Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/DataModel') (more/less context) (ignore whitespace changes)
14 files changed, 165 insertions, 262 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js index 8f8696d..507ee31 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js | |||
@@ -1,46 +1,44 @@ | |||
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 | Clipperz.Base.module('Clipperz.PM.DataModel'); | 24 | Clipperz.Base.module('Clipperz.PM.DataModel'); |
27 | 25 | ||
28 | Clipperz.PM.DataModel.DirectLogin = function(args) { | 26 | Clipperz.PM.DataModel.DirectLogin = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.DataModel.DirectLogin.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.DataModel.DirectLogin.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._reference =args.reference | 31 | this._reference =args.reference |
34 | ||Clipperz.PM.Crypto.randomKey(); | 32 | ||Clipperz.PM.Crypto.randomKey(); |
35 | this._record =args.record | 33 | this._record =args.record |
36 | ||Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | ||Clipperz.Base.exception.raise('MandatoryParameter'); |
37 | 35 | ||
38 | this._retrieveIndexDataFunction = args.retrieveIndexDataFunction | 36 | this._retrieveIndexDataFunction = args.retrieveIndexDataFunction |
39 | ||this.record().retrieveDirectLoginIndexDataFunction() | 37 | ||this.record().retrieveDirectLoginIndexDataFunction() |
40 | ||Clipperz.Base.exception.raise('MandatoryParameter'); | 38 | ||Clipperz.Base.exception.raise('MandatoryParameter'); |
41 | this._setIndexDataFunction = args.setIndexDataFunction | 39 | this._setIndexDataFunction = args.setIndexDataFunction |
42 | ||this.record().setDirectLoginIndexDataFunction() | 40 | ||this.record().setDirectLoginIndexDataFunction() |
43 | ||Clipperz.Base.exception.raise('MandatoryParameter'); | 41 | ||Clipperz.Base.exception.raise('MandatoryParameter'); |
44 | this._removeIndexDataFunction =args.removeIndexDataFunction | 42 | this._removeIndexDataFunction =args.removeIndexDataFunction |
45 | ||this.record().removeDirectLoginIndexDataFunction() | 43 | ||this.record().removeDirectLoginIndexDataFunction() |
46 | ||Clipperz.Base.exception.raise('MandatoryParameter'); | 44 | ||Clipperz.Base.exception.raise('MandatoryParameter'); |
@@ -308,49 +306,49 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.DirectLogin, Object, { | |||
308 | 306 | ||
309 | //TODO: shoud remove the 'formValues' call, as it is now deferred | 307 | //TODO: shoud remove the 'formValues' call, as it is now deferred |
310 | // if ((aRadio['checked'] == true) && (this.formValues()[aRadio['name']] == null)) { | 308 | // if ((aRadio['checked'] == true) && (this.formValues()[aRadio['name']] == null)) { |
311 | // this.formValues()[aRadio['name']] = aRadio['value']; | 309 | // this.formValues()[aRadio['name']] = aRadio['value']; |
312 | // } | 310 | // } |
313 | }, this)) | 311 | }, this)) |
314 | 312 | ||
315 | updatedInputs = MochiKit.Base.concat(updatedInputs, MochiKit.Base.values(updatedRadios)); | 313 | updatedInputs = MochiKit.Base.concat(updatedInputs, MochiKit.Base.values(updatedRadios)); |
316 | } | 314 | } |
317 | 315 | ||
318 | delete result.inputs; | 316 | delete result.inputs; |
319 | result.inputs = updatedInputs; | 317 | result.inputs = updatedInputs; |
320 | 318 | ||
321 | return result; | 319 | return result; |
322 | }, | 320 | }, |
323 | 321 | ||
324 | '_fixConfiguration': function (aConfiguration) { | 322 | '_fixConfiguration': function (aConfiguration) { |
325 | var fixedConfiguration; | 323 | var fixedConfiguration; |
326 | // var inputs; | 324 | // var inputs; |
327 | // var bindings; | 325 | // var bindings; |
328 | // var i,c; | 326 | // var i,c; |
329 | 327 | ||
330 | fixedConfiguration = Clipperz.Base.deepClone(aConfiguration); | 328 | fixedConfiguration = Clipperz.Base.deepClone(aConfiguration); |
331 | 329 | ||
332 | //console.log("PROCESS CONFIGURATION", aConfiguration); | 330 | //Clipperz.log("PROCESS CONFIGURATION", aConfiguration); |
333 | switch (aConfiguration['bookmarkletVersion']) { | 331 | switch (aConfiguration['bookmarkletVersion']) { |
334 | case '0.1': | 332 | case '0.1': |
335 | fixedConfiguration['formData'] = this.fixFormDataFromBookmarkletVersion_0_1(aConfiguration['formData']); | 333 | fixedConfiguration['formData'] = this.fixFormDataFromBookmarkletVersion_0_1(aConfiguration['formData']); |
336 | break; | 334 | break; |
337 | case '0.2': | 335 | case '0.2': |
338 | fixedConfiguration['formData'] = aConfiguration['formData']; | 336 | fixedConfiguration['formData'] = aConfiguration['formData']; |
339 | break; | 337 | break; |
340 | } | 338 | } |
341 | 339 | ||
342 | / * | 340 | / * |
343 | aConfiguration['_inputs'] = []; | 341 | aConfiguration['_inputs'] = []; |
344 | c = formData['inputs'].length; | 342 | c = formData['inputs'].length; |
345 | for (i=0; i<c; i++) { | 343 | for (i=0; i<c; i++) { |
346 | aConfiguration['_inputs'].push(new Clipperz.PM.DataModel.DirectLoginInput(formData['inputs'][i])); | 344 | aConfiguration['_inputs'].push(new Clipperz.PM.DataModel.DirectLoginInput(formData['inputs'][i])); |
347 | } | 345 | } |
348 | * / | 346 | * / |
349 | / * | 347 | / * |
350 | aConfiguration['_bindings'] = {}; | 348 | aConfiguration['_bindings'] = {}; |
351 | if (aConfiguration['legacyBindingData'] == null) { | 349 | if (aConfiguration['legacyBindingData'] == null) { |
352 | if (aConfiguration['bindingData'] != null) { | 350 | if (aConfiguration['bindingData'] != null) { |
353 | var bindingKey; | 351 | var bindingKey; |
354 | 352 | ||
355 | for (bindingKey in aConfiguration['bindingData']) { | 353 | for (bindingKey in aConfiguration['bindingData']) { |
356 | var newBinding; | 354 | var newBinding; |
@@ -460,52 +458,51 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.DirectLogin, Object, { | |||
460 | //'favicon' | 458 | //'favicon' |
461 | // 'url' | 459 | // 'url' |
462 | }, | 460 | }, |
463 | 'form': someValues['configuration']['formData'], | 461 | 'form': someValues['configuration']['formData'], |
464 | 'version':someValues['configuration']['bookmarkletVersion'] | 462 | 'version':someValues['configuration']['bookmarkletVersion'] |
465 | } | 463 | } |
466 | 464 | ||
467 | result = Clipperz.Base.formatJSON(configuration); | 465 | result = Clipperz.Base.formatJSON(configuration); |
468 | } else { | 466 | } else { |
469 | result = ''; | 467 | result = ''; |
470 | } | 468 | } |
471 | 469 | ||
472 | return result; | 470 | return result; |
473 | } | 471 | } |
474 | ], {trace:false}); | 472 | ], {trace:false}); |
475 | 473 | ||
476 | }, | 474 | }, |
477 | 475 | ||
478 | //------------------------------------------------------------------------- | 476 | //------------------------------------------------------------------------- |
479 | 477 | ||
480 | 'setBookmarkletConfiguration': function (aValue) { | 478 | 'setBookmarkletConfiguration': function (aValue) { |
481 | var bookmarkletConfiguration; | 479 | var bookmarkletConfiguration; |
482 | 480 | ||
483 | bookmarkletConfiguration = Clipperz.PM.DataModel.DirectLogin.checkBookmarkletConfiguration(aValue); | 481 | bookmarkletConfiguration = Clipperz.PM.DataModel.DirectLogin.checkBookmarkletConfiguration(aValue); |
484 | //console.log("BOOKMARKLET CONFIGURATION", bookmarkletConfiguration); | 482 | |
485 | return Clipperz.Async.callbacks("DirectLogin.setBookmarkletConfiguration", [ | 483 | return Clipperz.Async.callbacks("DirectLogin.setBookmarkletConfiguration", [ |
486 | MochiKit.Base.method(this, 'setValue', 'formData', bookmarkletConfiguration['form']), | 484 | MochiKit.Base.method(this, 'setValue', 'formData', bookmarkletConfiguration['form']), |
487 | //function (aValue) { console.log("SET VALUE - formData", aValue); return aValue; }, | ||
488 | MochiKit.Base.method(this, 'setValue', 'bookmarkletVersion', bookmarkletConfiguration['version']), | 485 | MochiKit.Base.method(this, 'setValue', 'bookmarkletVersion', bookmarkletConfiguration['version']), |
489 | 486 | ||
490 | MochiKit.Base.method(this, 'favicon'), | 487 | MochiKit.Base.method(this, 'favicon'), |
491 | Clipperz.Async.deferredIf("the favicon is not set", [ | 488 | Clipperz.Async.deferredIf("the favicon is not set", [ |
492 | ], [ | 489 | ], [ |
493 | MochiKit.Base.method(this, 'faviconUrlWithBookmarkletConfiguration', bookmarkletConfiguration), | 490 | MochiKit.Base.method(this, 'faviconUrlWithBookmarkletConfiguration', bookmarkletConfiguration), |
494 | MochiKit.Base.method(this, 'setFavicon') | 491 | MochiKit.Base.method(this, 'setFavicon') |
495 | ]), | 492 | ]), |
496 | 493 | ||
497 | MochiKit.Base.method(this, 'updateInputsAfterChangingBookmarkletConfiguration'), | 494 | MochiKit.Base.method(this, 'updateInputsAfterChangingBookmarkletConfiguration'), |
498 | MochiKit.Base.method(this, 'updateFormValuesAfterChangingBookmarkletConfiguration'), | 495 | MochiKit.Base.method(this, 'updateFormValuesAfterChangingBookmarkletConfiguration'), |
499 | MochiKit.Base.method(this, 'updateBindingsAfterChangingBookmarkletConfiguration'), | 496 | MochiKit.Base.method(this, 'updateBindingsAfterChangingBookmarkletConfiguration'), |
500 | 497 | ||
501 | MochiKit.Base.noop | 498 | MochiKit.Base.noop |
502 | ], {trace:false}); | 499 | ], {trace:false}); |
503 | }, | 500 | }, |
504 | 501 | ||
505 | //========================================================================= | 502 | //========================================================================= |
506 | 503 | ||
507 | 'formAttributes': function () { | 504 | 'formAttributes': function () { |
508 | return this.getValue('formData.attributes'); | 505 | return this.getValue('formData.attributes'); |
509 | }, | 506 | }, |
510 | 507 | ||
511 | //========================================================================= | 508 | //========================================================================= |
@@ -515,63 +512,59 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.DirectLogin, Object, { | |||
515 | Clipperz.Async.deferredIf("this._inputs is defined", [ | 512 | Clipperz.Async.deferredIf("this._inputs is defined", [ |
516 | ], [ | 513 | ], [ |
517 | MochiKit.Base.method(this, 'updateInputsAfterChangingBookmarkletConfiguration') | 514 | MochiKit.Base.method(this, 'updateInputsAfterChangingBookmarkletConfiguration') |
518 | ]) | 515 | ]) |
519 | ], {trace:false}, this._inputs); | 516 | ], {trace:false}, this._inputs); |
520 | }, | 517 | }, |
521 | 518 | ||
522 | 'setInputWithFormDataConfiguration': function (aFormDataConfiguration) { | 519 | 'setInputWithFormDataConfiguration': function (aFormDataConfiguration) { |
523 | this._inputs = {}; | 520 | this._inputs = {}; |
524 | 521 | ||
525 | if (aFormDataConfiguration != null) { | 522 | if (aFormDataConfiguration != null) { |
526 | MochiKit.Iter.forEach(aFormDataConfiguration['inputs'], MochiKit.Base.bind(function (anInputData) { | 523 | MochiKit.Iter.forEach(aFormDataConfiguration['inputs'], MochiKit.Base.bind(function (anInputData) { |
527 | var newInput; | 524 | var newInput; |
528 | 525 | ||
529 | newInput = new Clipperz.PM.DataModel.DirectLoginInput(anInputData); | 526 | newInput = new Clipperz.PM.DataModel.DirectLoginInput(anInputData); |
530 | this._inputs[newInput.name()] = newInput; | 527 | this._inputs[newInput.name()] = newInput; |
531 | }, this)); | 528 | }, this)); |
532 | } | 529 | } |
533 | 530 | ||
534 | return this._inputs; | 531 | return this._inputs; |
535 | }, | 532 | }, |
536 | 533 | ||
537 | 'updateInputsAfterChangingBookmarkletConfiguration': function () { | 534 | 'updateInputsAfterChangingBookmarkletConfiguration': function () { |
538 | return Clipperz.Async.callbacks("DirectLogin.updateInputsAfterChangingBookmarkletConfiguration", [ | 535 | return Clipperz.Async.callbacks("DirectLogin.updateInputsAfterChangingBookmarkletConfiguration", [ |
539 | // MochiKit.Base.method(this, 'getValue', ''), | ||
540 | //function (aValue) { console.log("VALUE", aValue); return aValue }, | ||
541 | MochiKit.Base.method(this, 'getValue', 'formData'), | 536 | MochiKit.Base.method(this, 'getValue', 'formData'), |
542 | //function (aValue) { console.log("FORM DATA", aValue); return aValue }, | ||
543 | MochiKit.Base.method(this, 'setInputWithFormDataConfiguration') | 537 | MochiKit.Base.method(this, 'setInputWithFormDataConfiguration') |
544 | ], {trace:false}); | 538 | ], {trace:false}); |
545 | }, | 539 | }, |
546 | 540 | ||
547 | //========================================================================= | 541 | //========================================================================= |
548 | 542 | ||
549 | 'inputValues': function () { | 543 | 'inputValues': function () { |
550 | return Clipperz.Async.callbacks("DirectLogin.inputValues", [ | 544 | return Clipperz.Async.callbacks("DirectLogin.inputValues", [ |
551 | MochiKit.Base.method(this, 'inputs'), | 545 | MochiKit.Base.method(this, 'inputs'), |
552 | MochiKit.Base.values, | 546 | MochiKit.Base.values, |
553 | //function (aValue) { console.log("INPUTS", aValue); return aValue; }, | ||
554 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.partial(MochiKit.Base.method(this, 'inputValue'))), | 547 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.partial(MochiKit.Base.method(this, 'inputValue'))), |
555 | Clipperz.Async.collectAll, | 548 | Clipperz.Async.collectAll, |
556 | Clipperz.Base.mergeItems | 549 | Clipperz.Base.mergeItems |
557 | ], {trace:false}); | 550 | ], {trace:false}); |
558 | }, | 551 | }, |
559 | 552 | ||
560 | 'inputValue': function (anInput) { | 553 | 'inputValue': function (anInput) { |
561 | vardeferredResult; | 554 | vardeferredResult; |
562 | 555 | ||
563 | deferredResult = new Clipperz.Async.Deferred("DirectLogin.inputValue", {trace:false}); | 556 | deferredResult = new Clipperz.Async.Deferred("DirectLogin.inputValue", {trace:false}); |
564 | 557 | ||
565 | if (anInput.needsFormValue()) { | 558 | if (anInput.needsFormValue()) { |
566 | deferredResult.addMethod(this, 'formValues'); | 559 | deferredResult.addMethod(this, 'formValues'); |
567 | deferredResult.addCallback(MochiKit.Base.itemgetter(anInput.name())); | 560 | deferredResult.addCallback(MochiKit.Base.itemgetter(anInput.name())); |
568 | deferredResult.addMethodcaller('value'); | 561 | deferredResult.addMethodcaller('value'); |
569 | } else if (anInput.needsBinding()) { | 562 | } else if (anInput.needsBinding()) { |
570 | deferredResult.addMethod(this, 'bindings'); | 563 | deferredResult.addMethod(this, 'bindings'); |
571 | deferredResult.addCallback(MochiKit.Base.itemgetter(anInput.name())); | 564 | deferredResult.addCallback(MochiKit.Base.itemgetter(anInput.name())); |
572 | deferredResult.addMethodcaller('field'); | 565 | deferredResult.addMethodcaller('field'); |
573 | deferredResult.addMethodcaller('value'); | 566 | deferredResult.addMethodcaller('value'); |
574 | } else { | 567 | } else { |
575 | deferredResult.addCallback(MochiKit.Async.succeed, anInput.value()); | 568 | deferredResult.addCallback(MochiKit.Async.succeed, anInput.value()); |
576 | } | 569 | } |
577 | deferredResult.addCallback(function (anActualValue) { | 570 | deferredResult.addCallback(function (anActualValue) { |
@@ -653,61 +646,58 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.DirectLogin, Object, { | |||
653 | 646 | ||
654 | if (MochiKit.Base.isUndefinedOrNull(someValues['originalValues']) || MochiKit.Base.isUndefinedOrNull(someValues['originalValues']['bindingData'])) { | 647 | if (MochiKit.Base.isUndefinedOrNull(someValues['originalValues']) || MochiKit.Base.isUndefinedOrNull(someValues['originalValues']['bindingData'])) { |
655 | availableBindingValues = {}; | 648 | availableBindingValues = {}; |
656 | } else { | 649 | } else { |
657 | availableBindingValues = Clipperz.Base.deepClone(someValues['originalValues']['bindingData']) | 650 | availableBindingValues = Clipperz.Base.deepClone(someValues['originalValues']['bindingData']) |
658 | } | 651 | } |
659 | 652 | ||
660 | if (someValues['currentValues'] != null) { | 653 | if (someValues['currentValues'] != null) { |
661 | MochiKit.Base.update(availableBindingValues, someValues['currentValues']['bindingData']); | 654 | MochiKit.Base.update(availableBindingValues, someValues['currentValues']['bindingData']); |
662 | } | 655 | } |
663 | 656 | ||
664 | this._bindings = {}; | 657 | this._bindings = {}; |
665 | newBindingValues = {} | 658 | newBindingValues = {} |
666 | MochiKit.Iter.forEach(MochiKit.Base.filter(MochiKit.Base.methodcaller('needsBinding'), MochiKit.Base.values(someValues['inputs'])), MochiKit.Base.bind(function (anInput) { | 659 | MochiKit.Iter.forEach(MochiKit.Base.filter(MochiKit.Base.methodcaller('needsBinding'), MochiKit.Base.values(someValues['inputs'])), MochiKit.Base.bind(function (anInput) { |
667 | varnewBinding; | 660 | varnewBinding; |
668 | 661 | ||
669 | newBindingValues[anInput.name()] = availableBindingValues[anInput.name()]; | 662 | newBindingValues[anInput.name()] = availableBindingValues[anInput.name()]; |
670 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, { | 663 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, { |
671 | 'key': anInput.name(), | 664 | 'key': anInput.name(), |
672 | 'field':availableBindingValues[anInput.name()] | 665 | 'field':availableBindingValues[anInput.name()] |
673 | }); | 666 | }); |
674 | 667 | ||
675 | this._bindings[anInput.name()] = newBinding; | 668 | this._bindings[anInput.name()] = newBinding; |
676 | }, this)) | 669 | }, this)) |
677 | //console.log("THIS._BINDINGS", this._bindings); | ||
678 | 670 | ||
679 | return newBindingValues; | 671 | return newBindingValues; |
680 | 672 | ||
681 | /* | 673 | /* |
682 | this._bindings = {}; | 674 | this._bindings = {}; |
683 | //console.log("CONFIGURATION", aConfiguration); | ||
684 | 675 | ||
685 | if (someValues['currentValues'] != null) { | 676 | if (someValues['currentValues'] != null) { |
686 | if (someValues['currentValues']['bindingData'] != null) { | 677 | if (someValues['currentValues']['bindingData'] != null) { |
687 | var bindingKey; | 678 | var bindingKey; |
688 | 679 | ||
689 | //console.log("BINDING DATA", someValues['currentValues']['bindingData']); | ||
690 | for (bindingKey in someValues['currentValues']['bindingData']) { | 680 | for (bindingKey in someValues['currentValues']['bindingData']) { |
691 | var newBinding; | 681 | var newBinding; |
692 | 682 | ||
693 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, { | 683 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, { |
694 | 'key': bindingKey, | 684 | 'key': bindingKey, |
695 | 'field':someValues['currentValues']['bindingData'][bindingKey] | 685 | 'field':someValues['currentValues']['bindingData'][bindingKey] |
696 | }); | 686 | }); |
697 | this._bindings[newBinding.key()] = newBinding; | 687 | this._bindings[newBinding.key()] = newBinding; |
698 | } | 688 | } |
699 | } else if (someValues['currentValues']['legacyBindingData'] == null) { | 689 | } else if (someValues['currentValues']['legacyBindingData'] == null) { |
700 | var bindingKey; | 690 | var bindingKey; |
701 | 691 | ||
702 | for (bindingKey in someValues['currentValues']['legacyBindingData']) { | 692 | for (bindingKey in someValues['currentValues']['legacyBindingData']) { |
703 | var newBinding; | 693 | var newBinding; |
704 | 694 | ||
705 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, { | 695 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, { |
706 | 'key': bindingKey, | 696 | 'key': bindingKey, |
707 | 'field':someValues['currentValues']['legacyBindingData'][bindingKey] | 697 | 'field':someValues['currentValues']['legacyBindingData'][bindingKey] |
708 | }); | 698 | }); |
709 | this._bindings[newBinding.key()] = newBinding; | 699 | this._bindings[newBinding.key()] = newBinding; |
710 | } | 700 | } |
711 | } else { | 701 | } else { |
712 | WTF = TODO; | 702 | WTF = TODO; |
713 | } | 703 | } |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js index 4377853..a8ebb97 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js | |||
@@ -1,46 +1,44 @@ | |||
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.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | 28 | ||
31 | //############################################################################# | 29 | //############################################################################# |
32 | 30 | ||
33 | Clipperz.PM.DataModel.DirectLoginBinding = function(aDirectLogin, args) { | 31 | Clipperz.PM.DataModel.DirectLoginBinding = function(aDirectLogin, args) { |
34 | args = args || {}; | 32 | args = args || {}; |
35 | 33 | ||
36 | this._directLogin = aDirectLogin|| Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | this._directLogin = aDirectLogin|| Clipperz.Base.exception.raise('MandatoryParameter'); |
37 | 35 | ||
38 | this._key = args.key|| Clipperz.Base.exception.raise('MandatoryParameter'); | 36 | this._key = args.key|| Clipperz.Base.exception.raise('MandatoryParameter'); |
39 | this._fieldKey = args.field || /* this.directLogin().fieldWithName(args.fieldName).reference() || */null; | 37 | this._fieldKey = args.field || /* this.directLogin().fieldWithName(args.fieldName).reference() || */null; |
40 | 38 | ||
41 | return this; | 39 | return this; |
42 | } | 40 | } |
43 | 41 | ||
44 | Clipperz.PM.DataModel.DirectLoginBinding.prototype = MochiKit.Base.update(null, { | 42 | Clipperz.PM.DataModel.DirectLoginBinding.prototype = MochiKit.Base.update(null, { |
45 | 43 | ||
46 | 'toString': function() { | 44 | 'toString': function() { |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js index a461197..2429f88 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js | |||
@@ -1,46 +1,44 @@ | |||
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.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | 28 | ||
31 | //############################################################################# | 29 | //############################################################################# |
32 | 30 | ||
33 | Clipperz.PM.DataModel.DirectLoginFormValue = function(aDirectLogin, args) { | 31 | Clipperz.PM.DataModel.DirectLoginFormValue = function(aDirectLogin, args) { |
34 | args = args || {}; | 32 | args = args || {}; |
35 | 33 | ||
36 | this._directLogin = aDirectLogin|| Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | this._directLogin = aDirectLogin|| Clipperz.Base.exception.raise('MandatoryParameter'); |
37 | 35 | ||
38 | this._key = args.key || Clipperz.Base.exception.raise('MandatoryParameter'); | 36 | this._key = args.key || Clipperz.Base.exception.raise('MandatoryParameter'); |
39 | this._fieldOptions = args.fieldOptions|| Clipperz.Base.exception.raise('MandatoryParameter'); | 37 | this._fieldOptions = args.fieldOptions|| Clipperz.Base.exception.raise('MandatoryParameter'); |
40 | this._value = args.value || null; | 38 | this._value = args.value || null; |
41 | 39 | ||
42 | return this; | 40 | return this; |
43 | } | 41 | } |
44 | 42 | ||
45 | Clipperz.PM.DataModel.DirectLoginFormValue.prototype = MochiKit.Base.update(null, { | 43 | Clipperz.PM.DataModel.DirectLoginFormValue.prototype = MochiKit.Base.update(null, { |
46 | 44 | ||
@@ -66,39 +64,38 @@ Clipperz.PM.DataModel.DirectLoginFormValue.prototype = MochiKit.Base.update(null | |||
66 | return this._fieldOptions; | 64 | return this._fieldOptions; |
67 | }, | 65 | }, |
68 | 66 | ||
69 | //------------------------------------------------------------------------- | 67 | //------------------------------------------------------------------------- |
70 | 68 | ||
71 | 'type': function () { | 69 | 'type': function () { |
72 | return this.fieldOptions()['type']; | 70 | return this.fieldOptions()['type']; |
73 | }, | 71 | }, |
74 | 72 | ||
75 | //------------------------------------------------------------------------- | 73 | //------------------------------------------------------------------------- |
76 | 74 | ||
77 | 'value': function() { | 75 | 'value': function() { |
78 | varresult; | 76 | varresult; |
79 | 77 | ||
80 | result = this._value; | 78 | result = this._value; |
81 | 79 | ||
82 | // if ((result == null) && (this.type() == 'checkbox')) { | 80 | // if ((result == null) && (this.type() == 'checkbox')) { |
83 | // result = false; | 81 | // result = false; |
84 | // }; | 82 | // }; |
85 | 83 | ||
86 | return result; | 84 | return result; |
87 | }, | 85 | }, |
88 | 86 | ||
89 | 'setValue': function (aValue) { | 87 | 'setValue': function (aValue) { |
90 | //console.log("DirectLoginFormValue.setValue", aValue); | ||
91 | this._value = aValue; | 88 | this._value = aValue; |
92 | return this.directLogin().setValue('formValues' + '.' + this.key(), aValue); | 89 | return this.directLogin().setValue('formValues' + '.' + this.key(), aValue); |
93 | }, | 90 | }, |
94 | 91 | ||
95 | //------------------------------------------------------------------------- | 92 | //------------------------------------------------------------------------- |
96 | /* | 93 | /* |
97 | 'serializedData': function() { | 94 | 'serializedData': function() { |
98 | return this.value(); | 95 | return this.value(); |
99 | }, | 96 | }, |
100 | */ | 97 | */ |
101 | //------------------------------------------------------------------------- | 98 | //------------------------------------------------------------------------- |
102 | __syntaxFix__: "syntax fix" | 99 | __syntaxFix__: "syntax fix" |
103 | }); | 100 | }); |
104 | 101 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js index 8188389..d9995fc 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js | |||
@@ -1,46 +1,44 @@ | |||
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.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | //############################################################################# | 28 | //############################################################################# |
31 | 29 | ||
32 | Clipperz.PM.DataModel.DirectLoginInput = function(args) { | 30 | Clipperz.PM.DataModel.DirectLoginInput = function(args) { |
33 | this._args = args; | 31 | this._args = args; |
34 | 32 | ||
35 | return this; | 33 | return this; |
36 | } | 34 | } |
37 | 35 | ||
38 | Clipperz.PM.DataModel.DirectLoginInput.prototype = MochiKit.Base.update(null, { | 36 | Clipperz.PM.DataModel.DirectLoginInput.prototype = MochiKit.Base.update(null, { |
39 | 37 | ||
40 | 'args': function() { | 38 | 'args': function() { |
41 | return this._args; | 39 | return this._args; |
42 | }, | 40 | }, |
43 | 41 | ||
44 | //------------------------------------------------------------------------- | 42 | //------------------------------------------------------------------------- |
45 | 43 | ||
46 | 'name': function() { | 44 | 'name': function() { |
@@ -55,49 +53,49 @@ Clipperz.PM.DataModel.DirectLoginInput.prototype = MochiKit.Base.update(null, { | |||
55 | result = this.args()['type']; | 53 | result = this.args()['type']; |
56 | 54 | ||
57 | if (result != null) { | 55 | if (result != null) { |
58 | result = result.toLowerCase(); | 56 | result = result.toLowerCase(); |
59 | } | 57 | } |
60 | return result; | 58 | return result; |
61 | }, | 59 | }, |
62 | 60 | ||
63 | //------------------------------------------------------------------------- | 61 | //------------------------------------------------------------------------- |
64 | 62 | ||
65 | 'options': function() { | 63 | 'options': function() { |
66 | return this.args()['options']; | 64 | return this.args()['options']; |
67 | }, | 65 | }, |
68 | 66 | ||
69 | //------------------------------------------------------------------------- | 67 | //------------------------------------------------------------------------- |
70 | 68 | ||
71 | 'value': function() { | 69 | 'value': function() { |
72 | return this.args()['value']; | 70 | return this.args()['value']; |
73 | }, | 71 | }, |
74 | 72 | ||
75 | //------------------------------------------------------------------------- | 73 | //------------------------------------------------------------------------- |
76 | /* | 74 | /* |
77 | 'formConfiguration': function(someFormValues, someBindings, someFields) { | 75 | 'formConfiguration': function(someFormValues, someBindings, someFields) { |
78 | var result; | 76 | var result; |
79 | //console.log("### DirectLoginInput.formConfiguration", someFields); | 77 | |
80 | if (this.shouldSetValue()) { | 78 | if (this.shouldSetValue()) { |
81 | switch (this.type()) { | 79 | switch (this.type()) { |
82 | case 'select': | 80 | case 'select': |
83 | var currentValue; | 81 | var currentValue; |
84 | var options; | 82 | var options; |
85 | 83 | ||
86 | // currentValue = this.directLogin()._configuration['formValues'][this.name()]; | 84 | // currentValue = this.directLogin()._configuration['formValues'][this.name()]; |
87 | currentValue = someFormValues[this.name()]; | 85 | currentValue = someFormValues[this.name()]; |
88 | options = this.args()['options']; | 86 | options = this.args()['options']; |
89 | 87 | ||
90 | result = MochiKit.DOM.SELECT({name:this.name()}, | 88 | result = MochiKit.DOM.SELECT({name:this.name()}, |
91 | MochiKit.Base.map(function(anOption) { | 89 | MochiKit.Base.map(function(anOption) { |
92 | var options; | 90 | var options; |
93 | 91 | ||
94 | options = {value:anOption['value']}; | 92 | options = {value:anOption['value']}; |
95 | if (currentValue == anOption['value']) { | 93 | if (currentValue == anOption['value']) { |
96 | options.selected = true; | 94 | options.selected = true; |
97 | } | 95 | } |
98 | 96 | ||
99 | return MochiKit.DOM.OPTION(options, anOption['label']) | 97 | return MochiKit.DOM.OPTION(options, anOption['label']) |
100 | }, options) | 98 | }, options) |
101 | ) | 99 | ) |
102 | break; | 100 | break; |
103 | case 'checkbox': | 101 | case 'checkbox': |
@@ -133,54 +131,48 @@ Clipperz.PM.DataModel.DirectLoginInput.prototype = MochiKit.Base.update(null, { | |||
133 | if (isChecked) { | 131 | if (isChecked) { |
134 | options.checked = true; | 132 | options.checked = true; |
135 | } | 133 | } |
136 | 134 | ||
137 | if (Clipperz_IEisBroken == true) { | 135 | if (Clipperz_IEisBroken == true) { |
138 | var checkedValue; | 136 | var checkedValue; |
139 | 137 | ||
140 | checkedValue = (isChecked ? " CHECKED" : ""); | 138 | checkedValue = (isChecked ? " CHECKED" : ""); |
141 | inputNode = MochiKit.DOM.currentDocument().createElement("<INPUT TYPE='RADIO' NAME='" + currentName + "' VALUE='" + anOption['value'] + "'" + checkedValue + ">"); | 139 | inputNode = MochiKit.DOM.currentDocument().createElement("<INPUT TYPE='RADIO' NAME='" + currentName + "' VALUE='" + anOption['value'] + "'" + checkedValue + ">"); |
142 | } else { | 140 | } else { |
143 | inputNode = MochiKit.DOM.INPUT(options, anOption['value']); | 141 | inputNode = MochiKit.DOM.INPUT(options, anOption['value']); |
144 | } | 142 | } |
145 | divNode = MochiKit.DOM.DIV(null, inputNode); | 143 | divNode = MochiKit.DOM.DIV(null, inputNode); |
146 | 144 | ||
147 | return divNode; | 145 | return divNode; |
148 | }, options) | 146 | }, options) |
149 | ); | 147 | ); |
150 | break; | 148 | break; |
151 | } | 149 | } |
152 | } else { | 150 | } else { |
153 | var binding; | 151 | var binding; |
154 | // binding = this.directLogin().bindings()[this.name()]; | 152 | // binding = this.directLogin().bindings()[this.name()]; |
155 | binding = someBindings[this.name()]; | 153 | binding = someBindings[this.name()]; |
156 | 154 | ||
157 | //console.log("### binding", binding); | ||
158 | //if (binding != null) { | ||
159 | ///console.log(" binding.field()", binding.field()); | ||
160 | ///console.log(" binding.field().value()", binding.field().value()); | ||
161 | //console.log(" someFields[binding.fieldKey()].value()", someFields[binding.fieldKey()].value()); | ||
162 | //} | ||
163 | result = MochiKit.DOM.INPUT({ | 155 | result = MochiKit.DOM.INPUT({ |
164 | type:((this.type() != 'password') ? this.type() : 'text'), | 156 | type:((this.type() != 'password') ? this.type() : 'text'), |
165 | name:this.name(), | 157 | name:this.name(), |
166 | // value:((binding != null)? binding.field().value() : this.value()) | 158 | // value:((binding != null)? binding.field().value() : this.value()) |
167 | value:((binding != null)? someFields[binding.fieldKey()]['value'] : this.value()) | 159 | value:((binding != null)? someFields[binding.fieldKey()]['value'] : this.value()) |
168 | // value:((binding != null)? someFields[binding.fieldKey()].value() : this.value()) | 160 | // value:((binding != null)? someFields[binding.fieldKey()].value() : this.value()) |
169 | }, null); | 161 | }, null); |
170 | } | 162 | } |
171 | 163 | ||
172 | return result; | 164 | return result; |
173 | }, | 165 | }, |
174 | */ | 166 | */ |
175 | //------------------------------------------------------------------------- | 167 | //------------------------------------------------------------------------- |
176 | 168 | ||
177 | 'needsFormValue': function() { | 169 | 'needsFormValue': function() { |
178 | var type; | 170 | var type; |
179 | var result; | 171 | var result; |
180 | 172 | ||
181 | type = this.type(); | 173 | type = this.type(); |
182 | result = ((type == 'checkbox') || (type == 'radio') || (type == 'select')); | 174 | result = ((type == 'checkbox') || (type == 'radio') || (type == 'select')); |
183 | 175 | ||
184 | return result; | 176 | return result; |
185 | }, | 177 | }, |
186 | 178 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js b/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js index cdeec8b..1aa7a52 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js | |||
@@ -1,46 +1,44 @@ | |||
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 | try { if (typeof(Clipperz.KeyValueObjectStore) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.KeyValueObjectStore) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.EncryptedRemoteObject depends on Clipperz.KeyValueObjectStore!"; | 25 | throw "Clipperz.PM.DataModel.EncryptedRemoteObject depends on Clipperz.KeyValueObjectStore!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 28 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
31 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 29 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
32 | 30 | ||
33 | Clipperz.PM.DataModel.EncryptedRemoteObject = function(args) { | 31 | Clipperz.PM.DataModel.EncryptedRemoteObject = function(args) { |
34 | args = args || {}; | 32 | args = args || {}; |
35 | 33 | ||
36 | this._name = args.name || null; | 34 | this._name = args.name || null; |
37 | this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); | 35 | this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); |
38 | this._isBrandNew = ((args.reference == null) && (args.remoteData == null)); | 36 | this._isBrandNew = ((args.reference == null) && (args.remoteData == null)); |
39 | 37 | ||
40 | if ((this._isBrandNew == false) && (args['retrieveKeyFunction'] == null)) { | 38 | if ((this._isBrandNew == false) && (args['retrieveKeyFunction'] == null)) { |
41 | Clipperz.Base.exception.raise('MandatoryParameter'); | 39 | Clipperz.Base.exception.raise('MandatoryParameter'); |
42 | } else { | 40 | } else { |
43 | this._retrieveKeyFunction = args['retrieveKeyFunction']; | 41 | this._retrieveKeyFunction = args['retrieveKeyFunction']; |
44 | } | 42 | } |
45 | 43 | ||
46 | this._retrieveRemoteDataFunction = args.retrieveRemoteDataFunction|| null; | 44 | this._retrieveRemoteDataFunction = args.retrieveRemoteDataFunction|| null; |
@@ -390,52 +388,48 @@ Clipperz.PM.DataModel.EncryptedRemoteObject.prototype = MochiKit.Base.update(nul | |||
390 | 388 | ||
391 | //------------------------------------------------------------------------- | 389 | //------------------------------------------------------------------------- |
392 | 390 | ||
393 | 'hasPendingChanges': function () { | 391 | 'hasPendingChanges': function () { |
394 | var deferredResult; | 392 | var deferredResult; |
395 | var tempObj = this; | 393 | var tempObj = this; |
396 | 394 | ||
397 | if (this.isBrandNew()) { | 395 | if (this.isBrandNew()) { |
398 | // deferredResult = MochiKit.Async.succeed(true); | 396 | // deferredResult = MochiKit.Async.succeed(true); |
399 | deferredResult = this.hasPendingChangesWhenBrandNew(); | 397 | deferredResult = this.hasPendingChangesWhenBrandNew(); |
400 | } else if (this.hasInitiatedObjectDataStore()) { | 398 | } else if (this.hasInitiatedObjectDataStore()) { |
401 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.hasPendingChanges", {trace:false}); | 399 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.hasPendingChanges", {trace:false}); |
402 | deferredResult.collectResults({ | 400 | deferredResult.collectResults({ |
403 | 'decryptedData': [ | 401 | 'decryptedData': [ |
404 | MochiKit.Base.method(this, 'getDecryptedData'), | 402 | MochiKit.Base.method(this, 'getDecryptedData'), |
405 | Clipperz.Base.serializeJSON | 403 | Clipperz.Base.serializeJSON |
406 | ], | 404 | ], |
407 | 'objectData': [ | 405 | 'objectData': [ |
408 | MochiKit.Base.method(this, '_getObjectDataStore'), | 406 | MochiKit.Base.method(this, '_getObjectDataStore'), |
409 | MochiKit.Base.methodcaller('values'), | 407 | MochiKit.Base.methodcaller('values'), |
410 | Clipperz.Base.serializeJSON | 408 | Clipperz.Base.serializeJSON |
411 | ] | 409 | ] |
412 | }); | 410 | }); |
413 | deferredResult.addCallback(function (someValues) { | 411 | deferredResult.addCallback(function (someValues) { |
414 | //if (someValues['decryptedData'] != someValues['objectData']) { | ||
415 | //console.log("ORIGINAL DATA", '[[[' + someValues['decryptedData'] + ']]]'); | ||
416 | //console.log("CURRENT DATA", '>>>' + someValues['objectData'] + '<<<'); | ||
417 | //} | ||
418 | return (someValues['decryptedData'] != someValues['objectData']); | 412 | return (someValues['decryptedData'] != someValues['objectData']); |
419 | }); | 413 | }); |
420 | deferredResult.callback(); | 414 | deferredResult.callback(); |
421 | } else { | 415 | } else { |
422 | deferredResult = MochiKit.Async.succeed(false); | 416 | deferredResult = MochiKit.Async.succeed(false); |
423 | } | 417 | } |
424 | 418 | ||
425 | return deferredResult; | 419 | return deferredResult; |
426 | }, | 420 | }, |
427 | 421 | ||
428 | 'hasPendingChangesWhenBrandNew': function () { | 422 | 'hasPendingChangesWhenBrandNew': function () { |
429 | return MochiKit.Async.succeed(true); | 423 | return MochiKit.Async.succeed(true); |
430 | }, | 424 | }, |
431 | 425 | ||
432 | //------------------------------------------------------------------------- | 426 | //------------------------------------------------------------------------- |
433 | 427 | ||
434 | 'commitTransientState': function () { | 428 | 'commitTransientState': function () { |
435 | var deferredResult; | 429 | var deferredResult; |
436 | 430 | ||
437 | // if (this.transientState().getValue('__prepareRemoteData') == true) { | 431 | // if (this.transientState().getValue('__prepareRemoteData') == true) { |
438 | if (this.transientState().getValue('packedRemoteData') != null) { | 432 | if (this.transientState().getValue('packedRemoteData') != null) { |
439 | deferredResult = Clipperz.Async.callbacks("EncryptedRemoteObject.commitTransientState - prepareRemoteData", [ | 433 | deferredResult = Clipperz.Async.callbacks("EncryptedRemoteObject.commitTransientState - prepareRemoteData", [ |
440 | MochiKit.Base.bind(function (someData) { | 434 | MochiKit.Base.bind(function (someData) { |
441 | this._remoteData = this.transientState().getValue('packedRemoteData'); | 435 | this._remoteData = this.transientState().getValue('packedRemoteData'); |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js b/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js index 834e21b..fbca1ff 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js | |||
@@ -1,46 +1,44 @@ | |||
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.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | 28 | ||
31 | //############################################################################# | 29 | //############################################################################# |
32 | 30 | ||
33 | Clipperz.PM.DataModel.OneTimePassword = function(args) { | 31 | Clipperz.PM.DataModel.OneTimePassword = function(args) { |
34 | args = args || {}; | 32 | args = args || {}; |
35 | 33 | ||
36 | //this._user = args['user']; | 34 | //this._user = args['user']; |
37 | this._reference = args['reference']|| Clipperz.PM.Crypto.randomKey(); | 35 | this._reference = args['reference']|| Clipperz.PM.Crypto.randomKey(); |
38 | this._password = args['password']; | 36 | this._password = args['password']; |
39 | this._passwordValue = Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword(args['password']); | 37 | this._passwordValue = Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword(args['password']); |
40 | this._creationDate = args['created'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['created']) : new Date(); | 38 | this._creationDate = args['created'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['created']) : new Date(); |
41 | this._usageDate = args['used'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['used']) : null; | 39 | this._usageDate = args['used'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['used']) : null; |
42 | 40 | ||
43 | this._status = args['status'] || 'ACTIVE'; //'REQUESTED', 'USED', 'DISABLED' | 41 | this._status = args['status'] || 'ACTIVE'; //'REQUESTED', 'USED', 'DISABLED' |
44 | this._connectionInfo= null; | 42 | this._connectionInfo= null; |
45 | 43 | ||
46 | this._key = null; | 44 | this._key = null; |
@@ -122,145 +120,145 @@ Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, { | |||
122 | 120 | ||
123 | result = { | 121 | result = { |
124 | 'password': this.password(), | 122 | 'password': this.password(), |
125 | 'created': this.creationDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.creationDate()) : null, | 123 | 'created': this.creationDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.creationDate()) : null, |
126 | 'used': this.usageDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.usageDate()) : null, | 124 | 'used': this.usageDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.usageDate()) : null, |
127 | 'status': this.status() | 125 | 'status': this.status() |
128 | }; | 126 | }; |
129 | 127 | ||
130 | return result; | 128 | return result; |
131 | }, | 129 | }, |
132 | 130 | ||
133 | //------------------------------------------------------------------------- | 131 | //------------------------------------------------------------------------- |
134 | 132 | ||
135 | 'packedPassphrase': function() { | 133 | 'packedPassphrase': function() { |
136 | var result; | 134 | var result; |
137 | var packedPassphrase; | 135 | var packedPassphrase; |
138 | var encodedPassphrase; | 136 | var encodedPassphrase; |
139 | varprefixPadding; | 137 | varprefixPadding; |
140 | var suffixPadding; | 138 | var suffixPadding; |
141 | var getRandomBytes; | 139 | var getRandomBytes; |
142 | 140 | ||
143 | getRandomBytes = MochiKit.Base.method(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'getRandomBytes'); | 141 | getRandomBytes = MochiKit.Base.method(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'getRandomBytes'); |
144 | 142 | ||
145 | encodedPassphrase = new Clipperz.ByteArray(this.user().passphrase()).toBase64String(); | 143 | encodedPassphrase = new Clipperz.ByteArray(this.user().passphrase()).toBase64String(); |
146 | //MochiKit.Logging.logDebug("--- encodedPassphrase.length: " + encodedPassphrase.length); | 144 | //Clipperz.logDebug("--- encodedPassphrase.length: " + encodedPassphrase.length); |
147 | prefixPadding = getRandomBytes(getRandomBytes(1).byteAtIndex(0)).toBase64String(); | 145 | prefixPadding = getRandomBytes(getRandomBytes(1).byteAtIndex(0)).toBase64String(); |
148 | //MochiKit.Logging.logDebug("--- prefixPadding.length: " + prefixPadding.length); | 146 | //Clipperz.logDebug("--- prefixPadding.length: " + prefixPadding.length); |
149 | suffixPadding = getRandomBytes((500 - prefixPadding.length - encodedPassphrase.length) * 6 / 8).toBase64String(); | 147 | suffixPadding = getRandomBytes((500 - prefixPadding.length - encodedPassphrase.length) * 6 / 8).toBase64String(); |
150 | //MochiKit.Logging.logDebug("--- suffixPadding.length: " + suffixPadding.length); | 148 | //Clipperz.logDebug("--- suffixPadding.length: " + suffixPadding.length); |
151 | //MochiKit.Logging.logDebug("--- total.length: " + (prefixPadding.length + encodedPassphrase.length + suffixPadding.length)); | 149 | //Clipperz.logDebug("--- total.length: " + (prefixPadding.length + encodedPassphrase.length + suffixPadding.length)); |
152 | 150 | ||
153 | packedPassphrase = { | 151 | packedPassphrase = { |
154 | 'prefix': prefixPadding, | 152 | 'prefix': prefixPadding, |
155 | 'passphrase': encodedPassphrase, | 153 | 'passphrase': encodedPassphrase, |
156 | 'suffix': suffixPadding | 154 | 'suffix': suffixPadding |
157 | }; | 155 | }; |
158 | 156 | ||
159 | // result = Clipperz.Base.serializeJSON(packedPassphrase); | 157 | // result = Clipperz.Base.serializeJSON(packedPassphrase); |
160 | result = packedPassphrase; | 158 | result = packedPassphrase; |
161 | //MochiKit.Logging.logDebug("===== OTP packedPassprase: [" + result.length + "]" + result); | 159 | //Clipperz.logDebug("===== OTP packedPassprase: [" + result.length + "]" + result); |
162 | //MochiKit.Logging.logDebug("<<< OneTimePassword.packedPassphrase"); | 160 | //Clipperz.logDebug("<<< OneTimePassword.packedPassphrase"); |
163 | 161 | ||
164 | return result; | 162 | return result; |
165 | }, | 163 | }, |
166 | 164 | ||
167 | //------------------------------------------------------------------------- | 165 | //------------------------------------------------------------------------- |
168 | 166 | ||
169 | 'encryptedPackedPassphrase': function() { | 167 | 'encryptedPackedPassphrase': function() { |
170 | return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(this.passwordValue(), this.packedPassphrase()) | 168 | return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(this.passwordValue(), this.packedPassphrase()) |
171 | }, | 169 | }, |
172 | 170 | ||
173 | //------------------------------------------------------------------------- | 171 | //------------------------------------------------------------------------- |
174 | 172 | ||
175 | 'encryptedData': function() { | 173 | 'encryptedData': function() { |
176 | var deferredResult; | 174 | var deferredResult; |
177 | varresult; | 175 | varresult; |
178 | 176 | ||
179 | //MochiKit.Logging.logDebug(">>> OneTimePassword.encryptedData"); | 177 | //Clipperz.logDebug(">>> OneTimePassword.encryptedData"); |
180 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - id: " + this.reference()); | 178 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - id: " + this.reference()); |
181 | result = { | 179 | result = { |
182 | 'reference': this.reference(), | 180 | 'reference': this.reference(), |
183 | 'key': this.key(), | 181 | 'key': this.key(), |
184 | 'keyChecksum': this.keyChecksum(), | 182 | 'keyChecksum': this.keyChecksum(), |
185 | 'data': "", | 183 | 'data': "", |
186 | 'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion | 184 | 'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion |
187 | } | 185 | } |
188 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 2: " + Clipperz.Base.serializeJSON(result)); | 186 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - 2: " + Clipperz.Base.serializeJSON(result)); |
189 | deferredResult = new MochiKit.Async.Deferred(); | 187 | deferredResult = new MochiKit.Async.Deferred(); |
190 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 3"); | 188 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - 3"); |
191 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 1: " + res); return res;}); | 189 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.encryptedData - 1: " + res); return res;}); |
192 | //# deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion, this.passwordValue(), this.packedPassphrase()); | 190 | //# deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion, this.passwordValue(), this.packedPassphrase()); |
193 | deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedPackedPassphrase')); | 191 | deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedPackedPassphrase')); |
194 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 4"); | 192 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - 4"); |
195 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 2: [" + res.length + "]" + res); return res;}); | 193 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.encryptedData - 2: [" + res.length + "]" + res); return res;}); |
196 | deferredResult.addCallback(function(aResult, res) { | 194 | deferredResult.addCallback(function(aResult, res) { |
197 | aResult['data'] = res; | 195 | aResult['data'] = res; |
198 | return aResult; | 196 | return aResult; |
199 | }, result); | 197 | }, result); |
200 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 5"); | 198 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - 5"); |
201 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 3: " + Clipperz.Base.serializeJSON(res)); return res;}); | 199 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.encryptedData - 3: " + Clipperz.Base.serializeJSON(res)); return res;}); |
202 | deferredResult.callback(); | 200 | deferredResult.callback(); |
203 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 6"); | 201 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - 6"); |
204 | 202 | ||
205 | return deferredResult; | 203 | return deferredResult; |
206 | }, | 204 | }, |
207 | 205 | ||
208 | //------------------------------------------------------------------------- | 206 | //------------------------------------------------------------------------- |
209 | 207 | ||
210 | 'saveChanges': function() { | 208 | 'saveChanges': function() { |
211 | var deferredResult; | 209 | var deferredResult; |
212 | varresult; | 210 | varresult; |
213 | 211 | ||
214 | //MochiKit.Logging.logDebug(">>> OneTimePassword.saveChanges"); | 212 | //Clipperz.logDebug(">>> OneTimePassword.saveChanges"); |
215 | result = {}; | 213 | result = {}; |
216 | deferredResult = new MochiKit.Async.Deferred(); | 214 | deferredResult = new MochiKit.Async.Deferred(); |
217 | 215 | ||
218 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptUserData'); | 216 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptUserData'); |
219 | deferredResult.addCallback(MochiKit.Base.method(this.user(), 'encryptedData')); | 217 | deferredResult.addCallback(MochiKit.Base.method(this.user(), 'encryptedData')); |
220 | deferredResult.addCallback(function(aResult, res) { | 218 | deferredResult.addCallback(function(aResult, res) { |
221 | aResult['user'] = res; | 219 | aResult['user'] = res; |
222 | return aResult; | 220 | return aResult; |
223 | }, result); | 221 | }, result); |
224 | 222 | ||
225 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptOTPData'); | 223 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptOTPData'); |
226 | deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedData')); | 224 | deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedData')); |
227 | deferredResult.addCallback(function(aResult, res) { | 225 | deferredResult.addCallback(function(aResult, res) { |
228 | aResult['oneTimePassword'] = res; | 226 | aResult['oneTimePassword'] = res; |
229 | return aResult; | 227 | return aResult; |
230 | }, result); | 228 | }, result); |
231 | 229 | ||
232 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_sendingData'); | 230 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_sendingData'); |
233 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 1: " + Clipperz.Base.serializeJSON(res)); return res;}); | 231 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.saveChanges - 1: " + Clipperz.Base.serializeJSON(res)); return res;}); |
234 | deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'addNewOneTimePassword'); | 232 | deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'addNewOneTimePassword'); |
235 | 233 | ||
236 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_updatingInterface'); | 234 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_updatingInterface'); |
237 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;}); | 235 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;}); |
238 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'notify', 'OTPUpdated'); | 236 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'notify', 'OTPUpdated'); |
239 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'oneTimePassword_saveChanges_done', null); | 237 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'oneTimePassword_saveChanges_done', null); |
240 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;}); | 238 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;}); |
241 | deferredResult.callback(); | 239 | deferredResult.callback(); |
242 | //MochiKit.Logging.logDebug("<<< OneTimePassword.saveChanges"); | 240 | //Clipperz.logDebug("<<< OneTimePassword.saveChanges"); |
243 | 241 | ||
244 | return deferredResult; | 242 | return deferredResult; |
245 | }, | 243 | }, |
246 | 244 | ||
247 | //------------------------------------------------------------------------- | 245 | //------------------------------------------------------------------------- |
248 | 246 | ||
249 | 'usageDate': function() { | 247 | 'usageDate': function() { |
250 | return this._usageDate; | 248 | return this._usageDate; |
251 | }, | 249 | }, |
252 | 250 | ||
253 | 'setUsageDate': function(aValue) { | 251 | 'setUsageDate': function(aValue) { |
254 | this._usageDate = aValue; | 252 | this._usageDate = aValue; |
255 | }, | 253 | }, |
256 | 254 | ||
257 | //------------------------------------------------------------------------- | 255 | //------------------------------------------------------------------------- |
258 | 256 | ||
259 | 'connectionInfo': function() { | 257 | 'connectionInfo': function() { |
260 | return this._connectionInfo; | 258 | return this._connectionInfo; |
261 | }, | 259 | }, |
262 | 260 | ||
263 | 'setConnectionInfo': function(aValue) { | 261 | 'setConnectionInfo': function(aValue) { |
264 | this._connectionInfo = aValue; | 262 | this._connectionInfo = aValue; |
265 | }, | 263 | }, |
266 | 264 | ||
@@ -287,68 +285,66 @@ Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, { | |||
287 | 285 | ||
288 | return result; | 286 | return result; |
289 | }, | 287 | }, |
290 | */ | 288 | */ |
291 | //------------------------------------------------------------------------- | 289 | //------------------------------------------------------------------------- |
292 | __syntaxFix__: "syntax fix" | 290 | __syntaxFix__: "syntax fix" |
293 | }); | 291 | }); |
294 | 292 | ||
295 | //############################################################################# | 293 | //############################################################################# |
296 | 294 | ||
297 | Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword = function(anUsername, aPassword) { | 295 | Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword = function(anUsername, aPassword) { |
298 | return Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aPassword)).toHexString().substring(2); | 296 | return Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aPassword)).toHexString().substring(2); |
299 | } | 297 | } |
300 | 298 | ||
301 | Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword = function(anUsername, aPassword) { | 299 | Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword = function(anUsername, aPassword) { |
302 | return Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(anUsername + aPassword)).toHexString().substring(2); | 300 | return Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(anUsername + aPassword)).toHexString().substring(2); |
303 | } | 301 | } |
304 | 302 | ||
305 | //============================================================================= | 303 | //============================================================================= |
306 | 304 | ||
307 | Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue = function(aPassword) { | 305 | Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue = function(aPassword) { |
308 | var result; | 306 | var result; |
309 | 307 | ||
310 | //"yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg" | 308 | //"yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg" |
311 | //console.log("Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue", aPassword); | ||
312 | if (aPassword.replace(/[\s\-]/g, '').length == 32) { | 309 | if (aPassword.replace(/[\s\-]/g, '').length == 32) { |
313 | try { | 310 | try { |
314 | var passwordByteArray; | 311 | var passwordByteArray; |
315 | 312 | ||
316 | passwordByteArray = new Clipperz.ByteArray(); | 313 | passwordByteArray = new Clipperz.ByteArray(); |
317 | passwordByteArray.appendBase32String(aPassword); | 314 | passwordByteArray.appendBase32String(aPassword); |
318 | 315 | ||
319 | result = true; | 316 | result = true; |
320 | } catch(exception) { | 317 | } catch(exception) { |
321 | result = false; | 318 | result = false; |
322 | } | 319 | } |
323 | } else { | 320 | } else { |
324 | result = false; | 321 | result = false; |
325 | } | 322 | } |
326 | 323 | ||
327 | return result; | 324 | return result; |
328 | } | 325 | } |
329 | 326 | ||
330 | //============================================================================= | 327 | //============================================================================= |
331 | 328 | ||
332 | Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword = function(aPassword) { | 329 | Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword = function(aPassword) { |
333 | varresult; | 330 | varresult; |
334 | 331 | ||
335 | if (aPassword.replace(/[\s\-]/g, '').length == 32) { | 332 | if (aPassword.replace(/[\s\-]/g, '').length == 32) { |
336 | try { | 333 | try { |
337 | var passwordByteArray; | 334 | var passwordByteArray; |
338 | 335 | ||
339 | passwordByteArray = new Clipperz.ByteArray(); | 336 | passwordByteArray = new Clipperz.ByteArray(); |
340 | passwordByteArray.appendBase32String(aPassword); | 337 | passwordByteArray.appendBase32String(aPassword); |
341 | 338 | ||
342 | result = passwordByteArray.toBase64String(); | 339 | result = passwordByteArray.toBase64String(); |
343 | } catch(exception) { | 340 | } catch(exception) { |
344 | result = aPassword; | 341 | result = aPassword; |
345 | } | 342 | } |
346 | } else { | 343 | } else { |
347 | result = aPassword; | 344 | result = aPassword; |
348 | } | 345 | } |
349 | 346 | ||
350 | //console.log("Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword", aPassword, result); | ||
351 | return result; | 347 | return result; |
352 | } | 348 | } |
353 | 349 | ||
354 | //############################################################################# | 350 | //############################################################################# |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js index f51bbc2..986db40 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js | |||
@@ -1,46 +1,44 @@ | |||
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 | try { if (typeof(Clipperz.PM.DataModel.Record.Version) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.Record.Version) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.Record.Version.Field depends on Clipperz.PM.DataModel.Record.Version!"; | 25 | throw "Clipperz.PM.DataModel.Record.Version.Field depends on Clipperz.PM.DataModel.Record.Version!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | Clipperz.PM.DataModel.Record.Version.Field = function(args) { | 28 | Clipperz.PM.DataModel.Record.Version.Field = function(args) { |
31 | Clipperz.PM.DataModel.Record.Version.Field.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.DataModel.Record.Version.Field.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._recordVersion = args.recordVersion|| Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._recordVersion = args.recordVersion|| Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); | 32 | this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); |
35 | 33 | ||
36 | return this; | 34 | return this; |
37 | } | 35 | } |
38 | 36 | ||
39 | 37 | ||
40 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version.Field, Object, { | 38 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version.Field, Object, { |
41 | 39 | ||
42 | 'toString': function() { | 40 | 'toString': function() { |
43 | return "Record.Version.Field (" + this.reference() + ")"; | 41 | return "Record.Version.Field (" + this.reference() + ")"; |
44 | }, | 42 | }, |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js index dd35fc9..87b319c 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js | |||
@@ -1,55 +1,52 @@ | |||
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 | try { if (typeof(Clipperz.PM.DataModel.Record) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.Record) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.Record.Version depends on Clipperz.PM.DataModel.Record!"; | 25 | throw "Clipperz.PM.DataModel.Record.Version depends on Clipperz.PM.DataModel.Record!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | Clipperz.PM.DataModel.Record.Version = function(args) { | 28 | Clipperz.PM.DataModel.Record.Version = function(args) { |
31 | //console.log(">>> Record.new"); | ||
32 | Clipperz.PM.DataModel.Record.Version.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.DataModel.Record.Version.superclass.constructor.apply(this, arguments); |
33 | 30 | ||
34 | this._getVersionFunction = args.getVersion|| Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._getVersionFunction = args.getVersion|| Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | this._fields = null; | 32 | this._fields = null; |
36 | 33 | ||
37 | return this; | 34 | return this; |
38 | } | 35 | } |
39 | 36 | ||
40 | 37 | ||
41 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version, Clipperz.PM.DataModel.EncryptedRemoteObject, { | 38 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version, Clipperz.PM.DataModel.EncryptedRemoteObject, { |
42 | 39 | ||
43 | 'toString': function() { | 40 | 'toString': function() { |
44 | return "Record.Version (" + this.reference() + ")"; | 41 | return "Record.Version (" + this.reference() + ")"; |
45 | }, | 42 | }, |
46 | 43 | ||
47 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
48 | 45 | ||
49 | 'reference': function () { | 46 | 'reference': function () { |
50 | return this._reference; | 47 | return this._reference; |
51 | }, | 48 | }, |
52 | 49 | ||
53 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
54 | /* | 51 | /* |
55 | 'hasPendingChanges': function () { | 52 | 'hasPendingChanges': function () { |
@@ -78,49 +75,48 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version, Clipperz.PM.DataModel | |||
78 | }); | 75 | }); |
79 | deferredResult.addCallback(MochiKit.Base.operator.lognot) | 76 | deferredResult.addCallback(MochiKit.Base.operator.lognot) |
80 | deferredResult.callback(); | 77 | deferredResult.callback(); |
81 | 78 | ||
82 | return deferredResult; | 79 | return deferredResult; |
83 | }, | 80 | }, |
84 | 81 | ||
85 | //========================================================================= | 82 | //========================================================================= |
86 | 83 | ||
87 | 'commitTransientState': function () { | 84 | 'commitTransientState': function () { |
88 | var deferredResult; | 85 | var deferredResult; |
89 | 86 | ||
90 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.commitTransientState", {trace:false}); | 87 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.commitTransientState", {trace:false}); |
91 | deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.Version.superclass.commitTransientState, this)); | 88 | deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.Version.superclass.commitTransientState, this)); |
92 | deferredResult.callback(); | 89 | deferredResult.callback(); |
93 | 90 | ||
94 | return deferredResult; | 91 | return deferredResult; |
95 | }, | 92 | }, |
96 | 93 | ||
97 | //========================================================================= | 94 | //========================================================================= |
98 | 95 | ||
99 | 'unpackData': function (someData) { //++ | 96 | 'unpackData': function (someData) { //++ |
100 | varresult; | 97 | varresult; |
101 | 98 | ||
102 | //console.log("Record.Version - UNPACK DATA", this, someData); | ||
103 | result = someData; | 99 | result = someData; |
104 | if ((someData['fields'] != null) && (someData['fields'] instanceof Array)) { | 100 | if ((someData['fields'] != null) && (someData['fields'] instanceof Array)) { |
105 | varfields; | 101 | varfields; |
106 | var i,c; | 102 | var i,c; |
107 | 103 | ||
108 | fields = someData['fields']; | 104 | fields = someData['fields']; |
109 | delete someData['fields']; | 105 | delete someData['fields']; |
110 | 106 | ||
111 | someData['fields'] = {}; | 107 | someData['fields'] = {}; |
112 | c = fields.length; | 108 | c = fields.length; |
113 | for (i=0; i<c; i++) { | 109 | for (i=0; i<c; i++) { |
114 | someData['fields'][i] = fields[i]; | 110 | someData['fields'][i] = fields[i]; |
115 | } | 111 | } |
116 | } | 112 | } |
117 | 113 | ||
118 | 114 | ||
119 | 115 | ||
120 | return result; | 116 | return result; |
121 | }, | 117 | }, |
122 | 118 | ||
123 | //========================================================================= | 119 | //========================================================================= |
124 | 120 | ||
125 | 'fields': function () { | 121 | 'fields': function () { |
126 | vardeferredResult; | 122 | vardeferredResult; |
@@ -271,49 +267,48 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version, Clipperz.PM.DataModel | |||
271 | 267 | ||
272 | 'setPreviousVersionReferenceAndKey': function (aVersionObjectAndKey) { | 268 | 'setPreviousVersionReferenceAndKey': function (aVersionObjectAndKey) { |
273 | // this._previousVersion = anotherVersion; | 269 | // this._previousVersion = anotherVersion; |
274 | return Clipperz.Async.callbacks("Record.Version.setPreviousVersion", [ | 270 | return Clipperz.Async.callbacks("Record.Version.setPreviousVersion", [ |
275 | MochiKit.Base.method(this, 'setValue', 'previousVersionReference',aVersionObjectAndKey['reference']), | 271 | MochiKit.Base.method(this, 'setValue', 'previousVersionReference',aVersionObjectAndKey['reference']), |
276 | MochiKit.Base.method(this, 'setValue', 'previousVersionKey', aVersionObjectAndKey['key']) | 272 | MochiKit.Base.method(this, 'setValue', 'previousVersionKey', aVersionObjectAndKey['key']) |
277 | ], {trace:false}); | 273 | ], {trace:false}); |
278 | }, | 274 | }, |
279 | 275 | ||
280 | //========================================================================= | 276 | //========================================================================= |
281 | 277 | ||
282 | 'revertChanges': function () { | 278 | 'revertChanges': function () { |
283 | this.setReference(this.transientState()['originalReference']); | 279 | this.setReference(this.transientState()['originalReference']); |
284 | Clipperz.PM.DataModel.Record.Version.superclass.revertChanges.apply(this, arguments); | 280 | Clipperz.PM.DataModel.Record.Version.superclass.revertChanges.apply(this, arguments); |
285 | }, | 281 | }, |
286 | 282 | ||
287 | //------------------------------------------------------------------------- | 283 | //------------------------------------------------------------------------- |
288 | 284 | ||
289 | 'prepareRemoteDataWithKey': function (aKey) { | 285 | 'prepareRemoteDataWithKey': function (aKey) { |
290 | var deferredResult; | 286 | var deferredResult; |
291 | var result; | 287 | var result; |
292 | 288 | ||
293 | result = {}; | 289 | result = {}; |
294 | 290 | ||
295 | //console.log("prepareRemoteDataWithKey", aKey); | ||
296 | deferredResult = new Clipperz.Async.Deferred("Record.Version.prepareRemoteDataWithKey", {trace:false}); | 291 | deferredResult = new Clipperz.Async.Deferred("Record.Version.prepareRemoteDataWithKey", {trace:false}); |
297 | if (this.isBrandNew() == false) { | 292 | if (this.isBrandNew() == false) { |
298 | this.transientState()['originalReference'] = this.reference(); | 293 | this.transientState()['originalReference'] = this.reference(); |
299 | 294 | ||
300 | deferredResult.collectResults({ | 295 | deferredResult.collectResults({ |
301 | 'key':MochiKit.Base.partial(MochiKit.Async.succeed, aKey), | 296 | 'key':MochiKit.Base.partial(MochiKit.Async.succeed, aKey), |
302 | 'value': MochiKit.Base.method(this, 'getKey'), | 297 | 'value': MochiKit.Base.method(this, 'getKey'), |
303 | 'version': MochiKit.Base.partial(MochiKit.Async.succeed, Clipperz.PM.Crypto.encryptingFunctions.currentVersion) | 298 | 'version': MochiKit.Base.partial(MochiKit.Async.succeed, Clipperz.PM.Crypto.encryptingFunctions.currentVersion) |
304 | }); | 299 | }); |
305 | deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncrypt); | 300 | deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncrypt); |
306 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'previousVersionKey'); | 301 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'previousVersionKey'); |
307 | } else { | 302 | } else { |
308 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'previousVersionKey', Clipperz.PM.Crypto.nullValue); | 303 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'previousVersionKey', Clipperz.PM.Crypto.nullValue); |
309 | } | 304 | } |
310 | deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.prepareRemoteDataWithKey, this, aKey)); | 305 | deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.prepareRemoteDataWithKey, this, aKey)); |
311 | deferredResult.addCallback(MochiKit.Base.update, result); | 306 | deferredResult.addCallback(MochiKit.Base.update, result); |
312 | deferredResult.addMethod(this, 'setRemoteData'); | 307 | deferredResult.addMethod(this, 'setRemoteData'); |
313 | 308 | ||
314 | deferredResult.callback(); | 309 | deferredResult.callback(); |
315 | 310 | ||
316 | return deferredResult; | 311 | return deferredResult; |
317 | }, | 312 | }, |
318 | 313 | ||
319 | //========================================================================= | 314 | //========================================================================= |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/Record.js b/frontend/gamma/js/Clipperz/PM/DataModel/Record.js index b816f80..3fc1813 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/Record.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/Record.js | |||
@@ -1,90 +1,85 @@ | |||
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.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | 28 | ||
31 | Clipperz.PM.DataModel.Record = function(args) { | 29 | Clipperz.PM.DataModel.Record = function(args) { |
32 | //console.log(">>> new Clipperz.PM.DataModel.Record", args); | ||
33 | Clipperz.PM.DataModel.Record.superclass.constructor.apply(this, arguments); | 30 | Clipperz.PM.DataModel.Record.superclass.constructor.apply(this, arguments); |
34 | 31 | ||
35 | this._updateDate = (args.updateDate ? Clipperz.PM.Date.parse(args.updateDate) : Clipperz.Base.exception.raise('MandatoryParameter')); | 32 | this._updateDate = (args.updateDate ? Clipperz.PM.Date.parse(args.updateDate) : Clipperz.Base.exception.raise('MandatoryParameter')); |
36 | 33 | ||
37 | this._retrieveIndexDataFunction = args.retrieveIndexDataFunction|| Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | this._retrieveIndexDataFunction = args.retrieveIndexDataFunction|| Clipperz.Base.exception.raise('MandatoryParameter'); |
38 | this._updateIndexDataFunction = args.updateIndexDataFunction || Clipperz.Base.exception.raise('MandatoryParameter'); | 35 | this._updateIndexDataFunction = args.updateIndexDataFunction || Clipperz.Base.exception.raise('MandatoryParameter'); |
39 | 36 | ||
40 | this._retrieveDirectLoginIndexDataFunction = args.retrieveDirectLoginIndexDataFunction|| null; | 37 | this._retrieveDirectLoginIndexDataFunction = args.retrieveDirectLoginIndexDataFunction|| null; |
41 | this._setDirectLoginIndexDataFunction = args.setDirectLoginIndexDataFunction || null; | 38 | this._setDirectLoginIndexDataFunction = args.setDirectLoginIndexDataFunction || null; |
42 | this._removeDirectLoginIndexDataFunction = args.removeDirectLoginIndexDataFunction|| null; | 39 | this._removeDirectLoginIndexDataFunction = args.removeDirectLoginIndexDataFunction|| null; |
43 | 40 | ||
44 | this._createNewDirectLoginFunction = args.createNewDirectLoginFunction || null; | 41 | this._createNewDirectLoginFunction = args.createNewDirectLoginFunction || null; |
45 | 42 | ||
46 | this._directLogins = {}; | 43 | this._directLogins = {}; |
47 | 44 | ||
48 | this._versions = {}; | 45 | this._versions = {}; |
49 | 46 | ||
50 | this._currentRecordVersion = null; | 47 | this._currentRecordVersion = null; |
51 | if (this.isBrandNew()) { | 48 | if (this.isBrandNew()) { |
52 | var newVersion; | 49 | var newVersion; |
53 | 50 | ||
54 | this.setNotes(''); | 51 | this.setNotes(''); |
55 | newVersion = new Clipperz.PM.DataModel.Record.Version({ | 52 | newVersion = new Clipperz.PM.DataModel.Record.Version({ |
56 | 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'), | 53 | 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'), |
57 | 'getVersion': MochiKit.Base.method(this, 'getVersion') | 54 | 'getVersion': MochiKit.Base.method(this, 'getVersion') |
58 | 55 | ||
59 | }); | 56 | }); |
60 | this._versions[newVersion.reference()] = newVersion; | 57 | this._versions[newVersion.reference()] = newVersion; |
61 | this._currentVersionReference = newVersion.reference(); | 58 | this._currentVersionReference = newVersion.reference(); |
62 | // this.setLabel(''); | 59 | // this.setLabel(''); |
63 | } | 60 | } |
64 | 61 | ||
65 | //console.log("<<< new Clipperz.PM.DataModel.Record", args); | ||
66 | |||
67 | return this; | 62 | return this; |
68 | } | 63 | } |
69 | 64 | ||
70 | 65 | ||
71 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.EncryptedRemoteObject, { | 66 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.EncryptedRemoteObject, { |
72 | 67 | ||
73 | 'toString': function() { | 68 | 'toString': function() { |
74 | return "Record (" + this.reference() + ")"; | 69 | return "Record (" + this.reference() + ")"; |
75 | }, | 70 | }, |
76 | 71 | ||
77 | //------------------------------------------------------------------------- | 72 | //------------------------------------------------------------------------- |
78 | 73 | ||
79 | 'reference': function () { | 74 | 'reference': function () { |
80 | return this._reference; | 75 | return this._reference; |
81 | }, | 76 | }, |
82 | 77 | ||
83 | //========================================================================= | 78 | //========================================================================= |
84 | 79 | ||
85 | 'getIndexData': function () { | 80 | 'getIndexData': function () { |
86 | return this._retrieveIndexDataFunction(this.reference()); | 81 | return this._retrieveIndexDataFunction(this.reference()); |
87 | }, | 82 | }, |
88 | 83 | ||
89 | //......................................................................... | 84 | //......................................................................... |
90 | 85 | ||
@@ -189,109 +184,106 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt | |||
189 | }, | 184 | }, |
190 | 185 | ||
191 | //========================================================================= | 186 | //========================================================================= |
192 | 187 | ||
193 | 'favicon': function () { | 188 | 'favicon': function () { |
194 | var result; | 189 | var result; |
195 | var directLogins; | 190 | var directLogins; |
196 | 191 | ||
197 | directLogins = MochiKit.Base.values(this.directLogins()); | 192 | directLogins = MochiKit.Base.values(this.directLogins()); |
198 | if (directLogins.length > 0) { | 193 | if (directLogins.length > 0) { |
199 | result = directLogins[0].favicon(); | 194 | result = directLogins[0].favicon(); |
200 | // } else if (/* is there an URL to use for searching a favicon */){ | 195 | // } else if (/* is there an URL to use for searching a favicon */){ |
201 | } else { | 196 | } else { |
202 | result = null; //MochiKit.Async.succeed(Clipperz.PM.Strings['defaultFaviconUrl']); | 197 | result = null; //MochiKit.Async.succeed(Clipperz.PM.Strings['defaultFaviconUrl']); |
203 | } | 198 | } |
204 | 199 | ||
205 | return result; | 200 | return result; |
206 | }, | 201 | }, |
207 | 202 | ||
208 | //------------------------------------------------------------------------- | 203 | //------------------------------------------------------------------------- |
209 | 204 | ||
210 | 'searchableContent': function () { | 205 | 'searchableContent': function () { |
211 | var deferredResult; | 206 | var deferredResult; |
212 | 207 | ||
213 | //console.log(">>> searchableContent"); | ||
214 | deferredResult = new Clipperz.Async.Deferred("Record.searchableContent", {trace:false}); | 208 | deferredResult = new Clipperz.Async.Deferred("Record.searchableContent", {trace:false}); |
215 | 209 | ||
216 | deferredResult.collectResults({ | 210 | deferredResult.collectResults({ |
217 | 'recordLabel': MochiKit.Base.method(this, 'label'), | 211 | 'recordLabel': MochiKit.Base.method(this, 'label'), |
218 | 'directLoginLabels': [ | 212 | 'directLoginLabels': [ |
219 | MochiKit.Base.method(this, 'directLoginReferences'), | 213 | MochiKit.Base.method(this, 'directLoginReferences'), |
220 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.itemgetter('label')) | 214 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.itemgetter('label')) |
221 | ] | 215 | ] |
222 | }) | 216 | }) |
223 | deferredResult.addCallback(function (someValues) { | 217 | deferredResult.addCallback(function (someValues) { |
224 | return someValues['recordLabel'] + ' ' + someValues['directLoginLabels'].join(' '); | 218 | return someValues['recordLabel'] + ' ' + someValues['directLoginLabels'].join(' '); |
225 | }); | 219 | }); |
226 | deferredResult.callback(); | 220 | deferredResult.callback(); |
227 | //console.log("<<< searchableContent"); | ||
228 | 221 | ||
229 | return deferredResult; | 222 | return deferredResult; |
230 | }, | 223 | }, |
231 | 224 | ||
232 | //------------------------------------------------------------------------- | 225 | //------------------------------------------------------------------------- |
233 | 226 | ||
234 | 'isMatching': function (aRegExp) { | 227 | 'isMatching': function (aRegExp) { |
235 | return Clipperz.Async.callbacks("deferredFilterFunction", [ | 228 | return Clipperz.Async.callbacks("deferredFilterFunction", [ |
236 | MochiKit.Base.method(this, 'searchableContent'), | 229 | MochiKit.Base.method(this, 'searchableContent'), |
237 | MochiKit.Base.method(aRegExp, 'test'), | 230 | MochiKit.Base.method(aRegExp, 'test'), |
238 | function (doesItMatch) { | 231 | function (doesItMatch) { |
239 | var result; | 232 | var result; |
240 | 233 | ||
241 | if (doesItMatch) { | 234 | if (doesItMatch) { |
242 | result = MochiKit.Async.succeed('match'); | 235 | result = MochiKit.Async.succeed('match'); |
243 | } else { | 236 | } else { |
244 | result = MochiKit.Async.fail('miss'); | 237 | result = MochiKit.Async.fail('miss'); |
245 | } | 238 | } |
246 | 239 | ||
247 | return result; | 240 | return result; |
248 | } | 241 | } |
249 | ], {trace:false}); | 242 | ], {trace:false}); |
250 | }, | 243 | }, |
251 | 244 | ||
252 | //========================================================================= | 245 | //========================================================================= |
253 | 246 | ||
254 | 'directLogins': function () { | 247 | 'directLogins': function () { |
255 | return this._directLogins; | 248 | return this._directLogins; |
256 | }, | 249 | }, |
257 | 250 | ||
258 | 'addDirectLogin': function (aDirectLogin) { | 251 | 'addDirectLogin': function (aDirectLogin) { |
259 | this._directLogins[aDirectLogin.reference()] = aDirectLogin; | 252 | this._directLogins[aDirectLogin.reference()] = aDirectLogin; |
260 | }, | 253 | }, |
261 | 254 | ||
262 | 'directLoginWithReference': function (aDirectLoginReference) { | 255 | 'directLoginWithReference': function (aDirectLoginReference) { |
263 | return this._directLogins[aDirectLoginReference]; | 256 | return this._directLogins[aDirectLoginReference]; |
264 | }, | 257 | }, |
265 | 258 | ||
266 | 'createNewDirectLoginFunction': function () { | 259 | 'createNewDirectLoginFunction': function () { |
267 | return this._createNewDirectLoginFunction; | 260 | return this._createNewDirectLoginFunction; |
268 | }, | 261 | }, |
269 | 262 | ||
270 | 'saveOriginalDirectLoginStatusToTransientState': function () { | 263 | 'saveOriginalDirectLoginStatusToTransientState': function () { |
271 | if (this.transientState().getValue('directLogins') == null) { | 264 | if (this.transientState().getValue('directLogins') == null) { |
272 | // this.transientState().setValue('directLogins', this._directLogins) | 265 | // this.transientState().setValue('directLogins', this._directLogins) |
273 | //console.log("SET TRANSIENT STATE", Clipperz.Base.serializeJSON(MochiKit.Base.keys(this.transientState().getValue('directLogins')))) | ||
274 | MochiKit.Iter.forEach(MochiKit.Base.keys(this._directLogins), MochiKit.Base.bind(function(aKey) { | 266 | MochiKit.Iter.forEach(MochiKit.Base.keys(this._directLogins), MochiKit.Base.bind(function(aKey) { |
275 | this.transientState().setValue('directLogins' + '.' + aKey, this._directLogins[aKey]) | 267 | this.transientState().setValue('directLogins' + '.' + aKey, this._directLogins[aKey]) |
276 | }, this)) | 268 | }, this)) |
277 | } | 269 | } |
278 | }, | 270 | }, |
279 | 271 | ||
280 | 'createNewDirectLogin': function () { | 272 | 'createNewDirectLogin': function () { |
281 | this.saveOriginalDirectLoginStatusToTransientState(); | 273 | this.saveOriginalDirectLoginStatusToTransientState(); |
282 | 274 | ||
283 | return this.createNewDirectLoginFunction()(this); | 275 | return this.createNewDirectLoginFunction()(this); |
284 | }, | 276 | }, |
285 | 277 | ||
286 | 'removeDirectLogin': function(aDirectLogin) { | 278 | 'removeDirectLogin': function(aDirectLogin) { |
287 | this.saveOriginalDirectLoginStatusToTransientState(); | 279 | this.saveOriginalDirectLoginStatusToTransientState(); |
288 | 280 | ||
289 | return Clipperz.Async.callbacks("Record.removeDirectLogin", [ | 281 | return Clipperz.Async.callbacks("Record.removeDirectLogin", [ |
290 | MochiKit.Base.method(this, 'removeValue', 'directLogins' + '.' + aDirectLogin.reference()), | 282 | MochiKit.Base.method(this, 'removeValue', 'directLogins' + '.' + aDirectLogin.reference()), |
291 | MochiKit.Base.bind(function () { | 283 | MochiKit.Base.bind(function () { |
292 | delete this._directLogins[aDirectLogin.reference()] | 284 | delete this._directLogins[aDirectLogin.reference()] |
293 | }, this) | 285 | }, this) |
294 | ], {trace:false}); | 286 | ], {trace:false}); |
295 | 287 | ||
296 | }, | 288 | }, |
297 | 289 | ||
@@ -308,71 +300,68 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt | |||
308 | result = []; | 300 | result = []; |
309 | c = someDirectLogins.length; | 301 | c = someDirectLogins.length; |
310 | for (i=0; i<c; i++) { | 302 | for (i=0; i<c; i++) { |
311 | result.push(Clipperz.Async.collectResults("Record.directLoginReferences - collectResults", { | 303 | result.push(Clipperz.Async.collectResults("Record.directLoginReferences - collectResults", { |
312 | '_rowObject': MochiKit.Async.succeed, | 304 | '_rowObject': MochiKit.Async.succeed, |
313 | '_reference': MochiKit.Base.methodcaller('reference'), | 305 | '_reference': MochiKit.Base.methodcaller('reference'), |
314 | 'label': MochiKit.Base.methodcaller('label'), | 306 | 'label': MochiKit.Base.methodcaller('label'), |
315 | 'favicon': MochiKit.Base.methodcaller('favicon') | 307 | 'favicon': MochiKit.Base.methodcaller('favicon') |
316 | }, {trace:false})(someDirectLogins[i])); | 308 | }, {trace:false})(someDirectLogins[i])); |
317 | }; | 309 | }; |
318 | 310 | ||
319 | return result; | 311 | return result; |
320 | }, | 312 | }, |
321 | Clipperz.Async.collectAll | 313 | Clipperz.Async.collectAll |
322 | ], {trace:false}); | 314 | ], {trace:false}); |
323 | 315 | ||
324 | return result; | 316 | return result; |
325 | }, | 317 | }, |
326 | 318 | ||
327 | //========================================================================= | 319 | //========================================================================= |
328 | 320 | ||
329 | 'unpackRemoteData': function (someData) { | 321 | 'unpackRemoteData': function (someData) { |
330 | var result; | 322 | var result; |
331 | 323 | ||
332 | //console.log("new Clipperz.PM.DataModel.Record.Version [2]"); | ||
333 | /* | 324 | /* |
334 | this._currentRecordVersion = new Clipperz.PM.DataModel.Record.Version({ | 325 | this._currentRecordVersion = new Clipperz.PM.DataModel.Record.Version({ |
335 | 'reference': someData['currentVersion']['reference'], | 326 | 'reference': someData['currentVersion']['reference'], |
336 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getCurrentRecordVersionKey'), | 327 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getCurrentRecordVersionKey'), |
337 | 'remoteData': someData['currentVersion'], | 328 | 'remoteData': someData['currentVersion'], |
338 | }); | 329 | }); |
339 | */ | 330 | */ |
340 | var versionKey; | 331 | var versionKey; |
341 | 332 | ||
342 | for (versionKey in someData['versions']) { | 333 | for (versionKey in someData['versions']) { |
343 | //console.log("### versionKey", versionKey); | ||
344 | this._versions[versionKey] = new Clipperz.PM.DataModel.Record.Version({ | 334 | this._versions[versionKey] = new Clipperz.PM.DataModel.Record.Version({ |
345 | 'reference': versionKey, | 335 | 'reference': versionKey, |
346 | 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'), | 336 | 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'), |
347 | 'remoteData': someData['versions'][versionKey], | 337 | 'remoteData': someData['versions'][versionKey], |
348 | 'getVersion': MochiKit.Base.method(this, 'getVersion') | 338 | 'getVersion': MochiKit.Base.method(this, 'getVersion') |
349 | }) | 339 | }) |
350 | } | 340 | } |
351 | 341 | ||
352 | // this._currentVersionReference = someData['currentVersion']['reference']; | 342 | // this._currentVersionReference = someData['currentVersion']['reference']; |
353 | this._currentVersionReference = someData['currentVersion']; | 343 | this._currentVersionReference = someData['currentVersion']; |
354 | //console.log("=== currentVersionReference", this._currentVersionReference, someData); | ||
355 | 344 | ||
356 | result = Clipperz.PM.DataModel.Record.superclass.unpackRemoteData.apply(this, arguments); | 345 | result = Clipperz.PM.DataModel.Record.superclass.unpackRemoteData.apply(this, arguments); |
357 | 346 | ||
358 | return result; | 347 | return result; |
359 | }, | 348 | }, |
360 | 349 | ||
361 | //------------------------------------------------------------------------- | 350 | //------------------------------------------------------------------------- |
362 | 351 | ||
363 | 'unpackData': function (someData) { | 352 | 'unpackData': function (someData) { |
364 | var result; | 353 | var result; |
365 | 354 | ||
366 | result = Clipperz.PM.DataModel.Record.superclass.unpackData.apply(this, arguments); | 355 | result = Clipperz.PM.DataModel.Record.superclass.unpackData.apply(this, arguments); |
367 | 356 | ||
368 | if (MochiKit.Base.isUndefinedOrNull(result['notes'])) { | 357 | if (MochiKit.Base.isUndefinedOrNull(result['notes'])) { |
369 | result['notes'] = '' | 358 | result['notes'] = '' |
370 | } | 359 | } |
371 | 360 | ||
372 | return result; | 361 | return result; |
373 | }, | 362 | }, |
374 | 363 | ||
375 | //------------------------------------------------------------------------- | 364 | //------------------------------------------------------------------------- |
376 | 365 | ||
377 | 'prepareRemoteDataWithKey': function (aKey) { | 366 | 'prepareRemoteDataWithKey': function (aKey) { |
378 | var deferredResult; | 367 | var deferredResult; |
@@ -515,171 +504,160 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt | |||
515 | 504 | ||
516 | 'getCurrentRecordVersion': function () { | 505 | 'getCurrentRecordVersion': function () { |
517 | return Clipperz.Async.callbacks("Record.getCurrentRecordVersion", [ | 506 | return Clipperz.Async.callbacks("Record.getCurrentRecordVersion", [ |
518 | // MochiKit.Base.method(this, 'getValue', 'fakeKey, just to trigger unpackRemoteData'), | 507 | // MochiKit.Base.method(this, 'getValue', 'fakeKey, just to trigger unpackRemoteData'), |
519 | // MochiKit.Base.bind(function () { return this._currentRecordVersion; }, this) | 508 | // MochiKit.Base.bind(function () { return this._currentRecordVersion; }, this) |
520 | 509 | ||
521 | MochiKit.Base.method(this, 'versions'), | 510 | MochiKit.Base.method(this, 'versions'), |
522 | MochiKit.Base.itemgetter(this.currentVersionReference()), | 511 | MochiKit.Base.itemgetter(this.currentVersionReference()), |
523 | Clipperz.Async.deferredIf("The current version is available", [ | 512 | Clipperz.Async.deferredIf("The current version is available", [ |
524 | MochiKit.Async.succeed | 513 | MochiKit.Async.succeed |
525 | ], [ | 514 | ], [ |
526 | MochiKit.Base.method(this, 'getVersions'), | 515 | MochiKit.Base.method(this, 'getVersions'), |
527 | MochiKit.Base.bind(function (someVersions) { return someVersions[this.currentVersionReference()]}, this) | 516 | MochiKit.Base.bind(function (someVersions) { return someVersions[this.currentVersionReference()]}, this) |
528 | ]) | 517 | ]) |
529 | ], {trace:false}); | 518 | ], {trace:false}); |
530 | }, | 519 | }, |
531 | 520 | ||
532 | 'setCurrentRecordVersion': function (aRecordVersion) { | 521 | 'setCurrentRecordVersion': function (aRecordVersion) { |
533 | this._currentVersionReference = aRecordVersion.reference(); | 522 | this._currentVersionReference = aRecordVersion.reference(); |
534 | }, | 523 | }, |
535 | 524 | ||
536 | //......................................................................... | 525 | //......................................................................... |
537 | 526 | ||
538 | 'currentVersionReference': function () { | 527 | 'currentVersionReference': function () { |
539 | //console.log("currentVersionReference"); | ||
540 | return this._currentVersionReference; | 528 | return this._currentVersionReference; |
541 | }, | 529 | }, |
542 | 530 | ||
543 | //------------------------------------------------------------------------- | 531 | //------------------------------------------------------------------------- |
544 | 532 | ||
545 | 'createNewRecordVersion': function () { | 533 | 'createNewRecordVersion': function () { |
546 | var deferredResult; | 534 | var deferredResult; |
547 | 535 | ||
548 | if (this.isBrandNew()) { | 536 | if (this.isBrandNew()) { |
549 | deferredResult = this.getCurrentRecordVersion(); | 537 | deferredResult = this.getCurrentRecordVersion(); |
550 | } else { | 538 | } else { |
551 | var newVersion; | 539 | var newVersion; |
552 | 540 | ||
553 | newVersion = new Clipperz.PM.DataModel.Record.Version({ | 541 | newVersion = new Clipperz.PM.DataModel.Record.Version({ |
554 | // 'reference': versionKey, | 542 | // 'reference': versionKey, |
555 | 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'), | 543 | 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'), |
556 | // 'remoteData': {}, | 544 | // 'remoteData': {}, |
557 | 'getVersion': MochiKit.Base.method(this, 'getVersion') | 545 | 'getVersion': MochiKit.Base.method(this, 'getVersion') |
558 | }) | 546 | }) |
559 | this._versions[newVersion.reference()] = newVersion; | 547 | this._versions[newVersion.reference()] = newVersion; |
560 | 548 | ||
561 | deferredResult = Clipperz.Async.callbacks("Record.createNewRecordVersion", [ | 549 | deferredResult = Clipperz.Async.callbacks("Record.createNewRecordVersion", [ |
562 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 550 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
563 | // MochiKit.Base.methodcaller('values'), | 551 | // MochiKit.Base.methodcaller('values'), |
564 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'values'), | 552 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'values'), |
565 | MochiKit.Base.method(newVersion, 'setValues'), | 553 | MochiKit.Base.method(newVersion, 'setValues'), |
566 | 554 | ||
567 | Clipperz.Async.collectResults("Record.createNewRecordVersion [collect results]", { | 555 | Clipperz.Async.collectResults("Record.createNewRecordVersion [collect results]", { |
568 | 'reference':MochiKit.Base.method(this, 'currentVersionReference'), | 556 | 'reference':MochiKit.Base.method(this, 'currentVersionReference'), |
569 | 'key': MochiKit.Base.method(this, 'getCurrentRecordVersionKey') | 557 | 'key': MochiKit.Base.method(this, 'getCurrentRecordVersionKey') |
570 | }, {trace:false}), | 558 | }, {trace:false}), |
571 | MochiKit.Base.method(newVersion, 'setPreviousVersionReferenceAndKey'), | 559 | MochiKit.Base.method(newVersion, 'setPreviousVersionReferenceAndKey'), |
572 | 560 | ||
573 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 561 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
574 | // MochiKit.Base.method(this, 'revertChanges'), | 562 | // MochiKit.Base.method(this, 'revertChanges'), |
575 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'revertChanges'), | 563 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'revertChanges'), |
576 | 564 | ||
577 | MochiKit.Base.method(this, 'setCurrentRecordVersion', newVersion), | 565 | MochiKit.Base.method(this, 'setCurrentRecordVersion', newVersion), |
578 | MochiKit.Base.partial(MochiKit.Async.succeed, newVersion) | 566 | MochiKit.Base.partial(MochiKit.Async.succeed, newVersion) |
579 | ], {trace:false}); | 567 | ], {trace:false}); |
580 | } | 568 | } |
581 | 569 | ||
582 | return deferredResult; | 570 | return deferredResult; |
583 | }, | 571 | }, |
584 | 572 | ||
585 | //------------------------------------------------------------------------- | 573 | //------------------------------------------------------------------------- |
586 | 574 | ||
587 | 'getCurrentRecordVersionKey': function () { | 575 | 'getCurrentRecordVersionKey': function () { |
588 | //console.log("getCurrentRecordVersionKey"); | ||
589 | return Clipperz.Async.callbacks("Record.getCurrentRecordVersionKey", [ | 576 | return Clipperz.Async.callbacks("Record.getCurrentRecordVersionKey", [ |
590 | MochiKit.Base.method(this, 'getValue', 'currentVersionKey'), | 577 | MochiKit.Base.method(this, 'getValue', 'currentVersionKey'), |
591 | Clipperz.Async.deferredIf("currentVersionKey is NOT null", [ | 578 | Clipperz.Async.deferredIf("currentVersionKey is NOT null", [ |
592 | MochiKit.Async.succeed | 579 | MochiKit.Async.succeed |
593 | ], [ | 580 | ], [ |
594 | MochiKit.Base.method(this, 'getKey') | 581 | MochiKit.Base.method(this, 'getKey') |
595 | ]) | 582 | ]) |
596 | ], {trace:false}); | 583 | ], {trace:false}); |
597 | }, | 584 | }, |
598 | 585 | ||
599 | 'setCurrentRecordVersionKey': function (aValue) { | 586 | 'setCurrentRecordVersionKey': function (aValue) { |
600 | //TODO: triple check this method! | 587 | //TODO: triple check this method! |
601 | return Clipperz.Async.callbacks("Record.setCurrentRecordVersionKey", [ | 588 | return Clipperz.Async.callbacks("Record.setCurrentRecordVersionKey", [ |
602 | MochiKit.Base.method(this, 'setValue', 'currentVersionKey', aValue) | 589 | MochiKit.Base.method(this, 'setValue', 'currentVersionKey', aValue) |
603 | ], {trace:false}); | 590 | ], {trace:false}); |
604 | }, | 591 | }, |
605 | 592 | ||
606 | //------------------------------------------------------------------------- | 593 | //------------------------------------------------------------------------- |
607 | 594 | ||
608 | 'invokeCurrentRecordVersionMethod': function (aMethodName, someValues) { | 595 | 'invokeCurrentRecordVersionMethod': function (aMethodName, someValues) { |
609 | //console.log(">>> invokeCurrentRecordVersionMethod", aMethodName); | ||
610 | return Clipperz.Async.callbacks("Record.invokeCurrentRecordVersionMethod", [ | 596 | return Clipperz.Async.callbacks("Record.invokeCurrentRecordVersionMethod", [ |
611 | MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 597 | MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
612 | //function (aValue) { console.log("=== getCurrentRecordVersion", aValue); return aValue}, | ||
613 | MochiKit.Base.methodcaller(aMethodName, someValues) | 598 | MochiKit.Base.methodcaller(aMethodName, someValues) |
614 | ], {trace:false}); | 599 | ], {trace:false}); |
615 | }, | 600 | }, |
616 | 601 | ||
617 | 602 | ||
618 | 'lazilyinvokeCurrentRecordVersionMethod': function (aMethodName, someValues, defaultResult) { | 603 | 'lazilyinvokeCurrentRecordVersionMethod': function (aMethodName, someValues, defaultResult) { |
619 | return Clipperz.Async.callbacks("Record.lazilyinvokeCurrentRecordVersionMethod", [ | 604 | return Clipperz.Async.callbacks("Record.lazilyinvokeCurrentRecordVersionMethod", [ |
620 | MochiKit.Base.method(this, 'currentVersionReference'), | 605 | MochiKit.Base.method(this, 'currentVersionReference'), |
621 | //function (aValue) { console.log("LAZY -> versions", aValue); return aValue; }, | ||
622 | Clipperz.Async.deferredIf("versions has been loaded", [ | 606 | Clipperz.Async.deferredIf("versions has been loaded", [ |
623 | //function (aValue) { console.log("LAZY -> then"); return aValue; }, | ||
624 | MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 607 | MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
625 | MochiKit.Base.methodcaller(aMethodName, someValues), | 608 | MochiKit.Base.methodcaller(aMethodName, someValues), |
626 | //function (aValue) { console.log("LAZY <- then"); return aValue; } | ||
627 | ], [ | 609 | ], [ |
628 | //function (aValue) { console.log("LAZY -> else"); return aValue; }, | ||
629 | MochiKit.Base.partial(MochiKit.Async.succeed, defaultResult), | 610 | MochiKit.Base.partial(MochiKit.Async.succeed, defaultResult), |
630 | //function (aValue) { console.log("LAZY <- else"); return aValue; } | ||
631 | ]) | 611 | ]) |
632 | ], {trace:false}); | 612 | ], {trace:false}); |
633 | }, | 613 | }, |
634 | 614 | ||
635 | //========================================================================= | 615 | //========================================================================= |
636 | 616 | ||
637 | 'hasPendingChanges': function () { | 617 | 'hasPendingChanges': function () { |
638 | var deferredResult; | 618 | var deferredResult; |
639 | 619 | ||
640 | if (this.hasInitiatedObjectDataStore()) { | 620 | if (this.hasInitiatedObjectDataStore()) { |
641 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.hasPendingChanges", {trace:false}); | 621 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.hasPendingChanges", {trace:false}); |
642 | deferredResult.collectResults({ | 622 | deferredResult.collectResults({ |
643 | 'super': MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.hasPendingChanges, this), | 623 | 'super': MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.hasPendingChanges, this), |
644 | 'currentVersion': [ | 624 | 'currentVersion': [ |
645 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 625 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
646 | // MochiKit.Base.methodcaller('hasPendingChanges') | 626 | // MochiKit.Base.methodcaller('hasPendingChanges') |
647 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'hasPendingChanges') | 627 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'hasPendingChanges') |
648 | ], | 628 | ], |
649 | 'directLogins': [ | 629 | 'directLogins': [ |
650 | MochiKit.Base.method(this, 'directLogins'), | 630 | MochiKit.Base.method(this, 'directLogins'), |
651 | //function (aValue) { console.log("Record.directLogins", aValue); return aValue; }, | ||
652 | MochiKit.Base.values, | 631 | MochiKit.Base.values, |
653 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasPendingChanges')), | 632 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasPendingChanges')), |
654 | Clipperz.Async.collectAll, | 633 | Clipperz.Async.collectAll, |
655 | Clipperz.Async.or | 634 | Clipperz.Async.or |
656 | // function(someValues) { | 635 | // function(someValues) { |
657 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); | 636 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); |
658 | // } | 637 | // } |
659 | ] | 638 | ] |
660 | }); | 639 | }); |
661 | //deferredResult.addCallback(function (aValue) { console.log("Record.hasPendingResults", aValue); return aValue; }); | ||
662 | deferredResult.addCallback(MochiKit.Base.values); | 640 | deferredResult.addCallback(MochiKit.Base.values); |
663 | deferredResult.addCallback(MochiKit.Base.bind(function(someValues) { | 641 | deferredResult.addCallback(MochiKit.Base.bind(function(someValues) { |
664 | var result; | 642 | var result; |
665 | result = MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); | 643 | result = MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); |
666 | 644 | ||
667 | if ((result == false) && (this.isBrandNew() == false)) { | 645 | if ((result == false) && (this.isBrandNew() == false)) { |
668 | result = MochiKit.Iter.some(MochiKit.Base.values(this.transientState().getValue('hasPendingChanges.indexData')), MochiKit.Base.operator.identity); | 646 | result = MochiKit.Iter.some(MochiKit.Base.values(this.transientState().getValue('hasPendingChanges.indexData')), MochiKit.Base.operator.identity); |
669 | } | 647 | } |
670 | 648 | ||
671 | return result; | 649 | return result; |
672 | }, this)); | 650 | }, this)); |
673 | 651 | ||
674 | deferredResult.callback(); | 652 | deferredResult.callback(); |
675 | } else { | 653 | } else { |
676 | deferredResult = Clipperz.Async.callbacks("Recrod.hasPendingChanges [hasInitiatedObjectDataStore == false]", [ | 654 | deferredResult = Clipperz.Async.callbacks("Recrod.hasPendingChanges [hasInitiatedObjectDataStore == false]", [ |
677 | MochiKit.Base.method(this, 'directLogins'), | 655 | MochiKit.Base.method(this, 'directLogins'), |
678 | MochiKit.Base.values, | 656 | MochiKit.Base.values, |
679 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasPendingChanges')), | 657 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasPendingChanges')), |
680 | Clipperz.Async.collectAll, | 658 | Clipperz.Async.collectAll, |
681 | Clipperz.Async.or | 659 | Clipperz.Async.or |
682 | // function(someValues) { | 660 | // function(someValues) { |
683 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); | 661 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); |
684 | // } | 662 | // } |
685 | ], {trace:false}) | 663 | ], {trace:false}) |
@@ -755,89 +733,87 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt | |||
755 | ]); | 733 | ]); |
756 | deferredResult.callback(); | 734 | deferredResult.callback(); |
757 | } else { | 735 | } else { |
758 | // this.deleteAllCleanTextData(); | 736 | // this.deleteAllCleanTextData(); |
759 | deferredResult = MochiKit.Async.succeed(); | 737 | deferredResult = MochiKit.Async.succeed(); |
760 | } | 738 | } |
761 | 739 | ||
762 | return deferredResult; | 740 | return deferredResult; |
763 | }, | 741 | }, |
764 | 742 | ||
765 | //------------------------------------------------------------------------- | 743 | //------------------------------------------------------------------------- |
766 | 744 | ||
767 | 'resetTransientState': function (isCommitting) { | 745 | 'resetTransientState': function (isCommitting) { |
768 | // if ((isCommitting == false) && (this.transientState().getValue('directLogins') != null)) { | 746 | // if ((isCommitting == false) && (this.transientState().getValue('directLogins') != null)) { |
769 | // this._directLogins = this.transientState().getValue('directLogins'); | 747 | // this._directLogins = this.transientState().getValue('directLogins'); |
770 | // } | 748 | // } |
771 | 749 | ||
772 | return Clipperz.Async.callbacks("Record.resetTransientState", [ | 750 | return Clipperz.Async.callbacks("Record.resetTransientState", [ |
773 | //- MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 751 | //- MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
774 | //- MochiKit.Base.methodcaller('resetTransientState'), | 752 | //- MochiKit.Base.methodcaller('resetTransientState'), |
775 | // MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'resetTransientState'), | 753 | // MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'resetTransientState'), |
776 | MochiKit.Base.method(this, 'lazilyinvokeCurrentRecordVersionMethod', 'resetTransientState'), | 754 | MochiKit.Base.method(this, 'lazilyinvokeCurrentRecordVersionMethod', 'resetTransientState'), |
777 | 755 | ||
778 | MochiKit.Base.method(this, 'directLogins'), | 756 | MochiKit.Base.method(this, 'directLogins'), |
779 | //function (aValue) { console.log("resetTransientState - directLogins", aValue); return aValue; }, | ||
780 | MochiKit.Base.values, | 757 | MochiKit.Base.values, |
781 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('resetTransientState')), | 758 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('resetTransientState')), |
782 | 759 | ||
783 | MochiKit.Base.bind(function () { | 760 | MochiKit.Base.bind(function () { |
784 | if ((isCommitting == false) && (this.transientState().getValue('directLogins') != null)) { | 761 | if ((isCommitting == false) && (this.transientState().getValue('directLogins') != null)) { |
785 | this._directLogins = this.transientState().getValue('directLogins'); | 762 | this._directLogins = this.transientState().getValue('directLogins'); |
786 | } | 763 | } |
787 | }, this), | 764 | }, this), |
788 | 765 | ||
789 | MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.resetTransientState, this, isCommitting) | 766 | MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.resetTransientState, this, isCommitting) |
790 | ], {trace:false}) | 767 | ], {trace:false}) |
791 | }, | 768 | }, |
792 | 769 | ||
793 | //------------------------------------------------------------------------- | 770 | //------------------------------------------------------------------------- |
794 | 771 | ||
795 | 'commitTransientState': function () { | 772 | 'commitTransientState': function () { |
796 | var deferredResult; | 773 | var deferredResult; |
797 | 774 | ||
798 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.commitTransientState", {trace:false}); | 775 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.commitTransientState", {trace:false}); |
799 | deferredResult.addMethod(this, 'hasPendingChanges'); | 776 | deferredResult.addMethod(this, 'hasPendingChanges'); |
800 | deferredResult.addIf([ | 777 | deferredResult.addIf([ |
801 | MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.commitTransientState, this), | 778 | MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.commitTransientState, this), |
802 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 779 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
803 | // MochiKit.Base.methodcaller('commitTransientState'), | 780 | // MochiKit.Base.methodcaller('commitTransientState'), |
804 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'commitTransientState'), | 781 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'commitTransientState'), |
805 | MochiKit.Base.method(this, 'directLogins'), | 782 | MochiKit.Base.method(this, 'directLogins'), |
806 | MochiKit.Base.values, | 783 | MochiKit.Base.values, |
807 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('commitTransientState')) | 784 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('commitTransientState')) |
808 | ], [ | 785 | ], [ |
809 | MochiKit.Async.succeed | 786 | MochiKit.Async.succeed |
810 | ]); | 787 | ]); |
811 | deferredResult.callback(); | 788 | deferredResult.callback(); |
812 | 789 | ||
813 | return deferredResult; | 790 | return deferredResult; |
814 | }, | 791 | }, |
815 | 792 | ||
816 | //========================================================================= | 793 | //========================================================================= |
817 | 794 | ||
818 | 'retrieveDirectLoginIndexDataFunction': function () { | 795 | 'retrieveDirectLoginIndexDataFunction': function () { |
819 | //console.log("Record.retrieveDirectLoginIndexDataFunction", this._retrieveDirectLoginIndexDataFunction); | ||
820 | return this._retrieveDirectLoginIndexDataFunction; | 796 | return this._retrieveDirectLoginIndexDataFunction; |
821 | }, | 797 | }, |
822 | 798 | ||
823 | 'setDirectLoginIndexDataFunction': function () { | 799 | 'setDirectLoginIndexDataFunction': function () { |
824 | return this._setDirectLoginIndexDataFunction; | 800 | return this._setDirectLoginIndexDataFunction; |
825 | }, | 801 | }, |
826 | 802 | ||
827 | 'removeDirectLoginIndexDataFunction': function () { | 803 | 'removeDirectLoginIndexDataFunction': function () { |
828 | return this._removeDirectLoginIndexDataFunction; | 804 | return this._removeDirectLoginIndexDataFunction; |
829 | }, | 805 | }, |
830 | 806 | ||
831 | //========================================================================= | 807 | //========================================================================= |
832 | 808 | ||
833 | 'deleteAllCleanTextData': function () { | 809 | 'deleteAllCleanTextData': function () { |
834 | // return Clipperz.PM.DataModel.Record.superclass.deleteAllCleanTextData.apply(this, arguments); | 810 | // return Clipperz.PM.DataModel.Record.superclass.deleteAllCleanTextData.apply(this, arguments); |
835 | 811 | ||
836 | return Clipperz.Async.callbacks("Record.deleteAllCleanTextData", [ | 812 | return Clipperz.Async.callbacks("Record.deleteAllCleanTextData", [ |
837 | MochiKit.Base.method(this, 'versions'), | 813 | MochiKit.Base.method(this, 'versions'), |
838 | MochiKit.Base.values, | 814 | MochiKit.Base.values, |
839 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('deleteAllCleanTextData')), | 815 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('deleteAllCleanTextData')), |
840 | 816 | ||
841 | MochiKit.Base.method(this, 'directLogins'), | 817 | MochiKit.Base.method(this, 'directLogins'), |
842 | MochiKit.Base.values, | 818 | MochiKit.Base.values, |
843 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('deleteAllCleanTextData')), | 819 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('deleteAllCleanTextData')), |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js index d6202ff..cda5a41 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js | |||
@@ -1,46 +1,44 @@ | |||
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 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.User.Header.Legacy depends on Clipperz.PM.DataModel.User!"; | 25 | throw "Clipperz.PM.DataModel.User.Header.Legacy depends on Clipperz.PM.DataModel.User!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } | 28 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } |
31 | 29 | ||
32 | Clipperz.PM.DataModel.User.Header.Legacy = function(args) { | 30 | Clipperz.PM.DataModel.User.Header.Legacy = function(args) { |
33 | //args = args || {}; | 31 | //args = args || {}; |
34 | Clipperz.PM.DataModel.User.Header.Legacy.superclass.constructor.apply(this, arguments); | 32 | Clipperz.PM.DataModel.User.Header.Legacy.superclass.constructor.apply(this, arguments); |
35 | 33 | ||
36 | this._retrieveRecordDetailFunction = args.retrieveRecordDetailFunction|| Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | this._retrieveRecordDetailFunction = args.retrieveRecordDetailFunction|| Clipperz.Base.exception.raise('MandatoryParameter'); |
37 | this._records = null; | 35 | this._records = null; |
38 | //this._directLogins = null; | 36 | //this._directLogins = null; |
39 | 37 | ||
40 | return this; | 38 | return this; |
41 | } | 39 | } |
42 | 40 | ||
43 | 41 | ||
44 | Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.Legacy, Clipperz.PM.DataModel.EncryptedRemoteObject, { | 42 | Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.Legacy, Clipperz.PM.DataModel.EncryptedRemoteObject, { |
45 | 43 | ||
46 | 'toString': function() { | 44 | 'toString': function() { |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js index 3528db6..e82da47 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js | |||
@@ -1,104 +1,96 @@ | |||
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 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.User.Header.OneTimePasswords depends on Clipperz.PM.DataModel.User!"; | 25 | throw "Clipperz.PM.DataModel.User.Header.OneTimePasswords depends on Clipperz.PM.DataModel.User!"; |
28 | } | 26 | } |
29 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } | 27 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } |
30 | 28 | ||
31 | //----------------------------------------------------------------------------- | 29 | //----------------------------------------------------------------------------- |
32 | 30 | ||
33 | Clipperz.PM.DataModel.User.Header.OneTimePasswords = function(args) { | 31 | Clipperz.PM.DataModel.User.Header.OneTimePasswords = function(args) { |
34 | Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.constructor.apply(this, arguments); | 32 | Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.constructor.apply(this, arguments); |
35 | 33 | ||
36 | this._oneTimePasswords = null; | 34 | this._oneTimePasswords = null; |
37 | 35 | ||
38 | return this; | 36 | return this; |
39 | } | 37 | } |
40 | 38 | ||
41 | //----------------------------------------------------------------------------- | 39 | //----------------------------------------------------------------------------- |
42 | 40 | ||
43 | Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.OneTimePasswords, Clipperz.PM.DataModel.EncryptedRemoteObject, { | 41 | Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.OneTimePasswords, Clipperz.PM.DataModel.EncryptedRemoteObject, { |
44 | 42 | ||
45 | 'toString': function() { | 43 | 'toString': function() { |
46 | return "Clipperz.PM.DataModel.User.Header.OneTimePasswords"; | 44 | return "Clipperz.PM.DataModel.User.Header.OneTimePasswords"; |
47 | }, | 45 | }, |
48 | 46 | ||
49 | //------------------------------------------------------------------------- | 47 | //------------------------------------------------------------------------- |
50 | /* | 48 | /* |
51 | 'packData': function (someData) { //++ | 49 | 'packData': function (someData) { //++ |
52 | var result; | 50 | var result; |
53 | 51 | ||
54 | console.log(">>> OneTimePasswords.packData", someData); | ||
55 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packData.apply(this, arguments); | 52 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packData.apply(this, arguments); |
56 | console.log("<<< OneTimePasswords.packData"); | ||
57 | 53 | ||
58 | return result; | 54 | return result; |
59 | }, | 55 | }, |
60 | */ | 56 | */ |
61 | //------------------------------------------------------------------------- | 57 | //------------------------------------------------------------------------- |
62 | /* | 58 | /* |
63 | 'packRemoteData': function (someData) { | 59 | 'packRemoteData': function (someData) { |
64 | var result; | 60 | var result; |
65 | 61 | ||
66 | console.log(">>> OneTimePasswords.packRemoteData", someData); | ||
67 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packRemoteData.apply(this, arguments); | 62 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packRemoteData.apply(this, arguments); |
68 | console.log("<<< OneTimePasswords.packRemoteData"); | ||
69 | 63 | ||
70 | return result; | 64 | return result; |
71 | }, | 65 | }, |
72 | */ | 66 | */ |
73 | //------------------------------------------------------------------------- | 67 | //------------------------------------------------------------------------- |
74 | /* | 68 | /* |
75 | 'prepareRemoteDataWithKey': function (aKey) { | 69 | 'prepareRemoteDataWithKey': function (aKey) { |
76 | var result; | 70 | var result; |
77 | 71 | ||
78 | console.log(">>> OneTimePasswords.prepareRemoteDataWithKey"); | ||
79 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.prepareRemoteDataWithKey.apply(this, arguments); | 72 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.prepareRemoteDataWithKey.apply(this, arguments); |
80 | console.log("<<< OneTimePasswords.prepareRemoteDataWithKey"); | ||
81 | 73 | ||
82 | return result; | 74 | return result; |
83 | }, | 75 | }, |
84 | */ | 76 | */ |
85 | //========================================================================= | 77 | //========================================================================= |
86 | 78 | ||
87 | 'oneTimePasswords': function () { | 79 | 'oneTimePasswords': function () { |
88 | vardeferredResult; | 80 | vardeferredResult; |
89 | 81 | ||
90 | deferredResult = new Clipperz.Async.Deferred("User.Header.OneTimePasswords.oneTimePasswords", {trace:false}); | 82 | deferredResult = new Clipperz.Async.Deferred("User.Header.OneTimePasswords.oneTimePasswords", {trace:false}); |
91 | if (this._oneTimePasswords == null) { | 83 | if (this._oneTimePasswords == null) { |
92 | deferredResult.addMethod(this, 'values') | 84 | deferredResult.addMethod(this, 'values') |
93 | deferredResult.addCallback(MochiKit.Base.bind(function (someData) { | 85 | deferredResult.addCallback(MochiKit.Base.bind(function (someData) { |
94 | varotpKey; | 86 | varotpKey; |
95 | 87 | ||
96 | this._oneTimePasswords = {}; | 88 | this._oneTimePasswords = {}; |
97 | 89 | ||
98 | for (otpKey in someData) { | 90 | for (otpKey in someData) { |
99 | var otp; | 91 | var otp; |
100 | var otpParameters; | 92 | var otpParameters; |
101 | 93 | ||
102 | otpParameters = Clipperz.Base.deepClone(someData[otpKey]); | 94 | otpParameters = Clipperz.Base.deepClone(someData[otpKey]); |
103 | otpParameters['reference'] = otpKey; | 95 | otpParameters['reference'] = otpKey; |
104 | 96 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js index b164889..f1f95e8 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js | |||
@@ -1,46 +1,44 @@ | |||
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 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.User.Header.Preferences depends on Clipperz.PM.DataModel.User!"; | 25 | throw "Clipperz.PM.DataModel.User.Header.Preferences depends on Clipperz.PM.DataModel.User!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } | 28 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } |
31 | 29 | ||
32 | Clipperz.PM.DataModel.User.Header.Preferences = function(args) { | 30 | Clipperz.PM.DataModel.User.Header.Preferences = function(args) { |
33 | Clipperz.PM.DataModel.User.Header.Preferences.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.DataModel.User.Header.Preferences.superclass.constructor.apply(this, arguments); |
34 | 32 | ||
35 | return this; | 33 | return this; |
36 | } | 34 | } |
37 | 35 | ||
38 | 36 | ||
39 | Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.Preferences, Clipperz.PM.DataModel.EncryptedRemoteObject, { | 37 | Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.Preferences, Clipperz.PM.DataModel.EncryptedRemoteObject, { |
40 | 38 | ||
41 | 'toString': function() { | 39 | 'toString': function() { |
42 | return "Clipperz.PM.DataModel.User.Header.Preferences"; | 40 | return "Clipperz.PM.DataModel.User.Header.Preferences"; |
43 | }, | 41 | }, |
44 | 42 | ||
45 | //------------------------------------------------------------------------- | 43 | //------------------------------------------------------------------------- |
46 | //========================================================================= | 44 | //========================================================================= |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js index f77ea80..5681f70 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js | |||
@@ -1,59 +1,56 @@ | |||
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 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.User.Header.RecordIndex depends on Clipperz.PM.DataModel.User!"; | 25 | throw "Clipperz.PM.DataModel.User.Header.RecordIndex depends on Clipperz.PM.DataModel.User!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } | 28 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } |
31 | 29 | ||
32 | Clipperz.PM.DataModel.User.Header.RecordIndex = function(args) { | 30 | Clipperz.PM.DataModel.User.Header.RecordIndex = function(args) { |
33 | Clipperz.PM.DataModel.User.Header.RecordIndex.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.DataModel.User.Header.RecordIndex.superclass.constructor.apply(this, arguments); |
34 | 32 | ||
35 | //console.log("NEW Clipperz.PM.DataModel.User.Header.RecordIndex", args); | ||
36 | this._recordsData = new Clipperz.PM.DataModel.EncryptedRemoteObject({ | 33 | this._recordsData = new Clipperz.PM.DataModel.EncryptedRemoteObject({ |
37 | 'name':'recordsData', | 34 | 'name':'recordsData', |
38 | 'retrieveKeyFunction': args.retrieveKeyFunction, | 35 | 'retrieveKeyFunction': args.retrieveKeyFunction, |
39 | 'remoteData': { | 36 | 'remoteData': { |
40 | 'data': args.recordsData['data'], | 37 | 'data': args.recordsData['data'], |
41 | 'version': args.encryptedDataVersion, | 38 | 'version': args.encryptedDataVersion, |
42 | 'recordsStats': args.recordsStats | 39 | 'recordsStats': args.recordsStats |
43 | }//, | 40 | }//, |
44 | // 'encryptedDataKeypath': 'data', | 41 | // 'encryptedDataKeypath': 'data', |
45 | // 'encryptedVersionKeypath': 'version' | 42 | // 'encryptedVersionKeypath': 'version' |
46 | }); | 43 | }); |
47 | 44 | ||
48 | this._directLoginsData = new Clipperz.PM.DataModel.EncryptedRemoteObject({ | 45 | this._directLoginsData = new Clipperz.PM.DataModel.EncryptedRemoteObject({ |
49 | 'name':'directLoginsData', | 46 | 'name':'directLoginsData', |
50 | 'retrieveKeyFunction': args.retrieveKeyFunction, | 47 | 'retrieveKeyFunction': args.retrieveKeyFunction, |
51 | 'remoteData': { | 48 | 'remoteData': { |
52 | 'data': args.directLoginsData['data'], | 49 | 'data': args.directLoginsData['data'], |
53 | 'version': args.encryptedDataVersion | 50 | 'version': args.encryptedDataVersion |
54 | }//, | 51 | }//, |
55 | // 'encryptedDataKeypath': 'data', | 52 | // 'encryptedDataKeypath': 'data', |
56 | // 'encryptedVersionKeypath': 'version' | 53 | // 'encryptedVersionKeypath': 'version' |
57 | }); | 54 | }); |
58 | 55 | ||
59 | this._lock = new MochiKit.Async.DeferredLock(); | 56 | this._lock = new MochiKit.Async.DeferredLock(); |
@@ -97,97 +94,94 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.RecordIndex, Object, { | |||
97 | return this._directLoginsIndex; | 94 | return this._directLoginsIndex; |
98 | }, | 95 | }, |
99 | 96 | ||
100 | 'directLoginsData': function () { | 97 | 'directLoginsData': function () { |
101 | return this._directLoginsData; | 98 | return this._directLoginsData; |
102 | }, | 99 | }, |
103 | 100 | ||
104 | //------------------------------------------------------------------------- | 101 | //------------------------------------------------------------------------- |
105 | 102 | ||
106 | 'lock': function () { | 103 | 'lock': function () { |
107 | return this._lock; | 104 | return this._lock; |
108 | }, | 105 | }, |
109 | 106 | ||
110 | //------------------------------------------------------------------------- | 107 | //------------------------------------------------------------------------- |
111 | 108 | ||
112 | 'transientState': function () { | 109 | 'transientState': function () { |
113 | if (this._transientState == null) { | 110 | if (this._transientState == null) { |
114 | this._transientState = new Clipperz.KeyValueObjectStore(/*{'name':'User.Header.RecordIndex.transientState [1]'}*/); | 111 | this._transientState = new Clipperz.KeyValueObjectStore(/*{'name':'User.Header.RecordIndex.transientState [1]'}*/); |
115 | } | 112 | } |
116 | 113 | ||
117 | return this._transientState; | 114 | return this._transientState; |
118 | }, | 115 | }, |
119 | 116 | ||
120 | 'resetTransientState': function (isCommitting) { | 117 | 'resetTransientState': function (isCommitting) { |
121 | //console.log("######## UserHeaderRecordIndex - resetTransientState", Clipperz.Base.deepClone(this._transientState)); | ||
122 | if (this._transientState != null) { | 118 | if (this._transientState != null) { |
123 | this._transientState.removeAllData(); | 119 | this._transientState.removeAllData(); |
124 | } | 120 | } |
125 | 121 | ||
126 | this._transientState = null; | 122 | this._transientState = null; |
127 | }, | 123 | }, |
128 | 124 | ||
129 | //------------------------------------------------------------------------- | 125 | //------------------------------------------------------------------------- |
130 | 126 | ||
131 | 'getRecordKey': function (aRecordReference) { | 127 | 'getRecordKey': function (aRecordReference) { |
132 | return Clipperz.Async.callbacks("User.Header.RecordIndex.getRecordKey", [ | 128 | return Clipperz.Async.callbacks("User.Header.RecordIndex.getRecordKey", [ |
133 | MochiKit.Base.method(this, 'getRecordIndexData', aRecordReference), | 129 | MochiKit.Base.method(this, 'getRecordIndexData', aRecordReference), |
134 | MochiKit.Base.itemgetter('key') | 130 | MochiKit.Base.itemgetter('key') |
135 | ], {trace:false}); | 131 | ], {trace:false}); |
136 | }, | 132 | }, |
137 | 133 | ||
138 | 'setRecordKey': function (aRecordReference, aValue) { | 134 | 'setRecordKey': function (aRecordReference, aValue) { |
139 | return this.updateRecordIndexData(aRecordReference, 'key', aValue); | 135 | return this.updateRecordIndexData(aRecordReference, 'key', aValue); |
140 | }, | 136 | }, |
141 | 137 | ||
142 | //------------------------------------------------------------------------- | 138 | //------------------------------------------------------------------------- |
143 | 139 | ||
144 | 'getRecordIndexData': function (aRecordReference) { | 140 | 'getRecordIndexData': function (aRecordReference) { |
145 | return this.recordsData().getValue(this.recordsIndex()[aRecordReference]); | 141 | return this.recordsData().getValue(this.recordsIndex()[aRecordReference]); |
146 | }, | 142 | }, |
147 | 143 | ||
148 | //......................................................................... | 144 | //......................................................................... |
149 | 145 | ||
150 | 'updateRecordIndexData': function (aRecordReference, aKey, aValue) { | 146 | 'updateRecordIndexData': function (aRecordReference, aKey, aValue) { |
151 | return this.recordsData().setValue(this.recordsIndex()[aRecordReference]+'.'+aKey, aValue); | 147 | return this.recordsData().setValue(this.recordsIndex()[aRecordReference]+'.'+aKey, aValue); |
152 | }, | 148 | }, |
153 | 149 | ||
154 | //------------------------------------------------------------------------- | 150 | //------------------------------------------------------------------------- |
155 | 151 | ||
156 | 'getDirectLoginIndexData': function (aDirectLoginReference) { | 152 | 'getDirectLoginIndexData': function (aDirectLoginReference) { |
157 | return this.directLoginsData().getValue(this.directLoginsIndex()[aDirectLoginReference]); | 153 | return this.directLoginsData().getValue(this.directLoginsIndex()[aDirectLoginReference]); |
158 | }, | 154 | }, |
159 | 155 | ||
160 | 'setDirectLoginIndexData': function (aDirectLoginReference, aKey, aValue) { | 156 | 'setDirectLoginIndexData': function (aDirectLoginReference, aKey, aValue) { |
161 | //console.log("UserHeaderRecordIndex.setDirectLoginIndexData", aDirectLoginReference, this.directLoginsIndex()[aDirectLoginReference], aKey); | ||
162 | //if (MochiKit.Base.isUndefinedOrNull(this.directLoginsIndex()[aDirectLoginReference])) { | 157 | //if (MochiKit.Base.isUndefinedOrNull(this.directLoginsIndex()[aDirectLoginReference])) { |
163 | //throw "PIPPO"; | 158 | //throw "PIPPO"; |
164 | //} | 159 | //} |
165 | return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference] + '.' + aKey, aValue); | 160 | return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference] + '.' + aKey, aValue); |
166 | }, | 161 | }, |
167 | 162 | ||
168 | 'addDirectLoginIndexData': function (aDirectLoginReference) { | 163 | 'addDirectLoginIndexData': function (aDirectLoginReference) { |
169 | //console.log("UserHeaderRecordIndex.addDirectLoginIndexData", aDirectLoginReference, this.directLoginsIndex()[aDirectLoginReference]); | ||
170 | return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference], {}); | 164 | return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference], {}); |
171 | }, | 165 | }, |
172 | 166 | ||
173 | 'removeDirectLoginIndexData': function (aDirectLoginReference) { | 167 | 'removeDirectLoginIndexData': function (aDirectLoginReference) { |
174 | return this.directLoginsData().removeValue(this.directLoginsIndex()[aDirectLoginReference]) | 168 | return this.directLoginsData().removeValue(this.directLoginsIndex()[aDirectLoginReference]) |
175 | }, | 169 | }, |
176 | 170 | ||
177 | //------------------------------------------------------------------------- | 171 | //------------------------------------------------------------------------- |
178 | 172 | ||
179 | 'records': function () { | 173 | 'records': function () { |
180 | vardeferredResult; | 174 | vardeferredResult; |
181 | 175 | ||
182 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.records", {trace:false}); | 176 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.records", {trace:false}); |
183 | deferredResult.acquireLock(this.lock()); | 177 | deferredResult.acquireLock(this.lock()); |
184 | deferredResult.addCallback(MochiKit.Base.bind(function () { | 178 | deferredResult.addCallback(MochiKit.Base.bind(function () { |
185 | var innerDeferredResult; | 179 | var innerDeferredResult; |
186 | 180 | ||
187 | if (this._records == null) { | 181 | if (this._records == null) { |
188 | innerDeferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.records <inner deferred>", {trace:false}); | 182 | innerDeferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.records <inner deferred>", {trace:false}); |
189 | innerDeferredResult.collectResults({ | 183 | innerDeferredResult.collectResults({ |
190 | 'records': [ | 184 | 'records': [ |
191 | // MochiKit.Base.method(this.recordsData(), 'getObjectDataStore'), | 185 | // MochiKit.Base.method(this.recordsData(), 'getObjectDataStore'), |
192 | // MochiKit.Base.methodcaller('values') | 186 | // MochiKit.Base.methodcaller('values') |
193 | MochiKit.Base.method(this.recordsData(), 'values') | 187 | MochiKit.Base.method(this.recordsData(), 'values') |
@@ -240,93 +234,87 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.RecordIndex, Object, { | |||
240 | 234 | ||
241 | this._records[reference] = record; | 235 | this._records[reference] = record; |
242 | } else { | 236 | } else { |
243 | Clipperz.log("SKIPPING record " + reference + " as there are no stas associated - " + Clipperz.Base.serializeJSON(someData['records'][reference])); | 237 | Clipperz.log("SKIPPING record " + reference + " as there are no stas associated - " + Clipperz.Base.serializeJSON(someData['records'][reference])); |
244 | //# skip the record, as it seems it is not present in the DB | 238 | //# skip the record, as it seems it is not present in the DB |
245 | //updateDate = Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); | 239 | //updateDate = Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); |
246 | } | 240 | } |
247 | } | 241 | } |
248 | 242 | ||
249 | for (indexReference in someData['directLogins']) { | 243 | for (indexReference in someData['directLogins']) { |
250 | // vardirectLogin; | 244 | // vardirectLogin; |
251 | var reference; | 245 | var reference; |
252 | var record; | 246 | var record; |
253 | 247 | ||
254 | reference = directLoginsInvertedIndex[indexReference]; | 248 | reference = directLoginsInvertedIndex[indexReference]; |
255 | record = this._records[recordsInvertedIndex[someData['directLogins'][indexReference]['record']]]; | 249 | record = this._records[recordsInvertedIndex[someData['directLogins'][indexReference]['record']]]; |
256 | 250 | ||
257 | if (record != null) { | 251 | if (record != null) { |
258 | // directLogin = new Clipperz.PM.DataModel.DirectLogin({ | 252 | // directLogin = new Clipperz.PM.DataModel.DirectLogin({ |
259 | new Clipperz.PM.DataModel.DirectLogin({ | 253 | new Clipperz.PM.DataModel.DirectLogin({ |
260 | 'reference': reference, | 254 | 'reference': reference, |
261 | 'record': record | 255 | 'record': record |
262 | }); | 256 | }); |
263 | } else { | 257 | } else { |
264 | Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!"); | 258 | Clipperz.logWarning("WARNING: DIRECT LOGIN without a matching RECORD!!"); |
265 | //console.log("direct login data", someData['directLogins']); | ||
266 | //console.log("current direct login data", someData['directLogins'][indexReference]) | ||
267 | //console.log("reference", reference); | ||
268 | //console.log("record index", this.recordsIndex()); | ||
269 | //console.log("record inverted index", recordsInvertedIndex); | ||
270 | } | 259 | } |
271 | } | 260 | } |
272 | 261 | ||
273 | return this._records; | 262 | return this._records; |
274 | }, this)); | 263 | }, this)); |
275 | innerDeferredResult.callback(); | 264 | innerDeferredResult.callback(); |
276 | } else { | 265 | } else { |
277 | innerDeferredResult = MochiKit.Async.succeed(this._records); | 266 | innerDeferredResult = MochiKit.Async.succeed(this._records); |
278 | } | 267 | } |
279 | 268 | ||
280 | return innerDeferredResult; | 269 | return innerDeferredResult; |
281 | }, this)); | 270 | }, this)); |
282 | deferredResult.releaseLock(this.lock()); | 271 | deferredResult.releaseLock(this.lock()); |
283 | deferredResult.callback(); | 272 | deferredResult.callback(); |
284 | 273 | ||
285 | return deferredResult; | 274 | return deferredResult; |
286 | }, | 275 | }, |
287 | 276 | ||
288 | //------------------------------------------------------------------------- | 277 | //------------------------------------------------------------------------- |
289 | 278 | ||
290 | 'updateRecordIndexForNewRecord': function (aNewRecord) { | 279 | 'updateRecordIndexForNewRecord': function (aNewRecord) { |
291 | var newRecordIndex; | 280 | var newRecordIndex; |
292 | var recordReference; | 281 | var recordReference; |
293 | 282 | ||
294 | recordReference = aNewRecord.reference(); | 283 | recordReference = aNewRecord.reference(); |
295 | newRecordIndex = (MochiKit.Base.listMax(MochiKit.Base.map(MochiKit.Base.partial(MochiKit.Base.operator.mul, 1), MochiKit.Base.values(this.recordsIndex()))) + 1) + ''; | 284 | newRecordIndex = (MochiKit.Base.listMax(MochiKit.Base.map(MochiKit.Base.partial(MochiKit.Base.operator.mul, 1), MochiKit.Base.values(this.recordsIndex()))) + 1) + ''; |
296 | this.recordsIndex()[recordReference] = newRecordIndex; | 285 | this.recordsIndex()[recordReference] = newRecordIndex; |
297 | 286 | ||
298 | this.transientState().setValue('newlyCreatedRecordsIndex' + '.' + recordReference, newRecordIndex); | 287 | this.transientState().setValue('newlyCreatedRecordsIndex' + '.' + recordReference, newRecordIndex); |
299 | this.transientState().setValue('newlyCreatedRecordsReferences'+ '.' + recordReference, aNewRecord); | 288 | this.transientState().setValue('newlyCreatedRecordsReferences'+ '.' + recordReference, aNewRecord); |
300 | }, | 289 | }, |
301 | 290 | ||
302 | //......................................................................... | 291 | //......................................................................... |
303 | 292 | ||
304 | 'createNewRecord': function () { | 293 | 'createNewRecord': function () { |
305 | var deferredResult; | 294 | var deferredResult; |
306 | var newRecord; | 295 | var newRecord; |
307 | 296 | ||
308 | //console.log("#### new Clipperz.PM.DataModel.Record [4]"); | ||
309 | newRecord = new Clipperz.PM.DataModel.Record({ | 297 | newRecord = new Clipperz.PM.DataModel.Record({ |
310 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getRecordKey'), | 298 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getRecordKey'), |
311 | 'retrieveRemoteDataFunction':this.retrieveRecordDetailFunction(), | 299 | 'retrieveRemoteDataFunction':this.retrieveRecordDetailFunction(), |
312 | 300 | ||
313 | 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getRecordIndexData'), | 301 | 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getRecordIndexData'), |
314 | 'updateIndexDataFunction': MochiKit.Base.method(this, 'updateRecordIndexData'), | 302 | 'updateIndexDataFunction': MochiKit.Base.method(this, 'updateRecordIndexData'), |
315 | 'updateDate': Clipperz.PM.Date.formatDateWithUTCFormat(new Date()), | 303 | 'updateDate': Clipperz.PM.Date.formatDateWithUTCFormat(new Date()), |
316 | 304 | ||
317 | 'retrieveDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'), | 305 | 'retrieveDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'), |
318 | 'setDirectLoginIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'), | 306 | 'setDirectLoginIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'), |
319 | 'removeDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'removeDirectLoginIndexData'), | 307 | 'removeDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'removeDirectLoginIndexData'), |
320 | 308 | ||
321 | 'createNewDirectLoginFunction': MochiKit.Base.method(this, 'createNewDirectLogin') | 309 | 'createNewDirectLoginFunction': MochiKit.Base.method(this, 'createNewDirectLogin') |
322 | }); | 310 | }); |
323 | 311 | ||
324 | this.transientState().setValue('newRecordsReferences' + '.' + newRecord.reference(), newRecord); | 312 | this.transientState().setValue('newRecordsReferences' + '.' + newRecord.reference(), newRecord); |
325 | this.updateRecordIndexForNewRecord(newRecord); | 313 | this.updateRecordIndexForNewRecord(newRecord); |
326 | 314 | ||
327 | deferredResult = Clipperz.Async.callbacks("User.Header.RecordIndex.createNewRecord", [ | 315 | deferredResult = Clipperz.Async.callbacks("User.Header.RecordIndex.createNewRecord", [ |
328 | MochiKit.Base.method(this, 'records'), | 316 | MochiKit.Base.method(this, 'records'), |
329 | MochiKit.Base.partial(Clipperz.Async.setItemOnObject, newRecord.reference(), newRecord), | 317 | MochiKit.Base.partial(Clipperz.Async.setItemOnObject, newRecord.reference(), newRecord), |
330 | MochiKit.Base.method(this, 'setRecordKey', newRecord.reference(), Clipperz.PM.Crypto.randomKey()), | 318 | MochiKit.Base.method(this, 'setRecordKey', newRecord.reference(), Clipperz.PM.Crypto.randomKey()), |
331 | MochiKit.Base.method(newRecord, 'setLabel', ''), | 319 | MochiKit.Base.method(newRecord, 'setLabel', ''), |
332 | MochiKit.Base.partial(MochiKit.Async.succeed, newRecord) | 320 | MochiKit.Base.partial(MochiKit.Async.succeed, newRecord) |
@@ -365,124 +353,120 @@ Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!"); | |||
365 | delete someRecords[recordReference]; | 353 | delete someRecords[recordReference]; |
366 | }, this)); | 354 | }, this)); |
367 | deferredResult.callback(); | 355 | deferredResult.callback(); |
368 | 356 | ||
369 | return deferredResult; | 357 | return deferredResult; |
370 | }, | 358 | }, |
371 | 359 | ||
372 | //========================================================================= | 360 | //========================================================================= |
373 | 361 | ||
374 | 'removeDirectLogin': function (aDirectLogin) { | 362 | 'removeDirectLogin': function (aDirectLogin) { |
375 | this.directLoginsData().removeValue(this.directLoginsIndex()[aDirectLogin.reference()]); | 363 | this.directLoginsData().removeValue(this.directLoginsIndex()[aDirectLogin.reference()]); |
376 | }, | 364 | }, |
377 | 365 | ||
378 | //------------------------------------------------------------------------- | 366 | //------------------------------------------------------------------------- |
379 | 367 | ||
380 | 'createNewDirectLogin': function (aRecord) { | 368 | 'createNewDirectLogin': function (aRecord) { |
381 | var newDirectLogin; | 369 | var newDirectLogin; |
382 | varnewDirectLoginIndexValue; | 370 | varnewDirectLoginIndexValue; |
383 | 371 | ||
384 | newDirectLogin = new Clipperz.PM.DataModel.DirectLogin({record:aRecord}); | 372 | newDirectLogin = new Clipperz.PM.DataModel.DirectLogin({record:aRecord}); |
385 | newDirectLoginIndexValue = MochiKit.Base.listMax(MochiKit.Base.map(function (aValue) { return aValue * 1; }, MochiKit.Base.values(this.directLoginsIndex()))) + 1; | 373 | newDirectLoginIndexValue = MochiKit.Base.listMax(MochiKit.Base.map(function (aValue) { return aValue * 1; }, MochiKit.Base.values(this.directLoginsIndex()))) + 1; |
386 | 374 | ||
387 | this.transientState().setValue('newDirectLoginReferences' + '.' + newDirectLogin.reference(), newDirectLogin); | 375 | this.transientState().setValue('newDirectLoginReferences' + '.' + newDirectLogin.reference(), newDirectLogin); |
388 | 376 | ||
389 | //console.log("UserHeaderRecordIndex.createNewDirectLogin [1]", newDirectLogin.reference(), newDirectLoginIndexValue); | ||
390 | this.directLoginsIndex()[newDirectLogin.reference()] = newDirectLoginIndexValue; | 377 | this.directLoginsIndex()[newDirectLogin.reference()] = newDirectLoginIndexValue; |
391 | //console.log("UserHeaderRecordIndex.createNewDirectLogin [2]", newDirectLogin.reference(), this.directLoginsIndex()[newDirectLogin.reference()]); | ||
392 | this.directLoginsData().setValue(this.directLoginsIndex()[newDirectLogin.reference()], {'record': this.recordsIndex()[aRecord.reference()]}); | 378 | this.directLoginsData().setValue(this.directLoginsIndex()[newDirectLogin.reference()], {'record': this.recordsIndex()[aRecord.reference()]}); |
393 | 379 | ||
394 | return newDirectLogin; | 380 | return newDirectLogin; |
395 | }, | 381 | }, |
396 | 382 | ||
397 | //========================================================================= | 383 | //========================================================================= |
398 | 384 | ||
399 | 'deleteAllCleanTextData': function () { | 385 | 'deleteAllCleanTextData': function () { |
400 | return Clipperz.Async.callbacks("User.Header.RecordIndex.deleteAllCleanTextData", [ | 386 | return Clipperz.Async.callbacks("User.Header.RecordIndex.deleteAllCleanTextData", [ |
401 | // MochiKit.Base.method(this, 'records'), | 387 | // MochiKit.Base.method(this, 'records'), |
402 | // MochiKit.Base.values, | 388 | // MochiKit.Base.values, |
403 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('deleteAllCleanTextData')), | 389 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('deleteAllCleanTextData')), |
404 | 390 | ||
405 | MochiKit.Base.method(this, 'recordsData'), | 391 | MochiKit.Base.method(this, 'recordsData'), |
406 | MochiKit.Base.methodcaller('deleteAllCleanTextData'), | 392 | MochiKit.Base.methodcaller('deleteAllCleanTextData'), |
407 | MochiKit.Base.method(this, 'directLoginsData'), | 393 | MochiKit.Base.method(this, 'directLoginsData'), |
408 | MochiKit.Base.methodcaller('deleteAllCleanTextData') | 394 | MochiKit.Base.methodcaller('deleteAllCleanTextData') |
409 | ], {trace:false}); | 395 | ], {trace:false}); |
410 | }, | 396 | }, |
411 | 397 | ||
412 | //------------------------------------------------------------------------- | 398 | //------------------------------------------------------------------------- |
413 | 399 | ||
414 | 'hasAnyCleanTextData': function () { | 400 | 'hasAnyCleanTextData': function () { |
415 | var deferredResult; | 401 | var deferredResult; |
416 | 402 | ||
417 | deferredResult = new Clipperz.Async.Deferred({trace:false}); | 403 | deferredResult = new Clipperz.Async.Deferred({trace:false}); |
418 | deferredResult.collectResults({ | 404 | deferredResult.collectResults({ |
419 | 'recordsData': [ | 405 | 'recordsData': [ |
420 | MochiKit.Base.method(this, 'recordsData'), | 406 | MochiKit.Base.method(this, 'recordsData'), |
421 | MochiKit.Base.methodcaller('hasAnyCleanTextData') | 407 | MochiKit.Base.methodcaller('hasAnyCleanTextData') |
422 | ], | 408 | ], |
423 | 'directLoginsData':[ | 409 | 'directLoginsData':[ |
424 | MochiKit.Base.method(this, 'directLoginsData'), | 410 | MochiKit.Base.method(this, 'directLoginsData'), |
425 | MochiKit.Base.methodcaller('hasAnyCleanTextData') | 411 | MochiKit.Base.methodcaller('hasAnyCleanTextData') |
426 | ], | 412 | ], |
427 | // 'records': [ | 413 | // 'records': [ |
428 | // MochiKit.Base.method(this, 'records'), | 414 | // MochiKit.Base.method(this, 'records'), |
429 | // MochiKit.Base.values, | 415 | // MochiKit.Base.values, |
430 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasAnyCleanTextData')), | 416 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasAnyCleanTextData')), |
431 | // Clipperz.Async.collectAll | 417 | // Clipperz.Async.collectAll |
432 | // ] | 418 | // ] |
433 | }); | 419 | }); |
434 | //deferredResult.addCallback(function (aValue) { console.log("USER.Header.RecordIndex.hasAnyCleanTextData", aValue); return aValue}); | ||
435 | 420 | ||
436 | // deferredResult.addCallback(MochiKit.Base.values); | 421 | // deferredResult.addCallback(MochiKit.Base.values); |
437 | // deferredResult.addCallback(MochiKit.Base.flattenArguments); | 422 | // deferredResult.addCallback(MochiKit.Base.flattenArguments); |
438 | // deferredResult.addCallback(function(someValues) { | 423 | // deferredResult.addCallback(function(someValues) { |
439 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); | 424 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); |
440 | // }); | 425 | // }); |
441 | deferredResult.addCallback(Clipperz.Async.or); | 426 | deferredResult.addCallback(Clipperz.Async.or); |
442 | 427 | ||
443 | deferredResult.callback(); | 428 | deferredResult.callback(); |
444 | 429 | ||
445 | return deferredResult; | 430 | return deferredResult; |
446 | }, | 431 | }, |
447 | 432 | ||
448 | //------------------------------------------------------------------------- | 433 | //------------------------------------------------------------------------- |
449 | 434 | ||
450 | 'hasPendingChanges': function () { | 435 | 'hasPendingChanges': function () { |
451 | vardeferredResult; | 436 | vardeferredResult; |
452 | 437 | ||
453 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.hasPendingChanges", {trace:false}); | 438 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.hasPendingChanges", {trace:false}); |
454 | deferredResult.collectResults({ | 439 | deferredResult.collectResults({ |
455 | 'recordsData': [ | 440 | 'recordsData': [ |
456 | MochiKit.Base.method(this, 'recordsData'), | 441 | MochiKit.Base.method(this, 'recordsData'), |
457 | MochiKit.Base.methodcaller('hasPendingChanges') | 442 | MochiKit.Base.methodcaller('hasPendingChanges') |
458 | ], | 443 | ], |
459 | 'directLoginsData': [ | 444 | 'directLoginsData': [ |
460 | MochiKit.Base.method(this, 'directLoginsData'), | 445 | MochiKit.Base.method(this, 'directLoginsData'), |
461 | MochiKit.Base.methodcaller('hasPendingChanges') | 446 | MochiKit.Base.methodcaller('hasPendingChanges') |
462 | ] | 447 | ] |
463 | }); | 448 | }); |
464 | //deferredResult.addCallback(function (aValue) { console.log("UserHeaderIndex.hasPendingResults", aValue); return aValue; }); | ||
465 | deferredResult.addCallback(Clipperz.Async.or); | 449 | deferredResult.addCallback(Clipperz.Async.or); |
466 | // deferredResult.addCallback(MochiKit.Base.values); | 450 | // deferredResult.addCallback(MochiKit.Base.values); |
467 | // deferredResult.addCallback(MochiKit.Base.flattenArguments); | 451 | // deferredResult.addCallback(MochiKit.Base.flattenArguments); |
468 | // deferredResult.addCallback(function(someValues) { | 452 | // deferredResult.addCallback(function(someValues) { |
469 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); | 453 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); |
470 | // }); | 454 | // }); |
471 | deferredResult.callback(); | 455 | deferredResult.callback(); |
472 | 456 | ||
473 | return deferredResult; | 457 | return deferredResult; |
474 | }, | 458 | }, |
475 | 459 | ||
476 | //------------------------------------------------------------------------- | 460 | //------------------------------------------------------------------------- |
477 | 461 | ||
478 | 'commitTransientState': function () { | 462 | 'commitTransientState': function () { |
479 | var deferredResult; | 463 | var deferredResult; |
480 | 464 | ||
481 | deferredResut = Clipperz.Async.callbacks("User.Header.RecordIndex.commitTransientState", [ | 465 | deferredResut = Clipperz.Async.callbacks("User.Header.RecordIndex.commitTransientState", [ |
482 | MochiKit.Base.method(this, 'recordsData'), | 466 | MochiKit.Base.method(this, 'recordsData'), |
483 | MochiKit.Base.methodcaller('commitTransientState'), | 467 | MochiKit.Base.methodcaller('commitTransientState'), |
484 | 468 | ||
485 | MochiKit.Base.method(this, 'directLoginsData'), | 469 | MochiKit.Base.method(this, 'directLoginsData'), |
486 | MochiKit.Base.methodcaller('commitTransientState'), | 470 | MochiKit.Base.methodcaller('commitTransientState'), |
487 | 471 | ||
488 | MochiKit.Base.method(this, 'resetTransientState', true) | 472 | MochiKit.Base.method(this, 'resetTransientState', true) |
@@ -549,49 +533,48 @@ Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!"); | |||
549 | // "records": { | 533 | // "records": { |
550 | // "index": { | 534 | // "index": { |
551 | // "eeda70e0392261967bda71c3764da78989c45bbd2bb7be6b941b90f81d9b81b5": "0", | 535 | // "eeda70e0392261967bda71c3764da78989c45bbd2bb7be6b941b90f81d9b81b5": "0", |
552 | // "13a5e52976337ab210903cd04872588e1b21fb72bc183e91aa25c494b8138551": "1", | 536 | // "13a5e52976337ab210903cd04872588e1b21fb72bc183e91aa25c494b8138551": "1", |
553 | // ... | 537 | // ... |
554 | // "465a067a0bd2b470fa834de5397e38494de0c7707938262fae3427932e219744": "18", | 538 | // "465a067a0bd2b470fa834de5397e38494de0c7707938262fae3427932e219744": "18", |
555 | // "4fd1dc2ca860b7fb47cef10a84edb3270da05510b0a30a6b0b083898712d4b9e": "19" | 539 | // "4fd1dc2ca860b7fb47cef10a84edb3270da05510b0a30a6b0b083898712d4b9e": "19" |
556 | // }, | 540 | // }, |
557 | // "data": "n+AzGEEQXaSRSY4d ... BDypotrXgPo94uHfoXvGFzwCn8w=" | 541 | // "data": "n+AzGEEQXaSRSY4d ... BDypotrXgPo94uHfoXvGFzwCn8w=" |
558 | // }, | 542 | // }, |
559 | // "directLogins": { | 543 | // "directLogins": { |
560 | // "index": { | 544 | // "index": { |
561 | // "61e87fdc4f1d9112e3b30c1f6812d095dcdb24f014c83319091eb6c9899ec348":"0", | 545 | // "61e87fdc4f1d9112e3b30c1f6812d095dcdb24f014c83319091eb6c9899ec348":"0", |
562 | // "989593d4c48929f0c8f1581aa96969c622807e99619ed4732026e967530a68ad":"1", | 546 | // "989593d4c48929f0c8f1581aa96969c622807e99619ed4732026e967530a68ad":"1", |
563 | // ... | 547 | // ... |
564 | // "cb9ae0bba1957075ccdbfd3b3481704d62087687a2ac7c411a4f07d444bde0f7":"17", | 548 | // "cb9ae0bba1957075ccdbfd3b3481704d62087687a2ac7c411a4f07d444bde0f7":"17", |
565 | // "7e1d069b7fa57c03bd7bf48807520feb953157834503aaff8c9d493f37dea69d":"18" | 549 | // "7e1d069b7fa57c03bd7bf48807520feb953157834503aaff8c9d493f37dea69d":"18" |
566 | // }, | 550 | // }, |
567 | // "data":"5YG9KKU/OZ5guUgFlms6k1 ... ZG/5Fn0uN+LoAsNfHm+EE62x" | 551 | // "data":"5YG9KKU/OZ5guUgFlms6k1 ... ZG/5Fn0uN+LoAsNfHm+EE62x" |
568 | // }, | 552 | // }, |
569 | 553 | ||
570 | var deferredResult; | 554 | var deferredResult; |
571 | var result; | 555 | var result; |
572 | 556 | ||
573 | //console.log("recordsIndex", this.recordsIndex()); | ||
574 | result = {}; | 557 | result = {}; |
575 | 558 | ||
576 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.prepareRemoteDataWithKey", {trace:false}); | 559 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.prepareRemoteDataWithKey", {trace:false}); |
577 | deferredResult.collectResults({ | 560 | deferredResult.collectResults({ |
578 | 'index':MochiKit.Base.partial(MochiKit.Async.succeed, this.recordsIndex()), | 561 | 'index':MochiKit.Base.partial(MochiKit.Async.succeed, this.recordsIndex()), |
579 | 'data': [ | 562 | 'data': [ |
580 | MochiKit.Base.method(this.recordsData(), 'prepareRemoteDataWithKey', aKey), | 563 | MochiKit.Base.method(this.recordsData(), 'prepareRemoteDataWithKey', aKey), |
581 | MochiKit.Base.itemgetter('data') | 564 | MochiKit.Base.itemgetter('data') |
582 | ] | 565 | ] |
583 | }); | 566 | }); |
584 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'records'); | 567 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'records'); |
585 | 568 | ||
586 | deferredResult.collectResults({ | 569 | deferredResult.collectResults({ |
587 | 'index':MochiKit.Base.partial(MochiKit.Async.succeed, this.directLoginsIndex()), | 570 | 'index':MochiKit.Base.partial(MochiKit.Async.succeed, this.directLoginsIndex()), |
588 | 'data': [ | 571 | 'data': [ |
589 | MochiKit.Base.method(this.directLoginsData(), 'prepareRemoteDataWithKey', aKey), | 572 | MochiKit.Base.method(this.directLoginsData(), 'prepareRemoteDataWithKey', aKey), |
590 | MochiKit.Base.itemgetter('data') | 573 | MochiKit.Base.itemgetter('data') |
591 | ] | 574 | ] |
592 | }); | 575 | }); |
593 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'directLogins'); | 576 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'directLogins'); |
594 | 577 | ||
595 | deferredResult.addCallback(MochiKit.Async.succeed, result); | 578 | deferredResult.addCallback(MochiKit.Async.succeed, result); |
596 | 579 | ||
597 | deferredResult.callback(); | 580 | deferredResult.callback(); |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.js index 646ce21..fd18faf 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/User.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.js | |||
@@ -1,46 +1,44 @@ | |||
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.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | 28 | ||
31 | //############################################################################# | 29 | //############################################################################# |
32 | 30 | ||
33 | Clipperz.PM.DataModel.User = function (args) { | 31 | Clipperz.PM.DataModel.User = function (args) { |
34 | args = args || {}; | 32 | args = args || {}; |
35 | 33 | ||
36 | Clipperz.PM.DataModel.User.superclass.constructor.apply(this, arguments); | 34 | Clipperz.PM.DataModel.User.superclass.constructor.apply(this, arguments); |
37 | 35 | ||
38 | this._username = args.username || null; | 36 | this._username = args.username || null; |
39 | this._getPassphraseFunction = args.getPassphraseFunction || null; | 37 | this._getPassphraseFunction = args.getPassphraseFunction || null; |
40 | 38 | ||
41 | this._data = null; | 39 | this._data = null; |
42 | 40 | ||
43 | this._connection = null; | 41 | this._connection = null; |
44 | this._connectionVersion = 'current'; | 42 | this._connectionVersion = 'current'; |
45 | 43 | ||
46 | this._serverData = null; | 44 | this._serverData = null; |
@@ -307,49 +305,48 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, { | |||
307 | var result; | 305 | var result; |
308 | 306 | ||
309 | if (anHeader.charAt(0) == '{') { | 307 | if (anHeader.charAt(0) == '{') { |
310 | varheaderData; | 308 | varheaderData; |
311 | 309 | ||
312 | headerData = Clipperz.Base.evalJSON(anHeader); | 310 | headerData = Clipperz.Base.evalJSON(anHeader); |
313 | result = headerData['version']; | 311 | result = headerData['version']; |
314 | } else { | 312 | } else { |
315 | result = 'LEGACY'; | 313 | result = 'LEGACY'; |
316 | } | 314 | } |
317 | 315 | ||
318 | return result; | 316 | return result; |
319 | }, | 317 | }, |
320 | 318 | ||
321 | //------------------------------------------------------------------------- | 319 | //------------------------------------------------------------------------- |
322 | 320 | ||
323 | 'unpackServerData': function (someServerData) { | 321 | 'unpackServerData': function (someServerData) { |
324 | var unpackedData; | 322 | var unpackedData; |
325 | var headerVersion; | 323 | var headerVersion; |
326 | 324 | ||
327 | varrecordsIndex; | 325 | varrecordsIndex; |
328 | var preferences; | 326 | var preferences; |
329 | var oneTimePasswords; | 327 | var oneTimePasswords; |
330 | 328 | ||
331 | //console.log(">>> ***************** user.unpackServerData", someServerData); | ||
332 | // this.setServerLockValue(someServerData['lock']); | 329 | // this.setServerLockValue(someServerData['lock']); |
333 | 330 | ||
334 | headerVersion = this.headerFormatVersion(someServerData['header']); | 331 | headerVersion = this.headerFormatVersion(someServerData['header']); |
335 | 332 | ||
336 | switch (headerVersion) { | 333 | switch (headerVersion) { |
337 | case 'LEGACY': | 334 | case 'LEGACY': |
338 | varlegacyHeader; | 335 | varlegacyHeader; |
339 | 336 | ||
340 | legacyHeader = new Clipperz.PM.DataModel.User.Header.Legacy({ | 337 | legacyHeader = new Clipperz.PM.DataModel.User.Header.Legacy({ |
341 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), | 338 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), |
342 | 'remoteData': { | 339 | 'remoteData': { |
343 | 'data': someServerData['header'], | 340 | 'data': someServerData['header'], |
344 | 'version': someServerData['version'], | 341 | 'version': someServerData['version'], |
345 | 'recordsStats': someServerData['recordsStats'] | 342 | 'recordsStats': someServerData['recordsStats'] |
346 | }, | 343 | }, |
347 | // 'encryptedDataKeypath': 'data', | 344 | // 'encryptedDataKeypath': 'data', |
348 | // 'encryptedVersionKeypath': 'version', | 345 | // 'encryptedVersionKeypath': 'version', |
349 | 'retrieveRecordDetailFunction':MochiKit.Base.method(this, 'getRecordDetail') | 346 | 'retrieveRecordDetailFunction':MochiKit.Base.method(this, 'getRecordDetail') |
350 | }); | 347 | }); |
351 | 348 | ||
352 | recordsIndex = legacyHeader; | 349 | recordsIndex = legacyHeader; |
353 | preferences = legacyHeader; | 350 | preferences = legacyHeader; |
354 | oneTimePasswords= legacyHeader; | 351 | oneTimePasswords= legacyHeader; |
355 | break; | 352 | break; |
@@ -396,49 +393,48 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, { | |||
396 | } else { | 393 | } else { |
397 | oneTimePasswords = new Clipperz.PM.DataModel.User.Header.OneTimePasswords({ | 394 | oneTimePasswords = new Clipperz.PM.DataModel.User.Header.OneTimePasswords({ |
398 | 'name':'preferences', | 395 | 'name':'preferences', |
399 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase') | 396 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase') |
400 | }); | 397 | }); |
401 | } | 398 | } |
402 | 399 | ||
403 | break; | 400 | break; |
404 | } | 401 | } |
405 | 402 | ||
406 | unpackedData = { | 403 | unpackedData = { |
407 | 'version': someServerData['version'], | 404 | 'version': someServerData['version'], |
408 | 'statistics': someServerData['statistics'], | 405 | 'statistics': someServerData['statistics'], |
409 | 'header': { | 406 | 'header': { |
410 | 'data': someServerData['header'], | 407 | 'data': someServerData['header'], |
411 | 'version': headerVersion, | 408 | 'version': headerVersion, |
412 | 409 | ||
413 | 'recordsIndex': recordsIndex, | 410 | 'recordsIndex': recordsIndex, |
414 | 'preferences': preferences, | 411 | 'preferences': preferences, |
415 | 'oneTimePasswords': oneTimePasswords | 412 | 'oneTimePasswords': oneTimePasswords |
416 | } | 413 | } |
417 | }; | 414 | }; |
418 | 415 | ||
419 | this._serverData = unpackedData; | 416 | this._serverData = unpackedData; |
420 | //console.log("<<< ***************** user.unpackServerData", this._serverData); | ||
421 | 417 | ||
422 | return this._serverData; | 418 | return this._serverData; |
423 | }, | 419 | }, |
424 | 420 | ||
425 | //------------------------------------------------------------------------- | 421 | //------------------------------------------------------------------------- |
426 | 422 | ||
427 | 'getServerData': function() { | 423 | 'getServerData': function() { |
428 | var deferredResult; | 424 | var deferredResult; |
429 | 425 | ||
430 | deferredResult = new Clipperz.Async.Deferred("User.getServerData", {trace:false}); | 426 | deferredResult = new Clipperz.Async.Deferred("User.getServerData", {trace:false}); |
431 | deferredResult.acquireLock(this.deferredLockForSection('serverData')); | 427 | deferredResult.acquireLock(this.deferredLockForSection('serverData')); |
432 | deferredResult.addCallback(MochiKit.Base.bind(function(aResult) { | 428 | deferredResult.addCallback(MochiKit.Base.bind(function(aResult) { |
433 | var innerDeferredResult; | 429 | var innerDeferredResult; |
434 | 430 | ||
435 | innerDeferredResult = new Clipperz.Async.Deferred("User.getUserDetails.innerDeferred", {trace:false}); | 431 | innerDeferredResult = new Clipperz.Async.Deferred("User.getUserDetails.innerDeferred", {trace:false}); |
436 | if (this._serverData == null) { | 432 | if (this._serverData == null) { |
437 | innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'loadingUserDetails'); | 433 | innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'loadingUserDetails'); |
438 | innerDeferredResult.addMethod(this.connection(), 'message', 'getUserDetails'); | 434 | innerDeferredResult.addMethod(this.connection(), 'message', 'getUserDetails'); |
439 | innerDeferredResult.addMethod(this, 'unpackServerData'); | 435 | innerDeferredResult.addMethod(this, 'unpackServerData'); |
440 | innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'loadedUserDetails'); | 436 | innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'loadedUserDetails'); |
441 | } | 437 | } |
442 | 438 | ||
443 | innerDeferredResult.addCallback(MochiKit.Base.bind(function () { | 439 | innerDeferredResult.addCallback(MochiKit.Base.bind(function () { |
444 | return this._serverData; | 440 | return this._serverData; |