summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz/PM/Components/Compact/CompactInterface.js
Unidiff
Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/Compact/CompactInterface.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Compact/CompactInterface.js22
1 files changed, 10 insertions, 12 deletions
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,150 +1,148 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
28if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } 26if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
29if (typeof(Clipperz.PM.Components.Compact) == 'undefined') { Clipperz.PM.Components.Compact = {}; } 27if (typeof(Clipperz.PM.Components.Compact) == 'undefined') { Clipperz.PM.Components.Compact = {}; }
30 28
31Clipperz.PM.Components.Compact.CompactInterface = function(anElement, args) { 29Clipperz.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
47YAHOO.extendX(Clipperz.PM.Components.Compact.CompactInterface, Clipperz.PM.Components.BaseComponent, { 45YAHOO.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");
119 YAHOO.ext.Element.get('directLogins').update(""); 117 YAHOO.ext.Element.get('directLogins').update("");
120//MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 2"); 118//MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 2");
121 allDirectLogins = MochiKit.Base.values(this.user().directLoginReferences()); 119 allDirectLogins = MochiKit.Base.values(this.user().directLoginReferences());
122//MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 3"); 120//MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 3");
123 allDirectLogins.sort(this.compareDirectLogins); 121 allDirectLogins.sort(this.compareDirectLogins);
124 122
125//MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 4"); 123//MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 4");
126 template = this.directLoginItemTemplate(); 124 template = this.directLoginItemTemplate();
127//MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 5"); 125//MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 5");
128 MochiKit.Iter.forEach(allDirectLogins, MochiKit.Base.bind(function(aDirectLogin) { 126 MochiKit.Iter.forEach(allDirectLogins, MochiKit.Base.bind(function(aDirectLogin) {
129 vardirectLoginElement; 127 vardirectLoginElement;
130 varfaviconImageElementID; 128 varfaviconImageElementID;
131 129
132 faviconImageElementID = aDirectLogin.reference() + "_faviconIMG"; 130 faviconImageElementID = aDirectLogin.reference() + "_faviconIMG";
133 directLoginElement = template.append('directLogins', { 131 directLoginElement = template.append('directLogins', {
134 elementID:faviconImageElementID, 132 elementID:faviconImageElementID,
135 faviconUrl:aDirectLogin.fixedFavicon(), 133 faviconUrl:aDirectLogin.fixedFavicon(),
136 directLoginTitle:aDirectLogin.label(), 134 directLoginTitle:aDirectLogin.label(),
137 directLoginReference:aDirectLogin.reference() 135 directLoginReference:aDirectLogin.reference()
138 }, true); 136 }, true);
139//MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 6: " + recordElement.dom); 137//MochiKit.Logging.logDebug("--- CompactInterface.redrawDirectLoginItems - 6: " + recordElement.dom);
140 directLoginElement.addClassOnOver("hover"); 138 directLoginElement.addClassOnOver("hover");
141 MochiKit.Signal.connect(directLoginElement.dom, 'onclick', this, 'handleDirectLoginClick'); 139 MochiKit.Signal.connect(directLoginElement.dom, 'onclick', this, 'handleDirectLoginClick');
142 140
143 MochiKit.Signal.connect(faviconImageElementID, 'onload', this, 'handleLoadedFaviconImage'); 141 MochiKit.Signal.connect(faviconImageElementID, 'onload', this, 'handleLoadedFaviconImage');
144 MochiKit.Signal.connect(faviconImageElementID, 'onerror', aDirectLogin, 'handleMissingFaviconImage'); 142 MochiKit.Signal.connect(faviconImageElementID, 'onerror', aDirectLogin, 'handleMissingFaviconImage');
145 MochiKit.Signal.connect(faviconImageElementID, 'onabort', aDirectLogin, 'handleMissingFaviconImage'); 143 MochiKit.Signal.connect(faviconImageElementID, 'onabort', aDirectLogin, 'handleMissingFaviconImage');
146 144
147 // YAHOO.ext.Element.get(faviconImageElementID).dom.src = aDirectLogin.fixedFavicon(); 145 // YAHOO.ext.Element.get(faviconImageElementID).dom.src = aDirectLogin.fixedFavicon();
148 }, this)); 146 }, this));
149 147
150 this.resetAutoLockTimer(); 148 this.resetAutoLockTimer();