<%@ page buffer="100kb" %>
<%@ page import="vkc.view.WebShare" %>
<%@ page import="vkc.view.TabId" %>
<%@ page import="org.apache.struts.Globals" %>

<%@ taglib uri="struts-html"     prefix="html"     %>
<%@ taglib uri="struts-bean"     prefix="bean"     %>
<%@ 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" />
    <script type="text/javascript" src="<vkc:rewrite page='/common/utils.js'/>"></script>
	
	<vkc:cssinclude />
	    
    <script type="text/javascript">
    
    window.name = "MAINVIEW";
    var associatedTabId = <%=TabId.ADMIN_LDAP_TAB%>;
    var currentCalendar = null;
    	
    function init() {
      	var tabView = getTabView();
        var tabViewForm = tabView.document.forms[0];

        if (tabView && tabView.systemviewtype == "administrationview" && tabView.selectedTabId != associatedTabId) {
          	tabView.location.replace("<%=ctxPath%>/adminTabView.do?selectedTabId=<%=TabId.ADMIN_LDAP_TAB%>"
          						   + "&lastCategoryId=" + tabViewForm.lastCategoryId.value
          						   + "&lastFunctionalId=" + tabViewForm.lastFunctionalId.value
          						   + "&lastProjectId=" + tabViewForm.lastProjectId.value);
        }

        <logic:present name="<%=WebShare.INFO_KEY%>" scope="request">
          <bean:define id="msg" type="java.lang.String" scope="request" name="<%=WebShare.INFO_KEY%>"/>
          alert( '<vkc:message javascript="true" filter="false" key="<%=msg%>"/>' );
        </logic:present>

        var form = document.forms[ 0 ];
        form.name.focus();
    }

    </script>

</head>
<body onload="init();" topmargin="0" marginheight="0">
<table width="100%" cellspacing="1" cellpadding="5" border="0">
  <html:form action="/editLdapServer" method="post">

  <bean:define id="form" name="editLdapServerForm" scope="request" type="vkc.ldap.administration.form.EditLdapServerForm"/>

  <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" height="3" width="30"/></td></tr>

  <tr>
    <td width="100%" align="center" valign="center">
	  <table width="400" align="center" cellpadding="0" cellspacing="5" border="0">
        <logic:present name="<%=Globals.ERROR_KEY%>">
        <tr><td align="left" nowrap="nowrap" colspan="2"><font color="red"><b><vkc:errors/></b></font></td></tr>
        </logic:present>
		<tr>
      	  <td width="0" align="left" nowrap="nowrap" colspan="2"><vkc:message key="mandatory.field1"/>&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/>&nbsp;<vkc:message key="mandatory.field2"/></td>
        </tr>

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

		<tr>
		  <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.administration.ldap.serverUrl" />:</b>&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/></td>
		  <td width="100%" align="left"><vkc:text property="serverUrl" styleClass="inputField" maxlengthProperty="ldap.serverUrl"/></td>
		</tr>

		<tr>
		  <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.administration.ldap.description" />:</b>&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/></td>
		  <td width="100%" align="left"><vkc:text property="description" styleClass="inputField" maxlengthProperty="ldap.description"/></td>
		</tr>

        <tr>
          <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.administration.ldap.authmethod" />:</b>&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/></td>
		  <td width="100%" align="left">
          <bean:define id="authMethods" name="form" property="authenticationMethods" type="java.util.List"/>
		    <html:select property="authmethod">
              <vkc:options name="authMethods"/>
            </html:select>  
		  </td>
<!--
		  <td width="100%" align="left"><vkc:text property="authmethod" styleClass="inputField" maxlengthProperty="ldap.authmethod"/></td>
-->
        </tr>

		<tr>
		  <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.administration.ldap.basedn" />:</b>&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/></td>
		  <td width="100%" align="left"><vkc:text property="baseDN" styleClass="inputField" maxlengthProperty="ldap.basedn"/></td>
		</tr>

		<tr>
		  <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.administration.ldap.usersBaseDN" />:</b>&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/></td>
		  <td width="100%" align="left"><vkc:text property="usersBaseRDN" styleClass="inputField" maxlengthProperty="ldap.usersBaseRDN"/></td>
		</tr>

		<tr>
		  <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.administration.ldap.groupsBaseRDN" />:</b>&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/></td>
		  <td width="100%" align="left"><vkc:text property="groupsBaseRDN" styleClass="inputField" maxlengthProperty="ldap.groupsBaseRDN"/></td>
		</tr>

        <vkc:hline colspan="2" lineClass="hline" lineHeight="1" topSpace="0" bottomSpace="0"/>
                
		<tr colspan=2>
		  <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.administration.ldap.mappings" />:</b></td>
		</tr>

		<tr>
		  <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.administration.ldap.mapping.loginAttr" />:</b>&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/></td>
		  <td width="100%" align="left"><vkc:text property="mappingLoginAttr" styleClass="inputField" maxlengthProperty="ldap.mapping.loginAttr"/></td>
		</tr>
		
		<tr>
		  <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.administration.ldap.mapping.email" />:</b></td>
		  <td width="100%" align="left"><vkc:text property="mappingEmail" styleClass="inputField" maxlengthProperty="ldap.mapping.email"/></td>
		</tr>

		<tr>
		  <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.administration.ldap.mapping.userId" />:</b>&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/></td>
		  <td width="100%" align="left"><vkc:text property="mappingUserId" styleClass="inputField" maxlengthProperty="ldap.mapping.userId"/></td>
		</tr>

		<tr>
		  <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.administration.ldap.mapping.fullName" />:</b>&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/></td>
		  <td width="100%" align="left"><vkc:text property="mappingFullName" styleClass="inputField" maxlengthProperty="ldap.mapping.fullName"/></td>
		</tr>

		<tr>
		  <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.administration.ldap.mapping.language" />:</b></td>
		  <td width="100%" align="left"><vkc:text property="mappingLanguage" styleClass="inputField" maxlengthProperty="ldap.mapping.language"/></td>
		</tr>

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

		<tr>
		  <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.administration.ldap.enabled.true" />:</b></td>
          <td width="100%" align="left"><html:checkbox property="enabled"/></td>
		</tr>

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

		<tr>
		  <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.administration.ldap.lastChanger"/>:</b></td>
		  <td width="100%" align="left"><vkc:write name="form" property="lastChanger"/></td>
		</tr>

		<tr>
		  <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.administration.ldap.lastChanged"/>:</b></td>
		  <td width="100%" align="left"><vkc:write name="form" property="lastChanged" formatKey="date.medium.format"/></td>
		</tr>

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

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