summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz/PM/Components/Import/GenericImportComponent.js
Unidiff
Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/Import/GenericImportComponent.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Import/GenericImportComponent.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/GenericImportComponent.js b/frontend/beta/js/Clipperz/PM/Components/Import/GenericImportComponent.js
index a55455a..3c23b1c 100644
--- a/frontend/beta/js/Clipperz/PM/Components/Import/GenericImportComponent.js
+++ b/frontend/beta/js/Clipperz/PM/Components/Import/GenericImportComponent.js
@@ -1,214 +1,212 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer 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
26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
28if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } 26if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
29if (typeof(Clipperz.PM.Components.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; } 27if (typeof(Clipperz.PM.Components.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; }
30 28
31//############################################################################# 29//#############################################################################
32 30
33Clipperz.PM.Components.Import.GenericImportComponent = function(anElement, args) { 31Clipperz.PM.Components.Import.GenericImportComponent = function(anElement, args) {
34 args = args || {}; 32 args = args || {};
35 33
36 this._steps = this._steps || ['EDIT', 'PREVIEW', 'IMPORT']; 34 this._steps = this._steps || ['EDIT', 'PREVIEW', 'IMPORT'];
37 35
38 Clipperz.PM.Components.Import.GenericImportComponent.superclass.constructor.call(this, anElement, args); 36 Clipperz.PM.Components.Import.GenericImportComponent.superclass.constructor.call(this, anElement, args);
39 37
40 this._user = args['user']; 38 this._user = args['user'];
41 39
42 this._currentStep = 0; 40 this._currentStep = 0;
43 this._currentStatus = 'IDLE'; //'PROCESSING' 41 this._currentStatus = 'IDLE'; //'PROCESSING'
44 42
45 this._parsedValues = null; 43 this._parsedValues = null;
46 this._processedValues = null; 44 this._processedValues = null;
47 45
48 this._backButton = null; 46 this._backButton = null;
49 this._nextButton = null; 47 this._nextButton = null;
50 48
51 Clipperz.NotificationCenter.register(null, 'importProcessorProgressUpdate', this, 'updateProgressDialogStatus'); 49 Clipperz.NotificationCenter.register(null, 'importProcessorProgressUpdate', this, 'updateProgressDialogStatus');
52 50
53 return this; 51 return this;
54} 52}
55 53
56//============================================================================= 54//=============================================================================
57 55
58YAHOO.extendX(Clipperz.PM.Components.Import.GenericImportComponent, Clipperz.PM.Components.BaseComponent, { 56YAHOO.extendX(Clipperz.PM.Components.Import.GenericImportComponent, Clipperz.PM.Components.BaseComponent, {
59 57
60 'toString': function() { 58 'toString': function() {
61 return "Clipperz.PM.Components.Import.GenericImportComponent component"; 59 return "Clipperz.PM.Components.Import.GenericImportComponent component";
62 }, 60 },
63 61
64 //------------------------------------------------------------------------- 62 //-------------------------------------------------------------------------
65 63
66 'user': function() { 64 'user': function() {
67 return this._user; 65 return this._user;
68 }, 66 },
69 67
70 //------------------------------------------------------------------------- 68 //-------------------------------------------------------------------------
71 69
72 'textAreaConfig': function() { 70 'textAreaConfig': function() {
73 return {tag:'textarea', name:this.getId('importTextArea'), cls:'importTextArea', id:this.getId('importTextArea'), cols:60, rows:15, html:""}; 71 return {tag:'textarea', name:this.getId('importTextArea'), cls:'importTextArea', id:this.getId('importTextArea'), cols:60, rows:15, html:""};
74 }, 72 },
75 73
76 'textAreaContent': function() { 74 'textAreaContent': function() {
77 return this.getDom('importTextArea').value 75 return this.getDom('importTextArea').value
78 }, 76 },
79 77
80 //------------------------------------------------------------------------- 78 //-------------------------------------------------------------------------
81 79
82 'steps': function() { 80 'steps': function() {
83 return this._steps; 81 return this._steps;
84 }, 82 },
85 83
86 'currentStep': function() { 84 'currentStep': function() {
87 return this._currentStep; 85 return this._currentStep;
88 }, 86 },
89 87
90 'setCurrentStep': function(aValue) { 88 'setCurrentStep': function(aValue) {
91 this._currentStep = aValue; 89 this._currentStep = aValue;
92 this.updateSteps(); 90 this.updateSteps();
93 }, 91 },
94 92
95 //------------------------------------------------------------------------- 93 //-------------------------------------------------------------------------
96 94
97 'currentStatus': function() { 95 'currentStatus': function() {
98 return this._currentStatus; 96 return this._currentStatus;
99 }, 97 },
100 98
101 'startProcessing': function() { 99 'startProcessing': function() {
102 this._currentStatus = 'PROCESSING'; 100 this._currentStatus = 'PROCESSING';
103 this.updateSteps(); 101 this.updateSteps();
104 }, 102 },
105 103
106 'processingDone': function() { 104 'processingDone': function() {
107 this._currentStatus = 'IDLE'; 105 this._currentStatus = 'IDLE';
108 this.setCurrentStep(this.currentStep() + 1); 106 this.setCurrentStep(this.currentStep() + 1);
109 }, 107 },
110 108
111 'processingAborted': function() { 109 'processingAborted': function() {
112 this._currentStatus = 'IDLE'; 110 this._currentStatus = 'IDLE';
113 this.updateSteps(); 111 this.updateSteps();
114 }, 112 },
115 113
116 //------------------------------------------------------------------------- 114 //-------------------------------------------------------------------------
117 115
118 'stepsConfig': function() { 116 'stepsConfig': function() {
119 var result; 117 var result;
120 var i,c; 118 var i,c;
121 119
122 result = []; 120 result = [];
123 c = this.steps().length; 121 c = this.steps().length;
124 for (i=0; i<c; i++) { 122 for (i=0; i<c; i++) {
125 var cls; 123 var cls;
126 124
127 if (this.currentStep() == i) { 125 if (this.currentStep() == i) {
128 if (this.currentStatus() == 'IDLE') { 126 if (this.currentStatus() == 'IDLE') {
129 cls = 'current'; 127 cls = 'current';
130 } else { 128 } else {
131 cls = 'currentProcessing'; 129 cls = 'currentProcessing';
132 } 130 }
133 } else { 131 } else {
134 cls = ""; 132 cls = "";
135 } 133 }
136 134
137 result.push({tag:'td', cls:cls, children:[ 135 result.push({tag:'td', cls:cls, children:[
138 {tag:'div', children:[{tag:'span', htmlString:Clipperz.PM.Strings['ImportWizard'][this.steps()[i]]}]} 136 {tag:'div', children:[{tag:'span', htmlString:Clipperz.PM.Strings['ImportWizard'][this.steps()[i]]}]}
139 ]}) 137 ]})
140 if (i < (c-1)) { 138 if (i < (c-1)) {
141 if ((this.currentStep() == i) && (this.currentStatus() == 'PROCESSING')) { 139 if ((this.currentStep() == i) && (this.currentStatus() == 'PROCESSING')) {
142 cls = 'stepSeparatorProcessing'; 140 cls = 'stepSeparatorProcessing';
143 } else { 141 } else {
144 cls = 'stepSeparator'; 142 cls = 'stepSeparator';
145 } 143 }
146 144
147 result.push({tag:'td', cls:cls, children:[ 145 result.push({tag:'td', cls:cls, children:[
148 {tag:'div', children:[{tag:'span', html:">"}]} 146 {tag:'div', children:[{tag:'span', html:">"}]}
149 ]}); 147 ]});
150 } 148 }
151 } 149 }
152 150
153 result = [{tag:'div', cls:'importWizardStepsBox', children:[ 151 result = [{tag:'div', cls:'importWizardStepsBox', children:[
154 {tag:'div', cls:'importWizardStepsInnerBox', children:[ 152 {tag:'div', cls:'importWizardStepsInnerBox', children:[
155 {tag:'table', cls:'importWizardSteps', children:[ 153 {tag:'table', cls:'importWizardSteps', children:[
156 {tag:'tbody', children:[ 154 {tag:'tbody', children:[
157 {tag:'tr', children:result} 155 {tag:'tr', children:result}
158 ]} 156 ]}
159 ]} 157 ]}
160 ]}, 158 ]},
161 {tag:'div', cls:'importWizardStepsBoxFooter'} 159 {tag:'div', cls:'importWizardStepsBoxFooter'}
162 ]}]; 160 ]}];
163 161
164 return result; 162 return result;
165 }, 163 },
166 164
167 'updateSteps': function() { 165 'updateSteps': function() {
168 this.getElement('importSteps').update(""); 166 this.getElement('importSteps').update("");
169 Clipperz.YUI.DomHelper.append(this.getDom('importSteps'), {tag:'div', children:this.stepsConfig()}); 167 Clipperz.YUI.DomHelper.append(this.getDom('importSteps'), {tag:'div', children:this.stepsConfig()});
170 }, 168 },
171 169
172 //------------------------------------------------------------------------- 170 //-------------------------------------------------------------------------
173 171
174 'backAction': function() { 172 'backAction': function() {
175//MochiKit.Logging.logDebug(">>> backAction"); 173//MochiKit.Logging.logDebug(">>> backAction");
176 if (this.currentStep() == 0) { 174 if (this.currentStep() == 0) {
177 Clipperz.NotificationCenter.notify(this, 'importCancelled'); 175 Clipperz.NotificationCenter.notify(this, 'importCancelled');
178 } else { 176 } else {
179 this.getElement('step_' + this.currentStep()).hide(); 177 this.getElement('step_' + this.currentStep()).hide();
180 this.setCurrentStep(this.currentStep() - 1); 178 this.setCurrentStep(this.currentStep() - 1);
181 this.getElement('step_' + this.currentStep()).show(); 179 this.getElement('step_' + this.currentStep()).show();
182 180
183 this.nextButton().enable(); 181 this.nextButton().enable();
184 } 182 }
185//MochiKit.Logging.logDebug("<<< backAction"); 183//MochiKit.Logging.logDebug("<<< backAction");
186 }, 184 },
187 185
188 //------------------------------------------------------------------------- 186 //-------------------------------------------------------------------------
189 187
190 'backButton': function() { 188 'backButton': function() {
191 return this._backButton; 189 return this._backButton;
192 }, 190 },
193 191
194 'setBackButton': function(aValue) { 192 'setBackButton': function(aValue) {
195 this._backButton = aValue; 193 this._backButton = aValue;
196 }, 194 },
197 195
198 'nextButton': function() { 196 'nextButton': function() {
199 return this._nextButton; 197 return this._nextButton;
200 }, 198 },
201 199
202 'setNextButton': function(aValue) { 200 'setNextButton': function(aValue) {
203 this._nextButton = aValue; 201 this._nextButton = aValue;
204 }, 202 },
205 203
206 //------------------------------------------------------------------------- 204 //-------------------------------------------------------------------------
207 205
208 'render': function() { 206 'render': function() {
209//MochiKit.Logging.logDebug(">>> Import.GenericImportComponent.render"); 207//MochiKit.Logging.logDebug(">>> Import.GenericImportComponent.render");
210 this.domHelper().append(this.element(), {tag:'div', children:[ 208 this.domHelper().append(this.element(), {tag:'div', children:[
211 {tag:'h2', html:this.toString()} 209 {tag:'h2', html:this.toString()}
212 ]}); 210 ]});
213//MochiKit.Logging.logDebug("<<< Import.GenericImportComponent.render"); 211//MochiKit.Logging.logDebug("<<< Import.GenericImportComponent.render");
214 }, 212 },