summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js23
1 files changed, 10 insertions, 13 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js
index effde31..b1ff81f 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js
@@ -1,70 +1,68 @@
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.Controllers'); 24Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
27 25
28Clipperz.PM.UI.Web.Controllers.CardDialogController = function(args) { 26Clipperz.PM.UI.Web.Controllers.CardDialogController = function(args) {
29 args = args || {}; 27 args = args || {};
30 28
31 Clipperz.PM.UI.Web.Controllers.CardDialogController.superclass.constructor.call(this, args); 29 Clipperz.PM.UI.Web.Controllers.CardDialogController.superclass.constructor.call(this, args);
32 30
33 this._record = args.record || Clipperz.Base.exception.raise('MandatoryParameter'); 31 this._record = args.record || Clipperz.Base.exception.raise('MandatoryParameter');
34 this._delegate = args.delegate || Clipperz.Base.exception.raise('MandatoryParameter'); 32 this._delegate = args.delegate || Clipperz.Base.exception.raise('MandatoryParameter');
35 33
36 this._referenceElement = null; 34 this._referenceElement = null;
37 this._cardDialogComponent = null; 35 this._cardDialogComponent = null;
38 36
39 this._fieldsReferences = {}; 37 this._fieldsReferences = {};
40 this._directLoginReferences = {}; 38 this._directLoginReferences = {};
41 39
42 this._directLoginWizardController = null; 40 this._directLoginWizardController = null;
43 this._directLoginEditingComponent = null; 41 this._directLoginEditingComponent = null;
44 this._isDirectLoginEditingComponentVisible = false; 42 this._isDirectLoginEditingComponentVisible = false;
45 43
46 return this; 44 return this;
47}; 45};
48 46
49Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardDialogController, Object, { 47Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardDialogController, Object, {
50 48
51 'toString': function() { 49 'toString': function() {
52 return "Clipperz.PM.UI.Web.Controllers.CardDialogController"; 50 return "Clipperz.PM.UI.Web.Controllers.CardDialogController";
53 }, 51 },
54 52
55 //------------------------------------------------------------------------- 53 //-------------------------------------------------------------------------
56 54
57 'record': function () { 55 'record': function () {
58 return this._record; 56 return this._record;
59 }, 57 },
60 58
61 'delegate': function () { 59 'delegate': function () {
62 return this._delegate; 60 return this._delegate;
63 }, 61 },
64 62
65 //------------------------------------------------------------------------- 63 //-------------------------------------------------------------------------
66 64
67 'fieldsReferences': function () { 65 'fieldsReferences': function () {
68 return this._fieldsReferences; 66 return this._fieldsReferences;
69 }, 67 },
70 68
@@ -329,97 +327,96 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardDialogController, Object
329 327
330 return deferredResult; 328 return deferredResult;
331 }, 329 },
332 330
333 //------------------------------------------------------------------------- 331 //-------------------------------------------------------------------------
334 332
335 'updateRecordDirectLoginDetails': function (aDirectLogin) { 333 'updateRecordDirectLoginDetails': function (aDirectLogin) {
336 var result; 334 var result;
337 335
338 if (MochiKit.Base.isUndefinedOrNull(aDirectLogin)) { 336 if (MochiKit.Base.isUndefinedOrNull(aDirectLogin)) {
339 result = MochiKit.Async.succeed(); 337 result = MochiKit.Async.succeed();
340 } else { 338 } else {
341 result = Clipperz.Async.callbacks("CardDialogController.updateRecordDirectLoginDetails", [ 339 result = Clipperz.Async.callbacks("CardDialogController.updateRecordDirectLoginDetails", [
342 MochiKit.Base.method(this.directLoginEditingComponent(), 'label'), 340 MochiKit.Base.method(this.directLoginEditingComponent(), 'label'),
343 MochiKit.Base.method(aDirectLogin, 'setLabel'), 341 MochiKit.Base.method(aDirectLogin, 'setLabel'),
344 MochiKit.Base.method(this.directLoginEditingComponent(), 'favicon'), 342 MochiKit.Base.method(this.directLoginEditingComponent(), 'favicon'),
345 MochiKit.Base.method(aDirectLogin, 'setFavicon') 343 MochiKit.Base.method(aDirectLogin, 'setFavicon')
346 ], {trace:false}); 344 ], {trace:false});
347 } 345 }
348 346
349 return result; 347 return result;
350 }, 348 },
351 349
352 //========================================================================= 350 //=========================================================================
353 351
354 'addField': function () { 352 'addField': function () {
355 return this.record().addField({ 353 return this.record().addField({
356 'label':this.cardDialogComponent().newFieldLabel(), 354 'label':this.cardDialogComponent().newFieldLabel(),
357 'value':this.cardDialogComponent().newFieldValue(), 355 'value':this.cardDialogComponent().newFieldValue(),
358 'isHidden':this.cardDialogComponent().newFieldIsHidden() 356 'isHidden':this.cardDialogComponent().newFieldIsHidden()
359 }); 357 });
360 }, 358 },
361 359
362 'handleAddField': function () { 360 'handleAddField': function () {
363 return Clipperz.Async.callbacks("CardDialogController.handleAddField", [ 361 return Clipperz.Async.callbacks("CardDialogController.handleAddField", [
364 MochiKit.Base.method(this, 'addField'), 362 MochiKit.Base.method(this, 'addField'),
365 363
366 MochiKit.Base.method(this, 'addCardDialogComponentWithField'), 364 MochiKit.Base.method(this, 'addCardDialogComponentWithField'),
367 MochiKit.Base.method(this.cardDialogComponent(), 'resetNewFieldInputs'), 365 MochiKit.Base.method(this.cardDialogComponent(), 'resetNewFieldInputs'),
368 366
369 MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'), 367 MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'),
370 MochiKit.Base.method(this, 'handleChangedValue') 368 MochiKit.Base.method(this, 'handleChangedValue')
371 ], {trace:false}) 369 ], {trace:false})
372 }, 370 },
373 371
374 //------------------------------------------------------------------------- 372 //-------------------------------------------------------------------------
375 373
376 'handlePerformFieldAction': function (aFieldID, aTargetElement) { 374 'handlePerformFieldAction': function (aFieldID, aTargetElement) {
377//console.log("### targetElement", aTargetElement);
378 return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [ 375 return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [
379 MochiKit.Base.method(this.record(), 'fields'), 376 MochiKit.Base.method(this.record(), 'fields'),
380 MochiKit.Base.itemgetter(aFieldID), 377 MochiKit.Base.itemgetter(aFieldID),
381 Clipperz.Async.collectResults("CardDialogController.handleDeleteField <collect results>", { 378 Clipperz.Async.collectResults("CardDialogController.handleDeleteField <collect results>", {
382 'value':MochiKit.Base.methodcaller('value'), 379 'value':MochiKit.Base.methodcaller('value'),
383 'type': MochiKit.Base.methodcaller('actionType') 380 'type': MochiKit.Base.methodcaller('actionType')
384 }, {trace:false}), 381 }, {trace:false}),
385 MochiKit.Base.bind(function (someValues) { 382 MochiKit.Base.bind(function (someValues) {
386 switch (someValues['type']) { 383 switch (someValues['type']) {
387 case 'NONE': 384 case 'NONE':
388 throw "this event handler should not be triggered for fields with type 'NONE'"; 385 throw "this event handler should not be triggered for fields with type 'NONE'";
389 break; 386 break;
390 case 'URL': 387 case 'URL':
391 var url; 388 var url;
392 389
393 url = someValues['value']; 390 url = someValues['value'];
394 if (/^https?\:\/\//.test(url) == false) { 391 if (/^https?\:\/\//.test(url) == false) {
395 url = 'http://' + url; 392 url = 'http://' + url;
396 } 393 }
397 394
398 window.open(url); 395 window.open(url);
399 break; 396 break;
400 case 'EMAIL': 397 case 'EMAIL':
401 var url; 398 var url;
402 399
403 url = 'mailto:' + someValues['value']; 400 url = 'mailto:' + someValues['value'];
404 401
405 MochiKit.DOM.currentWindow().location = url; 402 MochiKit.DOM.currentWindow().location = url;
406 break; 403 break;
407 case 'PASSWORD': 404 case 'PASSWORD':
408//Clipperz.log("SHOW PASSWORD " + someValues['value']); 405//Clipperz.log("SHOW PASSWORD " + someValues['value']);
409 this.showPasswordTooltip(someValues['value'], aTargetElement); 406 this.showPasswordTooltip(someValues['value'], aTargetElement);
410 break; 407 break;
411 } 408 }
412 }, this) 409 }, this)
413 ], {trace:false}); 410 ], {trace:false});
414 }, 411 },
415 412
416 //------------------------------------------------------------------------- 413 //-------------------------------------------------------------------------
417 414
418 'handleDeleteField': function (aFieldID) { 415 'handleDeleteField': function (aFieldID) {
419 return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [ 416 return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [
420 MochiKit.Base.method(this.record(), 'fields'), 417 MochiKit.Base.method(this.record(), 'fields'),
421 MochiKit.Base.itemgetter(aFieldID), 418 MochiKit.Base.itemgetter(aFieldID),
422 MochiKit.Base.method(this.record(), 'removeField'), 419 MochiKit.Base.method(this.record(), 'removeField'),
423 420
424 MochiKit.Base.method(this, 'fieldsReferences'), 421 MochiKit.Base.method(this, 'fieldsReferences'),
425 MochiKit.Base.itemgetter(aFieldID), 422 MochiKit.Base.itemgetter(aFieldID),