Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js index d8dc941..b4fc24e 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js | |||
@@ -1,150 +1,148 @@ | |||
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 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager = function(args) { |
31 | args = args || {}; | 29 | args = args || {}; |
32 | Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager.superclass.constructor.call(this, args); | 30 | Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager.superclass.constructor.call(this, args); |
33 | 31 | ||
34 | this._enterLeaveCounter = 0; | 32 | this._enterLeaveCounter = 0; |
35 | this._selectedRowObject = null; | 33 | this._selectedRowObject = null; |
36 | 34 | ||
37 | return this; | 35 | return this; |
38 | } | 36 | } |
39 | 37 | ||
40 | //============================================================================= | 38 | //============================================================================= |
41 | 39 | ||
42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { | 40 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { |
43 | 41 | ||
44 | 'toString': function () { | 42 | 'toString': function () { |
45 | return "Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager component"; | 43 | return "Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager component"; |
46 | }, | 44 | }, |
47 | 45 | ||
48 | //------------------------------------------------------------------------- | 46 | //------------------------------------------------------------------------- |
49 | 47 | ||
50 | 'renderHeader': function(aTRElement) { | 48 | 'renderHeader': function(aTRElement) { |
51 | Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager.superclass.renderHeader.call(this, aTRElement); | 49 | Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager.superclass.renderHeader.call(this, aTRElement); |
52 | 50 | ||
53 | Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body, {tag:'div', cls:'DirectLoginListPopup', id:this.getId('DirectLoginListPopup'), children:[ | 51 | Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body, {tag:'div', cls:'DirectLoginListPopup', id:this.getId('DirectLoginListPopup'), children:[ |
54 | {tag:'div', cls:'DirectLoginListPopup_body', children:[ | 52 | {tag:'div', cls:'DirectLoginListPopup_body', children:[ |
55 | {tag:'ul', id:this.getId('DirectLoginListPopup_list'), children:[ | 53 | {tag:'ul', id:this.getId('DirectLoginListPopup_list'), children:[ |
56 | // {tag:'li', children:[ | 54 | // {tag:'li', children:[ |
57 | // {tag:'img', cls:'favicon', src:'http://www.microsoft.com/favicon.ico'}, | 55 | // {tag:'img', cls:'favicon', src:'http://www.microsoft.com/favicon.ico'}, |
58 | // {tag:'a', href:'#', html:"Google Mail"} | 56 | // {tag:'a', href:'#', html:"Google Mail"} |
59 | // ]}, | 57 | // ]}, |
60 | // ... | 58 | // ... |
61 | ]} | 59 | ]} |
62 | ]}, | 60 | ]}, |
63 | {tag:'div', cls:'DirectLoginListPopup_footer'} | 61 | {tag:'div', cls:'DirectLoginListPopup_footer'} |
64 | ]}); | 62 | ]}); |
65 | 63 | ||
66 | MochiKit.Style.hideElement(this.getId('DirectLoginListPopup')); | 64 | MochiKit.Style.hideElement(this.getId('DirectLoginListPopup')); |
67 | 65 | ||
68 | //BEWARE: use MochiKit.Signal.connect instead of this.connectEvent, as the HEADER is NOT redrawn after each refresh | 66 | //BEWARE: use MochiKit.Signal.connect instead of this.connectEvent, as the HEADER is NOT redrawn after each refresh |
69 | MochiKit.Signal.connect(this.getId('DirectLoginListPopup'), 'onmouseenter', this, 'handleDirectLoginListPopupEnter'); | 67 | MochiKit.Signal.connect(this.getId('DirectLoginListPopup'), 'onmouseenter', this, 'handleDirectLoginListPopupEnter'); |
70 | MochiKit.Signal.connect(this.getId('DirectLoginListPopup'), 'onmouseleave', this, 'handleDirectLoginListPopupLeave'); | 68 | MochiKit.Signal.connect(this.getId('DirectLoginListPopup'), 'onmouseleave', this, 'handleDirectLoginListPopupLeave'); |
71 | }, | 69 | }, |
72 | 70 | ||
73 | //------------------------------------------------------------------------- | 71 | //------------------------------------------------------------------------- |
74 | 72 | ||
75 | 'renderCell': function(aRowElement, anObject) { | 73 | 'renderCell': function(aRowElement, anObject) { |
76 | var i,c; | 74 | var i,c; |
77 | var directLoginsInfo; | 75 | var directLoginsInfo; |
78 | 76 | ||
79 | directLoginsInfo = anObject[this.name()]; | 77 | directLoginsInfo = anObject[this.name()]; |
80 | 78 | ||
81 | TDElement = Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:'card_directLogins'}); | 79 | TDElement = Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:'card_directLogins'}); |
82 | 80 | ||
83 | c = Math.min(2, directLoginsInfo.length); | 81 | c = Math.min(2, directLoginsInfo.length); |
84 | for (i=0; i<c; i++) { | 82 | for (i=0; i<c; i++) { |
85 | var elementID; | 83 | var elementID; |
86 | 84 | ||
87 | elementID = 'directLogin_' + directLoginsInfo[i]['_reference']; | 85 | elementID = 'directLogin_' + directLoginsInfo[i]['_reference']; |
88 | 86 | ||
89 | Clipperz.DOM.Helper.append(TDElement, {tag:'div', cls:'card_directLogin', children:[ | 87 | Clipperz.DOM.Helper.append(TDElement, {tag:'div', cls:'card_directLogin', children:[ |
90 | {tag:'div', cls:'card_directLogin_body', children:[ | 88 | {tag:'div', cls:'card_directLogin_body', children:[ |
91 | {tag:'a', href:'#', id:elementID, html:directLoginsInfo[i]['label']} | 89 | {tag:'a', href:'#', id:elementID, html:directLoginsInfo[i]['label']} |
92 | ]} | 90 | ]} |
93 | ]}); | 91 | ]}); |
94 | // MochiKit.Signal.connect(elementID, 'onclick', MochiKit.Base.method(this, 'handleDirectLoginClick', directLoginsInfo[i]['_rowObject'])); | 92 | // MochiKit.Signal.connect(elementID, 'onclick', MochiKit.Base.method(this, 'handleDirectLoginClick', directLoginsInfo[i]['_rowObject'])); |
95 | this.connectEvent(elementID, 'onclick', MochiKit.Base.method(this, 'handleDirectLoginClick', directLoginsInfo[i]['_rowObject'])); | 93 | this.connectEvent(elementID, 'onclick', MochiKit.Base.method(this, 'handleDirectLoginClick', directLoginsInfo[i]['_rowObject'])); |
96 | } | 94 | } |
97 | 95 | ||
98 | if (directLoginsInfo.length > 2) { | 96 | if (directLoginsInfo.length > 2) { |
99 | var ellipsesElement; | 97 | var ellipsesElement; |
100 | 98 | ||
101 | ellipsesElement = Clipperz.DOM.Helper.append(TDElement, {tag:'div', cls:'card_directLogin_ellipses', children:[ | 99 | ellipsesElement = Clipperz.DOM.Helper.append(TDElement, {tag:'div', cls:'card_directLogin_ellipses', children:[ |
102 | {tag:'div', cls:'card_directLogin_ellipses_body', children:[ | 100 | {tag:'div', cls:'card_directLogin_ellipses_body', children:[ |
103 | {tag:'span', html:'…'} | 101 | {tag:'span', html:'…'} |
104 | ]} | 102 | ]} |
105 | ]}); | 103 | ]}); |
106 | 104 | ||
107 | /// MochiKit.Signal.connect(ellipsesElement, 'onmouseenter', MochiKit.Base.method(this, 'handleEllipsesEnter', anObject)); | 105 | /// MochiKit.Signal.connect(ellipsesElement, 'onmouseenter', MochiKit.Base.method(this, 'handleEllipsesEnter', anObject)); |
108 | /// MochiKit.Signal.connect(ellipsesElement, 'onmouseleave', MochiKit.Base.method(this, 'handleEllipsesLeave')); | 106 | /// MochiKit.Signal.connect(ellipsesElement, 'onmouseleave', MochiKit.Base.method(this, 'handleEllipsesLeave')); |
109 | // MochiKit.Signal.connect(TDElement, 'onmouseleave', MochiKit.Base.method(this, 'handleTDLeave')); | 107 | // MochiKit.Signal.connect(TDElement, 'onmouseleave', MochiKit.Base.method(this, 'handleTDLeave')); |
110 | this.connectEvent(TDElement, 'onmouseleave', MochiKit.Base.method(this, 'handleTDLeave')); | 108 | this.connectEvent(TDElement, 'onmouseleave', MochiKit.Base.method(this, 'handleTDLeave')); |
111 | } | 109 | } |
112 | // MochiKit.Signal.connect(TDElement, 'onmouseenter', MochiKit.Base.method(this, 'handleTDEnter', anObject)); | 110 | // MochiKit.Signal.connect(TDElement, 'onmouseenter', MochiKit.Base.method(this, 'handleTDEnter', anObject)); |
113 | this.connectEvent(TDElement, 'onmouseenter', MochiKit.Base.method(this, 'handleTDEnter', anObject)); | 111 | this.connectEvent(TDElement, 'onmouseenter', MochiKit.Base.method(this, 'handleTDEnter', anObject)); |
114 | 112 | ||
115 | }, | 113 | }, |
116 | 114 | ||
117 | //========================================================================= | 115 | //========================================================================= |
118 | /* | 116 | /* |
119 | 'handleEllipsesEnter': function (aRecordInfo, anEvent) { | 117 | 'handleEllipsesEnter': function (aRecordInfo, anEvent) { |
120 | this._enterLeaveCounter ++; | 118 | this._enterLeaveCounter ++; |
121 | if (this._enterLeaveCounter > 2) { | 119 | if (this._enterLeaveCounter > 2) { |
122 | this._enterLeaveCounter = 2; | 120 | this._enterLeaveCounter = 2; |
123 | } | 121 | } |
124 | 122 | ||
125 | if (this._enterLeaveCounter == 1) { | 123 | if (this._enterLeaveCounter == 1) { |
126 | this.showDirectLoginListPopup(aRecordInfo, anEvent.src()); | 124 | this.showDirectLoginListPopup(aRecordInfo, anEvent.src()); |
127 | } | 125 | } |
128 | }, | 126 | }, |
129 | 127 | ||
130 | 'handleEllipsesLeave': function (anEvent) { | 128 | 'handleEllipsesLeave': function (anEvent) { |
131 | this._enterLeaveCounter --; | 129 | this._enterLeaveCounter --; |
132 | 130 | ||
133 | MochiKit.Async.callLater(0.3, MochiKit.Base.bind(function () { | 131 | MochiKit.Async.callLater(0.3, MochiKit.Base.bind(function () { |
134 | if (this._enterLeaveCounter == 0) { | 132 | if (this._enterLeaveCounter == 0) { |
135 | this.hideDirectLoginListPopup(); | 133 | this.hideDirectLoginListPopup(); |
136 | } | 134 | } |
137 | }, this)) | 135 | }, this)) |
138 | }, | 136 | }, |
139 | */ | 137 | */ |
140 | //------------------------------------------------------------------------- | 138 | //------------------------------------------------------------------------- |
141 | 139 | ||
142 | 'handleTDEnter': function (aRecordInfo, anEvent) { | 140 | 'handleTDEnter': function (aRecordInfo, anEvent) { |
143 | if (MochiKit.Selector.findChildElements(anEvent.src(), ['div.card_directLogin_ellipses']).length > 0) { | 141 | if (MochiKit.Selector.findChildElements(anEvent.src(), ['div.card_directLogin_ellipses']).length > 0) { |
144 | this._enterLeaveCounter ++; | 142 | this._enterLeaveCounter ++; |
145 | if (this._enterLeaveCounter > 2) { | 143 | if (this._enterLeaveCounter > 2) { |
146 | this._enterLeaveCounter = 2; | 144 | this._enterLeaveCounter = 2; |
147 | } | 145 | } |
148 | 146 | ||
149 | if (this._enterLeaveCounter == 1) { | 147 | if (this._enterLeaveCounter == 1) { |
150 | this.showDirectLoginListPopup(aRecordInfo, anEvent.src()); | 148 | this.showDirectLoginListPopup(aRecordInfo, anEvent.src()); |