Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/Compact') (more/less context) (ignore whitespace changes)
3 files changed, 30 insertions, 36 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/Compact/CompactHeader.js b/frontend/beta/js/Clipperz/PM/Components/Compact/CompactHeader.js index 7a3b3a3..14e42a5 100644 --- a/frontend/beta/js/Clipperz/PM/Components/Compact/CompactHeader.js +++ b/frontend/beta/js/Clipperz/PM/Components/Compact/CompactHeader.js | |||
@@ -1,83 +1,81 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | 26 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } |
29 | if (typeof(Clipperz.PM.Components.Compact) == 'undefined') { Clipperz.PM.Components.Compact = {}; } | 27 | if (typeof(Clipperz.PM.Components.Compact) == 'undefined') { Clipperz.PM.Components.Compact = {}; } |
30 | 28 | ||
31 | Clipperz.PM.Components.Compact.CompactHeader = function(anElement, args) { | 29 | Clipperz.PM.Components.Compact.CompactHeader = function(anElement, args) { |
32 | 30 | ||
33 | Clipperz.PM.Components.Compact.CompactHeader.superclass.constructor.call(this, anElement, args); | 31 | Clipperz.PM.Components.Compact.CompactHeader.superclass.constructor.call(this, anElement, args); |
34 | 32 | ||
35 | this.render(); | 33 | this.render(); |
36 | 34 | ||
37 | return this; | 35 | return this; |
38 | }; | 36 | }; |
39 | 37 | ||
40 | YAHOO.extendX(Clipperz.PM.Components.Compact.CompactHeader, Clipperz.PM.Components.BaseComponent, { | 38 | YAHOO.extendX(Clipperz.PM.Components.Compact.CompactHeader, Clipperz.PM.Components.BaseComponent, { |
41 | 39 | ||
42 | 'toString': function() { | 40 | 'toString': function() { |
43 | return "Clipperz.PM.Components.Compact.CompactHeader"; | 41 | return "Clipperz.PM.Components.Compact.CompactHeader"; |
44 | }, | 42 | }, |
45 | 43 | ||
46 | //----------------------------------------------------- | 44 | //----------------------------------------------------- |
47 | 45 | ||
48 | 'render': function() { | 46 | 'render': function() { |
49 | this.element().update(""); | 47 | this.element().update(""); |
50 | 48 | ||
51 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', children:[ | 49 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', children:[ |
52 | {tag:'img', src:'./images/logo.gif'}, | 50 | {tag:'img', src:'./images/logo.gif'}, |
53 | {tag:'div', id:'lockBlock', children:[ | 51 | {tag:'div', id:'lockBlock', children:[ |
54 | {tag:'input', type:'checkbox', id:'autolock'}, | 52 | {tag:'input', type:'checkbox', id:'autolock'}, |
55 | {tag:'span', html:'auto'}, | 53 | {tag:'span', html:'auto'}, |
56 | {tag:'a', href:'#', htmlString:Clipperz.PM.Strings['lockMenuLabel'], id:'lock'} | 54 | {tag:'a', href:'#', htmlString:Clipperz.PM.Strings['lockMenuLabel'], id:'lock'} |
57 | ]} | 55 | ]} |
58 | ]}); | 56 | ]}); |
59 | 57 | ||
60 | Clipperz.YUI.DomHelper.append(this.element().dom, | 58 | Clipperz.YUI.DomHelper.append(this.element().dom, |
61 | {tag:'div', id:'compactMiscLinks', children:[ | 59 | {tag:'div', id:'compactMiscLinks', children:[ |
62 | {tag:'a', id:'donateHeaderIconLink', target:'_blank', href:Clipperz.PM.Strings['donateHeaderLinkUrl'], children:[ | 60 | {tag:'a', id:'donateHeaderIconLink', target:'_blank', href:Clipperz.PM.Strings['donateHeaderLinkUrl'], children:[ |
63 | {tag:'img', id:'donateHeaderLinkIcon', src:'./images/smiles_small.gif'} | 61 | {tag:'img', id:'donateHeaderLinkIcon', src:'./images/smiles_small.gif'} |
64 | ]}, | 62 | ]}, |
65 | {tag:'ul', children:[ | 63 | {tag:'ul', children:[ |
66 | {tag:'li', children:[{tag:'a', id:'donateHeaderLink', html:'donate', target:'_blank'}]}, | 64 | {tag:'li', children:[{tag:'a', id:'donateHeaderLink', html:'donate', target:'_blank'}]}, |
67 | {tag:'li', children:[{tag:'a', id:'creditsHeaderLink', html:'credits', target:'_blank'}]}, | 65 | {tag:'li', children:[{tag:'a', id:'creditsHeaderLink', html:'credits', target:'_blank'}]}, |
68 | {tag:'li', children:[{tag:'a', id:'feedbackHeaderLink', html:'feedback', target:'_blank'}]}, | 66 | {tag:'li', children:[{tag:'a', id:'feedbackHeaderLink', html:'feedback', target:'_blank'}]}, |
69 | {tag:'li', children:[{tag:'a', id:'helpHeaderLink', html:'help', target:'_blank'}]}, | 67 | {tag:'li', children:[{tag:'a', id:'helpHeaderLink', html:'help', target:'_blank'}]}, |
70 | {tag:'li', children:[{tag:'a', id:'forumHeaderLink', html:'forum', target:'_blank'}]} | 68 | {tag:'li', children:[{tag:'a', id:'forumHeaderLink', html:'forum', target:'_blank'}]} |
71 | ]} | 69 | ]} |
72 | ]} | 70 | ]} |
73 | ); | 71 | ); |
74 | 72 | ||
75 | YAHOO.ext.Element.get('lockBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); | 73 | YAHOO.ext.Element.get('lockBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); |
76 | Clipperz.NotificationCenter.notify(this, 'switchLanguage'); | 74 | Clipperz.NotificationCenter.notify(this, 'switchLanguage'); |
77 | }, | 75 | }, |
78 | 76 | ||
79 | //----------------------------------------------------- | 77 | //----------------------------------------------------- |
80 | __syntaxFix__: '__syntaxFix__' | 78 | __syntaxFix__: '__syntaxFix__' |
81 | }); | 79 | }); |
82 | 80 | ||
83 | 81 | ||
diff --git a/frontend/beta/js/Clipperz/PM/Components/Compact/CompactInterface.js b/frontend/beta/js/Clipperz/PM/Components/Compact/CompactInterface.js index 0f6858a..1312967 100644 --- a/frontend/beta/js/Clipperz/PM/Components/Compact/CompactInterface.js +++ b/frontend/beta/js/Clipperz/PM/Components/Compact/CompactInterface.js | |||
@@ -1,118 +1,116 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | 26 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } |
29 | if (typeof(Clipperz.PM.Components.Compact) == 'undefined') { Clipperz.PM.Components.Compact = {}; } | 27 | if (typeof(Clipperz.PM.Components.Compact) == 'undefined') { Clipperz.PM.Components.Compact = {}; } |
30 | 28 | ||
31 | Clipperz.PM.Components.Compact.CompactInterface = function(anElement, args) { | 29 | Clipperz.PM.Components.Compact.CompactInterface = function(anElement, args) { |
32 | 30 | ||
33 | Clipperz.PM.Components.Compact.CompactInterface.superclass.constructor.call(this, anElement, args); | 31 | Clipperz.PM.Components.Compact.CompactInterface.superclass.constructor.call(this, anElement, args); |
34 | 32 | ||
35 | this._directLoginItemTemplate = null; | 33 | this._directLoginItemTemplate = null; |
36 | this._user = args.user; | 34 | this._user = args.user; |
37 | this._autoLockTimer = null; | 35 | this._autoLockTimer = null; |
38 | 36 | ||
39 | Clipperz.NotificationCenter.register(null, 'updatedProgressState', this, 'userNotificationHandler') | 37 | Clipperz.NotificationCenter.register(null, 'updatedProgressState', this, 'userNotificationHandler') |
40 | Clipperz.NotificationCenter.register(null, 'directLoginAdded', this, 'directLoginAddedHandler'); | 38 | Clipperz.NotificationCenter.register(null, 'directLoginAdded', this, 'directLoginAddedHandler'); |
41 | 39 | ||
42 | this.render(); | 40 | this.render(); |
43 | 41 | ||
44 | return this; | 42 | return this; |
45 | }; | 43 | }; |
46 | 44 | ||
47 | YAHOO.extendX(Clipperz.PM.Components.Compact.CompactInterface, Clipperz.PM.Components.BaseComponent, { | 45 | YAHOO.extendX(Clipperz.PM.Components.Compact.CompactInterface, Clipperz.PM.Components.BaseComponent, { |
48 | 46 | ||
49 | 'toString': function() { | 47 | 'toString': function() { |
50 | return "Clipperz.PM.Components.Compact.CompactInterface"; | 48 | return "Clipperz.PM.Components.Compact.CompactInterface"; |
51 | }, | 49 | }, |
52 | 50 | ||
53 | //----------------------------------------------------- | 51 | //----------------------------------------------------- |
54 | 52 | ||
55 | 'render': function() { | 53 | 'render': function() { |
56 | var result; | 54 | var result; |
57 | varlayout; | 55 | varlayout; |
58 | var registerButton; | 56 | var registerButton; |
59 | 57 | ||
60 | //MochiKit.Logging.logDebug(">>> CompactInterface.render"); | 58 | //MochiKit.Logging.logDebug(">>> CompactInterface.render"); |
61 | this.element().update(""); | 59 | this.element().update(""); |
62 | 60 | ||
63 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', children:[ | 61 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', children:[ |
64 | {tag:'div', id:this.getId('cantentPanel'), children:[ | 62 | {tag:'div', id:this.getId('cantentPanel'), children:[ |
65 | {tag:'h4', id:this.getId('message')}, | 63 | {tag:'h4', id:this.getId('message')}, |
66 | {tag:'ul', id:'directLogins', children:[]} | 64 | {tag:'ul', id:'directLogins', children:[]} |
67 | ]}, | 65 | ]}, |
68 | {tag:'div', id:this.getId('lockPanel'), cls:'lockPanel', children:[ | 66 | {tag:'div', id:this.getId('lockPanel'), cls:'lockPanel', children:[ |
69 | {tag:'div', htmlString:Clipperz.PM.Strings['lockDescription']}, | 67 | {tag:'div', htmlString:Clipperz.PM.Strings['lockDescription']}, |
70 | {tag:'form', id:'lockDialogForm', children:[ | 68 | {tag:'form', id:'lockDialogForm', children:[ |
71 | {tag:'input', type:'password', id:this.getId('lockPassphrase')} | 69 | {tag:'input', type:'password', id:this.getId('lockPassphrase')} |
72 | ]}, | 70 | ]}, |
73 | {tag:'div', id:this.getId('unlock')} | 71 | {tag:'div', id:this.getId('unlock')} |
74 | ]} | 72 | ]} |
75 | ]}); | 73 | ]}); |
76 | 74 | ||
77 | this.getElement('lockPanel').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); | 75 | this.getElement('lockPanel').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); |
78 | 76 | ||
79 | YAHOO.ext.Element.get('lockBlock').show(); | 77 | YAHOO.ext.Element.get('lockBlock').show(); |
80 | MochiKit.Signal.connect(YAHOO.ext.Element.get('lock').dom, 'onclick', this, 'doLockEventHandler'); | 78 | MochiKit.Signal.connect(YAHOO.ext.Element.get('lock').dom, 'onclick', this, 'doLockEventHandler'); |
81 | new YAHOO.ext.Button(this.getId('unlock'), {text:Clipperz.PM.Strings['unlockButtonLabel'], handler:this.doUnlockEventHandler, scope:this, minWidth:0}); | 79 | new YAHOO.ext.Button(this.getId('unlock'), {text:Clipperz.PM.Strings['unlockButtonLabel'], handler:this.doUnlockEventHandler, scope:this, minWidth:0}); |
82 | this.getElement('unlock').swallowEvent('click', true); | 80 | this.getElement('unlock').swallowEvent('click', true); |
83 | new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('lockPassphrase')); | 81 | new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('lockPassphrase')); |
84 | MochiKit.Signal.connect('lockDialogForm', 'onsubmit', this, 'doUnlockEventHandler'); | 82 | MochiKit.Signal.connect('lockDialogForm', 'onsubmit', this, 'doUnlockEventHandler'); |
85 | 83 | ||
86 | this.getElement('cantentPanel').setVisibilityMode(YAHOO.ext.Element.DISPLAY); | 84 | this.getElement('cantentPanel').setVisibilityMode(YAHOO.ext.Element.DISPLAY); |
87 | //MochiKit.Logging.logDebug("<<< CompactInterface.render"); | 85 | //MochiKit.Logging.logDebug("<<< CompactInterface.render"); |
88 | 86 | ||
89 | return result; | 87 | return result; |
90 | }, | 88 | }, |
91 | 89 | ||
92 | //----------------------------------------------------- | 90 | //----------------------------------------------------- |
93 | 91 | ||
94 | 'directLoginAddedHandler': function(anEvent) { | 92 | 'directLoginAddedHandler': function(anEvent) { |
95 | this.redrawDirectLoginItems(); | 93 | this.redrawDirectLoginItems(); |
96 | }, | 94 | }, |
97 | 95 | ||
98 | //----------------------------------------------------- | 96 | //----------------------------------------------------- |
99 | 97 | ||
100 | 'compareDirectLogins': function(a, b) { | 98 | 'compareDirectLogins': function(a, b) { |
101 | return MochiKit.Base.compare(a.label().toLowerCase(), b.label().toLowerCase()); | 99 | return MochiKit.Base.compare(a.label().toLowerCase(), b.label().toLowerCase()); |
102 | }, | 100 | }, |
103 | 101 | ||
104 | //----------------------------------------------------- | 102 | //----------------------------------------------------- |
105 | 103 | ||
106 | 'redrawDirectLoginItems': function() { | 104 | 'redrawDirectLoginItems': function() { |
107 | var template; | 105 | var template; |
108 | var allDirectLogins; | 106 | var allDirectLogins; |
109 | 107 | ||
110 | this.getElement('message').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); | 108 | this.getElement('message').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); |
111 | //MochiKit.Logging.logDebug(">>> CompactInterface.redrawDirectLoginItems"); | 109 | //MochiKit.Logging.logDebug(">>> CompactInterface.redrawDirectLoginItems"); |
112 | //MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 0"); | 110 | //MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 0"); |
113 | MochiKit.Iter.forEach(YAHOO.ext.Element.get('directLogins').getChildrenByTagName('li'), function(aDirectLoginElement) { | 111 | MochiKit.Iter.forEach(YAHOO.ext.Element.get('directLogins').getChildrenByTagName('li'), function(aDirectLoginElement) { |
114 | MochiKit.Signal.disconnectAll(aDirectLoginElement.dom); | 112 | MochiKit.Signal.disconnectAll(aDirectLoginElement.dom); |
115 | //MochiKit.Logging.logDebug("disconnecting IMG " + aDirectLoginElement.getChildrenByTagName('img')[0].dom.src); | 113 | //MochiKit.Logging.logDebug("disconnecting IMG " + aDirectLoginElement.getChildrenByTagName('img')[0].dom.src); |
116 | MochiKit.Signal.disconnectAll(aDirectLoginElement.getChildrenByTagName('img')[0].dom); | 114 | MochiKit.Signal.disconnectAll(aDirectLoginElement.getChildrenByTagName('img')[0].dom); |
117 | }) | 115 | }) |
118 | //MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 1"); | 116 | //MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 1"); |
diff --git a/frontend/beta/js/Clipperz/PM/Components/Compact/LoginForm.js b/frontend/beta/js/Clipperz/PM/Components/Compact/LoginForm.js index a1e60d8..013dd0d 100644 --- a/frontend/beta/js/Clipperz/PM/Components/Compact/LoginForm.js +++ b/frontend/beta/js/Clipperz/PM/Components/Compact/LoginForm.js | |||
@@ -1,118 +1,116 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | 26 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } |
29 | if (typeof(Clipperz.PM.Components.Compact) == 'undefined') { Clipperz.PM.Components.Compact = {}; } | 27 | if (typeof(Clipperz.PM.Components.Compact) == 'undefined') { Clipperz.PM.Components.Compact = {}; } |
30 | 28 | ||
31 | Clipperz.PM.Components.Compact.LoginForm = function(anElement, args) { | 29 | Clipperz.PM.Components.Compact.LoginForm = function(anElement, args) { |
32 | 30 | ||
33 | Clipperz.PM.Components.Compact.LoginForm.superclass.constructor.call(this, anElement, args); | 31 | Clipperz.PM.Components.Compact.LoginForm.superclass.constructor.call(this, anElement, args); |
34 | 32 | ||
35 | this.render(); | 33 | this.render(); |
36 | Clipperz.NotificationCenter.register(null, 'updatedProgressState', this, 'userNotificationHandler') | 34 | Clipperz.NotificationCenter.register(null, 'updatedProgressState', this, 'userNotificationHandler') |
37 | 35 | ||
38 | return this; | 36 | return this; |
39 | }; | 37 | }; |
40 | 38 | ||
41 | YAHOO.extendX(Clipperz.PM.Components.Compact.LoginForm, Clipperz.PM.Components.BaseComponent, { | 39 | YAHOO.extendX(Clipperz.PM.Components.Compact.LoginForm, Clipperz.PM.Components.BaseComponent, { |
42 | 40 | ||
43 | 'toString': function() { | 41 | 'toString': function() { |
44 | return "Clipperz.PM.Components.Compact.LoginForm"; | 42 | return "Clipperz.PM.Components.Compact.LoginForm"; |
45 | }, | 43 | }, |
46 | 44 | ||
47 | //----------------------------------------------------- | 45 | //----------------------------------------------------- |
48 | 46 | ||
49 | 'render': function() { | 47 | 'render': function() { |
50 | var result; | 48 | var result; |
51 | varlayout; | 49 | varlayout; |
52 | 50 | ||
53 | MochiKit.Signal.disconnectAllTo(this); | 51 | MochiKit.Signal.disconnectAllTo(this); |
54 | this.element().update(""); | 52 | this.element().update(""); |
55 | 53 | ||
56 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', id:this.getId('baseDiv'), cls:'LoginPanel', children:[ | 54 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', id:this.getId('baseDiv'), cls:'LoginPanel', children:[ |
57 | {tag:'div', id:'compactHeader'}, | 55 | {tag:'div', id:'compactHeader'}, |
58 | {tag:'div', id:'compactBody', children:[ | 56 | {tag:'div', id:'compactBody', children:[ |
59 | {tag:'form', id:this.getId('loginForm_form'), children:[ | 57 | {tag:'form', id:this.getId('loginForm_form'), children:[ |
60 | {tag:'dl', children:[ | 58 | {tag:'dl', children:[ |
61 | {tag:'dt', htmlString:Clipperz.PM.Strings['loginFormUsernameLabel']}, | 59 | {tag:'dt', htmlString:Clipperz.PM.Strings['loginFormUsernameLabel']}, |
62 | {tag:'dd', children:[ | 60 | {tag:'dd', children:[ |
63 | {tag:'input', id:this.getId('login_username'), type:'text', size:'30', name:'username'} | 61 | {tag:'input', id:this.getId('login_username'), type:'text', size:'30', name:'username'} |
64 | ]}, | 62 | ]}, |
65 | {tag:'dt', htmlString:Clipperz.PM.Strings['loginFormPassphraseLabel']}, | 63 | {tag:'dt', htmlString:Clipperz.PM.Strings['loginFormPassphraseLabel']}, |
66 | {tag:'dd', children:[ | 64 | {tag:'dd', children:[ |
67 | {tag:'input', id:this.getId('login_passphrase'), type:'password', size:'30', name:'passphrase'} | 65 | {tag:'input', id:this.getId('login_passphrase'), type:'password', size:'30', name:'passphrase'} |
68 | ]} | 66 | ]} |
69 | ]}, | 67 | ]}, |
70 | {tag:'div', id:this.getId('login_submit')} | 68 | {tag:'div', id:this.getId('login_submit')} |
71 | ]}, | 69 | ]}, |
72 | {tag:'h4', id:this.getId('message')} | 70 | {tag:'h4', id:this.getId('message')} |
73 | ]} | 71 | ]} |
74 | ]}); | 72 | ]}); |
75 | 73 | ||
76 | new Clipperz.PM.Components.Compact.CompactHeader(YAHOO.ext.Element.get('compactHeader')); | 74 | new Clipperz.PM.Components.Compact.CompactHeader(YAHOO.ext.Element.get('compactHeader')); |
77 | 75 | ||
78 | MochiKit.Signal.connect(this.getId('loginForm_form'), 'onsubmit', this, 'stopFormSubmit'); | 76 | MochiKit.Signal.connect(this.getId('loginForm_form'), 'onsubmit', this, 'stopFormSubmit'); |
79 | new YAHOO.ext.Button(this.getId('login_submit'), {text:Clipperz.PM.Strings['loginFormButtonLabel'], handler:this.doLogin, scope:this, minWidth:0}); | 77 | new YAHOO.ext.Button(this.getId('login_submit'), {text:Clipperz.PM.Strings['loginFormButtonLabel'], handler:this.doLogin, scope:this, minWidth:0}); |
80 | this.getElement('login_submit').swallowEvent('click', true); | 78 | this.getElement('login_submit').swallowEvent('click', true); |
81 | 79 | ||
82 | MochiKit.Signal.connect(this.getId('loginForm_form'), 'onkeydown', this, 'onkeydown'); | 80 | MochiKit.Signal.connect(this.getId('loginForm_form'), 'onkeydown', this, 'onkeydown'); |
83 | 81 | ||
84 | new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('login_passphrase')); | 82 | new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('login_passphrase')); |
85 | this.getElement('login_username').focus(); | 83 | this.getElement('login_username').focus(); |
86 | 84 | ||
87 | return result; | 85 | return result; |
88 | }, | 86 | }, |
89 | 87 | ||
90 | //----------------------------------------------------- | 88 | //----------------------------------------------------- |
91 | 89 | ||
92 | 'doLogin': function(e) { | 90 | 'doLogin': function(e) { |
93 | //MochiKit.Logging.logDebug(">>> compact.LoginForm.doLogin"); | 91 | //MochiKit.Logging.logDebug(">>> compact.LoginForm.doLogin"); |
94 | if (this.checkLoginForm()) { | 92 | if (this.checkLoginForm()) { |
95 | this.doLoginWithUsernameAndPassphrase(this.getDom('login_username').value, this.getDom('login_passphrase').value); | 93 | this.doLoginWithUsernameAndPassphrase(this.getDom('login_username').value, this.getDom('login_passphrase').value); |
96 | } | 94 | } |
97 | //MochiKit.Logging.logDebug("<<< compact.LoginForm.doLogin"); | 95 | //MochiKit.Logging.logDebug("<<< compact.LoginForm.doLogin"); |
98 | }, | 96 | }, |
99 | 97 | ||
100 | //......................................................................... | 98 | //......................................................................... |
101 | 99 | ||
102 | 'doLoginWithUsernameAndPassphrase': function(anUsername, aPassphrase) { | 100 | 'doLoginWithUsernameAndPassphrase': function(anUsername, aPassphrase) { |
103 | var deferredResult; | 101 | var deferredResult; |
104 | var user; | 102 | var user; |
105 | 103 | ||
106 | //MochiKit.Logging.logDebug(">>> compact.LoginForm.doLoginWithUsernameAndPassphrase"); | 104 | //MochiKit.Logging.logDebug(">>> compact.LoginForm.doLoginWithUsernameAndPassphrase"); |
107 | user = new Clipperz.PM.DataModel.User({username:anUsername, passphrase:aPassphrase}); | 105 | user = new Clipperz.PM.DataModel.User({username:anUsername, passphrase:aPassphrase}); |
108 | 106 | ||
109 | deferredResult = new MochiKit.Async.Deferred(); | 107 | deferredResult = new MochiKit.Async.Deferred(); |
110 | deferredResult.addCallback(MochiKit.Base.method(user, 'connect')); | 108 | deferredResult.addCallback(MochiKit.Base.method(user, 'connect')); |
111 | deferredResult.addCallback(MochiKit.Base.method(user, 'loadPreferences')); | 109 | deferredResult.addCallback(MochiKit.Base.method(user, 'loadPreferences')); |
112 | deferredResult.addCallback(MochiKit.Base.method(user, 'loadRecords')); | 110 | deferredResult.addCallback(MochiKit.Base.method(user, 'loadRecords')); |
113 | deferredResult.addCallback(MochiKit.Base.method(user, 'loadDirectLogins')); | 111 | deferredResult.addCallback(MochiKit.Base.method(user, 'loadDirectLogins')); |
114 | deferredResult.addErrback(MochiKit.Base.bind(function() { | 112 | deferredResult.addErrback(MochiKit.Base.bind(function() { |
115 | this.getElement('loginForm_form').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show(); | 113 | this.getElement('loginForm_form').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show(); |
116 | this.getElement('message').update(Clipperz.PM.Strings['loginMessagePanelFailureText']); | 114 | this.getElement('message').update(Clipperz.PM.Strings['loginMessagePanelFailureText']); |
117 | this.getDom('login_passphrase').value = ""; | 115 | this.getDom('login_passphrase').value = ""; |
118 | this.getElement('login_passphrase').focus(); | 116 | this.getElement('login_passphrase').focus(); |