<%--
  The contents of this file are subject to the Mozilla Public License Version 1.1
  (the "License"); you may not use this file except in compliance with the License.
  You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.

  Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
  WARRANTY OF ANY KIND, either express or implied. See the License for the specific
  language governing rights and limitations under the License.
  
  The Original Code is the Venice Web Communities System.
  
  The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
  for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
  Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.

  Contributor(s): 
--%>
<%@ page import = "java.util.*" %>
<%@ page import = "com.silverwrist.venice.core.*" %>
<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %>
<%@ taglib uri="/tlds/util" prefix="util" %>
<%@ taglib uri="/tlds/community" prefix="comm" %>
<%
  JSPView view = JSPView.get(request);
%>
<util:comment>Category browser for community "<comm:name/>"</util:comment>
<util:header title="Set Community Category:">
  <util:subtitle><util:escape><comm:name/></util:escape></util:subtitle>
</util:header>

<DIV ALIGN="LEFT"><util:xlink>
  <util:href type="servlet">comm/admin_menu.js.vs?cc=<comm:ID/></util:href>
  <util:text><util:button id="cancel"/></util:text>
</util:xlink></DIV>

<util:font color="content.fg" size="content">
  <% CategoryDescriptor prev_cat = (CategoryDescriptor)(view.getRequestAttribute("category.previous")); %>
  <B>Previous community Category:</B> <util:escape><%= prev_cat.toString() %></util:escape><P>
  <B>Current category:</B><BR>
  <% CategoryDescriptor curr_cat = (CategoryDescriptor)(view.getRequestAttribute("category.current")); %>
  <% if (curr_cat.getCategoryID()>=0) { %><util:xlink>
    <util:href type="servlet">comm/category.js.vs?cc=<comm:ID/>&go=-1</util:href>
    <util:text>Top</util:text>
  </util:xlink><% } else { %>Top<% } // end if %>:
  <% for (int i=0; i<curr_cat.getNumLevels(); i++) { %>
    <% int tmpid = curr_cat.getIDAtLevel(i); %>
    <% if (tmpid!=curr_cat.getCategoryID()) { %><util:xlink>
      <util:href type="servlet">comm/category.js.vs?cc=<comm:ID/>&go=<%= tmpid %></util:href>
      <util:text><util:escape><%= curr_cat.getTitleAtLevel(i) %></util:escape></util:text>
    </util:xlink>: <% } else { %><util:escape><%= curr_cat.getTitleAtLevel(i) %></util:escape><% } %>
  <% } // end for %>
  <% if (curr_cat.getCategoryID()>=0) { %>&nbsp;&nbsp;&nbsp;&nbsp;[<util:xlink>
  <util:href type="servlet">comm/category.js.vs?cc=<comm:ID/>&set=<%= curr_cat.getCategoryID() %></util:href>
    <util:text>set</util:text>
  </util:xlink>]<% } // end if %>

  <P><B>Subcategories:</B><BR>
  <% List subcats = (List)(view.getRequestAttribute("category.subcats")); %>
  <% if (subcats.size()>0) { %>
    <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=2>
      <% Iterator it = subcats.iterator(); %>
      <% while (it.hasNext()) { %>
        <% CategoryDescriptor c = (CategoryDescriptor)(it.next()); %>
        <% int subid = c.getLinkedCategoryID(); %>
        <TR VALIGN=MIDDLE>
          <TD ALIGN=CENTER WIDTH=14><util:stdbullet/></TD>
          <TD ALIGN=LEFT CLASS="content"><util:font color="content.fg" size="content">
            <util:xlink>
              <util:href type="servlet">comm/category.js.vs?cc=<comm:ID/>&go=<%= subid %></util:href>
              <util:text><util:escape><%= c.getTitleAtLevel(c.getNumLevels()-1) %></util:escape></util:text>
            </util:xlink>
            <% if (c.isSymbolicLink()) { %><EM>@</EM><% } %>
            &nbsp;&nbsp;&nbsp;&nbsp;[<util:xlink>
              <util:href type="servlet">comm/category.js.vs?cc=<comm:ID/>&set=<%= subid %></util:href>
              <util:text>set</util:text>
            </util:xlink>]
          </util:font></TD>
        </TR>
      <% } // end while %>
    </TABLE>
  <% } else { %><EM>(None)</EM><% } // end if (subcategory display) %><P>

  Click on a subcategory name to make that category the currently displayed one.<P>
  Click on a [set] link to set that category as the community's new category and return to the
  <B>Community Administration</B> menu.<P>

</util:font>
