summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz
Unidiff
Diffstat (limited to 'frontend/beta/js/Clipperz') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/Base.js308
-rw-r--r--frontend/beta/js/Clipperz/ByteArray.js1426
-rw-r--r--frontend/beta/js/Clipperz/CSVProcessor.js348
-rw-r--r--frontend/beta/js/Clipperz/Crypto/AES.js836
-rw-r--r--frontend/beta/js/Clipperz/Crypto/Base.js1852
-rw-r--r--frontend/beta/js/Clipperz/Crypto/BigInt.js1760
-rw-r--r--frontend/beta/js/Clipperz/Crypto/BigInt_scoped.js1649
-rw-r--r--frontend/beta/js/Clipperz/Crypto/ECC.js960
-rw-r--r--frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Curve.js461
-rw-r--r--frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js526
-rw-r--r--frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Point.js67
-rw-r--r--frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Value.js377
-rw-r--r--frontend/beta/js/Clipperz/Crypto/PRNG.js854
-rw-r--r--frontend/beta/js/Clipperz/Crypto/RSA.js151
-rw-r--r--frontend/beta/js/Clipperz/Crypto/SHA.js296
-rw-r--r--frontend/beta/js/Clipperz/Crypto/SRP.js331
-rw-r--r--frontend/beta/js/Clipperz/DOM.js131
-rw-r--r--frontend/beta/js/Clipperz/Date.js305
-rw-r--r--frontend/beta/js/Clipperz/KeePassExportProcessor.js251
-rw-r--r--frontend/beta/js/Clipperz/NotificationCenter.js325
-rw-r--r--frontend/beta/js/Clipperz/PM/BookmarkletProcessor.js288
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/BaseComponent.js124
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Compact/CompactHeader.js86
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Compact/CompactInterface.js312
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Compact/LoginForm.js189
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportColumns.js174
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportFields.js247
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportHeader.js240
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportNotes.js212
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportTitle.js189
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Import/CSVImportComponent.js548
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Import/ClipperzImportComponent.js212
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Import/ExcelImportComponent.js134
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Import/GenericImportComponent.js523
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Import/KeePassImportComponent.js450
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Import/MainComponent.js332
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Import/PasswordPlusImportComponent.js315
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Import/RoboFormImportComponent.js392
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/MessageBox.js224
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/OTP/MainComponent.js490
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Panels/AccountPanel.js784
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Panels/BasePanel.js96
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Panels/ContactsPanel.js105
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Panels/DataPanel.js486
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Panels/LoginPanel.js1114
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Panels/LogoutPanel.js73
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js906
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Panels/ToolsPanel.js305
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/PasswordEntropyDisplay.js118
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/PasswordGenerator.js285
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Printing/Footer.js28
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Printing/Header.js28
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Printing/Record.js95
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/AbstractComponent.js105
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/AbstractFieldSubComponent.js77
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/CreationWizard.js317
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js174
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginComponent.js362
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginValueComponent.js257
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginsComponent.js199
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldButtonComponent.js117
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldComponent.js189
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldDragHandler.js59
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldLabelComponent.js141
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldTypeComponent.js157
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldValueComponent.js275
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/HeaderComponent.js165
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/MainComponent.js758
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/NotesComponent.js240
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/TitleComponent.js137
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/TabPanel/TabPanelController.js158
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/TextFormField.js310
-rw-r--r--frontend/beta/js/Clipperz/PM/Connection.js584
-rw-r--r--frontend/beta/js/Clipperz/PM/Crypto.js503
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js536
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/DirectLoginBinding.js113
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js229
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js192
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/Header.js751
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/OneTimePassword.js333
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js280
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/Record.js759
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/RecordField.js220
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/RecordVersion.js535
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/Statistics.js133
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/User.js904
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js197
-rw-r--r--frontend/beta/js/Clipperz/PM/Date.js193
-rw-r--r--frontend/beta/js/Clipperz/PM/Main.js588
-rw-r--r--frontend/beta/js/Clipperz/PM/Proxy.js173
-rwxr-xr-xfrontend/beta/js/Clipperz/PM/Proxy/Proxy.JSON.js100
-rw-r--r--frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js804
-rw-r--r--frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.js73
-rwxr-xr-xfrontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js259
-rw-r--r--frontend/beta/js/Clipperz/PM/Proxy/Proxy.Test.js94
-rw-r--r--frontend/beta/js/Clipperz/PM/Strings.js231
-rw-r--r--frontend/beta/js/Clipperz/PM/Strings/MessagePanelConfigurations.js389
-rw-r--r--frontend/beta/js/Clipperz/PM/Strings/Strings_de-DE.js352
-rw-r--r--frontend/beta/js/Clipperz/PM/Strings/Strings_el-GR.js701
-rw-r--r--frontend/beta/js/Clipperz/PM/Strings/Strings_en-CA.js43
-rw-r--r--frontend/beta/js/Clipperz/PM/Strings/Strings_en-GB.js43
-rw-r--r--frontend/beta/js/Clipperz/PM/Strings/Strings_en-US.js1259
-rw-r--r--frontend/beta/js/Clipperz/PM/Strings/Strings_es-ES.js480
-rw-r--r--frontend/beta/js/Clipperz/PM/Strings/Strings_fr-FR.js362
-rw-r--r--frontend/beta/js/Clipperz/PM/Strings/Strings_he-IL.js40
-rw-r--r--frontend/beta/js/Clipperz/PM/Strings/Strings_it-IT.js694
-rw-r--r--frontend/beta/js/Clipperz/PM/Strings/Strings_ja-JP.js808
-rw-r--r--frontend/beta/js/Clipperz/PM/Strings/Strings_pt-BR.js478
-rw-r--r--frontend/beta/js/Clipperz/PM/Strings/Strings_pt-PT.js42
-rw-r--r--frontend/beta/js/Clipperz/PM/Strings/Strings_ru-RU.js440
-rw-r--r--frontend/beta/js/Clipperz/PM/Strings/Strings_zh-CN.js477
-rw-r--r--frontend/beta/js/Clipperz/PM/Toll.js193
-rw-r--r--frontend/beta/js/Clipperz/Profile.js485
-rw-r--r--frontend/beta/js/Clipperz/Set.js167
-rw-r--r--frontend/beta/js/Clipperz/Signal.js71
-rw-r--r--frontend/beta/js/Clipperz/Style.js73
-rw-r--r--frontend/beta/js/Clipperz/YUI/Collapser.js73
-rw-r--r--frontend/beta/js/Clipperz/YUI/DomHelper.js465
-rw-r--r--frontend/beta/js/Clipperz/YUI/DomQuery.js710
-rw-r--r--frontend/beta/js/Clipperz/YUI/Drawer.js238
-rw-r--r--frontend/beta/js/Clipperz/YUI/IBLayoutManager.js114
-rw-r--r--frontend/beta/js/Clipperz/YUI/IBLayoutRegion.js249
-rw-r--r--frontend/beta/js/Clipperz/YUI/MessageBox.js265
123 files changed, 46010 insertions, 0 deletions
diff --git a/frontend/beta/js/Clipperz/Base.js b/frontend/beta/js/Clipperz/Base.js
new file mode 100644
index 0000000..5bd972b
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Base.js
@@ -0,0 +1,308 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.Base) == 'undefined') { Clipperz.Base = {}; }
31
32Clipperz.Base.VERSION = "0.1";
33Clipperz.Base.NAME = "Clipperz.Base";
34
35MochiKit.Base.update(Clipperz.Base, {
36
37 //-------------------------------------------------------------------------
38
39 '__repr__': function () {
40 return "[" + this.NAME + " " + this.VERSION + "]";
41 },
42
43 //-------------------------------------------------------------------------
44
45 'toString': function () {
46 return this.__repr__();
47 },
48
49 //-------------------------------------------------------------------------
50
51 'trim': function (aValue) {
52 return aValue.replace(/^\s+|\s+$/g, "");
53 },
54
55 //-------------------------------------------------------------------------
56
57 'stringToByteArray': function (aValue) {
58 varresult;
59 var i, c;
60
61 result = [];
62
63 c = aValue.length;
64 for (i=0; i<c; i++) {
65 result[i] = aValue.charCodeAt(i);
66 }
67
68 return result;
69 },
70
71 //.........................................................................
72
73 'byteArrayToString': function (anArrayOfBytes) {
74 varresult;
75 var i, c;
76
77 result = "";
78
79 c = anArrayOfBytes.length;
80 for (i=0; i<c; i++) {
81 result += String.fromCharCode(anArrayOfBytes[i]);
82 }
83
84 return result;
85 },
86
87 //-------------------------------------------------------------------------
88
89 'getValueForKeyInFormContent': function (aFormContent, aKey) {
90 return aFormContent[1][MochiKit.Base.find(aFormContent[0], aKey)];
91 },
92
93 //-------------------------------------------------------------------------
94
95 'indexOfObjectInArray': function(anObject, anArray) {
96 varresult;
97 vari, c;
98
99 result = -1;
100
101 c = anArray.length;
102 for (i=0; ((i<c) && (result < 0)); i++) {
103 if (anArray[i] === anObject) {
104 result = i;
105 }
106 }
107
108 return result;
109 },
110
111 'removeObjectAtIndexFromArray': function(anIndex, anArray) {
112 anArray.splice(anIndex, 1);
113 },
114
115 'removeObjectFromArray': function(anObject, anArray) {
116 varobjectIndex;
117
118 objectIndex = Clipperz.Base.indexOfObjectInArray(anObject, anArray);
119 if (objectIndex > -1) {
120 Clipperz.Base.removeObjectAtIndexFromArray(objectIndex, anArray);
121 } else {
122 // jslog.error("Trying to remove an object not present in the array");
123 //TODO: raise an exception
124 }
125 },
126
127 'removeFromArray': function(anArray, anObject) {
128 return Clipperz.Base.removeObjectFromArray(anObject, anArray);
129 },
130
131 //-------------------------------------------------------------------------
132
133 'splitStringAtFixedTokenSize': function(aString, aTokenSize) {
134 var result;
135 varstringToProcess;
136
137 stringToProcess = aString;
138 result = [];
139 if (stringToProcess != null) {
140 while (stringToProcess.length > aTokenSize) {
141 result.push(stringToProcess.substring(0, aTokenSize));
142 stringToProcess = stringToProcess.substring(aTokenSize);
143 }
144
145 result.push(stringToProcess);
146 }
147
148 return result;
149 },
150
151 //-------------------------------------------------------------------------
152
153 'objectType': function(anObject) {
154 var result;
155
156 if (anObject == null) {
157 result = null;
158 } else {
159 result = typeof(anObject);
160
161 if (result == "object") {
162 if (anObject instanceof Array) {
163 result = 'array'
164 } else if (anObject.constructor == Boolean) {
165 result = 'boolean'
166 } else if (anObject instanceof Date) {
167 result = 'date'
168 } else if (anObject instanceof Error) {
169 result = 'error'
170 } else if (anObject instanceof Function) {
171 result = 'function'
172 } else if (anObject.constructor == Number) {
173 result = 'number'
174 } else if (anObject.constructor == String) {
175 result = 'string'
176 } else if (anObject instanceof Object) {
177 result = 'object'
178 } else {
179 throw Clipperz.Base.exception.UnknownType;
180 }
181 }
182 }
183
184 return result;
185 },
186
187 //-------------------------------------------------------------------------
188
189 'escapeHTML': function(aValue) {
190 var result;
191
192 result = aValue;
193 result = result.replace(/</g, "&lt;");
194 result = result.replace(/>/g, "&gt;");
195
196 return result;
197 },
198
199 //-------------------------------------------------------------------------
200
201 'deepClone': function(anObject) {
202 var result;
203
204 result = Clipperz.Base.evalJSON(Clipperz.Base.serializeJSON(anObject));
205
206 return result;
207 },
208
209 //-------------------------------------------------------------------------
210
211 'evalJSON': function(aString) {
212/*
213 var result;
214
215 //check for XSS injection
216 if (/<script>/.test(aString)) {
217 throw "error";
218 }
219
220 if (/<iframe>/.test(aString)) {
221 throw "error";
222 }
223
224 result = MochiKit.Base.evalJSON(aString);
225
226 return result;
227*/
228
229 // return MochiKit.Base.evalJSON(aString);
230 return JSON2.parse(aString);
231 },
232
233 'serializeJSON': function(anObject) {
234 // return MochiKit.Base.serializeJSON(anObject);
235 return JSON2.stringify(anObject);
236 },
237
238 //-------------------------------------------------------------------------
239
240 'sanitizeString': function(aValue) {
241 var result;
242
243 if (Clipperz.Base.objectType(aValue) == 'string') {
244 result = aValue;
245 result = result.replace(/</img,"&lt;");
246 result = result.replace(/>/img,"&gt;");
247 } else {
248 result = aValue;
249 }
250
251 return result;
252 },
253
254 //-------------------------------------------------------------------------
255
256 'exception': {
257 'AbstractMethod': new MochiKit.Base.NamedError("Clipperz.Base.exception.AbstractMethod"),
258 'UnknownType': new MochiKit.Base.NamedError("Clipperz.Base.exception.UnknownType"),
259 'VulnerabilityIssue':new MochiKit.Base.NamedError("Clipperz.Base.exception.VulnerabilityIssue")
260 },
261
262 //-------------------------------------------------------------------------
263 __syntaxFix__: "syntax fix"
264
265});
266
267
268
269MochiKit.Base.registerComparator('Object dummy comparator',
270 function(a, b) {
271 return ((a.constructor == Object) && (b.constructor == Object));
272 },
273 function(a, b) {
274 var result;
275 var aKeys;
276 var bKeys;
277
278//MochiKit.Logging.logDebug(">>> comparator");
279//MochiKit.Logging.logDebug("- a: " + Clipperz.Base.serializeJSON(a));
280//MochiKit.Logging.logDebug("- b: " + Clipperz.Base.serializeJSON(a));
281 aKeys = MochiKit.Base.keys(a).sort();
282 bKeys = MochiKit.Base.keys(b).sort();
283
284 result = MochiKit.Base.compare(aKeys, bKeys);
285//if (result != 0) {
286 //MochiKit.Logging.logDebug("- comparator 'keys':");
287 //MochiKit.Logging.logDebug("- comparator aKeys: " + Clipperz.Base.serializeJSON(aKeys));
288 //MochiKit.Logging.logDebug("- comparator bKeys: " + Clipperz.Base.serializeJSON(bKeys));
289//}
290 if (result == 0) {
291 vari, c;
292
293 c = aKeys.length;
294 for (i=0; (i<c) && (result == 0); i++) {
295 result = MochiKit.Base.compare(a[aKeys[i]], b[bKeys[i]]);
296//if (result != 0) {
297 //MochiKit.Logging.logDebug("- comparator 'values':");
298 //MochiKit.Logging.logDebug("- comparator a[aKeys[i]]: " + Clipperz.Base.serializeJSON(a[aKeys[i]]));
299 //MochiKit.Logging.logDebug("- comparator b[bKeys[i]]: " + Clipperz.Base.serializeJSON(b[bKeys[i]]));
300//}
301 }
302 }
303
304//MochiKit.Logging.logDebug("<<< comparator - result: " + result);
305 return result;
306 },
307 true
308);
diff --git a/frontend/beta/js/Clipperz/ByteArray.js b/frontend/beta/js/Clipperz/ByteArray.js
new file mode 100644
index 0000000..2275087
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/ByteArray.js
@@ -0,0 +1,1426 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30
31//=============================================================================
32
33Clipperz.ByteArray_abstract = function(args) {
34 return this;
35}
36
37Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, {
38
39 //-------------------------------------------------------------------------
40
41 'toString': function() {
42 return "Clipperz.ByteArray_abstract";
43 },
44
45 //-------------------------------------------------------------------------
46
47 'equals': function(aValue) {
48 return (this.compare(aValue) == 0);
49 },
50
51 //-------------------------------------------------------------------------
52
53 'compare': function(aValue) {
54 var result;
55 var i;
56
57 result = MochiKit.Base.compare(this.length(), aValue.length());
58 i = this.length();
59
60 while ((result == 0) && (i>0)) {
61 i--;
62 result = MochiKit.Base.compare(this.byteAtIndex(i), aValue.byteAtIndex(i));
63 }
64
65 return result;
66 },
67
68 //-------------------------------------------------------------------------
69
70 'clone': function() {
71 throw Clipperz.Base.exception.AbstractMethod;
72 },
73
74 //-------------------------------------------------------------------------
75
76 'newInstance': function() {
77 throw Clipperz.Base.exception.AbstractMethod;
78 },
79
80 //-------------------------------------------------------------------------
81
82 'reset': function() {
83 throw Clipperz.Base.exception.AbstractMethod;
84 },
85
86 //-------------------------------------------------------------------------
87
88 'length': function() {
89 throw Clipperz.Base.exception.AbstractMethod;
90 },
91
92 //-------------------------------------------------------------------------
93
94 'checkValue': function(aValue) {
95 if ((aValue & 0xff) != aValue) {
96 MochiKit.Logging.logError("Clipperz.ByteArray.appendByte: the provided value (0x" + aValue.toString(16) + ") is not a byte value.");
97 throw Clipperz.ByteArray.exception.InvalidValue;
98 }
99 },
100
101 //-------------------------------------------------------------------------
102
103 'xorMergeWithBlock': function(aBlock, anAllignment, paddingMode) {
104 var result;
105 var a, b;
106 var aLength;
107 var bLength;
108 var i, c;
109
110 if (this.length() > aBlock.length()) {
111 a = this;
112 b = aBlock;
113 } else {
114 a = aBlock;
115 b = this;
116 }
117
118 aLength = a.length();
119 bLength = b.length();
120
121 if (aLength != bLength) {
122 if (paddingMode == 'truncate') {
123 if (anAllignment == 'left') {
124 a = a.split(0, bLength);
125 } else {
126 a = a.split(aLength - bLength);
127 }
128 } else {
129 var ii, cc;
130 var padding;
131
132 // padding = new Clipperz.ByteArray();
133 padding = this.newInstance();
134 cc = aLength - bLength;
135 for (ii=0; ii<cc; ii++) {
136 padding.appendByte(0);
137 }
138
139 if (anAllignment == 'left') {
140 b = b.appendBlock(padding);
141 } else {
142 b = padding.appendBlock(b);
143 }
144 }
145 }
146
147
148 // result = new Clipperz.ByteArray();
149 result = this.newInstance();
150 c = a.length();
151 for (i=0; i<c; i++) {
152 result.appendByte(a.byteAtIndex(i) ^ b.byteAtIndex(i));
153 }
154
155 return result;
156 },
157
158 //-------------------------------------------------------------------------
159/*
160 'shiftLeft': function(aNumberOfBitsToShift) {
161 var result;
162
163 result = this.clone(); //???????????
164
165 return result;
166 },
167 */
168 //-------------------------------------------------------------------------
169
170 'appendBlock': function(aBlock) {
171 throw Clipperz.Base.exception.AbstractMethod;
172 },
173
174 //-------------------------------------------------------------------------
175
176 'appendByte': function(aValue) {
177 throw Clipperz.Base.exception.AbstractMethod;
178 },
179
180 'appendBytes': function(args) {
181 varvalues;
182 vari,c;
183
184 if (args.constructor == Array) {
185 values = args;
186 } else {
187 values = arguments;
188 }
189
190 c = values.length;
191 for (i=0; i<c; i++) {
192 this.appendByte(values[i]);
193 }
194
195 return this;
196 },
197
198 //-------------------------------------------------------------------------
199
200 'appendWord': function(aValue, isLittleEndian) {
201 var result;
202 var processAsLittleEndian;
203
204 processAsLittleEndian = isLittleEndian === true ? true : false;
205
206 if (processAsLittleEndian) {
207 result = this.appendBytes( (aValue) & 0xff, (aValue >> 8) & 0xff, (aValue >> 16) & 0xff, (aValue >> 24) & 0xff ); //little endian
208 } else {
209 result = this.appendBytes( (aValue >> 24) & 0xff, (aValue >> 16) & 0xff, (aValue >> 8) & 0xff, (aValue) & 0xff ); //big endian - DEFAULT
210 }
211
212 return result;
213 },
214
215 'appendWords': function(args) {
216 varvalues;
217 vari,c;
218
219 if (args.constructor == Array) {
220 values = args;
221 } else {
222 values = arguments;
223 }
224
225 c = values.length;
226 for (i=0; i<c; i++) {
227 this.appendWord(values[i], false);
228 }
229
230 return this;
231 },
232
233 //-------------------------------------------------------------------------
234
235 'appendBigEndianWords': function(args) {
236 varvalues;
237 vari,c;
238
239 if (args.constructor == Array) {
240 values = args;
241 } else {
242 values = arguments;
243 }
244
245 c = values.length;
246 for (i=0; i<c; i++) {
247 this.appendWord(values[i], true);
248 }
249
250 return this;
251 },
252
253 //-------------------------------------------------------------------------
254
255 'byteAtIndex': function(anIndex) {
256 throw Clipperz.Base.exception.AbstractMethod;
257 },
258
259 'setByteAtIndex': function(aValue, anIndex) {
260 throw Clipperz.Base.exception.AbstractMethod;
261 },
262
263 //-------------------------------------------------------------------------
264
265 'bitAtIndex': function(aBitPosition) {
266 var result;
267 varbytePosition;
268 var bitPositionInSelectedByte;
269 var selectedByte;
270 var selectedByteMask;
271
272 bytePosition = this.length() - Math.ceil((aBitPosition + 1)/ 8);
273 bitPositionInSelectedByte = aBitPosition % 8;
274 selectedByte = this.byteAtIndex(bytePosition);
275
276 if (bitPositionInSelectedByte > 0) {
277 selectedByteMask = (1 << bitPositionInSelectedByte);
278 } else {
279 selectedByteMask = 1;
280 }
281 result = selectedByte & selectedByteMask ? 1 : 0;
282//console.log("aBitPosition: " + aBitPosition + ", length: " + this.length() + ", bytePosition: " + bytePosition + ", bitPositionInSelectedByte: " + bitPositionInSelectedByte + ", selectedByteMask: " + selectedByteMask);
283
284 return result;
285 },
286
287 //-------------------------------------------------------------------------
288
289 'bitBlockAtIndexWithSize': function(aBitPosition, aSize) {
290 var result;
291 var bitValue;
292 var i,c;
293
294 result = 0;
295 c = aSize;
296 for (i=0; i<c; i++) {
297 bitValue = this.bitAtIndex(aBitPosition + i);
298 result = result | bitValue << i;
299 }
300
301 return result;
302 },
303
304 //-------------------------------------------------------------------------
305
306 'asString': function() {
307 varresult;
308 varlength;
309 vari;
310
311//var startTime = new Date();
312
313 //# result = "";
314 result = [];
315
316 i = 0;
317 length = this.length();
318
319 while (i < length) {
320 varcurrentCharacter;
321 varcurrentByte;
322 varunicode;
323
324 currentByte = this.byteAtIndex(i);
325
326 if ((currentByte & 0x80) == 0x00 ) { //0xxxxxxx
327 unicode = currentByte;
328 currentCharacter = String.fromCharCode(unicode);
329 } else if ((currentByte & 0xe0) == 0xc0 ) { //110xxxxx 10xxxxxx
330 unicode = (currentByte & 0x1f) << 6;
331 i++; currentByte = this.byteAtIndex(i);
332 unicode = unicode | (currentByte & 0x3f);
333
334 currentCharacter = String.fromCharCode(unicode);
335 } else if ((currentByte & 0xf0) == 0xe0 ) { //1110xxxx 10xxxxxx 10xxxxxx
336 unicode = (currentByte & 0x0f) << (6+6);
337 i++; currentByte = this.byteAtIndex(i);
338 unicode = unicode | ((currentByte & 0x3f) << 6);
339 i++; currentByte = this.byteAtIndex(i);
340 unicode = unicode | (currentByte & 0x3f);
341
342 currentCharacter = String.fromCharCode(unicode);
343 } else { //11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
344 unicode = (currentByte & 0x07) << (6+6+6);
345 i++; currentByte = this.byteAtIndex(i);
346 unicode = unicode | ((currentByte & 0x3f) << (6+6));
347 i++; currentByte = this.byteAtIndex(i);
348 unicode = unicode | ((currentByte & 0x3f) << 6);
349 i++; currentByte = this.byteAtIndex(i);
350 unicode = unicode | (currentByte & 0x3f);
351
352 currentCharacter = String.fromCharCode(unicode);
353 }
354
355 // result += currentCharacter;
356 result.push(currentCharacter);
357 i++;
358 }
359
360//MochiKit.Logging.logDebug("[" + (new Date() - startTime) + "] ByteArray.asString");
361
362 // return result;
363 return result.join("");
364 },
365
366 //-------------------------------------------------------------------------
367
368 'toHexString': function() {
369 throw Clipperz.Base.exception.AbstractMethod;
370 },
371
372 //-------------------------------------------------------------------------
373
374 'base64map': "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
375 'base64mapIndex': "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(''),
376 //'base64mapInvertedIndex': {
377 // 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7, 'I': 8, 'J': 9,
378 // 'K': 10, 'L': 11, 'M': 12, 'N': 13, 'O': 14, 'P': 15, 'Q': 16, 'R': 17, 'S': 18, 'T': 19,
379 // 'U': 20, 'V': 21, 'W': 22, 'X': 23, 'Y': 24, 'Z': 25, 'a': 26, 'b': 27, 'c': 28, 'd': 29,
380 // 'e': 30, 'f': 31, 'g': 32, 'h': 33, 'i': 34, 'j': 35, 'k': 36, 'l': 37, 'm': 38, 'n': 39,
381 // 'o': 40, 'p': 41, 'q': 42, 'r': 43, 's': 44, 't': 45, 'u': 46, 'v': 47, 'w': 48, 'x': 49,
382 // 'y': 50, 'z': 51, '0': 52, '1': 53, '2': 54, '3': 55, '4': 56, '5': 57, '6': 58, '7': 59,
383 // '8': 60, '9': 61, '+': 62, '/': 63,
384 // "=": -1},
385
386 //-------------------------------------------------------------------------
387
388 'appendBase64String': function(aValue) {
389 var i;
390 var length;
391
392 length = aValue.length;
393
394 if ((length % 4) != 0) {
395 MochiKit.Logging.logError("the value passed to the 'ByteArray.setBase64Value' is not correct");
396 throw Clipperz.ByteArray.exception.InvalidValue;
397 }
398
399 i = 0;
400 while (i<length) {
401 var value1, value2, value3, value4;
402 var byte1, byte2, byte3;
403
404 value1 = this.base64map.indexOf(aValue.charAt(i));
405 value2 = this.base64map.indexOf(aValue.charAt(i+1));
406 value3 = this.base64map.indexOf(aValue.charAt(i+2));
407 value4 = this.base64map.indexOf(aValue.charAt(i+3));
408
409 // value1 = this.base64mapInvertedIndex[aValue.charAt(i)];
410 // value2 = this.base64mapInvertedIndex[aValue.charAt(i+1)];
411 // value3 = this.base64mapInvertedIndex[aValue.charAt(i+2)];
412 // value4 = this.base64mapInvertedIndex[aValue.charAt(i+3)];
413
414 byte1 = (value1 << 2) | ((value2 & 0x30) >> 4);
415 if (value3 != -1) {
416 byte2 = ((value2 & 0x0f) << 4) | ((value3 & 0x3c) >> 2);
417
418 if (value4 != -1) {
419 byte3 = ((value3 & 0x03) << 6) | (value4);
420 } else {
421 byte3 = null;
422 }
423 } else {
424 byte2 = null;
425 byte3 = null;
426 }
427
428 this.appendByte(byte1);
429 this.appendByte(byte2);
430 this.appendByte(byte3);
431
432 i += 4;
433 }
434
435 return this;
436 },
437
438 //-------------------------------------------------------------------------
439
440 'toBase64String': function() {
441 var result;
442 var length;
443 var i;
444 var byte1, byte2, byte3;
445 var char1, char2, char3, char4;
446
447 i = 0;
448 length = this.length();
449 result = new Array(Math.ceil(length/3));
450
451 while (i < length) {
452 byte1 = this.byteAtIndex(i);
453 if ((i+2) < length) {
454 byte2 = this.byteAtIndex(i+1);
455 byte3 = this.byteAtIndex(i+2);
456 } else if ((i+2) == length) {
457 byte2 = this.byteAtIndex(i+1);
458 byte3 = null;
459 } else {
460 byte2 = null;
461 byte3 = null;
462 }
463
464 char1 = this.base64mapIndex[byte1 >> 2];
465 if (byte2 != null) {
466 char2 = this.base64mapIndex[((byte1 & 0x03) << 4) | ((byte2 & 0xf0) >> 4)];
467 if (byte3 != null) {
468 char3 = this.base64mapIndex[((byte2 & 0x0f) << 2) | ((byte3 & 0xc0) >> 6)];
469 char4 = this.base64mapIndex[(byte3 & 0x3f)];
470 } else {
471 char3 = this.base64mapIndex[(byte2 & 0x0f) << 2];
472 char4 = "=";
473 }
474 } else {
475 char2 = this.base64mapIndex[(byte1 & 0x03) << 4];
476 char3 = "=";
477 char4 = "=";
478 }
479
480 result.push(char1 + char2 + char3 + char4);
481
482 i += 3;
483 }
484
485 return result.join("");
486 },
487
488 //-------------------------------------------------------------------------
489
490 'base32map': "0123456789abcdefghjkmnpqrstvwxyz",
491 'base32mapIndex': "0123456789abcdefghjkmnpqrstvwxyz".split(''),
492
493 //-------------------------------------------------------------------------
494
495 'appendBase32String': function(aValue) {
496 var value;
497 var i;
498 var length;
499 var value1, value2, value3, value4, value5, value6, value7, value8;
500 var byte1, byte2, byte3, byte4, byte5;
501
502 value = aValue.toLowerCase();
503 value = value.replace(/[\s\-]/g, '');
504 value = value.replace(/[0o]/g, '0');
505 value = value.replace(/[1il]/g, '1');
506
507 length = value.length;
508
509 if ((length % 8) != 0) {
510 MochiKit.Logging.logError("the value passed to the 'ByteArray.setBase32Value' is not correct");
511 throw Clipperz.ByteArray.exception.InvalidValue;
512 }
513
514 i = 0;
515 while (i<length) {
516 value1 = this.base32map.indexOf(value.charAt(i));
517 value2 = this.base32map.indexOf(value.charAt(i+1));
518 value3 = this.base32map.indexOf(value.charAt(i+2));
519 value4 = this.base32map.indexOf(value.charAt(i+3));
520 value5 = this.base32map.indexOf(value.charAt(i+4));
521 value6 = this.base32map.indexOf(value.charAt(i+5));
522 value7 = this.base32map.indexOf(value.charAt(i+6));
523 value8 = this.base32map.indexOf(value.charAt(i+7));
524
525 byte1 = byte2 = byte3 = byte4 = byte5 = null;
526
527 byte1 = (value1 << 3) | ((value2 & 0x1c) >> 2);
528 if (value3 != -1) {
529 byte2 = ((value2 & 0x03) << 6) | (value3 << 1) | ((value4 & 0x10) >> 4);
530 if (value5 != -1) {
531 byte3 = ((value4 & 0x0f) << 4) | ((value5 & 0x1e) >> 1);
532 if (value6 != -1) {
533 byte4 = ((value5 & 0x01) << 7) | (value6 << 2) | ((value7 & 0x18) >> 3);
534 if (value8 != -1) {
535 byte5 = ((value7 & 0x07) << 5) | (value8);
536 }
537 }
538 }
539 }
540
541 this.appendByte(byte1);
542 this.appendByte(byte2);
543 this.appendByte(byte3);
544 this.appendByte(byte4);
545 this.appendByte(byte5);
546
547 i += 8;
548 }
549
550 return this;
551 },
552
553 //-------------------------------------------------------------------------
554
555 'toBase32String': function() {
556 var result;
557 var length;
558 var i;
559 var byte1, byte2, byte3, byte4, byte5;
560 var char1, char2, char3, char4, char5, char6, char7, char8;
561
562 i = 0;
563 length = this.length();
564 result = new Array(Math.ceil(length/5));
565
566 while (i < length) {
567 byte1 = this.byteAtIndex(i);
568
569 if ((i+4) < length) {
570 byte2 = this.byteAtIndex(i+1);
571 byte3 = this.byteAtIndex(i+2);
572 byte4 = this.byteAtIndex(i+3);
573 byte5 = this.byteAtIndex(i+4);
574 } else if ((i+4) == length) {
575 byte2 = this.byteAtIndex(i+1);
576 byte3 = this.byteAtIndex(i+2);
577 byte4 = this.byteAtIndex(i+3);
578 byte5 = null;
579 } else if ((i+3) == length) {
580 byte2 = this.byteAtIndex(i+1);
581 byte3 = this.byteAtIndex(i+2);
582 byte4 = null;
583 byte5 = null;
584 } else if ((i+2) == length) {
585 byte2 = this.byteAtIndex(i+1);
586 byte3 = null;
587 byte4 = null;
588 byte5 = null;
589 } else {
590 byte2 = null;
591 byte3 = null;
592 byte4 = null;
593 byte5 = null;
594 }
595
596
597 char1 = this.base32mapIndex[byte1 >> 3];
598 char2 = char3 = char4 = char5 = char6 = char7 = char8 = "=";
599
600 if (byte2 != null) {
601 char2 = this.base32mapIndex[((byte1 & 0x07) << 2) | ((byte2 & 0xc0) >> 6)];
602 char3 = this.base32mapIndex[((byte2 & 0x3e) >> 1)];
603 if (byte3 != null) {
604 char4 = this.base32mapIndex[((byte2 & 0x01) << 4) | ((byte3 & 0xf0) >> 4)];
605 if (byte4 != null) {
606 char5 = this.base32mapIndex[((byte3 & 0x0f) << 1) | ((byte4 & 0x80) >> 7)];
607 char6 = this.base32mapIndex[(byte4 & 0x7c) >> 2];
608 if (byte5 != null) {
609 char7 = this.base32mapIndex[((byte4 & 0x03) << 3) | ((byte5 & 0xe0) >> 5)];
610 char8 = this.base32mapIndex[(byte5 & 0x1f)];
611 } else {
612 char7 = this.base32mapIndex[(byte4 & 0x03) << 3];
613 }
614 } else {
615 char5 = this.base32mapIndex[(byte3 & 0x0f) << 1];
616 }
617
618 } else {
619 char4 = this.base32mapIndex[(byte2 & 0x01) << 4];
620 }
621 } else {
622 char2 = this.base32mapIndex[(byte1 & 0x07) << 2];
623 }
624
625 result.push(char1 + char2 + char3 + char4 + char5 + char6 + char7 + char8);
626 i += 5;
627 }
628
629 return result.join("");
630 },
631
632 //-------------------------------------------------------------------------
633
634 'split': function(aStartingIndex, anEndingIndex) {
635 throw Clipperz.Base.exception.AbstractMethod;
636 },
637
638 //-------------------------------------------------------------------------
639
640 'increment': function() {
641 var i;
642 var done;
643
644 done = false;
645 i = this.length() - 1;
646
647 while ((i>=0) && (done == false)) {
648 var currentByteValue;
649
650 currentByteValue = this.byteAtIndex(i);
651
652 if (currentByteValue == 0xff) {
653 this.setByteAtIndex(0, i);
654 if (i>= 0) {
655 i --;
656 } else {
657 done = true;
658 }
659 } else {
660 this.setByteAtIndex(currentByteValue + 1, i);
661 done = true;
662 }
663 }
664 },
665
666 //-------------------------------------------------------------------------
667
668 'arrayValues': function() {
669 throw Clipperz.Base.exception.AbstractMethod;
670 },
671
672 //-------------------------------------------------------------------------
673 __syntaxFix__: "syntax fix"
674
675});
676
677//=============================================================================
678//
679 //Clipperz.ByteArray_hex
680//
681//=============================================================================
682Clipperz.ByteArray_hex = function (args) {
683 this._value = "";
684
685 if (typeof(args) != 'undefined') {
686 if (args.constructor == Array) {
687 this.appendBytes(args);
688 } else if (args.constructor == String) {
689 if (args.indexOf("0x") == 0) {
690 varvalue;
691
692 value = args.substring(2).toLowerCase();
693 if (/[0123456789abcdef]*/.test(value)) {
694 if ((value.length % 2) == 0) {
695 this._value = value;
696 } else {
697 this._value = "0" + value;
698 }
699 } else {
700MochiKit.Logging.logError("Clipperz.ByteArray should be inizialized with an hex string.");
701 throw Clipperz.ByteArray.exception.InvalidValue;
702 }
703 } else {
704 varvalue;
705 vari,c;
706
707 c = args.length;
708 value = new Array(c);
709 for (i=0; i<c; i++) {
710 value.push(Clipperz.ByteArray.unicodeToUtf8HexString(args.charCodeAt(i)));
711 }
712
713 this._value = value.join("");
714 }
715 } else {
716 this.appendBytes(MochiKit.Base.extend(null, arguments));
717 }
718 }
719 return this;
720}
721
722Clipperz.ByteArray_hex.prototype = MochiKit.Base.update(new Clipperz.ByteArray_abstract(), {
723
724 //-------------------------------------------------------------------------
725
726 'toString': function() {
727 return "Clipperz.ByteArray_hex";
728 },
729
730 //-------------------------------------------------------------------------
731
732 'clone': function() {
733 var result;
734
735 result = this.newInstance();
736 result._value = this._value;
737
738 return result;
739 },
740
741 //-------------------------------------------------------------------------
742
743 'newInstance': function() {
744 return new Clipperz.ByteArray_hex();
745 },
746
747 //-------------------------------------------------------------------------
748
749 'reset': function() {
750 this._value = "";
751 },
752
753 //-------------------------------------------------------------------------
754
755 'length': function() {
756 return (this._value.length / 2);
757 },
758
759 //-------------------------------------------------------------------------
760
761 'appendBlock': function(aBlock) {
762 this._value = this._value += aBlock.toHexString().substring(2);
763
764 return this;
765 },
766
767 //-------------------------------------------------------------------------
768
769 'appendByte': function(aValue) {
770 if (aValue != null) {
771 this.checkValue(aValue);
772 this._value += Clipperz.ByteArray.byteToHex(aValue);
773 }
774
775 return this;
776 },
777
778 //-------------------------------------------------------------------------
779
780 'byteAtIndex': function(anIndex) {
781 return parseInt(this._value.substr(anIndex*2, 2), 16);
782 },
783
784 'setByteAtIndex': function(aValue, anIndex) {
785 varmissingBytes;
786
787 this.checkValue(aValue);
788
789 missingBytes = anIndex - this.length();
790
791 if (missingBytes < 0) {
792 varcurrentValue;
793 varfirstCutIndex;
794 var secondCutIndex;
795
796 firstCutIndex = anIndex * 2;
797 secondCutIndex = firstCutIndex + 2;
798 currentValue = this._value;
799 this._value =currentValue.substring(0, firstCutIndex) +
800 Clipperz.ByteArray.byteToHex(aValue) +
801 currentValue.substring(secondCutIndex);
802 } else if (missingBytes == 0) {
803 this.appendByte(aValue);
804 } else {
805 var i,c;
806
807 c = missingBytes;
808 for (i=0; i<c; i++) {
809 this.appendByte(0);
810 }
811
812 this.appendByte(aValue);
813 }
814 },
815
816 //-------------------------------------------------------------------------
817
818 'toHexString': function() {
819 return "0x" + this._value;
820 },
821
822 //-------------------------------------------------------------------------
823
824 'split': function(aStartingIndex, anEndingIndex) {
825 var result;
826 varstartingIndex;
827 var endingIndex;
828
829 result = this.newInstance();
830
831 startingIndex = aStartingIndex * 2;
832 if (typeof(anEndingIndex) != 'undefined') {
833 endingIndex = anEndingIndex * 2;
834 result._value = this._value.substring(startingIndex, endingIndex);
835 } else {
836 result._value = this._value.substring(startingIndex);
837 }
838
839 return result;
840 },
841
842 //-------------------------------------------------------------------------
843
844 'arrayValues': function() {
845 var result;
846 var i,c;
847
848 c = this.length();
849
850 result = new Array(c);
851 for (i=0; i<c; i++) {
852 result[i] = this.byteAtIndex(i);
853 }
854
855 return result;
856 },
857
858 //-------------------------------------------------------------------------
859 __syntaxFix__: "syntax fix"
860});
861
862//=============================================================================
863//
864 //Clipperz.ByteArray_array
865//
866//=============================================================================
867
868Clipperz.ByteArray_array = function (args) {
869 if (typeof(args) != 'undefined') {
870 if (args.constructor == Array) {
871 this._value = args.slice(0);
872 } else if (args.constructor == String) {
873 var result;
874 varvalue;
875 var i, c;
876
877 if (args.indexOf("0x") == 0) {
878
879 value = args.substring(2).toLowerCase();
880 if (/[0123456789abcdef]*/.test(value)) {
881 if ((value.length % 2) != 0) {
882 value = "0" + value;
883 }
884 } else {
885MochiKit.Logging.logError("Clipperz.ByteArray should be inizialized with an hex string.");
886 throw Clipperz.ByteArray.exception.InvalidValue;
887 }
888
889 c = value.length / 2
890 result = new Array(c);
891 for (i=0; i<c; i++) {
892 result[i] = parseInt(value.substr(i*2, 2), 16);
893 }
894
895 } else {
896 var unicode;
897 result = [];
898 c = args.length;
899 for (i=0; i<c; i++) {
900 // Clipperz.ByteArray.pushUtf8BytesOfUnicodeChar(result, args.charCodeAt(i));
901
902 unicode = args.charCodeAt(i);
903 if (unicode <= 0x7f) { //0x00000000 - 0x0000007f -> 0xxxxxxx
904 result.push(unicode);
905 // } else if ((unicode >= 0x80) && (unicode <= 0x7ff)) { //0x00000080 - 0x000007ff -> 110xxxxx 10xxxxxx
906 } else if (unicode <= 0x7ff) { //0x00000080 - 0x000007ff -> 110xxxxx 10xxxxxx
907 result.push((unicode >> 6) | 0xc0);
908 result.push((unicode & 0x3F) | 0x80);
909 // } else if ((unicode >= 0x0800) && (unicode <= 0xffff)) { //0x00000800 - 0x0000ffff -> 1110xxxx 10xxxxxx 10xxxxxx
910 } else if (unicode <= 0xffff) { //0x00000800 - 0x0000ffff -> 1110xxxx 10xxxxxx 10xxxxxx
911 result.push((unicode >> 12) | 0xe0);
912 result.push(((unicode >> 6) & 0x3f) | 0x80);
913 result.push((unicode & 0x3f) | 0x80);
914 } else { //0x00010000 - 0x001fffff -> 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
915 result.push((unicode >> 18) | 0xf0);
916 result.push(((unicode >> 12) & 0x3f) | 0x80);
917 result.push(((unicode >> 6) & 0x3f) | 0x80);
918 result.push((unicode & 0x3f) | 0x80);
919 }
920 }
921 }
922
923
924 this._value = result;
925 } else {
926 this._value = [];
927 this.appendBytes(MochiKit.Base.extend(null, arguments));
928 }
929 } else {
930 this._value = [];
931 }
932
933 return this;
934}
935
936Clipperz.ByteArray_array.prototype = MochiKit.Base.update(new Clipperz.ByteArray_abstract(), {
937
938 //-------------------------------------------------------------------------
939
940 'toString': function() {
941 return "Clipperz.ByteArray_array";
942 },
943
944 //-------------------------------------------------------------------------
945
946 'clone': function() {
947 var result;
948
949 result = this.newInstance();
950 result.appendBytes(this._value);
951
952 return result;
953 },
954
955 //-------------------------------------------------------------------------
956
957 'newInstance': function() {
958 return new Clipperz.ByteArray_array();
959 },
960
961 //-------------------------------------------------------------------------
962
963 'reset': function() {
964 this._value = [];
965 },
966
967 //-------------------------------------------------------------------------
968
969 'length': function() {
970 return (this._value.length);
971 },
972
973 //-------------------------------------------------------------------------
974
975 'appendBlock': function(aBlock) {
976 MochiKit.Base.extend(this._value, aBlock._value);
977
978 return this;
979 },
980
981 //-------------------------------------------------------------------------
982
983 'appendByte': function(aValue) {
984 if (aValue != null) {
985 this.checkValue(aValue);
986 this._value.push(aValue);
987 }
988
989 return this;
990 },
991
992 //-------------------------------------------------------------------------
993
994 'byteAtIndex': function(anIndex) {
995 return this._value[anIndex];
996 },
997
998 'setByteAtIndex': function(aValue, anIndex) {
999 varmissingBytes;
1000
1001 this.checkValue(aValue);
1002
1003 missingBytes = anIndex - this.length();
1004
1005 if (missingBytes < 0) {
1006 this._value[anIndex] = aValue;
1007 } else if (missingBytes == 0) {
1008 this._value.push(aValue);
1009 } else {
1010 var i,c;
1011
1012 c = missingBytes;
1013 for (i=0; i<c; i++) {
1014 this._value.push(0);
1015 }
1016
1017 this._value.push(aValue);
1018 }
1019 },
1020
1021 //-------------------------------------------------------------------------
1022
1023 'toHexString': function() {
1024 var result;
1025 var i, c;
1026
1027 result = "0x";
1028 c = this.length();
1029 for (i=0; i<c; i++) {
1030 result += Clipperz.ByteArray.byteToHex(this._value[i]);
1031 }
1032
1033 return result;
1034 },
1035
1036 //-------------------------------------------------------------------------
1037
1038 'split': function(aStartingIndex, anEndingIndex) {
1039 var result;
1040
1041 result = this.newInstance();
1042 result._value = this._value.slice(aStartingIndex, anEndingIndex ? anEndingIndex : this.length());
1043
1044 return result;
1045 },
1046
1047 //-------------------------------------------------------------------------
1048
1049 'arrayValues': function() {
1050 return this._value.slice(0);
1051 },
1052
1053 //-------------------------------------------------------------------------
1054 __syntaxFix__: "syntax fix"
1055});
1056
1057
1058
1059
1060
1061//=============================================================================
1062//
1063 //Clipperz.ByteArray_string
1064//
1065//=============================================================================
1066
1067Clipperz.ByteArray_string = function (args) {
1068 this._value = "";
1069
1070 if (typeof(args) != 'undefined') {
1071 if (args.constructor == Array) {
1072 this.appendBytes(args);
1073 } else if (args.constructor == String) {
1074 var result;
1075 varvalue;
1076 var i, c;
1077
1078 if (args.indexOf("0x") == 0) {
1079
1080 value = args.substring(2).toLowerCase();
1081 if (/[0123456789abcdef]*/.test(value)) {
1082 if ((value.length % 2) != 0) {
1083 value = "0" + value;
1084 }
1085 } else {
1086MochiKit.Logging.logError("Clipperz.ByteArray should be inizialized with an hex string.");
1087 throw Clipperz.ByteArray.exception.InvalidValue;
1088 }
1089 } else {
1090 value = "";
1091 c = args.length;
1092 for (i=0; i<c; i++) {
1093 value += Clipperz.ByteArray.unicodeToUtf8HexString(args.charCodeAt(i));
1094 }
1095 }
1096
1097 c = value.length / 2
1098 for (i=0; i<c; i++) {
1099 this.appendByte(parseInt(value.substr(i*2, 2), 16));
1100 }
1101 } else {
1102 this.appendBytes(MochiKit.Base.extend(null, arguments));
1103 }
1104 }
1105
1106 return this;
1107}
1108
1109Clipperz.ByteArray_string.prototype = MochiKit.Base.update(new Clipperz.ByteArray_abstract(), {
1110
1111 //-------------------------------------------------------------------------
1112
1113 'toString': function() {
1114 return "Clipperz.ByteArray_string";
1115 },
1116
1117 //-------------------------------------------------------------------------
1118
1119 'clone': function() {
1120 var result;
1121
1122 result = this.newInstance();
1123 result._value = this._value;
1124
1125 return result;
1126 },
1127
1128 //-------------------------------------------------------------------------
1129
1130 'newInstance': function() {
1131 return new Clipperz.ByteArray_string();
1132 },
1133
1134 //-------------------------------------------------------------------------
1135
1136 'reset': function() {
1137 this._value = "";
1138 },
1139
1140 //-------------------------------------------------------------------------
1141
1142 'length': function() {
1143 return (this._value.length);
1144 },
1145
1146 //-------------------------------------------------------------------------
1147
1148 'appendBlock': function(aBlock) {
1149 this._value += aBlock._value;
1150
1151 return this;
1152 },
1153
1154 //-------------------------------------------------------------------------
1155
1156 'appendByte': function(aValue) {
1157 if (aValue != null) {
1158 this.checkValue(aValue);
1159 this._value += String.fromCharCode(aValue);
1160 }
1161
1162 return this;
1163 },
1164
1165 //-------------------------------------------------------------------------
1166
1167 'byteAtIndex': function(anIndex) {
1168 return this._value.charCodeAt(anIndex);
1169 },
1170
1171 'setByteAtIndex': function(aValue, anIndex) {
1172 varmissingBytes;
1173
1174 this.checkValue(aValue);
1175
1176 missingBytes = anIndex - this.length();
1177
1178 if (missingBytes < 0) {
1179 this._value = this._value.substring(0, anIndex) + String.fromCharCode(aValue) + this._value.substring(anIndex + 1);
1180 } else if (missingBytes == 0) {
1181 this.appendByte(aValue);
1182 } else {
1183 var i,c;
1184
1185 c = missingBytes;
1186 for (i=0; i<c; i++) {
1187 this.appendByte(0);
1188 }
1189
1190 this.appendByte(aValue);
1191 }
1192 },
1193
1194 //-------------------------------------------------------------------------
1195
1196 'toHexString': function() {
1197 var result;
1198 var i, c;
1199
1200 result = "0x";
1201 c = this.length();
1202 for (i=0; i<c; i++) {
1203 result += Clipperz.ByteArray.byteToHex(this.byteAtIndex(i));
1204 }
1205
1206 return result;
1207 },
1208
1209 //-------------------------------------------------------------------------
1210
1211 'split': function(aStartingIndex, anEndingIndex) {
1212 var result;
1213 result = this.newInstance();
1214 result._value = this._value.substring(aStartingIndex, anEndingIndex ? anEndingIndex : this.length());
1215
1216 return result;
1217 },
1218
1219 //-------------------------------------------------------------------------
1220
1221 'arrayValues': function() {
1222 var result;
1223 var i,c;
1224
1225 c = this.length();
1226
1227 result = new Array(c);
1228 for (i=0; i<c; i++) {
1229 result[i] = this.byteAtIndex(i);
1230 }
1231
1232 return result;
1233 },
1234
1235 //-------------------------------------------------------------------------
1236 __syntaxFix__: "syntax fix"
1237});
1238
1239
1240//=============================================================================
1241//
1242 //Clipperz.ByteArray
1243//
1244//=============================================================================
1245
1246Clipperz.ByteArray = Clipperz.ByteArray_array;
1247//Clipperz.ByteArray = Clipperz.ByteArray_string;
1248//Clipperz.ByteArray = Clipperz.ByteArray_hex;
1249
1250//#############################################################################
1251
1252Clipperz.ByteArray.byteToHex = function(aByte) {
1253 return ((aByte < 16) ? "0" : "") + aByte.toString(16);
1254}
1255
1256
1257Clipperz.ByteArray.unicodeToUtf8HexString = function(aUnicode) {
1258 var result;
1259 varself;
1260
1261 self = Clipperz.ByteArray;
1262
1263 if (aUnicode <= 0x7f) { //0x00000000 - 0x0000007f -> 0xxxxxxx
1264 result = self.byteToHex(aUnicode);
1265 // } else if ((aUnicode >= 0x80) && (aUnicode <= 0x7ff)) { //0x00000080 - 0x000007ff -> 110xxxxx 10xxxxxx
1266 } else if (aUnicode <= 0x7ff) { //0x00000080 - 0x000007ff -> 110xxxxx 10xxxxxx
1267 result = self.byteToHex((aUnicode >> 6) | 0xc0);
1268 result += self.byteToHex((aUnicode & 0x3F) | 0x80);
1269 // } else if ((aUnicode >= 0x0800) && (aUnicode <= 0xffff)) { //0x00000800 - 0x0000ffff -> 1110xxxx 10xxxxxx 10xxxxxx
1270 } else if (aUnicode <= 0xffff) { //0x00000800 - 0x0000ffff -> 1110xxxx 10xxxxxx 10xxxxxx
1271 result = self.byteToHex((aUnicode >> 12) | 0xe0);
1272 result += self.byteToHex(((aUnicode >> 6) & 0x3f) | 0x80);
1273 result += self.byteToHex((aUnicode & 0x3f) | 0x80);
1274 } else { //0x00010000 - 0x001fffff -> 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
1275 result = self.byteToHex((aUnicode >> 18) | 0xf0);
1276 result += self.byteToHex(((aUnicode >> 12) & 0x3f) | 0x80);
1277 result += self.byteToHex(((aUnicode >> 6) & 0x3f) | 0x80);
1278 result += self.byteToHex((aUnicode & 0x3f) | 0x80);
1279 }
1280
1281 return result;
1282}
1283
1284Clipperz.ByteArray.pushUtf8BytesOfUnicodeChar = function(anArray, aUnicode) {
1285 varself;
1286
1287 self = Clipperz.ByteArray;
1288
1289 if (aUnicode <= 0x7f) { //0x00000000 - 0x0000007f -> 0xxxxxxx
1290 anArray.push(aUnicode);
1291 // } else if ((aUnicode >= 0x80) && (aUnicode <= 0x7ff)) { //0x00000080 - 0x000007ff -> 110xxxxx 10xxxxxx
1292 } else if (aUnicode <= 0x7ff) { //0x00000080 - 0x000007ff -> 110xxxxx 10xxxxxx
1293 anArray.push((aUnicode >> 6) | 0xc0);
1294 anArray.push((aUnicode & 0x3F) | 0x80);
1295 // } else if ((aUnicode >= 0x0800) && (aUnicode <= 0xffff)) { //0x00000800 - 0x0000ffff -> 1110xxxx 10xxxxxx 10xxxxxx
1296 } else if (aUnicode <= 0xffff) { //0x00000800 - 0x0000ffff -> 1110xxxx 10xxxxxx 10xxxxxx
1297 anArray.push((aUnicode >> 12) | 0xe0);
1298 anArray.push(((aUnicode >> 6) & 0x3f) | 0x80);
1299 anArray.push((aUnicode & 0x3f) | 0x80);
1300 } else { //0x00010000 - 0x001fffff -> 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
1301 anArray.push((aUnicode >> 18) | 0xf0);
1302 anArray.push(((aUnicode >> 12) & 0x3f) | 0x80);
1303 anArray.push(((aUnicode >> 6) & 0x3f) | 0x80);
1304 anArray.push((aUnicode & 0x3f) | 0x80);
1305 }
1306}
1307
1308Clipperz.ByteArray.exception = {
1309 InvalidValue: new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.InvalidValue")
1310};
1311
1312//#############################################################################
1313
1314Clipperz.ByteArrayIterator = function(args) {
1315 args = args || {};
1316
1317 this._byteArray = args.byteArray;
1318 this._blockSize = args.blockSize;
1319 this._finalPadding = args.finalPadding || false;
1320
1321 this._currentPosition = 0;
1322
1323 return this;
1324}
1325
1326Clipperz.ByteArrayIterator.prototype = MochiKit.Base.update(null, {
1327
1328 //-------------------------------------------------------------------------
1329
1330 'toString': function() {
1331 return "Clipperz.ByteArrayIterator";
1332 },
1333
1334 //-------------------------------------------------------------------------
1335
1336 'blockSize': function() {
1337 var result;
1338
1339 result = this._blockSize;
1340
1341 return result;
1342 },
1343
1344 //-------------------------------------------------------------------------
1345
1346 'currentPosition': function() {
1347 var result;
1348
1349 result = this._currentPosition;
1350
1351 return result;
1352 },
1353
1354 //-------------------------------------------------------------------------
1355
1356 'byteArray': function() {
1357 var result;
1358
1359 result = this._byteArray;
1360
1361 return result;
1362 },
1363
1364 //-------------------------------------------------------------------------
1365
1366 'finalPadding': function() {
1367 var result;
1368
1369 result = this._finalPadding;
1370
1371 return result;
1372 },
1373
1374 //-------------------------------------------------------------------------
1375
1376 'nextBlock': function() {
1377 var result;
1378 var currentPosition;
1379 varbyteArrayLength;
1380
1381 currentPosition = this._currentPosition;
1382 byteArrayLength = this.byteArray().length();
1383
1384 if (currentPosition < byteArrayLength) {
1385 var i,c;
1386
1387 c = this.blockSize();
1388 result = new Array(c);
1389 for (i=0; i<c; i++) {
1390 if (currentPosition < byteArrayLength) {
1391 result[i] = this.byteArray().byteAtIndex(currentPosition);
1392 currentPosition++;
1393 } else if (this.finalPadding() == true) {
1394 result[i] = 0;
1395 }
1396 }
1397
1398 this._currentPosition = currentPosition;
1399 } else {
1400 result = null;
1401 }
1402
1403 return result;
1404 },
1405
1406 //-------------------------------------------------------------------------
1407
1408 'nextBlockArray': function() {
1409 var result;
1410 var nextBlock;
1411
1412 nextBlock = this.nextBlock();
1413
1414 if (nextBlock != null) {
1415 result = new Clipperz.ByteArray(nextBlock);
1416 } else {
1417 result = null;
1418 }
1419
1420 return result;
1421 },
1422
1423 //-----------------------------------------------------------------------------
1424 __syntaxFix__: "syntax fix"
1425
1426});
diff --git a/frontend/beta/js/Clipperz/CSVProcessor.js b/frontend/beta/js/Clipperz/CSVProcessor.js
new file mode 100644
index 0000000..164b02e
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/CSVProcessor.js
@@ -0,0 +1,348 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30
31
32Clipperz.CSVProcessor = function(args) {
33 args = args || {};
34
35 // this._status = undefined;
36 // this._error_input= undefined;
37 // this._string = undefined;
38 // this._fields = undefined;
39
40 this._quoteChar = args['quoteChar'] ||"\042";
41 this._eol = args['eol'] ||"";
42 this._escapeChar = args['escapeChar'] ||"\042";
43 this._separatorChar = args['separatorChar'] ||",";
44 this._binary = args['binary'] ||false;
45 this._alwaysQuote = args['alwaysQuote'] ||false;
46
47 return this;
48}
49
50//=============================================================================
51
52Clipperz.CSVProcessor.prototype = MochiKit.Base.update(null, {
53
54 //-------------------------------------------------------------------------
55
56 'quoteChar': function() {
57 return this._quoteChar;
58 },
59
60 //-------------------------------------------------------------------------
61
62 'eol': function() {
63 return this._eol;
64 },
65
66 //-------------------------------------------------------------------------
67
68 'escapeChar': function() {
69 return this._escapeChar;
70 },
71
72 //-------------------------------------------------------------------------
73
74 'separatorChar': function() {
75 return this._separatorChar;
76 },
77
78 'setSeparatorChar': function(aValue) {
79 this._separatorChar = aValue;
80 },
81
82 //-------------------------------------------------------------------------
83
84 'binary': function() {
85 return this._binary;
86 },
87
88 //-------------------------------------------------------------------------
89
90 'alwaysQuote': function() {
91 return this._alwaysQuote;
92 },
93
94 //-------------------------------------------------------------------------
95/*
96 'parse': function(aValue) {
97 var result;
98 var lines;
99 var parameter;
100
101//MochiKit.Logging.logDebug(">>> CSVProcessor.parse");
102 result = [];
103
104 lines = aValue.replace(/\r?\n/g, "\n").replace(/^\n* /g, "").replace(/\n$/g, "");;
105 parameter = {
106 line: lines
107 }
108
109 do {
110 var fields;
111
112 fields = this.parseLine(parameter);
113
114 if (fields != null) {
115 result.push(fields);
116 }
117
118 parameter.line = parameter.line.replace(/^\n* /g, "").replace(/\n$/g, "");
119
120//MochiKit.Logging.logDebug("line: '" + parameter.line + "'");
121 } while (parameter.line != "");
122//MochiKit.Logging.logDebug("--- CSVProcessor.parse - result: " + Clipperz.Base.serializeJSON(result));
123//MochiKit.Logging.logDebug("<<< CSVProcessor.parse");
124
125 return result;
126 },
127*/
128 //-------------------------------------------------------------------------
129
130 'deferredParse_core': function(aContext) {
131 var deferredResult;
132
133 if (aContext.line == "") {
134 deferredResult = MochiKit.Async.succeed(aContext.result);
135 } else {
136 var fields;
137
138 fields = this.parseLine(aContext);
139 if (fields != null) {
140 aContext.result.push(fields);
141 }
142
143 aContext.line = aContext.line.replace(/^\n*/g, "").replace(/\n$/g, "");
144
145 deferredResult = new MochiKit.Async.Deferred();
146 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'importProcessorProgressUpdate', {status:'processing', size:aContext.size, progress:(aContext.size - aContext.line.length)});
147 deferredResult.addCallback(MochiKit.Async.wait, 0.2);
148 deferredResult.addCallback(MochiKit.Base.method(this, 'deferredParse_core'))
149 deferredResult.callback(aContext);
150 }
151
152 return deferredResult;
153 },
154
155 //.........................................................................
156
157 'deferredParse': function(aValue) {
158 var deferredResult;
159 var lines;
160 var context;
161
162 lines = aValue.replace(/\r?\n/g, "\n").replace(/^\n*/g, "").replace(/\n$/g, "");
163
164 context = {
165 line: lines,
166 size: lines.length,
167 result: []
168 }
169
170 deferredResult = new MochiKit.Async.Deferred();
171 deferredResult.addCallback(MochiKit.Base.method(this, 'deferredParse_core'));
172 deferredResult.callback(context);
173
174 return deferredResult;
175 },
176
177 //-------------------------------------------------------------------------
178
179 'parseLine': function(aParameter) {
180 var result;
181 var palatable;
182 var line;
183 var processedField;
184
185 result = [];
186
187 do {
188 processedField = this.parseField(aParameter);
189 if (processedField != null) {
190 result.push(processedField)
191 };
192 } while (processedField != null);
193
194 return result;
195 },
196
197 //-------------------------------------------------------------------------
198
199 'parseField': function(aParameter) {
200 var result;
201
202 var inQuotes;
203 var validRegExp;
204 var singleQuoteBeginRegexp;
205 var escapedQuoteBeginRegexp;
206 var singleQuoteCommaEndRegexp;
207 var singleQuoteNewLineEndRegexp;
208 var commaBeginRegexp;
209 var newlineRegexp;
210
211
212 singleQuoteBeginRegexp = new RegExp("^" + '\\' + this.quoteChar());
213 escapedQuoteBeginRegexp = new RegExp("^" + '\\' + this.escapeChar() + '\\' + this.quoteChar());
214 singleQuoteCommaEndRegexp= new RegExp("^" + '\\' + this.quoteChar() + '\\' + this.separatorChar());
215 singleQuoteNewLineEndRegexp= new RegExp("^" + '\\' + this.quoteChar() + "\n");
216 commaBeginRegexp = new RegExp("^" + '\\' + this.separatorChar());
217 newlineRegexp = new RegExp("^\n");
218
219 inQuotes = false;
220
221//MochiKit.Logging.logDebug("#################################### '" + aParameter.line + "'");
222 if (aParameter.line == "") {
223 if (aParameter.isThereAnEmptyFinalField == true) {
224 aParameter.isThereAnEmptyFinalField = false;
225 result = "";
226 } else {
227 result = null;
228 }
229 } else {
230 if (this.binary()) {
231 validRegexp = /^./;
232 // validRegexp = /^[^\\]/;
233 } else {
234 validRegexp = /^[\t\040-\176]/;
235 }
236
237 try {
238 var done;
239
240 done = false;
241 result = "";
242
243 while (!done) {
244 if (aParameter.line.length < 1) {
245//MochiKit.Logging.logDebug("---> 1: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
246 if (inQuotes == true) {
247//MochiKit.Logging.logDebug("---> 1.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
248 throw new Error("CSV Parsing error; end of string, missing closing double-quote...");
249 } else {
250//MochiKit.Logging.logDebug("---> 1.2: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
251 done = true;
252 }
253 } else if (escapedQuoteBeginRegexp.test(aParameter.line)) {
254//MochiKit.Logging.logDebug("---> 2.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
255 result += this.quoteChar();
256 aParameter.line = aParameter.line.substr(2, aParameter.line.length - 1);
257//MochiKit.Logging.logDebug("<--- 2.2: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
258 } else if (singleQuoteBeginRegexp.test(aParameter.line)) {
259//MochiKit.Logging.logDebug("---> 3: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
260 if (inQuotes == true) {
261 if (aParameter.line.length == 1) {
262//MochiKit.Logging.logDebug("---> 3.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
263 aParameter.line = '';
264 done = true;
265 } else if (singleQuoteCommaEndRegexp.test(aParameter.line)) {
266//MochiKit.Logging.logDebug("---> 3.3: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
267 aParameter.line = aParameter.line.substr(2, aParameter.line.length - 1);
268 done = true;
269//MochiKit.Logging.logDebug("<--- 3.3: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
270 } else if (singleQuoteNewLineEndRegexp.test(aParameter.line)) {
271 aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1);
272 done = true;
273 } else {
274 throw new Error("CSV Parsing error; double-quote, followed by undesirable character (bad character sequence)... " + aParameter.line);
275 }
276 } else {
277//MochiKit.Logging.logDebug("---> 4: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
278 if (result == "") {
279//MochiKit.Logging.logDebug("---> 4.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
280 inQuotes = true;
281 aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1);
282//MochiKit.Logging.logDebug("<--- 4.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
283 } else {
284 throw new Error("CSV Parsing error; double-quote, outside of double-quotes (bad character sequence)...");
285 }
286 }
287 } else if (commaBeginRegexp.test(aParameter.line)) {
288//MochiKit.Logging.logDebug("---> 5: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
289 if (inQuotes) {
290//MochiKit.Logging.logDebug("---> 5.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
291 result += aParameter.line.substr(0 ,1);
292 aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1);
293//MochiKit.Logging.logDebug("<--- 5.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
294 } else {
295//MochiKit.Logging.logDebug("---> 5.2: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
296 aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1);
297 if (newlineRegexp.test(aParameter.line) || aParameter.line == "") {
298//MochiKit.Logging.logDebug("######");
299 aParameter.isThereAnEmptyFinalField = true;
300 };
301 done = true;
302//MochiKit.Logging.logDebug("<--- 5.2: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
303 }
304 } else if (validRegexp.test(aParameter.line)) {
305//MochiKit.Logging.logDebug("---> 6: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
306 result += aParameter.line.substr(0, 1);
307 aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1);
308//MochiKit.Logging.logDebug("<--- 6: '" + aParameter.line.replace(/\n/g, "\\n") + "'");
309 } else if (newlineRegexp.test(aParameter.line)) {
310 if (inQuotes == true) {
311 result += aParameter.line.substr(0 ,1);
312 aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1);
313 } else {
314 if (result == "") {
315 if (aParameter.isThereAnEmptyFinalField == true) {
316 aParameter.isThereAnEmptyFinalField = false;
317 } else {
318 result = null;
319 }
320 }
321
322 done = true;
323 }
324 } else {
325 throw new Error("CSV Parsing error; an undesirable character... '" + aParameter.line.substr(0,1) + "'");
326 }
327 }
328 } catch(exception) {
329 MochiKit.Logging.logError(exception.message);
330 // result = null;
331 throw exception;
332 }
333 }
334
335//if (result != null) {
336 //MochiKit.Logging.logDebug("<=== result: '" + result.replace(/\n/g, "\\n") + "'");
337//} else {
338 //MochiKit.Logging.logDebug("<=== result: NULL");
339//}
340
341 return result;
342 },
343
344 //-------------------------------------------------------------------------
345 __syntaxFix__: "syntax fix"
346});
347
348
diff --git a/frontend/beta/js/Clipperz/Crypto/AES.js b/frontend/beta/js/Clipperz/Crypto/AES.js
new file mode 100644
index 0000000..a60df5c
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Crypto/AES.js
@@ -0,0 +1,836 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.Crypto.AES depends on Clipperz.ByteArray!";
31}
32
33 //Dependency commented to avoid a circular reference
34//try { if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { throw ""; }} catch (e) {
35 //throw "Clipperz.Crypto.AES depends on Clipperz.Crypto.PRNG!";
36//}
37
38if (typeof(Clipperz.Crypto.AES) == 'undefined') { Clipperz.Crypto.AES = {}; }
39
40//#############################################################################
41
42Clipperz.Crypto.AES.DeferredExecutionContext = function(args) {
43 args = args || {};
44
45 this._key = args.key;
46 this._message = args.message;
47 this._result = args.message.clone();
48 this._nonce = args.nonce;
49 this._messageLength = this._message.length();
50
51 this._messageArray = this._message.arrayValues();
52 this._resultArray = this._result.arrayValues();
53 this._nonceArray = this._nonce.arrayValues();
54
55 this._executionStep = 0;
56
57 return this;
58}
59
60Clipperz.Crypto.AES.DeferredExecutionContext.prototype = MochiKit.Base.update(null, {
61
62 'key': function() {
63 return this._key;
64 },
65
66 'message': function() {
67 return this._message;
68 },
69
70 'messageLength': function() {
71 return this._messageLength;
72 },
73
74 'result': function() {
75 return new Clipperz.ByteArray(this.resultArray());
76 },
77
78 'nonce': function() {
79 return this._nonce;
80 },
81
82 'messageArray': function() {
83 return this._messageArray;
84 },
85
86 'resultArray': function() {
87 return this._resultArray;
88 },
89
90 'nonceArray': function() {
91 return this._nonceArray;
92 },
93
94 'elaborationChunkSize': function() {
95 return Clipperz.Crypto.AES.DeferredExecution.chunkSize;
96 },
97
98 'executionStep': function() {
99 return this._executionStep;
100 },
101
102 'setExecutionStep': function(aValue) {
103 this._executionStep = aValue;
104 },
105
106 'pause': function(aValue) {
107 return MochiKit.Async.wait(Clipperz.Crypto.AES.DeferredExecution.pauseTime, aValue);
108 },
109
110 //-----------------------------------------------------------------------------
111 __syntaxFix__: "syntax fix"
112
113});
114
115//#############################################################################
116
117Clipperz.Crypto.AES.Key = function(args) {
118 args = args || {};
119
120 this._key = args.key;
121 this._keySize = args.keySize || this.key().length();
122
123 if (this.keySize() == 128/8) {
124 this._b = 176;
125 this._numberOfRounds = 10;
126 } else if (this.keySize() == 256/8) {
127 this._b = 240;
128 this._numberOfRounds = 14;
129 } else {
130 MochiKit.Logging.logError("AES unsupported key size: " + (this.keySize() * 8) + " bits");
131 throw Clipperz.Crypto.AES.exception.UnsupportedKeySize;
132 }
133
134 this._stretchedKey = null;
135
136 return this;
137}
138
139Clipperz.Crypto.AES.Key.prototype = MochiKit.Base.update(null, {
140
141 'asString': function() {
142 return "Clipperz.Crypto.AES.Key (" + this.key().toHexString() + ")";
143 },
144
145 //-----------------------------------------------------------------------------
146
147 'key': function() {
148 return this._key;
149 },
150
151 'keySize': function() {
152 return this._keySize;
153 },
154
155 'b': function() {
156 return this._b;
157 },
158
159 'numberOfRounds': function() {
160 return this._numberOfRounds;
161 },
162 //=========================================================================
163
164 'keyScheduleCore': function(aWord, aRoundConstantsIndex) {
165 varresult;
166 var sbox;
167
168 sbox = Clipperz.Crypto.AES.sbox();
169
170 result = [sbox[aWord[1]] ^ Clipperz.Crypto.AES.roundConstants()[aRoundConstantsIndex],
171 sbox[aWord[2]],
172 sbox[aWord[3]],
173 sbox[aWord[0]]];
174
175 return result;
176 },
177
178 //-----------------------------------------------------------------------------
179
180 'xorWithPreviousStretchValues': function(aKey, aWord, aPreviousWordIndex) {
181 varresult;
182 var i,c;
183
184 result = [];
185 c = 4;
186 for (i=0; i<c; i++) {
187 result[i] = aWord[i] ^ aKey.byteAtIndex(aPreviousWordIndex + i);
188 }
189
190 return result;
191 },
192
193 //-----------------------------------------------------------------------------
194
195 'sboxShakeup': function(aWord) {
196 var result;
197 var sbox;
198 var i,c;
199
200 result = [];
201 sbox = Clipperz.Crypto.AES.sbox();
202 c =4;
203 for (i=0; i<c; i++) {
204 result[i] = sbox[aWord[i]];
205 }
206
207 return result;
208 },
209
210 //-----------------------------------------------------------------------------
211
212 'stretchKey': function(aKey) {
213 varcurrentWord;
214 varkeyLength;
215 varpreviousStretchIndex;
216 var i,c;
217
218 keyLength = aKey.length();
219 previousStretchIndex = keyLength - this.keySize();
220
221 currentWord = [aKey.byteAtIndex(keyLength - 4),
222 aKey.byteAtIndex(keyLength - 3),
223 aKey.byteAtIndex(keyLength - 2),
224 aKey.byteAtIndex(keyLength - 1)];
225 currentWord = this.keyScheduleCore(currentWord, keyLength / this.keySize());
226
227 if (this.keySize() == 256/8) {
228 c = 8;
229 } else if (this.keySize() == 128/8){
230 c = 4;
231 }
232
233 for (i=0; i<c; i++) {
234 if (i == 4) {
235 //fifth streatch word
236 currentWord = this.sboxShakeup(currentWord);
237 }
238
239 currentWord = this.xorWithPreviousStretchValues(aKey, currentWord, previousStretchIndex + (i*4));
240 aKey.appendBytes(currentWord);
241 }
242
243 return aKey;
244 },
245
246 //-----------------------------------------------------------------------------
247
248 'stretchedKey': function() {
249 if (this._stretchedKey == null) {
250 var stretchedKey;
251
252 stretchedKey = this.key().clone();
253
254 while (stretchedKey.length() < this.keySize()) {
255 stretchedKey.appendByte(0);
256 }
257
258 while (stretchedKey.length() < this.b()) {
259 stretchedKey = this.stretchKey(stretchedKey);
260 }
261
262 this._stretchedKey = stretchedKey.split(0, this.b());
263 }
264
265 return this._stretchedKey;
266 },
267
268 //=========================================================================
269 __syntaxFix__: "syntax fix"
270});
271
272//#############################################################################
273
274Clipperz.Crypto.AES.State = function(args) {
275 args = args || {};
276
277 this._data = args.block;
278 this._key = args.key;
279
280 return this;
281}
282
283Clipperz.Crypto.AES.State.prototype = MochiKit.Base.update(null, {
284
285 'key': function() {
286 return this._key;
287 },
288
289 //-----------------------------------------------------------------------------
290
291 'data': function() {
292 return this._data;
293 },
294
295 'setData': function(aValue) {
296 this._data = aValue;
297 },
298
299 //=========================================================================
300
301 'addRoundKey': function(aRoundNumber) {
302 //each byte of the state is combined with the round key; each round key is derived from the cipher key using a key schedule.
303 vardata;
304 varstretchedKey;
305 varfirstStretchedKeyIndex;
306 var i,c;
307
308 data = this.data();
309 stretchedKey = this.key().stretchedKey();
310 firstStretchedKeyIndex = aRoundNumber * (128/8);
311 c = 128/8;
312 for (i=0; i<c; i++) {
313 data[i] = data[i] ^ stretchedKey.byteAtIndex(firstStretchedKeyIndex + i);
314 }
315 },
316
317 //-----------------------------------------------------------------------------
318
319 'subBytes': function() {
320 // a non-linear substitution step where each byte is replaced with another according to a lookup table.
321 var i,c;
322 vardata;
323 var sbox;
324
325 data = this.data();
326 sbox = Clipperz.Crypto.AES.sbox();
327
328 c = 16;
329 for (i=0; i<c; i++) {
330 data[i] = sbox[data[i]];
331 }
332 },
333
334 //-----------------------------------------------------------------------------
335
336 'shiftRows': function() {
337 //a transposition step where each row of the state is shifted cyclically a certain number of steps.
338 varnewValue;
339 vardata;
340 varshiftMapping;
341 vari,c;
342
343 newValue = new Array(16);
344 data = this.data();
345 shiftMapping = Clipperz.Crypto.AES.shiftRowMapping();
346 // [0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, 1, 6, 11];
347 c = 16;
348 for (i=0; i<c; i++) {
349 newValue[i] = data[shiftMapping[i]];
350 }
351 for (i=0; i<c; i++) {
352 data[i] = newValue[i];
353 }
354 },
355
356 //-----------------------------------------------------------------------------
357/*
358 'mixColumnsWithValues': function(someValues) {
359 varresult;
360 vara;
361 var i,c;
362
363 c = 4;
364 result = [];
365 a = [];
366 for (i=0; i<c; i++) {
367 a[i] = [];
368 a[i][1] = someValues[i]
369 if ((a[i][1] & 0x80) == 0x80) {
370 a[i][2] = (a[i][1] << 1) ^ 0x11b;
371 } else {
372 a[i][2] = a[i][1] << 1;
373 }
374
375 a[i][3] = a[i][2] ^ a[i][1];
376 }
377
378 for (i=0; i<c; i++) {
379 varx;
380
381 x = Clipperz.Crypto.AES.mixColumnsMatrix()[i];
382 result[i] = a[0][x[0]] ^ a[1][x[1]] ^ a[2][x[2]] ^ a[3][x[3]];
383 }
384
385 return result;
386 },
387
388 'mixColumns': function() {
389 //a mixing operation which operates on the columns of the state, combining the four bytes in each column using a linear transformation.
390 var data;
391 var i, c;
392
393 data = this.data();
394 c = 4;
395 for(i=0; i<c; i++) {
396 varblockIndex;
397 var mixedValues;
398
399 blockIndex = i * 4;
400 mixedValues = this.mixColumnsWithValues([data[blockIndex + 0],
401 data[blockIndex + 1],
402 data[blockIndex + 2],
403 data[blockIndex + 3]]);
404 data[blockIndex + 0] = mixedValues[0];
405 data[blockIndex + 1] = mixedValues[1];
406 data[blockIndex + 2] = mixedValues[2];
407 data[blockIndex + 3] = mixedValues[3];
408 }
409 },
410*/
411
412 'mixColumns': function() {
413 //a mixing operation which operates on the columns of the state, combining the four bytes in each column using a linear transformation.
414 var data;
415 var i, c;
416 var a_1;
417 var a_2;
418
419 a_1 = new Array(4);
420 a_2 = new Array(4);
421
422 data = this.data();
423 c = 4;
424 for(i=0; i<c; i++) {
425 varblockIndex;
426 var ii, cc;
427
428 blockIndex = i * 4;
429
430 cc = 4;
431 for (ii=0; ii<cc; ii++) {
432 var value;
433
434 value = data[blockIndex + ii];
435 a_1[ii] = value;
436 a_2[ii] = (value & 0x80) ? ((value << 1) ^ 0x011b) : (value << 1);
437 }
438
439 data[blockIndex + 0] = a_2[0] ^ a_1[1] ^ a_2[1] ^ a_1[2] ^ a_1[3];
440 data[blockIndex + 1] = a_1[0] ^ a_2[1] ^ a_1[2] ^ a_2[2] ^ a_1[3];
441 data[blockIndex + 2] = a_1[0] ^ a_1[1] ^ a_2[2] ^ a_1[3] ^ a_2[3];
442 data[blockIndex + 3] = a_1[0] ^ a_2[0] ^ a_1[1] ^ a_1[2] ^ a_2[3];
443 }
444 },
445
446 //=========================================================================
447
448 'spinRound': function(aRoundNumber) {
449 this.addRoundKey(aRoundNumber);
450 this.subBytes();
451 this.shiftRows();
452 this.mixColumns();
453 },
454
455 'spinLastRound': function() {
456 this.addRoundKey(this.key().numberOfRounds() - 1);
457 this.subBytes();
458 this.shiftRows();
459 this.addRoundKey(this.key().numberOfRounds());
460 },
461
462 //=========================================================================
463
464 'encrypt': function() {
465 vari,c;
466
467 c = this.key().numberOfRounds() - 1;
468 for (i=0; i<c; i++) {
469 this.spinRound(i);
470 }
471
472 this.spinLastRound();
473 },
474
475 //=========================================================================
476 __syntaxFix__: "syntax fix"
477});
478
479//#############################################################################
480
481Clipperz.Crypto.AES.VERSION = "0.1";
482Clipperz.Crypto.AES.NAME = "Clipperz.Crypto.AES";
483
484MochiKit.Base.update(Clipperz.Crypto.AES, {
485
486 //http://www.cs.eku.edu/faculty/styer/460/Encrypt/JS-AES.html
487 //http://en.wikipedia.org/wiki/Advanced_Encryption_Standard
488 //http://en.wikipedia.org/wiki/Rijndael_key_schedule
489 //http://en.wikipedia.org/wiki/Rijndael_S-box
490
491 '__repr__': function () {
492 return "[" + this.NAME + " " + this.VERSION + "]";
493 },
494
495 'toString': function () {
496 return this.__repr__();
497 },
498
499 //=============================================================================
500
501 '_sbox': null,
502 'sbox': function() {
503 if (Clipperz.Crypto.AES._sbox == null) {
504 Clipperz.Crypto.AES._sbox = [
5050x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
5060xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
5070xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
5080x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
5090x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
5100x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
5110xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
5120x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
5130xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
5140x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
5150xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
5160xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
5170xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
5180x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
5190xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
5200x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
521 ];
522 }
523
524 return Clipperz.Crypto.AES._sbox;
525 },
526
527 //-----------------------------------------------------------------------------
528 //
529 // 0 4 8 12 0 4 812
530 // 1 5 9 13 => 5 9 131
531 // 2 6 10 14 10 14 26
532 // 3 7 11 15 15 3 711
533 //
534 '_shiftRowMapping': null,
535 'shiftRowMapping': function() {
536 if (Clipperz.Crypto.AES._shiftRowMapping == null) {
537 Clipperz.Crypto.AES._shiftRowMapping = [0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, 1, 6, 11];
538 }
539
540 return Clipperz.Crypto.AES._shiftRowMapping;
541 },
542
543 //-----------------------------------------------------------------------------
544
545 '_mixColumnsMatrix': null,
546 'mixColumnsMatrix': function() {
547 if (Clipperz.Crypto.AES._mixColumnsMatrix == null) {
548 Clipperz.Crypto.AES._mixColumnsMatrix = [[2, 3, 1 ,1],
549 [1, 2, 3, 1],
550 [1, 1, 2, 3],
551 [3, 1, 1, 2] ];
552 }
553
554 return Clipperz.Crypto.AES._mixColumnsMatrix;
555 },
556
557 '_roundConstants': null,
558 'roundConstants': function() {
559 if (Clipperz.Crypto.AES._roundConstants == null) {
560 Clipperz.Crypto.AES._roundConstants = [ , 1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, 171, 77, 154];
561 // Clipperz.Crypto.AES._roundConstants = [ , 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a];
562 }
563
564 return Clipperz.Crypto.AES._roundConstants;
565 },
566
567 //=============================================================================
568
569 'incrementNonce': function(aNonce) {
570//Clipperz.Profile.start("Clipperz.Crypto.AES.incrementNonce");
571 var i;
572 var done;
573
574 done = false;
575 i = aNonce.length - 1;
576
577 while ((i>=0) && (done == false)) {
578 var currentByteValue;
579
580 currentByteValue = aNonce[i];
581
582 if (currentByteValue == 0xff) {
583 aNonce[i] = 0;
584 if (i>= 0) {
585 i --;
586 } else {
587 done = true;
588 }
589 } else {
590 aNonce[i] = currentByteValue + 1;
591 done = true;
592 }
593 }
594//Clipperz.Profile.stop("Clipperz.Crypto.AES.incrementNonce");
595 },
596
597 //-----------------------------------------------------------------------------
598
599 'encryptBlock': function(aKey, aBlock) {
600 varresult;
601 varstate;
602
603 state = new Clipperz.Crypto.AES.State({block:aBlock, key:aKey});
604//is(state.data(), 'before');
605 state.encrypt();
606 result = state.data();
607
608 return result;
609 },
610
611 //-----------------------------------------------------------------------------
612
613 'encryptBlocks': function(aKey, aMessage, aNonce) {
614 varresult;
615 var nonce;
616 var self;
617 varmessageIndex;
618 varmessageLength;
619 var blockSize;
620
621 self = Clipperz.Crypto.AES;
622 blockSize = 128/8;
623 messageLength = aMessage.length;
624 nonce = aNonce;
625
626 result = aMessage;
627 messageIndex = 0;
628 while (messageIndex < messageLength) {
629 var encryptedBlock;
630 var i,c;
631
632 self.incrementNonce(nonce);
633 encryptedBlock = self.encryptBlock(aKey, nonce);
634
635 if ((messageLength - messageIndex) > blockSize) {
636 c = blockSize;
637 } else {
638 c = messageLength - messageIndex;
639 }
640
641 for (i=0; i<c; i++) {
642 result[messageIndex + i] = result[messageIndex + i] ^ encryptedBlock[i];
643 }
644
645 messageIndex += blockSize;
646 }
647
648 return result;
649 },
650
651 //-----------------------------------------------------------------------------
652
653 'encrypt': function(aKey, someData, aNonce) {
654 var result;
655 var nonce;
656 varencryptedData;
657 var key;
658
659 key = new Clipperz.Crypto.AES.Key({key:aKey});
660 nonce = aNonce ? aNonce.clone() : Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(128/8);
661
662 encryptedData = Clipperz.Crypto.AES.encryptBlocks(key, someData.arrayValues(), nonce.arrayValues());
663
664 result = nonce.appendBytes(encryptedData);
665
666 return result;
667 },
668
669 //-----------------------------------------------------------------------------
670
671 'decrypt': function(aKey, someData) {
672 var result;
673 var nonce;
674 var encryptedData;
675 var decryptedData;
676 vardataIterator;
677 var key;
678
679 key = new Clipperz.Crypto.AES.Key({key:aKey});
680
681 encryptedData = someData.arrayValues();
682 nonce = encryptedData.slice(0, (128/8));
683 encryptedData = encryptedData.slice(128/8);
684 decryptedData = Clipperz.Crypto.AES.encryptBlocks(key, encryptedData, nonce);
685
686 result = new Clipperz.ByteArray(decryptedData);
687
688 return result;
689 },
690
691 //=============================================================================
692
693 'deferredEncryptExecutionChunk': function(anExecutionContext) {
694 varresult;
695 var nonce;
696 var self;
697 varmessageIndex;
698 varmessageLength;
699 var blockSize;
700 var executionLimit;
701
702 self = Clipperz.Crypto.AES;
703 blockSize = 128/8;
704 messageLength = anExecutionContext.messageArray().length;
705 nonce = anExecutionContext.nonceArray();
706 result = anExecutionContext.resultArray();
707
708 messageIndex = anExecutionContext.executionStep();
709 executionLimit = messageIndex + anExecutionContext.elaborationChunkSize();
710 executionLimit = Math.min(executionLimit, messageLength);
711
712 while (messageIndex < executionLimit) {
713 var encryptedBlock;
714 var i,c;
715
716 self.incrementNonce(nonce);
717 encryptedBlock = self.encryptBlock(anExecutionContext.key(), nonce);
718
719 if ((executionLimit - messageIndex) > blockSize) {
720 c = blockSize;
721 } else {
722 c = executionLimit - messageIndex;
723 }
724
725 for (i=0; i<c; i++) {
726 result[messageIndex + i] = result[messageIndex + i] ^ encryptedBlock[i];
727 }
728
729 messageIndex += blockSize;
730 }
731 anExecutionContext.setExecutionStep(messageIndex);
732
733 return anExecutionContext;
734 },
735
736 //-----------------------------------------------------------------------------
737
738 'deferredEncryptBlocks': function(anExecutionContext) {
739 vardeferredResult;
740 varmessageSize;
741 var i,c;
742 var now;
743
744 messageSize = anExecutionContext.messageLength();
745
746 deferredResult = new MochiKit.Async.Deferred();
747//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.Crypto.AES.deferredEncryptBlocks - START: " + res); return res;});
748 // deferredResult.addCallback(MochiKit.Base.method(anExecutionContext, 'pause'));
749
750 c = Math.ceil(messageSize / anExecutionContext.elaborationChunkSize());
751 for (i=0; i<c; i++) {
752//deferredResult.addBoth(function(res) {now = new Date(); return res;});
753//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.Crypto.AES.deferredEncryptBlocks - : (" + i + ") - " + res); return res;});
754 deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncryptExecutionChunk);
755//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("[" + (new Date() - now) + "]Clipperz.Crypto.AES.deferredEncryptBlocks"); return res;});
756//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.Crypto.AES.deferredEncryptBlocks - : (" + i + ") -- " + res); return res;});
757 deferredResult.addCallback(MochiKit.Base.method(anExecutionContext, 'pause'));
758//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.Crypto.AES.deferredEncryptBlocks - : (" + i + ") --- " + res); return res;});
759 }
760//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.Crypto.AES.deferredEncryptBlocks - END: " + res); return res;});
761
762 deferredResult.callback(anExecutionContext);
763
764 return deferredResult;
765 },
766
767 //-----------------------------------------------------------------------------
768
769 'deferredEncrypt': function(aKey, someData, aNonce) {
770 var deferredResult;
771 varexecutionContext;
772 var result;
773 var nonce;
774 var key;
775
776 key = new Clipperz.Crypto.AES.Key({key:aKey});
777 nonce = aNonce ? aNonce.clone() : Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(128/8);
778
779 executionContext = new Clipperz.Crypto.AES.DeferredExecutionContext({key:key, message:someData, nonce:nonce});
780
781 deferredResult = new MochiKit.Async.Deferred();
782//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.Crypto.AES.deferredEncrypt - 1: " + res); return res;});
783 deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncryptBlocks);
784//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.Crypto.AES.deferredEncrypt - 2: " + res); return res;});
785 deferredResult.addCallback(function(anExecutionContext) {
786 var result;
787
788 result = anExecutionContext.nonce().clone();
789 result.appendBytes(anExecutionContext.resultArray());
790
791 return result;
792 });
793//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.Crypto.AES.deferredEncrypt - 3: " + res); return res;});
794 deferredResult.callback(executionContext)
795
796 return deferredResult;
797 },
798
799 //-----------------------------------------------------------------------------
800
801 'deferredDecrypt': function(aKey, someData) {
802 var deferredResult
803 var nonce;
804 var message;
805 var key;
806
807 key = new Clipperz.Crypto.AES.Key({key:aKey});
808 nonce = someData.split(0, (128/8));
809 message = someData.split(128/8);
810 executionContext = new Clipperz.Crypto.AES.DeferredExecutionContext({key:key, message:message, nonce:nonce});
811
812 deferredResult = new MochiKit.Async.Deferred();
813 deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncryptBlocks);
814 deferredResult.addCallback(function(anExecutionContext) {
815 return anExecutionContext.result();
816 });
817 deferredResult.callback(executionContext);
818
819 return deferredResult;
820 },
821
822 //-----------------------------------------------------------------------------
823 __syntaxFix__: "syntax fix"
824
825});
826
827//#############################################################################
828
829Clipperz.Crypto.AES.DeferredExecution = {
830 'chunkSize': 4096, // 1024 4096 8192 1638432768;
831 'pauseTime': 0.2
832}
833
834Clipperz.Crypto.AES.exception = {
835 'UnsupportedKeySize': new MochiKit.Base.NamedError("Clipperz.Crypto.AES.exception.UnsupportedKeySize")
836};
diff --git a/frontend/beta/js/Clipperz/Crypto/Base.js b/frontend/beta/js/Clipperz/Crypto/Base.js
new file mode 100644
index 0000000..b69dcc8
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Crypto/Base.js
@@ -0,0 +1,1852 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29try { if (typeof(Clipperz.Base) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.Crypto.Base depends on Clipperz.Base!";
31}
32
33if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; }
34if (typeof(Clipperz.Crypto.Base) == 'undefined') { Clipperz.Crypto.Base = {}; }
35
36Clipperz.Crypto.Base.VERSION = "0.1";
37Clipperz.Crypto.Base.NAME = "Clipperz.Crypto.Base";
38
39//#############################################################################
40 //Downloaded on March 30, 2006 from http://anmar.eu.org/projects/jssha2/files/jssha2-0.3.zip (jsSha2/sha256.js)
41//#############################################################################
42
43/* A JavaScript implementation of the Secure Hash Algorithm, SHA-256
44 * Version 0.3 Copyright Angel Marin 2003-2004 - http://anmar.eu.org/
45 * Distributed under the BSD License
46 * Some bits taken from Paul Johnston's SHA-1 implementation
47 */
48var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */
49function safe_add (x, y) {
50 var lsw = (x & 0xFFFF) + (y & 0xFFFF);
51 var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
52 return (msw << 16) | (lsw & 0xFFFF);
53}
54function S (X, n) {return ( X >>> n ) | (X << (32 - n));}
55function R (X, n) {return ( X >>> n );}
56function Ch(x, y, z) {return ((x & y) ^ ((~x) & z));}
57function Maj(x, y, z) {return ((x & y) ^ (x & z) ^ (y & z));}
58function Sigma0256(x) {return (S(x, 2) ^ S(x, 13) ^ S(x, 22));}
59function Sigma1256(x) {return (S(x, 6) ^ S(x, 11) ^ S(x, 25));}
60function Gamma0256(x) {return (S(x, 7) ^ S(x, 18) ^ R(x, 3));}
61function Gamma1256(x) {return (S(x, 17) ^ S(x, 19) ^ R(x, 10));}
62function core_sha256 (m, l) {
63 var K = new Array(0x428A2F98,0x71374491,0xB5C0FBCF,0xE9B5DBA5,0x3956C25B,0x59F111F1,0x923F82A4,0xAB1C5ED5,0xD807AA98,0x12835B01,0x243185BE,0x550C7DC3,0x72BE5D74,0x80DEB1FE,0x9BDC06A7,0xC19BF174,0xE49B69C1,0xEFBE4786,0xFC19DC6,0x240CA1CC,0x2DE92C6F,0x4A7484AA,0x5CB0A9DC,0x76F988DA,0x983E5152,0xA831C66D,0xB00327C8,0xBF597FC7,0xC6E00BF3,0xD5A79147,0x6CA6351,0x14292967,0x27B70A85,0x2E1B2138,0x4D2C6DFC,0x53380D13,0x650A7354,0x766A0ABB,0x81C2C92E,0x92722C85,0xA2BFE8A1,0xA81A664B,0xC24B8B70,0xC76C51A3,0xD192E819,0xD6990624,0xF40E3585,0x106AA070,0x19A4C116,0x1E376C08,0x2748774C,0x34B0BCB5,0x391C0CB3,0x4ED8AA4A,0x5B9CCA4F,0x682E6FF3,0x748F82EE,0x78A5636F,0x84C87814,0x8CC70208,0x90BEFFFA,0xA4506CEB,0xBEF9A3F7,0xC67178F2);
64 var HASH = new Array(0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19);
65 var W = new Array(64);
66 var a, b, c, d, e, f, g, h, i, j;
67 var T1, T2;
68 /* append padding */
69 m[l >> 5] |= 0x80 << (24 - l % 32);
70 m[((l + 64 >> 9) << 4) + 15] = l;
71 for ( var i = 0; i<m.length; i+=16 ) {
72 a = HASH[0]; b = HASH[1]; c = HASH[2]; d = HASH[3]; e = HASH[4]; f = HASH[5]; g = HASH[6]; h = HASH[7];
73 for ( var j = 0; j<64; j++) {
74 if (j < 16) W[j] = m[j + i];
75 else W[j] = safe_add(safe_add(safe_add(Gamma1256(W[j - 2]), W[j - 7]), Gamma0256(W[j - 15])), W[j - 16]);
76 T1 = safe_add(safe_add(safe_add(safe_add(h, Sigma1256(e)), Ch(e, f, g)), K[j]), W[j]);
77 T2 = safe_add(Sigma0256(a), Maj(a, b, c));
78 h = g; g = f; f = e; e = safe_add(d, T1); d = c; c = b; b = a; a = safe_add(T1, T2);
79 }
80 HASH[0] = safe_add(a, HASH[0]); HASH[1] = safe_add(b, HASH[1]); HASH[2] = safe_add(c, HASH[2]); HASH[3] = safe_add(d, HASH[3]); HASH[4] = safe_add(e, HASH[4]); HASH[5] = safe_add(f, HASH[5]); HASH[6] = safe_add(g, HASH[6]); HASH[7] = safe_add(h, HASH[7]);
81 }
82 return HASH;
83}
84function str2binb (str) {
85 var bin = Array();
86 var mask = (1 << chrsz) - 1;
87 for(var i = 0; i < str.length * chrsz; i += chrsz)
88 bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - i%32);
89 return bin;
90}
91function binb2hex (binarray) {
92 var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
93 var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
94 var str = "";
95 for (var i = 0; i < binarray.length * 4; i++) {
96 str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);
97 }
98 return str;
99}
100function hex_sha256(s){return binb2hex(core_sha256(str2binb(s),s.length * chrsz));}
101
102
103
104//#############################################################################
105 //Downloaded on March 30, 2006 from http://www.fourmilab.ch/javascrypt/javascrypt.zip (entropy.js)
106//#############################################################################
107
108 // Entropy collection utilities
109
110 /*Start by declaring static storage and initialise
111 the entropy vector from the time we come through
112 here. */
113
114 var entropyData = new Array(); // Collected entropy data
115 var edlen = 0; // Keyboard array data length
116
117 addEntropyTime(); // Start entropy collection with page load time
118 ce(); // Roll milliseconds into initial entropy
119
120 //Add a byte to the entropy vector
121
122 function addEntropyByte(b) {
123 entropyData[edlen++] = b;
124 }
125
126 /*Capture entropy. When the user presses a key or performs
127 various other events for which we can request
128 notification, add the time in 255ths of a second to the
129 entropyData array. The name of the function is short
130 so it doesn't bloat the form object declarations in
131 which it appears in various "onXXX" events. */
132
133 function ce() {
134 addEntropyByte(Math.floor((((new Date).getMilliseconds()) * 255) / 999));
135 }
136
137 //Add a 32 bit quantity to the entropy vector
138
139 function addEntropy32(w) {
140 var i;
141
142 for (i = 0; i < 4; i++) {
143 addEntropyByte(w & 0xFF);
144 w >>= 8;
145 }
146 }
147
148 /*Add the current time and date (milliseconds since the epoch,
149 truncated to 32 bits) to the entropy vector. */
150
151 function addEntropyTime() {
152 addEntropy32((new Date()).getTime());
153 }
154
155 /* Start collection of entropy from mouse movements. The
156 argument specifies the number of entropy items to be
157 obtained from mouse motion, after which mouse motion
158 will be ignored. Note that you can re-enable mouse
159 motion collection at any time if not already underway. */
160
161 var mouseMotionCollect = 0;
162 var oldMoveHandler; // For saving and restoring mouse move handler in IE4
163
164 function mouseMotionEntropy(maxsamp) {
165 if (mouseMotionCollect <= 0) {
166 mouseMotionCollect = maxsamp;
167 if ((document.implementation.hasFeature("Events", "2.0")) &&
168 document.addEventListener) {
169 // Browser supports Document Object Model (DOM) 2 events
170 document.addEventListener("mousemove", mouseMoveEntropy, false);
171 } else {
172 if (document.attachEvent) {
173 // Internet Explorer 5 and above event model
174 document.attachEvent("onmousemove", mouseMoveEntropy);
175 } else {
176 //Internet Explorer 4 event model
177 oldMoveHandler = document.onmousemove;
178 document.onmousemove = mouseMoveEntropy;
179 }
180 }
181//dump("Mouse enable", mouseMotionCollect);
182 }
183 }
184
185 /*Collect entropy from mouse motion events. Note that
186 this is craftily coded to work with either DOM2 or Internet
187 Explorer style events. Note that we don't use every successive
188 mouse movement event. Instead, we XOR the three bytes collected
189 from the mouse and use that to determine how many subsequent
190 mouse movements we ignore before capturing the next one. */
191
192 var mouseEntropyTime = 0; // Delay counter for mouse entropy collection
193
194 function mouseMoveEntropy(e) {
195 if (!e) {
196 e = window.event; // Internet Explorer event model
197 }
198 if (mouseMotionCollect > 0) {
199 if (mouseEntropyTime-- <= 0) {
200 addEntropyByte(e.screenX & 0xFF);
201 addEntropyByte(e.screenY & 0xFF);
202 ce();
203 mouseMotionCollect--;
204 mouseEntropyTime = (entropyData[edlen - 3] ^ entropyData[edlen - 2] ^
205 entropyData[edlen - 1]) % 19;
206//dump("Mouse Move", byteArrayToHex(entropyData.slice(-3)));
207 }
208 if (mouseMotionCollect <= 0) {
209 if (document.removeEventListener) {
210 document.removeEventListener("mousemove", mouseMoveEntropy, false);
211 } else if (document.detachEvent) {
212 document.detachEvent("onmousemove", mouseMoveEntropy);
213 } else {
214 document.onmousemove = oldMoveHandler;
215 }
216//dump("Spung!", 0);
217 }
218 }
219 }
220
221 /*Compute a 32 byte key value from the entropy vector.
222 We compute the value by taking the MD5 sum of the even
223 and odd bytes respectively of the entropy vector, then
224 concatenating the two MD5 sums. */
225
226 function keyFromEntropy() {
227 var i, k = new Array(32);
228
229 if (edlen == 0) {
230 alert("Blooie! Entropy vector void at call to keyFromEntropy.");
231 }
232//dump("Entropy bytes", edlen);
233
234 md5_init();
235 for (i = 0; i < edlen; i += 2) {
236 md5_update(entropyData[i]);
237 }
238 md5_finish();
239 for (i = 0; i < 16; i++) {
240 k[i] = digestBits[i];
241 }
242
243 md5_init();
244 for (i = 1; i < edlen; i += 2) {
245 md5_update(entropyData[i]);
246 }
247 md5_finish();
248 for (i = 0; i < 16; i++) {
249 k[i + 16] = digestBits[i];
250 }
251
252//dump("keyFromEntropy", byteArrayToHex(k));
253 return k;
254 }
255
256//#############################################################################
257 //Downloaded on March 30, 2006 from http://www.fourmilab.ch/javascrypt/javascrypt.zip (aesprng.js)
258//#############################################################################
259
260
261 // AES based pseudorandom number generator
262
263 /* Constructor. Called with an array of 32 byte (0-255) values
264 containing the initial seed. */
265
266 function AESprng(seed) {
267 this.key = new Array();
268 this.key = seed;
269 this.itext = hexToByteArray("9F489613248148F9C27945C6AE62EECA3E3367BB14064E4E6DC67A9F28AB3BD1");
270 this.nbytes = 0; // Bytes left in buffer
271
272 this.next = AESprng_next;
273 this.nextbits = AESprng_nextbits;
274 this.nextInt = AESprng_nextInt;
275 this.round = AESprng_round;
276
277 /* Encrypt the initial text with the seed key
278 three times, feeding the output of the encryption
279 back into the key for the next round. */
280
281 bsb = blockSizeInBits;
282 blockSizeInBits = 256;
283 var i, ct;
284 for (i = 0; i < 3; i++) {
285 this.key = rijndaelEncrypt(this.itext, this.key, "ECB");
286 }
287
288 /* Now make between one and four additional
289 key-feedback rounds, with the number determined
290 by bits from the result of the first three
291 rounds. */
292
293 var n = 1 + (this.key[3] & 2) + (this.key[9] & 1);
294 for (i = 0; i < n; i++) {
295 this.key = rijndaelEncrypt(this.itext, this.key, "ECB");
296 }
297 blockSizeInBits = bsb;
298 }
299
300 function AESprng_round() {
301 bsb = blockSizeInBits;
302 blockSizeInBits = 256;
303 this.key = rijndaelEncrypt(this.itext, this.key, "ECB");
304 this.nbytes = 32;
305 blockSizeInBits = bsb;
306 }
307
308 //Return next byte from the generator
309
310 function AESprng_next() {
311 if (this.nbytes <= 0) {
312 this.round();
313 }
314 return(this.key[--this.nbytes]);
315 }
316
317 //Return n bit integer value (up to maximum integer size)
318
319 function AESprng_nextbits(n) {
320 var i, w = 0, nbytes = Math.floor((n + 7) / 8);
321
322 for (i = 0; i < nbytes; i++) {
323 w = (w << 8) | this.next();
324 }
325 return w & ((1 << n) - 1);
326 }
327
328 // Return integer between 0 and n inclusive
329
330 function AESprng_nextInt(n) {
331 var p = 1, nb = 0;
332
333 // Determine smallest p, 2^p > n
334 // nb = log_2 p
335
336 while (n >= p) {
337 p <<= 1;
338 nb++;
339 }
340 p--;
341
342 /* Generate values from 0 through n by first generating
343 values v from 0 to (2^p)-1, then discarding any results v > n.
344 For the rationale behind this (and why taking
345 values mod (n + 1) is biased toward smaller values, see
346 Ferguson and Schneier, "Practical Cryptography",
347 ISBN 0-471-22357-3, section 10.8). */
348
349 while (true) {
350 var v = this.nextbits(nb) & p;
351
352 if (v <= n) {
353 return v;
354 }
355 }
356 }
357
358//#############################################################################
359 //Downloaded on March 30, 2006 from http://www.fourmilab.ch/javascrypt/javascrypt.zip (md5.js)
360//#############################################################################
361
362/*
363 * md5.jvs 1.0b 27/06/96
364 *
365 * Javascript implementation of the RSA Data Security, Inc. MD5
366 * Message-Digest Algorithm.
367 *
368 * Copyright (c) 1996 Henri Torgemane. All Rights Reserved.
369 *
370 * Permission to use, copy, modify, and distribute this software
371 * and its documentation for any purposes and without
372 * fee is hereby granted provided that this copyright notice
373 * appears in all copies.
374 *
375 * Of course, this soft is provided "as is" without express or implied
376 * warranty of any kind.
377
378 This version contains some trivial reformatting modifications
379 by John Walker.
380
381 */
382
383function array(n) {
384 for (i = 0; i < n; i++) {
385 this[i] = 0;
386 }
387 this.length = n;
388}
389
390/* Some basic logical functions had to be rewritten because of a bug in
391 * Javascript.. Just try to compute 0xffffffff >> 4 with it..
392 * Of course, these functions are slower than the original would be, but
393 * at least, they work!
394 */
395
396function integer(n) {
397 return n % (0xffffffff + 1);
398}
399
400function shr(a, b) {
401 a = integer(a);
402 b = integer(b);
403 if (a - 0x80000000 >= 0) {
404 a = a % 0x80000000;
405 a >>= b;
406 a += 0x40000000 >> (b - 1);
407 } else {
408 a >>= b;
409 }
410 return a;
411}
412
413function shl1(a) {
414 a = a % 0x80000000;
415 if (a & 0x40000000 == 0x40000000) {
416 a -= 0x40000000;
417 a *= 2;
418 a += 0x80000000;
419 } else {
420 a *= 2;
421 }
422 return a;
423}
424
425function shl(a, b) {
426 a = integer(a);
427 b = integer(b);
428 for (var i = 0; i < b; i++) {
429 a = shl1(a);
430 }
431 return a;
432}
433
434function and(a, b) {
435 a = integer(a);
436 b = integer(b);
437 var t1 = a - 0x80000000;
438 var t2 = b - 0x80000000;
439 if (t1 >= 0) {
440 if (t2 >= 0) {
441 return ((t1 & t2) + 0x80000000);
442 } else {
443 return (t1 & b);
444 }
445 } else {
446 if (t2 >= 0) {
447 return (a & t2);
448 } else {
449 return (a & b);
450 }
451 }
452}
453
454function or(a, b) {
455 a = integer(a);
456 b = integer(b);
457 var t1 = a - 0x80000000;
458 var t2 = b - 0x80000000;
459 if (t1 >= 0) {
460 if (t2 >= 0) {
461 return ((t1 | t2) + 0x80000000);
462 } else {
463 return ((t1 | b) + 0x80000000);
464 }
465 } else {
466 if (t2 >= 0) {
467 return ((a | t2) + 0x80000000);
468 } else {
469 return (a | b);
470 }
471 }
472}
473
474function xor(a, b) {
475 a = integer(a);
476 b = integer(b);
477 var t1 = a - 0x80000000;
478 var t2 = b - 0x80000000;
479 if (t1 >= 0) {
480 if (t2 >= 0) {
481 return (t1 ^ t2);
482 } else {
483 return ((t1 ^ b) + 0x80000000);
484 }
485 } else {
486 if (t2 >= 0) {
487 return ((a ^ t2) + 0x80000000);
488 } else {
489 return (a ^ b);
490 }
491 }
492}
493
494function not(a) {
495 a = integer(a);
496 return 0xffffffff - a;
497}
498
499/* Here begin the real algorithm */
500
501var state = new array(4);
502var count = new array(2);
503 count[0] = 0;
504 count[1] = 0;
505var buffer = new array(64);
506var transformBuffer = new array(16);
507var digestBits = new array(16);
508
509var S11 = 7;
510var S12 = 12;
511var S13 = 17;
512var S14 = 22;
513var S21 = 5;
514var S22 = 9;
515var S23 = 14;
516var S24 = 20;
517var S31 = 4;
518var S32 = 11;
519var S33 = 16;
520var S34 = 23;
521var S41 = 6;
522var S42 = 10;
523var S43 = 15;
524var S44 = 21;
525
526function F(x, y, z) {
527 return or(and(x, y), and(not(x), z));
528}
529
530function G(x, y, z) {
531 return or(and(x, z), and(y, not(z)));
532}
533
534function H(x, y, z) {
535 return xor(xor(x, y), z);
536}
537
538function I(x, y, z) {
539 return xor(y ,or(x , not(z)));
540}
541
542function rotateLeft(a, n) {
543 return or(shl(a, n), (shr(a, (32 - n))));
544}
545
546function FF(a, b, c, d, x, s, ac) {
547 a = a + F(b, c, d) + x + ac;
548 a = rotateLeft(a, s);
549 a = a + b;
550 return a;
551}
552
553function GG(a, b, c, d, x, s, ac) {
554 a = a + G(b, c, d) + x + ac;
555 a = rotateLeft(a, s);
556 a = a + b;
557 return a;
558}
559
560function HH(a, b, c, d, x, s, ac) {
561 a = a + H(b, c, d) + x + ac;
562 a = rotateLeft(a, s);
563 a = a + b;
564 return a;
565}
566
567function II(a, b, c, d, x, s, ac) {
568 a = a + I(b, c, d) + x + ac;
569 a = rotateLeft(a, s);
570 a = a + b;
571 return a;
572}
573
574function transform(buf, offset) {
575 var a = 0, b = 0, c = 0, d = 0;
576 var x = transformBuffer;
577
578 a = state[0];
579 b = state[1];
580 c = state[2];
581 d = state[3];
582
583 for (i = 0; i < 16; i++) {
584 x[i] = and(buf[i * 4 + offset], 0xFF);
585 for (j = 1; j < 4; j++) {
586 x[i] += shl(and(buf[i * 4 + j + offset] ,0xFF), j * 8);
587 }
588 }
589
590 /* Round 1 */
591 a = FF( a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
592 d = FF( d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
593 c = FF( c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
594 b = FF( b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
595 a = FF( a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
596 d = FF( d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
597 c = FF( c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
598 b = FF( b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
599 a = FF( a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
600 d = FF( d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
601 c = FF( c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
602 b = FF( b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
603 a = FF( a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
604 d = FF( d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
605 c = FF( c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
606 b = FF( b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
607
608 /* Round 2 */
609 a = GG( a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
610 d = GG( d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
611 c = GG( c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
612 b = GG( b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
613 a = GG( a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
614 d = GG( d, a, b, c, x[10], S22, 0x2441453); /* 22 */
615 c = GG( c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
616 b = GG( b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
617 a = GG( a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
618 d = GG( d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
619 c = GG( c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
620 b = GG( b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
621 a = GG( a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
622 d = GG( d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
623 c = GG( c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
624 b = GG( b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
625
626 /* Round 3 */
627 a = HH( a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
628 d = HH( d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
629 c = HH( c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
630 b = HH( b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
631 a = HH( a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
632 d = HH( d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
633 c = HH( c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
634 b = HH( b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
635 a = HH( a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
636 d = HH( d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
637 c = HH( c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
638 b = HH( b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
639 a = HH( a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
640 d = HH( d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
641 c = HH( c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
642 b = HH( b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
643
644 /* Round 4 */
645 a = II( a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
646 d = II( d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
647 c = II( c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
648 b = II( b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
649 a = II( a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
650 d = II( d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
651 c = II( c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
652 b = II( b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
653 a = II( a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
654 d = II( d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
655 c = II( c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
656 b = II( b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
657 a = II( a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
658 d = II( d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
659 c = II( c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
660 b = II( b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
661
662 state[0] += a;
663 state[1] += b;
664 state[2] += c;
665 state[3] += d;
666
667}
668
669function md5_init() {
670 count[0] = count[1] = 0;
671 state[0] = 0x67452301;
672 state[1] = 0xefcdab89;
673 state[2] = 0x98badcfe;
674 state[3] = 0x10325476;
675 for (i = 0; i < digestBits.length; i++) {
676 digestBits[i] = 0;
677 }
678}
679
680function md5_update(b) {
681 var index, i;
682
683 index = and(shr(count[0],3) , 0x3F);
684 if (count[0] < 0xFFFFFFFF - 7) {
685 count[0] += 8;
686 } else {
687 count[1]++;
688 count[0] -= 0xFFFFFFFF + 1;
689 count[0] += 8;
690 }
691 buffer[index] = and(b, 0xff);
692 if (index >= 63) {
693 transform(buffer, 0);
694 }
695}
696
697function md5_finish() {
698 var bits = new array(8);
699 var padding;
700 var i = 0, index = 0, padLen = 0;
701
702 for (i = 0; i < 4; i++) {
703 bits[i] = and(shr(count[0], (i * 8)), 0xFF);
704 }
705 for (i = 0; i < 4; i++) {
706 bits[i + 4] = and(shr(count[1], (i * 8)), 0xFF);
707 }
708 index = and(shr(count[0], 3), 0x3F);
709 padLen = (index < 56) ? (56 - index) : (120 - index);
710 padding = new array(64);
711 padding[0] = 0x80;
712 for (i = 0; i < padLen; i++) {
713 md5_update(padding[i]);
714 }
715 for (i = 0; i < 8; i++) {
716 md5_update(bits[i]);
717 }
718
719 for (i = 0; i < 4; i++) {
720 for (j = 0; j < 4; j++) {
721 digestBits[i * 4 + j] = and(shr(state[i], (j * 8)) , 0xFF);
722 }
723 }
724}
725
726/* End of the MD5 algorithm */
727
728//#############################################################################
729 //Downloaded on March 30, 2006 from http://www.fourmilab.ch/javascrypt/javascrypt.zip (aes.js)
730//#############################################################################
731
732
733/* rijndael.js Rijndael Reference Implementation
734
735 This is a modified version of the software described below,
736 produced in September 2003 by John Walker for use in the
737 JavsScrypt browser-based encryption package. The principal
738 changes are replacing the original getRandomBytes function with
739 one which calls our pseudorandom generator (which must
740 be instantiated and seeded before the first call on getRandomBytes),
741 and changing keySizeInBits to 256. Some code not required by the
742 JavsScrypt application has been commented out. Please see
743 http://www.fourmilab.ch/javascrypt/ for further information on
744 JavaScrypt.
745
746 The following is the original copyright and application
747 information.
748
749 Copyright (c) 2001 Fritz Schneider
750
751 This software is provided as-is, without express or implied warranty.
752 Permission to use, copy, modify, distribute or sell this software, with or
753 without fee, for any purpose and by any individual or organization, is hereby
754 granted, provided that the above copyright notice and this paragraph appear
755 in all copies. Distribution as a part of an application or binary must
756 include the above copyright notice in the documentation and/or other materials
757 provided with the application or distribution.
758
759 As the above disclaimer notes, you are free to use this code however you
760 want. However, I would request that you send me an email
761 (fritz /at/ cs /dot/ ucsd /dot/ edu) to say hi if you find this code useful
762 or instructional. Seeing that people are using the code acts as
763 encouragement for me to continue development. If you *really* want to thank
764 me you can buy the book I wrote with Thomas Powell, _JavaScript:
765 _The_Complete_Reference_ :)
766
767 This code is an UNOPTIMIZED REFERENCE implementation of Rijndael.
768 If there is sufficient interest I can write an optimized (word-based,
769 table-driven) version, although you might want to consider using a
770 compiled language if speed is critical to your application. As it stands,
771 one run of the monte carlo test (10,000 encryptions) can take up to
772 several minutes, depending upon your processor. You shouldn't expect more
773 than a few kilobytes per second in throughput.
774
775 Also note that there is very little error checking in these functions.
776 Doing proper error checking is always a good idea, but the ideal
777 implementation (using the instanceof operator and exceptions) requires
778 IE5+/NS6+, and I've chosen to implement this code so that it is compatible
779 with IE4/NS4.
780
781 And finally, because JavaScript doesn't have an explicit byte/char data
782 type (although JavaScript 2.0 most likely will), when I refer to "byte"
783 in this code I generally mean "32 bit integer with value in the interval
784 [0,255]" which I treat as a byte.
785
786 See http://www-cse.ucsd.edu/~fritz/rijndael.html for more documentation
787 of the (very simple) API provided by this code.
788
789 Fritz Schneider
790 fritz at cs.ucsd.edu
791
792*/
793
794
795// Rijndael parameters -- Valid values are 128, 192, or 256
796
797var keySizeInBits = 256;
798var blockSizeInBits = 128;
799
800//
801// Note: in the following code the two dimensional arrays are indexed as
802// you would probably expect, as array[row][column]. The state arrays
803// are 2d arrays of the form state[4][Nb].
804
805
806// The number of rounds for the cipher, indexed by [Nk][Nb]
807var roundsArray = [ ,,,,[,,,,10,, 12,, 14],,
808 [,,,,12,, 12,, 14],,
809 [,,,,14,, 14,, 14] ];
810
811// The number of bytes to shift by in shiftRow, indexed by [Nb][row]
812var shiftOffsets = [ ,,,,[,1, 2, 3],,[,1, 2, 3],,[,1, 3, 4] ];
813
814// The round constants used in subkey expansion
815var Rcon = [
8160x01, 0x02, 0x04, 0x08, 0x10, 0x20,
8170x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8,
8180xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc,
8190x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4,
8200xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91 ];
821
822// Precomputed lookup table for the SBox
823var SBox = [
824 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171,
825118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164,
826114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113,
827216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226,
828235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214,
829179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203,
830190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69,
831249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245,
832188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68,
83323, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42,
834144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73,
835 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109,
836141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37,
837 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62,
838181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225,
839248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223,
840140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187,
841 22 ];
842
843// Precomputed lookup table for the inverse SBox
844var SBoxInverse = [
845 82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215,
846251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222,
847233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66,
848250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73,
849109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92,
850204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21,
851 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247,
852228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2,
853193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220,
854234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173,
855 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29,
856 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75,
857198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168,
858 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81,
859127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160,
860224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97,
861 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12,
862125 ];
863
864// This method circularly shifts the array left by the number of elements
865// given in its parameter. It returns the resulting array and is used for
866// the ShiftRow step. Note that shift() and push() could be used for a more
867// elegant solution, but they require IE5.5+, so I chose to do it manually.
868
869function cyclicShiftLeft(theArray, positions) {
870 var temp = theArray.slice(0, positions);
871 theArray = theArray.slice(positions).concat(temp);
872 return theArray;
873}
874
875// Cipher parameters ... do not change these
876var Nk = keySizeInBits / 32;
877var Nb = blockSizeInBits / 32;
878var Nr = roundsArray[Nk][Nb];
879
880// Multiplies the element "poly" of GF(2^8) by x. See the Rijndael spec.
881
882function xtime(poly) {
883 poly <<= 1;
884 return ((poly & 0x100) ? (poly ^ 0x11B) : (poly));
885}
886
887// Multiplies the two elements of GF(2^8) together and returns the result.
888// See the Rijndael spec, but should be straightforward: for each power of
889// the indeterminant that has a 1 coefficient in x, add y times that power
890// to the result. x and y should be bytes representing elements of GF(2^8)
891
892function mult_GF256(x, y) {
893 var bit, result = 0;
894
895 for (bit = 1; bit < 256; bit *= 2, y = xtime(y)) {
896 if (x & bit)
897 result ^= y;
898 }
899 return result;
900}
901
902// Performs the substitution step of the cipher. State is the 2d array of
903// state information (see spec) and direction is string indicating whether
904// we are performing the forward substitution ("encrypt") or inverse
905// substitution (anything else)
906
907function byteSub(state, direction) {
908 var S;
909 if (direction == "encrypt") // Point S to the SBox we're using
910 S = SBox;
911 else
912 S = SBoxInverse;
913 for (var i = 0; i < 4; i++) // Substitute for every byte in state
914 for (var j = 0; j < Nb; j++)
915 state[i][j] = S[state[i][j]];
916}
917
918// Performs the row shifting step of the cipher.
919
920function shiftRow(state, direction) {
921 for (var i=1; i<4; i++) // Row 0 never shifts
922 if (direction == "encrypt")
923 state[i] = cyclicShiftLeft(state[i], shiftOffsets[Nb][i]);
924 else
925 state[i] = cyclicShiftLeft(state[i], Nb - shiftOffsets[Nb][i]);
926
927}
928
929// Performs the column mixing step of the cipher. Most of these steps can
930// be combined into table lookups on 32bit values (at least for encryption)
931// to greatly increase the speed.
932
933function mixColumn(state, direction) {
934 var b = []; // Result of matrix multiplications
935 for (var j = 0; j < Nb; j++) { // Go through each column...
936 for (var i = 0; i < 4; i++) { // and for each row in the column...
937 if (direction == "encrypt")
938 b[i] = mult_GF256(state[i][j], 2) ^ // perform mixing
939 mult_GF256(state[(i+1)%4][j], 3) ^
940 state[(i+2)%4][j] ^
941 state[(i+3)%4][j];
942 else
943 b[i] = mult_GF256(state[i][j], 0xE) ^
944 mult_GF256(state[(i+1)%4][j], 0xB) ^
945 mult_GF256(state[(i+2)%4][j], 0xD) ^
946 mult_GF256(state[(i+3)%4][j], 9);
947 }
948 for (var i = 0; i < 4; i++) // Place result back into column
949 state[i][j] = b[i];
950 }
951}
952
953// Adds the current round key to the state information. Straightforward.
954
955function addRoundKey(state, roundKey) {
956 for (var j = 0; j < Nb; j++) { // Step through columns...
957 state[0][j] ^= (roundKey[j] & 0xFF); // and XOR
958 state[1][j] ^= ((roundKey[j]>>8) & 0xFF);
959 state[2][j] ^= ((roundKey[j]>>16) & 0xFF);
960 state[3][j] ^= ((roundKey[j]>>24) & 0xFF);
961 }
962}
963
964// This function creates the expanded key from the input (128/192/256-bit)
965// key. The parameter key is an array of bytes holding the value of the key.
966// The returned value is an array whose elements are the 32-bit words that
967// make up the expanded key.
968
969function keyExpansion(key) {
970 var expandedKey = new Array();
971 var temp;
972
973 // in case the key size or parameters were changed...
974 Nk = keySizeInBits / 32;
975 Nb = blockSizeInBits / 32;
976 Nr = roundsArray[Nk][Nb];
977
978 for (var j=0; j < Nk; j++) // Fill in input key first
979 expandedKey[j] =
980 (key[4*j]) | (key[4*j+1]<<8) | (key[4*j+2]<<16) | (key[4*j+3]<<24);
981
982 // Now walk down the rest of the array filling in expanded key bytes as
983 // per Rijndael's spec
984 for (j = Nk; j < Nb * (Nr + 1); j++) { // For each word of expanded key
985 temp = expandedKey[j - 1];
986 if (j % Nk == 0)
987 temp = ( (SBox[(temp>>8) & 0xFF]) |
988 (SBox[(temp>>16) & 0xFF]<<8) |
989 (SBox[(temp>>24) & 0xFF]<<16) |
990 (SBox[temp & 0xFF]<<24) ) ^ Rcon[Math.floor(j / Nk) - 1];
991 else if (Nk > 6 && j % Nk == 4)
992 temp = (SBox[(temp>>24) & 0xFF]<<24) |
993 (SBox[(temp>>16) & 0xFF]<<16) |
994 (SBox[(temp>>8) & 0xFF]<<8) |
995 (SBox[temp & 0xFF]);
996 expandedKey[j] = expandedKey[j-Nk] ^ temp;
997 }
998 return expandedKey;
999}
1000
1001// Rijndael's round functions...
1002
1003function Round(state, roundKey) {
1004 byteSub(state, "encrypt");
1005 shiftRow(state, "encrypt");
1006 mixColumn(state, "encrypt");
1007 addRoundKey(state, roundKey);
1008}
1009
1010function InverseRound(state, roundKey) {
1011 addRoundKey(state, roundKey);
1012 mixColumn(state, "decrypt");
1013 shiftRow(state, "decrypt");
1014 byteSub(state, "decrypt");
1015}
1016
1017function FinalRound(state, roundKey) {
1018 byteSub(state, "encrypt");
1019 shiftRow(state, "encrypt");
1020 addRoundKey(state, roundKey);
1021}
1022
1023function InverseFinalRound(state, roundKey){
1024 addRoundKey(state, roundKey);
1025 shiftRow(state, "decrypt");
1026 byteSub(state, "decrypt");
1027}
1028
1029// encrypt is the basic encryption function. It takes parameters
1030// block, an array of bytes representing a plaintext block, and expandedKey,
1031// an array of words representing the expanded key previously returned by
1032// keyExpansion(). The ciphertext block is returned as an array of bytes.
1033
1034function encrypt(block, expandedKey) {
1035 var i;
1036 if (!block || block.length*8 != blockSizeInBits)
1037 return;
1038 if (!expandedKey)
1039 return;
1040
1041 block = packBytes(block);
1042 addRoundKey(block, expandedKey);
1043 for (i=1; i<Nr; i++)
1044 Round(block, expandedKey.slice(Nb*i, Nb*(i+1)));
1045 FinalRound(block, expandedKey.slice(Nb*Nr));
1046 return unpackBytes(block);
1047}
1048
1049// decrypt is the basic decryption function. It takes parameters
1050// block, an array of bytes representing a ciphertext block, and expandedKey,
1051// an array of words representing the expanded key previously returned by
1052// keyExpansion(). The decrypted block is returned as an array of bytes.
1053
1054function decrypt(block, expandedKey) {
1055 var i;
1056 if (!block || block.length*8 != blockSizeInBits)
1057 return;
1058 if (!expandedKey)
1059 return;
1060
1061 block = packBytes(block);
1062 InverseFinalRound(block, expandedKey.slice(Nb*Nr));
1063 for (i = Nr - 1; i>0; i--)
1064 InverseRound(block, expandedKey.slice(Nb*i, Nb*(i+1)));
1065 addRoundKey(block, expandedKey);
1066 return unpackBytes(block);
1067}
1068
1069/* !NEEDED
1070// This method takes a byte array (byteArray) and converts it to a string by
1071// applying String.fromCharCode() to each value and concatenating the result.
1072// The resulting string is returned. Note that this function SKIPS zero bytes
1073// under the assumption that they are padding added in formatPlaintext().
1074// Obviously, do not invoke this method on raw data that can contain zero
1075// bytes. It is really only appropriate for printable ASCII/Latin-1
1076// values. Roll your own function for more robust functionality :)
1077
1078function byteArrayToString(byteArray) {
1079 var result = "";
1080 for(var i=0; i<byteArray.length; i++)
1081 if (byteArray[i] != 0)
1082 result += String.fromCharCode(byteArray[i]);
1083 return result;
1084}
1085*/
1086
1087// This function takes an array of bytes (byteArray) and converts them
1088// to a hexadecimal string. Array element 0 is found at the beginning of
1089// the resulting string, high nibble first. Consecutive elements follow
1090// similarly, for example [16, 255] --> "10ff". The function returns a
1091// string.
1092
1093function byteArrayToHex(byteArray) {
1094 var result = "";
1095 if (!byteArray)
1096 return;
1097 for (var i=0; i<byteArray.length; i++)
1098 result += ((byteArray[i]<16) ? "0" : "") + byteArray[i].toString(16);
1099
1100 return result;
1101}
1102
1103// This function converts a string containing hexadecimal digits to an
1104// array of bytes. The resulting byte array is filled in the order the
1105// values occur in the string, for example "10FF" --> [16, 255]. This
1106// function returns an array.
1107
1108function hexToByteArray(hexString) {
1109 var byteArray = [];
1110 if (hexString.length % 2) // must have even length
1111 return;
1112 if (hexString.indexOf("0x") == 0 || hexString.indexOf("0X") == 0)
1113 hexString = hexString.substring(2);
1114 for (var i = 0; i<hexString.length; i += 2)
1115 byteArray[Math.floor(i/2)] = parseInt(hexString.slice(i, i+2), 16);
1116 return byteArray;
1117}
1118
1119// This function packs an array of bytes into the four row form defined by
1120// Rijndael. It assumes the length of the array of bytes is divisible by
1121// four. Bytes are filled in according to the Rijndael spec (starting with
1122// column 0, row 0 to 3). This function returns a 2d array.
1123
1124function packBytes(octets) {
1125 var state = new Array();
1126 if (!octets || octets.length % 4)
1127 return;
1128
1129 state[0] = new Array(); state[1] = new Array();
1130 state[2] = new Array(); state[3] = new Array();
1131 for (var j=0; j<octets.length; j+= 4) {
1132 state[0][j/4] = octets[j];
1133 state[1][j/4] = octets[j+1];
1134 state[2][j/4] = octets[j+2];
1135 state[3][j/4] = octets[j+3];
1136 }
1137 return state;
1138}
1139
1140// This function unpacks an array of bytes from the four row format preferred
1141// by Rijndael into a single 1d array of bytes. It assumes the input "packed"
1142// is a packed array. Bytes are filled in according to the Rijndael spec.
1143// This function returns a 1d array of bytes.
1144
1145function unpackBytes(packed) {
1146 var result = new Array();
1147 for (var j=0; j<packed[0].length; j++) {
1148 result[result.length] = packed[0][j];
1149 result[result.length] = packed[1][j];
1150 result[result.length] = packed[2][j];
1151 result[result.length] = packed[3][j];
1152 }
1153 return result;
1154}
1155
1156// This function takes a prospective plaintext (string or array of bytes)
1157// and pads it with pseudorandom bytes if its length is not a multiple of the block
1158// size. If plaintext is a string, it is converted to an array of bytes
1159// in the process. The type checking can be made much nicer using the
1160// instanceof operator, but this operator is not available until IE5.0 so I
1161// chose to use the heuristic below.
1162
1163function formatPlaintext(plaintext) {
1164 var bpb = blockSizeInBits / 8; // bytes per block
1165 var fillWithRandomBits;
1166 var i;
1167
1168 // if primitive string or String instance
1169 if ((!((typeof plaintext == "object") &&
1170 ((typeof (plaintext[0])) == "number"))) &&
1171 ((typeof plaintext == "string") || plaintext.indexOf))
1172 {
1173 plaintext = plaintext.split("");
1174 // Unicode issues here (ignoring high byte)
1175 for (i=0; i<plaintext.length; i++) {
1176 plaintext[i] = plaintext[i].charCodeAt(0) & 0xFF;
1177 }
1178 }
1179
1180 i = plaintext.length % bpb;
1181 if (i > 0) {
1182//alert("adding " + (bpb - 1) + " bytes");
1183 // plaintext = plaintext.concat(getRandomBytes(bpb - i));
1184 {
1185 varpaddingBytes;
1186 var ii,cc;
1187
1188 paddingBytes = new Array();
1189 cc = bpb - i;
1190 for (ii=0; ii<cc; ii++) {
1191 paddingBytes[ii] = cc;
1192 }
1193
1194//is("cc", cc);
1195//is(getRandomBytes(bpb - i) + "", paddingBytes + "");
1196 plaintext = plaintext.concat(paddingBytes);
1197 }
1198 }
1199
1200 return plaintext;
1201}
1202
1203// Returns an array containing "howMany" random bytes.
1204
1205function getRandomBytes(howMany) {
1206 var i, bytes = new Array();
1207
1208//alert("getting some random bytes");
1209 for (i = 0; i < howMany; i++) {
1210 bytes[i] = prng.nextInt(255);
1211 }
1212 return bytes;
1213}
1214
1215// rijndaelEncrypt(plaintext, key, mode)
1216// Encrypts the plaintext using the given key and in the given mode.
1217// The parameter "plaintext" can either be a string or an array of bytes.
1218// The parameter "key" must be an array of key bytes. If you have a hex
1219// string representing the key, invoke hexToByteArray() on it to convert it
1220// to an array of bytes. The third parameter "mode" is a string indicating
1221// the encryption mode to use, either "ECB" or "CBC". If the parameter is
1222// omitted, ECB is assumed.
1223//
1224// An array of bytes representing the cihpertext is returned. To convert
1225// this array to hex, invoke byteArrayToHex() on it.
1226
1227function rijndaelEncrypt(plaintext, key, mode) {
1228 var expandedKey, i, aBlock;
1229 var bpb = blockSizeInBits / 8; // bytes per block
1230 var ct; // ciphertext
1231
1232 if (!plaintext || !key)
1233 return;
1234 if (key.length*8 != keySizeInBits)
1235 return;
1236 if (mode == "CBC") {
1237 ct = getRandomBytes(bpb); // get IV
1238//dump("IV", byteArrayToHex(ct));
1239 } else {
1240 mode = "ECB";
1241 ct = new Array();
1242 }
1243
1244 // convert plaintext to byte array and pad with zeros if necessary.
1245 plaintext = formatPlaintext(plaintext);
1246
1247 expandedKey = keyExpansion(key);
1248
1249 for (var block = 0; block < plaintext.length / bpb; block++) {
1250 aBlock = plaintext.slice(block * bpb, (block + 1) * bpb);
1251 if (mode == "CBC") {
1252 for (var i = 0; i < bpb; i++) {
1253 aBlock[i] ^= ct[(block * bpb) + i];
1254 }
1255 }
1256 ct = ct.concat(encrypt(aBlock, expandedKey));
1257 }
1258
1259 return ct;
1260}
1261
1262// rijndaelDecrypt(ciphertext, key, mode)
1263// Decrypts the using the given key and mode. The parameter "ciphertext"
1264// must be an array of bytes. The parameter "key" must be an array of key
1265// bytes. If you have a hex string representing the ciphertext or key,
1266// invoke hexToByteArray() on it to convert it to an array of bytes. The
1267// parameter "mode" is a string, either "CBC" or "ECB".
1268//
1269// An array of bytes representing the plaintext is returned. To convert
1270// this array to a hex string, invoke byteArrayToHex() on it. To convert it
1271// to a string of characters, you can use byteArrayToString().
1272
1273function rijndaelDecrypt(ciphertext, key, mode) {
1274 var expandedKey;
1275 var bpb = blockSizeInBits / 8; // bytes per block
1276 var pt = new Array(); // plaintext array
1277 var aBlock; // a decrypted block
1278 var block; // current block number
1279
1280 if (!ciphertext || !key || typeof ciphertext == "string")
1281 return;
1282 if (key.length*8 != keySizeInBits)
1283 return;
1284 if (!mode) {
1285 mode = "ECB"; // assume ECB if mode omitted
1286 }
1287
1288 expandedKey = keyExpansion(key);
1289
1290 // work backwards to accomodate CBC mode
1291 for (block=(ciphertext.length / bpb)-1; block>0; block--) {
1292 aBlock =
1293 decrypt(ciphertext.slice(block*bpb,(block+1)*bpb), expandedKey);
1294 if (mode == "CBC")
1295 for (var i=0; i<bpb; i++)
1296 pt[(block-1)*bpb + i] = aBlock[i] ^ ciphertext[(block-1)*bpb + i];
1297 else
1298 pt = aBlock.concat(pt);
1299 }
1300
1301 // do last block if ECB (skips the IV in CBC)
1302 if (mode == "ECB")
1303 pt = decrypt(ciphertext.slice(0, bpb), expandedKey).concat(pt);
1304
1305 return pt;
1306}
1307
1308//#############################################################################
1309 //Downloaded on March 30, 2006 from http://www.fourmilab.ch/javascrypt/javascrypt.zip (utf-8.js)
1310//#############################################################################
1311
1312
1313 /*Encoding and decoding of Unicode character strings as
1314 UTF-8 byte streams. */
1315
1316 //UNICODE_TO_UTF8 -- Encode Unicode argument string as UTF-8 return value
1317
1318 function unicode_to_utf8(s) {
1319 var utf8 = "";
1320
1321 for (var n = 0; n < s.length; n++) {
1322 var c = s.charCodeAt(n);
1323
1324 if (c <= 0x7F) {
1325 // 0x00 - 0x7F: Emit as single byte, unchanged
1326 utf8 += String.fromCharCode(c);
1327 } else if ((c >= 0x80) && (c <= 0x7FF)) {
1328 // 0x80 - 0x7FF: Output as two byte code, 0xC0 in first byte
1329 // 0x80 in second byte
1330 utf8 += String.fromCharCode((c >> 6) | 0xC0);
1331 utf8 += String.fromCharCode((c & 0x3F) | 0x80);
1332 } else {
1333 // 0x800 - 0xFFFF: Output as three bytes, 0xE0 in first byte
1334 // 0x80 in second byte
1335 // 0x80 in third byte
1336 utf8 += String.fromCharCode((c >> 12) | 0xE0);
1337 utf8 += String.fromCharCode(((c >> 6) & 0x3F) | 0x80);
1338 utf8 += String.fromCharCode((c & 0x3F) | 0x80);
1339 }
1340 }
1341 return utf8;
1342 }
1343
1344 //UTF8_TO_UNICODE -- Decode UTF-8 argument into Unicode string return value
1345
1346 function utf8_to_unicode(utf8) {
1347 var s = "", i = 0, b1, b2, b2;
1348
1349 while (i < utf8.length) {
1350 b1 = utf8.charCodeAt(i);
1351 if (b1 < 0x80) { // One byte code: 0x00 0x7F
1352 s += String.fromCharCode(b1);
1353 i++;
1354 } else if((b1 >= 0xC0) && (b1 < 0xE0)) {// Two byte code: 0x80 - 0x7FF
1355 b2 = utf8.charCodeAt(i + 1);
1356 s += String.fromCharCode(((b1 & 0x1F) << 6) | (b2 & 0x3F));
1357 i += 2;
1358 } else { // Three byte code: 0x800 - 0xFFFF
1359 b2 = utf8.charCodeAt(i + 1);
1360 b3 = utf8.charCodeAt(i + 2);
1361 s += String.fromCharCode(((b1 & 0xF) << 12) |
1362 ((b2 & 0x3F) << 6) |
1363 (b3 & 0x3F));
1364 i += 3;
1365 }
1366 }
1367 return s;
1368 }
1369
1370 /*ENCODE_UTF8 -- Encode string as UTF8 only if it contains
1371 a character of 0x9D (Unicode OPERATING
1372 SYSTEM COMMAND) or a character greater
1373 than 0xFF. This permits all strings
1374 consisting exclusively of 8 bit
1375 graphic characters to be encoded as
1376 themselves. We choose 0x9D as the sentinel
1377 character as opposed to one of the more
1378 logical PRIVATE USE characters because 0x9D
1379 is not overloaded by the regrettable
1380 "Windows-1252" character set. Now such characters
1381 don't belong in JavaScript strings, but you never
1382 know what somebody is going to paste into a
1383 text box, so this choice keeps Windows-encoded
1384 strings from bloating to UTF-8 encoding. */
1385
1386 function encode_utf8(s) {
1387 var i, necessary = false;
1388
1389 for (i = 0; i < s.length; i++) {
1390 if ((s.charCodeAt(i) == 0x9D) ||
1391 (s.charCodeAt(i) > 0xFF)) {
1392 necessary = true;
1393 break;
1394 }
1395 }
1396 if (!necessary) {
1397 return s;
1398 }
1399 return String.fromCharCode(0x9D) + unicode_to_utf8(s);
1400 }
1401
1402 /* DECODE_UTF8 -- Decode a string encoded with encode_utf8
1403 above. If the string begins with the
1404 sentinel character 0x9D (OPERATING
1405 SYSTEM COMMAND), then we decode the
1406 balance as a UTF-8 stream. Otherwise,
1407 the string is output unchanged, as
1408 it's guaranteed to contain only 8 bit
1409 characters excluding 0x9D. */
1410
1411 function decode_utf8(s) {
1412 if ((s.length > 0) && (s.charCodeAt(0) == 0x9D)) {
1413 return utf8_to_unicode(s.substring(1));
1414 }
1415 return s;
1416 }
1417
1418
1419//#############################################################################
1420 //Downloaded on April 26, 2006 from http://pajhome.org.uk/crypt/md5/md5.js
1421//#############################################################################
1422
1423/*
1424 * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
1425 * Digest Algorithm, as defined in RFC 1321.
1426 * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
1427 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
1428 * Distributed under the BSD License
1429 * See http://pajhome.org.uk/crypt/md5 for more info.
1430 */
1431
1432/*
1433 * Configurable variables. You may need to tweak these to be compatible with
1434 * the server-side, but the defaults work in most cases.
1435 */
1436var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
1437var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
1438var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */
1439
1440/*
1441 * These are the functions you'll usually want to call
1442 * They take string arguments and return either hex or base-64 encoded strings
1443 */
1444function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
1445function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
1446function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
1447function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
1448function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
1449function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }
1450
1451/*
1452 * Perform a simple self-test to see if the VM is working
1453 */
1454function md5_vm_test()
1455{
1456 return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
1457}
1458
1459/*
1460 * Calculate the MD5 of an array of little-endian words, and a bit length
1461 */
1462function core_md5(x, len)
1463{
1464 /* append padding */
1465 x[len >> 5] |= 0x80 << ((len) % 32);
1466 x[(((len + 64) >>> 9) << 4) + 14] = len;
1467
1468 var a = 1732584193;
1469 var b = -271733879;
1470 var c = -1732584194;
1471 var d = 271733878;
1472
1473 for(var i = 0; i < x.length; i += 16)
1474 {
1475 var olda = a;
1476 var oldb = b;
1477 var oldc = c;
1478 var oldd = d;
1479
1480 a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
1481 d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
1482 c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
1483 b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
1484 a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
1485 d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
1486 c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
1487 b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
1488 a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
1489 d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
1490 c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
1491 b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
1492 a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
1493 d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
1494 c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
1495 b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
1496
1497 a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
1498 d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
1499 c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
1500 b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
1501 a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
1502 d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
1503 c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
1504 b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
1505 a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
1506 d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
1507 c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
1508 b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
1509 a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
1510 d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
1511 c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
1512 b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
1513
1514 a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
1515 d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
1516 c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
1517 b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
1518 a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
1519 d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
1520 c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
1521 b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
1522 a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
1523 d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
1524 c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
1525 b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
1526 a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
1527 d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
1528 c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
1529 b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
1530
1531 a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
1532 d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
1533 c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
1534 b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
1535 a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
1536 d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
1537 c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
1538 b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
1539 a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
1540 d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
1541 c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
1542 b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
1543 a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
1544 d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
1545 c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
1546 b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
1547
1548 a = safe_add(a, olda);
1549 b = safe_add(b, oldb);
1550 c = safe_add(c, oldc);
1551 d = safe_add(d, oldd);
1552 }
1553 return Array(a, b, c, d);
1554
1555}
1556
1557/*
1558 * These functions implement the four basic operations the algorithm uses.
1559 */
1560function md5_cmn(q, a, b, x, s, t)
1561{
1562 return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
1563}
1564function md5_ff(a, b, c, d, x, s, t)
1565{
1566 return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
1567}
1568function md5_gg(a, b, c, d, x, s, t)
1569{
1570 return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
1571}
1572function md5_hh(a, b, c, d, x, s, t)
1573{
1574 return md5_cmn(b ^ c ^ d, a, b, x, s, t);
1575}
1576function md5_ii(a, b, c, d, x, s, t)
1577{
1578 return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
1579}
1580
1581/*
1582 * Calculate the HMAC-MD5, of a key and some data
1583 */
1584function core_hmac_md5(key, data)
1585{
1586 var bkey = str2binl(key);
1587 if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);
1588
1589 var ipad = Array(16), opad = Array(16);
1590 for(var i = 0; i < 16; i++)
1591 {
1592 ipad[i] = bkey[i] ^ 0x36363636;
1593 opad[i] = bkey[i] ^ 0x5C5C5C5C;
1594 }
1595
1596 var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
1597 return core_md5(opad.concat(hash), 512 + 128);
1598}
1599
1600/*
1601 * Add integers, wrapping at 2^32. This uses 16-bit operations internally
1602 * to work around bugs in some JS interpreters.
1603 */
1604function safe_add(x, y)
1605{
1606 var lsw = (x & 0xFFFF) + (y & 0xFFFF);
1607 var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
1608 return (msw << 16) | (lsw & 0xFFFF);
1609}
1610
1611/*
1612 * Bitwise rotate a 32-bit number to the left.
1613 */
1614function bit_rol(num, cnt)
1615{
1616 return (num << cnt) | (num >>> (32 - cnt));
1617}
1618
1619/*
1620 * Convert a string to an array of little-endian words
1621 * If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
1622 */
1623function str2binl(str)
1624{
1625 var bin = Array();
1626 var mask = (1 << chrsz) - 1;
1627 for(var i = 0; i < str.length * chrsz; i += chrsz)
1628 bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
1629 return bin;
1630}
1631
1632/*
1633 * Convert an array of little-endian words to a string
1634 */
1635function binl2str(bin)
1636{
1637 var str = "";
1638 var mask = (1 << chrsz) - 1;
1639 for(var i = 0; i < bin.length * 32; i += chrsz)
1640 str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);
1641 return str;
1642}
1643
1644/*
1645 * Convert an array of little-endian words to a hex string.
1646 */
1647function binl2hex(binarray)
1648{
1649 var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
1650 var str = "";
1651 for(var i = 0; i < binarray.length * 4; i++)
1652 {
1653 str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
1654 hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);
1655 }
1656 return str;
1657}
1658
1659/*
1660 * Convert an array of little-endian words to a base-64 string
1661 */
1662function binl2b64(binarray)
1663{
1664 var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1665 var str = "";
1666 for(var i = 0; i < binarray.length * 4; i += 3)
1667 {
1668 var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16)
1669 | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
1670 | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
1671 for(var j = 0; j < 4; j++)
1672 {
1673 if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
1674 else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
1675 }
1676 }
1677 return str;
1678}
1679
1680
1681//#############################################################################
1682//#############################################################################
1683//#############################################################################
1684
1685
1686
1687MochiKit.Base.update(Clipperz.Crypto.Base, {
1688
1689 '__repr__': function () {
1690 return "[" + this.NAME + " " + this.VERSION + "]";
1691 },
1692
1693 'toString': function () {
1694 return this.__repr__();
1695 },
1696
1697 //-----------------------------------------------------------------------------
1698
1699 'encryptUsingSecretKey': function (aKey, aMessage) {
1700//Clipperz.Profile.start("Clipperz.Crypto.Base.encryptUsingSecretKey");
1701 var result;
1702 var plaintext;
1703 varheader;
1704 varkey;
1705
1706 key = hexToByteArray(Clipperz.Crypto.Base.computeHashValue(aKey));
1707
1708 addEntropyTime();
1709 prng = new AESprng(keyFromEntropy());
1710
1711 plaintext = encode_utf8(aMessage);
1712
1713 header = Clipperz.Base.byteArrayToString(hexToByteArray(Clipperz.Crypto.Base.computeMD5HashValue(plaintext)));
1714
1715 // Add message length in bytes to header
1716 i = plaintext.length;
1717 header += String.fromCharCode(i >>> 24);
1718 header += String.fromCharCode(i >>> 16);
1719 header += String.fromCharCode(i >>> 8);
1720 header += String.fromCharCode(i & 0xFF);
1721
1722 //The format of the actual message passed to rijndaelEncrypt
1723 //is:
1724 //
1725 // Bytes Content
1726 // 0-15 MD5 signature of plaintext
1727 // 16-19 Length of plaintext, big-endian order
1728 // 20-end Plaintext
1729 //
1730 //Note that this message will be padded with zero bytes
1731 //to an integral number of AES blocks (blockSizeInBits / 8).
1732 //This does not include the initial vector for CBC
1733 //encryption, which is added internally by rijndaelEncrypt.
1734 result = byteArrayToHex(rijndaelEncrypt(header + plaintext, key, "CBC"));
1735
1736 delete prng;
1737
1738//Clipperz.Profile.stop("Clipperz.Crypto.Base.encryptUsingSecretKey");
1739 return result;
1740 },
1741
1742 //.............................................................................
1743
1744 'decryptUsingSecretKey': function (aKey, aMessage) {
1745//Clipperz.Profile.start("Clipperz.Crypto.Base.decryptUsingSecretKey");
1746 varkey;
1747 var decryptedText;
1748 vartextLength;
1749 varheader;
1750 varheaderDigest;
1751 var plaintext;
1752 var i;
1753
1754 key = hexToByteArray(Clipperz.Crypto.Base.computeHashValue(aKey));
1755
1756 decryptedText = rijndaelDecrypt(hexToByteArray(aMessage), key, "CBC");
1757
1758 header = decryptedText.slice(0, 20);
1759 decryptedText = decryptedText.slice(20);
1760
1761 headerDigest = byteArrayToHex(header.slice(0,16));
1762 textLength = (header[16] << 24) | (header[17] << 16) | (header[18] << 8) | header[19];
1763
1764 if ((textLength < 0) || (textLength > decryptedText.length)) {
1765 // jslog.warning("Message (length " + decryptedText.length + ") truncated. " + textLength + " characters expected.");
1766 //Try to sauve qui peut by setting length to entire message
1767 textLength = decryptedText.length;
1768 }
1769
1770 plainText = "";
1771
1772 for (i=0; i<textLength; i++) {
1773 plainText += String.fromCharCode(decryptedText[i]);
1774 }
1775
1776 if (Clipperz.Crypto.Base.computeMD5HashValue(plainText) != headerDigest) {
1777 // jslog.warning("Message corrupted. Checksum of decrypted message does not match.");
1778 throw Clipperz.Crypto.Base.exception.CorruptedMessage;
1779 // throw new Error("Message corrupted. Checksum of decrypted message does not match. Parsed result: " + decode_utf8(plainText));
1780 }
1781
1782 // That's it; plug plaintext into the result field
1783
1784 result = decode_utf8(plainText);
1785
1786//Clipperz.Profile.stop("Clipperz.Crypto.Base.decryptUsingSecretKey");
1787 return result;
1788 },
1789
1790 //-----------------------------------------------------------------------------
1791
1792 'computeHashValue': function (aMessage) {
1793//Clipperz.Profile.start("Clipperz.Crypto.Base.computeHashValue");
1794 varresult;
1795
1796 result = hex_sha256(aMessage);
1797//Clipperz.Profile.stop("Clipperz.Crypto.Base.computeHashValue");
1798
1799 return result;
1800 },
1801
1802 //.........................................................................
1803
1804 'computeMD5HashValue': function (aMessage) {
1805 varresult;
1806//Clipperz.Profile.start("Clipperz.Crypto.Base.computeMD5HashValue");
1807 result = hex_md5(aMessage);
1808//Clipperz.Profile.stop("Clipperz.Crypto.Base.computeMD5HashValue");
1809
1810 return result;
1811 },
1812
1813 //-----------------------------------------------------------------------------
1814
1815 'generateRandomSeed': function () {
1816//Clipperz.Profile.start("Clipperz.Crypto.Base.generateRandomSeed");
1817 varresult;
1818 var seed;
1819 var prng;
1820 var charA;
1821 var i;
1822
1823 addEntropyTime();
1824
1825 seed = keyFromEntropy();
1826 prng = new AESprng(seed);
1827
1828 result = "";
1829 charA = ("A").charCodeAt(0);
1830
1831 for (i = 0; i < 64; i++) {
1832 result += String.fromCharCode(charA + prng.nextInt(25));
1833 }
1834
1835 delete prng;
1836
1837 result = Clipperz.Crypto.Base.computeHashValue(result);
1838
1839//Clipperz.Profile.stop("Clipperz.Crypto.Base.generateRandomSeed");
1840 return result;
1841 },
1842
1843 //-----------------------------------------------------------------------------
1844
1845 'exception': {
1846 'CorruptedMessage': new MochiKit.Base.NamedError("Clipperz.Crypto.Base.exception.CorruptedMessage")
1847 },
1848
1849 //.........................................................................
1850 __syntaxFix__: "syntax fix"
1851});
1852
diff --git a/frontend/beta/js/Clipperz/Crypto/BigInt.js b/frontend/beta/js/Clipperz/Crypto/BigInt.js
new file mode 100644
index 0000000..d4d05d2
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Crypto/BigInt.js
@@ -0,0 +1,1760 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; }
31
32//#############################################################################
33 //Downloaded on March 05, 2007 from http://www.leemon.com/crypto/BigInt.js
34//#############################################################################
35
36
37////////////////////////////////////////////////////////////////////////////////////////
38// Big Integer Library v. 5.0
39// Created 2000, last modified 2006
40// Leemon Baird
41// www.leemon.com
42//
43// This file is public domain. You can use it for any purpose without restriction.
44// I do not guarantee that it is correct, so use it at your own risk. If you use
45// it for something interesting, I'd appreciate hearing about it. If you find
46// any bugs or make any improvements, I'd appreciate hearing about those too.
47// It would also be nice if my name and address were left in the comments.
48// But none of that is required.
49//
50// This code defines a bigInt library for arbitrary-precision integers.
51// A bigInt is an array of integers storing the value in chunks of bpe bits,
52// little endian (buff[0] is the least significant word).
53// Negative bigInts are stored two's complement.
54// Some functions assume their parameters have at least one leading zero element.
55// Functions with an underscore at the end of the name have unpredictable behavior in case of overflow,
56// so the caller must make sure overflow won't happen.
57// For each function where a parameter is modified, that same
58// variable must not be used as another argument too.
59// So, you cannot square x by doing multMod_(x,x,n).
60// You must use squareMod_(x,n) instead, or do y=dup(x); multMod_(x,y,n).
61//
62// These functions are designed to avoid frequent dynamic memory allocation in the inner loop.
63// For most functions, if it needs a BigInt as a local variable it will actually use
64// a global, and will only allocate to it when it's not the right size. This ensures
65// that when a function is called repeatedly with same-sized parameters, it only allocates
66// memory on the first call.
67//
68// Note that for cryptographic purposes, the calls to Math.random() must
69// be replaced with calls to a better pseudorandom number generator.
70//
71// In the following, "bigInt" means a bigInt with at least one leading zero element,
72// and "integer" means a nonnegative integer less than radix. In some cases, integer
73// can be negative. Negative bigInts are 2s complement.
74//
75// The following functions do not modify their inputs, but dynamically allocate memory every time they are called:
76//
77// function bigInt2str(x,base) //convert a bigInt into a string in a given base, from base 2 up to base 95
78// function dup(x) //returns a copy of bigInt x
79// function findPrimes(n) //return array of all primes less than integer n
80// function int2bigInt(t,n,m) //convert integer t to a bigInt with at least n bits and m array elements
81// function int2bigInt(s,b,n,m) //convert string s in base b to a bigInt with at least n bits and m array elements
82// function trim(x,k) //return a copy of x with exactly k leading zero elements
83//
84// The following functions do not modify their inputs, so there is never a problem with the result being too big:
85//
86// function bitSize(x) //returns how many bits long the bigInt x is, not counting leading zeros
87// function equals(x,y) //is the bigInt x equal to the bigint y?
88// function equalsInt(x,y) //is bigint x equal to integer y?
89// function greater(x,y) //is x>y? (x and y are nonnegative bigInts)
90// function greaterShift(x,y,shift)//is (x <<(shift*bpe)) > y?
91// function isZero(x) //is the bigInt x equal to zero?
92// function millerRabin(x,b) //does one round of Miller-Rabin base integer b say that bigInt x is possibly prime (as opposed to definitely composite)?
93// function modInt(x,n) //return x mod n for bigInt x and integer n.
94// function negative(x) //is bigInt x negative?
95//
96// The following functions do not modify their inputs, but allocate memory and call functions with underscores
97//
98// function add(x,y) //return (x+y) for bigInts x and y.
99// function addInt(x,n) //return (x+n) where x is a bigInt and n is an integer.
100// function expand(x,n) //return a copy of x with at least n elements, adding leading zeros if needed
101// function inverseMod(x,n) //return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null
102// function mod(x,n) //return a new bigInt equal to (x mod n) for bigInts x and n.
103// function mult(x,y) //return x*y for bigInts x and y. This is faster when y<x.
104// function multMod(x,y,n) //return (x*y mod n) for bigInts x,y,n. For greater speed, let y<x.
105// function powMod(x,y,n) //return (x**y mod n) where x,y,n are bigInts and ** is exponentiation. 0**0=1. Faster for odd n.
106// function randTruePrime(k) //return a new, random, k-bit, true prime using Maurer's algorithm.
107// function sub(x,y) //return (x-y) for bigInts x and y. Negative answers will be 2s complement
108//
109// The following functions write a bigInt result to one of the parameters, but
110// the result is never bigger than the original, so there can't be overflow problems:
111//
112// function divInt_(x,n) //do x=floor(x/n) for bigInt x and integer n, and return the remainder
113// function GCD_(x,y) //set x to the greatest common divisor of bigInts x and y, (y is destroyed).
114// function halve_(x) //do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement
115// function mod_(x,n) //do x=x mod n for bigInts x and n.
116// function rightShift_(x,n) //right shift bigInt x by n bits. 0 <= n < bpe.
117//
118// The following functions write a bigInt result to one of the parameters. The caller is responsible for
119// ensuring it is large enough to hold the result.
120//
121// function addInt_(x,n) //do x=x+n where x is a bigInt and n is an integer
122// function add_(x,y) //do x=x+y for bigInts x and y
123// function addShift_(x,y,ys) //do x=x+(y<<(ys*bpe))
124// function copy_(x,y) //do x=y on bigInts x and y
125// function copyInt_(x,n) //do x=n on bigInt x and integer n
126// function carry_(x) //do carries and borrows so each element of the bigInt x fits in bpe bits.
127// function divide_(x,y,q,r) //divide_ x by y giving quotient q and remainder r
128// function eGCD_(x,y,d,a,b) //sets a,b,d to positive big integers such that d = GCD_(x,y) = a*x-b*y
129// function inverseMod_(x,n) //do x=x**(-1) mod n, for bigInts x and n. Returns 1 (0) if inverse does (doesn't) exist
130// function inverseModInt_(x,n) //return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse
131// function leftShift_(x,n) //left shift bigInt x by n bits. n<bpe.
132// function linComb_(x,y,a,b) //do x=a*x+b*y for bigInts x and y and integers a and b
133// function linCombShift_(x,y,b,ys) //do x=x+b*(y<<(ys*bpe)) for bigInts x and y, and integers b and ys
134// function mont_(x,y,n,np) //Montgomery multiplication (see comments where the function is defined)
135// function mult_(x,y) //do x=x*y for bigInts x and y.
136// function multInt_(x,n) //do x=x*n where x is a bigInt and n is an integer.
137// function multMod_(x,y,n) //do x=x*y mod n for bigInts x,y,n.
138// function powMod_(x,y,n) //do x=x**y mod n, where x,y,n are bigInts (n is odd) and ** is exponentiation. 0**0=1.
139// function randBigInt_(b,n,s) //do b = an n-bit random BigInt. if s=1, then nth bit (most significant bit) is set to 1. n>=1.
140// function randTruePrime_(ans,k) //do ans = a random k-bit true random prime (not just probable prime) with 1 in the msb.
141// function squareMod_(x,n) //do x=x*x mod n for bigInts x,n
142// function sub_(x,y) //do x=x-y for bigInts x and y. Negative answers will be 2s complement.
143// function subShift_(x,y,ys) //do x=x-(y<<(ys*bpe)). Negative answers will be 2s complement.
144//
145// The following functions are based on algorithms from the _Handbook of Applied Cryptography_
146// powMod_() = algorithm 14.94, Montgomery exponentiation
147// eGCD_,inverseMod_() = algorithm 14.61, Binary extended GCD_
148// GCD_() = algorothm 14.57, Lehmer's algorithm
149// mont_() = algorithm 14.36, Montgomery multiplication
150// divide_() = algorithm 14.20 Multiple-precision division
151// squareMod_() = algorithm 14.16 Multiple-precision squaring
152// randTruePrime_() = algorithm 4.62, Maurer's algorithm
153// millerRabin() = algorithm 4.24, Miller-Rabin algorithm
154//
155// Profiling shows:
156// randTruePrime_() spends:
157// 10% of its time in calls to powMod_()
158// 85% of its time in calls to millerRabin()
159// millerRabin() spends:
160// 99% of its time in calls to powMod_() (always with a base of 2)
161// powMod_() spends:
162// 94% of its time in calls to mont_() (almost always with x==y)
163//
164// This suggests there are several ways to speed up this library slightly:
165// - convert powMod_ to use a Montgomery form of k-ary window (or maybe a Montgomery form of sliding window)
166// -- this should especially focus on being fast when raising 2 to a power mod n
167// - convert randTruePrime_() to use a minimum r of 1/3 instead of 1/2 with the appropriate change to the test
168// - tune the parameters in randTruePrime_(), including c, m, and recLimit
169// - speed up the single loop in mont_() that takes 95% of the runtime, perhaps by reducing checking
170// within the loop when all the parameters are the same length.
171//
172// There are several ideas that look like they wouldn't help much at all:
173// - replacing trial division in randTruePrime_() with a sieve (that speeds up something taking almost no time anyway)
174// - increase bpe from 15 to 30 (that would help if we had a 32*32->64 multiplier, but not with JavaScript's 32*32->32)
175// - speeding up mont_(x,y,n,np) when x==y by doing a non-modular, non-Montgomery square
176// followed by a Montgomery reduction. The intermediate answer will be twice as long as x, so that
177// method would be slower. This is unfortunate because the code currently spends almost all of its time
178// doing mont_(x,x,...), both for randTruePrime_() and powMod_(). A faster method for Montgomery squaring
179// would have a large impact on the speed of randTruePrime_() and powMod_(). HAC has a couple of poorly-worded
180// sentences that seem to imply it's faster to do a non-modular square followed by a single
181// Montgomery reduction, but that's obviously wrong.
182////////////////////////////////////////////////////////////////////////////////////////
183
184//globals
185bpe=0; //bits stored per array element
186mask=0; //AND this with an array element to chop it down to bpe bits
187radix=mask+1; //equals 2^bpe. A single 1 bit to the left of the last bit of mask.
188
189//the digits for converting to different bases
190digitsStr='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_=!@#$%^&*()[]{}|;:,.<>/?`~ \\\'\"+-';
191
192//initialize the global variables
193for (bpe=0; (1<<(bpe+1)) > (1<<bpe); bpe++); //bpe=number of bits in the mantissa on this platform
194bpe>>=1; //bpe=number of bits in one element of the array representing the bigInt
195mask=(1<<bpe)-1; //AND the mask with an integer to get its bpe least significant bits
196radix=mask+1; //2^bpe. a single 1 bit to the left of the first bit of mask
197one=int2bigInt(1,1,1); //constant used in powMod_()
198
199//the following global variables are scratchpad memory to
200//reduce dynamic memory allocation in the inner loop
201t=new Array(0);
202ss=t; //used in mult_()
203s0=t; //used in multMod_(), squareMod_()
204s1=t; //used in powMod_(), multMod_(), squareMod_()
205s2=t; //used in powMod_(), multMod_()
206s3=t; //used in powMod_()
207s4=t; s5=t; //used in mod_()
208s6=t; //used in bigInt2str()
209s7=t; //used in powMod_()
210T=t; //used in GCD_()
211sa=t; //used in mont_()
212mr_x1=t; mr_r=t; mr_a=t; //used in millerRabin()
213eg_v=t; eg_u=t; eg_A=t; eg_B=t; eg_C=t; eg_D=t; //used in eGCD_(), inverseMod_()
214md_q1=t; md_q2=t; md_q3=t; md_r=t; md_r1=t; md_r2=t; md_tt=t; //used in mod_()
215
216primes=t; pows=t; s_i=t; s_i2=t; s_R=t; s_rm=t; s_q=t; s_n1=t;
217 s_a=t; s_r2=t; s_n=t; s_b=t; s_d=t; s_x1=t; s_x2=t, s_aa=t; //used in randTruePrime_()
218
219////////////////////////////////////////////////////////////////////////////////////////
220
221//return array of all primes less than integer n
222function findPrimes(n) {
223 var i,s,p,ans;
224 s=new Array(n);
225 for (i=0;i<n;i++)
226 s[i]=0;
227 s[0]=2;
228 p=0; //first p elements of s are primes, the rest are a sieve
229 for(;s[p]<n;) { //s[p] is the pth prime
230 for(i=s[p]*s[p]; i<n; i+=s[p]) //mark multiples of s[p]
231 s[i]=1;
232 p++;
233 s[p]=s[p-1]+1;
234 for(; s[p]<n && s[s[p]]; s[p]++); //find next prime (where s[p]==0)
235 }
236 ans=new Array(p);
237 for(i=0;i<p;i++)
238 ans[i]=s[i];
239 return ans;
240}
241
242//does a single round of Miller-Rabin base b consider x to be a possible prime?
243//x is a bigInt, and b is an integer
244function millerRabin(x,b) {
245 var i,j,k,s;
246
247 if (mr_x1.length!=x.length) {
248 mr_x1=dup(x);
249 mr_r=dup(x);
250 mr_a=dup(x);
251 }
252
253 copyInt_(mr_a,b);
254 copy_(mr_r,x);
255 copy_(mr_x1,x);
256
257 addInt_(mr_r,-1);
258 addInt_(mr_x1,-1);
259
260 //s=the highest power of two that divides mr_r
261 k=0;
262 for (i=0;i<mr_r.length;i++)
263 for (j=1;j<mask;j<<=1)
264 if (x[i] & j) {
265 s=(k<mr_r.length+bpe ? k : 0);
266 i=mr_r.length;
267 j=mask;
268 } else
269 k++;
270
271 if (s)
272 rightShift_(mr_r,s);
273
274 powMod_(mr_a,mr_r,x);
275
276 if (!equalsInt(mr_a,1) && !equals(mr_a,mr_x1)) {
277 j=1;
278 while (j<=s-1 && !equals(mr_a,mr_x1)) {
279 squareMod_(mr_a,x);
280 if (equalsInt(mr_a,1)) {
281 return 0;
282 }
283 j++;
284 }
285 if (!equals(mr_a,mr_x1)) {
286 return 0;
287 }
288 }
289 return 1;
290}
291
292//returns how many bits long the bigInt is, not counting leading zeros.
293function bitSize(x) {
294 var j,z,w;
295 for (j=x.length-1; (x[j]==0) && (j>0); j--);
296 for (z=0,w=x[j]; w; (w>>=1),z++);
297 z+=bpe*j;
298 return z;
299}
300
301//return a copy of x with at least n elements, adding leading zeros if needed
302function expand(x,n) {
303 var ans=int2bigInt(0,(x.length>n ? x.length : n)*bpe,0);
304 copy_(ans,x);
305 return ans;
306}
307
308//return a k-bit true random prime using Maurer's algorithm.
309function randTruePrime(k) {
310 var ans=int2bigInt(0,k,0);
311 randTruePrime_(ans,k);
312 return trim(ans,1);
313}
314
315//return a new bigInt equal to (x mod n) for bigInts x and n.
316function mod(x,n) {
317 var ans=dup(x);
318 mod_(ans,n);
319 return trim(ans,1);
320}
321
322//return (x+n) where x is a bigInt and n is an integer.
323function addInt(x,n) {
324 var ans=expand(x,x.length+1);
325 addInt_(ans,n);
326 return trim(ans,1);
327}
328
329//return x*y for bigInts x and y. This is faster when y<x.
330function mult(x,y) {
331 var ans=expand(x,x.length+y.length);
332 mult_(ans,y);
333 return trim(ans,1);
334}
335
336//return (x**y mod n) where x,y,n are bigInts and ** is exponentiation. 0**0=1. Faster for odd n.
337function powMod(x,y,n) {
338 var ans=expand(x,n.length);
339 powMod_(ans,trim(y,2),trim(n,2),0); //this should work without the trim, but doesn't
340 return trim(ans,1);
341}
342
343//return (x-y) for bigInts x and y. Negative answers will be 2s complement
344function sub(x,y) {
345 var ans=expand(x,(x.length>y.length ? x.length+1 : y.length+1));
346 sub_(ans,y);
347 return trim(ans,1);
348}
349
350//return (x+y) for bigInts x and y.
351function add(x,y) {
352 var ans=expand(x,(x.length>y.length ? x.length+1 : y.length+1));
353 add_(ans,y);
354 return trim(ans,1);
355}
356
357//return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null
358function inverseMod(x,n) {
359 var ans=expand(x,n.length);
360 var s;
361 s=inverseMod_(ans,n);
362 return s ? trim(ans,1) : null;
363}
364
365//return (x*y mod n) for bigInts x,y,n. For greater speed, let y<x.
366function multMod(x,y,n) {
367 var ans=expand(x,n.length);
368 multMod_(ans,y,n);
369 return trim(ans,1);
370}
371
372//generate a k-bit true random prime using Maurer's algorithm,
373//and put it into ans. The bigInt ans must be large enough to hold it.
374function randTruePrime_(ans,k) {
375 var c,m,pm,dd,j,r,B,divisible,z,zz,recSize;
376
377 if (primes.length==0)
378 primes=findPrimes(30000); //check for divisibility by primes <=30000
379
380 if (pows.length==0) {
381 pows=new Array(512);
382 for (j=0;j<512;j++) {
383 pows[j]=Math.pow(2,j/511.-1.);
384 }
385 }
386
387 //c and m should be tuned for a particular machine and value of k, to maximize speed
388 //this was: c=primes[primes.length-1]/k/k; //check using all the small primes. (c=0.1 in HAC)
389 c=0.1;
390 m=20; //generate this k-bit number by first recursively generating a number that has between k/2 and k-m bits
391 recLimit=20; /*must be at least 2 (was 29)*/ //stop recursion when k <=recLimit
392
393 if (s_i2.length!=ans.length) {
394 s_i2=dup(ans);
395 s_R =dup(ans);
396 s_n1=dup(ans);
397 s_r2=dup(ans);
398 s_d =dup(ans);
399 s_x1=dup(ans);
400 s_x2=dup(ans);
401 s_b =dup(ans);
402 s_n =dup(ans);
403 s_i =dup(ans);
404 s_rm=dup(ans);
405 s_q =dup(ans);
406 s_a =dup(ans);
407 s_aa=dup(ans);
408 }
409
410 if (k <= recLimit) { //generate small random primes by trial division up to its square root
411 pm=(1<<((k+2)>>1))-1; //pm is binary number with all ones, just over sqrt(2^k)
412 copyInt_(ans,0);
413 for (dd=1;dd;) {
414 dd=0;
415 ans[0]= 1 | (1<<(k-1)) | Math.floor(Math.random()*(1<<k)); //random, k-bit, odd integer, with msb 1
416 for (j=1;(j<primes.length) && ((primes[j]&pm)==primes[j]);j++) { //trial division by all primes 3...sqrt(2^k)
417 if (0==(ans[0]%primes[j])) {
418 dd=1;
419 break;
420 }
421 }
422 }
423 carry_(ans);
424 return;
425 }
426
427 B=c*k*k; //try small primes up to B (or all the primes[] array if the largest is less than B).
428 if (k>2*m) //generate this k-bit number by first recursively generating a number that has between k/2 and k-m bits
429 for (r=1; k-k*r<=m; )
430 r=pows[Math.floor(Math.random()*512)]; //r=Math.pow(2,Math.random()-1);
431 else
432 r=.5;
433
434 //simulation suggests the more complex algorithm using r=.333 is only slightly faster.
435
436 recSize=Math.floor(r*k)+1;
437
438 randTruePrime_(s_q,recSize);
439 copyInt_(s_i2,0);
440 s_i2[Math.floor((k-2)/bpe)] |= (1<<((k-2)%bpe)); //s_i2=2^(k-2)
441 divide_(s_i2,s_q,s_i,s_rm); //s_i=floor((2^(k-1))/(2q))
442
443 z=bitSize(s_i);
444
445 for (;;) {
446 for (;;) { //generate z-bit numbers until one falls in the range [0,s_i-1]
447 randBigInt_(s_R,z,0);
448 if (greater(s_i,s_R))
449 break;
450 } //now s_R is in the range [0,s_i-1]
451 addInt_(s_R,1); //now s_R is in the range [1,s_i]
452 add_(s_R,s_i); //now s_R is in the range [s_i+1,2*s_i]
453
454 copy_(s_n,s_q);
455 mult_(s_n,s_R);
456 multInt_(s_n,2);
457 addInt_(s_n,1); //s_n=2*s_R*s_q+1
458
459 copy_(s_r2,s_R);
460 multInt_(s_r2,2); //s_r2=2*s_R
461
462 //check s_n for divisibility by small primes up to B
463 for (divisible=0,j=0; (j<primes.length) && (primes[j]<B); j++)
464 if (modInt(s_n,primes[j])==0) {
465 divisible=1;
466 break;
467 }
468
469 if (!divisible) //if it passes small primes check, then try a single Miller-Rabin base 2
470 if (!millerRabin(s_n,2)) //this line represents 75% of the total runtime for randTruePrime_
471 divisible=1;
472
473 if (!divisible) { //if it passes that test, continue checking s_n
474 addInt_(s_n,-3);
475 for (j=s_n.length-1;(s_n[j]==0) && (j>0); j--); //strip leading zeros
476 for (zz=0,w=s_n[j]; w; (w>>=1),zz++);
477 zz+=bpe*j; //zz=number of bits in s_n, ignoring leading zeros
478 for (;;) { //generate z-bit numbers until one falls in the range [0,s_n-1]
479 randBigInt_(s_a,zz,0);
480 if (greater(s_n,s_a))
481 break;
482 } //now s_a is in the range [0,s_n-1]
483 addInt_(s_n,3); //now s_a is in the range [0,s_n-4]
484 addInt_(s_a,2); //now s_a is in the range [2,s_n-2]
485 copy_(s_b,s_a);
486 copy_(s_n1,s_n);
487 addInt_(s_n1,-1);
488 powMod_(s_b,s_n1,s_n); //s_b=s_a^(s_n-1) modulo s_n
489 addInt_(s_b,-1);
490 if (isZero(s_b)) {
491 copy_(s_b,s_a);
492 powMod_(s_b,s_r2,s_n);
493 addInt_(s_b,-1);
494 copy_(s_aa,s_n);
495 copy_(s_d,s_b);
496 GCD_(s_d,s_n); //if s_b and s_n are relatively prime, then s_n is a prime
497 if (equalsInt(s_d,1)) {
498 copy_(ans,s_aa);
499 return; //if we've made it this far, then s_n is absolutely guaranteed to be prime
500 }
501 }
502 }
503 }
504}
505
506//set b to an n-bit random BigInt. If s=1, then nth bit (most significant bit) is set to 1.
507//array b must be big enough to hold the result. Must have n>=1
508function randBigInt_(b,n,s) {
509 var i,a;
510 for (i=0;i<b.length;i++)
511 b[i]=0;
512 a=Math.floor((n-1)/bpe)+1; //# array elements to hold the BigInt
513 for (i=0;i<a;i++) {
514 b[i]=Math.floor(Math.random()*(1<<(bpe-1)));
515 }
516 b[a-1] &= (2<<((n-1)%bpe))-1;
517 if (s)
518 b[a-1] |= (1<<((n-1)%bpe));
519}
520
521//set x to the greatest common divisor of x and y.
522//x,y are bigInts with the same number of elements. y is destroyed.
523function GCD_(x,y) {
524 var i,xp,yp,A,B,C,D,q,sing;
525 if (T.length!=x.length)
526 T=dup(x);
527
528 sing=1;
529 while (sing) { //while y has nonzero elements other than y[0]
530 sing=0;
531 for (i=1;i<y.length;i++) //check if y has nonzero elements other than 0
532 if (y[i]) {
533 sing=1;
534 break;
535 }
536 if (!sing) break; //quit when y all zero elements except possibly y[0]
537
538 for (i=x.length;!x[i] && i>=0;i--); //find most significant element of x
539 xp=x[i];
540 yp=y[i];
541 A=1; B=0; C=0; D=1;
542 while ((yp+C) && (yp+D)) {
543 q =Math.floor((xp+A)/(yp+C));
544 qp=Math.floor((xp+B)/(yp+D));
545 if (q!=qp)
546 break;
547 t= A-q*C; A=C; C=t; // do (A,B,xp, C,D,yp) = (C,D,yp, A,B,xp) - q*(0,0,0, C,D,yp)
548 t= B-q*D; B=D; D=t;
549 t=xp-q*yp; xp=yp; yp=t;
550 }
551 if (B) {
552 copy_(T,x);
553 linComb_(x,y,A,B); //x=A*x+B*y
554 linComb_(y,T,D,C); //y=D*y+C*T
555 } else {
556 mod_(x,y);
557 copy_(T,x);
558 copy_(x,y);
559 copy_(y,T);
560 }
561 }
562 if (y[0]==0)
563 return;
564 t=modInt(x,y[0]);
565 copyInt_(x,y[0]);
566 y[0]=t;
567 while (y[0]) {
568 x[0]%=y[0];
569 t=x[0]; x[0]=y[0]; y[0]=t;
570 }
571}
572
573//do x=x**(-1) mod n, for bigInts x and n.
574//If no inverse exists, it sets x to zero and returns 0, else it returns 1.
575//The x array must be at least as large as the n array.
576function inverseMod_(x,n) {
577 var k=1+2*Math.max(x.length,n.length);
578
579 if(!(x[0]&1) && !(n[0]&1)) { //if both inputs are even, then inverse doesn't exist
580 copyInt_(x,0);
581 return 0;
582 }
583
584 if (eg_u.length!=k) {
585 eg_u=new Array(k);
586 eg_v=new Array(k);
587 eg_A=new Array(k);
588 eg_B=new Array(k);
589 eg_C=new Array(k);
590 eg_D=new Array(k);
591 }
592
593 copy_(eg_u,x);
594 copy_(eg_v,n);
595 copyInt_(eg_A,1);
596 copyInt_(eg_B,0);
597 copyInt_(eg_C,0);
598 copyInt_(eg_D,1);
599 for (;;) {
600 while(!(eg_u[0]&1)) { //while eg_u is even
601 halve_(eg_u);
602 if (!(eg_A[0]&1) && !(eg_B[0]&1)) { //if eg_A==eg_B==0 mod 2
603 halve_(eg_A);
604 halve_(eg_B);
605 } else {
606 add_(eg_A,n); halve_(eg_A);
607 sub_(eg_B,x); halve_(eg_B);
608 }
609 }
610
611 while (!(eg_v[0]&1)) { //while eg_v is even
612 halve_(eg_v);
613 if (!(eg_C[0]&1) && !(eg_D[0]&1)) { //if eg_C==eg_D==0 mod 2
614 halve_(eg_C);
615 halve_(eg_D);
616 } else {
617 add_(eg_C,n); halve_(eg_C);
618 sub_(eg_D,x); halve_(eg_D);
619 }
620 }
621
622 if (!greater(eg_v,eg_u)) { //eg_v <= eg_u
623 sub_(eg_u,eg_v);
624 sub_(eg_A,eg_C);
625 sub_(eg_B,eg_D);
626 } else { //eg_v > eg_u
627 sub_(eg_v,eg_u);
628 sub_(eg_C,eg_A);
629 sub_(eg_D,eg_B);
630 }
631
632 if (equalsInt(eg_u,0)) {
633 if (negative(eg_C)) //make sure answer is nonnegative
634 add_(eg_C,n);
635 copy_(x,eg_C);
636
637 if (!equalsInt(eg_v,1)) { //if GCD_(x,n)!=1, then there is no inverse
638 copyInt_(x,0);
639 return 0;
640 }
641 return 1;
642 }
643 }
644}
645
646//return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse
647function inverseModInt_(x,n) {
648 var a=1,b=0,t;
649 for (;;) {
650 if (x==1) return a;
651 if (x==0) return 0;
652 b-=a*Math.floor(n/x);
653 n%=x;
654
655 if (n==1) return b; //to avoid negatives, change this b to n-b, and each -= to +=
656 if (n==0) return 0;
657 a-=b*Math.floor(x/n);
658 x%=n;
659 }
660}
661
662//Given positive bigInts x and y, change the bigints v, a, and b to positive bigInts such that:
663// v = GCD_(x,y) = a*x-b*y
664//The bigInts v, a, b, must have exactly as many elements as the larger of x and y.
665function eGCD_(x,y,v,a,b) {
666 var g=0;
667 var k=Math.max(x.length,y.length);
668 if (eg_u.length!=k) {
669 eg_u=new Array(k);
670 eg_A=new Array(k);
671 eg_B=new Array(k);
672 eg_C=new Array(k);
673 eg_D=new Array(k);
674 }
675 while(!(x[0]&1) && !(y[0]&1)) { //while x and y both even
676 halve_(x);
677 halve_(y);
678 g++;
679 }
680 copy_(eg_u,x);
681 copy_(v,y);
682 copyInt_(eg_A,1);
683 copyInt_(eg_B,0);
684 copyInt_(eg_C,0);
685 copyInt_(eg_D,1);
686 for (;;) {
687 while(!(eg_u[0]&1)) { //while u is even
688 halve_(eg_u);
689 if (!(eg_A[0]&1) && !(eg_B[0]&1)) { //if A==B==0 mod 2
690 halve_(eg_A);
691 halve_(eg_B);
692 } else {
693 add_(eg_A,y); halve_(eg_A);
694 sub_(eg_B,x); halve_(eg_B);
695 }
696 }
697
698 while (!(v[0]&1)) { //while v is even
699 halve_(v);
700 if (!(eg_C[0]&1) && !(eg_D[0]&1)) { //if C==D==0 mod 2
701 halve_(eg_C);
702 halve_(eg_D);
703 } else {
704 add_(eg_C,y); halve_(eg_C);
705 sub_(eg_D,x); halve_(eg_D);
706 }
707 }
708
709 if (!greater(v,eg_u)) { //v<=u
710 sub_(eg_u,v);
711 sub_(eg_A,eg_C);
712 sub_(eg_B,eg_D);
713 } else { //v>u
714 sub_(v,eg_u);
715 sub_(eg_C,eg_A);
716 sub_(eg_D,eg_B);
717 }
718 if (equalsInt(eg_u,0)) {
719 if (negative(eg_C)) { //make sure a (C)is nonnegative
720 add_(eg_C,y);
721 sub_(eg_D,x);
722 }
723 multInt_(eg_D,-1); ///make sure b (D) is nonnegative
724 copy_(a,eg_C);
725 copy_(b,eg_D);
726 leftShift_(v,g);
727 return;
728 }
729 }
730}
731
732
733//is bigInt x negative?
734function negative(x) {
735 return ((x[x.length-1]>>(bpe-1))&1);
736}
737
738
739//is (x << (shift*bpe)) > y?
740//x and y are nonnegative bigInts
741//shift is a nonnegative integer
742function greaterShift(x,y,shift) {
743 var kx=x.length, ky=y.length;
744 k=((kx+shift)<ky) ? (kx+shift) : ky;
745 for (i=ky-1-shift; i<kx && i>=0; i++)
746 if (x[i]>0)
747 return 1; //if there are nonzeros in x to the left of the first column of y, then x is bigger
748 for (i=kx-1+shift; i<ky; i++)
749 if (y[i]>0)
750 return 0; //if there are nonzeros in y to the left of the first column of x, then x is not bigger
751 for (i=k-1; i>=shift; i--)
752 if (x[i-shift]>y[i]) return 1;
753 else if (x[i-shift]<y[i]) return 0;
754 return 0;
755}
756
757//is x > y? (x and y both nonnegative)
758function greater(x,y) {
759 var i;
760 var k=(x.length<y.length) ? x.length : y.length;
761
762 for (i=x.length;i<y.length;i++)
763 if (y[i])
764 return 0; //y has more digits
765
766 for (i=y.length;i<x.length;i++)
767 if (x[i])
768 return 1; //x has more digits
769
770 for (i=k-1;i>=0;i--)
771 if (x[i]>y[i])
772 return 1;
773 else if (x[i]<y[i])
774 return 0;
775 return 0;
776}
777
778//divide_ x by y giving quotient q and remainder r. (q=floor(x/y), r=x mod y). All 4 are bigints.
779//x must have at least one leading zero element.
780//y must be nonzero.
781//q and r must be arrays that are exactly the same length as x.
782//the x array must have at least as many elements as y.
783function divide_(x,y,q,r) {
784 var kx, ky;
785 var i,j,y1,y2,c,a,b;
786 copy_(r,x);
787 for (ky=y.length;y[ky-1]==0;ky--); //kx,ky is number of elements in x,y, not including leading zeros
788 for (kx=r.length;r[kx-1]==0 && kx>ky;kx--);
789
790 //normalize: ensure the most significant element of y has its highest bit set
791 b=y[ky-1];
792 for (a=0; b; a++)
793 b>>=1;
794 a=bpe-a; //a is how many bits to shift so that the high order bit of y is leftmost in its array element
795 leftShift_(y,a); //multiply both by 1<<a now, then divide_ both by that at the end
796 leftShift_(r,a);
797
798 copyInt_(q,0); // q=0
799 while (!greaterShift(y,r,kx-ky)) { // while (leftShift_(y,kx-ky) <= r) {
800 subShift_(r,y,kx-ky); // r=r-leftShift_(y,kx-ky)
801 q[kx-ky]++; // q[kx-ky]++;
802 } // }
803
804 for (i=kx-1; i>=ky; i--) {
805 if (r[i]==y[ky-1])
806 q[i-ky]=mask;
807 else
808 q[i-ky]=Math.floor((r[i]*radix+r[i-1])/y[ky-1]);
809
810 //The following for(;;) loop is equivalent to the commented while loop,
811 //except that the uncommented version avoids overflow.
812 //The commented loop comes from HAC, which assumes r[-1]==y[-1]==0
813 // while (q[i-ky]*(y[ky-1]*radix+y[ky-2]) > r[i]*radix*radix+r[i-1]*radix+r[i-2])
814 // q[i-ky]--;
815 for (;;) {
816 y2=(ky>1 ? y[ky-2] : 0)*q[i-ky];
817 c=y2>>bpe;
818 y2=y2 & mask;
819 y1=c+q[i-ky]*y[ky-1];
820 c=y1>>bpe;
821 y1=y1 & mask;
822
823 if (c==r[i] ? y1==r[i-1] ? y2>(i>1 ? r[i-2] : 0) : y1>r[i-1] : c>r[i])
824 q[i-ky]--;
825 else
826 break;
827 }
828
829 linCombShift_(r,y,-q[i-ky],i-ky); //r=r-q[i-ky]*leftShift_(y,i-ky)
830 if (negative(r)) {
831 addShift_(r,y,i-ky); //r=r+leftShift_(y,i-ky)
832 q[i-ky]--;
833 }
834 }
835
836 rightShift_(y,a); //undo the normalization step
837 rightShift_(r,a); //undo the normalization step
838}
839
840//do carries and borrows so each element of the bigInt x fits in bpe bits.
841function carry_(x) {
842 var i,k,c,b;
843 k=x.length;
844 c=0;
845 for (i=0;i<k;i++) {
846 c+=x[i];
847 b=0;
848 if (c<0) {
849 b=-(c>>bpe);
850 c+=b*radix;
851 }
852 x[i]=c & mask;
853 c=(c>>bpe)-b;
854 }
855}
856
857//return x mod n for bigInt x and integer n.
858function modInt(x,n) {
859 var i,c=0;
860 for (i=x.length-1; i>=0; i--)
861 c=(c*radix+x[i])%n;
862 return c;
863}
864
865//convert the integer t into a bigInt with at least the given number of bits.
866//the returned array stores the bigInt in bpe-bit chunks, little endian (buff[0] is least significant word)
867//Pad the array with leading zeros so that it has at least minSize elements.
868//There will always be at least one leading 0 element.
869function int2bigInt(t,bits,minSize) {
870 var i,k;
871 k=Math.ceil(bits/bpe)+1;
872 k=minSize>k ? minSize : k;
873 buff=new Array(k);
874 copyInt_(buff,t);
875 return buff;
876}
877
878//return the bigInt given a string representation in a given base.
879//Pad the array with leading zeros so that it has at least minSize elements.
880//If base=-1, then it reads in a space-separated list of array elements in decimal.
881//The array will always have at least one leading zero, unless base=-1.
882function str2bigInt(s,base,minSize) {
883 var d, i, j, x, y, kk;
884 var k=s.length;
885 if (base==-1) { //comma-separated list of array elements in decimal
886 x=new Array(0);
887 for (;;) {
888 y=new Array(x.length+1);
889 for (i=0;i<x.length;i++)
890 y[i+1]=x[i];
891 y[0]=parseInt(s,10);
892 x=y;
893 d=s.indexOf(',',0);
894 if (d<1)
895 break;
896 s=s.substring(d+1);
897 if (s.length==0)
898 break;
899 }
900 if (x.length<minSize) {
901 y=new Array(minSize);
902 copy_(y,x);
903 return y;
904 }
905 return x;
906 }
907
908 x=int2bigInt(0,base*k,0);
909 for (i=0;i<k;i++) {
910 d=digitsStr.indexOf(s.substring(i,i+1),0);
911 if (base<=36 && d>=36) //convert lowercase to uppercase if base<=36
912 d-=26;
913 if (d<base && d>=0) { //ignore illegal characters
914 multInt_(x,base);
915 addInt_(x,d);
916 }
917 }
918
919 for (k=x.length;k>0 && !x[k-1];k--); //strip off leading zeros
920 k=minSize>k+1 ? minSize : k+1;
921 y=new Array(k);
922 kk=k<x.length ? k : x.length;
923 for (i=0;i<kk;i++)
924 y[i]=x[i];
925 for (;i<k;i++)
926 y[i]=0;
927 return y;
928}
929
930//is bigint x equal to integer y?
931//y must have less than bpe bits
932function equalsInt(x,y) {
933 var i;
934 if (x[0]!=y)
935 return 0;
936 for (i=1;i<x.length;i++)
937 if (x[i])
938 return 0;
939 return 1;
940}
941
942//are bigints x and y equal?
943//this works even if x and y are different lengths and have arbitrarily many leading zeros
944function equals(x,y) {
945 var i;
946 var k=x.length<y.length ? x.length : y.length;
947 for (i=0;i<k;i++)
948 if (x[i]!=y[i])
949 return 0;
950 if (x.length>y.length) {
951 for (;i<x.length;i++)
952 if (x[i])
953 return 0;
954 } else {
955 for (;i<y.length;i++)
956 if (y[i])
957 return 0;
958 }
959 return 1;
960}
961
962//is the bigInt x equal to zero?
963function isZero(x) {
964 var i;
965 for (i=0;i<x.length;i++)
966 if (x[i])
967 return 0;
968 return 1;
969}
970
971//convert a bigInt into a string in a given base, from base 2 up to base 95.
972//Base -1 prints the contents of the array representing the number.
973function bigInt2str(x,base) {
974 var i,t,s="";
975
976 if (s6.length!=x.length)
977 s6=dup(x);
978 else
979 copy_(s6,x);
980
981 if (base==-1) { //return the list of array contents
982 for (i=x.length-1;i>0;i--)
983 s+=x[i]+',';
984 s+=x[0];
985 }
986 else { //return it in the given base
987 while (!isZero(s6)) {
988 t=divInt_(s6,base); //t=s6 % base; s6=floor(s6/base);
989 s=digitsStr.substring(t,t+1)+s;
990 }
991 }
992 if (s.length==0)
993 s="0";
994 return s;
995}
996
997//returns a duplicate of bigInt x
998function dup(x) {
999 var i;
1000 buff=new Array(x.length);
1001 copy_(buff,x);
1002 return buff;
1003}
1004
1005//do x=y on bigInts x and y. x must be an array at least as big as y (not counting the leading zeros in y).
1006function copy_(x,y) {
1007 var i;
1008 var k=x.length<y.length ? x.length : y.length;
1009 for (i=0;i<k;i++)
1010 x[i]=y[i];
1011 for (i=k;i<x.length;i++)
1012 x[i]=0;
1013}
1014
1015//do x=y on bigInt x and integer y.
1016function copyInt_(x,n) {
1017 var i,c;
1018 for (c=n,i=0;i<x.length;i++) {
1019 x[i]=c & mask;
1020 c>>=bpe;
1021 }
1022}
1023
1024//do x=x+n where x is a bigInt and n is an integer.
1025//x must be large enough to hold the result.
1026function addInt_(x,n) {
1027 var i,k,c,b;
1028 x[0]+=n;
1029 k=x.length;
1030 c=0;
1031 for (i=0;i<k;i++) {
1032 c+=x[i];
1033 b=0;
1034 if (c<0) {
1035 b=-(c>>bpe);
1036 c+=b*radix;
1037 }
1038 x[i]=c & mask;
1039 c=(c>>bpe)-b;
1040 if (!c) return; //stop carrying as soon as the carry_ is zero
1041 }
1042}
1043
1044//right shift bigInt x by n bits. 0 <= n < bpe.
1045function rightShift_(x,n) {
1046 var i;
1047 var k=Math.floor(n/bpe);
1048 if (k) {
1049 for (i=0;i<x.length-k;i++) //right shift x by k elements
1050 x[i]=x[i+k];
1051 for (;i<x.length;i++)
1052 x[i]=0;
1053 n%=bpe;
1054 }
1055 for (i=0;i<x.length-1;i++) {
1056 x[i]=mask & ((x[i+1]<<(bpe-n)) | (x[i]>>n));
1057 }
1058 x[i]>>=n;
1059}
1060
1061//do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement
1062function halve_(x) {
1063 var i;
1064 for (i=0;i<x.length-1;i++) {
1065 x[i]=mask & ((x[i+1]<<(bpe-1)) | (x[i]>>1));
1066 }
1067 x[i]=(x[i]>>1) | (x[i] & (radix>>1)); //most significant bit stays the same
1068}
1069
1070//left shift bigInt x by n bits.
1071function leftShift_(x,n) {
1072 var i;
1073 var k=Math.floor(n/bpe);
1074 if (k) {
1075 for (i=x.length; i>=k; i--) //left shift x by k elements
1076 x[i]=x[i-k];
1077 for (;i>=0;i--)
1078 x[i]=0;
1079 n%=bpe;
1080 }
1081 if (!n)
1082 return;
1083 for (i=x.length-1;i>0;i--) {
1084 x[i]=mask & ((x[i]<<n) | (x[i-1]>>(bpe-n)));
1085 }
1086 x[i]=mask & (x[i]<<n);
1087}
1088
1089//do x=x*n where x is a bigInt and n is an integer.
1090//x must be large enough to hold the result.
1091function multInt_(x,n) {
1092 var i,k,c,b;
1093 if (!n)
1094 return;
1095 k=x.length;
1096 c=0;
1097 for (i=0;i<k;i++) {
1098 c+=x[i]*n;
1099 b=0;
1100 if (c<0) {
1101 b=-(c>>bpe);
1102 c+=b*radix;
1103 }
1104 x[i]=c & mask;
1105 c=(c>>bpe)-b;
1106 }
1107}
1108
1109//do x=floor(x/n) for bigInt x and integer n, and return the remainder
1110function divInt_(x,n) {
1111 var i,r=0,s;
1112 for (i=x.length-1;i>=0;i--) {
1113 s=r*radix+x[i];
1114 x[i]=Math.floor(s/n);
1115 r=s%n;
1116 }
1117 return r;
1118}
1119
1120//do the linear combination x=a*x+b*y for bigInts x and y, and integers a and b.
1121//x must be large enough to hold the answer.
1122function linComb_(x,y,a,b) {
1123 var i,c,k,kk;
1124 k=x.length<y.length ? x.length : y.length;
1125 kk=x.length;
1126 for (c=0,i=0;i<k;i++) {
1127 c+=a*x[i]+b*y[i];
1128 x[i]=c & mask;
1129 c>>=bpe;
1130 }
1131 for (i=k;i<kk;i++) {
1132 c+=a*x[i];
1133 x[i]=c & mask;
1134 c>>=bpe;
1135 }
1136}
1137
1138//do the linear combination x=a*x+b*(y<<(ys*bpe)) for bigInts x and y, and integers a, b and ys.
1139//x must be large enough to hold the answer.
1140function linCombShift_(x,y,b,ys) {
1141 var i,c,k,kk;
1142 k=x.length<ys+y.length ? x.length : ys+y.length;
1143 kk=x.length;
1144 for (c=0,i=ys;i<k;i++) {
1145 c+=x[i]+b*y[i-ys];
1146 x[i]=c & mask;
1147 c>>=bpe;
1148 }
1149 for (i=k;c && i<kk;i++) {
1150 c+=x[i];
1151 x[i]=c & mask;
1152 c>>=bpe;
1153 }
1154}
1155
1156//do x=x+(y<<(ys*bpe)) for bigInts x and y, and integers a,b and ys.
1157//x must be large enough to hold the answer.
1158function addShift_(x,y,ys) {
1159 var i,c,k,kk;
1160 k=x.length<ys+y.length ? x.length : ys+y.length;
1161 kk=x.length;
1162 for (c=0,i=ys;i<k;i++) {
1163 c+=x[i]+y[i-ys];
1164 x[i]=c & mask;
1165 c>>=bpe;
1166 }
1167 for (i=k;c && i<kk;i++) {
1168 c+=x[i];
1169 x[i]=c & mask;
1170 c>>=bpe;
1171 }
1172}
1173
1174//do x=x-(y<<(ys*bpe)) for bigInts x and y, and integers a,b and ys.
1175//x must be large enough to hold the answer.
1176function subShift_(x,y,ys) {
1177 var i,c,k,kk;
1178 k=x.length<ys+y.length ? x.length : ys+y.length;
1179 kk=x.length;
1180 for (c=0,i=ys;i<k;i++) {
1181 c+=x[i]-y[i-ys];
1182 x[i]=c & mask;
1183 c>>=bpe;
1184 }
1185 for (i=k;c && i<kk;i++) {
1186 c+=x[i];
1187 x[i]=c & mask;
1188 c>>=bpe;
1189 }
1190}
1191
1192//do x=x-y for bigInts x and y.
1193//x must be large enough to hold the answer.
1194//negative answers will be 2s complement
1195function sub_(x,y) {
1196 var i,c,k,kk;
1197 k=x.length<y.length ? x.length : y.length;
1198 for (c=0,i=0;i<k;i++) {
1199 c+=x[i]-y[i];
1200 x[i]=c & mask;
1201 c>>=bpe;
1202 }
1203 for (i=k;c && i<x.length;i++) {
1204 c+=x[i];
1205 x[i]=c & mask;
1206 c>>=bpe;
1207 }
1208}
1209
1210//do x=x+y for bigInts x and y.
1211//x must be large enough to hold the answer.
1212function add_(x,y) {
1213 var i,c,k,kk;
1214 k=x.length<y.length ? x.length : y.length;
1215 for (c=0,i=0;i<k;i++) {
1216 c+=x[i]+y[i];
1217 x[i]=c & mask;
1218 c>>=bpe;
1219 }
1220 for (i=k;c && i<x.length;i++) {
1221 c+=x[i];
1222 x[i]=c & mask;
1223 c>>=bpe;
1224 }
1225}
1226
1227//do x=x*y for bigInts x and y. This is faster when y<x.
1228function mult_(x,y) {
1229 var i;
1230 if (ss.length!=2*x.length)
1231 ss=new Array(2*x.length);
1232 copyInt_(ss,0);
1233 for (i=0;i<y.length;i++)
1234 if (y[i])
1235 linCombShift_(ss,x,y[i],i); //ss=1*ss+y[i]*(x<<(i*bpe))
1236 copy_(x,ss);
1237}
1238
1239//do x=x mod n for bigInts x and n.
1240function mod_(x,n) {
1241 if (s4.length!=x.length)
1242 s4=dup(x);
1243 else
1244 copy_(s4,x);
1245 if (s5.length!=x.length)
1246 s5=dup(x);
1247 divide_(s4,n,s5,x); //x = remainder of s4 / n
1248}
1249
1250//do x=x*y mod n for bigInts x,y,n.
1251//for greater speed, let y<x.
1252function multMod_(x,y,n) {
1253 var i;
1254 if (s0.length!=2*x.length)
1255 s0=new Array(2*x.length);
1256 copyInt_(s0,0);
1257 for (i=0;i<y.length;i++)
1258 if (y[i])
1259 linCombShift_(s0,x,y[i],i); //s0=1*s0+y[i]*(x<<(i*bpe))
1260 mod_(s0,n);
1261 copy_(x,s0);
1262}
1263
1264//do x=x*x mod n for bigInts x,n.
1265function squareMod_(x,n) {
1266 var i,j,d,c,kx,kn,k;
1267 for (kx=x.length; kx>0 && !x[kx-1]; kx--); //ignore leading zeros in x
1268 k=kx>n.length ? 2*kx : 2*n.length; //k=# elements in the product, which is twice the elements in the larger of x and n
1269 if (s0.length!=k)
1270 s0=new Array(k);
1271 copyInt_(s0,0);
1272 for (i=0;i<kx;i++) {
1273 c=s0[2*i]+x[i]*x[i];
1274 s0[2*i]=c & mask;
1275 c>>=bpe;
1276 for (j=i+1;j<kx;j++) {
1277 c=s0[i+j]+2*x[i]*x[j]+c;
1278 s0[i+j]=(c & mask);
1279 c>>=bpe;
1280 }
1281 s0[i+kx]=c;
1282 }
1283 mod_(s0,n);
1284 copy_(x,s0);
1285}
1286
1287//return x with exactly k leading zero elements
1288function trim(x,k) {
1289 var i,y;
1290 for (i=x.length; i>0 && !x[i-1]; i--);
1291 y=new Array(i+k);
1292 copy_(y,x);
1293 return y;
1294}
1295
1296//do x=x**y mod n, where x,y,n are bigInts and ** is exponentiation. 0**0=1.
1297//this is faster when n is odd. x usually needs to have as many elements as n.
1298function powMod_(x,y,n) {
1299 var k1,k2,kn,np;
1300 if(s7.length!=n.length)
1301 s7=dup(n);
1302
1303 //for even modulus, use a simple square-and-multiply algorithm,
1304 //rather than using the more complex Montgomery algorithm.
1305 if ((n[0]&1)==0) {
1306 copy_(s7,x);
1307 copyInt_(x,1);
1308 while(!equalsInt(y,0)) {
1309 if (y[0]&1)
1310 multMod_(x,s7,n);
1311 divInt_(y,2);
1312 squareMod_(s7,n);
1313 }
1314 return;
1315 }
1316
1317 //calculate np from n for the Montgomery multiplications
1318 copyInt_(s7,0);
1319 for (kn=n.length;kn>0 && !n[kn-1];kn--);
1320 np=radix-inverseModInt_(modInt(n,radix),radix);
1321 s7[kn]=1;
1322 multMod_(x ,s7,n); // x = x * 2**(kn*bp) mod n
1323
1324 if (s3.length!=x.length)
1325 s3=dup(x);
1326 else
1327 copy_(s3,x);
1328
1329 for (k1=y.length-1;k1>0 & !y[k1]; k1--); //k1=first nonzero element of y
1330 if (y[k1]==0) { //anything to the 0th power is 1
1331 copyInt_(x,1);
1332 return;
1333 }
1334 for (k2=1<<(bpe-1);k2 && !(y[k1] & k2); k2>>=1); //k2=position of first 1 bit in y[k1]
1335 for (;;) {
1336 if (!(k2>>=1)) { //look at next bit of y
1337 k1--;
1338 if (k1<0) {
1339 mont_(x,one,n,np);
1340 return;
1341 }
1342 k2=1<<(bpe-1);
1343 }
1344 mont_(x,x,n,np);
1345
1346 if (k2 & y[k1]) //if next bit is a 1
1347 mont_(x,s3,n,np);
1348 }
1349}
1350
1351//do x=x*y*Ri mod n for bigInts x,y,n,
1352// where Ri = 2**(-kn*bpe) mod n, and kn is the
1353// number of elements in the n array, not
1354// counting leading zeros.
1355//x must be large enough to hold the answer.
1356//It's OK if x and y are the same variable.
1357//must have:
1358// x,y < n
1359// n is odd
1360// np = -(n^(-1)) mod radix
1361function mont_(x,y,n,np) {
1362 var i,j,c,ui,t;
1363 var kn=n.length;
1364 var ky=y.length;
1365
1366 if (sa.length!=kn)
1367 sa=new Array(kn);
1368
1369 for (;kn>0 && n[kn-1]==0;kn--); //ignore leading zeros of n
1370 //this function sometimes gives wrong answers when the next line is uncommented
1371 //for (;ky>0 && y[ky-1]==0;ky--); //ignore leading zeros of y
1372
1373 copyInt_(sa,0);
1374
1375 //the following loop consumes 95% of the runtime for randTruePrime_() and powMod_() for large keys
1376 for (i=0; i<kn; i++) {
1377 t=sa[0]+x[i]*y[0];
1378 ui=((t & mask) * np) & mask; //the inner "& mask" is needed on Macintosh MSIE, but not windows MSIE
1379 c=(t+ui*n[0]) >> bpe;
1380 t=x[i];
1381
1382 //do sa=(sa+x[i]*y+ui*n)/b where b=2**bpe
1383 for (j=1;j<ky;j++) {
1384 c+=sa[j]+t*y[j]+ui*n[j];
1385 sa[j-1]=c & mask;
1386 c>>=bpe;
1387 }
1388 for (;j<kn;j++) {
1389 c+=sa[j]+ui*n[j];
1390 sa[j-1]=c & mask;
1391 c>>=bpe;
1392 }
1393 sa[j-1]=c & mask;
1394 }
1395
1396 if (!greater(n,sa))
1397 sub_(sa,n);
1398 copy_(x,sa);
1399}
1400
1401
1402
1403
1404//#############################################################################
1405//#############################################################################
1406//#############################################################################
1407//#############################################################################
1408//#############################################################################
1409//#############################################################################
1410//#############################################################################
1411
1412
1413
1414
1415
1416//#############################################################################
1417
1418Clipperz.Crypto.BigInt = function (aValue, aBase) {
1419 varbase;
1420 varvalue;
1421
1422 if (typeof(aValue) == 'object') {
1423 this._internalValue = aValue;
1424 } else {
1425 if (typeof(aValue) == 'undefined') {
1426 value = "0";
1427 } else {
1428 value = aValue + "";
1429 }
1430
1431 if (typeof(aBase) == 'undefined') {
1432 base = 10;
1433 } else {
1434 base = aBase;
1435 }
1436
1437 this._internalValue = str2bigInt(value, base, 1, 1);
1438 }
1439
1440 return this;
1441}
1442
1443//=============================================================================
1444
1445MochiKit.Base.update(Clipperz.Crypto.BigInt.prototype, {
1446
1447 'clone': function() {
1448 return new Clipperz.Crypto.BigInt(this.internalValue());
1449 },
1450
1451 //-------------------------------------------------------------------------
1452
1453 'internalValue': function () {
1454 return this._internalValue;
1455 },
1456
1457 //-------------------------------------------------------------------------
1458
1459 'isBigInt': true,
1460
1461 //-------------------------------------------------------------------------
1462
1463 'toString': function(aBase) {
1464 return this.asString(aBase);
1465 },
1466
1467 //-------------------------------------------------------------------------
1468
1469 'asString': function (aBase, minimumLength) {
1470 varresult;
1471 varbase;
1472
1473 if (typeof(aBase) == 'undefined') {
1474 base = 10;
1475 } else {
1476 base = aBase;
1477 }
1478
1479 result = bigInt2str(this.internalValue(), base).toLowerCase();
1480
1481 if ((typeof(minimumLength) != 'undefined') && (result.length < minimumLength)) {
1482 var i, c;
1483 //MochiKit.Logging.logDebug(">>> FIXING BigInt.asString length issue")
1484 c = (minimumLength - result.length);
1485 for (i=0; i<c; i++) {
1486 result = '0' + result;
1487 }
1488 }
1489
1490 return result;
1491 },
1492
1493 //-------------------------------------------------------------------------
1494
1495 'asByteArray': function() {
1496 return new Clipperz.ByteArray("0x" + this.asString(16), 16);
1497 },
1498
1499 //-------------------------------------------------------------------------
1500
1501 'equals': function (aValue) {
1502 var result;
1503
1504 if (aValue.isBigInt) {
1505 result = equals(this.internalValue(), aValue.internalValue());
1506 } else if (typeof(aValue) == "number") {
1507 result = equalsInt(this.internalValue(), aValue);
1508 } else {
1509 throw Clipperz.Crypt.BigInt.exception.UnknownType;
1510 }
1511
1512 return result;
1513 },
1514
1515 //-------------------------------------------------------------------------
1516
1517 'compare': function(aValue) {
1518/*
1519 var result;
1520 var thisAsString;
1521 var aValueAsString;
1522
1523 thisAsString = this.asString(10);
1524 aValueAsString = aValue.asString(10);
1525
1526 result = MochiKit.Base.compare(thisAsString.length, aValueAsString.length);
1527 if (result == 0) {
1528 result = MochiKit.Base.compare(thisAsString, aValueAsString);
1529 }
1530
1531 return result;
1532*/
1533 var result;
1534
1535 if (equals(this.internalValue(), aValue.internalValue())) {
1536 result = 0;
1537 } else if (greater(this.internalValue(), aValue.internalValue())) {
1538 result = 1;
1539 } else {
1540 result = -1;
1541 }
1542
1543 return result;
1544 },
1545
1546 //-------------------------------------------------------------------------
1547
1548 'add': function (aValue) {
1549 var result;
1550
1551 if (aValue.isBigInt) {
1552 result = add(this.internalValue(), aValue.internalValue());
1553 } else {
1554 result = addInt(this.internalValue(), aValue);
1555 }
1556
1557 return new Clipperz.Crypto.BigInt(result);
1558 },
1559
1560 //-------------------------------------------------------------------------
1561
1562 'subtract': function (aValue) {
1563 var result;
1564 var value;
1565
1566 if (aValue.isBigInt) {
1567 value = aValue;
1568 } else {
1569 value = new Clipperz.Crypto.BigInt(aValue);
1570 }
1571
1572 result = sub(this.internalValue(), value.internalValue());
1573
1574 return new Clipperz.Crypto.BigInt(result);
1575 },
1576
1577 //-------------------------------------------------------------------------
1578
1579 'multiply': function (aValue, aModule) {
1580 var result;
1581 var value;
1582
1583 if (aValue.isBigInt) {
1584 value = aValue;
1585 } else {
1586 value = new Clipperz.Crypto.BigInt(aValue);
1587 }
1588
1589 if (typeof(aModule) == 'undefined') {
1590 result = mult(this.internalValue(), value.internalValue());
1591 } else {
1592 if (greater(this.internalValue(), value.internalValue())) {
1593 result = multMod(this.internalValue(), value.internalValue(), aModule);
1594 } else {
1595 result = multMod(value.internalValue(), this.internalValue(), aModule);
1596 }
1597 }
1598
1599 return new Clipperz.Crypto.BigInt(result);
1600 },
1601
1602 //-------------------------------------------------------------------------
1603
1604 'module': function (aModule) {
1605 varresult;
1606 var module;
1607
1608 if (aModule.isBigInt) {
1609 module = aModule;
1610 } else {
1611 module = new Clipperz.Crypto.BigInt(aModule);
1612 }
1613
1614 result = mod(this.internalValue(), module.internalValue());
1615
1616 return new Clipperz.Crypto.BigInt(result);
1617 },
1618
1619 //-------------------------------------------------------------------------
1620
1621 'powerModule': function(aValue, aModule) {
1622 varresult;
1623 varvalue;
1624 var module;
1625
1626 if (aValue.isBigInt) {
1627 value = aValue;
1628 } else {
1629 value = new Clipperz.Crypto.BigInt(aValue);
1630 }
1631
1632 if (aModule.isBigInt) {
1633 module = aModule;
1634 } else {
1635 module = new Clipperz.Crypto.BigInt(aModule);
1636 }
1637
1638 if (aValue == -1) {
1639 result = inverseMod(this.internalValue(), module.internalValue());
1640 } else {
1641 result = powMod(this.internalValue(), value.internalValue(), module.internalValue());
1642 }
1643
1644 return new Clipperz.Crypto.BigInt(result);
1645 },
1646
1647 //-------------------------------------------------------------------------
1648
1649 'xor': function(aValue) {
1650 var result;
1651 varthisByteArray;
1652 var aValueByteArray;
1653 var xorArray;
1654
1655 thisByteArray = new Clipperz.ByteArray("0x" + this.asString(16), 16);
1656 aValueByteArray = new Clipperz.ByteArray("0x" + aValue.asString(16), 16);
1657 xorArray = thisByteArray.xorMergeWithBlock(aValueByteArray, 'right');
1658 result = new Clipperz.Crypto.BigInt(xorArray.toHexString(), 16);
1659
1660 return result;
1661 },
1662
1663 //-------------------------------------------------------------------------
1664
1665 'shiftLeft': function(aNumberOfBitsToShift) {
1666 var result;
1667 var internalResult;
1668 var wholeByteToShift;
1669 var bitsLeftToShift;
1670
1671 wholeByteToShift = Math.floor(aNumberOfBitsToShift / 8);
1672 bitsLeftToShift = aNumberOfBitsToShift % 8;
1673
1674 if (wholeByteToShift == 0) {
1675 internalResult = this.internalValue();
1676 } else {
1677 var hexValue;
1678 var i,c;
1679
1680 hexValue = this.asString(16);
1681 c = wholeByteToShift;
1682 for (i=0; i<c; i++) {
1683 hexValue += "00";
1684 }
1685 internalResult = str2bigInt(hexValue, 16, 1, 1);
1686 }
1687
1688 if (bitsLeftToShift > 0) {
1689 leftShift_(internalResult, bitsLeftToShift);
1690 }
1691 result = new Clipperz.Crypto.BigInt(internalResult);
1692
1693 return result;
1694 },
1695
1696 //-------------------------------------------------------------------------
1697
1698 'bitSize': function() {
1699 return bitSize(this.internalValue());
1700 },
1701
1702 //-------------------------------------------------------------------------
1703
1704 'isBitSet': function(aBitPosition) {
1705 var result;
1706
1707 if (this.asByteArray().bitAtIndex(aBitPosition) == 0) {
1708 result = false;
1709 } else {
1710 result = true;
1711 };
1712
1713 return result;
1714 },
1715
1716 //-------------------------------------------------------------------------
1717 __syntaxFix__: "syntax fix"
1718
1719});
1720
1721//#############################################################################
1722
1723Clipperz.Crypto.BigInt.randomPrime = function(aBitSize) {
1724 return new Clipperz.Crypto.BigInt(randTruePrime(aBitSize));
1725}
1726
1727//#############################################################################
1728//#############################################################################
1729
1730Clipperz.Crypto.BigInt.ZERO = new Clipperz.Crypto.BigInt(0);
1731
1732//#############################################################################
1733
1734Clipperz.Crypto.BigInt.equals = function(a, b) {
1735 return a.equals(b);
1736}
1737
1738Clipperz.Crypto.BigInt.add = function(a, b) {
1739 return a.add(b);
1740}
1741
1742Clipperz.Crypto.BigInt.subtract = function(a, b) {
1743 return a.subtract(b);
1744}
1745
1746Clipperz.Crypto.BigInt.multiply = function(a, b, module) {
1747 return a.multiply(b, module);
1748}
1749
1750Clipperz.Crypto.BigInt.module = function(a, module) {
1751 return a.module(module);
1752}
1753
1754Clipperz.Crypto.BigInt.powerModule = function(a, b, module) {
1755 return a.powerModule(b, module);
1756}
1757
1758Clipperz.Crypto.BigInt.exception = {
1759 UnknownType: new MochiKit.Base.NamedError("Clipperz.Crypto.BigInt.exception.UnknownType")
1760}
diff --git a/frontend/beta/js/Clipperz/Crypto/BigInt_scoped.js b/frontend/beta/js/Clipperz/Crypto/BigInt_scoped.js
new file mode 100644
index 0000000..e91e823
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Crypto/BigInt_scoped.js
@@ -0,0 +1,1649 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; }
31
32if (typeof(Leemon) == 'undefined') { Leemon = {}; }
33if (typeof(Baird.Crypto) == 'undefined') { Baird.Crypto = {}; }
34if (typeof(Baird.Crypto.BigInt) == 'undefined') { Baird.Crypto.BigInt = {}; }
35
36
37//#############################################################################
38 //Downloaded on March 05, 2007 from http://www.leemon.com/crypto/BigInt.js
39//#############################################################################
40
41////////////////////////////////////////////////////////////////////////////////////////
42// Big Integer Library v. 5.0
43// Created 2000, last modified 2006
44// Leemon Baird
45// www.leemon.com
46//
47// This file is public domain. You can use it for any purpose without restriction.
48// I do not guarantee that it is correct, so use it at your own risk. If you use
49// it for something interesting, I'd appreciate hearing about it. If you find
50// any bugs or make any improvements, I'd appreciate hearing about those too.
51// It would also be nice if my name and address were left in the comments.
52// But none of that is required.
53//
54// This code defines a bigInt library for arbitrary-precision integers.
55// A bigInt is an array of integers storing the value in chunks of bpe bits,
56// little endian (buff[0] is the least significant word).
57// Negative bigInts are stored two's complement.
58// Some functions assume their parameters have at least one leading zero element.
59// Functions with an underscore at the end of the name have unpredictable behavior in case of overflow,
60// so the caller must make sure overflow won't happen.
61// For each function where a parameter is modified, that same
62// variable must not be used as another argument too.
63// So, you cannot square x by doing multMod_(x,x,n).
64// You must use squareMod_(x,n) instead, or do y=dup(x); multMod_(x,y,n).
65//
66// These functions are designed to avoid frequent dynamic memory allocation in the inner loop.
67// For most functions, if it needs a BigInt as a local variable it will actually use
68// a global, and will only allocate to it when it's not the right size. This ensures
69// that when a function is called repeatedly with same-sized parameters, it only allocates
70// memory on the first call.
71//
72// Note that for cryptographic purposes, the calls to Math.random() must
73// be replaced with calls to a better pseudorandom number generator.
74//
75// In the following, "bigInt" means a bigInt with at least one leading zero element,
76// and "integer" means a nonnegative integer less than radix. In some cases, integer
77// can be negative. Negative bigInts are 2s complement.
78//
79// The following functions do not modify their inputs, but dynamically allocate memory every time they are called:
80//
81// function bigInt2str(x,base) //convert a bigInt into a string in a given base, from base 2 up to base 95
82// function dup(x) //returns a copy of bigInt x
83// function findPrimes(n) //return array of all primes less than integer n
84// function int2bigInt(t,n,m) //convert integer t to a bigInt with at least n bits and m array elements
85// function str2bigInt(s,b,n,m) //convert string s in base b to a bigInt with at least n bits and m array elements
86// function trim(x,k) //return a copy of x with exactly k leading zero elements
87//
88// The following functions do not modify their inputs, so there is never a problem with the result being too big:
89//
90// function bitSize(x) //returns how many bits long the bigInt x is, not counting leading zeros
91// function equals(x,y) //is the bigInt x equal to the bigint y?
92// function equalsInt(x,y) //is bigint x equal to integer y?
93// function greater(x,y) //is x>y? (x and y are nonnegative bigInts)
94// function greaterShift(x,y,shift)//is (x <<(shift*bpe)) > y?
95// function isZero(x) //is the bigInt x equal to zero?
96// function millerRabin(x,b) //does one round of Miller-Rabin base integer b say that bigInt x is possibly prime (as opposed to definitely composite)?
97// function modInt(x,n) //return x mod n for bigInt x and integer n.
98// function negative(x) //is bigInt x negative?
99//
100// The following functions do not modify their inputs, but allocate memory and call functions with underscores
101//
102// function add(x,y) //return (x+y) for bigInts x and y.
103// function addInt(x,n) //return (x+n) where x is a bigInt and n is an integer.
104// function expand(x,n) //return a copy of x with at least n elements, adding leading zeros if needed
105// function inverseMod(x,n) //return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null
106// function mod(x,n) //return a new bigInt equal to (x mod n) for bigInts x and n.
107// function mult(x,y) //return x*y for bigInts x and y. This is faster when y<x.
108// function multMod(x,y,n) //return (x*y mod n) for bigInts x,y,n. For greater speed, let y<x.
109// function powMod(x,y,n) //return (x**y mod n) where x,y,n are bigInts and ** is exponentiation. 0**0=1. Faster for odd n.
110// function randTruePrime(k) //return a new, random, k-bit, true prime using Maurer's algorithm.
111// function sub(x,y) //return (x-y) for bigInts x and y. Negative answers will be 2s complement
112//
113// The following functions write a bigInt result to one of the parameters, but
114// the result is never bigger than the original, so there can't be overflow problems:
115//
116// function divInt_(x,n) //do x=floor(x/n) for bigInt x and integer n, and return the remainder
117// function GCD_(x,y) //set x to the greatest common divisor of bigInts x and y, (y is destroyed).
118// function halve_(x) //do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement
119// function mod_(x,n) //do x=x mod n for bigInts x and n.
120// function rightShift_(x,n) //right shift bigInt x by n bits. 0 <= n < bpe.
121//
122// The following functions write a bigInt result to one of the parameters. The caller is responsible for
123// ensuring it is large enough to hold the result.
124//
125// function addInt_(x,n) //do x=x+n where x is a bigInt and n is an integer
126// function add_(x,y) //do x=x+y for bigInts x and y
127// function addShift_(x,y,ys) //do x=x+(y<<(ys*bpe))
128// function copy_(x,y) //do x=y on bigInts x and y
129// function copyInt_(x,n) //do x=n on bigInt x and integer n
130// function carry_(x) //do carries and borrows so each element of the bigInt x fits in bpe bits.
131// function divide_(x,y,q,r) //divide_ x by y giving quotient q and remainder r
132// function eGCD_(x,y,d,a,b) //sets a,b,d to positive big integers such that d = GCD_(x,y) = a*x-b*y
133// function inverseMod_(x,n) //do x=x**(-1) mod n, for bigInts x and n. Returns 1 (0) if inverse does (doesn't) exist
134// function inverseModInt_(x,n) //return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse
135// function leftShift_(x,n) //left shift bigInt x by n bits. n<bpe.
136// function linComb_(x,y,a,b) //do x=a*x+b*y for bigInts x and y and integers a and b
137// function linCombShift_(x,y,b,ys) //do x=x+b*(y<<(ys*bpe)) for bigInts x and y, and integers b and ys
138// function mont_(x,y,n,np) //Montgomery multiplication (see comments where the function is defined)
139// function mult_(x,y) //do x=x*y for bigInts x and y.
140// function multInt_(x,n) //do x=x*n where x is a bigInt and n is an integer.
141// function multMod_(x,y,n) //do x=x*y mod n for bigInts x,y,n.
142// function powMod_(x,y,n) //do x=x**y mod n, where x,y,n are bigInts (n is odd) and ** is exponentiation. 0**0=1.
143// function randBigInt_(b,n,s) //do b = an n-bit random BigInt. if s=1, then nth bit (most significant bit) is set to 1. n>=1.
144// function randTruePrime_(ans,k) //do ans = a random k-bit true random prime (not just probable prime) with 1 in the msb.
145// function squareMod_(x,n) //do x=x*x mod n for bigInts x,n
146// function sub_(x,y) //do x=x-y for bigInts x and y. Negative answers will be 2s complement.
147// function subShift_(x,y,ys) //do x=x-(y<<(ys*bpe)). Negative answers will be 2s complement.
148//
149// The following functions are based on algorithms from the _Handbook of Applied Cryptography_
150// powMod_() = algorithm 14.94, Montgomery exponentiation
151// eGCD_,inverseMod_() = algorithm 14.61, Binary extended GCD_
152// GCD_() = algorothm 14.57, Lehmer's algorithm
153// mont_() = algorithm 14.36, Montgomery multiplication
154// divide_() = algorithm 14.20 Multiple-precision division
155// squareMod_() = algorithm 14.16 Multiple-precision squaring
156// randTruePrime_() = algorithm 4.62, Maurer's algorithm
157// millerRabin() = algorithm 4.24, Miller-Rabin algorithm
158//
159// Profiling shows:
160// randTruePrime_() spends:
161// 10% of its time in calls to powMod_()
162// 85% of its time in calls to millerRabin()
163// millerRabin() spends:
164// 99% of its time in calls to powMod_() (always with a base of 2)
165// powMod_() spends:
166// 94% of its time in calls to mont_() (almost always with x==y)
167//
168// This suggests there are several ways to speed up this library slightly:
169// - convert powMod_ to use a Montgomery form of k-ary window (or maybe a Montgomery form of sliding window)
170// -- this should especially focus on being fast when raising 2 to a power mod n
171// - convert randTruePrime_() to use a minimum r of 1/3 instead of 1/2 with the appropriate change to the test
172// - tune the parameters in randTruePrime_(), including c, m, and recLimit
173// - speed up the single loop in mont_() that takes 95% of the runtime, perhaps by reducing checking
174// within the loop when all the parameters are the same length.
175//
176// There are several ideas that look like they wouldn't help much at all:
177// - replacing trial division in randTruePrime_() with a sieve (that speeds up something taking almost no time anyway)
178// - increase bpe from 15 to 30 (that would help if we had a 32*32->64 multiplier, but not with JavaScript's 32*32->32)
179// - speeding up mont_(x,y,n,np) when x==y by doing a non-modular, non-Montgomery square
180// followed by a Montgomery reduction. The intermediate answer will be twice as long as x, so that
181// method would be slower. This is unfortunate because the code currently spends almost all of its time
182// doing mont_(x,x,...), both for randTruePrime_() and powMod_(). A faster method for Montgomery squaring
183// would have a large impact on the speed of randTruePrime_() and powMod_(). HAC has a couple of poorly-worded
184// sentences that seem to imply it's faster to do a non-modular square followed by a single
185// Montgomery reduction, but that's obviously wrong.
186////////////////////////////////////////////////////////////////////////////////////////
187
188//
189 //The whole library has been moved into the Baird.Crypto.BigInt scope by Giulio Cesare Solaroli <giulio.cesare@clipperz.com>
190//
191Baird.Crypto.BigInt.VERSION = "5.0";
192Baird.Crypto.BigInt.NAME = "Baird.Crypto.BigInt";
193
194MochiKit.Base.update(Baird.Crypto.BigInt, {
195 //globals
196 'bpe': 0, //bits stored per array element
197 'mask': 0, //AND this with an array element to chop it down to bpe bits
198 'radix': Baird.Crypto.BigInt.mask + 1,//equals 2^bpe. A single 1 bit to the left of the last bit of mask.
199
200 //the digits for converting to different bases
201 'digitsStr': '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_=!@#$%^&*()[]{}|;:,.<>/?`~ \\\'\"+-',
202
203//initialize the global variables
204for (bpe=0; (1<<(bpe+1)) > (1<<bpe); bpe++); //bpe=number of bits in the mantissa on this platform
205bpe>>=1; //bpe=number of bits in one element of the array representing the bigInt
206mask=(1<<bpe)-1; //AND the mask with an integer to get its bpe least significant bits
207radix=mask+1; //2^bpe. a single 1 bit to the left of the first bit of mask
208one=int2bigInt(1,1,1); //constant used in powMod_()
209
210//the following global variables are scratchpad memory to
211//reduce dynamic memory allocation in the inner loop
212t=new Array(0);
213ss=t; //used in mult_()
214s0=t; //used in multMod_(), squareMod_()
215s1=t; //used in powMod_(), multMod_(), squareMod_()
216s2=t; //used in powMod_(), multMod_()
217s3=t; //used in powMod_()
218s4=t; s5=t; //used in mod_()
219s6=t; //used in bigInt2str()
220s7=t; //used in powMod_()
221T=t; //used in GCD_()
222sa=t; //used in mont_()
223mr_x1=t; mr_r=t; mr_a=t; //used in millerRabin()
224eg_v=t; eg_u=t; eg_A=t; eg_B=t; eg_C=t; eg_D=t; //used in eGCD_(), inverseMod_()
225md_q1=t; md_q2=t; md_q3=t; md_r=t; md_r1=t; md_r2=t; md_tt=t; //used in mod_()
226
227primes=t; pows=t; s_i=t; s_i2=t; s_R=t; s_rm=t; s_q=t; s_n1=t;
228 s_a=t; s_r2=t; s_n=t; s_b=t; s_d=t; s_x1=t; s_x2=t, s_aa=t; //used in randTruePrime_()
229
230////////////////////////////////////////////////////////////////////////////////////////
231
232 //return array of all primes less than integer n
233 'findPrimes': function(n) {
234 var i,s,p,ans;
235 s=new Array(n);
236 for (i=0;i<n;i++)
237 s[i]=0;
238 s[0]=2;
239 p=0; //first p elements of s are primes, the rest are a sieve
240 for(;s[p]<n;) { //s[p] is the pth prime
241 for(i=s[p]*s[p]; i<n; i+=s[p]) //mark multiples of s[p]
242 s[i]=1;
243 p++;
244 s[p]=s[p-1]+1;
245 for(; s[p]<n && s[s[p]]; s[p]++); //find next prime (where s[p]==0)
246 }
247 ans=new Array(p);
248 for(i=0;i<p;i++)
249 ans[i]=s[i];
250 return ans;
251 },
252
253 //does a single round of Miller-Rabin base b consider x to be a possible prime?
254 //x is a bigInt, and b is an integer
255 'millerRabin': function(x,b) {
256 var i,j,k,s;
257
258 if (mr_x1.length!=x.length) {
259 mr_x1=dup(x);
260 mr_r=dup(x);
261 mr_a=dup(x);
262 }
263
264 copyInt_(mr_a,b);
265 copy_(mr_r,x);
266 copy_(mr_x1,x);
267
268 addInt_(mr_r,-1);
269 addInt_(mr_x1,-1);
270
271 //s=the highest power of two that divides mr_r
272 k=0;
273 for (i=0;i<mr_r.length;i++)
274 for (j=1;j<mask;j<<=1)
275 if (x[i] & j) {
276 s=(k<mr_r.length+bpe ? k : 0);
277 i=mr_r.length;
278 j=mask;
279 } else
280 k++;
281
282 if (s)
283 rightShift_(mr_r,s);
284
285 powMod_(mr_a,mr_r,x);
286
287 if (!equalsInt(mr_a,1) && !equals(mr_a,mr_x1)) {
288 j=1;
289 while (j<=s-1 && !equals(mr_a,mr_x1)) {
290 squareMod_(mr_a,x);
291 if (equalsInt(mr_a,1)) {
292 return 0;
293 }
294 j++;
295 }
296 if (!equals(mr_a,mr_x1)) {
297 return 0;
298 }
299 }
300
301 return 1;
302 },
303
304 //returns how many bits long the bigInt is, not counting leading zeros.
305 'bitSize': function(x) {
306 var j,z,w;
307 for (j=x.length-1; (x[j]==0) && (j>0); j--);
308 for (z=0,w=x[j]; w; (w>>=1),z++);
309 z+=bpe*j;
310 return z;
311 },
312
313 //return a copy of x with at least n elements, adding leading zeros if needed
314 'expand': function(x,n) {
315 var ans=int2bigInt(0,(x.length>n ? x.length : n)*bpe,0);
316 copy_(ans,x);
317 return ans;
318 },
319
320 //return a k-bit true random prime using Maurer's algorithm.
321 'randTruePrime': function(k) {
322 var ans=int2bigInt(0,k,0);
323 randTruePrime_(ans,k);
324 return trim(ans,1);
325 },
326
327 //return a new bigInt equal to (x mod n) for bigInts x and n.
328 'mod': function(x,n) {
329 var ans=dup(x);
330 mod_(ans,n);
331 return trim(ans,1);
332 },
333
334 //return (x+n) where x is a bigInt and n is an integer.
335 'addInt': function(x,n) {
336 var ans=expand(x,x.length+1);
337 addInt_(ans,n);
338 return trim(ans,1);
339 },
340
341 //return x*y for bigInts x and y. This is faster when y<x.
342 'mult': function(x,y) {
343 var ans=expand(x,x.length+y.length);
344 mult_(ans,y);
345 return trim(ans,1);
346 },
347
348 //return (x**y mod n) where x,y,n are bigInts and ** is exponentiation. 0**0=1. Faster for odd n.
349 'powMod': function(x,y,n) {
350 var ans=expand(x,n.length);
351 powMod_(ans,trim(y,2),trim(n,2),0); //this should work without the trim, but doesn't
352 return trim(ans,1);
353 },
354
355 //return (x-y) for bigInts x and y. Negative answers will be 2s complement
356 'sub': function(x,y) {
357 var ans=expand(x,(x.length>y.length ? x.length+1 : y.length+1));
358 sub_(ans,y);
359 return trim(ans,1);
360 },
361
362 //return (x+y) for bigInts x and y.
363 'add': function(x,y) {
364 var ans=expand(x,(x.length>y.length ? x.length+1 : y.length+1));
365 add_(ans,y);
366 return trim(ans,1);
367 },
368
369 //return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null
370 'inverseMod': function(x,n) {
371 var ans=expand(x,n.length);
372 var s;
373 s=inverseMod_(ans,n);
374 return s ? trim(ans,1) : null;
375 },
376
377 //return (x*y mod n) for bigInts x,y,n. For greater speed, let y<x.
378 'multMod': function(x,y,n) {
379 var ans=expand(x,n.length);
380 multMod_(ans,y,n);
381 return trim(ans,1);
382 },
383
384 //generate a k-bit true random prime using Maurer's algorithm,
385 //and put it into ans. The bigInt ans must be large enough to hold it.
386 'randTruePrime_': function(ans,k) {
387 var c,m,pm,dd,j,r,B,divisible,z,zz,recSize;
388
389 if (primes.length==0)
390 primes=findPrimes(30000); //check for divisibility by primes <=30000
391
392 if (pows.length==0) {
393 pows=new Array(512);
394 for (j=0;j<512;j++) {
395 pows[j]=Math.pow(2,j/511.-1.);
396 }
397 }
398
399 //c and m should be tuned for a particular machine and value of k, to maximize speed
400 //this was: c=primes[primes.length-1]/k/k; //check using all the small primes. (c=0.1 in HAC)
401 c=0.1;
402 m=20; //generate this k-bit number by first recursively generating a number that has between k/2 and k-m bits
403 recLimit=20; /*must be at least 2 (was 29)*/ //stop recursion when k <=recLimit
404
405 if (s_i2.length!=ans.length) {
406 s_i2=dup(ans);
407 s_R =dup(ans);
408 s_n1=dup(ans);
409 s_r2=dup(ans);
410 s_d =dup(ans);
411 s_x1=dup(ans);
412 s_x2=dup(ans);
413 s_b =dup(ans);
414 s_n =dup(ans);
415 s_i =dup(ans);
416 s_rm=dup(ans);
417 s_q =dup(ans);
418 s_a =dup(ans);
419 s_aa=dup(ans);
420 }
421
422 if (k <= recLimit) { //generate small random primes by trial division up to its square root
423 pm=(1<<((k+2)>>1))-1; //pm is binary number with all ones, just over sqrt(2^k)
424 copyInt_(ans,0);
425 for (dd=1;dd;) {
426 dd=0;
427 ans[0]= 1 | (1<<(k-1)) | Math.floor(Math.random()*(1<<k)); //random, k-bit, odd integer, with msb 1
428 for (j=1;(j<primes.length) && ((primes[j]&pm)==primes[j]);j++) { //trial division by all primes 3...sqrt(2^k)
429 if (0==(ans[0]%primes[j])) {
430 dd=1;
431 break;
432 }
433 }
434 }
435 carry_(ans);
436 return;
437 }
438
439 B=c*k*k; //try small primes up to B (or all the primes[] array if the largest is less than B).
440 if (k>2*m) //generate this k-bit number by first recursively generating a number that has between k/2 and k-m bits
441 for (r=1; k-k*r<=m; )
442 r=pows[Math.floor(Math.random()*512)]; //r=Math.pow(2,Math.random()-1);
443 else
444 r=.5;
445
446 //simulation suggests the more complex algorithm using r=.333 is only slightly faster.
447
448 recSize=Math.floor(r*k)+1;
449
450 randTruePrime_(s_q,recSize);
451 copyInt_(s_i2,0);
452 s_i2[Math.floor((k-2)/bpe)] |= (1<<((k-2)%bpe)); //s_i2=2^(k-2)
453 divide_(s_i2,s_q,s_i,s_rm); //s_i=floor((2^(k-1))/(2q))
454
455 z=bitSize(s_i);
456
457 for (;;) {
458 for (;;) { //generate z-bit numbers until one falls in the range [0,s_i-1]
459 randBigInt_(s_R,z,0);
460 if (greater(s_i,s_R))
461 break;
462 } //now s_R is in the range [0,s_i-1]
463 addInt_(s_R,1); //now s_R is in the range [1,s_i]
464 add_(s_R,s_i); //now s_R is in the range [s_i+1,2*s_i]
465
466 copy_(s_n,s_q);
467 mult_(s_n,s_R);
468 multInt_(s_n,2);
469 addInt_(s_n,1); //s_n=2*s_R*s_q+1
470
471 copy_(s_r2,s_R);
472 multInt_(s_r2,2); //s_r2=2*s_R
473
474 //check s_n for divisibility by small primes up to B
475 for (divisible=0,j=0; (j<primes.length) && (primes[j]<B); j++)
476 if (modInt(s_n,primes[j])==0) {
477 divisible=1;
478 break;
479 }
480
481 if (!divisible) //if it passes small primes check, then try a single Miller-Rabin base 2
482 if (!millerRabin(s_n,2)) //this line represents 75% of the total runtime for randTruePrime_
483 divisible=1;
484
485 if (!divisible) { //if it passes that test, continue checking s_n
486 addInt_(s_n,-3);
487 for (j=s_n.length-1;(s_n[j]==0) && (j>0); j--); //strip leading zeros
488 for (zz=0,w=s_n[j]; w; (w>>=1),zz++);
489 zz+=bpe*j; //zz=number of bits in s_n, ignoring leading zeros
490 for (;;) { //generate z-bit numbers until one falls in the range [0,s_n-1]
491 randBigInt_(s_a,zz,0);
492 if (greater(s_n,s_a))
493 break;
494 } //now s_a is in the range [0,s_n-1]
495 addInt_(s_n,3); //now s_a is in the range [0,s_n-4]
496 addInt_(s_a,2); //now s_a is in the range [2,s_n-2]
497 copy_(s_b,s_a);
498 copy_(s_n1,s_n);
499 addInt_(s_n1,-1);
500 powMod_(s_b,s_n1,s_n); //s_b=s_a^(s_n-1) modulo s_n
501 addInt_(s_b,-1);
502 if (isZero(s_b)) {
503 copy_(s_b,s_a);
504 powMod_(s_b,s_r2,s_n);
505 addInt_(s_b,-1);
506 copy_(s_aa,s_n);
507 copy_(s_d,s_b);
508 GCD_(s_d,s_n); //if s_b and s_n are relatively prime, then s_n is a prime
509 if (equalsInt(s_d,1)) {
510 copy_(ans,s_aa);
511 return; //if we've made it this far, then s_n is absolutely guaranteed to be prime
512 }
513 }
514 }
515 }
516 },
517
518 //set b to an n-bit random BigInt. If s=1, then nth bit (most significant bit) is set to 1.
519 //array b must be big enough to hold the result. Must have n>=1
520 'randBigInt_': function(b,n,s) {
521 var i,a;
522 for (i=0;i<b.length;i++)
523 b[i]=0;
524 a=Math.floor((n-1)/bpe)+1; //# array elements to hold the BigInt
525 for (i=0;i<a;i++) {
526 b[i]=Math.floor(Math.random()*(1<<(bpe-1)));
527 }
528 b[a-1] &= (2<<((n-1)%bpe))-1;
529 if (s)
530 b[a-1] |= (1<<((n-1)%bpe));
531 },
532
533 //set x to the greatest common divisor of x and y.
534 //x,y are bigInts with the same number of elements. y is destroyed.
535 'GCD_': function(x,y) {
536 var i,xp,yp,A,B,C,D,q,sing;
537 if (T.length!=x.length)
538 T=dup(x);
539
540 sing=1;
541 while (sing) { //while y has nonzero elements other than y[0]
542 sing=0;
543 for (i=1;i<y.length;i++) //check if y has nonzero elements other than 0
544 if (y[i]) {
545 sing=1;
546 break;
547 }
548 if (!sing) break; //quit when y all zero elements except possibly y[0]
549
550 for (i=x.length;!x[i] && i>=0;i--); //find most significant element of x
551 xp=x[i];
552 yp=y[i];
553 A=1; B=0; C=0; D=1;
554 while ((yp+C) && (yp+D)) {
555 q =Math.floor((xp+A)/(yp+C));
556 qp=Math.floor((xp+B)/(yp+D));
557 if (q!=qp)
558 break;
559 t= A-q*C; A=C; C=t; // do (A,B,xp, C,D,yp) = (C,D,yp, A,B,xp) - q*(0,0,0, C,D,yp)
560 t= B-q*D; B=D; D=t;
561 t=xp-q*yp; xp=yp; yp=t;
562 }
563 if (B) {
564 copy_(T,x);
565 linComb_(x,y,A,B); //x=A*x+B*y
566 linComb_(y,T,D,C); //y=D*y+C*T
567 } else {
568 mod_(x,y);
569 copy_(T,x);
570 copy_(x,y);
571 copy_(y,T);
572 }
573 }
574 if (y[0]==0)
575 return;
576 t=modInt(x,y[0]);
577 copyInt_(x,y[0]);
578 y[0]=t;
579 while (y[0]) {
580 x[0]%=y[0];
581 t=x[0]; x[0]=y[0]; y[0]=t;
582 }
583 },
584
585//do x=x**(-1) mod n, for bigInts x and n.
586//If no inverse exists, it sets x to zero and returns 0, else it returns 1.
587//The x array must be at least as large as the n array.
588function inverseMod_(x,n) {
589 var k=1+2*Math.max(x.length,n.length);
590
591 if(!(x[0]&1) && !(n[0]&1)) { //if both inputs are even, then inverse doesn't exist
592 copyInt_(x,0);
593 return 0;
594 }
595
596 if (eg_u.length!=k) {
597 eg_u=new Array(k);
598 eg_v=new Array(k);
599 eg_A=new Array(k);
600 eg_B=new Array(k);
601 eg_C=new Array(k);
602 eg_D=new Array(k);
603 }
604
605 copy_(eg_u,x);
606 copy_(eg_v,n);
607 copyInt_(eg_A,1);
608 copyInt_(eg_B,0);
609 copyInt_(eg_C,0);
610 copyInt_(eg_D,1);
611 for (;;) {
612 while(!(eg_u[0]&1)) { //while eg_u is even
613 halve_(eg_u);
614 if (!(eg_A[0]&1) && !(eg_B[0]&1)) { //if eg_A==eg_B==0 mod 2
615 halve_(eg_A);
616 halve_(eg_B);
617 } else {
618 add_(eg_A,n); halve_(eg_A);
619 sub_(eg_B,x); halve_(eg_B);
620 }
621 }
622
623 while (!(eg_v[0]&1)) { //while eg_v is even
624 halve_(eg_v);
625 if (!(eg_C[0]&1) && !(eg_D[0]&1)) { //if eg_C==eg_D==0 mod 2
626 halve_(eg_C);
627 halve_(eg_D);
628 } else {
629 add_(eg_C,n); halve_(eg_C);
630 sub_(eg_D,x); halve_(eg_D);
631 }
632 }
633
634 if (!greater(eg_v,eg_u)) { //eg_v <= eg_u
635 sub_(eg_u,eg_v);
636 sub_(eg_A,eg_C);
637 sub_(eg_B,eg_D);
638 } else { //eg_v > eg_u
639 sub_(eg_v,eg_u);
640 sub_(eg_C,eg_A);
641 sub_(eg_D,eg_B);
642 }
643
644 if (equalsInt(eg_u,0)) {
645 if (negative(eg_C)) //make sure answer is nonnegative
646 add_(eg_C,n);
647 copy_(x,eg_C);
648
649 if (!equalsInt(eg_v,1)) { //if GCD_(x,n)!=1, then there is no inverse
650 copyInt_(x,0);
651 return 0;
652 }
653 return 1;
654 }
655 }
656}
657
658//return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse
659function inverseModInt_(x,n) {
660 var a=1,b=0,t;
661 for (;;) {
662 if (x==1) return a;
663 if (x==0) return 0;
664 b-=a*Math.floor(n/x);
665 n%=x;
666
667 if (n==1) return b; //to avoid negatives, change this b to n-b, and each -= to +=
668 if (n==0) return 0;
669 a-=b*Math.floor(x/n);
670 x%=n;
671 }
672}
673
674//Given positive bigInts x and y, change the bigints v, a, and b to positive bigInts such that:
675// v = GCD_(x,y) = a*x-b*y
676//The bigInts v, a, b, must have exactly as many elements as the larger of x and y.
677function eGCD_(x,y,v,a,b) {
678 var g=0;
679 var k=Math.max(x.length,y.length);
680 if (eg_u.length!=k) {
681 eg_u=new Array(k);
682 eg_A=new Array(k);
683 eg_B=new Array(k);
684 eg_C=new Array(k);
685 eg_D=new Array(k);
686 }
687 while(!(x[0]&1) && !(y[0]&1)) { //while x and y both even
688 halve_(x);
689 halve_(y);
690 g++;
691 }
692 copy_(eg_u,x);
693 copy_(v,y);
694 copyInt_(eg_A,1);
695 copyInt_(eg_B,0);
696 copyInt_(eg_C,0);
697 copyInt_(eg_D,1);
698 for (;;) {
699 while(!(eg_u[0]&1)) { //while u is even
700 halve_(eg_u);
701 if (!(eg_A[0]&1) && !(eg_B[0]&1)) { //if A==B==0 mod 2
702 halve_(eg_A);
703 halve_(eg_B);
704 } else {
705 add_(eg_A,y); halve_(eg_A);
706 sub_(eg_B,x); halve_(eg_B);
707 }
708 }
709
710 while (!(v[0]&1)) { //while v is even
711 halve_(v);
712 if (!(eg_C[0]&1) && !(eg_D[0]&1)) { //if C==D==0 mod 2
713 halve_(eg_C);
714 halve_(eg_D);
715 } else {
716 add_(eg_C,y); halve_(eg_C);
717 sub_(eg_D,x); halve_(eg_D);
718 }
719 }
720
721 if (!greater(v,eg_u)) { //v<=u
722 sub_(eg_u,v);
723 sub_(eg_A,eg_C);
724 sub_(eg_B,eg_D);
725 } else { //v>u
726 sub_(v,eg_u);
727 sub_(eg_C,eg_A);
728 sub_(eg_D,eg_B);
729 }
730 if (equalsInt(eg_u,0)) {
731 if (negative(eg_C)) { //make sure a (C)is nonnegative
732 add_(eg_C,y);
733 sub_(eg_D,x);
734 }
735 multInt_(eg_D,-1); ///make sure b (D) is nonnegative
736 copy_(a,eg_C);
737 copy_(b,eg_D);
738 leftShift_(v,g);
739 return;
740 }
741 }
742}
743
744
745//is bigInt x negative?
746function negative(x) {
747 return ((x[x.length-1]>>(bpe-1))&1);
748}
749
750
751//is (x << (shift*bpe)) > y?
752//x and y are nonnegative bigInts
753//shift is a nonnegative integer
754function greaterShift(x,y,shift) {
755 var kx=x.length, ky=y.length;
756 k=((kx+shift)<ky) ? (kx+shift) : ky;
757 for (i=ky-1-shift; i<kx && i>=0; i++)
758 if (x[i]>0)
759 return 1; //if there are nonzeros in x to the left of the first column of y, then x is bigger
760 for (i=kx-1+shift; i<ky; i++)
761 if (y[i]>0)
762 return 0; //if there are nonzeros in y to the left of the first column of x, then x is not bigger
763 for (i=k-1; i>=shift; i--)
764 if (x[i-shift]>y[i]) return 1;
765 else if (x[i-shift]<y[i]) return 0;
766 return 0;
767}
768
769//is x > y? (x and y both nonnegative)
770function greater(x,y) {
771 var i;
772 var k=(x.length<y.length) ? x.length : y.length;
773
774 for (i=x.length;i<y.length;i++)
775 if (y[i])
776 return 0; //y has more digits
777
778 for (i=y.length;i<x.length;i++)
779 if (x[i])
780 return 1; //x has more digits
781
782 for (i=k-1;i>=0;i--)
783 if (x[i]>y[i])
784 return 1;
785 else if (x[i]<y[i])
786 return 0;
787 return 0;
788}
789
790//divide_ x by y giving quotient q and remainder r. (q=floor(x/y), r=x mod y). All 4 are bigints.
791//x must have at least one leading zero element.
792//y must be nonzero.
793//q and r must be arrays that are exactly the same length as x.
794//the x array must have at least as many elements as y.
795function divide_(x,y,q,r) {
796 var kx, ky;
797 var i,j,y1,y2,c,a,b;
798 copy_(r,x);
799 for (ky=y.length;y[ky-1]==0;ky--); //kx,ky is number of elements in x,y, not including leading zeros
800 for (kx=r.length;r[kx-1]==0 && kx>ky;kx--);
801
802 //normalize: ensure the most significant element of y has its highest bit set
803 b=y[ky-1];
804 for (a=0; b; a++)
805 b>>=1;
806 a=bpe-a; //a is how many bits to shift so that the high order bit of y is leftmost in its array element
807 leftShift_(y,a); //multiply both by 1<<a now, then divide_ both by that at the end
808 leftShift_(r,a);
809
810 copyInt_(q,0); // q=0
811 while (!greaterShift(y,r,kx-ky)) { // while (leftShift_(y,kx-ky) <= r) {
812 subShift_(r,y,kx-ky); // r=r-leftShift_(y,kx-ky)
813 q[kx-ky]++; // q[kx-ky]++;
814 } // }
815
816 for (i=kx-1; i>=ky; i--) {
817 if (r[i]==y[ky-1])
818 q[i-ky]=mask;
819 else
820 q[i-ky]=Math.floor((r[i]*radix+r[i-1])/y[ky-1]);
821
822 //The following for(;;) loop is equivalent to the commented while loop,
823 //except that the uncommented version avoids overflow.
824 //The commented loop comes from HAC, which assumes r[-1]==y[-1]==0
825 // while (q[i-ky]*(y[ky-1]*radix+y[ky-2]) > r[i]*radix*radix+r[i-1]*radix+r[i-2])
826 // q[i-ky]--;
827 for (;;) {
828 y2=(ky>1 ? y[ky-2] : 0)*q[i-ky];
829 c=y2>>bpe;
830 y2=y2 & mask;
831 y1=c+q[i-ky]*y[ky-1];
832 c=y1>>bpe;
833 y1=y1 & mask;
834
835 if (c==r[i] ? y1==r[i-1] ? y2>(i>1 ? r[i-2] : 0) : y1>r[i-1] : c>r[i])
836 q[i-ky]--;
837 else
838 break;
839 }
840
841 linCombShift_(r,y,-q[i-ky],i-ky); //r=r-q[i-ky]*leftShift_(y,i-ky)
842 if (negative(r)) {
843 addShift_(r,y,i-ky); //r=r+leftShift_(y,i-ky)
844 q[i-ky]--;
845 }
846 }
847
848 rightShift_(y,a); //undo the normalization step
849 rightShift_(r,a); //undo the normalization step
850}
851
852//do carries and borrows so each element of the bigInt x fits in bpe bits.
853function carry_(x) {
854 var i,k,c,b;
855 k=x.length;
856 c=0;
857 for (i=0;i<k;i++) {
858 c+=x[i];
859 b=0;
860 if (c<0) {
861 b=-(c>>bpe);
862 c+=b*radix;
863 }
864 x[i]=c & mask;
865 c=(c>>bpe)-b;
866 }
867}
868
869//return x mod n for bigInt x and integer n.
870function modInt(x,n) {
871 var i,c=0;
872 for (i=x.length-1; i>=0; i--)
873 c=(c*radix+x[i])%n;
874 return c;
875}
876
877//convert the integer t into a bigInt with at least the given number of bits.
878//the returned array stores the bigInt in bpe-bit chunks, little endian (buff[0] is least significant word)
879//Pad the array with leading zeros so that it has at least minSize elements.
880//There will always be at least one leading 0 element.
881function int2bigInt(t,bits,minSize) {
882 var i,k;
883 k=Math.ceil(bits/bpe)+1;
884 k=minSize>k ? minSize : k;
885 buff=new Array(k);
886 copyInt_(buff,t);
887 return buff;
888}
889
890//return the bigInt given a string representation in a given base.
891//Pad the array with leading zeros so that it has at least minSize elements.
892//If base=-1, then it reads in a space-separated list of array elements in decimal.
893//The array will always have at least one leading zero, unless base=-1.
894function str2bigInt(s,base,minSize) {
895 var d, i, j, x, y, kk;
896 var k=s.length;
897 if (base==-1) { //comma-separated list of array elements in decimal
898 x=new Array(0);
899 for (;;) {
900 y=new Array(x.length+1);
901 for (i=0;i<x.length;i++)
902 y[i+1]=x[i];
903 y[0]=parseInt(s,10);
904 x=y;
905 d=s.indexOf(',',0);
906 if (d<1)
907 break;
908 s=s.substring(d+1);
909 if (s.length==0)
910 break;
911 }
912 if (x.length<minSize) {
913 y=new Array(minSize);
914 copy_(y,x);
915 return y;
916 }
917 return x;
918 }
919
920 x=int2bigInt(0,base*k,0);
921 for (i=0;i<k;i++) {
922 d=digitsStr.indexOf(s.substring(i,i+1),0);
923 if (base<=36 && d>=36) //convert lowercase to uppercase if base<=36
924 d-=26;
925 if (d<base && d>=0) { //ignore illegal characters
926 multInt_(x,base);
927 addInt_(x,d);
928 }
929 }
930
931 for (k=x.length;k>0 && !x[k-1];k--); //strip off leading zeros
932 k=minSize>k+1 ? minSize : k+1;
933 y=new Array(k);
934 kk=k<x.length ? k : x.length;
935 for (i=0;i<kk;i++)
936 y[i]=x[i];
937 for (;i<k;i++)
938 y[i]=0;
939 return y;
940}
941
942//is bigint x equal to integer y?
943//y must have less than bpe bits
944function equalsInt(x,y) {
945 var i;
946 if (x[0]!=y)
947 return 0;
948 for (i=1;i<x.length;i++)
949 if (x[i])
950 return 0;
951 return 1;
952}
953
954//are bigints x and y equal?
955//this works even if x and y are different lengths and have arbitrarily many leading zeros
956function equals(x,y) {
957 var i;
958 var k=x.length<y.length ? x.length : y.length;
959 for (i=0;i<k;i++)
960 if (x[i]!=y[i])
961 return 0;
962 if (x.length>y.length) {
963 for (;i<x.length;i++)
964 if (x[i])
965 return 0;
966 } else {
967 for (;i<y.length;i++)
968 if (y[i])
969 return 0;
970 }
971 return 1;
972}
973
974//is the bigInt x equal to zero?
975function isZero(x) {
976 var i;
977 for (i=0;i<x.length;i++)
978 if (x[i])
979 return 0;
980 return 1;
981}
982
983//convert a bigInt into a string in a given base, from base 2 up to base 95.
984//Base -1 prints the contents of the array representing the number.
985function bigInt2str(x,base) {
986 var i,t,s="";
987
988 if (s6.length!=x.length)
989 s6=dup(x);
990 else
991 copy_(s6,x);
992
993 if (base==-1) { //return the list of array contents
994 for (i=x.length-1;i>0;i--)
995 s+=x[i]+',';
996 s+=x[0];
997 }
998 else { //return it in the given base
999 while (!isZero(s6)) {
1000 t=divInt_(s6,base); //t=s6 % base; s6=floor(s6/base);
1001 s=digitsStr.substring(t,t+1)+s;
1002 }
1003 }
1004 if (s.length==0)
1005 s="0";
1006 return s;
1007}
1008
1009//returns a duplicate of bigInt x
1010function dup(x) {
1011 var i;
1012 buff=new Array(x.length);
1013 copy_(buff,x);
1014 return buff;
1015}
1016
1017//do x=y on bigInts x and y. x must be an array at least as big as y (not counting the leading zeros in y).
1018function copy_(x,y) {
1019 var i;
1020 var k=x.length<y.length ? x.length : y.length;
1021 for (i=0;i<k;i++)
1022 x[i]=y[i];
1023 for (i=k;i<x.length;i++)
1024 x[i]=0;
1025}
1026
1027//do x=y on bigInt x and integer y.
1028function copyInt_(x,n) {
1029 var i,c;
1030 for (c=n,i=0;i<x.length;i++) {
1031 x[i]=c & mask;
1032 c>>=bpe;
1033 }
1034}
1035
1036//do x=x+n where x is a bigInt and n is an integer.
1037//x must be large enough to hold the result.
1038function addInt_(x,n) {
1039 var i,k,c,b;
1040 x[0]+=n;
1041 k=x.length;
1042 c=0;
1043 for (i=0;i<k;i++) {
1044 c+=x[i];
1045 b=0;
1046 if (c<0) {
1047 b=-(c>>bpe);
1048 c+=b*radix;
1049 }
1050 x[i]=c & mask;
1051 c=(c>>bpe)-b;
1052 if (!c) return; //stop carrying as soon as the carry_ is zero
1053 }
1054}
1055
1056//right shift bigInt x by n bits. 0 <= n < bpe.
1057function rightShift_(x,n) {
1058 var i;
1059 var k=Math.floor(n/bpe);
1060 if (k) {
1061 for (i=0;i<x.length-k;i++) //right shift x by k elements
1062 x[i]=x[i+k];
1063 for (;i<x.length;i++)
1064 x[i]=0;
1065 n%=bpe;
1066 }
1067 for (i=0;i<x.length-1;i++) {
1068 x[i]=mask & ((x[i+1]<<(bpe-n)) | (x[i]>>n));
1069 }
1070 x[i]>>=n;
1071}
1072
1073//do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement
1074function halve_(x) {
1075 var i;
1076 for (i=0;i<x.length-1;i++) {
1077 x[i]=mask & ((x[i+1]<<(bpe-1)) | (x[i]>>1));
1078 }
1079 x[i]=(x[i]>>1) | (x[i] & (radix>>1)); //most significant bit stays the same
1080}
1081
1082//left shift bigInt x by n bits.
1083function leftShift_(x,n) {
1084 var i;
1085 var k=Math.floor(n/bpe);
1086 if (k) {
1087 for (i=x.length; i>=k; i--) //left shift x by k elements
1088 x[i]=x[i-k];
1089 for (;i>=0;i--)
1090 x[i]=0;
1091 n%=bpe;
1092 }
1093 if (!n)
1094 return;
1095 for (i=x.length-1;i>0;i--) {
1096 x[i]=mask & ((x[i]<<n) | (x[i-1]>>(bpe-n)));
1097 }
1098 x[i]=mask & (x[i]<<n);
1099}
1100
1101//do x=x*n where x is a bigInt and n is an integer.
1102//x must be large enough to hold the result.
1103function multInt_(x,n) {
1104 var i,k,c,b;
1105 if (!n)
1106 return;
1107 k=x.length;
1108 c=0;
1109 for (i=0;i<k;i++) {
1110 c+=x[i]*n;
1111 b=0;
1112 if (c<0) {
1113 b=-(c>>bpe);
1114 c+=b*radix;
1115 }
1116 x[i]=c & mask;
1117 c=(c>>bpe)-b;
1118 }
1119}
1120
1121//do x=floor(x/n) for bigInt x and integer n, and return the remainder
1122function divInt_(x,n) {
1123 var i,r=0,s;
1124 for (i=x.length-1;i>=0;i--) {
1125 s=r*radix+x[i];
1126 x[i]=Math.floor(s/n);
1127 r=s%n;
1128 }
1129 return r;
1130}
1131
1132//do the linear combination x=a*x+b*y for bigInts x and y, and integers a and b.
1133//x must be large enough to hold the answer.
1134function linComb_(x,y,a,b) {
1135 var i,c,k,kk;
1136 k=x.length<y.length ? x.length : y.length;
1137 kk=x.length;
1138 for (c=0,i=0;i<k;i++) {
1139 c+=a*x[i]+b*y[i];
1140 x[i]=c & mask;
1141 c>>=bpe;
1142 }
1143 for (i=k;i<kk;i++) {
1144 c+=a*x[i];
1145 x[i]=c & mask;
1146 c>>=bpe;
1147 }
1148}
1149
1150//do the linear combination x=a*x+b*(y<<(ys*bpe)) for bigInts x and y, and integers a, b and ys.
1151//x must be large enough to hold the answer.
1152function linCombShift_(x,y,b,ys) {
1153 var i,c,k,kk;
1154 k=x.length<ys+y.length ? x.length : ys+y.length;
1155 kk=x.length;
1156 for (c=0,i=ys;i<k;i++) {
1157 c+=x[i]+b*y[i-ys];
1158 x[i]=c & mask;
1159 c>>=bpe;
1160 }
1161 for (i=k;c && i<kk;i++) {
1162 c+=x[i];
1163 x[i]=c & mask;
1164 c>>=bpe;
1165 }
1166}
1167
1168//do x=x+(y<<(ys*bpe)) for bigInts x and y, and integers a,b and ys.
1169//x must be large enough to hold the answer.
1170function addShift_(x,y,ys) {
1171 var i,c,k,kk;
1172 k=x.length<ys+y.length ? x.length : ys+y.length;
1173 kk=x.length;
1174 for (c=0,i=ys;i<k;i++) {
1175 c+=x[i]+y[i-ys];
1176 x[i]=c & mask;
1177 c>>=bpe;
1178 }
1179 for (i=k;c && i<kk;i++) {
1180 c+=x[i];
1181 x[i]=c & mask;
1182 c>>=bpe;
1183 }
1184}
1185
1186//do x=x-(y<<(ys*bpe)) for bigInts x and y, and integers a,b and ys.
1187//x must be large enough to hold the answer.
1188function subShift_(x,y,ys) {
1189 var i,c,k,kk;
1190 k=x.length<ys+y.length ? x.length : ys+y.length;
1191 kk=x.length;
1192 for (c=0,i=ys;i<k;i++) {
1193 c+=x[i]-y[i-ys];
1194 x[i]=c & mask;
1195 c>>=bpe;
1196 }
1197 for (i=k;c && i<kk;i++) {
1198 c+=x[i];
1199 x[i]=c & mask;
1200 c>>=bpe;
1201 }
1202}
1203
1204//do x=x-y for bigInts x and y.
1205//x must be large enough to hold the answer.
1206//negative answers will be 2s complement
1207function sub_(x,y) {
1208 var i,c,k,kk;
1209 k=x.length<y.length ? x.length : y.length;
1210 for (c=0,i=0;i<k;i++) {
1211 c+=x[i]-y[i];
1212 x[i]=c & mask;
1213 c>>=bpe;
1214 }
1215 for (i=k;c && i<x.length;i++) {
1216 c+=x[i];
1217 x[i]=c & mask;
1218 c>>=bpe;
1219 }
1220}
1221
1222//do x=x+y for bigInts x and y.
1223//x must be large enough to hold the answer.
1224function add_(x,y) {
1225 var i,c,k,kk;
1226 k=x.length<y.length ? x.length : y.length;
1227 for (c=0,i=0;i<k;i++) {
1228 c+=x[i]+y[i];
1229 x[i]=c & mask;
1230 c>>=bpe;
1231 }
1232 for (i=k;c && i<x.length;i++) {
1233 c+=x[i];
1234 x[i]=c & mask;
1235 c>>=bpe;
1236 }
1237}
1238
1239//do x=x*y for bigInts x and y. This is faster when y<x.
1240function mult_(x,y) {
1241 var i;
1242 if (ss.length!=2*x.length)
1243 ss=new Array(2*x.length);
1244 copyInt_(ss,0);
1245 for (i=0;i<y.length;i++)
1246 if (y[i])
1247 linCombShift_(ss,x,y[i],i); //ss=1*ss+y[i]*(x<<(i*bpe))
1248 copy_(x,ss);
1249}
1250
1251//do x=x mod n for bigInts x and n.
1252function mod_(x,n) {
1253 if (s4.length!=x.length)
1254 s4=dup(x);
1255 else
1256 copy_(s4,x);
1257 if (s5.length!=x.length)
1258 s5=dup(x);
1259 divide_(s4,n,s5,x); //x = remainder of s4 / n
1260}
1261
1262//do x=x*y mod n for bigInts x,y,n.
1263//for greater speed, let y<x.
1264function multMod_(x,y,n) {
1265 var i;
1266 if (s0.length!=2*x.length)
1267 s0=new Array(2*x.length);
1268 copyInt_(s0,0);
1269 for (i=0;i<y.length;i++)
1270 if (y[i])
1271 linCombShift_(s0,x,y[i],i); //s0=1*s0+y[i]*(x<<(i*bpe))
1272 mod_(s0,n);
1273 copy_(x,s0);
1274}
1275
1276//do x=x*x mod n for bigInts x,n.
1277function squareMod_(x,n) {
1278 var i,j,d,c,kx,kn,k;
1279 for (kx=x.length; kx>0 && !x[kx-1]; kx--); //ignore leading zeros in x
1280 k=kx>n.length ? 2*kx : 2*n.length; //k=# elements in the product, which is twice the elements in the larger of x and n
1281 if (s0.length!=k)
1282 s0=new Array(k);
1283 copyInt_(s0,0);
1284 for (i=0;i<kx;i++) {
1285 c=s0[2*i]+x[i]*x[i];
1286 s0[2*i]=c & mask;
1287 c>>=bpe;
1288 for (j=i+1;j<kx;j++) {
1289 c=s0[i+j]+2*x[i]*x[j]+c;
1290 s0[i+j]=(c & mask);
1291 c>>=bpe;
1292 }
1293 s0[i+kx]=c;
1294 }
1295 mod_(s0,n);
1296 copy_(x,s0);
1297}
1298
1299//return x with exactly k leading zero elements
1300function trim(x,k) {
1301 var i,y;
1302 for (i=x.length; i>0 && !x[i-1]; i--);
1303 y=new Array(i+k);
1304 copy_(y,x);
1305 return y;
1306}
1307
1308//do x=x**y mod n, where x,y,n are bigInts and ** is exponentiation. 0**0=1.
1309//this is faster when n is odd. x usually needs to have as many elements as n.
1310function powMod_(x,y,n) {
1311 var k1,k2,kn,np;
1312 if(s7.length!=n.length)
1313 s7=dup(n);
1314
1315 //for even modulus, use a simple square-and-multiply algorithm,
1316 //rather than using the more complex Montgomery algorithm.
1317 if ((n[0]&1)==0) {
1318 copy_(s7,x);
1319 copyInt_(x,1);
1320 while(!equalsInt(y,0)) {
1321 if (y[0]&1)
1322 multMod_(x,s7,n);
1323 divInt_(y,2);
1324 squareMod_(s7,n);
1325 }
1326 return;
1327 }
1328
1329 //calculate np from n for the Montgomery multiplications
1330 copyInt_(s7,0);
1331 for (kn=n.length;kn>0 && !n[kn-1];kn--);
1332 np=radix-inverseModInt_(modInt(n,radix),radix);
1333 s7[kn]=1;
1334 multMod_(x ,s7,n); // x = x * 2**(kn*bp) mod n
1335
1336 if (s3.length!=x.length)
1337 s3=dup(x);
1338 else
1339 copy_(s3,x);
1340
1341 for (k1=y.length-1;k1>0 & !y[k1]; k1--); //k1=first nonzero element of y
1342 if (y[k1]==0) { //anything to the 0th power is 1
1343 copyInt_(x,1);
1344 return;
1345 }
1346 for (k2=1<<(bpe-1);k2 && !(y[k1] & k2); k2>>=1); //k2=position of first 1 bit in y[k1]
1347 for (;;) {
1348 if (!(k2>>=1)) { //look at next bit of y
1349 k1--;
1350 if (k1<0) {
1351 mont_(x,one,n,np);
1352 return;
1353 }
1354 k2=1<<(bpe-1);
1355 }
1356 mont_(x,x,n,np);
1357
1358 if (k2 & y[k1]) //if next bit is a 1
1359 mont_(x,s3,n,np);
1360 }
1361}
1362
1363//do x=x*y*Ri mod n for bigInts x,y,n,
1364// where Ri = 2**(-kn*bpe) mod n, and kn is the
1365// number of elements in the n array, not
1366// counting leading zeros.
1367//x must be large enough to hold the answer.
1368//It's OK if x and y are the same variable.
1369//must have:
1370// x,y < n
1371// n is odd
1372// np = -(n^(-1)) mod radix
1373function mont_(x,y,n,np) {
1374 var i,j,c,ui,t;
1375 var kn=n.length;
1376 var ky=y.length;
1377
1378 if (sa.length!=kn)
1379 sa=new Array(kn);
1380
1381 for (;kn>0 && n[kn-1]==0;kn--); //ignore leading zeros of n
1382 //this function sometimes gives wrong answers when the next line is uncommented
1383 //for (;ky>0 && y[ky-1]==0;ky--); //ignore leading zeros of y
1384
1385 copyInt_(sa,0);
1386
1387 //the following loop consumes 95% of the runtime for randTruePrime_() and powMod_() for large keys
1388 for (i=0; i<kn; i++) {
1389 t=sa[0]+x[i]*y[0];
1390 ui=((t & mask) * np) & mask; //the inner "& mask" is needed on Macintosh MSIE, but not windows MSIE
1391 c=(t+ui*n[0]) >> bpe;
1392 t=x[i];
1393
1394 //do sa=(sa+x[i]*y+ui*n)/b where b=2**bpe
1395 for (j=1;j<ky;j++) {
1396 c+=sa[j]+t*y[j]+ui*n[j];
1397 sa[j-1]=c & mask;
1398 c>>=bpe;
1399 }
1400 for (;j<kn;j++) {
1401 c+=sa[j]+ui*n[j];
1402 sa[j-1]=c & mask;
1403 c>>=bpe;
1404 }
1405 sa[j-1]=c & mask;
1406 }
1407
1408 if (!greater(n,sa))
1409 sub_(sa,n);
1410 copy_(x,sa);
1411}
1412
1413
1414
1415
1416//#############################################################################
1417//#############################################################################
1418//#############################################################################
1419//#############################################################################
1420//#############################################################################
1421//#############################################################################
1422//#############################################################################
1423
1424
1425
1426
1427
1428//#############################################################################
1429
1430Clipperz.Crypto.BigInt = function (aValue, aBase) {
1431 varbase;
1432 varvalue;
1433
1434 if (typeof(aValue) == 'object') {
1435 this._internalValue = aValue;
1436 } else {
1437 if (typeof(aValue) == 'undefined') {
1438 value = "0";
1439 } else {
1440 value = aValue + "";
1441 }
1442
1443 if (typeof(aBase) == 'undefined') {
1444 base = 10;
1445 } else {
1446 base = aBase;
1447 }
1448
1449 this._internalValue = str2bigInt(value, base, 1, 1);
1450 }
1451
1452 return this;
1453}
1454
1455//=============================================================================
1456
1457MochiKit.Base.update(Clipperz.Crypto.BigInt.prototype, {
1458
1459 //-------------------------------------------------------------------------
1460
1461 'internalValue': function () {
1462 return this._internalValue;
1463 },
1464
1465 //-------------------------------------------------------------------------
1466
1467 'isBigInt': true,
1468
1469 //-------------------------------------------------------------------------
1470
1471 'toString': function(aBase) {
1472 return this.asString(aBase);
1473 },
1474
1475 //-------------------------------------------------------------------------
1476
1477 'asString': function (aBase) {
1478 varbase;
1479
1480 if (typeof(aBase) == 'undefined') {
1481 base = 10;
1482 } else {
1483 base = aBase;
1484 }
1485
1486 return bigInt2str(this.internalValue(), base).toLowerCase();
1487 },
1488
1489 //-------------------------------------------------------------------------
1490
1491 'equals': function (aValue) {
1492 var result;
1493
1494 if (aValue.isBigInt) {
1495 result = equals(this.internalValue(), aValue.internalValue());
1496 } else if (typeof(aValue) == "number") {
1497 result = equalsInt(this.internalValue(), aValue);
1498 } else {
1499 throw Clipperz.Crypt.BigInt.exception.UnknownType;
1500 }
1501
1502 return result;
1503 },
1504
1505 //-------------------------------------------------------------------------
1506
1507 'add': function (aValue) {
1508 var result;
1509
1510 if (aValue.isBigInt) {
1511 result = add(this.internalValue(), aValue.internalValue());
1512 } else {
1513 result = addInt(this.internalValue(), aValue);
1514 }
1515
1516 return new Clipperz.Crypto.BigInt(result);
1517 },
1518
1519 //-------------------------------------------------------------------------
1520
1521 'subtract': function (aValue) {
1522 var result;
1523 var value;
1524
1525 if (aValue.isBigInt) {
1526 value = aValue;
1527 } else {
1528 value = new Clipperz.Crypto.BigInt(aValue);
1529 }
1530
1531 result = sub(this.internalValue(), value.internalValue());
1532
1533 return new Clipperz.Crypto.BigInt(result);
1534 },
1535
1536 //-------------------------------------------------------------------------
1537
1538 'multiply': function (aValue, aModule) {
1539 var result;
1540 var value;
1541
1542 if (aValue.isBigInt) {
1543 value = aValue;
1544 } else {
1545 value = new Clipperz.Crypto.BigInt(aValue);
1546 }
1547
1548 if (typeof(aModule) == 'undefined') {
1549 result = mult(this.internalValue(), value.internalValue());
1550 } else {
1551 result = multMod(this.internalValue(), value.internalValue(), aModule);
1552 }
1553
1554 return new Clipperz.Crypto.BigInt(result);
1555 },
1556
1557 //-------------------------------------------------------------------------
1558
1559 'module': function (aModule) {
1560 varresult;
1561 var module;
1562
1563 if (aModule.isBigInt) {
1564 module = aModule;
1565 } else {
1566 module = new Clipperz.Crypto.BigInt(aModule);
1567 }
1568
1569 result = mod(this.internalValue(), module.internalValue());
1570
1571 return new Clipperz.Crypto.BigInt(result);
1572 },
1573
1574 //-------------------------------------------------------------------------
1575
1576 'powerModule': function(aValue, aModule) {
1577 varresult;
1578 varvalue;
1579 var module;
1580
1581 if (aValue.isBigInt) {
1582 value = aValue;
1583 } else {
1584 value = new Clipperz.Crypto.BigInt(aValue);
1585 }
1586
1587 if (aModule.isBigInt) {
1588 module = aModule;
1589 } else {
1590 module = new Clipperz.Crypto.BigInt(aModule);
1591 }
1592
1593 if (aValue == -1) {
1594 result = inverseMod(this.internalValue(), module.internalValue());
1595 } else {
1596 result = powMod(this.internalValue(), value.internalValue(), module.internalValue());
1597 }
1598
1599 return new Clipperz.Crypto.BigInt(result);
1600 },
1601
1602 //-------------------------------------------------------------------------
1603
1604 'bitSize': function() {
1605 return bitSize(this.internalValue());
1606 },
1607
1608 //-------------------------------------------------------------------------
1609 __syntaxFix__: "syntax fix"
1610
1611});
1612
1613//#############################################################################
1614
1615Clipperz.Crypto.BigInt.randomPrime = function(aBitSize) {
1616 return new Clipperz.Crypto.BigInt(randTruePrime(aBitSize));
1617}
1618
1619//#############################################################################
1620//#############################################################################
1621//#############################################################################
1622
1623Clipperz.Crypto.BigInt.equals = function(a, b) {
1624 return a.equals(b);
1625}
1626
1627Clipperz.Crypto.BigInt.add = function(a, b) {
1628 return a.add(b);
1629}
1630
1631Clipperz.Crypto.BigInt.subtract = function(a, b) {
1632 return a.subtract(b);
1633}
1634
1635Clipperz.Crypto.BigInt.multiply = function(a, b, module) {
1636 return a.multiply(b, module);
1637}
1638
1639Clipperz.Crypto.BigInt.module = function(a, module) {
1640 return a.module(module);
1641}
1642
1643Clipperz.Crypto.BigInt.powerModule = function(a, b, module) {
1644 return a.powerModule(b, module);
1645}
1646
1647Clipperz.Crypto.BigInt.exception = {
1648 UnknownType: new MochiKit.Base.NamedError("Clipperz.Crypto.BigInt.exception.UnknownType")
1649}
diff --git a/frontend/beta/js/Clipperz/Crypto/ECC.js b/frontend/beta/js/Clipperz/Crypto/ECC.js
new file mode 100644
index 0000000..c3dcec3
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Crypto/ECC.js
@@ -0,0 +1,960 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29/*
30try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
31 throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!";
32}
33
34if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; }
35
36
37//#############################################################################
38
39Clipperz.Crypto.ECC.BinaryField = {};
40
41//#############################################################################
42
43Clipperz.Crypto.ECC.BinaryField.AbstractValue = function(aValue, aBase) {
44 return this;
45}
46
47Clipperz.Crypto.ECC.BinaryField.AbstractValue.prototype = MochiKit.Base.update(null, {
48
49 'asString': function(aBase) {
50 throw Clipperz.Base.exception.AbstractMethod;
51 },
52
53 'isZero': function() {
54 throw Clipperz.Base.exception.AbstractMethod;
55 },
56
57 'shiftLeft': function(aNumberOfBitsToShift) {
58 throw Clipperz.Base.exception.AbstractMethod;
59 },
60
61 'bitSize': function() {
62 throw Clipperz.Base.exception.AbstractMethod;
63 },
64
65 'isBitSet': function(aBitPosition) {
66 throw Clipperz.Base.exception.AbstractMethod;
67 },
68
69 'xor': function(aValue) {
70 throw Clipperz.Base.exception.AbstractMethod;
71 },
72
73 'compare': function(aValue) {
74 throw Clipperz.Base.exception.AbstractMethod;
75 },
76
77 //-----------------------------------------------------------------------------
78 __syntaxFix__: "syntax fix"
79});
80
81//*****************************************************************************
82/ *
83Clipperz.Crypto.ECC.BinaryField.BigIntValue = function(aValue, aBase) {
84 this._value = new Clipperz.Crypto.BigInt(aValue, aBase);
85 return this;
86}
87
88Clipperz.Crypto.ECC.BinaryField.BigIntValue.prototype = MochiKit.Base.update(new Clipperz.Crypto.ECC.BinaryField.AbstractValue(), {
89
90 'value': function() {
91 return this._value;
92 },
93
94 //-----------------------------------------------------------------------------
95
96 'isZero': function() {
97 return (this.value().compare(Clipperz.Crypto.ECC.BinaryField.BigIntValue.O) == 0);
98 },
99
100 //-----------------------------------------------------------------------------
101
102 'asString': function(aBase) {
103 return this.value().asString(aBase);
104 },
105
106 //-----------------------------------------------------------------------------
107
108 'shiftLeft': function(aNumberOfBitsToShift) {
109 return new Clipperz.Crypto.ECC.BinaryField.BigIntValue(this.value().shiftLeft(aNumberOfBitsToShift));
110 },
111
112 //-----------------------------------------------------------------------------
113
114 'bitSize': function() {
115 return this.value().bitSize();
116 },
117
118 //-----------------------------------------------------------------------------
119
120 'isBitSet': function(aBitPosition) {
121 return this.value().isBitSet(aBitPosition);
122 },
123
124 //-----------------------------------------------------------------------------
125
126 'xor': function(aValue) {
127 return new Clipperz.Crypto.ECC.BinaryField.BigIntValue(this.value().xor(aValue.value()));
128 },
129
130 //-----------------------------------------------------------------------------
131
132 'compare': function(aValue) {
133 return this.value().compare(aValue.value());
134 },
135
136 //-----------------------------------------------------------------------------
137 __syntaxFix__: "syntax fix"
138});
139
140Clipperz.Crypto.ECC.BinaryField.BigIntValue.O = new Clipperz.Crypto.BigInt(0);
141Clipperz.Crypto.ECC.BinaryField.BigIntValue.I = new Clipperz.Crypto.BigInt(1);
142* /
143//*****************************************************************************
144
145Clipperz.Crypto.ECC.BinaryField.WordArrayValue = function(aValue, aBase) {
146 if (aValue.constructor == String) {
147 varvalue;
148 varstringLength;
149 var numberOfWords;
150 vari,c;
151
152 if (aBase != 16) {
153 throw Clipperz.Crypto.ECC.BinaryField.WordArrayValue.exception.UnsupportedBase;
154 }
155
156 value = aValue.replace(/ /g, '');
157 stringLength = value.length;
158 numberOfWords = Math.ceil(stringLength / 8);
159 this._value = new Array(numberOfWords);
160
161 c = numberOfWords;
162 for (i=0; i<c; i++) {
163 varword;
164
165 if (i < (c-1)) {
166 word = parseInt(value.substr(stringLength-((i+1)*8), 8), 16);
167 } else {
168 word = parseInt(value.substr(0, stringLength-(i*8)), 16);
169 }
170
171 this._value[i] = word;
172 }
173 } else if (aValue.constructor == Array) {
174 var itemsToCopy;
175
176 itemsToCopy = aValue.length;
177 while (aValue[itemsToCopy - 1] == 0) {
178 itemsToCopy --;
179 }
180
181 this._value = aValue.slice(0, itemsToCopy);
182 } else if (aValue.constructor == Number) {
183 this._value = [aValue];
184 } else {
185 // throw Clipperz.Crypto.ECC.BinaryField.WordArrayValue.exception.UnsupportedConstructorValueType;
186 }
187
188 return this;
189}
190
191Clipperz.Crypto.ECC.BinaryField.WordArrayValue.prototype = MochiKit.Base.update(new Clipperz.Crypto.ECC.BinaryField.AbstractValue(), {
192
193 'value': function() {
194 return this._value;
195 },
196
197 //-----------------------------------------------------------------------------
198
199 'wordSize': function() {
200 return this._value.length
201 },
202
203 //-----------------------------------------------------------------------------
204
205 'clone': function() {
206 return new Clipperz.Crypto.ECC.BinaryField.WordArrayValue(this._value.slice(0));
207 },
208
209 //-----------------------------------------------------------------------------
210
211 'isZero': function() {
212 return (this.compare(Clipperz.Crypto.ECC.BinaryField.WordArrayValue.O) == 0);
213 },
214
215 //-----------------------------------------------------------------------------
216
217 'asString': function(aBase) {
218 varresult;
219 var i,c;
220
221 if (aBase != 16) {
222 throw Clipperz.Crypto.ECC.BinaryField.WordArrayValue.exception.UnsupportedBase;
223 }
224
225 result = "";
226 c = this.wordSize();
227 for (i=0; i<c; i++) {
228 varwordAsString;
229
230 // wordAsString = ("00000000" + this.value()[i].toString(16));
231 wordAsString = ("00000000" + this._value[i].toString(16));
232 wordAsString = wordAsString.substring(wordAsString.length - 8);
233 result = wordAsString + result;
234 }
235
236 result = result.replace(/^(00)* SPACEs THAT SHOULD BE REMOVED TO FIX THIS REGEX /, "");
237
238 if (result == "") {
239 result = "0";
240 }
241
242 return result;
243 },
244
245 //-----------------------------------------------------------------------------
246
247 'shiftLeft': function(aNumberOfBitsToShift) {
248 return new Clipperz.Crypto.ECC.BinaryField.WordArrayValue(Clipperz.Crypto.ECC.BinaryField.WordArrayValue.shiftLeft(this._value, aNumberOfBitsToShift));
249 },
250
251 //-----------------------------------------------------------------------------
252
253 'bitSize': function() {
254 return Clipperz.Crypto.ECC.BinaryField.WordArrayValue.bitSize(this._value);
255 },
256
257 //-----------------------------------------------------------------------------
258
259 'isBitSet': function(aBitPosition) {
260 return Clipperz.Crypto.ECC.BinaryField.WordArrayValue.isBitSet(this._value, aBitPosition);
261 },
262
263 //-----------------------------------------------------------------------------
264
265 'xor': function(aValue) {
266 return new Clipperz.Crypto.ECC.BinaryField.WordArrayValue(Clipperz.Crypto.ECC.BinaryField.WordArrayValue.xor(this._value, aValue._value));
267 },
268
269 //-----------------------------------------------------------------------------
270
271 'compare': function(aValue) {
272 return Clipperz.Crypto.ECC.BinaryField.WordArrayValue.compare(this._value, aValue._value);
273 },
274
275 //-----------------------------------------------------------------------------
276 __syntaxFix__: "syntax fix"
277});
278
279Clipperz.Crypto.ECC.BinaryField.WordArrayValue.O = new Clipperz.Crypto.ECC.BinaryField.WordArrayValue('0', 16);
280Clipperz.Crypto.ECC.BinaryField.WordArrayValue.I = new Clipperz.Crypto.ECC.BinaryField.WordArrayValue('1', 16);
281
282Clipperz.Crypto.ECC.BinaryField.WordArrayValue.xor = function(a, b) {
283 var result;
284 var resultSize;
285 var i,c;
286
287 resultSize = Math.max(a.length, b.length);
288
289 result = new Array(resultSize);
290 c = resultSize;
291 for (i=0; i<c; i++) {
292 // resultValue[i] = (((this.value()[i] || 0) ^ (aValue.value()[i] || 0)) >>> 0);
293 result[i] = (((a[i] || 0) ^ (b[i] || 0)) >>> 0);
294 }
295
296 return result;
297};
298
299Clipperz.Crypto.ECC.BinaryField.WordArrayValue.shiftLeft = function(aWordArray, aNumberOfBitsToShift) {
300 var numberOfWordsToShift;
301 varnumberOfBitsToShift;
302 var result;
303 varoverflowValue;
304 vari,c;
305
306 numberOfWordsToShift = Math.floor(aNumberOfBitsToShift / 32);
307 numberOfBitsToShift = aNumberOfBitsToShift % 32;
308
309 result = new Array(aWordArray.length + numberOfWordsToShift);
310
311 c = numberOfWordsToShift;
312 for (i=0; i<c; i++) {
313 result[i] = 0;
314 }
315
316 overflowValue = 0;
317 nextOverflowValue = 0;
318
319 c = aWordArray.length;
320 for (i=0; i<c; i++) {
321 varvalue;
322 varresultWord;
323
324 // value = this.value()[i];
325 value = aWordArray[i];
326
327 if (numberOfBitsToShift > 0) {
328 var nextOverflowValue;
329
330 nextOverflowValue = (value >>> (32 - numberOfBitsToShift));
331 value = value & (0xffffffff >>> numberOfBitsToShift);
332 resultWord = (((value << numberOfBitsToShift) | overflowValue) >>> 0);
333 } else {
334 resultWord = value;
335 }
336
337 result[i+numberOfWordsToShift] = resultWord;
338 overflowValue = nextOverflowValue;
339 }
340
341 if (overflowValue != 0) {
342 result[aWordArray.length + numberOfWordsToShift] = overflowValue;
343 }
344
345 return result;
346};
347
348Clipperz.Crypto.ECC.BinaryField.WordArrayValue.bitSize = function(aWordArray) {
349 varresult;
350 varnotNullElements;
351 var mostValuableWord;
352 var matchingBitsInMostImportantWord;
353 var mask;
354 var i,c;
355
356 notNullElements = aWordArray.length;
357
358 if ((aWordArray.length == 1) && (aWordArray[0] == 0)) {
359 result = 0;
360 } else {
361 while((aWordArray[notNullElements - 1] == 0) && (notNullElements > 0)) {
362 notNullElements --;
363 }
364
365 result = (notNullElements - 1) * 32;
366 mostValuableWord = aWordArray[notNullElements - 1];
367
368 matchingBits = 32;
369 mask = 0x80000000;
370
371 while ((matchingBits > 0) && ((mostValuableWord & mask) == 0)) {
372 matchingBits --;
373 mask >>>= 1;
374 }
375
376 result += matchingBits;
377 }
378
379 return result;
380};
381
382Clipperz.Crypto.ECC.BinaryField.WordArrayValue.isBitSet = function(aWordArray, aBitPosition) {
383 var result;
384 varbyteIndex;
385 var bitIndexInSelectedByte;
386
387 byteIndex = Math.floor(aBitPosition / 32);
388 bitIndexInSelectedByte = aBitPosition % 32;
389
390 if (byteIndex <= aWordArray.length) {
391 result = ((aWordArray[byteIndex] & (1 << bitIndexInSelectedByte)) != 0);
392 } else {
393 result = false;
394 }
395
396 return result;
397};
398
399Clipperz.Crypto.ECC.BinaryField.WordArrayValue.compare = function(a,b) {
400 varresult;
401 var i,c;
402
403 result = MochiKit.Base.compare(a.length, b.length);
404
405 c = a.length;
406 for (i=0; (i<c) && (result==0); i++) {
407//console.log("compare[" + c + " - " + i + " - 1] " + this.value()[c-i-1] + ", " + aValue.value()[c-i-1]);
408 // result = MochiKit.Base.compare(this.value()[c-i-1], aValue.value()[c-i-1]);
409 result = MochiKit.Base.compare(a[c-i-1], b[c-i-1]);
410 }
411
412 return result;
413};
414
415
416Clipperz.Crypto.ECC.BinaryField.WordArrayValue['exception']= {
417 'UnsupportedBase': new MochiKit.Base.NamedError("Clipperz.Crypto.ECC.BinaryField.WordArrayValue.exception.UnsupportedBase"),
418 'UnsupportedConstructorValueType':new MochiKit.Base.NamedError("Clipperz.Crypto.ECC.BinaryField.WordArrayValue.exception.UnsupportedConstructorValueType")
419};
420
421//*****************************************************************************
422
423 //Clipperz.Crypto.ECC.BinaryField.Value =Clipperz.Crypto.ECC.BinaryField.BigIntValue;
424 Clipperz.Crypto.ECC.BinaryField.Value =Clipperz.Crypto.ECC.BinaryField.WordArrayValue;
425
426//#############################################################################
427
428Clipperz.Crypto.ECC.BinaryField.Point = function(args) {
429 args = args || {};
430 this._x = args.x;
431 this._y = args.y;
432
433 return this;
434}
435
436Clipperz.Crypto.ECC.BinaryField.Point.prototype = MochiKit.Base.update(null, {
437
438 'asString': function() {
439 return "Clipperz.Crypto.ECC.BinaryField.Point (" + this.x() + ", " + this.y() + ")";
440 },
441
442 //-----------------------------------------------------------------------------
443
444 'x': function() {
445 return this._x;
446 },
447
448 'y': function() {
449 return this._y;
450 },
451
452 //-----------------------------------------------------------------------------
453
454 'isZero': function() {
455 return (this.x().isZero() && this.y().isZero())
456 },
457
458 //-----------------------------------------------------------------------------
459 __syntaxFix__: "syntax fix"
460});
461
462//#############################################################################
463
464Clipperz.Crypto.ECC.BinaryField.FiniteField = function(args) {
465 args = args || {};
466 this._modulus = args.modulus;
467
468 return this;
469}
470
471Clipperz.Crypto.ECC.BinaryField.FiniteField.prototype = MochiKit.Base.update(null, {
472
473 'asString': function() {
474 return "Clipperz.Crypto.ECC.BinaryField.FiniteField (" + this.modulus().asString() + ")";
475 },
476
477 //-----------------------------------------------------------------------------
478
479 'modulus': function() {
480 return this._modulus;
481 },
482
483 //-----------------------------------------------------------------------------
484
485 '_module': function(aValue) {
486 varresult;
487 var modulusComparison;
488//console.log(">>> binaryField.finiteField.(standard)module");
489
490 modulusComparison = Clipperz.Crypto.ECC.BinaryField.WordArrayValue.compare(aValue, this.modulus()._value);
491
492 if (modulusComparison < 0) {
493 result = aValue;
494 } else if (modulusComparison == 0) {
495 result = [0];
496 } else {
497 var modulusBitSize;
498 var resultBitSize;
499
500 result = aValue;
501
502 modulusBitSize = this.modulus().bitSize();
503 resultBitSize = Clipperz.Crypto.ECC.BinaryField.WordArrayValue.bitSize(result);
504 while (resultBitSize >= modulusBitSize) {
505 result = Clipperz.Crypto.ECC.BinaryField.WordArrayValue.xor(result, Clipperz.Crypto.ECC.BinaryField.WordArrayValue.shiftLeft(this.modulus()._value, resultBitSize - modulusBitSize));
506 resultBitSize = Clipperz.Crypto.ECC.BinaryField.WordArrayValue.bitSize(result);
507 }
508 }
509//console.log("<<< binaryField.finiteField.(standard)module");
510
511 return result;
512 },
513
514 'module': function(aValue) {
515 return new Clipperz.Crypto.ECC.BinaryField.Value(this._module(aValue._value));
516 },
517
518 //-----------------------------------------------------------------------------
519
520 '_add': function(a, b) {
521 return Clipperz.Crypto.ECC.BinaryField.WordArrayValue.xor(a, b);
522 },
523
524 'add': function(a, b) {
525 return new Clipperz.Crypto.ECC.BinaryField.Value(this._add(a._value, b._value));
526 },
527
528 //-----------------------------------------------------------------------------
529
530 'negate': function(aValue) {
531 return aValue.clone();
532 },
533
534 //-----------------------------------------------------------------------------
535/ *
536 'multiply': function(a, b) {
537 var result;
538 var valueToXor;
539 var i,c;
540
541 result = Clipperz.Crypto.ECC.BinaryField.Value.O;
542 valueToXor = b;
543 c = a.bitSize();
544 for (i=0; i<c; i++) {
545 if (a.isBitSet(i) === true) {
546 result = result.xor(valueToXor);
547 }
548 valueToXor = valueToXor.shiftLeft(1);
549 }
550 result = this.module(result);
551
552 return result;
553 },
554* /
555
556 '_multiply': function(a, b) {
557 var result;
558 var valueToXor;
559 var i,c;
560
561 result = [0];
562 valueToXor = b;
563 c = Clipperz.Crypto.ECC.BinaryField.WordArrayValue.bitSize(a);
564 for (i=0; i<c; i++) {
565 if (Clipperz.Crypto.ECC.BinaryField.WordArrayValue.isBitSet(a, i) === true) {
566 result = Clipperz.Crypto.ECC.BinaryField.WordArrayValue.xor(result, valueToXor);
567 }
568 valueToXor = Clipperz.Crypto.ECC.BinaryField.WordArrayValue.shiftLeft(valueToXor, 1);
569 }
570 result = this._module(result);
571
572 return result;
573 },
574
575 'multiply': function(a, b) {
576 return new Clipperz.Crypto.ECC.BinaryField.Value(this._multiply(a._value, b._value));
577 },
578
579 //-----------------------------------------------------------------------------
580 //
581 //Guide to Elliptic Curve Cryptography
582 //Darrel Hankerson, Alfred Menezes, Scott Vanstone
583 //- Pag: 49, Alorithm 2.34
584 //
585 //-----------------------------------------------------------------------------
586/ *
587 'square': function(aValue) {
588 varresult;
589 vart;
590 var i,c;
591
592 result = [0];
593 t = Math.max(a)
594 c = 32;
595 for (i=0; i<c; i++) {
596 var ii, cc;
597
598 cc =
599 }
600
601
602
603
604 return result;
605 },
606 * /
607 //-----------------------------------------------------------------------------
608
609 'inverse': function(aValue) {
610 varresult;
611 var b, c;
612 var u, v;
613
614 b = Clipperz.Crypto.ECC.BinaryField.Value.I;
615 c = Clipperz.Crypto.ECC.BinaryField.Value.O;
616 u = this.module(aValue);
617 v = this.modulus();
618
619 while (u.bitSize() > 1) {
620 varbitDifferenceSize;
621
622 bitDifferenceSize = u.bitSize() - v.bitSize();
623 if (bitDifferenceSize < 0) {
624 var swap;
625
626 swap = u;
627 u = v;
628 v = swap;
629
630 swap = c;
631 c = b;
632 b = swap;
633
634 bitDifferenceSize = -bitDifferenceSize;
635 }
636
637 u = this.add(u, v.shiftLeft(bitDifferenceSize));
638 b = this.add(b, c.shiftLeft(bitDifferenceSize))
639 }
640
641 result = this.module(b);
642
643 return result;
644 },
645
646 //-----------------------------------------------------------------------------
647 __syntaxFix__: "syntax fix"
648});
649
650//#############################################################################
651
652Clipperz.Crypto.ECC.BinaryField.Curve = function(args) {
653 args = args || {};
654
655 this._modulus = args.modulus;
656
657 this._a = args.a;
658 this._b = args.b;
659 this._G = args.G;
660 this._r = args.r;
661 this._h = args.h;
662
663 this._finiteField = null;
664
665 return this;
666}
667
668Clipperz.Crypto.ECC.BinaryField.Curve.prototype = MochiKit.Base.update(null, {
669
670 'asString': function() {
671 return "Clipperz.Crypto.ECC.BinaryField.Curve";
672 },
673
674 //-----------------------------------------------------------------------------
675
676 'modulus': function() {
677 return this._modulus;
678 },
679
680 'a': function() {
681 return this._a;
682 },
683
684 'b': function() {
685 return this._b;
686 },
687
688 'G': function() {
689 return this._G;
690 },
691
692 'r': function() {
693 return this._r;
694 },
695
696 'h': function() {
697 return this._h;
698 },
699
700 //-----------------------------------------------------------------------------
701
702 'finiteField': function() {
703 if (this._finiteField == null) {
704 this._finiteField = new Clipperz.Crypto.ECC.BinaryField.FiniteField({modulus:this.modulus()})
705 }
706
707 return this._finiteField;
708 },
709
710 //-----------------------------------------------------------------------------
711
712 'negate': function(aPointA) {
713 var result;
714
715 result = new Clipperz.Crypto.ECC.Point({x:aPointA.x(), y:this.finiteField().add(aPointA.y(), aPointA.x())})
716
717 return result;
718 },
719
720 //-----------------------------------------------------------------------------
721
722 'add': function(aPointA, aPointB) {
723 var result;
724
725//console.log(">>> ECC.BinaryField.Curve.add");
726 if (aPointA.isZero()) {
727//console.log("--- pointA == zero");
728 result = aPointB;
729 } else if (aPointB.isZero()) {
730//console.log("--- pointB == zero");
731 result = aPointA;
732 } else if ((aPointA.x().compare(aPointB.x()) == 0) &&
733 ((aPointA.y().compare(aPointB.y()) != 0) || aPointB.x().isZero()))
734 {
735//console.log("compare A.x - B.x: ", aPointA.x().compare(aPointB.x()));
736//console.log("compare A.y - B.y: ", (aPointA.y().compare(aPointB.y()) != 0));
737//console.log("compare B.x.isZero(): ", aPointB.x().isZero());
738
739//console.log("--- result = zero");
740 result = new Clipperz.Crypto.ECC.BinaryField.Point({x:Clipperz.Crypto.ECC.BinaryField.Value.O, y:Clipperz.Crypto.ECC.BinaryField.Value.O});
741 } else {
742//console.log("--- result = ELSE");
743 varf2m;
744 var x, y;
745 var lambda;
746
747 f2m = this.finiteField();
748
749 if (aPointA.x().compare(aPointB.x()) != 0) {
750//console.log(" a.x != b.x");
751 lambda =f2m.multiply(
752 f2m.add(aPointA.y(), aPointB.y()),
753 f2m.inverse(f2m.add(aPointA.x(), aPointB.x()))
754 );
755 x = f2m.add(this.a(), f2m.multiply(lambda, lambda));
756 x = f2m.add(x, lambda);
757 x = f2m.add(x, aPointA.x());
758 x = f2m.add(x, aPointB.x());
759 } else {
760//console.log(" a.x == b.x");
761 lambda = f2m.add(aPointB.x(), f2m.multiply(aPointB.y(), f2m.inverse(aPointB.x())));
762//console.log(" lambda: " + lambda.asString(16));
763 x = f2m.add(this.a(), f2m.multiply(lambda, lambda));
764//console.log(" x (step 1): " + x.asString(16));
765 x = f2m.add(x, lambda);
766//console.log(" x (step 2): " + x.asString(16));
767 }
768
769 y = f2m.multiply(f2m.add(aPointB.x(), x), lambda);
770//console.log(" y (step 1): " + y.asString(16));
771 y = f2m.add(y, x);
772//console.log(" y (step 2): " + y.asString(16));
773 y = f2m.add(y, aPointB.y());
774//console.log(" y (step 3): " + y.asString(16));
775
776 result = new Clipperz.Crypto.ECC.BinaryField.Point({x:x, y:y})
777 }
778//console.log("<<< ECC.BinaryField.Curve.add");
779
780 return result;
781 },
782
783 //-----------------------------------------------------------------------------
784
785 'multiply': function(aValue, aPoint) {
786 var result;
787
788console.profile();
789 result = new Clipperz.Crypto.ECC.BinaryField.Point({x:Clipperz.Crypto.ECC.BinaryField.Value.O, y:Clipperz.Crypto.ECC.BinaryField.Value.O});
790
791 if (aValue.isZero() == false) {
792 var k, Q;
793 var i;
794 var countIndex; countIndex = 0;
795
796 if (aValue.compare(Clipperz.Crypto.ECC.BinaryField.WordArrayValue.O) > 0) {
797 k = aValue;
798 Q = aPoint;
799 } else {
800MochiKit.Logging.logError("The Clipperz.Crypto.ECC.BinaryFields.Value does not work with negative values!!!!");
801 k = aValue.negate();
802 Q = this.negate(aPoint);
803 }
804
805//console.log("k: " + k.toString(16));
806//console.log("k.bitSize: " + k.bitSize());
807 for (i=k.bitSize()-1; i>=0; i--) {
808 result = this.add(result, result);
809 if (k.isBitSet(i)) {
810 result = this.add(result, Q);
811 }
812
813 // if (countIndex==100) {console.log("multiply.break"); break;} else countIndex++;
814 }
815 }
816console.profileEnd();
817
818 return result;
819 },
820
821 //-----------------------------------------------------------------------------
822 __syntaxFix__: "syntax fix"
823});
824
825//#############################################################################
826
827//#############################################################################
828/ *
829Clipperz.Crypto.ECC.Key = function(args) {
830 args = args || {};
831
832 return this;
833}
834
835Clipperz.Crypto.ECC.Key.prototype = MochiKit.Base.update(null, {
836
837 'asString': function() {
838 return "Clipperz.Crypto.ECC.Key";
839 },
840
841 //-----------------------------------------------------------------------------
842 __syntaxFix__: "syntax fix"
843});
844* /
845//#############################################################################
846
847
848//#############################################################################
849
850Clipperz.Crypto.ECC.StandardCurves = {};
851
852MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, {
853/ *
854 '_K571': null,
855 'K571': function() {
856 if (Clipperz.Crypto.ECC.StandardCurves._K571 == null) {
857 Clipperz.Crypto.ECC.StandardCurves._K571 = new Clipperz.Crypto.ECC.Curve.Koblitz({
858 exadecimalForm: '80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425',
859 a: new Clipperz.Crypto.BigInt(0),
860 G: new Clipperz.Crypto.ECC.Point({
861 x: new Clipperz.Crypto.BigInt('26eb7a859923fbc82189631f8103fe4ac9ca2970012d5d46024804801841ca44370958493b205e647da304db4ceb08cbbd1ba39494776fb988b47174dca88c7e2945283a01c8972', 16),
862 y: new Clipperz.Crypto.BigInt('349dc807f4fbf374f4aeade3bca95314dd58cec9f307a54ffc61efc006d8a2c9d4979c0ac44aea74fbebbb9f772aedcb620b01a7ba7af1b320430c8591984f601cd4c143ef1c7a3', 16)
863 }),
864 n: new Clipperz.Crypto.BigInt('1932268761508629172347675945465993672149463664853217499328617625725759571144780212268133978522706711834706712800825351461273674974066617311929682421617092503555733685276673', 16),
865 h: new Clipperz.Crypto.BigInt(4)
866 });
867 }
868
869 return Clipperz.Crypto.ECC.StandardCurves._K571;
870 },
871* /
872 //-----------------------------------------------------------------------------
873
874 '_B571': null,
875 'B571': function() { //f(z) = z^571 + z^10 + z^5 + z^2 + 1
876 if (Clipperz.Crypto.ECC.StandardCurves._B571 == null) {
877 Clipperz.Crypto.ECC.StandardCurves._B571 = new Clipperz.Crypto.ECC.BinaryField.Curve({
878 modulus: new Clipperz.Crypto.ECC.BinaryField.Value('80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425', 16),
879 a: new Clipperz.Crypto.ECC.BinaryField.Value('1', 16),
880 b: new Clipperz.Crypto.ECC.BinaryField.Value('02f40e7e2221f295de297117b7f3d62f5c6a97ffcb8ceff1cd6ba8ce4a9a18ad84ffabbd8efa59332be7ad6756a66e294afd185a78ff12aa520e4de739baca0c7ffeff7f2955727a', 16),
881 G: new Clipperz.Crypto.ECC.BinaryField.Point({
882 x: new Clipperz.Crypto.ECC.BinaryField.Value('0303001d34b856296c16c0d40d3cd7750a93d1d2955fa80aa5f40fc8db7b2abdbde53950f4c0d293cdd711a35b67fb1499ae60038614f1394abfa3b4c850d927e1e7769c8eec2d19', 16),
883 y: new Clipperz.Crypto.ECC.BinaryField.Value('037bf27342da639b6dccfffeb73d69d78c6c27a6009cbbca1980f8533921e8a684423e43bab08a576291af8f461bb2a8b3531d2f0485c19b16e2f1516e23dd3c1a4827af1b8ac15b', 16)
884 }),
885 // r: new Clipperz.Crypto.ECC.BinaryField.Value('3864537523017258344695351890931987344298927329706434998657235251451519142289560424536143999389415773083133881121926944486246872462816813070234528288303332411393191105285703', 10),
886 r: new Clipperz.Crypto.ECC.BinaryField.Value('03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe661ce18ff55987308059b186823851ec7dd9ca1161de93d5174d66e8382e9bb2fe84e47', 16),
887 h: new Clipperz.Crypto.ECC.BinaryField.Value('2', 16)
888
889 // S: new Clipperz.Crypto.ECC.BinaryField.Value('2aa058f73a0e33ab486b0f610410c53a7f132310', 10),
890 // n: new Clipperz.Crypto.ECC.BinaryField.Value('03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe661ce18ff55987308059b186823851ec7dd9ca1161de93d5174d66e8382e9bb2fe84e47', 16),
891 });
892
893 //-----------------------------------------------------------------------------
894 //
895 //Guide to Elliptic Curve Cryptography
896 //Darrel Hankerson, Alfred Menezes, Scott Vanstone
897 //- Pag: 56, Alorithm 2.45 (with a typo!!!)
898 //
899 //-----------------------------------------------------------------------------
900 //
901 // http://www.milw0rm.com/papers/136
902 //
903 // -------------------------------------------------------------------------
904 // Polynomial Reduction Algorithm Modulo f571
905 // -------------------------------------------------------------------------
906 //
907 // Input: Polynomial p(x) of degree 1140 or less, stored as
908 // an array of 2T machinewords.
909 // Output: p(x) mod f571(x)
910 //
911 // FOR i = T-1, ..., 0 DO
912 // SET X := P[i+T]
913 // P[i] := P[i] ^ (X<<5) ^ (X<<7) ^ (X<<10) ^ (X<<15)
914 // P[i+1] := P[i+1] ^ (X>>17) ^ (X>>22) ^ (X>>25) ^ (X>>27)
915 //
916 // SET X := P[T-1] >> 27
917 // P[0] := P[0] ^ X ^ (X<<2) ^ (X<<5) ^ (X<<10)
918 // P[T-1] := P[T-1] & 0x07ffffff
919 //
920 // RETURN P[T-1],...,P[0]
921 //
922 // -------------------------------------------------------------------------
923 //
924 Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module = function(aValue) {
925 varresult;
926 varC, T;
927 var i;
928
929//console.log(">>> binaryField.finiteField.(improved)module");
930 // C = aValue.value().slice(0);
931 C = aValue._value.slice(0);
932 for (i=35; i>=18; i--) {
933 T = C[i];
934 C[i-18] = (((C[i-18] ^ (T<<5) ^ (T<<7) ^ (T<<10) ^ (T<<15)) & 0xffffffff) >>> 0);
935 C[i-17] = ((C[i-17] ^ (T>>>27) ^ (T>>>25) ^ (T>>>22) ^ (T>>>17)) >>> 0);
936 }
937 T = (C[17] >>> 27);
938 C[0] = ((C[0] ^ T ^ ((T<<2) ^ (T<<5) ^ (T<<10)) & 0xffffffff) >>> 0);
939 C[17] = (C[17] & 0x07ffffff);
940
941 for(i=18; i<=35; i++) {
942 C[i] = 0;
943 }
944
945 result = new Clipperz.Crypto.ECC.BinaryField.WordArrayValue(C);
946//console.log("<<< binaryField.finiteField.(improved)module");
947
948 return result;
949 };
950 }
951
952 return Clipperz.Crypto.ECC.StandardCurves._B571;
953 },
954
955 //-----------------------------------------------------------------------------
956 __syntaxFix__: "syntax fix"
957});
958
959//#############################################################################
960*/
diff --git a/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Curve.js b/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Curve.js
new file mode 100644
index 0000000..042ca6c
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Curve.js
@@ -0,0 +1,461 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!";
31}
32if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; }
33if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; }
34
35Clipperz.Crypto.ECC.BinaryField.Curve = function(args) {
36 args = args || {};
37
38 this._modulus = args.modulus;
39
40 this._a = args.a;
41 this._b = args.b;
42 this._G = args.G;
43 this._r = args.r;
44 this._h = args.h;
45
46 this._finiteField = null;
47
48 return this;
49}
50
51Clipperz.Crypto.ECC.BinaryField.Curve.prototype = MochiKit.Base.update(null, {
52
53 'asString': function() {
54 return "Clipperz.Crypto.ECC.BinaryField.Curve";
55 },
56
57 //-----------------------------------------------------------------------------
58
59 'modulus': function() {
60 return this._modulus;
61 },
62
63 'a': function() {
64 return this._a;
65 },
66
67 'b': function() {
68 return this._b;
69 },
70
71 'G': function() {
72 return this._G;
73 },
74
75 'r': function() {
76 return this._r;
77 },
78
79 'h': function() {
80 return this._h;
81 },
82
83 //-----------------------------------------------------------------------------
84
85 'finiteField': function() {
86 if (this._finiteField == null) {
87 this._finiteField = new Clipperz.Crypto.ECC.BinaryField.FiniteField({modulus:this.modulus()})
88 }
89
90 return this._finiteField;
91 },
92
93 //-----------------------------------------------------------------------------
94
95 'negate': function(aPointA) {
96 var result;
97
98 result = new Clipperz.Crypto.ECC.Point({x:aPointA.x(), y:this.finiteField().add(aPointA.y(), aPointA.x())})
99
100 return result;
101 },
102
103 //-----------------------------------------------------------------------------
104
105 'add': function(aPointA, aPointB) {
106 var result;
107
108//console.log(">>> ECC.BinaryField.Curve.add");
109 if (aPointA.isZero()) {
110//console.log("--- pointA == zero");
111 result = aPointB;
112 } else if (aPointB.isZero()) {
113//console.log("--- pointB == zero");
114 result = aPointA;
115 } else if ((aPointA.x().compare(aPointB.x()) == 0) && ((aPointA.y().compare(aPointB.y()) != 0) || aPointB.x().isZero())) {
116//console.log("compare A.x - B.x: ", aPointA.x().compare(aPointB.x()));
117//console.log("compare A.y - B.y: ", (aPointA.y().compare(aPointB.y()) != 0));
118//console.log("compare B.x.isZero(): ", aPointB.x().isZero());
119
120//console.log("--- result = zero");
121 result = new Clipperz.Crypto.ECC.BinaryField.Point({x:Clipperz.Crypto.ECC.BinaryField.Value.O, y:Clipperz.Crypto.ECC.BinaryField.Value.O});
122 } else {
123//console.log("--- result = ELSE");
124 varf2m;
125 var x, y;
126 var lambda;
127 var aX, aY, bX, bY;
128
129 aX = aPointA.x()._value;
130 aY = aPointA.y()._value;
131 bX = aPointB.x()._value;
132 bY = aPointB.y()._value;
133
134 f2m = this.finiteField();
135
136 if (aPointA.x().compare(aPointB.x()) != 0) {
137//console.log(" a.x != b.x");
138 lambda =f2m._fastMultiply(
139 f2m._add(aY, bY),
140 f2m._inverse(f2m._add(aX, bX))
141 );
142 x = f2m._add(this.a()._value, f2m._square(lambda));
143 f2m._overwriteAdd(x, lambda);
144 f2m._overwriteAdd(x, aX);
145 f2m._overwriteAdd(x, bX);
146 } else {
147//console.log(" a.x == b.x");
148 lambda = f2m._add(bX, f2m._fastMultiply(bY, f2m._inverse(bX)));
149//console.log(" lambda: " + lambda.asString(16));
150 x = f2m._add(this.a()._value, f2m._square(lambda));
151//console.log(" x (step 1): " + x.asString(16));
152 f2m._overwriteAdd(x, lambda);
153//console.log(" x (step 2): " + x.asString(16));
154 }
155
156 y = f2m._fastMultiply(f2m._add(bX, x), lambda);
157//console.log(" y (step 1): " + y.asString(16));
158 f2m._overwriteAdd(y, x);
159//console.log(" y (step 2): " + y.asString(16));
160 f2m._overwriteAdd(y, bY);
161//console.log(" y (step 3): " + y.asString(16));
162
163 result = new Clipperz.Crypto.ECC.BinaryField.Point({x:new Clipperz.Crypto.ECC.BinaryField.Value(x), y:new Clipperz.Crypto.ECC.BinaryField.Value(y)})
164 }
165//console.log("<<< ECC.BinaryField.Curve.add");
166
167 return result;
168 },
169
170 //-----------------------------------------------------------------------------
171
172 'overwriteAdd': function(aPointA, aPointB) {
173 if (aPointA.isZero()) {
174 // result = aPointB;
175 aPointA._x._value = aPointB._x._value;
176 aPointA._y._value = aPointB._y._value;
177 } else if (aPointB.isZero()) {
178 // result = aPointA;
179 } else if ((aPointA.x().compare(aPointB.x()) == 0) && ((aPointA.y().compare(aPointB.y()) != 0) || aPointB.x().isZero())) {
180 // result = new Clipperz.Crypto.ECC.BinaryField.Point({x:Clipperz.Crypto.ECC.BinaryField.Value.O, y:Clipperz.Crypto.ECC.BinaryField.Value.O});
181 aPointA._x = Clipperz.Crypto.ECC.BinaryField.Value.O;
182 aPointA._y = Clipperz.Crypto.ECC.BinaryField.Value.O;
183 } else {
184 varf2m;
185 var x, y;
186 var lambda;
187 var aX, aY, bX, bY;
188
189 aX = aPointA.x()._value;
190 aY = aPointA.y()._value;
191 bX = aPointB.x()._value;
192 bY = aPointB.y()._value;
193
194 f2m = this.finiteField();
195
196 if (aPointA.x().compare(aPointB.x()) != 0) {
197//console.log(" a.x != b.x");
198 lambda =f2m._fastMultiply(
199 f2m._add(aY, bY),
200 f2m._inverse(f2m._add(aX, bX))
201 );
202 x = f2m._add(this.a()._value, f2m._square(lambda));
203 f2m._overwriteAdd(x, lambda);
204 f2m._overwriteAdd(x, aX);
205 f2m._overwriteAdd(x, bX);
206 } else {
207//console.log(" a.x == b.x");
208 lambda = f2m._add(bX, f2m._fastMultiply(bY, f2m._inverse(bX)));
209//console.log(" lambda: " + lambda.asString(16));
210 x = f2m._add(this.a()._value, f2m._square(lambda));
211//console.log(" x (step 1): " + x.asString(16));
212 f2m._overwriteAdd(x, lambda);
213//console.log(" x (step 2): " + x.asString(16));
214 }
215
216 y = f2m._fastMultiply(f2m._add(bX, x), lambda);
217//console.log(" y (step 1): " + y.asString(16));
218 f2m._overwriteAdd(y, x);
219//console.log(" y (step 2): " + y.asString(16));
220 f2m._overwriteAdd(y, bY);
221//console.log(" y (step 3): " + y.asString(16));
222
223 // result = new Clipperz.Crypto.ECC.BinaryField.Point({x:new Clipperz.Crypto.ECC.BinaryField.Value(x), y:new Clipperz.Crypto.ECC.BinaryField.Value(y)})
224 aPointA._x._value = x;
225 aPointA._y._value = y;
226
227 }
228//console.log("<<< ECC.BinaryField.Curve.add");
229
230 return result;
231 },
232
233 //-----------------------------------------------------------------------------
234
235 'multiply': function(aValue, aPoint) {
236 var result;
237
238//console.profile();
239 result = new Clipperz.Crypto.ECC.BinaryField.Point({x:Clipperz.Crypto.ECC.BinaryField.Value.O, y:Clipperz.Crypto.ECC.BinaryField.Value.O});
240
241 if (aValue.isZero() == false) {
242 var k, Q;
243 var i;
244 var countIndex; countIndex = 0;
245
246 if (aValue.compare(Clipperz.Crypto.ECC.BinaryField.Value.O) > 0) {
247 k = aValue;
248 Q = aPoint;
249 } else {
250MochiKit.Logging.logError("The Clipperz.Crypto.ECC.BinaryFields.Value does not work with negative values!!!!");
251 k = aValue.negate();
252 Q = this.negate(aPoint);
253 }
254
255//console.log("k: " + k.toString(16));
256//console.log("k.bitSize: " + k.bitSize());
257 for (i=k.bitSize()-1; i>=0; i--) {
258 result = this.add(result, result);
259 // this.overwriteAdd(result, result);
260 if (k.isBitSet(i)) {
261 result = this.add(result, Q);
262 // this.overwriteAdd(result, Q);
263 }
264
265 // if (countIndex==100) {console.log("multiply.break"); break;} else countIndex++;
266 }
267 }
268//console.profileEnd();
269
270 return result;
271 },
272
273 //-----------------------------------------------------------------------------
274 __syntaxFix__: "syntax fix"
275});
276
277
278//#############################################################################
279
280Clipperz.Crypto.ECC.StandardCurves = {};
281
282MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, {
283/*
284 '_K571': null,
285 'K571': function() {
286 if (Clipperz.Crypto.ECC.StandardCurves._K571 == null) {
287 Clipperz.Crypto.ECC.StandardCurves._K571 = new Clipperz.Crypto.ECC.Curve.Koblitz({
288 exadecimalForm: '80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425',
289 a: new Clipperz.Crypto.BigInt(0),
290 G: new Clipperz.Crypto.ECC.Point({
291 x: new Clipperz.Crypto.BigInt('26eb7a859923fbc82189631f8103fe4ac9ca2970012d5d46024804801841ca44370958493b205e647da304db4ceb08cbbd1ba39494776fb988b47174dca88c7e2945283a01c8972', 16),
292 y: new Clipperz.Crypto.BigInt('349dc807f4fbf374f4aeade3bca95314dd58cec9f307a54ffc61efc006d8a2c9d4979c0ac44aea74fbebbb9f772aedcb620b01a7ba7af1b320430c8591984f601cd4c143ef1c7a3', 16)
293 }),
294 n: new Clipperz.Crypto.BigInt('1932268761508629172347675945465993672149463664853217499328617625725759571144780212268133978522706711834706712800825351461273674974066617311929682421617092503555733685276673', 16),
295 h: new Clipperz.Crypto.BigInt(4)
296 });
297 }
298
299 return Clipperz.Crypto.ECC.StandardCurves._K571;
300 },
301*/
302 //-----------------------------------------------------------------------------
303
304 '_B571': null,
305 'B571': function() { //f(z) = z^571 + z^10 + z^5 + z^2 + 1
306 if (Clipperz.Crypto.ECC.StandardCurves._B571 == null) {
307 Clipperz.Crypto.ECC.StandardCurves._B571 = new Clipperz.Crypto.ECC.BinaryField.Curve({
308 modulus: new Clipperz.Crypto.ECC.BinaryField.Value('80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425', 16),
309 a: new Clipperz.Crypto.ECC.BinaryField.Value('1', 16),
310 b: new Clipperz.Crypto.ECC.BinaryField.Value('02f40e7e2221f295de297117b7f3d62f5c6a97ffcb8ceff1cd6ba8ce4a9a18ad84ffabbd8efa59332be7ad6756a66e294afd185a78ff12aa520e4de739baca0c7ffeff7f2955727a', 16),
311 G: new Clipperz.Crypto.ECC.BinaryField.Point({
312 x: new Clipperz.Crypto.ECC.BinaryField.Value('0303001d 34b85629 6c16c0d4 0d3cd775 0a93d1d2 955fa80a a5f40fc8 db7b2abd bde53950 f4c0d293 cdd711a3 5b67fb14 99ae6003 8614f139 4abfa3b4 c850d927 e1e7769c 8eec2d19', 16),
313 y: new Clipperz.Crypto.ECC.BinaryField.Value('037bf273 42da639b 6dccfffe b73d69d7 8c6c27a6 009cbbca 1980f853 3921e8a6 84423e43 bab08a57 6291af8f 461bb2a8 b3531d2f 0485c19b 16e2f151 6e23dd3c 1a4827af 1b8ac15b', 16)
314 }),
315 r: new Clipperz.Crypto.ECC.BinaryField.Value('03ffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff e661ce18 ff559873 08059b18 6823851e c7dd9ca1 161de93d 5174d66e 8382e9bb 2fe84e47', 16),
316 h: new Clipperz.Crypto.ECC.BinaryField.Value('2', 16)
317
318 // S: new Clipperz.Crypto.ECC.BinaryField.Value('2aa058f73a0e33ab486b0f610410c53a7f132310', 10),
319 // n: new Clipperz.Crypto.ECC.BinaryField.Value('03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe661ce18ff55987308059b186823851ec7dd9ca1161de93d5174d66e8382e9bb2fe84e47', 16),
320 });
321
322 //-----------------------------------------------------------------------------
323 //
324 //Guide to Elliptic Curve Cryptography
325 //Darrel Hankerson, Alfred Menezes, Scott Vanstone
326 //- Pag: 56, Alorithm 2.45 (with a typo!!!)
327 //
328 //-----------------------------------------------------------------------------
329 //
330 // http://www.milw0rm.com/papers/136
331 //
332 // -------------------------------------------------------------------------
333 // Polynomial Reduction Algorithm Modulo f571
334 // -------------------------------------------------------------------------
335 //
336 // Input: Polynomial p(x) of degree 1140 or less, stored as
337 // an array of 2T machinewords.
338 // Output: p(x) mod f571(x)
339 //
340 // FOR i = T-1, ..., 0 DO
341 // SET X := P[i+T]
342 // P[i] := P[i] ^ (X<<5) ^ (X<<7) ^ (X<<10) ^ (X<<15)
343 // P[i+1] := P[i+1] ^ (X>>17) ^ (X>>22) ^ (X>>25) ^ (X>>27)
344 //
345 // SET X := P[T-1] >> 27
346 // P[0] := P[0] ^ X ^ (X<<2) ^ (X<<5) ^ (X<<10)
347 // P[T-1] := P[T-1] & 0x07ffffff
348 //
349 // RETURN P[T-1],...,P[0]
350 //
351 // -------------------------------------------------------------------------
352 //
353 Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module;
354 Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module = function(aValue) {
355 varresult;
356
357 if (aValue.bitSize() > 1140) {
358 MochiKit.Logging.logWarning("ECC.StandarCurves.B571.finiteField().module: falling back to default implementation");
359 result = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule(aValue);
360 } else {
361 varC, T;
362 var i;
363
364//console.log(">>> binaryField.finiteField.(improved)module");
365 // C = aValue.value().slice(0);
366 C = aValue._value.slice(0);
367 for (i=35; i>=18; i--) {
368 T = C[i];
369 C[i-18] = (((C[i-18] ^ (T<<5) ^ (T<<7) ^ (T<<10) ^ (T<<15)) & 0xffffffff) >>> 0);
370 C[i-17] = ((C[i-17] ^ (T>>>27) ^ (T>>>25) ^ (T>>>22) ^ (T>>>17)) >>> 0);
371 }
372 T = (C[17] >>> 27);
373 C[0] = ((C[0] ^ T ^ ((T<<2) ^ (T<<5) ^ (T<<10)) & 0xffffffff) >>> 0);
374 C[17] = (C[17] & 0x07ffffff);
375
376 for(i=18; i<=35; i++) {
377 C[i] = 0;
378 }
379
380 result = new Clipperz.Crypto.ECC.BinaryField.Value(C);
381//console.log("<<< binaryField.finiteField.(improved)module");
382 }
383
384 return result;
385 };
386 }
387
388 return Clipperz.Crypto.ECC.StandardCurves._B571;
389 },
390
391 //-----------------------------------------------------------------------------
392
393 '_B283': null,
394 'B283': function() { //f(z) = z^283 + z^12 + z^7 + z^5 + 1
395 if (Clipperz.Crypto.ECC.StandardCurves._B283 == null) {
396 Clipperz.Crypto.ECC.StandardCurves._B283 = new Clipperz.Crypto.ECC.BinaryField.Curve({
397 // modulus: new Clipperz.Crypto.ECC.BinaryField.Value('10000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000010a1', 16),
398 modulus: new Clipperz.Crypto.ECC.BinaryField.Value('08000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000010a1', 16),
399 a: new Clipperz.Crypto.ECC.BinaryField.Value('1', 16),
400 b: new Clipperz.Crypto.ECC.BinaryField.Value('027b680a c8b8596d a5a4af8a 19a0303f ca97fd76 45309fa2 a581485a f6263e31 3b79a2f5', 16),
401 G: new Clipperz.Crypto.ECC.BinaryField.Point({
402 x: new Clipperz.Crypto.ECC.BinaryField.Value('05f93925 8db7dd90 e1934f8c 70b0dfec 2eed25b8 557eac9c 80e2e198 f8cdbecd 86b12053', 16),
403 y: new Clipperz.Crypto.ECC.BinaryField.Value('03676854 fe24141c b98fe6d4 b20d02b4 516ff702 350eddb0 826779c8 13f0df45 be8112f4', 16)
404 }),
405 r: new Clipperz.Crypto.ECC.BinaryField.Value('03ffffff ffffffff ffffffff ffffffff ffffef90 399660fc 938a9016 5b042a7c efadb307', 16),
406 h: new Clipperz.Crypto.ECC.BinaryField.Value('2', 16)
407
408 // S: new Clipperz.Crypto.ECC.BinaryField.Value('2aa058f73a0e33ab486b0f610410c53a7f132310', 10),
409 // n: new Clipperz.Crypto.ECC.BinaryField.Value('03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe661ce18ff55987308059b186823851ec7dd9ca1161de93d5174d66e8382e9bb2fe84e47', 16),
410 });
411
412 //-----------------------------------------------------------------------------
413 //
414 //Guide to Elliptic Curve Cryptography
415 //Darrel Hankerson, Alfred Menezes, Scott Vanstone
416 //- Pag: 56, Alorithm 2.43
417 //
418 //-----------------------------------------------------------------------------
419 Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module;
420 Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module = function(aValue) {
421 varresult;
422
423 if (aValue.bitSize() > 564) {
424 MochiKit.Logging.logWarning("ECC.StandarCurves.B283.finiteField().module: falling back to default implementation");
425 result = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule(aValue);
426 } else {
427 varC, T;
428 var i;
429
430//console.log(">>> binaryField.finiteField.(improved)module");
431 C = aValue._value.slice(0);
432 for (i=17; i>=9; i--) {
433 T = C[i];
434 C[i-9] = (((C[i-9] ^ (T<<5) ^ (T<<10) ^ (T<<12) ^ (T<<17)) & 0xffffffff) >>> 0);
435 C[i-8] = ((C[i-8] ^ (T>>>27) ^ (T>>>22) ^ (T>>>20) ^ (T>>>15)) >>> 0);
436 }
437 T = (C[8] >>> 27);
438 C[0] = ((C[0] ^ T ^ ((T<<5) ^ (T<<7) ^ (T<<12)) & 0xffffffff) >>> 0);
439 C[8] = (C[8] & 0x07ffffff);
440
441 for(i=9; i<=17; i++) {
442 C[i] = 0;
443 }
444
445 result = new Clipperz.Crypto.ECC.BinaryField.Value(C);
446//console.log("<<< binaryField.finiteField.(improved)module");
447 }
448
449 return result;
450 };
451 }
452
453 return Clipperz.Crypto.ECC.StandardCurves._B283;
454 },
455
456 //-----------------------------------------------------------------------------
457 __syntaxFix__: "syntax fix"
458});
459
460//#############################################################################
461
diff --git a/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js b/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js
new file mode 100644
index 0000000..3ddf2ec
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js
@@ -0,0 +1,526 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!";
31}
32if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; }
33if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; }
34
35Clipperz.Crypto.ECC.BinaryField.FiniteField = function(args) {
36 args = args || {};
37 this._modulus = args.modulus;
38
39 return this;
40}
41
42Clipperz.Crypto.ECC.BinaryField.FiniteField.prototype = MochiKit.Base.update(null, {
43
44 'asString': function() {
45 return "Clipperz.Crypto.ECC.BinaryField.FiniteField (" + this.modulus().asString() + ")";
46 },
47
48 //-----------------------------------------------------------------------------
49
50 'modulus': function() {
51 return this._modulus;
52 },
53
54 //-----------------------------------------------------------------------------
55
56 '_module': function(aValue) {
57 varresult;
58 var modulusComparison;
59//console.log(">>> binaryField.finiteField.(standard)module");
60
61 modulusComparison = Clipperz.Crypto.ECC.BinaryField.Value._compare(aValue, this.modulus()._value);
62
63 if (modulusComparison < 0) {
64 result = aValue;
65 } else if (modulusComparison == 0) {
66 result = [0];
67 } else {
68 var modulusBitSize;
69 var resultBitSize;
70
71 result = aValue;
72
73 modulusBitSize = this.modulus().bitSize();
74 resultBitSize = Clipperz.Crypto.ECC.BinaryField.Value._bitSize(result);
75 while (resultBitSize >= modulusBitSize) {
76 Clipperz.Crypto.ECC.BinaryField.Value._overwriteXor(result, Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft(this.modulus()._value, resultBitSize - modulusBitSize));
77 resultBitSize = Clipperz.Crypto.ECC.BinaryField.Value._bitSize(result);
78 }
79 }
80//console.log("<<< binaryField.finiteField.(standard)module");
81
82 return result;
83 },
84
85 'module': function(aValue) {
86 return new Clipperz.Crypto.ECC.BinaryField.Value(this._module(aValue._value.slice(0)));
87 },
88
89 //-----------------------------------------------------------------------------
90
91 '_add': function(a, b) {
92 return Clipperz.Crypto.ECC.BinaryField.Value._xor(a, b);
93 },
94
95 '_overwriteAdd': function(a, b) {
96 Clipperz.Crypto.ECC.BinaryField.Value._overwriteXor(a, b);
97 },
98
99 'add': function(a, b) {
100 return new Clipperz.Crypto.ECC.BinaryField.Value(this._add(a._value, b._value));
101 },
102
103 //-----------------------------------------------------------------------------
104
105 'negate': function(aValue) {
106 return aValue.clone();
107 },
108
109 //-----------------------------------------------------------------------------
110
111 '_multiply': function(a, b) {
112 var result;
113 var valueToXor;
114 var i,c;
115
116 result = [0];
117 valueToXor = b;
118 c = Clipperz.Crypto.ECC.BinaryField.Value._bitSize(a);
119 for (i=0; i<c; i++) {
120 if (Clipperz.Crypto.ECC.BinaryField.Value._isBitSet(a, i) === true) {
121 Clipperz.Crypto.ECC.BinaryField.Value._overwriteXor(result, valueToXor);
122 }
123 valueToXor = Clipperz.Crypto.ECC.BinaryField.Value._overwriteShiftLeft(valueToXor, 1);
124 }
125 result = this._module(result);
126
127 return result;
128 },
129
130 'multiply': function(a, b) {
131 return new Clipperz.Crypto.ECC.BinaryField.Value(this._multiply(a._value, b._value));
132 },
133
134 //-----------------------------------------------------------------------------
135
136 '_fastMultiply': function(a, b) {
137 var result;
138 var B;
139 var i,c;
140
141 result = [0];
142 B = b.slice(0); //Is this array copy avoidable?
143 c = 32;
144 for (i=0; i<c; i++) {
145 var ii, cc;
146
147 cc = a.length;
148 for (ii=0; ii<cc; ii++) {
149 if (((a[ii] >>> i) & 0x01) == 1) {
150 Clipperz.Crypto.ECC.BinaryField.Value._overwriteXor(result, B, ii);
151 }
152 }
153
154 if (i < (c-1)) {
155 B = Clipperz.Crypto.ECC.BinaryField.Value._overwriteShiftLeft(B, 1);
156 }
157 }
158 result = this._module(result);
159
160 return result;
161 },
162
163 'fastMultiply': function(a, b) {
164 return new Clipperz.Crypto.ECC.BinaryField.Value(this._fastMultiply(a._value, b._value));
165 },
166
167 //-----------------------------------------------------------------------------
168 //
169 //Guide to Elliptic Curve Cryptography
170 //Darrel Hankerson, Alfred Menezes, Scott Vanstone
171 //- Pag: 49, Alorithm 2.34
172 //
173 //-----------------------------------------------------------------------------
174
175 '_square': function(aValue) {
176 var result;
177 var value;
178 var c,i;
179 var precomputedValues;
180
181 value = aValue;
182 result = new Array(value.length * 2);
183 precomputedValues = Clipperz.Crypto.ECC.BinaryField.FiniteField.squarePrecomputedBytes;
184
185 c = value.length;
186 for (i=0; i<c; i++) {
187 result[i*2] = precomputedValues[(value[i] & 0x000000ff)];
188 result[i*2] |= ((precomputedValues[(value[i] & 0x0000ff00) >>> 8]) << 16);
189
190 result[i*2 + 1] = precomputedValues[(value[i] & 0x00ff0000) >>> 16];
191 result[i*2 + 1] |= ((precomputedValues[(value[i] & 0xff000000) >>> 24]) << 16);
192 }
193
194 return this._module(result);
195 },
196
197 'square': function(aValue) {
198 return new Clipperz.Crypto.ECC.BinaryField.Value(this._square(aValue._value));
199 },
200
201 //-----------------------------------------------------------------------------
202
203 '_inverse': function(aValue) {
204 varresult;
205 var b, c;
206 var u, v;
207
208 // b = Clipperz.Crypto.ECC.BinaryField.Value.I._value;
209 b = [1];
210 // c = Clipperz.Crypto.ECC.BinaryField.Value.O._value;
211 c = [0];
212 u = this._module(aValue);
213 v = this.modulus()._value.slice(0);
214
215 while (Clipperz.Crypto.ECC.BinaryField.Value._bitSize(u) > 1) {
216 varbitDifferenceSize;
217
218 bitDifferenceSize = Clipperz.Crypto.ECC.BinaryField.Value._bitSize(u) - Clipperz.Crypto.ECC.BinaryField.Value._bitSize(v);
219 if (bitDifferenceSize < 0) {
220 var swap;
221
222 swap = u;
223 u = v;
224 v = swap;
225
226 swap = c;
227 c = b;
228 b = swap;
229
230 bitDifferenceSize = -bitDifferenceSize;
231 }
232
233 u = this._add(u, Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft(v, bitDifferenceSize));
234 b = this._add(b, Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft(c, bitDifferenceSize));
235 // this._overwriteAdd(u, Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft(v, bitDifferenceSize));
236 // this._overwriteAdd(b, Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft(c, bitDifferenceSize));
237 }
238
239 result = this._module(b);
240
241 return result;
242 },
243
244 'inverse': function(aValue) {
245 return new Clipperz.Crypto.ECC.BinaryField.Value(this._inverse(aValue._value));
246 },
247
248 //-----------------------------------------------------------------------------
249 __syntaxFix__: "syntax fix"
250});
251
252
253Clipperz.Crypto.ECC.BinaryField.FiniteField.squarePrecomputedBytes = [
254 0x0000, // 0 = 0000 0000 -> 0000 0000 0000 0000
255 0x0001, // 1 = 0000 0001 -> 0000 0000 0000 0001
256 0x0004, // 2 = 0000 0010 -> 0000 0000 0000 0100
257 0x0005, // 3 = 0000 0011 -> 0000 0000 0000 0101
258 0x0010, // 4 = 0000 0100 -> 0000 0000 0001 0000
259 0x0011, // 5 = 0000 0101 -> 0000 0000 0001 0001
260 0x0014, // 6 = 0000 0110 -> 0000 0000 0001 0100
261 0x0015, // 7 = 0000 0111 -> 0000 0000 0001 0101
262 0x0040, // 8 = 0000 1000 -> 0000 0000 0100 0000
263 0x0041, // 9 = 0000 1001 -> 0000 0000 0100 0001
264 0x0044, // 10 = 0000 1010 -> 0000 0000 0100 0100
265 0x0045, // 11 = 0000 1011 -> 0000 0000 0100 0101
266 0x0050, // 12 = 0000 1100 -> 0000 0000 0101 0000
267 0x0051, // 13 = 0000 1101 -> 0000 0000 0101 0001
268 0x0054, // 14 = 0000 1110 -> 0000 0000 0101 0100
269 0x0055, // 15 = 0000 1111 -> 0000 0000 0101 0101
270
271 0x0100, // 16 = 0001 0000 -> 0000 0001 0000 0000
272 0x0101, // 17 = 0001 0001 -> 0000 0001 0000 0001
273 0x0104, // 18 = 0001 0010 -> 0000 0001 0000 0100
274 0x0105, // 19 = 0001 0011 -> 0000 0001 0000 0101
275 0x0110, // 20 = 0001 0100 -> 0000 0001 0001 0000
276 0x0111, // 21 = 0001 0101 -> 0000 0001 0001 0001
277 0x0114, // 22 = 0001 0110 -> 0000 0001 0001 0100
278 0x0115, // 23 = 0001 0111 -> 0000 0001 0001 0101
279 0x0140, // 24 = 0001 1000 -> 0000 0001 0100 0000
280 0x0141, // 25 = 0001 1001 -> 0000 0001 0100 0001
281 0x0144, // 26 = 0001 1010 -> 0000 0001 0100 0100
282 0x0145, // 27 = 0001 1011 -> 0000 0001 0100 0101
283 0x0150, // 28 = 0001 1100 -> 0000 0001 0101 0000
284 0x0151, // 28 = 0001 1101 -> 0000 0001 0101 0001
285 0x0154, // 30 = 0001 1110 -> 0000 0001 0101 0100
286 0x0155, // 31 = 0001 1111 -> 0000 0001 0101 0101
287
288 0x0400, // 32 = 0010 0000 -> 0000 0100 0000 0000
289 0x0401, // 33 = 0010 0001 -> 0000 0100 0000 0001
290 0x0404, // 34 = 0010 0010 -> 0000 0100 0000 0100
291 0x0405, // 35 = 0010 0011 -> 0000 0100 0000 0101
292 0x0410, // 36 = 0010 0100 -> 0000 0100 0001 0000
293 0x0411, // 37 = 0010 0101 -> 0000 0100 0001 0001
294 0x0414, // 38 = 0010 0110 -> 0000 0100 0001 0100
295 0x0415, // 39 = 0010 0111 -> 0000 0100 0001 0101
296 0x0440, // 40 = 0010 1000 -> 0000 0100 0100 0000
297 0x0441, // 41 = 0010 1001 -> 0000 0100 0100 0001
298 0x0444, // 42 = 0010 1010 -> 0000 0100 0100 0100
299 0x0445, // 43 = 0010 1011 -> 0000 0100 0100 0101
300 0x0450, // 44 = 0010 1100 -> 0000 0100 0101 0000
301 0x0451, // 45 = 0010 1101 -> 0000 0100 0101 0001
302 0x0454, // 46 = 0010 1110 -> 0000 0100 0101 0100
303 0x0455, // 47 = 0010 1111 -> 0000 0100 0101 0101
304
305 0x0500, // 48 = 0011 0000 -> 0000 0101 0000 0000
306 0x0501, // 49 = 0011 0001 -> 0000 0101 0000 0001
307 0x0504, // 50 = 0011 0010 -> 0000 0101 0000 0100
308 0x0505, // 51 = 0011 0011 -> 0000 0101 0000 0101
309 0x0510, // 52 = 0011 0100 -> 0000 0101 0001 0000
310 0x0511, // 53 = 0011 0101 -> 0000 0101 0001 0001
311 0x0514, // 54 = 0011 0110 -> 0000 0101 0001 0100
312 0x0515, // 55 = 0011 0111 -> 0000 0101 0001 0101
313 0x0540, // 56 = 0011 1000 -> 0000 0101 0100 0000
314 0x0541, // 57 = 0011 1001 -> 0000 0101 0100 0001
315 0x0544, // 58 = 0011 1010 -> 0000 0101 0100 0100
316 0x0545, // 59 = 0011 1011 -> 0000 0101 0100 0101
317 0x0550, // 60 = 0011 1100 -> 0000 0101 0101 0000
318 0x0551, // 61 = 0011 1101 -> 0000 0101 0101 0001
319 0x0554, // 62 = 0011 1110 -> 0000 0101 0101 0100
320 0x0555, // 63 = 0011 1111 -> 0000 0101 0101 0101
321
322 0x1000, // 64 = 0100 0000 -> 0001 0000 0000 0000
323 0x1001, // 65 = 0100 0001 -> 0001 0000 0000 0001
324 0x1004, // 66 = 0100 0010 -> 0001 0000 0000 0100
325 0x1005, // 67 = 0100 0011 -> 0001 0000 0000 0101
326 0x1010, // 68 = 0100 0100 -> 0001 0000 0001 0000
327 0x1011, // 69 = 0100 0101 -> 0001 0000 0001 0001
328 0x1014, // 70 = 0100 0110 -> 0001 0000 0001 0100
329 0x1015, // 71 = 0100 0111 -> 0001 0000 0001 0101
330 0x1040, // 72 = 0100 1000 -> 0001 0000 0100 0000
331 0x1041, // 73 = 0100 1001 -> 0001 0000 0100 0001
332 0x1044, // 74 = 0100 1010 -> 0001 0000 0100 0100
333 0x1045, // 75 = 0100 1011 -> 0001 0000 0100 0101
334 0x1050, // 76 = 0100 1100 -> 0001 0000 0101 0000
335 0x1051, // 77 = 0100 1101 -> 0001 0000 0101 0001
336 0x1054, // 78 = 0100 1110 -> 0001 0000 0101 0100
337 0x1055, // 79 = 0100 1111 -> 0001 0000 0101 0101
338
339 0x1100, // 80 = 0101 0000 -> 0001 0001 0000 0000
340 0x1101, // 81 = 0101 0001 -> 0001 0001 0000 0001
341 0x1104, // 82 = 0101 0010 -> 0001 0001 0000 0100
342 0x1105, // 83 = 0101 0011 -> 0001 0001 0000 0101
343 0x1110, // 84 = 0101 0100 -> 0001 0001 0001 0000
344 0x1111, // 85 = 0101 0101 -> 0001 0001 0001 0001
345 0x1114, // 86 = 0101 0110 -> 0001 0001 0001 0100
346 0x1115, // 87 = 0101 0111 -> 0001 0001 0001 0101
347 0x1140, // 88 = 0101 1000 -> 0001 0001 0100 0000
348 0x1141, // 89 = 0101 1001 -> 0001 0001 0100 0001
349 0x1144, // 90 = 0101 1010 -> 0001 0001 0100 0100
350 0x1145, // 91 = 0101 1011 -> 0001 0001 0100 0101
351 0x1150, // 92 = 0101 1100 -> 0001 0001 0101 0000
352 0x1151, // 93 = 0101 1101 -> 0001 0001 0101 0001
353 0x1154, // 94 = 0101 1110 -> 0001 0001 0101 0100
354 0x1155, // 95 = 0101 1111 -> 0001 0001 0101 0101
355
356 0x1400, // 96 = 0110 0000 -> 0001 0100 0000 0000
357 0x1401, // 97 = 0110 0001 -> 0001 0100 0000 0001
358 0x1404, // 98 = 0110 0010 -> 0001 0100 0000 0100
359 0x1405, // 99 = 0110 0011 -> 0001 0100 0000 0101
360 0x1410, //100 = 0110 0100 -> 0001 0100 0001 0000
361 0x1411, //101 = 0110 0101 -> 0001 0100 0001 0001
362 0x1414, //102 = 0110 0110 -> 0001 0100 0001 0100
363 0x1415, //103 = 0110 0111 -> 0001 0100 0001 0101
364 0x1440, //104 = 0110 1000 -> 0001 0100 0100 0000
365 0x1441, //105 = 0110 1001 -> 0001 0100 0100 0001
366 0x1444, //106 = 0110 1010 -> 0001 0100 0100 0100
367 0x1445, //107 = 0110 1011 -> 0001 0100 0100 0101
368 0x1450, //108 = 0110 1100 -> 0001 0100 0101 0000
369 0x1451, //109 = 0110 1101 -> 0001 0100 0101 0001
370 0x1454, //110 = 0110 1110 -> 0001 0100 0101 0100
371 0x1455, //111 = 0110 1111 -> 0001 0100 0101 0101
372
373 0x1500, //112 = 0111 0000 -> 0001 0101 0000 0000
374 0x1501, //113 = 0111 0001 -> 0001 0101 0000 0001
375 0x1504, //114 = 0111 0010 -> 0001 0101 0000 0100
376 0x1505, //115 = 0111 0011 -> 0001 0101 0000 0101
377 0x1510, //116 = 0111 0100 -> 0001 0101 0001 0000
378 0x1511, //117 = 0111 0101 -> 0001 0101 0001 0001
379 0x1514, //118 = 0111 0110 -> 0001 0101 0001 0100
380 0x1515, //119 = 0111 0111 -> 0001 0101 0001 0101
381 0x1540, //120 = 0111 1000 -> 0001 0101 0100 0000
382 0x1541, //121 = 0111 1001 -> 0001 0101 0100 0001
383 0x1544, //122 = 0111 1010 -> 0001 0101 0100 0100
384 0x1545, //123 = 0111 1011 -> 0001 0101 0100 0101
385 0x1550, //124 = 0111 1100 -> 0001 0101 0101 0000
386 0x1551, //125 = 0111 1101 -> 0001 0101 0101 0001
387 0x1554, //126 = 0111 1110 -> 0001 0101 0101 0100
388 0x1555, //127 = 0111 1111 -> 0001 0101 0101 0101
389
390 0x4000, //128 = 1000 0000 -> 0100 0000 0000 0000
391 0x4001, //129 = 1000 0001 -> 0100 0000 0000 0001
392 0x4004, //130 = 1000 0010 -> 0100 0000 0000 0100
393 0x4005, //131 = 1000 0011 -> 0100 0000 0000 0101
394 0x4010, //132 = 1000 0100 -> 0100 0000 0001 0000
395 0x4011, //133 = 1000 0101 -> 0100 0000 0001 0001
396 0x4014, //134 = 1000 0110 -> 0100 0000 0001 0100
397 0x4015, //135 = 1000 0111 -> 0100 0000 0001 0101
398 0x4040, //136 = 1000 1000 -> 0100 0000 0100 0000
399 0x4041, //137 = 1000 1001 -> 0100 0000 0100 0001
400 0x4044, //138 = 1000 1010 -> 0100 0000 0100 0100
401 0x4045, //139 = 1000 1011 -> 0100 0000 0100 0101
402 0x4050, //140 = 1000 1100 -> 0100 0000 0101 0000
403 0x4051, //141 = 1000 1101 -> 0100 0000 0101 0001
404 0x4054, //142 = 1000 1110 -> 0100 0000 0101 0100
405 0x4055, //143 = 1000 1111 -> 0100 0000 0101 0101
406
407 0x4100, //144 = 1001 0000 -> 0100 0001 0000 0000
408 0x4101, //145 = 1001 0001 -> 0100 0001 0000 0001
409 0x4104, //146 = 1001 0010 -> 0100 0001 0000 0100
410 0x4105, //147 = 1001 0011 -> 0100 0001 0000 0101
411 0x4110, //148 = 1001 0100 -> 0100 0001 0001 0000
412 0x4111, //149 = 1001 0101 -> 0100 0001 0001 0001
413 0x4114, //150 = 1001 0110 -> 0100 0001 0001 0100
414 0x4115, //151 = 1001 0111 -> 0100 0001 0001 0101
415 0x4140, //152 = 1001 1000 -> 0100 0001 0100 0000
416 0x4141, //153 = 1001 1001 -> 0100 0001 0100 0001
417 0x4144, //154 = 1001 1010 -> 0100 0001 0100 0100
418 0x4145, //155 = 1001 1011 -> 0100 0001 0100 0101
419 0x4150, //156 = 1001 1100 -> 0100 0001 0101 0000
420 0x4151, //157 = 1001 1101 -> 0100 0001 0101 0001
421 0x4154, //158 = 1001 1110 -> 0100 0001 0101 0100
422 0x4155, //159 = 1001 1111 -> 0100 0001 0101 0101
423
424 0x4400, //160 = 1010 0000 -> 0100 0100 0000 0000
425 0x4401, //161 = 1010 0001 -> 0100 0100 0000 0001
426 0x4404, //162 = 1010 0010 -> 0100 0100 0000 0100
427 0x4405, //163 = 1010 0011 -> 0100 0100 0000 0101
428 0x4410, //164 = 1010 0100 -> 0100 0100 0001 0000
429 0x4411, //165 = 1010 0101 -> 0100 0100 0001 0001
430 0x4414, //166 = 1010 0110 -> 0100 0100 0001 0100
431 0x4415, //167 = 1010 0111 -> 0100 0100 0001 0101
432 0x4440, //168 = 1010 1000 -> 0100 0100 0100 0000
433 0x4441, //169 = 1010 1001 -> 0100 0100 0100 0001
434 0x4444, //170 = 1010 1010 -> 0100 0100 0100 0100
435 0x4445, //171 = 1010 1011 -> 0100 0100 0100 0101
436 0x4450, //172 = 1010 1100 -> 0100 0100 0101 0000
437 0x4451, //173 = 1010 1101 -> 0100 0100 0101 0001
438 0x4454, //174 = 1010 1110 -> 0100 0100 0101 0100
439 0x4455, //175 = 1010 1111 -> 0100 0100 0101 0101
440
441 0x4500, //176 = 1011 0000 -> 0100 0101 0000 0000
442 0x4501, //177 = 1011 0001 -> 0100 0101 0000 0001
443 0x4504, //178 = 1011 0010 -> 0100 0101 0000 0100
444 0x4505, //179 = 1011 0011 -> 0100 0101 0000 0101
445 0x4510, //180 = 1011 0100 -> 0100 0101 0001 0000
446 0x4511, //181 = 1011 0101 -> 0100 0101 0001 0001
447 0x4514, //182 = 1011 0110 -> 0100 0101 0001 0100
448 0x4515, //183 = 1011 0111 -> 0100 0101 0001 0101
449 0x4540, //184 = 1011 1000 -> 0100 0101 0100 0000
450 0x4541, //185 = 1011 1001 -> 0100 0101 0100 0001
451 0x4544, //186 = 1011 1010 -> 0100 0101 0100 0100
452 0x4545, //187 = 1011 1011 -> 0100 0101 0100 0101
453 0x4550, //188 = 1011 1100 -> 0100 0101 0101 0000
454 0x4551, //189 = 1011 1101 -> 0100 0101 0101 0001
455 0x4554, //190 = 1011 1110 -> 0100 0101 0101 0100
456 0x4555, //191 = 1011 1111 -> 0100 0101 0101 0101
457
458 0x5000, //192 = 1100 0000 -> 0101 0000 0000 0000
459 0x5001, //193 = 1100 0001 -> 0101 0000 0000 0001
460 0x5004, //194 = 1100 0010 -> 0101 0000 0000 0100
461 0x5005, //195 = 1100 0011 -> 0101 0000 0000 0101
462 0x5010, //196 = 1100 0100 -> 0101 0000 0001 0000
463 0x5011, //197 = 1100 0101 -> 0101 0000 0001 0001
464 0x5014, //198 = 1100 0110 -> 0101 0000 0001 0100
465 0x5015, //199 = 1100 0111 -> 0101 0000 0001 0101
466 0x5040, //200 = 1100 1000 -> 0101 0000 0100 0000
467 0x5041, //201 = 1100 1001 -> 0101 0000 0100 0001
468 0x5044, //202 = 1100 1010 -> 0101 0000 0100 0100
469 0x5045, //203 = 1100 1011 -> 0101 0000 0100 0101
470 0x5050, //204 = 1100 1100 -> 0101 0000 0101 0000
471 0x5051, //205 = 1100 1101 -> 0101 0000 0101 0001
472 0x5054, //206 = 1100 1110 -> 0101 0000 0101 0100
473 0x5055, //207 = 1100 1111 -> 0101 0000 0101 0101
474
475 0x5100, //208 = 1101 0000 -> 0101 0001 0000 0000
476 0x5101, //209 = 1101 0001 -> 0101 0001 0000 0001
477 0x5104, //210 = 1101 0010 -> 0101 0001 0000 0100
478 0x5105, //211 = 1101 0011 -> 0101 0001 0000 0101
479 0x5110, //212 = 1101 0100 -> 0101 0001 0001 0000
480 0x5111, //213 = 1101 0101 -> 0101 0001 0001 0001
481 0x5114, //214 = 1101 0110 -> 0101 0001 0001 0100
482 0x5115, //215 = 1101 0111 -> 0101 0001 0001 0101
483 0x5140, //216 = 1101 1000 -> 0101 0001 0100 0000
484 0x5141, //217 = 1101 1001 -> 0101 0001 0100 0001
485 0x5144, //218 = 1101 1010 -> 0101 0001 0100 0100
486 0x5145, //219 = 1101 1011 -> 0101 0001 0100 0101
487 0x5150, //220 = 1101 1100 -> 0101 0001 0101 0000
488 0x5151, //221 = 1101 1101 -> 0101 0001 0101 0001
489 0x5154, //222 = 1101 1110 -> 0101 0001 0101 0100
490 0x5155, //223 = 1101 1111 -> 0101 0001 0101 0101
491
492 0x5400, //224 = 1110 0000 -> 0101 0100 0000 0000
493 0x5401, //225 = 1110 0001 -> 0101 0100 0000 0001
494 0x5404, //226 = 1110 0010 -> 0101 0100 0000 0100
495 0x5405, //227 = 1110 0011 -> 0101 0100 0000 0101
496 0x5410, //228 = 1110 0100 -> 0101 0100 0001 0000
497 0x5411, //229 = 1110 0101 -> 0101 0100 0001 0001
498 0x5414, //230 = 1110 0110 -> 0101 0100 0001 0100
499 0x5415, //231 = 1110 0111 -> 0101 0100 0001 0101
500 0x5440, //232 = 1110 1000 -> 0101 0100 0100 0000
501 0x5441, //233 = 1110 1001 -> 0101 0100 0100 0001
502 0x5444, //234 = 1110 1010 -> 0101 0100 0100 0100
503 0x5445, //235 = 1110 1011 -> 0101 0100 0100 0101
504 0x5450, //236 = 1110 1100 -> 0101 0100 0101 0000
505 0x5451, //237 = 1110 1101 -> 0101 0100 0101 0001
506 0x5454, //238 = 1110 1110 -> 0101 0100 0101 0100
507 0x5455, //239 = 1110 1111 -> 0101 0100 0101 0101
508
509 0x5500, //240 = 1111 0000 -> 0101 0101 0000 0000
510 0x5501, //241 = 1111 0001 -> 0101 0101 0000 0001
511 0x5504, //242 = 1111 0010 -> 0101 0101 0000 0100
512 0x5505, //243 = 1111 0011 -> 0101 0101 0000 0101
513 0x5510, //244 = 1111 0100 -> 0101 0101 0001 0000
514 0x5511, //245 = 1111 0101 -> 0101 0101 0001 0001
515 0x5514, //246 = 1111 0110 -> 0101 0101 0001 0100
516 0x5515, //247 = 1111 0111 -> 0101 0101 0001 0101
517 0x5540, //248 = 1111 1000 -> 0101 0101 0100 0000
518 0x5541, //249 = 1111 1001 -> 0101 0101 0100 0001
519 0x5544, //250 = 1111 1010 -> 0101 0101 0100 0100
520 0x5545, //251 = 1111 1011 -> 0101 0101 0100 0101
521 0x5550, //252 = 1111 1100 -> 0101 0101 0101 0000
522 0x5551, //253 = 1111 1101 -> 0101 0101 0101 0001
523 0x5554, //254 = 1111 1110 -> 0101 0101 0101 0100
524 0x5555 //255 = 1111 1111 -> 0101 0101 0101 0101
525
526]
diff --git a/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Point.js b/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Point.js
new file mode 100644
index 0000000..f0739bc
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Point.js
@@ -0,0 +1,67 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!";
31}
32if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; }
33if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; }
34
35Clipperz.Crypto.ECC.BinaryField.Point = function(args) {
36 args = args || {};
37 this._x = args.x;
38 this._y = args.y;
39
40 return this;
41}
42
43Clipperz.Crypto.ECC.BinaryField.Point.prototype = MochiKit.Base.update(null, {
44
45 'asString': function() {
46 return "Clipperz.Crypto.ECC.BinaryField.Point (" + this.x() + ", " + this.y() + ")";
47 },
48
49 //-----------------------------------------------------------------------------
50
51 'x': function() {
52 return this._x;
53 },
54
55 'y': function() {
56 return this._y;
57 },
58
59 //-----------------------------------------------------------------------------
60
61 'isZero': function() {
62 return (this.x().isZero() && this.y().isZero())
63 },
64
65 //-----------------------------------------------------------------------------
66 __syntaxFix__: "syntax fix"
67});
diff --git a/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Value.js b/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Value.js
new file mode 100644
index 0000000..10d055e
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Value.js
@@ -0,0 +1,377 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!";
31}
32if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; }
33if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; }
34
35Clipperz.Crypto.ECC.BinaryField.Value = function(aValue, aBase) {
36 if (aValue.constructor == String) {
37 varvalue;
38 varstringLength;
39 var numberOfWords;
40 vari,c;
41
42 if (aBase != 16) {
43 throw Clipperz.Crypto.ECC.BinaryField.Value.exception.UnsupportedBase;
44 }
45
46 value = aValue.replace(/ /g, '');
47 stringLength = value.length;
48 numberOfWords = Math.ceil(stringLength / 8);
49 this._value = new Array(numberOfWords);
50
51 c = numberOfWords;
52 for (i=0; i<c; i++) {
53 varword;
54
55 if (i < (c-1)) {
56 word = parseInt(value.substr(stringLength-((i+1)*8), 8), 16);
57 } else {
58 word = parseInt(value.substr(0, stringLength-(i*8)), 16);
59 }
60
61 this._value[i] = word;
62 }
63 } else if (aValue.constructor == Array) {
64 var itemsToCopy;
65
66 itemsToCopy = aValue.length;
67 while (aValue[itemsToCopy - 1] == 0) {
68 itemsToCopy --;
69 }
70
71 this._value = aValue.slice(0, itemsToCopy);
72 } else if (aValue.constructor == Number) {
73 this._value = [aValue];
74 } else {
75 // throw Clipperz.Crypto.ECC.BinaryField.Value.exception.UnsupportedConstructorValueType;
76 }
77
78 return this;
79}
80
81Clipperz.Crypto.ECC.BinaryField.Value.prototype = MochiKit.Base.update(null, {
82
83 'value': function() {
84 return this._value;
85 },
86
87 //-----------------------------------------------------------------------------
88
89 'wordSize': function() {
90 return this._value.length
91 },
92
93 //-----------------------------------------------------------------------------
94
95 'clone': function() {
96 return new Clipperz.Crypto.ECC.BinaryField.Value(this._value.slice(0));
97 },
98
99 //-----------------------------------------------------------------------------
100
101 'isZero': function() {
102 return (this.compare(Clipperz.Crypto.ECC.BinaryField.Value.O) == 0);
103 },
104
105 //-----------------------------------------------------------------------------
106
107 'asString': function(aBase) {
108 varresult;
109 var i,c;
110
111 if (aBase != 16) {
112 throw Clipperz.Crypto.ECC.BinaryField.Value.exception.UnsupportedBase;
113 }
114
115 result = "";
116 c = this.wordSize();
117 for (i=0; i<c; i++) {
118 varwordAsString;
119
120 // wordAsString = ("00000000" + this.value()[i].toString(16));
121 wordAsString = ("00000000" + this._value[i].toString(16));
122 wordAsString = wordAsString.substring(wordAsString.length - 8);
123 result = wordAsString + result;
124 }
125
126 result = result.replace(/^(00)*/, "");
127
128 if (result == "") {
129 result = "0";
130 }
131
132 return result;
133 },
134
135 //-----------------------------------------------------------------------------
136
137 'shiftLeft': function(aNumberOfBitsToShift) {
138 return new Clipperz.Crypto.ECC.BinaryField.Value(Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft(this._value, aNumberOfBitsToShift));
139 },
140
141 //-----------------------------------------------------------------------------
142
143 'bitSize': function() {
144 return Clipperz.Crypto.ECC.BinaryField.Value._bitSize(this._value);
145 },
146
147 //-----------------------------------------------------------------------------
148
149 'isBitSet': function(aBitPosition) {
150 return Clipperz.Crypto.ECC.BinaryField.Value._isBitSet(this._value, aBitPosition);
151 },
152
153 //-----------------------------------------------------------------------------
154
155 'xor': function(aValue) {
156 return new Clipperz.Crypto.ECC.BinaryField.Value(Clipperz.Crypto.ECC.BinaryField.Value._xor(this._value, aValue._value));
157 },
158
159 //-----------------------------------------------------------------------------
160
161 'compare': function(aValue) {
162 return Clipperz.Crypto.ECC.BinaryField.Value._compare(this._value, aValue._value);
163 },
164
165 //-----------------------------------------------------------------------------
166 __syntaxFix__: "syntax fix"
167});
168
169Clipperz.Crypto.ECC.BinaryField.Value.O = new Clipperz.Crypto.ECC.BinaryField.Value('0', 16);
170Clipperz.Crypto.ECC.BinaryField.Value.I = new Clipperz.Crypto.ECC.BinaryField.Value('1', 16);
171
172Clipperz.Crypto.ECC.BinaryField.Value._xor = function(a, b, aFirstItemOffset) {
173 var result;
174 var resultSize;
175 var i,c;
176 var firstItemOffset;
177
178 firstItemOffset = aFirstItemOffset || 0;
179 resultSize = Math.max((a.length - firstItemOffset), b.length) + firstItemOffset;
180
181 result = new Array(resultSize);
182
183 c = firstItemOffset;
184 for (i=0; i<c; i++) {
185 result[i] = a[i];
186 }
187
188 c = resultSize;
189 for (i=firstItemOffset; i<c; i++) {
190 result[i] = (((a[i] || 0) ^ (b[i - firstItemOffset] || 0)) >>> 0);
191 }
192
193 return result;
194};
195
196Clipperz.Crypto.ECC.BinaryField.Value._overwriteXor = function(a, b, aFirstItemOffset) {
197 var i,c;
198 var firstItemOffset;
199
200 firstItemOffset = aFirstItemOffset || 0;
201
202 c = Math.max((a.length - firstItemOffset), b.length) + firstItemOffset;
203 for (i=firstItemOffset; i<c; i++) {
204 a[i] = (((a[i] || 0) ^ (b[i - firstItemOffset] || 0)) >>> 0);
205 }
206};
207
208Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft = function(aWordArray, aNumberOfBitsToShift) {
209 var numberOfWordsToShift;
210 varnumberOfBitsToShift;
211 var result;
212 varoverflowValue;
213 vari,c;
214
215 numberOfWordsToShift = Math.floor(aNumberOfBitsToShift / 32);
216 numberOfBitsToShift = aNumberOfBitsToShift % 32;
217
218 result = new Array(aWordArray.length + numberOfWordsToShift);
219
220 c = numberOfWordsToShift;
221 for (i=0; i<c; i++) {
222 result[i] = 0;
223 }
224
225 overflowValue = 0;
226 nextOverflowValue = 0;
227
228 c = aWordArray.length;
229 for (i=0; i<c; i++) {
230 varvalue;
231 varresultWord;
232
233 // value = this.value()[i];
234 value = aWordArray[i];
235
236 if (numberOfBitsToShift > 0) {
237 var nextOverflowValue;
238
239 nextOverflowValue = (value >>> (32 - numberOfBitsToShift));
240 value = value & (0xffffffff >>> numberOfBitsToShift);
241 resultWord = (((value << numberOfBitsToShift) | overflowValue) >>> 0);
242 } else {
243 resultWord = value;
244 }
245
246 result[i+numberOfWordsToShift] = resultWord;
247 overflowValue = nextOverflowValue;
248 }
249
250 if (overflowValue != 0) {
251 result[aWordArray.length + numberOfWordsToShift] = overflowValue;
252 }
253
254 return result;
255};
256
257Clipperz.Crypto.ECC.BinaryField.Value._overwriteShiftLeft = function(aWordArray, aNumberOfBitsToShift) {
258 var numberOfWordsToShift;
259 varnumberOfBitsToShift;
260 var result;
261 varoverflowValue;
262 vari,c;
263
264 numberOfWordsToShift = Math.floor(aNumberOfBitsToShift / 32);
265 numberOfBitsToShift = aNumberOfBitsToShift % 32;
266
267 result = new Array(aWordArray.length + numberOfWordsToShift);
268
269 c = numberOfWordsToShift;
270 for (i=0; i<c; i++) {
271 result[i] = 0;
272 }
273
274 overflowValue = 0;
275 nextOverflowValue = 0;
276
277 c = aWordArray.length;
278 for (i=0; i<c; i++) {
279 varvalue;
280 varresultWord;
281
282 // value = this.value()[i];
283 value = aWordArray[i];
284
285 if (numberOfBitsToShift > 0) {
286 var nextOverflowValue;
287
288 nextOverflowValue = (value >>> (32 - numberOfBitsToShift));
289 value = value & (0xffffffff >>> numberOfBitsToShift);
290 resultWord = (((value << numberOfBitsToShift) | overflowValue) >>> 0);
291 } else {
292 resultWord = value;
293 }
294
295 result[i+numberOfWordsToShift] = resultWord;
296 overflowValue = nextOverflowValue;
297 }
298
299 if (overflowValue != 0) {
300 result[aWordArray.length + numberOfWordsToShift] = overflowValue;
301 }
302
303 return result;
304};
305
306Clipperz.Crypto.ECC.BinaryField.Value._bitSize = function(aWordArray) {
307 varresult;
308 varnotNullElements;
309 var mostValuableWord;
310 var matchingBitsInMostImportantWord;
311 var mask;
312 var i,c;
313
314 notNullElements = aWordArray.length;
315
316 if ((aWordArray.length == 1) && (aWordArray[0] == 0)) {
317 result = 0;
318 } else {
319 while((aWordArray[notNullElements - 1] == 0) && (notNullElements > 0)) {
320 notNullElements --;
321 }
322
323 result = (notNullElements - 1) * 32;
324 mostValuableWord = aWordArray[notNullElements - 1];
325
326 matchingBits = 32;
327 mask = 0x80000000;
328
329 while ((matchingBits > 0) && ((mostValuableWord & mask) == 0)) {
330 matchingBits --;
331 mask >>>= 1;
332 }
333
334 result += matchingBits;
335 }
336
337 return result;
338};
339
340Clipperz.Crypto.ECC.BinaryField.Value._isBitSet = function(aWordArray, aBitPosition) {
341 var result;
342 varbyteIndex;
343 var bitIndexInSelectedByte;
344
345 byteIndex = Math.floor(aBitPosition / 32);
346 bitIndexInSelectedByte = aBitPosition % 32;
347
348 if (byteIndex <= aWordArray.length) {
349 result = ((aWordArray[byteIndex] & (1 << bitIndexInSelectedByte)) != 0);
350 } else {
351 result = false;
352 }
353
354 return result;
355};
356
357Clipperz.Crypto.ECC.BinaryField.Value._compare = function(a,b) {
358 varresult;
359 var i,c;
360
361 result = MochiKit.Base.compare(a.length, b.length);
362
363 c = a.length;
364 for (i=0; (i<c) && (result==0); i++) {
365//console.log("compare[" + c + " - " + i + " - 1] " + this.value()[c-i-1] + ", " + aValue.value()[c-i-1]);
366 // result = MochiKit.Base.compare(this.value()[c-i-1], aValue.value()[c-i-1]);
367 result = MochiKit.Base.compare(a[c-i-1], b[c-i-1]);
368 }
369
370 return result;
371};
372
373
374Clipperz.Crypto.ECC.BinaryField.Value['exception']= {
375 'UnsupportedBase': new MochiKit.Base.NamedError("Clipperz.Crypto.ECC.BinaryField.Value.exception.UnsupportedBase"),
376 'UnsupportedConstructorValueType':new MochiKit.Base.NamedError("Clipperz.Crypto.ECC.BinaryField.Value.exception.UnsupportedConstructorValueType")
377};
diff --git a/frontend/beta/js/Clipperz/Crypto/PRNG.js b/frontend/beta/js/Clipperz/Crypto/PRNG.js
new file mode 100644
index 0000000..770ceb1
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Crypto/PRNG.js
@@ -0,0 +1,854 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!";
31}
32
33try { if (typeof(Clipperz.Crypto.SHA) == 'undefined') { throw ""; }} catch (e) {
34 throw "Clipperz.Crypto.PRNG depends on Clipperz.Crypto.SHA!";
35}
36
37try { if (typeof(Clipperz.Crypto.AES) == 'undefined') { throw ""; }} catch (e) {
38 throw "Clipperz.Crypto.PRNG depends on Clipperz.Crypto.AES!";
39}
40
41if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { Clipperz.Crypto.PRNG = {}; }
42
43//#############################################################################
44
45Clipperz.Crypto.PRNG.EntropyAccumulator = function(args) {
46 args = args || {};
47 //MochiKit.Base.bindMethods(this);
48
49 this._stack = new Clipperz.ByteArray();
50 this._maxStackLengthBeforeHashing = args.maxStackLengthBeforeHashing || 256;
51 return this;
52}
53
54Clipperz.Crypto.PRNG.EntropyAccumulator.prototype = MochiKit.Base.update(null, {
55
56 'toString': function() {
57 return "Clipperz.Crypto.PRNG.EntropyAccumulator";
58 },
59
60 //-------------------------------------------------------------------------
61
62 'stack': function() {
63 return this._stack;
64 },
65
66 'setStack': function(aValue) {
67 this._stack = aValue;
68 },
69
70 'resetStack': function() {
71 this.stack().reset();
72 },
73
74 'maxStackLengthBeforeHashing': function() {
75 return this._maxStackLengthBeforeHashing;
76 },
77
78 //-------------------------------------------------------------------------
79
80 'addRandomByte': function(aValue) {
81 this.stack().appendByte(aValue);
82
83 if (this.stack().length() > this.maxStackLengthBeforeHashing()) {
84 this.setStack(Clipperz.Crypto.SHA.sha_d256(this.stack()));
85 }
86 },
87
88 //-------------------------------------------------------------------------
89 __syntaxFix__: "syntax fix"
90});
91
92//#############################################################################
93
94Clipperz.Crypto.PRNG.RandomnessSource = function(args) {
95 args = args || {};
96 MochiKit.Base.bindMethods(this);
97
98 this._generator = args.generator || null;
99 this._sourceId = args.sourceId || null;
100 this._boostMode = args.boostMode || false;
101
102 this._nextPoolIndex = 0;
103
104 return this;
105}
106
107Clipperz.Crypto.PRNG.RandomnessSource.prototype = MochiKit.Base.update(null, {
108
109 'generator': function() {
110 return this._generator;
111 },
112
113 'setGenerator': function(aValue) {
114 this._generator = aValue;
115 },
116
117 //-------------------------------------------------------------------------
118
119 'boostMode': function() {
120 return this._boostMode;
121 },
122
123 'setBoostMode': function(aValue) {
124 this._boostMode = aValue;
125 },
126
127 //-------------------------------------------------------------------------
128
129 'sourceId': function() {
130 return this._sourceId;
131 },
132
133 'setSourceId': function(aValue) {
134 this._sourceId = aValue;
135 },
136
137 //-------------------------------------------------------------------------
138
139 'nextPoolIndex': function() {
140 return this._nextPoolIndex;
141 },
142
143 'incrementNextPoolIndex': function() {
144 this._nextPoolIndex = ((this._nextPoolIndex + 1) % this.generator().numberOfEntropyAccumulators());
145 },
146
147 //-------------------------------------------------------------------------
148
149 'updateGeneratorWithValue': function(aRandomValue) {
150 if (this.generator() != null) {
151 this.generator().addRandomByte(this.sourceId(), this.nextPoolIndex(), aRandomValue);
152 this.incrementNextPoolIndex();
153 }
154 },
155
156 //-------------------------------------------------------------------------
157 __syntaxFix__: "syntax fix"
158});
159
160//#############################################################################
161
162Clipperz.Crypto.PRNG.TimeRandomnessSource = function(args) {
163 args = args || {};
164 //MochiKit.Base.bindMethods(this);
165
166 this._intervalTime = args.intervalTime || 1000;
167
168 Clipperz.Crypto.PRNG.RandomnessSource.call(this, args);
169
170 this.collectEntropy();
171 return this;
172}
173
174Clipperz.Crypto.PRNG.TimeRandomnessSource.prototype = MochiKit.Base.update(new Clipperz.Crypto.PRNG.RandomnessSource, {
175
176 'intervalTime': function() {
177 return this._intervalTime;
178 },
179
180 //-------------------------------------------------------------------------
181
182 'collectEntropy': function() {
183 varnow;
184 varentropyByte;
185 var intervalTime;
186 now = new Date();
187 entropyByte = (now.getTime() & 0xff);
188
189 intervalTime = this.intervalTime();
190 if (this.boostMode() == true) {
191 intervalTime = intervalTime / 9;
192 }
193
194 this.updateGeneratorWithValue(entropyByte);
195 setTimeout(this.collectEntropy, intervalTime);
196 },
197
198 //-------------------------------------------------------------------------
199
200 'numberOfRandomBits': function() {
201 return 5;
202 },
203
204 //-------------------------------------------------------------------------
205
206 'pollingFrequency': function() {
207 return 10;
208 },
209
210 //-------------------------------------------------------------------------
211 __syntaxFix__: "syntax fix"
212});
213
214//*****************************************************************************
215
216Clipperz.Crypto.PRNG.MouseRandomnessSource = function(args) {
217 args = args || {};
218
219 Clipperz.Crypto.PRNG.RandomnessSource.call(this, args);
220
221 this._numberOfBitsToCollectAtEachEvent = 4;
222 this._randomBitsCollector = 0;
223 this._numberOfRandomBitsCollected = 0;
224
225 MochiKit.Signal.connect(document, 'onmousemove', this, 'collectEntropy');
226
227 return this;
228}
229
230Clipperz.Crypto.PRNG.MouseRandomnessSource.prototype = MochiKit.Base.update(new Clipperz.Crypto.PRNG.RandomnessSource, {
231
232 //-------------------------------------------------------------------------
233
234 'numberOfBitsToCollectAtEachEvent': function() {
235 return this._numberOfBitsToCollectAtEachEvent;
236 },
237
238 //-------------------------------------------------------------------------
239
240 'randomBitsCollector': function() {
241 return this._randomBitsCollector;
242 },
243
244 'setRandomBitsCollector': function(aValue) {
245 this._randomBitsCollector = aValue;
246 },
247
248 'appendRandomBitsToRandomBitsCollector': function(aValue) {
249 var collectedBits;
250 var numberOfRandomBitsCollected;
251
252 numberOfRandomBitsCollected = this.numberOfRandomBitsCollected();
253 collectetBits = this.randomBitsCollector() | (aValue << numberOfRandomBitsCollected);
254 this.setRandomBitsCollector(collectetBits);
255 numberOfRandomBitsCollected += this.numberOfBitsToCollectAtEachEvent();
256
257 if (numberOfRandomBitsCollected == 8) {
258 this.updateGeneratorWithValue(collectetBits);
259 numberOfRandomBitsCollected = 0;
260 this.setRandomBitsCollector(0);
261 }
262
263 this.setNumberOfRandomBitsCollected(numberOfRandomBitsCollected)
264 },
265
266 //-------------------------------------------------------------------------
267
268 'numberOfRandomBitsCollected': function() {
269 return this._numberOfRandomBitsCollected;
270 },
271
272 'setNumberOfRandomBitsCollected': function(aValue) {
273 this._numberOfRandomBitsCollected = aValue;
274 },
275
276 //-------------------------------------------------------------------------
277
278 'collectEntropy': function(anEvent) {
279 var mouseLocation;
280 var randomBit;
281 var mask;
282
283 mask = 0xffffffff >>> (32 - this.numberOfBitsToCollectAtEachEvent());
284
285 mouseLocation = anEvent.mouse().client;
286 randomBit = ((mouseLocation.x ^ mouseLocation.y) & mask);
287 this.appendRandomBitsToRandomBitsCollector(randomBit)
288 },
289
290 //-------------------------------------------------------------------------
291
292 'numberOfRandomBits': function() {
293 return 1;
294 },
295
296 //-------------------------------------------------------------------------
297
298 'pollingFrequency': function() {
299 return 10;
300 },
301
302 //-------------------------------------------------------------------------
303 __syntaxFix__: "syntax fix"
304});
305
306//*****************************************************************************
307
308Clipperz.Crypto.PRNG.KeyboardRandomnessSource = function(args) {
309 args = args || {};
310 Clipperz.Crypto.PRNG.RandomnessSource.call(this, args);
311
312 this._randomBitsCollector = 0;
313 this._numberOfRandomBitsCollected = 0;
314
315 MochiKit.Signal.connect(document, 'onkeypress', this, 'collectEntropy');
316
317 return this;
318}
319
320Clipperz.Crypto.PRNG.KeyboardRandomnessSource.prototype = MochiKit.Base.update(new Clipperz.Crypto.PRNG.RandomnessSource, {
321
322 //-------------------------------------------------------------------------
323
324 'randomBitsCollector': function() {
325 return this._randomBitsCollector;
326 },
327
328 'setRandomBitsCollector': function(aValue) {
329 this._randomBitsCollector = aValue;
330 },
331
332 'appendRandomBitToRandomBitsCollector': function(aValue) {
333 var collectedBits;
334 var numberOfRandomBitsCollected;
335
336 numberOfRandomBitsCollected = this.numberOfRandomBitsCollected();
337 collectetBits = this.randomBitsCollector() | (aValue << numberOfRandomBitsCollected);
338 this.setRandomBitsCollector(collectetBits);
339 numberOfRandomBitsCollected ++;
340
341 if (numberOfRandomBitsCollected == 8) {
342 this.updateGeneratorWithValue(collectetBits);
343 numberOfRandomBitsCollected = 0;
344 this.setRandomBitsCollector(0);
345 }
346
347 this.setNumberOfRandomBitsCollected(numberOfRandomBitsCollected)
348 },
349
350 //-------------------------------------------------------------------------
351
352 'numberOfRandomBitsCollected': function() {
353 return this._numberOfRandomBitsCollected;
354 },
355
356 'setNumberOfRandomBitsCollected': function(aValue) {
357 this._numberOfRandomBitsCollected = aValue;
358 },
359
360 //-------------------------------------------------------------------------
361
362 'collectEntropy': function(anEvent) {
363/*
364 var mouseLocation;
365 var randomBit;
366
367 mouseLocation = anEvent.mouse().client;
368
369 randomBit = ((mouseLocation.x ^ mouseLocation.y) & 0x1);
370 this.appendRandomBitToRandomBitsCollector(randomBit);
371*/
372 },
373
374 //-------------------------------------------------------------------------
375
376 'numberOfRandomBits': function() {
377 return 1;
378 },
379
380 //-------------------------------------------------------------------------
381
382 'pollingFrequency': function() {
383 return 10;
384 },
385
386 //-------------------------------------------------------------------------
387 __syntaxFix__: "syntax fix"
388});
389
390//#############################################################################
391
392Clipperz.Crypto.PRNG.Fortuna = function(args) {
393 vari,c;
394
395 args = args || {};
396
397 this._key = args.seed || null;
398 if (this._key == null) {
399 this._counter = 0;
400 this._key = new Clipperz.ByteArray();
401 } else {
402 this._counter = 1;
403 }
404
405 this._aesKey = null;
406
407 this._firstPoolReseedLevel = args.firstPoolReseedLevel || 32 || 64;
408 this._numberOfEntropyAccumulators = args.numberOfEntropyAccumulators || 32;
409
410 this._accumulators = [];
411 c = this.numberOfEntropyAccumulators();
412 for (i=0; i<c; i++) {
413 this._accumulators.push(new Clipperz.Crypto.PRNG.EntropyAccumulator());
414 }
415
416 this._randomnessSources = [];
417 this._reseedCounter = 0;
418
419 return this;
420}
421
422Clipperz.Crypto.PRNG.Fortuna.prototype = MochiKit.Base.update(null, {
423
424 'toString': function() {
425 return "Clipperz.Crypto.PRNG.Fortuna";
426 },
427
428 //-------------------------------------------------------------------------
429
430 'key': function() {
431 return this._key;
432 },
433
434 'setKey': function(aValue) {
435 this._key = aValue;
436 this._aesKey = null;
437 },
438
439 'aesKey': function() {
440 if (this._aesKey == null) {
441 this._aesKey = new Clipperz.Crypto.AES.Key({key:this.key()});
442 }
443
444 return this._aesKey;
445 },
446
447 'accumulators': function() {
448 return this._accumulators;
449 },
450
451 'firstPoolReseedLevel': function() {
452 return this._firstPoolReseedLevel;
453 },
454
455 //-------------------------------------------------------------------------
456
457 'reseedCounter': function() {
458 return this._reseedCounter;
459 },
460
461 'incrementReseedCounter': function() {
462 this._reseedCounter = this._reseedCounter +1;
463 },
464
465 //-------------------------------------------------------------------------
466
467 'reseed': function() {
468 varnewKeySeed;
469 var reseedCounter;
470 varreseedCounterMask;
471 var i, c;
472
473 newKeySeed = this.key();
474 this.incrementReseedCounter();
475 reseedCounter = this.reseedCounter();
476
477 c = this.numberOfEntropyAccumulators();
478 reseedCounterMask = 0xffffffff >>> (32 - c);
479 for (i=0; i<c; i++) {
480 if ((i == 0) || ((reseedCounter & (reseedCounterMask >>> (c - i))) == 0)) {
481 newKeySeed.appendBlock(this.accumulators()[i].stack());
482 this.accumulators()[i].resetStack();
483 }
484 }
485
486 if (reseedCounter == 1) {
487 c = this.randomnessSources().length;
488 for (i=0; i<c; i++) {
489 this.randomnessSources()[i].setBoostMode(false);
490 }
491 }
492
493 this.setKey(Clipperz.Crypto.SHA.sha_d256(newKeySeed));
494 if (reseedCounter == 1) {
495MochiKit.Logging.logDebug("### PRNG.readyToGenerateRandomBytes");
496 MochiKit.Signal.signal(this, 'readyToGenerateRandomBytes');
497 }
498 MochiKit.Signal.signal(this, 'reseeded');
499 },
500
501 //-------------------------------------------------------------------------
502
503 'isReadyToGenerateRandomValues': function() {
504 return this.reseedCounter() != 0;
505 },
506
507 //-------------------------------------------------------------------------
508
509 'entropyLevel': function() {
510 return this.accumulators()[0].stack().length() + (this.reseedCounter() * this.firstPoolReseedLevel());
511 },
512
513 //-------------------------------------------------------------------------
514
515 'counter': function() {
516 return this._counter;
517 },
518
519 'incrementCounter': function() {
520 this._counter += 1;
521 },
522
523 'counterBlock': function() {
524 var result;
525
526 result = new Clipperz.ByteArray().appendWords(this.counter(), 0, 0, 0);
527
528 return result;
529 },
530
531 //-------------------------------------------------------------------------
532
533 'getRandomBlock': function() {
534 var result;
535
536 result = new Clipperz.ByteArray(Clipperz.Crypto.AES.encryptBlock(this.aesKey(), this.counterBlock().arrayValues()));
537 this.incrementCounter();
538
539 return result;
540 },
541
542 //-------------------------------------------------------------------------
543
544 'getRandomBytes': function(aSize) {
545 var result;
546
547 if (this.isReadyToGenerateRandomValues()) {
548 var i,c;
549 var newKey;
550
551 result = new Clipperz.ByteArray();
552
553 c = Math.ceil(aSize / (128 / 8));
554 for (i=0; i<c; i++) {
555 result.appendBlock(this.getRandomBlock());
556 }
557
558 if (result.length() != aSize) {
559 result = result.split(0, aSize);
560 }
561
562 newKey = this.getRandomBlock().appendBlock(this.getRandomBlock());
563 this.setKey(newKey);
564 } else {
565MochiKit.Logging.logWarning("Fortuna generator has not enough entropy, yet!");
566 throw Clipperz.Crypto.PRNG.exception.NotEnoughEntropy;
567 }
568
569 return result;
570 },
571
572 //-------------------------------------------------------------------------
573
574 'addRandomByte': function(aSourceId, aPoolId, aRandomValue) {
575 varselectedAccumulator;
576
577 selectedAccumulator = this.accumulators()[aPoolId];
578 selectedAccumulator.addRandomByte(aRandomValue);
579
580 if (aPoolId == 0) {
581 MochiKit.Signal.signal(this, 'addedRandomByte')
582 if (selectedAccumulator.stack().length() > this.firstPoolReseedLevel()) {
583 this.reseed();
584 }
585 }
586 },
587
588 //-------------------------------------------------------------------------
589
590 'numberOfEntropyAccumulators': function() {
591 return this._numberOfEntropyAccumulators;
592 },
593
594 //-------------------------------------------------------------------------
595
596 'randomnessSources': function() {
597 return this._randomnessSources;
598 },
599
600 'addRandomnessSource': function(aRandomnessSource) {
601 aRandomnessSource.setGenerator(this);
602 aRandomnessSource.setSourceId(this.randomnessSources().length);
603 this.randomnessSources().push(aRandomnessSource);
604
605 if (this.isReadyToGenerateRandomValues() == false) {
606 aRandomnessSource.setBoostMode(true);
607 }
608 },
609
610 //-------------------------------------------------------------------------
611
612 'deferredEntropyCollection': function(aValue) {
613 var result;
614
615//MochiKit.Logging.logDebug(">>> PRNG.deferredEntropyCollection");
616
617 if (this.isReadyToGenerateRandomValues()) {
618//MochiKit.Logging.logDebug("--- PRNG.deferredEntropyCollection - 1");
619 result = aValue;
620 } else {
621//MochiKit.Logging.logDebug("--- PRNG.deferredEntropyCollection - 2");
622 var deferredResult;
623
624 Clipperz.NotificationCenter.notify(this, 'updatedProgressState', 'collectingEntropy', true);
625
626 deferredResult = new MochiKit.Async.Deferred();
627 // deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.1 - PRNG.deferredEntropyCollection - 1: " + res); return res;});
628 deferredResult.addCallback(MochiKit.Base.partial(MochiKit.Async.succeed, aValue));
629 // deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.2 - PRNG.deferredEntropyCollection - 2: " + res); return res;});
630 MochiKit.Signal.connect(this,
631 'readyToGenerateRandomBytes',
632 deferredResult,
633 'callback');
634
635 result = deferredResult;
636 }
637//MochiKit.Logging.logDebug("<<< PRNG.deferredEntropyCollection - result: " + result);
638
639 return result;
640 },
641
642 //-------------------------------------------------------------------------
643
644 'fastEntropyAccumulationForTestingPurpose': function() {
645 while (! this.isReadyToGenerateRandomValues()) {
646 this.addRandomByte(Math.floor(Math.random() * 32), Math.floor(Math.random() * 32), Math.floor(Math.random() * 256));
647 }
648 },
649
650 //-------------------------------------------------------------------------
651
652 'dump': function(appendToDoc) {
653 var tbl;
654 var i,c;
655
656 tbl = document.createElement("table");
657 tbl.border = 0;
658 with (tbl.style) {
659 border = "1px solid lightgrey";
660 fontFamily = 'Helvetica, Arial, sans-serif';
661 fontSize = '8pt';
662 //borderCollapse = "collapse";
663 }
664 var hdr = tbl.createTHead();
665 var hdrtr = hdr.insertRow(0);
666 // document.createElement("tr");
667 {
668 var ntd;
669
670 ntd = hdrtr.insertCell(0);
671 ntd.style.borderBottom = "1px solid lightgrey";
672 ntd.style.borderRight = "1px solid lightgrey";
673 ntd.appendChild(document.createTextNode("#"));
674
675 ntd = hdrtr.insertCell(1);
676 ntd.style.borderBottom = "1px solid lightgrey";
677 ntd.style.borderRight = "1px solid lightgrey";
678 ntd.appendChild(document.createTextNode("s"));
679
680 ntd = hdrtr.insertCell(2);
681 ntd.colSpan = this.firstPoolReseedLevel();
682 ntd.style.borderBottom = "1px solid lightgrey";
683 ntd.style.borderRight = "1px solid lightgrey";
684 ntd.appendChild(document.createTextNode("base values"));
685
686 ntd = hdrtr.insertCell(3);
687 ntd.colSpan = 20;
688 ntd.style.borderBottom = "1px solid lightgrey";
689 ntd.appendChild(document.createTextNode("extra values"));
690
691 }
692
693 c = this.accumulators().length;
694 for (i=0; i<c ; i++) {
695 varcurrentAccumulator;
696 var bdytr;
697 var bdytd;
698 var ii, cc;
699
700 currentAccumulator = this.accumulators()[i]
701
702 bdytr = tbl.insertRow(true);
703
704 bdytd = bdytr.insertCell(0);
705 bdytd.style.borderRight = "1px solid lightgrey";
706 bdytd.style.color = "lightgrey";
707 bdytd.appendChild(document.createTextNode("" + i));
708
709 bdytd = bdytr.insertCell(1);
710 bdytd.style.borderRight = "1px solid lightgrey";
711 bdytd.style.color = "gray";
712 bdytd.appendChild(document.createTextNode("" + currentAccumulator.stack().length()));
713
714
715 cc = Math.max(currentAccumulator.stack().length(), this.firstPoolReseedLevel());
716 for (ii=0; ii<cc; ii++) {
717 var cellText;
718
719 bdytd = bdytr.insertCell(ii + 2);
720
721 if (ii < currentAccumulator.stack().length()) {
722 cellText = Clipperz.ByteArray.byteToHex(currentAccumulator.stack().byteAtIndex(ii));
723 } else {
724 cellText = "_";
725 }
726
727 if (ii == (this.firstPoolReseedLevel() - 1)) {
728 bdytd.style.borderRight = "1px solid lightgrey";
729 }
730
731 bdytd.appendChild(document.createTextNode(cellText));
732 }
733
734 }
735
736
737 if (appendToDoc) {
738 var ne = document.createElement("div");
739 ne.id = "entropyGeneratorStatus";
740 with (ne.style) {
741 fontFamily = "Courier New, monospace";
742 fontSize = "12px";
743 lineHeight = "16px";
744 borderTop = "1px solid black";
745 padding = "10px";
746 }
747 if (document.getElementById(ne.id)) {
748 MochiKit.DOM.swapDOM(ne.id, ne);
749 } else {
750 document.body.appendChild(ne);
751 }
752 ne.appendChild(tbl);
753 }
754
755 return tbl;
756 },
757
758 //-----------------------------------------------------------------------------
759 __syntaxFix__: "syntax fix"
760});
761
762//#############################################################################
763
764Clipperz.Crypto.PRNG.Random = function(args) {
765 args = args || {};
766 //MochiKit.Base.bindMethods(this);
767
768 return this;
769}
770
771Clipperz.Crypto.PRNG.Random.prototype = MochiKit.Base.update(null, {
772
773 'toString': function() {
774 return "Clipperz.Crypto.PRNG.Random";
775 },
776
777 //-------------------------------------------------------------------------
778
779 'getRandomBytes': function(aSize) {
780//Clipperz.Profile.start("Clipperz.Crypto.PRNG.Random.getRandomBytes");
781 varresult;
782 var i,c;
783
784 result = new Clipperz.ByteArray()
785 c = aSize || 1;
786 for (i=0; i<c; i++) {
787 result.appendByte((Math.random()*255) & 0xff);
788 }
789
790//Clipperz.Profile.stop("Clipperz.Crypto.PRNG.Random.getRandomBytes");
791 return result;
792 },
793
794 //-------------------------------------------------------------------------
795 __syntaxFix__: "syntax fix"
796});
797
798//#############################################################################
799
800_clipperz_crypt_prng_defaultPRNG = null;
801
802Clipperz.Crypto.PRNG.defaultRandomGenerator = function() {
803 if (_clipperz_crypt_prng_defaultPRNG == null) {
804 _clipperz_crypt_prng_defaultPRNG = new Clipperz.Crypto.PRNG.Fortuna();
805
806 //.............................................................
807 //
808 // TimeRandomnessSource
809 //
810 //.............................................................
811 {
812 var newRandomnessSource;
813
814 newRandomnessSource = new Clipperz.Crypto.PRNG.TimeRandomnessSource({intervalTime:111});
815 _clipperz_crypt_prng_defaultPRNG.addRandomnessSource(newRandomnessSource);
816 }
817
818 //.............................................................
819 //
820 // MouseRandomnessSource
821 //
822 //.............................................................
823 {
824 varnewRandomnessSource;
825
826 newRandomnessSource = new Clipperz.Crypto.PRNG.MouseRandomnessSource();
827 _clipperz_crypt_prng_defaultPRNG.addRandomnessSource(newRandomnessSource);
828 }
829
830 //.............................................................
831 //
832 // KeyboardRandomnessSource
833 //
834 //.............................................................
835 {
836 varnewRandomnessSource;
837
838 newRandomnessSource = new Clipperz.Crypto.PRNG.KeyboardRandomnessSource();
839 _clipperz_crypt_prng_defaultPRNG.addRandomnessSource(newRandomnessSource);
840 }
841
842 }
843
844 return _clipperz_crypt_prng_defaultPRNG;
845};
846
847//#############################################################################
848
849Clipperz.Crypto.PRNG.exception = {
850 NotEnoughEntropy: new MochiKit.Base.NamedError("Clipperz.Crypto.PRNG.exception.NotEnoughEntropy")
851};
852
853
854MochiKit.DOM.addLoadEvent(Clipperz.Crypto.PRNG.defaultRandomGenerator);
diff --git a/frontend/beta/js/Clipperz/Crypto/RSA.js b/frontend/beta/js/Clipperz/Crypto/RSA.js
new file mode 100644
index 0000000..4dad8f7
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Crypto/RSA.js
@@ -0,0 +1,151 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29try { if (typeof(Clipperz.Crypto.BigInt) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.Crypto.RSA depends on Clipperz.Crypto.BigInt!";
31}
32
33if (typeof(Clipperz.Crypto.RSA) == 'undefined') { Clipperz.Crypto.RSA = {}; }
34
35Clipperz.Crypto.RSA.VERSION = "0.1";
36Clipperz.Crypto.RSA.NAME = "Clipperz.RSA";
37
38//#############################################################################
39
40MochiKit.Base.update(Clipperz.Crypto.RSA, {
41
42 //-------------------------------------------------------------------------
43
44 'publicKeyWithValues': function (e, d, n) {
45 varresult;
46
47 result = {};
48
49 if (e.isBigInt) {
50 result.e = e;
51 } else {
52 result.e = new Clipperz.Crypto.BigInt(e, 16);
53 }
54
55 if (d.isBigInt) {
56 result.d = d;
57 } else {
58 result.d = new Clipperz.Crypto.BigInt(d, 16);
59 }
60
61 if (n.isBigInt) {
62 result.n = n;
63 } else {
64 result.n = new Clipperz.Crypto.BigInt(n, 16);
65 }
66
67 return result;
68 },
69
70 'privateKeyWithValues': function(e, d, n) {
71 return Clipperz.Crypto.RSA.publicKeyWithValues(e, d, n);
72 },
73
74 //-----------------------------------------------------------------------------
75
76 'encryptUsingPublicKey': function (aKey, aMessage) {
77 varmessageValue;
78 varresult;
79
80 messageValue = new Clipperz.Crypto.BigInt(aMessage, 16);
81 result = messageValue.powerModule(aKey.e, aKey.n);
82
83 return result.asString(16);
84 },
85
86 //.............................................................................
87
88 'decryptUsingPublicKey': function (aKey, aMessage) {
89 return Clipperz.Crypto.RSA.encryptUsingPublicKey(aKey, aMessage);
90 },
91
92 //-----------------------------------------------------------------------------
93
94 'encryptUsingPrivateKey': function (aKey, aMessage) {
95 varmessageValue;
96 varresult;
97
98 messageValue = new Clipperz.Crypto.BigInt(aMessage, 16);
99 result = messageValue.powerModule(aKey.d, aKey.n);
100
101 return result.asString(16);
102 },
103
104 //.............................................................................
105
106 'decryptUsingPrivateKey': function (aKey, aMessage) {
107 return Clipperz.Crypto.RSA.encryptUsingPrivateKey(aKey, aMessage);
108 },
109
110 //-----------------------------------------------------------------------------
111
112 'generatePublicKey': function(aNumberOfBits) {
113 varresult;
114 vare;
115 vard;
116 varn;
117
118 e = new Clipperz.Crypto.BigInt("10001", 16);
119
120 {
121 var p, q;
122 varphi;
123
124 do {
125 p = Clipperz.Crypto.BigInt.randomPrime(aNumberOfBits);
126 } while (p.module(e).equals(1));
127
128 do {
129 q = Clipperz.Crypto.BigInt.randomPrime(aNumberOfBits);
130 } while ((q.equals(p)) || (q.module(e).equals(1)));
131
132 n = p.multiply(q);
133 phi = (p.subtract(1).multiply(q.subtract(1)));
134 d = e.powerModule(-1, phi);
135 }
136
137 result = Clipperz.Crypto.RSA.publicKeyWithValues(e, d, n);
138
139 return result;
140 },
141
142 //-------------------------------------------------------------------------
143
144 __syntaxFix__: "syntax fix"
145
146 //-------------------------------------------------------------------------
147
148});
149
150//#############################################################################
151
diff --git a/frontend/beta/js/Clipperz/Crypto/SHA.js b/frontend/beta/js/Clipperz/Crypto/SHA.js
new file mode 100644
index 0000000..bb50b4f
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Crypto/SHA.js
@@ -0,0 +1,296 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!";
31}
32
33if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; }
34if (typeof(Clipperz.Crypto.SHA) == 'undefined') { Clipperz.Crypto.SHA = {}; }
35
36Clipperz.Crypto.SHA.VERSION = "0.3";
37Clipperz.Crypto.SHA.NAME = "Clipperz.Crypto.SHA";
38
39MochiKit.Base.update(Clipperz.Crypto.SHA, {
40
41 '__repr__': function () {
42 return "[" + this.NAME + " " + this.VERSION + "]";
43 },
44
45 'toString': function () {
46 return this.__repr__();
47 },
48
49 //-----------------------------------------------------------------------------
50
51 'rotateRight': function(aValue, aNumberOfBits) {
52//Clipperz.Profile.start("Clipperz.Crypto.SHA.rotateRight");
53 var result;
54
55 result = (aValue >>> aNumberOfBits) | (aValue << (32 - aNumberOfBits));
56
57//Clipperz.Profile.stop("Clipperz.Crypto.SHA.rotateRight");
58 return result;
59 },
60
61 'shiftRight': function(aValue, aNumberOfBits) {
62//Clipperz.Profile.start("Clipperz.Crypto.SHA.shiftRight");
63 var result;
64
65 result = aValue >>> aNumberOfBits;
66
67//Clipperz.Profile.stop("Clipperz.Crypto.SHA.shiftRight");
68 return result;
69 },
70
71 //-----------------------------------------------------------------------------
72
73 'safeAdd': function() {
74//Clipperz.Profile.start("Clipperz.Crypto.SHA.safeAdd");
75 varresult;
76 vari, c;
77
78 result = arguments[0];
79 c = arguments.length;
80 for (i=1; i<c; i++) {
81 varlowerBytesSum;
82
83 lowerBytesSum = (result & 0xffff) + (arguments[i] & 0xffff);
84 result = (((result >> 16) + (arguments[i] >> 16) + (lowerBytesSum >> 16)) << 16) | (lowerBytesSum & 0xffff);
85 }
86
87//Clipperz.Profile.stop("Clipperz.Crypto.SHA.safeAdd");
88 return result;
89 },
90
91 //-----------------------------------------------------------------------------
92
93 'sha256_array': function(aValue) {
94//Clipperz.Profile.start("Clipperz.Crypto.SHA.sha256_array");
95 varresult;
96 varmessage;
97 var h0, h1, h2, h3, h4, h5, h6, h7;
98 vark;
99 varmessageLength;
100 varmessageLengthInBits;
101 var_i, _c;
102 var charBits;
103 var rotateRight;
104 var shiftRight;
105 var safeAdd;
106 varbytesPerBlock;
107 var currentMessageIndex;
108
109 bytesPerBlock = 512/8;
110 rotateRight = Clipperz.Crypto.SHA.rotateRight;
111 shiftRight = Clipperz.Crypto.SHA.shiftRight;
112 safeAdd = Clipperz.Crypto.SHA.safeAdd;
113
114 charBits = 8;
115
116 h0 = 0x6a09e667;
117 h1 = 0xbb67ae85;
118 h2 = 0x3c6ef372;
119 h3 = 0xa54ff53a;
120 h4 = 0x510e527f;
121 h5 = 0x9b05688c;
122 h6 = 0x1f83d9ab;
123 h7 = 0x5be0cd19;
124
125 k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
126 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
127 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
128 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
129 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
130 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
131 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
132 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];
133
134 message = aValue;
135 messageLength = message.length;
136
137 //Pre-processing:
138 message.push(0x80); //append a single "1" bit to message
139
140 _c = (512 - (((messageLength + 1) * charBits) % 512) - 64) / charBits;
141 for (_i=0; _i<_c; _i++) {
142 message.push(0x00); //append "0" bits until message length ≡ 448 ≡ -64 (mod 512)
143 }
144 messageLengthInBits = messageLength * charBits;
145 message.push(0x00); //the 4 most high byte are alway 0 as message length is represented with a 32bit value;
146 message.push(0x00);
147 message.push(0x00);
148 message.push(0x00);
149 message.push((messageLengthInBits >> 24)& 0xff);
150 message.push((messageLengthInBits >> 16)& 0xff);
151 message.push((messageLengthInBits >> 8) & 0xff);
152 message.push( messageLengthInBits & 0xff);
153
154 currentMessageIndex = 0;
155 while(currentMessageIndex < message.length) {
156 varw;
157 vara, b, c, d, e, f, g, h;
158
159 w = Array(64);
160
161 _c = 16;
162 for (_i=0; _i<_c; _i++) {
163 var _j;
164
165 _j = currentMessageIndex + _i*4;
166 w[_i] = (message[_j] << 24) | (message[_j + 1] << 16) | (message[_j + 2] << 8) | (message[_j + 3] << 0);
167 }
168
169 _c = 64;
170 for (_i=16; _i<_c; _i++) {
171 vars0, s1;
172
173 s0 = (rotateRight(w[_i-15], 7)) ^ (rotateRight(w[_i-15], 18)) ^ (shiftRight(w[_i-15], 3));
174 s1 = (rotateRight(w[_i-2], 17)) ^ (rotateRight(w[_i-2], 19)) ^ (shiftRight(w[_i-2], 10));
175 w[_i] = safeAdd(w[_i-16], s0, w[_i-7], s1);
176 }
177
178 a=h0; b=h1; c=h2; d=h3; e=h4; f=h5; g=h6; h=h7;
179
180 _c = 64;
181 for (_i=0; _i<_c; _i++) {
182 var s0, s1, ch, maj, t1, t2;
183
184 s0 = (rotateRight(a, 2)) ^ (rotateRight(a, 13)) ^ (rotateRight(a, 22));
185 maj = (a & b) ^ (a & c) ^ (b & c);
186 t2 = safeAdd(s0, maj);
187 s1 = (rotateRight(e, 6)) ^ (rotateRight(e, 11)) ^ (rotateRight(e, 25));
188 ch = (e & f) ^ ((~e) & g);
189 t1 = safeAdd(h, s1, ch, k[_i], w[_i]);
190
191 h = g;
192 g = f;
193 f = e;
194 e = safeAdd(d, t1);
195 d = c;
196 c = b;
197 b = a;
198 a = safeAdd(t1, t2);
199 }
200
201 h0 = safeAdd(h0, a);
202 h1 = safeAdd(h1, b);
203 h2 = safeAdd(h2, c);
204 h3 = safeAdd(h3, d);
205 h4 = safeAdd(h4, e);
206 h5 = safeAdd(h5, f);
207 h6 = safeAdd(h6, g);
208 h7 = safeAdd(h7, h);
209
210 currentMessageIndex += bytesPerBlock;
211 }
212
213 result = new Array(256/8);
214 result[0] = (h0 >> 24)& 0xff;
215 result[1] = (h0 >> 16)& 0xff;
216 result[2] = (h0 >> 8)& 0xff;
217 result[3] = h0 & 0xff;
218
219 result[4] = (h1 >> 24)& 0xff;
220 result[5] = (h1 >> 16)& 0xff;
221 result[6] = (h1 >> 8)& 0xff;
222 result[7] = h1 & 0xff;
223
224 result[8] = (h2 >> 24)& 0xff;
225 result[9] = (h2 >> 16)& 0xff;
226 result[10] = (h2 >> 8)& 0xff;
227 result[11] = h2 & 0xff;
228
229 result[12] = (h3 >> 24)& 0xff;
230 result[13] = (h3 >> 16)& 0xff;
231 result[14] = (h3 >> 8)& 0xff;
232 result[15] = h3 & 0xff;
233
234 result[16] = (h4 >> 24)& 0xff;
235 result[17] = (h4 >> 16)& 0xff;
236 result[18] = (h4 >> 8)& 0xff;
237 result[19] = h4 & 0xff;
238
239 result[20] = (h5 >> 24)& 0xff;
240 result[21] = (h5 >> 16)& 0xff;
241 result[22] = (h5 >> 8)& 0xff;
242 result[23] = h5 & 0xff;
243
244 result[24] = (h6 >> 24)& 0xff;
245 result[25] = (h6 >> 16)& 0xff;
246 result[26] = (h6 >> 8)& 0xff;
247 result[27] = h6 & 0xff;
248
249 result[28] = (h7 >> 24)& 0xff;
250 result[29] = (h7 >> 16)& 0xff;
251 result[30] = (h7 >> 8)& 0xff;
252 result[31] = h7 & 0xff;
253
254//Clipperz.Profile.stop("Clipperz.Crypto.SHA.sha256_array");
255 return result;
256 },
257
258 //-----------------------------------------------------------------------------
259
260 'sha256': function(aValue) {
261//Clipperz.Profile.start("Clipperz.Crypto.SHA.sha256");
262 var result;
263 var resultArray;
264 varvalueArray;
265
266 valueArray = aValue.arrayValues();
267 resultArray = Clipperz.Crypto.SHA.sha256_array(valueArray);
268
269 result = new Clipperz.ByteArray(resultArray);
270
271//Clipperz.Profile.stop("Clipperz.Crypto.SHA.sha256");
272 return result;
273 },
274
275 //-----------------------------------------------------------------------------
276
277 'sha_d256': function(aValue) {
278//Clipperz.Profile.start("Clipperz.Crypto.SHA.sha_d256");
279 var result;
280 var resultArray;
281 varvalueArray;
282
283 valueArray = aValue.arrayValues();
284 resultArray = Clipperz.Crypto.SHA.sha256_array(valueArray);
285 resultArray = Clipperz.Crypto.SHA.sha256_array(resultArray);
286
287 result = new Clipperz.ByteArray(resultArray);
288
289//Clipperz.Profile.stop("Clipperz.Crypto.SHA.sha256");
290 return result;
291 },
292
293 //-----------------------------------------------------------------------------
294 __syntaxFix__: "syntax fix"
295
296});
diff --git a/frontend/beta/js/Clipperz/Crypto/SRP.js b/frontend/beta/js/Clipperz/Crypto/SRP.js
new file mode 100644
index 0000000..0eef6ec
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Crypto/SRP.js
@@ -0,0 +1,331 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!";
31}
32
33try { if (typeof(Clipperz.Crypto.BigInt) == 'undefined') { throw ""; }} catch (e) {
34 throw "Clipperz.Crypto.SRP depends on Clipperz.Crypto.BigInt!";
35}
36
37try { if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { throw ""; }} catch (e) {
38 throw "Clipperz.Crypto.SRP depends on Clipperz.Crypto.PRNG!";
39}
40
41if (typeof(Clipperz.Crypto.SRP) == 'undefined') { Clipperz.Crypto.SRP = {}; }
42
43Clipperz.Crypto.SRP.VERSION = "0.1";
44Clipperz.Crypto.SRP.NAME = "Clipperz.Crypto.SRP";
45
46//#############################################################################
47
48MochiKit.Base.update(Clipperz.Crypto.SRP, {
49
50 '_n': null,
51 '_g': null,
52 //-------------------------------------------------------------------------
53
54 'n': function() {
55 if (Clipperz.Crypto.SRP._n == null) {
56 Clipperz.Crypto.SRP._n = new Clipperz.Crypto.BigInt("115b8b692e0e045692cf280b436735c77a5a9e8a9e7ed56c965f87db5b2a2ece3", 16);
57 }
58
59 return Clipperz.Crypto.SRP._n;
60 },
61
62 //-------------------------------------------------------------------------
63
64 'g': function() {
65 if (Clipperz.Crypto.SRP._g == null) {
66 Clipperz.Crypto.SRP._g = new Clipperz.Crypto.BigInt(2); //eventually 5 (as suggested on the Diffi-Helmann documentation)
67 }
68
69 return Clipperz.Crypto.SRP._g;
70 },
71
72 //-----------------------------------------------------------------------------
73
74 'exception': {
75 'InvalidValue': new MochiKit.Base.NamedError("Clipperz.Crypto.SRP.exception.InvalidValue")
76 },
77
78 //-------------------------------------------------------------------------
79 __syntaxFix__: "syntax fix"
80
81});
82
83//#############################################################################
84//
85 // S R P C o n n e c t i o n version 1.0
86//
87//=============================================================================
88Clipperz.Crypto.SRP.Connection = function (args) {
89 args = args || {};
90
91 this._C = args.C;
92 this._P = args.P;
93 this.hash = args.hash;
94
95 this._a = null;
96 this._A = null;
97
98 this._s = null;
99 this._B = null;
100
101 this._x = null;
102
103 this._u = null;
104 this._K = null;
105 this._M1 = null;
106 this._M2 = null;
107
108 this._sessionKey = null;
109
110 return this;
111}
112
113Clipperz.Crypto.SRP.Connection.prototype = MochiKit.Base.update(null, {
114
115 'toString': function () {
116 return "Clipperz.Crypto.SRP.Connection (username: " + this.username() + "). Status: " + this.statusDescription();
117 },
118
119 //-------------------------------------------------------------------------
120
121 'C': function () {
122 return this._C;
123 },
124
125 //-------------------------------------------------------------------------
126
127 'P': function () {
128 return this._P;
129 },
130
131 //-------------------------------------------------------------------------
132
133 'a': function () {
134 if (this._a == null) {
135 this._a = new Clipperz.Crypto.BigInt(Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2), 16);
136 // this._a = new Clipperz.Crypto.BigInt("37532428169486597638072888476611365392249575518156687476805936694442691012367", 10);
137//MochiKit.Logging.logDebug("SRP a: " + this._a);
138 }
139
140 return this._a;
141 },
142
143 //-------------------------------------------------------------------------
144
145 'A': function () {
146 if (this._A == null) {
147 //Warning: this value should be strictly greater than zero: how should we perform this check?
148 this._A = Clipperz.Crypto.SRP.g().powerModule(this.a(), Clipperz.Crypto.SRP.n());
149
150 if (this._A.equals(0)) {
151MochiKit.Logging.logError("Clipperz.Crypto.SRP.Connection: trying to set 'A' to 0.");
152 throw Clipperz.Crypto.SRP.exception.InvalidValue;
153 }
154//MochiKit.Logging.logDebug("SRP A: " + this._A);
155 }
156
157 return this._A;
158 },
159
160 //-------------------------------------------------------------------------
161
162 's': function () {
163 return this._s;
164//MochiKit.Logging.logDebug("SRP s: " + this._S);
165 },
166
167 'set_s': function(aValue) {
168 this._s = aValue;
169 },
170
171 //-------------------------------------------------------------------------
172
173 'B': function () {
174 return this._B;
175 },
176
177 'set_B': function(aValue) {
178 //Warning: this value should be strictly greater than zero: how should we perform this check?
179 if (! aValue.equals(0)) {
180 this._B = aValue;
181//MochiKit.Logging.logDebug("SRP B: " + this._B);
182 } else {
183MochiKit.Logging.logError("Clipperz.Crypto.SRP.Connection: trying to set 'B' to 0.");
184 throw Clipperz.Crypto.SRP.exception.InvalidValue;
185 }
186 },
187
188 //-------------------------------------------------------------------------
189
190 'x': function () {
191 if (this._x == null) {
192 this._x = new Clipperz.Crypto.BigInt(this.stringHash(this.s().asString(16, 64) + this.P()), 16);
193//MochiKit.Logging.logDebug("SRP x: " + this._x);
194 }
195
196 return this._x;
197 },
198
199 //-------------------------------------------------------------------------
200
201 'u': function () {
202 if (this._u == null) {
203 this._u = new Clipperz.Crypto.BigInt(this.stringHash(this.B().asString()), 16);
204//MochiKit.Logging.logDebug("SRP u: " + this._u);
205 }
206
207 return this._u;
208 },
209
210 //-------------------------------------------------------------------------
211
212 'S': function () {
213 if (this._S == null) {
214 var bigint;
215 varsrp;
216
217 bigint = Clipperz.Crypto.BigInt;
218 srp = Clipperz.Crypto.SRP;
219
220 this._S =bigint.powerModule(
221 bigint.subtract(this.B(), bigint.powerModule(srp.g(), this.x(), srp.n())),
222 bigint.add(this.a(), bigint.multiply(this.u(), this.x())),
223 srp.n()
224 )
225//MochiKit.Logging.logDebug("SRP S: " + this._S);
226 }
227
228 return this._S;
229 },
230
231 //-------------------------------------------------------------------------
232
233 'K': function () {
234 if (this._K == null) {
235 this._K = this.stringHash(this.S().asString());
236//MochiKit.Logging.logDebug("SRP K: " + this._K);
237 }
238
239 return this._K;
240 },
241
242 //-------------------------------------------------------------------------
243
244 'M1': function () {
245 if (this._M1 == null) {
246 this._M1 = this.stringHash(this.A().asString(10) + this.B().asString(10) + this.K());
247//MochiKit.Logging.logDebug("SRP M1: " + this._M1);
248 }
249
250 return this._M1;
251 },
252
253 //-------------------------------------------------------------------------
254
255 'M2': function () {
256 if (this._M2 == null) {
257 this._M2 = this.stringHash(this.A().asString(10) + this.M1() + this.K());
258//MochiKit.Logging.logDebug("SRP M2: " + this._M2);
259 }
260
261 return this._M2;
262 },
263
264 //=========================================================================
265
266 'serverSideCredentialsWithSalt': function(aSalt) {
267 var result;
268 var s, x, v;
269
270 s = aSalt;
271 x = this.stringHash(s + this.P());
272 v = Clipperz.Crypto.SRP.g().powerModule(new Clipperz.Crypto.BigInt(x, 16), Clipperz.Crypto.SRP.n());
273
274 result = {};
275 result['C'] = this.C();
276 result['s'] = s;
277 result['v'] = v.asString(16);
278
279 return result;
280 },
281
282 'serverSideCredentials': function() {
283 var result;
284 var s;
285
286 s = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2);
287
288 result = this.serverSideCredentialsWithSalt(s);
289
290 return result;
291 },
292
293 //=========================================================================
294/*
295 'computeServerSide_S': function(b) {
296 var result;
297 var v;
298 var bigint;
299 varsrp;
300
301 bigint = Clipperz.Crypto.BigInt;
302 srp = Clipperz.Crypto.SRP;
303
304 v = new Clipperz.Crypto.BigInt(srpConnection.serverSideCredentialsWithSalt(this.s().asString(16, 64)).v, 16);
305 // _S = (this.A().multiply(this.v().modPow(this.u(), this.n()))).modPow(this.b(), this.n());
306 result = bigint.powerModule(
307 bigint.multiply(
308 this.A(),
309 bigint.powerModule(v, this.u(), srp.n())
310 ), new Clipperz.Crypto.BigInt(b, 10), srp.n()
311 );
312
313 return result;
314 },
315*/
316 //=========================================================================
317
318 'stringHash': function(aValue) {
319 varresult;
320
321 result = this.hash(new Clipperz.ByteArray(aValue)).toHexString().substring(2);
322
323 return result;
324 },
325
326 //=========================================================================
327 __syntaxFix__: "syntax fix"
328
329});
330
331//#############################################################################
diff --git a/frontend/beta/js/Clipperz/DOM.js b/frontend/beta/js/Clipperz/DOM.js
new file mode 100644
index 0000000..7c27359
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/DOM.js
@@ -0,0 +1,131 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.DOM) == 'undefined') { Clipperz.DOM = {}; }
31
32Clipperz.DOM.VERSION = "0.1";
33Clipperz.DOM.NAME = "Clipperz.DOM";
34
35MochiKit.Base.update(Clipperz.DOM, {
36
37 //-------------------------------------------------------------------------
38
39 '__repr__': function () {
40 return "[" + this.NAME + " " + this.VERSION + "]";
41 },
42
43 //-------------------------------------------------------------------------
44
45 'toString': function () {
46 return this.__repr__();
47 },
48
49 //-------------------------------------------------------------------------
50
51 'selectOptionMatchingValue': function (aSelectElement, aValue, shouldUseCaseInsensitiveTest) {
52 var selectedOptionIndex;
53 var i, c;
54
55 selectedOptionIndex = -1;
56
57 c = aSelectElement.options.length;
58 for (i=0; (i<c) && (selectedOptionIndex == -1); i++) {
59 if (shouldUseCaseInsensitiveTest == true) {
60 if (aSelectElement.options[i].value.toLowerCase() == aValue.toLowerCase()) {
61 selectedOptionIndex = i;
62 }
63 } else {
64 if (aSelectElement.options[i].value == aValue) {
65 selectedOptionIndex = i;
66 }
67 }
68 }
69
70 if (selectedOptionIndex != -1) {
71 aSelectElement.selectedIndex = selectedOptionIndex;
72 }
73 },
74
75 //-------------------------------------------------------------------------
76
77 'setFormContents': function(aNode, someValues) {
78 var node;
79 var values;
80 var i, c;
81
82 values = {};
83 c = someValues[0].length;
84 for (i=0; i<c; i++) {
85 values[someValues[0][i]] = someValues[1][i];
86 }
87
88 // var m = MochiKit.Base;
89 // var self = MochiKit.DOM;
90 if (typeof(aNode) == "undefined" || aNode === null) {
91 node = MochiKit.DOM._document.body;
92 } else {
93 node = MochiKit.DOM.getElement(aNode);
94 }
95
96 MochiKit.Base.nodeWalk(node, function(aNode) {
97 var result;
98 var name;
99
100 result = null;
101 name = aNode.name;
102 if (MochiKit.Base.isNotEmpty(name) && (typeof(values[name]) != 'undefined')) {
103 var tagName;
104
105 tagName = aNode.tagName.toUpperCase();
106 if (tagName === "INPUT" && (aNode.type == "radio" || aNode.type == "checkbox")) {
107 aNode.checked = values[name];
108 } else if (tagName === "SELECT") {
109 if (aNode.type == "select-one") {
110 Clipperz.DOM.selectOptionMatchingValue(aNode, values[name]);
111 } else { //aNode.type == "select-multiple"
112MochiKit.Logging.logWarning("### unhandled Select.type = 'select-multiple' condition");
113 }
114 } else if (tagName === "FORM" || tagName === "P" || tagName === "SPAN" || tagName === "DIV") {
115 result = aNode.childNodes;
116 } else {
117 aNode.value = values[name]
118 }
119 } else {
120 result = aNode.childNodes;
121 }
122
123 return result;
124 });
125 },
126
127 //-------------------------------------------------------------------------
128 __syntaxFix__: "syntax fix"
129
130});
131
diff --git a/frontend/beta/js/Clipperz/Date.js b/frontend/beta/js/Clipperz/Date.js
new file mode 100644
index 0000000..4103b88
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Date.js
@@ -0,0 +1,305 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.Date) == 'undefined') { Clipperz.Date = {}; }
31
32Clipperz.Date.VERSION = "0.1";
33Clipperz.Date.NAME = "Clipperz.Date";
34
35MochiKit.Base.update(Clipperz.Date, {
36
37 //-------------------------------------------------------------------------
38
39 '__repr__': function () {
40 return "[" + this.NAME + " " + this.VERSION + "]";
41 },
42
43 //-------------------------------------------------------------------------
44
45 'toString': function () {
46 return this.__repr__();
47 },
48
49 //-------------------------------------------------------------------------
50
51 'daysInMonth': [31,28,31,30,31,30,31,31,30,31,30,31],
52
53 //-------------------------------------------------------------------------
54
55 'englishOrdinalDaySuffixForDate': function(aDate) {
56 var result;
57
58 switch (aDate.getDate()) {
59 case 1:
60 case 21:
61 case 31:
62 result = "st";
63 break;
64 case 2:
65 case 22:
66 result = "nd";
67 break;
68 case 3:
69 case 23:
70 result = "rd";
71 break;
72 default:
73 result = "th";
74 break;
75 }
76
77 return result;
78 },
79
80 //-------------------------------------------------------------------------
81
82 'isLeapYear': function(aDate) {
83 var year;
84 var result;
85
86 year = aDate.getFullYear();
87 result = ((year & 0x03) == 0 && (year % 100 || (year % 400 == 0 && year)));
88
89 return result;
90 },
91
92 //-------------------------------------------------------------------------
93
94 'getDaysInMonth': function(aDate) {
95 var result;
96
97 if (aDate.getMonth() == 1) {
98 Clipperz.Date.isLeapYear(aDate)
99 result += Clipperz.Date.isLeapYear(aDate) ? 29 : 28;
100 } else {
101 result = Clipperz.Date.daysInMonth[aDate.getMonth()];
102 }
103
104 return result;
105 },
106
107 //-------------------------------------------------------------------------
108
109 'getTimezone': function(aDate) {
110 var result;
111
112 result = aDate.toString();
113 result = result.replace(/([A-Z]{3}) [0-9]{4}/, '$1');
114 result = result.replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, "$1$2$3");
115
116 return result;
117 },
118
119 'getGMTOffset': function(aDate) {
120 return (aDate.getTimezoneOffset() > 0 ? "-" : "+")+ MochiKit.Format.numberFormatter('00')(Math.floor(this.getTimezoneOffset() / 60))
121 + MochiKit.Format.numberFormatter('00')(this.getTimezoneOffset() % 60);
122 },
123
124 //-------------------------------------------------------------------------
125
126 'dayOfYear': function(aDate) {
127 var result;
128 var i,c;
129
130 result = 0;
131 c = aDate.getMonth();
132 for (i=0; i<c; i++) {
133 if (i == 1) {
134 result += Clipperz.Date.isLeapYear(aDate) ? 29 : 28;
135 } else {
136 result += Clipperz.Date.daysInMonth[i];
137 }
138 }
139 return num + this.getDate() - 1;
140 },
141
142 //-------------------------------------------------------------------------
143
144 'getPHPLikeFormatCode': function(aCharacter) {
145 var result;
146
147 switch (aCharacter) {
148 case "d":
149 result = " + MochiKit.Format.numberFormatter('00')(aDate.getDate())";
150 break;
151 case "D":
152 result = " + aLocale['shortDays'][aDate.getDay()]";
153 break;
154 case "j":
155 result = " + aDate.getDate()";
156 break;
157 case "l":
158 result = " + aLocale['days'][aDate.getDay()]";
159 break;
160 case "S":
161 result = " + Clipperz.Date.englishOrdinalDaySuffixForDate(aDate)";
162 break;
163 case "w":
164 result = " + aDate.getDay()";
165 break;
166 case "z":
167 result = " + aDate.getDayOfYear()";
168 break;
169 case "W":
170 result = " + aDate.getWeekOfYear()";
171 break;
172 case "F":
173 result = " + aLocale['months'][aDate.getMonth()]";
174 break;
175 case "m":
176 result = " + MochiKit.Format.numberFormatter('00')(aDate.getMonth() + 1)";
177 break;
178 case "M":
179 result = " + aLocale['shortMonths'][aDate.getMonth()]";
180 break;
181 case "n":
182 result = " + (aDate.getMonth() + 1)";
183 break;
184 case "t":
185 result = " + Clipperz.Date.getDaysInMonth(aDate)";
186 break;
187 case "L":
188 result = " + (Clipperz.Date.isLeapYear(aDate) ? 1 : 0)";
189 break;
190 case "Y":
191 result = " + aDate.getFullYear()";
192 break;
193 case "y":
194 result = " + ('' + aDate.getFullYear()).substring(2, 4)";
195 break;
196 case "a":
197 result = " + (aDate.getHours() < 12 ? aLocale['amDesignation'] : aLocale['pmDesignation'])";
198 break;
199 case "A":
200 result = " + (aDate.getHours() < 12 ? aLocale['amDesignation'].toUpperCase() : aLocale['pmDesignation'].toUpperCase())";
201 break;
202 case "g":
203 result = " + ((aDate.getHours() %12) ? aDate.getHours() % 12 : 12)";
204 break;
205 case "G":
206 result = " + aDate.getHours()";
207 break;
208 case "h":
209 result = " + MochiKit.Format.numberFormatter('00')((aDate.getHours() %12) ? aDate.getHours() % 12 : 12)";
210 break;
211 case "H":
212 result = " + MochiKit.Format.numberFormatter('00')(aDate.getHours())";
213 break;
214 case "i":
215 result = " + MochiKit.Format.numberFormatter('00')(aDate.getMinutes())";
216 break;
217 case "s":
218 result = " + MochiKit.Format.numberFormatter('00')(aDate.getSeconds())";
219 break;
220 case "O":
221 result = " + aDate.getGMTOffset()";
222 break;
223 case "T":
224 result = " + Clipperz.Date.getTimezone(aDate)";
225 break;
226 case "Z":
227 result = " + ( + aDate.getTimezoneOffset() * -60)";
228 break;
229 default:
230 result = " + '" + aCharacter + "'";
231 break;
232 };
233
234 return result;
235 },
236
237 //=========================================================================
238
239 'formatDateWithPHPLikeTemplateAndLocale': function(aDate, aFormat, aLocale) {
240 var result;
241 var formatterCode;
242 var formatter;
243 var i,c;
244
245//MochiKit.Logging.logDebug(">>> Clipperz.Date.formatDateWithPHPLikeTemplateAndLocale");
246 formatterCode = "Clipperz.Date.__scratchFormatter = function(aDate, aLocale){return ''";
247
248 c = aFormat.length;
249 i = 0;
250
251 while (i<c) {
252 var character;
253
254 character = aFormat.charAt(i);
255 if (character == "\\") {
256 i++;
257 character = aFormat.charAt(i);
258 formatterCode += " + '" + character + "'"
259 } else {
260 formatterCode += Clipperz.Date.getPHPLikeFormatCode(character);
261 }
262
263 i++;
264 }
265
266 formatterCode += ";}";
267//MochiKit.Logging.logDebug("--- Clipperz.Date.formatDateWithPHPLikeTemplateAndLocale - formatterCode: " + formatterCode);
268 eval(formatterCode);
269
270 result = Clipperz.Date.__scratchFormatter.call(this, aDate, aLocale);
271 delete Clipperz.Date.__scratchFormatter;
272//MochiKit.Logging.logDebug("<<< Clipperz.Date.formatDateWithPHPLikeTemplateAndLocale");
273
274 return result;
275 },
276
277 //-------------------------------------------------------------------------
278
279 'parseDateWithPHPLikeTemplateAndLocale': function(aString, aFormat, aLocale) {
280 return new Date();
281 },
282
283 //=========================================================================
284
285 'formatDateWithUTCFormatAndLocale': function(aDate, aLocale) {
286 // return Clipperz.Date.formatWithJavaLikeTemplateAndLocale(aDate, "EEE, dd MMMM yyyy HH:mm:ss zzz", aLocale);
287 return aDate.toString();
288 },
289
290 'parseDateWithUTCFormatAndLocale': function(aValue, aLocale) {
291 return new Date(Date.parse(aValue));
292 },
293
294 //=========================================================================
295
296 'exception': {
297 // 'AbstractMethod': new MochiKit.Base.NamedError("Clipperz.Base.exception.AbstractMethod"),
298 // 'UnknownType': new MochiKit.Base.NamedError("Clipperz.Base.exception.UnknownType")
299 },
300
301 //-------------------------------------------------------------------------
302 __syntaxFix__: "syntax fix"
303
304});
305
diff --git a/frontend/beta/js/Clipperz/KeePassExportProcessor.js b/frontend/beta/js/Clipperz/KeePassExportProcessor.js
new file mode 100644
index 0000000..ba56b8e
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/KeePassExportProcessor.js
@@ -0,0 +1,251 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30
31
32Clipperz.KeePassExportProcessor = function(args) {
33 args = args || {};
34
35 return this;
36}
37
38//=============================================================================
39
40Clipperz.KeePassExportProcessor.prototype = MochiKit.Base.update(null, {
41
42 //-------------------------------------------------------------------------
43/*
44 'parse': function(aValue) {
45 var result;
46
47//MochiKit.Logging.logDebug(">>> KeePassExportProcessor.parse");
48 result = [];
49//MochiKit.Logging.logDebug("--- KeePassExportProcessor.parse - result: " + Clipperz.Base.serializeJSON(result));
50//MochiKit.Logging.logDebug("<<< KeePassExportProcessor.parse");
51
52 return result;
53 },
54*/
55 //-------------------------------------------------------------------------
56
57 'deferredParse_core': function(aContext) {
58 var deferredResult;
59
60 //MochiKit.Logging.logDebug(">>> KeePassExportProcessor.deferredParse_core");
61 //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse_core - (1) aContext.line: " + aContext.line.replace(/\n/g, "\\n").substring(0,50));
62 //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse_core - aContext: " + Clipperz.Base.serializeJSON(aContext).substring(0,50));
63 //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse_core - (2) aContext.line: " + aContext.line.replace(/\n/g, "\\n").substring(0,50));
64//console.log("deferredParse_core - aContext", aContext);
65 //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse_core - (3) aContext.line: " + aContext.line.replace(/\n/g, "\\n").substring(0,50));
66 if (aContext.line == "") {
67 deferredResult = MochiKit.Async.succeed(aContext.result);
68 } else {
69 var record;
70
71 record = this.parseRecord(aContext);
72 if (record != null) {
73 aContext.result.push(record);
74 }
75
76 //MochiKit.Logging.logDebug("--> KeePassExportProcessor.deferredParse_core - aContext.line: " + aContext.line.replace(/\n/g, "\\n").substring(0,50));
77 aContext.line = aContext.line.replace(/^\n*/g, "").replace(/\n$/g, "");
78 //MochiKit.Logging.logDebug("<-- KeePassExportProcessor.deferredParse_core - aContext.line: " + aContext.line.replace(/\n/g, "\\n").substring(0,50));
79
80 deferredResult = new MochiKit.Async.Deferred();
81//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse_core - 1.1 " + res); return res;});
82 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'importProcessorProgressUpdate', {status:'processing', size:aContext.size, progress:(aContext.size - aContext.line.length)});
83//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse_core - 1.2 " + res); return res;});
84 deferredResult.addCallback(MochiKit.Async.wait, 0.2);
85//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse_core - 1.3 " + res); return res;});
86//deferredResult.addBoth(function(res) {console.log("KeePassExportProcessor.deferredParse_core - 1.3 ", res); return res;});
87 deferredResult.addCallback(MochiKit.Base.method(this, 'deferredParse_core'))
88//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse_core - 1.4 " + res); return res;});
89 deferredResult.callback(aContext);
90 }
91 //MochiKit.Logging.logDebug("<<< KeePassExportProcessor.deferredParse_core");
92
93 return deferredResult;
94 },
95
96 //.........................................................................
97
98 'deferredParse': function(aValue) {
99 var deferredResult;
100 var lines;
101 var context;
102
103//MochiKit.Logging.logDebug(">>> KeePassExportProcessor.deferredParse");
104//MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse - aValue: " + aValue.length);
105 lines = aValue.replace(/\r?\n/g, "\n");
106//MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse - lines: " + lines.length);
107 context = {
108 line: lines,
109 size: lines.length,
110 result: []
111 }
112//MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse - context: " + Clipperz.Base.serializeJSON(context).substring(0,50));
113//console.log("--- KeePassExportProcessor.deferredParse - context: ", context);
114
115 deferredResult = new MochiKit.Async.Deferred();
116//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse - 1 " + res); return res;});
117//deferredResult.addBoth(function(res) {console.log("KeePassExportProcessor.deferredParse - 1 ", res); return res;});
118 deferredResult.addCallback(MochiKit.Base.method(this, 'deferredParse_core'));
119//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse - 2 " + res); return res;});
120 deferredResult.callback(context);
121//MochiKit.Logging.logDebug("<<< KeePassExportProcessor.deferredParse");
122
123 return deferredResult;
124 },
125
126 //-------------------------------------------------------------------------
127
128 'parseRecord': function(aContext) {
129 var result;
130 var recordLabelRegexp;
131 varfieldLabelRegexp;
132 var fieldValueRegexp;
133 var fullLineRegexp;
134/*
135[Record name]
136Group Tree:
137UserName:
138URL:
139Password:
140Notes: test
141UUID: 525f62430079bae48b79ed2961924b05
142Icon: 0
143Creation Time: 2007-06-26 17:56:03
144Last Access: 2007-10-25 16:23:51
145Last Modification: 2007-10-25 16:23:51
146Expires: 2999-12-28 23:59:59
147
148 [Record name] ==> Title
149 Group: General ==> Group
150 Group Tree: ==> Group Tree
151 UserName: ==> UserName
152 URL: ==>URL
153 Password: ==>Password
154 Notes: test ==>Notes
155 UUID: 525f62430079bae48b79ed2961924b05 ==>UUID
156 Icon: 0 ==>Icon
157 Creation Time: 2007-06-26 17:56:03 ==>Creation Time
158 Last Access: 2007-10-25 16:23:51 ==>Last Access
159 Last Modification: 2007-10-25 16:23:51 ==>Last Modification
160 Expires: 2999-12-28 23:59:59 ==> Expires
161 Attachment Description: ==> Attachment Description
162 Attachment: ==> Attachment
163*/
164 recordLabelRegexp = new RegExp("^\\[(.*)\\]\\n");
165 // recordLabelRegexp = new RegExp("^\\[(.*)\\]$", "m");
166 fieldLabelRegexp = new RegExp("^(Group|Group Tree|UserName|URL|Password|Notes|UUID|Icon|Creation Time|Last Access|Last Modification|Expires|Attachment Description|Attachment|Valid until): ");
167 fieldValueRegexp = new RegExp("(.*)(\\n|$)");
168 fullLineRegexp = new RegExp("^(.*\\n)");
169
170
171 if (recordLabelRegexp.test(aContext.line) == true) {
172 var line;
173
174//MochiKit.Logging.logDebug("1.0");
175 line = aContext.line;
176//MochiKit.Logging.logDebug("0 - line: " + line.replace(/\n/g, "\\n").substring(0,50));
177
178 result = {};
179 result['Title'] = line.match(recordLabelRegexp)[1];
180//MochiKit.Logging.logDebug("1 - title: " + result['Title']);
181 line = line.replace(/^.*\n/, "");
182//MochiKit.Logging.logDebug("2 - line: " + line.replace(/\n/g, "\\n").substring(0,50));
183//MochiKit.Logging.logDebug("=======================================");
184 while (fieldLabelRegexp.test(line) == true) {
185 var fieldName;
186 var fieldValue;
187
188 fieldName = RegExp.$1;
189//MochiKit.Logging.logDebug("3 - fieldName: " + fieldName);
190 line = RegExp.rightContext;
191//MochiKit.Logging.logDebug("4 - line: " + line.replace(/\n/g, "\\n").substring(0,50));
192
193 fieldValue = line.match(fieldValueRegexp)[1];
194//MochiKit.Logging.logDebug("5 - fieldValue: " + fieldValue);
195 line = RegExp.rightContext;
196//MochiKit.Logging.logDebug("6 - line: " + line.replace(/\n/g, "\\n").substring(0,50));
197
198 if (fieldName == 'Notes') {
199 var isMultiline;
200
201 isMultiline = false;
202
203//MochiKit.Logging.logDebug("7 - fieldLabelRegexp.test(line): " + fieldLabelRegexp.test(line) + " - recordLabelRegexp.test(line): " + recordLabelRegexp.test(line));
204 if ((line != "") && (fieldLabelRegexp.test(line) == false) && (recordLabelRegexp.test(line) == false)) {
205 fieldValue += '\n';
206 }
207
208 while ((line != "") && (fieldLabelRegexp.test(line) == false) && (recordLabelRegexp.test(line) == false)) {
209 var newLineValue;
210
211 newLineValue = line.match(fullLineRegexp)[1];
212 if (newLineValue != "\n") {
213 isMultiline = true;
214 }
215 fieldValue += newLineValue;
216//MochiKit.Logging.logDebug("8 - fieldValue: " + fieldValue);
217 line = RegExp.rightContext;
218//MochiKit.Logging.logDebug("9 - line: " + line.replace(/\n/g, "\\n").substring(0,50));
219//MochiKit.Logging.logDebug("10 - fieldLabelRegexp.test(line): " + fieldLabelRegexp.test(line) + " - recordLabelRegexp.test(line): " + recordLabelRegexp.test(line));
220 }
221
222 if (isMultiline) {
223 fieldValue = fieldValue.replace(/\n$/g, "");
224 } else {
225 fieldValue = fieldValue.replace(/\n\n$/g, "");
226 }
227
228 line = line.replace(/^\n/, '');
229 }
230//MochiKit.Logging.logDebug("5 - fieldValue: " + fieldValue);
231
232 result[fieldName] = fieldValue;
233//MochiKit.Logging.logDebug("6 - line: " + line.replace(/\n/g, "\\n").substring(0,50));
234//MochiKit.Logging.logDebug("---------------------------------------");
235 }
236 } else {
237//MochiKit.Logging.logDebug("2.0");
238 result = null;
239 }
240
241 aContext.line = line;
242//MochiKit.Logging.logDebug("#######################################");
243
244 return result;
245 },
246
247 //-------------------------------------------------------------------------
248 __syntaxFix__: "syntax fix"
249});
250
251
diff --git a/frontend/beta/js/Clipperz/NotificationCenter.js b/frontend/beta/js/Clipperz/NotificationCenter.js
new file mode 100644
index 0000000..815d4fd
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/NotificationCenter.js
@@ -0,0 +1,325 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.NotificationCenter) == 'undefined') { Clipperz.NotificationCenter = {}; }
31
32
33//#############################################################################
34
35Clipperz.NotificationCenterEvent = function(args) {
36 args = args || {};
37 //MochiKit.Base.bindMethods(this);
38
39 this._source = args.source || null;
40 this._event = args.event || null;
41 this._parameters = args.parameters || null;
42 this._isSynchronous = args.isSynchronous || false;
43
44 return this;
45}
46
47//=============================================================================
48
49Clipperz.NotificationCenterEvent.prototype = MochiKit.Base.update(null, {
50
51 //-------------------------------------------------------------------------
52
53 'toString': function() {
54 return "Clipperz.NotificationCenterEvent";
55 //return "Clipperz.NotificationCenterEvent {source: " + this.source() + ", event: " + this.event() + ", parameters: " + this.parameters() + "}";
56 },
57
58 //-------------------------------------------------------------------------
59
60 'source': function() {
61 return this._source;
62 },
63
64 'setSource': function(aValue) {
65 this._source = aValue;
66 },
67
68 //-------------------------------------------------------------------------
69
70 'event': function() {
71 return this._event;
72 },
73
74 'setEvent': function(aValue) {
75 this._event = aValue;
76 },
77
78 //-------------------------------------------------------------------------
79
80 'parameters': function() {
81 return this._parameters;
82 },
83
84 'setParameters': function(aValue) {
85 this._parameters = aValue;
86 },
87
88 //-------------------------------------------------------------------------
89
90 'isSynchronous': function() {
91 return this._isSynchronous;
92 },
93
94 //-------------------------------------------------------------------------
95 __syntaxFix__: "syntax fix"
96});
97
98
99//#############################################################################
100//#############################################################################
101
102Clipperz.NotificationCenter = function(args) {
103 args = args || {};
104 //MochiKit.Base.bindMethods(this);
105
106 this._listeners = {};
107 this._useSynchronousListenerInvocation = args.useSynchronousListenerInvocation || false;
108 this._timeoutDelay = args.timeoutDelay || 0.1;
109
110 return this;
111}
112
113//=============================================================================
114
115Clipperz.NotificationCenter.prototype = MochiKit.Base.update(null, {
116
117 //-------------------------------------------------------------------------
118
119 'toString': function() {
120 return "Clipperz.NotificationCenter";
121 },
122
123 //-------------------------------------------------------------------------
124
125 'useSynchronousListenerInvocation': function() {
126 return this._useSynchronousListenerInvocation;
127 },
128
129 'setUseSynchronousListenerInvocation': function(aValue) {
130 this._useSynchronousListenerInvocation = aValue;
131 },
132
133 //-------------------------------------------------------------------------
134
135 'timeoutDelay': function() {
136 return this._timeoutDelay;
137 },
138
139 'setTimeoutDelay': function(aValue) {
140 this._timeoutDelay = aValue;
141 },
142
143 //-------------------------------------------------------------------------
144
145 'listeners': function() {
146 return this._listeners;
147 },
148
149 //-------------------------------------------------------------------------
150
151 'register': function(aSource, anEvent, aListener, aMethod) {
152 vareventListeners;
153 varlistenerInfo;
154 vareventKey;
155
156 if (anEvent != null) {
157 eventKey = anEvent;
158 } else {
159 eventKey = '_notificationCenter_matchAnyEvent_key_';
160 }
161
162 eventListeners = this.listeners()[eventKey];
163
164 if (eventListeners == null) {
165 eventListeners = [];
166 this.listeners()[eventKey] = eventListeners;
167 }
168
169 listenerInfo = {};
170 if (aSource != null) {
171 listenerInfo['source'] = aSource;
172 } else {
173 listenerInfo['source'] = 'any';
174 }
175
176 listenerInfo['listener'] = aListener;
177 listenerInfo['method'] = aMethod;
178
179 eventListeners.push(listenerInfo);
180
181 return listenerInfo;
182 },
183
184 //-------------------------------------------------------------------------
185
186 'removeListenerInfoFromListeners': function(aListener, someListeners) {
187 varlistenerIndex;
188 vari,c;
189
190 if (someListeners != null) {
191 listenerIndex = -1;
192 c = someListeners.length;
193 for (i=0; i<c; i++) {
194 varlistenerInfo;
195
196 listenerInfo = someListeners[i];
197 if (listenerInfo['listener'] === aListener) {
198 listenerIndex = i;
199 }
200 }
201
202 if (listenerIndex != -1) {
203 Clipperz.Base.removeObjectAtIndexFromArray(listenerIndex, someListeners);
204 }
205 }
206 },
207
208 //-------------------------------------------------------------------------
209
210 'unregister': function(aListener, anEvent) {
211 if (anEvent == null) {
212 varallListenerList;
213 vari, c;
214
215 // allListenerList = Clipperz.Base.values(this.listeners());
216 allListenerList = MochiKit.Base.values(this.listeners());
217 c = allListenerList.length;
218 for (i=0; i<c; i++) {
219 this.removeListenerInfoFromListeners(aListener, allListenerList[i]);
220 }
221 } else {
222 this.removeListenerInfoFromListeners(aListener, this.listeners()[anEvent]);
223 }
224 },
225
226 //-------------------------------------------------------------------------
227
228 'asysnchronousListenerNotification': function(anEventInfo, aMethod, aListener) {
229 MochiKit.Async.callLater(this.timeoutDelay(), MochiKit.Base.partial(MochiKit.Base.methodcaller(aMethod, anEventInfo), aListener));
230 // setTimeout(MochiKit.Base.partial(MochiKit.Base.methodcaller(aMethod, anEventInfo), aListener), this.timeoutDelay());
231 },
232
233 //-------------------------------------------------------------------------
234
235 'processListenerInfo': function(anEventInfo, aListenerInfo) {
236 varshouldInvokeListenerMethod;
237
238 if (aListenerInfo['source'] == 'any') {
239 shouldInvokeListenerMethod = true;
240 } else {
241 if (aListenerInfo['source'] === anEventInfo.source()) {
242 shouldInvokeListenerMethod = true;
243 } else {
244 shouldInvokeListenerMethod = false;
245 }
246 }
247
248 if (shouldInvokeListenerMethod) {
249 if (this.useSynchronousListenerInvocation() || anEventInfo.isSynchronous()) {
250//MochiKit.Logging.logDebug("syncrhronous listener invocation");
251 try {
252 // MochiKit.Base.map(MochiKit.Base.methodcaller(aListenerInfo['method'], anEventInfo), [aListenerInfo['listener']]);
253//console.log("notification: ", aListenerInfo['listener'], aListenerInfo['method'], anEventInfo);
254 MochiKit.Base.method(aListenerInfo['listener'], aListenerInfo['method'], anEventInfo)();
255 } catch(exception) {
256 MochiKit.Logging.logError('NotificationCenter ERROR: unable to invoke method \'' + aListenerInfo['method'] + '\' on object ' + aListenerInfo['listener']);
257 }
258 } else {
259 var asyncMethod;
260
261//MochiKit.Logging.logDebug("asyncrhronous listener invocation");
262 asyncMethod = MochiKit.Base.bind(this.asysnchronousListenerNotification, this)
263 MochiKit.Base.map(MochiKit.Base.partial(asyncMethod, anEventInfo, aListenerInfo['method']), [aListenerInfo['listener']]);
264 }
265 }
266 },
267
268 //-------------------------------------------------------------------------
269
270 'notify': function(aSource, anEvent, someEventParameters, isSynchronous) {
271 vareventInfo;
272 var processInfoMethod;
273
274//MochiKit.Logging.logDebug(">>> NotificationCenter.notify");
275 eventInfo = new Clipperz.NotificationCenterEvent({source:aSource, event:anEvent, parameters:someEventParameters, isSynchronous:isSynchronous});
276//MochiKit.Logging.logDebug("--- NotificationCenter.notify - 1");
277 processInfoMethod = MochiKit.Base.bind(this.processListenerInfo, this);
278//MochiKit.Logging.logDebug("--- NotificationCenter.notify - 2");
279
280 MochiKit.Base.map(MochiKit.Base.partial(processInfoMethod, eventInfo), this.listeners()[anEvent] || []);
281//MochiKit.Logging.logDebug("--- NotificationCenter.notify - 3");
282 MochiKit.Base.map(MochiKit.Base.partial(processInfoMethod, eventInfo), this.listeners()['_notificationCenter_matchAnyEvent_key_'] || []);
283//MochiKit.Logging.logDebug("<<< NotificationCenter.notify");
284 },
285
286 //-------------------------------------------------------------------------
287
288 'deferredNotification': function(aSource, anEvent, someEventParameters, aDeferredResult) {
289
290 this.notify(aSource, anEvent, someEventParameters, true);
291
292 return aDeferredResult;
293 // return MochiKit.Async.wait(1, aDeferredResult);
294 },
295
296 //-------------------------------------------------------------------------
297
298 'resetStatus': function() {
299 this._listeners = {};
300 },
301
302 //-------------------------------------------------------------------------
303 __syntaxFix__: "syntax fix"
304
305});
306
307//#############################################################################
308
309Clipperz.NotificationCenter.defaultNotificationCenter = new Clipperz.NotificationCenter();
310
311Clipperz.NotificationCenter.notify = MochiKit.Base.method(Clipperz.NotificationCenter.defaultNotificationCenter, 'notify');
312Clipperz.NotificationCenter.register = MochiKit.Base.method(Clipperz.NotificationCenter.defaultNotificationCenter, 'register');
313Clipperz.NotificationCenter.unregister = MochiKit.Base.method(Clipperz.NotificationCenter.defaultNotificationCenter, 'unregister');
314Clipperz.NotificationCenter.deferredNotification = MochiKit.Base.method(Clipperz.NotificationCenter.defaultNotificationCenter, 'deferredNotification');
315/*
316_clipperz_notificationCenter_defaultNotificationCenter = null;
317
318Clipperz.NotificationCenter.defaultNotificationCenter = function() {
319 if (_clipperz_notificationCenter_defaultNotificationCenter == null) {
320 _clipperz_notificationCenter_defaultNotificationCenter = new Clipperz.NotificationCenter();
321 }
322
323 return _clipperz_notificationCenter_defaultNotificationCenter;
324};
325*/
diff --git a/frontend/beta/js/Clipperz/PM/BookmarkletProcessor.js b/frontend/beta/js/Clipperz/PM/BookmarkletProcessor.js
new file mode 100644
index 0000000..4dfdd8e
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/BookmarkletProcessor.js
@@ -0,0 +1,288 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31//if (typeof(Clipperz.PM.BookmarkletProcessor) == 'undefined') { Clipperz.PM.BookmarkletProcessor = {}; }
32//if (typeof(Clipperz.PM.BookmarkletProcessor.versions) == 'undefined') { Clipperz.PM.BookmarkletProcessor.versions = {}; }
33
34/*
35Clipperz.PM.BookmarkletProcessor.versions['abstract'] = function(anUser, aConfiguration) {
36 this._user = anUser;
37 this._configuration = aConfiguration;
38
39 this._recordTitle = null;
40 this._record = null;
41 this._editableFields = null;
42
43 return this;
44}
45
46
47Clipperz.PM.BookmarkletProcessor.versions['abstract'].prototype = MochiKit.Base.update(null, {
48
49 'toString': function() {
50 return "BookmarkletProcessor - " + this.user();
51 },
52
53 //-------------------------------------------------------------------------
54
55 'user': function() {
56 return this._user;
57 },
58
59 //-------------------------------------------------------------------------
60
61 'configuration': function() {
62 return this._configuration;
63 },
64
65 //-------------------------------------------------------------------------
66
67 'record': function() {
68 throw Clipperz.Base.exception.AbstractMethod;
69 },
70
71 //-------------------------------------------------------------------------
72 __syntaxFix__: "syntax fix"
73});
74*/
75
76Clipperz.PM.BookmarkletProcessor = function(anUser, aConfiguration) {
77 this._user = anUser;
78 this._configuration = aConfiguration;
79
80 this._recordTitle = null;
81 this._record = null;
82 this._editableFields = null;
83 this._favicon = null;
84
85 return this;
86}
87
88Clipperz.PM.BookmarkletProcessor.prototype = MochiKit.Base.update(null, {
89
90 'toString': function() {
91 return "BookmarkletProcessor - " + this.user();
92 },
93
94 //-------------------------------------------------------------------------
95
96 'user': function() {
97 return this._user;
98 },
99
100 //-------------------------------------------------------------------------
101
102 'configuration': function() {
103 return this._configuration;
104 },
105
106 //-------------------------------------------------------------------------
107
108 'recordTitle': function() {
109 if (this._recordTitle == null) {
110 this._recordTitle = this.configuration().page.title;
111 }
112
113 return this._recordTitle;
114 },
115
116 //-------------------------------------------------------------------------
117
118 'fields': function() {
119 return this.configuration().form.inputs;
120 },
121
122 //-------------------------------------------------------------------------
123
124 'editableFields': function() {
125 if (this._editableFields == null) {
126 this._editableFields = MochiKit.Base.filter(function(aField) {
127 var result;
128 var type;
129
130 type = aField['type'].toLowerCase();
131 result = ((type != 'hidden') && (type != 'submit') && (type != 'checkbox') && (type != 'radio') && (type != 'select'));
132
133 return result;
134 }, this.fields())
135 }
136
137 return this._editableFields;
138 },
139
140 //-------------------------------------------------------------------------
141
142 'hostname': function() {
143 if (this._hostname == null) {
144 var actionUrl;
145
146 actionUrl = this.configuration()['form']['attributes']['action'];
147//MochiKit.Logging.logDebug("+++ actionUrl: " + actionUrl);
148 this._hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1');
149 }
150
151 return this._hostname;
152 },
153
154 'favicon': function() {
155 if (this._favicon == null) {
156 this._favicon = "http://" + this.hostname() + "/favicon.ico";
157//MochiKit.Logging.logDebug("+++ favicon: " + this._favicon);
158 }
159
160 return this._favicon;
161 },
162
163 //-------------------------------------------------------------------------
164
165 'record': function() {
166 if (this._record == null) {
167 var record;
168 var recordVersion;
169 var directLogin;
170 var bindings;
171 var i,c;
172
173 record = new Clipperz.PM.DataModel.Record({
174 label:this.recordTitle(),
175 notes:"",
176 user:this.user()
177 });
178 recordVersion = new Clipperz.PM.DataModel.RecordVersion(record, {})
179 record.setCurrentVersion(recordVersion);
180
181 bindings = {};
182
183 c = this.editableFields().length;
184 for (i=0; i<c; i++) {
185 var formField;
186 var recordField;
187
188//MochiKit.Logging.logDebug(">>> adding a field");
189 formField = this.editableFields()[i];
190 recordField = new Clipperz.PM.DataModel.RecordField({
191 recordVersion:recordVersion,
192 label:formField['name'],
193 value:formField['value'],
194 type:Clipperz.PM.Strings.inputTypeToRecordFieldType[formField['type']],
195 hidden:false
196 });
197 recordVersion.addField(recordField);
198
199 bindings[formField['name']] = recordField.key();
200//MochiKit.Logging.logDebug("<<< adding a field");
201 }
202
203 directLogin = new Clipperz.PM.DataModel.DirectLogin({
204 record:record,
205 label:this.recordTitle() + Clipperz.PM.Strings['newDirectLoginLabelSuffix'],
206 // bookmarkletVersion:this.version(),
207 bookmarkletVersion:'0.2',
208 favicon:this.favicon(),
209 formData:this.configuration()['form'],
210 bindingData:bindings
211 });
212 record.addDirectLogin(directLogin);
213
214 this.user().addRecord(record);
215
216 this._record = record;
217 }
218
219 return this._record;
220 },
221
222 //-------------------------------------------------------------------------
223 __syntaxFix__: "syntax fix"
224});
225
226//#############################################################################
227
228Clipperz.PM.BookmarkletProcessor.createRecordFromBookmarkletConfiguration = function(anUser, aConfiguration) {
229 var processor;
230
231 processor = new Clipperz.PM.BookmarkletProcessor(anUser, aConfiguration);
232
233 return processor.record();
234};
235
236//-----------------------------------------------------------------------------
237
238Clipperz.PM.BookmarkletProcessor.sanitizeBookmarkletConfiguration = function(aConfiguration) {
239 var result;
240
241 //throw "XSS Bookmarklet attempt";
242
243 result = aConfiguration;
244
245 return result;
246};
247
248//-----------------------------------------------------------------------------
249
250Clipperz.PM.BookmarkletProcessor.checkBookmarkletConfiguration = function(aConfiguration, aButton, aCallback) {
251 var result;
252
253 try {
254 result = Clipperz.Base.evalJSON(aConfiguration);
255 result = Clipperz.PM.BookmarkletProcessor.sanitizeBookmarkletConfiguration(result);
256
257 if (result['version'] != '0.2.3') {
258 throw "WrongBookmarkletVersion";
259 }
260 } catch (exception) {
261 var title;
262 var message;
263
264 if (exception == "WrongBookmarkletVersion") {
265 title = Clipperz.PM.Strings['newRecordPanelWrongBookmarkletVersionExceptionTitle'];
266 message = Clipperz.PM.Strings['newRecordPanelWrongBookmarkletVersionExceptionMessage'];
267 } else {
268 title = Clipperz.PM.Strings['newRecordPanelGeneralExceptionTitle'];
269 message = Clipperz.PM.Strings['newRecordPanelGeneralExceptionMessage'];
270 }
271 Clipperz.PM.Components.MessageBox().show({
272 title:title,
273 text:message,
274 width:240,
275 fn:aCallback,
276 closable:false,
277 showProgressBar:false,
278 showCloseButton:false,
279 buttons:{'ok':Clipperz.PM.Strings['newRecordPanelExceptionPanelCloseButtonLabel']}
280 }, aButton);
281
282 throw exception;
283 }
284
285 return result;
286};
287
288//-----------------------------------------------------------------------------
diff --git a/frontend/beta/js/Clipperz/PM/Components/BaseComponent.js b/frontend/beta/js/Clipperz/PM/Components/BaseComponent.js
new file mode 100644
index 0000000..67e257b
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/BaseComponent.js
@@ -0,0 +1,124 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32
33//#############################################################################
34
35var _Clipperz_PM_Components_Panels_base_id_ = 0;
36
37//#############################################################################
38
39Clipperz.PM.Components.BaseComponent = function(anElement, args) {
40 args = args || {};
41 //MochiKit.Base.bindMethods(this);
42 //Clipperz.PM.Components.BaseComponent.superclass.constructor.call(this, args);
43
44 this._element = anElement;
45 this._ids = {};
46
47 return this;
48}
49
50//=============================================================================
51
52//MochiKit.Base.update(Clipperz.PM.Components.BaseComponent.prototype, {
53YAHOO.extendX(Clipperz.PM.Components.BaseComponent, YAHOO.ext.util.Observable, {
54
55 'isClipperzPMComponent': true,
56
57 //-------------------------------------------------------------------------
58
59 'toString': function () {
60 return "Clipperz.PM.Components.BaseComponent component";
61 },
62
63 //-------------------------------------------------------------------------
64
65 'domHelper': function() {
66 return Clipperz.YUI.DomHelper;
67 },
68
69 //-------------------------------------------------------------------------
70
71 'element': function() {
72//MochiKit.Logging.logDebug(">>> BaseComponent.element");
73 return this._element;
74 },
75
76 'setElement': function(aValue) {
77 this._element = aValue;
78 },
79
80 //-----------------------------------------------------
81
82 'remove': function() {
83//MochiKit.Logging.logDebug(">>> BaseComponent.remove");
84 Clipperz.NotificationCenter.unregister(this);
85 MochiKit.Signal.disconnectAllTo(this);
86//MochiKit.Logging.logDebug("<<< BaseComponent.remove");
87 },
88
89 //-------------------------------------------------------------------------
90
91 'getId': function(aValue) {
92 varresult;
93
94 result = this._ids[aValue];
95
96 if (typeof(result) == 'undefined') {
97 _Clipperz_PM_Components_Panels_base_id_ ++;
98
99 result = "Clipperz_PM_Components_Panels_" + aValue + "_" + _Clipperz_PM_Components_Panels_base_id_;
100 this._ids[aValue] = result;
101//MochiKit.Logging.logDebug(">>> getId(" + aValue + ") = " + result);
102 } else {
103//MochiKit.Logging.logDebug("<<< getId(" + aValue + ") = " + result);
104 }
105
106 return result;
107 },
108
109 'getDom': function(aValue) {
110 return YAHOO.util.Dom.get(this.getId(aValue));
111 },
112
113 'getElement': function(aValue) {
114 return YAHOO.ext.Element.get(this.getId(aValue));
115 },
116
117 'getActor': function(aValue, anAnimator) {
118 return new YAHOO.ext.Actor(this.getDom(aValue), anAnimator);
119 },
120
121 //-------------------------------------------------------------------------
122 __syntaxFix__: "syntax fix"
123
124});
diff --git a/frontend/beta/js/Clipperz/PM/Components/Compact/CompactHeader.js b/frontend/beta/js/Clipperz/PM/Components/Compact/CompactHeader.js
new file mode 100644
index 0000000..e51b56f
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Compact/CompactHeader.js
@@ -0,0 +1,86 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Compact) == 'undefined') { Clipperz.PM.Components.Compact = {}; }
33
34Clipperz.PM.Components.Compact.CompactHeader = function(anElement, args) {
35
36 Clipperz.PM.Components.Compact.CompactHeader.superclass.constructor.call(this, anElement, args);
37
38 this.render();
39
40 return this;
41};
42
43YAHOO.extendX(Clipperz.PM.Components.Compact.CompactHeader, Clipperz.PM.Components.BaseComponent, {
44
45 'toString': function() {
46 return "Clipperz.PM.Components.Compact.CompactHeader";
47 },
48
49 //-----------------------------------------------------
50
51 'render': function() {
52 this.element().update("");
53
54 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', children:[
55 {tag:'img', src:'./images/logo.gif'},
56 {tag:'div', id:'lockBlock', children:[
57 {tag:'input', type:'checkbox', id:'autolock'},
58 {tag:'span', html:'auto'},
59 {tag:'a', href:'#', htmlString:Clipperz.PM.Strings['lockMenuLabel'], id:'lock'}
60 ]}
61 ]});
62
63 Clipperz.YUI.DomHelper.append(this.element().dom,
64 {tag:'div', id:'compactMiscLinks', children:[
65 {tag:'a', id:'donateHeaderIconLink', target:'_blank', href:Clipperz.PM.Strings['donateHeaderLinkUrl'], children:[
66 {tag:'img', id:'donateHeaderLinkIcon', src:'./images/smiles_small.gif'}
67 ]},
68 {tag:'ul', children:[
69 {tag:'li', children:[{tag:'a', id:'donateHeaderLink', html:'donate', target:'_blank'}]},
70 {tag:'li', children:[{tag:'a', id:'creditsHeaderLink', html:'credits', target:'_blank'}]},
71 {tag:'li', children:[{tag:'a', id:'feedbackHeaderLink', html:'feedback', target:'_blank'}]},
72 {tag:'li', children:[{tag:'a', id:'helpHeaderLink', html:'help', target:'_blank'}]},
73 {tag:'li', children:[{tag:'a', id:'forumHeaderLink', html:'forum', target:'_blank'}]}
74 ]}
75 ]}
76 );
77
78 YAHOO.ext.Element.get('lockBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
79 Clipperz.NotificationCenter.notify(this, 'switchLanguage');
80 },
81
82 //-----------------------------------------------------
83 __syntaxFix__: '__syntaxFix__'
84});
85
86
diff --git a/frontend/beta/js/Clipperz/PM/Components/Compact/CompactInterface.js b/frontend/beta/js/Clipperz/PM/Components/Compact/CompactInterface.js
new file mode 100644
index 0000000..492f815
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Compact/CompactInterface.js
@@ -0,0 +1,312 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Compact) == 'undefined') { Clipperz.PM.Components.Compact = {}; }
33
34Clipperz.PM.Components.Compact.CompactInterface = function(anElement, args) {
35
36 Clipperz.PM.Components.Compact.CompactInterface.superclass.constructor.call(this, anElement, args);
37
38 this._directLoginItemTemplate = null;
39 this._user = args.user;
40 this._autoLockTimer = null;
41
42 Clipperz.NotificationCenter.register(null, 'updatedProgressState', this, 'userNotificationHandler')
43 Clipperz.NotificationCenter.register(null, 'directLoginAdded', this, 'directLoginAddedHandler');
44
45 this.render();
46
47 return this;
48};
49
50YAHOO.extendX(Clipperz.PM.Components.Compact.CompactInterface, Clipperz.PM.Components.BaseComponent, {
51
52 'toString': function() {
53 return "Clipperz.PM.Components.Compact.CompactInterface";
54 },
55
56 //-----------------------------------------------------
57
58 'render': function() {
59 var result;
60 varlayout;
61 var registerButton;
62
63//MochiKit.Logging.logDebug(">>> CompactInterface.render");
64 this.element().update("");
65
66 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', children:[
67 {tag:'div', id:this.getId('cantentPanel'), children:[
68 {tag:'h4', id:this.getId('message')},
69 {tag:'ul', id:'directLogins', children:[]}
70 ]},
71 {tag:'div', id:this.getId('lockPanel'), cls:'lockPanel', children:[
72 {tag:'div', htmlString:Clipperz.PM.Strings['lockDescription']},
73 {tag:'form', id:'lockDialogForm', children:[
74 {tag:'input', type:'password', id:this.getId('lockPassphrase')}
75 ]},
76 {tag:'div', id:this.getId('unlock')}
77 ]}
78 ]});
79
80 this.getElement('lockPanel').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
81
82 YAHOO.ext.Element.get('lockBlock').show();
83 MochiKit.Signal.connect(YAHOO.ext.Element.get('lock').dom, 'onclick', this, 'doLockEventHandler');
84 new YAHOO.ext.Button(this.getId('unlock'), {text:Clipperz.PM.Strings['unlockButtonLabel'], handler:this.doUnlockEventHandler, scope:this, minWidth:0});
85 this.getElement('unlock').swallowEvent('click', true);
86 new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('lockPassphrase'));
87 MochiKit.Signal.connect('lockDialogForm', 'onsubmit', this, 'doUnlockEventHandler');
88
89 this.getElement('cantentPanel').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
90//MochiKit.Logging.logDebug("<<< CompactInterface.render");
91
92 return result;
93 },
94
95 //-----------------------------------------------------
96
97 'directLoginAddedHandler': function(anEvent) {
98 this.redrawDirectLoginItems();
99 },
100
101 //-----------------------------------------------------
102
103 'compareDirectLogins': function(a, b) {
104 return MochiKit.Base.compare(a.label().toLowerCase(), b.label().toLowerCase());
105 },
106
107 //-----------------------------------------------------
108
109 'redrawDirectLoginItems': function() {
110 var template;
111 var allDirectLogins;
112
113 this.getElement('message').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
114//MochiKit.Logging.logDebug(">>> CompactInterface.redrawDirectLoginItems");
115//MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 0");
116 MochiKit.Iter.forEach(YAHOO.ext.Element.get('directLogins').getChildrenByTagName('li'), function(aDirectLoginElement) {
117 MochiKit.Signal.disconnectAll(aDirectLoginElement.dom);
118//MochiKit.Logging.logDebug("disconnecting IMG " + aDirectLoginElement.getChildrenByTagName('img')[0].dom.src);
119 MochiKit.Signal.disconnectAll(aDirectLoginElement.getChildrenByTagName('img')[0].dom);
120 })
121//MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 1");
122 YAHOO.ext.Element.get('directLogins').update("");
123//MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 2");
124 allDirectLogins = MochiKit.Base.values(this.user().directLoginReferences());
125//MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 3");
126 allDirectLogins.sort(this.compareDirectLogins);
127
128//MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 4");
129 template = this.directLoginItemTemplate();
130//MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 5");
131 MochiKit.Iter.forEach(allDirectLogins, MochiKit.Base.bind(function(aDirectLogin) {
132 vardirectLoginElement;
133 varfaviconImageElementID;
134
135 faviconImageElementID = aDirectLogin.reference() + "_faviconIMG";
136 directLoginElement = template.append('directLogins', {
137 elementID:faviconImageElementID,
138 faviconUrl:aDirectLogin.fixedFavicon(),
139 directLoginTitle:aDirectLogin.label(),
140 directLoginReference:aDirectLogin.reference()
141 }, true);
142//MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 6: " + recordElement.dom);
143 directLoginElement.addClassOnOver("hover");
144 MochiKit.Signal.connect(directLoginElement.dom, 'onclick', this, 'handleDirectLoginClick');
145
146 MochiKit.Signal.connect(faviconImageElementID, 'onload', this, 'handleLoadedFaviconImage');
147 MochiKit.Signal.connect(faviconImageElementID, 'onerror', aDirectLogin, 'handleMissingFaviconImage');
148 MochiKit.Signal.connect(faviconImageElementID, 'onabort', aDirectLogin, 'handleMissingFaviconImage');
149
150 // YAHOO.ext.Element.get(faviconImageElementID).dom.src = aDirectLogin.fixedFavicon();
151 }, this));
152
153 this.resetAutoLockTimer();
154//MochiKit.Logging.logDebug("<<< CompactInterface.redrawDirectLoginItems");
155 },
156
157 //-----------------------------------------------------
158
159 'directLoginItemTemplate': function() {
160 if (this._directLoginItemTemplate == null) {
161 this._directLoginItemTemplate = Clipperz.YUI.DomHelper.createTemplate({tag:'li', id:'{directLoginReference}', children:[
162 {tag:'table', border:'0', cellpadding:'0', cellspacing:'0', children:[
163 {tag:'tbody', children:[
164 {tag:'tr', children:[
165 {tag:'td', width:'20', align:'center', valign:'top', children:[
166 {tag:'img', id:'{elementID}', src:'{faviconUrl}'}
167 ]},
168 {tag:'td', valign:'top', children:[
169 {tag:'a', cls:'directLoginItemTitle', html:'{directLoginTitle}'}
170 ]}
171 ]}
172 ]}
173 ]}
174 ]});
175 this._directLoginItemTemplate.compile();
176 }
177
178 return this._directLoginItemTemplate;
179 },
180
181 //-------------------------------------------------------------------------
182
183 'handleDirectLoginClick': function(anEvent) {
184 vardirectLoginReference;
185//MochiKit.Logging.logDebug(">>> MainPanel.handleDirectLoginClick !!!");
186
187 directLoginReference = this.user().directLoginReferences()[anEvent.src().id];
188 this.openDirectLogin(directLoginReference);
189 this.resetAutoLockTimer();
190 //MochiKit.Logging.logDebug("<<< MainPanel.handleDirectLoginClick");
191 },
192
193 //-----------------------------------------------------
194
195 'openDirectLogin': function(aDirectLoginReference) {
196 vardeferredResult;
197 varnewWindow;
198
199//MochiKit.Logging.logDebug(">>> MainPanel.openDirectLogin - " + aDirectLoginReference.label());
200 deferredResult = new MochiKit.Async.Deferred();
201//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.openDirectLogin - 1: " + res); return res;});
202 deferredResult.addCallback(MochiKit.Base.method(aDirectLoginReference, 'setupJumpPageWindow'));
203 deferredResult.addCallback(MochiKit.Base.method(aDirectLoginReference, 'deferredDirectLogin'));
204 deferredResult.addCallback(function(aDirectLogin) {
205 aDirectLogin.runDirectLogin(newWindow);
206 });
207
208 newWindow = window.open(Clipperz.PM.Strings['directLoginJumpPageUrl'], "");
209 // MochiKit.Signal.connect(newWindow, 'onload', MochiKit.Base.method(deferredResult, 'callback', newWindow))
210 // MochiKit.Signal.connect(newWindow, 'onload', MochiKit.Base.partial(alert, "done"));
211 deferredResult.callback(newWindow);
212//MochiKit.Logging.logDebug("<<< MainPanel.openDirectLogin");
213 },
214
215 //-------------------------------------------------------------------------
216
217 'handleLoadedFaviconImage': function(anEvent) {
218//MochiKit.Logging.logDebug(">>> MainPanel.handleLoadedFaviconImage");
219 MochiKit.Signal.disconnectAll(anEvent.src())
220//MochiKit.Logging.logDebug("<<< MainPanel.handleLoadedFaviconImage");
221 },
222
223 //-------------------------------------------------------------------------
224
225 'doLockEventHandler': function(anEvent) {
226 anEvent.stop();
227 this.lock();
228 },
229
230 'doUnlockEventHandler': function(anEvent) {
231 if (typeof(anEvent.stop) != 'undefined') {
232 anEvent.stop();
233 }
234 this.unlock();
235 },
236
237 //-------------------------------------------------------------------------
238
239 'autolock': function() {
240 varshouldAutoLock;
241
242 shouldAutoLock = YAHOO.ext.Element.get('autolock').dom.checked;
243
244 if (shouldAutoLock) {
245 this.lock();
246 } else {
247 this.resetAutoLockTimer();
248 }
249 },
250
251 'lock': function() {
252//MochiKit.Logging.logDebug(">>> lock");
253 this.getDom('lockPassphrase').value = "";
254 this.getElement('lockPanel').show();
255 this.getElement('cantentPanel').hide();
256 YAHOO.ext.Element.get('lockBlock').hide();
257 //this.getElement('lockPassphrase').focus();
258//MochiKit.Logging.logDebug("<<< lock");
259 },
260
261 'unlock': function(anEvent) {
262//MochiKit.Logging.logDebug(">>> unlock");
263 if (this.getDom('lockPassphrase').value == this.user().passphrase()) {
264 this.getElement('lockPanel').hide();
265 this.getElement('cantentPanel').show();
266 YAHOO.ext.Element.get('lockBlock').show();
267 this.resetAutoLockTimer();
268 } else {
269 this.getDom('lockPassphrase').value = "";
270 this.getElement('lockPassphrase').focus();
271 }
272//MochiKit.Logging.logDebug("<<< unlock");
273 },
274
275 //-------------------------------------------------------------------------
276
277 'user': function() {
278 return this._user;
279 },
280
281 //-----------------------------------------------------
282
283 'autoLockTimer': function() {
284 if (this._autoLockTimer == null) {
285//MochiKit.Logging.logDebug("--- timer started - 1");
286 this._autoLockTimer = MochiKit.Async.callLater(60, MochiKit.Base.method(this, 'autolock'));
287//MochiKit.Logging.logDebug("--- timer started - 2");
288 }
289
290 return this._autoLockTimer;
291 },
292
293 'resetAutoLockTimer': function() {
294//MochiKit.Logging.logDebug(">>> timer resetted");
295 this.autoLockTimer().cancel();
296 this._autoLockTimer = null;
297//MochiKit.Logging.logDebug("--- timer resetted - 1");
298 this.autoLockTimer();
299//MochiKit.Logging.logDebug("<<< timer resetted");
300 },
301
302 //-----------------------------------------------------
303
304 'userNotificationHandler': function(anEvent) {
305 this.getElement('message').update(anEvent.parameters().text);
306 },
307
308 //-----------------------------------------------------
309 __syntaxFix__: '__syntaxFix__'
310});
311
312
diff --git a/frontend/beta/js/Clipperz/PM/Components/Compact/LoginForm.js b/frontend/beta/js/Clipperz/PM/Components/Compact/LoginForm.js
new file mode 100644
index 0000000..d708464
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Compact/LoginForm.js
@@ -0,0 +1,189 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Compact) == 'undefined') { Clipperz.PM.Components.Compact = {}; }
33
34Clipperz.PM.Components.Compact.LoginForm = function(anElement, args) {
35
36 Clipperz.PM.Components.Compact.LoginForm.superclass.constructor.call(this, anElement, args);
37
38 this.render();
39 Clipperz.NotificationCenter.register(null, 'updatedProgressState', this, 'userNotificationHandler')
40
41 return this;
42};
43
44YAHOO.extendX(Clipperz.PM.Components.Compact.LoginForm, Clipperz.PM.Components.BaseComponent, {
45
46 'toString': function() {
47 return "Clipperz.PM.Components.Compact.LoginForm";
48 },
49
50 //-----------------------------------------------------
51
52 'render': function() {
53 var result;
54 varlayout;
55
56 MochiKit.Signal.disconnectAllTo(this);
57 this.element().update("");
58
59 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', id:this.getId('baseDiv'), cls:'LoginPanel', children:[
60 {tag:'div', id:'compactHeader'},
61 {tag:'div', id:'compactBody', children:[
62 {tag:'form', id:this.getId('loginForm_form'), children:[
63 {tag:'dl', children:[
64 {tag:'dt', htmlString:Clipperz.PM.Strings['loginFormUsernameLabel']},
65 {tag:'dd', children:[
66 {tag:'input', id:this.getId('login_username'), type:'text', size:'30', name:'username'}
67 ]},
68 {tag:'dt', htmlString:Clipperz.PM.Strings['loginFormPassphraseLabel']},
69 {tag:'dd', children:[
70 {tag:'input', id:this.getId('login_passphrase'), type:'password', size:'30', name:'passphrase'}
71 ]}
72 ]},
73 {tag:'div', id:this.getId('login_submit')}
74 ]},
75 {tag:'h4', id:this.getId('message')}
76 ]}
77 ]});
78
79 new Clipperz.PM.Components.Compact.CompactHeader(YAHOO.ext.Element.get('compactHeader'));
80
81 MochiKit.Signal.connect(this.getId('loginForm_form'), 'onsubmit', this, 'stopFormSubmit');
82 new YAHOO.ext.Button(this.getId('login_submit'), {text:Clipperz.PM.Strings['loginFormButtonLabel'], handler:this.doLogin, scope:this, minWidth:0});
83 this.getElement('login_submit').swallowEvent('click', true);
84
85 MochiKit.Signal.connect(this.getId('loginForm_form'), 'onkeydown', this, 'onkeydown');
86
87 new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('login_passphrase'));
88 this.getElement('login_username').focus();
89
90 return result;
91 },
92
93 //-----------------------------------------------------
94
95 'doLogin': function(e) {
96//MochiKit.Logging.logDebug(">>> compact.LoginForm.doLogin");
97 if (this.checkLoginForm()) {
98 this.doLoginWithUsernameAndPassphrase(this.getDom('login_username').value, this.getDom('login_passphrase').value);
99 }
100//MochiKit.Logging.logDebug("<<< compact.LoginForm.doLogin");
101 },
102
103 //.........................................................................
104
105 'doLoginWithUsernameAndPassphrase': function(anUsername, aPassphrase) {
106 var deferredResult;
107 var user;
108
109//MochiKit.Logging.logDebug(">>> compact.LoginForm.doLoginWithUsernameAndPassphrase");
110 user = new Clipperz.PM.DataModel.User({username:anUsername, passphrase:aPassphrase});
111
112 deferredResult = new MochiKit.Async.Deferred();
113 deferredResult.addCallback(MochiKit.Base.method(user, 'connect'));
114 deferredResult.addCallback(MochiKit.Base.method(user, 'loadPreferences'));
115 deferredResult.addCallback(MochiKit.Base.method(user, 'loadRecords'));
116 deferredResult.addCallback(MochiKit.Base.method(user, 'loadDirectLogins'));
117 deferredResult.addErrback(MochiKit.Base.bind(function() {
118 this.getElement('loginForm_form').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show();
119 this.getElement('message').update(Clipperz.PM.Strings['loginMessagePanelFailureText']);
120 this.getDom('login_passphrase').value = "";
121 this.getElement('login_passphrase').focus();
122 }, this))
123//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("compact.LoginForm.doLogin - 6: " + res); return res;});
124 deferredResult.callback("token");
125//MochiKit.Logging.logDebug("<<< compact.LoginForm.doLoginWithUsernameAndPassphrase");
126
127 return deferredResult;
128 },
129
130 //.........................................................................
131
132 'checkLoginForm': function() {
133 var result;
134 var username
135 varpassphrase;
136
137//MochiKit.Logging.logDebug(">>> checkLoginForm");
138 username = this.getDom('login_username').value;
139 passphrase = this.getDom('login_passphrase').value;
140
141 if ((username != "") && (passphrase != "")) {
142 result = true;
143 } else {
144 if (username == "") {
145 this.getElement('login_username').focus();
146 } else if (passphrase == "") {
147 this.getElement('login_passphrase').focus();
148 }
149
150 result = false;
151 }
152//MochiKit.Logging.logDebug("<<< checkLoginForm - " + result);
153
154 return result;
155 },
156
157 //-------------------------------------------------------------------------
158
159 'stopFormSubmit': function(anEvent) {
160 anEvent.stop();
161 },
162
163 //-------------------------------------------------------------------------
164
165 'onkeydown': function(anEvent) {
166//MochiKit.Logging.logDebug(">>> onkeydown - " + anEvent.src().id);
167 if (anEvent.key().code == 13) {
168 this.doLogin();
169 anEvent.stop();
170 }
171 },
172
173 //-----------------------------------------------------
174
175 'userNotificationHandler': function(anEvent) {
176//MochiKit.Logging.logDebug(">>> compact.LoginForm.userNotificationHandler");
177//MochiKit.Logging.logDebug("userNotificationHandler - event: " + anEvent.event());
178 this.getElement('loginForm_form').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
179 if (this.getDom('message') != null) {
180 this.getElement('message').update(Clipperz.PM.Strings.messagePanelConfigurations[anEvent.parameters()]()['text']);
181 }
182//MochiKit.Logging.logDebug("<<< compact.LoginForm.userNotificationHandler");
183 },
184
185 //-----------------------------------------------------
186 __syntaxFix__: '__syntaxFix__'
187});
188
189
diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportColumns.js b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportColumns.js
new file mode 100644
index 0000000..18b36da
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportColumns.js
@@ -0,0 +1,174 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; }
33if (typeof(Clipperz.PM.Components.Import.CSVImport) == 'undefined') { Clipperz.PM.Components.Import.CSVImport = {}; }
34
35//#############################################################################
36
37Clipperz.PM.Components.Import.CSVImport.CSVImportColumns = function(anElement, args) {
38 args = args || {};
39
40 Clipperz.PM.Components.Import.CSVImport.CSVImportColumns.superclass.constructor.call(this, anElement, args);
41 this._mainComponent = args.mainComponent;
42
43 return this;
44}
45
46//=============================================================================
47
48YAHOO.extendX(Clipperz.PM.Components.Import.CSVImport.CSVImportColumns, Clipperz.PM.Components.BaseComponent, {
49
50 'toString': function() {
51 return "Clipperz.PM.Components.Import.CSVImport.CSVImportColumns component";
52 },
53
54 //-------------------------------------------------------------------------
55
56 'mainComponent': function() {
57 return this._mainComponent;
58 },
59
60 //-------------------------------------------------------------------------
61
62 'render': function() {
63 var i,c;
64 var columnSelectorCheckboxCells;
65 var checkboxes;
66 var data;
67
68//MochiKit.Logging.logDebug(">>> CSVImportColumns.render");
69 Clipperz.NotificationCenter.unregister(this);
70 MochiKit.Signal.disconnectAllTo(this);
71
72 this.element().update("");
73
74 data = this.mainComponent().parsedValues();
75 columnSelectorCheckboxCells = [];
76
77 c =data[0].length;
78 for (i=0; i<c; i++) {
79 columnSelectorCheckboxCells.push({tag:'th', valign:'top', cls:(this.mainComponent().isColumnSelected(i) ? 'selectedColumn': 'skippedColumn'), children:[
80 {tag:'input', type:'checkbox', id:this.getId('columnCheckbox_' + i), value:i}
81 ]})
82 }
83
84 this.domHelper().append(this.element(), {tag:'div', children:[
85 {tag:'div', cls:'importStepDescription', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Columns']},
86 {tag:'div', id:this.getId('dataDiv'), cls:'csvImportPreview', children:[
87 {tag:'table', id:this.getId('previewDada'), cls:'csvImportPreview columns', cellspacing:'0', children:[
88 {tag:'thead', id:this.getId('previewData_thead'), children:[
89 {tag:'tr', children:columnSelectorCheckboxCells}
90 ]},
91 {tag:'tbody', id:this.getId('previewData_tbody'), children:[]}
92 ]}
93 ]}
94 ]});
95
96 c =data[0].length;
97 for (i=0; i<c; i++) {
98 if (this.mainComponent().isColumnSelected(i)) {
99 this.getDom('columnCheckbox_' + i).checked = true;
100 }
101 }
102
103 this.renderData(this.getElement('previewData_tbody'), data);
104
105 checkboxes = MochiKit.DOM.getElementsByTagAndClassName('input', null, this.getDom('previewData_thead'));
106 c = checkboxes.length;
107 for (i=0; i<c; i++) {
108 MochiKit.Signal.connect(checkboxes[i], 'onclick', this, 'renderDataHandler');
109 }
110//MochiKit.Logging.logDebug("<<< CSVImportColumns.render");
111 },
112
113 //-------------------------------------------------------------------------
114
115 'renderData': function(anElement, someData) {
116 var config;
117 var i,c;
118
119//MochiKit.Logging.logDebug(">>> CSVImportColumns.renderData");
120 // anElement.update("");
121 MochiKit.DOM.replaceChildNodes(anElement.dom);
122
123 config = MochiKit.Base.map(MochiKit.Base.bind(function(aRowData) {
124 var result;
125 var i,c;
126
127 result = {tag:'tr', children:[]};
128 c = aRowData.length;
129 for (i=0; i<c; i++) {
130 var field;
131
132 field = aRowData[i];
133 result.children.push({tag:'td', valign:'top', cls:(this.mainComponent().isColumnSelected(i) ? 'selectedColumn': 'skippedColumn'), html:(MochiKit.Base.isNotEmpty(field) ? field.replace(/\n/g, '<br>') : '&nbsp;')});
134 }
135
136 return result;
137 }, this), someData);
138
139 MochiKit.Base.map(function(aRowConfig) {Clipperz.YUI.DomHelper.append(anElement, aRowConfig);}, config);
140
141 Clipperz.Style.applyZebraStylesToTable(this.getId('previewDada'));
142//MochiKit.Logging.logDebug("<<< CSVImportColumns.renderData");
143 },
144
145 //-------------------------------------------------------------------------
146
147 'renderDataHandler': function(anEvent) {
148 var thElement;
149
150 thElement = YAHOO.ext.Element.get(anEvent.src().parentNode);
151
152 if (anEvent.src().checked == true) {
153 this.mainComponent().skippedColumns().remove(anEvent.src().value);
154 thElement.addClass('selectedColumn');
155 thElement.removeClass('skippedColumn');
156 } else {
157 this.mainComponent().skippedColumns().add(anEvent.src().value);
158 thElement.removeClass('selectedColumn');
159 thElement.addClass('skippedColumn');
160 }
161
162 if (this.mainComponent().skippedColumns().allItems().length == this.mainComponent().parsedValues()[0].length) {
163 this.mainComponent().nextButton().disable();
164 } else {
165 this.mainComponent().nextButton().enable();
166 }
167
168 this.renderData(this.getElement('previewData_tbody'), this.mainComponent().parsedValues());
169 },
170
171 //-------------------------------------------------------------------------
172 __syntaxFix__: "syntax fix"
173});
174
diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportFields.js b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportFields.js
new file mode 100644
index 0000000..a368747
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportFields.js
@@ -0,0 +1,247 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; }
33if (typeof(Clipperz.PM.Components.Import.CSVImport) == 'undefined') { Clipperz.PM.Components.Import.CSVImport = {}; }
34
35//#############################################################################
36
37Clipperz.PM.Components.Import.CSVImport.CSVImportFields = function(anElement, args) {
38 args = args || {};
39
40 Clipperz.PM.Components.Import.CSVImport.CSVImportFields.superclass.constructor.call(this, anElement, args);
41 this._mainComponent = args.mainComponent;
42
43 return this;
44}
45
46//=============================================================================
47
48YAHOO.extendX(Clipperz.PM.Components.Import.CSVImport.CSVImportFields, Clipperz.PM.Components.BaseComponent, {
49
50 'toString': function() {
51 return "Clipperz.PM.Components.Import.CSVImport.CSVImportFields component";
52 },
53
54 //-------------------------------------------------------------------------
55
56 'mainComponent': function() {
57 return this._mainComponent;
58 },
59
60 //-------------------------------------------------------------------------
61
62 'render': function() {
63 varfieldsHeaderCells;
64 var titleColumnIndex;
65 var notesColumnIndex;
66 var i,c;
67
68 Clipperz.NotificationCenter.unregister(this);
69 MochiKit.Signal.disconnectAllTo(this);
70
71 this.element().update("");
72
73 titleColumnIndex = this.mainComponent().titleColumnIndex()
74 notesColumnIndex = this.mainComponent().notesColumnIndex()
75
76 fieldsHeaderCells = [];
77 fieldsHeaderCells.push({tag:'td', valign:'top', cls:'title', html:this.mainComponent().labelForColumn(titleColumnIndex)});
78
79 c =this.mainComponent().parsedValues()[0].length;
80 for (i=0; i<c; i++) {
81 if ((i != titleColumnIndex) && (i != notesColumnIndex) && (this.mainComponent().isColumnSelected(i))) {
82 var trimmedLabel;
83
84 trimmedLabel = Clipperz.Base.trim(this.mainComponent().labelForColumn(i));
85 fieldsHeaderCells.push({tag:'td', valign:'top', id:this.getId('fieldHeaderTD_' + i), cls:((trimmedLabel == "") ? 'missingLabelWarning' : (this.isColumnSetup(i) ? 'configuredColumn': 'unconfiguredColumn')), children:[
86 {tag:'span', html:((trimmedLabel == "") ? Clipperz.PM.Strings['CSV_ImportWizard_Fields_MissingLabelWarning'] : trimmedLabel)/*, cls:((trimmedLabel == "") ? 'missingLabelWarning' : '')*/},
87 {tag:'select', id:this.getId('select_' + i), name:i, children:[
88 {tag:'option', value:'UNDEFINED', html:"select data type", cls:'disabledOption'},
89 {tag:'option', value:'TXT', htmlString:Clipperz.PM.Strings['recordFieldTypologies']['TXT']['shortDescription']},
90 {tag:'option', value:'PWD', htmlString:Clipperz.PM.Strings['recordFieldTypologies']['PWD']['shortDescription']},
91 {tag:'option', value:'URL', htmlString:Clipperz.PM.Strings['recordFieldTypologies']['URL']['shortDescription']},
92 {tag:'option', value:'DATE', htmlString:Clipperz.PM.Strings['recordFieldTypologies']['DATE']['shortDescription']},
93 {tag:'option', value:'ADDR', htmlString:Clipperz.PM.Strings['recordFieldTypologies']['ADDR']['shortDescription']}
94 ]}
95 ]})
96 }
97 }
98
99 if (notesColumnIndex != -1) {
100 fieldsHeaderCells.push({tag:'td', valign:'top', cls:'notes', html:this.mainComponent().labelForColumn(notesColumnIndex)});
101 }
102
103 this.domHelper().append(this.element(), {tag:'div', children:[
104 {tag:'div', cls:'importStepDescription', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Fields']},
105 {tag:'div', id:this.getId('dataDiv'), children:[
106 {tag:'div', children:[
107 ]},
108 {tag:'div', cls:'csvImportPreview', children:[
109 {tag:'table', id:this.getId('previewDada'), cls:'csvImportPreview', cellspacing:'0', children:[
110 {tag:'thead', id:this.getId('previewData_thead'), children:[
111 {tag:'tr', cls:'CSV_previewData_header', children:fieldsHeaderCells}
112 ]},
113 {tag:'tbody', id:this.getId('previewData_tbody'), children:[]}
114 ]}
115 ]}
116 ]}
117 ]});
118
119 for (i=0; i<c; i++) {
120 if ((i != titleColumnIndex) && (i != notesColumnIndex) && (this.mainComponent().isColumnSelected(i))) {
121 Clipperz.DOM.selectOptionMatchingValue(this.getDom('select_' + i), this.mainComponent().typeForColumn(i));
122 MochiKit.Signal.connect(this.getDom('select_' + i), 'onchange', this, 'renderDataRowsHandler');
123 }
124 }
125
126 this.renderDataRows(this.getElement('previewData_tbody'));
127 // Clipperz.NotificationCenter.register(null, 'updatedCSVImportColumnHeader', this, 'renderDataRowsHandler');
128 },
129
130 //-------------------------------------------------------------------------
131
132 'isColumnSetup': function(aColumnIndex) {
133 return ((Clipperz.Base.trim(this.mainComponent().labelForColumn(aColumnIndex)) != "") && (this.mainComponent().typeForColumn(aColumnIndex) != 'UNDEFINED'));
134 },
135
136 //-------------------------------------------------------------------------
137
138 'renderDataRowsHandler': function(anEvent) {
139 var columnIndex;
140 var tdElement;
141
142//MochiKit.Logging.logDebug(">>> renderDataRowsHandler")
143 columnIndex = anEvent.src().name;
144 this.mainComponent().setTypeForColumn(anEvent.src().value, columnIndex);
145
146 tdElement = this.getElement('fieldHeaderTD_' + columnIndex);
147
148 if (this.isColumnSetup(columnIndex)) {
149 tdElement.removeClass('unconfiguredColumn');
150 tdElement.addClass('configuredColumn');
151 } else {
152 tdElement.addClass('unconfiguredColumn');
153 tdElement.removeClass('configuredColumn');
154 }
155
156 this.renderDataRows(this.getElement('previewData_tbody'));
157 },
158
159 //-------------------------------------------------------------------------
160
161 'renderDataRows': function(anElement) {
162 var titleColumnIndex;
163 var notesColumnIndex;
164 var data
165 var i,c;
166
167//MochiKit.Logging.logDebug("#### >> renderDataRows");
168 // anElement.update("");
169 MochiKit.DOM.replaceChildNodes(anElement.dom);
170
171 if (this.mainComponent().isFirstRowHeader()) {
172 data = this.mainComponent().parsedValues().slice(1);
173 } else {
174 data = this.mainComponent().parsedValues();
175 }
176
177
178 titleColumnIndex = this.mainComponent().titleColumnIndex();
179 notesColumnIndex = this.mainComponent().notesColumnIndex();
180
181 c = data.length;
182 for (i=0; i<c; i++) {
183 var rowData;
184 var rowConfig;
185 var ii, cc;
186
187 rowData = data[i];
188
189 rowConfig = {tag:'tr', children:[
190 {tag:'td', valign:'top', cls:'title', html:(MochiKit.Base.isNotEmpty(rowData[titleColumnIndex]) ? rowData[titleColumnIndex].replace(/\n/g, '<br>') : '&nbsp;')}
191 ]};
192
193 cc = rowData.length;
194 for (ii=0; ii<cc; ii++) {
195 // if ((ii != titleColumnIndex) && (ii != notesColumnIndex)) {
196 if ((ii != titleColumnIndex) && (ii != notesColumnIndex) && (this.mainComponent().isColumnSelected(ii))) {
197 rowConfig.children.push({
198 tag:'td',
199 valign:'top',
200 cls:(this.isColumnSetup(ii) ? 'configuredColumn' : 'unconfiguredColumn'),
201 html:(MochiKit.Base.isNotEmpty(rowData[ii]) ? rowData[ii].replace(/\n/g, '<br>') : '&nbsp;')
202 });
203 }
204 }
205 if (notesColumnIndex != -1) {
206 rowConfig.children.push({tag:'td', valign:'top', cls:'notes', html:(MochiKit.Base.isNotEmpty(rowData[notesColumnIndex]) ? rowData[notesColumnIndex].replace(/\n/g, '<br>') : '&nbsp;')});
207 }
208
209 this.domHelper().append(anElement, rowConfig);
210 }
211
212 Clipperz.Style.applyZebraStylesToTable(this.getId('previewDada'));
213
214 this.checkWetherToEnableNextButton();
215//MochiKit.Logging.logDebug("#### << renderDataRows");
216 },
217
218 //-------------------------------------------------------------------------
219
220 'checkWetherToEnableNextButton': function() {
221 var result;
222 var titleColumnIndex;
223 var notesColumnIndex;
224 var i,c;
225
226 titleColumnIndex = this.mainComponent().titleColumnIndex()
227 notesColumnIndex = this.mainComponent().notesColumnIndex()
228
229 result = true;
230 c =this.mainComponent().parsedValues()[0].length;
231 for (i=0; i<c; i++) {
232 if ((i != titleColumnIndex) && (i != notesColumnIndex) && (this.mainComponent().isColumnSelected(i))) {
233 result = result && this.isColumnSetup(i);
234 }
235 }
236
237 if (result) {
238 this.mainComponent().nextButton().enable();
239 } else {
240 this.mainComponent().nextButton().disable();
241 }
242 },
243
244 //-------------------------------------------------------------------------
245 __syntaxFix__: "syntax fix"
246});
247
diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportHeader.js b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportHeader.js
new file mode 100644
index 0000000..ebd243a
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportHeader.js
@@ -0,0 +1,240 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; }
33if (typeof(Clipperz.PM.Components.Import.CSVImport) == 'undefined') { Clipperz.PM.Components.Import.CSVImport = {}; }
34
35//#############################################################################
36
37Clipperz.PM.Components.Import.CSVImport.CSVImportHeader = function(anElement, args) {
38 args = args || {};
39
40 Clipperz.PM.Components.Import.CSVImport.CSVImportHeader.superclass.constructor.call(this, anElement, args);
41 this._mainComponent = args.mainComponent;
42
43 this._pendingDeferredLabelFieldHandlerEvents = 0;
44
45 return this;
46}
47
48//=============================================================================
49
50YAHOO.extendX(Clipperz.PM.Components.Import.CSVImport.CSVImportHeader, Clipperz.PM.Components.BaseComponent, {
51
52 'toString': function() {
53 return "Clipperz.PM.Components.Import.CSVImport.CSVImportHeader component";
54 },
55
56 //-------------------------------------------------------------------------
57
58 'mainComponent': function() {
59 return this._mainComponent;
60 },
61
62 //-------------------------------------------------------------------------
63
64 'render': function() {
65 var thConfigs;
66 var i,c;
67
68//MochiKit.Logging.logDebug(">>> CSVImportHeader.render");
69 Clipperz.NotificationCenter.unregister(this);
70 MochiKit.Signal.disconnectAllTo(this);
71
72 thConfigs = [];
73 c = this.mainComponent().parsedValues()[0].length;
74 for (i=0; i<c; i++) {
75 if (this.mainComponent().isColumnSelected(i)) {
76 // thConfigs.push({tag:'th', children:[{tag:'input', type:'text', id:this.getId('headerTextField_' + i), value:this.mainComponent().labelForColumn(i)}]});
77 thConfigs.push({tag:'th', children:[{tag:'input', type:'text', id:this.getId('headerTextField_' + i), value:""}]});
78 }
79 }
80
81 this.element().update("");
82 this.domHelper().append(this.element(), {tag:'div', children:[
83 {tag:'div', cls:'importStepDescription', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Header']},
84 {tag:'div', cls:'importStepParameters', children:[
85 {tag:'input', type:'checkbox', name:'isFistRowHeader', id:this.getId('isFirstRowHeader_checkbox')},
86 {tag:'span', id:this.getId('isFirstRowHeader_span'), cls:'clickableSpan', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Header_Settings_firstRowHeaderLabel']}
87 ]},
88 {tag:'div', id:this.getId('dataDiv'), children:[
89 {tag:'div', cls:'csvImportPreview', children:[
90 {tag:'table', id:this.getId('previewDada'), cls:'csvImportPreview header', cellspacing:'0', children:[
91 {tag:'thead', children:[{tag:'tr', children:thConfigs}]},
92 {tag:'tbody', id:this.getId('previewData_tbody')}
93 ]}
94 ]}
95 ]}
96 ]});
97
98 for (i=0; i<c; i++) {
99 if (this.mainComponent().isColumnSelected(i)) {
100 this.getElement('headerTextField_' + i).dom.value = this.mainComponent().labelForColumn(i);
101 }
102 }
103
104 this.renderData(this.getElement('previewData_tbody'), this.mainComponent().parsedValues());
105
106 if (this.mainComponent().isFirstRowHeader()) {
107 this.getDom('isFirstRowHeader_checkbox').click();
108 }
109
110 c = this.mainComponent().parsedValues()[0].length;
111 for (i=0; i<c; i++) {
112 if (this.mainComponent().isColumnSelected(i)) {
113 MochiKit.Signal.connect(this.getDom('headerTextField_' + i), 'onchange', MochiKit.Base.partial(MochiKit.Base.method(this, 'labelFieldHandler'), i));
114 MochiKit.Signal.connect(this.getDom('headerTextField_' + i), 'onkeypress', MochiKit.Base.partial(MochiKit.Base.method(this, 'deferredLabelFieldHandler'), i));
115 }
116 }
117
118 MochiKit.Signal.connect(this.getDom('isFirstRowHeader_checkbox'), 'onclick', this, 'toggleFirstRowHeaderCheckboxHandler');
119 if (Clipperz_IEisBroken != true) {
120 MochiKit.Signal.connect(this.getDom('isFirstRowHeader_span'), 'onclick', this.getDom('isFirstRowHeader_checkbox'), 'click');
121 }
122//MochiKit.Logging.logDebug("<<< CSVImportHeader.render");
123 },
124
125 //-------------------------------------------------------------------------
126
127 'renderData': function(anElement, someData) {
128 var trConfigs;
129 var data;
130 var i,c;
131
132 // anElement.update("");
133 MochiKit.DOM.replaceChildNodes(anElement.dom);
134
135 if (this.mainComponent().isFirstRowHeader()) {
136 data = someData.slice(1);
137 } else {
138 data = someData;
139 }
140
141 trConfigs = MochiKit.Base.map(MochiKit.Base.bind(function(aRowData) {
142 var result;
143 var i,c;
144
145 result = {tag:'tr', children:[]};
146 c = aRowData.length;
147 for (i=0; i<c; i++) {
148 if (this.mainComponent().isColumnSelected(i)) {
149 result.children.push({tag:'td', valign:'top', html:(MochiKit.Base.isNotEmpty(aRowData[i]) ? aRowData[i].replace(/\n/g, '<br>') : '&nbsp;')});
150 }
151 }
152
153 return result;
154 }, this), data);
155
156 MochiKit.Base.map(function(aRowConfig) {Clipperz.YUI.DomHelper.append(anElement, aRowConfig);}, trConfigs);
157
158 Clipperz.Style.applyZebraStylesToTable(this.getId('previewDada'));
159 },
160
161 //-------------------------------------------------------------------------
162
163 'toggleFirstRowHeaderCheckboxHandler': function() {
164 var firstRowData;
165 var i,c;
166
167//MochiKit.Logging.logDebug(">>> toggleFirstRowHeaderCheckboxHandler");
168 this.mainComponent().setIsFirstRowHeader(this.getDom('isFirstRowHeader_checkbox').checked);
169
170 firstRowData = this.mainComponent().parsedValues()[0];
171
172 c = firstRowData.length;
173 for (i=0; i<c; i++) {
174 if (this.mainComponent().isColumnSelected(i)) {
175 var label;
176
177 if (this.mainComponent().isFirstRowHeader()) {
178 label = firstRowData[i];
179 } else {
180 label = null;
181 }
182
183 this.mainComponent().setLabelForColumn(label, i);
184 }
185 };
186
187 this.updateInputFieldValues();
188 this.renderData(this.getElement('previewData_tbody'), this.mainComponent().parsedValues());
189//MochiKit.Logging.logDebug("<<< toggleFirstRowHeaderCheckboxHandler");
190 },
191
192 //-------------------------------------------------------------------------
193
194 'updateInputFieldValues': function() {
195 var i,c;
196
197//MochiKit.Logging.logDebug(">>> updateInputFieldValues");
198 c = this.mainComponent().parsedValues()[0].length;
199 for (i=0; i<c; i++) {
200 if (this.mainComponent().isColumnSelected(i)) {
201 this.getDom('headerTextField_' + i).value = this.mainComponent().labelForColumn(i);
202 }
203 }
204//console.log('[1] fieldSettings', fieldSettings);
205//MochiKit.Logging.logDebug("<<< updateInputFieldValues");
206 },
207
208 //-------------------------------------------------------------------------
209
210 'labelFieldHandler': function(aColumnIndex, anEvent) {
211 var inputField;
212
213//MochiKit.Logging.logDebug(">>> labelFieldHandler");
214 inputField = anEvent.src();
215
216 this.mainComponent().setLabelForColumn(inputField.value, aColumnIndex);
217//MochiKit.Logging.logDebug("##### [" + anEvent.src().id + "] -> label[" + aColumnIndex + "]: '" + inputField.value + "'");
218//MochiKit.Logging.logDebug("<<< labelFieldHandler");
219 },
220
221 'deferredLabelFieldHandler': function(aColumnIndex, anEvent) {
222//MochiKit.Logging.logDebug(">>> deferredLabelFieldHandler");
223 this._pendingDeferredLabelFieldHandlerEvents ++;
224 MochiKit.Async.callLater(1, MochiKit.Base.partial(MochiKit.Base.method(this, 'deferredLabelFieldHandlerCatcher'), aColumnIndex, anEvent));
225//MochiKit.Logging.logDebug("<<< deferredLabelFieldHandler");
226 },
227
228 'deferredLabelFieldHandlerCatcher': function(aColumnIndex, anEvent) {
229//MochiKit.Logging.logDebug(">>> deferredLabelFieldHandlerCatcher");
230 this._pendingDeferredLabelFieldHandlerEvents --;
231 if (this._pendingDeferredLabelFieldHandlerEvents == 0) {
232 this.labelFieldHandler(aColumnIndex, anEvent);
233 }
234//MochiKit.Logging.logDebug("<<< deferredLabelFieldHandlerCatcher");
235 },
236
237 //-------------------------------------------------------------------------
238 __syntaxFix__: "syntax fix"
239});
240
diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportNotes.js b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportNotes.js
new file mode 100644
index 0000000..a53c531
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportNotes.js
@@ -0,0 +1,212 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; }
33if (typeof(Clipperz.PM.Components.Import.CSVImport) == 'undefined') { Clipperz.PM.Components.Import.CSVImport = {}; }
34
35//#############################################################################
36
37Clipperz.PM.Components.Import.CSVImport.CSVImportNotes = function(anElement, args) {
38 args = args || {};
39
40 Clipperz.PM.Components.Import.CSVImport.CSVImportNotes.superclass.constructor.call(this, anElement, args);
41 this._mainComponent = args.mainComponent;
42
43 return this;
44}
45
46//=============================================================================
47
48YAHOO.extendX(Clipperz.PM.Components.Import.CSVImport.CSVImportNotes, Clipperz.PM.Components.BaseComponent, {
49
50 'toString': function() {
51 return "Clipperz.PM.Components.Import.CSVImport.CSVImportNotes component";
52 },
53
54 //-------------------------------------------------------------------------
55
56 'mainComponent': function() {
57 return this._mainComponent;
58 },
59
60 //-------------------------------------------------------------------------
61
62 'render': function() {
63 varnotesSelectorCheckboxCells;
64 var totalNumberOfColumns;
65 var titleColumnIndex;
66 var notesColumnIndex;
67 var i,c;
68
69 Clipperz.NotificationCenter.unregister(this);
70 MochiKit.Signal.disconnectAllTo(this);
71
72 this.element().update("");
73
74 titleColumnIndex = this.mainComponent().titleColumnIndex()
75 notesColumnIndex = this.mainComponent().notesColumnIndex()
76
77 totalNumberOfColumns = this.mainComponent().parsedValues()[0].length;
78
79 notesSelectorCheckboxCells = [{tag:'th', cls:'title', html:this.mainComponent().labelForColumn(titleColumnIndex)}];
80 c =totalNumberOfColumns;
81 for (i=0; i<c; i++) {
82 if ((i != titleColumnIndex) && (this.mainComponent().isColumnSelected(i))) {
83 notesSelectorCheckboxCells.push({tag:'th', id:this.getId('th_' + i), valign:'top', children:[
84 {tag:'input', type:'radio', id:this.getId('radio_' + i), name:'CSVImportNotesColumn', value:i},
85 {tag:'span', cls:'clickableSpan', id:this.getId('columnLabel_' + i), html:this.mainComponent().labelForColumn(i)}
86 ]})
87 }
88 }
89
90 this.domHelper().append(this.element(), {tag:'div', children:[
91 {tag:'div', cls:'importStepDescription', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Notes']},
92 {tag:'div', id:this.getId('dataDiv'), children:[
93 {tag:'div', cls:'importStepParameters', children:[
94 {tag:'input', id:this.getId('doNotSetNotes_radio'), type:'radio', name:'CSVImportNotesColumn', value:-1},
95 {tag:'span', id:this.getId('doNotSetNotes_span'), cls:'clickableSpan', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Notes_Settings_noSelectionLabel']}
96 ]},
97 {tag:'div', cls:'csvImportPreview', children:[
98 {tag:'table', id:this.getId('previewDada'), cls:'csvImportPreview', cellspacing:'0', children:[
99 {tag:'thead', id:this.getId('previewData_thead'), children:[
100 {tag:'tr', children:notesSelectorCheckboxCells}
101 ]},
102 {tag:'tbody', id:this.getId('previewData_tbody'), children:[]}
103 ]}
104 ]}
105 ]}
106 ]});
107
108 this.renderData(this.getElement('previewData_tbody'), this.mainComponent().parsedValues());
109
110 if ((notesColumnIndex >= totalNumberOfColumns) || (notesColumnIndex == titleColumnIndex) || !(this.mainComponent().isColumnSelected(notesColumnIndex))) {
111 this.mainComponent().setNotesColumnIndex(-1);
112 notesColumnIndex = -1;
113 }
114
115 c =totalNumberOfColumns;
116 for (i=0; i<c; i++) {
117 if ((i != titleColumnIndex) && (this.mainComponent().isColumnSelected(i))) {
118 MochiKit.Signal.connect(this.getDom('radio_' + i), 'onclick', this, 'renderDataHandler');
119 if (Clipperz_IEisBroken != true) {
120 MochiKit.Signal.connect(this.getDom('columnLabel_' + i), 'onclick', this.getDom('radio_' + i), 'click');
121 }
122 }
123 }
124
125 MochiKit.Signal.connect(this.getDom('doNotSetNotes_radio'), 'onclick', this, 'renderDataHandler');
126 if (Clipperz_IEisBroken != true) {
127 MochiKit.Signal.connect(this.getDom('doNotSetNotes_span'), 'onclick', this.getDom('doNotSetNotes_radio'), 'click');
128 }
129
130 if (notesColumnIndex == -1) {
131 this.getDom('doNotSetNotes_radio').click();
132 } else {
133 this.getDom('radio_' + notesColumnIndex).click();
134 }
135 },
136
137 //-------------------------------------------------------------------------
138
139 'renderData': function(anElement, someData) {
140 var data;
141 var config;
142 var titleColumnIndex;
143 var notesColumnIndex;
144 var i,c;
145
146 // anElement.update("");
147 MochiKit.DOM.replaceChildNodes(anElement.dom);
148
149 titleColumnIndex = this.mainComponent().titleColumnIndex();
150 notesColumnIndex = this.mainComponent().notesColumnIndex();
151
152 if (this.mainComponent().isFirstRowHeader()) {
153 data = someData.slice(1);
154 } else {
155 data = someData;
156 }
157
158
159 // config = [{tag:'tr', cls:'CSV_previewData_header', children:[{tag:'td', valign:'top', html:header[titleColumnIndex], cls:'title'}]}];
160 // c = header.length;
161 // for (i=0; i<c; i++) {
162 // if (i != titleColumnIndex) {
163 // config[0].children.push({tag:'td', valign:'top', html:header[i], cls:((notesColumnIndex == i) ? 'notesColumn': '')})
164 // }
165 // }
166
167 config = MochiKit.Base.map(MochiKit.Base.bind(function(aTitleColumnIndex, aRowData) {
168 var result;
169 var i,c;
170
171 result = {tag:'tr', children:[{tag:'td', valign:'top', cls:'title', html:(MochiKit.Base.isNotEmpty(aRowData[aTitleColumnIndex]) ? aRowData[aTitleColumnIndex].replace(/\n/g, '<br>') : '&nbsp;')}]};
172 c = aRowData.length;
173 for (i=0; i<c; i++) {
174 if ((i != titleColumnIndex) && (this.mainComponent().isColumnSelected(i))) {
175 result.children.push({tag:'td', valign:'top', cls:((notesColumnIndex == i) ? 'notesColumn': ''), html:(MochiKit.Base.isNotEmpty(aRowData[i]) ? aRowData[i].replace(/\n/g, '<br>') : '&nbsp;')});
176 }
177 }
178
179 return result;
180 }, this, titleColumnIndex), data);
181
182 MochiKit.Base.map(function(aRowConfig) {Clipperz.YUI.DomHelper.append(anElement, aRowConfig);}, config);
183
184 Clipperz.Style.applyZebraStylesToTable(this.getId('previewDada'));
185 },
186
187 //-------------------------------------------------------------------------
188
189 'renderDataHandler': function(anEvent) {
190 var titleColumnIndex;
191 var i,c;
192
193 this.mainComponent().setNotesColumnIndex(anEvent.src().value);
194 titleColumnIndex = this.mainComponent().titleColumnIndex();
195
196 c = this.mainComponent().parsedValues()[0].length;
197 for (i=0; i<c; i++) {
198 if ((i != titleColumnIndex) && (this.mainComponent().isColumnSelected(i))) {
199 this.getElement('th_' + i).removeClass('notesColumn');
200 }
201 }
202 if (anEvent.src().value != -1) {
203 this.getElement('th_' + anEvent.src().value).addClass('notesColumn');
204 }
205
206 this.renderData(this.getElement('previewData_tbody'), this.mainComponent().parsedValues());
207 },
208
209 //-------------------------------------------------------------------------
210 __syntaxFix__: "syntax fix"
211});
212
diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportTitle.js b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportTitle.js
new file mode 100644
index 0000000..9162867
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportTitle.js
@@ -0,0 +1,189 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; }
33if (typeof(Clipperz.PM.Components.Import.CSVImport) == 'undefined') { Clipperz.PM.Components.Import.CSVImport = {}; }
34
35//#############################################################################
36
37Clipperz.PM.Components.Import.CSVImport.CSVImportTitle = function(anElement, args) {
38 args = args || {};
39
40 Clipperz.PM.Components.Import.CSVImport.CSVImportTitle.superclass.constructor.call(this, anElement, args);
41 this._mainComponent = args.mainComponent;
42
43 return this;
44}
45
46//=============================================================================
47
48YAHOO.extendX(Clipperz.PM.Components.Import.CSVImport.CSVImportTitle, Clipperz.PM.Components.BaseComponent, {
49
50 'toString': function() {
51 return "Clipperz.PM.Components.Import.CSVImport.CSVImportTitle component";
52 },
53
54 //-------------------------------------------------------------------------
55
56 'mainComponent': function() {
57 return this._mainComponent;
58 },
59
60 //-------------------------------------------------------------------------
61
62 'render': function() {
63 vartitleSelectorCheckboxCells;
64 var titleColumnIndex;
65 var i,c;
66
67 Clipperz.NotificationCenter.unregister(this);
68 MochiKit.Signal.disconnectAllTo(this);
69
70 this.element().update("");
71
72 titleColumnIndex = this.mainComponent().titleColumnIndex()
73 titleSelectorCheckboxCells = [];
74 c =this.mainComponent().parsedValues()[0].length;
75 for (i=0; i<c; i++) {
76 if (this.mainComponent().isColumnSelected(i)) {
77 titleSelectorCheckboxCells.push({tag:'th', valign:'top', id:this.getId('th_' + i), children:[
78 {tag:'input', type:'radio', id:this.getId('radio_' + i), name:'CSVImportTitleColumn', value:i},
79 {tag:'span', cls:'clickableSpan', id:this.getId('columnLabel_' + i), html:this.mainComponent().labelForColumn(i)}
80 ]})
81 }
82 }
83
84 if (titleColumnIndex >= titleSelectorCheckboxCells.length) {
85 this.mainComponent().setTitleColumnIndex(-1);
86 }
87
88 this.domHelper().append(this.element(), {tag:'div', children:[
89 {tag:'div', cls:'importStepDescription', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Title']},
90 {tag:'div', id:this.getId('dataDiv'), cls:'csvImportPreview', children:[
91 {tag:'table', id:this.getId('previewDada'), cls:'csvImportPreview', cellspacing:'0', children:[
92 {tag:'thead', id:this.getId('previewData_thead'), children:[
93 {tag:'tr', children:titleSelectorCheckboxCells}
94 ]},
95 {tag:'tbody', id:this.getId('previewData_tbody'), children:[]}
96 ]}
97 ]}
98 ]});
99
100 this.renderData(this.getElement('previewData_tbody'), this.mainComponent().parsedValues());
101
102 c =this.mainComponent().parsedValues()[0].length;
103 for (i=0; i<c; i++) {
104 if (this.mainComponent().isColumnSelected(i)) {
105 MochiKit.Signal.connect(this.getDom('radio_' + i), 'onclick', this, 'renderDataHandler');
106 if (Clipperz_IEisBroken != true) {
107 MochiKit.Signal.connect(this.getDom('columnLabel_' + i), 'onclick', this.getDom('radio_' + i), 'click');
108 }
109 }
110 }
111
112 if (titleColumnIndex != -1) {
113 this.getDom('radio_' + titleColumnIndex).click();
114 } else {
115 this.mainComponent().nextButton().disable();
116 }
117
118 },
119
120 //-------------------------------------------------------------------------
121
122 'renderData': function(anElement, someData) {
123 var data;
124 var config;
125 var titleColumnIndex;
126 var i,c;
127
128 // anElement.update("");
129 MochiKit.DOM.replaceChildNodes(anElement.dom);
130
131 titleColumnIndex = this.mainComponent().titleColumnIndex()
132
133 if (this.mainComponent().isFirstRowHeader()) {
134 data = someData.slice(1);
135 } else {
136 data = someData;
137 }
138
139 config = MochiKit.Base.map(MochiKit.Base.bind(function(aRowData) {
140 var result;
141 var i,c;
142
143 result = {tag:'tr', children:[]};
144 c = aRowData.length;
145 for (i=0; i<c; i++) {
146 if (this.mainComponent().isColumnSelected(i)) {
147 var field;
148
149 field = aRowData[i];
150 result.children.push({tag:'td', valign:'top', cls:((titleColumnIndex == i) ? 'titleColumn': ''), html:(MochiKit.Base.isNotEmpty(field) ? field.replace(/\n/g, '<br>') : '&nbsp;')});
151 }
152 }
153
154 return result;
155 }, this), data);
156
157 MochiKit.Base.map(function(aRowConfig) {Clipperz.YUI.DomHelper.append(anElement, aRowConfig);}, config);
158
159 Clipperz.Style.applyZebraStylesToTable(this.getId('previewDada'));
160 },
161
162 //-------------------------------------------------------------------------
163
164 'renderDataHandler': function(anEvent) {
165 var i,c;
166
167 this.mainComponent().setTitleColumnIndex(anEvent.src().value);
168
169 c = this.mainComponent().parsedValues()[0].length;
170 for (i=0; i<c; i++) {
171 if (this.mainComponent().isColumnSelected(i)) {
172 this.getElement('th_' + i).removeClass('titleColumn');
173 }
174 }
175 this.getElement('th_' + anEvent.src().value).addClass('titleColumn');
176
177 if (anEvent.src().value != -1) {
178 this.mainComponent().nextButton().enable();
179 } else {
180 this.mainComponent().nextButton().disable();
181 }
182
183 this.renderData(this.getElement('previewData_tbody'), this.mainComponent().parsedValues());
184 },
185
186 //-------------------------------------------------------------------------
187 __syntaxFix__: "syntax fix"
188});
189
diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/CSVImportComponent.js b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImportComponent.js
new file mode 100644
index 0000000..707a3d2
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImportComponent.js
@@ -0,0 +1,548 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.Import.CSVImportComponent = function(anElement, args) {
37 args = args || {};
38
39 this._steps = this._steps || ['CSV_EDIT', 'CSV_COLUMNS', 'CSV_HEADER', 'CSV_TITLE', 'CSV_NOTES', 'CSV_FIELDS', 'PREVIEW', 'IMPORT'];
40
41 Clipperz.PM.Components.Import.CSVImportComponent.superclass.constructor.call(this, anElement, args);
42
43 this._step1Component = null;
44 this._step2Component = null;
45 this._step3Component = null;
46 this._step4Component = null;
47 this._step5Component = null;
48
49 this._isFirstRowHeader = false;
50 this._titleColumnIndex = -1;
51 this._notesColumnIndex = -1;
52 this._fieldSettings = {};
53 this._skippedColumns = new Clipperz.Set();
54
55 this.render();
56
57 return this;
58}
59
60//=============================================================================
61
62YAHOO.extendX(Clipperz.PM.Components.Import.CSVImportComponent, Clipperz.PM.Components.Import.GenericImportComponent, {
63
64 'toString': function() {
65 return "Clipperz.PM.Components.Import.CSVImportComponent component";
66 },
67
68 //-------------------------------------------------------------------------
69
70 'render': function() {
71 this.domHelper().append(this.element(), {tag:'div', cls:'csvImportWizard', children:[
72 {tag:'h3', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Title']},
73 {tag:'div', cls:'importSteps', id:this.getId('importSteps')},
74 {tag:'div', cls:'importStepBlocks', children:[
75 {tag:'div', cls:'step_0', id:this.getId('step_0'), children:[
76 {tag:'div', children:[
77 {tag:'div', cls:'importOptionsDescription', htmlString:Clipperz.PM.Strings['importOptions_csv_description']},
78 {tag:'div', cls:'importOptionsParameters', children:[
79 {tag:'div', cls:'CSVImportOptionsParameters', children:[
80 {tag:'ul', children:[
81 {tag:'li', children:[
82 {tag:'label', 'for':this.getId('CSV_inputOptions_separator'), html:"separator"},
83 {tag:'select', name:this.getId('CSV_inputOptions_separator'), id:this.getId('CSV_inputOptions_separator'), children:[
84 {tag:'option', name:'comma', value:',', html:"comma (,)", selected:true},
85 {tag:'option', name:'tab', value:'\t', html:"tab"}
86 ]}
87 ]},
88
89 {tag:'li', children:[
90 {tag:'label', 'for':this.getId('CSV_inputOptions_quote'), html:"quote"},
91 {tag:'select', name:this.getId('CSV_inputOptions_quote'), id:this.getId('CSV_inputOptions_quote'), children:[
92 {tag:'option', name:'doubleQuote', value:'\"', html:"double quote (\")", selected:true},
93 {tag:'option', name:'singleQuote', value:'\'', html:"single quote (\')"}
94 ]}
95 ]},
96
97 {tag:'li', children:[
98 {tag:'label', 'for':this.getId('CSV_inputOptions_escape'), html:"escape"},
99 {tag:'select', name:this.getId('CSV_inputOptions_escape'), id:this.getId('CSV_inputOptions_escape'), children:[
100 {tag:'option', name:'doubleQuote', value:'\"', html:"double quote (\")", selected:true},
101 {tag:'option', name:'slash', value:'\/', html:"slash (\/)"},
102 {tag:'option', name:'backslash', value:'\\', html:"backslash (\\)"}
103 ]}
104 ]}
105 ]}
106 ]}
107 ]},
108 this.textAreaConfig()
109 ]}
110 ]},
111 {tag:'div', cls:'step_1', id:this.getId('step_1'), children:[]},
112 {tag:'div', cls:'step_2', id:this.getId('step_2'), children:[]},
113 {tag:'div', cls:'step_3', id:this.getId('step_3'), children:[]},
114 {tag:'div', cls:'step_4', id:this.getId('step_4'), children:[]},
115 {tag:'div', cls:'step_5', id:this.getId('step_5'), children:[]},
116 {tag:'div', cls:'step_6', id:this.getId('step_6'), children:[
117 {tag:'div', children:[
118 {tag:'div', id:this.getId('previewDiv'), html:"preview"}
119 ]}
120 ]},
121 {tag:'div', cls:'step_7', id:this.getId('step_7'), children:[
122 {tag:'div', children:[
123 {tag:'h4', html:"done"}
124 ]}
125 ]}
126 ]},
127 {tag:'div', cls:'importOptionsButtons', children:[
128 {tag:'table', children:[
129 {tag:'tbody', children:[
130 {tag:'tr', children:[
131 {tag:'td', html:'&nbsp;'},
132 {tag:'td', children:[
133 {tag:'div', id:this.getId('backActionButton')}
134 ]},
135 {tag:'td', html:'&nbsp;'},
136 {tag:'td', children:[
137 {tag:'div', id:this.getId('nextActionButton')}
138 ]},
139 {tag:'td', html:'&nbsp;'}
140 ]}
141 ]}
142 ]}
143 ]}
144 ]});
145
146 this.setBackButton(new YAHOO.ext.Button(this.getDom('backActionButton'), {text:"back", handler:this.backAction, scope:this}));
147 this.setNextButton(new YAHOO.ext.Button(this.getDom('nextActionButton'), {text:"next", handler:this.nextAction, scope:this}));
148
149 this.updateSteps();
150
151 this.getElement('step_0').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show()
152 this.getElement('step_1').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
153 this.getElement('step_2').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
154 this.getElement('step_3').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
155 this.getElement('step_4').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
156 this.getElement('step_5').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
157 this.getElement('step_6').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
158 this.getElement('step_7').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
159
160 // this.backButton().disable();
161 },
162
163 //-------------------------------------------------------------------------
164
165 'nextAction': function() {
166 switch (this.currentStep()) {
167 case 0: //-> 1
168 Clipperz.PM.Components.MessageBox.showProgressPanel(
169 MochiKit.Base.method(this, 'deferredParseValues'),
170 MochiKit.Base.method(this, 'handleParseError'),
171 this.getDom('nextActionButton')
172 );
173 break;
174 case 1: //-> 2
175 this.getElement('step_1').hide();
176 this.step2Component().render();
177 this.setCurrentStep(2);
178 this.getElement('step_2').show();
179 break;
180 case 2: //-> 3
181 this.getElement('step_2').hide();
182 this.step3Component().render();
183 this.setCurrentStep(3);
184 this.getElement('step_3').show();
185 break;
186 case 3: //-> 4
187 this.getElement('step_3').hide();
188 this.step4Component().render();
189 this.setCurrentStep(4);
190 this.getElement('step_4').show();
191 break;
192 case 4: //-> 5
193 this.getElement('step_4').hide();
194 this.step5Component().render();
195 this.setCurrentStep(5);
196 this.getElement('step_5').show();
197 break;
198 case 5: //-> 6
199 this.previewValues();
200 break;
201 case 6: //-> 7
202 this.importValues();
203 break;
204 }
205 },
206
207 //-------------------------------------------------------------------------
208
209 'deferredParseValues': function() {
210 var deferredResult;
211
212 deferredResult = new MochiKit.Async.Deferred();
213//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("CSVImportComponent.deferredParseValues - 1 " + res.substring(0,50)); return res;});
214 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'parseImportData');
215//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("CSVImportComponent.deferredParseValues - 2 " + res.substring(0,50)); return res;});
216 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
217 this.startProcessing();
218
219 return res;
220 }, this));
221//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("CSVImportComponent.deferredParseValues - 3 " + res.substring(0,50)); return res;});
222 deferredResult.addCallback(MochiKit.Base.method(this, 'parseCSVValues'));
223//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("CSVImportComponent.deferredParseValues - 4 " + res); return res;});
224 deferredResult.addCallback(MochiKit.Base.method(this, 'setParsedValues'));
225//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("CSVImportComponent.deferredParseValues - 5 " + res); return res;});
226 deferredResult.addCallback(MochiKit.Base.method(this.step1Component(), 'render'));
227//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("CSVImportComponent.deferredParseValues - 6 " + res); return res;});
228 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
229 this.processingDone();
230 this.getElement('step_0').hide();
231 this.getElement('step_1').show();
232 this.backButton().enable();
233
234 return res;
235 }, this));
236//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("CSVImportComponent.deferredParseValues - 7 " + res); return res;});
237 deferredResult.callback(this.textAreaContent());
238
239 return deferredResult;
240 },
241
242 //-------------------------------------------------------------------------
243
244 'deferredPreviewValues': function() {
245 var deferredResult;
246
247//MochiKit.Logging.logDebug(">>> CSVImportComponent.deferredPreviewValues");
248 deferredResult = new MochiKit.Async.Deferred();
249//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredPreviewValues - 1 " + res); return res;});
250 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'previewImportData');
251//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredPreviewValues - 2 " + res); return res;});
252 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
253 this.startProcessing();
254
255 return res;
256 }, this));
257//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredPreviewValues - 3 " + res); return res;});
258 deferredResult.addCallback(MochiKit.Base.method(this, 'processCSVParsedValues'));
259//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredPreviewValues - 4 " + res); return res;});
260 deferredResult.addCallback(MochiKit.Base.method(this, 'setProcessedValues'));
261//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredPreviewValues - 5 " + res); return res;});
262 deferredResult.addCallback(MochiKit.Base.method(this, 'previewRecordValues'));
263//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredPreviewValues - 6 " + res); return res;});
264 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
265 this.processingDone();
266 this.getElement('step_5').hide();
267 this.getElement('step_6').show();
268 this.backButton().enable();
269
270 return res;
271 }, this));
272 deferredResult.callback(this.parsedValues());
273//MochiKit.Logging.logDebug("<<< CSVImportComponent.deferredPreviewValues");
274
275 return deferredResult;
276 },
277
278 //-------------------------------------------------------------------------
279
280 'csvProcessor': function() {
281 return new Clipperz.CSVProcessor({
282 quoteChar: this.getDom('CSV_inputOptions_quote').value,
283 escapeChar: this.getDom('CSV_inputOptions_escape').value,
284 separatorChar:this.getDom('CSV_inputOptions_separator').value,
285 binary:true
286 });
287 },
288
289 //-------------------------------------------------------------------------
290
291 'parseCSVValues': function(someData) {
292 var deferredResult;
293 var csvProcessor;
294
295 csvProcessor = this.csvProcessor();
296 deferredResult = new MochiKit.Async.Deferred();
297//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.parseKeePassValues - 1 " + res.substring(0,50)); return res;});
298 deferredResult.addCallback(function(res) {
299 return Clipperz.NotificationCenter.deferredNotification(this, 'updatedProgressState', {steps:(res.length)}, res);
300 })
301//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.parseKeePassValues - 2 " + res.substring(0,50)); return res;});
302 deferredResult.addCallback(MochiKit.Base.method(csvProcessor, 'deferredParse'));
303//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.parseKeePassValues - 3 " + res); return res;});
304 deferredResult.callback(someData);
305
306 return deferredResult;
307 },
308
309 //-------------------------------------------------------------------------
310
311 'processCSVParsedValues': function (someValues) {
312 var deferredResult;
313 var records;
314 var titleColumnIndex;
315 var notesColumnIndex;
316 var i,c;
317
318 deferredResult = new MochiKit.Async.Deferred();
319 records = [];
320
321 titleColumnIndex = this.titleColumnIndex();
322 notesColumnIndex = this.notesColumnIndex();
323
324 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', {steps:(someValues.length)});
325
326 c = someValues.length;
327 if (this.isFirstRowHeader()) {
328 i = 1;
329 } else {
330 i = 0;
331 }
332
333 for( ; i<c; i++) {
334 deferredResult.addCallback(MochiKit.Async.wait, 0.2);
335 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', {});
336 deferredResult.addCallback(MochiKit.Base.bind(function(someRecords, someData) {
337 var record;
338 var recordVersion;
339 var ii;
340
341 record = new Clipperz.PM.DataModel.Record({user:this.user()});
342 record.setLabel(someData[titleColumnIndex]);
343 if (notesColumnIndex != -1) {
344 record.setNotes(someData[notesColumnIndex]);
345 }
346 recordVersion = record.currentVersion()
347
348 for (ii in someData) {
349 // if ((ii != titleColumnIndex) && (ii != notesColumnIndex) && (typeof(this.fieldSettings()[ii]) != 'undefined')) {
350 if ((ii != titleColumnIndex) && (ii != notesColumnIndex) && (this.isColumnSelected(ii))) {
351 var recordField;
352
353 recordField = new Clipperz.PM.DataModel.RecordField({
354 recordVersion:recordVersion,
355 label: this.labelForColumn(ii),
356 value: someData[ii],
357 type: this.typeForColumn(ii)
358 });
359 recordVersion.addField(recordField);
360 }
361 }
362
363 someRecords.push(record);
364
365 return someRecords;
366 }, this), records, someValues[i]);
367 }
368 deferredResult.addCallback(MochiKit.Async.succeed, records);
369 deferredResult.callback();
370
371 return deferredResult;
372 },
373
374 //-------------------------------------------------------------------------
375
376 'step1Component': function() {
377 if (this._step1Component == null) {
378 this._step1Component = new Clipperz.PM.Components.Import.CSVImport.CSVImportColumns(this.getElement('step_1'), {mainComponent:this});
379 }
380
381 return this._step1Component;
382 },
383
384 'step2Component': function() {
385 if (this._step2Component == null) {
386 this._step2Component = new Clipperz.PM.Components.Import.CSVImport.CSVImportHeader(this.getElement('step_2'), {mainComponent:this});
387 }
388
389 return this._step2Component;
390 },
391
392 'step3Component': function() {
393 if (this._step3Component == null) {
394 this._step3Component = new Clipperz.PM.Components.Import.CSVImport.CSVImportTitle(this.getElement('step_3'), {mainComponent:this});
395 }
396
397 return this._step3Component;
398 },
399
400 'step4Component': function() {
401 if (this._step4Component == null) {
402 this._step4Component = new Clipperz.PM.Components.Import.CSVImport.CSVImportNotes(this.getElement('step_4'), {mainComponent:this});
403 }
404
405 return this._step4Component;
406 },
407
408 'step5Component': function() {
409 if (this._step5Component == null) {
410 this._step5Component = new Clipperz.PM.Components.Import.CSVImport.CSVImportFields(this.getElement('step_5'), {mainComponent:this});
411 }
412
413 return this._step5Component;
414 },
415
416 //-------------------------------------------------------------------------
417
418 'isFirstRowHeader': function() {
419 return this._isFirstRowHeader;
420 },
421
422 'setIsFirstRowHeader': function(aValue) {
423 this._isFirstRowHeader = aValue;
424 },
425
426 //-------------------------------------------------------------------------
427
428 'titleColumnIndex': function() {
429 return this._titleColumnIndex;
430 },
431
432 'setTitleColumnIndex': function(aValue) {
433 this._titleColumnIndex = aValue;
434 },
435
436 //-------------------------------------------------------------------------
437
438 'notesColumnIndex': function() {
439 return this._notesColumnIndex;
440 },
441
442 'setNotesColumnIndex': function(aValue) {
443 this._notesColumnIndex = aValue;
444 },
445
446 //-------------------------------------------------------------------------
447
448 'fieldSettings': function() {
449 return this._fieldSettings;
450 },
451
452 //-------------------------------------------------------------------------
453
454 'skippedColumns': function() {
455 return this._skippedColumns;
456 },
457
458 //-------------------------------------------------------------------------
459
460 'isColumnSelected': function(aColumnIndex) {
461 return !this.skippedColumns().contains("" + aColumnIndex);
462 },
463
464 //=========================================================================
465
466 'labelForColumn': function(aColumnIndex) {
467 var result;
468
469 if ((typeof(this.fieldSettings()) != 'undefined') && (typeof(this.fieldSettings()[aColumnIndex]) != 'undefined')) {
470 if (this.isFirstRowHeader()) {
471 result = this.fieldSettings()[aColumnIndex]['_firstRowLabel'];
472//MochiKit.Logging.logDebug("--- updateInputFieldValues - [" + aColumnIndex + "] _firstRowLabel: " + label);
473 } else {
474 result = this.fieldSettings()[aColumnIndex]['_emptyLabel'];
475//MochiKit.Logging.logDebug("--- updateInputFieldValues - [" + aColumnIndex + "] _emptyLabel: " + label);
476 }
477 } else {
478 result = "";
479 }
480
481 return result;
482 },
483
484 //-------------------------------------------------------------------------
485
486 'setLabelForColumn': function(aLabel, aColumnIndex) {
487 var fieldSettings;
488
489//MochiKit.Logging.logDebug(">>> setLabelForColumn[" + aColumnIndex + "]: " + aLabel);
490 fieldSettings = this.fieldSettings();
491
492 if (typeof(fieldSettings[aColumnIndex]) == 'undefined') {
493 fieldSettings[aColumnIndex] = {}
494 }
495
496 if (this.isFirstRowHeader()) {
497//MochiKit.Logging.logDebug("--- setLabelForColumn -> _firstRowLabel");
498 fieldSettings[aColumnIndex]['_firstRowLabel'] = aLabel;
499 } else {
500 if (typeof(fieldSettings[aColumnIndex]['_emptyLabel']) == 'undefined') {
501 if (aLabel == null) {
502//MochiKit.Logging.logDebug("--- setLabelForColumn -> _emptyLabel = \"\"");
503 fieldSettings[aColumnIndex]['_emptyLabel'] = "";
504 } else {
505 fieldSettings[aColumnIndex]['_emptyLabel'] = aLabel;
506 }
507 } else {
508//MochiKit.Logging.logDebug("--- setLabelForColumn -> _emptyLabel = " + aLabel);
509 if (aLabel != null) {
510 fieldSettings[aColumnIndex]['_emptyLabel'] = aLabel;
511 }
512 }
513 }
514//MochiKit.Logging.logDebug("<<< setLabelForColumn[" + aColumnIndex + "]: " + aLabel);
515 },
516
517 //=========================================================================
518
519 'typeForColumn': function(aColumnIndex) {
520 var result;
521
522 if ((typeof(this.fieldSettings()) != 'undefined') && (typeof(this.fieldSettings()[aColumnIndex]) != 'undefined') && (typeof(this.fieldSettings()[aColumnIndex]['type']) != 'undefined')) {
523 result = this.fieldSettings()[aColumnIndex]['type'];
524 } else {
525 result = 'UNDEFINED';
526 }
527
528 return result;
529 },
530
531 //-------------------------------------------------------------------------
532
533 'setTypeForColumn': function(aType, aColumnIndex) {
534 var fieldSettings;
535
536 fieldSettings = this.fieldSettings();
537
538 if (typeof(fieldSettings[aColumnIndex]) == 'undefined') {
539 fieldSettings[aColumnIndex] = {}
540 }
541
542 fieldSettings[aColumnIndex]['type'] = aType;
543 },
544
545 //=========================================================================
546 __syntaxFix__: "syntax fix"
547});
548
diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/ClipperzImportComponent.js b/frontend/beta/js/Clipperz/PM/Components/Import/ClipperzImportComponent.js
new file mode 100644
index 0000000..50dcb93
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Import/ClipperzImportComponent.js
@@ -0,0 +1,212 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.Import.ClipperzImportComponent = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.Import.ClipperzImportComponent.superclass.constructor.call(this, anElement, args);
40
41 this.render();
42
43 return this;
44}
45
46//=============================================================================
47
48YAHOO.extendX(Clipperz.PM.Components.Import.ClipperzImportComponent, Clipperz.PM.Components.Import.GenericImportComponent, {
49
50 'toString': function() {
51 return "Clipperz.PM.Components.Import.ClipperzImportComponent component";
52 },
53
54 //-------------------------------------------------------------------------
55
56 'render': function() {
57//MochiKit.Logging.logDebug(">>> Import.ClipperzImportComponent.render");
58 this.domHelper().append(this.element(), {tag:'div', cls:'clipperzImportWizard', children:[
59 {tag:'h3', htmlString:Clipperz.PM.Strings['Clipperz_ImportWizard_Title']},
60 {tag:'div', cls:'importSteps', id:this.getId('importSteps')},
61 {tag:'div', cls:'importStepBlocks', children:[
62 {tag:'div', cls:'step_0', id:this.getId('step_0'), children:[
63 {tag:'div', children:[
64 {tag:'div', cls:'importOptionsDescription', htmlString:Clipperz.PM.Strings['importOptions_clipperz_description']},
65 {tag:'div', cls:'importOptionsParameters', children:[]},
66 this.textAreaConfig()
67 ]}
68 ]},
69 {tag:'div', cls:'step_1', id:this.getId('step_1'), children:[
70 {tag:'div', children:[
71 {tag:'div', id:this.getId('previewDiv'), html:"preview"}
72 ]}
73 ]},
74 {tag:'div', cls:'step_2', id:this.getId('step_2'), children:[
75 {tag:'div', children:[
76 {tag:'h4', html:"done"}
77 ]}
78 ]}
79 ]},
80 {tag:'div', cls:'importOptionsButtons', children:[
81 {tag:'table', children:[
82 {tag:'tbody', children:[
83 {tag:'tr', children:[
84 {tag:'td', html:'&nbsp;'},
85 {tag:'td', children:[
86 {tag:'div', id:this.getId('backActionButton')}
87 ]},
88 {tag:'td', html:'&nbsp;'},
89 {tag:'td', children:[
90 {tag:'div', id:this.getId('nextActionButton')}
91 ]},
92 {tag:'td', html:'&nbsp;'}
93 ]}
94 ]}
95 ]}
96 ]}
97 ]});
98
99 this.updateSteps();
100
101 this.setBackButton(new YAHOO.ext.Button(this.getDom('backActionButton'), {text:"back", handler:this.backAction, scope:this}));
102 this.setNextButton(new YAHOO.ext.Button(this.getDom('nextActionButton'), {text:"next", handler:this.nextAction, scope:this}));
103
104 this.getElement('step_0').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show()
105 this.getElement('step_1').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
106 this.getElement('step_2').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
107//MochiKit.Logging.logDebug("<<< Import.ClipperzImportComponent.render");
108 },
109
110 //-------------------------------------------------------------------------
111
112 'nextAction': function() {
113 switch (this.currentStep()) {
114 case 0: //-> 1
115 this.previewValues();
116 break;
117 case 1: //-> 2
118 this.importValues();
119 break;
120 }
121 },
122
123 //-------------------------------------------------------------------------
124
125 'deferredPreviewValues': function() {
126 var deferredResult;
127
128 deferredResult = new MochiKit.Async.Deferred();
129 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
130 this.startProcessing();
131
132 return res;
133 }, this));
134 deferredResult.addCallback(MochiKit.Base.method(this, 'processClipperzValues'));
135 deferredResult.addCallback(MochiKit.Base.method(this, 'setProcessedValues'));
136 deferredResult.addCallback(MochiKit.Base.method(this, 'previewRecordValues'));
137 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
138 this.processingDone();
139 this.getElement('step_0').hide();
140 this.getElement('step_1').show();
141 this.backButton().enable();
142
143 return res;
144 }, this));
145 // deferredResult.addErrback(MochiKit.Base.bind(function() {
146 // this.processingAborted();
147 // }, this))
148 deferredResult.callback(this.textAreaContent());
149
150 return deferredResult;
151 },
152
153 //-------------------------------------------------------------------------
154
155 'processClipperzValues': function(someData) {
156 var deferredResult;
157
158 deferredResult = new MochiKit.Async.Deferred();
159//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Record.processClipperzValues - 1: " + res); return res;});
160 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'parseImportData');
161//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Record.processClipperzValues - 2: " + res); return res;});
162 deferredResult.addCallback(Clipperz.Base.evalJSON);
163//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Record.processClipperzValues - 3: " + res); return res;});
164 deferredResult.addCallback(function(res) {
165 return Clipperz.NotificationCenter.deferredNotification(this, 'updatedProgressState', {steps:(res.length)}, res);
166 })
167//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Record.processClipperzValues - 4: " + res); return res;});
168 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'previewImportData');
169//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Record.processClipperzValues - 5: " + res); return res;});
170 deferredResult.addCallback(MochiKit.Base.bind(function(someClipperzValues) {
171 var innerDeferredResult;
172 var records;
173 var i,c;
174
175 innerDeferredResult = new MochiKit.Async.Deferred();
176 records = [];
177
178 c = someClipperzValues.length;
179 for(i=0; i<c; i++) {
180 innerDeferredResult.addCallback(MochiKit.Async.wait, 0.2);
181 innerDeferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', {});
182 innerDeferredResult.addCallback(MochiKit.Base.bind(function(someRecords, someData) {
183 var record;
184 var recordVersion;
185
186//MochiKit.Logging.logDebug("=== someData: " + Clipperz.Base.serializeJSON(someData));
187 record = new Clipperz.PM.DataModel.Record({user:this.user()});
188 record.setLabel(someData['label']);
189 record.setShouldProcessData(true);
190 record.processData(someData);
191
192 someRecords.push(record);
193
194 return someRecords;
195 }, this), records, someClipperzValues[i]);
196 }
197 innerDeferredResult.addCallback(MochiKit.Async.succeed, records);
198 innerDeferredResult.callback();
199
200 return innerDeferredResult;
201 }, this));
202//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Record.processClipperzValues - 6: " + res); return res;});
203 deferredResult.callback(someData);
204
205 return deferredResult;
206 },
207
208
209 //-------------------------------------------------------------------------
210 __syntaxFix__: "syntax fix"
211});
212
diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/ExcelImportComponent.js b/frontend/beta/js/Clipperz/PM/Components/Import/ExcelImportComponent.js
new file mode 100644
index 0000000..ecdf509
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Import/ExcelImportComponent.js
@@ -0,0 +1,134 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.Import.ExcelImportComponent = function(anElement, args) {
37 args = args || {};
38
39 this._steps = ['EXCEL_EDIT', 'CSV_COLUMNS', 'CSV_HEADER', 'CSV_TITLE', 'CSV_NOTES', 'CSV_FIELDS', 'PREVIEW', 'IMPORT'];
40
41 Clipperz.PM.Components.Import.ExcelImportComponent.superclass.constructor.call(this, anElement, args);
42
43 return this;
44}
45
46//=============================================================================
47
48YAHOO.extendX(Clipperz.PM.Components.Import.ExcelImportComponent, Clipperz.PM.Components.Import.CSVImportComponent, {
49
50 'toString': function() {
51 return "Clipperz.PM.Components.Import.ExcelImportComponent component";
52 },
53
54 //-------------------------------------------------------------------------
55
56 'render': function() {
57//MochiKit.Logging.logDebug(">>> Import.ExcelImportComponent.render");
58 this.domHelper().append(this.element(), {tag:'div', cls:'excelImportWizard', children:[
59 {tag:'h3', htmlString:Clipperz.PM.Strings['Excel_ImportWizard_Title']},
60 {tag:'div', cls:'importSteps', id:this.getId('importSteps')},
61 {tag:'div', cls:'importStepBlocks', children:[
62 {tag:'div', cls:'step_0', id:this.getId('step_0'), children:[
63 {tag:'div', children:[
64 {tag:'div', cls:'importOptionsDescription', htmlString:Clipperz.PM.Strings['importOptions_excel_description']},
65 {tag:'div', cls:'importOptionsParameters', children:[]},
66 this.textAreaConfig()
67 ]}
68 ]},
69 {tag:'div', cls:'step_1', id:this.getId('step_1'), children:[]},
70 {tag:'div', cls:'step_2', id:this.getId('step_2'), children:[]},
71 {tag:'div', cls:'step_3', id:this.getId('step_3'), children:[]},
72 {tag:'div', cls:'step_4', id:this.getId('step_4'), children:[]},
73 {tag:'div', cls:'step_5', id:this.getId('step_5'), children:[]},
74 {tag:'div', cls:'step_6', id:this.getId('step_6'), children:[
75 {tag:'div', children:[
76 {tag:'div', id:this.getId('previewDiv'), html:"preview"}
77 ]}
78 ]},
79 {tag:'div', cls:'step_7', id:this.getId('step_7'), children:[
80 {tag:'div', children:[
81 {tag:'h4', html:"done"}
82 ]}
83 ]}
84 ]},
85 {tag:'div', cls:'importOptionsButtons', children:[
86 {tag:'table', children:[
87 {tag:'tbody', children:[
88 {tag:'tr', children:[
89 {tag:'td', html:'&nbsp;'},
90 {tag:'td', children:[
91 {tag:'div', id:this.getId('backActionButton')}
92 ]},
93 {tag:'td', html:'&nbsp;'},
94 {tag:'td', children:[
95 {tag:'div', id:this.getId('nextActionButton')}
96 ]},
97 {tag:'td', html:'&nbsp;'}
98 ]}
99 ]}
100 ]}
101 ]}
102 ]});
103
104 this.updateSteps();
105
106 this.setBackButton(new YAHOO.ext.Button(this.getDom('backActionButton'), {text:"back", handler:this.backAction, scope:this}));
107 this.setNextButton(new YAHOO.ext.Button(this.getDom('nextActionButton'), {text:"next", handler:this.nextAction, scope:this}));
108
109 this.getElement('step_0').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show()
110 this.getElement('step_1').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
111 this.getElement('step_2').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
112 this.getElement('step_3').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
113 this.getElement('step_4').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
114 this.getElement('step_5').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
115 this.getElement('step_6').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
116 this.getElement('step_7').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
117//MochiKit.Logging.logDebug("<<< Import.ExcelImportComponent.render");
118 },
119
120 //-------------------------------------------------------------------------
121
122 'csvProcessor': function() {
123 return new Clipperz.CSVProcessor({
124 // quoteChar: this.getDom('CSV_inputOptions_quote').value,
125 // escapeChar: this.getDom('CSV_inputOptions_escape').value,
126 separatorChar:'\t',
127 binary:true
128 });
129 },
130
131 //-------------------------------------------------------------------------
132 __syntaxFix__: "syntax fix"
133});
134
diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/GenericImportComponent.js b/frontend/beta/js/Clipperz/PM/Components/Import/GenericImportComponent.js
new file mode 100644
index 0000000..4f6b1e4
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Import/GenericImportComponent.js
@@ -0,0 +1,523 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.Import.GenericImportComponent = function(anElement, args) {
37 args = args || {};
38
39 this._steps = this._steps || ['EDIT', 'PREVIEW', 'IMPORT'];
40
41 Clipperz.PM.Components.Import.GenericImportComponent.superclass.constructor.call(this, anElement, args);
42
43 this._user = args['user'];
44
45 this._currentStep = 0;
46 this._currentStatus = 'IDLE'; //'PROCESSING'
47
48 this._parsedValues = null;
49 this._processedValues = null;
50
51 this._backButton = null;
52 this._nextButton = null;
53
54 Clipperz.NotificationCenter.register(null, 'importProcessorProgressUpdate', this, 'updateProgressDialogStatus');
55
56 return this;
57}
58
59//=============================================================================
60
61YAHOO.extendX(Clipperz.PM.Components.Import.GenericImportComponent, Clipperz.PM.Components.BaseComponent, {
62
63 'toString': function() {
64 return "Clipperz.PM.Components.Import.GenericImportComponent component";
65 },
66
67 //-------------------------------------------------------------------------
68
69 'user': function() {
70 return this._user;
71 },
72
73 //-------------------------------------------------------------------------
74
75 'textAreaConfig': function() {
76 return {tag:'textarea', name:this.getId('importTextArea'), cls:'importTextArea', id:this.getId('importTextArea'), cols:60, rows:15, html:""};
77 },
78
79 'textAreaContent': function() {
80 return this.getDom('importTextArea').value
81 },
82
83 //-------------------------------------------------------------------------
84
85 'steps': function() {
86 return this._steps;
87 },
88
89 'currentStep': function() {
90 return this._currentStep;
91 },
92
93 'setCurrentStep': function(aValue) {
94 this._currentStep = aValue;
95 this.updateSteps();
96 },
97
98 //-------------------------------------------------------------------------
99
100 'currentStatus': function() {
101 return this._currentStatus;
102 },
103
104 'startProcessing': function() {
105 this._currentStatus = 'PROCESSING';
106 this.updateSteps();
107 },
108
109 'processingDone': function() {
110 this._currentStatus = 'IDLE';
111 this.setCurrentStep(this.currentStep() + 1);
112 },
113
114 'processingAborted': function() {
115 this._currentStatus = 'IDLE';
116 this.updateSteps();
117 },
118
119 //-------------------------------------------------------------------------
120
121 'stepsConfig': function() {
122 var result;
123 var i,c;
124
125 result = [];
126 c = this.steps().length;
127 for (i=0; i<c; i++) {
128 var cls;
129
130 if (this.currentStep() == i) {
131 if (this.currentStatus() == 'IDLE') {
132 cls = 'current';
133 } else {
134 cls = 'currentProcessing';
135 }
136 } else {
137 cls = "";
138 }
139
140 result.push({tag:'td', cls:cls, children:[
141 {tag:'div', children:[{tag:'span', htmlString:Clipperz.PM.Strings['ImportWizard'][this.steps()[i]]}]}
142 ]})
143 if (i < (c-1)) {
144 if ((this.currentStep() == i) && (this.currentStatus() == 'PROCESSING')) {
145 cls = 'stepSeparatorProcessing';
146 } else {
147 cls = 'stepSeparator';
148 }
149
150 result.push({tag:'td', cls:cls, children:[
151 {tag:'div', children:[{tag:'span', html:">"}]}
152 ]});
153 }
154 }
155
156 result = [{tag:'div', cls:'importWizardStepsBox', children:[
157 {tag:'div', cls:'importWizardStepsInnerBox', children:[
158 {tag:'table', cls:'importWizardSteps', children:[
159 {tag:'tbody', children:[
160 {tag:'tr', children:result}
161 ]}
162 ]}
163 ]},
164 {tag:'div', cls:'importWizardStepsBoxFooter'}
165 ]}];
166
167 return result;
168 },
169
170 'updateSteps': function() {
171 this.getElement('importSteps').update("");
172 Clipperz.YUI.DomHelper.append(this.getDom('importSteps'), {tag:'div', children:this.stepsConfig()});
173 },
174
175 //-------------------------------------------------------------------------
176
177 'backAction': function() {
178//MochiKit.Logging.logDebug(">>> backAction");
179 if (this.currentStep() == 0) {
180 Clipperz.NotificationCenter.notify(this, 'importCancelled');
181 } else {
182 this.getElement('step_' + this.currentStep()).hide();
183 this.setCurrentStep(this.currentStep() - 1);
184 this.getElement('step_' + this.currentStep()).show();
185
186 this.nextButton().enable();
187 }
188//MochiKit.Logging.logDebug("<<< backAction");
189 },
190
191 //-------------------------------------------------------------------------
192
193 'backButton': function() {
194 return this._backButton;
195 },
196
197 'setBackButton': function(aValue) {
198 this._backButton = aValue;
199 },
200
201 'nextButton': function() {
202 return this._nextButton;
203 },
204
205 'setNextButton': function(aValue) {
206 this._nextButton = aValue;
207 },
208
209 //-------------------------------------------------------------------------
210
211 'render': function() {
212//MochiKit.Logging.logDebug(">>> Import.GenericImportComponent.render");
213 this.domHelper().append(this.element(), {tag:'div', children:[
214 {tag:'h2', html:this.toString()}
215 ]});
216//MochiKit.Logging.logDebug("<<< Import.GenericImportComponent.render");
217 },
218
219 //-------------------------------------------------------------------------
220
221 'previewValues': function() {
222 Clipperz.PM.Components.MessageBox.showProgressPanel(
223 MochiKit.Base.method(this, 'deferredPreviewValues'),
224 MochiKit.Base.method(this, 'handlePreviewError'),
225 this.getDom('nextActionButton')
226 );
227 },
228
229 'deferredPreviewValues': function() {
230 throw Clipperz.Base.exception.AbstractMethod;
231 },
232
233 'handlePreviewError': function(anError) {
234console.log("anError", anError);
235 MochiKit.Logging.logError("An error occurred while previewing the data: " + anError);
236 alert("An error occurred while previewing the data");
237 Clipperz.PM.Components.MessageBox().hide();
238 },
239
240 //-------------------------------------------------------------------------
241
242 'previewRecordValues': function(someProcessedRecords) {
243//MochiKit.Logging.logDebug(">>> previewRecordValues");
244 this.getElement('previewDiv').update("");
245//MochiKit.Logging.logDebug("--- previewRecordValues - 1");
246 this.domHelper().append(this.getElement('previewDiv'), {tag:'div', cls:'importPreviewDiv', children:[{tag:'table', id:'importPreview', cellspacing:'0', children:[
247 {tag:'tbody', children:
248 MochiKit.Base.map(MochiKit.Base.bind(function(aRecord) {
249 var result;
250//MochiKit.Logging.logDebug("--- previewRecordValues - 1.1");
251//console.log("fields", aRecord.currentVersion().fields());
252 result = {tag:'tr', children:[{tag:'td', children:[
253 {tag:'table', cls:'importPreview_record', children:[
254 {tag:'tbody', children:[
255 {tag:'tr', children:[
256 {tag:'td', rowspan:'2', valign:'top', children:[
257 {tag:'input', type:'checkbox', id:this.getId(aRecord.reference()), value:"aRecord.reference()", checked:true}
258 ]},
259 {tag:'td', colspan:'2', children:[
260 {tag:'span', cls:'importPreview_title', html:aRecord.label()}
261 ]}
262 ]},
263 {tag:'tr', children:[
264 {tag:'td', valign:'top', children:[
265 {tag:'span', cls:'importPreview_notes', html:(MochiKit.Base.isNotEmpty(aRecord.notes()) ? aRecord.notes().replace(/\n/g, '<br>') : '&nbsp;')}
266 ]},
267 {tag:'td', valign:'top', cls:'importPreview_fieds', children:[
268 {tag:'table', cls:'importPreview_fields', children:[
269 {tag:'tbody', children:MochiKit.Base.map(function(aField) {
270 var result;
271//MochiKit.Logging.logDebug("--- previewRecordValues - 1.1.1");
272 result = {tag:'tr', children:[
273 {tag:'td', valign:'top', children:[
274 {tag:'span', cls:'importPreview_fields_label', html:aField.label()}
275 ]},
276 {tag:'td', valign:'top', children:[
277 {tag:'span', cls:'importPreview_fields_value', html:aField.value()}
278 ]}
279 ]};
280//MochiKit.Logging.logDebug("--- previewRecordValues - 1.1.2");
281 return result;
282 }, MochiKit.Base.values(aRecord.currentVersion().fields()))}
283 ]}
284 ]}
285 ]}
286 ]}
287 ]}
288 ]}]};
289//MochiKit.Logging.logDebug("--- previewRecordValues - 1.2");
290 return result;
291 }, this), someProcessedRecords)
292 }
293 ]}]});
294//MochiKit.Logging.logDebug("--- previewRecordValues - 2");
295
296 MochiKit.Base.map(MochiKit.Base.bind(function(aRecord) {
297 this.getElement(aRecord.reference()).dom.value = aRecord.reference();
298 }, this), someProcessedRecords);
299
300 Clipperz.Style.applyZebraStylesToTable('importPreview');
301//MochiKit.Logging.logDebug("<<< previewRecordValues");
302 },
303
304 //-------------------------------------------------------------------------
305
306 'updateProgressDialogStatus': function(anEvent) {
307 Clipperz.PM.Components.MessageBox().update({step:anEvent.parameters().progress});
308 },
309
310 //-------------------------------------------------------------------------
311
312 'parsedValues': function() {
313 return this._parsedValues;
314 },
315
316 'setParsedValues': function(aValue) {
317 this._parsedValues = aValue;
318
319 return this._parsedValues;
320 },
321
322 //-------------------------------------------------------------------------
323
324 'processedValues': function() {
325 return this._processedValues;
326 },
327
328 'setProcessedValues': function(aValue) {
329 this._processedValues = aValue;
330 return this._processedValues;
331 },
332
333 //-------------------------------------------------------------------------
334
335 'importValues': function() {
336 var deferredResult;
337
338 deferredResult = new MochiKit.Async.Deferred();
339
340 deferredResult.addCallback(MochiKit.Base.bind(function() {
341 this.nextButton().disable();
342 this.startProcessing();
343 },this));
344 deferredResult.addCallback(MochiKit.Base.method(this, 'importProcessedValues'));
345 deferredResult.addCallback(MochiKit.Base.method(this, 'processingDone'));
346 deferredResult.addErrback (MochiKit.Base.method(this, 'processingAborted'));
347 deferredResult.callback();
348
349 return deferredResult;
350 },
351
352 //-------------------------------------------------------------------------
353
354 'importProcessedValues': function() {
355 var deferredResult;
356 var processedValues;
357 var selectedRecords;
358 var i,c;
359
360//MochiKit.Logging.logDebug(">>> GenericImportComponent.importProcessedValues");
361 processedValues = this.processedValues();
362 selectedRecords = [];
363
364 c = processedValues.length;
365 for (i=0; i<c; i++) {
366 var currentRecord;
367
368 currentRecord = processedValues[i];
369 if (this.getDom(currentRecord.reference()).checked == true) {
370 selectedRecords.push(currentRecord);
371 }
372 }
373
374 deferredResult = new MochiKit.Async.Deferred();
375//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 1: " + res); return res;});
376 deferredResult.addCallback(function(someRecords) {
377 var innerDeferredResult;
378 var text;
379
380 text = Clipperz.PM.Strings['importData_importConfirmation_text'];
381 text = text.replace(/__numberOfRecords__/, someRecords.length);
382
383 innerDeferredResult = new MochiKit.Async.Deferred();
384//innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 1.1: " + res); return res;});
385 innerDeferredResult.addCallback(MochiKit.Async.succeed, someRecords);
386//innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 1.2: " + res); return res;});
387
388 Clipperz.PM.Components.MessageBox().deferredShow({
389 title:Clipperz.PM.Strings['importData_importConfirmation_title'],
390 text:text,
391 width:240,
392 showProgressBar:false,
393 showCloseButton:false,
394 buttons:{
395 'yes':"yes", //Clipperz.PM.Strings['mainPanelDeleteRecordPanelConfirmButtonLabel'],
396 'no':"no" //Clipperz.PM.Strings['mainPanelDeleteRecordPanelDenyButtonLabel']
397 },
398 fn:MochiKit.Base.partial(function(aDeferred, aResult) {
399 if (aResult == 'yes') {
400 aDeferred.callback(aResult);
401 } else {
402 aDeferred.errback(aResult);
403 }
404 }, innerDeferredResult)
405 }/*, this.getId('nextActionButton')*/);
406
407 return innerDeferredResult;
408 });
409
410//-------------------
411 // deferredResult.addCallback(MochiKit.Base.bind(function(someRecords) {
412 // Clipperz.PM.Components.MessageBox.showProgressPanel(
413 // MochiKit.Base.method(this, 'importProcessedValues_core', someRecords),
414 // MochiKit.Base.method(this, 'handleProcessError'),
415 // this.getDom('mainDiv')
416 // );
417 // }, this));
418
419//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 2: " + res); return res;});
420 deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'),
421 {
422 // title:Clipperz.PM.Strings['accountPanelDeletingAccountPanelProgressTitle'],
423 // text:Clipperz.PM.Strings['accountPanelDeletingAccountPanelProgressText'],
424 width:240,
425 showProgressBar:true,
426 showCloseButton:false
427 }
428 );
429//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 3: " + res); return res;});
430
431 deferredResult.addCallback(MochiKit.Base.bind(function(someRecords) {
432 var innerDeferredResult;
433
434//MochiKit.Logging.logDebug(">>> inner deferred");
435 innerDeferredResult = new MochiKit.Async.Deferred();
436
437//innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 3.1: " + res); return res;});
438 innerDeferredResult.addCallback(MochiKit.Base.method(this, 'importProcessedValues_core', someRecords));
439//innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 3.2: " + res); return res;});
440 innerDeferredResult.addErrback(MochiKit.Base.method(this, 'handleProcessError'));
441//innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 3.3: " + res); return res;});
442 innerDeferredResult.callback(someRecords);
443//MochiKit.Logging.logDebug("<<< inner deferred");
444
445 return innerDeferredResult;
446 }, this), selectedRecords);
447//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 4: " + res); return res;});
448
449 deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'hide'), 'mainDiv');
450
451 deferredResult.addErrback(MochiKit.Base.bind(function() {
452 this.nextButton().enable();
453 this.setCurrentStep(this.currentStep() -1);
454 }, this));
455//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 5: " + res); return res;});
456
457 deferredResult.callback(selectedRecords);
458//MochiKit.Logging.logDebug("<<< GenericImportComponent.importProcessedValues");
459
460 return deferredResult;
461 },
462
463 //-------------------------------------------------------------------------
464
465 'importProcessedValues_core': function(someRecords) {
466 var deferredResult;
467
468 deferredResult = new MochiKit.Async.Deferred();
469
470 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'processingImportData');
471 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', {steps:(someRecords.length + 6 + 1)});
472 deferredResult.addCallback(MochiKit.Async.wait, 0.5);
473//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("importProcessedValues_core - 3: " + res); return res;});
474 deferredResult.addCallback(MochiKit.Base.bind(function(someRecords) {
475 var i,c;
476
477 c = someRecords.length;
478 for (i=0; i<c; i++) {
479 this.user().addRecord(someRecords[i], true);
480 }
481
482 return someRecords;
483 }, this));
484 deferredResult.addCallback(MochiKit.Async.wait, 0.5);
485//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("importProcessedValues_core - 4: " + res); return res;});
486 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'recordAdded', null);
487//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("importProcessedValues_core - 5: " + res); return res;});
488 deferredResult.addCallback(MochiKit.Base.method(this.user(), 'saveRecords'));
489//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("importProcessedValues_core - 6: " + res); return res;});
490 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'selectTab', 'mainTabPanel.recordsTab');
491//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("importProcessedValues_core - 7: " + res); return res;});
492
493 if (this.user().preferences().shouldShowDonationPanel()) {
494 deferredResult.addCallback(Clipperz.PM.showDonationSplashScreen, this.user(), 'mainDiv');
495 }
496
497 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'importCompleted', null);
498
499 deferredResult.callback(someRecords);
500
501 return deferredResult;
502 },
503
504 //-------------------------------------------------------------------------
505
506 'handleParseError': function(res) {
507 this.processingAborted();
508 MochiKit.Logging.logError("An error occurred while parsing the values: " + res);
509 alert("An error occurred while parsing the values: " + res);
510 Clipperz.PM.Components.MessageBox().hide();
511 },
512
513 'handleProcessError': function(res) {
514 this.processingAborted();
515 MochiKit.Logging.logError("An error occurred while processing the values: " + res);
516 alert("An error occurred while processing the values: " + res);
517 Clipperz.PM.Components.MessageBox().hide();
518 },
519
520 //-------------------------------------------------------------------------
521 __syntaxFix__: "syntax fix"
522});
523
diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/KeePassImportComponent.js b/frontend/beta/js/Clipperz/PM/Components/Import/KeePassImportComponent.js
new file mode 100644
index 0000000..0657520
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Import/KeePassImportComponent.js
@@ -0,0 +1,450 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.Import.KeePassImportComponent = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.Import.KeePassImportComponent.superclass.constructor.call(this, anElement, args);
40
41 this._steps = ['EDIT', 'KEEPASS_SETTINGS', 'PREVIEW', 'IMPORT'];
42 this._definedFields = ['Group', 'Group Tree', 'UserName', 'URL', 'Password', 'Notes', 'UUID', 'Icon', 'Creation Time', 'Last Access', 'Last Modification', 'Expires', 'Attachment Description', 'Attachment'];
43
44 this.render();
45
46 return this;
47}
48
49//=============================================================================
50
51YAHOO.extendX(Clipperz.PM.Components.Import.KeePassImportComponent, Clipperz.PM.Components.Import.GenericImportComponent, {
52
53 'toString': function() {
54 return "Clipperz.PM.Components.Import.KeePassImportComponent component";
55 },
56
57 //-------------------------------------------------------------------------
58
59 'render': function() {
60//MochiKit.Logging.logDebug(">>> Import.KeePassImportComponent.render");
61 this.domHelper().append(this.element(), {tag:'div', cls:'keePassImportWizard', children:[
62 {tag:'h3', htmlString:Clipperz.PM.Strings['KeePass_ImportWizard_Title']},
63 {tag:'div', cls:'importSteps', id:this.getId('importSteps')},
64 {tag:'div', cls:'importStepBlocks', children:[
65 {tag:'div', cls:'step_0', id:this.getId('step_0'), children:[
66 {tag:'div', children:[
67 {tag:'div', cls:'importOptionsDescription', htmlString:Clipperz.PM.Strings['importOptions_keePass_description']},
68 {tag:'div', cls:'importOptionsParameters', children:[]},
69 this.textAreaConfig()
70 ]}
71 ]},
72 {tag:'div', cls:'step_1', id:this.getId('step_1'), children:[
73 {tag:'div', children:[
74 {tag:'div', id:this.getId('settingsDiv'), children:[
75 {tag:'table', id:'KeePassSettings', children:[
76 {tag:'tbody', children:[
77 {tag:'tr', children:[
78 {tag:'td', width:'50%', valign:'top', children:[
79 {tag:'table', children:[
80 {tag:'tbody', children:[
81 {tag:'tr', children:[
82 {tag:'td', valign:'top', children:[{tag:'input', type:'checkbox', id:this.getId('Group_checkbox'), name:'Group'/*, checked:true*/}]},
83 {tag:'td', width:'150', valign:'top', children:[{tag:'span', cls:'keePassFieldLabel', id:this.getId('Group_label'), html:"Group"}]}
84 ]},
85 {tag:'tr', children:[
86 {tag:'td', valign:'top', children:[{tag:'input', type:'checkbox', id:this.getId('Group Tree_checkbox'), name:'Group Tree'/*, checked:true*/}]},
87 {tag:'td', valign:'top', children:[{tag:'span', cls:'keePassFieldLabel', id:this.getId('Group Tree_label'), html:"Group Tree"}]}
88 ]},
89 {tag:'tr', children:[
90 {tag:'td', valign:'top', children:[{tag:'input', type:'checkbox', id:this.getId('UserName_checkbox'), name:'UserName', checked:true}]},
91 {tag:'td', valign:'top', children:[{tag:'span', cls:'keePassFieldLabel', id:this.getId('UserName_label'), html:"UserName"}]}
92 ]},
93 {tag:'tr', children:[
94 {tag:'td', valign:'top', children:[{tag:'input', type:'checkbox', id:this.getId('URL_checkbox'), name:'URL', checked:true}]},
95 {tag:'td', valign:'top', children:[{tag:'span', cls:'keePassFieldLabel', id:this.getId('URL_label'), html:"URL"}]}
96 ]},
97 {tag:'tr', children:[
98 {tag:'td', valign:'top', children:[{tag:'input', type:'checkbox', id:this.getId('Password_checkbox'), name:'Password', checked:true}]},
99 {tag:'td', valign:'top', children:[{tag:'span', cls:'keePassFieldLabel', id:this.getId('Password_label'), html:"Password"}]}
100 ]},
101 {tag:'tr', children:[
102 {tag:'td', valign:'top', children:[{tag:'input', type:'checkbox', id:this.getId('Notes_checkbox'), name:'Notes', checked:true}]},
103 {tag:'td', valign:'top', children:[{tag:'span', cls:'keePassFieldLabel', id:this.getId('Notes_label'), html:"Notes"}]}
104 ]},
105 {tag:'tr', children:[
106 {tag:'td', valign:'top', children:[{tag:'input', type:'checkbox', id:this.getId('UUID_checkbox'), name:'UUID'/*, checked:true*/}]},
107 {tag:'td', valign:'top', children:[{tag:'span', cls:'keePassFieldLabel', id:this.getId('UUID_label'), html:"UUID"}]}
108 ]}
109 ]}
110 ]}
111 ]},
112 {tag:'td', width:'50%', valign:'top', children:[
113 {tag:'table', children:[
114 {tag:'tbody', children:[
115 {tag:'tr', children:[
116 {tag:'td', valign:'top', children:[{tag:'input', type:'checkbox', id:this.getId('Icon_checkbox'), name:'Icon'/*, checked:true*/}]},
117 {tag:'td', width:'150', valign:'top', children:[{tag:'span', cls:'keePassFieldLabel', id:this.getId('Icon_label'), html:"Icon"}]}
118 ]},
119 {tag:'tr', children:[
120 {tag:'td', valign:'top', children:[{tag:'input', type:'checkbox', id:this.getId('Creation Time_checkbox'), name:'Creation Time'/*, checked:true*/}]},
121 {tag:'td', valign:'top', children:[{tag:'span', cls:'keePassFieldLabel', id:this.getId('Creation Time_label'), html:"Creation Time"}]}
122 ]},
123 {tag:'tr', children:[
124 {tag:'td', valign:'top', children:[{tag:'input', type:'checkbox', id:this.getId('Last Access_checkbox'), name:'Last Access'/*, checked:true*/}]},
125 {tag:'td', valign:'top', children:[{tag:'span', cls:'keePassFieldLabel', id:this.getId('Last Access_label'), html:"Last Access"}]}
126 ]},
127 {tag:'tr', children:[
128 {tag:'td', valign:'top', children:[{tag:'input', type:'checkbox', id:this.getId('Last Modification_checkbox'), name:'Last Modification'/*, checked:true*/}]},
129 {tag:'td', valign:'top', children:[{tag:'span', cls:'keePassFieldLabel', id:this.getId('Last Modification_label'), html:"Last Modification"}]}
130 ]},
131 {tag:'tr', children:[
132 {tag:'td', valign:'top', children:[{tag:'input', type:'checkbox', id:this.getId('Expires_checkbox'), name:'Expires'/*, checked:true*/}]},
133 {tag:'td', valign:'top', children:[{tag:'span', cls:'keePassFieldLabel', id:this.getId('Expires_label'), html:"Expires"}]}
134 ]},
135 {tag:'tr', children:[
136 {tag:'td', valign:'top', children:[{tag:'input', type:'checkbox', id:this.getId('Attachment Description_checkbox'), name:'Attachment Description', checked:true}]},
137 {tag:'td', valign:'top', children:[{tag:'span', cls:'keePassFieldLabel', id:this.getId('Attachment Description_label'), html:"Attachment Description"}]}
138 ]},
139 {tag:'tr', children:[
140 {tag:'td', valign:'top', children:[{tag:'input', type:'checkbox', id:this.getId('Attachment_checkbox'), name:'Attachment', checked:true}]},
141 {tag:'td', valign:'top', children:[{tag:'span', cls:'keePassFieldLabel', id:this.getId('Attachment_label'), html:"Attachment"}]}
142 ]}
143 ]}
144 ]}
145 ]}
146 ]}
147 ]}
148 ]}
149 ]}
150 ]}
151 ]},
152 {tag:'div', cls:'step_2', id:this.getId('step_2'), children:[
153 {tag:'div', children:[
154 {tag:'div', id:this.getId('previewDiv'), html:"preview"}
155 ]}
156 ]},
157 {tag:'div', cls:'step_3', id:this.getId('step_3'), children:[
158 {tag:'div', children:[
159 {tag:'h4', html:"done"}
160 ]}
161 ]}
162 ]},
163 {tag:'div', cls:'importOptionsButtons', children:[
164 {tag:'table', children:[
165 {tag:'tbody', children:[
166 {tag:'tr', children:[
167 {tag:'td', html:'&nbsp;'},
168 {tag:'td', children:[
169 {tag:'div', id:this.getId('backActionButton')}
170 ]},
171 {tag:'td', html:'&nbsp;'},
172 {tag:'td', children:[
173 {tag:'div', id:this.getId('nextActionButton')}
174 ]},
175 {tag:'td', html:'&nbsp;'}
176 ]}
177 ]}
178 ]}
179 ]}
180 ]});
181
182 this.updateSteps();
183
184 this.setBackButton(new YAHOO.ext.Button(this.getDom('backActionButton'), {text:"back", handler:this.backAction, scope:this}));
185 this.setNextButton(new YAHOO.ext.Button(this.getDom('nextActionButton'), {text:"next", handler:this.nextAction, scope:this}));
186
187 this.getElement('step_0').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show()
188 this.getElement('step_1').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
189 this.getElement('step_2').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
190 this.getElement('step_3').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
191//MochiKit.Logging.logDebug("<<< Import.KeePassImportComponent.render");
192 },
193
194 //-------------------------------------------------------------------------
195
196 'nextAction': function() {
197 switch (this.currentStep()) {
198 case 0: //-> 1
199 Clipperz.PM.Components.MessageBox.showProgressPanel(
200 MochiKit.Base.method(this, 'deferredParseValues'),
201 MochiKit.Base.method(this, 'handleParseError'),
202 this.getDom('nextActionButton')
203 );
204 break;
205 case 1: //-> 2
206 this.previewValues();
207 break;
208 case 2: //-> 3
209 this.importValues();
210 break;
211 }
212 },
213
214 //-------------------------------------------------------------------------
215
216 'deferredParseValues': function() {
217 var deferredResult;
218
219 deferredResult = new MochiKit.Async.Deferred();
220//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredParseValues - 1 " + res.substring(0,50)); return res;});
221 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'parseImportData');
222//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredParseValues - 2 " + res.substring(0,50)); return res;});
223 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
224 this.startProcessing();
225
226 return res;
227 }, this));
228//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredParseValues - 3 " + res.substring(0,50)); return res;});
229 deferredResult.addCallback(MochiKit.Base.method(this, 'parseKeePassValues')); //processPasswordPlusValues
230//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredParseValues - 4 " + res); return res;});
231 deferredResult.addCallback(MochiKit.Base.method(this, 'setParsedValues')); //setProcessedValues
232//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredParseValues - 5 " + res); return res;});
233 deferredResult.addCallback(MochiKit.Base.method(this, 'showSettings')); //previewRecordValues
234//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredParseValues - 6 " + res); return res;});
235 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
236 this.processingDone();
237 this.getElement('step_0').hide();
238 this.getElement('step_1').show();
239 this.backButton().enable();
240
241 return res;
242 }, this));
243//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredParseValues - 7 " + res); return res;});
244 deferredResult.callback(this.textAreaContent());
245
246 return deferredResult;
247 },
248
249 //-------------------------------------------------------------------------
250
251 'deferredPreviewValues': function() {
252 var deferredResult;
253
254//MochiKit.Logging.logDebug(">>> KeePassImportComonent.deferredPreviewValues");
255 deferredResult = new MochiKit.Async.Deferred();
256//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredPreviewValues - 1 " + res); return res;});
257 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'previewImportData');
258//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredPreviewValues - 2 " + res); return res;});
259 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
260 this.startProcessing();
261
262 return res;
263 }, this));
264//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredPreviewValues - 3 " + res); return res;});
265 deferredResult.addCallback(MochiKit.Base.method(this, 'processKeePassParsedValues'));
266//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredPreviewValues - 4 " + res); return res;});
267 deferredResult.addCallback(MochiKit.Base.method(this, 'setProcessedValues'));
268//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredPreviewValues - 5 " + res); return res;});
269 deferredResult.addCallback(MochiKit.Base.method(this, 'previewRecordValues'));
270//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredPreviewValues - 6 " + res); return res;});
271 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
272 this.processingDone();
273 this.getElement('step_1').hide();
274 this.getElement('step_2').show();
275 this.backButton().enable();
276
277 return res;
278 }, this));
279//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredPreviewValues - 7 " + res); return res;});
280 // deferredResult.addErrback(MochiKit.Base.bind(function() {
281 // this.processingAborted();
282 // }, this))
283//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.deferredPreviewValues - 8 " + res); return res;});
284 deferredResult.callback(this.parsedValues());
285//MochiKit.Logging.logDebug("<<< KeePassImportComonent.deferredPreviewValues");
286
287 return deferredResult;
288 },
289
290 //-------------------------------------------------------------------------
291
292 'definedFields': function() {
293 return this._definedFields;
294 },
295
296 //-------------------------------------------------------------------------
297
298 'parseKeePassValues': function(someData) {
299 var deferredResult;
300 var keePassProcessor;
301
302 keePassProcessor = new Clipperz.KeePassExportProcessor();
303
304 deferredResult = new MochiKit.Async.Deferred();
305//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.parseKeePassValues - 1 " + res.substring(0,50)); return res;});
306 deferredResult.addCallback(function(res) {
307 return Clipperz.NotificationCenter.deferredNotification(this, 'updatedProgressState', {steps:(res.length)}, res);
308 })
309//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.parseKeePassValues - 2 " + res.substring(0,50)); return res;});
310 deferredResult.addCallback(MochiKit.Base.method(keePassProcessor, 'deferredParse'));
311//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassImportComponent.parseKeePassValues - 3 " + res); return res;});
312 deferredResult.callback(someData);
313
314 return deferredResult;
315 },
316
317 //-------------------------------------------------------------------------
318
319 'showSettings': function(someValues) {
320 var availableFields;
321 var i,c;
322
323//MochiKit.Logging.logDebug(">>> KeePassImportCOmponent.showSettings");
324 availableFields = new Clipperz.Set();
325 c = this.parsedValues().length;
326 for (i=0; i<c; i++) {
327 var fieldLabel;
328
329 for (fieldLabel in this.parsedValues()[i]) {
330 availableFields.add(fieldLabel);
331 }
332 }
333
334 c = this.definedFields().length;
335 for (i=0; i<c; i++) {
336 var definedField;
337
338 definedField = this.definedFields()[i];
339 if (availableFields.contains(definedField)) {
340//MochiKit.Logging.logDebug("enabling field " + definedField);
341 this.getDom(definedField + '_checkbox').disabled = false;
342 this.getElement(definedField + '_label').removeClass('disabled');
343 } else {
344//MochiKit.Logging.logDebug("disabling field " + definedField);
345 this.getDom(definedField + '_checkbox').disabled = true;
346 this.getDom(definedField + '_checkbox').checked = false; //????
347 this.getElement(definedField + '_label').addClass('disabled');
348 }
349 }
350//MochiKit.Logging.logDebug("<<< KeePassImportCOmponent.showSettings");
351
352 return MochiKit.Async.succeed(someValues);
353 },
354
355 //-------------------------------------------------------------------------
356
357 'shouldImportField': function(aFieldName) {
358 var fieldCheckbox;
359 var result;
360
361//MochiKit.Logging.logDebug(">>> shouldImportField: " + aFieldName);
362 // fieldCheckbox = this.getDom(aFieldName + '_checkbox');
363 fieldCheckbox = MochiKit.DOM.getElement(this.getId(aFieldName + '_checkbox'));
364 if (fieldCheckbox != null) {
365 result = fieldCheckbox.checked;
366 } else {
367 result = false;
368 }
369//MochiKit.Logging.logDebug("<<< shouldImportField: " + result);
370
371 return result;
372 },
373
374 //-------------------------------------------------------------------------
375
376 'processKeePassParsedValues': function(someValues) {
377 var deferredResult;
378 var records;
379 var i,c;
380
381//MochiKit.Logging.logDebug(">>> processKeePassParsedValues");
382 deferredResult = new MochiKit.Async.Deferred();
383 records = [];
384
385//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("processKeePassParsedValues - 1: " + res); return res;});
386 c = someValues.length;
387 deferredResult.addCallback(function(res) {
388 return Clipperz.NotificationCenter.deferredNotification(this, 'updatedProgressState', {steps:c}, res);
389 })
390 for(i=0; i<c; i++) {
391//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("[" + i + "] processKeePassParsedValues - 1.1: " + res); return res;});
392 deferredResult.addCallback(MochiKit.Async.wait, 0.2);
393//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("[" + i + "] processKeePassParsedValues - 1.2: " + res); return res;});
394 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', {});
395//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("[" + i + "] processKeePassParsedValues - 1.3: " + res); return res;});
396 deferredResult.addCallback(MochiKit.Base.bind(function(someRecords, someData) {
397 var record;
398 var recordVersion;
399 var ii;
400
401 record = new Clipperz.PM.DataModel.Record({user:this.user()});
402 record.setLabel(someData['Title']);
403 if (this.shouldImportField('Notes')) {
404 record.setNotes(someData['Notes']);
405 }
406 recordVersion = record.currentVersion()
407
408 for (ii in someData) {
409 if ((ii != 'Title') && (ii != 'Notes') && (typeof(someData[ii]) != "undefined") && (this.shouldImportField(ii))) {
410 var recordField;
411 var recordFieldType;
412
413 recordFieldType = 'TXT';
414 if (ii == 'Password') {
415 recordFieldType = 'PWD';
416 } else if (ii == 'URL') {
417 recordFieldType = 'URL';
418 } else if ((ii == 'Creation Time') || (ii == 'Last Access') || (ii == 'Last Modification') || (ii == 'Expires')) {
419 recordFieldType = 'Date';
420 }
421
422 recordField = new Clipperz.PM.DataModel.RecordField({
423 recordVersion:recordVersion,
424 label: ii,
425 value: someData[ii],
426 type: recordFieldType
427 });
428 recordVersion.addField(recordField);
429 }
430 }
431
432 someRecords.push(record);
433
434 return someRecords;
435 }, this), records, someValues[i]);
436//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("[" + i + "] processKeePassParsedValues - 1.4: " + res); return res;});
437 }
438//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("processKeePassParsedValues - 2: " + res); return res;});
439 deferredResult.addCallback(MochiKit.Async.succeed, records);
440//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("processKeePassParsedValues - 3: " + res); return res;});
441 deferredResult.callback();
442//MochiKit.Logging.logDebug("<<< processKeePassParsedValues");
443
444 return deferredResult;
445 },
446
447 //-------------------------------------------------------------------------
448 __syntaxFix__: "syntax fix"
449});
450
diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/MainComponent.js b/frontend/beta/js/Clipperz/PM/Components/Import/MainComponent.js
new file mode 100644
index 0000000..54813bc
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Import/MainComponent.js
@@ -0,0 +1,332 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.Import.MainComponent = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.Import.MainComponent.superclass.constructor.call(this, anElement, args);
40
41 this._user = args.user;
42 this._wizardComponent = null;
43
44 this._backButton = null;
45 this._nextButton = null;
46
47 this._selectedComponent = null;
48
49 this.render();
50
51 return this;
52}
53
54//=============================================================================
55
56YAHOO.extendX(Clipperz.PM.Components.Import.MainComponent, Clipperz.PM.Components.BaseComponent, {
57
58 'toString': function() {
59 return "Clipperz.PM.Components.Import.MainComponent component";
60 },
61
62 //-------------------------------------------------------------------------
63
64 'user': function() {
65 return this._user;
66 },
67
68 //-------------------------------------------------------------------------
69
70 'wizardComponent': function() {
71 return this._wizardComponent;
72 },
73
74 'setWizardComponent': function(aValue) {
75 if (this._wizardComponent != null) {
76 this._wizardComponent.remove();
77 }
78
79 if (aValue != null) {
80 this.getElement('importCover').hide();
81 this.getElement('importWizard').show();
82 }
83 this._wizardComponent = aValue;
84 },
85
86 'resetImportComponent': function() {
87//MochiKit.Logging.logDebug(">>> resetImportComponent");
88 this.setWizardComponent(null);
89 this.getElement('wizardComponent').update("");
90
91 this.getElement('importCover').show();
92 this.getElement('importWizard').hide();
93//MochiKit.Logging.logDebug("<<< resetImportComponent");
94 },
95
96 //-------------------------------------------------------------------------
97
98 'backButton': function() {
99 return this._backButton;
100 },
101
102 'setBackButton': function(aValue) {
103 this._backButton = aValue;
104 },
105
106 'nextButton': function() {
107 return this._nextButton;
108 },
109
110 'setNextButton': function(aValue) {
111 this._nextButton = aValue;
112 },
113
114 //-------------------------------------------------------------------------
115
116 'render': function() {
117//MochiKit.Logging.logDebug(">>> Import.MainComponent.render");
118 Clipperz.NotificationCenter.unregister(this);
119 MochiKit.Signal.disconnectAllTo(this);
120
121 this.element().update("");
122 this.domHelper().append(this.element(), {tag:'div', id:this.getId('mainDiv'), children:[
123 {tag:'div', id:this.getId('importCover'), children:[
124 {tag:'h5', htmlString:Clipperz.PM.Strings['importTabTitle']},
125 {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['importTabDescription']},
126 {tag:'div', cls:'importFormats', children:[
127 {tag:'ul', cls:'radioList', children:[
128 {tag:'li', children:[
129 {tag:'table', children:[{tag:'tbody', children:[{tag:'tr', children:[
130 {tag:'td', valign:'top', children:[
131 {tag:'input', id:this.getId('CSV_radio'), type:'radio', name:'importFormat', value:'CSV'}
132 ]},
133 {tag:'td', valign:'top', children:[
134 {tag:'h4', id:this.getId('CSV_title'), htmlString:Clipperz.PM.Strings['importFormats']['CSV']['label']},
135 {tag:'div', cls:'templateDescription', htmlString:Clipperz.PM.Strings['importFormats']['CSV']['description']}
136 ]}
137 ]}]}]}
138 ]},
139 {tag:'li', children:[
140 {tag:'table', children:[{tag:'tbody', children:[{tag:'tr', children:[
141 {tag:'td', valign:'top', children:[
142 {tag:'input', id:this.getId('Excel_radio'), type:'radio', name:'importFormat', value:'EXCEL'}
143 ]},
144 {tag:'td', valign:'top', children:[
145 {tag:'h4', id:this.getId('Excel_title'), htmlString:Clipperz.PM.Strings['importFormats']['Excel']['label']},
146 {tag:'div', cls:'templateDescription', htmlString:Clipperz.PM.Strings['importFormats']['Excel']['description']}
147 ]}
148 ]}]}]}
149 ]},
150 {tag:'li', children:[
151 {tag:'table', children:[{tag:'tbody', children:[{tag:'tr', children:[
152 {tag:'td', valign:'top', children:[
153 {tag:'input', id:this.getId('KeePass_radio'), type:'radio', name:'importFormat', value:'KEEPASS'}
154 ]},
155 {tag:'td', valign:'top', children:[
156 {tag:'h4', id:this.getId('KeePass_title'), htmlString:Clipperz.PM.Strings['importFormats']['KeePass']['label']},
157 {tag:'div', cls:'templateDescription', htmlString:Clipperz.PM.Strings['importFormats']['KeePass']['description']}
158 ]}
159 ]}]}]}
160 ]},
161 {tag:'li', children:[
162 {tag:'table', children:[{tag:'tbody', children:[{tag:'tr', children:[
163 {tag:'td', valign:'top', children:[
164 {tag:'input', id:this.getId('Roboform_radio'), type:'radio', name:'importFormat', value:'ROBOFORM'}
165 ]},
166 {tag:'td', valign:'top', children:[
167 {tag:'h4', id:this.getId('Roboform_title'), htmlString:Clipperz.PM.Strings['importFormats']['Roboform']['label']},
168 {tag:'div', cls:'templateDescription', htmlString:Clipperz.PM.Strings['importFormats']['Roboform']['description']}
169 ]}
170 ]}]}]}
171 ]},
172 {tag:'li', children:[
173 {tag:'table', children:[{tag:'tbody', children:[{tag:'tr', children:[
174 {tag:'td', valign:'top', children:[
175 {tag:'input', id:this.getId('PasswordPlus_radio'), type:'radio', name:'importFormat', value:'PASSWORD_PLUS'}
176 ]},
177 {tag:'td', valign:'top', children:[
178 {tag:'h4', id:this.getId('PasswordPlus_title'), htmlString:Clipperz.PM.Strings['importFormats']['PasswordPlus']['label']},
179 {tag:'div', cls:'templateDescription', htmlString:Clipperz.PM.Strings['importFormats']['PasswordPlus']['description']}
180 ]}
181 ]}]}]}
182 ]},
183 {tag:'li', children:[
184 {tag:'table', children:[{tag:'tbody', children:[{tag:'tr', children:[
185 {tag:'td', valign:'top', children:[
186 {tag:'input', id:this.getId('ClipperzExport_radio'), type:'radio', name:'importFormat', value:'CLIPPERZ_EXPORT'}
187 ]},
188 {tag:'td', valign:'top', children:[
189 {tag:'h4', id:this.getId('ClipperzExport_title'), htmlString:Clipperz.PM.Strings['importFormats']['ClipperzExport']['label']},
190 {tag:'div', cls:'templateDescription', htmlString:Clipperz.PM.Strings['importFormats']['ClipperzExport']['description']}
191 ]}
192 ]}]}]}
193 ]}
194 ]},
195
196 {tag:'div', cls:'importOptionsButtons', children:[
197 {tag:'table', children:[
198 {tag:'tbody', children:[
199 {tag:'tr', children:[
200 {tag:'td', html:'&nbsp;'},
201 {tag:'td', children:[
202 {tag:'div', id:this.getId('backActionButton')}
203 ]},
204 {tag:'td', html:'&nbsp;'},
205 {tag:'td', children:[
206 {tag:'div', id:this.getId('nextActionButton')}
207 ]},
208 {tag:'td', html:'&nbsp;'}
209 ]}
210 ]}
211 ]}
212 ]}
213 ]}
214 ]},
215 {tag:'div', id:this.getId('importWizard'), children:[
216 {tag:'form', id:this.getId('importWizardForm'), children:[
217 {tag:'div', cls:'wizardComponent', id:this.getId('wizardComponent'), children:[]}
218 ]}
219 ]}
220 ]});
221
222 this.setBackButton(new YAHOO.ext.Button(this.getDom('backActionButton'), {text:"back", handler:this.backAction, scope:this}));
223 this.setNextButton(new YAHOO.ext.Button(this.getDom('nextActionButton'), {text:"next", handler:this.nextAction, scope:this}));
224
225 this.backButton().disable();
226 this.nextButton().disable();
227
228 this.getElement('importCover').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show();
229 this.getElement('importWizard').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
230
231 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) {
232 this.getElement('mainDiv').addClass('read-only');
233
234 this.getDom('ClipperzExport_radio').disabled = true;
235 this.getDom('CSV_radio').disabled = true;
236 this.getDom('Excel_radio').disabled = true;
237 this.getDom('PasswordPlus_radio').disabled = true;
238 this.getDom('Roboform_radio').disabled = true;
239 this.getDom('KeePass_radio').disabled = true;
240 } else {
241 MochiKit.Signal.connect(this.getId('ClipperzExport_radio'), 'onclick', MochiKit.Base.method(this, 'selectComponent'));
242 MochiKit.Signal.connect(this.getId('CSV_radio'), 'onclick', MochiKit.Base.method(this, 'selectComponent'));
243 MochiKit.Signal.connect(this.getId('Excel_radio'), 'onclick', MochiKit.Base.method(this, 'selectComponent'));
244 MochiKit.Signal.connect(this.getId('PasswordPlus_radio'), 'onclick', MochiKit.Base.method(this, 'selectComponent'));
245 MochiKit.Signal.connect(this.getId('Roboform_radio'), 'onclick', MochiKit.Base.method(this, 'selectComponent'));
246 MochiKit.Signal.connect(this.getId('KeePass_radio'), 'onclick', MochiKit.Base.method(this, 'selectComponent'));
247
248 if (Clipperz_IEisBroken != true) {
249 MochiKit.Signal.connect(this.getId('ClipperzExport_title'), 'onclick', this.getDom('ClipperzExport_radio'), 'click');
250 MochiKit.Signal.connect(this.getId('CSV_title'), 'onclick', this.getDom('CSV_radio'), 'click');
251 MochiKit.Signal.connect(this.getId('Excel_title'), 'onclick', this.getDom('Excel_radio'), 'click');
252 MochiKit.Signal.connect(this.getId('PasswordPlus_title'), 'onclick', this.getDom('PasswordPlus_radio'), 'click');
253 MochiKit.Signal.connect(this.getId('Roboform_title'), 'onclick', this.getDom('Roboform_radio'), 'click');
254 MochiKit.Signal.connect(this.getId('KeePass_title'), 'onclick', this.getDom('KeePass_radio'), 'click');
255 }
256
257 Clipperz.NotificationCenter.register(null, 'importCompleted', this, 'resetImportComponent');
258 Clipperz.NotificationCenter.register(null, 'importCancelled', this, 'resetImportComponent');
259 }
260
261//MochiKit.Logging.logDebug("<<< Import.MainComponent.render");
262 },
263
264 //-------------------------------------------------------------------------
265/*
266 'selectedFormat': function() {
267 return this.getDom('importSelectionOptions').value;
268 },
269*/
270 //-------------------------------------------------------------------------
271
272 'updateSelectedImportWizardComponent': function(aComponent) {
273 var newWizardComponent;
274
275//MochiKit.Logging.logDebug(">>> Import.MainComponent.updateSelectedImportWizardComponent");
276 this.getElement('wizardComponent').update("");
277
278 switch(aComponent) {
279 case 'CLIPPERZ_EXPORT':
280 newWizardComponent = new Clipperz.PM.Components.Import.ClipperzImportComponent(this.getElement('wizardComponent'), {user:this.user()});
281 break;
282 case 'CSV':
283 newWizardComponent = new Clipperz.PM.Components.Import.CSVImportComponent(this.getElement('wizardComponent'), {user:this.user()});
284 break;
285 case 'EXCEL':
286 newWizardComponent = new Clipperz.PM.Components.Import.ExcelImportComponent(this.getElement('wizardComponent'), {user:this.user()});
287 break;
288 case 'PASSWORD_PLUS':
289 newWizardComponent = new Clipperz.PM.Components.Import.PasswordPlusImportComponent(this.getElement('wizardComponent'), {user:this.user()});
290 break;
291 case 'ROBOFORM':
292 newWizardComponent = new Clipperz.PM.Components.Import.RoboFormImportComponent(this.getElement('wizardComponent'), {user:this.user()});;
293 break;
294 case 'KEEPASS':
295 newWizardComponent = new Clipperz.PM.Components.Import.KeePassImportComponent(this.getElement('wizardComponent'), {user:this.user()});
296 break;
297 }
298
299 this.setWizardComponent(newWizardComponent);
300//MochiKit.Logging.logDebug("<<< Import.MainComponent.updateSelectedWizardComponent");
301 },
302
303 //-------------------------------------------------------------------------
304
305 'selectComponent': function(anEvent) {
306 this.setSelectedComponent(anEvent.src().value);
307 this.nextButton().enable();
308 },
309
310 'selectedComponent': function() {
311 return this._selectedComponent;
312 },
313
314 'setSelectedComponent': function(aValue) {
315 this._selectedComponent = aValue;
316 },
317
318 //-------------------------------------------------------------------------
319
320 'backAction': function() {
321 },
322
323 //-------------------------------------------------------------------------
324
325 'nextAction': function() {
326 this.updateSelectedImportWizardComponent(this.selectedComponent());
327 },
328
329 //-------------------------------------------------------------------------
330 __syntaxFix__: "syntax fix"
331});
332
diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/PasswordPlusImportComponent.js b/frontend/beta/js/Clipperz/PM/Components/Import/PasswordPlusImportComponent.js
new file mode 100644
index 0000000..f476ac2
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Import/PasswordPlusImportComponent.js
@@ -0,0 +1,315 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.Import.PasswordPlusImportComponent = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.Import.PasswordPlusImportComponent.superclass.constructor.call(this, anElement, args);
40
41 this.render();
42
43 return this;
44}
45
46//=============================================================================
47
48YAHOO.extendX(Clipperz.PM.Components.Import.PasswordPlusImportComponent, Clipperz.PM.Components.Import.GenericImportComponent, {
49
50 'toString': function() {
51 return "Clipperz.PM.Components.Import.PasswordPlusImportComponent component";
52 },
53
54 //-------------------------------------------------------------------------
55
56 'render': function() {
57//MochiKit.Logging.logDebug(">>> Import.PasswordPlusImportComponent.render");
58 this.domHelper().append(this.element(), {tag:'div', cls:'passwordPlusImportWizard', children:[
59 {tag:'h3', htmlString:Clipperz.PM.Strings['PasswordPlus_ImportWizard_Title']},
60 {tag:'div', cls:'importSteps', id:this.getId('importSteps')},
61 {tag:'div', cls:'importStepBlocks', children:[
62 {tag:'div', cls:'step_0', id:this.getId('step_0'), children:[
63 {tag:'div', children:[
64 {tag:'div', cls:'importOptionsDescription', htmlString:Clipperz.PM.Strings['importOptions_passwordPlus_description']},
65 {tag:'div', cls:'importOptionsParameters', children:[]},
66 this.textAreaConfig()
67 ]}
68 ]},
69 {tag:'div', cls:'step_1', id:this.getId('step_1'), children:[
70 {tag:'div', children:[
71 {tag:'div', id:this.getId('previewDiv'), html:"preview"}
72 ]}
73 ]},
74 {tag:'div', cls:'step_2', id:this.getId('step_2'), children:[
75 {tag:'div', children:[
76 {tag:'h4', html:"done"}
77 ]}
78 ]}
79 ]},
80 {tag:'div', cls:'importOptionsButtons', children:[
81 {tag:'table', children:[
82 {tag:'tbody', children:[
83 {tag:'tr', children:[
84 {tag:'td', html:'&nbsp;'},
85 {tag:'td', children:[
86 {tag:'div', id:this.getId('backActionButton')}
87 ]},
88 {tag:'td', html:'&nbsp;'},
89 {tag:'td', children:[
90 {tag:'div', id:this.getId('nextActionButton')}
91 ]},
92 {tag:'td', html:'&nbsp;'}
93 ]}
94 ]}
95 ]}
96 ]}
97 ]});
98
99 this.updateSteps();
100
101 this.setBackButton(new YAHOO.ext.Button(this.getDom('backActionButton'), {text:"back", handler:this.backAction, scope:this}));
102 this.setNextButton(new YAHOO.ext.Button(this.getDom('nextActionButton'), {text:"next", handler:this.nextAction, scope:this}));
103
104 this.getElement('step_0').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show()
105 this.getElement('step_1').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
106 this.getElement('step_2').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
107//MochiKit.Logging.logDebug("<<< Import.PasswordPlusImportComponent.render");
108 },
109
110 //-------------------------------------------------------------------------
111/*
112 'backAction': function() {
113 switch (this.currentStep()) {
114 case 1: //-> 0
115 this.backButton().disable();
116 this.getElement('step_1').hide();
117 this.setCurrentStep(0);
118 this.getElement('step_0').show();
119 break;
120 }
121 },
122*/
123 //-------------------------------------------------------------------------
124
125 'nextAction': function() {
126 switch (this.currentStep()) {
127 case 0: //-> 1
128 this.previewValues();
129 break;
130 case 1: //-> 2
131 this.importValues();
132 break;
133 }
134 },
135
136 //-------------------------------------------------------------------------
137
138 'deferredPreviewValues': function() {
139 var deferredResult;
140
141 // this.setFormValues(MochiKit.DOM.formContents(this.getDom('dataForm')));
142
143 deferredResult = new MochiKit.Async.Deferred();
144 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
145 this.startProcessing();
146
147 return res;
148 }, this));
149 deferredResult.addCallback(MochiKit.Base.method(this, 'processPasswordPlusValues'));
150 deferredResult.addCallback(MochiKit.Base.method(this, 'setProcessedValues'));
151 deferredResult.addCallback(MochiKit.Base.method(this, 'previewRecordValues'));
152 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
153 this.processingDone();
154 this.getElement('step_0').hide();
155 this.getElement('step_1').show();
156 this.backButton().enable();
157
158 return res;
159 }, this));
160 // deferredResult.addErrback(MochiKit.Base.bind(function() {
161 // this.processingAborted();
162 // }, this))
163 deferredResult.callback(this.textAreaContent());
164
165 return deferredResult;
166 },
167
168 //-------------------------------------------------------------------------
169
170 'processPasswordPlusValues': function(someData) {
171 var deferredResult;
172 var csvProcessor;
173
174 csvProcessor = new Clipperz.CSVProcessor({binary:true});
175
176 deferredResult = new MochiKit.Async.Deferred();
177 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'parseImportData');
178 deferredResult.addCallback(function(res) {
179 return Clipperz.NotificationCenter.deferredNotification(this, 'updatedProgressState', {steps:(res.length * 2)}, res);
180 })
181 deferredResult.addCallback(MochiKit.Base.method(csvProcessor, 'deferredParse'));
182 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'previewImportData');
183 deferredResult.addCallback(function(res) {
184 return Clipperz.NotificationCenter.deferredNotification(this, 'updatedProgressState', {steps:(res.length * 2), step:res.length}, res);
185 })
186 deferredResult.addCallback(MochiKit.Base.bind(function(someCSVValues) {
187 var innerDeferredResult;
188 var records;
189 var i,c;
190
191 innerDeferredResult = new MochiKit.Async.Deferred();
192 records = [];
193
194 c = someCSVValues.length;
195 i=0;
196 i++; //Dataviz Passwords Plus Export, Version,1, Minimum Version To Read,1
197 i++; //Is Template,Title,Category,Field 1 Label,Field 1 Value,Field 1 Hidden,Field 2 Label,Field 2 Value,Field 2 Hidden,Field 3 Label,Field 3 Value,Field 3 Hidden,Field 4 Label,Field 4 Value,Field 4 Hidden,Field 5 Label,Field 5 Value,Field 5 Hidden,Field 6 Label,Field 6 Value,Field 6 Hidden,Field 7 Label,Field 7 Value,Field 7 Hidden,Field 8 Label,Field 8 Value,Field 8 Hidden,Field 9 Label,Field 9 Value,Field 9 Hidden,Field 10 Label,Field 10 Value,Field 10 Hidden,Note
198
199 for( ; i<c; i++) {
200 innerDeferredResult.addCallback(MochiKit.Async.wait, 0.2);
201 innerDeferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', {});
202 innerDeferredResult.addCallback(MochiKit.Base.bind(function(someRecords, someData) {
203 if (someData[0] == '0') {
204 var record;
205 var recordVersion;
206 var ii, cc;
207
208 record = new Clipperz.PM.DataModel.Record({user:this.user()});
209 if (someData[1] != "") {
210 record.setLabel(someData[1]);
211 } else {
212 record.setLabel("imported record [" + (i+1) + "]");
213 }
214 record.setNotes(someData[33]);
215 recordVersion = record.currentVersion()
216
217 cc = 10;
218 for (ii=0; ii<cc; ii++) {
219 var currentFieldValueIndex;
220 var currentType;
221
222 currentFieldValueIndex = (ii * 3) + 4;
223
224 if (someData[currentFieldValueIndex] != "") {
225 var recordField;
226 var recordFieldType;
227
228 recordFieldType = 'TXT';
229 if (someData[currentFieldValueIndex + 1] == 1) {
230 recordFieldType = 'PWD';
231 } else if (/^http/.test(someData[currentFieldValueIndex])) {
232 recordFieldType = 'URL';
233 }
234
235 recordField = new Clipperz.PM.DataModel.RecordField({
236 recordVersion:recordVersion,
237 label: someData[currentFieldValueIndex - 1],
238 value: someData[currentFieldValueIndex],
239 type: recordFieldType
240 });
241 recordVersion.addField(recordField);
242 }
243 }
244
245 // this.user().addRecord(record, true);
246
247 someRecords.push(record);
248 }
249
250 return someRecords;
251 }, this), records, someCSVValues[i]);
252 }
253 innerDeferredResult.addCallback(MochiKit.Async.succeed, records);
254 innerDeferredResult.callback();
255
256 return innerDeferredResult;
257 }, this));
258 deferredResult.callback(someData);
259
260 return deferredResult;
261
262/*
263 0Is Template
264 1Title
265 2Category
266
267 3Field 1 Label
268 4Field 1 Value
269 5Field 1 Hidden
270
271 6Field 2 Label
272 7Field 2 Value
273 8Field 2 Hidden
274
275 9Field 3 Label
276 10Field 3 Value
277 11Field 3 Hidden
278
279 12Field 4 Label
280 13Field 4 Value
281 14Field 4 Hidden
282
283 15Field 5 Label
284 16Field 5 Value
285 17Field 5 Hidden
286
287 18Field 6 Label
288 19Field 6 Value
289 20Field 6 Hidden
290
291 21Field 7 Label
292 22Field 7 Value
293 23Field 7 Hidden
294
295 24Field 8 Label
296 25Field 8 Value
297 26Field 8 Hidden
298
299 27Field 9 Label
300 28Field 9 Value
301 29Field 9 Hidden
302
303 30Field 10 Label
304 31Field 10 Value
305 32Field 10 Hidden
306
307 33Note
308*/
309 },
310
311
312 //-------------------------------------------------------------------------
313 __syntaxFix__: "syntax fix"
314});
315
diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/RoboFormImportComponent.js b/frontend/beta/js/Clipperz/PM/Components/Import/RoboFormImportComponent.js
new file mode 100644
index 0000000..d35bdc6
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Import/RoboFormImportComponent.js
@@ -0,0 +1,392 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.Import.RoboFormImportComponent = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.Import.RoboFormImportComponent.superclass.constructor.call(this, anElement, args);
40
41 this.render();
42
43 return this;
44}
45
46//=============================================================================
47
48YAHOO.extendX(Clipperz.PM.Components.Import.RoboFormImportComponent, Clipperz.PM.Components.Import.GenericImportComponent, {
49
50 'toString': function() {
51 return "Clipperz.PM.Components.Import.RoboFormImportComponent component";
52 },
53
54 //-------------------------------------------------------------------------
55
56 'render': function() {
57//MochiKit.Logging.logDebug(">>> Import.RoboFormImportComponent.render");
58 this.domHelper().append(this.element(), {tag:'div', cls:'roboFormImportWizard', children:[
59 {tag:'h3', htmlString:Clipperz.PM.Strings['RoboForm_ImportWizard_Title']},
60 {tag:'div', cls:'importSteps', id:this.getId('importSteps')},
61 {tag:'div', cls:'importStepBlocks', children:[
62 {tag:'div', cls:'step_0', id:this.getId('step_0'), children:[
63 {tag:'div', children:[
64 {tag:'div', cls:'importOptionsDescription', htmlString:Clipperz.PM.Strings['importOptions_roboForm_description']},
65 {tag:'div', cls:'importOptionsParameters', children:[]},
66 this.textAreaConfig()
67 ]}
68 ]},
69 {tag:'div', cls:'step_1', id:this.getId('step_1'), children:[
70 {tag:'div', children:[
71 {tag:'div', id:this.getId('previewDiv'), html:"preview"}
72 ]}
73 ]},
74 {tag:'div', cls:'step_2', id:this.getId('step_2'), children:[
75 {tag:'div', children:[
76 {tag:'h4', html:"done"}
77 ]}
78 ]}
79 ]},
80 {tag:'div', cls:'importOptionsButtons', children:[
81 {tag:'table', children:[
82 {tag:'tbody', children:[
83 {tag:'tr', children:[
84 {tag:'td', html:'&nbsp;'},
85 {tag:'td', children:[
86 {tag:'div', id:this.getId('backActionButton')}
87 ]},
88 {tag:'td', html:'&nbsp;'},
89 {tag:'td', children:[
90 {tag:'div', id:this.getId('nextActionButton')}
91 ]},
92 {tag:'td', html:'&nbsp;'}
93 ]}
94 ]}
95 ]}
96 ]}
97 ]});
98
99 this.updateSteps();
100
101 this.setBackButton(new YAHOO.ext.Button(this.getDom('backActionButton'), {text:"back", handler:this.backAction, scope:this}));
102 this.setNextButton(new YAHOO.ext.Button(this.getDom('nextActionButton'), {text:"next", handler:this.nextAction, scope:this}));
103
104 this.getElement('step_0').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show()
105 this.getElement('step_1').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
106 this.getElement('step_2').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
107//MochiKit.Logging.logDebug("<<< Import.RoboFormImportComponent.render");
108 },
109
110 //-------------------------------------------------------------------------
111
112 'nextAction': function() {
113 switch (this.currentStep()) {
114 case 0: //-> 1
115 this.previewValues();
116 break;
117 case 1: //-> 2
118 this.importValues();
119 break;
120 }
121 },
122
123 //-------------------------------------------------------------------------
124
125 'deferredPreviewValues': function() {
126 var deferredResult;
127
128 // this.setFormValues(MochiKit.DOM.formContents(this.getDom('dataForm')));
129
130 deferredResult = new MochiKit.Async.Deferred();
131 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
132 this.startProcessing();
133
134 return res;
135 }, this));
136 deferredResult.addCallback(MochiKit.Base.method(this, 'processRoboFormValues'));
137 deferredResult.addCallback(MochiKit.Base.method(this, 'setProcessedValues'));
138 deferredResult.addCallback(MochiKit.Base.method(this, 'previewRecordValues'));
139 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
140 this.processingDone();
141 this.getElement('step_0').hide();
142 this.getElement('step_1').show();
143 this.backButton().enable();
144
145 return res;
146 }, this));
147 // deferredResult.addErrback(MochiKit.Base.bind(function() {
148 // this.processingAborted();
149 // }, this))
150 deferredResult.callback(this.textAreaContent());
151
152 return deferredResult;
153 },
154
155 //-------------------------------------------------------------------------
156
157 'processRoboFormValues': function(someData) {
158 var result;
159
160 if (someData.match(/^\<HTML\>\<HEAD\>\<TITLE\>RoboForm Passcards List /g)) {
161 result = this.processRoboFormPasscardsValues(someData);
162 } else if (someData.match(/\<HTML\>\<HEAD\>\<TITLE\>RoboForm Safenotes List /g)) {
163 result = this.processRoboFormSafenotesValues(someData);
164 }
165
166 return result;
167 },
168
169 //.........................................................................
170
171 'processRoboFormPasscardsValues': function(someData) {
172 var deferredResult;
173
174 deferredResult = new MochiKit.Async.Deferred();
175//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues - 1: "/* + res*/); return res;});
176 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'parseImportData');
177//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues - 2: "/* + res*/); return res;});
178 deferredResult.addCallback(function(someData) {
179 var result;
180 var data;
181
182 data = someData.replace(/\r?\n/g, "");
183 result = data.match(/\<TABLE width\=\"100\%\"\>.*?\<\/TABLE\>/g);
184
185 return result;
186 });
187//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues - 3: "/* + res*/); return res;});
188//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues - 3.1: " + res.length); return res;});
189 deferredResult.addCallback(function(res) {
190 return Clipperz.NotificationCenter.deferredNotification(this, 'updatedProgressState', {steps:(res.length)}, res);
191 })
192//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues - 4: "/* + res*/); return res;});
193 deferredResult.addCallback(MochiKit.Base.bind(function(someRecordValues) {
194 var innerDeferredResult;
195 var records;
196 var i,c;
197
198 innerDeferredResult = new MochiKit.Async.Deferred();
199 records = [];
200
201 c = someRecordValues.length;
202 for(i=0; i<c; i++) {
203//innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues __inner loop__ - 1: " + res); return res;});
204 innerDeferredResult.addCallback(MochiKit.Async.wait, 0.2);
205//innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues __inner loop__ - 2: " + res); return res;});
206 innerDeferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', {});
207//innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues __inner loop__ - 3: " + res); return res;});
208 innerDeferredResult.addCallback(MochiKit.Base.bind(function(someRecords, someData) {
209 var data;
210 var record;
211 var recordVersion;
212 var fields;
213 var ii, cc;
214 var hasNotes;
215
216 var caption;
217 var subcaption;
218
219//MochiKit.Logging.logDebug("data: " + someData);
220 data = someData.replace(/\<WBR\>/g, "");
221 hasNotes = false;
222
223 /\<TD class\=caption colSpan\=3\>(.*?)\<\/TD\>/.test(data); //<TD class=caption colSpan=3>110mb</TD>
224 caption = RegExp.$1;
225//MochiKit.Logging.logDebug("caption: " + caption);
226
227 /\<TD class\=subcaption colSpan\=3\>(.*?)\<\/TD\>/.test(data); //<TD class=subcaption colSpan=3>110<WBR>mb.com</TD>
228 subcaption = RegExp.$1;
229//MochiKit.Logging.logDebug("subcaption: " + subcaption);
230
231 record = new Clipperz.PM.DataModel.Record({user:this.user()});
232 recordVersion = record.currentVersion()
233
234 record.setLabel(caption);
235 // record.setNotes(subcaption);
236 if (subcaption != null) {
237 var recordField;
238
239 recordField = new Clipperz.PM.DataModel.RecordField({
240 recordVersion:recordVersion,
241 label: "url",
242 value: subcaption,
243 type: 'URL'
244 });
245 recordVersion.addField(recordField);
246 }
247
248 fields = data.match(/\<TR\>.*?\<\/TR\>/g) || [];
249 cc = fields.length;
250//MochiKit.Logging.logDebug("fields.length: " + cc);
251 for (ii=0; ii<cc; ii++) {
252 var recordField;
253 var fieldString;
254 var fieldName;
255 var fieldValue;
256
257//MochiKit.Logging.logDebug("fieldString: " + fields[ii]);
258 fieldString = fields[ii];
259//MochiKit.Logging.logDebug("fieldString (cleaned): " + fieldString);
260 /\<TD class\=field vAlign\=top align\=left width\=\"40\%\"\>(.*?)\<\/TD\>/.test(fieldString);
261 fieldName = RegExp.$1;
262
263 /\<TD class\=wordbreakfield vAlign\=top align\=left width\=\"55\%\"\>(.*?)\<\/TD\>/.test(fieldString);
264 fieldValue = RegExp.$1;
265
266 if (fieldName == "Note$") {
267 record.setNotes(fieldValue);
268 hasNotes = true;
269 } else {
270 var fieldType;
271
272 if (((ii == 1) && (hasNotes == false)) || ((ii == 2) && (hasNotes == true))) {
273 fieldType = 'PWD';
274 } else {
275 fieldType = 'TXT';
276 }
277
278 recordField = new Clipperz.PM.DataModel.RecordField({
279 recordVersion:recordVersion,
280 label: fieldName,
281 value: fieldValue,
282 type: fieldType
283 });
284 recordVersion.addField(recordField);
285 }
286 }
287
288 someRecords.push(record);
289
290 return someRecords;
291 }, this), records, someRecordValues[i]);
292 }
293//innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues __inner loop__ - 4: " + res); return res;});
294 innerDeferredResult.addCallback(MochiKit.Async.succeed, records);
295//innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues __inner loop__ - 5: " + res); return res;});
296 innerDeferredResult.callback();
297
298 return innerDeferredResult;
299 }, this));
300 deferredResult.callback(someData);
301
302 return deferredResult;
303 },
304
305
306 //.........................................................................
307
308 'processRoboFormSafenotesValues': function(someData) {
309 var deferredResult;
310
311 deferredResult = new MochiKit.Async.Deferred();
312//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues - 1: "/* + res*/); return res;});
313 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'parseImportData');
314//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues - 2: "/* + res*/); return res;});
315 deferredResult.addCallback(function(someData) {
316 var result;
317 var data;
318
319 data = someData.replace(/\r?\n/g, "");
320 result = data.match(/\<TABLE width\=\"100\%\"\>.*?\<\/TABLE\>/g);
321
322 return result;
323 });
324//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues - 3: "/* + res*/); return res;});
325//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues - 3.1: " + res.length); return res;});
326 deferredResult.addCallback(function(res) {
327 return Clipperz.NotificationCenter.deferredNotification(this, 'updatedProgressState', {steps:(res.length)}, res);
328 })
329//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues - 4: "/* + res*/); return res;});
330 deferredResult.addCallback(MochiKit.Base.bind(function(someRecordValues) {
331 var innerDeferredResult;
332 var records;
333 var i,c;
334
335 innerDeferredResult = new MochiKit.Async.Deferred();
336 records = [];
337
338 c = someRecordValues.length;
339 for(i=0; i<c; i++) {
340//innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues __inner loop__ - 1: " + res); return res;});
341 innerDeferredResult.addCallback(MochiKit.Async.wait, 0.2);
342//innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues __inner loop__ - 2: " + res); return res;});
343 innerDeferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', {});
344//innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues __inner loop__ - 3: " + res); return res;});
345 innerDeferredResult.addCallback(MochiKit.Base.bind(function(someRecords, someData) {
346 var data;
347 var record;
348 var recordVersion;
349
350 var caption;
351 var wordbreakfield;
352
353//MochiKit.Logging.logDebug("data: " + someData);
354 data = someData.replace(/\<WBR\>/g, "");
355 hasNotes = false;
356
357 /\<TD class\=caption colSpan\=3\>(.*?)\<\/TD\>/.test(data); //<TD class=caption colSpan=3>110mb</TD>
358 caption = RegExp.$1;
359//MochiKit.Logging.logDebug("caption: " + caption);
360
361 /\<TD class\=wordbreakfield vAlign=top align\=left width\=\"\1\0\0\%\"\>(.*?)\<\/TD\>/.test(data); //<TD class=wordbreakfield vAlign=top align=left width="100%">7759500</TD>
362 wordbreakfield = RegExp.$1;
363//MochiKit.Logging.logDebug("subcaption: " + subcaption);
364
365 record = new Clipperz.PM.DataModel.Record({user:this.user()});
366 recordVersion = record.currentVersion()
367
368 record.setLabel(caption);
369 record.setNotes(wordbreakfield);
370
371 someRecords.push(record);
372
373 return someRecords;
374 }, this), records, someRecordValues[i]);
375 }
376//innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues __inner loop__ - 4: " + res); return res;});
377 innerDeferredResult.addCallback(MochiKit.Async.succeed, records);
378//innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RoboFormImportComponent.processRoboFormValues __inner loop__ - 5: " + res); return res;});
379 innerDeferredResult.callback();
380
381 return innerDeferredResult;
382 }, this));
383 deferredResult.callback(someData);
384
385 return deferredResult;
386 },
387
388
389 //-------------------------------------------------------------------------
390 __syntaxFix__: "syntax fix"
391});
392
diff --git a/frontend/beta/js/Clipperz/PM/Components/MessageBox.js b/frontend/beta/js/Clipperz/PM/Components/MessageBox.js
new file mode 100644
index 0000000..d2bc09a
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/MessageBox.js
@@ -0,0 +1,224 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32
33
34
35Clipperz.PM.Components.MessageBoxImplementation = function() {
36 this._step = 0;
37 this._steps = 0;
38
39 return this;
40};
41
42//YAHOO.extendX(Clipperz.PM.Components.MessageBoxImplementation, Clipperz.PM.Components.BaseComponent, {
43Clipperz.PM.Components.MessageBoxImplementation.prototype = MochiKit.Base.update(null, {
44
45 'toString': function() {
46 return "Clipperz.PM.Components.MessageBox";
47 },
48
49 //-----------------------------------------------------
50
51 'step': function() {
52 return this._step;
53 },
54
55 'setStep': function(aValue) {
56 if (aValue == 'next') {
57 this._step = this._step + 1;
58 } else {
59 this._step = aValue;
60 }
61
62 if (this._step > this.steps()) {
63//MochiKit.Logging.logDebug("overstepping: " + this._step + " (" + this.steps() + ")");
64 this._step = this.steps();
65 }
66 },
67
68 //-----------------------------------------------------
69
70 'steps': function() {
71 return this._steps;
72 },
73
74 'setSteps': function(aValue) {
75 if (aValue.constructor == String) {
76 if (aValue.charAt(0) == '+') {
77 this._steps += aValue.substring(1)*1;
78 } else if (aValue.charAt(0) == '-') {
79 this._steps -= aValue.substring(1)*1;
80 } else {
81 this._steps = aValue.substring(1)*1;
82 }
83 } else {
84 this._steps = aValue;
85 }
86 },
87
88 //-----------------------------------------------------
89
90 'deferredShow': function(aConfiguration, anAnimationTargetElement, aValue) {
91 this.show(aConfiguration, anAnimationTargetElement);
92
93 return aValue;
94 },
95
96 'show': function(aConfiguration, anAnimationTargetElement) {
97 varmessageBoxConfiguration;
98
99 messageBoxConfiguration = MochiKit.Base.clone(aConfiguration);
100 messageBoxConfiguration.msg = messageBoxConfiguration.text;
101 messageBoxConfiguration.animEl = anAnimationTargetElement;
102 messageBoxConfiguration.progress = messageBoxConfiguration.showProgressBar;
103 messageBoxConfiguration.closable = messageBoxConfiguration.showCloseButton;
104 this.setSteps(aConfiguration.steps || 0);
105 this.setStep(aConfiguration.step || 0);
106 delete messageBoxConfiguration.buttons;
107
108 Clipperz.YUI.MessageBox.show(messageBoxConfiguration);
109 },
110
111 //-----------------------------------------------------
112
113 'update': function(someValues) {
114//MochiKit.Logging.logDebug(">>> MessageBox.update");
115 if (someValues.title) {
116 Clipperz.YUI.MessageBox.getDialog().setTitle(someValues.title);
117 };
118
119 if (someValues.text) {
120 Clipperz.YUI.MessageBox.updateText(someValues.text);
121 };
122
123 if (typeof(someValues.showProgressBar) != 'undefined') {
124 Clipperz.YUI.MessageBox.progressElement().setDisplayed(someValues.showProgressBar);
125 Clipperz.YUI.MessageBox.updateProgress(0);
126 };
127
128 if (typeof(someValues.steps) != 'undefined') {
129 this.setSteps(someValues.steps);
130 };
131
132 if (typeof(someValues.step) != 'undefined') {
133 this.setStep(someValues.step);
134 } else {
135 this.setStep('next');
136 }
137 Clipperz.YUI.MessageBox.updateProgress(this.step() / this.steps());
138
139
140 if (typeof(someValues.fn) != 'undefined') {
141 Clipperz.YUI.MessageBox.opt().fn = someValues.fn;
142 };
143
144 if (typeof(someValues.scope) != 'undefined') {
145 Clipperz.YUI.MessageBox.opt().scope = someValues.scope;
146 };
147
148 if (someValues.buttons) {
149 Clipperz.YUI.MessageBox.updateButtons(someValues.buttons);
150 };
151
152 // if (someValues.title) {
153 // Clipperz.YUI.MessageBox.getDialog().setTitle(someValues.title + " [" + this.step() + " / " + this.steps() + "]");
154 // };
155
156//MochiKit.Logging.logDebug("--- MessageBox.update - step: " + this.step() + " / " + this.steps() + " - " + someValues.text);
157//MochiKit.Logging.logDebug("<<< MessageBox.update");
158 },
159
160 //-----------------------------------------------------
161
162 'hide': function(anAnimationTargetElement) {
163 if (anAnimationTargetElement) {
164 Clipperz.YUI.MessageBox.getDialog().animateTarget = anAnimationTargetElement;
165 }
166
167 Clipperz.YUI.MessageBox.hide();
168 },
169
170 //-----------------------------------------------------
171 __syntaxFix__: '__syntaxFix__'
172});
173
174
175//##########################################################
176
177_clipperz_pm_components_messageBox = null;
178
179Clipperz.PM.Components.MessageBox = function() {
180 if (_clipperz_pm_components_messageBox == null) {
181 _clipperz_pm_components_messageBox = new Clipperz.PM.Components.MessageBoxImplementation();
182 }
183
184 return _clipperz_pm_components_messageBox;
185}
186
187//---------------------------------------------------------
188
189Clipperz.PM.Components.MessageBox.showProgressPanel = function(aCallback, anErrback, anActivationItem) {
190 var deferredResult;
191
192 deferredResult = new MochiKit.Async.Deferred();
193//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.PM.Components.MessageBox.showProgressPanel - 0: " + res); return res;});
194 deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'),
195 {
196 title: "",
197 text: "",
198 width:240,
199 showProgressBar:true,
200 showCloseButton:false,
201 fn:MochiKit.Base.method(deferredResult, 'cancel'),
202 scope:this,
203 buttons:{
204 //'ok':Clipperz.PM.Strings['loginMessagePanelInitialButtonLabel']
205 }
206 },
207 anActivationItem
208 );
209//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.PM.Components.MessageBox.showProgressPanel - 1: " + res); return res;});
210 deferredResult.addCallback(aCallback);
211//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.PM.Components.MessageBox.showProgressPanel - 2: " + res); return res;});
212 deferredResult.addCallback(MochiKit.Async.wait, 0.5);
213 deferredResult.addCallback(function(res) {
214 Clipperz.PM.Components.MessageBox().hide(YAHOO.ext.Element.get(anActivationItem));
215 return res;
216 });
217//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.PM.Components.MessageBox.showProgressPanel - 3: " + res); return res;});
218 deferredResult.addErrback(anErrback);
219//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.PM.Components.MessageBox.showProgressPanel - 4: " + res); return res;});
220 deferredResult.callback();
221
222 return deferredResult;
223};
224
diff --git a/frontend/beta/js/Clipperz/PM/Components/OTP/MainComponent.js b/frontend/beta/js/Clipperz/PM/Components/OTP/MainComponent.js
new file mode 100644
index 0000000..9d191f6
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/OTP/MainComponent.js
@@ -0,0 +1,490 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.OTP) == 'undefined') { Clipperz.PM.Components.OTP = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.OTP.MainComponent = function(anElement, args) {
37 args = args || {};
38
39//MochiKit.Logging.logDebug("new OTP.MainComponent");
40 Clipperz.PM.Components.OTP.MainComponent.superclass.constructor.call(this, anElement, args);
41
42 this._user = args.user;
43 this._shouldRender = true;
44
45 this._deleteButton = null;
46 this._printButton = null;
47
48 Clipperz.NotificationCenter.register(null, 'tabSelected', this, 'tabSelectedHandler');
49 //Clipperz.NotificationCenter.register(null, 'oneTimePasswordAdded', this, 'render');
50
51 return this;
52}
53
54//=============================================================================
55
56YAHOO.extendX(Clipperz.PM.Components.OTP.MainComponent, Clipperz.PM.Components.BaseComponent, {
57
58 'toString': function() {
59 return "Clipperz.PM.Components.OTP.MainComponent component";
60 },
61
62 //-------------------------------------------------------------------------
63
64 'render': function() {
65//MochiKit.Logging.logDebug("### OTP.MainComponent.render");
66 Clipperz.NotificationCenter.unregister(this);
67 MochiKit.Signal.disconnectAllTo(this);
68
69 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) {
70 this.element().update("");
71 this.domHelper().append(this.element(), {tag:'div', cls:'oneTimePasswordReadOnlyMessage', htmlString:Clipperz.PM.Strings['oneTimePasswordReadOnlyMessage']});
72 } else {
73 var deferredResult;
74
75 deferredResult = new MochiKit.Async.Deferred();
76
77//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OTP.MainComponent.render - 1: " + res); return res;});
78 deferredResult.addCallback(MochiKit.Base.bind(function() {
79 this.element().update("");
80 Clipperz.YUI.DomHelper.append(this.element(), {tag:'div', htmlString:Clipperz.PM.Strings['oneTimePasswordLoadingMessage']});
81 }, this));
82//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OTP.MainComponent.render - 2: " + res); return res;});
83 deferredResult.addCallback(MochiKit.Base.method(this.user(), 'loadOneTimePasswords'));
84//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OTP.MainComponent.render - 3: " + res); return res;});
85//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OTP.MainComponent.render - 3.1: " + Clipperz.Base.serializeJSON(res.serializedData())); return res;});
86 deferredResult.addCallback(MochiKit.Base.bind(function(aResult) {
87 vartbodyElement;
88 varoneTimePasswordReferenceKeys;
89 var imageExtension;
90 var isThereAnyActiveOneTimePassword;
91
92 isThereAnyActiveOneTimePassword = false;
93
94 this.element().update("");
95 Clipperz.YUI.DomHelper.append(this.element(), {tag:'div', id:'oneTimePasswordList', children:[
96 {tag:'div', id:'oneTimePasswords_header', children:[
97 {tag:'table', width:'100%', children:[
98 {tag:'tbody', children:[
99 {tag:'tr', children:[
100 {tag:'td', width:'10%', children:[
101 {tag:'div', id:this.getId('createNewOneTimePasswordButton')}
102 ]},
103 {tag:'td', width:'40%', children:[
104 {tag:'div', id:this.getId('deleteSelectedOneTimePasswordButton')}
105 ]},
106 {tag:'td', width:'50%', align:'right', children:[
107 {tag:'div', id:this.getId('printOneTimePasswordButton')}
108 ]}
109 ]}
110 ]}
111 ]},
112 {tag:'div', children:[
113 {tag:'ul', children:[
114 {tag:'li', children:[
115 {tag:'span', htmlString:Clipperz.PM.Strings['oneTimePasswordSelectionLink_selectLabel']}
116 ]},
117 {tag:'li', children:[
118 {tag:'a', href:'#', id:this.getId('selectAllOneTimePasswords_link'), htmlString:Clipperz.PM.Strings['oneTimePasswordSelectionLink_all']}
119 ]},
120 {tag:'li', children:[
121 {tag:'a', href:'#', id:this.getId('selectNoneOneTimePasswords_link'), htmlString:Clipperz.PM.Strings['oneTimePasswordSelectionLink_none']}
122 ]},
123 {tag:'li', children:[
124 {tag:'a', href:'#', id:this.getId('selectUsedOneTimePasswords_link'), htmlString:Clipperz.PM.Strings['oneTimePasswordSelectionLink_used']}
125 ]},
126 {tag:'li', children:[
127 {tag:'a', href:'#', id:this.getId('selectUnusedOneTimePasswords_link'), htmlString:Clipperz.PM.Strings['oneTimePasswordSelectionLink_unused']}
128 ]}
129 ]}
130 ]}
131 ]},
132 {tag:'form', id:this.getId('oneTimePasswords_form'), children:[
133 {tag:'table', cls:'oneTimePassword', cellspacing:'0', cellpadding:'2', children:[
134 {tag:'tbody', id:this.getId('oneTimePasswords_tbody'), children:[
135 ]}
136 ]}
137 ]}
138 ]});
139
140 imageExtension = (Clipperz_IEisBroken == true) ? 'gif': 'png';
141
142 tbodyElement = this.getElement('oneTimePasswords_tbody');
143 oneTimePasswordReferenceKeys = MochiKit.Base.keys(this.user().oneTimePasswordManager().oneTimePasswords()).reverse();
144 c = oneTimePasswordReferenceKeys.length;
145 if (c>0) {
146 for (i=0; i<c; i++) {
147 var otpReference;
148 var currentOTP;
149 var loginSessionInfoConfig;
150
151 imageExtension = (Clipperz_IEisBroken == true) ? 'gif': 'png';
152
153 otpReference = oneTimePasswordReferenceKeys[i];
154 currentOTP = this.user().oneTimePasswordManager().oneTimePasswords()[otpReference];
155
156 switch (currentOTP.status()) {
157 case 'USED':
158 var loginSessionInfo;
159
160 loginSessionInfo = currentOTP.connectionInfo();
161 try {
162 var ip;
163
164 ip = (currentOTP.connectionInfo()['ip'].match(/^\d{1,3}(.\d{1,3}){3}$/)) ? currentOTP.connectionInfo()['ip'] : Clipperz.PM.Strings['unknown_ip'];
165
166 loginSessionInfoConfig = [
167 {tag:'div', cls:'oneTimePassword_usageDateDescription', children:[
168 {tag:'span', cls:'value', html:Clipperz.PM.Date.getElapsedTimeDescription(currentOTP.usageDate())}
169 ]},
170 {tag:'div', cls:'oneTimePassword_usageDetails', children:[
171 {tag:'img', cls:'flag', title:Clipperz.PM.Strings['countries'][ loginSessionInfo['country']], src:Clipperz.PM.Strings['icons_baseUrl'] + "/flags/" + loginSessionInfo['country'].toLowerCase() + "." + imageExtension, width:'32', height:'32'},
172 {tag:'img', cls:'browser', title:Clipperz.PM.Strings['browsers'][ loginSessionInfo['browser']], src:Clipperz.PM.Strings['icons_baseUrl'] + "/browsers/" + loginSessionInfo['browser'].toLowerCase() + "." + imageExtension, width:'32', height:'32'},
173 {tag:'img', cls:'operatingSystem', title:Clipperz.PM.Strings['operatingSystems'][loginSessionInfo['operatingSystem']], src:Clipperz.PM.Strings['icons_baseUrl'] + "/operatingSystems/" + loginSessionInfo['operatingSystem'].toLowerCase() + "." + imageExtension, width:'32', height:'32'}
174 ]},
175 {tag:'div', cls:'oneTimePassword_usageDate', html:Clipperz.PM.Date.formatDateWithTemplate(currentOTP.usageDate(), Clipperz.PM.Strings['fullDate_format'])},
176 {tag:'div', cls:'oneTimePassword_IP', children:[
177 {tag:'span', cls:'oneTimePassword_IPLabel', htmlString:Clipperz.PM.Strings['loginHistoryIPLabel']},
178 {tag:'span', cls:'oneTimePassword_IPValue', html:ip}
179 ]}
180 ];
181 } catch(exception) {
182 MochiKit.Logging.logWarning("an error occured while showing the One Time Password session details");
183 loginSessionInfoConfig = [];
184 }
185 break;
186 case 'DISABLED':
187 loginSessionInfoConfig = [
188 {tag:'span', cls:'disabledOneTimePassword', htmlString:Clipperz.PM.Strings['disabledOneTimePassword_warning']}
189 ];
190 break;
191 case 'ACTIVE':
192 default:
193 loginSessionInfoConfig = [];
194 break;
195 }
196
197
198 if (currentOTP.isExpired() == false) {
199 isThereAnyActiveOneTimePassword = true;
200 };
201
202
203 this.domHelper().append(tbodyElement, {tag:'tr', cls:(currentOTP.isExpired() ? 'oneTimePassword_used': 'oneTimePassword_new'), children:[
204 {tag:'td', valign:'top', children:[
205 {tag:'input', type:'checkbox', cls:'otpCheckbox', name:currentOTP.reference()}
206 ]},
207 {tag:'td', valign:'top', children:[
208 {tag:'span', cls:'oneTimePassword_value', html:currentOTP.password()}
209 ]},
210 {tag:'td', valign:'top', children:[
211 {tag:'div', cls:'oneTimePassword_usageStats', children:loginSessionInfoConfig}
212 ]}
213 ]});
214 }
215 } else {
216 this.domHelper().append(tbodyElement, {tag:'tr', children:[
217 {tag:'td', children:[
218 {tag:'div', cls:'oneTimePassword_noPasswordPresent', htmlString:Clipperz.PM.Strings['oneTimePasswordNoPasswordAvailable']}
219 ]}
220 ]});
221 }
222
223 new YAHOO.ext.Button(this.getDom('createNewOneTimePasswordButton'), {text:Clipperz.PM.Strings['createNewOTPButtonLabel'], handler:this.createNewOneTimePassword, scope:this});
224 this.setDeleteButton(new YAHOO.ext.Button(this.getDom('deleteSelectedOneTimePasswordButton'), {text:Clipperz.PM.Strings['deleteOTPButtonLabel'], handler:this.deleteSelectedOneTimePasswords, scope:this}));
225 this.setPrintButton(new YAHOO.ext.Button(this.getDom('printOneTimePasswordButton'), {text:Clipperz.PM.Strings['printOTPButtonLabel'], handler:this.printOneTimePasswords, scope:this}));
226
227 MochiKit.Signal.connect(this.getId('selectAllOneTimePasswords_link'),'onclick', this, 'selectAllOneTimePasswords');
228 MochiKit.Signal.connect(this.getId('selectNoneOneTimePasswords_link'),'onclick', this, 'selectNoneOneTimePasswords');
229 MochiKit.Signal.connect(this.getId('selectUsedOneTimePasswords_link'),'onclick', this, 'selectUsedOneTimePasswords');
230 MochiKit.Signal.connect(this.getId('selectUnusedOneTimePasswords_link'),'onclick', this, 'selectUnusedOneTimePasswords');
231
232 MochiKit.Base.map(MochiKit.Base.bind(function(aCheckbox) {
233 MochiKit.Signal.connect(aCheckbox, 'onclick', this, 'handleCheckboxClick');
234 }, this), this.oneTimePasswordCheckboxes());
235
236 this.updateDeleteButtonStatus();
237
238 if (isThereAnyActiveOneTimePassword == true) {
239 this.printButton().enable();
240 } else {
241 this.printButton().disable();
242 }
243
244 // Clipperz.NotificationCenter.register(null, 'oneTimePasswordAdded', this, 'render');
245 Clipperz.NotificationCenter.register(null, 'oneTimePassword_saveChanges_done', this, 'render');
246
247 }, this));
248//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OTP.MainComponent.render - 4: " + res); return res;});
249
250 deferredResult.callback();
251 }
252 },
253
254 //-------------------------------------------------------------------------
255
256 'printOneTimePasswords': function() {
257 var newWindow;
258 var activeOneTimePasswords;
259
260//MochiKit.Logging.logDebug(">>> printAllData");
261 newWindow = window.open("", "");
262 newWindow.document.write(
263"<html>" +
264"<header>" +
265 "<title>Clipperz One Time Password</title>" +
266"<style>" +
267"div.oneTimePassword_print h2 {" +
268 "font-family: monospace;" +
269 "font-weight: normal;" +
270 "padding: 10px 20px;" +
271"}" +
272"</style>" +
273"" +
274"<!--[if IE]>" +
275"<style>" +
276"</style>" +
277"<![endif]-->" +
278"" +
279"</header>" +
280"<body>" +
281"</body>" +
282"</html>"
283 );
284
285 activeOneTimePasswords = MochiKit.Base.filter(function(aOneTimePassword) {return (aOneTimePassword.isExpired() == false)}, MochiKit.Base.values(this.user().oneTimePasswordManager().oneTimePasswords()).reverse());
286
287 MochiKit.Iter.forEach(activeOneTimePasswords, MochiKit.Base.partial(function(aWindow, aOneTimePassword) {
288 MochiKit.DOM.withWindow(aWindow, MochiKit.Base.partial(function(aOneTimePassword) {
289 var newBlock;
290
291 newBlock = MochiKit.DOM.DIV({'class': 'oneTimePassword_print'},
292 MochiKit.DOM.H2(null, aOneTimePassword.password())
293 );
294 MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, newBlock);
295
296 }, aOneTimePassword));
297 }, newWindow));
298 },
299
300 //-------------------------------------------------------------------------
301
302 'generateRandomBase32OTPValue': function(aButton) {
303 var randomValue;
304 varresult;
305
306 randomValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(160/8);
307 result = randomValue.toBase32String();
308 result = result.replace(/.{4}\B/g, '$&' + ' ');
309 result = result.replace(/(.{4} ){2}/g, '$&' + '- ');
310
311 return result;
312 },
313
314 //-------------------------------------------------------------------------
315
316 'createNewOneTimePassword': function() {
317 var newOneTimePassword;
318 var password;
319
320 password = this.generateRandomBase32OTPValue();
321 newOneTimePassword = new Clipperz.PM.DataModel.OneTimePassword({
322 user:this.user(),
323 password:password
324 });
325 this.user().oneTimePasswordManager().addOneTimePassword(newOneTimePassword);
326 Clipperz.PM.Components.MessageBox.showProgressPanel(MochiKit.Base.method(newOneTimePassword, 'saveChanges'), null, this.getDom('createNewOneTimePasswordButton'));
327 },
328
329 //-------------------------------------------------------------------------
330
331 'oneTimePasswordCheckboxes': function() {
332 return MochiKit.DOM.getElementsByTagAndClassName('input', 'otpCheckbox', this.getId('oneTimePasswords_tbody'));
333 },
334
335 'checkedOneTimePasswordCheckboxes': function() {
336 return MochiKit.Base.filter(function(aCheckbox) {return (aCheckbox.checked == true)}, this.oneTimePasswordCheckboxes());
337 },
338
339 //-------------------------------------------------------------------------
340
341 'selectAllOneTimePasswords': function(anEvent) {
342 var checkboxes;
343 var i,c;
344
345 anEvent.stop();
346 checkboxes = this.oneTimePasswordCheckboxes();
347 c = checkboxes.length;
348 for (i=0; i<c; i++) {
349 checkboxes[i].checked = true;
350 }
351
352 this.updateDeleteButtonStatus();
353 },
354
355 'selectNoneOneTimePasswords': function(anEvent) {
356 var checkboxes;
357 var i,c;
358
359 anEvent.stop();
360 checkboxes = this.oneTimePasswordCheckboxes();
361 c = checkboxes.length;
362 for (i=0; i<c; i++) {
363 checkboxes[i].checked = false;
364 }
365
366 this.updateDeleteButtonStatus();
367 },
368
369 'selectUsedOneTimePasswords': function(anEvent) {
370 var checkboxes;
371 var oneTimePasswordManager;
372 var i,c;
373
374 anEvent.stop();
375 oneTimePasswordManager = this.user().oneTimePasswordManager();
376 checkboxes = this.oneTimePasswordCheckboxes();
377 c = checkboxes.length;
378 for (i=0; i<c; i++) {
379 var matchingOneTimePassword;
380
381 matchingOneTimePassword = oneTimePasswordManager.oneTimePasswordWithReference(checkboxes[i].name);
382 checkboxes[i].checked = matchingOneTimePassword.isExpired();
383 }
384
385 this.updateDeleteButtonStatus();
386 },
387
388 'selectUnusedOneTimePasswords': function(anEvent) {
389 var checkboxes;
390 var oneTimePasswordManager;
391 var i,c;
392
393 anEvent.stop();
394 oneTimePasswordManager = this.user().oneTimePasswordManager();
395 checkboxes = this.oneTimePasswordCheckboxes();
396 c = checkboxes.length;
397 for (i=0; i<c; i++) {
398 var matchingOneTimePassword;
399
400 matchingOneTimePassword = oneTimePasswordManager.oneTimePasswordWithReference(checkboxes[i].name);
401 checkboxes[i].checked = !matchingOneTimePassword.isExpired();
402 }
403
404 this.updateDeleteButtonStatus();
405 },
406
407 //-------------------------------------------------------------------------
408
409 'handleCheckboxClick': function(anEvent) {
410 this.updateDeleteButtonStatus();
411 },
412
413 //-------------------------------------------------------------------------
414
415 'deleteSelectedOneTimePasswords': function() {
416 var deferredResult;
417 var otpToDelete;
418 var i,c;
419
420 otpToDelete = this.checkedOneTimePasswordCheckboxes();
421 c = otpToDelete.length;
422 for (i=0; i<c; i++) {
423//MochiKit.Logging.logDebug("otp to delete: " + otpToDelete[i].name);
424 this.user().oneTimePasswordManager().deleteOneTimePasswordWithReference(otpToDelete[i].name);
425 };
426
427 deferredResult = new MochiKit.Async.Deferred();
428//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("ActiveOTPPanel.deleteSelectedOneTimePasswords - 0: " + res); return res;});
429 deferredResult.addCallback(Clipperz.PM.Components.MessageBox.showProgressPanel, MochiKit.Base.method(this.user().oneTimePasswordManager(), 'saveChanges'), null, null);
430//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("ActiveOTPPanel.deleteSelectedOneTimePasswords - 1: " + res); return res;});
431 deferredResult.addCallback(MochiKit.Base.method(this, 'render'));
432//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("ActiveOTPPanel.deleteSelectedOneTimePasswords - 2: " + res); return res;});
433 deferredResult.callback();
434 },
435
436 //-------------------------------------------------------------------------
437
438 'user': function() {
439 return this._user;
440 },
441
442 //-------------------------------------------------------------------------
443
444 'shouldRender': function() {
445 return this._shouldRender;
446 },
447
448 'setShouldRender': function(aValue) {
449 this._shouldRender = aValue;
450 },
451
452 'tabSelectedHandler': function(anEvent) {
453 if ((this.shouldRender()) && (anEvent.source().selectedTab() == 'manageOTPTab')) {
454 this.render();
455 this.setShouldRender(false);
456 }
457 },
458
459 //-------------------------------------------------------------------------
460
461 'deleteButton': function() {
462 return this._deleteButton;
463 },
464
465 'setDeleteButton': function(aValue) {
466 this._deleteButton = aValue;
467 },
468
469 'updateDeleteButtonStatus': function() {
470 if (this.checkedOneTimePasswordCheckboxes().length > 0) {
471 this.deleteButton().enable();
472 } else {
473 this.deleteButton().disable();
474 }
475 },
476
477 //-------------------------------------------------------------------------
478
479 'printButton': function() {
480 return this._printButton;
481 },
482
483 'setPrintButton': function(aValue) {
484 this._printButton = aValue;
485 },
486
487 //-------------------------------------------------------------------------
488 __syntaxFix__: "syntax fix"
489});
490
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/AccountPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/AccountPanel.js
new file mode 100644
index 0000000..6b467d0
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Panels/AccountPanel.js
@@ -0,0 +1,784 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.Panels.AccountPanel = function(anElement, args) {
37//MochiKit.Logging.logDebug(">>> new AccountPanel");
38 args = args || {};
39
40 Clipperz.PM.Components.Panels.AccountPanel.superclass.constructor.call(this, anElement, args);
41
42 Clipperz.NotificationCenter.register(null, 'setupDone', this, 'render');
43
44 this._shouldLoadLoginHistory = true;
45
46 //this.render();
47//MochiKit.Logging.logDebug("<<< new AccountPanel");
48
49 return this;
50}
51
52//=============================================================================
53
54YAHOO.extendX(Clipperz.PM.Components.Panels.AccountPanel, Clipperz.PM.Components.Panels.BasePanel, {
55
56 'toString': function() {
57 return "Clipperz.PM.Components.AccountPanel component";
58 },
59
60 //-------------------------------------------------------------------------
61
62 'render': function() {
63 var errorMessageActor;
64 varchangePasswordButton;
65 var deleteAccountButton;
66
67try {
68//MochiKit.Logging.logDebug(">>> AccountPanel.render");
69 Clipperz.NotificationCenter.unregister(this);
70 MochiKit.Signal.disconnectAllTo(this);
71
72 this.element().update("");
73 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[
74 {tag:'tbody', children:[
75 {tag:'tr', children:[
76 {tag:'td', valign:'top', width:'200', children:[
77 {tag:'ul', id:"accountSubMenu", cls:'subMenu', children:[
78 {tag:'li', id:'changePassphraseTab', htmlString:Clipperz.PM.Strings['changePasswordTabLabel']},
79 {tag:'li', id:'manageOTPTab', htmlString:Clipperz.PM.Strings['manageOTPTabLabel']},
80 {tag:'li', id:'accountPreferencesTab', htmlString:Clipperz.PM.Strings['accountPreferencesLabel']},
81 {tag:'li', id:'loginHistoryTab', htmlString:Clipperz.PM.Strings['accountLoginHistoryLabel']},
82 {tag:'li', id:'deleteAccountTab', htmlString:Clipperz.PM.Strings['deleteAccountTabLabel']}
83 // {tag:'li', id:'paidAccountTab'), htmlString:Clipperz.PM.Strings['paidAccountTabLabel']}
84 ]}
85 ]},
86 {tag:'td', valign:'top', children:[
87 {tag:'ul', cls:'clipperzTabPanels', children:[
88 {tag:'li', id:this.getId('changePassphrasePanel'), children:[
89 {tag:'div', cls:'clipperzSubPanel', children:[
90 {tag:'h5', htmlString:Clipperz.PM.Strings['changePasswordTabTitle']},
91 {tag:'div', cls:'panelBody', id:'changePassphraseBlock', children:[
92 {tag:'form', id:this.getId('changePassphraseForm'), children:[
93 {tag:'h5', cls:'errorMessage', id:this.getId('changePassphrase_errorMessage')},
94 {tag:'table', cls:'panelBody', children:[
95 {tag:'tr', children:[
96 {tag:'td', children:[
97 {tag:'span', cls:'formLabel', htmlString:Clipperz.PM.Strings['changePasswordFormUsernameLabel']}
98 ]},
99 {tag:'td', children:[
100 {tag:'input', type:'text', name:'username', id:this.getId('changePassphrase_username')}
101 ]}
102 ]},
103 {tag:'tr', children:[
104 {tag:'td', children:[
105 {tag:'span', cls:'formLabel', htmlString:Clipperz.PM.Strings['changePasswordFormOldPassphraseLabel']}
106 ]},
107 {tag:'td', children:[
108 {tag:'input', type:'password', name:'oldPassphrase', id:this.getId('changePassphrase_oldPassphrase')}
109 ]}
110 ]},
111 {tag:'tr', children:[
112 {tag:'td', children:[
113 {tag:'span', cls:'formLabel', htmlString:Clipperz.PM.Strings['changePasswordFormNewPassphraseLabel']}
114 ]},
115 {tag:'td', children:[
116 {tag:'input', type:'password', name:'newPassphrase', id:this.getId('changePassphrase_newPassphrase')}
117 ]}
118 ]},
119 {tag:'tr', children:[
120 {tag:'td', children:[
121 {tag:'span', cls:'formLabel', htmlString:Clipperz.PM.Strings['changePasswordFormRetypePassphraseLabel']}
122 ]},
123 {tag:'td', children:[
124 {tag:'input', type:'password', name:'renewPassphrase', id:this.getId('changePassphrase_renewPassphrase')}
125 ]}
126 ]},
127 {tag:'tr', children:[
128 {tag:'td', align:'right', children:[
129 {tag:'input', type:'checkbox', id:this.getId('changePassphrase_safetyCheck')}
130 ]},
131 {tag:'td', children:[
132 {tag:'span', htmlString:Clipperz.PM.Strings['changePasswordFormSafetyCheckboxLabel']}
133 ]}
134 ]}
135 ]},
136 {tag:'div', cls:'clipperzSubPanelButtonBox', children:[
137 {tag:'div', id:this.getId('changePassphraseButton')}
138 ]}
139 ]}
140 ]}
141 ]}
142 ]},
143 {tag:'li', id:this.getId('manageOTPPanel'), children:[
144 {tag:'div', cls:'clipperzSubPanel', children:[
145 {tag:'h5', htmlString:Clipperz.PM.Strings['manageOTPTabTitle']},
146 {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['manageOTPTabDescription']},
147 {tag:'div', id:'OTPComponent'}
148 ]}
149 ]},
150 {tag:'li', id:this.getId('accountPreferencesPanel'), children:[
151 {tag:'div', cls:'clipperzSubPanel', children:[
152 {tag:'h5', htmlString:Clipperz.PM.Strings['accountPreferencesTabTitle']},
153 {tag:'div', cls:'panelBody', id:this.getId('preferencesPanelBody')}
154 ]}
155 ]},
156 {tag:'li', id:this.getId('loginHistoryAccountPanel'), children:[
157 {tag:'div', cls:'clipperzSubPanel', children:[
158 {tag:'h5', htmlString:Clipperz.PM.Strings['loginHistoryTabTitle']},
159 {tag:'div', cls:'panelBody', id:'loginHistoryAccountBlock'}
160 ]}
161 ]},
162 {tag:'li', id:this.getId('deleteAccountPanel'), children:[
163 {tag:'div', cls:'clipperzSubPanel', children:[
164 {tag:'h5', htmlString:Clipperz.PM.Strings['deleteAccountTabTitle']},
165
166 {tag:'div', cls:'panelBody', id:'deleteAccountBlock', children:[
167 {tag:'form', id:this.getId('deleteAccountForm'), children:[
168 {tag:'h5', cls:'errorMessage', id:this.getId('deleteAccount_errorMessage')},
169 {tag:'table', cls:'panelBody', children:[
170 {tag:'tr', children:[
171 {tag:'td', children:[
172 {tag:'span', cls:'formLabel', htmlString:Clipperz.PM.Strings['deleteAccountFormUsernameLabel']}
173 ]},
174 {tag:'td', children:[
175 {tag:'input', type:'text', name:'username', id:this.getId('deleteAccount_username')}
176 ]}
177 ]},
178 {tag:'tr', children:[
179 {tag:'td', children:[
180 {tag:'span', cls:'formLabel', htmlString:Clipperz.PM.Strings['deleteAccountFormPassphraseLabel']}
181 ]},
182 {tag:'td', children:[
183 {tag:'input', type:'password', name:'passphrase', id:this.getId('deleteAccount_passphrase')}
184 ]}
185 ]},
186 {tag:'tr', children:[
187 {tag:'td', align:'right', children:[
188 {tag:'input', type:'checkbox', id:this.getId('deleteAccount_safetyCheck')}
189 ]},
190 {tag:'td', children:[
191 {tag:'span', htmlString:Clipperz.PM.Strings['deleteAccountFormSafetyCheckboxLabel']}
192 ]}
193 ]}
194 ]},
195 {tag:'div', cls:'clipperzSubPanelButtonBox', children:[
196 {tag:'div', id:this.getId('deleteAccountButton')}
197 ]}
198 ]}
199 ]}
200 ]}
201 ]}
202 /*
203 {tag:'li', id:this.getId('paidAccountPanel'), children:[
204 {tag:'div', cls:'clipperzSubPanel', children:[
205 {tag:'h5', htmlString:Clipperz.PM.Strings['upgradeAccountTabTitle']},
206 {tag:'div', htmlString:Clipperz.PM.Strings['comingSoon']}
207 ]}
208 ]}
209*/
210 ]}
211 ]}
212 ]}
213 ]}
214 ]});
215
216//MochiKit.Logging.logDebug("--- AccountPanel.render - 1");
217 MochiKit.Signal.connect(this.getId('changePassphraseForm'), 'onkeydown', this, 'onkeydown');
218 errorMessageActor = this.getActor('changePassphrase_errorMessage');
219 errorMessageActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY);
220 errorMessageActor.update("---");
221 errorMessageActor.hide();
222 changePasswordButton = new YAHOO.ext.Button(this.getDom('changePassphraseButton'), {text:Clipperz.PM.Strings['changePasswordFormSubmitLabel'], handler:this.doChangePassphrase, scope:this});
223
224//MochiKit.Logging.logDebug("--- AccountPanel.render - 2");
225
226 MochiKit.Signal.connect(this.getId('deleteAccountForm'), 'onkeydown', this, 'onkeydown');
227 errorMessageActor = this.getActor('deleteAccount_errorMessage');
228 errorMessageActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY);
229 errorMessageActor.update(Clipperz.PM.Strings['deleteAccountFormEmptyErrorMessage']);
230 errorMessageActor.hide();
231 deleteAccountButton = new YAHOO.ext.Button(this.getDom('deleteAccountButton'), {text:Clipperz.PM.Strings['deleteAccountFormSubmitLabel'], handler:this.doDeleteAccount, scope:this});
232//MochiKit.Logging.logDebug("--- AccountPanel.render - 5");
233
234 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) {
235 this.getElement('changePassphraseForm').addClass('read-only');
236 // this.getElement('accountPreferencesForm').addClass('read-only');
237 this.getElement('deleteAccountForm').addClass('read-only');
238 changePasswordButton.disable();
239 deleteAccountButton.disable();
240 }
241//MochiKit.Logging.logDebug("--- AccountPanel.render - 6");
242
243 new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('changePassphrase_oldPassphrase'));
244 new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('changePassphrase_newPassphrase'));
245
246 new Clipperz.PM.Components.OTP.MainComponent(YAHOO.ext.Element.get('OTPComponent'), {user:this.user()});
247
248 this.tabPanelController().setUp();
249 Clipperz.NotificationCenter.register(null, 'tabSelected', this, 'tabSelectedHandler');
250 Clipperz.NotificationCenter.register(null, 'updatedPreferences', this, 'renderPreferences');
251 Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler');
252//MochiKit.Logging.logDebug("<<< AccountPanel.render");
253
254} catch(exception) {
255 MochiKit.Logging.logError("### " + exception);
256 throw exception;
257}
258 },
259
260 //-------------------------------------------------------------------------
261
262 'tabPanelController': function() {
263 if (this._tabPanelController == null) {
264 var tabPanelControllerConfig;
265
266 tabPanelControllerConfig = {}
267 tabPanelControllerConfig['changePassphraseTab'] = this.getId('changePassphrasePanel');
268 tabPanelControllerConfig['manageOTPTab'] = this.getId('manageOTPPanel');
269 tabPanelControllerConfig['accountPreferencesTab'] = this.getId('accountPreferencesPanel');
270 tabPanelControllerConfig['loginHistoryTab'] = this.getId('loginHistoryAccountPanel');
271 tabPanelControllerConfig['deleteAccountTab'] = this.getId('deleteAccountPanel');
272 // tabPanelControllerConfig['paidAccountTab'] = this.getId('paidAccountPanel');
273
274 this._tabPanelController = new Clipperz.PM.Components.TabPanel.TabPanelController({
275 name:'accountTabPanel',
276 config:tabPanelControllerConfig,
277 selectedTab:'changePassphraseTab'
278 });
279 }
280
281 return this._tabPanelController;
282 },
283
284 //-------------------------------------------------------------------------
285
286 'doChangePassphrase': function() {
287 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly() == false) {
288 varusername;
289 varoldPassphrase;
290 var newPassphrase;
291 var renewPassphrase;
292 var safetyCheck;
293 varareThereAnyErrors;
294 var errorMessageActor;
295
296 errorMessageActor = this.getActor('changePassphrase_errorMessage');
297
298 areThereAnyErrors = false;
299 username = this.getDom('changePassphrase_username').value;
300 oldPassphrase= this.getDom('changePassphrase_oldPassphrase').value;
301 newPassphrase= this.getDom('changePassphrase_newPassphrase').value;
302 renewPassphrase= this.getDom('changePassphrase_renewPassphrase').value;
303 safetyCheck = this.getDom('changePassphrase_safetyCheck').checked;
304
305 if (this.user().username() != username) {
306 this.showFormErrorMessageAnimation(errorMessageActor, Clipperz.PM.Strings['changePasswordFormWrongUsernameWarning']);
307 this.getElement('changePassphrase_username').focus().dom.select();
308 areThereAnyErrors = true;
309 } else if (this.user().passphrase() != oldPassphrase) {
310 this.showFormErrorMessageAnimation(errorMessageActor, Clipperz.PM.Strings['changePasswordFormWrongPassphraseWarning']);
311 this.getElement('changePassphrase_oldPassphrase').focus().dom.select();
312 areThereAnyErrors = true;
313 } else if (newPassphrase != renewPassphrase) {
314 this.showFormErrorMessageAnimation(errorMessageActor, Clipperz.PM.Strings['changePasswordFormWrongRetypePassphraseWarning']);
315 this.getElement('changePassphrase_renewPassphrase').focus().dom.select();
316 areThereAnyErrors = true;
317 } else if (safetyCheck != true) {
318 this.showFormErrorMessageAnimation(errorMessageActor, Clipperz.PM.Strings['changePasswordFormSafetyCheckWarning']);
319 this.getElement('changePassphrase_safetyCheck').focus();
320 areThereAnyErrors = true;
321 }
322
323 if (areThereAnyErrors == false) {
324 errorMessageActor.hide();
325 this.doChangePassphraseWithUsernameAndPassphrase(username, newPassphrase);
326 }
327 }
328 },
329
330 //-------------------------------------------------------------------------
331
332 'doChangePassphraseWithUsernameAndPassphrase': function(anUsername, aPassphrase) {
333 var deferredResult;
334
335//MochiKit.Logging.logDebug(">>> AccountPanel.doChangePassphraseWithUsernameAndPassphrase - this.user: " + this.user());
336 deferredResult = new MochiKit.Async.Deferred();
337//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug(" AccountPanel.doChangePassphraseWithUsernameAndPassphrase 1: " + res); return res;});
338 deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'),
339 {
340 title:Clipperz.PM.Strings['changePasswordFormProgressDialogTitle'],
341 text:Clipperz.PM.Strings['changePasswordFormProgressDialogEmptyText'],
342 width:240,
343 showProgressBar:true,
344 showCloseButton:false,
345 steps:4
346 },
347 this.getDom('changePassphraseButton')
348 );
349//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug(" AccountPanel.doChangePassphraseWithUsernameAndPassphrase 2: " + res); return res;});
350 deferredResult.addCallback(MochiKit.Base.method(this.user(), 'changeCredentials'), anUsername, aPassphrase);
351//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug(" AccountPanel.doChangePassphraseWithUsernameAndPassphrase 3: " + res); return res;});
352 deferredResult.addCallback(function() {
353 Clipperz.PM.Components.MessageBox().update({
354 title:Clipperz.PM.Strings['changePasswordFormProgressDialogConnectedMessageTitle'],
355 text:Clipperz.PM.Strings['changePasswordFormProgressDialogConnectedMessageText'],
356 /*showProgressBar:false,*/
357 step:'next'
358 });
359 });
360//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug(" AccountPanel.doChangePassphraseWithUsernameAndPassphrase 4: " + res); return res;});
361 deferredResult.addCallback(MochiKit.Async.wait, 1);
362//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug(" AccountPanel.doChangePassphraseWithUsernameAndPassphrase 5: " + res); return res;});
363 deferredResult.addCallback(function(anAccountPanel, res) {
364 Clipperz.PM.Components.MessageBox().hide(YAHOO.ext.Element.get('main'));
365
366 anAccountPanel.getDom('changePassphrase_username').value = "";
367 anAccountPanel.getDom('changePassphrase_oldPassphrase').value = "";
368 anAccountPanel.getElement('changePassphrase_oldPassphrase').focus();
369 anAccountPanel.getDom('changePassphrase_newPassphrase').value = "";
370 anAccountPanel.getElement('changePassphrase_newPassphrase').focus();
371 anAccountPanel.getDom('changePassphrase_renewPassphrase').value = "";
372 anAccountPanel.getDom('changePassphrase_safetyCheck').checked = false;
373
374 anAccountPanel.getElement('changePassphrase_username').focus();
375 return res;
376 }, this);
377//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug(" AccountPanel.doChangePassphraseWithUsernameAndPassphrase 6: " + res); return res;});
378 deferredResult.addErrback(function() {
379 Clipperz.PM.Components.MessageBox().update({
380 title:Clipperz.PM.Strings['changePasswordFormProgressDialogErrorMessageTitle'],
381 text:Clipperz.PM.Strings['changePasswordFormProgressDialogErrorMessageText'],
382 buttons:{'ok':"close"}
383 });
384 });
385//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug(" AccountPanel.doChangePassphraseWithUsernameAndPassphrase 7: " + res); return res;});
386 deferredResult.callback();
387
388//MochiKit.Logging.logDebug("<<< AccountPanel.doChangePassphraseWithUsernameAndPassphrase");
389 },
390
391 //-------------------------------------------------------------------------
392
393 'doDeleteAccount': function() {
394 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly() == false) {
395 varusername;
396 varpassphrase;
397 var safetyCheck;
398 varareThereAnyErrors;
399 var errorMessageActor;
400
401 errorMessageActor = this.getActor('deleteAccount_errorMessage');
402
403 areThereAnyErrors = false;
404 username = this.getDom('deleteAccount_username').value;
405 passphrase= this.getDom('deleteAccount_passphrase').value;
406 safetyCheck = this.getDom('deleteAccount_safetyCheck').checked;
407
408 if (this.user().username() != username) {
409 this.showFormErrorMessageAnimation(errorMessageActor, Clipperz.PM.Strings['deleteAccountFormWrongUsernameWarning']);
410 this.getElement('deleteAccount_username').focus().dom.select();
411 areThereAnyErrors = true;
412 } else if (this.user().passphrase() != passphrase) {
413 this.showFormErrorMessageAnimation(errorMessageActor, Clipperz.PM.Strings['deleteAccountFormWrongPassphraseWarning']);
414 this.getElement('deleteAccount_passphrase').focus().dom.select();
415 areThereAnyErrors = true;
416 } else if (safetyCheck != true) {
417 this.showFormErrorMessageAnimation(errorMessageActor, Clipperz.PM.Strings['deleteAccountFormSafetyCheckWarning']);
418 this.getElement('deleteAccount_safetyCheck').focus();
419 areThereAnyErrors = true;
420 }
421
422 if (areThereAnyErrors == false) {
423 var deferred;
424
425 deferred = new MochiKit.Async.Deferred();
426 errorMessageActor.hide();
427
428 deferred.addCallback(function() {
429 var deferredResult;
430
431 //TODO: if the form is submitted with the return key, the confirmation dialog is skipped!?
432 deferredResult = new MochiKit.Async.Deferred();
433 Clipperz.PM.Components.MessageBox().deferredShow({
434 title:Clipperz.PM.Strings['accountPanelDeletingAccountPanelConfirmationTitle'],
435 text:Clipperz.PM.Strings['accountPanelDeleteAccountPanelConfirmationText'],
436 width:240,
437 showProgressBar:false,
438 showCloseButton:false,
439 buttons:{
440 'yes':Clipperz.PM.Strings['accountPanelDeleteAccountPanelConfirmButtonLabel'],
441 'no':Clipperz.PM.Strings['accountPanelDeleteAccountPanelDenyButtonLabel']
442 },
443 fn:MochiKit.Base.partial(function(aDeferred, aResult) {
444 if (aResult == 'yes') {
445 aDeferred.callback(aResult);
446 } else {
447 aDeferred.errback(aResult);
448 }
449 }, deferredResult)
450 });
451
452 return deferredResult;
453 });
454 deferred.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'),
455 {
456 title:Clipperz.PM.Strings['accountPanelDeletingAccountPanelProgressTitle'],
457 text:Clipperz.PM.Strings['accountPanelDeletingAccountPanelProgressText'],
458 width:240,
459 showProgressBar:true,
460 showCloseButton:false
461 }
462 );
463 deferred.addCallback(MochiKit.Base.method(this.user(), 'deleteAccountAction'));
464 deferred.addCallback(Clipperz.PM.exit, 'accountDeleted.html');
465 deferred.addErrback(function(res) {
466 alert(res);
467 })
468 deferred.callback();
469 }
470 }
471 },
472
473 //-------------------------------------------------------------------------
474
475 'showFormErrorMessageAnimation': function(anActor, anErrorMessage, aCallback) {
476 anActor.update(anErrorMessage);
477 anActor.show(true);
478 anActor.play(aCallback);
479 },
480
481 //-------------------------------------------------------------------------
482
483 'onkeydown': function(anEvent) {
484//MochiKit.Logging.logDebug(">>> onkeydown - " + anEvent.src().id);
485 if (anEvent.key().code == 13) {
486 anEvent.stop();
487
488 if (anEvent.src() == this.getDom('changePassphraseForm')) {
489 this.doChangePassphrase();
490 } else if (anEvent.src() == this.getDom('deleteAccountForm')) {
491 this.doDeleteAccount();
492 } else {
493 }
494
495 }
496 },
497
498 //-------------------------------------------------------------------------
499
500 'selectSelectedLanguageOption': function() {
501 varuserSelectedLanguage;
502
503 userSelectedLanguage = this.user().preferences().preferredLanguage() || "default";
504 MochiKit.Base.filter(function(anOption) {return (anOption.value == userSelectedLanguage)}, this.getDom('languageSelector').childNodes)[0].selected = true;
505 },
506
507 //-------------------------------------------------------------------------
508
509 'doSaveUserPreferences': function() {
510 var selectedLanguage;
511 var showDonationReminderDialog;
512 // var disableUnsecureFaviconLoadingForIE;
513
514//MochiKit.Logging.logDebug(">>> AccountPanel.doSaveUserPreferences");
515 selectedLanguage = this.getDom('languageSelector').value;
516 if (selectedLanguage == "default") {
517 selectedLanguage = null;
518 }
519 this.user().preferences().setPreferredLanguage(selectedLanguage);
520
521 showDonationReminderDialog = this.getDom('showDonationReminderCheckbox').checked;
522 this.user().preferences().setShouldShowDonationPanel(showDonationReminderDialog);
523
524 // disableUnsecureFaviconLoadingForIE = this.getDom('disableFaviconForIECheckbox').checked;
525 // this.user().preferences().setDisableUnsecureFaviconLoadingForIE(disableUnsecureFaviconLoadingForIE);
526
527 this.user().preferences().saveChanges(this.getDom('saveUserPreferences'));
528 },
529
530 'doCancelUserPreferences': function() {
531 this.renderPreferences();
532 },
533
534 //'switchLanguage': function(anEvent) {
535 // Clipperz.PM.Strings.Languages.setSelectedLanguage(anEvent.src().value);
536 //},
537
538 //-------------------------------------------------------------------------
539
540 'renderLoginHistory': function() {
541 var element;
542
543//MochiKit.Logging.logDebug(">>> AccountPanel.renderLoginHistory");
544 element = YAHOO.ext.Element.get('loginHistoryAccountBlock');
545
546 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) {
547 element.update("");
548 this.domHelper().append(element, {tag:'div', cls:'loginHistoryReadOnlyMessage', htmlString:Clipperz.PM.Strings['loginHistoryReadOnlyMessage']});
549 } else {
550 var deferredResult;
551
552 deferredResult = new MochiKit.Async.Deferred();
553 deferredResult.addCallback(MochiKit.Base.bind(function(anElement) {
554 anElement.update("");
555 Clipperz.YUI.DomHelper.append(anElement, {tag:'div', cls:'loadingMessage', htmlString:Clipperz.PM.Strings['loginHistoryLoadingMessage']});
556 }, this), element);
557 deferredResult.addCallback(MochiKit.Base.method(this.user(), 'loadLoginHistory'));
558 deferredResult.addCallback(MochiKit.Base.bind(function(anElement, aResult) {
559 var loginListItems;
560 var tBodyElement;
561 var imageExtension;
562 var now;
563 var i, c;
564
565 loginListItems = aResult;
566//MochiKit.Logging.logDebug("=== loginListItems: " + Clipperz.Base.serializeJSON(loginListItems));
567 imageExtension = (Clipperz_IEisBroken == true) ? 'gif': 'png';
568
569 now = new Date();
570 anElement.update("");
571 Clipperz.YUI.DomHelper.append(anElement, {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['loginHistoryLoadedMessage']});
572 Clipperz.YUI.DomHelper.append(anElement, {tag:'table', id:'loginHistoryTable', cellspacing:'0', cellpadding:'2', border:'0', children:[
573 {tag:'tbody', id:this.getId('loginHistoryTBody'), children:[]}
574 ]});
575 //# Clipperz.YUI.DomHelper.append(anElement, {tag:'div', id:'loginHistoryFooter', children:[
576 Clipperz.YUI.DomHelper.append(anElement, {tag:'div', cls:'clipperzSubPanelButtonBox', children:[
577 {tag:'div', id:this.getId('reloadHistoryButton')}
578 ]});
579
580 new YAHOO.ext.Button(this.getDom('reloadHistoryButton'), {text:Clipperz.PM.Strings['loginHistoryReloadButtonLabel'], handler:this.reloadHistory, scope:this});
581
582 tBodyElement = this.getElement('loginHistoryTBody');
583 c = loginListItems.length;
584 for (i=0; i<c; i++) {
585 var ip;
586 var date;
587 var mainText;
588
589 date = Clipperz.PM.Date.parseDateWithUTCFormat(loginListItems[i]['date']);
590
591 if (loginListItems[i]['isCurrent'] === true) {
592 mainText ={tag:'div', cls:'currentSession', htmlString:Clipperz.PM.Strings['loginHistoryCurrentSessionText']}
593 } else {
594 mainText = {tag:'div', cls:'elapsedTime', html:Clipperz.PM.Date.getElapsedTimeDescription(date)}
595 }
596
597 if (loginListItems[i]['connectionType'] == "ONE_TIME_PASSPHRASE") {
598 optionalInfo = [
599 {tag:'span', html:"OTP"}
600 ];
601 } else {
602 optionalInfo = [];
603 }
604
605 ip = (loginListItems[i]['ip'].match(/^\d{1,3}(.\d{1,3}){3}$/)) ? loginListItems[i]['ip'] : Clipperz.PM.Strings['unknown_ip'];
606 Clipperz.YUI.DomHelper.append(tBodyElement, {tag:'tr', children:[
607 {tag:'td', cls:'loginHistoryValues', valign:'top', children:[
608 mainText,
609 {tag:'div', cls:'fullDate', html:Clipperz.PM.Date.formatDateWithTemplate(date, Clipperz.PM.Strings['fullDate_format'])},
610 {tag:'div', cls:'loginHistoryIP', children:[
611 {tag:'span', cls:'loginHistoryIPLabel', htmlString:Clipperz.PM.Strings['loginHistoryIPLabel']},
612 {tag:'span', cls:'loginHistoryIPValue', html:ip}
613 ]}
614 ]},
615 {tag:'td', cls:'loginHistoryCountry', valign:'top', children:optionalInfo},
616 {tag:'td', cls:'loginHistoryCountry', valign:'top', align:'center', children:[
617 {tag:'img', title:Clipperz.PM.Strings['countries'][loginListItems[i]['country']], cls:'flag', src:Clipperz.PM.Strings['icons_baseUrl'] + "/flags/" + loginListItems[i]['country'].toLowerCase() + "." + imageExtension, width:'32', height:'32'}
618 // {tag:'span', cls:'label', htmlString:Clipperz.PM.Strings['countries'][loginListItems[i]['country']]}
619 ]},
620 {tag:'td', cls:'loginHistoryBrowser', valign:'top', align:'center', children:[
621 {tag:'img', title:Clipperz.PM.Strings['browsers'][loginListItems[i]['browser']], cls:'browser', src:Clipperz.PM.Strings['icons_baseUrl'] + "/browsers/" + loginListItems[i]['browser'].toLowerCase() + "." + imageExtension, width:'32', height:'32'}
622 // {tag:'span', cls:'label', htmlString:Clipperz.PM.Strings['browsers'][loginListItems[i]['browser']]}
623 ]},
624 {tag:'td', cls:'loginHistoryOperatingSystem', valign:'top', align:'center', children:[
625 {tag:'img', title:Clipperz.PM.Strings['operatingSystems'][loginListItems[i]['operatingSystem']], cls:'operatingSystem', src:Clipperz.PM.Strings['icons_baseUrl'] + "/operatingSystems/" + loginListItems[i]['operatingSystem'].toLowerCase() + "." + imageExtension, width:'32', height:'32'}
626 // {tag:'span', cls:'label', htmlString:Clipperz.PM.Strings['operatingSystems'][loginListItems[i]['operatingSystem']]}
627 ]}
628 ]});
629 }
630
631 Clipperz.Style.applyZebraStylesToTable('loginHistoryTable');
632 }, this), element);
633
634 deferredResult.callback();
635 }
636//MochiKit.Logging.logDebug("<<< AccountPanel.renderLoginHistory");
637 },
638
639 //-------------------------------------------------------------------------
640
641 'renderPreferences': function() {
642 var saveUserPreferencesButton;
643 var cancelUserPreferencesButton;
644 var preferencedPanelBodyElement;
645
646 preferencedPanelBodyElement = this.getElement('preferencesPanelBody');
647
648 preferencedPanelBodyElement.update("");
649 Clipperz.YUI.DomHelper.append(preferencedPanelBodyElement,
650 {tag:'form', id:this.getId('accountPreferencesForm'), children:[
651 {tag:'table', cls:'panelBody', children:[
652 {tag:'tr', cls:'openPreferenceBlock', children:[
653 {tag:'td', children:[
654 {tag:'div', cls:'preferenceBlockTitle', htmlString:Clipperz.PM.Strings['accountPreferencesLanguageTitle']},
655 {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['accountPreferencesLanguageDescription']},
656 {tag:'div', cls:'panelDescription', children:[
657 {tag:'select',
658 id:this.getId('languageSelector'),
659 children:MochiKit.Base.concat([{tag:'option', value:"default", html:"---"}], Clipperz.PM.Strings['loginPanelSwitchLanguageSelectOptions'])
660 }
661 ]}
662 ]}
663 ]},
664 {tag:'tr', cls:'openPreferenceBlock', children:[
665 {tag:'td', children:[
666 {tag:'div', cls:'preferenceBlockTitle', htmlString:Clipperz.PM.Strings['showDonationReminderPanelTitle']},
667 {tag:'table', cellpadding:'0', cellspacing:'0', children:[
668 {tag:'tbody', children:[
669 {tag:'tr', children:[
670 {tag:'td', valign:'top', children:[
671 {tag:'div', cls:'panelDescription', children:[
672 {tag:'input', type:'checkbox', id:this.getId('showDonationReminderCheckbox')}
673 ]}
674 ]},
675 {tag:'td', valign:'top', children:[
676 {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['showDonationReminderPanelDescription']}
677 ]}
678 ]}
679 ]}
680 ]}
681 ]}
682 ]}//,
683/*
684 {tag:'tr', cls:'openPreferenceBlock', children:[
685 {tag:'td', children:[
686 {tag:'div', cls:'preferenceBlockTitle', htmlString:Clipperz.PM.Strings['disableFaviconForIETitle']},
687 {tag:'table', cellpadding:'0', cellspacing:'0', children:[
688 {tag:'tbody', children:[
689 {tag:'tr', children:[
690 {tag:'td', valign:'top', children:[
691 {tag:'div', cls:'panelDescription', children:[
692 {tag:'input', type:'checkbox', id:this.getId('disableFaviconForIECheckbox')}
693 ]}
694 ]},
695 {tag:'td', valign:'top', children:[
696 {tag:'div', cls:'panelDescription', children:Clipperz.PM.Strings['disableFaviconForIEDescriptionConfig']}
697 ]}
698 ]}
699 ]}
700 ]}
701 ]}
702 ]},
703*/
704 // {tag:'tr', cls:'openPreferenceBlock', children:[
705 // {tag:'td', children:[
706 // {tag:'div', cls:'preferenceBlockTitle', htmlString:Clipperz.PM.Strings['accountPreferencesInterfaceTitle']},
707 // {tag:'div', cls:'panelDescription', children:Clipperz.PM.Strings['accountPreferencesInterfaceDescriptionConfig']}
708 // ]}
709 // ]}
710 ]},
711 {tag:'div', cls:'clipperzSubPanelButtonBox', children:[
712 {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[
713 {tag:'tbody', children:[
714 {tag:'tr', children:[
715 {tag:'td', width:'100', align:'right', cls:'newRecordPanelButtonTD', children:[
716 {tag:'div', id:this.getId('saveUserPreferences')}
717 ]},
718 {tag:'td', width:'10', html:"&nbsp;"},
719 {tag:'td', cls:'newRecordPanelButtonTD', children:[
720 {tag:'div', id:this.getId('cancelUserPreferences')}
721 ]}
722 ]}
723 ]}
724 ]}
725 ]}
726 ]}
727 );
728
729 this.selectSelectedLanguageOption();
730 if (this.user().preferences().shouldShowDonationPanel()) {
731 this.getDom('showDonationReminderCheckbox').checked = true;
732 }
733 // if (this.user().preferences().disableUnsecureFaviconLoadingForIE()) {
734 // this.getDom('disableFaviconForIECheckbox').checked = true;
735 // }
736
737//MochiKit.Logging.logDebug("--- AccountPanel.render - 3");
738 //# saveUserPreferencesButton = new YAHOO.ext.Button(this.getDom('saveUserPreferences'), {text:Clipperz.PM.Strings['saveUserPreferencesFormSubmitLabel'], handler:this.doSaveUserPreferences, scope:this});
739 saveUserPreferencesButton = new YAHOO.ext.Button(this.getDom('saveUserPreferences'), {text:'-----------------', handler:this.doSaveUserPreferences, scope:this});
740 saveUserPreferencesButton.setText(Clipperz.PM.Strings['saveUserPreferencesFormSubmitLabel']);
741 //# cancelUserPreferencesButton = new YAHOO.ext.Button(this.getDom('cancelUserPreferences'), {text:Clipperz.PM.Strings['cancelUserPreferencesFormSubmitLabel'], handler:this.doCancelUserPreferences, scope:this});
742 cancelUserPreferencesButton = new YAHOO.ext.Button(this.getDom('cancelUserPreferences'), {text:'-----------------', handler:this.doCancelUserPreferences, scope:this});
743 cancelUserPreferencesButton.setText(Clipperz.PM.Strings['cancelUserPreferencesFormSubmitLabel']);
744//MochiKit.Logging.logDebug("--- AccountPanel.render - 4");
745
746 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) {
747 this.getElement('accountPreferencesForm').addClass('read-only');
748 saveUserPreferencesButton.disable();
749 cancelUserPreferencesButton.disable();
750 }
751
752 },
753
754 //-------------------------------------------------------------------------
755
756 'reloadHistory': function() {
757 this.setShouldLoadLoginHistory(true);
758 this.renderLoginHistory();
759 },
760
761 'shouldLoadLoginHistory': function() {
762 return this._shouldLoadLoginHistory;
763 },
764
765 'setShouldLoadLoginHistory': function(aValue) {
766 this._shouldLoadLoginHistory = aValue;
767 },
768
769 'tabSelectedHandler': function(anEvent) {
770 if (anEvent.parameters() == 'accountPreferencesTab') {
771 this.renderPreferences();
772 }
773
774 if ((this.shouldLoadLoginHistory()) && (anEvent.parameters() == 'loginHistoryTab')) {
775 this.renderLoginHistory();
776 this.setShouldLoadLoginHistory(false);
777 }
778 },
779
780 //-------------------------------------------------------------------------
781 __syntaxFix__: "syntax fix"
782
783});
784
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/BasePanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/BasePanel.js
new file mode 100644
index 0000000..bf60f45
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Panels/BasePanel.js
@@ -0,0 +1,96 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; }
33
34//var _Clipperz_PM_Components_Panels_base_id_ = 0;
35
36//#############################################################################
37
38Clipperz.PM.Components.Panels.BasePanel = function(anElement, args) {
39 args = args || {};
40
41 Clipperz.PM.Components.Panels.BasePanel.superclass.constructor.call(this, anElement, args);
42
43 this._user = args.user || null;
44 this._delegate = args.delegate || null;
45 this._tabPanelController = null;
46 //Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler');
47
48 //this._ids = {};
49
50 return this;
51}
52
53//=============================================================================
54
55YAHOO.extendX(Clipperz.PM.Components.Panels.BasePanel, Clipperz.PM.Components.BaseComponent, {
56
57 'toString': function() {
58 return "Clipperz.PM.Components.Panels.BasePanel component";
59 },
60
61 //-------------------------------------------------------------------------
62
63 'user': function() {
64 return this._user;
65 },
66
67 'setUser': function(aValue) {
68 this._user = aValue;
69 },
70
71 //-------------------------------------------------------------------------
72
73 'delegate': function() {
74 return this._delegate;
75 },
76
77 'setDelegate': function(aValue) {
78 this._delegate = aValue;
79 },
80
81 //-------------------------------------------------------------------------
82
83 'tabPanelController': function() {
84 return this._tabPanelController;
85 },
86
87 'switchLanguageHandler': function() {
88//MochiKit.Logging.logDebug(">>> BasePanel.switchLanguageHandler [" + this.toString() + "]");
89 this.render();
90//MochiKit.Logging.logDebug("<<< BasePanel.switchLanguageHandler [" + this.toString() + "]");
91 },
92
93 //-------------------------------------------------------------------------
94 __syntaxFix__: "syntax fix"
95
96});
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/ContactsPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/ContactsPanel.js
new file mode 100644
index 0000000..f0eb9c8
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Panels/ContactsPanel.js
@@ -0,0 +1,105 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.Panels.ContactsPanel = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.Panels.ContactsPanel.superclass.constructor.call(this, anElement, args);
40
41 this.render();
42
43 return this;
44}
45
46//=============================================================================
47
48YAHOO.extendX(Clipperz.PM.Components.Panels.ContactsPanel, Clipperz.PM.Components.Panels.BasePanel, {
49
50 'toString': function() {
51 return "Clipperz.PM.Components.ContactsPanel component";
52 },
53
54 //-------------------------------------------------------------------------
55
56 'render': function() {
57 // var tabPanelControllerConfig;
58
59 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[
60 {tag:'tbody', children:[
61 {tag:'tr', children:[
62 {tag:'td', valign:'top', width:'200', children:[
63 {tag:'ul', id:"dataSubMenu", cls:'subMenu', children:[
64 {tag:'li', id:this.getId('contacts'), htmlString:Clipperz.PM.Strings['contactsTabLabel']},
65 ]}
66 ]},
67 {tag:'td', valign:'top', children:[
68 {tag:'ul', cls:'clipperzTabPanels', children:[
69 {tag:'li', id:this.getId('contactsPanel'), children:[
70 {tag:'div', cls:'clipperzSubPanel', children:[
71 {tag:'h5', htmlString:Clipperz.PM.Strings['contactsTabTitle']},
72 {tag:'div', htmlString:Clipperz.PM.Strings['comingSoon']}
73 ]}
74 ]}
75 ]}
76 ]}
77 ]}
78 ]}
79 ]});
80
81 // tabPanelControllerConfig = {}
82 // tabPanelControllerConfig[this.getId('contacts')] = this.getId('contactsPanel');
83 // new Clipperz.PM.Components.TabPanel.TabPanelController({ config:tabPanelControllerConfig, selectedTab:this.getId('contacts') });
84 this.tabPanelController().setUp();
85 },
86
87 //-------------------------------------------------------------------------
88
89 'tabPanelController': function() {
90 if (this._tabPanelController == null) {
91 var tabPanelControllerConfig;
92
93 tabPanelControllerConfig = {}
94 tabPanelControllerConfig[this.getId('contacts')] = this.getId('contactsPanel');
95 this._tabPanelController = new Clipperz.PM.Components.TabPanel.TabPanelController({ config:tabPanelControllerConfig, selectedTab:this.getId('contacts') });
96 }
97
98 return this._tabPanelController;
99 },
100
101 //-------------------------------------------------------------------------
102 __syntaxFix__: "syntax fix"
103
104});
105
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/DataPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/DataPanel.js
new file mode 100644
index 0000000..759903f
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Panels/DataPanel.js
@@ -0,0 +1,486 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.Panels.DataPanel = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.Panels.DataPanel.superclass.constructor.call(this, anElement, args);
40
41 this._progressWidth = 400;
42
43
44 this.render();
45
46 return this;
47}
48
49//=============================================================================
50
51YAHOO.extendX(Clipperz.PM.Components.Panels.DataPanel, Clipperz.PM.Components.Panels.BasePanel, {
52
53 'toString': function() {
54 return "Clipperz.PM.Components.DataPanel component";
55 },
56
57 //-------------------------------------------------------------------------
58
59 'render': function() {
60 MochiKit.Signal.disconnectAllTo(this);
61 Clipperz.NotificationCenter.unregister(this);
62 this.element().update("");
63
64 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[
65 {tag:'tbody', children:[
66 {tag:'tr', children:[
67 {tag:'td', valign:'top', width:'200', children:[
68 {tag:'ul', id:"dataSubMenu", cls:'subMenu', children:[
69 {tag:'li', id:'offlineCopyTab', htmlString:Clipperz.PM.Strings['offlineCopyTabLabel']},
70 {tag:'li', id:'sharingTab', htmlString:Clipperz.PM.Strings['sharingTabLabel']},
71 {tag:'li', id:'importTab', htmlString:Clipperz.PM.Strings['importTabLabel']},
72 {tag:'li', id:'printingTab', htmlString:Clipperz.PM.Strings['printingTabLabel']}
73 ]}
74 ]},
75 {tag:'td', valign:'top', children:[
76 {tag:'ul', cls:'clipperzTabPanels', children:[
77 {tag:'li', id:this.getId('offlineCopyPanel'), children:[
78 {tag:'div', cls:'clipperzSubPanel', children:[
79 {tag:'h5', htmlString:Clipperz.PM.Strings['offlineCopyTabTitle']},
80 {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['offlineCopyTabDescription']},
81 {tag:'div', id:this.getId('offlineCopyLinkBox'), children:[
82 {tag:'a', id:'offlineCopyLink', href:'#', htmlString:Clipperz.PM.Strings['offlineCopyDownloadLinkLabel']}
83 ]},
84 {tag:'div', id:this.getId('offlineCopyLinkBox_read-only'), children:[
85 {tag:'span', cls:'read-only', htmlString:Clipperz.PM.Strings['offlineCopyDownloadLinkLabel']}
86 ]}
87 ]}
88 ]},
89 {tag:'li', id:this.getId('sharingPanel'), children:[
90 {tag:'div', cls:'clipperzSubPanel', children:[
91 {tag:'h5', htmlString:Clipperz.PM.Strings['sharingTabTitle']},
92 {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['sharingTabDescription']}
93 ]}
94 ]},
95 {tag:'li', id:this.getId('importPanel'), children:[
96 {tag:'div', cls:'clipperzSubPanel', children:[
97 {tag:'div', id:this.getId('importPanelMainComponent')}
98 ]}
99 ]},
100 {tag:'li', id:this.getId('printingPanel'), children:[
101 {tag:'div', cls:'clipperzSubPanel', children:[
102 {tag:'h5', htmlString:Clipperz.PM.Strings['printingTabTitle']},
103
104 {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['printingTabDescription']},
105 {tag:'div', id:this.getId('printingLinkBox'), children:[
106 {tag:'a', id:'printingLink', href:'#', htmlString:Clipperz.PM.Strings['printingLinkLabel']}
107 ]},
108
109 {tag:'hr'},
110
111 {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['exportTabDescription']},
112 {tag:'div', id:this.getId('exportLinkBox'), children:[
113 {tag:'a', id:'exportLink', href:'#', htmlString:Clipperz.PM.Strings['exportLinkLabel']}
114 ]}
115 ]}
116 ]}
117 ]}
118 ]}
119 ]}
120 ]}
121 ]});
122
123 this.tabPanelController().setUp();
124
125 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) {
126 this.getElement('offlineCopyLinkBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
127 } else {
128 this.getElement('offlineCopyLinkBox_read-only').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
129 MochiKit.Signal.connect('offlineCopyLink', 'onclick', this, 'downloadOfflineCopy');
130 }
131
132 new Clipperz.PM.Components.Import.MainComponent(this.getElement('importPanelMainComponent'), {user:this.user()});
133
134 MochiKit.Signal.connect('printingLink', 'onclick', this, 'printAllData');
135 MochiKit.Signal.connect('exportLink', 'onclick', this, 'exportAllData');
136
137 Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler');
138 },
139
140 //-------------------------------------------------------------------------
141
142 'tabPanelController': function() {
143 if (this._tabPanelController == null) {
144 var tabPanelControllerConfig;
145
146 tabPanelControllerConfig = {}
147 tabPanelControllerConfig['offlineCopyTab'] = this.getId('offlineCopyPanel');
148 tabPanelControllerConfig['sharingTab'] = this.getId('sharingPanel');
149 tabPanelControllerConfig['importTab'] = this.getId('importPanel');
150 tabPanelControllerConfig['printingTab'] = this.getId('printingPanel');
151 this._tabPanelController = new Clipperz.PM.Components.TabPanel.TabPanelController({
152 name: 'dataTabPanel',
153 config:tabPanelControllerConfig,
154 selectedTab:'offlineCopyTab'
155 });
156 }
157
158 return this._tabPanelController;
159 },
160
161 //-------------------------------------------------------------------------
162
163 'downloadOfflineCopy': function(anEvent) {
164 var downloadHref;
165
166 downloadHref = window.location.href.replace(/\/[^\/]*$/,'') + Clipperz_dumpUrl;
167
168 if (Clipperz_IEisBroken == true) {
169 window.open(downloadHref, "");
170 } else {
171 vardeferredResult;
172 var newWindow;
173
174 newWindow = window.open("", "");
175
176 anEvent.preventDefault();
177
178 deferredResult = new MochiKit.Async.Deferred();
179 deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'echo', {'echo':"echo"});
180 deferredResult.addCallback(function(aWindow) {
181 aWindow.location.href = downloadHref;
182 }, newWindow);
183 deferredResult.callback();
184 }
185 },
186
187 //-------------------------------------------------------------------------
188
189 'compareRecords': function(a, b) {
190 return MochiKit.Base.compare(a.label().toLowerCase(), b.label().toLowerCase());
191 },
192
193 'logo': function() {
194 var result;
195
196 if (Clipperz_IEisBroken == true) {
197 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) {
198 result = "<span><span class=\"clipperzLogoSpan\">clipper</span><span class=\"clipperzLoggoZSpan\">z</span></span>";
199 } else {
200 result = "<img src=\"./images/exportLogo.png\" />";
201 }
202 } else {
203 result = "<img src=\"data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAANYAAABOCAIAAADTtH9XAAANIWlDQ1BJQ0MgUHJvZmlsZQAAeJyV13k0lG8bB/BrFsYyZhhjDyO77LKHLJFItmwp2bdhJiZRypIUIkso2iiSFC0kEtWPLCHJkq2oyJI9kmXeP6R6f+f9ve95rz+ecz3385xz389zzud7nxsAr+FKpZKRABAQSAuyNjEgOTg6kTBdgAJewAEzaLi6B1P1LS3N4R9roRMQAADtcq5UKvmf3/uPhQtycHQCQMgCANF7vd8OAES39d4WAIhHaFQaAMIHAIjuPq4eAIhwAJANsrU2BEAUAADOe70vBwCc23pfDwC4EHdvGgCiG4CREOjhGwiAmQBg1PXwDHYHwMkCgIdHsHsAAC4ZACwCAigeALgPACDlTg2iAeCZAEDOwdGJtL7kffEAW/kAmMx+jx1JByjNAZDa/XtM9BEAtytAbuLvsTlrQAAAgrs12EtFGQAAEFgDAIYBOn1OAgCTCrCaQqcv59Lpq9cBUH0ANWT3w0EhP/8XAtEM8L/u17/5Z6EQAEgAhBgiH3kUFY4OZzjBGImJZjrJbMRcy3Ka9Qw2ju0srozdhyOFkMKZSjzPlc6dzpPJW8tPEcjelC14WaiedFgkd/N10VbxYxL5km3SJ2Rub+mUi5a/o9CjdFr5vsp71bNqZeqDmklaFdrDOmm6T/XG9DMMnhtO7sgyrjOZNb26q9FsYXeuRcue15avrdqsV2wL93bYddp3OXQ7offdc+7b339gwOX9wQ9uWPfHHp88P3sNe4/4fPEd9eciPwv4GjhJmaJOH5oJmg2ep80f/haycGQx9HvY0tEfx1bCV46vRkhHdkQjTiJjUKfQsQynGc9g4pjimRNYzrImYpPYzuGS8SnsqRxphPOc6cQMrkzuCzwXebP4svkvCVzedEXwqtA14RxSrsj1zTdE88TyxW9KFkjekiqUvi1ze7yIfEf2rlyxQoniPaX7Sg+UH24tVS1TK1t4FFKu/lijQqtS+8m2qm1PdZ6uVUfU6D3b/lz/hcFfhrXo2pi6HS+N600aTBtNm1iaEl6ZNZu3WLTiWs+9tmyzemPdTmhPfWvTYdu5t4u7K7Pb/p1Dj1Mvf292n3O/88D+90Lvr35wGTw4JDKU+9Htk/tnj2Hx4fwRry/eoz5j0mOF434T/l/Jk3KTd6cCpykz1Fml2ftzQfPB32gLqgtliyHfQ5fCfoQtay1XrhxbDV/TWXtKpwMgRJE45DSqCX2bIY0xHOPNZMtsyLKVVRIrycaL48HzsvNycBEkOKWIGlzm3Ad4gnmT+Ir5mwRGBTmF1IS9SRdEXooixHTED0nck5ySlpIhb6mUQ8nrK6QoDipLq8Ru7VKTUadq1GrxaIdue6XLrUfZ/txAzPCYUZuxkEnozirTJTMlc8/d6RZtljgrE+tQmzzbt3Ys9tsdDjledqrbN7Vf+MAel6MHc11r3UY9uDz1vBy8T/hc863x6/dfCuAM3EIxovocCg9KDs6llR6uD+k9Mha6cBR1jCOcdFz2hGrE9kizqD3R+04ejPE8RY6lnQ46ExkXGX8yIe5samJCUta5i8mZKSmpl9JSz2ekX8goyLx54e7Fgqzb2cWXnlx+cqX26qtrbTntue3X22/05n3KH7k5VPD51lThzO2posk7s3enisdLJu6N3B98MPSwp7StrOFRTfmjx8UVlypTn0RWBTzdV21Ws+2ZzHPC86UXH/5qrH1Yl/YyqN6mQa1RoJHe1PPqYXN8i1OraOvw6wdtx9/saMe197+91uHXqdK52tXcnfZuf490z1xvRV90v9kAcWDg/a0PwYPaQ+ihxo/nPx34LPl5YrhiJOrLrlGu0f6xG+PkCdWJta8Nk6lT+6bFpidmHsyGz5nME+a7v+UtUBY1v6O+v1xK+bFvWXT560rZauSaKZ2bTgeAk4hQ5FGUNqoCfZxBj6GaMQpzismYqZY5luU0azx2F7aJLRGXiE9i38PeypFMSOVMI6Zx2XK95c7gyeC9wJfFny2QvemSoLNgv9BV4WukHJGczTmi18VuiOdJ5EvelCqQviXjKzO2pVC2SO6O/F2FYsUSpXvK91UebH2oWqZWpl6mEarxXbNCq0K7ctsTnSrdE7pretXba/SfGTw3fGEUswO9o9a4zuTlznrThl2NZgnmWPNXu5stWva0WiZbsVu1Wb+xabd9u7fTLsOe277LodvxnVPPvmxnAee+/f0H3rt8OPjBNcdNxG3I/aPHJ8/PXvneEusJ4jfmf5ssS574txSZ+5Ui5WEaYUtHfxxbDl85vnpiLYIeBdHIX0mCOYOJY4priN+VwHoWm4hNYjuHT2ZP4fiVJdyZPBd4f2bJpj+zJHfouvsN0TyxfImbEhtpUiR7R+6u/B9ZolK6tUz1kXq5+mONCs1K7SfaVdue6lbr/pEjO+qMXxrXmzTsbDRtMnsV0rK51eK1ZZvlG6v24x0ynXZd9t3RPQq9Tn2xAyrv4wZVh85+8hjWHkkZ9R33+0qeoszEzzstnFtKWLWm0wHW9z4AAEY1gIwtAHZZADa5ALFbACRdALgLACzZAGw1AckgBEgdKiB26WzsH4AAdhAEeTAARwiGZCiB7wgSwgwRiihAtCBGkHikCTIKWYVcQemgolB1qBW0CNoRnY/+xmDMcIqhmGGK0YQxh3EYw4VxxlQxYZg0mWKYxpm1mCnMNSxyLJEs5aw41ijWd1giNhD7hW0H20m2QZwr7jkehffCT7BbsWewr3LEccwStAh5nOqceZxTRBfiIpcvVxn3Fu6XPF68GN5CPnG+I3zz/JcFTATmNl0TFBMMF0IIlQr7kURIPSLnN2/eHCmKF20VSxHfK8EvMSR5W8pQ6pa0gQyHzOCWB7Kn5ZzlVRSwCiOKfynlKkereGw1UZVV41RbUR/WyNTEadZolWjnbDuvc0Y3Qu/I9kP6ZANfQx8jnx3+xoEmtJ3HTGN2nTPLNr+1u9yiYU+f5Yw1xkbIVmOvjR3VPsnhruNrpzln3v26B7xckg9Wun5x5/Ew8QzzKvLl9bP0jyfXBiIp+tSoQy+CGWlmh1NDxcIoR5+Esxx3OlEUQY+yjUGeco59dIYz7lB8W2J60lKyS0pdmsL5rMzgCx+zbLJrr9y9Jp5z+TpPPvvNpFu4wnN3MosFS27clys1Kmsrd308U8XztKjG4AWtFl9XVL+rKb5ZrqXtdUh7XQe1S6C7vk+iv/t9/KDep6Jhjy/Coz1f7aa4p7tms+ZdFieWSpcj6Lx0OgAggQV4QBr0wAEOQzqUwwACg1BEuCCSENWIOaQM0gWZhXyLwqN2o86imtFs6D3odHQvA4nBl6GE4TujIeM5xncYccxhzAsmApMHUzkzK7Mz810WNMsBloesLKzurNVYLiwV28wmw5bINoEzxxXj2fAUfCf7dvYbHDiOEI5egjHhHieJM5VzjRhM/MrlxzXGTeae5aHxLPAe5UPwneXn5y8U0BSo22S3aVQwUohPqEzYSniMFCsiIVK/OVCUR/SpmLs4VvyZRKCksOQbqThpA+lVmcot4bI6soty1fJnFGwVRRSnlKqVU1T8thqpCqkuq3WoP9a4rBml5a1tv01HR0FXRI+wHa2P0p81mDGcMhrfMWw8ZzK+89supBnRnGe3koXunj2W1lb+1mE22bb3976y67VfcSQ6KeyzcD60/+KBWpcRV2Y3RXcfjyzPaq9pH2lfT79M/44AgcC9lGzqlyCp4BBaQ4jgkeDQxqOix5LCx044RtRHqUXnxRBOJZ0mnMmI503ITlRNakn2TPmRlpiunvH5wpUsv0t7r0hfY8iZuP48r/TmxVuxt93vOBcb39N4sLVU/pHcY6lK8SqpasVnei921lq9JDccakppvtb6pG2gnd4p3K3T49GXMFDxYeIj32eDkcjRgvFPk/zTXrNX5ocXpZYCl8vWEHQ6ADACOwiCAThCMpTAmw37G+7X1aPxaEf0NwZjhqyf3tcwzkzCTDFM48y2zDUsciyXWHGsUayL2EDsFzYPnCvuI94LP8EezL7KEUfgJuRxqnM2El2Ii1zJv0xb8M3/9GwphBAq/WnZal3yT8ch0gZ/Gv4t+KffN5o1WiW/7f6W+89u/5ta70FfXj/Lv6sN6fm72+jCP+WeVf4tN4Nxw+5lzQ29N9I2/BYRNgQ/KN8wXHlyXfGzng3HDaNN8a/+as5oaXsd8kawva6D2lnSFdtd3xPSJ9HvP2D0Pn5Qb+j0R7dPRZ8Xhtu/CI/6j5mOS01gvtpN5k/FTnvP7JyVmWOdm5x//e3BQsai7eLE95glgx+SP4aXI1Z4V66scqzGrC6u3aAn0OkA6+clAABgMaSQKUEkc0Oj//Ow978qgHx4Yw4kAGA9A/faAAABAKR8aaa2AEAEAC0wBAqQgQJBQAJzMASjn1cSuP964guwfpYDAGBkB7hkDwBQ/f1Y5N/npXmG0gAADCnUsCBfbx8aSZ9KJXuSDCkB1MM0zyBZkmmgu7wsSVlRURUA4F93RgACxGzQPQAAAAlwSFlzAAALEwAACxMBAJqcGAAAC25JREFUeJztnHlUE9cex38JYY2JGhQ14Hae1BSXKoK4C0UtbtRqRUWlomi1NK5Y6tKKQpG2qK0pWo8oPp+ix+rRFlCPyxEVV9TXpx7klOdxKQFERQ1CWMLM+wMfDZk7k5nJMsHez8k/+d3f/d1fJt+5d+6SiEiSBAxGOMRCJ4D5u4MliBEYLEGMwGAJYgQGSxAjMFiCGIHBEsQIDJYgRmCwBDECgyWIERgsQYzAYAliBAZLECMwWIIYgcESxAgMliBGYLAEMQKDJYgRGCxBjMBgCWIEBksQIzASoRN4w+93X25YpWkl8zCyifr37bDsy5mcfDAtDkeRYFFRmVZbbmKsrixeBjM5+WBaHI4yEJNg/ufMbHwwLQ5HkSDmb0uLl6BM1kroFDAW0ZIkqNfXU43FJU/snwnGijjKdIQNUTP6hoelmhjdXEWCJIOxFi1JgiIRtFW4Cp0Fxsq0pIEY81ZitV5QV0nmZOUfz877o/CBkZlQqbpMmDB0TJh/a4UHbWV2NBBQ/PiFi4uzkU3k7ka2UTSbkehr4GnZC2cjt/q6ui7d2gKIAOB5heHg/tyjR85W6l43JRkYqPpkTlhAUA+RmHZYt1FYJNoS/bEjl86culqi/etJVy53DwsLipg+onO39szVmVMFgCfl9ds0x07kXGh8HxTos3VHPAmkqP4uiC0YZ5ze4VFJZPn/CxaX1EVFrqv669LTYUhPX9HHvwey7NDRe5sSt5kYO3s7H87a3PT2n5m3t6XuNPGRy+tO5+4wtiDdzp5Z79FW8WF4crm2lCHFz2PHzZ43Fllko7AmXLqiXRqbYm5sMqSlqQMG+9EVI1PNyV7bTtmhpg6mTjHNtvE6G8iHkp+6s0mSFnUDj3HV0oE4OeXklAkrWOgPACQxMT9GRyYBSfBry93dmWr0UXZg4/bgYfWAAWpmoQDAT2nHRwerkRnaKGwTBgImTkxebl5/ACCJjd2++FPTmRlzqq1kHroqGDGINlsnEaKWHbBIgtMjt/56KIdTlYLCJ0EDFvBWIZXKSjbqh5iYb13YBdTpYHTIEpatWytsTR0MCjAvZWOu5T/6eOIXrN2JoiJd8HC1Ay4f8Jfg0hUHHxQW8arqHj3za97t2gGdDhZ/utFuYQkShg5SO3EP+KdWv3rFD+x8xTExKcL0cubgKcF7RdVXzl2iKw0J6bciLnLs+BF0DgWFr67k3uDXtOXI5a5zosctip3aybsTnc+1/JJnHBe9eYddHneQblYYGKj6LHby8rjZdDHPnrtfdPc+pzzpaCARK/92gOeMeMa0eOTEKXx8/zUb5v5/4gXrEqfuz7ylSc2gen6dsOt0bgC/1i3AkJX9jZdS0fhmzrwRryrh/ZFq5FVYGafJyEyyddjyCkDezEGBXX9IWyaWvOkcp0UOLC6p/2jCcmqfMSsq8dqtPezybIa3dzsSxFptuUzmAQASUTdQmx5EMkICUA0aH8aQfHo0PhJ8XNKA1F9oiO+axLnGFhHArEj/1/r6jLR9Js46HQkkASJ7LkwaLl3eLHFzNza1lsG1G5qgAIRcCgpfNNTVObmYfdizKOyqVbuoEUNDfJM3LTYx+iidcy9rQoZQn+dkL8sr2ngpzOX5hs7erXfsivf0kqEKmZZ7nh+f5MlQrK5imYAJfBSwadMvKHNt8iY10j9qdhBq4cf55dOXPFrnzfa0hSZCaUQihqPZW1A1xKdy8mwattYAd/J/pzjUJ6d+jmxL6gbhEROo9j27s8zm2Uj4+D6Hs5Jo9MeELi/S8/4F2mJ1OQDPdV8+EryIGjji46Y0rXya4OECfQPfk8ulMqMXAOHqbs/dtlr/wX3pyrooJa5yxImbQ7/k2jTsvUId9ZLFRAczDA6fxX5ANR44dAlYHKaUyw1rEheYdaNSdS9B/u8DtMULbzN3n8xwHoiratB1RocFMdRK3xHDtSHrEhriR3eHNKJe8klqYpqdw2ZlX6Ea0zMudvTp+bxCh6pB3ClATpKcSEODSGLm20zfGc/sgISoyJKeWU9bPPM3cO7DI2wTnCX4SkeiLnm9rK3ckjxszfBhtH1VIyNHqlITTY0FhcUAJIPILAx75dJNVCVxUuJu5rAUJM/Kn7enrNI3R9/VtyvHsAD1d8T7w2lLx34HiomcYzaH80AskSC/DwOIHHDV0xh+8x4XMLOBaVFYpRnRcMBZYmbVz0/VkbnDpkKCFn6mv8f6z4AeKzkFRML5Crq7Ih46eHw8O+PX27LdT9uElbZCzGNsRGVlNSd/EqprGZZglO/BsExLcwIAHhKsrEIMxAWF5WwehwXkZn6BA4YtK31mrUwMBjMLy5EzRrOPRgDxTCN1oyt2bwNTqBN5nljrsJYYSNLhx2ImDAa02cIPxSNsUKDyx+2rDAYOtzRBgCutXvhQlu6pZCiOeW7FtjhLsJUUee2cn5U+bUf/ZLNFc/FgxiETY0rytJCwYVwT4EfmgbOTI5mOS2VlXaca/VRK5gcMC8OGhAZlUPbZgwa+KxKDs4tg9/OTI/2UevolW3WVdU86c44llwKyx9+39yRDrb0U/QFAn76+XFvnzZ9aPVFXx+Dwc9q/UGYzJ3osDDsqtB+1bGvaMeZGCQJqa0jjV4PBaiePKvIiO5T8h7ZYXcx7CZoOPnL+YHwo1Xjg0HVDjR7pX1IOqE0ug6dXGx6t80WckriHruzClTLkNtyCBZNsGrZbF1eUdmSPih4xNBkQoB4xZLHxK2zUInN5sqL6v98rGJag5+cDeFulIWP4SHDZMuQXIx46ZBF1UlJvgAlhiI27zt5SkcSuv0X6NefOiaPnqfbScmJl7DeoGobBIxC9lBXDSsQQirqfI6al6GkmsEtXZFJXXzYkzDebp1mIiiyPE/QHEOdeBDebHCvhMx3xUkA3le9DxGFBWZD/or171/Ts1RlEQBCQe+HhquWbkAtW69cLsF+SkHj4+MmbSRsXNv6QpaYG9u2/vDMNfd+HhviCmNX1sSTsV2smncs5S/GSBI+Mnxs9Jnr+OBc3JwAgCLh6rXhJ7LeoPqN28Eh/NnkyQAJZtT+caef48RmoRD5UNGfgDvM+zeE5I965c/Ho4chDCc5RUd+ZrS6XG3r5q/g1bSHX8x+MGcVqn2rdhoV2CCt1g+nRHx/MOEz13J1xanfGKWMLcsxKSZ5jlQNH6Ll7Ewx7dMYM3M51aOWZulwKSZt5r4wTJ05uNu8lKAlfTXGVWvm5my7sMvVI5GkGNvip2oaEDbE4LyHhf/eMDu6SmraaR8Xs7ATk6SYbw2HOOCNi4NiPgu0Z9nzuxvb0Z63pkMshI5Nd5+TAWNSBDx/cKfvM1gbW/n6qDpevbm6vRB7sYbMMxn+pLCV5RvYZDRvPL+I+XPrlbDuHFQFkZ62eH8vhjxInju9/OldjxX1Rof5Yw9JniPYK0Y1bmm3pazt6M+24v6vq9Fv2+ozMtU4u6N30jh0RCzQmu/hsfOh4UVHZXgF51zWTI8LofAID/3Hu/PdTIkexCWiLsDHzBuVe1syKnsS8MTItYnje5S1rmx9QN8YddRATaTTGzLMgWzjfElb4KXsTBAFlZdVFf2hfvdC5uruVasu9vT1VKh+fLgp7ns9H/io+Pm5c0zYGSUJpafWd2w9q9TXV+jpPhZRNkjYKS0dVFfnwwVNt8dMafTUJkhq9vnt3r3d6erdRuDn4iRCuWLP3FYtBqfRQKpv2PHpZMbgVEYka87RyetYNK5WKevX26tXbyyrRHBn8t0YYgcESxAgMliBGYLAEMQKDJYgRmLdQgno90wE+RwuLaUn/Nc2S4UN8n0a8LzXain1dVeMf2Nsxw2KsuTSNwfDgLRyIMS0LLEGMwGAJYgQGSxAjMFiCGIHBEsQIDJYgRmCwBDECgyWIERgsQYzAYAliBOZ/jys2NWyvP3gAAAAASUVORK5CYIIK\" />";
204 }
205
206 return result;
207 },
208
209 'progressWidth': function() {
210 return this._progressWidth;
211 },
212
213 'updateProgress': function(aProgressComponent, aPercentage) {
214
215
216 },
217
218 //-------------------------------------------------------------------------
219
220 'printAllData': function(anEvent) {
221 var newWindow;
222 var allRecords;
223
224//MochiKit.Logging.logDebug(">>> printAllData");
225 newWindow = window.open("", "");
226 newWindow.document.write(
227"<html>" +
228"<header>" +
229 "<title>Clipperz export data</title>" +
230"<style>" +
231"#exportedData {" +
232 " width: 600px;"+
233"}" +
234".ext-mb-progress-wrap {" +
235 "border:1px solid #6593cf;" +
236 "margin-bottom: 10px;" +
237 "width: " + this.progressWidth() + "px;" +
238"}" +
239".ext-mb-progress {" +
240 "height:18px;" +
241 "background:transparent url(./images/default/basic-dialog/progress2.gif) repeat-x 1px 1px;" +
242"}" +
243".ext-mb-progress-bar {" +
244 "height:18px;" +
245 "overflow:hidden;" +
246 "width:0;" +
247 "background:#8bb8f3;" +
248"}" +
249"body {" +
250 "font-family: sans-serif;" +
251"}" +
252"div#logo {" +
253 "border-bottom: 1px dotted #aaaaaa;" +
254 "margin-bottom: 15px;" +
255"}" +
256"div.recordBlock h2 {" +
257 "font-size: 14pt;" +
258 "margin: 0px;" +
259 "padding: 0px;" +
260 "border: 0px;" +
261 "color: #666666;" +
262"}" +
263"div.recordBlock div.recordNotes p {" +
264 "margin: 0px;" +
265 "padding: 0px;" +
266 "border: 0px;" +
267 "color: #aaaaaa;" +
268 "font-size: 10pt;" +
269 "line-height: 18pt;" +
270 "border-left: 1px solid #aaaaaa;" +
271 "padding-left: 10px;" +
272"}" +
273"div.recordBlock dl {" +
274 "margin: 0px;" +
275 "padding: 0px;" +
276 "border: 0px;" +
277 "color: #999999;" +
278 "padding-bottom: 10px;" +
279 "border-bottom: 1px dotted #aaaaaa;" +
280 "margin-top: 10px;" +
281 "margin-bottom: 15px;" +
282"}" +
283"div.recordBlock dl dt {" +
284 "display: block;" +
285 "float: left;" +
286 "min-width: 100px;" +
287 "white-space: nowrap;" +
288 "overflow: hidden;" +
289 "margin-right: 10px;" +
290 "font-size: 10pt;" +
291 "line-height: 18pt;" +
292"}" +
293"div.recordBlock dl dd {" +
294 "color: #666666;" +
295 "font-size: 10pt;" +
296 "line-height: 18pt;" +
297"}" +
298"" +
299"</style>" +
300"" +
301"<!--[if IE]>" +
302"<style>" +
303"div.recordBlock dl dt {" +
304 "width: 100px;" +
305"}" +
306"</style>" +
307"<![endif]-->" +
308"" +
309"</header>" +
310"<body>" +
311 "<div id=\"logo\">" + this.logo() +
312 "<div id=\"progressWrapper\"><div class=\"ext-mb-progress-wrap\"><div class=\"ext-mb-progress\"><div id=\"progress\" class=\"ext-mb-progress-bar\">&#160;</div></div></div></div>" +
313" </div>" +
314"</body>" +
315"</html>"
316 );
317
318 anEvent.preventDefault();
319
320 allRecords = MochiKit.Base.values(this.user().records());
321 allRecords.sort(this.compareRecords);
322
323/*
324 deferredResult = new MochiKit.Async.Deferred();
325 MochiKit.Iter.forEach(allRecords, MochiKit.Base.partial(function(aDeferredResult, aWindow, aRecord) {
326 var printerRecord;
327
328 printerRecord = new Clipperz.PM.Components.Printing.Record({record:aRecord});
329 aDeferredResult.addCallback(MochiKit.Base.method(printerRecord, 'deferredDrawToWindow', aWindow));
330 }, deferredResult, newWindow));
331 deferredResult.callback();
332
333 return deferredResult;
334 */
335
336 MochiKit.DOM.withWindow(newWindow, MochiKit.Base.bind(function(someRecords) {
337 var currentWindow;
338 vardeferredResult;
339 var progressBar;
340 var progressWrapper;
341 var i, c;
342
343 currentWindow = MochiKit.DOM.currentWindow();
344 progressBar = MochiKit.DOM.getElement('progress');
345 progressWrapper = MochiKit.DOM.getElement('progressWrapper');
346
347 deferredResult = new MochiKit.Async.Deferred();
348 c = someRecords.length;
349 for (i=0; i<c; i++) {
350 deferredResult.addCallback(function(aWindow, aRecord) {
351 var printerRecord;
352
353 printerRecord = new Clipperz.PM.Components.Printing.Record({record:aRecord});
354 return printerRecord.deferredDrawToWindow(aWindow);
355 }, currentWindow, someRecords[i])
356 deferredResult.addCallback(MochiKit.Base.bind(function(aProgressBar, aProgress) {
357 MochiKit.Style.setElementDimensions(aProgressBar, {w:aProgress * this.progressWidth()});
358 }, this, progressBar, ((i+1)/c)));
359 deferredResult.addCallback(MochiKit.Async.wait, 0.2);
360 }
361
362 deferredResult.addCallback(function(aWindow, aProgressWrapper) {
363 MochiKit.DOM.replaceChildNodes(aProgressWrapper);
364 MochiKit.Style.hideElement(aProgressWrapper);
365 aWindow.stop();
366 }, currentWindow, progressWrapper);
367
368
369 deferredResult.callback();
370 }, this, allRecords));
371 },
372
373 //-------------------------------------------------------------------------
374
375 'exportAllData': function(anEvent) {
376 // vardeferredResult;
377 var newWindow;
378 var allRecords;
379
380//MochiKit.Logging.logDebug(">>> printAllData");
381 newWindow = window.open("", "");
382 newWindow.document.write(
383"<html>" +
384"<header>" +
385 "<title>Clipperz export data</title>" +
386"<style>" +
387"#exportedData {" +
388 " width: 600px;"+
389"}" +
390".ext-mb-progress-wrap {" +
391 "margin-top:4px;" +
392 "margin-bottom: 10px;" +
393 "border:1px solid #6593cf;" +
394 "width: " + this.progressWidth() + "px;" +
395"}" +
396".ext-mb-progress {" +
397 "height:18px;" +
398 "background:transparent url(./images/default/basic-dialog/progress2.gif) repeat-x 1px 1px;" +
399"}" +
400".ext-mb-progress-bar {" +
401 "height:18px;" +
402 "overflow:hidden;" +
403 "width:0;" +
404 "background:#8bb8f3;" +
405"}" +
406"</style>" +
407"" +
408"<!--[if IE]>" +
409"<style>" +
410"</style>" +
411"<![endif]-->" +
412"" +
413"</header>" +
414"<body>" +
415 "<div id=\"logo\">" + this.logo() + "</div>" +
416 "<div id=\"progressWrapper\">" +
417 " <div class=\"description\">" + Clipperz.PM.Strings['exportDataInProgressDescription'] + "</div>" +
418 " <div class=\"ext-mb-progress-wrap\"><div class=\"ext-mb-progress\"><div id=\"progress\" class=\"ext-mb-progress-bar\">&#160;</div></div></div>" +
419 "</div>" +
420 "<div id=\"textareaWrapper\">" +
421 " <div class=\"description\">" + Clipperz.PM.Strings['exportDataDescription'] + "</div>" +
422 " <textarea id=\"exportedData\" cols=\"80\" rows=\"20\">[</textarea>" +
423 "</div>" +
424"</body>" +
425"</html>"
426 );
427
428 anEvent.preventDefault();
429
430 allRecords = MochiKit.Base.values(this.user().records());
431 allRecords.sort(this.compareRecords);
432
433 MochiKit.DOM.withWindow(newWindow, MochiKit.Base.bind(function(someRecords) {
434 var currentWindow;
435 vardeferredResult;
436 var textareaWrapper;
437 vartextarea;
438 var progressBar;
439 var progressWrapper;
440 var i, c;
441
442 currentWindow = MochiKit.DOM.currentWindow();
443 textarea = MochiKit.DOM.getElement('exportedData');
444 textareaWrapper = MochiKit.DOM.getElement('textareaWrapper');
445 MochiKit.Style.hideElement(textareaWrapper);
446 progressBar = MochiKit.DOM.getElement('progress');
447 progressWrapper = MochiKit.DOM.getElement('progressWrapper');
448
449 deferredResult = new MochiKit.Async.Deferred();
450
451//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("exportAllData - 1: " + res); return res;});
452 c = someRecords.length;
453 for (i=0; i<c; i++) {
454 deferredResult.addCallback(MochiKit.Base.method(someRecords[i], 'deferredData'));
455 deferredResult.addCallback(MochiKit.Base.method(someRecords[i], 'exportedData'));
456 deferredResult.addCallback(MochiKit.Base.bind(function(aTextarea, aProgressBar, aProgress, someRecordExportedData) {
457 aTextarea.value = aTextarea.value + "\n" + someRecordExportedData + ",";
458 MochiKit.Style.setElementDimensions(aProgressBar, {w:aProgress * this.progressWidth()});
459 }, this, textarea, progressBar, ((i+1)/c)));
460 deferredResult.addCallback(MochiKit.Async.wait, 0.2);
461 }
462//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("exportAllData - 2: " + res); return res;});
463 deferredResult.addCallback(function(aTextareaWrapper, aTextarea, aProgressWrapper) {
464 aTextarea.value = aTextarea.value.slice(0, -1) + "\n]";
465 // MochiKit.DOM.replaceChildNodes(aProgressWrapper);
466 MochiKit.Style.hideElement(aProgressWrapper);
467 MochiKit.Style.showElement(aTextareaWrapper);
468 aTextarea.focus();
469 aTextarea.select();
470 }, textareaWrapper, textarea, progressWrapper);
471//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("exportAllData - 3: " + res); return res;});
472 deferredResult.addBoth(function(aWindow) {
473 aWindow.stop();
474 }, currentWindow);
475//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("exportAllData - 4: " + res); return res;});
476
477 deferredResult.callback();
478 }, this, allRecords));
479 },
480
481 //-------------------------------------------------------------------------
482
483 __syntaxFix__: "syntax fix"
484
485});
486
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/LoginPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/LoginPanel.js
new file mode 100644
index 0000000..84b2475
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Panels/LoginPanel.js
@@ -0,0 +1,1114 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; }
33
34
35Clipperz.PM.Components.Panels.LoginPanel = function(anElement, args) {
36 args = args || {};
37
38 Clipperz.PM.Components.Panels.LoginPanel.superclass.constructor.call(this, anElement, args);
39
40 this._showLoginFormAnimator = null;
41 this._showRegistrationFormAnimator = null;
42 this._shouldShowRegistrationAlert = true;
43
44 this._visibleForm = null;
45 //this._isPassphraseVisible = true;
46
47 Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler');
48
49 this.render();
50
51 return this;
52}
53
54//=============================================================================
55
56//MochiKit.Base.update(Clipperz.PM.Components.Panels.LoginPanel.prototype, {
57YAHOO.extendX(Clipperz.PM.Components.Panels.LoginPanel, Clipperz.PM.Components.Panels.BasePanel, {
58
59 'toString': function() {
60 return "Clipperz.PM.Components.LoginPanel component";
61 },
62
63 //-------------------------------------------------------------------------
64
65 'render': function() {
66 var result;
67 varlayout;
68 var registerButton;
69
70 MochiKit.Signal.disconnectAllTo(this);
71 this.element().update("");
72
73//MochiKit.Logging.logDebug(">>> LoginPanel.initPanel");
74 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', id:this.getId('baseDiv'), cls:'LoginPanel', children:[
75 {tag:'table', children:[
76 {tag:'thead'},
77 {tag:'tbody', children:[
78 {tag:'tr', children:[
79 {tag:'td', valign:'top', children:[
80 {tag:'div', cls:'clipperzServiceDescription', htmlString:Clipperz.PM.Strings['clipperzServiceDescription']}
81 ]},
82 {tag:'td', valign:'top', align:'right', children:[
83{tag:'div', id:this.getId('forms'), cls:'clipperzLoginForm', children:[
84 {tag:'div', id:this.getId('loginForm'), cls:'loginForm', children:[
85 {tag:'div', cls:'loginFormHeaderBox', children:[{tag:'h3', htmlString:Clipperz.PM.Strings['loginFormTitle']}]},
86 {tag:'form', id:this.getId('loginForm_form'), autocomplete:'off', children:[
87
88 {tag:'table', cls:'formLayout', children:[
89 {tag:'thead'},
90 {tag:'tbody', children:[
91 {tag:'tr', cls:'formFieldTR', children:[
92 {tag:'td', width:'90', htmlString:Clipperz.PM.Strings['loginFormUsernameLabel']},
93 {tag:'td', children:[
94 {tag:'input', id:this.getId('login_username'), cls:'loginFormField', type:'text', name:'username'}
95 ]}
96 ]},
97 {tag:'tr', cls:'formFieldTR', children:[
98 {tag:'td', htmlString:Clipperz.PM.Strings['loginFormPassphraseLabel']},
99 {tag:'td', children:[
100 {tag:'div', id:this.getId('passphraseDIV'), children:[
101 {tag:'input', id:this.getId('login_passphrase'), cls:'loginFormField', type:'password', name:'passphrase'}
102 ]},
103 {tag:'div', cls:'oneTimePassword', id:this.getId('oneTimePasswordDIV'), children:[
104 {tag:'input', type:'text', id:this.getId('oneTimePassword_1'), name:'passphrase'},
105 {tag:'span', html:'-'},
106 {tag:'input', type:'text', id:this.getId('oneTimePassword_2'), name:'passphrase'},
107 {tag:'span', html:'-'},
108 {tag:'input', type:'text', id:this.getId('oneTimePassword_3'), name:'passphrase'},
109 {tag:'span', html:'-'},
110 {tag:'input', type:'text', id:this.getId('oneTimePassword_4'), name:'passphrase'}
111 ]}
112 ]}
113 ]},
114 {tag:'tr', cls:'formFieldTR', id:this.getId('passwordTypeChooserTR'), children:[
115 {tag:'td', valign:'top', align:'right', children:[
116 {tag:'input', type:'checkbox', cls:'passwordTypeCheckbox', id:this.getId('useOneTimePasswordCheckbox')}
117 ]},
118 {tag:'td', children:[
119 {tag:'div', cls:'passwordTypeChooser', children:[
120 {tag:'h4', htmlString:Clipperz.PM.Strings['loginFormOneTimePasswordCheckboxLabel']},
121 {tag:'span', htmlString:Clipperz.PM.Strings['loginFormOneTimePasswordCheckboxDescription']}
122 ]}
123 ]}
124 ]},
125 {tag:'tr', children:[
126 {tag:'td'},
127 {tag:'td', children:[
128 {tag:'div', id:this.getId('login_submit')}
129 ]}
130 ]}
131 ]},
132 {tag:'tfoot'}
133 ]}
134 ]},
135
136 {tag:'div', cls:'loginFormFooterBox', children:[
137 {tag:'ul', children:[
138 {tag:'li', id:this.getId('showRegistrationLI'), children:[
139 {tag:'span', htmlString:Clipperz.PM.Strings['loginFormDontHaveAnAccountLabel']},
140 {tag:'a', href:'.', id:this.getId('showRegistration'), cls:'clipperzActionLink', htmlString:Clipperz.PM.Strings['loginFormCreateOneLabel']}
141 ]},
142 {tag:'li', children:[
143 {tag:'span', htmlString:Clipperz.PM.Strings['loginFormForgotYourCredentialsLabel']},
144 {tag:'a', href:Clipperz.PM.Strings['loginFormAarghThatsBadUrl'], target:'Clipperz_Help', htmlString:Clipperz.PM.Strings['loginFormAarghThatsBadLabel']}
145 ]},
146 {tag:'li', children:[
147 {tag:'span', htmlString:Clipperz.PM.Strings['loginFormAfraidOfMaliciousScriptsLabel']},
148 {tag:'a', href:Clipperz.PM.Strings['loginFormVerifyTheCodeUrl'], target:'Clipperz_Help', htmlString:Clipperz.PM.Strings['loginFormVerifyTheCodeLabel']}
149 ]}
150 ]}
151 ]}
152 ]},
153
154
155
156 {tag:'div', id:this.getId('registrationForm'), cls:'registrationForm', children:[
157 {tag:'div', cls:'loginFormHeaderBox', children:[{tag:'h3', htmlString:Clipperz.PM.Strings['registrationFormTitle']}]},
158 {tag:'form', id:this.getId('registrationForm_form'), children:[
159 {tag:'h5', cls:'errorMessage', id:this.getId('registration_errorMessage')},
160 {tag:'table', cls:'formLayout', children:[
161 {tag:'thead'},
162 {tag:'tbody', children:[
163 {tag:'tr', cls:'formFieldTR', children:[
164 {tag:'td', width:'90', htmlString:Clipperz.PM.Strings['registrationFormUsernameLabel']},
165 {tag:'td', children:[
166 {tag:'input', id:this.getId('registration_username'), cls:'loginFormField', type:'text', name:'username'}
167 ]}
168 ]},
169 {tag:'tr', cls:'formFieldTR', children:[
170 {tag:'td', htmlString:Clipperz.PM.Strings['registrationFormPassphraseLabel']},
171 {tag:'td', children:[
172 {tag:'input', id:this.getId('registration_passphrase'), cls:'loginFormField', type:'password', name:'passphrase'}
173 ]}
174 ]},
175 {tag:'tr', cls:'formFieldTR', children:[
176 {tag:'td', htmlString:Clipperz.PM.Strings['registrationFormRetypePassphraseLabel']},
177 {tag:'td', children:[
178 {tag:'input', id:this.getId('registration_repassphrase'), cls:'loginFormField', type:'password', name:'repeat-passphrase'}
179 ]}
180 ]},
181 {tag:'tr', cls:'formFieldTR', children:[
182 {tag:'td', align:'right', valign:'top', children:[
183 {tag:'input', id:this.getId('registration_check'), type:'checkbox', name:'safetyCheck'}
184 ]},
185 {tag:'td', children:[
186 {tag:'span', htmlString:Clipperz.PM.Strings['registrationFormSafetyCheckLabel']}
187 ]}
188 ]},
189 {tag:'tr', cls:'formFieldTR', children:[
190 {tag:'td', align:'right', valign:'top', children:[
191 {tag:'input', id:this.getId('registration_termsOfServiceCheck'), type:'checkbox', name:'termsOfServiceCheck'}
192 ]},
193 {tag:'td', children:[
194 {tag:'span', htmlString:Clipperz.PM.Strings['registrationFormTermsOfServiceCheckLabel']}
195 ]}
196 ]},
197 // {tag:'tr', cls:'formFieldTR', children:[
198 // {tag:'td', htmlString:Clipperz.PM.Strings['registrationFormInvitationCodeLabel']},
199 // {tag:'td', children:[
200 // {tag:'input', id:this.getId('registration_invitationCode'), type:'text', size:'30', name:'invitationCode'}
201 // ]}
202 // ]},
203 {tag:'tr', children:[
204 {tag:'td'},
205 {tag:'td', children:[
206 {tag:'div', id:this.getId('registration_submit')}
207 ]}
208 ]}
209 ]},
210 {tag:'tfoot'}
211 ]}
212 ]},
213 {tag:'div', cls:'loginFormFooterBox', children:[
214 {tag:'ul', children:[
215 {tag:'li', children:[
216 {tag:'span', htmlString:Clipperz.PM.Strings['registrationFormDoYouAlreadyHaveAnAccountLabel']},
217 {tag:'a', href:'.', id:this.getId('showLogin'), cls:'clipperzActionLink', htmlString:Clipperz.PM.Strings['registrationFormSimplyLoginLabel']}
218 ]}
219 ]}
220 ]}
221 ]}
222]},
223 {tag:'div', cls:'loginPanelSwitchLanguageBox', children:[
224 {tag:'div', cls:'loginPanelSwitchLanguageDescription', htmlString:Clipperz.PM.Strings['loginPanelSwithLanguageDescription']},
225 {tag:'div', cls:'loginPanelSwitchLanguageSelect', children:[
226 {tag:'select', id:this.getId('languageSelector'), children:Clipperz.PM.Strings['loginPanelSwitchLanguageSelectOptions']}
227 ]}
228 ]},
229 {tag:'div', cls:'browserCompatibilityBox', htmlString:Clipperz.PM.Strings['browserCompatibilityDescription']}
230 ]}
231 ]}
232 ]}
233 ]}
234 ]});
235
236 MochiKit.Signal.connect(this.getId('loginForm_form'), 'onsubmit', function(e){e.stop();});
237 MochiKit.Signal.connect(this.getId('registrationForm_form'), 'onsubmit', function(e){e.stop();});
238
239 MochiKit.Signal.connect(this.getId('showRegistration'), 'onclick', this, 'showRegistrationFormEventHandler');
240 MochiKit.Signal.connect(this.getId('showLogin'), 'onclick', this, 'showLoginFormEventHandler');
241
242 new YAHOO.ext.Button(this.getId('login_submit'), {text:Clipperz.PM.Strings['loginFormButtonLabel'], handler:this.doLogin, scope:this, minWidth:0});
243 registerButton = new YAHOO.ext.Button(this.getId('registration_submit'), {text:Clipperz.PM.Strings['registrationFormButtonLabel'], handler:this.doRegister, scope:this, minWidth:0})
244
245 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) {
246 // this.getElement('showRegistrationLI').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
247 this.getElement('registrationForm_form').addClass('read-only');
248 registerButton.disable();
249 this.getElement('passwordTypeChooserTR').addClass('read-only');
250 this.getDom('useOneTimePasswordCheckbox').disabled = true;
251 }
252
253 MochiKit.Signal.connect(this.getId('loginForm'), 'onkeydown', this, 'onkeydown');
254 MochiKit.Signal.connect(this.getId('registrationForm'), 'onkeydown', this, 'onkeydown');
255 // MochiKit.Signal.connect(this.getId('useOneTimePasswordCheckbox'), 'onchange', this, 'renderPasswordField');
256 MochiKit.Signal.connect(this.getId('useOneTimePasswordCheckbox'), 'onclick', this, 'renderPasswordField');
257 this.renderPasswordField();
258
259 this.selectSelectedLanguageOption();
260 MochiKit.Signal.connect(this.getId('languageSelector'), 'onchange', this, 'switchLanguage');
261
262 MochiKit.Signal.connect(this.getId('oneTimePassword_1'), 'onkeypress', this, 'handleOneTimePasswordFieldKeyPress');
263 MochiKit.Signal.connect(this.getId('oneTimePassword_2'), 'onkeypress', this, 'handleOneTimePasswordFieldKeyPress');
264 MochiKit.Signal.connect(this.getId('oneTimePassword_3'), 'onkeypress', this, 'handleOneTimePasswordFieldKeyPress');
265 MochiKit.Signal.connect(this.getId('oneTimePassword_4'), 'onkeypress', this, 'handleOneTimePasswordFieldKeyPress');
266
267 MochiKit.Signal.connect(this.getId('oneTimePassword_1'), 'onkeyup', this, 'handleOneTimePasswordFieldKeyUp');
268 MochiKit.Signal.connect(this.getId('oneTimePassword_2'), 'onkeyup', this, 'handleOneTimePasswordFieldKeyUp');
269 MochiKit.Signal.connect(this.getId('oneTimePassword_3'), 'onkeyup', this, 'handleOneTimePasswordFieldKeyUp');
270 MochiKit.Signal.connect(this.getId('oneTimePassword_4'), 'onkeyup', this, 'handleOneTimePasswordFieldKeyUp');
271
272 new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('login_passphrase'));
273 new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('registration_passphrase'));
274//MochiKit.Logging.logDebug("<<< LoginPanel.initPanel");
275
276 return result;
277 },
278
279 //-------------------------------------------------------------------------
280
281 'renderPasswordField': function() {
282 if (this.getDom('useOneTimePasswordCheckbox').checked == false) {
283 this.getElement('oneTimePasswordDIV').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(false);
284 this.getElement('passphraseDIV').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show(false);
285 this.getElement('login_passphrase').focus();
286 } else {
287 this.getElement('passphraseDIV').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
288 this.getElement('oneTimePasswordDIV').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show();
289 this.getElement('oneTimePassword_1').focus();
290 }
291
292 },
293
294 //.........................................................................
295
296 'handleOneTimePasswordFieldKeyPress': function(anEvent) {
297 if (anEvent.key().string == '-') {
298 switch (anEvent.src().id) {
299 case this.getId('oneTimePassword_1'):
300 this.getElement('oneTimePassword_2').focus();
301 break;
302 case this.getId('oneTimePassword_2'):
303 this.getElement('oneTimePassword_3').focus();
304 break;
305 case this.getId('oneTimePassword_3'):
306 this.getElement('oneTimePassword_4').focus();
307 break;
308 }
309
310 anEvent.stop();
311 }
312 },
313
314/*
315 var ctrl = document.getElementById("txtTargetText");
316 var saveText = ctrl.value;
317 ctrl.focus();
318
319 var range = document.selection.createRange();
320 var specialchar = String.fromCharCode(1);
321 range.text = specialchar;
322 var pos = ctrl.value.indexOf(specialchar);
323 ctrl.value = saveText;
324 range = ctrl.createTextRange();
325 range.move('character', pos);
326 range.select();
327 range.text =
328 document.getElementById("txtSourceText").value;
329 document.getElementById("txtTargetText").focus();
330 window.event.returnValue = false;
331*/
332
333 'handleOneTimePasswordFieldKeyUp': function(anEvent) {
334 varfield;
335 varfieldValue;
336 var key;
337
338//console.log("keyUp", anEvent);
339 field = anEvent.src();
340 fieldValue = field.value;
341 key = anEvent.key();
342
343 // &&(key.string != 'KEY_TAB')
344 // &&(key.string != 'KEY_SHIFT')
345 // &&(key.string != 'KEY_BACKSPACE')
346 // &&(key.string != 'KEY_DELETE')
347 // &&(key.string.indexOf('KEY_ARROW') != 0)
348
349
350 if ((fieldValue.replace(/\s/g, '').length == 8) && (key.string == 'KEY_SPACEBAR')) {
351 // field.value = Clipperz.Base.trim(fieldValue).replace(/.{4}/g, '$&' + ' ');
352
353 switch (field.id) {
354 case this.getId('oneTimePassword_1'):
355 this.getElement('oneTimePassword_2').focus();
356 break;
357 case this.getId('oneTimePassword_2'):
358 this.getElement('oneTimePassword_3').focus();
359 break;
360 case this.getId('oneTimePassword_3'):
361 this.getElement('oneTimePassword_4').focus();
362 break;
363 }
364 // } else if (fieldValue.replace(/\s/g, '').length > 8) {
365 }
366
367//MochiKit.Logging.logDebug("-- fieldValue: " + fieldValue);
368 },
369
370 //.........................................................................
371
372 'doLogin': function() {
373//MochiKit.Logging.logDebug(">>> LoginPanel.doLogin");
374 if (this.checkLoginForm()) {
375 if (this.getDom('useOneTimePasswordCheckbox').checked == false) {
376 this.doLoginWithUsernameAndPassphrase(this.getDom('login_username').value, this.getDom('login_passphrase').value);
377 } else {
378 varoneTimePasswordValue;
379
380 oneTimePasswordValue = this.getDom('oneTimePassword_1').value + this.getDom('oneTimePassword_2').value + this.getDom('oneTimePassword_3').value + this.getDom('oneTimePassword_4').value;
381 this.doLoginWithUsernameAndOneTimePassword(this.getDom('login_username').value, oneTimePasswordValue);
382 }
383 }
384//MochiKit.Logging.logDebug("<<< LoginPanel.doLogin");
385 },
386
387 //.........................................................................
388
389 'doLoginWithUsernameAndPassphrase': function(anUsername, aPassphrase) {
390 var deferredResult;
391 var user;
392 var loginPanel;
393
394//MochiKit.Logging.logDebug(">>> LoginPanel.doLoginWithUsernameAndPassphrase");
395 user = new Clipperz.PM.DataModel.User({username:anUsername, passphrase:aPassphrase});
396 loginPanel = this;
397
398 deferredResult = new MochiKit.Async.Deferred();
399//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("0 - LoginPanel.doLogin - 0: "/* + res*/); return res;});
400//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
401 deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'),
402 {
403 title: "",
404 text: "",
405 width:240,
406 showProgressBar:true,
407 showCloseButton:false,
408 fn:MochiKit.Base.method(deferredResult, 'cancel'),
409 scope:this
410 },
411 this.getDom('login_submit')
412 );
413//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1 - LoginPanel.doLogin - 1: "/* + res*/); return res;});
414//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
415 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'login_start');
416//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("2 - LoginPanel.doLogin - 2: "/* + res*/); return res;});
417//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
418 deferredResult.addCallback(MochiKit.Base.method(user, 'connect'));
419//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("3 - LoginPanel.doLogin - 3: "/* + res*/); return res;});
420//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
421 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_done');
422//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("4 - LoginPanel.doLogin - 4: "/* + res*/); return res;});
423//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
424 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_loadingUserData');
425//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("5 - LoginPanel.doLogin - 5: "/* + res*/); return res;});
426//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
427 deferredResult.addCallback(MochiKit.Base.method(user, 'loadPreferences'));
428//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("6 - LoginPanel.doLogin - 6: "/* + res*/); return res;});
429//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
430 deferredResult.addCallback(MochiKit.Base.method(user, 'loadRecords'));
431//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("7 - LoginPanel.doLogin - 7: "/* + res*/); return res;});
432//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
433 deferredResult.addCallback(MochiKit.Base.method(user, 'loadDirectLogins'));
434//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("8 - LoginPanel.doLogin - 8: "/* + res*/); return res;});
435//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
436 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'login_connected');
437//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("9 - LoginPanel.doLogin - 9: "/* + res*/); return res;});
438//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
439 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, user, 'setupDone', null);
440//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("10 - LoginPanel.doLogin - 10: "/* + res*/); return res;});
441//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
442
443 deferredResult.addCallback(MochiKit.Async.wait, 0.5);
444//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("11 - LoginPanel.doLogin - 11: "/* + res*/); return res;});
445//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
446
447 deferredResult.addCallback(function(res) {
448 Clipperz.PM.Components.MessageBox().hide(YAHOO.ext.Element.get('main'));
449 return res;
450 });
451//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("12 - LoginPanel.doLogin - 12: "/* + res*/); return res;});
452//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
453
454 deferredResult.addErrback(MochiKit.Base.bind(function() {
455 Clipperz.PM.Components.MessageBox().update({
456 title:Clipperz.PM.Strings['loginMessagePanelFailureTitle'],
457 text:Clipperz.PM.Strings['loginMessagePanelFailureText'],
458 showProgressBar:false,
459 buttons:{'ok':Clipperz.PM.Strings['loginMessagePanelFailureButtonLabel']},
460 fn:MochiKit.Base.bind(function() {
461 this.getElement('login_passphrase').focus();
462 this.getElement('login_passphrase').dom.select();
463 }, this),
464 scope:this
465 });
466 }, this));
467//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("13 - LoginPanel.doLogin - 13: "/* + res*/); return res;});
468//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
469
470 deferredResult.callback("token");
471//MochiKit.Logging.logDebug("<<< LoginPanel.doLoginWithUsernameAndPassphrase");
472
473 return deferredResult;
474 },
475
476 //.........................................................................
477
478 'doLoginWithUsernameAndOneTimePassword': function(anUsername, aOneTimePassword) {
479 var deferredResult;
480 var loginPanel;
481 var oneTimePassword;
482
483 oneTimePassword = Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword(aOneTimePassword);
484
485//MochiKit.Logging.logDebug(">>> LoginPanel.doLoginWithUsernameAndPassphrase");
486 deferredResult = new MochiKit.Async.Deferred();
487 deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'),
488 {
489 title: "",
490 text: "",
491 width:240,
492 showProgressBar:true,
493 showCloseButton:false,
494 fn:MochiKit.Base.method(deferredResult, 'cancel'),
495 scope:this,
496 steps:7,
497 buttons:{
498 //'ok':Clipperz.PM.Strings['loginMessagePanelInitialButtonLabel']
499 }
500 },
501 this.getDom('login_submit')
502 );
503 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'OTP_login_start');
504 deferredResult.addCallback(function(anUsername, aOneTimePassword) {
505 var args;
506
507 args = {
508 'message': 'oneTimePassword',
509 'version': Clipperz.PM.Crypto.communicationProtocol.currentVersion,
510 'parameters': {
511 'oneTimePasswordKey': Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(anUsername, aOneTimePassword),
512 'oneTimePasswordKeyChecksum': Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(anUsername, aOneTimePassword)
513 }
514 }
515
516 return args;
517 }, anUsername, oneTimePassword);
518 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'OTP_login_loadingOTP');
519 deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Proxy.defaultProxy, 'handshake'));
520 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'OTP_login_extractingPassphrase');
521 deferredResult.addCallback(function(aResult) {
522 return Clipperz.PM.Crypto.deferredDecrypt(oneTimePassword, aResult['data'], aResult['version']);
523 });
524//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.otpLogin - 4: " + res); return res;});
525 deferredResult.addCallback(function(aResult) {
526 //MochiKit.Logging.logDebug("aResult")
527 return (new Clipperz.ByteArray().appendBase64String(aResult['passphrase'])).asString();
528 });
529//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.otpLogin - 5: " + res); return res;});
530 deferredResult.addCallbacks(
531 MochiKit.Base.method(this, 'doLoginWithUsernameAndPassphrase', anUsername),
532 MochiKit.Base.bind(function(aLoginPanel) {
533 Clipperz.PM.Components.MessageBox().update({
534 title:Clipperz.PM.Strings['loginMessagePanelFailureTitle'],
535 text:Clipperz.PM.Strings['loginMessagePanelFailureText'],
536 showProgressBar:false,
537 buttons:{'ok':Clipperz.PM.Strings['loginMessagePanelFailureButtonLabel']},
538 fn:MochiKit.Base.bind(function() {
539 this.getElement('oneTimePassword_1').focus();
540 }, this),
541 scope:aLoginPanel
542 });
543 }, this)
544 );
545//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.otpLogin - 6: " + res); return res;});
546 deferredResult.callback("token");
547//MochiKit.Logging.logDebug("<<< LoginPanel.doLoginWithUsernameAndPassphrase");
548
549 return deferredResult;
550 },
551
552 //.........................................................................
553
554 'checkLoginForm': function() {
555 var result;
556 var username
557
558 result = true;
559
560//MochiKit.Logging.logDebug(">>> checkLoginForm");
561 username = Clipperz.Base.trim(this.getDom('login_username').value);
562 if (username == "") {
563 this.getElement('login_username').focus();
564 result = false;
565 } else {
566 if (this.getDom('useOneTimePasswordCheckbox').checked == false) {
567 varpassphrase;
568
569 passphrase = Clipperz.Base.trim(this.getDom('login_passphrase').value);
570
571 if (passphrase == "") {
572 this.getElement('login_passphrase').focus();
573 result = false;
574 }
575 } else {
576 if (Clipperz.Base.trim(this.getDom('oneTimePassword_1').value) == "") {
577 this.getElement('oneTimePassword_1').focus();
578 result = false;
579 } else if (Clipperz.Base.trim(this.getDom('oneTimePassword_2').value) == "") {
580 this.getElement('oneTimePassword_2').focus();
581 result = false;
582 } else if (Clipperz.Base.trim(this.getDom('oneTimePassword_3').value) == "") {
583 this.getElement('oneTimePassword_3').focus();
584 result = false;
585 } else if (Clipperz.Base.trim(this.getDom('oneTimePassword_4').value) == "") {
586 this.getElement('oneTimePassword_4').focus();
587 result = false;
588 }
589 }
590 }
591//MochiKit.Logging.logDebug("<<< checkLoginForm - " + result);
592
593 return result;
594 },
595
596 //.........................................................................
597
598 'doRegister': function(anEvent) {
599 if ((Clipperz.PM.Proxy.defaultProxy.isReadOnly() == false) && (this.checkRegistrationForm())) {
600 this.doRegistrationWithUsernameAndPassphrase(this.getDom('registration_username').value, this.getDom('registration_passphrase').value /*, this.getDom('registration_invitationCode').value*/);
601 }
602 },
603
604 //.........................................................................
605
606 'checkRegistrationForm': function() {
607 var result;
608 var username
609 varpassphrase;
610 varrePassphrase;
611 varsafetyCheck;
612 vartermsOfServiceCheck;
613 // varinvitationCode;
614
615 username = this.getDom('registration_username').value;
616 passphrase = this.getDom('registration_passphrase').value;
617 rePassphrase = this.getDom('registration_repassphrase').value;
618 safetyCheck = this.getDom('registration_check').checked;
619 termsOfServiceCheck = this.getDom('registration_termsOfServiceCheck').checked;
620 // invitationCode = this.getDom('registration_invitationCode').value;
621
622 if ((username != "") && (passphrase != "") && (rePassphrase != "") /*&& (invitationCode != "")*/) {
623 if (passphrase != rePassphrase) {
624 //show alert that the passphrase and rePassphrase should be equal
625//MochiKit.Logging.logDebug("WARNING: passphrase != rePassphrase");
626 this.showRegistrationFormErrorMessageAnimation(Clipperz.PM.Strings['registrationFormWarningMessageNotMatchingPassphrases']);
627 this.getElement('registration_repassphrase').focus().dom.select();
628 // this.getElement('registration_repassphrase').select();
629 result = false;
630 } else if (safetyCheck != true) {
631 //show alert that the safetyCheck should be checed
632//MochiKit.Logging.logDebug("WARNING: safetyCheck not checked");
633 this.showRegistrationFormErrorMessageAnimation(Clipperz.PM.Strings['registrationFormWarningMessageSafetyCheckNotSelected']);
634 this.getElement('registration_check').focus();
635 result = false;
636 } else if (termsOfServiceCheck != true) {
637 this.showRegistrationFormErrorMessageAnimation(Clipperz.PM.Strings['registrationFormWarningMessageTermsOfServiceCheckNotSelected']);
638 this.getElement('registration_termsOfServiceCheck').focus();
639 } else {
640 result = true;
641 }
642 } else {
643 if (username == "") {
644 this.getElement('registration_username').focus();
645 } else if (passphrase == "") {
646 this.getElement('registration_passphrase').focus();
647 } else if (rePassphrase == "") {
648 this.getElement('registration_repassphrase').focus();
649 // } else if (invitationCode == "") {
650 // this.showRegistrationFormErrorMessageAnimation(Clipperz.PM.Strings['registrationFormWarningMessageInvitationCodeMissing']);
651 // this.getElement('registration_invitationCode').focus();
652 }
653
654 result = false;
655 }
656
657 if (result === true) {
658 this.getActor('registration_errorMessage').hide();
659 }
660
661 return result;
662 },
663
664 //.........................................................................
665
666 'showRegistrationFormErrorMessageAnimation': function(anErrorMessage, aCallback) {
667 varerrorMessageActor;
668
669 errorMessageActor = this.getActor('registration_errorMessage');
670 errorMessageActor.update(anErrorMessage);
671 errorMessageActor.show(true);
672 errorMessageActor.play(aCallback);
673 },
674
675 //.........................................................................
676
677 'doRegistrationWithUsernameAndPassphrase': function(anUsername, aPassphrase /*, anInvitationCode */) {
678 var deferredResult;
679 var user;
680 var loginPanel;
681
682//MochiKit.Logging.logDebug(">>> LoginPanel.doRegistrationWithUsernameAndPassphrase");
683 user = new Clipperz.PM.DataModel.User({username:anUsername, passphrase:aPassphrase});
684//MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 1");
685 loginPanel = this;
686//MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 2");
687
688 deferredResult = new MochiKit.Async.Deferred();
689//MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 3");
690//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 1: " + res); return res;});
691 deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'),
692 {
693 title:Clipperz.PM.Strings['registrationMessagePanelInitialTitle'],
694 text: Clipperz.PM.Strings['registrationMessagePanelInitialText'],
695 width:240,
696 showProgressBar:true,
697 showCloseButton:false,
698 fn:MochiKit.Base.method(deferredResult, 'cancel'),
699 scope:this,
700 steps:9,
701 buttons:{
702 'ok':Clipperz.PM.Strings['registrationMessagePanelInitialButtonLabel']
703 }
704 },
705 this.getDom('registration_submit')
706 );
707//MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 4");
708//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 2: " + res); return res;});
709 deferredResult.addCallback(MochiKit.Base.method(user, 'register'), /*anInvitationCode*/ "VeryBraveBetaTester");
710//MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 5");
711//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 3: " + res); return res;});
712 deferredResult.addCallback(function(res) {
713 Clipperz.PM.Components.MessageBox().update({
714 title:Clipperz.PM.Strings['registrationMessagePanelRegistrationDoneTitle'],
715 text:Clipperz.PM.Strings['registrationMessagePanelRegistrationDoneText'],
716 step:'next'
717 });
718 return res;
719 });
720//MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 6");
721//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 5: " + res); return res;});
722 deferredResult.addCallback(MochiKit.Async.wait, 1);
723//MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 7");
724//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 6: " + res); return res;});
725 deferredResult.addCallback(MochiKit.Base.method(user, 'connect'));
726//MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 8");
727//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 7: " + res); return res;});
728 deferredResult.addCallback(MochiKit.Async.wait, 1);
729//MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 9");
730//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 8: " + res); return res;});
731 deferredResult.addCallback(function(res) {
732 Clipperz.PM.Components.MessageBox().hide(YAHOO.ext.Element.get('main'));
733 return res;
734 });
735 deferredResult.addCallback(MochiKit.Base.method(this, 'showRegistrationSplashScreen'), user);
736//MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 10");
737//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 9: " + res); return res;});
738 deferredResult.addErrback(function(anError) {
739 Clipperz.PM.Components.MessageBox().update({
740 title:Clipperz.PM.Strings['registrationMessagePanelFailureTitle'],
741 text:anError.message,
742 showProgressBar:false,
743 buttons:{'ok':Clipperz.PM.Strings['registrationMessagePanelFailureButtonLabel']}});
744 return anError;
745 });
746//MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 11");
747//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 10: " + res); return res;});
748 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, user, 'setupDone', null);
749 deferredResult.callback("token");
750//MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 12");
751
752 return deferredResult;
753 },
754
755 //-------------------------------------------------------------------------
756
757 'showRegistrationSplashScreen': function(anUser) {
758 var deferredResult;
759 var alertElement;
760 varalertDialog;
761 var closeButton;
762 var closeFunction;
763
764 deferredResult = new MochiKit.Async.Deferred();
765
766//MochiKit.Logging.logDebug(">>> Main.showRegistrationSplashScreen");
767 alertElement = Clipperz.YUI.DomHelper.append(document.body, {tag:'div', id:'registrationSplash', children:[
768 {tag:'div', cls:'ydlg-hd', htmlString:Clipperz.PM.Strings['registrationSplashPanelTitle']},
769 {tag:'div', cls:'ydlg-bd', children:[
770 {tag:'div', cls:'alert-message', id:'splashMessage', children:[
771 {tag:'div', htmlString:Clipperz.PM.Strings['registrationSplashPanelDescription']},
772 {tag:'table', border:'0', cellpadding:'5', children:[
773 {tag:'tbody', children:[
774 {tag:'tr', children:[
775 {tag:'td', valign:'top', children:[
776 {tag:'span', cls:'label', htmlString:Clipperz.PM.Strings['registrationSplashPanelUsernameLabel']}
777 ]},
778 {tag:'td', valign:'top', children:[
779 {tag:'span', cls:'value', html:Clipperz.Base.escapeHTML(anUser.username())}
780 ]}
781 ]},
782 {tag:'tr', children:[
783 {tag:'td', valign:'top', children:[
784 {tag:'span', cls:'label', htmlString:Clipperz.PM.Strings['registrationSplashPanelPassphraseLabel']}
785 ]},
786 {tag:'td', valign:'top', children:[
787 {tag:'div', id:this.getId('showPassphraseDiv'), children:[
788 {tag:'span', cls:'value', html:Clipperz.Base.escapeHTML(anUser.passphrase())}
789 ]},
790 {tag:'div', id:this.getId('hidePassphraseDiv'), cls:'Clipperz_recordFieldData', children:[
791 {tag:'input', id:this.getId('passwordField'), type:'text', cls:'scrambledField', title:Clipperz.PM.Strings['recordDetailPasswordFieldTooltipLabel'], value:"anUser.passphrase()"}
792 ]}
793 ]}
794 ]},
795 {tag:'tr', children:[
796 {tag:'td'},
797 {tag:'td', valign:'top', children:[
798 // {tag:'a', href:"#", id:this.getId('togglePassphraseVisibility'), htmlString:Clipperz.PM.Strings['registrationSplashPanelShowPassphraseButtonLabel']}
799 {tag:'input', type:'checkbox', id:this.getId('showPassphraseCheckbox')},
800 {tag:'span', cls:'activeText', id:this.getId('showPassphraseText'), htmlString:Clipperz.PM.Strings['registrationSplashPanelShowPassphraseButtonLabel']}
801 ]}
802 ]}
803 ]}
804 ]}
805 ]}
806 ]},
807 {tag:'div', cls:'ydlg-ft'}
808 ]}, true);
809//MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 1");
810
811 this.getElement('passwordField').dom.value = anUser.passphrase();
812 this.getElement('passwordField').wrap({tag:'div', cls:'passwordBackground'}).setStyle('background-position', "0px -" + Math.min(128, Clipperz.PM.Crypto.passwordEntropy(anUser.passphrase())) + "px").setStyle('width', '71px');
813 MochiKit.Signal.connect(this.getId('showPassphraseCheckbox'), 'onclick', this, 'togglePassphraseVisibility');
814 MochiKit.Signal.connect(this.getId('showPassphraseText'), 'onclick', this, 'togglePassphraseCheckbox');
815//MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 1.1");
816
817 this.getElement('showPassphraseDiv').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
818 this.getElement('hidePassphraseDiv').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
819//MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 1.1.1");
820 this.togglePassphraseVisibility();
821//MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 1.2");
822
823 alertDialog = new YAHOO.ext.BasicDialog(
824 alertElement, {
825 closable:false,
826 modal:true,
827 autoTabs:false,
828 resizable:false,
829 fixedcenter:true,
830 constraintoviewport:false,
831 width:450,
832 height:220,
833 shadow:true,
834 minWidth:300,
835 minHeight:300
836 }
837 );
838//MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 2");
839
840 closeFunction = deferredResult.callback;
841//MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 3");
842 alertDialog.addKeyListener(27, closeFunction);
843//MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 4");
844 closeButton = alertDialog.addButton(Clipperz.PM.Strings['splashAlertCloseButtonLabel'], closeFunction, deferredResult);
845//MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 5");
846 alertDialog.setDefaultButton(closeButton);
847//MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 6");
848 alertDialog.show('main');
849//MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 7");
850
851 deferredResult.addBoth(MochiKit.Base.method(alertDialog, 'hide'));
852 deferredResult.addCallback(MochiKit.Signal.disconnectAllTo, this)
853//MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 8");
854 deferredResult.addCallback(MochiKit.Async.succeed);
855//MochiKit.Logging.logDebug("<<< Main.showRegistrationSplashScreen");
856
857 return deferredResult;
858 },
859
860 //-------------------------------------------------------------------------
861
862 'showLoginFormEventHandler': function(anEvent) {
863 anEvent.stop();
864 this.showLoginForm(true);
865 },
866
867 'showLoginForm': function(shouldAnimate) {
868 if (shouldAnimate) {
869 this.showLoginFormAnimator().play();
870 } else {
871 this.hideRegistrationForm(false);
872 this.getActor('loginForm').show(false);
873 this.getElement('login_username').focus();
874 }
875 this.setVisibleForm('login');
876 },
877
878 'showLoginFormAnimator': function() {
879 if (this._showLoginFormAnimator == null) {
880 var animator;
881 varloginFormActor;
882 var registrationFormActor;
883 var usernameFieldActor;
884
885 animator = new YAHOO.ext.Animator();
886 loginFormActor = this.getActor('loginForm', animator);
887 loginFormActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY);
888 registrationFormActor = this.getActor('registrationForm', animator);
889 registrationFormActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY);
890 usernameFieldActor = this.getActor('login_username', animator);
891
892 animator.startCapture();
893 registrationFormActor.hide(true);
894 loginFormActor.show(true);
895 usernameFieldActor.focus();
896 animator.stopCapture();
897
898 this._showLoginFormAnimator = animator;
899 }
900
901 return this._showLoginFormAnimator;
902 },
903
904
905 'hideLoginForm': function(shouldAnimate) {
906 var loginFormActor;
907
908 loginFormActor = this.getActor('loginForm');
909 loginFormActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY);
910 loginFormActor.hide(shouldAnimate);
911 },
912
913 //-------------------------------------------------------------------------
914
915 'showRegistrationFormEventHandler': function(anEvent) {
916 anEvent.stop();
917 this.showRegistrationForm(true);
918 },
919
920 'showRegistrationForm': function(shouldAnimate) {
921 if (shouldAnimate) {
922 this.showRegistrationFormAnimator().play(MochiKit.Base.bind(this.showRegistrationAlert, this));
923 } else {
924 varerrorMessageActor;
925
926 this.hideLoginForm(shouldAnimate)
927 this.getActor('registrationForm').show(false);
928 this.getElement('registration_username').focus();
929
930 errorMessageActor = this.getActor('registration_errorMessage');
931 errorMessageActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY);
932 errorMessageActor.update("---");
933 errorMessageActor.hide();
934
935 this.showRegistrationAlert();
936 }
937 this.setVisibleForm('registration');
938 },
939
940 'showRegistrationFormAnimator': function() {
941 if (this._showRegistrationFormAnimator == null) {
942 var animator;
943 varloginFormActor;
944 var registrationFormActor;
945 var usernameFieldActor;
946 varerrorMessageActor;
947
948 animator = new YAHOO.ext.Animator();
949 loginFormActor = this.getActor('loginForm', animator);
950 loginFormActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY);
951 registrationFormActor = this.getActor('registrationForm', animator);
952 registrationFormActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY);
953 usernameFieldActor = this.getActor('registration_username', animator);
954 errorMessageActor = this.getActor('registration_errorMessage', animator);
955 errorMessageActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY);
956
957 animator.startCapture();
958 loginFormActor.hide(true);
959 errorMessageActor.update("---");
960 errorMessageActor.hide();
961 registrationFormActor.show(true);
962 usernameFieldActor.focus();
963 animator.stopCapture();
964
965 this._showRegistrationFormAnimator = animator;
966 }
967
968 return this._showRegistrationFormAnimator;
969 },
970
971 'hideRegistrationForm': function(shouldAnimate) {
972 var registrationFormActor;
973
974 registrationFormActor = this.getActor('registrationForm');
975 registrationFormActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY);
976 registrationFormActor.hide(shouldAnimate);
977 },
978
979 //-------------------------------------------------------------------------
980
981 'shouldShowRegistrationAlert': function() {
982 return this._shouldShowRegistrationAlert;
983 },
984
985 'showRegistrationAlert': function() {
986 if ((this.shouldShowRegistrationAlert()) && (Clipperz.PM.Proxy.defaultProxy.isReadOnly() == false)) {
987 var alertElement;
988 varalertDialog;
989 var closeButton;
990 var closeFunction;
991
992 alertElement = Clipperz.YUI.DomHelper.append(document.body, {tag:'div', id:'alert', children:[
993 {tag:'div', cls:'ydlg-hd', htmlString:Clipperz.PM.Strings['splashAlertTitle']},
994 {tag:'div', cls:'ydlg-bd', children:[
995 {tag:'div', cls:'alert-message', id:'splashMessage', htmlString:Clipperz.PM.Strings['splashAlertText']}
996 ]},
997 {tag:'div', cls:'ydlg-ft'}
998 ]}, true);
999
1000 alertDialog = new YAHOO.ext.BasicDialog(
1001 alertElement, {
1002 closable:false,
1003 modal:true,
1004 autoTabs:false,
1005 resizable:false,
1006 fixedcenter:true,
1007 constraintoviewport:false,
1008 width:450,
1009 height:320,
1010 shadow:true,
1011 minWidth:300,
1012 minHeight:300
1013 }
1014 );
1015
1016 closeFunction = MochiKit.Base.partial(MochiKit.Base.bind(this.closeResigrationAlert, this), alertDialog);
1017 alertDialog.addKeyListener(27, closeFunction);
1018 closeButton = alertDialog.addButton(Clipperz.PM.Strings['splashAlertCloseButtonLabel'], closeFunction, this);
1019 alertDialog.setDefaultButton(closeButton);
1020 alertDialog.show('main');
1021
1022 this._shouldShowRegistrationAlert = false;
1023 }
1024 },
1025
1026 'closeResigrationAlert': function(anAlertDialog) {
1027 anAlertDialog.hide(MochiKit.Base.bind(function() {anAlertDialog.destroy(true); this.focusOnVisibleForm();}, this));
1028 },
1029
1030 //-------------------------------------------------------------------------
1031
1032 'onkeydown': function(anEvent) {
1033//MochiKit.Logging.logDebug(">>> onkeydown - " + anEvent.src().id);
1034 if (anEvent.key().code == 13) {
1035 if (anEvent.src() == this.getDom('loginForm')) {
1036 this.doLogin();
1037 } else if (anEvent.src() == this.getDom('registrationForm')) {
1038 this.doRegister();
1039 } else {
1040 }
1041
1042 anEvent.stop();
1043 }
1044 },
1045
1046 //-------------------------------------------------------------------------
1047
1048 'visibleForm': function() {
1049 return this._visibleForm;
1050 },
1051
1052 'setVisibleForm': function(aValue) {
1053 this._visibleForm = aValue;
1054 },
1055
1056 //-------------------------------------------------------------------------
1057
1058 'focusOnVisibleForm': function() {
1059 if (this.visibleForm() == 'registration') {
1060 this.getElement('registration_username').focus();
1061 } else {
1062 this.getElement('login_username').focus();
1063 }
1064 },
1065
1066 //-------------------------------------------------------------------------
1067
1068 'show': function() {
1069 if (this.visibleForm() == 'registration') {
1070 this.showRegistrationForm(false);
1071 } else {
1072 this.showLoginForm(false);
1073 }
1074 },
1075
1076 //-------------------------------------------------------------------------
1077
1078 'switchLanguage': function(anEvent) {
1079 Clipperz.PM.Strings.Languages.setSelectedLanguage(anEvent.src().value);
1080 },
1081
1082 //-------------------------------------------------------------------------
1083
1084 'selectSelectedLanguageOption': function() {
1085 Clipperz.DOM.selectOptionMatchingValue(this.getDom('languageSelector'), Clipperz.PM.Strings.selectedLanguage, true);
1086 },
1087
1088 //-------------------------------------------------------------------------
1089
1090 'switchLanguageHandler': function() {
1091 this.render();
1092 this.show();
1093 },
1094
1095 //-------------------------------------------------------------------------
1096
1097 'togglePassphraseCheckbox': function(anEvent) {
1098 this.getDom('showPassphraseCheckbox').click();
1099 },
1100
1101 'togglePassphraseVisibility': function(anEvent) {
1102 if (this.getDom('showPassphraseCheckbox').checked == true) {
1103 this.getElement('showPassphraseDiv').show();
1104 this.getElement('hidePassphraseDiv').hide();
1105 } else {
1106 this.getElement('showPassphraseDiv').hide();
1107 this.getElement('hidePassphraseDiv').show();
1108 }
1109 },
1110
1111 //-------------------------------------------------------------------------
1112 __syntaxFix__: "syntax fix"
1113
1114});
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/LogoutPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/LogoutPanel.js
new file mode 100644
index 0000000..d7abfd6
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Panels/LogoutPanel.js
@@ -0,0 +1,73 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.Panels.LogoutPanel = function(args) {
37 args = args || {};
38
39 Clipperz.PM.Components.Panels.LogoutPanel.superclass.constructor.call(this, args);
40
41 return this;
42}
43
44//=============================================================================
45
46YAHOO.extendX(Clipperz.PM.Components.Panels.LogoutPanel, Clipperz.PM.Components.Panels.BasePanel, {
47
48 'toString': function() {
49 return "Clipperz.PM.Components.LogoutPanel component";
50 },
51
52 //-------------------------------------------------------------------------
53
54 'initPanel': function() {
55 var result;
56 varlayout;
57
58 result = new YAHOO.ext.ContentPanel(this.getId('panel'), {title:'logout', closable:false, autoCreate:true});
59
60 Clipperz.YUI.DomHelper.append(result.getEl().dom,
61 {tag:'div', children:[
62 {tag:'h2', html:'Logout panel'}
63 ]}
64 );
65
66 return result;
67 },
68
69 //-------------------------------------------------------------------------
70 __syntaxFix__: "syntax fix"
71
72});
73
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js
new file mode 100644
index 0000000..e2036d0
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js
@@ -0,0 +1,906 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.Panels.MainPanel = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.Panels.MainPanel.superclass.constructor.call(this, anElement, args);
40
41 this._recordListDataModel = null;
42 this._selectedRecord = null;
43 this._recordDetailComponent = null;
44 this._recordListGrid = null;
45
46 this._directLinkItemTemplate = null;
47 this._recordItemTemplate = null;
48
49 this._addNewRecordButton = null;
50 this._deleteRecordButton = null;
51
52 this._creationWizard = null;
53
54 Clipperz.NotificationCenter.register(null, 'selectAndEnterEditMode', this, 'selectRecordAndEnterEditModeHandler');
55
56 Clipperz.NotificationCenter.register(null, 'recordAdded', this, 'recordAddedHandler');
57 Clipperz.NotificationCenter.register(null, 'recordUpdated', this, 'recordUpdatedHandler');
58 Clipperz.NotificationCenter.register(null, 'recordRemoved', this, 'recordRemovedHandler');
59
60 Clipperz.NotificationCenter.register(null, 'directLoginAdded', this, 'directLoginAddedHandler');
61 Clipperz.NotificationCenter.register(null, 'directLoginUpdated', this, 'directLoginUpdatedHandler');
62 Clipperz.NotificationCenter.register(null, 'directLoginRemoved', this, 'directLoginRemovedHandler');
63
64 Clipperz.NotificationCenter.register(null, 'accountLocked', this, 'accountLockedHandler');
65
66 MochiKit.Signal.connect(MochiKit.DOM.currentWindow(), 'onresize', this, 'resizeModalMask');
67 this.render();
68
69 return this;
70}
71
72//=============================================================================
73
74YAHOO.extendX(Clipperz.PM.Components.Panels.MainPanel, Clipperz.PM.Components.Panels.BasePanel, {
75
76 'toString': function() {
77 return "Clipperz.PM.Components.Panels.MainPanel component";
78 },
79
80 //-------------------------------------------------------------------------
81
82 'render': function() {
83 this.element().update("");
84 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'table', id:'mainPanelTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[
85 {tag:'tbody', children:[
86 {tag:'tr', children:[
87 {tag:'td', width:'15', children:[
88 {tag:'div', cls:'mainPanelMinHeightDiv'}
89 ]},
90 {tag:'td', valign:'top', id:'directLoginsTD', width:'200', children:[
91 {tag:'div', id:'directLoginsBlock', children:[
92 {tag:'div', cls:'directLoginsBlockHeaderBox', children:[{tag:'h3', id:'directLoginTitle', htmlString:Clipperz.PM.Strings['mainPanelDirectLoginBlockLabel']}]},
93 {tag:'div', id:'directLoginsDescription', htmlString:Clipperz.PM.Strings['mainPanelDirectLoginBlockDescription']},
94 {tag:'ul', id:'directLogins'}
95 ]}
96 ]},
97 {tag:'td', width:'15', children:[
98 {tag:'div', cls:'mainPanelMinHeightDiv'}
99 ]},
100 {tag:'td', valign:'top', children:[
101 {tag:'div', id:'mainContent', children:[
102 {tag:'div', id:'recordListBlockHeader'},
103 {tag:'div', id:'recordListAndDetailBlock', children:[
104 {tag:'table', id:'recordListAndDetailBlockTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[
105 {tag:'tbody', children:[
106 {tag:'tr', children:[
107 {tag:'td', valign:'top', width:'250', children:[
108 {tag:'div', id:'recordListBlock', children:[
109 {tag:'div', id:'recordListFilterHeader'},
110 {tag:'ul', id:'records'}
111 ]}
112 ]},
113 {tag:'td', id:'recordDetailSeparatorTD', rowspan:'2', valign:'top', bgcolor:'#ddddff', html:'&nbsp;'},
114 {tag:'td', valign:'top', children:[
115 {tag:'div', id:'recordDetailMainBlock', children:[
116 {tag:'div', id:'recordTitleTopBlock'},
117 {tag:'div', id:'recordDetailBlock', children:[
118 {tag:'div', id:'recordDetail'}
119 ]}
120 ]},
121 {tag:'div', id:'recordCreationWizardMainBlock', children:[
122 {tag:'div', id:'recordCreationWizard', html:"WIZARD"}
123 ]}
124 ]}
125 ]},
126 {tag:'tr', children:[
127 {tag:'td', id:'cardBoxLowerLeftTD', html:'&nbsp;'},
128 {tag:'td', id:'cardBoxLowerRightTD', html:'&nbsp;'}
129 ]}
130 ]}
131 ]}
132 ]}
133 ]}
134 ]},
135 {tag:'td', width:'15', html:"&nbsp;"}
136 ]}
137 ]}
138 ]});
139
140 this.renderRecordListBlockHeader();
141 // this.renderRecordListFilterHeader();
142
143 YAHOO.ext.Element.get('directLogins').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
144
145 this.recordDetailComponent();
146
147 YAHOO.ext.Element.get('recordDetailMainBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show();
148 YAHOO.ext.Element.get('recordCreationWizardMainBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
149 },
150
151 //-------------------------------------------------------------------------
152
153 'addNewRecordButton': function() {
154 return this._addNewRecordButton;
155 },
156
157 'setAddNewRecordButton': function(aValue) {
158 this._addNewRecordButton = aValue;
159 },
160
161 'deleteRecordButton': function() {
162 return this._deleteRecordButton;
163 },
164
165 'setDeleteRecordButton': function(aValue) {
166 this._deleteRecordButton = aValue;
167 },
168
169 //-------------------------------------------------------------------------
170
171 'addNewRecord': function(anEvent) {
172 var deferredResult;
173 // var currentNumberOfRecords;
174
175 deferredResult = new MochiKit.Async.Deferred();
176
177 // currentNumberOfRecords = MochiKit.Base.keys(this.user().records()).length;
178/*
179 // if ((this.user().preferences().shouldShowDonationPanel()) && (currentNumberOfRecords > 0) && ((currentNumberOfRecords%10) == 0)) {
180 // if (true) {
181 if ((this.user().preferences().shouldShowDonationPanel()) && (currentNumberOfRecords >= 5)) {
182 deferredResult.addCallback(Clipperz.PM.showDonationSplashScreen, this.user(), 'recordListAddRecordButton');
183 }
184*/
185 deferredResult.addCallback(MochiKit.Base.bind(function() {
186 var currentlySelectedRecord;
187
188 currentlySelecedRecord = this.selectedRecord();
189 this.setSelectedRecord(null);
190
191 YAHOO.ext.Element.get('recordDetailMainBlock').hide();
192 YAHOO.ext.Element.get('recordCreationWizardMainBlock').show();
193 this.setCreationWizard(new Clipperz.PM.Components.RecordDetail.CreationWizard(YAHOO.ext.Element.get('recordCreationWizardMainBlock'), {previouslySelectedRecord:currentlySelecedRecord, mainComponent:this}));
194
195 this.enterModalView();
196 }, this));
197
198 deferredResult.callback();
199 },
200
201 //-------------------------------------------------------------------------
202
203 'creationWizard': function() {
204 return this._creationWizard;
205 },
206
207 'setCreationWizard': function(aValue) {
208 this._creationWizard = aValue;
209 },
210
211 //-------------------------------------------------------------------------
212
213 'exitWizard': function(aSelectedRecord, shouldEnterEditMode) {
214//MochiKit.Logging.logDebug(">>> MainPanel.exitWizard - " + aSelectedRecord)
215 YAHOO.ext.Element.get('recordCreationWizardMainBlock').hide();
216 YAHOO.ext.Element.get('recordDetailMainBlock').show();
217
218 if (shouldEnterEditMode == true) {
219 this.selectRecordAndEnterEditMode(aSelectedRecord);
220 } else {
221 this.setSelectedRecord(aSelectedRecord);
222 this.exitModalView();
223 }
224
225 this.creationWizard().remove();
226 this.setCreationWizard(null);
227//MochiKit.Logging.logDebug("<<< MainPanel.exitWizard");
228 },
229
230 //-------------------------------------------------------------------------
231
232 'selectRecordAndEnterEditMode': function(aRecord) {
233 this.setSelectedRecord(aRecord);
234 this.recordDetailComponent().setEditMode('EDIT');
235 },
236
237 'selectRecordAndEnterEditModeHandler': function(anEvent) {
238 this.selectRecordAndEnterEditMode(anEvent.source());
239 },
240
241 //-------------------------------------------------------------------------
242
243 'resizeModalMask': function() {
244//MochiKit.Logging.logDebug(">>> MainPanel.resizeModalMask");
245 MochiKit.Style.setElementDimensions('recordDetailEditModeHeaderMask', {w:MochiKit.Style.getElementDimensions('mainDiv').w, h:119});
246
247 MochiKit.Style.setElementDimensions('recordDetailEditModeVerticalMask', {w:511, h:MochiKit.Style.getElementDimensions('mainDiv').h - 119});
248//MochiKit.Logging.logDebug("<<< MainPanel.resizeModalMask");
249 },
250
251 //-------------------------------------------------------------------------
252
253 'enterModalView': function() {
254 if (this.user().preferences().useSafeEditMode()) {
255 var headerMaskElement;
256 var verticalMaskElement;
257
258 this.resizeModalMask();
259
260 headerMaskElement = YAHOO.ext.Element.get('recordDetailEditModeHeaderMask');
261 headerMaskElement.show();
262 headerMaskElement.mask();
263
264 verticalMaskElement = YAHOO.ext.Element.get('recordDetailEditModeVerticalMask');
265 verticalMaskElement.show();
266 verticalMaskElement.mask();
267 }
268 },
269
270 //-------------------------------------------------------------------------
271
272 'exitModalView': function() {
273 if (this.user().preferences().useSafeEditMode()) {
274 var headerMaskElement;
275 var verticalMaskElement;
276
277 headerMaskElement = YAHOO.ext.Element.get('recordDetailEditModeHeaderMask');
278 headerMaskElement.unmask();
279 headerMaskElement.hide();
280
281 verticalMaskElement = YAHOO.ext.Element.get('recordDetailEditModeVerticalMask');
282 verticalMaskElement.unmask();
283 verticalMaskElement.hide();
284 }
285 },
286
287 //-------------------------------------------------------------------------
288
289 'removeSelectedRecord': function() {
290 var selectedRecordReferences;
291
292//MochiKit.Logging.logDebug(">>> MainPanel.removeSelectedRecord");
293 if (this.selectedRecord() != null) {
294 selectedRecordReferences = [this.selectedRecord().reference()];
295 } else {
296 selectedRecordReferences = [];
297 }
298
299 if (selectedRecordReferences.length > 0 ) {
300 varrecordReference;
301 varrecords;
302 var deferred;
303
304 records = [];
305 for (recordReference in selectedRecordReferences) {
306 var record;
307
308//MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - recordReference: " + selectedRecordReferences[recordReference]);
309 record = this.user().records()[selectedRecordReferences[recordReference]];
310//MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - record: " + record);
311 records.push(record);
312 }
313//MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - records.length: " + records.length);
314
315 deferred = new MochiKit.Async.Deferred();
316//MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 1:");
317//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 1: " + res); return res;});
318//MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 2:");
319 deferred.addCallback(function() {
320 var deferredResult;
321
322 deferredResult = new MochiKit.Async.Deferred();
323 Clipperz.PM.Components.MessageBox().deferredShow({
324 title:Clipperz.PM.Strings['mainPanelDeletingRecordPanelConfirmationTitle'],
325 text:Clipperz.PM.Strings['mainPanelDeleteRecordPanelConfirmationText'],
326 width:240,
327 showProgressBar:false,
328 showCloseButton:false,
329 buttons:{
330 'yes':Clipperz.PM.Strings['mainPanelDeleteRecordPanelConfirmButtonLabel'],
331 'no':Clipperz.PM.Strings['mainPanelDeleteRecordPanelDenyButtonLabel']
332 },
333 fn:MochiKit.Base.partial(function(aDeferred, aResult) {
334 if (aResult == 'yes') {
335 aDeferred.callback(aResult);
336 } else {
337 aDeferred.errback(aResult);
338 }
339 }, deferredResult)
340 }, 'recordListRemoveRecordButton');
341
342 return deferredResult;
343 });
344//MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 3:");
345//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 2: " + res); return res;});
346//MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 4:");
347//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 3: " + res); return res;});
348 deferred.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'),
349 {
350 title:Clipperz.PM.Strings['mainPanelDeletingRecordPanelInitialTitle'],
351 text:Clipperz.PM.Strings['mainPanelDeletingRecordPanelInitialText'],
352 width:240,
353 showProgressBar:true,
354 showCloseButton:false,
355 steps:5
356 }
357 );
358//MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 5:");
359//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 4: " + res); return res;});
360 deferred.addCallback(MochiKit.Base.method(this.user(), 'deleteRecordsAction'), records);
361//MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 6:");
362//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 5: " + res); return res;});
363//MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 7:");
364//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 6: " + res); return res;});
365 deferred.addCallback(function() {
366 Clipperz.PM.Components.MessageBox().update({
367 title:null,
368 text:Clipperz.PM.Strings['mainPanelDeletingRecordPanelCompletedText'],
369 step:'next',
370 buttons:{}
371 });
372 });
373//MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 8:");
374//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 7: " + res); return res;});
375 deferred.addCallback(MochiKit.Async.wait, 1);
376//MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 9:");
377//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 8: " + res); return res;});
378 deferred.addCallback(function(res) {
379 Clipperz.PM.Components.MessageBox().hide(YAHOO.ext.Element.get('main'));
380 return res;
381 });
382//MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 10:");
383//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 9: " + res); return res;});
384 deferred.callback();
385 } else {
386//MochiKit.Logging.logDebug("+++ MainPanel.removeSelectedRecord - nothing selected");
387 }
388 },
389
390 //-------------------------------------------------------------------------
391
392 'recordDetailComponent': function() {
393//MochiKit.Logging.logDebug(">>> MainPanel.recordDetailComponent");
394 if (this._recordDetailComponent == null) {
395//MochiKit.Logging.logDebug("--- MainPanel.recordDetailComponent - 1");
396//MochiKit.Logging.logDebug("--- MainPanel.recordDetailComponent - 1 - user: " + this.user());
397 this._recordDetailComponent = new Clipperz.PM.Components.RecordDetail.MainComponent(
398 YAHOO.ext.Element.get('recordDetail'),
399 {user:this.user(), mainPanel:this}
400 );
401 }
402
403//MochiKit.Logging.logDebug("<<< MainPanel.recordDetailComponent");
404
405 return this._recordDetailComponent;
406 },
407
408 //-------------------------------------------------------------------------
409
410 'selectedRecord': function() {
411 return this._selectedRecord;
412 },
413
414 'setSelectedRecord': function(aValue) {
415 // this.hideNewRecordPanel();
416//MochiKit.Logging.logDebug(">>> MainPanel.setSelectedRecord");
417 if (aValue != this._selectedRecord) {
418//MochiKit.Logging.logDebug("--- MainPanel.setSelectedRecord - 1");
419 this._selectedRecord = aValue;
420//MochiKit.Logging.logDebug("--- MainPanel.setSelectedRecord - 2");
421 this.redrawRecordItems();
422//MochiKit.Logging.logDebug("--- MainPanel.setSelectedRecord - 3");
423 this.recordDetailComponent().setRecord(aValue);
424//MochiKit.Logging.logDebug("--- MainPanel.setSelectedRecord - 4");
425 }
426
427 if ((aValue == null) || (Clipperz.PM.Proxy.defaultProxy.isReadOnly())) {
428 this.deleteRecordButton().disable();
429 } else {
430 this.deleteRecordButton().enable();
431 }
432//MochiKit.Logging.logDebug("<<< MainPanel.setSelectedRecord");
433 },
434
435 //-------------------------------------------------------------------------
436
437 'recordAddedHandler': function(anEvent) {
438//MochiKit.Logging.logDebug(">>> MainPanel.recordAddedHandler");
439 this.recordDetailComponent();
440 this.redrawRecordItems();
441//MochiKit.Logging.logDebug("<<< MainPanel.recordAddedHandler");
442 },
443
444 'recordUpdatedHandler': function(anEvent) {
445//MochiKit.Logging.logDebug(">>> MainPanel.recordUpdatedHandler");
446 this.redrawRecordItems();
447//MochiKit.Logging.logDebug("<<< MainPanel.recordUpdatedHandler");
448 },
449
450 'recordRemovedHandler': function(anEvent) {
451//MochiKit.Logging.logDebug(">>> MainPanel.recordRemovedHandler");
452 this.setSelectedRecord(null);
453//MochiKit.Logging.logDebug("--- MainPanel.recordRemovedHandler - 1");
454 this.redrawRecordItems();
455//MochiKit.Logging.logDebug("<<< MainPanel.recordRemovedHandler");
456 },
457
458 'compareRecords': function(a, b) {
459//MochiKit.Logging.logDebug("=== compareRecords: " + a.toString() + " - " + b.toString());
460 return MochiKit.Base.compare(a.label().toLowerCase(), b.label().toLowerCase());
461 },
462
463 'redrawRecordItems': function() {
464 var template;
465 var allRecords;
466
467//MochiKit.Logging.logDebug(">>> MainPanel.redrawRecordItems");
468 MochiKit.Iter.forEach(YAHOO.ext.Element.get('records').getChildrenByTagName('li'), function(aRecordElement) {
469 MochiKit.Signal.disconnectAll(aRecordElement.dom);
470 })
471//MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 1");
472 YAHOO.ext.Element.get('records').update("");
473//MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 2");
474 allRecords = MochiKit.Base.values(this.user().records());
475//MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 3");
476 allRecords.sort(this.compareRecords);
477//MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 4");
478 template = this.recordItemTemplate();
479//MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 5");
480 MochiKit.Iter.forEach(allRecords, MochiKit.Base.bind(function(aRecord) {
481 varrecordElement;
482 recordElement = template.append('records', {
483 recordTitle:aRecord.label(),
484 recordReference:aRecord.reference(),
485 cls:((aRecord == this.selectedRecord()) ? 'selected': '')
486 }, true);
487//MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 6: " + recordElement.dom);
488 recordElement.addClassOnOver('hover');
489 MochiKit.Signal.connect(recordElement.dom, 'onclick', this, 'selectRecord');
490 }, this));
491//MochiKit.Logging.logDebug("<<< MainPanel.redrawRecordItems");
492 },
493
494 'selectRecord': function(anEvent) {
495//MochiKit.Logging.logDebug(">>> MainPanel.selectRecord");
496//MochiKit.Logging.logDebug("--- MainPanel.selectRecord !!! - ", this.user().records()[anEvent.src().id].label());
497 this.setSelectedRecord(this.user().records()[anEvent.src().id]);
498 //MochiKit.Logging.logDebug("<<< MainPanel.selectRecord");
499 },
500
501 //-------------------------------------------------------------------------
502
503 'directLoginAddedHandler': function(anEvent) {
504//MochiKit.Logging.logDebug(">>> MainPanel.recordRemovedHandler");
505 this.redrawDirectLoginItems();
506//MochiKit.Logging.logDebug("<<< MainPanel.recordRemovedHandler");
507 },
508
509 'directLoginUpdatedHandler': function(anEvent) {
510//MochiKit.Logging.logDebug(">>> MainPanel.directLoginUpdatedHandler");
511 this.redrawDirectLoginItems();
512//MochiKit.Logging.logDebug("<<< MainPanel.directLoginUpdatedHandler");
513 },
514
515 'directLoginRemovedHandler': function(anEvent) {
516//MochiKit.Logging.logDebug(">>> MainPanel.directLoginRemovedHandler");
517 this.redrawDirectLoginItems();
518//MochiKit.Logging.logDebug("<<< MainPanel.directLoginRemovedHandler");
519 },
520
521 'compareDirectLogins': function(a, b) {
522 return MochiKit.Base.compare(a.label().toLowerCase(), b.label().toLowerCase());
523 },
524
525 'redrawDirectLoginItems': function() {
526 var template;
527 var allDirectLogins;
528
529//MochiKit.Logging.logDebug(">>> MainPanel.redrawDirectLoginItems");
530 MochiKit.Iter.forEach(YAHOO.ext.Element.get('directLogins').getChildrenByTagName('li'), function(aDirectLoginElement) {
531 MochiKit.Signal.disconnectAll(aDirectLoginElement.dom);
532//MochiKit.Logging.logDebug("disconnecting IMG " + aDirectLoginElement.getChildrenByTagName('img')[0].dom.src);
533 MochiKit.Signal.disconnectAll(aDirectLoginElement.getChildrenByTagName('img')[0].dom);
534 })
535//MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 1");
536 YAHOO.ext.Element.get('directLogins').update("");
537//MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 2");
538 allDirectLogins = MochiKit.Base.values(this.user().directLoginReferences());
539//MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 3");
540 allDirectLogins.sort(this.compareDirectLogins);
541
542 if (allDirectLogins.length == 0) {
543 YAHOO.ext.Element.get('directLoginsDescription').show();
544 YAHOO.ext.Element.get('directLogins').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
545 } else {
546 YAHOO.ext.Element.get('directLoginsDescription').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
547 YAHOO.ext.Element.get('directLogins').show();
548 }
549//MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 4");
550 template = this.directLoginItemTemplate();
551//MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 5");
552 MochiKit.Iter.forEach(allDirectLogins, MochiKit.Base.bind(function(aDirectLogin) {
553 vardirectLoginElement;
554 varfaviconImageElementID;
555
556 faviconImageElementID = aDirectLogin.reference() + "_faviconIMG";
557 directLoginElement = template.append('directLogins', {
558 elementID:faviconImageElementID,
559 faviconUrl:aDirectLogin.fixedFavicon(),
560 directLoginTitle:aDirectLogin.label(),
561 directLoginReference:aDirectLogin.reference()
562 }, true);
563//MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 6: " + recordElement.dom);
564 directLoginElement.addClassOnOver("hover");
565 MochiKit.Signal.connect(directLoginElement.dom, 'onclick', this, 'handleDirectLoginClick');
566
567 MochiKit.Signal.connect(faviconImageElementID, 'onload', this, 'handleLoadedFaviconImage');
568 MochiKit.Signal.connect(faviconImageElementID, 'onerror', aDirectLogin, 'handleMissingFaviconImage');
569 MochiKit.Signal.connect(faviconImageElementID, 'onabort', aDirectLogin, 'handleMissingFaviconImage');
570
571 // YAHOO.ext.Element.get(faviconImageElementID).dom.src = aDirectLogin.fixedFavicon();
572 }, this));
573//MochiKit.Logging.logDebug("<<< MainPanel.redrawDirectLoginItems");
574 },
575
576 //-------------------------------------------------------------------------
577
578 'handleDirectLoginClick': function(anEvent) {
579 vardirectLoginReference;
580//MochiKit.Logging.logDebug(">>> MainPanel.handleDirectLoginClick !!!");
581
582 directLoginReference = this.user().directLoginReferences()[anEvent.src().id];
583 if (anEvent.target().className == 'directLoginItemEditButton') {
584 this.editDirectLogin(directLoginReference);
585 } else {
586 this.openDirectLogin(directLoginReference);
587 }
588 //MochiKit.Logging.logDebug("<<< MainPanel.handleDirectLoginClick");
589 },
590
591 'editDirectLogin': function(aDirectLoginReference) {
592//MochiKit.Logging.logDebug("=== MainPanel.editDirectLogin - " + aDirectLoginReference.label());
593 this.setSelectedRecord(aDirectLoginReference.record());
594 },
595
596 'openDirectLogin': function(aDirectLoginReference) {
597 vardeferredResult;
598 varnewWindow;
599
600//MochiKit.Logging.logDebug(">>> MainPanel.openDirectLogin - " + aDirectLoginReference.label());
601 deferredResult = new MochiKit.Async.Deferred();
602//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.openDirectLogin - 1: " + res); return res;});
603 deferredResult.addCallback(MochiKit.Base.method(aDirectLoginReference, 'setupJumpPageWindow'));
604 deferredResult.addCallback(MochiKit.Base.method(aDirectLoginReference, 'deferredDirectLogin'));
605 deferredResult.addCallback(function(aDirectLogin) {
606 aDirectLogin.runDirectLogin(newWindow);
607 });
608
609 newWindow = window.open(Clipperz.PM.Strings['directLoginJumpPageUrl'], "");
610 // MochiKit.Signal.connect(newWindow, 'onload', MochiKit.Base.method(deferredResult, 'callback', newWindow))
611 // MochiKit.Signal.connect(newWindow, 'onload', MochiKit.Base.partial(alert, "done"));
612 deferredResult.callback(newWindow);
613//MochiKit.Logging.logDebug("<<< MainPanel.openDirectLogin");
614 },
615
616 //-------------------------------------------------------------------------
617
618 'handleLoadedFaviconImage': function(anEvent) {
619//MochiKit.Logging.logDebug(">>> MainPanel.handleLoadedFaviconImage");
620 MochiKit.Signal.disconnectAll(anEvent.src())
621//MochiKit.Logging.logDebug("<<< MainPanel.handleLoadedFaviconImage");
622 },
623
624 //-------------------------------------------------------------------------
625
626 'recordItemTemplate': function() {
627 if (this._recordItemTemplate == null) {
628 this._recordItemTemplate = Clipperz.YUI.DomHelper.createTemplate({tag:'li', cls:'{cls}', id:'{recordReference}', children:[
629 {tag:'span', html:'{recordTitle}'}
630 ]});
631 this._recordItemTemplate.compile();
632 }
633
634 return this._recordItemTemplate;
635 },
636
637 'directLoginItemTemplate': function() {
638 if (this._directLoginItemTemplate == null) {
639 this._directLoginItemTemplate = Clipperz.YUI.DomHelper.createTemplate({tag:'li', id:'{directLoginReference}', children:[
640 {tag:'table', border:'0', cellpadding:'0', cellspacing:'0', children:[
641 {tag:'tbody', children:[
642 {tag:'tr', children:[
643 {tag:'td', width:'20', align:'center', valign:'top', children:[
644 {tag:'img', id:'{elementID}', src:'{faviconUrl}'}
645 ]},
646 {tag:'td', valign:'top', children:[
647 {tag:'a', cls:'directLoginItemTitle', html:'{directLoginTitle}'}
648 ]},
649 {tag:'td', valign:'top', align:'right', children:[
650 // {tag:'span', cls:'directLoginItemEditButton', htmlString:Clipperz.PM.Strings['directLinkReferenceShowButtonLabel']}
651 {tag:'a', cls:'directLoginItemEditButton', htmlString:Clipperz.PM.Strings['directLinkReferenceShowButtonLabel']}
652 ]}
653 ]}
654 ]}
655 ]}
656 ]});
657 this._directLoginItemTemplate.compile();
658 }
659
660 return this._directLoginItemTemplate;
661 },
662
663 //-------------------------------------------------------------------------
664/*
665 'newRecordButton': function() {
666 return this._newRecordButton;
667 },
668
669 'setNewRecordButton': function(aValue) {
670 this._newRecordButton = aValue;
671 },
672
673 'newRecordCancelButton': function() {
674 return this._newRecordCancelButton;
675 },
676
677 'setNewRecordCancelButton': function(aValue) {
678 this._newRecordCancelButton = aValue;
679 },
680 */
681 //-------------------------------------------------------------------------
682
683 'onkeydown': function(anEvent) {
684//MochiKit.Logging.logDebug(">>> onkeydown - " + anEvent.src().id + ": " + anEvent.key().code);
685 switch (anEvent.src().id) {
686/*
687 case this.getId('newRecordForm'):
688 if (anEvent.key().code == 13) {
689 this.newRecordButton().focus();
690 // this.addNewRecord();
691 } else if (anEvent.key().code == 27) {
692 this.newRecordCancelButton().focus();
693 this.hideNewRecordPanel(true);
694 }
695 break;
696*/
697 case "recordFilterSearchForm":
698 if (anEvent.key().code == 13) {
699//MochiKit.Logging.logDebug("SEARCH");
700 this.filterCardsWithName(YAHOO.ext.Element.get('recordFilterSearchValue').dom.value);
701 anEvent.event().stopPropagation();
702 YAHOO.ext.Element.get('recordFilterSearchValue').focus();
703 } else if (anEvent.key().code == 27) {
704 this.hideRecordFilterSearchPanel(true);
705 this.showRecordFilterAllPanel();
706 }
707 break;
708 }
709
710 },
711
712 //-------------------------------------------------------------------------
713
714 'renderRecordListBlockHeader': function(){
715 var recordListBlockHeaderElement;
716
717 recordListBlockHeaderElement = YAHOO.ext.Element.get('recordListBlockHeader');
718 recordListBlockHeaderElement.update("");
719 Clipperz.YUI.DomHelper.append(recordListBlockHeaderElement.dom,
720 {tag:'table', cls:'recordListBlockHeaderTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[
721 {tag:'tbody', children:[
722 {tag:'tr', children:[
723 {tag:'td', /*width:'50%',*/ cls:'recordBlockTitleTD', children:[
724 {tag:'h3', id:'recordBlockTitle', htmlString:Clipperz.PM.Strings['mainPanelRecordsBlockLabel']}
725 ]},
726 {tag:'td', align:'right', children:[
727 {tag:'table', id:'recordListButtonsTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[
728 {tag:'tbody', children:[
729 {tag:'tr', children:[
730 {tag:'td', cls:'recordButtonTD', align:'right', children:[
731 {tag:'div', cls:'recordButton', id:'recordListAddRecordButton'}
732 ]},
733 {tag:'td', cls:'recordButtonTD', align:'left', children:[
734 {tag:'div', cls:'recordButton', id:'recordListRemoveRecordButton'}
735 ]}
736 ]}
737 ]}
738 ]}
739 ]},
740 {tag:'td', width:'15', html:"&nbsp;"}
741 ]}
742 ]}
743 ]}
744 );
745
746 this.setAddNewRecordButton(new YAHOO.ext.Button('recordListAddRecordButton', {text:Clipperz.PM.Strings['mainPanelAddRecordButtonLabel'], handler:this.addNewRecord, scope:this}));
747 // this.setAddNewRecordButton(new YAHOO.ext.Button('recordListAddRecordButton', {text:Clipperz.PM.Strings['mainPanelAddRecordButtonLabel'], handler:this.showNewRecordPanel, scope:this}));
748 this.setDeleteRecordButton(new YAHOO.ext.Button('recordListRemoveRecordButton', {text:Clipperz.PM.Strings['mainPanelRemoveRecordButtonLabel'], handler:this.removeSelectedRecord, scope:this}));
749
750
751 if ((Clipperz.PM.Proxy.defaultProxy.isReadOnly()) || (this.selectedRecord() == null)) {
752 this.deleteRecordButton().disable();
753 }
754
755 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) {
756 this.addNewRecordButton().disable();
757 }
758
759 },
760
761 //-------------------------------------------------------------------------
762
763 'renderRecordListFilterHeader': function(){
764 var recordListFilterHeaderElement;
765
766 recordListFilterHeaderElement = YAHOO.ext.Element.get('recordListFilterHeader');
767 recordListFilterHeaderElement.update("");
768 Clipperz.YUI.DomHelper.append(recordListFilterHeaderElement.dom,
769 {tag:'div', id:'recordFiltersDIV', children:[
770 {tag:'div', id:'recordFiltersTableWrapper', children:[
771 {tag:'table', id:'recordFiltersTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[
772 {tag:'tbody', children:[
773 {tag:'tr', children:[
774 {tag:'td', id:'recordFilterAllTD', children:[{tag:'div', children:[{tag:'a', id:'recordFilterAll', htmlString:Clipperz.PM.Strings['mainPanelRecordFilterBlockAllLabel']}]}]},
775 {tag:'td', id:'recordFilterTagsTD', children:[{tag:'div', children:[{tag:'a', id:'recordFilterTags', htmlString:Clipperz.PM.Strings['mainPanelRecordFilterBlockTagsLabel']}]}]},
776 {tag:'td', id:'recordFilterSearchTD', children:[{tag:'div', children:[{tag:'a', id:'recordFilterSearch', htmlString:Clipperz.PM.Strings['mainPanelRecordFilterBlockSearchLabel']}]}]}
777 ]}
778 ]}
779 ]}
780 ]},
781 {tag:'div', id:'recordFiltersTagsPanel'},
782 {tag:'div', id:'recordFiltersSearchPanel', children:[{tag:'div', id:'recordFiltersSearchInnerPanel', children:[{tag:'div', id:'recordFiltersSearchInnerInnerPanel', children:[
783 {tag:'form', id:'recordFilterSearchForm', children:[
784 {tag:'input', type:'text', name:'search', id:'recordFilterSearchValue'}
785 ]}
786 ]}]}]}
787 ]}
788 );
789
790 /// YAHOO.ext.Element.get('recordFiltersSearchPanel').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
791 this.showRecordFilterAllPanel(false);
792
793 MochiKit.Signal.connect('recordFilterSearchForm', 'onkeydown', this, 'onkeydown');
794 MochiKit.Signal.connect('recordFilterSearchForm', 'onsubmit', this, 'onkeydown');
795
796 MochiKit.Signal.connect('recordFilterAll', 'onclick', this, 'showRecordFilterAllPanel');
797 MochiKit.Signal.connect('recordFilterTags', 'onclick', this, 'showRecordFilterTagsPanel');
798 MochiKit.Signal.connect('recordFilterSearch', 'onclick', this, 'showRecordFilterSearchPanel');
799 },
800
801 //-------------------------------------------------------------------------
802
803 'showRecordFilterAllPanel': function(shouldSlide) {
804 this.hideRecordFilterTagsPanel(shouldSlide);
805 this.hideRecordFilterSearchPanel(shouldSlide);
806 YAHOO.ext.Element.get('recordFilterAllTD').addClass('selectedTab');
807 },
808
809 'hideRecordFilterAllPanel': function(shouldSlide) {
810 YAHOO.ext.Element.get('recordFilterAllTD').removeClass('selectedTab');
811 },
812
813 //-------------------------------------------------------------------------
814
815 'showRecordFilterTagsPanel': function(shouldSlide) {
816 this.hideRecordFilterAllPanel(shouldSlide);
817 this.hideRecordFilterSearchPanel(shouldSlide);
818 YAHOO.ext.Element.get('recordFilterTagsTD').addClass('selectedTab');
819 },
820
821 'hideRecordFilterTagsPanel': function(shouldSlide) {
822 YAHOO.ext.Element.get('recordFilterTagsTD').removeClass('selectedTab');
823 },
824
825 //-------------------------------------------------------------------------
826
827 'showRecordFilterSearchPanel': function(shouldSlide) {
828 var searchPanelActor;
829
830 this.hideRecordFilterAllPanel(shouldSlide);
831 this.hideRecordFilterTagsPanel(shouldSlide);
832 YAHOO.ext.Element.get('recordFilterSearchTD').addClass('selectedTab');
833 YAHOO.ext.Element.get('recordFilterSearchValue').dom.value = "";
834
835 searchPanelActor = new YAHOO.ext.Actor('recordFiltersSearchPanel');
836
837 searchPanelActor.startCapture(true);
838 searchPanelActor.slideShow('top', 54);
839 searchPanelActor.play(MochiKit.Base.bind(function() {
840 YAHOO.ext.Element.get('recordFilterSearchValue').focus();
841 }, this));
842 },
843
844 'hideRecordFilterSearchPanel': function(shouldSlide) {
845 var searchPanelActor;
846 varcallback;
847
848 YAHOO.ext.Element.get('recordFilterSearchTD').removeClass('selectedTab');
849
850 searchPanelActor = new YAHOO.ext.Actor('recordFiltersSearchPanel');
851
852 searchPanelActor.startCapture(true)
853 if (shouldSlide === false) {
854 searchPanelActor.hide();
855 searchPanelActor.slideHide('top');
856 searchPanelActor.show();
857 } else {
858 searchPanelActor.slideHide('top');
859 }
860
861 callback = MochiKit.Base.bind(function() {
862 }, this);
863
864 searchPanelActor.play(callback);
865 },
866
867 //-------------------------------------------------------------------------
868
869 'filterCardsWithName': function(aValue) {
870MochiKit.Logging.logDebug(">>> filterCardsWithName: " + aValue);
871
872MochiKit.Logging.logDebug("<<< filterCardsWithName");
873 },
874
875 'accountLockedHandler': function() {
876 this.setSelectedRecord(null);
877 },
878
879 //-------------------------------------------------------------------------
880
881 'switchLanguageHandler': function() {
882 YAHOO.ext.Element.get('directLoginTitle').update(Clipperz.PM.Strings['mainPanelDirectLoginBlockLabel']);
883 YAHOO.ext.Element.get('directLoginsDescription').update("");
884 MochiKit.Iter.forEach(Clipperz.PM.Strings['mainPanelDirectLoginBlockDescriptionConfig'], function(aConfigItem) {
885 Clipperz.YUI.DomHelper.append(YAHOO.ext.Element.get('directLoginsDescription').dom, aConfigItem);
886 });
887 YAHOO.ext.Element.get('recordBlockTitle').update(Clipperz.PM.Strings['mainPanelRecordsBlockLabel']);
888 this.renderRecordListBlockHeader();
889 // this.renderRecordListFilterHeader();
890
891 // YAHOO.ext.Element.get('newRecordPanelTitleH2').update(Clipperz.PM.Strings['mainPanelNewRecordPanelTitle']);
892 // YAHOO.ext.Element.get('newRecordPanelTitleLabel').update(Clipperz.PM.Strings['mainPanelNewRecordPanelRecordTitleLabel']);
893 // YAHOO.ext.Element.get('newRecordPanelConfigLabel').update("");
894 // MochiKit.Iter.forEach(Clipperz.PM.Strings['mainPanelNewRecordPanelRecordConfigConfig'], function(aConfigItem) {
895 // Clipperz.YUI.DomHelper.append(YAHOO.ext.Element.get('newRecordPanelConfigLabel').dom, aConfigItem);
896 // });
897 // this.newRecordButton().setText(Clipperz.PM.Strings['mainPanelNewRecordPanelCreateButtonLabel']);
898 // this.newRecordCancelButton().setText(Clipperz.PM.Strings['mainPanelNewRecordPanelCancelButtonLabel']);
899
900 this.recordDetailComponent().render();
901 },
902
903 //-------------------------------------------------------------------------
904 __syntaxFix__: "syntax fix"
905
906});
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/ToolsPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/ToolsPanel.js
new file mode 100644
index 0000000..abd2621
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Panels/ToolsPanel.js
@@ -0,0 +1,305 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.Panels.ToolsPanel = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.Panels.ToolsPanel.superclass.constructor.call(this, anElement, args);
40
41 this._generateButtonElement = null;
42 this._needsRenderingUponTabSwitch = false;
43
44 this.render();
45
46 return this;
47}
48
49//=============================================================================
50
51YAHOO.extendX(Clipperz.PM.Components.Panels.ToolsPanel, Clipperz.PM.Components.Panels.BasePanel, {
52
53 'toString': function() {
54 return "Clipperz.PM.Components.Panels.ToolsPanel component";
55 },
56
57 //-------------------------------------------------------------------------
58
59 'render': function() {
60 var bookmarkletUrl;
61
62//MochiKit.Logging.logDebug(">>> ToolsPanel.render");
63 Clipperz.NotificationCenter.unregister(this);
64 MochiKit.Signal.disconnectAllTo(this);
65
66 if (Clipperz_IEisBroken == true) {
67 bookmarkletUrl = bookmarklet_ie;
68 } else {
69 bookmarkletUrl = bookmarklet;
70 }
71
72 this.element().update("");
73 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[
74 {tag:'tbody', children:[
75 {tag:'tr', children:[
76 {tag:'td', valign:'top', width:'200', children:[
77 {tag:'ul', id:"dataSubMenu", cls:'subMenu', children:[
78 {tag:'li', id:this.getId('passwordGenerator'), htmlString:Clipperz.PM.Strings['passwordGeneratorTabLabel']},
79 {tag:'li', id:this.getId('bookmarklet'), htmlString:Clipperz.PM.Strings['bookmarkletTabLabel']},
80 {tag:'li', id:this.getId('compact'), htmlString:Clipperz.PM.Strings['compactTabLabel']},
81 {tag:'li', id:this.getId('httpAuth'), htmlString:Clipperz.PM.Strings['httpAuthTabLabel']}
82 ]}
83 ]},
84 {tag:'td', valign:'top', children:[
85 {tag:'ul', cls:'clipperzTabPanels', children:[
86 {tag:'li', id:this.getId('passwordGeneratorPanel'), children:[
87 {tag:'div', cls:'clipperzSubPanel', children:[
88 {tag:'h5', htmlString:Clipperz.PM.Strings['passwordGeneratorTabTitle']},
89 {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['paswordGeneratorTabDescription']},
90
91 //---------------------------------------------------
92 {tag:'div', children:[
93 {tag:'form', id:this.getId('passwordGeneratorForm'), cls:'passwordGenerator', children:[
94 {tag:'input', type:'text', cls:'clipperz_passwordGenerator_password', id:this.getId('passwordField')},
95 {tag:'table', children:[
96 {tag:'tbody', children:[
97 {tag:'tr', children:[
98 {tag:'td', width:'20%', children:[
99 {tag:'input', type:'checkbox', name:'lowercase', id:this.getId('lowercase'), checked:true},
100 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorLowercaseLabel']}
101 ]},
102 {tag:'td', width:'20%', children:[
103 {tag:'input', type:'checkbox', name:'uppercase', id:this.getId('uppercase'), checked:true},
104 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorUppercaseLabel']}
105 ]},
106 {tag:'td', width:'20%', children:[
107 {tag:'input', type:'checkbox', name:'numbers', id:this.getId('numbers'), checked:true},
108 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorNumberLabel']}
109 ]},
110 {tag:'td', width:'20%', children:[
111 {tag:'input', type:'checkbox', name:'symbols', id:this.getId('symbols'), checked:true},
112 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorSymbolLabel']}
113 ]},
114 {tag:'td', width:'20%', children:[
115 {tag:'span', cls:'passwordGeneratorLength', children:[
116 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorLengthLabel']},
117 {tag:'span', id:this.getId('passwordLength'), cls:'passwordGeneratorLengthValue', html:'0'}
118 ]}
119 ]}
120 ]}
121 ]}
122 ]}
123 ]},
124 {tag:'div', id:this.getId('generateRandomPassword')}
125 ]}
126 //---------------------------------------------------
127
128 ]}
129 ]},
130 {tag:'li', id:this.getId('bookmarkletPanel'), children:[
131 {tag:'div', cls:'clipperzSubPanel', children:[
132 {tag:'h5', htmlString:Clipperz.PM.Strings['bookmarkletTabTitle']},
133 {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['bookmarkletTabDescription']},
134 {tag:'a', href:bookmarkletUrl, cls:'bookmarkletLink', htmlString:Clipperz.PM.Strings['bookmarkletTabBookmarkletTitle']},
135 {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['bookmarkletTabInstructions']}
136 ]}
137 ]},
138 {tag:'li', id:this.getId('compactPanel'), children:[
139 {tag:'div', cls:'clipperzSubPanel', children:[
140 {tag:'h5', htmlString:Clipperz.PM.Strings['compactTabTitle']},
141 {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['compactTabDescription']}
142 ]}
143 ]},
144 {tag:'li', id:this.getId('httpAuthPanel'), children:[
145 {tag:'div', cls:'clipperzSubPanel', children:[
146 {tag:'h5', htmlString:Clipperz.PM.Strings['httpAuthTabTitle']},
147 {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['httpAuthTabDescription']},
148 {tag:'div', cls:'bookmarkletConfiguration', children:[Clipperz.PM.Strings['httpAuthBookmarkletConfiguration']]}
149 ]}
150 ]}
151 ]}
152 ]}
153 ]}
154 ]}
155 ]});
156
157 new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('passwordField'));
158
159 MochiKit.Signal.connect(this.getId('lowercase'), 'onclick', this, 'updatePasswordValue');
160 MochiKit.Signal.connect(this.getId('uppercase'), 'onclick', this, 'updatePasswordValue');
161 MochiKit.Signal.connect(this.getId('numbers'), 'onclick', this, 'updatePasswordValue');
162 MochiKit.Signal.connect(this.getId('symbols'), 'onclick', this, 'updatePasswordValue');
163
164 MochiKit.Signal.connect(this.getDom('passwordField'), 'onkeyup', this, 'updatePasswordLengthLabel');
165 MochiKit.Signal.connect(this.getDom('passwordField'), 'onchange', this, 'updatePasswordLengthLabel');
166 MochiKit.Signal.connect(this.getDom('passwordField'), 'onblur', this, 'updatePasswordLengthLabel');
167
168 this.setGenerateButtonElement(new YAHOO.ext.Button(this.getDom('generateRandomPassword'), {text:Clipperz.PM.Strings['passwordGeneratorTabButtonLabel'], handler:this.updatePasswordValue, scope:this}));
169
170 this.setNeedsRenderingUponTabSwitch(false);
171 this.tabPanelController().setUp();
172 Clipperz.NotificationCenter.register(null, 'tabSelected', this, 'tabSelectedHandler');
173 Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler');
174//MochiKit.Logging.logDebug("<<< ToolsPanel.render");
175 },
176
177 //-------------------------------------------------------------------------
178
179 'needsRenderingUponTabSwitch': function() {
180 return this._needsRenderingUponTabSwitch;
181 },
182
183 'setNeedsRenderingUponTabSwitch': function(aValue) {
184 this._needsRenderingUponTabSwitch = aValue;
185 },
186
187 'tabSelectedHandler': function(anEvent) {
188 if (this.needsRenderingUponTabSwitch()) {
189 this.render();
190 }
191
192 if (anEvent.parameters() == this.getId('httpAuth')) {
193 var textarea;
194
195 textarea = document.getElementById("httpAuthDefaultConfiguration");
196 textarea.focus();
197 textarea.select();
198 }
199 },
200
201 //-------------------------------------------------------------------------
202
203 'tabPanelController': function() {
204 if (this._tabPanelController == null) {
205 var tabPanelControllerConfig;
206
207 tabPanelControllerConfig = {}
208 tabPanelControllerConfig[this.getId('passwordGenerator')] = this.getId('passwordGeneratorPanel');
209 tabPanelControllerConfig[this.getId('bookmarklet')] = this.getId('bookmarkletPanel');
210 tabPanelControllerConfig[this.getId('compact')] = this.getId('compactPanel');
211 tabPanelControllerConfig[this.getId('httpAuth')] = this.getId('httpAuthPanel');
212 this._tabPanelController = new Clipperz.PM.Components.TabPanel.TabPanelController({ config:tabPanelControllerConfig, selectedTab:this.getId('passwordGenerator') });
213 }
214
215 return this._tabPanelController;
216 },
217
218 //-------------------------------------------------------------------------
219
220 'generateButtonElement': function() {
221 return this._generateButtonElement;
222 },
223
224 'setGenerateButtonElement': function(aValue) {
225 this._generateButtonElement = aValue;
226 },
227
228 //-------------------------------------------------------------------------
229
230 'updatePasswordValue': function(anEvent) {
231 varrandomBytes;
232 varrandomValue;
233 var charset;
234 var charsetBitSize;
235 var stringValue;
236 varblockIndex;
237
238//MochiKit.Logging.logDebug(">>> updatePasswordValue");
239 randomBytes = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(50);
240 stringValue = "";
241 blockIndex = 0;
242
243 charset = "";
244 if (this.getDom('lowercase').checked) {
245 charset += Clipperz.PM.Strings['passwordGeneratorLowercaseCharset'];
246 }
247 if (this.getDom('uppercase').checked) {
248 charset += Clipperz.PM.Strings['passwordGeneratorUppercaseCharset'];
249 }
250 if (this.getDom('numbers').checked) {
251 charset += Clipperz.PM.Strings['passwordGeneratorNumberCharset'];
252 }
253 if (this.getDom('symbols').checked) {
254 charset += Clipperz.PM.Strings['passwordGeneratorSymbolCharset'];
255 }
256
257 charsetBitSize = 0;
258 while (Math.pow(2, charsetBitSize) < charset.length) {
259 charsetBitSize ++;
260 }
261
262 if (charsetBitSize > 0) {
263 while (Clipperz.PM.Crypto.passwordEntropy(stringValue) < 128) {
264 if (((blockIndex + 1)*charsetBitSize) > (randomBytes.length() * 8)) {
265 randomBytes = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(50);
266 blockIndex = 0;
267 }
268 randomValue = randomBytes.bitBlockAtIndexWithSize(blockIndex*charsetBitSize, charsetBitSize);
269 if (randomValue < charset.length) {
270 stringValue += charset.charAt(randomValue);
271 }
272
273 blockIndex ++;
274 }
275 } else {
276 stringValue = "";
277 }
278
279 this.getElement('passwordField').dom.focus()
280 this.getElement('passwordField').dom.value = stringValue;
281
282
283 if (anEvent.src) {
284 anEvent.src().focus();
285 } else {
286 this.generateButtonElement().el.focus();
287 }
288
289 this.setNeedsRenderingUponTabSwitch(true);
290
291 return false;
292//MochiKit.Logging.logDebug("<<< updatePasswordValue");
293 },
294
295 //-----------------------------------------------------
296
297 'updatePasswordLengthLabel': function() {
298 this.getElement('passwordLength').update(this.getDom('passwordField').value.length);
299 },
300
301 //-------------------------------------------------------------------------
302 __syntaxFix__: "syntax fix"
303
304});
305
diff --git a/frontend/beta/js/Clipperz/PM/Components/PasswordEntropyDisplay.js b/frontend/beta/js/Clipperz/PM/Components/PasswordEntropyDisplay.js
new file mode 100644
index 0000000..530d2cb
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/PasswordEntropyDisplay.js
@@ -0,0 +1,118 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32
33Clipperz.PM.Components.PasswordEntropyDisplay = function(anElement, args) {
34 args = args || {};
35
36//MochiKit.Logging.logDebug(">>> new TextFormField");
37 Clipperz.PM.Components.PasswordEntropyDisplay.superclass.constructor.call(this, anElement, args);
38
39 this._wrapperElement = null;
40 this._entropyElement = null;
41
42 this.render();
43//MochiKit.Logging.logDebug("<<< new TextFormField");
44
45 return this;
46};
47
48YAHOO.extendX(Clipperz.PM.Components.PasswordEntropyDisplay, Clipperz.PM.Components.BaseComponent, {
49
50 'toString': function() {
51 return "Clipperz.PM.Components.PasswordEntropyDisplay";
52 },
53
54 //-----------------------------------------------------
55
56 'wrapperElement': function() {
57 return this._wrapperElement;
58 },
59
60 'setWrapperElement': function(aValue) {
61 this._wrapperElement = aValue;
62 },
63
64 //-----------------------------------------------------
65
66 'passwordElement': function() {
67 return this.element();
68 },
69
70 //-----------------------------------------------------
71
72 'entropyElement': function() {
73 return this._entropyElement;
74 },
75
76 'setEntropyElement': function(aValue) {
77 this._entropyElement = aValue;
78 },
79
80 //-----------------------------------------------------
81
82 'render': function() {
83 MochiKit.Signal.disconnectAllTo(this);
84
85 this.setWrapperElement(this.element().wrap({tag:'div'}));
86 this.setEntropyElement(Clipperz.YUI.DomHelper.append(this.wrapperElement().dom, {tag:'div', cls:'passwordEntropy', html:"&nbsp;"}, true));
87
88 // this.entropyElement().setWidth(this.passwordElement().getWidth());
89 this.updateEntropyElement();
90
91 MochiKit.Signal.connect(this.element().dom, 'onkeyup', this, 'updateEntropyElement');
92 MochiKit.Signal.connect(this.element().dom, 'onchange', this, 'updateEntropyElement');
93 MochiKit.Signal.connect(this.element().dom, 'onblur', this, 'updateEntropyElement');
94 },
95
96 //-----------------------------------------------------
97
98 'computeEntropyForString': function(aValue) {
99 return Clipperz.PM.Crypto.passwordEntropy(aValue);
100 },
101
102 //-----------------------------------------------------
103
104 'updateEntropyElement': function(anEvent) {
105//MochiKit.Logging.logDebug(">>> PasswordEntropyDisplay.updateEntropyElement");
106 varmaxExtent;
107 varentropy;
108
109 entropy = Math.min(128, this.computeEntropyForString(this.passwordElement().dom.value));
110//MochiKit.Logging.logDebug("--- PasswordEntropyDisplay.updateEntropyElement - entropy: " + entropy);
111 this.entropyElement().setStyle('background-position', "0px " + -entropy + "px");
112 this.entropyElement().setWidth(this.passwordElement().getWidth() * (entropy/128));
113//MochiKit.Logging.logDebug("<<< PasswordEntropyDisplay.updateEntropyElement");
114 },
115
116 //-----------------------------------------------------
117 __syntaxFix__: '__syntaxFix__'
118});
diff --git a/frontend/beta/js/Clipperz/PM/Components/PasswordGenerator.js b/frontend/beta/js/Clipperz/PM/Components/PasswordGenerator.js
new file mode 100644
index 0000000..8195f2e
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/PasswordGenerator.js
@@ -0,0 +1,285 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32
33Clipperz.PM.Components.PasswordGenerator = function(anElement, aFieldValueComponent, args) {
34 args = args || {};
35
36//MochiKit.Logging.logDebug(">>> new TextFormField");
37 Clipperz.PM.Components.PasswordGenerator.superclass.constructor.call(this, anElement, args);
38
39 this._fieldValueComponent = aFieldValueComponent;
40 this._panelButton = null;
41 this.render();
42//MochiKit.Logging.logDebug("<<< new TextFormField");
43
44 return this;
45};
46
47YAHOO.extendX(Clipperz.PM.Components.PasswordGenerator, Clipperz.PM.Components.BaseComponent, {
48
49 'toString': function() {
50 return "Clipperz.PM.Components.PasswordGenerator";
51 },
52
53 //-----------------------------------------------------
54
55 'fieldValueComponent': function() {
56 return this._fieldValueComponent;
57 },
58
59 //-----------------------------------------------------
60
61 'render': function() {
62 MochiKit.Signal.disconnectAllTo(this);
63
64 // this._panelButton = new YAHOO.ext.Button(this.element().dom, {text:Clipperz.PM.Strings['passwordGeneratorButtonLabel'], handler:this.openPasswordPanel, scope:this});
65 MochiKit.Signal.connect(this.element().dom, 'onmouseenter', this, 'onMouseEnter');
66 MochiKit.Signal.connect(this.element().dom, 'onmouseleave', this, 'onMouseLeave');
67 MochiKit.Signal.connect(this.element().dom, 'onclick', this, 'openPasswordPanel');
68 },
69
70 //-----------------------------------------------------
71
72 'onMouseEnter': function() {
73 this.element().addClass('hover');
74 },
75
76 'onMouseLeave': function() {
77 this.element().removeClass('hover');
78 },
79
80 //-----------------------------------------------------
81
82 'panelButton': function() {
83 return this._panelButton;
84 },
85
86 //-----------------------------------------------------
87
88 'openPasswordPanel': function() {
89 var passwordGeneratorElement;
90 var passwordGeneratorDialog;
91 var cancelButton;
92 var okButton;
93 var cancelFunction;
94 var okFunction;
95
96//MochiKit.Logging.logDebug(">>> PasswordGenerator.openPasswordPanel");
97 passwordGeneratorElement = Clipperz.YUI.DomHelper.append(document.body, {tag:'div', id:'passwordGenerator', children:[
98 {tag:'div', cls:'ydlg-hd', htmlString:Clipperz.PM.Strings['passwordGeneratorPanelTitle']},
99 {tag:'div', cls:'ydlg-bd', children:[
100 {tag:'form', id:this.getId('passwordGeneratorForm'), cls:'passwordGenerator', children:[
101 {tag:'input', type:'text', cls:'clipperz_passwordGenerator_password', id:this.getId('passwordField')},
102 {tag:'table', children:[
103 {tag:'tbody', children:[
104 {tag:'tr', children:[
105 {tag:'td', width:'20%', children:[
106 {tag:'input', type:'checkbox', name:'lowercase', id:this.getId('lowercase'), checked:true},
107 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorLowercaseLabel']}
108 ]},
109 {tag:'td', width:'20%', children:[
110 {tag:'input', type:'checkbox', name:'uppercase', id:this.getId('uppercase'), checked:true},
111 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorUppercaseLabel']}
112 ]},
113 {tag:'td', width:'20%', children:[
114 {tag:'input', type:'checkbox', name:'numbers', id:this.getId('numbers'), checked:true},
115 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorNumberLabel']}
116 ]},
117 {tag:'td', width:'20%', children:[
118 {tag:'input', type:'checkbox', name:'symbols', id:this.getId('symbols'), checked:true},
119 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorSymbolLabel']}
120 ]},
121 {tag:'td', width:'20%', children:[
122 {tag:'span', cls:'passwordGeneratorLength', children:[
123 {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorLengthLabel']},
124 {tag:'span', id:this.getId('passwordLength'), cls:'passwordGeneratorLengthValue', html:'0'}
125 ]}
126 ]}
127 ]}
128 ]}
129 ]}
130 ]}
131 ]},
132 {tag:'div', cls:'ydlg-ft'}
133 ]}, true);
134
135 new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('passwordField'));
136
137 MochiKit.Signal.connect(this.getId('lowercase'), 'onclick', this, 'updatePasswordValue');
138 MochiKit.Signal.connect(this.getId('uppercase'), 'onclick', this, 'updatePasswordValue');
139 MochiKit.Signal.connect(this.getId('numbers'), 'onclick', this, 'updatePasswordValue');
140 MochiKit.Signal.connect(this.getId('symbols'), 'onclick', this, 'updatePasswordValue');
141
142 MochiKit.Signal.connect(this.getDom('passwordField'), 'onkeyup', this, 'updatePasswordLengthLabel');
143 MochiKit.Signal.connect(this.getDom('passwordField'), 'onchange', this, 'updatePasswordLengthLabel');
144 MochiKit.Signal.connect(this.getDom('passwordField'), 'onblur', this, 'updatePasswordLengthLabel');
145
146 this.updatePasswordValue();
147
148 passwordGeneratorDialog = new YAHOO.ext.BasicDialog(
149 passwordGeneratorElement, {
150 autoCreate:false,
151 closable:false,
152 modal:true,
153 autoTabs:false,
154 resizable:false,
155 fixedcenter:true,
156 constraintoviewport:false,
157 width:320,
158 height:130,
159 shadow:true,
160 minWidth:200,
161 minHeight:100
162 }
163 );
164
165 cancelFunction = MochiKit.Base.partial(MochiKit.Base.bind(this.cancelPasswordPanel, this), passwordGeneratorDialog);
166 passwordGeneratorDialog.addKeyListener(27, cancelFunction);
167 cancelButton = passwordGeneratorDialog.addButton(Clipperz.PM.Strings['passwordGeneratorPanelCancelLabel'], cancelFunction, this);
168
169 okFunction = MochiKit.Base.partial(MochiKit.Base.bind(this.okPasswordPanel, this), passwordGeneratorDialog);
170 passwordGeneratorDialog.addKeyListener([10, 13], okFunction);
171 okButton = passwordGeneratorDialog.addButton(Clipperz.PM.Strings['passwordGeneratorPanelOkLabel'], okFunction, this);
172
173 MochiKit.Signal.connect(this.getId('passwordGeneratorForm'), 'onsubmit', okFunction);
174
175 passwordGeneratorDialog.setDefaultButton(okButton);
176
177 this.fieldValueComponent().mainComponent().mainPanel().exitModalView();
178 this.fieldValueComponent().mainComponent().scrollToTop();
179
180 // passwordGeneratorDialog.show(this.panelButton().getEl());
181 passwordGeneratorDialog.show(this.element());
182 this.onMouseLeave();
183 },
184
185 //-----------------------------------------------------
186
187 'cancelPasswordPanel': function(aPasswordGeneratorPanel) {
188 this.fieldValueComponent().mainComponent().mainPanel().enterModalView();
189 aPasswordGeneratorPanel.hide(MochiKit.Base.bind(function() {
190 aPasswordGeneratorPanel.destroy(true);
191 MochiKit.Signal.disconnectAllTo(this);
192 }, this));
193 },
194
195 //-----------------------------------------------------
196
197 'updatePasswordLengthLabel': function() {
198 this.getElement('passwordLength').update(this.getDom('passwordField').value.length);
199 },
200
201 //-----------------------------------------------------
202
203 'okPasswordPanel': function(aPasswordGeneratorPanel, anEvent) {
204//MochiKit.Logging.logDebug(">>> PasswordGenerator.okPasswordPanel");
205
206 if (anEvent.stop) {
207 anEvent.stop();
208 }
209
210 this.fieldValueComponent().inputElement().dom.focus();
211 this.fieldValueComponent().inputElement().dom.value = this.getElement('passwordField').dom.value;
212 this.getElement('passwordField').dom.focus();
213 this.cancelPasswordPanel(aPasswordGeneratorPanel);
214
215 return false;
216 },
217
218 //-----------------------------------------------------
219
220 'updatePasswordValue': function(anEvent) {
221 varrandomBytes;
222 varrandomValue;
223 var charset;
224 var charsetBitSize;
225 var stringValue;
226 varblockIndex;
227
228//MochiKit.Logging.logDebug(">>> updatePasswordValue");
229 randomBytes = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(50);
230 stringValue = "";
231 blockIndex = 0;
232
233 charset = "";
234 if (this.getDom('lowercase').checked) {
235 charset += Clipperz.PM.Strings['passwordGeneratorLowercaseCharset'];
236 }
237 if (this.getDom('uppercase').checked) {
238 charset += Clipperz.PM.Strings['passwordGeneratorUppercaseCharset'];
239 }
240 if (this.getDom('numbers').checked) {
241 charset += Clipperz.PM.Strings['passwordGeneratorNumberCharset'];
242 }
243 if (this.getDom('symbols').checked) {
244 charset += Clipperz.PM.Strings['passwordGeneratorSymbolCharset'];
245 }
246
247 charsetBitSize = 0;
248 while (Math.pow(2, charsetBitSize) < charset.length) {
249 charsetBitSize ++;
250 }
251
252 if (charsetBitSize > 0) {
253 while (Clipperz.PM.Crypto.passwordEntropy(stringValue) < 128) {
254 if (((blockIndex + 1)*charsetBitSize) > (randomBytes.length() * 8)) {
255 randomBytes = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(50);
256 blockIndex = 0;
257 }
258 randomValue = randomBytes.bitBlockAtIndexWithSize(blockIndex*charsetBitSize, charsetBitSize);
259 if (randomValue < charset.length) {
260 stringValue += charset.charAt(randomValue);
261 }
262
263 blockIndex ++;
264 }
265 } else {
266 stringValue = "";
267 }
268
269 this.getElement('passwordField').dom.focus()
270 this.getElement('passwordField').dom.value = stringValue;
271
272
273 if (anEvent) {
274 anEvent.src().focus();
275 } else {
276 this.element().focus();
277 }
278
279 return false;
280//MochiKit.Logging.logDebug("<<< updatePasswordValue");
281 },
282
283 //-----------------------------------------------------
284 __syntaxFix__: '__syntaxFix__'
285});
diff --git a/frontend/beta/js/Clipperz/PM/Components/Printing/Footer.js b/frontend/beta/js/Clipperz/PM/Components/Printing/Footer.js
new file mode 100644
index 0000000..6bede3e
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Printing/Footer.js
@@ -0,0 +1,28 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
diff --git a/frontend/beta/js/Clipperz/PM/Components/Printing/Header.js b/frontend/beta/js/Clipperz/PM/Components/Printing/Header.js
new file mode 100644
index 0000000..6bede3e
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Printing/Header.js
@@ -0,0 +1,28 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
diff --git a/frontend/beta/js/Clipperz/PM/Components/Printing/Record.js b/frontend/beta/js/Clipperz/PM/Components/Printing/Record.js
new file mode 100644
index 0000000..910d4b1
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/Printing/Record.js
@@ -0,0 +1,95 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.Printing) == 'undefined') { Clipperz.PM.Components.Printing = {}; }
33
34Clipperz.PM.Components.Printing.Record = function(args) {
35 args = args || {};
36
37 this._record = args['record'];
38
39 return this;
40}
41
42MochiKit.Base.update(Clipperz.PM.Components.Printing.Record.prototype, {
43
44 'record': function() {
45 return this._record;
46 },
47
48 //-------------------------------------------------------------------------
49
50 'deferredDrawToWindow': function(aWindow) {
51 vardeferredResult;
52
53 deferredResult = new MochiKit.Async.Deferred();
54 deferredResult.addCallback(MochiKit.Base.method(this.record(), 'deferredData'));
55 deferredResult.addCallback(MochiKit.Base.method(this, 'appendToWindow', aWindow));
56 deferredResult.callback();
57 return deferredResult;
58 },
59
60 //-------------------------------------------------------------------------
61
62 'appendToWindow': function(aWindow) {
63 MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function() {
64 var newBlock;
65 var fields;
66
67 fields = MochiKit.Base.concat(
68 MochiKit.Base.map(MochiKit.Base.bind(function(aField) {
69 var result;
70 var dt, dd;
71 var label, value;
72
73 label = aField.label();
74 value = aField.value();
75 dt = MochiKit.DOM.createDOM('DT', null, label);
76 dd = MochiKit.DOM.createDOM('DD', null, value)
77 result = [dt, dd];
78
79 return result
80 }, this), MochiKit.Base.values(this.record().currentVersion().fields()))
81 );
82
83 newBlock = MochiKit.DOM.DIV({'class': 'recordBlock'},
84 MochiKit.DOM.H2(null, this.record().label()),
85 MochiKit.DOM.DIV({'class': 'recordNotes'}, MochiKit.Base.map(MochiKit.Base.partial(MochiKit.DOM.P, null), this.record().notes().split("\n"))),
86 MochiKit.DOM.createDOM('DL', null, fields)
87 );
88 MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, newBlock);
89
90 }, this));
91 },
92
93 //-------------------------------------------------------------------------
94 __syntaxFix__: "syntax fix"
95});
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/AbstractComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/AbstractComponent.js
new file mode 100644
index 0000000..840d555
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/AbstractComponent.js
@@ -0,0 +1,105 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.RecordDetail.AbstractComponent = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.RecordDetail.AbstractComponent.superclass.constructor.call(this, args);
40
41 this._element = anElement;
42 this._mainComponent = args.mainComponent;
43
44 return this;
45}
46
47//=============================================================================
48
49YAHOO.extendX(Clipperz.PM.Components.RecordDetail.AbstractComponent, Clipperz.PM.Components.BaseComponent, {
50
51 'toString': function() {
52 return "Clipperz.PM.Components.RecordDetail.AbstractComponent";
53 },
54
55 //-------------------------------------------------------------------------
56
57 'mainComponent': function() {
58 return this._mainComponent;
59 },
60
61 //-------------------------------------------------------------------------
62
63 'record': function() {
64 return this.mainComponent().record();
65 },
66
67 //-------------------------------------------------------------------------
68
69 'editMode': function() {
70 return this.mainComponent().editMode();
71 },
72
73 //-------------------------------------------------------------------------
74
75 'render': function() {
76 this.element().update("");
77 this.update();
78 },
79
80 //-------------------------------------------------------------------------
81
82 'update': function(anEvent) {
83 if (this.editMode() == 'EDIT') {
84 this.updateEditMode();
85 } else if (this.editMode() == 'VIEW') {
86 this.updateViewMode();
87 }
88 },
89
90 //-------------------------------------------------------------------------
91
92 'updateViewMode': function() {},
93 'updateEditMode': function() {},
94 'synchronizeComponentValues': function() {},
95
96 //-------------------------------------------------------------------------
97
98 'destroy': function() {
99 this.element().remove();
100 },
101
102 //-------------------------------------------------------------------------
103 __syntaxFix__: "syntax fix"
104});
105
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/AbstractFieldSubComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/AbstractFieldSubComponent.js
new file mode 100644
index 0000000..7596184
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/AbstractFieldSubComponent.js
@@ -0,0 +1,77 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.RecordDetail.AbstractFieldSubComponent = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.RecordDetail.AbstractFieldSubComponent.superclass.constructor.call(this, anElement, args);
40
41 this._fieldComponent = args.fieldComponent || null;
42
43 this.render();
44
45 return this;
46}
47
48//=============================================================================
49
50YAHOO.extendX(Clipperz.PM.Components.RecordDetail.AbstractFieldSubComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, {
51
52 'toString': function() {
53 return "Clipperz.PM.Components.RecordDetail.AbstractFieldSubComponent";
54 },
55
56 //-------------------------------------------------------------------------
57
58 'fieldComponent': function() {
59 return this._fieldComponent;
60 },
61
62 //-------------------------------------------------------------------------
63
64 'mainComponent': function() {
65 return this.fieldComponent().mainComponent();
66 },
67
68 //-------------------------------------------------------------------------
69
70 'recordField': function() {
71 return this.fieldComponent().recordField();
72 },
73
74 //-------------------------------------------------------------------------
75 __syntaxFix__: "syntax fix"
76});
77
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/CreationWizard.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/CreationWizard.js
new file mode 100644
index 0000000..a92285f
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/CreationWizard.js
@@ -0,0 +1,317 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.RecordDetail.CreationWizard = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.RecordDetail.CreationWizard.superclass.constructor.call(this, anElement, args);
40
41 this._mainComponent = args.mainComponent;
42 this._previouslySelectedRecord = args.previouslySelectedRecord;
43//MochiKit.Logging.logDebug("--- new CreationWizard - previouslySelectedRecord: " + args.previouslySelectedRecord);
44 this._createButton_header = null;
45 this._createButton_footer = null;
46
47 this._cancelButton_header = null;
48 this._cancelButton_footer = null;
49
50 this.render();
51
52 return this;
53}
54
55//=============================================================================
56
57YAHOO.extendX(Clipperz.PM.Components.RecordDetail.CreationWizard, Clipperz.PM.Components.BaseComponent, {
58
59 'toString': function() {
60 return "Clipperz.PM.Components.RecordDetail.CreationWizard component";
61 },
62
63 //-------------------------------------------------------------------------
64
65 'previouslySelectedRecord': function() {
66 return this._previouslySelectedRecord;
67 },
68
69 //-------------------------------------------------------------------------
70
71 'render': function() {
72 vartemplateListElement;
73 vartemplates;
74
75 this.element().update("");
76
77 Clipperz.YUI.DomHelper.append(this.element().dom,
78 {tag:'form', cls:'recordDataFORM', id:this.getId('form'), children:[
79 {tag:'div', id:'recordDetailDataBox', cls:'recordDetailDataBox', children:[
80 {tag:'div', id:this.getId('wizardBox'), cls:'recordCreationWizard', children:[
81 {tag:'div', id:this.getId('recordCreationWizardTitleBox'), cls:'recordCreationWizardTitleBox', htmlString:Clipperz.PM.Strings['newRecordWizardTitleBox']},
82 {tag:'ul', id:this.getId('templateList'), cls:'radioList'}
83 ]}
84 ]}
85 ]}
86 );
87
88 Clipperz.YUI.DomHelper.append(this.getDom('recordCreationWizardTitleBox'), {tag:'div', cls:'newRecordWizardHeader', children:[
89 {tag:'table', width:'100%', cellpadding:'5', children:[
90 {tag:'tbody', children:[
91 {tag:'tr', children:[
92 {tag:'td', width:'49%', align:'right', children:[
93 {tag:'div', id:this.getId('cancelButton_header')}
94 ]},
95 {tag:'td', width:'10', html:'&nbsp;'},
96 {tag:'td', width:'49%', align:'left', children:[
97 {tag:'div', id:this.getId('createButton_header')}
98 ]}
99 ]}
100 ]}
101 ]}
102 ]});
103
104 templateListElement = this.getElement('templateList');
105 templates = Clipperz.PM.Strings['recordTemplates'];
106 MochiKit.Iter.forEach(MochiKit.Base.keys(templates), MochiKit.Base.bind(function(aTemplateKey) {
107 Clipperz.YUI.DomHelper.append(templateListElement.dom, {tag:'li', children:[
108 {tag:'table', children:[
109 {tag:'tbody', children:[
110 {tag:'tr', children:[
111 {tag:'td', valign:'top', children:[
112 {tag:'input', id:this.getId(aTemplateKey+"_radio"), type:'radio', name:'recordTemplate', value:"aTemplateKey"}
113 ]},
114 {tag:'td', valign:'top', children:[
115 {tag:'h4', id:this.getId(aTemplateKey+"_title"), html:templates[aTemplateKey]['title']},
116 {tag:'div', cls:'templateDescription', htmlString:templates[aTemplateKey]['description']}
117 ]}
118 ]}
119 ]}
120 ]}
121 ]});
122 this.getElement(aTemplateKey+"_radio").dom.value = aTemplateKey;
123 MochiKit.Signal.connect(this.getDom(aTemplateKey+"_title"), 'onclick', MochiKit.Base.partial(function(aRadioButton) {aRadioButton.click();}, this.getDom(aTemplateKey+"_radio")));
124 }, this));
125
126 Clipperz.YUI.DomHelper.append(templateListElement.dom, {tag:'li', children:[
127 {tag:'table', children:[
128 {tag:'tbody', children:[
129 {tag:'tr', children:[
130 {tag:'td', valign:'top', children:[
131 {tag:'input', type:'radio', name:'recordTemplate', id:this.getId('bookmarkletRadioButton'), value:'BookmarkletConfigurationTemplate'}
132 ]},
133 {tag:'td', valign:'top', children:[
134 {tag:'h4', htmlString:Clipperz.PM.Strings['newRecordWizardBookmarkletConfigurationTitle']},
135 {tag:'div', cls:'templateDescription', htmlString:Clipperz.PM.Strings['newRecordWizardBookmarkletConfigurationDescription']},
136 {tag:'div', cls:'bookmarkletConfiguration', children:[
137 // {tag:'span', htmlString:Clipperz.PM.Strings['newRecordWizardBookmarkletConfigurationLabel']},
138 {tag:'div', htmlString:Clipperz.PM.Strings['recordDetailNewDirectLoginDescription']},
139 {tag:'textarea', id:this.getId('bookmarkletConfiguration')}
140 ]}
141 ]}
142 ]}
143 ]}
144 ]}
145 ]});
146
147 Clipperz.YUI.DomHelper.append(this.getDom('wizardBox'), {tag:'div', cls:'newRecordWizardFooter', children:[
148 {tag:'table', width:'100%', cellpadding:'5', children:[
149 {tag:'tbody', children:[
150 {tag:'tr', children:[
151 {tag:'td', width:'49%', align:'right', children:[
152 {tag:'div', id:this.getId('cancelButton_footer')}
153 ]},
154 {tag:'td', width:'10', html:'&nbsp;'},
155 {tag:'td', width:'49%', align:'left', children:[
156 {tag:'div', id:this.getId('createButton_footer')}
157 ]}
158 ]}
159 ]}
160 ]}
161 ]});
162
163 this.setCreateButton_header(new YAHOO.ext.Button(this.getDom('createButton_header'), {text:Clipperz.PM.Strings['newRecordWizardCreateButtonLabel'], handler:this.createRecord, scope:this}));
164 this.setCreateButton_footer(new YAHOO.ext.Button(this.getDom('createButton_footer'), {text:Clipperz.PM.Strings['newRecordWizardCreateButtonLabel'], handler:this.createRecord, scope:this}));
165
166 this.setCancelButton_header(new YAHOO.ext.Button(this.getDom('cancelButton_header'), {text:Clipperz.PM.Strings['newRecordWizardCancelButtonLabel'], handler:this.exitWizard, scope:this}));
167 this.setCancelButton_footer(new YAHOO.ext.Button(this.getDom('cancelButton_footer'), {text:Clipperz.PM.Strings['newRecordWizardCancelButtonLabel'], handler:this.exitWizard, scope:this}));
168
169 this.createButton_header().disable();
170 this.createButton_footer().disable();
171
172 MochiKit.Iter.forEach(this.getElement('form').getChildrenByTagName('input'), MochiKit.Base.bind(function(anInput) {
173 // MochiKit.Signal.connect(anInput.dom, 'onchange', this, 'enableCreateButton');
174 MochiKit.Signal.connect(anInput.dom, 'onclick', this, 'enableCreateButton'); //for Safari
175 },this));
176
177 MochiKit.Signal.connect(this.getDom('bookmarkletConfiguration'), 'onkeyup', this, 'enableCreateButton');
178 MochiKit.Signal.connect(this.getDom('bookmarkletConfiguration'), 'onkeydown', this, 'enableCreateButton'); //for Safari
179 },
180
181 //-------------------------------------------------------------------------
182
183 'createButton_header': function() {
184 return this._createButton_header;
185 },
186
187 'setCreateButton_header': function(aValue) {
188 this._createButton_header = aValue;
189 },
190
191 //.........................................................................
192
193 'createButton_footer': function() {
194 return this._createButton_footer;
195 },
196
197 'setCreateButton_footer': function(aValue) {
198 this._createButton_footer = aValue;
199 },
200
201
202 //-------------------------------------------------------------------------
203
204 'cancelButton_header': function() {
205 return this._cancelButton_header;
206 },
207
208 'setCancelButton_header': function(aValue) {
209 this._cancelButton_header = aValue;
210 },
211
212 //.........................................................................
213
214 'cancelButton_footer': function() {
215 return this._cancelButton_footer;
216 },
217
218 'setCancelButton_footer': function(aValue) {
219 this._cancelButton_footer = aValue;
220 },
221
222 //-------------------------------------------------------------------------
223
224 'enableCreateButton': function(anEvent, skipKeyDownCheck) {
225//MochiKit.Logging.logDebug(">>> CreationWizard.enableCreateButton (" + anEvent.type() + ")");
226 if ((anEvent.type() == "keydown") && (skipKeyDownCheck != true)) {
227//MochiKit.Logging.logDebug("--- CreationWizard.enableCreateButton - handling 'keydown' event with a postponed execution of the check");
228 MochiKit.Async.callLater(0.3, MochiKit.Base.method(this, 'enableCreateButton', anEvent, true));
229 } else {
230 var shouldEnableCreateButton;
231 var isBookmarkletConfigurationEmpty;
232
233//MochiKit.Logging.logDebug("--- CreationWizard.enableCreateButton - common execution");
234
235 shouldEnableCreateButton = true;
236
237 isBookmarkletConfigurationEmpty = !/[^ \n]/.test(this.getDom('bookmarkletConfiguration').value);
238//MochiKit.Logging.logDebug("--- CreationWizard.enableCreateButton - isBookmarkletConfigurationEmpty: " + isBookmarkletConfigurationEmpty);
239
240 if ((anEvent.src() == this.getDom('bookmarkletConfiguration')) && !isBookmarkletConfigurationEmpty) {
241 this.getDom('bookmarkletRadioButton').checked = true;
242 }
243
244 if ((this.getDom('bookmarkletRadioButton').checked) && isBookmarkletConfigurationEmpty) {
245 shouldEnableCreateButton = false;
246 }
247
248 if (shouldEnableCreateButton) {
249//MochiKit.Logging.logDebug("--- CreationWizard.enableCreateButton - enabling button");
250 this.createButton_header().enable();
251 this.createButton_footer().enable();
252 } else {
253//MochiKit.Logging.logDebug("--- CreationWizard.enableCreateButton - disabling button");
254 this.createButton_header().disable();
255 this.createButton_footer().disable();
256 }
257 }
258//MochiKit.Logging.logDebug("<<< CreationWizard.enableCreateButton");
259 },
260
261 //-------------------------------------------------------------------------
262
263 'createRecord': function() {
264 varselectedTemplateKey;
265 varnewRecord;
266
267 selectedTemplateKey = MochiKit.Base.filter(function(aCheckBoxElement) {
268 return aCheckBoxElement.dom.checked;
269 },this.getElement('form').getChildrenByTagName('input'))[0].dom.value;
270
271//MochiKit.Logging.logDebug("--- CreationWizard.createRecord - selectedTemplateKey: " + selectedTemplateKey);
272 if (selectedTemplateKey == 'BookmarkletConfigurationTemplate') {
273 var bookmarkletConfiguration;
274
275 this.mainComponent().exitModalView();
276 bookmarkletConfiguration = Clipperz.PM.BookmarkletProcessor.checkBookmarkletConfiguration(this.getDom('bookmarkletConfiguration').value, this.getDom('createButton'), MochiKit.Base.method(this.mainComponent(), 'enterModalView'));
277 this.mainComponent().enterModalView();
278 newRecord = Clipperz.PM.BookmarkletProcessor.createRecordFromBookmarkletConfiguration(this.mainComponent().user(), bookmarkletConfiguration);
279 } else {
280 varfieldsConfigurations;
281
282 newRecord = this.mainComponent().user().addNewRecord();
283 newRecord.setLabel(Clipperz.PM.Strings['recordTemplates'][selectedTemplateKey]['title']);
284
285 fieldsConfigurations = Clipperz.PM.Strings['recordTemplates'][selectedTemplateKey]['fields'];
286
287 MochiKit.Iter.forEach(fieldsConfigurations, MochiKit.Base.partial(function(aRecord, aFieldConfiguration) {
288 var newField;
289
290 newField = new Clipperz.PM.DataModel.RecordField({recordVersion:aRecord.currentVersion()});
291 newField.setLabel(aFieldConfiguration['label']);
292 newField.setType(aFieldConfiguration['type']);
293 aRecord.currentVersion().addField(newField);
294 }, newRecord));
295 }
296
297 this.mainComponent().exitWizard(newRecord, true);
298 },
299
300 //-------------------------------------------------------------------------
301
302 'exitWizard': function() {
303//MochiKit.Logging.logDebug(">>> CreationWizard.exitWizard - " + this.previouslySelectedRecord());
304 this.mainComponent().exitWizard(this.previouslySelectedRecord());
305//MochiKit.Logging.logDebug("<<< CreationWizard.exitWizard");
306 },
307
308 //-------------------------------------------------------------------------
309
310 'mainComponent': function() {
311 return this._mainComponent;
312 },
313
314 //-------------------------------------------------------------------------
315 __syntaxFix__: "syntax fix"
316});
317
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js
new file mode 100644
index 0000000..6171a4e
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js
@@ -0,0 +1,174 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent = function(anElement, args) {
37//MochiKit.Logging.logDebug(">>> new DirectLoginBindingComponent");
38 args = args || {};
39
40 Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent.superclass.constructor.call(this, anElement, args);
41
42 this._directLoginBinding = args.directLoginBinding || null;
43 this.render();
44
45 Clipperz.NotificationCenter.register(this.record(), 'addNewRecordField',this, 'syncAndUpdateEditMode');
46 Clipperz.NotificationCenter.register(this.record(), 'removedField', this, 'syncAndUpdateEditMode');
47 Clipperz.NotificationCenter.register(this.record(), 'updatedFieldLabel',this, 'syncAndUpdateEditMode');
48//MochiKit.Logging.logDebug("<<< new DirectLoginBindingComponent");
49
50 return this;
51}
52
53//=============================================================================
54
55YAHOO.extendX(Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, {
56
57 'toString': function() {
58 return "Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent component";
59 },
60
61 //-------------------------------------------------------------------------
62
63 'directLoginBinding': function() {
64 return this._directLoginBinding;
65 },
66
67 //-------------------------------------------------------------------------
68
69 'render': function() {
70 // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', style:'font-weight:bold;', html:this.directLoginBinding().key()})
71 // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', html:this.directLoginBinding().value()})
72//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.render");
73 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginBindingLabelTD', children:[
74 {tag:'span', html:this.directLoginBinding().key()}
75 ]});
76//MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.render - 1");
77 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginBindingValueTD', children:[
78 {tag:'div', id:this.getId('editModeBox'), children:[
79 {tag:'select', id:this.getId('select'), children:this.recordFieldOptions()}
80 ]},
81 {tag:'div', id:this.getId('viewModeBox'), children:[
82 {tag:'span', id:this.getId('viewValue'), html:""}
83 ]}
84 ]});
85//MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.render - 2");
86 this.getElement('editModeBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
87 this.getElement('viewModeBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
88
89 this.update();
90//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.render");
91 },
92
93 //-------------------------------------------------------------------------
94
95 'recordFieldOptions': function() {
96 varresult;
97 var option;
98 varrecordFieldKey;
99 varrecordFields;
100
101//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.recordFieldOptions");
102 recordFields = this.directLoginBinding().directLogin().record().currentVersion().fields();
103 result = [];
104 option = {tag:'option', value:null, html:'---'};
105 result.push(option);
106 for (recordFieldKey in recordFields) {
107 //TODO: remove the value: field and replace it with element.dom.value = <some value>
108 option = {tag:'option', value:recordFieldKey, html:recordFields[recordFieldKey].label()}
109 if (recordFieldKey == this.directLoginBinding().fieldKey()) {
110 option['selected'] = true;
111 }
112 result.push(option);
113 }
114//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.recordFieldOptions");
115
116 return result;
117 },
118
119 //-------------------------------------------------------------------------
120
121 'syncAndUpdateEditMode': function() {
122 this.synchronizeComponentValues();
123 this.updateEditMode();
124 },
125
126 'updateEditMode': function() {
127 varselectElementBox;
128
129//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.updateEditMode");
130 this.getElement('viewModeBox').hide();
131
132 selectElementBox = this.getElement('editModeBox');
133 selectElementBox.update("");
134
135 Clipperz.YUI.DomHelper.append(selectElementBox.dom, {tag:'select', id:this.getId('select'), children:this.recordFieldOptions()});
136
137/*
138 selectElement = this.getElement('select');
139
140 selectElement.update("");
141 MochiKit.Iter.forEach(this.recordFieldOptions(), function(anOption) {
142 Clipperz.YUI.DomHelper.append(selectElement.dom, anOption);
143 });
144*/
145
146
147 this.getElement('editModeBox').show();
148//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.updateEditMode");
149 },
150
151 //-------------------------------------------------------------------------
152
153 'updateViewMode': function() {
154//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.updateViewMode");
155 this.getElement('editModeBox').hide();
156 this.getElement('viewModeBox').show();
157
158 this.getElement('viewValue').update(this.directLoginBinding().field().label());
159//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.updateViewMode");
160 },
161
162 //-------------------------------------------------------------------------
163
164 'synchronizeComponentValues': function() {
165//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.synchronizeComponentValues")
166//MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.synchronizeComponentValues - 1 - " + this.getId('select'));
167 this.directLoginBinding().setFieldKey(this.getDom('select').value);
168//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.synchronizeComponentValues");
169 },
170
171 //-------------------------------------------------------------------------
172 __syntaxFix__: "syntax fix"
173});
174
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginComponent.js
new file mode 100644
index 0000000..7638f00
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginComponent.js
@@ -0,0 +1,362 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.RecordDetail.DirectLoginComponent = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.RecordDetail.DirectLoginComponent.superclass.constructor.call(this, anElement, args);
40
41 this._directLogin = args.directLogin || null;
42 //this._titleElement = null;
43 this._structureElement = null;
44 this._removeButton = null;
45 this._directLoginBindingComponents = null;
46 this._collapser = null;
47
48 this.mainComponent().addEditComponent(this);
49 this.render();
50
51 return this;
52}
53
54//=============================================================================
55
56YAHOO.extendX(Clipperz.PM.Components.RecordDetail.DirectLoginComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, {
57
58 'toString': function() {
59 return "Clipperz.PM.Components.RecordDetail.DirectLoginComponent component";
60 },
61
62 //-------------------------------------------------------------------------
63
64 'directLogin': function() {
65 return this._directLogin;
66 },
67
68 'directLoginBindingComponents': function() {
69 return this._directLoginBindingComponents;
70 },
71
72 //-------------------------------------------------------------------------
73
74 'removeDirectLogin': function() {
75//MochiKit.Logging.logDebug(">>> DirectLoginComponent.removeDirectLogin");
76 this.mainComponent().synchronizeComponentValues();
77 this.directLogin().remove();
78 this.mainComponent().removeEditComponent(this);
79 this.mainComponent().render();
80//MochiKit.Logging.logDebug("<<< DirectLoginComponent.removeDirectLogin");
81 },
82
83 //-------------------------------------------------------------------------
84/*
85 'formDataValue': function() {
86 return Clipperz.Base.serializeJSON(this.directLogin().formData());
87 },
88
89 'setFormDataValue': function(aValue) {
90
91 },
92 */
93 //-------------------------------------------------------------------------
94
95 'removeButton': function() {
96 return this._removeButton;
97 },
98
99 'setRemoveButton': function(aValue) {
100 this._removeButton = aValue;
101 },
102
103 //-------------------------------------------------------------------------
104/*
105 'titleElement': function() {
106 return this._titleElement;
107 },
108
109 'setTitleElement': function(aValue) {
110 this._titleElement = aValue;
111 },
112 */
113 //-------------------------------------------------------------------------
114
115 'structureElement': function() {
116 return this._structureElement;
117 },
118
119 'setStructureElement': function(aValue) {
120 this._structureElement = aValue;
121 },
122
123 //-------------------------------------------------------------------------
124
125 'render': function() {
126//MochiKit.Logging.logDebug(">>> DirectLoginComponent.render");
127 try {
128 this.element().update("");
129 Clipperz.YUI.DomHelper.append(this.element().dom,
130 {tag:'li', children:[
131 {tag:'table', width:'100%', border:'0', cellpadding:'0', cellspacing:'0', children:[
132 {tag:'tbody', children:[
133 {tag:'tr', children:[
134 {tag:'td', rowspan:'2', width:'30', valign:'top', html:'&#160', children:[
135 {tag:'div', id:this.getId('removeDirectLogin'), children:[
136 {tag:'div', id:this.getId('removeDirectLoginButton')}
137 ]},
138 {tag:'div', id:this.getId('collapseLink'), cls:'directLoginCollapseLink'}
139 ]},
140 {tag:'td', valign:'top', children:[
141 {tag:'table', width:'100%', border:'0', cellpadding:'0', cellspacing:'0', children:[
142 {tag:'tbody', children:[
143 {tag:'tr', children:[
144 {tag:'td', width:'20', valign:'top', children:[
145 {tag:'a', href:'#', id:this.getId('directLogin'), children:[
146 {tag:'img', id:this.getId('faviconImage'), width:'16', height:'16', src:this.directLogin().fixedFavicon()}
147 ]}
148 ]},
149 {tag:'td', valign:'top', children:[
150 {tag:'div', cls:'directLoginDetailTitle', children:[
151 {tag:'div', id:this.getId('titleViewBox'), children:[
152 {tag:'a', href:'#', id:this.getId('titleLink')}
153 ]},
154 {tag:'div', id:this.getId('titleEditBox'), children:[
155 {tag:'input', type:'text', id:this.getId('titleInput')}
156 ]}
157 ]}
158 ]}
159 ]}
160 ]}
161 ]}
162 ]}
163 ]},
164 {tag:'tr', children:[
165 {tag:'td', /*colspan:'2',*/ children:[
166 {tag:'div', id:this.getId('details'), children:[
167 {tag:'table', cls:'directLoginBindings', border:'0', cellpadding:'0', cellspacing:'0', children:[
168 {tag:'tbody', id:this.getId('tbodyBindings'), children:[]}
169 ]}
170 ]}
171 ]}
172 ]}
173 ]}
174 ]}
175 ]}
176 );
177
178 MochiKit.Signal.connect(this.getId('faviconImage'), 'onload', this, 'handleLoadedFaviconImage');
179 MochiKit.Signal.connect(this.getId('faviconImage'), 'onerror', this.directLogin(), 'handleMissingFaviconImage');
180 MochiKit.Signal.connect(this.getId('faviconImage'), 'onabort', this.directLogin(), 'handleMissingFaviconImage');
181
182 this.getElement('removeDirectLogin').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
183//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 1");
184 this.getElement('collapseLink').addClassOnOver('hover');
185 this._collapser = new Clipperz.YUI.Collapser(this.getElement('collapseLink'), this.getElement('details'), true);
186//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 2");
187 MochiKit.Signal.connect(this.getId('directLogin'), 'onclick', this, 'runDirectLogin');
188 // this.getElement('directLogin').on('click', this.runDirectLogin, this, false);
189//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 3");
190 // this.setTitleElement(new Clipperz.PM.Components.TextFormField(this.getElement('title'), {
191 // editMode:this.editMode(),
192 // value:this.directLogin().label()
193 // }));
194 this.getElement('titleViewBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
195 this.getElement('titleEditBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
196 //- this.getElement('titleLink').on('click', this.runDirectLogin, this, false);
197 MochiKit.Signal.connect(this.getId('titleLink'), 'onclick', this, 'runDirectLogin');
198
199//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 4");
200 //- this.setStructureElement(new Clipperz.PM.Components.TextFormField(this.getElement('formStructure'), {
201 //- editMode:this.editMode(),
202 //- value:this.formDataValue(), multiline:true
203 //- }));
204//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 5");
205 {
206 varbindingKey;
207 var valueName;
208 var inputsRequiringAdditionalValues;
209 var bindingsElement;
210 var i,c;
211
212//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 6");
213 this._directLoginBindingComponents = [];
214//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 7");
215 bindingsElement = this.getElement('tbodyBindings');
216//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 8");
217 for (bindingKey in this.directLogin().bindings()) {
218 try {
219 var directLoginBindingElement;
220 var directLoginBindingComponent;
221
222//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 9");
223 directLoginBindingElement = Clipperz.YUI.DomHelper.append(bindingsElement.dom, {tag:'tr'}, true);
224//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 10");
225 directLoginBindingComponent =new Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent(directLoginBindingElement, {
226 mainComponent:this,
227 directLoginBinding:this.directLogin().bindings()[bindingKey]
228 });
229//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 11");
230 this._directLoginBindingComponents.push(directLoginBindingComponent);
231 } catch (e) {
232 MochiKit.Logging.logError("Error while rendering a DirectLoginBindingComponent - " + e);
233 }
234//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 12");
235 }
236//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 13");
237
238 inputsRequiringAdditionalValues = this.directLogin().inputsRequiringAdditionalValues();
239//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 13.1");
240 for (valueName in inputsRequiringAdditionalValues) {
241 //- Clipperz.YUI.DomHelper.append(bindingsElement.dom, {tag:'tr', children:[
242 //- {tag:'td', html:valueName},
243 //- {tag:'td', children:inputsRequiringAdditionalValues[valueName].inputElementConfiguration()}
244 //- ]}, true)
245 var directLoginValueElement;
246 var directLoginValueComponent;
247
248//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 13.2");
249 directLoginValueElement = Clipperz.YUI.DomHelper.append(bindingsElement.dom, {tag:'tr'}, true);
250//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 13.3");
251 directLoginValueComponent =new Clipperz.PM.Components.RecordDetail.DirectLoginValueComponent(directLoginValueElement, {
252 mainComponent:this,
253 directLoginInputValue:inputsRequiringAdditionalValues[valueName]
254 });
255//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 13.4");
256 this._directLoginBindingComponents.push(directLoginValueComponent);
257//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 13.5");
258 }
259//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 13.6");
260 }
261//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 14");
262 this.setRemoveButton(new YAHOO.ext.Button(this.getDom('removeDirectLoginButton'), {text:Clipperz.PM.Strings['recordDetailDeleteDirectLoginButtonLabel'], handler:this.removeDirectLogin, scope:this}));
263//MochiKit.Logging.logDebug("--- DirectLoginComponent.render - 15");
264 this.update();
265 } catch (e) {
266 MochiKit.Logging.logError("Error while rendering a DirectLoginComponent - " + e);
267 }
268//MochiKit.Logging.logDebug("<<< DirectLoginComponent.render");
269 },
270
271 //-------------------------------------------------------------------------
272
273 'collapser': function() {
274 return this._collapser;
275 },
276
277 //-------------------------------------------------------------------------
278
279 'handleLoadedFaviconImage': function(anEvent) {
280 MochiKit.Signal.disconnectAll(anEvent.src())
281 },
282
283 //-------------------------------------------------------------------------
284
285 'update': function() {
286 var i,c;
287 var bindingComponents;
288
289//MochiKit.Logging.logDebug(">>> DirectLoginComponent.update");
290 bindingComponents = this.directLoginBindingComponents();
291 c = bindingComponents.length;
292 for (i=0; i<c; i++) {
293 bindingComponents[i].update();
294 }
295
296 Clipperz.PM.Components.RecordDetail.DirectLoginComponent.superclass.update.call(this);
297//MochiKit.Logging.logDebug("<<< DirectLoginComponent.update");
298 },
299
300 //-------------------------------------------------------------------------
301
302 'updateEditMode': function() {
303 // this.element().update("");
304 // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', style:'border:4px solid red; padding:10px;', children:[
305 // {tag:'div', style:'font-weight:bold;', html:this.directLogin().label()},
306 // {tag:'div', style:'border:1px solid #aaaaaa;', html:Clipperz.Base.serializeJSON(this.directLogin().formData())},
307 // {tag:'div', style:'border:1px solid #aaaaaa;', html:Clipperz.Base.serializeJSON(this.directLogin().bindings())}
308 // ]});
309
310 this.getElement('titleEditBox').show();
311 this.getElement('titleViewBox').hide();
312
313 this.getDom('titleInput').value = this.directLogin().label();
314
315//MochiKit.Logging.logDebug(">>> DirectLoginComponent.updateEditMode");
316 this.collapser().expand();
317 this.getElement('collapseLink').hide();
318 this.getElement('removeDirectLogin').show();
319 // this.removeButton().show();
320//MochiKit.Logging.logDebug("<<< DirectLoginComponent.updateEditMode");
321 },
322
323 //-------------------------------------------------------------------------
324
325 'updateViewMode': function() {
326//MochiKit.Logging.logDebug(">>> DirectLoginComponent.updateViewMode");
327 this.getElement('titleEditBox').hide();
328 this.getElement('titleViewBox').show();
329 this.getElement('titleLink').update(this.directLogin().label());
330
331 this.getElement('collapseLink').show();
332 this.getElement('removeDirectLogin').hide();
333 // this.removeButton().hide();
334//MochiKit.Logging.logDebug("<<< DirectLoginComponent.updateViewMode");
335 },
336
337 //-------------------------------------------------------------------------
338
339 'synchronizeComponentValues': function() {
340//MochiKit.Logging.logDebug(">>> DirectLoginComponent.syncronizeComponentValues");
341 this.directLogin().setLabel(this.getDom('titleInput').value);
342 // this.setFormDataValue(this.structureElement().value());
343
344 MochiKit.Iter.forEach(this.directLoginBindingComponents(), MochiKit.Base.methodcaller('synchronizeComponentValues'));
345//MochiKit.Logging.logDebug("<<< DirectLoginComponent.syncronizeComponentValues");
346 },
347
348 //-------------------------------------------------------------------------
349
350 'runDirectLogin': function(anEvent) {
351//MochiKit.Logging.logDebug("--- DirectLoginComponent.runDirectLogin - 1");
352//MochiKit.Logging.logDebug("--- DirectLoginComponent.runDirectLogin - 1 anEvent: " + anEvent);
353 anEvent.stop();
354//MochiKit.Logging.logDebug("--- DirectLoginComponent.runDirectLogin - 2");
355 this.directLogin().runDirectLogin();
356//MochiKit.Logging.logDebug("--- DirectLoginComponent.runDirectLogin - 3");
357 },
358
359 //-------------------------------------------------------------------------
360 __syntaxFix__: "syntax fix"
361});
362
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginValueComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginValueComponent.js
new file mode 100644
index 0000000..e70229b
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginValueComponent.js
@@ -0,0 +1,257 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.RecordDetail.DirectLoginValueComponent = function(anElement, args) {
37//MochiKit.Logging.logDebug(">>> new DirectLoginValueComponent");
38 args = args || {};
39
40 Clipperz.PM.Components.RecordDetail.DirectLoginValueComponent.superclass.constructor.call(this, anElement, args);
41
42 this._directLoginInputValue = args.directLoginInputValue || null;
43 this._value = this.directLoginInputValue().directLogin().formValues()[this.directLoginInputValue().name()];
44
45 this.render();
46//MochiKit.Logging.logDebug("<<< new DirectLoginValueComponent - record: " + this.record());
47
48 return this;
49}
50
51//=============================================================================
52
53YAHOO.extendX(Clipperz.PM.Components.RecordDetail.DirectLoginValueComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, {
54
55 'toString': function() {
56 return "Clipperz.PM.Components.RecordDetail.DirectLoginValueComponent component - " + this.directLoginInputValue().name();
57 },
58
59 //-------------------------------------------------------------------------
60
61 'directLoginInputValue': function() {
62 return this._directLoginInputValue;
63 },
64
65 //-------------------------------------------------------------------------
66
67 'render': function() {
68//MochiKit.Logging.logDebug(">>> DirectLoginValueComponent.render");
69 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginDataLabelTD', children:[
70 {tag:'span', html:this.directLoginInputValue().name()}
71 ]});
72//MochiKit.Logging.logDebug("--- DirectLoginValueComponent.render - 1");
73 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginDataValueTD', children:[
74 {tag:'span', id:this.getId('inputElement')}
75 ]});
76//MochiKit.Logging.logDebug("--- DirectLoginValueComponent.render - 2");
77 this.update();
78//MochiKit.Logging.logDebug("<<< DirectLoginValueComponent.render");
79 },
80
81 //-------------------------------------------------------------------------
82
83 'inputElementConfiguration': function() {
84 var result;
85 var currentValue;
86
87//MochiKit.Logging.logDebug(">>> DirectLoginValueComponent.inputElementConfiguration - " + this.directLoginInputValue().name());
88 result = [];
89 currentValue = this.value();
90
91 switch (this.directLoginInputValue().type()) {
92 case 'checkbox':
93 var checkbox;
94//{"type":"checkbox", "name":"rememberUsernameChk", "value":"checkbox"}
95 checkbox = {tag:'input', id:this.getId('checkbox'), type:'checkbox'}
96 if (currentValue == true) {
97 checkbox.checked = true;
98 }
99 result.push(checkbox);
100 break;
101
102 case 'select':
103 var input;
104//{"type":"select", "name":"DOMAIN", "options":[{"selected":true, "label":"@tin.it", "value":"tin.it"}, {"selected":false, "label":"@virgilio.it", "value":"virgilio.it"}]}
105 input = {tag:'select', id:this.getId('select'), name:this.directLoginInputValue().name(), children:[]};
106 input.children.push({tag:'option', value:null, html:"---"});
107 MochiKit.Iter.forEach(this.directLoginInputValue().args()['options'], function(anOption) {
108 var option;
109
110 //TODO: remove the value: field and replace it with element.dom.value = <some value>
111 option = {tag:'option', value:anOption['value'], html:anOption['label']}
112 if (currentValue == anOption['value']) {
113 option.selected = true;
114 }
115 input.children.push(option);
116 })
117 result.push(input);
118 break;
119
120 case 'radio':
121 var name;
122 var radioBox;
123
124//MochiKit.Logging.logDebug("--- DirectLoginValueComponent.inputElementConfiguration - 3");
125 name = this.getId(this.directLoginInputValue().name());
126 radioBox = {tag:'div', id:this.getId('radioBox'), children:[]};
127 result.push(radioBox);
128//MochiKit.Logging.logDebug("--- DirectLoginValueComponent.inputElementConfiguration - 3.1 - options.length: " + this.directLoginInputValue().args()['options'].length);
129//{"name":"dominio", "type":"radio", "options":[{"value":"@alice.it", "checked":true}, {"value":"@tin.it", "checked":false}, {"value":"@virgilio.it", "checked":false}, {"value":"@tim.it", "checked":false}]}
130
131 MochiKit.Iter.forEach(this.directLoginInputValue().args()['options'], function(anOption) {
132 varradio;
133
134//MochiKit.Logging.logDebug("--- DirectLoginValueComponent.inputElementConfiguration - 3.1.1");
135 //TODO: remove the value: field and replace it with element.dom.value = <some value>
136 radio = {tag:'input', type:'radio', name:name, value:anOption['value']};
137//MochiKit.Logging.logDebug("--- DirectLoginValueComponent.inputElementConfiguration - 3.1.2");
138 if (currentValue == anOption['value']) {
139//MochiKit.Logging.logDebug("--- DirectLoginValueComponent.inputElementConfiguration - 3.1.3");
140 radio.checked = true;
141//MochiKit.Logging.logDebug("--- DirectLoginValueComponent.inputElementConfiguration - 3.1.4");
142 }
143//MochiKit.Logging.logDebug("--- DirectLoginValueComponent.inputElementConfiguration - 3.1.5");
144 radioBox.children.push({tag:'div', children:[ radio, {tag:'span', html:anOption['value']} ]})
145//MochiKit.Logging.logDebug("--- DirectLoginValueComponent.inputElementConfiguration - 3.1.6");
146 })
147//MochiKit.Logging.logDebug("--- DirectLoginValueComponent.inputElementConfiguration - 3.2");
148 break;
149 }
150//MochiKit.Logging.logDebug("<<< DirectLoginValueComponent.inputElementConfiguration");
151
152 return result;
153 },
154
155 //-------------------------------------------------------------------------
156
157 'inputValue': function() {
158 var result;
159
160 switch (this.directLoginInputValue().type()) {
161 case 'checkbox':
162 result = this.getDom('checkbox').checked;
163 break;
164 case 'select':
165 result = this.getDom('select').value;
166 break;
167 case 'radio':
168 var checkedRadioButtons;
169
170 checkedRadioButtons = MochiKit.Base.filter(function(aRadioButton) { return aRadioButton.dom.checked },
171 this.getElement('radioBox').getChildrenByTagName('input'));
172
173 if (checkedRadioButtons.length == 0) {
174 result = null;
175 } else {
176 result = checkedRadioButtons[0].dom.value;
177 }
178 break;
179 }
180
181 return result;
182 },
183
184 //-------------------------------------------------------------------------
185
186 'value': function() {
187 return this._value;
188 },
189
190 'setValue': function(aValue) {
191 this._value = aValue;
192 },
193
194 //-------------------------------------------------------------------------
195
196 'updateEditMode': function() {
197//MochiKit.Logging.logDebug(">>> DirectLoginValueComponent.updateEditMode - " + this);
198 this.getElement('inputElement').update("");
199//MochiKit.Logging.logDebug("--- DirectLoginValueComponent.updateEditMode - 1");
200 Clipperz.YUI.DomHelper.append(this.getDom('inputElement'), {tag:'div', children:this.inputElementConfiguration()});
201//MochiKit.Logging.logDebug("<<< DirectLoginValueComponent.updateEditMode");
202 },
203
204 //-------------------------------------------------------------------------
205
206 'updateViewMode': function() {
207//MochiKit.Logging.logDebug(">>> DirectLoginValueComponent.updateViewMode");
208 // this.getElement('inputElement').update(this.directLoginInputValue().value());
209
210 this.getElement('inputElement').update("");
211
212 switch (this.directLoginInputValue().type()) {
213 case 'checkbox':
214 if (this.value() == true) {
215 this.getElement('inputElement').update(Clipperz.PM.Strings['directLoginConfigurationCheckBoxFieldSelectedValue']);
216 } else {
217 this.getElement('inputElement').update(Clipperz.PM.Strings['directLoginConfigurationCheckBoxFieldNotSelectedValue'])
218 }
219 break;
220 case 'select':
221 var displayedValue;
222 var selectedOptions;
223 var currentValue;
224
225 currentValue = this.value();
226 selectedOptions = MochiKit.Base.filter(function(anOption) { return (anOption['value'] == currentValue); },
227 this.directLoginInputValue().args()['options']);
228 if (selectedOptions.length == 0) {
229 displayedValue = "---";
230 } else {
231//MochiKit.Logging.logDebug("+++ " + Clipperz.Base.serializeJSON(selectedOptions));
232//MochiKit.Logging.logDebug("*** " + Clipperz.Base.serializeJSON(selectedOptions[0]));
233 displayedValue = selectedOptions[0]['label'];
234 }
235 this.getElement('inputElement').update(displayedValue);
236 break;
237 case 'radio':
238 this.getElement('inputElement').update(this.value());
239 break;
240 }
241//MochiKit.Logging.logDebug("<<< DirectLoginValueComponent.updateViewMode");
242 },
243
244 //-------------------------------------------------------------------------
245
246 'synchronizeComponentValues': function() {
247//MochiKit.Logging.logDebug(">>> DirectLoginValueComponent.synchronizeComponentValues");
248//MochiKit.Logging.logDebug("--- DirectLoginValueComponent.synchronizeComponentValues - 1; value: " + this.inputValue());
249 this.setValue(this.inputValue());
250 this.directLoginInputValue().directLogin().formValues()[this.directLoginInputValue().name()] = this.value();
251//MochiKit.Logging.logDebug("<<< DirectLoginValueComponent.synchronizeComponentValues");
252 },
253
254 //-------------------------------------------------------------------------
255 __syntaxFix__: "syntax fix"
256});
257
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginsComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginsComponent.js
new file mode 100644
index 0000000..3292a95
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginsComponent.js
@@ -0,0 +1,199 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.RecordDetail.DirectLoginsComponent = function(anElement, args) {
37//MochiKit.Logging.logDebug(">>> new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent");
38 args = args || {};
39
40//MochiKit.Logging.logDebug("--- new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent - 0");
41 Clipperz.PM.Components.RecordDetail.DirectLoginsComponent.superclass.constructor.call(this, anElement, args);
42//MochiKit.Logging.logDebug("--- new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent - 1");
43
44 this._addDirectLoginButton = null;
45
46//MochiKit.Logging.logDebug("--- new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent - 2");
47 this.mainComponent().addEditComponent(this);
48//MochiKit.Logging.logDebug("--- new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent - 3");
49 this.render();
50//MochiKit.Logging.logDebug("<<< new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent");
51
52 return this;
53}
54
55//=============================================================================
56
57YAHOO.extendX(Clipperz.PM.Components.RecordDetail.DirectLoginsComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, {
58
59 'toString': function() {
60 return "Clipperz.PM.Components.RecordDetail.DirectLoginsComponent component";
61 },
62
63 //-------------------------------------------------------------------------
64
65 'addDirectLoginButton': function() {
66 return this._addDirectLoginButton;
67 },
68
69 'setAddDirectLoginButton': function(aValue) {
70 this._addDirectLoginButton = aValue;
71 },
72
73 //-------------------------------------------------------------------------
74
75 'render': function() {
76 this.element().update("");
77
78 Clipperz.YUI.DomHelper.append(this.element().dom,
79 {tag:'div', cls:'directLoginsRecordBox', children:[
80 {tag:'h3', htmlString:Clipperz.PM.Strings['recordDetailDirectLoginBlockTitle']},
81 {tag:'ul', id:this.getId('directLogins')},
82
83 {tag:'div', cls:'addDirectLoginBox', id:this.getId('addDirectLogin'), children:[
84 {tag:'div', cls:'addDirectLoginBoxContent', children:[
85 {tag:'div', cls:'bookmarkletConfiguration', children:[
86 // {tag:'span', htmlString:Clipperz.PM.Strings['newRecordWizardBookmarkletConfigurationLabel']},
87 {tag:'div', htmlString:Clipperz.PM.Strings['recordDetailNewDirectLoginDescription']},
88 {tag:'textarea', id:this.getId('addDirectLoginTextarea')}
89 ]},
90 {tag:'div', id:this.getId('addDirectLoginButton')}
91 ]}
92 ]}
93 ]}
94 );
95
96 if (MochiKit.Base.keys(this.record().directLogins()).length == 0) {
97//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 3");
98 Clipperz.YUI.DomHelper.append(this.getElement('directLogins'),
99 {tag:'li', children:[
100 // {tag:'span', htmlString:Clipperz.PM.Strings['recordDetailDirectLoginBlockNoDirectLoginConfiguredLabel']}
101 {tag:'div', cls:'recordDetailNoDirectLoginDescriptionBox', htmlString:Clipperz.PM.Strings['recordDetailDirectLoginBlockNoDirectLoginConfiguredDescription']}
102 ]}
103 );
104//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 4");
105 } else {
106//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 5");
107 for (directLoginReference in this.record().directLogins()) {
108//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 6");
109 this.addDirectLogin(this.record().directLogins()[directLoginReference]);
110//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 7");
111 }
112//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 8");
113 }
114//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 9");
115
116 this.setAddDirectLoginButton(new YAHOO.ext.Button(this.getDom('addDirectLoginButton'), {
117 text:Clipperz.PM.Strings['recordDetailAddNewDirectLoginButtonLabel'],
118 handler:this.addNewDirectLogin,
119 scope:this
120 }));
121 MochiKit.Signal.connect(this.getId('addDirectLoginTextarea'), 'onkeydown', this, 'onkeydown');
122//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 11");
123
124 this.update();
125//MochiKit.Logging.logDebug("<<< DirectLoginsComponent.render");
126 },
127
128 //-------------------------------------------------------------------------
129
130 'addDirectLogin': function(aDirectLogin) {
131//MochiKit.Logging.logDebug(">>> DirectLoginsComponent.addDirectLogin");
132 new Clipperz.PM.Components.RecordDetail.DirectLoginComponent(
133 Clipperz.YUI.DomHelper.append(this.getDom('directLogins'), {tag:'div'}, true),
134 {
135 mainComponent:this.mainComponent(),
136 directLogin:aDirectLogin
137 }
138 );
139//MochiKit.Logging.logDebug("<<< DirectLoginsComponent.addDirectLogin");
140 },
141
142 //-------------------------------------------------------------------------
143
144 'addNewDirectLogin': function() {
145 varnewDirectLogin;
146 varconfiguration;
147
148//MochiKit.Logging.logDebug(">>> DirectLoginsComponent.addNewDirectLogin");
149 if (MochiKit.Base.keys(this.record().directLogins()).length == 0) {
150 this.getElement('directLogins').update("");
151 }
152
153 this.mainComponent().synchronizeComponentValues();
154
155 this.mainComponent().exitModalView();
156 configuration = Clipperz.PM.BookmarkletProcessor.checkBookmarkletConfiguration(
157 this.getDom('addDirectLoginTextarea').value,
158 this.getDom('addDirectLoginButton'),
159 MochiKit.Base.method(this.mainComponent(), 'enterModalView')
160 );
161 this.mainComponent().enterModalView();
162
163 newDirectLogin = new Clipperz.PM.DataModel.DirectLogin({record:this.record(),
164 label:configuration['page']['title'],
165 bookmarkletVersion:'0.2',
166 // bookmarkletVersion:configuration['version'],
167 formData:configuration['form']});
168 this.record().addDirectLogin(newDirectLogin);
169 this.addDirectLogin(newDirectLogin);
170 this.getDom('addDirectLoginTextarea').value = "";
171//MochiKit.Logging.logDebug("<<< DirectLoginsComponent.addNewDirectLogin");
172 },
173
174 //-------------------------------------------------------------------------
175
176 'updateViewMode': function() {
177 this.getElement('addDirectLogin').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
178 this.getElement('addDirectLogin').hide();
179 },
180
181 //-------------------------------------------------------------------------
182
183 'updateEditMode': function() {
184 this.getElement('addDirectLogin').show();
185 },
186
187 //-------------------------------------------------------------------------
188
189 'onkeydown': function(anEvent) {
190//MochiKit.Logging.logDebug(">>> onkeydown - " + anEvent.src().id + ": " + anEvent.key().code);
191 if (anEvent.key().code == 13) {
192 this.addNewDirectLogin();
193 }
194 },
195
196 //-------------------------------------------------------------------------
197 __syntaxFix__: "syntax fix"
198});
199
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldButtonComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldButtonComponent.js
new file mode 100644
index 0000000..9e1d56a
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldButtonComponent.js
@@ -0,0 +1,117 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.RecordDetail.FieldButtonComponent = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.RecordDetail.FieldButtonComponent.superclass.constructor.call(this, anElement, args);
40
41 this._button = null;
42
43 this.render();
44
45 return this;
46}
47
48//=============================================================================
49
50YAHOO.extendX(Clipperz.PM.Components.RecordDetail.FieldButtonComponent, Clipperz.PM.Components.RecordDetail.AbstractFieldSubComponent, {
51
52 'toString': function() {
53 return "Clipperz.PM.Components.RecordDetail.FieldButtonComponent";
54 },
55
56 //-------------------------------------------------------------------------
57
58 'buttonText': function() {
59 varresult;
60
61 if (this.recordField() == null) {
62 //TODO: this is never used. It is just an obsolete legacy chunk of code
63 result = Clipperz.PM.Strings['recordDetailAddFieldButtonLabel'];
64 } else {
65 result = Clipperz.PM.Strings['recordDetailRemoveFieldButtonLabel'];
66 }
67
68 return result;
69 },
70
71 //-------------------------------------------------------------------------
72
73 'button': function() {
74 return this._button;
75 },
76
77 'setButton': function(aValue) {
78 this._button = aValue;
79 },
80
81 //-------------------------------------------------------------------------
82
83 'render': function() {
84 this.element().update("");
85
86 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', id:this.getId('button')})
87 this.setButton(new YAHOO.ext.Button(this.getDom('button'), {text:this.buttonText(), handler:this.handleButtonClick, scope:this}));
88
89 this.update();
90 },
91
92 //-------------------------------------------------------------------------
93
94 'handleButtonClick': function() {
95 if (this.recordField() == null) {
96 this.mainComponent().addNewField();
97 } else {
98 this.mainComponent().removeField(this.fieldComponent());
99 }
100 },
101
102 //-------------------------------------------------------------------------
103
104 'updateEditMode': function() {
105 this.button().show();
106 },
107
108 //-------------------------------------------------------------------------
109
110 'updateViewMode': function() {
111 this.button().hide();
112 },
113
114 //-------------------------------------------------------------------------
115 __syntaxFix__: "syntax fix"
116});
117
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldComponent.js
new file mode 100644
index 0000000..c2d947e
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldComponent.js
@@ -0,0 +1,189 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.RecordDetail.FieldComponent = function(anElement, args) {
37//MochiKit.Logging.logDebug(">>> new FieldComponent");
38 args = args || {};
39
40 Clipperz.PM.Components.RecordDetail.FieldComponent.superclass.constructor.call(this, anElement, args);
41
42 this._element = anElement;
43 this._recordField = args.recordField || null;
44
45 this._buttonComponent = null;
46 this._labelComponent = null;
47 this._dragHandler = null;
48 this._valueComponent = null;
49 this._typeComponent = null;
50
51 this.mainComponent().addEditComponent(this);
52
53 this.render();
54
55 return this;
56}
57
58//=============================================================================
59
60YAHOO.extendX(Clipperz.PM.Components.RecordDetail.FieldComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, {
61
62 'toString': function() {
63 return "Clipperz.PM.Components.RecordDetail.FieldComponent component";
64 },
65
66 //-------------------------------------------------------------------------
67
68 'recordField': function() {
69 return this._recordField;
70 },
71
72 //-------------------------------------------------------------------------
73
74 'buttonComponent': function() {
75 return this._buttonComponent;
76 },
77
78 'setButtonComponent': function(aValue) {
79 this._buttonComponent = aValue;
80 },
81
82 //-------------------------------------------------------------------------
83
84 'labelComponent': function() {
85 return this._labelComponent;
86 },
87
88 'setLabelComponent': function(aValue) {
89 this._labelComponent = aValue;
90 },
91
92 //-------------------------------------------------------------------------
93
94 'dragHandler': function() {
95 return this._dragHandler;
96 },
97
98 'setDragHandler': function(aValue) {
99 this._dragHandler = aValue;
100 },
101
102 //-------------------------------------------------------------------------
103
104 'valueComponent': function() {
105 return this._valueComponent;
106 },
107
108 'setValueComponent': function(aValue) {
109 this._valueComponent = aValue;
110 },
111
112 //-------------------------------------------------------------------------
113
114 'typeComponent': function() {
115 return this._typeComponent;
116 },
117
118 'setTypeComponent': function(aValue) {
119 this._typeComponent = aValue;
120 },
121
122 //-------------------------------------------------------------------------
123
124 'render': function() {
125//MochiKit.Logging.logDebug(">>> RecordDetail.FieldComponent.render");
126 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td',/* width:'32',*/ height:'24', cls:'removeFieldButton', align:'left', valign:'top', id:this.getId('button')});
127 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td',/* width:'25%',*/ valign:'top', id:this.getId('label')});
128 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td',/* width:'3',*/ valign:'top', id:this.getId('dragHandler')});
129 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td',/* width:'50%',*/ valign:'top', children:[
130 {tag:'div', cls:'Clipperz_recordFieldData', id:this.getId('value')}
131 ]});
132
133
134 this.setButtonComponent(new Clipperz.PM.Components.RecordDetail.FieldButtonComponent(this.getElement('button'), {fieldComponent:this}));
135 this.setLabelComponent(new Clipperz.PM.Components.RecordDetail.FieldLabelComponent(this.getElement('label'), {fieldComponent:this}));
136 this.setDragHandler(new Clipperz.PM.Components.RecordDetail.FieldDragHandler(this.getElement('dragHandler'), {fieldComponent:this}));
137 this.setValueComponent(new Clipperz.PM.Components.RecordDetail.FieldValueComponent(this.getElement('value'), {fieldComponent:this}));
138
139 if (this.editMode() == 'EDIT') {
140 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td',/* width:'60',*/ align:'left', cls:'fieldTypeTD', valign:'top', id:this.getId('type')});
141 this.setTypeComponent(new Clipperz.PM.Components.RecordDetail.FieldTypeComponent(this.getElement('type'), {fieldComponent:this}));
142 }
143
144 this.update();
145//MochiKit.Logging.logDebug("<<< RecordDetail.FieldComponent.render");
146 },
147
148 //-------------------------------------------------------------------------
149
150 'handleButtonClick': function() {
151 this.mainComponent().record().removeField(this.recordField());
152
153 // if (this.recordField() == null) {
154 // this.mainComponent().record().addNewField();
155 // } else {
156 // this.mainComponent().record().removeField(this.recordField());
157 // }
158 },
159
160 //-------------------------------------------------------------------------
161
162 'update': function(anEvent) {
163//MochiKit.Logging.logDebug(">>> RecordDetail.FieldComponent.update");
164 this.buttonComponent().update();
165 this.labelComponent().update();
166 this.dragHandler().update();
167 this.valueComponent().update();
168 if (this.editMode() == 'EDIT') {
169 this.typeComponent().update();
170 }
171//MochiKit.Logging.logDebug("<<< RecordDetail.FieldComponent.update");
172 },
173
174 //-------------------------------------------------------------------------
175
176 'synchronizeComponentValues': function() {
177//MochiKit.Logging.logDebug(">>> FieldComponent.synchronizeComponentValues");
178 this.labelComponent().synchronizeComponentValues();
179 this.valueComponent().synchronizeComponentValues();
180 if (this.editMode() == 'EDIT') {
181 this.typeComponent().synchronizeComponentValues();
182 }
183//MochiKit.Logging.logDebug("<<< FieldComponent.synchronizeComponentValues");
184 },
185
186 //-------------------------------------------------------------------------
187 __syntaxFix__: "syntax fix"
188});
189
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldDragHandler.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldDragHandler.js
new file mode 100644
index 0000000..13a08fc
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldDragHandler.js
@@ -0,0 +1,59 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.RecordDetail.FieldDragHandler = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.RecordDetail.FieldDragHandler.superclass.constructor.call(this, anElement, args);
40
41 this._element = anElement;
42
43 this.render();
44
45 return this;
46}
47
48//=============================================================================
49
50YAHOO.extendX(Clipperz.PM.Components.RecordDetail.FieldDragHandler, Clipperz.PM.Components.RecordDetail.AbstractFieldSubComponent, {
51
52 'toString': function() {
53 return "Clipperz.PM.Components.RecordDetail.FieldDragHandler component";
54 },
55
56 //-------------------------------------------------------------------------
57 __syntaxFix__: "syntax fix"
58});
59
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldLabelComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldLabelComponent.js
new file mode 100644
index 0000000..3bbcd1d
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldLabelComponent.js
@@ -0,0 +1,141 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.RecordDetail.FieldLabelComponent = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.RecordDetail.FieldLabelComponent.superclass.constructor.call(this, anElement, args);
40
41 this._inputElement = null;
42
43 this.render();
44
45 return this;
46}
47
48//=============================================================================
49
50YAHOO.extendX(Clipperz.PM.Components.RecordDetail.FieldLabelComponent, Clipperz.PM.Components.RecordDetail.AbstractFieldSubComponent, {
51
52 'toString': function() {
53 return "Clipperz.PM.Components.RecordDetail.FieldLabelComponent component";
54 },
55
56 //-------------------------------------------------------------------------
57
58 'value': function() {
59 return this.recordField().label();
60 },
61
62 //-------------------------------------------------------------------------
63
64 'inputElement': function() {
65 return this._inputElement;
66 },
67
68 'setInputElement': function(aValue) {
69 this._inputElement = aValue;
70 },
71
72 //-------------------------------------------------------------------------
73
74 'render': function() {
75 varnewTextFormField;
76 this.element().update("");
77 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', cls:'Clipperz_recordFieldLabel', id:this.getId('label')});
78 // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', style:'font-size:8pt;', html:this.recordField().key()});
79
80 // this.setInputElement(new Clipperz.PM.Components.TextFormField(this.getElement('label'), {editMode:this.editMode(), value:this.value()}));
81 newTextFormField = new Clipperz.PM.Components.TextFormField(this.getElement('label'), {editMode:this.editMode(), value:this.value()});
82 // newTextFormField.inputElement().setStyle({border:'3px solid cyan;'});
83 newTextFormField.on('change', this.notifyChanges, this, true)
84 // this.inputElement().on('change', function() {alert("CHANGE");});
85 // this.inputElement().getElement('editComponent_input').on('change', function() {alert("CHANGE");})
86 // this.inputElement().on('blur', this.notifyChanges, this, true);
87
88 this.setInputElement(newTextFormField);
89 this.update();
90 },
91
92 'notifyChanges': function() {
93//MochiKit.Logging.logDebug(">>> FieldLabelComponent.notifyChanges - " + this);
94 this.synchronizeComponentValues();
95 Clipperz.NotificationCenter.notify(this.recordField().recordVersion().record(), 'updatedFieldLabel');
96//MochiKit.Logging.logDebug("<<< FieldLabelComponent.notifyChanges");
97 },
98
99 //-------------------------------------------------------------------------
100
101 'update': function() {
102//MochiKit.Logging.logDebug(">>> FieldLabelComponent.update");
103 this.inputElement().update({editMode:this.editMode(), value:this.value()});
104//MochiKit.Logging.logDebug("<<< FieldLabelComponent.update");
105 },
106
107 //-------------------------------------------------------------------------
108/*
109 'updateViewMode': function() {
110 varwidth;
111 varelement;
112
113 this.element().update("");
114 width = this.element().getWidth();
115 element = Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', html:this.value()}, true);
116 element.setWidth(width-1);
117 },
118
119 //-------------------------------------------------------------------------
120
121 'updateEditMode': function() {
122 varwidth;
123
124 this.element().update("");
125 width = this.element().getWidth(true);
126 this.setInputElement(Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'input', type:'text', value:this.value()}, true));
127 this.inputElement().setWidth(width-1);
128 },
129*/
130 //-------------------------------------------------------------------------
131
132 'synchronizeComponentValues': function() {
133 if (this.inputElement() != null) {
134 this.recordField().setLabel(this.inputElement().value());
135 }
136 },
137
138 //-------------------------------------------------------------------------
139 __syntaxFix__: "syntax fix"
140});
141
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldTypeComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldTypeComponent.js
new file mode 100644
index 0000000..3bdd093
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldTypeComponent.js
@@ -0,0 +1,157 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.RecordDetail.FieldTypeComponent = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.RecordDetail.FieldTypeComponent.superclass.constructor.call(this, anElement, args);
40
41 this._inputElement = null;
42
43 this.render();
44
45 return this;
46}
47
48//=============================================================================
49
50YAHOO.extendX(Clipperz.PM.Components.RecordDetail.FieldTypeComponent, Clipperz.PM.Components.RecordDetail.AbstractFieldSubComponent, {
51
52 'toString': function() {
53 return "Clipperz.PM.Components.RecordDetail.FieldTypeComponent component";
54 },
55
56 //-------------------------------------------------------------------------
57
58 'inputElement': function() {
59 return this._inputElement;
60 },
61
62 'setInputElement': function(aValue) {
63 this._inputElement = aValue;
64 },
65
66 //-------------------------------------------------------------------------
67
68 'value': function() {
69 return this.recordField().type();
70 },
71
72 'canChangeType': function() {
73 var value;
74 var result;
75
76 value = this.value();
77 result = ((value == 'TXT') || (value == 'PWD') || (value == 'URL') || (value == 'DATE') || (value == 'ADDR'));
78
79 return result
80 },
81
82 //-------------------------------------------------------------------------
83
84 'updateViewMode': function() {
85 this.element().update("");
86 if (this.canChangeType()) {
87 varwidth;
88 var element;
89
90 width = this.element().getWidth(true);
91 element = Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', html:this.recordField().typeShortDescription()}, true);
92 element.setWidth(width-1);
93 }
94 },
95
96 //-------------------------------------------------------------------------
97
98 'updateEditMode': function() {
99 this.element().update("");
100
101 if (this.canChangeType()) {
102 varwidth;
103
104 width = this.element().getWidth(true);
105 this.setInputElement(Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'select', children:[
106 {tag:'option', value:'TXT', htmlString:Clipperz.PM.Strings['recordFieldTypologies']['TXT']['shortDescription']},
107 {tag:'option', value:'PWD', htmlString:Clipperz.PM.Strings['recordFieldTypologies']['PWD']['shortDescription']},
108 {tag:'option', value:'URL', htmlString:Clipperz.PM.Strings['recordFieldTypologies']['URL']['shortDescription']},
109 {tag:'option', value:'DATE', htmlString:Clipperz.PM.Strings['recordFieldTypologies']['DATE']['shortDescription']},
110 {tag:'option', value:'ADDR', htmlString:Clipperz.PM.Strings['recordFieldTypologies']['ADDR']['shortDescription']}
111
112 // {tag:'option', value:'CHECK', html:Clipperz.PM.DataModel.RecordField.TypeDescriptions['CHECK']['shortDescription']},
113 // {tag:'option', value:'RADIO', html:Clipperz.PM.DataModel.RecordField.TypeDescriptions['RADIO']['shortDescription']},
114 // {tag:'option', value:'CHECK', html:Clipperz.PM.DataModel.RecordField.TypeDescriptions['SELECT']['shortDescription']}
115 // {tag:'option', value:'NOTE', html:Clipperz.PM.DataModel.RecordField.TypeDescriptions['NOTE']['shortDescription']}
116 ]}, true));
117 this.inputElement().setWidth(width-1);
118 this.inputElement().addHandler('change', true, this.onChange, this, true);
119 // this.selectCorrectOption();
120 Clipperz.DOM.selectOptionMatchingValue(this.inputElement().dom, this.value());
121 }
122 },
123
124 //-------------------------------------------------------------------------
125
126 'onChange': function() {
127 this.synchronizeComponentValues();
128 this.fieldComponent().valueComponent().handleTypeChange();
129 },
130
131 //-------------------------------------------------------------------------
132/*
133 'selectCorrectOption': function() {
134 varoptions;
135 var i,c;
136
137 options = this.inputElement().getChildrenByTagName('option');
138 c = options.length;
139 for (i=0; i<c; i++) {
140 if (options[i].dom.value == this.value()) {
141 options[i].dom.selected = true;
142 }
143 }
144 },
145 */
146 //-------------------------------------------------------------------------
147
148 'synchronizeComponentValues': function() {
149 if (this.inputElement() != null) {
150 this.recordField().setType(this.inputElement().dom.value);
151 }
152 },
153
154 //-------------------------------------------------------------------------
155 __syntaxFix__: "syntax fix"
156});
157
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldValueComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldValueComponent.js
new file mode 100644
index 0000000..a30992a
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldValueComponent.js
@@ -0,0 +1,275 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.RecordDetail.FieldValueComponent = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.RecordDetail.FieldValueComponent.superclass.constructor.call(this, anElement, args);
40
41 this._inputElement = null;
42 this._scrambledStatus = 'SCRAMBLED'; //'UNSCRAMBLED'
43
44 this.render();
45
46 return this;
47}
48
49//=============================================================================
50
51YAHOO.extendX(Clipperz.PM.Components.RecordDetail.FieldValueComponent, Clipperz.PM.Components.RecordDetail.AbstractFieldSubComponent, {
52
53 'toString': function() {
54 return "Clipperz.PM.Components.RecordDetail.FieldValueComponent component";
55 },
56
57 //-------------------------------------------------------------------------
58
59 'value': function() {
60 return this.recordField().value();
61 },
62
63 'setValue': function(aValue) {
64 this.recordField().setValue(aValue);
65 },
66
67 //-------------------------------------------------------------------------
68
69 'inputElement': function() {
70 return this._inputElement;
71 },
72
73 'setInputElement': function(aValue) {
74 this._inputElement = aValue;
75 },
76
77 //-------------------------------------------------------------------------
78
79 'scrambledStatus': function() {
80 return this._scrambledStatus;
81 },
82
83 'setScrambledStatus': function(aValue) {
84 this._scrambledStatus = aValue;
85 },
86
87 //-------------------------------------------------------------------------
88
89 'handleTypeChange': function() {
90//MochiKit.Logging.logDebug(">>> handling type change - " + this.recordField().type());
91 this.synchronizeComponentValues();
92 this.update();
93 },
94
95 //-------------------------------------------------------------------------
96
97 'addrUrl': function() {
98 var result;
99
100 result = "http://maps.google.com/maps?q=" + this.value().split(' ').join('+');
101
102 return result;
103 },
104
105 //-------------------------------------------------------------------------
106
107 'updateViewMode': function() {
108 var scarmbledStatus;
109
110 scrambledStatus = this.scrambledStatus() || 'SCRAMBLED';
111
112 this.element().update("");
113 if (this.recordField().hidden() == false) {
114 switch(this.recordField().type()) {
115 case 'TXT':
116 case 'PWD':
117 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', html:this.value()});
118 break;
119 case 'URL':
120 varurlLocation;
121
122 urlLocation = Clipperz.Base.sanitizeString(this.value());
123 if (! (/^(https?|ftp|svn):\/\//.test(urlLocation))) {
124 urlLocation = 'http://' + urlLocation;
125 }
126 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'a', href:urlLocation, html:this.value(), target:'_blank'});
127 break;
128 case 'DATE':
129 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', html:this.value()});
130 break;
131 case 'ADDR':
132 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'a', href:this.addrUrl(), html:this.value(), target:'_blank'});
133 break;
134 }
135 } else {
136 var tableElement;
137 var tdElement;
138 var inputElement;
139 var passwordElementConfiguration;
140
141 if (scrambledStatus == 'SCRAMBLED') {
142 varscrambledInputElement;
143
144 if ((Clipperz_IEisBroken === true) && (Clipperz.PM.Proxy.defaultProxy.isReadOnly())) {
145 scrambledInputElement = {tag:'input', type:'password', value:"this.value()"};
146 } else {
147 scrambledInputElement = {tag:'input', type:'text', cls:'scrambledField', title:Clipperz.PM.Strings['recordDetailPasswordFieldTooltipLabel'], value:"this.value()"};
148 }
149
150 passwordElementConfiguration =
151 {tag:'table', border:'0', cellspacing:'2', cellpadding:'0', children:[
152 {tag:'tbody', children:[
153 {tag:'tr', children:[
154 {tag:'td', valign:'top', children:[
155 scrambledInputElement,
156 {tag:'a', cls:'scrambleLink', id:this.getId('scrambleLink'), href:'#', htmlString:Clipperz.PM.Strings['recordDetailPasswordFieldUnscrambleLabel']}
157 ]},
158 {tag:'td', valign:'top', children:[
159 {tag:'span', cls:'scrambledFieldLabel', htmlString:Clipperz.PM.Strings['recordDetailPasswordFieldHelpLabel']}
160 ]}
161 ]}
162 ]}
163 ]};
164 } else {
165 passwordElementConfiguration =
166 {tag:'div', children:[
167 {tag:'input', type:'text', cls:'unscrambledField', value:"this.value()"},
168 {tag:'a', cls:'scrambleLink', id:this.getId('scrambleLink'), href:'#', htmlString:Clipperz.PM.Strings['recordDetailPasswordFieldScrambleLabel']}
169 ]};
170 }
171
172 tableElement = Clipperz.YUI.DomHelper.append(this.element().dom, passwordElementConfiguration, true);
173
174 inputElement = tableElement.getChildrenByTagName('input')[0];
175 inputElement.dom.value = this.value();
176 inputElement.wrap({tag:'div', cls:'passwordBackground'}).setStyle('background-position', "0px -" + Math.min(128, Clipperz.PM.Crypto.passwordEntropy(this.value())) + "px");
177
178 MochiKit.Signal.connect(inputElement.dom, 'onfocus', this, 'selectHiddenFieldOnFocus');
179 MochiKit.Signal.connect(this.getDom('scrambleLink'), 'onclick', this, 'toggleScramble');
180 }
181 },
182
183 //-------------------------------------------------------------------------
184
185 'updateEditMode': function() {
186 var inputElement;
187 var scarmbledStatus;
188
189 scrambledStatus = this.scrambledStatus() || 'SCRAMBLED';
190
191 this.element().update("");
192 switch(this.recordField().type()) {
193 case 'TXT':
194 case 'URL':
195 case 'ADDR':
196 inputElement = Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'input', type:'text', value:"this.value()"}, true);
197 inputElement.dom.value = this.value();
198 break;
199 case 'PWD':
200 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'table', width:'100%', cellpadding:'0', cellspacing:'0', children:[
201 {tag:'tbody', children:[
202 {tag:'tr', children:[
203 {tag:'td', valign:'top', children:[
204 {tag:'input', type:((scrambledStatus == 'SCRAMBLED') ? 'password' : 'text'), id:this.getId('passwordInputElement'), value:"this.value()"},
205 {tag:'a', cls:'scrambleLink', id:this.getId('scrambleLink'), href:'#', html:(scrambledStatus == 'SCRAMBLED' ? Clipperz.PM.Strings['recordDetailPasswordFieldUnscrambleLabel'] : Clipperz.PM.Strings['recordDetailPasswordFieldScrambleLabel'])}
206 ]},
207 {tag:'td', valign:'top', children:[
208 {tag:'div', id:this.getId('passwordGenerator'), cls:'Clipperz_PasswordGenerator_button', html:'&nbsp;'}
209 ]}
210 ]}
211 ]}
212 ]})
213 inputElement = this.getElement('passwordInputElement');
214 inputElement.dom.value = this.value();
215 new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('passwordInputElement'));
216 new Clipperz.PM.Components.PasswordGenerator(this.getElement('passwordGenerator'), this);
217 MochiKit.Signal.connect(this.getDom('scrambleLink'), 'onclick', this, 'toggleScramble');
218 break;
219 // case 'NOTE':
220 // inputElement = Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'textarea', rows:'5', html:this.value()}, true);
221 // break
222 case 'DATE':
223 inputElement = Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'input', type:'text', value:"this.value()"}, true);
224 inputElement.dom.value = this.value();
225 break;
226 }
227
228 this.setInputElement(inputElement);
229 },
230
231 //-------------------------------------------------------------------------
232
233 'synchronizeComponentValues': function() {
234//MochiKit.Logging.logDebug(">>> FieldValueComponent.synchronizeComponentValues");
235 if (this.inputElement() != null) {
236 var value;
237
238 switch(this.recordField().type()) {
239 case 'TXT':
240 case 'URL':
241 case 'ADDR':
242 case 'PWD':
243 case 'DATE':
244 value = this.inputElement().dom.value;
245 break;
246 }
247 this.setValue(value);
248 }
249//MochiKit.Logging.logDebug("<<< FieldValueComponent.synchronizeComponentValues");
250 },
251
252 //-------------------------------------------------------------------------
253
254 'selectHiddenFieldOnFocus': function(anEvent) {
255 anEvent.src().select();
256 },
257
258 //-------------------------------------------------------------------------
259
260 'toggleScramble': function(anEvent) {
261 this.synchronizeComponentValues();
262
263 if (this.scrambledStatus() == 'SCRAMBLED') {
264 this.setScrambledStatus('UNSCRAMBLED');
265 } else {
266 this.setScrambledStatus('SCRAMBLED');
267 };
268
269 this.update();
270 },
271
272 //-------------------------------------------------------------------------
273 __syntaxFix__: "syntax fix"
274});
275
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/HeaderComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/HeaderComponent.js
new file mode 100644
index 0000000..7aaca3e
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/HeaderComponent.js
@@ -0,0 +1,165 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.RecordDetail.HeaderComponent = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.RecordDetail.HeaderComponent.superclass.constructor.call(this, anElement, args);
40 this.mainComponent().addEditComponent(this);
41
42 this._saveButton = null;
43
44 this.render();
45
46 return this;
47}
48
49//=============================================================================
50
51YAHOO.extendX(Clipperz.PM.Components.RecordDetail.HeaderComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, {
52
53 'toString': function() {
54 return "Clipperz.PM.Components.RecordDetail.HeaderComponent component";
55 },
56
57 //-------------------------------------------------------------------------
58
59 'render': function() {
60 var editButton;
61
62//MochiKit.Logging.logDebug(">>> RecordDetail.HeaderComponent.appendTo");
63 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', cls:'recordDetailButtonsBox', children:[
64 {tag:'div', id:this.getId('editButtonBox'), children:[
65 {tag:'table', cls:'recordDetailButtonsTABLE', border:'0', cellpadding:'0', cellspacing:'0', children:[
66 {tag:'tbody', children:[
67 {tag:'tr', children:[
68 {tag:'td', align:'center', children:[
69 {tag:'div', id:this.getId('editButton')}
70 ]}
71 ]}
72 ]}
73 ]}
74 ]},
75 {tag:'div', id:this.getId('saveCancelButtonBox'), children:[
76 {tag:'table', cls:'recordDetailButtonsTABLE', border:'0', cellpadding:'0', cellspacing:'0', children:[
77 {tag:'tbody', children:[
78 {tag:'tr', children:[
79 {tag:'td', width:'49%', align:'right', children:[
80 {tag:'div', id:this.getId('saveButton')}
81 ]},
82 {tag:'td', html:'&nbsp'},
83 {tag:'td', width:'49%', align:'left', children:[
84 {tag:'div', id:this.getId('cancelButton')}
85 ]}
86 ]}
87 ]}
88 ]}
89 ]}
90 ]});
91
92 this.getElement('editButtonBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
93 this.getElement('saveCancelButtonBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
94
95 editButton = new YAHOO.ext.Button(this.getDom('editButton'), {text:Clipperz.PM.Strings['recordDetailEditButtonLabel'], handler:this.editButtonHandler, scope:this});
96 this.setSaveButton(new YAHOO.ext.Button(this.getDom('saveButton'), {text:Clipperz.PM.Strings['recordDetailSaveButtonLabel'], handler:this.saveButtonHandler, scope:this}));
97 new YAHOO.ext.Button(this.getDom('cancelButton'), {text:Clipperz.PM.Strings['recordDetailCancelButtonLabel'], handler:this.cancelButtonHandler, scope:this});
98
99 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) {
100 editButton.disable();
101 }
102
103 this.update();
104//MochiKit.Logging.logDebug("<<< RecordDetail.HeaderComponent.appendTo");
105 },
106
107 //-------------------------------------------------------------------------
108
109 'updateViewMode': function() {
110//MochiKit.Logging.logDebug(">>> HeaderComponent.updateViewMode");
111 this.getElement('editButtonBox').show();
112 this.getElement('saveCancelButtonBox').hide();
113//MochiKit.Logging.logDebug("<<< HeaderComponent.updateViewMode");
114 },
115
116 //-------------------------------------------------------------------------
117
118 'updateEditMode': function() {
119 this.getElement('editButtonBox').hide();
120 this.getElement('saveCancelButtonBox').show();
121 if (this.mainComponent().enableSaveButton() == true) {
122//MochiKit.Logging.logDebug("--- HeaderComponent.updateViewMode - ENABLE");
123 this.saveButton().enable();
124 } else {
125 this.saveButton().disable();
126 }
127 },
128
129 //-------------------------------------------------------------------------
130
131 'saveButton': function() {
132 return this._saveButton;
133 },
134
135 'setSaveButton': function(aValue) {
136 this._saveButton = aValue;
137 },
138
139 //-------------------------------------------------------------------------
140
141 'editButtonHandler': function(anEvent) {
142 this.mainComponent().setEditMode('EDIT');
143 },
144
145 //-------------------------------------------------------------------------
146
147 'saveButtonHandler': function(anEvent) {
148//MochiKit.Logging.logDebug(">>> RecordDetail.HeaderComponent.saveButtonHandler");
149 this.mainComponent().setEditMode('VIEW', this.getElement('saveButton'));
150//MochiKit.Logging.logDebug("<<< RecordDetail.HeaderComponent.saveButtonHandler");
151 },
152
153 //-------------------------------------------------------------------------
154
155 'cancelButtonHandler': function(anEvent) {
156 this.record().cancelChanges();
157//MochiKit.Logging.logDebug("--- HeaderComponent.cancelButtonHandler - " + Clipperz.Base.serializeJSON(this.record().currentDataSnapshot()));
158 this.mainComponent().setEditMode('VIEW', null, true);
159 },
160
161 //-------------------------------------------------------------------------
162
163 __syntaxFix__: "syntax fix"
164});
165
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/MainComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/MainComponent.js
new file mode 100644
index 0000000..53bf9c5
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/MainComponent.js
@@ -0,0 +1,758 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.RecordDetail.MainComponent = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.RecordDetail.MainComponent.superclass.constructor.call(this, anElement, args);
40
41 //this._element = args.element;
42 this._user = args.user;
43 this._editMode = args.editMode || 'VIEW'; //[ 'VIEW' | 'EDIT' ]
44 this._mainPanel = args.mainPanel;
45
46 this._record = null;
47 this._editComponents = [];
48 this._addFieldButton = null;
49
50 this._enableSaveButton = true;
51 this._shouldShowLoginInfo = (Clipperz.PM.Proxy.defaultProxy.isReadOnly() ? false : true);
52
53 //this._mainLayoutManager = null;
54 //this._layoutRegion = null;
55
56 Clipperz.NotificationCenter.register(null, 'loadingRecordData', this, 'render');
57 Clipperz.NotificationCenter.register(null, 'decryptingRecordData', this, 'render');
58 Clipperz.NotificationCenter.register(null, 'loadingRecordVersionData', this, 'render');
59 Clipperz.NotificationCenter.register(null, 'decryptingRecordVersionData', this, 'render');
60 Clipperz.NotificationCenter.register(null, 'setupDone', this, 'render');
61 Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'render');
62
63 this.render();
64
65 return this;
66}
67
68//=============================================================================
69
70YAHOO.extendX(Clipperz.PM.Components.RecordDetail.MainComponent, Clipperz.PM.Components.BaseComponent, {
71
72 'toString': function() {
73 return "Clipperz.PM.Components.RecordDetail.MainComponent component";
74 },
75
76 //-------------------------------------------------------------------------
77
78 'editMode': function() {
79 return this._editMode;
80 },
81
82 'setEditMode': function(aValue, aButtonElement, shouldSkipComponentSynchronization) {
83//MochiKit.Logging.logDebug(">>> MainComponent.setEditingMode");
84 this.scrollToTop();
85
86 if (aValue == 'VIEW') {
87 if (shouldSkipComponentSynchronization == true) {
88 this.exitModalView();
89 } else {
90 this.synchronizeComponentValues();
91 if (this.record().hasPendingChanges()) {
92 if (this.record().isBrandNew()) {
93 this.record().removeEmptyFields();
94 }
95 this.saveCurrentRecordChanges(aButtonElement);
96 } else {
97 if (this.record().isBrandNew()) {
98 this.record().user().removeRecord(this.record());
99 }
100 this.exitModalView();
101 }
102 }
103 } else if (aValue == 'EDIT') {
104 this.enterModalView();
105 } else {
106 //????
107 }
108
109 this._editMode = aValue;
110 this.render();
111 },
112
113 //-------------------------------------------------------------------------
114
115 'user': function() {
116 return this._user;
117 },
118
119 //-------------------------------------------------------------------------
120
121 'mainPanel': function() {
122 return this._mainPanel;
123 },
124
125 //-------------------------------------------------------------------------
126
127 'render': function() {
128//MochiKit.Logging.logDebug(">>> RecordDetail.MainComponent.render");
129 this.setEnableSaveButton(true);
130 this.element().update("");
131
132 if (this.record() == null) {
133 if (MochiKit.Base.keys(this.user().records()).length == 0) {
134 this.renderWithNoRecordAtAll();
135 } else {
136 this.renderWithNoSelectedRecord();
137 }
138 } else {
139 this.renderWithSelectedRecord();
140 }
141//MochiKit.Logging.logDebug("<<< RecordDetail.MainComponent.render");
142 },
143
144 //-------------------------------------------------------------------------
145
146 'renderWithNoRecordAtAll': function() {
147//MochiKit.Logging.logDebug(">>> RecordDetail.MainComponent.renderWithNoRecordAtAll");
148 Clipperz.YUI.DomHelper.append(this.element().dom,
149 {tag:'form', cls:'noRecordAtAllFORM', children:[
150 {tag:'div', cls:'recordTitleBlock', children:[
151 {tag:'h2', id:'recordTitle', htmlString:Clipperz.PM.Strings['recordDetailNoRecordAtAllTitle']}
152 ]},
153 {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[
154 {tag:'tbody', children:[
155 {tag:'tr', children:[
156 {tag:'td', colspan:'5', children:[
157 {tag:'div', cls:'recordDetailDescriptionBox', htmlString:Clipperz.PM.Strings['recordDetailNoRecordAtAllDescription']}
158 ]}
159 ]}
160 ]}
161 ]}
162 ]}
163 );
164//MochiKit.Logging.logDebug("<<< RecordDetail.MainComponent.renderWithNoRecordAtAll");
165 },
166
167 //-------------------------------------------------------------------------
168
169 'renderWithNoSelectedRecord': function() {
170//MochiKit.Logging.logDebug(">>> RecordDetail.MainComponent.renderWithNoSelectedRecord");
171 Clipperz.YUI.DomHelper.append(this.element().dom,
172 {tag:'form', cls:'noRecordSelectedFORM', children:[
173 {tag:'div', cls:'recordTitleBlock', children:[
174 {tag:'h2', id:'recordTitle', htmlString:Clipperz.PM.Strings['recordDetailNoRecordSelectedTitle']}
175 ]},
176 {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[
177 {tag:'tbody', children:[
178 {tag:'tr', children:[
179 {tag:'td', colspan:'5', children:[
180 {tag:'div', cls:'recordDetailDescriptionBox', htmlString:Clipperz.PM.Strings['recordDetailNoRecordSelectedDescription']}
181 ]}
182 ]},
183 {tag:'tr', colspan:'5', children:[
184 {tag:'td', colspan:'5', children:this.loginInfo()}
185 ]}
186 ]}
187 ]}
188 ]}
189 );
190//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithNoSelectedRecord - 1");
191
192 if (MochiKit.DOM.getElement('fullLoginHistoryLink') != null) {
193 MochiKit.Signal.connect('fullLoginHistoryLink', 'onclick', this, 'showLoginHistoryPanel');
194 }
195//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithNoSelectedRecord - 2");
196
197 if (MochiKit.DOM.getElement('offlineCopyDownloadWarningLink') != null) {
198 MochiKit.Signal.connect('offlineCopyDownloadWarningLink', 'onclick', this, 'showDownloadOfflineCopyPanel');
199 }
200//MochiKit.Logging.logDebug("<<< RecordDetail.MainComponent.renderWithNoSelectedRecord");
201 },
202
203 //-------------------------------------------------------------------------
204
205 'renderWithSelectedRecord': function() {
206//MochiKit.Logging.logDebug(">>> RecordDetail.MainComponent.renderWithSelectedRecord");
207 if (this.record().shouldLoadData() === true) {
208 // this.renderWithSelectedRecordLoading();
209//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 1.1");
210 this.renderWhileProcessingWithMessage(Clipperz.PM.Strings['recordDetailLoadingRecordMessage']);
211//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 1.2");
212 } else if (this.record().shouldDecryptData() === true) {
213 // this.renderWithSelectedRecordDecrypting();
214//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 2.1");
215 this.renderWhileProcessingWithMessage(Clipperz.PM.Strings['recordDetailDecryptingRecordMessage']);
216//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 2.2");
217 } else if (this.record().currentVersion().shouldLoadData() === true) {
218//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 3.1");
219 this.renderWhileProcessingWithMessage(Clipperz.PM.Strings['recordDetailLoadingRecordVersionMessage']);
220//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 3.2");
221 } else if (this.record().currentVersion().shouldDecryptData() === true) {
222 // this.renderWithSelectedRecordCurrentVersionDecrypting();
223//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 4.1");
224 this.renderWhileProcessingWithMessage(Clipperz.PM.Strings['recordDetailDecryptingRecordVersionMessage']);
225//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 4.2");
226 } else {
227//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 5.1");
228 this.renderWithSelectedRecordData();
229//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 5.2");
230 }
231//MochiKit.Logging.logDebug("<<< RecordDetail.MainComponent.renderWithSelectedRecord");
232 },
233
234 //.........................................................................
235
236 'renderWhileProcessingWithMessage': function(aMessage) {
237//MochiKit.Logging.logDebug(">>> RecordDetail.MainComponent.renderWhileProcessingWithMessage");
238 Clipperz.YUI.DomHelper.append(this.element().dom,
239 {tag:'form', cls:'processingRecordFORM', children:[
240 {tag:'div', cls:'recordTitleBlock', children:[
241 {tag:'h2', id:'recordTitle', html:this.record().label()}
242 ]},
243 {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[
244 {tag:'tbody', children:[
245 {tag:'tr', cls:'recordTR', children:[
246 {tag:'td', colspan:'5', children:[
247 {tag:'div', cls:'recordDetailDescriptionBox', children:[
248 {tag:'h5', cls:'recordLoadingMessage', html:aMessage}
249 ]}
250 ]}
251 ]}
252 ]}
253 ]}
254 ]}
255 );
256//MochiKit.Logging.logDebug("<<< RecordDetail.MainComponent.renderWhileProcessingWithMessage");
257 },
258
259 //.........................................................................
260/*
261 'renderWithSelectedRecordLoading': function() {
262 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', cls:'', style:'border:1px solid red; padding: 20px;', children:[
263 {tag:'div', cls:'Clipprez_RecordDetailTitle', children:[
264 {tag:'h3', html:this.record().label()},
265 {tag:'h3', html:"loading"}
266 ]}
267 ]});
268 },
269
270 //.........................................................................
271
272 'renderWithSelectedRecordDecrypting': function() {
273 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', cls:'', style:'border:1px solid red; padding: 20px;', children:[
274 {tag:'div', cls:'Clipprez_RecordDetailTitle', children:[
275 {tag:'h3', html:this.record().label()},
276 {tag:'h3', html:"decrypting ... "}
277 ]}
278 ]});
279 },
280
281 //.........................................................................
282
283 'renderWithSelectedRecordCurrentVersionDecrypting': function() {
284 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', cls:'', style:'border:1px solid red; padding: 20px;', children:[
285 {tag:'div', cls:'Clipprez_RecordDetailTitle', children:[
286 {tag:'h3', html:this.record().label()},
287 {tag:'h3', html:"decrypting version ... "}
288 ]}
289 ]});
290 },
291*/
292 //-------------------------------------------------------------------------
293
294 'renderWithErrorMessage': function(anErrorMessage) {
295//MochiKit.Logging.logDebug(">>> RecordDetail.MainComponent.renderWithErrorMessage");
296 this.element().update("");
297
298//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithErrorMessage - 1");
299 Clipperz.YUI.DomHelper.append(this.element().dom,
300 {tag:'form', cls:'errorMessageFORM', children:[
301 {tag:'div', cls:'recordTitleBlock', children:[
302 {tag:'h2', id:'recordTitle', html:this.record().label()}
303 ]},
304 {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[
305 {tag:'tbody', children:[
306 {tag:'tr', cls:'recordTR', children:[
307 {tag:'td', colspan:'5', children:[
308 {tag:'div', cls:'recordDetailDescriptionBox loadingError', children:[
309 {tag:'h5', htmlString:Clipperz.PM.Strings['recordDetailLoadingErrorMessageTitle']},
310 {tag:'p', html:anErrorMessage.message}
311 ]}
312 ]}
313 ]}
314 ]}
315 ]}
316 ]}
317 );
318//MochiKit.Logging.logDebug("<<< RecordDetail.MainComponent.renderWithErrorMessage");
319 },
320
321 //-------------------------------------------------------------------------
322
323 'renderWithSelectedRecordData': function() {
324 varcolumns;
325
326 this.resetEditComponents();
327
328 columns = [
329 {tag:'td', width:'25', html:'&#160'},
330 {tag:'td', width:'25%', htmlString:Clipperz.PM.Strings['recordDetailLabelFieldColumnLabel']},
331 {tag:'td', width:'3', html:'&#160'},
332 {tag:'td', /*width:'80%',*/ htmlString:Clipperz.PM.Strings['recordDetailDataFieldColumnLabel']}
333 ];
334
335 if (this.editMode() == 'EDIT') {
336 columns.push({tag:'td', /*width:'55',*/ htmlString:Clipperz.PM.Strings['recordDetailTypeFieldColumnLabel']})
337 }
338
339//MochiKit.Logging.logDebug(">>> RecordDetail.MainComponent.renderWithSelectedRecordData");
340 Clipperz.YUI.DomHelper.append(this.element().dom,
341 {tag:'form', cls:'recordDataFORM', children:[
342 {tag:'div', cls:'recordTitleBlock', id:this.getId('title')},
343 {tag:'div', id:'recordDetailDataBox', cls:'recordDetailDataBox', children:[
344
345{tag:'table', width:'100%', border:'0', cellspacing:'0', cellpadding:'0', children:[
346 {tag:'tbody', children:[
347 {tag:'tr', children:[
348 {tag:'td', width:'5', html:"&nbsp;"},
349 {tag:'td', children:[
350
351 {tag:'table', cls:'recordDetailDataBoxTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[
352 {tag:'tbody', id:this.getId('tbody'), children:[
353 {tag:'tr', /*cls:'recordNoteTR',*/ children:[
354 {tag:'td', colspan:'5', id:this.getId('notes')}
355 ]},
356 {tag:'tr', cls:'recordFieldsTR', children:columns /*[
357 {tag:'td', width:'25', html:'&#160'},
358 {tag:'td', width:'25%', htmlString:Clipperz.PM.Strings['recordDetailLabelFieldColumnLabel']},
359 {tag:'td', width:'3', html:'&#160'},
360 {tag:'td', / *width:'80%',* / htmlString:Clipperz.PM.Strings['recordDetailDataFieldColumnLabel']},
361 {tag:'td', / *width:'55',* / htmlString:Clipperz.PM.Strings['recordDetailTypeFieldColumnLabel']}
362 ] */}
363 ]}
364 ]},
365 {tag:'div', cls:'addFieldButton', id:this.getId('addField'), children:[
366 {tag:'div', id:this.getId('addFieldButton')}
367 ]},
368 {tag:'div', id:this.getId('directLogins')},
369 {tag:'div', id:this.getId('footer')}
370
371 ]}
372 ]}
373 ]}
374]}
375
376 ]}
377 ]}
378 );
379
380//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecordData - 1");
381
382 new Clipperz.PM.Components.RecordDetail.TitleComponent(this.getElement('title'), {mainComponent:this});
383//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecordData - 2");
384 new Clipperz.PM.Components.RecordDetail.NotesComponent(this.getElement('notes'), {mainComponent:this});
385//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecordData - 3");
386 new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent(this.getElement('directLogins'), {mainComponent:this});
387//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecordData - 4");
388 new Clipperz.PM.Components.RecordDetail.HeaderComponent(this.getElement('footer'), {mainComponent:this});
389//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecordData - 5");
390 MochiKit.Iter.forEach(MochiKit.Base.values(this.record().currentVersion().fields()), this.appendFieldComponent, this);
391//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecordData - 6");
392 this.setAddFieldButton(new YAHOO.ext.Button(this.getDom('addFieldButton'), {text:Clipperz.PM.Strings['recordDetailAddFieldButtonLabel'], handler:this.addNewRecordField, scope:this}));
393//MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecordData - 7");
394
395 this.update();
396
397//MochiKit.Logging.logDebug("<<< RecordDetail.MainComponent.renderWithSelectedRecordData");
398 },
399
400 //-------------------------------------------------------------------------
401
402 'editComponents': function() {
403 return this._editComponents;
404 },
405
406 'resetEditComponents': function() {
407 this._editComponents = [];
408 },
409
410 'addEditComponent': function(aValue) {
411 this.editComponents().push(aValue);
412 },
413
414 'removeEditComponent': function(aValue) {
415 Clipperz.Base.removeFromArray(this.editComponents(), aValue);
416 },
417
418 //-------------------------------------------------------------------------
419
420 'record': function() {
421 return this._record;
422 },
423
424 'setRecord': function(aValue) {
425 varresult;
426
427//MochiKit.Logging.logDebug(">>> MainComponent.setRecord")
428 if (this._record != aValue) {
429 vardeferredResult;
430
431 deferredResult = new MochiKit.Async.Deferred();
432
433 if ((this._record != null) && (this.editMode() == 'EDIT')) {
434 this.synchronizeComponentValues();
435 deferredResult.addCallback(MochiKit.Base.method(this._record, 'saveChanges'));
436 }
437
438 this._record = aValue;
439
440 if (aValue != null) {
441 this.setShouldShowLoginInfo(false);
442 deferredResult.addCallback(MochiKit.Base.method(this._record, 'deferredData'));
443 }
444 deferredResult.addCallbacks(
445 MochiKit.Base.method(this, 'render'),
446 MochiKit.Base.method(this, 'renderWithErrorMessage')
447 );
448 deferredResult.callback();
449 this.scrollToTop();
450
451 result = deferredResult;
452 } else {
453 result = MochiKit.Async.success();
454 }
455//MochiKit.Logging.logDebug("<<< MainComponent.setRecord")
456
457 return result;
458 },
459
460 //-------------------------------------------------------------------------
461
462 'saveCurrentRecordChanges': function(aButtonElement) {
463 var deferred;
464 var currentNumberOfRecords;
465
466 deferred = new MochiKit.Async.Deferred();
467 deferred.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'),
468 {
469 title:Clipperz.PM.Strings['recordDetailSavingChangesMessagePanelInitialTitle'],
470 text:Clipperz.PM.Strings['recordDetailSavingChangesMessagePanelInitialText'],
471 width:240,
472 showProgressBar:true,
473 showCloseButton:false,
474 steps:6
475 },
476 aButtonElement.dom
477 );
478 deferred.addCallback(MochiKit.Base.method(this, 'exitModalView'));
479 deferred.addCallback(MochiKit.Base.method(this.record(), 'saveChanges'));
480 deferred.addCallback(Clipperz.NotificationCenter.deferredNotification, this.record(), 'recordUpdated');
481 deferred.addCallback(function(res) {
482 Clipperz.PM.Components.MessageBox().hide(YAHOO.ext.Element.get('main'));
483 return res;
484 });
485
486 currentNumberOfRecords = MochiKit.Base.keys(this.user().records()).length;
487 if ((this.record().isBrandNew()) && (this.user().preferences().shouldShowDonationPanel()) && (currentNumberOfRecords >= 5)) {
488 deferred.addCallback(Clipperz.PM.showDonationSplashScreen, this.user(), 'recordListAddRecordButton');
489 }
490
491 deferred.callback();
492 },
493
494 //-------------------------------------------------------------------------
495
496 'update': function(anEvent) {
497 if (this.editMode() == 'EDIT') {
498 this.updateEditMode();
499 } else if (this.editMode() == 'VIEW') {
500 this.updateViewMode();
501 }
502
503 MochiKit.Iter.forEach(this.editComponents(), MochiKit.Base.methodcaller('update'));
504 },
505
506 //-------------------------------------------------------------------------
507
508 'updateViewMode': function() {
509 this.addFieldButton().hide();
510 },
511
512 //-------------------------------------------------------------------------
513
514 'updateEditMode': function() {
515 this.addFieldButton().show();
516 },
517
518 //-------------------------------------------------------------------------
519
520 'appendFieldComponent': function(aRecordField) {
521//MochiKit.Logging.logDebug(">>> MainComponent.appendFieldComponent");
522 new Clipperz.PM.Components.RecordDetail.FieldComponent(
523 Clipperz.YUI.DomHelper.append(this.getDom('tbody'), {tag:'tr'}, true),
524 {recordField:aRecordField, mainComponent:this}
525 );
526//MochiKit.Logging.logDebug("<<< MainComponent.appendFieldComponent");
527 },
528
529 //-------------------------------------------------------------------------
530
531 'removeField': function(aFieldComponent) {
532 varrecordField;
533
534 //MochiKit.Logging.logDebug(">>> MainComponent.removeField")
535 recordField = aFieldComponent.recordField();
536 this.removeEditComponent(aFieldComponent);
537 aFieldComponent.destroy();
538 this.record().removeField(recordField);
539
540 Clipperz.NotificationCenter.notify(this.record(), 'removedField');
541 //MochiKit.Logging.logDebug("<<< MainComponent.removeField")
542 },
543
544 //-------------------------------------------------------------------------
545
546 'synchronizeComponentValues': function() {
547 MochiKit.Iter.forEach(this.editComponents(), MochiKit.Base.methodcaller('synchronizeComponentValues'));
548 },
549
550 //=========================================================================
551
552 'addFieldButton': function() {
553 return this._addFieldButton;
554 },
555
556 'setAddFieldButton': function(aValue) {
557 this._addFieldButton = aValue;
558 },
559
560 'addNewRecordField': function() {
561 varnewField;
562
563 newField = this.record().addNewField();
564 this.appendFieldComponent(newField);
565
566 Clipperz.NotificationCenter.notify(this.record(), 'addNewRecordField');
567 },
568
569 //-------------------------------------------------------------------------
570
571 'enterModalView': function() {
572/*
573 if (this.user().preferences().useSafeEditMode()) {
574 var headerMaskElement;
575 var verticalMaskElement;
576
577 headerMaskElement = YAHOO.ext.Element.get('recordDetailEditModeHeaderMask');
578 headerMaskElement.show().mask();
579
580 verticalMaskElement = YAHOO.ext.Element.get('recordDetailEditModeVerticalMask');
581 verticalMaskElement.show().mask();
582 }
583*/
584 this.mainPanel().enterModalView();
585 },
586
587 //-------------------------------------------------------------------------
588
589 'exitModalView': function() {
590/*
591 if (this.user().preferences().useSafeEditMode()) {
592 var headerMaskElement;
593 var verticalMaskElement;
594
595 headerMaskElement = YAHOO.ext.Element.get('recordDetailEditModeHeaderMask');
596 headerMaskElement.unmask();
597 headerMaskElement.hide();
598
599 verticalMaskElement = YAHOO.ext.Element.get('recordDetailEditModeVerticalMask');
600 verticalMaskElement.unmask();
601 verticalMaskElement.hide();
602 }
603*/
604 this.mainPanel().exitModalView();
605 },
606
607 //-------------------------------------------------------------------------
608
609 'enableSaveButton': function() {
610 return this._enableSaveButton;
611 },
612
613 'setEnableSaveButton': function(aValue) {
614 this._enableSaveButton = aValue;
615 },
616
617 //-------------------------------------------------------------------------
618
619 'scrollToTop': function() {
620 YAHOO.ext.Element.get('recordTitleTopBlock').scrollIntoView(document.body);
621 },
622
623 //-------------------------------------------------------------------------
624
625 'loginInfo': function() {
626 varresult;
627
628 if (this.shouldShowLoginInfo() == true) {
629 // && (typeof(this.user().loginInfo()['latest']) != 'undefined')) {
630 varimageExtension;
631 var currentConnectionText;
632 var currentIP;
633 var contentChildren;
634
635 result = [];
636 contentChildren = [];
637
638 imageExtension = (Clipperz_IEisBroken == true) ? 'gif': 'png';
639
640 contentChildren.push({tag:'h4', valign:'top', htmlString:Clipperz.PM.Strings['WELCOME_BACK']});
641
642 currentIP = (this.user().loginInfo()['current']['ip'].match(/^\d{1,3}(.\d{1,3}){3}$/)) ? this.user().loginInfo()['current']['ip'] : Clipperz.PM.Strings['unknown_ip'];
643 currentConnectionText = Clipperz.PM.Strings['currentConnectionText'];
644 currentConnectionText = currentConnectionText.replace(/__ip__/, "<b>" + Clipperz.Base.sanitizeString(this.user().loginInfo()['current']['ip']) + "</b>");
645 currentConnectionText = currentConnectionText.replace(/__country__/, "<b>" + Clipperz.PM.Strings['countries'][Clipperz.Base.sanitizeString(this.user().loginInfo()['current']['country'])] + "</b>");
646 currentConnectionText = currentConnectionText.replace(/__browser__/, "<b>" + Clipperz.PM.Strings['browsers'][Clipperz.Base.sanitizeString(this.user().loginInfo()['current']['browser'])] + "</b>");
647 currentConnectionText = currentConnectionText.replace(/__operatingSystem__/, "<b>" + Clipperz.PM.Strings['operatingSystems'][Clipperz.Base.sanitizeString(this.user().loginInfo()['current']['operatingSystem'])] + "</b>");
648
649 contentChildren.push(
650 {tag:'div', cls:'loginInfo_now', children:[
651 {tag:'div', cls:'text', htmlString:currentConnectionText},
652 {tag:'div', cls:'icons', children:[
653 {tag:'img', title:Clipperz.PM.Strings['countries'][Clipperz.Base.sanitizeString(this.user().loginInfo()['current']['country'])], cls:'flag', src:Clipperz.PM.Strings['icons_baseUrl'] + "/flags/" + Clipperz.Base.sanitizeString(this.user().loginInfo()['current']['country']).toLowerCase() + "." + imageExtension, width:'32', height:'32'},
654 {tag:'img', title:Clipperz.PM.Strings['browsers'][Clipperz.Base.sanitizeString(this.user().loginInfo()['current']['browser'])], src:Clipperz.PM.Strings['icons_baseUrl'] + "/browsers/" + Clipperz.Base.sanitizeString(this.user().loginInfo()['current']['browser']).toLowerCase() + "." + imageExtension, width:'32', height:'32'},
655 {tag:'img', title:Clipperz.PM.Strings['operatingSystems'][Clipperz.Base.sanitizeString(this.user().loginInfo()['current']['operatingSystem'])], src:Clipperz.PM.Strings['icons_baseUrl'] + "/operatingSystems/" + Clipperz.Base.sanitizeString(this.user().loginInfo()['current']['operatingSystem']).toLowerCase() + "." + imageExtension, width:'32', height:'32'}
656 ]}
657 ]}
658 );
659
660 if (typeof(this.user().loginInfo()['latest']) != 'undefined') {
661 var latestLoginDate;
662 var elapsedTimeDescription;
663 var latestIP;
664 var latestConnectionText;
665
666 latestLoginDate = Clipperz.PM.Date.parseDateWithUTCFormat(Clipperz.Base.sanitizeString(this.user().loginInfo()['latest']['date']));
667
668 elapsedTimeDescription = Clipperz.PM.Date.getElapsedTimeDescription(latestLoginDate);
669 latestIP = (this.user().loginInfo()['latest']['ip'].match(/^\d{1,3}(.\d{1,3}){3}$/)) ? this.user().loginInfo()['latest']['ip'] : Clipperz.PM.Strings['unknown_ip'];
670
671 latestConnectionText = Clipperz.PM.Strings['latestConnectionText'];
672 latestConnectionText = latestConnectionText.replace(/__elapsedTimeDescription__/, "<b>" + elapsedTimeDescription + "</b>");
673 latestConnectionText = latestConnectionText.replace(/__time__/, Clipperz.PM.Date.formatDateWithTemplate(latestLoginDate, Clipperz.PM.Strings['fullDate_format']));
674 latestConnectionText = latestConnectionText.replace(/__ip__/, "<b>" + Clipperz.Base.sanitizeString(this.user().loginInfo()['latest']['ip']) + "</b>");
675 latestConnectionText = latestConnectionText.replace(/__country__/, "<b>" + Clipperz.PM.Strings['countries'][Clipperz.Base.sanitizeString(this.user().loginInfo()['latest']['country'])] + "</b>");
676 latestConnectionText = latestConnectionText.replace(/__browser__/, "<b>" + Clipperz.PM.Strings['browsers'][Clipperz.Base.sanitizeString(this.user().loginInfo()['latest']['browser'])] + "</b>");
677 latestConnectionText = latestConnectionText.replace(/__operatingSystem__/, "<b>" + Clipperz.PM.Strings['operatingSystems'][Clipperz.Base.sanitizeString(this.user().loginInfo()['latest']['operatingSystem'])] + "</b>");
678
679
680 contentChildren.push(
681 {tag:'div', cls:'loginInfo_latest', children:[
682 {tag:'div', cls:'inner_header', html:'&nbsp;'},
683 {tag:'div', cls:'content', children:[
684 {tag:'div', cls:'text', htmlString:latestConnectionText},
685 {tag:'div', cls:'icons', children:[
686 {tag:'img', title:Clipperz.PM.Strings['countries'][Clipperz.Base.sanitizeString(this.user().loginInfo()['latest']['country'])], cls:'flag', src:Clipperz.PM.Strings['icons_baseUrl'] + "/flags/" + Clipperz.Base.sanitizeString(this.user().loginInfo()['latest']['country']).toLowerCase() + "." + imageExtension, width:'32', height:'32'},
687 {tag:'img', title:Clipperz.PM.Strings['browsers'][Clipperz.Base.sanitizeString(this.user().loginInfo()['latest']['browser'])], src:Clipperz.PM.Strings['icons_baseUrl'] + "/browsers/" + Clipperz.Base.sanitizeString(this.user().loginInfo()['latest']['browser']).toLowerCase() + "." + imageExtension, width:'32', height:'32'},
688 {tag:'img', title:Clipperz.PM.Strings['operatingSystems'][Clipperz.Base.sanitizeString(this.user().loginInfo()['latest']['operatingSystem'])], src:Clipperz.PM.Strings['icons_baseUrl'] + "/operatingSystems/" + Clipperz.Base.sanitizeString(this.user().loginInfo()['latest']['operatingSystem']).toLowerCase() + "." + imageExtension, width:'32', height:'32'}
689 ]}
690 ]},
691 {tag:'div', children:[
692 {tag:'a', href:'#', id:'fullLoginHistoryLink', htmlString:Clipperz.PM.Strings['fullLoginHistoryLinkLabel']}
693 ]},
694 {tag:'div', cls:'inner_footer', html:'&nbsp;'}
695 ]}
696 );
697 }
698
699 contentChildren.push(
700 {tag:'table', id:'shouldDownloadOfflineCopyWarningBox', children:[
701 {tag:'tbody', width:'100%', children:[
702 {tag:'tr', children:[
703 {tag:'td', cls:'offlineCopyDownloadWarningIconTD', valign:'top', align:'center', width:'50', children:(this.user().shouldDownloadOfflineCopy() ? [{tag:'img', src:Clipperz.PM.Strings['icons_baseUrl'] + "/misc/offlineCopyWarning.png" , width:'32', height:'32'}]: [])},
704 {tag:'td', children:[
705 {tag:'div', cls:'offlineCopyDownloadWarning', htmlString:(this.user().shouldDownloadOfflineCopy() ? Clipperz.PM.Strings['offlineCopyDownloadWarning']: Clipperz.PM.Strings['offlineCopyDownloadOk'])}
706 ]}
707 ]}
708 ]}
709 ]}
710 );
711
712
713 result = [{tag:'div', id:'loginInfoWrapper', children:[{tag:'div', id:'loginInfo', children:[
714 {tag:'div', cls:'header', html:'&nbsp;'},
715 {tag:'div', cls:'content', children:contentChildren},
716 {tag:'div', cls:'footer', html:'&nbsp;'}
717 ]}]}];
718
719 // this.setShouldShowLoginInfo(false);
720 } else {
721 resut = [];
722 }
723
724 return result;
725 },
726
727 //-------------------------------------------------------------------------
728
729 'shouldShowLoginInfo': function() {
730 return this._shouldShowLoginInfo;
731 },
732
733 'setShouldShowLoginInfo': function(aValue) {
734 this._shouldShowLoginInfo = aValue;
735 },
736
737 //-------------------------------------------------------------------------
738
739 'showLoginHistoryPanel': function(anEvent) {
740 anEvent.stop();
741
742 Clipperz.NotificationCenter.notify(this, 'selectTab', 'mainTabPanel.accountTab', true);
743 Clipperz.NotificationCenter.notify(this, 'selectTab', 'accountTabPanel.loginHistoryTab', true);
744 },
745
746 //-------------------------------------------------------------------------
747
748 'showDownloadOfflineCopyPanel': function(anEvent) {
749 anEvent.stop();
750
751 Clipperz.NotificationCenter.notify(this, 'selectTab', 'mainTabPanel.dataTab', true);
752 Clipperz.NotificationCenter.notify(this, 'selectTab', 'dataTabPanel.offlineCopyTab', true);
753 },
754
755 //-------------------------------------------------------------------------
756 __syntaxFix__: "syntax fix"
757});
758
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/NotesComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/NotesComponent.js
new file mode 100644
index 0000000..6f454fc
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/NotesComponent.js
@@ -0,0 +1,240 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33
34//#############################################################################
35
36
37
38Clipperz.PM.Components.RecordDetail.NotesComponent = function(anElement, args) {
39//MochiKit.Logging.logDebug(">>> new NotesComponent");
40 args = args || {};
41
42 Clipperz.PM.Components.RecordDetail.NotesComponent.superclass.constructor.call(this, anElement, args);
43
44 this.mainComponent().addEditComponent(this);
45
46 this._staticOffset = null;
47 this._componentHeight = 50;
48 this._mouseMoveIdentifier = null;
49 this._mouseUpIdentifier = null;
50
51 this.element().setVisibilityMode(YAHOO.ext.Element.DISPLAY);
52
53 this.render();
54//MochiKit.Logging.logDebug("<<< new NotesComponent");
55
56 return this;
57}
58
59//=============================================================================
60
61YAHOO.extendX(Clipperz.PM.Components.RecordDetail.NotesComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, {
62
63 'toString': function() {
64 return "Clipperz.PM.Components.RecordDetail.NotesComponent component";
65 },
66
67 //-------------------------------------------------------------------------
68
69 'value': function() {
70 return this.record().notes();
71 },
72
73 'setValue': function(aValue) {
74 this.record().setNotes(aValue);
75 },
76
77 //-------------------------------------------------------------------------
78
79 'render': function() {
80//MochiKit.Logging.logDebug(">>> NotesComponent.render");
81/*
82 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', colspan:'5', children:[
83 {tag:'span', cls:'noteFieldLabel', htmlString:Clipperz.PM.Strings['recordDetailNotesLabel']},
84 {tag:'div', cls:'noteFieldContent', id:this.getId('notes')}
85 ]});
86 */
87 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', cls:'noteFieldLabel', htmlString:Clipperz.PM.Strings['recordDetailNotesLabel']});
88 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', cls:'noteFieldContent', id:this.getId('notes'), children:[
89 {tag:'div', id:this.getId('resizableDiv'), cls:'resizable-textarea', children:[
90 {tag:'div', id:this.getId('contentView'), cls:'viewMode', html:""},
91 {tag:'div', id:this.getId('contentEdit'), children:[
92 {tag:'span', children:[
93 {tag:'textarea', id:this.getId('textarea'), html:""}
94 ]}
95 ]},
96 {tag:'div', id:this.getId('grippie'), cls:'grippie'}
97 ]}
98 ]});
99
100 this.getElement('contentView').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
101 this.getElement('contentEdit').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
102
103 MochiKit.Signal.connect(this.getId('grippie'), 'onmousedown', this, 'startResize');
104
105 this.update();
106//MochiKit.Logging.logDebug("<<< NotesComponent.render");
107 },
108
109 //-------------------------------------------------------------------------
110
111 'updateViewMode': function() {
112//MochiKit.Logging.logDebug(">>> NotesComponent.updateViewMode");
113 // this.getElement('notes').update(this.value().replace(/\n/g, '<br>'));
114
115 this.getElement('contentView').update(Clipperz.Base.sanitizeString(this.value()).replace(/\n/g, '<br>'));
116
117 if (this.isNoteEmpty()) {
118 this.element().hide();
119 } else {
120 this.getElement('contentView').show();
121 this.getElement('contentView').setHeight(this.componentHeight());
122 }
123 this.getElement('contentEdit').hide();
124
125//MochiKit.Logging.logDebug("<<< NotesComponent.updateViewMode");
126 },
127
128 //-------------------------------------------------------------------------
129
130 'updateEditMode': function() {
131//MochiKit.Logging.logDebug(">>> NotesComponent.updateEditMode");
132 this.getDom('textarea').value = this.value().replace(/\n/g, Clipperz_normalizedNewLine);
133
134 this.getElement('contentView').hide();
135 this.getElement('contentEdit').show();
136
137 this.getElement('textarea').setHeight(this.componentHeight());
138//MochiKit.Logging.logDebug("<<< NotesComponent.updateEditMode");
139 },
140
141 //-------------------------------------------------------------------------
142
143 'synchronizeComponentValues': function() {
144//MochiKit.Logging.logDebug(">>> NotesComponent.synchronizeComponentValues");
145 if (this.getElement('textarea') != null) {
146 this.setValue(this.getDom('textarea').value.replace(/(\x0a\x0d|\x0d\x0a)/g,'\n'));
147 }
148//MochiKit.Logging.logDebug("<<< NotesComponent.synchronizeComponentValues");
149 },
150
151 //-------------------------------------------------------------------------
152
153 'componentHeight': function() {
154 return this._componentHeight;
155 },
156
157 'setComponentHeight': function(aValue) {
158 this._componentHeight = aValue;
159 },
160
161 //-------------------------------------------------------------------------
162
163 'isNoteEmpty': function() {
164 return !/[^ \n]/.test(this.value());
165 },
166
167 //-------------------------------------------------------------------------
168
169 'staticOffset': function() {
170 return this._staticOffset;
171 },
172
173 'setStaticOffset': function(aValue) {
174 this._staticOffset = aValue;
175 },
176
177 //-------------------------------------------------------------------------
178
179 'startResize': function(anEvent) {
180//MochiKit.Logging.logDebug(">>> startResize");
181 if (this.editMode() == 'VIEW') {
182 this.setStaticOffset(this.getElement('contentView').getHeight() - anEvent.mouse().page['y'])
183 } else {
184 this.setStaticOffset(this.getElement('textarea').getHeight() - anEvent.mouse().page['y'])
185 // this.getElement('textarea').setStyle('opacity', 0.25);
186 }
187 this.setMouseMoveIdentifier(MochiKit.Signal.connect(MochiKit.DOM.currentDocument(), 'onmousemove', this, 'whileResizing'));
188 this.setMouseUpIdentifier(MochiKit.Signal.connect(MochiKit.DOM.currentDocument(), 'onmouseup', this, 'endResize'));
189 anEvent.stop();
190//MochiKit.Logging.logDebug("<<< startResize");
191 },
192
193 //-------------------------------------------------------------------------
194
195 'whileResizing': function(anEvent) {
196//MochiKit.Logging.logDebug(">>> whileResizing");
197 this.getElement('textarea').setHeight(Math.max(32, this.staticOffset() + anEvent.mouse().page['y']) + 'px');
198 this.getElement('contentView').setHeight(Math.max(32, this.staticOffset() + anEvent.mouse().page['y']) + 'px');
199 anEvent.stop();
200//MochiKit.Logging.logDebug("<<< whileResizing");
201 },
202
203 //-------------------------------------------------------------------------
204
205 'endResize': function(anEvent) {
206//MochiKit.Logging.logDebug(">>> endResize");
207 MochiKit.Signal.disconnect(this.mouseMoveIdentifier());
208 this.setMouseMoveIdentifier(null);
209 MochiKit.Signal.disconnect(this.mouseUpIdentifier());
210 this.setMouseUpIdentifier(null);
211 // this.getElement('textarea').setStyle('opacity', 1);
212
213 this.setComponentHeight(this.getElement('textarea').getHeight());
214//MochiKit.Logging.logDebug("<<< endResize");
215 },
216
217 //-------------------------------------------------------------------------
218
219 'mouseMoveIdentifier': function() {
220 return this._mouseMoveIdentifier;
221 },
222
223 'setMouseMoveIdentifier': function(aValue) {
224 this._mouseMoveIdentifier = aValue;
225 },
226
227 //-------------------------------------------------------------------------
228
229 'mouseUpIdentifier': function() {
230 return this._mouseUpIdentifier;
231 },
232
233 'setMouseUpIdentifier': function(aValue) {
234 this._mouseUpIdentifier = aValue;
235 },
236
237 //-------------------------------------------------------------------------
238 __syntaxFix__: "syntax fix"
239});
240
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/TitleComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/TitleComponent.js
new file mode 100644
index 0000000..52e718c
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/TitleComponent.js
@@ -0,0 +1,137 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33
34//#############################################################################
35
36Clipperz.PM.Components.RecordDetail.TitleComponent = function(anElement, args) {
37 args = args || {};
38
39 Clipperz.PM.Components.RecordDetail.TitleComponent.superclass.constructor.call(this, anElement, args);
40
41 //this._inputElement = null;
42
43 this.mainComponent().addEditComponent(this);
44
45 this.render();
46
47 return this;
48}
49
50//=============================================================================
51
52YAHOO.extendX(Clipperz.PM.Components.RecordDetail.TitleComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, {
53
54 'toString': function() {
55 return "Clipperz.PM.Components.RecordDetail.TitleComponent component";
56 },
57
58 //-------------------------------------------------------------------------
59
60 'value': function() {
61 return this.record().label();
62 },
63
64 'setValue': function(aValue) {
65 this.record().setLabel(aValue);
66 },
67
68 //-------------------------------------------------------------------------
69/*
70 'inputElement': function() {
71 return this._inputElement;
72 },
73
74 'setInputElement': function(aValue) {
75 this._inputElement = aValue;
76 },
77*/
78 //-------------------------------------------------------------------------
79
80 'render': function() {
81 // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', html:'&#160'});
82 // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', colspan:"3", html:'&#160', children:[
83 // {tag:'div', /*style:'border: 1px solid green;',*/ id:this.getId('title')}
84 // ]});
85 // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', html:'&#160'});
86 //
87 // this.setInputElement(new Clipperz.PM.Components.TextFormField(this.getElement('title'), {editMode:this.editMode(), value:this.value()}));
88
89 this.update();
90 },
91
92 //-------------------------------------------------------------------------
93/*
94 'update': function() {
95 this.inputElement().update({value:this.value(), editMode:this.editMode()});
96 },
97 */
98 //-------------------------------------------------------------------------
99
100 'updateViewMode': function() {
101 this.element().update("");
102 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'h2', html:this.value()});
103 },
104
105 //-------------------------------------------------------------------------
106
107 'updateEditMode': function() {
108//MochiKit.Logging.logDebug(">>> TitleComponent.updateEditMode");
109 // this.getElement('title').update("");
110 // Clipperz.YUI.DomHelper.append(this.getDom('title'), {tag:'div', id:this.getId('title_input')});
111 // this.setInputElement(Clipperz.YUI.DomHelper.append(this.getDom('title_input'), {tag:'input', type:'text', value:this.value()}, true));
112
113 this.element().update("");
114 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'input', id:this.getId('titleField'), type:'text', value:"this.value()"});
115 this.getElement('titleField').dom.value = this.value();
116
117//MochiKit.Logging.logDebug("<<< TitleComponent.updateEditMode");
118 },
119
120 //-------------------------------------------------------------------------
121
122 'synchronizeComponentValues': function() {
123 var inputElement;
124
125//MochiKit.Logging.logDebug(">>> TitleComponent.synchronizeComponentValues");
126 inputElement = this.element().getChildrenByTagName('input')[0];
127
128 if (inputElement != null) {
129 this.setValue(inputElement.dom.value);
130 }
131//MochiKit.Logging.logDebug("<<< TitleComponent.synchronizeComponentValues");
132 },
133
134 //-------------------------------------------------------------------------
135 __syntaxFix__: "syntax fix"
136});
137
diff --git a/frontend/beta/js/Clipperz/PM/Components/TabPanel/TabPanelController.js b/frontend/beta/js/Clipperz/PM/Components/TabPanel/TabPanelController.js
new file mode 100644
index 0000000..c872462
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/TabPanel/TabPanelController.js
@@ -0,0 +1,158 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.TabPanel) == 'undefined') { Clipperz.PM.Components.TabPanel = {}; }
33
34Clipperz.PM.Components.TabPanel.TabPanelController = function(args) {
35 args = args || {};
36
37 Clipperz.PM.Components.TabPanel.TabPanelController.superclass.constructor.call(this);
38
39 this._name = args.name || 'undefined';
40 this._config = args.config;
41 this._selectedTab = args.selectedTab || ((MochiKit.Base.keys(args.config).length > 0) ? MochiKit.Base.keys(args.config)[0] : null);
42
43 this._tabs = {};
44 this._panels = {};
45
46 Clipperz.NotificationCenter.register(null, 'selectTab', this, 'handleSelectTabNotification');
47 return this;
48}
49
50//=============================================================================
51
52YAHOO.extendX(Clipperz.PM.Components.TabPanel.TabPanelController, YAHOO.ext.util.Observable, {
53
54 //-------------------------------------------------------------------------
55
56 'name': function() {
57 return this._name;
58 },
59
60 //-------------------------------------------------------------------------
61
62 'tabs': function() {
63 return this._tabs;
64 },
65
66 //-------------------------------------------------------------------------
67
68 'panels': function() {
69 return this._panels;
70 },
71
72 //-------------------------------------------------------------------------
73
74 'config': function() {
75 return this._config;
76 },
77
78 //-------------------------------------------------------------------------
79
80 'selectedTab': function() {
81 return this._selectedTab;
82 },
83
84 'setSelectedTab': function(aValue) {
85 this._selectedTab = aValue;
86 },
87
88 //-------------------------------------------------------------------------
89
90 'setUp': function() {
91 vartabId;
92
93//MochiKit.Logging.logDebug(">>> TabPanelController.setUp - config: " + Clipperz.Base.serializeJSON(this.config()));
94 for (tabId in this.config()) {
95 vartabElement;
96 varpanelElement;
97
98//MochiKit.Logging.logDebug("--- TabPanelController.setUp - tabId: " + tabId);
99//MochiKit.Logging.logDebug("--- TabPanelController.setUp - panelId: " + this.config()[tabId]);
100 tabElement = YAHOO.ext.Element.get(tabId);
101 tabElement.addClassOnOver("hover");
102 MochiKit.Signal.connect(tabId, 'onclick', this, 'selectTabHandler');
103
104 panelElement = YAHOO.ext.Element.get(this.config()[tabId]);
105
106 this._tabs[tabId] = tabElement;
107 this._panels[tabId] = panelElement;
108
109 if (tabId == this.selectedTab()) {
110 tabElement.addClass('selectedTab');
111 panelElement.addClass('selectedPanel');
112 } else {
113 panelElement.addClass('hiddenPanel');
114 }
115 }
116//MochiKit.Logging.logDebug("<<< TabPanelController.setUp");
117 },
118
119 //-------------------------------------------------------------------------
120
121 'selectTab': function(aTab) {
122 if (aTab != this.selectedTab()) {
123 this.tabs()[this.selectedTab()].removeClass('selectedTab');
124 this.panels()[this.selectedTab()].removeClass('selectedPanel').addClass('hiddenPanel');
125
126 this.tabs()[aTab].addClass('selectedTab');
127 this.panels()[aTab].addClass('selectedPanel').removeClass('hiddenPanel');
128
129 this.setSelectedTab(aTab);
130
131 Clipperz.NotificationCenter.notify(this, 'tabSelected', aTab);
132 }
133 },
134
135 //-------------------------------------------------------------------------
136
137 'selectTabHandler': function(anEvent) {
138 this.selectTab(anEvent.src().id);
139 },
140
141 //-------------------------------------------------------------------------
142
143 'handleSelectTabNotification': function(aNotificationEvent) {
144 var parameters;
145 var splittedParamters;
146 vartargetTabPanel;
147
148 parameters = aNotificationEvent.parameters();
149 splittedParamters = parameters.split('.');
150 targetTabPanel = splittedParamters[0];
151 if (targetTabPanel == this.name()) {
152 this.selectTab(splittedParamters[1])
153 }
154 },
155
156 //-------------------------------------------------------------------------
157 __syntaxFix__: "syntax fix"
158});
diff --git a/frontend/beta/js/Clipperz/PM/Components/TextFormField.js b/frontend/beta/js/Clipperz/PM/Components/TextFormField.js
new file mode 100644
index 0000000..cb4f06a
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Components/TextFormField.js
@@ -0,0 +1,310 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32
33Clipperz.PM.Components.TextFormField = function(anElement, args) {
34 args = args || {};
35
36//MochiKit.Logging.logDebug(">>> new TextFormField");
37 Clipperz.PM.Components.TextFormField.superclass.constructor.call(this, args);
38
39 this._element = anElement;
40 this._editMode = args.editMode || 'VIEW';
41 this._value = args.value || "";
42 this._inputElement = null;
43 this._wrapper = null;
44 this._multiline = args.multiline || false;
45
46 //this.multiline = args.multiline || true;
47 //this.editing = true;
48 //this.completeOnBlur = true;
49 //this.autoSizeTask = new YAHOO.ext.util.DelayedTask(this.autoSize, this);
50 //this.textSizeEl = Clipperz.YUI.DomHelper.append(document.body, {
51 // tag: 'div',
52 // cls: 'yinline-editor-sizer ' + (this.cls || '')
53 //});
54
55 this.render();
56//MochiKit.Logging.logDebug("<<< new TextFormField");
57
58 return this;
59};
60
61YAHOO.extendX(Clipperz.PM.Components.TextFormField, Clipperz.PM.Components.BaseComponent, {
62
63 'toString': function() {
64 return "Clipperz.PM.Components.TextFormField";
65 },
66
67 //-----------------------------------------------------
68
69 'value': function() {
70 if (this.inputElement() != null) {
71 this._value = this.inputElement().dom.value;
72 }
73
74 return this._value;
75 // return this.inlineEditor().getValue();
76 },
77
78 'setValue': function(aValue) {
79 this._value = aValue;
80 // this.getElement('viewComponent_Content').update(aValue);
81 // this.inlineEditor().setValue(aValue);
82 },
83
84 //-----------------------------------------------------
85
86 'multiline': function() {
87 return this._multiline;
88 },
89
90 //-----------------------------------------------------
91
92 'editMode': function() {
93 return this._editMode;
94 },
95
96 'setEditMode': function(aValue) {
97 this._editMode = aValue;
98 },
99
100 //-----------------------------------------------------
101
102 'inputElement': function() {
103 return this._inputElement;
104 },
105
106 'setInputElement': function(aValue) {
107 this._inputElement = aValue;
108 },
109
110 //-----------------------------------------------------
111
112 'on': function(anEventName, anHandler, aScope, shouldOverride) {
113//MochiKit.Logging.logDebug(">>> TextFormField.on - inputElement: " + this.inputElement());
114 return this.inputElement().on(anEventName, anHandler, aScope, shouldOverride);
115//MochiKit.Logging.logDebug("<<< TextFormField.on - inputElement: " + this.inputElement());
116 },
117
118 //-----------------------------------------------------
119
120 'wrapper': function() {
121 return this._wrapper;
122 },
123
124 //-----------------------------------------------------
125
126 'render': function() {
127 var editModeConfiguration;
128 var viewModeConfiguration;
129
130 editModeConfiguration = {tag:'div', id:this.getId('editComponent'), children:[]};
131 if (this.multiline() == false) {
132 editModeConfiguration.children.push({tag:'input', type:'text', id:this.getId('editComponent_input'), value:"this.value(1)"});
133 } else {
134 editModeConfiguration.children.push({tag:'textarea', id:this.getId('editComponent_input'), html:"this.value(2)"});
135 }
136
137 viewModeConfiguration = {tag:'div', id:this.getId('viewComponent'), /*style:'border: 1px solid blue;',*/ children:[
138 {tag:'span', id:this.getId('viewComponent_Content'), html:this.value()}
139 ]}
140
141//MochiKit.Logging.logDebug(">>> TextFormField.render");
142 this._wrapper = Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', id:this.getId('wrapper'), children:[
143 {tag:'div', id:this.getId('editModeBox'), children:[editModeConfiguration]},
144 {tag:'div', id:this.getId('viewModeBox'), children:[viewModeConfiguration]}
145 ]}, true);
146
147 this.getElement('editModeBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
148 this.getElement('viewModeBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
149
150 this.getElement('editComponent_input').dom.value = this.value();
151 this.setInputElement(this.getElement('editComponent_input'));
152
153 this.update();
154//MochiKit.Logging.logDebug("<<< TextFormField.render");
155 },
156
157 //-----------------------------------------------------
158
159 'update': function(args) {
160 args = args || {};
161
162//MochiKit.Logging.logDebug(">>> TextFormField.update");
163 if (typeof(args.value) != 'undefined') {
164 this.setValue(args.value);
165 }
166 if (typeof(args.editMode) != 'undefined') {
167 this.setEditMode(args.editMode)
168 }
169
170 if (this.editMode() == 'VIEW') {
171 this.updateViewMode();
172 } else if (this.editMode() == 'EDIT') {
173 this.updateEditMode();
174 } else {
175 //?????
176 }
177//MochiKit.Logging.logDebug("<<< TextFormField.update");
178 },
179
180 //-----------------------------------------------------
181
182 'updateEditMode': function() {
183//MochiKit.Logging.logDebug(">>> TextFormField.updateEditMode");
184 this.getElement('viewModeBox').hide();
185 this.getElement('editModeBox').show();
186
187 if (this.multiline() == false) {
188 this.getElement('editComponent_input').dom.value = this.value();
189 } else {
190 this.getElement('editComponent_input').update(Clipperz.Base.sanitizeString(this.value()));
191 }
192//MochiKit.Logging.logDebug("<<< TextFormField.updateEditMode");
193 },
194
195 //-----------------------------------------------------
196
197 'updateViewMode': function() {
198//MochiKit.Logging.logDebug(">>> TextFormField.updateViewMode");
199 this.getElement('editModeBox').hide();
200 this.getElement('viewModeBox').show();
201
202 this.getElement('viewComponent_Content').update(Clipperz.Base.sanitizeString(this.value()));
203//MochiKit.Logging.logDebug("<<< TextFormField.updateViewMode");
204 },
205
206 //#####################################################
207 //#####################################################
208 //#####################################################
209 //#####################################################
210 /*
211 'onEnter': function(k, e) {
212MochiKit.Logging.logDebug(">>> TextFormField.onEnter");
213 if (this.multiline && (e.ctrlKey || e.shiftKey)) {
214 return;
215 } else {
216 this.completeEdit();
217 e.stopEvent();
218 }
219MochiKit.Logging.logDebug("<<< TextFormField.onEnter");
220 },
221
222 //-----------------------------------------------------
223
224 'onEsc': function() {
225MochiKit.Logging.logDebug(">>> TextFormField.onEsc");
226 // if (this.ignoreNoChange) {
227 // this.revert(true);
228 // } else {
229 this.revert(false);
230 this.completeEdit();
231 // }
232MochiKit.Logging.logDebug("<<< TextFormField.onEsc");
233 },
234
235 //-----------------------------------------------------
236
237 onBlur : function(){
238MochiKit.Logging.logDebug(">>> TextFormField.onBlur");
239 if (this.editing && this.completeOnBlur !== false) {
240 this.completeEdit();
241 }
242MochiKit.Logging.logDebug("<<< TextFormField.onBlur");
243 },
244
245 //-----------------------------------------------------
246
247 'onKeyUp': function(e) {
248 var k = e.getKey();
249 if (this.editing && (k < 33 || k > 40) && k != 27) {
250 this.autoSizeTask.delay(50);
251 }
252 },
253
254 //-----------------------------------------------------
255
256 'autoSize': function() {
257 var el = this.inputElement();
258 var wrap = this.getElement('editComponent');
259 var v = el.dom.value;
260 var ts = this.textSizeEl;
261
262 if (v.length < 1) {
263 ts.innerHTML = "&#160;&#160;";
264 } else {
265 v = v.replace(/[<> ]/g, '&#160;');
266 if (this.multiline) {
267 v = v.replace(/\n/g, '<br />&#160;');
268 }
269 ts.innerHTML = v;
270 }
271
272 var ww = wrap.dom.offsetWidth;
273 var wh = wrap.dom.offsetHeight;
274 var w = ts.offsetWidth;
275 var h = ts.offsetHeight;
276 // lots of magic numbers in this block - wtf?
277 // the logic is to prevent the scrollbars from flashing
278 // in firefox. Updates the right element first
279 // so there's never overflow.
280 if (ww > w+4) {
281 el.setWidth(w+4);
282 wrap.setWidth(w+8);
283 } else {
284 wrap.setWidth(w+8);
285 el.setWidth(w+4);
286 }
287 if (wh > h+4) {
288 el.setHeight(h);
289 wrap.setHeight(h+4);
290 } else {
291 wrap.setHeight(h+4);
292 el.setHeight(h);
293 }
294 },
295
296 //-----------------------------------------------------
297
298 'completeEdit': function() {
299MochiKit.Logging.logDebug(">>> TextFormField.completeEdit");
300
301 },
302
303 'revert': function() {
304MochiKit.Logging.logDebug(">>> TextFormField.revert");
305
306 },
307 */
308 //-----------------------------------------------------
309 __syntaxFix__: '__syntaxFix__'
310});
diff --git a/frontend/beta/js/Clipperz/PM/Connection.js b/frontend/beta/js/Clipperz/PM/Connection.js
new file mode 100644
index 0000000..cf37ccc
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Connection.js
@@ -0,0 +1,584 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31
32//-----------------------------------------------------------------------------
33//
34 // Abstract C O N N E C T I O N class
35//
36//-----------------------------------------------------------------------------
37
38Clipperz.PM.Connection = function (args) {
39 args = args || {};
40
41 this._user = args.user;
42 this._clipperz_pm_crypto_version = null;
43 this._connectionId = null;
44 this._oneTimePassword = null;
45
46 return this;
47}
48
49Clipperz.PM.Connection.prototype = MochiKit.Base.update(null, {
50
51 'user': function() {
52 return this._user;
53 },
54
55 'toString': function() {
56 return "Connection [" + this.version() + "] - user: " + this.user();
57 },
58
59 //=========================================================================
60
61 'version': function() {
62 throw Clipperz.Base.exception.AbstractMethod;
63 },
64
65 'clipperz_pm_crypto_version': function() {
66 if (this._clipperz_pm_crypto_version == null) {
67 var connectionVersions;
68 varversions;
69 varversion;
70 var i, c;
71
72 version = null;
73 connectionVersions = Clipperz.PM.Crypto.communicationProtocol.versions;
74 versions = MochiKit.Base.keys(connectionVersions);
75 c = versions.length;
76 for (i=0; i<c; i++) {
77 if (! (versions[i] == 'current')) {
78 if (this instanceof connectionVersions[versions[i]]) {
79 version = versions[i];
80 };
81 }
82 }
83
84 this._clipperz_pm_crypto_version = version;
85 }
86
87 return this._clipperz_pm_crypto_version;
88 },
89
90 //-------------------------------------------------------------------------
91
92 'defaultErrorHandler': function(anErrorString, anException) {
93MochiKit.Logging.logError("### Connection.defaultErrorHandler: " + anErrorString + " (" + anException + ")");
94 },
95
96 //-------------------------------------------------------------------------
97
98 'login': function(someArguments, aCallback) {
99 throw Clipperz.Base.exception.AbstractMethod;
100 },
101
102 //-------------------------------------------------------------------------
103
104 'message': function(someArguments, aCallback) {
105 throw Clipperz.Base.exception.AbstractMethod;
106 },
107
108 //-------------------------------------------------------------------------
109
110 'sharedSecret': function() {
111 throw Clipperz.Base.exception.AbstractMethod;
112 },
113
114 'serverSideUserCredentials': function() {
115 throw Clipperz.Base.exception.AbstractMethod;
116 },
117
118 //=========================================================================
119
120 'connectionId': function() {
121 return this._connectionId;
122 },
123
124 'setConnectionId': function(aValue) {
125 this._connectionId = aValue;
126 },
127
128 //=========================================================================
129
130 'oneTimePassword': function() {
131 return this._oneTimePassword;
132 },
133
134 'setOneTimePassword': function(aValue) {
135 this._oneTimePassword = aValue;
136 },
137
138 //=========================================================================
139 __syntaxFix__: "syntax fix"
140
141}
142);
143
144
145if (typeof(Clipperz.PM.Connection.SRP) == 'undefined') { Clipperz.PM.Connection.SRP = {}; }
146//-----------------------------------------------------------------------------
147//
148 // S R P [ 1 . 0 ] C O N N E C T I O N class
149//
150//-----------------------------------------------------------------------------
151
152Clipperz.PM.Connection.SRP['1.0'] = function (args) {
153 args = args || {};
154 Clipperz.PM.Connection.call(this, args);
155
156 this._C = null;
157 this._P = null;
158 this._srpConnection = null;
159
160 return this;
161}
162
163Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz.PM.Connection(), {
164
165 'version': function() {
166 return '1.0';
167 },
168
169 //=========================================================================
170
171 'register': function(anInvitationCode) {
172 var deferredResult;
173 varparameters;
174
175//MochiKit.Logging.logError(">>> Connection.register: " + this);
176 parameters = {};
177 deferredResult = new MochiKit.Async.Deferred();
178//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.register - 1: " + res); return res;});
179 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'registration_verify');
180//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.register - 2: " + res); return res;});
181 deferredResult.addCallback(function(aConnection, anInvitationCode) {
182 var args;
183
184 args = {};
185 args.message = 'register';
186 args.version = aConnection.clipperz_pm_crypto_version();
187 args.invitationCode = anInvitationCode;
188
189 return args;
190 }, this);
191//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.register - 3: " + res); return res;});
192 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'registration_sendingCredentials');
193//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.register - 4: " + res); return res;});
194 deferredResult.addCallback(MochiKit.Base.method(this.user(), 'encryptedData'));
195//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.register - 5: " + res); return res;});
196 deferredResult.addCallback(function(someParameters, anUser, anEncryptedData) {
197 var currentVersionConnection;
198 var args;
199
200 currentVersionConnection = new Clipperz.PM.Crypto.communicationProtocol.versions['current']({user:anUser});
201
202 args = someParameters
203 args.credentials = currentVersionConnection.serverSideUserCredentials();
204 args.user = anEncryptedData;
205 args.version = args.credentials.version;
206 args.message = "completeRegistration";
207
208 return args;
209 }, parameters, this.user());
210//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.register - 6: " + res); return res;});
211 deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Proxy.defaultProxy, 'registration'));
212//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.register - 7: " + Clipperz.Base.serializeJSON(res)); return res;});
213 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
214 this.user().setLock(res['lock']);
215
216 return res;
217 }, this));
218 deferredResult.callback(anInvitationCode);
219//MochiKit.Logging.logError("<<< Connection.register");
220
221 return deferredResult;
222 },
223
224 //=========================================================================
225
226 'login': function(isReconnecting) {
227 vardeferredResult;
228
229//MochiKit.Logging.logDebug(">>> Connection.login: "/* + this*/);
230//MochiKit.Logging.logDebug("--- Connection.login - isReconnecting: " + (isReconnecting == true));
231 deferredResult = new MochiKit.Async.Deferred();
232//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.3.1 - Connection.login - 1: "/* + res*/); return res;});
233//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
234 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_sendingCredentials');
235//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.3.2 - Connection.login - 2: "/* + res*/); return res;});
236//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
237 deferredResult.addCallback(function(aConnection) {
238 var args;
239
240 args = {};
241 args.message = 'connect';
242 args.version = aConnection.clipperz_pm_crypto_version();
243 args.parameters = {};
244//MochiKit.Logging.logDebug("=== Connection.login - username: " + aConnection.srpConnection().C());
245 args.parameters['C'] = aConnection.srpConnection().C();
246 args.parameters['A'] = aConnection.srpConnection().A().asString(16);
247
248 if (isReconnecting == true) {
249//MochiKit.Logging.logDebug("--- Connection.login - reconnecting");
250 //# args.parameters['reconnecting'] = "yes";
251 args.parameters['reconnecting'] = aConnection.connectionId();
252 }
253//MochiKit.Logging.logDebug("--- Connection.login - args: " + Clipperz.Base.serializeJSON(args));
254//MochiKit.Logging.logDebug("--- Connection.login - srp.a: " + aConnection.srpConnection().a().asString(16));
255
256 return args;
257 });
258//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.3.3 - Connection.login - 3: "/* + res*/); return res;});
259//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
260 deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Proxy.defaultProxy, 'handshake'));
261//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.3.4 - Connection.login - 4: "/* + res*/); return res;});
262//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
263 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_credentialVerification');
264//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.3.5 - Connection.login - 5: "/* + res*/); return res;});
265//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
266deferredResult.addErrback(MochiKit.Base.bind(function(res) {MochiKit.Logging.logDebug("ERROR - c: " + this.srpConnection().C() + " # version: " + this.clipperz_pm_crypto_version()); return res;}, this));
267 deferredResult.addCallback(MochiKit.Base.bind(function(someParameters) {
268 var args;
269
270 this.srpConnection().set_s(new Clipperz.Crypto.BigInt(someParameters['s'], 16));
271 this.srpConnection().set_B(new Clipperz.Crypto.BigInt(someParameters['B'], 16));
272
273 if (typeof(someParameters['oneTimePassword']) != 'undefined') {
274 this.setOneTimePassword(someParameters['oneTimePassword']);
275 }
276
277 args = {};
278 args.message = 'credentialCheck';
279 args.version = this.clipperz_pm_crypto_version();
280 args.parameters = {};
281 args.parameters['M1'] = this.srpConnection().M1();
282
283 return args;
284 }, this));
285//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.3.6 - Connection.login - 6: "/* + res*/); return res;});
286//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
287 deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Proxy.defaultProxy, 'handshake'));
288//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.3.7 - Connection.login - 7: "/* + res*/); return res;});
289//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
290 //# deferredResult.addCallback(MochiKit.Base.method(this, 'loginDone'));
291 deferredResult.addCallback(MochiKit.Base.bind(function(someParameters) {
292 var result;
293
294//MochiKit.Logging.logDebug(">>> Connection.loginDone: " + this + " (M2: " + this.srpConnection().M2() + ")");
295 if (someParameters['M2'] == this.srpConnection().M2()) {
296 result = new MochiKit.Async.Deferred();
297
298//MochiKit.Logging.logDebug("--- Connection.loginDone - someParameters: " + Clipperz.Base.serializeJSON(someParameters));
299 this.setConnectionId(someParameters['connectionId']);
300 this.user().setLoginInfo(someParameters['loginInfo']);
301 this.user().setShouldDownloadOfflineCopy(someParameters['offlineCopyNeeded']);
302 this.user().setLock(someParameters['lock']);
303
304 if (this.oneTimePassword() != null) {
305 result.addCallback(MochiKit.Base.method(this.user().oneTimePasswordManager(), 'archiveOneTimePassword', this.oneTimePassword()));
306 }
307 result.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_loggedIn');
308 result.addCallback(MochiKit.Async.succeed, someParameters);
309
310 result.callback();
311//MochiKit.Logging.logDebug("--- Connection.loginDone - 1 - result: "/* + Clipperz.Base.serializeJSON(result)*/);
312 } else {
313//MochiKit.Logging.logDebug("--- Connection.loginDone - 2 - ERROR");
314//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
315 result = MochiKit.Async.fail(Clipperz.PM.Connection.exception.WrongChecksum);
316 }
317//MochiKit.Logging.logDebug("<<< Connection.loginDone - result: " + Clipperz.Base.serializeJSON(result));
318
319 return result;
320 }, this));
321
322//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.3.8 - Connection.login - 8: "/* + res*/); return res;});
323//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
324 deferredResult.callback(this);
325//MochiKit.Logging.logDebug("<<< Connection.login");
326
327 return deferredResult;
328 },
329
330 //=========================================================================
331
332 'logout': function() {
333 var deferredResult;
334
335//MochiKit.Logging.logDebug(">>> Connection.logout: " + this);
336 deferredResult = new MochiKit.Async.Deferred();
337//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.logout - 1: " + res); return res;});
338 deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Proxy.defaultProxy, 'logout'), {});
339//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.logout - 2: " + res); return res;});
340 deferredResult.addCallback(MochiKit.Base.method(this, 'resetSrpConnection'));
341//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.logout - 3: " + res); return res;});
342 deferredResult.callback();
343//MochiKit.Logging.logDebug("<<< Connection.logout");
344
345 return deferredResult;
346 },
347
348 //=========================================================================
349
350 'message': function(aMessageName, someParameters) {
351 var args;
352 var deferredResult;
353
354//MochiKit.Logging.logDebug(">>> Connection.message: " + this);
355 args = {}
356 args['message'] = aMessageName;
357 args['srpSharedSecret'] = this.srpConnection().K();
358 // args['lock'] = this.user().lock();
359
360 if (someParameters != null) {
361 args['parameters'] = someParameters;
362 } else {
363 args['parameters'] = {};
364 }
365//MochiKit.Logging.logDebug("--- Connection.message - args: " + Clipperz.Base.serializeJSON(args));
366
367 // deferredResult = new MochiKit.Async.Deferred(); //### ?????????????
368
369 return this.sendMessage(args);
370 },
371
372 //-------------------------------------------------------------------------
373
374 'sendMessage': function(someArguments) {
375 vardeferredResult;
376
377//MochiKit.Logging.logDebug(">>> Connection.sendMessage: " + this);
378 deferredResult = new MochiKit.Async.Deferred();
379//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.sendMessage - 1: " + res); return res;});
380 deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Proxy.defaultProxy, 'message'), someArguments);
381//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.sendMessage - 2: " + res); return res;});
382
383 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
384 if (typeof(res['lock']) != 'undefined') {
385 this.user().setLock(res['lock']);
386 }
387 return res;
388 }, this));
389
390 deferredResult.addErrback(MochiKit.Base.method(this, 'messageExceptionHandler'), someArguments);
391//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.sendMessage - 3: " + res); return res;});
392//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.sendMessage - 3: " + Clipperz.Base.serializeJSON(res)); return res;});
393 deferredResult.callback();
394//MochiKit.Logging.logDebug("<<< Connection.sendMessage");
395
396 return deferredResult
397 },
398
399 //-------------------------------------------------------------------------
400
401 'messageExceptionHandler': function(anOriginalMessageArguments, anError) {
402 var result;
403
404//MochiKit.Logging.logDebug(">>> Connection.messageExceptionHandler - this: " + this + ", anError: " + anError);
405 if (anError instanceof MochiKit.Async.CancelledError) {
406//MochiKit.Logging.logDebug("--- Connection.messageExceptionHandler - 1");
407 result = anError;
408//MochiKit.Logging.logDebug("--- Connection.messageExceptionHandler - 2");
409 } else {
410//MochiKit.Logging.logDebug("--- Connection.messageExceptionHandler - 3 - anError.name: " + anError.name + ", message: " + anError.message);
411 if ((anError.message == 'Trying to communicate without an active connection')||
412 (anError.message == 'No tollManager available for current session')
413 ) {
414//MochiKit.Logging.logDebug("--- Connection.messageExceptionHandler - 4");
415 result = this.reestablishConnection(anOriginalMessageArguments);
416//MochiKit.Logging.logDebug("--- Connection.messageExceptionHandler - 5");
417 } else if (anError.message == 'Session with stale data') {
418//MochiKit.Logging.logDebug("--- Connection.messageExceptionHandler - 5.1");
419 Clipperz.NotificationCenter.notify(this, 'EXCEPTION');
420//MochiKit.Logging.logDebug("--- Connection.messageExceptionHandler - 5.2");
421 } else {
422//MochiKit.Logging.logDebug("--- Connection.messageExceptionHandler - 6");
423 result = anError;
424//MochiKit.Logging.logDebug("--- Connection.messageExceptionHandler - 7");
425 }
426//MochiKit.Logging.logDebug("--- Connection.messageExceptionHandler - 8");
427 }
428//MochiKit.Logging.logDebug("<<< Connection.messageExceptionHandler");
429
430 return result;;
431 },
432
433 //=========================================================================
434
435 'reestablishConnection': function(anOriginalMessageArguments) {
436 var deferredResult;
437
438//MochiKit.Logging.logDebug("+++ Connection.reestablishConnection: " + Clipperz.Base.serializeJSON(anOriginalMessageArguments));
439
440//MochiKit.Logging.logDebug(">>> Connection.reestablishConnection: " + this);
441 deferredResult = new MochiKit.Async.Deferred();
442//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.reestablishConnection 1: " + res); return res;});
443 deferredResult.addCallback(MochiKit.Base.method(this, 'resetSrpConnection'));
444//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.reestablishConnection 2: " + res); return res;});
445 deferredResult.addCallback(MochiKit.Base.method(this, 'login'), true);
446//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.reestablishConnection 3: " + res); return res;});
447 deferredResult.addCallback(MochiKit.Base.bind(function(aMessage) {
448 aMessage['srpSharedSecret'] = this.srpConnection().K();
449 return aMessage;
450 }, this), anOriginalMessageArguments);
451//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.reestablishConnection 4: " + Clipperz.Base.serializeJSON(res)); return res;});
452 deferredResult.addCallback(MochiKit.Base.method(this, 'sendMessage'));
453//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.reestablishConnection 5: " + res); return res;});
454 deferredResult.addErrback(Clipperz.NotificationCenter.deferredNotification, this, 'EXCEPTION', null);
455//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Connection.reestablishConnection 6: " + res); return res;});
456 deferredResult.callback();
457//MochiKit.Logging.logDebug("<<< Connection.reestablishConnection");
458
459 return deferredResult;
460 },
461
462 //=========================================================================
463
464 'sharedSecret': function() {
465 return this.srpConnection().K();
466 },
467
468 //=========================================================================
469
470 'serverSideUserCredentials': function() {
471 varresult;
472 varnewSrpConnection;
473
474//MochiKit.Logging.logDebug(">>> Connection.serverSideUserCredentials");
475 newSrpConnection = new Clipperz.Crypto.SRP.Connection({ C:this.C(), P:this.P(), hash:this.hash() });
476 result = newSrpConnection.serverSideCredentials();
477 result['version'] = this.clipperz_pm_crypto_version();
478
479//MochiKit.Logging.logDebug("<<< Connection.serverSideUserCredentials - result: " + Clipperz.Base.serializeJSON(result));
480 return result;
481 },
482
483 //=========================================================================
484
485 'C': function() {
486 if (this._C == null) {
487 this._C = this.hash()(new Clipperz.ByteArray(this.user().username())).toHexString().substring(2);
488 }
489
490 return this._C;
491 },
492
493 //-----------------------------------------------------------------------------
494
495 'P': function() {
496 if (this._P == null) {
497 this._P = this.hash()(new Clipperz.ByteArray(this.user().passphrase() + this.user().username())).toHexString().substring(2);
498 }
499
500 return this._P;
501 },
502
503 //-----------------------------------------------------------------------------
504
505 'hash': function() {
506 return Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].hash;
507 },
508
509 //-----------------------------------------------------------------------------
510
511 'srpConnection': function() {
512 if (this._srpConnection == null) {
513 this._srpConnection = new Clipperz.Crypto.SRP.Connection({ C:this.C(), P:this.P(), hash:this.hash() });
514 }
515
516 return this._srpConnection;
517 },
518
519 'resetSrpConnection': function() {
520 this._C = null;
521 this._P = null;
522 this._srpConnection = null;
523 },
524
525 //-----------------------------------------------------------------------------
526 __syntaxFix__: "syntax fix"
527
528});
529
530
531
532//-----------------------------------------------------------------------------
533//
534 // S R P [ 1 . 1 ] C O N N E C T I O N class
535//
536//-----------------------------------------------------------------------------
537
538Clipperz.PM.Connection.SRP['1.1'] = function (args) {
539 args = args || {};
540 Clipperz.PM.Connection.SRP['1.0'].call(this, args);
541
542 return this;
543}
544
545Clipperz.PM.Connection.SRP['1.1'].prototype = MochiKit.Base.update(new Clipperz.PM.Connection.SRP['1.0'](), {
546
547 'version': function() {
548 return '1.1';
549 },
550
551 //-----------------------------------------------------------------------------
552
553 'C': function() {
554 if (this._C == null) {
555 this._C = this.hash()(new Clipperz.ByteArray(this.user().username() + this.user().passphrase())).toHexString().substring(2);
556 }
557
558 return this._C;
559 },
560
561 //-----------------------------------------------------------------------------
562
563 'P': function() {
564 if (this._P == null) {
565 this._P = this.hash()(new Clipperz.ByteArray(this.user().passphrase() + this.user().username())).toHexString().substring(2);
566 }
567
568 return this._P;
569 },
570
571 //-----------------------------------------------------------------------------
572
573 'hash': function() {
574 return Clipperz.PM.Crypto.encryptingFunctions.versions['0.2'].hash;
575 },
576
577 //-----------------------------------------------------------------------------
578 __syntaxFix__: "syntax fix"
579
580});
581
582Clipperz.PM.Connection.exception = {
583 WrongChecksum: new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.InvalidValue")
584};
diff --git a/frontend/beta/js/Clipperz/PM/Crypto.js b/frontend/beta/js/Clipperz/PM/Crypto.js
new file mode 100644
index 0000000..7636822
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Crypto.js
@@ -0,0 +1,503 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Crypto) == 'undefined') { Clipperz.PM.Crypto = {}; }
32
33Clipperz.PM.Crypto.VERSION = "0.2";
34Clipperz.PM.Crypto.NAME = "Clipperz.PM.Crypto";
35
36MochiKit.Base.update(Clipperz.PM.Crypto, {
37
38 '__repr__': function () {
39 return "[" + this.NAME + " " + this.VERSION + "]";
40 },
41
42 //-------------------------------------------------------------------------
43
44 'toString': function () {
45 return this.__repr__();
46 },
47
48 //-------------------------------------------------------------------------
49
50 'communicationProtocol': {
51 'currentVersion': '0.2',
52 'versions': {
53 '0.1': Clipperz.PM.Connection.SRP['1.0'],//Clipperz.Crypto.SRP.versions['1.0'].Connection,
54 '0.2': Clipperz.PM.Connection.SRP['1.1']//Clipperz.Crypto.SRP.versions['1.1'].Connection,
55 },
56 'fallbackVersions': {
57 'current':'0.1',
58 '0.2': '0.1',
59 '0.1': null
60 }
61 },
62
63 //-------------------------------------------------------------------------
64
65 'encryptingFunctions': {
66 'currentVersion': '0.3',
67 'versions': {
68
69 //#####################################################################
70
71 '0.1': {
72 'encrypt': function(aKey, aValue) {
73 return Clipperz.Crypto.Base.encryptUsingSecretKey(aKey, Clipperz.Base.serializeJSON(aValue));
74 },
75
76 'deferredEncrypt': function(aKey, aValue) {
77 var deferredResult;
78
79 deferredResult = new MochiKit.Async.Deferred();
80 deferredResult.addCallback(Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].encrypt, aKey, aValue);
81 deferredResult.callback();
82
83 return deferredResult;
84 },
85
86 'decrypt': function(aKey, aValue) {
87 var result;
88
89 if (aValue != null) {
90 result = Clipperz.Base.evalJSON(Clipperz.Crypto.Base.decryptUsingSecretKey(aKey, aValue));
91 } else {
92 result = null;
93 }
94
95 return result;
96 },
97
98 'deferredDecrypt': function(aKey, aValue) {
99 var deferredResult;
100
101 deferredResult = new MochiKit.Async.Deferred();
102 deferredResult.addCallback(Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].decrypt, aKey, aValue);
103 deferredResult.callback();
104
105 return deferredResult;
106 },
107
108 'hash': function(aValue) {
109 var result;
110 var strngResult;
111
112 stringResult = Clipperz.Crypto.Base.computeHashValue(aValue.asString()); //!!!!!!!
113 result = new Clipperz.ByteArray("0x" + stringResult);
114
115 return result;
116 }
117 },
118
119 //#####################################################################
120
121 '0.2': {
122 'encrypt': function(aKey, aValue, aNonce) {
123 var result;
124 varkey, value;
125 var dataToEncrypt;
126 var encryptedData;
127
128 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
129 value = new Clipperz.ByteArray(Clipperz.Base.serializeJSON(aValue));
130 dataToEncrypt = Clipperz.Crypto.SHA.sha_d256(value).appendBlock(value);
131 encryptedData = Clipperz.Crypto.AES.encrypt(key, dataToEncrypt, aNonce);
132 result = encryptedData.toBase64String();
133
134 return result;
135 },
136
137 'deferredEncrypt': function(aKey, aValue, aNonce) {
138 var deferredResult;
139 varkey, value;
140 var dataToEncrypt;
141 var encryptedData;
142
143 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
144 value = new Clipperz.ByteArray(Clipperz.Base.serializeJSON(aValue));
145 dataToEncrypt = Clipperz.Crypto.SHA.sha_d256(value).appendBlock(value);
146
147 deferredResult = new MochiKit.Async.Deferred()
148 deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncrypt, key, dataToEncrypt, aNonce);
149 deferredResult.addCallback(function(aResult) {
150 return aResult.toBase64String();
151 })
152 deferredResult.callback();
153
154 return deferredResult;
155 },
156
157 'decrypt': function(aKey, aValue) {
158 var result;
159
160 if (aValue != null) {
161 var key, value;
162 var decryptedData;
163 var decryptedData;
164
165 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
166 value = new Clipperz.ByteArray().appendBase64String(aValue);
167
168 decryptedData = Clipperz.Crypto.AES.decrypt(key, value);
169 decryptedData = decryptedData.split((256/8));
170
171 try {
172 result = Clipperz.Base.evalJSON(decryptedData.asString());
173 } catch (exception) {
174 MochiKit.Logging.logError("Error while decrypting data");
175 throw Clipperz.Crypto.Base.exception.CorruptedMessage;
176 }
177 } else {
178 result = null;
179 }
180
181 return result;
182 },
183
184 'deferredDecrypt': function(aKey, aValue) {
185 var result;
186
187 if (aValue != null) {
188 var deferredResult;
189 var key, value;
190 var decryptedData;
191
192 result = new MochiKit.Async.Deferred();
193
194 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
195 value = new Clipperz.ByteArray().appendBase64String(aValue);
196
197
198 deferredResult = new MochiKit.Async.Deferred()
199 deferredResult.addCallback(Clipperz.Crypto.AES.deferredDecrypt, key, value);
200 deferredResult.addCallback(function(aResult) {
201 var result;
202 var decryptedData;
203
204 decryptedData = aResult.split((256/8));
205
206 try {
207 result = Clipperz.Base.evalJSON(decryptedData.asString());
208 } catch (exception) {
209 MochiKit.Logging.logError("Error while decrypting data");
210 throw Clipperz.Crypto.Base.exception.CorruptedMessage;
211 }
212
213 return result;
214 })
215 deferredResult.callback();
216
217 result = deferredResult;
218 } else {
219 result = MochiKit.Async.succeed(null);
220 }
221
222 return result;
223 },
224
225 'hash': Clipperz.Crypto.SHA.sha_d256
226 },
227
228 //#####################################################################
229
230 '0.3': {
231 'encrypt': function(aKey, aValue, aNonce) {
232 var result;
233 varkey, value;
234 var data;
235 var dataToEncrypt;
236 var encryptedData;
237
238 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
239 value = Clipperz.Base.serializeJSON(aValue);
240 data = new Clipperz.ByteArray(value);
241 encryptedData = Clipperz.Crypto.AES.encrypt(key, data, aNonce);
242 result = encryptedData.toBase64String();
243
244 return result;
245 },
246
247 'deferredEncrypt': function(aKey, aValue, aNonce) {
248 var deferredResult;
249 varkey, value;
250 var data;
251 var dataToEncrypt;
252 var encryptedData;
253
254 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
255 value = Clipperz.Base.serializeJSON(aValue);
256 data = new Clipperz.ByteArray(value);
257
258 deferredResult = new MochiKit.Async.Deferred()
259//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.PM.Crypto.deferredEncrypt - 1: " + res); return res;});
260 deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncrypt, key, data, aNonce);
261//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.PM.Crypto.deferredEncrypt - 2: " + res); return res;});
262 deferredResult.addCallback(function(aResult) {
263 return aResult.toBase64String();
264 })
265//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.PM.Crypto.deferredEncrypt - 3: " + res); return res;});
266 deferredResult.callback();
267
268 return deferredResult;
269 },
270
271 'decrypt': function(aKey, aValue) {
272 var result;
273
274 if (aValue != null) {
275 var key, value;
276 var decryptedData;
277 var decryptedValue;
278
279 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
280 value = new Clipperz.ByteArray().appendBase64String(aValue);
281
282 decryptedData = Clipperz.Crypto.AES.decrypt(key, value);
283
284 value = decryptedData.asString();
285 try {
286 result = Clipperz.Base.evalJSON(value);
287 } catch (exception) {
288 MochiKit.Logging.logError("Error while decrypting data");
289 throw Clipperz.Crypto.Base.exception.CorruptedMessage;
290 }
291 } else {
292 result = null;
293 }
294
295 return result;
296 },
297
298 'deferredDecrypt': function(aKey, aValue) {
299 var deferredResult;
300 // var now;
301
302 deferredResult = new MochiKit.Async.Deferred();
303 now = new Date;
304
305//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("[" + (new Date() - now) + "] Clipperz.PM.Crypto.deferredDecrypt - 1: " + res); return res;});
306 if (aValue != null) {
307 var key, value;
308 var decryptedData;
309 var decryptedValue;
310
311 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
312//MochiKit.Logging.logDebug("[" + (new Date() - now) + "] computed key");
313 value = new Clipperz.ByteArray().appendBase64String(aValue);
314//MochiKit.Logging.logDebug("[" + (new Date() - now) + "] appendedBase64String");
315
316//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("[" + (new Date() - now) + "] Clipperz.PM.Crypto.deferredDecrypt - 1.1: " /* + res*/); return res;});
317 deferredResult.addCallback(Clipperz.Crypto.AES.deferredDecrypt, key, value);
318//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("[" + (new Date() - now) + "] Clipperz.PM.Crypto.deferredDecrypt - 2: " /* + res*/); return res;});
319 deferredResult.addCallback(MochiKit.Async.wait, 0.1);
320//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("[" + (new Date() - now) + "] Clipperz.PM.Crypto.deferredDecrypt - 3: " /* + res*/); return res;});
321 deferredResult.addCallback(function(aResult) {
322 return aResult.asString();
323 });
324//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("[" + (new Date() - now) + "] Clipperz.PM.Crypto.deferredDecrypt - 4: " /* + res*/); return res;});
325 deferredResult.addCallback(MochiKit.Async.wait, 0.1);
326//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("[" + (new Date() - now) + "] Clipperz.PM.Crypto.deferredDecrypt - 5: " /* + res*/); return res;});
327 deferredResult.addCallback(Clipperz.Base.evalJSON);
328//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("[" + (new Date() - now) + "] Clipperz.PM.Crypto.deferredDecrypt - 6: " /* + res*/); return res;});
329 deferredResult.addErrback(function(anError) {
330 MochiKit.Logging.logError("Error while decrypting data");
331 throw Clipperz.Crypto.Base.exception.CorruptedMessage;
332 })
333//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("[" + (new Date() - now) + "] Clipperz.PM.Crypto.deferredDecrypt - 7: " /* + res*/); return res;});
334 } else {
335 deferredResult.addCallback(function() {
336 return null;
337 });
338 }
339 deferredResult.callback();
340
341 return deferredResult;
342 },
343
344 'hash': Clipperz.Crypto.SHA.sha_d256
345 },
346
347 //#####################################################################
348/*
349 '0.4': {
350 'encrypt': function(aKey, aValue, aNonce) {
351 var result;
352 varkey, value;
353 var data;
354 var dataToEncrypt;
355 var encryptedData;
356
357//MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt");
358 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
359//MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 1");
360 value = Clipperz.Base.serializeJSON(aValue);
361//MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 2");
362/ *
363//MochiKit.Logging.logDebug("--> encrypt.fullSize: " + value.length);
364 value = value.replace(/":{"label":"/g, '":{l:"');
365 value = value.replace(/":{"key":"/g, '":{k:"');
366 value = value.replace(/":{"notes":"/g, '":{n:"');
367 value = value.replace(/":{"record":"/g, '":{r:"');
368 value = value.replace(/", "label":"/g, '",l:"');
369 value = value.replace(/", "favicon":"/g,'",f:"');
370//MochiKit.Logging.logDebug("<-- encrypt.compressed: " + value.length);
371* /
372 data = new Clipperz.ByteArray(value);
373//MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 3");
374 encryptedData = Clipperz.Crypto.AES.encrypt(key, data, aNonce);
375//MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 4");
376 result = encryptedData.toBase64String();
377//MochiKit.Logging.logDebug("<<< [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt");
378
379 return result;
380 },
381
382 'decrypt': function(aKey, aValue) {
383 var result;
384
385 if (aValue != null) {
386 var key, value;
387 var decryptedData;
388 var decryptedValue;
389
390 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
391 value = new Clipperz.ByteArray().appendBase64String(aValue);
392
393 decryptedData = Clipperz.Crypto.AES.decrypt(key, value);
394
395 value = decryptedData.asString();
396/ *
397 value = value.replace(/":{l:"/g,'":{"label":"');
398 value = value.replace(/":{k:"/g,'":{"key":"');
399 value = value.replace(/":{n:"/g,'":{"notes":"');
400 value = value.replace(/":{r:"/g,'":{"record":"');
401 value = value.replace(/",l:"/g, '", "label":"');
402 value = value.replace(/",f:"/g, '", "favicon":"');
403* /
404 try {
405 result = Clipperz.Base.evalJSON(value);
406 } catch (exception) {
407 MochiKit.Logging.logError("Error while decrypting data");
408 throw Clipperz.Crypto.Base.exception.CorruptedMessage;
409 }
410
411
412 } else {
413 result = null;
414 }
415
416 return result;
417 },
418
419 'hash': Clipperz.Crypto.SHA.sha_d256
420 },
421*/
422 //#####################################################################
423 __syntaxFix__: "syntax fix"
424 }
425 },
426
427 //-------------------------------------------------------------------------
428
429 'encrypt': function(aKey, aValue, aVersion) {
430 return Clipperz.PM.Crypto.encryptingFunctions.versions[aVersion].encrypt(aKey, aValue);
431 },
432
433 'deferredEncrypt': function(aKey, aValue, aVersion) {
434 return Clipperz.PM.Crypto.encryptingFunctions.versions[aVersion].deferredEncrypt(aKey, aValue);
435 },
436
437 'encryptWithCurrentVersion': function(aKey, aValue) {
438 return Clipperz.PM.Crypto.encrypt(aKey, aValue, Clipperz.PM.Crypto.encryptingFunctions.currentVersion);
439 },
440
441 'deferredEncryptWithCurrentVersion': function(aKey, aValue) {
442 return Clipperz.PM.Crypto.deferredEncrypt(aKey, aValue, Clipperz.PM.Crypto.encryptingFunctions.currentVersion);
443 },
444
445 //.........................................................................
446
447 'decrypt': function(aKey, aValue, aVersion) {
448 return Clipperz.PM.Crypto.encryptingFunctions.versions[aVersion].decrypt(aKey, aValue);
449 },
450
451 'deferredDecrypt': function(aKey, aValue, aVersion) {
452 return Clipperz.PM.Crypto.encryptingFunctions.versions[aVersion].deferredDecrypt(aKey, aValue);
453 },
454
455 //-------------------------------------------------------------------------
456
457 'randomKey': function() {
458 return Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2);
459 },
460
461 //-------------------------------------------------------------------------
462
463 'passwordEntropy': function(aValue) {
464 var result;
465 varbitPerChar;
466
467 bitPerChar = 4;
468 if (/[a-z]/.test(aValue)) {
469 bitPerChar ++;
470 }
471 if (/[A-Z]/.test(aValue)) {
472 bitPerChar ++;
473 }
474 if (/[^a-zA-Z0-9]/.test(aValue)) {
475 bitPerChar ++;
476 }
477//MochiKit.Logging.logDebug("--- bitPerChar: " + bitPerChar);
478
479 result = aValue.length * bitPerChar;
480
481 return result;
482 },
483
484 //-------------------------------------------------------------------------
485
486 'nullValue': "####",
487
488 //-------------------------------------------------------------------------
489 __syntaxFix__: "syntax fix"
490
491});
492
493//*****************************************************************************
494
495MochiKit.Base.update(Clipperz.PM.Crypto.communicationProtocol.versions, {
496 'current': Clipperz.PM.Crypto.communicationProtocol.versions[Clipperz.PM.Crypto.communicationProtocol.currentVersion]
497});
498
499MochiKit.Base.update(Clipperz.PM.Crypto.encryptingFunctions.versions, {
500 'current': Clipperz.PM.Crypto.encryptingFunctions.versions[Clipperz.PM.Crypto.encryptingFunctions.currentVersion]
501});
502
503//*****************************************************************************
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js
new file mode 100644
index 0000000..3ebc208
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js
@@ -0,0 +1,536 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33
34//#############################################################################
35
36Clipperz.PM.DataModel.DirectLogin = function(args) {
37//MochiKit.Logging.logDebug(">>> new Clipperz.PM.DataModel.DirectLogin");
38//console.log(">>> new Clipperz.PM.DataModel.DirectLogin - args: %o", args);
39//console.log("--- formData: %s", Clipperz.Base.serializeJSON(args.formData));
40 args = args || {};
41
42//MochiKit.Logging.logDebug("--- new Clipperz.PM.DataModel.DirectLogin - args: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(args)));
43 this._record = args.record || null;
44 this._label = args.label || "unnamed record"
45 this._reference = args.reference || Clipperz.PM.Crypto.randomKey();
46 this._favicon = args.favicon || null;
47 this._bookmarkletVersion = args.bookmarkletVersion || "0.1";
48
49 this._directLoginInputs = null;
50
51 this._formValues = args.formValues || {};
52 this.setFormData(args.formData || null);
53//console.log("=== formData: %o", this.formData());
54
55 if (args.legacyBindingData == null) {
56 this.setBindingData(args.bindingData || null);
57 } else {
58 this.setLegacyBindingData(args.legacyBindingData);
59 }
60
61 this._fixedFavicon = null;
62
63 //this._formValues = args.formValues || (this.hasValuesToSet() ? {} : null);
64//MochiKit.Logging.logDebug("<<< new Clipperz.PM.DataModel.DirectLogin");
65
66 return this;
67}
68
69Clipperz.PM.DataModel.DirectLogin.prototype = MochiKit.Base.update(null, {
70
71 'remove': function() {
72 this.record().removeDirectLogin(this);
73 },
74
75 //-------------------------------------------------------------------------
76
77 'record': function() {
78 return this._record;
79 },
80
81 //-------------------------------------------------------------------------
82
83 'user': function() {
84 return this.record().user();
85 },
86
87 //-------------------------------------------------------------------------
88
89 'reference': function() {
90 return this._reference;
91 },
92
93 //-------------------------------------------------------------------------
94
95 'label': function() {
96 return this._label;
97 },
98
99 'setLabel': function(aValue) {
100 this._label = aValue;
101 },
102
103 //-------------------------------------------------------------------------
104
105 'favicon': function() {
106 if (this._favicon == null) {
107 varactionUrl;
108 var hostname;
109
110 actionUrl = this.formData()['attributes']['action'];
111 hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1');
112 this._favicon = "http://" + hostname + "/favicon.ico";
113 }
114
115 return this._favicon;
116 },
117
118 //-------------------------------------------------------------------------
119
120 'fixedFavicon': function() {
121 var result;
122
123 if (this._fixedFavicon == null) {
124 result = this.favicon();
125
126 if (Clipperz_IEisBroken) {
127 if (this.user().preferences().disableUnsecureFaviconLoadingForIE()) {
128 if (result.indexOf('https://') != 0) {
129 result = Clipperz.PM.Strings['defaultFaviconUrl_IE'];
130 this.setFixedFavicon(result);
131 }
132 }
133 }
134 } else {
135 result = this._fixedFavicon;
136 }
137
138 return result;
139 },
140
141 'setFixedFavicon': function(aValue) {
142 this._fixedFavicon = aValue;
143 },
144
145 //-------------------------------------------------------------------------
146
147 'bookmarkletVersion': function() {
148 return this._bookmarkletVersion;
149 },
150
151 'setBookmarkletVersion': function(aValue) {
152 this._bookmarkletVersion = aValue;
153 },
154
155 //-------------------------------------------------------------------------
156
157 'formData': function() {
158 return this._formData;
159 },
160
161 'setFormData': function(aValue) {
162 var formData;
163
164//MochiKit.Logging.logDebug(">>> DirectLogin.setFormData - " + Clipperz.Base.serializeJSON(aValue));
165 switch (this.bookmarkletVersion()) {
166 case "0.2":
167 formData = aValue;
168 break;
169 case "0.1":
170//MochiKit.Logging.logDebug("--- DirectLogin.setFormData - fixing form data from bookmarklet version 0.1");
171 formData = this.fixFormDataFromBookmarkletVersion_0_1(aValue);
172 break;
173 }
174
175 this._formData = aValue;
176 this.setBookmarkletVersion("0.2");
177
178//MochiKit.Logging.logDebug("--- DirectLogin.setFormData - formData: " + Clipperz.Base.serializeJSON(formData));
179 if (formData != null) {
180 var i,c;
181
182 this._directLoginInputs = [];
183 c = formData['inputs'].length;
184 for (i=0; i<c; i++) {
185 var directLoginInput;
186
187 directLoginInput = new Clipperz.PM.DataModel.DirectLoginInput(this, formData['inputs'][i]);
188 this._directLoginInputs.push(directLoginInput);
189 }
190 }
191//MochiKit.Logging.logDebug("<<< DirectLogin.setFormData");
192 },
193
194 'fixFormDataFromBookmarkletVersion_0_1': function(aValue) {
195//{"type":"radio", "name":"action", "value":"new-user", "checked":false }, { "type":"radio", "name":"action", "value":"sign-in", "checked":true }
196 // ||
197 // \ /
198 // \/
199//{"name":"dominio", "type":"radio", "options":[{"value":"@alice.it", "checked":true}, {"value":"@tin.it", "checked":false}, {"value":"@virgilio.it", "checked":false}, {"value":"@tim.it", "checked":false}]}
200 var result;
201 var inputs;
202 var updatedInputs;
203 var radios;
204
205//MochiKit.Logging.logDebug(">>> DirectLogin.fixFormDataFromBookmarkletVersion_0_1");
206 result = aValue;
207 inputs = aValue['inputs'];
208
209 updatedInputs = MochiKit.Base.filter(function(anInput) {
210 varresult;
211 var type;
212
213 type = anInput['type'] || 'text';
214 result = type.toLowerCase() != 'radio';
215
216 return result;
217 }, inputs);
218 radios = MochiKit.Base.filter(function(anInput) {
219 varresult;
220 var type;
221
222 type = anInput['type'] || 'text';
223 result = type.toLowerCase() == 'radio';
224
225 return result;
226 }, inputs);
227
228 if (radios.length > 0) {
229 var updatedRadios;
230
231 updatedRadios = {};
232 MochiKit.Iter.forEach(radios, MochiKit.Base.bind(function(aRadio) {
233 varradioConfiguration;
234
235 radioConfiguration = updatedRadios[aRadio['name']];
236 if (radioConfiguration == null) {
237 radioConfiguration = {type:'radio', name:aRadio['name'], options:[]};
238 updatedRadios[aRadio['name']] = radioConfiguration;
239 }
240
241 //TODO: remove the value: field and replace it with element.dom.value = <some value>
242 radioConfiguration.options.push({value:aRadio['value'], checked:aRadio['checked']});
243
244 if ((aRadio['checked'] == true) && (this.formValues()[aRadio['name']] == null)) {
245//MochiKit.Logging.logDebug("+++ setting value '" + aRadio['value'] + "' for key: '" + aRadio['name'] + "'");
246 this.formValues()[aRadio['name']] = aRadio['value'];
247 }
248 }, this))
249
250 updatedInputs = MochiKit.Base.concat(updatedInputs, MochiKit.Base.values(updatedRadios));
251 }
252
253 delete result.inputs;
254 result.inputs = updatedInputs;
255//MochiKit.Logging.logDebug("<<< DirectLogin.fixFormDataFromBookmarkletVersion_0_1");
256
257 return result;
258 },
259
260 //.........................................................................
261
262 'directLoginInputs': function() {
263 return this._directLoginInputs;
264 },
265
266 //-------------------------------------------------------------------------
267
268 'formValues': function() {
269 return this._formValues;
270 },
271
272 'hasValuesToSet': function() {
273 var result;
274
275//MochiKit.Logging.logDebug(">>> DirectLogin.hasValuesToSet");
276 if (this.directLoginInputs() != null) {
277 result = MochiKit.Iter.some(this.directLoginInputs(), MochiKit.Base.methodcaller('shouldSetValue'));
278 } else {
279 result = false;
280 }
281//MochiKit.Logging.logDebug("<<< DirectLogin.hasValuesToSet");
282
283 return result;
284 },
285
286 //'additionalValues': function() {
287 'inputsRequiringAdditionalValues': function() {
288 varresult;
289 var inputs;
290
291//MochiKit.Logging.logDebug(">>> DirectLogin.additionalValues");
292 result = {};
293 if (this.directLoginInputs() != null) {
294 inputs = MochiKit.Base.filter(MochiKit.Base.methodcaller('shouldSetValue'), this.directLoginInputs());
295 MochiKit.Iter.forEach(inputs, function(anInput) {
296 result[anInput.name()] = anInput;
297 })
298 }
299//MochiKit.Logging.logDebug("<<< DirectLogin.additionalValues");
300
301 return result;
302 },
303
304 //-------------------------------------------------------------------------
305
306 'bindingData': function() {
307 return this._bindingData;
308 },
309
310 'setBindingData': function(aValue) {
311//MochiKit.Logging.logDebug(">>> DirectLogin.setBindingData");
312 if (aValue != null) {
313 var bindingKey;
314
315 this._bindingData = aValue;
316 this._bindings = {};
317
318 for (bindingKey in aValue) {
319 var directLoginBinding;
320
321 directLoginBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, bindingKey, {fieldKey:aValue[bindingKey]});
322 this._bindings[bindingKey] = directLoginBinding;
323 }
324 } else {
325 var editableFields;
326 var bindings;
327
328 bindings = {};
329
330 editableFields = MochiKit.Base.filter(function(aField) {
331 var result;
332 var type;
333
334 type = aField['type'].toLowerCase();
335 result = ((type != 'hidden') && (type != 'submit') && (type != 'checkbox') && (type != 'radio') && (type != 'select'));
336
337 return result;
338 }, this.formData().inputs);
339
340 MochiKit.Iter.forEach(editableFields, function(anEditableField) {
341 bindings[anEditableField['name']] = new Clipperz.PM.DataModel.DirectLoginBinding(this, anEditableField['name']);
342 }, this);
343
344 this._bindings = bindings;
345 }
346//MochiKit.Logging.logDebug("<<< DirectLogin.setBindingData");
347 },
348
349 'setLegacyBindingData': function(aValue) {
350//MochiKit.Logging.logDebug(">>> DirectLogin.setLegacyBindingData");
351 var bindingKey;
352
353 this._bindingData = aValue;
354 this._bindings = {};
355
356 for (bindingKey in aValue) {
357 var directLoginBinding;
358
359 directLoginBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, bindingKey, {fieldName:aValue[bindingKey]});
360 this._bindings[bindingKey] = directLoginBinding;
361 }
362//MochiKit.Logging.logDebug("<<< DirectLogin.setLegacyBindingData");
363 },
364
365 //.........................................................................
366
367 'bindings': function() {
368 return this._bindings;
369 },
370
371 //-------------------------------------------------------------------------
372
373 'serializedData': function() {
374 var result;
375 varbindingKey;
376
377 result = {};
378 // result.reference = this.reference();
379 result.label = this.label();
380 result.favicon = this.favicon() || "";
381 result.bookmarkletVersion = this.bookmarkletVersion();
382 result.formData = this.formData();
383 if (this.hasValuesToSet) {
384 result.formValues = this.formValues();
385 }
386 result.bindingData = {};
387
388 for (bindingKey in this.bindings()) {
389 result.bindingData[bindingKey] = this.bindings()[bindingKey].serializedData();
390 }
391
392 return result;
393 },
394
395 //-------------------------------------------------------------------------
396
397 'handleMissingFaviconImage': function(anEvent) {
398 anEvent.stop();
399 MochiKit.Signal.disconnectAll(anEvent.src());
400 this.setFixedFavicon(Clipperz.PM.Strings['defaultFaviconUrl']);
401 anEvent.src().src = this.fixedFavicon();
402 },
403
404 //=========================================================================
405
406 'runHttpAuthDirectLogin': function(aWindow) {
407 MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function() {
408 var completeUrl;
409 var url;
410
411 url = this.bindings()['url'].field().value();
412
413 if (/^https?\:\/\//.test(url) == false) {
414 url = 'http://' + url;
415 }
416
417 if (Clipperz_IEisBroken === true) {
418 completeUrl = url;
419 } else {
420 var username;
421 var password;
422
423 username = this.bindings()['username'].field().value();
424 password = this.bindings()['password'].field().value();
425
426 /(^https?\:\/\/)?(.*)/.test(url);
427
428 completeUrl = RegExp.$1 + username + ':' + password + '@' + RegExp.$2;
429 }
430
431 MochiKit.DOM.currentWindow().location.href = completeUrl;
432 }, this));
433 },
434
435 //-------------------------------------------------------------------------
436
437 'runSubmitFormDirectLogin': function(aWindow) {
438 MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function() {
439 var formElement;
440 varformSubmitFunction;
441 var submitButtons;
442
443//MochiKit.Logging.logDebug("### runDirectLogin - 3");
444 // MochiKit.DOM.currentDocument().write('<html><head><title>' + this.label() + '</title><META http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body></body></html>')
445//MochiKit.Logging.logDebug("### runDirectLogin - 3.1");
446 MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, MochiKit.DOM.H3(null, "Loading " + this.label() + " ..."));
447//MochiKit.Logging.logDebug("### runDirectLogin - 4");
448//console.log(this.formData()['attributes']);
449 formElement = MochiKit.DOM.FORM(MochiKit.Base.update({id:'directLoginForm'}, {'method':this.formData()['attributes']['method'],
450 'action':this.formData()['attributes']['action']}));
451//MochiKit.Logging.logDebug("### runDirectLogin - 5");
452 formSubmitFunction = MochiKit.Base.method(formElement, 'submit');
453//MochiKit.Logging.logDebug("### runDirectLogin - 6");
454
455 MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body,
456 MochiKit.DOM.DIV({style:'display:none; visibility:hidden;'}, formElement)
457 );
458//MochiKit.Logging.logDebug("### runDirectLogin - 7");
459 MochiKit.DOM.appendChildNodes(formElement, MochiKit.Base.map(MochiKit.Base.methodcaller("formConfiguration"),
460 this.directLoginInputs()));
461//MochiKit.Logging.logDebug("### runDirectLogin - 8");
462
463 submitButtons = MochiKit.Base.filter(function(anInputElement) {
464//MochiKit.Logging.logDebug("### runDirectLogin - 8.1 - " + anInputElement);
465//MochiKit.Logging.logDebug("### runDirectLogin - 8.2 - " + anInputElement.tagName);
466//MochiKit.Logging.logDebug("### runDirectLogin - 8.3 - " + anInputElement.getAttribute('type'));
467 return ((anInputElement.tagName.toLowerCase() == 'input') && (anInputElement.getAttribute('type').toLowerCase() == 'submit'));
468 }, formElement.elements)
469//MochiKit.Logging.logDebug("### runDirectLogin - 9");
470
471 if (submitButtons.length == 0) {
472//MochiKit.Logging.logDebug("### OLD submit")
473 if (Clipperz_IEisBroken == true) {
474//MochiKit.Logging.logDebug("### runDirectLogin - 10");
475 formElement.submit();
476 } else {
477//MochiKit.Logging.logDebug("### runDirectLogin - 11");
478 formSubmitFunction();
479 }
480 } else {
481//MochiKit.Logging.logDebug("### NEW submit")
482 submitButtons[0].click();
483 }
484
485 }, this));
486 },
487
488 //-------------------------------------------------------------------------
489
490 'runDirectLogin': function(aNewWindow) {
491 varnewWindow;
492
493//console.log("formData.attributes", this.formData()['attributes']);
494 // if (/^javascript/.test(this.formData()['attributes']['action'])) {
495 if ((/^(https?|webdav|ftp)\:/.test(this.formData()['attributes']['action']) == false) &&
496 (this.formData()['attributes']['type'] != 'http_auth'))
497 {
498 var messageBoxConfiguration;
499
500 if (typeof(aNewWindow) != 'undefined') {
501 aNewWindow.close();
502 }
503
504 messageBoxConfiguration = {};
505 messageBoxConfiguration.title = Clipperz.PM.Strings['VulnerabilityWarning_Panel_title'];
506 messageBoxConfiguration.msg = Clipperz.PM.Strings['VulnerabilityWarning_Panel_message'];
507 messageBoxConfiguration.animEl = YAHOO.ext.Element.get("mainDiv");
508 messageBoxConfiguration.progress = false;
509 messageBoxConfiguration.closable = false;
510 messageBoxConfiguration.buttons = {'cancel': Clipperz.PM.Strings['VulnerabilityWarning_Panel_buttonLabel']};
511
512 Clipperz.YUI.MessageBox.show(messageBoxConfiguration);
513
514 throw Clipperz.Base.exception.VulnerabilityIssue;
515 }
516
517//MochiKit.Logging.logDebug("### runDirectLogin - 1 : " + Clipperz.Base.serializeJSON(this.serializedData()));
518 if (typeof(aNewWindow) == 'undefined') {
519 newWindow = window.open(Clipperz.PM.Strings['directLoginJumpPageUrl'], "");
520 } else {
521 newWindow = aNewWindow;
522 }
523//MochiKit.Logging.logDebug("### runDirectLogin - 2");
524
525 if (this.formData()['attributes']['type'] == 'http_auth') {
526 this.runHttpAuthDirectLogin(newWindow);
527 } else {
528 this.runSubmitFormDirectLogin(newWindow)
529 }
530 },
531
532 //-------------------------------------------------------------------------
533 __syntaxFix__: "syntax fix"
534
535});
536
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginBinding.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginBinding.js
new file mode 100644
index 0000000..19aa9cb
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginBinding.js
@@ -0,0 +1,113 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33
34//#############################################################################
35
36Clipperz.PM.DataModel.DirectLoginBinding = function(aDirectLogin, aKey, args) {
37//MochiKit.Logging.logDebug(">>> new DirectLoginBinding")
38 args = args || {};
39//MochiKit.Logging.logDebug("--- new DirectLoginBinding - args: " + Clipperz.Base.serializeJSON(args));
40
41 this._directLogin = aDirectLogin || args.directLogin || null;
42 this._key = aKey;
43
44 this._fieldKey = args.fieldKey || null;
45 this._fieldName = args.fieldName || null;
46//MochiKit.Logging.logDebug("<<< new DirectLoginBinding")
47
48 return this;
49}
50
51Clipperz.PM.DataModel.DirectLoginBinding.prototype = MochiKit.Base.update(null, {
52
53 'directLogin': function() {
54 return this._directLogin;
55 },
56
57 //-------------------------------------------------------------------------
58
59 'key': function() {
60 return this._key;
61 },
62
63 //-------------------------------------------------------------------------
64
65 'fieldKey': function() {
66//MochiKit.Logging.logDebug("=== Clipperz.PM.DataModel.DirectLoginBinding.fieldKey");
67//MochiKit.Logging.logDebug("=== Clipperz.PM.DataModel.DirectLoginBinding.fieldKey - " + this._fieldKey);
68 return this._fieldKey;
69 },
70
71 'setFieldKey': function(aValue) {
72 this._fieldKey = aValue;
73 },
74
75 'fieldName': function() {
76 return this._fieldName;
77 },
78
79 //-------------------------------------------------------------------------
80
81 'field': function() {
82 var result;
83
84 //MochiKit.Logging.logDebug(">>> Clipperz.PM.DataModel.DirectLoginBinding.field")
85//MochiKit.Logging.logDebug("--- Clipperz.PM.DataModel.DirectLoginBinding.field - 1 - this.fieldKey(): " + this.fieldKey());
86//MochiKit.Logging.logDebug("--- Clipperz.PM.DataModel.DirectLoginBinding.field - 2 - this.fieldName(): " + this.fieldName());
87 if (this.fieldKey() != null) {
88 result = this.directLogin().record().currentVersion().fields()[this.fieldKey()];
89//MochiKit.Logging.logDebug("--- Clipperz.PM.DataModel.DirectLoginBinding.field - 3 - result: " + result);
90 } else if (this.fieldName() != null) {
91 result = this.directLogin().record().currentVersion().fieldWithName(this.fieldName());
92//MochiKit.Logging.logDebug("--- Clipperz.PM.DataModel.DirectLoginBinding.field - 4 - result: " + result);
93
94 this.setFieldKey(result.key());
95 } else {
96 result = null;
97 }
98 //MochiKit.Logging.logDebug("<<< Clipperz.PM.DataModel.DirectLoginBinding.field")
99
100 return result;
101 },
102
103 //-------------------------------------------------------------------------
104
105 'serializedData': function() {
106 return this.fieldKey();
107 },
108
109 //-------------------------------------------------------------------------
110 __syntaxFix__: "syntax fix"
111
112});
113
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js
new file mode 100644
index 0000000..3302ed6
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js
@@ -0,0 +1,229 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33//#############################################################################
34
35Clipperz.PM.DataModel.DirectLoginInput = function(aDirectLogin, args) {
36 args = args || {};
37
38//console.log(">>> new DirectLoginInput - args: %o" + args);
39 this._directLogin = aDirectLogin;
40 this._args = args;
41
42 return this;
43}
44
45Clipperz.PM.DataModel.DirectLoginInput.prototype = MochiKit.Base.update(null, {
46
47 'directLogin': function() {
48 return this._directLogin;
49 },
50
51 //-------------------------------------------------------------------------
52
53 'args': function() {
54 return this._args;
55 },
56
57 //-------------------------------------------------------------------------
58
59 'name': function() {
60 return this.args()['name'];
61 },
62
63 //-------------------------------------------------------------------------
64
65 'type': function() {
66 var result;
67
68 result = this.args()['type'];
69
70 if (result != null) {
71 result = result.toLowerCase();
72 }
73 return result;
74 },
75
76 //-------------------------------------------------------------------------
77
78 'value': function() {
79 return this.args()['value'];
80 },
81
82 //-------------------------------------------------------------------------
83
84 'formConfiguration': function() {
85 var result;
86
87//MochiKit.Logging.logDebug(">>> DirectLoginInput.formConfiguration - " + this.name());
88 if (this.shouldSetValue()) {
89//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 1");
90 switch (this.type()) {
91 case 'select':
92 var currentValue;
93 var options;
94
95//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2");
96 currentValue = this.directLogin().formValues()[this.name()];
97//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.1");
98 options = this.args()['options'];
99//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.2");
100
101 result = MochiKit.DOM.SELECT({name:this.name()},
102 MochiKit.Base.map(function(anOption) {
103 var options;
104
105//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.3");
106 //TODO: remove the value: field and replace it with element.dom.value = <some value>
107 options = {value:anOption['value']};
108//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.4");
109 if (currentValue == anOption['value']) {
110//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.5");
111 options.selected = true;
112//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.6");
113 }
114//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.7");
115
116 return MochiKit.DOM.OPTION(options, anOption['label'])
117 }, options)
118 )
119//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.8");
120 break;
121 case 'checkbox':
122 var options;
123
124//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 3");
125 options = {type:'checkbox', name: this.name()};
126 if (this.directLogin().formValues()[this.name()] == true) {
127 options['checked'] = true;
128 };
129
130 result = MochiKit.DOM.INPUT(options, null);
131 break;
132 case 'radio':
133 var currentName;
134 var currentValue;
135 var options;
136
137//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4");
138 currentName = this.name();
139//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.1");
140 currentValue = this.directLogin().formValues()[this.name()];
141//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.2");
142 options = this.args()['options'];
143//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.3");
144
145 result = MochiKit.DOM.DIV(null,
146 MochiKit.Base.map(function(anOption) {
147 var options;
148 var isChecked;
149 var inputNode;
150 var divNode;
151
152//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.4");
153 //TODO: remove the value: field and replace it with element.dom.value = <some value>
154 options = {type:'radio', name:currentName, value:anOption['value']}
155 isChecked = (currentValue == anOption['value']);
156//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.5");
157 if (isChecked) {
158//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.6");
159 options.checked = true;
160//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.7");
161 }
162//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.8 - options: " + Clipperz.Base.serializeJSON(options));
163//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.8 - value: " + anOption['value']);
164
165 if (Clipperz_IEisBroken == true) {
166 var checkedValue;
167
168//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.8.1");
169 checkedValue = (isChecked ? " CHECKED" : "");
170//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.8.2");
171 inputNode = MochiKit.DOM.currentDocument().createElement("<INPUT TYPE='RADIO' NAME='" + currentName + "' VALUE='" + anOption['value'] + "'" + checkedValue + ">");
172//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.8.3");
173 } else {
174//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.8.4");
175 inputNode = MochiKit.DOM.INPUT(options, anOption['value']);
176//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.8.5");
177 }
178//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.9");
179 divNode = MochiKit.DOM.DIV(null, inputNode);
180//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.10");
181
182 return divNode;
183 // return MochiKit.DOM.DIV(null, MochiKit.DOM.INPUT(options, anOption['value']));
184 }, options)
185 );
186//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.9");
187 break;
188 }
189 } else {
190 var binding;
191//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 5");
192 binding = this.directLogin().bindings()[this.name()];
193
194//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 6");
195 //TODO: remove the value: field and replace it with element.dom.value = <some value>
196 result = MochiKit.DOM.INPUT({
197 type:((this.type() != 'password') ? this.type() : 'text'),
198 // type:(((this.type() != 'password') && (this.type() != 'submit')) ? this.type() : 'text'),
199 name:this.name(),
200 value:((binding != null)? binding.field().value() : this.value())
201 }, null);
202//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 7");
203 }
204
205//MochiKit.Logging.logDebug("<<< DirectLoginInput.formConfiguration: ");
206 return result;
207 },
208
209 //-------------------------------------------------------------------------
210
211 'shouldSetValue': function() {
212 var type;
213 var result;
214
215//MochiKit.Logging.logDebug(">>> DirectLoginInput.shouldSetValue");
216 type = this.type();
217 result = ((type == 'checkbox') || (type == 'radio') || (type == 'select'));
218//if (result == true) {
219 //MochiKit.Logging.logDebug("DIRECT LOGIN INPUT need value: " + Clipperz.Base.serializeJSON(this.args()));
220//}
221//MochiKit.Logging.logDebug("<<< DirectLoginInput.shouldSetValue");
222 return result;
223 },
224
225 //-------------------------------------------------------------------------
226 __syntaxFix__: "syntax fix"
227
228});
229
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js
new file mode 100644
index 0000000..b067a21
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js
@@ -0,0 +1,192 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33
34//#############################################################################
35
36Clipperz.PM.DataModel.DirectLoginReference = function(args) {
37 args = args || {};
38
39//MochiKit.Logging.logDebug(">>> new DirectLoginReference: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(args)));
40//MochiKit.Logging.logDebug(">>> new DirectLoginReference - record: " + args.record);
41 this._user = args.user;
42
43 if (args.directLogin != null) {
44 this._reference = args.directLogin.reference();
45 this._recordReference = args.directLogin.record().reference();
46 this._label = args.directLogin.label();
47 this._favicon = args.directLogin.favicon() || null;
48
49 this._directLogin = args.directLogin;
50 this._record = args.directLogin.record();
51 } else {
52 this._reference = args.reference;
53 this._recordReference = args.record;
54 this._label = args.label;
55 this._favicon = args.favicon || null;
56
57 this._directLogin = null;
58 this._record = null;
59 }
60
61 this._fixedFavicon = null;
62
63 return this;
64}
65
66Clipperz.PM.DataModel.DirectLoginReference.prototype = MochiKit.Base.update(null, {
67
68 'user': function() {
69 return this._user;
70 },
71
72 //-------------------------------------------------------------------------
73
74 'reference': function() {
75 return this._reference;
76 },
77
78 //-------------------------------------------------------------------------
79
80 'synchronizeValues': function(aDirectLogin) {
81 this._label = aDirectLogin.label();
82 this._favicon = aDirectLogin.favicon();
83 },
84
85 //-------------------------------------------------------------------------
86
87 'label': function() {
88 return this._label;
89 },
90
91 //-------------------------------------------------------------------------
92
93 'recordReference': function() {
94 return this._recordReference;
95 },
96
97 //-------------------------------------------------------------------------
98
99 'record': function() {
100//MochiKit.Logging.logDebug(">>> DirectLoginReference.record");
101 if (this._record == null) {
102 this._record = this.user().records()[this.recordReference()];
103 }
104
105//MochiKit.Logging.logDebug("<<< DirectLoginReference.record");
106 return this._record;
107 },
108
109 //-------------------------------------------------------------------------
110
111 'favicon': function() {
112 return this._favicon;
113 },
114
115 //-------------------------------------------------------------------------
116
117 'fixedFavicon': function() {
118 var result;
119
120 if (this._fixedFavicon == null) {
121 result = this.favicon();
122
123 if (Clipperz_IEisBroken && (this.user().preferences().disableUnsecureFaviconLoadingForIE()) && (result.indexOf('https://') != 0)) {
124 result = Clipperz.PM.Strings['defaultFaviconUrl_IE'];
125 this.setFixedFavicon(result);
126 }
127 } else {
128 result = this._fixedFavicon;
129 }
130
131 return result;
132 },
133
134 'setFixedFavicon': function(aValue) {
135 this._fixedFavicon = aValue;
136 },
137
138 //-------------------------------------------------------------------------
139
140 'setupJumpPageWindow': function(aWindow) {
141//MochiKit.Logging.logDebug(">>> DirectLoginReference.setupJumpPageWindow - " + aWindow);
142 try {
143 MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function() {
144 MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body,
145 MochiKit.DOM.H1(null, "Loading " + this.label())
146 );
147 }, this));
148 } catch(e) {
149 MochiKit.Logging.logDebug("EXCEPTION: " + e);
150 }
151//MochiKit.Logging.logDebug("<<< DirectLoginReference.setupJumpPageWindow");
152 },
153
154 //-------------------------------------------------------------------------
155
156 'deferredDirectLogin': function() {
157 var deferredResult;
158
159//MochiKit.Logging.logDebug(">>> DirectLoginReference.deferredDirectLogin - " + this);
160 deferredResult = new MochiKit.Async.Deferred();
161//MochiKit.Logging.logDebug("--- DirectLoginReference.deferredDirectLogin - 1");
162 deferredResult.addCallback(MochiKit.Base.method(this.record(), 'deferredData'));
163//MochiKit.Logging.logDebug("--- DirectLoginReference.deferredDirectLogin - 2");
164 deferredResult.addCallback(function(aRecord, aDirectLoginReference) {
165 return aRecord.directLogins()[aDirectLoginReference];
166 }, this.record(), this.reference());
167//MochiKit.Logging.logDebug("--- DirectLoginReference.deferredDirectLogin - 3");
168 deferredResult.callback();
169//MochiKit.Logging.logDebug("<<< DirectLoginReference.deferredDirectLogin");
170
171 return deferredResult;
172 },
173
174 //-------------------------------------------------------------------------
175
176 'handleMissingFaviconImage': function(anEvent) {
177//MochiKit.Logging.logDebug(">>> DirectLoginReference.handleMissingFaviconImage");
178 anEvent.stop();
179 MochiKit.Signal.disconnectAll(anEvent.src());
180 this.setFixedFavicon(Clipperz.PM.Strings['defaultFaviconUrl']);
181//MochiKit.Logging.logDebug("--- DirectLoginReference.handleMissingFaviconImage - fixedFavicon: " + this.fixedFavicon());
182//MochiKit.Logging.logDebug("--- DirectLoginReference.handleMissingFaviconImage - anEvent.src().src: " + anEvent.src().src);
183 // MochiKit.DOM.swapDOM(anEvent.src(), MochiKit.DOM.IMG({src:'this.fixedFavicon()'}));
184 anEvent.src().src = this.fixedFavicon();
185//MochiKit.Logging.logDebug("<<< DirectLoginReference.handleMissingFaviconImage");
186 },
187
188 //-------------------------------------------------------------------------
189 __syntaxFix__: "syntax fix"
190
191});
192
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/Header.js b/frontend/beta/js/Clipperz/PM/DataModel/Header.js
new file mode 100644
index 0000000..ef34732
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/DataModel/Header.js
@@ -0,0 +1,751 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33
34//#############################################################################
35
36Clipperz.PM.DataModel.Header = function(args) {
37 args = args || {};
38
39 this._user = args.user;
40
41 this._serverData = null;
42 this._serverDataVersion = null;
43 this._jsonEvaledServerData = null;
44
45 this._decryptedLegacyServerData = null;
46 this._isDecryptingLegacyServerData = false;
47 this._decryptingLegacyServerDataPendingQueue = [];
48
49 this.resetUpdatedSections();
50
51 this._shouldLoadSections = {};
52
53 Clipperz.NotificationCenter.register(this.user(), 'updatedSection', this, 'updatedSectionHandler');
54
55 return this;
56}
57
58Clipperz.PM.DataModel.Header.prototype = MochiKit.Base.update(null, {
59
60 //-------------------------------------------------------------------------
61
62 'user': function() {
63 return this._user;
64 },
65
66 //-------------------------------------------------------------------------
67 //-------------------------------------------------------------------------
68 //-------------------------------------------------------------------------
69 //-------------------------------------------------------------------------
70 //-------------------------------------------------------------------------
71 //-------------------------------------------------------------------------
72 //-------------------------------------------------------------------------
73 //-------------------------------------------------------------------------
74 //-------------------------------------------------------------------------
75
76 'updatedSections': function() {
77 return this._updatedSections;
78 },
79
80 'markSectionAsUpdated': function(aSectionName) {
81 this.updatedSections().push(aSectionName);
82 },
83
84 'resetUpdatedSections': function() {
85 this._updatedSections = []
86 },
87
88 'hasSectionBeenUpdated': function(aSectionName) {
89 return (this.updatedSections().join().indexOf(aSectionName) != -1);
90 },
91
92 'cachedServerDataSection': function(aSectionName) {
93 return (this.hasSectionBeenUpdated(aSectionName)) ? {} : this.jsonEvaledServerData()[aSectionName];
94 },
95
96 'updateAllSections': function() {
97 this.resetUpdatedSections();
98 this.markSectionAsUpdated('records');
99 this.markSectionAsUpdated('directLogins');
100 this.markSectionAsUpdated('preferences');
101 this.markSectionAsUpdated('oneTimePasswords');
102
103 return MochiKit.Async.succeed(this);
104 },
105
106 'updatedSectionHandler': function(anEvent) {
107 this.markSectionAsUpdated(anEvent.parameters());
108 },
109
110 //-------------------------------------------------------------------------
111
112 'getObjectKeyIndex': function(anObject) {
113 var result;
114 varitemReference;
115 var index;
116
117 result = {};
118 index = 0;
119
120 for (itemReference in anObject) {
121 result[itemReference] = index.toString();
122 index ++;
123 }
124
125 return result;
126 },
127
128 //-------------------------------------------------------------------------
129
130 'serializedDataWithRecordAndDirectLoginIndexes': function(aRecordIndexes, aDirectLoginIndexs) {
131 var result;
132 var records;
133 var recordReference;
134
135//MochiKit.Logging.logDebug(">>> Header.serializedData");
136 result = {
137 'records': {},
138 'directLogins': {}
139 };
140
141 records = this.user().records();
142 for (recordReference in records) {
143 result['records'][aRecordIndexes[recordReference]] = this.user().records()[recordReference].headerData();
144 }
145
146 for (directLoginReference in this.user().directLoginReferences()) {
147 var currentDirectLogin;
148 vardirectLoginData;
149
150 currentDirectLogin = this.user().directLoginReferences()[directLoginReference];
151 if (aRecordIndexes[currentDirectLogin.recordReference()] != null) {
152 directLoginData = {
153 // reference: currentDirectLogin.reference(),
154 record: aRecordIndexes[currentDirectLogin.recordReference()].toString(),
155 label: currentDirectLogin.label(),
156 favicon:currentDirectLogin.favicon() || ""
157 }
158
159 result['directLogins'][aDirectLoginIndexs[directLoginReference]] = directLoginData;
160 }
161
162 }
163//MochiKit.Logging.logDebug("<<< Header.serializedData - result: " + Clipperz.Base.serializeJSON(result));
164//MochiKit.Logging.logDebug("<<< Header.serializedData");
165
166 return result;
167 },
168
169 //-------------------------------------------------------------------------
170
171 'encryptedData': function() {
172 var deferredResult;
173 var recordIndex;
174 var directLoginIndex;
175 varserializedData;
176 var result;
177
178//MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Header.encryptedData");
179//MochiKit.Logging.logDebug("### Header.encryptedData - " + Clipperz.Base.serializeJSON(this.updatedSections()));
180 result = {
181 'records': this.cachedServerDataSection('records'),
182 'directLogins': this.cachedServerDataSection('directLogins'),
183 'preferences': this.cachedServerDataSection('preferences'),
184 'oneTimePasswords': this.cachedServerDataSection('oneTimePasswords'),
185 'version': '0.1'
186 };
187
188 if (this.hasSectionBeenUpdated('records')) {
189 recordIndex = this.getObjectKeyIndex(this.user().records());
190 result['records']['index'] = recordIndex;
191 } else {
192 recordIndex = result['records']['index'];
193 }
194
195 if (this.hasSectionBeenUpdated('directLogins')) {
196 directLoginIndex = this.getObjectKeyIndex(this.user().directLoginReferences());
197 result['directLogins']['index'] = directLoginIndex;
198 } else {
199 directLoginIndex = result['directLogins']['index'];
200 }
201
202 if (this.hasSectionBeenUpdated('records') || this.hasSectionBeenUpdated('directLogins')) {
203 serializedData = this.serializedDataWithRecordAndDirectLoginIndexes(recordIndex, directLoginIndex);
204 }
205
206 deferredResult = new MochiKit.Async.Deferred();
207
208//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 1: " + res); return res;});
209 if (this.hasSectionBeenUpdated('records')) {
210//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 1.1: " + res); return res;});
211 deferredResult.addCallback(function(anHeader, aResult, aSerializedData, aValue) {
212 return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(anHeader.user().passphrase(), aSerializedData['records']);
213 }, this, result, serializedData);
214//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 1.2: " + res); return res;});
215 deferredResult.addCallback(function(anHeader, aResult, aValue) {
216 aResult['records']['data'] = aValue;
217 }, this, result);
218//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 1.3: " + res); return res;});
219 }
220
221//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 2: " + res); return res;});
222 if (this.hasSectionBeenUpdated('directLogins')) {
223//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 2.1: " + res); return res;});
224 deferredResult.addCallback(function(anHeader, aResult, aSerializedData, aValue) {
225 return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(anHeader.user().passphrase(), aSerializedData['directLogins']);
226 }, this, result, serializedData);
227//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 2.2: " + res); return res;});
228 deferredResult.addCallback(function(anHeader, aResult, aValue) {
229 aResult['directLogins']['data'] = aValue;
230 }, this, result);
231//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 2.3: " + res); return res;});
232 }
233
234//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 3: " + res); return res;});
235 if (this.hasSectionBeenUpdated('preferences')) {
236//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 3.1: " + res); return res;});
237 deferredResult.addCallback(function(anHeader, aResult, aValue) {
238 return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(anHeader.user().passphrase(), anHeader.user().preferences().serializedData());
239 }, this, result);
240//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 3.2: " + res); return res;});
241 deferredResult.addCallback(function(anHeader, aResult, aValue) {
242 aResult['preferences']['data'] = aValue;
243 }, this, result);
244//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 3.3: " + res); return res;});
245 }
246
247//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 4: " + res); return res;});
248 if (this.hasSectionBeenUpdated('oneTimePasswords')) {
249//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 4.1: " + res); return res;});
250 // deferredResult.addCallback(MochiKit.Base.method(this, 'loadOneTimePasswords'));
251//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 4.2: " + res); return res;});
252 deferredResult.addCallback(function(anHeader, aResult, aValue) {
253 return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(anHeader.user().passphrase(), anHeader.user().oneTimePasswordManager().serializedData());
254 }, this, result);
255//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 4.3: " + res); return res;});
256 deferredResult.addCallback(function(anHeader, aResult, aValue) {
257 aResult['oneTimePasswords']['data'] = aValue;
258 }, this, result);
259//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 4.4: " + res); return res;});
260 }
261
262//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 5: " + res); return res;});
263 deferredResult.addCallback(function(anHeader, aResult, aValue) {
264 var serverData;
265
266 serverData = Clipperz.Base.serializeJSON(aResult);
267 anHeader.setServerData(serverData);
268
269 return serverData;
270 }, this, result);
271//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 6: " + res); return res;});
272
273 deferredResult.callback();
274//MochiKit.Logging.logDebug("<<< [" + (new Date()).valueOf() + "] Header.encryptedData");
275
276 return deferredResult;
277 },
278
279 //-------------------------------------------------------------------------
280
281 'serverData': function() {
282 return this._serverData;
283 },
284
285 'setServerData': function(aValue) {
286//MochiKit.Logging.logDebug(">>> Header.setServerData");
287//MochiKit.Logging.logDebug("[start]=============================================");
288//MochiKit.Logging.logDebug("SERVER_DATA: " + aValue);
289//MochiKit.Logging.logDebug("[end]===============================================");
290 this._serverData = aValue;
291//MochiKit.Logging.logDebug("--- Header.setServerData - 1");
292 this.resetUpdatedSections();
293//MochiKit.Logging.logDebug("--- Header.setServerData - 2");
294 this.resetJsonEvaledServerData();
295//MochiKit.Logging.logDebug("<<< Header.setServerData");
296 },
297
298 'jsonEvaledServerData': function() {
299 if (this._jsonEvaledServerData == null) {
300 this._jsonEvaledServerData = Clipperz.Base.evalJSON(this.serverData());
301 }
302
303 return this._jsonEvaledServerData;
304 },
305
306 'resetJsonEvaledServerData': function() {
307 this._jsonEvaledServerData = null;
308 },
309
310 //-------------------------------------------------------------------------
311
312 'serverDataVersion': function() {
313 return this._serverDataVersion;
314 },
315
316 'setServerDataVersion': function(aValue) {
317 this._serverDataVersion = aValue;
318 },
319
320 //-------------------------------------------------------------------------
321
322 'decryptedLegacyServerData': function() {
323 var deferredResult;
324
325//MochiKit.Logging.logDebug(">>> Header.decryptedLegacyServerData");
326 deferredResult = new MochiKit.Async.Deferred();
327//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.decryptedLegacyServerData 1: "/* + res*/); return res;});
328//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
329 deferredResult.addCallback(MochiKit.Base.method(this, 'updateAllSections'));
330//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.decryptedLegacyServerData 2: "/* + res*/); return res;});
331//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
332 if (this._decryptedLegacyServerData == null) {
333//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.decryptedLegacyServerData 3: "/* + res*/); return res;});
334//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
335 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_decryptingUserData');
336//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.decryptedLegacyServerData 4: "/* + res*/); return res;});
337//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
338 deferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt, this.user().passphrase(), this.serverData(), this.serverDataVersion());
339//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.decryptedLegacyServerData 5: "/* + res*/); return res;});
340//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
341 deferredResult.addCallback(function(anHeader, aValue) {
342 anHeader._decryptedLegacyServerData = aValue;
343 }, this);
344//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.decryptedLegacyServerData 6: "/* + res*/); return res;});
345//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
346 };
347//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.decryptedLegacyServerData 7: "/* + res*/); return res;});
348//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
349
350 deferredResult.addCallback(function(anHeader) {
351 return anHeader._decryptedLegacyServerData;
352 }, this);
353//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.decryptedLegacyServerData 8: "/* + res*/); return res;});
354//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
355 deferredResult.callback();
356//MochiKit.Logging.logDebug("<<< Header.decryptedLegacyServerData");
357
358 return deferredResult;
359 },
360
361 //-------------------------------------------------------------------------
362
363 'serverDataFormat': function() {
364 var result;
365
366//MochiKit.Logging.logDebug(">>> Header.serverDataFormat");
367 if (this.serverData().charAt(0) == '{') {
368 varserverData;
369
370 serverData = Clipperz.Base.evalJSON(this.serverData());
371 result = serverData['version'];
372 } else {
373 result = 'LEGACY';
374 }
375//MochiKit.Logging.logDebug("<<< Header.serverDataFormat");
376
377 return result;
378 },
379
380 //-------------------------------------------------------------------------
381
382 'extractHeaderDataFromUserDetails': function(someUserDetails) {
383 if (this.serverData() == null) {
384 this.setServerData(someUserDetails['header']);
385 this.setServerDataVersion(someUserDetails['version'])
386 }
387 },
388
389 //-------------------------------------------------------------------------
390
391 'extractDataWithKey': function(aKey) {
392 var deferredResult;
393
394//MochiKit.Logging.logDebug(">>> Header.extractDataWithKey");
395 deferredResult = new MochiKit.Async.Deferred();
396
397 switch (this.serverDataFormat()) {
398 case 'LEGACY':
399//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 1: "/* + res*/); return res;});
400//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
401 deferredResult.addCallback(MochiKit.Base.method(this, 'decryptedLegacyServerData'));
402//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 2: "/* + res*/); return res;});
403//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
404 deferredResult.addCallback(function(someDecryptedValues) {
405 return someDecryptedValues[aKey] || {};
406 })
407//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 3: "/* + res*/); return res;});
408//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
409 break;
410 case '0.1':
411 var data;
412
413 //# data = Clipperz.Base.evalJSON(this.serverData());
414 data = this.jsonEvaledServerData();
415 if (typeof(data[aKey]) != 'undefined') {
416//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 4: "/* + res*/); return res;});
417//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
418 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_decryptingUserData');
419//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 5: "/* + res*/); return res;});
420//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
421 deferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt, this.user().passphrase(), data[aKey]['data'], this.serverDataVersion());
422//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 6: "/* + res*/); return res;});
423//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
424 deferredResult.addCallback(function(/*anHeader,*/ aKey, aData, aRecordIndex, aValue) {
425 var result;
426//MochiKit.Logging.logDebug(">>> [start] ===============================================");
427//MochiKit.Logging.logDebug("--- extractDataWithKey - 0 [" + aKey + "]: " + Clipperz.Base.serializeJSON(aValue));
428//MochiKit.Logging.logDebug("<<< [end] =================================================");
429 if (aKey == 'records') {
430 var recordKey;
431
432 result = {};
433 for (recordKey in aData['index']) {
434 result[recordKey] = aValue[aData['index'][recordKey]];
435 }
436 } else if (aKey == 'directLogins') {
437 varrecordKeyReversedIndex;
438 var recordKey;
439 var directLoginKey;
440
441 result = {};
442 recordKeyReversedIndex = {};
443
444 for (recordKey in aRecordIndex) {
445 recordKeyReversedIndex[aRecordIndex[recordKey]] = recordKey;
446 }
447
448//MochiKit.Logging.logDebug("--- extractDataWithKey - 1 - aData['index']: " + Clipperz.Base.serializeJSON(aData['index']));
449 for (directLoginKey in aData['index']) {
450try {
451 if ((aData['index'][directLoginKey] != null) && (aValue[aData['index'][directLoginKey]] != null)) {
452 result[directLoginKey] = aValue[aData['index'][directLoginKey]];
453 result[directLoginKey]['record'] = recordKeyReversedIndex[result[directLoginKey]['record']];
454 }
455} catch(exception) {
456 //result[directLoginKey] has no properties
457 MochiKit.Logging.logDebug("[Header 391] EXCEPTION: " + exception);
458 throw exception;
459}
460 }
461//MochiKit.Logging.logDebug("--- extractDataWithKey - 2");
462 } else {
463 result = aValue;
464 }
465
466 return result;
467 }, /*this,*/ aKey, data[aKey], data['records']['index']);
468//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 6: "/* + res*/); return res;});
469//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
470 } else {
471//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 7: "/* + res*/); return res;});
472//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
473 deferredResult.addCallback(MochiKit.Async.succeed, {});
474//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 8: "/* + res*/); return res;});
475//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
476 }
477 break;
478 }
479
480//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 9: "/* + res*/); return res;});
481//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
482 deferredResult.callback();
483//MochiKit.Logging.logDebug("<<< Header.extractDataWithKey");
484
485 return deferredResult;
486 },
487
488 //-------------------------------------------------------------------------
489
490 'processRecordData': function(someRecordData) {
491 var records;
492 varrecordReference;
493
494//console.log("HeaderRecordData parameters", someRecordData);
495//MochiKit.Logging.logDebug(">>> Header.processRecordData");
496 records = someRecordData;
497//MochiKit.Logging.logDebug("--- Header.processRecordData - 1");
498 if (records != null) {
499//MochiKit.Logging.logDebug("--- Header.processRecordData - records: " + Clipperz.Base.serializeJSON(records));
500 for (recordReference in records) {
501 var newRecord;
502 var parameters;
503
504//MochiKit.Logging.logDebug("--- Header.processRecordData - 2 - recordReference: " + recordReference);
505 if (recordReference != "stacktrace") {
506 parameters = records[recordReference];//.slice();
507//MochiKit.Logging.logDebug("--- Header.processRecordData - 3");
508 if (typeof(parameters['notes']) != 'undefined') {
509//MochiKit.Logging.logDebug("--- Header.processRecordData - 4");
510 if (parameters['notes'] != "") {
511//MochiKit.Logging.logDebug("--- Header.processRecordData - 5");
512 parameters['headerNotes'] = parameters['notes'];
513//MochiKit.Logging.logDebug("--- Header.processRecordData - 6");
514 }
515//MochiKit.Logging.logDebug("--- Header.processRecordData - 7");
516 delete parameters['notes'];
517//MochiKit.Logging.logDebug("--- Header.processRecordData - 8");
518 }
519//MochiKit.Logging.logDebug("--- Header.processRecordData - 9");
520 parameters['reference'] = recordReference;
521//MochiKit.Logging.logDebug("--- Header.processRecordData - 10");
522 parameters['user'] = this.user();
523//MochiKit.Logging.logDebug("--- Header.processRecordData - 11");
524
525 newRecord = new Clipperz.PM.DataModel.Record(parameters);
526//MochiKit.Logging.logDebug("--- Header.processRecordData - 12");
527 this.user().addRecord(newRecord, true);
528//MochiKit.Logging.logDebug("--- Header.processRecordData - 13");
529 }
530 }
531
532//MochiKit.Logging.logDebug("--- Header.processRecordData - 14");
533 Clipperz.NotificationCenter.notify(null, 'recordAdded', null, true);
534//MochiKit.Logging.logDebug("--- Header.processRecordData - 15");
535 }
536//MochiKit.Logging.logDebug("<<< Header.processRecordData");
537
538 return this.user().records();
539 },
540
541 //-------------------------------------------------------------------------
542
543 'processDirectLoginData': function(someDirectLoginData) {
544 var directLogins;
545 var directLoginReference;
546
547//MochiKit.Logging.logDebug(">>> Header.processDirectLoginData");
548 directLogins = someDirectLoginData;
549 if (directLogins != null) {
550 for (directLoginReference in directLogins) {
551 var directLoginReference;
552 var parameters;
553
554 parameters = directLogins[directLoginReference];//.slice();
555 parameters.user = this.user();
556 parameters.reference = directLoginReference;
557 directLoginReference = new Clipperz.PM.DataModel.DirectLoginReference(parameters);
558 if (directLoginReference.record() != null) {
559 this.user().addDirectLoginReference(directLoginReference, true);
560 }
561 }
562 }
563
564 Clipperz.NotificationCenter.notify(null, 'directLoginAdded', null, true);
565//MochiKit.Logging.logDebug("<<< Header.processDirectLoginData");
566
567 return this.user().directLoginReferences();
568 },
569
570 //-------------------------------------------------------------------------
571
572 'shouldLoadSections': function() {
573 return this._shouldLoadSections;
574 },
575
576 'shouldLoadSection': function(aSectionName) {
577 var result;
578
579 if (typeof(this.shouldLoadSections()[aSectionName]) != 'undefined') {
580 result = this.shouldLoadSections()[aSectionName];
581 } else {
582 result = true;
583 }
584
585 return result;
586 },
587
588 'setShouldLoadSection': function(aSectionName, aValue) {
589 this.shouldLoadSections()[aSectionName] = aValue;
590 },
591
592 //-------------------------------------------------------------------------
593
594 'loadRecords': function() {
595 var deferredResult;
596
597 if (this.shouldLoadSection('records') == true) {
598 this.setShouldLoadSection('records', false);
599
600 deferredResult = new MochiKit.Async.Deferred();
601//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadRecords 1: "/* + res*/); return res;});
602//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
603 deferredResult.addCallback(MochiKit.Base.method(this.user(), 'getUserDetails'));
604//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadRecords 2: "/* + res*/); return res;});
605//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
606 deferredResult.addCallback(MochiKit.Base.method(this, 'extractHeaderDataFromUserDetails'));
607//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadRecords 3: "/* + res*/); return res;});
608//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
609 deferredResult.addCallback(MochiKit.Base.method(this, 'extractDataWithKey', 'records'));
610//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadRecords 4: "/* + res*/); return res;});
611//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
612 deferredResult.addCallback(MochiKit.Base.method(this, 'processRecordData'));
613//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadRecords 5: "/* + res*/); return res;});
614//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
615 deferredResult.callback();
616 } else {
617 deferredResult = MochiKit.Async.succeed(this.user().records());
618 }
619
620 return deferredResult;
621 },
622
623 //-------------------------------------------------------------------------
624
625 'loadDirectLogins': function() {
626 var deferredResult;
627
628 if (this.shouldLoadSection('directLogins') == true) {
629 this.setShouldLoadSection('directLogins', false);
630
631 deferredResult = new MochiKit.Async.Deferred();
632//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadDirectLogins - 1: "/* + res*/); return res;});
633//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
634 deferredResult.addCallback(MochiKit.Base.method(this.user(), 'getUserDetails'));
635//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadDirectLogins - 2: "/* + res*/); return res;});
636//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
637 deferredResult.addCallback(MochiKit.Base.method(this, 'extractHeaderDataFromUserDetails'));
638//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadDirectLogins - 3: "/* + res*/); return res;});
639//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
640 deferredResult.addCallback(MochiKit.Base.method(this, 'extractDataWithKey', 'directLogins'));
641//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadDirectLogins - 4: "/* + res*/); return res;});
642//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
643 deferredResult.addCallback(MochiKit.Base.method(this, 'processDirectLoginData'));
644//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadDirectLogins - 5: "/* + res*/); return res;});
645//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
646 deferredResult.callback();
647 } else {
648 deferredResult = MochiKit.Async.succeed(this.user().directLoginReferences());
649 }
650
651 return deferredResult;
652 },
653
654 //-------------------------------------------------------------------------
655
656 'loadPreferences': function() {
657 var deferredResult;
658
659 if (this.shouldLoadSection('preferences') == true) {
660 this.setShouldLoadSection('preferences', false);
661
662 deferredResult = new MochiKit.Async.Deferred();
663//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadPreferences - 1: "/* + res*/); return res;});
664//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
665 deferredResult.addCallback(MochiKit.Base.method(this.user(), 'getUserDetails'));
666//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadPreferences - 2: "/* + res*/); return res;});
667//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
668 deferredResult.addCallback(MochiKit.Base.method(this, 'extractHeaderDataFromUserDetails'));
669//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadPreferences - 3: "/* + res*/); return res;});
670//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
671 deferredResult.addCallback(MochiKit.Base.method(this, 'extractDataWithKey', 'preferences'));
672//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadPreferences - 4: "/* + res*/); return res;});
673//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
674 deferredResult.addCallback(MochiKit.Base.method(this.user().preferences(), 'updateWithData'));
675//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadPreferences - 5: "/* + res*/); return res;});
676//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
677 deferredResult.callback();
678 } else {
679 deferredResult = MochiKit.Async.succeed(this.user().preferences());
680 }
681
682 return deferredResult;
683 },
684
685 //-------------------------------------------------------------------------
686
687 'loadOneTimePasswords': function() {
688 var deferredResult;
689
690 if (this.shouldLoadSection('oneTimePasswords') == true) {
691 this.setShouldLoadSection('oneTimePasswords', false);
692
693 deferredResult = new MochiKit.Async.Deferred();
694//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadOneTimePasswords - 1: "/* + res*/); return res;});
695//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
696 deferredResult.addCallback(MochiKit.Base.method(this.user(), 'getUserDetails'));
697//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadOneTimePasswords - 2: "/* + res*/); return res;});
698//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
699 deferredResult.addCallback(MochiKit.Base.method(this, 'extractHeaderDataFromUserDetails'));
700//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadOneTimePasswords - 3: "/* + res*/); return res;});
701//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
702 deferredResult.addCallback(MochiKit.Base.method(this, 'extractDataWithKey', 'oneTimePasswords'));
703//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadOneTimePasswords - 4: "/* + res*/); return res;});
704//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
705 deferredResult.addCallback(MochiKit.Base.method(this.user().oneTimePasswordManager(), 'updateWithData'));
706//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadOneTimePasswords - 5: "/* + res*/); return res;});
707//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
708 deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'getOneTimePasswordsDetails', {});
709//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadOneTimePasswords - 6: "/* + res*/); return res;});
710//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
711 deferredResult.addCallback(MochiKit.Base.method(this.user().oneTimePasswordManager(), 'updateWithServerData'));
712//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadOneTimePasswords - 7: "/* + res*/); return res;});
713//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
714 deferredResult.callback();
715 } else {
716 deferredResult = MochiKit.Async.succeed(this.user().oneTimePasswordManager());
717 }
718
719 return deferredResult;
720 },
721
722 //-------------------------------------------------------------------------
723
724 'loadAllSections': function() {
725 var deferredResult;
726
727 deferredResult = new MochiKit.Async.Deferred();
728//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadAllSections - 1: "/* + res*/); return res;});
729//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
730 deferredResult.addCallback(MochiKit.Base.method(this, 'loadRecords'));
731//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadAllSections - 2: "/* + res*/); return res;});
732//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
733 deferredResult.addCallback(MochiKit.Base.method(this, 'loadDirectLogins'));
734//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadAllSections - 3: "/* + res*/); return res;});
735//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
736 deferredResult.addCallback(MochiKit.Base.method(this, 'loadPreferences'));
737//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadAllSections - 4: "/* + res*/); return res;});
738//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
739 deferredResult.addCallback(MochiKit.Base.method(this, 'loadOneTimePasswords'));
740//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.loadAllSections - 5: "/* + res*/); return res;});
741//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
742 deferredResult.callback();
743
744 return deferredResult;
745 },
746
747 //-------------------------------------------------------------------------
748 __syntaxFix__: "syntax fix"
749
750});
751
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/OneTimePassword.js b/frontend/beta/js/Clipperz/PM/DataModel/OneTimePassword.js
new file mode 100644
index 0000000..dd8d5c9
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/DataModel/OneTimePassword.js
@@ -0,0 +1,333 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33
34//#############################################################################
35
36Clipperz.PM.DataModel.OneTimePassword = function(args) {
37 args = args || {};
38
39//console.log("new OneTimePassword", args);
40//MochiKit.Logging.logDebug("---");
41 this._user = args['user'];
42 this._password = args['password'];
43 this._passwordValue = Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword(args['password']);
44 this._reference = args['reference'] || Clipperz.PM.Crypto.randomKey();
45 this._creationDate = args['created'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['created']) : new Date();
46 this._usageDate = args['used'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['used']) : null;
47
48 this._status = args['status'] || 'ACTIVE';
49 this._connectionInfo = null;
50
51 this._key = null;
52 this._keyChecksum = null;
53
54 return this;
55}
56
57Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, {
58
59 'toString': function() {
60 return "Clipperz.PM.DataModel.OneTimePassword";
61 },
62
63 //-------------------------------------------------------------------------
64
65 'user': function() {
66 return this._user;
67 },
68
69 //-------------------------------------------------------------------------
70
71 'password': function() {
72 return this._password;
73 },
74
75 //-------------------------------------------------------------------------
76
77 'passwordValue': function() {
78 return this._passwordValue;
79 },
80
81 //-------------------------------------------------------------------------
82
83 'creationDate': function() {
84 return this._creationDate;
85 },
86
87 //-------------------------------------------------------------------------
88
89 'reference': function() {
90 return this._reference;
91 },
92
93 //-------------------------------------------------------------------------
94
95 'key': function() {
96 if (this._key == null) {
97 this._key = Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(this.user().username(), this.passwordValue());
98 }
99
100 return this._key;
101 },
102
103 //-------------------------------------------------------------------------
104
105 'keyChecksum': function() {
106 if (this._keyChecksum == null) {
107 this._keyChecksum = Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(this.user().username(), this.passwordValue());
108 }
109
110 return this._keyChecksum;
111 },
112
113 //-------------------------------------------------------------------------
114
115 'status': function() {
116 return this._status;
117 },
118
119 'setStatus': function(aValue) {
120 this._status = aValue;
121 },
122
123 //-------------------------------------------------------------------------
124
125 'serializedData': function() {
126 var result;
127
128 result = {
129 'password': this.password(),
130 'created': this.creationDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.creationDate()) : null,
131 'used': this.usageDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.usageDate()) : null,
132 'status': this.status()
133 };
134
135 return result;
136 },
137
138 //-------------------------------------------------------------------------
139
140 'packedPassphrase': function() {
141 var result;
142 var packedPassphrase;
143 var encodedPassphrase;
144 varprefixPadding;
145 var suffixPadding;
146 var getRandomBytes;
147
148 getRandomBytes = MochiKit.Base.method(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'getRandomBytes');
149
150 encodedPassphrase = new Clipperz.ByteArray(this.user().passphrase()).toBase64String();
151//MochiKit.Logging.logDebug("--- encodedPassphrase.length: " + encodedPassphrase.length);
152 prefixPadding = getRandomBytes(getRandomBytes(1).byteAtIndex(0)).toBase64String();
153//MochiKit.Logging.logDebug("--- prefixPadding.length: " + prefixPadding.length);
154 suffixPadding = getRandomBytes((500 - prefixPadding.length - encodedPassphrase.length) * 6 / 8).toBase64String();
155//MochiKit.Logging.logDebug("--- suffixPadding.length: " + suffixPadding.length);
156//MochiKit.Logging.logDebug("--- total.length: " + (prefixPadding.length + encodedPassphrase.length + suffixPadding.length));
157
158 packedPassphrase = {
159 'prefix': prefixPadding,
160 'passphrase': encodedPassphrase,
161 'suffix': suffixPadding
162 };
163
164 // result = Clipperz.Base.serializeJSON(packedPassphrase);
165 result = packedPassphrase;
166//MochiKit.Logging.logDebug("===== OTP packedPassprase: [" + result.length + "]" + result);
167//MochiKit.Logging.logDebug("<<< OneTimePassword.packedPassphrase");
168
169 return result;
170 },
171
172 //-------------------------------------------------------------------------
173
174 'encryptedPackedPassphrase': function() {
175 return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(this.passwordValue(), this.packedPassphrase())
176 },
177
178 //-------------------------------------------------------------------------
179
180 'encryptedData': function() {
181 var deferredResult;
182 varresult;
183
184//MochiKit.Logging.logDebug(">>> OneTimePassword.encryptedData");
185//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - id: " + this.reference());
186 result = {
187 'reference': this.reference(),
188 'key': this.key(),
189 'keyChecksum': this.keyChecksum(),
190 'data': "",
191 'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion
192 }
193//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 2: " + Clipperz.Base.serializeJSON(result));
194 deferredResult = new MochiKit.Async.Deferred();
195//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 3");
196//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 1: " + res); return res;});
197 //# deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion, this.passwordValue(), this.packedPassphrase());
198 deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedPackedPassphrase'));
199//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 4");
200//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 2: [" + res.length + "]" + res); return res;});
201 deferredResult.addCallback(function(aResult, res) {
202 aResult['data'] = res;
203 return aResult;
204 }, result);
205//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 5");
206//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 3: " + Clipperz.Base.serializeJSON(res)); return res;});
207 deferredResult.callback();
208//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 6");
209
210 return deferredResult;
211 },
212
213 //-------------------------------------------------------------------------
214
215 'saveChanges': function() {
216 var deferredResult;
217 varresult;
218
219//MochiKit.Logging.logDebug(">>> OneTimePassword.saveChanges");
220 result = {};
221 deferredResult = new MochiKit.Async.Deferred();
222
223 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptUserData');
224 deferredResult.addCallback(MochiKit.Base.method(this.user(), 'encryptedData'));
225 deferredResult.addCallback(function(aResult, res) {
226 aResult['user'] = res;
227 return aResult;
228 }, result);
229
230 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptOTPData');
231 deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedData'));
232 deferredResult.addCallback(function(aResult, res) {
233 aResult['oneTimePassword'] = res;
234 return aResult;
235 }, result);
236
237 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_sendingData');
238//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 1: " + Clipperz.Base.serializeJSON(res)); return res;});
239 deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'addNewOneTimePassword');
240
241 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_updatingInterface');
242//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;});
243 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'notify', 'OTPUpdated');
244 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'oneTimePassword_saveChanges_done', null);
245//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;});
246 deferredResult.callback();
247//MochiKit.Logging.logDebug("<<< OneTimePassword.saveChanges");
248
249 return deferredResult;
250 },
251
252 //-------------------------------------------------------------------------
253
254 'usageDate': function() {
255 return this._usageDate;
256 },
257
258 'setUsageDate': function(aValue) {
259 this._usageDate = aValue;
260 },
261
262 //-------------------------------------------------------------------------
263
264 'connectionInfo': function() {
265 return this._connectionInfo;
266 },
267
268 'setConnectionInfo': function(aValue) {
269 this._connectionInfo = aValue;
270 },
271
272 //-------------------------------------------------------------------------
273
274 'isExpired': function() {
275 return (this.usageDate() != null);
276 },
277
278 //-------------------------------------------------------------------------
279
280 'updateStatusWithValues': function(someValues) {
281 var result;
282
283 result = false;
284
285 if (someValues['status'] != this.status()) {
286 result = true;
287 }
288
289 this.setStatus(someValues['status']);
290 this.setUsageDate(Clipperz.PM.Date.parseDateWithUTCFormat(someValues['requestDate']));
291 this.setConnectionInfo(someValues['connection']);
292
293 return result;
294 },
295
296 //-------------------------------------------------------------------------
297 __syntaxFix__: "syntax fix"
298});
299
300//=============================================================================
301
302Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword = function(anUsername, aPassword) {
303 return Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aPassword)).toHexString().substring(2);
304}
305
306Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword = function(anUsername, aPassword) {
307 return Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(anUsername + aPassword)).toHexString().substring(2);
308}
309
310//=============================================================================
311
312Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword = function(aPassword) {
313 varresult;
314
315 if (aPassword.replace(/[\s\-]/g, '').length == 32) {
316 try {
317 var passwordByteArray;
318
319 passwordByteArray = new Clipperz.ByteArray();
320 passwordByteArray.appendBase32String(aPassword);
321
322 result = passwordByteArray.toBase64String();
323 } catch(exception) {
324 result = aPassword;
325 }
326 } else {
327 result = aPassword;
328 }
329
330 return result;
331}
332
333//=============================================================================
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js b/frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js
new file mode 100644
index 0000000..d90100a
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js
@@ -0,0 +1,280 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33
34//#############################################################################
35
36Clipperz.PM.DataModel.OneTimePasswordManager = function(anUser, args) {
37 args = args || {};
38
39 this._user = anUser;
40 this._oneTimePasswords = {};
41
42 this.updateWithData(args);
43
44 Clipperz.NotificationCenter.notify(null, 'oneTimePasswordAdded', null, true);
45
46 return this;
47}
48
49Clipperz.PM.DataModel.OneTimePasswordManager.prototype = MochiKit.Base.update(null, {
50
51 'toString': function() {
52 return "Clipperz.PM.DataModel.OneTimePasswordManager";
53 },
54
55 //-------------------------------------------------------------------------
56
57 'updateWithData': function(someValues) {
58 varotpReference;
59
60//console.log("OneTimePasswordManager.updateWithData", someValues);
61//MochiKit.Logging.logDebug("OneTimePasswordManager.updateWithData: " + Clipperz.Base.serializeJSON(someValues));
62 for (otpReference in someValues) {
63 var otp;
64 var otpConfiguration;
65
66 otpConfiguration = someValues[otpReference];
67 otpConfiguration['user'] = this.user();
68 otpConfiguration['reference'] = otpReference;
69 otp = new Clipperz.PM.DataModel.OneTimePassword(otpConfiguration);
70 this._oneTimePasswords[otpReference] = otp;
71 }
72
73 return this;
74 },
75
76 //-------------------------------------------------------------------------
77
78 'updateWithServerData': function(someValues) {
79 var deferredResult;
80 varoneTimePasswordReference;
81 var wereChangesApplied;
82
83//MochiKit.Logging.logDebug(">>> OneTimePasswordManager.updateWithServerData");
84 deferredResult = new MochiKit.Async.Deferred();
85 wereChangesApplied = false;
86
87 for (oneTimePasswordReference in someValues) {
88 var oneTimePassword;
89
90 oneTimePassword = this.oneTimePasswordWithReference(oneTimePasswordReference);
91 if (oneTimePassword != null) {
92 var oneTimePasswordHasBeenUpdated;
93
94 oneTimePasswordHasBeenUpdated = oneTimePassword.updateStatusWithValues(someValues[oneTimePasswordReference]);
95 wereChangesApplied = oneTimePasswordHasBeenUpdated || wereChangesApplied;
96 } else {
97
98 }
99 }
100
101 if (wereChangesApplied == true) {
102 this.user().header().markSectionAsUpdated('oneTimePasswords');
103 }
104
105 for (oneTimePasswordReference in this.oneTimePasswords()) {
106 if (typeof(someValues[oneTimePasswordReference]) == 'undefind') {
107 deferredResult.addCallback(MochiKit.Base.method(this.oneTimePasswordWithReference(oneTimePasswordReference), 'saveChanges'));
108 }
109 }
110
111 deferredResult.addCallback(MochiKit.Async.succeed, this);
112
113 deferredResult.callback();
114//MochiKit.Logging.logDebug("<<< OneTimePasswordManager.updateWithServerData");
115
116 return deferredResult;
117 },
118
119 //-------------------------------------------------------------------------
120
121 'user': function() {
122 return this._user;
123 },
124
125 //-------------------------------------------------------------------------
126
127 'addOneTimePassword': function(aOneTimePassword, isBatchUpdate) {
128 this.oneTimePasswords()[aOneTimePassword.reference()] = aOneTimePassword;
129
130 if (isBatchUpdate != true) {
131 Clipperz.NotificationCenter.notify(aOneTimePassword, 'oneTimePasswordAdded');
132 Clipperz.NotificationCenter.notify(this.user(), 'updatedSection', 'oneTimePasswords', true);
133 }
134 },
135
136 //-------------------------------------------------------------------------
137
138 'archiveOneTimePassword': function(aOneTimePasswordReference) {
139 var deferredResult;
140
141//MochiKit.Logging.logDebug(">>> OneTimePasswordManager.archiveOneTimePassword");
142//MochiKit.Logging.logDebug("--- OneTimePasswordManager.archiveOneTimePassword - 0 otp.reference: " + aOneTimePasswordReference);
143 deferredResult = new MochiKit.Async.Deferred();
144 deferredResult.addCallback(MochiKit.Base.method(this.user(), 'loadOneTimePasswords'));
145 deferredResult.addCallback(MochiKit.Base.bind(function(aOneTimePasswordReference) {
146 var oneTimePassword;
147
148//MochiKit.Logging.logDebug("--- OneTimePasswordManager.archiveOneTimePassword - 1 serializedData: " + Clipperz.Base.serializeJSON(this.serializedData()));
149 oneTimePassword = this.oneTimePasswords()[aOneTimePasswordReference];
150
151 if (oneTimePassword != null) {
152 oneTimePassword.setUsageDate(new Date());
153
154 // while (this.usedOneTimePasswords().length > 10) {
155 // var referenceOfOneTimePasswordToRemove;
156 //
157 // referenceOfOneTimePasswordToRemove = this.usedOneTimePasswords()[0];
158 // delete this.oneTimePasswords()[referenceOfOneTimePasswordToRemove];
159 // this.usedOneTimePasswords().shift();
160 // }
161
162 Clipperz.NotificationCenter.notify(this.user(), 'updatedSection', 'oneTimePasswords', true);
163 } else {
164 MochiKit.Logging.logError("### OneTimePasswordManager.archiveOneTimePassword - the used OneTimePassword has not been found on the index-card. :-(");
165 }
166
167//MochiKit.Logging.logDebug("--- OneTimePasswordManager.archiveOneTimePassword - 2 serializedData: " + Clipperz.Base.serializeJSON(this.serializedData()));
168 }, this), aOneTimePasswordReference);
169 deferredResult.addCallback(MochiKit.Base.method(this, 'saveChanges'));
170 deferredResult.callback();
171//MochiKit.Logging.logDebug("<<< OneTimePasswordManager.archiveOneTimePassword");
172
173 return deferredResult;
174 },
175
176 //-------------------------------------------------------------------------
177
178 'serializedData': function() {
179 var result;
180 varkey;
181
182 result = {};
183
184 for (key in this.oneTimePasswords()) {
185 result[key] = this.oneTimePasswords()[key].serializedData();
186 }
187
188 return result;
189 },
190
191 //-------------------------------------------------------------------------
192
193 'oneTimePasswords': function() {
194 return this._oneTimePasswords;
195 },
196
197 //-------------------------------------------------------------------------
198
199 'oneTimePasswordWithReference': function(aOneTimePasswordReference) {
200 return this.oneTimePasswords()[aOneTimePasswordReference];
201 },
202
203 //-------------------------------------------------------------------------
204
205 'deleteOneTimePasswordWithReference': function(aOneTimePasswordReference) {
206 delete(this.oneTimePasswords()[aOneTimePasswordReference]);
207 Clipperz.NotificationCenter.notify(this.user(), 'updatedSection', 'oneTimePasswords', true);
208 },
209
210 //-------------------------------------------------------------------------
211
212 'encryptedData': function() {
213 var deferredResult;
214 var oneTimePasswordReferences;
215 var result;
216 var i, c;
217
218 result = {};
219 deferredResult = new MochiKit.Async.Deferred();
220 deferredResult.addCallback(MochiKit.Async.succeed);
221
222 oneTimePasswordReferences = MochiKit.Base.keys(this.oneTimePasswords());
223 c = oneTimePasswordReferences.length;
224 for (i=0; i<c; i++) {
225 var currentOneTimePassword;
226
227 currentOneTimePassword = this.oneTimePasswords()[oneTimePasswordReferences[i]];
228 deferredResult.addCallback(MochiKit.Base.method(currentOneTimePassword, 'encryptedPackedPassphrase'));
229 deferredResult.addCallback(function(aResult, aOneTimePasswordReference, anEncryptedPackedPassphrase) {
230 aResult[aOneTimePasswordReference] = anEncryptedPackedPassphrase;
231 return aResult;
232 }, result, oneTimePasswordReferences[i]);
233 }
234//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePasswordManager.encryptedData: " + res); return res;});
235
236 deferredResult.callback(result);
237
238 return deferredResult;
239 },
240
241 //-------------------------------------------------------------------------
242
243 'saveChanges': function() {
244 var deferredResult;
245 varresult;
246
247//MochiKit.Logging.logDebug(">>> OneTimePasswordManager.saveChanges");
248 result = {};
249 deferredResult = new MochiKit.Async.Deferred();
250 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptUserData');
251 deferredResult.addCallback(MochiKit.Base.method(this.user(), 'encryptedData'));
252 deferredResult.addCallback(function(aResult, res) {
253 aResult['user'] = res;
254 return aResult;
255 }, result);
256
257 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptOTPData');
258 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
259 res['oneTimePasswords'] = MochiKit.Base.keys(this.oneTimePasswords());
260 return res;
261 }, this));
262
263 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_sendingData');
264//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePasswordManager.saveChanges - 1: " + Clipperz.Base.serializeJSON(res)); return res;});
265 deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'updateOneTimePasswords');
266
267 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_updatingInterface');
268//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePasswordManager.saveChanges - 2: " + res); return res;});
269 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'notify', 'OTPUpdated');
270//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePasswordManager.saveChanges - 3: " + res); return res;});
271 deferredResult.callback();
272//MochiKit.Logging.logDebug("<<< OneTimePasswordManager.saveChanges");
273
274 return deferredResult;
275 },
276
277 //-------------------------------------------------------------------------
278 __syntaxFix__: "syntax fix"
279});
280
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/Record.js b/frontend/beta/js/Clipperz/PM/DataModel/Record.js
new file mode 100644
index 0000000..b4b5023
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/DataModel/Record.js
@@ -0,0 +1,759 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33
34//#############################################################################
35
36Clipperz.PM.DataModel.Record = function(args) {
37 args = args || {};
38
39 this._user = args['user'] || null;
40 this._reference = args['reference'] || Clipperz.PM.Crypto.randomKey();
41 this._version = args['version'] || Clipperz.PM.Crypto.encryptingFunctions.currentVersion;
42 this._key = args['key'] || Clipperz.PM.Crypto.randomKey();
43
44 this.setLabel(args['label'] || Clipperz.PM.Strings['newRecordTitleLabel']);
45
46 this.setHeaderNotes(args['headerNotes'] || null);
47 this.setNotes(args['notes'] || args['headerNotes'] || "");
48//MochiKit.Logging.logDebug("--- new Record ('" + this._label + "')- _headerNotes: '" + this._headerNotes + "'");
49//MochiKit.Logging.logDebug("--- new Record ('" + this._label + "')- _notes: '" + this._notes + "'");
50 //this._notes = args.notes || "";
51
52 this._versions = {};
53 this._directLogins = {};
54 this._removedDirectLogins = [];
55
56 this.setIsBrandNew(args['reference'] == null);
57
58 this.setShouldLoadData(this.isBrandNew() ? false: true);
59 this.setShouldDecryptData(this.isBrandNew() ? false: true);
60 this.setShouldProcessData(this.isBrandNew() ? false: true);
61
62 this.setCurrentVersion(this.isBrandNew() ? new Clipperz.PM.DataModel.RecordVersion(this, null): null);
63 this.setCurrentVersionKey(null);
64
65 this._serverData = null;
66 this._decryptedData = null;
67 this._cachedData = null;
68
69 return this;
70}
71
72Clipperz.PM.DataModel.Record.prototype = MochiKit.Base.update(null, {
73
74 'toString': function() {
75 return "Record (" + this.label() + ")";
76 },
77
78 //-------------------------------------------------------------------------
79
80 'isBrandNew': function() {
81 return this._isBrandNew;
82 },
83
84 'setIsBrandNew': function(aValue) {
85 this._isBrandNew = aValue;
86 },
87
88 //-------------------------------------------------------------------------
89/*
90 'shouldRunTheRecordCreationWizard': function() {
91 return (this.isBrandNew() && (MochiKit.Base.keys(this.currentVersion().fields()).length == 0));
92 },
93 */
94 //-------------------------------------------------------------------------
95
96 'user': function() {
97 return this._user;
98 },
99
100 //-------------------------------------------------------------------------
101
102 'reference': function() {
103 return this._reference;
104 },
105
106 //-------------------------------------------------------------------------
107
108 'key': function() {
109 return this._key;
110 },
111
112 'updateKey': function() {
113 this._key = Clipperz.PM.Crypto.randomKey();
114 },
115
116 //-------------------------------------------------------------------------
117
118 'label': function() {
119 return this._label;
120 },
121
122 'setLabel': function(aValue) {
123 this._label = aValue;
124 },
125
126 'lowerCaseLabel': function() {
127 return this.label().toLowerCase();
128 },
129
130 //-------------------------------------------------------------------------
131
132 'versions': function() {
133 return this._versions;
134 },
135
136 //-------------------------------------------------------------------------
137
138 'currentVersion': function() {
139 return this._currentVersion;
140 },
141
142 'setCurrentVersion': function(aValue) {
143 this._currentVersion = aValue;
144 },
145
146 //-------------------------------------------------------------------------
147
148 'currentVersionKey': function() {
149 return this._currentVersionKey;
150 },
151
152 'setCurrentVersionKey': function(aValue) {
153 this._currentVersionKey = aValue;
154 },
155
156 //-------------------------------------------------------------------------
157
158 'deferredData': function() {
159 vardeferredResult;
160
161//MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Record.deferredData - this: " + this);
162 deferredResult = new MochiKit.Async.Deferred();
163 deferredResult.addCallback(MochiKit.Base.method(this, 'loadData'));
164 deferredResult.addCallback(MochiKit.Base.method(this, 'decryptData'));
165 deferredResult.addCallback(MochiKit.Base.method(this, 'processData'));
166 deferredResult.addCallback(function(aRecord) {
167 return aRecord.currentVersion().deferredData();
168 });
169 deferredResult.addCallback(MochiKit.Base.method(this, 'takeSnapshotOfCurrentData'));
170 deferredResult.addCallback(MochiKit.Async.succeed, this);
171 deferredResult.callback();
172//MochiKit.Logging.logDebug("<<< [" + (new Date()).valueOf() + "] Record.deferredData");
173
174 return deferredResult;
175 },
176
177 //-------------------------------------------------------------------------
178
179 'exportedData': function() {
180 var result;
181
182 result = {};
183 result['label'] = this.label();
184 result['data'] = this.serializedData();
185 result['currentVersion'] = this.currentVersion().serializedData();
186 result['currentVersion']['reference'] = this.currentVersion().reference();
187 // result['versions'] = MochiKit.Base.map(MochiKit.Base.methodcaller("serializedData"), MochiKit.Base.values(this.versions()));
188
189 return Clipperz.Base.serializeJSON(result);
190 },
191
192 //-------------------------------------------------------------------------
193
194 'shouldLoadData': function() {
195 return this._shouldLoadData;
196 },
197
198 'setShouldLoadData': function(aValue) {
199 this._shouldLoadData = aValue;
200 },
201
202 //-------------------------------------------------------------------------
203
204 'shouldDecryptData': function() {
205 return this._shouldDecryptData;
206 },
207
208 'setShouldDecryptData': function(aValue) {
209 this._shouldDecryptData = aValue;
210 },
211
212 //-------------------------------------------------------------------------
213
214 'shouldProcessData': function() {
215 return this._shouldProcessData;
216 },
217
218 'setShouldProcessData': function(aValue) {
219 this._shouldProcessData = aValue;
220 },
221
222 //-------------------------------------------------------------------------
223
224 'loadData': function() {
225 var result;
226
227//MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Record.loadData - this: " + this);
228 if (this.shouldLoadData()) {
229 var deferredResult;
230
231 deferredResult = new MochiKit.Async.Deferred();
232 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'notify', 'loadingRecordData');
233 deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'getRecordDetail', {reference: this.reference()});
234 deferredResult.addCallback(MochiKit.Base.method(this,'setServerData'));
235 deferredResult.callback();
236 result = deferredResult;
237 } else {
238 result = MochiKit.Async.succeed(this.serverData());
239 }
240//MochiKit.Logging.logDebug("<<< [" + (new Date()).valueOf() + "] Record.loadData");
241
242 return result;
243 },
244
245 //-------------------------------------------------------------------------
246
247 'decryptData': function(anEncryptedData) {
248 var result;
249
250//MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Record.decryptData - this: " + this + " (" + anEncryptedData + ")");
251 if (this.shouldDecryptData()) {
252 var deferredResult;
253
254 deferredResult = new MochiKit.Async.Deferred();
255 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'notify', 'decryptingRecordData');
256 deferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt, this.key(), anEncryptedData['data'], anEncryptedData['version']);
257 deferredResult.addCallback(function(anEncryptedData, someDecryptedValues) {
258 varresult;
259
260 result = anEncryptedData;
261 result['data'] = someDecryptedValues;
262
263 return result;
264 }, anEncryptedData);
265 deferredResult.addCallback(MochiKit.Base.method(this, 'setDecryptedData'));
266 deferredResult.callback();
267
268 result = deferredResult;
269 } else {
270 result = MochiKit.Async.succeed(this.decryptedData());
271 }
272//MochiKit.Logging.logDebug("<<< [" + (new Date()).valueOf() + "] Record.decryptData");
273
274 return result;
275 },
276
277 //-------------------------------------------------------------------------
278
279 'processData': function(someValues) {
280//MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Record.processData");
281//MochiKit.Logging.logDebug("--- Record.processData: " + Clipperz.Base.serializeJSON(someValues));
282 if (this.shouldProcessData()) {
283 var currentVersionParameters;
284
285 this.processDataToExtractLegacyValues(someValues['data']);
286
287 if (typeof(someValues['data']['notes']) != 'undefined') {
288 this.setNotes(someValues['data']['notes']);
289 }
290 if (someValues['data']['currentVersionKey'] != null) {
291 this.setCurrentVersionKey(someValues['data']['currentVersionKey']);
292 } else {
293 this.setCurrentVersionKey(this.key());
294 }
295
296 currentVersionParameters = someValues['currentVersion'];
297 currentVersionParameters['key'] = this.currentVersionKey();
298 this.setCurrentVersion(new Clipperz.PM.DataModel.RecordVersion(this, currentVersionParameters));
299
300 if (someValues['data']['directLogins'] != null) {
301 vardirectLoginReference;
302
303 for (directLoginReference in someValues['data']['directLogins']) {
304 var directLogin;
305 var directLoginParameters;
306
307 directLoginParameters = someValues['data']['directLogins'][directLoginReference];
308 directLoginParameters.record = this;
309 directLoginParameters.reference = directLoginReference;
310
311 directLogin = new Clipperz.PM.DataModel.DirectLogin(directLoginParameters);
312 this.addDirectLogin(directLogin, true);
313 }
314 }
315 this.setShouldProcessData(false);
316 }
317
318 Clipperz.NotificationCenter.notify(this, 'recordDataReady');
319//MochiKit.Logging.logDebug("<<< [" + (new Date()).valueOf() + "] Record.processData");
320//MochiKit.Logging.logDebug("<<< Record.processData");
321
322 return this;
323 },
324
325 //-------------------------------------------------------------------------
326
327 'processDataToExtractLegacyValues': function(someValues) {
328//MochiKit.Logging.logDebug(">>> Record.processDataToExtractLegacyValues");
329 if (someValues['data'] != null) {
330 this.setNotes(someValues['data']);
331 }
332
333 if (
334 (typeof(someValues['loginFormData']) != "undefined")
335 &&(typeof(someValues['loginBindings'] != "undefined"))
336 &&(someValues['loginFormData'] != "")
337 &&(someValues['loginBindings'] != "")
338 ) {
339 vardirectLogin;
340
341 directLogin = new Clipperz.PM.DataModel.DirectLogin({
342 record:this,
343 label:this.label() + Clipperz.PM.Strings['newDirectLoginLabelSuffix'],
344 reference:Clipperz.Crypto.SHA.sha256(new Clipperz.ByteArray(this.label() +
345 someValues['loginFormData'] +
346 someValues['loginBindings'])).toHexString().substring(2),
347 formData:Clipperz.Base.evalJSON(someValues['loginFormData']),
348 legacyBindingData:Clipperz.Base.evalJSON(someValues['loginBindings']),
349 bookmarkletVersion:'0.1'
350 });
351 this.addDirectLogin(directLogin, true);
352 }
353//MochiKit.Logging.logDebug("<<< Record.processDataToExtractLegacyValues");
354 },
355
356 //-------------------------------------------------------------------------
357
358 'getReadyBeforeUpdatingVersionValues': function() {
359 },
360
361 //-------------------------------------------------------------------------
362
363 'addNewField': function() {
364 varnewField;
365
366//MochiKit.Logging.logDebug(">>> Record.addNewField - " + this);
367 this.getReadyBeforeUpdatingVersionValues();
368 newField = this.currentVersion().addNewField();
369 Clipperz.NotificationCenter.notify(this, 'recordUpdated');
370//MochiKit.Logging.logDebug("<<< Record.addNewField");
371
372 return newField;
373 },
374
375 //-------------------------------------------------------------------------
376
377 'removeField': function(aField) {
378 this.getReadyBeforeUpdatingVersionValues();
379 this.currentVersion().removeField(aField);
380 Clipperz.NotificationCenter.notify(this, 'recordUpdated');
381 },
382
383 'removeEmptyFields': function() {
384 MochiKit.Iter.forEach(MochiKit.Base.values(this.currentVersion().fields()), MochiKit.Base.bind(function(aField) {
385 if (aField.isEmpty()) {
386 this.removeField(aField);
387 // this.currentVersion().removeField(aField);
388 }
389 }, this));
390 },
391
392 //-------------------------------------------------------------------------
393
394 'notes': function() {
395 return this._notes;
396 },
397
398 'setNotes': function(aValue) {
399 this._notes = aValue;
400 this.setHeaderNotes(null);
401 },
402
403 //-------------------------------------------------------------------------
404
405 'headerNotes': function() {
406 return this._headerNotes;
407 },
408
409 'setHeaderNotes': function(aValue) {
410 this._headerNotes = aValue;
411 },
412
413 //-------------------------------------------------------------------------
414
415 'remove': function() {
416//MochiKit.Logging.logDebug(">>> Record.remove - " + this);
417 MochiKit.Iter.forEach(MochiKit.Base.values(this.directLogins()), MochiKit.Base.method(this, 'removeDirectLogin'));
418
419 this.syncDirectLoginReferenceValues();
420 this.user().removeRecord(this);
421//MochiKit.Logging.logDebug("<<< Record.remove");
422 },
423
424 //-------------------------------------------------------------------------
425
426 'directLogins': function() {
427 return this._directLogins;
428 },
429
430 'addDirectLogin': function(aDirectLogin, shouldUpdateUser) {
431 this.directLogins()[aDirectLogin.reference()] = aDirectLogin;
432 if (shouldUpdateUser == true) {
433 this.user().addDirectLogin(aDirectLogin);
434 }
435 },
436
437 'removeDirectLogin': function(aDirectLogin) {
438 this.removedDirectLogins().push(aDirectLogin);
439 delete this.directLogins()[aDirectLogin.reference()];
440 // this.user().removeDirectLogin(aDirectLogin);
441 },
442
443 'resetDirectLogins': function() {
444 this._directLogins = {};
445 },
446
447 'removedDirectLogins': function() {
448 return this._removedDirectLogins;
449 },
450
451 'resetRemovedDirectLogins': function() {
452 this._removedDirectLogins = [];
453 },
454
455 //-------------------------------------------------------------------------
456
457 'serverData': function() {
458 return this._serverData;
459 },
460
461 'setServerData': function(aValue) {
462 this._serverData = aValue;
463 this.setShouldLoadData(false);
464 return aValue;
465 },
466
467 //-------------------------------------------------------------------------
468
469 'decryptedData': function() {
470 return this._decryptedData;
471 },
472
473 'setDecryptedData': function(aValue) {
474 this._decryptedData = aValue;
475 this.setShouldDecryptData(false);
476 return aValue;
477 },
478
479 //-------------------------------------------------------------------------
480
481 'cachedData': function() {
482 return this._cachedData;
483 },
484
485 'setCachedData': function(aValue) {
486//MochiKit.Logging.logDebug(">>> Record.setCachedData");
487//MochiKit.Logging.logDebug("--- Record.setCachedData - aValue: " + Clipperz.Base.serializeJSON(aValue));
488 this._cachedData = aValue;
489 this.setShouldProcessData(false);
490//MochiKit.Logging.logDebug("<<< Record.setCachedData");
491
492 return aValue;
493 },
494
495 //-------------------------------------------------------------------------
496
497 'hasPendingChanges': function() {
498 var result;
499
500//MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Record.hasPendingChanges");
501//MochiKit.Logging.logDebug(">>> Record.hasPendingChanges - cachedData: " + this.cachedData());
502//MochiKit.Logging.logDebug(">>> Record.hasPendingChanges - cachedData: " + Clipperz.Base.serializeJSON(this.cachedData()));
503//MochiKit.Logging.logDebug(">>> Record.hasPendingChanges - currentSnapshot: " + this.currentDataSnapshot());
504//MochiKit.Logging.logDebug(">>> Record.hasPendingChanges - currentSnapshot: " + Clipperz.Base.serializeJSON(this.currentDataSnapshot()));
505//console.log(">>> Record.hasPendingChanges - cachedData: %o", this.cachedData());
506//console.log(">>> Record.hasPendingChanges - currentSnapshot: %o", this.currentDataSnapshot());
507 result = (MochiKit.Base.compare(this.cachedData(), this.currentDataSnapshot()) != 0);
508//MochiKit.Logging.logDebug("<<< Record.hasPendingChanges - " + result);
509
510 if ((result == false) && this.isBrandNew() && (this.label() != Clipperz.PM.Strings['newRecordTitleLabel'])) {
511 result = true;
512 }
513//MochiKit.Logging.logDebug("<<< [" + (new Date()).valueOf() + "] Record.hasPendingChanges");
514
515 return result;
516 },
517
518 //-------------------------------------------------------------------------
519
520 'currentDataSnapshot': function() {
521 varresult;
522
523//MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Record.currentDataSnapshot");
524 result = {
525 'label': this.label(),
526 'data': this.serializedData(),
527 'currentVersion': this.currentVersion().currentDataSnapshot()
528 };
529
530 // result['data']['data'] = this.notes();
531 result = Clipperz.Base.serializeJSON(result);
532
533//MochiKit.Logging.logDebug("<<< [" + (new Date()).valueOf() + "] Record.currentDataSnapshot");
534//MochiKit.Logging.logDebug("<<< Record.currentDataSnapshot");
535
536 return result;
537 },
538
539 //.........................................................................
540
541 'takeSnapshotOfCurrentData': function() {
542 this.setCachedData(this.currentDataSnapshot());
543 },
544
545 //-------------------------------------------------------------------------
546
547 'headerData': function() {
548 var result;
549
550 result = {
551 'label': this.label(),
552 'key': this.key()
553 };
554
555 if (this.headerNotes() != null) {
556 result['headerNotes'] = this.headerNotes();
557 }
558
559 return result;
560 },
561
562 //-------------------------------------------------------------------------
563
564 'serializedData': function() {
565 var result;
566 var directLoginReference;
567
568 result = {};
569 result['currentVersionKey'] = this.currentVersion().key();
570
571 result['directLogins'] = {};
572 for (directLoginReference in this.directLogins()) {
573 result['directLogins'][directLoginReference] = this.directLogins()[directLoginReference].serializedData();
574 }
575 result['notes'] = this.notes();
576
577 return result;
578 },
579
580 //-------------------------------------------------------------------------
581
582 'encryptedData': function() {
583 var deferredResult;
584 varresult;
585
586//MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Record.encryptedData");
587 result = {}
588//MochiKit.Logging.logDebug("--- Record.encryptedData - 1");
589 deferredResult = new MochiKit.Async.Deferred();
590//MochiKit.Logging.logDebug("--- Record.encryptedData - 2");
591//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Record.encryptedData - 1: " + res); return res;});
592 deferredResult.addCallback(function(aResult, aRecord) {
593 aResult['reference'] = aRecord.reference();
594 return aResult;
595 }, result, this);
596//MochiKit.Logging.logDebug("--- Record.encryptedData - 3");
597//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Record.encryptedData - 2: " + res); return res;});
598 deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion, this.key(), this.serializedData());
599//MochiKit.Logging.logDebug("--- Record.encryptedData - 4");
600//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Record.encryptedData - 3: " + res); return res;});
601 deferredResult.addCallback(function(aResult, res) {
602 aResult['data'] = res;
603 return aResult;
604 }, result);
605//MochiKit.Logging.logDebug("--- Record.encryptedData - 5");
606//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Record.encryptedData - 4: " + res); return res;});
607 deferredResult.addCallback(function(aResult) {
608 aResult['version'] = Clipperz.PM.Crypto.encryptingFunctions.currentVersion;
609 return aResult;
610 }, result);
611//MochiKit.Logging.logDebug("--- Record.encryptedData - 6");
612//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Record.encryptedData - 5: " + res); return res;});
613 deferredResult.callback();
614//MochiKit.Logging.logDebug("<<< [" + (new Date()).valueOf() + "] Record.encryptedData");
615
616 return deferredResult;
617 },
618
619 //-------------------------------------------------------------------------
620
621 'syncDirectLoginReferenceValues': function() {
622//MochiKit.Logging.logDebug(">>> Record.syncDirectLoginReferenceValues");
623 MochiKit.Iter.forEach(MochiKit.Base.values(this.directLogins()), function(aDirectLogin) {
624 aDirectLogin.record().user().synchronizeDirectLogin(aDirectLogin);
625 });
626
627 MochiKit.Iter.forEach(this.removedDirectLogins(), function(aDirectLogin) {
628 aDirectLogin.record().user().removeDirectLogin(aDirectLogin);
629 });
630
631 this.resetRemovedDirectLogins();
632//MochiKit.Logging.logDebug("<<< Record.syncDirectLoginReferenceValues");
633 },
634
635 //-------------------------------------------------------------------------
636
637 'saveChanges': function() {
638 var result;
639
640 if (this.isBrandNew() == false) {
641 result = this.user().saveRecords([this], 'updateData');
642 } else {
643 result = this.user().saveRecords([this], 'addNewRecords');
644 }
645
646 return result;
647 },
648
649/*
650 'saveChanges': function() {
651 var deferredResult;
652 varresult;
653
654 Clipperz.NotificationCenter.notify(this.user(), 'updatedSection', 'records', true);
655//MochiKit.Logging.logDebug(">>> Record.saveChanges");
656//MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Record.saveChanges");
657 if (this.headerNotes() != null) {
658 this.setNotes(this.headerNotes());
659 }
660 this.syncDirectLoginReferenceValues();
661 this.currentVersion().createNewVersion();
662
663 result = {'records': [{}]};
664
665 deferredResult = new MochiKit.Async.Deferred();
666 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveCard_collectRecordInfo');
667 deferredResult.addCallback(MochiKit.Base.method(this, 'updateKey'));
668
669 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveCard_encryptUserData');
670 deferredResult.addCallback(MochiKit.Base.method(this.user(), 'encryptedData'));
671 deferredResult.addCallback(function(aResult, res) {
672 aResult['user'] = res;
673 return aResult;
674 }, result);
675
676 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveCard_encryptRecordData');
677 deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedData'));
678 deferredResult.addCallback(function(aResult, res) {
679 //# aResult['record'] = res;
680 aResult['records'][0]['record'] = res;
681 return aResult;
682 }, result);
683
684 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveCard_encryptRecordVersions');
685 deferredResult.addCallback(MochiKit.Base.method(this.currentVersion(), 'encryptedData'));
686 deferredResult.addCallback(function(aResult, res) {
687 // aResult['currentRecordVersion'] = res;
688 aResult['records'][0]['currentRecordVersion'] = res;
689 return aResult;
690 }, result);
691
692 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveCard_sendingData');
693 if (this.isBrandNew() == false) {
694 deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'updateData');
695 } else {
696 //# deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'addNewRecord');
697 deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'addNewRecords');
698 }
699
700 deferredResult.addCallback(MochiKit.Base.method(this, 'takeSnapshotOfCurrentData'));
701 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveCard_updatingInterface');
702 deferredResult.addCallback(MochiKit.Base.method(this, 'setIsBrandNew'), false);
703 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'notify', 'recordUpdated');
704 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'notify', 'directLoginUpdated');
705 deferredResult.callback();
706
707 return deferredResult;
708 },
709 */
710 //-------------------------------------------------------------------------
711
712 'cancelChanges': function() {
713//MochiKit.Logging.logDebug(">>> Record.cancelChanges");
714//MochiKit.Logging.logDebug("--- Record.cancelChanges - cachedData: " + Clipperz.Base.serializeJSON(this.cachedData()));
715 if (this.isBrandNew()) {
716 this.user().removeRecord(this);
717 } else {
718 this.restoreValuesFromSnapshot(this.cachedData());
719 }
720//MochiKit.Logging.logDebug("<<< Record.cancelChanges");
721 },
722
723 //-------------------------------------------------------------------------
724
725 'restoreValuesFromSnapshot': function(someSnapshotData) {
726 varsnapshotData;
727
728//MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Record.restoreValuesFromSnapshot");
729 snapshotData = Clipperz.Base.evalJSON(someSnapshotData);
730//MochiKit.Logging.logDebug("--- Record.restoreValuesFromSnapshot - someSnapshotData (1): " + Clipperz.Base.serializeJSON(someSnapshotData));
731 this.setLabel(snapshotData['label']);
732 this.resetDirectLogins();
733 this.setShouldProcessData(true);
734 this.processData(snapshotData);
735//MochiKit.Logging.logDebug("--- Record.restoreValuesFromSnapshot - snapshotData: (2)" + Clipperz.Base.serializeJSON(snapshotData));
736
737 this.resetRemovedDirectLogins();
738
739 {
740 var currentSnapshot;
741 varcomparisonResult;
742
743 currentSnapshot = this.currentDataSnapshot();
744//MochiKit.Logging.logDebug("--- Record.restoreValuesFromSnapshot - 1");
745//console.log("snapshot data: %o", someSnapshotData.currentVersion);
746//console.log("current data: %o", currentSnapshot.currentVersion);
747//MochiKit.Logging.logDebug("--- Record.restoreValuesFromSnapshot - someSnapshotData: " + Clipperz.Base.serializeJSON(someSnapshotData.currentVersion));
748//MochiKit.Logging.logDebug("--- Record.restoreValuesFromSnapshot - currentSnapshot: " + Clipperz.Base.serializeJSON(currentSnapshot.currentVersion));
749 comparisonResult = MochiKit.Base.compare(someSnapshotData.currentVersion, currentSnapshot.currentVersion);
750//MochiKit.Logging.logDebug("--- Record.restoreValuesFromSnapshot - " + comparisonResult);
751 }
752//MochiKit.Logging.logDebug("<<< [" + (new Date()).valueOf() + "] Record.restoreValuesFromSnapshot");
753 },
754
755 //-------------------------------------------------------------------------
756 __syntaxFix__: "syntax fix"
757});
758
759
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/RecordField.js b/frontend/beta/js/Clipperz/PM/DataModel/RecordField.js
new file mode 100644
index 0000000..2063825
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/DataModel/RecordField.js
@@ -0,0 +1,220 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33//#############################################################################
34
35Clipperz.PM.DataModel.RecordField = function(args) {
36 args = args || {};
37
38 this._recordVersion = args.recordVersion || null;
39 this._key = args.key || Clipperz.PM.Crypto.randomKey();
40 this.setLabel(args.label || '');
41 this.setValue(args.value || '');
42 this.setType(args.type || 'TXT'); //valid types: 'TXT', 'PWD', 'URL', 'DATE', 'ADDR', 'CHECK', 'RADIO', ('NOTE' probably not), ...
43 this._hidden = args.hidden || (args.type == 'PWD') || false;
44
45 return this;
46}
47
48Clipperz.PM.DataModel.RecordField.prototype = MochiKit.Base.update(null, {
49
50 'toString': function() {
51 return "Clipperz.PM.DataModel.RecordField - " + this.label() + " (" + this.key() + ")";
52 },
53
54 //-------------------------------------------------------------------------
55
56 'recordVersion': function() {
57 return this._recordVersion;
58 },
59
60 //-------------------------------------------------------------------------
61
62 'key': function() {
63 return this._key;
64 },
65
66 //-------------------------------------------------------------------------
67
68 'label': function() {
69 return this._label;
70 },
71
72 'setLabel': function(aValue) {
73 this._label = aValue;
74 },
75
76 //-------------------------------------------------------------------------
77
78 'value': function() {
79 return this._value;
80 },
81
82 'setValue': function(aValue) {
83 this._value = aValue;
84 },
85
86 //-------------------------------------------------------------------------
87
88 'type': function() {
89 return this._type;
90 },
91
92 'setType': function(aValue) {
93 this._type = aValue;
94
95 if (aValue == 'PWD') {
96 this.setHidden(true);
97 } else {
98 this.setHidden(false);
99 }
100 },
101
102 //-------------------------------------------------------------------------
103
104 'serializeData': function() {
105 var result;
106
107//MochiKit.Logging.logDebug(">>> RecordField.serializeData - " + this);
108 result = {
109 label: this.label(),
110 value:this.value(),
111 type: this.type(),
112 hidden: this.hidden()
113 };
114//MochiKit.Logging.logDebug("<<< RecordField.serializeData");
115
116 return result;
117 },
118
119 //-------------------------------------------------------------------------
120
121 'typeShortDescription': function() {
122 // return Clipperz.PM.DataModel.RecordField.TypeDescriptions[this.type()]['shortDescription'];
123 return Clipperz.PM.Strings['recordFieldTypologies'][this.type()]['shortDescription'];
124 },
125
126 //-------------------------------------------------------------------------
127
128 'hidden': function() {
129 return this._hidden;
130 },
131
132 'setHidden': function(aValue) {
133 this._hidden = aValue;
134 },
135
136 //-------------------------------------------------------------------------
137
138 'clone': function(aRecordVersion) {
139 var result;
140
141 result = new Clipperz.PM.DataModel.RecordField({
142 recordVersion:aRecordVersion,
143 label:this.label(),
144 value:this.value(),
145 type:this.type(),
146 hidden:this.hidden()
147 });
148
149 return result;
150 },
151
152 //-------------------------------------------------------------------------
153
154 'isEmpty': function() {
155 var result;
156
157 if ((this.label() == "") && (this.value() == "") && (this.type() == 'TXT')) {
158 result = true;
159 } else {
160 result = false;
161 }
162
163 return result;
164 },
165
166 //-------------------------------------------------------------------------
167 __syntaxFix__: "syntax fix"
168
169});
170
171//#############################################################################
172/*
173Clipperz.PM.DataModel.RecordField.TypeDescriptions = {
174 'TXT': {
175 description: 'simple text field',
176 shortDescription: 'txt'
177 },
178 'PWD': {
179 description: 'simple text field, with default status set to hidden',
180 shortDescription: 'pwd'
181 },
182 'URL': {
183 description: 'simple text field in edit mode, that became an active url in view mode',
184 shortDescription: 'url'
185 },
186 'DATE': {
187 description: 'a value set with a calendar helper',
188 shortDescription: 'date'
189 },
190 'ADDR': {
191 description: 'just like the URL, but the active link points to Google Maps (or similar service) passing the address value as argument',
192 shortDescription: 'addr'
193 },
194 'CHECK': {
195 description: 'check description',
196 shortDescription: 'check'
197 },
198 'RADIO': {
199 description: 'radio description',
200 shortDescription: 'radio'
201 },
202 'SELECT': {
203 description: 'select description',
204 shortDescription: 'select'
205 }
206
207 //'NOTE': {
208 // description: 'a simple text field, but with a bigger component dimension; possibly with "smart edit components"',
209 // shortDescription: 'note'
210 //}
211};
212
213Clipperz.PM.DataModel.RecordField.InputTypeToRecordFieldType = {
214 'text': 'TXT',
215 'password': 'PWD',
216 'checkbox': 'CHECK',
217 'radio': 'RADIO',
218 'select': 'SELECT'
219};
220*/
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/RecordVersion.js b/frontend/beta/js/Clipperz/PM/DataModel/RecordVersion.js
new file mode 100644
index 0000000..d2b3e12
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/DataModel/RecordVersion.js
@@ -0,0 +1,535 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33
34//#############################################################################
35
36Clipperz.PM.DataModel.RecordVersion = function(aRecord, args) {
37 args = args || {};
38
39 this._record = aRecord;
40
41 this._reference = args.reference || Clipperz.PM.Crypto.randomKey();
42 this._version = args.version || Clipperz.PM.Crypto.encryptingFunctions.currentVersion;
43 this._key = args.key || Clipperz.PM.Crypto.randomKey();;
44
45 this._previousVersion = args.previousVersion || null;
46 this._previousVersionKey = args.previousVersionKey || null;
47
48 this.setIsBrandNew(args.reference == null);
49
50 if (this.isBrandNew()) {
51 this._fields = {};
52
53 this.setShouldLoadData(false);
54 this.setShouldDecryptData(false);
55 this.setShouldProcessData(false);
56 } else {
57 if (typeof(args.fields) != 'undefined') {
58 this.processFieldData(args.fields);
59
60 this.setShouldLoadData(false);
61 this.setShouldDecryptData(false);
62 this.setShouldProcessData(false);
63 } else {
64 if (typeof(args.data) != 'undefined') {
65 this.setShouldLoadData(false);
66 } else {
67 this.setShouldLoadData(true);
68 }
69 this.setShouldDecryptData(true);
70 this.setShouldProcessData(true);
71 }
72 }
73
74 this._serverData = args.data;
75 this._decryptedData = null;
76
77 return this;
78}
79
80Clipperz.PM.DataModel.RecordVersion.prototype = MochiKit.Base.update(null, {
81
82 'toString': function() {
83 return "RecordVersion";
84 },
85
86 //-------------------------------------------------------------------------
87
88 'record': function() {
89 return this._record;
90 },
91
92 //-------------------------------------------------------------------------
93
94 'reference': function() {
95 return this._reference;
96 },
97
98 'setReference': function(aValue) {
99 this._reference = aValue;
100 },
101
102 //-------------------------------------------------------------------------
103
104 'key': function() {
105//MochiKit.Logging.logDebug(">>> RecordVersion.key");
106//MochiKit.Logging.logDebug("--- RecordVersion.key - " + this._key);
107 return this._key;
108 },
109
110 'setKey': function(aValue) {
111 this._key = aValue;
112 },
113
114 //-------------------------------------------------------------------------
115
116 'serverData': function() {
117 return this._serverData;
118 },
119
120 'setServerData': function(aValue) {
121 this._serverData = aValue;
122 this.setShouldLoadData(false);
123 return aValue;
124 },
125
126 //-------------------------------------------------------------------------
127
128 'decryptedData': function() {
129//MochiKit.Logging.logDebug(">>> RecordVersion.decryptedData: " + (this._decryptedData ? Clipperz.Base.serializeJSON(aValue) : "null"));
130 return this._decryptedData;
131 },
132
133 'setDecryptedData': function(aValue) {
134//MochiKit.Logging.logDebug(">>> RecordVersion.setDecryptedData: " + Clipperz.Base.serializeJSON(aValue));
135 this._decryptedData = aValue;
136 this.setShouldDecryptData(false);
137 return aValue;
138 },
139
140 //-------------------------------------------------------------------------
141
142 'version': function() {
143 return this._version;
144 },
145
146 //-------------------------------------------------------------------------
147
148 'isBrandNew': function() {
149 return this._isBrandNew;
150 },
151
152 'setIsBrandNew': function(aValue) {
153 this._isBrandNew = aValue;
154 },
155
156 //-------------------------------------------------------------------------
157
158 'fields': function() {
159 return this._fields;
160 },
161
162 'addField': function(aField) {
163 this.fields()[aField.key()] = aField;
164 },
165
166 'addNewField': function() {
167 varnewRecordField;
168
169 newRecordField = new Clipperz.PM.DataModel.RecordField({recordVersion:this});
170 this.addField(newRecordField);
171
172 return newRecordField;
173 },
174
175 'fieldWithName': function(aValue) {
176 varresult;
177 var fieldValues;
178 var i,c;
179
180 result = null;
181 fieldValues = MochiKit.Base.values(this.fields());
182 c = fieldValues.length;
183 for (i=0; (i<c) && (result == null); i++) {
184 varcurrentField;
185
186 currentField = fieldValues[i];
187 if (currentField.label() == aValue) {
188 result = currentField;
189 }
190 }
191
192 return result;
193 },
194
195 //-------------------------------------------------------------------------
196
197 'shouldLoadData': function() {
198 return this._shouldLoadData;
199 },
200
201 'setShouldLoadData': function(aValue) {
202 this._shouldLoadData = aValue;
203 },
204
205 //-------------------------------------------------------------------------
206
207 'shouldDecryptData': function() {
208 return this._shouldDecryptData;
209 },
210
211 'setShouldDecryptData': function(aValue) {
212 this._shouldDecryptData = aValue;
213 },
214
215 //-------------------------------------------------------------------------
216
217 'shouldProcessData': function() {
218 return this._shouldProcessData;
219 },
220
221 'setShouldProcessData': function(aValue) {
222 this._shouldProcessData = aValue;
223 },
224
225 //-------------------------------------------------------------------------
226
227 'deferredData': function() {
228 var deferredResult;
229
230//MochiKit.Logging.logDebug(">>> RecordVersion.deferredData - this: " + this);
231 deferredResult = new MochiKit.Async.Deferred();
232 deferredResult.addCallback(MochiKit.Base.method(this, 'loadData'));
233 deferredResult.addCallback(MochiKit.Base.method(this, 'decryptData'));
234 deferredResult.addCallback(MochiKit.Base.method(this, 'processData'));
235 deferredResult.callback();
236//MochiKit.Logging.logDebug("<<< RecordVersion.deferredData");
237
238 return deferredResult;
239 },
240
241 //-------------------------------------------------------------------------
242
243 'loadData': function() {
244 var result;
245
246//MochiKit.Logging.logDebug(">>> RecordVersion.loadData - this: " + this);
247 if (this.shouldLoadData()) {
248 var deferredResult;
249
250 alert("ERROR: this should have not happened yet!");
251//MochiKit.Logging.logDebug("--- RecordVersion.loadData - 1");
252 deferredResult = new MochiKit.Async.Deferred();
253//MochiKit.Logging.logDebug("--- RecordVersion.loadData - 2");
254 deferredResult.addCallback(MochiKit.Base.method(this, 'notify'), 'loadingRecordVersionData');
255//MochiKit.Logging.logDebug("--- RecordVersion.loadData - 3");
256 deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'getRecordVersionDetail', {reference: this.reference()});
257//MochiKit.Logging.logDebug("--- RecordVersion.loadData - 4");
258 deferredResult.addCallback(MochiKit.Base.method(this, 'setServerData'));
259//MochiKit.Logging.logDebug("--- RecordVersion.loadData - 5");
260 deferredResult.callback();
261//MochiKit.Logging.logDebug("--- RecordVersion.loadData - 6");
262 result = deferredResult;
263//MochiKit.Logging.logDebug("--- RecordVersion.loadData - 7");
264 } else {
265//MochiKit.Logging.logDebug("--- RecordVersion.loadData - 8");
266 result = MochiKit.Async.succeed(this.serverData());
267//MochiKit.Logging.logDebug("--- RecordVersion.loadData - 9");
268 }
269//MochiKit.Logging.logDebug("<<< RecordVersion.loadData");
270
271 return result;
272 },
273
274 //-------------------------------------------------------------------------
275
276 'decryptData': function(anEncryptedData) {
277 var result;
278
279//MochiKit.Logging.logDebug(">>> RecordVersion.decryptData - this: " + this + " (" + anEncryptedData + ")");
280 if (this.shouldDecryptData()) {
281 var deferredResult;
282
283//MochiKit.Logging.logDebug("--- RecordVersion.decryptData - 1");
284 deferredResult = new MochiKit.Async.Deferred();
285//MochiKit.Logging.logDebug("--- RecordVersion.decryptData - 2");
286//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RecordVersion.decryptData 1: " + res); return res;});
287 deferredResult.addCallback(MochiKit.Base.method(this, 'notify'), 'decryptingRecordVersionData');
288//MochiKit.Logging.logDebug("--- RecordVersion.decryptData - 3");
289//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RecordVersion.decryptData 2: " + res); return res;});
290 deferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt, this.key(), anEncryptedData, this.version());
291//MochiKit.Logging.logDebug("--- RecordVersion.decryptData - 4");
292//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RecordVersion.decryptData 3: " + res); return res;});
293//MochiKit.Logging.logDebug("--- RecordVersion.decryptData - 5");
294//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RecordVersion.decryptData 4: " + res); return res;});
295 deferredResult.addCallback(MochiKit.Base.method(this, 'setDecryptedData'));
296//MochiKit.Logging.logDebug("--- RecordVersion.decryptData - 6");
297//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RecordVersion.decryptData 5: " + res); return res;});
298 deferredResult.callback();
299//MochiKit.Logging.logDebug("--- RecordVersion.decryptData - 7");
300 result = deferredResult;
301//MochiKit.Logging.logDebug("--- RecordVersion.decryptData - 8");
302 } else {
303//MochiKit.Logging.logDebug("--- RecordVersion.decryptData - 9");
304 result = MochiKit.Async.succeed(this.decryptedData());
305//MochiKit.Logging.logDebug("--- RecordVersion.decryptData - 10");
306 }
307//MochiKit.Logging.logDebug("<<< RecordVersion.decryptData");
308
309 return result;
310 },
311
312 //-------------------------------------------------------------------------
313
314 'processFieldData': function(someValues) {
315 var fieldValues;
316
317 this._fields = {};
318
319 if (typeof(someValues) == 'undefined') {
320 fieldValues = {};
321 } else {
322 fieldValues = someValues;
323 }
324
325 if (fieldValues.constructor == Array) {
326 var i, c;
327 c = fieldValues.length;
328 for (i=0; i<c; i++) {
329 var newRecordField;
330 var currentFieldValues;
331
332 currentFieldValues = fieldValues[i];
333 currentFieldValues['recordVersion'] = this;
334 newRecordField = new Clipperz.PM.DataModel.RecordField(currentFieldValues);
335 this._fields[newRecordField.key()] = newRecordField;
336 }
337
338 } else {
339 var fieldKey;
340
341 for (fieldKey in fieldValues) {
342 var newRecordField;
343 var currentFieldValues;
344
345 currentFieldValues = fieldValues[fieldKey];
346 currentFieldValues['key'] = fieldKey;
347 currentFieldValues['recordVersion'] = this;
348 newRecordField = new Clipperz.PM.DataModel.RecordField(currentFieldValues);
349 this._fields[fieldKey] = newRecordField;
350 }
351 }
352
353 },
354
355 'processData': function(someValues) {
356 if (this.shouldProcessData()) {
357 this.processFieldData(someValues.fields);
358 this.setShouldProcessData(false);
359 }
360
361 this.notify('recordVersionDataReady');
362
363 return this;
364 },
365
366 //-------------------------------------------------------------------------
367
368 'notify': function(aValue) {
369 Clipperz.NotificationCenter.notify(this, aValue);
370 },
371
372 //-------------------------------------------------------------------------
373
374 'removeField': function(aField) {
375 delete this.fields()[aField.key()];
376 },
377
378 //-------------------------------------------------------------------------
379
380 'previousVersion': function() {
381 return this._previousVersion;
382 },
383
384 'setPreviousVersion': function(aValue) {
385 this._previousVersion = aValue;
386 },
387
388 //-------------------------------------------------------------------------
389
390 'previousVersionKey': function() {
391 return this._previousVersionKey;
392 },
393
394 'setPreviousVersionKey': function(aValue) {
395 this._previousVersionKey = aValue;
396 },
397
398 //-------------------------------------------------------------------------
399
400 'serializedData': function() {
401 var result;
402 varfieldKey;
403
404//MochiKit.Logging.logDebug(">>> RecordVersion.serializedData");
405 result = {
406 fields: {}
407 };
408//MochiKit.Logging.logDebug("--- RecordVersion.serializedData - 1");
409
410 for (fieldKey in this.fields()) {
411//MochiKit.Logging.logDebug("--- RecordVersion.serializedData - 2");
412 result.fields[fieldKey] = this.fields()[fieldKey].serializeData();
413//MochiKit.Logging.logDebug("--- RecordVersion.serializedData - 3");
414 }
415//MochiKit.Logging.logDebug("--- RecordVersion.serializedData - 4");
416//MochiKit.Logging.logDebug("<<< RecordVersion.serializedData: " + Clipperz.Base.serializeJSON(result));
417
418 return result;
419 },
420
421 'currentDataSnapshot': function() {
422 var result;
423
424 result = this.serializedData();
425 result['version'] = this.version();
426 result['reference'] = this.reference();
427 result['previousVersionKey'] = this.previousVersionKey();
428
429 return result;
430 },
431
432 //-------------------------------------------------------------------------
433
434 'encryptedData': function() {
435 var deferredResult;
436 var result;
437
438//MochiKit.Logging.logDebug(">>> RecordVersion.encryptedData - " + this);
439 result = {};
440 deferredResult = new MochiKit.Async.Deferred();
441//MochiKit.Logging.logDebug("--- RecordVersion.encryptedData - 1");
442//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RecordVersion.encryptedData - 1: " + res); return res;});
443 deferredResult.addCallback(function(aResult, aRecordVersion) {
444 aResult['reference'] = aRecordVersion.reference();
445 aResult['recordReference'] = aRecordVersion.record().reference();// TODO - this seems to be completely useless
446 return aResult;
447 }, result, this);
448//MochiKit.Logging.logDebug("--- RecordVersion.encryptedData - 2");
449//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RecordVersion.encryptedData - 2: " + res); return res;});
450 deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion, this.key(), this.serializedData());
451//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RecordVersion.encryptedData - 3: " + res); return res;});
452 deferredResult.addCallback(function(aResult, res) {
453 aResult['data'] = res;
454 return aResult;
455 }, result);
456//MochiKit.Logging.logDebug("--- RecordVersion.encryptedData - 3");
457//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RecordVersion.encryptedData - 4: " + res); return res;});
458 deferredResult.addCallback(function(aResult) {
459 aResult['version'] = Clipperz.PM.Crypto.encryptingFunctions.currentVersion;
460 return aResult;
461 }, result);
462//MochiKit.Logging.logDebug("--- RecordVersion.encryptedData - 4");
463 if (this.previousVersion() != null) {
464//MochiKit.Logging.logDebug("--- RecordVersion.encryptedData - 5");
465//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RecordVersion.encryptedData - 5: " + res); return res;});
466 deferredResult.addCallback(function(aResult, aRecordVersion) {
467 aResult['previousVersion'] = aRecordVersion.previousVersion();
468 return aResult;
469 }, result, this);
470//MochiKit.Logging.logDebug("--- RecordVersion.encryptedData - 6");
471//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RecordVersion.encryptedData - 6: " + res); return res;});
472 deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion, this.key(), this.previousVersionKey());
473//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RecordVersion.encryptedData - 7: " + res); return res;});
474 deferredResult.addCallback(function(aResult, res) {
475 aResult['previousVersionKey'] = res;
476 return aResult;
477 }, result);
478//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RecordVersion.encryptedData - 8: " + res); return res;});
479//MochiKit.Logging.logDebug("--- RecordVersion.encryptedData - 7");
480 } else {
481//MochiKit.Logging.logDebug("--- RecordVersion.encryptedData - 8");
482//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RecordVersion.encryptedData - 9: " + res); return res;});
483 deferredResult.addCallback(function(aResult) {
484 aResult['previousVersionKey'] = Clipperz.PM.Crypto.nullValue;
485 return aResult;
486 }, result);
487//MochiKit.Logging.logDebug("--- RecordVersion.encryptedData - 9");
488//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RecordVersion.encryptedData - 10: " + res); return res;});
489 };
490//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("RecordVersion.encryptedData - 11: " + res); return res;});
491 deferredResult.callback();
492//MochiKit.Logging.logDebug("<<< RecordVersion.encryptedData");
493
494 return deferredResult;
495 },
496
497 //-------------------------------------------------------------------------
498
499 'createNewVersion': function() {
500 if (this.record().isBrandNew() == false) {
501 this.setPreviousVersion(this.reference());
502 this.setPreviousVersionKey(this.key());
503
504 this.setReference(Clipperz.PM.Crypto.randomKey());
505 this.setKey(Clipperz.PM.Crypto.randomKey());
506 }
507 },
508
509 //-------------------------------------------------------------------------
510/*
511 'shouldLoadData': function() {
512 return ((this.data() == null) && (this.isBrandNew() === false));
513 },
514
515 'loadData': function() {
516//MochiKit.Logging.logDebug(">>> Record.loadData (" + this.label() + ")");
517 // if (this.shouldLoadData()) {
518 // this.user().connection().message('getRecordDetail',
519 // {recordReference: this.reference()},
520 // {callback:MochiKit.Base.bind(this.loadDataCallback, this),
521 // errorHandler:Clipperz.PM.defaultErrorHandler });
522 // } else {
523 // this.notify('loadDataDone');
524 // }
525 },
526
527 'loadDataCallback': function() {
528MochiKit.Logging.logDebug("RecordVersion.loadDataCallback: " + Clipperz.Base.serializeJSON(arguments));
529 },
530*/
531 //-------------------------------------------------------------------------
532 __syntaxFix__: "syntax fix"
533
534});
535
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/Statistics.js b/frontend/beta/js/Clipperz/PM/DataModel/Statistics.js
new file mode 100644
index 0000000..fb5eb01
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/DataModel/Statistics.js
@@ -0,0 +1,133 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33
34//#############################################################################
35
36Clipperz.PM.DataModel.Statistics = function(args) {
37 args = args || {};
38
39 this._user = args.user;
40 this._data = args.data || null;
41
42 return this;
43}
44
45Clipperz.PM.DataModel.Statistics.prototype = MochiKit.Base.update(null, {
46
47 //-------------------------------------------------------------------------
48
49 'decrypt': function(aVersion, someEncryptedData) {
50 var deferredResult;
51
52//MochiKit.Logging.logDebug(">>> Statistics.decrypt");
53 if (someEncryptedData == Clipperz.PM.Crypto.nullValue) {
54 this.setData({});
55 deferredResult = MochiKit.Async.succeed(this.data());
56 } else {
57 varstatistic;
58 var user;
59
60 statistic = this;
61 user = this.user();
62 deferredResult = new MochiKit.Async.Deferred();
63//deferredResult.addCallback(function() { console.time("Statistics.decrypt.deferredDecrypt")});
64 deferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt, user.passphrase(), someEncryptedData, aVersion);
65//deferredResult.addCallback(function() { console.timeEnd("Statistics.decrypt.deferredDecrypt")});
66//deferredResult.addCallback(function() { console.time("Statistics.decrypt.setup")});
67 deferredResult.addCallbacks(
68 MochiKit.Base.partial(function (aStatistic, someData) {
69 aStatistic.setData(someData);
70 return aStatistic.data();
71 }, statistic),
72 MochiKit.Base.partial(function (aStatistic) {
73 MochiKit.Logging.logWarning("resetting user statistics due to an error while decrypting stored data");
74 aStatistic.setData({});
75 return aStatistic.data();
76 }, statistic)
77 );
78//deferredResult.addCallback(function() { console.timeEnd("Statistics.decrypt.setup")});
79
80 deferredResult.callback();
81 }
82//MochiKit.Logging.logDebug("<<< Statistics.decrypt");
83
84 return deferredResult;
85 },
86
87 //-------------------------------------------------------------------------
88
89 'user': function() {
90 return this._user;
91 },
92
93 //-------------------------------------------------------------------------
94
95 'data': function() {
96 return this._data;
97 },
98
99 'setData': function(aValue) {
100 this._data = aValue;
101
102 this.extractInfoFromData(aValue);
103 },
104
105 //-------------------------------------------------------------------------
106
107 'extractInfoFromData': function(someValues) {
108
109 },
110
111 //-------------------------------------------------------------------------
112
113 'encryptedData': function() {
114 return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(this.user().passphrase(), this.serializedData());
115 },
116
117 //-------------------------------------------------------------------------
118
119 'serializedData': function() {
120 var result;
121
122//MochiKit.Logging.logDebug(">>> Statistics.serializedData");
123 result = {};
124//MochiKit.Logging.logDebug("<<< Statistics.serializedData");
125
126 return result;
127 },
128
129 //-------------------------------------------------------------------------
130 __syntaxFix__: "syntax fix"
131
132});
133
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/User.js b/frontend/beta/js/Clipperz/PM/DataModel/User.js
new file mode 100644
index 0000000..5aaaff7
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/DataModel/User.js
@@ -0,0 +1,904 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33
34//#############################################################################
35
36Clipperz.PM.DataModel.User = function(args) {
37//MochiKit.Logging.logDebug(">>> new User");
38 args = args || {};
39
40 this._username = args.username || null;
41 this._passphrase = args.passphrase || null;
42
43 this._connection = null;
44 this._connectionVersion = 'current';
45
46 this._header = null;
47 this._statistics = null;
48 this._lock = 'new lock';
49
50 this._preferences = null;
51 this._records = {};
52 this._directLoginReferences = {};
53 this._oneTimePasswordManager = null;
54
55 this._isLoadingUserDetails = false;
56 this._loadingUserDetailsPendingQueue = [];
57
58 this._maxNumberOfRecords = Number.MAX_VALUE;
59
60 this._shouldDownloadOfflineCopy = false;
61
62 this._loginInfo = null;
63 this._loginHistory = null;
64
65 this._serverData = null;
66//MochiKit.Logging.logDebug("<<< new User");
67
68 return this;
69}
70
71Clipperz.PM.DataModel.User.prototype = MochiKit.Base.update(null, {
72
73 'toString': function() {
74 return "Clipperz.PM.DataModel.User - " + this.username();
75 },
76
77 //-------------------------------------------------------------------------
78
79 'username': function() {
80 return this._username;
81 },
82
83 'setUsername': function(aValue) {
84 this._username = aValue;
85 },
86
87 //-------------------------------------------------------------------------
88
89 'passphrase': function() {
90 return this._passphrase;
91 },
92
93 'setPassphrase': function(aValue) {
94 this._passphrase = aValue;
95 },
96
97 //-------------------------------------------------------------------------
98
99 'maxNumberOfRecords': function() {
100 return this._maxNumberOfRecords;
101 },
102
103 'setMaxNumberOfRecords': function(aValue) {
104 this._maxNumberOfRecords = aValue;
105 },
106
107 //-------------------------------------------------------------------------
108
109 'errorHandler': function(anErrorString, anException) {
110MochiKit.Logging.logError("- User.errorHandler: " + anErrorString + " (" + anException + ")");
111 },
112
113 //-------------------------------------------------------------------------
114
115 'connectionVersion': function() {
116 return this._connectionVersion;
117 },
118
119 'setConnectionVersion': function(aValue) {
120 this._connectionVersion = aValue;
121 },
122
123 //-------------------------------------------------------------------------
124
125 'connection': function() {
126 if ((this._connection == null) && (this.connectionVersion() != null) ){
127 this._connection = new Clipperz.PM.Crypto.communicationProtocol.versions[this.connectionVersion()]({user:this});
128 }
129
130 return this._connection;
131 },
132
133 'resetConnection': function(aValue) {
134 this._connection = null;
135 },
136
137 //=========================================================================
138
139 'register': function(anInvitationCode) {
140 vardeferredResult;
141 var prng;
142
143//MochiKit.Logging.logError(">>> User.register: " + this);
144 prng = Clipperz.Crypto.PRNG.defaultRandomGenerator();
145
146 deferredResult = new MochiKit.Async.Deferred()
147//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.register - 1: " + res); return res;});
148 deferredResult.addCallback(MochiKit.Base.method(prng, 'deferredEntropyCollection'));
149//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.register - 2: " + res); return res;});
150 deferredResult.addCallback(MochiKit.Base.method(this.header(), 'updateAllSections'), anInvitationCode);
151//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.register - 2.1: " + res); return res;});
152 deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'register'), anInvitationCode);
153//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.register - 3: " + res); return res;});
154 deferredResult.callback();
155//MochiKit.Logging.logError("<<< User.register");
156
157 return deferredResult;
158 },
159
160 //=========================================================================
161
162 'connect': function(aValue) {
163 vardeferredResult;
164 var prng;
165
166 prng = Clipperz.Crypto.PRNG.defaultRandomGenerator();
167
168//MochiKit.Logging.logDebug(">>> User.connect");
169 deferredResult = new MochiKit.Async.Deferred();
170//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.1 - User.connect - 1: "/* + res*/); return res;});
171//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
172 deferredResult.addCallback(MochiKit.Base.method(prng, 'deferredEntropyCollection'));
173//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.2 - User.connect - 2: "/* + res*/); return res;});
174//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
175 deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'login'));
176//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.3 - User.connect - 3: "/* + res*/); return res;});
177//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
178
179 // TODO:add an addErrback call here to manage a wrong login. Any error after this point is due to some other causes.
180 // possibly the same exact 'handleConnectionFallback use at the end of this same method.
181
182 if (this.connectionVersion() != 'current') {
183 varcurrentConnection;
184
185 currentVersionConnection = new Clipperz.PM.Crypto.communicationProtocol.versions['current']({user:this});
186
187//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.4 - User.connect - 4: "/* + res*/); return res;});
188//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
189 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_upgrading');
190//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.5 - User.connect - 5: "/* + res*/); return res;});
191//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
192 deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), 'upgradeUserCredentials', currentVersionConnection.serverSideUserCredentials());
193//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.6 - User.connect - 6: "/* + res*/); return res;});
194//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
195 }
196
197//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.7 - User.connect - 7: "/* + res*/); return res;});
198//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
199 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'userConnected', null);
200//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.8 - User.connect - 8: "/* + res*/); return res;});
201//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
202 deferredResult.addErrback(MochiKit.Base.method(this, 'handleConnectionFallback'));
203//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.9 - User.connect - 9: "/* + res*/); return res;});
204//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
205
206 deferredResult.callback(aValue);
207//MochiKit.Logging.logDebug("<<< User.connect");
208
209 return deferredResult;
210 },
211
212 //.........................................................................
213
214 'handleConnectionFallback': function(aValue) {
215 var result;
216//MochiKit.Logging.logDebug(">>> User.handleConnectionFallback");
217 if (aValue instanceof MochiKit.Async.CancelledError) {
218//MochiKit.Logging.logDebug("--- User.handleConnectionFallback - operation cancelled");
219 result = aValue;
220 } else {
221
222//MochiKit.Logging.logDebug("--- User.handleConnectionFallback - an ERROR has occurred - " + aValue);
223 this.resetConnection();
224 this.setConnectionVersion(Clipperz.PM.Crypto.communicationProtocol.fallbackVersions[this.connectionVersion()]);
225
226 if (this.connectionVersion() != null) {
227 result = new MochiKit.Async.Deferred();
228
229 result.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_tryOlderSchema');
230 result.addCallback(MochiKit.Base.method(this, 'connect'));
231 result.callback();
232 } else {
233 result = MochiKit.Async.fail(Clipperz.PM.DataModel.User.exception.LoginFailed);
234 }
235 }
236//MochiKit.Logging.logDebug("<<< User.handleConnectionFallback");
237 return result;
238 },
239
240 //=========================================================================
241
242 'header': function() {
243 if (this._header == null) {
244 this._header = new Clipperz.PM.DataModel.Header({user:this});
245 }
246 return this._header;
247 },
248
249 //-------------------------------------------------------------------------
250
251 'statistics': function() {
252 if (this._statistics == null) {
253 this._statistics = new Clipperz.PM.DataModel.Statistics({user:this});
254 }
255 return this._statistics;
256 },
257
258 //-------------------------------------------------------------------------
259
260 'records': function() {
261 return this._records;
262 },
263
264 //.........................................................................
265
266 'addRecord': function(aValue, isBatchUpdate) {
267 this.records()[aValue.reference()] = aValue;
268
269 if (isBatchUpdate != true) {
270 Clipperz.NotificationCenter.notify(aValue, 'recordAdded', null, true);
271 Clipperz.NotificationCenter.notify(this, 'updatedSection', 'records', true);
272 }
273 },
274
275 //-----------------------------------------------------------------------------
276
277 'addNewRecord': function() {
278 varrecord;
279
280//MochiKit.Logging.logDebug(">>> User.addNewRecord");
281 record = new Clipperz.PM.DataModel.Record({user:this});
282 this.addRecord(record);
283 Clipperz.NotificationCenter.notify(this, 'updatedSection', 'records', true);
284//MochiKit.Logging.logDebug("<<< User.addNewRecord");
285
286 return record;
287 },
288
289 //-------------------------------------------------------------------------
290
291 'saveRecords': function(someRecords, aMethodName) {
292 var deferredResult;
293 var methodName;
294 varresult;
295 var i,c;
296
297//console.log("User.saveRecords - someRecords", someRecords);
298 methodName = aMethodName || 'addNewRecords';
299
300 Clipperz.NotificationCenter.notify(this, 'updatedSection', 'records', true);
301//MochiKit.Logging.logDebug(">>> User.saveRecords");
302//MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] User.saveRecords");
303/*
304MochiKit.Logging.logDebug("--- User.saveRecords - 1");
305 MochiKit.Iter.forEach(someRecords, function(aRecord) {
306 if (aRecord.headerNotes() != null) {
307 aRecord.setNotes(aRecord.headerNotes());
308 }
309 aRecord.syncDirectLoginReferenceValues();
310 aRecord.currentVersion().createNewVersion();
311 aRecord.updateKey();
312 });
313MochiKit.Logging.logDebug("--- User.saveRecords - 2");
314*/
315
316 result = {'records': []};
317
318 deferredResult = new MochiKit.Async.Deferred();
319 c = someRecords.length;
320 for (i=0; i<c; i++) {
321 deferredResult.addCallback(function(aRecord) {
322 if (aRecord.headerNotes() != null) {
323 aRecord.setNotes(aRecord.headerNotes());
324 }
325 aRecord.syncDirectLoginReferenceValues();
326 aRecord.currentVersion().createNewVersion();
327 aRecord.updateKey();
328 }, someRecords[i]);
329 deferredResult.addCallback(MochiKit.Async.wait, 0.1);
330 }
331//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 1 " + res); return res;});
332 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveCard_collectRecordInfo');
333//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 2 " + res); return res;});
334
335 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveCard_encryptUserData');
336//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 3 " + res); return res;});
337 deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedData'));
338//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 4 " + res); return res;});
339 deferredResult.addCallback(function(aResult, res) {
340 aResult['user'] = res;
341 return aResult;
342 }, result);
343//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 5 " + res); return res;});
344
345 c = someRecords.length;
346 for (i=0; i<c; i++) {
347 var recordData;
348
349 recordData = {};
350
351//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.1 " + res); return res;});
352 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveCard_encryptRecordData');
353//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.2 " + res); return res;});
354 deferredResult.addCallback(MochiKit.Base.method(someRecords[i], 'encryptedData'));
355//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.3 " + res); return res;});
356 deferredResult.addCallback(function(aResult, res) {
357 aResult['record'] = res;
358 return aResult;
359 }, recordData);
360//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.4 " + res); return res;});
361
362 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', {} /*'saveCard_encryptRecordVersions'*/);
363//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.5 " + res); return res;});
364 deferredResult.addCallback(MochiKit.Base.method(someRecords[i].currentVersion(), 'encryptedData'));
365//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.6 " + res); return res;});
366 deferredResult.addCallback(function(aResult, res) {
367 aResult['currentRecordVersion'] = res;
368 return aResult;
369 }, recordData);
370//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.7 " + res); return res;});
371
372 deferredResult.addCallback(function(aResult, res) {
373 aResult['records'].push(res);
374 return aResult;
375 }, result);
376//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.8 " + res); return res;});
377 }
378
379//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 7 " + res); return res;});
380 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveCard_sendingData');
381//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 8 " + res); return res;});
382 deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), methodName);
383//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 9 " + res); return res;});
384
385 for (i=0; i<c; i++) {
386//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 9.1 " + res); return res;});
387 deferredResult.addCallback(MochiKit.Base.method(someRecords[i], 'takeSnapshotOfCurrentData'));
388//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 9.2 " + res); return res;});
389 deferredResult.addCallback(MochiKit.Base.method(someRecords[i], 'setIsBrandNew'), false);
390//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 9.3 " + res); return res;});
391 }
392
393//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 10 " + res); return res;});
394 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'notify', 'recordUpdated');
395//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 11 " + res); return res;});
396 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'notify', 'directLoginUpdated');
397//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 12 " + res); return res;});
398 deferredResult.callback();
399
400 return deferredResult;
401 },
402
403 //-------------------------------------------------------------------------
404
405 'removeRecord': function(aRecord) {
406//MochiKit.Logging.logDebug(">>> User.removeRecord");
407 delete this.records()[aRecord.reference()];
408//MochiKit.Logging.logDebug("--- User.removeRecord - 1");
409 Clipperz.NotificationCenter.notify(aRecord, 'recordRemoved', null, false);
410 Clipperz.NotificationCenter.notify(this, 'updatedSection', 'records', true);
411//MochiKit.Logging.logDebug("<<< User.removeRecord");
412 },
413
414 //-------------------------------------------------------------------------
415
416 'deleteRecordsAction': function(someRecords) {
417 vardeferredResult;
418 var parameters;
419
420//MochiKit.Logging.logDebug(">>> User.deleteRecordsAction - someRecords.length: " + someRecords.length);
421 parameters = {};
422 deferredResult = new MochiKit.Async.Deferred();
423//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.deleteRecordsAction - 1 " + res); return res;});
424 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'deleteRecord_collectData');
425//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.deleteRecordsAction - 2 " + res); return res;});
426 deferredResult.addCallback(function(someParameters, someRecords) {
427 var recordReferences;
428
429 recordReferences = MochiKit.Base.map(function(aRecord) {
430 var result;
431
432 result = aRecord.reference();
433 aRecord.remove();
434
435 return result;
436 }, someRecords);
437 someParameters.recordReferences = recordReferences;
438
439 return someParameters;
440 }, parameters);
441//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.deleteRecordsAction - 3 " + res); return res;});
442 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'deleteRecord_encryptData');
443//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.deleteRecordsAction - 4 " + res); return res;});
444 deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedData'));
445//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.deleteRecordsAction - 5 " + res); return res;});
446 deferredResult.addCallback(function(someParameters, anUserEncryptedData) {
447 someParameters.user = anUserEncryptedData;
448 return someParameters;
449 }, parameters);
450//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.deleteRecordsAction - 6 " + res); return res;});
451 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'deleteRecord_sendingData');
452//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.deleteRecords parameters: " + Clipperz.Base.serializeJSON(res)); return res;});
453//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.deleteRecordsAction - 7 " + res); return res;});
454 deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), 'deleteRecords');
455//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.deleteRecordsAction - 8 " + res); return res;});
456 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'deleteRecord_updatingInterface');
457//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.deleteRecordsAction - 9 " + res); return res;});
458 deferredResult.callback(someRecords);
459//MochiKit.Logging.logDebug("<<< User.deleteRecordsAction");
460
461 return deferredResult;
462 },
463
464 //-------------------------------------------------------------------------
465
466 'resetAllLocalData': function() {
467 this.resetConnection();
468
469 this.setUsername("");
470 this.setPassphrase("");
471
472 this._header = null;
473 this._statistics = null;
474 this._preferences = null;
475 this._records = {};
476 this._directLoginReferences = {};
477 },
478
479 //-------------------------------------------------------------------------
480
481 'deleteAccountAction': function() {
482 var deferredResult;
483
484//MochiKit.Logging.logDebug(">>> user.deleteAccountAction - " + this);
485 deferredResult = new MochiKit.Async.Deferred();
486 deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), 'deleteUser');
487 deferredResult.addCallback(MochiKit.Base.method(this, 'resetAllLocalData'));
488 deferredResult.callback();
489//MochiKit.Logging.logDebug("<<< user.deleteAccountAction - " + this);
490
491 return deferredResult;
492 },
493
494 //-------------------------------------------------------------------------
495
496 'encryptedData': function() {
497 var deferredResult;
498 varresult;
499
500 result = {};
501
502 deferredResult = new MochiKit.Async.Deferred();
503
504//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.encryptedData - 0: " + res); return res;});
505 deferredResult.addCallback(MochiKit.Base.method(this.header(), 'encryptedData'));
506//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.encryptedData - 1: " + res); return res;});
507 deferredResult.addCallback(function(aResult, aValue) {
508 aResult['header'] = aValue;
509 }, result);
510//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.encryptedData - 2: " + res); return res;});
511
512 deferredResult.addCallback(MochiKit.Base.method(this.statistics(), 'encryptedData'));
513//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.encryptedData - 3: " + res); return res;});
514 deferredResult.addCallback(function(aResult, aValue) {
515 aResult['statistics'] = aValue;
516 }, result);
517//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.encryptedData - 4: " + res); return res;});
518
519 deferredResult.addCallback(MochiKit.Base.bind(function(aResult, aValue) {
520 aResult['version'] = Clipperz.PM.Crypto.encryptingFunctions.currentVersion;
521 aResult['lock'] = this.lock();
522
523 return aResult;
524 }, this), result);
525//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.encryptedData - 5: " + res); return res;});
526 deferredResult.callback();
527
528 return deferredResult;
529 },
530
531 //-------------------------------------------------------------------------
532
533 'preferences': function() {
534 if (this._preferences == null) {
535 this._preferences = new Clipperz.PM.DataModel.UserPreferences({user:this});
536 }
537
538 return this._preferences;
539 },
540/*
541 'setPreferences': function(aValue) {
542 this._preferences = aValue;
543
544 if (this._preferences.preferredLanguage() != null) {
545 Clipperz.PM.Strings.Languages.setSelectedLanguage(this._preferences.preferredLanguage());
546 } else {
547//MochiKit.Logging.logDebug("### keepping the browser selected language: " + Clipperz.PM.Strings.selectedLanguage);
548 }
549 },
550*/
551 //-------------------------------------------------------------------------
552
553 'oneTimePasswordManager': function() {
554 if (this._oneTimePasswordManager == null) {
555 this._oneTimePasswordManager = new Clipperz.PM.DataModel.OneTimePasswordManager(this, null);
556 }
557
558 return this._oneTimePasswordManager;
559 },
560
561 //-------------------------------------------------------------------------
562
563 'directLoginReferences': function() {
564 return this._directLoginReferences;
565 },
566
567 'addDirectLoginReference': function(aDirectLoginReference, isBatchUpdate) {
568//MochiKit.Logging.logDebug(">>> User.addDirectLoginReference");
569 this.directLoginReferences()[aDirectLoginReference.reference()] = aDirectLoginReference;
570
571 if (isBatchUpdate != true) {
572 Clipperz.NotificationCenter.notify(aDirectLoginReference, 'directLoginAdded');
573 Clipperz.NotificationCenter.notify(this, 'updatedSection', 'directLogins', true);
574 }
575 },
576
577 'removeDirectLoginReference': function(aDirectLoginReference) {
578 delete this.directLoginReferences()[aDirectLoginReference.reference()];
579 Clipperz.NotificationCenter.notify(aDirectLoginReference, 'directLoginRemoved');
580 Clipperz.NotificationCenter.notify(this, 'updatedSection', 'directLogins', true);
581 },
582
583 //.........................................................................
584
585 'addDirectLogin': function(aDirectLogin) {
586 varnewDirectLoginReference;
587
588 newDirectLoginReference = new Clipperz.PM.DataModel.DirectLoginReference({user:this, directLogin:aDirectLogin})
589 this.addDirectLoginReference(newDirectLoginReference);
590 },
591
592 'synchronizeDirectLogin': function(aDirectLogin) {
593 var directLoginReference;
594
595 directLoginReference = this.directLoginReferences()[aDirectLogin.reference()];
596 if (typeof(directLoginReference) != 'undefined') {
597 directLoginReference.synchronizeValues(aDirectLogin);
598 } else {
599 this.addDirectLogin(aDirectLogin);
600 }
601 },
602
603 'removeDirectLogin': function(aDirectLogin) {
604 this.removeDirectLoginReference(aDirectLogin);
605 },
606
607 //-------------------------------------------------------------------------
608
609 'changeCredentials': function(aUsername, aPassphrase) {
610 vardeferredResult;
611 var result;
612
613 result = {};
614
615 deferredResult = new MochiKit.Async.Deferred();
616
617 deferredResult.addCallback(MochiKit.Base.method(this.header(), 'loadAllSections'));
618 deferredResult.addCallback(MochiKit.Base.method(this.header(), 'updateAllSections'));
619
620 deferredResult.addCallback(MochiKit.Base.bind(function(aUsername, aPssphrase) {
621 this.setUsername(aUsername);
622 this.setPassphrase(aPassphrase);
623 }, this), aUsername, aPassphrase)
624
625//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.changeCredentials - 1: " + res); return res;});
626 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'changeCredentials_encryptingData');
627//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.changeCredentials - 2: " + res); return res;});
628 deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedData'));
629//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.changeCredentials - 3: " + res); return res;});
630 deferredResult.addCallback(function(aResult, anEncryptedData) {
631 aResult['user'] = anEncryptedData;
632
633 return aResult;
634 }, result);
635//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.changeCredentials - 4: " + res); return res;});
636 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'changeCredentials_creatingNewCredentials');
637//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.changeCredentials - 5: " + res); return res;});
638 deferredResult.addCallback(function(aResult, anUser) {
639 varnewConnection;
640
641 newConnection = new Clipperz.PM.Crypto.communicationProtocol.versions[Clipperz.PM.Crypto.communicationProtocol.currentVersion]({user:anUser})
642 aResult['credentials'] = newConnection.serverSideUserCredentials();
643
644 return aResult;
645 }, result, this);
646//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.changeCredentials - 6: " + res); return res;});
647 deferredResult.addCallback(MochiKit.Base.method(this.oneTimePasswordManager(), 'encryptedData'));
648//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.changeCredentials - 7: " + res); return res;});
649 deferredResult.addCallback(function(aResult, anEncryptedData) {
650 aResult['oneTimePasswords'] = anEncryptedData;
651
652 return aResult;
653 }, result);
654//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.changeCredentials - 8: " + res); return res;});
655 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'changeCredentials_sendingCredentials');
656//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.changeCredentials - 9: " + res); return res;});
657 deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), 'upgradeUserCredentials');
658//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.changeCredentials - 10: " + res); return res;});
659 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'changeCredentials_done');
660//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.changeCredentials - 11: " + res); return res;});
661 deferredResult.callback();
662
663 return deferredResult;
664 },
665
666 //-------------------------------------------------------------------------
667
668 'doLogout': function() {
669 var deferredResult;
670
671 deferredResult = new MochiKit.Async.Deferred();
672//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.doLogout - 1: " + res); return res;});
673 deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'logout'));
674//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.doLogout - 2: " + res); return res;});
675 deferredResult.addCallback(MochiKit.Base.method(this, 'resetAllLocalData'));
676//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.doLogout - 3: " + res); return res;});
677
678 deferredResult.callback();
679
680 return deferredResult;
681 },
682
683 //-------------------------------------------------------------------------
684
685 'lock': function() {
686 this.setPassphrase("")
687 this.connection().logout();
688 this.connection().resetSrpConnection();
689 },
690
691 'unlockWithPassphrase': function(aValue) {
692 vardeferredResult;
693 // varconnection;
694
695 // connection = this.connection();
696
697 deferredResult = new MochiKit.Async.Deferred();
698//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.unlockWithPassphrase 1: " + res); return res;});
699 deferredResult.addCallback(MochiKit.Base.method(this, 'setPassphrase'));
700//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.unlockWithPassphrase 2: " + res); return res;});
701 // deferredResult.addCallback(MochiKit.Base.method(connection, 'message'), 'echo', {'echo':"echo"});
702 deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'reestablishConnection'));
703//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.unlockWithPassphrase 3: " + res); return res;});
704 // deferredResult.addErrback(MochiKit.Base.method(this, 'setPassphrase', ""));
705 deferredResult.addErrback(MochiKit.Base.bind(function(anError) {
706 this.setPassphrase("");
707 this.connection().resetSrpConnection();
708
709 return anError;
710 }, this));
711//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.unlockWithPassphrase 4: " + res); return res;});
712 deferredResult.callback(aValue);
713
714 return deferredResult;
715 },
716
717 //-------------------------------------------------------------------------
718 //-------------------------------------------------------------------------
719 //-------------------------------------------------------------------------
720 //-------------------------------------------------------------------------
721 //-------------------------------------------------------------------------
722 //-------------------------------------------------------------------------
723 //-------------------------------------------------------------------------
724 //-------------------------------------------------------------------------
725 //-------------------------------------------------------------------------
726 //-------------------------------------------------------------------------
727 //-------------------------------------------------------------------------
728 //-------------------------------------------------------------------------
729
730 'serverData': function() {
731 return this._serverData;
732 },
733
734 'setServerData': function(aValue) {
735//MochiKit.Logging.logDebug(">>> User.setServerData");
736 this._serverData = aValue;
737
738 if (typeof(aValue.maxNumberOfRecords) != 'undefined') {
739 this.setMaxNumberOfRecords(aValue.maxNumberOfRecords);
740 }
741//MochiKit.Logging.logDebug("<<< User.setServerData");
742 },
743
744 //-------------------------------------------------------------------------
745
746 'isLoadingUserDetails': function() {
747 return this._isLoadingUserDetails;
748 },
749
750 'setIsLoadingUserDetails': function(aValue) {
751 this._isLoadingUserDetails = aValue;
752 },
753
754 //-------------------------------------------------------------------------
755
756 'loadingUserDetailsPendingQueue': function() {
757 return this._loadingUserDetailsPendingQueue;
758 },
759
760 'flushLoadingUserDetailsPendingQueue': function() {
761 var queue;
762
763//MochiKit.Logging.logDebug(">>> User.flushLoadingUserDetailsPendingQueue");
764 queue = this.loadingUserDetailsPendingQueue();
765
766 while(queue.length > 0) {
767//MochiKit.Logging.logDebug("--- User.flushLoadingUserDetailsPendingQueue - pop");
768 queue.pop().callback();
769 }
770//MochiKit.Logging.logDebug("<<< User.flushLoadingUserDetailsPendingQueue");
771 },
772
773 //-------------------------------------------------------------------------
774
775 'getUserDetails': function() {
776 var deferredResult;
777
778//MochiKit.Logging.logDebug(">>> User.getUserDetails");
779 deferredResult = new MochiKit.Async.Deferred();
780 if ((this.serverData() == null) && (this.isLoadingUserDetails() == false)) {
781 deferredResult.addCallback(MochiKit.Base.method(this, 'setIsLoadingUserDetails', true));
782 deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), 'getUserDetails');
783 deferredResult.addCallback(MochiKit.Base.method(this, 'setServerData'));
784 deferredResult.addCallback(MochiKit.Base.method(this, 'flushLoadingUserDetailsPendingQueue'));
785 deferredResult.addCallback(MochiKit.Base.method(this, 'setIsLoadingUserDetails', false));
786 }
787
788 deferredResult.addCallback(MochiKit.Base.method(this, 'serverData'));
789
790 if (this.isLoadingUserDetails() == false) {
791 deferredResult.callback();
792 } else {
793 this.loadingUserDetailsPendingQueue().push(deferredResult);
794 }
795//MochiKit.Logging.logDebug("<<< User.getUserDetails");
796
797 return deferredResult;
798 },
799
800 //-------------------------------------------------------------------------
801
802 'loadRecords': function() {
803 return this.header().loadRecords();
804 },
805
806 'loadDirectLogins': function() {
807 return this.header().loadDirectLogins();
808 },
809
810 'loadPreferences': function() {
811 return this.header().loadPreferences();
812 },
813
814 'loadOneTimePasswords': function() {
815 return this.header().loadOneTimePasswords();
816 },
817
818 //-------------------------------------------------------------------------
819
820 'loadLoginHistory': function() {
821 var deferredResult;
822
823 deferredResult = new MochiKit.Async.Deferred();
824 deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), 'getLoginHistory');
825 deferredResult.addCallback(function(aResult) {
826 return aResult['result'];
827 });
828 deferredResult.addCallback(MochiKit.Base.method(this, 'setLoginHistory'));
829 deferredResult.addCallback(MochiKit.Base.method(this, 'loginHistory'));
830 deferredResult.callback();
831
832 return deferredResult;
833 },
834
835 //-------------------------------------------------------------------------
836
837 'shouldDownloadOfflineCopy': function() {
838 return this._shouldDownloadOfflineCopy;
839 },
840
841 'setShouldDownloadOfflineCopy': function(aValue) {
842 this._shouldDownloadOfflineCopy = aValue;
843 },
844
845 //-------------------------------------------------------------------------
846
847 'loginInfo': function() {
848 return this._loginInfo;
849 },
850
851 'setLoginInfo': function(aValue) {
852 this._loginInfo = aValue;
853//MochiKit.Logging.logDebug("### LoginInfo: " + Clipperz.Base.serializeJSON(aValue));
854 },
855
856 //-------------------------------------------------------------------------
857
858 'loginHistory': function() {
859 return this._loginHistory;
860 },
861
862 'setLoginHistory': function(aValue) {
863 this._loginHistory = aValue;
864 },
865/*
866 'loginInfoWithOneTimePasswordReference': function(aOneTimePasswordReference) {
867 var result;
868 var i,c;
869
870 result = null;
871 c = this.loginHistory().length;
872 for (i=0; (i<c) && (result == null); i++) {
873 var currentLoginInfo;
874
875 currentLoginInfo = this.loginHistory()[i];
876 if (currentLoginInfo['oneTimePasswordReference'] == aOneTimePasswordReference) {
877 result = currentLoginInfo;
878 }
879 }
880
881 return result;
882 },
883 */
884 //-------------------------------------------------------------------------
885
886 'lock': function() {
887 return this._lock;
888 },
889
890 'setLock': function(aValue) {
891//MochiKit.Logging.logDebug("=== User.setLock: " + aValue);
892 this._lock = aValue;
893 },
894
895 //-------------------------------------------------------------------------
896 __syntaxFix__: "syntax fix"
897
898});
899
900
901Clipperz.PM.DataModel.User.exception = {
902 LoginFailed: new MochiKit.Base.NamedError("Clipperz.PM.DataModel.User.exception.LoginFailed")
903};
904
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js b/frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js
new file mode 100644
index 0000000..dc73ce1
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js
@@ -0,0 +1,197 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33
34//#############################################################################
35
36Clipperz.PM.DataModel.UserPreferences = function(args) {
37 args = args || {};
38
39 this._user = args['user']; delete args['user'];
40 this._config = args;
41
42 return this;
43}
44
45Clipperz.PM.DataModel.UserPreferences.prototype = MochiKit.Base.update(null, {
46
47 //-------------------------------------------------------------------------
48
49 'config': function() {
50 return this._config;
51 },
52
53 //-------------------------------------------------------------------------
54
55 'user': function() {
56 return this._user;
57 },
58
59 //-------------------------------------------------------------------------
60
61 'updateWithData': function(someValues) {
62 var currentLanguage;
63
64//MochiKit.Logging.logDebug(">>> Clipperz.PM.DataModel.UserPreferences.updateWithData: " + Clipperz.Base.serializeJSON(someValues));
65 currentLanguage = this.preferredLanguage();
66
67 MochiKit.Base.update(this._config, someValues);
68
69 if (this.preferredLanguage() != currentLanguage) {
70 Clipperz.PM.Strings.Languages.setSelectedLanguage(this.preferredLanguage());
71 } else {
72//MochiKit.Logging.logDebug("### keepping the browser selected language: " + Clipperz.PM.Strings.selectedLanguage);
73 }
74
75 return this;
76 },
77
78 //-------------------------------------------------------------------------
79
80 'configValue': function(aConfigName, aDefaultValue) {
81 var result;
82
83//MochiKit.Logging.logDebug(">>> UserPreferences.configValue - config: " + Clipperz.Base.serializeJSON(this.config()));
84 if (typeof(this.config()[aConfigName]) == 'undefined') {
85 result = aDefaultValue;
86 } else {
87 result = this.config()[aConfigName];
88 }
89//MochiKit.Logging.logDebug("<<< UserPreferences.configValue");
90
91 return result;
92 },
93
94 'setConfigValue': function(aConfigName, aValue) {
95 var result;
96
97 if (aValue != this.configValue(aConfigName)) {
98 if (aValue == null) {
99 delete this.config()[aConfigName]
100 } else {
101 this.config()[aConfigName] = aValue;
102 }
103
104 Clipperz.NotificationCenter.notify(this.user(), 'updatedSection', 'preferences', true);
105
106 result = true;
107 } else {
108 result = false;
109 }
110
111 return result;
112 },
113
114 //-------------------------------------------------------------------------
115
116 'useSafeEditMode': function() {
117 return this.configValue('useSafeEditMode', true);
118 },
119
120 'setUseSafeEditMode': function(aValue) {
121 this.setConfigValue('useSafeEditMode', aValue);
122 },
123
124 //-------------------------------------------------------------------------
125
126 'preferredLanguage': function() {
127 return this.configValue('preferredLanguage', null);
128 },
129
130 'setPreferredLanguage': function(aValue) {
131 if (this.setConfigValue('preferredLanguage', aValue)) {
132 Clipperz.PM.Strings.Languages.setSelectedLanguage(this.preferredLanguage());
133 }
134 },
135
136 //-------------------------------------------------------------------------
137
138 'shouldShowDonationPanel': function() {
139 return this.configValue('shouldShowDonationPanel', true);
140 },
141
142 'setShouldShowDonationPanel': function(aValue) {
143 this.setConfigValue('shouldShowDonationPanel', aValue);
144 },
145
146 //-------------------------------------------------------------------------
147
148 'disableUnsecureFaviconLoadingForIE': function() {
149 return this.configValue('disableUnsecureFaviconLoadingForIE', false);
150 },
151
152 'setDisableUnsecureFaviconLoadingForIE': function(aValue) {
153 this.setConfigValue('disableUnsecureFaviconLoadingForIE', aValue);
154 },
155
156 //-------------------------------------------------------------------------
157
158 'serializedData': function() {
159 return this.config();
160 },
161
162 //-------------------------------------------------------------------------
163
164 'saveChanges': function(aReferenceElement) {
165 vardeferredResult;
166
167 deferredResult = new MochiKit.Async.Deferred();
168
169 deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'),
170 {
171 title:"", //Clipperz.PM.Strings['accountPreferencesSavingPanelTitle_Step1'],
172 text:"", //Clipperz.PM.Strings['accountPreferencesSavingPanelText_Step1'],
173 width:240,
174 showProgressBar:true,
175 showCloseButton:false
176 },
177 aReferenceElement
178 );
179 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'account_savingPreferences_1');
180 deferredResult.addCallback(MochiKit.Base.method(this.user(), 'encryptedData'));
181 deferredResult.addCallback(function(res) {
182 return {user:res};
183 })
184 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'account_savingPreferences_2');
185 deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'updateData');
186 deferredResult.addCallback(Clipperz.PM.Components.MessageBox().hide, YAHOO.ext.Element.get('main'));
187 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedPreferences', null);
188
189 deferredResult.callback();
190
191 return deferredResult;
192 },
193
194 //-------------------------------------------------------------------------
195 __syntaxFix__: "syntax fix"
196});
197
diff --git a/frontend/beta/js/Clipperz/PM/Date.js b/frontend/beta/js/Clipperz/PM/Date.js
new file mode 100644
index 0000000..5e21340
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Date.js
@@ -0,0 +1,193 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Date) == 'undefined') { Clipperz.PM.Date = {}; }
32
33Clipperz.PM.Date.VERSION = "0.1";
34Clipperz.PM.Date.NAME = "Clipperz.PM.Date";
35
36MochiKit.Base.update(Clipperz.PM.Date, {
37
38 '__repr__': function () {
39 return "[" + this.NAME + " " + this.VERSION + "]";
40 },
41
42 //-------------------------------------------------------------------------
43
44 'toString': function () {
45 return this.__repr__();
46 },
47
48 //-------------------------------------------------------------------------
49
50 'locale': function() {
51 return {
52 'amDesignation':Clipperz.PM.Strings['calendarStrings']['amDesignation'],
53 'pmDesignation':Clipperz.PM.Strings['calendarStrings']['pmDesignation'],
54 'days': Clipperz.PM.Strings['calendarStrings']['days'],
55 'shortDays': Clipperz.PM.Strings['calendarStrings']['shortDays'],
56 'shortMonths': Clipperz.PM.Strings['calendarStrings']['shortMonths'],
57 'months': Clipperz.PM.Strings['calendarStrings']['months']
58 }
59 },
60
61 //=========================================================================
62/*
63 'formatDateWithPHPLikeTemplate': function(aDate, aTemplate) {
64 return Clipperz.Date.formatDateWithPHPLikeTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale());
65 },
66
67 'parseDateWithPHPLikeTemplate': function(aDate, aTemplate) {
68 return Clipperz.Date.parseDateWithPHPTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale());
69 },
70
71 //=========================================================================
72
73 'formatDateWithJavaLikeTemplate': function(aDate, aTemplate) {
74 return Clipperz.Date.formatDateWithJavaLikeTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale());
75 },
76
77 'parseDateWithJavaLikeTemplate': function(aDate, aTemplate) {
78 return Clipperz.Date.parseDateWithJavaLikeTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale());
79 },
80*/
81 //=========================================================================
82
83 'formatDateWithTemplate': function(aDate, aTemplate) {
84 var result;
85
86 if (aDate == null) {
87 result = ""
88 } else {
89 result = Clipperz.Date.formatDateWithPHPLikeTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale());
90 };
91
92 return result;
93 },
94
95 'parseDateWithTemplate': function(aValue, aTemplate) {
96 return Clipperz.Date.parseDateWithPHPTemplateAndLocale(aValue, aTemplate, Clipperz.PM.Date.locale());
97 },
98
99 //=========================================================================
100
101 'formatDateWithUTCFormat': function(aDate) {
102 return Clipperz.Date.formatDateWithUTCFormatAndLocale(aDate, Clipperz.PM.Date.locale());
103 },
104
105 'parseDateWithUTCFormat': function(aValue) {
106 var result;
107
108 if (aValue == null) {
109 result = null;
110 } else {
111 result = Clipperz.Date.parseDateWithUTCFormatAndLocale(aValue, Clipperz.PM.Date.locale());
112 }
113
114 return result;
115 },
116
117 //=========================================================================
118
119 'getElapsedTimeDescription': function(aDate) {
120 var result;
121
122 result = ""
123
124 if (aDate != null) {
125 var now;
126 var elapsedTime;
127
128 var millisencondsInAMinute;
129 var millisencondsInAnHour;
130 var millisencondsInADay;
131 var millisencondsInAWeek;
132 var millisencondsInAMonth;
133
134 now = new Date();
135 elapsedTime = now.getTime() - aDate.getTime();
136
137 millisencondsInAMinute = 60 * 1000;
138 millisencondsInAnHour = millisencondsInAMinute * 60;
139 millisencondsInADay = millisencondsInAnHour * 24;
140 millisencondsInAWeek = millisencondsInADay * 7;
141 millisencondsInAMonth = millisencondsInAWeek * 5;
142
143 if ((elapsedTime / millisencondsInAMonth) > 1) {
144 result = Clipperz.PM.Strings['elapsedTimeDescriptions']['MORE_THAN_A_MONTH_AGO'];
145 } else if ((elapsedTime / millisencondsInAWeek) > 1) {
146 var elapsedWeeks;
147
148 elapsedWeeks = Math.floor((elapsedTime / millisencondsInAWeek));
149 if (elapsedWeeks == 1) {
150 result = Clipperz.PM.Strings['elapsedTimeDescriptions']['MORE_THAN_A_WEEK_AGO'];
151 } else {
152 result = Clipprez.PM.Strings['elapsedTimeDescriptions']['MORE_THAN_*_WEEKS_AGO'].replace(/__elapsed__/, elapsedWeeks);
153 }
154 } else if ((elapsedTime / millisencondsInADay) > 1) {
155 var elapsedDays;
156
157 elapsedDays = Math.floor((elapsedTime / millisencondsInADay));
158 if (elapsedDays == 1) {
159 result = Clipperz.PM.Strings['elapsedTimeDescriptions']['YESTERDAY'];
160 } else {
161 result = Clipperz.PM.Strings['elapsedTimeDescriptions']['*_DAYS_AGO'].replace(/__elapsed__/, elapsedDays);
162 }
163 } else if ((elapsedTime / millisencondsInAnHour) > 1) {
164 var elapsedHours;
165
166 elapsedHours = Math.floor((elapsedTime / millisencondsInAnHour));
167 if (elapsedHours == 1) {
168 result = Clipperz.PM.Strings['elapsedTimeDescriptions']['ABOUT_AN_HOUR_AGO'];
169 } else {
170 result = Clipperz.PM.Strings['elapsedTimeDescriptions']['*_HOURS_AGO'].replace(/__elapsed__/, elapsedHours);
171 }
172 } else {
173 var elapsed10Minutes;
174
175 elapsed10Minutes = (Math.floor((elapsedTime / millisencondsInAMinute) / 10)) * 10;
176 if (elapsed10Minutes == 0) {
177 result = Clipperz.PM.Strings['elapsedTimeDescriptions']['JUST_A_FEW_MINUTES_AGO'];
178 } else {
179 result = Clipperz.PM.Strings['elapsedTimeDescriptions']['ABOUT_*_MINUTES_AGO'].replace(/__elapsed__/, elapsed10Minutes+"");
180 }
181 }
182 }
183
184 return result;
185 },
186
187 //-------------------------------------------------------------------------
188
189 //-------------------------------------------------------------------------
190 __syntaxFix__: "syntax fix"
191
192});
193
diff --git a/frontend/beta/js/Clipperz/PM/Main.js b/frontend/beta/js/Clipperz/PM/Main.js
new file mode 100644
index 0000000..9a068e1
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Main.js
@@ -0,0 +1,588 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
30
31Clipperz.PM.VERSION = "0.1";
32Clipperz.PM.NAME = "Clipperz.PM";
33
34//#############################################################################
35
36Clipperz.PM.Main = function() {
37 this._loginPanel = null;
38 this._user = null;
39
40 this._isRunningCompact = false;
41
42 Clipperz.NotificationCenter.register(null, 'userConnected', this, 'userConnectedCallback');
43 Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler');
44
45 Clipperz.NotificationCenter.register(null, 'EXCEPTION', this, 'reportException');
46
47 return this;
48}
49
50//=============================================================================
51
52MochiKit.Base.update(Clipperz.PM.Main.prototype, {
53 'toString': function() {
54 return "Clipperz.PM.Main";
55 },
56
57 'switchLanguageHandler': function() {
58//MochiKit.Logging.logDebug(">>> main.switchLanguageHandler");
59 YAHOO.ext.Element.get('donateHeaderIconLink').dom.href = Clipperz.PM.Strings['donateHeaderLinkUrl'];
60 YAHOO.ext.Element.get('donateHeaderLink').update(Clipperz.PM.Strings['donateHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['donateHeaderLinkUrl'];
61 YAHOO.ext.Element.get('creditsHeaderLink').update(Clipperz.PM.Strings['creditsHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['creditsHeaderLinkUrl'];
62 YAHOO.ext.Element.get('feedbackHeaderLink').update(Clipperz.PM.Strings['feedbackHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['feedbackHeaderLinkUrl'];
63 YAHOO.ext.Element.get('helpHeaderLink').update(Clipperz.PM.Strings['helpHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['helpHeaderLinkUrl'];
64 YAHOO.ext.Element.get('forumHeaderLink').update(Clipperz.PM.Strings['forumHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['forumHeaderLinkUrl'];
65
66 if (YAHOO.ext.Element.get('logout') != null) {
67 YAHOO.ext.Element.get('logout').update(Clipperz.PM.Strings['logoutMenuLabel']);
68 YAHOO.ext.Element.get('lock').update(Clipperz.PM.Strings['lockMenuLabel']);
69
70 YAHOO.ext.Element.get('recordsTabAnchor').update(Clipperz.PM.Strings['recordMenuLabel']);
71 YAHOO.ext.Element.get('accountTabAnchor').update(Clipperz.PM.Strings['accountMenuLabel']);
72 YAHOO.ext.Element.get('dataTabAnchor').update(Clipperz.PM.Strings['dataMenuLabel']);
73 // YAHOO.ext.Element.get('contactsTabAnchor').update(Clipperz.PM.Strings['contactsMenuLabel']);
74 YAHOO.ext.Element.get('toolsTabAnchor').update(Clipperz.PM.Strings['toolsMenuLabel']);
75 }
76//MochiKit.Logging.logDebug("<<< main.switchLanguageHandler");
77 },
78
79 //-------------------------------------------------------------------------
80
81 'fixToDrawTheMainTabsCorrectlyOnSafari': function() {
82 this.switchLanguageHandler();
83 },
84
85 //-------------------------------------------------------------------------
86
87 'run': function(shouldShowRegistrationForm) {
88 varmainElement;
89
90 Clipperz.NotificationCenter.register(null, 'updatedProgressState', this, 'updateProgressDialogStatus');
91
92 YAHOO.ext.Element.get('recordDetailEditModeHeaderMask').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide().unmask();
93 YAHOO.ext.Element.get('recordDetailEditModeVerticalMask').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide().unmask();
94
95//MochiKit.Logging.logDebug(">>> Main.run");
96 mainElement = YAHOO.ext.Element.get('main');
97 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) {
98 YAHOO.ext.Element.get('applicationVersionType').dom.className = "readOnly";
99 }
100 mainElement.update("");
101
102 Clipperz.YUI.DomHelper.append(mainElement.dom, {tag:'ul', cls:'clipperzTabPanels', children:[
103 {tag:'li', id:'loginPanel'}
104 ]})
105
106 this.setLoginPanel(new Clipperz.PM.Components.Panels.LoginPanel(YAHOO.ext.Element.get('loginPanel')));
107
108//MochiKit.Logging.logDebug("--- Main.run - selecting active form to show ...");
109 if (shouldShowRegistrationForm == true) {
110 this.loginPanel().showRegistrationForm(false);
111 } else {
112 this.loginPanel().showLoginForm(false);
113 }
114
115 this.switchLanguageHandler();
116//MochiKit.Logging.logDebug("--- Main.run - selecting active form to show. done.");
117//MochiKit.Logging.logDebug("<<< Main.run");
118 },
119
120 //-------------------------------------------------------------------------
121
122 'runCompact': function() {
123 this.setIsRunningCompact(true);
124 YAHOO.ext.Element.get(document.body).addClass("compact");
125 new Clipperz.PM.Components.Compact.LoginForm(YAHOO.ext.Element.get('mainDiv'));
126 },
127
128 'showCompactInterface': function() {
129//MochiKit.Logging.logDebug(">>> main.showCompactInterface");
130 new Clipperz.PM.Components.Compact.CompactInterface(YAHOO.ext.Element.get('compactBody'), {user:this.user()});
131//MochiKit.Logging.logDebug("<<< main.showCompactInterface");
132 },
133
134 //-------------------------------------------------------------------------
135
136 'mainPage': function() {
137 if (this._mainPage == null) {
138 this._mainPage = new Clipperz.PM.Components.MainPage();
139 }
140
141 return this._mainPage;
142 },
143
144 //-------------------------------------------------------------------------
145
146 'loginPanel': function() {
147 return this._loginPanel;
148 },
149
150 'setLoginPanel': function(aValue) {
151 this._loginPanel = aValue;
152 },
153
154 //-------------------------------------------------------------------------
155
156 'showMainPanels': function() {
157 varmainElement;
158 var logoutBlock;
159 var lockBlock;
160 var menusTRElement;
161
162 this.loginPanel().remove();
163 this.setLoginPanel(null);
164
165 logoutBlock = YAHOO.ext.Element.get('logoutLI');
166 Clipperz.YUI.DomHelper.append(logoutBlock.dom, {tag:'a', href:"#", id:'logout', htmlString:Clipperz.PM.Strings['logoutMenuLabel']});
167 MochiKit.Signal.connect('logout', 'onclick', this, 'doLogoutEventHandler');
168
169 lockBlock = YAHOO.ext.Element.get('lockLI');
170 Clipperz.YUI.DomHelper.append(lockBlock.dom, {tag:'a', href:"#", id:'lock', htmlString:Clipperz.PM.Strings['lockMenuLabel']});
171 MochiKit.Signal.connect('lock', 'onclick', this, 'doLockEventHandler');
172
173 menusTRElement = YAHOO.ext.Element.get('menusTR');
174 Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'recordsTab', children:[{tag:'div', children:[{tag:'a', id:'recordsTabAnchor', htmlString:Clipperz.PM.Strings['recordMenuLabel']}]}]});
175 Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'accountTab', children:[{tag:'div', children:[{tag:'a', id:'accountTabAnchor', htmlString:Clipperz.PM.Strings['accountMenuLabel']}]}]});
176 Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'dataTab', children:[{tag:'div', children:[{tag:'a', id:'dataTabAnchor', htmlString:Clipperz.PM.Strings['dataMenuLabel']}]}]});
177 // Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'contactsTab', children:[{tag:'div', children:[{tag:'a', id:'contactsTabAnchor', htmlString:Clipperz.PM.Strings['contactsMenuLabel']}]}]});
178 Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'toolsTab', children:[{tag:'div', children:[{tag:'a', id:'toolsTabAnchor', htmlString:Clipperz.PM.Strings['toolsMenuLabel']}]}]});
179
180 mainElement = YAHOO.ext.Element.get('main');
181 mainElement.update("");
182 Clipperz.YUI.DomHelper.append(mainElement.dom, {tag:'ul', cls:'clipperzTabPanels', children:[
183 {tag:'li', id:'recordsPanel'},
184 {tag:'li', id:'accountPanel'},
185 {tag:'li', id:'dataPanel'},
186 // {tag:'li', id:'contactsPanel'},
187 {tag:'li', id:'toolsPanel'}
188 ]}, true)
189
190 new Clipperz.PM.Components.TabPanel.TabPanelController({
191 name: 'mainTabPanel',
192 config:{'recordsTab':'recordsPanel',
193 'accountTab':'accountPanel',
194 'dataTab':'dataPanel',
195 // 'contactsTab':'contactsPanel',
196 'toolsTab':'toolsPanel'},
197 selectedTab:'recordsTab'
198 }).setUp();
199
200 new Clipperz.PM.Components.Panels.MainPanel(YAHOO.ext.Element.get('recordsPanel'), {user:this.user()});
201 new Clipperz.PM.Components.Panels.AccountPanel(YAHOO.ext.Element.get('accountPanel'), {user:this.user()});
202 new Clipperz.PM.Components.Panels.DataPanel(YAHOO.ext.Element.get('dataPanel'), {user:this.user()});
203 // new Clipperz.PM.Components.Panels.ContactsPanel(YAHOO.ext.Element.get('contactsPanel'), {user:this.user()});
204 new Clipperz.PM.Components.Panels.ToolsPanel(YAHOO.ext.Element.get('toolsPanel'), {user:this.user()});
205
206 this.fixToDrawTheMainTabsCorrectlyOnSafari(); //fix to
207//MochiKit.Logging.logDebug("<<< Main.showMainPanels");
208 },
209
210 //-------------------------------------------------------------------------
211
212 'userConnectedCallback': function(anEvent) {
213//MochiKit.Logging.logDebug(">>> Main.userConnectedCallback");
214//MochiKit.Logging.logDebug(">>> doConnect - user: " + this.user());
215 this.setUser(anEvent.source());
216
217 if (this.isRunningCompact()) {
218 this.showCompactInterface();
219 } else {
220 this.showMainPanels();
221 }
222//MochiKit.Logging.logDebug("<<< Main.userConnectedCallback");
223 },
224
225 //-----------------------------------------------------------------------------
226
227 'user': function() {
228 return this._user;
229 },
230
231 'setUser': function(aValue) {
232 this._user = aValue;
233 },
234
235 //-----------------------------------------------------------------------------
236
237 'doLogoutEventHandler': function(anEvent) {
238 var deferred;
239
240 anEvent.stop();
241
242 deferred = new MochiKit.Async.Deferred();
243//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("Main.doLogoutEventHandler - 1: " + res); return res;});
244 deferred.addCallback(MochiKit.Base.method(this.user(), 'doLogout'));
245//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("Main.doLogoutEventHandler - 2: " + res); return res;});
246 deferred.addCallback(Clipperz.PM.exit, 'logout.html');
247//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("Main.doLogoutEventHandler - 3: " + res); return res;});
248 deferred.callback();
249 },
250
251 //-----------------------------------------------------------------------------
252
253 'doLockEventHandler': function(anEvent) {
254 vardeferredResult;
255 varlockDialogElement;
256 var lockDialog;
257 var unlockButton;
258
259 anEvent.stop();
260
261 Clipperz.NotificationCenter.notify(this, 'accountLocked', null, true);
262
263 lockDialogElement = Clipperz.YUI.DomHelper.append(document.body, {tag:'div', id:'lockDialog', children:[
264 {tag:'div', cls:'ydlg-hd', htmlString:Clipperz.PM.Strings['lockTitle']},
265 {tag:'div', cls:'ydlg-bd', children:[
266 {tag:'div', cls:'alert-message', id:'lockMessage', children:[
267 {tag:'div', htmlString:Clipperz.PM.Strings['lockDescription']},
268 {tag:'form', id:'lockDialogForm', children:[
269 {tag:'input', type:'password', id:'lockPassphrase'}
270 ]}
271 ]}
272 ]},
273 {tag:'div', cls:'ydlg-ft'}
274 ]}, true);
275 new Clipperz.PM.Components.PasswordEntropyDisplay(YAHOO.ext.Element.get('lockPassphrase'));
276
277 lockDialog = new YAHOO.ext.BasicDialog(
278 lockDialogElement, {
279 closable:false,
280 modal:true,
281 autoTabs:false,
282 resizable:false,
283 fixedcenter:true,
284 constraintoviewport:false,
285 width:350,
286 height:130,
287 shadow:true
288 }
289 );
290
291 unlockButton = lockDialog.addButton(Clipperz.PM.Strings['unlockButtonLabel'], MochiKit.Base.method(this, 'exitLock', lockDialog));
292//MochiKit.Logging.logDebug("--- Main.showAlertDialog - 5");
293 lockDialog.setDefaultButton(unlockButton);
294
295 MochiKit.Signal.connect('lockDialogForm', 'onsubmit', MochiKit.Base.method(this, 'exitLock', lockDialog));
296 lockDialog.on('show', function() {YAHOO.ext.Element.get('lockPassphrase').focus();});
297 lockDialog.show('main');
298 // this.user().lock();
299 },
300
301 'exitLock': function(aLockDialog, anEvent) {
302 // var deferredResult;
303
304//MochiKit.Logging.logDebug(">>> Exiting lock");
305 if (typeof(anEvent.stop) != 'undefined') {
306 anEvent.stop();
307 }
308
309 if (this.user().passphrase() == YAHOO.ext.Element.get('lockPassphrase').dom.value) {
310 aLockDialog.hide(MochiKit.Base.method(aLockDialog, 'destroy', true));
311 Clipperz.NotificationCenter.notify(this, 'accountUnlocked', null, true);
312 } else {
313 YAHOO.ext.Element.get('lockPassphrase').dom.value = "";
314 YAHOO.ext.Element.get('lockPassphrase').focus();
315 }
316
317 // deferredResult = new MochiKit.Async.Deferred();
318 // deferredResult.addCallback(MochiKit.Base.method(this.user(), 'unlockWithPassphrase'));
319 // deferredResult.addCallback(MochiKit.Base.method(aLockDialog, 'hide', MochiKit.Base.method(aLockDialog, 'destroy', true)));
320 // deferredResult.addCallback(MochiKit.Base.method(Clipperz.NotificationCenter, 'notify', this, 'accountUnlocked', null, true));
321 // deferredResult.addErrback(function() {
322 // YAHOO.ext.Element.get('lockPassphrase').dom.value = "";
323 // YAHOO.ext.Element.get('lockPassphrase').focus();
324 // });
325 // deferredResult.callback(YAHOO.ext.Element.get('lockPassphrase').dom.value);
326
327 return false;
328 },
329
330 //-----------------------------------------------------------------------------
331
332 'updateProgressDialogStatus': function(anEvent) {
333//MochiKit.Logging.logDebug(">>> main.updateProgressDialogStatus - " + anEvent.parameters());
334//try {
335 if (Clipperz.Base.objectType(anEvent.parameters()) == 'string') {
336 Clipperz.PM.Components.MessageBox().update(Clipperz.PM.Strings.messagePanelConfigurations[anEvent.parameters()]());
337 } else {
338 Clipperz.PM.Components.MessageBox().update(anEvent.parameters());
339 }
340//} catch (exception) {
341//console.log("updateProgressDialogStatus - anEvent", anEvent);
342 //MochiKit.Logging.logError("Main.updateProgressDialogStatus: " + exception);
343 //throw exception;
344//}
345//MochiKit.Logging.logDebug("<<< main.updateProgressDialogStatus");
346 },
347
348 //-----------------------------------------------------------------------------
349
350 'defaultErrorHandler': function(anErrorString, anException) {
351MochiKit.Logging.logDebug(">>> DEFAULT ERROR HANDLER: " + anErrorString + " (exception: " + Clipperz.Base.serializeJSON(anException) + ")");
352 },
353
354 //-----------------------------------------------------------------------------
355
356 'isRunningCompact': function() {
357 return this._isRunningCompact;
358 },
359
360 'setIsRunningCompact': function(aValue) {
361 this._isRunningCompact = aValue;
362 },
363
364 //-----------------------------------------------------------------------------
365
366 'reportException': function(anError) {
367/*
368 var deferredResult;
369
370 deferredResult = new MochiKit.Async.Deferred();
371
372 Clipperz.PM.Components.MessageBox().show(
373 {
374 title:Clipperz.PM.Strings['fatalErrorMessageTitle'],
375 text:Clipperz.PM.Strings['fatalErrorMessageText'],
376 width:240,
377 showProgressBar:false,
378 showCloseButton:false,
379 fn:MochiKit.Base.method(deferredResult, 'callback'),
380 scope:this,
381 buttons:{
382 'ok':Clipperz.PM.Strings['fatalErrorMessageCloseButtonLabel']
383 }
384 }
385 );
386
387 deferredResult.addCallback(function() {
388 window.document.body.innerHTML = "";
389 window.location.reload(true);
390 });
391*/
392 Clipperz.PM.exit('error.html');
393 },
394
395 //-----------------------------------------------------------------------------
396 __syntaxFix__: "syntax fix"
397
398});
399
400
401
402//#############################################################################
403
404MochiKit.Base.update(Clipperz.PM, {
405
406 __repr__: function() {
407 return "[" + this.NAME + " " + this.VERSION + "]";
408 },
409
410 toString: function() {
411 return this.__repr__();
412 },
413
414 //-----------------------------------------------------------------------------
415
416 'initPage': function() {
417 varmain;
418 var shouldShowRegistrationForm;
419 var useCompactDesign;
420
421//MochiKit.Logging.logWarning("Just testing logging system");
422 Clipperz.PM.Strings.Languages.initSetup();
423 // DWRUtil.useLoadingMessage(Clipperz.PM.Strings['DWRUtilLoadingMessage']);
424
425 if (window.location.search.indexOf("registration") != -1) {
426 shouldShowRegistrationForm = true;
427 } else {
428 shouldShowRegistrationForm = false;
429 }
430
431 if (window.location.search.indexOf("compact") != -1) {
432 useCompactDesign = true;
433 } else {
434 useCompactDesign = false;
435 }
436
437 main = new Clipperz.PM.Main();
438
439 if (useCompactDesign == true) {
440 main.runCompact();
441 } else {
442 if (Clipperz_IEisBroken === true) {
443 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) {
444 var logoParentNode;
445
446 YAHOO.ext.Element.get('donateHeaderIcon').remove();
447 logoParentNode = YAHOO.ext.Element.get('logo').dom.parentNode;
448 YAHOO.ext.Element.get('logo').remove();
449 Clipperz.YUI.DomHelper.append(logoParentNode, {tag:'span', children:[
450 {tag:'span', cls:'clipperzLogoSpan', html:'clipper'},
451 {tag:'span', cls:'clipperzLogoZSpan', html:'z'}
452 ]})
453 } else {
454 YAHOO.ext.Element.get('donateHeaderIcon').dom.src = "./images/smiles.gif";
455 YAHOO.ext.Element.get('logo').dom.src = "./images/logo.gif";
456 }
457 } else {
458 YAHOO.ext.Element.get('donateHeaderIcon').dom.src = "data:image/gif;charset=utf-8;base64,R0lGODlhEAAQAPf/ADMzZvrFL/KbGPrER3VXJeaJHvnGXNJ/KAEAAPnKefvJDamopMvLy8GZEfrTpvvgwGhVB0xKSO3BDUk+A/vYqnVgLcmndoRqM/exO3hrS3lmPYRsB39lDum9Dv3aCuebVPnIdP////3cCvewE07BafrQk/rHG1tYR5qZl7eUWZl7CfnGjdeuDPnCPpl4LDEoA5R2OP3XC/jBgfi2EvrXrvrRlWpYHgGtKdiqKPvfvu6nFzTNWfexFv7gCEc4GPrFDvaqFJmDB/euE/vYrJV5SfzUC7uTIuCxDf8AAPrHX519EbONGLubCvvYqzsxA/42AwaIGPzTC9u8CfTALlRUUomJiACWHaaMCsmeJFBFBZ5wUtaRVGlOVrySGLBvPNaBKsSGU9OOUbF7VPOycaRxUaFzWfGtaLZ6L+CaHcZ/Kt6YHVxJXfvXqaGhn0A8Z/i8c7JwM7d4MP6SBrJtM21MUDs4ZT84YmFhYaBnPqtyNM2QW6t2Va18XfvWsPvZsmVOXUQ7X86CJ1ZDWzo2Y6FoOfzSDBMPB/rTqW1OT0I5YEQ9ZnVTS1pEV9iCI7x+Ljw4ZvnJlqNnOfeyUfnMi/CkSfnKhAOmJ/WqU/ewJmVUO6qRB3ljHOGzFvauSfnFWveuI/esFK2JE5iVifrEEA+uJ/K+RayHMYVvTsyiE3NxbnBdQl5KG+cAAPnBIQYFA8GXN82hJbWXa6WDEQgGBFNBGMKeC4iFeZiiGdTZ1aqgd1dTPF9fX4R1BHReOOi9cdmsUn9xBKKFIWVPG5J0FLmzmcLCwtK5B6eQcnx5doZrFPnAH6eFP/fDL1RLBYVsQW5raMXGEFA5E+rLoUQEAG0kA8ONCteZId6wF86tCJ0AAGFQBurKn6mJHks/A2tZQOKfIHFua+29Wum1OOzv7LysCN3i3s/Rz/DDdeOyKCckHxQTEDsuEUIvEI1EBfP29KuIQbqUR9O7CbnCER8ZCSIeGDQJADQXAaCVaKeCGUNAPFRGMpmJS1xIF/rELPXARv///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQFZAD/ACwAAAAAEAAQAAAI+AABCASwhkyYDx+27PkzcGCdMmZWOOjT5xCkMXwUDXwERgaNHA9CPsjhZ4UeNwK1vHEwpAmFlxSaDGEjQwwAQZQq1aihKlaJEhYylagx6RIXPJ1AJEjgSsNSIrOWJpDk5QAGT0mSIKiQFQaCrAYwfCnwqUWpAatMDRjwitYAfy0wFSgwQhksZgHy6mWGpRWPAgdGjEKlxIThw7IajBrRKBIQBQpUaGMiQUItbSogA5nDSMCPIlGudHPiZEKQKEV+CKADgJCQQh5iy44dZQQcgXbSzCjSo7fvGDMCJRo4KA8oBTFEiIihQEgcQA0FIjqjRocONI4WNQwIACH5BAVkAP8ALAEABAANAAkAAAhaAP8J1GehhMASBgUqREAExLkUEFMoFOgDXpJwFzLCUChuwL8BHj8O8OeRRxd0ASbiwBKgn8AjHK5N5AQB1bUjAmt128BCIIssL3gqlALBiUAnGyRMFChiqcKAACH5BAVkAP8ALAEABAANAAoAAAhzAP8JrKEqlkALmQQq/JfAlYYECYjMSrDwXxIEFZIkgYEgicIWAleZEviK1gCBI/7BqhggwD8cS/4tEVWBg5JQoZRwsGEr2D8JuUKYa1OlCopiIYgdEchEVIinUBdcWahJFwoGDNqcCFLxnxRezbIAM6YwIAAh+QQFZAD/ACwCAAMADAAMAAAIeQD//ZN2TOC/bQUN/st06pRAhg4NOuvlS+DEigZ/LbsgUCNHgwSEuRAYcuS/JUam4FCIg5kRfF3anNqUbNiwZJs0oOCmYN8/d+VwmcM17t89Cf+kaCCxo+kOEhmwGYwHxYpVK1DIKYR2o2tXS/IU3rpBqiwpS7cEBgQAIfkEBWQA/wAsAgADAAwADAAACH4A//0b0kTgPwoFDf6roSqWQAuZSihM4EqDQCKzEihMgqCCQBgIkhgsNWCVKYGvaA3w908Zln8BFMbE0moUKiUmcuqU1WDUPwUqtDHp0KEatXYKFPwrUkRTN3v1pmV7UsSgBw8x5CBhxeqJwiI9wsp58kSOQlAKYlyNoWCEwIAAIfkEBWQA/wAsAQAEAA4ACwAACIwACURIhQxcBG8a8j1DlooKAXpUdt3ZFUGdoQgS71BJFw2Bx38IYLxDANIju2/C5hla5+LfP1M+DM3jZ+1fF1gBXOr8FwDHEpdLRFXgoCRUKCUcbNgK5lJCrhDm2lSpgqJYCGJHdDIRFaKr1wVXdv7TpAsFAwZtTgQR61IKr2ZZgBmLwVanCBEuhegMCAA7Cg==";
459 YAHOO.ext.Element.get('logo').dom.src = "data:image/gif;charset=utf-8;base64,R0lGODlhgwAoAPf/AP////+SAIKCmV1df3l5jYmhef//9vr6+YSQrJSguNfk60xMZjw8bf+PAI2Zsq6ulTU1ZZqasrzE05Gdtf//90pHW6d4KuPj6cLCz6ampzw3Ymt9nXp6Z21tif+MAHV1mPaOBJGRrPLy8dPT21Zhifb2+H19j/z8+MmOG3V/n729zcnJ1jU1aLmKIsnb5M3O2Xe5y3JyjHZqRD1xlElJd7KyuPSSBGFhhPn59kFBcKiovIaGov+KAP7+/sDA0HZ2mKqtwV5fh6y1yMTM2X19nXuCoTg5al1MUdTV4O3u8jU8bTMzZv+OAIt6Nfz8/G5ukldTVF5egv///nFxlJ2eeFFRfPX18cN/HpOTanV1lLOzp3l5m1dXesXF1O7u7MOPHj4+YaWltdXV1WJqj4ODdU1NeZWVZNaSFff39WFmjEtQfP+GAPSGBenq77q6ym1thP//+3l5kX5+kIOiubx8IpyCMf3//8nJ0eHh20JMedHRwVJSeba2yEJyPsaDHVhYffT+/llag4uNqcTE0T4+bvDw7dra4v7///n//6GhuGZojTw8a/r6+/z89OLy9ZWVr8mMG9ra1t/f5zo6ZUNEcjs7bPHx9dzc34iVsE5Od319mZ2dbUZJd2hoh4xsOf398mBhiP39/ZmZkmtrkKOmvK7B0T9Bb77H1evr2c2PGX2Ipn1YQT9RbOrq56bR3Y2NgLrV35mZZ+yOCqmptZiYmN/fx7OzxTY+YFJXgVFchdnZvsLE08jI0ztcTeCLEPuVAv2QAIqSrZietlJUbGpqYYWFWWdlSKKlepajukJvQMbI1kZhiURukj09ZlNUf5mwxOHhxFxchVtehoaOqoqKZv39+HF5mnR6m5OZsj8/bDQ0ZzQzZuzs6vr67MDAyUhIdGpqj+np0IqZstfY4o+btI6dtv2NAPf353ibtGJcTtWJEDJIdrPD0u/9/ufo7ZWiuZWjulVVdeLi6Nvb5N3d4oiIcIyMecLC0XWAoGVlfpCQmGCctXR3mXh4W2lukv///yH5BAEAAP8ALAAAAACDACgAAAj/AP8JHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmTKFOqXMmyZcktLwZ1wRBF4I+YM2+43IlRWI8eAKrFEIgNANBqcXgqpfgOgFMDBAROcAqAgpylWCEmoApVIDyqVrOKZbj1adR/RbqoHdRprFuEZQF0fes2yIcfH55QOhh37sMcU378eMLAIaEngp8QYhjt7gdFRh5W+fCBVUcWIVaUoCplnopoBfueLbKiNK8OAkmXngVhzjjOSIQtKnit9Ioa/9Ah4TwuUbaDLAQp20z1RYTIBP3Z9sbClBB3Tgs0gYSiuvXrKCCla6jmBdXvTp1Q/yEoWiAysCakOpXS5hQi8E51LSCIab0lCe/h15pPMI8r+OuNkAlBRVAlAi4ufEcFJGt44OCDEHqwhgwM0aBAD4cASNUrA5X3z1ROUZDePw5oCN8IhQmEwHeHZAigITkMtM4FJgIgRSR7CZQCVSW0YYeLACzYIIRMBGCkkR5QuBAQ35XABxHiwPJdEvEI5CGIVY1Y4nehuLHDIyOAJ8BAK4Knwg4heMfZDgMJ8Z0kiXyQCHRO9RDGQDtqeMgxTXzhp58tnNHAkQFMuBAngFDVyJgCKXHKd8VYydVZWIoo0JZOhaLJQEbA8F0kZH7XA5sCsQADUE7hIdAyB6CqxzdLxP+qhgJUWZFinpxh8MEoHwxzUAvmHOlBKhUoxEk5VMHxQEEzcPaIpGapF6KWVPWwLEFKtFGrTv+UaaMWBWlDo1M4tLXPeiIsEOu6G9hRZz06fgfHnQktYUGwSJ4BxkK5lEJVKFVi+8QUU3xQBbRyUYrepf9yYBApLkpBhorVOlyQMJzZo80QVBWywxZEhLwFOe5+Gy9VYsyWkCfAAGNkA74Uu1AaElDVzb5kTSptlgw7xc0eBinCmRkUO2XFHwYF8V0sRjhSo6hunOzUMQrJMOiRNhzRECg+UIUKzgtduTCJVF2QI0FCU0V0t1S1QYNBoHy3CQu0Pk2VClJLIUpCxoD/cHUAHqziEM1UnQO2QmJP2zMAPxuUxndreysCFwZJI3fTVJ3Aiwo+dO655/pIfQBqB/Viw98NePIQCexkzt9AlAChwuykJs4z2eQOVZC3AFBTNAAnJFWQKt9hoQ0SLuJRSUO4jn7QEWwQ6kEdEKnxDJARFDRGok7t/Y/tluLu1CwF0U0VI7rzjhtBLCQYXlJzKFpTQSCHPH/zpBNUgTrSUw+REYFAFQBEQIyBMIBjVOkHwuZSKWpRBQdZIMgjnEAVaEzidwA4wKYGIghGUCUcF2wWVXiRon9oAwE/AgAczoK/gtzCDx44UgMsAIGCbKMh/qLKJ0LwASIYgjOXSBH4/xz4Lx1QRgXgoUWo5AUEyvCBSxkYCAKdIo8dUGYXJQOAHvBEFecRpA88IFQA/ECHK5jxjHSQWULyIImnweENHdLZh8aGqaeJoYS8q9ElYiQQErTjaZ/IBxed4sWBgFGMf5PhL6DAEGeMI4vgScIWCNKUaH0PLFcRHxruoCF6IG2JAMDBHQT4HXnMbyDMkIeJLDGxgeBjPaHIn0AOKcZaBsAGjGQIJQThjlaFpwQ6+ORAglGCYlqBdNMoZgmsoDtMteIbH7iABwHgBGC+jSDeKkQZniCJaYaiBEAow0Fo8Igk+JKaViBFIApiDWWKoC0ESQYbQEDPetqznrLIZUOMQIEDcExhC9EoIfsYQFAGsKBUBTXo4gpBOSM4IzBBWIxBJDeAfxihCoEBBR8TUokyjKJggWgGcBJ6UIJAQAMoTalKV1pDlmDKC5RrCEXpwpOXxpQhM6WpS2zqkJzqlCVYOppD6kOuU/5UJfwYxOxs8Q2HTOEes+ODOI9K1apa9aoLCQgAOwo=";
460 }
461
462 main.run(shouldShowRegistrationForm);
463 }
464
465 Clipperz.PM.defaultErrorHandler = main.defaultErrorHandler;
466
467 //DEBUG
468 if ((typeof(_clipperz_pm_test_user) != 'undefined') && (typeof(_clipperz_pm_test_passphrase) != 'undefined')) {
469 //------- automatic login with test/test --------------
470 // Clipperz.PM.Proxy.defaultProxy = new Clipperz.PM.Proxy.Offline();
471//MochiKit.Logging.logWarning("activating AUTOLOGIN (" + _clipperz_pm_test_user + "/" + _clipperz_pm_test_passphrase + ")");
472 // MochiKit.Async.callLater(0.9, MochiKit.Base.bind(main.doLogin, main), _clipperz_pm_test_user, _clipperz_pm_test_passphrase, YAHOO.ext.Element.get('Clipperz_PM_Components_Panels_login_submit_9'));
473 MochiKit.Async.callLater(0.5, MochiKit.Base.bind(main.loginPanel().doLoginWithUsernameAndPassphrase, main.loginPanel()), _clipperz_pm_test_user, _clipperz_pm_test_passphrase);
474 //------- automatic registration --------------
475//MochiKit.Logging.logWarning("Testing registration (user,passwd)");
476//MochiKit.Logging.logDebug("mainPanel: " + main.mainPage().mainPanel().content());
477 // main.mainPage().getActivePanel().showRegistrationFormAnimator().play();
478 // MochiKit.Async.callLater(1.9, MochiKit.Base.bind(main.doRegistration, main), 'user', 'passwd');
479//-------------------------------------
480 // main.showMainPanels('ok');
481 };
482
483 if (/fastEntropyAccumulationForTestingPurpose/.test(window.location.search)) {
484 Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose();
485 }
486
487 // Clipperz.PM.Proxy.defaultProxy.knock();
488 },
489
490 //-------------------------------------------------------------------------
491
492 'showDonationSplashScreen': function(aUser, aFocusElementId) {
493 var deferredResult;
494 var donateElement;
495 vardonateDialog;
496 var closeButton;
497 var closeFunction;
498 var donateButton;
499 var donateFunction;
500
501 deferredResult = new MochiKit.Async.Deferred();
502
503//MochiKit.Logging.logDebug(">>> Main.showRegistrationSplashScreen");
504 donateElement = Clipperz.YUI.DomHelper.append(document.body, {tag:'div', id:'donateSplash', children:[
505 {tag:'div', cls:'ydlg-hd', htmlString:Clipperz.PM.Strings['donateSplashPanelTitle']},
506 {tag:'div', cls:'ydlg-bd', children:[
507 {tag:'div', cls:'alert-message', id:'donateMessage', children:[
508 {tag:'div', cls:'donateSplashPanelIcon', children:[
509 {tag:'img', src:Clipperz.PM.Strings['donateSplashPanelIconUrl']}
510 ]},
511 {tag:'div', cls:'donateSplashPanelDescription', htmlString:Clipperz.PM.Strings['donateSplashPanelDescription']}
512 ]}
513 ]},
514 {tag:'div', cls:'ydlg-ft'}
515 ]}, true);
516
517 donateDialog = new YAHOO.ext.BasicDialog(
518 donateElement, {
519 closable:false,
520 modal:true,
521 autoTabs:false,
522 resizable:false,
523 fixedcenter:true,
524 constraintoviewport:false,
525 width:450,
526 height:220,
527 shadow:true,
528 minWidth:300,
529 minHeight:300
530 }
531 );
532
533 closeFunction = MochiKit.Base.partial(deferredResult.callback, false);
534 donateFunction = MochiKit.Base.partial(deferredResult.callback, true);
535 donateButton = donateDialog.addButton(Clipperz.PM.Strings['donateDonateButtonLabel'], donateFunction, deferredResult);
536
537 donateDialog.addKeyListener(27, closeFunction, deferredResult);
538 closeButton = donateDialog.addButton(Clipperz.PM.Strings['donateCloseButtonLabel'], closeFunction, deferredResult);
539
540 donateDialog.setDefaultButton(donateButton);
541 donateDialog.show(aFocusElementId /*'recordListAddRecordButton'*/);
542
543 deferredResult.addCallback(MochiKit.Base.bind(function(shouldOpenDonatePage) {
544 var result;
545
546 if (shouldOpenDonatePage) {
547 window.open(Clipperz.PM.Strings['donateHeaderLinkUrl'], "donate");
548 aUser.preferences().setShouldShowDonationPanel(false);
549 aUser.preferences().saveChanges();
550 }
551 }, this));
552 deferredResult.addBoth(MochiKit.Base.method(donateDialog, 'hide'));
553 deferredResult.addBoth(MochiKit.Base.method(donateElement, 'remove'));
554//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Main.showDonationSplashScreen - 2: " + res); return res;});
555//MochiKit.Logging.logDebug("<<< Main.showRegistrationSplashScreen");
556
557 return deferredResult;
558 },
559
560 //-----------------------------------------------------------------------------
561
562 'exit': function(aPageName) {
563 // alert("ERROR: " + aPageName);
564
565 // YAHOO.ext.Element.get('menus').update("");
566 // YAHOO.ext.Element.get('logoutLI').update("");
567 // YAHOO.ext.Element.get('lockLI').update("");
568 // YAHOO.ext.Element.get('main').update("");
569 // Clipperz.YUI.DomHelper.append('main', {tag:'div', id:'exitBlock', children:Clipperz.PM.Strings['exitConfig']});
570
571 MochiKit.Async.wait(0).addCallback(function() {
572 // window.location.href = "http://www.google.com/search?hl=" + Clipperz.PM.Strings.preferredLanguage + "&q=phishing&btnI=Google+Search";
573 window.location.href = "./" + aPageName;
574 });
575 },
576
577 //-----------------------------------------------------------------------------
578 __syntaxFix__: "syntax fix"
579
580});
581
582//#############################################################################
583
584//Clipperz.PM.SerializeAsyncCalls = function(aDelay, aFunction) {
585 //aFunction.apply(extend(null, arguments, 1));
586//};
587
588MochiKit.DOM.addLoadEvent(Clipperz.PM.initPage);
diff --git a/frontend/beta/js/Clipperz/PM/Proxy.js b/frontend/beta/js/Clipperz/PM/Proxy.js
new file mode 100644
index 0000000..d05a5e0
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Proxy.js
@@ -0,0 +1,173 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31
32//=============================================================================
33
34Clipperz.PM.Proxy = function(args) {
35 args = args || {};
36
37 this._shouldPayTolls = args.shouldPayTolls || false;
38
39 this._tolls = {
40 'CONNECT':[],
41 'REGISTER':[],
42 'MESSAGE':[]
43 };
44
45 if (args.isDefault === true) {
46 Clipperz.PM.Proxy.defaultProxy = this;
47 }
48
49 return this;
50}
51
52Clipperz.PM.Proxy.prototype = MochiKit.Base.update(null, {
53
54 'toString': function() {
55 return "Clipperz.PM.Proxy";
56 },
57
58 //=========================================================================
59
60 'shouldPayTolls': function() {
61 return this._shouldPayTolls;
62 },
63
64 //-------------------------------------------------------------------------
65
66 'tolls': function() {
67 return this._tolls;
68 },
69
70 //-------------------------------------------------------------------------
71
72 'payToll': function(aRequestType, someParameters) {
73 vardeferredResult;
74
75//console.log(">>> Proxy.payToll", aRequestType, someParameters);
76 if (this.shouldPayTolls()) {
77 deferredResult = new MochiKit.Async.Deferred();
78
79 if (this.tolls()[aRequestType].length == 0) {
80 deferredResult.addCallback(MochiKit.Base.method(this, 'sendMessage', 'knock', {requestType:aRequestType}));
81 deferredResult.addCallback(MochiKit.Base.method(this, 'setTollCallback'));
82 }
83 deferredResult.addCallback(MochiKit.Base.method(this.tolls()[aRequestType], 'pop'));
84 deferredResult.addCallback(MochiKit.Base.methodcaller('deferredPay'));
85 deferredResult.addCallback(function(aToll) {
86 var result;
87
88 result = {
89 parameters: someParameters,
90 toll: aToll
91 }
92
93 return result;
94 });
95
96 deferredResult.callback();
97 } else {
98 deferredResult = MochiKit.Async.succeed({parameters:someParameters});
99 }
100//console.log("<<< Proxy.payToll");
101
102 return deferredResult;
103 },
104
105 //-------------------------------------------------------------------------
106
107 'addToll': function(aToll) {
108//console.log(">>> Proxy.addToll", aToll);
109 this.tolls()[aToll.requestType()].push(aToll);
110//console.log("<<< Proxy.addToll");
111 },
112
113 //=========================================================================
114
115 'setTollCallback': function(someParameters) {
116//console.log(">>> Proxy.setTollCallback", someParameters);
117 if (typeof(someParameters['toll']) != 'undefined') {
118//console.log("added a new toll", someParameters['toll']);
119 this.addToll(new Clipperz.PM.Toll(someParameters['toll']));
120 }
121//console.log("<<< Proxy.setTallCallback", someParameters['result']);
122 //return someParameters['result'];
123 return someParameters;
124 },
125
126 //=========================================================================
127
128 'registration': function (someParameters) {
129 return this.processMessage('registration', someParameters, 'REGISTER');
130 },
131
132 'handshake': function (someParameters) {
133 return this.processMessage('handshake', someParameters, 'CONNECT');
134 },
135
136 'message': function (someParameters) {
137 return this.processMessage('message', someParameters, 'MESSAGE');
138 },
139
140 'logout': function (someParameters) {
141 return this.processMessage('logout', someParameters, 'MESSAGE');
142 },
143
144 //=========================================================================
145
146 'processMessage': function (aFunctionName, someParameters, aRequestType) {
147 vardeferredResult;
148
149 deferredResult = new MochiKit.Async.Deferred();
150 deferredResult.addCallback(MochiKit.Base.method(this, 'payToll', aRequestType));
151 deferredResult.addCallback(MochiKit.Base.method(this, 'sendMessage', aFunctionName));
152 deferredResult.addCallback(MochiKit.Base.method(this, 'setTollCallback'));
153 deferredResult.callback(someParameters);
154
155 return deferredResult;
156 },
157
158 //=========================================================================
159
160 'sendMessage': function () {
161 throw Clipperz.Base.exception.AbstractMethod;
162 },
163
164 //=========================================================================
165
166 'isReadOnly': function () {
167 return false;
168 },
169
170 //=========================================================================
171 __syntaxFix__: "syntax fix"
172
173});
diff --git a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.JSON.js b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.JSON.js
new file mode 100755
index 0000000..889e1f1
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.JSON.js
@@ -0,0 +1,100 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31
32//=============================================================================
33
34Clipperz.PM.Proxy.JSON = function(args) {
35 Clipperz.PM.Proxy.JSON.superclass.constructor.call(this, args);
36
37 this._url = args.url || Clipperz.Base.exception.raise('MandatoryParameter');
38
39 return this;
40}
41
42YAHOO.extendX(Clipperz.PM.Proxy.JSON, Clipperz.PM.Proxy, {
43
44 'toString': function() {
45 return "Clipperz.PM.Proxy.JSON";
46 },
47
48 //=========================================================================
49
50 'url': function () {
51 return this._url;
52 },
53
54 //=========================================================================
55
56 'sendMessage': function(aFunctionName, someParameters) {
57 vardeferredResult;
58 var parameters;
59
60 parameters = {
61 method: aFunctionName,
62 // version: someParameters['version'],
63 // message: someParameters['message'],
64 parameters: Clipperz.Base.serializeJSON(someParameters)
65 };
66
67 deferredResult = new MochiKit.Async.Deferred();
68 deferredResult.addCallback(function (aValue) {
69 MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'remoteRequestSent');
70 return aValue;
71 });
72 deferredResult.addCallback(MochiKit.Async.doXHR, this.url(), {
73 method:'POST',
74 sendContent:MochiKit.Base.queryString(parameters),
75 headers:{"Content-Type":"application/x-www-form-urlencoded"}
76 });
77 deferredResult.addCallback(function (aValue) {
78 MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'remoteRequestReceived');
79 return aValue;
80 });
81 // deferredResult.addCallback(MochiKit.Async.evalJSONRequest);
82 deferredResult.addCallback(MochiKit.Base.itemgetter('responseText'));
83 deferredResult.addCallback(Clipperz.Base.evalJSON);
84 deferredResult.addCallback(function (someValues) {
85 if (someValues['result'] == 'EXCEPTION') {
86 throw someValues['message'];
87 }
88
89 return someValues;
90 })
91 // return MochiKit.Base.evalJSON(req.responseText);
92 deferredResult.callback();
93
94 return deferredResult;
95 },
96
97 //=========================================================================
98 __syntaxFix__: "syntax fix"
99
100});
diff --git a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js
new file mode 100644
index 0000000..4d3ba08
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js
@@ -0,0 +1,804 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29try { if (typeof(Clipperz.PM.Proxy.Offline) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.PM.Proxy.Offline.DataStore depends on Clipperz.PM.Proxy.Offline!";
31}
32
33//=============================================================================
34
35Clipperz.PM.Proxy.Offline.DataStore = function(args) {
36 args = args || {};
37
38 this._data = args.data || (typeof(_clipperz_dump_data_) != 'undefined' ? _clipperz_dump_data_ : null);
39 this._isReadOnly = (typeof(args.readOnly) == 'undefined' ? true : args.readOnly);
40 this._shouldPayTolls = args.shouldPayTolls || false;
41
42 this._tolls = {};
43 this._connections = {};
44
45 this._b = null;
46 this._B = null;
47 this._A = null;
48 this._userData = null;
49
50 return this;
51}
52
53//Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, {
54Clipperz.PM.Proxy.Offline.DataStore.prototype = MochiKit.Base.update(null, {
55
56 //-------------------------------------------------------------------------
57
58 'isReadOnly': function () {
59 return this._isReadOnly;
60 },
61
62 //-------------------------------------------------------------------------
63
64 'shouldPayTolls': function() {
65 return this._shouldPayTolls;
66 },
67
68 //-------------------------------------------------------------------------
69
70 'data': function () {
71 return this._data;
72 },
73
74 //-------------------------------------------------------------------------
75
76 'tolls': function () {
77 return this._tolls;
78 },
79
80 //-------------------------------------------------------------------------
81
82 'connections': function () {
83 return this._connections;
84 },
85
86 //=========================================================================
87
88 'resetData': function() {
89 this._data = {
90 'users': {
91 'catchAllUser': {
92 __masterkey_test_value__: 'masterkey',
93 s: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00',
94 v: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00'
95 }
96 }
97 };
98 },
99
100 //-------------------------------------------------------------------------
101
102 'setupWithEncryptedData': function(someData) {
103 this._data = Clipperz.Base.deepClone(someData);
104 },
105
106 //-------------------------------------------------------------------------
107
108 'setupWithData': function(someData) {
109 var deferredResult;
110 var resultData;
111 var i, c;
112
113//Clipperz.log(">>> Proxy.Test.setupWithData");
114 resultData = this._data;
115
116 deferredResult = new MochiKit.Async.Deferred();
117 c = someData['users'].length;
118
119 for (i=0; i<c; i++) {
120 varnewConnection;
121 varrecordConfiguration;
122
123 deferredResult.addCallback(MochiKit.Base.method(this, 'userSerializedEncryptedData', someData['users'][i]));
124 deferredResult.addCallback(MochiKit.Base.bind(function(aUserSerializationContext) {
125//console.log("SERIALIZED USER", aUserSerializationContext);
126 resultData['users'][aUserSerializationContext['credentials']['C']] = {
127 's': aUserSerializationContext['credentials']['s'],
128 'v': aUserSerializationContext['credentials']['v'],
129 'version': aUserSerializationContext['data']['connectionVersion'],
130 'userDetails': aUserSerializationContext['encryptedData']['user']['header'],
131 'userDetailsVersion':aUserSerializationContext['encryptedData']['user']['version'],
132 'statistics': aUserSerializationContext['encryptedData']['user']['statistics'],
133 'lock': aUserSerializationContext['encryptedData']['user']['lock'],
134 'records': this.rearrangeRecordsData(aUserSerializationContext['encryptedData']['records'])
135 }
136 }, this));
137 }
138
139 deferredResult.addCallback(MochiKit.Base.bind(function() {
140//console.log("this._data", resultData);
141 this._data = resultData;
142 }, this));
143
144 deferredResult.callback();
145//Clipperz.log("<<< Proxy.Test.setupWithData");
146
147 return deferredResult;
148 },
149
150 //=========================================================================
151
152 'b': function() {
153 return this._b;
154 },
155
156 'set_b': function(aValue) {
157 this._b = aValue;
158 },
159
160 //-------------------------------------------------------------------------
161
162 'B': function() {
163 return this._B;
164 },
165
166 'set_B': function(aValue) {
167 this._B = aValue;
168 },
169
170 //-------------------------------------------------------------------------
171
172 'A': function() {
173 return this._A;
174 },
175
176 'set_A': function(aValue) {
177 this._A = aValue;
178 },
179
180 //-------------------------------------------------------------------------
181
182 'userData': function() {
183 return this._userData;
184 },
185
186 'setUserData': function(aValue) {
187 this._userData = aValue;
188 },
189
190 //=========================================================================
191
192 'getTollForRequestType': function (aRequestType) {
193 varresult;
194 vartargetValue;
195 var cost;
196
197 targetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2);
198 switch (aRequestType) {
199 case 'REGISTER':
200 cost = 5;
201 break;
202 case 'CONNECT':
203 cost = 5;
204 break;
205 case 'MESSAGE':
206 cost = 2;
207 break;
208 }
209
210 result = {
211 requestType: aRequestType,
212 targetValue: targetValue,
213 cost: cost
214 }
215
216 if (this.shouldPayTolls()) {
217 this.tolls()[targetValue] = result;
218 }
219
220 return result;
221 },
222
223 //-------------------------------------------------------------------------
224
225 'checkToll': function (aFunctionName, someParameters) {
226 if (this.shouldPayTolls()) {
227 var localToll;
228 vartollParameters;
229
230 tollParameters = someParameters['toll'];
231 localToll = this.tolls()[tollParameters['targetValue']];
232
233 if (localToll != null) {
234 if (! Clipperz.PM.Toll.validate(tollParameters['targetValue'], tollParameters['toll'], localToll['cost'])) {
235 throw "Toll value too low.";
236 };
237 } else {
238 throw "Missing toll";
239 }
240 }
241 },
242
243 //=========================================================================
244
245 'processMessage': function(aFunctionName, someParameters) {
246 var result;
247
248 switch(aFunctionName) {
249 case 'knock':
250 result = this._knock(someParameters);
251 break;
252 case 'registration':
253 this.checkToll(aFunctionName, someParameters);
254 result = this._registration(someParameters.parameters);
255 break;
256 case 'handshake':
257 this.checkToll(aFunctionName, someParameters);
258 result = this._handshake(someParameters.parameters);
259 break;
260 case 'message':
261 this.checkToll(aFunctionName, someParameters);
262 result = this._message(someParameters.parameters);
263 break;
264 case 'logout':
265 result = this._logout(someParameters.parameters);
266 break;
267 }
268
269 return result;
270 },
271
272 //=========================================================================
273
274 '_knock': function(someParameters) {
275 var result;
276
277 result = {
278 toll: this.getTollForRequestType(someParameters['requestType'])
279 // toll: {
280 // requestType: someParameters['requestType'],
281 // targetValue: "3a1ba0be23580f902885c6c8a6b035e228ed1ca74d77de5f9bb0e0c899f07cfe",
282 // cost:
283 // }
284 }
285
286 return result;
287 },
288
289 //-------------------------------------------------------------------------
290
291 '_registration': function(someParameters) {
292//console.log("_registration", someParameters);
293 if (this.isReadOnly() == false) {
294 if (typeof(this.data()['users'][someParameters['credentials']['C']]) == 'undefined') {
295 this.data()['users'][someParameters['credentials']['C']] = {
296 's': someParameters['credentials']['s'],
297 'v': someParameters['credentials']['v'],
298 'version':someParameters['credentials']['version'],
299 // 'lock': someParameters['user']['lock'],
300 'lock': Clipperz.Crypto.Base.generateRandomSeed(),
301 // 'maxNumberOfRecords':'100',
302 'userDetails': someParameters['user']['header'],
303 'statistics': someParameters['user']['statistics'],
304 'userDetailsVersion':someParameters['user']['version'],
305 'records':{}
306 }
307 } else {
308 throw "user already exists";
309 }
310 } else {
311 throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly;
312 }
313
314 result = {
315 result: {
316 'lock': this.data()['users'][someParameters['credentials']['C']]['lock'],
317 'result':'done'
318 },
319 toll: this.getTollForRequestType('CONNECT')
320 }
321
322 return MochiKit.Async.succeed(result);
323 },
324
325 //-------------------------------------------------------------------------
326
327 '_handshake': function(someParameters) {
328 var result;
329 varnextTollRequestType;
330
331//Clipperz.log(">>> Proxy.Offline.DataStore._handshake");
332 result = {};
333 if (someParameters.message == "connect") {
334 var userData;
335 var randomBytes;
336 var b, B, v;
337
338//console.log(">>> Proxy.Offline.DataStore._handshake.connect", someParameters);
339 userData = this.data()['users'][someParameters.parameters.C];
340
341 if ((typeof(userData) != 'undefined') && (userData['version'] == someParameters.version)) {
342 this.setUserData(userData);
343 } else {
344 this.setUserData(this.data()['users']['catchAllUser']);
345 }
346
347 randomBytes = Clipperz.Crypto.Base.generateRandomSeed();
348 this.set_b(new Clipperz.Crypto.BigInt(randomBytes, 16));
349 v = new Clipperz.Crypto.BigInt(this.userData()['v'], 16);
350 this.set_B(v.add(Clipperz.Crypto.SRP.g().powerModule(this.b(), Clipperz.Crypto.SRP.n())));
351
352 this.set_A(someParameters.parameters.A);
353
354 result['s'] = this.userData()['s'];
355 result['B'] = this.B().asString(16);
356
357 nextTollRequestType = 'CONNECT';
358 } else if (someParameters.message == "credentialCheck") {
359 var v, u, S, A, K, M1;
360
361//console.log(">>> Proxy.Offline.DataStore._handshake.credentialCheck", someParameters);
362 v = new Clipperz.Crypto.BigInt(this.userData()['v'], 16);
363 u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(this.B().asString(10))).toHexString(), 16);
364 A = new Clipperz.Crypto.BigInt(this.A(), 16);
365 S = (A.multiply(v.powerModule(u, Clipperz.Crypto.SRP.n()))).powerModule(this.b(), Clipperz.Crypto.SRP.n());
366
367 K = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(S.asString(10))).toHexString().slice(2);
368
369 M1 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + this.B().asString(10) + K)).toHexString().slice(2);
370 if (someParameters.parameters.M1 == M1) {
371 var M2;
372
373 M2 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + someParameters.parameters.M1 + K)).toHexString().slice(2);
374 result['M2'] = M2;
375 } else {
376 throw new Error("Client checksum verification failed! Expected <" + M1 + ">, received <" + someParameters.parameters.M1 + ">.", "Error");
377 }
378
379 nextTollRequestType = 'MESSAGE';
380 } else if (someParameters.message == "oneTimePassword") {
381 var otpData;
382
383//console.log("HANDSHAKE WITH OTP", someParameters.parameters.oneTimePasswordKey);
384//console.log("someParameters", someParameters);
385//console.log("data.OTP", Clipperz.Base.serializeJSON(this.data()['onetimePasswords']));
386 otpData = this.data()['onetimePasswords'][someParameters.parameters.oneTimePasswordKey];
387
388 try {
389 if (typeof(otpData) != 'undefined') {
390 if (otpData['status'] == 'ACTIVE') {
391 if (otpData['key_checksum'] == someParameters.parameters.oneTimePasswordKeyChecksum) {
392 result = {
393 'data': otpData['data'],
394 'version':otpData['version']
395 }
396
397 otpData['status'] = 'REQUESTED';
398 } else {
399 otpData['status'] = 'DISABLED';
400 throw "The requested One Time Password has been disabled, due to a wrong keyChecksum";
401 }
402 } else {
403 throw "The requested One Time Password was not active";
404 }
405 } else {
406 throw "The requested One Time Password has not been found"
407 }
408 } catch (exception) {
409 result = {
410 'data': Clipperz.PM.Crypto.randomKey(),
411 'version':Clipperz.PM.Connection.communicationProtocol.currentVersion
412 }
413 }
414 nextTollRequestType = 'CONNECT';
415 } else {
416 MochiKit.Logging.logError("Clipperz.PM.Proxy.Test.handshake - unhandled message: " + someParameters.message);
417 }
418//console.log("<<< Proxy.Offline._handshake", result);
419
420 result = {
421 result: result,
422 toll: this.getTollForRequestType(nextTollRequestType)
423 }
424
425 return MochiKit.Async.succeed(result);
426 },
427
428 //-------------------------------------------------------------------------
429
430 '_message': function(someParameters) {
431 var result;
432
433 result = {};
434
435 //=====================================================================
436 //
437 // R E A D - O N L Y M e t h o d s
438 //
439 //=====================================================================
440 if (someParameters.message == 'getUserDetails') {
441 var recordsStats;
442 var recordReference;
443
444 //try {
445 recordsStats = {};
446 for (recordReference in this.userData()['records']) {
447 recordsStats[recordReference] = {
448 'updateDate': this.userData()['records'][recordReference]['updateDate']
449 }
450 }
451
452 result['header'] = this.userDetails();
453 result['statistics'] = this.statistics();
454 result['maxNumberOfRecords'] = this.userData()['maxNumberOfRecords'];
455 result['version'] = this.userData()['userDetailsVersion'];
456 result['recordsStats'] = recordsStats;
457
458 if (this.isReadOnly() == false) {
459 varlock;
460
461 if (typeof(this.userData()['lock']) == 'undefined') {
462 this.userData()['lock'] = "<<LOCK>>";
463 }
464
465 result['lock'] = this.userData()['lock'];
466 }
467//} catch (exception) {
468 //console.log("*#*#*#*#*#*#*", exception);
469 //throw exception;
470//}
471 //=====================================================================
472 } else if (someParameters.message == 'getRecordDetail') {
473 recordData = this.userData()['records'][someParameters['parameters']['reference']];
474
475 result['reference'] = someParameters['parameters']['reference'];
476 result['data'] = recordData['data'];
477 result['version'] = recordData['version'];
478 result['creationData'] = recordData['creationDate'];
479 result['updateDate'] = recordData['updateDate'];
480 result['accessDate'] = recordData['accessDate'];
481
482 currentVersionData = recordData['versions'][recordData['currentVersion']];
483
484 result['currentVersion'] = {};
485 result['currentVersion']['reference'] = recordData['currentVersion'];
486 result['currentVersion']['version'] = currentVersionData['version'];
487 result['currentVersion']['header'] = currentVersionData['header'];
488 result['currentVersion']['data'] = currentVersionData['data'];
489 result['currentVersion']['creationData'] = currentVersionData['creationDate'];
490 result['currentVersion']['updateDate'] = currentVersionData['updateDate'];
491 result['currentVersion']['accessDate'] = currentVersionData['accessDate'];
492 if (typeof(currentVersionData['previousVersion']) != 'undefined') {
493 result['currentVersion']['previousVersionKey'] = currentVersionData['previousVersionKey'];
494 result['currentVersion']['previousVersion'] = currentVersionData['previousVersion'];
495 }
496
497 //=====================================================================
498 //
499 // R E A D - W R I T E M e t h o d s
500 //
501 //=====================================================================
502 } else if (someParameters.message == 'upgradeUserCredentials') {
503 if (this.isReadOnly() == false) {
504 var parameters;
505 parameters = someParameters.parameters;
506
507 if (parameters['C'] == null) {
508 result = Clipperz.PM.DataModel.User.exception.CredentialUpgradeFailed;
509 } else if (parameters['s'] == null) {
510 result = Clipperz.PM.DataModel.User.exception.CredentialUpgradeFailed;
511 } else if (parameters['v'] == null) {
512 result = Clipperz.PM.DataModel.User.exception.CredentialUpgradeFailed;
513 } else if (parameters['version'] != Clipperz.PM.Connection.communicationProtocol.currentVersion) {
514 result = Clipperz.PM.DataModel.User.exception.CredentialUpgradeFailed;
515 } else {
516 result = {result:"done", parameters:parameters};
517 }
518 } else {
519 throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly;
520 }
521 //=====================================================================
522 /* } else if (someParameters.message == 'updateData') {
523 if (this.isReadOnly() == false) {
524 var i, c;
525
526//console.log("###===============================================================");
527//console.log("###>>>", Clipperz.Base.serializeJSON(someParameters));
528//console.log("###--- userData", Clipperz.Base.serializeJSON(this.userData()));
529 if (this.userData()['lock']!= someParameters['parameters']['user']['lock']) {
530 throw "the lock attribute is not processed correctly"
531 }
532
533 this.userData()['userDetails'] = someParameters['parameters']['user']['header'];
534 this.userData()['statistics'] = someParameters['parameters']['user']['statistics'];
535 this.userData()['userDetailsVersions']= someParameters['parameters']['user']['version'];
536
537 c = someParameters['parameters']['records'].length;
538 for (i=0; i<c; i++) {
539 var currentRecord;
540 var currentRecordData;
541
542 currentRecordData = someParameters['parameters']['records'][i];
543 currentRecord = this.userData()['records'][currentRecordData['record']['reference']];
544
545 if (currentRecord == null) {
546 }
547
548 currentRecord['data'] = currentRecordData['record']['data'];
549 currentRecord['version'] = currentRecordData['record']['version'];
550 currentRecord['currentVersion'] = currentRecordData['currentRecordVersion']['reference'];
551
552 currentRecord['versions'][currentRecordData['currentRecordVersion']['reference']] = {
553 'data': currentRecordData['currentRecordVersion']['data'],
554 'version': currentRecordData['currentRecordVersion']['version'],
555 'previousVersion': currentRecordData['currentRecordVersion']['previousVersion'],
556 'previousVersionKey':currentRecordData['currentRecordVersion']['previousVersionKey']
557 }
558 }
559
560 this.userData()['lock'] = Clipperz.PM.Crypto.randomKey();
561 result['lock'] = this.userData()['lock'];
562 result['result'] = 'done';
563//console.log("###<<< userData", Clipperz.Base.serializeJSON(this.userData()));
564 } else {
565 throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly;
566 }
567 */ //=====================================================================
568 } else if (someParameters.message == 'saveChanges') {
569 if (this.isReadOnly() == false) {
570 var i, c;
571
572//console.log("###===============================================================");
573//console.log("###>>>", someParameters);
574//console.log("###>>>", Clipperz.Base.serializeJSON(someParameters));
575//console.log("###--- userData", Clipperz.Base.serializeJSON(this.userData()));
576//console.log("###===============================================================");
577//console.log("--- userData.lock ", this.userData()['lock']);
578//console.log("--- parameters.lock", someParameters['parameters']['user']['lock']);
579 if (this.userData()['lock']!= someParameters['parameters']['user']['lock']) {
580 throw "the lock attribute is not processed correctly"
581 }
582
583 this.userData()['userDetails'] = someParameters['parameters']['user']['header'];
584 this.userData()['statistics'] = someParameters['parameters']['user']['statistics'];
585 this.userData()['userDetailsVersions']= someParameters['parameters']['user']['version'];
586
587 c = someParameters['parameters']['records']['updated'].length;
588 for (i=0; i<c; i++) {
589 var currentRecord;
590 var currentRecordData;
591
592 currentRecordData = someParameters['parameters']['records']['updated'][i];
593 currentRecord = this.userData()['records'][currentRecordData['record']['reference']];
594
595 if (
596 (typeof(this.userData()['records'][currentRecordData['record']['reference']]) == 'undefined')
597 &&
598 (typeof(currentRecordData['currentRecordVersion']) == 'undefined')
599 ) {
600//console.log("######## SHIT HAPPENS");
601 throw "Record added without a recordVersion";
602 }
603
604 if (currentRecord == null) {
605 currentRecord = {};
606 currentRecord['versions'] = {};
607 currentRecord['creationDate']= Clipperz.PM.Date.formatDateWithUTCFormat(new Date());
608 currentRecord['accessDate'] = Clipperz.PM.Date.formatDateWithUTCFormat(new Date());
609
610 this.userData()['records'][currentRecordData['record']['reference']] = currentRecord;
611 }
612
613 currentRecord['data'] = currentRecordData['record']['data'];
614 currentRecord['version']= currentRecordData['record']['version'];
615 currentRecord['updateDate']= Clipperz.PM.Date.formatDateWithUTCFormat(new Date());
616
617 if (typeof(currentRecordData['currentRecordVersion']) != 'undefined') {
618 currentRecord['currentVersion'] = currentRecordData['currentRecordVersion']['reference'];
619 currentRecord['versions'][currentRecordData['currentRecordVersion']['reference']] = {
620 'data': currentRecordData['currentRecordVersion']['data'],
621 'version': currentRecordData['currentRecordVersion']['version'],
622 'previousVersion': currentRecordData['currentRecordVersion']['previousVersion'],
623 'previousVersionKey':currentRecordData['currentRecordVersion']['previousVersionKey'],
624 'creationDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date()),
625 'updateDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date()),
626 'accessDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date())
627 }
628 }
629 }
630
631 c = someParameters['parameters']['records']['deleted'].length;
632 for (i=0; i<c; i++) {
633 var currentRecordReference;
634
635 currentRecordReference = someParameters['parameters']['records']['deleted'][i];
636//console.log("DELETING records", currentRecordReference);
637 delete this.userData()['records'][currentRecordReference];
638 }
639
640 this.userData()['lock'] = Clipperz.PM.Crypto.randomKey();
641 result['lock'] = this.userData()['lock'];
642 result['result'] = 'done';
643//console.log("###<<< userData", Clipperz.Base.serializeJSON(this.userData()));
644 } else {
645 throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly;
646 }
647
648 //=====================================================================
649 //
650 // U N H A N D L E D M e t h o d
651 //
652 //=====================================================================
653 } else {
654 MochiKit.Logging.logError("Clipperz.PM.Proxy.Test.message - unhandled message: " + someParameters.message);
655 }
656
657 result = {
658 result: result,
659 toll: this.getTollForRequestType('MESSAGE')
660 }
661
662 return MochiKit.Async.succeed(result);
663 },
664
665 //-------------------------------------------------------------------------
666
667 '_logout': function(someParameters) {
668 return MochiKit.Async.succeed({result: 'done'});
669 },
670
671 //=========================================================================
672 //#########################################################################
673
674 'isTestData': function() {
675 return (typeof(this.userData()['__masterkey_test_value__']) != 'undefined');
676 },
677
678 'userDetails': function() {
679 var result;
680
681 if (this.isTestData()) {
682 var serializedHeader;
683 var version;
684
685//MochiKit.Logging.logDebug("### test data");
686 version = this.userData()['userDetailsVersion'];
687 serializedHeader = Clipperz.Base.serializeJSON(this.userData()['userDetails']);
688 result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(this.userData()['__masterkey_test_value__'], serializedHeader);
689 } else {
690//MochiKit.Logging.logDebug("### NOT test data");
691 result = this.userData()['userDetails'];
692 }
693
694 return result;
695 },
696
697 'statistics': function() {
698 var result;
699
700 if (this.userData()['statistics'] != null) {
701 if (this.isTestData()) {
702 var serializedStatistics;
703 var version;
704
705 version = this.userData()['userDetailsVersion'];
706 serializedStatistics = Clipperz.Base.serializeJSON(this.userData()['statistics']);
707 result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(this.userData()['__masterkey_test_value__'], serializedStatistics);
708 } else {
709 result = this.userData()['statistics'];
710 }
711 } else {
712 result = null;
713 }
714
715 return result;
716 },
717
718/*
719 'userSerializedEncryptedData': function(someData) {
720 var deferredResult;
721 var deferredContext;
722
723 deferredContext = { 'data': someData };
724
725 deferredResult = new Clipperz.Async.Deferred('Proxy.Test.serializeUserEncryptedData', {trace:false});
726 deferredResult.addCallback(MochiKit.Base.bind(function(aDeferredContext) {
727 aDeferredContext['user'] = this.createUserUsingConfigurationData(aDeferredContext['data']);
728 return aDeferredContext;
729 }, this));
730 deferredResult.addCallback(function(aDeferredContext) {
731 // return aDeferredContext['user'].encryptedDataUsingVersion(aDeferredContext['data']['version']);
732 return aDeferredContext['user'].serializedDataUsingVersion(MochiKit.Base.values(aDeferredContext['user'].records()), aDeferredContext['data']['version']);
733 });
734 deferredResult.addCallback(function(aUserEncryptedData) {
735 deferredContext['encryptedData'] = aUserEncryptedData;
736 return deferredContext;
737 });
738 deferredResult.addCallback(function(aDeferredContext) {
739 var connection;
740
741 connection = new Clipperz.PM.Connection.communicationProtocol.versions[aDeferredContext['data']['connectionVersion']]()
742 aDeferredContext['credentials'] = connection.serverSideUserCredentials(aDeferredContext['user'].username(),aDeferredContext['user'].passphrase());
743
744 return aDeferredContext;
745 });
746
747 // deferredResult.addCallback(function(aDeferredContext) {
748//console.log("#-#-#-#-#", aDeferredContext);
749 // return aDeferredContext['user'].serializedDataUsingVersion(MochiKit.Base.values(aDeferredContext['user'].records()), aDeferredContext['data']['version']);
750 // }, deferredContext);
751 // deferredResult.addCallback(function(aUserSerializedData) {
752//console.log("USER SERIALIZED DATA", aUserSerializedData);
753 // });
754//
755 // deferredResult.addCallback(MochiKit.Async.succeed, deferredContext);
756 deferredResult.callback(deferredContext);
757
758 return deferredResult;
759 },
760
761 'createUserUsingConfigurationData': function(someData) {
762 var result;
763 var user;
764 var recordLabel;
765
766 user = new Clipperz.PM.DataModel.User();
767 user.initForTests();
768 user.setUsername(someData['username']);
769 user.setPassphrase(someData['passphrase']);
770
771 for (recordLabel in someData['records']) {
772 var recordData;
773 var record;
774 var i, c;
775
776 recordData = someData['records'][recordLabel];
777 record = new Clipperz.PM.DataModel.Record({user:user, label:recordLabel});
778 record.setNotes(recordData['notes']);
779
780 c = recordData['fields'].length;
781 for (i=0; i<c; i++) {
782 var recordField;
783
784 recordField = new Clipperz.PM.DataModel.RecordField();
785 recordField.setLabel(recordData['fields'][i]['name']);
786 recordField.setValue(recordData['fields'][i]['value']);
787 recordField.setType(recordData['fields'][i]['type']);
788 record.addField(recordField);
789 }
790 user.addRecord(record, true);
791 }
792
793 result = user;
794
795 return result;
796 },
797*/
798 //=========================================================================
799 __syntaxFix__: "syntax fix"
800});
801
802Clipperz.PM.Proxy.Offline.DataStore['exception'] = {
803 'ReadOnly': new MochiKit.Base.NamedError("Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly")
804}; \ No newline at end of file
diff --git a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.js b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.js
new file mode 100644
index 0000000..072f9bf
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.js
@@ -0,0 +1,73 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31
32//=============================================================================
33
34Clipperz.PM.Proxy.Offline = function(args) {
35 args = args || {};
36
37 Clipperz.PM.Proxy.Offline.superclass.constructor.call(this, args);
38
39 this._dataStore = args.dataStore || new Clipperz.PM.Proxy.Offline.DataStore(args);
40
41 return this;
42}
43
44YAHOO.extendX(Clipperz.PM.Proxy.Offline, Clipperz.PM.Proxy, {
45
46 'toString': function () {
47 return "Clipperz.PM.Proxy.Offline";
48 },
49
50 //-------------------------------------------------------------------------
51
52 'dataStore': function () {
53 return this._dataStore;
54 },
55
56 //-------------------------------------------------------------------------
57
58 'sendMessage': function(aFunctionName, someParameters) {
59 return this.dataStore().processMessage(aFunctionName, someParameters);
60 },
61
62 //-------------------------------------------------------------------------
63
64 'isReadOnly': function () {
65 return true;
66 },
67
68 //-------------------------------------------------------------------------
69
70 __syntaxFix__: "syntax fix"
71
72});
73
diff --git a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js
new file mode 100755
index 0000000..e7c2bc1
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js
@@ -0,0 +1,259 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31
32//=============================================================================
33
34Clipperz.PM.Proxy.PHP = function(args) {
35 Clipperz.PM.Proxy.PHP.superclass.constructor.call(this, args);
36/*
37 this._tolls = {
38 'CONNECT':[],
39 'REGISTER':[],
40 'MESSAGE':[]
41 };
42 */
43 return this;
44}
45
46YAHOO.extendX(Clipperz.PM.Proxy.PHP, Clipperz.PM.Proxy, {
47
48 'toString': function() {
49 return "Clipperz.PM.Proxy.PHP - " + this.args();
50 },
51
52 //=========================================================================
53/*
54 'tolls': function() {
55 return this._tolls;
56 },
57*/
58 //-------------------------------------------------------------------------
59/*
60 'payToll': function(aRequestType, someParameters) {
61 vardeferredResult;
62
63//MochiKit.Logging.logDebug(">>> Proxy.DWR.payToll: " + aRequestType);
64 if (this.tolls()[aRequestType].length > 0) {
65 deferredResult = MochiKit.Async.succeed(this.tolls()[aRequestType].pop());
66 } else {
67//MochiKit.Logging.logDebug("### " + aRequestType + " toll NOT immediately available; request queued.");
68 deferredResult = new MochiKit.Async.Deferred();
69 deferredResult.addCallback(function(someParameters) {
70 return new Clipperz.PM.Toll(someParameters['toll']);
71 })
72 com_clipperz_pm_Proxy.knock(Clipperz.Base.serializeJSON({requestType:aRequestType}), {
73 callback:MochiKit.Base.method(deferredResult, 'callback'),
74 errorHandler:MochiKit.Base.method(deferredResult, 'errback')
75 });
76 }
77
78 deferredResult.addCallback(function(aToll) {
79 return aToll.deferredPay();
80 });
81 deferredResult.addCallback(function(someParameters, aToll) {
82 var result;
83
84 result = {
85 parameters: someParameters,
86 toll: aToll
87 }
88
89 return result;
90 }, someParameters);
91
92 return deferredResult;
93 },
94*/
95 //-------------------------------------------------------------------------
96/*
97 'addToll': function(aToll) {
98 this.tolls()[aToll.requestType()].push(aToll);
99 },
100*/
101 //=========================================================================
102/*
103 'setTollCallback': function(someParameters) {
104//MochiKit.Logging.logDebug(">>> Proxy.DWR.setTollCallback");
105//MochiKit.Logging.logDebug("--- Proxy.DWR.setTollCallback - " + Clipperz.Base.serializeJSON(someParameters));
106 if (typeof(someParameters['toll']) != 'undefined') {
107 this.addToll(new Clipperz.PM.Toll(someParameters['toll']));
108 }
109 return someParameters['result'];
110 },
111*/
112 //=========================================================================
113
114 'registration': function(someParameters) {
115 return this.sendMessage('registration', someParameters, 'REGISTER');
116 },
117
118 //-------------------------------------------------------------------------
119
120 'handshake': function(someParameters) {
121/*
122 _s = "e8a2162f29aeaabb729f5625e9740edbf0cd80ac77c6b19ab951ed6c88443b8c";
123 _v = new Clipperz.Crypto.BigInt("955e2db0f7844aca372f5799e5f7e51b5866718493096908bd66abcf1d068108", 16);
124 _b = new Clipperz.Crypto.BigInt("5761e6c84d22ea3c5649de01702d60f674ccfe79238540eb34c61cd020230c53", 16);
125
126 _B = _v.add(Clipperz.Crypto.SRP.g().powerModule(_b, Clipperz.Crypto.SRP.n()));
127 _u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_B.asString(10))).toHexString(), 16);
128 _A = new Clipperz.Crypto.BigInt("3b3567ec33d73673552e960872eb154d091a2488915941038aef759236a27e64", 16);
129 _S = (_A.multiply(_v.powerModule(_u, Clipperz.Crypto.SRP.n()))).powerModule(_b, Clipperz.Crypto.SRP.n());
130 _K = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_S.asString(10))).toHexString().slice(2);
131 _M1 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_A.asString(10) + _B.asString(10) + _K)).toHexString().slice(2);
132 _M2 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_A.asString(10) + _M1 + _K)).toHexString().slice(2);
133
134 // MochiKit.Logging.logDebug("b = " + _b.asString(16));
135 // MochiKit.Logging.logDebug("v = " + _v.asString(16));
136 MochiKit.Logging.logDebug("B = " + _B.asString(16));
137 MochiKit.Logging.logDebug("u = " + _u.asString(16));
138 MochiKit.Logging.logDebug("S = " + _S.asString(16));
139 MochiKit.Logging.logDebug("K = " + _K);
140 MochiKit.Logging.logDebug("M1 = " + _M1);
141 MochiKit.Logging.logDebug("M2 = " + _M2);
142 // MochiKit.Logging.logDebug("someParameters.version: " + someParameters.version);
143 */
144 return this.sendMessage('handshake', someParameters, 'CONNECT');
145 },
146
147 //-------------------------------------------------------------------------
148
149 'message': function(someParameters) {
150 return this.sendMessage('message', someParameters, 'MESSAGE');
151 },
152
153 //-------------------------------------------------------------------------
154
155 'logout': function(someParameters) {
156//MochiKit.Logging.logDebug("=== Proxy.DWR.logout");
157 return this.sendMessage('logout', someParameters, 'MESSAGE');
158 },
159
160 //=========================================================================
161
162 'sendMessage': function(aFunctionName, someParameters, aRequestType) {
163/*
164 vardeferredResult;
165 var proxy;
166
167//MochiKit.Logging.logDebug(">>> Proxy.DWR.sendMessage - " + aFunctionName + " - " + aRequestType);
168 proxy = this;
169
170 deferredResult = new MochiKit.Async.Deferred();
171//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.1 Proxy.DWR.sendMessage - 1: " + res); return res;});
172 deferredResult.addCallback(MochiKit.Base.method(proxy, 'payToll'), aRequestType);
173//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.2 Proxy.DWR.sendMessage - 2: " + Clipperz.Base.serializeJSON(res)); return res;});
174 deferredResult.addCallback(MochiKit.Base.method(proxy, 'sendRemoteMessage'), aFunctionName);
175//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.DWR.sendMessage - 3: " + res); return res;});
176//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.DWR.sendMessage - 3: " + Clipperz.Base.serializeJSON(res)); return res;});
177 deferredResult.callback(someParameters);
178
179//MochiKit.Logging.logDebug("<<< Proxy.DWR.sendMessage");
180 return deferredResult;
181*/
182
183 // return this.sendRemoteMessage(aFunctionName, someParameters);
184
185
186 vardeferredResult;
187 var proxy;
188
189 proxy = this;
190
191 deferredResult = new MochiKit.Async.Deferred();
192 deferredResult.addCallback(MochiKit.Base.method(proxy, 'sendRemoteMessage'), aFunctionName);
193//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.PHP.sendMessage - 3: " + res); return res;});
194//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.PHP.sendMessage - 3.1: " + Clipperz.Base.serializeJSON(res)); return res;});
195
196 deferredResult.callback(someParameters);
197
198 return deferredResult;
199 },
200
201 //=========================================================================
202
203 'sendRemoteMessage': function(aFunctionName, someParameters) {
204/*
205 vardeferredResult;
206
207//MochiKit.Logging.logDebug(">>> Proxy.DWR.sendRemoteMessage('" + aFunctionName + "', " + Clipperz.Base.serializeJSON(someParameters) + ") - " + this);
208 deferredResult = new MochiKit.Async.Deferred();
209//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Proxy.DWR.sendRemoteMessage - 1: " + res); return res;});
210 // deferredResult.addCallback(MochiKit.Base.method(this, 'setTollCallback'));
211//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Proxy.DWR.sendRemoteMessage - 2: " + res); return res;});
212
213 com_clipperz_pm_Proxy[aFunctionName](Clipperz.Base.serializeJSON(someParameters), {
214 callback:MochiKit.Base.method(deferredResult, 'callback'),
215 errorHandler:MochiKit.Base.method(deferredResult, 'errback')
216 });
217//MochiKit.Logging.logDebug("<<< Proxy.PHP.sendRemoteMessage - result: " + deferredResult);
218
219 return deferredResult;
220*/
221
222 vardeferredResult;
223 var parameters;
224
225//MochiKit.Logging.logDebug(">>> Proxy.PHP.sendRemoteMessage('" + aFunctionName + "', " + Clipperz.Base.serializeJSON(someParameters) + ") - " + this);
226 parameters = {};
227 parameters['method'] = aFunctionName;
228 // parameters['version'] = someParameters['version'];
229 // parameters['message'] = someParameters['message'];
230 parameters['parameters'] = Clipperz.Base.serializeJSON(someParameters);
231//MochiKit.Logging.logDebug("--- Proxy.PHP.sendRemoteMessage('" + Clipperz.Base.serializeJSON(parameters) + ") - " + this);
232 deferredResult = new MochiKit.Async.Deferred();
233 deferredResult.addCallback(MochiKit.Async.doXHR, "./php/index.php", {
234 method:'POST',
235 sendContent:MochiKit.Base.queryString(parameters),
236 headers:{"Content-Type":"application/x-www-form-urlencoded"}
237 });
238//deferredResult.addCallback(function(res) {MochiKit.Logging.logDebug("Proxy.PHP.response - 2: " + res.responseText); return res;});
239//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("Proxy.PHP.response - ERROR: " + res); return res;});
240 deferredResult.addCallback(MochiKit.Async.evalJSONRequest);
241 deferredResult.callback();
242
243 return deferredResult;
244 },
245
246 //=========================================================================
247
248 'isReadOnly': function() {
249 return false;
250 },
251
252 //=========================================================================
253 __syntaxFix__: "syntax fix"
254
255});
256
257//=============================================================================
258
259//Clipperz.PM.Proxy.defaultProxy = new Clipperz.PM.Proxy.PHP("Proxy.PHP - async test");
diff --git a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Test.js b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Test.js
new file mode 100644
index 0000000..fd5bf8a
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Test.js
@@ -0,0 +1,94 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Proxy) == 'undefined') { Clipperz.PM.Proxy = {}; }
32
33//=============================================================================
34
35Clipperz.PM.Proxy.Test = function(args) {
36 args = args || {};
37
38 Clipperz.PM.Proxy.Offline.call(this, args);
39
40
41
42 return this;
43}
44
45Clipperz.PM.Proxy.Test.prototype = MochiKit.Base.update(new Clipperz.PM.Proxy.Offline(), {
46
47 'toString': function() {
48 return "Clipperz.PM.Proxy.Test";
49 },
50
51 //-------------------------------------------------------------------------
52
53 'isTestData': function() {
54 return typeof(this.userData()['__masterkey_test_value__'] != 'undefined');
55 },
56
57 //-------------------------------------------------------------------------
58
59 'userDetails': function() {
60 var result;
61
62 if (this.isTestData()) {
63 var serializedHeader;
64 var version;
65
66 version = this.userData()['version'];
67 serializedHeader = Clipperz.Base.serializeJSON(this.userData()['userDetails']);
68 result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(this.userData()['__masterkey_test_value__'], serializedHeader);
69 } else {
70 result = Clipperz.PM.Proxy.Offline.prototype.userDetails.call(this);
71 }
72
73 return result;
74 },
75
76 //-------------------------------------------------------------------------
77
78 'statistics': function() {
79 var result;
80 var serializedStatistics;
81 var version;
82
83 version = this.userData()['version'];
84 serializedStatistics = Clipperz.Base.serializeJSON(this.userData()['statistics']);
85 result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(this.userData()['__masterkey_test_value__'], serializedStatistics);
86
87 return result;
88 },
89
90 //-------------------------------------------------------------------------
91 __syntaxFix__: "syntax fix"
92
93});
94
diff --git a/frontend/beta/js/Clipperz/PM/Strings.js b/frontend/beta/js/Clipperz/PM/Strings.js
new file mode 100644
index 0000000..e9f5dbe
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Strings.js
@@ -0,0 +1,231 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; }
32if (typeof(Clipperz.PM.Strings.Languages) == 'undefined') { Clipperz.PM.Strings.Languages = {}; }
33
34Clipperz.PM.Strings.standardStrings = {
35
36 'loginPanelSwitchLanguageSelectOptions':[
37/*
38 {tag:'option', html:"Arabic (Oman) (العربية)", value:'ar-OM', disabled:true},
39 {tag:'option', html:"Arabic (Syria) (العربية)", value:'ar-SY', disabled:true},
40 {tag:'option', html:"Bahasa Indonesia", value:'id-ID', disabled:true},
41 {tag:'option', html:"Bulgarian (Български)", value:'bg-BG', disabled:true},
42 {tag:'option', html:"Català", value:'ca-ES', disabled:true},
43 {tag:'option', html:"Chinese (Simplified) (简体中文)", value:'zh-CN', disabled:true},
44 {tag:'option', html:"Chinese (Traditional) (正體中文)", value:'zh-TW', disabled:true},
45 {tag:'option', html:"Czech (Česky)", value:'cs-CZ', disabled:true},
46 {tag:'option', html:"Dansk", value:'da-DK', disabled:true},
47 {tag:'option', html:"Deutsch", value:'de-DE'/ *, disabled:true* /},
48 {tag:'option', html:"English (American)", value:'en-US'/ *, disabled:true* /},
49 {tag:'option', html:"English (British)", value:'en-GB'/ *, disabled:true* /},
50 {tag:'option', html:"English (Canadian)", value:'en-CA'/ *, disabled:true* /},
51 {tag:'option', html:"Español", value:'es-ES', disabled:true},
52 {tag:'option', html:"Eesti", value:'et-EE', disabled:true},
53 {tag:'option', html:"Français", value:'fr-FR', disabled:true},
54 {tag:'option', html:"Galego", value:'gl-ES', disabled:true},
55 {tag:'option', html:"Greek (Ελληνικά)", value:'el-GR', disabled:true},
56 {tag:'option', html:"Íslenska", value:'is-IS', disabled:true},
57 {tag:'option', html:"Italiano", value:'it-IT'/ *, disabled:true* /},
58 {tag:'option', html:"Japanese (日本語)", value:'ja-JP', disabled:true},
59 {tag:'option', html:"Korean (한국어)", value:'ko-KR', disabled:true},
60 {tag:'option', html:"Latviešu", value:'lv-LV', disabled:true},
61 {tag:'option', html:"Lietuvių", value:'lt-LT', disabled:true},
62 {tag:'option', html:"Macedonian (Македонски)", value:'mk-MK', disabled:true},
63 {tag:'option', html:"Magyar", value:'hu-HU', disabled:true},
64 {tag:'option', html:"Nederlands", value:'nl-NL', disabled:true},
65 {tag:'option', html:"Norsk bokmål", value:'nb-NO', disabled:true},
66 {tag:'option', html:"Norsk nynorsk", value:'nn-NO', disabled:true},
67 {tag:'option', html:"Persian (Western) (فارسى)", value:'fa-IR', disabled:true},
68 {tag:'option', html:"Polski", value:'pl-PL', disabled:true},
69 {tag:'option', html:"Português", value:'pt-PT'/ *, disabled:true* /},
70 {tag:'option', html:"Português Brasileiro", value:'pt-BR'/ *, disabled:true* /},
71 {tag:'option', html:"Românä", value:'ro-RO', disabled:true},
72 {tag:'option', html:"Russian (Русский)", value:'ru-RU', disabled:true},
73 {tag:'option', html:"Slovak (Slovenčina)", value:'sk-SK', disabled:true},
74 {tag:'option', html:"Slovenian (Slovenščina)", value:'sl-SI', disabled:true},
75 {tag:'option', html:"Suomi", value:'fi-FI', disabled:true},
76 {tag:'option', html:"Svenska", value:'sv-SE', disabled:true},
77 {tag:'option', html:"Thai (ไทย)", value:'th-TH', disabled:true},
78 {tag:'option', html:"Türkçe", value:'tr-TR', disabled:true},
79 {tag:'option', html:"Ukrainian (Українська)", value:'uk-UA', disabled:true}
80*/
81 {tag:'option', html:"Arabic (العربية)", value:"ar", disabled:true, cls:'disabledOption'},
82 // {tag:'option', html:"Chinese (中文)", value:"zh", disabled:true},
83 {tag:'option', html:"Chinese (Simplified) (简体中文)", value:'zh-CN'},
84 {tag:'option', html:"Dutch (Nederlands)", value:"nl-NL", disabled:true, cls:'disabledOption'},
85 {tag:'option', html:"English", value:"en-US"},
86 {tag:'option', html:"French (Français)", value:"fr-FR"},
87 {tag:'option', html:"German (Deutsch)", value:"de-DE"/* -- */, disabled:true, cls:'disabledOption' /* */},
88 {tag:'option', html:"Greek (Ελληνικά)", value:"el-GR"/* -- */, disabled:true, cls:'disabledOption' /* */},
89 {tag:'option', html:"Hebrew (עברית)", value:"he-IL"/* -- */, disabled:true, cls:'disabledOption' /* */},
90 {tag:'option', html:"Italian (Italiano)", value:"it-IT"},
91 {tag:'option', html:"Japanese (日本語)", value:"ja-JP"},
92 {tag:'option', html:"Korean (한국어)", value:"ko-KR", disabled:true, cls:'disabledOption'},
93 {tag:'option', html:"Norwegian (Norsk)", value:"no", disabled:true, cls:'disabledOption'},
94 {tag:'option', html:"Persian (فارسی)", value:"fa-IR", disabled:true, cls:'disabledOption'},
95 {tag:'option', html:"Polish (Polski)", value:"pl-PL", disabled:true, cls:'disabledOption'},
96 {tag:'option', html:"Portuguese (Português)", value:"pt-BR"},
97 {tag:'option', html:"Russian (Русский)", value:"ru-RU"/* -- */, disabled:true, cls:'disabledOption' /* */},
98 {tag:'option', html:"Spanish (Español)", value:"es-ES"},
99 {tag:'option', html:"Swedish (Svenska)", value:"sv-SE", disabled:true, cls:'disabledOption'},
100 {tag:'option', html:"Turkish (Türkçe)", value:"tr-TR", disabled:true, cls:'disabledOption'},
101 {tag:'option', html:"Vietnamese (Tiếng Việt)", value:"vi-VN", disabled:true, cls:'disabledOption'}
102 ]
103}
104
105Clipperz.PM.Strings.GeneralSettings = {
106 'en-us': {
107 'loginFormAarghThatsBadUrl':"http://www.clipperz.com/support/faq/account_faq",
108 'loginFormVerifyTheCodeUrl':"http://www.clipperz.com/learn_more/reviewing_the_code",
109
110 'donateHeaderLinkUrl': "http://www.clipperz.com/donations",
111 'creditsHeaderLinkUrl': "http://www.clipperz.com/credits",
112 'feedbackHeaderLinkUrl': "http://www.clipperz.com/contact",
113 'helpHeaderLinkUrl': "http://www.clipperz.com/support/user_guide",
114 'forumHeaderLinkUrl': "http://www.clipperz.com/forum",
115
116 'httpAuthBookmarkletConfiguration':{tag:'textarea', id:'httpAuthDefaultConfiguration', html:"" +
117 "{ \"page\":{\"title\":\"HTTP authentication\"}," + "\n" +
118 " \"form\":{\"attributes\": {" + "\n" +
119 " \"action\":\"\"," + "\n" +
120 " \"type\":\"http_auth\"" + "\n" +
121 " }, \"inputs\": [" + "\n" +
122 " {\"type\":\"text\",\"name\":\"url\",\"value\":\"\"}," + "\n" +
123 " {\"type\":\"text\",\"name\":\"username\",\"value\":\"\"}," + "\n" +
124 " {\"type\":\"password\",\"name\":\"password\",\"value\":\"\"}" + "\n" +
125 " ]}, \"version\":\"0.2.3\"}"
126 },
127
128 'directLoginJumpPageUrl':"",
129 'defaultFaviconUrl': "data:application/octet-stream;charset=utf-8;base64,AAABAAEAFxcAAAEAGAD8BgAAFgAAACgAAAAXAAAALgAAAAEAGAAAAAAAAAAAABIXAAASFwAAAAAAAAAAAAD///////////////////////////////////////////////////////////////////////////////////////////9zAC////////////////////////////////////////////////////////////////////////////////////////////9pAG////////////////////////////////////////////////////////////////////////////////////////////9rAC////////////////////////////////////////////////////////////////////////////////////////////9yAHP////////////////////////IyMizs7O6urrq6ur////////////Ozs6zs7Ozs7Pq6ur///////////////////////8AAAD////////////////////V1dWXl5eXl5eXl5elpaX4+Pj////Ozs6Xl5eXl5eXl5eenp7///////////////////////8AAAD////////////////////Ozs6Xl5eXl5eXl5eXl5fBwcHq6uqenp6Xl5eXl5eXl5eXl5f///////////////////////8AAAD////////////////////j4+OXl5eXl5eXl5eXl5eXl5elpaWXl5eXl5eXl5eXl5ezs7P///////////////////////8AAAD////////////////////////IyMiXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eenp7x8fH////////////////////////////////////////////////////4+PilpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5fOzs7////////////////////////////////////////////////////////q6uq6urqXl5eXl5eXl5eXl5eXl5eXl5eenp7V1dX4+Pj///////////////////////8AAAD////////////4+PjOzs6lpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5e6urrj4+P///////////////8AAAD////////////BwcGXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fx8fH///////////8AAAD///////////+zs7OXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fj4+P///////////8AAAD////////////IyMiXl5eXl5eXl5eXl5e6urqXl5eXl5eXl5eXl5esrKylpaWXl5eXl5eXl5eenp7x8fH///////////8AAAD////////////////Ozs7Ozs7V1dX4+Pj///+Xl5eXl5eXl5eXl5fOzs7////q6urOzs7Ozs7q6ur///////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD////////////////////////////////////IyMiXl5eXl5eenp7x8fH///////////////////////////////////8AAAD////////////////////////////////////////j4+Pj4+Px8fH///////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAo=",
130 'defaultFaviconUrl_IE': "https://www.clipperz.com/images/icons/misc/favicon.ico",
131
132 'donateSplashPanelIconUrl':"./images/smiles_big.gif",
133
134 'icons_baseUrl':"https://www.clipperz.com/images/icons",
135
136 'passwordGeneratorLowercaseCharset':"abcdefghijklmnopqrstuvwxyz",
137 'passwordGeneratorUppercaseCharset':"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
138 'passwordGeneratorNumberCharset': "0123456789",
139 'passwordGeneratorSymbolCharset': "!@#$%^&*+?[]{}/|\\<>,.;:~=-_",
140
141 '_': ""
142 }
143}
144
145Clipperz.PM.Strings.defaultLanguages = {
146 'default':"en-us",
147
148 // 'de':"de-de",
149 // 'el':"el-gr",
150 // 'he':"he-il",
151 // 'ru':"ru-ru",
152
153
154 'fr':"fr-fr",
155 'es':"es-es",
156 'zh':"zh-cn",
157 'ja':"ja-jp",
158 'pt':"pt-br",
159 'it':"it-it",
160 'en': "en-us"
161}
162
163Clipperz.PM.Strings.inputTypeToRecordFieldType = {
164 'text': 'TXT',
165 'password': 'PWD',
166 'checkbox': 'CHECK',
167 'radio': 'RADIO',
168 'select': 'SELECT'
169};
170
171Clipperz.PM.Strings.Languages.setSelectedLanguage = function(aLanguage) {
172 var language;
173 varselectedLanguage;
174
175 language = (aLanguage || Clipperz.PM.Strings.preferredLanguage || 'default').toLowerCase();
176//MochiKit.Logging.logDebug("1 - language: " + language);
177 if (typeof(Clipperz.PM.Strings.defaultLanguages[language]) != 'undefined') {
178 language = Clipperz.PM.Strings.defaultLanguages[language];
179//MochiKit.Logging.logDebug("2 - language: " + language);
180 }
181
182 if (typeof(Clipperz.PM.Strings.Languages[language]) != 'undefined') {
183 selectedLanguage = language;
184//MochiKit.Logging.logDebug("### selectedLanguage full match: " + selectedLanguage);
185 } else if (typeof(Clipperz.PM.Strings.defaultLanguages[language.substr(0,2)]) != 'undefined') {
186 selectedLanguage = Clipperz.PM.Strings.defaultLanguages[language.substr(0,2)];
187//MochiKit.Logging.logDebug("### selectedLanguage partial match: " + selectedLanguage);
188 } else {
189 selectedLanguage = Clipperz.PM.Strings.defaultLanguages['default'];
190//MochiKit.Logging.logDebug("### selectedLanguage default match: " + selectedLanguage);
191 }
192
193//MochiKit.Logging.logDebug("### selectedLanguage: " + selectedLanguage);
194 if (selectedLanguage != Clipperz.PM.Strings.selectedLanguage) {
195//MochiKit.Logging.logDebug(">>> setting Clipperz.PM.Strings.selectedLanguage: " + selectedLanguage);
196 Clipperz.PM.Strings.selectedLanguage = selectedLanguage;
197
198 MochiKit.Base.update(Clipperz.PM.Strings, Clipperz.PM.Strings.standardStrings)
199//MochiKit.Logging.logDebug("=== 1: " + Clipperz.PM.Strings['bookmarkletTabInstructions']);
200 MochiKit.Base.updatetree(Clipperz.PM.Strings, Clipperz.PM.Strings.Languages[Clipperz.PM.Strings.defaultLanguages['default']]);
201//MochiKit.Logging.logDebug("=== 2: " + Clipperz.PM.Strings['bookmarkletTabInstructions']);
202 MochiKit.Base.updatetree(Clipperz.PM.Strings, Clipperz.PM.Strings.GeneralSettings[Clipperz.PM.Strings.defaultLanguages['default']]);
203//MochiKit.Logging.logDebug("=== 3: " + Clipperz.PM.Strings['bookmarkletTabInstructions']);
204 MochiKit.Base.updatetree(Clipperz.PM.Strings, Clipperz.PM.Strings.Languages[selectedLanguage]);
205//MochiKit.Logging.logDebug("=== 4: " + Clipperz.PM.Strings['bookmarkletTabInstructions']);
206 MochiKit.Base.updatetree(Clipperz.PM.Strings, Clipperz.PM.Strings.GeneralSettings[selectedLanguage]);
207//MochiKit.Logging.logDebug("=== 5: " + Clipperz.PM.Strings['bookmarkletTabInstructions']);
208
209 Clipperz.NotificationCenter.notify(Clipperz.PM.Strings.Languages, 'switchLanguage', selectedLanguage);
210//MochiKit.Logging.logDebug("<<< setting Clipperz.PM.Strings.selectedLanguage. Done");
211 }
212}
213
214Clipperz.PM.Strings.Languages.initSetup = function() {
215 varlanguage;
216 varlanguageParser;
217
218 language = navigator.language || navigator.userLanguage; //en, en-US, .... "de", "nb-no"
219 languageParser = new RegExp("language=([a-z]{2}(?:\-[a-z]{2})?)(\&|$)", "i");
220 if (languageParser.test(window.location.search)) {
221//MochiKit.Logging.logDebug("LANGUAGE specified in the query string");
222 language = RegExp.$1;
223 }
224
225//MochiKit.Logging.logDebug("+++ preferredLanguage: " + language);
226 Clipperz.PM.Strings.preferredLanguage = language.toLowerCase();
227//MochiKit.Logging.logDebug("## preferredLanguage: " + Clipperz.PM.Strings.preferredLanguage);
228 Clipperz.PM.Strings.Languages.setSelectedLanguage(Clipperz.PM.Strings.preferredLanguage);
229}
230
231//MochiKit.DOM.addLoadEvent(Clipperz.PM.Strings.Languages.initSetup);
diff --git a/frontend/beta/js/Clipperz/PM/Strings/MessagePanelConfigurations.js b/frontend/beta/js/Clipperz/PM/Strings/MessagePanelConfigurations.js
new file mode 100644
index 0000000..446e96c
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Strings/MessagePanelConfigurations.js
@@ -0,0 +1,389 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; }
32
33Clipperz.PM.Strings.messagePanelConfigurations = {
34
35
36 //-------------------------------------------------------------------------
37 //
38 // Registration - connection
39 //
40 'registration_verify': function() {
41 return {
42 'title': null,
43 'text': Clipperz.PM.Strings['connectionRegistrationSendingRequestMessageText']
44 }
45 },
46
47 'registration_sendingCredentials': function() {
48 return {
49 'title': null,
50 'text': Clipperz.PM.Strings['connectionRegistrationSendingCredentialsMessageText']
51 }
52 },
53
54 //-------------------------------------------------------------------------
55 //
56 // One Time Password login message panel
57 //
58
59 'OTP_login_start': function() {
60 return {
61 'title': Clipperz.PM.Strings['OTPloginMessagePanelInitialTitle'],
62 'text': Clipperz.PM.Strings['OTPloginMessagePanelInitialText'],
63 'steps': '+3',
64 'buttons': {}
65 }
66 },
67
68 'OTP_login_loadingOTP': function() {
69 return {
70 'title': Clipperz.PM.Strings['OTPloginMessagePanelLoadingTitle'],
71 'text': Clipperz.PM.Strings['OTPloginMessagePanelLoadingText']
72 }
73 },
74
75 'OTP_login_extractingPassphrase': function() {
76 return {
77 'title': Clipperz.PM.Strings['OTPloginMessagePanelProcessingTitle'],
78 'text': Clipperz.PM.Strings['OTPloginMessagePanelProcessingText']
79 }
80 },
81
82
83 //-------------------------------------------------------------------------
84 //
85 // Login message panel
86 //
87 'login_start': function() {
88 return {
89 'title': Clipperz.PM.Strings['loginMessagePanelInitialTitle'],
90 'text': Clipperz.PM.Strings['loginMessagePanelInitialText'],
91 'steps': '+7',
92 'buttons': {
93 'ok': Clipperz.PM.Strings['loginMessagePanelInitialButtonLabel']
94 }
95 }
96 },
97
98 'login_connected': function() {
99 return {
100 'title': Clipperz.PM.Strings['loginMessagePanelConnectedTitle'],
101 'text': Clipperz.PM.Strings['loginMessagePanelConnectedText'],
102 'buttons': {}
103 }
104 },
105
106 'login_failed':function() {
107 return {
108 'title': Clipperz.PM.Strings['loginMessagePanelFailureTitle'],
109 'text': Clipperz.PM.Strings['loginMessagePanelFailureText'],
110 'button': Clipperz.PM.Strings['loginMessagePanelFailureButtonLabel']
111 }
112 },
113
114 //-------------------------------------------------------------------------
115 //
116 // Login message panel - connection
117 //
118 'connection_sendingCredentials': function() {
119 return {
120 'title': Clipperz.PM.Strings['connectionLoginSendingCredentialsMessageTitle'],
121 'text': Clipperz.PM.Strings['connectionLoginSendingCredentialsMessageText']
122 }
123 },
124
125 'connection_credentialVerification': function() {
126 return {
127 'title': Clipperz.PM.Strings['connectionLoginCredentialsVerificationMessageTitle'],
128 'text': Clipperz.PM.Strings['connectionLoginCredentialsVerificationMessageText']
129 }
130 },
131
132 'connection_loggedIn': function() {
133 return {
134 'title': Clipperz.PM.Strings['connectionLoginDoneMessageTitle'],
135 'text': Clipperz.PM.Strings['connectionLoginDoneMessageText']
136 }
137 },
138
139 //-------------------------------------------------------------------------
140 //
141 //Login message panel - user
142 //
143 'connection_upgrading': function() {
144 return {
145 'title': Clipperz.PM.Strings['userLoginPanelUpgradingUserCredentialsMessageTitle'],
146 'text': Clipperz.PM.Strings['userLoginPanelUpgradingUserCredentialsMessageText'],
147 'steps': '+1'
148 }
149 },
150
151 'connection_done': function() {
152 return {
153 'title': Clipperz.PM.Strings['userLoginPanelConnectedMessageTitle'],
154 'text': Clipperz.PM.Strings['userLoginPanelConnectedMessageText']
155 }
156 },
157
158 'connection_tryOlderSchema': function() {
159 return {
160 'title': Clipperz.PM.Strings['userLoginPanelTryingAnOlderConnectionSchemaMessageTitle'],
161 'text': Clipperz.PM.Strings['userLoginPanelTryingAnOlderConnectionSchemaMessageText'],
162 'steps': '+4'
163 }
164 },
165
166 'connection_loadingUserData': function() {
167 return {
168 'title': Clipperz.PM.Strings['userLoginPanelLoadingUserDataMessageTitle'],
169 'text': Clipperz.PM.Strings['userLoginPanelLoadingUserDataMessageText']
170 }
171 },
172
173 'connection_decryptingUserData': function() {
174 return {
175 'title': Clipperz.PM.Strings['userLoginPanelDecryptingUserDataMessageTitle'],
176 'text': Clipperz.PM.Strings['userLoginPanelDecryptingUserDataMessageText'],
177 'steps': '+1'
178 }
179 },
180
181 'connection_decryptingUserStatistics': function() {
182 return {
183 'title': Clipperz.PM.Strings['userLoginPanelDecryptingUserStatisticsMessageTitle'],
184 'text': Clipperz.PM.Strings['userLoginPanelDecryptingUserStatisticsMessageText']
185 }
186 },
187
188 'collectingEntropy': function() {
189 return {
190 'text': Clipperz.PM.Strings['panelCollectingEntryopyMessageText'],
191 'steps': '+1'
192 }
193 },
194
195 //-------------------------------------------------------------------------
196 //
197 // Cards block - delete card panel
198 //
199 'deleteRecord_collectData': function() {
200 return {
201 'title': Clipperz.PM.Strings['deleteRecordPanelCollectRecordDataMessageTitle'],
202 'text': Clipperz.PM.Strings['deleteRecordPanelCollectRecordDataMessageText']
203 }
204 },
205
206 'deleteRecord_encryptData': function() {
207 return {
208 'title': Clipperz.PM.Strings['deleteRecordPanelEncryptUserDataMessageTitle'],
209 'text': Clipperz.PM.Strings['deleteRecordPanelEncryptUserDataMessageText']
210 }
211 },
212
213 'deleteRecord_sendingData': function() {
214 return {
215 'title': Clipperz.PM.Strings['deleteRecordPanelSendingDataToTheServerMessageTitle'],
216 'text': Clipperz.PM.Strings['deleteRecordPanelSendingDataToTheServerMessageText']
217 }
218 },
219
220 'deleteRecord_updatingInterface': function() {
221 return {
222 'title': Clipperz.PM.Strings['deleteRecordPanelUpdatingTheInterfaceMessageTitle'],
223 'text': Clipperz.PM.Strings['deleteRecordPanelUpdatingTheInterfaceMessageText']
224 }
225 },
226
227
228 //-------------------------------------------------------------------------
229 //
230 //Cards block - save card panel
231 //
232 'saveCard_collectRecordInfo': function() {
233 return {
234 'title': Clipperz.PM.Strings['recordSaveChangesPanelCollectRecordInfoMessageTitle'],
235 'text': Clipperz.PM.Strings['recordSaveChangesPanelCollectRecordInfoMessageText']
236 }
237 },
238
239 'saveCard_encryptUserData': function() {
240 return {
241 'title': Clipperz.PM.Strings['recordSaveChangesPanelEncryptUserDataMessageTitle'],
242 'text': Clipperz.PM.Strings['recordSaveChangesPanelEncryptUserDataMessageText']
243 }
244 },
245
246 'saveCard_encryptRecordData': function() {
247 return {
248 'title': Clipperz.PM.Strings['recordSaveChangesPanelEncryptRecordDataMessageTitle'],
249 'text': Clipperz.PM.Strings['recordSaveChangesPanelEncryptRecordDataMessageText']
250 }
251 },
252
253 'saveCard_encryptRecordVersions': function() {
254 return {
255 'title': Clipperz.PM.Strings['recordSaveChangesPanelEncryptRecordVersionDataMessageTitle'],
256 'text': Clipperz.PM.Strings['recordSaveChangesPanelEncryptRecordVersionDataMessageText']
257 }
258 },
259
260 'saveCard_sendingData': function() {
261 return {
262 'title': Clipperz.PM.Strings['recordSaveChangesPanelSendingDataToTheServerMessageTitle'],
263 'text': Clipperz.PM.Strings['recordSaveChangesPanelSendingDataToTheServerMessageText']
264 }
265 },
266
267 'saveCard_updatingInterface': function() {
268 return {
269 'title': Clipperz.PM.Strings['recordSaveChangesPanelUpdatingTheInterfaceMessageTitle'],
270 'text': Clipperz.PM.Strings['recordSaveChangesPanelUpdatingTheInterfaceMessageText']
271 }
272 },
273
274 //-------------------------------------------------------------------------
275 //
276 //Account panel - user preferences
277 //
278 'account_savingPreferences_1': function() {
279 return {
280 'title': Clipperz.PM.Strings['accountPreferencesSavingPanelTitle_Step1'],
281 'text': Clipperz.PM.Strings['accountPreferencesSavingPanelText_Step1'],
282 'steps': '+3'
283 }
284 },
285
286 'account_savingPreferences_2': function() {
287 return {
288 'title': Clipperz.PM.Strings['accountPreferencesSavingPanelTitle_Step2'],
289 'text': Clipperz.PM.Strings['accountPreferencesSavingPanelText_Step2']
290 }
291 },
292
293
294 //-------------------------------------------------------------------------
295 //
296 //Account panel - change credentials
297 //
298 'changeCredentials_encryptingData': function() {
299 return {
300 'title': Clipperz.PM.Strings['changeCredentialsPanelEncryptingDataMessageTitle'],
301 'text': Clipperz.PM.Strings['changeCredentialsPanelEncryptingDataMessageText']
302 }
303 },
304
305 'changeCredentials_creatingNewCredentials': function() {
306 return {
307 'title': Clipperz.PM.Strings['changeCredentialsPanelCreatingNewCredentialsMessageTitle'],
308 'text': Clipperz.PM.Strings['changeCredentialsPanelCreatingNewCredentialsMessageText']
309 }
310 },
311
312 'changeCredentials_sendingCredentials': function() {
313 return {
314 'title': Clipperz.PM.Strings['changeCredentialsPanelSendingNewCredentialsToTheServerMessageTitle'],
315 'text': Clipperz.PM.Strings['changeCredentialsPanelSendingNewCredentialsToTheServerMessageText']
316 }
317 },
318
319 'changeCredentials_done': function() {
320 return {
321 'title': Clipperz.PM.Strings['changeCredentialsPanelDoneMessageTitle'],
322 'text': Clipperz.PM.Strings['changeCredentialsPanelDoneMessageText']
323 }
324 },
325
326
327 //-------------------------------------------------------------------------
328 //
329 //Account panel - change credentials
330 //
331 'saveOTP_encryptUserData': function() {
332 return {
333 'title': Clipperz.PM.Strings['saveOTP_encryptUserDataTitle'],
334 'text': Clipperz.PM.Strings['saveOTP_encryptUserDataText'],
335 'steps': '+4'
336 }
337 },
338
339 'saveOTP_encryptOTPData': function() {
340 return {
341 'title': Clipperz.PM.Strings['saveOTP_encryptOTPDataTitle'],
342 'text': Clipperz.PM.Strings['saveOTP_encryptOTPDataText']
343 }
344 },
345
346 'saveOTP_sendingData': function() {
347 return {
348 'title': Clipperz.PM.Strings['saveOTP_sendingDataTitle'],
349 'text': Clipperz.PM.Strings['saveOTP_sendingDataText']
350 }
351 },
352
353 'saveOTP_updatingInterface': function() {
354 return {
355 'title': Clipperz.PM.Strings['saveOTP_updatingInterfaceTitle'],
356 'text': Clipperz.PM.Strings['saveOTP_updatingInterfaceText']
357 }
358 },
359
360
361 //-------------------------------------------------------------------------
362 //
363 //Data panel - processingImportData
364 //
365 'parseImportData': function() {
366 return {
367 'title': Clipperz.PM.Strings['importData_parsingDataTitle'],
368 'text': Clipperz.PM.Strings['importData_parsingDataText']
369 }
370 },
371
372 'previewImportData': function() {
373 return {
374 'title': Clipperz.PM.Strings['importData_previewingDataTitle'],
375 'text': Clipperz.PM.Strings['importData_previewingDataText']
376 }
377 },
378
379 'processingImportData': function() {
380 return {
381 'title': Clipperz.PM.Strings['importData_processingDataTitle'],
382 'text': Clipperz.PM.Strings['importData_processingDataText']
383 }
384 },
385
386 //-------------------------------------------------------------------------
387 __syntaxFix__: "syntax fix"
388
389}
diff --git a/frontend/beta/js/Clipperz/PM/Strings/Strings_de-DE.js b/frontend/beta/js/Clipperz/PM/Strings/Strings_de-DE.js
new file mode 100644
index 0000000..ecc8a36
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Strings/Strings_de-DE.js
@@ -0,0 +1,352 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29Clipperz.PM.Strings.Languages['de-DE'.toLowerCase()] = MochiKit.Base.merge(Clipperz.PM.Strings.Languages['en-us'], {
30 'clipperzServiceDescription':"<h2>Privatsphäre für Deine Daten</h2> <ul> <li> <h3>Clipperz heißt:</h3> <ul> <li> <p>sichere und einfache zu bedienene Passwortverwaltung</p> </li> <li> <p>eine effektive Lösung des einmaligen Anmeldens</p> </li> <li> <p>eine digitale Brieftasche für Deine vertraulichen Daten</p> </li> </ul> </li> <li> <h3>Clipperz bietet Dir:</h3> <ul> <li> <p>einfaches Speichern und Verwalten von Passwörtern und Webzugangsdaten</p> </li> <li> <p>schnelles unkompliziertes einloggen, ohne Eingabe des Benutzernamen und Passworts, bei Webdiensten</p> </li> <li> <p>Schutz aller Deiner persönlichen Daten: Zutrittscodes, PINs, Benutzernamen, Passwörter, Kreditkartennummern, &hellip;</p> </li> <li> <p>Deine Geheimnisse mit Familienmitgliedern und Freunden zu teilen (mehr dazu in Kürze)</p> </li> </ul> </li> <li> <h3>Clipperz ist:</h3> <ul> <li> <p>kostenlos und absolut anonym</p> </li> <li> <p>unkomplizierter Zugriff zu jeder Zeit von jedem Rechner</p> </li> <li> <p>ohne Download und Installation verwendbar</p> </li> <li> <p>ein Schutz gegen das Speichern von Passwörtern auf Deinem PC oder das Notieren auf Papier</p> </li> </ul> </li> <li> <h3>Clipperz Sicherheit:</h3> <ul> <li> <p>Deine sensiblen persönlichen Informationen werden lokal durch Deinen Browser verschlüsselt, bevor sie an Clipperz über das Internet gesendet werden</p> </li> <li> <p>Der Schlüssel für diese Daten ist der Sicherheitssatz, den nur Du kennst</p> </li> <li> <p>Clipperz speichert Deine sensiblen Daten nur in verschlüsselter Form und kann zu keinem Zeitpunkt diese entschlüssel und in ihrer ursprünglichen Klartextform zugänglich machen</p> </li> <li> <p>Clipperz basiert auf standart Verschlüsselungsverfahren. Nichts ausergewöhnliches – oder hand gestricktes</p> </li> <li> <p>Du kannst den Quellcode zu jeder Zeit anschauen, aber Du brauchst nichts von Kryptographie zu verstehen um ein glücklicher Anwender zu sein!</p> </li> </ul> </li> <li> <a href=\"http://www.clipperz.com\" target=\"_blank\">Weitere Informationen</a> </li> </ul> ",
31 'loginFormTitle':"Login zu Deinem Clipperz Konto",
32 'loginFormUsernameLabel':"Benutzernamen",
33 'loginFormPassphraseLabel':"Sicherheitssatz",
34 'loginFormDontHaveAnAccountLabel':"Du hast noch kein Clipperz Konto?",
35 'loginFormCreateOneLabel':"Konto erstellen",
36 'loginFormForgotYourCredentialsLabel':"Zugangsdaten vergessen?",
37 'loginFormAarghThatsBadLabel':"Misst! Dass ist schlecht!",
38 'loginFormAfraidOfMaliciousScriptsLabel':"verängstigt von bösartigen Scripts?",
39 'loginFormVerifyTheCodeLabel':"begutachte den Quellcode",
40 'loginFormButtonLabel':"Einloggen",
41 'loginPanelSwithLanguageDescription':"<h5>Wechsel zu Deiner vervorzugten Sprache</h5> ",
42 'browserCompatibilityDescription':"<p>Bessere und sicherere Clipperz-Erfahrung mit Firefox. Clipperz funktioniert auch mit Safari, Opera und MS Internet Explorer!</p> ",
43 'loginMessagePanelInitialTitle':"Du wirst eingeloggt…",
44 'loginMessagePanelInitialButtonLabel':"Abbruch",
45 'loginMessagePanelConnectedTitle':"Verbunden",
46 'loginMessagePanelConnectedText':"Fertig",
47 'loginMessagePanelFailureTitle':"Fehler",
48 'loginMessagePanelFailureText':"Login fehlgeschlagen",
49 'loginMessagePanelFailureButtonLabel':"Schließen",
50 'connectionLoginSendingCredentialsMessageTitle':"Prüfe Zugangsdaten",
51 'connectionLoginSendingCredentialsMessageText':"Sende Zugangsdaten",
52 'connectionLoginCredentialsVerificationMessageTitle':"Prüfe Zugangsdaten",
53 'connectionLoginCredentialsVerificationMessageText':"Führe SRP Authentifizierung durch",
54 'connectionLoginDoneMessageTitle':"Prüfe Zugangsdaten",
55 'connectionLoginDoneMessageText':"Verbunden",
56 'userLoginPanelUpgradingUserCredentialsMessageTitle':"Prüfe Zugangsdaten",
57 'userLoginPanelUpgradingUserCredentialsMessageText':"Aktualisierung Deiner Zugangsdaten auf ein neues Authentifizierungsschema",
58 'userLoginPanelConnectedMessageTitle':"Benutzer authentifiziert",
59 'userLoginPanelConnectedMessageText':"Login erfolgreich",
60 'userLoginPanelTryingAnOlderConnectionSchemaMessageTitle':"Prüfe Zugangsdaten",
61 'userLoginPanelTryingAnOlderConnectionSchemaMessageText':"Probiere älteres Authentifizierungsschema",
62 'userLoginPanelLoadingUserDataMessageTitle':"Benutzer authentifiziert",
63 'userLoginPanelLoadingUserDataMessageText':"Lade verschlüsselte Kartendaten von Clipperz",
64 'userLoginPanelDecryptingUserDataMessageTitle':"Benutzer authentifiziert",
65 'userLoginPanelDecryptingUserDataMessageText':"Lokale Entschlüsselung der Kartendaten",
66 'userLoginPanelDecryptingUserStatisticsMessageTitle':"Benutzer authentifiziert",
67 'userLoginPanelDecryptingUserStatisticsMessageText':"Lokale Entschlüsselung der Benutzerstatisik",
68 'splashAlertTitle':"Willkommen bei Clipperz!",
69 'splashAlertText':"<p>Sicherheitshinweis</p> <ul> <li> <p>Die Speicherung von Informationen bei Clipperz ist so sicher, wie der Sicherheitssatz den Du zum Schutz gewählt hast. Ist der Sicherheitssatz nicht bekannt, können keine Informationen abgefragt werden.</p> </li> <li> <p>Solltest Du Clipperz nutzen, um sensible und kritische persönliche Daten abzuspeichern, so empfehlen wir in jedem Fall die Nutzung eines langen Sicherheitssatzes als Passwort und die Nutzung von Sonderzeichen, Zahlen, Groß- und Kleinbuchstaben.</p> </li> <li> <p>Clipperz kann einen verlorenen Sicherheitssatz nicht wiederherstellen!</p> </li> </ul> <p>Weitere Informationen findest Du bei <a href=\"http://www.clipperz.com\" target=\"_blank\">Clipperz</a>.</p> ",
70 'splashAlertCloseButtonLabel':"Ok",
71 'registrationFormTitle':"Erstelle Dein Konto",
72 'registrationFormUsernameLabel':"Benutzernamen",
73 'registrationFormPassphraseLabel':"Sicherheitssatz",
74 'registrationFormRetypePassphraseLabel':"Wiederhole Sicherheitssatz",
75 'registrationFormSafetyCheckLabel':"Ich akzeptiere dass es Clipperz nicht möglich ist, einen verlorenen Sicherheitssatz wiederherzustellen.",
76 'registrationFormTermsOfServiceCheckLabel':"Ich habe die <a href='http://www.clipperz.com/terms_of_service' target='_blank'>Nutzungsbedingungen</a> gelesen, verstanden und akzeptiere diese.",
77 'registrationFormDoYouAlreadyHaveAnAccountLabel':"Hast Du bereits einen Zugang?",
78 'registrationFormSimplyLoginLabel':"Einloggen",
79 'registrationFormButtonLabel':"Anmelden",
80 'registrationFormWarningMessageNotMatchingPassphrases':"Deine Sicherheitssätze stimmen nicht überein. Bitte erneut eingeben.",
81 'registrationFormWarningMessageSafetyCheckNotSelected':"Bitte lese die Bedingungen und akzeptiere die Auswahlboxen weiter unten.",
82 'registrationFormWarningMessageTermsOfServiceCheckNotSelected':"Du musst die Nutzungsbedingungen akzeptieren.",
83 'registrationMessagePanelInitialTitle':"Benutzer wird angelegt…",
84 'registrationMessagePanelInitialButtonLabel':"Abbruch",
85 'registrationMessagePanelRegistrationDoneTitle':"Anmeldung",
86 'registrationMessagePanelRegistrationDoneText':"Fertig",
87 'registrationMessagePanelFailureTitle':"Anmerldung fehlgeschlagen",
88 'registrationMessagePanelFailureButtonLabel':"Schließen",
89 'connectionRegistrationSendingRequestMessageText':"Zugangsdaten werden geprüft",
90 'connectionRegistrationSendingCredentialsMessageText':"Sende Zugangsdaten",
91 'registrationSplashPanelTitle':"Sicherheitshinweis",
92 'registrationSplashPanelDescription':"<p>Dies sind Deine Clipperz Zugangsdaten, pass sehr gut auf sie auf. Clipperz wird diese kein zweites und weiteres mal anzeigen!</p> ",
93 'registrationSplashPanelUsernameLabel':"Benutzernamen",
94 'registrationSplashPanelPassphraseLabel':"Schlüsselsatz",
95 'donateHeaderLinkLabel':"spende",
96 'creditsHeaderLinkLabel':"credits",
97 'feedbackHeaderLinkLabel':"feedback",
98 'helpHeaderLinkLabel':"hilfe",
99 'forumHeaderLinkLabel':"forum",
100 'recordMenuLabel':"Karten",
101 'accountMenuLabel':"Benutzer",
102 'dataMenuLabel':"Daten",
103 'contactsMenuLabel':"Kontakt",
104 'bookmarkletMenuLabel':"Bookmarklet",
105 'logoutMenuLabel':"Ausloggen",
106 'lockMenuLabel':"Sperren",
107 'lockTitle':"Dieses Konto ist gesperrt",
108 'lockDescription':"<p>Bitte gebe Deinen Sicherheitssatz ein, um das Clipperz-Konto zu entsperren.</p> ",
109 'unlockButtonLabel':"Entsperren",
110 'changePasswordTabLabel':"Sicherheitssatz ändern",
111 'changePasswordTabTitle':"Sicherheitssatz ändern",
112 'changePasswordFormUsernameLabel':"Benutzername",
113 'changePasswordFormOldPassphraseLabel':"Alter Sicherheitssatz",
114 'changePasswordFormNewPassphraseLabel':"Neuer Sicherheitssatz",
115 'changePasswordFormRetypePassphraseLabel':"Wiederholdung neuen Sicherheitssatz",
116 'changePasswordFormSafetyCheckboxLabel':"Ich akzeptiere dass es Clipperz nicht möglich ist, einen verlorenen Sicherheitssatz wiederherzustellen.",
117 'changePasswordFormSubmitLabel':"Sicherheitssatz ändern",
118 'changePasswordFormWrongUsernameWarning':"Falscher Benutzername",
119 'changePasswordFormWrongPassphraseWarning':"Falscher Sicherheitssatz",
120 'changePasswordFormWrongRetypePassphraseWarning':"Deine Sicherheitssätze stimmen nicht überein. Bitte erneut eingeben.",
121 'changePasswordFormSafetyCheckWarning':"Bitte ließ die folgenden Hinweise und akzeptiere diese.",
122 'changePasswordFormProgressDialogTitle':"Ändere Zugangsdaten",
123 'changePasswordFormProgressDialogConnectedMessageTitle':"Verbunden",
124 'changePasswordFormProgressDialogConnectedMessageText':"Fertig",
125 'changePasswordFormProgressDialogErrorMessageTitle':"Fehler",
126 'changePasswordFormProgressDialogErrorMessageText':"Ändern der Zugangsdaten fehlgeschlagen!",
127 'changeCredentialsPanelEncryptingDataMessageTitle':"Ändere Sicherheitssatz",
128 'changeCredentialsPanelEncryptingDataMessageText':"Lokale Verschlüsselung der Kartendaten",
129 'changeCredentialsPanelCreatingNewCredentialsMessageTitle':"Ändere Sicherheitssatz",
130 'changeCredentialsPanelCreatingNewCredentialsMessageText':"Aktualisiere Zugangsdaten",
131 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageTitle':"Ändere Sicherheitssatz",
132 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageText':"Sende verschlüsselte Zugangsdaten zu Clipperz",
133 'changeCredentialsPanelDoneMessageTitle':"Ändere Sicherheitssatz",
134 'changeCredentialsPanelDoneMessageText':"Fertig",
135 'manageOTPTabLabel':"Verwaltung des Sicheitssatzes für einmaliges Anmelden",
136 'manageOTPTabTitle':"Verwaltung des Sicheitssatzes für einmaliges Anmelden",
137 'manageOTPTabDescription':"<p>Der Sicherheitssatz für einmaliges Anmelden funktoniert wie Dein regulärer Sicherheitssatz, nur dass er nur einmal verwendet werden kann.</p> <p>Sollte der gleiche Sicherheitssatz zu einem späteren Zeitpunkt nocheinmal genutzt werden, wird dieser automatisch zurückgewießen und der Einlogvorgang scheitert.</p> <p>Sofort nach einem erfolgreichen Login wird der Sicherheitssatz für einmaliges Anmelden gelöscht und somit verhindert dass er ungewollt verwendet wird.</p> <p>Die Nutzung von Sicherheitssätzen für einmaliges Anmelden sind eine ideale Möglichkeit wenn Du verunsichert bist ob Trojaner, Spyware oder ähnliches auf Deinem Rechner vorhanden ist.</p> <p> <b>Es wird empfohlen Sicherheitssätze für einmaliges Anmelden beim Zugiff auf Clipperz zu verwenden, wenn man sich an öffentlichen Rechnern befindet, wie in Internet Cafes oder Bücherreien.</b> </p> <p> </p> <p> <b>Mehr dazu in Kürze ...</b> </p> ",
138 'accountPreferencesLabel':"Einstellungen",
139 'accountPreferencesTabTitle':"Einstellungen",
140 'accountPreferencesLanguageTitle':"Sprachenauswahl",
141 'accountPreferencesLanguageDescription':"<p>Wähle Deine bevorzugte Sprache, aus der unten stehenden Liste.</p> ",
142 'accountPreferencesInterfaceTitle':"Personalisiere Dein persönliches Clipperz-Erscheinungsbild",
143 'accountPreferencesInterfaceDescription':"<p>Passe dass Clipperz-Erscheinungsbild an Deine Wünsche an.</p> ",
144 'saveUserPreferencesFormSubmitLabel':"Speichern",
145 'cancelUserPreferencesFormSubmitLabel':"Abbruch",
146 'accountPreferencesSavingPanelTitle_Step1':"Speichere Einstellungen",
147 'accountPreferencesSavingPanelText_Step1':"Lokale Verschlüsselung der Einstellungen",
148 'accountPreferencesSavingPanelTitle_Step2':"Speichere Einstellungen",
149 'accountPreferencesSavingPanelText_Step2':"Sende verschlüsselte Einstellungen",
150 'deleteAccountTabLabel':"Konto löschen",
151 'deleteAccountTabTitle':"Konto löschen",
152 'deleteAccountFormUsernameLabel':"Benutzername",
153 'deleteAccountFormPassphraseLabel':"Sicherheitssatz",
154 'deleteAccountFormSafetyCheckboxLabel':"Ich bin mir bewusst, dass alle meine Daten gelöscht werden und dieser Vorgang in keinem Falle rückgängig gemacht werden kann.",
155 'deleteAccountFormSubmitLabel':"Konto löschens",
156 'deleteAccountFormWrongUsernameWarning':"Falscher Benutzername",
157 'deleteAccountFormWrongPassphraseWarning':"Falscher Sicherheitssatz",
158 'deleteAccountFormSafetyCheckWarning':"Bitte lese die Bedingungen und akzeptiere die Auswahlboxen weiter unten.",
159 'accountPanelDeletingAccountPanelConfirmationTitle':"ACHTUNG",
160 'accountPanelDeleteAccountPanelConfirmationText':"Bist Du sicher, dass Du den Zugang löschen möchtest?",
161 'accountPanelDeleteAccountPanelConfirmButtonLabel':"Ja",
162 'accountPanelDeleteAccountPanelDenyButtonLabel':"Nein",
163 'offlineCopyTabLabel':"Offline Kopie",
164 'offlineCopyTabTitle':"Offline Kopie",
165 'offlineCopyTabDescription':"<p>Mit nur einem Klick kannst Du alle Deine verschlüsselten Daten von dem Clipperz Server auf Deine Festplatte speichern und somit eine “nur lesbare” Offline Version anlegen. Diese Version ist auch dann verwendbar, wenn Du keine Verbindung ins Internet hast. (Zum Beispiel zum Speichern von Login-Informationen bei einem Hotspot)</p> <p>Die “nur lesbare” Version ist genauso sicher, wie die änderbare Version auf dem Server. Deine Daten werden niemals entschlüsselt gespeichert - beide Versionen verwenden die gleiche Art der Verschlüsselung und Entschlüsselung direkt im Browser.</p> <ol> <li> <p>Klicke auf den untenstehenden Link um die Offline Version herunterzuladen.</p> </li> <li> <p>Der Browser fragt Dich, was Du mit der Datei “Clipperz_YYYYMMDD.zip” machen möchtest. Speichere Sie auf Deine Festplatte.</p> </li> <li> <p>Unzip (dekomprimiere) die Datei. Du erhälst das Verzeichnis “Clipperz_YYYYMMDD”.</p> </li> <li> <p>Öffne das Verzeichnis “Clipperz_YYYYMMDD” und mache einen Doppelklick auf die Datei “index.html”.</p> </li> <li> <p>Gib Deinen Clipperz Benutzernamen und Sicherheitsschlüssel ein, um Zugriff auf Deine persönlichen Daten auch ohne Internetzugang zu erhalten.</p> </li> </ol> ",
166 'offlineCopyDownloadLinkLabel':"Download",
167 'sharingTabLabel':"Freigabe für gemeinsame Nutzung",
168 'sharingTabTitle':"Freigabe für gemeinsame Nutzung",
169 'sharingTabDescription':"<p>Häufig muss eine vertrauenswürdige Information mit mehreren Personen geteilt werden.</p> <p>Dies sollte so einfach sein, wie einem Kollegen die PIN für den Anrufbeantworter zu geben, wenn Du im Urlaub bist; jedoch so schwierig, wie berechtigten Erben Zugriff auf das Ersparte bei der Bank zu geben.</p> <p>Clipperz ermöglicht die einfache Freigabe für gemeinsam genutzte Informationen, an berechtigte Personen, durch einen einfachen Prozess.</p> <p> </p> <p> <b>Mehr dazu in Kürze ...</b> </p> ",
170 'importTabLabel':"Import",
171 'importTabTitle':"Import",
172 'importTabDescription':"<p> <b>In Kürze ...</b> </p> ",
173 'printingTabLabel':"Export",
174 'printingTabTitle':"Export",
175 'printingTabDescription':"<p> <b>Drucke deine Kartendaten</b> </p> <p>Klicke auf den untenstehenden Link. Es öffnet sich ein Fenster mit Deinen Kartendaten in einem druckerfreundlichen Format.</p> <p>Wenn Du den Ausdruck aus Absicherungsgründen nutzen möchtest, nutze lieber die Variante der sichereren “Offline Kopie”. Ein Ausdruck ist wie eine Notiz auf dem Scheibtisch und könnte von jedem ohne weiteres gelesen werden. Bewahre diesen an einem sicheren, für andere nicht zugänglichen Ort auf!</p> ",
176 'printingLinkLabel':"Druckerfreundliches Format",
177 'contactsTabLabel':"Kontakte",
178 'contactsTabTitle':"Kontakte",
179 'bookmarkletTabLabel':"Bookmarklet",
180 'bookmarkletTabTitle':"Bookmarklet",
181 'bookmarkletTabDescription':"<p>Ein Bookmarklet ist ein Werkezug, welches Dir mit einem Mausklick wichtige Funktionen ermöglicht. Es kann gespeichert und verwendet werden wie eine ganz normale Webseite, die Du in Deine Favoriten gespeichert hast.</p> <p>Das clipperz Bookmarklet ermöglicht Dir schnell und einfach neue Karten und Direkt-Logins für bestehende Karten anzulegen.</p> <p> <b>Bitte beachte: Das Bookmarklet enthält keine Informationen zu Deinem Zugang (wie Benutzernamen oder Passwort), das Bookmarklet ist ein generisches Werzeug, welches für jeden Clipperz Anwender den gleichen Code beinhaltet.</b> </p> <div> <p>Um das Bookmarklet zu installieren <b>ziehe</b> den unten stehenden Link in die Lesezeichen-Leiste Deines Browsers.</p> </div> ",
182 'bookmarkletTabBookmarkletTitle':"Zu Clipperz hinzufügen",
183 'bookmarkletTabInstructions':"<h3>Anlegen einer neuen Karte für das Direkt Login bei einem Webservice</h3> <ol> <li> <p>Öffne die Webseite, auf der das Anmeldeforumlar vorhanden ist. (Das ist die Seite, auf der Du normal Deine Zugangsdaten einträgst)</p> </li> <li> <p>Öffne das Boormarklet durch anklicken: ein Pop-Up Fenster erscheint und bietet Dir die Karteninformationen an.</p> </li> <li> <p>Kopiere von diesem Fenster den Inhalt des größten Textfeldes durch in die Zwischenablage (Makieren und STRG+C)</p> </li> <li> <p>Öffne Deinen Clipperz Zugang und wähle <b>Neue Karte anlegen</b>.</p> </li> <li> <p>Füge den Inhalt Deiner Zwischenablage in das Textfeld ein (STRG+V) und ergänze optional einen <b>Titel</b>.</p> </li> <li> <p>Drücke die <b>Anlegen</b> Schaltfläche, kontrolliere nocheinmal die Details, und wähle anschließend <b>Speichern<b>.</p> </li> </ol> <h3>Direkt Login Funktionalität zu einer bestehenden Karte ergänzen</h3> <ol> <li> <p>Gleich wie oben.</p> </li> <li> <p>Gleich wie oben.</p> </li> <li> <p>Gleich wie oben.</p> </li> <li> <p>Öffne Deinen Clipperz Zugang und wähle die Karte, die Du ändern möchtest. Klicke anschließend auf <b>Bearbeiten</b>.</p> </li> <li> <p>Füge den Inhalt Deiner Zwischenablage in das Textfeld für “Direkt Login” ein (STRG+V).</p> </li> <li> <p>Drücke auf <b>Direkt Login hinzufügen</b>, kontrolliere die Angabgen und wähle <b>Speichern</b>.</p> </li> </ol> <p> </p> <p>Weitere Informationen über das Bookmarklet findest Du <a href=\"http://www.clipperz.com/support/user_guide/bookmarklet\" target=\"_blank\">hier</a>.</p> ",
184 'mainPanelDirectLoginBlockLabel':"Direktes Login",
185 'directLinkReferenceShowButtonLabel':"zeigen",
186 'mainPanelDirectLoginBlockDescription':"<p>Add “direct logins” to sign in to your web accounts without typing usernames and passwords!</p> <p>“Direct logins” greatly enhance your password security since you can:</p> <ul> <li> <p>conveniently adopt and enter complex passwords;</p> </li> <li> <p>never re-use the same and easy-to-guess password.</p> </li> </ul> <p>Simple and quick configuration with the Clipperz <b>bookmarklet</b>.</p> <a href=\"http://www.clipperz.com/support/user_guide/direct_logins\" target=\"_blank\">Learn more about “direct logins”</a> ",
187 'mainPanelRecordsBlockLabel':"Karten",
188 'mainPanelAddRecordButtonLabel':"Neue Karte anlegen",
189 'mainPanelRemoveRecordButtonLabel':"Karte löschen",
190 'mainPanelRecordFilterBlockAllLabel':"all",
191 'mainPanelRecordFilterBlockTagsLabel':"tags",
192 'mainPanelRecordFilterBlockSearchLabel':"search",
193 'recordDetailNoRecordAtAllTitle':"Willkommen bei Clipperz!",
194 'recordDetailNoRecordAtAllDescription':"<h5>Beginne mit dem Hinzufügen von Karten zu Deinem Zugang.</h5> <p>Karten sind einfache und flexible Formulare, bei denen Du Deine Passwörter und andere vertrauenswürde Daten speichern kannst.</p> <p>Karten können Zugangsinformationen für eine WebSite, die Kombination Deines Fahrradschlosses, oder Daten Deiner Kreditkarte enthalten, ...</p> <h5>Vergiss nicht das Bookmarklet</h5> <p>Bevor Du beginnst, installiere Dir das “Add to Clipperz” Bookmarklet: Es vereinfacht Dir das anlegen von Karten und verbessert somit den Komfor.</p> <p>Gehe zum “Bookmarklet” Tabulator um herauszufinden, wie es installiert und verwendet werden kann.</p> <p> </p> <p>Dann klicke einfach auf den <b>Neue Karte anlegen</b> Button und genieße Deinen Clipperz Zugang.</p> <p> </p> <a href=\"http://www.clipperz.com/support/user_guide/managing_cards\" target=\"_blank\">Näheres zum Erstellen und Verwalten von Karten lernen</a> ",
195 'newRecordWizardTitleBox':"<h5>Bitte wähle eine Vorlage</h5> <p>Karten sind einfache und flexible Formulare, bei denen Du Passwörter oder jede Art von vertraulichen Informationen speichern kannst.</p> <p>Beginne mit der Auswahl einer der unten stehenden Vorlagen. Zu jeder Zeit kannst Du Deine Karten durch hinzufügen oder entfernen von Feldern verändern.</p> ",
196 'newRecordWizardBookmarkletConfigurationTitle':"Direktes Login",
197 'newRecordWizardBookmarkletConfigurationDescription':"<p>Füge bitte unten den Konfigurationscode ein, den das Clipperz Bookmarklet erzeugt hat.</p> <p>Eine neue Karte mit einem vollständigen Direkt Login zu dem gewählten Webzugang wird angelegt.</p> ",
198 'newRecordWizardCreateButtonLabel':"Anlegen",
199 'newRecordWizardCancelButtonLabel':"Abbruch",
200 'recordTemplates':{
201 'WebAccount':{
202 'title':"Web Zugangsdaten",
203 'description':"<p>Eine einfache Karte, die die Login Informationen für einen Online Service speichert.</p> ",
204 'fields':{
205 'URL':"Web Adresse",
206 'TXT':"Benutzername / E-Mail",
207 'PWD':"Passwort"
208 }
209 },
210 'BankAccount':{
211 'title':"Bank Zugangsdaten",
212 'description':"<p>Speichere geschützt Deine Online Banking Zugangsdaten.</p> ",
213 'fields':{
214 'TXT':"Bank",
215 'TXT':"Kontonummer",
216 'URL':"Web Adresse",
217 'TXT':"Online Zugangsdaten",
218 'PWD':"Online Passwort"
219 }
220 },
221 'CreditCard':{
222 'title':"Kreditkarte",
223 'description':"<p>Kartennummer, CVV2, Ablaufdatum und PIN zu jeder Zeit abrufbar bei Clipperz.</p> ",
224 'fields':{
225 'TXT':"Art (Visa, AmEx, ...)",
226 'TXT':"Nummer",
227 'TXT':"Inhaber",
228 'TXT':"Ablaufdatum",
229 'TXT':"CVV2",
230 'PWD':"PIN",
231 'URL':"Webseite",
232 'TXT':"Online Zugangsdaten",
233 'PWD':"Passwort"
234 }
235 },
236 'AddressBookEntry':{
237 'title':"Adressbuch Eintrag",
238 'description':"<p>Clipperz kann auch als Dein neues privates Adressbuch agieren. Nutze diese Vorlage um einfach eine neuen Eintrag anzulegen.</p> ",
239 'fields':{
240 'TXT':"Name",
241 'TXT':"Email",
242 'TXT':"Telefon",
243 'TXT':"Handy",
244 'ADDR':"Adresse"
245 }
246 },
247 'Custom':{
248 'title':"Benutzerdefinierte Karte",
249 'description':"<p>Egal welche Art von vertraulichen Informationen Du speichern musst, mit der benutzerdefinierten Karte kannst Du diese Informationen speichern.</p> ",
250 'fields':{
251 'TXT':"Feldname 1",
252 'TXT':"Feldname 2",
253 'TXT':"Feldname 3"
254 }
255 }
256},
257 'recordFieldTypologies':{
258 'TXT':{
259 'description':"simple text field",
260 'shortDescription':"Text"
261 },
262 'PWD':{
263 'description':"simple text field, with default status set to hidden",
264 'shortDescription':"Passwort"
265 },
266 'URL':{
267 'description':"simple text field in edit mode, that became an active url in view mode",
268 'shortDescription':"Webadresse"
269 },
270 'DATE':{
271 'description':"a value set with a calendar helper",
272 'shortDescription':"Datum"
273 },
274 'ADDR':{
275 'description':"just like the URL, but the active link points to Google Maps (or similar service) passing the address value as argument",
276 'shortDescription':"Postanschrift"
277 },
278 'CHECK':{
279 'description':"check description",
280 'shortDescription':"check"
281 },
282 'RADIO':{
283 'description':"radio description",
284 'shortDescription':"radio"
285 },
286 'SELECT':{
287 'description':"select description",
288 'shortDescription':"select"
289 }
290},
291 'newRecordPanelGeneralExceptionTitle':"Fehler",
292 'newRecordPanelGeneralExceptionMessage':"Der Konfigurationstext ist nicht gültig. Stelle sicher, dass Du den Text des Bookmarket Pop-Up eingefügt hast und versuch es nocheinmal.",
293 'newRecordPanelWrongBookmarkletVersionExceptionTitle':"Fehler",
294 'newRecordPanelWrongBookmarkletVersionExceptionMessage':"Der Konfigurationstext wurde von einer älteren Version des Bookmarklets erstellt. Bitte aktualisiere Dein Bookmarklet und probiere es erneut.",
295 'newRecordPanelExceptionPanelCloseButtonLabel':"Abbruch",
296 'mainPanelDeletingRecordPanelConfirmationTitle':"Lösche ausgewählte Karte",
297 'mainPanelDeleteRecordPanelConfirmationText':"Möschtest Du wirklich die ausgewählte Karte löschen?",
298 'mainPanelDeleteRecordPanelConfirmButtonLabel':"Ja",
299 'mainPanelDeleteRecordPanelDenyButtonLabel':"Nein",
300 'mainPanelDeletingRecordPanelInitialTitle':"Lösche ausgewählte Karte",
301 'mainPanelDeletingRecordPanelCompletedText':"Fertig",
302 'deleteRecordPanelCollectRecordDataMessageTitle':"Karte löschen",
303 'deleteRecordPanelCollectRecordDataMessageText':"Aktualisiere Kartenliste",
304 'deleteRecordPanelEncryptUserDataMessageTitle':"Karte löschen",
305 'deleteRecordPanelEncryptUserDataMessageText':"Lokale Verschlüsselung der Karten Kopfdaten",
306 'deleteRecordPanelSendingDataToTheServerMessageTitle':"Karte löschen",
307 'deleteRecordPanelSendingDataToTheServerMessageText':"Lade verschlüsselte Karten Kopfdaten zu Clipperz hoch",
308 'deleteRecordPanelUpdatingTheInterfaceMessageTitle':"Karte löschen",
309 'deleteRecordPanelUpdatingTheInterfaceMessageText':"Aktualisiere Benutzerschnittstelle",
310 'recordDetailNoRecordSelectedTitle':"Keine Karte ausgewählt",
311 'recordDetailNoRecordSelectedDescription':"<p>Bitte wähle aus der linken Liste eine Karte aus.</p> ",
312 'recordDetailLoadingRecordMessage':"Lade verschlüsselte Karte von Clipperz runter",
313 'recordDetailDecryptingRecordMessage':"Lokale entschlüsselung der Kartendaten",
314 'recordDetailLoadingRecordVersionMessage':"Herunterladen der aktuellsten Kartenversion",
315 'recordDetailDecryptingRecordVersionMessage':"Lokale Entschlüsselung der aktuellen Version",
316 'recordDetailLoadingErrorMessageTitle':"Fehler beim Herunterladen der Karte",
317 'recordDetailNotesLabel':"Notiz",
318 'recordDetailLabelFieldColumnLabel':"Feld Namen",
319 'recordDetailDataFieldColumnLabel':"Feld Daten",
320 'recordDetailTypeFieldColumnLabel':"Art",
321 'recordDetailSavingChangesMessagePanelInitialTitle':"Speichere Karte",
322 'recordDetailAddFieldButtonLabel':"Neues Feld hinzufügen",
323 'recordDetailDirectLoginBlockTitle':"Direkt Logins",
324 'recordDetailNewDirectLoginDescription':"<p>Direkt Login Konfiguration</p> ",
325 'recordDetailDirectLoginBlockNoDirectLoginConfiguredDescription':"<p>Enthält diese Karte Informationen um Zugriff auf ein Online Service zu erhalten?</p> <p>Verwende das Bookmarklet um ein “Direkt Login” mit nur einem Klick von Clipperz zu konfigurieren.</p> ",
326 'recordDetailAddNewDirectLoginButtonLabel':"Neues Direktlogin hinzufügen",
327 'recordDetailEditButtonLabel':"Bearbeiten",
328 'recordDetailSaveButtonLabel':"Speichern",
329 'recordDetailCancelButtonLabel':"Abbruch",
330 'newRecordTitleLabel':"_neue Karte_",
331 'newDirectLoginLabelSuffix':"",
332 'recordSaveChangesPanelCollectRecordInfoMessageTitle':"Karte speichern",
333 'recordSaveChangesPanelCollectRecordInfoMessageText':"Aktualisierung der Karten Kopfdaten",
334 'recordSaveChangesPanelEncryptUserDataMessageTitle':"Karte speichern",
335 'recordSaveChangesPanelEncryptUserDataMessageText':"Lokale Verschlüsselung der Karten Kopfdaten",
336 'recordSaveChangesPanelEncryptRecordDataMessageTitle':"Karte speichern",
337 'recordSaveChangesPanelEncryptRecordDataMessageText':"Lokale Verschlüsselung der Karten Informationen",
338 'recordSaveChangesPanelEncryptRecordVersionDataMessageTitle':"Karte speichern",
339 'recordSaveChangesPanelEncryptRecordVersionDataMessageText':"Lokale Verschlüsselung der Karten Versions Informationen",
340 'recordSaveChangesPanelSendingDataToTheServerMessageTitle':"Karte speichern",
341 'recordSaveChangesPanelSendingDataToTheServerMessageText':"Verschlüsselte Karten Kopfdaten auf Clipperz hochladen",
342 'recordSaveChangesPanelUpdatingTheInterfaceMessageTitle':"Karte speichern",
343 'recordSaveChangesPanelUpdatingTheInterfaceMessageText':"Aktualisierung der Benutzerschnittstelle",
344 'exit':"<h2> <b>Auf Wiedersehen! Danke, dass Du Clipperz verwendet hast.</b> </h2> <ul> <li> <h3>Hinweis:</h3> <ul> <li> <p>Speichere diese Seite in Deine Favoriten, damit Du auch in Zukunft dich sicher mit Clipperz verbinden kannst (solltest Du dies nicht bereits getan haben)</p> </li> <li> <p>Clipperz wird Dir niemals eine E-Mail senden, weil wir Dich niemals nach Deiner E-Mail Anschrift gefragt haben (und dies auch nie werden) – öffne daher niemals eine Mail, die wvon Clipperz zu sein scheint</p> </li> </ul> </li> </ul> <p> </p> <p>In 10 Sekunden wirdst Du auf eine Seite von Wikipedia umgeleitet, wo Du über eine herausragende Sicherheitslücke informiert wirst.</p> ",
345 //'DWRUtilLoadingMessage':"Lade Daten ...",
346 'comingSoon':"In Kürze ...",
347 'panelCollectingEntryopyMessageText':"Sammlung",
348 'directLoginConfigurationCheckBoxFieldSelectedValue':"Ja",
349 'directLoginConfigurationCheckBoxFieldNotSelectedValue':"Nein",
350
351__syntaxFix__: "syntax fix"
352});
diff --git a/frontend/beta/js/Clipperz/PM/Strings/Strings_el-GR.js b/frontend/beta/js/Clipperz/PM/Strings/Strings_el-GR.js
new file mode 100644
index 0000000..37e0a96
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Strings/Strings_el-GR.js
@@ -0,0 +1,701 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29//=============================================================================
30//
31 // G R E E K (el_GR)
32//
33//=============================================================================
34
35Clipperz.PM.Strings.Languages['el-gr'] = MochiKit.Base.merge(Clipperz.PM.Strings.Languages['en-us'], {
36
37//-----------------------------------------------------
38 //Login page - description
39 'clipperzServiceDescriptionConfig': [
40 {tag:'h2', html:'Κρατήστε το για τον Εαυτό Σας'},
41 {tag:'ul', children:[
42 {tag:'li', children:[
43 {tag:'h3', html:'Το Clipperz είναι:'},
44 {tag:'ul', children:[
45 {tag:'li', children:[{tag:'span', html:'Ένας ασφαλής και απλός τρόπος διαχείρησης όλων των κωδικών πρόσβασης σας'}]},
46 {tag:'li', children:[{tag:'span', html:'Μια αποτελεσματική λύση πρόσβασης σε δεδομένα/εφαρμογές με μοναδικό κωδικό'}]},
47 {tag:'li', children:[{tag:'span', html:'Μια ψηφιακή θυρίδα για τα απόρρητα δεδομένα σας'}]}
48 ]}
49 ]},
50 {tag:'li', children:[
51 {tag:'h3', html:'Με το Clipperz μπορείτε:'},
52 {tag:'ul', children:[
53 {tag:'li', children:[{tag:'span', html:'Να αποθηκεύσετε και να διαχειριστείτε όλους τους κωδικούς πρόσβασης και τα online πιστοποιητικά/διαπιστευτήρια σας'}]},
54 {tag:'li', children:[{tag:'span', html:'Να έχετε πρόσβαση (login) στις υπηρεσίες διαδικτύου χωρίς την εισαγωγή oνομάτων λογαρισμών χρήστη (username),ή, κωδικών πρόσβασης (passwords)'}]},
55 {tag:'li', children:[{tag:'span', html:'Να προστατεύσετε όλα τα προσωπικά δεδομένα σας: κωδικούς συναγερμών, PINs, αριθμούς πιστωτικών καρτών, ...'}]},
56 {tag:'li', children:[{tag:'span', html:'Να μοιραστείτε δεδομένα με μέλη της οικογένεια σας και τους συνεργάτες σας (σύντομα στην διάθεση σας)'}]}
57 ]}
58 ]},
59 {tag:'li', children:[
60 {tag:'h3', html:'Τα πλεονεκτήματα του Clipperz είναι:'},
61 {tag:'ul', children:[
62 {tag:'li', children:[{tag:'span', html:'Είναι δωρεάν και προσφέρει πρόσβαση ανώνυμα'}]},
63 {tag:'li', children:[{tag:'span', html:'Μπορεί να χρησιμοποιηθεί οποαδήποτε ώρα και από οποιοδήποτε τερματικό'}]},
64 {tag:'li', children:[{tag:'span', html:'Δεν απαιτεί την φόρτωση και εγκατάσταση οποιουδήποτε λογισμικού'}]},
65 {tag:'li', children:[{tag:'span', html:'Αποφεύγετε την διατήριση απορρήτων στον υπολογιστή σας ή σε έντυπη μορφή'}]}
66 ]}
67 ]},
68 {tag:'li', children:[
69 {tag:'h3', html:'Η ασφάλεια που παρέχει το Clipperz:'},
70 {tag:'ul', children:[
71 {tag:'li', children:[{tag:'span', html:'Τα απόρρητα δεδομένα σας κωδικοποιούνται τοπικά από τον διακομιστή σας (browser) πρίν να φορτωθούν στο Clipperz'}]},
72 {tag:'li', children:[{tag:'span', html:'Το κλειδί της κωδικοποίησης είναι μία φράση-κωδικός γνωστή μόνο σε εσάς'}]},
73 {tag:'li', children:[{tag:'span', html:'Το Clipperz φυλάσσει τα προσωπικά σας δεδομένα σε κωδικοποιημένη μορφή, και δεν μπορεί να έχει πρόσβαση σε αυτά στην αρχική τους μορφή'}]},
74 {tag:'li', children:[{tag:'span', html:'Το Clipperz χρησιμοποιεί επίσημες /πρότυπες μεθόδους κωδικοποίησης, και όχι αόριστα και εφάνταστα μοντέλα'}]},
75 {tag:'li', children:[{tag:'span', html:'Έχετε πρόσβαση στον πηγαίο κώδικα οποτεδήποτε το θελήσετε, και δεν χρειάζετε να γνωρίζετε τίποτα από κρυπτογράφηση για να είστε ένας ευχαριστημένος χρήστης!'}]}
76 ]}
77 ]},
78 {tag:'li', children:[
79 {tag:'a', href:"http://www.clipperz.com", target:'_blank', html:'Μάθετε περισσότερα'}
80 ]}
81 ]}
82 ],
83
84 // Login page - form
85 'loginFormTitle': "Συνδεθείτε με τον Clipperz λογαριασμό σας",
86 'loginFormUsernameLabel': "Όνομα χρήστη",
87 'loginFormPassphraseLabel': "Κωδική φράση",
88 'loginFormDontHaveAnAccountLabel': "Δεν έχετε δημιουργήσει λογαριασμό?",
89 'loginFormCreateOneLabel': "Δημιουργήστε έναν",
90 'loginFormForgotYourCredentialsLabel': "Ξεχάσατε τα διαπιστευτήριά σας?",
91 'loginFormAarghThatsBadLabel': "Ααααργκ! Αυτό είναι κακό!",
92 'loginFormAfraidOfMaliciousScriptsLabel':"φοβάστε κακόβουλα προγράμματα (scripts)?",
93 'loginFormVerifyTheCodeLabel': "Επαληθεύστε τον κωδικό",
94 'loginFormButtonLabel': "Σύνδεση",
95
96// Login page - language selection
97 'loginPanelSwithLanguageDescriptionConfig':[
98 {tag:'h5', html:"Αλλάξτε στην γλώσσα προτήμησης σας"}
99 ],
100
101// Login page - browser compatibility
102 'browserCompatibilityDescriptionConfig':[
103 {tag:'p', html:"Έχετε μία καλύτερη και πιό ασφαλή Clipperz εμπειρία χρησιμοποιόντας τον Firefox. Ωστόσο το Clipperz συνεργάζετε άψογα με Opera και MS Internet Explorer!"}
104 ],
105
106// Login message panel
107 'loginMessagePanelInitialTitle': "Γίνεται σύνδεση ...",
108 'loginMessagePanelInitialButtonLabel': "Ακύρωση",
109 'loginMessagePanelConnectedTitle': "Συνδεθήκατε",
110 'loginMessagePanelConnectedText': "Ολοκληρώθηκε",
111 'loginMessagePanelFailureTitle': "Λάθος",
112 'loginMessagePanelFailureText': "Η σύνδεση χρήστη απέτυχε",
113 'loginMessagePanelFailureButtonLabel': "Κλείσιμο",
114
115// Login message panel - connection
116 'connectionLoginSendingCredentialsMessageTitle': "Γίνεται επαλήθευση διαπιστευτηρίων",
117 'connectionLoginSendingCredentialsMessageText': "Αποστέλλονται διαπιστευτήρια",
118 'connectionLoginCredentialsVerificationMessageTitle':"Γίνεται επαλήθευση διαπιστευτηρίων",
119 'connectionLoginCredentialsVerificationMessageText':"Εκτέλεση πιστοποίησης SRP ",
120 'connectionLoginDoneMessageTitle': "Γίνεται επαλήθευση διαπιστευτηρίων",
121 'connectionLoginDoneMessageText': "Συνδεδεμένος",
122
123 //Login message panel - user
124 'userLoginPanelUpgradingUserCredentialsMessageTitle': "Γίνεται επαλήθευση διαπιστευτηρίων",
125 'userLoginPanelUpgradingUserCredentialsMessageText': "Αναβάθμηση των διαπιστευτηρίων σας σε ένα νέο σζήμα πιστοποίησης",
126 'userLoginPanelConnectedMessageTitle': "Χρήστης πιστοποιήθηκε ",
127 'userLoginPanelConnectedMessageText': "Συνδεθήκατε με επιτυχία",
128 'userLoginPanelTryingAnOlderConnectionSchemaMessageTitle': "Γίνεται επαλήθευση διαπιστευτηρίων",
129 'userLoginPanelTryingAnOlderConnectionSchemaMessageText': "Trying an older authentication schema",
130 'userLoginPanelLoadingUserDataMessageTitle': "Χρήστης πιστοποιήθηκε ",
131 'userLoginPanelLoadingUserDataMessageText': "Downloading encrypted card headers from Clipperz",
132 'userLoginPanelDecryptingUserDataMessageTitle': "Χρήστης πιστοποιήθηκε ",
133 'userLoginPanelDecryptingUserDataMessageText': "Local decryption of card headers",
134 'userLoginPanelDecryptingUserStatisticsMessageTitle': "Χρήστης πιστοποιήθηκε ",
135 'userLoginPanelDecryptingUserStatisticsMessageText': "Local decryption of usage statistics",
136
137 //-----------------------------------------------------
138 //Registration page - splash alert
139 'splashAlertTitle':"Καλώς ήλθατε στο Clipperz!",
140 'splashAlertTextConfig': [
141 {tag:'p', html:'Μερικές συμβουλές ασφαλείας'},
142 {tag:'ul', children:[
143 {tag:'li', children:[{tag:'span', html:'Η αποθήκευση των δεδομένων σας στο Clipperz είναι τόσο ασφαλής, όσο η κωδική φράση που επιλέγετε για να τα προστατεύσετε. Κανένας δεν θα έχει πρόσβαση σε αυτά, εκτός αν γνωρίζει την κωδική φράση σας.'}]},
144 {tag:'li', children:[{tag:'span', html:'Αν πρόκειται να χρησιμοποιήσετε το Clipperz για ασφαλή προστασία ευαίσθητων ή σημαντικών πληροφοριών, βεβαιωθείτε ότι θα χρησιμοποιήσετε μία “γερή” κωδική φράση. Όσο μεγαλύτερη, τόσο καλύτερη!'}]},
145 {tag:'li', children:[{tag:'span', html:'Το Clipperz δεν θα έχει τη δυνατότητα να ανακτήσει μία χαμένη κωδική φράση!'}]}
146 ]},
147 {tag:'p', html:'Για περισσότερες πληροφορίες, παρακαλώ ανατρέξτε στο <a href=\"http://www.clipperz.com\" target=\"_blank\">Clipperz</a>.'}
148 ],
149 'splashAlertCloseButtonLabel':"Εντάξει",
150
151 // Registration page - form
152 'registrationFormTitle': "Δημιουργήστε λογαριασμό",
153 'registrationFormUsernameLabel': "Όνομα χρήστη",
154 'registrationFormPassphraseLabel': "Κωδική φράση",
155 'registrationFormRetypePassphraseLabel': "Εισάγετε ξανά την κωδική φράση",
156 'registrationFormSafetyCheckLabel': "Κατανοώ πως το Clipperz δεν θα μπορεί να ανακτήσει μία χαμένη κωδική φράση.",
157 'registrationFormTermsOfServiceCheckLabel': "Έχω διαβάσει και αποδέχομαι τους Όρους Χρήσης <a href='http://www.clipperz.com/terms_of_service' target='_blank'>Όρους Χρήσης</a>.",
158 'registrationFormDoYouAlreadyHaveAnAccountLabel': "Έχετε ήδη έναν λογαριασμό?",
159 'registrationFormSimplyLoginLabel': "απλώς συνδεθείτε",
160 'registrationFormButtonLabel': "Εγγραφείτε",
161
162// Registration page - warning messages
163 'registrationFormWarningMessageNotMatchingPassphrases':"Οι κωδικές φράσεις που εισάγατε δεν ταιριάζουν. Παρακαλώ ξαναπροσπαθήστε.",
164 'registrationFormWarningMessageSafetyCheckNotSelected':"Παρακαλώ διαβάστε και επιλέξτε όλες τις παρακάτω επιλογές.",
165 'registrationFormWarningMessageTermsOfServiceCheckNotSelected':"Πρέπει να αποδεχθείτε τους Όρους Χρήσης.",
166
167 // Registration message panel
168 'registrationMessagePanelInitialTitle': "Δημιουργία λογαριασμού ...",
169 'registrationMessagePanelInitialButtonLabel': "Ακύρωση",
170 'registrationMessagePanelRegistrationDoneTitle': "Εγγραφή",
171 'registrationMessagePanelRegistrationDoneText': "Ολοκληρώθηκε",
172 'registrationMessagePanelFailureTitle': "Η εγγραφή απέτυχε",
173 'registrationMessagePanelFailureButtonLabel': "Κλείσιμο",
174
175// Registration - connection
176 'connectionRegistrationSendingRequestMessageText': "Γίνεται επαλήθευση διαπιστευτηρίων",
177 'connectionRegistrationSendingCredentialsMessageText':"Αποστέλλονται διαπιστευτήρια",
178
179 //-----------------------------------------------------
180// Registration splash panel
181 'registrationSplashPanelTitle':"Συμβουλές Ασφαλείας",
182 'registrationSplashPanelDescriptionConfig': [
183 {tag:'p', html:'Αυτά είναι τα διαπιστευτήριά σας στο Clipperz, δείτε τα προσεκτικά. Το Clipperz δεν θα απεικονίσει το όνομα χρήστη και την κωδική σας φράση δεύτερη φορά!'}
184 ],
185 'registrationSplashPanelUsernameLabel': "όνομα χρήστη",
186 'registrationSplashPanelPassphraseLabel':"κωδική φράση",
187
188 //-----------------------------------------------------
189 //Header links
190 'donateHeaderLinkLabel':"donate",
191 'creditsHeaderLinkLabel':"credits",
192 'feedbackHeaderLinkLabel':"feedback",
193 'helpHeaderLinkLabel': "Βοήθεια",
194 'forumHeaderLinkLabel': "forum",
195
196 //-----------------------------------------------------
197 //Menu labels
198 'recordMenuLabel': "cards",
199 'accountMenuLabel': "Λογαριασμός",
200 'dataMenuLabel': "Δεδομένα",
201 'contactsMenuLabel':"Επαφές",
202 'bookmarkletMenuLabel':"bookmarklet",
203 'logoutMenuLabel': "Αποσύνδεση",
204 'lockMenuLabel': "lock",
205
206//-----------------------------------------------------
207 //Lock dialog
208 'lockTitle': "The account is locked",
209 'lockDescriptionConfig':[
210 {tag:'p', html:'To unlock your account, please insert your passphrase'}
211 ],
212 'unlockButtonLabel': "Unlock",
213
214//-----------------------------------------------------
215 //Account panel - change passphrase
216 'changePasswordTabLabel':"Αλλάξτε την κωδική φράση σας",
217 'changePasswordTabTitle':"Αλλάξτε την κωδική φράση σας",
218
219 //Account panel - change passphrase - form
220 'changePasswordFormUsernameLabel': "όνομα χρήστη",
221 'changePasswordFormOldPassphraseLabel': "παλαιά κωδική φράση",
222 'changePasswordFormNewPassphraseLabel': "νέα κωδική φράση",
223 'changePasswordFormRetypePassphraseLabel':"Εισάγετε ξανά τη νέα κωδική φράση",
224 'changePasswordFormSafetyCheckboxLabel':"Κατανοώ πως το Clipperz δεν θα μπορεί να ανακτήσει μία χαμένη κωδική φράση.",
225 'changePasswordFormSubmitLabel': "Αλλάξτε την κωδική φράση σας",
226
227 //Account panel - change passphrase - warnings
228 'changePasswordFormWrongUsernameWarning': "Λάθος όνομα χρήστη",
229 'changePasswordFormWrongPassphraseWarning': "Λάθος κωδική φράση",
230 'changePasswordFormWrongRetypePassphraseWarning':"Οι κωδικές φράσεις που εισάγατε δεν ταιριάζουν. Παρακαλώ ξαναπροσπαθήστε.",
231 'changePasswordFormSafetyCheckWarning': "Παρακαλώ διαβάστε και επιλέξτε όλες τις παρακάτω επιλογές.",
232
233 //Account panel - change passphrase - progress dialog
234 'changePasswordFormProgressDialogTitle': "Γίνεται αλλαγή διαπιστευτηρίων χρήστη",
235 'changePasswordFormProgressDialogConnectedMessageTitle': "Συνδεδεμένος",
236 'changePasswordFormProgressDialogConnectedMessageText': "Ολοκληρώθηκε",
237 'changePasswordFormProgressDialogErrorMessageTitle': "Σφάλμα",
238 'changePasswordFormProgressDialogErrorMessageText': "Απέτυχε η αλλαγή διαπιστευτηρίων!",
239
240 'changeCredentialsPanelEncryptingDataMessageTitle': "Γίνεται αλλαγή της κωδικής φράσης σας",
241 'changeCredentialsPanelEncryptingDataMessageText': "Local encryption of card headers",
242 'changeCredentialsPanelCreatingNewCredentialsMessageTitle': "Γίνεται αλλαγή της κωδικής φράσης σας",
243 'changeCredentialsPanelCreatingNewCredentialsMessageText': "Γίνεται ανανέωση των διαπιστευτηρίων σας",
244 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageTitle':"Γίνεται αλλαγή της κωδικής φράσης σας",
245 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageText':"Uploading your encrypted credentials to Clipperz",
246 'changeCredentialsPanelDoneMessageTitle': "Γίνεται αλλαγή της κωδικής φράσης σας",
247 'changeCredentialsPanelDoneMessageText': "Ολοκληρώθηκε",
248
249//-----------------------------------------------------
250 //Account panel - manage OTP
251 'manageOTPTabLabel': "Manage your one-time passphrases",
252 'manageOTPTabTitle': "Manage your one-time passphrases",
253
254 // Account panel - manage OTP - description
255 'manageOTPTabDescriptionConfig':[
256 {tag:'p', html:"A one-time passphrase works like your regular passphrase, but can be used only once."},
257 {tag:'p', html:"If the same passphrase is used again at a later stage in a login attempt it will be rejected and the login process will fail."},
258 {tag:'p', html:"Immediately after a successful login, your one-time passphrase will be deleted preventing any fraudulent access."},
259 {tag:'p', html:"One-time passwords are an excellent choice if one is concerned about keyloggers or spyware infections that may be collecting data from compromised machines."},
260 {tag:'p', html:"<b>It's strongly advisable to use one-time passphrases when accessing Clipperz from public terminals, such as Internet cafes and libraries.</b>"},
261 {tag:'p', html:""},
262 {tag:'p', html:"<b>Coming soon ...</b>"}
263 ],
264
265//-----------------------------------------------------
266// Account panel - user preferences
267 'accountPreferencesLabel': "Προτιμήσεις",
268 'accountPreferencesTabTitle': "Προτιμήσεις",
269
270// Account panel - user preferences - description
271 'accountPreferencesLanguageTitle':"Επιλογή Γλώσσας",
272 'accountPreferencesLanguageDescriptionConfig': [
273 {tag:'p', html:"Choose your preferred language from the list below."}
274 ],
275
276 'accountPreferencesInterfaceTitle':"Interface customization",
277 'accountPreferencesInterfaceDescriptionConfig': [
278 {tag:'p', html:"Tune the Clipperz interface to your needs."}
279 ],
280
281// Account panel - user preferences - form
282 'saveUserPreferencesFormSubmitLabel': "Αποθήκευση",
283 'cancelUserPreferencesFormSubmitLabel': "Ακύρωση",
284
285// Account panel - user preferences - panel
286 'accountPreferencesSavingPanelTitle_Step1': "Saving preferences",
287 'accountPreferencesSavingPanelText_Step1': "Local encryption of your preferences",
288 'accountPreferencesSavingPanelTitle_Step2': "Saving preferences",
289 'accountPreferencesSavingPanelText_Step2': "Sending encrypted preferences to Clipperz",
290
291//-----------------------------------------------------
292 //Account panel - delete account
293 'deleteAccountTabLabel': "Διαγράψτε τον λογαριασμό σας",
294 'deleteAccountTabTitle':"Γίνεται διαγραφή του λογαριασμού σας",
295
296 //Account panel - delete account - form
297 'deleteAccountFormUsernameLabel': "όνομα χρήστη",
298 'deleteAccountFormPassphraseLabel': "κωδική φράση",
299 'deleteAccountFormSafetyCheckboxLabel':"Κατανοώ πως όλα τα δεδομένα μου θα διαγραφούν και πως αυτή η πράξη είναι μη αναστρέψιμη.",
300 'deleteAccountFormSubmitLabel': "Διαγράψτε τον λογαριασμό μου",
301
302 //Account panel - delete account - warnings
303 'deleteAccountFormWrongUsernameWarning':"λάθος όνομα χρήστη",
304 'deleteAccountFormWrongPassphraseWarning':"λάθος κωδική φράση",
305 'deleteAccountFormSafetyCheckWarning': "Παρακαλώ διαβάστε και επιλέξτε την παρακάτω επιλογή.",
306
307 //Account panel - delete account - confirmation
308 'accountPanelDeletingAccountPanelConfirmationTitle':"ΠΡΟΣΟΧΗ",
309 'accountPanelDeleteAccountPanelConfirmationText': "Είστε σίγουρος/η ότι θέλετε να διαγράψετε αυτόν τον λογαριασμό?",
310 'accountPanelDeleteAccountPanelConfirmButtonLabel': "Ναι",
311 'accountPanelDeleteAccountPanelDenyButtonLabel': "Όχι",
312
313//-----------------------------------------------------
314 //Data panel - offline copy
315 'offlineCopyTabLabel':"Offline copy",
316 'offlineCopyTabTitle':"Offline copy",
317
318 // Data panel - offline copy - description
319 'offlineCopyTabDescriptionConfig': [
320 {tag:'p', html:"With just one click you can dump all your encrypted data from Clipperz servers to your hard disk and create a read-only offline version of Clipperz to be used when you are not connected to the Internet."},
321 {tag:'p', html:"The read-only version is as secure as the read-and-write one and will not expose your data to higher risks since they both share the same code and security architecture."},
322 {tag:'ol', children:[
323 {tag:'li', children:[{tag:'span', html:"Click the link below to download the offline copy."}]},
324 {tag:'li', children:[{tag:'span', html:"The browser will ask you what to do with the “Clipperz_YYYYMMDD.zip” file. Save it on your hard disk."}]},
325 {tag:'li', children:[{tag:'span', html:"Unzip the file to reveal the “Clipperz_YYYYMMDD” folder."}]},
326 {tag:'li', children:[{tag:'span', html:"Open the “Clipperz_YYYYMMDD” folder and double click on the “index.html” file."}]},
327 {tag:'li', children:[{tag:'span', html:"Enter the usual username and passphrase and access your private data without an Internet connection."}]}
328 ]}
329 ],
330 'offlineCopyDownloadLinkLabel':"Download",
331
332//-----------------------------------------------------
333 //Data panel - sharing
334 'sharingTabLabel':"Sharing",
335 'sharingTabTitle':"Sharing",
336
337 //Data panel - sharing - description
338 'sharingTabDescriptionConfig':[
339 {tag:'p', html:"Quite often a confidential piece of information needs to be shared with one or more persons."},
340 {tag:'p', html:"This could be as simple as giving your colleague the access code of your voice mailbox when you are out of the office, or as complicated as enabling the entitled heirs to access your safe deposit box at the local bank when you pass on."},
341 {tag:'p', html:"Clipperz can make sharing your secrets a secure and straightforward process."},
342 {tag:'p', html:""},
343 {tag:'p', html:"<b>Coming soon ...</b>"}
344 ],
345
346//-----------------------------------------------------
347 // Data panel - import
348 'importTabLabel':"Εισαγωγή",
349 'importTabTitle':"Εισαγωγή",
350
351 // Data panel - import - description
352 'importTabDescriptionConfig':[
353 {tag:'p', html:"<b>Σύντομα κοντά σας ...</b>"}
354 ],
355
356//-----------------------------------------------------
357 //Data panel - export
358 'printingTabLabel':"Εξαγωγή",
359 'printingTabTitle':"Εξαγωγή",
360
361 //Data panel - export - description “”
362 'printingTabDescriptionConfig':[
363 {tag:'p', html:"<b>Print your data</b>"},
364 {tag:'p', html:"Clicking on the link below will open a new window displaying all your cards in a printable format."},
365 {tag:'p', html:"If you are going to print for backup purposes, please consider the more safe option provided by the creating an “offline copy”."}
366 ],
367 'printingLinkLabel':"Έκδοση Εκτύπωσης",
368
369//-------------------------------------------------------------------
370 //Contacts panel
371 'contactsTabLabel':"Contacts",
372 'contactsTabTitle':"Contacts",
373
374//-------------------------------------------------------------------
375 //Bookmarklet panel
376 'bookmarkletTabLabel': "Bookmarklet",
377 'bookmarkletTabTitle': "Bookmarklet",
378
379 //Bookmarklet panel - description
380 'bookmarkletTabDescriptionConfig':[
381 {tag:'p', html:"A bookmarklet is a simple “one-click” tool that can perform very useful tasks. It can be saved and used like a normal web page bookmark."},
382 {tag:'p', html:"The Clipperz bookmarklet will help you to quickly create new cards and new “direct logins” within existing cards."},
383 {tag:'p', html:"<b>Please note that the bookmarklet does not include any information related to your account (e.g. your username or passphrase), the bookmarklet is a general tool containing the same code for every Clipperz user.</b>"},
384 {tag:'div', children:[
385 {tag:'p', html:"To install the bookmarklet <b>drag</b> the link below to the bookmark bar of your browser."}
386 ]}
387 ],
388 'bookmarkletTabBookmarkletTitle':"Προσθήκη στο Clipperz",
389
390 //Bookmarklet panel - instructions
391 'bookmarkletTabInstructionsConfig':[
392 {tag:'h3', html:"How to create a new card inclusive of a “direct login” link to an online service"},
393 {tag:'ol', children:[
394 {tag:'li', children:[{tag:'span', html:"Open the web page where the login form is hosted. (this is the page where you usually enter your sign-in credentials)"}]},
395 {tag:'li', children:[{tag:'span', html:"Launch the bookmarklet by clicking on it: a pop-up window will appear over the web page."}]},
396 {tag:'li', children:[{tag:'span', html:"Copy to the clipboard the content of the large text area within the pop-up. (ctrl-C)"}]},
397 {tag:'li', children:[{tag:'span', html:"Enter your Clipperz account and click on the <b>Add new card</b> button."}]},
398 {tag:'li', children:[{tag:'span', html:"Select the “Direct login” template and paste the content of the clipboard to the large text area in the form. (ctrl-V)"}]},
399 {tag:'li', children:[{tag:'span', html:"Press the <b>Create</b> button, complete and review the details, then click <b>Save</b>."}]}
400 ]},
401 {tag:'h3', html:"How to add a “direct login” link to an existing card"},
402 {tag:'ol', children:[
403 {tag:'li', children:[{tag:'span', html:"Same as above."}]},
404 {tag:'li', children:[{tag:'span', html:"Same as above."}]},
405 {tag:'li', children:[{tag:'span', html:"Same as above."}]},
406 {tag:'li', children:[{tag:'span', html:"Enter your Clipperz account and select the card containing the credentials for the web service you just visited and click the <b>Edit</b> button."}]},
407 {tag:'li', children:[{tag:'span', html:"Paste the content of the clipboard to the large text area in the “Direct logins” section. (ctrl-V)"}]},
408 {tag:'li', children:[{tag:'span', html:"Press the <b>Add direct login</b> button, review the details and then click <b>Save</b>."}]}
409 ]},
410 {tag:'p', html:""},
411 {tag:'p', html:"Further information about the bookmarklet are <a href=\"http://www.clipperz.com/support/user_guide/bookmarklet\" target=\"_blank\">available here</a>."}
412 ],
413
414//-------------------------------------------------------------------
415// Direct logins block
416 'mainPanelDirectLoginBlockLabel': "Απευθείας σύνδεση",
417 'directLinkReferenceShowButtonLabel':"Επίδειξη",
418
419 // Direct logins - blank slate“”
420 'mainPanelDirectLoginBlockDescriptionConfig': [
421 {tag:'p', html:"Add “direct logins” to sign in to your web accounts without typing usernames and passwords!"},
422 {tag:'p', html:"“Direct logins” greatly enhance your password security since you can:"},
423 {tag:'ul', children:[
424 {tag:'li', children:[{tag:'span', html:"conveniently adopt and enter complex passwords;"}]},
425 {tag:'li', children:[{tag:'span', html:"never re-use the same and easy-to-guess password."}]}
426 ]},
427 {tag:'p', html:"Simple and quick configuration with the Clipperz <b>bookmarklet</b>."},
428 {tag:'a', href:"http://www.clipperz.com/support/user_guide/direct_logins", target:'_blank', html:'Learn more about “direct logins”'}
429 ],
430
431//-------------------------------------------------------------------
432 // Cards block
433 'mainPanelRecordsBlockLabel': "Κάρτες",
434 'mainPanelAddRecordButtonLabel': "Προσθήκη νέας Κάρτας ",
435 'mainPanelRemoveRecordButtonLabel': "Διαγραφή κάρτας",
436
437// Cards block - filter tabs
438 'mainPanelRecordFilterBlockAllLabel': "Όλα",
439 'mainPanelRecordFilterBlockTagsLabel': "Επιλογές",
440 'mainPanelRecordFilterBlockSearchLabel':"Αναζήτηση",
441
442// Cards block - blank slate
443 'recordDetailNoRecordAtAllTitle': "Welcome to Clipperz!",
444 'recordDetailNoRecordAtAllDescriptionConfig':[
445 {tag:'h5', html:'Get started by adding cards to your account.'},
446 {tag:'p', html:'Cards are simple and flexible forms where you can store your passwords and any other confidential data.'},
447 {tag:'p', html:'Cards could contain credentials for accessing a web site, the combination of your bicycle lock, details of your credit card, ...'},
448 {tag:'h5', html:'Don\'t forget the bookmarklet!'},
449 {tag:'p', html:'Before you start, install the “Add to Clipperz” bookmarklet: it will make creating cards easier and more fun.'},
450 {tag:'p', html:'Go to the bookmarklet tab to discover how to install it and how it use it.'},
451 {tag:'p', html:''},
452 {tag:'p', html:'Then simply click the <b>"Add new card"</b> button and enjoy your Clipperz account.'},
453 {tag:'p', html:''},
454 {tag:'a', href:"http://www.clipperz.com/support/user_guide/managing_cards", target:'_blank', html:'Learn more about creating and managing cards'}
455 ],
456
457// Cards block - new card wizard - bookmarklet configuration
458 'newRecordWizardTitleBoxConfig': [
459 {tag:'h5', html:"Please select a template"},
460 {tag:'p', html:'Cards are simple and flexible forms where you can store passwords or any other confidential data.'},
461 {tag:'p', html:'Start choosing one of the template below. You can always customize your cards later by adding or removing fields.'}
462 ],
463
464 'newRecordWizardBookmarkletConfigurationTitle': "Απευθείας σύνδεση",
465 'newRecordWizardBookmarkletConfigurationDescriptionConfig': [
466 {tag:'p', html:"Paste below the configuration code generated by the Clipperz bookmarklet."},
467 {tag:'p', html:"A new card complete with a direct login to your web account will be created."}
468 ],
469
470 'newRecordWizardCreateButtonLabel':"Δημιουργία",
471 'newRecordWizardCancelButtonLabel':"Ακύρωση",
472
473//-------------------------------------------------------------------
474// Card templates
475//-------------------------------------------------------------------
476
477 'recordTemplates': {
478
479 //Web password
480 'WebAccount': {
481 'title': "Web password",
482 'description': [
483 {tag:'p', html:"A simple card to store login credentials for your online services."}
484 ],
485 'fields': [
486 {label:"Διεύθυνση δικτύου", type:'URL'},
487 {label:"Χρήστης ή διεύθυνση ηλεκτρονικού ταχυδρομείου", type:'TXT'},
488 {label:"Κωδικός Πράσβασης", type:'PWD'}
489 ]
490 },
491
492 // Bank account
493 'BankAccount': {
494 'title': "Bank account",
495 'description': [
496 {tag:'p', html:"Safely store your bank account number and online banking credentials."}
497 ],
498 'fields': [
499 {label:"Τράπεζα", type:'TXT'},
500 {label:"Αριθμός λογαριασμού", type:'TXT'},
501 {label:"Ιστοσελίδα τράπεζας", type:'URL'},
502 {label:"Αρ. Ηλεκτρονικής τράπεζας (ID)", type:'TXT'},
503 {label:"Κώδικος Ηλεκτρονικής τράπεζας", type:'PWD'}
504 ]
505 },
506
507 // Credit card
508 'CreditCard': {
509 'title': "Credit card",
510 'description': [
511 {tag:'p', html:"Card number, expire date, CVV2 and PIN always at hand with Clipperz."}
512 ],
513 'fields': [
514 {label:"Τύπος Κάρτας (Visa, AmEx,...)", type:'TXT'},
515 {label:"Αριθμός κάρτα", type:'TXT'},
516 {label:"Ονοματεπώνυμο κατόχου", type:'TXT'},
517 {label:"Ημερομηνία λήξης", type:'TXT'},
518 {label:"CVV2", type:'TXT'},
519 {label:"Κωδικός Αυτόματης ταμείακης μηχανης (ΑΤΜ)", type:'PWD'},
520 {label:"Ιστοσελίδα κάρτας", type:'URL'},
521 {label:"Χρήστης", type:'TXT'},
522 {label:"Κωδικός Πρόσβασης", type:'PWD'}
523 ]
524 },
525
526 // Address book entry
527 'AddressBookEntry': {
528 'title': "Address book entry",
529 'description': [
530 {tag:'p', html:"Clipperz could also work as your new private address book. Use this template to easily add a new entry."}
531 ],
532 'fields': [
533 {label:"Όνομα", type:'TXT'},
534 {label:"Ηλετρονικό ταχυδρομείο", type:'TXT'},
535 {label:"Τηλέφωνο", type:'TXT'},
536 {label:"Κινητο τηλέφωνο", type:'TXT'},
537 {label:"Διεύθυνση", type:'ADDR'},
538 ]
539 },
540
541 //Custom card
542 'Custom': {
543 'title': "Custom card",
544 'description': [
545 {tag:'p', html:"No matter which kind of confidential data you need to protect, create a custom card to match your needs."}
546 ],
547 'fields': [
548 {label:"Περιγραφή 1", type:'TXT'},
549 {label:"Περιγραφή 2", type:'TXT'},
550 {label:"Περιγραφή 3", type:'TXT'}
551 ]
552 }
553 },
554
555
556 'recordFieldTypologies': {
557 'TXT': {
558 description: 'simple text field',
559 shortDescription: '΄Κείμενο'
560 },
561 'PWD': {
562 description: 'simple text field, with default status set to hidden',
563 shortDescription: 'Κωδικός Πρόσβασης'
564 },
565 'URL': {
566 description: 'simple text field in edit mode, that became an active url in view mode',
567 shortDescription: 'Διεύθυνση ηλεκτρονικού ταχυδρομείου'
568 },
569 'DATE': {
570 description: 'a value set with a calendar helper',
571 shortDescription: 'Ημερομηνία'
572 },
573 'ADDR': {
574 description: 'just like the URL, but the active link points to Google Maps (or similar service) passing the address value as argument',
575 shortDescription: 'Διεύθυνση'
576 },
577 'CHECK': {
578 description: 'check description',
579 shortDescription: 'check'
580 },
581 'RADIO': {
582 description: 'radio description',
583 shortDescription: 'radio'
584 },
585 'SELECT': {
586 description: 'select description',
587 shortDescription: 'select'
588 }
589 },
590
591// Cards block - new card - warnings
592 'newRecordPanelGeneralExceptionTitle': "Σφάλμα",
593 'newRecordPanelGeneralExceptionMessage': "The configuration text is not valid. Make sure to get your text from the bookmarklet pop-up and retry.",
594 'newRecordPanelWrongBookmarkletVersionExceptionTitle': "Σφάλμα",
595 'newRecordPanelWrongBookmarkletVersionExceptionMessage':"The configuration text has been generated by an old version of the bookmarklet. Please update your bookmarklet and retry.",
596 'newRecordPanelExceptionPanelCloseButtonLabel': "Ακύρωση",
597
598// Cards block - delete card
599 'mainPanelDeletingRecordPanelConfirmationTitle':"Διαγραφή επιλεγμένης κάρτας",
600 'mainPanelDeleteRecordPanelConfirmationText': "Είστε σίγουρος ότι θέλετε να διαγράψετε την επιλεγμένη κάρτα?",
601 'mainPanelDeleteRecordPanelConfirmButtonLabel': "Ναι",
602 'mainPanelDeleteRecordPanelDenyButtonLabel': "Όχι",
603 'mainPanelDeletingRecordPanelInitialTitle': "Διαγραφή επιλεγμένης κάρτας ",
604 'mainPanelDeletingRecordPanelCompletedText': "Ολοκλήρωση",
605
606// Cards block - delete card panel
607 'deleteRecordPanelCollectRecordDataMessageTitle': "Διαγραφή κάρτας",
608 'deleteRecordPanelCollectRecordDataMessageText': "Φόρτωση λίστα κάρτας",
609 'deleteRecordPanelEncryptUserDataMessageTitle': "Διαγραφή κάρτας",
610 'deleteRecordPanelEncryptUserDataMessageText': "Local encryption of card headers",
611 'deleteRecordPanelSendingDataToTheServerMessageTitle': "Διαγραφή κάρτας",
612 'deleteRecordPanelSendingDataToTheServerMessageText': "Uploading encrypted card headers to Clipperz",
613 'deleteRecordPanelUpdatingTheInterfaceMessageTitle': "Διαγραφή κάρτας",
614 'deleteRecordPanelUpdatingTheInterfaceMessageText': "Φόρτωση επιφάνειας",
615
616// Cards block - no record selected
617 'recordDetailNoRecordSelectedTitle': "Δεν έχει επιλεγεί κάποια κάρτα",
618 'recordDetailNoRecordSelectedDescriptionConfig':[
619 {tag:'p', html:'Παρακαλώ επιλέξτε μια κάρτα από αυτές που βρίσκονται στα αριστερά σας'}
620 ],
621
622 // Cards block - loading messages
623 'recordDetailLoadingRecordMessage': "Downloading encrypted card from Clipperz",
624 'recordDetailDecryptingRecordMessage': "Τοπικη αποκωδικοποίηση αρχείων κάρτας",
625 'recordDetailLoadingRecordVersionMessage': "Φόρτωση τελευταίας έκδοσης κάρτας",
626 'recordDetailDecryptingRecordVersionMessage':"Τοπική αποκωδικοποίηση της τελευταίας έκδοσης",
627 'recordDetailLoadingErrorMessageTitle': "Σφάλμα στη φόρτωση της κάρτας",
628
629// Cards block - card details
630 'recordDetailNotesLabel': "Σημειώσης",
631 'recordDetailLabelFieldColumnLabel': "Περιγραφή πεδίου",
632 'recordDetailDataFieldColumnLabel': "Στοιχεία πεδίου",
633 'recordDetailTypeFieldColumnLabel': "Τύπος",
634
635 'recordDetailSavingChangesMessagePanelInitialTitle':"Αποθήκευση κάρτας",
636
637 'recordDetailAddFieldButtonLabel': "Προσθέστε νέο πεδίο",
638 'recordDetailPasswordFieldHelpLabel': "Για αντιγραφή του κωδικού στο clipboard επιλέξτε τα αστεράκια και μετα Ctrl-C",
639
640 'recordDetailDirectLoginBlockTitle': "Κωδικός Πρόσβασης",
641 'recordDetailNewDirectLoginDescriptionConfig': [
642 {tag:'p', html:'Επικύρωση κωδικου πρόσβασης'}
643 ],
644
645 'recordDetailDirectLoginBlockNoDirectLoginConfiguredDescriptionConfig':[
646 {tag:'p', html:"Does this card contain credentials to access an online service?"},
647 {tag:'p', html:"Use the bookmarklet to configure a “direct login” from Clipperz with just one click!"}
648 ],
649 'recordDetailAddNewDirectLoginButtonLabel': "Προσθέστε νέο κωδικό πρόσβασης",
650
651 'recordDetailEditButtonLabel': "Edit",
652 'recordDetailSaveButtonLabel': "Αποθήκευση",
653 'recordDetailCancelButtonLabel':"Ακύρωση",
654
655 'newRecordTitleLabel': "_Νέα κάρτα_",
656
657// Cards block - save card panel
658 'recordSaveChangesPanelCollectRecordInfoMessageTitle': "Αποθήκευση κάρτας",
659 'recordSaveChangesPanelCollectRecordInfoMessageText': "Updating card headers",
660 'recordSaveChangesPanelEncryptUserDataMessageTitle': "Αποθήκευση κάρτας",
661 'recordSaveChangesPanelEncryptUserDataMessageText': "Local encryption of card headers",
662 'recordSaveChangesPanelEncryptRecordDataMessageTitle': "Αποθήκευση κάρτας",
663 'recordSaveChangesPanelEncryptRecordDataMessageText': "Local encryption of card's data",
664 'recordSaveChangesPanelEncryptRecordVersionDataMessageTitle':"Αποθήκευση κάρτας",
665 'recordSaveChangesPanelEncryptRecordVersionDataMessageText':"Local encryption of card's version data",
666 'recordSaveChangesPanelSendingDataToTheServerMessageTitle': "Αποθήκευση κάρτας",
667 'recordSaveChangesPanelSendingDataToTheServerMessageText': "Uploading encrypted card's header to Clipperz",
668 'recordSaveChangesPanelUpdatingTheInterfaceMessageTitle': "Αποθήκευση κάρτας",
669 'recordSaveChangesPanelUpdatingTheInterfaceMessageText': "Φόρτωση επιφάνειας",
670
671 // Exit page
672 'exitConfig': [
673 {tag:'h2', html:'<b>Goodbye! Thanks for using Clipperz.</b>'},
674
675 {tag:'ul', children:[
676 {tag:'li', children:[
677 {tag:'h3', html:'Remember:'},
678 {tag:'ul', children:[
679 {tag:'li', children:[{tag:'span', html:'Bookmark this page to safely connect to Clipperz in the future (if you haven\'t already done it)'}]},
680 {tag:'li', children:[{tag:'span', html:'Clipperz will never send you an email, because we never asked your email address (and we never will), so never open an email that says it\'s from Clipperz'}]}
681 ]}
682 ]}
683 ]},
684 {tag:'p', html:""},
685 {tag:'p', html:"In 10 seconds you will be redirected to a Wikipedia page where you can read about a major security issue ..."}
686 ],
687
688//-------------------------------------------------------------------
689 // Miscellaneous strings
690 //-------------------------------------------------------------------
691
692 // 'DWRUtilLoadingMessage': "Φόρτωση δεδομένων ...",
693 'comingSoon': "Σύντομα κοντά σας ...",
694 'panelCollectingEntryopyMessageText': "Collecting entropy",
695 'directLoginConfigurationCheckBoxFieldSelectedValue': "Ναι",
696 'directLoginConfigurationCheckBoxFieldNotSelectedValue':"Όχι",
697
698 //-------------------------------------------------------------------------
699 __syntaxFix__: "syntax fix"
700});
701
diff --git a/frontend/beta/js/Clipperz/PM/Strings/Strings_en-CA.js b/frontend/beta/js/Clipperz/PM/Strings/Strings_en-CA.js
new file mode 100644
index 0000000..50fa7e5
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Strings/Strings_en-CA.js
@@ -0,0 +1,43 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29//=============================================================================
30//
31 // E N G L I S H C A N A D I A N ( en_CA )
32//
33//=============================================================================
34
35Clipperz.PM.Strings.Languages['en-ca'] = MochiKit.Base.merge(Clipperz.PM.Strings.Languages['en-us'], {
36
37 // 'forumHeaderLinkLabel': "forum-CA",
38
39 // 'recordMenuLabel': "cards-CA",
40
41 //-------------------------------------------------------------------------
42 __syntaxFix__: "syntax fix"
43}); \ No newline at end of file
diff --git a/frontend/beta/js/Clipperz/PM/Strings/Strings_en-GB.js b/frontend/beta/js/Clipperz/PM/Strings/Strings_en-GB.js
new file mode 100644
index 0000000..ea55650
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Strings/Strings_en-GB.js
@@ -0,0 +1,43 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29//=============================================================================
30//
31 // E N G L I S H B R I T I S H ( en_GB )
32//
33//=============================================================================
34
35Clipperz.PM.Strings.Languages['en-gb'] = MochiKit.Base.merge(Clipperz.PM.Strings.Languages['en-us'], {
36
37 // 'forumHeaderLinkLabel': "forum-GB",
38
39 // 'recordMenuLabel': "cards-GB",
40
41 //-------------------------------------------------------------------------
42 __syntaxFix__: "syntax fix"
43}); \ No newline at end of file
diff --git a/frontend/beta/js/Clipperz/PM/Strings/Strings_en-US.js b/frontend/beta/js/Clipperz/PM/Strings/Strings_en-US.js
new file mode 100644
index 0000000..c0dd6d0
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Strings/Strings_en-US.js
@@ -0,0 +1,1259 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; }
32if (typeof(Clipperz.PM.Strings.Languages) == 'undefined') { Clipperz.PM.Strings.Languages = {}; }
33
34//=============================================================================
35//
36 // E N G L I S H A M E R I C A N ( en_US )
37//
38//=============================================================================
39
40Clipperz.PM.Strings.Languages['en-us'] = {
41
42 //Login page - description
43'clipperzServiceDescription': "\
44 <!-- FIX CSS DONE -->\
45 <h2>Keep it to yourself!</h2>\
46 <ul>\
47 <li>\
48 <h3>Clipperz is:</h3>\
49 <ul>\
50 <li><p>a secure and simple password manager</p></li>\
51 <li><p>an effective single sign-on solution</p></li>\
52 <li><p>a digital vault for your personal data</p></li>\
53 </ul>\
54 </li>\
55 <li>\
56 <h3>With Clipperz you can:</h3>\
57 <ul>\
58 <li><p>store and manage your passwords and online credentials</p></li>\
59 <li><p>login to your web services without entering any username or password</p></li>\
60 <li><p>protect all your sensitive data: codes for burglar alarms, PINs, credit card numbers, …</p></li>\
61 <li><p>share secrets with family members and associates (coming soon)</p></li>\
62 </ul>\
63 </li>\
64 <li>\
65 <h3>Clipperz benefits:</h3>\
66 <ul>\
67 <li><p>free and completely anonymous</p></li>\
68 <li><p>access it any time from any computer</p></li>\
69 <li><p>no software to download and nothing to install</p></li>\
70 <li><p>avoid keeping secrets on your PC or on paper</p></li>\
71 </ul>\
72 </li>\
73 <li>\
74 <h3>Clipperz security:</h3>\
75 <ul>\
76 <li><p>your secrets are locally encrypted by your browser before being uploaded to Clipperz</p></li>\
77 <li><p>the encryption key is a passphrase known only to you</p></li>\
78 <li><p>Clipperz hosts your sensitive data in encrypted form and could never actually access the data in its plain form</p></li>\
79 <li><p>Clipperz is built upon standard encryption schemes, nothing fancies or homemade</p></li>\
80 <li><p>you can review the source code anytime you like, but you need to know nothing about cryptography to be an happy user!</p></li>\
81 </ul>\
82 </li>\
83 <li>\
84 <a href=\"http://www.clipperz.com\" target=\"_blank\">Learn more</a>\
85 </li>\
86 </ul>",
87
88
89 'loginFormTitle': "login with your Clipperz account",
90 'loginFormUsernameLabel': "username",
91 'loginFormPassphraseLabel': "passphrase",
92 'loginFormDontHaveAnAccountLabel': "don\'t have an account?",
93 'loginFormCreateOneLabel': "create one",
94 'loginFormForgotYourCredentialsLabel': "forgot your credentials?",
95 'loginFormAarghThatsBadLabel': "aargh! that\'s bad!",
96 'loginFormAfraidOfMaliciousScriptsLabel': "afraid of malicious scripts?",
97 'loginFormVerifyTheCodeLabel': "verify the code",
98 'loginFormButtonLabel': "Login",
99 'loginFormOneTimePasswordCheckboxLabel': "use a one-time passphrase",
100'loginFormOneTimePasswordCheckboxDescription': "",
101
102// Login page - language selection
103 'loginPanelSwithLanguageDescription': "<h5>Switch to your preferred language</h5>",
104
105// Login page - browser compatibility
106 'browserCompatibilityDescription': "<p>Have a better and safer Clipperz experience with Firefox. However Clipperz works just fine also with Opera, Safari and MS Internet Explorer!</p>",
107
108// Login with OTP - message panel
109 'OTPloginMessagePanelInitialTitle': "Logging in using a one-time passphrase",
110 'OTPloginMessagePanelInitialText': "Sending OTP credentials …",
111 'OTPloginMessagePanelLoadingTitle': "Logging in using a one-time passphrase",
112 'OTPloginMessagePanelLoadingText': "Fetching encrypted authentication data from the server …",
113 'OTPloginMessagePanelProcessingTitle': "Logging in using a one-time passphrase",
114 'OTPloginMessagePanelProcessingText': "Local decryption of authentication data",
115
116// Regular login - message panel
117 'loginMessagePanelInitialTitle': "Logging in …",
118 'loginMessagePanelInitialText': "---",
119 'loginMessagePanelInitialButtonLabel': "Cancel",
120 'loginMessagePanelConnectedTitle': "Connected",
121 'loginMessagePanelConnectedText': "Done",
122 'loginMessagePanelFailureTitle': "Error",
123 'loginMessagePanelFailureText': "Login failed",
124 'loginMessagePanelFailureButtonLabel': "Close",
125
126// Regular login - message panel - connection
127 'connectionLoginSendingCredentialsMessageTitle': "Verifying credentials",
128 'connectionLoginSendingCredentialsMessageText': "Sending credentials",
129 'connectionLoginCredentialsVerificationMessageTitle':"Verifying credentials",
130 'connectionLoginCredentialsVerificationMessageText':"Performing SRP authentication",
131 'connectionLoginDoneMessageTitle': "Verifying credentials",
132 'connectionLoginDoneMessageText': "Connected",
133
134 //Regular login - message panel - user
135 'userLoginPanelUpgradingUserCredentialsMessageTitle': "Verifying credentials",
136 'userLoginPanelUpgradingUserCredentialsMessageText': "Upgrading your credentials to a new authentication schema",
137 'userLoginPanelConnectedMessageTitle': "User authenticated",
138 'userLoginPanelConnectedMessageText': "Successfully logged in",
139 'userLoginPanelTryingAnOlderConnectionSchemaMessageTitle': "Verifying credentials",
140 'userLoginPanelTryingAnOlderConnectionSchemaMessageText': "Trying an older authentication schema",
141 'userLoginPanelLoadingUserDataMessageTitle': "User authenticated",
142 'userLoginPanelLoadingUserDataMessageText': "Downloading encrypted card headers from Clipperz",
143 'userLoginPanelDecryptingUserDataMessageTitle': "User authenticated",
144 'userLoginPanelDecryptingUserDataMessageText': "Local decryption of card headers",
145 'userLoginPanelDecryptingUserStatisticsMessageTitle': "User authenticated",
146 'userLoginPanelDecryptingUserStatisticsMessageText': "Local decryption of usage statistics",
147
148 //Registration page - splash alert
149 'splashAlertTitle':"Welcome to Clipperz!",
150'splashAlertText': "\
151 <!-- FIX CSS DONE! -->\
152 <p>Some security advice</p>\
153 <ul>\
154 <li><p>Storing your data at Clipperz is as secure as the passphrase you choose to protect them. Nobody can access them unless they know your passphrase.</p></li>\
155 <li><p>If you are going to use Clipperz for safeguarding sensitive and critical information please make sure to use a strong passphrase. The longer the better!</p></li>\
156 <li><p>Clipperz will not be able to recover a lost passphrase!</p></li>\
157 </ul>\
158 <p>For any further information, please refer to <a href=\"http://www.clipperz.com\" target=\"_blank\">Clipperz</a> website.</p>",
159 'splashAlertCloseButtonLabel':"Ok",
160
161 // Registration page - form
162 'registrationFormTitle': "create your account",
163 'registrationFormUsernameLabel': "username",
164 'registrationFormPassphraseLabel': "passphrase",
165 'registrationFormRetypePassphraseLabel': "re-enter passphrase",
166 'registrationFormSafetyCheckLabel': "I understand that Clipperz will not be able to recover a lost passphrase.",
167 'registrationFormTermsOfServiceCheckLabel': "I have read and agreed to the <a href='http://www.clipperz.com/terms_of_service' target='_blank'>Terms of Service</a>.",
168 'registrationFormDoYouAlreadyHaveAnAccountLabel': "do you already have an account?",
169 'registrationFormSimplyLoginLabel': "simply login",
170 'registrationFormButtonLabel': "Register",
171
172// Registration page - warning messages
173 'registrationFormWarningMessageNotMatchingPassphrases':"Your passphrases don't match, please re-type them.",
174 'registrationFormWarningMessageSafetyCheckNotSelected':"Please read and check all the boxes below.",
175 'registrationFormWarningMessageTermsOfServiceCheckNotSelected':"You need to agree to the Terms of Service.",
176
177 // Registration page - message panel
178 'registrationMessagePanelInitialTitle': "Creating account …",
179 'registrationMessagePanelInitialText': "---",
180 'registrationMessagePanelInitialButtonLabel': "Cancel",
181 'registrationMessagePanelRegistrationDoneTitle': "Registration",
182 'registrationMessagePanelRegistrationDoneText': "Done",
183 'registrationMessagePanelFailureTitle': "Registration failed",
184 'registrationMessagePanelFailureButtonLabel': "Close",
185
186// Registration page - message panel - connection
187 'connectionRegistrationSendingRequestMessageText': "Verifying credentials",
188 'connectionRegistrationSendingCredentialsMessageText':"Sending credentials",
189
190// Registration page - splash panel
191 'registrationSplashPanelTitle': "Security advice",
192 'registrationSplashPanelDescription': "<p>These are your Clipperz credentials, take good care of them. Clipperz will never display your username and passphrase a second time!</p>",
193 'registrationSplashPanelUsernameLabel': "username",
194 'registrationSplashPanelPassphraseLabel':"passphrase",
195
196 'registrationSplashPanelShowPassphraseButtonLabel':"show passphrase",
197
198 //Header links
199 'donateHeaderLinkLabel': "donate",
200 'creditsHeaderLinkLabel': "credits",
201 'feedbackHeaderLinkLabel': "feedback",
202 'helpHeaderLinkLabel': "help",
203 'forumHeaderLinkLabel': "forum",
204
205 //Menu labels
206 'recordMenuLabel': "cards",
207 'accountMenuLabel': "account",
208 'dataMenuLabel': "data",
209 'contactsMenuLabel': "contacts",
210 'toolsMenuLabel': "tools",
211 'logoutMenuLabel': "logout",
212 'lockMenuLabel': "lock",
213
214 //Lock dialog
215 'lockTitle': "The account is locked",
216 'lockDescription': "<p>To unlock your account, please enter your passphrase.</p>",
217 'unlockButtonLabel': "Unlock",
218
219 //Account panel - change passphrase
220 'changePasswordTabLabel': "Change your passphrase",
221 'changePasswordTabTitle': "Change your passphrase",
222
223 'changePasswordFormUsernameLabel': "username",
224 'changePasswordFormOldPassphraseLabel': "old passphrase",
225 'changePasswordFormNewPassphraseLabel': "new passphrase",
226 'changePasswordFormRetypePassphraseLabel':"re-enter new passphrase",
227 'changePasswordFormSafetyCheckboxLabel':"I understand that Clipperz will not be able to recover a lost passphrase.",
228 'changePasswordFormSubmitLabel': "Change passphrase",
229
230 //Account panel - change passphrase - warning messages
231 'changePasswordFormWrongUsernameWarning': "Wrong username",
232 'changePasswordFormWrongPassphraseWarning': "Wrong passphrase",
233 'changePasswordFormWrongRetypePassphraseWarning':"Your passphrases don't match, please re-type them.",
234 'changePasswordFormSafetyCheckWarning': "Please read and check the box below.",
235
236 //Account panel - change passphrase - progress dialog
237 'changePasswordFormProgressDialogTitle': "Changing user credentials",
238 'changePasswordFormProgressDialogEmptyText': "---",
239 'changePasswordFormProgressDialogConnectedMessageTitle': "Connected",
240 'changePasswordFormProgressDialogConnectedMessageText': "Done",
241 'changePasswordFormProgressDialogErrorMessageTitle': "Error",
242 'changePasswordFormProgressDialogErrorMessageText': "Credentials change failed!",
243
244 'changeCredentialsPanelEncryptingDataMessageTitle': "Changing your passphrase",
245 'changeCredentialsPanelEncryptingDataMessageText': "Local encryption of card headers",
246 'changeCredentialsPanelCreatingNewCredentialsMessageTitle': "Changing your passphrase",
247 'changeCredentialsPanelCreatingNewCredentialsMessageText': "Updating your credentials",
248 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageTitle':"Changing your passphrase",
249 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageText':"Uploading your encrypted credentials to Clipperz",
250 'changeCredentialsPanelDoneMessageTitle': "Changing your passphrase",
251 'changeCredentialsPanelDoneMessageText': "Done",
252
253 //Account panel - OTP
254 'manageOTPTabLabel': "Manage your one-time passphrases",
255 'manageOTPTabTitle': "Manage your one-time passphrases",
256
257 'manageOTPTabDescription':"\
258 <p>A one-time passphrase works like your regular passphrase, but can be used only once.</p>\
259 <p>If the same passphrase is used again at a later stage in a login attempt it will be rejected and the login process will fail.</p>\
260 <p>Immediately after a successful login, your one-time passphrase will be deleted preventing any fraudulent access.</p>\
261 <p>One-time passphrases are an excellent choice if one is concerned about keyloggers or spyware infections that may be collecting data from compromised machines.</p>\
262 <p><b>It's strongly advisable to use one-time passphrases when accessing Clipperz from public terminals, such as Internet cafes and libraries.</b></p>",
263
264 //Account panel - OTP - OTP table
265'oneTimePasswordReadOnlyMessage': "\
266 <h6>Sorry!</h6>\
267 <p>You cannot manage your one-time passphrases when using the offline version of Clipperz.</p>",
268
269 'oneTimePasswordLoadingMessage':"\
270 <h6>Loading data</h6>\
271 <p>Please wait …</p>",
272
273 'oneTimePasswordNoPasswordAvailable':"\
274 <h6>No one-time passphrase available</h6>\
275 <p>Click the “New” button above to add one-time passphrases to your account.</p>",
276
277 'createNewOTPButtonLabel': "New",
278 'deleteOTPButtonLabel': "Delete",
279 'printOTPButtonLabel': "Print",
280
281 'disabledOneTimePassword_warning': "disabled",
282
283 'oneTimePasswordSelectionLink_selectLabel':"Select:",
284 'oneTimePasswordSelectionLink_all': "all",
285 'oneTimePasswordSelectionLink_none': "none",
286 'oneTimePasswordSelectionLink_used': "used",
287 'oneTimePasswordSelectionLink_unused': "unused",
288
289//Account panel - OTP - saving new OTP dialog
290 'saveOTP_encryptUserDataTitle': "Saving one-time passphrase",
291 'saveOTP_encryptUserDataText': "Processing new OTP credentials …",
292 'saveOTP_encryptOTPDataTitle': "Saving one-time passphrase",
293 'saveOTP_encryptOTPDataText': "Local encryption of authentication data …",
294 'saveOTP_sendingDataTitle': "Saving one-time passphrase",
295 'saveOTP_sendingDataText': "Sending authentication data to the server …",
296 'saveOTP_updatingInterfaceTitle': "Saving one-time passphrase",
297 'saveOTP_updatingInterfaceText': "Updating interface",
298
299// Account panel - preferences
300 'accountPreferencesLabel': "Preferences",
301 'accountPreferencesTabTitle': "Preferences",
302
303 'accountPreferencesLanguageTitle': "Language",
304 'accountPreferencesLanguageDescription':"<p>Choose your preferred language from the list below.</p>",
305
306 'showDonationReminderPanelTitle': "Donation reminders",
307 'showDonationReminderPanelDescription': "<p>Show donation reminders</p>",
308
309 'saveUserPreferencesFormSubmitLabel': "Save",
310 'cancelUserPreferencesFormSubmitLabel': "Cancel",
311
312// Account panel - preferences - saving dialog
313 'accountPreferencesSavingPanelTitle_Step1': "Saving preferences",
314 'accountPreferencesSavingPanelText_Step1': "Local encryption of your preferences",
315 'accountPreferencesSavingPanelTitle_Step2': "Saving preferences",
316 'accountPreferencesSavingPanelText_Step2': "Sending encrypted preferences to Clipperz",
317
318 //Account panel - login history
319 'accountLoginHistoryLabel': "Login history",
320 'loginHistoryTabTitle': "Login history",
321
322 'loginHistoryReadOnlyMessage': "\
323 <h6>Sorry!</h6>\
324 <p>The login history is not available while using the offline version of Clipperz.</p>",
325
326 'loginHistoryLoadingMessage': "\
327 <h6>Loading data</h6>\
328 <p>Please wait …</p>",
329
330 'loginHistoryLoadedMessage': "\
331 <h6>Your latest 10 logins</h6>\
332 <p></p>",
333
334 'loginHistoryIPLabel': "IP",
335 'loginHistoryTimeLabel': "date",
336 'loginHistoryCurrentSessionText': "current session",
337 'loginHistoryReloadButtonLabel': "Reload login history",
338
339 //Account panel - delete account
340 'deleteAccountTabLabel': "Delete your account",
341 'deleteAccountTabTitle': "Delete your account",
342
343 'deleteAccountFormUsernameLabel': "username",
344 'deleteAccountFormPassphraseLabel': "passphrase",
345 'deleteAccountFormSafetyCheckboxLabel': "I understand that all my data will be deleted and that this action is irreversible.",
346 'deleteAccountFormSubmitLabel': "Delete my account",
347
348//Account panel - delete account - warnings
349 'deleteAccountFormWrongUsernameWarning':"Wrong username",
350 'deleteAccountFormWrongPassphraseWarning':"Wrong passphrase",
351 'deleteAccountFormSafetyCheckWarning': "Please read and check the box below.",
352
353//Account panel - delete account - confirmation
354 'accountPanelDeletingAccountPanelConfirmationTitle':"ATTENTION",
355 'accountPanelDeleteAccountPanelConfirmationText': "Are your sure you want to delete your account?",
356 'accountPanelDeleteAccountPanelConfirmButtonLabel': "Yes",
357 'accountPanelDeleteAccountPanelDenyButtonLabel': "No",
358
359//Account panel - delete account - confirmation
360 'accountPanelDeletingAccountPanelProgressTitle': "Deleting the account data",
361 'accountPanelDeletingAccountPanelProgressText': "The operation could take long, please be patient.",
362
363//Data panel - offline copy
364 'offlineCopyTabLabel': "Offline copy",
365 'offlineCopyTabTitle': "Offline copy",
366
367'offlineCopyTabDescription': "\
368 <!-- FIX CSS DONE! -->\
369 <p>With just one click you can dump all your encrypted data from Clipperz servers to your hard disk and create a read-only offline version of Clipperz to be used when you are not connected to the Internet.</p>\
370 <p>The read-only version is as secure as the read-and-write one and will not expose your data to higher risks since they both share the same code and security architecture.</p>\
371 <ol>\
372 <li><p>Click the link below to start the download.</p></li>\
373 <li><p>The browser will ask you what to do with the “Clipperz_YYYYMMDD.html” file. Save it on your hard disk.</p></li>\
374 <li><p>Double click on the downloaded file to launch the offline version in your browser.</p></li>\
375 <li><p>Enter the usual username and passphrase.</p></li>\
376 </ol>",
377
378 'offlineCopyDownloadLinkLabel': "Download",
379
380 //Data panel - offline copy - not updated
381 'offlineCopyDownloadWarning': "\
382 <!-- FIX CSS DONE! -->\
383 <h4><a href=\"#\" id=\"offlineCopyDownloadWarningLink\">Update your “offline copy”!</a></h4>\
384 <p>You have recently created or modified one or more cards, it would be wise to download a new copy of the offline version.</p>",
385
386 'offlineCopyDownloadOk': "",
387
388 //Data panel - sharing
389 'sharingTabLabel': "Sharing",
390 'sharingTabTitle': "Sharing",
391
392 'sharingTabDescription': "\
393 <p>Quite often a confidential piece of information needs to be shared with one or more persons.</p>\
394 <p>This could be as simple as giving your colleague the access code of your voice mailbox when you are out of the office, or as complicated as enabling the entitled heirs to access your safe deposit box at the local bank when you pass on.</p>\
395 <p>Clipperz can make sharing your secrets a secure and straightforward process.</p>\
396 <p></p>\
397 <p><b>Coming soon …</b></p>",
398
399 // Data panel - import
400 'importTabLabel': "Import",
401 'importTabTitle': "Import",
402
403 'importTabDescription': "<p>You can bulk import data to your Clipperz account from several file formats.</p>",
404
405 //Data panel - export
406 'printingTabLabel': "Export",
407 'printingTabTitle': "Export",
408
409 'printingTabDescription': "\
410 <h5>Printing</h5>\
411 <p>Click on the link below to open a new window displaying all your cards in a printable format.</p>\
412 <p>If you are going to print for backup purposes, please consider the safer option provided by the “offline copy”.</p>",
413
414 'printingLinkLabel': "Printable version",
415
416 'exportTabDescription': "\
417 <h5>Exporting to JSON</h5>\
418 <p>JSON enables a “lossless” export of your cards. All the information will be preserved, including direct login configurations.</p>\
419 <p>This custom format it’s quite convenient if you need to move some of all of your cards to a different Clipperz account. Or if you want to restore a card that has been accidentally deleted.</p>\
420 <p>Click on the link below to start the export process.</p>",
421
422 'exportLinkLabel': "Export to JSON",
423
424 'exportDataInProgressDescription':"<h4>Exporting, please wait while your data are being processed …</h4>",
425
426 'exportDataDescription': "\
427 <h4>Instructions</h4>\
428 <p>Copy the text below to your favorite editor and save it. (e.g. “clipperz_export_20071217.json”)</p>",
429
430 //Contacts panel
431 'contactsTabLabel': "Contacts",
432 'contactsTabTitle': "Contacts",
433
434//Tools panel - password generator
435 'passwordGeneratorTabLabel': "Password generator",
436 'bookmarkletTabLabel': "Bookmarklet",
437 'compactTabLabel': "Compact edition",
438 'httpAuthTabLabel': "HTTP authentication",
439
440 'passwordGeneratorTabTitle': "Password generator",
441 'bookmarkletTabTitle': "Bookmarklet",
442 'compactTabTitle': "Compact edition",
443 'httpAuthTabTitle': "HTTP authentication",
444
445
446 //Tools panel - password generator - description
447 'paswordGeneratorTabDescription':"<p></p>",
448 'passwordGeneratorTabButtonLabel':"Generate password",
449
450 //Tools panel - bookmarklet
451 'bookmarkletTabLabel': "Bookmarklet",
452 'bookmarkletTabTitle': "Bookmarklet",
453
454 'bookmarkletTabDescription': "\
455 <!-- FIX CSS DONE! -->\
456 <p>A bookmarklet is a simple “one-click” tool that can perform very useful tasks. It can be saved and used like a normal web page bookmark.</p>\
457 <p>The Clipperz bookmarklet will help you to quickly create new cards and new “direct logins” within existing cards.</p>\
458 <p><b>Please note that the bookmarklet does not include any information related to your account (e.g. your username or passphrase), the bookmarklet is a general tool containing the same code for every Clipperz user.</b></p>\
459 <h3>How to install the bookmarklet</h3>\
460 <h>Firefox, Camino, Opera, Safari</h5>\
461 <ol>\
462 <li><p>Make sure that the “Bookmarks Bar” is displayed by selecting “View > Toolbars > Bookmarks”, or similar menu items, from the browser menu.</p></li>\
463 <li><p>Drag and drop the “Add to Clipperz” link below to the bookmark bar.</p></li>\
464 </ol>\
465 \
466 <h5>Internet Explorer</h5>\
467 <ol>\
468 <li><p>Make sure that the “Links” toolbar is displayed by selecting “View > Toolbars > Links” from the browser menu.</p></li>\
469 <li><p>Right-click on the “Add to Clipperz” link below.</p></li>\
470 <li><p>Select “Add to favorites” from the contextual menu.</p></li>\
471 <li><p>Click “Yes” for any security message that pops up.</p></li>\
472 <li><p>Open the “Links” folder and click “OK”</p></li>\
473 </ol>",
474
475 'bookmarkletTabBookmarkletTitle':"Add to Clipperz",
476
477 //Tools panel - bookmarklet - instructions
478 'bookmarkletTabInstructions': "\
479 <!-- FIX CSS DONE! -->\
480 <h3>How to create a new card inclusive of a “direct login” link to an online service</h3>\
481 <ol>\
482 <li><p>Open the web page where the login form is hosted. (this is the page where you usually enter your sign-in credentials)</p></li>\
483 <li><p>Launch the bookmarklet by clicking on it: a pop-up window will appear over the web page.</p></li>\
484 <li><p>Copy to the clipboard the content of the large text area within the pop-up. (ctrl-C)</p></li>\
485 <li><p>Enter your Clipperz account and click on the <b>Add new card</b> button.</p></li>\
486 <li><p>Select the “Direct login” template and paste the content of the clipboard to the large text area in the form. (ctrl-V)</p></li>\
487 <li><p>Press the <b>Create</b> button, complete and review the details, then click <b>Save</b>.</p></li>\
488 </ol>\
489 \
490 <h3>How to add a “direct login” link to an existing card</h3>\
491 <ol>\
492 <li><p>Same as above.</p></li>\
493 <li><p>Same as above.</p></li>\
494 <li><p>Same as above.</p></li>\
495 <li><p>Enter your Clipperz account and select the card containing the credentials for the web service you just visited and click the <b>Edit</b> button.</p></li>\
496 <li><p>Paste the content of the clipboard to the large text area in the “Direct logins” section. (ctrl-V)</p></li>\
497 <li><p>Press the <b>Add direct login</b> button, review the details and then click <b>Save</b>.</p></li>\
498 </ol>\
499 \
500 <p></p>\
501 <p>Further information about the bookmarklet are <a href=\"http://www.clipperz.com/support/user_guide/bookmarklet\" target=\"_blank\">available here</a>.</p>",
502
503 //Tools panel - Compact - instructions
504 'compactTabDescription': "\
505 <!-- FIX CSS DONE! -->\
506 <p>Clipperz Compact is a special version of Clipperz designed to be opened in the Firefox sidebar.</p>\
507 <p>Its purpose is to keep your collection of “direct logins” always at hand. Read more <a href=\"http://www.clipperz.com/support/user_guide/clipperz_compact\", target=\"blank\">here</a></p>\
508 \
509 <h3>How to launch Clipperz Compact in the sidebar</h3>\
510 <ol>\
511 <li><p>Get Firefox! Sidebars are only available in Firefox and you need to switch to Firefox in order to enjoy the convenience of Clipperz Compact.</p></li>\
512 <li>\
513 <p>Add the following URL to Firefox bookmarks, or even better, drag it to the bookmark bar.</p>\
514 <div id=\"compactLinkBox\"><a href=\"https://www.clipperz.com/beta/index.html?compact\" target=\"_search\">Clipperz Compact</a></div>\
515 </li>\
516 <li><p>Change the properties of the bookmark so that “load this bookmark in the sidebar” is checked.</p></li>\
517 </ol>\
518 \
519 <h5>Added bonus: Clipperz Compact works also in Opera’s panel.</h5>",
520
521 //Tools panel - HTTP authentication - instructions
522 'httpAuthTabDescription': "\
523 <!-- FIX CSS DONE! -->\
524 <p>HTTP authentication is a method designed to allow a web browser to provide credentials – in the form of a username and password – including them in a website address (HTTP or HTTPS URL).</p>\
525 <p>Nowadays it is rarely used, but it can still be found on small, private websites. You can tell that a website is protected by HTTP authentication when the browser displays a pop-up window to enter username and password.</p>\
526 <p>Unfortunately the Clipperz bookmarklet does not work on websites that use HTTP authentication. However you can still create a “direct login”.</p>\
527 \
528 <h3>How to create a “direct login” for a website that uses HTTP authentication</h3>\
529 <ol>\
530 <li><p>Store website URL, username and password in a new card.</p></li>\
531 <li><p>Copy the configuration below and paste it to the large text area in the “Direct logins” section of the new card.</p></li>\
532 <li><p>Press the <b>Add direct login</b> button, bind URL, username and password fields and then click <b>Save</b>.</p></li>\
533 </ol>\
534 \
535 <h5><a href=\"http://support.microsoft.com/kb/834489\" target=\"_blank\">Warning: Internet Explorer does not support HTTP authentication.</a></h5>",
536
537// Direct logins block
538 'mainPanelDirectLoginBlockLabel': "Direct logins",
539 'directLinkReferenceShowButtonLabel': "show",
540
541// Direct logins - blank slate
542 'mainPanelDirectLoginBlockDescription': "\
543 <!-- FIX CSS DONE! -->\
544 <p>Add “direct logins” to sign in to your web accounts without typing usernames and passwords!</p>\
545 <p>“Direct logins” greatly enhance your password security since you can:</p>\
546 <ul>\
547 <li><p>conveniently adopt and enter complex passwords;</p></li>\
548 <li><p>never re-use the same and easy-to-guess password.</p></li>\
549 </ul>\
550 <p>Simple and quick configuration with the <b>Clipperz bookmarklet</b>.</p>\
551 <a href=\"http://www.clipperz.com/support/user_guide/direct_logins\" target=\"_blank\">Learn more about “direct logins”</a>",
552
553 // Cards block
554 'mainPanelRecordsBlockLabel': "Cards",
555 'mainPanelAddRecordButtonLabel': "Add new card",
556 'mainPanelRemoveRecordButtonLabel': "Delete card",
557
558// Cards block - filter tabs
559 'mainPanelRecordFilterBlockAllLabel': "all",
560 'mainPanelRecordFilterBlockTagsLabel': "tags",
561 'mainPanelRecordFilterBlockSearchLabel':"search",
562
563// Cards block - blank slate
564 'recordDetailNoRecordAtAllTitle': "Welcome to Clipperz!",
565 'recordDetailNoRecordAtAllDescription': "\
566 <h5>Get started by adding cards to your account.</h5>\
567 <p>Cards are simple and flexible forms where you can store your passwords and any other confidential data.</p>\
568 <p>Cards could contain credentials for accessing a web site, the combination of your bicycle lock, details of your credit card, …</p>\
569 \
570 <h5>Don't forget the Clipperz bookmarklet!</h5>\
571 <p>Before you start, install the “Add to Clipperz” bookmarklet: it will make creating cards easier and more fun.</p>\
572 <p>Go to the “Tools” tab to discover how to install it and how it use it.</p>\
573 <p></p>\
574 <p>Then simply click the <b>\"Add new card\"</b> button and enjoy your Clipperz account.</p>\
575 <p></p>\
576 <a href=\"http://www.clipperz.com/support/user_guide/managing_cards\" target=\"_blank\">Learn more about creating and managing cards</a>",
577
578// Cards block - new card wizard - bookmarklet configuration
579 'newRecordWizardTitleBox': "\
580 <h5>Please select a template</h5>\
581 <p>Cards are simple and flexible forms where you can store passwords or any other confidential data.</p>\
582 <p>Start choosing one of the templates below. You can always customize your cards later by adding or removing fields.</p>",
583
584 'newRecordWizardBookmarkletConfigurationTitle': "Direct login",
585 'newRecordWizardBookmarkletConfigurationDescription':"\
586 <p>Paste below the configuration code generated by the Clipperz bookmarklet.</p>\
587 <p>A new card complete with a direct login to your web account will be created.</p>",
588
589 'newRecordWizardCreateButtonLabel': "Create",
590 'newRecordWizardCancelButtonLabel': "Cancel",
591
592 //Create new card - Donation splash
593 'donateSplashPanelTitle': "Support Clipperz, make a donation today!",
594 'donateSplashPanelDescription': "\
595 <!-- FIX CSS DONE! -->\
596 <p>A few good reasons to make a donation:</p>\
597 <ul>\
598 <li><p>support the development of new features</p></li>\
599 <li><p>keep Clipperz free</p></li>\
600 <li><p>show appreciation for our hard work</p></li>\
601 </ul>\
602 <p>For any further information, please visit our <a href=\"http://www.clipperz.com/donations\" target=\"_blank\">Donations page</a>.</p>\
603 <p><b>Ready to donate?</b></p>",
604
605 'donateCloseButtonLabel': "Not yet",
606 'donateDonateButtonLabel': "Yes",
607
608// Card templates
609'recordTemplates': {
610
611//Web password
612 'WebAccount': {
613 'title': "Web password",
614 'description':"<p>A simple card to store login credentials for your online services.</p>",
615 'fields': [
616 {label:"Web address", type:'URL'},
617 {label:"Username or email", type:'TXT'},
618 {label:"Password", type:'PWD'}
619 ]
620 },
621
622 //Bank account
623 'BankAccount': {
624 'title': "Bank account",
625 'description':"<p>Safely store your bank account number and online banking credentials.</p>",
626 'fields': [
627 {label:"Bank", type:'TXT'},
628 {label:"Account number", type:'TXT'},
629 {label:"Bank website", type:'URL'},
630 {label:"Online banking ID", type:'TXT'},
631 {label:"Online banking password", type:'PWD'}
632 ]
633 },
634
635 // Credit card
636 'CreditCard': {
637 'title': "Credit card",
638 'description':"<p>Card number, expire date, CVV2 and PIN always at hand with Clipperz.</p>",
639 'fields': [
640 {label:"Type (Visa, AmEx, …)", type:'TXT'},
641 {label:"Number", type:'TXT'},
642 {label:"Owner name", type:'TXT'},
643 {label:"Expiry date", type:'TXT'},
644 {label:"CVV2", type:'TXT'},
645 {label:"PIN", type:'PWD'},
646 {label:"Card website", type:'URL'},
647 {label:"Username", type:'TXT'},
648 {label:"Password", type:'PWD'}
649 ]
650 },
651
652 // Address book entry
653 'AddressBookEntry': {
654 'title': "Address book entry",
655 'description':"<p>Clipperz could also work as your new private address book. Use this template to easily add a new entry.</p>",
656 'fields': [
657 {label:"Name", type:'TXT'},
658 {label:"Email", type:'TXT'},
659 {label:"Phone", type:'TXT'},
660 {label:"Mobile", type:'TXT'},
661 {label:"Address", type:'ADDR'},
662 ]
663 },
664
665//Custom card
666 'Custom': {
667 'title': "Custom card",
668 'description':"<p>No matter which kind of confidential data you need to protect, create a custom card to match your needs.</p>",
669 'fields': [
670 {label:"Label 1", type:'TXT'},
671 {label:"Label 2", type:'TXT'},
672 {label:"Label 3", type:'TXT'}
673 ]
674 }
675},
676
677
678'recordFieldTypologies': {
679 'TXT': {
680 description: "simple text field",
681 shortDescription: "text"
682 },
683 'PWD': {
684 description: "simple text field, with default status set to hidden",
685 shortDescription: "password"
686 },
687 'URL': {
688 description: "simple text field in edit mode, that became an active url in view mode",
689 shortDescription: "web address"
690 },
691 'DATE': {
692 description: "a value set with a calendar helper",
693 shortDescription: "date"
694 },
695 'ADDR': {
696 description: "just like the URL, but the active link points to Google Maps (or similar service) passing the address value as argument",
697 shortDescription: "street address"
698 },
699 'CHECK': {
700 description: "check description",
701 shortDescription: "check"
702 },
703 'RADIO': {
704 description: "radio description",
705 shortDescription: "radio"
706 },
707 'SELECT': {
708 description: "select description",
709 shortDescription: "select"
710 }
711},
712
713// Cards block - new card - warnings
714 'newRecordPanelGeneralExceptionTitle': "Error",
715 'newRecordPanelGeneralExceptionMessage': "The configuration text is not valid. Make sure to get your text from the bookmarklet pop-up and retry.",
716 'newRecordPanelWrongBookmarkletVersionExceptionTitle': "Error",
717 'newRecordPanelWrongBookmarkletVersionExceptionMessage':"The configuration text has been generated by an old version of the bookmarklet. Please update your bookmarklet and retry.",
718 'newRecordPanelExceptionPanelCloseButtonLabel': "Cancel",
719
720// Cards block - delete card
721 'mainPanelDeletingRecordPanelConfirmationTitle': "Deleting selected card",
722 'mainPanelDeleteRecordPanelConfirmationText': "Do your really want to delete the selected card?",
723 'mainPanelDeleteRecordPanelConfirmButtonLabel': "Yes",
724 'mainPanelDeleteRecordPanelDenyButtonLabel': "No",
725 'mainPanelDeletingRecordPanelInitialTitle': "Deleting selected card",
726 'mainPanelDeletingRecordPanelInitialText': "---",
727 'mainPanelDeletingRecordPanelCompletedText': "Done",
728
729// Cards block - delete card panel
730 'deleteRecordPanelCollectRecordDataMessageTitle': "Delete card",
731 'deleteRecordPanelCollectRecordDataMessageText': "Updating card list",
732 'deleteRecordPanelEncryptUserDataMessageTitle': "Delete card",
733 'deleteRecordPanelEncryptUserDataMessageText': "Local encryption of card headers",
734 'deleteRecordPanelSendingDataToTheServerMessageTitle': "Delete card",
735 'deleteRecordPanelSendingDataToTheServerMessageText': "Uploading encrypted card headers to Clipperz",
736 'deleteRecordPanelUpdatingTheInterfaceMessageTitle': "Delete card",
737 'deleteRecordPanelUpdatingTheInterfaceMessageText': "Updating the interface",
738
739// Cards block - no record selected
740 'recordDetailNoRecordSelectedTitle': "No card selected",
741 'recordDetailNoRecordSelectedDescription': "<p>Please select a card from the list on the left.</p>",
742
743 // Cards block - loading messages
744 'recordDetailLoadingRecordMessage': "Downloading encrypted card from Clipperz",
745 'recordDetailDecryptingRecordMessage': "Local decryption of card\'s data",
746 'recordDetailLoadingRecordVersionMessage': "Downloading latest card version",
747 'recordDetailDecryptingRecordVersionMessage': "Local decryption of latest version",
748 'recordDetailLoadingErrorMessageTitle': "Error while downloading the card",
749
750// Cards block - card details
751 'recordDetailNotesLabel': "Notes",
752 'recordDetailLabelFieldColumnLabel': "Field label",
753 'recordDetailDataFieldColumnLabel': "Field data",
754 'recordDetailTypeFieldColumnLabel': "Type",
755
756 'recordDetailSavingChangesMessagePanelInitialTitle': "Saving card",
757 'recordDetailSavingChangesMessagePanelInitialText': "---",
758
759 'recordDetailRemoveFieldButtonLabel': "-",
760 'recordDetailAddFieldButtonLabel': "Add new field",
761 'recordDetailPasswordFieldHelpLabel': "click the stars to select the password and then Ctrl-C to copy",
762
763 'recordDetailPasswordFieldScrambleLabel': "scramble",
764 'recordDetailPasswordFieldUnscrambleLabel': "unscramble",
765
766 'recordDetailDirectLoginBlockTitle': "Direct logins",
767 'recordDetailNewDirectLoginDescription': "<p>Direct login configuration</p>",
768
769 'recordDetailDirectLoginBlockNoDirectLoginConfiguredDescription':"\
770 <p>Does this card contain credentials to access an online service?</p>\
771 <p>Use the bookmarklet to configure a “direct login” from Clipperz with just one click!</p>",
772
773 'recordDetailDeleteDirectLoginButtonLabel': "-",
774 'recordDetailAddNewDirectLoginButtonLabel': "Add new direct login",
775
776 'recordDetailEditButtonLabel': "Edit",
777 'recordDetailSaveButtonLabel': "Save",
778 'recordDetailCancelButtonLabel': "Cancel",
779
780 'newRecordTitleLabel': "_new card_",
781 'newDirectLoginLabelSuffix': "",
782
783// Cards block - save card panel
784 'recordSaveChangesPanelCollectRecordInfoMessageTitle': "Save card",
785 'recordSaveChangesPanelCollectRecordInfoMessageText': "Updating card headers",
786 'recordSaveChangesPanelEncryptUserDataMessageTitle': "Save card",
787 'recordSaveChangesPanelEncryptUserDataMessageText': "Local encryption of card headers",
788 'recordSaveChangesPanelEncryptRecordDataMessageTitle': "Save card",
789 'recordSaveChangesPanelEncryptRecordDataMessageText': "Local encryption of card's data",
790 'recordSaveChangesPanelEncryptRecordVersionDataMessageTitle':"Save card",
791 'recordSaveChangesPanelEncryptRecordVersionDataMessageText':"Local encryption of card's version data",
792 'recordSaveChangesPanelSendingDataToTheServerMessageTitle': "Save card",
793 'recordSaveChangesPanelSendingDataToTheServerMessageText': "Uploading encrypted card's header to Clipperz",
794 'recordSaveChangesPanelUpdatingTheInterfaceMessageTitle': "Save card",
795 'recordSaveChangesPanelUpdatingTheInterfaceMessageText': "Updating the interface",
796
797 //Password Generator strings
798 'passwordGeneratorPanelTitle': "Password generator",
799 'passwordGeneratorPanelOkLabel': "Ok",
800 'passwordGeneratorPanelCancelLabel': "Cancel",
801
802 'passwordGeneratorLowercaseLabel': "abc",
803 'passwordGeneratorUppercaseLabel': "ABC",
804 'passwordGeneratorNumberLabel': "012",
805 'passwordGeneratorSymbolLabel': "@#$",
806
807 'passwordGeneratorLengthLabel': "length:",
808
809
810 //Miscellaneous strings
811
812 //'DWRUtilLoadingMessage': "Loading data …",
813 'comingSoon': "coming soon …",
814 'panelCollectingEntryopyMessageText': "Collecting entropy",
815 'directLoginConfigurationCheckBoxFieldSelectedValue': "Yes",
816 'directLoginConfigurationCheckBoxFieldNotSelectedValue': "No",
817
818
819
820// NEW - Import panel
821 'importFormats':{
822 'CSV': {
823 'label': "CSV",
824 'description':"<p>A widely recognized file format that stores tabular data. Several password managers can export data to this format.</p>"
825 },
826 'Excel': {
827 'label': "Excel",
828 'description':"<p>The popular spreadsheet from Microsoft. Storing passwords in Excel files is very common but not advisable.</p>"
829 },
830 'KeePass': {
831 'label': "KeePass",
832 'description':"<p>The custom TXT file created by KeePass password manager.</p>"
833 },
834 'PasswordPlus': {
835 'label': "Password Plus",
836 'description':"<p>The custom CSV format produced by Password Plus, a password manager mostly used on mobile devices.</p>"
837 },
838 'Roboform': {
839 'label': "RoboForm",
840 'description':"<p>The special HTML file created by Roboform password manager when displaying Passcard and Safenotes for printing.</p>"
841 },
842 'ClipperzExport': {
843 'label': "JSON",
844 'description':"<p>The file created by Clipperz itself in JSON format. It preserves all information contained in your cards, even direct login configurations.</p>"
845 }
846},
847
848 //JSON
849 'Clipperz_ImportWizard_Title': "JSON import",
850 'importOptions_clipperz_description': "<p>Open the JSON file exported from Clipperz in a text editor. Then copy and paste its content to the text area below.</p>",
851
852 //CSV
853 'CSV_ImportWizard_Title': "CSV import",
854 'importOptions_csv_description_': "\
855 <p>Open the CSV file in a text editor. Then copy and paste its content to the text area below.</p>\
856 <p>Please select the special characters used within your file.</p>",
857
858 //Excel
859 'Excel_ImportWizard_Title': "Excel import",
860 'importOptions_excel_description_': "<p>Open the Excel file and select the cells you want to import. Then copy and paste them to the text area below.</p>",
861
862 //KeePass
863 'KeePass_ImportWizard_Title': "KeePass import",
864 'importOptions_keePass_description_': "<p>Open the TXT file created by Keepass in a text editor. Then copy and paste its content to the text area below.</p>",
865
866 //PasswordPlus
867 'PasswordPlus_ImportWizard_Title': "Password Plus import",
868 'importOptions_passwordPlus_description':"<p>Open the CSV file created by PasswordPlus in a text editor. Then copy and paste its content to the text area below.</p>",
869
870 //RoboForm
871 'RoboForm_ImportWizard_Title': "RoboForm import",
872 'importOptions_roboForm_description': "<p>Open the HTML file created by RoboForm in a text editor. Then copy and paste its content to the text area below.</p>",
873
874
875 'importData_parsingDataTitle': "Import",
876 'importData_parsingDataText': "Parsing data …",
877
878 'importData_previewingDataTitle': "Import",
879 'importData_previewingDataText': "Processing data …",
880
881 'importData_processingDataTitle': "Import",
882 'importData_processingDataText': "Creating new cards …",
883
884'ImportWizard': {
885 'EDIT': "edit",
886 'PREVIEW': "preview",
887 'IMPORT': "import",
888
889 'KEEPASS_SETTINGS': "settings",
890
891 'CSV_EDIT': "paste",
892 'CSV_COLUMNS': "columns",
893 'CSV_HEADER': "labels",
894 'CSV_TITLE': "titles",
895 'CSV_NOTES': "notes",
896 'CSV_FIELDS': "types",
897
898 'EXCEL_EDIT': "edit"
899},
900
901 'CSV_ImportWizard_Columns': "<p>Select the columns you want to import.</p>",
902 'CSV_ImportWizard_Header': "<p>If the first row of the CSV file contains field labels, tick off the checkbox below.</p>",
903 'CSV_ImportWizard_Header_Settings_firstRowHeaderLabel':"Use the first row as labels?",
904 'CSV_ImportWizard_Title': "<p>Select the column that contains titles of the cards you are importing. (mandatory)</p>",
905 'CSV_ImportWizard_Notes': "<p>Select the column that represents a \"notes\" field. (optional)</p>",
906 'CSV_ImportWizard_Notes_Settings_noSelectionLabel': "\"notes\" field not present",
907 'CSV_ImportWizard_Fields': "<p>Select the correct type for each column from the drop down lists.</p>",
908 'CSV_ImportWizard_Fields_MissingLabelWarning': "Missing label",
909
910 'importData_importConfirmation_title': "Import",
911 'importData_importConfirmation_text': "Do you want to import __numberOfRecords__ cards?",
912
913
914 //Vulnerability warning
915 'VulnerabilityWarning_Panel_title': "Vulnerability warning",
916 'VulnerabilityWarning_Panel_message': "The action as been aborted due to a catched vulnerability",
917 'VulnerabilityWarning_Panel_buttonLabel':"Close",
918
919
920
921 //All the loginInfo panel infos
922
923 'WELCOME_BACK': "Welcome back!",
924
925 'currentConnectionText': "You are connected from ip&nbsp;__ip__, apparently from __country__, using __browser__ on __operatingSystem__.",
926 'latestConnectionText': "Your latest connection was __elapsedTimeDescription__ (__time__) from ip&nbsp;__ip__, apparently from __country__, using __browser__ on __operatingSystem__.",
927
928 'fullLoginHistoryLinkLabel': "show login history",
929
930'elapsedTimeDescriptions': {
931 'MORE_THAN_A_MONTH_AGO': "more than a month ago",
932 'MORE_THAN_A_WEEK_AGO': "more than a week ago",
933 'MORE_THAN_*_WEEKS_AGO': "more than __elapsed__ weeks ago",
934 'YESTERDAY': "yesterday",
935 '*_DAYS_AGO': "__elapsed__ days ago",
936 'ABOUT_AN_HOUR_AGO': "about an hour ago",
937 '*_HOURS_AGO': "__elapsed__ hours ago",
938 'JUST_A_FEW_MINUTES_AGO': "just a few minutes ago",
939 'ABOUT_*_MINUTES_AGO': "about __elapsed__ minutes ago"
940},
941
942 'unknown_ip': "unknown",
943
944'countries': {
945 '--': "unknown",
946 'AD': "Andorra",
947 'AE': "United Arab Emirates",
948 'AF': "Afghanistan",
949 'AG': "Antigua and Barbuda",
950 'AI': "Anguilla",
951 'AL': "Albania",
952 'AM': "Armenia",
953 'AN': "Netherlands Antilles",
954 'AO': "Angola",
955 'AP': "Non-Spec Asia Pas Location",
956 'AR': "Argentina",
957 'AS': "American Samoa",
958 'AT': "Austria",
959 'AU': "Australia",
960 'AW': "Aruba",
961 'AX': "Aland Islands",
962 'AZ': "Azerbaijan",
963 'BA': "Bosnia and Herzegowina",
964 'BB': "Barbados",
965 'BD': "Bangladesh",
966 'BE': "Belgium",
967 'BF': "Burkina Faso",
968 'BG': "Bulgaria",
969 'BH': "Bahrain",
970 'BI': "Burundi",
971 'BJ': "Benin",
972 'BM': "Bermuda",
973 'BN': "Brunei Darussalam",
974 'BO': "Bolivia",
975 'BR': "Brazil",
976 'BS': "Bahamas",
977 'BT': "Bhutan",
978 'BW': "Botswana",
979 'BY': "Belarus",
980 'BZ': "Belize",
981 'CA': "Canada",
982 'CD': "Congo the Democratic Republic of the",
983 'CF': "Central African Republic",
984 'CH': "Switzerland",
985 'CI': "Cote D'ivoire",
986 'CK': "Cook Islands",
987 'CL': "Chile",
988 'CM': "Cameroon",
989 'CN': "China",
990 'CO': "Colombia",
991 'CR': "Costa Rica",
992 'CS': "Serbia and Montenegro",
993 'CU': "Cuba",
994 'CY': "Cyprus",
995 'CZ': "Czech Republic",
996 'DE': "Germany",
997 'DJ': "Djibouti",
998 'DK': "Denmark",
999 'DO': "Dominican Republic",
1000 'DZ': "Algeria",
1001 'EC': "Ecuador",
1002 'EE': "Estonia",
1003 'EG': "Egypt",
1004 'ER': "Eritrea",
1005 'ES': "Spain",
1006 'ET': "Ethiopia",
1007 'EU': "European Union",
1008 'FI': "Finland",
1009 'FJ': "Fiji",
1010 'FM': "Micronesia Federated States of",
1011 'FO': "Faroe Islands",
1012 'FR': "France",
1013 'GA': "Gabon",
1014 'GB': "United Kingdom",
1015 'GD': "Grenada",
1016 'GE': "Georgia",
1017 'GF': "French Guiana",
1018 'GG': "Guernsey",
1019 'GH': "Ghana",
1020 'GI': "Gibraltar",
1021 'GL': "Greenland",
1022 'GM': "Gambia",
1023 'GP': "Guadeloupe",
1024 'GR': "Greece",
1025 'GT': "Guatemala",
1026 'GU': "Guam",
1027 'GW': "Guinea-Bissau",
1028 'GY': "Guyana",
1029 'HK': "Hong Kong",
1030 'HN': "Honduras",
1031 'HR': "Croatia (Local Name: Hrvatska)",
1032 'HT': "Haiti",
1033 'HU': "Hungary",
1034 'ID': "Indonesia",
1035 'IE': "Ireland",
1036 'IL': "Israel",
1037 'IM': "Isle of Man",
1038 'IN': "India",
1039 'IO': "British Indian Ocean Territory",
1040 'IQ': "Iraq",
1041 'IR': "Iran (Islamic Republic of)",
1042 'IS': "Iceland",
1043 'IT': "Italy",
1044 'JE': "Jersey",
1045 'JM': "Jamaica",
1046 'JO': "Jordan",
1047 'JP': "Japan",
1048 'KE': "Kenya",
1049 'KG': "Kyrgyzstan",
1050 'KH': "Cambodia",
1051 'KI': "Kiribati",
1052 'KN': "Saint Kitts and Nevis",
1053 'KR': "Korea Republic of",
1054 'KW': "Kuwait",
1055 'KY': "Cayman Islands",
1056 'KZ': "Kazakhstan",
1057 'LA': "Lao People's Democratic Republic",
1058 'LB': "Lebanon",
1059 'LC': "Saint Lucia",
1060 'LI': "Liechtenstein",
1061 'LK': "Sri Lanka",
1062 'LR': "Liberia",
1063 'LS': "Lesotho",
1064 'LT': "Lithuania",
1065 'LU': "Luxembourg",
1066 'LV': "Latvia",
1067 'LY': "Libyan Arab Jamahiriya",
1068 'MA': "Morocco",
1069 'MC': "Monaco",
1070 'MD': "Moldova Republic of",
1071 'MG': "Madagascar",
1072 'MH': "Marshall Islands",
1073 'MK': "Macedonia the Former Yugoslav Republic of",
1074 'ML': "Mali",
1075 'MM': "Myanmar",
1076 'MN': "Mongolia",
1077 'MO': "Macau",
1078 'MP': "Northern Mariana Islands",
1079 'MR': "Mauritania",
1080 'MS': "Montserrat",
1081 'MT': "Malta",
1082 'MU': "Mauritius",
1083 'MV': "Maldives",
1084 'MW': "Malawi",
1085 'MX': "Mexico",
1086 'MY': "Malaysia",
1087 'MZ': "Mozambique",
1088 'NA': "Namibia",
1089 'NC': "New Caledonia",
1090 'NF': "Norfolk Island",
1091 'NG': "Nigeria",
1092 'NI': "Nicaragua",
1093 'NL': "Netherlands",
1094 'NO': "Norway",
1095 'NP': "Nepal",
1096 'NR': "Nauru",
1097 'NU': "Niue",
1098 'NZ': "New Zealand",
1099 'OM': "Oman",
1100 'PA': "Panama",
1101 'PE': "Peru",
1102 'PF': "French Polynesia",
1103 'PG': "Papua New Guinea",
1104 'PH': "Philippines",
1105 'PK': "Pakistan",
1106 'PL': "Poland",
1107 'PR': "Puerto Rico",
1108 'PS': "Palestinian Territory Occupied",
1109 'PT': "Portugal",
1110 'PW': "Palau",
1111 'PY': "Paraguay",
1112 'QA': "Qatar",
1113 'RO': "Romania",
1114 'RS': "Serbia",
1115 'RU': "Russian Federation",
1116 'RW': "Rwanda",
1117 'SA': "Saudi Arabia",
1118 'SB': "Solomon Islands",
1119 'SC': "Seychelles",
1120 'SD': "Sudan",
1121 'SE': "Sweden",
1122 'SG': "Singapore",
1123 'SI': "Slovenia",
1124 'SK': "Slovakia (Slovak Republic)",
1125 'SL': "Sierra Leone",
1126 'SM': "San Marino",
1127 'SN': "Senegal",
1128 'SR': "Suriname",
1129 'SV': "El Salvador",
1130 'SY': "Syrian Arab Republic",
1131 'SZ': "Swaziland",
1132 'TC': "Turks and Caicos Islands",
1133 'TG': "Togo",
1134 'TH': "Thailand",
1135 'TJ': "Tajikistan",
1136 'TM': "Turkmenistan",
1137 'TN': "Tunisia",
1138 'TO': "Tonga",
1139 'TR': "Turkey",
1140 'TT': "Trinidad and Tobago",
1141 'TV': "Tuvalu",
1142 'TW': "Taiwan Province of China",
1143 'TZ': "Tanzania United Republic of",
1144 'UA': "Ukraine",
1145 'UG': "Uganda",
1146 'US': "United States",
1147 'UY': "Uruguay",
1148 'UZ': "Uzbekistan",
1149 'VA': "Holy See (Vatican City State)",
1150 'VE': "Venezuela",
1151 'VG': "Virgin Islands (British)",
1152 'VI': "Virgin Islands (U.S.)",
1153 'VN': "Viet Nam",
1154 'VU': "Vanuatu",
1155 'WF': "Wallis and Futuna Islands",
1156 'WS': "Samoa",
1157 'YE': "Yemen",
1158 'ZA': "South Africa",
1159 'ZM': "Zambia",
1160 'ZW': "Zimbabwe",
1161 'ZZ': "Reserved"
1162},
1163
1164'browsers': {
1165 'UNKNOWN': "Unknown",
1166 'MSIE': "Internet Explorer",
1167 'FIREFOX': "Firefox",
1168 'OPERA': "Opera",
1169 'SAFARI': "Safari",
1170 'OMNIWEB': "OmniWeb",
1171 'CAMINO': "Camino",
1172 'CHROME': "Chrome"
1173},
1174
1175'operatingSystems': {
1176 'UNKNOWN': "Unknown",
1177 'WINDOWS': "Windows",
1178 'MAC': "Mac",
1179 'LINUX': "Linux",
1180 'IPHONE': "iPhone",
1181 'MOBILE': "Mobile",
1182 'OPENBSD': "OpenBSD",
1183 'FREEBSD': "FreeBSD",
1184 'NETBSD': "NetBSD"
1185},
1186
1187
1188 //Calendar texts
1189'calendarStrings': {
1190 'months': {
1191 '0':"January",
1192 '1':"February",
1193 '2':"March",
1194 '3':"April",
1195 '4':"May",
1196 '5':"June",
1197 '6':"July",
1198 '7':"August",
1199 '8':"September",
1200 '9':"October",
1201 '10':"November",
1202 '11':"December"
1203 },
1204 'shortMonths':{
1205 '0':"Jan",
1206 '1':"Feb",
1207 '2':"Mar",
1208 '3':"Apr",
1209 '4':"May",
1210 '5':"Jun",
1211 '6':"Jul",
1212 '7':"Aug",
1213 '8':"Sep",
1214 '9':"Oct",
1215 '10':"Nov",
1216 '11':"Dec"
1217 },
1218
1219 'days':{
1220 '0':"Sunday",
1221 '1':"Monday",
1222 '2':"Tuesday",
1223 '3':"Wednesday",
1224 '4':"Thursday",
1225 '5':"Friday",
1226 '6':"Saturday"
1227 },
1228
1229 'shortDays':{
1230 '0':"Sun",
1231 '1':"Mon",
1232 '2':"Tue",
1233 '3':"Wed",
1234 '4':"Thu",
1235 '5':"Fri",
1236 '6':"Sat"
1237 },
1238
1239 'veryShortDays':{
1240 '0':"Su",
1241 '1':"Mo",
1242 '2':"Tu",
1243 '3':"We",
1244 '4':"Th",
1245 '5':"Fr",
1246 '6':"Sa"
1247 },
1248
1249 'amDesignation':"am",
1250 'pmDesignation':"pm"
1251},
1252
1253
1254// Date format
1255 'fullDate_format':"l, F d, Y H:i:s",
1256
1257__syntaxFix__: "syntax fix"
1258
1259}
diff --git a/frontend/beta/js/Clipperz/PM/Strings/Strings_es-ES.js b/frontend/beta/js/Clipperz/PM/Strings/Strings_es-ES.js
new file mode 100644
index 0000000..1541d5f
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Strings/Strings_es-ES.js
@@ -0,0 +1,480 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29Clipperz.PM.Strings.Languages['es-ES'.toLowerCase()] = MochiKit.Base.merge(Clipperz.PM.Strings.Languages['en-us'], {
30 'clipperzServiceDescription':"<h2>Guárdelo usted mismo!</h2> <ul> <li> <h3>Clipperz es:</h3> <ul> <li> <p>un simple y seguro administrador de contraseñas</p> </li> <li> <p>una efectiva y simple solución de logueo</p> </li> <li> <p>un maletín digital para sus datos confidenciales</p> </li> </ul> </li> <li> <h3>Con Clipperz usted puede:</h3> <ul> <li> <p>administrar y almacenar en línea sus contraseñas y credenciales digitales</p> </li> <li> <p>ingresar en sus servicios web sin ningún nombre de usuario o contraseña</p> </li> <li> <p>protejer todos sus datos sensibles: códigos de alarmas, PINs y números de tarjetas de crédito, &hellip;</p> </li> <li> <p>compartir secretos con sus familiares y socios</p> </li> </ul> </li> <li> <h3>Beneficios de Clipperz:</h3> <ul> <li> <p>es gratis y completamente anónimo</p> </li> <li> <p>con acceso en cualquier momento y desde cualquier ordenador</p> </li> <li> <p>no necesita instalar o descargar ningún programa</p> </li> <li> <p>no necesita guardar secretos en papel o en el ordenador</p> </li> </ul> </li> <li> <h3>Seguridad de Clipperz:</h3> <ul> <li> <p>sus secretos son localmente encriptados por su navegador antes de ser almacenados en Clipperz</p> </li> <li> <p>la llave de encriptación es una frase clave conocida solo por usted</p> </li> <li> <p>Clipperz almacena sus datos de manera encriptada y nunca accede a ellos en forma de texto plano</p> </li> <li> <p>Clipperz esta basado en esquemas estándares de encriptación, no hemos inventado nada</p> </li> <li> <p>usted puede revisar el código todas las veces que lo desee, ¡ pero no necesita conocer algo de encriptación para ser un usuario feliz!</p> </li> </ul> </li> <li> <a href=\"http://www.clipperz.com\" target=\"_blank\">Aprender más</a> </li> </ul> ",
31 'loginFormTitle':"ingrese con su usuario Clipperz",
32 'loginFormUsernameLabel':"usuario",
33 'loginFormPassphraseLabel':"frase clave",
34 'loginFormDontHaveAnAccountLabel':"¿no tiene una cuenta?",
35 'loginFormCreateOneLabel':"crear una",
36 'loginFormForgotYourCredentialsLabel':"¿perdió sus credenciales?",
37 'loginFormAarghThatsBadLabel':"¡Ahhh! ¡eso es malo!",
38 'loginFormAfraidOfMaliciousScriptsLabel':"¿evitar scripts maliciosos?",
39 'loginFormVerifyTheCodeLabel':"verificar el código",
40 'loginFormButtonLabel':"Ingresar",
41 'loginFormOneTimePasswordCheckboxLabel':"usar una frase clave desechable",
42 'loginPanelSwithLanguageDescription':"<h5>Cambiar a su lenguaje preferido</h5> ",
43 'browserCompatibilityDescription':"<p>Obtenga una mejor y más segura experiencia con Firefox. De todas maneras Clipperz funciona también con Opera y MS Explorer!</p> ",
44 'OTPloginMessagePanelInitialTitle':"Ingresar usando una frase clave desechable",
45 'OTPloginMessagePanelInitialText':"Enviando credenciales OTP ...",
46 'OTPloginMessagePanelLoadingTitle':"Ingresar usando una frase clave desechable",
47 'OTPloginMessagePanelLoadingText':"Descargando datos de autenticación encriptados desde el servidor ...",
48 'OTPloginMessagePanelProcessingTitle':"Ingresar usando una frase clave desechable",
49 'OTPloginMessagePanelProcessingText':"Desencriptación local de datos de autenticación ...",
50 'loginMessagePanelInitialTitle':"Ingresando ...",
51 'loginMessagePanelInitialButtonLabel':"Cancelar",
52 'loginMessagePanelConnectedTitle':"Conectado",
53 'loginMessagePanelConnectedText':"Hecho",
54 'loginMessagePanelFailureTitle':"Error",
55 'loginMessagePanelFailureText':"Ingreso fallido",
56 'loginMessagePanelFailureButtonLabel':"Cerrar",
57 'connectionLoginSendingCredentialsMessageTitle':"Verificando credenciales",
58 'connectionLoginSendingCredentialsMessageText':"Enviando credenciales",
59 'connectionLoginCredentialsVerificationMessageTitle':"Verificando credenciales",
60 'connectionLoginCredentialsVerificationMessageText':"Realizando una autenticación SRP",
61 'connectionLoginDoneMessageTitle':"Verificando credenciales",
62 'connectionLoginDoneMessageText':"Conectado",
63 'userLoginPanelUpgradingUserCredentialsMessageTitle':"Verificando credenciales",
64 'userLoginPanelUpgradingUserCredentialsMessageText':"Actualizando sus credenciales al nuevo esquema de autenticación",
65 'userLoginPanelConnectedMessageTitle':"Usuario autenticado",
66 'userLoginPanelConnectedMessageText':"Exitosamente logueado",
67 'userLoginPanelTryingAnOlderConnectionSchemaMessageTitle':"Verifying credentials",
68 'userLoginPanelTryingAnOlderConnectionSchemaMessageText':"Probando un esquema de autenticación antiguo",
69 'userLoginPanelLoadingUserDataMessageTitle':"Usuario autenticado",
70 'userLoginPanelLoadingUserDataMessageText':"Descargando encabezamientos encriptados desde Clipperz",
71 'userLoginPanelDecryptingUserDataMessageTitle':"Usuario autenticado",
72 'userLoginPanelDecryptingUserDataMessageText':"Desencriptación local de datos",
73 'userLoginPanelDecryptingUserStatisticsMessageTitle':"Usuario autenticado",
74 'userLoginPanelDecryptingUserStatisticsMessageText':"Desencriptación local de estadísticas de uso",
75 'splashAlertTitle':"¡Bienvenido a Clipperz!",
76 'splashAlertText':"<p>Algunas advertencias sobre seguridad</p> <ul> <li> <p>Almacenar sus datos en Clipperz es tan seguro como la frase clave que usted elija para protegerlos. Nadie puede acceder a ellos a no ser que conozca la frase clave.</p> </li> <li> <p>Si usted va a usar Clipperz para guardar información sensible y crítica, esté seguro de elegir una frase clave fuerte. ¡Cuanto más larga mejor!</p> </li> <li> <p>Clipperz no le permitirá recuperar una frase clave perdida.</p> </li> </ul> <p>Si necesita más información, por favor visite el sitio de <a href=\"http://www.clipperz.com\" target=\"_blank\">Clipperz</a>.</p> ",
77 'splashAlertCloseButtonLabel':"Aceptar",
78 'registrationFormTitle':"Abrir su cuenta",
79 'registrationFormUsernameLabel':"usuario",
80 'registrationFormPassphraseLabel':"frase clave",
81 'registrationFormRetypePassphraseLabel':"reingrese la frase clave",
82 'registrationFormSafetyCheckLabel':"Yo entiendo que Clipperz no me permite recuperar frases clave perdidas",
83 'registrationFormTermsOfServiceCheckLabel':"He leído y estoy de acuerdo con los <a href='http://www.clipperz.com/terms_of_service' target='_blank'>Términos de Servicio</a>.",
84 'registrationFormDoYouAlreadyHaveAnAccountLabel':"¿usted ya tiene una cuenta?",
85 'registrationFormSimplyLoginLabel':"ingreso simple",
86 'registrationFormButtonLabel':"Registrarse",
87 'registrationFormWarningMessageNotMatchingPassphrases':"Su frase clave no coincide, por favor reescríbala.",
88 'registrationFormWarningMessageSafetyCheckNotSelected':"Por favor, lea y chequee todas las casillas debajo.",
89 'registrationFormWarningMessageTermsOfServiceCheckNotSelected':"Usted necesita estar de acuerdo con los Términos de Servicio.",
90 'registrationMessagePanelInitialTitle':"Creando cuenta ...",
91 'registrationMessagePanelInitialButtonLabel':"Cancelar",
92 'registrationMessagePanelRegistrationDoneTitle':"Registración",
93 'registrationMessagePanelRegistrationDoneText':"Hecho",
94 'registrationMessagePanelFailureTitle':"Registración fallada",
95 'registrationMessagePanelFailureButtonLabel':"Cerrar",
96 'connectionRegistrationSendingRequestMessageText':"Verificando credenciales",
97 'connectionRegistrationSendingCredentialsMessageText':"Enviando credenciales",
98 'registrationSplashPanelTitle':"Aviso de seguridad",
99 'registrationSplashPanelDescriptionConfig':"<p>Estas son sus credenciales de Clipperz, cuídelas. ¡Clipperz nunca más le mostrará su cuenta y frase clave por segunda vez!</p> ",
100 'registrationSplashPanelUsernameLabel':"usuario",
101 'registrationSplashPanelPassphraseLabel':"frase clave",
102 'registrationSplashPanelShowPassphraseButtonLabel':" mostrar frase clave",
103 'donateHeaderLinkLabel':"donaciones",
104 'creditsHeaderLinkLabel':"créditos",
105 'feedbackHeaderLinkLabel':"contacto",
106 'helpHeaderLinkLabel':"ayuda",
107 'forumHeaderLinkLabel':"foro",
108 'recordMenuLabel':"tarjetas",
109 'accountMenuLabel':"cuenta",
110 'dataMenuLabel':"datos",
111 'contactsMenuLabel':"contactos",
112 'toolsMenuLabel':"herramientas",
113 'logoutMenuLabel':"salir",
114 'lockMenuLabel':"bloquear",
115 'lockTitle':"La cuenta está bloqueada",
116 'lockDescriptionConfig':"<p>Para desbloquear su cuenta, por favor ingrese su frase clave</p> ",
117 'unlockButtonLabel':"desbloquear",
118 'changePasswordTabLabel':"Cambiar su frase clave",
119 'changePasswordTabTitle':"Cambiar su frase clave",
120 'changePasswordFormUsernameLabel':"usuario",
121 'changePasswordFormOldPassphraseLabel':"frase clave anterior",
122 'changePasswordFormNewPassphraseLabel':"nueva frase clave",
123 'changePasswordFormRetypePassphraseLabel':"reingrese su nueva frase clave",
124 'changePasswordFormSafetyCheckboxLabel':"Yo entiendo que Clipperz no me permite recuperar una frase clave perdida.",
125 'changePasswordFormSubmitLabel':"Cambiar",
126 'changePasswordFormWrongUsernameWarning':"Usuario incorrecto",
127 'changePasswordFormWrongPassphraseWarning':"Frase clave incorrecta",
128 'changePasswordFormWrongRetypePassphraseWarning':"Sus frases claves no coinciden, por favor reescríbalas.",
129 'changePasswordFormSafetyCheckWarning':"Por favor lea y seleccione la casilla de abajo.",
130 'changePasswordFormProgressDialogTitle':"Cambiando credenciales de usuario",
131 'changePasswordFormProgressDialogConnectedMessageTitle':"Conectado",
132 'changePasswordFormProgressDialogConnectedMessageText':"Hecho",
133 'changePasswordFormProgressDialogErrorMessageTitle':"Error",
134 'changePasswordFormProgressDialogErrorMessageText':"¡Cambio de credenciales fallado!",
135 'changeCredentialsPanelEncryptingDataMessageTitle':"Cambiando su frase clave",
136 'changeCredentialsPanelEncryptingDataMessageText':"Encriptación local de encabezados de tarjetas",
137 'changeCredentialsPanelCreatingNewCredentialsMessageTitle':"Cambiando su frase clave",
138 'changeCredentialsPanelCreatingNewCredentialsMessageText':"Actualizando su credenciales",
139 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageTitle':"Cambiando su frase clave",
140 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageText':"Subiendo sus credenciales encriptadas a Clipperz",
141 'changeCredentialsPanelDoneMessageTitle':"Cambiando su frase clave",
142 'changeCredentialsPanelDoneMessageText':"Hecho",
143 'manageOTPTabLabel':"Administrar su frases clave desechables",
144 'manageOTPTabTitle':"Administrar su frases clave desechables",
145 'manageOTPTabDescription':"<p>Una frase clave desechable uso funciona como una frase clave regular, pero puede ser usada solo una vez.</p> <p>Si las misma frase clave es usada nuevamente en un segundo intento de acceso, esta será rechazada y el proceso de acceso fallará.</p> <p>Inmediatamente después de un acceso exitoso, su on-time frase clave será borrada previniendo accesos fraudulentos.</p> <p>Frases claves desechables son una excelente elección para protegerse de keyloggers y spywares, que pueden recolectar datos desde máquinas comprometidas.</p> <p> <b>Le recomendamos muy fuertemente que use frases claves desechables uso cuando acceda a Clipperz desde terminales públicas, como Internet Cafés, Cybercafés y bibliotecas.</b> </p> ",
146 'oneTimePasswordReadOnlyMessage':"<h6>¡Disculpe!</h6> <p>Usted no puede usar su frases clave desechables mientras usa la versión fuera de línea de Clipperz.</p> ",
147 'oneTimePasswordLoadingMessage':"<h6>Cargando datos</h6> <p>Por favor espere ...</p> ",
148 'oneTimePasswordNoPasswordAvailable':"<h6>No hay frase clave desechables disponible</h6> <p>Haga click en el botón “Nueva” para agregar una frase clave desechables a su cuenta.</p> ",
149 'createNewOTPButtonLabel':"Nueva",
150 'deleteOTPButtonLabel':"Borrar",
151 'printOTPButtonLabel':"Imprimir",
152 'disabledOneTimePassword_warning':"desabilitado",
153 'oneTimePasswordSelectionLink_selectLabel':"Seleccionar:",
154 'oneTimePasswordSelectionLink_all':"todo",
155 'oneTimePasswordSelectionLink_none':"ninguna",
156 'oneTimePasswordSelectionLink_used':"usada",
157 'oneTimePasswordSelectionLink_unused':"sin uso",
158 'saveOTP_encryptUserDataTitle':"Guardando frase clave desechable",
159 'saveOTP_encryptUserDataText':"Procesando nuevas credenciales OTP ...",
160 'saveOTP_encryptOTPDataTitle':"Guardando frase clave desechable",
161 'saveOTP_encryptOTPDataText':"Encriptación local de datos de autenticación ...",
162 'saveOTP_sendingDataTitle':"Guardando frase clave desechable",
163 'saveOTP_sendingDataText':"Enviando datos de autenticación al servidor ...",
164 'saveOTP_updatingInterfaceTitle':"Guardando frase clave desechable",
165 'saveOTP_updatingInterfaceText':"Actualizando interface ...",
166 'accountPreferencesLabel':"Preferencias",
167 'accountPreferencesTabTitle':"Preferencias",
168 'accountPreferencesLanguageTitle':"Seleccione el lenguaje",
169 'accountPreferencesLanguageDescription':"<p>Elija su lenguaje preferido de la siguiente lista.<p> ",
170 'showDonationReminderPanelTitle':"Recordatorios de donaciones",
171 'showDonationReminderPanelDescription':"<p>Mostrar recordatorios de donaciones</p> ",
172 'accountPreferencesInterfaceTitle':"Personalización de la interface",
173 'accountPreferencesInterfaceDescription':"<p>Ajuste Clipperz a sus necesidades.</p> ",
174 'saveUserPreferencesFormSubmitLabel':"Guardar",
175 'cancelUserPreferencesFormSubmitLabel':"Cancelar",
176 'accountPreferencesSavingPanelTitle_Step1':"Guardando preferencias",
177 'accountPreferencesSavingPanelText_Step1':"Encriptación local de sus preferencias",
178 'accountPreferencesSavingPanelTitle_Step2':"Guardando preferencias",
179 'accountPreferencesSavingPanelText_Step2':"Enviando preferencias encriptadas a Clipperz",
180 'accountLoginHistoryLabel':"Historial de accesos",
181 'loginHistoryTabTitle':"Historial de accesos",
182 'loginHistoryReadOnlyMessage':"<h6>¡Perdón!</h6> <p>El historial de acceso no está disponible mientras usa la versión fuera de línea de Clipperz.</p> ",
183 'loginHistoryLoadingMessage':"<h6>Cargando datos</h6> <p>Por favor espere ...</p> ",
184 'loginHistoryLoadedMessage':"<h6>Sus últimos 10 accesos</h6> <p> </p> ",
185 'loginHistoryIPLabel':"IP",
186 'loginHistoryTimeLabel':"fecha",
187 'loginHistoryCurrentSessionText':"sesión actual",
188 'loginHistoryReloadButtonLabel':"Refrescar historial de acceso",
189 'deleteAccountTabLabel':"Borrar su cuenta",
190 'deleteAccountTabTitle':"Borrar su cuenta",
191 'deleteAccountFormUsernameLabel':"usuario",
192 'deleteAccountFormPassphraseLabel':"frase clave",
193 'deleteAccountFormSafetyCheckboxLabel':"Yo entiendo que todos mis datos serán borrados y que esta acción es irreversible.",
194 'deleteAccountFormSubmitLabel':"Borrar mi cuenta",
195 'deleteAccountFormWrongUsernameWarning':"Usuario incorrecto",
196 'deleteAccountFormWrongPassphraseWarning':"Frase clave incorrecta",
197 'deleteAccountFormSafetyCheckWarning':"Por favor, léa y marque la opción debajo.",
198 'accountPanelDeletingAccountPanelConfirmationTitle':"ATENCIÓN",
199 'accountPanelDeleteAccountPanelConfirmationText':"¿Esta Ud. seguro que desea borrar esta cuenta?",
200 'accountPanelDeleteAccountPanelConfirmButtonLabel':"Sí",
201 'accountPanelDeleteAccountPanelDenyButtonLabel':"No",
202 'offlineCopyTabLabel':"Copia fuera de línea",
203 'offlineCopyTabTitle':"Copia fuera de línea",
204 'offlineCopyTabDescription':"<p>Con solo un clik usted puede descargar todos sus datos encriptados desde los servidores de Clipperz a su disco rígido y crear una versión solo-lectura fuera de línea para ser usada cuando usted no está conectado a Internet.</p> <p>La versión solo-lectura es tan segura como la lectura-escritura y no expondrá sus datos a mayores riegos desde el momento que ambas comparten el mismo código y arquitectura de seguridad.</p> <ol> <li> <p>Haga click en el link debajo para comenzar la descarga.</p> </li> <li> <p>El navegador le preguntará que hacer con el archivo “Clipperz_YYYYMMDD.html”. Guárdelo en su disco rígido.</p> </li> <li> <p>Haga doble click en el archivo descargado para ejecutar la versión fuera de línea en su navegador.</p> </li> <li> <p>Ingrese el usuario y la frase clave habitual.</p> </li> </ol> ",
205 'offlineCopyDownloadLinkLabel':"Descargar",
206 'offlineCopyDownloadWarning':"<h4> <a href=\"#\" id=\"offlineCopyDownloadWarningLink\">¡Actualize su “copia fuera de línea”!</a> </h4> <p>Usted ha recientemente creado o modificado una o más tarjetas, podría ser necesario que realize una nueva “copia fuera de línea”.</p> ",
207 'sharingTabLabel':"Compartir",
208 'sharingTabTitle':"Compartir",
209 'sharingTabDescription':"<p>Muy frecuentemente una pieza de información confidencial necesita ser compartida con una o más personas.</p> <p>Esto debería ser tan simple como darle a sus colegas el accese al código de su casilla de voz cuando está fuera de la oficina, o tan complicado con habilitarles a sus herederos el derecho de acceder a su caja de seguridad en su banco.</p> <p>Clipperz puede permitirle compartir sus secretos de una forma segura y directa.</p> <p> </p> <p> <b>Proximamente ...</b> </p> ",
210 'importTabLabel':"Importar",
211 'importTabTitle':"Importar",
212 'importTabDescription':"<p> <b>Proximamente ...</b> </p> ",
213 'printingTabLabel':"Exportar",
214 'printingTabTitle':"Exportar",
215 'printingTabDescription':"<p> <b>Imprima sus datos</b> </p> <p>Haciendo click en el enlace que sigue se abrirá una nueva ventana mostrando todas sus tarjetas en un formato imprimible.</p> <p>Si usted está imprimiendo con propósitos de respaldo, por favor considere la opción más segura provista por la creación de una “copia fuera de línea”.</p> ",
216 'printingLinkLabel':"Versión imprimible",
217 'contactsTabLabel':"Contactos",
218 'contactsTabTitle':"Contactos",
219 'passwordGeneratorTabLabel':"Generador de contraseñas",
220 'passwordGeneratorTabTitle':"Generador de contraseñas",
221 'paswordGeneratorTabDescriptionConfig':"<p> </p> ",
222 'passwordGeneratorTabButtonLabel':"Generar contraseña",
223 'bookmarkletTabLabel':"Bookmarklet",
224 'bookmarkletTabTitle':"Bookmarklet",
225 'bookmarkletTabDescription':"<p>Un bookmarklet es una simple herramienta de \"un click\" que puede realizar tareas muy útiles. Este puede ser grabado y usado como un marcador normal de una página web.</p> <p>El Clipperz bookmarklet le ayudará a usted a crear rapidamente tarjetas nuevas y accesos directos dentro de las tarjetas existentes.</p> <p> <b>Por favor tenga en cuenta que el bookmarklet no incluye ninguna información relacionadas con su cuenta (ej: su nombre de usuario o clave), el bookmarklet es una herramienta general que contiene el mismo código para todos los usuarios de Clipperz.</b> </p> <h3>How to install the bookmarklet</h3> <h5>Firefox, Camino, Opera, Safari</h5> <ol> <li> <p>Asegúrese que la “Barra de marcadores” está mostrada seleccionando “Ver > Barra de herramientas > Barra de marcadores”, menú similar, desde el menú del navegador.</p> </li> <li> <p>Arrastre el enlace “Agregar a Clipperz” sobre la barra de marcadores.</p> </li> </ol> <h5>Internet Explorer</h5> <ol> <li> <p>Asegúrese que la barra “Vínculos” es mostrada seleccionando “Ver > Barra de Herramientas > Herramientas > Vínculos” desde el menú del navegador.</p> </li> <li> <p>Haga click con el botón derecho del mouse en el link “Agregar a Clipperz”.</p> </li> <li> <p>Seleccione “Agregar a favoritos” desde el menú contextual.</p> </li> <li> <p>Haga click en “Si” o “Acepto” a cualquier advertencia de seguridad que le aparezca.</p> </li> <li> <p>Abra la carpeta “Vínculos” y haga click en “OK”</p> </li> </ol> ",
226 'bookmarkletTabBookmarkletTitle':"Agregar a Clipperz",
227 'bookmarkletTabInstructions':"<h3>Como crear una nueva tarjeta que incluya un enlace de “acceso directo” a un servicio en línea.</h3> <ol> <li> <p>Abra una página web dónde el formulario de logueo está almacenado (es la página donde usualmente ingresa sus credenciales firmadas)</p> </li> <li> <p>Ejecute el bookmarklet haciendo click en éste: una ventana emergente (pop-up) aparecerá sobre la página web.</p> </li> <li> <p>Copie al portapapeles el contenido de todo el texto dentro de la ventana emergente (pop-up) (Ctrl-C)</p> </li> <li> <p>Ingrese en su cuenta Clipperz y haga click en el botón <b>Agregar nueva tarjeta</b>.</p> </li> <li> <p>Seleccione la plantilla “Acceso directo” y pegue el contenido del portapapeles en el formulario (Ctrl-V)</p> </li> <li> <p>Haga click en el botón <b>Crear</b>, revise los datos y luego haga click en <b>Guardar</b>.</p> </li> </ol> <h3>Cómo agregar un enlace “acceso directo” a una tarjeta existente</h3> <ol> <li> <p>Igual que arriba.</p> </li> <li> <p>Igual que arriba.</p> </li> <li> <p>Igual que arriba.</p> </li> <li> <p>Ingrese en su cuenta Clipperz y seleccione una tarjeta conteniendo las credenciales de un servicio web que usted visitó y haga click en el botón <b>Editar</b>.</p> </li> <li> <p>Pegue el contenido del portapapeles en el área de texto de la sección “Acceso directo” (Ctrl-V)</p> </li> <li> <p>Haga click en el botón <b>Agregar acceso directo</b>, revise los detalles y luego haga click en <b>Guardar</b>.</p> </li> </ol> <p> </p> <p>Más información sobre bookmarklet está <a href=\"http://www.clipperz.com/support/user_guide/bookmarklet\" target=\"_blank\">disponible aquí</a>.</p> ",
228 'mainPanelDirectLoginBlockLabel':"Accesos directos",
229 'directLinkReferenceShowButtonLabel':"ver",
230 'mainPanelDirectLoginBlockDescription':"<p>¡ Agregar “accesos directos” para ingresar en sus cuentas de la web sin necesidad de escribir nombres de usuarios o claves!</p> <p>“Accesos directos” incrementa notablemente la seguridad de sus claves desde que ud. puede:</p> <ul> <li> <p>usar claves complejas con comodidad;</p> </li> <li> <p>nunca más reusar la misma clave simple.</p> </li> </ul> <p> </p> <a href=\"http://www.clipperz.com/support/user_guide/direct_logins\" target=\"_blank\">Apreender más sobre “accesos directos”</a> ",
231 'mainPanelRecordsBlockLabel':"Tarjetas",
232 'mainPanelAddRecordButtonLabel':"Agregar tarjeta nueva",
233 'mainPanelRemoveRecordButtonLabel':"Borrar tarjeta",
234 'mainPanelRecordFilterBlockAllLabel':"todo",
235 'mainPanelRecordFilterBlockTagsLabel':"tags",
236 'mainPanelRecordFilterBlockSearchLabel':"buscar",
237 'recordDetailNoRecordAtAllTitle':"¡Bienvenido a Clipperz!",
238 'recordDetailNoRecordAtAllDescription':"<h5>Comienze agregando tarjetas a su cuenta.</h5> <p>Tarjetas son formularios simples y flexibles donde Usted puede almacenar sus claves y cualquier otro dato confidencial.</p> <p>Tarjetas pueden contener credenciales para acceder a un sitio web, la conbinación del candado de su bicicleta, detalles de su tarjeta de crédito, ....</p> <h5>¡No olvide los bookmarklet!</h5> <p>Antes de comenzar, instale el “Agregar a Clipperz” bookmarklet: esta hará la creación de tarjetas más fácil y más divertida.</p> <p>Vaya al marcador “herramientas” para descubrir como instalar y usarlo.</p> <p> </p> <p>Luego simplemente haga click en el botón “Agregar nueva tarjeta” y disfrute su cuenta Clipperz.</p> <p> </p> <a href=\"http://www.clipperz.com/support/user_guide/managing_cards\" target=\"_blank\">Apreender más acerca de la creación y administración de las tarjetas</a> ",
239 'newRecordWizardTitleBox':"<h5>Por favor seleccione una plantilla</h5> <p>Tarjetas son formularios simples y flexibles donde usted puede almacenar claves y cualquier otro dato confidencial.</p> <p>Comienze eligiendo una de las plantillas que se encuentran debajo. Usted siempre puede personalizar sus tarjetas más tarde agregando o borrando campos.</p> ",
240 'newRecordWizardBookmarkletConfigurationTitle':"Acceso directo",
241 'newRecordWizardBookmarkletConfigurationDescription':"<p>Pegue debajo el código de configuración generado por el bookmarklet Clipperz.</p> <p>Una nueva tarjeta con un acceso directo a su cuenta web será creada.</p> ",
242 'newRecordWizardCreateButtonLabel':"Crear",
243 'newRecordWizardCancelButtonLabel':"Cancelar",
244 'donateSplashPanelTitle':"¡Apoye a Clipperz, haga una donación hoy!",
245 'donateSplashPanelDescription':"<p>Una pocas buenas razones para hacer una donación:</p> <ul> <li> <p>apoyar el desarrollo de nuevas utilidades</p> </li> <li> <p>mantener Clipperz gratuito</p> </li> <li> <p>mostrar su aprecio por nuestro duro trabajo</p> </li> </ul> <p>Por cualquier información adicional, por favor visite nuestra <a href=\"http://www.clipperz.com/donations\" target=\"_blank\">página de donaciones</a>.</p> <p> <b>¿Listo para hacer una donación?</b> </p> ",
246 'donateCloseButtonLabel':"No todavía",
247 'donateDonateButtonLabel':"Si",
248 'recordTemplates':{
249 'WebAccount':{
250 'title':"Contraseña web",
251 'description':"<p>Una simple tarjeta para almacenar sus credenciales de acceso a sus servicios online.</p> ",
252 'fields':{
253 'URL':"Dirección web",
254 'TXT':"Usuario o correo electrónico",
255 'PWD':"Contraseña"
256 }
257 },
258 'BankAccount':{
259 'title':"Cuenta bancaria",
260 'description':"<p>Almacene en forma segura su número de cuenta bancaria y credenciales de servicios bancarios en línea.</p> ",
261 'fields':{
262 'TXT':"Banco",
263 'TXT':"Número de cuenta",
264 'URL':"Sitio web del Banco",
265 'TXT':"ID del servicio bancario en línea",
266 'PWD':"Contraseña del servicio bancario en línea"
267 }
268 },
269 'CreditCard':{
270 'title':"Tarjeta de crédito",
271 'description':"<p>Número de tarjeta, fecha de vencimiento, CVV2 y PIN siempre a mano con Clipperz.</p> ",
272 'fields':{
273 'TXT':"Tipo (Visa, AmEx, ...)",
274 'TXT':"Número",
275 'TXT':"Nombre del propietario",
276 'TXT':"Fecha de vencimiento",
277 'TXT':"CVV2",
278 'PWD':"PIN cajero automático",
279 'URL':"Sitio web tarjeta",
280 'TXT':"Usuario",
281 'PWD':"Contraseña"
282 }
283 },
284 'AddressBookEntry':{
285 'title':"Libreta de direcciones",
286 'description':"<p>Clipperz puede también funcionar como su nueva libreta privada de direcciones. Use esta plantilla para crear fácilmente nuevas entradas.</p> ",
287 'fields':{
288 'TXT':"Nombre",
289 'TXT':"Correo electrónico",
290 'TXT':"Teléfono",
291 'TXT':"Móvil",
292 'ADDR':"Dirección"
293 }
294 },
295 'Custom':{
296 'title':" Tarjeta personalizada",
297 'description':"<p>No importa que tipo de dato confidencial usted necesita proteger, puede crear la tarjeta que necesite.</p> ",
298 'fields':{
299 'TXT':"Etiqueta 1",
300 'TXT':"Etiqueta 2",
301 'TXT':"Etiqueta 3"
302 }
303 }
304},
305 'recordFieldTypologies':{
306 'TXT':{
307 'description':"simple text field",
308 'shortDescription':"texto"
309 },
310 'PWD':{
311 'description':"simple text field, with default status set to hidden",
312 'shortDescription':"contraseña"
313 },
314 'URL':{
315 'description':"simple text field in edit mode, that became an active url in view mode",
316 'shortDescription':"dirección web"
317 },
318 'DATE':{
319 'description':"a value set with a calendar helper",
320 'shortDescription':"fecha"
321 },
322 'ADDR':{
323 'description':"just like the URL, but the active link points to Google Maps (or similar service) passing the address value as argument",
324 'shortDescription':"dirección postal"
325 },
326 'CHECK':{
327 'description':"check description",
328 'shortDescription':"check"
329 },
330 'RADIO':{
331 'description':"radio description",
332 'shortDescription':"radio"
333 },
334 'SELECT':{
335 'description':"select description",
336 'shortDescription':"select"
337 }
338},
339 'newRecordPanelGeneralExceptionTitle':"Error",
340 'newRecordPanelGeneralExceptionMessage':"El texto de configuración no es válido. Asegúrese que toma su texto desde la ventana emergente del bookmarklet.",
341 'newRecordPanelWrongBookmarkletVersionExceptionTitle':"Error",
342 'newRecordPanelWrongBookmarkletVersionExceptionMessage':"El texto de configuración ha sido generado por una versión anterior de bookmarklet. Por favor actualize su bookmarklet y pruebe nuevamente.",
343 'newRecordPanelExceptionPanelCloseButtonLabel':"Cancelar",
344 'mainPanelDeletingRecordPanelConfirmationTitle':"Eliminando tarjeta seleccionada",
345 'mainPanelDeleteRecordPanelConfirmationText':"¿Desea realmente eliminar la tarjeta seleccionada?",
346 'mainPanelDeleteRecordPanelConfirmButtonLabel':"Sí",
347 'mainPanelDeleteRecordPanelDenyButtonLabel':"No",
348 'mainPanelDeletingRecordPanelInitialTitle':"Eliminando tarjeta seleccionada",
349 'mainPanelDeletingRecordPanelCompletedText':"Hecho",
350 'deleteRecordPanelCollectRecordDataMessageTitle':"Eliminar tarjeta",
351 'deleteRecordPanelCollectRecordDataMessageText':"Actualizando lista de tarjetas",
352 'deleteRecordPanelEncryptUserDataMessageTitle':"Eliminar tarjeta",
353 'deleteRecordPanelEncryptUserDataMessageText':"Encriptación local de encabezamiento de tarjetas",
354 'deleteRecordPanelSendingDataToTheServerMessageTitle':"Eliminar tarjeta",
355 'deleteRecordPanelSendingDataToTheServerMessageText':"Subiendo encabezamiento de tarjetas encriptadas a Clipperz",
356 'deleteRecordPanelUpdatingTheInterfaceMessageTitle':"Eliminar tarjeta",
357 'deleteRecordPanelUpdatingTheInterfaceMessageText':"Actualizando interface",
358 'recordDetailNoRecordSelectedTitle':"No hay tarjetas seleccionadas",
359 'recordDetailNoRecordSelectedDescription':"<p>Por favor seleccione una tarjeta de la lista de la izquierda.</p> ",
360 'recordDetailLoadingRecordMessage':"Descargando tarjetas encriptadas desde Clipperz",
361 'recordDetailDecryptingRecordMessage':"Desencriptación local de los datos de las tarjetas",
362 'recordDetailLoadingRecordVersionMessage':"Descargando última versión de la tarjeta",
363 'recordDetailDecryptingRecordVersionMessage':"Desencriptación local de la última versión",
364 'recordDetailLoadingErrorMessageTitle':"Error mientras descargaba la tarjeta",
365 'recordDetailNotesLabel':"Notas",
366 'recordDetailLabelFieldColumnLabel':"Campo título",
367 'recordDetailDataFieldColumnLabel':"Campo de datos",
368 'recordDetailTypeFieldColumnLabel':"Tipo",
369 'recordDetailSavingChangesMessagePanelInitialTitle':"Guardando tarjeta",
370 'recordDetailAddFieldButtonLabel':"Agregar nuevo campo",
371 'recordDetailPasswordFieldHelpLabel':"para copiar la contraseña al portapapeles, haga click en la estrella y luego Ctrl-C",
372 'recordDetailPasswordFieldScrambleLabel':"ocultar",
373 'recordDetailPasswordFieldUnscrambleLabel':"mostrar",
374 'recordDetailDirectLoginBlockTitle':"Acceso directos",
375 'recordDetailNewDirectLoginDescription':"<p>Configuración de los accesos directos</p> ",
376 'recordDetailDirectLoginBlockNoDirectLoginConfiguredDescription':"<p>¿Esta tarjeta contiene credenciales para acceder a un servicio en línea?</p> <p>¡Use los bookmarklet para configurar un \"acceso directo\" desde Clpperz con solo un click!</p> ",
377 'recordDetailAddNewDirectLoginButtonLabel':"Agregar nuevo acceso directo",
378 'recordDetailEditButtonLabel':"Editar",
379 'recordDetailSaveButtonLabel':"Guardar",
380 'recordDetailCancelButtonLabel':"Cancelar",
381 'newRecordTitleLabel':"_nueva tarjeta_",
382 'recordSaveChangesPanelCollectRecordInfoMessageTitle':"Guardar tarjeta",
383 'recordSaveChangesPanelCollectRecordInfoMessageText':"Actualizando encabezamiento de tarjetas",
384 'recordSaveChangesPanelEncryptUserDataMessageTitle':"Guardar tarjeta",
385 'recordSaveChangesPanelEncryptUserDataMessageText':"Encriptación local de encabezamiento de tarjetas",
386 'recordSaveChangesPanelEncryptRecordDataMessageTitle':"Guardar tarjeta",
387 'recordSaveChangesPanelEncryptRecordDataMessageText':"Encriptación local de los datos de la tarjeta",
388 'recordSaveChangesPanelEncryptRecordVersionDataMessageTitle':"Guardar tarjeta",
389 'recordSaveChangesPanelEncryptRecordVersionDataMessageText':"Encriptación local de la versión de los datos de la tarjeta",
390 'recordSaveChangesPanelSendingDataToTheServerMessageTitle':"Guardar tarjeta",
391 'recordSaveChangesPanelSendingDataToTheServerMessageText':"Subiendo encabezamiento de tarjeta encriptada a Clipperz",
392 'recordSaveChangesPanelUpdatingTheInterfaceMessageTitle':"Guardar tarjeta",
393 'recordSaveChangesPanelUpdatingTheInterfaceMessageText':"Actualizando la interface",
394 'passwordGeneratorPanelTitle':"Generador de contraseñas",
395 'passwordGeneratorPanelOkLabel':"Ok",
396 'passwordGeneratorPanelCancelLabel':"Cancelar",
397 'passwordGeneratorLengthLabel':"longitud:",
398 //'DWRUtilLoadingMessage':"Cargando datos ...",
399 'comingSoon':"próximamente ...",
400 'panelCollectingEntryopyMessageText':"Recogiendo entropía",
401 'directLoginConfigurationCheckBoxFieldSelectedValue':"Sí",
402 'directLoginConfigurationCheckBoxFieldNotSelectedValue':"No",
403 'WELCOME_BACK':"¡Bienvenido!",
404 'currentConnectionText':"Usted está ahora conectado desde ip&nbsp;__ip__, aparentemente desde __country__, usando __browser__ en __operatingSystem__.",
405 'latestConnectionText':"Su última conexión fue __elapsedTimeDescription__ (__time__) desde ip&nbsp;__ip__, aparentemente desde __country__, usando __browser__ en __operatingSystem__.",
406 'fullLoginHistoryLinkLabel':"mostrar historial de acceso",
407 'elapsedTimeDescriptions':{
408 'MORE_THAN_A_MONTH_AGO':"más de un mes atrás",
409 'MORE_THAN_A_WEEK_AGO':"más de una semana atrás",
410 'MORE_THAN_*_WEEKS_AGO':"más de __elapsed__ semanas atrás",
411 'YESTERDAY':"ayer",
412 '*_DAYS_AGO':"__elapsed__ días atrás",
413 'ABOUT_AN_HOUR_AGO':"about an hour ago",
414 '*_HOURS_AGO':"__elapsed__ hours ago",
415 'JUST_A_FEW_MINUTES_AGO':"hace unos minutos",
416 'ABOUT_*_MINUTES_AGO':"hace __elapsed__ minutos atrás"
417},
418 'unknown_ip':"desconocida",
419 'calendarStrings':{
420 'months':{
421 '0':"Enero",
422 '1':"Febrero",
423 '2':"Marzo",
424 '3':"Abril",
425 '4':"Mayo",
426 '5':"Junio",
427 '6':"Julio",
428 '7':"Agosto",
429 '8':"Setiembre",
430 '9':"Octubre",
431 '10':"Noviembre",
432 '11':"Diciembre"
433 },
434 'shortMonths':{
435 '0':"Ene",
436 '1':"Feb",
437 '2':"Mar",
438 '3':"Abr",
439 '4':"May",
440 '5':"Jun",
441 '6':"Jul",
442 '7':"Ago",
443 '8':"Set",
444 '9':"Oct",
445 '10':"Nov",
446 '11':"Dic"
447 },
448 'days':{
449 '0':"Domingo",
450 '1':"Lunes",
451 '2':"Martes",
452 '3':"Miércoles",
453 '4':"Jueves",
454 '5':"Viernes",
455 '6':"Sábado"
456 },
457 'shortDays':{
458 '0':"Dom",
459 '1':"Lun",
460 '2':"Mar",
461 '3':"Mie",
462 '4':"Jue",
463 '5':"Vie",
464 '6':"Sab"
465 },
466 'veryShortDays':{
467 '0':"Do",
468 '1':"Lu",
469 '2':"Ma",
470 '3':"Mi",
471 '4':"Ju",
472 '5':"Vi",
473 '6':"Sa"
474 },
475 'amDesignation':"am",
476 'pmDesignation':"pm"
477},
478
479__syntaxFix__: "syntax fix"
480});
diff --git a/frontend/beta/js/Clipperz/PM/Strings/Strings_fr-FR.js b/frontend/beta/js/Clipperz/PM/Strings/Strings_fr-FR.js
new file mode 100644
index 0000000..c137fb8
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Strings/Strings_fr-FR.js
@@ -0,0 +1,362 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29Clipperz.PM.Strings.Languages['fr-FR'.toLowerCase()] = MochiKit.Base.merge(Clipperz.PM.Strings.Languages['en-us'], {
30 'clipperzServiceDescription':"<h2>Gardez le pour vous!</h2> <ul> <li> <h3>Clipperz est:</h3> <ul> <li> <p>un gestionnaire de mots de passe sécurisé</p> </li> <li> <p>une solution fiable d’authentification unique</p> </li> <li> <p>une chambre forte numérique pour vos données confidentielles</p> </li> </ul> </li> <li> <h3>Avec Clipperz vous pouvez:</h3> <ul> <li> <p>enregistrer et gérer vos mots de passe et autres informations d'identification en ligne</p> </li> <li> <p>vous identifier sur vos sites web sans avoir besoin de saisir votre nom d’utilisateur ou votre mot de passe</p> </li> <li> <p>protéger toutes vos données sensibles: codes d’alarmes, PINs (téléphone portable), carte de crédits, &hellip;</p> </li> <li> <p>partager certaines données confidentielles avec vos proches et vos associés (bientôt disponible!)</p> </li> </ul> </li> <li> <h3>Les avantages de Clipperz:</h3> <ul> <li> <p>c'est gratuit et totalement anonyme</p> </li> <li> <p>accéder à vos données depuis n’importe quel ordinateur</p> </li> <li> <p>vous n'avez besoin d'aucun logiciel et rien n'est à installer sur votre poste</p> </li> <li> <p>cela vous évite de garder des mots de passe sur votre PC ou sur des bouts de papier</p> </li> </ul> </li> <li> <h3>La sécurité de Clipperz:</h3> <ul> <li> <p>vos mots de passe sont localement chiffrés par votre navigateur avant d’être téléchargé à Clipperz</p> </li> <li> <p>la clé de cryptage est une phrase secrète détenue uniquement par vous même</p> </li> <li> <p>héberge vos données sensibles dans des formulaires cryptés et ne peuvent être consultées directement en clair</p> </li> <li> <p>est développé sur des standard de cryptage réputé sans aucune fantaisie ni de bricolage fait maison</p> </li> <li> <p>vous pouvez consulter le code source autant que vous le souhaitez</p> </li> </ul> </li> <li> <a href=\"http://www.clipperz.com\" target=\"_blank\">Plus d’informations</a> </li> </ul> ",
31 'loginFormTitle':"identifiez-vous avec votre compte Clipperz",
32 'loginFormUsernameLabel':"nom d’utilisateur",
33 'loginFormPassphraseLabel':"phrase secrète",
34 'loginFormDontHaveAnAccountLabel':"vous n’avez pas de compte?",
35 'loginFormCreateOneLabel':"créez votre compte",
36 'loginFormForgotYourCredentialsLabel':"vous avez oublié votre certificat?",
37 'loginFormAarghThatsBadLabel':"c’est fort dommage pour vous!",
38 'loginFormAfraidOfMaliciousScriptsLabel':"vous avez peur des script malicieux?",
39 'loginFormVerifyTheCodeLabel':"vérifiez le code",
40 'loginFormButtonLabel':"S’identifer",
41 'loginPanelSwithLanguageDescription':"<p>Sélectionnez votre langue préféré</p> ",
42 'browserCompatibilityDescription':"<p>Have a better and safer Clipperz experience with Firefox. However Clipperz works just fine also with Opera and MS Internet Explorer!</p> ",
43 'loginMessagePanelInitialTitle':"En cours d’identification ...",
44 'loginMessagePanelInitialButtonLabel':"Annuler",
45 'loginMessagePanelConnectedTitle':"Connecté",
46 'loginMessagePanelConnectedText':"Terminé",
47 'loginMessagePanelFailureTitle':"Erreur",
48 'loginMessagePanelFailureText':"Identification échoué",
49 'loginMessagePanelFailureButtonLabel':"Fermer",
50 'connectionLoginSendingCredentialsMessageTitle':"Vérification des identifiants",
51 'connectionLoginSendingCredentialsMessageText':"Envoi des identifiants",
52 'connectionLoginCredentialsVerificationMessageTitle':"Vérification des identifiants",
53 'connectionLoginCredentialsVerificationMessageText':"Authentification SRP en cours",
54 'connectionLoginDoneMessageTitle':"Vérification des identifiants",
55 'connectionLoginDoneMessageText':"Connecté",
56 'userLoginPanelUpgradingUserCredentialsMessageTitle':"Vérification des identifiants",
57 'userLoginPanelUpgradingUserCredentialsMessageText':"Mise à jour de vos identifiants à un nouveau schéma d’authentification",
58 'userLoginPanelConnectedMessageTitle':"Utilisateur identifié",
59 'userLoginPanelConnectedMessageText':"Vous vous êtes identifié avec succès",
60 'userLoginPanelTryingAnOlderConnectionSchemaMessageTitle':"Vérification des identifiants",
61 'userLoginPanelTryingAnOlderConnectionSchemaMessageText':"Nous essayons un ancien schéma d’authentification",
62 'userLoginPanelLoadingUserDataMessageTitle':"Utilisateur identifié",
63 'userLoginPanelLoadingUserDataMessageText':"Téléchargement des cartes d’en-têtes chiffrés depuis Clipperz",
64 'userLoginPanelDecryptingUserDataMessageTitle':"Utilisateur identifié",
65 'userLoginPanelDecryptingUserDataMessageText':"Décryptage local des en-têtes chiffrés",
66 'userLoginPanelDecryptingUserStatisticsMessageTitle':"Utilisateur identifié",
67 'userLoginPanelDecryptingUserStatisticsMessageText':"Décryptage local des statistiques",
68 'splashAlertTitle':"Bienvenue sur Clipperz!",
69 'splashAlertText':"<p>Conseils de sécurité</p> <ul> <li> <p>Le stockage de vos mots de passe sur Clipperz est aussi sécurisé que la phrase que vous avez sélectionnée pour les protéger. Personne ne peux y accéder tant que personne ne connait votre phrase secrète.</p> </li> <li> <p>Si vous allez utiliser Clipperz pour sauvegarder des informations sensibles et critiques assurez-vous d’utiliser une phrase secrète compliquée. Plus elle sera longue mieux ce sera!</p> </li> <li> <p>Clipperz ne sera pas capable de récupérer votre phrase secrète!</p> </li> </ul> <p>Pour toute autre information, veuillez vous référer au site <a href=\"http://www.clipperz.com\" target=\"_blank\">Clipperz</a>.</p> ",
70 'splashAlertCloseButtonLabel':"Ok",
71 'registrationFormTitle':"créer votre compte",
72 'registrationFormUsernameLabel':"nom d’utilisateur",
73 'registrationFormPassphraseLabel':"phrase secrète",
74 'registrationFormRetypePassphraseLabel':"re-saisissez votre phrase secrète",
75 'registrationFormSafetyCheckLabel':"J’accepte que Clipperz ne pourra pas récupérer ma phrase secrète.",
76 'registrationFormTermsOfServiceCheckLabel':"J’ai lu et j’accepte les <a href='http://www.clipperz.com/terms_of_service' target='_blank'>Conditions d’Utilisation du Service</a>.",
77 'registrationFormDoYouAlreadyHaveAnAccountLabel':"avez-vous déjà un compte?",
78 'registrationFormSimplyLoginLabel':"identifiez-vous",
79 'registrationFormButtonLabel':"S’inscrire",
80 'registrationFormWarningMessageNotMatchingPassphrases':"Vos phrases secrètes ne correspondent pas, veuillez les saisir à nouveau.",
81 'registrationFormWarningMessageSafetyCheckNotSelected':"Veuillez lire et cocher les cases-à-cocher ci-dessous.",
82 'registrationFormWarningMessageTermsOfServiceCheckNotSelected':"Vous devez accepter les “Conditions d’Utilisation du Service”.",
83 'registrationMessagePanelInitialTitle':"Création du compte en cours ...",
84 'registrationMessagePanelInitialButtonLabel':"Annuler",
85 'registrationMessagePanelRegistrationDoneTitle':"Enregistrement",
86 'registrationMessagePanelRegistrationDoneText':"Terminé",
87 'registrationMessagePanelFailureTitle':"Enregistrement échoué",
88 'registrationMessagePanelFailureButtonLabel':"Fermer",
89 'connectionRegistrationSendingRequestMessageText':"Vérification en cours des identifiants",
90 'connectionRegistrationSendingCredentialsMessageText':"Envoi des identifiants",
91 'registrationSplashPanelTitle':"Conseils de sécurité",
92 'registrationSplashPanelDescription':"<p>Ce sont vos identifiants Clipperz, gardez les biens. Clipperz ne va plus jamais vous montrer votre nom d’utilisateur et votre phrase secrète!</p> ",
93 'registrationSplashPanelUsernameLabel':"nom d’utilisateur",
94 'registrationSplashPanelPassphraseLabel':"phrase secrète",
95 'registrationSplashPanelShowPassphraseButtonLabel':"afficher la phrase secrète",
96 'donateHeaderLinkLabel':"faites un don",
97 'creditsHeaderLinkLabel':"crédits",
98 'feedbackHeaderLinkLabel':"votre avis",
99 'helpHeaderLinkLabel':"aide",
100 'forumHeaderLinkLabel':"forum",
101 'recordMenuLabel':"cartes",
102 'accountMenuLabel':"compte",
103 'dataMenuLabel':"données",
104 'contactsMenuLabel':"contacts",
105 'toolsMenuLabel':"outils",
106 'logoutMenuLabel':"déconnexion",
107 'lockMenuLabel':"verrouiller",
108 'lockTitle':"Le compte est verrouillé",
109 'lockDescription':"<p>Pour déverrouiller votre compte, veuillez saisir votre phrase secrète</p> ",
110 'unlockButtonLabel':"Déverrouiller",
111 'changePasswordTabLabel':"Changer votre phrase secrète",
112 'changePasswordTabTitle':"Changer votre phrase secrète",
113 'changePasswordFormUsernameLabel':"nom d’utilisateur",
114 'changePasswordFormOldPassphraseLabel':"ancienne phrase secrète",
115 'changePasswordFormNewPassphraseLabel':"nouvelle phrase secrète",
116 'changePasswordFormRetypePassphraseLabel':"re-saisissez phrase secrète",
117 'changePasswordFormSafetyCheckboxLabel':"Je sais que Clipperz ne pourra pas récupérer ma phrase secrète.",
118 'changePasswordFormSubmitLabel':"Changer ma phrase secrète",
119 'changePasswordFormWrongUsernameWarning':"Nom d’utilisateur incorrect",
120 'changePasswordFormWrongPassphraseWarning':"Phrase secrète incorrect",
121 'changePasswordFormWrongRetypePassphraseWarning':"Votre phrase secrète ne correspond pas, veuillez la saisir à nouveau",
122 'changePasswordFormSafetyCheckWarning':"Veuillez lire et cocher la case-à-cocher ci-dessous",
123 'changePasswordFormProgressDialogTitle':"Changement des identifiants utilisateurs",
124 'changePasswordFormProgressDialogConnectedMessageTitle':"Connecté",
125 'changePasswordFormProgressDialogConnectedMessageText':"Terminé",
126 'changePasswordFormProgressDialogErrorMessageTitle':"Erreur",
127 'changePasswordFormProgressDialogErrorMessageText':"Changement de identifiants échoué!",
128 'changeCredentialsPanelEncryptingDataMessageTitle':"Changement de votre phrase secrète",
129 'changeCredentialsPanelEncryptingDataMessageText':"Cryptage local des identifiants",
130 'changeCredentialsPanelCreatingNewCredentialsMessageTitle':"Modifier votre phrase secrète",
131 'changeCredentialsPanelCreatingNewCredentialsMessageText':"Mettre à jour vos identifiants",
132 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageTitle':"Modifier votre phrase secrète",
133 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageText':"Téléchargement de vos identifiants sur Clipperz.com",
134 'changeCredentialsPanelDoneMessageTitle':"Modifier votre phrase secrète",
135 'changeCredentialsPanelDoneMessageText':"Terminé",
136 'manageOTPTabLabel':"Mettre à jour votre phrase secrète à usage unique",
137 'manageOTPTabTitle':"Mettre à jour votre phrase secrète à usage unique",
138 'manageOTPTabDescription':"<p>Une phrase secrète à usage unique fonctionne comme votre phrase secrète habituelle, mais elle ne peut être utilisé qu'une seule fois.</p> <p>Si la phrase secrète est utilisé de nouveau et que vous tenté de vous identifier à nouveau, vous serez rejeté et le processus d'identification échouera.</p> <p>Juste après une identification correcte, votre phrase secrète à usage unique sera effacée pour interdire tout accès frauduleux.</p> <p>Les phrases secrètes à usage unique sont un excellent choix si vous craignez qu'un logiciel espion ne vole vos données après avoir infecté votre machine.</p> <p> <b>Il est fortement recommandé d'utiliser des phrases secrètes à usage unique lorsque vous accédez à Clipperz depuis un terminal public, comme un cybercafé ou une borne Internet.</b> </p> ",
139 'accountPreferencesLabel':"Préférences",
140 'accountPreferencesTabTitle':"Préférences",
141 'accountPreferencesLanguageTitle':"Choix de la langue",
142 'accountPreferencesLanguageDescription':"<p>Choisissez la langue d'affichage de Clipperz dans la liste suivante.</p> ",
143 'accountPreferencesInterfaceTitle':"Personnalisation de l'interface",
144 'accountPreferencesInterfaceDescription':"<p>Ajustez l'interface de Clipperz à vos besoins.</p> ",
145 'saveUserPreferencesFormSubmitLabel':"Enregistrer",
146 'cancelUserPreferencesFormSubmitLabel':"Annuler",
147 'accountPreferencesSavingPanelTitle_Step1':"Enregistrement des préférences",
148 'accountPreferencesSavingPanelText_Step1':"Chiffrement local de vos préférences",
149 'accountPreferencesSavingPanelTitle_Step2':"Enregistrement des préférences",
150 'accountPreferencesSavingPanelText_Step2':"Transmission des préférences chiffrées au serveur",
151 'deleteAccountTabLabel':"Supprimer votre compte",
152 'deleteAccountTabTitle':"Supprimer votre compte",
153 'deleteAccountFormUsernameLabel':"nom d’utilisateur",
154 'deleteAccountFormPassphraseLabel':"phrase secrète",
155 'deleteAccountFormSafetyCheckboxLabel':"Je sais que toute mes données seront supprimés et que cette action sera irréversible.",
156 'deleteAccountFormSubmitLabel':"Supprimer mon compte",
157 'deleteAccountFormWrongUsernameWarning':"Nom d’utilisateur incorrect",
158 'deleteAccountFormWrongPassphraseWarning':"Phrase secrète incorrect",
159 'deleteAccountFormSafetyCheckWarning':"Veuillez lire et cocher la case-à-cocher ci-dessous.",
160 'accountPanelDeletingAccountPanelConfirmationTitle':"ATTENTION",
161 'accountPanelDeleteAccountPanelConfirmationText':"Êtes-vous sûr de vouloir supprimer ce compte?",
162 'accountPanelDeleteAccountPanelConfirmButtonLabel':"Oui",
163 'accountPanelDeleteAccountPanelDenyButtonLabel':"Non",
164 'offlineCopyTabLabel':"Copie locale",
165 'offlineCopyTabTitle':"Copie locale",
166 'offlineCopyTabDescription':"<p>D'un seul click, vous pouvez télécharger toutes vos données chiffrées des serveurs Clipperz sur votre disque dur, créant ainsi une version déconnecté de Clipperz utilisable lorsque vous n'êtes pas connectés à Internet.</p> <p>Cette version en lecture seule est aussi sécurisée que la version en lecture-écriture, et n'expose pas vos données à un risque plus élevé. Elles partagent en effet le même code et la même architecture de sécurité.</p> <ol> <li> <p>Cliquez sur le liens ci-dessous pour lancer le téléchargement.</p> </li> <li> <p>Votre navigateur vous demandera que faire du fichier “Clipperz_YYYYMMDD.html”. Sauvez le sur votre disque dur.</p> </li> <li> <p>Puis double-cliquez sur le fichier téléchargé pour lancer la version déconnectée dans votre navigateur.</p> </li> <li> <p>Utilisez vos nom d’utilisateur et phrase secrète habituels.</p> </li> </ol> ",
167 'offlineCopyDownloadLinkLabel':"Télécharger",
168 'sharingTabLabel':"Partager",
169 'sharingTabTitle':"Partager",
170 'sharingTabDescription':"<p>De temps en temps il est nécessaire de partager des parties de vos informations confidentiels avec une ou plusieurs personnes.</p> <p>Cela pourrait être aussi simple que l’octroi à un collègue de votre code d’accès à votre messagerie vocale quand vous êtes hors du bureau, ou aussi compliqués que la permission d’ayant droit aux héritiers pour avoir accès à votre boîte de coffre-fort à la banque locale.</p> <p>Clipperz vous permez donc de partager vos mots de passe grâce à un processe sûr et direct.</p> <p> </p> <p> <b>Prochainement disponible ...</b> </p> ",
171 'importTabLabel':"Importer",
172 'importTabTitle':"Importer",
173 'importTabDescription':"<p> <b>Prochainement disponible ...</b> </p> ",
174 'printingTabLabel':"Exporter",
175 'printingTabTitle':"Exporter",
176 'printingTabDescription':"<p> <b>Version d’impression</b> </p> <p>En cliquant sur ce bouton vous ouvrirez une fenêtre contenant vos en-têtes cryptés dans un format d’impression.</p> <p>Si vous imprimez pour des raisons de sauvegarde personnel, veuillez vous tourner vers une solution plus sécurisé comme la version “Copie locale”.</p> ",
177 'printingLinkLabel':"Version imprimable",
178 'contactsTabLabel':"Contacts",
179 'contactsTabTitle':"Contacts",
180 'passwordGeneratorTabLabel':"Générateur de mot de passe",
181 'bookmarkletTabLabel':"Bookmarklet",
182 'passwordGeneratorTabTitle':"Générateur de mot de passe",
183 'bookmarkletTabTitle':"Bookmarklet",
184 'paswordGeneratorTabDescription':"<p> </p> ",
185 'passwordGeneratorTabButtonLabel':" Générer un mot de passe",
186 'bookmarkletTabDescription':"<p>Un bookmarklet est un outil “clique unique” simple qui peut exécuter des tâches très utiles. Il peut être sauvegardé et utilisé comme un signet de page Web normal.</p> <p>Le bookmarklet Clipperz vous aidera à rapidement créer de nouvelles cartes et des nouveaux “accès directs” avec vos cartes existantes.</p> <p> <b>Notez s’il vous plaît que le bookmarklet n’inclut pas d’informations liées à votre compte (par exemple votre nom d’utilisateur ou votre phrase secrète), le bookmarklet est un outil général contenant le même code pour chaque utilisateur Clipperz.</b> </p> <div> <p>Pour installer le bookmarklet <b>glissez & déposez</b> le lien ci-dessous dans votre bar de navigation.</p> </div> ",
187 'bookmarkletTabBookmarkletTitle':"Ajouter à Clipperz",
188 'bookmarkletTabInstructions':"<h3>Comment créer une carte comprenant un lien de “accès direct” à un service en ligne</h3> <ol> <li> <p>Ouvrir la page Web où le site affiche un formulaire d’identification. (C’est la page où vous entrez d’habitude vos informations d'identification)</p> </li> <li> <p>Lancer le bookmarklet en cliquant dessus : une fenêtre contextuelle apparait alors sur la page Web.</p> </li> <li> <p>Copier dans le presse-papiers le contenu du grand secteur de texte dans le menu contextuel. (Ctrl-C)</p> </li> <li> <p>Entrer dans votre compte Clipperz et cliquer sur <b>“Ajouter une nouvelle carte”</b>.</p> </li> <li> <p>Coller le presse-papiers dans la zone de texte et rajouter un titre (facultatif). (Ctrl-V)</p> </li> <li> <p>Cliquer sur le bouton <b>“Créer”</b>, repassez en revu les détails et cliquer <b>“Sauver”</b>. De plus amples informations sont disponibles <a href=\"http://www.clipperz.com/support/user_guide/bookmarklet\" target=\"_blank\">ici</a>.</p> </li> </ol> <h3>Comment ajouter un lien de “accès direct” à une carte existante</h3> <ol> <li> <p>Idem que précédemment.</p> </li> <li> <p>Idem que précédemment..</p> </li> <li> <p>Idem que précédemment.</p> </li> <li> <p>Entrer dans votre compte Clipperz et sélectionner la carte crypté qui contient les identifiants pour le service web que vous venez tout juste de visiter et cliquer sur <b>“Modifier”</b>.</p> </li> <li> <p>Coller le presse-papier dans la zone de texte <b>“Accès directs”</b>. (ctrl-V)</p> </li> <li> <p>Cliquer sur <b>“Ajouter un accès direct”</b>, repassez en revu les détails et cliquer <b>“Sauver”</b>.</p> </li> </ol> ",
189 'mainPanelDirectLoginBlockLabel':"Accès directs",
190 'directLinkReferenceShowButtonLabel':"voir",
191 'mainPanelDirectLoginBlockDescription':"<p>Ajouter une “accès direct” pour vous identifier sans avoir besoin de taper vos identifiants de connexions!</p> <p>Les “accès directs” augmente considérablement la sécurité de vos mots passes dans la mesure où vous pouvez:</p> <ul> <li> <p>adopter et saisir des mots de passe complexes;</p> </li> <li> <p>ne réutilisez le même mot de passe et ne mettez plus de mots de passe facile à deviner.</p> </li> </ul> <p>Simple et rapide à configurer avec le Clipperz <b>bookmarklet</b>.</p> <a href=\"http://www.clipperz.com/support/user_guide/direct_logins\" target=\"_blank\">Pour en savoir plus sur les “accès directs”</a> ",
192 'mainPanelRecordsBlockLabel':"Cartes",
193 'mainPanelAddRecordButtonLabel':"Ajouter une nouvelle carte",
194 'mainPanelRemoveRecordButtonLabel':"Supprimer une carte",
195 'mainPanelRecordFilterBlockAllLabel':"tous",
196 'mainPanelRecordFilterBlockTagsLabel':"tags",
197 'mainPanelRecordFilterBlockSearchLabel':"chercher",
198 'recordDetailNoRecordAtAllTitle':"Bienvenue sur Clipperz!",
199 'recordDetailNoRecordAtAllDescription':"<h5>Commencez par ajouter des cartes à votre compte.</h5> <p>Les cartes sont des formulaires flexibles ou vous pouvez enregistrer vos mots de passe et autres informations confidentielles.</p> <p>Par exemple, une carte peut contenir les informations d\"identification pour un site web, la combinaison de votre antivol de bicyclette, les détails de votre carte bancaire, ...</p> <h5>N'oubliez pas le bookmarklet!</h5> <p>Avant de commencer, installez le bookmarklet “Ajouter à Clipperz”: il rends la création de carte plus facile et amusante.</p> <p>Allez à l'onglet “outils” pour découvrir comment l'installer et l'utiliser.</p> <p> </p> <p>Ensuite, cliquez tout simplement sur le bouton “Ajouter une nouvelle carte” et profitez de votre compte Clipperz.</p> <p> </p> <a href=\"http://www.clipperz.com/support/user_guide/managing_cards\" target=\"_blank\">En savoir plus sur la création et la gestion des cartes.</a> ",
200 'newRecordWizardTitleBox':"<h5>Choisissez un modèle</h5> <p>Les cartes sont des formulaires flexibles ou vous pouvez enregistrer vos mots de passe et autres informations confidentielles.</p> <p>Commencez par choisir un des modèles ci-dessous. Vous pourrez toujours adapter vos cartes plus tard en ajoutant ou supprimant des champs.</p> ",
201 'newRecordWizardBookmarkletConfigurationTitle':"Accès directs",
202 'newRecordWizardBookmarkletConfigurationDescriptionConfig':"<p>Collez ici le code de configuration généré par le bookmarlet Clipperz.</p> <p>Cela créera une nouvelle carte avec un accès direct à votre site web.</p> ",
203 'newRecordWizardCreateButtonLabel':"Créer",
204 'newRecordWizardCancelButtonLabel':"Annuler",
205 'recordTemplates':{
206 'WebAccount':{
207 'title':"Mot de passe web",
208 'description':"<p>Une carte toute simple pour enregistrer les informations d'identification de vos services en ligne.</p> ",
209 'fields':{
210 'URL':"Adresse web",
211 'TXT':"Nom d'utilisateur ou email",
212 'PWD':"Mot de passe"
213 }
214 },
215 'BankAccount':{
216 'title':"Compte bancaire",
217 'description':"<p>Enregistrer de façon sécurisée vos numéros de compte bancaire et vos identifiants de service bancaire en ligne.</p> ",
218 'fields':{
219 'TXT':"Banque",
220 'TXT':"N° de compte",
221 'URL':"Adresse web du site",
222 'TXT':"Identifiant",
223 'PWD':"Mot de passe"
224 }
225 },
226 'CreditCard':{
227 'title':"Carte bancaire",
228 'description':"<p>Ayez toujours sous la main votre numéro de carte, la date d'expiration, le code de contrôle et le code secret avec Clipperz</p> ",
229 'fields':{
230 'TXT':"Type (Visa, AmEx, ...)",
231 'TXT':"Numéro",
232 'TXT':"Nom du porteur",
233 'TXT':"Date de validité",
234 'TXT':"Code de contrôle",
235 'PWD':"Code secret",
236 'URL':"Site web",
237 'TXT':"Identifiant",
238 'PWD':"Mot de passe"
239 }
240 },
241 'AddressBookEntry':{
242 'title':"Carnet d'adresse",
243 'description':"<p>Clipperz peux aussi être utilisé comme un nouveau carnet d'adresse privé. Utilisez ce modèle pour ajouter des contacts facilement.</p> ",
244 'fields':{
245 'TXT':"Nom",
246 'TXT':"Adresse eMail",
247 'TXT':"Téléphone",
248 'TXT':"Mobile",
249 'ADDR':"Adresse"
250 }
251 },
252 'Custom':{
253 'title':"Carte personnalisée",
254 'description':"<p>Quelles que soient les données confidentielles que vous souhaitez protéger, créez une carte personnalisée adaptée à vos besoins.</p> ",
255 'fields':{
256 'TXT':"Titre du champ 1",
257 'TXT':"Titre du champ 2",
258 'TXT':"Titre du champ 3"
259 }
260 }
261},
262 'recordFieldTypologies':{
263 'TXT':{
264 'description':"simple text field",
265 'shortDescription':"texte"
266 },
267 'PWD':{
268 'description':"simple text field, with default status set to hidden",
269 'shortDescription':"mot de passe"
270 },
271 'URL':{
272 'description':"simple text field in edit mode, that became an active url in view mode",
273 'shortDescription':"adresse de site web"
274 },
275 'DATE':{
276 'description':"a value set with a calendar helper",
277 'shortDescription':"date"
278 },
279 'ADDR':{
280 'description':"just like the URL, but the active link points to Google Maps (or similar service) passing the address value as argument",
281 'shortDescription':"adresse"
282 },
283 'CHECK':{
284 'description':"check description",
285 'shortDescription':"check"
286 },
287 'RADIO':{
288 'description':"radio description",
289 'shortDescription':"radio"
290 },
291 'SELECT':{
292 'description':"select description",
293 'shortDescription':"select"
294 }
295},
296 'newRecordPanelGeneralExceptionTitle':"Erreur",
297 'newRecordPanelGeneralExceptionMessage':"Le code de configuration n'est pas valide. Copiez le depuis la fenêtre du bookmarklet, et essayez à nouveau.",
298 'newRecordPanelWrongBookmarkletVersionExceptionTitle':"Erreur",
299 'newRecordPanelWrongBookmarkletVersionExceptionMessage':"Ce code de configuration provient d'un ancien bookmarklet. Mettez votre bookmarklet à jour, puis essayez de nouveau.",
300 'newRecordPanelExceptionPanelCloseButtonLabel':"Annuler",
301 'mainPanelDeletingRecordPanelConfirmationTitle':"Suppression de la carte sélectionnée",
302 'mainPanelDeleteRecordPanelConfirmationText':"Voulez vous vraiment supprimer la carte sélectionnée?",
303 'mainPanelDeleteRecordPanelConfirmButtonLabel':"Oui",
304 'mainPanelDeleteRecordPanelDenyButtonLabel':"Non",
305 'mainPanelDeletingRecordPanelInitialTitle':"Suppression de la carte",
306 'mainPanelDeletingRecordPanelCompletedText':"Terminé",
307 'deleteRecordPanelCollectRecordDataMessageTitle':"Supprimer la carte",
308 'deleteRecordPanelCollectRecordDataMessageText':"Mise à jour de la liste des cartes",
309 'deleteRecordPanelEncryptUserDataMessageTitle':"Supprimer la carte",
310 'deleteRecordPanelEncryptUserDataMessageText':"Chiffrement local des en-têtes de carte",
311 'deleteRecordPanelSendingDataToTheServerMessageTitle':"Supprimer la carteDelete card",
312 'deleteRecordPanelSendingDataToTheServerMessageText':"Transmission des en-têtes chiffrées à Clipperz",
313 'deleteRecordPanelUpdatingTheInterfaceMessageTitle':"Supprimer la carte",
314 'deleteRecordPanelUpdatingTheInterfaceMessageText':"Mise à jour de l'interface",
315 'recordDetailNoRecordSelectedTitle':"Aucune carte sélectionnée",
316 'recordDetailNoRecordSelectedDescription':"<p>Veuillez selectionner une carte dans la liste de gauche.</p> ",
317 'recordDetailLoadingRecordMessage':"Téléchargement de la carte chiffrée depuis Clipperz",
318 'recordDetailDecryptingRecordMessage':"Déchiffrement local des informations de la carte",
319 'recordDetailLoadingRecordVersionMessage':"Téléchargement de la dernière version de la carte",
320 'recordDetailDecryptingRecordVersionMessage':"Déchiffrement local de la dernière version",
321 'recordDetailLoadingErrorMessageTitle':"Erreur lors du téléchargement de la carte",
322 'recordDetailNotesLabel':"Notes",
323 'recordDetailLabelFieldColumnLabel':"Titre du champ",
324 'recordDetailDataFieldColumnLabel':"Données du champ",
325 'recordDetailTypeFieldColumnLabel':"Type",
326 'recordDetailSavingChangesMessagePanelInitialTitle':"Enregistrement de la carte",
327 'recordDetailAddFieldButtonLabel':"Ajouter un champ",
328 'recordDetailPasswordFieldHelpLabel':"pour copier le mot de passe, cliquez sur les étoiles, puis Ctrl-C",
329 'recordDetailPasswordFieldScrambleLabel':"dissimuler",
330 'recordDetailPasswordFieldUnscrambleLabel':"en clair",
331 'recordDetailDirectLoginBlockTitle':"Accès directs",
332 'recordDetailNewDirectLoginDescription':"<p>Configuration de l'accès direct</p> ",
333 'recordDetailDirectLoginBlockNoDirectLoginConfiguredDescription':"<p>Cette carte contient-elle des informations d'identification pour un service en ligne?</p> <p>Utilisez le bookmarklet pour configurer un “accès direct” depuis Clipperz en un seul click!</p> ",
334 'recordDetailAddNewDirectLoginButtonLabel':"Ajouter un accès direct",
335 'recordDetailEditButtonLabel':"Modifier",
336 'recordDetailSaveButtonLabel':"Sauver",
337 'recordDetailCancelButtonLabel':"Annuler",
338 'newRecordTitleLabel':"_nouvelle carte_",
339 'recordSaveChangesPanelCollectRecordInfoMessageTitle':"Enregistrement de la carte",
340 'recordSaveChangesPanelCollectRecordInfoMessageText':"Updating card headers",
341 'recordSaveChangesPanelEncryptUserDataMessageTitle':"Sauvegarde de la carte",
342 'recordSaveChangesPanelEncryptUserDataMessageText':"Cryptage local des en-têtes chiffrés",
343 'recordSaveChangesPanelEncryptRecordDataMessageTitle':"Sauvegarde de la carte",
344 'recordSaveChangesPanelEncryptRecordDataMessageText':"Cryptage local des en-têtes chiffrés",
345 'recordSaveChangesPanelEncryptRecordVersionDataMessageTitle':"Sauvegarde de la carte",
346 'recordSaveChangesPanelEncryptRecordVersionDataMessageText':"Cryptage local des données de version de la carte",
347 'recordSaveChangesPanelSendingDataToTheServerMessageTitle':"Sauvegarde de la carte",
348 'recordSaveChangesPanelSendingDataToTheServerMessageText':"Téléchargement des cartes d’en-têtes chiffrés depuis Clipperz",
349 'recordSaveChangesPanelUpdatingTheInterfaceMessageTitle':"Sauvegarde de la carte",
350 'recordSaveChangesPanelUpdatingTheInterfaceMessageText':"Mise à jour de l'interface",
351 'passwordGeneratorPanelTitle':"Générateur de mot de passe",
352 'passwordGeneratorPanelOkLabel':"Ok",
353 'passwordGeneratorPanelCancelLabel':"Annuler",
354 'passwordGeneratorLengthLabel':"longueur:",
355 //'DWRUtilLoadingMessage':"Chargement des données ...",
356 'comingSoon':"Bientôt en ligne ...",
357 'panelCollectingEntryopyMessageText':"Rassemblement d'entropie",
358 'directLoginConfigurationCheckBoxFieldSelectedValue':"Oui",
359 'directLoginConfigurationCheckBoxFieldNotSelectedValue':"Non",
360
361__syntaxFix__: "syntax fix"
362});
diff --git a/frontend/beta/js/Clipperz/PM/Strings/Strings_he-IL.js b/frontend/beta/js/Clipperz/PM/Strings/Strings_he-IL.js
new file mode 100644
index 0000000..3bdfe19
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Strings/Strings_he-IL.js
@@ -0,0 +1,40 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29//=============================================================================
30//
31 // H E B R E W (he_IL)
32//
33//=============================================================================
34
35Clipperz.PM.Strings.Languages['he-il'] = MochiKit.Base.merge(Clipperz.PM.Strings.Languages['en-us'], {
36
37 //-------------------------------------------------------------------------
38 __syntaxFix__: "syntax fix"
39});
40
diff --git a/frontend/beta/js/Clipperz/PM/Strings/Strings_it-IT.js b/frontend/beta/js/Clipperz/PM/Strings/Strings_it-IT.js
new file mode 100644
index 0000000..51c0d03
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Strings/Strings_it-IT.js
@@ -0,0 +1,694 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29Clipperz.PM.Strings.Languages['it-IT'.toLowerCase()] = MochiKit.Base.merge(Clipperz.PM.Strings.Languages['en-us'], {
30 'clipperzServiceDescription':"<h2>Tienilo per te!</h2> <ul> <li> <h3>Clipperz è:</h3> <ul> <li> <p>un archivio semplice e sicuro per le tue password</p> </li> <li> <p>un canale di accesso unificato a tutti i tuoi servizi online</p> </li> <li> <p>una cassaforte digitale per tutti i tuoi dati riservati</p> </li> </ul> </li> <li> <h3>Con Clipperz puoi:</h3> <ul> <li> <p>memorizzare e gestire le password e le credenziali di accesso dei tuoi servizi online</p> </li> <li> <p>accedere ai tuoi servizi online con un solo click senza bisogno di inserire username o password</p> </li> <li> <p>proteggere tutte le tue informazioni confidenziali: codice dell&#x27;allarme di casa, dati delle carte di credito, …</p> </li> <li> <p>condividere dati riservati con i tuoi familiari o colleghi (disponibile a breve)</p> </li> </ul> </li> <li> <h3>I vantaggi di Clipperz:</h3> <ul> <li> <p>gratuito e completamente anonimo</p> </li> <li> <p>accessibile da qualsiasi computer</p> </li> <li> <p>nessun software da scaricare e niente da installare</p> </li> <li> <p>mai più informazioni riservate sul tuo PC o sulla carta!</p> </li> </ul> </li> <li> <h3>La sicurezza di Clipperz:</h3> <ul> <li> <p>i dati sono criptati dal tuo browser prima di essere inviati a Clipperz</p> </li> <li> <p>la chiave per decriptare i dati è conosciuta soltanto da te</p> </li> <li> <p>Clipperz riceve e memorizza solo i tuoi dati criptati e non ha nessuna possibilità di accedere alla versione in chiaro</p> </li> <li> <p>Clipperz utilizza solo sistemi crittografici standard, senza nessuna velleità di inventare e proporre nuovi algoritmi non validati dalla comunità scientifica</p> </li> <li> <p>tutto il codice di Clipperz è disponibile e può essere analizzato in qualsiasi momento, ma non serve essere un esperto di crittografia per apprezzare la sicurezza e la comodità di Clipperz!</p> </li> </ul> </li> <li><a href=\"http://www.clipperz.com\" target=\"_blank\">Maggiori informazioni su Clipperz (in inglese)</a> </li> </ul> ",
31 'loginFormTitle':"accedi a Clipperz",
32 'loginFormUsernameLabel':"Utente",
33 'loginFormPassphraseLabel':"frase segreta",
34 'loginFormDontHaveAnAccountLabel':"non ti sei ancora registrato?",
35 'loginFormCreateOneLabel':"registrati adesso",
36 'loginFormForgotYourCredentialsLabel':"hai perso i dati di accesso?",
37 'loginFormAarghThatsBadLabel':"aargh! questo non è bello!",
38 'loginFormAfraidOfMaliciousScriptsLabel':"non ti fidi?",
39 'loginFormVerifyTheCodeLabel':"controlla il codice",
40 'loginFormButtonLabel':"Accedi",
41 'loginFormOneTimePasswordCheckboxLabel':"usa un codice “usa e getta”",
42 'loginFormOneTimePasswordCheckboxDescription':"",
43 'loginPanelSwithLanguageDescription':"<h5>Seleziona la tua lingua preferita</h5> ",
44 'browserCompatibilityDescription':"<p>Clipperz consiglia Firefox per una maggiore sicurezza. Clipperz supporta anche Opera ed Internet Explorer.</p> ",
45 'OTPloginMessagePanelInitialTitle':"Accesso con codice “usa e getta”",
46 'OTPloginMessagePanelInitialText':"Invio delle credenziali OTP ...",
47 'OTPloginMessagePanelLoadingTitle':"Accesso con codice “usa e getta”",
48 'OTPloginMessagePanelLoadingText':"Caricamento dei dati di autenticazione criptati ...",
49 'OTPloginMessagePanelProcessingTitle':"Accesso con codice “usa e getta”",
50 'OTPloginMessagePanelProcessingText':"Decodifica locale dei dati di autenticazione ...",
51 'loginMessagePanelInitialTitle':"Connessione in corso ...",
52 'loginMessagePanelInitialText':"---",
53 'loginMessagePanelInitialButtonLabel':"Annulla",
54 'loginMessagePanelConnectedTitle':"Connesso",
55 'loginMessagePanelConnectedText':"Fatto",
56 'loginMessagePanelFailureTitle':"Errore",
57 'loginMessagePanelFailureText':"Connessione fallita",
58 'loginMessagePanelFailureButtonLabel':"Chiudi",
59 'connectionLoginSendingCredentialsMessageTitle':"Verifica delle credenziali",
60 'connectionLoginSendingCredentialsMessageText':"Invio delle credenziali",
61 'connectionLoginCredentialsVerificationMessageTitle':"Verifica delle credenziali",
62 'connectionLoginCredentialsVerificationMessageText':"Esecuzione dell&#x27;autenticazione SRP ...",
63 'connectionLoginDoneMessageTitle':"Verifica delle credenziali",
64 'connectionLoginDoneMessageText':"Connesso",
65 'userLoginPanelUpgradingUserCredentialsMessageTitle':"Verifica delle credenziali",
66 'userLoginPanelUpgradingUserCredentialsMessageText':"Aggiornamento delle credenziali ad un nuovo schema di autenticazione",
67 'userLoginPanelConnectedMessageTitle':"Utente autenticato",
68 'userLoginPanelConnectedMessageText':"Autenticazione eseguita con successo",
69 'userLoginPanelTryingAnOlderConnectionSchemaMessageTitle':"Verifica delle credenziali",
70 'userLoginPanelTryingAnOlderConnectionSchemaMessageText':"Tentativo con vecchio schema di autenticazione",
71 'userLoginPanelLoadingUserDataMessageTitle':"Utente autenticato",
72 'userLoginPanelLoadingUserDataMessageText':"Scarica le intestazioni criptate delle schede da Clipperz",
73 'userLoginPanelDecryptingUserDataMessageTitle':"Utente autenticato",
74 'userLoginPanelDecryptingUserDataMessageText':"Decodifica locale dell&#x27;intestazione delle schede",
75 'userLoginPanelDecryptingUserStatisticsMessageTitle':"Utente autenticato",
76 'userLoginPanelDecryptingUserStatisticsMessageText':"Decodifica locale delle statistiche d&#x27;uso",
77 'splashAlertTitle':"Benvenuto a Clipperz!",
78 'splashAlertText':"<p>Alcuni consigli per la sicurezza</p> <ul> <li> <p>La sicurezza dei tuoi dati dipende da quanto è sicura la frase segreta che usi per proteggerli. Nessuno può accedervi a meno che non conosca la frase segreta.</p> </li> <li> <p>Se hai intenzione di usare Clipperz per conservare informazioni sensibili e riservate, scegli attentamente una frase segreta complessa. Più è lunga, maggiore è la sicurezza!</p> </li> <li> <p>E non dimenticare che Clipperz non è in grado di recuperare la tua frase segreta in caso di smarrimento!</p> </li> </ul> <p>Per maggiori informazioni sulla sicurezza, consulta il sito <a href=\"http://www.clipperz.com\" target=\"_blank\">Clipperz</a> (in lingua inglese).</p> ",
79 'splashAlertCloseButtonLabel':"Ok",
80 'registrationFormTitle':"crea il tuo utente",
81 'registrationFormUsernameLabel':"Utente",
82 'registrationFormPassphraseLabel':"frase segreta",
83 'registrationFormRetypePassphraseLabel':"ripeti frase segreta",
84 'registrationFormSafetyCheckLabel':"Sono consapevole che Clipperz non è in grado di recuperare una frase segreta dimenticata.",
85 'registrationFormTermsOfServiceCheckLabel':"Dichiaro di aver letto e di accettare i <a href=\"http://www.clipperz.com/terms_of_service\" target=\"_blank\">Termini del Servizio</a> .",
86 'registrationFormDoYouAlreadyHaveAnAccountLabel':"sei già un utente registrato?",
87 'registrationFormSimplyLoginLabel':"accedi subito",
88 'registrationFormButtonLabel':"Registrati",
89 'registrationFormWarningMessageNotMatchingPassphrases':"Le frasi segrete non corrispondono, ripeti l&#x27;inserimento.",
90 'registrationFormWarningMessageSafetyCheckNotSelected':"Leggi e spunta le condizioni sotto riportate.",
91 'registrationFormWarningMessageTermsOfServiceCheckNotSelected':"Per procedere devi accettare i Termini del Servizio.",
92 'registrationMessagePanelInitialTitle':"Registrazione in corso ...",
93 'registrationMessagePanelInitialText':"---",
94 'registrationMessagePanelInitialButtonLabel':"Annulla",
95 'registrationMessagePanelRegistrationDoneTitle':"Registrazione",
96 'registrationMessagePanelRegistrationDoneText':"Fatto",
97 'registrationMessagePanelFailureTitle':"Registrazione fallita",
98 'registrationMessagePanelFailureButtonLabel':"Chiudi",
99 'connectionRegistrationSendingRequestMessageText':"Verifica delle credenziali",
100 'connectionRegistrationSendingCredentialsMessageText':"Invio delle credenziali",
101 'registrationSplashPanelTitle':"Avviso di sicurezza",
102 'registrationSplashPanelDescription':"<p>Queste sono le tue credenziali di accesso a Clipperz, conservale con cura. Il tuo utente ed la tua frase segreta non ti verranno mostrati una seconda volta!</p> ",
103 'registrationSplashPanelUsernameLabel':"Utente",
104 'registrationSplashPanelPassphraseLabel':"frase segreta",
105 'registrationSplashPanelShowPassphraseButtonLabel':"mostra la frase segreta",
106 'donateHeaderLinkLabel':"donazioni",
107 'creditsHeaderLinkLabel':"credits",
108 'feedbackHeaderLinkLabel':"scrivici",
109 'helpHeaderLinkLabel':"aiuto",
110 'forumHeaderLinkLabel':"forum",
111 'recordMenuLabel':"Schede",
112 'accountMenuLabel':"profilo",
113 'dataMenuLabel':"dati",
114 'contactsMenuLabel':"Contatti",
115 'toolsMenuLabel':"strumenti",
116 'logoutMenuLabel':"esci",
117 'lockMenuLabel':"blocca",
118 'lockTitle':"Utente bloccato",
119 'lockDescription':"<p>Per sbloccare il tuo utente inserisci la frase segreta</p> ",
120 'unlockButtonLabel':"Sblocca",
121 'changePasswordTabLabel':"Cambia la tua frase segreta",
122 'changePasswordTabTitle':"Cambia la tua frase segreta",
123 'changePasswordFormUsernameLabel':"Utente",
124 'changePasswordFormOldPassphraseLabel':"attuale frase segreta",
125 'changePasswordFormNewPassphraseLabel':"nuova frase segreta",
126 'changePasswordFormRetypePassphraseLabel':"ripeti nuova frase segreta",
127 'changePasswordFormSafetyCheckboxLabel':"Sono consapevole che Clipperz non è in grado di recuperare una frase segreta dimenticata.",
128 'changePasswordFormSubmitLabel':"Cambia frase segreta",
129 'changePasswordFormWrongUsernameWarning':"Utente errato",
130 'changePasswordFormWrongPassphraseWarning':"Frase segreta errata",
131 'changePasswordFormWrongRetypePassphraseWarning':"Le frasi segrete non corrispondono, ripeti l&#x27;inserimento.",
132 'changePasswordFormSafetyCheckWarning':"Leggi e spunta le condizioni sotto riportate.",
133 'changePasswordFormProgressDialogTitle':"Aggiornamento credenziali",
134 'changePasswordFormProgressDialogEmptyText':"---",
135 'changePasswordFormProgressDialogConnectedMessageTitle':"Connesso",
136 'changePasswordFormProgressDialogConnectedMessageText':"Fatto",
137 'changePasswordFormProgressDialogErrorMessageTitle':"Errore",
138 'changePasswordFormProgressDialogErrorMessageText':"Aggiornamento credenziali fallito!",
139 'changeCredentialsPanelEncryptingDataMessageTitle':"Cambio della frase segreta",
140 'changeCredentialsPanelEncryptingDataMessageText':"Cripta localmente l&#x27;intestazione delle schede",
141 'changeCredentialsPanelCreatingNewCredentialsMessageTitle':"Cambio della frase segreta",
142 'changeCredentialsPanelCreatingNewCredentialsMessageText':"Aggiornamento delle credenziali",
143 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageTitle':"Cambio della frase segreta",
144 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageText':"Carica le intestazioni criptate delle schede su Clipperz",
145 'changeCredentialsPanelDoneMessageTitle':"Cambio della frase segreta",
146 'changeCredentialsPanelDoneMessageText':"Fatto",
147 'manageOTPTabLabel':"Codici di accesso “usa e getta”",
148 'manageOTPTabTitle':"Codici di accesso “usa e getta”",
149 'manageOTPTabDescription':"<p>I codici di accesso e “usa e getta” funzionano come la tua normale frase segreta, ma possono essere utilizzate una sola volta.</p> <p>Se lo stesso codice “usa e getta” viene utilizzato per tentare ulteriori accessi il processo di autenticazione fallirà.</p> <p>Infatti, dopo il primo utilizzo, il codice “usa e getta” verrà immediatamente disattivato e cancellato prevenendo così eventuali accessi non autorizzati.</p> <p>L&#x27;utilizzo di codici “usa e getta” è una scelta consigliata per chi teme che il computer dal quale sta accedendo a Clipperz non sia sicuro a causa di software quali keyloggers e spyware che potrebbero registrare le proprie credenziali di accesso.</p> <p><b>E&#x27; caldamente consigliato l&#x27;utilizzo di codici “usa e getta” quando ci si collega a Clipperz da terminali pubblici quali Internet Cafe e biblioteche.</b> </p> ",
150 'oneTimePasswordReadOnlyMessage':"<h6>Attenzione!</h6> <p>Non è possibilie accedere ai propri codici “usa e getta” quando si utilizza la versione offline di Clipperz.</p> ",
151 'oneTimePasswordLoadingMessage':"<h6>Caricamento dati</h6> <p>Si prega di attendere ...</p> ",
152 'oneTimePasswordNoPasswordAvailable':"<h6>Nessun codice “usa e getta” disponibile</h6> <p>Per creare codici “usa e getta” clicca sul pulsante “Nuovo” che trovi qui sopra.</p> ",
153 'deleteOTPButtonLabel':"Elimina",
154 'printOTPButtonLabel':"Stampa",
155 'disabledOneTimePassword_warning':"disabilitato",
156 'oneTimePasswordSelectionLink_selectLabel':"Seleziona:",
157 'oneTimePasswordSelectionLink_none':"nessuno",
158 'oneTimePasswordSelectionLink_used':"utilizzati",
159 'oneTimePasswordSelectionLink_unused':"disponibili",
160 'saveOTP_encryptUserDataTitle':"Registrazione del nuovo codice “usa e getta”",
161 'saveOTP_encryptUserDataText':"Elaborazione delle credenziali OTP ...",
162 'saveOTP_encryptOTPDataTitle':"Registrazione del nuovo codice “usa e getta”",
163 'saveOTP_encryptOTPDataText':"Codifica locale dei dati di autenticazione ...",
164 'saveOTP_sendingDataTitle':"Registrazione del nuovo codice “usa e getta”",
165 'saveOTP_sendingDataText':"Invio dei dati di autenticazione criptati ...",
166 'saveOTP_updatingInterfaceTitle':"Registrazione del nuovo codice “usa e getta”",
167 'saveOTP_updatingInterfaceText':"Aggiornamento dell&#x27;interfaccia",
168 'accountPreferencesLabel':"Preferenze",
169 'accountPreferencesTabTitle':"Preferenze",
170 'accountPreferencesLanguageTitle':"Selezione della lingua",
171 'accountPreferencesLanguageDescription':"<p>Scegli la lingua preferita dall&#x27;elenco sottostante.</p> ",
172 'showDonationReminderPanelTitle':"Promemoria donazioni",
173 'showDonationReminderPanelDescription':"<p>Mostra i promemopria per le donazioni</p> ",
174 'saveUserPreferencesFormSubmitLabel':"Salva",
175 'cancelUserPreferencesFormSubmitLabel':"Annulla",
176 'accountPreferencesSavingPanelTitle_Step1':"Salvataggio preferenze",
177 'accountPreferencesSavingPanelText_Step1':"Cripta localmente le preferenze",
178 'accountPreferencesSavingPanelTitle_Step2':"Salvataggio preferenze",
179 'accountPreferencesSavingPanelText_Step2':"Carica preferenze criptate su Clipperz",
180 'accountLoginHistoryLabel':"Registro degli accessi",
181 'loginHistoryTabTitle':"Registro degli accessi",
182 'loginHistoryReadOnlyMessage':"<h6>Attenzione!</h6> <p>Il registro degli accessi non è disponibile quando si utilizza la versione offline di Clipperz</p> ",
183 'loginHistoryLoadingMessage':"<h6>Caricamento dati</h6> <p>Si prega di attendere ...</p> ",
184 'loginHistoryLoadedMessage':"<h6>I tuoi ultimi 10 accessi</h6> <p> </p> ",
185 'loginHistoryIPLabel':"IP",
186 'loginHistoryTimeLabel':"data",
187 'loginHistoryCurrentSessionText':"sessione corrente",
188 'loginHistoryReloadButtonLabel':"Aggiorna il registro degli accessi",
189 'deleteAccountTabLabel':"Cancella il tuo utente",
190 'deleteAccountTabTitle':"Cancella il tuo utente",
191 'deleteAccountFormUsernameLabel':"Utente",
192 'deleteAccountFormPassphraseLabel':"frase segreta",
193 'deleteAccountFormSafetyCheckboxLabel':"Sono consapevole che tutti miei dati verranno cancellati e che questa azione è irreversibile.",
194 'deleteAccountFormSubmitLabel':"Cancella il mio utente",
195 'deleteAccountFormWrongUsernameWarning':"Utente errato",
196 'deleteAccountFormWrongPassphraseWarning':"Frase segreta errata",
197 'deleteAccountFormSafetyCheckWarning':"Leggi e spunta le condizioni sotto riportate.",
198 'accountPanelDeletingAccountPanelConfirmationTitle':"ATTENZIONE",
199 'accountPanelDeleteAccountPanelConfirmationText':"Sei sicuro di voler cancellare il tuo utente?",
200 'offlineCopyTabLabel':"Copia offline",
201 'offlineCopyTabTitle':"Copia offline",
202 'offlineCopyTabDescription':"<p>Con un solo clic puoi trasferire tutti i tuoi dati dai server di Clipperz al tuo PC, creando una versione offline di Clipperz a cui potrai accedere quando non è disponibile un collegamento ad Internet.</p> <p>La versione offline in sola lettura è sicura quanto quella online e non espone i tuoi dati a livelli di rischio superiore in quanto entrambe condividono la medesima architettura di sicurezza.</p> <ol> <li> <p>Clicca sul link sottostante per scaricare la copia offline dei tuoi dati.</p> </li> <li> <p>Il browser ti chiederà cosa fare del file “Clipperz_YYYYMMDD.html”. Scegli di salvarlo su un disco locale.</p> </li> <li> <p>Basta un doppio click sul file appena scaricato per lanciare la versione offline di Clipperz.</p> </li> <li> <p>Accedi utilizzando le normali credenziali di accesso.</p> </li> </ol> ",
203 'offlineCopyDownloadLinkLabel':"Scarica copia offline",
204 'offlineCopyDownloadWarning':"<h4><a href=\"#\" id=\"offlineCopyDownloadWarningLink\">Aggiorna la tua “copia offline”!</a> </h4> <p>Una o più schede sono state recentemente create o modificate, ti consigliamo di scaricare nuovamente la tua “copia offline”.</p> ",
205 'offlineCopyDownloadOk':"",
206 'sharingTabLabel':"Condividi",
207 'sharingTabTitle':"Condividi",
208 'sharingTabDescription':"<p>Spesso è necessario condividere alcune delle proprie informazioni riservate con una o più persone.</p> <p>Può trattarsi di situazioni semplici come dare ad un collega il codice di accesso alla propria segreteria telefonica quando si va in vacanza, oppure complesse come regolare l&#x27;accesso dei legittimi eredi ai servizi di online banking utilizzati dal defunto.</p> <p>Con Clipperz la condivisione di segreti diviene un processo semplice e sicuro.</p> <p> </p> <p><b>Presto disponibile ...</b> </p> ",
209 'importTabLabel':"Importa",
210 'importTabTitle':"Importa",
211 'importTabDescription':"<p>Presto disponibile ...</p> ",
212 'printingTabLabel':"Esporta",
213 'printingTabTitle':"Esporta",
214 'printingTabDescription':"<h5>Stampa i tuoi dati</h5> <p>Cliccando sul link sottostante si aprirà una nuova finestra in cui verranno visualizzate tutte le tue schede in un formato idoneo alla stampa.</p> <p>Se intendi utilizzare la stampa per creare una copia di sicurezza dei tuoi dati, ti suggeriamo di considerare l&#x27;opzione più sicura fornita della “copia offline”.</p> ",
215 'printingLinkLabel':"Versione stampabile",
216 'contactsTabLabel':"Contatti",
217 'contactsTabTitle':"Contatti",
218 'passwordGeneratorTabLabel':"Generatore di password",
219 'bookmarkletTabLabel':"Bookmarklet",
220 'passwordGeneratorTabTitle':"Generatore di password",
221 'bookmarkletTabTitle':"Bookmarklet",
222 'paswordGeneratorTabDescription':"<p> </p> ",
223 'passwordGeneratorTabButtonLabel':"Genera password",
224 'bookmarkletTabLabel':"Bookmarklet",
225 'bookmarkletTabTitle':"Bookmarklet",
226 'bookmarkletTabBookmarkletTitle':"Aggiungi a Clipperz",
227 'bookmarkletTabInstructions':"<h3>Come creare una scheda con “login diretto” ad un servizio online</h3> <ol> <li> <p>Aprire la pagina web che contiene la maschera di login. (ovvero la pagina dove usualmente si inseriscono nome utente e password)</p> </li> <li> <p>Cliccare sulla bookmarklet: una nuova finestrella si visualizzerà sopra la pagina.</p> </li> <li> <p>Copiare il testo di configurazione del “login diretto” contenuto nella finestrella. (ctrl-C)</p> </li> <li> <p>Accedere a Clipperz e cliccare sul pulsante <b>Aggiungi nuova scheda</b> .</p> </li> <li> <p>Selezionare il modello “Login diretto” ed incollare il testo precedentemente copiato. (ctrl-V)</p> </li> <li> <p>Cliccare sul pulsante <b>Crea</b> , completare e verificare i dettagli della scheda, quindi cliccare su <b>Salva</b> .</p> </li> </ol> <h3>Come aggiungere un “login diretto” ad una scheda esistente</h3> <ol> <li> <p>Come sopra.</p> </li> <li> <p>Come sopra.</p> </li> <li> <p>Come sopra.</p> </li> <li> <p>Accedere a Clipperz e selezionare la scheda contenente le credenziali del servizio a cui si vuole accedere con il “login diretto” e cliccare su <b>Modifica</b> .</p> </li> <li> <p>Incollare il testo precedentemente copiato nell&#x27;apposito campo presente nella sezione “Login diretti”. (ctrl-V)</p> </li> <li> <p>Cliccare il pulsante <b>Aggiungi nuovo login diretto</b> , completare e verificare i dettagli della scheda, quindi cliccare su <b>Salva</b> .</p> </li> </ol> <p> </p> <p>Ulteriori informazioni sull&#x27;utilizzo della bookmarklet sono <a href=\"http://www.clipperz.com/support/user_guide/bookmarklet\" target=\"_blank\">disponibili qui</a> .</p> ",
228 'mainPanelDirectLoginBlockLabel':"Login diretti",
229 'directLinkReferenceShowButtonLabel':"mostra",
230 'mainPanelDirectLoginBlockDescription':"<p>Crea “login diretti” per accedere ai tuoi servizi web senza bisogno di inserire username e password!</p> <p>I “login diretti” migliorano la tua sicurezza permettendoti di:</p> <ul> <li> <p>adottare comodamente password complesse;</p> </li> <li> <p>non riutilizzare mai la stessa password.</p> </li> </ul> <p>Semplice e rapido grazie alla <b>Clipperz bookmarklet</b> .</p><a href=\"http://www.clipperz.com/support/user_guide/direct_logins\" target=\"_blank\">Ulteriori informazioni</a> ",
231 'mainPanelRecordsBlockLabel':"Schede",
232 'mainPanelAddRecordButtonLabel':"Aggiungi nuova scheda",
233 'mainPanelRemoveRecordButtonLabel':"Elimina scheda",
234 'mainPanelRecordFilterBlockTagsLabel':"tags",
235 'recordDetailNoRecordAtAllTitle':"Benvenuto a Clipperz!",
236 'recordDetailNoRecordAtAllDescription':"<h5>Ora puoi iniziare ad aggiungere schede con le tue informazioni riservate.</h5> <p>Le schede sono semplici moduli in cui organizzare le tue password ed ogni altro tipo di dato confidenziale.</p> <p>Le schede hanno una struttura flessibile e si adattano a contenere le informazioni più diverse: dalle password ai dettagli delle tue carte di credito!</p> <h5>Non dimenticarti di installare la bookmarklet!</h5> <p>Prima di iniziare ti consigliamo di installare la bookmarklet “Aggiungi a Clipperz”: creare nuove schede diventerà più rapido e divertente.</p> <p>Vai alla sezione “bookmarklet” per scoprire come installarla ed utilizzarla.</p> <p> </p> <p>Quando sei pronto, clicca sul pulsante <b>Aggiungi nuova scheda</b> e metti al sicuro tutte le tue informazioni più preziose.</p> <p> </p><a href=\"http://www.clipperz.com/support/user_guide/managing_cards\" target=\"_blank\">Maggiori informazioni sulla creazione e gestione delle schede (in inglese)</a> ",
237 'newRecordWizardTitleBox':"<h5>Seleziona un modello di scheda</h5> <p>Le schede sono semplici moduli in cui organizzare le tue password ed ogni altro tipo di dato confidenziale.</p> <p>Scegli un modello dall&#x27;elenco sottostante. In seguito potrai sempre modificare la tua scheda aggiungendo o rimuovendo campi.</p> ",
238 'newRecordWizardBookmarkletConfigurationTitle':"Login diretto",
239 'newRecordWizardBookmarkletConfigurationDescription':"<p>Incolla qui sotto il codice generato dalla bookmarklet di Clipperz.</p> <p>Verrà creata una nuova scheda già completa con le informazioni per il “login diretto” al tuo servizio web.</p> ",
240 'newRecordWizardCreateButtonLabel':"Crea",
241 'newRecordWizardCancelButtonLabel':"Annulla",
242 'donateSplashPanelTitle':"Supporta Clipperz, fai una donazione oggi!",
243 'donateSplashPanelDescription':"<p>Alcune buone ragioni per fare una donazione:</p> <ul> <li> <p>supportare lo sviluppo di nuove funzionalità</p> </li> <li> <p>mantenere il servizio gratuito per tutti</p> </li> <li> <p>mostrare la tua gratitudine per il nostro duro lavoro</p> </li> </ul> <p>Per qualunque ulteriore informazione visita la <a href=\"http://www.clipperz.com/donations\" target=\"_blank\">pagina delle donazioni</a> .</p> <p><b>Pronto a donare?</b> </p> ",
244 'donateCloseButtonLabel':"Non ancora",
245 'recordTemplates':{
246 'WebAccount':{
247 'title':"Password",
248 'description':"<p>Una scheda molto semplice per conservare le credenziali di accesso ai tuoi servizi web.</p> ",
249 'fields':{
250 'URL':"Indirizzo web",
251 'TXT':"Utente o email",
252 'PWD':"Password"
253 }
254 },
255 'BankAccount':{
256 'title':"Conto corrente bancario",
257 'description':"<p>Proteggi il tuo numero di conto corrente ed i codici di accesso ai servizi di online banking.</p> ",
258 'fields':{
259 'TXT':"Banca",
260 'TXT':"Conto corrente n.",
261 'URL':"Sito web della banca",
262 'TXT':"Online banking ID",
263 'PWD':"Online banking password"
264 }
265 },
266 'CreditCard':{
267 'title':"Carta di credito",
268 'description':"<p>Numero della carta, data di scadenza, codici CVV2 e PIN sempre a portata di mano con Clipperz.</p> ",
269 'fields':{
270 'TXT':"Tipo (Visa, AmEx, ...)",
271 'TXT':"Numero",
272 'TXT':"Titolare",
273 'TXT':"Data di scadenza",
274 'TXT':"CVV2",
275 'PWD':"PIN",
276 'URL':"Sito web della carta",
277 'TXT':"Utente",
278 'PWD':"Password"
279 }
280 },
281 'AddressBookEntry':{
282 'title':"Voce della rubrica",
283 'description':"<p>Fai di Clipperz la tua rubrica segreta. Usa questo modello per creare una nuova voce.</p> ",
284 'fields':{
285 'TXT':"Nome",
286 'TXT':"Email",
287 'TXT':"Telefono",
288 'TXT':"Cellulare",
289 'ADDR':"Indirizzo"
290 }
291 },
292 'Custom':{
293 'title':"Scheda personalizzata",
294 'description':"<p>Qualunque sia il tipo di informazione che desideri proteggere, Clipperz ti consente di creare una scheda su misura per i tuoi bisogni.</p> ",
295 'fields':{
296 'TXT':"Nome del campo 1",
297 'TXT':"Nome del campo 2",
298 'TXT':"Nome del campo 3"
299 }
300 }
301},
302 'recordFieldTypologies':{
303 'TXT':{
304 'description':"simple text field"
305 },
306 'PWD':{
307 'description':"simple text field, with default status set to hidden",
308 'shortDescription':"Password"
309 },
310 'URL':{
311 'description':"simple text field in edit mode, that became an active url in view mode",
312 'shortDescription':"Indirizzo web"
313 },
314 'DATE':{
315 'description':"a value set with a calendar helper",
316 'shortDescription':"data"
317 },
318 'ADDR':{
319 'description':"just like the URL, but the active link points to Google Maps (or similar service) passing the address value as argument",
320 'shortDescription':"indirizzo stradale"
321 },
322 'CHECK':{
323 'description':"check description",
324 'shortDescription':"check"
325 },
326 'RADIO':{
327 'description':"radio description",
328 'shortDescription':"radio"
329 },
330 'SELECT':{
331 'description':"select description",
332 'shortDescription':"Seleziona:"
333 }
334},
335 'newRecordPanelGeneralExceptionTitle':"Errore",
336 'newRecordPanelGeneralExceptionMessage':"Configurazione non valida. Accertati di aver utilizzato il codice quello generato dalla bookmarklet.",
337 'newRecordPanelWrongBookmarkletVersionExceptionTitle':"Errore",
338 'newRecordPanelWrongBookmarkletVersionExceptionMessage':"La configurazione è stato generata da una vecchia versione della bookmarklet. Sei pregato di aggiornare subito la tua bookmarklet.",
339 'newRecordPanelExceptionPanelCloseButtonLabel':"Annulla",
340 'mainPanelDeletingRecordPanelConfirmationTitle':"Eliminazione della scheda in corso",
341 'mainPanelDeleteRecordPanelConfirmationText':"Vuoi veramente eliminare la scheda selezionata?",
342 'mainPanelDeletingRecordPanelInitialTitle':"Eliminazione della scheda in corso",
343 'mainPanelDeletingRecordPanelInitialText':"---",
344 'mainPanelDeletingRecordPanelCompletedText':"Fatto",
345 'deleteRecordPanelCollectRecordDataMessageTitle':"Elimina scheda",
346 'deleteRecordPanelCollectRecordDataMessageText':"Aggiorna elenco delle schede",
347 'deleteRecordPanelEncryptUserDataMessageTitle':"Elimina scheda",
348 'deleteRecordPanelEncryptUserDataMessageText':"Cripta localmente l&#x27;intestazione delle schede",
349 'deleteRecordPanelSendingDataToTheServerMessageTitle':"Elimina scheda",
350 'deleteRecordPanelSendingDataToTheServerMessageText':"Carica le intestazioni criptate delle schede su Clipperz",
351 'deleteRecordPanelUpdatingTheInterfaceMessageTitle':"Elimina scheda",
352 'deleteRecordPanelUpdatingTheInterfaceMessageText':"Aggiornamento dell&#x27;interfaccia",
353 'recordDetailNoRecordSelectedTitle':"Nessuna scheda selezionata",
354 'recordDetailNoRecordSelectedDescription':"<p>Selezionare una scheda dall&#x27;elenco a sinistra.</p> ",
355 'recordDetailLoadingRecordMessage':"Scarica scheda criptata da Clipperz",
356 'recordDetailDecryptingRecordMessage':"Decodifica locale dei dati della scheda",
357 'recordDetailLoadingRecordVersionMessage':"Scarica l&#x27;ultima versione della scheda",
358 'recordDetailDecryptingRecordVersionMessage':"Decodifica locale dell&#x27;ultima versione",
359 'recordDetailLoadingErrorMessageTitle':"Errore nello scaricamento della scheda",
360 'recordDetailNotesLabel':"Note",
361 'recordDetailLabelFieldColumnLabel':"Nome del campo",
362 'recordDetailDataFieldColumnLabel':"Dati del campo",
363 'recordDetailTypeFieldColumnLabel':"Tipo",
364 'recordDetailSavingChangesMessagePanelInitialTitle':"Salvataggio scheda",
365 'recordDetailSavingChangesMessagePanelInitialText':"---",
366 'recordDetailRemoveFieldButtonLabel':"-",
367 'recordDetailAddFieldButtonLabel':"Aggiungi nuovo campo",
368 'recordDetailPasswordFieldHelpLabel':"clicca le stelline per copiare la password e poi Ctrl-C",
369 'recordDetailPasswordFieldScrambleLabel':"nascondi",
370 'recordDetailPasswordFieldUnscrambleLabel':"mostra",
371 'recordDetailDirectLoginBlockTitle':"Login diretti",
372 'recordDetailNewDirectLoginDescription':"<p>Configurazione del login diretto</p> ",
373 'recordDetailDirectLoginBlockNoDirectLoginConfiguredDescription':"<p>Questa scheda contiene credenziali di accesso ad un servizio online?</p> <p>In tal caso puoi utilizzare la bookmarklet per configurare un “login diretto” da Clipperz con un solo clic!</p> ",
374 'recordDetailDeleteDirectLoginButtonLabel':"-",
375 'recordDetailAddNewDirectLoginButtonLabel':"Aggiungi nuovo login diretto",
376 'recordDetailEditButtonLabel':"Modifica",
377 'recordDetailSaveButtonLabel':"Salva",
378 'recordDetailCancelButtonLabel':"Annulla",
379 'newRecordTitleLabel':"_nuova scheda_",
380 'newDirectLoginLabelSuffix':"",
381 'recordSaveChangesPanelCollectRecordInfoMessageTitle':"Salva scheda",
382 'recordSaveChangesPanelCollectRecordInfoMessageText':"Aggiorna elenco delle schede",
383 'recordSaveChangesPanelEncryptUserDataMessageTitle':"Salva scheda",
384 'recordSaveChangesPanelEncryptUserDataMessageText':"Cripta localmente l&#x27;intestazione delle schede",
385 'recordSaveChangesPanelEncryptRecordDataMessageTitle':"Salva scheda",
386 'recordSaveChangesPanelEncryptRecordDataMessageText':"Cripta localmente i dati della scheda",
387 'recordSaveChangesPanelEncryptRecordVersionDataMessageTitle':"Salva scheda",
388 'recordSaveChangesPanelEncryptRecordVersionDataMessageText':"Cripta localmente la versione della scheda",
389 'recordSaveChangesPanelSendingDataToTheServerMessageTitle':"Salva scheda",
390 'recordSaveChangesPanelSendingDataToTheServerMessageText':"Carica le intestazioni criptate delle schede su Clipperz",
391 'recordSaveChangesPanelUpdatingTheInterfaceMessageTitle':"Salva scheda",
392 'recordSaveChangesPanelUpdatingTheInterfaceMessageText':"Aggiornamento dell&#x27;interfaccia",
393 'passwordGeneratorPanelTitle':"Generatore di password",
394 'passwordGeneratorPanelOkLabel':"Ok",
395 'passwordGeneratorPanelCancelLabel':"Annulla",
396 'passwordGeneratorLengthLabel':"lung . :",
397 //'DWRUtilLoadingMessage':"Caricamento dati",
398 'comingSoon':"Presto disponibile ...",
399 'panelCollectingEntryopyMessageText':"Raccolta entropia",
400 'importData_parsingDataTitle':"Importa",
401 'importData_previewingDataTitle':"Importa",
402 'importData_processingDataTitle':"Importa",
403 'ImportWizard':{
404 'EDIT':"Modifica",
405 'IMPORT':"Importa",
406 'CSV_NOTES':"Note",
407 'EXCEL_EDIT':"Modifica"
408},
409 'importData_importConfirmation_title':"Importa",
410 'WELCOME_BACK':"Bentornato!",
411 'currentConnectionText':"Sei collegato da ip __ip__; probabilmente in __country__, utilizzando __browser__ con __operatingSystem__.",
412 'latestConnectionText':"Il tuo ultimo accesso è stato __elapsedTimeDescription__ (__time__) da ip __ip__; probabilmente in __country__, utilizzando __browser__ con __operatingSystem__.",
413 'fullLoginHistoryLinkLabel':"vai al registro degli accessi",
414 'elapsedTimeDescriptions':{
415 'MORE_THAN_A_MONTH_AGO':"più di un mese fa",
416 'MORE_THAN_A_WEEK_AGO':"più di una settimana fa",
417 'MORE_THAN_*_WEEKS_AGO':"più di __elapsed__ settimane fa",
418 'YESTERDAY':"ieri",
419 '*_DAYS_AGO':"__elapsed__ giorni fa",
420 'ABOUT_AN_HOUR_AGO':"circa un&#x27;ora fa",
421 '*_HOURS_AGO':"__elapsed__ ore fa",
422 'JUST_A_FEW_MINUTES_AGO':"pochi minuti fa",
423 'ABOUT_*_MINUTES_AGO':"circa __elapsed__ minuti fa"
424},
425 'unknown_ip':"sconosciuto",
426 'countries':{
427 '--':"sconosciuto",
428 'AD':"Andorra",
429 'AE':"Emirati arabi uniti",
430 'AF':"Afghanistan",
431 'AG':"Antigua e Barbuda",
432 'AI':"Anguilla",
433 'AL':"Albania",
434 'AM':"Armenia",
435 'AN':"Antille olandesi",
436 'AO':"Angola",
437 'AR':"Argentina",
438 'AS':"Samoa americane",
439 'AT':"Austria",
440 'AU':"Australia",
441 'AW':"Aruba",
442 'AZ':"Azerbaigian",
443 'BB':"Barbados",
444 'BD':"Bangladesh",
445 'BE':"Belgio",
446 'BF':"Burkina-Faso",
447 'BG':"Bulgaria",
448 'BH':"Bahrein",
449 'BI':"Burundi",
450 'BJ':"Benin",
451 'BM':"Bermuda",
452 'BN':"Brunei",
453 'BO':"Bolivia",
454 'BR':"Brasile",
455 'BS':"Bahamas",
456 'BT':"Bhutan",
457 'BW':"Botswana",
458 'BY':"Bielorussia",
459 'BZ':"Belize",
460 'CA':"Canada",
461 'CD':"Repubblica democratica del Congo",
462 'CF':"Repubblica centrafricana",
463 'CH':"Svizzera",
464 'CK':"Isole Cook",
465 'CL':"Cile",
466 'CM':"Camerun",
467 'CN':"Cina",
468 'CO':"Colombia",
469 'CR':"Costa Rica",
470 'CS':"Repubblica del Montenegro",
471 'CU':"Cuba",
472 'CY':"Cipro",
473 'CZ':"Repubblica ceca",
474 'DE':"Germania",
475 'DJ':"Gibuti",
476 'DK':"Danimarca",
477 'DO':"Repubblica dominicana",
478 'DZ':"Algeria",
479 'EC':"Ecuador",
480 'EE':"Estonia",
481 'EG':"Egitto",
482 'ER':"Eritrea",
483 'ES':"Spagna",
484 'ET':"Etiopia",
485 'FI':"Finlandia",
486 'FJ':"Figi",
487 'FM':"Micronesia",
488 'FO':"Isole Fær Øer",
489 'FR':"Francia",
490 'GA':"Gabon",
491 'GB':"Regno Unito",
492 'GD':"Grenada",
493 'GE':"Georgia",
494 'GF':"Guyana francese",
495 'GG':"Guernsey",
496 'GH':"Ghana",
497 'GI':"Gibilterra",
498 'GL':"Groenlandia",
499 'GM':"Gambia",
500 'GP':"Guadalupa",
501 'GR':"Grecia",
502 'GT':"Guatemala",
503 'GU':"Guam",
504 'GW':"Guinea-Bissau",
505 'GY':"Guyana",
506 'HK':"Hong Kong",
507 'HN':"Honduras",
508 'HT':"Haiti",
509 'HU':"Ungheria",
510 'ID':"Indonesia",
511 'IE':"Irlanda",
512 'IL':"Israele",
513 'IM':"Isola di Man",
514 'IN':"India",
515 'IO':"Territorio britannico dell&#x27;Oceano Indiano",
516 'IQ':"Iraq",
517 'IR':"Iran",
518 'IS':"Islanda",
519 'IT':"Italia",
520 'JE':"Jersey",
521 'JM':"Giamaica",
522 'JO':"Giordania",
523 'JP':"Giappone",
524 'KE':"Kenya",
525 'KG':"Kirghizistan",
526 'KH':"Cambogia",
527 'KI':"Kiribati",
528 'KN':"Saint Kitts e Nevis",
529 'KR':"Corea del Sud",
530 'KW':"Kuwait",
531 'KY':"Isole Cayman",
532 'KZ':"Kazakistan",
533 'LA':"Laos",
534 'LB':"Libano",
535 'LC':"Saint Lucia",
536 'LI':"Liechtenstein",
537 'LK':"Sri Lanka",
538 'LR':"Liberia",
539 'LS':"Lesotho",
540 'LT':"Lituania",
541 'LU':"Lussemburgo",
542 'LV':"Lettonia",
543 'LY':"Libia",
544 'MA':"Marocco",
545 'MC':"Monaco",
546 'MD':"Moldova",
547 'MG':"Madagascar",
548 'MH':"Isole Marshall",
549 'ML':"Mali",
550 'MM':"Myanmar",
551 'MN':"Mongolia",
552 'MP':"Marianne settentrionali",
553 'MR':"Mauritania",
554 'MS':"Montserrat",
555 'MT':"Malta",
556 'MU':"Maurizio",
557 'MV':"Maldive",
558 'MW':"Malawi",
559 'MX':"Messico",
560 'MY':"Malaysia",
561 'MZ':"Mozambico",
562 'NA':"Namibia",
563 'NC':"Nuova Caledonia",
564 'NF':"Isola Norfolk",
565 'NG':"Nigeria",
566 'NI':"Nicaragua",
567 'NL':"Paesi Bassi",
568 'NO':"Norvegia",
569 'NP':"Nepal",
570 'NR':"Nauru",
571 'NU':"Niue",
572 'NZ':"Nuova Zelanda",
573 'OM':"Oman",
574 'PA':"Panama",
575 'PE':"Perù",
576 'PF':"Polinesia francese",
577 'PG':"Papua Nuova Guinea",
578 'PH':"Filippine",
579 'PK':"Pakistan",
580 'PL':"Polonia",
581 'PR':"Puerto Rico",
582 'PS':"Territori palestinesi",
583 'PT':"Portogallo",
584 'PW':"Palau",
585 'PY':"Paraguay",
586 'QA':"Qatar",
587 'RO':"Romania",
588 'RS':"Serbia",
589 'RU':"Russia",
590 'RW':"Ruanda",
591 'SA':"Arabia Saudita",
592 'SB':"Isole Salomone",
593 'SC':"Seicelle",
594 'SD':"Sudan",
595 'SE':"Svezia",
596 'SG':"Singapore",
597 'SI':"Slovenia",
598 'SL':"Sierra Leone",
599 'SM':"San Marino",
600 'SN':"Senegal",
601 'SR':"Suriname",
602 'SV':"El Salvador",
603 'SY':"Siria",
604 'SZ':"Swaziland",
605 'TC':"Turks e Caicos",
606 'TG':"Togo",
607 'TH':"Thailandia",
608 'TJ':"Tagikistan",
609 'TM':"Turkmenistan",
610 'TN':"Tunisia",
611 'TO':"Tonga",
612 'TR':"Turchia",
613 'TV':"Tuvalu",
614 'TW':"Taiwan",
615 'TZ':"Tanzania",
616 'UA':"Ucraina",
617 'UG':"Uganda",
618 'US':"Stati Uniti",
619 'UY':"Uruguay",
620 'UZ':"Uzbekistan",
621 'VA':"Santa Sede (Stato della Città del Vaticano)",
622 'VE':"Venezuela",
623 'VG':"Isole Vergini britanniche",
624 'VI':"Isole Vergini statunitensi",
625 'VN':"Vietnam",
626 'VU':"Vanuatu",
627 'WS':"Samoa",
628 'YE':"Yemen",
629 'ZA':"Sud Africa",
630 'ZM':"Zambia",
631 'ZW':"Zimbabwe"
632},
633 'browsers':{
634 'UNKNOWN':"sconosciuto"
635},
636 'operatingSystems':{
637 'UNKNOWN':"sconosciuto",
638 'MOBILE':"Cellulare"
639},
640 'calendarStrings':{
641 'months':{
642 '0':"Gennaio",
643 '1':"Febbraio",
644 '2':"Marzo",
645 '3':"Aprile",
646 '4':"Mag",
647 '5':"Giugno",
648 '6':"Luglio",
649 '7':"Agosto",
650 '8':"Settembre",
651 '9':"Ottobre",
652 '10':"Novembre",
653 '11':"Dicembre"
654 },
655 'shortMonths':{
656 '0':"Gen",
657 '1':"Feb",
658 '2':"Mar",
659 '3':"Apr",
660 '4':"Mag",
661 '5':"Giu",
662 '6':"Lug",
663 '7':"Ago",
664 '8':"Set",
665 '9':"Ott",
666 '10':"Nov",
667 '11':"Dic"
668 },
669 'days':{
670 '0':"Domenica",
671 '1':"Lunedì",
672 '2':"Martedì",
673 '3':"Mercoledì",
674 '4':"Giovedì",
675 '5':"Venerdì",
676 '6':"Sabato"
677 },
678 'shortDays':{
679 '0':"Dom",
680 '2':"Mar",
681 '3':"Mer",
682 '4':"Gio",
683 '5':"Ven",
684 '6':"Sab"
685 },
686 'veryShortDays':{
687 '1':"Lu",
688 '4':"Gi",
689 '5':"Ve"
690 }
691},
692
693__syntaxFix__: "syntax fix"
694});
diff --git a/frontend/beta/js/Clipperz/PM/Strings/Strings_ja-JP.js b/frontend/beta/js/Clipperz/PM/Strings/Strings_ja-JP.js
new file mode 100644
index 0000000..2b571b7
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Strings/Strings_ja-JP.js
@@ -0,0 +1,808 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29Clipperz.PM.Strings.Languages['ja-JP'.toLowerCase()] = MochiKit.Base.merge(Clipperz.PM.Strings.Languages['en-us'], {
30 'clipperzServiceDescription':"<h2>自分で管理しよう!</h2> <ul> <li> <h3>Clipperz は</h3> <ul> <li> <p>安全でシンプルなパスワードマネージャです</p> </li> <li> <p>シングルサインオンを提供します</p> </li> <li> <p>機密情報のデジタル格納庫です</p> </li> </ul> </li> <li> <h3>Clipperz でできること</h3> <ul> <li> <p>パスワードを保管して管理できます</p> </li> <li> <p>ユーザー名やパスワードを入力せずに登録したウェブサービスにログインできます</p> </li> <li> <p>暗証番号やクレジットカード番号などあらゆる機密情報を守ります</p> </li> <li> <p>家族や信用できる相手と機密情報を共有できます(提供予定)</p> </li> </ul> </li> <li> <h3>Clipperz のよいところ</h3> <ul> <li> <p>無料で匿名利用できます</p> </li> <li> <p>いつでもどのコンピュータからでもアクセスできます</p> </li> <li> <p>ソフトウェアのダウンロードやインストールは不要です</p> </li> <li> <p>PC や紙に機密情報を残す必要がありません</p> </li> </ul> </li> <li> <h3>Clipperz のセキュリティ</h3> <ul> <li> <p>データはブラウザで暗号化されてから Clipprez に送信されます</p> </li> <li> <p>暗号化のキーはあなただけが知っているパスフレーズです</p> </li> <li> <p>保管したデータは暗号化されていて、保管中には決して中身を見ることができません</p> </li> <li> <p>標準が確立された暗号化手順を採用しています</p> </li> <li> <p>ソースコードはいつでも参照できますが、暗号化について何も知らなくても使えます</p> </li> </ul> </li> <li><a href=\"http://www.clipperz.com\" target=\"_blank\">もっと見る</a> </li> </ul> ",
31 'loginFormTitle':"Clipperz のアカウントでログイン",
32 'loginFormUsernameLabel':"ユーザー名",
33 'loginFormPassphraseLabel':"パスフレーズ",
34 'loginFormDontHaveAnAccountLabel':"アカウントを持っていない?",
35 'loginFormCreateOneLabel':"新規作成",
36 'loginFormForgotYourCredentialsLabel':"パスフレーズを忘れた?",
37 'loginFormAarghThatsBadLabel':"それは困った!",
38 'loginFormAfraidOfMaliciousScriptsLabel':"偽サイトかも?",
39 'loginFormVerifyTheCodeLabel':"確認する",
40 'loginFormButtonLabel':"ログイン",
41 'loginFormOneTimePasswordCheckboxLabel':"ワンタイムパスフレーズ使用",
42 'loginFormOneTimePasswordCheckboxDescription':"",
43 'loginPanelSwithLanguageDescription':"<h5>言語設定の変更</h5> ",
44 'browserCompatibilityDescription':"<p>Clipperz は Firefox に最適化されています。 しかし Clipperz は Opera や Safari そしてインターネットエクスプローラでも十分動作します。</p> ",
45 'OTPloginMessagePanelInitialTitle':"ワンタイムパスフレーズでログイン中",
46 'OTPloginMessagePanelInitialText':"OTP 情報送信中 ...",
47 'OTPloginMessagePanelLoadingTitle':"ワンタイムパスフレーズでログイン中",
48 'OTPloginMessagePanelLoadingText':"認証情報を取得中 ...",
49 'OTPloginMessagePanelProcessingTitle':"ワンタイムパスフレーズでログイン中",
50 'OTPloginMessagePanelProcessingText':"認証情報を復号中 ...",
51 'loginMessagePanelInitialTitle':"ログイン中 ...",
52 'loginMessagePanelInitialText':"---",
53 'loginMessagePanelInitialButtonLabel':"キャンセル",
54 'loginMessagePanelConnectedTitle':"接続完了",
55 'loginMessagePanelConnectedText':"完了",
56 'loginMessagePanelFailureTitle':"エラー",
57 'loginMessagePanelFailureText':"ログインに失敗しました",
58 'loginMessagePanelFailureButtonLabel':"閉じる",
59 'connectionLoginSendingCredentialsMessageTitle':"認証確認中",
60 'connectionLoginSendingCredentialsMessageText':"認証送信中",
61 'connectionLoginCredentialsVerificationMessageTitle':"認証確認中",
62 'connectionLoginCredentialsVerificationMessageText':"SRP 認証中",
63 'connectionLoginDoneMessageTitle':"認証確認中",
64 'connectionLoginDoneMessageText':"接続完了",
65 'userLoginPanelUpgradingUserCredentialsMessageTitle':"認証確認中",
66 'userLoginPanelUpgradingUserCredentialsMessageText':"認証更新中",
67 'userLoginPanelConnectedMessageTitle':"認証完了",
68 'userLoginPanelConnectedMessageText':"ログイン完了",
69 'userLoginPanelTryingAnOlderConnectionSchemaMessageTitle':"認証確認中",
70 'userLoginPanelTryingAnOlderConnectionSchemaMessageText':"認証復元中",
71 'userLoginPanelLoadingUserDataMessageTitle':"認証完了",
72 'userLoginPanelLoadingUserDataMessageText':"暗号化データを受信中",
73 'userLoginPanelDecryptingUserDataMessageTitle':"認証完了",
74 'userLoginPanelDecryptingUserDataMessageText':"復号中",
75 'userLoginPanelDecryptingUserStatisticsMessageTitle':"認証完了",
76 'userLoginPanelDecryptingUserStatisticsMessageText':"復号中",
77 'splashAlertTitle':"Clipperz へようこそ",
78 'splashAlertText':"<p>セキュリティアドバイス</p> <ul> <li> <p>Clipperz に保管したデータはパスフレーズによって保護されます。 パスフレーズを知らない人はデータにアクセスできません。</p> </li> <li> <p>Clipperz に重要なデータを保管するためにパスフレーズを類推されにくいものにしてください。 長いほど安全です。</p> </li> <li> <p>パスフレーズを忘れてしまったら Clipperz ではデータを復元できません。</p> </li> </ul> <p>さらに詳しくは Clipperz のサイトをごらんください。</p> ",
79 'splashAlertCloseButtonLabel':"OK",
80 'registrationFormTitle':"新規アカウント作成",
81 'registrationFormUsernameLabel':"ユーザー名",
82 'registrationFormPassphraseLabel':"パスフレーズ",
83 'registrationFormRetypePassphraseLabel':"パスフレーズをもう一度",
84 'registrationFormSafetyCheckLabel':"パスフレーズを忘れたら復活できないことを了承します。",
85 'registrationFormTermsOfServiceCheckLabel':"利用許諾に同意します 。",
86 'registrationFormDoYouAlreadyHaveAnAccountLabel':"アカウントを持っている?",
87 'registrationFormSimplyLoginLabel':"すぐにログイン",
88 'registrationFormButtonLabel':"登録",
89 'registrationFormWarningMessageNotMatchingPassphrases':"パスフレーズの入力に誤りがあります。 再入力してください。",
90 'registrationFormWarningMessageSafetyCheckNotSelected':"説明を読んで下のボックスを全てチェックしてください。",
91 'registrationFormWarningMessageTermsOfServiceCheckNotSelected':"利用許諾に同意してください。",
92 'registrationMessagePanelInitialTitle':"アカウント作成中 ...",
93 'registrationMessagePanelInitialText':"---",
94 'registrationMessagePanelInitialButtonLabel':"キャンセル",
95 'registrationMessagePanelRegistrationDoneTitle':"登録",
96 'registrationMessagePanelRegistrationDoneText':"完了",
97 'registrationMessagePanelFailureTitle':"登録失敗",
98 'registrationMessagePanelFailureButtonLabel':"閉じる",
99 'connectionRegistrationSendingRequestMessageText':"認証確認中",
100 'connectionRegistrationSendingCredentialsMessageText':"認証送信中",
101 'registrationSplashPanelTitle':"セキュリティアドバイス",
102 'registrationSplashPanelDescription':"<p>Clipperz の認証情報です。 大切に保管してください。 ユーザー名とパスフレーズは二度と表示されません。</p> ",
103 'registrationSplashPanelUsernameLabel':"ユーザー名",
104 'registrationSplashPanelPassphraseLabel':"パスフレーズ",
105 'registrationSplashPanelShowPassphraseButtonLabel':"パスフレーズを表示",
106 'donateHeaderLinkLabel':"寄付",
107 'creditsHeaderLinkLabel':"クレジット",
108 'feedbackHeaderLinkLabel':"フィードバック",
109 'helpHeaderLinkLabel':"ヘルプ",
110 'forumHeaderLinkLabel':"フォーラム",
111 'recordMenuLabel':"カード",
112 'accountMenuLabel':"アカウント",
113 'dataMenuLabel':"データ",
114 'contactsMenuLabel':"コンタクト",
115 'toolsMenuLabel':"ツール",
116 'logoutMenuLabel':"ログアウト",
117 'lockMenuLabel':"ロック",
118 'lockTitle':"アカウントはロックされました",
119 'lockDescription':"<p>ロックを解除するにはパスフレーズを入力してください。</p> ",
120 'unlockButtonLabel':"解除",
121 'changePasswordTabLabel':"パスフレーズの変更",
122 'changePasswordTabTitle':"パスフレーズの変更",
123 'changePasswordFormUsernameLabel':"ユーザー名",
124 'changePasswordFormOldPassphraseLabel':"今のパスフレーズ",
125 'changePasswordFormNewPassphraseLabel':"新しいパスフレーズ",
126 'changePasswordFormRetypePassphraseLabel':"パスフレーズをもう一度",
127 'changePasswordFormSafetyCheckboxLabel':"パスフレーズを忘れたら復活できないことを了承します。",
128 'changePasswordFormSubmitLabel':"変更",
129 'changePasswordFormWrongUsernameWarning':"ユーザー名が違います",
130 'changePasswordFormWrongPassphraseWarning':"パスフレーズが違います",
131 'changePasswordFormWrongRetypePassphraseWarning':"パスフレーズの入力に誤りがあります。 再入力してください。",
132 'changePasswordFormSafetyCheckWarning':"説明を読んでボックスをチェックしてください。",
133 'changePasswordFormProgressDialogTitle':"認証情報を変更中",
134 'changePasswordFormProgressDialogEmptyText':"---",
135 'changePasswordFormProgressDialogConnectedMessageTitle':"接続完了",
136 'changePasswordFormProgressDialogConnectedMessageText':"完了",
137 'changePasswordFormProgressDialogErrorMessageTitle':"エラー",
138 'changePasswordFormProgressDialogErrorMessageText':"変更に失敗しました",
139 'changeCredentialsPanelEncryptingDataMessageTitle':"パスフレーズを変更中",
140 'changeCredentialsPanelEncryptingDataMessageText':"カードヘッダ暗号化",
141 'changeCredentialsPanelCreatingNewCredentialsMessageTitle':"パスフレーズを変更中",
142 'changeCredentialsPanelCreatingNewCredentialsMessageText':"認証情報を送信中",
143 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageTitle':"パスフレーズを変更中",
144 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageText':"暗号化データを送信中",
145 'changeCredentialsPanelDoneMessageTitle':"パスフレーズを変更中",
146 'changeCredentialsPanelDoneMessageText':"完了",
147 'manageOTPTabLabel':"ワンタイムパスフレーズ管理",
148 'manageOTPTabTitle':"ワンタイムパスフレーズ管理",
149 'manageOTPTabDescription':"<p>ワンタイムパスフレーズは通常のパスフレームと同様に機能しますが、一回限りの使い捨てパスフレーズです。</p> <p>同じパスフレーズで再度ログインすることはできません。</p> <p>不正アクセス防止のためにログインに成功したら直ちにワンタイムパスフレーズは削除されます</p> <p>ワンタイムパスフレーズはキーロガーやスパイウェアからパスフレーズを守るすばらしい機能です</p> <p><b>インターネットカフェや図書館などから Clipperz にアクセする場合にはワンタイムパスフレーズを利用することを強くお薦めします。</b> </p> ",
150 'oneTimePasswordReadOnlyMessage':"<h6>ごめんなさい</h6> <p>ローカルコピー使用中はワンタイムパスフレーズを利用できません。</p> ",
151 'oneTimePasswordLoadingMessage':"<h6>ロード中</h6> <p>お待ちください ...</p> ",
152 'oneTimePasswordNoPasswordAvailable':"<h6>有効なワンタイムパスフレーズがありません</h6> <p>「新規」ボタンをクリックしてワンタイムパスフレーズを作成してください。</p> ",
153 'createNewOTPButtonLabel':"新規",
154 'deleteOTPButtonLabel':"削除",
155 'printOTPButtonLabel':"印刷",
156 'disabledOneTimePassword_warning':"無効",
157 'oneTimePasswordSelectionLink_selectLabel':"選択:",
158 'oneTimePasswordSelectionLink_all':"すべて",
159 'oneTimePasswordSelectionLink_none':"解除",
160 'oneTimePasswordSelectionLink_used':"使用済",
161 'oneTimePasswordSelectionLink_unused':"未使用",
162 'saveOTP_encryptUserDataTitle':"ワンタイムパスフレーズを保存中",
163 'saveOTP_encryptUserDataText':"OTP 認証譲歩を作成中 ...",
164 'saveOTP_encryptOTPDataTitle':"ワンタイムパスフレーズを保存中",
165 'saveOTP_encryptOTPDataText':"暗号化データを作成中 ...",
166 'saveOTP_sendingDataTitle':"ワンタイムパスフレーズを保存中",
167 'saveOTP_sendingDataText':"暗号化データを送信中 ...",
168 'saveOTP_updatingInterfaceTitle':"ワンタイムパスフレーズを保存中",
169 'saveOTP_updatingInterfaceText':"インターフェイスを更新中 ...",
170 'accountPreferencesLabel':"設定",
171 'accountPreferencesTabTitle':"設定",
172 'accountPreferencesLanguageTitle':"言語設定",
173 'accountPreferencesLanguageDescription':"<p>リストから使用する言語を選択してください。</p> ",
174 'showDonationReminderPanelTitle':"ドネーションリマインダ",
175 'showDonationReminderPanelDescription':"<p>ドネーションリマインダを表示</p> ",
176 'saveUserPreferencesFormSubmitLabel':"保存",
177 'cancelUserPreferencesFormSubmitLabel':"キャンセル",
178 'accountPreferencesSavingPanelTitle_Step1':"保存中",
179 'accountPreferencesSavingPanelText_Step1':"暗号化中",
180 'accountPreferencesSavingPanelTitle_Step2':"保存中",
181 'accountPreferencesSavingPanelText_Step2':"送信中",
182 'accountLoginHistoryLabel':"ログイン履歴",
183 'loginHistoryTabTitle':"ログイン履歴",
184 'loginHistoryReadOnlyMessage':"<h6>ごめんなさい</h6> <p>ローカルコピー使用中はログイン履歴を利用できません。</p> ",
185 'loginHistoryLoadingMessage':"<h6>ロード中</h6> <p>お待ちください ...</p> ",
186 'loginHistoryLoadedMessage':"<h6>最近 10 回のログイン</h6> <p> </p> ",
187 'loginHistoryIPLabel':"IP",
188 'loginHistoryTimeLabel':"日付",
189 'loginHistoryCurrentSessionText':"現在のログイン",
190 'loginHistoryReloadButtonLabel':"ログイン履歴を更新",
191 'deleteAccountTabLabel':"アカウント削除",
192 'deleteAccountTabTitle':"アカウント削除",
193 'deleteAccountFormUsernameLabel':"ユーザー名",
194 'deleteAccountFormPassphraseLabel':"パスフレーズ",
195 'deleteAccountFormSafetyCheckboxLabel':"全てのデータが消去されて復元不可能になることを了承します。",
196 'deleteAccountFormSubmitLabel':"アカウント削除",
197 'deleteAccountFormWrongUsernameWarning':"ユーザー名が違います",
198 'deleteAccountFormWrongPassphraseWarning':"パスフレーズが違います",
199 'deleteAccountFormSafetyCheckWarning':"説明を読んでボックスをチェックしてください。",
200 'accountPanelDeletingAccountPanelConfirmationTitle':"確認",
201 'accountPanelDeleteAccountPanelConfirmationText':"本当にアカウントを削除しますか?",
202 'accountPanelDeleteAccountPanelConfirmButtonLabel':"はい",
203 'accountPanelDeleteAccountPanelDenyButtonLabel':"いいえ",
204 'accountPanelDeletingAccountPanelProgressTitle':"アカウント情報削除中",
205 'accountPanelDeletingAccountPanelProgressText':"しばらくお待ちください",
206 'offlineCopyTabLabel':"ローカルコピー",
207 'offlineCopyTabTitle':"ローカルコピー",
208 'offlineCopyTabDescription':"<p>ダウンロードのリンクをクリクするとインターネットに接続していないときでも利用できる読み取り専用のローカル版をダウンロードできます。</p> <p>ローカル版はオンライン版と同じ暗号化処理がされているため、編集可能なオンライン版と同じ安全性があります。</p> <ol> <li> <p>下の「ダウンロード」をクリックします。</p> </li> <li> <p>ブラウザーが &quot;Clipperz_YYYYMMDD.html&quot; をダウンロードするか確認します。 ファイルをハードディスクに保存してください。</p> </li> <li> <p>ローカルコピーをダブルクリックして起動してください。</p> </li> <li> <p>オンライン版と同じユーザー名とパスフレーズを入力してください。</p> </li> </ol> ",
209 'offlineCopyDownloadLinkLabel':"ダウンロード",
210 'offlineCopyDownloadWarning':"<h4><a href=\"#\" id=\"offlineCopyDownloadWarningLink\">ローカルコピーを更新してください</a> </h4> <p>ローカルコピーを作成後に新しいカードを追加または編集しています。 最新の情報を保つためローカルコピーを更新してください。</p> ",
211 'offlineCopyDownloadOk':"",
212 'sharingTabLabel':"共有",
213 'sharingTabTitle':"共有",
214 'sharingTabDescription':"<p>暗証番号などを他人に教える必要があることは日常生活で往々にして発生します。</p> <p>同僚に留守番電話のメッセージを代わりに聞いてもらうために暗証番号を教えたり、秘書に代わりに銀行に行ってもらうために暗証番号を教えたりということはよくあることです。</p> <p>Clipperz では機密情報を安全に、そして簡単に共有できます。</p> <p> </p> <p><b>近日登場 ...</b> </p> ",
215 'importTabLabel':"インポート",
216 'importTabTitle':"インポート",
217 'importTabDescription':"<p>コンピュータから Clipperz にデータを一括インポートできます。</p> ",
218 'printingTabLabel':"エクスポート",
219 'printingTabTitle':"エクスポート",
220 'printingTabDescription':"<h5>印刷</h5> <p>「印刷用データ」のリンクをクリックするとウィンドウが開いて全てのデータが印刷可能な状態で表示されます。</p> <p>バックアップが目的なら、誰でも見ることができる印刷版よりは安全なローカルコピーをお薦めします。</p> ",
221 'printingLinkLabel':"印刷用データ",
222 'exportTabDescription':"<h5>JSON エクスポート</h5> <p>JSON はすべてのデータをエクスポートできます。 ダイレクトログインを含むすべての情報が保存されます。</p> <p>このフォーマットはすべてのデータを別の Clipperz アカウントに移動するときに便利です。 トラブルが発生したときにデータを復旧するのにも役立ちます。</p> <p>「JSON 出力」のリンクをクリックするとエクスポートが開始されます。</p> ",
223 'exportLinkLabel':"JSON 出力",
224 'exportDataInProgressDescription':"<h4>出力中。しばらくお待ちください ...</h4> ",
225 'exportDataDescription':"<h4>利用法</h4> <p>下のテキストを任意のエディターにコピーして保存します。 (例: 「clipperz_export_20071217.json」)</p> ",
226 'contactsTabLabel':"コンタクト",
227 'contactsTabTitle':"コンタクト",
228 'passwordGeneratorTabLabel':"パスワードジェネレータ",
229 'bookmarkletTabLabel':"ブックマークレット",
230 'compactTabLabel':"コンパクト版",
231 'httpAuthTabLabel':"HTTP 認証",
232 'passwordGeneratorTabTitle':"パスワードジェネレータ",
233 'bookmarkletTabTitle':"ブックマークレット",
234 'compactTabTitle':"コンパクト版",
235 'httpAuthTabTitle':"HTTP 認証",
236 'paswordGeneratorTabDescription':"<p> </p> ",
237 'passwordGeneratorTabButtonLabel':"パスワード生成",
238 'bookmarkletTabLabel':"ブックマークレット",
239 'bookmarkletTabTitle':"ブックマークレット",
240 'bookmarkletTabDescription':"<p>ブックマークレットはブラウザのブックマークに登録して使う小さなプログラムです。 通常のウェブページのブックマークと同じようにブラウザに登録できます。</p> <p>Clipperz のブックマークレットを使えば簡単に新規カードを追加したり、既存のカードにダイレクトログインを追加したりできます。</p> <p><b>Clipperz のブックマークレットにはユーザー名やパスフレーズなどの個人情報は含まれていません。ブックマークレットは全ユーザー共通のものです。</b> </p> <h3>ブックマークレットの登録方法</h3> <h>Firefox, Camino, Opera, Safari <ol> <li> <p>ブックマークバー(パーソナルバー)が表示されていることを確認します。 (「表示」メニュー(「表示>ツールバー」サブメニューの場合もあり)から変更できます。)</p> </li> <li> <p>下の「Clipperz に追加」をブックマークバー(パーソナルバー)にドラッグします。</p> </li> </ol> <h5>インターネットエクスプローラー</h5> <ol> <li> <p>アドレスバーが表示されていることを確認します。 (「表示>ツールバー>アドレスバー」メニューから変更できます。)</p> </li> <li> <p>下の「Clipperz に追加」を右クリックします。</p> </li> <li> <p>コンテキストメニューから「お気に入りに追加」を選択します。</p> </li> <li> <p>セキュリティ警告が表示されますので「はい」をクリックします。</p> </li> <li> <p>保存先の「リンク」フォルダーを開き「OK」をクリックします。</p> </li> </ol> ",
241 'bookmarkletTabBookmarkletTitle':"Clipperz に追加",
242 'bookmarkletTabInstructions':"<h3>ダイレクトログイン用の新規カードの作成方法</h3> <ol> <li> <p>保存したいサービスのログインページを開きます。 (パスワードなどを入力する画面があるところです)</p> </li> <li> <p>ブックマークレットをクリックします。 画面上にウィンドウがポップアップします。</p> </li> <li> <p>ポップアップしたウィンドウに表示された登録用コードをコピーします。 (ctrl-C)</p> </li> <li> <p>Clipperz にログインして 「新規カード追加」のボタンをクリックします。</p> </li> <li> <p>「ダイレクトログイン」のテンプレートを選んでコード入力用のスペースに先ほどコピーしたコードを貼り付けます。 (ctrl-V)</p> </li> <li> <p>「作成」ボタンをクリックして、内容を確認して「保存」ボタンをクリックします。</p> </li> </ol> <h3>既存カードへのダイレクトログインの追加方法</h3> <ol> <li> <p>上記と同じです。</p> </li> <li> <p>上記と同じです。</p> </li> <li> <p>上記と同じです。</p> </li> <li> <p>Clipperz にログインして変更したいカードを選択後「編集」ボタンをクリックします。</p> </li> <li> <p>ダイレクトログインコード用のスペースに先ほどコピーしたコードを貼り付けます。 (ctrl-V)</p> </li> <li> <p>「ダイレクトログイン追加」ボタンをクリックして、内容を確認して「保存」ボタンをクリックします。</p> </li> </ol> <p> </p> <p>ブックマークレットに関する詳しい情報はこちら。</p> ",
243 'compactTabDescription':"<p>Clipprez Compact は Firefox のサイドバーで利用するようデザインされた Clipperz の特別版です。</p> <p>ダイレクトログインを常時アクセス可能にします。 さらに詳しく </p> <h3>Clipperz Compact の利用法</h3> <ol> <li> <p>Firefox を入手します。 サイドバーは Firefox だけで利用できるため、 Clipperz Compact を利用するには Firefox が必須です。</p> </li> <li> <p>下の「Clipperz Compact」 URL を Firefox のブックマークに登録します。ブックマークバーにドラッグするのが簡単です。</p> <div id=\"compactLinkBox\"><a href=\"https://www.clipperz.com/beta/index.html?compact\" target=\"_search\">Clipperz Compact</a> </div> </li> <li> <p>ブックマークを右クリックして「情報を見る」を選択後、「このブックマークをサイドバーに読み込む」にチェックを入れます。</p> </li> </ol> <h5>追加情報:Clipperz Compact は Opera のパネルでも操作します。</h5> ",
244 'httpAuthTabDescription':"<p>HTTP 認証は HTML の基本機能を使ってブラウザからユーザー名とパスワードでログインする方式です。</p> <p>すでに主流ではありませんが、またプライベートなサイトなどで使われています。 HTTP 認証が必要なサイトにアクセスしようとすると、ブラウザがポップアップウィンドウを開いてユーザー名とパスワードの入力を要求してきます。</p> <p>残念ながら、 Clipperz のブックマークレットは HTTP 認証には対応していません。 しかし、ダイレクトログインを設定する方法はあります。</p> <h3>HTTP 認証サイトでのダイレクトログイン設定方法</h3> <ol> <li> <p>サイトの URL とユーザー名、パスワードを新規カードに登録します。</p> </li> <li> <p>下記の設定をコピーして、カード編集画面の「ダイレクトログイン設定」のセクションに貼り付けます。</p> </li> <li> <p>「新規ダイレクトログイン追加」ボタンをクリックして、 URL とユーザー名、パスワードを入力して保存します。</p> </li> </ol> <h5><a href=\"http://support.microsoft.com/kb/834489\" target=\"_blank\">警告:インターネットエクスプローラは HTTP 認証に対応していません。</a> </h5> ",
245 'mainPanelDirectLoginBlockLabel':"ダイレクトログイン",
246 'directLinkReferenceShowButtonLabel':"表示",
247 'mainPanelDirectLoginBlockDescription':"<p>ダイレクトログインを設定してユーザー名やパスワードを入力することなくログインできるようにしましょう。</p> <p>ダイレクトログインでさらにセキュリティを強化するために:</p> <ul> <li> <p>より複雑なパスワードを設定しましょう</p> </li> <li> <p>推測されやすい同じパスワードを複数のサイトで使わないようにしましょう。</p> </li> </ul> <p>ブックマークレットを使うと簡単に設定できます。</p><a href=\"http://www.clipperz.com/support/user_guide/direct_logins\" target=\"_blank\">ダイレクトログインに関する詳しい情報</a> ",
248 'mainPanelRecordsBlockLabel':"カード",
249 'mainPanelAddRecordButtonLabel':"新規カード追加",
250 'mainPanelRemoveRecordButtonLabel':"カード削除",
251 'mainPanelRecordFilterBlockAllLabel':"すべて",
252 'mainPanelRecordFilterBlockTagsLabel':"タグ",
253 'mainPanelRecordFilterBlockSearchLabel':"検索",
254 'recordDetailNoRecordAtAllTitle':"Clipperz へようこそ",
255 'recordDetailNoRecordAtAllDescription':"<h5>まず最初にカードを追加しましょう。</h5> <p>カードはパスワードやその他の重要な情報を保管するためのシンプルでフレキシブルなフォームです。</p> <p>カードにはウェブサイトのログインパスワード、自転車の鍵の番号、クレジットカードの番号など何でも記入できます。</p> <h5>ブックマークレットを活用しましょう。</h5> <p>まずは簡単にカードを追加できるブックマークレットをインストールしましょう。</p> <p>ブックマークレットのタブをクリックしてインストール方法と利用方法を確認しましょう。</p> <p> </p> <p>ブックマークレットをインストールしたら Clipperz を活用しましょう。</p> <p> </p><a href=\"http://www.clipperz.com/support/user_guide/managing_cards\" target=\"_blank\">カードに関する詳しい情報</a> ",
256 'newRecordWizardTitleBox':"<h5>テンプレート選択</h5> <p>カードはシンプルでパスワードや重要な情報を何でも保存できる柔軟性があります。</p> <p>まずはテンプレートを選んでください。  カードはいつでも自由に変更できます。</p> ",
257 'newRecordWizardBookmarkletConfigurationTitle':"ダイレクトログイン",
258 'newRecordWizardBookmarkletConfigurationDescription':"<p>ブックマークレットが生成したコードを下に貼り付けてください。</p> <p>ダイレクトログイン情報を含む新しいカードが作成されます。</p> ",
259 'newRecordWizardCreateButtonLabel':"作成",
260 'newRecordWizardCancelButtonLabel':"キャンセル",
261 'donateSplashPanelTitle':"Clipperz のために今すぐ寄付しよう",
262 'donateSplashPanelDescription':"<p>寄付する理由:</p> <ul> <li> <p>新機能追加をサポートします</p> </li> <li> <p>Clipperz を無料に保ちます</p> </li> <li> <p>開発陣の仕事に感謝します</p> </li> </ul> <p>詳しくは寄付のページをごらんください .</p> <p><b>寄付しますか?</b> </p> ",
263 'donateCloseButtonLabel':"あとでする",
264 'donateDonateButtonLabel':"はい",
265 'recordTemplates':{
266 'WebAccount':{
267 'title':"ウェブパスワード",
268 'description':"<p>ログイン情報用のシンプルなカードです。</p> ",
269 'fields':{
270 'URL':"ウェブアドレス",
271 'TXT':"ユーザー名またはメールアドレス",
272 'PWD':"パスワード"
273 }
274 },
275 'BankAccount':{
276 'title':"銀行口座",
277 'description':"<p>口座番号とオンラインバンキング情報用のカードです。</p> ",
278 'fields':{
279 'TXT':"銀行",
280 'TXT':"口座番号",
281 'URL':"銀行サイト",
282 'TXT':"オンラインバンキング ID",
283 'PWD':"オンラインバンキングパスワード"
284 }
285 },
286 'CreditCard':{
287 'title':"クレジットカード",
288 'description':"<p>クレジットカードに関するあらゆる情報を保管できます。</p> ",
289 'fields':{
290 'TXT':"種類(Visa 、 AMEX など)",
291 'TXT':"番号",
292 'TXT':"所有者名",
293 'TXT':"有効期限",
294 'TXT':"CVV2 番号",
295 'PWD':"暗証番号",
296 'URL':"カード会社サイト",
297 'TXT':"ユーザー名",
298 'PWD':"パスワード"
299 }
300 },
301 'AddressBookEntry':{
302 'title':"アドレス帳",
303 'description':"<p>Clipperz はプライベートなアドレス帳としても機能します。 このテンプレートを利用して簡単に新しい住所を追加できます。</p> ",
304 'fields':{
305 'TXT':"名前",
306 'TXT':"メールアドレス",
307 'TXT':"電話番号",
308 'TXT':"携帯電話",
309 'ADDR':"住所"
310 }
311 },
312 'Custom':{
313 'title':"カスタムカード",
314 'description':"<p>カスタムカードを使えばどんな情報でも保管できます。</p> ",
315 'fields':{
316 'TXT':"ラベル 1",
317 'TXT':"ラベル 2",
318 'TXT':"ラベル 3"
319 }
320 }
321},
322 'recordFieldTypologies':{
323 'TXT':{
324 'description':"テキスト入力欄",
325 'shortDescription':"テキスト"
326 },
327 'PWD':{
328 'description':"通常は非表示になるテキスト入力欄",
329 'shortDescription':"パスワード"
330 },
331 'URL':{
332 'description':"表示モードではクリックできる URL 入力欄",
333 'shortDescription':"ウェブアドレス"
334 },
335 'DATE':{
336 'description':"日付入力欄",
337 'shortDescription':"日付"
338 },
339 'ADDR':{
340 'description':"Google マップ用の URL に似た文字列",
341 'shortDescription':"住所"
342 },
343 'CHECK':{
344 'description':"チェックボックスの詳細",
345 'shortDescription':"チェックボックス"
346 },
347 'RADIO':{
348 'description':"ラジオボタンの詳細",
349 'shortDescription':"ラジオボタン"
350 },
351 'SELECT':{
352 'description':"セレクトリストの詳細",
353 'shortDescription':"セレクトリスト"
354 }
355},
356 'newRecordPanelGeneralExceptionTitle':"エラー",
357 'newRecordPanelGeneralExceptionMessage':"コードが不正です。 ブックマークレットを確認してもう一度やり直してください。",
358 'newRecordPanelWrongBookmarkletVersionExceptionTitle':"エラー",
359 'newRecordPanelWrongBookmarkletVersionExceptionMessage':"古いバージョンのブックマークレットで生成されたコードです。 ブックマークレットを更新してやり直してください。",
360 'newRecordPanelExceptionPanelCloseButtonLabel':"キャンセル",
361 'mainPanelDeletingRecordPanelConfirmationTitle':"カード削除中",
362 'mainPanelDeleteRecordPanelConfirmationText':"本当に削除しますか?",
363 'mainPanelDeleteRecordPanelConfirmButtonLabel':"はい",
364 'mainPanelDeleteRecordPanelDenyButtonLabel':"いいえ",
365 'mainPanelDeletingRecordPanelInitialTitle':"カード削除中",
366 'mainPanelDeletingRecordPanelInitialText':"---",
367 'mainPanelDeletingRecordPanelCompletedText':"完了",
368 'deleteRecordPanelCollectRecordDataMessageTitle':"カード削除",
369 'deleteRecordPanelCollectRecordDataMessageText':"カードリスト更新中",
370 'deleteRecordPanelEncryptUserDataMessageTitle':"カード削除",
371 'deleteRecordPanelEncryptUserDataMessageText':"カードヘッダ暗号化",
372 'deleteRecordPanelSendingDataToTheServerMessageTitle':"カード削除",
373 'deleteRecordPanelSendingDataToTheServerMessageText':"送信中",
374 'deleteRecordPanelUpdatingTheInterfaceMessageTitle':"カード削除",
375 'deleteRecordPanelUpdatingTheInterfaceMessageText':"更新中",
376 'recordDetailNoRecordSelectedTitle':"カードが選択されていません",
377 'recordDetailNoRecordSelectedDescription':"<p>左のリストからカードを選択してください。</p> ",
378 'recordDetailLoadingRecordMessage':"データ受信中",
379 'recordDetailDecryptingRecordMessage':"データ復元中",
380 'recordDetailLoadingRecordVersionMessage':"最新情報を受信中",
381 'recordDetailDecryptingRecordVersionMessage':"最新情報を復元中",
382 'recordDetailLoadingErrorMessageTitle':"受信エラー",
383 'recordDetailNotesLabel':"ノート",
384 'recordDetailLabelFieldColumnLabel':"ラベル",
385 'recordDetailDataFieldColumnLabel':"データ",
386 'recordDetailTypeFieldColumnLabel':"タイプ",
387 'recordDetailSavingChangesMessagePanelInitialTitle':"保存中",
388 'recordDetailSavingChangesMessagePanelInitialText':"---",
389 'recordDetailRemoveFieldButtonLabel':"-",
390 'recordDetailAddFieldButtonLabel':"フィールド追加",
391 'recordDetailPasswordFieldHelpLabel':"パスワードをコピーするには星マークをクリックして ctrl-C をタイプします",
392 'recordDetailPasswordFieldScrambleLabel':"隠す",
393 'recordDetailPasswordFieldUnscrambleLabel':"可視化",
394 'recordDetailDirectLoginBlockTitle':"ダイレクトログイン",
395 'recordDetailNewDirectLoginDescription':"<p>ダイレクトログイン設定</p> ",
396 'recordDetailDirectLoginBlockNoDirectLoginConfiguredDescription':"<p>オンラインサービスのログイン情報を含んでいますか?</p> <p>ブックマークレットを使ってダイレクトログインを設定しましょう!</p> ",
397 'recordDetailDeleteDirectLoginButtonLabel':"-",
398 'recordDetailAddNewDirectLoginButtonLabel':"新規ダイレクトログイン追加",
399 'recordDetailEditButtonLabel':"編集",
400 'recordDetailSaveButtonLabel':"保存",
401 'recordDetailCancelButtonLabel':"キャンセル",
402 'newRecordTitleLabel':"_新規カード_",
403 'newDirectLoginLabelSuffix':"",
404 'recordSaveChangesPanelCollectRecordInfoMessageTitle':"カード保存",
405 'recordSaveChangesPanelCollectRecordInfoMessageText':"更新中",
406 'recordSaveChangesPanelEncryptUserDataMessageTitle':"カード保存",
407 'recordSaveChangesPanelEncryptUserDataMessageText':"カードヘッダ暗号化",
408 'recordSaveChangesPanelEncryptRecordDataMessageTitle':"カード保存",
409 'recordSaveChangesPanelEncryptRecordDataMessageText':"カードデータ暗号化",
410 'recordSaveChangesPanelEncryptRecordVersionDataMessageTitle':"カード保存",
411 'recordSaveChangesPanelEncryptRecordVersionDataMessageText':"バージョンデータ暗号化",
412 'recordSaveChangesPanelSendingDataToTheServerMessageTitle':"カード保存",
413 'recordSaveChangesPanelSendingDataToTheServerMessageText':"カード送信中",
414 'recordSaveChangesPanelUpdatingTheInterfaceMessageTitle':"カード保存",
415 'recordSaveChangesPanelUpdatingTheInterfaceMessageText':"更新中",
416 'passwordGeneratorPanelTitle':"パスワードジェネレータ",
417 'passwordGeneratorPanelOkLabel':"OK",
418 'passwordGeneratorPanelCancelLabel':"キャンセル",
419 'passwordGeneratorLowercaseLabel':"abc",
420 'passwordGeneratorUppercaseLabel':"ABC",
421 'passwordGeneratorNumberLabel':"012",
422 'passwordGeneratorSymbolLabel':"@#$",
423 'passwordGeneratorLengthLabel':"文字数:",
424 //'DWRUtilLoadingMessage':"ロード中 ...",
425 'comingSoon':"近日登場 ...",
426 'panelCollectingEntryopyMessageText':"整頓中",
427 'directLoginConfigurationCheckBoxFieldSelectedValue':"はい",
428 'directLoginConfigurationCheckBoxFieldNotSelectedValue':"いいえ",
429 'importFormats':{
430 'CSV':{
431 'label':"CSV",
432 'description':"<p>広く普及しているフォーマットです。 いくつかのパスワードマネージャは CSV でのエクスポートに対応しています。</p>"
433 },
434 'Excel':{
435 'label':"エクセル",
436 'description':"<p>マイクロソフトの有名な表計算ソフトです。 エクセルのファイルでパスワードを保存することは広く行われていますがおすすめできません。</p>"
437 },
438 'KeePass':{
439 'label':"KeePass",
440 'description':"<p>パスワードマネージャ KeePass で生成されるテキストファイルです。</p>"
441 },
442 'PasswordPlus':{
443 'label':"Password Plus",
444 'description':"<p>パスワードマネージャ Password Plus で生成される CSV ファイルです。</p>"
445 },
446 'Roboform':{
447 'label':"RoboForm",
448 'description':"<p>パスワードマネージャ Roboform で印刷用に表示される HTML ファイルです。</p>"
449 },
450 'ClipperzExport':{
451 'label':"JSON",
452 'description':"<p>Clipperz で生成されるフォーマットです。 ダイレクトログインを含むすべての情報が含まれます。</p>"
453 }
454},
455 'Clipperz_ImportWizard_Title':"JSON インポート",
456 'importOptions_clipperz_description':"<p>Clipperz で生成された JSON ファイルをテキストエディタで開きます。 次に下のテキストエリアにファイルの内容をコピーします。</p> ",
457 'CSV_ImportWizard_Title':"CSV インポート",
458 'importOptions_csv_description_':"<p>CSV ファイルをテキストエディタで開きます。 下のテキストエリアにファイルの内容をコピーします。</p> <p>区切り記号などを選択します。</p> ",
459 'Excel_ImportWizard_Title':"エクセルインポート",
460 'importOptions_excel_description_':"<p>エクセルでファイルを開いてインポートしたいセルを選択します。 次に下のテキストエリアに選択したセルをコピーします。</p> ",
461 'KeePass_ImportWizard_Title':"KeePass インポート",
462 'importOptions_keePass_description_':"<p>KeePas で生成されたファイルをテキストエディタで開きます。 次に下のテキストエリアにファイルの内容をコピーします。</p> ",
463 'PasswordPlus_ImportWizard_Title':"Password Plus インポート",
464 'importOptions_passwordPlus_description':"<p>Password Plus で生成された CSV ファイルをテキストエディタで開きます。 下のテキストエリアにファイルの内容をコピーします。</p> ",
465 'RoboForm_ImportWizard_Title':"RoboForm インポート",
466 'importOptions_roboForm_description':"<p>RoboForm で生成された HTML ファイルをテキストエディタで開きます。 次に下のテキストエリアにファイルの内容をコピーします。</p> ",
467 'importData_parsingDataTitle':"インポート",
468 'importData_parsingDataText':"分析中 ...",
469 'importData_previewingDataTitle':"インポート",
470 'importData_previewingDataText':"変換中 ...",
471 'importData_processingDataTitle':"インポート",
472 'importData_processingDataText':"カード作成中 ...",
473 'ImportWizard':{
474 'EDIT':"編集",
475 'PREVIEW':"プレビュー",
476 'IMPORT':"インポート",
477 'KEEPASS_SETTINGS':"設定",
478 'CSV_EDIT':"貼り付け",
479 'CSV_COLUMNS':"列",
480 'CSV_HEADER':"ラベル",
481 'CSV_TITLE':"タイトル",
482 'CSV_NOTES':"ノート",
483 'CSV_FIELDS':"タイプ",
484 'EXCEL_EDIT':"編集"
485},
486 'CSV_ImportWizard_Columns':"<p>インポートする列を選択してください。</p> ",
487 'CSV_ImportWizard_Header':"<p>最初の行にラベルが含まれている場合、下のチェックボックスをチェックしてください。</p> ",
488 'CSV_ImportWizard_Header_Settings_firstRowHeaderLabel':"先頭行をラベルとして利用する",
489 'CSV_ImportWizard_Title':"<p>カードのタイトルになる列を選択してください。 (必須)</p>",
490 'CSV_ImportWizard_Notes':"<p>ノートに相当する列を選択してください。 (オプション)</p> ",
491 'CSV_ImportWizard_Notes_Settings_noSelectionLabel':"ノートは利用できません",
492 'CSV_ImportWizard_Fields':"<p>それぞれの列のデータタイプをドロップダウンリストから選択してください。</p> ",
493 'CSV_ImportWizard_Fields_MissingLabelWarning':"ラベルがありません",
494 'importData_importConfirmation_title':"インポート",
495 'importData_importConfirmation_text':"__numberOfRecords__ 枚のカードをインポートしますか?",
496 'WELCOME_BACK':"おかえりなさい",
497 'currentConnectionText':"あなたの利用 IP アドレスは __ip__, です。 country__, から __operatingSystem__ 版 __browser__ を利用しています。",
498 'latestConnectionText':"前回の利用は __elapsedTimeDescription__ (__time__)、IP アドレスは __ip__, でした。 country__ から __operatingSystem__ 版 __browser__ を利用しました。",
499 'fullLoginHistoryLinkLabel':"ログイン履歴を詳しく見る",
500 'elapsedTimeDescriptions':{
501 'MORE_THAN_A_MONTH_AGO':"1 か月以上前",
502 'MORE_THAN_A_WEEK_AGO':"1 週間以上前",
503 'MORE_THAN_*_WEEKS_AGO':"elapsed__ 週間以上前",
504 'YESTERDAY':"昨日",
505 '*_DAYS_AGO':"__elapsed__ 日前",
506 'ABOUT_AN_HOUR_AGO':"約 1 時間前",
507 '*_HOURS_AGO':"__elapsed__ 時間前",
508 'JUST_A_FEW_MINUTES_AGO':"直前",
509 'ABOUT_*_MINUTES_AGO':"約 __elapsed__ 分前"
510},
511 'unknown_ip':"不明",
512 'countries':{
513 '--':"不明",
514 'AD':"アンドラ",
515 'AE':"アラブ首長国連邦",
516 'AF':"アフガニスタン",
517 'AG':"アンティグアバーブーダ",
518 'AI':"アングイラ",
519 'AL':"アルバニア",
520 'AM':"アルメニア",
521 'AN':"オランダ アンティル諸島",
522 'AO':"アンゴラ",
523 'AP':"その他のアジアパシフィック地域",
524 'AR':"アルゼンチン",
525 'AS':"米国領サモア",
526 'AT':"オーストリア",
527 'AU':"オーストラリア",
528 'AW':"アルーバ",
529 'AX':"アーラント諸島",
530 'AZ':"アゼルバイジャン",
531 'BA':"ボスニア・ヘルツェゴビナ",
532 'BB':"バルバドス",
533 'BD':"バングラデシュ",
534 'BE':"ベルギー",
535 'BF':"ブルキナファソ",
536 'BG':"ブルガリア",
537 'BH':"バーレーン",
538 'BI':"ブルンジ",
539 'BJ':"ベナン",
540 'BN':"ブルネイダルサラーム",
541 'BO':"ボリビア",
542 'BR':"ブラジル",
543 'BS':"バハマ",
544 'BT':"ブータン",
545 'BW':"ボツワナ",
546 'BY':"ベラルーシ",
547 'BZ':"ベリーズ",
548 'CA':"カナダ",
549 'CD':"コンゴ民主共和国",
550 'CF':"中央アフリカ共和国",
551 'CH':"スイス",
552 'CI':"コートジボワール",
553 'CK':"クック諸島",
554 'CL':"チリ",
555 'CM':"カメルーン",
556 'CN':"中国",
557 'CO':"コロンビア",
558 'CR':"コスタリカ",
559 'CS':"セルビア・モンテネグロ",
560 'CU':"キューバ",
561 'CY':"キプロス",
562 'CZ':"チェコ共和国",
563 'DE':"ドイツ",
564 'DJ':"ジブチ",
565 'DK':"デンマーク",
566 'DO':"ドミニカ共和国",
567 'DZ':"アルジェリア",
568 'EC':"エクアドル",
569 'EE':"エストニア",
570 'EG':"エジプト",
571 'ER':"エリトリア",
572 'ES':"スペイン",
573 'ET':"エチオピア",
574 'EU':"欧州連合",
575 'FI':"フィンランド",
576 'FJ':"フィジー",
577 'FM':"ミクロネシア連邦邦国",
578 'FR':"フランス",
579 'GA':"ガボン",
580 'GB':"英国",
581 'GD':"グラナダ",
582 'GE':"グルジア",
583 'GF':"仏領ギアナ",
584 'GG':"ガーンジー",
585 'GH':"ガーナ",
586 'GI':"ジブラルタル",
587 'GL':"グリーンランド",
588 'GP':"グアドロープ",
589 'GR':"ギリシャ",
590 'GT':"カタロニア",
591 'GU':"グアム",
592 'GW':"ギニアビサウ",
593 'GY':"ガイアナ",
594 'HK':"香港",
595 'HN':"ホンデュラス",
596 'HR':"クロアチア",
597 'HT':"ハイチ",
598 'HU':"ハンガリー",
599 'ID':"インドネシア",
600 'IE':"アイルランド",
601 'IL':"イスラエル",
602 'IM':"マン島",
603 'IN':"インド",
604 'IO':"英領インド洋植民地",
605 'IQ':"イラク",
606 'IR':"イラン・イスラム共和国",
607 'IS':"アイスランド",
608 'IT':"イタリア",
609 'JE':"ジャージー",
610 'JO':"ヨルダン",
611 'JP':"日本",
612 'KE':"ケニア",
613 'KG':"キルギスタン",
614 'KH':"カンボジア",
615 'KI':"キリバス",
616 'KN':"セントキッツネヴィス",
617 'KR':"大韓民国 (韓国)",
618 'KW':"クウェート",
619 'KY':"カイマン諸島",
620 'KZ':"カザフスタン",
621 'LA':"ラオス人民民主共和国",
622 'LB':"レバノン",
623 'LC':"セントルシア",
624 'LI':"リヒテンシュタイン",
625 'LK':"スリランカ",
626 'LR':"リベリア",
627 'LS':"レソト",
628 'LT':"リトアニア",
629 'LU':"ルクセンブルグ",
630 'LV':"ラトビア",
631 'LY':"リビア・アラブ・Jamahiriya",
632 'MA':"モロッコ",
633 'MC':"モナコ",
634 'MD':"モルドバ共和国",
635 'MG':"マダガスカル",
636 'MH':"マーシャル諸島",
637 'MK':"マケドニア共和国",
638 'ML':"マリ",
639 'MM':"ミャンマー",
640 'MN':"モンゴル",
641 'MO':"マカオ",
642 'MP':"北マリアナ諸島",
643 'MR':"モーリタニア",
644 'MT':"マルタ",
645 'MU':"モーリシャス",
646 'MV':"モルジヴ",
647 'MW':"マラウイ",
648 'MX':"メキシコ",
649 'MY':"マレーシア",
650 'MZ':"モザンビーク",
651 'NA':"ナミビア",
652 'NC':"ニューカレドニア",
653 'NF':"ノーフォーク諸島",
654 'NG':"ナイジェリア",
655 'NI':"ニカラグア",
656 'NL':"オランダ",
657 'NO':"ノルウェー",
658 'NP':"ネパール",
659 'NR':"ナウル",
660 'NU':"ニウエ",
661 'NZ':"ニュージーランド",
662 'OM':"オマーン",
663 'PA':"パナマ",
664 'PE':"ペルー",
665 'PF':"仏領ポリネシア",
666 'PG':"パプアニューギニア",
667 'PH':"フィリピン",
668 'PK':"パキスタン",
669 'PL':"ポーランド",
670 'PR':"プエルトリコ",
671 'PS':"パレスチナ占領地区",
672 'PT':"ポルトガル",
673 'PW':"パラオ",
674 'PY':"パラグアイ",
675 'QA':"カタール",
676 'RO':"ルーマニア",
677 'RS':"セルビア",
678 'RU':"ロシア連邦",
679 'RW':"ルワンダ",
680 'SA':"サウジアラビア",
681 'SB':"ソロモン諸島",
682 'SC':"セイシェル",
683 'SD':"スーダン",
684 'SE':"スウェーデン",
685 'SG':"シンガポール",
686 'SI':"スロベニア",
687 'SK':"スロバキア",
688 'SL':"シエラレオネ",
689 'SM':"サンマリノ",
690 'SN':"セネガル",
691 'SR':"スリナム",
692 'SV':"エルサルバドル",
693 'SY':"シリアアラブ共和国",
694 'SZ':"スワジランド",
695 'TC':"タークスアンドケーコス諸島",
696 'TG':"トーゴ",
697 'TH':"タイ",
698 'TJ':"タジキスタン",
699 'TM':"トルクメニスタン",
700 'TN':"チュニジア",
701 'TO':"トンガ",
702 'TR':"トルコ",
703 'TT':"トリニダードトバコ",
704 'TV':"ツヴァル",
705 'TW':"中国領・台湾",
706 'TZ':"タニザニア連合共和国",
707 'UA':"ウクライナ",
708 'UG':"ウガンダ",
709 'US':"アメリカ合衆国",
710 'UY':"ウルグアイ",
711 'UZ':"ウズベキスタン",
712 'VA':"聖庁 (バチカン市国)",
713 'VE':"ベネズェラ",
714 'VG':"英国ヴァージン諸島",
715 'VI':"米国ヴァージン諸島",
716 'VN':"ベトナム",
717 'VU':"バヌアツ",
718 'WF':"ワリーエフトゥーナ諸島",
719 'WS':"サモア",
720 'YE':"イエメン",
721 'ZA':"南アフリカ",
722 'ZM':"ザンビア",
723 'ZW':"ジンバブエ",
724 'ZZ':"Reserved"
725},
726 'browsers':{
727 'UNKNOWN':"不明",
728 'MSIE':"インターネットエクスプローラー",
729 'FIREFOX':"Firefox",
730 'OPERA':"Opera",
731 'SAFARI':"Safari",
732 'OMNIWEB':"OmniWeb",
733 'CAMINO':"Camino"
734},
735 'operatingSystems':{
736 'UNKNOWN':"不明",
737 'WINDOWS':"ウィンドウズ",
738 'MAC':"Mac",
739 'LINUX':"Linux",
740 'IPHONE':"iPhone",
741 'MOBILE':"携帯電話",
742 'OPENBSD':"OpenBSD",
743 'FREEBSD':"FreeBSD",
744 'NETBSD':"NetBSD"
745},
746 'calendarStrings':{
747 'months':{
748 '0':"1 月",
749 '1':"2 月",
750 '2':"3 月",
751 '3':"4 月",
752 '4':"5",
753 '5':"6 月",
754 '6':"7 月",
755 '7':"8 月",
756 '8':"9 月",
757 '9':"10 月",
758 '10':"11 月",
759 '11':"12 月"
760 },
761 'shortMonths':{
762 '0':"1",
763 '1':"2",
764 '2':"3",
765 '3':"4",
766 '4':"5",
767 '5':"6",
768 '6':"7",
769 '7':"8",
770 '8':"9",
771 '9':"10",
772 '10':"11",
773 '11':"12"
774 },
775 'days':{
776 '0':"日曜日",
777 '1':"月曜日",
778 '2':"火曜日",
779 '3':"水曜日",
780 '4':"木曜日",
781 '5':"金曜日",
782 '6':"土曜日"
783 },
784 'shortDays':{
785 '0':"日",
786 '1':"月",
787 '2':"火",
788 '3':"水",
789 '4':"木",
790 '5':"金",
791 '6':"土"
792 },
793 'veryShortDays':{
794 '0':"月",
795 '1':"月",
796 '2':"日",
797 '3':"金",
798 '4':"木",
799 '5':"金",
800 '6':"水"
801 },
802 'amDesignation':"土",
803 'pmDesignation':"午後"
804},
805 'fullDate_format':"l, F d, Y H:i:s",
806
807__syntaxFix__: "syntax fix"
808});
diff --git a/frontend/beta/js/Clipperz/PM/Strings/Strings_pt-BR.js b/frontend/beta/js/Clipperz/PM/Strings/Strings_pt-BR.js
new file mode 100644
index 0000000..db6c2f6
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Strings/Strings_pt-BR.js
@@ -0,0 +1,478 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29Clipperz.PM.Strings.Languages['pt-BR'.toLowerCase()] = MochiKit.Base.merge(Clipperz.PM.Strings.Languages['en-us'], {
30 'clipperzServiceDescriptionConfig':"<h2>Guarde com você!</h2> <ul> <li> <h3>Clipperz é:</h3> <ul> <li> <p>um simples e seguro gerenciador de senhas</p> </li> <li> <p>uma efetiva solução com uma única assinatura</p> </li> <li> <p>um cofre digital para suas informações confidenciais</p> </li> </ul> </li> <li> <h3>Com Clipperz você pode:</h3> <ul> <li> <p>guardar e gerenciar suas senhas e credenciais online</p> </li> <li> <p>logar em seus serviços web sem precisar entrar com nenhum nome de usuário ou senha</p> </li> <li> <p>proteger todos os seus dados sensíveis: códigos de alarme, PINs, números de cartão de crédito, &hellip;</p> </li> <li> <p>compartilhar segredos com membros da família e associados (em breve)</p> </li> </ul> </li> <li> <h3>Clipperz proporciona:</h3> <ul> <li> <p>anonimato completo e gratuito</p> </li> <li> <p>acesso a qualquer hora em qualquer computador</p> </li> <li> <p>sem software ou download e nada que instalar</p> </li> <li> <p>evite guardar seus segredos em seu PC ou papel</p> </li> </ul> </li> <li> <h3>Segurança Clipperz:</h3> <ul> <li> <p>seus segredos são codificados localmente por seu navegador antes de ser enviado para Clipperz</p> </li> <li> <p>a chave de codificação é uma senha que só você conhece</p> </li> <li> <p>Clipperz armazena apenas seus dados confidenciais codificados, nunca acessando os dados originais</p> </li> <li> <p>Clipperz é construído a partir de esquemas de codificação padrão, ou seja, nada é exclusivo ou caseiro</p> </li> <li> <p>você pode revisar o código a qualquer momento, mas você não precisa conhecer nada sobre criptograia para ser um usuário feliz!</p> </li> </ul> </li> <li> <a href=\"http://www.clipperz.com\" target=\"_blank\">Saiba mais</a> </li> </ul> ",
31 'loginFormTitle':"entre sua conta Clipperz",
32 'loginFormUsernameLabel':"nome do usuário",
33 'loginFormPassphraseLabel':"frase chave",
34 'loginFormDontHaveAnAccountLabel':"não tem uma conta?",
35 'loginFormCreateOneLabel':"criar uma",
36 'loginFormForgotYourCredentialsLabel':"esqueceu suas credenciais?",
37 'loginFormAarghThatsBadLabel':"xiiiii! isso é não é bom!",
38 'loginFormAfraidOfMaliciousScriptsLabel':"medo de scripts maliciosos?",
39 'loginFormVerifyTheCodeLabel':"verifique o código",
40 'loginFormButtonLabel':"Entrar",
41 'loginFormOneTimePasswordCheckboxLabel':"use uma frase chave descartável",
42 'loginPanelSwithLanguageDescription':"<h5>Mudar para sua linguagem preferida</h5> ",
43 'browserCompatibilityDescription':"<p>Tenha uma experiência melhor e mais segura com Clipperz, utilizando o Firefox. No entanto, Clipperz funciona bem também em Opera e MS Internet Explorer!</p> ",
44 'OTPloginMessagePanelInitialTitle':"Acessando usando a frase chave descartável",
45 'OTPloginMessagePanelInitialText':"Enviando credenciais descartáveis ...",
46 'OTPloginMessagePanelLoadingTitle':"Acessando usando a frase chave descartável",
47 'OTPloginMessagePanelLoadingText':"Buscando informação de autenticação codificada no servidor ...",
48 'OTPloginMessagePanelProcessingTitle':"Acessando usando a frase chave descartável",
49 'OTPloginMessagePanelProcessingText':"Decodificação local da informação de autenticação ...",
50 'loginMessagePanelInitialTitle':"Entrando ...",
51 'loginMessagePanelInitialButtonLabel':"Cancelar",
52 'loginMessagePanelConnectedTitle':"Conectado",
53 'loginMessagePanelConnectedText':"Concluído",
54 'loginMessagePanelFailureTitle':"Erro",
55 'loginMessagePanelFailureText':"Ocorreu uma falha",
56 'loginMessagePanelFailureButtonLabel':"Fechar",
57 'connectionLoginSendingCredentialsMessageTitle':"Verificando credenciais",
58 'connectionLoginSendingCredentialsMessageText':"Enviando credenciais",
59 'connectionLoginCredentialsVerificationMessageTitle':"Verificando credenciais",
60 'connectionLoginCredentialsVerificationMessageText':"Realizando autenticação SRP",
61 'connectionLoginDoneMessageTitle':"Verificando credenciais",
62 'connectionLoginDoneMessageText':"Conectado",
63 'userLoginPanelUpgradingUserCredentialsMessageTitle':"Verificando credenciais",
64 'userLoginPanelUpgradingUserCredentialsMessageText':"Upgrade de suas credenciais para um novo esquema de autenticação",
65 'userLoginPanelConnectedMessageTitle':"Usuário autenticado",
66 'userLoginPanelConnectedMessageText':"Logado com sucesso em",
67 'userLoginPanelTryingAnOlderConnectionSchemaMessageTitle':"Verificando credenciais",
68 'userLoginPanelTryingAnOlderConnectionSchemaMessageText':"Tentando esquema antigo de autenticação",
69 'userLoginPanelLoadingUserDataMessageTitle':"Usuário autenticado",
70 'userLoginPanelLoadingUserDataMessageText':"Baixando cabeçalhos de cartão codificados de Clipperz",
71 'userLoginPanelDecryptingUserDataMessageTitle':"Usuário autenticado",
72 'userLoginPanelDecryptingUserDataMessageText':"Descrição local de cabeçalhos dos cartões",
73 'userLoginPanelDecryptingUserStatisticsMessageTitle':"Usuário autenticado",
74 'userLoginPanelDecryptingUserStatisticsMessageText':"Descrição local de estatísticas de uso",
75 'splashAlertTitle':"Bem-vindo ao Clipperz!",
76 'splashAlertText':"<p>Alguns avisos de segurança</p> <ul> <li> <p>Guardar suas informações no Clipperz é tão seguro quanto a frase chave que você escolher para protege-los. Ninguém pode acessá-los sem essa frase chave.</p> </li> <li> <p>Se você vai utlizar Clipperz para armazenar suas informações confidenciais e críticas, escolha uma frase chave difícil de ser descoberta. Quanto mais longa, melhor!</p> </li> <li> <p>Clipperz não será capaz de recuperar frase chave perdidas!</p> </li> </ul> <p>Para mais informações, por favor vá até <a href=\"http://www.clipperz.com\" target=\"_blank\">Clipperz</a> website.</p> ",
77 'splashAlertCloseButtonLabel':"Ok",
78 'registrationFormTitle':"crie sua conta",
79 'registrationFormUsernameLabel':"nome do usuário",
80 'registrationFormPassphraseLabel':"frase chave",
81 'registrationFormRetypePassphraseLabel':"entre novamente sua frase chave",
82 'registrationFormSafetyCheckLabel':"Eu compreendo que Clipperz não será capaz de recuperar senhas perdidas.",
83 'registrationFormTermsOfServiceCheckLabel':"Eu li e concordo com os <a href='http://www.clipperz.com/terms_of_service' target='_blank'>Termos do Serviço</a>.",
84 'registrationFormDoYouAlreadyHaveAnAccountLabel':"você já tem uma conta?",
85 'registrationFormSimplyLoginLabel':"login simples",
86 'registrationFormButtonLabel':"Registrar",
87 'registrationFormWarningMessageNotMatchingPassphrases':"Suas frases chaves não conferem, por favor tente novamente.",
88 'registrationFormWarningMessageSafetyCheckNotSelected':"Por favor leia e confira todos os campos abaixo.",
89 'registrationFormWarningMessageTermsOfServiceCheckNotSelected':"Você precisa concordar com os Termos do Serviço.",
90 'registrationMessagePanelInitialTitle':"Criando conta ...",
91 'registrationMessagePanelInitialText':"---",
92 'registrationMessagePanelInitialButtonLabel':"Cancelar",
93 'registrationMessagePanelRegistrationDoneTitle':"Registro",
94 'registrationMessagePanelRegistrationDoneText':"Concluído",
95 'registrationMessagePanelFailureTitle':"Registrou falhou",
96 'registrationMessagePanelFailureButtonLabel':"Fechar",
97 'connectionRegistrationSendingRequestMessageText':"Verificando credenciais",
98 'connectionRegistrationSendingCredentialsMessageText':"Enviando credenciais",
99 'registrationSplashPanelTitle':"Informe de segurança",
100 'registrationSplashPanelDescription':"<p>Essas são suas credenciais Clipperz, cuide delas com cuidado. Clipperz nunca vai mostrar seu nome de usuário e frase chave uma outra vez!</p> ",
101 'registrationSplashPanelUsernameLabel':"nome de usuário",
102 'registrationSplashPanelPassphraseLabel':"frase chave",
103 'registrationSplashPanelShowPassphraseButtonLabel':"mostrar frase chave",
104 'donateHeaderLinkLabel':"doar",
105 'creditsHeaderLinkLabel':"créditos",
106 'feedbackHeaderLinkLabel':"feedback",
107 'helpHeaderLinkLabel':"ajuda",
108 'forumHeaderLinkLabel':"fórum",
109 'recordMenuLabel':"cartões",
110 'accountMenuLabel':"conta",
111 'dataMenuLabel':"dados",
112 'contactsMenuLabel':"contatos",
113 'toolsMenuLabel':"ferramentas",
114 'logoutMenuLabel':"sair",
115 'lockMenuLabel':"bloquear",
116 'lockTitle':"A conta está bloqueada",
117 'lockDescription':"<p>Para desbloquear sua conta, por favor, entre com a frase chave</p> ",
118 'unlockButtonLabel':"desbloquear",
119 'changePasswordTabLabel':"Alterar sua frase chave",
120 'changePasswordTabTitle':"Alterar sua frase chave",
121 'changePasswordFormUsernameLabel':"nome de usuário",
122 'changePasswordFormOldPassphraseLabel':"frase chave antiga",
123 'changePasswordFormNewPassphraseLabel':"frase chave nova",
124 'changePasswordFormRetypePassphraseLabel':"re-inserir frase chave nova",
125 'changePasswordFormSafetyCheckboxLabel':"Eu compreendo que Clipperz não poderá recuperar a frase chave perdida.",
126 'changePasswordFormSubmitLabel':"Alterar frase chave",
127 'changePasswordFormWrongUsernameWarning':"Nome de usuário errado",
128 'changePasswordFormWrongPassphraseWarning':"Frase chave errada",
129 'changePasswordFormWrongRetypePassphraseWarning':"Suas frases chaves não conferem, por favor tente novamente.",
130 'changePasswordFormSafetyCheckWarning':"Por favor leia e confira todos os campos abaixo.",
131 'changePasswordFormProgressDialogTitle':"Alterando credenciais do usuário",
132 'changePasswordFormProgressDialogConnectedMessageTitle':"Conectado",
133 'changePasswordFormProgressDialogConnectedMessageText':"Concluído",
134 'changePasswordFormProgressDialogErrorMessageTitle':"Erro",
135 'changePasswordFormProgressDialogErrorMessageText':"Mudança de credenciais falhou!",
136 'changeCredentialsPanelEncryptingDataMessageTitle':"Alterando sua frase chave",
137 'changeCredentialsPanelEncryptingDataMessageText':"Codificação local de cabeçalho de cartões",
138 'changeCredentialsPanelCreatingNewCredentialsMessageTitle':"Alterando sua frase chave",
139 'changeCredentialsPanelCreatingNewCredentialsMessageText':"Atualizando suas credenciais",
140 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageTitle':"Alterando sua frase chave",
141 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageText':"Enviando suas credenciais codificadas para Clipperz",
142 'changeCredentialsPanelDoneMessageTitle':"Alterando sua frase chave",
143 'changeCredentialsPanelDoneMessageText':"Concluído",
144 'manageOTPTabLabel':"Gerenciar suas frases chaves descartáveis",
145 'manageOTPTabTitle':"Gerenciar suas frases chaves descartáveis",
146 'manageOTPTabDescription':"<p>Uma frase chave descartável funciona como uma frase chave normal, mas só pode ser utilizada uma única vez.</p> <p>Se a mesma frase chave for utilizada novamente num próximo login, ela será rejeitada e o login não irá ocorrer.</p> <p>Imediatamente após um login com sucesso, sua frase chave descartável será apagada para evitar logins fraudulentos.</p> <p>Frases chaves descartáveis são uma excelente opção se você está preocupado com keyloggers ou spywares que podem estar coletando seus dados em determinadas máquinas.</p> <p> <b>É recomendável que você utilize frases chaves descartáveis sempre que utilizar terminais públicos como Internet cafés e bibliotecas.</b> </p> ",
147 'oneTimePasswordReadOnlyMessage':"<h6>Desculpe!</h6> <p>Você não pode gerenciar sua frase chave descartável quando usando a versão offline do Clipperz.</p> ",
148 'oneTimePasswordLoadingMessage':"<h6>Carregando informação</h6> <p>Por favor, aguarde ...</p> ",
149 'oneTimePasswordNoPasswordAvailable':"<h6>Nenhuma frase chave descartável disponível</h6> <p>Clique o botão “Novo” acima para adicionar uma frase chave descartável em sua conta.</p> ",
150 'createNewOTPButtonLabel':"Novo",
151 'deleteOTPButtonLabel':"Apagar",
152 'printOTPButtonLabel':"Imprimir",
153 'disabledOneTimePassword_warning':"desativada",
154 'oneTimePasswordSelectionLink_selectLabel':"Selecionar:",
155 'oneTimePasswordSelectionLink_all':"tudo",
156 'oneTimePasswordSelectionLink_none':"nenhum",
157 'oneTimePasswordSelectionLink_used':"usado",
158 'oneTimePasswordSelectionLink_unused':"não usado",
159 'saveOTP_encryptUserDataTitle':"Salvando a frase chave descartável",
160 'saveOTP_encryptUserDataText':"Processando novas credenciais descartáveis ...",
161 'saveOTP_encryptOTPDataTitle':"Salvando a frase chave descartável",
162 'saveOTP_encryptOTPDataText':"Codificação local da informação de autenticação ...",
163 'saveOTP_sendingDataTitle':"Salvando a frase chave descartável",
164 'saveOTP_sendingDataText':"Enviando informação de autenticação para o servidor ...",
165 'saveOTP_updatingInterfaceTitle':"Salvando a frase chave descartável",
166 'saveOTP_updatingInterfaceText':"Atualizando interface ...",
167 'accountPreferencesLabel':"Preferências",
168 'accountPreferencesTabTitle':"Preferências",
169 'accountPreferencesLanguageTitle':"Seleção de idioma",
170 'accountPreferencesLanguageDescription':"<p>Escolha seu idioma preferido da lista abaixo.</p> ",
171 'showDonationReminderPanelTitle':"Lembretes de doação",
172 'showDonationReminderPanelDescription':"<p>Mostrar lembretes de doação</p> ",
173 'saveUserPreferencesFormSubmitLabel':"Salvar",
174 'cancelUserPreferencesFormSubmitLabel':"Cancelar",
175 'accountPreferencesSavingPanelTitle_Step1':"Salvando preferências",
176 'accountPreferencesSavingPanelText_Step1':"Codificação local de suas preferências",
177 'accountPreferencesSavingPanelTitle_Step2':"Salvando preferências",
178 'accountPreferencesSavingPanelText_Step2':"Enviando informação codificada para o servidor",
179 'accountLoginHistoryLabel':"Histórico de conexão",
180 'loginHistoryTabTitle':"Histórico de conexão",
181 'loginHistoryReadOnlyMessage':"<h6>Desculpe!</h6> <p>Seu histórico de conexão não está disponível quando usando uma versão offline do Clipperz.</p> ",
182 'loginHistoryLoadingMessage':"<h6>Carregando informação</h6> <p>Por favor, aguarde ...</p> ",
183 'loginHistoryLoadedMessageConfig':"<h6>Suas 10 últimas conexões</h6> <p> </p> ",
184 'loginHistoryIPLabel':"IP",
185 'loginHistoryTimeLabel':"data",
186 'loginHistoryCurrentSessionText':"sessão atual",
187 'loginHistoryReloadButtonLabel':"Recarregar histórico de conexão",
188 'deleteAccountTabLabel':"Apagar sua conta",
189 'deleteAccountTabTitle':"Apagar sua conta",
190 'deleteAccountFormUsernameLabel':"nome de usuário",
191 'deleteAccountFormPassphraseLabel':"frase chave",
192 'deleteAccountFormSafetyCheckboxLabel':"Eu compreendo que toda minha informação será apagada e que esta ação é irreversível.",
193 'deleteAccountFormSubmitLabel':"Apagar minha conta",
194 'deleteAccountFormWrongUsernameWarning':"Nome de usuário errado",
195 'deleteAccountFormWrongPassphraseWarning':"Frase chave errada",
196 'deleteAccountFormSafetyCheckWarning':"Por favor leia e confira os campos abaixo.",
197 'accountPanelDeletingAccountPanelConfirmationTitle':"ATENÇÃO",
198 'accountPanelDeleteAccountPanelConfirmationText':"Você tem certeza que quer apagar esta conta?",
199 'accountPanelDeleteAccountPanelConfirmButtonLabel':"Sim",
200 'accountPanelDeleteAccountPanelDenyButtonLabel':"Não",
201 'offlineCopyTabLabel':"Cópia offline",
202 'offlineCopyTabTitle':"Cópia offline",
203 'offlineCopyTabDescription':"<p>Com apenas um click você pode passar toda sua informação codificada dos servidores Clipperz para seu hard disk e criar uma versão read-only offline do Clipperz para ser utilizada quando você não estiver conectado na Internet.</p> <p>Essa versão read-only é tão segura quanto a versão online e não vai expor suas informações a riscos maiores já que ambas tem a mesma arquitetura de código e segurança.</p> <ol> <li> <p>Clique no link abaixo para iniciar o download.</p> </li> <li> <p>O navegador vai perguntar o que fazer com o arquivo “Clipperz_YYYYMMDD.html”. Grave-o em seu hard disk.</p> </li> <li> <p>Clique duas vezes no arquivo baixado para abrir a versão offline em seu navegador.</p> </li> <li> <p>Entre sua frase chave e nome de usuário como sempre faz.</p> </li> </ol> ",
204 'offlineCopyDownloadLinkLabel':"Baixar",
205 'offlineCopyDownloadWarningConfig':"<h4> <a href=\"#\" id=\"offlineCopyDownloadWarningLink\">Atualize sua “cópia offline”!</a> </h4> <p>Vocie recentemente criou ou modificou um ou mais cartões, seria inteligente baixar uma nova “cópia offline”.</p> ",
206 'sharingTabLabel':"Compartilhar",
207 'sharingTabTitle':"Compartilhar",
208 'sharingTabDescriptionConfig':"<p>Frequentemente uma informação confidencial precisa ser compartilhada com uma ou mais pessoas.</p> <p>Isso pode ser tão simples quanto permitir o acesso de seus colegas ao seu voice mail quando você está fora do escritório, ou tão complicado quanto permitir que seus herdeiros acessem seu caixa num banco quando você morrer.</p> <p>Clipperz pode fazer o processo de compartilhamento simples e seguro.</p> <p> </p> <p> <b>Em breve ...</b> </p> ",
209 'importTabLabel':"Importar",
210 'importTabTitle':"Importar",
211 'importTabDescription':"<p> <b>Em breve ...</b> <p> ",
212 'printingTabLabel':"Exportar",
213 'printingTabTitle':"Exportar",
214 'printingTabDescription':"<p> <b>Versão para impressão</b> </p> <p>Clicando no link abaixo você abre uma nova janela contendo todos os seus cartões em formato de impressão.</p> <p>Se você vai impriir para backup, considere a opção mais segura criando uma “cópia offline”.</p> ",
215 'printingLinkLabel':"Versão para impressão",
216 'contactsTabLabel':"Contatos",
217 'contactsTabTitle':"Contatos",
218 'passwordGeneratorTabLabel':"Gerador de senhas",
219 'passwordGeneratorTabTitle':"Gerador de senhas",
220 'passwordGeneratorTabButtonLabel':"Gerar senha",
221 'bookmarkletTabLabel':"Bookmarklet",
222 'bookmarkletTabTitle':"Bookmarklet",
223 'bookmarkletTabDescription':"<p>Um bookmarklet é uma ferramenta “one-click” que pode executar diversas tarefas úteis. Pode ser salva e utilizada como uma página web preferida normal.</p> <p>Os bookmarklet Clipperz vão ajudar você a a rapidamente criar novos cartões e novos logins diretos a partir dos cartões existentes.</p> <p> <b>Por favor, note que o bookmarklet não inclui nenhuma informação relacionada à sua conta (e.g. seu nome de usuário ou frase chave), o bookmarklet é um ferramenta contendo o mesmo código para todos ois usuários Clipperz.</b> </p> <h3>Como instalar o bookmarlet</h3> <h5>Firefox, Camino, Opera, Safari</h5> <ol> <li> <p>Assegure-se que a “Barra de Bookmarks” está visível, selecionando “View > Toolbars > Bookmarks”, ou menu similar no menu do navegador</p> </li> <li> <p>Arraste o link “Adicionar ao Clipperz” abaixo para a barra de bookmark.</p> </li> </ol> <h5>Internet Explorer</h5> <ol> <li> <p>Assegure-se que o barra de “Links” está visível selecionando “View > Toolbar > Links” no menu do navegador.</p> </li> <li> <p>Clique com o botão direito no link “Adicionar ao Clipperz” abaixo.</p> </li> <li> <p>Select “Selecione “Add to favorites” no menu contextual.</p> </li> <li> <p>Clique “Yes” para qualquer mensagem de segurança que surgir em pop-up.</p> </li> <li> <p>Abra o folder “Links” e clique “OK”.</p> </li> </ol> ",
224 'bookmarkletTabBookmarkletTitle':"Adicionar ao Clipperz",
225 'bookmarkletTabInstructions':"<h3>Como criar um novo cartão para acessar diretamente um serviço online</h3> <ol> <li> <p>Abra a página web onde o formulário de login está. (é a página onde você usualmente entra com suas credenciais)</p> </li> <li> <p>Dispare a preferência clicando nela: um pop-up vai aparecer sobre a página.</p> </li> <li> <p>Copie para o clipboard o conteúdo da área de texto do pop-up. (ctrl-C)</p> </li> <li> <p>Entre em sua conta Clipperz e clique no botão <b>Adicionar novo cartão</b>.</p> </li> <li> <p>Selecione o template de \"Login Direto\" e cole o conteúdo do clipboard para a grande área de texto do formulário. (ctrl-V)</p> </li> <li> <p>Pressione o botão <b>Criar</b>, reveja os detalhes e clique <b>Save</b>.</p> </li> </ol> <h3>Como adicionar login direto a um cartão existente</h3> <ol> <li> <p>Idem acima.</p> </li> <li> <p>Idem acima.</p> </li> <li> <p>Idem acima.</p> </li> <li> <p>Entre em sua conta Clipperz e selecione o cartão contendo as credenciais para o serviço web que você visitou e clique no botão <b>Editar</b>.</p> </li> <li> <p>Cole o conteúdo do clipboard para a grande área de texto da sessão “Logins diretos”. (ctrl-V)</p> </li> <li> <p>Pressione o botão <b>Adicionar login direto</b>, reveja os detalhes e clique <b>Salvar</b>.</p> </li> </ol> <p> </p> <p>Mais informações sobre as preferências estão <a href=\"http://www.clipperz.com/support/user_guide/bookmarklet\" target=\"_blank\">disponíveis aqui</a>.</p> ",
226 'mainPanelDirectLoginBlockLabel':"Logins diretos",
227 'directLinkReferenceShowButtonLabel':"mostrar",
228 'mainPanelDirectLoginBlockDescription':"<p>Adicionar “logins diretos” para entrar em páginas web sem ter que digitar nome de usuário e senhas!</p> <p>“Logins diretos” ampliam a segurança de sus senha já que você pode:</p> <ul> <li> <p>utilizar senhas mais complexas;</p> </li> <li> <p>nunca re-utilizar a mesma senha fácil-de-lembrar.</p> </li> </ul> <p>Configuração simples e rápida com os <b>bookmarklet</b> Clipperz.</p> <a href=\"http://www.clipperz.com/support/user_guide/direct_logins\" target=\"_blank\">Saiba mais sobre “logins diretos”</a> ",
229 'mainPanelRecordsBlockLabel':"Cartões",
230 'mainPanelAddRecordButtonLabel':"Adicionar novo cartão",
231 'mainPanelRemoveRecordButtonLabel':"Apagar cartão",
232 'mainPanelRecordFilterBlockAllLabel':"todos",
233 'mainPanelRecordFilterBlockTagsLabel':"tags",
234 'mainPanelRecordFilterBlockSearchLabel':"buscar",
235 'recordDetailNoRecordAtAllTitle':"Bem-vindo ao Clipperz!",
236 'recordDetailNoRecordAtAllDescription':"<h5>Inicie criando cartões para sua conta.</h5> <p>Cartões são formulários simples e flexíveis onde você guarda senhas e outras informações confidenciais.</p> <p>Cartões podem conter credenciais de login a sites, a combinação do seu cadeado da bicicleta, detalhes do seu cartão de crédito, ...</p> <h5>Não esqueça o bookmarklet</h5> <p>Antes de começar, instale o bookmarklet “Adicionar ao Clipperz”: ele vai tornar o processo de criar cartões mais fácil e divertido.</p> <p> </p> <p>Depois, apenas click no botão <b>Adicionar novo cartão</b> e aproveite sua conta Clipperz.</p> <p> </p> <a href=\"http://www.clipperz.com/support/user_guide/managing_cards\" target=\"_blank\">Saiba mais sobre criar e gerenciar cartões</a> ",
237 'newRecordWizardTitleBox':"<h5>Por favor selecione um template</h5> <p>Cartões são formulários simples e flexíveis onde você pode arquivar suas senhas ou outras informações confidenciais.</p> <p>Comece escolhendo um dos templates abaixo. Você poderá customizar seus cartões mais tarde, adicionando e removendo campos.</p> ",
238 'newRecordWizardBookmarkletConfigurationTitle':"Login direto",
239 'newRecordWizardBookmarkletConfigurationDescription':"<p>Coloque abaixo o código de configuração gerado pelo bookmarklet Clipperz.</p> <p>Um novo cartão completo com login direto para sua conta web será criado.</p> ",
240 'newRecordWizardCreateButtonLabel':"Criar",
241 'newRecordWizardCancelButtonLabel':"Cancelar",
242 'donateSplashPanelTitle':"Apoie Clipperz, faça uma doação hoje!",
243 'donateSplashPanelDescription':"<p>Algumas boas razões para doar:</p> <ul> <li> <p>apoie o desenvolvimento de novas funcionalidades</p> </li> <li> <p>mantenha Clipperz gratuito</p> </li> <li> <p>mostrar apreciação por trabalho duro</p> </li> </ul> <p>Para qualquer informação adicional, por favor visite nossa <a href=\"http://www.clipperz.com/donations\" target=\"_blank\">página de Doações</a>.</p> <p> <b>Pronto para doar?</b> </p> ",
244 'donateCloseButtonLabel':"Não ainda",
245 'donateDonateButtonLabel':"Sim",
246 'recordTemplates':{
247 'WebAccount':{
248 'title':"Senha web",
249 'description':"<p>Um cartão simples para arquivar credenciais de login para seus serviços online.</p> ",
250 'fields':{
251 'URL':"Endereço web",
252 'TXT':"Nome de usuário ou email",
253 'PWD':"Senha"
254 }
255 },
256 'BankAccount':{
257 'title':"Conta bancária",
258 'description':"<p>Arquive com segurança o número de sua conta corrente e suas credenciais de online banking.</p> ",
259 'fields':{
260 'TXT':"Banco",
261 'TXT':"Número da conta",
262 'URL':"Website do banco",
263 'TXT':"ID de online banking",
264 'PWD':"Senha de online banking"
265 }
266 },
267 'CreditCard':{
268 'title':"Cartão de crédito",
269 'description':"<p>Número do cartão, validade, CVV2 e PIN sempre disponíveis no Clipperz</p> ",
270 'fields':{
271 'TXT':"Tipo (Visa, AmEx, ...)",
272 'TXT':"Número",
273 'TXT':"Nome do proprietário",
274 'TXT':"Prazo de validade",
275 'TXT':"CVV2",
276 'PWD':"PIN",
277 'URL':"Website do cartão",
278 'TXT':"Nome do usuário",
279 'PWD':"Senha"
280 }
281 },
282 'AddressBookEntry':{
283 'title':"Agenda de endereços",
284 'description':"<p>Clipperz pode também funcionar como sua agenda de endereços particular. Use esse template para facilmente adicionar novas entradas.</p> ",
285 'fields':{
286 'TXT':"Nome",
287 'TXT':"Email",
288 'TXT':"Fone",
289 'TXT':"Mobile",
290 'ADDR':"Endereço"
291 }
292 },
293 'Custom':{
294 'title':"Cartão customizado",
295 'description':"<p>Não importa o tipo de informação confidencial você precisa proteger, crie um cartão customizado para sua necessidade.</p> ",
296 'fields':{
297 'TXT':"Label 1",
298 'TXT':"Label 2",
299 'TXT':"Label 3"
300 }
301 }
302},
303 'recordFieldTypologies':{
304 'TXT':{
305 'description':"simple text field",
306 'shortDescription':"texto"
307 },
308 'PWD':{
309 'description':"simple text field, with default status set to hidden",
310 'shortDescription':"senha"
311 },
312 'URL':{
313 'description':"simple text field in edit mode, that became an active url in view mode",
314 'shortDescription':"endereço web"
315 },
316 'DATE':{
317 'description':"a value set with a calendar helper",
318 'shortDescription':"data"
319 },
320 'ADDR':{
321 'description':"just like the URL, but the active link points to Google Maps (or similar service) passing the address value as argument",
322 'shortDescription':"endereço"
323 },
324 'CHECK':{
325 'description':"check description",
326 'shortDescription':"check"
327 },
328 'RADIO':{
329 'description':"radio description",
330 'shortDescription':"radio"
331 },
332 'SELECT':{
333 'description':"select description",
334 'shortDescription':"select"
335 }
336},
337 'newRecordPanelGeneralExceptionTitle':"Erro",
338 'newRecordPanelGeneralExceptionMessage':"O texto de configuração não é válido. Certifique-se do texto no pop-up de bookmarklet e tente novamente.",
339 'newRecordPanelWrongBookmarkletVersionExceptionTitle':"Erro",
340 'newRecordPanelWrongBookmarkletVersionExceptionMessage':"O texto de configuração foi gerado por uma velha versão de bookmarklet. Por favor, atualize seus preferidos e tente novamente.",
341 'newRecordPanelExceptionPanelCloseButtonLabel':"Cancelar",
342 'mainPanelDeletingRecordPanelConfirmationTitle':"Apagando o cartão selecionado",
343 'mainPanelDeleteRecordPanelConfirmationText':"Você quer mesmo apagar o cartão selecionado?",
344 'mainPanelDeleteRecordPanelConfirmButtonLabel':"Sim",
345 'mainPanelDeleteRecordPanelDenyButtonLabel':"Não",
346 'mainPanelDeletingRecordPanelInitialTitle':"Apagando o cartão selecionado",
347 'mainPanelDeletingRecordPanelCompletedText':"Concluído",
348 'deleteRecordPanelCollectRecordDataMessageTitle':"Apagar cartão",
349 'deleteRecordPanelCollectRecordDataMessageText':"Atualizando lista de cartões",
350 'deleteRecordPanelEncryptUserDataMessageTitle':"Apagar cartão",
351 'deleteRecordPanelEncryptUserDataMessageText':"Codificação local de cabeçalhos de cartão",
352 'deleteRecordPanelSendingDataToTheServerMessageTitle':"Apagar cartão",
353 'deleteRecordPanelSendingDataToTheServerMessageText':"Enviando os cabeçalhos de cartão codificados para Clipperz",
354 'deleteRecordPanelUpdatingTheInterfaceMessageTitle':"Apagar cartão",
355 'deleteRecordPanelUpdatingTheInterfaceMessageText':"Atualizando a interface",
356 'recordDetailNoRecordSelectedTitle':"Nenhum cartão selecionado",
357 'recordDetailNoRecordSelectedDescription':"<p>Por favor selecione um cartão da lista na esquerda.</p> ",
358 'recordDetailLoadingRecordMessage':"Baixando cartão codificados do Clipperz",
359 'recordDetailDecryptingRecordMessage':"Descrição local dos dados do cartão",
360 'recordDetailLoadingRecordVersionMessage':"Baixando a versão mais recente do cartão",
361 'recordDetailDecryptingRecordVersionMessage':"Descrição local da versão mais recente",
362 'recordDetailLoadingErrorMessageTitle':"Erro enquanto baixando o cartão",
363 'recordDetailNotesLabel':"Notas",
364 'recordDetailLabelFieldColumnLabel':"Legenda do campo",
365 'recordDetailDataFieldColumnLabel':"Dados do campo",
366 'recordDetailTypeFieldColumnLabel':"Tipo",
367 'recordDetailSavingChangesMessagePanelInitialTitle':"Salvando cartão",
368 'recordDetailAddFieldButtonLabel':"Adicionar novo campo",
369 'recordDetailPasswordFieldHelpLabel':"para copiar a senha para o clipboard clique nas estrelas e em seguida Ctrl-C",
370 'recordDetailPasswordFieldScrambleLabel':"misturar",
371 'recordDetailPasswordFieldUnscrambleLabel':"mostrar",
372 'recordDetailDirectLoginBlockTitle':"Logins diretos",
373 'recordDetailNewDirectLoginDescription':"<p>Configuração de login direto</p> ",
374 'recordDetailDirectLoginBlockNoDirectLoginConfiguredDescriptionConfig':"<p>Este cartão contém credenciais para acessar um serviço online?</p> <p>Use o bookmarklet para configurar um “login direto” desde o Clipperz com apenas um click!</p> ",
375 'recordDetailAddNewDirectLoginButtonLabel':"Adicionar novo login direto",
376 'recordDetailEditButtonLabel':"Editar",
377 'recordDetailSaveButtonLabel':"Salvar",
378 'recordDetailCancelButtonLabel':"Cancelar",
379 'newRecordTitleLabel':"_novo cartão_",
380 'recordSaveChangesPanelCollectRecordInfoMessageTitle':"Salvar cartão",
381 'recordSaveChangesPanelCollectRecordInfoMessageText':"Subindo cabeçalhos de cartão",
382 'recordSaveChangesPanelEncryptUserDataMessageTitle':"Salvar cartão",
383 'recordSaveChangesPanelEncryptUserDataMessageText':"Codificação local do cabeçalho do cartão",
384 'recordSaveChangesPanelEncryptRecordDataMessageTitle':"Salvar cartão",
385 'recordSaveChangesPanelEncryptRecordDataMessageText':"Codificação local da informação do cartão",
386 'recordSaveChangesPanelEncryptRecordVersionDataMessageTitle':"Salvar cartão",
387 'recordSaveChangesPanelEncryptRecordVersionDataMessageText':"Codificação local da informação de versão do cartão",
388 'recordSaveChangesPanelSendingDataToTheServerMessageTitle':"Salvar cartão",
389 'recordSaveChangesPanelSendingDataToTheServerMessageText':"Subindo o cabeçalho do cartão codificado para Clipperz",
390 'recordSaveChangesPanelUpdatingTheInterfaceMessageTitle':"Salvar cartão",
391 'recordSaveChangesPanelUpdatingTheInterfaceMessageText':"Atualizando a interface",
392 'passwordGeneratorPanelTitle':"Gerador de senhas",
393 'passwordGeneratorPanelOkLabel':"Ok",
394 'passwordGeneratorPanelCancelLabel':"Cancelar",
395 'passwordGeneratorLengthLabel':"compr.:",
396 //'DWRUtilLoadingMessage':"Carregando ...",
397 'comingSoon':"em breve ...",
398 'panelCollectingEntryopyMessageText':"Coletando entropia",
399 'directLoginConfigurationCheckBoxFieldSelectedValue':"Sim",
400 'directLoginConfigurationCheckBoxFieldNotSelectedValue':"Não",
401 'WELCOME_BACK':"Welcome back!",
402 'currentConnectionText':"Você está conectado do ip&nbsp;__ip__, aparentemente desde __country__, usando __browser__ num __operatingSystem__.",
403 'latestConnectionText':"Sua úlitima conexão foi __elapsedTimeDescription__ (__time__) do ip&nbsp;__ip__, aparentemente desde __country__, usando __browser__ num __operatingSystem__.",
404 'fullLoginHistoryLinkLabel':"mostrar o histórico de logins completos",
405 'elapsedTimeDescriptions':{
406 'MORE_THAN_A_MONTH_AGO':"mais de um mês atrás",
407 'MORE_THAN_A_WEEK_AGO':"mais de uma semana atrás",
408 'MORE_THAN_*_WEEKS_AGO':"mais de __elapsed__ semanas atrás",
409 'YESTERDAY':"ontem",
410 '*_DAYS_AGO':"__elapsed__ dias atrás",
411 'ABOUT_AN_HOUR_AGO':"cerca de uma hora atrás",
412 '*_HOURS_AGO':"__elapsed__ horas atrás",
413 'JUST_A_FEW_MINUTES_AGO':"apenas alguns minutos atrás",
414 'ABOUT_*_MINUTES_AGO':"cerca de __elapsed__ minutos atrás"
415},
416 'unknown_ip':"desconhecido",
417 'calendarStrings':{
418 'months':{
419 '0':"Janeiro",
420 '1':"Fevereiro",
421 '2':"Março",
422 '3':"Abril",
423 '4':"Maio",
424 '5':"Junho",
425 '6':"Julho",
426 '7':"Agosto",
427 '8':"Setembro",
428 '9':"Outubro",
429 '10':"Novembro",
430 '11':"Dezembro"
431 },
432 'shortMonths':{
433 '0':"Jan",
434 '1':"Fev",
435 '2':"Mar",
436 '3':"Abr",
437 '4':"Mai",
438 '5':"Jun",
439 '6':"Jul",
440 '7':"Ago",
441 '8':"Set",
442 '9':"Out",
443 '10':"Nov",
444 '11':"Dez"
445 },
446 'days':{
447 '0':"Domingo",
448 '1':"Segunda-feira",
449 '2':"Terça-feira",
450 '3':"Quarta-feira",
451 '4':"Quinta-feira",
452 '5':"Sexta-feira",
453 '6':"Sábado"
454 },
455 'shortDays':{
456 '0':"Dom",
457 '1':"Seg",
458 '2':"Ter",
459 '3':"Qua",
460 '4':"Quin",
461 '5':"Sex",
462 '6':"Sab"
463 },
464 'veryShortDays':{
465 '0':"Do",
466 '1':"Se",
467 '2':"Te",
468 '3':"Qa",
469 '4':"Qi",
470 '5':"Se",
471 '6':"Sa"
472 },
473 'amDesignation':"am",
474 'pmDesignation':"pm"
475},
476
477__syntaxFix__: "syntax fix"
478});
diff --git a/frontend/beta/js/Clipperz/PM/Strings/Strings_pt-PT.js b/frontend/beta/js/Clipperz/PM/Strings/Strings_pt-PT.js
new file mode 100644
index 0000000..5284683
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Strings/Strings_pt-PT.js
@@ -0,0 +1,42 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29//=============================================================================
30//
31 // P O R T U G U Ê S ( pt_PT )
32//
33//=============================================================================
34
35Clipperz.PM.Strings.Languages['pt-pt'] = MochiKit.Base.merge(Clipperz.PM.Strings.Languages['pt-br'], {
36
37
38
39 //-------------------------------------------------------------------------
40 __syntaxFix__: "syntax fix"
41});
42
diff --git a/frontend/beta/js/Clipperz/PM/Strings/Strings_ru-RU.js b/frontend/beta/js/Clipperz/PM/Strings/Strings_ru-RU.js
new file mode 100644
index 0000000..41c904f
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Strings/Strings_ru-RU.js
@@ -0,0 +1,440 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29Clipperz.PM.Strings.Languages['ru-RU'.toLowerCase()] = MochiKit.Base.merge(Clipperz.PM.Strings.Languages['en-us'], {
30 'clipperzServiceDescription':"<h2>Держи при себе!</h2> <ul> <li> <h3>Clipperz - это:</h3> <ul> <li> <p>безопасный и простой менеджер паролей</p> </li> <li> <p>эффективное решение для единой регистрации</p> </li> <li> <p>цифровое хранилище Ваших конфидециальных данных</p> </li> </ul> </li> <li>
31 <h3>C помошью Clipperz Вы можете:</h3> <ul>
32 <li> <p>хранить и управлять Вашими паролями</p> </li> <li> <p>входить в любые веб-сервисы без ввода логина и пароля</p> </li> <li> <p>защитить все важные данные: коды охранной сигнализации, ПИНы, номера кредитных кард, ...</p> </li> <li> <p>открыть доступ Вашим членам семьи, друзьям, коллегам</p> </li> </ul> </li> <li>
33 <h3>Преимущества Clipperz:</h3> <ul>
34 <li> <p>бесплатный и абсолютно анонимный</p> </li> <li> <p>доступен в любое время и с любого компьютера</p> </li> <li> <p>не нужно ничего устанавливать</p> </li> <li> <p>не надо хранить секреты на компьютере или бумаге</p> </li> </ul> </li> <li>
35 <h3>Безопасность Clipperz:</h3> <ul>
36 <li> <p>все данные перед отправкой в Clipperz шифруются в браузере</p> </li> <li> <p>секретный ключ - это фраза, которую знаете только Вы</p> </li> <li> <p>Clipperz управляет важными данными в зашифрованном виде и никогда не получит доступ к ним в открытом виде</p> </li> <li> <p>Clipperz основан на стандартных криптографических протоколах: без каких-либо самоделок</p> </li> <li> <p>Вы можете просмотреть исходный код, но Вам ничего не надо знать о криптографии, чтобы быть просто пользоваться</p> </li> </ul> </li> <li>
37 <a href=\"http://www.clipperz.com\" target=\"_blank\">Подробнее</a> </li> </ul> ",
38 'loginFormTitle':"войти под Вашим аккаунтом Clipperz",
39 'loginFormUsernameLabel':"имя пользователя",
40 'loginFormPassphraseLabel':"ключевая фраза",
41 'loginFormDontHaveAnAccountLabel':"у вас еще нет аккаунта?",
42 'loginFormCreateOneLabel':"создать",
43 'loginFormForgotYourCredentialsLabel':"забыли пароль?",
44 'loginFormAarghThatsBadLabel':"о! это плохо!",
45 'loginFormAfraidOfMaliciousScriptsLabel':"опасаетесь вредоносных скриптов?",
46 'loginFormVerifyTheCodeLabel':"проверить код",
47 'loginFormButtonLabel':"Войти",
48 'loginFormOneTimePasswordCheckboxLabel':"использовать одноразовую ключевую фразу",
49 'loginPanelSwithLanguageDescription':"<h5>Переключиться на Ваш язык</h5> ",
50 'browserCompatibilityDescription':"<p>Лучше работать с Clipperz в Firefox. Однако Clipperz хорошо совместим с Opera и MS Internet Explorer!</p> ",
51 'OTPloginMessagePanelInitialTitle':"Вход",
52 'OTPloginMessagePanelInitialText':"Передача данных учетной записи ...",
53 'OTPloginMessagePanelLoadingTitle':"Вход",
54 'OTPloginMessagePanelLoadingText':"Запрос аутентификационных данных с сервера ...",
55 'OTPloginMessagePanelProcessingTitle':"Вход",
56 'OTPloginMessagePanelProcessingText':"Расшифровка аутентификационных данных",
57 'loginMessagePanelInitialTitle':"Вход ...",
58 'loginMessagePanelInitialButtonLabel':"Отмена",
59 'loginMessagePanelConnectedTitle':"Соединен",
60 'loginMessagePanelConnectedText':"Выполнен",
61 'loginMessagePanelFailureTitle':"Ошибка",
62 'loginMessagePanelFailureText':"Ошибка при попытке входа",
63 'loginMessagePanelFailureButtonLabel':"Закрыть",
64 'connectionLoginSendingCredentialsMessageTitle':"Проверка учетной записи",
65 'connectionLoginSendingCredentialsMessageText':"Передача данных ...",
66 'connectionLoginCredentialsVerificationMessageTitle':"Проверка учетной записи",
67 'connectionLoginCredentialsVerificationMessageText':"Выполняем SRP-аутентификацию ...",
68 'connectionLoginDoneMessageTitle':"Проверка учетной записи",
69 'connectionLoginDoneMessageText':"Соединено",
70 'userLoginPanelUpgradingUserCredentialsMessageTitle':"Проверка учетной записи",
71 'userLoginPanelUpgradingUserCredentialsMessageText':"Обновляем полномочия к новой схеме аутентификации",
72 'userLoginPanelConnectedMessageTitle':"Пользователь аутентифицирован",
73 'userLoginPanelConnectedMessageText':"Успешный вход",
74 'userLoginPanelTryingAnOlderConnectionSchemaMessageTitle':"Проверка учетной записи",
75 'userLoginPanelTryingAnOlderConnectionSchemaMessageText':"Пробуем войти по старой схеме",
76 'userLoginPanelLoadingUserDataMessageTitle':"Пользователь аутентифицирован",
77 'userLoginPanelLoadingUserDataMessageText':"Загрузка зашифрованных заголовков карточек",
78 'userLoginPanelDecryptingUserDataMessageTitle':"Пользователь аутентифицирован",
79 'userLoginPanelDecryptingUserDataMessageText':"Расшифровка заголовков карточек",
80 'userLoginPanelDecryptingUserStatisticsMessageTitle':"Пользователь аутентифицирован",
81 'userLoginPanelDecryptingUserStatisticsMessageText':"Расшифровка статистики",
82 'splashAlertTitle':"Добро пожаловать в Clipperz!",
83 'splashAlertText':"<p>Несколько советов по безопасности:</p> <ul> <li> <p>Хранение данных в Clipperz зависит от того, насколько безопасна выбранная Вами ключевая фраза</p> </li> <li> <p>Если собираетесь использовать Clipperz для защиты важных или критических данных, то убедитесь, что выбрали сложный пароль</p> </li> <li> <p>Clipperz не может восстановить забытую ключевую фразу</p> </li> </ul> <p>За дополнительной информацией обратитесь на <a href=\"http://www.clipperz.com\" target=\"_blank\">сайт</a> Clipperz.</p> ",
84 'splashAlertCloseButtonLabel':"OK",
85 'registrationFormTitle':"создать аккаунт",
86 'registrationFormUsernameLabel':"имя пользователя",
87 'registrationFormPassphraseLabel':"ключевая фраза",
88 'registrationFormRetypePassphraseLabel':"повторите ключевую фразу",
89 'registrationFormSafetyCheckLabel':"Я понимаю, что Clipperz не может восстановить забытую ключевую фразу",
90 'registrationFormTermsOfServiceCheckLabel':"Я прочитал и согласен с <a href='http://www.clipperz.com/terms_of_service' target='_blank'>Условиями предоставления услуг</a>.",
91 'registrationFormDoYouAlreadyHaveAnAccountLabel':"у вас уже есть аккаунт?",
92 'registrationFormSimplyLoginLabel':"просто ввойдите",
93 'registrationFormButtonLabel':"Зарегистрировать",
94 'registrationFormWarningMessageNotMatchingPassphrases':"Ключевые фразы не совпадают, пожайлуста, повторите ввод",
95 'registrationFormWarningMessageSafetyCheckNotSelected':"Прочитайте и проверьте все поля ниже",
96 'registrationFormWarningMessageTermsOfServiceCheckNotSelected':"Вы должны принять Условия предоставления услуг",
97 'registrationMessagePanelInitialTitle':"Создание аккаунта",
98 'registrationMessagePanelInitialButtonLabel':"Отмена",
99 'registrationMessagePanelRegistrationDoneTitle':"Регистрация",
100 'registrationMessagePanelRegistrationDoneText':"Выполнено",
101 'registrationMessagePanelFailureTitle':"Ошибка регистрации",
102 'registrationMessagePanelFailureButtonLabel':"Закрыть",
103 'connectionRegistrationSendingRequestMessageText':"Проверка учетной записи",
104 'connectionRegistrationSendingCredentialsMessageText':"Передача данных",
105 'registrationSplashPanelTitle':"Совет",
106 'registrationSplashPanelDescription':"<p>Это Ваши данные учетной записи, позаботесь об их безопасности. Clipperz никогда больше не покажет Ваше имя пользователя и ключевую фразу!</p> ",
107 'registrationSplashPanelUsernameLabel':"имя пользователя",
108 'registrationSplashPanelPassphraseLabel':"ключевая фраза",
109 'registrationSplashPanelShowPassphraseButtonLabel':"показать ключевую фразу",
110 'donateHeaderLinkLabel':"пожертвования",
111 'creditsHeaderLinkLabel':"список разработчиков",
112 'feedbackHeaderLinkLabel':"обратная связь",
113 'helpHeaderLinkLabel':"помощь",
114 'forumHeaderLinkLabel':"форум",
115 'recordMenuLabel':"карточки",
116 'accountMenuLabel':"аккаунт",
117 'dataMenuLabel':"данные",
118 'contactsMenuLabel':"контакты",
119 'toolsMenuLabel':"инструменты",
120 'logoutMenuLabel':"выйти",
121 'lockMenuLabel':"заблокировать",
122 'lockTitle':"Аккаунт заблокирован",
123 'lockDescription':"<p>Введите ключевую фразу для разблокировки</p> ",
124 'unlockButtonLabel':"разблокировать",
125 'changePasswordTabLabel':"Изменить ключевую фразу",
126 'changePasswordTabTitle':"Изменить ключевую фразу",
127 'changePasswordFormUsernameLabel':"имя пользователя",
128 'changePasswordFormOldPassphraseLabel':"старая ключевая фраза",
129 'changePasswordFormNewPassphraseLabel':"новая ключевая фраза",
130 'changePasswordFormRetypePassphraseLabel':"повторить ключевую фразу",
131 'changePasswordFormSafetyCheckboxLabel':"Я понимаю, что Clipperz не может восстановить забытую ключевую фразу.",
132 'changePasswordFormSubmitLabel':"Изменить",
133 'changePasswordFormWrongUsernameWarning':"Неправильное имя пользователя",
134 'changePasswordFormWrongPassphraseWarning':"Неверная ключевая фраза",
135 'changePasswordFormWrongRetypePassphraseWarning':"Ключевые фразы не совпадают, пожайлуста, повторите ввод.",
136 'changePasswordFormSafetyCheckWarning':"Прочитайте и проверьте все поля ниже.",
137 'changePasswordFormProgressDialogTitle':"Изменение учетной записи",
138 'changePasswordFormProgressDialogConnectedMessageTitle':"Соединено",
139 'changePasswordFormProgressDialogConnectedMessageText':"Выполнено",
140 'changePasswordFormProgressDialogErrorMessageTitle':"Ошибка",
141 'changePasswordFormProgressDialogErrorMessageText':"Ошибка изменения учетной записи!",
142 'changeCredentialsPanelEncryptingDataMessageTitle':"Изменение ключевой фразы",
143 'changeCredentialsPanelEncryptingDataMessageText':"Шифрование заголовков карточек",
144 'changeCredentialsPanelCreatingNewCredentialsMessageTitle':"Изменение ключевой фразы",
145 'changeCredentialsPanelCreatingNewCredentialsMessageText':"Обновление учетной записи",
146 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageTitle':"Изменение ключевой фразы",
147 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageText':"Загрузка данных учетной записи в Clipperz",
148 'changeCredentialsPanelDoneMessageTitle':"Изменение ключевой фразы",
149 'changeCredentialsPanelDoneMessageText':"Выполнено",
150 'manageOTPTabLabel':"Управление одноразовыми ключевыми фразами",
151 'manageOTPTabTitle':"Управление одноразовыми ключевыми фразами",
152 'manageOTPTabDescription':"<p>Одноразовый пароль работает, как Ваша обычная ключевая фраза, но может быть использована только один раз.</p> <p>Если один и тот же пароль будет использоваться снова на следующих этапах, она будет отклонен и процедура входа завершится неудачно.</p> <p>Сразу после входа одноразовый пароль будет удален, чтобы предовратить любую несанкционированную попытку доступа.</p> <p>Одноразовые пароли - удачный выбор для тех, кто обеспокоен кейлоггерами или spyware, которые могут собирать информ.</p> <p> <b>Строго рекомендуется использовать одноразовые пароли для доступа к Clipperz с чужих компьютеров, из интернет-кафе и библиотек.</b> </p> ",
153 'oneTimePasswordReadOnlyMessage':"<h6>Извините!</h6> <p>Вы не можете управлять одноразовыми ключевыми фразами в оффлайновой версии Clipperz.</p> ",
154 'oneTimePasswordLoadingMessage':"<h6>Загрузка данных</h6> <p>Подождите, пожайлуста ...</p> ",
155 'oneTimePasswordNoPasswordAvailable':"<h6>Нет свободных для использования одноразовых ключевых фраз.</h6> <p>Нажмите кнопку “Новая”, чтобы добавить еще одноразовые ключевые фразы в аккаунт.</p> ",
156 'createNewOTPButtonLabel':"новая",
157 'deleteOTPButtonLabel':"удалить",
158 'printOTPButtonLabel':"печать",
159 'disabledOneTimePassword_warning':"запрещено",
160 'oneTimePasswordSelectionLink_selectLabel':"Выбрать:",
161 'oneTimePasswordSelectionLink_all':"все",
162 'oneTimePasswordSelectionLink_none':"ни одного",
163 'oneTimePasswordSelectionLink_used':"использованные",
164 'oneTimePasswordSelectionLink_unused':"неиспользованные",
165 'saveOTP_encryptUserDataTitle':"Сохранение одноразовых ключевых фраз",
166 'saveOTP_encryptUserDataText':"Обработка новых данных учетной записи ...",
167 'saveOTP_encryptOTPDataTitle':"одноразовыми ключевыми фразами",
168 'saveOTP_encryptOTPDataText':"Шифрование аутентификационных данных ...",
169 'saveOTP_sendingDataTitle':"одноразовыми ключевыми фразами",
170 'saveOTP_sendingDataText':"Передача аутентификационных данных на сервер ...",
171 'saveOTP_updatingInterfaceTitle':"одноразовыми ключевыми фразами",
172 'saveOTP_updatingInterfaceText':"Обновление интерфейса ...",
173 'accountPreferencesLabel':"Настройки",
174 'accountPreferencesTabTitle':"Настройки",
175 'accountPreferencesLanguageTitle':"Выбор языка",
176 'accountPreferencesLanguageDescription':"<p>Выберите Ваш язык из списка.</p> ",
177 'showDonationReminderPanelTitle':"Напоминания о пожертвованиях",
178 'showDonationReminderPanelDescription':"<p>Показать напоминания о пожертвованиях</p> ",
179 'saveUserPreferencesFormSubmitLabel':"Сохранить",
180 'cancelUserPreferencesFormSubmitLabel':"Отмена",
181 'accountPreferencesSavingPanelTitle_Step1':"Сохранение настроек",
182 'accountPreferencesSavingPanelText_Step1':"Шифрование настроек",
183 'accountPreferencesSavingPanelTitle_Step2':"Сохранение настроек",
184 'accountPreferencesSavingPanelText_Step2':"Передача зашифрованных настроек в Clipperz",
185 'accountLoginHistoryLabel':"История входов",
186 'loginHistoryTabTitle':"История входов",
187 'loginHistoryReadOnlyMessage':"<h6>Извините!</h6> <p>История входов не доступна в оффлайновой версии Clipperz.</p> ",
188 'loginHistoryLoadingMessage':"<h6>Загрузка данных</h6> <p>Подождите, пожайлуста ...</p> ",
189 'loginHistoryLoadedMessage':"<h6>Десять Ваших последних входов</h6> <p> </p> ",
190 'loginHistoryIPLabel':"IP",
191 'loginHistoryTimeLabel':"дата",
192 'loginHistoryCurrentSessionText':"текущая сессия",
193 'loginHistoryReloadButtonLabel':"Обновить историю",
194 'deleteAccountTabLabel':"Удалить аккаунт",
195 'deleteAccountTabTitle':"Удалить аккаунт",
196 'deleteAccountFormUsernameLabel':"имя пользователя",
197 'deleteAccountFormPassphraseLabel':"ключевая фраза",
198 'deleteAccountFormSafetyCheckboxLabel':"Я понимаю, что все мои данные будут удалены и это действие необратимо.",
199 'deleteAccountFormSubmitLabel':"Удалить мой аккаунт",
200 'deleteAccountFormWrongUsernameWarning':"Неверное имя пользователя",
201 'deleteAccountFormWrongPassphraseWarning':"Неверная ключевая фраза",
202 'deleteAccountFormSafetyCheckWarning':"Прочтите и отметьте все поля ниже.",
203 'accountPanelDeletingAccountPanelConfirmationTitle':"ВНИМАНИЕ",
204 'accountPanelDeleteAccountPanelConfirmationText':"Вы уверены, что хотите удалить аккаунт?",
205 'accountPanelDeleteAccountPanelConfirmButtonLabel':"Да",
206 'accountPanelDeleteAccountPanelDenyButtonLabel':"Нет",
207 'offlineCopyTabLabel':"Оффлайновая копия",
208 'offlineCopyTabTitle':"Оффлайновая копия",
209 'offlineCopyTabDescription':"<p>Одним кликом Вы можете сохранить все зашифрованные данные с серверов Clipperz на жесткий диск и создать оффлайновую версию, которую будете использовать при отсутствии подключения к Интернету.</p> <p>Версия только для чтения безопасна также, как и полная, и не подвергает Ваши данные большим рискам, так как использует тот же код и архитектуру.</p> <ol> <li> <p>Нажмите на ссылку, чтобы начать скачивание.</p> </li> <li> <p>Браузер спросит, что сделать с файлом “Clipperz_YYYYMMDD.html”. Сохраните его на Ваш жесткий диск.</p> </li> <li> <p>Double click on the downloaded file to launch the offline version in your browser.</p> </li> <li> <p>Как обычно, введите имя пользователя и ключевую фразу.</p> </li> </ol> ",
210 'offlineCopyDownloadLinkLabel':"Скачать",
211 'offlineCopyDownloadWarning':"<h4> <a href=\"#\" id=\"offlineCopyDownloadWarningLink\">Обновите Вашу “оффлайновую копию”!</a> </h4> <p>Вы недавно создали или изменили одну или более карточек: было бы разумным скачать новую оффлайновую копию.</p> ",
212 'sharingTabLabel':"Совместное использование",
213 'sharingTabTitle':"Совместное использование",
214 'sharingTabDescription':"<p>Достаточно часто конфидециальную информацию нужно открыть одному или нескольким людям.</p> <p>Это может быть просто, как дать коллеге ключ доступа к Вашей голосовой почте, когда Вас нет в офисе, или сложно, как открыть доступ наследникам к Вашему счету в местном банке, когда Вы скончаетесь.</p> <p>Clipperz поможет сделать совместное использование Ваших секретов безопасным и простым процессом.</p> <p> </p> <p> <b>Скоро ...</b> </p> ",
215 'importTabLabel':"Импорт",
216 'importTabTitle':"Импорт",
217 'importTabDescription':"<p> <b>Скоро ...</b> </p> ",
218 'printingTabLabel':"Экспорт",
219 'printingTabTitle':"Экспорт",
220 'printingTabDescription':"<p> <b>Печать Ваших данных</b> </p> <p>Нажмите по ссылке, чтобы открыть новое окно со всеми Вашими карточками для печати.</p> <p>Если вы собираетесь распечатать в резервных целях, пожайлуста, рассмотрите более безопасный вариант, как создание “оффлайновой копии”.</p> ",
221 'printingLinkLabel':"Версия для печати",
222 'contactsTabLabel':"Контакты",
223 'contactsTabTitle':"Контакты",
224 'passwordGeneratorTabLabel':"Генератор паролей",
225 'passwordGeneratorTabTitle':"Генератор паролей",
226 'passwordGeneratorTabButtonLabel':"Генератор паролей",
227 'bookmarkletTabLabel':"Закладка",
228 'bookmarkletTabTitle':"Закладка",
229 'bookmarkletTabDescription':"<p>Закладка - это простой инструмент, который может решать очень полезные задачи. Ее можно сохранить и использовать как обычную веб-страницу.</p> <p>Закладки помогут Вам быстро создать новые карточки и новые логины внутри существующих карточек.</p> <p> <b>Пожайлуста, учтите, что закладки действительно не включают какой-либо информации, связанной с аккаунтом (например, имя или ключевая фраза), закладки содержат один и тот же код для каждого пользователя.</b> </p> <h3>Как установить закладку</h3> <h5>Firefox, Camino, Opera, Safari</h5> <ol> <li> <p>Убедитесь, что панель закладок отображается выбором “View > Toolbars > Bookmarks” или похожими пунктами из меню браузера.</p> </li> <li> <p>Нажмите и перетащите ссылку “Добавить в Clipperz” на панель закладок.</p> </li> </ol> <h5>Internet Explorer</h5> <ol> <li> <p>Убедитесь, что отображается панель “Ссылки” выбором “View > Toolbars > Links” из меню браузера.</p> </li> <li> <p>Нажмите правой кнопкой на ссылку “Добавить в Clipperz”.</p> </li> <li> <p>Выберите “Add to favorites” из контекстного меню.</p> </li> <li> <p>Нажмите “Yes” для любых сообщений, которые появятся.</p> </li> <li> <p>Откройте папку “Links” и нажмите “OK”.</p> </li> </ol> ",
230 'bookmarkletTabBookmarkletTitle':"Добавить в Clipperz",
231 'bookmarkletTabInstructions':"<h3>Как создать новую карточку с ссылками “прямого подключения” в онлайновый сервис</h3> <ol> <li> <p>Откройте веб-страницу с формой входа. (обычно на этой страницы Вы вводите данные вашей учетной записи)</p> </li> <li> <p>Запустите закладку, нажав на нее: появится всплывающее окно.</p> </li> <li> <p>Скопируйте в буфер обмена содержимое текстового поля из всплывающего окна. (ctrl-C)</p> </li> <li> <p>Ввойдите в Ваш аккаунт и нажмите “Добавить новую карточку”.</p> </li> <li> <p>Выберите шаблон “Прямого подключения” и вставьте в текстовое поле содержимое буфера обмена. (ctrl-V)</p> </li> <li> <p>Нажмите кнопку “Создать”, проверьте правильность и нажмите “Сохранить”.</p> </li> </ol> <h3>Как создать ссылку “Прямого подключения” в существующей карточке</h3> <ol> <li> <p>Тоже самое, как и выше.</p> </li> <li> <p>Тоже самое, как и выше.</p> </li> <li> <p>Тоже самое, как и выше.</p> </li> <li> <p>Ввойдите в Ваш аккаунт и выберите карточку с данными учетной записи для только что посещенного веб-сервиса и нажмите “Редактировать”.</p> </li> <li> <p>Вставьте содержимое буфера обмена в текстовое поле в разделе “Прямого подключения”. (ctrl-V)</p> </li> <li> <p>Нажмите “Добавить новое прямое подключение”, проверьте правильность и нажмите “Сохранить”.</p> </li> </ol> <p> </p> <p>Подробнее о закладках <a href=\"http://www.clipperz.com/support/user_guide/bookmarklet\" target=\"_blank\">здесь</a>.</p> ",
232 'mainPanelDirectLoginBlockLabel':"Прямые подключения",
233 'directLinkReferenceShowButtonLabel':"показать",
234 'mainPanelDirectLoginBlockDescription':"<p>Добавьте “Прямые подключения”, чтобы срау входить в веб-сервисы без ввода имени и пароля!</p> <p>“Прямые подключения” значительно усиливают безопасность, так как:</p> <ul> <li> <p>удобно принимать и вводить сложные пароли;</p> </li> <li> <p>никогда не надо использовать простой и один и тот же пароль.</p> </li> </ul> <p>Простая и быстрая конфигурация с помощью закладок.</p> <a href=\"http://www.clipperz.com/support/user_guide/direct_logins\" target=\"_blank\">Подробнее о прямых подключениях</a> ",
235 'mainPanelRecordsBlockLabel':"Карточки",
236 'mainPanelAddRecordButtonLabel':"Добавить новую карточку",
237 'mainPanelRemoveRecordButtonLabel':"Удалить карточку",
238 'mainPanelRecordFilterBlockAllLabel':"все",
239 'mainPanelRecordFilterBlockTagsLabel':"теги",
240 'mainPanelRecordFilterBlockSearchLabel':"поиск",
241 'recordDetailNoRecordAtAllTitle':"Добро пожаловать в Clipperz!",
242 'recordDetailNoRecordAtAllDescription':"<h5>Начните, добавив карточку.</h5> <p>Карточки - это простой и гибкий инструмент, с помощью которого Вы можете хранить пароли и любую другую информацию.</p> <p>Карточки могут содержать учетные записи для доступа к веб-сайтам, код для замка от велосипеда, данные кредитной карточки, ...</p> <h5>Не забывай о закладках!</h5> <p>Перед началом работы установите закладку “Добавить в Clipperz”: создание карточек будет простым и забавным.</p> <p>Перейдите на панель закладок, чтобы изучить, как установить и использовать их.</p> <p> </p> <a href=\"http://www.clipperz.com/support/user_guide/managing_cards\" target=\"_blank\">Подробнее об создании и управлениями закладками</a> ",
243 'newRecordWizardTitleBox':"<h5>Пожайлуста, выберите шаблон</h5> <p>Карточки - это простой и гибкий инструмент, с помощью которого Вы можете хранить пароли и любую другую информацию.</p> <p>Выберите один из шаблонов. Вы всегда сможете настроить ваши карточки, добавляя или удаляя поля.</p> ",
244 'newRecordWizardBookmarkletConfigurationTitle':"Прямое подключение",
245 'newRecordWizardBookmarkletConfigurationDescription':"<p>Вставьте конфигурационный код, сгенерированный с помощью закладки</p> <p>Будет создана новая карточка с поддержкой прямого подключения.</p> ",
246 'newRecordWizardCreateButtonLabel':"Создать",
247 'newRecordWizardCancelButtonLabel':"Отмена",
248 'donateSplashPanelTitle':"Поддержите Clipperz, сделайте пожертвование сегодня!",
249 'donateSplashPanelDescription':"<p>Несколько причин сделать пожертвование:</p> <ul> <li> <p>поддержка развития новых функций</p> </li> <li> <p>оставить Clipperz бесплатным</p> </li> <li> <p>показать признательность нашей упорной работе</p> </li> </ul> <p>Для дополнительной информации посетите нашу <a href=\"http://www.clipperz.com/donations\" target=\"_blank\">страницу пожертвований</a>.</p> <p> <b>Готовы пожертвовать?</b> </p> ",
250 'donateCloseButtonLabel':"Еще нет",
251 'donateDonateButtonLabel':"Да",
252 'recordTemplates':{
253 'WebAccount':{
254 'title':"Интернет Пароль",
255 'description':"Простая форма для хранения учетной записи в онлайновый сервис."
256 },
257 'BankAccount':{
258 'title':"Банковский аккаунт",
259 'description':"Безопасное хранение номера Вашей банковской карты и учетной записи для онлайнового банкинга."
260 },
261 'CreditCard':{
262 'title':"Кредитная карта",
263 'description':"Номер карты, срок действия, CCV2 и ПИН всегда в Ваших руках."
264 },
265 'AddressBookEntry':{
266 'title':"Запись адресной книги",
267 'description':"Clipperz может также работать, как новая частная адресная книга. Используйте этот шаблон, чтобы легко добавить новую запись."
268 },
269 'Custom':{
270 'title':"Пользовательская карточка",
271 'description':"Не важно, какие данные нужно защитить, просто создайте карточку."
272 }
273 },
274 'recordFieldTypologies':{
275 'TXT':{
276 'description':"simple text field",
277 'shortDescription':"текст"
278 },
279 'PWD':{
280 'description':"simple text field, with default status set to hidden",
281 'shortDescription':"пароль"
282 },
283 'URL':{
284 'description':"simple text field in edit mode, that became an active url in view mode",
285 'shortDescription':"веб-адрес"
286 },
287 'DATE':{
288 'description':"a value set with a calendar helper",
289 'shortDescription':"дата"
290 },
291 'ADDR':{
292 'description':"just like the URL, but the active link points to Google Maps (or similar service) passing the address value as argument",
293 'shortDescription':"почтовый адрес"
294 },
295 'CHECK':{
296 'description':"check description",
297 'shortDescription':"check"
298 },
299 'RADIO':{
300 'description':"radio description",
301 'shortDescription':"radio"
302 },
303 'SELECT':{
304 'description':"select description",
305 'shortDescription':"select"
306 }
307 },
308 'newRecordPanelGeneralExceptionTitle':"Ошибка",
309 'newRecordPanelGeneralExceptionMessage':"Конфигурационный текст неверен. Убедитесь, что Вы взяли его из окна закладки и попробуйте снова.",
310 'newRecordPanelWrongBookmarkletVersionExceptionTitle':"Ошибка",
311 'newRecordPanelWrongBookmarkletVersionExceptionMessage':"Конфигурационный текст был сгенерирован с помощью старой весии закладок. Пожайлуста, обновите Вашу закладку и попробуйте снова.",
312 'newRecordPanelExceptionPanelCloseButtonLabel':"Отмена",
313 'mainPanelDeletingRecordPanelConfirmationTitle':"Удаление выбранной карточки",
314 'mainPanelDeleteRecordPanelConfirmationText':"Вы действительно хотите удалить эту карточку?",
315 'mainPanelDeleteRecordPanelConfirmButtonLabel':"Ага",
316 'mainPanelDeleteRecordPanelDenyButtonLabel':"Не-а",
317 'mainPanelDeletingRecordPanelInitialTitle':"Удаление выбранной карточки",
318 'mainPanelDeletingRecordPanelCompletedText':"Выполнено",
319 'deleteRecordPanelCollectRecordDataMessageTitle':"Удаление карточки",
320 'deleteRecordPanelCollectRecordDataMessageText':"Обновление списка карточек",
321 'deleteRecordPanelEncryptUserDataMessageTitle':"Удаление карточки",
322 'deleteRecordPanelEncryptUserDataMessageText':"Шифрование заголовков карточек",
323 'deleteRecordPanelSendingDataToTheServerMessageTitle':"Удаление карточки",
324 'deleteRecordPanelSendingDataToTheServerMessageText':"Передача зашифрованных заголовков карчточек в Clipperz",
325 'deleteRecordPanelUpdatingTheInterfaceMessageTitle':"Удаление карточки",
326 'deleteRecordPanelUpdatingTheInterfaceMessageText':"Обновление интерфейса",
327 'recordDetailNoRecordSelectedTitle':"Не выбрана карточка",
328 'recordDetailNoRecordSelectedDescription':"<p>Пожайлуста, выберите карточку из списка слева.</p> ",
329 'recordDetailLoadingRecordMessage':"Загрузка зашифрованных карточек из Clipperz",
330 'recordDetailDecryptingRecordMessage':"Расшифровка данных карточек",
331 'recordDetailLoadingRecordVersionMessage':"Загрузка последней версии карточкиn",
332 'recordDetailDecryptingRecordVersionMessage':"Расшифровка",
333 'recordDetailLoadingErrorMessageTitle':"Ошибка при загрузку",
334 'recordDetailNotesLabel':"Примечания",
335 'recordDetailLabelFieldColumnLabel':"Метка поля",
336 'recordDetailDataFieldColumnLabel':"Данные поля",
337 'recordDetailTypeFieldColumnLabel':"Тип",
338 'recordDetailSavingChangesMessagePanelInitialTitle':"Сохранение карточки",
339 'recordDetailAddFieldButtonLabel':"Добавить новое поле",
340 'recordDetailPasswordFieldHelpLabel':"чтобы скопировать пароль в буфер обмена, нажмите на звездочку, затем Ctrl-C",
341 'recordDetailPasswordFieldScrambleLabel':"спрятать",
342 'recordDetailPasswordFieldUnscrambleLabel':"показать",
343 'recordDetailDirectLoginBlockTitle':"Прямые подключения",
344 'recordDetailNewDirectLoginDescription':"<p>Настройка прямых подключений</p> ",
345 'recordDetailDirectLoginBlockNoDirectLoginConfiguredDescription':"<p>В этой карточке есть данные для доступа в онлайновый сервис?</p> <p>Используйте закладки, чтобы настроить “прямые подключения”!</p> ",
346 'recordDetailAddNewDirectLoginButtonLabel':"Добавить новое прямое подключение",
347 'recordDetailEditButtonLabel':"Редактировать",
348 'recordDetailSaveButtonLabel':"Сохранить",
349 'recordDetailCancelButtonLabel':"Отмена",
350 'newRecordTitleLabel':"_новую карточку_",
351 'recordSaveChangesPanelCollectRecordInfoMessageTitle':"Сохранение карточки",
352 'recordSaveChangesPanelCollectRecordInfoMessageText':"Обновление заголовков карточек",
353 'recordSaveChangesPanelEncryptUserDataMessageTitle':"Сохранение карточки",
354 'recordSaveChangesPanelEncryptUserDataMessageText':"Шифрование заголовков карточки",
355 'recordSaveChangesPanelEncryptRecordDataMessageTitle':"Сохранение карточки",
356 'recordSaveChangesPanelEncryptRecordDataMessageText':"Шифровани данных карточки",
357 'recordSaveChangesPanelEncryptRecordVersionDataMessageTitle':"Сохранение карточки",
358 'recordSaveChangesPanelEncryptRecordVersionDataMessageText':"Шифрование данных версии карточки",
359 'recordSaveChangesPanelSendingDataToTheServerMessageTitle':"Сохранение карточки",
360 'recordSaveChangesPanelSendingDataToTheServerMessageText':"Передача зашифрованного заголовка карточки в Clipperz",
361 'recordSaveChangesPanelUpdatingTheInterfaceMessageTitle':"Сохранение карточки",
362 'recordSaveChangesPanelUpdatingTheInterfaceMessageText':"Обновление интерфейса",
363 'passwordGeneratorPanelTitle':"Генератор паролей",
364 'passwordGeneratorPanelOkLabel':"OK",
365 'passwordGeneratorPanelCancelLabel':"Отмена",
366 'passwordGeneratorLengthLabel':"длина:",
367 //'DWRUtilLoadingMessage':"Загрузка данных ...",
368 'comingSoon':"вскоре ...",
369 'panelCollectingEntryopyMessageText':"Определение энтропии",
370 'directLoginConfigurationCheckBoxFieldSelectedValue':"Да",
371 'directLoginConfigurationCheckBoxFieldNotSelectedValue':"Нет",
372 'WELCOME_BACK':"Добро пожаловать снова!",
373 'currentConnectionText':"Сейчас вы подключились с ip&nbsp;__ip__, очевидно __country__, используя __browser__ на __operatingSystem__.",
374 'latestConnectionText':"Последнее соединение было __elapsedTimeDescription__ (__time__) с ip&nbsp;__ip__, очевидно __country__, используя __browser__ на __operatingSystem__.",
375 'fullLoginHistoryLinkLabel':"показать полную историю входов",
376 'elapsedTimeDescriptions':{
377 'MORE_THAN_A_MONTH_AGO':"за месяц",
378 'MORE_THAN_A_WEEK_AGO':"за неделю",
379 'MORE_THAN_*_WEEKS_AGO':"за несколько __elapsed__ недель",
380 'YESTERDAY':"вчера",
381 '*_DAYS_AGO':"__elapsed__ дней(-я)",
382 'ABOUT_AN_HOUR_AGO':"за час",
383 '*_HOURS_AGO':"__elapsed__ часов(-а)",
384 'JUST_A_FEW_MINUTES_AGO':"несколько минут",
385 'ABOUT_*_MINUTES_AGO':"около __elapsed__ минут"
386},
387 'unknown_ip':"неизвестный",
388 'calendarStrings':{
389 'months':{
390 '0':"Январь",
391 '1':"Февраль",
392 '2':"Март",
393 '3':"Апрель",
394 '4':"Май",
395 '5':"Июнь",
396 '6':"Июль",
397 '7':"Август",
398 '8':"Сентябрь",
399 '9':"Октябрь",
400 '10':"Ноябрь",
401 '11':"Декабрь"
402 },
403 'shortMonths':{
404 '0':"Янв",
405 '1':"Фев",
406 '2':"Мар",
407 '3':"Апр",
408 '4':"Май",
409 '5':"Июн",
410 '6':"Июл",
411 '7':"Авг",
412 '8':"Сен",
413 '9':"Окт",
414 '10':"Ноя",
415 '11':"Дек"
416 },
417 'days':{
418 '0':"Воскресенье",
419 '1':"Понедельник",
420 '2':"Вторник",
421 '3':"Среда",
422 '4':"Четверг",
423 '5':"Пятница",
424 '6':"Суббота"
425 },
426 'shortDays':{
427 '0':"Вск",
428 '1':"Пон",
429 '2':"Втр",
430 '3':"Сре",
431 '4':"Чет",
432 '5':"Пят",
433 '6':"Суб"
434 },
435 'amDesignation':"am",
436 'pmDesignation':"pm"
437},
438
439__syntaxFix__: "syntax fix"
440});
diff --git a/frontend/beta/js/Clipperz/PM/Strings/Strings_zh-CN.js b/frontend/beta/js/Clipperz/PM/Strings/Strings_zh-CN.js
new file mode 100644
index 0000000..a1d09f1
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Strings/Strings_zh-CN.js
@@ -0,0 +1,477 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29Clipperz.PM.Strings.Languages['zh-CN'.toLowerCase()] = MochiKit.Base.merge(Clipperz.PM.Strings.Languages['en-us'], {
30 'clipperzServiceDescription':"<h2>只有你知道</h2> <ul> <li> <h3>Clipperz 是:</h3> <ul> <li> <p>一个简单而又安全的密码管理员</p> </li> <li> <p>一个有效的单一登录解决方案</p> </li> <li> <p>一个您保密的资料数据库</p> </li> </ul> </li> <li> <h3> 使用 Clipperz 你能:</h3> <ul> <li> <p>储存和管理你的密码和网上证书</p> </li> <li> <p>无需输入密码自动帮助你登录网站服务</p> </li> <li> <p>保护你的敏感数据:通讯录,口令,信用卡号码, ...</p> </li> <li> <p>与家人和伙伴分享秘密(将要上线)</p> </li> </ul> </li> <li> <h3>Clipperz 的特点:</h3> <ul> <li> <p>免费,彻底匿名</p> </li> <li> <p>在任何时间 任何电脑都可以轻松获取你的密码</p> </li> <li> <p>无需下载和安装任何软件</p> </li> <li> <p>再也无需在电脑或者纸上记录密码了</p> </li> </ul> </li> <li> <h3>Clipperz 的安全性:</h3> <ul> <li> <p>密码将在本地浏览器加密,然后上传至 Clipperz</p> </li> <li> <p>加密密钥是一个只有你知道的密码短语</p> </li> <li> <p>Clipperz 服务会加密你的敏感数据,并不会出现数据的原始形式</p> </li> <li> <p>Clipperz 基于加密标准,没有任何的花哨</p> </li> <li> <p>只要你愿意,你随时都可以查看源代码,但是做为一个使用者来说完全没有去必要去了解那些繁琐的加密原理</p> </li> </ul> </li> <li> <a href=\"http://www.clipperz.com\" target=\"_blank\">更多</a> </li> </ul> ",
31 'loginFormTitle':"用你的 Clipperz 帐户登录",
32 'loginFormUsernameLabel':"用户名",
33 'loginFormPassphraseLabel':"密码短语",
34 'loginFormDontHaveAnAccountLabel':"还未建立帐户?",
35 'loginFormCreateOneLabel':"创建一个新帐户",
36 'loginFormForgotYourCredentialsLabel':"忘记你的证书?",
37 'loginFormAarghThatsBadLabel':"呃?这下糟糕了",
38 'loginFormAfraidOfMaliciousScriptsLabel':"害怕有恶意脚本?",
39 'loginFormVerifyTheCodeLabel':"验证代码",
40 'loginFormButtonLabel':"登录",
41 'loginFormOneTimePasswordCheckboxLabel':"使用一次性密码短语",
42 'loginPanelSwithLanguageDescription':"<h5>选择你的第一语言</h5> ",
43 'browserCompatibilityDescription':"<p>使用 Firefox 将得到更快更安全的 Clipperz 服务。不过 Clipperz 同样可以很好的工作在 Opera 和 微软的 IE 中。</p> ",
44 'OTPloginMessagePanelInitialTitle':"用一次性密码短语登录",
45 'OTPloginMessagePanelInitialText':"发送 OTP 证书 ...",
46 'OTPloginMessagePanelLoadingTitle':"用一次性密码短语登录",
47 'OTPloginMessagePanelLoadingText':"从服务器读取加密认证数据 ...",
48 'OTPloginMessagePanelProcessingTitle':"用一次性密码短语登录",
49 'OTPloginMessagePanelProcessingText':"本地解密认证数据",
50 'loginMessagePanelInitialTitle':"登录中...",
51 'loginMessagePanelInitialButtonLabel':"取消",
52 'loginMessagePanelConnectedTitle':"连接成功",
53 'loginMessagePanelConnectedText':"完成",
54 'loginMessagePanelFailureTitle':"错误",
55 'loginMessagePanelFailureText':"登录失败",
56 'loginMessagePanelFailureButtonLabel':"取消",
57 'connectionLoginSendingCredentialsMessageTitle':"验证证书",
58 'connectionLoginSendingCredentialsMessageText':"传送证书",
59 'connectionLoginCredentialsVerificationMessageTitle':"验证证书",
60 'connectionLoginCredentialsVerificationMessageText':"进行 SRP 认证",
61 'connectionLoginDoneMessageTitle':"验证证书",
62 'connectionLoginDoneMessageText':"已连接",
63 'userLoginPanelUpgradingUserCredentialsMessageTitle':"验证证书",
64 'userLoginPanelUpgradingUserCredentialsMessageText':"升级证书到新的认证模式",
65 'userLoginPanelConnectedMessageTitle':"用户识别",
66 'userLoginPanelConnectedMessageText':"成功登录",
67 'userLoginPanelTryingAnOlderConnectionSchemaMessageTitle':"验证证书",
68 'userLoginPanelTryingAnOlderConnectionSchemaMessageText':"旧认证模式失效",
69 'userLoginPanelLoadingUserDataMessageTitle':"用户识别",
70 'userLoginPanelLoadingUserDataMessageText':"正在从 Clipperz 下载加密卡报头",
71 'userLoginPanelDecryptingUserDataMessageTitle':"用户识别",
72 'userLoginPanelDecryptingUserDataMessageText':"加密卡报头本地解密",
73 'userLoginPanelDecryptingUserStatisticsMessageTitle':"用户识别",
74 'userLoginPanelDecryptingUserStatisticsMessageText':"本地解密使用统计",
75 'splashAlertTitle':"Clipperz 欢迎您",
76 'splashAlertText':"<p>安全忠告</p> <ul> <li> <p>在 Clipperz ,用你选择的密码短语保存数据是安全的。没有人能够得到这些数据,除非他们有你的密码。</p> </li> <li> <p> 如果你决定使用 Clipperz 保护敏感数据和关键资料,请务必选用一个复杂的密码短语。越长越好</p> </li> <li> <p>注意:Clipperz将无法找回忘记的密码码短语!</p> </li> </ul> <p>获得更多的说明,请前往 <a href=\"http://www.clipperz.com\" target=\"_blank\">Clipperz</a> 网站.</p> ",
77 'splashAlertCloseButtonLabel':"确定",
78 'registrationFormTitle':"创建你的帐户",
79 'registrationFormUsernameLabel':"用户名",
80 'registrationFormPassphraseLabel':"密码短语",
81 'registrationFormRetypePassphraseLabel':"确认密码短语",
82 'registrationFormSafetyCheckLabel':"我明白 Clipperz 无法找回忘记的密码短语.",
83 'registrationFormTermsOfServiceCheckLabel':"我同意接受 <a href='http://www.clipperz.com/terms_of_service' target='_blank'>服务条款</a> 款.",
84 'registrationFormDoYouAlreadyHaveAnAccountLabel':"如果已有一个 Clipperz 帐户",
85 'registrationFormSimplyLoginLabel':"在此登录",
86 'registrationFormButtonLabel':"注册",
87 'registrationFormWarningMessageNotMatchingPassphrases':"两次密码短语不同,请重新输入",
88 'registrationFormWarningMessageSafetyCheckNotSelected':"请阅读并检查下面的选项框",
89 'registrationFormWarningMessageTermsOfServiceCheckNotSelected':"您需要同意服务条款",
90 'registrationMessagePanelInitialTitle':"创建账户...",
91 'registrationMessagePanelInitialButtonLabel':"取消",
92 'registrationMessagePanelRegistrationDoneTitle':"注册",
93 'registrationMessagePanelRegistrationDoneText':"完成",
94 'registrationMessagePanelFailureTitle':"注册失败",
95 'registrationMessagePanelFailureButtonLabel':"关闭",
96 'connectionRegistrationSendingRequestMessageText':"验证证书",
97 'connectionRegistrationSendingCredentialsMessageText':"传送证书",
98 'registrationSplashPanelTitle':"安全忠告",
99 'registrationSplashPanelDescription':"<p>这是你的 Clipperz 证书,请保存好。Clipperz 永远不会第二次显示你的用户名和密码短语</p> ",
100 'registrationSplashPanelUsernameLabel':"用户名",
101 'registrationSplashPanelPassphraseLabel':"密码短语",
102 'registrationSplashPanelShowPassphraseButtonLabel':"显示密码短语",
103 'donateHeaderLinkLabel':"捐赠",
104 'creditsHeaderLinkLabel':"致谢",
105 'feedbackHeaderLinkLabel':"反馈",
106 'helpHeaderLinkLabel':"帮助",
107 'forumHeaderLinkLabel':"论坛",
108 'recordMenuLabel':"密码卡片",
109 'accountMenuLabel':"账户",
110 'dataMenuLabel':"资料",
111 'contactsMenuLabel':"联系",
112 'toolsMenuLabel':"工具",
113 'logoutMenuLabel':"暂时离开",
114 'lockMenuLabel':"安全锁",
115 'lockTitle':"账户被锁定",
116 'lockDescription':"<p>请输入你的密码短语解开账户</p> ",
117 'unlockButtonLabel':"解锁",
118 'changePasswordTabLabel':"修改密码短语",
119 'changePasswordTabTitle':"修改密码短语",
120 'changePasswordFormUsernameLabel':"用户名",
121 'changePasswordFormOldPassphraseLabel':"旧密码短语",
122 'changePasswordFormNewPassphraseLabel':"新密码短语",
123 'changePasswordFormRetypePassphraseLabel':"确认密码短语",
124 'changePasswordFormSafetyCheckboxLabel':"我知道 Clipperz 不能找回丢失的密码短语",
125 'changePasswordFormSubmitLabel':"修改密码短语",
126 'changePasswordFormWrongUsernameWarning':"用户名错误",
127 'changePasswordFormWrongPassphraseWarning':"旧密码短语错误",
128 'changePasswordFormWrongRetypePassphraseWarning':"两次密码短语不同,请重新输入",
129 'changePasswordFormSafetyCheckWarning':"请阅读并检查下面的选项框",
130 'changePasswordFormProgressDialogTitle':"正在修改密码短语",
131 'changePasswordFormProgressDialogConnectedMessageTitle':"连接",
132 'changePasswordFormProgressDialogConnectedMessageText':"完成",
133 'changePasswordFormProgressDialogErrorMessageTitle':"错误",
134 'changePasswordFormProgressDialogErrorMessageText':"证书修改失败",
135 'changeCredentialsPanelEncryptingDataMessageTitle':"正在修改你的密码短语",
136 'changeCredentialsPanelEncryptingDataMessageText':"加密卡报头本地解密",
137 'changeCredentialsPanelCreatingNewCredentialsMessageTitle':"正在修改你的密码短语",
138 'changeCredentialsPanelCreatingNewCredentialsMessageText':"更新你的证书",
139 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageTitle':"正在修改你的密码短语",
140 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageText':"正在上传本地证书到 Clipperz",
141 'changeCredentialsPanelDoneMessageTitle':"正在修改你的密码短语",
142 'changeCredentialsPanelDoneMessageText':"完成",
143 'manageOTPTabLabel':"管理你的一次性密码短语",
144 'manageOTPTabTitle':"管理你的一次性密码短语",
145 'manageOTPTabDescription':"<p>一次性密码短语工作起来和一般的密码短语一样,但是只可以使用一次</p> <p>如果同样的密码短语在一段时间以内再次登录,会被拒绝。登录进程将会失败。</p> <p>为了防止任何欺诈登录,在成功登陆之后,你的一次性密码将会立即被删除,</p> <p>如果一次性密码被键盘记录程序或者间谍软件得到,可能会从被感染的机器上收集数据,这样的话,一次性密码绝对是个很好的选择。</p> <p> <b>强烈建议在公共场合登录 Clipperz 时,使用一次性密码。比如公关计算机,网吧,图书馆等</b> </p> ",
146 'oneTimePasswordReadOnlyMessage':"<h6>对不起!</h6> <p>你不能从离线版本管理你的一次性密码短语</p> ",
147 'oneTimePasswordLoadingMessage':"<h6>加载数据</h6> <p>请等待 ...</p> ",
148 'oneTimePasswordNoPasswordAvailable':"<h6>一次性密码短语没有激活</h6> <p>点击“新建”按钮添加一次性密码短语到你的帐户</p> ",
149 'createNewOTPButtonLabel':"新建",
150 'deleteOTPButtonLabel':"删除",
151 'printOTPButtonLabel':"打印",
152 'disabledOneTimePassword_warning':"禁用",
153 'oneTimePasswordSelectionLink_selectLabel':"选择:",
154 'oneTimePasswordSelectionLink_all':"所有",
155 'oneTimePasswordSelectionLink_none':"没有",
156 'oneTimePasswordSelectionLink_used':"被使用",
157 'oneTimePasswordSelectionLink_unused':"未使用",
158 'saveOTP_encryptUserDataTitle':"保存一次性密码短语",
159 'saveOTP_encryptUserDataText':"处理新的 OTP 证书 ...",
160 'saveOTP_encryptOTPDataTitle':"保存一次性密码短语",
161 'saveOTP_encryptOTPDataText':"本地解密认证数据 ...",
162 'saveOTP_sendingDataTitle':"保存一次性密码短语",
163 'saveOTP_sendingDataText':"发送信任数据到服务器 ...",
164 'saveOTP_updatingInterfaceTitle':"保存一次性密码短语",
165 'saveOTP_updatingInterfaceText':"更新界面...",
166 'accountPreferencesLabel':"使用偏好",
167 'accountPreferencesTabTitle':"使用偏好",
168 'accountPreferencesLanguageTitle':"界面语言选择",
169 'accountPreferencesLanguageDescription':"<p>在下拉菜单中选择你的首选语言</p> ",
170 'showDonationReminderPanelTitle':"捐赠提示",
171 'showDonationReminderPanelDescription':"<p>显示捐赠提示</p> ",
172 'saveUserPreferencesFormSubmitLabel':"保存",
173 'cancelUserPreferencesFormSubmitLabel':"取消",
174 'accountPreferencesSavingPanelTitle_Step1':"保存使用偏好",
175 'accountPreferencesSavingPanelText_Step1':"本地加密你的使用偏好",
176 'accountPreferencesSavingPanelTitle_Step2':"保存使用偏好",
177 'accountPreferencesSavingPanelText_Step2':"正在向 Clipperz 传送加密后的使用偏好",
178 'accountLoginHistoryLabel':"登录历史",
179 'loginHistoryTabTitle':"登录历史",
180 'loginHistoryReadOnlyMessage':"<h6>对不起!</h6> <p>当你使用离线版本时登录历史是无法显示的</p> ",
181 'loginHistoryLoadingMessage':"<h6>加载数据</h6> <p>请等待 ...</p> ",
182 'loginHistoryLoadedMessage':"<h6>您的最近 10 次登陆</h6> <p> </p> ",
183 'loginHistoryIPLabel':"IP",
184 'loginHistoryTimeLabel':"时间",
185 'loginHistoryCurrentSessionText':"当前登录信息",
186 'loginHistoryReloadButtonLabel':"刷新登录历史",
187 'deleteAccountTabLabel':"删除你的账户",
188 'deleteAccountTabTitle':"删除你的账户",
189 'deleteAccountFormUsernameLabel':"用户名",
190 'deleteAccountFormPassphraseLabel':"密码短语",
191 'deleteAccountFormSafetyCheckboxLabel':"我知道我的所有数据将被删除,并且是不可回复的.",
192 'deleteAccountFormSubmitLabel':"删除我的账户",
193 'deleteAccountFormWrongUsernameWarning':"用户名错误",
194 'deleteAccountFormWrongPassphraseWarning':"密码短语错误",
195 'deleteAccountFormSafetyCheckWarning':"请阅读并检查下面的选项框",
196 'accountPanelDeletingAccountPanelConfirmationTitle':"注意",
197 'accountPanelDeleteAccountPanelConfirmationText':"你确认要删除你的帐户",
198 'accountPanelDeleteAccountPanelConfirmButtonLabel':"是",
199 'accountPanelDeleteAccountPanelDenyButtonLabel':"否",
200 'offlineCopyTabLabel':"离线拷贝",
201 'offlineCopyTabTitle':"离线拷贝",
202 'offlineCopyTabDescription':"<p>只需点击一次就可以从 Clipperz 服务器下载所有加密数据到你的硬盘,让你在不能连接互联网的时候使用离线只读版本的 Clipperz。</p> <p>你下载的离线数据和登陆我们网站在线使用是一样安全的,它们使用了同样的密码和安全体系,都不会有暴露数据的风险。</p> <ol> <li> <p>点击链接后开始下载。</p> </li> <li> <p>浏览器会问你如何处理 “Clipperz_YYYYMMDD.html” 文件。保存这个文件到你的硬盘。</p> </li> <li> <p>双击下载的文件在浏览器运行离线版本。</p> </li> <li> <p>输入你的用户名和密码短语。</p> </li> </ol> ",
203 'offlineCopyDownloadLinkLabel':"下载",
204 'offlineCopyDownloadWarning':"<h4> <a href=\"#\" id=\"offlineCopyDownloadWarningLink\">更新你的“离线版本”!</a> </h4> <p>你最近创建或修改了卡片,需要下载新的“离线版本”</p> ",
205 'sharingTabLabel':"共享",
206 'sharingTabTitle':"共享",
207 'sharingTabDescription':"<p>往往一个机密的资料需要另外一个人或者多人共同使用</p> <p>你可以在这里设置一个简单的授权码,以便在离开办公室的时候你的同事可以访问你的邮箱,或者设置一个复杂的,当你去世后子孙可以在这里找到取得银行保险箱的方法。</p> <p>Clipperz 可以安全并且简单的分享你的密码</p> <p> </p> <p> <b>即将发布...</b> </p> ",
208 'importTabLabel':"导入",
209 'importTabTitle':"导入",
210 'importTabDescription':"<p> <b>即将发布 ...</b> </p> ",
211 'printingTabLabel':"导出",
212 'printingTabTitle':"导出",
213 'printingTabDescription':"<p> <b>打印你的数据</b> </p> <p>点击下面的链接,将会打开一个新窗口,以打印格式显示你的密码卡片</p> <p>如果你打印下来是为了备份,请考虑使用我们提供的\"离线版本\",这比打印更安全。</p> ",
214 'printingLinkLabel':"打印版本",
215 'contactsTabLabel':"联系",
216 'contactsTabTitle':"联系",
217 'passwordGeneratorTabLabel':"随机密码生成器",
218 'passwordGeneratorTabTitle':"随机密码生成器",
219 'passwordGeneratorTabButtonLabel':"生成随机密码",
220 'bookmarkletTabLabel':"书签按钮",
221 'bookmarkletTabTitle':"书签按钮",
222 'bookmarkletTabDescription':"<p>这个书签按钮是一个简单的非常有用的“一键”工具,它能像一般网站一样储存并且使用</p> <p>Clipperz 按钮书签可以帮助你快速建立密码卡片并且用存在的密码卡片直接登录</p> <p> <b>请注意,这个书签按钮不包含你账户中的任何信息(例如你的用户名和密码),对所有的 Clipperz 使用者,这个书签按钮是大家的工具,代码都是相同的。</b> </p> <h3>怎样安装书签按钮</h3> <h5>Firefox, Camino, Opera, Safari</h5> <ol> <li> <p>选择 “查看 > 工具栏 > 书签工具栏” 确认 “书签工具栏” 显示在浏览器菜单上。</p> </li> <li> <p>拖动 “添加到 Clipperz” 链接到书签工具栏。</p> </li> </ol> <h5>Internet Explorer</h5> <ol> <li> <p>选择 “查看 > 工具栏 > 链接” 确认 “链接” 显示在浏览器菜单上。</p> </li> <li> <p>右键 “添加到 Clipperz”</p> </li> <li> <p>选择 “添加到收藏夹”</p> </li> <li> <p>如果弹出安全提示选择 “是”</p> </li> <li> <p>打开 “链接” 文件夹后单击 “添加”</p> </li> </ol> ",
223 'bookmarkletTabBookmarkletTitle':"添加到 Clipperz",
224 'bookmarkletTabInstructions':"<h3>如何在一个在线服务中创建可以直接登录的新的密码卡片</h3> <ol> <li> <p>打开你要登录的页面(这个页面通常就是你输入登录信息的页面)</p> </li> <li> <p>点击书签按钮,会出现一个新的弹出窗口</p> </li> <li> <p>复制弹出窗口中的所有文本到剪贴板(ctrl+c)</p> </li> <li> <p>登录你的 Clipperz 账户,然后点击 <b>新建密码卡片</b> 按钮</p> </li> <li> <p>选择“直接登录”模板,之后粘贴剪贴板中的内容到大文本框(ctrl+v)</p> </li> <li> <p>按下 <b>创建</b> 按钮,检查细节并且点击 <b>保存</b>.</p> </li> </ol> <h3>对于已经存在的密码卡片如何添加直接登陆</h3> <ol> <li> <p>与上面的步骤相同</p> </li> <li> <p>与上面的步骤相同</p> </li> <li> <p>与上面的步骤相同</p> </li> <li> <p>输入你的 Clipperz 帐号,选择你刚刚访问的网络服务的密码卡片然后点击 <b>编辑</b> 按钮.</p> </li> <li> <p>将剪贴板中的内容粘贴到“直接登录”区域的大文本框中 (ctrl-V)</p> </li> <li> <p>点击添加 <b>自动登录</b> 按钮,检查细节并且点击k <b>保存</b>.</p> </li> </ol> <p> </p> <p>如果需要关于书签按钮的进一步资料可以在 <a href=\"http://www.clipperz.com/support/user_guide/bookmarklet\" target=\"_blank\">这里获得</a>.</p> ",
225 'mainPanelDirectLoginBlockLabel':"直接登录",
226 'directLinkReferenceShowButtonLabel':"显示",
227 'mainPanelDirectLoginBlockDescription':"<p>添加 “直接登录” 可以让你不用输入用户名和密码即可登录网络账户</p> <p>“直接登录” 可以大大提高你的密码安全性,因为你可以:</p> <ul> <li> <p>方便选择和输入复杂的密码</p> </li> <li> <p>永远不再使用相同的,容易猜测的密码</p> </li> </ul> <p>用 Clipperz 书签按钮简单快速的配置</p> <a href=\"http://www.clipperz.com/support/user_guide/direct_logins\" target=\"_blank\">关于 “直接登录” 的更多信息</a> ",
228 'mainPanelRecordsBlockLabel':"密码卡片",
229 'mainPanelAddRecordButtonLabel':"添加新密码卡片",
230 'mainPanelRemoveRecordButtonLabel':"删除密码卡片",
231 'mainPanelRecordFilterBlockAllLabel':"所有",
232 'mainPanelRecordFilterBlockTagsLabel':"标签",
233 'mainPanelRecordFilterBlockSearchLabel':"搜索",
234 'recordDetailNoRecordAtAllTitle':"欢迎来到 Clipperz!",
235 'recordDetailNoRecordAtAllDescription':"<h5>从你的账户添加密码卡片开始</h5> <p>密码卡片是简单灵活的方式,在这里你可以保存你的密码和其他机密资料.</p> <p>密码卡片含有一个全权访问网站的证书,你的通讯录,你的信用卡信息,……</p> <h5>不要忘记书签按钮</h5> <p>在你开始前,安装 “添加到 Clipperz” 书签按钮:它将使创建密码卡片变得简单并且有趣</p> <p>去书签按钮标签了解如何安装并使用它</p> <p> </p> <p>然后只需单击 “添加密码卡片” 按钮,即可尽情享受 Clipperz 帐户.</p> <p> <a href=\"http://www.clipperz.com/support/user_guide/managing_cards\" target=\"_blank\">关于创建和管理密码卡片的更多信息</a> </p> ",
236 'newRecordWizardTitleBox':"<h5>请选择一个模板</h5> <p>密码卡片是简单灵活的方式,在这里你可以保存你的密码和其他机密资料.</p> <p>首先选择下面的一个模板。在添加或者删除以后,可以随时定制你的密码卡片.</p> ",
237 'newRecordWizardBookmarkletConfigurationTitle':"直接登陆",
238 'newRecordWizardBookmarkletConfigurationDescription':"<p>将从 Clipperz 书签按钮得到的代码粘贴到下面的文本框中</p> <p>一个直接登陆你的网络账户的新密码卡片将要被创建完成</p> ",
239 'newRecordWizardCreateButtonLabel':"创建",
240 'newRecordWizardCancelButtonLabel':"取消",
241 'donateSplashPanelTitle':"今天就捐赠支持 Clipperz!",
242 'donateSplashPanelDescription':"<p>捐赠我们的原因:</p> <ul> <li> <p>支持新特性的开发</p> </li> <li> <p>保持 Clipperz 的免费</p> </li> <li> <p>对我们的辛勤工作表示感谢</p> </li> </ul> <p> <a href=\"http://www.clipperz.com/donations\" target=\"_blank\">进一步资料,请浏览我们的捐款页</a>.</p> <p> <b>愿意捐款?</b> </p> ",
243 'donateCloseButtonLabel':"不必了",
244 'donateDonateButtonLabel':"是",
245 'recordTemplates':{
246 'WebAccount':{
247 'title':"网站密码",
248 'description':"<p>为您的网上服务提供简单的密码储存,自动登录服务.</p> ",
249 'fields':{
250 'URL':"网址",
251 'TXT':"用户名或者电子邮件地址",
252 'PWD':"密码"
253 }
254 },
255 'BankAccount':{
256 'title':"银行帐户",
257 'description':"<p>安全储存你的银行账号和网上银行证书.</p> ",
258 'fields':{
259 'TXT':"银行",
260 'TXT':"帐号",
261 'URL':"银行网站",
262 'TXT':"在线银行 ID",
263 'PWD':"在线银行密码"
264 }
265 },
266 'CreditCard':{
267 'title':"信用卡",
268 'description':"<p>信用卡号码,有效日期,CVV2和PIN 都由 Clipperz 管理</p> ",
269 'fields':{
270 'TXT':"类型(VISA, AmEx, ...)",
271 'TXT':"号码",
272 'TXT':"持卡人姓名",
273 'TXT':"有效日期",
274 'TXT':"CVV2",
275 'PWD':"PIN",
276 'URL':"信用卡网站",
277 'TXT':"用户名",
278 'PWD':"密码"
279 }
280 },
281 'AddressBookEntry':{
282 'title':"通讯录条目",
283 'description':"<p>Clipperz 同样可以为你的私人通讯录服务. 使用这个模板,轻易添加新的条目.</p> ",
284 'fields':{
285 'TXT':"姓名",
286 'TXT':"电子邮件",
287 'TXT':"电话",
288 'TXT':"手机",
289 'ADDR':"地址"
290 }
291 },
292 'Custom':{
293 'title':"定制密码卡片",
294 'description':"<p>无论你需要保护哪种类型的机密数据,创建定制密码卡片便可满足你的需求</p> ",
295 'fields':{
296 'TXT':"标签 1",
297 'TXT':"标签 2",
298 'TXT':"标签 3"
299 }
300 }
301},
302 'recordFieldTypologies':{
303 'TXT':{
304 'description':"simple text field",
305 'shortDescription':"文字"
306 },
307 'PWD':{
308 'description':"simple text field, with default status set to hidden",
309 'shortDescription':"密码"
310 },
311 'URL':{
312 'description':"simple text field in edit mode, that became an active url in view mode",
313 'shortDescription':"网址"
314 },
315 'DATE':{
316 'description':"a value set with a calendar helper",
317 'shortDescription':"数据"
318 },
319 'ADDR':{
320 'description':"just like the URL, but the active link points to Google Maps (or similar service) passing the address value as argument",
321 'shortDescription':"地址"
322 },
323 'CHECK':{
324 'description':"check description",
325 'shortDescription':"check"
326 },
327 'RADIO':{
328 'description':"radio description",
329 'shortDescription':"radio"
330 },
331 'SELECT':{
332 'description':"select description",
333 'shortDescription':"select"
334 }
335},
336 'newRecordPanelGeneralExceptionTitle':"错误",
337 'newRecordPanelGeneralExceptionMessage':"配置文本不正确,请从书签中确认你的文本并且再试一次",
338 'newRecordPanelWrongBookmarkletVersionExceptionTitle':"错误",
339 'newRecordPanelWrongBookmarkletVersionExceptionMessage':"配置文本已经产生了一个旧版本书签,请更新你的书签然后再试试。",
340 'newRecordPanelExceptionPanelCloseButtonLabel':"取消",
341 'mainPanelDeletingRecordPanelConfirmationTitle':"删除所选密码卡片",
342 'mainPanelDeleteRecordPanelConfirmationText':"确认要删除选定的密码卡片?",
343 'mainPanelDeleteRecordPanelConfirmButtonLabel':"是",
344 'mainPanelDeleteRecordPanelDenyButtonLabel':"否",
345 'mainPanelDeletingRecordPanelInitialTitle':"删除选定的密码卡片",
346 'mainPanelDeletingRecordPanelCompletedText':"完成",
347 'deleteRecordPanelCollectRecordDataMessageTitle':"删除密码卡片",
348 'deleteRecordPanelCollectRecordDataMessageText':"更新密码卡片列表",
349 'deleteRecordPanelEncryptUserDataMessageTitle':"删除密码卡片",
350 'deleteRecordPanelEncryptUserDataMessageText':"加密卡报头本地解密",
351 'deleteRecordPanelSendingDataToTheServerMessageTitle':"删除密码卡片",
352 'deleteRecordPanelSendingDataToTheServerMessageText':"从 Clipperz 更新加密卡报头",
353 'deleteRecordPanelUpdatingTheInterfaceMessageTitle':"删除密码卡片",
354 'deleteRecordPanelUpdatingTheInterfaceMessageText':"更新界面",
355 'recordDetailNoRecordSelectedTitle':"未选择密码卡片",
356 'recordDetailNoRecordSelectedDescription':"<p>从左边的列表中选择一个密码卡片</p> ",
357 'recordDetailLoadingRecordMessage':"正在从 Clipperz 下载加密卡片",
358 'recordDetailDecryptingRecordMessage':"密码卡片数据本地解密",
359 'recordDetailLoadingRecordVersionMessage':"下载最新版本的密码卡片",
360 'recordDetailDecryptingRecordVersionMessage':"本地解密最新版本密码卡片",
361 'recordDetailLoadingErrorMessageTitle':"密码卡片下载错误",
362 'recordDetailNotesLabel':"注释",
363 'recordDetailLabelFieldColumnLabel':"标签区域",
364 'recordDetailDataFieldColumnLabel':"数据区域",
365 'recordDetailTypeFieldColumnLabel':"类型",
366 'recordDetailSavingChangesMessagePanelInitialTitle':"保存密码卡片",
367 'recordDetailAddFieldButtonLabel':"添加新区域",
368 'recordDetailPasswordFieldHelpLabel':"点击星星复制密码到剪贴板,然后用 Ctrl+V 使用",
369 'recordDetailPasswordFieldScrambleLabel':"隐藏密码",
370 'recordDetailPasswordFieldUnscrambleLabel':"显示密码",
371 'recordDetailDirectLoginBlockTitle':"直接登录",
372 'recordDetailNewDirectLoginDescription':"<p>直接登录配置</p> ",
373 'recordDetailDirectLoginBlockNoDirectLoginConfiguredDescription':"<p>这个密码卡片包含在线服务证书吗?</p> <p>仅仅单击就可以从 Clipperz 使用书签配置 “直接登录”</p> ",
374 'recordDetailAddNewDirectLoginButtonLabel':"添加新的直接登录",
375 'recordDetailEditButtonLabel':"编辑",
376 'recordDetailSaveButtonLabel':"保存",
377 'recordDetailCancelButtonLabel':"取消",
378 'newRecordTitleLabel':"_新密码卡片_",
379 'recordSaveChangesPanelCollectRecordInfoMessageTitle':"保存密码卡片",
380 'recordSaveChangesPanelCollectRecordInfoMessageText':"更新密码卡片报头",
381 'recordSaveChangesPanelEncryptUserDataMessageTitle':"保存密码卡片",
382 'recordSaveChangesPanelEncryptUserDataMessageText':"本地加密卡片报头",
383 'recordSaveChangesPanelEncryptRecordDataMessageTitle':"保存密码卡片",
384 'recordSaveChangesPanelEncryptRecordDataMessageText':"本地加密卡片数据",
385 'recordSaveChangesPanelEncryptRecordVersionDataMessageTitle':"保存密码卡片",
386 'recordSaveChangesPanelEncryptRecordVersionDataMessageText':"本地加密密码卡片版本数据",
387 'recordSaveChangesPanelSendingDataToTheServerMessageTitle':"保存密码卡片",
388 'recordSaveChangesPanelSendingDataToTheServerMessageText':"从 Clipperz 更新加密卡报头",
389 'recordSaveChangesPanelUpdatingTheInterfaceMessageTitle':"保存密码卡片",
390 'recordSaveChangesPanelUpdatingTheInterfaceMessageText':"更新界面",
391 'passwordGeneratorPanelTitle':"密码生成器",
392 'passwordGeneratorPanelOkLabel':"确认",
393 'passwordGeneratorPanelCancelLabel':"取消",
394 'passwordGeneratorLengthLabel':"长度:",
395 //'DWRUtilLoadingMessage':"加载数据。。。",
396 'comingSoon':"即将到来。。。",
397 'panelCollectingEntryopyMessageText':"收集平均信息",
398 'directLoginConfigurationCheckBoxFieldSelectedValue':"是",
399 'directLoginConfigurationCheckBoxFieldNotSelectedValue':"否",
400 'WELCOME_BACK':"欢迎回来!",
401 'currentConnectionText':"你的连接 IP 地址是&nbsp;__ip__; 来自 __country__, 在 __browser__ 上使用 __operatingSystem__。",
402 'latestConnectionText':"你上次的登录 IP 是&nbsp;__ip__ 在 __elapsedTimeDescription__ (__time__); 来自 __country__, 在 __browser__ 上使用 __operatingSystem__。",
403 'fullLoginHistoryLinkLabel':"显示所有登录历史",
404 'elapsedTimeDescriptions':{
405 'MORE_THAN_A_MONTH_AGO':"一个月之前",
406 'MORE_THAN_A_WEEK_AGO':"一周之前",
407 'MORE_THAN_*_WEEKS_AGO':"__elapsed__ 周以前",
408 'YESTERDAY':"昨天",
409 '*_DAYS_AGO':"__elapsed__ 天之前",
410 'ABOUT_AN_HOUR_AGO':"大约一个小时前",
411 '*_HOURS_AGO':"__elapsed__ 小时前",
412 'JUST_A_FEW_MINUTES_AGO':"仅仅几分钟之前",
413 'ABOUT_*_MINUTES_AGO':"大约 __elapsed__ 几分钟前"
414},
415 'unknown_ip':"未知",
416 'calendarStrings':{
417 'months':{
418 '0':"一月",
419 '1':"二月",
420 '2':"三月",
421 '3':"四月",
422 '4':"五月",
423 '5':"六月",
424 '6':"七月",
425 '7':"八月",
426 '8':"九月",
427 '9':"十月",
428 '10':"十一月",
429 '11':"十二月"
430 },
431 'shortMonths':{
432 '0':"一月",
433 '1':"二月",
434 '2':"三月",
435 '3':"四月",
436 '4':"五月",
437 '5':"六月",
438 '6':"七月",
439 '7':"八月",
440 '8':"九月",
441 '9':"十月",
442 '10':"十一月",
443 '11':"十二月"
444 },
445 'days':{
446 '0':"星期日",
447 '1':"星期一",
448 '2':"星期二",
449 '3':"星期三",
450 '4':"星期四",
451 '5':"星期五",
452 '6':"星期六"
453 },
454 'shortDays':{
455 '0':"日",
456 '1':"一",
457 '2':"二",
458 '3':"三",
459 '4':"四",
460 '5':"五",
461 '6':"六"
462 },
463 'veryShortDays':{
464 '0':"日",
465 '1':"一",
466 '2':"二",
467 '3':"三",
468 '4':"四",
469 '5':"五",
470 '6':"六"
471 },
472 'amDesignation':"上午",
473 'pmDesignation':"下午"
474},
475
476__syntaxFix__: "syntax fix"
477});
diff --git a/frontend/beta/js/Clipperz/PM/Toll.js b/frontend/beta/js/Clipperz/PM/Toll.js
new file mode 100644
index 0000000..6d412c1
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/PM/Toll.js
@@ -0,0 +1,193 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31
32//=============================================================================
33
34Clipperz.PM.Toll = function(args) {
35 this._requestType = args.requestType;
36 this._targetValue = args.targetValue;
37 this._cost = args.cost;
38 this._toll = null;
39
40 return this;
41}
42
43Clipperz.PM.Toll.prototype = MochiKit.Base.update(null, {
44
45 'toString': function() {
46 return "Clipperz.PM.Toll (" + this.requestType() + ": " + this.cost() + " - " + ((this.toll() == null)? 'UNPAID' : 'PAID') + ")";
47 },
48
49 //-------------------------------------------------------------------------
50
51 'requestType': function() {
52 return this._requestType;
53 },
54
55 //-------------------------------------------------------------------------
56
57 'targetValue': function() {
58 return this._targetValue;
59 },
60
61 //-------------------------------------------------------------------------
62
63 'cost': function() {
64 return this._cost;
65 },
66
67 //-------------------------------------------------------------------------
68
69 'toll': function() {
70 return this._toll;
71 },
72
73 //=========================================================================
74
75 'prefixMatchingBits': function(aValue1, aValue2) {
76 varresult;
77 var i,c;
78
79 result = 0;
80
81 c = Math.min(aValue1.length(), aValue2.length());
82 i = 0;
83 while (i<c && (aValue1.byteAtIndex(i) == aValue2.byteAtIndex(i))) {
84 result += 8;
85 i++;
86 }
87
88 if (i<c) {
89 varxorValue;
90
91 xorValue = (aValue1.byteAtIndex(i) ^ aValue2.byteAtIndex(i));
92
93 if (xorValue >= 128) {
94 result += 0;
95 } else if (xorValue >= 64) {
96 result += 1;
97 } else if (xorValue >= 32) {
98 result += 2;
99 } else if (xorValue >= 16) {
100 result += 3;
101 } else if (xorValue >= 8) {
102 result += 4;
103 } else if (xorValue >= 4) {
104 result += 5;
105 } else if (xorValue >= 2) {
106 result += 6;
107 } else if (xorValue >= 1) {
108 result += 7;
109 }
110 }
111
112 return result;
113 },
114
115 //=========================================================================
116
117 'pay': function() {
118 varresult;
119 vartargetData;
120 vartargetMatchSize;
121 var prefixMatchingBits;
122 varpayment;
123 var i;
124
125//MochiKit.Logging.logDebug(">>> Toll.pay");
126 if (this.toll() == null) {
127 i = 0;
128//MochiKit.Logging.logDebug("--- Proxy.payToll - 1");
129 targetData = new Clipperz.ByteArray("0x" + this.targetValue());
130//MochiKit.Logging.logDebug("--- Proxy.payToll - 2");
131 targetMatchSize = this.cost();
132//MochiKit.Logging.logDebug("--- Proxy.payToll - 3");
133
134 payment = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32);
135//MochiKit.Logging.logDebug("--- Proxy.payToll - 4");
136
137 do {
138 varpaymentData;
139
140//MochiKit.Logging.logDebug("--- Proxy.payToll - 5");
141 //payment = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32);
142 payment.increment();
143//MochiKit.Logging.logDebug("--- Proxy.payToll - 6");
144 paymentData = Clipperz.Crypto.SHA.sha256(payment);
145//MochiKit.Logging.logDebug("--- Proxy.payToll - 7");
146 prefixMatchingBits = this.prefixMatchingBits(targetData, paymentData);
147//MochiKit.Logging.logDebug("--- Proxy.payToll - 8");
148 i++;
149//MochiKit.Logging.logDebug("--- Proxy.payToll - 9");
150 } while (prefixMatchingBits < targetMatchSize);
151//MochiKit.Logging.logDebug("--- Proxy.payToll - 10");
152
153 this._toll = payment.toHexString().substring(2)
154 }
155//MochiKit.Logging.logDebug("<<< Toll.pay");
156
157 return this;
158 },
159
160 //-------------------------------------------------------------------------
161
162 'deferredPay': function() {
163 vardeferredResult;
164 vartoll;
165
166//MochiKit.Logging.logDebug(">>> Toll.deferredPay");
167 toll = this;
168 deferredResult = new MochiKit.Async.Deferred();
169//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("y.1 - Proxy.deferredPayToll - 1: " + res); return res;});
170 deferredResult.addCallback(MochiKit.Base.method(toll, 'pay'));
171//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("y.2 - Proxy.deferredPayToll - 2: " + res); return res;});
172 deferredResult.addCallback(function(aToll) {
173 var result;
174
175 result = {
176 targetValue:aToll.targetValue(),
177 toll:aToll.toll()
178 };
179
180 return result;
181 });
182//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("y.3 - Proxy.deferredPayToll - 3: " + res); return res;});
183 deferredResult.callback();
184//MochiKit.Logging.logDebug("<<< Toll.deferredPay");
185
186 return deferredResult;
187 },
188
189 //=========================================================================
190 __syntaxFix__: "syntax fix"
191
192});
193
diff --git a/frontend/beta/js/Clipperz/Profile.js b/frontend/beta/js/Clipperz/Profile.js
new file mode 100644
index 0000000..31888a9
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Profile.js
@@ -0,0 +1,485 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29addEvent(window, "load", sortables_init);
30
31var SORT_COLUMN_INDEX;
32
33function sortables_init() {
34 // Find all tables with class sortable and make them sortable
35 if (!document.getElementsByTagName) return;
36 tbls = document.getElementsByTagName("table");
37 for (ti=0;ti<tbls.length;ti++) {
38 thisTbl = tbls[ti];
39 if (((' '+thisTbl.className+' ').indexOf("sortable") != -1) && (thisTbl.id)) {
40 //initTable(thisTbl.id);
41 ts_makeSortable(thisTbl);
42 }
43 }
44}
45
46function ts_makeSortable(table) {
47 if (table.rows && table.rows.length > 0) {
48 var firstRow = table.rows[0];
49 }
50 if (!firstRow) return;
51
52 // We have a first row: assume it's the header, and make its contents clickable links
53 for (var i=0;i<firstRow.cells.length;i++) {
54 var cell = firstRow.cells[i];
55 var txt = ts_getInnerText(cell);
56 cell.innerHTML = '<a href="#" class="sortheader" '+
57 'onclick="ts_resortTable(this, '+i+');return false;">' +
58 txt+'<span class="sortarrow">&nbsp;&nbsp;&nbsp;</span></a>';
59 }
60}
61
62function ts_getInnerText(el) {
63 if (typeof el == "string") return el;
64 if (typeof el == "undefined") { return el };
65 if (el.innerText) return el.innerText;//Not needed but it is faster
66 var str = "";
67
68 var cs = el.childNodes;
69 var l = cs.length;
70 for (var i = 0; i < l; i++) {
71 switch (cs[i].nodeType) {
72 case 1: //ELEMENT_NODE
73 str += ts_getInnerText(cs[i]);
74 break;
75 case 3://TEXT_NODE
76 str += cs[i].nodeValue;
77 break;
78 }
79 }
80 return str;
81}
82
83function ts_resortTable(lnk,clid) {
84 // get the span
85 var span;
86 for (var ci=0;ci<lnk.childNodes.length;ci++) {
87 if (lnk.childNodes[ci].tagName && lnk.childNodes[ci].tagName.toLowerCase() == 'span') span = lnk.childNodes[ci];
88 }
89 var spantext = ts_getInnerText(span);
90 var td = lnk.parentNode;
91 var column = clid || td.cellIndex;
92 var table = getParent(td,'TABLE');
93
94 // Work out a type for the column
95 if (table.rows.length <= 1) return;
96 var itm = ts_getInnerText(table.rows[1].cells[column]);
97 sortfn = ts_sort_caseinsensitive;
98 if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d\d\d$/)) {
99 sortfn = ts_sort_date;
100 }
101 if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d$/)) {
102 sortfn = ts_sort_date;
103 }
104 if (itm.match(/^[£$]/)) {
105 sortfn = ts_sort_currency;
106 }
107 if (itm.match(/^[\d\.]+$/)) {
108 sortfn = ts_sort_numeric;
109 }
110 SORT_COLUMN_INDEX = column;
111 var firstRow = new Array();
112 var newRows = new Array();
113 for (i=0;i<table.rows[0].length;i++) {
114 firstRow[i] = table.rows[0][i];
115 }
116
117 for (j=1;j<table.rows.length;j++) {
118 newRows[j-1] = table.rows[j];
119 }
120 newRows.sort(sortfn);
121
122 if (span.getAttribute("sortdir") == 'down') {
123 ARROW = '&nbsp;&nbsp;&uarr;';
124 newRows.reverse();
125 span.setAttribute('sortdir','up');
126 } else {
127 ARROW = '&nbsp;&nbsp;&darr;';
128 span.setAttribute('sortdir','down');
129 }
130
131 // We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones
132 // don't do sortbottom rows
133 for (i=0;i<newRows.length;i++) {
134 if (!newRows[i].className || (newRows[i].className && (newRows[i].className.indexOf('sortbottom') == -1))) {
135 table.tBodies[0].appendChild(newRows[i]);
136 }
137 }
138 // do sortbottom rows only
139 for (i=0;i<newRows.length;i++) {
140 if (newRows[i].className && (newRows[i].className.indexOf('sortbottom') != -1)) {
141 table.tBodies[0].appendChild(newRows[i]);
142 }
143 }
144
145 // Delete any other arrows there may be showing
146 var allspans = document.getElementsByTagName("span");
147 for (var ci=0;ci<allspans.length;ci++) {
148 if (allspans[ci].className == 'sortarrow') {
149 if (getParent(allspans[ci],"table") == getParent(lnk,"table")) { // in the same table as us?
150 allspans[ci].innerHTML = '&nbsp;&nbsp;&nbsp;';
151 }
152 }
153 }
154
155 span.innerHTML = ARROW;
156}
157
158function getParent(el, pTagName) {
159 if (el == null) return null;
160 else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase())// Gecko bug, supposed to be uppercase
161 return el;
162 else
163 return getParent(el.parentNode, pTagName);
164}
165function ts_sort_date(a,b) {
166 // y2k notes: two digit years less than 50 are treated as 20XX, greater than 50 are treated as 19XX
167 aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]);
168 bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]);
169 if (aa.length == 10) {
170 dt1 = aa.substr(6,4)+aa.substr(3,2)+aa.substr(0,2);
171 } else {
172 yr = aa.substr(6,2);
173 if (parseInt(yr) < 50) { yr = '20'+yr; } else { yr = '19'+yr; }
174 dt1 = yr+aa.substr(3,2)+aa.substr(0,2);
175 }
176 if (bb.length == 10) {
177 dt2 = bb.substr(6,4)+bb.substr(3,2)+bb.substr(0,2);
178 } else {
179 yr = bb.substr(6,2);
180 if (parseInt(yr) < 50) { yr = '20'+yr; } else { yr = '19'+yr; }
181 dt2 = yr+bb.substr(3,2)+bb.substr(0,2);
182 }
183 if (dt1==dt2) return 0;
184 if (dt1<dt2) return -1;
185 return 1;
186}
187
188function ts_sort_currency(a,b) {
189 aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]).replace(/[^0-9.]/g,'');
190 bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]).replace(/[^0-9.]/g,'');
191 return parseFloat(aa) - parseFloat(bb);
192}
193
194function ts_sort_numeric(a,b) {
195 aa = parseFloat(ts_getInnerText(a.cells[SORT_COLUMN_INDEX]));
196 if (isNaN(aa)) aa = 0;
197 bb = parseFloat(ts_getInnerText(b.cells[SORT_COLUMN_INDEX]));
198 if (isNaN(bb)) bb = 0;
199 return aa-bb;
200}
201
202function ts_sort_caseinsensitive(a,b) {
203 aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]).toLowerCase();
204 bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]).toLowerCase();
205 if (aa==bb) return 0;
206 if (aa<bb) return -1;
207 return 1;
208}
209
210function ts_sort_default(a,b) {
211 aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]);
212 bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]);
213 if (aa==bb) return 0;
214 if (aa<bb) return -1;
215 return 1;
216}
217
218
219function addEvent(elm, evType, fn, useCapture)
220// addEvent and removeEvent
221// cross-browser event handling for IE5+, NS6 and Mozilla
222// By Scott Andrew
223{
224 if (elm.addEventListener){
225 elm.addEventListener(evType, fn, useCapture);
226 return true;
227 } else if (elm.attachEvent){
228 var r = elm.attachEvent("on"+evType, fn);
229 return r;
230 } else {
231 alert("Handler could not be removed");
232 }
233}
234
235
236
237
238if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
239if (typeof(Clipperz.Profile) == 'undefined') { Clipperz.Profile = {}; }
240
241Clipperz.Profile.VERSION = "0.1";
242Clipperz.Profile.NAME = "Clipperz.Profile";
243
244MochiKit.Base.update(Clipperz.Profile, {
245
246 //-------------------------------------------------------------------------
247
248 '__repr__': function () {
249 varstatus;
250
251 if (Clipperz.Profile.isEnabled == true) {
252 status = ENABLED;
253 } else {
254 status = DISABLED;
255 }
256
257 return "[" + this.NAME + " " + this.VERSION + " - " + status + "]";
258 },
259
260 //-------------------------------------------------------------------------
261
262 'toString': function () {
263 return this.__repr__();
264 },
265
266 //-------------------------------------------------------------------------
267
268 'isEnabled': function() {
269 return false;
270 },
271
272 //-------------------------------------------------------------------------
273
274 'initialValues': function() {
275 return {iters:0, total:0, min:Number.MAX_VALUE, max:0}
276 },
277
278 //-------------------------------------------------------------------------
279
280 'start': function(aName) {},
281 'stop': function(aName) {},
282 'dump': function(aName) {},
283 'profileData': function(aName, aKey) {
284 varresult;
285
286 if (typeof(aName) != 'undefined') {
287 result = this.initialValues();
288
289 if (typeof(aKey) != 'undefined') {
290 result = result[aKey];
291 }
292 } else {
293 result = null;
294 }
295
296 return result;
297
298 },
299 'resetProfileData': function() {},
300 //-------------------------------------------------------------------------
301
302 'end': function(aName) {
303 Clipperz.Profile.stop(aName);
304 },
305
306 //-------------------------------------------------------------------------
307
308 __syntaxFix__: "syntax fix"
309});
310
311
312
313if ((typeof(clipperz_profiling_enabled) != 'undefined') && (clipperz_profiling_enabled == true)) {
314
315var _clipperz_profile_profiles = {};
316var _clipperz_profile_pns = [];
317
318
319MochiKit.Base.update(Clipperz.Profile, {
320
321 //-------------------------------------------------------------------------
322
323 'isEnabled': function() {
324 return true;
325 },
326
327 //-------------------------------------------------------------------------
328
329 'start': function(aName) {
330 if (!_clipperz_profile_profiles[aName]) {
331 _clipperz_profile_profiles[aName] = this.initialValues();
332 _clipperz_profile_pns[_clipperz_profile_pns.length] = aName;
333 } else {
334 if (_clipperz_profile_profiles[aName]["start"]) {
335 Clipperz.Profile.stop(aName);
336 }
337 }
338
339 _clipperz_profile_profiles[aName].end = null;
340 _clipperz_profile_profiles[aName].start = new Date();
341 },
342
343 //-------------------------------------------------------------------------
344
345 'stop': function(aName) {
346 if ((_clipperz_profile_profiles[aName]) && (_clipperz_profile_profiles[aName]["start"])) {
347 with(_clipperz_profile_profiles[aName]) {
348 var now;
349 varelapsedTime;
350
351 now = new Date();
352 elapsedTime = (now - start);
353
354 end = now;
355 min = Math.min(min, elapsedTime);
356 max = Math.max(max, elapsedTime);
357 total += elapsedTime;
358 start = null;
359 iters++;
360 }
361 } else {
362 // oops! bad call to end(), what should we do here?
363 return true;
364 }
365 },
366
367 //-------------------------------------------------------------------------
368
369 'dump': function(appendToDoc) {
370 // var tbl = document.createElement("table");
371 var tbl = MochiKit.DOM.TABLE(null, MochiKit.DOM.TBODY());
372 tbl.className = 'sortable';
373 tbl.id = "profileOutputTable_table";
374 with(tbl.style){
375 border = "1px solid black";
376 borderCollapse = "collapse";
377 }
378 var hdr = tbl.createTHead();
379 var hdrtr = hdr.insertRow(0);
380 // document.createElement("tr");
381 var cols = ["Identifier","#","Min", "Avg","Max","Total"];
382 for(var x=0; x<cols.length; x++){
383 var ntd = hdrtr.insertCell(x);
384 with(ntd.style){
385 backgroundColor = "#225d94";
386 color = "white";
387 borderBottom = "1px solid black";
388 borderRight = "1px solid black";
389 fontFamily = "tahoma";
390 fontWeight = "bolder";
391 paddingLeft = paddingRight = "5px";
392 }
393 ntd.appendChild(document.createTextNode(cols[x]));
394 }
395
396 for(var x=0; x < _clipperz_profile_pns.length; x++){
397 var prf = _clipperz_profile_profiles[_clipperz_profile_pns[x]];
398 this.end(_clipperz_profile_pns[x]);
399 if(prf.iters>0){
400 var bdytr = tbl.insertRow(true);
401 var vals = [_clipperz_profile_pns[x], prf.iters, prf.min, parseInt(Math.round(prf.total/prf.iters)), prf.max, prf.total];
402 for(var y=0; y<vals.length; y++){
403 var cc = bdytr.insertCell(y);
404 cc.appendChild(document.createTextNode(vals[y]));
405 with(cc.style){
406 borderBottom = "1px solid gray";
407 paddingLeft = paddingRight = "5px";
408 if(x%2){
409 backgroundColor = "#e1f1ff";
410 }
411 if(y>0){
412 textAlign = "right";
413 borderRight = "1px solid gray";
414 }else{
415 borderRight = "1px solid black";
416 }
417 }
418 }
419 }
420 }
421
422 if(appendToDoc){
423 var ne = document.createElement("div");
424 ne.id = "profileOutputTable";
425 with(ne.style){
426 fontFamily = "Courier New, monospace";
427 fontSize = "12px";
428 lineHeight = "16px";
429 borderTop = "1px solid black";
430 padding = "10px";
431 }
432 if(document.getElementById("profileOutputTable")){
433 MochiKit.DOM.swapDOM("profileOutputTable", ne);
434 }else{
435 document.body.appendChild(ne);
436 }
437 ne.appendChild(tbl);
438 }
439
440 return tbl;
441 },
442
443 //-------------------------------------------------------------------------
444
445 'profileData': function(aName, aKey) {
446 varresult;
447
448 if (typeof(aName) == 'undefined') {
449 result = _clipperz_profile_profiles;
450 } else {
451 if (typeof(_clipperz_profile_profiles[aName]) != 'undefined') {
452 result = _clipperz_profile_profiles[aName];
453 } else {
454 result = {};
455 }
456 }
457
458 if (typeof(aKey) != 'undefined') {
459 if (aKey == "average") {
460 result = Math.round(Clipperz.Profile.profileData(aName, 'total')/Clipperz.Profile.profileData(aName, 'iters'));
461 } else {
462 if (typeof(result[aKey]) != 'undefined') {
463 result = result[aKey];
464 } else {
465 result = 0;
466 }
467 }
468 }
469
470 return result;
471 },
472
473 //-------------------------------------------------------------------------
474
475 'resetProfileData': function() {
476 _clipperz_profile_profiles = {};
477 _clipperz_profile_pns = [];
478 },
479
480 //-------------------------------------------------------------------------
481
482 __syntaxFix__: "syntax fix"
483});
484
485}
diff --git a/frontend/beta/js/Clipperz/Set.js b/frontend/beta/js/Clipperz/Set.js
new file mode 100644
index 0000000..61e0769
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Set.js
@@ -0,0 +1,167 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29
30if (typeof(Clipperz) == 'undefined') {
31 Clipperz = {};
32}
33
34//#############################################################################
35
36Clipperz.Set = function(args) {
37 args = args || {};
38 //MochiKit.Base.bindMethods(this);
39
40 if (args.items != null) {
41 this._items = args.items.slice();
42 } else {
43 this._items = [];
44 }
45
46 return this;
47}
48
49//=============================================================================
50
51Clipperz.Set.prototype = MochiKit.Base.update(null, {
52
53 //-------------------------------------------------------------------------
54
55 'toString': function() {
56 return "Clipperz.Set";
57 },
58
59 //-------------------------------------------------------------------------
60
61 'items': function() {
62 return this._items;
63 },
64
65 //-------------------------------------------------------------------------
66
67 'popAnItem': function() {
68 var result;
69
70 if (this.size() > 0) {
71 result = this.items().pop();
72 } else {
73 result = null;
74 }
75
76 return result;
77 },
78
79 //-------------------------------------------------------------------------
80
81 'allItems': function() {
82 return this.items();
83 },
84
85 //-------------------------------------------------------------------------
86
87 'contains': function(anItem) {
88 return (this.indexOf(anItem) != -1);
89 },
90
91 //-------------------------------------------------------------------------
92
93 'indexOf': function(anItem) {
94 varresult;
95 vari, c;
96
97 result = -1;
98
99 c = this.items().length;
100 for (i=0; (i<c) && (result == -1); i++) {
101 if (this.items()[i] === anItem) {
102 result = i;
103 }
104 }
105
106 return result;
107 },
108
109 //-------------------------------------------------------------------------
110
111 'add': function(anItem) {
112 if (anItem.constructor == Array) {
113 MochiKit.Base.map(MochiKit.Base.bind(this,add, this), anItem);
114 } else {
115 if (! this.contains(anItem)) {
116 this.items().push(anItem);
117 }
118 }
119 },
120
121 //-------------------------------------------------------------------------
122
123 'debug': function() {
124 vari, c;
125
126 result = -1;
127
128 c = this.items().length;
129 for (i=0; i<c; i++) {
130 alert("[" + i + "] " + this.items()[i].label);
131 }
132 },
133
134 //-------------------------------------------------------------------------
135
136 'remove': function(anItem) {
137 if (anItem.constructor == Array) {
138 MochiKit.Base.map(MochiKit.Base.bind(this.remove, this), anItem);
139 } else {
140 varitemIndex;
141
142 itemIndex = this.indexOf(anItem);
143 if (itemIndex != -1) {
144 this.items().splice(itemIndex, 1);
145 }
146 }
147 },
148
149 //-------------------------------------------------------------------------
150
151 'size': function() {
152 return this.items().length;
153 },
154
155 //-------------------------------------------------------------------------
156
157 'empty': function() {
158 this.items().splice(0, this.items().length);
159 },
160
161 //-------------------------------------------------------------------------
162
163 __syntaxFix__: "syntax fix"
164
165 //-------------------------------------------------------------------------
166});
167
diff --git a/frontend/beta/js/Clipperz/Signal.js b/frontend/beta/js/Clipperz/Signal.js
new file mode 100644
index 0000000..1d3c9eb
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Signal.js
@@ -0,0 +1,71 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.Signal) == 'undefined') { Clipperz.Signal = {}; }
31
32Clipperz.Signal.VERSION = "0.1";
33Clipperz.Signal.NAME = "Clipperz.Signal";
34
35MochiKit.Base.update(Clipperz.Signal, {
36
37 //-------------------------------------------------------------------------
38
39 '__repr__': function () {
40 return "[" + this.NAME + " " + this.VERSION + "]";
41 },
42
43 //-------------------------------------------------------------------------
44
45 'toString': function () {
46 return this.__repr__();
47 },
48
49 //-------------------------------------------------------------------------
50
51 'fireNativeEvent': function(element, eventName) {
52 if (element.fireEvent) {
53 // MSIE
54 element.fireEvent(eventName);
55 } else {
56 // W3C
57 var event;
58
59 event = document.createEvent("HTMLEvents");
60 event.initEvent(eventName.replace(/^on/, ""), true, true);
61 element.dispatchEvent(event);
62 }
63 },
64
65 //-------------------------------------------------------------------------
66 __syntaxFix__: "syntax fix"
67
68});
69
70
71
diff --git a/frontend/beta/js/Clipperz/Style.js b/frontend/beta/js/Clipperz/Style.js
new file mode 100644
index 0000000..9762b1c
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/Style.js
@@ -0,0 +1,73 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.Style) == 'undefined') { Clipperz.Style = {}; }
31
32Clipperz.Style.VERSION = "0.1";
33Clipperz.Style.NAME = "Clipperz.DOM";
34
35MochiKit.Base.update(Clipperz.Style, {
36
37 //-------------------------------------------------------------------------
38
39 '__repr__': function () {
40 return "[" + this.NAME + " " + this.VERSION + "]";
41 },
42
43 //-------------------------------------------------------------------------
44
45 'toString': function () {
46 return this.__repr__();
47 },
48
49 //-------------------------------------------------------------------------
50
51 'applyZebraStylesToTable': function(aTable) {
52 var tbody;
53 var tbodyRows;
54 var i,c;
55
56 tbody = MochiKit.DOM.getFirstElementByTagAndClassName('tbody', null, aTable);
57 tbodyRows = tbody.childNodes;
58 // tbodyRows = MochiKit.DOM.getElementsByTagAndClassName('tr', null, tbody)
59 c = tbodyRows.length;
60 for (i=0; i<c; i++) {
61 var element;
62
63 element = YAHOO.ext.Element.get(tbodyRows[i]);
64 element.addClass(((i%2 == 0) ? "zebra_odd": "zebra_even"));
65 element.removeClass(((i%2 == 1) ? "zebra_odd": "zebra_even"));
66 }
67 },
68
69 //-------------------------------------------------------------------------
70 __syntaxFix__: "syntax fix"
71
72});
73
diff --git a/frontend/beta/js/Clipperz/YUI/Collapser.js b/frontend/beta/js/Clipperz/YUI/Collapser.js
new file mode 100644
index 0000000..5c0ac0f
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/YUI/Collapser.js
@@ -0,0 +1,73 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; }
31
32 //found on YUI-EXT forum (http://www.yui-ext.com/forum/viewtopic.php?t=683&highlight=accordion)
33Clipperz.YUI.Collapser = function(clickEl, collapseEl, initiallyCollapsed) {
34 this.clickEl = getEl(clickEl);
35 this.collapseEl = getEl(collapseEl);
36 this.clickEl.addClass('collapser-expanded');
37 if (initiallyCollapsed == true) {
38 this.afterCollapse();
39 }
40 this.clickEl.mon('click', function(){
41 this.collapsed === true ? this.expand() : this.collapse();
42 }, this, true);
43};
44
45Clipperz.YUI.Collapser.prototype = {
46 'collapse': function(){
47 this.collapseEl.clip();
48 this.collapseEl.setHeight(1, true, .35, this.afterCollapse.createDelegate(this), YAHOO.util.Easing.easeOut);
49 this.clickEl.replaceClass('collapser-expanded','collapser-collapsed');
50 },
51
52 'afterCollapse': function(){
53 this.collapsed = true;
54 this.collapseEl.setDisplayed(false);
55 this.clickEl.replaceClass('collapser-expanded','collapser-collapsed');
56 },
57
58 'expand': function(){
59 this.collapseEl.setDisplayed(true);
60 this.collapseEl.autoHeight(true, .35, this.afterExpand.createDelegate(this), YAHOO.util.Easing.easeOut);
61 this.clickEl.replaceClass('collapser-collapsed','collapser-expanded');
62 },
63
64 'afterExpand': function(){
65 this.collapsed = false;
66 this.collapseEl.unclip();
67 this.collapseEl.setStyle('height', '');
68 this.clickEl.replaceClass('collapser-collapsed','collapser-expanded');
69 },
70
71 //-----------------------------------------------------
72 __syntaxFix__: '__syntaxFix__'
73};
diff --git a/frontend/beta/js/Clipperz/YUI/DomHelper.js b/frontend/beta/js/Clipperz/YUI/DomHelper.js
new file mode 100644
index 0000000..4f8acde
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/YUI/DomHelper.js
@@ -0,0 +1,465 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.ext) == 'undefined') { Clipperz.ext = {}; }
31
32/**
33 * @class Clipperz.YUI.DomHelper
34 * Utility class for working with DOM and/or Templates. It transparently supports using HTML fragments or DOM.
35 * For more information see <a href="http://www.jackslocum.com/yui/2006/10/06/domhelper-create-elements-using-dom-html-fragments-or-templates/">this blog post with examples</a>.
36 * @singleton
37 */
38Clipperz.YUI.DomHelper = new function(){
39 /**@private*/
40 var d = document;
41 var tempTableEl = null;
42 /** True to force the use of DOM instead of html fragments @type Boolean */
43 this.useDom = false;
44 var emptyTags = /^(?:base|basefont|br|frame|hr|img|input|isindex|link|meta|nextid|range|spacer|wbr|audioscope|area|param|keygen|col|limittext|spot|tab|over|right|left|choose|atop|of)$/i;
45 /**
46 * Applies a style specification to an element
47 * @param {String/HTMLElement} el The element to apply styles to
48 * @param {String/Object/Function} styles A style specification string eg "width:100px", or object in the form {width:"100px"}, or
49 * a function which returns such a specification.
50 */
51 this.applyStyles = function(el, styles){
52 if(styles){
53 var D = YAHOO.util.Dom;
54 if (typeof styles == "string"){
55 var re = /\s?([a-z\-]*)\:([^;]*);?/gi;
56 var matches;
57 while ((matches = re.exec(styles)) != null){
58 D.setStyle(el, matches[1], matches[2]);
59 }
60 }else if (typeof styles == "object"){
61 for (var style in styles){
62 D.setStyle(el, style, styles[style]);
63 }
64 }else if (typeof styles == "function"){
65 Clipperz.YUI.DomHelper.applyStyles(el, styles.call());
66 }
67 }
68 };
69
70 // build as innerHTML where available
71 /** @ignore */
72 var createHtml = function(o){
73 var b = '';
74
75 if(typeof(o['html']) != 'undefined') {
76 o['html'] = Clipperz.Base.sanitizeString(o['html']);
77 } else if (typeof(o['htmlString']) != 'undefined') {
78 o['html'] = o['htmlString'];
79 delete o.htmlString;
80 }
81
82 b += '<' + o.tag;
83 for(var attr in o){
84 if(attr == 'tag' || attr == 'children' || attr == 'html' || typeof o[attr] == 'function') continue;
85 if(attr == 'style'){
86 var s = o['style'];
87 if(typeof s == 'function'){
88 s = s.call();
89 }
90 if(typeof s == 'string'){
91 b += ' style="' + s + '"';
92 }else if(typeof s == 'object'){
93 b += ' style="';
94 for(var key in s){
95 if(typeof s[key] != 'function'){
96 b += key + ':' + s[key] + ';';
97 }
98 }
99 b += '"';
100 }
101 }else{
102 if(attr == 'cls'){
103 b += ' class="' + o['cls'] + '"';
104 }else if(attr == 'htmlFor'){
105 b += ' for="' + o['htmlFor'] + '"';
106 }else{
107 b += ' ' + attr + '="' + o[attr] + '"';
108 }
109 }
110 }
111 if(emptyTags.test(o.tag)){
112 b += ' />';
113 }else{
114 b += '>';
115 if(o.children){
116 for(var i = 0, len = o.children.length; i < len; i++) {
117 b += createHtml(o.children[i], b);
118 }
119 }
120 if(o.html){
121 b += o.html;
122 }
123 b += '</' + o.tag + '>';
124 }
125 return b;
126 }
127
128 // build as dom
129 /** @ignore */
130 var createDom = function(o, parentNode){
131 var el = d.createElement(o.tag);
132 var useSet = el.setAttribute ? true : false; // In IE some elements don't have setAttribute
133 for(var attr in o){
134 if(attr == 'tag' || attr == 'children' || attr == 'html' || attr == 'style' || typeof o[attr] == 'function') continue;
135 if(attr=='cls'){
136 el.className = o['cls'];
137 }else{
138 if(useSet) el.setAttribute(attr, o[attr]);
139 else el[attr] = o[attr];
140 }
141 }
142 Clipperz.YUI.DomHelper.applyStyles(el, o.style);
143 if(o.children){
144 for(var i = 0, len = o.children.length; i < len; i++) {
145 createDom(o.children[i], el);
146 }
147 }
148 if(o.html){
149 el.innerHTML = o.html;
150 }
151 if(parentNode){
152 parentNode.appendChild(el);
153 }
154 return el;
155 };
156
157 /**
158 * @ignore
159 * Nasty code for IE's broken table implementation
160 */
161 var insertIntoTable = function(tag, where, el, html){
162 if(!tempTableEl){
163 tempTableEl = document.createElement('div');
164 }
165 var node;
166 if(tag == 'table' || tag == 'tbody'){
167 tempTableEl.innerHTML = '<table><tbody>'+html+'</tbody></table>';
168 node = tempTableEl.firstChild.firstChild.firstChild;
169 }else{
170 tempTableEl.innerHTML = '<table><tbody><tr>'+html+'</tr></tbody></table>';
171 node = tempTableEl.firstChild.firstChild.firstChild.firstChild;
172 }
173 if(where == 'beforebegin'){
174 el.parentNode.insertBefore(node, el);
175 return node;
176 }else if(where == 'afterbegin'){
177 el.insertBefore(node, el.firstChild);
178 return node;
179 }else if(where == 'beforeend'){
180 el.appendChild(node);
181 return node;
182 }else if(where == 'afterend'){
183 el.parentNode.insertBefore(node, el.nextSibling);
184 return node;
185 }
186 }
187
188 /**
189 * Inserts an HTML fragment into the Dom
190 * @param {String} where Where to insert the html in relation to el - beforeBegin, afterBegin, beforeEnd, afterEnd.
191 * @param {HTMLElement} el The context element
192 * @param {String} html The HTML fragmenet
193 * @return {HTMLElement} The new node
194 */
195 this.insertHtml = function(where, el, html){
196 where = where.toLowerCase();
197 if(el.insertAdjacentHTML){
198 var tag = el.tagName.toLowerCase();
199 if(tag == 'table' || tag == 'tbody' || tag == 'tr'){
200 return insertIntoTable(tag, where, el, html);
201 }
202 switch(where){
203 case 'beforebegin':
204 el.insertAdjacentHTML(where, html);
205 return el.previousSibling;
206 case 'afterbegin':
207 el.insertAdjacentHTML(where, html);
208 return el.firstChild;
209 case 'beforeend':
210 el.insertAdjacentHTML(where, html);
211 return el.lastChild;
212 case 'afterend':
213 el.insertAdjacentHTML(where, html);
214 return el.nextSibling;
215 }
216 throw 'Illegal insertion point -> "' + where + '"';
217 }
218 var range = el.ownerDocument.createRange();
219 var frag;
220 switch(where){
221 case 'beforebegin':
222 range.setStartBefore(el);
223 frag = range.createContextualFragment(html);
224 el.parentNode.insertBefore(frag, el);
225 return el.previousSibling;
226 case 'afterbegin':
227 if(el.firstChild){ // faster
228 range.setStartBefore(el.firstChild);
229 }else{
230 range.selectNodeContents(el);
231 range.collapse(true);
232 }
233 frag = range.createContextualFragment(html);
234 el.insertBefore(frag, el.firstChild);
235 return el.firstChild;
236 case 'beforeend':
237 if(el.lastChild){
238 range.setStartAfter(el.lastChild); // faster
239 }else{
240 range.selectNodeContents(el);
241 range.collapse(false);
242 }
243 frag = range.createContextualFragment(html);
244 el.appendChild(frag);
245 return el.lastChild;
246 case 'afterend':
247 range.setStartAfter(el);
248 frag = range.createContextualFragment(html);
249 el.parentNode.insertBefore(frag, el.nextSibling);
250 return el.nextSibling;
251 }
252 throw 'Illegal insertion point -> "' + where + '"';
253 };
254
255 /**
256 * Creates new Dom element(s) and inserts them before el
257 * @param {String/HTMLElement/Element} el The context element
258 * @param {Object} o The Dom object spec (and children)
259 * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element
260 * @return {HTMLElement} The new node
261 */
262 this.insertBefore = function(el, o, returnElement){
263 el = el.dom ? el.dom : YAHOO.util.Dom.get(el);
264 var newNode;
265 if(this.useDom){
266 newNode = createDom(o, null);
267 el.parentNode.insertBefore(newNode, el);
268 }else{
269 var html = createHtml(o);
270 newNode = this.insertHtml('beforeBegin', el, html);
271 }
272 return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode;
273 };
274
275 /**
276 * Creates new Dom element(s) and inserts them after el
277 * @param {String/HTMLElement/Element} el The context element
278 * @param {Object} o The Dom object spec (and children)
279 * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element
280 * @return {HTMLElement} The new node
281 */
282 this.insertAfter = function(el, o, returnElement){
283 el = el.dom ? el.dom : YAHOO.util.Dom.get(el);
284 var newNode;
285 if(this.useDom){
286 newNode = createDom(o, null);
287 el.parentNode.insertBefore(newNode, el.nextSibling);
288 }else{
289 var html = createHtml(o);
290 newNode = this.insertHtml('afterEnd', el, html);
291 }
292 return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode;
293 };
294
295 /**
296 * Creates new Dom element(s) and appends them to el
297 * @param {String/HTMLElement/Element} el The context element
298 * @param {Object} o The Dom object spec (and children)
299 * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element
300 * @return {HTMLElement} The new node
301 */
302 this.append = function(el, o, returnElement){
303 el = el.dom ? el.dom : YAHOO.util.Dom.get(el);
304 var newNode;
305 if(this.useDom){
306 newNode = createDom(o, null);
307 el.appendChild(newNode);
308 }else{
309 var html = createHtml(o);
310 newNode = this.insertHtml('beforeEnd', el, html);
311 }
312 return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode;
313 };
314
315 /**
316 * Creates new Dom element(s) and overwrites the contents of el with them
317 * @param {String/HTMLElement/Element} el The context element
318 * @param {Object} o The Dom object spec (and children)
319 * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element
320 * @return {HTMLElement} The new node
321 */
322 this.overwrite = function(el, o, returnElement){
323 el = el.dom ? el.dom : YAHOO.util.Dom.get(el);
324 el.innerHTML = createHtml(o);
325 return returnElement ? YAHOO.ext.Element.get(el.firstChild, true) : el.firstChild;
326 };
327
328 /**
329 * Creates a new Clipperz.YUI.DomHelper.Template from the Dom object spec
330 * @param {Object} o The Dom object spec (and children)
331 * @return {Clipperz.YUI.DomHelper.Template} The new template
332 */
333 this.createTemplate = function(o){
334 var html = createHtml(o);
335 return new Clipperz.YUI.DomHelper.Template(html);
336 };
337}();
338
339/**
340* @class Clipperz.YUI.DomHelper.Template
341* Represents an HTML fragment template.
342* For more information see <a href="http://www.jackslocum.com/yui/2006/10/06/domhelper-create-elements-using-dom-html-fragments-or-templates/">this blog post with examples</a>.
343* <br>
344* <b>This class is also available as YAHOO.ext.Template</b>.
345* @constructor
346* @param {String/Array} html The HTML fragment or an array of fragments to join('') or multiple arguments to join('')
347*/
348Clipperz.YUI.DomHelper.Template = function(html){
349 if(html instanceof Array){
350 html = html.join('');
351 }else if(arguments.length > 1){
352 html = Array.prototype.join.call(arguments, '');
353 }
354 /**@private*/
355 this.html = html;
356};
357Clipperz.YUI.DomHelper.Template.prototype = {
358 /**
359 * Returns an HTML fragment of this template with the specified values applied
360 * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
361 * @return {String}
362 */
363 applyTemplate : function(values){
364 if(this.compiled){
365 return this.compiled(values);
366 }
367 var empty = '';
368 var fn = function(match, index){
369 if(typeof values[index] != 'undefined'){
370 return values[index];
371 }else{
372 return empty;
373 }
374 }
375 return this.html.replace(this.re, fn);
376 },
377
378 /**
379 * The regular expression used to match template variables
380 * @type RegExp
381 * @property
382 */
383 re : /\{([\w|-]+)\}/g,
384
385 /**
386 * Compiles the template into an internal function, eliminating the RegEx overhead
387 */
388 compile : function(){
389 var body = ["this.compiled = function(values){ return ['"];
390 body.push(this.html.replace(this.re, "', values['$1'], '"));
391 body.push("'].join('');};");
392 eval(body.join(''));
393 return this;
394 },
395
396 /**
397 * Applies the supplied values to the template and inserts the new node(s) before el
398 * @param {String/HTMLElement/Element} el The context element
399 * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
400 * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element
401 * @return {HTMLElement} The new node
402 */
403 insertBefore: function(el, values, returnElement){
404 el = el.dom ? el.dom : YAHOO.util.Dom.get(el);
405 var newNode = Clipperz.YUI.DomHelper.insertHtml('beforeBegin', el, this.applyTemplate(values));
406 return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode;
407 },
408
409 /**
410 * Applies the supplied values to the template and inserts the new node(s) after el
411 * @param {String/HTMLElement/Element} el The context element
412 * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
413 * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element
414 * @return {HTMLElement} The new node
415 */
416 insertAfter : function(el, values, returnElement){
417 el = el.dom ? el.dom : YAHOO.util.Dom.get(el);
418 var newNode = Clipperz.YUI.DomHelper.insertHtml('afterEnd', el, this.applyTemplate(values));
419 return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode;
420 },
421
422 /**
423 * Applies the supplied values to the template and append the new node(s) to el
424 * @param {String/HTMLElement/Element} el The context element
425 * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
426 * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element
427 * @return {HTMLElement} The new node
428 */
429 append : function(el, values, returnElement){
430 var sanitizedValues;
431 var key;
432
433 // sanitizedValues = MochiKit.Base.map(sanitizedValues)
434//console.log("values", values);
435 sanitizedValues = {};
436 for (key in values) {
437 sanitizedValues[key] = Clipperz.Base.sanitizeString(values[key]);
438 }
439//console.log("sanitizedValues", sanitizedValues);
440 el = el.dom ? el.dom : YAHOO.util.Dom.get(el);
441 var newNode = Clipperz.YUI.DomHelper.insertHtml('beforeEnd', el, this.applyTemplate(sanitizedValues));
442 return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode;
443 },
444
445 /**
446 * Applies the supplied values to the template and overwrites the content of el with the new node(s)
447 * @param {String/HTMLElement/Element} el The context element
448 * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
449 * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element
450 * @return {HTMLElement} The new node
451 */
452 overwrite : function(el, values, returnElement){
453 el = el.dom ? el.dom : YAHOO.util.Dom.get(el);
454 el.innerHTML = '';
455 var newNode = Clipperz.YUI.DomHelper.insertHtml('beforeEnd', el, this.applyTemplate(values));
456 return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode;
457 }
458};
459/**
460 * Alias for applyTemplate
461 * @method
462 */
463Clipperz.YUI.DomHelper.Template.prototype.apply = Clipperz.YUI.DomHelper.Template.prototype.applyTemplate;
464
465YAHOO.ext.Template = Clipperz.YUI.DomHelper.Template;
diff --git a/frontend/beta/js/Clipperz/YUI/DomQuery.js b/frontend/beta/js/Clipperz/YUI/DomQuery.js
new file mode 100644
index 0000000..84aac08
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/YUI/DomQuery.js
@@ -0,0 +1,710 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29/*
30 * yui-ext 0.40
31 * Copyright(c) 2006, Jack Slocum.
32 */
33
34/**
35 * @class Ext.DomQuery
36 * Provides high performance selector/xpath processing by compiling queries into reusable functions.
37 * New pseudo classes and matchers can be plugged. It works on HTML and XML documents (if a content node is passed in).
38 * @singleton
39 */
40Ext.DomQuery = function(){
41 var cache = {}, simpleCache = {}, valueCache = {};
42 var nonSpace = /\S/;
43 var trimRe = /^\s*(.*?)\s*$/;
44 var tplRe = /\{(\d+)\}/g;
45 var modeRe = /^(\s?[\/>]\s?|\s|$)/;
46 var clsRes = {};
47
48 function child(p, index){
49 var i = 0;
50 var n = p.firstChild;
51 while(n){
52 if(n.nodeType == 1){
53 i++;
54 if(i == index){
55 return n;
56 }
57 }
58 n = n.nextSibling;
59 }
60 return null;
61 };
62
63 function next(d){
64 var n = d.nextSibling;
65 while(n && n.nodeType != 1){
66 n = n.nextSibling;
67 }
68 return n;
69 };
70
71 function prev(d){
72 var n = d.previousSibling;
73 while(n && n.nodeType != 1){
74 n = n.previousSibling;
75 }
76 return n;
77 };
78
79 function clean(d){
80 var n = d.firstChild, ni = -1;
81 while(n){
82 var nx = n.nextSibling;
83 if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
84 d.removeChild(n);
85 }else{
86 n.nodeIndex = ++ni;
87 }
88 n = nx;
89 }
90 return this;
91 };
92
93 function byClassName(c, a, v){
94 if(!v){
95 return c;
96 }
97 var re = clsRes[v];
98 if(!re){
99 re = new RegExp('(?:^|\\s)(?:' + v + ')(?:\\s|$)');
100 clsRes[v] = re;
101 }
102 var r = [];
103 for(var i = 0, ci; ci = c[i]; i++){
104 if(re.test(ci.className)){
105 r[r.length] = ci;
106 }
107 }
108 return r;
109 };
110
111 function convert(c){
112 if(c.slice){
113 return c;
114 }
115 var r = [];
116 for(var i = 0, l = c.length; i < l; i++){
117 r[r.length] = c[i];
118 }
119 return r;
120 };
121
122 function attrValue(n, attr){
123 if(!n.tagName && typeof n.length != 'undefined'){
124 n = n[0];
125 }
126 if(!n){
127 return null;
128 }
129 if(attr == 'for'){
130 return n.htmlFor;
131 }
132 if(attr == 'class' || attr == 'className'){
133 return n.className;
134 }
135 return n.getAttribute(attr) || n[attr];
136
137 };
138
139 function getNodes(ns, mode, tagName){
140 var result = [], cs;
141 if(!ns){
142 return result;
143 }
144 mode = mode ? mode.replace(trimRe, '$1') : '';
145 tagName = tagName || '*';
146 if(ns.tagName || ns == document){
147 ns = [ns];
148 }
149 if(mode != '/' && mode != '>'){
150 for(var i = 0, ni; ni = ns[i]; i++){
151 cs = ni.getElementsByTagName(tagName);
152 result = concat(result, cs);
153 }
154 }else{
155 for(var i = 0, ni; ni = ns[i]; i++){
156 var cn = ni.getElementsByTagName(tagName);
157 for(var j = 0, cj; cj = cn[j]; j++){
158 if(cj.parentNode == ni){
159 result[result.length] = cj;
160 }
161 }
162 }
163
164 }
165 return result;
166 };
167
168 function concat(a, b){
169 if(b.slice){
170 return a.concat(b);
171 }
172 for(var i = 0, l = b.length; i < l; i++){
173 a[a.length] = b[i];
174 }
175 return a;
176 }
177
178 function byTag(cs, tagName){
179 if(cs.tagName || cs == document){
180 cs = [cs];
181 }
182 if(!tagName){
183 return cs;
184 }
185 var r = []; tagName = tagName.toLowerCase();
186 for(var i = 0, ci; ci = cs[i]; i++){
187 if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){
188 r[r.length] = ci;
189 }
190 }
191 return r;
192 };
193
194 function byId(cs, attr, id){
195 if(cs.tagName || cs == document){
196 cs = [cs];
197 }
198 if(!id){
199 return cs;
200 }
201 var r = [];
202 for(var i = 0, l = cs.length; i < l; i++){
203 var ci = cs[i];
204 if(ci && ci.id == id){
205 r[r.length] = ci;
206 }
207 }
208 return r;
209 };
210
211 function byAttribute(cs, attr, value, op, custom){
212 var r = [], st = custom=='{';
213 var f = Ext.DomQuery.operators[op];
214 for(var i = 0, l = cs.length; i < l; i++){
215 var a;
216 if(st){
217 a = Ext.DomQuery.getStyle(cs[i], attr);
218 }
219 else if(attr == 'class' || attr == 'className'){
220 a = cs[i].className;
221 }else if(attr == 'for'){
222 a = cs[i].htmlFor;
223 }else{
224 a = cs[i].getAttribute(attr);
225 }
226 if((f && f(a, value)) || (!f && a)){
227 r[r.length] = cs[i];
228 }
229 }
230 return r;
231 };
232
233 function byPseudo(cs, name, value){
234 return Ext.DomQuery.pseudos[name](cs, value);
235 };
236
237 // This is for IE MSXML which does not support expandos.
238 // IE runs the same speed using setAttribute, however FF slows way down
239 // and Safari completely fails so they need to continue to use expandos.
240 // Branched at load time for faster execution.
241 var isIE = window.ActiveXObject;
242 var addAttr = isIE ?
243 function(n, a, v){
244 n.setAttribute(a, v);
245 } :
246 function(n, a, v){
247 n[a] = v;
248 };
249 var getAttr = isIE ?
250 function(n, a){
251 return n.getAttribute(a);
252 } :
253 function(n, a){
254 return n[a];
255 };
256 var clearAttr = isIE ?
257 function(n, a){
258 n.removeAttribute(a);
259 } :
260 function(n, a, v){
261 delete n[a];
262 };
263
264 function nodup(cs){
265 if(!cs.length){
266 return cs;
267 }
268 addAttr(cs[0], '_nodup', true);
269 var r = [cs[0]];
270 for(var i = 1, len = cs.length; i < len; i++){
271 var c = cs[i];
272 if(!getAttr(c, '_nodup')){
273 addAttr(c, '_nodup', true);
274 r[r.length] = c;
275 }
276 }
277 for(var i = 0, len = cs.length; i < len; i++){
278 clearAttr(cs[i], '_nodup');
279 }
280 return r;
281 }
282
283 function quickDiff(c1, c2){
284 if(!c1.length){
285 return c2;
286 }
287 for(var i = 0, len = c1.length; i < len; i++){
288 addAttr(c1[i], '_qdiff', true);
289 }
290 var r = [];
291 for(var i = 0, len = c2.length; i < len; i++){
292 if(!getAttr(c2[i], '_qdiff')){
293 r[r.length] = c2[i];
294 }
295 }
296 for(var i = 0, len = c1.length; i < len; i++){
297 clearAttr(c1[i], '_qdiff');
298 }
299 return r;
300 }
301
302 function quickId(ns, mode, root, id){
303 if(ns == root){
304 var d = root.ownerDocument || root;
305 return d.getElementById(id);
306 }
307 ns = getNodes(ns, mode, '*');
308 return byId(ns, null, id);
309 }
310
311 return {
312 getStyle : function(el, name){
313 return YAHOO.util.Dom.getStyle(el, name);
314 },
315 /**
316 * Compiles a selector/xpath query into a reusable function. The returned function
317 * takes one parameter "root" (optional), which is the context node from where the query should start.
318 * @param {String} selector The selector/xpath query
319 * @param {String} type (optional) Either 'select' (the default) or 'simple' for a simple selector match
320 * @return {Function}
321 */
322 compile : function(path, type){
323 // strip leading slashes
324 while(path.substr(0, 1)=='/'){
325 path = path.substr(1);
326 }
327 type = type || 'select';
328
329 var fn = ['var f = function(root){\n var mode; var n = root || document;\n'];
330 var q = path, mode, lq;
331 var tk = Ext.DomQuery.matchers;
332 var tklen = tk.length;
333 var mm;
334 while(q && lq != q){
335 lq = q;
336 var tm = q.match(/^(#)?([\w-\*]+)/);
337 if(type == 'select'){
338 if(tm){
339 if(tm[1] == '#'){
340 fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");';
341 }else{
342 fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");';
343 }
344 q = q.replace(tm[0], '');
345 }else{
346 fn[fn.length] = 'n = getNodes(n, mode, "*");';
347 }
348 }else{
349 if(tm){
350 if(tm[1] == '#'){
351 fn[fn.length] = 'n = byId(n, null, "'+tm[2]+'");';
352 }else{
353 fn[fn.length] = 'n = byTag(n, "'+tm[2]+'");';
354 }
355 q = q.replace(tm[0], '');
356 }
357 }
358 while(!(mm = q.match(modeRe))){
359 var matched = false;
360 for(var j = 0; j < tklen; j++){
361 var t = tk[j];
362 var m = q.match(t.re);
363 if(m){
364 fn[fn.length] = t.select.replace(tplRe, function(x, i){
365 return m[i];
366 });
367 q = q.replace(m[0], '');
368 matched = true;
369 break;
370 }
371 }
372 // prevent infinite loop on bad selector
373 if(!matched){
374 throw 'Error parsing selector, parsing failed at "' + q + '"';
375 }
376 }
377 if(mm[1]){
378 fn[fn.length] = 'mode="'+mm[1]+'";';
379 q = q.replace(mm[1], '');
380 }
381 }
382 fn[fn.length] = 'return nodup(n);\n}';
383 eval(fn.join(''));
384 return f;
385 },
386
387 /**
388 * Selects a group of elements.
389 * @param {String} selector The selector/xpath query
390 * @param {Node} root (optional) The start of the query (defaults to document).
391 * @return {Array}
392 */
393 select : function(path, root, type){
394 if(!root || root == document){
395 root = document;
396 }
397 if(typeof root == 'string'){
398 root = document.getElementById(root);
399 }
400 var paths = path.split(',');
401 var results = [];
402 for(var i = 0, len = paths.length; i < len; i++){
403 var p = paths[i].replace(trimRe, '$1');
404 if(!cache[p]){
405 cache[p] = Ext.DomQuery.compile(p);
406 if(!cache[p]){
407 throw p + ' is not a valid selector';
408 }
409 }
410 var result = cache[p](root);
411 if(result && result != document){
412 results = results.concat(result);
413 }
414 }
415 return results;
416 },
417
418 /**
419 * Selects a single element.
420 * @param {String} selector The selector/xpath query
421 * @param {Node} root (optional) The start of the query (defaults to document).
422 * @return {Element}
423 */
424 selectNode : function(path, root){
425 return Ext.DomQuery.select(path, root)[0];
426 },
427
428 /**
429 * Selects the value of a node, optionally replacing null with the defaultValue.
430 * @param {String} selector The selector/xpath query
431 * @param {Node} root (optional) The start of the query (defaults to document).
432 * @param {String} defaultValue
433 */
434 selectValue : function(path, root, defaultValue){
435 path = path.replace(trimRe, '$1');
436 if(!valueCache[path]){
437 valueCache[path] = Ext.DomQuery.compile(path, 'simple');
438 }
439 var n = valueCache[path](root);
440 n = n[0] ? n[0] : n;
441 var v = (n && n.firstChild ? n.firstChild.nodeValue : null);
442 return (v === null ? defaultValue : v);
443 },
444
445 /**
446 * Selects the value of a node, parsing integers and floats.
447 * @param {String} selector The selector/xpath query
448 * @param {Node} root (optional) The start of the query (defaults to document).
449 * @param {Number} defaultValue
450 * @return {Number}
451 */
452 selectNumber : function(path, root, defaultValue){
453 var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
454 return parseFloat(v);
455 },
456
457 /**
458 * Returns true if the passed element(s) match the passed simple selector (e.g. div.some-class or span:first-child)
459 * @param {String/HTMLElement/Array} el An element id, element or array of elements
460 * @param {String} selector The simple selector to test
461 * @return {Boolean}
462 */
463 is : function(el, ss){
464 if(typeof el == 'string'){
465 el = document.getElementById(el);
466 }
467 var isArray = (el instanceof Array);
468 var result = Ext.DomQuery.filter(isArray ? el : [el], ss);
469 return isArray ? (result.length == el.length) : (result.length > 0);
470 },
471
472 /**
473 * Filters an array of elements to only include matches of a simple selector (e.g. div.some-class or span:first-child)
474 * @param {Array} el An array of elements to filter
475 * @param {String} selector The simple selector to test
476 * @param {Boolean} nonMatches If true, it returns the elements that DON'T match
477 * the selector instead of the ones that match
478 * @return {Array}
479 */
480 filter : function(els, ss, nonMatches){
481 ss = ss.replace(trimRe, '$1');
482 if(!simpleCache[ss]){
483 simpleCache[ss] = Ext.DomQuery.compile(ss, 'simple');
484 }
485 var result = simpleCache[ss](els);
486 return nonMatches ? quickDiff(result, els) : result;
487 },
488
489 /**
490 * Collection of matching regular expressions and code snippets.
491 */
492 matchers : [{
493 re: /^\.([\w-]+)/,
494 select: 'n = byClassName(n, null, "{1}");'
495 }, {
496 re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
497 select: 'n = byPseudo(n, "{1}", "{2}");'
498 },{
499 re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
500 select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
501 }, {
502 re: /^#([\w-]+)/,
503 select: 'n = byId(n, null, "{1}");'
504 },{
505 re: /^@([\w-]+)/,
506 select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
507 }
508 ],
509
510 /**
511 * Collection of operator comparison functions. The default operators are =, !=, ^=, $=, *= and %=.
512 * New operators can be added as long as the match the format <i>c</i>= where <i>c<i> is any character other than space, &gt; &lt;.
513 */
514 operators : {
515 '=' : function(a, v){
516 return a == v;
517 },
518 '!=' : function(a, v){
519 return a != v;
520 },
521 '^=' : function(a, v){
522 return a && a.substr(0, v.length) == v;
523 },
524 '$=' : function(a, v){
525 return a && a.substr(a.length-v.length) == v;
526 },
527 '*=' : function(a, v){
528 return a && a.indexOf(v) !== -1;
529 },
530 '%=' : function(a, v){
531 return (a % v) == 0;
532 }
533 },
534
535 /**
536 * Collection of "pseudo class" processors. Each processor is passed the current nodeset (array)
537 * and the argument (if any) supplied in the selector.
538 */
539 pseudos : {
540 'first-child' : function(c){
541 var r = [];
542 for(var i = 0, l = c.length; i < l; i++){
543 var ci = c[i];
544 if(!prev(ci)){
545 r[r.length] = ci;
546 }
547 }
548 return r;
549 },
550
551 'last-child' : function(c){
552 var r = [];
553 for(var i = 0, l = c.length; i < l; i++){
554 var ci = c[i];
555 if(!next(ci)){
556 r[r.length] = ci;
557 }
558 }
559 return r;
560 },
561
562 'nth-child' : function(c, a){
563 var r = [];
564 if(a != 'odd' && a != 'even'){
565 for(var i = 0, ci; ci = c[i]; i++){
566 var m = child(ci.parentNode, a);
567 if(m == ci){
568 r[r.length] = m;
569 }
570 }
571 return r;
572 }
573 var p;
574 // first let's clean up the parent nodes
575 for(var i = 0, l = c.length; i < l; i++){
576 var cp = c[i].parentNode;
577 if(cp != p){
578 clean(cp);
579 p = cp;
580 }
581 }
582 // then lets see if we match
583 for(var i = 0, l = c.length; i < l; i++){
584 var ci = c[i], m = false;
585 if(a == 'odd'){
586 m = ((ci.nodeIndex+1) % 2 == 1);
587 }else if(a == 'even'){
588 m = ((ci.nodeIndex+1) % 2 == 0);
589 }
590 if(m){
591 r[r.length] = ci;
592 }
593 }
594 return r;
595 },
596
597 'only-child' : function(c){
598 var r = [];
599 for(var i = 0, l = c.length; i < l; i++){
600 var ci = c[i];
601 if(!prev(ci) && !next(ci)){
602 r[r.length] = ci;
603 }
604 }
605 return r;
606 },
607
608 'empty' : function(c){
609 var r = [];
610 for(var i = 0, l = c.length; i < l; i++){
611 var ci = c[i];
612 if(!ci.firstChild){
613 r[r.length] = ci;
614 }
615 }
616 return r;
617 },
618
619 'contains' : function(c, v){
620 var r = [];
621 for(var i = 0, l = c.length; i < l; i++){
622 var ci = c[i];
623 if(ci.innerHTML.indexOf(v) !== -1){
624 r[r.length] = ci;
625 }
626 }
627 return r;
628 },
629
630 'checked' : function(c){
631 var r = [];
632 for(var i = 0, l = c.length; i < l; i++){
633 if(c[i].checked == 'checked'){
634 r[r.length] = c[i];
635 }
636 }
637 return r;
638 },
639
640 'not' : function(c, ss){
641 return Ext.DomQuery.filter(c, ss, true);
642 },
643
644 'odd' : function(c){
645 return this['nth-child'](c, 'odd');
646 },
647
648 'even' : function(c){
649 return this['nth-child'](c, 'even');
650 },
651
652 'nth' : function(c, a){
653 return c[a-1];
654 },
655
656 'first' : function(c){
657 return c[0];
658 },
659
660 'last' : function(c){
661 return c[c.length-1];
662 },
663
664 'has' : function(c, ss){
665 var s = Ext.DomQuery.select;
666 var r = [];
667 for(var i = 0, ci; ci = c[i]; i++){
668 if(s(ss, ci).length > 0){
669 r[r.length] = ci;
670 }
671 }
672 return r;
673 },
674
675 'next' : function(c, ss){
676 var is = Ext.DomQuery.is;
677 var r = [];
678 for(var i = 0, ci; ci = c[i]; i++){
679 var n = next(ci);
680 if(n && is(n, ss)){
681 r[r.length] = ci;
682 }
683 }
684 return r;
685 },
686
687 'prev' : function(c, ss){
688 var is = Ext.DomQuery.is;
689 var r = [];
690 for(var i = 0, ci; ci = c[i]; i++){
691 var n = prev(ci);
692 if(n && is(n, ss)){
693 r[r.length] = ci;
694 }
695 }
696 return r;
697 }
698 }
699 };
700}();
701
702/**
703 * Selects an array of DOM nodes by CSS/XPath selector. Shorthand of {@link Ext.DomQuery#select}
704 * @param {String} path The selector/xpath query
705 * @param {Node} root (optional) The start of the query (defaults to document).
706 * @return {Array}
707 * @member Ext
708 * @method query
709 */
710Ext.query = Ext.DomQuery.select;
diff --git a/frontend/beta/js/Clipperz/YUI/Drawer.js b/frontend/beta/js/Clipperz/YUI/Drawer.js
new file mode 100644
index 0000000..394912e
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/YUI/Drawer.js
@@ -0,0 +1,238 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; }
31
32
33Clipperz.YUI.Drawer = function(anElement, aRegion) {
34 this._status = 'slideIn';
35
36 this._element = YAHOO.ext.Element.get(anElement);
37 this._region = aRegion || null;
38
39 this._collapsedElement = this.element().getChildrenByClassName("drawer-collapsed")[0];
40 this._contentElement = this.element().getChildrenByClassName("drawer-content")[0];
41
42
43 this._wholeCollapedElement = this.enhanceCollapsedElement();
44 this._wholeCollapedElement.setWidth(this.region().element().getWidth());
45 this._wholeCollapedElement.setHeight(this.region().element().getHeight());
46
47 this._contentWrapper = this.enhanceContentElement();
48 this._contentElementActor = new YAHOO.ext.Actor(this.contentWrapper().dom);
49 this.contentElementActor().hide();
50
51 this._contentWidth = 200;
52};
53
54YAHOO.extendX(Clipperz.YUI.Drawer, YAHOO.ext.util.Observable, {
55
56 'element': function() {
57 return this._element;
58 },
59
60 //-----------------------------------------------------
61
62 'status': function() {
63 return this._status;
64 },
65
66 'setStatus': function(aValue) {
67 this._status = aValue;
68 },
69
70 //-----------------------------------------------------
71
72 'collapsedElement': function() {
73 return this._collapsedElement;
74 },
75
76 //-----------------------------------------------------
77
78 'contentElement': function() {
79 return this._contentElement;
80 },
81
82 //-----------------------------------------------------
83
84 'contentElementActor': function() {
85 return this._contentElementActor;
86 },
87
88 //-----------------------------------------------------
89
90 'contentWrapper': function() {
91 return this._contentWrapper;
92 },
93
94 //-----------------------------------------------------
95
96 'contentWidth': function() {
97 return this._contentWidth;
98 },
99
100 //-----------------------------------------------------
101
102 'region': function() {
103 return this._region;
104 },
105
106 //-----------------------------------------------------
107
108 'enhanceCollapsedElement': function() {
109 varwrapper;
110 var link;
111
112 wrapper = this.collapsedElement().wrap({tag:'div', cls:'drawer-collapsedElement-wrapper', children:[
113 {tag:'div', cls:'drawer-pin-button', children:[
114 {tag:'a', cls:'drawer-pin-button', href:"#", children:[
115 {tag:'img', src:'./images/directLogins/drawer/mm-expand.gif'}
116 ]}
117 ]}
118 ]});
119
120 link = wrapper.getChildrenByClassName('drawer-pin-button', 'a')[0];
121 MochiKit.Signal.connect(link.dom, 'onclick', this, 'pinDrawer');
122
123 this.collapsedElement().setHeight('100%');
124 this.collapsedElement().setStyle('cursor', 'pointer');
125 MochiKit.Signal.connect(this.collapsedElement().dom, 'onclick', this, 'showDrawer');
126
127 return wrapper;
128 },
129
130 //-----------------------------------------------------
131
132 'enhanceContentElement': function() {
133 var wrapper;
134
135 wrapper = this.contentElement().wrap({tag:'div', cls:'drawer-content-wrapper', children:[
136 {tag:'div', cls:'drawer-content-header', html:'direct login', style:'width:100%;'}
137 ]});
138
139 MochiKit.Signal.connect(wrapper.dom, 'onclick', this, 'hideDrawer');
140 return wrapper;
141 },
142
143 //-----------------------------------------------------
144
145 'pinDrawer': function() {
146 alert("pin drawer");
147 },
148
149 //-----------------------------------------------------
150
151 'showDrawer': function() {
152 if (this.status() == 'slideIn') {
153 var actor;
154
155 this.setStatus('slidingOut');
156 actor = this.contentElementActor();
157 actor.setHeight(this.region().element().getHeight());
158
159 actor.startCapture(true);
160 actor.alignTo(this.element(), 'tr');
161 actor.blindShow('left', this.contentWidth(), .35);
162 actor.play(this.onSlideOut.createDelegate(this));
163 }
164 },
165
166 //-----------------------------------------------------
167
168 'onSlideOut': function() {
169 this.setStatus('slideOut');
170MochiKit.Logging.logDebug(">>> onSlideOut");
171 // alert("done");
172 },
173
174 //-----------------------------------------------------
175/*
176 'showContentElement': function() {
177 var top, left, width, height;
178
179MochiKit.Logging.logDebug(">>> showContentElement");
180
181
182 top = this.element().getTop(true);
183 left = this.element().getRight();
184 width = this.contentWidth();
185 height = this.element().getHeight();
186
187 this.contentWrapper().setStyle('position', 'absolute');
188 this.contentWrapper().setStyle('overflow', 'none');
189 this.contentWrapper().setStyle('visibility', 'visible');
190 this.contentWrapper().setStyle('z-index', '10');
191
192 this.contentWrapper().setLeft(left);
193 this.contentWrapper().setTop(top);
194 this.contentWrapper().setHeight(height);
195 this.contentWrapper().setWidth(width);
196
197 this.contentWrapper().show();
198 },
199 */
200 //-----------------------------------------------------
201
202 'hideDrawer': function() {
203 if (this.status() == 'slideOut') {
204 var actor;
205
206 this.setStatus('slidingIn');
207
208 actor = this.contentElementActor();
209 actor.setHeight(this.region().element().getHeight());
210
211 actor.startCapture(true);
212 actor.alignTo(this.element(), 'tr');
213 actor.blindHide('left', .35);
214 actor.setVisible(false);
215 actor.play(this.onSlideIn.createDelegate(this));
216 }
217 },
218
219 //-----------------------------------------------------
220
221 'onSlideIn': function() {
222 this.setStatus('slideIn');
223MochiKit.Logging.logDebug(">>> onSlideIn");
224 // alert("done");
225 },
226
227 //-----------------------------------------------------
228
229 'hideContentElement': function() {
230 this.contentWrapper().hide();
231 },
232
233 //-----------------------------------------------------
234 //-----------------------------------------------------
235
236 //-----------------------------------------------------
237 __syntaxFix__: '__syntaxFix__'
238}); \ No newline at end of file
diff --git a/frontend/beta/js/Clipperz/YUI/IBLayoutManager.js b/frontend/beta/js/Clipperz/YUI/IBLayoutManager.js
new file mode 100644
index 0000000..626b699
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/YUI/IBLayoutManager.js
@@ -0,0 +1,114 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; }
31
32
33Clipperz.YUI.IBLayoutManager = function(container, config) {
34 var regionName;
35 varelement;
36
37 config = config || {};
38
39 Clipperz.YUI.IBLayoutManager.superclass.constructor.call(this, container);
40 this.hideOnLayout = config.hideOnLayout || false;
41
42 element = YAHOO.ext.Element.get(container);
43 element.setStyle('position', 'absolute');
44 element.setStyle('overflow', 'hidden');
45
46 for (regionName in config.regions) {
47 var newRegion;
48
49 newRegion = new new Clipperz.YUI.IBLayoutRegion(this, regionName, config.regions[regionName]);
50 this.addRegion(regionName, newRegion);
51 }
52
53 this.layout();
54};
55
56YAHOO.extendX(Clipperz.YUI.IBLayoutManager, YAHOO.ext.LayoutManager, {
57
58 'toString': function() {
59 return "IBLayoutManager (" + this.el.id + ")";
60 },
61
62 //-----------------------------------------------------
63
64 'add': function(aName, aPanel) {
65 var regionName;
66
67 regionName = aName.toLowerCase();
68 return this.regions[regionName].add(aPanel);
69 },
70
71 //-----------------------------------------------------
72
73 'addRegion': function(aRegion) {
74 var regionName;
75
76 regionName = aRegion.name().toLowerCase();
77 if (!this.regions[regionName]) {
78//MochiKit.Logging.logDebug("--- adding region with name: " + aRegion.name());
79 this.regions[regionName] = aRegion;
80 } else {
81 // ????
82 }
83
84 return aRegion;
85 },
86
87 //-----------------------------------------------------
88
89 'getRegion': function(target){
90 return this.regions[target.toLowerCase()];
91 },
92
93 //-----------------------------------------------------
94
95 'layout': function(){
96 varregion;
97
98//MochiKit.Logging.logDebug(">>> IBLayoutManager.layout - regions: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(this.regions)));
99 for (region in this.regions) {
100//MochiKit.Logging.logDebug("--- IBLayoutManager.layout - region: " + region);
101 this.regions[region].layout();
102 }
103//MochiKit.Logging.logDebug("<<< IBLayoutManager.layout");
104 },
105
106 //-----------------------------------------------------
107
108 'getSize': function() {
109 return this.el.getSize();
110 },
111
112 //-----------------------------------------------------
113 __syntaxFix__: '__syntaxFix__'
114});
diff --git a/frontend/beta/js/Clipperz/YUI/IBLayoutRegion.js b/frontend/beta/js/Clipperz/YUI/IBLayoutRegion.js
new file mode 100644
index 0000000..2fd4377
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/YUI/IBLayoutRegion.js
@@ -0,0 +1,249 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; }
31
32
33Clipperz.YUI.IBLayoutRegion = function(aManager, aName, aConfig) {
34 this._configuration = aConfig;
35
36 //Clipperz.YUI.IBLayoutRegion.superclass.constructor.call();
37 Clipperz.YUI.IBLayoutRegion.superclass.constructor.call(this, aManager, aConfig, aName);
38};
39
40YAHOO.extendX(Clipperz.YUI.IBLayoutRegion, YAHOO.ext.LayoutRegion, {
41
42 'toString': function() {
43 return "IBLayoutRegion (" + this.name() + ")";
44 },
45
46 //-----------------------------------------------------
47
48 'name': function() {
49 return this.position;
50 },
51
52 //-----------------------------------------------------
53
54 'manager': function() {
55 return this.mgr;
56 },
57
58 'configuration': function() {
59 return this._configuration;
60 },
61
62 //-----------------------------------------------------
63
64 'getAttributeValue': function(anAttribute) {
65 var result;
66
67 switch(anAttribute) {
68 case "top":
69 result = this.element().getTop();
70 break;
71 case "left":
72 result = this.element().getLeft();
73 break;
74 case "bottom":
75 result = this.element().getBottom();
76 break;
77 case "right":
78 result = this.element().getRight();
79 break;
80 case "height":
81 result = this.element().getHeight();
82 break;
83 case "width":
84 result = this.element().getWidth();
85 break;
86 }
87//MochiKit.Logging.logDebug("--- " + this.name() + " [" + anAttribute + "] = " + result);
88
89 return result;
90 },
91
92 //-----------------------------------------------------
93
94 'normalizeConfigureValue': function(aConfigurationValue) {
95 var result;
96
97//MochiKit.Logging.logDebug("--- normalizeConfigureValue - " + aConfigurationValue);
98 if (typeof(aConfigurationValue) == 'number') {
99 result = aConfigurationValue;
100 } else if (aConfigurationValue == 'auto') {
101 result = aConfigurationValue;
102 } else {
103 var splitValues;
104 var referenceValue;
105 var deltaValue;
106 var targetRegion;
107 var targetAttribute;
108
109 splitValues = aConfigurationValue.split('+');
110 referenceValue = Clipperz.Base.trim(splitValues[0]);
111 deltaValue = Clipperz.Base.trim(splitValues[1] || "");
112
113 splitValues = referenceValue.split('.');
114 targetRegion = splitValues[0];
115 targetAttribute = splitValues[1];
116
117//MochiKit.Logging.logDebug("> " + aConfigurationValue);
118//MochiKit.Logging.logDebug(">> manager: " + this.manager());
119//MochiKit.Logging.logDebug(">> targetRegion: " + targetRegion);
120//MochiKit.Logging.logDebug(">>> " + this.manager().getRegion(targetRegion));
121 targetValue = this.manager().getRegion(targetRegion).getAttributeValue(targetAttribute);
122//MochiKit.Logging.logDebug(">>>> " + targetRegion + "." + targetAttribute + " + " + deltaValue + " = " + targetValue);
123
124 result = targetValue + (deltaValue - 0);
125
126//MochiKit.Logging.logDebug("<<< " + aConfigurationValue + " = " + result);
127 }
128
129 return result;
130 },
131
132 'normalizedConfiguration': function(aConfiguration) {
133 varresult;
134 varkey;
135
136 result = {};
137
138//MochiKit.Logging.logDebug("--- normalizedConfiguration - keys: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(aConfiguration)));
139 for (key in aConfiguration) {
140 if ((key == 'top') || (key == 'bottom') || (key == 'left') || (key == 'rigth') || (key == 'width') || (key == 'height')) {
141 result[key] = this.normalizeConfigureValue(aConfiguration[key]);
142 } else {
143 result[key] = aConfiguration[key];
144 }
145 }
146
147 return result;
148 },
149
150 //-----------------------------------------------------
151
152 'element': function() {
153 return this.el;
154 },
155
156 //-----------------------------------------------------
157/*
158 'hide': function() {
159MochiKit.Logging.logDebug(">>> IBLayoutManager.hide()")
160 Clipperz.YUI.IBLayoutRegion.superclass.hide.call(this);
161 },
162*/
163 //-----------------------------------------------------
164/*
165 'add': function(aPanel) {
166 Clipperz.YUI.IBLayoutRegion.superclass.add.call(this, aPanel);
167 aPanel.el.fitToParent(true);
168 },
169*/
170 //-----------------------------------------------------
171
172 'updateBox': function(aBox) {
173//MochiKit.Logging.logDebug(">>> IBLayoutRegion.updateBox - " + aBox);
174 Clipperz.YUI.IBLayoutRegion.superclass.updateBox.call(this, aBox);
175 },
176
177 //-----------------------------------------------------
178
179 'layout': function() {
180 vartop, left, bottom, right, width, height;
181 varelement;
182 var config;
183 var windowSize;
184 var containerSize;
185
186//MochiKit.Logging.logDebug(">>> IBLayoutRegion.layout - " + this);
187 config = this.normalizedConfiguration(this.configuration());
188 element = this.element();
189 // containerSize = this.manager().getSize(true);
190 containerSize = this.manager().getSize(false);
191 windowSize = {width: YAHOO.util.Dom.getViewportWidth(), height: YAHOO.util.Dom.getViewportHeight()};
192
193 // element.setStyle("position", "absolute");
194 // element.setStyle("overflow", "none");
195
196 if (typeof(config.top) == 'number') {
197 top = config.top;
198
199 if (typeof(config.bottom) == 'number') {
200 height = containerSize.height - top - config.bottom;
201 } else if (typeof(config.height) == 'number') {
202 height = config.height;
203 } else {
204 //???
205 }
206 } else {
207 if ((typeof(config.bottom) == 'number') && (typeof(config.height) == 'number')) {
208 top = containerSize.height - (config.height + config.bottom);
209 height = config.height;
210 } else if ((config.bottom == 'auto') && (typeof(config.height) == 'number')) {
211 top = ((containerSize.height - config.height) / 2);
212 height = config.height;
213 }
214 }
215
216 if (typeof(config.left) == 'number') {
217 left = config.left;
218
219 if (typeof(config.right) == 'number') {
220 width = (containerSize.width - left - config.right);
221 } else if (typeof(config.width) == 'number') {
222 width = config.width;
223 } else {
224 //???
225 }
226 } else {
227 if ((typeof(config.right) == 'number') && (typeof(config.width) == 'number')) {
228 left = containerSize.width - (config.width + config.right);
229 width = config.width;
230 } else if ((config.right == 'auto') && (typeof(config.width) == 'number')) {
231 left = ((containerSize.width - config.width) / 2);
232 width = config.width;
233 }
234 }
235//MochiKit.Logging.logDebug("--- setting position (top: " + top + ", left: " + left + ", width: " + width + ", height: " + height + ")");
236 element.setTop(top);
237 element.setLeft(left);
238 element.setWidth(width);
239 element.setHeight(height);
240
241 if (this.activePanel != null) {
242 this.activePanel.setSize(width, height);
243 }
244//MochiKit.Logging.logDebug("<<< IBLayoutRegion.layout");
245 },
246
247 //-----------------------------------------------------
248 __syntaxFix__: '__syntaxFix__'
249});
diff --git a/frontend/beta/js/Clipperz/YUI/MessageBox.js b/frontend/beta/js/Clipperz/YUI/MessageBox.js
new file mode 100644
index 0000000..ec33d7d
--- a/dev/null
+++ b/frontend/beta/js/Clipperz/YUI/MessageBox.js
@@ -0,0 +1,265 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
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
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 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
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29Clipperz.YUI.MessageBox = function(){
30 var dlg, opt, mask;
31 var bodyEl, msgEl, textboxEl, textareaEl, progressEl, pp;
32 var buttons, activeTextEl, bwidth;
33
34 var handleButton = function(button){
35 if(typeof opt.fn == 'function'){
36 if(opt.fn.call(opt.scope||window, button, activeTextEl.dom.value) !== false){
37 dlg.hide();
38 }
39 }else{
40 dlg.hide();
41 }
42 };
43
44 return {
45 updateButtons: function(b){
46 var width = 0;
47 if(!b){
48 buttons['ok'].hide();
49 buttons['cancel'].hide();
50 buttons['yes'].hide();
51 buttons['no'].hide();
52 return width;
53 }
54 for(var k in buttons){
55 if(typeof buttons[k] != 'function'){
56 if(b[k]){
57 buttons[k].show();
58 buttons[k].setText(typeof b[k] == 'string' ? b[k] : YAHOO.ext.MessageBox.buttonText[k]);
59 width += buttons[k].el.getWidth()+15;
60 }else{
61 buttons[k].hide();
62 }
63 }
64 }
65 return width;
66 },
67
68 getDialog : function(){
69 if(!dlg){
70 dlg = new YAHOO.ext.BasicDialog('mb-dlg', {
71 autoCreate:true,
72 shadow:true,
73 draggable:true,
74 resizable:false,
75 constraintoviewport:true,
76 fixedcenter:true,
77 shim:true,
78 modal:true,
79 width:400, height:100,
80 buttonAlign:'center',
81 closeClick : function(){
82 if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){
83 handleButton('no');
84 }else{
85 handleButton('cancel');
86 }
87 }
88 });
89 dlg.closeClick = function(){
90 alert('wtf');
91 };
92 mask = dlg.mask;
93 dlg.addKeyListener(27, dlg.hide, dlg);
94 buttons = {};
95 buttons['ok'] = dlg.addButton(this.buttonText['ok'], handleButton.createCallback('ok'));
96 buttons['yes'] = dlg.addButton(this.buttonText['yes'], handleButton.createCallback('yes'));
97 buttons['no'] = dlg.addButton(this.buttonText['no'], handleButton.createCallback('no'));
98 buttons['cancel'] = dlg.addButton(this.buttonText['cancel'], handleButton.createCallback('cancel'));
99 bodyEl = dlg.body.createChild({
100 tag:'div',
101 html:'<span class="ext-mb-text"></span><br /><input type="text" class="ext-mb-input"><textarea class="ext-mb-textarea"></textarea><div class="ext-mb-progress-wrap"><div class="ext-mb-progress"><div class="ext-mb-progress-bar">&#160;</div></div></div>'
102 });
103 msgEl = bodyEl.dom.firstChild;
104 textboxEl = getEl(bodyEl.dom.childNodes[2]);
105 textboxEl.enableDisplayMode();
106 textboxEl.addKeyListener([10,13], function(){
107 if(dlg.isVisible() && opt && opt.buttons){
108 if(opt.buttons.ok){
109 handleButton('ok');
110 }else if(opt.buttons.yes){
111 handleButton('yes');
112 }
113 }
114 });
115 textareaEl = getEl(bodyEl.dom.childNodes[3]);
116 textareaEl.enableDisplayMode();
117 progressEl = getEl(bodyEl.dom.childNodes[4]);
118 progressEl.enableDisplayMode();
119 pp = getEl(progressEl.dom.firstChild.firstChild);
120 }
121 return dlg;
122 },
123
124 updateText : function(text){
125 if(!dlg.isVisible() && !opt.width){
126 dlg.resizeTo(this.maxWidth, 100); // resize first so content is never clipped from previous shows
127 }
128 msgEl.innerHTML = text;
129 var w = Math.max(Math.min(opt.width || msgEl.offsetWidth, this.maxWidth),
130 Math.max(opt.minWidth || this.minWidth, bwidth));
131 if(opt.prompt){
132 activeTextEl.setWidth(w);
133 }
134 dlg.setContentSize(w, bodyEl.getHeight());
135 },
136
137 updateProgress : function(value, text){
138 if(text){
139 this.updateText(text);
140 }
141 pp.setWidth(value*progressEl.dom.firstChild.offsetWidth);
142 },
143
144 isVisible : function(){
145 return dlg && dlg.isVisible();
146 },
147
148 hide : function(){
149 if(this.isVisible()){
150 dlg.hide();
151 }
152 },
153
154 show : function(options){
155 var d = this.getDialog();
156 opt = options;
157 d.setTitle(opt.title || '&#160;');
158 d.close.setDisplayed(opt.closable !== false);
159 activeTextEl = textboxEl;
160 opt.prompt = opt.prompt || (opt.multiline ? true : false)
161 if(opt.prompt){
162 if(opt.multiline){
163 textboxEl.hide();
164 textareaEl.show();
165 textareaEl.setHeight(typeof opt.multiline == 'number' ?
166 opt.multiline : this.defaultTextHeight);
167 activeTextEl = textareaEl;
168 }else{
169 textboxEl.show();
170 textareaEl.hide();
171 }
172 }else{
173 textboxEl.hide();
174 textareaEl.hide();
175 }
176 progressEl.setDisplayed(opt.progress === true);
177 this.updateProgress(0);
178 activeTextEl.dom.value = opt.value || '';
179 if(opt.prompt){
180 dlg.setDefaultButton(activeTextEl);
181 }else{
182 var bs = opt.buttons;
183 var db = null;
184 if(bs && bs.ok){
185 db = buttons['ok'];
186 }else if(bs && bs.yes){
187 db = buttons['yes'];
188 }
189 dlg.setDefaultButton(db);
190 }
191 bwidth = this.updateButtons(opt.buttons);
192 this.updateText(opt.msg);
193 d.modal = opt.modal !== false;
194 d.mask = opt.modal !== false ? mask : false;
195 d.animateTarget = null;
196 d.show(options.animEl);
197 },
198
199 progress : function(title, msg){
200 this.show({
201 title : title,
202 msg : msg,
203 buttons: false,
204 progress:true,
205 closable:false
206 });
207 },
208
209 progressElement : function() {
210 return progressEl;
211 },
212
213 opt: function() {
214 return opt;
215 },
216
217 alert : function(title, msg, fn, scope){
218 this.show({
219 title : title,
220 msg : msg,
221 buttons: this.OK,
222 fn: fn,
223 scope : scope
224 });
225 },
226
227 confirm : function(title, msg, fn, scope){
228 this.show({
229 title : title,
230 msg : msg,
231 buttons: this.YESNO,
232 fn: fn,
233 scope : scope
234 });
235 },
236
237 prompt : function(title, msg, fn, scope, multiline){
238 this.show({
239 title : title,
240 msg : msg,
241 buttons: this.OKCANCEL,
242 fn: fn,
243 minWidth:250,
244 scope : scope,
245 prompt:true,
246 multiline: multiline
247 });
248 },
249
250 OK : {ok:true},
251 YESNO : {yes:true, no:true},
252 OKCANCEL : {ok:true, cancel:true},
253 YESNOCANCEL : {yes:true, no:true, cancel:true},
254
255 defaultTextHeight:75,
256 maxWidth : 500,
257 minWidth : 100,
258 buttonText : {
259 ok : 'OK',
260 cancel : 'Cancel',
261 yes : 'Yes',
262 no : 'No'
263 }
264 };
265}();