<% 
	import org.exoplatform.faq.service.Category;
	import org.exoplatform.faq.service.Question;
	import org.exoplatform.faq.webui.FAQUtils;
%>
<div class="ResultQuickSearch $uicomponent.id" style="padding:8px">
		<% uiform.begin() %>
		<div class="UIForm">
					<div class="TitleMoveThreads"><%= _ctx.appRes("ResultQuickSearch.title.result"); %></div>
 					<div class="UIHorizontalLayout">
 							<div class="UIPermissionManager">
 								<div class="UIPermissionInfo">
 									<table class="UIGrid" cellspacing="0" border="0" cellpadding="0">
 										<thead>
 											<tr>
 												<th style="width:40px">&nbsp;</th>
 												<th><%= _ctx.appRes("ResultQuickSearch.title.name"); %></th>
 												<th style="width:90px"><%= _ctx.appRes("ResultQuickSearch.title.createdate"); %></th>
 												<th style="width:60px;"><%= _ctx.appRes("ResultQuickSearch.title.action"); %></th>
 											</tr>
 										</thead>
 										<tbody>
 										<% 
 										List searchResults = uicomponent.getSearchResults() ; 
 										if(searchResults != null && searchResults.size() > 0){
 											for(result in searchResults) {
												String Id = result.getId();
												String name = result.getName() ;
						 						String date = FAQUtils.getShortDateFormat(result.getCreatedDate());
						 						String icon = result.getIcon() ;
						 						String categoryLink = uicomponent.event("OpenCategory",Id);
						 						String linkQuestion = uicomponent.event("LinkQuestion",Id);
 										 %>
 											<tr class="EvenRow">
 												<td class="text" style="text-align:center"><div class="$icon"><span></span></div></td>
 												<%
 												String title = name;
												if(name.length()>90) {
													title = FAQUtils.getTitle(title) ; 
													name = FAQUtils.getSubString(name, 90);
 												}%>
 												
 												<% if(result.getType().equals("faqCategory")) {
 												 %>
 												 	<td class="text" style="text-align:left"><a href="$categoryLink" title="$title">$name</a></td>
 												 	<td class="text" style="text-align:center">$date</td>
 													<td style="text-align:center">
 														<div onclick="$categoryLink"><div class="FAQViewIcon" style="margin:0px auto;"></div></div>
 													</td>	
 													<% } else { %>
 													<td class="text" style="text-align:left"><a href="$linkQuestion" title="$title">$name</a></td>
 												 	<td class="text" style="text-align:center">$date</td>
 													<td style="text-align:center">
 														<div onclick="$linkQuestion"><div class="FAQViewIcon" style="margin:0px auto;"></div></div>
 													</td>
 													<% } %>
 											</tr>
 											<% 
 												}
 											} else {
 										 %>
 										 <tr class="EvenRow">
												<td class="Tdbox" colspan="4" style="text-align:center">
													<div><%= _ctx.appRes("ResultSearch.title.no-matches"); %></div>
												</td>
			  							</tr>
										<% } %> 
 									</tbody>
 								</table>
 								<% 
 								long totalPages = uicomponent.getTotalpages("LIST_RESULT_SEARCH") ;
					       if(totalPages > 1) {
					       %>
 								<div style="overflow:auto;">
									<% uicomponent.renderChild(uicomponent.LIST_RESULT_SEARCH) ; %>
									<div style="clear:both;"><span></span></div>
								</div>
								<% } %>
 						</div>
 					</div>
 				</div>
 		</div>
 	
		 <div class="UIAction">
	      <a href="javascript:void(0);" onclick="<%=uicomponent.event("Close")%>" class="ActionButton LightBlueStyle"><%=_ctx.appRes(uicomponent.getName() + ".action.Close");%></a>
	    </div>
		<%uiform.end()%>
</div>