<%@ page language="java" buffer="100kb" errorPage="/common/error.jsp"%>

<%@ page import="vkc.view.form.DisplayAclForm"%>

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

<vkc:checkLogin/>
<vkc:init/>
<html:html locale="true">
<head>
  <meta http-equiv="Content-Type" 	content="text/html; charset=iso-8859-1">
  <meta http-equiv="cache" 			content="no-cache">
  <meta http-equiv="expires" 		content="1">

  <vkc:cssinclude />

  <script type="text/javascript" src="<vkc:rewrite page='/common/utils.js'/>"></script>
  <title><vkc:message key="vkc.aclviewer.title"/></title>

  <script type="text/javascript">
  function selectChanged() {
      var form = document.forms[0];
      form.ctrlAction.value = <%= DisplayAclForm.ACTION_CHANGE_SELECT %>;
      form.submit();
  }  

  function submitClose(elem) {
      var form = document.forms[0];
      form.ctrlAction.value = <%= DisplayAclForm.ACTION_CLOSE %>;
      disableAllButtons(elem);
      form.submit();
  }  
  </script>
</head>

<body>
  <html:form action="/displayAcl" method="post">
  <bean:define id="form" name="displayAclForm" scope="request" type="vkc.view.form.DisplayAclForm"/>
  <%-- Hidden fields --%>
  <html:hidden property="ctrlAction"/>
  <html:hidden property="categoryId"/>
  <html:hidden property="defaultAcl"/>
  <html:hidden property="ownWindow"/>
  <html:hidden property="sourcePageId"/>
  <logic:notEmpty name="form" property="targetId">
    <html:hidden property="targetId"/>
  </logic:notEmpty>
  <logic:notEmpty name="form" property="subTargetId">
    <html:hidden property="subTargetId"/>
  </logic:notEmpty>

  <table class="color_dialogborder" cellspacing="0" cellpadding="3" border="0" align="center">
    <%-- Ueberschrift --%>
    <tr>
      <td class="color_default_background"><vkc:img page="/templates/${template.name}/gfx/trans.gif" width="1" height="1" border="0" alt=""/></td>
    <tr>
    <tr>
      <td class="color_titlebar" align="center">
        <font style="font-family:sans-serif; font-size:12pt; color:white;"><b><i><vkc:message key="vkc.aclviewer.title"/></i></b></font>
      </td>
    </tr>
    <%-- Umgebende Dialogtabelle --%>
    <tr>
      <td>
        <table class="color_dialogborder" cellspacing="10" border="0" width="100%">
          <%-- Anzeige des Kategorienamens --%>
          <tr>
            <td width="99%" valign="top">
              <table width="100%" cellspacing="0" cellpadding="0">
                <tr>
                  <td valign="top" width="1%">
                    <b><vkc:message key="vkc.category"/>:</b>&nbsp;
                  </td>
                  <td valign="top" width="99%">
                    <vkc:write name="form" property="categoryPath"/>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
          <logic:equal name="form" property="defaultAcl" value="true">
            <tr>
              <td>
                <b><vkc:message key="vkc.acl.isDefaultAcl"/>:</b>
              </td>
            </tr>
          </logic:equal>
          <tr>
            <td width="99%" valign="top">
              <%-- Haupttabelle mit Namens-Select und Liste der Berechtigungen --%>
              <table class="color_bodycontent" cellspacing="0" border="0" width="100%">
                <tr>
                  <%-- Ueberschrift des Namens-Select --%>
                  <td class="color_highlightbar">
                    <b><vkc:message key="vkc.acl.users_and_groups"/></b>
                  </td>
                </tr>
                <tr>
                  <td width="99%">
                    <bean:define property="users" name="form" id ="usersCollection"/>
                    <bean:define property="groups" name="form" id="groupsCollection"/>
                    <bean:define property="anyothers" name="form" id="anyotherCollection"/>
                    <bean:define property="ldapGroups" name="form" id="ldapGroupsCollection"/>
                    <html:select property="accessorSelect" size="8" style="width:100%" onchange="javascript:selectChanged();" styleClass="color_bodycontent">
                      <vkc:options collection="anyotherCollection" property="selectIdString" labelProperty="accessorName"/>
                      <logic:notEmpty name="usersCollection">
                        <optgroup label="<vkc:message key='vkc.users'/>">
                          <vkc:options collection="usersCollection" property="selectIdString" labelProperty="accessorName"/>
                        </optgroup>
                      </logic:notEmpty>
                      <logic:notEmpty name="groupsCollection">
                        <optgroup label="<vkc:message key='vkc.groups'/>">
                          <vkc:options collection="groupsCollection" property="selectIdString" labelProperty="accessorName"/>
                        </optgroup>
                      </logic:notEmpty>
                      <logic:notEmpty name="ldapGroupsCollection">
                        <optgroup label="<vkc:message key='vkc.ldapGroups'/>">
                          <vkc:options collection="ldapGroupsCollection" property="selectIdString" labelProperty="accessorName"/>
                        </optgroup>
                      </logic:notEmpty>
                    </html:select>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
          <tr>
            <td>
              <%-- Berechtigungen --%>
              <table class="color_bodycontent" cellspacing="0" border="0" width="100%">
                <tr>
                  <%-- Ueberschrift Berechtigungstabelle --%>
                  <td class="color_highlightbar">
                    <b><vkc:message key="vkc.acl.perms_for"/></b>
                  </td>
                  <td class="color_highlightbar" width="100">
                    <b><vkc:message key="vkc.acl.allow"/></b>
                  </td>
                </tr>
                <!-- Einzelne Berechtigungen -->
                <logic:equal name="form" property="changeAclEnabled" value="true">
                  <tr>
                    <td>
                      <vkc:message key="vkc.acl.category.perm_c"/>
                    </td>
                    <td>
                     <logic:equal name="form" property="changeAcl" value="true"><input type="checkbox" name="acl_c" value="on" checked="checked" disabled="disabled"></logic:equal>
                     <logic:notEqual name="form" property="changeAcl" value="true"><input type="checkbox" name="acl_c" value="off" disabled="disabled"></logic:notEqual>
                    </td>
                  </tr>
                </logic:equal>
                <logic:equal name="form" property="readCategoryEnabled" value="true">
                  <tr>
                    <td>
                      <vkc:message key="vkc.acl.category.perm_r"/>
                    </td>
                    <td>
                     <logic:equal name="form" property="readCategory" value="true"><input type="checkbox" name="acl" value="on" checked="checked" disabled="disabled"></logic:equal>
                     <logic:notEqual name="form" property="readCategory" value="true"><input type="checkbox" name="acl" value="off" disabled="disabled"></logic:notEqual>
                    </td>
                  </tr>
                </logic:equal>
                <logic:equal name="form" property="writeCategoryEnabled" value="true">
                  <tr>
                    <td>
                      <vkc:message key="vkc.acl.category.perm_w"/>
                    </td>
                    <td>
                     <logic:equal name="form" property="writeCategory" value="true"><input type="checkbox" name="acl" value="on" checked="checked" disabled="disabled"></logic:equal>
                     <logic:notEqual name="form" property="writeCategory" value="true"><input type="checkbox" name="acl" value="off" disabled="disabled"></logic:notEqual>
                    </td>
                  </tr>
                </logic:equal>
                <logic:equal name="form" property="deleteDocumentsEnabled" value="true">
                  <tr>
                    <td>
                      <vkc:message key="vkc.acl.category.perm_d"/>
                    </td>
                    <td>
                     <logic:equal name="form" property="deleteDocuments" value="true"><input type="checkbox" name="acl" value="on" checked="checked" disabled="disabled"></logic:equal>
                     <logic:notEqual name="form" property="deleteDocuments" value="true"><input type="checkbox" name="acl" value="off" disabled="disabled"></logic:notEqual>
                    </td>
                  </tr>
                </logic:equal>
                <logic:equal name="form" property="archiveCategoryEnabled" value="true">
                  <tr>
                    <td>
                      <vkc:message key="vkc.acl.category.perm_a"/>
                    </td>
                    <td>
                      <html:checkbox property="archiveCategory"/>
                    </td>
                  </tr>
                </logic:equal>
                <logic:equal name="form" property="editQueryVirtualDocsEnabled" value="true">
                  <tr>
                    <td>
                      <vkc:message key="vkc.acl.category.perm_q"/>
                    </td>
                    <td>
                      <html:checkbox property="editQueryVirtualDocs"/>
                    </td>
                  </tr>
                </logic:equal>
                <logic:equal name="form" property="deleteCategoryEnabled" value="true">
                  <tr>
                    <td>
                      <vkc:message key="vkc.acl.category.perm_D"/>
                    </td>
                    <td>
                     <logic:equal name="form" property="deleteCategory" value="true"><input type="checkbox" name="acl" value="on" checked="checked" disabled="disabled"></logic:equal>
                     <logic:notEqual name="form" property="deleteCategory" value="true"><input type="checkbox" name="acl" value="off" disabled="disabled"></logic:notEqual>
                    </td>
                  </tr>
                </logic:equal>
                <logic:equal name="form" property="createSubcategoryEnabled" value="true">
                  <tr>
                    <td>
                      <vkc:message key="vkc.acl.category.perm_C"/>
                    </td>
                    <td>
                     <logic:equal name="form" property="createSubcategory" value="true"><input type="checkbox" name="acl" value="on" checked="checked" disabled="disabled"></logic:equal>
                     <logic:notEqual name="form" property="createSubcategory" value="true"><input type="checkbox" name="acl" value="off" disabled="disabled"></logic:notEqual>
                    </td>
                  </tr>
                </logic:equal>
                <logic:equal name="form" property="createLinkToCategoryEnabled" value="true">
                  <tr>
                    <td>
                      <vkc:message key="vkc.acl.category.perm_L"/>
                    </td>
                    <td>
                     <logic:equal name="form" property="createLinkToCategory" value="true"><input type="checkbox" name="acl" value="on" checked="checked" disabled="disabled"></logic:equal>
                     <logic:notEqual name="form" property="createLinkToCategory" value="true"><input type="checkbox" name="acl" value="off" disabled="disabled"></logic:notEqual>
                    </td>
                  </tr>
                </logic:equal>
                <logic:equal name="form" property="followLinkToCategoryEnabled" value="true">
                  <tr>
                    <td>
                      <vkc:message key="vkc.acl.category.perm_F"/>
                    </td>
                    <td>
                     <logic:equal name="form" property="followLinkToCategory" value="true"><input type="checkbox" name="acl" value="on" checked="checked" disabled="disabled"></logic:equal>
                     <logic:notEqual name="form" property="followLinkToCategory" value="true"><input type="checkbox" name="acl" value="off" disabled="disabled"></logic:notEqual>
                    </td>
                  </tr>
                </logic:equal>
                <logic:equal name="form" property="createLinkToDocumentEnabled" value="true">
                  <tr>
                    <td>
                      <vkc:message key="vkc.acl.category.perm_l"/>
                    </td>
                    <td>
                     <logic:equal name="form" property="createLinkToDocument" value="true"><input type="checkbox" name="acl" value="on" checked="checked" disabled="disabled"></logic:equal>
                     <logic:notEqual name="form" property="createLinkToDocument" value="true"><input type="checkbox" name="acl" value="off" disabled="disabled"></logic:notEqual>
                    </td>
                  </tr>
                </logic:equal>
                <logic:equal name="form" property="followLinkToDocumentEnabled" value="true">
                  <tr>
                    <td>
                      <vkc:message key="vkc.acl.category.perm_f"/>
                    </td>
                    <td>
                     <logic:equal name="form" property="followLinkToDocument" value="true"><input type="checkbox" name="acl" value="on" checked="checked" disabled="disabled"></logic:equal>
                     <logic:notEqual name="form" property="followLinkToDocument" value="true"><input type="checkbox" name="acl" value="off" disabled="disabled"></logic:notEqual>
                    </td>
                  </tr>
                </logic:equal>
              </table>
            </td>
          </tr>
          <tr>
            <td>
            <logic:equal name="form" property="ownWindow" value="true">
            <%-- Button Fenster schließen --%>
              <vkc:button property="close_action" onclick="javascript:disableAllButtons(this);window.close();">
                <vkc:message key="button.close"/>
              </vkc:button>
            </logic:equal>
            <logic:notEqual name="form" property="ownWindow" value="true">
              <vkc:button property="close_action" onclick="javascript:submitClose(this);">
                <vkc:message key="button.exit"/>
              </vkc:button>
            </logic:notEqual>
           </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</html:form>
</body>
</html:html>