author | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2011-10-02 23:56:18 (UTC) |
---|---|---|
committer | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2011-10-02 23:56:18 (UTC) |
commit | ef68436ac04da078ffdcacd7e1f785473a303d45 (patch) (unidiff) | |
tree | c403752d66a2c4775f00affd4fa8431b29c5b68c /frontend/gamma/js/Clipperz/PM/UI/Web/Components | |
parent | 597ecfbc0249d83e1b856cbd558340c01237a360 (diff) | |
download | clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.zip clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.tar.gz clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.tar.bz2 |
First version of the newly restructured repository
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Components') (more/less context) (ignore whitespace changes)
34 files changed, 6512 insertions, 0 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js new file mode 100644 index 0000000..4378b19 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js | |||
@@ -0,0 +1,148 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.AccountPanel = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.AccountPanel.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | //this._initiallySelectedTab = args.selected || 'ACCOUNT'; | ||
37 | this._initiallySelectedTab = args.selected || 'PASSPHRASE'; | ||
38 | this._tabPanelControllerConfiguration = { | ||
39 | // 'ACCOUNT': { | ||
40 | // tab:'accountTab', | ||
41 | // panel:'accountPanel' | ||
42 | // }, | ||
43 | 'PASSPHRASE': { | ||
44 | tab:'passphraseTab', | ||
45 | panel:'passphrasePanel' | ||
46 | }, | ||
47 | 'PREFERENCES': { | ||
48 | tab:'preferencesTab', | ||
49 | panel:'preferencesPanel' | ||
50 | }, | ||
51 | 'LOGIN_HISTORY': { | ||
52 | tab:'loginHistoryTab', | ||
53 | panel:'loginHistoryPanel' | ||
54 | } | ||
55 | }; | ||
56 | |||
57 | return this; | ||
58 | } | ||
59 | |||
60 | //============================================================================= | ||
61 | |||
62 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.AccountPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, { | ||
63 | |||
64 | //------------------------------------------------------------------------- | ||
65 | |||
66 | 'toString': function () { | ||
67 | return "Clipperz.PM.UI.Web.Components.AccountPanel component"; | ||
68 | }, | ||
69 | |||
70 | //------------------------------------------------------------------------- | ||
71 | |||
72 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
73 | //Clipperz.log("AccountPanel.renderSelf element", this.element()); | ||
74 | this.append(this.element(), [ | ||
75 | {tag:'div', cls:'header', children:[ | ||
76 | {tag:'div', cls:'subPanelTabs', children:[ | ||
77 | {tag:'ul', children:[ | ||
78 | // {tag:'li', id:this.getId('accountTab'), children:[{tag:'a', href:'#', html:'Account'}], cls:'first'}, | ||
79 | {tag:'li', id:this.getId('passphraseTab'), children:[{tag:'a', href:'#', html:'Passphrase'}], cls:'first'}, | ||
80 | {tag:'li', id:this.getId('preferencesTab'), children:[{tag:'a', href:'#', html:'Preferences'}]}, | ||
81 | {tag:'li', id:this.getId('loginHistoryTab'),children:[{tag:'a', href:'#', html:'Login history'}]} | ||
82 | ]} | ||
83 | ]} | ||
84 | ]}, | ||
85 | {tag:'div', cls:'body', children:[ | ||
86 | {tag:'div', cls:'accountPanel', children:[ | ||
87 | {tag:'div', cls:'subPanelContent', children:[ | ||
88 | {tag:'ul', children:[ | ||
89 | // {tag:'li', id:this.getId('accountPanel'),children:[ | ||
90 | // {tag:'h3', html:"-- Account --"} | ||
91 | // ]}, | ||
92 | {tag:'li', id:this.getId('passphrasePanel'),children:[ | ||
93 | {tag:'h3', cls:'changePassphrase', html:"Change passphrase"}, | ||
94 | {tag:'form', id:this.getId('changePassphrase'), cls:'changePassphrase', children:[ | ||
95 | {tag:'div', cls:'currentCredentials', children:[ | ||
96 | {tag:'div', cls:'field username', children:[ | ||
97 | {tag:'label', html:"username", 'for':this.getId('currentUsername')}, | ||
98 | {tag:'input', id:this.getId('currentUsername')} | ||
99 | ]}, | ||
100 | {tag:'div', cls:'field passphrase', children:[ | ||
101 | {tag:'label', html:"passphrase", 'for':this.getId('currentPassphrase')}, | ||
102 | {tag:'input', id:this.getId('currentPassphrase')} | ||
103 | ]} | ||
104 | ]}, | ||
105 | {tag:'div', cls:'newPassphrase', children:[ | ||
106 | {tag:'div', cls:'field', children:[ | ||
107 | {tag:'label', html:"new passphrase", 'for':this.getId('newPassphrase')}, | ||
108 | {tag:'input', id:this.getId('newPassphrase')} | ||
109 | ]}, | ||
110 | {tag:'div', cls:'field', children:[ | ||
111 | {tag:'label', html:"re-new passphrase", 'for':this.getId('reNewPassphrase')}, | ||
112 | {tag:'input', id:this.getId('reNewPassphrase')} | ||
113 | ]} | ||
114 | ]}, | ||
115 | {tag:'div', cls:'confirm', children:[ | ||
116 | {tag:'input', type:'checkbox', id:this.getId('confirm')}, | ||
117 | {tag:'label', html:"I understand that Clipperz will not be able to recover a lost passphrase", 'for':this.getId('confirm')} | ||
118 | ]} | ||
119 | ]}, | ||
120 | {tag:'div', cls:'clear'}, | ||
121 | {tag:'div', cls:'confirmButton', id:this.getId('confirmationButton'), children:[ | ||
122 | {tag:'span', html:"change passphrase"} | ||
123 | ]}, | ||
124 | |||
125 | {tag:'h3', cls:'manageOTP', html:"Manage One-Time Passphrases"}, | ||
126 | {} | ||
127 | ]}, | ||
128 | {tag:'li', id:this.getId('preferencesPanel'), children:[ | ||
129 | {tag:'h3', html:"-- Preferences --"} | ||
130 | ]}, | ||
131 | {tag:'li', id:this.getId('loginHistoryPanel'), children:[ | ||
132 | {tag:'h3', html:"-- Login History --"} | ||
133 | ]} | ||
134 | ]} | ||
135 | ]} | ||
136 | ]} | ||
137 | ]}, | ||
138 | {tag:'div', cls:'footer'} | ||
139 | ]); | ||
140 | |||
141 | this.tabPanelController().setup({selected:this.initiallySelectedTab()}); | ||
142 | }, | ||
143 | |||
144 | //------------------------------------------------------------------------- | ||
145 | |||
146 | |||
147 | __syntaxFix__: "syntax fix" | ||
148 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AppPage.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AppPage.js new file mode 100644 index 0000000..67247df --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AppPage.js | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.AppPage = function(args) { | ||
32 | args = args || {}; | ||
33 | Clipperz.PM.UI.Web.Components.AppPage.superclass.constructor.call(this, args); | ||
34 | |||
35 | this._element = args.element || null; | ||
36 | |||
37 | this._slots = { | ||
38 | 'cardGrid' : this.getId('cardGrid'), | ||
39 | // 'directLoginGrid' : this.getId('directLoginGrid'), | ||
40 | 'accountPanel': this.getId('accountPanel'), | ||
41 | 'dataPanel': this.getId('dataPanel'), | ||
42 | 'toolsPanel': this.getId('toolsPanel'), | ||
43 | 'userInfoBox': this.getId('userInfoBox'), | ||
44 | 'tabSidePanel': this.getId('tabSidePanel') | ||
45 | }; | ||
46 | |||
47 | return this; | ||
48 | } | ||
49 | |||
50 | //============================================================================= | ||
51 | |||
52 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.AppPage, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
53 | |||
54 | //------------------------------------------------------------------------- | ||
55 | |||
56 | 'toString': function () { | ||
57 | return "Clipperz.PM.UI.Web.Components.AppPage component"; | ||
58 | }, | ||
59 | |||
60 | //------------------------------------------------------------------------- | ||
61 | |||
62 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
63 | this.append(this.element(), {tag:'div', id:this.getId('userInfoBox'), cls:'userInfoBox'}); | ||
64 | this.append(this.element(), {tag:'div', id:this.getId('sidePanels'), cls:'sidePanels'}); | ||
65 | this.append(this.getId('sidePanels'),{tag:'div', id:this.getId('tabSidePanel'), cls:'tabSidePanel', children:[]}); | ||
66 | |||
67 | this.append(this.element(), {tag:'div', id:this.getId('mainPanels'), cls:'mainPanels'}); | ||
68 | this.append(this.getId('mainPanels'), {tag:'div', id:this.getId('cardGrid'), cls:'gridComponent cardGrid'}); | ||
69 | // this.append(this.getId('mainPanels'), {tag:'div', id:this.getId('directLoginGrid'), cls:'gridComponent directLoginGrid'}); | ||
70 | this.append(this.getId('mainPanels'), {tag:'div', id:this.getId('accountPanel'), cls:'otherPanel'}); | ||
71 | this.append(this.getId('mainPanels'), {tag:'div', id:this.getId('dataPanel'), cls:'otherPanel'}); | ||
72 | this.append(this.getId('mainPanels'), {tag:'div', id:this.getId('toolsPanel'), cls:'otherPanel'}); | ||
73 | }, | ||
74 | |||
75 | //------------------------------------------------------------------------- | ||
76 | |||
77 | __syntaxFix__: "syntax fix" | ||
78 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/BookmarkletComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/BookmarkletComponent.js new file mode 100644 index 0000000..42a6052 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/BookmarkletComponent.js | |||
@@ -0,0 +1,109 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.BookmarkletComponent = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.BookmarkletComponent.superclass.constructor.apply(this, arguments); | ||
35 | MochiKit.Signal.connect(Clipperz.PM.Strings.Languages, 'switchLanguage', this, 'updateBookmarkletURLs'); | ||
36 | |||
37 | return this; | ||
38 | } | ||
39 | |||
40 | //============================================================================= | ||
41 | |||
42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.BookmarkletComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
43 | |||
44 | //------------------------------------------------------------------------- | ||
45 | |||
46 | 'toString': function () { | ||
47 | return "Clipperz.PM.UI.Web.Components.BookmarkletComponent component"; | ||
48 | }, | ||
49 | |||
50 | //------------------------------------------------------------------------- | ||
51 | |||
52 | 'renderSelf': function() { | ||
53 | // var bookmarkletUrl; | ||
54 | // | ||
55 | // if (Clipperz_IEisBroken == true) { | ||
56 | // bookmarkletUrl = bookmarklet_ie; | ||
57 | // } else { | ||
58 | /// bookmarkletUrl = bookmarklet; | ||
59 | // bookmarkletUrl = Clipperz.PM.Strings['bookmarklet']; | ||
60 | // } | ||
61 | |||
62 | this.append(this.element(), {tag:'div', cls:'bookmarklet', children: [ | ||
63 | {tag:'div', id:this.getId('linkBlock'), cls:'bookmarklet_link', children:[ | ||
64 | // {tag:'a', id:this.getId('link'), href:bookmarkletUrl, children:[ | ||
65 | {tag:'a', id:this.getId('link'), href:'#', children:[ | ||
66 | {tag:'div', cls:'icon'}, | ||
67 | {tag:'div', cls:'text', children:[ | ||
68 | {tag:'span', html:"add to Clipperz"} | ||
69 | ]} | ||
70 | ]} | ||
71 | ]} | ||
72 | ]}); | ||
73 | |||
74 | new Clipperz.PM.UI.Common.Components.Tooltip({ | ||
75 | element:this.getElement('linkBlock'), | ||
76 | text: "Drag and drop the \"add to Clipperz\" link above to the bookmark bar.", | ||
77 | position:'BELOW' | ||
78 | }); | ||
79 | |||
80 | MochiKit.Signal.connect(this.getId('link'), 'onclick', this, 'handleOnclick'); | ||
81 | this.updateBookmarkletURLs(); | ||
82 | }, | ||
83 | |||
84 | //------------------------------------------------------------------------- | ||
85 | |||
86 | 'handleOnclick': function (anEvent) { | ||
87 | anEvent.preventDefault(); | ||
88 | |||
89 | Clipperz.log("BOOKMARKLET CLICK"); | ||
90 | }, | ||
91 | |||
92 | //------------------------------------------------------------------------- | ||
93 | |||
94 | 'updateBookmarkletURLs': function () { | ||
95 | var bookmarkletUrl; | ||
96 | |||
97 | if (Clipperz_IEisBroken == true) { | ||
98 | bookmarkletUrl = bookmarklet_ie; | ||
99 | } else { | ||
100 | // bookmarkletUrl = bookmarklet; | ||
101 | bookmarkletUrl = Clipperz.PM.Strings.getValue('bookmarklet'); | ||
102 | } | ||
103 | |||
104 | this.getElement('link').href = bookmarkletUrl; | ||
105 | }, | ||
106 | |||
107 | //------------------------------------------------------------------------- | ||
108 | __syntaxFix__: "syntax fix" | ||
109 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js new file mode 100644 index 0000000..e3238ca --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js | |||
@@ -0,0 +1,881 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.CardDialogComponent = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.CardDialogComponent.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._tabPanelController = null; | ||
37 | |||
38 | this._tabPanelControllerConfiguration = { | ||
39 | 'DETAILS': { | ||
40 | tab:'detailTab', | ||
41 | panel:'detailTabpanel' | ||
42 | }, | ||
43 | 'DIRECT_LOGINS': { | ||
44 | tab:'directLoginTab', | ||
45 | panel:'directLoginTabpanel' | ||
46 | }, | ||
47 | 'SHARING': { | ||
48 | tab:'sharingTab', | ||
49 | panel:'sharingTabpanel' | ||
50 | } | ||
51 | }; | ||
52 | |||
53 | this._tooltips = null; | ||
54 | |||
55 | this._isSavingEnabled = false; | ||
56 | this._hintMode = 'OFF'; //'ON' | ||
57 | |||
58 | this._fieldComponents = {}; | ||
59 | this._directLoginComponents = {}; | ||
60 | |||
61 | this._displayMode = 'fixed'; //'scrollable'; | ||
62 | |||
63 | return this; | ||
64 | } | ||
65 | |||
66 | //============================================================================= | ||
67 | |||
68 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
69 | |||
70 | //------------------------------------------------------------------------- | ||
71 | |||
72 | 'toString': function () { | ||
73 | return "Clipperz.PM.UI.Web.Components.CardDialogComponent component"; | ||
74 | }, | ||
75 | |||
76 | //------------------------------------------------------------------------- | ||
77 | |||
78 | 'tabPanelController': function () { | ||
79 | if (this._tabPanelController == null) { | ||
80 | this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({ | ||
81 | component:this, | ||
82 | configuration:this._tabPanelControllerConfiguration | ||
83 | }); | ||
84 | |||
85 | MochiKit.Signal.connect(this._tabPanelController, 'tabSelected', this, 'handleTabSelected') | ||
86 | } | ||
87 | |||
88 | return this._tabPanelController; | ||
89 | }, | ||
90 | |||
91 | //------------------------------------------------------------------------- | ||
92 | |||
93 | 'renderSelf': function() { | ||
94 | this.append(this.element(), {tag:'div', cls:'CardDialog mainDialog loading', id:this.getId('panel'), children: [ | ||
95 | {tag:'form', id:this.getId('form'), children:[ | ||
96 | // {tag:'input', type:'text', id:this.getId('hidden'), cls:'hidden'}, | ||
97 | {tag:'div', cls:'header', children:[ | ||
98 | {tag:'div', cls:'title', children:[ | ||
99 | {tag:'input', type:'text', id:this.getId('title')} | ||
100 | ]} | ||
101 | ]}, | ||
102 | {tag:'div', id:this.getId('body'), cls:'body', children:[ | ||
103 | {tag:'div', cls:'tabs', children:[ | ||
104 | {tag:'ul', cls:'tabs', children:[ | ||
105 | {tag:'li', id:this.getId('detailTab'), children:[{tag:'span', html:"details"}]}, | ||
106 | {tag:'li', id:this.getId('directLoginTab'), children:[ | ||
107 | {tag:'span', html:"direct logins"}//, | ||
108 | // {tag:'div', id:this.getId('addDirectLoginButton'), cls:'addDirectLoginButton', children:[ | ||
109 | // {tag:'span', html:"+"} | ||
110 | // ]} | ||
111 | ]}, | ||
112 | {tag:'li', id:this.getId('sharingTab'), children:[{tag:'span', html:"sharing"}]} | ||
113 | ]} | ||
114 | ]}, | ||
115 | {tag:'div', cls:'tabPanels', children:[ | ||
116 | {tag:'ul', cls:'tabPanels', children:[ | ||
117 | {tag:'li', id:this.getId('detailTabpanel'), cls:'tabPanel', children:[ | ||
118 | {tag:'div', id:this.getId('recordFields'), children:[ | ||
119 | {tag:'table', cls:'fields', cellpadding:'0', id:this.getId('fieldTable'), cellspacing:'0', children:[ | ||
120 | {tag:'thead', children:[ | ||
121 | {tag:'tr', children:[ | ||
122 | {tag:'th', cls:'fieldStateTH',html:""}, | ||
123 | {tag:'th', cls:'fieldLabelTH',html:"label"}, | ||
124 | {tag:'th', cls:'fieldLockTH',html:""}, | ||
125 | {tag:'th', cls:'fieldValueTH',html:"value"}, | ||
126 | {tag:'th', cls:'fieldActionTH',html:""}, | ||
127 | {tag:'th', cls:'fieldDeleteTH',html:""} | ||
128 | ]} | ||
129 | ]}, | ||
130 | {tag:'tfoot'}, | ||
131 | {tag:'tbody', id:this.getId('tableBody'), children:[ | ||
132 | {tag:'tr', id:this.getId('newFieldTR'), cls:'newFieldTR', children:[ | ||
133 | {tag:'td', cls:'fieldState'}, | ||
134 | {tag:'td', cls:'fieldLabel', children:[ | ||
135 | {tag:'input', cls:'label', id:this.getId('newFieldLabel')} | ||
136 | ]}, | ||
137 | {tag:'td', cls:'fieldLock', children:[ | ||
138 | {tag:'div', cls:'unlocked', id:this.getId('newFieldIsLocked')} | ||
139 | ]}, | ||
140 | {tag:'td', cls:'fieldValue', children:[ | ||
141 | {tag:'div', cls:'unlocked', id:this.getId('newFieldValueWrapper'), children:[ | ||
142 | {tag:'input',type:'text', cls:'value', id:this.getId('newFieldValue')} | ||
143 | ]} | ||
144 | ]}, | ||
145 | {tag:'td', cls:'fieldAction', children:[ | ||
146 | {tag:'div', html:' '} | ||
147 | ]}, | ||
148 | {tag:'td', cls:'fieldAddDelete', children:[ | ||
149 | {tag:'div', cls:'new', children:[ | ||
150 | {tag:'span', children:[ | ||
151 | {tag:'a', href:'#', id:this.getId('newFieldAddButton'), html:"add"} | ||
152 | ]} | ||
153 | ]} | ||
154 | ]} | ||
155 | ]} | ||
156 | ]} | ||
157 | ]} | ||
158 | ]}, | ||
159 | {tag:'div', cls:'notes', children:[ | ||
160 | {tag:'div', children:[ | ||
161 | {tag:'textarea', id:this.getId('recordNote'), value:""} | ||
162 | ]} | ||
163 | ]} | ||
164 | ]}, | ||
165 | {tag:'li', id:this.getId('directLoginTabpanel'), cls:'tabPanel', children:[ | ||
166 | {tag:'div', id:this.getId('directLoginsComponentContainer'), cls:'directLoginsComponentContainer', children:[ | ||
167 | {tag:'div', id:this.getId('directLogins'), cls:'directLogins', children:[ | ||
168 | {tag:'div', id:this.getId('addNewDirectLoginSplash'), cls:'addNewDirectLoginSplash', children:[ | ||
169 | {tag:'h3', html:"Here you can add a Direct Login for this card: instant access to your favorit website!"}, | ||
170 | {tag:'a', href:'#', id:this.getId('addNewDirectLoginSplashButton'), children:[{tag:'span', html:"Add Direct Login"}]} | ||
171 | ]}, | ||
172 | {tag:'div', id:this.getId('directLoginsList')}, | ||
173 | {tag:'div', cls:'addDirectLoginListItem', id:this.getId('addDirectLoginListItem'), children:[{tag:'a', href:'#', id:this.getId('addNewDirectLoginListItemButton'), children:[{tag:'span', html:"Add Direct Login"}]}]} | ||
174 | ]}, | ||
175 | {tag:'div', id:this.getId('directLoginEditDetail'), cls:'directLoginEditDetail'} | ||
176 | ]} | ||
177 | ]}, | ||
178 | {tag:'li', id:this.getId('sharingTabpanel'), cls:'tabPanel', children:[ | ||
179 | {tag:'h2', html:"Coming soon!"} | ||
180 | ]} | ||
181 | ]} | ||
182 | ]}, | ||
183 | {tag:'div', cls:'mask', children:[ | ||
184 | {tag:'div', id:this.getId('progress'), children:[ | ||
185 | {tag:'h3', id:this.getId('progressDescription'), cls:'progressDescription', html:"Loading"}, | ||
186 | {tag:'div', id:this.getId('progressBar')} | ||
187 | ]}, | ||
188 | {tag:'div', id:this.getId('error'), cls:'error', children:[ | ||
189 | {tag:'div', cls:'img'}, | ||
190 | {tag:'p', id:this.getId('errorMessage')} | ||
191 | ]} | ||
192 | ]} | ||
193 | ]}, | ||
194 | {tag:'div', cls:'footer', children:[ | ||
195 | {tag:'div', cls:'buttonArea', children:[ | ||
196 | {tag:'div', cls:'cancel', id:this.getId('cancelButton'), html:"cancel"}, | ||
197 | {tag:'div', cls:'save disabled', id:this.getId('saveButton'), html:"save"} | ||
198 | ]} | ||
199 | ]} | ||
200 | ]} | ||
201 | ]}); | ||
202 | |||
203 | |||
204 | this.insertAllTooltips(); | ||
205 | |||
206 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); | ||
207 | |||
208 | this.tabPanelController().setup({selected:'DETAILS'}); | ||
209 | // this.tabPanelController().setup({selected:'DIRECT_LOGINS'}); | ||
210 | |||
211 | MochiKit.Style.hideElement(this.getId('error')); | ||
212 | MochiKit.Style.hideElement(this.getElement('directLoginEditDetail')); | ||
213 | MochiKit.Style.hideElement(this.getElement('addDirectLoginListItem')); | ||
214 | this.plumbDetailsPanel(); | ||
215 | |||
216 | MochiKit.Signal.connect(this.getId('cancelButton'), 'onclick', this, 'handleCancelEvent'); | ||
217 | MochiKit.Signal.connect(this.getId('saveButton'), 'onclick', this, 'handleSaveEvent'); | ||
218 | |||
219 | MochiKit.Signal.connect(this.getId('addNewDirectLoginSplashButton'), 'onclick', this, 'handleAddDirectLogin'); | ||
220 | MochiKit.Signal.connect(this.getId('addNewDirectLoginListItemButton'), 'onclick', this, 'handleAddDirectLogin'); | ||
221 | |||
222 | MochiKit.Signal.connect(MochiKit.DOM.currentDocument().body, 'onkeydown',this, 'handleKeyEvent'); | ||
223 | }, | ||
224 | |||
225 | //------------------------------------------------------------------------- | ||
226 | |||
227 | 'displayMode': function () { | ||
228 | return this._displayMode; | ||
229 | }, | ||
230 | |||
231 | 'setDisplayMode': function (aValue) { | ||
232 | this._displayMode = aValue; | ||
233 | }, | ||
234 | |||
235 | //------------------------------------------------------------------------- | ||
236 | |||
237 | 'plumbDetailsPanel': function () { | ||
238 | MochiKit.Signal.connect(this.getId('title'), 'onfocus', MochiKit.Base.method(this, 'handleOnFocusEvent',this.getElement('title').parentNode)); | ||
239 | MochiKit.Signal.connect(this.getId('title'), 'onblur',MochiKit.Base.method(this, 'handleLooseFocusEvent', this.getElement('title').parentNode)); | ||
240 | MochiKit.Signal.connect(this.getId('title'), 'onchange',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | ||
241 | MochiKit.Signal.connect(this.getId('title'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | ||
242 | |||
243 | MochiKit.Signal.connect(this.getId('recordNote'), 'onfocus', MochiKit.Base.method(this, 'handleOnFocusEvent',MochiKit.Selector.findChildElements(this.element(), ['div.notes'])[0])); | ||
244 | MochiKit.Signal.connect(this.getId('recordNote'), 'onblur',MochiKit.Base.method(this, 'handleLooseFocusEvent', MochiKit.Selector.findChildElements(this.element(), ['div.notes'])[0])); | ||
245 | MochiKit.Signal.connect(this.getId('recordNote'), 'onchange',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | ||
246 | MochiKit.Signal.connect(this.getId('recordNote'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | ||
247 | |||
248 | MochiKit.Signal.connect(this.getId('newFieldValue'), 'onkeydown',this, 'handleKeyDownOnNewFieldValue'); | ||
249 | |||
250 | MochiKit.Signal.connect(this.getId('newFieldLabel'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | ||
251 | MochiKit.Signal.connect(this.getId('newFieldIsLocked'), 'onclick',this, 'toggleNewFieldIsHidden'); | ||
252 | MochiKit.Signal.connect(this.getId('newFieldValue'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | ||
253 | |||
254 | MochiKit.Signal.connect(this.getId('newFieldAddButton'), 'onclick', this, 'handleAddClick'); | ||
255 | }, | ||
256 | |||
257 | //------------------------------------------------------------------------- | ||
258 | |||
259 | 'insertAllTooltips': function () { | ||
260 | var tooltips; | ||
261 | var tooltipEnabled; | ||
262 | |||
263 | tooltips = {}; | ||
264 | tooltipEnabled = (this.hintMode() == 'ON'); | ||
265 | |||
266 | tooltips['title'] = new Clipperz.PM.UI.Common.Components.Tooltip({ | ||
267 | 'element':this.getElement('title'), | ||
268 | 'text': "Insert here the title of the card", | ||
269 | 'position':'RIGHT' | ||
270 | }); | ||
271 | this.addComponent(tooltips['title']); | ||
272 | MochiKit.Signal.connect(this.getId('title'), 'onfocus',MochiKit.Base.method(this, 'showTooltipOnFocus', 'title')); | ||
273 | MochiKit.Signal.connect(this.getId('title'), 'onblur', MochiKit.Base.method(this, 'hideTooltipOnBlur', 'title')); | ||
274 | |||
275 | tooltips['newFieldTR'] = new Clipperz.PM.UI.Common.Components.Tooltip({ | ||
276 | 'element':this.getElement('newFieldTR'), | ||
277 | 'text': "Insert your card new values here", | ||
278 | 'position':'RIGHT' | ||
279 | }); | ||
280 | this.addComponent(tooltips['newFieldTR']); | ||
281 | MochiKit.Signal.connect(this.getId('newFieldLabel'), 'onfocus',MochiKit.Base.method(this, 'showTooltipOnFocus', 'newFieldTR')); | ||
282 | MochiKit.Signal.connect(this.getId('newFieldValue'), 'onblur', MochiKit.Base.method(this, 'hideTooltipOnBlur', 'newFieldTR')); | ||
283 | |||
284 | tooltips['recordNote'] = new Clipperz.PM.UI.Common.Components.Tooltip({ | ||
285 | 'element':this.getElement('recordNote'), | ||
286 | 'text': "You can insert some notes here", | ||
287 | 'position':'RIGHT' | ||
288 | }); | ||
289 | this.addComponent(tooltips['recordNote']); | ||
290 | MochiKit.Signal.connect(this.getId('recordNote'), 'onfocus',MochiKit.Base.method(this, 'showTooltipOnFocus', 'recordNote')); | ||
291 | MochiKit.Signal.connect(this.getId('recordNote'), 'onblur', MochiKit.Base.method(this, 'hideTooltipOnBlur', 'recordNote')); | ||
292 | |||
293 | this._tooltips = tooltips; | ||
294 | }, | ||
295 | |||
296 | //......................................................................... | ||
297 | |||
298 | 'updateAllTooltipsEnabledMode': function (aStatus) { | ||
299 | vartooltipLabel; | ||
300 | var tooltipEnabled; | ||
301 | |||
302 | tooltipEnabled = (aStatus == 'ON') ? true : false; | ||
303 | |||
304 | for (tooltipLabel in this.tooltips()) { | ||
305 | this.tooltips()[tooltipLabel].setIsEnabled(tooltipEnabled); | ||
306 | } | ||
307 | }, | ||
308 | |||
309 | //......................................................................... | ||
310 | |||
311 | 'tooltips': function () { | ||
312 | return this._tooltips; | ||
313 | }, | ||
314 | |||
315 | //......................................................................... | ||
316 | |||
317 | 'showTooltipOnFocus': function (aTooltip, anEvent) { | ||
318 | MochiKit.Async.callLater(0.5, MochiKit.Base.method(this.tooltips()[aTooltip], 'show')); | ||
319 | }, | ||
320 | |||
321 | //......................................................................... | ||
322 | |||
323 | 'hideTooltipOnBlur': function (aTooltip, anEvent) { | ||
324 | this.tooltips()[aTooltip].hide(); | ||
325 | }, | ||
326 | |||
327 | //------------------------------------------------------------------------- | ||
328 | |||
329 | 'displayElement': function() { | ||
330 | return this.getElement('panel'); | ||
331 | }, | ||
332 | |||
333 | //------------------------------------------------------------------------- | ||
334 | |||
335 | 'fieldComponents': function () { | ||
336 | return this._fieldComponents; | ||
337 | }, | ||
338 | |||
339 | //------------------------------------------------------------------------- | ||
340 | |||
341 | 'directLoginComponents': function () { | ||
342 | return this._directLoginComponents; | ||
343 | }, | ||
344 | |||
345 | //------------------------------------------------------------------------- | ||
346 | |||
347 | 'hintMode': function () { | ||
348 | return this._hintMode; | ||
349 | }, | ||
350 | |||
351 | 'setHintMode': function (aValue) { | ||
352 | if (this._hintMode != aValue) { | ||
353 | this._hintMode = aValue; | ||
354 | |||
355 | this.updateAllTooltipsEnabledMode(this._hintMode); | ||
356 | // if (this._hintMode == 'ON') { | ||
357 | // this.enableHints(); | ||
358 | // } | ||
359 | } | ||
360 | }, | ||
361 | |||
362 | //------------------------------------------------------------------------- | ||
363 | |||
364 | 'focusOnNewFieldLabel': function () { | ||
365 | this.getElement('newFieldLabel').focus(); | ||
366 | }, | ||
367 | |||
368 | //========================================================================= | ||
369 | |||
370 | 'isSavingEnabled': function () { | ||
371 | return this._isSavingEnabled; | ||
372 | }, | ||
373 | |||
374 | 'setShouldEnableSaving': function (aValue) { | ||
375 | this._isSavingEnabled = aValue || this.newFieldHasPendingChanges(); | ||
376 | |||
377 | if (this._isSavingEnabled == true) { | ||
378 | MochiKit.DOM.addElementClass(this.getElement('panel'), 'hasPendingChanges'); | ||
379 | MochiKit.DOM.removeElementClass(this.getId('saveButton'), 'disabled'); | ||
380 | } else { | ||
381 | MochiKit.DOM.removeElementClass(this.getElement('panel'), 'hasPendingChanges'); | ||
382 | MochiKit.DOM.addElementClass(this.getId('saveButton'), 'disabled'); | ||
383 | } | ||
384 | }, | ||
385 | |||
386 | //========================================================================= | ||
387 | |||
388 | 'title': function () { | ||
389 | return this.getElement('title').value; | ||
390 | }, | ||
391 | |||
392 | 'setTitle': function (aValue) { | ||
393 | this.renderTitle(aValue); | ||
394 | }, | ||
395 | |||
396 | //------------------------------------------------------------------------- | ||
397 | |||
398 | 'renderTitle': function (aValue) { | ||
399 | this.getElement('title').value = Clipperz.Base.sanitizeString(aValue); | ||
400 | }, | ||
401 | |||
402 | //------------------------------------------------------------------------- | ||
403 | |||
404 | 'setFocusOnTitleField': function () { | ||
405 | this.getElement('title').focus(); | ||
406 | }, | ||
407 | |||
408 | //------------------------------------------------------------------------- | ||
409 | |||
410 | 'disableCardTitleEditing': function () { | ||
411 | this.getElement('title').disabled = true; | ||
412 | MochiKit.DOM.addElementClass(this.getElement('title').parentNode, 'disabled'); | ||
413 | }, | ||
414 | |||
415 | |||
416 | 'enableCardTitleEditing': function () { | ||
417 | this.getElement('title').disabled = false; | ||
418 | MochiKit.DOM.removeElementClass(this.getElement('title').parentNode, 'disabled'); | ||
419 | }, | ||
420 | |||
421 | //========================================================================= | ||
422 | |||
423 | 'notes': function () { | ||
424 | return this.getElement('recordNote').value; | ||
425 | }, | ||
426 | |||
427 | 'setNotes': function (aValue) { | ||
428 | this.renderNotes(aValue); | ||
429 | }, | ||
430 | |||
431 | //------------------------------------------------------------------------- | ||
432 | |||
433 | 'renderNotes': function (aValue) { | ||
434 | var noteElement; | ||
435 | |||
436 | noteElement = this.getElement('recordNote'); | ||
437 | |||
438 | if ((aValue != null) && (typeof(aValue) != 'undefined')) { | ||
439 | noteElement.value = aValue; | ||
440 | } else { | ||
441 | noteElement.value = ""; | ||
442 | } | ||
443 | |||
444 | this.fixNotesHeight(); | ||
445 | }, | ||
446 | |||
447 | //========================================================================= | ||
448 | |||
449 | 'addFieldRowComponent': function (aFieldComponent) { | ||
450 | varfieldTR; | ||
451 | |||
452 | fieldTR = this.insertBefore(this.getElement('newFieldTR'), {tag:'tr', id:'recordFieldReferece_'+aFieldComponent.reference()}); | ||
453 | aFieldComponent.renderInNode(fieldTR); | ||
454 | this.fieldComponents()[aFieldComponent.reference()] = aFieldComponent; | ||
455 | }, | ||
456 | |||
457 | //========================================================================= | ||
458 | |||
459 | 'addDirectLoginComponent': function (aDirectLoginComponent) { | ||
460 | var directLoginDIV; | ||
461 | |||
462 | if (MochiKit.Base.keys(this.directLoginComponents()).length == 0) { | ||
463 | this.hideNewDirectLoginSplash(); | ||
464 | } | ||
465 | |||
466 | directLoginDIV = this.append(this.getElement('directLoginsList'), {tag:'div', cls:'directLoginItem'}); | ||
467 | aDirectLoginComponent.renderInNode(directLoginDIV); | ||
468 | this.directLoginComponents()[aDirectLoginComponent.reference()] = aDirectLoginComponent; | ||
469 | }, | ||
470 | |||
471 | 'removeDirectLoginComponent': function (aDirectLoginComponent) { | ||
472 | delete this.directLoginComponents()[aDirectLoginComponent.reference()]; | ||
473 | aDirectLoginComponent.remove(); | ||
474 | |||
475 | if (MochiKit.Base.keys(this.directLoginComponents()).length == 0) { | ||
476 | this.showNewDirectLoginSplash(); | ||
477 | } | ||
478 | }, | ||
479 | |||
480 | //========================================================================= | ||
481 | |||
482 | 'showNewDirectLoginSplash': function () { | ||
483 | MochiKit.Style.showElement(this.getElement('addNewDirectLoginSplash')); | ||
484 | MochiKit.Style.hideElement(this.getElement('addDirectLoginListItem')); | ||
485 | }, | ||
486 | |||
487 | 'hideNewDirectLoginSplash': function () { | ||
488 | MochiKit.Style.hideElement(this.getElement('addNewDirectLoginSplash')); | ||
489 | MochiKit.Style.showElement(this.getElement('addDirectLoginListItem')); | ||
490 | }, | ||
491 | |||
492 | //========================================================================= | ||
493 | |||
494 | 'renderDirectLoginEditingComponent': function (aDirectLoginEditingComponent) { | ||
495 | aDirectLoginEditingComponent.renderInNode(this.getElement('directLoginEditDetail')); | ||
496 | }, | ||
497 | |||
498 | 'placeDirectLoginEditingComponent': function () { | ||
499 | var width; | ||
500 | |||
501 | width = MochiKit.Style.getElementDimensions(this.getElement('directLoginsComponentContainer'))['w']; | ||
502 | |||
503 | return Clipperz.Async.callbacks("CardDialogComponent.renderDirectLoginEditingComponent", [ | ||
504 | MochiKit.Base.bind(function () { | ||
505 | MochiKit.Style.setElementPosition (this.getElement('directLoginEditDetail'), {x:width, y:-MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}); | ||
506 | MochiKit.Style.setElementDimensions(this.getElement('directLoginEditDetail'), {w:width}); | ||
507 | }, this), | ||
508 | |||
509 | MochiKit.Base.noop | ||
510 | ], {trace:false}); | ||
511 | }, | ||
512 | |||
513 | //========================================================================= | ||
514 | |||
515 | 'newFieldLabel': function () { | ||
516 | return this.getElement('newFieldLabel').value; | ||
517 | }, | ||
518 | |||
519 | 'setNewFieldLabel': function (aValue) { | ||
520 | this.getElement('newFieldLabel').value = aValue; | ||
521 | }, | ||
522 | |||
523 | //------------------------------------------------------------------------- | ||
524 | |||
525 | 'newFieldValue': function () { | ||
526 | return this.getElement('newFieldValue').value; | ||
527 | }, | ||
528 | |||
529 | 'setNewFieldValue': function (aValue) { | ||
530 | this.getElement('newFieldValue').value = aValue; | ||
531 | }, | ||
532 | |||
533 | //------------------------------------------------------------------------- | ||
534 | |||
535 | 'newFieldIsHidden': function () { | ||
536 | return MochiKit.DOM.hasElementClass(this.getElement('newFieldIsLocked'), 'locked'); | ||
537 | }, | ||
538 | |||
539 | 'setNewFieldIsHidden': function (aValue) { | ||
540 | MochiKit.DOM.setElementClass(this.getElement('newFieldIsLocked'), (aValue ? 'locked': 'unlocked')); | ||
541 | MochiKit.DOM.setElementClass(this.getElement('newFieldValueWrapper'), (aValue ? 'locked': 'unlocked')); | ||
542 | }, | ||
543 | |||
544 | 'toggleNewFieldIsHidden': function (anEvent) { | ||
545 | anEvent.preventDefault(); | ||
546 | |||
547 | this.setNewFieldIsHidden(! this.newFieldIsHidden()); | ||
548 | MochiKit.Signal.signal(this, 'changedValue'); | ||
549 | }, | ||
550 | |||
551 | //------------------------------------------------------------------------- | ||
552 | |||
553 | 'newFieldHasPendingChanges': function () { | ||
554 | return ((this.newFieldLabel() != '') || (this.newFieldValue() != '') || (this.newFieldIsHidden() == true)); | ||
555 | }, | ||
556 | |||
557 | 'resetNewFieldInputs': function () { | ||
558 | this.setNewFieldLabel(''); | ||
559 | this.setNewFieldValue(''); | ||
560 | this.setNewFieldIsHidden(false); | ||
561 | }, | ||
562 | |||
563 | //========================================================================= | ||
564 | |||
565 | 'handleKeyDownOnNewFieldValue': function (anEvent) { | ||
566 | MochiKit.Signal.signal(this, 'keyPressed', anEvent); | ||
567 | /* | ||
568 | if ((anEvent.key().string == 'KEY_TAB') && this.newFieldHasPendingChanges()) { | ||
569 | anEvent.preventDefault(); | ||
570 | |||
571 | MochiKit.Signal.signal(this, 'addField'); | ||
572 | this.getElement('newFieldLabel').focus(); | ||
573 | } | ||
574 | */ | ||
575 | }, | ||
576 | |||
577 | //------------------------------------------------------------------------- | ||
578 | |||
579 | 'handleAddClick': function (anEvent) { | ||
580 | anEvent.preventDefault(); | ||
581 | MochiKit.Signal.signal(this, 'addField'); | ||
582 | this.getElement('newFieldLabel').focus(); | ||
583 | }, | ||
584 | |||
585 | //========================================================================= | ||
586 | |||
587 | 'handleDeleteClick': function (aFieldKey, anEvent) { | ||
588 | anEvent.preventDefault(); | ||
589 | MochiKit.Signal.signal(this, 'deleteField', aFieldKey); | ||
590 | }, | ||
591 | |||
592 | //------------------------------------------------------------------------- | ||
593 | |||
594 | 'toggleLock': function (aFieldKey, anEvent) { | ||
595 | var shouldRedrawAsLocked; | ||
596 | var currentTRElement; | ||
597 | |||
598 | anEvent.preventDefault(); | ||
599 | |||
600 | currentTRElement = Clipperz.DOM.get(aFieldKey); | ||
601 | shouldRedrawAsLocked = (MochiKit.DOM.hasElementClass(currentTRElement, 'locked') ? false : true); | ||
602 | |||
603 | this.renderFieldTR(currentTRElement, { | ||
604 | label:MochiKit.Selector.findChildElements(currentTRElement, ['td.fieldLabel input'])[0].value, | ||
605 | value:MochiKit.Selector.findChildElements(currentTRElement, ['td.fieldValue input'])[0].value | ||
606 | }, shouldRedrawAsLocked, MochiKit.DOM.hasElementClass(currentTRElement, 'new')); | ||
607 | }, | ||
608 | |||
609 | //========================================================================= | ||
610 | |||
611 | 'fixNotesHeight': function () { | ||
612 | var element; | ||
613 | |||
614 | element = this.getElement('recordNote'); | ||
615 | |||
616 | if (element.scrollHeight == 0) { | ||
617 | MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, 'fixNotesHeight')); | ||
618 | } else { | ||
619 | var textareaHeight; | ||
620 | |||
621 | textareaHeight = Math.min(Math.max(50, element.scrollHeight), 500); | ||
622 | |||
623 | MochiKit.Style.setElementDimensions(element, {h:textareaHeight}, 'px'); | ||
624 | MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, 'fixRendering')); | ||
625 | } | ||
626 | }, | ||
627 | |||
628 | //------------------------------------------------------------------------- | ||
629 | |||
630 | 'fixRendering': function () { | ||
631 | // varheight; | ||
632 | var y; | ||
633 | varscrollHeight; | ||
634 | var viewportHeight; | ||
635 | var viewportY; | ||
636 | var footerElement; | ||
637 | var footerElementPosition; | ||
638 | var footerElementDimensions; | ||
639 | var footerComputedHeight; | ||
640 | |||
641 | // height = MochiKit.Style.getElementDimensions(this.displayElement())['h']; | ||
642 | y = MochiKit.Style.getElementPosition(this.displayElement())['y']; | ||
643 | |||
644 | footerElement = MochiKit.Selector.findChildElements(this.displayElement(), ['div.footer'])[0]; | ||
645 | footerElementPosition = MochiKit.Style.getElementPosition(footerElement); | ||
646 | footerElementDimensions = MochiKit.Style.getElementDimensions(footerElement); | ||
647 | footerComputedHeight = footerElementPosition['y'] + footerElementDimensions['h'] - y; | ||
648 | |||
649 | // scrollHeight = this.displayElement().scrollHeight; | ||
650 | scrollHeight = footerComputedHeight; | ||
651 | |||
652 | viewportHeight = MochiKit.Style.getViewportDimensions()['h']; | ||
653 | viewportY = MochiKit.Style.getViewportPosition()['y']; | ||
654 | |||
655 | if ((y + scrollHeight) > (viewportY + viewportHeight)) { | ||
656 | this.setDisplayMode('scrollable'); | ||
657 | MochiKit.DOM.addElementClass(this.element(), 'scrollable'); | ||
658 | MochiKit.DOM.removeElementClass(this.element(), 'fixed'); | ||
659 | MochiKit.Style.setElementPosition(this.displayElement(), {y:Math.max(0, Math.min(y, (viewportY + viewportHeight) - scrollHeight))}, 'px'); | ||
660 | MochiKit.Visual.ScrollTo(this.displayElement(), {duration:0.5}); | ||
661 | } else { | ||
662 | this.setDisplayMode('fixed'); | ||
663 | MochiKit.DOM.removeElementClass(this.element(), 'scrollable'); | ||
664 | MochiKit.DOM.addElementClass(this.element(), 'fixed'); | ||
665 | } | ||
666 | }, | ||
667 | |||
668 | //========================================================================= | ||
669 | |||
670 | 'unselectCurrentSelectedItems': function () { | ||
671 | MochiKit.Iter.forEach(MochiKit.Selector.findChildElements(this.displayElement(), ['.selectedField']), function (anElement) { | ||
672 | MochiKit.DOM.removeElementClass(anElement, 'selectedField'); | ||
673 | }); | ||
674 | }, | ||
675 | |||
676 | //========================================================================= | ||
677 | |||
678 | 'hideProgressMask': function () { | ||
679 | MochiKit.DOM.removeElementClass(this.getId('panel'), 'loading'); | ||
680 | }, | ||
681 | |||
682 | 'showProgressMask': function () { | ||
683 | this.getElement('progressDescription').innerHTML = "Saving"; | ||
684 | MochiKit.DOM.addElementClass(this.getId('panel'), 'loading'); | ||
685 | }, | ||
686 | |||
687 | 'showError': function (anError) { | ||
688 | //console.log(">>> showError", anError); | ||
689 | MochiKit.Style.hideElement(this.getId('progress')); | ||
690 | this.getElement('errorMessage').innerHTML = Clipperz.PM.Strings.errorDescriptionForException(anError['message']); | ||
691 | MochiKit.Style.showElement(this.getId('error')); | ||
692 | }, | ||
693 | |||
694 | //------------------------------------------------------------------------- | ||
695 | |||
696 | 'cancel': function () { | ||
697 | /* | ||
698 | var deferredResult; | ||
699 | |||
700 | deferredResult = new Clipperz.Async.Deferred("CardDialogComponent.cancel", {trace:false}); | ||
701 | deferredResult.addCallback(MochiKit.Base.method(this, 'isSavingEnabled')); | ||
702 | deferredResult.addIf([ | ||
703 | MochiKit.Base.method(this, 'askConfirmationForLoosingPendingChanges') | ||
704 | ], []); | ||
705 | deferredResult.addCallback(MochiKit.Base.partial(MochiKit.Signal.signal, this, 'cancel')); | ||
706 | deferredResult.callback(); | ||
707 | |||
708 | return deferredResult; | ||
709 | */ | ||
710 | MochiKit.Signal.signal(this, 'cancel'); | ||
711 | }, | ||
712 | |||
713 | 'handleCancelEvent': function (anEvent) { | ||
714 | anEvent.preventDefault(); | ||
715 | this.cancel(); | ||
716 | }, | ||
717 | |||
718 | //------------------------------------------------------------------------- | ||
719 | |||
720 | 'handleSaveEvent': function (anEvent) { | ||
721 | anEvent.preventDefault(); | ||
722 | |||
723 | if (! MochiKit.DOM.hasElementClass(anEvent.src(), 'disabled')) { | ||
724 | MochiKit.Signal.signal(this, 'save'); | ||
725 | } | ||
726 | }, | ||
727 | |||
728 | //------------------------------------------------------------------------- | ||
729 | |||
730 | 'handleAddDirectLogin': function (anEvent) { | ||
731 | anEvent.preventDefault(); | ||
732 | |||
733 | MochiKit.Signal.signal(this, 'addDirectLogin'); | ||
734 | }, | ||
735 | |||
736 | //------------------------------------------------------------------------- | ||
737 | |||
738 | 'handleOnFocusEvent': function (anElement, anEvent) { | ||
739 | this.unselectCurrentSelectedItems(); | ||
740 | MochiKit.DOM.addElementClass(anElement, 'selectedField'); | ||
741 | }, | ||
742 | |||
743 | 'handleLooseFocusEvent': function (anElement, anEvent) { | ||
744 | this.unselectCurrentSelectedItems(); | ||
745 | }, | ||
746 | |||
747 | //------------------------------------------------------------------------- | ||
748 | |||
749 | 'handleTabSelected': function (aSelectedTab) { | ||
750 | this.unselectCurrentSelectedItems(); | ||
751 | |||
752 | switch (aSelectedTab) { | ||
753 | case 'DETAILS': | ||
754 | // MochiKit.Style.hideElement(this.getElement('addDirectLoginButton')); | ||
755 | break; | ||
756 | case 'DIRECT_LOGINS': | ||
757 | // MochiKit.Style.showElement(this.getElement('addDirectLoginButton')); | ||
758 | break; | ||
759 | case 'SHARING': | ||
760 | // MochiKit.Style.hideElement(this.getElement('addDirectLoginButton')); | ||
761 | break; | ||
762 | } | ||
763 | }, | ||
764 | |||
765 | //------------------------------------------------------------------------- | ||
766 | |||
767 | 'handleKeyEvent': function (anEvent) { | ||
768 | //console.log("####", anEvent.key().string); | ||
769 | if (anEvent.key().string == 'KEY_ESCAPE') { | ||
770 | MochiKit.Signal.signal(this, 'changedValue'); | ||
771 | this.cancel(); | ||
772 | } else if (anEvent.key().string == 'KEY_ENTER') { | ||
773 | if (anEvent.target().nodeName == 'TEXTAREA') { | ||
774 | |||
775 | } else { | ||
776 | anEvent.preventDefault(); | ||
777 | } | ||
778 | } | ||
779 | }, | ||
780 | |||
781 | //========================================================================= | ||
782 | |||
783 | 'askConfirmationForLoosingPendingChanges': function () { | ||
784 | var deferredResult; | ||
785 | var confirmationDialog; | ||
786 | |||
787 | confirmationDialog = new Clipperz.PM.UI.Common.Components.SimpleMessagePanel({ | ||
788 | title:"Alert", | ||
789 | text:"Should lost pending changes?", | ||
790 | type:'ALERT', | ||
791 | buttons: [ | ||
792 | {text:"Cancel",result:'CANCEL', isDefault:true}, | ||
793 | {text:"Ok", result:'OK'} | ||
794 | ] | ||
795 | }); | ||
796 | |||
797 | deferredResult = new Clipperz.Async.Deferred("CardDialogComponent.askConfirmationForLoosingPendingChanges", {trace:false}); | ||
798 | // deferredResult = confirmationDialog.deferredShow({openFromElement:anEvent.src(), onOkCloseToElement:MochiKit.DOM.currentDocument().body, onCancelCloseToElement:anEvent.src()}); | ||
799 | deferredResult.addMethod(confirmationDialog, 'deferredShow', { | ||
800 | 'openFromElement': this.getElement('cancelButton'), | ||
801 | 'onOkCloseToElement': null, //this.getElement('cancelButton'), | ||
802 | 'onCancelCloseToElement':this.getElement('cancelButton') | ||
803 | }); | ||
804 | // deferredResult.addCallback(function () { console.log("DELETE: " + anObject.toString(), anObject); }); | ||
805 | // deferredResult.addErrbackPass(function () { console.log("skip deletion: " + anObject.toString(), anObject); }); | ||
806 | deferredResult.callback(); | ||
807 | |||
808 | return deferredResult; | ||
809 | }, | ||
810 | |||
811 | //========================================================================= | ||
812 | |||
813 | 'showDirectLoginEditingComponent': function () { | ||
814 | varwidth; | ||
815 | var transition; | ||
816 | var duration; | ||
817 | |||
818 | width = MochiKit.Style.getElementDimensions(this.getElement('directLoginsComponentContainer'))['w']; | ||
819 | transition = MochiKit.Visual.Transitions.sinoidal; | ||
820 | duration = 1; | ||
821 | |||
822 | return Clipperz.Async.callbacks("CardDialogComponent.showDirectLoginEditingComponent", [ | ||
823 | MochiKit.Base.method(this, 'disableCardTitleEditing'), | ||
824 | MochiKit.Base.method(this.tabPanelController(), 'disable'), | ||
825 | |||
826 | MochiKit.Base.bind(function () { | ||
827 | MochiKit.Style.setElementPosition (this.getElement('directLoginEditDetail'), {x:width, y:-MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}); | ||
828 | MochiKit.Style.setElementDimensions(this.getElement('directLoginEditDetail'), {w:width}); | ||
829 | MochiKit.Style.showElement(this.getElement('directLoginEditDetail')); | ||
830 | MochiKit.Style.setOpacity(this.getElement('directLoginEditDetail'), 0); | ||
831 | MochiKit.Style.setElementDimensions(this.getElement('directLoginsComponentContainer'), { | ||
832 | h:Math.max( | ||
833 | MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h'], | ||
834 | MochiKit.Style.getElementDimensions(this.getElement('directLoginEditDetail'))['h'] | ||
835 | ) | ||
836 | }); | ||
837 | // MochiKit.Style.setElementDimensions(this.getElement('directLoginsComponentContainer'), {h:MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}); | ||
838 | }, this), | ||
839 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimations,MochiKit.Visual.Parallel, [ | ||
840 | new MochiKit.Visual.Move(this.getElement('directLogins'), {x:-width, y:0, mode:'relative', transition:transition, sync:true}), | ||
841 | new MochiKit.Visual.Opacity(this.getElement('directLogins'), {from:1.0, to:0.0, transition:transition, sync:true}), | ||
842 | new MochiKit.Visual.Move(this.getElement('directLoginEditDetail'), {x:-width, y:0, mode:'relative', transition:transition, sync:true}), | ||
843 | new MochiKit.Visual.Opacity(this.getElement('directLoginEditDetail'),{from:0.0, to:1.0, transition:transition, sync:true}) | ||
844 | ], {duration:duration}), | ||
845 | |||
846 | MochiKit.Base.noop | ||
847 | ], {trace:false}); | ||
848 | }, | ||
849 | |||
850 | //------------------------------------------------------------------------- | ||
851 | |||
852 | 'hideDirectLoginEditingComponent': function () { | ||
853 | varwidth; | ||
854 | var transition; | ||
855 | var duration; | ||
856 | |||
857 | width = MochiKit.Style.getElementDimensions(this.getElement('directLoginsComponentContainer'))['w']; | ||
858 | transition = MochiKit.Visual.Transitions.sinoidal; | ||
859 | duration = 1; | ||
860 | |||
861 | return Clipperz.Async.callbacks("CardDialogComponent.hideDirectLoginEditingComponent", [ | ||
862 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimations,MochiKit.Visual.Parallel, [ | ||
863 | new MochiKit.Visual.Move(this.getElement('directLogins'), {x:width, y:0, mode:'relative', transition:transition, sync:true}), | ||
864 | new MochiKit.Visual.Opacity(this.getElement('directLogins'), {from:0.0, to:1.0, transition:transition, sync:true}), | ||
865 | new MochiKit.Visual.Move(this.getElement('directLoginEditDetail'), {x:width, y:0, mode:'relative', transition:transition, sync:true}), | ||
866 | new MochiKit.Visual.Opacity(this.getElement('directLoginEditDetail'),{from:1.0, to:0.0, transition:transition, sync:true}) | ||
867 | ], {duration:duration}), | ||
868 | // MochiKit.Base.partial(MochiKit.Visual.appear, this.getElement('addDirectLoginButton'), {duration:0.3}), | ||
869 | Clipperz.Async.clearResult, | ||
870 | MochiKit.Base.partial(MochiKit.Style.hideElement, this.getElement('directLoginEditDetail')), | ||
871 | // MochiKit.Base.partial(MochiKit.Style.showElement, this.getElement('directLogins')), | ||
872 | MochiKit.Base.partial(MochiKit.Style.setElementDimensions, this.getElement('directLoginsComponentContainer'), {h:MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}), | ||
873 | |||
874 | MochiKit.Base.method(this, 'enableCardTitleEditing'), | ||
875 | MochiKit.Base.method(this.tabPanelController(), 'enable') | ||
876 | ], {trace:false}); | ||
877 | }, | ||
878 | |||
879 | //========================================================================= | ||
880 | __syntaxFix__: "syntax fix" | ||
881 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordDirectLoginComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordDirectLoginComponent.js new file mode 100644 index 0000000..126c5b1 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordDirectLoginComponent.js | |||
@@ -0,0 +1,182 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginComponent = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginComponent.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._reference = args.reference|| Clipperz.Base.exception.raise('MandatoryParameter'); | ||
37 | this._faviconComponent = null; | ||
38 | |||
39 | return this; | ||
40 | } | ||
41 | |||
42 | //============================================================================= | ||
43 | |||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
45 | |||
46 | //------------------------------------------------------------------------- | ||
47 | |||
48 | 'toString': function () { | ||
49 | return "Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginComponent component"; | ||
50 | }, | ||
51 | |||
52 | //------------------------------------------------------------------------- | ||
53 | |||
54 | 'reference': function () { | ||
55 | return this._reference; | ||
56 | }, | ||
57 | |||
58 | //------------------------------------------------------------------------- | ||
59 | |||
60 | 'renderSelf': function() { | ||
61 | //console.log(">>> CardDialogRecordDirectLoginComponent.renderSelf"); | ||
62 | this.append(this.element(), [ | ||
63 | {tag:'div', cls:'cardDialogRecordDirectLoginComponent_favicon', children:[ | ||
64 | {tag:'img', cls:'favicon', id:this.getId('favicon')} | ||
65 | ]}, | ||
66 | {tag:'div', cls:'cardDialogRecordDirectLoginComponent_label', children:[ | ||
67 | {tag:'input', id:this.getId('label'), type:'text'} | ||
68 | ]}, | ||
69 | {tag:'div', cls:'open', children:[ | ||
70 | {tag:'span', children:[ | ||
71 | {tag:'a', href:'open', id:this.getId('open'), html:' '} | ||
72 | ]} | ||
73 | ]}, | ||
74 | {tag:'div', cls:'edit', children:[ | ||
75 | {tag:'span', children:[ | ||
76 | {tag:'a', href:'edit', id:this.getId('edit'), html:"edit"} | ||
77 | ]} | ||
78 | ]}, | ||
79 | {tag:'div', cls:'delete', children:[ | ||
80 | {tag:'span', children:[ | ||
81 | {tag:'a', href:'delete', id:this.getId('delete'), html:"delete"} | ||
82 | ]} | ||
83 | ]} | ||
84 | /* | ||
85 | {tag:'td', cls:'fieldState'}, | ||
86 | {tag:'td', cls:'fieldLabel', children:[ | ||
87 | {tag:'input', cls:'label', id:this.getId('label')} | ||
88 | ]}, | ||
89 | {tag:'td', cls:'fieldLock', children:[ | ||
90 | {tag:'div', cls:'unlocked', id:this.getId('isHidden')} | ||
91 | ]}, | ||
92 | {tag:'td', cls:'fieldValue', children:[ | ||
93 | {tag:'div', cls:'unlocked', id:this.getId('valueWrapper'), children:[ | ||
94 | {tag:'input', type:'text', cls:'value', id:this.getId('value')} | ||
95 | ]} | ||
96 | ]}, | ||
97 | {tag:'td', cls:'fieldAddDelete', children:[ | ||
98 | {tag:'div', cls:'delete', children:[ | ||
99 | {tag:'span', children:[ | ||
100 | {tag:'a', href:'#', id:this.getId('delete'), html:"delete"} | ||
101 | ]} | ||
102 | ]} | ||
103 | ]} | ||
104 | */ | ||
105 | ]); | ||
106 | |||
107 | MochiKit.Signal.connect(this.getId('label'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | ||
108 | MochiKit.Signal.connect(this.getId('open'), 'onclick',this, 'openDirectLogin'); | ||
109 | MochiKit.Signal.connect(this.getId('edit'), 'onclick',this, 'editDirectLogin'); | ||
110 | MochiKit.Signal.connect(this.getId('delete'), 'onclick',this, 'deleteDirectLogin'); | ||
111 | }, | ||
112 | |||
113 | //------------------------------------------------------------------------- | ||
114 | |||
115 | 'shouldShowElementWhileRendering': function () { | ||
116 | return false; | ||
117 | }, | ||
118 | |||
119 | //------------------------------------------------------------------------- | ||
120 | |||
121 | 'faviconComponent': function () { | ||
122 | if (this._faviconComponent == null) { | ||
123 | //console.log("created the FAVICON component"); | ||
124 | this._faviconComponent = new Clipperz.PM.UI.Common.Components.FaviconComponent({element:this.getId('favicon')}); | ||
125 | } | ||
126 | |||
127 | return this._faviconComponent; | ||
128 | }, | ||
129 | |||
130 | //========================================================================= | ||
131 | |||
132 | 'label': function () { | ||
133 | return this.getElement('label').value; | ||
134 | }, | ||
135 | |||
136 | 'setLabel': function (aValue) { | ||
137 | this.getElement('label').value = Clipperz.Base.sanitizeString(aValue); | ||
138 | }, | ||
139 | |||
140 | //------------------------------------------------------------------------- | ||
141 | |||
142 | 'favicon': function () { | ||
143 | // return this.getElement('favicon').src; | ||
144 | return this.faviconComponent().src(); | ||
145 | }, | ||
146 | |||
147 | 'setFavicon': function (aValue) { | ||
148 | // this.getElement('favicon').src = Clipperz.Base.sanitizeString(aValue); | ||
149 | this.faviconComponent().setSrc(Clipperz.Base.sanitizeString(aValue)); | ||
150 | }, | ||
151 | |||
152 | //========================================================================= | ||
153 | |||
154 | 'openDirectLogin': function (anEvent) { | ||
155 | anEvent.preventDefault(); | ||
156 | |||
157 | MochiKit.Signal.signal(this, 'openDirectLogin', this.reference()); | ||
158 | }, | ||
159 | |||
160 | //------------------------------------------------------------------------- | ||
161 | |||
162 | 'editDirectLogin': function (anEvent) { | ||
163 | anEvent.preventDefault(); | ||
164 | |||
165 | MochiKit.Signal.signal(this, 'editDirectLogin', this.reference()); | ||
166 | //console.log("EDIT DIRECT LOGIN"); | ||
167 | }, | ||
168 | |||
169 | //------------------------------------------------------------------------- | ||
170 | |||
171 | 'deleteDirectLogin': function (anEvent) { | ||
172 | anEvent.preventDefault(); | ||
173 | |||
174 | MochiKit.Signal.signal(this, 'deleteDirectLogin', this.reference()); | ||
175 | //console.log("DELETE DIRECT LOGIN"); | ||
176 | }, | ||
177 | |||
178 | |||
179 | |||
180 | //========================================================================= | ||
181 | __syntaxFix__: "syntax fix" | ||
182 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js new file mode 100644 index 0000000..c1a7c13 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js | |||
@@ -0,0 +1,190 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._reference = args.reference|| Clipperz.Base.exception.raise('MandatoryParameter'); | ||
37 | this._actionType = null; | ||
38 | |||
39 | return this; | ||
40 | } | ||
41 | |||
42 | //============================================================================= | ||
43 | |||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
45 | |||
46 | //------------------------------------------------------------------------- | ||
47 | |||
48 | 'toString': function () { | ||
49 | return "Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent component"; | ||
50 | }, | ||
51 | |||
52 | //------------------------------------------------------------------------- | ||
53 | |||
54 | 'renderSelf': function() { | ||
55 | this.append(this.element(), [ | ||
56 | {tag:'td', cls:'fieldState'}, | ||
57 | {tag:'td', cls:'fieldLabel', children:[ | ||
58 | {tag:'input', cls:'label', id:this.getId('label')} | ||
59 | ]}, | ||
60 | {tag:'td', cls:'fieldLock', children:[ | ||
61 | {tag:'div', cls:'unlocked', id:this.getId('isHidden')} | ||
62 | ]}, | ||
63 | {tag:'td', cls:'fieldValue', children:[ | ||
64 | {tag:'div', cls:'unlocked', id:this.getId('valueWrapper'), children:[ | ||
65 | {tag:'input', type:'text', cls:'value', id:this.getId('value')} | ||
66 | ]} | ||
67 | ]}, | ||
68 | {tag:'td', cls:'fieldAction', children:[ | ||
69 | {tag:'a', href:'#', id:this.getId('actionLink'), html:' '} | ||
70 | ]}, | ||
71 | {tag:'td', cls:'fieldAddDelete', children:[ | ||
72 | {tag:'div', cls:'delete', children:[ | ||
73 | {tag:'span', children:[ | ||
74 | {tag:'a', href:'#', id:this.getId('delete'), html:"delete"} | ||
75 | ]} | ||
76 | ]} | ||
77 | ]} | ||
78 | ]); | ||
79 | |||
80 | MochiKit.Signal.connect(this.getId('label'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | ||
81 | MochiKit.Signal.connect(this.getId('isHidden'), 'onclick',this, 'toggleIsHidden'); | ||
82 | MochiKit.Signal.connect(this.getId('value'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | ||
83 | MochiKit.Signal.connect(this.getId('actionLink'), 'onclick',this, 'handleActionLink'); | ||
84 | MochiKit.Signal.connect(this.getId('delete'), 'onclick',this, 'deleteField'); | ||
85 | // MochiKit.Signal.connect(this.getId('delete'), 'onclick',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'deleteField', this.reference())); | ||
86 | }, | ||
87 | |||
88 | //------------------------------------------------------------------------- | ||
89 | |||
90 | 'shouldShowElementWhileRendering': function () { | ||
91 | return false; | ||
92 | }, | ||
93 | |||
94 | //========================================================================= | ||
95 | |||
96 | 'reference': function () { | ||
97 | return this._reference; | ||
98 | }, | ||
99 | |||
100 | //========================================================================= | ||
101 | |||
102 | 'label': function () { | ||
103 | return this.getElement('label').value; | ||
104 | }, | ||
105 | |||
106 | 'setLabel': function (aValue) { | ||
107 | // this.getElement('label').value = Clipperz.Base.sanitizeString(aValue); | ||
108 | this.getElement('label').value = aValue; | ||
109 | }, | ||
110 | |||
111 | //========================================================================= | ||
112 | |||
113 | 'value': function () { | ||
114 | return this.getElement('value').value; | ||
115 | }, | ||
116 | |||
117 | 'setValue': function (aValue) { | ||
118 | // this.getElement('value').value = Clipperz.Base.sanitizeString(aValue); | ||
119 | this.getElement('value').value = aValue; | ||
120 | }, | ||
121 | |||
122 | //------------------------------------------------------------------------- | ||
123 | |||
124 | 'actionType': function () { | ||
125 | return this._actionType; | ||
126 | }, | ||
127 | |||
128 | 'setActionType': function (anActionType) { | ||
129 | this._actionType = anActionType; | ||
130 | |||
131 | switch (this._actionType) { | ||
132 | case 'NONE': | ||
133 | MochiKit.Style.hideElement(this.getId('actionLink')); | ||
134 | MochiKit.DOM.setElementClass(this.getId('actionLink'), ''); | ||
135 | break; | ||
136 | case 'URL': | ||
137 | MochiKit.Style.showElement(this.getId('actionLink')); | ||
138 | MochiKit.DOM.setElementClass(this.getId('actionLink'), 'url'); | ||
139 | break; | ||
140 | case 'EMAIL': | ||
141 | MochiKit.Style.showElement(this.getId('actionLink')); | ||
142 | MochiKit.DOM.setElementClass(this.getId('actionLink'), 'email'); | ||
143 | break; | ||
144 | case 'PASSWORD': | ||
145 | MochiKit.Style.showElement(this.getId('actionLink')); | ||
146 | MochiKit.DOM.setElementClass(this.getId('actionLink'), 'password'); | ||
147 | break; | ||
148 | } | ||
149 | }, | ||
150 | |||
151 | //========================================================================= | ||
152 | |||
153 | 'isHidden': function () { | ||
154 | // return this.getElement('value').value; | ||
155 | return MochiKit.DOM.hasElementClass(this.getElement('isHidden'), 'locked'); | ||
156 | }, | ||
157 | |||
158 | 'setIsHidden': function (aValue) { | ||
159 | // this.getElement('value').value = Clipperz.Base.sanitizeString(aValue); | ||
160 | MochiKit.DOM.setElementClass(this.getElement('isHidden'), (aValue ? 'locked': 'unlocked')); | ||
161 | MochiKit.DOM.setElementClass(this.getElement('valueWrapper'), (aValue ? 'locked': 'unlocked')); | ||
162 | }, | ||
163 | |||
164 | 'toggleIsHidden': function (anEvent) { | ||
165 | anEvent.preventDefault(); | ||
166 | |||
167 | this.setIsHidden(! this.isHidden()); | ||
168 | MochiKit.Signal.signal(this, 'changedValue'); | ||
169 | }, | ||
170 | |||
171 | //========================================================================= | ||
172 | |||
173 | 'handleActionLink': function (anEvent) { | ||
174 | anEvent.preventDefault(); | ||
175 | |||
176 | //console.log("ACTION LINK - " + this.actionType()); | ||
177 | MochiKit.Signal.signal(this, 'performAction', this.reference(), anEvent.target()); | ||
178 | }, | ||
179 | |||
180 | //========================================================================= | ||
181 | |||
182 | 'deleteField': function (anEvent) { | ||
183 | anEvent.preventDefault(); | ||
184 | |||
185 | MochiKit.Signal.signal(this, 'deleteField', this.reference()); | ||
186 | }, | ||
187 | |||
188 | //========================================================================= | ||
189 | __syntaxFix__: "syntax fix" | ||
190 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js new file mode 100644 index 0000000..bfc7e61 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js | |||
@@ -0,0 +1,203 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | //############################################################################# | ||
32 | |||
33 | Clipperz.PM.UI.Web.Components.ColumnManager = function(args) { | ||
34 | args = args || {}; | ||
35 | Clipperz.PM.UI.Web.Components.ColumnManager.superclass.constructor.call(this, args); | ||
36 | |||
37 | this._name = args.name || Clipperz.Base.exception.raise('MandatoryParameter'); | ||
38 | this._selector = args.selector|| Clipperz.Base.exception.raise('MandatoryParameter');; | ||
39 | this._label = args.label || null; | ||
40 | this._isSortable = args.sortable|| false; | ||
41 | this._comparator = args.comparator|| null; | ||
42 | this._sorted = args.sorted || 'UNSORTED'; //'ASCENDING' | 'DESCENDING' | 'UNSORTED' | ||
43 | this._cssClass = args.cssClass|| ''; | ||
44 | |||
45 | this._signalIdentifiers = []; | ||
46 | |||
47 | return this; | ||
48 | } | ||
49 | |||
50 | //============================================================================= | ||
51 | |||
52 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.ColumnManager, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
53 | |||
54 | 'toString': function () { | ||
55 | return "Clipperz.PM.UI.Web.Components.ColumnManager - " + this._name; | ||
56 | }, | ||
57 | |||
58 | 'name': function () { | ||
59 | return this._name; | ||
60 | }, | ||
61 | |||
62 | 'label': function () { | ||
63 | return this._label; | ||
64 | }, | ||
65 | |||
66 | 'selector': function () { | ||
67 | return this._selector; | ||
68 | }, | ||
69 | |||
70 | 'comparator': function() { | ||
71 | return this._comparator; | ||
72 | }, | ||
73 | |||
74 | 'cssClass': function() { | ||
75 | return this._cssClass; | ||
76 | }, | ||
77 | |||
78 | //------------------------------------------------------------------------- | ||
79 | |||
80 | 'isSortable': function () { | ||
81 | return this._isSortable; | ||
82 | }, | ||
83 | |||
84 | //------------------------------------------------------------------------- | ||
85 | |||
86 | 'sorted': function () { | ||
87 | return this._sorted; | ||
88 | }, | ||
89 | |||
90 | 'isSorted': function () { | ||
91 | return (this.sorted() != 'UNSORTED'); | ||
92 | }, | ||
93 | |||
94 | 'setSorted': function(aValue) { | ||
95 | this._sorted = aValue; | ||
96 | this.updateSortIcon(); | ||
97 | }, | ||
98 | |||
99 | //------------------------------------------------------------------------- | ||
100 | |||
101 | 'signalIdentifiers': function () { | ||
102 | return this._signalIdentifiers; | ||
103 | }, | ||
104 | |||
105 | 'resetSignalIdentifiers': function () { | ||
106 | this._signalIdentifiers = []; | ||
107 | }, | ||
108 | |||
109 | //------------------------------------------------------------------------- | ||
110 | |||
111 | 'disconnectRowsSignals': function () { | ||
112 | MochiKit.Base.map(MochiKit.Signal.disconnect, this.signalIdentifiers()); | ||
113 | this.resetSignalIdentifiers(); | ||
114 | }, | ||
115 | |||
116 | 'connectEvent': function () { | ||
117 | var ident; | ||
118 | |||
119 | ident = MochiKit.Signal.connect.apply(null, arguments); | ||
120 | this.signalIdentifiers().push(ident); | ||
121 | }, | ||
122 | |||
123 | //------------------------------------------------------------------------- | ||
124 | |||
125 | 'renderHeader': function(aTRElement) { | ||
126 | varthElement; | ||
127 | |||
128 | thElement = Clipperz.DOM.Helper.append(aTRElement, {tag:'th', cls:(this.cssClass() + 'TH'), id:this.getId('sortLink'), children:[ | ||
129 | {tag:'span', html:this.label() ? this.label() : ' '} | ||
130 | ]}); | ||
131 | |||
132 | if (this.isSortable()) { | ||
133 | Clipperz.DOM.Helper.append(thElement, {tag:'span', cls:'sortable', children:[ | ||
134 | {tag:'a', href:'#'/*, id:this.getId('sortLink')*/, html:' '} | ||
135 | ]}); | ||
136 | |||
137 | MochiKit.DOM.addElementClass(thElement, 'sortable'); | ||
138 | MochiKit.Signal.connect(thElement, 'onclick', this, 'handleClickOnSortingCriteria'); | ||
139 | }; | ||
140 | |||
141 | this.updateSortIcon(); | ||
142 | }, | ||
143 | |||
144 | //------------------------------------------------------------------------- | ||
145 | |||
146 | 'toggleSorting': function () { | ||
147 | var result; | ||
148 | switch (this.sorted()) { | ||
149 | case 'UNSORTED': | ||
150 | result = 'ASCENDING'; | ||
151 | break; | ||
152 | case 'ASCENDING': | ||
153 | result = 'DESCENDING'; | ||
154 | break; | ||
155 | case 'DESCENDING': | ||
156 | result = 'ASCENDING'; | ||
157 | break; | ||
158 | default: | ||
159 | result = 'UNSORTED'; | ||
160 | break; | ||
161 | } | ||
162 | |||
163 | this.setSorted(result); | ||
164 | |||
165 | return result; | ||
166 | }, | ||
167 | |||
168 | //------------------------------------------------------------------------- | ||
169 | |||
170 | 'sortElementClass': function () { | ||
171 | return this.sorted().toLowerCase(); | ||
172 | }, | ||
173 | |||
174 | //------------------------------------------------------------------------- | ||
175 | |||
176 | 'updateSortIcon': function () { | ||
177 | if (this.isSortable()) { | ||
178 | MochiKit.DOM.removeElementClass(this.getId('sortLink'), 'ascending'); | ||
179 | MochiKit.DOM.removeElementClass(this.getId('sortLink'), 'descending'); | ||
180 | MochiKit.DOM.removeElementClass(this.getId('sortLink'), 'unsorted'); | ||
181 | |||
182 | MochiKit.DOM.addElementClass(this.getId('sortLink'), this.sortElementClass()); | ||
183 | } | ||
184 | }, | ||
185 | |||
186 | //------------------------------------------------------------------------- | ||
187 | |||
188 | 'renderCell': function(aRowElement, anObject) { | ||
189 | Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[{tag:'span', html:anObject[this.name()]}]}); | ||
190 | }, | ||
191 | |||
192 | //----------------------------------------------------- | ||
193 | |||
194 | 'handleClickOnSortingCriteria': function (anEvent) { | ||
195 | anEvent.preventDefault(); | ||
196 | MochiKit.Signal.signal(this, 'sort', this); | ||
197 | }, | ||
198 | |||
199 | //----------------------------------------------------- | ||
200 | '__syntax_fix__' : 'syntax fix' | ||
201 | |||
202 | }); | ||
203 | |||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CreateNewCardSplashComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CreateNewCardSplashComponent.js new file mode 100644 index 0000000..61d6ead --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CreateNewCardSplashComponent.js | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | return this; | ||
37 | } | ||
38 | |||
39 | //============================================================================= | ||
40 | |||
41 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
42 | |||
43 | //------------------------------------------------------------------------- | ||
44 | |||
45 | 'toString': function () { | ||
46 | return "Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent component"; | ||
47 | }, | ||
48 | |||
49 | //------------------------------------------------------------------------- | ||
50 | |||
51 | 'renderSelf': function() { | ||
52 | this.append(this.element(), [ | ||
53 | {tag:'div', cls:'createNewCardSplash', id:this.getId('button'), children:[ | ||
54 | {tag:'span', html:"Create New Card"} | ||
55 | ]} | ||
56 | ]); | ||
57 | |||
58 | MochiKit.Signal.connect(this.getElement('button'), 'onclick', this, 'handleClick'); | ||
59 | }, | ||
60 | |||
61 | //------------------------------------------------------------------------- | ||
62 | |||
63 | 'handleClick': function (anEvent) { | ||
64 | anEvent.preventDefault(); | ||
65 | MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'addCard', this.element()); | ||
66 | }, | ||
67 | |||
68 | //------------------------------------------------------------------------- | ||
69 | |||
70 | __syntaxFix__: "syntax fix" | ||
71 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js new file mode 100644 index 0000000..91d99e3 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js | |||
@@ -0,0 +1,111 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.DataPanel = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.DataPanel.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._initiallySelectedTab = args.selected || 'OFFLINE_COPY'; | ||
37 | this._tabPanelControllerConfiguration = { | ||
38 | 'OFFLINE_COPY': { | ||
39 | tab:'offlineCopyTab', | ||
40 | panel:'offlineCopyPanel' | ||
41 | }, | ||
42 | 'SHARING': { | ||
43 | tab:'sharingTab', | ||
44 | panel:'sharingPanel' | ||
45 | }, | ||
46 | 'IMPORT': { | ||
47 | tab:'importTab', | ||
48 | panel:'importPanel' | ||
49 | }, | ||
50 | 'EXPORT': { | ||
51 | tab:'exportTab', | ||
52 | panel:'exportPanel' | ||
53 | } | ||
54 | }; | ||
55 | |||
56 | return this; | ||
57 | } | ||
58 | |||
59 | //============================================================================= | ||
60 | |||
61 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DataPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, { | ||
62 | |||
63 | //------------------------------------------------------------------------- | ||
64 | |||
65 | 'toString': function () { | ||
66 | return "Clipperz.PM.UI.Web.Components.DataPanel component"; | ||
67 | }, | ||
68 | |||
69 | //------------------------------------------------------------------------- | ||
70 | |||
71 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
72 | this.append(this.element(), [ | ||
73 | {tag:'div', cls:'header', children:[ | ||
74 | {tag:'div', cls:'subPanelTabs', children:[ | ||
75 | {tag:'ul', children:[ | ||
76 | {tag:'li', id:this.getId('offlineCopyTab'),children:[{tag:'a', href:'#', html:'Offline copy'}], cls:'first'}, | ||
77 | {tag:'li', id:this.getId('sharingTab'), children:[{tag:'a', href:'#', html:'Sharing'}]}, | ||
78 | {tag:'li', id:this.getId('importTab'), children:[{tag:'a', href:'#', html:'Import'}]}, | ||
79 | {tag:'li', id:this.getId('exportTab'), children:[{tag:'a', href:'#', html:'Export'}]} | ||
80 | ]} | ||
81 | ]} | ||
82 | ]}, | ||
83 | {tag:'div', cls:'body', children:[ | ||
84 | {tag:'div', cls:'accountPanel', children:[ | ||
85 | {tag:'div', cls:'subPanelContent', children:[ | ||
86 | {tag:'ul', children:[ | ||
87 | {tag:'li', id:this.getId('offlineCopyPanel'),children:[ | ||
88 | {tag:'h3', html:"Offline copy"} | ||
89 | ]}, | ||
90 | {tag:'li', id:this.getId('sharingPanel'),children:[ | ||
91 | {tag:'h3', html:"Sharing"} | ||
92 | ]}, | ||
93 | {tag:'li', id:this.getId('importPanel'), children:[ | ||
94 | {tag:'h3', html:"Import"} | ||
95 | ]}, | ||
96 | {tag:'li', id:this.getId('exportPanel'), children:[ | ||
97 | {tag:'h3', html:"Export"} | ||
98 | ]} | ||
99 | ]} | ||
100 | ]} | ||
101 | ]} | ||
102 | ]}, | ||
103 | {tag:'div', cls:'footer'} | ||
104 | ]); | ||
105 | |||
106 | this.tabPanelController().setup({selected:this.initiallySelectedTab()}); | ||
107 | }, | ||
108 | |||
109 | //------------------------------------------------------------------------- | ||
110 | __syntaxFix__: "syntax fix" | ||
111 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DateColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DateColumnManager.js new file mode 100644 index 0000000..3f8aa88 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DateColumnManager.js | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | //############################################################################# | ||
32 | |||
33 | Clipperz.PM.UI.Web.Components.DateColumnManager = function(args) { | ||
34 | args = args || {}; | ||
35 | Clipperz.PM.UI.Web.Components.DateColumnManager.superclass.constructor.call(this, args); | ||
36 | |||
37 | this._format = args.format|| Clipperz.Base.exception.raise('MandatoryParameter'); | ||
38 | |||
39 | return this; | ||
40 | } | ||
41 | |||
42 | //============================================================================= | ||
43 | |||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DateColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { | ||
45 | |||
46 | 'toString': function () { | ||
47 | return "Clipperz.PM.UI.Web.Components.DateColumnManager component"; | ||
48 | }, | ||
49 | |||
50 | //------------------------------------------------------------------------- | ||
51 | |||
52 | 'format': function () { | ||
53 | return this._format; | ||
54 | }, | ||
55 | |||
56 | //------------------------------------------------------------------------- | ||
57 | |||
58 | 'renderCell': function(aRowElement, anObject) { | ||
59 | Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ | ||
60 | { | ||
61 | tag:'span', | ||
62 | title:Clipperz.PM.Date.formatDateWithTemplate(anObject[this.name()], "D, d M Y H:i:s"), | ||
63 | html:Clipperz.PM.Date.formatDateWithTemplate(anObject[this.name()], this.format()) | ||
64 | } | ||
65 | ]}); | ||
66 | }, | ||
67 | |||
68 | //----------------------------------------------------- | ||
69 | |||
70 | '__syntax_fix__' : 'syntax fix' | ||
71 | }); | ||
72 | |||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DeleteObjectColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DeleteObjectColumnManager.js new file mode 100644 index 0000000..ee60f2f --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DeleteObjectColumnManager.js | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | //############################################################################# | ||
32 | |||
33 | Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager = function(args) { | ||
34 | args = args || {}; | ||
35 | Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager.superclass.constructor.call(this, args); | ||
36 | |||
37 | return this; | ||
38 | } | ||
39 | |||
40 | //============================================================================= | ||
41 | |||
42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager, Clipperz.PM.UI.Web.Components.LinkColumnManager, { | ||
43 | |||
44 | 'toString': function () { | ||
45 | return "Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager component"; | ||
46 | }, | ||
47 | |||
48 | //------------------------------------------------------------------------- | ||
49 | |||
50 | 'renderCell': function(aRowElement, anObject) { | ||
51 | var tdElement; | ||
52 | var linkElement; | ||
53 | |||
54 | tdElement = Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ | ||
55 | {tag:'div', cls:'delete', children:[ | ||
56 | {tag:'span', children:[ | ||
57 | {tag:'a', href:'delete', html:"delete"} | ||
58 | ]} | ||
59 | ]} | ||
60 | ]}); | ||
61 | |||
62 | linkElement = MochiKit.DOM.getFirstElementByTagAndClassName('a', null, tdElement); | ||
63 | // MochiKit.Signal.connect(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); | ||
64 | this.connectEvent(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); | ||
65 | }, | ||
66 | |||
67 | //----------------------------------------------------- | ||
68 | '__syntax_fix__' : 'syntax fix' | ||
69 | }); | ||
70 | |||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginColumnManager.js new file mode 100644 index 0000000..4bf9020 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginColumnManager.js | |||
@@ -0,0 +1,90 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | /* | ||
30 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
31 | |||
32 | //############################################################################# | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.DirectLoginColumnManager = function(args) { | ||
35 | args = args || {}; | ||
36 | Clipperz.PM.UI.Web.Components.DirectLoginColumnManager.superclass.constructor.call(this, args); | ||
37 | |||
38 | this._actionMethod = args.actionMethod || null; | ||
39 | |||
40 | return this; | ||
41 | } | ||
42 | |||
43 | //============================================================================= | ||
44 | |||
45 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { | ||
46 | |||
47 | 'toString': function () { | ||
48 | return "Clipperz.PM.UI.Web.Components.DateColumnManager component"; | ||
49 | }, | ||
50 | |||
51 | //------------------------------------------------------------------------- | ||
52 | |||
53 | 'actionMethod': function () { | ||
54 | return this._actionMethod; | ||
55 | }, | ||
56 | |||
57 | //------------------------------------------------------------------------- | ||
58 | |||
59 | 'renderCell': function(aRowElement, anObject) { | ||
60 | vartdElement; | ||
61 | varlinkElement; | ||
62 | |||
63 | tdElement = Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ | ||
64 | {tag:'div', cls:'directLogin_directLogin', children:[ | ||
65 | {tag:'div', cls:'directLogin_directLogin_body', children:[ | ||
66 | {tag:'a', href:'#', html:anObject[this.name()]} | ||
67 | ]} | ||
68 | ]} | ||
69 | ]}); | ||
70 | |||
71 | linkElement = MochiKit.DOM.getFirstElementByTagAndClassName('a', null, tdElement); | ||
72 | // MochiKit.Signal.connect(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); | ||
73 | this.connectEvent(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); | ||
74 | }, | ||
75 | |||
76 | //----------------------------------------------------- | ||
77 | |||
78 | 'handleLinkClick': function (anObject, anEvent) { | ||
79 | anEvent.preventDefault(); | ||
80 | |||
81 | if (this.actionMethod() != null) { | ||
82 | this.actionMethod()(anObject, anEvent); | ||
83 | } | ||
84 | }, | ||
85 | |||
86 | //----------------------------------------------------- | ||
87 | '__syntax_fix__' : 'syntax fix' | ||
88 | }); | ||
89 | |||
90 | */ \ No newline at end of file | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingBindingComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingBindingComponent.js new file mode 100644 index 0000000..9a9c0b2 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingBindingComponent.js | |||
@@ -0,0 +1,168 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._formFieldName = args.formFieldName|| Clipperz.Base.exception.raise('MandatoryParameter'); | ||
37 | this._fields = args.fields || Clipperz.Base.exception.raise('MandatoryParameter'); | ||
38 | this._initiallySelectedFieldKey = args.selectedFieldKey|| null; | ||
39 | |||
40 | return this; | ||
41 | } | ||
42 | |||
43 | //============================================================================= | ||
44 | |||
45 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
46 | |||
47 | //------------------------------------------------------------------------- | ||
48 | |||
49 | 'toString': function () { | ||
50 | return "Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent component"; | ||
51 | }, | ||
52 | |||
53 | //------------------------------------------------------------------------- | ||
54 | |||
55 | 'formFieldName': function () { | ||
56 | return this._formFieldName; | ||
57 | }, | ||
58 | |||
59 | //------------------------------------------------------------------------- | ||
60 | |||
61 | 'fields': function () { | ||
62 | return this._fields; | ||
63 | }, | ||
64 | |||
65 | //------------------------------------------------------------------------- | ||
66 | |||
67 | 'selectedValue': function () { | ||
68 | var result; | ||
69 | |||
70 | result = this.getElement('select').value; | ||
71 | |||
72 | if (result == '---') { | ||
73 | result = null; | ||
74 | } | ||
75 | |||
76 | return result; | ||
77 | }, | ||
78 | |||
79 | 'initiallySelectedFieldKey': function () { | ||
80 | return this._initiallySelectedFieldKey; | ||
81 | }, | ||
82 | |||
83 | //========================================================================= | ||
84 | |||
85 | 'renderSelf': function() { | ||
86 | var initiallySelectedOptions; | ||
87 | |||
88 | this.append(this.element(), {tag:'div', id:this.getId('div'), cls:'binding', children:[ | ||
89 | {tag:'span', cls:'formFieldName', html:this.formFieldName()}, | ||
90 | {tag:'span', cls:'fieldLock', id:this.getId('isHidden'), children:[ | ||
91 | {tag:'a', href:'#', id:this.getId('showHide'), html:' '} | ||
92 | ]}, | ||
93 | {tag:'input', id:this.getId('input'), cls:'formFieldExampleValue', disabled:true, value:''}, | ||
94 | {tag:'select', name:this.formFieldName(), id:this.getId('select'), cls:'formFieldMatchinCardField', children: | ||
95 | MochiKit.Base.flattenArguments( | ||
96 | {tag:'option', value:'---', html:"---"}, | ||
97 | MochiKit.Base.map( | ||
98 | MochiKit.Base.bind(function (aField) { return {tag:'option', value:aField['reference'], html:aField['label']}; }, this), | ||
99 | this.fields() | ||
100 | ) | ||
101 | ) | ||
102 | } | ||
103 | ]}); | ||
104 | |||
105 | MochiKit.Signal.connect(this.getElement('select'), 'onchange', this, 'handleSelectChange'); | ||
106 | MochiKit.Signal.connect(this.getElement('showHide'), 'onclick', this, 'handleShowHide'); | ||
107 | |||
108 | if (! MochiKit.Base.isUndefinedOrNull(this.initiallySelectedFieldKey())) { | ||
109 | initiallySelectedOptions = MochiKit.Selector.findChildElements(this.element(), ['option[value=' + this.initiallySelectedFieldKey() + ']']); | ||
110 | if (initiallySelectedOptions.length == 1) { | ||
111 | MochiKit.DOM.updateNodeAttributes(initiallySelectedOptions[0], {selected:true}); | ||
112 | this.handleSelectChange(); | ||
113 | } | ||
114 | } | ||
115 | }, | ||
116 | |||
117 | //------------------------------------------------------------------------- | ||
118 | |||
119 | 'setFieldValue': function (aValue) { | ||
120 | this.getElement('input').value = aValue; | ||
121 | }, | ||
122 | |||
123 | 'isHidden': function () { | ||
124 | return MochiKit.DOM.hasElementClass(this.getElement('div'), 'locked'); | ||
125 | }, | ||
126 | |||
127 | 'setIsHidden': function (aValue) { | ||
128 | if (aValue == true) { | ||
129 | MochiKit.DOM.addElementClass(this.getElement('div'), 'locked'); | ||
130 | MochiKit.DOM.addElementClass(this.getElement('div'), 'showLocked'); | ||
131 | } else { | ||
132 | MochiKit.DOM.removeElementClass(this.getElement('div'), 'locked'); | ||
133 | MochiKit.DOM.removeElementClass(this.getElement('div'), 'showLocked'); | ||
134 | } | ||
135 | }, | ||
136 | |||
137 | 'isShowLocked': function () { | ||
138 | return MochiKit.DOM.hasElementClass(this.getElement('div'), 'showLocked'); | ||
139 | }, | ||
140 | |||
141 | //------------------------------------------------------------------------- | ||
142 | |||
143 | 'handleSelectChange': function (anEvent) { | ||
144 | // this.getElement('input').value = this.valueOfField(anEvent.src().value); | ||
145 | MochiKit.Signal.signal(this, 'bindChange', this); | ||
146 | }, | ||
147 | |||
148 | 'handleShowHide': function (anEvent) { | ||
149 | anEvent.preventDefault(); | ||
150 | |||
151 | if (this.isShowLocked()) { | ||
152 | MochiKit.DOM.removeElementClass(this.getElement('div'), 'showLocked'); | ||
153 | } else { | ||
154 | MochiKit.DOM.addElementClass(this.getElement('div'), 'showLocked'); | ||
155 | } | ||
156 | }, | ||
157 | |||
158 | //========================================================================= | ||
159 | __syntaxFix__: "syntax fix" | ||
160 | }); | ||
161 | |||
162 | |||
163 | |||
164 | |||
165 | |||
166 | |||
167 | |||
168 | |||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js new file mode 100644 index 0000000..d254c29 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js | |||
@@ -0,0 +1,481 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._tabPanelController = null; | ||
37 | |||
38 | this._initiallySelectedTab = args.selected || 'TYPE'; | ||
39 | this._tabPanelControllerConfiguration = { | ||
40 | 'LABEL': { | ||
41 | tab:'labelTab', | ||
42 | panel:'labelTabpanel' | ||
43 | }, | ||
44 | 'TYPE': { | ||
45 | tab:'typeTab', | ||
46 | panel:'typeTabpanel' | ||
47 | }, | ||
48 | 'CONFIGURATION': { | ||
49 | tab:'configurationTab', | ||
50 | panel:'configurationTabpanel' | ||
51 | }, | ||
52 | 'BINDINGS': { | ||
53 | tab:'bindingsTab', | ||
54 | panel:'bindingsTabpanel' | ||
55 | }, | ||
56 | 'FAVICON': { | ||
57 | tab:'faviconTab', | ||
58 | panel:'faviconTabpanel' | ||
59 | }, | ||
60 | 'DONE': { | ||
61 | tab:'doneTab', | ||
62 | panel:'doneTabpanel' | ||
63 | } | ||
64 | }; | ||
65 | |||
66 | this._directLoginReference = null; | ||
67 | |||
68 | this._directLoginFavicon = null; | ||
69 | |||
70 | this._updateFaviconCounter = 0; | ||
71 | this._faviconComponent = null; | ||
72 | |||
73 | this._bindingComponents= []; | ||
74 | this._formValueComponents = []; | ||
75 | |||
76 | return this; | ||
77 | } | ||
78 | |||
79 | //============================================================================= | ||
80 | |||
81 | //Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
82 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent, Clipperz.PM.UI.Common.Components.TabPanelComponent, { | ||
83 | |||
84 | //------------------------------------------------------------------------- | ||
85 | |||
86 | 'toString': function () { | ||
87 | return "Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent component"; | ||
88 | }, | ||
89 | |||
90 | //========================================================================= | ||
91 | |||
92 | 'directLoginReference': function () { | ||
93 | return this._directLoginReference; | ||
94 | }, | ||
95 | |||
96 | //------------------------------------------------------------------------- | ||
97 | |||
98 | 'setDirectLoginReference': function (aDirectLoginReference) { | ||
99 | this._directLoginReference = aDirectLoginReference; | ||
100 | |||
101 | return this._directLoginReference; | ||
102 | }, | ||
103 | |||
104 | //========================================================================= | ||
105 | |||
106 | 'label': function () { | ||
107 | return this.getElement('label').value | ||
108 | }, | ||
109 | |||
110 | 'setLabel': function (aValue) { | ||
111 | //console.log("##> LABEL: " + aValue); | ||
112 | this.getElement('label').value = (aValue ? aValue : ''); | ||
113 | }, | ||
114 | |||
115 | //------------------------------------------------------------------------- | ||
116 | |||
117 | 'favicon': function () { | ||
118 | return this.getElement('faviconURL').value; | ||
119 | }, | ||
120 | |||
121 | 'setFavicon': function (aValue) { | ||
122 | var regexp; | ||
123 | var displayValue; | ||
124 | |||
125 | regexp = new RegExp('^data\:\/\/.*', 'i'); | ||
126 | if (regexp.test(aValue)) { | ||
127 | displayValue = '' | ||
128 | } else { | ||
129 | displayValue = (aValue ? aValue : ''); | ||
130 | } | ||
131 | |||
132 | this.getElement('faviconURL').value = displayValue; | ||
133 | this.faviconComponent().setSrc(aValue); | ||
134 | }, | ||
135 | |||
136 | //'setFaviconData': function (aValue) { | ||
137 | // this.getElement('faviconIcon').src = aValue; | ||
138 | //}, | ||
139 | |||
140 | 'directLoginFavicon': function () { | ||
141 | return this._directLoginFavicon; | ||
142 | }, | ||
143 | |||
144 | 'setDirectLoginFavicon': function (aValue) { | ||
145 | this._directLoginFavicon = aValue; | ||
146 | this.setFavicon(aValue); | ||
147 | }, | ||
148 | |||
149 | //------------------------------------------------------------------------- | ||
150 | |||
151 | 'bookmarkletConfiguration': function () { | ||
152 | return this.getElement('bookmarkletConfiguration').value | ||
153 | }, | ||
154 | |||
155 | 'setBookmarkletConfiguration': function (aValue) { | ||
156 | this.getElement('bookmarkletConfiguration').value = aValue; | ||
157 | }, | ||
158 | |||
159 | 'highlightConfigurationSyntaxError': function () { | ||
160 | MochiKit.DOM.addElementClass(this.getElement('bookmarkletConfiguration'), 'error'); | ||
161 | }, | ||
162 | |||
163 | 'removeHighlightConfigurationSyntaxError': function () { | ||
164 | MochiKit.DOM.removeElementClass(this.getElement('bookmarkletConfiguration'), 'error'); | ||
165 | }, | ||
166 | |||
167 | //========================================================================= | ||
168 | |||
169 | 'disableAllPanels': function () { | ||
170 | this.getElement('label').disabled = true; | ||
171 | MochiKit.DOM.addElementClass(this.getElement('label').parentNode, 'disabled'); | ||
172 | |||
173 | this.tabPanelController().selectTab(null); | ||
174 | }, | ||
175 | |||
176 | //------------------------------------------------------------------------- | ||
177 | |||
178 | //'disableLabelField': function () { | ||
179 | // this.getElement('label').disabled = true; | ||
180 | // MochiKit.DOM.addElementClass(this.getElement('label').parentNode, 'disabled'); | ||
181 | //}, | ||
182 | |||
183 | 'enableLabelField': function () { | ||
184 | this.getElement('label').disabled = false; | ||
185 | MochiKit.DOM.removeElementClass(this.getElement('label').parentNode, 'disabled'); | ||
186 | this.tabPanelController().selectTab('LABEL'); | ||
187 | }, | ||
188 | |||
189 | //------------------------------------------------------------------------- | ||
190 | |||
191 | //'disableTypeField': function () { | ||
192 | // this.tabPanelController().selectTab(null); | ||
193 | //}, | ||
194 | |||
195 | 'enableTypeField': function () { | ||
196 | this.tabPanelController().selectTab('TYPE'); | ||
197 | }, | ||
198 | |||
199 | //------------------------------------------------------------------------- | ||
200 | |||
201 | //'disableConfigurationField': function () { | ||
202 | // this.tabPanelController().selectTab(null); | ||
203 | //}, | ||
204 | |||
205 | 'enableConfigurationField': function () { | ||
206 | this.tabPanelController().selectTab('CONFIGURATION'); | ||
207 | }, | ||
208 | |||
209 | //------------------------------------------------------------------------- | ||
210 | |||
211 | //'disableBindingFields': function () { | ||
212 | // this.tabPanelController().selectTab(null); | ||
213 | //}, | ||
214 | |||
215 | 'enableBindingFields': function () { | ||
216 | this.tabPanelController().selectTab('BINDINGS'); | ||
217 | }, | ||
218 | |||
219 | //------------------------------------------------------------------------- | ||
220 | |||
221 | //'disableFaviconField': function () { | ||
222 | // this.tabPanelController().selectTab(null); | ||
223 | //}, | ||
224 | |||
225 | 'enableFaviconField': function () { | ||
226 | this.tabPanelController().selectTab('FAVICON'); | ||
227 | }, | ||
228 | |||
229 | //------------------------------------------------------------------------- | ||
230 | |||
231 | 'enableDonePanel': function () { | ||
232 | this.tabPanelController().selectTab('DONE'); | ||
233 | }, | ||
234 | |||
235 | //========================================================================= | ||
236 | |||
237 | 'shouldShowElementWhileRendering': function() { | ||
238 | return false; | ||
239 | }, | ||
240 | |||
241 | //========================================================================= | ||
242 | |||
243 | 'faviconComponent': function () { | ||
244 | if (this._faviconComponent == null) { | ||
245 | this._faviconComponent = new Clipperz.PM.UI.Common.Components.FaviconComponent({element:this.getId('favicon')}); | ||
246 | } | ||
247 | |||
248 | return this._faviconComponent; | ||
249 | }, | ||
250 | |||
251 | //========================================================================= | ||
252 | |||
253 | 'tabPanelController': function () { | ||
254 | if (this._tabPanelController == null) { | ||
255 | this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({ | ||
256 | component:this, | ||
257 | configuration:this._tabPanelControllerConfiguration | ||
258 | }); | ||
259 | |||
260 | MochiKit.Signal.connect(this._tabPanelController, 'tabSelected', this, 'handleTabSelected') | ||
261 | } | ||
262 | |||
263 | return this._tabPanelController; | ||
264 | }, | ||
265 | |||
266 | //------------------------------------------------------------------------- | ||
267 | |||
268 | 'renderSelf': function() { | ||
269 | varbookmarkletComponent; | ||
270 | |||
271 | this.append(this.element(), {tag:'div', cls:'directLoginEditing', id:this.getId('panel'), children: [ | ||
272 | // {tag:'div', cls:'back', children:[ | ||
273 | // {tag:'a', href:'#', id:this.getId('back'), html:" "} | ||
274 | // ]}, | ||
275 | {tag:'form', id:this.getId('form'), cls:'directLoginEditingForm', children:[ | ||
276 | {tag:'div', cls:'title', children:[ | ||
277 | {tag:'img', id:this.getId('favicon'), cls:'favicon'}, | ||
278 | {tag:'input', type:'text', id:this.getId('label')}//, | ||
279 | // {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.LABEL.description')}]}, | ||
280 | ]}, | ||
281 | {tag:'div', cls:'tabContainer', children:[ | ||
282 | {tag:'ul', cls:'tabs', children:[ | ||
283 | {tag:'li', id:this.getId('labelTab'), children:[{tag:'span', html:"label"}]}, | ||
284 | {tag:'li', id:this.getId('typeTab'), children:[{tag:'span', html:"type"}]}, | ||
285 | {tag:'li', id:this.getId('configurationTab'),children:[{tag:'span', html:"configuration"}]}, | ||
286 | {tag:'li', id:this.getId('bindingsTab'), children:[{tag:'span', html:"bindings"}]}, | ||
287 | {tag:'li', id:this.getId('faviconTab'), children:[{tag:'span', html:"favicon"}]}, | ||
288 | {tag:'li', id:this.getId('doneTab'), children:[{tag:'span', html:"done"}]} | ||
289 | ]}, | ||
290 | {tag:'ul', cls:'tabPanels', children:[ | ||
291 | {tag:'li', id:this.getId('labelTabpanel'), cls:'tabPanel label', children:[ | ||
292 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.LABEL.description')}]} | ||
293 | ]}, | ||
294 | {tag:'li', id:this.getId('typeTabpanel'), cls:'tabPanel type', children:[ | ||
295 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.TYPE.description')}]}, | ||
296 | {tag:'h2', html:"type"} | ||
297 | ]}, | ||
298 | {tag:'li', id:this.getId('configurationTabpanel'), cls:'tabPanel configuration', children:[ | ||
299 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.CONFIGURATION.description')}]}, | ||
300 | {tag:'div', cls:'bookmarkletConfigurationWrapper', children:[ | ||
301 | {tag:'textarea', id:this.getId('bookmarkletConfiguration'), value:""}, | ||
302 | // {tag:'div', cls:'bookmarkletComponentWrapper', children:[{tag:'div', id:this.getId('bookmarkletComponent'), cls:'bookmarkletComponent'}]} | ||
303 | {tag:'div', id:this.getId('bookmarkletComponent'), cls:'bookmarkletComponent'} | ||
304 | ]} | ||
305 | ]}, | ||
306 | {tag:'li', id:this.getId('bindingsTabpanel'), cls:'tabPanel bindings', children:[ | ||
307 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.BINDINGS.description')}]}, | ||
308 | {tag:'div', cls:'bindings', id:this.getId('bindings'), children:[]}, | ||
309 | {tag:'div', cls:'formValues', id:this.getId('formValues'), children:[]} | ||
310 | ]}, | ||
311 | {tag:'li', id:this.getId('faviconTabpanel'), cls:'tabPanel favicon', children:[ | ||
312 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.FAVICON.description')}]}, | ||
313 | {tag:'div', cls:'favicon', children:[ | ||
314 | {tag:'input', type:'text', id:this.getId('faviconURL')} | ||
315 | ]} | ||
316 | ]}, | ||
317 | {tag:'li', id:this.getId('doneTabpanel'), cls:'tabPanel done', children:[ | ||
318 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', id:this.getId('doneDescription')/*, html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.DONE.description')*/}]} | ||
319 | ]} | ||
320 | ]} | ||
321 | ]} | ||
322 | ]}, | ||
323 | {tag:'div', cls:'clear'} | ||
324 | ]}); | ||
325 | |||
326 | bookmarkletComponent = new Clipperz.PM.UI.Web.Components.BookmarkletComponent({element:this.getElement('bookmarkletComponent')}); | ||
327 | bookmarkletComponent.render(); | ||
328 | |||
329 | this.tabPanelController().setup(/*{selected:this.initiallySelectedTab()}*/); | ||
330 | |||
331 | MochiKit.Signal.connect(this.getId('label'), 'onchange', this, 'changedValue'); | ||
332 | MochiKit.Signal.connect(this.getId('label'), 'onkeyup', this, 'changedValue'); | ||
333 | |||
334 | MochiKit.Signal.connect(this.getId('bookmarkletConfiguration'),'onchange', this, 'changedValue'); | ||
335 | MochiKit.Signal.connect(this.getId('bookmarkletConfiguration'),'onkeyup', this, 'changedValue'); | ||
336 | |||
337 | MochiKit.Signal.connect(this.getId('faviconURL'), 'onchange', this, 'changedValue'); | ||
338 | MochiKit.Signal.connect(this.getId('faviconURL'), 'onkeyup', this, 'changedValue'); | ||
339 | |||
340 | MochiKit.Signal.connect(this.getId('panel'), 'onkeydown',this, 'handleKeyEvent'); | ||
341 | }, | ||
342 | |||
343 | //------------------------------------------------------------------------- | ||
344 | |||
345 | 'handleTabSelected': function (aSelectedTab) { | ||
346 | switch (aSelectedTab) { | ||
347 | case 'DETAILS': | ||
348 | break; | ||
349 | case 'DIRECT_LOGINS': | ||
350 | MochiKit.Style.hideElement(this.getElement('backToDirectLoginList')); | ||
351 | break; | ||
352 | case 'SHARING': | ||
353 | break; | ||
354 | } | ||
355 | }, | ||
356 | |||
357 | //========================================================================= | ||
358 | |||
359 | 'incrementUpdateFaviconCounter': function () { | ||
360 | this._updateFaviconCounter ++; | ||
361 | }, | ||
362 | |||
363 | 'decrementUpdateFaviconCounter': function () { | ||
364 | this._updateFaviconCounter --; | ||
365 | }, | ||
366 | |||
367 | 'updateFaviconCounter': function () { | ||
368 | return this._updateFaviconCounter; | ||
369 | }, | ||
370 | |||
371 | //------------------------------------------------------------------------- | ||
372 | |||
373 | 'updateFavicon': function () { | ||
374 | this.decrementUpdateFaviconCounter(); | ||
375 | |||
376 | if (this.updateFaviconCounter() == 0) { | ||
377 | this.setFavicon(this.favicon()); | ||
378 | } | ||
379 | }, | ||
380 | |||
381 | //========================================================================= | ||
382 | |||
383 | 'bindingComponents': function () { | ||
384 | return this._bindingComponents; | ||
385 | }, | ||
386 | |||
387 | 'clearAllBindingsComponents': function () { | ||
388 | MochiKit.Iter.forEach(this.bindingComponents(), MochiKit.Base.methodcaller('remove')); | ||
389 | this._bindingComponents = []; | ||
390 | this.getElement('bindings').innerHTML = ''; | ||
391 | }, | ||
392 | |||
393 | 'addBindingComponent': function (aBindingComponent) { | ||
394 | this.bindingComponents().push(aBindingComponent); | ||
395 | aBindingComponent.renderInNode(this.append(this.getElement('bindings'), {tag:'div'})); | ||
396 | }, | ||
397 | |||
398 | //========================================================================= | ||
399 | |||
400 | 'formValueComponents': function () { | ||
401 | return this._formValueComponents; | ||
402 | }, | ||
403 | |||
404 | 'clearAllFormValueComponents': function () { | ||
405 | MochiKit.Iter.forEach(this.formValueComponents(), MochiKit.Base.methodcaller('remove')); | ||
406 | this._formValueComponents = []; | ||
407 | this.getElement('formValues').innerHTML = ''; | ||
408 | }, | ||
409 | |||
410 | 'addFormValueComponent': function (aFormValueComponent) { | ||
411 | this.formValueComponents().push(aFormValueComponent); | ||
412 | aFormValueComponent.renderInNode(this.append(this.getElement('formValues'), {tag:'div'})); | ||
413 | }, | ||
414 | |||
415 | //========================================================================= | ||
416 | |||
417 | 'changedValue': function (anEvent) { | ||
418 | MochiKit.Signal.signal(this, 'changedValue', anEvent); | ||
419 | |||
420 | this.incrementUpdateFaviconCounter(); | ||
421 | MochiKit.Async.callLater(1, MochiKit.Base.method(this, 'updateFavicon')); | ||
422 | }, | ||
423 | |||
424 | //------------------------------------------------------------------------- | ||
425 | |||
426 | 'handleBackClick': function (anEvent) { | ||
427 | anEvent.preventDefault(); | ||
428 | |||
429 | MochiKit.Signal.signal(this, 'back'); | ||
430 | }, | ||
431 | |||
432 | //========================================================================= | ||
433 | |||
434 | 'bottomMargin': function () { | ||
435 | returnMochiKit.Style.getElementPosition(this.element().parentNode)['y'] + | ||
436 | MochiKit.Style.getElementDimensions(this.element())['h']; | ||
437 | }, | ||
438 | |||
439 | //========================================================================= | ||
440 | |||
441 | 'focusOnLabelElement': function () { | ||
442 | this.getElement('label').focus(); | ||
443 | }, | ||
444 | |||
445 | 'focusOnBookmarkletConfigurationElement': function () { | ||
446 | this.getElement('bookmarkletConfiguration').focus(); | ||
447 | }, | ||
448 | |||
449 | 'focusOnFaviconElement': function () { | ||
450 | this.getElement('faviconURL').focus(); | ||
451 | }, | ||
452 | |||
453 | //========================================================================= | ||
454 | |||
455 | 'setDoneDescriptionWithKeys': function (someKeys) { | ||
456 | // {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', id:this.getId('doneDescription')/*, html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.DONE.description')*/}]} | ||
457 | this.getElement('doneDescription').innerHTML = Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.DONE.description', someKeys); | ||
458 | }, | ||
459 | |||
460 | //========================================================================= | ||
461 | |||
462 | 'handleKeyEvent': function (anEvent) { | ||
463 | MochiKit.Signal.signal(this, 'keyPressed', anEvent); | ||
464 | /* | ||
465 | if (anEvent.key().string == 'KEY_ENTER') { | ||
466 | if (anEvent.target().nodeName != 'TEXTAREA') { | ||
467 | MochiKit.Signal.signal(this, 'moveForward'); | ||
468 | anEvent.preventDefault(); | ||
469 | } | ||
470 | } else if (anEvent.key().string == 'KEY_TAB') { | ||
471 | if ((anEvent.target().nodeName == 'INPUT') || (anEvent.target().nodeName == 'TEXTAREA')) { | ||
472 | MochiKit.Signal.signal(this, 'moveForward'); | ||
473 | anEvent.preventDefault(); | ||
474 | } | ||
475 | } | ||
476 | */ | ||
477 | }, | ||
478 | |||
479 | //========================================================================= | ||
480 | __syntaxFix__: "syntax fix" | ||
481 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js new file mode 100644 index 0000000..b91eb98 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js | |||
@@ -0,0 +1,179 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._formFieldName = args.formFieldName|| Clipperz.Base.exception.raise('MandatoryParameter'); | ||
37 | this._fieldOptions = args.fieldOptions || Clipperz.Base.exception.raise('MandatoryParameter'); | ||
38 | this._initialValue = args.initialValue || null; | ||
39 | |||
40 | return this; | ||
41 | } | ||
42 | |||
43 | //============================================================================= | ||
44 | |||
45 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
46 | |||
47 | //------------------------------------------------------------------------- | ||
48 | |||
49 | 'toString': function () { | ||
50 | return "Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent component"; | ||
51 | }, | ||
52 | |||
53 | //------------------------------------------------------------------------- | ||
54 | |||
55 | 'formFieldName': function () { | ||
56 | return this._formFieldName; | ||
57 | }, | ||
58 | |||
59 | //------------------------------------------------------------------------- | ||
60 | |||
61 | 'fieldOptions': function () { | ||
62 | return this._fieldOptions; | ||
63 | }, | ||
64 | |||
65 | 'fieldType': function () { | ||
66 | return this.fieldOptions()['type']; | ||
67 | }, | ||
68 | |||
69 | 'optionValues': function () { | ||
70 | return MochiKit.Base.map(function (anOptionValue) { | ||
71 | return { | ||
72 | 'label': anOptionValue['label'] || anOptionValue['value'], | ||
73 | 'value': anOptionValue['value'] | ||
74 | } | ||
75 | }, this.fieldOptions()['options']); | ||
76 | }, | ||
77 | |||
78 | //------------------------------------------------------------------------- | ||
79 | |||
80 | 'selectedValue': function () { | ||
81 | var result; | ||
82 | |||
83 | result = this.getElement('select').value; | ||
84 | |||
85 | if (result == '---') { | ||
86 | result = null; | ||
87 | } | ||
88 | |||
89 | return result; | ||
90 | }, | ||
91 | |||
92 | 'initialValue': function () { | ||
93 | return this._initialValue; | ||
94 | }, | ||
95 | |||
96 | //========================================================================= | ||
97 | |||
98 | 'renderSelf': function() { | ||
99 | //console.log(">>> DirectLoginEditingFormValueComponent.renderSelf"); | ||
100 | //console.log("FIELD OPTIONS", this.fieldOptions()); | ||
101 | //console.log("OPTION VALUES", this.optionValues()); | ||
102 | this.append(this.element(), {tag:'div', id:this.getId('div'), cls:'formValue', children:[ | ||
103 | {tag:'span', cls:'formFieldName', html:this.formFieldName()}, | ||
104 | {tag:'div', id:this.getId('values')} | ||
105 | ]}); | ||
106 | |||
107 | if ((this.fieldType() == 'radio') || (this.fieldType() == 'select')) { | ||
108 | this.append(this.getElement('values'), | ||
109 | {tag:'select', name:this.formFieldName(), id:this.getId('select'), cls:'formFieldMatchinCardField', children: | ||
110 | MochiKit.Base.flattenArguments( | ||
111 | // {tag:'option', value:'---', html:"---"}, | ||
112 | MochiKit.Base.map( | ||
113 | MochiKit.Base.bind(function (aValue) { return {tag:'option', value:aValue['value'], html:aValue['label']}; }, this), | ||
114 | this.optionValues() | ||
115 | ) | ||
116 | ) | ||
117 | } | ||
118 | ); | ||
119 | |||
120 | MochiKit.Signal.connect(this.getElement('select'), 'onchange', this, 'handleSelectChange'); | ||
121 | |||
122 | if (! MochiKit.Base.isUndefinedOrNull(this.initialValue())) { | ||
123 | var initiallySelectedOptions; | ||
124 | initiallySelectedOptions = MochiKit.Selector.findChildElements(this.element(), ['option[value=' + this.initialValue() + ']']); | ||
125 | if (initiallySelectedOptions.length == 1) { | ||
126 | MochiKit.DOM.updateNodeAttributes(initiallySelectedOptions[0], {selected:true}); | ||
127 | this.handleSelectChange(); | ||
128 | } else { | ||
129 | Clipperz.DOM.Helper.insertBefore(this.getElement('select').childNodes[0], {tag:'option', value:'---', html:"", selected:true}); | ||
130 | } | ||
131 | } else { | ||
132 | Clipperz.DOM.Helper.insertBefore(this.getElement('select').childNodes[0], {tag:'option', value:'---', html:"", selected:true}); | ||
133 | } | ||
134 | } else if (this.fieldType() == 'checkbox') { | ||
135 | this.append(this.getElement('values'), | ||
136 | {tag:'input', type:'checkbox', name:this.formFieldName(), id:this.getId('checkbox'), cls:'formFieldMatchinCardField'} | ||
137 | ); | ||
138 | |||
139 | MochiKit.Signal.connect(this.getElement('checkbox'), 'onchange', this, 'handleSelectChange'); | ||
140 | |||
141 | if (this.initialValue()) { | ||
142 | MochiKit.DOM.updateNodeAttributes(this.getElement('checkbox'), {checked:true}); | ||
143 | } | ||
144 | } else { | ||
145 | WTF = TODO; | ||
146 | } | ||
147 | //console.log("<<< DirectLoginEditingFormValueComponent.renderSelf"); | ||
148 | }, | ||
149 | |||
150 | //========================================================================= | ||
151 | |||
152 | 'handleSelectChange': function (anEvent) { | ||
153 | //console.log("handleSelectChange", anEvent, anEvent.src(), anEvent.src().value); | ||
154 | var options; | ||
155 | |||
156 | options = {}; | ||
157 | |||
158 | options['fieldName'] = this.formFieldName(); | ||
159 | |||
160 | if (this.fieldType() == 'checkbox') { | ||
161 | options['selectedValue'] = (this.getElement('checkbox').checked ? 1 : null); | ||
162 | } else { | ||
163 | options['selectedValue'] = this.selectedValue(); | ||
164 | } | ||
165 | |||
166 | MochiKit.Signal.signal(this, 'formValueChange', options); | ||
167 | }, | ||
168 | |||
169 | //========================================================================= | ||
170 | __syntaxFix__: "syntax fix" | ||
171 | }); | ||
172 | |||
173 | |||
174 | |||
175 | |||
176 | |||
177 | |||
178 | |||
179 | |||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js new file mode 100644 index 0000000..1f49575 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js | |||
@@ -0,0 +1,271 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | //############################################################################# | ||
32 | |||
33 | Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager = function(args) { | ||
34 | args = args || {}; | ||
35 | Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager.superclass.constructor.call(this, args); | ||
36 | |||
37 | this._enterLeaveCounter = 0; | ||
38 | this._selectedRowObject = null; | ||
39 | |||
40 | return this; | ||
41 | } | ||
42 | |||
43 | //============================================================================= | ||
44 | |||
45 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { | ||
46 | |||
47 | 'toString': function () { | ||
48 | return "Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager component"; | ||
49 | }, | ||
50 | |||
51 | //------------------------------------------------------------------------- | ||
52 | |||
53 | 'renderHeader': function(aTRElement) { | ||
54 | Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager.superclass.renderHeader.call(this, aTRElement); | ||
55 | |||
56 | Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body, {tag:'div', cls:'DirectLoginListPopup', id:this.getId('DirectLoginListPopup'), children:[ | ||
57 | {tag:'div', cls:'DirectLoginListPopup_body', children:[ | ||
58 | {tag:'ul', id:this.getId('DirectLoginListPopup_list'), children:[ | ||
59 | // {tag:'li', children:[ | ||
60 | // {tag:'img', cls:'favicon', src:'http://www.microsoft.com/favicon.ico'}, | ||
61 | // {tag:'a', href:'#', html:"Google Mail"} | ||
62 | // ]}, | ||
63 | // ... | ||
64 | ]} | ||
65 | ]}, | ||
66 | {tag:'div', cls:'DirectLoginListPopup_footer'} | ||
67 | ]}); | ||
68 | |||
69 | MochiKit.Style.hideElement(this.getId('DirectLoginListPopup')); | ||
70 | |||
71 | //BEWARE: use MochiKit.Signal.connect instead of this.connectEvent, as the HEADER is NOT redrawn after each refresh | ||
72 | MochiKit.Signal.connect(this.getId('DirectLoginListPopup'), 'onmouseenter', this, 'handleDirectLoginListPopupEnter'); | ||
73 | MochiKit.Signal.connect(this.getId('DirectLoginListPopup'), 'onmouseleave', this, 'handleDirectLoginListPopupLeave'); | ||
74 | }, | ||
75 | |||
76 | //------------------------------------------------------------------------- | ||
77 | |||
78 | 'renderCell': function(aRowElement, anObject) { | ||
79 | var i,c; | ||
80 | var directLoginsInfo; | ||
81 | |||
82 | directLoginsInfo = anObject[this.name()]; | ||
83 | |||
84 | TDElement = Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:'card_directLogins'}); | ||
85 | |||
86 | c = Math.min(2, directLoginsInfo.length); | ||
87 | for (i=0; i<c; i++) { | ||
88 | var elementID; | ||
89 | |||
90 | elementID = 'directLogin_' + directLoginsInfo[i]['_reference']; | ||
91 | |||
92 | Clipperz.DOM.Helper.append(TDElement, {tag:'div', cls:'card_directLogin', children:[ | ||
93 | {tag:'div', cls:'card_directLogin_body', children:[ | ||
94 | {tag:'a', href:'#', id:elementID, html:directLoginsInfo[i]['label']} | ||
95 | ]} | ||
96 | ]}); | ||
97 | // MochiKit.Signal.connect(elementID, 'onclick', MochiKit.Base.method(this, 'handleDirectLoginClick', directLoginsInfo[i]['_rowObject'])); | ||
98 | this.connectEvent(elementID, 'onclick', MochiKit.Base.method(this, 'handleDirectLoginClick', directLoginsInfo[i]['_rowObject'])); | ||
99 | } | ||
100 | |||
101 | if (directLoginsInfo.length > 2) { | ||
102 | var ellipsesElement; | ||
103 | |||
104 | ellipsesElement = Clipperz.DOM.Helper.append(TDElement, {tag:'div', cls:'card_directLogin_ellipses', children:[ | ||
105 | {tag:'div', cls:'card_directLogin_ellipses_body', children:[ | ||
106 | {tag:'span', html:'…'} | ||
107 | ]} | ||
108 | ]}); | ||
109 | |||
110 | /// MochiKit.Signal.connect(ellipsesElement, 'onmouseenter', MochiKit.Base.method(this, 'handleEllipsesEnter', anObject)); | ||
111 | /// MochiKit.Signal.connect(ellipsesElement, 'onmouseleave', MochiKit.Base.method(this, 'handleEllipsesLeave')); | ||
112 | // MochiKit.Signal.connect(TDElement, 'onmouseleave', MochiKit.Base.method(this, 'handleTDLeave')); | ||
113 | this.connectEvent(TDElement, 'onmouseleave', MochiKit.Base.method(this, 'handleTDLeave')); | ||
114 | } | ||
115 | // MochiKit.Signal.connect(TDElement, 'onmouseenter', MochiKit.Base.method(this, 'handleTDEnter', anObject)); | ||
116 | this.connectEvent(TDElement, 'onmouseenter', MochiKit.Base.method(this, 'handleTDEnter', anObject)); | ||
117 | |||
118 | }, | ||
119 | |||
120 | //========================================================================= | ||
121 | /* | ||
122 | 'handleEllipsesEnter': function (aRecordInfo, anEvent) { | ||
123 | this._enterLeaveCounter ++; | ||
124 | if (this._enterLeaveCounter > 2) { | ||
125 | this._enterLeaveCounter = 2; | ||
126 | } | ||
127 | |||
128 | if (this._enterLeaveCounter == 1) { | ||
129 | this.showDirectLoginListPopup(aRecordInfo, anEvent.src()); | ||
130 | } | ||
131 | }, | ||
132 | |||
133 | 'handleEllipsesLeave': function (anEvent) { | ||
134 | this._enterLeaveCounter --; | ||
135 | |||
136 | MochiKit.Async.callLater(0.3, MochiKit.Base.bind(function () { | ||
137 | if (this._enterLeaveCounter == 0) { | ||
138 | this.hideDirectLoginListPopup(); | ||
139 | } | ||
140 | }, this)) | ||
141 | }, | ||
142 | */ | ||
143 | //------------------------------------------------------------------------- | ||
144 | |||
145 | 'handleTDEnter': function (aRecordInfo, anEvent) { | ||
146 | if (MochiKit.Selector.findChildElements(anEvent.src(), ['div.card_directLogin_ellipses']).length > 0) { | ||
147 | this._enterLeaveCounter ++; | ||
148 | if (this._enterLeaveCounter > 2) { | ||
149 | this._enterLeaveCounter = 2; | ||
150 | } | ||
151 | |||
152 | if (this._enterLeaveCounter == 1) { | ||
153 | this.showDirectLoginListPopup(aRecordInfo, anEvent.src()); | ||
154 | } | ||
155 | } else { | ||
156 | if (this._selectedRowObject != null) { | ||
157 | this.hideDirectLoginListPopup(); | ||
158 | } | ||
159 | } | ||
160 | }, | ||
161 | |||
162 | 'handleTDLeave': function (anEvent) { | ||
163 | this._enterLeaveCounter --; | ||
164 | if (this._enterLeaveCounter < 0) { | ||
165 | this._enterLeaveCounter = 0; | ||
166 | } | ||
167 | |||
168 | MochiKit.Async.callLater(0.3, MochiKit.Base.bind(function () { | ||
169 | if (this._enterLeaveCounter == 0) { | ||
170 | this.hideDirectLoginListPopup(); | ||
171 | } | ||
172 | }, this)) | ||
173 | }, | ||
174 | |||
175 | //------------------------------------------------------------------------- | ||
176 | |||
177 | 'handleDirectLoginListPopupEnter': function (anEvent) { | ||
178 | this._enterLeaveCounter ++; | ||
179 | if (this._enterLeaveCounter > 2) { | ||
180 | this._enterLeaveCounter = 2; | ||
181 | } | ||
182 | }, | ||
183 | |||
184 | 'handleDirectLoginListPopupLeave': function (anEvent) { | ||
185 | this._enterLeaveCounter --; | ||
186 | if (this._enterLeaveCounter < 0) { | ||
187 | this._enterLeaveCounter = 0; | ||
188 | } | ||
189 | |||
190 | MochiKit.Async.callLater(0.3, MochiKit.Base.bind(function () { | ||
191 | if (this._enterLeaveCounter == 0) { | ||
192 | this.hideDirectLoginListPopup(); | ||
193 | } | ||
194 | }, this)) | ||
195 | }, | ||
196 | |||
197 | //========================================================================= | ||
198 | |||
199 | 'showDirectLoginListPopup': function (aRecordInfo, anElement) { | ||
200 | var position; | ||
201 | var directLoginsInfo; | ||
202 | var directLoginsListElement; | ||
203 | var ellipsesElement; | ||
204 | |||
205 | |||
206 | ellipsesElement = MochiKit.Selector.findChildElements(anElement, ['div.card_directLogin_ellipses'])[0]; | ||
207 | position = MochiKit.Style.getElementPosition(ellipsesElement); | ||
208 | // position = MochiKit.Style.getElementPosition(anElement); | ||
209 | position.x += 14; | ||
210 | position.y -= 26; | ||
211 | |||
212 | MochiKit.Style.setElementPosition(this.getId('DirectLoginListPopup'), position /*[, units='px'] */); | ||
213 | |||
214 | directLoginsListElement = this.getElement('DirectLoginListPopup_list'); | ||
215 | directLoginsListElement.innerHTML = ''; | ||
216 | |||
217 | directLoginsInfo = aRecordInfo[this.name()]; | ||
218 | c = directLoginsInfo.length; | ||
219 | for (i=0; i<c; i++) { | ||
220 | varelementID; | ||
221 | varlabel; | ||
222 | var trunkedLabel; | ||
223 | |||
224 | label = directLoginsInfo[i]['label']; | ||
225 | trunkedLabel = (label.length > 20 ? label.slice(0,20) + '…' : label); | ||
226 | |||
227 | elementID = this.getId('directLoginList_' + directLoginsInfo[i]['_reference']); | ||
228 | |||
229 | Clipperz.DOM.Helper.append(directLoginsListElement, {tag:'li', children:[ | ||
230 | {tag:'div', children:[ | ||
231 | {tag:'img', cls:'favicon', src:directLoginsInfo[i]['favicon']}, | ||
232 | (label == trunkedLabel ? {tag:'a', href:'#', id:elementID, html:trunkedLabel} : {tag:'a', href:'#', id:elementID, title:label, html:trunkedLabel}) | ||
233 | ]} | ||
234 | ]}); | ||
235 | |||
236 | // MochiKit.Signal.connect(elementID, 'onclick', MochiKit.Base.method(this, 'handleDirectLoginClick', directLoginsInfo[i]['_rowObject'])); | ||
237 | this.connectEvent(elementID, 'onclick', MochiKit.Base.method(this, 'handleDirectLoginClick', directLoginsInfo[i]['_rowObject'])); | ||
238 | } | ||
239 | |||
240 | // MochiKit.Style.showElement(this.getId('DirectLoginListPopup')); | ||
241 | MochiKit.Visual.appear(this.getId('DirectLoginListPopup'), {duration:0.5}); | ||
242 | MochiKit.Signal.signal(this, 'selectRow', aRecordInfo); | ||
243 | |||
244 | this._selectedRowObject = aRecordInfo; | ||
245 | }, | ||
246 | |||
247 | //------------------------------------------------------------------------- | ||
248 | |||
249 | 'hideDirectLoginListPopup': function () { | ||
250 | if (this._selectedRowObject != null) { | ||
251 | MochiKit.Signal.signal(this, 'unselectRow', this._selectedRowObject); | ||
252 | MochiKit.Visual.fade(this.getId('DirectLoginListPopup'), {duration:0.5}); | ||
253 | this._selectedRowObject = null; | ||
254 | this._enterLeaveCounter = 0; | ||
255 | } | ||
256 | }, | ||
257 | |||
258 | //========================================================================= | ||
259 | |||
260 | 'handleDirectLoginClick': function (aDirectLogin, anEvent) { | ||
261 | anEvent.preventDefault(); | ||
262 | // aDirectLogin.runDirectLogin(); | ||
263 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.openDirectLogin(aDirectLogin); | ||
264 | }, | ||
265 | |||
266 | //------------------------------------------------------------------------- | ||
267 | |||
268 | '__syntax_fix__' : 'syntax fix' | ||
269 | |||
270 | }); | ||
271 | |||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/FaviconColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/FaviconColumnManager.js new file mode 100644 index 0000000..19d1635 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/FaviconColumnManager.js | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | //############################################################################# | ||
32 | |||
33 | Clipperz.PM.UI.Web.Components.FaviconColumnManager = function(args) { | ||
34 | args = args || {}; | ||
35 | Clipperz.PM.UI.Web.Components.FaviconColumnManager.superclass.constructor.call(this, args); | ||
36 | |||
37 | return this; | ||
38 | } | ||
39 | |||
40 | //============================================================================= | ||
41 | |||
42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.FaviconColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { | ||
43 | |||
44 | 'toString': function () { | ||
45 | return "Clipperz.PM.UI.Web.Components.FaviconColumnManager component"; | ||
46 | }, | ||
47 | |||
48 | //------------------------------------------------------------------------- | ||
49 | |||
50 | 'renderCell': function(aRowElement, anObject) { | ||
51 | varfaviconImageElement; | ||
52 | var faviconUrl; | ||
53 | |||
54 | faviconImageElement = this.getId('favicon'); | ||
55 | faviconUrl = anObject[this.name()]; | ||
56 | |||
57 | if (faviconUrl == null) { | ||
58 | faviconUrl = Clipperz.PM.Strings.getValue('defaultFaviconUrl'); | ||
59 | } | ||
60 | |||
61 | Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ | ||
62 | {tag:'img', id:faviconImageElement, src:faviconUrl} | ||
63 | ]}); | ||
64 | |||
65 | MochiKit.Signal.connect(faviconImageElement, 'onload', this, 'handleLoadedFaviconImage'); | ||
66 | MochiKit.Signal.connect(faviconImageElement, 'onerror', this, 'handleMissingFaviconImage'); | ||
67 | MochiKit.Signal.connect(faviconImageElement, 'onabort', this, 'handleMissingFaviconImage'); | ||
68 | }, | ||
69 | |||
70 | //----------------------------------------------------- | ||
71 | |||
72 | 'handleLoadedFaviconImage': function(anEvent) { | ||
73 | MochiKit.Signal.disconnectAllTo(anEvent.src()); | ||
74 | if (anEvent.src().complete == false) { | ||
75 | anEvent.src().src = Clipperz.PM.Strings.getValue('defaultFaviconUrl'); | ||
76 | } | ||
77 | }, | ||
78 | |||
79 | //----------------------------------------------------- | ||
80 | |||
81 | 'handleMissingFaviconImage': function(anEvent) { | ||
82 | MochiKit.Signal.disconnectAllTo(anEvent.src()); | ||
83 | anEvent.src().src = Clipperz.PM.Strings.getValue('defaultFaviconUrl'); | ||
84 | }, | ||
85 | |||
86 | //----------------------------------------------------- | ||
87 | '__syntax_fix__' : 'syntax fix' | ||
88 | }); | ||
89 | |||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/GridComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/GridComponent.js new file mode 100644 index 0000000..8b3e6c9 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/GridComponent.js | |||
@@ -0,0 +1,262 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.GridComponent = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.GridComponent.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._columnsManagers = args.columnsManagers; | ||
37 | |||
38 | this._rowsObjects = []; | ||
39 | this._noRowsGridComponent = null; | ||
40 | |||
41 | this._slots = { | ||
42 | 'headerSlot':this.getId('headerSlot') | ||
43 | }; | ||
44 | |||
45 | return this; | ||
46 | } | ||
47 | |||
48 | //============================================================================= | ||
49 | |||
50 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.GridComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
51 | |||
52 | //------------------------------------------------------------------------- | ||
53 | |||
54 | 'toString': function () { | ||
55 | return "Clipperz.PM.UI.Web.Components.GridComponent component"; | ||
56 | }, | ||
57 | |||
58 | //------------------------------------------------------------------------- | ||
59 | |||
60 | 'rows': function () { | ||
61 | throw Clipperz.Base.exception.AbstractMethod; | ||
62 | // return this._rows; | ||
63 | }, | ||
64 | |||
65 | //------------------------------------------------------------------------- | ||
66 | |||
67 | 'columnsManagers': function () { | ||
68 | return this._columnsManagers; | ||
69 | }, | ||
70 | |||
71 | //------------------------------------------------------------------------- | ||
72 | |||
73 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
74 | this.append(this.element(), [ | ||
75 | {tag:'div', cls:'header', children:[ | ||
76 | {tag:'form', id:this.getId('searchForm'), cls:'search', children:[ | ||
77 | {tag:'div', cls:'search', children:[ | ||
78 | {tag:'input', type:'text', id:this.getId('search'), cls:'search', placeholder:"search", name:'textToSearch'/*, value:"clipperz"*/} | ||
79 | ]}, | ||
80 | {tag:'div', cls:'clearSearchButton', id:this.getId('clearSearch')}, | ||
81 | // {tag:'input', type:'button', cls:'searchButton', name:'searchButton', value:"search"}, | ||
82 | {tag:'div', cls:'headerSlot', id:this.getId('headerSlot')} | ||
83 | ]} | ||
84 | ]}, | ||
85 | {tag:'div', cls:'body', children:[ | ||
86 | {tag:'div', cls:'rows', id:this.getId('rows'), children:[ | ||
87 | {tag:'table', cellpadding:'0', cellspacing:'0', cls:'rows', children:[ | ||
88 | {tag:'thead', children:[ | ||
89 | {tag:'tr', id:this.getId('thead_tr'), children:[]} | ||
90 | ]}, | ||
91 | {tag:'tbody', id:this.getId('gridRows'), children:[]} | ||
92 | ]} | ||
93 | ]}, | ||
94 | {tag:'div', cls:'noRowsBlock', id:this.getId('noRowsBlock'), children:[]} | ||
95 | ]}, | ||
96 | {tag:'div', cls:'footer'} | ||
97 | ]); | ||
98 | |||
99 | this.renderHeader(); | ||
100 | MochiKit.Signal.connect(this.getId('clearSearch'), 'onclick', this, 'clearSearchHandler'); | ||
101 | }, | ||
102 | |||
103 | //------------------------------------------------------------------------- | ||
104 | |||
105 | 'renderHeader': function () { | ||
106 | var headerElement; | ||
107 | |||
108 | headerElement = this.getElement('thead_tr'); | ||
109 | headerElement.innerHTML = ""; | ||
110 | |||
111 | MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) { | ||
112 | aColumnManager.renderHeader(headerElement); | ||
113 | }); | ||
114 | }, | ||
115 | |||
116 | //------------------------------------------------------------------------- | ||
117 | |||
118 | 'update': function (someObjects) { | ||
119 | this._rowsObjects = someObjects | ||
120 | this.refresh(); | ||
121 | this.focus(); | ||
122 | }, | ||
123 | |||
124 | 'focus': function () { | ||
125 | this.getElement('search').focus(); | ||
126 | }, | ||
127 | |||
128 | //------------------------------------------------------------------------- | ||
129 | |||
130 | 'startSearch': function () { | ||
131 | //console.log("--> startSearch"); | ||
132 | MochiKit.DOM.addElementClass(this.getElement('search'), 'running'); | ||
133 | }, | ||
134 | |||
135 | 'endSearch': function () { | ||
136 | MochiKit.DOM.removeElementClass(this.getElement('search'), 'running'); | ||
137 | //console.log("<-- startSearch"); | ||
138 | }, | ||
139 | |||
140 | //------------------------------------------------------------------------- | ||
141 | |||
142 | 'disconnectColumnManagersRowsSignals': function () { | ||
143 | MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) { | ||
144 | aColumnManager.disconnectRowsSignals(); | ||
145 | }); | ||
146 | }, | ||
147 | |||
148 | //------------------------------------------------------------------------- | ||
149 | |||
150 | 'refresh': function () { | ||
151 | var gridRowsElement; | ||
152 | var rowClass; | ||
153 | |||
154 | this.disconnectColumnManagersRowsSignals(); | ||
155 | |||
156 | { | ||
157 | MochiKit.DOM.removeElementClass(this.getElement('search'), 'disabled'); | ||
158 | // MochiKit.DOM.setNodeAttribute(this.getElement('search'), 'disabled', null); | ||
159 | MochiKit.DOM.removeElementClass(this.element(), 'empty'); | ||
160 | MochiKit.DOM.removeElementClass(this.element(), 'noRows'); | ||
161 | } | ||
162 | |||
163 | |||
164 | gridRowsElement = this.getElement('gridRows'); | ||
165 | gridRowsElement.innerHTML = ""; | ||
166 | |||
167 | MochiKit.DOM.removeElementClass(this.element(), 'empty'); | ||
168 | |||
169 | rowClass = 'odd'; | ||
170 | MochiKit.Iter.forEach(this._rowsObjects, MochiKit.Base.bind(function (aRowObject) { | ||
171 | var cardRowElement; | ||
172 | |||
173 | cardRowElement = this.append(gridRowsElement, {tag:'tr', id:this.getId(aRowObject['_reference']), cls:rowClass}); | ||
174 | MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) { | ||
175 | aColumnManager.renderCell(cardRowElement, aRowObject); | ||
176 | }); | ||
177 | |||
178 | rowClass = (rowClass == 'odd') ? 'even' : 'odd'; | ||
179 | }, this)); | ||
180 | }, | ||
181 | |||
182 | //----------------------------------------------------------------------------- | ||
183 | |||
184 | 'filterElement': function () { | ||
185 | return this.getElement('search'); | ||
186 | }, | ||
187 | |||
188 | //------------------------------------------------------------------------- | ||
189 | |||
190 | 'shouldShowElementWhileRendering': function () { | ||
191 | return false; | ||
192 | }, | ||
193 | |||
194 | //------------------------------------------------------------------------- | ||
195 | |||
196 | 'selectRow': function (aRowObject) { | ||
197 | MochiKit.DOM.addElementClass(this.getId(aRowObject['_reference']), 'selected'); | ||
198 | }, | ||
199 | |||
200 | 'unselectRow': function (aRowObject) { | ||
201 | MochiKit.DOM.removeElementClass(this.getId(aRowObject['_reference']), 'selected'); | ||
202 | }, | ||
203 | |||
204 | //------------------------------------------------------------------------- | ||
205 | /* | ||
206 | 'passOpenDirectLogin': function(aDirectLoginReferenceId) { | ||
207 | MochiKit.Signal.signal(this, 'openDirectLogin', aDirectLoginReferenceId); | ||
208 | }, | ||
209 | */ | ||
210 | //------------------------------------------------------------------------- | ||
211 | |||
212 | 'clearSearchHandler': function (anEvent) { | ||
213 | var searchElement; | ||
214 | |||
215 | anEvent.preventDefault(); | ||
216 | |||
217 | searchElement = this.getElement('search'); | ||
218 | searchElement.value = ""; | ||
219 | searchElement.focus(); | ||
220 | }, | ||
221 | |||
222 | //------------------------------------------------------------------------- | ||
223 | |||
224 | 'drawEmpty': function () { | ||
225 | this.disconnectColumnManagersRowsSignals(); | ||
226 | MochiKit.DOM.addElementClass(this.getElement('search'), 'disabled'); | ||
227 | // MochiKit.DOM.setNodeAttribute(this.getElement('search'), 'disabled', 'disabled'); | ||
228 | |||
229 | gridRowsElement = this.getElement('gridRows'); | ||
230 | gridRowsElement.innerHTML = ""; | ||
231 | MochiKit.DOM.addElementClass(this.element(), 'empty'); | ||
232 | }, | ||
233 | |||
234 | //------------------------------------------------------------------------- | ||
235 | |||
236 | 'setNoRowsGridComponent': function (aComponent) { | ||
237 | this.removeNoRowsGridComponent(); | ||
238 | this._noRowsGridComponent = aComponent; | ||
239 | |||
240 | this.disconnectColumnManagersRowsSignals(); | ||
241 | MochiKit.DOM.addElementClass(this.getElement('search'), 'disabled'); | ||
242 | // MochiKit.DOM.setNodeAttribute(this.getElement('search'), 'disabled', 'disabled'); | ||
243 | |||
244 | gridRowsElement = this.getElement('gridRows'); | ||
245 | gridRowsElement.innerHTML = ""; | ||
246 | MochiKit.DOM.addElementClass(this.element(), 'noRows'); | ||
247 | |||
248 | if (aComponent != null) { | ||
249 | aComponent.renderInNode(this.getElement('noRowsBlock')); | ||
250 | } | ||
251 | }, | ||
252 | |||
253 | 'removeNoRowsGridComponent': function () { | ||
254 | if (this._noRowsGridComponent != null) { | ||
255 | this._noRowsGridComponent.remove(); | ||
256 | this._noRowsGridComponent = null; | ||
257 | } | ||
258 | }, | ||
259 | |||
260 | //------------------------------------------------------------------------- | ||
261 | __syntaxFix__: "syntax fix" | ||
262 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ImageColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ImageColumnManager.js new file mode 100644 index 0000000..07b8dcc --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ImageColumnManager.js | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | //############################################################################# | ||
32 | |||
33 | Clipperz.PM.UI.Web.Components.ImageColumnManager = function(args) { | ||
34 | args = args || {}; | ||
35 | Clipperz.PM.UI.Web.Components.ImageColumnManager.superclass.constructor.call(this, args); | ||
36 | |||
37 | return this; | ||
38 | } | ||
39 | |||
40 | //============================================================================= | ||
41 | |||
42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.ImageColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { | ||
43 | |||
44 | 'toString': function () { | ||
45 | return "Clipperz.PM.UI.Web.Components.ImageColumnManager component"; | ||
46 | }, | ||
47 | |||
48 | //------------------------------------------------------------------------- | ||
49 | |||
50 | 'renderCell': function(aRowElement, anObject) { | ||
51 | Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ | ||
52 | {tag:'img', src:anObject[this.name()]} | ||
53 | ]}); | ||
54 | |||
55 | // return Clipperz.Async.callbacks("ImageColumnManager.renderCell", [ | ||
56 | // this.selector(), | ||
57 | // MochiKit.Base.bind(function (aValue) { | ||
58 | // Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ | ||
59 | // {tag:'img', src:aValue} | ||
60 | // ]}); | ||
61 | // }, this) | ||
62 | // ], {trace:false}, anObject); | ||
63 | }, | ||
64 | |||
65 | //----------------------------------------------------- | ||
66 | '__syntax_fix__' : 'syntax fix' | ||
67 | }); | ||
68 | |||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LinkColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LinkColumnManager.js new file mode 100644 index 0000000..e833190 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LinkColumnManager.js | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | //############################################################################# | ||
32 | |||
33 | Clipperz.PM.UI.Web.Components.LinkColumnManager = function(args) { | ||
34 | args = args || {}; | ||
35 | Clipperz.PM.UI.Web.Components.LinkColumnManager.superclass.constructor.call(this, args); | ||
36 | |||
37 | this._actionMethod = args.actionMethod || null; | ||
38 | |||
39 | return this; | ||
40 | } | ||
41 | |||
42 | //============================================================================= | ||
43 | |||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LinkColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { | ||
45 | |||
46 | 'toString': function () { | ||
47 | return "Clipperz.PM.UI.Web.Components.DateColumnManager component"; | ||
48 | }, | ||
49 | |||
50 | //------------------------------------------------------------------------- | ||
51 | |||
52 | 'actionMethod': function () { | ||
53 | return this._actionMethod; | ||
54 | }, | ||
55 | |||
56 | //------------------------------------------------------------------------- | ||
57 | |||
58 | 'renderCell': function(aRowElement, anObject) { | ||
59 | vartdElement; | ||
60 | varlinkElement; | ||
61 | |||
62 | tdElement = Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ | ||
63 | {tag:'span', children:[ | ||
64 | {tag:'a', href:'#', html:anObject[this.name()]} | ||
65 | ]} | ||
66 | ]}); | ||
67 | |||
68 | linkElement = MochiKit.DOM.getFirstElementByTagAndClassName('a', null, tdElement); | ||
69 | // MochiKit.Signal.connect(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); | ||
70 | this.connectEvent(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); | ||
71 | }, | ||
72 | |||
73 | //----------------------------------------------------- | ||
74 | |||
75 | 'handleLinkClick': function (anObject, anEvent) { | ||
76 | anEvent.preventDefault(); | ||
77 | |||
78 | if (this.actionMethod() != null) { | ||
79 | var deferredResult; | ||
80 | |||
81 | deferredResult = new Clipperz.Async.Deferred("LinkColumnManager.handleLinkClick", {trace:false}); | ||
82 | // deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'selectRow', anObject); | ||
83 | deferredResult.addCallback(this.actionMethod(), anObject, anEvent); | ||
84 | // deferredResult.addBothPass(MochiKit.Signal.signal, this, 'unselectRow', anObject); | ||
85 | deferredResult.callback(); | ||
86 | } | ||
87 | }, | ||
88 | |||
89 | //----------------------------------------------------- | ||
90 | '__syntax_fix__' : 'syntax fix' | ||
91 | }); | ||
92 | |||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js new file mode 100644 index 0000000..de20853 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js | |||
@@ -0,0 +1,203 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.LoginForm = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | this._autocomplete = args.autocomplete || 'off'; | ||
35 | |||
36 | Clipperz.PM.UI.Web.Components.LoginForm.superclass.constructor.apply(this, arguments); | ||
37 | |||
38 | this._slots = { | ||
39 | 'passphraseEntropy':this.getId('passphraseEntropy') | ||
40 | }; | ||
41 | |||
42 | return this; | ||
43 | } | ||
44 | |||
45 | //============================================================================= | ||
46 | |||
47 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
48 | |||
49 | //------------------------------------------------------------------------- | ||
50 | |||
51 | 'toString': function () { | ||
52 | return "Clipperz.PM.UI.Web.Components.LoginForm component"; | ||
53 | }, | ||
54 | |||
55 | 'autocomplete': function () { | ||
56 | return this._autocomplete; | ||
57 | }, | ||
58 | |||
59 | //------------------------------------------------------------------------- | ||
60 | |||
61 | 'renderSelf': function() { | ||
62 | this.append(this.element(), {tag:'div', id:'loginBox', children:[ | ||
63 | {tag:'div', cls:'header'}, | ||
64 | {tag:'div', cls:'body', id:this.getId('body'), children:[ | ||
65 | {tag:'div', id:this.getId('loginForm'), children:[ | ||
66 | {tag:'div', children:[ | ||
67 | {tag:'h4', html:'Login'}, | ||
68 | // {tag:'form', cls:'loginForm', autocomplete:this.autocomplete(), children:[ | ||
69 | {tag:'form', id:this.getId('form'), cls:'loginForm', children:[ | ||
70 | {tag:'label', html:'username', 'for':this.getId('usernameField')}, | ||
71 | {tag:'input', id:this.getId('usernameField'), type:'text', cls:'username'/*, value:'joe'*/}, | ||
72 | {tag:'ul', id:this.getId('passwordOptions'), children:[ | ||
73 | {tag:'li', id:this.getId('passphraseOption'), children:[ | ||
74 | {tag:'label', html:'passphrase / OTP', 'for':this.getId('passphraseField')}, | ||
75 | {tag:'input', id:this.getId('passphraseField'), type:'password', cls:'password'/*, value:'clipperz'*/} | ||
76 | ]} //, | ||
77 | /* | ||
78 | {tag:'li', id:this.getId('otpOption'), children:[ | ||
79 | {tag:'label', html:'one-time password', 'for':this.getId('otpField_1')}, | ||
80 | {tag:'input', id:this.getId('otpField_1'), type:'text', cls:'otp', value:'abcd-efgh'}, | ||
81 | {tag:'input', id:this.getId('otpField_2'), type:'text', cls:'otp', value:'abcd-efgh'}, | ||
82 | {tag:'input', id:this.getId('otpField_3'), type:'text', cls:'otp', value:'abcd-efgh'}, | ||
83 | {tag:'input', id:this.getId('otpField_4'), type:'text', cls:'otp', value:'abcd-efgh'} | ||
84 | ]} | ||
85 | */ | ||
86 | ]}, | ||
87 | // {tag:'input', id:this.getId('otpCheckbox'), type:'checkbox', cls:'checkbox'}, | ||
88 | // {tag:'label', html:'use a one-time passphrase', 'for':this.getId('otpCheckbox'), cls:'checkbox'}, | ||
89 | |||
90 | {tag:'div', cls:'translations', children:[ | ||
91 | {tag:'h4', html:'choose your language'}, | ||
92 | {tag:'ul', children:[ | ||
93 | {tag:'li', cls:'selected', html:'english'}, | ||
94 | {tag:'li', html:'italiano'}, | ||
95 | {tag:'li', html:'dutch'}, | ||
96 | {tag:'li', html:'french'}, | ||
97 | {tag:'li', html:'spanish'}, | ||
98 | {tag:'li', html:'chinese'}, | ||
99 | {tag:'li', html:'japanese'}, | ||
100 | {tag:'li', html:'portugal'}, | ||
101 | {tag:'li', html:'arabic'} | ||
102 | ]} | ||
103 | ]}, | ||
104 | |||
105 | {tag:'input', id:this.getId('submitButton'), type:'submit', value:'login', cls:'submit'} | ||
106 | ]} | ||
107 | ]} | ||
108 | ]} | ||
109 | ]}, | ||
110 | {tag:'div', cls:'footer'} | ||
111 | ]}); | ||
112 | |||
113 | if (this.autocomplete() == 'off') { | ||
114 | MochiKit.DOM.updateNodeAttributes(this.getElement('form'), {autocomplete:'off'}); | ||
115 | } | ||
116 | |||
117 | // Clipperz.Style.setBackgroundGradient(this.getElement('body'), {from:"#ff9955", to:"#ff6622"}) | ||
118 | |||
119 | // this.setEntropyDisplay(new Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay(this.getElement('passphraseField'))); | ||
120 | |||
121 | // MochiKit.Signal.connect(this.getId('otpCheckbox'), 'onclick', this, 'togglePasswordFields'); | ||
122 | // this.showPassphraseField(); | ||
123 | |||
124 | this.getElement('usernameField').focus(); | ||
125 | |||
126 | MochiKit.Signal.connect(this.getElement('loginForm'), 'onsubmit', this, 'loginEventHandler'); | ||
127 | }, | ||
128 | |||
129 | //----------------------------------------------------------------------------- | ||
130 | /* | ||
131 | 'togglePasswordFields': function(anEvent) { | ||
132 | var shouldUseOTP; | ||
133 | |||
134 | shouldUseOTP = this.getElement('otpCheckbox').checked; | ||
135 | |||
136 | if (shouldUseOTP == false) { | ||
137 | this.showPassphraseField(); | ||
138 | } else { | ||
139 | this.showOTPFields(); | ||
140 | } | ||
141 | }, | ||
142 | */ | ||
143 | //----------------------------------------------------------------------------- | ||
144 | /* | ||
145 | 'showPassphraseField': function() { | ||
146 | this.showElement('passphraseOption'); | ||
147 | this.hideElement('otpOption'); | ||
148 | }, | ||
149 | */ | ||
150 | //----------------------------------------------------------------------------- | ||
151 | |||
152 | 'focusOnPassphraseField': function () { | ||
153 | this.getElement('passphraseField').focus(); | ||
154 | this.getElement('passphraseField').select(); | ||
155 | }, | ||
156 | |||
157 | //----------------------------------------------------------------------------- | ||
158 | /* | ||
159 | 'showOTPFields': function() { | ||
160 | this.hideElement('passphraseOption'); | ||
161 | this.showElement('otpOption'); | ||
162 | }, | ||
163 | */ | ||
164 | //------------------------------------------------------------------------- | ||
165 | |||
166 | 'loginEventHandler': function(anEvent) { | ||
167 | varusername; | ||
168 | var passphrase; | ||
169 | // var shouldUseOTP; | ||
170 | // var otp; | ||
171 | var signalArguments; | ||
172 | |||
173 | anEvent.preventDefault(); | ||
174 | |||
175 | username = this.getElement('usernameField').value; | ||
176 | passphrase = this.getElement('passphraseField').value; | ||
177 | // otp =this.getElement('otpField_1').value + | ||
178 | // this.getElement('otpField_2').value + | ||
179 | // this.getElement('otpField_3').value + | ||
180 | // this.getElement('otpField_4').value; | ||
181 | // shouldUseOTP = this.getElement('otpCheckbox').checked; | ||
182 | |||
183 | signalArguments = {username:username}; | ||
184 | |||
185 | // if (shouldUseOTP) { | ||
186 | // signalArguments.otp = otp; | ||
187 | // } else { | ||
188 | signalArguments.passphrase = passphrase; | ||
189 | // } | ||
190 | |||
191 | MochiKit.Signal.signal(this, 'doLogin', signalArguments); | ||
192 | }, | ||
193 | |||
194 | //------------------------------------------------------------------------- | ||
195 | |||
196 | 'submitButtonElement': function() { | ||
197 | return this.getElement('submitButton'); | ||
198 | }, | ||
199 | |||
200 | //------------------------------------------------------------------------- | ||
201 | |||
202 | __syntaxFix__: "syntax fix" | ||
203 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginPage.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginPage.js new file mode 100644 index 0000000..49c030d --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginPage.js | |||
@@ -0,0 +1,206 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.LoginPage = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.LoginPage.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._slots = { | ||
37 | 'loginForm':this.getId('loginBoxSlot') | ||
38 | }; | ||
39 | |||
40 | return this; | ||
41 | } | ||
42 | |||
43 | //============================================================================= | ||
44 | |||
45 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginPage, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
46 | |||
47 | //------------------------------------------------------------------------- | ||
48 | |||
49 | 'toString': function () { | ||
50 | return "Clipperz.PM.UI.Web.Components.LoginPage component"; | ||
51 | }, | ||
52 | |||
53 | //------------------------------------------------------------------------- | ||
54 | |||
55 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
56 | this.append(this.element(), [ | ||
57 | {tag:'div', id:this.getId('loginBoxSlot')}, | ||
58 | {tag:'div', id:'main', children:[ | ||
59 | {tag:'div', id:'featurePoints', children:[ | ||
60 | {tag:'table', children:[ | ||
61 | {tag:'tr', children:[ | ||
62 | {tag:'td', children:[ | ||
63 | {tag:'div', cls:'block', children:[ | ||
64 | {tag:'h3', html:'Clipperz is:'}, | ||
65 | {tag:'ul', children:[ | ||
66 | {tag:'li', html:'a secure and simple password manager'}, | ||
67 | {tag:'li', html:'an effective single sign-on solution'}, | ||
68 | {tag:'li', html:'a digital vault for your personal data'} | ||
69 | ]} | ||
70 | ]}, | ||
71 | {tag:'div', cls:'block', children:[ | ||
72 | {tag:'h3', html:'Clipperz benefits:'}, | ||
73 | {tag:'ul', children:[ | ||
74 | {tag:'li', html:'free and completely anonymous'}, | ||
75 | {tag:'li', html:'access it any time from any computer'}, | ||
76 | {tag:'li', html:'no software to download and nothing to install'}, | ||
77 | {tag:'li', html:'avoid keeping secrets on your PC or on paper'} | ||
78 | ]} | ||
79 | ]} | ||
80 | ]}, {tag:'td', children:[ | ||
81 | {tag:'div', cls:'block', children:[ | ||
82 | {tag:'h3', html:'Clipperz security:'}, | ||
83 | {tag:'ul', children:[ | ||
84 | {tag:'li', html:'your secretes are locally encrypted by your browser before being uploaded to Clipperz'}, | ||
85 | {tag:'li', html:'the encryption key is a passphrase known only to you'}, | ||
86 | {tag:'li', html:'Clipperz hosts your sensitive data in an encrypted form and could never access the data in its plain form'}, | ||
87 | {tag:'li', html:'Clipperz is built upon standard encryption schemes, nothing fancies of homemade'}, | ||
88 | {tag:'li', html:'you can review the source code anytime you like, but you need to know nothing about cryptography to be an happy user!'} | ||
89 | ]} | ||
90 | ]} | ||
91 | ]} | ||
92 | ]} | ||
93 | ]} | ||
94 | ]}, | ||
95 | {tag:'div', cls:'activeFeatures', children:[ | ||
96 | {tag:'div', id:this.getId('registerButton'), cls:'createAccountLink', children:[ | ||
97 | {tag:'canvas', id:this.getId('registerButtonIcon')}, | ||
98 | {tag:'a', href:'#', id:this.getId('createAccountLink'), cls:'createAccountLink', children:[ | ||
99 | {tag:'span', cls:'payoff', html:"Free sign up!"}, | ||
100 | {tag:'span', cls:'link', html:"Create account >>"} | ||
101 | ]} | ||
102 | ]}, | ||
103 | {tag:'div', cls:'keepTogether', children:[ | ||
104 | {tag:'div', id:this.getId('screenshotLink'), cls:'screenshotLink', children:[ | ||
105 | {tag:'canvas', id:this.getId('lookIcon')}, | ||
106 | {tag:'a', href:'#', cls:'screenshotLink', children:[ | ||
107 | {tag:'span', cls:'payoff', html:"Look Clipperz!"}, | ||
108 | {tag:'span', cls:'link', html:"screenshot tour >>"} | ||
109 | ]} | ||
110 | ]}, | ||
111 | {tag:'div', id:this.getId('offlineLink'), cls:'offlineLink', children:[ | ||
112 | {tag:'canvas', id:this.getId('downloadIcon')}, | ||
113 | {tag:'a', href:'#', cls:'offlineLink', children:[ | ||
114 | {tag:'span', cls:'payoff', html:"Download!"}, | ||
115 | {tag:'span', cls:'link', html:"Offline version >>"} | ||
116 | ]} | ||
117 | ]} | ||
118 | ]} | ||
119 | ]} | ||
120 | ]} | ||
121 | ]); | ||
122 | |||
123 | this.setRegistrationButtonIconDefaultColors(); | ||
124 | this.setLookIconDefaultColors(); | ||
125 | this.setDownloadIconDefaultColors(); | ||
126 | |||
127 | // MochiKit.Signal.connect(this.getElement('createAccountLink'), 'onclick', this, 'handleCreateAccountLink') | ||
128 | |||
129 | MochiKit.Signal.connect(this.getElement('registerButton'), 'onmouseenter', this, 'handleMouseEnterOnRegisterButtonIcon'); | ||
130 | MochiKit.Signal.connect(this.getElement('registerButton'), 'onmouseleave', this, 'handleMouseLeaveOnRegisterButtonIcon'); | ||
131 | |||
132 | MochiKit.Signal.connect(this.getElement('screenshotLink'), 'onmouseenter', this, 'handleMouseEnterOnLookIcon'); | ||
133 | MochiKit.Signal.connect(this.getElement('screenshotLink'), 'onmouseleave', this, 'handleMouseLeaveOnLookIcon'); | ||
134 | |||
135 | MochiKit.Signal.connect(this.getElement('offlineLink'), 'onmouseenter', this, 'handleMouseEnterOnDownloadIcon'); | ||
136 | MochiKit.Signal.connect(this.getElement('offlineLink'), 'onmouseleave', this, 'handleMouseLeaveOnDownloadIcon'); | ||
137 | |||
138 | MochiKit.Signal.connect(this.getElement('createAccountLink'), 'onclick', this, 'handleCreateAccountLink') | ||
139 | }, | ||
140 | |||
141 | //------------------------------------------------------------------------- | ||
142 | |||
143 | 'setRegistrationButtonIconDefaultColors': function () { | ||
144 | Clipperz.PM.UI.Canvas.registerButton.normal(this.getElement('registerButtonIcon'), "#eeeeee", "#eeeeee", "#ecab12", "#e14624", "#ffffff"); | ||
145 | }, | ||
146 | |||
147 | 'setRegistrationButtonIconHoverColors': function () { | ||
148 | Clipperz.PM.UI.Canvas.registerButton.normal(this.getElement('registerButtonIcon'), "#cccccc", "#999999", "#ffb710", "#ff4d27", "#ffffff"); | ||
149 | }, | ||
150 | |||
151 | 'handleMouseEnterOnRegisterButtonIcon': function (anEvent) { | ||
152 | this.setRegistrationButtonIconHoverColors(); | ||
153 | }, | ||
154 | |||
155 | 'handleMouseLeaveOnRegisterButtonIcon': function (anEvent) { | ||
156 | this.setRegistrationButtonIconDefaultColors(); | ||
157 | }, | ||
158 | |||
159 | //------------------------------------------------------------------------- | ||
160 | |||
161 | 'setLookIconDefaultColors': function () { | ||
162 | Clipperz.PM.UI.Canvas.coverActions.look(this.getElement('lookIcon'), "#7e7e7e", "#ffffff", 1); | ||
163 | }, | ||
164 | |||
165 | 'setLookIconHoverColors': function () { | ||
166 | Clipperz.PM.UI.Canvas.coverActions.look(this.getElement('lookIcon'), "#666666", "#ffffff", 2); | ||
167 | }, | ||
168 | |||
169 | 'handleMouseEnterOnLookIcon': function (anEvent) { | ||
170 | this.setLookIconHoverColors(); | ||
171 | }, | ||
172 | |||
173 | 'handleMouseLeaveOnLookIcon': function (anEvent) { | ||
174 | this.setLookIconDefaultColors(); | ||
175 | }, | ||
176 | |||
177 | //------------------------------------------------------------------------- | ||
178 | |||
179 | 'setDownloadIconDefaultColors': function () { | ||
180 | Clipperz.PM.UI.Canvas.coverActions.download(this.getElement('downloadIcon'), "#7e7e7e", "#ffffff", 1); | ||
181 | }, | ||
182 | |||
183 | 'setDownloadIconHoverColors': function () { | ||
184 | Clipperz.PM.UI.Canvas.coverActions.download(this.getElement('downloadIcon'), "#666666", "#ffffff", 2); | ||
185 | }, | ||
186 | |||
187 | 'handleMouseEnterOnDownloadIcon': function (anEvent) { | ||
188 | this.setDownloadIconHoverColors(); | ||
189 | }, | ||
190 | |||
191 | 'handleMouseLeaveOnDownloadIcon': function (anEvent) { | ||
192 | this.setDownloadIconDefaultColors(); | ||
193 | }, | ||
194 | |||
195 | //------------------------------------------------------------------------- | ||
196 | |||
197 | 'handleCreateAccountLink': function (anEvent) { | ||
198 | anEvent.preventDefault(); | ||
199 | |||
200 | MochiKit.Signal.signal(this, 'createNewAccountClick', anEvent.src()); | ||
201 | }, | ||
202 | |||
203 | //------------------------------------------------------------------------- | ||
204 | |||
205 | __syntaxFix__: "syntax fix" | ||
206 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js new file mode 100644 index 0000000..03c7b9e --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js | |||
@@ -0,0 +1,155 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.LoginProgress = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.LoginProgress.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._deferred = null; | ||
37 | |||
38 | return this; | ||
39 | } | ||
40 | |||
41 | //============================================================================= | ||
42 | |||
43 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginProgress, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
44 | |||
45 | //------------------------------------------------------------------------- | ||
46 | |||
47 | 'toString': function () { | ||
48 | return "Clipperz.PM.UI.Web.Components.LoginProgress component"; | ||
49 | }, | ||
50 | |||
51 | //------------------------------------------------------------------------- | ||
52 | |||
53 | 'deferred': function() { | ||
54 | return this._deferred; | ||
55 | }, | ||
56 | |||
57 | 'setDeferred': function(aValue) { | ||
58 | this._deferred = aValue; | ||
59 | }, | ||
60 | |||
61 | //------------------------------------------------------------------------- | ||
62 | |||
63 | 'renderSelf': function() { | ||
64 | // var loginProgressElement; | ||
65 | // | ||
66 | // loginProgressElement = MochiKit.DOM.getElement('loginProgress'); | ||
67 | // | ||
68 | // if (loginProgressElement == null) { | ||
69 | // loginProgressElement = this.append(this.element(), {tag:'div', id:'loginProgress', cls:'LoginProgress'}, true); | ||
70 | // } | ||
71 | |||
72 | //console.log(">> LoginProgress.renderSelf", this.element()); | ||
73 | this.append(this.element(), {tag:'div', id:'loginProgress', cls:'LoginProgress', children: [ | ||
74 | // this.append(loginProgressElement, [ | ||
75 | {tag:'div', cls:'header', children:[ | ||
76 | {tag:'h3', id:this.getId('title'), html:"login progress"} | ||
77 | ]}, | ||
78 | {tag:'div', cls:'body', children:[ | ||
79 | {tag:'div', id:this.getId('progressBar')}, | ||
80 | {tag:'div', id:this.getId('errorBox'), cls:'errorBox', children:[ | ||
81 | // {tag:'div',cls:'img ALERT', children:[{tag:'div'}]}, | ||
82 | {tag:'div',cls:'img ALERT', children:[{tag:'canvas', id:this.getId('canvas')}]}, | ||
83 | {tag:'p', html:"Login failed"} | ||
84 | ]} | ||
85 | ]}, | ||
86 | {tag:'div', cls:'footer', children:[ | ||
87 | {tag:'div', cls:'buttonArea', id:this.getId('buttonArea'), children:[ | ||
88 | {tag:'div', cls:'button', id:this.getId('button'), children:[ | ||
89 | {tag:'a', href:'#', id:this.getId('buttonLink'), html:"cancel"} | ||
90 | ]} | ||
91 | ]} | ||
92 | ]} | ||
93 | ]}); | ||
94 | // ]); | ||
95 | |||
96 | Clipperz.PM.UI.Canvas.marks['!'](this.getElement('canvas'), "#ffffff"); | ||
97 | |||
98 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); | ||
99 | MochiKit.Style.hideElement(this.getElement('errorBox')); | ||
100 | |||
101 | MochiKit.Signal.connect(this.getId('buttonLink'), 'onclick', this, 'cancelEventHandler'); | ||
102 | }, | ||
103 | |||
104 | //------------------------------------------------------------------------- | ||
105 | |||
106 | 'displayElement': function() { | ||
107 | return MochiKit.DOM.getElement('loginProgress'); | ||
108 | }, | ||
109 | |||
110 | //------------------------------------------------------------------------- | ||
111 | |||
112 | 'cancelEventHandler': function(anEvent) { | ||
113 | anEvent.preventDefault(); | ||
114 | |||
115 | MochiKit.Signal.signal(this, 'cancelEvent'); | ||
116 | }, | ||
117 | |||
118 | //------------------------------------------------------------------------- | ||
119 | |||
120 | 'disableCancel': function() { | ||
121 | MochiKit.Style.hideElement(this.getElement('buttonArea')); | ||
122 | }, | ||
123 | |||
124 | //------------------------------------------------------------------------- | ||
125 | |||
126 | 'showErrorMessage': function() { | ||
127 | this.getElement('buttonLink').innerHTML = "close"; | ||
128 | |||
129 | MochiKit.Style.hideElement(this.getElement('progressBar')); | ||
130 | |||
131 | this.getElement('title').innerHTML = "Error"; | ||
132 | MochiKit.Style.showElement(this.getElement('errorBox')); | ||
133 | MochiKit.Style.showElement(this.getElement('buttonArea')); | ||
134 | }, | ||
135 | |||
136 | //------------------------------------------------------------------------- | ||
137 | |||
138 | 'deferredHideModalAndRemove': function(someParameters, aResult) { | ||
139 | vardeferredResult; | ||
140 | |||
141 | deferredResult = new Clipperz.Async.Deferred("LoginProgress.deferredHideModalAndRemove", {trace:false}); | ||
142 | deferredResult.addMethod(this, 'deferredHideModal'); | ||
143 | deferredResult.addMethod(this, 'remove'); | ||
144 | deferredResult.addCallback(function () { | ||
145 | return aResult; | ||
146 | }); | ||
147 | deferredResult.callback(someParameters); | ||
148 | |||
149 | return deferredResult; | ||
150 | }, | ||
151 | |||
152 | //------------------------------------------------------------------------- | ||
153 | |||
154 | __syntaxFix__: "syntax fix" | ||
155 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/NewUserCreationComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/NewUserCreationComponent.js new file mode 100644 index 0000000..b40d1f3 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/NewUserCreationComponent.js | |||
@@ -0,0 +1,430 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.NewUserCreationComponent = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.NewUserCreationComponent.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._tabPanelController = null; | ||
37 | |||
38 | this._initiallySelectedTab = args.selected || 'CREDENTIALS'; | ||
39 | this._tabPanelControllerConfiguration = { | ||
40 | 'CREDENTIALS': { | ||
41 | tab:'credentialsTab', | ||
42 | panel:'credentialsTabpanel' | ||
43 | }, | ||
44 | 'CHECK_CREDENTIALS': { | ||
45 | tab:'checkCredentialsTab', | ||
46 | panel:'checkCredentialsTabpanel' | ||
47 | }, | ||
48 | 'TERMS_OF_SERVICE': { | ||
49 | tab:'termsOfServiceTab', | ||
50 | panel:'termsOfServiceTabpanel' | ||
51 | }, | ||
52 | 'CREATE_USER': { | ||
53 | tab:'createUserTab', | ||
54 | panel:'createUserTabpanel' | ||
55 | }//, | ||
56 | /* | ||
57 | 'LOGIN': { | ||
58 | tab:'loginTab', | ||
59 | panel:'loginTabpanel' | ||
60 | } | ||
61 | */ | ||
62 | }; | ||
63 | |||
64 | return this; | ||
65 | } | ||
66 | |||
67 | //============================================================================= | ||
68 | |||
69 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.NewUserCreationComponent, Clipperz.PM.UI.Common.Components.TabPanelComponent, { | ||
70 | |||
71 | //------------------------------------------------------------------------- | ||
72 | |||
73 | 'toString': function () { | ||
74 | return "Clipperz.PM.UI.Web.Components.NewUserCreationComponent component"; | ||
75 | }, | ||
76 | |||
77 | //========================================================================= | ||
78 | |||
79 | 'disableAllPanels': function () { | ||
80 | this.tabPanelController().selectTab(null); | ||
81 | }, | ||
82 | |||
83 | //------------------------------------------------------------------------- | ||
84 | |||
85 | 'enableCredentialsPanel': function () { | ||
86 | this.tabPanelController().selectTab('CREDENTIALS'); | ||
87 | }, | ||
88 | |||
89 | 'enableCheckCredentialsPanel': function () { | ||
90 | this.tabPanelController().selectTab('CHECK_CREDENTIALS'); | ||
91 | }, | ||
92 | |||
93 | 'enableTermsOfServicePanel': function () { | ||
94 | this.tabPanelController().selectTab('TERMS_OF_SERVICE'); | ||
95 | }, | ||
96 | |||
97 | 'enableCreateUserPanel': function () { | ||
98 | this.tabPanelController().selectTab('CREATE_USER'); | ||
99 | }, | ||
100 | |||
101 | //'enableLoginPanel': function () { | ||
102 | // this.tabPanelController().selectTab('LOGIN'); | ||
103 | //}, | ||
104 | |||
105 | //========================================================================= | ||
106 | |||
107 | 'shouldShowElementWhileRendering': function() { | ||
108 | return false; | ||
109 | }, | ||
110 | |||
111 | //========================================================================= | ||
112 | |||
113 | 'tabPanelController': function () { | ||
114 | if (this._tabPanelController == null) { | ||
115 | this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({ | ||
116 | component:this, | ||
117 | configuration:this._tabPanelControllerConfiguration | ||
118 | }); | ||
119 | |||
120 | MochiKit.Signal.connect(this._tabPanelController, 'tabSelected', this, 'handleTabSelected') | ||
121 | } | ||
122 | |||
123 | return this._tabPanelController; | ||
124 | }, | ||
125 | |||
126 | //------------------------------------------------------------------------- | ||
127 | |||
128 | 'renderSelf': function() { | ||
129 | //console.log('** Clipperz.targetModalDimensionsAndPosition', Clipperz.Base.serializeJSON(Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition)); | ||
130 | |||
131 | this.append(this.element(), {tag:'div', cls:'NewUserCreation mainDialog', id:this.getId('panel'), children: [ | ||
132 | {tag:'form', id:this.getId('form'), cls:'newUserCreationForm', children:[ | ||
133 | {tag:'div', cls:'header', children:[ | ||
134 | {tag:'div', cls:'title', children:[ | ||
135 | {tag:'h3', id:this.getId('title'), html:"Create new user"} | ||
136 | ]} | ||
137 | ]}, | ||
138 | {tag:'div', id:this.getId('body'), cls:'body', children:[ | ||
139 | {tag:'div', cls:'tabContainer', children:[ | ||
140 | {tag:'ul', cls:'tabs', children:[ | ||
141 | {tag:'li', id:this.getId('credentialsTab'), children:[{tag:'span', html:"credentials"}]}, | ||
142 | {tag:'li', id:this.getId('checkCredentialsTab'),children:[{tag:'span', html:"credentials check"}]}, | ||
143 | {tag:'li', id:this.getId('termsOfServiceTab'), children:[{tag:'span', html:"terms of service"}]}, | ||
144 | {tag:'li', id:this.getId('createUserTab'), children:[{tag:'span', html:"create user"}]}//, | ||
145 | // {tag:'li', id:this.getId('loginTab'), children:[{tag:'span', html:"login"}]}, | ||
146 | ]}, | ||
147 | {tag:'ul', cls:'tabPanels', children:[ | ||
148 | {tag:'li', id:this.getId('credentialsTabpanel'), cls:'tabPanel credentials', children:[ | ||
149 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.NewUserWizard.CREDENTIALS.description')}]}, | ||
150 | {tag:'ul', cls:'credentials', children:[ | ||
151 | {tag:'li', children:[{tag:'span', cls:'label', html:"username"},{tag:'input', type:'text', id:this.getId('username')/*, value:'test'*/}]}, | ||
152 | {tag:'li', children:[{tag:'span', cls:'label', html:"passphrase"},{tag:'input', type:'password', id:this.getId('passphrase')/*, value:'test'*/}]} | ||
153 | ]} | ||
154 | ]}, | ||
155 | {tag:'li', id:this.getId('checkCredentialsTabpanel'), cls:'tabPanel checkCredentials', children:[ | ||
156 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.NewUserWizard.CHECK_CREDENTIALS.description')}]}, | ||
157 | {tag:'ul', cls:'credentials', children:[ | ||
158 | {tag:'li', children:[{tag:'span', cls:'label', html:"re-passphrase"},{tag:'input', type:'password', id:this.getId('re-passphrase')/*, value:'test'*/}]} | ||
159 | ]} | ||
160 | ]}, | ||
161 | {tag:'li', id:this.getId('termsOfServiceTabpanel'), cls:'tabPanel termsOfService', children:[ | ||
162 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.NewUserWizard.TERMS_OF_SERVICE.description')}]}, | ||
163 | {tag:'ul', cls:'termsOfService', children:[ | ||
164 | {tag:'li', children:[{tag:'input', type:'checkbox', id:this.getId('awareOfUnrecoverablePassphrase')/*, checked:true*/}, {tag:'label', cls:'label', 'for':this.getId('awareOfUnrecoverablePassphrase'), html:"I understand that Clipperz will not be able to recover a lost passphrase."}]}, | ||
165 | {tag:'li', children:[{tag:'input', type:'checkbox', id:this.getId('readTermsOfService')/*, checked:true*/}, {tag:'label', cls:'label', 'for':this.getId('readTermsOfService'), htmlString:"I have read and agreed to the <a href='http://www.clipperz.com/terms_of_service' target='_blank'>Terms of Service</a>."}]} | ||
166 | ]} | ||
167 | ]}, | ||
168 | {tag:'li', id:this.getId('createUserTabpanel'), cls:'tabPanel createUser', children:[ | ||
169 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.NewUserWizard.CREATE_USER.description')}]}, | ||
170 | {tag:'ul', cls:'createUserStates', children:[ | ||
171 | {tag:'li', cls:'creating', id:this.getId('creatingRegistering'), children:[{tag:'span', html:"registering user"}]}, | ||
172 | {tag:'li', cls:'done', id:this.getId('creatingDone'), children:[{tag:'span', html:"done"}]}, | ||
173 | {tag:'li', cls:'fail', id:this.getId('creatingFailed'), children:[{tag:'span', html:"fail"}]} | ||
174 | ]} | ||
175 | ]}//, | ||
176 | // {tag:'li', id:this.getId('loginTabpanel'), cls:'tabPanel login', children:[ | ||
177 | // {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.NewUserWizard.LOGIN.description')}]}, | ||
178 | // ]} | ||
179 | ]} | ||
180 | ]} | ||
181 | ]}, | ||
182 | {tag:'div', id:this.getId('footer'), cls:'footer', children:[ | ||
183 | {tag:'div', cls:'buttonArea', children:[ | ||
184 | // {tag:'div', cls:'cancel', id:this.getId('cancelButton'), html:"cancel"}, | ||
185 | // {tag:'div', cls:'save disabled', id:this.getId('saveButton'), html:"save"} | ||
186 | ]} | ||
187 | ]} | ||
188 | ]}, | ||
189 | {tag:'div', cls:'clear'} | ||
190 | ]}); | ||
191 | |||
192 | this.tabPanelController().setup(); | ||
193 | // MochiKit.Signal.connect(this.getId('panel'), 'onkeydown', this, 'handleKeyEvent'); | ||
194 | MochiKit.Signal.connect(MochiKit.DOM.currentDocument().body, 'onkeydown', this, 'handleKeyEvent'); | ||
195 | MochiKit.Signal.connect(this.getId('awareOfUnrecoverablePassphrase'), 'onchange', this, 'handleTermsOfServiceCheckboxChange'); | ||
196 | MochiKit.Signal.connect(this.getId('readTermsOfService'), 'onchange', this, 'handleTermsOfServiceCheckboxChange'); | ||
197 | }, | ||
198 | |||
199 | //------------------------------------------------------------------------- | ||
200 | /* | ||
201 | 'resetContent': function () { | ||
202 | this.getElement('username').value = ''; | ||
203 | this.getElement('passphrase').value = ''; | ||
204 | }, | ||
205 | */ | ||
206 | //------------------------------------------------------------------------- | ||
207 | |||
208 | 'displayElement': function() { | ||
209 | return this.getElement('panel'); | ||
210 | }, | ||
211 | |||
212 | //------------------------------------------------------------------------- | ||
213 | |||
214 | 'handleTabSelected': function (aSelectedTab) { | ||
215 | /* | ||
216 | switch (aSelectedTab) { | ||
217 | case 'DETAILS': | ||
218 | break; | ||
219 | case 'DIRECT_LOGINS': | ||
220 | MochiKit.Style.hideElement(this.getElement('backToDirectLoginList')); | ||
221 | break; | ||
222 | case 'SHARING': | ||
223 | break; | ||
224 | } | ||
225 | */ | ||
226 | }, | ||
227 | |||
228 | //========================================================================= | ||
229 | |||
230 | 'username': function () { | ||
231 | return this.getElement('username').value; | ||
232 | }, | ||
233 | |||
234 | 'usernameElement': function () { | ||
235 | return this.getElement('username'); | ||
236 | }, | ||
237 | |||
238 | 'passphrase': function () { | ||
239 | return this.getElement('passphrase').value; | ||
240 | }, | ||
241 | |||
242 | 'rePassphrase': function () { | ||
243 | return this.getElement('re-passphrase').value; | ||
244 | }, | ||
245 | |||
246 | 'awareOfUnrecoverablePassphrase': function () { | ||
247 | return this.getElement('awareOfUnrecoverablePassphrase').value; | ||
248 | }, | ||
249 | |||
250 | 'readTermsOfService': function () { | ||
251 | return this.getElement('readTermsOfService').value; | ||
252 | }, | ||
253 | |||
254 | //========================================================================= | ||
255 | /* | ||
256 | 'incrementUpdateFaviconCounter': function () { | ||
257 | this._updateFaviconCounter ++; | ||
258 | }, | ||
259 | |||
260 | 'decrementUpdateFaviconCounter': function () { | ||
261 | this._updateFaviconCounter --; | ||
262 | }, | ||
263 | |||
264 | 'updateFaviconCounter': function () { | ||
265 | return this._updateFaviconCounter; | ||
266 | }, | ||
267 | */ | ||
268 | //------------------------------------------------------------------------- | ||
269 | /* | ||
270 | 'updateFavicon': function () { | ||
271 | this.decrementUpdateFaviconCounter(); | ||
272 | |||
273 | if (this.updateFaviconCounter() == 0) { | ||
274 | this.setFavicon(this.favicon()); | ||
275 | } | ||
276 | }, | ||
277 | */ | ||
278 | //========================================================================= | ||
279 | /* | ||
280 | 'bindingComponents': function () { | ||
281 | return this._bindingComponents; | ||
282 | }, | ||
283 | |||
284 | 'clearAllBindingsComponents': function () { | ||
285 | MochiKit.Iter.forEach(this.bindingComponents(), MochiKit.Base.methodcaller('remove')); | ||
286 | this._bindingComponents = []; | ||
287 | this.getElement('bindings').innerHTML = ''; | ||
288 | }, | ||
289 | |||
290 | 'addBindingComponent': function (aBindingComponent) { | ||
291 | this.bindingComponents().push(aBindingComponent); | ||
292 | aBindingComponent.renderInNode(this.append(this.getElement('bindings'), {tag:'div'})); | ||
293 | }, | ||
294 | */ | ||
295 | //========================================================================= | ||
296 | /* | ||
297 | 'formValueComponents': function () { | ||
298 | return this._formValueComponents; | ||
299 | }, | ||
300 | |||
301 | 'clearAllFormValueComponents': function () { | ||
302 | MochiKit.Iter.forEach(this.formValueComponents(), MochiKit.Base.methodcaller('remove')); | ||
303 | this._formValueComponents = []; | ||
304 | this.getElement('formValues').innerHTML = ''; | ||
305 | }, | ||
306 | |||
307 | 'addFormValueComponent': function (aFormValueComponent) { | ||
308 | this.formValueComponents().push(aFormValueComponent); | ||
309 | aFormValueComponent.renderInNode(this.append(this.getElement('formValues'), {tag:'div'})); | ||
310 | }, | ||
311 | */ | ||
312 | //========================================================================= | ||
313 | |||
314 | 'changedValue': function (anEvent) { | ||
315 | MochiKit.Signal.signal(this, 'changedValue', anEvent); | ||
316 | |||
317 | this.incrementUpdateFaviconCounter(); | ||
318 | MochiKit.Async.callLater(1, MochiKit.Base.method(this, 'updateFavicon')); | ||
319 | }, | ||
320 | |||
321 | //------------------------------------------------------------------------- | ||
322 | |||
323 | 'handleBackClick': function (anEvent) { | ||
324 | anEvent.preventDefault(); | ||
325 | |||
326 | MochiKit.Signal.signal(this, 'back'); | ||
327 | }, | ||
328 | |||
329 | //========================================================================= | ||
330 | |||
331 | 'bottomMargin': function () { | ||
332 | var result; | ||
333 | |||
334 | //TODO: WTF!!! | ||
335 | // result =MochiKit.Style.getElementPosition(this.element())['y'] + | ||
336 | // MochiKit.Style.getElementDimensions(this.element())['h']; | ||
337 | |||
338 | // result =MochiKit.Style.getElementPosition(this.getElement('footer'))['y']; | ||
339 | //console.log("### bottomMargin"); | ||
340 | //console.log('displayElement', this.displayElement()); | ||
341 | //console.log('-- Clipperz.targetModalDimensionsAndPosition', Clipperz.Base.serializeJSON(Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition)); | ||
342 | //console.log('element', MochiKit.Style.getElementPosition('modalDialog') ['y'], MochiKit.Style.getElementDimensions('modalDialog')['h']); | ||
343 | // result = 450; | ||
344 | |||
345 | result =Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition['position']['y'] + | ||
346 | Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition['dimensions']['h'] - | ||
347 | 60; | ||
348 | |||
349 | return result; | ||
350 | }, | ||
351 | |||
352 | //========================================================================= | ||
353 | |||
354 | 'focusOnUsernameElement': function () { | ||
355 | MochiKit.Async.callLater(0.1, MochiKit.Base.method(this.getElement('username'), 'focus')); | ||
356 | }, | ||
357 | |||
358 | 'focusOnRePassphraseElement': function () { | ||
359 | this.getElement('re-passphrase').focus(); | ||
360 | }, | ||
361 | /* | ||
362 | 'focusOnBookmarkletConfigurationElement': function () { | ||
363 | this.getElement('bookmarkletConfiguration').focus(); | ||
364 | }, | ||
365 | |||
366 | 'focusOnFaviconElement': function () { | ||
367 | this.getElement('faviconURL').focus(); | ||
368 | }, | ||
369 | */ | ||
370 | |||
371 | //========================================================================= | ||
372 | |||
373 | 'hideAllProgeressStates': function () { | ||
374 | MochiKit.Style.hideElement(this.getElement('creatingRegistering')); | ||
375 | MochiKit.Style.hideElement(this.getElement('creatingDone')); | ||
376 | MochiKit.Style.hideElement(this.getElement('creatingFailed')); | ||
377 | }, | ||
378 | |||
379 | 'showProgressOnUserCreation': function () { | ||
380 | //Clipperz.log(">>> NewUserCreationComponent.showProgressOnUserCreation"); | ||
381 | this.hideAllProgeressStates(); | ||
382 | MochiKit.Style.showElement(this.getElement('creatingRegistering')); | ||
383 | }, | ||
384 | |||
385 | 'showUserCreationDone': function () { | ||
386 | //Clipperz.log(">>> NewUserCreationComponent.showUserCreationDone"); | ||
387 | this.hideAllProgeressStates(); | ||
388 | MochiKit.Style.showElement(this.getElement('creatingDone')); | ||
389 | //Clipperz.log("<<< NewUserCreationComponent.showUserCreationDone"); | ||
390 | }, | ||
391 | |||
392 | 'showUserCreationFailed': function () { | ||
393 | //Clipperz.log(">>> NewUserCreationComponent.showUserCreationFailed"); | ||
394 | this.hideAllProgeressStates(); | ||
395 | MochiKit.Style.showElement(this.getElement('creatingFailed')); | ||
396 | }, | ||
397 | |||
398 | //========================================================================= | ||
399 | |||
400 | 'handleKeyEvent': function (anEvent) { | ||
401 | MochiKit.Signal.signal(this, 'keyPressed', anEvent); | ||
402 | /* | ||
403 | if (anEvent.key().string == 'KEY_ENTER') { | ||
404 | if (anEvent.target().nodeName != 'TEXTAREA') { | ||
405 | MochiKit.Signal.signal(this, 'moveForward'); | ||
406 | anEvent.preventDefault(); | ||
407 | } | ||
408 | } else if (anEvent.key().string == 'KEY_TAB') { | ||
409 | if ((anEvent.target().nodeName == 'INPUT') || (anEvent.target().nodeName == 'TEXTAREA')) { | ||
410 | MochiKit.Signal.signal(this, 'moveForward'); | ||
411 | anEvent.preventDefault(); | ||
412 | } | ||
413 | } | ||
414 | */ | ||
415 | }, | ||
416 | |||
417 | 'handleTermsOfServiceCheckboxChange': function (anEvent) { | ||
418 | MochiKit.Signal.signal(this, 'changedValue'); | ||
419 | }, | ||
420 | |||
421 | //========================================================================= | ||
422 | |||
423 | 'clear': function () { | ||
424 | this.tabPanelController().selectTab(null); | ||
425 | Clipperz.PM.UI.Web.Components.NewUserCreationComponent.superclass.clear.apply(this, arguments); | ||
426 | }, | ||
427 | |||
428 | //========================================================================= | ||
429 | __syntaxFix__: "syntax fix" | ||
430 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/Page.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/Page.js new file mode 100644 index 0000000..bed6675 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/Page.js | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.Page = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.Page.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._slots = { | ||
37 | 'header':'pageHeader', | ||
38 | 'body': 'pageBody', | ||
39 | 'footer':'pageFooter' | ||
40 | }; | ||
41 | |||
42 | return this; | ||
43 | } | ||
44 | |||
45 | //============================================================================= | ||
46 | |||
47 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.Page, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
48 | |||
49 | //------------------------------------------------------------------------- | ||
50 | |||
51 | 'toString': function () { | ||
52 | return "Clipperz.PM.UI.Web.Components.Page component"; | ||
53 | }, | ||
54 | |||
55 | //------------------------------------------------------------------------- | ||
56 | |||
57 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
58 | this.append(this.element(), [ | ||
59 | {tag:'div', id:'pageHeaderAndBody', cls:'pageHeaderAndBody', children:[ | ||
60 | {tag:'div', id:'pageHeader', cls:'pageHeader'}, | ||
61 | {tag:'div', id:'pageBody', cls:'pageBody'} | ||
62 | ]}, | ||
63 | {tag:'div', id:'pageFooter', cls:'pageFooter'} | ||
64 | ]); | ||
65 | |||
66 | }, | ||
67 | |||
68 | //------------------------------------------------------------------------- | ||
69 | |||
70 | __syntaxFix__: "syntax fix" | ||
71 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageFooter.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageFooter.js new file mode 100644 index 0000000..11135d8 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageFooter.js | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.PageFooter = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.PageFooter.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | return this; | ||
37 | } | ||
38 | |||
39 | //============================================================================= | ||
40 | |||
41 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.PageFooter, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
42 | |||
43 | //------------------------------------------------------------------------- | ||
44 | |||
45 | 'toString': function () { | ||
46 | return "Clipperz.PM.UI.Web.Components.PageFooter component"; | ||
47 | }, | ||
48 | |||
49 | //------------------------------------------------------------------------- | ||
50 | |||
51 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
52 | this.append(this.element(), [ | ||
53 | {tag:'div', cls:'footerWrapper', children:[ | ||
54 | {tag:'div', cls:'footerContent', children:[ | ||
55 | // {tag:'div', cls:'footerStarIcon'}, | ||
56 | {tag:'canvas', id:this.getId('footerStarIcon'), cls:'footerStarIcon'}, | ||
57 | {tag:'span', cls:'copyright', html:'Copyright © 2009 Clipperz Srl'}, | ||
58 | {tag:'a', href:'http://www.clipperz.com/terms_of_service',target:'_blank', html:'terms of service'}, | ||
59 | {tag:'a', href:'http://www.clipperz.com/privacy_policy',target:'_blank', html:'privacy policy'}, | ||
60 | {tag:'span', cls:'applicationVersion', html:'application version: [1992]'} | ||
61 | ]} | ||
62 | ]} | ||
63 | ]); | ||
64 | |||
65 | Clipperz.PM.UI.Canvas.star.normal(this.getElement('footerStarIcon'), "#7e7e7e"); | ||
66 | }, | ||
67 | |||
68 | //------------------------------------------------------------------------- | ||
69 | |||
70 | __syntaxFix__: "syntax fix" | ||
71 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageHeader.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageHeader.js new file mode 100644 index 0000000..3924434 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageHeader.js | |||
@@ -0,0 +1,184 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.PageHeader = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.PageHeader.superclass.constructor.apply(this, arguments); | ||
35 | this._newsIsOpen = args.newsIsOpen || false; | ||
36 | this._animationDuration = args.animationDuration || 0.5; | ||
37 | |||
38 | this._offset = 82; | ||
39 | |||
40 | return this; | ||
41 | } | ||
42 | |||
43 | //============================================================================= | ||
44 | |||
45 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.PageHeader, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
46 | |||
47 | //------------------------------------------------------------------------- | ||
48 | |||
49 | 'toString': function () { | ||
50 | return "Clipperz.PM.UI.Web.Components.PageHeader component"; | ||
51 | }, | ||
52 | |||
53 | //------------------------------------------------------------------------- | ||
54 | |||
55 | 'iframeURL': function () { | ||
56 | // return './rss_view.html'; | ||
57 | return 'http://www.clipperz.com/files/clipperz.com/appTips/index.html'; | ||
58 | }, | ||
59 | |||
60 | //------------------------------------------------------------------------- | ||
61 | |||
62 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
63 | this.append(this.element(), [ | ||
64 | {tag:'div', id:'miscLinks', children:[ | ||
65 | {tag:'ul', children:[ | ||
66 | {tag:'li', children:[{tag:'a', id:'donateHeaderLink', stringID:'pageHeader.donation', href:'http://www.clipperz.com/donations', target:'_blank', html:Clipperz.PM.Strings.getValue('pageHeader.donation')}]}, | ||
67 | {tag:'li', children:[{tag:'a', id:'forumHeaderLink', stringID:'pageHeader.forum', href:'http://www.clipperz.com/forum', target:'_blank', html:Clipperz.PM.Strings.getValue('pageHeader.forum')}]}, | ||
68 | {tag:'li', children:[{tag:'a', id:'creditsHeaderLink', stringID:'pageHeader.credits', href:'http://www.clipperz.com/credits', target:'_blank', html:Clipperz.PM.Strings.getValue('pageHeader.credits')}]}, | ||
69 | {tag:'li', children:[{tag:'a', id:'feedbackHeaderLink', stringID:'pageHeader.feedback', href:'http://www.clipperz.com/contact', target:'_blank', html:Clipperz.PM.Strings.getValue('pageHeader.feedback')}]}, | ||
70 | {tag:'li', children:[{tag:'a', id:'helpHeaderLink', stringID:'pageHeader.help', href:'http://www.clipperz.com/support/user_guide',target:'_blank', html:Clipperz.PM.Strings.getValue('pageHeader.help')}]} | ||
71 | ]} | ||
72 | ]}, | ||
73 | {tag:'div', id:'logoFrame', children:[ | ||
74 | {tag:'a', href:'http://www.clipperz.com', target:'_blank', children:[{tag:'div', id:'logo'}]}, | ||
75 | {tag:'h5', cls:'clipperzPayoff', html:'keep it to yourself!'} | ||
76 | ]}, | ||
77 | {tag:'div', id:'news', cls:'hidden', children:[ | ||
78 | // {tag:'div', cls:'close', children:[ | ||
79 | // {tag:'a', href:'#', id:this.getId('closeTips'), html:'x'} | ||
80 | // ]}, | ||
81 | {tag:'div', id:'newsframe', children:[ | ||
82 | {tag:'iframe', id:this.getId('iframe'), src:this.iframeURL()} | ||
83 | ]}, | ||
84 | {tag:'div', id:this.getId('newsGrip'), cls:'grip', children:[]} | ||
85 | ]}, | ||
86 | {tag:'div', id:'featureTabs', children:[ | ||
87 | {tag:'table', children:[{tag:'tr', children:[ | ||
88 | {tag:'td', children:[{tag:'div', id:'feature_store', children:[{tag:'canvas', cls:'featureIcon', id:this.getId('storeIcon')}, {tag:'span', html:"Store and manage your password and online credentials"}]}]}, | ||
89 | {tag:'td', children:[{tag:'div', id:'feature_protect', children:[{tag:'canvas', cls:'featureIcon', id:this.getId('protectIcon')}, {tag:'span', html:"Protect all your sensitive data"}]}]}, | ||
90 | {tag:'td', children:[{tag:'div', id:'feature_directLogin', children:[{tag:'canvas', cls:'featureIcon', id:this.getId('directLoginIcon')},{tag:'span', html:"Login to your web services without entering any username or password"}]}]}, | ||
91 | {tag:'td', children:[{tag:'div', id:'feature_share', children:[{tag:'canvas', cls:'featureIcon', id:this.getId('shareIcon')}, {tag:'span', html:"Share secret with family members and associates"}]}]} | ||
92 | ]}]} | ||
93 | ]} | ||
94 | ]); | ||
95 | |||
96 | Clipperz.PM.UI.Canvas.features.store(this.getElement('storeIcon'), "#ffffff"); | ||
97 | Clipperz.PM.UI.Canvas.features.protect(this.getElement('protectIcon'), "#ffffff"); | ||
98 | Clipperz.PM.UI.Canvas.features.directLogin(this.getElement('directLoginIcon'), "#ffffff"); | ||
99 | Clipperz.PM.UI.Canvas.features.share(this.getElement('shareIcon'), "#ffffff", "#ffffff", "#ff0000"); | ||
100 | |||
101 | MochiKit.Signal.connect(this.getElement('newsGrip'), 'onclick', this, 'toggleTips'); | ||
102 | MochiKit.Signal.connect(this.getElement('iframe'), 'onload', this, 'handleIframeDidLoad'); | ||
103 | }, | ||
104 | |||
105 | //------------------------------------------------------------------------- | ||
106 | |||
107 | 'switchToLoggedMode': function() { | ||
108 | // MochiKit.Style.addElementClass(this.element(), 'logged'); | ||
109 | MochiKit.Style.hideElement('featureTabs'); | ||
110 | }, | ||
111 | |||
112 | //------------------------------------------------------------------------- | ||
113 | |||
114 | 'animationDuration': function () { | ||
115 | return this._animationDuration; | ||
116 | }, | ||
117 | |||
118 | 'offset': function () { | ||
119 | return this._offset; | ||
120 | }, | ||
121 | |||
122 | //------------------------------------------------------------------------- | ||
123 | |||
124 | 'isNewsOpen': function () { | ||
125 | return this._newsIsOpen; | ||
126 | }, | ||
127 | |||
128 | 'toggleNewsIsOpen': function () { | ||
129 | this._newsIsOpen = !this._newsIsOpen; | ||
130 | }, | ||
131 | |||
132 | 'toggleTips': function(anEvent) { | ||
133 | anEvent.preventDefault(); | ||
134 | |||
135 | if (this.isNewsOpen() == true) { | ||
136 | MochiKit.Visual.Move(Clipperz.DOM.get('news'), { | ||
137 | x: 0, | ||
138 | y: -this.offset(), | ||
139 | mode: 'relative', | ||
140 | duration: this.animationDuration(), | ||
141 | beforeStart: function () { | ||
142 | MochiKit.DOM.setElementClass(Clipperz.DOM.get('news'), 'hiding'); | ||
143 | }, | ||
144 | afterFinish: function () { | ||
145 | Clipperz.DOM.get('newsframe').innerHTML = ""; | ||
146 | MochiKit.DOM.setElementClass(Clipperz.DOM.get('news'), 'hidden'); | ||
147 | } | ||
148 | }) | ||
149 | this.toggleNewsIsOpen(); | ||
150 | } else { | ||
151 | MochiKit.DOM.addElementClass('newsframe', 'loading'); | ||
152 | MochiKit.Visual.Move(Clipperz.DOM.get('news'), { | ||
153 | x: 0, | ||
154 | y: this.offset(), | ||
155 | mode: 'relative', | ||
156 | duration: this.animationDuration(), | ||
157 | beforeStart: MochiKit.Base.bind(function () { | ||
158 | this.append(Clipperz.DOM.get('newsframe'), {tag:'iframe', id:this.getId('iframe'), src:this.iframeURL()}); | ||
159 | |||
160 | MochiKit.Signal.connect(this.getElement('iframe'), 'onload', this, 'handleIframeDidLoad'); | ||
161 | MochiKit.DOM.setElementClass(Clipperz.DOM.get('news'), 'opening'); | ||
162 | }, this), | ||
163 | afterFinish: function () { | ||
164 | MochiKit.DOM.setElementClass(Clipperz.DOM.get('news'), 'open'); | ||
165 | } | ||
166 | }) | ||
167 | this.toggleNewsIsOpen(); | ||
168 | } | ||
169 | }, | ||
170 | |||
171 | //------------------------------------------------------------------------- | ||
172 | |||
173 | 'handleIframeDidLoad': function (anEvent) { | ||
174 | if (this.isNewsOpen() == false) { | ||
175 | this.toggleTips(anEvent); | ||
176 | } | ||
177 | |||
178 | MochiKit.DOM.removeElementClass('newsframe', 'loading'); | ||
179 | MochiKit.Signal.disconnectAllTo(this.getElement('iframe')); | ||
180 | }, | ||
181 | |||
182 | //------------------------------------------------------------------------- | ||
183 | __syntaxFix__: "syntax fix" | ||
184 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PasswordTooltip.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PasswordTooltip.js new file mode 100644 index 0000000..79c8d4f --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PasswordTooltip.js | |||
@@ -0,0 +1,164 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.PasswordTooltip = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.PasswordTooltip.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._referenceElement = args.referenceElement|| Clipperz.Base.exception.raise('MandatoryParameter'); | ||
37 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); | ||
38 | |||
39 | this._boxDimensions = null; | ||
40 | this._isVisible = false; | ||
41 | |||
42 | this.renderSelf(); | ||
43 | |||
44 | return this; | ||
45 | } | ||
46 | |||
47 | //============================================================================= | ||
48 | |||
49 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.PasswordTooltip, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
50 | |||
51 | //------------------------------------------------------------------------- | ||
52 | |||
53 | 'toString': function () { | ||
54 | return "Clipperz.PM.UI.Web.Components.PasswordTooltip component"; | ||
55 | }, | ||
56 | |||
57 | //------------------------------------------------------------------------- | ||
58 | |||
59 | 'referenceElement': function () { | ||
60 | return this._referenceElement; | ||
61 | }, | ||
62 | |||
63 | //------------------------------------------------------------------------- | ||
64 | |||
65 | 'text': function () { | ||
66 | return this._text; | ||
67 | }, | ||
68 | |||
69 | 'setText': function (aValue) { | ||
70 | this._text = aValue; | ||
71 | }, | ||
72 | |||
73 | //------------------------------------------------------------------------- | ||
74 | |||
75 | 'isVisible': function () { | ||
76 | return this._isVisible; | ||
77 | }, | ||
78 | |||
79 | 'setIsVisible': function (aValue) { | ||
80 | this._isVisible = aValue; | ||
81 | }, | ||
82 | |||
83 | //------------------------------------------------------------------------- | ||
84 | |||
85 | 'renderSelf': function() { | ||
86 | this.append(MochiKit.DOM.getElement('Clipperz_PM_UI_Common_Components_Tooltip_wrapperNode'), {tag:'div', id:this.getId('tooltip'), cls:'passwordTooltip', children:[ | ||
87 | {tag:'div', id:this.getId('body'), cls:'passwordTooltip_body', children:[ | ||
88 | {tag:'div', cls:'passwordTooltip_text', children:[ | ||
89 | {tag:'span', html:this.text()} | ||
90 | ]}, | ||
91 | {tag:'div', id:this.getId('footer'), cls:'passwordTooltip_footer'} | ||
92 | ]}, | ||
93 | {tag:'div', id:this.getId('arrow'), cls:'passwordTooltip_arrow'} | ||
94 | ]}); | ||
95 | |||
96 | this._boxDimensions = MochiKit.Style.getElementDimensions(this.getId('body')); | ||
97 | // this._boxDimensions.h += MochiKit.Style.getElementDimensions(this.getId('footer')).h; | ||
98 | |||
99 | MochiKit.Style.hideElement(this.displayElement()); | ||
100 | MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); | ||
101 | MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); | ||
102 | }, | ||
103 | |||
104 | //----------------------------------------------------- | ||
105 | |||
106 | 'displayElement': function() { | ||
107 | return this.getElement('tooltip'); | ||
108 | }, | ||
109 | |||
110 | //------------------------------------------------------------------------- | ||
111 | |||
112 | 'boxDimensions': function () { | ||
113 | return this._boxDimensions; | ||
114 | }, | ||
115 | |||
116 | //------------------------------------------------------------------------- | ||
117 | |||
118 | 'show': function () { | ||
119 | var elementSizeAndPosition; | ||
120 | var arrowPosition; | ||
121 | var bodyPosition; | ||
122 | |||
123 | if (this.isVisible() == false) { | ||
124 | arrowPosition = {}; | ||
125 | bodyPosition = {}; | ||
126 | |||
127 | this.setIsVisible(true); | ||
128 | elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element()); | ||
129 | |||
130 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); | ||
131 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); | ||
132 | bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13; | ||
133 | |||
134 | arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); | ||
135 | arrowPosition.y = elementSizeAndPosition.position.y - 13; | ||
136 | |||
137 | MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); | ||
138 | MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition); | ||
139 | MochiKit.Visual.appear(this.displayElement(), {duration:0.4}); | ||
140 | } | ||
141 | }, | ||
142 | |||
143 | 'hide': function () { | ||
144 | if (this.isVisible() == true) { | ||
145 | MochiKit.Visual.fade(this.displayElement(), {duration:0.4}); | ||
146 | this.setIsVisible(false); | ||
147 | } | ||
148 | }, | ||
149 | |||
150 | //------------------------------------------------------------------------- | ||
151 | /* | ||
152 | 'shouldRemoveElementWhenClearningUp': function () { | ||
153 | return false; | ||
154 | }, | ||
155 | */ | ||
156 | //------------------------------------------------------------------------- | ||
157 | __syntaxFix__: "syntax fix" | ||
158 | }); | ||
159 | |||
160 | Clipperz.PM.UI.Web.Components.PasswordTooltip.initTooltips = function () { | ||
161 | Clipperz.DOM.Helper.insertBefore(MochiKit.DOM.currentDocument().body.childNodes[0], {tag:'div', id:'Clipperz_PM_UI_Web_Components_PasswordTooltip_wrapperNode'}); | ||
162 | } | ||
163 | |||
164 | MochiKit.DOM.addLoadEvent(Clipperz.PM.UI.Web.Components.PasswordTooltip.initTooltips); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/RulerComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/RulerComponent.js new file mode 100644 index 0000000..ab8a38c --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/RulerComponent.js | |||
@@ -0,0 +1,324 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.RulerComponent = function(args) { | ||
32 | args = args || {}; | ||
33 | Clipperz.PM.UI.Web.Components.RulerComponent.superclass.constructor.apply(this, arguments); | ||
34 | |||
35 | this._translationContext = args.translationContext|| Clipperz.Base.exception.raise('MandatoryParameter'); | ||
36 | // this._steps = args.steps || Clipperz.Base.exception.raise('MandatoryParameter'); | ||
37 | this._steps = args.steps; | ||
38 | |||
39 | this._currentStep = -1; | ||
40 | |||
41 | return this; | ||
42 | } | ||
43 | |||
44 | //============================================================================= | ||
45 | |||
46 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.RulerComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
47 | |||
48 | //------------------------------------------------------------------------- | ||
49 | |||
50 | 'toString': function () { | ||
51 | return "Clipperz.PM.UI.Web.Components.RulerComponent component"; | ||
52 | }, | ||
53 | |||
54 | //------------------------------------------------------------------------- | ||
55 | |||
56 | 'resetStatus': function (args) { | ||
57 | args = args || {}; | ||
58 | |||
59 | if (this.currentStep() != 0) { | ||
60 | var shouldAnimateTransition; | ||
61 | |||
62 | shouldAnimateTransition = args.animateTransition || false; | ||
63 | |||
64 | if (shouldAnimateTransition) { | ||
65 | this.moveToFirstStep(MochiKit.Base.method(this, 'cursorMoved')); | ||
66 | } else { | ||
67 | this._currentStep = 0; | ||
68 | this.cursorMoved(); | ||
69 | } | ||
70 | } | ||
71 | }, | ||
72 | |||
73 | //------------------------------------------------------------------------- | ||
74 | |||
75 | 'translationContext': function () { | ||
76 | return this._translationContext; | ||
77 | }, | ||
78 | |||
79 | 'steps': function () { | ||
80 | return this._steps; | ||
81 | }, | ||
82 | |||
83 | 'setSteps': function (aValue) { | ||
84 | this._steps = aValue; | ||
85 | this.renderStepsComponents(); | ||
86 | this.resetStatus(); | ||
87 | }, | ||
88 | |||
89 | 'translatedStepDescription': function (aStep) { | ||
90 | return Clipperz.PM.Strings.getValue(this.translationContext() + '.' + aStep + '.' + 'name'); | ||
91 | }, | ||
92 | |||
93 | //------------------------------------------------------------------------- | ||
94 | |||
95 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
96 | this.setElement(this.append(MochiKit.DOM.currentDocument().body, [ | ||
97 | {tag:'div', id:this.getId('rulerWrapper'), cls:'rulerWrapper fixed', children:[ | ||
98 | {tag:'div', cls:'ruler', children:[ | ||
99 | {tag:'a', href:'#', id:this.getId('exit'), cls:'exit', html:' '}, | ||
100 | {tag:'a', href:'#', id:this.getId('smallPreviousButton'),cls:'smallButton previous', html:' '}, | ||
101 | {tag:'a', href:'#', id:this.getId('smallNextButton'), cls:'smallButton next', html:' '}, | ||
102 | {tag:'div', cls:'marker', id:this.getId('marker'), children:[ | ||
103 | {tag:'div', cls:'previous', id:this.getId('previousButton')}, | ||
104 | {tag:'div', cls:'markerBody'}, | ||
105 | {tag:'div', cls:'next', id:this.getId('nextButton')} | ||
106 | ]}, | ||
107 | {tag:'div', cls:'steps', id:this.getId('stepsFrame')}, | ||
108 | // {tag:'div', cls:'steps' + ' ' + 'steps_' + this.steps().length, children:[ | ||
109 | // {tag:'ul', id:this.getId('steps'), children:MochiKit.Base.map(MochiKit.Base.bind(function (aStep) { return {tag:'li', children:[{tag:'span', html:this.translatedStepDescription(aStep)}]}}, this), this.steps())} | ||
110 | // ]}, | ||
111 | {tag:'div', cls:'dots', id:this.getId('dotsFrame')} | ||
112 | // {tag:'div', cls:'dots' + ' ' + 'steps_' + this.steps().length, children:[ | ||
113 | // {tag:'ul', id:this.getId('dots'), children:MochiKit.Base.map(function (aStep) { return {tag:'li', children:[{tag:'span', html:'*'}]}}, this.steps())} | ||
114 | // ]} | ||
115 | ]} | ||
116 | ]} | ||
117 | ])); | ||
118 | //console.log("ELEMENT", this.element()); | ||
119 | |||
120 | MochiKit.Signal.connect(this.getElement('exit'), 'onclick', this, 'handleExit'); | ||
121 | |||
122 | MochiKit.Signal.connect(this.getElement('previousButton'), 'onclick', this, 'handlePrevious'); | ||
123 | MochiKit.Signal.connect(this.getElement('smallPreviousButton'),'onclick', this, 'handlePrevious'); | ||
124 | |||
125 | MochiKit.Signal.connect(this.getElement('nextButton'), 'onclick', this, 'handleNext'); | ||
126 | MochiKit.Signal.connect(this.getElement('smallNextButton'), 'onclick', this, 'handleNext'); | ||
127 | |||
128 | this.enablePrevious(false); | ||
129 | this.enableNext(false); | ||
130 | |||
131 | // this.cursorMoved(); | ||
132 | }, | ||
133 | |||
134 | //......................................................................... | ||
135 | |||
136 | 'renderStepsComponents': function () { | ||
137 | varstepsFrame; | ||
138 | var dotsFrame; | ||
139 | |||
140 | stepsFrames = this.getElement('stepsFrame'); | ||
141 | MochiKit.DOM.setElementClass(stepsFrames, 'steps'); | ||
142 | MochiKit.DOM.addElementClass(stepsFrames, 'steps_' + this.steps().length); | ||
143 | |||
144 | stepsFrames.innerHTML = ""; | ||
145 | this.append(stepsFrames, {tag:'ul', id:this.getId('steps'), children:MochiKit.Base.map( | ||
146 | MochiKit.Base.bind(function (aStep) { return {tag:'li', children:[{tag:'span', html:this.translatedStepDescription(aStep)}]}}, this), | ||
147 | this.steps())} | ||
148 | ); | ||
149 | |||
150 | dotsFrames = this.getElement('dotsFrame'); | ||
151 | MochiKit.DOM.setElementClass(dotsFrames, 'dots'); | ||
152 | MochiKit.DOM.addElementClass(dotsFrames, 'steps_' + this.steps().length); | ||
153 | |||
154 | dotsFrames.innerHTML = ""; | ||
155 | this.append(dotsFrames, {tag:'ul', id:this.getId('dots'), children:MochiKit.Base.map( | ||
156 | function (aStep) { return {tag:'li', children:[{tag:'span', html:'*'}]}; }, | ||
157 | this.steps())} | ||
158 | ); | ||
159 | }, | ||
160 | |||
161 | //------------------------------------------------------------------------- | ||
162 | |||
163 | 'handleExit': function (anEvent) { | ||
164 | anEvent.preventDefault(); | ||
165 | |||
166 | MochiKit.Signal.signal(this, 'exit'); | ||
167 | }, | ||
168 | |||
169 | //------------------------------------------------------------------------- | ||
170 | |||
171 | 'handlePrevious': function (anEvent) { | ||
172 | anEvent.preventDefault(); | ||
173 | |||
174 | // if (!MochiKit.DOM.hasElementClass(this.getElement('previousButton'), 'disabled')) { | ||
175 | // this.moveBackward(); | ||
176 | // } | ||
177 | |||
178 | MochiKit.Signal.signal(this, 'moveBackward'); | ||
179 | }, | ||
180 | |||
181 | 'handleNext': function (anEvent) { | ||
182 | anEvent.preventDefault(); | ||
183 | |||
184 | // if (!MochiKit.DOM.hasElementClass(this.getElement('nextButton'), 'disabled')) { | ||
185 | // this.moveForward(); | ||
186 | // } | ||
187 | |||
188 | MochiKit.Signal.signal(this, 'moveForward'); | ||
189 | }, | ||
190 | |||
191 | //------------------------------------------------------------------------- | ||
192 | |||
193 | 'currentStep': function () { | ||
194 | return this._currentStep; | ||
195 | }, | ||
196 | |||
197 | 'markerInitialOffset': function () { | ||
198 | return -246; | ||
199 | }, | ||
200 | |||
201 | 'markerStepOffset': function () { | ||
202 | return 410 / (this.steps().length - 1); | ||
203 | // return 100; | ||
204 | }, | ||
205 | |||
206 | //------------------------------------------------------------------------- | ||
207 | |||
208 | 'moveToFirstStep': function (aCallback) { | ||
209 | varstepsToMove; | ||
210 | |||
211 | stepsToMove = this._currentStep; | ||
212 | this._currentStep = 0; | ||
213 | |||
214 | this.enablePrevious(false); | ||
215 | this.enableNext(false); | ||
216 | // MochiKit.Signal.signal(this, 'moveBackward'); | ||
217 | MochiKit.Base.map( | ||
218 | function (anElement) { MochiKit.DOM.removeElementClass(anElement, 'selected'); }, | ||
219 | MochiKit.Selector.findChildElements(this.element(), ['li.selected']) | ||
220 | ); | ||
221 | new MochiKit.Visual.Move(this.getElement('marker'), { | ||
222 | x:-(this.markerStepOffset() * stepsToMove), | ||
223 | mode:'relative', | ||
224 | duration:(0.5 * (stepsToMove/2)), | ||
225 | // afterFinish:MochiKit.Base.method(this, 'cursorMoved') | ||
226 | afterFinish:MochiKit.Base.compose(MochiKit.Base.method(this, 'cursorMoved'), aCallback) | ||
227 | }); | ||
228 | }, | ||
229 | |||
230 | 'moveBackward': function (aCallback) { | ||
231 | this._currentStep --; | ||
232 | |||
233 | this.enablePrevious(false); | ||
234 | this.enableNext(false); | ||
235 | // MochiKit.Signal.signal(this, 'moveBackward'); | ||
236 | MochiKit.Base.map( | ||
237 | function (anElement) { MochiKit.DOM.removeElementClass(anElement, 'selected'); }, | ||
238 | MochiKit.Selector.findChildElements(this.element(), ['li.selected']) | ||
239 | ); | ||
240 | new MochiKit.Visual.Move(this.getElement('marker'), { | ||
241 | x:-this.markerStepOffset(), | ||
242 | mode:'relative', | ||
243 | duration:0.5, | ||
244 | // afterFinish:MochiKit.Base.method(this, 'cursorMoved') | ||
245 | afterFinish:MochiKit.Base.compose(MochiKit.Base.method(this, 'cursorMoved'), aCallback) | ||
246 | }); | ||
247 | }, | ||
248 | |||
249 | 'moveForward': function (aCallback) { | ||
250 | this._currentStep ++; | ||
251 | |||
252 | if (this._currentStep < this.steps().length) { | ||
253 | this.enablePrevious(false); | ||
254 | this.enableNext(false); | ||
255 | // MochiKit.Signal.signal(this, 'moveForward'); | ||
256 | MochiKit.Base.map( | ||
257 | function (anElement) { MochiKit.DOM.removeElementClass(anElement, 'selected'); }, | ||
258 | MochiKit.Selector.findChildElements(this.element(), ['li.selected']) | ||
259 | ); | ||
260 | new MochiKit.Visual.Move(this.getElement('marker'), { | ||
261 | x:this.markerStepOffset(), | ||
262 | mode:'relative', | ||
263 | duration:0.5, | ||
264 | // afterFinish:MochiKit.Base.method(this, 'cursorMoved') | ||
265 | afterFinish:MochiKit.Base.compose(MochiKit.Base.method(this, 'cursorMoved'), aCallback) | ||
266 | }); | ||
267 | } else { | ||
268 | MochiKit.Signal.signal(this, 'done'); | ||
269 | } | ||
270 | }, | ||
271 | |||
272 | //------------------------------------------------------------------------- | ||
273 | |||
274 | 'enablePrevious': function (aValue) { | ||
275 | if (aValue == true) { | ||
276 | MochiKit.DOM.removeElementClass(this.getElement('previousButton'), 'disabled'); | ||
277 | MochiKit.DOM.removeElementClass(this.getElement('smallPreviousButton'), 'disabled'); | ||
278 | } else { | ||
279 | MochiKit.DOM.addElementClass(this.getElement('previousButton'), 'disabled'); | ||
280 | MochiKit.DOM.addElementClass(this.getElement('smallPreviousButton'), 'disabled'); | ||
281 | } | ||
282 | }, | ||
283 | |||
284 | //'disablePrevious': function () { | ||
285 | // MochiKit.DOM.addElementClass(this.getElement('previousButton'), 'disabled'); | ||
286 | //}, | ||
287 | |||
288 | //......................................................................... | ||
289 | |||
290 | 'enableNext': function (aValue) { | ||
291 | if (aValue == true) { | ||
292 | MochiKit.DOM.removeElementClass(this.getElement('nextButton'), 'disabled'); | ||
293 | MochiKit.DOM.removeElementClass(this.getElement('smallNextButton'), 'disabled'); | ||
294 | } else { | ||
295 | MochiKit.DOM.addElementClass(this.getElement('nextButton'), 'disabled'); | ||
296 | MochiKit.DOM.addElementClass(this.getElement('smallNextButton'), 'disabled'); | ||
297 | } | ||
298 | }, | ||
299 | |||
300 | //'disableNext': function () { | ||
301 | // MochiKit.DOM.addElementClass(this.getElement('nextButton'), 'disabled'); | ||
302 | //}, | ||
303 | |||
304 | //------------------------------------------------------------------------- | ||
305 | |||
306 | 'cursorMoved': function () { | ||
307 | MochiKit.Style.setElementPosition(this.getElement('marker'), {x:this.markerStepOffset() * this.currentStep() + this.markerInitialOffset()}) | ||
308 | MochiKit.Signal.signal(this, 'cursorMoved'); | ||
309 | |||
310 | MochiKit.DOM.addElementClass(this.getElement('steps').childNodes[this.currentStep()], 'selected'); | ||
311 | MochiKit.DOM.addElementClass(this.getElement('dots').childNodes[this.currentStep()], 'selected'); | ||
312 | }, | ||
313 | |||
314 | //------------------------------------------------------------------------- | ||
315 | |||
316 | 'setDisplayMode': function (aValue) { | ||
317 | MochiKit.DOM.removeElementClass(this.getElement('rulerWrapper'), 'fixed'); | ||
318 | MochiKit.DOM.removeElementClass(this.getElement('rulerWrapper'), 'scrollable'); | ||
319 | MochiKit.DOM.addElementClass(this.getElement('rulerWrapper'), aValue); | ||
320 | }, | ||
321 | |||
322 | //------------------------------------------------------------------------- | ||
323 | __syntaxFix__: "syntax fix" | ||
324 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js new file mode 100644 index 0000000..39a1ccb --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js | |||
@@ -0,0 +1,193 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.TabSidePanel = function(args) { | ||
32 | args = args || {}; | ||
33 | Clipperz.PM.UI.Web.Components.TabSidePanel.superclass.constructor.call(this, args); | ||
34 | |||
35 | this._element = args.element || null; | ||
36 | |||
37 | this._slots = { | ||
38 | }; | ||
39 | |||
40 | return this; | ||
41 | } | ||
42 | |||
43 | //============================================================================= | ||
44 | |||
45 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.TabSidePanel, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
46 | |||
47 | //------------------------------------------------------------------------- | ||
48 | |||
49 | 'toString': function () { | ||
50 | return "Clipperz.PM.UI.Web.Components.TabSidePanel component"; | ||
51 | }, | ||
52 | |||
53 | //------------------------------------------------------------------------- | ||
54 | |||
55 | 'deselectAllTabs': function() { | ||
56 | var tabListItems; | ||
57 | |||
58 | tabListItems = [ | ||
59 | 'cardsLI', | ||
60 | // 'directLoginLI', | ||
61 | 'accountLI', | ||
62 | 'dataLI', | ||
63 | 'toolsLI' | ||
64 | ]; | ||
65 | |||
66 | //Clipperz.log("=== TabSidePanel.tabSelected anEvent.src().id", anEvent.src().id); | ||
67 | for (var i in tabListItems) { | ||
68 | //Clipperz.log("=== TabSidePanel.tabSelected aTabListItem", tabListItems[i]); | ||
69 | MochiKit.DOM.removeElementClass(this.getId(tabListItems[i]), 'selected'); | ||
70 | } | ||
71 | }, | ||
72 | |||
73 | 'selectTab': function(aTabName) { | ||
74 | this.deselectAllTabs(); | ||
75 | MochiKit.DOM.addElementClass(this.getId(this.listItemIdForTabNamed(aTabName)), 'selected'); | ||
76 | MochiKit.Signal.signal(this, 'tabSelected', aTabName); | ||
77 | }, | ||
78 | |||
79 | 'tabNameForAnchorId': function(anId) { | ||
80 | var result; | ||
81 | |||
82 | switch(anId) { | ||
83 | case 'cards_tabSidePanel': | ||
84 | result = 'cards'; | ||
85 | break; | ||
86 | // case 'directLogins_tabSidePanel': | ||
87 | // result = 'directLogins'; | ||
88 | // break; | ||
89 | case 'account_tabSidePanel': | ||
90 | result = 'account'; | ||
91 | break; | ||
92 | case 'data_tabSidePanel': | ||
93 | result = 'data'; | ||
94 | break; | ||
95 | case 'tools_tabSidePanel': | ||
96 | result = 'tools'; | ||
97 | break; | ||
98 | } | ||
99 | |||
100 | return result; | ||
101 | }, | ||
102 | |||
103 | 'listItemIdForTabNamed': function(aTabName) { | ||
104 | var result; | ||
105 | |||
106 | switch (aTabName) { | ||
107 | case 'cards': | ||
108 | result = 'cardsLI'; | ||
109 | break; | ||
110 | // case 'directLogins': | ||
111 | // result = 'directLoginLI'; | ||
112 | // break; | ||
113 | case 'account': | ||
114 | result = 'accountLI'; | ||
115 | break; | ||
116 | case 'data': | ||
117 | result = 'dataLI'; | ||
118 | break; | ||
119 | case 'tools': | ||
120 | result = 'toolsLI'; | ||
121 | break; | ||
122 | } | ||
123 | |||
124 | return result; | ||
125 | }, | ||
126 | |||
127 | 'tabSelected': function (anEvent) { | ||
128 | this.selectTab(this.tabNameForAnchorId(anEvent.src().id)); | ||
129 | // anEvent.stop(); | ||
130 | anEvent.preventDefault(); | ||
131 | }, | ||
132 | |||
133 | //------------------------------------------------------------------------- | ||
134 | |||
135 | 'addCard': function (anEvent) { | ||
136 | anEvent.stop(); | ||
137 | MochiKit.Signal.signal(this, 'addCard', anEvent.src()); | ||
138 | }, | ||
139 | |||
140 | //------------------------------------------------------------------------- | ||
141 | |||
142 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
143 | this.append(this.element(), [ | ||
144 | {tag:'div', cls:'header'}, | ||
145 | {tag:'div', cls:'body', children:[ | ||
146 | {tag:'ul', cls:'mainTabs', children:[ | ||
147 | {tag:'li', id:this.getId('cardsLI'), cls:'cards', children:[ | ||
148 | {tag:'a', id:'cards_tabSidePanel', href:'#', html:"cards"}, | ||
149 | {tag:'div', cls:'selectionHighlighter', children:[ | ||
150 | {tag:'img', src:'./images/old/main/tabs/selectionHighligher.png'}, | ||
151 | {tag:'a', id:this.getId('addCardA'), cls:'add', href:'#', children:[ | ||
152 | {tag:'span', html:"add"}, | ||
153 | {tag:'h3', html:"+"} | ||
154 | ]} | ||
155 | ]} | ||
156 | ]} | ||
157 | ]}, | ||
158 | {tag:'ul', cls:'otherTabs', children:[ | ||
159 | {tag:'li', id:this.getId('accountLI'), children:[ | ||
160 | {tag:'a', id:'account_tabSidePanel', href:'#', html:"account"}, | ||
161 | {tag:'div', cls:'selectionHighlighter', children:[ | ||
162 | {tag:'img', src:'./images/old/main/tabs/selectionHighligherGray.png'} | ||
163 | ]} | ||
164 | ]}, | ||
165 | {tag:'li', id:this.getId('dataLI'), children:[ | ||
166 | {tag:'a', id:'data_tabSidePanel', href:'#', html:"data"}, | ||
167 | {tag:'div', cls:'selectionHighlighter', children:[ | ||
168 | {tag:'img', src:'./images/old/main/tabs/selectionHighligherGray.png'} | ||
169 | ]} | ||
170 | ]}, | ||
171 | {tag:'li', id:this.getId('toolsLI'), children:[ | ||
172 | {tag:'a', id:'tools_tabSidePanel', href:'#', html:"tools"}, | ||
173 | {tag:'div', cls:'selectionHighlighter', children:[ | ||
174 | {tag:'img', src:'./images/old/main/tabs/selectionHighligherGray.png'} | ||
175 | ]} | ||
176 | ]} | ||
177 | ]} | ||
178 | ]}, | ||
179 | {tag:'div', cls:'footer'} | ||
180 | ]); | ||
181 | |||
182 | MochiKit.Signal.connect('cards_tabSidePanel', 'onclick', this, 'tabSelected'); | ||
183 | // MochiKit.Signal.connect('directLogins_tabSidePanel', 'onclick', this, 'tabSelected'); | ||
184 | MochiKit.Signal.connect('account_tabSidePanel', 'onclick', this, 'tabSelected'); | ||
185 | MochiKit.Signal.connect('data_tabSidePanel', 'onclick', this, 'tabSelected'); | ||
186 | MochiKit.Signal.connect('tools_tabSidePanel', 'onclick', this, 'tabSelected'); | ||
187 | MochiKit.Signal.connect(this.getId('addCardA'), 'onclick', this, 'addCard'); | ||
188 | }, | ||
189 | |||
190 | //------------------------------------------------------------------------- | ||
191 | |||
192 | __syntaxFix__: "syntax fix" | ||
193 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TextColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TextColumnManager.js new file mode 100644 index 0000000..97e81b4 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TextColumnManager.js | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | //############################################################################# | ||
32 | |||
33 | Clipperz.PM.UI.Web.Components.TextColumnManager = function(args) { | ||
34 | args = args || {}; | ||
35 | Clipperz.PM.UI.Web.Components.TextColumnManager.superclass.constructor.call(this, args); | ||
36 | |||
37 | return this; | ||
38 | } | ||
39 | |||
40 | //============================================================================= | ||
41 | |||
42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.TextColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { | ||
43 | |||
44 | 'toString': function () { | ||
45 | return "Clipperz.PM.UI.Web.Components.TextColumnManager component"; | ||
46 | }, | ||
47 | |||
48 | //----------------------------------------------------- | ||
49 | |||
50 | '__syntax_fix__' : 'syntax fix' | ||
51 | |||
52 | }); | ||
53 | |||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js new file mode 100644 index 0000000..179c495 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js | |||
@@ -0,0 +1,113 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.ToolsPanel = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.ToolsPanel.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._initiallySelectedTab = args.selected || 'PASSWORD_GENERATOR'; | ||
37 | this._tabPanelControllerConfiguration = { | ||
38 | 'PASSWORD_GENERATOR': { | ||
39 | tab:'passwordGeneratorTab', | ||
40 | panel:'passwordGeneratorPanel' | ||
41 | }, | ||
42 | 'BOOKMARKLET': { | ||
43 | tab:'bookmarkletTab', | ||
44 | panel:'bookmarkletPanel' | ||
45 | }, | ||
46 | 'COMPACT_EDITION': { | ||
47 | tab:'compactEditionTab', | ||
48 | panel:'compactEditionPanel' | ||
49 | }, | ||
50 | 'HTTP_AUTH': { | ||
51 | tab:'httpAuthTab', | ||
52 | panel:'httpAuthPanel' | ||
53 | } | ||
54 | }; | ||
55 | |||
56 | return this; | ||
57 | } | ||
58 | |||
59 | //============================================================================= | ||
60 | |||
61 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.ToolsPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, { | ||
62 | |||
63 | //------------------------------------------------------------------------- | ||
64 | |||
65 | 'toString': function () { | ||
66 | return "Clipperz.PM.UI.Web.Components.ToolsPanel component"; | ||
67 | }, | ||
68 | |||
69 | //------------------------------------------------------------------------- | ||
70 | |||
71 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
72 | this.append(this.element(), [ | ||
73 | {tag:'div', cls:'header', children:[ | ||
74 | {tag:'div', cls:'subPanelTabs', children:[ | ||
75 | {tag:'ul', children:[ | ||
76 | {tag:'li', id:this.getId('passwordGeneratorTab'),children:[{tag:'a', href:'#', html:'Password generator'}], cls:'first'}, | ||
77 | {tag:'li', id:this.getId('bookmarkletTab'), children:[{tag:'a', href:'#', html:'Bookmarklet'}]}, | ||
78 | {tag:'li', id:this.getId('compactEditionTab'), children:[{tag:'a', href:'#', html:'Compact edition'}]}, | ||
79 | {tag:'li', id:this.getId('httpAuthTab'), children:[{tag:'a', href:'#', html:'HTTP Auth'}]} | ||
80 | ]} | ||
81 | ]} | ||
82 | ]}, | ||
83 | {tag:'div', cls:'body', children:[ | ||
84 | {tag:'div', cls:'accountPanel', children:[ | ||
85 | {tag:'div', cls:'subPanelContent', children:[ | ||
86 | {tag:'ul', children:[ | ||
87 | {tag:'li', id:this.getId('passwordGeneratorPanel'),children:[ | ||
88 | {tag:'h3', html:"Password generator"} | ||
89 | ]}, | ||
90 | {tag:'li', id:this.getId('bookmarkletPanel'),children:[ | ||
91 | {tag:'h3', html:"Bookmarklet"} | ||
92 | ]}, | ||
93 | {tag:'li', id:this.getId('compactEditionPanel'), children:[ | ||
94 | {tag:'h3', html:"Compact edition"} | ||
95 | ]}, | ||
96 | {tag:'li', id:this.getId('httpAuthPanel'), children:[ | ||
97 | {tag:'h3', html:"HTTP Auth"} | ||
98 | ]} | ||
99 | ]} | ||
100 | ]} | ||
101 | ]} | ||
102 | ]}, | ||
103 | {tag:'div', cls:'footer'} | ||
104 | ]); | ||
105 | |||
106 | this.tabPanelController().setup({selected:this.initiallySelectedTab()}); | ||
107 | }, | ||
108 | |||
109 | //------------------------------------------------------------------------- | ||
110 | |||
111 | |||
112 | __syntaxFix__: "syntax fix" | ||
113 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js new file mode 100644 index 0000000..5b9d522 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js | |||
@@ -0,0 +1,184 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.UnlockPasswordComponent = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.UnlockPasswordComponent.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._openFromElement = args.openFromElement || null; | ||
37 | this._onOkCloseToElement = args.onOkCloseToElement || null; | ||
38 | this._onCancelCloseToElement = args.onCancelCloseToElement|| null; | ||
39 | |||
40 | this._progressBarComponent = null; | ||
41 | |||
42 | return this; | ||
43 | } | ||
44 | |||
45 | //============================================================================= | ||
46 | |||
47 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.UnlockPasswordComponent, Clipperz.PM.UI.Common.Components.SimpleMessagePanel, { | ||
48 | |||
49 | //------------------------------------------------------------------------- | ||
50 | |||
51 | 'toString': function () { | ||
52 | return "Clipperz.PM.UI.Web.Components.UnlockPasswordComponent component"; | ||
53 | }, | ||
54 | |||
55 | //------------------------------------------------------------------------- | ||
56 | |||
57 | 'getPassphrase': function () { | ||
58 | /* var deferredResult; | ||
59 | |||
60 | if (this.passphrase() == null) { | ||
61 | this.deferredShowModal({'openFromElement': this.openFromElement()}); | ||
62 | deferredResult = this.deferred(); | ||
63 | } else { | ||
64 | deferredResult = MochiKit.Async.succeed(this.passphrase()); | ||
65 | } | ||
66 | |||
67 | return deferredResult; | ||
68 | */ | ||
69 | |||
70 | this.deferredShowModal({'openFromElement': this.openFromElement()}); | ||
71 | |||
72 | return this.deferred(); | ||
73 | }, | ||
74 | |||
75 | //------------------------------------------------------------------------- | ||
76 | |||
77 | 'deferredShowModal': function (someParameters) { | ||
78 | return Clipperz.Async.callbacks("UnlockPasswordComponent.deferredShowModal", [ | ||
79 | MochiKit.Base.bind(Clipperz.PM.UI.Web.Components.UnlockPasswordComponent.superclass.deferredShowModal, this, someParameters), | ||
80 | MochiKit.Base.method(this, 'getElement', 'passphrase'), | ||
81 | MochiKit.Base.methodcaller('focus') | ||
82 | ], {trace:false}) | ||
83 | }, | ||
84 | |||
85 | //------------------------------------------------------------------------- | ||
86 | |||
87 | 'openFromElement': function () { | ||
88 | return this._openFromElement; | ||
89 | }, | ||
90 | |||
91 | 'onOkCloseToElement': function () { | ||
92 | return this._onOkCloseToElement; | ||
93 | }, | ||
94 | |||
95 | 'onCancelCloseToElement': function () { | ||
96 | return this._onCancelCloseToElement; | ||
97 | }, | ||
98 | |||
99 | //------------------------------------------------------------------------- | ||
100 | |||
101 | 'renderSelf': function() { | ||
102 | Clipperz.PM.UI.Web.Components.UnlockPasswordComponent.superclass.renderSelf.apply(this, arguments); | ||
103 | |||
104 | this.append(this.getElement('container'), {tag:'div', cls:'passphrase', children: [ | ||
105 | // {tag:'form', id:this.getId('passphraseForm'), children:[ | ||
106 | {tag:'input', id:this.getId('passphrase'), type:'password', name:'passphrase', value:''} | ||
107 | // ]} | ||
108 | ]}); | ||
109 | |||
110 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'userSuccessfullyLoggedIn', this, 'userSuccessfullyLoggedInHandler'); | ||
111 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'userLoginFailed', this, 'userLoginFailedHandler'); | ||
112 | |||
113 | |||
114 | // MochiKit.Async.callLater(0.1, MochiKit.Base.method(this.getElement('passphrase'), 'focus')); | ||
115 | // this.getElement('passphrase').select(); | ||
116 | }, | ||
117 | |||
118 | //------------------------------------------------------------------------- | ||
119 | |||
120 | 'showProgressBar': function () { | ||
121 | varprogressBarElement; | ||
122 | |||
123 | this.getElement('container').innerHTML = ''; | ||
124 | |||
125 | progressBarElement = this.append(this.getElement('container'), {tag:'div', cls:'progressBarWrapper'}); | ||
126 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':progressBarElement})); | ||
127 | |||
128 | this.setButtons([{text:"Cancel", result:'CANCEL'}]); | ||
129 | }, | ||
130 | |||
131 | //------------------------------------------------------------------------- | ||
132 | |||
133 | 'showFailure': function () { | ||
134 | this.setType('ALERT'); | ||
135 | this.setTitle("Login failed"); | ||
136 | this.setText("Wrong passphrase; the unlock has failed."); | ||
137 | this.getElement('container').innerHTML = ''; | ||
138 | this.setButtons([{text:"Close", result:'CANCEL', isDefault:true}]); | ||
139 | }, | ||
140 | |||
141 | //------------------------------------------------------------------------- | ||
142 | |||
143 | 'closeOk': function () { | ||
144 | var passphrase; | ||
145 | |||
146 | passphrase = this.getElement('passphrase').value; | ||
147 | this.showProgressBar(); | ||
148 | // this.deferred().callback(passphrase); | ||
149 | MochiKit.Async.callLater(0.5, MochiKit.Base.method(this.deferred(), 'callback', passphrase)); | ||
150 | this._deferred = null; | ||
151 | }, | ||
152 | |||
153 | 'closeCancel': function () { | ||
154 | this.deferredHideModal({closeToElement:this.onCancelCloseToElement()}); | ||
155 | this.deferred().cancel(); | ||
156 | this._deferred = null; | ||
157 | }, | ||
158 | |||
159 | //------------------------------------------------------------------------- | ||
160 | |||
161 | 'userSuccessfullyLoggedInHandler': function (anEvent) { | ||
162 | this.deferredHideModal({closeToElement:this.onOkCloseToElement()}); | ||
163 | }, | ||
164 | |||
165 | 'userLoginFailedHandler': function (anEvent) { | ||
166 | //console.log("############### FAILED LOGIN ################"); | ||
167 | this.showFailure(); | ||
168 | }, | ||
169 | |||
170 | //------------------------------------------------------------------------- | ||
171 | /* | ||
172 | 'deferredShow': function (someArgs, aResult) { | ||
173 | this.deferredShowModal(someArgs); | ||
174 | |||
175 | // this.deferred().addMethod(this, 'deferredHideModal', {closeToElement:someArgs.onOkCloseToElement }); | ||
176 | // this.deferred().addErrback (MochiKit.Base.method(this, 'deferredHideModal', {closeToElement:someArgs.onCancelCloseToElement })); | ||
177 | // this.deferred().addCallback(MochiKit.Async.succeed, aResult); | ||
178 | |||
179 | return this.deferred(); | ||
180 | }, | ||
181 | */ | ||
182 | //------------------------------------------------------------------------- | ||
183 | __syntaxFix__: "syntax fix" | ||
184 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UserInfoBox.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UserInfoBox.js new file mode 100644 index 0000000..f26118e --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UserInfoBox.js | |||
@@ -0,0 +1,346 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.UserInfoBox = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Web.Components.UserInfoBox.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._slots = {}; | ||
37 | this._isLocked = false; | ||
38 | this._lockTooltip = null; | ||
39 | |||
40 | return this; | ||
41 | } | ||
42 | |||
43 | //============================================================================= | ||
44 | |||
45 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.UserInfoBox, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
46 | |||
47 | //------------------------------------------------------------------------- | ||
48 | |||
49 | 'toString': function () { | ||
50 | return "Clipperz.PM.UI.Web.Components.UserInfoBox component"; | ||
51 | }, | ||
52 | |||
53 | //------------------------------------------------------------------------- | ||
54 | |||
55 | 'handleLogout': function(anEvent) { | ||
56 | //Clipperz.log(">>> UserInfoBox.handleLogout"); | ||
57 | anEvent.preventDefault(); | ||
58 | MochiKit.Signal.signal(this, 'logout'); | ||
59 | //Clipperz.log("<<< UserInfoBox.handleLogout"); | ||
60 | }, | ||
61 | |||
62 | //------------------------------------------------------------------------- | ||
63 | |||
64 | 'lockTooltip': function () { | ||
65 | return this._lockTooltip; | ||
66 | }, | ||
67 | |||
68 | //------------------------------------------------------------------------- | ||
69 | |||
70 | 'isLocked': function () { | ||
71 | return this._isLocked; | ||
72 | }, | ||
73 | |||
74 | 'setIsLocked': function (aValue) { | ||
75 | this._isLocked = aValue; | ||
76 | }, | ||
77 | |||
78 | 'toggleLock': function(anEvent) { | ||
79 | var deferredResult; | ||
80 | var shouldLock; | ||
81 | |||
82 | //console.log(">>> UserInfoBox.toggleLock [locked: " + this.isLocked() + "]"); | ||
83 | anEvent.preventDefault(); | ||
84 | this.lockTooltip().hide(); | ||
85 | |||
86 | shouldLock = (this.isLocked() == false); | ||
87 | |||
88 | if (shouldLock) { | ||
89 | var maskElement; | ||
90 | |||
91 | this.setIsLocked(true); | ||
92 | maskElement = this.getId('modalDialogMask'); | ||
93 | deferredResult = Clipperz.Async.callbacks("UserInfoBox.toggleLock [lock]", [ | ||
94 | MochiKit.Base.partial(MochiKit.DOM.addElementClass, this.element(), 'locked'), | ||
95 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimation, MochiKit.Visual.appear, maskElement, {from:0.0, to:0.75, duration:0.5}), | ||
96 | MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', MochiKit.Base.method(this, 'askForPassphrase')), | ||
97 | MochiKit.Base.partial(MochiKit.Signal.signal, this, 'lock') | ||
98 | ], {trace:false}); | ||
99 | } else { | ||
100 | deferredResult = Clipperz.Async.callbacks("UserInfoBox.toggleLock [unlock]", [ | ||
101 | MochiKit.Base.partial(MochiKit.Signal.signal, this, 'unlock') | ||
102 | ], {trace:false}); | ||
103 | } | ||
104 | //console.log("<<< UserInfoBox.toggleLock"); | ||
105 | |||
106 | return deferredResult; | ||
107 | }, | ||
108 | |||
109 | //------------------------------------------------------------------------- | ||
110 | |||
111 | 'unlock': function () { | ||
112 | var deferredResult; | ||
113 | var maskElement; | ||
114 | |||
115 | this.setIsLocked(false); | ||
116 | maskElement = this.getId('modalDialogMask'); | ||
117 | |||
118 | deferredResult = Clipperz.Async.callbacks("UserInfoBox.unlock", [ | ||
119 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimation, MochiKit.Visual.fade, maskElement, {from:0.75, to:0.0, duration:0.5}), | ||
120 | // Clipperz.Visual.deferredAnimation(MochiKit.Visual.fade, maskElement, {from:0.75, to:0.0, duration:0.5}), | ||
121 | MochiKit.Base.partial(MochiKit.DOM.removeElementClass, this.element(), 'locked') | ||
122 | ], {trace:false}); | ||
123 | }, | ||
124 | |||
125 | //------------------------------------------------------------------------- | ||
126 | |||
127 | 'askForPassphrase': function () { | ||
128 | varunlockPasswordComponent; | ||
129 | /* | ||
130 | vardeferredResult; | ||
131 | |||
132 | deferredResult = new Clipperz.Async.Deferred("UserInfoBox.askForPassphrase", {trace:false}); | ||
133 | deferredResult.addCallback(MochiKit.Async.succeed, 'test'); | ||
134 | |||
135 | deferredResult.callback(); | ||
136 | |||
137 | return deferredResult; | ||
138 | */ | ||
139 | //console.log(">>> UserInfoBox.askForPassphrase"); | ||
140 | unlockPasswordComponent = new Clipperz.PM.UI.Web.Components.UnlockPasswordComponent({ | ||
141 | 'title':"Unlock account", | ||
142 | 'text': "Insert the passprase to unlock the account", | ||
143 | 'type': 'INFO', | ||
144 | 'buttons': [ | ||
145 | {text:"Cancel",result:'CANCEL'}, | ||
146 | {text:"Unlock", result:'OK',isDefault:true} | ||
147 | ], | ||
148 | 'openFromElement': this.getElement('lock'), | ||
149 | 'onOkCloseToElement': null, | ||
150 | 'onCancelCloseToElement':this.getId('lock') | ||
151 | }); | ||
152 | //console.log("<<< UserInfoBox.askForPassphrase"); | ||
153 | |||
154 | return unlockPasswordComponent.getPassphrase(); | ||
155 | }, | ||
156 | |||
157 | //========================================================================= | ||
158 | |||
159 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
160 | this.append(this.element(), [ | ||
161 | // {tag:'canvas', id:this.getId('canvas'), cls:'canvas', width:'188', height:'154'}, | ||
162 | {tag:'div', cls:'header', children:[ | ||
163 | {tag:'h1', html:"Welcome"}, | ||
164 | {tag:'a', cls:'lockButton', href:'#', id:this.getId('lock'), html:' '} | ||
165 | ]}, | ||
166 | {tag:'div', cls:'body', children:[ | ||
167 | {tag:'h3', id:this.getId('username'), html:""}, | ||
168 | {tag:'ul', children:[ | ||
169 | {tag:'li', id:this.getId('cards'), children:[ | ||
170 | {tag:'span', id:this.getId('cardsNumber'), cls:'number', html:"-"}, | ||
171 | {tag:'span', id:this.getId('cardsLabel'), html:"cards"} | ||
172 | ]}, | ||
173 | {tag:'li', id:this.getId('directLogins'), children:[ | ||
174 | {tag:'span', id:this.getId('directLoginsNumber'), cls:'number', html:"-"}, | ||
175 | {tag:'span', id:this.getId('directLoginsLabel'), html:"direct logins"} | ||
176 | ]} | ||
177 | ]}, | ||
178 | {tag:'a', href:'#', id:this.getId('logout'), html:"logout >"} | ||
179 | ]}, | ||
180 | {tag:'div', cls:'footer'} | ||
181 | ]); | ||
182 | |||
183 | MochiKit.Signal.connect(this.getElement('logout'), 'onclick', this, 'handleLogout'); | ||
184 | MochiKit.Signal.connect(this.getElement('lock'), 'onclick', this, 'toggleLock'); | ||
185 | |||
186 | this._lockTooltip = new Clipperz.PM.UI.Common.Components.Tooltip({ | ||
187 | element:this.getElement('lock'), | ||
188 | text: "Click here to lock/unlock your account.", | ||
189 | position:'RIGHT' | ||
190 | }); | ||
191 | |||
192 | Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body, | ||
193 | {tag:'div', id:this.getId('modalDialogWrapper'), cls:'modalDialogWrapper', children:[ | ||
194 | {tag:'div', id:this.getId('modalDialogMask'), cls:'modalDialogMask userInfoBoxMask'} | ||
195 | ]} | ||
196 | ); | ||
197 | MochiKit.Style.hideElement(this.getId('modalDialogMask')); | ||
198 | |||
199 | // this.drawUserInfoBackground(this.getElement('canvas')); | ||
200 | }, | ||
201 | |||
202 | //------------------------------------------------------------------------- | ||
203 | /* | ||
204 | 'drawUserInfoBackground': function (canvas) { | ||
205 | var kMyDrawingFunctionWidth = 188.0; | ||
206 | var kMyDrawingFunctionHeight = 154.0; | ||
207 | |||
208 | var context = canvas.getContext("2d"); | ||
209 | var color; | ||
210 | var resolution; | ||
211 | var alignStroke; | ||
212 | var path; | ||
213 | var pointX; | ||
214 | var pointY; | ||
215 | var controlPoint1X; | ||
216 | var controlPoint1Y; | ||
217 | var controlPoint2X; | ||
218 | var controlPoint2Y; | ||
219 | var gradient; | ||
220 | if (window.devicePixelRatio) | ||
221 | resolution = window.devicePixelRatio; | ||
222 | else | ||
223 | resolution = 1.0; | ||
224 | resolution *= 0.5 * (canvas.width / kMyDrawingFunctionWidth + canvas.height / kMyDrawingFunctionHeight); | ||
225 | |||
226 | context.save(); | ||
227 | context.scale(canvas.width / kMyDrawingFunctionWidth, canvas.height / kMyDrawingFunctionHeight); | ||
228 | context.clearRect(0.0, 0.0, kMyDrawingFunctionWidth, kMyDrawingFunctionHeight); | ||
229 | |||
230 | // Setup for Shadow Effect | ||
231 | color = "rgba(0.0%, 0.0%, 0.0%, 0.667)"; | ||
232 | context.save(); | ||
233 | context.shadowColor = color; | ||
234 | context.shadowBlur = 3.0; | ||
235 | context.shadowOffsetX = 5.729 * Math.cos(7.592) * resolution; | ||
236 | context.shadowOffsetY = 5.729 * Math.sin(7.592) * resolution; | ||
237 | |||
238 | // Layer 1 | ||
239 | |||
240 | alignStroke = 0.0; | ||
241 | context.beginPath(); | ||
242 | pointX = 169.5; | ||
243 | pointY = 141.5; | ||
244 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
245 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
246 | context.moveTo(pointX, pointY); | ||
247 | pointX = 177.5; | ||
248 | pointY = 133.5; | ||
249 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
250 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
251 | controlPoint1X = 173.889; | ||
252 | controlPoint1Y = 141.5; | ||
253 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | ||
254 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | ||
255 | controlPoint2X = 177.5; | ||
256 | controlPoint2Y = 137.889; | ||
257 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | ||
258 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | ||
259 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | ||
260 | pointX = 177.5; | ||
261 | pointY = 19.5; | ||
262 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
263 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
264 | context.lineTo(pointX, pointY); | ||
265 | pointX = 169.5; | ||
266 | pointY = 11.5; | ||
267 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
268 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
269 | controlPoint1X = 177.5; | ||
270 | controlPoint1Y = 15.111; | ||
271 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | ||
272 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | ||
273 | controlPoint2X = 173.889; | ||
274 | controlPoint2Y = 11.5; | ||
275 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | ||
276 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | ||
277 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | ||
278 | pointX = 18.5; | ||
279 | pointY = 11.5; | ||
280 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
281 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
282 | context.lineTo(pointX, pointY); | ||
283 | pointX = 10.5; | ||
284 | pointY = 19.5; | ||
285 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
286 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
287 | controlPoint1X = 14.111; | ||
288 | controlPoint1Y = 11.5; | ||
289 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | ||
290 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | ||
291 | controlPoint2X = 10.5; | ||
292 | controlPoint2Y = 15.111; | ||
293 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | ||
294 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | ||
295 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | ||
296 | pointX = 10.5; | ||
297 | pointY = 133.5; | ||
298 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
299 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
300 | context.lineTo(pointX, pointY); | ||
301 | pointX = 18.5; | ||
302 | pointY = 141.5; | ||
303 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
304 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
305 | controlPoint1X = 10.5; | ||
306 | controlPoint1Y = 137.889; | ||
307 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | ||
308 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | ||
309 | controlPoint2X = 14.111; | ||
310 | controlPoint2Y = 141.5; | ||
311 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | ||
312 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | ||
313 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | ||
314 | pointX = 169.5; | ||
315 | pointY = 141.5; | ||
316 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
317 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
318 | context.lineTo(pointX, pointY); | ||
319 | context.closePath(); | ||
320 | gradient = context.createLinearGradient(94.0, 11.5, 94.0, 141.5); | ||
321 | color = "#EE9B69"; | ||
322 | gradient.addColorStop(0.0, color); | ||
323 | color = "#E38D62"; | ||
324 | gradient.addColorStop(1.0, color); | ||
325 | context.fillStyle = gradient; | ||
326 | context.fill(); | ||
327 | |||
328 | // Shadow Effect | ||
329 | context.restore(); | ||
330 | |||
331 | context.restore(); | ||
332 | }, | ||
333 | */ | ||
334 | //------------------------------------------------------------------------- | ||
335 | |||
336 | 'updateUserDetails': function (someUserInfo) { | ||
337 | varelementName; | ||
338 | |||
339 | for (elementName in someUserInfo) { | ||
340 | this.getElement(elementName).innerHTML = someUserInfo[elementName]; | ||
341 | } | ||
342 | }, | ||
343 | |||
344 | //------------------------------------------------------------------------- | ||
345 | __syntaxFix__: "syntax fix" | ||
346 | }); | ||