Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js') (more/less context) (show whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js index b91eb98..fa57233 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.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.DirectLoginEditingFormValueComponent = function(args) { | 28 | Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent = function(args) { |
32 | args = args || {}; | 29 | args = args || {}; |
33 | 30 | ||
34 | Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent.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._fieldOptions = args.fieldOptions || Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | this._fieldOptions = args.fieldOptions || Clipperz.Base.exception.raise('MandatoryParameter'); |
38 | this._initialValue = args.initialValue || null; | 35 | this._initialValue = args.initialValue || 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.DirectLoginEditingFormValueComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent, 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.DirectLoginEditingFormValueComponent component"; | 47 | return "Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent 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 | 'fieldOptions': function () { | 58 | 'fieldOptions': function () { |
62 | return this._fieldOptions; | 59 | return this._fieldOptions; |
63 | }, | 60 | }, |
64 | 61 | ||
65 | 'fieldType': function () { | 62 | 'fieldType': function () { |
66 | return this.fieldOptions()['type']; | 63 | return this.fieldOptions()['type']; |
67 | }, | 64 | }, |
68 | 65 | ||
69 | 'optionValues': function () { | 66 | 'optionValues': function () { |
70 | return MochiKit.Base.map(function (anOptionValue) { | 67 | return MochiKit.Base.map(function (anOptionValue) { |
71 | return { | 68 | return { |
72 | 'label': anOptionValue['label'] || anOptionValue['value'], | 69 | 'label': anOptionValue['label'] || anOptionValue['value'], |
73 | 'value': anOptionValue['value'] | 70 | 'value': anOptionValue['value'] |
74 | } | 71 | } |
75 | }, this.fieldOptions()['options']); | 72 | }, this.fieldOptions()['options']); |
76 | }, | 73 | }, |
77 | 74 | ||
78 | //------------------------------------------------------------------------- | 75 | //------------------------------------------------------------------------- |
79 | 76 | ||
80 | 'selectedValue': function () { | 77 | 'selectedValue': function () { |
81 | var result; | 78 | var result; |
82 | 79 | ||
83 | result = this.getElement('select').value; | 80 | result = this.getElement('select').value; |
84 | 81 | ||
85 | if (result == '---') { | 82 | if (result == '---') { |
86 | result = null; | 83 | result = null; |
87 | } | 84 | } |
88 | 85 | ||
89 | return result; | 86 | return result; |
90 | }, | 87 | }, |
91 | 88 | ||
92 | 'initialValue': function () { | 89 | 'initialValue': function () { |
93 | return this._initialValue; | 90 | return this._initialValue; |
94 | }, | 91 | }, |
95 | 92 | ||
96 | //========================================================================= | 93 | //========================================================================= |
97 | 94 | ||
98 | 'renderSelf': function() { | 95 | 'renderSelf': function() { |
99 | //console.log(">>> DirectLoginEditingFormValueComponent.renderSelf"); | 96 | //console.log(">>> DirectLoginEditingFormValueComponent.renderSelf"); |
100 | //console.log("FIELD OPTIONS", this.fieldOptions()); | 97 | //console.log("FIELD OPTIONS", this.fieldOptions()); |
101 | //console.log("OPTION VALUES", this.optionValues()); | 98 | //console.log("OPTION VALUES", this.optionValues()); |
102 | this.append(this.element(), {tag:'div', id:this.getId('div'), cls:'formValue', children:[ | 99 | this.append(this.element(), {tag:'div', id:this.getId('div'), cls:'formValue', children:[ |
103 | {tag:'span', cls:'formFieldName', html:this.formFieldName()}, | 100 | {tag:'span', cls:'formFieldName', html:this.formFieldName()}, |
104 | {tag:'div', id:this.getId('values')} | 101 | {tag:'div', id:this.getId('values')} |
105 | ]}); | 102 | ]}); |
106 | 103 | ||
107 | if ((this.fieldType() == 'radio') || (this.fieldType() == 'select')) { | 104 | if ((this.fieldType() == 'radio') || (this.fieldType() == 'select')) { |
108 | this.append(this.getElement('values'), | 105 | this.append(this.getElement('values'), |
109 | {tag:'select', name:this.formFieldName(), id:this.getId('select'), cls:'formFieldMatchinCardField', children: | 106 | {tag:'select', name:this.formFieldName(), id:this.getId('select'), cls:'formFieldMatchinCardField', children: |
110 | MochiKit.Base.flattenArguments( | 107 | MochiKit.Base.flattenArguments( |
111 | // {tag:'option', value:'---', html:"---"}, | 108 | // {tag:'option', value:'---', html:"---"}, |
112 | MochiKit.Base.map( | 109 | MochiKit.Base.map( |
113 | MochiKit.Base.bind(function (aValue) { return {tag:'option', value:aValue['value'], html:aValue['label']}; }, this), | 110 | MochiKit.Base.bind(function (aValue) { return {tag:'option', value:aValue['value'], html:aValue['label']}; }, this), |
114 | this.optionValues() | 111 | this.optionValues() |
115 | ) | 112 | ) |
116 | ) | 113 | ) |
117 | } | 114 | } |
118 | ); | 115 | ); |
119 | 116 | ||
120 | MochiKit.Signal.connect(this.getElement('select'), 'onchange', this, 'handleSelectChange'); | 117 | MochiKit.Signal.connect(this.getElement('select'), 'onchange', this, 'handleSelectChange'); |