author | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
commit | 07d0357beef5d9328a2dd8d07ad7b39c87ac55e4 (patch) (unidiff) | |
tree | f7a4aed8848302db153c2a211f8e58b944eb4c5b /frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js | |
parent | 767a3dcf48b6ac911c088af5dd7738a728eb6b99 (diff) | |
download | clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.zip clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.gz clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.bz2 |
Updated Copyright claims
- updated reference dates;
- removed reference to Community Edition;
- normalized logging using Clipperz.log[Warn|Error|Debug]
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js index af33d85..8bb64f5 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js | |||
@@ -1,878 +1,872 @@ | |||
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 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.CardDialogComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.CardDialogComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.CardDialogComponent.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.CardDialogComponent.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._tabPanelController = null; | 31 | this._tabPanelController = null; |
34 | 32 | ||
35 | this._tabPanelControllerConfiguration = { | 33 | this._tabPanelControllerConfiguration = { |
36 | 'DETAILS': { | 34 | 'DETAILS': { |
37 | tab:'detailTab', | 35 | tab:'detailTab', |
38 | panel:'detailTabpanel' | 36 | panel:'detailTabpanel' |
39 | }, | 37 | }, |
40 | 'DIRECT_LOGINS': { | 38 | 'DIRECT_LOGINS': { |
41 | tab:'directLoginTab', | 39 | tab:'directLoginTab', |
42 | panel:'directLoginTabpanel' | 40 | panel:'directLoginTabpanel' |
43 | }, | 41 | }, |
44 | 'SHARING': { | 42 | 'SHARING': { |
45 | tab:'sharingTab', | 43 | tab:'sharingTab', |
46 | panel:'sharingTabpanel' | 44 | panel:'sharingTabpanel' |
47 | } | 45 | } |
48 | }; | 46 | }; |
49 | 47 | ||
50 | this._tooltips = null; | 48 | this._tooltips = null; |
51 | 49 | ||
52 | this._isSavingEnabled = false; | 50 | this._isSavingEnabled = false; |
53 | this._hintMode = 'OFF'; //'ON' | 51 | this._hintMode = 'OFF'; //'ON' |
54 | 52 | ||
55 | this._fieldComponents = {}; | 53 | this._fieldComponents = {}; |
56 | this._directLoginComponents = {}; | 54 | this._directLoginComponents = {}; |
57 | 55 | ||
58 | this._displayMode = 'fixed'; //'scrollable'; | 56 | this._displayMode = 'fixed'; //'scrollable'; |
59 | 57 | ||
60 | return this; | 58 | return this; |
61 | } | 59 | } |
62 | 60 | ||
63 | //============================================================================= | 61 | //============================================================================= |
64 | 62 | ||
65 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 63 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { |
66 | 64 | ||
67 | //------------------------------------------------------------------------- | 65 | //------------------------------------------------------------------------- |
68 | 66 | ||
69 | 'toString': function () { | 67 | 'toString': function () { |
70 | return "Clipperz.PM.UI.Web.Components.CardDialogComponent component"; | 68 | return "Clipperz.PM.UI.Web.Components.CardDialogComponent component"; |
71 | }, | 69 | }, |
72 | 70 | ||
73 | //------------------------------------------------------------------------- | 71 | //------------------------------------------------------------------------- |
74 | 72 | ||
75 | 'tabPanelController': function () { | 73 | 'tabPanelController': function () { |
76 | if (this._tabPanelController == null) { | 74 | if (this._tabPanelController == null) { |
77 | this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({ | 75 | this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({ |
78 | component:this, | 76 | component:this, |
79 | configuration:this._tabPanelControllerConfiguration | 77 | configuration:this._tabPanelControllerConfiguration |
80 | }); | 78 | }); |
81 | 79 | ||
82 | MochiKit.Signal.connect(this._tabPanelController, 'tabSelected', this, 'handleTabSelected') | 80 | MochiKit.Signal.connect(this._tabPanelController, 'tabSelected', this, 'handleTabSelected') |
83 | } | 81 | } |
84 | 82 | ||
85 | return this._tabPanelController; | 83 | return this._tabPanelController; |
86 | }, | 84 | }, |
87 | 85 | ||
88 | //------------------------------------------------------------------------- | 86 | //------------------------------------------------------------------------- |
89 | 87 | ||
90 | 'renderSelf': function() { | 88 | 'renderSelf': function() { |
91 | this.append(this.element(), {tag:'div', cls:'CardDialog mainDialog loading', id:this.getId('panel'), children: [ | 89 | this.append(this.element(), {tag:'div', cls:'CardDialog mainDialog loading', id:this.getId('panel'), children: [ |
92 | {tag:'form', id:this.getId('form'), children:[ | 90 | {tag:'form', id:this.getId('form'), children:[ |
93 | // {tag:'input', type:'text', id:this.getId('hidden'), cls:'hidden'}, | 91 | // {tag:'input', type:'text', id:this.getId('hidden'), cls:'hidden'}, |
94 | {tag:'div', cls:'header', children:[ | 92 | {tag:'div', cls:'header', children:[ |
95 | {tag:'div', cls:'title', children:[ | 93 | {tag:'div', cls:'title', children:[ |
96 | {tag:'input', type:'text', id:this.getId('title')} | 94 | {tag:'input', type:'text', id:this.getId('title')} |
97 | ]} | 95 | ]} |
98 | ]}, | 96 | ]}, |
99 | {tag:'div', id:this.getId('body'), cls:'body', children:[ | 97 | {tag:'div', id:this.getId('body'), cls:'body', children:[ |
100 | {tag:'div', cls:'tabs', children:[ | 98 | {tag:'div', cls:'tabs', children:[ |
101 | {tag:'ul', cls:'tabs', children:[ | 99 | {tag:'ul', cls:'tabs', children:[ |
102 | {tag:'li', id:this.getId('detailTab'), children:[{tag:'span', html:"details"}]}, | 100 | {tag:'li', id:this.getId('detailTab'), children:[{tag:'span', html:"details"}]}, |
103 | {tag:'li', id:this.getId('directLoginTab'), children:[ | 101 | {tag:'li', id:this.getId('directLoginTab'), children:[ |
104 | {tag:'span', html:"direct logins"}//, | 102 | {tag:'span', html:"direct logins"}//, |
105 | // {tag:'div', id:this.getId('addDirectLoginButton'), cls:'addDirectLoginButton', children:[ | 103 | // {tag:'div', id:this.getId('addDirectLoginButton'), cls:'addDirectLoginButton', children:[ |
106 | // {tag:'span', html:"+"} | 104 | // {tag:'span', html:"+"} |
107 | // ]} | 105 | // ]} |
108 | ]}, | 106 | ]}, |
109 | {tag:'li', id:this.getId('sharingTab'), children:[{tag:'span', html:"sharing"}]} | 107 | {tag:'li', id:this.getId('sharingTab'), children:[{tag:'span', html:"sharing"}]} |
110 | ]} | 108 | ]} |
111 | ]}, | 109 | ]}, |
112 | {tag:'div', cls:'tabPanels', children:[ | 110 | {tag:'div', cls:'tabPanels', children:[ |
113 | {tag:'ul', cls:'tabPanels', children:[ | 111 | {tag:'ul', cls:'tabPanels', children:[ |
114 | {tag:'li', id:this.getId('detailTabpanel'), cls:'tabPanel', children:[ | 112 | {tag:'li', id:this.getId('detailTabpanel'), cls:'tabPanel', children:[ |
115 | {tag:'div', id:this.getId('recordFields'), children:[ | 113 | {tag:'div', id:this.getId('recordFields'), children:[ |
116 | {tag:'table', cls:'fields', cellpadding:'0', id:this.getId('fieldTable'), cellspacing:'0', children:[ | 114 | {tag:'table', cls:'fields', cellpadding:'0', id:this.getId('fieldTable'), cellspacing:'0', children:[ |
117 | {tag:'thead', children:[ | 115 | {tag:'thead', children:[ |
118 | {tag:'tr', children:[ | 116 | {tag:'tr', children:[ |
119 | {tag:'th', cls:'fieldStateTH',html:""}, | 117 | {tag:'th', cls:'fieldStateTH',html:""}, |
120 | {tag:'th', cls:'fieldLabelTH',html:"label"}, | 118 | {tag:'th', cls:'fieldLabelTH',html:"label"}, |
121 | {tag:'th', cls:'fieldLockTH',html:""}, | 119 | {tag:'th', cls:'fieldLockTH',html:""}, |
122 | {tag:'th', cls:'fieldValueTH',html:"value"}, | 120 | {tag:'th', cls:'fieldValueTH',html:"value"}, |
123 | {tag:'th', cls:'fieldActionTH',html:""}, | 121 | {tag:'th', cls:'fieldActionTH',html:""}, |
124 | {tag:'th', cls:'fieldDeleteTH',html:""} | 122 | {tag:'th', cls:'fieldDeleteTH',html:""} |
125 | ]} | 123 | ]} |
126 | ]}, | 124 | ]}, |
127 | {tag:'tfoot'}, | 125 | {tag:'tfoot'}, |
128 | {tag:'tbody', id:this.getId('tableBody'), children:[ | 126 | {tag:'tbody', id:this.getId('tableBody'), children:[ |
129 | {tag:'tr', id:this.getId('newFieldTR'), cls:'newFieldTR', children:[ | 127 | {tag:'tr', id:this.getId('newFieldTR'), cls:'newFieldTR', children:[ |
130 | {tag:'td', cls:'fieldState'}, | 128 | {tag:'td', cls:'fieldState'}, |
131 | {tag:'td', cls:'fieldLabel', children:[ | 129 | {tag:'td', cls:'fieldLabel', children:[ |
132 | {tag:'input', cls:'label', id:this.getId('newFieldLabel')} | 130 | {tag:'input', cls:'label', id:this.getId('newFieldLabel')} |
133 | ]}, | 131 | ]}, |
134 | {tag:'td', cls:'fieldLock', children:[ | 132 | {tag:'td', cls:'fieldLock', children:[ |
135 | {tag:'div', cls:'unlocked', id:this.getId('newFieldIsLocked')} | 133 | {tag:'div', cls:'unlocked', id:this.getId('newFieldIsLocked')} |
136 | ]}, | 134 | ]}, |
137 | {tag:'td', cls:'fieldValue', children:[ | 135 | {tag:'td', cls:'fieldValue', children:[ |
138 | {tag:'div', cls:'unlocked', id:this.getId('newFieldValueWrapper'), children:[ | 136 | {tag:'div', cls:'unlocked', id:this.getId('newFieldValueWrapper'), children:[ |
139 | {tag:'input',type:'text', cls:'value', id:this.getId('newFieldValue')} | 137 | {tag:'input',type:'text', cls:'value', id:this.getId('newFieldValue')} |
140 | ]} | 138 | ]} |
141 | ]}, | 139 | ]}, |
142 | {tag:'td', cls:'fieldAction', children:[ | 140 | {tag:'td', cls:'fieldAction', children:[ |
143 | {tag:'div', html:' '} | 141 | {tag:'div', html:' '} |
144 | ]}, | 142 | ]}, |
145 | {tag:'td', cls:'fieldAddDelete', children:[ | 143 | {tag:'td', cls:'fieldAddDelete', children:[ |
146 | {tag:'div', cls:'new', children:[ | 144 | {tag:'div', cls:'new', children:[ |
147 | {tag:'span', children:[ | 145 | {tag:'span', children:[ |
148 | {tag:'a', href:'#', id:this.getId('newFieldAddButton'), html:"add"} | 146 | {tag:'a', href:'#', id:this.getId('newFieldAddButton'), html:"add"} |
149 | ]} | 147 | ]} |
150 | ]} | 148 | ]} |
151 | ]} | 149 | ]} |
152 | ]} | 150 | ]} |
153 | ]} | 151 | ]} |
154 | ]} | 152 | ]} |
155 | ]}, | 153 | ]}, |
156 | {tag:'div', cls:'notes', children:[ | 154 | {tag:'div', cls:'notes', children:[ |
157 | {tag:'div', children:[ | 155 | {tag:'div', children:[ |
158 | {tag:'textarea', id:this.getId('recordNote'), value:""} | 156 | {tag:'textarea', id:this.getId('recordNote'), value:""} |
159 | ]} | 157 | ]} |
160 | ]} | 158 | ]} |
161 | ]}, | 159 | ]}, |
162 | {tag:'li', id:this.getId('directLoginTabpanel'), cls:'tabPanel', children:[ | 160 | {tag:'li', id:this.getId('directLoginTabpanel'), cls:'tabPanel', children:[ |
163 | {tag:'div', id:this.getId('directLoginsComponentContainer'), cls:'directLoginsComponentContainer', children:[ | 161 | {tag:'div', id:this.getId('directLoginsComponentContainer'), cls:'directLoginsComponentContainer', children:[ |
164 | {tag:'div', id:this.getId('directLogins'), cls:'directLogins', children:[ | 162 | {tag:'div', id:this.getId('directLogins'), cls:'directLogins', children:[ |
165 | {tag:'div', id:this.getId('addNewDirectLoginSplash'), cls:'addNewDirectLoginSplash', children:[ | 163 | {tag:'div', id:this.getId('addNewDirectLoginSplash'), cls:'addNewDirectLoginSplash', children:[ |
166 | {tag:'h3', html:"Here you can add a Direct Login for this card: instant access to your favorit website!"}, | 164 | {tag:'h3', html:"Here you can add a Direct Login for this card: instant access to your favorit website!"}, |
167 | {tag:'a', href:'#', id:this.getId('addNewDirectLoginSplashButton'), children:[{tag:'span', html:"Add Direct Login"}]} | 165 | {tag:'a', href:'#', id:this.getId('addNewDirectLoginSplashButton'), children:[{tag:'span', html:"Add Direct Login"}]} |
168 | ]}, | 166 | ]}, |
169 | {tag:'div', id:this.getId('directLoginsList')}, | 167 | {tag:'div', id:this.getId('directLoginsList')}, |
170 | {tag:'div', cls:'addDirectLoginListItem', id:this.getId('addDirectLoginListItem'), children:[{tag:'a', href:'#', id:this.getId('addNewDirectLoginListItemButton'), children:[{tag:'span', html:"Add Direct Login"}]}]} | 168 | {tag:'div', cls:'addDirectLoginListItem', id:this.getId('addDirectLoginListItem'), children:[{tag:'a', href:'#', id:this.getId('addNewDirectLoginListItemButton'), children:[{tag:'span', html:"Add Direct Login"}]}]} |
171 | ]}, | 169 | ]}, |
172 | {tag:'div', id:this.getId('directLoginEditDetail'), cls:'directLoginEditDetail'} | 170 | {tag:'div', id:this.getId('directLoginEditDetail'), cls:'directLoginEditDetail'} |
173 | ]} | 171 | ]} |
174 | ]}, | 172 | ]}, |
175 | {tag:'li', id:this.getId('sharingTabpanel'), cls:'tabPanel', children:[ | 173 | {tag:'li', id:this.getId('sharingTabpanel'), cls:'tabPanel', children:[ |
176 | {tag:'h2', html:"Coming soon!"} | 174 | {tag:'h2', html:"Coming soon!"} |
177 | ]} | 175 | ]} |
178 | ]} | 176 | ]} |
179 | ]}, | 177 | ]}, |
180 | {tag:'div', cls:'mask', children:[ | 178 | {tag:'div', cls:'mask', children:[ |
181 | {tag:'div', id:this.getId('progress'), children:[ | 179 | {tag:'div', id:this.getId('progress'), children:[ |
182 | {tag:'h3', id:this.getId('progressDescription'), cls:'progressDescription', html:"Loading"}, | 180 | {tag:'h3', id:this.getId('progressDescription'), cls:'progressDescription', html:"Loading"}, |
183 | {tag:'div', id:this.getId('progressBar')} | 181 | {tag:'div', id:this.getId('progressBar')} |
184 | ]}, | 182 | ]}, |
185 | {tag:'div', id:this.getId('error'), cls:'error', children:[ | 183 | {tag:'div', id:this.getId('error'), cls:'error', children:[ |
186 | {tag:'div', cls:'img'}, | 184 | {tag:'div', cls:'img'}, |
187 | {tag:'p', id:this.getId('errorMessage')} | 185 | {tag:'p', id:this.getId('errorMessage')} |
188 | ]} | 186 | ]} |
189 | ]} | 187 | ]} |
190 | ]}, | 188 | ]}, |
191 | {tag:'div', cls:'footer', children:[ | 189 | {tag:'div', cls:'footer', children:[ |
192 | {tag:'div', cls:'buttonArea', children:[ | 190 | {tag:'div', cls:'buttonArea', children:[ |
193 | {tag:'div', cls:'cancel', id:this.getId('cancelButton'), html:"cancel"}, | 191 | {tag:'div', cls:'cancel', id:this.getId('cancelButton'), html:"cancel"}, |
194 | {tag:'div', cls:'save disabled', id:this.getId('saveButton'), html:"save"} | 192 | {tag:'div', cls:'save disabled', id:this.getId('saveButton'), html:"save"} |
195 | ]} | 193 | ]} |
196 | ]} | 194 | ]} |
197 | ]} | 195 | ]} |
198 | ]}); | 196 | ]}); |
199 | 197 | ||
200 | 198 | ||
201 | this.insertAllTooltips(); | 199 | this.insertAllTooltips(); |
202 | 200 | ||
203 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); | 201 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); |
204 | 202 | ||
205 | this.tabPanelController().setup({selected:'DETAILS'}); | 203 | this.tabPanelController().setup({selected:'DETAILS'}); |
206 | // this.tabPanelController().setup({selected:'DIRECT_LOGINS'}); | 204 | // this.tabPanelController().setup({selected:'DIRECT_LOGINS'}); |
207 | 205 | ||
208 | MochiKit.Style.hideElement(this.getId('error')); | 206 | MochiKit.Style.hideElement(this.getId('error')); |
209 | MochiKit.Style.hideElement(this.getElement('directLoginEditDetail')); | 207 | MochiKit.Style.hideElement(this.getElement('directLoginEditDetail')); |
210 | MochiKit.Style.hideElement(this.getElement('addDirectLoginListItem')); | 208 | MochiKit.Style.hideElement(this.getElement('addDirectLoginListItem')); |
211 | this.plumbDetailsPanel(); | 209 | this.plumbDetailsPanel(); |
212 | 210 | ||
213 | MochiKit.Signal.connect(this.getId('cancelButton'), 'onclick', this, 'handleCancelEvent'); | 211 | MochiKit.Signal.connect(this.getId('cancelButton'), 'onclick', this, 'handleCancelEvent'); |
214 | MochiKit.Signal.connect(this.getId('saveButton'), 'onclick', this, 'handleSaveEvent'); | 212 | MochiKit.Signal.connect(this.getId('saveButton'), 'onclick', this, 'handleSaveEvent'); |
215 | 213 | ||
216 | MochiKit.Signal.connect(this.getId('addNewDirectLoginSplashButton'), 'onclick', this, 'handleAddDirectLogin'); | 214 | MochiKit.Signal.connect(this.getId('addNewDirectLoginSplashButton'), 'onclick', this, 'handleAddDirectLogin'); |
217 | MochiKit.Signal.connect(this.getId('addNewDirectLoginListItemButton'), 'onclick', this, 'handleAddDirectLogin'); | 215 | MochiKit.Signal.connect(this.getId('addNewDirectLoginListItemButton'), 'onclick', this, 'handleAddDirectLogin'); |
218 | 216 | ||
219 | MochiKit.Signal.connect(MochiKit.DOM.currentDocument().body, 'onkeydown',this, 'handleKeyEvent'); | 217 | MochiKit.Signal.connect(MochiKit.DOM.currentDocument().body, 'onkeydown',this, 'handleKeyEvent'); |
220 | }, | 218 | }, |
221 | 219 | ||
222 | //------------------------------------------------------------------------- | 220 | //------------------------------------------------------------------------- |
223 | 221 | ||
224 | 'displayMode': function () { | 222 | 'displayMode': function () { |
225 | return this._displayMode; | 223 | return this._displayMode; |
226 | }, | 224 | }, |
227 | 225 | ||
228 | 'setDisplayMode': function (aValue) { | 226 | 'setDisplayMode': function (aValue) { |
229 | this._displayMode = aValue; | 227 | this._displayMode = aValue; |
230 | }, | 228 | }, |
231 | 229 | ||
232 | //------------------------------------------------------------------------- | 230 | //------------------------------------------------------------------------- |
233 | 231 | ||
234 | 'plumbDetailsPanel': function () { | 232 | 'plumbDetailsPanel': function () { |
235 | MochiKit.Signal.connect(this.getId('title'), 'onfocus', MochiKit.Base.method(this, 'handleOnFocusEvent',this.getElement('title').parentNode)); | 233 | MochiKit.Signal.connect(this.getId('title'), 'onfocus', MochiKit.Base.method(this, 'handleOnFocusEvent',this.getElement('title').parentNode)); |
236 | MochiKit.Signal.connect(this.getId('title'), 'onblur',MochiKit.Base.method(this, 'handleLooseFocusEvent', this.getElement('title').parentNode)); | 234 | MochiKit.Signal.connect(this.getId('title'), 'onblur',MochiKit.Base.method(this, 'handleLooseFocusEvent', this.getElement('title').parentNode)); |
237 | MochiKit.Signal.connect(this.getId('title'), 'onchange',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | 235 | MochiKit.Signal.connect(this.getId('title'), 'onchange',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); |
238 | MochiKit.Signal.connect(this.getId('title'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | 236 | MochiKit.Signal.connect(this.getId('title'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); |
239 | 237 | ||
240 | MochiKit.Signal.connect(this.getId('recordNote'), 'onfocus', MochiKit.Base.method(this, 'handleOnFocusEvent',MochiKit.Selector.findChildElements(this.element(), ['div.notes'])[0])); | 238 | MochiKit.Signal.connect(this.getId('recordNote'), 'onfocus', MochiKit.Base.method(this, 'handleOnFocusEvent',MochiKit.Selector.findChildElements(this.element(), ['div.notes'])[0])); |
241 | MochiKit.Signal.connect(this.getId('recordNote'), 'onblur',MochiKit.Base.method(this, 'handleLooseFocusEvent', MochiKit.Selector.findChildElements(this.element(), ['div.notes'])[0])); | 239 | MochiKit.Signal.connect(this.getId('recordNote'), 'onblur',MochiKit.Base.method(this, 'handleLooseFocusEvent', MochiKit.Selector.findChildElements(this.element(), ['div.notes'])[0])); |
242 | MochiKit.Signal.connect(this.getId('recordNote'), 'onchange',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | 240 | MochiKit.Signal.connect(this.getId('recordNote'), 'onchange',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); |
243 | MochiKit.Signal.connect(this.getId('recordNote'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | 241 | MochiKit.Signal.connect(this.getId('recordNote'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); |
244 | 242 | ||
245 | MochiKit.Signal.connect(this.getId('newFieldValue'), 'onkeydown',this, 'handleKeyDownOnNewFieldValue'); | 243 | MochiKit.Signal.connect(this.getId('newFieldValue'), 'onkeydown',this, 'handleKeyDownOnNewFieldValue'); |
246 | 244 | ||
247 | MochiKit.Signal.connect(this.getId('newFieldLabel'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | 245 | MochiKit.Signal.connect(this.getId('newFieldLabel'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); |
248 | MochiKit.Signal.connect(this.getId('newFieldIsLocked'), 'onclick',this, 'toggleNewFieldIsHidden'); | 246 | MochiKit.Signal.connect(this.getId('newFieldIsLocked'), 'onclick',this, 'toggleNewFieldIsHidden'); |
249 | MochiKit.Signal.connect(this.getId('newFieldValue'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | 247 | MochiKit.Signal.connect(this.getId('newFieldValue'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); |
250 | 248 | ||
251 | MochiKit.Signal.connect(this.getId('newFieldAddButton'), 'onclick', this, 'handleAddClick'); | 249 | MochiKit.Signal.connect(this.getId('newFieldAddButton'), 'onclick', this, 'handleAddClick'); |
252 | }, | 250 | }, |
253 | 251 | ||
254 | //------------------------------------------------------------------------- | 252 | //------------------------------------------------------------------------- |
255 | 253 | ||
256 | 'insertAllTooltips': function () { | 254 | 'insertAllTooltips': function () { |
257 | var tooltips; | 255 | var tooltips; |
258 | var tooltipEnabled; | 256 | var tooltipEnabled; |
259 | 257 | ||
260 | tooltips = {}; | 258 | tooltips = {}; |
261 | tooltipEnabled = (this.hintMode() == 'ON'); | 259 | tooltipEnabled = (this.hintMode() == 'ON'); |
262 | 260 | ||
263 | tooltips['title'] = new Clipperz.PM.UI.Common.Components.Tooltip({ | 261 | tooltips['title'] = new Clipperz.PM.UI.Common.Components.Tooltip({ |
264 | 'element':this.getElement('title'), | 262 | 'element':this.getElement('title'), |
265 | 'text': "Insert here the title of the card", | 263 | 'text': "Insert here the title of the card", |
266 | 'position':'RIGHT' | 264 | 'position':'RIGHT' |
267 | }); | 265 | }); |
268 | this.addComponent(tooltips['title']); | 266 | this.addComponent(tooltips['title']); |
269 | MochiKit.Signal.connect(this.getId('title'), 'onfocus',MochiKit.Base.method(this, 'showTooltipOnFocus', 'title')); | 267 | MochiKit.Signal.connect(this.getId('title'), 'onfocus',MochiKit.Base.method(this, 'showTooltipOnFocus', 'title')); |
270 | MochiKit.Signal.connect(this.getId('title'), 'onblur', MochiKit.Base.method(this, 'hideTooltipOnBlur', 'title')); | 268 | MochiKit.Signal.connect(this.getId('title'), 'onblur', MochiKit.Base.method(this, 'hideTooltipOnBlur', 'title')); |
271 | 269 | ||
272 | tooltips['newFieldTR'] = new Clipperz.PM.UI.Common.Components.Tooltip({ | 270 | tooltips['newFieldTR'] = new Clipperz.PM.UI.Common.Components.Tooltip({ |
273 | 'element':this.getElement('newFieldTR'), | 271 | 'element':this.getElement('newFieldTR'), |
274 | 'text': "Insert your card new values here", | 272 | 'text': "Insert your card new values here", |
275 | 'position':'RIGHT' | 273 | 'position':'RIGHT' |
276 | }); | 274 | }); |
277 | this.addComponent(tooltips['newFieldTR']); | 275 | this.addComponent(tooltips['newFieldTR']); |
278 | MochiKit.Signal.connect(this.getId('newFieldLabel'), 'onfocus',MochiKit.Base.method(this, 'showTooltipOnFocus', 'newFieldTR')); | 276 | MochiKit.Signal.connect(this.getId('newFieldLabel'), 'onfocus',MochiKit.Base.method(this, 'showTooltipOnFocus', 'newFieldTR')); |
279 | MochiKit.Signal.connect(this.getId('newFieldValue'), 'onblur', MochiKit.Base.method(this, 'hideTooltipOnBlur', 'newFieldTR')); | 277 | MochiKit.Signal.connect(this.getId('newFieldValue'), 'onblur', MochiKit.Base.method(this, 'hideTooltipOnBlur', 'newFieldTR')); |
280 | 278 | ||
281 | tooltips['recordNote'] = new Clipperz.PM.UI.Common.Components.Tooltip({ | 279 | tooltips['recordNote'] = new Clipperz.PM.UI.Common.Components.Tooltip({ |
282 | 'element':this.getElement('recordNote'), | 280 | 'element':this.getElement('recordNote'), |
283 | 'text': "You can insert some notes here", | 281 | 'text': "You can insert some notes here", |
284 | 'position':'RIGHT' | 282 | 'position':'RIGHT' |
285 | }); | 283 | }); |
286 | this.addComponent(tooltips['recordNote']); | 284 | this.addComponent(tooltips['recordNote']); |
287 | MochiKit.Signal.connect(this.getId('recordNote'), 'onfocus',MochiKit.Base.method(this, 'showTooltipOnFocus', 'recordNote')); | 285 | MochiKit.Signal.connect(this.getId('recordNote'), 'onfocus',MochiKit.Base.method(this, 'showTooltipOnFocus', 'recordNote')); |
288 | MochiKit.Signal.connect(this.getId('recordNote'), 'onblur', MochiKit.Base.method(this, 'hideTooltipOnBlur', 'recordNote')); | 286 | MochiKit.Signal.connect(this.getId('recordNote'), 'onblur', MochiKit.Base.method(this, 'hideTooltipOnBlur', 'recordNote')); |
289 | 287 | ||
290 | this._tooltips = tooltips; | 288 | this._tooltips = tooltips; |
291 | }, | 289 | }, |
292 | 290 | ||
293 | //......................................................................... | 291 | //......................................................................... |
294 | 292 | ||
295 | 'updateAllTooltipsEnabledMode': function (aStatus) { | 293 | 'updateAllTooltipsEnabledMode': function (aStatus) { |
296 | vartooltipLabel; | 294 | vartooltipLabel; |
297 | var tooltipEnabled; | 295 | var tooltipEnabled; |
298 | 296 | ||
299 | tooltipEnabled = (aStatus == 'ON') ? true : false; | 297 | tooltipEnabled = (aStatus == 'ON') ? true : false; |
300 | 298 | ||
301 | for (tooltipLabel in this.tooltips()) { | 299 | for (tooltipLabel in this.tooltips()) { |
302 | this.tooltips()[tooltipLabel].setIsEnabled(tooltipEnabled); | 300 | this.tooltips()[tooltipLabel].setIsEnabled(tooltipEnabled); |
303 | } | 301 | } |
304 | }, | 302 | }, |
305 | 303 | ||
306 | //......................................................................... | 304 | //......................................................................... |
307 | 305 | ||
308 | 'tooltips': function () { | 306 | 'tooltips': function () { |
309 | return this._tooltips; | 307 | return this._tooltips; |
310 | }, | 308 | }, |
311 | 309 | ||
312 | //......................................................................... | 310 | //......................................................................... |
313 | 311 | ||
314 | 'showTooltipOnFocus': function (aTooltip, anEvent) { | 312 | 'showTooltipOnFocus': function (aTooltip, anEvent) { |
315 | MochiKit.Async.callLater(0.5, MochiKit.Base.method(this.tooltips()[aTooltip], 'show')); | 313 | MochiKit.Async.callLater(0.5, MochiKit.Base.method(this.tooltips()[aTooltip], 'show')); |
316 | }, | 314 | }, |
317 | 315 | ||
318 | //......................................................................... | 316 | //......................................................................... |
319 | 317 | ||
320 | 'hideTooltipOnBlur': function (aTooltip, anEvent) { | 318 | 'hideTooltipOnBlur': function (aTooltip, anEvent) { |
321 | this.tooltips()[aTooltip].hide(); | 319 | this.tooltips()[aTooltip].hide(); |
322 | }, | 320 | }, |
323 | 321 | ||
324 | //------------------------------------------------------------------------- | 322 | //------------------------------------------------------------------------- |
325 | 323 | ||
326 | 'displayElement': function() { | 324 | 'displayElement': function() { |
327 | return this.getElement('panel'); | 325 | return this.getElement('panel'); |
328 | }, | 326 | }, |
329 | 327 | ||
330 | //------------------------------------------------------------------------- | 328 | //------------------------------------------------------------------------- |
331 | 329 | ||
332 | 'fieldComponents': function () { | 330 | 'fieldComponents': function () { |
333 | return this._fieldComponents; | 331 | return this._fieldComponents; |
334 | }, | 332 | }, |
335 | 333 | ||
336 | //------------------------------------------------------------------------- | 334 | //------------------------------------------------------------------------- |
337 | 335 | ||
338 | 'directLoginComponents': function () { | 336 | 'directLoginComponents': function () { |
339 | return this._directLoginComponents; | 337 | return this._directLoginComponents; |
340 | }, | 338 | }, |
341 | 339 | ||
342 | //------------------------------------------------------------------------- | 340 | //------------------------------------------------------------------------- |
343 | 341 | ||
344 | 'hintMode': function () { | 342 | 'hintMode': function () { |
345 | return this._hintMode; | 343 | return this._hintMode; |
346 | }, | 344 | }, |
347 | 345 | ||
348 | 'setHintMode': function (aValue) { | 346 | 'setHintMode': function (aValue) { |
349 | if (this._hintMode != aValue) { | 347 | if (this._hintMode != aValue) { |
350 | this._hintMode = aValue; | 348 | this._hintMode = aValue; |
351 | 349 | ||
352 | this.updateAllTooltipsEnabledMode(this._hintMode); | 350 | this.updateAllTooltipsEnabledMode(this._hintMode); |
353 | // if (this._hintMode == 'ON') { | 351 | // if (this._hintMode == 'ON') { |
354 | // this.enableHints(); | 352 | // this.enableHints(); |
355 | // } | 353 | // } |
356 | } | 354 | } |
357 | }, | 355 | }, |
358 | 356 | ||
359 | //------------------------------------------------------------------------- | 357 | //------------------------------------------------------------------------- |
360 | 358 | ||
361 | 'focusOnNewFieldLabel': function () { | 359 | 'focusOnNewFieldLabel': function () { |
362 | this.getElement('newFieldLabel').focus(); | 360 | this.getElement('newFieldLabel').focus(); |
363 | }, | 361 | }, |
364 | 362 | ||
365 | //========================================================================= | 363 | //========================================================================= |
366 | 364 | ||
367 | 'isSavingEnabled': function () { | 365 | 'isSavingEnabled': function () { |
368 | return this._isSavingEnabled; | 366 | return this._isSavingEnabled; |
369 | }, | 367 | }, |
370 | 368 | ||
371 | 'setShouldEnableSaving': function (aValue) { | 369 | 'setShouldEnableSaving': function (aValue) { |
372 | this._isSavingEnabled = aValue || this.newFieldHasPendingChanges(); | 370 | this._isSavingEnabled = aValue || this.newFieldHasPendingChanges(); |
373 | 371 | ||
374 | if (this._isSavingEnabled == true) { | 372 | if (this._isSavingEnabled == true) { |
375 | MochiKit.DOM.addElementClass(this.getElement('panel'), 'hasPendingChanges'); | 373 | MochiKit.DOM.addElementClass(this.getElement('panel'), 'hasPendingChanges'); |
376 | MochiKit.DOM.removeElementClass(this.getId('saveButton'), 'disabled'); | 374 | MochiKit.DOM.removeElementClass(this.getId('saveButton'), 'disabled'); |
377 | } else { | 375 | } else { |
378 | MochiKit.DOM.removeElementClass(this.getElement('panel'), 'hasPendingChanges'); | 376 | MochiKit.DOM.removeElementClass(this.getElement('panel'), 'hasPendingChanges'); |
379 | MochiKit.DOM.addElementClass(this.getId('saveButton'), 'disabled'); | 377 | MochiKit.DOM.addElementClass(this.getId('saveButton'), 'disabled'); |
380 | } | 378 | } |
381 | }, | 379 | }, |
382 | 380 | ||
383 | //========================================================================= | 381 | //========================================================================= |
384 | 382 | ||
385 | 'title': function () { | 383 | 'title': function () { |
386 | return this.getElement('title').value; | 384 | return this.getElement('title').value; |
387 | }, | 385 | }, |
388 | 386 | ||
389 | 'setTitle': function (aValue) { | 387 | 'setTitle': function (aValue) { |
390 | this.renderTitle(aValue); | 388 | this.renderTitle(aValue); |
391 | }, | 389 | }, |
392 | 390 | ||
393 | //------------------------------------------------------------------------- | 391 | //------------------------------------------------------------------------- |
394 | 392 | ||
395 | 'renderTitle': function (aValue) { | 393 | 'renderTitle': function (aValue) { |
396 | this.getElement('title').value = Clipperz.Base.sanitizeString(aValue); | 394 | this.getElement('title').value = Clipperz.Base.sanitizeString(aValue); |
397 | }, | 395 | }, |
398 | 396 | ||
399 | //------------------------------------------------------------------------- | 397 | //------------------------------------------------------------------------- |
400 | 398 | ||
401 | 'setFocusOnTitleField': function () { | 399 | 'setFocusOnTitleField': function () { |
402 | this.getElement('title').focus(); | 400 | this.getElement('title').focus(); |
403 | }, | 401 | }, |
404 | 402 | ||
405 | //------------------------------------------------------------------------- | 403 | //------------------------------------------------------------------------- |
406 | 404 | ||
407 | 'disableCardTitleEditing': function () { | 405 | 'disableCardTitleEditing': function () { |
408 | this.getElement('title').disabled = true; | 406 | this.getElement('title').disabled = true; |
409 | MochiKit.DOM.addElementClass(this.getElement('title').parentNode, 'disabled'); | 407 | MochiKit.DOM.addElementClass(this.getElement('title').parentNode, 'disabled'); |
410 | }, | 408 | }, |
411 | 409 | ||
412 | 410 | ||
413 | 'enableCardTitleEditing': function () { | 411 | 'enableCardTitleEditing': function () { |
414 | this.getElement('title').disabled = false; | 412 | this.getElement('title').disabled = false; |
415 | MochiKit.DOM.removeElementClass(this.getElement('title').parentNode, 'disabled'); | 413 | MochiKit.DOM.removeElementClass(this.getElement('title').parentNode, 'disabled'); |
416 | }, | 414 | }, |
417 | 415 | ||
418 | //========================================================================= | 416 | //========================================================================= |
419 | 417 | ||
420 | 'notes': function () { | 418 | 'notes': function () { |
421 | return this.getElement('recordNote').value; | 419 | return this.getElement('recordNote').value; |
422 | }, | 420 | }, |
423 | 421 | ||
424 | 'setNotes': function (aValue) { | 422 | 'setNotes': function (aValue) { |
425 | this.renderNotes(aValue); | 423 | this.renderNotes(aValue); |
426 | }, | 424 | }, |
427 | 425 | ||
428 | //------------------------------------------------------------------------- | 426 | //------------------------------------------------------------------------- |
429 | 427 | ||
430 | 'renderNotes': function (aValue) { | 428 | 'renderNotes': function (aValue) { |
431 | var noteElement; | 429 | var noteElement; |
432 | 430 | ||
433 | noteElement = this.getElement('recordNote'); | 431 | noteElement = this.getElement('recordNote'); |
434 | 432 | ||
435 | if ((aValue != null) && (typeof(aValue) != 'undefined')) { | 433 | if ((aValue != null) && (typeof(aValue) != 'undefined')) { |
436 | noteElement.value = aValue; | 434 | noteElement.value = aValue; |
437 | } else { | 435 | } else { |
438 | noteElement.value = ""; | 436 | noteElement.value = ""; |
439 | } | 437 | } |
440 | 438 | ||
441 | this.fixNotesHeight(); | 439 | this.fixNotesHeight(); |
442 | }, | 440 | }, |
443 | 441 | ||
444 | //========================================================================= | 442 | //========================================================================= |
445 | 443 | ||
446 | 'addFieldRowComponent': function (aFieldComponent) { | 444 | 'addFieldRowComponent': function (aFieldComponent) { |
447 | varfieldTR; | 445 | varfieldTR; |
448 | 446 | ||
449 | fieldTR = this.insertBefore(this.getElement('newFieldTR'), {tag:'tr', id:'recordFieldReferece_'+aFieldComponent.reference()}); | 447 | fieldTR = this.insertBefore(this.getElement('newFieldTR'), {tag:'tr', id:'recordFieldReferece_'+aFieldComponent.reference()}); |
450 | aFieldComponent.renderInNode(fieldTR); | 448 | aFieldComponent.renderInNode(fieldTR); |
451 | this.fieldComponents()[aFieldComponent.reference()] = aFieldComponent; | 449 | this.fieldComponents()[aFieldComponent.reference()] = aFieldComponent; |
452 | }, | 450 | }, |
453 | 451 | ||
454 | //========================================================================= | 452 | //========================================================================= |
455 | 453 | ||
456 | 'addDirectLoginComponent': function (aDirectLoginComponent) { | 454 | 'addDirectLoginComponent': function (aDirectLoginComponent) { |
457 | var directLoginDIV; | 455 | var directLoginDIV; |
458 | 456 | ||
459 | if (MochiKit.Base.keys(this.directLoginComponents()).length == 0) { | 457 | if (MochiKit.Base.keys(this.directLoginComponents()).length == 0) { |
460 | this.hideNewDirectLoginSplash(); | 458 | this.hideNewDirectLoginSplash(); |
461 | } | 459 | } |
462 | 460 | ||
463 | directLoginDIV = this.append(this.getElement('directLoginsList'), {tag:'div', cls:'directLoginItem'}); | 461 | directLoginDIV = this.append(this.getElement('directLoginsList'), {tag:'div', cls:'directLoginItem'}); |
464 | aDirectLoginComponent.renderInNode(directLoginDIV); | 462 | aDirectLoginComponent.renderInNode(directLoginDIV); |
465 | this.directLoginComponents()[aDirectLoginComponent.reference()] = aDirectLoginComponent; | 463 | this.directLoginComponents()[aDirectLoginComponent.reference()] = aDirectLoginComponent; |
466 | }, | 464 | }, |
467 | 465 | ||
468 | 'removeDirectLoginComponent': function (aDirectLoginComponent) { | 466 | 'removeDirectLoginComponent': function (aDirectLoginComponent) { |
469 | delete this.directLoginComponents()[aDirectLoginComponent.reference()]; | 467 | delete this.directLoginComponents()[aDirectLoginComponent.reference()]; |
470 | aDirectLoginComponent.remove(); | 468 | aDirectLoginComponent.remove(); |
471 | 469 | ||
472 | if (MochiKit.Base.keys(this.directLoginComponents()).length == 0) { | 470 | if (MochiKit.Base.keys(this.directLoginComponents()).length == 0) { |
473 | this.showNewDirectLoginSplash(); | 471 | this.showNewDirectLoginSplash(); |
474 | } | 472 | } |
475 | }, | 473 | }, |
476 | 474 | ||
477 | //========================================================================= | 475 | //========================================================================= |
478 | 476 | ||
479 | 'showNewDirectLoginSplash': function () { | 477 | 'showNewDirectLoginSplash': function () { |
480 | MochiKit.Style.showElement(this.getElement('addNewDirectLoginSplash')); | 478 | MochiKit.Style.showElement(this.getElement('addNewDirectLoginSplash')); |
481 | MochiKit.Style.hideElement(this.getElement('addDirectLoginListItem')); | 479 | MochiKit.Style.hideElement(this.getElement('addDirectLoginListItem')); |
482 | }, | 480 | }, |
483 | 481 | ||
484 | 'hideNewDirectLoginSplash': function () { | 482 | 'hideNewDirectLoginSplash': function () { |
485 | MochiKit.Style.hideElement(this.getElement('addNewDirectLoginSplash')); | 483 | MochiKit.Style.hideElement(this.getElement('addNewDirectLoginSplash')); |
486 | MochiKit.Style.showElement(this.getElement('addDirectLoginListItem')); | 484 | MochiKit.Style.showElement(this.getElement('addDirectLoginListItem')); |
487 | }, | 485 | }, |
488 | 486 | ||
489 | //========================================================================= | 487 | //========================================================================= |
490 | 488 | ||
491 | 'renderDirectLoginEditingComponent': function (aDirectLoginEditingComponent) { | 489 | 'renderDirectLoginEditingComponent': function (aDirectLoginEditingComponent) { |
492 | aDirectLoginEditingComponent.renderInNode(this.getElement('directLoginEditDetail')); | 490 | aDirectLoginEditingComponent.renderInNode(this.getElement('directLoginEditDetail')); |
493 | }, | 491 | }, |
494 | 492 | ||
495 | 'placeDirectLoginEditingComponent': function () { | 493 | 'placeDirectLoginEditingComponent': function () { |
496 | var width; | 494 | var width; |
497 | 495 | ||
498 | width = MochiKit.Style.getElementDimensions(this.getElement('directLoginsComponentContainer'))['w']; | 496 | width = MochiKit.Style.getElementDimensions(this.getElement('directLoginsComponentContainer'))['w']; |
499 | 497 | ||
500 | return Clipperz.Async.callbacks("CardDialogComponent.renderDirectLoginEditingComponent", [ | 498 | return Clipperz.Async.callbacks("CardDialogComponent.renderDirectLoginEditingComponent", [ |
501 | MochiKit.Base.bind(function () { | 499 | MochiKit.Base.bind(function () { |
502 | MochiKit.Style.setElementPosition (this.getElement('directLoginEditDetail'), {x:width, y:-MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}); | 500 | MochiKit.Style.setElementPosition (this.getElement('directLoginEditDetail'), {x:width, y:-MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}); |
503 | MochiKit.Style.setElementDimensions(this.getElement('directLoginEditDetail'), {w:width}); | 501 | MochiKit.Style.setElementDimensions(this.getElement('directLoginEditDetail'), {w:width}); |
504 | }, this), | 502 | }, this), |
505 | 503 | ||
506 | MochiKit.Base.noop | 504 | MochiKit.Base.noop |
507 | ], {trace:false}); | 505 | ], {trace:false}); |
508 | }, | 506 | }, |
509 | 507 | ||
510 | //========================================================================= | 508 | //========================================================================= |
511 | 509 | ||
512 | 'newFieldLabel': function () { | 510 | 'newFieldLabel': function () { |
513 | return this.getElement('newFieldLabel').value; | 511 | return this.getElement('newFieldLabel').value; |
514 | }, | 512 | }, |
515 | 513 | ||
516 | 'setNewFieldLabel': function (aValue) { | 514 | 'setNewFieldLabel': function (aValue) { |
517 | this.getElement('newFieldLabel').value = aValue; | 515 | this.getElement('newFieldLabel').value = aValue; |
518 | }, | 516 | }, |
519 | 517 | ||
520 | //------------------------------------------------------------------------- | 518 | //------------------------------------------------------------------------- |
521 | 519 | ||
522 | 'newFieldValue': function () { | 520 | 'newFieldValue': function () { |
523 | return this.getElement('newFieldValue').value; | 521 | return this.getElement('newFieldValue').value; |
524 | }, | 522 | }, |
525 | 523 | ||
526 | 'setNewFieldValue': function (aValue) { | 524 | 'setNewFieldValue': function (aValue) { |
527 | this.getElement('newFieldValue').value = aValue; | 525 | this.getElement('newFieldValue').value = aValue; |
528 | }, | 526 | }, |
529 | 527 | ||
530 | //------------------------------------------------------------------------- | 528 | //------------------------------------------------------------------------- |
531 | 529 | ||
532 | 'newFieldIsHidden': function () { | 530 | 'newFieldIsHidden': function () { |
533 | return MochiKit.DOM.hasElementClass(this.getElement('newFieldIsLocked'), 'locked'); | 531 | return MochiKit.DOM.hasElementClass(this.getElement('newFieldIsLocked'), 'locked'); |
534 | }, | 532 | }, |
535 | 533 | ||
536 | 'setNewFieldIsHidden': function (aValue) { | 534 | 'setNewFieldIsHidden': function (aValue) { |
537 | MochiKit.DOM.setElementClass(this.getElement('newFieldIsLocked'), (aValue ? 'locked': 'unlocked')); | 535 | MochiKit.DOM.setElementClass(this.getElement('newFieldIsLocked'), (aValue ? 'locked': 'unlocked')); |
538 | MochiKit.DOM.setElementClass(this.getElement('newFieldValueWrapper'), (aValue ? 'locked': 'unlocked')); | 536 | MochiKit.DOM.setElementClass(this.getElement('newFieldValueWrapper'), (aValue ? 'locked': 'unlocked')); |
539 | }, | 537 | }, |
540 | 538 | ||
541 | 'toggleNewFieldIsHidden': function (anEvent) { | 539 | 'toggleNewFieldIsHidden': function (anEvent) { |
542 | anEvent.preventDefault(); | 540 | anEvent.preventDefault(); |
543 | 541 | ||
544 | this.setNewFieldIsHidden(! this.newFieldIsHidden()); | 542 | this.setNewFieldIsHidden(! this.newFieldIsHidden()); |
545 | MochiKit.Signal.signal(this, 'changedValue'); | 543 | MochiKit.Signal.signal(this, 'changedValue'); |
546 | }, | 544 | }, |
547 | 545 | ||
548 | //------------------------------------------------------------------------- | 546 | //------------------------------------------------------------------------- |
549 | 547 | ||
550 | 'newFieldHasPendingChanges': function () { | 548 | 'newFieldHasPendingChanges': function () { |
551 | return ((this.newFieldLabel() != '') || (this.newFieldValue() != '') || (this.newFieldIsHidden() == true)); | 549 | return ((this.newFieldLabel() != '') || (this.newFieldValue() != '') || (this.newFieldIsHidden() == true)); |
552 | }, | 550 | }, |
553 | 551 | ||
554 | 'resetNewFieldInputs': function () { | 552 | 'resetNewFieldInputs': function () { |
555 | this.setNewFieldLabel(''); | 553 | this.setNewFieldLabel(''); |
556 | this.setNewFieldValue(''); | 554 | this.setNewFieldValue(''); |
557 | this.setNewFieldIsHidden(false); | 555 | this.setNewFieldIsHidden(false); |
558 | }, | 556 | }, |
559 | 557 | ||
560 | //========================================================================= | 558 | //========================================================================= |
561 | 559 | ||
562 | 'handleKeyDownOnNewFieldValue': function (anEvent) { | 560 | 'handleKeyDownOnNewFieldValue': function (anEvent) { |
563 | MochiKit.Signal.signal(this, 'keyPressed', anEvent); | 561 | MochiKit.Signal.signal(this, 'keyPressed', anEvent); |
564 | /* | 562 | /* |
565 | if ((anEvent.key().string == 'KEY_TAB') && this.newFieldHasPendingChanges()) { | 563 | if ((anEvent.key().string == 'KEY_TAB') && this.newFieldHasPendingChanges()) { |
566 | anEvent.preventDefault(); | 564 | anEvent.preventDefault(); |
567 | 565 | ||
568 | MochiKit.Signal.signal(this, 'addField'); | 566 | MochiKit.Signal.signal(this, 'addField'); |
569 | this.getElement('newFieldLabel').focus(); | 567 | this.getElement('newFieldLabel').focus(); |
570 | } | 568 | } |
571 | */ | 569 | */ |
572 | }, | 570 | }, |
573 | 571 | ||
574 | //------------------------------------------------------------------------- | 572 | //------------------------------------------------------------------------- |
575 | 573 | ||
576 | 'handleAddClick': function (anEvent) { | 574 | 'handleAddClick': function (anEvent) { |
577 | anEvent.preventDefault(); | 575 | anEvent.preventDefault(); |
578 | MochiKit.Signal.signal(this, 'addField'); | 576 | MochiKit.Signal.signal(this, 'addField'); |
579 | this.getElement('newFieldLabel').focus(); | 577 | this.getElement('newFieldLabel').focus(); |
580 | }, | 578 | }, |
581 | 579 | ||
582 | //========================================================================= | 580 | //========================================================================= |
583 | 581 | ||
584 | 'handleDeleteClick': function (aFieldKey, anEvent) { | 582 | 'handleDeleteClick': function (aFieldKey, anEvent) { |
585 | anEvent.preventDefault(); | 583 | anEvent.preventDefault(); |
586 | MochiKit.Signal.signal(this, 'deleteField', aFieldKey); | 584 | MochiKit.Signal.signal(this, 'deleteField', aFieldKey); |
587 | }, | 585 | }, |
588 | 586 | ||
589 | //------------------------------------------------------------------------- | 587 | //------------------------------------------------------------------------- |
590 | 588 | ||
591 | 'toggleLock': function (aFieldKey, anEvent) { | 589 | 'toggleLock': function (aFieldKey, anEvent) { |
592 | var shouldRedrawAsLocked; | 590 | var shouldRedrawAsLocked; |
593 | var currentTRElement; | 591 | var currentTRElement; |
594 | 592 | ||
595 | anEvent.preventDefault(); | 593 | anEvent.preventDefault(); |
596 | 594 | ||
597 | currentTRElement = Clipperz.DOM.get(aFieldKey); | 595 | currentTRElement = Clipperz.DOM.get(aFieldKey); |
598 | shouldRedrawAsLocked = (MochiKit.DOM.hasElementClass(currentTRElement, 'locked') ? false : true); | 596 | shouldRedrawAsLocked = (MochiKit.DOM.hasElementClass(currentTRElement, 'locked') ? false : true); |
599 | 597 | ||
600 | this.renderFieldTR(currentTRElement, { | 598 | this.renderFieldTR(currentTRElement, { |
601 | label:MochiKit.Selector.findChildElements(currentTRElement, ['td.fieldLabel input'])[0].value, | 599 | label:MochiKit.Selector.findChildElements(currentTRElement, ['td.fieldLabel input'])[0].value, |
602 | value:MochiKit.Selector.findChildElements(currentTRElement, ['td.fieldValue input'])[0].value | 600 | value:MochiKit.Selector.findChildElements(currentTRElement, ['td.fieldValue input'])[0].value |
603 | }, shouldRedrawAsLocked, MochiKit.DOM.hasElementClass(currentTRElement, 'new')); | 601 | }, shouldRedrawAsLocked, MochiKit.DOM.hasElementClass(currentTRElement, 'new')); |
604 | }, | 602 | }, |
605 | 603 | ||
606 | //========================================================================= | 604 | //========================================================================= |
607 | 605 | ||
608 | 'fixNotesHeight': function () { | 606 | 'fixNotesHeight': function () { |
609 | var element; | 607 | var element; |
610 | 608 | ||
611 | element = this.getElement('recordNote'); | 609 | element = this.getElement('recordNote'); |
612 | 610 | ||
613 | if (element.scrollHeight == 0) { | 611 | if (element.scrollHeight == 0) { |
614 | MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, 'fixNotesHeight')); | 612 | MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, 'fixNotesHeight')); |
615 | } else { | 613 | } else { |
616 | var textareaHeight; | 614 | var textareaHeight; |
617 | 615 | ||
618 | textareaHeight = Math.min(Math.max(50, element.scrollHeight), 500); | 616 | textareaHeight = Math.min(Math.max(50, element.scrollHeight), 500); |
619 | 617 | ||
620 | MochiKit.Style.setElementDimensions(element, {h:textareaHeight}, 'px'); | 618 | MochiKit.Style.setElementDimensions(element, {h:textareaHeight}, 'px'); |
621 | MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, 'fixRendering')); | 619 | MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, 'fixRendering')); |
622 | } | 620 | } |
623 | }, | 621 | }, |
624 | 622 | ||
625 | //------------------------------------------------------------------------- | 623 | //------------------------------------------------------------------------- |
626 | 624 | ||
627 | 'fixRendering': function () { | 625 | 'fixRendering': function () { |
628 | // varheight; | 626 | // varheight; |
629 | var y; | 627 | var y; |
630 | varscrollHeight; | 628 | varscrollHeight; |
631 | var viewportHeight; | 629 | var viewportHeight; |
632 | var viewportY; | 630 | var viewportY; |
633 | var footerElement; | 631 | var footerElement; |
634 | var footerElementPosition; | 632 | var footerElementPosition; |
635 | var footerElementDimensions; | 633 | var footerElementDimensions; |
636 | var footerComputedHeight; | 634 | var footerComputedHeight; |
637 | 635 | ||
638 | // height = MochiKit.Style.getElementDimensions(this.displayElement())['h']; | 636 | // height = MochiKit.Style.getElementDimensions(this.displayElement())['h']; |
639 | y = MochiKit.Style.getElementPosition(this.displayElement())['y']; | 637 | y = MochiKit.Style.getElementPosition(this.displayElement())['y']; |
640 | 638 | ||
641 | footerElement = MochiKit.Selector.findChildElements(this.displayElement(), ['div.footer'])[0]; | 639 | footerElement = MochiKit.Selector.findChildElements(this.displayElement(), ['div.footer'])[0]; |
642 | footerElementPosition = MochiKit.Style.getElementPosition(footerElement); | 640 | footerElementPosition = MochiKit.Style.getElementPosition(footerElement); |
643 | footerElementDimensions = MochiKit.Style.getElementDimensions(footerElement); | 641 | footerElementDimensions = MochiKit.Style.getElementDimensions(footerElement); |
644 | footerComputedHeight = footerElementPosition['y'] + footerElementDimensions['h'] - y; | 642 | footerComputedHeight = footerElementPosition['y'] + footerElementDimensions['h'] - y; |
645 | 643 | ||
646 | // scrollHeight = this.displayElement().scrollHeight; | 644 | // scrollHeight = this.displayElement().scrollHeight; |
647 | scrollHeight = footerComputedHeight; | 645 | scrollHeight = footerComputedHeight; |
648 | 646 | ||
649 | viewportHeight = MochiKit.Style.getViewportDimensions()['h']; | 647 | viewportHeight = MochiKit.Style.getViewportDimensions()['h']; |
650 | viewportY = MochiKit.Style.getViewportPosition()['y']; | 648 | viewportY = MochiKit.Style.getViewportPosition()['y']; |
651 | 649 | ||
652 | if ((y + scrollHeight) > (viewportY + viewportHeight)) { | 650 | if ((y + scrollHeight) > (viewportY + viewportHeight)) { |
653 | this.setDisplayMode('scrollable'); | 651 | this.setDisplayMode('scrollable'); |
654 | MochiKit.DOM.addElementClass(this.element(), 'scrollable'); | 652 | MochiKit.DOM.addElementClass(this.element(), 'scrollable'); |
655 | MochiKit.DOM.removeElementClass(this.element(), 'fixed'); | 653 | MochiKit.DOM.removeElementClass(this.element(), 'fixed'); |
656 | MochiKit.Style.setElementPosition(this.displayElement(), {y:Math.max(0, Math.min(y, (viewportY + viewportHeight) - scrollHeight))}, 'px'); | 654 | MochiKit.Style.setElementPosition(this.displayElement(), {y:Math.max(0, Math.min(y, (viewportY + viewportHeight) - scrollHeight))}, 'px'); |
657 | MochiKit.Visual.ScrollTo(this.displayElement(), {duration:0.5}); | 655 | MochiKit.Visual.ScrollTo(this.displayElement(), {duration:0.5}); |
658 | } else { | 656 | } else { |
659 | this.setDisplayMode('fixed'); | 657 | this.setDisplayMode('fixed'); |
660 | MochiKit.DOM.removeElementClass(this.element(), 'scrollable'); | 658 | MochiKit.DOM.removeElementClass(this.element(), 'scrollable'); |
661 | MochiKit.DOM.addElementClass(this.element(), 'fixed'); | 659 | MochiKit.DOM.addElementClass(this.element(), 'fixed'); |
662 | } | 660 | } |
663 | }, | 661 | }, |
664 | 662 | ||
665 | //========================================================================= | 663 | //========================================================================= |
666 | 664 | ||
667 | 'unselectCurrentSelectedItems': function () { | 665 | 'unselectCurrentSelectedItems': function () { |
668 | MochiKit.Iter.forEach(MochiKit.Selector.findChildElements(this.displayElement(), ['.selectedField']), function (anElement) { | 666 | MochiKit.Iter.forEach(MochiKit.Selector.findChildElements(this.displayElement(), ['.selectedField']), function (anElement) { |
669 | MochiKit.DOM.removeElementClass(anElement, 'selectedField'); | 667 | MochiKit.DOM.removeElementClass(anElement, 'selectedField'); |
670 | }); | 668 | }); |
671 | }, | 669 | }, |
672 | 670 | ||
673 | //========================================================================= | 671 | //========================================================================= |
674 | 672 | ||
675 | 'hideProgressMask': function () { | 673 | 'hideProgressMask': function () { |
676 | MochiKit.DOM.removeElementClass(this.getId('panel'), 'loading'); | 674 | MochiKit.DOM.removeElementClass(this.getId('panel'), 'loading'); |
677 | }, | 675 | }, |
678 | 676 | ||
679 | 'showProgressMask': function () { | 677 | 'showProgressMask': function () { |
680 | this.getElement('progressDescription').innerHTML = "Saving"; | 678 | this.getElement('progressDescription').innerHTML = "Saving"; |
681 | MochiKit.DOM.addElementClass(this.getId('panel'), 'loading'); | 679 | MochiKit.DOM.addElementClass(this.getId('panel'), 'loading'); |
682 | }, | 680 | }, |
683 | 681 | ||
684 | 'showError': function (anError) { | 682 | 'showError': function (anError) { |
685 | //console.log(">>> showError", anError); | ||
686 | MochiKit.Style.hideElement(this.getId('progress')); | 683 | MochiKit.Style.hideElement(this.getId('progress')); |
687 | this.getElement('errorMessage').innerHTML = Clipperz.PM.Strings.errorDescriptionForException(anError['message']); | 684 | this.getElement('errorMessage').innerHTML = Clipperz.PM.Strings.errorDescriptionForException(anError['message']); |
688 | MochiKit.Style.showElement(this.getId('error')); | 685 | MochiKit.Style.showElement(this.getId('error')); |
689 | }, | 686 | }, |
690 | 687 | ||
691 | //------------------------------------------------------------------------- | 688 | //------------------------------------------------------------------------- |
692 | 689 | ||
693 | 'cancel': function () { | 690 | 'cancel': function () { |
694 | /* | 691 | /* |
695 | var deferredResult; | 692 | var deferredResult; |
696 | 693 | ||
697 | deferredResult = new Clipperz.Async.Deferred("CardDialogComponent.cancel", {trace:false}); | 694 | deferredResult = new Clipperz.Async.Deferred("CardDialogComponent.cancel", {trace:false}); |
698 | deferredResult.addCallback(MochiKit.Base.method(this, 'isSavingEnabled')); | 695 | deferredResult.addCallback(MochiKit.Base.method(this, 'isSavingEnabled')); |
699 | deferredResult.addIf([ | 696 | deferredResult.addIf([ |
700 | MochiKit.Base.method(this, 'askConfirmationForLoosingPendingChanges') | 697 | MochiKit.Base.method(this, 'askConfirmationForLoosingPendingChanges') |
701 | ], []); | 698 | ], []); |
702 | deferredResult.addCallback(MochiKit.Base.partial(MochiKit.Signal.signal, this, 'cancel')); | 699 | deferredResult.addCallback(MochiKit.Base.partial(MochiKit.Signal.signal, this, 'cancel')); |
703 | deferredResult.callback(); | 700 | deferredResult.callback(); |
704 | 701 | ||
705 | return deferredResult; | 702 | return deferredResult; |
706 | */ | 703 | */ |
707 | MochiKit.Signal.signal(this, 'cancel'); | 704 | MochiKit.Signal.signal(this, 'cancel'); |
708 | }, | 705 | }, |
709 | 706 | ||
710 | 'handleCancelEvent': function (anEvent) { | 707 | 'handleCancelEvent': function (anEvent) { |
711 | anEvent.preventDefault(); | 708 | anEvent.preventDefault(); |
712 | this.cancel(); | 709 | this.cancel(); |
713 | }, | 710 | }, |
714 | 711 | ||
715 | //------------------------------------------------------------------------- | 712 | //------------------------------------------------------------------------- |
716 | 713 | ||
717 | 'handleSaveEvent': function (anEvent) { | 714 | 'handleSaveEvent': function (anEvent) { |
718 | anEvent.preventDefault(); | 715 | anEvent.preventDefault(); |
719 | 716 | ||
720 | if (! MochiKit.DOM.hasElementClass(anEvent.src(), 'disabled')) { | 717 | if (! MochiKit.DOM.hasElementClass(anEvent.src(), 'disabled')) { |
721 | MochiKit.Signal.signal(this, 'save'); | 718 | MochiKit.Signal.signal(this, 'save'); |
722 | } | 719 | } |
723 | }, | 720 | }, |
724 | 721 | ||
725 | //------------------------------------------------------------------------- | 722 | //------------------------------------------------------------------------- |
726 | 723 | ||
727 | 'handleAddDirectLogin': function (anEvent) { | 724 | 'handleAddDirectLogin': function (anEvent) { |
728 | anEvent.preventDefault(); | 725 | anEvent.preventDefault(); |
729 | 726 | ||
730 | MochiKit.Signal.signal(this, 'addDirectLogin'); | 727 | MochiKit.Signal.signal(this, 'addDirectLogin'); |
731 | }, | 728 | }, |
732 | 729 | ||
733 | //------------------------------------------------------------------------- | 730 | //------------------------------------------------------------------------- |
734 | 731 | ||
735 | 'handleOnFocusEvent': function (anElement, anEvent) { | 732 | 'handleOnFocusEvent': function (anElement, anEvent) { |
736 | this.unselectCurrentSelectedItems(); | 733 | this.unselectCurrentSelectedItems(); |
737 | MochiKit.DOM.addElementClass(anElement, 'selectedField'); | 734 | MochiKit.DOM.addElementClass(anElement, 'selectedField'); |
738 | }, | 735 | }, |
739 | 736 | ||
740 | 'handleLooseFocusEvent': function (anElement, anEvent) { | 737 | 'handleLooseFocusEvent': function (anElement, anEvent) { |
741 | this.unselectCurrentSelectedItems(); | 738 | this.unselectCurrentSelectedItems(); |
742 | }, | 739 | }, |
743 | 740 | ||
744 | //------------------------------------------------------------------------- | 741 | //------------------------------------------------------------------------- |
745 | 742 | ||
746 | 'handleTabSelected': function (aSelectedTab) { | 743 | 'handleTabSelected': function (aSelectedTab) { |
747 | this.unselectCurrentSelectedItems(); | 744 | this.unselectCurrentSelectedItems(); |
748 | 745 | ||
749 | switch (aSelectedTab) { | 746 | switch (aSelectedTab) { |
750 | case 'DETAILS': | 747 | case 'DETAILS': |
751 | // MochiKit.Style.hideElement(this.getElement('addDirectLoginButton')); | 748 | // MochiKit.Style.hideElement(this.getElement('addDirectLoginButton')); |
752 | break; | 749 | break; |
753 | case 'DIRECT_LOGINS': | 750 | case 'DIRECT_LOGINS': |
754 | // MochiKit.Style.showElement(this.getElement('addDirectLoginButton')); | 751 | // MochiKit.Style.showElement(this.getElement('addDirectLoginButton')); |
755 | break; | 752 | break; |
756 | case 'SHARING': | 753 | case 'SHARING': |
757 | // MochiKit.Style.hideElement(this.getElement('addDirectLoginButton')); | 754 | // MochiKit.Style.hideElement(this.getElement('addDirectLoginButton')); |
758 | break; | 755 | break; |
759 | } | 756 | } |
760 | }, | 757 | }, |
761 | 758 | ||
762 | //------------------------------------------------------------------------- | 759 | //------------------------------------------------------------------------- |
763 | 760 | ||
764 | 'handleKeyEvent': function (anEvent) { | 761 | 'handleKeyEvent': function (anEvent) { |
765 | //console.log("####", anEvent.key().string); | ||
766 | if (anEvent.key().string == 'KEY_ESCAPE') { | 762 | if (anEvent.key().string == 'KEY_ESCAPE') { |
767 | MochiKit.Signal.signal(this, 'changedValue'); | 763 | MochiKit.Signal.signal(this, 'changedValue'); |
768 | this.cancel(); | 764 | this.cancel(); |
769 | } else if (anEvent.key().string == 'KEY_ENTER') { | 765 | } else if (anEvent.key().string == 'KEY_ENTER') { |
770 | if (anEvent.target().nodeName == 'TEXTAREA') { | 766 | if (anEvent.target().nodeName == 'TEXTAREA') { |
771 | 767 | ||
772 | } else { | 768 | } else { |
773 | anEvent.preventDefault(); | 769 | anEvent.preventDefault(); |
774 | } | 770 | } |
775 | } | 771 | } |
776 | }, | 772 | }, |
777 | 773 | ||
778 | //========================================================================= | 774 | //========================================================================= |
779 | 775 | ||
780 | 'askConfirmationForLoosingPendingChanges': function () { | 776 | 'askConfirmationForLoosingPendingChanges': function () { |
781 | var deferredResult; | 777 | var deferredResult; |
782 | var confirmationDialog; | 778 | var confirmationDialog; |
783 | 779 | ||
784 | confirmationDialog = new Clipperz.PM.UI.Common.Components.SimpleMessagePanel({ | 780 | confirmationDialog = new Clipperz.PM.UI.Common.Components.SimpleMessagePanel({ |
785 | title:"Alert", | 781 | title:"Alert", |
786 | text:"Should lost pending changes?", | 782 | text:"Should lost pending changes?", |
787 | type:'ALERT', | 783 | type:'ALERT', |
788 | buttons: [ | 784 | buttons: [ |
789 | {text:"Cancel",result:'CANCEL', isDefault:true}, | 785 | {text:"Cancel",result:'CANCEL', isDefault:true}, |
790 | {text:"Ok", result:'OK'} | 786 | {text:"Ok", result:'OK'} |
791 | ] | 787 | ] |
792 | }); | 788 | }); |
793 | 789 | ||
794 | deferredResult = new Clipperz.Async.Deferred("CardDialogComponent.askConfirmationForLoosingPendingChanges", {trace:false}); | 790 | deferredResult = new Clipperz.Async.Deferred("CardDialogComponent.askConfirmationForLoosingPendingChanges", {trace:false}); |
795 | // deferredResult = confirmationDialog.deferredShow({openFromElement:anEvent.src(), onOkCloseToElement:MochiKit.DOM.currentDocument().body, onCancelCloseToElement:anEvent.src()}); | 791 | // deferredResult = confirmationDialog.deferredShow({openFromElement:anEvent.src(), onOkCloseToElement:MochiKit.DOM.currentDocument().body, onCancelCloseToElement:anEvent.src()}); |
796 | deferredResult.addMethod(confirmationDialog, 'deferredShow', { | 792 | deferredResult.addMethod(confirmationDialog, 'deferredShow', { |
797 | 'openFromElement': this.getElement('cancelButton'), | 793 | 'openFromElement': this.getElement('cancelButton'), |
798 | 'onOkCloseToElement': null, //this.getElement('cancelButton'), | 794 | 'onOkCloseToElement': null, //this.getElement('cancelButton'), |
799 | 'onCancelCloseToElement':this.getElement('cancelButton') | 795 | 'onCancelCloseToElement':this.getElement('cancelButton') |
800 | }); | 796 | }); |
801 | // deferredResult.addCallback(function () { console.log("DELETE: " + anObject.toString(), anObject); }); | ||
802 | // deferredResult.addErrbackPass(function () { console.log("skip deletion: " + anObject.toString(), anObject); }); | ||
803 | deferredResult.callback(); | 797 | deferredResult.callback(); |
804 | 798 | ||
805 | return deferredResult; | 799 | return deferredResult; |
806 | }, | 800 | }, |
807 | 801 | ||
808 | //========================================================================= | 802 | //========================================================================= |
809 | 803 | ||
810 | 'showDirectLoginEditingComponent': function () { | 804 | 'showDirectLoginEditingComponent': function () { |
811 | varwidth; | 805 | varwidth; |
812 | var transition; | 806 | var transition; |
813 | var duration; | 807 | var duration; |
814 | 808 | ||
815 | width = MochiKit.Style.getElementDimensions(this.getElement('directLoginsComponentContainer'))['w']; | 809 | width = MochiKit.Style.getElementDimensions(this.getElement('directLoginsComponentContainer'))['w']; |
816 | transition = MochiKit.Visual.Transitions.sinoidal; | 810 | transition = MochiKit.Visual.Transitions.sinoidal; |
817 | duration = 1; | 811 | duration = 1; |
818 | 812 | ||
819 | return Clipperz.Async.callbacks("CardDialogComponent.showDirectLoginEditingComponent", [ | 813 | return Clipperz.Async.callbacks("CardDialogComponent.showDirectLoginEditingComponent", [ |
820 | MochiKit.Base.method(this, 'disableCardTitleEditing'), | 814 | MochiKit.Base.method(this, 'disableCardTitleEditing'), |
821 | MochiKit.Base.method(this.tabPanelController(), 'disable'), | 815 | MochiKit.Base.method(this.tabPanelController(), 'disable'), |
822 | 816 | ||
823 | MochiKit.Base.bind(function () { | 817 | MochiKit.Base.bind(function () { |
824 | MochiKit.Style.setElementPosition (this.getElement('directLoginEditDetail'), {x:width, y:-MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}); | 818 | MochiKit.Style.setElementPosition (this.getElement('directLoginEditDetail'), {x:width, y:-MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}); |
825 | MochiKit.Style.setElementDimensions(this.getElement('directLoginEditDetail'), {w:width}); | 819 | MochiKit.Style.setElementDimensions(this.getElement('directLoginEditDetail'), {w:width}); |
826 | MochiKit.Style.showElement(this.getElement('directLoginEditDetail')); | 820 | MochiKit.Style.showElement(this.getElement('directLoginEditDetail')); |
827 | MochiKit.Style.setOpacity(this.getElement('directLoginEditDetail'), 0); | 821 | MochiKit.Style.setOpacity(this.getElement('directLoginEditDetail'), 0); |
828 | MochiKit.Style.setElementDimensions(this.getElement('directLoginsComponentContainer'), { | 822 | MochiKit.Style.setElementDimensions(this.getElement('directLoginsComponentContainer'), { |
829 | h:Math.max( | 823 | h:Math.max( |
830 | MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h'], | 824 | MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h'], |
831 | MochiKit.Style.getElementDimensions(this.getElement('directLoginEditDetail'))['h'] | 825 | MochiKit.Style.getElementDimensions(this.getElement('directLoginEditDetail'))['h'] |
832 | ) | 826 | ) |
833 | }); | 827 | }); |
834 | // MochiKit.Style.setElementDimensions(this.getElement('directLoginsComponentContainer'), {h:MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}); | 828 | // MochiKit.Style.setElementDimensions(this.getElement('directLoginsComponentContainer'), {h:MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}); |
835 | }, this), | 829 | }, this), |
836 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimations,MochiKit.Visual.Parallel, [ | 830 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimations,MochiKit.Visual.Parallel, [ |
837 | new MochiKit.Visual.Move(this.getElement('directLogins'), {x:-width, y:0, mode:'relative', transition:transition, sync:true}), | 831 | new MochiKit.Visual.Move(this.getElement('directLogins'), {x:-width, y:0, mode:'relative', transition:transition, sync:true}), |
838 | new MochiKit.Visual.Opacity(this.getElement('directLogins'), {from:1.0, to:0.0, transition:transition, sync:true}), | 832 | new MochiKit.Visual.Opacity(this.getElement('directLogins'), {from:1.0, to:0.0, transition:transition, sync:true}), |
839 | new MochiKit.Visual.Move(this.getElement('directLoginEditDetail'), {x:-width, y:0, mode:'relative', transition:transition, sync:true}), | 833 | new MochiKit.Visual.Move(this.getElement('directLoginEditDetail'), {x:-width, y:0, mode:'relative', transition:transition, sync:true}), |
840 | new MochiKit.Visual.Opacity(this.getElement('directLoginEditDetail'),{from:0.0, to:1.0, transition:transition, sync:true}) | 834 | new MochiKit.Visual.Opacity(this.getElement('directLoginEditDetail'),{from:0.0, to:1.0, transition:transition, sync:true}) |
841 | ], {duration:duration}), | 835 | ], {duration:duration}), |
842 | 836 | ||
843 | MochiKit.Base.noop | 837 | MochiKit.Base.noop |
844 | ], {trace:false}); | 838 | ], {trace:false}); |
845 | }, | 839 | }, |
846 | 840 | ||
847 | //------------------------------------------------------------------------- | 841 | //------------------------------------------------------------------------- |
848 | 842 | ||
849 | 'hideDirectLoginEditingComponent': function () { | 843 | 'hideDirectLoginEditingComponent': function () { |
850 | varwidth; | 844 | varwidth; |
851 | var transition; | 845 | var transition; |
852 | var duration; | 846 | var duration; |
853 | 847 | ||
854 | width = MochiKit.Style.getElementDimensions(this.getElement('directLoginsComponentContainer'))['w']; | 848 | width = MochiKit.Style.getElementDimensions(this.getElement('directLoginsComponentContainer'))['w']; |
855 | transition = MochiKit.Visual.Transitions.sinoidal; | 849 | transition = MochiKit.Visual.Transitions.sinoidal; |
856 | duration = 1; | 850 | duration = 1; |
857 | 851 | ||
858 | return Clipperz.Async.callbacks("CardDialogComponent.hideDirectLoginEditingComponent", [ | 852 | return Clipperz.Async.callbacks("CardDialogComponent.hideDirectLoginEditingComponent", [ |
859 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimations,MochiKit.Visual.Parallel, [ | 853 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimations,MochiKit.Visual.Parallel, [ |
860 | new MochiKit.Visual.Move(this.getElement('directLogins'), {x:width, y:0, mode:'relative', transition:transition, sync:true}), | 854 | new MochiKit.Visual.Move(this.getElement('directLogins'), {x:width, y:0, mode:'relative', transition:transition, sync:true}), |
861 | new MochiKit.Visual.Opacity(this.getElement('directLogins'), {from:0.0, to:1.0, transition:transition, sync:true}), | 855 | new MochiKit.Visual.Opacity(this.getElement('directLogins'), {from:0.0, to:1.0, transition:transition, sync:true}), |
862 | new MochiKit.Visual.Move(this.getElement('directLoginEditDetail'), {x:width, y:0, mode:'relative', transition:transition, sync:true}), | 856 | new MochiKit.Visual.Move(this.getElement('directLoginEditDetail'), {x:width, y:0, mode:'relative', transition:transition, sync:true}), |
863 | new MochiKit.Visual.Opacity(this.getElement('directLoginEditDetail'),{from:1.0, to:0.0, transition:transition, sync:true}) | 857 | new MochiKit.Visual.Opacity(this.getElement('directLoginEditDetail'),{from:1.0, to:0.0, transition:transition, sync:true}) |
864 | ], {duration:duration}), | 858 | ], {duration:duration}), |
865 | // MochiKit.Base.partial(MochiKit.Visual.appear, this.getElement('addDirectLoginButton'), {duration:0.3}), | 859 | // MochiKit.Base.partial(MochiKit.Visual.appear, this.getElement('addDirectLoginButton'), {duration:0.3}), |
866 | Clipperz.Async.clearResult, | 860 | Clipperz.Async.clearResult, |
867 | MochiKit.Base.partial(MochiKit.Style.hideElement, this.getElement('directLoginEditDetail')), | 861 | MochiKit.Base.partial(MochiKit.Style.hideElement, this.getElement('directLoginEditDetail')), |
868 | // MochiKit.Base.partial(MochiKit.Style.showElement, this.getElement('directLogins')), | 862 | // MochiKit.Base.partial(MochiKit.Style.showElement, this.getElement('directLogins')), |
869 | MochiKit.Base.partial(MochiKit.Style.setElementDimensions, this.getElement('directLoginsComponentContainer'), {h:MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}), | 863 | MochiKit.Base.partial(MochiKit.Style.setElementDimensions, this.getElement('directLoginsComponentContainer'), {h:MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}), |
870 | 864 | ||
871 | MochiKit.Base.method(this, 'enableCardTitleEditing'), | 865 | MochiKit.Base.method(this, 'enableCardTitleEditing'), |
872 | MochiKit.Base.method(this.tabPanelController(), 'enable') | 866 | MochiKit.Base.method(this.tabPanelController(), 'enable') |
873 | ], {trace:false}); | 867 | ], {trace:false}); |
874 | }, | 868 | }, |
875 | 869 | ||
876 | //========================================================================= | 870 | //========================================================================= |
877 | __syntaxFix__: "syntax fix" | 871 | __syntaxFix__: "syntax fix" |
878 | }); | 872 | }); |