Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js | 22 |
1 files changed, 10 insertions, 12 deletions
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,118 +1,116 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.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() { |
47 | return "DirectLoginBinding (" + this.key() + ", " + this.fieldKey() + ")"; | 45 | return "DirectLoginBinding (" + this.key() + ", " + this.fieldKey() + ")"; |
48 | }, | 46 | }, |
49 | 47 | ||
50 | //------------------------------------------------------------------------- | 48 | //------------------------------------------------------------------------- |
51 | 49 | ||
52 | 'directLogin': function () { | 50 | 'directLogin': function () { |
53 | return this._directLogin; | 51 | return this._directLogin; |
54 | }, | 52 | }, |
55 | 53 | ||
56 | //------------------------------------------------------------------------- | 54 | //------------------------------------------------------------------------- |
57 | 55 | ||
58 | 'key': function() { | 56 | 'key': function() { |
59 | return this._key; | 57 | return this._key; |
60 | }, | 58 | }, |
61 | 59 | ||
62 | //------------------------------------------------------------------------- | 60 | //------------------------------------------------------------------------- |
63 | 61 | ||
64 | 'fieldKey': function() { | 62 | 'fieldKey': function() { |
65 | return this._fieldKey; | 63 | return this._fieldKey; |
66 | }, | 64 | }, |
67 | 65 | ||
68 | 'setFieldKey': function(aValue) { | 66 | 'setFieldKey': function(aValue) { |
69 | this._fieldKey = aValue; | 67 | this._fieldKey = aValue; |
70 | 68 | ||
71 | return this.directLogin().setValue('bindingData' + '.' + this.key(), aValue); | 69 | return this.directLogin().setValue('bindingData' + '.' + this.key(), aValue); |
72 | }, | 70 | }, |
73 | 71 | ||
74 | //'fieldName': function() { | 72 | //'fieldName': function() { |
75 | // return this._fieldName; | 73 | // return this._fieldName; |
76 | //}, | 74 | //}, |
77 | 75 | ||
78 | //------------------------------------------------------------------------- | 76 | //------------------------------------------------------------------------- |
79 | 77 | ||
80 | 'field': function() { | 78 | 'field': function() { |
81 | var deferredResult; | 79 | var deferredResult; |
82 | 80 | ||
83 | if (this.fieldKey() != null) { | 81 | if (this.fieldKey() != null) { |
84 | deferredResult = Clipperz.Async.callbacks("DirectLoginBinding.field [1]", [ | 82 | deferredResult = Clipperz.Async.callbacks("DirectLoginBinding.field [1]", [ |
85 | MochiKit.Base.method(this.directLogin().record(), 'fields'), | 83 | MochiKit.Base.method(this.directLogin().record(), 'fields'), |
86 | MochiKit.Base.itemgetter(this.fieldKey()) | 84 | MochiKit.Base.itemgetter(this.fieldKey()) |
87 | ], {trace:false}); | 85 | ], {trace:false}); |
88 | // } else if (this.fieldName() != null) { | 86 | // } else if (this.fieldName() != null) { |
89 | // WTF = TODO; | 87 | // WTF = TODO; |
90 | // result = this.directLogin().record().fieldWithName(this.fieldName()); | 88 | // result = this.directLogin().record().fieldWithName(this.fieldName()); |
91 | // | 89 | // |
92 | // this.setFieldKey(result.key()); | 90 | // this.setFieldKey(result.key()); |
93 | } else { | 91 | } else { |
94 | deferredResult = MochiKit.Async.succeed(null); | 92 | deferredResult = MochiKit.Async.succeed(null); |
95 | } | 93 | } |
96 | 94 | ||
97 | return deferredResult; | 95 | return deferredResult; |
98 | }, | 96 | }, |
99 | 97 | ||
100 | 'setField': function (aField) { | 98 | 'setField': function (aField) { |
101 | this.setFieldKey(aField.reference()); | 99 | this.setFieldKey(aField.reference()); |
102 | }, | 100 | }, |
103 | 101 | ||
104 | //------------------------------------------------------------------------- | 102 | //------------------------------------------------------------------------- |
105 | /* | 103 | /* |
106 | 'fieldValue': function () { | 104 | 'fieldValue': function () { |
107 | return Clipperz.Async.callbacks("DirectLoginBinding.fieldValue", [ | 105 | return Clipperz.Async.callbacks("DirectLoginBinding.fieldValue", [ |
108 | MochiKit.Base.method('field'), | 106 | MochiKit.Base.method('field'), |
109 | MochiKit.Base.methodcaller('value') | 107 | MochiKit.Base.methodcaller('value') |
110 | ], {trace:false}); | 108 | ], {trace:false}); |
111 | }, | 109 | }, |
112 | */ | 110 | */ |
113 | //------------------------------------------------------------------------- | 111 | //------------------------------------------------------------------------- |
114 | 112 | ||
115 | 'serializedData': function() { | 113 | 'serializedData': function() { |
116 | return this.fieldKey(); | 114 | return this.fieldKey(); |
117 | }, | 115 | }, |
118 | 116 | ||