Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js index c1a7c13..b58062c 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js | |||
@@ -1,190 +1,187 @@ | |||
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.CardDialogRecordFieldComponent = function(args) { | 28 | Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent = function(args) { |
32 | args = args || {}; | 29 | args = args || {}; |
33 | 30 | ||
34 | Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent.superclass.constructor.apply(this, arguments); |
35 | 32 | ||
36 | this._reference = args.reference|| Clipperz.Base.exception.raise('MandatoryParameter'); | 33 | this._reference = args.reference|| Clipperz.Base.exception.raise('MandatoryParameter'); |
37 | this._actionType = null; | 34 | this._actionType = null; |
38 | 35 | ||
39 | return this; | 36 | return this; |
40 | } | 37 | } |
41 | 38 | ||
42 | //============================================================================= | 39 | //============================================================================= |
43 | 40 | ||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 41 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { |
45 | 42 | ||
46 | //------------------------------------------------------------------------- | 43 | //------------------------------------------------------------------------- |
47 | 44 | ||
48 | 'toString': function () { | 45 | 'toString': function () { |
49 | return "Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent component"; | 46 | return "Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent component"; |
50 | }, | 47 | }, |
51 | 48 | ||
52 | //------------------------------------------------------------------------- | 49 | //------------------------------------------------------------------------- |
53 | 50 | ||
54 | 'renderSelf': function() { | 51 | 'renderSelf': function() { |
55 | this.append(this.element(), [ | 52 | this.append(this.element(), [ |
56 | {tag:'td', cls:'fieldState'}, | 53 | {tag:'td', cls:'fieldState'}, |
57 | {tag:'td', cls:'fieldLabel', children:[ | 54 | {tag:'td', cls:'fieldLabel', children:[ |
58 | {tag:'input', cls:'label', id:this.getId('label')} | 55 | {tag:'input', cls:'label', id:this.getId('label')} |
59 | ]}, | 56 | ]}, |
60 | {tag:'td', cls:'fieldLock', children:[ | 57 | {tag:'td', cls:'fieldLock', children:[ |
61 | {tag:'div', cls:'unlocked', id:this.getId('isHidden')} | 58 | {tag:'div', cls:'unlocked', id:this.getId('isHidden')} |
62 | ]}, | 59 | ]}, |
63 | {tag:'td', cls:'fieldValue', children:[ | 60 | {tag:'td', cls:'fieldValue', children:[ |
64 | {tag:'div', cls:'unlocked', id:this.getId('valueWrapper'), children:[ | 61 | {tag:'div', cls:'unlocked', id:this.getId('valueWrapper'), children:[ |
65 | {tag:'input', type:'text', cls:'value', id:this.getId('value')} | 62 | {tag:'input', type:'text', cls:'value', id:this.getId('value')} |
66 | ]} | 63 | ]} |
67 | ]}, | 64 | ]}, |
68 | {tag:'td', cls:'fieldAction', children:[ | 65 | {tag:'td', cls:'fieldAction', children:[ |
69 | {tag:'a', href:'#', id:this.getId('actionLink'), html:' '} | 66 | {tag:'a', href:'#', id:this.getId('actionLink'), html:' '} |
70 | ]}, | 67 | ]}, |
71 | {tag:'td', cls:'fieldAddDelete', children:[ | 68 | {tag:'td', cls:'fieldAddDelete', children:[ |
72 | {tag:'div', cls:'delete', children:[ | 69 | {tag:'div', cls:'delete', children:[ |
73 | {tag:'span', children:[ | 70 | {tag:'span', children:[ |
74 | {tag:'a', href:'#', id:this.getId('delete'), html:"delete"} | 71 | {tag:'a', href:'#', id:this.getId('delete'), html:"delete"} |
75 | ]} | 72 | ]} |
76 | ]} | 73 | ]} |
77 | ]} | 74 | ]} |
78 | ]); | 75 | ]); |
79 | 76 | ||
80 | MochiKit.Signal.connect(this.getId('label'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | 77 | MochiKit.Signal.connect(this.getId('label'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); |
81 | MochiKit.Signal.connect(this.getId('isHidden'), 'onclick',this, 'toggleIsHidden'); | 78 | MochiKit.Signal.connect(this.getId('isHidden'), 'onclick',this, 'toggleIsHidden'); |
82 | MochiKit.Signal.connect(this.getId('value'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | 79 | MochiKit.Signal.connect(this.getId('value'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); |
83 | MochiKit.Signal.connect(this.getId('actionLink'), 'onclick',this, 'handleActionLink'); | 80 | MochiKit.Signal.connect(this.getId('actionLink'), 'onclick',this, 'handleActionLink'); |
84 | MochiKit.Signal.connect(this.getId('delete'), 'onclick',this, 'deleteField'); | 81 | MochiKit.Signal.connect(this.getId('delete'), 'onclick',this, 'deleteField'); |
85 | // MochiKit.Signal.connect(this.getId('delete'), 'onclick',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'deleteField', this.reference())); | 82 | // MochiKit.Signal.connect(this.getId('delete'), 'onclick',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'deleteField', this.reference())); |
86 | }, | 83 | }, |
87 | 84 | ||
88 | //------------------------------------------------------------------------- | 85 | //------------------------------------------------------------------------- |
89 | 86 | ||
90 | 'shouldShowElementWhileRendering': function () { | 87 | 'shouldShowElementWhileRendering': function () { |
91 | return false; | 88 | return false; |
92 | }, | 89 | }, |
93 | 90 | ||
94 | //========================================================================= | 91 | //========================================================================= |
95 | 92 | ||
96 | 'reference': function () { | 93 | 'reference': function () { |
97 | return this._reference; | 94 | return this._reference; |
98 | }, | 95 | }, |
99 | 96 | ||
100 | //========================================================================= | 97 | //========================================================================= |
101 | 98 | ||
102 | 'label': function () { | 99 | 'label': function () { |
103 | return this.getElement('label').value; | 100 | return this.getElement('label').value; |
104 | }, | 101 | }, |
105 | 102 | ||
106 | 'setLabel': function (aValue) { | 103 | 'setLabel': function (aValue) { |
107 | // this.getElement('label').value = Clipperz.Base.sanitizeString(aValue); | 104 | // this.getElement('label').value = Clipperz.Base.sanitizeString(aValue); |
108 | this.getElement('label').value = aValue; | 105 | this.getElement('label').value = aValue; |
109 | }, | 106 | }, |
110 | 107 | ||
111 | //========================================================================= | 108 | //========================================================================= |
112 | 109 | ||
113 | 'value': function () { | 110 | 'value': function () { |
114 | return this.getElement('value').value; | 111 | return this.getElement('value').value; |
115 | }, | 112 | }, |
116 | 113 | ||
117 | 'setValue': function (aValue) { | 114 | 'setValue': function (aValue) { |
118 | // this.getElement('value').value = Clipperz.Base.sanitizeString(aValue); | 115 | // this.getElement('value').value = Clipperz.Base.sanitizeString(aValue); |
119 | this.getElement('value').value = aValue; | 116 | this.getElement('value').value = aValue; |
120 | }, | 117 | }, |
121 | 118 | ||
122 | //------------------------------------------------------------------------- | 119 | //------------------------------------------------------------------------- |
123 | 120 | ||
124 | 'actionType': function () { | 121 | 'actionType': function () { |
125 | return this._actionType; | 122 | return this._actionType; |
126 | }, | 123 | }, |
127 | 124 | ||
128 | 'setActionType': function (anActionType) { | 125 | 'setActionType': function (anActionType) { |
129 | this._actionType = anActionType; | 126 | this._actionType = anActionType; |
130 | 127 | ||
131 | switch (this._actionType) { | 128 | switch (this._actionType) { |
132 | case 'NONE': | 129 | case 'NONE': |
133 | MochiKit.Style.hideElement(this.getId('actionLink')); | 130 | MochiKit.Style.hideElement(this.getId('actionLink')); |
134 | MochiKit.DOM.setElementClass(this.getId('actionLink'), ''); | 131 | MochiKit.DOM.setElementClass(this.getId('actionLink'), ''); |
135 | break; | 132 | break; |
136 | case 'URL': | 133 | case 'URL': |
137 | MochiKit.Style.showElement(this.getId('actionLink')); | 134 | MochiKit.Style.showElement(this.getId('actionLink')); |
138 | MochiKit.DOM.setElementClass(this.getId('actionLink'), 'url'); | 135 | MochiKit.DOM.setElementClass(this.getId('actionLink'), 'url'); |
139 | break; | 136 | break; |
140 | case 'EMAIL': | 137 | case 'EMAIL': |
141 | MochiKit.Style.showElement(this.getId('actionLink')); | 138 | MochiKit.Style.showElement(this.getId('actionLink')); |
142 | MochiKit.DOM.setElementClass(this.getId('actionLink'), 'email'); | 139 | MochiKit.DOM.setElementClass(this.getId('actionLink'), 'email'); |
143 | break; | 140 | break; |
144 | case 'PASSWORD': | 141 | case 'PASSWORD': |
145 | MochiKit.Style.showElement(this.getId('actionLink')); | 142 | MochiKit.Style.showElement(this.getId('actionLink')); |
146 | MochiKit.DOM.setElementClass(this.getId('actionLink'), 'password'); | 143 | MochiKit.DOM.setElementClass(this.getId('actionLink'), 'password'); |
147 | break; | 144 | break; |
148 | } | 145 | } |
149 | }, | 146 | }, |
150 | 147 | ||
151 | //========================================================================= | 148 | //========================================================================= |
152 | 149 | ||
153 | 'isHidden': function () { | 150 | 'isHidden': function () { |
154 | // return this.getElement('value').value; | 151 | // return this.getElement('value').value; |
155 | return MochiKit.DOM.hasElementClass(this.getElement('isHidden'), 'locked'); | 152 | return MochiKit.DOM.hasElementClass(this.getElement('isHidden'), 'locked'); |
156 | }, | 153 | }, |
157 | 154 | ||
158 | 'setIsHidden': function (aValue) { | 155 | 'setIsHidden': function (aValue) { |
159 | // this.getElement('value').value = Clipperz.Base.sanitizeString(aValue); | 156 | // this.getElement('value').value = Clipperz.Base.sanitizeString(aValue); |
160 | MochiKit.DOM.setElementClass(this.getElement('isHidden'), (aValue ? 'locked': 'unlocked')); | 157 | MochiKit.DOM.setElementClass(this.getElement('isHidden'), (aValue ? 'locked': 'unlocked')); |
161 | MochiKit.DOM.setElementClass(this.getElement('valueWrapper'), (aValue ? 'locked': 'unlocked')); | 158 | MochiKit.DOM.setElementClass(this.getElement('valueWrapper'), (aValue ? 'locked': 'unlocked')); |
162 | }, | 159 | }, |
163 | 160 | ||
164 | 'toggleIsHidden': function (anEvent) { | 161 | 'toggleIsHidden': function (anEvent) { |
165 | anEvent.preventDefault(); | 162 | anEvent.preventDefault(); |
166 | 163 | ||
167 | this.setIsHidden(! this.isHidden()); | 164 | this.setIsHidden(! this.isHidden()); |
168 | MochiKit.Signal.signal(this, 'changedValue'); | 165 | MochiKit.Signal.signal(this, 'changedValue'); |
169 | }, | 166 | }, |
170 | 167 | ||
171 | //========================================================================= | 168 | //========================================================================= |
172 | 169 | ||
173 | 'handleActionLink': function (anEvent) { | 170 | 'handleActionLink': function (anEvent) { |
174 | anEvent.preventDefault(); | 171 | anEvent.preventDefault(); |
175 | 172 | ||
176 | //console.log("ACTION LINK - " + this.actionType()); | 173 | //console.log("ACTION LINK - " + this.actionType()); |
177 | MochiKit.Signal.signal(this, 'performAction', this.reference(), anEvent.target()); | 174 | MochiKit.Signal.signal(this, 'performAction', this.reference(), anEvent.target()); |
178 | }, | 175 | }, |
179 | 176 | ||
180 | //========================================================================= | 177 | //========================================================================= |
181 | 178 | ||
182 | 'deleteField': function (anEvent) { | 179 | 'deleteField': function (anEvent) { |
183 | anEvent.preventDefault(); | 180 | anEvent.preventDefault(); |
184 | 181 | ||
185 | MochiKit.Signal.signal(this, 'deleteField', this.reference()); | 182 | MochiKit.Signal.signal(this, 'deleteField', this.reference()); |
186 | }, | 183 | }, |
187 | 184 | ||
188 | //========================================================================= | 185 | //========================================================================= |
189 | __syntaxFix__: "syntax fix" | 186 | __syntaxFix__: "syntax fix" |
190 | }); | 187 | }); |