<% 
	import org.exoplatform.faq.service.Category;
	import org.exoplatform.faq.webui.FAQUtils;
%>
<div class="ResultSearchCategory $uicomponent.id" style="padding:8px;">
		<% uiform.begin() %>
		<div class="UIForm">
					<div class="TitleMoveThreads"><%= _ctx.appRes("ResultSearchCategory.title.resultCategory"); %></div>
 					<div class="UIHorizontalLayout">
 							<div class="UIPermissionManager">
 								<div class="UIPermissionInfo">
 									<table class="UIGrid" cellspacing="0" border="0" cellpadding="0">
 										<thead>
 											<tr>
 												<th style="width:30px"><%= _ctx.appRes("ResultSearchCategory.title.icon"); %></th>
 												<th><%= _ctx.appRes("ResultSearchCategory.title.category"); %></th>
 												<th><%= _ctx.appRes("ResultSearchCategory.title.description"); %></th>
 												<th><%= _ctx.appRes("ResultSearchCategory.title.created-date"); %></th>
 												<th style="width:30px"><%= _ctx.appRes("ResultSearchCategory.title.action"); %></th>
 											</tr>
 										</thead>
 										<tbody>
 										<% 
 										List categories = uicomponent.getListCategory() ; 
 										if(categories.size() > 0) {
											for(category in categories) {
												String categoryId = category.getId();
												String categoryName = category.getName() ;
												String description = category.getDescription() ;
						 						String date = FAQUtils.getShortDateFormat(category.getCreatedDate());
												String link = uicomponent.event("Link", categoryId);
 										 	%>
	 											<tr class="EvenRow"> 
	 												<td class="text" style="text-align:center"><div class="FAQCategorySearch"><span></span></div></td>
		 											<%
													if(categoryName.length()>70) {
														String title = categoryName ;
														title = FAQUtils.getTitle(title) ;
														categoryName = FAQUtils.getSubString(categoryName, 70);
													%>
													<td class="text" align="left"><a href="$link" title="$title">$categoryName</a></td>
													<%
													} else {
													%>
													<td class="text" align="left"><a href="$link">$categoryName</a></td>
													<%}%>
													<% if(description != null) {
															if(description.length()>25) {
															String titledescrip = description ;
															titledescrip = FAQUtils.getTitle(titledescrip) ;
															description = FAQUtils.getSubString(description, 25);
															%> 
															<td class="text" style="text-algin:left"><a title="$titledescrip">$description</a></td>
															<%  } else { %>
															<td class="text" style="text-algin:left"><%=description%></td>
															<% }
	 												 } else { %>
	 												<td class="text" style="text-algin:left"><%=""%></td>
	 												<% } %>
	 												<td class="text" align="center"><%=date%></td>
	 												<td style="cursor:pointer; text-align:center">
 														<div onclick="$link"><div class="CheckIcon" style="margin:0px auto; cursor:pointer;"></div></div>
 													</td>
	 											</tr>
 												<% 
 												}
 											} else {
 										 %>
 										 <tr class="EvenRow">
												<td class="Tdbox" colspan="5" 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>
								<% } %>
 						</div>
 					</div>
 				</div>
 		</div>
		<%uiform.end()%>
</div>