Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginValueComponent.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginValueComponent.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginValueComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginValueComponent.js index d210100..b478d94 100644 --- a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginValueComponent.js +++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginValueComponent.js | |||
@@ -1,118 +1,116 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer 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 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | 26 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } |
29 | if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; } | 27 | if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; } |
30 | 28 | ||
31 | //############################################################################# | 29 | //############################################################################# |
32 | 30 | ||
33 | Clipperz.PM.Components.RecordDetail.DirectLoginValueComponent = function(anElement, args) { | 31 | Clipperz.PM.Components.RecordDetail.DirectLoginValueComponent = function(anElement, args) { |
34 | //MochiKit.Logging.logDebug(">>> new DirectLoginValueComponent"); | 32 | //MochiKit.Logging.logDebug(">>> new DirectLoginValueComponent"); |
35 | args = args || {}; | 33 | args = args || {}; |
36 | 34 | ||
37 | Clipperz.PM.Components.RecordDetail.DirectLoginValueComponent.superclass.constructor.call(this, anElement, args); | 35 | Clipperz.PM.Components.RecordDetail.DirectLoginValueComponent.superclass.constructor.call(this, anElement, args); |
38 | 36 | ||
39 | this._directLoginInputValue = args.directLoginInputValue || null; | 37 | this._directLoginInputValue = args.directLoginInputValue || null; |
40 | this._value = this.directLoginInputValue().directLogin().formValues()[this.directLoginInputValue().name()]; | 38 | this._value = this.directLoginInputValue().directLogin().formValues()[this.directLoginInputValue().name()]; |
41 | 39 | ||
42 | this.render(); | 40 | this.render(); |
43 | //MochiKit.Logging.logDebug("<<< new DirectLoginValueComponent - record: " + this.record()); | 41 | //MochiKit.Logging.logDebug("<<< new DirectLoginValueComponent - record: " + this.record()); |
44 | 42 | ||
45 | return this; | 43 | return this; |
46 | } | 44 | } |
47 | 45 | ||
48 | //============================================================================= | 46 | //============================================================================= |
49 | 47 | ||
50 | YAHOO.extendX(Clipperz.PM.Components.RecordDetail.DirectLoginValueComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, { | 48 | YAHOO.extendX(Clipperz.PM.Components.RecordDetail.DirectLoginValueComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, { |
51 | 49 | ||
52 | 'toString': function() { | 50 | 'toString': function() { |
53 | return "Clipperz.PM.Components.RecordDetail.DirectLoginValueComponent component - " + this.directLoginInputValue().name(); | 51 | return "Clipperz.PM.Components.RecordDetail.DirectLoginValueComponent component - " + this.directLoginInputValue().name(); |
54 | }, | 52 | }, |
55 | 53 | ||
56 | //------------------------------------------------------------------------- | 54 | //------------------------------------------------------------------------- |
57 | 55 | ||
58 | 'directLoginInputValue': function() { | 56 | 'directLoginInputValue': function() { |
59 | return this._directLoginInputValue; | 57 | return this._directLoginInputValue; |
60 | }, | 58 | }, |
61 | 59 | ||
62 | //------------------------------------------------------------------------- | 60 | //------------------------------------------------------------------------- |
63 | 61 | ||
64 | 'render': function() { | 62 | 'render': function() { |
65 | //MochiKit.Logging.logDebug(">>> DirectLoginValueComponent.render"); | 63 | //MochiKit.Logging.logDebug(">>> DirectLoginValueComponent.render"); |
66 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginDataLabelTD', children:[ | 64 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginDataLabelTD', children:[ |
67 | {tag:'span', html:this.directLoginInputValue().name()} | 65 | {tag:'span', html:this.directLoginInputValue().name()} |
68 | ]}); | 66 | ]}); |
69 | //MochiKit.Logging.logDebug("--- DirectLoginValueComponent.render - 1"); | 67 | //MochiKit.Logging.logDebug("--- DirectLoginValueComponent.render - 1"); |
70 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginDataValueTD', children:[ | 68 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginDataValueTD', children:[ |
71 | {tag:'span', id:this.getId('inputElement')} | 69 | {tag:'span', id:this.getId('inputElement')} |
72 | ]}); | 70 | ]}); |
73 | //MochiKit.Logging.logDebug("--- DirectLoginValueComponent.render - 2"); | 71 | //MochiKit.Logging.logDebug("--- DirectLoginValueComponent.render - 2"); |
74 | this.update(); | 72 | this.update(); |
75 | //MochiKit.Logging.logDebug("<<< DirectLoginValueComponent.render"); | 73 | //MochiKit.Logging.logDebug("<<< DirectLoginValueComponent.render"); |
76 | }, | 74 | }, |
77 | 75 | ||
78 | //------------------------------------------------------------------------- | 76 | //------------------------------------------------------------------------- |
79 | 77 | ||
80 | 'inputElementConfiguration': function() { | 78 | 'inputElementConfiguration': function() { |
81 | var result; | 79 | var result; |
82 | var currentValue; | 80 | var currentValue; |
83 | 81 | ||
84 | //MochiKit.Logging.logDebug(">>> DirectLoginValueComponent.inputElementConfiguration - " + this.directLoginInputValue().name()); | 82 | //MochiKit.Logging.logDebug(">>> DirectLoginValueComponent.inputElementConfiguration - " + this.directLoginInputValue().name()); |
85 | result = []; | 83 | result = []; |
86 | currentValue = this.value(); | 84 | currentValue = this.value(); |
87 | 85 | ||
88 | switch (this.directLoginInputValue().type()) { | 86 | switch (this.directLoginInputValue().type()) { |
89 | case 'checkbox': | 87 | case 'checkbox': |
90 | var checkbox; | 88 | var checkbox; |
91 | //{"type":"checkbox", "name":"rememberUsernameChk", "value":"checkbox"} | 89 | //{"type":"checkbox", "name":"rememberUsernameChk", "value":"checkbox"} |
92 | checkbox = {tag:'input', id:this.getId('checkbox'), type:'checkbox'} | 90 | checkbox = {tag:'input', id:this.getId('checkbox'), type:'checkbox'} |
93 | if (currentValue == true) { | 91 | if (currentValue == true) { |
94 | checkbox.checked = true; | 92 | checkbox.checked = true; |
95 | } | 93 | } |
96 | result.push(checkbox); | 94 | result.push(checkbox); |
97 | break; | 95 | break; |
98 | 96 | ||
99 | case 'select': | 97 | case 'select': |
100 | var input; | 98 | var input; |
101 | //{"type":"select", "name":"DOMAIN", "options":[{"selected":true, "label":"@tin.it", "value":"tin.it"}, {"selected":false, "label":"@virgilio.it", "value":"virgilio.it"}]} | 99 | //{"type":"select", "name":"DOMAIN", "options":[{"selected":true, "label":"@tin.it", "value":"tin.it"}, {"selected":false, "label":"@virgilio.it", "value":"virgilio.it"}]} |
102 | input = {tag:'select', id:this.getId('select'), name:this.directLoginInputValue().name(), children:[]}; | 100 | input = {tag:'select', id:this.getId('select'), name:this.directLoginInputValue().name(), children:[]}; |
103 | input.children.push({tag:'option', value:null, html:"---"}); | 101 | input.children.push({tag:'option', value:null, html:"---"}); |
104 | MochiKit.Iter.forEach(this.directLoginInputValue().args()['options'], function(anOption) { | 102 | MochiKit.Iter.forEach(this.directLoginInputValue().args()['options'], function(anOption) { |
105 | var option; | 103 | var option; |
106 | 104 | ||
107 | //TODO: remove the value: field and replace it with element.dom.value = <some value> | 105 | //TODO: remove the value: field and replace it with element.dom.value = <some value> |
108 | option = {tag:'option', value:anOption['value'], html:anOption['label']} | 106 | option = {tag:'option', value:anOption['value'], html:anOption['label']} |
109 | if (currentValue == anOption['value']) { | 107 | if (currentValue == anOption['value']) { |
110 | option.selected = true; | 108 | option.selected = true; |
111 | } | 109 | } |
112 | input.children.push(option); | 110 | input.children.push(option); |
113 | }) | 111 | }) |
114 | result.push(input); | 112 | result.push(input); |
115 | break; | 113 | break; |
116 | 114 | ||
117 | case 'radio': | 115 | case 'radio': |
118 | var name; | 116 | var name; |