summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js23
1 files changed, 10 insertions, 13 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js
index 5114b1d..55d2c01 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js
@@ -1,300 +1,297 @@
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.DirectLoginEditingComponent = function(args) { 26Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent = function(args) {
29 args = args || {}; 27 args = args || {};
30 28
31 Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent.superclass.constructor.apply(this, arguments); 29 Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent.superclass.constructor.apply(this, arguments);
32 30
33 this._tabPanelController = null; 31 this._tabPanelController = null;
34 32
35 this._initiallySelectedTab = args.selected || 'TYPE'; 33 this._initiallySelectedTab = args.selected || 'TYPE';
36 this._tabPanelControllerConfiguration = { 34 this._tabPanelControllerConfiguration = {
37 'LABEL': { 35 'LABEL': {
38 tab:'labelTab', 36 tab:'labelTab',
39 panel:'labelTabpanel' 37 panel:'labelTabpanel'
40 }, 38 },
41 'TYPE': { 39 'TYPE': {
42 tab:'typeTab', 40 tab:'typeTab',
43 panel:'typeTabpanel' 41 panel:'typeTabpanel'
44 }, 42 },
45 'CONFIGURATION': { 43 'CONFIGURATION': {
46 tab:'configurationTab', 44 tab:'configurationTab',
47 panel:'configurationTabpanel' 45 panel:'configurationTabpanel'
48 }, 46 },
49 'BINDINGS': { 47 'BINDINGS': {
50 tab:'bindingsTab', 48 tab:'bindingsTab',
51 panel:'bindingsTabpanel' 49 panel:'bindingsTabpanel'
52 }, 50 },
53 'FAVICON': { 51 'FAVICON': {
54 tab:'faviconTab', 52 tab:'faviconTab',
55 panel:'faviconTabpanel' 53 panel:'faviconTabpanel'
56 }, 54 },
57 'DONE': { 55 'DONE': {
58 tab:'doneTab', 56 tab:'doneTab',
59 panel:'doneTabpanel' 57 panel:'doneTabpanel'
60 } 58 }
61 }; 59 };
62 60
63 this._directLoginReference = null; 61 this._directLoginReference = null;
64 62
65 this._directLoginFavicon = null; 63 this._directLoginFavicon = null;
66 64
67 this._updateFaviconCounter = 0; 65 this._updateFaviconCounter = 0;
68 this._faviconComponent = null; 66 this._faviconComponent = null;
69 67
70 this._bindingComponents= []; 68 this._bindingComponents= [];
71 this._formValueComponents = []; 69 this._formValueComponents = [];
72 70
73 return this; 71 return this;
74} 72}
75 73
76//============================================================================= 74//=============================================================================
77 75
78//Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { 76//Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent, Clipperz.PM.UI.Common.Components.BaseComponent, {
79Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent, Clipperz.PM.UI.Common.Components.TabPanelComponent, { 77Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent, Clipperz.PM.UI.Common.Components.TabPanelComponent, {
80 78
81 //------------------------------------------------------------------------- 79 //-------------------------------------------------------------------------
82 80
83 'toString': function () { 81 'toString': function () {
84 return "Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent component"; 82 return "Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent component";
85 }, 83 },
86 84
87 //========================================================================= 85 //=========================================================================
88 86
89 'directLoginReference': function () { 87 'directLoginReference': function () {
90 return this._directLoginReference; 88 return this._directLoginReference;
91 }, 89 },
92 90
93 //------------------------------------------------------------------------- 91 //-------------------------------------------------------------------------
94 92
95 'setDirectLoginReference': function (aDirectLoginReference) { 93 'setDirectLoginReference': function (aDirectLoginReference) {
96 this._directLoginReference = aDirectLoginReference; 94 this._directLoginReference = aDirectLoginReference;
97 95
98 return this._directLoginReference; 96 return this._directLoginReference;
99 }, 97 },
100 98
101 //========================================================================= 99 //=========================================================================
102 100
103 'label': function () { 101 'label': function () {
104 return this.getElement('label').value 102 return this.getElement('label').value
105 }, 103 },
106 104
107 'setLabel': function (aValue) { 105 'setLabel': function (aValue) {
108//console.log("##> LABEL: " + aValue);
109 this.getElement('label').value = (aValue ? aValue : ''); 106 this.getElement('label').value = (aValue ? aValue : '');
110 }, 107 },
111 108
112 //------------------------------------------------------------------------- 109 //-------------------------------------------------------------------------
113 110
114 'favicon': function () { 111 'favicon': function () {
115 return this.getElement('faviconURL').value; 112 return this.getElement('faviconURL').value;
116 }, 113 },
117 114
118 'setFavicon': function (aValue) { 115 'setFavicon': function (aValue) {
119 var regexp; 116 var regexp;
120 var displayValue; 117 var displayValue;
121 118
122 regexp = new RegExp('^data\:\/\/.*', 'i'); 119 regexp = new RegExp('^data\:\/\/.*', 'i');
123 if (regexp.test(aValue)) { 120 if (regexp.test(aValue)) {
124 displayValue = '' 121 displayValue = ''
125 } else { 122 } else {
126 displayValue = (aValue ? aValue : ''); 123 displayValue = (aValue ? aValue : '');
127 } 124 }
128 125
129 this.getElement('faviconURL').value = displayValue; 126 this.getElement('faviconURL').value = displayValue;
130 this.faviconComponent().setSrc(aValue); 127 this.faviconComponent().setSrc(aValue);
131 }, 128 },
132 129
133 //'setFaviconData': function (aValue) { 130 //'setFaviconData': function (aValue) {
134 // this.getElement('faviconIcon').src = aValue; 131 // this.getElement('faviconIcon').src = aValue;
135 //}, 132 //},
136 133
137 'directLoginFavicon': function () { 134 'directLoginFavicon': function () {
138 return this._directLoginFavicon; 135 return this._directLoginFavicon;
139 }, 136 },
140 137
141 'setDirectLoginFavicon': function (aValue) { 138 'setDirectLoginFavicon': function (aValue) {
142 this._directLoginFavicon = aValue; 139 this._directLoginFavicon = aValue;
143 this.setFavicon(aValue); 140 this.setFavicon(aValue);
144 }, 141 },
145 142
146 //------------------------------------------------------------------------- 143 //-------------------------------------------------------------------------
147 144
148 'bookmarkletConfiguration': function () { 145 'bookmarkletConfiguration': function () {
149 return this.getElement('bookmarkletConfiguration').value 146 return this.getElement('bookmarkletConfiguration').value
150 }, 147 },
151 148
152 'setBookmarkletConfiguration': function (aValue) { 149 'setBookmarkletConfiguration': function (aValue) {
153 this.getElement('bookmarkletConfiguration').value = aValue; 150 this.getElement('bookmarkletConfiguration').value = aValue;
154 }, 151 },
155 152
156 'highlightConfigurationSyntaxError': function () { 153 'highlightConfigurationSyntaxError': function () {
157 MochiKit.DOM.addElementClass(this.getElement('bookmarkletConfiguration'), 'error'); 154 MochiKit.DOM.addElementClass(this.getElement('bookmarkletConfiguration'), 'error');
158 }, 155 },
159 156
160 'removeHighlightConfigurationSyntaxError': function () { 157 'removeHighlightConfigurationSyntaxError': function () {
161 MochiKit.DOM.removeElementClass(this.getElement('bookmarkletConfiguration'), 'error'); 158 MochiKit.DOM.removeElementClass(this.getElement('bookmarkletConfiguration'), 'error');
162 }, 159 },
163 160
164 //========================================================================= 161 //=========================================================================
165 162
166 'disableAllPanels': function () { 163 'disableAllPanels': function () {
167 this.getElement('label').disabled = true; 164 this.getElement('label').disabled = true;
168 MochiKit.DOM.addElementClass(this.getElement('label').parentNode, 'disabled'); 165 MochiKit.DOM.addElementClass(this.getElement('label').parentNode, 'disabled');
169 166
170 this.tabPanelController().selectTab(null); 167 this.tabPanelController().selectTab(null);
171 }, 168 },
172 169
173 //------------------------------------------------------------------------- 170 //-------------------------------------------------------------------------
174 171
175 //'disableLabelField': function () { 172 //'disableLabelField': function () {
176 // this.getElement('label').disabled = true; 173 // this.getElement('label').disabled = true;
177 // MochiKit.DOM.addElementClass(this.getElement('label').parentNode, 'disabled'); 174 // MochiKit.DOM.addElementClass(this.getElement('label').parentNode, 'disabled');
178 //}, 175 //},
179 176
180 'enableLabelField': function () { 177 'enableLabelField': function () {
181 this.getElement('label').disabled = false; 178 this.getElement('label').disabled = false;
182 MochiKit.DOM.removeElementClass(this.getElement('label').parentNode, 'disabled'); 179 MochiKit.DOM.removeElementClass(this.getElement('label').parentNode, 'disabled');
183 this.tabPanelController().selectTab('LABEL'); 180 this.tabPanelController().selectTab('LABEL');
184 }, 181 },
185 182
186 //------------------------------------------------------------------------- 183 //-------------------------------------------------------------------------
187 184
188 //'disableTypeField': function () { 185 //'disableTypeField': function () {
189 // this.tabPanelController().selectTab(null); 186 // this.tabPanelController().selectTab(null);
190 //}, 187 //},
191 188
192 'enableTypeField': function () { 189 'enableTypeField': function () {
193 this.tabPanelController().selectTab('TYPE'); 190 this.tabPanelController().selectTab('TYPE');
194 }, 191 },
195 192
196 //------------------------------------------------------------------------- 193 //-------------------------------------------------------------------------
197 194
198 //'disableConfigurationField': function () { 195 //'disableConfigurationField': function () {
199 // this.tabPanelController().selectTab(null); 196 // this.tabPanelController().selectTab(null);
200 //}, 197 //},
201 198
202 'enableConfigurationField': function () { 199 'enableConfigurationField': function () {
203 this.tabPanelController().selectTab('CONFIGURATION'); 200 this.tabPanelController().selectTab('CONFIGURATION');
204 }, 201 },
205 202
206 //------------------------------------------------------------------------- 203 //-------------------------------------------------------------------------
207 204
208 //'disableBindingFields': function () { 205 //'disableBindingFields': function () {
209 // this.tabPanelController().selectTab(null); 206 // this.tabPanelController().selectTab(null);
210 //}, 207 //},
211 208
212 'enableBindingFields': function () { 209 'enableBindingFields': function () {
213 this.tabPanelController().selectTab('BINDINGS'); 210 this.tabPanelController().selectTab('BINDINGS');
214 }, 211 },
215 212
216 //------------------------------------------------------------------------- 213 //-------------------------------------------------------------------------
217 214
218 //'disableFaviconField': function () { 215 //'disableFaviconField': function () {
219 // this.tabPanelController().selectTab(null); 216 // this.tabPanelController().selectTab(null);
220 //}, 217 //},
221 218
222 'enableFaviconField': function () { 219 'enableFaviconField': function () {
223 this.tabPanelController().selectTab('FAVICON'); 220 this.tabPanelController().selectTab('FAVICON');
224 }, 221 },
225 222
226 //------------------------------------------------------------------------- 223 //-------------------------------------------------------------------------
227 224
228 'enableDonePanel': function () { 225 'enableDonePanel': function () {
229 this.tabPanelController().selectTab('DONE'); 226 this.tabPanelController().selectTab('DONE');
230 }, 227 },
231 228
232 //========================================================================= 229 //=========================================================================
233 230
234 'shouldShowElementWhileRendering': function() { 231 'shouldShowElementWhileRendering': function() {
235 return false; 232 return false;
236 }, 233 },
237 234
238 //========================================================================= 235 //=========================================================================
239 236
240 'faviconComponent': function () { 237 'faviconComponent': function () {
241 if (this._faviconComponent == null) { 238 if (this._faviconComponent == null) {
242 this._faviconComponent = new Clipperz.PM.UI.Common.Components.FaviconComponent({element:this.getId('favicon')}); 239 this._faviconComponent = new Clipperz.PM.UI.Common.Components.FaviconComponent({element:this.getId('favicon')});
243 } 240 }
244 241
245 return this._faviconComponent; 242 return this._faviconComponent;
246 }, 243 },
247 244
248 //========================================================================= 245 //=========================================================================
249 246
250 'tabPanelController': function () { 247 'tabPanelController': function () {
251 if (this._tabPanelController == null) { 248 if (this._tabPanelController == null) {
252 this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({ 249 this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({
253 component:this, 250 component:this,
254 configuration:this._tabPanelControllerConfiguration 251 configuration:this._tabPanelControllerConfiguration
255 }); 252 });
256 253
257 MochiKit.Signal.connect(this._tabPanelController, 'tabSelected', this, 'handleTabSelected') 254 MochiKit.Signal.connect(this._tabPanelController, 'tabSelected', this, 'handleTabSelected')
258 } 255 }
259 256
260 return this._tabPanelController; 257 return this._tabPanelController;
261 }, 258 },
262 259
263 //------------------------------------------------------------------------- 260 //-------------------------------------------------------------------------
264 261
265 'renderSelf': function() { 262 'renderSelf': function() {
266 varbookmarkletComponent; 263 varbookmarkletComponent;
267 264
268 this.append(this.element(), {tag:'div', cls:'directLoginEditing', id:this.getId('panel'), children: [ 265 this.append(this.element(), {tag:'div', cls:'directLoginEditing', id:this.getId('panel'), children: [
269 // {tag:'div', cls:'back', children:[ 266 // {tag:'div', cls:'back', children:[
270 // {tag:'a', href:'#', id:this.getId('back'), html:"&nbsp;"} 267 // {tag:'a', href:'#', id:this.getId('back'), html:"&nbsp;"}
271 // ]}, 268 // ]},
272 {tag:'form', id:this.getId('form'), cls:'directLoginEditingForm', children:[ 269 {tag:'form', id:this.getId('form'), cls:'directLoginEditingForm', children:[
273 {tag:'div', cls:'title', children:[ 270 {tag:'div', cls:'title', children:[
274 {tag:'img', id:this.getId('favicon'), cls:'favicon'}, 271 {tag:'img', id:this.getId('favicon'), cls:'favicon'},
275 {tag:'input', type:'text', id:this.getId('label')}//, 272 {tag:'input', type:'text', id:this.getId('label')}//,
276 // {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.LABEL.description')}]}, 273 // {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.LABEL.description')}]},
277 ]}, 274 ]},
278 {tag:'div', cls:'tabContainer', children:[ 275 {tag:'div', cls:'tabContainer', children:[
279 {tag:'ul', cls:'tabs', children:[ 276 {tag:'ul', cls:'tabs', children:[
280 {tag:'li', id:this.getId('labelTab'), children:[{tag:'span', html:"label"}]}, 277 {tag:'li', id:this.getId('labelTab'), children:[{tag:'span', html:"label"}]},
281 {tag:'li', id:this.getId('typeTab'), children:[{tag:'span', html:"type"}]}, 278 {tag:'li', id:this.getId('typeTab'), children:[{tag:'span', html:"type"}]},
282 {tag:'li', id:this.getId('configurationTab'),children:[{tag:'span', html:"configuration"}]}, 279 {tag:'li', id:this.getId('configurationTab'),children:[{tag:'span', html:"configuration"}]},
283 {tag:'li', id:this.getId('bindingsTab'), children:[{tag:'span', html:"bindings"}]}, 280 {tag:'li', id:this.getId('bindingsTab'), children:[{tag:'span', html:"bindings"}]},
284 {tag:'li', id:this.getId('faviconTab'), children:[{tag:'span', html:"favicon"}]}, 281 {tag:'li', id:this.getId('faviconTab'), children:[{tag:'span', html:"favicon"}]},
285 {tag:'li', id:this.getId('doneTab'), children:[{tag:'span', html:"done"}]} 282 {tag:'li', id:this.getId('doneTab'), children:[{tag:'span', html:"done"}]}
286 ]}, 283 ]},
287 {tag:'ul', cls:'tabPanels', children:[ 284 {tag:'ul', cls:'tabPanels', children:[
288 {tag:'li', id:this.getId('labelTabpanel'), cls:'tabPanel label', children:[ 285 {tag:'li', id:this.getId('labelTabpanel'), cls:'tabPanel label', children:[
289 {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.LABEL.description')}]} 286 {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.LABEL.description')}]}
290 ]}, 287 ]},
291 {tag:'li', id:this.getId('typeTabpanel'), cls:'tabPanel type', children:[ 288 {tag:'li', id:this.getId('typeTabpanel'), cls:'tabPanel type', children:[
292 {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.TYPE.description')}]}, 289 {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.TYPE.description')}]},
293 {tag:'h2', html:"type"} 290 {tag:'h2', html:"type"}
294 ]}, 291 ]},
295 {tag:'li', id:this.getId('configurationTabpanel'), cls:'tabPanel configuration', children:[ 292 {tag:'li', id:this.getId('configurationTabpanel'), cls:'tabPanel configuration', children:[
296 {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.CONFIGURATION.description')}]}, 293 {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.CONFIGURATION.description')}]},
297 {tag:'div', cls:'bookmarkletConfigurationWrapper', children:[ 294 {tag:'div', cls:'bookmarkletConfigurationWrapper', children:[
298 {tag:'textarea', id:this.getId('bookmarkletConfiguration'), value:""}, 295 {tag:'textarea', id:this.getId('bookmarkletConfiguration'), value:""},
299 // {tag:'div', cls:'bookmarkletComponentWrapper', children:[{tag:'div', id:this.getId('bookmarkletComponent'), cls:'bookmarkletComponent'}]} 296 // {tag:'div', cls:'bookmarkletComponentWrapper', children:[{tag:'div', id:this.getId('bookmarkletComponent'), cls:'bookmarkletComponent'}]}
300 {tag:'div', id:this.getId('bookmarkletComponent'), cls:'bookmarkletComponent'} 297 {tag:'div', id:this.getId('bookmarkletComponent'), cls:'bookmarkletComponent'}