Изменения документа LDAP Admin sheet

Редактировал(а) Dmitriy Rybakov 04.10.2024, 00:20

От версии 3.1
отредактировано Dmitriy Rybakov
на 04.10.2024, 00:20
Изменить комментарий: Install extension [org.xwiki.contrib.ldap:ldap-ui/9.15.5]
К версии 2.1
отредактировано superadmin
на 04.10.2024, 00:09
Изменить комментарий: Migrated property [scope] from class [XWiki.ConfigurableClass]

Сводка

Подробности

Свойства страницы
Автор документа
... ... @@ -1,1 +1,1 @@
1 -XWiki.rybakovds
1 +XWiki.superadmin
XWiki.ConfigurableClass[0]
configureGlobally
... ... @@ -1,1 +1,0 @@
1 -1
XWiki.JavaScriptExtension[0]
Код
... ... @@ -11,7 +11,6 @@
11 11   options: {
12 12   separator: ","
13 13   , mapsToString: " \u2192 "
14 - , escapeChar: '\\'
15 15   , newEntryMessage: "New entry"
16 16   },
17 17  
... ... @@ -22,8 +22,6 @@
22 22   initialize:function(input, options) {
23 23   this.input = $(input);
24 24   this.options = Object.extend(Object.clone(this.options), options || {});
25 - this.options.newEntryMessage = this.input.getAttribute("data-add-entry-text") || this.options.newEntryMessage;
26 - this.options.escapeChar = this.input.getAttribute("data-escape-character") || this.options.escapeChar;
27 27  
28 28   (this.input.up("dd") || this.input).addClassName("hidden");
29 29   this.inputContainer = (this.input.up("dd") || this.input).up();
... ... @@ -55,42 +55,17 @@
55 55   * Initializes a collection of existing properties based on the original input value, and displays them as a pair of two input elements.
56 56   */
57 57   initializeAndDisplayExistingProperties: function() {
58 - var propStr = this.value
59 - var props = []
60 - var escaped = false
61 - var currentProp = ''
62 - for (var i=0;i<propStr.length;i++) {
63 - var c = propStr[i]
64 - if (escaped) {
65 - currentProp += c
66 - escaped = false
67 - } else {
68 - if (c == this.options.escapeChar) {
69 - escaped = true
70 - } else if (c == this.options.separator) {
71 - this._addProp(currentProp)
72 - currentProp = ''
73 - } else {
74 - currentProp += c
75 - }
76 - }
55 + var props = this.value == "" ? [] : this.value.split(this.options.separator);
56 + for (var i=0;i<props.length;i++) {
57 + var key = props[i].substring(0, props[i].indexOf("=")),
58 + value = props[i].substring(props[i].indexOf("=") + 1) || "";
59 + this.properties.push( [key, value] );
77 77   }
78 - if (currentProp.length > 0) {
79 - this._addProp(currentProp)
80 - }
81 -
82 82   for (var i=this.properties.length-1;i>=0;i--) {
83 83   (this.input.up("dd") || this.input).insert({'after': this.createPropertyEntry(this.properties[i][0], this.properties[i][1]) });
84 84   }
85 85   },
86 86  
87 - _addProp: function(prop) {
88 - // note: we do not handle escaped '=' in keys; currently there should be no need for this
89 - var key = prop.substring(0, prop.indexOf("=")),
90 - value = prop.substring(prop.indexOf("=") + 1) || "";
91 - this.properties.push( [key, value] );
92 - },
93 -
94 94   /**
95 95   * Creates and returns the DOM fragment for an property entry for this widget
96 96   */
... ... @@ -145,24 +145,11 @@
145 145   * Computes the new value for the original underlaying input element (textarea or input text), and updates its value with the result.
146 146   */
147 147   updateValue: function() {
148 - var that = this
149 149   var value = this.inputContainer.select("." + this.id + " .key[value!='']").collect(function(key){
150 150   if (key.value == key.defaultValue) {
151 151   return ""
152 152   }
153 153   return key.value + "=" + key.next("input").value;
154 - }).filter(function(value) {
155 - return value != '' && value != '=';
156 - }).map(function(value) {
157 - var escapedValue = ''
158 - for (var i=0;i<value.length;i++) {
159 - var c = value[i]
160 - if (c == that.options.separator || c == that.options.escapeChar) {
161 - escapedValue += that.options.escapeChar
162 - }
163 - escapedValue += c
164 - }
165 - return escapedValue
166 166   }).join(this.options.separator);
167 167  
168 168   if (this.input.tagName.toLowerCase() === "textarea") {
XWiki.JavaScriptExtension[1]
Код
... ... @@ -4,14 +4,11 @@
4 4  
5 5   groupMapping.setAttribute("data-key-tip", "${escapetool.javascript($services.localization.render('ldap.xwikiGroupTip'))}")
6 6   groupMapping.setAttribute("data-value-tip", "${escapetool.javascript($services.localization.render('ldap.ldapGroupTip'))}")
7 - groupMapping.setAttribute("data-add-entry-text", "$!{escapetool.javascript($services.localization.render('ldap.addNewEntry'))}")
8 8   groupMapping.setAttribute("data-separator", "|")
9 - groupMapping.setAttribute("data-escape-character", "\\")
10 10   groupMapping.addClassName("properties-editor");
11 11  
12 12   fieldMapping.setAttribute("data-key-tip", "${escapetool.javascript($services.localization.render('ldap.xwikiUserField'))}")
13 13   fieldMapping.setAttribute("data-value-tip", "${escapetool.javascript($services.localization.render('ldap.ldapUserField'))}")
14 - fieldMapping.setAttribute("data-add-entry-text", "$!{escapetool.javascript($services.localization.render('ldap.addNewEntry'))}")
15 15   fieldMapping.addClassName("properties-editor");
16 16  
17 17  });
XWiki.StyleSheetExtension[0]
Content Type
... ... @@ -1,1 +1,0 @@
1 -CSS