<%@ page language="java" %>

<%@ taglib uri="struts-bean"  prefix="bean"  %>
<%@ taglib uri="struts-html"  prefix="html"  %>
<%@ taglib uri="struts-logic" prefix="logic" %>
<%@ taglib uri="vkc-taglib"   prefix="vkc"   %>

<html:html locale="true">
<vkc:init/>
<head>
  <vkc:cssinclude />
  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
  <title><vkc:message key="vkc"/></title>	
  <script type="text/javascript" src="<vkc:rewrite page='/common/utils.js'/>"></script>

  <script type="text/javascript">
    window.name = "SEARCHCATEGORIESVIEW";

    function navigateToCategory(categoryId) {    
        window.opener.location.replace('<vkc:rewrite page="/showCategory.do"/>?categoryId=' + categoryId);
    }
  </script>
</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgColor="dddddd">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
  <html:form action="/searchCategory" method="post">
  <bean:define id="form" name="searchCategoryForm" type="vkc.view.form.SearchCategoryForm"/>
  
  <logic:notEmpty name="form" property="categories">	  
  <bean:define id="categories" name="form" property="categories"/>
  <%
    int notInTrashCount = 0;
    request.setAttribute("notInTrash", "0");
  %>
  <logic:iterate id="category" name="categories" type="vkc.db.entities.VKCCategory">
  <bean:define id="categoryId" name="category" property="categoryId" type="java.lang.Integer"/>

  <logic:equal name="category" property="inTrash" value="false">
  <%
    notInTrashCount++;
    request.setAttribute("notInTrash", String.valueOf(notInTrashCount));
  %>
  <tr class="color_doctitle"> 			
    <td valign="bottom"><vkc:img page='<%="/templates/" + template + "/gfx/" + category.getFolderImage()%>' altKey='vkc.category' border='0'/><vkc:img page="/templates/${template.name}/gfx/trans.gif" width="10" alt="" /><vkc:link href='<%="javascript:navigateToCategory(" + categoryId + ")"%>'><vkc:write name="category" property="absPathDescrString"/></vkc:link></td>
  </tr>

  <%-- Beschreibung  --%>
  <tr>          
    <td>
      <table width="100%" cellspacing="0" cellpadding="0" border="0">
        <tr>     		 
          <td width="50%" valign="top">
            <table cellspacing="0" cellpadding="0" border="0">
              <tr>
                <td valign="top"><b><vkc:message key="vkc.search.category.description"/>&nbsp</b></td>
                <td valign="top">
                  <logic:equal name="form" property="tinyMCECompatible" value="true">
                  <vkc:write name="category" property="description" displayAsHTML="true" renderNewLine="true"/>
                  </logic:equal>
                  <logic:equal name="form" property="tinyMCECompatible" value="false">
                  <vkc:write name="category" property="description" stripHTML="true" renderNewLine="true"/>
                  </logic:equal>		          
                </td>	
              </tr>
            </table>
          </td>
          <td width="50%" valign="top">
            <table cellspacing="0" cellpadding="0" border="0">
              <tr>
                <td valign="top"><b><vkc:message key="vkc.search.category.keywords"/>&nbsp</b></td>
                <td valign="top"><vkc:write name="category" property="keywordsAsString"/></td>	
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>		          	     
  </tr>

  <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" height="10" alt="" /></td></tr>
  </logic:equal>
  
  </logic:iterate>

  <logic:equal name="notInTrash" value="0">
  <tr><td><b><vkc:message key="vkc.search.categoryNotFound"/></b></td></tr>
  </logic:equal>

  </logic:notEmpty>

  <logic:empty name="form" property="categories">
  <tr><td><b><vkc:message key="vkc.search.categoryNotFound"/></b></td></tr>
  </logic:empty>

  <vkc:hline colspan="5" lineClass="hline" lineHeight="1" topSpace="5" bottomSpace="5" />

  <tr>
    <td colspan="2" align="center"><vkc:button property="action.close" onclick="javascript:disableAllButtons(this);window.close();"><vkc:message key="button.close"/></vkc:button></td>
  </tr>
</html:form>
</table>
</body>
</html:html>