Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/RecordDetail/CreationWizard.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Components/RecordDetail/CreationWizard.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/CreationWizard.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/CreationWizard.js index d4c7837..c703db4 100644 --- a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/CreationWizard.js +++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/CreationWizard.js | |||
@@ -1,214 +1,212 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | 26 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } |
29 | if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; } | 27 | if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; } |
30 | 28 | ||
31 | //############################################################################# | 29 | //############################################################################# |
32 | 30 | ||
33 | Clipperz.PM.Components.RecordDetail.CreationWizard = function(anElement, args) { | 31 | Clipperz.PM.Components.RecordDetail.CreationWizard = function(anElement, args) { |
34 | args = args || {}; | 32 | args = args || {}; |
35 | 33 | ||
36 | Clipperz.PM.Components.RecordDetail.CreationWizard.superclass.constructor.call(this, anElement, args); | 34 | Clipperz.PM.Components.RecordDetail.CreationWizard.superclass.constructor.call(this, anElement, args); |
37 | 35 | ||
38 | this._mainComponent = args.mainComponent; | 36 | this._mainComponent = args.mainComponent; |
39 | this._previouslySelectedRecord = args.previouslySelectedRecord; | 37 | this._previouslySelectedRecord = args.previouslySelectedRecord; |
40 | //MochiKit.Logging.logDebug("--- new CreationWizard - previouslySelectedRecord: " + args.previouslySelectedRecord); | 38 | //MochiKit.Logging.logDebug("--- new CreationWizard - previouslySelectedRecord: " + args.previouslySelectedRecord); |
41 | this._createButton_header = null; | 39 | this._createButton_header = null; |
42 | this._createButton_footer = null; | 40 | this._createButton_footer = null; |
43 | 41 | ||
44 | this._cancelButton_header = null; | 42 | this._cancelButton_header = null; |
45 | this._cancelButton_footer = null; | 43 | this._cancelButton_footer = null; |
46 | 44 | ||
47 | this.render(); | 45 | this.render(); |
48 | 46 | ||
49 | return this; | 47 | return this; |
50 | } | 48 | } |
51 | 49 | ||
52 | //============================================================================= | 50 | //============================================================================= |
53 | 51 | ||
54 | YAHOO.extendX(Clipperz.PM.Components.RecordDetail.CreationWizard, Clipperz.PM.Components.BaseComponent, { | 52 | YAHOO.extendX(Clipperz.PM.Components.RecordDetail.CreationWizard, Clipperz.PM.Components.BaseComponent, { |
55 | 53 | ||
56 | 'toString': function() { | 54 | 'toString': function() { |
57 | return "Clipperz.PM.Components.RecordDetail.CreationWizard component"; | 55 | return "Clipperz.PM.Components.RecordDetail.CreationWizard component"; |
58 | }, | 56 | }, |
59 | 57 | ||
60 | //------------------------------------------------------------------------- | 58 | //------------------------------------------------------------------------- |
61 | 59 | ||
62 | 'previouslySelectedRecord': function() { | 60 | 'previouslySelectedRecord': function() { |
63 | return this._previouslySelectedRecord; | 61 | return this._previouslySelectedRecord; |
64 | }, | 62 | }, |
65 | 63 | ||
66 | //------------------------------------------------------------------------- | 64 | //------------------------------------------------------------------------- |
67 | 65 | ||
68 | 'render': function() { | 66 | 'render': function() { |
69 | vartemplateListElement; | 67 | vartemplateListElement; |
70 | vartemplates; | 68 | vartemplates; |
71 | 69 | ||
72 | this.element().update(""); | 70 | this.element().update(""); |
73 | 71 | ||
74 | Clipperz.YUI.DomHelper.append(this.element().dom, | 72 | Clipperz.YUI.DomHelper.append(this.element().dom, |
75 | {tag:'form', cls:'recordDataFORM', id:this.getId('form'), children:[ | 73 | {tag:'form', cls:'recordDataFORM', id:this.getId('form'), children:[ |
76 | {tag:'div', id:'recordDetailDataBox', cls:'recordDetailDataBox', children:[ | 74 | {tag:'div', id:'recordDetailDataBox', cls:'recordDetailDataBox', children:[ |
77 | {tag:'div', id:this.getId('wizardBox'), cls:'recordCreationWizard', children:[ | 75 | {tag:'div', id:this.getId('wizardBox'), cls:'recordCreationWizard', children:[ |
78 | {tag:'div', id:this.getId('recordCreationWizardTitleBox'), cls:'recordCreationWizardTitleBox', htmlString:Clipperz.PM.Strings['newRecordWizardTitleBox']}, | 76 | {tag:'div', id:this.getId('recordCreationWizardTitleBox'), cls:'recordCreationWizardTitleBox', htmlString:Clipperz.PM.Strings['newRecordWizardTitleBox']}, |
79 | {tag:'ul', id:this.getId('templateList'), cls:'radioList'} | 77 | {tag:'ul', id:this.getId('templateList'), cls:'radioList'} |
80 | ]} | 78 | ]} |
81 | ]} | 79 | ]} |
82 | ]} | 80 | ]} |
83 | ); | 81 | ); |
84 | 82 | ||
85 | Clipperz.YUI.DomHelper.append(this.getDom('recordCreationWizardTitleBox'), {tag:'div', cls:'newRecordWizardHeader', children:[ | 83 | Clipperz.YUI.DomHelper.append(this.getDom('recordCreationWizardTitleBox'), {tag:'div', cls:'newRecordWizardHeader', children:[ |
86 | {tag:'table', width:'100%', cellpadding:'5', children:[ | 84 | {tag:'table', width:'100%', cellpadding:'5', children:[ |
87 | {tag:'tbody', children:[ | 85 | {tag:'tbody', children:[ |
88 | {tag:'tr', children:[ | 86 | {tag:'tr', children:[ |
89 | {tag:'td', width:'49%', align:'right', children:[ | 87 | {tag:'td', width:'49%', align:'right', children:[ |
90 | {tag:'div', id:this.getId('cancelButton_header')} | 88 | {tag:'div', id:this.getId('cancelButton_header')} |
91 | ]}, | 89 | ]}, |
92 | {tag:'td', width:'10', html:' '}, | 90 | {tag:'td', width:'10', html:' '}, |
93 | {tag:'td', width:'49%', align:'left', children:[ | 91 | {tag:'td', width:'49%', align:'left', children:[ |
94 | {tag:'div', id:this.getId('createButton_header')} | 92 | {tag:'div', id:this.getId('createButton_header')} |
95 | ]} | 93 | ]} |
96 | ]} | 94 | ]} |
97 | ]} | 95 | ]} |
98 | ]} | 96 | ]} |
99 | ]}); | 97 | ]}); |
100 | 98 | ||
101 | templateListElement = this.getElement('templateList'); | 99 | templateListElement = this.getElement('templateList'); |
102 | templates = Clipperz.PM.Strings['recordTemplates']; | 100 | templates = Clipperz.PM.Strings['recordTemplates']; |
103 | MochiKit.Iter.forEach(MochiKit.Base.keys(templates), MochiKit.Base.bind(function(aTemplateKey) { | 101 | MochiKit.Iter.forEach(MochiKit.Base.keys(templates), MochiKit.Base.bind(function(aTemplateKey) { |
104 | Clipperz.YUI.DomHelper.append(templateListElement.dom, {tag:'li', children:[ | 102 | Clipperz.YUI.DomHelper.append(templateListElement.dom, {tag:'li', children:[ |
105 | {tag:'table', children:[ | 103 | {tag:'table', children:[ |
106 | {tag:'tbody', children:[ | 104 | {tag:'tbody', children:[ |
107 | {tag:'tr', children:[ | 105 | {tag:'tr', children:[ |
108 | {tag:'td', valign:'top', children:[ | 106 | {tag:'td', valign:'top', children:[ |
109 | {tag:'input', id:this.getId(aTemplateKey+"_radio"), type:'radio', name:'recordTemplate', value:"aTemplateKey"} | 107 | {tag:'input', id:this.getId(aTemplateKey+"_radio"), type:'radio', name:'recordTemplate', value:"aTemplateKey"} |
110 | ]}, | 108 | ]}, |
111 | {tag:'td', valign:'top', children:[ | 109 | {tag:'td', valign:'top', children:[ |
112 | {tag:'h4', id:this.getId(aTemplateKey+"_title"), html:templates[aTemplateKey]['title']}, | 110 | {tag:'h4', id:this.getId(aTemplateKey+"_title"), html:templates[aTemplateKey]['title']}, |
113 | {tag:'div', cls:'templateDescription', htmlString:templates[aTemplateKey]['description']} | 111 | {tag:'div', cls:'templateDescription', htmlString:templates[aTemplateKey]['description']} |
114 | ]} | 112 | ]} |
115 | ]} | 113 | ]} |
116 | ]} | 114 | ]} |
117 | ]} | 115 | ]} |
118 | ]}); | 116 | ]}); |
119 | this.getElement(aTemplateKey+"_radio").dom.value = aTemplateKey; | 117 | this.getElement(aTemplateKey+"_radio").dom.value = aTemplateKey; |
120 | MochiKit.Signal.connect(this.getDom(aTemplateKey+"_title"), 'onclick', MochiKit.Base.partial(function(aRadioButton) {aRadioButton.click();}, this.getDom(aTemplateKey+"_radio"))); | 118 | MochiKit.Signal.connect(this.getDom(aTemplateKey+"_title"), 'onclick', MochiKit.Base.partial(function(aRadioButton) {aRadioButton.click();}, this.getDom(aTemplateKey+"_radio"))); |
121 | }, this)); | 119 | }, this)); |
122 | 120 | ||
123 | Clipperz.YUI.DomHelper.append(templateListElement.dom, {tag:'li', children:[ | 121 | Clipperz.YUI.DomHelper.append(templateListElement.dom, {tag:'li', children:[ |
124 | {tag:'table', children:[ | 122 | {tag:'table', children:[ |
125 | {tag:'tbody', children:[ | 123 | {tag:'tbody', children:[ |
126 | {tag:'tr', children:[ | 124 | {tag:'tr', children:[ |
127 | {tag:'td', valign:'top', children:[ | 125 | {tag:'td', valign:'top', children:[ |
128 | {tag:'input', type:'radio', name:'recordTemplate', id:this.getId('bookmarkletRadioButton'), value:'BookmarkletConfigurationTemplate'} | 126 | {tag:'input', type:'radio', name:'recordTemplate', id:this.getId('bookmarkletRadioButton'), value:'BookmarkletConfigurationTemplate'} |
129 | ]}, | 127 | ]}, |
130 | {tag:'td', valign:'top', children:[ | 128 | {tag:'td', valign:'top', children:[ |
131 | {tag:'h4', htmlString:Clipperz.PM.Strings['newRecordWizardBookmarkletConfigurationTitle']}, | 129 | {tag:'h4', htmlString:Clipperz.PM.Strings['newRecordWizardBookmarkletConfigurationTitle']}, |
132 | {tag:'div', cls:'templateDescription', htmlString:Clipperz.PM.Strings['newRecordWizardBookmarkletConfigurationDescription']}, | 130 | {tag:'div', cls:'templateDescription', htmlString:Clipperz.PM.Strings['newRecordWizardBookmarkletConfigurationDescription']}, |
133 | {tag:'div', cls:'bookmarkletConfiguration', children:[ | 131 | {tag:'div', cls:'bookmarkletConfiguration', children:[ |
134 | // {tag:'span', htmlString:Clipperz.PM.Strings['newRecordWizardBookmarkletConfigurationLabel']}, | 132 | // {tag:'span', htmlString:Clipperz.PM.Strings['newRecordWizardBookmarkletConfigurationLabel']}, |
135 | {tag:'div', htmlString:Clipperz.PM.Strings['recordDetailNewDirectLoginDescription']}, | 133 | {tag:'div', htmlString:Clipperz.PM.Strings['recordDetailNewDirectLoginDescription']}, |
136 | {tag:'textarea', id:this.getId('bookmarkletConfiguration')} | 134 | {tag:'textarea', id:this.getId('bookmarkletConfiguration')} |
137 | ]} | 135 | ]} |
138 | ]} | 136 | ]} |
139 | ]} | 137 | ]} |
140 | ]} | 138 | ]} |
141 | ]} | 139 | ]} |
142 | ]}); | 140 | ]}); |
143 | 141 | ||
144 | Clipperz.YUI.DomHelper.append(this.getDom('wizardBox'), {tag:'div', cls:'newRecordWizardFooter', children:[ | 142 | Clipperz.YUI.DomHelper.append(this.getDom('wizardBox'), {tag:'div', cls:'newRecordWizardFooter', children:[ |
145 | {tag:'table', width:'100%', cellpadding:'5', children:[ | 143 | {tag:'table', width:'100%', cellpadding:'5', children:[ |
146 | {tag:'tbody', children:[ | 144 | {tag:'tbody', children:[ |
147 | {tag:'tr', children:[ | 145 | {tag:'tr', children:[ |
148 | {tag:'td', width:'49%', align:'right', children:[ | 146 | {tag:'td', width:'49%', align:'right', children:[ |
149 | {tag:'div', id:this.getId('cancelButton_footer')} | 147 | {tag:'div', id:this.getId('cancelButton_footer')} |
150 | ]}, | 148 | ]}, |
151 | {tag:'td', width:'10', html:' '}, | 149 | {tag:'td', width:'10', html:' '}, |
152 | {tag:'td', width:'49%', align:'left', children:[ | 150 | {tag:'td', width:'49%', align:'left', children:[ |
153 | {tag:'div', id:this.getId('createButton_footer')} | 151 | {tag:'div', id:this.getId('createButton_footer')} |
154 | ]} | 152 | ]} |
155 | ]} | 153 | ]} |
156 | ]} | 154 | ]} |
157 | ]} | 155 | ]} |
158 | ]}); | 156 | ]}); |
159 | 157 | ||
160 | this.setCreateButton_header(new YAHOO.ext.Button(this.getDom('createButton_header'), {text:Clipperz.PM.Strings['newRecordWizardCreateButtonLabel'], handler:this.createRecord, scope:this})); | 158 | this.setCreateButton_header(new YAHOO.ext.Button(this.getDom('createButton_header'), {text:Clipperz.PM.Strings['newRecordWizardCreateButtonLabel'], handler:this.createRecord, scope:this})); |
161 | this.setCreateButton_footer(new YAHOO.ext.Button(this.getDom('createButton_footer'), {text:Clipperz.PM.Strings['newRecordWizardCreateButtonLabel'], handler:this.createRecord, scope:this})); | 159 | this.setCreateButton_footer(new YAHOO.ext.Button(this.getDom('createButton_footer'), {text:Clipperz.PM.Strings['newRecordWizardCreateButtonLabel'], handler:this.createRecord, scope:this})); |
162 | 160 | ||
163 | this.setCancelButton_header(new YAHOO.ext.Button(this.getDom('cancelButton_header'), {text:Clipperz.PM.Strings['newRecordWizardCancelButtonLabel'], handler:this.exitWizard, scope:this})); | 161 | this.setCancelButton_header(new YAHOO.ext.Button(this.getDom('cancelButton_header'), {text:Clipperz.PM.Strings['newRecordWizardCancelButtonLabel'], handler:this.exitWizard, scope:this})); |
164 | this.setCancelButton_footer(new YAHOO.ext.Button(this.getDom('cancelButton_footer'), {text:Clipperz.PM.Strings['newRecordWizardCancelButtonLabel'], handler:this.exitWizard, scope:this})); | 162 | this.setCancelButton_footer(new YAHOO.ext.Button(this.getDom('cancelButton_footer'), {text:Clipperz.PM.Strings['newRecordWizardCancelButtonLabel'], handler:this.exitWizard, scope:this})); |
165 | 163 | ||
166 | this.createButton_header().disable(); | 164 | this.createButton_header().disable(); |
167 | this.createButton_footer().disable(); | 165 | this.createButton_footer().disable(); |
168 | 166 | ||
169 | MochiKit.Iter.forEach(this.getElement('form').getChildrenByTagName('input'), MochiKit.Base.bind(function(anInput) { | 167 | MochiKit.Iter.forEach(this.getElement('form').getChildrenByTagName('input'), MochiKit.Base.bind(function(anInput) { |
170 | // MochiKit.Signal.connect(anInput.dom, 'onchange', this, 'enableCreateButton'); | 168 | // MochiKit.Signal.connect(anInput.dom, 'onchange', this, 'enableCreateButton'); |
171 | MochiKit.Signal.connect(anInput.dom, 'onclick', this, 'enableCreateButton'); //for Safari | 169 | MochiKit.Signal.connect(anInput.dom, 'onclick', this, 'enableCreateButton'); //for Safari |
172 | },this)); | 170 | },this)); |
173 | 171 | ||
174 | MochiKit.Signal.connect(this.getDom('bookmarkletConfiguration'), 'onkeyup', this, 'enableCreateButton'); | 172 | MochiKit.Signal.connect(this.getDom('bookmarkletConfiguration'), 'onkeyup', this, 'enableCreateButton'); |
175 | MochiKit.Signal.connect(this.getDom('bookmarkletConfiguration'), 'onkeydown', this, 'enableCreateButton'); //for Safari | 173 | MochiKit.Signal.connect(this.getDom('bookmarkletConfiguration'), 'onkeydown', this, 'enableCreateButton'); //for Safari |
176 | }, | 174 | }, |
177 | 175 | ||
178 | //------------------------------------------------------------------------- | 176 | //------------------------------------------------------------------------- |
179 | 177 | ||
180 | 'createButton_header': function() { | 178 | 'createButton_header': function() { |
181 | return this._createButton_header; | 179 | return this._createButton_header; |
182 | }, | 180 | }, |
183 | 181 | ||
184 | 'setCreateButton_header': function(aValue) { | 182 | 'setCreateButton_header': function(aValue) { |
185 | this._createButton_header = aValue; | 183 | this._createButton_header = aValue; |
186 | }, | 184 | }, |
187 | 185 | ||
188 | //......................................................................... | 186 | //......................................................................... |
189 | 187 | ||
190 | 'createButton_footer': function() { | 188 | 'createButton_footer': function() { |
191 | return this._createButton_footer; | 189 | return this._createButton_footer; |
192 | }, | 190 | }, |
193 | 191 | ||
194 | 'setCreateButton_footer': function(aValue) { | 192 | 'setCreateButton_footer': function(aValue) { |
195 | this._createButton_footer = aValue; | 193 | this._createButton_footer = aValue; |
196 | }, | 194 | }, |
197 | 195 | ||
198 | 196 | ||
199 | //------------------------------------------------------------------------- | 197 | //------------------------------------------------------------------------- |
200 | 198 | ||
201 | 'cancelButton_header': function() { | 199 | 'cancelButton_header': function() { |
202 | return this._cancelButton_header; | 200 | return this._cancelButton_header; |
203 | }, | 201 | }, |
204 | 202 | ||
205 | 'setCancelButton_header': function(aValue) { | 203 | 'setCancelButton_header': function(aValue) { |
206 | this._cancelButton_header = aValue; | 204 | this._cancelButton_header = aValue; |
207 | }, | 205 | }, |
208 | 206 | ||
209 | //......................................................................... | 207 | //......................................................................... |
210 | 208 | ||
211 | 'cancelButton_footer': function() { | 209 | 'cancelButton_footer': function() { |
212 | return this._cancelButton_footer; | 210 | return this._cancelButton_footer; |
213 | }, | 211 | }, |
214 | 212 | ||