author | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
commit | 07d0357beef5d9328a2dd8d07ad7b39c87ac55e4 (patch) (unidiff) | |
tree | f7a4aed8848302db153c2a211f8e58b944eb4c5b /frontend/beta/js/Clipperz/KeePassExportProcessor.js | |
parent | 767a3dcf48b6ac911c088af5dd7738a728eb6b99 (diff) | |
download | clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.zip clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.gz clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.bz2 |
Updated Copyright claims
- updated reference dates;
- removed reference to Community Edition;
- normalized logging using Clipperz.log[Warn|Error|Debug]
Diffstat (limited to 'frontend/beta/js/Clipperz/KeePassExportProcessor.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/KeePassExportProcessor.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/KeePassExportProcessor.js b/frontend/beta/js/Clipperz/KeePassExportProcessor.js index 74d36ca..7a32f3f 100644 --- a/frontend/beta/js/Clipperz/KeePassExportProcessor.js +++ b/frontend/beta/js/Clipperz/KeePassExportProcessor.js | |||
@@ -1,118 +1,116 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | 25 | ||
28 | 26 | ||
29 | Clipperz.KeePassExportProcessor = function(args) { | 27 | Clipperz.KeePassExportProcessor = function(args) { |
30 | args = args || {}; | 28 | args = args || {}; |
31 | 29 | ||
32 | return this; | 30 | return this; |
33 | } | 31 | } |
34 | 32 | ||
35 | //============================================================================= | 33 | //============================================================================= |
36 | 34 | ||
37 | Clipperz.KeePassExportProcessor.prototype = MochiKit.Base.update(null, { | 35 | Clipperz.KeePassExportProcessor.prototype = MochiKit.Base.update(null, { |
38 | 36 | ||
39 | //------------------------------------------------------------------------- | 37 | //------------------------------------------------------------------------- |
40 | /* | 38 | /* |
41 | 'parse': function(aValue) { | 39 | 'parse': function(aValue) { |
42 | var result; | 40 | var result; |
43 | 41 | ||
44 | //MochiKit.Logging.logDebug(">>> KeePassExportProcessor.parse"); | 42 | //MochiKit.Logging.logDebug(">>> KeePassExportProcessor.parse"); |
45 | result = []; | 43 | result = []; |
46 | //MochiKit.Logging.logDebug("--- KeePassExportProcessor.parse - result: " + Clipperz.Base.serializeJSON(result)); | 44 | //MochiKit.Logging.logDebug("--- KeePassExportProcessor.parse - result: " + Clipperz.Base.serializeJSON(result)); |
47 | //MochiKit.Logging.logDebug("<<< KeePassExportProcessor.parse"); | 45 | //MochiKit.Logging.logDebug("<<< KeePassExportProcessor.parse"); |
48 | 46 | ||
49 | return result; | 47 | return result; |
50 | }, | 48 | }, |
51 | */ | 49 | */ |
52 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
53 | 51 | ||
54 | 'deferredParse_core': function(aContext) { | 52 | 'deferredParse_core': function(aContext) { |
55 | var deferredResult; | 53 | var deferredResult; |
56 | 54 | ||
57 | //MochiKit.Logging.logDebug(">>> KeePassExportProcessor.deferredParse_core"); | 55 | //MochiKit.Logging.logDebug(">>> KeePassExportProcessor.deferredParse_core"); |
58 | //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse_core - (1) aContext.line: " + aContext.line.replace(/\n/g, "\\n").substring(0,50)); | 56 | //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse_core - (1) aContext.line: " + aContext.line.replace(/\n/g, "\\n").substring(0,50)); |
59 | //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse_core - aContext: " + Clipperz.Base.serializeJSON(aContext).substring(0,50)); | 57 | //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse_core - aContext: " + Clipperz.Base.serializeJSON(aContext).substring(0,50)); |
60 | //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse_core - (2) aContext.line: " + aContext.line.replace(/\n/g, "\\n").substring(0,50)); | 58 | //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse_core - (2) aContext.line: " + aContext.line.replace(/\n/g, "\\n").substring(0,50)); |
61 | //console.log("deferredParse_core - aContext", aContext); | 59 | //console.log("deferredParse_core - aContext", aContext); |
62 | //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse_core - (3) aContext.line: " + aContext.line.replace(/\n/g, "\\n").substring(0,50)); | 60 | //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse_core - (3) aContext.line: " + aContext.line.replace(/\n/g, "\\n").substring(0,50)); |
63 | if (aContext.line == "") { | 61 | if (aContext.line == "") { |
64 | deferredResult = MochiKit.Async.succeed(aContext.result); | 62 | deferredResult = MochiKit.Async.succeed(aContext.result); |
65 | } else { | 63 | } else { |
66 | var record; | 64 | var record; |
67 | 65 | ||
68 | record = this.parseRecord(aContext); | 66 | record = this.parseRecord(aContext); |
69 | if (record != null) { | 67 | if (record != null) { |
70 | aContext.result.push(record); | 68 | aContext.result.push(record); |
71 | } | 69 | } |
72 | 70 | ||
73 | //MochiKit.Logging.logDebug("--> KeePassExportProcessor.deferredParse_core - aContext.line: " + aContext.line.replace(/\n/g, "\\n").substring(0,50)); | 71 | //MochiKit.Logging.logDebug("--> KeePassExportProcessor.deferredParse_core - aContext.line: " + aContext.line.replace(/\n/g, "\\n").substring(0,50)); |
74 | aContext.line = aContext.line.replace(/^\n*/g, "").replace(/\n$/g, ""); | 72 | aContext.line = aContext.line.replace(/^\n*/g, "").replace(/\n$/g, ""); |
75 | //MochiKit.Logging.logDebug("<-- KeePassExportProcessor.deferredParse_core - aContext.line: " + aContext.line.replace(/\n/g, "\\n").substring(0,50)); | 73 | //MochiKit.Logging.logDebug("<-- KeePassExportProcessor.deferredParse_core - aContext.line: " + aContext.line.replace(/\n/g, "\\n").substring(0,50)); |
76 | 74 | ||
77 | deferredResult = new MochiKit.Async.Deferred(); | 75 | deferredResult = new MochiKit.Async.Deferred(); |
78 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse_core - 1.1 " + res); return res;}); | 76 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse_core - 1.1 " + res); return res;}); |
79 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'importProcessorProgressUpdate', {status:'processing', size:aContext.size, progress:(aContext.size - aContext.line.length)}); | 77 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'importProcessorProgressUpdate', {status:'processing', size:aContext.size, progress:(aContext.size - aContext.line.length)}); |
80 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse_core - 1.2 " + res); return res;}); | 78 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse_core - 1.2 " + res); return res;}); |
81 | deferredResult.addCallback(MochiKit.Async.wait, 0.2); | 79 | deferredResult.addCallback(MochiKit.Async.wait, 0.2); |
82 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse_core - 1.3 " + res); return res;}); | 80 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse_core - 1.3 " + res); return res;}); |
83 | //deferredResult.addBoth(function(res) {console.log("KeePassExportProcessor.deferredParse_core - 1.3 ", res); return res;}); | 81 | //deferredResult.addBoth(function(res) {console.log("KeePassExportProcessor.deferredParse_core - 1.3 ", res); return res;}); |
84 | deferredResult.addCallback(MochiKit.Base.method(this, 'deferredParse_core')) | 82 | deferredResult.addCallback(MochiKit.Base.method(this, 'deferredParse_core')) |
85 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse_core - 1.4 " + res); return res;}); | 83 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse_core - 1.4 " + res); return res;}); |
86 | deferredResult.callback(aContext); | 84 | deferredResult.callback(aContext); |
87 | } | 85 | } |
88 | //MochiKit.Logging.logDebug("<<< KeePassExportProcessor.deferredParse_core"); | 86 | //MochiKit.Logging.logDebug("<<< KeePassExportProcessor.deferredParse_core"); |
89 | 87 | ||
90 | return deferredResult; | 88 | return deferredResult; |
91 | }, | 89 | }, |
92 | 90 | ||
93 | //......................................................................... | 91 | //......................................................................... |
94 | 92 | ||
95 | 'deferredParse': function(aValue) { | 93 | 'deferredParse': function(aValue) { |
96 | var deferredResult; | 94 | var deferredResult; |
97 | var lines; | 95 | var lines; |
98 | var context; | 96 | var context; |
99 | 97 | ||
100 | //MochiKit.Logging.logDebug(">>> KeePassExportProcessor.deferredParse"); | 98 | //MochiKit.Logging.logDebug(">>> KeePassExportProcessor.deferredParse"); |
101 | //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse - aValue: " + aValue.length); | 99 | //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse - aValue: " + aValue.length); |
102 | lines = aValue.replace(/\r?\n/g, "\n"); | 100 | lines = aValue.replace(/\r?\n/g, "\n"); |
103 | //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse - lines: " + lines.length); | 101 | //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse - lines: " + lines.length); |
104 | context = { | 102 | context = { |
105 | line: lines, | 103 | line: lines, |
106 | size: lines.length, | 104 | size: lines.length, |
107 | result: [] | 105 | result: [] |
108 | } | 106 | } |
109 | //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse - context: " + Clipperz.Base.serializeJSON(context).substring(0,50)); | 107 | //MochiKit.Logging.logDebug("--- KeePassExportProcessor.deferredParse - context: " + Clipperz.Base.serializeJSON(context).substring(0,50)); |
110 | //console.log("--- KeePassExportProcessor.deferredParse - context: ", context); | 108 | //console.log("--- KeePassExportProcessor.deferredParse - context: ", context); |
111 | 109 | ||
112 | deferredResult = new MochiKit.Async.Deferred(); | 110 | deferredResult = new MochiKit.Async.Deferred(); |
113 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse - 1 " + res); return res;}); | 111 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse - 1 " + res); return res;}); |
114 | //deferredResult.addBoth(function(res) {console.log("KeePassExportProcessor.deferredParse - 1 ", res); return res;}); | 112 | //deferredResult.addBoth(function(res) {console.log("KeePassExportProcessor.deferredParse - 1 ", res); return res;}); |
115 | deferredResult.addCallback(MochiKit.Base.method(this, 'deferredParse_core')); | 113 | deferredResult.addCallback(MochiKit.Base.method(this, 'deferredParse_core')); |
116 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse - 2 " + res); return res;}); | 114 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("KeePassExportProcessor.deferredParse - 2 " + res); return res;}); |
117 | deferredResult.callback(context); | 115 | deferredResult.callback(context); |
118 | //MochiKit.Logging.logDebug("<<< KeePassExportProcessor.deferredParse"); | 116 | //MochiKit.Logging.logDebug("<<< KeePassExportProcessor.deferredParse"); |