<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/struts-tags" prefix="ww" %>
<html>
<head>
    <title>
        <ww:text name="menu.viewdirectory.label">
            <ww:param><ww:property value="directory.name"/></ww:param>
        </ww:text>
    </title>
    <meta name="section" content="directories"/>
    <meta name="pagename" content="view"/>
    <meta name="help.url" content="<ww:text name="help.directory.crowd.connection"/>"/>
    <script>
        <ww:include value="inc_test_connection.jsp">
            <ww:param name="formId" value="'crowddetails'" />
            <ww:param name="directoryId" value="ID" />
            <ww:param name="directoryType" value="'crowd'" />
            <ww:param name="messagePrefix" value="'directorycrowd'" />
        </ww:include>

        <ww:include value="../includes/inc_edit_password_events.jsp">
            <ww:param name="passwordFieldId" value="'applicationPassword'" />
        </ww:include>

        AJS.$(function() {
            wireEditPasswordEvents();
            <ww:if test="containsErrorMessages()">
            AJS.$("#edit-password").click();
            </ww:if>
        });
    </script>
</head>
<body>
<h2>
    <ww:text name="menu.viewdirectory.label">
        <ww:param><ww:property value="directory.name"/></ww:param>
    </ww:text>
</h2>

<div class="aui-tabs horizontal-tabs aui-tabs-disabled">
    <jsp:include page="inc_tabs_crowd.jsp">
        <jsp:param name="selectedTab" value="2" />
    </jsp:include>
    <div class="tabs-pane active-pane">
        <ww:set name="formContent">
            <ww:textfield name="url" size="50">
                <ww:param name="label" value="getText('directorycrowd.url.label')"/>
                <ww:param name="description">
                    <ww:property value="getText('directorycrowd.url.description')"/>
                </ww:param>
                <ww:param name="required" value="true" />
            </ww:textfield>
            <ww:textfield name="applicationName" size="50">
                <ww:param name="label" value="getText('directorycrowd.applicationname.label')"/>
                <ww:param name="description">
                    <ww:property value="getText('directorycrowd.applicationname.description')"/>
                </ww:param>
                <ww:param name="required" value="true" />
            </ww:textfield>
            <ww:password name="applicationPassword" size="50" disabled="true">
                <ww:param name="label" value="getText('directorycrowd.applicationpassword.label')"/>
                <ww:param name="description">
                    <ww:property value="getText('directorycrowd.applicationpassword.description')"/>
                </ww:param>
                <ww:param name="required" value="true" />
                <ww:param name="fieldAfter">
                    <button id="edit-password" type="button" class="aui-button">
                        <span class="aui-icon aui-icon-small aui-iconfont-edit"> </span>
                        <ww:property value="getText('directory.passwordupdate.startchange')"/>
                    </button>
                    <button id="cancel-edit-password" type="button" class="aui-button aui-button-subtle hidden">
                        <ww:property value="getText('directory.passwordupdate.endchange')"/>
                    </button>
                </ww:param>
            </ww:password>
            <ww:textfield name="httpTimeout">
                <ww:param name="label" value="getText('directorycrowd.http.timeout.label')"/>
                <ww:param name="type" value="'number'" />
                <ww:param name="fieldWidth" value="'short'"/>
                <ww:param name="description">
                    <ww:property value="getText('directorycrowd.http.timeout.description')"/>
                </ww:param>
            </ww:textfield>
            <ww:textfield name="httpMaxConnections">
                <ww:param name="label" value="getText('directorycrowd.http.maxconnections.label')"/>
                <ww:param name="type" value="'number'" />
                <ww:param name="fieldWidth" value="'short'"/>
                <ww:param name="description">
                    <ww:property value="getText('directorycrowd.http.maxconnections.description')"/>
                </ww:param>
            </ww:textfield>
            <ww:textfield name="httpProxyHost" size="50">
                <ww:param name="label" value="getText('directorycrowd.proxy.host.label')"/>
                <ww:param name="description">
                    <ww:property value="getText('directorycrowd.proxy.host.description')"/>
                </ww:param>
            </ww:textfield>
            <ww:textfield name="httpProxyPort">
                <ww:param name="label" value="getText('directorycrowd.proxy.port.label')"/>
                <ww:param name="description">
                    <ww:property value="getText('directorycrowd.proxy.port.description')"/>
                </ww:param>
            </ww:textfield>
            <ww:textfield name="httpProxyUsername">
                <ww:param name="label" value="getText('directorycrowd.proxy.username.label')"/>
                <ww:param name="description">
                    <ww:property value="getText('directorycrowd.proxy.username.description')"/>
                </ww:param>
            </ww:textfield>
            <ww:password name="httpProxyPassword">
                <ww:param name="label" value="getText('directorycrowd.proxy.password.label')"/>
                <ww:param name="description">
                    <ww:property value="getText('directorycrowd.proxy.password.description')"/>
                </ww:param>
            </ww:password>
            <ww:checkbox name="incrementalSyncEnabled" fieldValue="true">
                <ww:param name="label" value="getText('directorycrowd.incrementalsync.enable.label')"/>
                <ww:param name="description">
                    <ww:property value="getText('directorycrowd.incrementalsync.enable.description')"/>
                </ww:param>
            </ww:checkbox>
            <div id="polling_interval">
                <ww:textfield name="pollingIntervalInMin">
                    <ww:param name="label" value="getText('directorycrowd.polling.interval.label')"/>
                    <ww:param name="type" value="'number'" />
                    <ww:param name="fieldWidth" value="'short'"/>
                    <ww:param name="description">
                        <ww:property value="getText('directorycrowd.polling.interval.description')"/>
                    </ww:param>
                </ww:textfield>
            </div>
            <ww:if test="directoryCachingEnabled">
                <ww:component template="synchronisable_directory_settings.jsp"/>
            </ww:if>
            <div class="field-group">
                <input id="test-connection" type="button" class="aui-button" value="<ww:property value="getText('directorycrowd.testconnection.label')"/>" onClick="testConfiguration();"/>
            </div>
            <input type="hidden" name="ID" value="<ww:property value="ID" />"/>
        </ww:set>
        <ww:component template="form.jsp" id="crowddetails">
            <ww:param name="action"><ww:url namespace="/console/secure/directory" action="updateremotecrowdconnection" method="update" includeParams="none" /></ww:param>
            <ww:param name="content" value="#formContent" />
            <ww:param name="cancelUri"><ww:url namespace="/console/secure/directory" action="viewremotecrowd" method="default" includeParams="none" ><ww:param name="ID" value="ID" /></ww:url></ww:param>
        </ww:component>
    </div>
</div>

</body>
</html>
