Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingBindingComponent.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingBindingComponent.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingBindingComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingBindingComponent.js index 9a9c0b2..1a76b0c 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingBindingComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingBindingComponent.js | |||
@@ -1,120 +1,117 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
30 | 27 | ||
31 | Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent = function(args) { | 28 | Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent = function(args) { |
32 | args = args || {}; | 29 | args = args || {}; |
33 | 30 | ||
34 | Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent.superclass.constructor.apply(this, arguments); |
35 | 32 | ||
36 | this._formFieldName = args.formFieldName|| Clipperz.Base.exception.raise('MandatoryParameter'); | 33 | this._formFieldName = args.formFieldName|| Clipperz.Base.exception.raise('MandatoryParameter'); |
37 | this._fields = args.fields || Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | this._fields = args.fields || Clipperz.Base.exception.raise('MandatoryParameter'); |
38 | this._initiallySelectedFieldKey = args.selectedFieldKey|| null; | 35 | this._initiallySelectedFieldKey = args.selectedFieldKey|| null; |
39 | 36 | ||
40 | return this; | 37 | return this; |
41 | } | 38 | } |
42 | 39 | ||
43 | //============================================================================= | 40 | //============================================================================= |
44 | 41 | ||
45 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { |
46 | 43 | ||
47 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
48 | 45 | ||
49 | 'toString': function () { | 46 | 'toString': function () { |
50 | return "Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent component"; | 47 | return "Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent component"; |
51 | }, | 48 | }, |
52 | 49 | ||
53 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
54 | 51 | ||
55 | 'formFieldName': function () { | 52 | 'formFieldName': function () { |
56 | return this._formFieldName; | 53 | return this._formFieldName; |
57 | }, | 54 | }, |
58 | 55 | ||
59 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
60 | 57 | ||
61 | 'fields': function () { | 58 | 'fields': function () { |
62 | return this._fields; | 59 | return this._fields; |
63 | }, | 60 | }, |
64 | 61 | ||
65 | //------------------------------------------------------------------------- | 62 | //------------------------------------------------------------------------- |
66 | 63 | ||
67 | 'selectedValue': function () { | 64 | 'selectedValue': function () { |
68 | var result; | 65 | var result; |
69 | 66 | ||
70 | result = this.getElement('select').value; | 67 | result = this.getElement('select').value; |
71 | 68 | ||
72 | if (result == '---') { | 69 | if (result == '---') { |
73 | result = null; | 70 | result = null; |
74 | } | 71 | } |
75 | 72 | ||
76 | return result; | 73 | return result; |
77 | }, | 74 | }, |
78 | 75 | ||
79 | 'initiallySelectedFieldKey': function () { | 76 | 'initiallySelectedFieldKey': function () { |
80 | return this._initiallySelectedFieldKey; | 77 | return this._initiallySelectedFieldKey; |
81 | }, | 78 | }, |
82 | 79 | ||
83 | //========================================================================= | 80 | //========================================================================= |
84 | 81 | ||
85 | 'renderSelf': function() { | 82 | 'renderSelf': function() { |
86 | var initiallySelectedOptions; | 83 | var initiallySelectedOptions; |
87 | 84 | ||
88 | this.append(this.element(), {tag:'div', id:this.getId('div'), cls:'binding', children:[ | 85 | this.append(this.element(), {tag:'div', id:this.getId('div'), cls:'binding', children:[ |
89 | {tag:'span', cls:'formFieldName', html:this.formFieldName()}, | 86 | {tag:'span', cls:'formFieldName', html:this.formFieldName()}, |
90 | {tag:'span', cls:'fieldLock', id:this.getId('isHidden'), children:[ | 87 | {tag:'span', cls:'fieldLock', id:this.getId('isHidden'), children:[ |
91 | {tag:'a', href:'#', id:this.getId('showHide'), html:' '} | 88 | {tag:'a', href:'#', id:this.getId('showHide'), html:' '} |
92 | ]}, | 89 | ]}, |
93 | {tag:'input', id:this.getId('input'), cls:'formFieldExampleValue', disabled:true, value:''}, | 90 | {tag:'input', id:this.getId('input'), cls:'formFieldExampleValue', disabled:true, value:''}, |
94 | {tag:'select', name:this.formFieldName(), id:this.getId('select'), cls:'formFieldMatchinCardField', children: | 91 | {tag:'select', name:this.formFieldName(), id:this.getId('select'), cls:'formFieldMatchinCardField', children: |
95 | MochiKit.Base.flattenArguments( | 92 | MochiKit.Base.flattenArguments( |
96 | {tag:'option', value:'---', html:"---"}, | 93 | {tag:'option', value:'---', html:"---"}, |
97 | MochiKit.Base.map( | 94 | MochiKit.Base.map( |
98 | MochiKit.Base.bind(function (aField) { return {tag:'option', value:aField['reference'], html:aField['label']}; }, this), | 95 | MochiKit.Base.bind(function (aField) { return {tag:'option', value:aField['reference'], html:aField['label']}; }, this), |
99 | this.fields() | 96 | this.fields() |
100 | ) | 97 | ) |
101 | ) | 98 | ) |
102 | } | 99 | } |
103 | ]}); | 100 | ]}); |
104 | 101 | ||
105 | MochiKit.Signal.connect(this.getElement('select'), 'onchange', this, 'handleSelectChange'); | 102 | MochiKit.Signal.connect(this.getElement('select'), 'onchange', this, 'handleSelectChange'); |
106 | MochiKit.Signal.connect(this.getElement('showHide'), 'onclick', this, 'handleShowHide'); | 103 | MochiKit.Signal.connect(this.getElement('showHide'), 'onclick', this, 'handleShowHide'); |
107 | 104 | ||
108 | if (! MochiKit.Base.isUndefinedOrNull(this.initiallySelectedFieldKey())) { | 105 | if (! MochiKit.Base.isUndefinedOrNull(this.initiallySelectedFieldKey())) { |
109 | initiallySelectedOptions = MochiKit.Selector.findChildElements(this.element(), ['option[value=' + this.initiallySelectedFieldKey() + ']']); | 106 | initiallySelectedOptions = MochiKit.Selector.findChildElements(this.element(), ['option[value=' + this.initiallySelectedFieldKey() + ']']); |
110 | if (initiallySelectedOptions.length == 1) { | 107 | if (initiallySelectedOptions.length == 1) { |
111 | MochiKit.DOM.updateNodeAttributes(initiallySelectedOptions[0], {selected:true}); | 108 | MochiKit.DOM.updateNodeAttributes(initiallySelectedOptions[0], {selected:true}); |
112 | this.handleSelectChange(); | 109 | this.handleSelectChange(); |
113 | } | 110 | } |
114 | } | 111 | } |
115 | }, | 112 | }, |
116 | 113 | ||
117 | //------------------------------------------------------------------------- | 114 | //------------------------------------------------------------------------- |
118 | 115 | ||
119 | 'setFieldValue': function (aValue) { | 116 | 'setFieldValue': function (aValue) { |
120 | this.getElement('input').value = aValue; | 117 | this.getElement('input').value = aValue; |