summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/KeePassExportProcessor.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/KeePassExportProcessor.js') (more/less context) (show whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/KeePassExportProcessor.js15
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/gamma/js/Clipperz/KeePassExportProcessor.js b/frontend/gamma/js/Clipperz/KeePassExportProcessor.js
index 06ab5a8..a3c10c8 100644
--- a/frontend/gamma/js/Clipperz/KeePassExportProcessor.js
+++ b/frontend/gamma/js/Clipperz/KeePassExportProcessor.js
@@ -1,120 +1,117 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30 27
31 28
32Clipperz.KeePassExportProcessor = function(args) { 29Clipperz.KeePassExportProcessor = function(args) {
33 args = args || {}; 30 args = args || {};
34 31
35 return this; 32 return this;
36} 33}
37 34
38//============================================================================= 35//=============================================================================
39 36
40Clipperz.KeePassExportProcessor.prototype = MochiKit.Base.update(null, { 37Clipperz.KeePassExportProcessor.prototype = MochiKit.Base.update(null, {
41 38
42 //------------------------------------------------------------------------- 39 //-------------------------------------------------------------------------
43 40
44 'deferredParse_core': function(aContext) { 41 'deferredParse_core': function(aContext) {
45 var deferredResult; 42 var deferredResult;
46 43
47 if (aContext.line == "") { 44 if (aContext.line == "") {
48 deferredResult = MochiKit.Async.succeed(aContext.result); 45 deferredResult = MochiKit.Async.succeed(aContext.result);
49 } else { 46 } else {
50 var record; 47 var record;
51 48
52 record = this.parseRecord(aContext); 49 record = this.parseRecord(aContext);
53 if (record != null) { 50 if (record != null) {
54 aContext.result.push(record); 51 aContext.result.push(record);
55 } 52 }
56 53
57 aContext.line = aContext.line.replace(/^\n*/g, "").replace(/\n$/g, ""); 54 aContext.line = aContext.line.replace(/^\n*/g, "").replace(/\n$/g, "");
58 55
59 deferredResult = new Clipperz.Async.Deferred("KeePassExportProcessor.deferredParse_core"); 56 deferredResult = new Clipperz.Async.Deferred("KeePassExportProcessor.deferredParse_core");
60 deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'importProcessorProgressUpdate', {status:'processing', size:aContext.size, progress:(aContext.size - aContext.line.length)}); 57 deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'importProcessorProgressUpdate', {status:'processing', size:aContext.size, progress:(aContext.size - aContext.line.length)});
61 deferredResult.addCallback(MochiKit.Async.wait, 0.2); 58 deferredResult.addCallback(MochiKit.Async.wait, 0.2);
62 deferredResult.addMethod(this, 'deferredParse_core'); 59 deferredResult.addMethod(this, 'deferredParse_core');
63 deferredResult.callback(aContext); 60 deferredResult.callback(aContext);
64 } 61 }
65 62
66 return deferredResult; 63 return deferredResult;
67 }, 64 },
68 65
69 //......................................................................... 66 //.........................................................................
70 67
71 'deferredParse': function(aValue) { 68 'deferredParse': function(aValue) {
72 var deferredResult; 69 var deferredResult;
73 var lines; 70 var lines;
74 var context; 71 var context;
75 72
76 lines = aValue.replace(/\r?\n/g, "\n"); 73 lines = aValue.replace(/\r?\n/g, "\n");
77 context = { 74 context = {
78 line: lines, 75 line: lines,
79 size: lines.length, 76 size: lines.length,
80 result: [] 77 result: []
81 } 78 }
82 79
83 deferredResult = new Clipperz.Async.Deferred("KeePassExportProcessor.deferredResult"); 80 deferredResult = new Clipperz.Async.Deferred("KeePassExportProcessor.deferredResult");
84 deferredResult.addMethod(this, 'deferredParse_core'); 81 deferredResult.addMethod(this, 'deferredParse_core');
85 deferredResult.callback(context); 82 deferredResult.callback(context);
86 83
87 return deferredResult; 84 return deferredResult;
88 }, 85 },
89 86
90 //------------------------------------------------------------------------- 87 //-------------------------------------------------------------------------
91 88
92 'parseRecord': function(aContext) { 89 'parseRecord': function(aContext) {
93 var result; 90 var result;
94 var recordLabelRegexp; 91 var recordLabelRegexp;
95 varfieldLabelRegexp; 92 varfieldLabelRegexp;
96 var fieldValueRegexp; 93 var fieldValueRegexp;
97 var fullLineRegexp; 94 var fullLineRegexp;
98/* 95/*
99[Record name] 96[Record name]
100Group Tree: 97Group Tree:
101UserName: 98UserName:
102URL: 99URL:
103Password: 100Password:
104Notes: test 101Notes: test
105UUID: 525f62430079bae48b79ed2961924b05 102UUID: 525f62430079bae48b79ed2961924b05
106Icon: 0 103Icon: 0
107Creation Time: 2007-06-26 17:56:03 104Creation Time: 2007-06-26 17:56:03
108Last Access: 2007-10-25 16:23:51 105Last Access: 2007-10-25 16:23:51
109Last Modification: 2007-10-25 16:23:51 106Last Modification: 2007-10-25 16:23:51
110Expires: 2999-12-28 23:59:59 107Expires: 2999-12-28 23:59:59
111 108
112 [Record name] ==> Title 109 [Record name] ==> Title
113 Group: General ==> Group 110 Group: General ==> Group
114 Group Tree: ==> Group Tree 111 Group Tree: ==> Group Tree
115 UserName: ==> UserName 112 UserName: ==> UserName
116 URL: ==>URL 113 URL: ==>URL
117 Password: ==>Password 114 Password: ==>Password
118 Notes: test ==>Notes 115 Notes: test ==>Notes
119 UUID: 525f62430079bae48b79ed2961924b05 ==>UUID 116 UUID: 525f62430079bae48b79ed2961924b05 ==>UUID
120 Icon: 0 ==>Icon 117 Icon: 0 ==>Icon