Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/OTP/MainComponent.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Components/OTP/MainComponent.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/OTP/MainComponent.js b/frontend/beta/js/Clipperz/PM/Components/OTP/MainComponent.js index 9d191f6..7b0b12b 100644 --- a/frontend/beta/js/Clipperz/PM/Components/OTP/MainComponent.js +++ b/frontend/beta/js/Clipperz/PM/Components/OTP/MainComponent.js | |||
@@ -1,120 +1,117 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
30 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
31 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | 28 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } |
32 | if (typeof(Clipperz.PM.Components.OTP) == 'undefined') { Clipperz.PM.Components.OTP = {}; } | 29 | if (typeof(Clipperz.PM.Components.OTP) == 'undefined') { Clipperz.PM.Components.OTP = {}; } |
33 | 30 | ||
34 | //############################################################################# | 31 | //############################################################################# |
35 | 32 | ||
36 | Clipperz.PM.Components.OTP.MainComponent = function(anElement, args) { | 33 | Clipperz.PM.Components.OTP.MainComponent = function(anElement, args) { |
37 | args = args || {}; | 34 | args = args || {}; |
38 | 35 | ||
39 | //MochiKit.Logging.logDebug("new OTP.MainComponent"); | 36 | //MochiKit.Logging.logDebug("new OTP.MainComponent"); |
40 | Clipperz.PM.Components.OTP.MainComponent.superclass.constructor.call(this, anElement, args); | 37 | Clipperz.PM.Components.OTP.MainComponent.superclass.constructor.call(this, anElement, args); |
41 | 38 | ||
42 | this._user = args.user; | 39 | this._user = args.user; |
43 | this._shouldRender = true; | 40 | this._shouldRender = true; |
44 | 41 | ||
45 | this._deleteButton = null; | 42 | this._deleteButton = null; |
46 | this._printButton = null; | 43 | this._printButton = null; |
47 | 44 | ||
48 | Clipperz.NotificationCenter.register(null, 'tabSelected', this, 'tabSelectedHandler'); | 45 | Clipperz.NotificationCenter.register(null, 'tabSelected', this, 'tabSelectedHandler'); |
49 | //Clipperz.NotificationCenter.register(null, 'oneTimePasswordAdded', this, 'render'); | 46 | //Clipperz.NotificationCenter.register(null, 'oneTimePasswordAdded', this, 'render'); |
50 | 47 | ||
51 | return this; | 48 | return this; |
52 | } | 49 | } |
53 | 50 | ||
54 | //============================================================================= | 51 | //============================================================================= |
55 | 52 | ||
56 | YAHOO.extendX(Clipperz.PM.Components.OTP.MainComponent, Clipperz.PM.Components.BaseComponent, { | 53 | YAHOO.extendX(Clipperz.PM.Components.OTP.MainComponent, Clipperz.PM.Components.BaseComponent, { |
57 | 54 | ||
58 | 'toString': function() { | 55 | 'toString': function() { |
59 | return "Clipperz.PM.Components.OTP.MainComponent component"; | 56 | return "Clipperz.PM.Components.OTP.MainComponent component"; |
60 | }, | 57 | }, |
61 | 58 | ||
62 | //------------------------------------------------------------------------- | 59 | //------------------------------------------------------------------------- |
63 | 60 | ||
64 | 'render': function() { | 61 | 'render': function() { |
65 | //MochiKit.Logging.logDebug("### OTP.MainComponent.render"); | 62 | //MochiKit.Logging.logDebug("### OTP.MainComponent.render"); |
66 | Clipperz.NotificationCenter.unregister(this); | 63 | Clipperz.NotificationCenter.unregister(this); |
67 | MochiKit.Signal.disconnectAllTo(this); | 64 | MochiKit.Signal.disconnectAllTo(this); |
68 | 65 | ||
69 | if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) { | 66 | if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) { |
70 | this.element().update(""); | 67 | this.element().update(""); |
71 | this.domHelper().append(this.element(), {tag:'div', cls:'oneTimePasswordReadOnlyMessage', htmlString:Clipperz.PM.Strings['oneTimePasswordReadOnlyMessage']}); | 68 | this.domHelper().append(this.element(), {tag:'div', cls:'oneTimePasswordReadOnlyMessage', htmlString:Clipperz.PM.Strings['oneTimePasswordReadOnlyMessage']}); |
72 | } else { | 69 | } else { |
73 | var deferredResult; | 70 | var deferredResult; |
74 | 71 | ||
75 | deferredResult = new MochiKit.Async.Deferred(); | 72 | deferredResult = new MochiKit.Async.Deferred(); |
76 | 73 | ||
77 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OTP.MainComponent.render - 1: " + res); return res;}); | 74 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OTP.MainComponent.render - 1: " + res); return res;}); |
78 | deferredResult.addCallback(MochiKit.Base.bind(function() { | 75 | deferredResult.addCallback(MochiKit.Base.bind(function() { |
79 | this.element().update(""); | 76 | this.element().update(""); |
80 | Clipperz.YUI.DomHelper.append(this.element(), {tag:'div', htmlString:Clipperz.PM.Strings['oneTimePasswordLoadingMessage']}); | 77 | Clipperz.YUI.DomHelper.append(this.element(), {tag:'div', htmlString:Clipperz.PM.Strings['oneTimePasswordLoadingMessage']}); |
81 | }, this)); | 78 | }, this)); |
82 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OTP.MainComponent.render - 2: " + res); return res;}); | 79 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OTP.MainComponent.render - 2: " + res); return res;}); |
83 | deferredResult.addCallback(MochiKit.Base.method(this.user(), 'loadOneTimePasswords')); | 80 | deferredResult.addCallback(MochiKit.Base.method(this.user(), 'loadOneTimePasswords')); |
84 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OTP.MainComponent.render - 3: " + res); return res;}); | 81 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OTP.MainComponent.render - 3: " + res); return res;}); |
85 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OTP.MainComponent.render - 3.1: " + Clipperz.Base.serializeJSON(res.serializedData())); return res;}); | 82 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OTP.MainComponent.render - 3.1: " + Clipperz.Base.serializeJSON(res.serializedData())); return res;}); |
86 | deferredResult.addCallback(MochiKit.Base.bind(function(aResult) { | 83 | deferredResult.addCallback(MochiKit.Base.bind(function(aResult) { |
87 | vartbodyElement; | 84 | vartbodyElement; |
88 | varoneTimePasswordReferenceKeys; | 85 | varoneTimePasswordReferenceKeys; |
89 | var imageExtension; | 86 | var imageExtension; |
90 | var isThereAnyActiveOneTimePassword; | 87 | var isThereAnyActiveOneTimePassword; |
91 | 88 | ||
92 | isThereAnyActiveOneTimePassword = false; | 89 | isThereAnyActiveOneTimePassword = false; |
93 | 90 | ||
94 | this.element().update(""); | 91 | this.element().update(""); |
95 | Clipperz.YUI.DomHelper.append(this.element(), {tag:'div', id:'oneTimePasswordList', children:[ | 92 | Clipperz.YUI.DomHelper.append(this.element(), {tag:'div', id:'oneTimePasswordList', children:[ |
96 | {tag:'div', id:'oneTimePasswords_header', children:[ | 93 | {tag:'div', id:'oneTimePasswords_header', children:[ |
97 | {tag:'table', width:'100%', children:[ | 94 | {tag:'table', width:'100%', children:[ |
98 | {tag:'tbody', children:[ | 95 | {tag:'tbody', children:[ |
99 | {tag:'tr', children:[ | 96 | {tag:'tr', children:[ |
100 | {tag:'td', width:'10%', children:[ | 97 | {tag:'td', width:'10%', children:[ |
101 | {tag:'div', id:this.getId('createNewOneTimePasswordButton')} | 98 | {tag:'div', id:this.getId('createNewOneTimePasswordButton')} |
102 | ]}, | 99 | ]}, |
103 | {tag:'td', width:'40%', children:[ | 100 | {tag:'td', width:'40%', children:[ |
104 | {tag:'div', id:this.getId('deleteSelectedOneTimePasswordButton')} | 101 | {tag:'div', id:this.getId('deleteSelectedOneTimePasswordButton')} |
105 | ]}, | 102 | ]}, |
106 | {tag:'td', width:'50%', align:'right', children:[ | 103 | {tag:'td', width:'50%', align:'right', children:[ |
107 | {tag:'div', id:this.getId('printOneTimePasswordButton')} | 104 | {tag:'div', id:this.getId('printOneTimePasswordButton')} |
108 | ]} | 105 | ]} |
109 | ]} | 106 | ]} |
110 | ]} | 107 | ]} |
111 | ]}, | 108 | ]}, |
112 | {tag:'div', children:[ | 109 | {tag:'div', children:[ |
113 | {tag:'ul', children:[ | 110 | {tag:'ul', children:[ |
114 | {tag:'li', children:[ | 111 | {tag:'li', children:[ |
115 | {tag:'span', htmlString:Clipperz.PM.Strings['oneTimePasswordSelectionLink_selectLabel']} | 112 | {tag:'span', htmlString:Clipperz.PM.Strings['oneTimePasswordSelectionLink_selectLabel']} |
116 | ]}, | 113 | ]}, |
117 | {tag:'li', children:[ | 114 | {tag:'li', children:[ |
118 | {tag:'a', href:'#', id:this.getId('selectAllOneTimePasswords_link'), htmlString:Clipperz.PM.Strings['oneTimePasswordSelectionLink_all']} | 115 | {tag:'a', href:'#', id:this.getId('selectAllOneTimePasswords_link'), htmlString:Clipperz.PM.Strings['oneTimePasswordSelectionLink_all']} |
119 | ]}, | 116 | ]}, |
120 | {tag:'li', children:[ | 117 | {tag:'li', children:[ |