summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js
Unidiff
Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js15
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js
index 6171a4e..36dd9a8 100644
--- a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js
@@ -1,174 +1,171 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } 28if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
32if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; } 29if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
33 30
34//############################################################################# 31//#############################################################################
35 32
36Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent = function(anElement, args) { 33Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent = function(anElement, args) {
37//MochiKit.Logging.logDebug(">>> new DirectLoginBindingComponent"); 34//MochiKit.Logging.logDebug(">>> new DirectLoginBindingComponent");
38 args = args || {}; 35 args = args || {};
39 36
40 Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent.superclass.constructor.call(this, anElement, args); 37 Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent.superclass.constructor.call(this, anElement, args);
41 38
42 this._directLoginBinding = args.directLoginBinding || null; 39 this._directLoginBinding = args.directLoginBinding || null;
43 this.render(); 40 this.render();
44 41
45 Clipperz.NotificationCenter.register(this.record(), 'addNewRecordField',this, 'syncAndUpdateEditMode'); 42 Clipperz.NotificationCenter.register(this.record(), 'addNewRecordField',this, 'syncAndUpdateEditMode');
46 Clipperz.NotificationCenter.register(this.record(), 'removedField', this, 'syncAndUpdateEditMode'); 43 Clipperz.NotificationCenter.register(this.record(), 'removedField', this, 'syncAndUpdateEditMode');
47 Clipperz.NotificationCenter.register(this.record(), 'updatedFieldLabel',this, 'syncAndUpdateEditMode'); 44 Clipperz.NotificationCenter.register(this.record(), 'updatedFieldLabel',this, 'syncAndUpdateEditMode');
48//MochiKit.Logging.logDebug("<<< new DirectLoginBindingComponent"); 45//MochiKit.Logging.logDebug("<<< new DirectLoginBindingComponent");
49 46
50 return this; 47 return this;
51} 48}
52 49
53//============================================================================= 50//=============================================================================
54 51
55YAHOO.extendX(Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, { 52YAHOO.extendX(Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, {
56 53
57 'toString': function() { 54 'toString': function() {
58 return "Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent component"; 55 return "Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent component";
59 }, 56 },
60 57
61 //------------------------------------------------------------------------- 58 //-------------------------------------------------------------------------
62 59
63 'directLoginBinding': function() { 60 'directLoginBinding': function() {
64 return this._directLoginBinding; 61 return this._directLoginBinding;
65 }, 62 },
66 63
67 //------------------------------------------------------------------------- 64 //-------------------------------------------------------------------------
68 65
69 'render': function() { 66 'render': function() {
70 // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', style:'font-weight:bold;', html:this.directLoginBinding().key()}) 67 // 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()}) 68 // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', html:this.directLoginBinding().value()})
72//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.render"); 69//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.render");
73 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginBindingLabelTD', children:[ 70 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginBindingLabelTD', children:[
74 {tag:'span', html:this.directLoginBinding().key()} 71 {tag:'span', html:this.directLoginBinding().key()}
75 ]}); 72 ]});
76//MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.render - 1"); 73//MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.render - 1");
77 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginBindingValueTD', children:[ 74 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginBindingValueTD', children:[
78 {tag:'div', id:this.getId('editModeBox'), children:[ 75 {tag:'div', id:this.getId('editModeBox'), children:[
79 {tag:'select', id:this.getId('select'), children:this.recordFieldOptions()} 76 {tag:'select', id:this.getId('select'), children:this.recordFieldOptions()}
80 ]}, 77 ]},
81 {tag:'div', id:this.getId('viewModeBox'), children:[ 78 {tag:'div', id:this.getId('viewModeBox'), children:[
82 {tag:'span', id:this.getId('viewValue'), html:""} 79 {tag:'span', id:this.getId('viewValue'), html:""}
83 ]} 80 ]}
84 ]}); 81 ]});
85//MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.render - 2"); 82//MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.render - 2");
86 this.getElement('editModeBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY); 83 this.getElement('editModeBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
87 this.getElement('viewModeBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY); 84 this.getElement('viewModeBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
88 85
89 this.update(); 86 this.update();
90//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.render"); 87//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.render");
91 }, 88 },
92 89
93 //------------------------------------------------------------------------- 90 //-------------------------------------------------------------------------
94 91
95 'recordFieldOptions': function() { 92 'recordFieldOptions': function() {
96 varresult; 93 varresult;
97 var option; 94 var option;
98 varrecordFieldKey; 95 varrecordFieldKey;
99 varrecordFields; 96 varrecordFields;
100 97
101//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.recordFieldOptions"); 98//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.recordFieldOptions");
102 recordFields = this.directLoginBinding().directLogin().record().currentVersion().fields(); 99 recordFields = this.directLoginBinding().directLogin().record().currentVersion().fields();
103 result = []; 100 result = [];
104 option = {tag:'option', value:null, html:'---'}; 101 option = {tag:'option', value:null, html:'---'};
105 result.push(option); 102 result.push(option);
106 for (recordFieldKey in recordFields) { 103 for (recordFieldKey in recordFields) {
107 //TODO: remove the value: field and replace it with element.dom.value = <some value> 104 //TODO: remove the value: field and replace it with element.dom.value = <some value>
108 option = {tag:'option', value:recordFieldKey, html:recordFields[recordFieldKey].label()} 105 option = {tag:'option', value:recordFieldKey, html:recordFields[recordFieldKey].label()}
109 if (recordFieldKey == this.directLoginBinding().fieldKey()) { 106 if (recordFieldKey == this.directLoginBinding().fieldKey()) {
110 option['selected'] = true; 107 option['selected'] = true;
111 } 108 }
112 result.push(option); 109 result.push(option);
113 } 110 }
114//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.recordFieldOptions"); 111//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.recordFieldOptions");
115 112
116 return result; 113 return result;
117 }, 114 },
118 115
119 //------------------------------------------------------------------------- 116 //-------------------------------------------------------------------------
120 117
121 'syncAndUpdateEditMode': function() { 118 'syncAndUpdateEditMode': function() {
122 this.synchronizeComponentValues(); 119 this.synchronizeComponentValues();
123 this.updateEditMode(); 120 this.updateEditMode();
124 }, 121 },
125 122
126 'updateEditMode': function() { 123 'updateEditMode': function() {
127 varselectElementBox; 124 varselectElementBox;
128 125
129//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.updateEditMode"); 126//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.updateEditMode");
130 this.getElement('viewModeBox').hide(); 127 this.getElement('viewModeBox').hide();
131 128
132 selectElementBox = this.getElement('editModeBox'); 129 selectElementBox = this.getElement('editModeBox');
133 selectElementBox.update(""); 130 selectElementBox.update("");
134 131
135 Clipperz.YUI.DomHelper.append(selectElementBox.dom, {tag:'select', id:this.getId('select'), children:this.recordFieldOptions()}); 132 Clipperz.YUI.DomHelper.append(selectElementBox.dom, {tag:'select', id:this.getId('select'), children:this.recordFieldOptions()});
136 133
137/* 134/*
138 selectElement = this.getElement('select'); 135 selectElement = this.getElement('select');
139 136
140 selectElement.update(""); 137 selectElement.update("");
141 MochiKit.Iter.forEach(this.recordFieldOptions(), function(anOption) { 138 MochiKit.Iter.forEach(this.recordFieldOptions(), function(anOption) {
142 Clipperz.YUI.DomHelper.append(selectElement.dom, anOption); 139 Clipperz.YUI.DomHelper.append(selectElement.dom, anOption);
143 }); 140 });
144*/ 141*/
145 142
146 143
147 this.getElement('editModeBox').show(); 144 this.getElement('editModeBox').show();
148//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.updateEditMode"); 145//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.updateEditMode");
149 }, 146 },
150 147
151 //------------------------------------------------------------------------- 148 //-------------------------------------------------------------------------
152 149
153 'updateViewMode': function() { 150 'updateViewMode': function() {
154//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.updateViewMode"); 151//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.updateViewMode");
155 this.getElement('editModeBox').hide(); 152 this.getElement('editModeBox').hide();
156 this.getElement('viewModeBox').show(); 153 this.getElement('viewModeBox').show();
157 154
158 this.getElement('viewValue').update(this.directLoginBinding().field().label()); 155 this.getElement('viewValue').update(this.directLoginBinding().field().label());
159//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.updateViewMode"); 156//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.updateViewMode");
160 }, 157 },
161 158
162 //------------------------------------------------------------------------- 159 //-------------------------------------------------------------------------
163 160
164 'synchronizeComponentValues': function() { 161 'synchronizeComponentValues': function() {
165//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.synchronizeComponentValues") 162//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.synchronizeComponentValues")
166//MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.synchronizeComponentValues - 1 - " + this.getId('select')); 163//MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.synchronizeComponentValues - 1 - " + this.getId('select'));
167 this.directLoginBinding().setFieldKey(this.getDom('select').value); 164 this.directLoginBinding().setFieldKey(this.getDom('select').value);
168//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.synchronizeComponentValues"); 165//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.synchronizeComponentValues");
169 }, 166 },
170 167
171 //------------------------------------------------------------------------- 168 //-------------------------------------------------------------------------
172 __syntaxFix__: "syntax fix" 169 __syntaxFix__: "syntax fix"
173}); 170});
174 171