summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginsComponent.js
Unidiff
Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginsComponent.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginsComponent.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginsComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginsComponent.js
index 1396bd8..878adce 100644
--- a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginsComponent.js
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginsComponent.js
@@ -1,196 +1,194 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
28if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } 26if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
29if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; } 27if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
30 28
31//############################################################################# 29//#############################################################################
32 30
33Clipperz.PM.Components.RecordDetail.DirectLoginsComponent = function(anElement, args) { 31Clipperz.PM.Components.RecordDetail.DirectLoginsComponent = function(anElement, args) {
34//MochiKit.Logging.logDebug(">>> new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent"); 32//MochiKit.Logging.logDebug(">>> new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent");
35 args = args || {}; 33 args = args || {};
36 34
37//MochiKit.Logging.logDebug("--- new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent - 0"); 35//MochiKit.Logging.logDebug("--- new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent - 0");
38 Clipperz.PM.Components.RecordDetail.DirectLoginsComponent.superclass.constructor.call(this, anElement, args); 36 Clipperz.PM.Components.RecordDetail.DirectLoginsComponent.superclass.constructor.call(this, anElement, args);
39//MochiKit.Logging.logDebug("--- new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent - 1"); 37//MochiKit.Logging.logDebug("--- new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent - 1");
40 38
41 this._addDirectLoginButton = null; 39 this._addDirectLoginButton = null;
42 40
43//MochiKit.Logging.logDebug("--- new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent - 2"); 41//MochiKit.Logging.logDebug("--- new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent - 2");
44 this.mainComponent().addEditComponent(this); 42 this.mainComponent().addEditComponent(this);
45//MochiKit.Logging.logDebug("--- new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent - 3"); 43//MochiKit.Logging.logDebug("--- new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent - 3");
46 this.render(); 44 this.render();
47//MochiKit.Logging.logDebug("<<< new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent"); 45//MochiKit.Logging.logDebug("<<< new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent");
48 46
49 return this; 47 return this;
50} 48}
51 49
52//============================================================================= 50//=============================================================================
53 51
54YAHOO.extendX(Clipperz.PM.Components.RecordDetail.DirectLoginsComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, { 52YAHOO.extendX(Clipperz.PM.Components.RecordDetail.DirectLoginsComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, {
55 53
56 'toString': function() { 54 'toString': function() {
57 return "Clipperz.PM.Components.RecordDetail.DirectLoginsComponent component"; 55 return "Clipperz.PM.Components.RecordDetail.DirectLoginsComponent component";
58 }, 56 },
59 57
60 //------------------------------------------------------------------------- 58 //-------------------------------------------------------------------------
61 59
62 'addDirectLoginButton': function() { 60 'addDirectLoginButton': function() {
63 return this._addDirectLoginButton; 61 return this._addDirectLoginButton;
64 }, 62 },
65 63
66 'setAddDirectLoginButton': function(aValue) { 64 'setAddDirectLoginButton': function(aValue) {
67 this._addDirectLoginButton = aValue; 65 this._addDirectLoginButton = aValue;
68 }, 66 },
69 67
70 //------------------------------------------------------------------------- 68 //-------------------------------------------------------------------------
71 69
72 'render': function() { 70 'render': function() {
73 this.element().update(""); 71 this.element().update("");
74 72
75 Clipperz.YUI.DomHelper.append(this.element().dom, 73 Clipperz.YUI.DomHelper.append(this.element().dom,
76 {tag:'div', cls:'directLoginsRecordBox', children:[ 74 {tag:'div', cls:'directLoginsRecordBox', children:[
77 {tag:'h3', htmlString:Clipperz.PM.Strings['recordDetailDirectLoginBlockTitle']}, 75 {tag:'h3', htmlString:Clipperz.PM.Strings['recordDetailDirectLoginBlockTitle']},
78 {tag:'ul', id:this.getId('directLogins')}, 76 {tag:'ul', id:this.getId('directLogins')},
79 77
80 {tag:'div', cls:'addDirectLoginBox', id:this.getId('addDirectLogin'), children:[ 78 {tag:'div', cls:'addDirectLoginBox', id:this.getId('addDirectLogin'), children:[
81 {tag:'div', cls:'addDirectLoginBoxContent', children:[ 79 {tag:'div', cls:'addDirectLoginBoxContent', children:[
82 {tag:'div', cls:'bookmarkletConfiguration', children:[ 80 {tag:'div', cls:'bookmarkletConfiguration', children:[
83 // {tag:'span', htmlString:Clipperz.PM.Strings['newRecordWizardBookmarkletConfigurationLabel']}, 81 // {tag:'span', htmlString:Clipperz.PM.Strings['newRecordWizardBookmarkletConfigurationLabel']},
84 {tag:'div', htmlString:Clipperz.PM.Strings['recordDetailNewDirectLoginDescription']}, 82 {tag:'div', htmlString:Clipperz.PM.Strings['recordDetailNewDirectLoginDescription']},
85 {tag:'textarea', id:this.getId('addDirectLoginTextarea')} 83 {tag:'textarea', id:this.getId('addDirectLoginTextarea')}
86 ]}, 84 ]},
87 {tag:'div', id:this.getId('addDirectLoginButton')} 85 {tag:'div', id:this.getId('addDirectLoginButton')}
88 ]} 86 ]}
89 ]} 87 ]}
90 ]} 88 ]}
91 ); 89 );
92 90
93 if (MochiKit.Base.keys(this.record().directLogins()).length == 0) { 91 if (MochiKit.Base.keys(this.record().directLogins()).length == 0) {
94//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 3"); 92//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 3");
95 Clipperz.YUI.DomHelper.append(this.getElement('directLogins'), 93 Clipperz.YUI.DomHelper.append(this.getElement('directLogins'),
96 {tag:'li', children:[ 94 {tag:'li', children:[
97 // {tag:'span', htmlString:Clipperz.PM.Strings['recordDetailDirectLoginBlockNoDirectLoginConfiguredLabel']} 95 // {tag:'span', htmlString:Clipperz.PM.Strings['recordDetailDirectLoginBlockNoDirectLoginConfiguredLabel']}
98 {tag:'div', cls:'recordDetailNoDirectLoginDescriptionBox', htmlString:Clipperz.PM.Strings['recordDetailDirectLoginBlockNoDirectLoginConfiguredDescription']} 96 {tag:'div', cls:'recordDetailNoDirectLoginDescriptionBox', htmlString:Clipperz.PM.Strings['recordDetailDirectLoginBlockNoDirectLoginConfiguredDescription']}
99 ]} 97 ]}
100 ); 98 );
101//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 4"); 99//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 4");
102 } else { 100 } else {
103//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 5"); 101//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 5");
104 for (directLoginReference in this.record().directLogins()) { 102 for (directLoginReference in this.record().directLogins()) {
105//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 6"); 103//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 6");
106 this.addDirectLogin(this.record().directLogins()[directLoginReference]); 104 this.addDirectLogin(this.record().directLogins()[directLoginReference]);
107//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 7"); 105//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 7");
108 } 106 }
109//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 8"); 107//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 8");
110 } 108 }
111//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 9"); 109//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 9");
112 110
113 this.setAddDirectLoginButton(new YAHOO.ext.Button(this.getDom('addDirectLoginButton'), { 111 this.setAddDirectLoginButton(new YAHOO.ext.Button(this.getDom('addDirectLoginButton'), {
114 text:Clipperz.PM.Strings['recordDetailAddNewDirectLoginButtonLabel'], 112 text:Clipperz.PM.Strings['recordDetailAddNewDirectLoginButtonLabel'],
115 handler:this.addNewDirectLogin, 113 handler:this.addNewDirectLogin,
116 scope:this 114 scope:this
117 })); 115 }));
118 MochiKit.Signal.connect(this.getId('addDirectLoginTextarea'), 'onkeydown', this, 'onkeydown'); 116 MochiKit.Signal.connect(this.getId('addDirectLoginTextarea'), 'onkeydown', this, 'onkeydown');
119//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 11"); 117//MochiKit.Logging.logDebug("--- DirectLoginsComponent.render - 11");
120 118
121 this.update(); 119 this.update();
122//MochiKit.Logging.logDebug("<<< DirectLoginsComponent.render"); 120//MochiKit.Logging.logDebug("<<< DirectLoginsComponent.render");
123 }, 121 },
124 122
125 //------------------------------------------------------------------------- 123 //-------------------------------------------------------------------------
126 124
127 'addDirectLogin': function(aDirectLogin) { 125 'addDirectLogin': function(aDirectLogin) {
128//MochiKit.Logging.logDebug(">>> DirectLoginsComponent.addDirectLogin"); 126//MochiKit.Logging.logDebug(">>> DirectLoginsComponent.addDirectLogin");
129 new Clipperz.PM.Components.RecordDetail.DirectLoginComponent( 127 new Clipperz.PM.Components.RecordDetail.DirectLoginComponent(
130 Clipperz.YUI.DomHelper.append(this.getDom('directLogins'), {tag:'div'}, true), 128 Clipperz.YUI.DomHelper.append(this.getDom('directLogins'), {tag:'div'}, true),
131 { 129 {
132 mainComponent:this.mainComponent(), 130 mainComponent:this.mainComponent(),
133 directLogin:aDirectLogin 131 directLogin:aDirectLogin
134 } 132 }
135 ); 133 );
136//MochiKit.Logging.logDebug("<<< DirectLoginsComponent.addDirectLogin"); 134//MochiKit.Logging.logDebug("<<< DirectLoginsComponent.addDirectLogin");
137 }, 135 },
138 136
139 //------------------------------------------------------------------------- 137 //-------------------------------------------------------------------------
140 138
141 'addNewDirectLogin': function() { 139 'addNewDirectLogin': function() {
142 varnewDirectLogin; 140 varnewDirectLogin;
143 varconfiguration; 141 varconfiguration;
144 142
145//MochiKit.Logging.logDebug(">>> DirectLoginsComponent.addNewDirectLogin"); 143//MochiKit.Logging.logDebug(">>> DirectLoginsComponent.addNewDirectLogin");
146 if (MochiKit.Base.keys(this.record().directLogins()).length == 0) { 144 if (MochiKit.Base.keys(this.record().directLogins()).length == 0) {
147 this.getElement('directLogins').update(""); 145 this.getElement('directLogins').update("");
148 } 146 }
149 147
150 this.mainComponent().synchronizeComponentValues(); 148 this.mainComponent().synchronizeComponentValues();
151 149
152 this.mainComponent().exitModalView(); 150 this.mainComponent().exitModalView();
153 configuration = Clipperz.PM.BookmarkletProcessor.checkBookmarkletConfiguration( 151 configuration = Clipperz.PM.BookmarkletProcessor.checkBookmarkletConfiguration(
154 this.getDom('addDirectLoginTextarea').value, 152 this.getDom('addDirectLoginTextarea').value,
155 this.getDom('addDirectLoginButton'), 153 this.getDom('addDirectLoginButton'),
156 MochiKit.Base.method(this.mainComponent(), 'enterModalView') 154 MochiKit.Base.method(this.mainComponent(), 'enterModalView')
157 ); 155 );
158 this.mainComponent().enterModalView(); 156 this.mainComponent().enterModalView();
159 157
160 newDirectLogin = new Clipperz.PM.DataModel.DirectLogin({record:this.record(), 158 newDirectLogin = new Clipperz.PM.DataModel.DirectLogin({record:this.record(),
161 label:configuration['page']['title'], 159 label:configuration['page']['title'],
162 bookmarkletVersion:'0.2', 160 bookmarkletVersion:'0.2',
163 // bookmarkletVersion:configuration['version'], 161 // bookmarkletVersion:configuration['version'],
164 formData:configuration['form']}); 162 formData:configuration['form']});
165 this.record().addDirectLogin(newDirectLogin); 163 this.record().addDirectLogin(newDirectLogin);
166 this.addDirectLogin(newDirectLogin); 164 this.addDirectLogin(newDirectLogin);
167 this.getDom('addDirectLoginTextarea').value = ""; 165 this.getDom('addDirectLoginTextarea').value = "";
168//MochiKit.Logging.logDebug("<<< DirectLoginsComponent.addNewDirectLogin"); 166//MochiKit.Logging.logDebug("<<< DirectLoginsComponent.addNewDirectLogin");
169 }, 167 },
170 168
171 //------------------------------------------------------------------------- 169 //-------------------------------------------------------------------------
172 170
173 'updateViewMode': function() { 171 'updateViewMode': function() {
174 this.getElement('addDirectLogin').setVisibilityMode(YAHOO.ext.Element.DISPLAY); 172 this.getElement('addDirectLogin').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
175 this.getElement('addDirectLogin').hide(); 173 this.getElement('addDirectLogin').hide();
176 }, 174 },
177 175
178 //------------------------------------------------------------------------- 176 //-------------------------------------------------------------------------
179 177
180 'updateEditMode': function() { 178 'updateEditMode': function() {
181 this.getElement('addDirectLogin').show(); 179 this.getElement('addDirectLogin').show();
182 }, 180 },
183 181
184 //------------------------------------------------------------------------- 182 //-------------------------------------------------------------------------
185 183
186 'onkeydown': function(anEvent) { 184 'onkeydown': function(anEvent) {
187//MochiKit.Logging.logDebug(">>> onkeydown - " + anEvent.src().id + ": " + anEvent.key().code); 185//MochiKit.Logging.logDebug(">>> onkeydown - " + anEvent.src().id + ": " + anEvent.key().code);
188 if (anEvent.key().code == 13) { 186 if (anEvent.key().code == 13) {
189 this.addNewDirectLogin(); 187 this.addNewDirectLogin();
190 } 188 }
191 }, 189 },
192 190
193 //------------------------------------------------------------------------- 191 //-------------------------------------------------------------------------
194 __syntaxFix__: "syntax fix" 192 __syntaxFix__: "syntax fix"
195}); 193});
196 194