summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz/PM/Components/RecordDetail
authorGiulio Cesare Solaroli <giulio.cesare@clipperz.com>2011-10-02 23:56:18 (UTC)
committer Giulio Cesare Solaroli <giulio.cesare@clipperz.com>2011-10-02 23:56:18 (UTC)
commitef68436ac04da078ffdcacd7e1f785473a303d45 (patch) (unidiff)
treec403752d66a2c4775f00affd4fa8431b29c5b68c /frontend/beta/js/Clipperz/PM/Components/RecordDetail
parent597ecfbc0249d83e1b856cbd558340c01237a360 (diff)
downloadclipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.zip
clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.tar.gz
clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.tar.bz2
First version of the newly restructured repository
Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/RecordDetail') (more/less context) (ignore whitespace changes)
-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
17 files changed, 3729 insertions, 0 deletions
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