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,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 | 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'); |
@@ -493,386 +491,382 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogComponent, Clipperz | |||
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 | }); |