summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js
Unidiff
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.js27
1 files changed, 10 insertions, 17 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 fa57233..58b5b26 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js
@@ -1,34 +1,32 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); 24Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
27 25
28Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent = function(args) { 26Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent = function(args) {
29 args = args || {}; 27 args = args || {};
30 28
31 Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent.superclass.constructor.apply(this, arguments); 29 Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent.superclass.constructor.apply(this, arguments);
32 30
33 this._formFieldName = args.formFieldName|| Clipperz.Base.exception.raise('MandatoryParameter'); 31 this._formFieldName = args.formFieldName|| Clipperz.Base.exception.raise('MandatoryParameter');
34 this._fieldOptions = args.fieldOptions || Clipperz.Base.exception.raise('MandatoryParameter'); 32 this._fieldOptions = args.fieldOptions || Clipperz.Base.exception.raise('MandatoryParameter');
@@ -84,27 +82,24 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueCo
84 } 82 }
85 83
86 return result; 84 return result;
87 }, 85 },
88 86
89 'initialValue': function () { 87 'initialValue': function () {
90 return this._initialValue; 88 return this._initialValue;
91 }, 89 },
92 90
93 //========================================================================= 91 //=========================================================================
94 92
95 'renderSelf': function() { 93 'renderSelf': function() {
96//console.log(">>> DirectLoginEditingFormValueComponent.renderSelf");
97//console.log("FIELD OPTIONS", this.fieldOptions());
98//console.log("OPTION VALUES", this.optionValues());
99 this.append(this.element(), {tag:'div', id:this.getId('div'), cls:'formValue', children:[ 94 this.append(this.element(), {tag:'div', id:this.getId('div'), cls:'formValue', children:[
100 {tag:'span', cls:'formFieldName', html:this.formFieldName()}, 95 {tag:'span', cls:'formFieldName', html:this.formFieldName()},
101 {tag:'div', id:this.getId('values')} 96 {tag:'div', id:this.getId('values')}
102 ]}); 97 ]});
103 98
104 if ((this.fieldType() == 'radio') || (this.fieldType() == 'select')) { 99 if ((this.fieldType() == 'radio') || (this.fieldType() == 'select')) {
105 this.append(this.getElement('values'), 100 this.append(this.getElement('values'),
106 {tag:'select', name:this.formFieldName(), id:this.getId('select'), cls:'formFieldMatchinCardField', children: 101 {tag:'select', name:this.formFieldName(), id:this.getId('select'), cls:'formFieldMatchinCardField', children:
107 MochiKit.Base.flattenArguments( 102 MochiKit.Base.flattenArguments(
108 // {tag:'option', value:'---', html:"---"}, 103 // {tag:'option', value:'---', html:"---"},
109 MochiKit.Base.map( 104 MochiKit.Base.map(
110 MochiKit.Base.bind(function (aValue) { return {tag:'option', value:aValue['value'], html:aValue['label']}; }, this), 105 MochiKit.Base.bind(function (aValue) { return {tag:'option', value:aValue['value'], html:aValue['label']}; }, this),
@@ -132,31 +127,29 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueCo
132 this.append(this.getElement('values'), 127 this.append(this.getElement('values'),
133 {tag:'input', type:'checkbox', name:this.formFieldName(), id:this.getId('checkbox'), cls:'formFieldMatchinCardField'} 128 {tag:'input', type:'checkbox', name:this.formFieldName(), id:this.getId('checkbox'), cls:'formFieldMatchinCardField'}
134 ); 129 );
135 130
136 MochiKit.Signal.connect(this.getElement('checkbox'), 'onchange', this, 'handleSelectChange'); 131 MochiKit.Signal.connect(this.getElement('checkbox'), 'onchange', this, 'handleSelectChange');
137 132
138 if (this.initialValue()) { 133 if (this.initialValue()) {
139 MochiKit.DOM.updateNodeAttributes(this.getElement('checkbox'), {checked:true}); 134 MochiKit.DOM.updateNodeAttributes(this.getElement('checkbox'), {checked:true});
140 } 135 }
141 } else { 136 } else {
142 WTF = TODO; 137 WTF = TODO;
143 } 138 }
144//console.log("<<< DirectLoginEditingFormValueComponent.renderSelf");
145 }, 139 },
146 140
147 //========================================================================= 141 //=========================================================================
148 142
149 'handleSelectChange': function (anEvent) { 143 'handleSelectChange': function (anEvent) {
150//console.log("handleSelectChange", anEvent, anEvent.src(), anEvent.src().value);
151 var options; 144 var options;
152 145
153 options = {}; 146 options = {};
154 147
155 options['fieldName'] = this.formFieldName(); 148 options['fieldName'] = this.formFieldName();
156 149
157 if (this.fieldType() == 'checkbox') { 150 if (this.fieldType() == 'checkbox') {
158 options['selectedValue'] = (this.getElement('checkbox').checked ? 1 : null); 151 options['selectedValue'] = (this.getElement('checkbox').checked ? 1 : null);
159 } else { 152 } else {
160 options['selectedValue'] = this.selectedValue(); 153 options['selectedValue'] = this.selectedValue();
161 } 154 }
162 155