소스 검색

custom link refactoring

Jason Rivard 8 년 전
부모
커밋
c7b7a0227e

+ 4 - 1
pom.xml

@@ -293,7 +293,7 @@
                         <artifactId>jspc-compiler-tomcat7</artifactId>
                         <version>2.0.2</version>
                     </dependency>
-				</dependencies>
+                </dependencies>
                 <configuration>
                     <includeInProject>false</includeInProject>
                 </configuration>
@@ -505,6 +505,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-jar-plugin</artifactId>
+                <version>3.0.2</version>
                 <executions>
                     <execution>
                         <id>make-a-jar</id>
@@ -518,6 +519,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-install-plugin</artifactId>
+                <version>2.5.2</version>
                 <executions>
                     <execution>
                         <phase>install</phase>
@@ -539,6 +541,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-deploy-plugin</artifactId>
+                <version>2.8.2</version>
                 <executions>
                     <execution>
                         <phase>deploy</phase>

+ 5 - 58
src/main/java/password/pwm/config/CustomLinkConfiguration.java

@@ -22,10 +22,9 @@
 
 package password.pwm.config;
 
-import password.pwm.i18n.Display;
+import lombok.Getter;
 import password.pwm.util.LocaleHelper;
 import password.pwm.util.java.JsonUtil;
-import password.pwm.util.java.StringUtil;
 
 import java.io.Serializable;
 import java.util.Collections;
@@ -35,8 +34,8 @@ import java.util.Map;
 /**
  * @author Richard A. Keil
  */
+@Getter
 public class CustomLinkConfiguration implements Serializable {
-// ------------------------------ FIELDS ------------------------------
 
     public enum Type {text, url, select, checkbox, customLink}
 
@@ -44,19 +43,10 @@ public class CustomLinkConfiguration implements Serializable {
     private Type type = Type.customLink;
     private Map<String,String> labels = Collections.singletonMap("", "");
     private Map<String,String> description = Collections.singletonMap("","");
-    private String customLinkUrl = "";
-    private boolean customLinkNewWindow;
+    private String url = "";
+    private boolean newWindow;
     private Map<String,String> selectOptions = Collections.emptyMap();
 
-// -------------------------- STATIC METHODS --------------------------
-
-
-// --------------------- GETTER / SETTER METHODS ---------------------
-
-    public String getName() {
-        return name;
-    }
-
     public String getLabel(final Locale locale) {
         return LocaleHelper.resolveStringKeyLocaleMap(locale, labels);
     }
@@ -65,55 +55,12 @@ public class CustomLinkConfiguration implements Serializable {
         return LocaleHelper.resolveStringKeyLocaleMap(locale, description);
     }
 
-    public Map<String,String> getLabelDescriptionLocaleMap() {
-        return Collections.unmodifiableMap(this.description);
-    }
-
-    public Type getType() {
-        return type;
-    }
-
-    public boolean isCustomLinkNewWindow() {
-        return customLinkNewWindow;
-    }
-
-    public String getcustomLinkUrl() {
-        return customLinkUrl;
-    }
-
-    public Map<String,String> getSelectOptions() {
-        return Collections.unmodifiableMap(selectOptions);
-    }
-
     public String toString() {
         final StringBuilder sb = new StringBuilder();
 
-        sb.append("FormItem: ");
+        sb.append("CustomLink: ");
         sb.append(JsonUtil.serialize(this));
 
         return sb.toString();
     }
-
-// -------------------------- OTHER METHODS --------------------------
-
-    public String displayValue(final String value, final Locale locale, final Configuration config) {
-        if (value == null) {
-            return LocaleHelper.getLocalizedMessage(locale, Display.Value_NotApplicable, config);
-        }
-
-        if (this.getType() == Type.select) {
-            if (this.getSelectOptions() != null) {
-                for (final String key : selectOptions.keySet()) {
-                    if (value.equals(key)) {
-                        final String displayValue = selectOptions.get(key);
-                        if (!StringUtil.isEmpty(displayValue)) {
-                            return displayValue;
-                        }
-                    }
-                }
-            }
-        }
-
-        return value;
-    }
 }

+ 1 - 0
src/main/java/password/pwm/config/PwmSettingSyntax.java

@@ -25,6 +25,7 @@ package password.pwm.config;
 import password.pwm.config.value.ActionValue;
 import password.pwm.config.value.BooleanValue;
 import password.pwm.config.value.ChallengeValue;
+import password.pwm.config.value.CustomLinkValue;
 import password.pwm.config.value.EmailValue;
 import password.pwm.config.value.FileValue;
 import password.pwm.config.value.FormValue;

+ 6 - 6
src/main/java/password/pwm/config/value/CustomLinkValue.java

@@ -51,11 +51,11 @@ public class CustomLinkValue extends AbstractValue implements StoredValue {
             public CustomLinkValue fromJson(final String input)
             {
                 if (input == null) {
-                    return new CustomLinkValue(Collections.<CustomLinkConfiguration>emptyList());
+                    return new CustomLinkValue(Collections.emptyList());
                 } else {
                     List<CustomLinkConfiguration> srcList = JsonUtil.deserialize(input, new TypeToken<List<CustomLinkConfiguration>>() {
                     });
-                    srcList = srcList == null ? Collections.<CustomLinkConfiguration>emptyList() : srcList;
+                    srcList = srcList == null ? Collections.emptyList() : srcList;
                     while (srcList.contains(null)) {
                         srcList.remove(null);
                     }
@@ -117,12 +117,12 @@ public class CustomLinkValue extends AbstractValue implements StoredValue {
         if (values != null && !values.isEmpty()) {
             final StringBuilder sb = new StringBuilder();
             for (final CustomLinkConfiguration formRow : values) {
-                sb.append("FormItem Name:").append(formRow.getName()).append("\n");
+                sb.append("Link Name:").append(formRow.getName()).append("\n");
                 sb.append(" Type:").append(formRow.getType());
                 sb.append("\n");
-                sb.append(" Description:").append(JsonUtil.serializeMap(formRow.getLabelDescriptionLocaleMap())).append("\n");
-                sb.append(" Name:").append(formRow.isCustomLinkNewWindow()).append("\n");
-                sb.append(" Name:").append(formRow.getcustomLinkUrl()).append("\n");
+                sb.append(" Description:").append(JsonUtil.serializeMap(formRow.getLabels())).append("\n");
+                sb.append(" New Window:").append(formRow.isNewWindow()).append("\n");
+                sb.append(" Url:").append(formRow.getUrl()).append("\n");
                 if (formRow.getSelectOptions() != null && !formRow.getSelectOptions().isEmpty()) {
                     sb.append(" Select Options: ").append(JsonUtil.serializeMap(formRow.getSelectOptions())).append("\n");
                 }

+ 2 - 2
src/main/resources/password/pwm/i18n/PwmSetting.properties

@@ -673,7 +673,7 @@ Setting_Description_updateAttributes.profile.list=Update Attributes Profiles
 Setting_Description_updateAttributes.queryMatch=Add an LDAP query that only allows users who match this query to update their profiles.
 Setting_Description_updateAttributes.showConfirmation=Enable this option to show the update attributes to the users after they configure them.  This gives your users an opportunity to read and review their attributes before submitting, however, it shows the responses on the screen and makes them visible to anyone else watching the users' screens.
 Setting_Description_updateAttributes.sms.verification=Enable this option to send an SMS to the users' mobile phone numbers before updating the account.  The user must verify receipt of the SMS before @PwmAppName@ updates the account.
-Setting_Description_updateAttributes.customLinks=Create custom links for users to update their profile data.
+Setting_Description_updateAttributes.customLinks=Create custom links for users to navigate to while updating their profile data.
 Setting_Description_updateAttributes.writeAttributes=Add actions to execute after @PwmAppName@ populates a user's attributes.
 Setting_Description_urlshortener.classname=Specify the URL Shortening Service class name. The Java full class name that implements a short URL service. You must include the corresponding JAR or ZIP file in the classpath, typically in the <i>WEB-INF/lib</i> directory or the application server's lib directory.
 Setting_Description_urlshortener.parameters=Specify the Name/Value settings used to configure the selected URL shortening service. For example, an API key, user name, password or domain name. The settings must be in "name\=value" format, where name is the key value of a valid service setting.
@@ -1153,7 +1153,7 @@ Setting_Label_updateAttributes.profile.list=List of Update Attribute profiles.
 Setting_Label_updateAttributes.queryMatch=Update Profile Match
 Setting_Label_updateAttributes.showConfirmation=Show Update Profile Confirmation
 Setting_Label_updateAttributes.sms.verification=Enable SMS Verification
-Setting_Label_updateAttributes.customLinks=Update profile Custom Links 
+Setting_Label_updateAttributes.customLinks=Custom Links 
 Setting_Label_updateAttributes.writeAttributes=Update Profile Actions
 Setting_Label_urlshortener.classname=Enable URL Shortening Service Class
 Setting_Label_urlshortener.parameters=Configuration Parameters for URL Shortening Service

+ 1 - 0
src/main/webapp/WEB-INF/jsp/configeditor.jsp

@@ -157,6 +157,7 @@
 <pwm:script-ref url="/public/resources/js/uilibrary.js"/>
 <pwm:script-ref url="/public/resources/js/configeditor.js"/>
 <pwm:script-ref url="/public/resources/js/configeditor-settings.js"/>
+<pwm:script-ref url="/public/resources/js/configeditor-settings-customlink.js"/>
 <pwm:script-ref url="/public/resources/js/configeditor-settings-remotewebservices.js"/>
 <pwm:script-ref url="/public/resources/js/admin.js"/>
 <%@ include file="fragment/footer.jsp" %>

+ 42 - 0
src/main/webapp/WEB-INF/jsp/fragment/customlink.jsp

@@ -0,0 +1,42 @@
+<%@ page import="password.pwm.http.JspUtility" %>
+<%@ page import="password.pwm.http.PwmRequest" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Locale" %>
+<%@ page import="password.pwm.http.PwmRequestAttribute" %>
+<%@ page import="password.pwm.config.CustomLinkConfiguration" %>
+
+<%--
+  ~ Password Management Servlets (PWM)
+  ~ http://www.pwm-project.org
+  ~
+  ~ Copyright (c) 2006-2009 Novell, Inc.
+  ~ Copyright (c) 2009-2017 The PWM Project
+  ~
+  ~ This program is free software; you can redistribute it and/or modify
+  ~ it under the terms of the GNU General Public License as published by
+  ~ the Free Software Foundation; either version 2 of the License, or
+  ~ (at your option) any later version.
+  ~
+  ~ This program is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  ~ GNU General Public License for more details.
+  ~
+  ~ You should have received a copy of the GNU General Public License
+  ~ along with this program; if not, write to the Free Software
+  ~ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+  --%>
+
+<%@ taglib uri="pwm" prefix="pwm" %>
+
+<% final PwmRequest formPwmRequest = PwmRequest.forRequest(request,response); %>
+<% final Locale formLocale = formPwmRequest.getLocale(); %>
+<% final List<CustomLinkConfiguration> links = (List<CustomLinkConfiguration>)JspUtility.getAttribute(pageContext, PwmRequestAttribute.FormCustomLinks); %>
+<% if (links != null  && !links.isEmpty()) { %>
+<% for (final CustomLinkConfiguration item : links) { %>
+<form method="get" action="<%=item.getUrl()%>" title="<%=item.getDescription(formLocale)%>" <%=item.isNewWindow()?"target=\"_blank\"":""%>>
+    <input class="button" type="submit" value="<%=item.getLabel(formLocale)%>">
+</form>
+<% } %>
+<br/><br/>
+<% } %>

+ 4 - 17
src/main/webapp/WEB-INF/jsp/fragment/form.jsp

@@ -39,22 +39,9 @@
   --%>
 
 <%@ taglib uri="pwm" prefix="pwm" %>
-
-    <% final PwmRequest formPwmRequest = PwmRequest.forRequest(request,response); %>
-    <% final List<FormConfiguration> formConfigurationList = (List<FormConfiguration>)JspUtility.getAttribute(pageContext, PwmRequestAttribute.FormConfiguration); %>
-    <% final List<CustomLinkConfiguration> linkConfigurationList = (List<CustomLinkConfiguration>)JspUtility.getAttribute(pageContext, PwmRequestAttribute.FormCustomLinks); %>
-    <% final Locale formLocale = formPwmRequest.getLocale(); %>
-    <% if (linkConfigurationList != null) { %>
-        <% for (final CustomLinkConfiguration loopList : linkConfigurationList) { %>
-           <% if (loopList.isCustomLinkNewWindow()) { %>
-                <a href=<%=loopList.getcustomLinkUrl()%> title=<%=loopList.getDescription(formLocale)%> target="_blank"><%=loopList.getLabel(formLocale)%></a><br>
-            <% } else { %>
-                <a href=<%=loopList.getcustomLinkUrl()%> title=<%=loopList.getDescription(formLocale)%>><%=loopList.getLabel(formLocale)%></a><br>
-            <% } %>
-        <% } %>
-    <% } %>
-
-    <hr>
+<% final PwmRequest formPwmRequest = PwmRequest.forRequest(request,response); %>
+<% final List<FormConfiguration> formConfigurationList = (List<FormConfiguration>)JspUtility.getAttribute(pageContext, PwmRequestAttribute.FormConfiguration); %>
+<% final Locale formLocale = formPwmRequest.getLocale(); %>
 <% if (formConfigurationList == null) { %>
 [ form definition is not available ]
 <% } else if (formConfigurationList.isEmpty()) { %>
@@ -99,7 +86,7 @@
     <% } %>
     <% final boolean readonly = loopConfiguration.isReadonly() || forceReadOnly; %>
     <% if (readonly) { %>
-        <span id="<%=loopConfiguration.getName()%>">
+    <span id="<%=loopConfiguration.getName()%>">
         <span class="pwm-icon pwm-icon-chevron-circle-right"></span>
         <%= currentValue %>
         </span>

+ 2 - 0
src/main/webapp/WEB-INF/jsp/updateprofile.jsp

@@ -33,6 +33,8 @@
     </jsp:include>
     <div id="centerbody">
         <div id="page-content-title"><pwm:display key="Title_UpdateProfile" displayIfMissing="true"/></div>
+        <jsp:include page="fragment/customlink.jsp"/>
+        <br/>
         <p><pwm:display key="Display_UpdateProfile"/></p>
         <%@ include file="fragment/message.jsp" %>
         <br/>

+ 329 - 0
src/main/webapp/public/resources/js/configeditor-settings-customlink.js

@@ -0,0 +1,329 @@
+/*
+ * Password Management Servlets (PWM)
+ * http://www.pwm-project.org
+ *
+ * Copyright (c) 2006-2009 Novell, Inc.
+ * Copyright (c) 2009-2017 The PWM Project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+// -------------------------- Custom link handler ------------------------------------
+
+var CustomLinkHandler = {};
+CustomLinkHandler.newRowValue = {
+    name:'',
+    labels:{'':''},
+    description:{'':''}
+};
+
+CustomLinkHandler.init = function(keyName) {
+    console.log('CustomLinkHandler init for ' + keyName);
+    var parentDiv = 'table_setting_' + keyName;
+    PWM_CFGEDIT.clearDivElements(parentDiv, true);
+    PWM_CFGEDIT.readSetting(keyName, function(resultValue) {
+        PWM_VAR['clientSettingCache'][keyName] = resultValue;
+        CustomLinkHandler.redraw(keyName);
+    });
+};
+
+CustomLinkHandler.redraw = function(keyName) {
+    var resultValue = PWM_VAR['clientSettingCache'][keyName];
+    var parentDiv = 'table_setting_' + keyName;
+    var parentDivElement = PWM_MAIN.getObject(parentDiv);
+
+    parentDivElement.innerHTML = '<table class="noborder" style="margin-left: 0; width:auto" id="table-top-' + keyName + '"></table>';
+    parentDiv = 'table-top-' + keyName;
+    parentDivElement = PWM_MAIN.getObject(parentDiv);
+
+    if (!PWM_MAIN.JSLibrary.isEmpty(resultValue)) {
+        var headerRow = document.createElement("tr");
+        var rowHtml = '<td>Name</td><td></td><td>Label</td>';
+        headerRow.innerHTML = rowHtml;
+        parentDivElement.appendChild(headerRow);
+    }
+
+    for (var i in resultValue) {
+        CustomLinkHandler.drawRow(parentDiv, keyName, i, resultValue[i]);
+    }
+
+    var buttonRow = document.createElement("tr");
+    buttonRow.setAttribute("colspan","5");
+    buttonRow.innerHTML = '<td><button class="btn" id="button-' + keyName + '-addRow"><span class="btn-icon pwm-icon pwm-icon-plus-square"></span>Add Item</button></td>';
+
+    parentDivElement.appendChild(buttonRow);
+
+    PWM_MAIN.addEventHandler('button-' + keyName + '-addRow','click',function(){
+        CustomLinkHandler.addRow(keyName);
+    });
+
+};
+
+CustomLinkHandler.drawRow = function(parentDiv, settingKey, iteration, value) {
+    require(["dojo/json"], function(JSON){
+        var itemCount = PWM_MAIN.JSLibrary.itemCount(PWM_VAR['clientSettingCache'][settingKey]);
+        var inputID = 'value_' + settingKey + '_' + iteration + "_";
+        var options = PWM_SETTINGS['settings'][settingKey]['options'];
+        var properties = PWM_SETTINGS['settings'][settingKey]['properties'];
+
+        var newTableRow = document.createElement("tr");
+        newTableRow.setAttribute("style", "border-width: 0");
+
+        var htmlRow = '';
+        htmlRow += '<td style="background: #f6f9f8; border:1px solid #dae1e1; width:180px"><div class="noWrapTextBox" id="panel-name-' + inputID + '" ></div></td>';
+        htmlRow += '<td style="width:1px" id="icon-editLabel-' + inputID + '"><span class="btn-icon pwm-icon pwm-icon-edit"></span></td>';
+        htmlRow += '<td style="background: #f6f9f8; border:1px solid #dae1e1; width:170px"><div style="" class="noWrapTextBox " id="' + inputID + 'label"><span>' + value['labels'][''] + '</span></div></td>';
+
+        htmlRow += '<td class="noborder" style="min-width:90px;"><button id="' + inputID + 'optionsButton"><span class="btn-icon pwm-icon pwm-icon-sliders"/> Options</button></td>';
+
+        htmlRow += '<td style="width:10px">';
+        if (itemCount > 1 && iteration != (itemCount -1)) {
+            htmlRow += '<span id="' + inputID + '-moveDown" class="action-icon pwm-icon pwm-icon-chevron-down"></span>';
+        }
+        htmlRow += '</td>';
+
+        htmlRow += '<td style="width:10px">';
+        if (itemCount > 1 && iteration != 0) {
+            htmlRow += '<span id="' + inputID + '-moveUp" class="action-icon pwm-icon pwm-icon-chevron-up"></span>';
+        }
+        htmlRow += '</td>';
+        htmlRow += '<td style="width:10px"><span class="delete-row-icon action-icon pwm-icon pwm-icon-times" id="' + inputID + '-deleteRowButton"></span></td>';
+
+        newTableRow.innerHTML = htmlRow;
+        var parentDivElement = PWM_MAIN.getObject(parentDiv);
+        parentDivElement.appendChild(newTableRow);
+
+        UILibrary.addTextValueToElement("panel-name-" + inputID,value['name']);
+
+        PWM_MAIN.addEventHandler(inputID + "-moveUp", 'click', function () {
+            CustomLinkHandler.move(settingKey, true, iteration);
+        });
+        PWM_MAIN.addEventHandler(inputID + "-moveDown", 'click', function () {
+            CustomLinkHandler.move(settingKey, false, iteration);
+        });
+        PWM_MAIN.addEventHandler(inputID + "-deleteRowButton", 'click', function () {
+            CustomLinkHandler.removeRow(settingKey, iteration);
+        });
+        PWM_MAIN.addEventHandler(inputID + "label", 'click, keypress', function () {
+            CustomLinkHandler.showLabelDialog(settingKey, iteration);
+        });
+        PWM_MAIN.addEventHandler("icon-editLabel-" + inputID, 'click, keypress', function () {
+            CustomLinkHandler.showLabelDialog(settingKey, iteration);
+        });
+        PWM_MAIN.addEventHandler(inputID + "optionsButton", 'click', function () {
+            CustomLinkHandler.showOptionsDialog(settingKey, iteration);
+        });
+        PWM_MAIN.addEventHandler(inputID + "name", 'input', function () {
+            PWM_VAR['clientSettingCache'][settingKey][iteration]['name'] = PWM_MAIN.getObject(inputID + "name").value;
+            CustomLinkHandler.write(settingKey);
+        });
+        PWM_MAIN.addEventHandler(inputID + "type", 'click', function () {
+            PWM_VAR['clientSettingCache'][settingKey][iteration]['type'] = PWM_MAIN.getObject(inputID + "type").value;
+            CustomLinkHandler.write(settingKey);
+        });
+    });
+};
+
+CustomLinkHandler.write = function(settingKey, finishFunction) {
+    var cachedSetting = PWM_VAR['clientSettingCache'][settingKey];
+    PWM_CFGEDIT.writeSetting(settingKey, cachedSetting, finishFunction);
+};
+
+CustomLinkHandler.removeRow = function(keyName, iteration) {
+    PWM_MAIN.showConfirmDialog({
+        text:'Are you sure you wish to delete this item?',
+        okAction:function(){
+            var currentValues = PWM_VAR['clientSettingCache'][keyName];
+            currentValues.splice(iteration,1);
+            CustomLinkHandler.write(keyName,function(){
+                CustomLinkHandler.init(keyName);
+            });
+        }
+    });
+};
+
+CustomLinkHandler.move = function(settingKey, moveUp, iteration) {
+    var currentValues = PWM_VAR['clientSettingCache'][settingKey];
+    if (moveUp) {
+        CustomLinkHandler.arrayMoveUtil(currentValues, iteration, iteration - 1);
+    } else {
+        CustomLinkHandler.arrayMoveUtil(currentValues, iteration, iteration + 1);
+    }
+    CustomLinkHandler.write(settingKey);
+    CustomLinkHandler.redraw(settingKey);
+};
+
+CustomLinkHandler.arrayMoveUtil = function(arr, fromIndex, toIndex) {
+    var element = arr[fromIndex];
+    arr.splice(fromIndex, 1);
+    arr.splice(toIndex, 0, element);
+};
+
+
+CustomLinkHandler.addRow = function(keyName) {
+    UILibrary.stringEditorDialog({
+        title:PWM_SETTINGS['settings'][keyName]['label'] + ' - New Form Field',
+        regex:'^[a-zA-Z][a-zA-Z0-9-]*$',
+        instructions:'Please enter a descriptive name for the link service.',
+        placeholder:'FieldName',
+        completeFunction:function(value){
+            for (var i in PWM_VAR['clientSettingCache'][keyName]) {
+                if (PWM_VAR['clientSettingCache'][keyName][i]['name'] == value) {
+                    alert('field already exists');
+                    return;
+                }
+            }
+            var currentSize = PWM_MAIN.JSLibrary.itemCount(PWM_VAR['clientSettingCache'][keyName]);
+            PWM_VAR['clientSettingCache'][keyName][currentSize + 1] = CustomLinkHandler.newRowValue;
+            PWM_VAR['clientSettingCache'][keyName][currentSize + 1].name = value;
+            PWM_VAR['clientSettingCache'][keyName][currentSize + 1].labels = {'':value};
+            CustomLinkHandler.write(keyName,function(){
+                CustomLinkHandler.init(keyName);
+            });
+        }
+    });
+};
+
+CustomLinkHandler.showOptionsDialog = function(keyName, iteration) {
+    var type = PWM_VAR['clientSettingCache'][keyName][iteration]['type'];
+    var settings = PWM_SETTINGS['settings'][keyName];
+    var options = 'options' in PWM_SETTINGS['settings'][keyName] ? PWM_SETTINGS['settings'][keyName]['options'] : {};
+
+    var inputID = 'value_' + keyName + '_' + iteration + '_';
+    var bodyText = '<div style="max-height: 500px; overflow-x: auto"><table class="noborder">';
+
+    bodyText += '<tr>';
+    var descriptionValue = PWM_VAR['clientSettingCache'][keyName][iteration]['description'][''];
+    bodyText += '<td id="' + inputID + '-label-description" class="key" >Description</td><td>';
+    bodyText += '<div class="noWrapTextBox" id="' + inputID + 'DescriptionValue"><span class="btn-icon pwm-icon pwm-icon-edit"></span><span>' + descriptionValue + '...</span></div>';
+    bodyText += '</td>';
+
+    bodyText += '</tr><tr>';
+
+    var customUrl = PWM_VAR['clientSettingCache'][keyName][iteration]['url'];
+    bodyText += '<td id="' + inputID + '-Site-url" class="key" >Link URL</td><td>' +
+        '<input placeholder="https://example.com" style="width: 350px;" type="url" class="key" id="' + inputID + 'SiteURL' + '" value="'+ customUrl +'"/></td>';
+    bodyText += '</tr><tr>';
+
+    var checkedValue = PWM_VAR['clientSettingCache'][keyName][iteration]['newWindow'];
+    bodyText += '<td class="key" title="' + PWM_CONFIG.showString('Tooltip_Form_ShowInNewWindow') + '">Open link in new window</td><td><input type="checkbox" id="' + inputID + 'newWindow' + '" ';
+    if(checkedValue) {
+        bodyText += 'checked'
+    }
+    bodyText += '/></td>';
+
+    bodyText += '</tr><tr>';
+
+    bodyText += '</table></div>';
+
+    var initDialogWidgets = function () {
+
+        PWM_MAIN.addEventHandler(inputID + 'DescriptionValue', 'change', function () {
+            CustomLinkHandler.showDescriptionDialog(keyName, iteration);
+        });
+
+        PWM_MAIN.addEventHandler(inputID + 'DescriptionValue', 'click', function () {
+            CustomLinkHandler.showDescriptionDialog(keyName, iteration);
+        });
+
+        PWM_MAIN.addEventHandler(inputID + 'SiteURL', 'change', function () {
+            PWM_VAR['clientSettingCache'][keyName][iteration]['url'] = this.value;
+            CustomLinkHandler.write(keyName)
+        });
+
+        PWM_MAIN.addEventHandler(inputID + 'newWindow', 'click', function () {
+            PWM_VAR['clientSettingCache'][keyName][iteration]['newWindow'] = PWM_MAIN.getObject(inputID + 'newWindow').checked;
+            CustomLinkHandler.write(keyName)
+        });
+    };
+
+    PWM_MAIN.showDialog({
+        title: PWM_SETTINGS['settings'][keyName]['label'] + ' - ' + PWM_VAR['clientSettingCache'][keyName][iteration]['name'],
+        text: bodyText,
+        allowMove: true,
+        loadFunction: initDialogWidgets,
+        okAction: function () {
+            CustomLinkHandler.redraw(keyName);
+        }
+    });
+};
+
+CustomLinkHandler.showLabelDialog = function(keyName, iteration) {
+    var finishAction = function(){ CustomLinkHandler.redraw(keyName); };
+    var title = 'Label for ' + PWM_VAR['clientSettingCache'][keyName][iteration]['name'];
+    CustomLinkHandler.multiLocaleStringDialog(keyName, iteration, 'labels', finishAction, title);
+};
+
+CustomLinkHandler.multiLocaleStringDialog = function(keyName, iteration, settingType, finishAction, titleText) {
+    require(["dijit/Dialog","dijit/form/Textarea","dijit/form/CheckBox"],function(){
+        var inputID = 'value_' + keyName + '_' + iteration + "_" + "label_";
+        var bodyText = '<table class="noborder" id="' + inputID + 'table">';
+        bodyText += '<tr>';
+        for (var localeName in PWM_VAR['clientSettingCache'][keyName][iteration][settingType]) {
+            var value = PWM_VAR['clientSettingCache'][keyName][iteration][settingType][localeName];
+            var localeID = inputID + localeName;
+            bodyText += '<td>' + localeName + '</td>';
+            bodyText += '<td><input style="width:420px" class="configStringInput" type="text" value="' + value + '" id="' + localeID + '-input"></input></td>';
+            if (localeName != '') {
+                bodyText += '<td><span class="delete-row-icon action-icon pwm-icon pwm-icon-times" id="' + localeID + '-removeLocaleButton"></span></td>';
+            }
+            bodyText += '</tr><tr>';
+        }
+        bodyText += '</tr></table>';
+
+        PWM_MAIN.showDialog({
+            title: titleText,
+            text: bodyText,
+            okAction:function(){
+                finishAction();
+            },
+            loadFunction:function(){
+                for (var iter in PWM_VAR['clientSettingCache'][keyName][iteration][settingType]) {
+                    (function(localeName) {
+                        var localeID = inputID + localeName;
+                        PWM_MAIN.addEventHandler(localeID + '-input', 'input', function () {
+                            var inputElement = PWM_MAIN.getObject(localeID + '-input');
+                            var value = inputElement.value;
+                            PWM_VAR['clientSettingCache'][keyName][iteration][settingType][localeName] = value;
+                            CustomLinkHandler.write(keyName);
+                        });
+                        PWM_MAIN.addEventHandler(localeID + '-removeLocaleButton', 'click', function () {
+                            delete PWM_VAR['clientSettingCache'][keyName][iteration][settingType][localeName];
+                            CustomLinkHandler.write(keyName);
+                            CustomLinkHandler.multiLocaleStringDialog(keyName, iteration, settingType, finishAction, titleText);
+                        });
+                    }(iter));
+                }
+                UILibrary.addAddLocaleButtonRow(inputID + 'table', inputID, function(localeName){
+                    if (localeName in PWM_VAR['clientSettingCache'][keyName][iteration][settingType]) {
+                        alert('Locale is already present');
+                    } else {
+                        PWM_VAR['clientSettingCache'][keyName][iteration][settingType][localeName] = '';
+                        CustomLinkHandler.write(keyName);
+                        CustomLinkHandler.multiLocaleStringDialog(keyName, iteration, settingType, finishAction, titleText);
+                    }
+                }, Object.keys(PWM_VAR['clientSettingCache'][keyName][iteration][settingType]));
+            }
+        });
+    });
+};
+
+
+CustomLinkHandler.showDescriptionDialog = function(keyName, iteration) {
+    var finishAction = function(){ CustomLinkHandler.showOptionsDialog(keyName, iteration); };
+    var title = 'Description for ' + PWM_VAR['clientSettingCache'][keyName][iteration]['name'];
+    CustomLinkHandler.multiLocaleStringDialog(keyName, iteration, 'description', finishAction, title);
+};
+

+ 0 - 398
src/main/webapp/public/resources/js/configeditor-settings.js

@@ -3323,401 +3323,3 @@ NamedSecretHandler.deletePassword = function(settingKey, key) {
 };
 
 
-// -------------------------- Custom link handler ------------------------------------
-
-var CustomLinkHandler = {};
-CustomLinkHandler.newRowValue = {
-    name:'',
-    labels:{'':''},
-    description:{'':''}
-};
-
-CustomLinkHandler.init = function(keyName) {
-    console.log('CustomLinkHandler init for ' + keyName);
-    var parentDiv = 'table_setting_' + keyName;
-    PWM_CFGEDIT.clearDivElements(parentDiv, true);
-    PWM_CFGEDIT.readSetting(keyName, function(resultValue) {
-        PWM_VAR['clientSettingCache'][keyName] = resultValue;
-        CustomLinkHandler.redraw(keyName);
-    });
-};
-
-CustomLinkHandler.redraw = function(keyName) {
-    var resultValue = PWM_VAR['clientSettingCache'][keyName];
-    var parentDiv = 'table_setting_' + keyName;
-    var parentDivElement = PWM_MAIN.getObject(parentDiv);
-
-    parentDivElement.innerHTML = '<table class="noborder" style="margin-left: 0; width:auto" id="table-top-' + keyName + '"></table>';
-    parentDiv = 'table-top-' + keyName;
-    parentDivElement = PWM_MAIN.getObject(parentDiv);
-
-    if (!PWM_MAIN.JSLibrary.isEmpty(resultValue)) {
-        var headerRow = document.createElement("tr");
-        var rowHtml = '<td>Name</td><td></td><td>Label</td>';
-        headerRow.innerHTML = rowHtml;
-        parentDivElement.appendChild(headerRow);
-    }
-
-    for (var i in resultValue) {
-        CustomLinkHandler.drawRow(parentDiv, keyName, i, resultValue[i]);
-    }
-
-    var buttonRow = document.createElement("tr");
-    buttonRow.setAttribute("colspan","5");
-    buttonRow.innerHTML = '<td><button class="btn" id="button-' + keyName + '-addRow"><span class="btn-icon pwm-icon pwm-icon-plus-square"></span>Add Item</button></td>';
-
-    parentDivElement.appendChild(buttonRow);
-
-    PWM_MAIN.addEventHandler('button-' + keyName + '-addRow','click',function(){
-        CustomLinkHandler.addRow(keyName);
-    });
-
-};
-
-CustomLinkHandler.drawRow = function(parentDiv, settingKey, iteration, value) {
-    require(["dojo/json"], function(JSON){
-        var itemCount = PWM_MAIN.JSLibrary.itemCount(PWM_VAR['clientSettingCache'][settingKey]);
-        var inputID = 'value_' + settingKey + '_' + iteration + "_";
-        var options = PWM_SETTINGS['settings'][settingKey]['options'];
-        var properties = PWM_SETTINGS['settings'][settingKey]['properties'];
-
-        var newTableRow = document.createElement("tr");
-        newTableRow.setAttribute("style", "border-width: 0");
-
-        var htmlRow = '';
-        htmlRow += '<td style="background: #f6f9f8; border:1px solid #dae1e1; width:180px"><div class="noWrapTextBox" id="panel-name-' + inputID + '" ></div></td>';
-        htmlRow += '<td style="width:1px" id="icon-editLabel-' + inputID + '"><span class="btn-icon pwm-icon pwm-icon-edit"></span></td>';
-        htmlRow += '<td style="background: #f6f9f8; border:1px solid #dae1e1; width:170px"><div style="" class="noWrapTextBox " id="' + inputID + 'label"><span>' + value['labels'][''] + '</span></div></td>';
-
-        var userDNtypeAllowed = options['type-userDN'] == 'show';
-        if (!PWM_MAIN.JSLibrary.isEmpty(options)) {
-            htmlRow += '<td style="width:15px;">';
-            htmlRow += '<select id="' + inputID + 'type">';
-            for (var optionItem in options) {
-                //if (optionList[optionItem] != 'userDN' || userDNtypeAllowed) {
-                var optionName = options[optionItem];
-                var selected = (optionName == PWM_VAR['clientSettingCache'][settingKey][iteration]['type']);
-                htmlRow += '<option value="' + optionName + '"' + (selected ? " selected" : "") + '>' + optionName + '</option>';
-                //}
-            }
-            htmlRow += '</select>';
-            htmlRow += '</td>';
-        }
-
-        var hideOptions = PWM_MAIN.JSLibrary.arrayContains(PWM_SETTINGS['settings'][settingKey]['flags'], 'Form_HideOptions');
-        if (!hideOptions) {
-            htmlRow += '<td class="noborder" style="min-width:90px;"><button id="' + inputID + 'optionsButton"><span class="btn-icon pwm-icon pwm-icon-sliders"/> Options</button></td>';
-        }
-
-        htmlRow += '<td style="width:10px">';
-        if (itemCount > 1 && iteration != (itemCount -1)) {
-            htmlRow += '<span id="' + inputID + '-moveDown" class="action-icon pwm-icon pwm-icon-chevron-down"></span>';
-        }
-        htmlRow += '</td>';
-
-        htmlRow += '<td style="width:10px">';
-        if (itemCount > 1 && iteration != 0) {
-            htmlRow += '<span id="' + inputID + '-moveUp" class="action-icon pwm-icon pwm-icon-chevron-up"></span>';
-        }
-        htmlRow += '</td>';
-        htmlRow += '<td style="width:10px"><span class="delete-row-icon action-icon pwm-icon pwm-icon-times" id="' + inputID + '-deleteRowButton"></span></td>';
-
-        newTableRow.innerHTML = htmlRow;
-        var parentDivElement = PWM_MAIN.getObject(parentDiv);
-        parentDivElement.appendChild(newTableRow);
-
-        UILibrary.addTextValueToElement("panel-name-" + inputID,value['name']);
-
-        PWM_MAIN.addEventHandler(inputID + "-moveUp", 'click', function () {
-            CustomLinkHandler.move(settingKey, true, iteration);
-        });
-        PWM_MAIN.addEventHandler(inputID + "-moveDown", 'click', function () {
-            CustomLinkHandler.move(settingKey, false, iteration);
-        });
-        PWM_MAIN.addEventHandler(inputID + "-deleteRowButton", 'click', function () {
-            CustomLinkHandler.removeRow(settingKey, iteration);
-        });
-        PWM_MAIN.addEventHandler(inputID + "label", 'click, keypress', function () {
-            CustomLinkHandler.showLabelDialog(settingKey, iteration);
-        });
-       PWM_MAIN.addEventHandler("icon-editLabel-" + inputID, 'click, keypress', function () {
-            CustomLinkHandler.showLabelDialog(settingKey, iteration);
-        });
-        PWM_MAIN.addEventHandler(inputID + "optionsButton", 'click', function () {
-            CustomLinkHandler.showOptionsDialog(settingKey, iteration);
-        });
-        PWM_MAIN.addEventHandler(inputID + "name", 'input', function () {
-            PWM_VAR['clientSettingCache'][settingKey][iteration]['name'] = PWM_MAIN.getObject(inputID + "name").value;
-            CustomLinkHandler.write(settingKey);
-        });
-        PWM_MAIN.addEventHandler(inputID + "type", 'click', function () {
-            PWM_VAR['clientSettingCache'][settingKey][iteration]['type'] = PWM_MAIN.getObject(inputID + "type").value;
-            CustomLinkHandler.write(settingKey);
-        });
-    });
-};
-
-CustomLinkHandler.write = function(settingKey, finishFunction) {
-    var cachedSetting = PWM_VAR['clientSettingCache'][settingKey];
-    PWM_CFGEDIT.writeSetting(settingKey, cachedSetting, finishFunction);
-};
-
-CustomLinkHandler.removeRow = function(keyName, iteration) {
-    PWM_MAIN.showConfirmDialog({
-        text:'Are you sure you wish to delete this item?',
-        okAction:function(){
-            var currentValues = PWM_VAR['clientSettingCache'][keyName];
-            currentValues.splice(iteration,1);
-            CustomLinkHandler.write(keyName,function(){
-                CustomLinkHandler.init(keyName);
-            });
-        }
-    });
-};
-
-CustomLinkHandler.move = function(settingKey, moveUp, iteration) {
-    var currentValues = PWM_VAR['clientSettingCache'][settingKey];
-    if (moveUp) {
-        CustomLinkHandler.arrayMoveUtil(currentValues, iteration, iteration - 1);
-    } else {
-        CustomLinkHandler.arrayMoveUtil(currentValues, iteration, iteration + 1);
-    }
-    CustomLinkHandler.write(settingKey);
-    CustomLinkHandler.redraw(settingKey);
-};
-
-CustomLinkHandler.arrayMoveUtil = function(arr, fromIndex, toIndex) {
-    var element = arr[fromIndex];
-    arr.splice(fromIndex, 1);
-    arr.splice(toIndex, 0, element);
-};
-
-
-CustomLinkHandler.addRow = function(keyName) {
-    UILibrary.stringEditorDialog({
-        title:PWM_SETTINGS['settings'][keyName]['label'] + ' - New Form Field',
-        regex:'^[a-zA-Z][a-zA-Z0-9-]*$',
-        placeholder:'FieldName',
-        completeFunction:function(value){
-            for (var i in PWM_VAR['clientSettingCache'][keyName]) {
-                if (PWM_VAR['clientSettingCache'][keyName][i]['name'] == value) {
-                    alert('field already exists');
-                    return;
-                }
-            }
-            var currentSize = PWM_MAIN.JSLibrary.itemCount(PWM_VAR['clientSettingCache'][keyName]);
-            PWM_VAR['clientSettingCache'][keyName][currentSize + 1] = CustomLinkHandler.newRowValue;
-            PWM_VAR['clientSettingCache'][keyName][currentSize + 1].name = value;
-            PWM_VAR['clientSettingCache'][keyName][currentSize + 1].labels = {'':value};
-            CustomLinkHandler.write(keyName,function(){
-                CustomLinkHandler.init(keyName);
-            });
-        }
-    });
-};
-
-CustomLinkHandler.showOptionsDialog = function(keyName, iteration) {
-    var type = PWM_VAR['clientSettingCache'][keyName][iteration]['type'];
-    var settings = PWM_SETTINGS['settings'][keyName];
-    var options = 'options' in PWM_SETTINGS['settings'][keyName] ? PWM_SETTINGS['settings'][keyName]['options'] : {};
-
-    require(["dijit/Dialog", "dijit/form/Textarea", "dijit/form/CheckBox", "dijit/form/NumberSpinner"], function () {
-        var inputID = 'value_' + keyName + '_' + iteration + '_';
-        var bodyText = '<div style="max-height: 500px; overflow-x: auto"><table class="noborder">';
-
-        bodyText += '<tr>';
-        var descriptionValue = PWM_VAR['clientSettingCache'][keyName][iteration]['description'][''];
-        bodyText += '<td id="' + inputID + '-label-description" class="key" title="' + PWM_CONFIG.showString('Tooltip_FormOptions_Description') + '">Description</td><td>';
-        bodyText += '<div class="noWrapTextBox" id="' + inputID + 'DescriptionValue"><span class="btn-icon pwm-icon pwm-icon-edit"></span><span>' + descriptionValue + '...</span></div>';
-        bodyText += '</td>';
-
-        bodyText += '</tr><tr>';
-
-        var customUrl = PWM_VAR['clientSettingCache'][keyName][iteration]['customLinkUrl'];
-        bodyText += '<td id="' + inputID + '-Site-url" class="key" title="' + PWM_CONFIG.showString('Tooltip_FormOptions_LinkURL') + '">Link URL</td><td>' +
-            '<input placeholder="https://example.com" style="width: 350px;" type="url" class="key" id="' + inputID + 'SiteURL' + '" value="'+ customUrl +'"/></td>';
-        bodyText += '</tr><tr>';
-
-        var checkedValue = PWM_VAR['clientSettingCache'][keyName][iteration]['customLinkNewWindow'];
-        bodyText += '<td id="' + inputID + '-NewWindow-Option" class="key" title="' + PWM_CONFIG.showString('Tooltip_Form_ShowInNewWindow') + '">Open link in new window</td><td><input type="checkbox" id="' + inputID + 'customLinkNewWindow' + '" ';
-        if(checkedValue) {
-            bodyText += 'checked'
-        }
-        bodyText += '/></td>';
-
-        bodyText += '</tr><tr>';
-
-        bodyText += '</table></div>';
-
-        var initDialogWidgets = function () {
-
-            PWM_MAIN.clearDijitWidget(inputID + "DescriptionValue");
-            PWM_MAIN.addEventHandler(inputID + 'DescriptionValue', 'change', function () {
-                CustomLinkHandler.showDescriptionDialog(keyName, iteration);
-            });
-
-            PWM_MAIN.addEventHandler(inputID + 'DescriptionValue', 'click', function () {
-                CustomLinkHandler.showDescriptionDialog(keyName, iteration);
-            });
-
-            PWM_MAIN.clearDijitWidget(inputID + "SiteURL");
-            PWM_MAIN.addEventHandler(inputID + 'SiteURL', 'change', function () {
-                PWM_VAR['clientSettingCache'][keyName][iteration]['customLinkUrl'] = this.value;
-                CustomLinkHandler.write(keyName)
-            });
-
-            PWM_MAIN.clearDijitWidget(inputID + "customLinkNewWindow");
-            PWM_MAIN.addEventHandler(inputID + 'customLinkNewWindow', 'click', function () {
-                if(this.value === "on")
-                    this.value = "true";
-                PWM_VAR['clientSettingCache'][keyName][iteration]['customLinkNewWindow'] = this.value;
-                CustomLinkHandler.write(keyName)
-            });
-        };
-
-        PWM_MAIN.showDialog({
-            title: PWM_SETTINGS['settings'][keyName]['label'] + ' - ' + PWM_VAR['clientSettingCache'][keyName][iteration]['name'],
-            text: bodyText,
-            allowMove: true,
-            loadFunction: initDialogWidgets,
-            okAction: function () {
-                CustomLinkHandler.redraw(keyName);
-            }
-        });
-    });
-};
-
-CustomLinkHandler.showLabelDialog = function(keyName, iteration) {
-    var finishAction = function(){ CustomLinkHandler.redraw(keyName); };
-    var title = 'Label for ' + PWM_VAR['clientSettingCache'][keyName][iteration]['name'];
-    CustomLinkHandler.multiLocaleStringDialog(keyName, iteration, 'labels', finishAction, title);
-};
-
-CustomLinkHandler.multiLocaleStringDialog = function(keyName, iteration, settingType, finishAction, titleText) {
-    require(["dijit/Dialog","dijit/form/Textarea","dijit/form/CheckBox"],function(){
-        var inputID = 'value_' + keyName + '_' + iteration + "_" + "label_";
-        var bodyText = '<table class="noborder" id="' + inputID + 'table">';
-        bodyText += '<tr>';
-        for (var localeName in PWM_VAR['clientSettingCache'][keyName][iteration][settingType]) {
-            var value = PWM_VAR['clientSettingCache'][keyName][iteration][settingType][localeName];
-            var localeID = inputID + localeName;
-            bodyText += '<td>' + localeName + '</td>';
-            bodyText += '<td><input style="width:420px" class="configStringInput" type="text" value="' + value + '" id="' + localeID + '-input"></input></td>';
-            if (localeName != '') {
-                bodyText += '<td><span class="delete-row-icon action-icon pwm-icon pwm-icon-times" id="' + localeID + '-removeLocaleButton"></span></td>';
-            }
-            bodyText += '</tr><tr>';
-        }
-        bodyText += '</tr></table>';
-
-        PWM_MAIN.showDialog({
-            title: titleText,
-            text: bodyText,
-            okAction:function(){
-                finishAction();
-            },
-            loadFunction:function(){
-                for (var iter in PWM_VAR['clientSettingCache'][keyName][iteration][settingType]) {
-                    (function(localeName) {
-                        var localeID = inputID + localeName;
-                        PWM_MAIN.addEventHandler(localeID + '-input', 'input', function () {
-                            var inputElement = PWM_MAIN.getObject(localeID + '-input');
-                            var value = inputElement.value;
-                            PWM_VAR['clientSettingCache'][keyName][iteration][settingType][localeName] = value;
-                            CustomLinkHandler.write(keyName);
-                        });
-                        PWM_MAIN.addEventHandler(localeID + '-removeLocaleButton', 'click', function () {
-                            delete PWM_VAR['clientSettingCache'][keyName][iteration][settingType][localeName];
-                            CustomLinkHandler.write(keyName);
-                            CustomLinkHandler.multiLocaleStringDialog(keyName, iteration, settingType, finishAction, titleText);
-                        });
-                    }(iter));
-                }
-                UILibrary.addAddLocaleButtonRow(inputID + 'table', inputID, function(localeName){
-                    if (localeName in PWM_VAR['clientSettingCache'][keyName][iteration][settingType]) {
-                        alert('Locale is already present');
-                    } else {
-                        PWM_VAR['clientSettingCache'][keyName][iteration][settingType][localeName] = '';
-                        CustomLinkHandler.write(keyName);
-                        CustomLinkHandler.multiLocaleStringDialog(keyName, iteration, settingType, finishAction, titleText);
-                    }
-                }, Object.keys(PWM_VAR['clientSettingCache'][keyName][iteration][settingType]));
-            }
-        });
-    });
-};
-
-CustomLinkHandler.showSelectOptionsDialog = function(keyName, iteration) {
-    var inputID = 'value_' + keyName + '_' + iteration + "_" + "selectOptions_";
-    var bodyText = '';
-    bodyText += '<table class="noborder" id="' + inputID + 'table"">';
-    bodyText += '<tr>';
-    bodyText += '<td><b>Value</b></td><td><b>Display Name</b></td>';
-    bodyText += '</tr><tr>';
-    for (var optionName in PWM_VAR['clientSettingCache'][keyName][iteration]['selectOptions']) {
-        var value = PWM_VAR['clientSettingCache'][keyName][iteration]['selectOptions'][optionName];
-        var optionID = inputID + optionName;
-        bodyText += '<td>' + optionName + '</td><td>' + value + '</td>';
-        bodyText += '<td class="noborder" style="width:15px">';
-        bodyText += '<span id="' + optionID + '-removeButton" class="delete-row-icon action-icon pwm-icon pwm-icon-times"></span>';
-        bodyText += '</td>';
-        bodyText += '</tr><tr>';
-    }
-    bodyText += '</tr></table>';
-    bodyText += '<br/><br/><br/>';
-    bodyText += '<input class="configStringInput" style="width:200px" type="text" placeholder="Value" required id="addSelectOptionName"/>';
-    bodyText += '<input class="configStringInput" style="width:200px" type="text" placeholder="Display Name" required id="addSelectOptionValue"/>';
-    bodyText += '<button id="addSelectOptionButton"><span class="btn-icon pwm-icon pwm-icon-plus-square"/> Add</button>';
-
-    PWM_MAIN.showDialog({
-        title: 'Select Options for ' + PWM_VAR['clientSettingCache'][keyName][iteration]['name'],
-        text: bodyText,
-        okAction: function(){
-            CustomLinkHandler.showOptionsDialog(keyName,iteration);
-        }
-    });
-
-    for (var optionName in PWM_VAR['clientSettingCache'][keyName][iteration]['selectOptions']) {
-        var loopID = inputID + optionName;
-        var optionID = inputID + optionName;
-        PWM_MAIN.clearDijitWidget(loopID);
-        PWM_MAIN.addEventHandler(optionID + '-removeButton','click',function(){
-            CustomLinkHandler.removeSelectOptionsOption(keyName,iteration,optionName);
-        });
-    }
-
-    PWM_MAIN.addEventHandler('addSelectOptionButton','click',function(){
-        var value = PWM_MAIN.getObject('addSelectOptionName').value;
-        var display = PWM_MAIN.getObject('addSelectOptionValue').value;
-        CustomLinkHandler.addSelectOptionsOption(keyName, iteration, value, display);
-    });
-};
-
-CustomLinkHandler.addSelectOptionsOption = function(keyName, iteration, optionName, optionValue) {
-    if (optionName == null || optionName.length < 1) {
-        alert('Name field is required');
-        return;
-    }
-
-    if (optionValue == null || optionValue.length < 1) {
-        alert('Value field is required');
-        return;
-    }
-
-    PWM_VAR['clientSettingCache'][keyName][iteration]['selectOptions'][optionName] = optionValue;
-    CustomLinkHandler.write(keyName);
-    CustomLinkHandler.showSelectOptionsDialog(keyName, iteration);
-};
-
-CustomLinkHandler.removeSelectOptionsOption = function(keyName, iteration, optionName) {
-    delete PWM_VAR['clientSettingCache'][keyName][iteration]['selectOptions'][optionName];
-    CustomLinkHandler.write(keyName);
-    CustomLinkHandler.showSelectOptionsDialog(keyName, iteration);
-};
-
-CustomLinkHandler.showDescriptionDialog = function(keyName, iteration) {
-    var finishAction = function(){ CustomLinkHandler.showOptionsDialog(keyName, iteration); };
-    var title = 'Description for ' + PWM_VAR['clientSettingCache'][keyName][iteration]['description'][''];
-    CustomLinkHandler.multiLocaleStringDialog(keyName, iteration, 'description', finishAction, title);
-};
-