summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/DataModel
authorGiulio Cesare Solaroli <giulio.cesare@clipperz.com>2011-10-06 00:36:10 (UTC)
committer Giulio Cesare Solaroli <giulio.cesare@clipperz.com>2011-10-06 00:36:10 (UTC)
commit6ba274c79e60e417132b260bd0117c5a68121387 (patch) (unidiff)
tree57c1f95d0fbf9b80312c5c6b6f4a4f951e31c770 /frontend/gamma/js/Clipperz/PM/DataModel
parent13ebf1b1987a1566d081ff1ba89b4dca197b7d2e (diff)
downloadclipperz-6ba274c79e60e417132b260bd0117c5a68121387.zip
clipperz-6ba274c79e60e417132b260bd0117c5a68121387.tar.gz
clipperz-6ba274c79e60e417132b260bd0117c5a68121387.tar.bz2
Fixed the copyright headers
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/DataModel') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js15
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js15
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js15
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js15
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js15
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js15
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js15
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js15
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/Record.js15
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js15
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js15
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js15
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js15
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/User.js15
14 files changed, 84 insertions, 126 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js
index 1d38509..8f8696d 100644
--- a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js
@@ -1,216 +1,213 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29Clipperz.Base.module('Clipperz.PM.DataModel'); 26Clipperz.Base.module('Clipperz.PM.DataModel');
30 27
31Clipperz.PM.DataModel.DirectLogin = function(args) { 28Clipperz.PM.DataModel.DirectLogin = function(args) {
32 args = args || {}; 29 args = args || {};
33 30
34 Clipperz.PM.DataModel.DirectLogin.superclass.constructor.apply(this, arguments); 31 Clipperz.PM.DataModel.DirectLogin.superclass.constructor.apply(this, arguments);
35 32
36 this._reference =args.reference 33 this._reference =args.reference
37 ||Clipperz.PM.Crypto.randomKey(); 34 ||Clipperz.PM.Crypto.randomKey();
38 this._record =args.record 35 this._record =args.record
39 ||Clipperz.Base.exception.raise('MandatoryParameter'); 36 ||Clipperz.Base.exception.raise('MandatoryParameter');
40 37
41 this._retrieveIndexDataFunction = args.retrieveIndexDataFunction 38 this._retrieveIndexDataFunction = args.retrieveIndexDataFunction
42 ||this.record().retrieveDirectLoginIndexDataFunction() 39 ||this.record().retrieveDirectLoginIndexDataFunction()
43 ||Clipperz.Base.exception.raise('MandatoryParameter'); 40 ||Clipperz.Base.exception.raise('MandatoryParameter');
44 this._setIndexDataFunction = args.setIndexDataFunction 41 this._setIndexDataFunction = args.setIndexDataFunction
45 ||this.record().setDirectLoginIndexDataFunction() 42 ||this.record().setDirectLoginIndexDataFunction()
46 ||Clipperz.Base.exception.raise('MandatoryParameter'); 43 ||Clipperz.Base.exception.raise('MandatoryParameter');
47 this._removeIndexDataFunction =args.removeIndexDataFunction 44 this._removeIndexDataFunction =args.removeIndexDataFunction
48 ||this.record().removeDirectLoginIndexDataFunction() 45 ||this.record().removeDirectLoginIndexDataFunction()
49 ||Clipperz.Base.exception.raise('MandatoryParameter'); 46 ||Clipperz.Base.exception.raise('MandatoryParameter');
50 47
51 this._inputs = null; 48 this._inputs = null;
52 this._bindings = null; 49 this._bindings = null;
53 this._formValues = null; 50 this._formValues = null;
54 51
55 // this._inputsDeferredLock = new MochiKit.Async.DeferredLock(); 52 // this._inputsDeferredLock = new MochiKit.Async.DeferredLock();
56 // this._bindingsDeferredLock = new MochiKit.Async.DeferredLock(); 53 // this._bindingsDeferredLock = new MochiKit.Async.DeferredLock();
57 // this._formValuesDeferredLock = new MochiKit.Async.DeferredLock(); 54 // this._formValuesDeferredLock = new MochiKit.Async.DeferredLock();
58 55
59 this._transientState = null; 56 this._transientState = null;
60 57
61 this._isBrandNew = MochiKit.Base.isUndefinedOrNull(args.reference); 58 this._isBrandNew = MochiKit.Base.isUndefinedOrNull(args.reference);
62 59
63 this.record().addDirectLogin(this); 60 this.record().addDirectLogin(this);
64 61
65 return this; 62 return this;
66} 63}
67 64
68Clipperz.Base.extend(Clipperz.PM.DataModel.DirectLogin, Object, { 65Clipperz.Base.extend(Clipperz.PM.DataModel.DirectLogin, Object, {
69 66
70 'toString': function() { 67 'toString': function() {
71 return "DirectLogin (" + this.reference() + ")"; 68 return "DirectLogin (" + this.reference() + ")";
72 }, 69 },
73 70
74 //========================================================================= 71 //=========================================================================
75 72
76 'reference': function () { 73 'reference': function () {
77 return this._reference; 74 return this._reference;
78 }, 75 },
79 76
80 //------------------------------------------------------------------------- 77 //-------------------------------------------------------------------------
81 78
82 'record': function () { 79 'record': function () {
83 return this._record; 80 return this._record;
84 }, 81 },
85 82
86 //========================================================================= 83 //=========================================================================
87 84
88 'isBrandNew': function () { 85 'isBrandNew': function () {
89 return this._isBrandNew; 86 return this._isBrandNew;
90 }, 87 },
91 88
92 //========================================================================= 89 //=========================================================================
93 90
94 'removeIndexDataFunction': function () { 91 'removeIndexDataFunction': function () {
95 return this._removeIndexDataFunction; 92 return this._removeIndexDataFunction;
96 }, 93 },
97 94
98 'remove': function () { 95 'remove': function () {
99 return Clipperz.Async.callbacks("DirectLogin.remove", [ 96 return Clipperz.Async.callbacks("DirectLogin.remove", [
100 MochiKit.Base.partial(this.removeIndexDataFunction(), this.reference()), 97 MochiKit.Base.partial(this.removeIndexDataFunction(), this.reference()),
101 MochiKit.Base.method(this.record(), 'removeDirectLogin', this) 98 MochiKit.Base.method(this.record(), 'removeDirectLogin', this)
102 ], {trace:false}); 99 ], {trace:false});
103 }, 100 },
104 101
105 //========================================================================= 102 //=========================================================================
106 /* 103 /*
107 'inputsDeferredLock': function () { 104 'inputsDeferredLock': function () {
108 return this._inputsDeferredLock; 105 return this._inputsDeferredLock;
109 }, 106 },
110 107
111 'bindingsDeferredLock': function () { 108 'bindingsDeferredLock': function () {
112 return this._bindingsDeferredLock; 109 return this._bindingsDeferredLock;
113 }, 110 },
114 111
115 'formValuesDeferredLock': function () { 112 'formValuesDeferredLock': function () {
116 return this._formValuesDeferredLock; 113 return this._formValuesDeferredLock;
117 }, 114 },
118*/ 115*/
119 //========================================================================= 116 //=========================================================================
120 117
121 'label': function () { 118 'label': function () {
122 return this.getIndexDataForKey('label'); 119 return this.getIndexDataForKey('label');
123 }, 120 },
124 121
125 'setLabelKeepingBackwardCompatibilityWithBeta': function (aValue) { 122 'setLabelKeepingBackwardCompatibilityWithBeta': function (aValue) {
126 return Clipperz.Async.callbacks("DirectLogin.setLabelKeepingBackwardCompatibilityWithBeta", [ 123 return Clipperz.Async.callbacks("DirectLogin.setLabelKeepingBackwardCompatibilityWithBeta", [
127 MochiKit.Base.method(this, 'setIndexDataForKey', 'label', aValue), 124 MochiKit.Base.method(this, 'setIndexDataForKey', 'label', aValue),
128 MochiKit.Base.method(this, 'setValue', 'label', aValue) 125 MochiKit.Base.method(this, 'setValue', 'label', aValue)
129 ], {trace:false}); 126 ], {trace:false});
130 }, 127 },
131 128
132 'setLabel': function (aValue) { 129 'setLabel': function (aValue) {
133 return this.setLabelKeepingBackwardCompatibilityWithBeta(aValue); 130 return this.setLabelKeepingBackwardCompatibilityWithBeta(aValue);
134 // return this.setIndexDataForKey('label', aValue); 131 // return this.setIndexDataForKey('label', aValue);
135 }, 132 },
136 133
137 //========================================================================= 134 //=========================================================================
138 135
139 'favicon': function () { 136 'favicon': function () {
140 return this.getIndexDataForKey('favicon'); 137 return this.getIndexDataForKey('favicon');
141 }, 138 },
142 139
143 'setFavicon': function (aValue) { 140 'setFavicon': function (aValue) {
144 return this.setIndexDataForKey('favicon', aValue); 141 return this.setIndexDataForKey('favicon', aValue);
145 }, 142 },
146 143
147 'faviconUrlWithBookmarkletConfiguration': function (aBookmarkletConfiguration) { 144 'faviconUrlWithBookmarkletConfiguration': function (aBookmarkletConfiguration) {
148 varresult; 145 varresult;
149 146
150 if (! MochiKit.Base.isUndefinedOrNull(aBookmarkletConfiguration['page']['favicon'])) { 147 if (! MochiKit.Base.isUndefinedOrNull(aBookmarkletConfiguration['page']['favicon'])) {
151 result = aBookmarkletConfiguration['page']['favicon']; 148 result = aBookmarkletConfiguration['page']['favicon'];
152 } else if (! MochiKit.Base.isUndefinedOrNull(aBookmarkletConfiguration['form']['attributes']['action'])) { 149 } else if (! MochiKit.Base.isUndefinedOrNull(aBookmarkletConfiguration['form']['attributes']['action'])) {
153 var actionUrl; 150 var actionUrl;
154 var hostname; 151 var hostname;
155 152
156 actionUrl = aBookmarkletConfiguration['form']['attributes']['action']; 153 actionUrl = aBookmarkletConfiguration['form']['attributes']['action'];
157 hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1'); 154 hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1');
158 result = "http://" + hostname + "/favicon.ico"; 155 result = "http://" + hostname + "/favicon.ico";
159 } else { 156 } else {
160 result = null; 157 result = null;
161 } 158 }
162 159
163 160
164 return result; 161 return result;
165 }, 162 },
166 163
167 //------------------------------------------------------------------------- 164 //-------------------------------------------------------------------------
168/* 165/*
169 'faviconData': function () { 166 'faviconData': function () {
170 var regexp = new RegExp('^data\:\/\/.*', 'i'); 167 var regexp = new RegExp('^data\:\/\/.*', 'i');
171 168
172 return Clipperz.Async.callbacks("DirectLogin.favicon", [ 169 return Clipperz.Async.callbacks("DirectLogin.favicon", [
173 MochiKit.Base.method(this, 'getIndexDataForKey', 'favicon'), 170 MochiKit.Base.method(this, 'getIndexDataForKey', 'favicon'),
174 MochiKit.Base.method(regexp, 'test'), 171 MochiKit.Base.method(regexp, 'test'),
175 Clipperz.Async.deferredIf("is data URL", [ 172 Clipperz.Async.deferredIf("is data URL", [
176 MochiKit.Base.method(this, 'getIndexDataForKey', 'favicon') 173 MochiKit.Base.method(this, 'getIndexDataForKey', 'favicon')
177 ], [ 174 ], [
178 MochiKit.Base.method(this, 'transientState'), 175 MochiKit.Base.method(this, 'transientState'),
179 MochiKit.Base.itemgetter('faviconData'), 176 MochiKit.Base.itemgetter('faviconData'),
180 Clipperz.Async.deferredIf('has a chaced value for the favicon data', [ 177 Clipperz.Async.deferredIf('has a chaced value for the favicon data', [
181 MochiKit.Base.operator.identity 178 MochiKit.Base.operator.identity
182 ], [ 179 ], [
183 MochiKit.Base.method(this, 'getIndexDataForKey', 'favicon'), 180 MochiKit.Base.method(this, 'getIndexDataForKey', 'favicon'),
184 MochiKit.Base.method(this, 'loadFaviconDataFromURL') 181 MochiKit.Base.method(this, 'loadFaviconDataFromURL')
185 ]) 182 ])
186 183
187 ]) 184 ])
188 ], {trace:false}); 185 ], {trace:false});
189 }, 186 },
190 187
191 //------------------------------------------------------------------------- 188 //-------------------------------------------------------------------------
192 189
193 'loadFaviconDataFromURL': function (anURL) { 190 'loadFaviconDataFromURL': function (anURL) {
194 var deferredResult; 191 var deferredResult;
195 var image; 192 var image;
196 193
197 deferredResult = new Clipperz.Async.Deferred("DirectLogin.loadFaviconDataFromURL", {trace:false}); 194 deferredResult = new Clipperz.Async.Deferred("DirectLogin.loadFaviconDataFromURL", {trace:false});
198 deferredResult.addCallback(function (anEvent) { 195 deferredResult.addCallback(function (anEvent) {
199 var image = anEvent.src(); 196 var image = anEvent.src();
200 var canvas = document.createElement("canvas"); 197 var canvas = document.createElement("canvas");
201 var result; 198 var result;
202 199
203 canvas.width = image.width; 200 canvas.width = image.width;
204 canvas.height = image.height; 201 canvas.height = image.height;
205 202
206 var ctx = canvas.getContext("2d"); 203 var ctx = canvas.getContext("2d");
207 ctx.drawImage(image, 0, 0); 204 ctx.drawImage(image, 0, 0);
208 205
209 result = canvas.toDataURL(/*"image/png"* /); 206 result = canvas.toDataURL(/*"image/png"* /);
210 207
211 return result; 208 return result;
212 }); 209 });
213 deferredResult.addErrback(MochiKit.Async.succeed, Clipperz.PM.Strings.getValue('defaultFaviconUrl')); 210 deferredResult.addErrback(MochiKit.Async.succeed, Clipperz.PM.Strings.getValue('defaultFaviconUrl'));
214 deferredResult.addBoth(MochiKit.Base.bind(function (aDataUrl) { 211 deferredResult.addBoth(MochiKit.Base.bind(function (aDataUrl) {
215 this.transientState()['faviconData'] = aDataUrl; 212 this.transientState()['faviconData'] = aDataUrl;
216 213
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js
index fd55c63..4377853 100644
--- a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js
@@ -1,125 +1,122 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33 30
34//############################################################################# 31//#############################################################################
35 32
36Clipperz.PM.DataModel.DirectLoginBinding = function(aDirectLogin, args) { 33Clipperz.PM.DataModel.DirectLoginBinding = function(aDirectLogin, args) {
37 args = args || {}; 34 args = args || {};
38 35
39 this._directLogin = aDirectLogin|| Clipperz.Base.exception.raise('MandatoryParameter'); 36 this._directLogin = aDirectLogin|| Clipperz.Base.exception.raise('MandatoryParameter');
40 37
41 this._key = args.key|| Clipperz.Base.exception.raise('MandatoryParameter'); 38 this._key = args.key|| Clipperz.Base.exception.raise('MandatoryParameter');
42 this._fieldKey = args.field || /* this.directLogin().fieldWithName(args.fieldName).reference() || */null; 39 this._fieldKey = args.field || /* this.directLogin().fieldWithName(args.fieldName).reference() || */null;
43 40
44 return this; 41 return this;
45} 42}
46 43
47Clipperz.PM.DataModel.DirectLoginBinding.prototype = MochiKit.Base.update(null, { 44Clipperz.PM.DataModel.DirectLoginBinding.prototype = MochiKit.Base.update(null, {
48 45
49 'toString': function() { 46 'toString': function() {
50 return "DirectLoginBinding (" + this.key() + ", " + this.fieldKey() + ")"; 47 return "DirectLoginBinding (" + this.key() + ", " + this.fieldKey() + ")";
51 }, 48 },
52 49
53 //------------------------------------------------------------------------- 50 //-------------------------------------------------------------------------
54 51
55 'directLogin': function () { 52 'directLogin': function () {
56 return this._directLogin; 53 return this._directLogin;
57 }, 54 },
58 55
59 //------------------------------------------------------------------------- 56 //-------------------------------------------------------------------------
60 57
61 'key': function() { 58 'key': function() {
62 return this._key; 59 return this._key;
63 }, 60 },
64 61
65 //------------------------------------------------------------------------- 62 //-------------------------------------------------------------------------
66 63
67 'fieldKey': function() { 64 'fieldKey': function() {
68 return this._fieldKey; 65 return this._fieldKey;
69 }, 66 },
70 67
71 'setFieldKey': function(aValue) { 68 'setFieldKey': function(aValue) {
72 this._fieldKey = aValue; 69 this._fieldKey = aValue;
73 70
74 return this.directLogin().setValue('bindingData' + '.' + this.key(), aValue); 71 return this.directLogin().setValue('bindingData' + '.' + this.key(), aValue);
75 }, 72 },
76 73
77 //'fieldName': function() { 74 //'fieldName': function() {
78 // return this._fieldName; 75 // return this._fieldName;
79 //}, 76 //},
80 77
81 //------------------------------------------------------------------------- 78 //-------------------------------------------------------------------------
82 79
83 'field': function() { 80 'field': function() {
84 var deferredResult; 81 var deferredResult;
85 82
86 if (this.fieldKey() != null) { 83 if (this.fieldKey() != null) {
87 deferredResult = Clipperz.Async.callbacks("DirectLoginBinding.field [1]", [ 84 deferredResult = Clipperz.Async.callbacks("DirectLoginBinding.field [1]", [
88 MochiKit.Base.method(this.directLogin().record(), 'fields'), 85 MochiKit.Base.method(this.directLogin().record(), 'fields'),
89 MochiKit.Base.itemgetter(this.fieldKey()) 86 MochiKit.Base.itemgetter(this.fieldKey())
90 ], {trace:false}); 87 ], {trace:false});
91 // } else if (this.fieldName() != null) { 88 // } else if (this.fieldName() != null) {
92 // WTF = TODO; 89 // WTF = TODO;
93 // result = this.directLogin().record().fieldWithName(this.fieldName()); 90 // result = this.directLogin().record().fieldWithName(this.fieldName());
94 // 91 //
95 // this.setFieldKey(result.key()); 92 // this.setFieldKey(result.key());
96 } else { 93 } else {
97 deferredResult = MochiKit.Async.succeed(null); 94 deferredResult = MochiKit.Async.succeed(null);
98 } 95 }
99 96
100 return deferredResult; 97 return deferredResult;
101 }, 98 },
102 99
103 'setField': function (aField) { 100 'setField': function (aField) {
104 this.setFieldKey(aField.reference()); 101 this.setFieldKey(aField.reference());
105 }, 102 },
106 103
107 //------------------------------------------------------------------------- 104 //-------------------------------------------------------------------------
108/* 105/*
109 'fieldValue': function () { 106 'fieldValue': function () {
110 return Clipperz.Async.callbacks("DirectLoginBinding.fieldValue", [ 107 return Clipperz.Async.callbacks("DirectLoginBinding.fieldValue", [
111 MochiKit.Base.method('field'), 108 MochiKit.Base.method('field'),
112 MochiKit.Base.methodcaller('value') 109 MochiKit.Base.methodcaller('value')
113 ], {trace:false}); 110 ], {trace:false});
114 }, 111 },
115*/ 112*/
116 //------------------------------------------------------------------------- 113 //-------------------------------------------------------------------------
117 114
118 'serializedData': function() { 115 'serializedData': function() {
119 return this.fieldKey(); 116 return this.fieldKey();
120 }, 117 },
121 118
122 //------------------------------------------------------------------------- 119 //-------------------------------------------------------------------------
123 __syntaxFix__: "syntax fix" 120 __syntaxFix__: "syntax fix"
124}); 121});
125 122
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js
index 939ab4b..a461197 100644
--- a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js
@@ -1,107 +1,104 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33 30
34//############################################################################# 31//#############################################################################
35 32
36Clipperz.PM.DataModel.DirectLoginFormValue = function(aDirectLogin, args) { 33Clipperz.PM.DataModel.DirectLoginFormValue = function(aDirectLogin, args) {
37 args = args || {}; 34 args = args || {};
38 35
39 this._directLogin = aDirectLogin|| Clipperz.Base.exception.raise('MandatoryParameter'); 36 this._directLogin = aDirectLogin|| Clipperz.Base.exception.raise('MandatoryParameter');
40 37
41 this._key = args.key || Clipperz.Base.exception.raise('MandatoryParameter'); 38 this._key = args.key || Clipperz.Base.exception.raise('MandatoryParameter');
42 this._fieldOptions = args.fieldOptions|| Clipperz.Base.exception.raise('MandatoryParameter'); 39 this._fieldOptions = args.fieldOptions|| Clipperz.Base.exception.raise('MandatoryParameter');
43 this._value = args.value || null; 40 this._value = args.value || null;
44 41
45 return this; 42 return this;
46} 43}
47 44
48Clipperz.PM.DataModel.DirectLoginFormValue.prototype = MochiKit.Base.update(null, { 45Clipperz.PM.DataModel.DirectLoginFormValue.prototype = MochiKit.Base.update(null, {
49 46
50 'toString': function() { 47 'toString': function() {
51 return "DirectLoginFormValue (" + this.key() + ", " + this.value() + ")"; 48 return "DirectLoginFormValue (" + this.key() + ", " + this.value() + ")";
52 }, 49 },
53 50
54 //------------------------------------------------------------------------- 51 //-------------------------------------------------------------------------
55 52
56 'directLogin': function () { 53 'directLogin': function () {
57 return this._directLogin; 54 return this._directLogin;
58 }, 55 },
59 56
60 //------------------------------------------------------------------------- 57 //-------------------------------------------------------------------------
61 58
62 'key': function() { 59 'key': function() {
63 return this._key; 60 return this._key;
64 }, 61 },
65 62
66 //------------------------------------------------------------------------- 63 //-------------------------------------------------------------------------
67 64
68 'fieldOptions': function() { 65 'fieldOptions': function() {
69 return this._fieldOptions; 66 return this._fieldOptions;
70 }, 67 },
71 68
72 //------------------------------------------------------------------------- 69 //-------------------------------------------------------------------------
73 70
74 'type': function () { 71 'type': function () {
75 return this.fieldOptions()['type']; 72 return this.fieldOptions()['type'];
76 }, 73 },
77 74
78 //------------------------------------------------------------------------- 75 //-------------------------------------------------------------------------
79 76
80 'value': function() { 77 'value': function() {
81 varresult; 78 varresult;
82 79
83 result = this._value; 80 result = this._value;
84 81
85 // if ((result == null) && (this.type() == 'checkbox')) { 82 // if ((result == null) && (this.type() == 'checkbox')) {
86 // result = false; 83 // result = false;
87 // }; 84 // };
88 85
89 return result; 86 return result;
90 }, 87 },
91 88
92 'setValue': function (aValue) { 89 'setValue': function (aValue) {
93//console.log("DirectLoginFormValue.setValue", aValue); 90//console.log("DirectLoginFormValue.setValue", aValue);
94 this._value = aValue; 91 this._value = aValue;
95 return this.directLogin().setValue('formValues' + '.' + this.key(), aValue); 92 return this.directLogin().setValue('formValues' + '.' + this.key(), aValue);
96 }, 93 },
97 94
98 //------------------------------------------------------------------------- 95 //-------------------------------------------------------------------------
99/* 96/*
100 'serializedData': function() { 97 'serializedData': function() {
101 return this.value(); 98 return this.value();
102 }, 99 },
103*/ 100*/
104 //------------------------------------------------------------------------- 101 //-------------------------------------------------------------------------
105 __syntaxFix__: "syntax fix" 102 __syntaxFix__: "syntax fix"
106}); 103});
107 104
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js
index 673d5ee..8188389 100644
--- a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js
@@ -1,203 +1,200 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33//############################################################################# 30//#############################################################################
34 31
35Clipperz.PM.DataModel.DirectLoginInput = function(args) { 32Clipperz.PM.DataModel.DirectLoginInput = function(args) {
36 this._args = args; 33 this._args = args;
37 34
38 return this; 35 return this;
39} 36}
40 37
41Clipperz.PM.DataModel.DirectLoginInput.prototype = MochiKit.Base.update(null, { 38Clipperz.PM.DataModel.DirectLoginInput.prototype = MochiKit.Base.update(null, {
42 39
43 'args': function() { 40 'args': function() {
44 return this._args; 41 return this._args;
45 }, 42 },
46 43
47 //------------------------------------------------------------------------- 44 //-------------------------------------------------------------------------
48 45
49 'name': function() { 46 'name': function() {
50 return this.args()['name']; 47 return this.args()['name'];
51 }, 48 },
52 49
53 //------------------------------------------------------------------------- 50 //-------------------------------------------------------------------------
54 51
55 'type': function() { 52 'type': function() {
56 var result; 53 var result;
57 54
58 result = this.args()['type']; 55 result = this.args()['type'];
59 56
60 if (result != null) { 57 if (result != null) {
61 result = result.toLowerCase(); 58 result = result.toLowerCase();
62 } 59 }
63 return result; 60 return result;
64 }, 61 },
65 62
66 //------------------------------------------------------------------------- 63 //-------------------------------------------------------------------------
67 64
68 'options': function() { 65 'options': function() {
69 return this.args()['options']; 66 return this.args()['options'];
70 }, 67 },
71 68
72 //------------------------------------------------------------------------- 69 //-------------------------------------------------------------------------
73 70
74 'value': function() { 71 'value': function() {
75 return this.args()['value']; 72 return this.args()['value'];
76 }, 73 },
77 74
78 //------------------------------------------------------------------------- 75 //-------------------------------------------------------------------------
79 /* 76 /*
80 'formConfiguration': function(someFormValues, someBindings, someFields) { 77 'formConfiguration': function(someFormValues, someBindings, someFields) {
81 var result; 78 var result;
82//console.log("### DirectLoginInput.formConfiguration", someFields); 79//console.log("### DirectLoginInput.formConfiguration", someFields);
83 if (this.shouldSetValue()) { 80 if (this.shouldSetValue()) {
84 switch (this.type()) { 81 switch (this.type()) {
85 case 'select': 82 case 'select':
86 var currentValue; 83 var currentValue;
87 var options; 84 var options;
88 85
89 // currentValue = this.directLogin()._configuration['formValues'][this.name()]; 86 // currentValue = this.directLogin()._configuration['formValues'][this.name()];
90 currentValue = someFormValues[this.name()]; 87 currentValue = someFormValues[this.name()];
91 options = this.args()['options']; 88 options = this.args()['options'];
92 89
93 result = MochiKit.DOM.SELECT({name:this.name()}, 90 result = MochiKit.DOM.SELECT({name:this.name()},
94 MochiKit.Base.map(function(anOption) { 91 MochiKit.Base.map(function(anOption) {
95 var options; 92 var options;
96 93
97 options = {value:anOption['value']}; 94 options = {value:anOption['value']};
98 if (currentValue == anOption['value']) { 95 if (currentValue == anOption['value']) {
99 options.selected = true; 96 options.selected = true;
100 } 97 }
101 98
102 return MochiKit.DOM.OPTION(options, anOption['label']) 99 return MochiKit.DOM.OPTION(options, anOption['label'])
103 }, options) 100 }, options)
104 ) 101 )
105 break; 102 break;
106 case 'checkbox': 103 case 'checkbox':
107 var options; 104 var options;
108 105
109 options = {type:'checkbox', name: this.name()}; 106 options = {type:'checkbox', name: this.name()};
110 // if (this.directLogin()._configuration['formValues'][this.name()] == true) { 107 // if (this.directLogin()._configuration['formValues'][this.name()] == true) {
111 if (someFormValues[this.name()] == true) { 108 if (someFormValues[this.name()] == true) {
112 options['checked'] = true; 109 options['checked'] = true;
113 }; 110 };
114 111
115 result = MochiKit.DOM.INPUT(options, null); 112 result = MochiKit.DOM.INPUT(options, null);
116 break; 113 break;
117 case 'radio': 114 case 'radio':
118 var currentName; 115 var currentName;
119 var currentValue; 116 var currentValue;
120 var options; 117 var options;
121 118
122 currentName = this.name(); 119 currentName = this.name();
123 // currentValue = this.directLogin()._configuration['formValues'][this.name()]; 120 // currentValue = this.directLogin()._configuration['formValues'][this.name()];
124 currentValue = someFormValues[this.name()]; 121 currentValue = someFormValues[this.name()];
125 options = this.args()['options']; 122 options = this.args()['options'];
126 123
127 result = MochiKit.DOM.DIV(null, 124 result = MochiKit.DOM.DIV(null,
128 MochiKit.Base.map(function(anOption) { 125 MochiKit.Base.map(function(anOption) {
129 var options; 126 var options;
130 var isChecked; 127 var isChecked;
131 var inputNode; 128 var inputNode;
132 var divNode; 129 var divNode;
133 130
134 options = {type:'radio', name:currentName, value:anOption['value']} 131 options = {type:'radio', name:currentName, value:anOption['value']}
135 isChecked = (currentValue == anOption['value']); 132 isChecked = (currentValue == anOption['value']);
136 if (isChecked) { 133 if (isChecked) {
137 options.checked = true; 134 options.checked = true;
138 } 135 }
139 136
140 if (Clipperz_IEisBroken == true) { 137 if (Clipperz_IEisBroken == true) {
141 var checkedValue; 138 var checkedValue;
142 139
143 checkedValue = (isChecked ? " CHECKED" : ""); 140 checkedValue = (isChecked ? " CHECKED" : "");
144 inputNode = MochiKit.DOM.currentDocument().createElement("<INPUT TYPE='RADIO' NAME='" + currentName + "' VALUE='" + anOption['value'] + "'" + checkedValue + ">"); 141 inputNode = MochiKit.DOM.currentDocument().createElement("<INPUT TYPE='RADIO' NAME='" + currentName + "' VALUE='" + anOption['value'] + "'" + checkedValue + ">");
145 } else { 142 } else {
146 inputNode = MochiKit.DOM.INPUT(options, anOption['value']); 143 inputNode = MochiKit.DOM.INPUT(options, anOption['value']);
147 } 144 }
148 divNode = MochiKit.DOM.DIV(null, inputNode); 145 divNode = MochiKit.DOM.DIV(null, inputNode);
149 146
150 return divNode; 147 return divNode;
151 }, options) 148 }, options)
152 ); 149 );
153 break; 150 break;
154 } 151 }
155 } else { 152 } else {
156 var binding; 153 var binding;
157 // binding = this.directLogin().bindings()[this.name()]; 154 // binding = this.directLogin().bindings()[this.name()];
158 binding = someBindings[this.name()]; 155 binding = someBindings[this.name()];
159 156
160//console.log("### binding", binding); 157//console.log("### binding", binding);
161//if (binding != null) { 158//if (binding != null) {
162 ///console.log(" binding.field()", binding.field()); 159 ///console.log(" binding.field()", binding.field());
163 ///console.log(" binding.field().value()", binding.field().value()); 160 ///console.log(" binding.field().value()", binding.field().value());
164 //console.log(" someFields[binding.fieldKey()].value()", someFields[binding.fieldKey()].value()); 161 //console.log(" someFields[binding.fieldKey()].value()", someFields[binding.fieldKey()].value());
165//} 162//}
166 result = MochiKit.DOM.INPUT({ 163 result = MochiKit.DOM.INPUT({
167 type:((this.type() != 'password') ? this.type() : 'text'), 164 type:((this.type() != 'password') ? this.type() : 'text'),
168 name:this.name(), 165 name:this.name(),
169 // value:((binding != null)? binding.field().value() : this.value()) 166 // value:((binding != null)? binding.field().value() : this.value())
170 value:((binding != null)? someFields[binding.fieldKey()]['value'] : this.value()) 167 value:((binding != null)? someFields[binding.fieldKey()]['value'] : this.value())
171 // value:((binding != null)? someFields[binding.fieldKey()].value() : this.value()) 168 // value:((binding != null)? someFields[binding.fieldKey()].value() : this.value())
172 }, null); 169 }, null);
173 } 170 }
174 171
175 return result; 172 return result;
176 }, 173 },
177 */ 174 */
178 //------------------------------------------------------------------------- 175 //-------------------------------------------------------------------------
179 176
180 'needsFormValue': function() { 177 'needsFormValue': function() {
181 var type; 178 var type;
182 var result; 179 var result;
183 180
184 type = this.type(); 181 type = this.type();
185 result = ((type == 'checkbox') || (type == 'radio') || (type == 'select')); 182 result = ((type == 'checkbox') || (type == 'radio') || (type == 'select'));
186 183
187 return result; 184 return result;
188 }, 185 },
189 186
190 'needsBinding': function() { 187 'needsBinding': function() {
191 var type; 188 var type;
192 var result; 189 var result;
193 190
194 type = this.type(); 191 type = this.type();
195 result = ((type == 'text') || (type == 'password')); 192 result = ((type == 'text') || (type == 'password'));
196 193
197 return result; 194 return result;
198 }, 195 },
199 196
200 //------------------------------------------------------------------------- 197 //-------------------------------------------------------------------------
201 __syntaxFix__: "syntax fix" 198 __syntaxFix__: "syntax fix"
202}); 199});
203 200
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js b/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js
index 3408b08..cdeec8b 100644
--- a/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js
@@ -1,216 +1,213 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29try { if (typeof(Clipperz.KeyValueObjectStore) == 'undefined') { throw ""; }} catch (e) { 26try { if (typeof(Clipperz.KeyValueObjectStore) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.PM.DataModel.EncryptedRemoteObject depends on Clipperz.KeyValueObjectStore!"; 27 throw "Clipperz.PM.DataModel.EncryptedRemoteObject depends on Clipperz.KeyValueObjectStore!";
31} 28}
32 29
33if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
34if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
35 32
36Clipperz.PM.DataModel.EncryptedRemoteObject = function(args) { 33Clipperz.PM.DataModel.EncryptedRemoteObject = function(args) {
37 args = args || {}; 34 args = args || {};
38 35
39 this._name = args.name || null; 36 this._name = args.name || null;
40 this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); 37 this._reference = args.reference || Clipperz.PM.Crypto.randomKey();
41 this._isBrandNew = ((args.reference == null) && (args.remoteData == null)); 38 this._isBrandNew = ((args.reference == null) && (args.remoteData == null));
42 39
43 if ((this._isBrandNew == false) && (args['retrieveKeyFunction'] == null)) { 40 if ((this._isBrandNew == false) && (args['retrieveKeyFunction'] == null)) {
44 Clipperz.Base.exception.raise('MandatoryParameter'); 41 Clipperz.Base.exception.raise('MandatoryParameter');
45 } else { 42 } else {
46 this._retrieveKeyFunction = args['retrieveKeyFunction']; 43 this._retrieveKeyFunction = args['retrieveKeyFunction'];
47 } 44 }
48 45
49 this._retrieveRemoteDataFunction = args.retrieveRemoteDataFunction|| null; 46 this._retrieveRemoteDataFunction = args.retrieveRemoteDataFunction|| null;
50 this._remoteData = args.remoteData || null; 47 this._remoteData = args.remoteData || null;
51 // this._remoteData = args.remoteData ? Clipperz.Base.deepClone(args.remoteData) : null; 48 // this._remoteData = args.remoteData ? Clipperz.Base.deepClone(args.remoteData) : null;
52 if ((!this._isBrandNew) && ((this._retrieveRemoteDataFunction == null) && (this._remoteData == null))) { 49 if ((!this._isBrandNew) && ((this._retrieveRemoteDataFunction == null) && (this._remoteData == null))) {
53 Clipperz.Base.exception.raise('MandatoryParameter'); 50 Clipperz.Base.exception.raise('MandatoryParameter');
54 } 51 }
55 52
56 53
57 this._encryptedDataKeypath = args.encryptedDataKeypath || 'data'; //Clipperz.Base.exception.raise('MandatoryParameter'); 54 this._encryptedDataKeypath = args.encryptedDataKeypath || 'data'; //Clipperz.Base.exception.raise('MandatoryParameter');
58 this._encryptedVersionKeypath = args.encryptedVersionKeypath || 'version';//Clipperz.Base.exception.raise('MandatoryParameter'); 55 this._encryptedVersionKeypath = args.encryptedVersionKeypath || 'version';//Clipperz.Base.exception.raise('MandatoryParameter');
59 56
60 57
61 this._transientState = null; 58 this._transientState = null;
62 this._deferredLocks = {}; 59 this._deferredLocks = {};
63 60
64 if (this._isBrandNew == true) { 61 if (this._isBrandNew == true) {
65 this._objectDataStore = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.objectDataStore [1]'}*/); 62 this._objectDataStore = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.objectDataStore [1]'}*/);
66 } else { 63 } else {
67 this._objectDataStore = null; 64 this._objectDataStore = null;
68 } 65 }
69 66
70 return this; 67 return this;
71} 68}
72 69
73// 70//
74 // Basic data workflow 71 // Basic data workflow
75 //======================= 72 //=======================
76// 73//
77 //getRemoteData 74 //getRemoteData
78 // unpackRemoteData 75 // unpackRemoteData
79 // getDecryptData [encryptedDataKeypath, encryptedVersionKeypath] 76 // getDecryptData [encryptedDataKeypath, encryptedVersionKeypath]
80 // unpackData 77 // unpackData
81 // 78 //
82 // 79 //
83 // ?? packData 80 // ?? packData
84 // ?? encryptDataWithKey 81 // ?? encryptDataWithKey
85 // ??packRemoteData [encryptedDataKeypath (?), encryptedVersionKeypath (?)] 82 // ??packRemoteData [encryptedDataKeypath (?), encryptedVersionKeypath (?)]
86// 83//
87 84
88Clipperz.PM.DataModel.EncryptedRemoteObject.prototype = MochiKit.Base.update(null, { 85Clipperz.PM.DataModel.EncryptedRemoteObject.prototype = MochiKit.Base.update(null, {
89 86
90 'toString': function () { 87 'toString': function () {
91 return "Clipperz.PM.DataModel.EncryptedRemoteObject" + (this.name() != null ? " - " + this.name() : ""); 88 return "Clipperz.PM.DataModel.EncryptedRemoteObject" + (this.name() != null ? " - " + this.name() : "");
92 }, 89 },
93 90
94 //------------------------------------------------------------------------- 91 //-------------------------------------------------------------------------
95 92
96 'name': function () { 93 'name': function () {
97 return this._name; 94 return this._name;
98 }, 95 },
99 96
100 //------------------------------------------------------------------------- 97 //-------------------------------------------------------------------------
101 98
102 'reference': function () { 99 'reference': function () {
103 return this._reference; 100 return this._reference;
104 }, 101 },
105 102
106 'setReference': function (aValue) { 103 'setReference': function (aValue) {
107 this._reference = aValue; 104 this._reference = aValue;
108 105
109 return this._reference; 106 return this._reference;
110 }, 107 },
111 108
112 //------------------------------------------------------------------------- 109 //-------------------------------------------------------------------------
113 110
114 'transientState': function () { 111 'transientState': function () {
115 if (this._transientState == null) { 112 if (this._transientState == null) {
116 this._transientState = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.transientState [2]'}*/); 113 this._transientState = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.transientState [2]'}*/);
117 } 114 }
118 115
119 return this._transientState; 116 return this._transientState;
120 }, 117 },
121 118
122 'resetTransientState': function (isCommitting) { 119 'resetTransientState': function (isCommitting) {
123 if (this._transientState != null) { 120 if (this._transientState != null) {
124 this._transientState.removeAllData(); 121 this._transientState.removeAllData();
125 } 122 }
126 123
127 this._transientState = null; 124 this._transientState = null;
128 }, 125 },
129 126
130 //------------------------------------------------------------------------- 127 //-------------------------------------------------------------------------
131 128
132 'isBrandNew': function () { 129 'isBrandNew': function () {
133 return this._isBrandNew; 130 return this._isBrandNew;
134 }, 131 },
135 132
136 //------------------------------------------------------------------------- 133 //-------------------------------------------------------------------------
137 134
138 'getKey': function () { 135 'getKey': function () {
139 var deferredResult; 136 var deferredResult;
140 var deferredLock; 137 var deferredLock;
141 138
142 deferredLock = this.getDeferredLockForKey('key'); 139 deferredLock = this.getDeferredLockForKey('key');
143 140
144 deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.getKey", {trace:false}); 141 deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.getKey", {trace:false});
145 deferredResult.acquireLock(deferredLock); 142 deferredResult.acquireLock(deferredLock);
146 deferredResult.addMethod( 143 deferredResult.addMethod(
147 this.decryptedDataStore(), 144 this.decryptedDataStore(),
148 'deferredGetOrSet', 145 'deferredGetOrSet',
149 'decryptionKey', 146 'decryptionKey',
150 MochiKit.Base.partial(this.retrieveKeyFunction(), this.reference()) 147 MochiKit.Base.partial(this.retrieveKeyFunction(), this.reference())
151 ); 148 );
152 deferredResult.releaseLock(deferredLock); 149 deferredResult.releaseLock(deferredLock);
153 deferredResult.callback(); 150 deferredResult.callback();
154 151
155 return deferredResult; 152 return deferredResult;
156 }, 153 },
157 154
158 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
159 156
160 'retrieveKeyFunction': function () { 157 'retrieveKeyFunction': function () {
161 return this._retrieveKeyFunction; 158 return this._retrieveKeyFunction;
162 }, 159 },
163 160
164 'setRetrieveKeyFunction': function (aFunction) { 161 'setRetrieveKeyFunction': function (aFunction) {
165 this._retrieveKeyFunction = aFunction; 162 this._retrieveKeyFunction = aFunction;
166 }, 163 },
167 164
168 //------------------------------------------------------------------------- 165 //-------------------------------------------------------------------------
169 166
170 'hasLoadedRemoteData': function () { 167 'hasLoadedRemoteData': function () {
171 return (this._remoteData != null); 168 return (this._remoteData != null);
172 }, 169 },
173 170
174 'getRemoteData': function () { 171 'getRemoteData': function () {
175 var deferredResult; 172 var deferredResult;
176 vardeferredLock; 173 vardeferredLock;
177 174
178 deferredLock = this.getDeferredLockForKey('remoteData'); 175 deferredLock = this.getDeferredLockForKey('remoteData');
179 176
180 deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObjects.getRemoteData", {trace:false}); 177 deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObjects.getRemoteData", {trace:false});
181 deferredResult.acquireLock(deferredLock); 178 deferredResult.acquireLock(deferredLock);
182 deferredResult.addCallback(MochiKit.Base.bind(function () { 179 deferredResult.addCallback(MochiKit.Base.bind(function () {
183 var innerDeferredResult; 180 var innerDeferredResult;
184 181
185 if (this._remoteData != null) { 182 if (this._remoteData != null) {
186 innerDeferredResult = MochiKit.Async.succeed(this._remoteData); 183 innerDeferredResult = MochiKit.Async.succeed(this._remoteData);
187 } else { 184 } else {
188 innerDeferredResult = Clipperz.Async.callbacks("EncryptedRemoteObjects.getRemoteData <inner deferred>", [ 185 innerDeferredResult = Clipperz.Async.callbacks("EncryptedRemoteObjects.getRemoteData <inner deferred>", [
189 MochiKit.Base.partial(this.retrieveRemoteDataFunction(), this.reference()), 186 MochiKit.Base.partial(this.retrieveRemoteDataFunction(), this.reference()),
190 MochiKit.Base.method(this, 'unpackRemoteData'), 187 MochiKit.Base.method(this, 'unpackRemoteData'),
191 MochiKit.Base.bind(function (someData) { 188 MochiKit.Base.bind(function (someData) {
192 this._remoteData = someData; 189 this._remoteData = someData;
193 return this._remoteData; 190 return this._remoteData;
194 }, this) 191 }, this)
195 ], {trace:false}); 192 ], {trace:false});
196 } 193 }
197 194
198 return innerDeferredResult; 195 return innerDeferredResult;
199 }, this)) 196 }, this))
200 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); 197 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
201 deferredResult.releaseLock(deferredLock); 198 deferredResult.releaseLock(deferredLock);
202 199
203 deferredResult.callback(); 200 deferredResult.callback();
204 201
205 return deferredResult; 202 return deferredResult;
206 }, 203 },
207 204
208 //------------------------------------------------------------------------- 205 //-------------------------------------------------------------------------
209 206
210 'unpackRemoteData': function (someData) { 207 'unpackRemoteData': function (someData) {
211 return MochiKit.Async.succeed(someData); 208 return MochiKit.Async.succeed(someData);
212 }, 209 },
213 210
214 //......................................................................... 211 //.........................................................................
215 212
216 'packRemoteData': function (someData) { 213 'packRemoteData': function (someData) {
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js b/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js
index 9f1c197..834e21b 100644
--- a/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js
@@ -1,216 +1,213 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33 30
34//############################################################################# 31//#############################################################################
35 32
36Clipperz.PM.DataModel.OneTimePassword = function(args) { 33Clipperz.PM.DataModel.OneTimePassword = function(args) {
37 args = args || {}; 34 args = args || {};
38 35
39 //this._user = args['user']; 36 //this._user = args['user'];
40 this._reference = args['reference']|| Clipperz.PM.Crypto.randomKey(); 37 this._reference = args['reference']|| Clipperz.PM.Crypto.randomKey();
41 this._password = args['password']; 38 this._password = args['password'];
42 this._passwordValue = Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword(args['password']); 39 this._passwordValue = Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword(args['password']);
43 this._creationDate = args['created'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['created']) : new Date(); 40 this._creationDate = args['created'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['created']) : new Date();
44 this._usageDate = args['used'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['used']) : null; 41 this._usageDate = args['used'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['used']) : null;
45 42
46 this._status = args['status'] || 'ACTIVE'; //'REQUESTED', 'USED', 'DISABLED' 43 this._status = args['status'] || 'ACTIVE'; //'REQUESTED', 'USED', 'DISABLED'
47 this._connectionInfo= null; 44 this._connectionInfo= null;
48 45
49 this._key = null; 46 this._key = null;
50 this._keyChecksum= null; 47 this._keyChecksum= null;
51 48
52 return this; 49 return this;
53} 50}
54 51
55Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, { 52Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, {
56 53
57 'toString': function() { 54 'toString': function() {
58 return "Clipperz.PM.DataModel.OneTimePassword"; 55 return "Clipperz.PM.DataModel.OneTimePassword";
59 }, 56 },
60/* 57/*
61 //------------------------------------------------------------------------- 58 //-------------------------------------------------------------------------
62 59
63 'user': function() { 60 'user': function() {
64 return this._user; 61 return this._user;
65 }, 62 },
66 63
67 //------------------------------------------------------------------------- 64 //-------------------------------------------------------------------------
68 65
69 'password': function() { 66 'password': function() {
70 return this._password; 67 return this._password;
71 }, 68 },
72 69
73 //------------------------------------------------------------------------- 70 //-------------------------------------------------------------------------
74 71
75 'passwordValue': function() { 72 'passwordValue': function() {
76 return this._passwordValue; 73 return this._passwordValue;
77 }, 74 },
78 75
79 //------------------------------------------------------------------------- 76 //-------------------------------------------------------------------------
80 77
81 'creationDate': function() { 78 'creationDate': function() {
82 return this._creationDate; 79 return this._creationDate;
83 }, 80 },
84 81
85 //------------------------------------------------------------------------- 82 //-------------------------------------------------------------------------
86 83
87 'reference': function() { 84 'reference': function() {
88 return this._reference; 85 return this._reference;
89 }, 86 },
90 87
91 //------------------------------------------------------------------------- 88 //-------------------------------------------------------------------------
92 89
93 'key': function() { 90 'key': function() {
94 if (this._key == null) { 91 if (this._key == null) {
95 this._key = Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(this.user().username(), this.passwordValue()); 92 this._key = Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(this.user().username(), this.passwordValue());
96 } 93 }
97 94
98 return this._key; 95 return this._key;
99 }, 96 },
100 97
101 //------------------------------------------------------------------------- 98 //-------------------------------------------------------------------------
102 99
103 'keyChecksum': function() { 100 'keyChecksum': function() {
104 if (this._keyChecksum == null) { 101 if (this._keyChecksum == null) {
105 this._keyChecksum = Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(this.user().username(), this.passwordValue()); 102 this._keyChecksum = Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(this.user().username(), this.passwordValue());
106 } 103 }
107 104
108 return this._keyChecksum; 105 return this._keyChecksum;
109 }, 106 },
110*/ 107*/
111 //------------------------------------------------------------------------- 108 //-------------------------------------------------------------------------
112 109
113 'status': function() { 110 'status': function() {
114 return this._status; 111 return this._status;
115 }, 112 },
116 113
117 'setStatus': function(aValue) { 114 'setStatus': function(aValue) {
118 this._status = aValue; 115 this._status = aValue;
119 }, 116 },
120 117
121 //------------------------------------------------------------------------- 118 //-------------------------------------------------------------------------
122/* 119/*
123 'serializedData': function() { 120 'serializedData': function() {
124 var result; 121 var result;
125 122
126 result = { 123 result = {
127 'password': this.password(), 124 'password': this.password(),
128 'created': this.creationDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.creationDate()) : null, 125 'created': this.creationDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.creationDate()) : null,
129 'used': this.usageDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.usageDate()) : null, 126 'used': this.usageDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.usageDate()) : null,
130 'status': this.status() 127 'status': this.status()
131 }; 128 };
132 129
133 return result; 130 return result;
134 }, 131 },
135 132
136 //------------------------------------------------------------------------- 133 //-------------------------------------------------------------------------
137 134
138 'packedPassphrase': function() { 135 'packedPassphrase': function() {
139 var result; 136 var result;
140 var packedPassphrase; 137 var packedPassphrase;
141 var encodedPassphrase; 138 var encodedPassphrase;
142 varprefixPadding; 139 varprefixPadding;
143 var suffixPadding; 140 var suffixPadding;
144 var getRandomBytes; 141 var getRandomBytes;
145 142
146 getRandomBytes = MochiKit.Base.method(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'getRandomBytes'); 143 getRandomBytes = MochiKit.Base.method(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'getRandomBytes');
147 144
148 encodedPassphrase = new Clipperz.ByteArray(this.user().passphrase()).toBase64String(); 145 encodedPassphrase = new Clipperz.ByteArray(this.user().passphrase()).toBase64String();
149//MochiKit.Logging.logDebug("--- encodedPassphrase.length: " + encodedPassphrase.length); 146//MochiKit.Logging.logDebug("--- encodedPassphrase.length: " + encodedPassphrase.length);
150 prefixPadding = getRandomBytes(getRandomBytes(1).byteAtIndex(0)).toBase64String(); 147 prefixPadding = getRandomBytes(getRandomBytes(1).byteAtIndex(0)).toBase64String();
151//MochiKit.Logging.logDebug("--- prefixPadding.length: " + prefixPadding.length); 148//MochiKit.Logging.logDebug("--- prefixPadding.length: " + prefixPadding.length);
152 suffixPadding = getRandomBytes((500 - prefixPadding.length - encodedPassphrase.length) * 6 / 8).toBase64String(); 149 suffixPadding = getRandomBytes((500 - prefixPadding.length - encodedPassphrase.length) * 6 / 8).toBase64String();
153//MochiKit.Logging.logDebug("--- suffixPadding.length: " + suffixPadding.length); 150//MochiKit.Logging.logDebug("--- suffixPadding.length: " + suffixPadding.length);
154//MochiKit.Logging.logDebug("--- total.length: " + (prefixPadding.length + encodedPassphrase.length + suffixPadding.length)); 151//MochiKit.Logging.logDebug("--- total.length: " + (prefixPadding.length + encodedPassphrase.length + suffixPadding.length));
155 152
156 packedPassphrase = { 153 packedPassphrase = {
157 'prefix': prefixPadding, 154 'prefix': prefixPadding,
158 'passphrase': encodedPassphrase, 155 'passphrase': encodedPassphrase,
159 'suffix': suffixPadding 156 'suffix': suffixPadding
160 }; 157 };
161 158
162 // result = Clipperz.Base.serializeJSON(packedPassphrase); 159 // result = Clipperz.Base.serializeJSON(packedPassphrase);
163 result = packedPassphrase; 160 result = packedPassphrase;
164//MochiKit.Logging.logDebug("===== OTP packedPassprase: [" + result.length + "]" + result); 161//MochiKit.Logging.logDebug("===== OTP packedPassprase: [" + result.length + "]" + result);
165//MochiKit.Logging.logDebug("<<< OneTimePassword.packedPassphrase"); 162//MochiKit.Logging.logDebug("<<< OneTimePassword.packedPassphrase");
166 163
167 return result; 164 return result;
168 }, 165 },
169 166
170 //------------------------------------------------------------------------- 167 //-------------------------------------------------------------------------
171 168
172 'encryptedPackedPassphrase': function() { 169 'encryptedPackedPassphrase': function() {
173 return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(this.passwordValue(), this.packedPassphrase()) 170 return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(this.passwordValue(), this.packedPassphrase())
174 }, 171 },
175 172
176 //------------------------------------------------------------------------- 173 //-------------------------------------------------------------------------
177 174
178 'encryptedData': function() { 175 'encryptedData': function() {
179 var deferredResult; 176 var deferredResult;
180 varresult; 177 varresult;
181 178
182//MochiKit.Logging.logDebug(">>> OneTimePassword.encryptedData"); 179//MochiKit.Logging.logDebug(">>> OneTimePassword.encryptedData");
183//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - id: " + this.reference()); 180//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - id: " + this.reference());
184 result = { 181 result = {
185 'reference': this.reference(), 182 'reference': this.reference(),
186 'key': this.key(), 183 'key': this.key(),
187 'keyChecksum': this.keyChecksum(), 184 'keyChecksum': this.keyChecksum(),
188 'data': "", 185 'data': "",
189 'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion 186 'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion
190 } 187 }
191//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 2: " + Clipperz.Base.serializeJSON(result)); 188//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 2: " + Clipperz.Base.serializeJSON(result));
192 deferredResult = new MochiKit.Async.Deferred(); 189 deferredResult = new MochiKit.Async.Deferred();
193//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 3"); 190//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 3");
194//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 1: " + res); return res;}); 191//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 1: " + res); return res;});
195 //# deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion, this.passwordValue(), this.packedPassphrase()); 192 //# deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion, this.passwordValue(), this.packedPassphrase());
196 deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedPackedPassphrase')); 193 deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedPackedPassphrase'));
197//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 4"); 194//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 4");
198//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 2: [" + res.length + "]" + res); return res;}); 195//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 2: [" + res.length + "]" + res); return res;});
199 deferredResult.addCallback(function(aResult, res) { 196 deferredResult.addCallback(function(aResult, res) {
200 aResult['data'] = res; 197 aResult['data'] = res;
201 return aResult; 198 return aResult;
202 }, result); 199 }, result);
203//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 5"); 200//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 5");
204//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 3: " + Clipperz.Base.serializeJSON(res)); return res;}); 201//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 3: " + Clipperz.Base.serializeJSON(res)); return res;});
205 deferredResult.callback(); 202 deferredResult.callback();
206//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 6"); 203//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 6");
207 204
208 return deferredResult; 205 return deferredResult;
209 }, 206 },
210 207
211 //------------------------------------------------------------------------- 208 //-------------------------------------------------------------------------
212 209
213 'saveChanges': function() { 210 'saveChanges': function() {
214 var deferredResult; 211 var deferredResult;
215 varresult; 212 varresult;
216 213
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 147aa7d..f51bbc2 100644
--- a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js
@@ -1,167 +1,164 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29try { if (typeof(Clipperz.PM.DataModel.Record.Version) == 'undefined') { throw ""; }} catch (e) { 26try { if (typeof(Clipperz.PM.DataModel.Record.Version) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.PM.DataModel.Record.Version.Field depends on Clipperz.PM.DataModel.Record.Version!"; 27 throw "Clipperz.PM.DataModel.Record.Version.Field depends on Clipperz.PM.DataModel.Record.Version!";
31} 28}
32 29
33Clipperz.PM.DataModel.Record.Version.Field = function(args) { 30Clipperz.PM.DataModel.Record.Version.Field = function(args) {
34 Clipperz.PM.DataModel.Record.Version.Field.superclass.constructor.apply(this, arguments); 31 Clipperz.PM.DataModel.Record.Version.Field.superclass.constructor.apply(this, arguments);
35 32
36 this._recordVersion = args.recordVersion|| Clipperz.Base.exception.raise('MandatoryParameter'); 33 this._recordVersion = args.recordVersion|| Clipperz.Base.exception.raise('MandatoryParameter');
37 this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); 34 this._reference = args.reference || Clipperz.PM.Crypto.randomKey();
38 35
39 return this; 36 return this;
40} 37}
41 38
42 39
43Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version.Field, Object, { 40Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version.Field, Object, {
44 41
45 'toString': function() { 42 'toString': function() {
46 return "Record.Version.Field (" + this.reference() + ")"; 43 return "Record.Version.Field (" + this.reference() + ")";
47 }, 44 },
48 45
49 //------------------------------------------------------------------------- 46 //-------------------------------------------------------------------------
50 47
51 'recordVersion': function () { 48 'recordVersion': function () {
52 return this._recordVersion; 49 return this._recordVersion;
53 }, 50 },
54 51
55 //------------------------------------------------------------------------- 52 //-------------------------------------------------------------------------
56 53
57 'reference': function () { 54 'reference': function () {
58 return this._reference; 55 return this._reference;
59 }, 56 },
60 57
61 //------------------------------------------------------------------------- 58 //-------------------------------------------------------------------------
62 59
63 'getItem': function (aKey) { 60 'getItem': function (aKey) {
64 return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.getItem", [ 61 return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.getItem", [
65 MochiKit.Base.method(this, 'recordVersion'), 62 MochiKit.Base.method(this, 'recordVersion'),
66 MochiKit.Base.methodcaller('getValue', 'fields' + '.' + this.reference() + '.' + aKey) 63 MochiKit.Base.methodcaller('getValue', 'fields' + '.' + this.reference() + '.' + aKey)
67 ], {trace:false}); 64 ], {trace:false});
68 }, 65 },
69 66
70 'setItem': function (aKey, aValue) { 67 'setItem': function (aKey, aValue) {
71 return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.getItem", [ 68 return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.getItem", [
72 MochiKit.Base.method(this, 'recordVersion'), 69 MochiKit.Base.method(this, 'recordVersion'),
73 MochiKit.Base.methodcaller('setValue', 'fields' + '.' + this.reference() + '.' + aKey, aValue) 70 MochiKit.Base.methodcaller('setValue', 'fields' + '.' + this.reference() + '.' + aKey, aValue)
74 ], {trace:false}); 71 ], {trace:false});
75 }, 72 },
76 73
77 //------------------------------------------------------------------------- 74 //-------------------------------------------------------------------------
78 75
79 'label': function () { 76 'label': function () {
80 return this.getItem('label'); 77 return this.getItem('label');
81 }, 78 },
82 79
83 'setLabel': function (aValue) { 80 'setLabel': function (aValue) {
84 return this.setItem('label', aValue); 81 return this.setItem('label', aValue);
85 }, 82 },
86 83
87 //------------------------------------------------------------------------- 84 //-------------------------------------------------------------------------
88 85
89 'value': function () { 86 'value': function () {
90 return this.getItem('value'); 87 return this.getItem('value');
91 }, 88 },
92 89
93 'setValue': function (aValue) { 90 'setValue': function (aValue) {
94 return this.setItem('value', aValue); 91 return this.setItem('value', aValue);
95 }, 92 },
96 93
97 //------------------------------------------------------------------------- 94 //-------------------------------------------------------------------------
98 95
99 'actionType': function () { 96 'actionType': function () {
100 return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.actionType", [ 97 return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.actionType", [
101 Clipperz.Async.collectResults("Clipperz.PM.DataModel.Record.Version.Field.actionType [collect results]", { 98 Clipperz.Async.collectResults("Clipperz.PM.DataModel.Record.Version.Field.actionType [collect results]", {
102 'isHidden':MochiKit.Base.method(this, 'isHidden'), 99 'isHidden':MochiKit.Base.method(this, 'isHidden'),
103 'value':MochiKit.Base.method(this, 'value') 100 'value':MochiKit.Base.method(this, 'value')
104 }, {trace:false}), 101 }, {trace:false}),
105 function (someValues) { 102 function (someValues) {
106 var result; //'NONE', 'URL', 'EMAIL', 'PASSWORD' 103 var result; //'NONE', 'URL', 'EMAIL', 'PASSWORD'
107 104
108 result = 'NONE'; 105 result = 'NONE';
109 106
110 if (someValues['isHidden']) { 107 if (someValues['isHidden']) {
111 result = 'PASSWORD'; 108 result = 'PASSWORD';
112 } else if (Clipperz.Base.isUrl(someValues['value'])) { 109 } else if (Clipperz.Base.isUrl(someValues['value'])) {
113 result = 'URL' 110 result = 'URL'
114 } else if (Clipperz.Base.isEmail(someValues['value'])) { 111 } else if (Clipperz.Base.isEmail(someValues['value'])) {
115 result = 'EMAIL' 112 result = 'EMAIL'
116 }; 113 };
117 114
118 return result; 115 return result;
119 } 116 }
120 ], {trace:false}); 117 ], {trace:false});
121 }, 118 },
122 119
123 //------------------------------------------------------------------------- 120 //-------------------------------------------------------------------------
124 121
125 'isHidden': function () { 122 'isHidden': function () {
126 return this.getItem('hidden'); 123 return this.getItem('hidden');
127 }, 124 },
128 125
129 'setIsHidden': function (aValue) { 126 'setIsHidden': function (aValue) {
130 return this.setItem('hidden', aValue); 127 return this.setItem('hidden', aValue);
131 }, 128 },
132 129
133 //------------------------------------------------------------------------- 130 //-------------------------------------------------------------------------
134 131
135 'isEmpty': function () { 132 'isEmpty': function () {
136 var deferredResult; 133 var deferredResult;
137 134
138 deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.Field.isEmpty", {trace:false}); 135 deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.Field.isEmpty", {trace:false});
139 136
140 deferredResult.collectResults({ 137 deferredResult.collectResults({
141 'label': [ 138 'label': [
142 MochiKit.Base.method(this, 'label'), 139 MochiKit.Base.method(this, 'label'),
143 MochiKit.Base.partial(MochiKit.Base.operator.eq, '') 140 MochiKit.Base.partial(MochiKit.Base.operator.eq, '')
144 ], 141 ],
145 'value': [ 142 'value': [
146 MochiKit.Base.method(this, 'value'), 143 MochiKit.Base.method(this, 'value'),
147 MochiKit.Base.partial(MochiKit.Base.operator.eq, '') 144 MochiKit.Base.partial(MochiKit.Base.operator.eq, '')
148 ], 145 ],
149 'isHidden': [ 146 'isHidden': [
150 MochiKit.Base.method(this, 'isHidden'), 147 MochiKit.Base.method(this, 'isHidden'),
151 MochiKit.Base.partial(MochiKit.Base.operator.eq, false) 148 MochiKit.Base.partial(MochiKit.Base.operator.eq, false)
152 ] 149 ]
153 }); 150 });
154 deferredResult.addCallback(MochiKit.Base.values); 151 deferredResult.addCallback(MochiKit.Base.values);
155 deferredResult.addCallback(function(someValues) { 152 deferredResult.addCallback(function(someValues) {
156 return MochiKit.Iter.every(someValues, MochiKit.Base.operator.identity); 153 return MochiKit.Iter.every(someValues, MochiKit.Base.operator.identity);
157 }); 154 });
158 deferredResult.callback(); 155 deferredResult.callback();
159 156
160 return deferredResult; 157 return deferredResult;
161 }, 158 },
162 159
163 //------------------------------------------------------------------------- 160 //-------------------------------------------------------------------------
164 __syntaxFix__: "syntax fix" 161 __syntaxFix__: "syntax fix"
165}); 162});
166 163
167 164
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js
index 6e50f8e..dd35fc9 100644
--- a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js
@@ -1,216 +1,213 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29try { if (typeof(Clipperz.PM.DataModel.Record) == 'undefined') { throw ""; }} catch (e) { 26try { if (typeof(Clipperz.PM.DataModel.Record) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.PM.DataModel.Record.Version depends on Clipperz.PM.DataModel.Record!"; 27 throw "Clipperz.PM.DataModel.Record.Version depends on Clipperz.PM.DataModel.Record!";
31} 28}
32 29
33Clipperz.PM.DataModel.Record.Version = function(args) { 30Clipperz.PM.DataModel.Record.Version = function(args) {
34//console.log(">>> Record.new"); 31//console.log(">>> Record.new");
35 Clipperz.PM.DataModel.Record.Version.superclass.constructor.apply(this, arguments); 32 Clipperz.PM.DataModel.Record.Version.superclass.constructor.apply(this, arguments);
36 33
37 this._getVersionFunction = args.getVersion|| Clipperz.Base.exception.raise('MandatoryParameter'); 34 this._getVersionFunction = args.getVersion|| Clipperz.Base.exception.raise('MandatoryParameter');
38 this._fields = null; 35 this._fields = null;
39 36
40 return this; 37 return this;
41} 38}
42 39
43 40
44Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version, Clipperz.PM.DataModel.EncryptedRemoteObject, { 41Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version, Clipperz.PM.DataModel.EncryptedRemoteObject, {
45 42
46 'toString': function() { 43 'toString': function() {
47 return "Record.Version (" + this.reference() + ")"; 44 return "Record.Version (" + this.reference() + ")";
48 }, 45 },
49 46
50 //------------------------------------------------------------------------- 47 //-------------------------------------------------------------------------
51 48
52 'reference': function () { 49 'reference': function () {
53 return this._reference; 50 return this._reference;
54 }, 51 },
55 52
56 //------------------------------------------------------------------------- 53 //-------------------------------------------------------------------------
57/* 54/*
58 'hasPendingChanges': function () { 55 'hasPendingChanges': function () {
59 var deferredResult; 56 var deferredResult;
60 57
61 deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.hasPendingChanges", {trace:false}); 58 deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.hasPendingChanges", {trace:false});
62 deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.Version.superclass.hasPendingChanges, this)); 59 deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.Version.superclass.hasPendingChanges, this));
63 deferredResult.callback(); 60 deferredResult.callback();
64 61
65 return deferredResult; 62 return deferredResult;
66 }, 63 },
67*/ 64*/
68 //------------------------------------------------------------------------- 65 //-------------------------------------------------------------------------
69 66
70 67
71 'hasPendingChangesWhenBrandNew': function () { 68 'hasPendingChangesWhenBrandNew': function () {
72 var deferredResult; 69 var deferredResult;
73 70
74 deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.hasPendingChangesWhenBrandNew", {trace:false}); 71 deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.hasPendingChangesWhenBrandNew", {trace:false});
75 deferredResult.addMethod(this, 'fields'); 72 deferredResult.addMethod(this, 'fields');
76 deferredResult.addCallback(MochiKit.Base.values); 73 deferredResult.addCallback(MochiKit.Base.values);
77 deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.methodcaller('isEmpty')) 74 deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.methodcaller('isEmpty'))
78 deferredResult.addCallback(Clipperz.Async.collectAll); 75 deferredResult.addCallback(Clipperz.Async.collectAll);
79 deferredResult.addCallback(function(someValues) { 76 deferredResult.addCallback(function(someValues) {
80 return MochiKit.Iter.every(someValues, MochiKit.Base.operator.identity); 77 return MochiKit.Iter.every(someValues, MochiKit.Base.operator.identity);
81 }); 78 });
82 deferredResult.addCallback(MochiKit.Base.operator.lognot) 79 deferredResult.addCallback(MochiKit.Base.operator.lognot)
83 deferredResult.callback(); 80 deferredResult.callback();
84 81
85 return deferredResult; 82 return deferredResult;
86 }, 83 },
87 84
88 //========================================================================= 85 //=========================================================================
89 86
90 'commitTransientState': function () { 87 'commitTransientState': function () {
91 var deferredResult; 88 var deferredResult;
92 89
93 deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.commitTransientState", {trace:false}); 90 deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.commitTransientState", {trace:false});
94 deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.Version.superclass.commitTransientState, this)); 91 deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.Version.superclass.commitTransientState, this));
95 deferredResult.callback(); 92 deferredResult.callback();
96 93
97 return deferredResult; 94 return deferredResult;
98 }, 95 },
99 96
100 //========================================================================= 97 //=========================================================================
101 98
102 'unpackData': function (someData) { //++ 99 'unpackData': function (someData) { //++
103 varresult; 100 varresult;
104 101
105//console.log("Record.Version - UNPACK DATA", this, someData); 102//console.log("Record.Version - UNPACK DATA", this, someData);
106 result = someData; 103 result = someData;
107 if ((someData['fields'] != null) && (someData['fields'] instanceof Array)) { 104 if ((someData['fields'] != null) && (someData['fields'] instanceof Array)) {
108 varfields; 105 varfields;
109 var i,c; 106 var i,c;
110 107
111 fields = someData['fields']; 108 fields = someData['fields'];
112 delete someData['fields']; 109 delete someData['fields'];
113 110
114 someData['fields'] = {}; 111 someData['fields'] = {};
115 c = fields.length; 112 c = fields.length;
116 for (i=0; i<c; i++) { 113 for (i=0; i<c; i++) {
117 someData['fields'][i] = fields[i]; 114 someData['fields'][i] = fields[i];
118 } 115 }
119 } 116 }
120 117
121 118
122 119
123 return result; 120 return result;
124 }, 121 },
125 122
126 //========================================================================= 123 //=========================================================================
127 124
128 'fields': function () { 125 'fields': function () {
129 vardeferredResult; 126 vardeferredResult;
130 var deferredLock; 127 var deferredLock;
131 128
132 deferredLock = this.getDeferredLockForKey('fields'); 129 deferredLock = this.getDeferredLockForKey('fields');
133 130
134 deferredResult = new Clipperz.Async.Deferred("Record.Version.fields", {trace:false}); 131 deferredResult = new Clipperz.Async.Deferred("Record.Version.fields", {trace:false});
135 deferredResult.acquireLock(deferredLock); 132 deferredResult.acquireLock(deferredLock);
136 deferredResult.addCallback(MochiKit.Base.bind(function () { 133 deferredResult.addCallback(MochiKit.Base.bind(function () {
137 var innerDeferredResult; 134 var innerDeferredResult;
138 135
139 if (this._fields == null) { 136 if (this._fields == null) {
140 innerDeferredResult = new Clipperz.Async.Deferred("Record.Version.fields <inner deferred>", {trace:false}); 137 innerDeferredResult = new Clipperz.Async.Deferred("Record.Version.fields <inner deferred>", {trace:false});
141 innerDeferredResult.addMethod(this, 'getValue', 'fields'); 138 innerDeferredResult.addMethod(this, 'getValue', 'fields');
142 innerDeferredResult.addCallback(MochiKit.Base.bind(function (someObjectData) { 139 innerDeferredResult.addCallback(MochiKit.Base.bind(function (someObjectData) {
143 var reference; 140 var reference;
144 141
145 this._fields = {}; 142 this._fields = {};
146 143
147 for (reference in someObjectData) { 144 for (reference in someObjectData) {
148 varrecordVersionField; 145 varrecordVersionField;
149 146
150 recordVersionField = new Clipperz.PM.DataModel.Record.Version.Field({ 147 recordVersionField = new Clipperz.PM.DataModel.Record.Version.Field({
151 'recordVersion':this, 148 'recordVersion':this,
152 'reference': reference 149 'reference': reference
153 }); 150 });
154 151
155 this._fields[reference] = recordVersionField; 152 this._fields[reference] = recordVersionField;
156 } 153 }
157 154
158 return this._fields; 155 return this._fields;
159 }, this)); 156 }, this));
160 innerDeferredResult.callback(); 157 innerDeferredResult.callback();
161 } else { 158 } else {
162 innerDeferredResult = MochiKit.Async.succeed(this._fields); 159 innerDeferredResult = MochiKit.Async.succeed(this._fields);
163 } 160 }
164 161
165 return innerDeferredResult; 162 return innerDeferredResult;
166 }, this)); 163 }, this));
167 deferredResult.releaseLock(deferredLock); 164 deferredResult.releaseLock(deferredLock);
168 deferredResult.callback(); 165 deferredResult.callback();
169 166
170 return deferredResult; 167 return deferredResult;
171 }, 168 },
172 169
173 //------------------------------------------------------------------------- 170 //-------------------------------------------------------------------------
174 171
175 'getFieldsValues': function () { 172 'getFieldsValues': function () {
176 return this.getValue('fields'); 173 return this.getValue('fields');
177 }, 174 },
178 175
179 //------------------------------------------------------------------------- 176 //-------------------------------------------------------------------------
180 177
181 'addField': function (someParameters) { 178 'addField': function (someParameters) {
182 varnewField; 179 varnewField;
183 180
184 newField = new Clipperz.PM.DataModel.Record.Version.Field({recordVersion:this}); 181 newField = new Clipperz.PM.DataModel.Record.Version.Field({recordVersion:this});
185 182
186 return Clipperz.Async.callbacks("Record.Version.addField", [ 183 return Clipperz.Async.callbacks("Record.Version.addField", [
187 MochiKit.Base.method(this, 'fields'), 184 MochiKit.Base.method(this, 'fields'),
188 185
189 MochiKit.Base.method(this, '_getObjectDataStore'), 186 MochiKit.Base.method(this, '_getObjectDataStore'),
190 MochiKit.Base.methodcaller('values'), 187 MochiKit.Base.methodcaller('values'),
191 Clipperz.Base.serializeJSON, 188 Clipperz.Base.serializeJSON,
192 189
193 MochiKit.Base.bind(function () { this._fields[newField.reference()] = newField; }, this), 190 MochiKit.Base.bind(function () { this._fields[newField.reference()] = newField; }, this),
194 MochiKit.Base.method(newField, 'setLabel', someParameters['label']), 191 MochiKit.Base.method(newField, 'setLabel', someParameters['label']),
195 MochiKit.Base.method(newField, 'setValue', someParameters['value']), 192 MochiKit.Base.method(newField, 'setValue', someParameters['value']),
196 MochiKit.Base.method(newField, 'setIsHidden',someParameters['isHidden']), 193 MochiKit.Base.method(newField, 'setIsHidden',someParameters['isHidden']),
197 194
198 MochiKit.Base.method(this, '_getObjectDataStore'), 195 MochiKit.Base.method(this, '_getObjectDataStore'),
199 MochiKit.Base.methodcaller('values'), 196 MochiKit.Base.methodcaller('values'),
200 Clipperz.Base.serializeJSON, 197 Clipperz.Base.serializeJSON,
201 198
202 MochiKit.Base.partial(MochiKit.Async.succeed, newField) 199 MochiKit.Base.partial(MochiKit.Async.succeed, newField)
203 ], {trace:false}); 200 ], {trace:false});
204 }, 201 },
205 202
206 //------------------------------------------------------------------------- 203 //-------------------------------------------------------------------------
207 204
208 'removeField': function (aField) { 205 'removeField': function (aField) {
209 return Clipperz.Async.callbacks("Record.Version.removeField", [ 206 return Clipperz.Async.callbacks("Record.Version.removeField", [
210 MochiKit.Base.method(this, 'fields'), 207 MochiKit.Base.method(this, 'fields'),
211 MochiKit.Base.bind(function () { delete this._fields[aField.reference()]; }, this), 208 MochiKit.Base.bind(function () { delete this._fields[aField.reference()]; }, this),
212 MochiKit.Base.method(this, 'removeValue', 'fields' + '.' + aField.reference()) 209 MochiKit.Base.method(this, 'removeValue', 'fields' + '.' + aField.reference())
213 ], {trace:false}); 210 ], {trace:false});
214 }, 211 },
215 212
216 //------------------------------------------------------------------------- 213 //-------------------------------------------------------------------------
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/Record.js b/frontend/gamma/js/Clipperz/PM/DataModel/Record.js
index 85dd06b..b816f80 100644
--- a/frontend/gamma/js/Clipperz/PM/DataModel/Record.js
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/Record.js
@@ -1,216 +1,213 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33 30
34Clipperz.PM.DataModel.Record = function(args) { 31Clipperz.PM.DataModel.Record = function(args) {
35//console.log(">>> new Clipperz.PM.DataModel.Record", args); 32//console.log(">>> new Clipperz.PM.DataModel.Record", args);
36 Clipperz.PM.DataModel.Record.superclass.constructor.apply(this, arguments); 33 Clipperz.PM.DataModel.Record.superclass.constructor.apply(this, arguments);
37 34
38 this._updateDate = (args.updateDate ? Clipperz.PM.Date.parse(args.updateDate) : Clipperz.Base.exception.raise('MandatoryParameter')); 35 this._updateDate = (args.updateDate ? Clipperz.PM.Date.parse(args.updateDate) : Clipperz.Base.exception.raise('MandatoryParameter'));
39 36
40 this._retrieveIndexDataFunction = args.retrieveIndexDataFunction|| Clipperz.Base.exception.raise('MandatoryParameter'); 37 this._retrieveIndexDataFunction = args.retrieveIndexDataFunction|| Clipperz.Base.exception.raise('MandatoryParameter');
41 this._updateIndexDataFunction = args.updateIndexDataFunction || Clipperz.Base.exception.raise('MandatoryParameter'); 38 this._updateIndexDataFunction = args.updateIndexDataFunction || Clipperz.Base.exception.raise('MandatoryParameter');
42 39
43 this._retrieveDirectLoginIndexDataFunction = args.retrieveDirectLoginIndexDataFunction|| null; 40 this._retrieveDirectLoginIndexDataFunction = args.retrieveDirectLoginIndexDataFunction|| null;
44 this._setDirectLoginIndexDataFunction = args.setDirectLoginIndexDataFunction || null; 41 this._setDirectLoginIndexDataFunction = args.setDirectLoginIndexDataFunction || null;
45 this._removeDirectLoginIndexDataFunction = args.removeDirectLoginIndexDataFunction|| null; 42 this._removeDirectLoginIndexDataFunction = args.removeDirectLoginIndexDataFunction|| null;
46 43
47 this._createNewDirectLoginFunction = args.createNewDirectLoginFunction || null; 44 this._createNewDirectLoginFunction = args.createNewDirectLoginFunction || null;
48 45
49 this._directLogins = {}; 46 this._directLogins = {};
50 47
51 this._versions = {}; 48 this._versions = {};
52 49
53 this._currentRecordVersion = null; 50 this._currentRecordVersion = null;
54 if (this.isBrandNew()) { 51 if (this.isBrandNew()) {
55 var newVersion; 52 var newVersion;
56 53
57 this.setNotes(''); 54 this.setNotes('');
58 newVersion = new Clipperz.PM.DataModel.Record.Version({ 55 newVersion = new Clipperz.PM.DataModel.Record.Version({
59 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'), 56 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'),
60 'getVersion': MochiKit.Base.method(this, 'getVersion') 57 'getVersion': MochiKit.Base.method(this, 'getVersion')
61 58
62 }); 59 });
63 this._versions[newVersion.reference()] = newVersion; 60 this._versions[newVersion.reference()] = newVersion;
64 this._currentVersionReference = newVersion.reference(); 61 this._currentVersionReference = newVersion.reference();
65 // this.setLabel(''); 62 // this.setLabel('');
66 } 63 }
67 64
68//console.log("<<< new Clipperz.PM.DataModel.Record", args); 65//console.log("<<< new Clipperz.PM.DataModel.Record", args);
69 66
70 return this; 67 return this;
71} 68}
72 69
73 70
74Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.EncryptedRemoteObject, { 71Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.EncryptedRemoteObject, {
75 72
76 'toString': function() { 73 'toString': function() {
77 return "Record (" + this.reference() + ")"; 74 return "Record (" + this.reference() + ")";
78 }, 75 },
79 76
80 //------------------------------------------------------------------------- 77 //-------------------------------------------------------------------------
81 78
82 'reference': function () { 79 'reference': function () {
83 return this._reference; 80 return this._reference;
84 }, 81 },
85 82
86 //========================================================================= 83 //=========================================================================
87 84
88 'getIndexData': function () { 85 'getIndexData': function () {
89 return this._retrieveIndexDataFunction(this.reference()); 86 return this._retrieveIndexDataFunction(this.reference());
90 }, 87 },
91 88
92 //......................................................................... 89 //.........................................................................
93 90
94 'getIndexDataForKey': function (aKey) { 91 'getIndexDataForKey': function (aKey) {
95 return Clipperz.Async.callbacks("Record.getIndexDataForKey", [ 92 return Clipperz.Async.callbacks("Record.getIndexDataForKey", [
96 MochiKit.Base.method(this, 'getIndexData'), 93 MochiKit.Base.method(this, 'getIndexData'),
97 MochiKit.Base.itemgetter(aKey) 94 MochiKit.Base.itemgetter(aKey)
98 ], {trace:false}); 95 ], {trace:false});
99 }, 96 },
100 97
101 //------------------------------------------------------------------------- 98 //-------------------------------------------------------------------------
102 99
103 'setIndexDataForKey': function (aKey, aValue) { 100 'setIndexDataForKey': function (aKey, aValue) {
104 // return this._updateIndexDataFunction(this.reference(), aKey, aValue); 101 // return this._updateIndexDataFunction(this.reference(), aKey, aValue);
105 102
106 var deferredResult; 103 var deferredResult;
107 104
108 deferredResult = new Clipperz.Async.Deferred("Record.setIndexDataForKey", {trace:false}); 105 deferredResult = new Clipperz.Async.Deferred("Record.setIndexDataForKey", {trace:false});
109 deferredResult.addMethod(this, 'getIndexDataForKey', aKey); 106 deferredResult.addMethod(this, 'getIndexDataForKey', aKey);
110 deferredResult.addCallback(MochiKit.Base.bind(function (aCurrentValue) { 107 deferredResult.addCallback(MochiKit.Base.bind(function (aCurrentValue) {
111 var result; 108 var result;
112 var originalValue; 109 var originalValue;
113 110
114 originalValue = this.transientState().getValue('originalValues.indexData.' + aKey); 111 originalValue = this.transientState().getValue('originalValues.indexData.' + aKey);
115 if (originalValue == null) { 112 if (originalValue == null) {
116 originalValue = this.transientState().setValue('originalValues.indexData.' + aKey, aCurrentValue); 113 originalValue = this.transientState().setValue('originalValues.indexData.' + aKey, aCurrentValue);
117 } 114 }
118 115
119 if (aCurrentValue != aValue) { 116 if (aCurrentValue != aValue) {
120 if (originalValue != aValue) { 117 if (originalValue != aValue) {
121 this.transientState().setValue('hasPendingChanges.indexData.' + aKey, true); 118 this.transientState().setValue('hasPendingChanges.indexData.' + aKey, true);
122 } else { 119 } else {
123 this.transientState().setValue('hasPendingChanges.indexData.' + aKey, false); 120 this.transientState().setValue('hasPendingChanges.indexData.' + aKey, false);
124 } 121 }
125 122
126 result = this._updateIndexDataFunction(this.reference(), aKey, aValue); 123 result = this._updateIndexDataFunction(this.reference(), aKey, aValue);
127 } else { 124 } else {
128 result = MochiKit.Async.succeed(aValue); 125 result = MochiKit.Async.succeed(aValue);
129 } 126 }
130 127
131 return result; 128 return result;
132 }, this)); 129 }, this));
133 130
134 deferredResult.callback(); 131 deferredResult.callback();
135 132
136 return deferredResult; 133 return deferredResult;
137 }, 134 },
138 135
139 //========================================================================= 136 //=========================================================================
140/* 137/*
141 'key': function () { 138 'key': function () {
142 return this.getIndexDataForKey('key'); 139 return this.getIndexDataForKey('key');
143 }, 140 },
144*/ 141*/
145 //========================================================================= 142 //=========================================================================
146 143
147 'label': function () { 144 'label': function () {
148 return this.getIndexDataForKey('label'); 145 return this.getIndexDataForKey('label');
149 }, 146 },
150 147
151 //......................................................................... 148 //.........................................................................
152 149
153 'setLabel': function (aValue) { 150 'setLabel': function (aValue) {
154 return this.setIndexDataForKey('label', aValue); 151 return this.setIndexDataForKey('label', aValue);
155 }, 152 },
156 153
157 //========================================================================= 154 //=========================================================================
158 155
159 'headerNotes': function () { 156 'headerNotes': function () {
160 return this.getIndexDataForKey('notes'); 157 return this.getIndexDataForKey('notes');
161 }, 158 },
162 159
163 //------------------------------------------------------------------------- 160 //-------------------------------------------------------------------------
164 161
165 'notes': function () { 162 'notes': function () {
166 return Clipperz.Async.callbacks("Record.notes", [ 163 return Clipperz.Async.callbacks("Record.notes", [
167 MochiKit.Base.method(this, 'headerNotes'), 164 MochiKit.Base.method(this, 'headerNotes'),
168 MochiKit.Base.bind(function (someHeaderNotes) { 165 MochiKit.Base.bind(function (someHeaderNotes) {
169 var result; 166 var result;
170 167
171 if ((someHeaderNotes == null) || (typeof(someHeaderNotes) == 'undefined')) { 168 if ((someHeaderNotes == null) || (typeof(someHeaderNotes) == 'undefined')) {
172 result = this.getValue('notes'); 169 result = this.getValue('notes');
173 } else { 170 } else {
174 result = MochiKit.Async.succeed(someHeaderNotes); 171 result = MochiKit.Async.succeed(someHeaderNotes);
175 } 172 }
176 173
177 return result; 174 return result;
178 }, this) 175 }, this)
179 ], {trace:false}); 176 ], {trace:false});
180 }, 177 },
181 178
182 //......................................................................... 179 //.........................................................................
183 180
184 'setNotes': function (aValue) { 181 'setNotes': function (aValue) {
185 return this.setValue('notes', aValue); 182 return this.setValue('notes', aValue);
186 }, 183 },
187 184
188 //========================================================================= 185 //=========================================================================
189 186
190 'updateDate': function () { 187 'updateDate': function () {
191 return MochiKit.Async.succeed(this._updateDate); 188 return MochiKit.Async.succeed(this._updateDate);
192 }, 189 },
193 190
194 //========================================================================= 191 //=========================================================================
195 192
196 'favicon': function () { 193 'favicon': function () {
197 var result; 194 var result;
198 var directLogins; 195 var directLogins;
199 196
200 directLogins = MochiKit.Base.values(this.directLogins()); 197 directLogins = MochiKit.Base.values(this.directLogins());
201 if (directLogins.length > 0) { 198 if (directLogins.length > 0) {
202 result = directLogins[0].favicon(); 199 result = directLogins[0].favicon();
203 // } else if (/* is there an URL to use for searching a favicon */){ 200 // } else if (/* is there an URL to use for searching a favicon */){
204 } else { 201 } else {
205 result = null; //MochiKit.Async.succeed(Clipperz.PM.Strings['defaultFaviconUrl']); 202 result = null; //MochiKit.Async.succeed(Clipperz.PM.Strings['defaultFaviconUrl']);
206 } 203 }
207 204
208 return result; 205 return result;
209 }, 206 },
210 207
211 //------------------------------------------------------------------------- 208 //-------------------------------------------------------------------------
212 209
213 'searchableContent': function () { 210 'searchableContent': function () {
214 var deferredResult; 211 var deferredResult;
215 212
216//console.log(">>> searchableContent"); 213//console.log(">>> searchableContent");
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 e675525..d6202ff 100644
--- a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js
@@ -1,187 +1,184 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { 26try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.PM.DataModel.User.Header.Legacy depends on Clipperz.PM.DataModel.User!"; 27 throw "Clipperz.PM.DataModel.User.Header.Legacy depends on Clipperz.PM.DataModel.User!";
31} 28}
32 29
33if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } 30if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; }
34 31
35Clipperz.PM.DataModel.User.Header.Legacy = function(args) { 32Clipperz.PM.DataModel.User.Header.Legacy = function(args) {
36 //args = args || {}; 33 //args = args || {};
37 Clipperz.PM.DataModel.User.Header.Legacy.superclass.constructor.apply(this, arguments); 34 Clipperz.PM.DataModel.User.Header.Legacy.superclass.constructor.apply(this, arguments);
38 35
39 this._retrieveRecordDetailFunction = args.retrieveRecordDetailFunction|| Clipperz.Base.exception.raise('MandatoryParameter'); 36 this._retrieveRecordDetailFunction = args.retrieveRecordDetailFunction|| Clipperz.Base.exception.raise('MandatoryParameter');
40 this._records = null; 37 this._records = null;
41 //this._directLogins = null; 38 //this._directLogins = null;
42 39
43 return this; 40 return this;
44} 41}
45 42
46 43
47Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.Legacy, Clipperz.PM.DataModel.EncryptedRemoteObject, { 44Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.Legacy, Clipperz.PM.DataModel.EncryptedRemoteObject, {
48 45
49 'toString': function() { 46 'toString': function() {
50 return "Clipperz.PM.DataModel.User.Header.Legacy"; 47 return "Clipperz.PM.DataModel.User.Header.Legacy";
51 }, 48 },
52 49
53 //------------------------------------------------------------------------- 50 //-------------------------------------------------------------------------
54 51
55 'retrieveRecordDetailFunction': function () { 52 'retrieveRecordDetailFunction': function () {
56 return this._retrieveRecordDetailFunction; 53 return this._retrieveRecordDetailFunction;
57 }, 54 },
58 55
59 //------------------------------------------------------------------------- 56 //-------------------------------------------------------------------------
60 57
61 'getRecordKey': function (aRecordReference) { 58 'getRecordKey': function (aRecordReference) {
62 var deferredResult; 59 var deferredResult;
63 60
64 deferredResult = new Clipperz.Async.Deferred("User.Header.Legacy.getRecordKey", {trace:false}); 61 deferredResult = new Clipperz.Async.Deferred("User.Header.Legacy.getRecordKey", {trace:false});
65 deferredResult.addMethod(this, 'getRecordIndexData'); 62 deferredResult.addMethod(this, 'getRecordIndexData');
66 deferredResult.addCallback(MochiKit.Base.itemgetter('key')) 63 deferredResult.addCallback(MochiKit.Base.itemgetter('key'))
67 deferredResult.callback(); 64 deferredResult.callback();
68 65
69 return deferredResult; 66 return deferredResult;
70 }, 67 },
71 68
72 //========================================================================= 69 //=========================================================================
73 70
74 'getRecordIndexData': function (aRecordReference) { 71 'getRecordIndexData': function (aRecordReference) {
75 return this.getValue('records.' + aRecordReference); 72 return this.getValue('records.' + aRecordReference);
76 }, 73 },
77 74
78 'updateRecordIndexData': function (aRecordReference, aKey, aValue) { 75 'updateRecordIndexData': function (aRecordReference, aKey, aValue) {
79 return this.setValue('records.' + aRecordReference + "." + aKey, aValue); 76 return this.setValue('records.' + aRecordReference + "." + aKey, aValue);
80 }, 77 },
81 78
82 //------------------------------------------------------------------------- 79 //-------------------------------------------------------------------------
83 80
84 'getDirectLoginIndexData': function (aDirectLoginReference) { 81 'getDirectLoginIndexData': function (aDirectLoginReference) {
85 return this.getValue('directLogins.' + aDirectLoginReference); 82 return this.getValue('directLogins.' + aDirectLoginReference);
86 }, 83 },
87 84
88 'setDirectLoginIndexData': function (aDirectLoginReference, aKey, aValue) { 85 'setDirectLoginIndexData': function (aDirectLoginReference, aKey, aValue) {
89 return this.setValue('directLogins.' + aDirectLoginReference + '.' + aKey, aValue); 86 return this.setValue('directLogins.' + aDirectLoginReference + '.' + aKey, aValue);
90 }, 87 },
91 88
92 'removeDirectLoginIndexData': function (aDirectLoginReference) { 89 'removeDirectLoginIndexData': function (aDirectLoginReference) {
93 return this.removeValue('directLogins.' + aDirectLoginReference); 90 return this.removeValue('directLogins.' + aDirectLoginReference);
94 }, 91 },
95 92
96 //========================================================================= 93 //=========================================================================
97 94
98 'records': function () { 95 'records': function () {
99 vardeferredResult; 96 vardeferredResult;
100 var deferredLock; 97 var deferredLock;
101 98
102 deferredLock = this.getDeferredLockForKey('records'); 99 deferredLock = this.getDeferredLockForKey('records');
103 100
104 deferredResult = new Clipperz.Async.Deferred("User.Header.Legacy.records", {trace:false}); 101 deferredResult = new Clipperz.Async.Deferred("User.Header.Legacy.records", {trace:false});
105 deferredResult.acquireLock(deferredLock); 102 deferredResult.acquireLock(deferredLock);
106 deferredResult.addCallback(MochiKit.Base.bind(function () { 103 deferredResult.addCallback(MochiKit.Base.bind(function () {
107 var innerDeferredResult; 104 var innerDeferredResult;
108 105
109 if (this._records == null) { 106 if (this._records == null) {
110 innerDeferredResult = new Clipperz.Async.Deferred("User.Header.Legacy.records <inner deferred>", {trace:false}); 107 innerDeferredResult = new Clipperz.Async.Deferred("User.Header.Legacy.records <inner deferred>", {trace:false});
111 innerDeferredResult.collectResults({ 108 innerDeferredResult.collectResults({
112 'header': [ 109 'header': [
113 // MochiKit.Base.method(this, 'getObjectDataStore'), 110 // MochiKit.Base.method(this, 'getObjectDataStore'),
114 // MochiKit.Base.methodcaller('values') 111 // MochiKit.Base.methodcaller('values')
115 MochiKit.Base.method(this, 'values') 112 MochiKit.Base.method(this, 'values')
116 ], 113 ],
117 'recordsStats': [ 114 'recordsStats': [
118 MochiKit.Base.method(this, 'getRemoteData'), 115 MochiKit.Base.method(this, 'getRemoteData'),
119 MochiKit.Base.itemgetter('recordsStats') 116 MochiKit.Base.itemgetter('recordsStats')
120 ] 117 ]
121 }); 118 });
122 innerDeferredResult.addCallback(MochiKit.Base.bind(function (someObjectData) { 119 innerDeferredResult.addCallback(MochiKit.Base.bind(function (someObjectData) {
123 var reference; 120 var reference;
124 121
125 this._records = {}; 122 this._records = {};
126 // this._directLogins = {}; 123 // this._directLogins = {};
127 124
128 for (reference in someObjectData['header']['records']) { 125 for (reference in someObjectData['header']['records']) {
129 varrecord; 126 varrecord;
130 127
131 record = new Clipperz.PM.DataModel.Record({ 128 record = new Clipperz.PM.DataModel.Record({
132 'reference': reference, 129 'reference': reference,
133 'retrieveKeyFunction': MochiKit.Base.method(this, 'getRecordKey'), 130 'retrieveKeyFunction': MochiKit.Base.method(this, 'getRecordKey'),
134 'retrieveRemoteDataFunction':this.retrieveRecordDetailFunction(), 131 'retrieveRemoteDataFunction':this.retrieveRecordDetailFunction(),
135 // 'encryptedDataKeypath': 'data', 132 // 'encryptedDataKeypath': 'data',
136 // 'encryptedVersionKeypath': 'version', 133 // 'encryptedVersionKeypath': 'version',
137 134
138 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getRecordIndexData'), 135 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getRecordIndexData'),
139 'updateIndexDataFunction': MochiKit.Base.method(this, 'updateRecordIndexData'), 136 'updateIndexDataFunction': MochiKit.Base.method(this, 'updateRecordIndexData'),
140 'updateDate': someObjectData['recordsStats'][reference]['updateDate'], 137 'updateDate': someObjectData['recordsStats'][reference]['updateDate'],
141 138
142 'retrieveDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'), 139 'retrieveDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'),
143 'setDirectLoginIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'), 140 'setDirectLoginIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'),
144 'removeDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'removeDirectLoginIndexData') 141 'removeDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'removeDirectLoginIndexData')
145 }); 142 });
146 143
147 this._records[reference] = record; 144 this._records[reference] = record;
148 } 145 }
149 146
150 for (reference in someObjectData['header']['directLogins']) { 147 for (reference in someObjectData['header']['directLogins']) {
151 vardirectLogin; 148 vardirectLogin;
152 var record; 149 var record;
153 150
154 record = this._records[someObjectData['header']['directLogins'][reference]['record']]; 151 record = this._records[someObjectData['header']['directLogins'][reference]['record']];
155 if (record != null) { 152 if (record != null) {
156 directLogin = new Clipperz.PM.DataModel.DirectLogin({ 153 directLogin = new Clipperz.PM.DataModel.DirectLogin({
157 'reference': reference, 154 'reference': reference,
158 'record': record//, 155 'record': record//,
159 // 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'), 156 // 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'),
160 // 'setIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'), 157 // 'setIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'),
161 // 'removeIndexDataFunction': MochiKit.Base.method(this, 'removeDirectLoginIndexData') 158 // 'removeIndexDataFunction': MochiKit.Base.method(this, 'removeDirectLoginIndexData')
162 }); 159 });
163 } else { 160 } else {
164Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!"); 161Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!");
165 } 162 }
166 } 163 }
167 164
168 return this._records; 165 return this._records;
169 }, this)); 166 }, this));
170 innerDeferredResult.callback(); 167 innerDeferredResult.callback();
171 } else { 168 } else {
172 innerDeferredResult = MochiKit.Async.succeed(this._records); 169 innerDeferredResult = MochiKit.Async.succeed(this._records);
173 } 170 }
174 171
175 return innerDeferredResult; 172 return innerDeferredResult;
176 }, this)); 173 }, this));
177 deferredResult.releaseLock(deferredLock); 174 deferredResult.releaseLock(deferredLock);
178 deferredResult.callback(); 175 deferredResult.callback();
179 176
180 return deferredResult; 177 return deferredResult;
181 }, 178 },
182 179
183 //========================================================================= 180 //=========================================================================
184 __syntaxFix__: "syntax fix" 181 __syntaxFix__: "syntax fix"
185}); 182});
186 183
187 184
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 0ee8599..3528db6 100644
--- a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js
@@ -1,128 +1,125 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { 26try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.PM.DataModel.User.Header.OneTimePasswords depends on Clipperz.PM.DataModel.User!"; 27 throw "Clipperz.PM.DataModel.User.Header.OneTimePasswords depends on Clipperz.PM.DataModel.User!";
31} 28}
32if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } 29if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; }
33 30
34//----------------------------------------------------------------------------- 31//-----------------------------------------------------------------------------
35 32
36Clipperz.PM.DataModel.User.Header.OneTimePasswords = function(args) { 33Clipperz.PM.DataModel.User.Header.OneTimePasswords = function(args) {
37 Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.constructor.apply(this, arguments); 34 Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.constructor.apply(this, arguments);
38 35
39 this._oneTimePasswords = null; 36 this._oneTimePasswords = null;
40 37
41 return this; 38 return this;
42} 39}
43 40
44//----------------------------------------------------------------------------- 41//-----------------------------------------------------------------------------
45 42
46Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.OneTimePasswords, Clipperz.PM.DataModel.EncryptedRemoteObject, { 43Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.OneTimePasswords, Clipperz.PM.DataModel.EncryptedRemoteObject, {
47 44
48 'toString': function() { 45 'toString': function() {
49 return "Clipperz.PM.DataModel.User.Header.OneTimePasswords"; 46 return "Clipperz.PM.DataModel.User.Header.OneTimePasswords";
50 }, 47 },
51 48
52 //------------------------------------------------------------------------- 49 //-------------------------------------------------------------------------
53/* 50/*
54 'packData': function (someData) { //++ 51 'packData': function (someData) { //++
55 var result; 52 var result;
56 53
57console.log(">>> OneTimePasswords.packData", someData); 54console.log(">>> OneTimePasswords.packData", someData);
58 result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packData.apply(this, arguments); 55 result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packData.apply(this, arguments);
59console.log("<<< OneTimePasswords.packData"); 56console.log("<<< OneTimePasswords.packData");
60 57
61 return result; 58 return result;
62 }, 59 },
63*/ 60*/
64 //------------------------------------------------------------------------- 61 //-------------------------------------------------------------------------
65/* 62/*
66 'packRemoteData': function (someData) { 63 'packRemoteData': function (someData) {
67 var result; 64 var result;
68 65
69console.log(">>> OneTimePasswords.packRemoteData", someData); 66console.log(">>> OneTimePasswords.packRemoteData", someData);
70 result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packRemoteData.apply(this, arguments); 67 result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packRemoteData.apply(this, arguments);
71console.log("<<< OneTimePasswords.packRemoteData"); 68console.log("<<< OneTimePasswords.packRemoteData");
72 69
73 return result; 70 return result;
74 }, 71 },
75*/ 72*/
76 //------------------------------------------------------------------------- 73 //-------------------------------------------------------------------------
77/* 74/*
78 'prepareRemoteDataWithKey': function (aKey) { 75 'prepareRemoteDataWithKey': function (aKey) {
79 var result; 76 var result;
80 77
81console.log(">>> OneTimePasswords.prepareRemoteDataWithKey"); 78console.log(">>> OneTimePasswords.prepareRemoteDataWithKey");
82 result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.prepareRemoteDataWithKey.apply(this, arguments); 79 result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.prepareRemoteDataWithKey.apply(this, arguments);
83console.log("<<< OneTimePasswords.prepareRemoteDataWithKey"); 80console.log("<<< OneTimePasswords.prepareRemoteDataWithKey");
84 81
85 return result; 82 return result;
86 }, 83 },
87*/ 84*/
88 //========================================================================= 85 //=========================================================================
89 86
90 'oneTimePasswords': function () { 87 'oneTimePasswords': function () {
91 vardeferredResult; 88 vardeferredResult;
92 89
93 deferredResult = new Clipperz.Async.Deferred("User.Header.OneTimePasswords.oneTimePasswords", {trace:false}); 90 deferredResult = new Clipperz.Async.Deferred("User.Header.OneTimePasswords.oneTimePasswords", {trace:false});
94 if (this._oneTimePasswords == null) { 91 if (this._oneTimePasswords == null) {
95 deferredResult.addMethod(this, 'values') 92 deferredResult.addMethod(this, 'values')
96 deferredResult.addCallback(MochiKit.Base.bind(function (someData) { 93 deferredResult.addCallback(MochiKit.Base.bind(function (someData) {
97 varotpKey; 94 varotpKey;
98 95
99 this._oneTimePasswords = {}; 96 this._oneTimePasswords = {};
100 97
101 for (otpKey in someData) { 98 for (otpKey in someData) {
102 var otp; 99 var otp;
103 var otpParameters; 100 var otpParameters;
104 101
105 otpParameters = Clipperz.Base.deepClone(someData[otpKey]); 102 otpParameters = Clipperz.Base.deepClone(someData[otpKey]);
106 otpParameters['reference'] = otpKey; 103 otpParameters['reference'] = otpKey;
107 104
108 otp = new Clipperz.PM.DataModel.OneTimePassword(otpParameters); 105 otp = new Clipperz.PM.DataModel.OneTimePassword(otpParameters);
109 this._oneTimePasswords[otpKey] = otp; 106 this._oneTimePasswords[otpKey] = otp;
110 } 107 }
111 108
112 return this._oneTimePasswords; 109 return this._oneTimePasswords;
113 110
114 }, this)); 111 }, this));
115 deferredResult.callback(); 112 deferredResult.callback();
116 } else { 113 } else {
117 deferredResult = MochiKit.Async.succeed(this._oneTimePasswords); 114 deferredResult = MochiKit.Async.succeed(this._oneTimePasswords);
118 } 115 }
119 116
120 return deferredResult; 117 return deferredResult;
121 }, 118 },
122 119
123 //========================================================================= 120 //=========================================================================
124 __syntaxFix__: "syntax fix" 121 __syntaxFix__: "syntax fix"
125}); 122});
126 123
127//----------------------------------------------------------------------------- 124//-----------------------------------------------------------------------------
128 125
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 91b981e..b164889 100644
--- a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js
@@ -1,53 +1,50 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { 26try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.PM.DataModel.User.Header.Preferences depends on Clipperz.PM.DataModel.User!"; 27 throw "Clipperz.PM.DataModel.User.Header.Preferences depends on Clipperz.PM.DataModel.User!";
31} 28}
32 29
33if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } 30if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; }
34 31
35Clipperz.PM.DataModel.User.Header.Preferences = function(args) { 32Clipperz.PM.DataModel.User.Header.Preferences = function(args) {
36 Clipperz.PM.DataModel.User.Header.Preferences.superclass.constructor.apply(this, arguments); 33 Clipperz.PM.DataModel.User.Header.Preferences.superclass.constructor.apply(this, arguments);
37 34
38 return this; 35 return this;
39} 36}
40 37
41 38
42Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.Preferences, Clipperz.PM.DataModel.EncryptedRemoteObject, { 39Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.Preferences, Clipperz.PM.DataModel.EncryptedRemoteObject, {
43 40
44 'toString': function() { 41 'toString': function() {
45 return "Clipperz.PM.DataModel.User.Header.Preferences"; 42 return "Clipperz.PM.DataModel.User.Header.Preferences";
46 }, 43 },
47 44
48 //------------------------------------------------------------------------- 45 //-------------------------------------------------------------------------
49 //========================================================================= 46 //=========================================================================
50 __syntaxFix__: "syntax fix" 47 __syntaxFix__: "syntax fix"
51}); 48});
52 49
53 50
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 6ba58a8..f77ea80 100644
--- a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js
@@ -1,216 +1,213 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { 26try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.PM.DataModel.User.Header.RecordIndex depends on Clipperz.PM.DataModel.User!"; 27 throw "Clipperz.PM.DataModel.User.Header.RecordIndex depends on Clipperz.PM.DataModel.User!";
31} 28}
32 29
33if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } 30if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; }
34 31
35Clipperz.PM.DataModel.User.Header.RecordIndex = function(args) { 32Clipperz.PM.DataModel.User.Header.RecordIndex = function(args) {
36 Clipperz.PM.DataModel.User.Header.RecordIndex.superclass.constructor.apply(this, arguments); 33 Clipperz.PM.DataModel.User.Header.RecordIndex.superclass.constructor.apply(this, arguments);
37 34
38//console.log("NEW Clipperz.PM.DataModel.User.Header.RecordIndex", args); 35//console.log("NEW Clipperz.PM.DataModel.User.Header.RecordIndex", args);
39 this._recordsData = new Clipperz.PM.DataModel.EncryptedRemoteObject({ 36 this._recordsData = new Clipperz.PM.DataModel.EncryptedRemoteObject({
40 'name':'recordsData', 37 'name':'recordsData',
41 'retrieveKeyFunction': args.retrieveKeyFunction, 38 'retrieveKeyFunction': args.retrieveKeyFunction,
42 'remoteData': { 39 'remoteData': {
43 'data': args.recordsData['data'], 40 'data': args.recordsData['data'],
44 'version': args.encryptedDataVersion, 41 'version': args.encryptedDataVersion,
45 'recordsStats': args.recordsStats 42 'recordsStats': args.recordsStats
46 }//, 43 }//,
47 // 'encryptedDataKeypath': 'data', 44 // 'encryptedDataKeypath': 'data',
48 // 'encryptedVersionKeypath': 'version' 45 // 'encryptedVersionKeypath': 'version'
49 }); 46 });
50 47
51 this._directLoginsData = new Clipperz.PM.DataModel.EncryptedRemoteObject({ 48 this._directLoginsData = new Clipperz.PM.DataModel.EncryptedRemoteObject({
52 'name':'directLoginsData', 49 'name':'directLoginsData',
53 'retrieveKeyFunction': args.retrieveKeyFunction, 50 'retrieveKeyFunction': args.retrieveKeyFunction,
54 'remoteData': { 51 'remoteData': {
55 'data': args.directLoginsData['data'], 52 'data': args.directLoginsData['data'],
56 'version': args.encryptedDataVersion 53 'version': args.encryptedDataVersion
57 }//, 54 }//,
58 // 'encryptedDataKeypath': 'data', 55 // 'encryptedDataKeypath': 'data',
59 // 'encryptedVersionKeypath': 'version' 56 // 'encryptedVersionKeypath': 'version'
60 }); 57 });
61 58
62 this._lock = new MochiKit.Async.DeferredLock(); 59 this._lock = new MochiKit.Async.DeferredLock();
63 this._transientState = null; 60 this._transientState = null;
64 61
65 this._retrieveRecordDetailFunction = args.retrieveRecordDetailFunction|| Clipperz.Base.exception.raise('MandatoryParameter'); 62 this._retrieveRecordDetailFunction = args.retrieveRecordDetailFunction|| Clipperz.Base.exception.raise('MandatoryParameter');
66 this._recordsIndex = args.recordsData['index'] || Clipperz.Base.exception.raise('MandatoryParameter'); 63 this._recordsIndex = args.recordsData['index'] || Clipperz.Base.exception.raise('MandatoryParameter');
67 this._directLoginsIndex = args.directLoginsData['index']|| Clipperz.Base.exception.raise('MandatoryParameter'); 64 this._directLoginsIndex = args.directLoginsData['index']|| Clipperz.Base.exception.raise('MandatoryParameter');
68 65
69 this._records = null; 66 this._records = null;
70 67
71 return this; 68 return this;
72} 69}
73 70
74 71
75Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.RecordIndex, Object, { 72Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.RecordIndex, Object, {
76 73
77 'toString': function() { 74 'toString': function() {
78 return "Clipperz.PM.DataModel.User.Header.RecordIndex"; 75 return "Clipperz.PM.DataModel.User.Header.RecordIndex";
79 }, 76 },
80 77
81 //------------------------------------------------------------------------- 78 //-------------------------------------------------------------------------
82 79
83 'retrieveRecordDetailFunction': function () { 80 'retrieveRecordDetailFunction': function () {
84 return this._retrieveRecordDetailFunction; 81 return this._retrieveRecordDetailFunction;
85 }, 82 },
86 83
87 //------------------------------------------------------------------------- 84 //-------------------------------------------------------------------------
88 85
89 'recordsIndex': function () { 86 'recordsIndex': function () {
90 return this._recordsIndex; 87 return this._recordsIndex;
91 }, 88 },
92 89
93 'recordsData': function () { 90 'recordsData': function () {
94 return this._recordsData; 91 return this._recordsData;
95 }, 92 },
96 93
97 //------------------------------------------------------------------------- 94 //-------------------------------------------------------------------------
98 95
99 'directLoginsIndex': function () { 96 'directLoginsIndex': function () {
100 return this._directLoginsIndex; 97 return this._directLoginsIndex;
101 }, 98 },
102 99
103 'directLoginsData': function () { 100 'directLoginsData': function () {
104 return this._directLoginsData; 101 return this._directLoginsData;
105 }, 102 },
106 103
107 //------------------------------------------------------------------------- 104 //-------------------------------------------------------------------------
108 105
109 'lock': function () { 106 'lock': function () {
110 return this._lock; 107 return this._lock;
111 }, 108 },
112 109
113 //------------------------------------------------------------------------- 110 //-------------------------------------------------------------------------
114 111
115 'transientState': function () { 112 'transientState': function () {
116 if (this._transientState == null) { 113 if (this._transientState == null) {
117 this._transientState = new Clipperz.KeyValueObjectStore(/*{'name':'User.Header.RecordIndex.transientState [1]'}*/); 114 this._transientState = new Clipperz.KeyValueObjectStore(/*{'name':'User.Header.RecordIndex.transientState [1]'}*/);
118 } 115 }
119 116
120 return this._transientState; 117 return this._transientState;
121 }, 118 },
122 119
123 'resetTransientState': function (isCommitting) { 120 'resetTransientState': function (isCommitting) {
124//console.log("######## UserHeaderRecordIndex - resetTransientState", Clipperz.Base.deepClone(this._transientState)); 121//console.log("######## UserHeaderRecordIndex - resetTransientState", Clipperz.Base.deepClone(this._transientState));
125 if (this._transientState != null) { 122 if (this._transientState != null) {
126 this._transientState.removeAllData(); 123 this._transientState.removeAllData();
127 } 124 }
128 125
129 this._transientState = null; 126 this._transientState = null;
130 }, 127 },
131 128
132 //------------------------------------------------------------------------- 129 //-------------------------------------------------------------------------
133 130
134 'getRecordKey': function (aRecordReference) { 131 'getRecordKey': function (aRecordReference) {
135 return Clipperz.Async.callbacks("User.Header.RecordIndex.getRecordKey", [ 132 return Clipperz.Async.callbacks("User.Header.RecordIndex.getRecordKey", [
136 MochiKit.Base.method(this, 'getRecordIndexData', aRecordReference), 133 MochiKit.Base.method(this, 'getRecordIndexData', aRecordReference),
137 MochiKit.Base.itemgetter('key') 134 MochiKit.Base.itemgetter('key')
138 ], {trace:false}); 135 ], {trace:false});
139 }, 136 },
140 137
141 'setRecordKey': function (aRecordReference, aValue) { 138 'setRecordKey': function (aRecordReference, aValue) {
142 return this.updateRecordIndexData(aRecordReference, 'key', aValue); 139 return this.updateRecordIndexData(aRecordReference, 'key', aValue);
143 }, 140 },
144 141
145 //------------------------------------------------------------------------- 142 //-------------------------------------------------------------------------
146 143
147 'getRecordIndexData': function (aRecordReference) { 144 'getRecordIndexData': function (aRecordReference) {
148 return this.recordsData().getValue(this.recordsIndex()[aRecordReference]); 145 return this.recordsData().getValue(this.recordsIndex()[aRecordReference]);
149 }, 146 },
150 147
151 //......................................................................... 148 //.........................................................................
152 149
153 'updateRecordIndexData': function (aRecordReference, aKey, aValue) { 150 'updateRecordIndexData': function (aRecordReference, aKey, aValue) {
154 return this.recordsData().setValue(this.recordsIndex()[aRecordReference]+'.'+aKey, aValue); 151 return this.recordsData().setValue(this.recordsIndex()[aRecordReference]+'.'+aKey, aValue);
155 }, 152 },
156 153
157 //------------------------------------------------------------------------- 154 //-------------------------------------------------------------------------
158 155
159 'getDirectLoginIndexData': function (aDirectLoginReference) { 156 'getDirectLoginIndexData': function (aDirectLoginReference) {
160 return this.directLoginsData().getValue(this.directLoginsIndex()[aDirectLoginReference]); 157 return this.directLoginsData().getValue(this.directLoginsIndex()[aDirectLoginReference]);
161 }, 158 },
162 159
163 'setDirectLoginIndexData': function (aDirectLoginReference, aKey, aValue) { 160 'setDirectLoginIndexData': function (aDirectLoginReference, aKey, aValue) {
164//console.log("UserHeaderRecordIndex.setDirectLoginIndexData", aDirectLoginReference, this.directLoginsIndex()[aDirectLoginReference], aKey); 161//console.log("UserHeaderRecordIndex.setDirectLoginIndexData", aDirectLoginReference, this.directLoginsIndex()[aDirectLoginReference], aKey);
165//if (MochiKit.Base.isUndefinedOrNull(this.directLoginsIndex()[aDirectLoginReference])) { 162//if (MochiKit.Base.isUndefinedOrNull(this.directLoginsIndex()[aDirectLoginReference])) {
166 //throw "PIPPO"; 163 //throw "PIPPO";
167//} 164//}
168 return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference] + '.' + aKey, aValue); 165 return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference] + '.' + aKey, aValue);
169 }, 166 },
170 167
171 'addDirectLoginIndexData': function (aDirectLoginReference) { 168 'addDirectLoginIndexData': function (aDirectLoginReference) {
172//console.log("UserHeaderRecordIndex.addDirectLoginIndexData", aDirectLoginReference, this.directLoginsIndex()[aDirectLoginReference]); 169//console.log("UserHeaderRecordIndex.addDirectLoginIndexData", aDirectLoginReference, this.directLoginsIndex()[aDirectLoginReference]);
173 return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference], {}); 170 return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference], {});
174 }, 171 },
175 172
176 'removeDirectLoginIndexData': function (aDirectLoginReference) { 173 'removeDirectLoginIndexData': function (aDirectLoginReference) {
177 return this.directLoginsData().removeValue(this.directLoginsIndex()[aDirectLoginReference]) 174 return this.directLoginsData().removeValue(this.directLoginsIndex()[aDirectLoginReference])
178 }, 175 },
179 176
180 //------------------------------------------------------------------------- 177 //-------------------------------------------------------------------------
181 178
182 'records': function () { 179 'records': function () {
183 vardeferredResult; 180 vardeferredResult;
184 181
185 deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.records", {trace:false}); 182 deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.records", {trace:false});
186 deferredResult.acquireLock(this.lock()); 183 deferredResult.acquireLock(this.lock());
187 deferredResult.addCallback(MochiKit.Base.bind(function () { 184 deferredResult.addCallback(MochiKit.Base.bind(function () {
188 var innerDeferredResult; 185 var innerDeferredResult;
189 186
190 if (this._records == null) { 187 if (this._records == null) {
191 innerDeferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.records <inner deferred>", {trace:false}); 188 innerDeferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.records <inner deferred>", {trace:false});
192 innerDeferredResult.collectResults({ 189 innerDeferredResult.collectResults({
193 'records': [ 190 'records': [
194 // MochiKit.Base.method(this.recordsData(), 'getObjectDataStore'), 191 // MochiKit.Base.method(this.recordsData(), 'getObjectDataStore'),
195 // MochiKit.Base.methodcaller('values') 192 // MochiKit.Base.methodcaller('values')
196 MochiKit.Base.method(this.recordsData(), 'values') 193 MochiKit.Base.method(this.recordsData(), 'values')
197 ], 194 ],
198 'recordsStats': [ 195 'recordsStats': [
199 MochiKit.Base.method(this.recordsData(), 'getRemoteData'), 196 MochiKit.Base.method(this.recordsData(), 'getRemoteData'),
200 MochiKit.Base.itemgetter('recordsStats') 197 MochiKit.Base.itemgetter('recordsStats')
201 ], 198 ],
202 'directLogins': [ 199 'directLogins': [
203 // MochiKit.Base.method(this.directLoginsData(), 'getObjectDataStore'), 200 // MochiKit.Base.method(this.directLoginsData(), 'getObjectDataStore'),
204 // MochiKit.Base.methodcaller('values') 201 // MochiKit.Base.methodcaller('values')
205 MochiKit.Base.method(this.directLoginsData(), 'values') 202 MochiKit.Base.method(this.directLoginsData(), 'values')
206 ] 203 ]
207 }) 204 })
208 innerDeferredResult.addCallback(MochiKit.Base.bind(function (someData) { 205 innerDeferredResult.addCallback(MochiKit.Base.bind(function (someData) {
209 var indexReference; 206 var indexReference;
210 var recordsInvertedIndex; 207 var recordsInvertedIndex;
211 var directLoginsInvertedIndex; 208 var directLoginsInvertedIndex;
212 209
213 recordsInvertedIndex = Clipperz.PM.DataModel.User.Header.RecordIndex.invertIndex(this.recordsIndex()); 210 recordsInvertedIndex = Clipperz.PM.DataModel.User.Header.RecordIndex.invertIndex(this.recordsIndex());
214 directLoginsInvertedIndex= Clipperz.PM.DataModel.User.Header.RecordIndex.invertIndex(this.directLoginsIndex()); 211 directLoginsInvertedIndex= Clipperz.PM.DataModel.User.Header.RecordIndex.invertIndex(this.directLoginsIndex());
215 212
216 this._records = {}; 213 this._records = {};
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.js
index e8afa97..72d4006 100644
--- a/frontend/gamma/js/Clipperz/PM/DataModel/User.js
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.js
@@ -1,216 +1,213 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33 30
34//############################################################################# 31//#############################################################################
35 32
36Clipperz.PM.DataModel.User = function (args) { 33Clipperz.PM.DataModel.User = function (args) {
37 args = args || {}; 34 args = args || {};
38 35
39 Clipperz.PM.DataModel.User.superclass.constructor.apply(this, arguments); 36 Clipperz.PM.DataModel.User.superclass.constructor.apply(this, arguments);
40 37
41 this._username = args.username || null; 38 this._username = args.username || null;
42 this._getPassphraseFunction = args.getPassphraseFunction || null; 39 this._getPassphraseFunction = args.getPassphraseFunction || null;
43 40
44 this._data = null; 41 this._data = null;
45 42
46 this._connection = null; 43 this._connection = null;
47 this._connectionVersion = 'current'; 44 this._connectionVersion = 'current';
48 45
49 this._serverData = null; 46 this._serverData = null;
50 this._serverLockValue = null; 47 this._serverLockValue = null;
51 this._transientState = null; 48 this._transientState = null;
52 49
53 this._deferredLocks = { 50 this._deferredLocks = {
54 'passphrase': new MochiKit.Async.DeferredLock(), 51 'passphrase': new MochiKit.Async.DeferredLock(),
55 'serverData': new MochiKit.Async.DeferredLock(), 52 'serverData': new MochiKit.Async.DeferredLock(),
56 // 'recordsIndex': new MochiKit.Async.DeferredLock(), 53 // 'recordsIndex': new MochiKit.Async.DeferredLock(),
57 // 'directLoginsIndex':new MochiKit.Async.DeferredLock() 54 // 'directLoginsIndex':new MochiKit.Async.DeferredLock()
58 // 'preferences': new MochiKit.Async.DeferredLock() 55 // 'preferences': new MochiKit.Async.DeferredLock()
59 // 'oneTimePasswords': new MochiKit.Async.DeferredLock() 56 // 'oneTimePasswords': new MochiKit.Async.DeferredLock()
60 '__syntaxFix__': 'syntax fix' 57 '__syntaxFix__': 'syntax fix'
61 }; 58 };
62 59
63 return this; 60 return this;
64} 61}
65 62
66Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, { 63Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, {
67 64
68 'toString': function () { 65 'toString': function () {
69 return "Clipperz.PM.DataModel.User - " + this.username(); 66 return "Clipperz.PM.DataModel.User - " + this.username();
70 }, 67 },
71 68
72 //------------------------------------------------------------------------- 69 //-------------------------------------------------------------------------
73 70
74 'username': function () { 71 'username': function () {
75 return this._username; 72 return this._username;
76 }, 73 },
77 74
78 'setUsername': function (aValue) { 75 'setUsername': function (aValue) {
79 this._username = aValue; 76 this._username = aValue;
80 }, 77 },
81 78
82 //------------------------------------------------------------------------- 79 //-------------------------------------------------------------------------
83 80
84 'displayName': function() { 81 'displayName': function() {
85 return "" + this.username() + ""; 82 return "" + this.username() + "";
86 }, 83 },
87 84
88 //------------------------------------------------------------------------- 85 //-------------------------------------------------------------------------
89 86
90 'data': function () { 87 'data': function () {
91 if (this._data == null) { 88 if (this._data == null) {
92 this._data = new Clipperz.KeyValueObjectStore(/*{'name':'User.data [1]'}*/); 89 this._data = new Clipperz.KeyValueObjectStore(/*{'name':'User.data [1]'}*/);
93 }; 90 };
94 91
95 return this._data; 92 return this._data;
96 }, 93 },
97 94
98 //------------------------------------------------------------------------- 95 //-------------------------------------------------------------------------
99 96
100 'serverLockValue': function () { 97 'serverLockValue': function () {
101 return this._serverLockValue; 98 return this._serverLockValue;
102 }, 99 },
103 100
104 'setServerLockValue': function (aValue) { 101 'setServerLockValue': function (aValue) {
105 this._serverLockValue = aValue; 102 this._serverLockValue = aValue;
106 }, 103 },
107 104
108 //------------------------------------------------------------------------- 105 //-------------------------------------------------------------------------
109 106
110 'transientState': function () { 107 'transientState': function () {
111 if (this._transientState == null) { 108 if (this._transientState == null) {
112 this._transientState = {} 109 this._transientState = {}
113 } 110 }
114 111
115 return this._transientState; 112 return this._transientState;
116 }, 113 },
117 114
118 'resetTransientState': function (isCommitting) { 115 'resetTransientState': function (isCommitting) {
119 this._transientState = null; 116 this._transientState = null;
120 }, 117 },
121 118
122 //------------------------------------------------------------------------- 119 //-------------------------------------------------------------------------
123 120
124 'deferredLockForSection': function(aSectionName) { 121 'deferredLockForSection': function(aSectionName) {
125 return this._deferredLocks[aSectionName]; 122 return this._deferredLocks[aSectionName];
126 }, 123 },
127 124
128 //------------------------------------------------------------------------- 125 //-------------------------------------------------------------------------
129 126
130 'getPassphrase': function() { 127 'getPassphrase': function() {
131 var deferredResult; 128 var deferredResult;
132 129
133 deferredResult = new Clipperz.Async.Deferred("User.getPassphrase", {trace:false}); 130 deferredResult = new Clipperz.Async.Deferred("User.getPassphrase", {trace:false});
134 deferredResult.acquireLock(this.deferredLockForSection('passphrase')); 131 deferredResult.acquireLock(this.deferredLockForSection('passphrase'));
135 deferredResult.addMethod(this.data(), 'deferredGetOrSet', 'passphrase', this.getPassphraseFunction()); 132 deferredResult.addMethod(this.data(), 'deferredGetOrSet', 'passphrase', this.getPassphraseFunction());
136 deferredResult.releaseLock(this.deferredLockForSection('passphrase')); 133 deferredResult.releaseLock(this.deferredLockForSection('passphrase'));
137 deferredResult.callback(); 134 deferredResult.callback();
138 135
139 return deferredResult; 136 return deferredResult;
140 }, 137 },
141 138
142 'getPassphraseFunction': function () { 139 'getPassphraseFunction': function () {
143 return this._getPassphraseFunction; 140 return this._getPassphraseFunction;
144 }, 141 },
145 142
146 //------------------------------------------------------------------------- 143 //-------------------------------------------------------------------------
147 144
148 'getCredentials': function () { 145 'getCredentials': function () {
149 return Clipperz.Async.collectResults("User; get username and passphrase", { 146 return Clipperz.Async.collectResults("User; get username and passphrase", {
150 'username': MochiKit.Base.method(this, 'username'), 147 'username': MochiKit.Base.method(this, 'username'),
151 'password': MochiKit.Base.method(this, 'getPassphrase') 148 'password': MochiKit.Base.method(this, 'getPassphrase')
152 }, {trace:false})(); 149 }, {trace:false})();
153 }, 150 },
154 151
155 //------------------------------------------------------------------------- 152 //-------------------------------------------------------------------------
156 153
157 'changePassphrase': function (aNewValue) { 154 'changePassphrase': function (aNewValue) {
158 return this.updateCredentials(this.username(), aNewValue); 155 return this.updateCredentials(this.username(), aNewValue);
159 }, 156 },
160 157
161 //......................................................................... 158 //.........................................................................
162 159
163 'updateCredentials': function (aUsername, aPassphrase) { 160 'updateCredentials': function (aUsername, aPassphrase) {
164 vardeferredResult; 161 vardeferredResult;
165 162
166 deferredResult = new Clipperz.Async.Deferred("User.updateCredentials", {trace:false}); 163 deferredResult = new Clipperz.Async.Deferred("User.updateCredentials", {trace:false});
167 // deferredResult.addMethod(this, 'getPassphrase'); 164 // deferredResult.addMethod(this, 'getPassphrase');
168 // deferredResult.setValue('currentPassphrase'); 165 // deferredResult.setValue('currentPassphrase');
169 deferredResult.addMethod(this.connection(), 'ping'); 166 deferredResult.addMethod(this.connection(), 'ping');
170 deferredResult.addMethod(this, 'setUsername', aUsername) 167 deferredResult.addMethod(this, 'setUsername', aUsername)
171 deferredResult.acquireLock(this.deferredLockForSection('passphrase')); 168 deferredResult.acquireLock(this.deferredLockForSection('passphrase'));
172 deferredResult.addMethod(this.data(), 'deferredGetOrSet', 'passphrase', aPassphrase); 169 deferredResult.addMethod(this.data(), 'deferredGetOrSet', 'passphrase', aPassphrase);
173 deferredResult.releaseLock(this.deferredLockForSection('passphrase')); 170 deferredResult.releaseLock(this.deferredLockForSection('passphrase'));
174 // deferredResult.getValue('currentPassphrase'); 171 // deferredResult.getValue('currentPassphrase');
175 deferredResult.addMethod(this, 'prepareRemoteDataWithKey', aPassphrase); 172 deferredResult.addMethod(this, 'prepareRemoteDataWithKey', aPassphrase);
176 deferredResult.addMethod(this.connection(), 'updateCredentials', aUsername, aPassphrase); 173 deferredResult.addMethod(this.connection(), 'updateCredentials', aUsername, aPassphrase);
177 deferredResult.callback(); 174 deferredResult.callback();
178 175
179 return deferredResult; 176 return deferredResult;
180 }, 177 },
181 178
182 //------------------------------------------------------------------------- 179 //-------------------------------------------------------------------------
183 180
184 'initialSetupWithNoData': function () { 181 'initialSetupWithNoData': function () {
185 this._serverData = { 182 this._serverData = {
186 'version': '0.1', 183 'version': '0.1',
187 'statistics': "", 184 'statistics': "",
188 'header': { 185 'header': {
189 'data': null, 186 'data': null,
190 'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion, 187 'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion,
191 188
192 'recordsIndex': new Clipperz.PM.DataModel.User.Header.RecordIndex({ 189 'recordsIndex': new Clipperz.PM.DataModel.User.Header.RecordIndex({
193 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), 190 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'),
194 'recordsData': {'data':null, 'index':{}}, 191 'recordsData': {'data':null, 'index':{}},
195 'recordsStats': null, 192 'recordsStats': null,
196 'directLoginsData': {'data':null, 'index':{}}, 193 'directLoginsData': {'data':null, 'index':{}},
197 'encryptedDataVersion': Clipperz.PM.Crypto.encryptingFunctions.currentVersion, 194 'encryptedDataVersion': Clipperz.PM.Crypto.encryptingFunctions.currentVersion,
198 'retrieveRecordDetailFunction':MochiKit.Base.method(this, 'getRecordDetail') 195 'retrieveRecordDetailFunction':MochiKit.Base.method(this, 'getRecordDetail')
199 }), 196 }),
200 'preferences': new Clipperz.PM.DataModel.User.Header.Preferences({ 197 'preferences': new Clipperz.PM.DataModel.User.Header.Preferences({
201 'name':'preferences', 198 'name':'preferences',
202 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase') 199 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase')
203 }), 200 }),
204 'oneTimePasswords': new Clipperz.PM.DataModel.User.Header.OneTimePasswords({ 201 'oneTimePasswords': new Clipperz.PM.DataModel.User.Header.OneTimePasswords({
205 'name':'preferences', 202 'name':'preferences',
206 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase') 203 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase')
207 }) 204 })
208 } 205 }
209 }; 206 };
210 207
211 // this._serverLockValue = Clipperz.PM.Crypto.randomKey(); 208 // this._serverLockValue = Clipperz.PM.Crypto.randomKey();
212 }, 209 },
213 210
214 //......................................................................... 211 //.........................................................................
215 212
216 'registerAsNewAccount': function () { 213 'registerAsNewAccount': function () {