<%--
  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 Community 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 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.

  Contributor(s): 
--%>
<%@ page import = "java.util.*" %>
<%@ page import = "com.silverwrist.util.StringUtil" %>
<%@ page import = "com.silverwrist.venice.core.*" %>
<%@ page import = "com.silverwrist.venice.servlets.Variables" %>
<%@ page import = "com.silverwrist.venice.servlets.format.*" %>
<%
  CommunityCategoryBrowseData data = CommunityCategoryBrowseData.retrieve(request);
  Variables.failIfNull(data);
  RenderData rdat = RenderConfig.createRenderData(application,request,response);
  CategoryDescriptor cat = data.getCurrentCategory();
  int catid = cat.getCategoryID();
%>
<% rdat.writeContentHeader(out,"Set Community Category:",data.getCommunityName()); %>
<DIV ALIGN="LEFT">
  <A HREF="<%= data.getCancelURL(rdat) %>"><IMG SRC="<%= rdat.getFullImagePath("bn_cancel.gif") %>"
                                                ALT=\"Cancel\" WIDTH=80 HEIGHT=24 BORDER=0></A>
</DIV>
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
  <B>Previous community Category:</B> <%= StringUtil.encodeHTML(data.getPreviousCategory()) %><P>
  <B>Current category:</B><BR>
  <% if (catid>=0) { %><A HREF="<%= data.getGoLink(rdat,-1) %>"><% } %>Top<% if (catid>=0) { %></A><% } %>:
  <% for (int i=0; i<cat.getNumLevels(); i++) { %>
    <% int tmpid = cat.getIDAtLevel(i); %>
    <% if (catid!=tmpid) { %><A HREF="<%= data.getGoLink(rdat,tmpid) %>"><% } %><%= StringUtil.encodeHTML(cat.getTitleAtLevel(i)) %><% if (catid!=tmpid) { %></A>: <% } %>
  <% } // end for %>

  <% if (catid>=0) { %>&nbsp;&nbsp;&nbsp;&nbsp;[<A HREF="<%= data.getSetLink(rdat,catid) %>">set</A>]<% } %>

  <P><B>Subcategories:</B><BR>
  <% if (data.hasSubcategories()) { %>
    <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=2>
      <% Iterator it = data.getSubcategoryIterator(); %>
      <% while (it.hasNext()) { %>
        <% CategoryDescriptor c = (CategoryDescriptor)(it.next()); %>
        <% int subid = c.getLinkedCategoryID(); %>
        <TR VALIGN=MIDDLE>
          <TD ALIGN=CENTER WIDTH=14>
            <IMG SRC="<%= rdat.getFullImagePath("purple-ball.gif") %>" ALT="*" WIDTH=14 HEIGHT=14 BORDER=0>
          </TD>
          <TD ALIGN=LEFT CLASS="content"><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
            <A HREF="<%= data.getGoLink(rdat,subid) %>"><%= StringUtil.encodeHTML(c.getTitleAtLevel(c.getNumLevels()-1)) %></A>
            <% if (c.isSymbolicLink()) { %><EM>@</EM><% } %>
            &nbsp;&nbsp;&nbsp;&nbsp;[<A HREF="<%= data.getSetLink(rdat,subid) %>">set</A>]
          </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>

</FONT>
