summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/UI/Web
authorGiulio 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)
commitef68436ac04da078ffdcacd7e1f785473a303d45 (patch) (unidiff)
treec403752d66a2c4775f00affd4fa8431b29c5b68c /frontend/gamma/js/Clipperz/PM/UI/Web
parent597ecfbc0249d83e1b856cbd558340c01237a360 (diff)
downloadclipperz-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') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js148
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/AppPage.js78
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/BookmarkletComponent.js109
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js881
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordDirectLoginComponent.js182
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js190
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js203
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/CreateNewCardSplashComponent.js71
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js111
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/DateColumnManager.js72
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/DeleteObjectColumnManager.js70
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginColumnManager.js90
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingBindingComponent.js168
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js481
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js179
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js271
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/FaviconColumnManager.js89
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/GridComponent.js262
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/ImageColumnManager.js68
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/LinkColumnManager.js92
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js203
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginPage.js206
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js155
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/NewUserCreationComponent.js430
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/Page.js71
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageFooter.js71
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageHeader.js184
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/PasswordTooltip.js164
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/RulerComponent.js324
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js193
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/TextColumnManager.js53
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js113
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js184
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/UserInfoBox.js346
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js329
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js652
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js207
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js611
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js145
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js158
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js374
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js259
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js218
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js469
44 files changed, 9934 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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
62Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
52Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
42Clipperz.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
89Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
68Clipperz.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:'&nbsp;'}
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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
44Clipperz.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:'&nbsp;'}
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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
44Clipperz.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:'&nbsp;'}
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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31//#############################################################################
32
33Clipperz.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
52Clipperz.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() : '&nbsp;'}
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:'&nbsp;'}
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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
41Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
61Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31//#############################################################################
32
33Clipperz.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
44Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31//#############################################################################
32
33Clipperz.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
42Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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/*
30Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
31
32//#############################################################################
33
34Clipperz.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
45Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
45Clipperz.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:'&nbsp;'}
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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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, {
82Clipperz.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:"&nbsp;"}
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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
45Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31//#############################################################################
32
33Clipperz.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
45Clipperz.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:'&hellip;'}
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) + '&hellip;' : 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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31//#############################################################################
32
33Clipperz.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
42Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
50Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31//#############################################################################
32
33Clipperz.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
42Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31//#############################################################################
32
33Clipperz.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
44Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
47Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
45Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
43Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
69Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
47Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
41Clipperz.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 &copy; 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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
45Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Common.Components');
30
31Clipperz.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
49Clipperz.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
160Clipperz.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
164MochiKit.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
46Clipperz.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:'&nbsp;'},
100 {tag:'a', href:'#', id:this.getId('smallPreviousButton'),cls:'smallButton previous', html:'&nbsp;'},
101 {tag:'a', href:'#', id:this.getId('smallNextButton'), cls:'smallButton next', html:'&nbsp;'},
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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
45Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31//#############################################################################
32
33Clipperz.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
42Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
61Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
47Clipperz.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
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
30
31Clipperz.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
45Clipperz.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:'&nbsp;'}
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});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js
new file mode 100644
index 0000000..05563bf
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js
@@ -0,0 +1,329 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
30
31Clipperz.PM.UI.Web.Controllers.AppController = function(args) {
32
33 this._user = null;
34 this._tabSlotNames = {
35 //tabName: slotName
36 'cards': 'cardGrid',
37 // 'directLogins':'directLoginGrid',
38 'account': 'accountPanel',
39 'data': 'dataPanel',
40 'tools': 'toolsPanel'
41 };
42
43 //controllers
44 this._cardsController= null;
45 //this._directLoginsController = null;
46 this._filterController = null; //new Clipperz.PM.UI.Web.Controllers.FilterController();
47
48 //components
49 this._appPage = null;
50 this._userInfoBox = null;
51 this._tabSidePanel = null;
52
53 // MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'editCard', this, 'handleEditCard');
54 // MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'deleteCard',this, 'handleDeleteCard');
55
56 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'userDataSuccessfullySaved',this, 'userDataSuccessfullySavedHandler');
57
58 return this;
59}
60
61MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.AppController.prototype, {
62
63 'toString': function() {
64 return "Clipperz.PM.UI.Web.Controllers.AppController";
65 },
66
67 //-----------------------------------------------------------------------------
68
69 'setUser': function(anUser) {
70 this._user = anUser;
71 },
72
73 'user': function() {
74 return this._user;
75 },
76
77 //-----------------------------------------------------------------------------
78 /*
79 'tabSlotNames': function() {
80 return this._tabSlotNames;
81 },
82*/
83 'slotNameForTab': function(aTabName) {
84 return this._tabSlotNames[aTabName];
85 },
86
87 'hideAllAppPageTabSlots': function() {
88 var aTabName;
89
90 for (aTabName in this._tabSlotNames) {
91 this.appPage().hideSlot(this.slotNameForTab(aTabName));
92 }
93 },
94
95 //-----------------------------------------------------------------------------
96
97 'appPage': function() {
98 if (this._appPage == null) {
99 this._appPage = new Clipperz.PM.UI.Web.Components.AppPage();
100 }
101
102 return this._appPage;
103 },
104
105 //-----------------------------------------------------------------------------
106
107 'tabSidePanel': function() {
108 if (this._tabSidePanel == null) {
109 this._tabSidePanel = new Clipperz.PM.UI.Web.Components.TabSidePanel();
110 }
111
112 return this._tabSidePanel;
113 },
114
115 //-----------------------------------------------------------------------------
116
117 'userInfoBox': function() {
118 if (this._userInfoBox == null) {
119 this._userInfoBox = new Clipperz.PM.UI.Web.Components.UserInfoBox();
120
121 MochiKit.Signal.connect(this._userInfoBox, 'logout',this, 'handleLogout');
122 MochiKit.Signal.connect(this._userInfoBox, 'lock', this, 'handleLock');
123 MochiKit.Signal.connect(this._userInfoBox, 'unlock',this, 'handleUnlock');
124 }
125
126 return this._userInfoBox;
127 },
128
129 //-----------------------------------------------------------------------------
130
131 'accountPanel': function () {
132 if (this._accountPanel == null) {
133 this._accountPanel = new Clipperz.PM.UI.Web.Components.AccountPanel(/*{selected:'Preferences'}*/);
134 }
135
136 return this._accountPanel;
137 },
138
139 //.........................................................................
140
141 'dataPanel': function () {
142 if (this._dataPanel == null) {
143 this._dataPanel = new Clipperz.PM.UI.Web.Components.DataPanel();
144 }
145
146 return this._dataPanel;
147 },
148
149 //.........................................................................
150
151 'toolsPanel': function () {
152 if (this._toolsPanel == null) {
153 this._toolsPanel = new Clipperz.PM.UI.Web.Components.ToolsPanel();
154 }
155
156 return this._toolsPanel;
157 },
158
159 //-----------------------------------------------------------------------------
160
161 'filterController': function () {
162 if (this._filterController == null) {
163 this._filterController = new Clipperz.PM.UI.Web.Controllers.FilterController();
164 }
165
166 return this._filterController;
167 },
168
169 'cardsController': function() {
170 if (this._cardsController == null) {
171 this._cardsController = new Clipperz.PM.UI.Web.Controllers.CardsController({'filterController':this._filterController});
172 }
173
174 return this._cardsController;
175 },
176
177 //-----------------------------------------------------------------------------
178/*
179 'directLoginsController': function() {
180//Clipperz.log(">>> AppController.directLoginsController");
181 if (this._directLoginsController == null) {
182 this._directLoginsController = new Clipperz.PM.UI.Web.Controllers.DirectLoginsController({'filterController':this._filterController});
183 }
184//Clipperz.log("<<< AppController.directLoginsController");
185
186 return this._directLoginsController;
187 },
188*/
189 //-----------------------------------------------------------------------------
190
191 'populateUserInfo': function() {
192 var deferredResult;
193
194 deferredResult = new Clipperz.Async.Deferred("AppController.populateUserInfo", {trace:false});
195 deferredResult.collectResults({
196 'username':MochiKit.Base.methodcaller('displayName'),
197 'cardsNumber':[
198 MochiKit.Base.methodcaller('getRecords'),
199 function (someResults) { return someResults.length; }
200 ],
201 'directLoginsNumber': [
202 MochiKit.Base.methodcaller('getDirectLogins'),
203 function (someResults) { return someResults.length; }
204 ]
205 })
206 deferredResult.addMethod(this.userInfoBox(), 'updateUserDetails');
207 deferredResult.callback(this.user());
208
209 return deferredResult;
210 },
211
212 //-----------------------------------------------------------------------------
213
214 'run': function(args) {
215 var deferredResult;
216 varslot;
217 varpage;
218 var user;
219
220 slot = args.slot;
221 user = args.user;
222
223 this.setUser(user);
224
225 slot.setContent(this.appPage());
226
227 this.appPage().slotNamed('userInfoBox').setContent(this.userInfoBox());
228 this.appPage().slotNamed('tabSidePanel').setContent(this.tabSidePanel());
229
230 this.appPage().slotNamed('accountPanel').setContent(this.accountPanel());
231 this.appPage().slotNamed('dataPanel').setContent(this.dataPanel());
232 this.appPage().slotNamed('toolsPanel').setContent(this.toolsPanel());
233
234 this.hideAllAppPageTabSlots();
235 this.appPage().showSlot(this.slotNameForTab('cards'));
236
237 MochiKit.Signal.connect(this.tabSidePanel(), 'tabSelected',this, 'handleTabSelected');
238 MochiKit.Signal.connect(this.tabSidePanel(), 'addCard', this, 'handleAddCard');
239 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'addCard', this, 'handleAddCard');
240
241 deferredResult = new Clipperz.Async.Deferred("AppController.run", {trace:false});
242
243 deferredResult.addMethod(this.cardsController(), 'run', {slot:this.appPage().slotNamed('cardGrid'), user:user});
244 // deferredResult.addMethod(this.directLoginsController(), 'run', {slot:this.appPage().slotNamed('directLoginGrid'), user:user});
245 deferredResult.addMethod(this, 'populateUserInfo');
246
247 deferredResult.addCallback(MochiKit.Visual.ScrollTo, 'miscLinks', {duration:0});
248 deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN');
249 deferredResult.addMethod(this.tabSidePanel(), 'selectTab', 'cards');
250 deferredResult.callback();
251 },
252
253 //-----------------------------------------------------------------------------
254
255 'handleTabSelected': function (selectedTabName) {
256 var aTabName;
257 var aSlotName;
258
259//Clipperz.log(">>> AppController.handleTabSelected", selectedTabName);
260 this.hideAllAppPageTabSlots();
261 this.appPage().showSlot(this.slotNameForTab(selectedTabName));
262
263 switch (selectedTabName) {
264 case 'cards':
265 this.cardsController().focus();
266 break;
267 // case 'directLogins':
268 // this.directLoginsController().focus();
269 // break;
270 case 'data':
271 break;
272 case 'account':
273 break;
274 case 'tools':
275 break;
276 }
277//Clipperz.log("<-- AppController.handleTabSelected", aTabName);
278 },
279
280 //=============================================================================
281
282 'handleAddCard': function (aSourceElement) {
283//Clipperz.log("=== AppController.addCard", aSourceElement);
284 this.cardsController().addCard(aSourceElement);
285 },
286
287 //=============================================================================
288
289 'userDataSuccessfullySavedHandler': function (anEvent) {
290 this.populateUserInfo();
291 },
292
293 //=============================================================================
294
295 'handleLogout': function(anEvent) {
296 var deferredResult;
297
298 deferredResult = new Clipperz.Async.Deferred("AppController.handleLogout", {trace:false});
299 deferredResult.addMethod(this.user(), 'logout');
300 deferredResult.addCallback(MochiKit.Signal.signal, this, 'logout');
301 deferredResult.callback();
302
303 return deferredResult;
304 },
305
306 //-----------------------------------------------------------------------------
307
308 'handleLock': function (anEvent) {
309 return Clipperz.Async.callbacks("AppController.handleLock", [
310 MochiKit.Base.method(this.cardsController(), 'deleteAllCleanTextData'),
311 MochiKit.Base.method(this.user(), 'lock')
312 ], {trace:false});
313 },
314
315 //.............................................................................
316
317 'handleUnlock': function (anEvent) {
318 return Clipperz.Async.callbacks("AppController.handleUnock", [
319 MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress'),
320 MochiKit.Base.method(this.user(), 'login'),
321 MochiKit.Base.method(this.cardsController(), 'focus'),
322 MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'progressDone'),
323 MochiKit.Base.method(this.userInfoBox(), 'unlock')
324 ], {trace:false});
325 },
326
327 //=============================================================================
328 __syntaxFix__: "syntax fix"
329});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js
new file mode 100644
index 0000000..2340aeb
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js
@@ -0,0 +1,652 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
30
31Clipperz.PM.UI.Web.Controllers.CardDialogController = function(args) {
32 args = args || {};
33
34 Clipperz.PM.UI.Web.Controllers.CardDialogController.superclass.constructor.call(this, args);
35
36 this._record = args.record || Clipperz.Base.exception.raise('MandatoryParameter');
37 this._delegate = args.delegate || Clipperz.Base.exception.raise('MandatoryParameter');
38
39 this._referenceElement = null;
40 this._cardDialogComponent = null;
41
42 this._fieldsReferences = {};
43 this._directLoginReferences = {};
44
45 this._directLoginWizardController = null;
46 this._directLoginEditingComponent = null;
47 this._isDirectLoginEditingComponentVisible = false;
48
49 return this;
50};
51
52Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardDialogController, Object, {
53
54 'toString': function() {
55 return "Clipperz.PM.UI.Web.Controllers.CardDialogController";
56 },
57
58 //-------------------------------------------------------------------------
59
60 'record': function () {
61 return this._record;
62 },
63
64 'delegate': function () {
65 return this._delegate;
66 },
67
68 //-------------------------------------------------------------------------
69
70 'fieldsReferences': function () {
71 return this._fieldsReferences;
72 },
73
74 'directLoginReferences': function () {
75 return this._directLoginReferences;
76 },
77
78 //-------------------------------------------------------------------------
79
80 'referenceElement': function () {
81 return this._referenceElement;
82 },
83
84 'setReferenceElement': function (anElement) {
85 this._referenceElement = anElement;
86 },
87
88 //-------------------------------------------------------------------------
89
90 'cardDialogComponent': function () {
91 if (this._cardDialogComponent == null) {
92 this._cardDialogComponent = new Clipperz.PM.UI.Web.Components.CardDialogComponent();
93
94 MochiKit.Signal.connect(this._cardDialogComponent, 'cancel', this, 'handleCancel');
95 MochiKit.Signal.connect(this._cardDialogComponent, 'save', this, 'handleSave');
96
97 MochiKit.Signal.connect(this._cardDialogComponent, 'addField', this, 'handleAddField');
98 MochiKit.Signal.connect(this._cardDialogComponent, 'changedValue',this, 'handleChangedValue');
99
100 MochiKit.Signal.connect(this._cardDialogComponent, 'addDirectLogin',this, 'handleAddDirectLogin');
101 MochiKit.Signal.connect(this._cardDialogComponent, 'keyPressed',this, 'handleCardDialogComponentKeyPressed');
102 }
103
104 return this._cardDialogComponent;
105 },
106
107 //=========================================================================
108
109 'directLoginWizardController': function () {
110 if (this._directLoginWizardController == null) {
111 this._directLoginWizardController = new Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController({
112 'cardLabel': this.cardDialogComponent().title(),
113 'directLoginEditingComponent': this.directLoginEditingComponent()
114 })
115
116 MochiKit.Signal.connect(this._directLoginWizardController, 'exit',this, 'handleHideDirectLoginEditingComponent');
117 MochiKit.Signal.connect(this._directLoginWizardController, 'done',this, 'handleCompleteDirectLoginEditingComponent');
118 }
119
120 return this._directLoginWizardController;
121 },
122
123 //-------------------------------------------------------------------------
124
125 'directLoginEditingComponent': function () {
126 if (this._directLoginEditingComponent == null) {
127 this._directLoginEditingComponent = new Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent();
128
129 this.cardDialogComponent().renderDirectLoginEditingComponent(this._directLoginEditingComponent);
130
131 // MochiKit.Signal.connect(this._directLoginEditingComponent, 'back', this, 'handleHideDirectLoginEditingComponent')
132 // MochiKit.Signal.connect(this._directLoginEditingComponent, 'changedValue',this, 'handleChangedValue');
133 // MochiKit.Signal.connect(this.__directLoginEditingComponent, 'keyPressed',this, 'handleDirectLoginEditingComponentKeyPressed');
134 }
135
136 return this._directLoginEditingComponent;
137 },
138
139 //-------------------------------------------------------------------------
140
141 'isDirectLoginEditingComponentVisible': function () {
142 return this._isDirectLoginEditingComponentVisible;
143 },
144
145 'setIsDirectLoginEditingComponentVisible': function (aValue) {
146 this._isDirectLoginEditingComponentVisible = aValue;
147 },
148
149 //=========================================================================
150
151 'run': function (anElement) {
152 var deferredResult;
153
154 this.setReferenceElement(anElement);
155
156 deferredResult = new Clipperz.Async.Deferred("CardDialogController.run", {trace:false});
157 deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':11});
158
159 deferredResult.addMethod(this.cardDialogComponent(), 'deferredShowModal', {openFromElement:this.referenceElement()});
160 deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
161
162 deferredResult.addMethod(this.record(), 'label');
163 deferredResult.addMethod(this.cardDialogComponent(), 'setTitle');
164 deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
165
166 deferredResult.addMethod(this, 'updateComponentState');
167 deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
168 deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'progressDone');
169
170 deferredResult.addMethod(this.cardDialogComponent(), 'fixRendering');
171 deferredResult.addMethod(this.cardDialogComponent(), 'hideProgressMask');
172
173 if (this.record().isBrandNew()) {
174 deferredResult.addMethod(this.cardDialogComponent(), 'setHintMode', 'ON');
175 deferredResult.addMethod(this.cardDialogComponent(), 'setFocusOnTitleField');
176 }
177
178 deferredResult.addErrback(MochiKit.Base.method(this.cardDialogComponent(), 'showError'));
179 deferredResult.callback();
180
181 return deferredResult;
182 },
183
184 //=========================================================================
185
186 'updateComponentState': function () {
187 return Clipperz.Async.callbacks("CardDialogController.updateComponentState", [
188 MochiKit.Base.method(this.record(), 'hasPendingChanges'),
189 MochiKit.Base.method(this.cardDialogComponent(), 'setShouldEnableSaving'),
190
191 MochiKit.Base.method(this.record(), 'label'),
192 MochiKit.Base.method(this.cardDialogComponent(), 'setTitle'),
193 MochiKit.Base.method(this.record(), 'notes'),
194 MochiKit.Base.method(this.cardDialogComponent(), 'setNotes'),
195
196 MochiKit.Base.method(this.record(), 'fields'),
197 MochiKit.Base.values,
198 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'addCardDialogComponentWithField')),
199
200 MochiKit.Base.method(this.record(), 'directLogins'),
201 MochiKit.Base.values,
202 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'addCardDialogComponentWithDirectLogin')),
203
204 MochiKit.Base.method(this.cardDialogComponent(), 'resetNewFieldInputs'),
205 MochiKit.Base.noop
206 ], {trace:false});
207 },
208
209 //-------------------------------------------------------------------------
210
211 'addCardDialogComponentWithField': function (aField) {
212 varfieldComponent;
213
214 fieldComponent = new Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent({reference: aField.reference()});
215 MochiKit.Signal.connect(fieldComponent, 'changedValue',this, 'handleChangedValue');
216 MochiKit.Signal.connect(fieldComponent, 'performAction',this, 'handlePerformFieldAction');
217 MochiKit.Signal.connect(fieldComponent, 'deleteField',this, 'handleDeleteField');
218
219 // this.fieldsReferences().push({'field':aField, 'component':fieldComponent});
220 this.fieldsReferences()[aField.reference()] = {'field':aField, 'component':fieldComponent};
221
222 return Clipperz.Async.callbacks("CardDialogController.addCardDialogComponentWithField", [
223 MochiKit.Base.method(this.cardDialogComponent(), 'addFieldRowComponent', fieldComponent),
224
225 MochiKit.Base.method(aField, 'label'),
226 MochiKit.Base.method(fieldComponent, 'setLabel'),
227 MochiKit.Base.method(aField, 'value'),
228 MochiKit.Base.method(fieldComponent, 'setValue'),
229 MochiKit.Base.method(aField, 'actionType'),
230 MochiKit.Base.method(fieldComponent, 'setActionType'),
231 MochiKit.Base.method(aField, 'isHidden'),
232 MochiKit.Base.method(fieldComponent, 'setIsHidden')
233 ], {trace:false});
234 },
235
236 //-------------------------------------------------------------------------
237
238 'addCardDialogComponentWithDirectLogin': function (aDirectLogin) {
239 var directLoginComponent;
240
241 directLoginComponent = new Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginComponent({reference: aDirectLogin.reference()});
242 MochiKit.Signal.connect(directLoginComponent, 'changedValue', this, 'handleChangedValue');
243 MochiKit.Signal.connect(directLoginComponent, 'deleteDirectLogin',this, 'handleDeleteDirectLogin');
244 MochiKit.Signal.connect(directLoginComponent, 'editDirectLogin',this, 'handleEditDirectLogin');
245 MochiKit.Signal.connect(directLoginComponent, 'openDirectLogin',this, 'handleOpenDirectLogin');
246
247 this.directLoginReferences()[aDirectLogin.reference()] = {'directLogin':aDirectLogin, 'component':directLoginComponent};
248
249 return Clipperz.Async.callbacks("CardDialogController.addCardDialogComponentWithDirectLogin", [
250 MochiKit.Base.method(this.cardDialogComponent(), 'addDirectLoginComponent', directLoginComponent),
251 MochiKit.Base.method(this, 'refreshDirectLoginComponent', this.directLoginReferences()[aDirectLogin.reference()])
252 ], {trace:false});
253 },
254
255 //-------------------------------------------------------------------------
256
257 'refreshDirectLoginComponent': function (aDirectLoginReference) {
258 return Clipperz.Async.callbacks("CardDialogController.refreshDirectLoginComponent", [
259 MochiKit.Base.method(aDirectLoginReference['directLogin'],'favicon'),
260 // MochiKit.Base.method(aDirectLoginReference['directLogin'],'faviconData'),
261 MochiKit.Base.method(aDirectLoginReference['component'],'setFavicon'),
262 MochiKit.Base.method(aDirectLoginReference['directLogin'],'label'),
263 MochiKit.Base.method(aDirectLoginReference['component'],'setLabel')
264 ], {trace:false});
265 },
266
267 'refreshDirectLoginComponents': function () {
268 return Clipperz.Async.callbacks("CardDialogController.refreshDirectLoginComponents", [
269 MochiKit.Base.method(this, 'directLoginReferences'),
270 MochiKit.Base.values,
271 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'refreshDirectLoginComponent')),
272 Clipperz.Async.collectAll
273 ])
274 },
275
276 //-------------------------------------------------------------------------
277
278 'updateRecordValues': function () {
279 return Clipperz.Async.callbacks('CardDialogController.updateRecordValues', [
280 MochiKit.Base.method(this.cardDialogComponent(), 'title'),
281 MochiKit.Base.method(this.record(), 'setLabel'),
282 MochiKit.Base.method(this.cardDialogComponent(), 'notes'),
283 MochiKit.Base.method(this.record(), 'setNotes'),
284
285 MochiKit.Base.method(this, 'fieldsReferences'),
286 MochiKit.Base.values,
287 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'updateRecordFieldValues')),
288
289 MochiKit.Base.method(this, 'directLoginReferences'),
290 MochiKit.Base.values,
291 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'updateRecordDirectLoginValues')),
292
293 MochiKit.Base.method(this.directLoginEditingComponent(), 'directLoginReference'),
294 MochiKit.Base.method(this.record(), 'directLoginWithReference'),
295 MochiKit.Base.method(this, 'updateRecordDirectLoginDetails'),
296
297 MochiKit.Base.noop
298 ], {trace:false});
299 },
300
301 //-------------------------------------------------------------------------
302
303 'updateRecordFieldValues': function (aFieldReference) {
304 var deferredResult;
305
306 deferredResult = Clipperz.Async.callbacks('CardDialogController.updateRecordFieldValues', [
307 MochiKit.Base.method(aFieldReference['component'],'label'),
308 MochiKit.Base.method(aFieldReference['field'], 'setLabel'),
309
310 MochiKit.Base.method(aFieldReference['component'],'value'),
311 MochiKit.Base.method(aFieldReference['field'], 'setValue'),
312
313 MochiKit.Base.method(aFieldReference['component'],'isHidden'),
314 MochiKit.Base.method(aFieldReference['field'], 'setIsHidden'),
315
316 MochiKit.Base.method(aFieldReference['field'], 'actionType'),
317 MochiKit.Base.method(aFieldReference['component'],'setActionType')
318 ], {trace:false});
319
320 return deferredResult;
321 },
322
323 //-------------------------------------------------------------------------
324
325 'updateRecordDirectLoginValues': function (aDirectLoginReference) {
326 var deferredResult;
327
328 deferredResult = Clipperz.Async.callbacks('CardDialogController.updateRecordDirectLoginValues', [
329 MochiKit.Base.method(aDirectLoginReference['component'], 'label'),
330 MochiKit.Base.method(aDirectLoginReference['directLogin'], 'setLabel')
331 ], {trace:false});
332
333 return deferredResult;
334 },
335
336 //-------------------------------------------------------------------------
337
338 'updateRecordDirectLoginDetails': function (aDirectLogin) {
339 var result;
340
341 if (MochiKit.Base.isUndefinedOrNull(aDirectLogin)) {
342 result = MochiKit.Async.succeed();
343 } else {
344 result = Clipperz.Async.callbacks("CardDialogController.updateRecordDirectLoginDetails", [
345 MochiKit.Base.method(this.directLoginEditingComponent(), 'label'),
346 MochiKit.Base.method(aDirectLogin, 'setLabel'),
347 MochiKit.Base.method(this.directLoginEditingComponent(), 'favicon'),
348 MochiKit.Base.method(aDirectLogin, 'setFavicon')
349 ], {trace:false});
350 }
351
352 return result;
353 },
354
355 //=========================================================================
356
357 'addField': function () {
358 return this.record().addField({
359 'label':this.cardDialogComponent().newFieldLabel(),
360 'value':this.cardDialogComponent().newFieldValue(),
361 'isHidden':this.cardDialogComponent().newFieldIsHidden()
362 });
363 },
364
365 'handleAddField': function () {
366 return Clipperz.Async.callbacks("CardDialogController.handleAddField", [
367 MochiKit.Base.method(this, 'addField'),
368
369 MochiKit.Base.method(this, 'addCardDialogComponentWithField'),
370 MochiKit.Base.method(this.cardDialogComponent(), 'resetNewFieldInputs'),
371
372 MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'),
373 MochiKit.Base.method(this, 'handleChangedValue')
374 ], {trace:false})
375 },
376
377 //-------------------------------------------------------------------------
378
379 'handlePerformFieldAction': function (aFieldID, aTargetElement) {
380//console.log("### targetElement", aTargetElement);
381 return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [
382 MochiKit.Base.method(this.record(), 'fields'),
383 MochiKit.Base.itemgetter(aFieldID),
384 Clipperz.Async.collectResults("CardDialogController.handleDeleteField <collect results>", {
385 'value':MochiKit.Base.methodcaller('value'),
386 'type': MochiKit.Base.methodcaller('actionType')
387 }, {trace:false}),
388 MochiKit.Base.bind(function (someValues) {
389 switch (someValues['type']) {
390 case 'NONE':
391 throw "this event handler should not be triggered for fields with type 'NONE'";
392 break;
393 case 'URL':
394 var url;
395
396 url = someValues['value'];
397 if (/^https?\:\/\//.test(url) == false) {
398 url = 'http://' + url;
399 }
400
401 window.open(url);
402 break;
403 case 'EMAIL':
404 var url;
405
406 url = 'mailto:' + someValues['value'];
407
408 MochiKit.DOM.currentWindow().location = url;
409 break;
410 case 'PASSWORD':
411//Clipperz.log("SHOW PASSWORD " + someValues['value']);
412 this.showPasswordTooltip(someValues['value'], aTargetElement);
413 break;
414 }
415 }, this)
416 ], {trace:false});
417 },
418
419 //-------------------------------------------------------------------------
420
421 'handleDeleteField': function (aFieldID) {
422 return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [
423 MochiKit.Base.method(this.record(), 'fields'),
424 MochiKit.Base.itemgetter(aFieldID),
425 MochiKit.Base.method(this.record(), 'removeField'),
426
427 MochiKit.Base.method(this, 'fieldsReferences'),
428 MochiKit.Base.itemgetter(aFieldID),
429 MochiKit.Base.itemgetter('component'),
430
431 function (aComponent) {
432 return Clipperz.Async.callbacks("CardDialogController.handleDeleteField [fade and remove]", [
433 MochiKit.Base.partial(Clipperz.Visual.deferredAnimation, MochiKit.Visual.fade, aComponent.element(), {from:1.0, to:0.0, duration:0.5}),
434 // Clipperz.Visual.deferredAnimation(MochiKit.Visual.fade, aComponent.element(), {from:1.0, to:0.0, duration:0.5}),
435 MochiKit.Base.method(aComponent, 'remove')
436 ], {trace:false});
437 },
438
439 MochiKit.Base.bind(function () {
440 delete this.fieldsReferences()[aFieldID];
441 }, this),
442
443 MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'),
444 MochiKit.Base.method(this, 'handleChangedValue')
445 ], {trace:false});
446 },
447
448 //=========================================================================
449
450 'handleDeleteDirectLogin': function(aDirectLoginReference) {
451 var cardDialogComponent;
452
453 cardDialogComponent = this.cardDialogComponent();
454
455 return Clipperz.Async.callbacks("CardDialogController.handleDeleteDirectLogin", [
456 MochiKit.Base.method(this.record(), 'directLogins'),
457 MochiKit.Base.itemgetter(aDirectLoginReference),
458 MochiKit.Base.methodcaller('remove'),
459
460 MochiKit.Base.method(this, 'directLoginReferences'),
461 MochiKit.Base.itemgetter(aDirectLoginReference),
462 MochiKit.Base.itemgetter('component'),
463
464 function (aComponent) {
465 return Clipperz.Async.callbacks("CardDialogController.handleDeleteDirectLogin [fade and remove]", [
466 MochiKit.Base.partial(Clipperz.Visual.deferredAnimation, MochiKit.Visual.fade, aComponent.element(), {from:1.0, to:0.0, duration:0.5}),// Clipperz.Visual.deferredAnimation(MochiKit.Visual.fade, aComponent.element(), {from:1.0, to:0.0, duration:0.5}),
467 /// MochiKit.Base.method(aComponent, 'remove')
468 MochiKit.Base.method(cardDialogComponent, 'removeDirectLoginComponent', aComponent)
469 ], {trace:false});
470 },
471
472 MochiKit.Base.bind(function () {
473 delete this.directLoginReferences()[aDirectLoginReference];
474 }, this),
475
476 MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'),
477 MochiKit.Base.method(this, 'handleChangedValue')
478 ], {trace:false});
479 },
480
481 //-------------------------------------------------------------------------
482
483 'handleOpenDirectLogin': function (aDirectLoginReference) {
484 return Clipperz.Async.callbacks("CardDialogController.handleOpenDirectLogin", [
485 MochiKit.Base.method(this.record(), 'directLoginWithReference', aDirectLoginReference),
486 Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.openDirectLogin
487 ], {trace:false});
488 },
489
490 //-------------------------------------------------------------------------
491
492 'handleEditDirectLogin': function (aDirectLoginReference) {
493 return Clipperz.Async.callbacks("CardDialogController.handleEditDirectLogin", [
494 MochiKit.Base.method(this, 'setIsDirectLoginEditingComponentVisible', true),
495 MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginReference', aDirectLoginReference),
496 MochiKit.Base.method(this.cardDialogComponent(), 'placeDirectLoginEditingComponent'),
497 MochiKit.Base.method(this.record(), 'directLoginWithReference', aDirectLoginReference),
498 MochiKit.Base.method(this.directLoginWizardController(), 'runWithDirectLogin'),
499 MochiKit.Base.method(this.directLoginWizardController(), 'fixRulerRendering', this.cardDialogComponent().displayMode()),
500 MochiKit.Base.method(this.cardDialogComponent(), 'showDirectLoginEditingComponent')
501 ], {trace:false});
502 },
503
504 //-------------------------------------------------------------------------
505
506 'handleHideDirectLoginEditingComponent': function () {
507 return Clipperz.Async.callbacks("CardDialogController.handleHideDirectLoginEditingComponent", [
508 MochiKit.Base.method(this, 'setIsDirectLoginEditingComponentVisible', false),
509 MochiKit.Base.method(this.directLoginWizardController(), 'hideRuler'),
510 MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginReference', null),
511 MochiKit.Base.method(this, 'refreshDirectLoginComponents'),
512 MochiKit.Base.method(this.cardDialogComponent(), 'hideDirectLoginEditingComponent')
513 ], {trace:false})
514 },
515
516 'handleCompleteDirectLoginEditingComponent': function (someParameters) {
517 return Clipperz.Async.callbacks("CardDialogController.handleCompleteDirectLoginEditingComponent", [
518 MochiKit.Base.method(this, 'setIsDirectLoginEditingComponentVisible', false),
519 MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginReference', null),
520 MochiKit.Base.partial(MochiKit.Async.succeed, someParameters['hasJustBeenAdded']),
521 Clipperz.Async.deferredIf("CardDialogController.handleCompleteDirectLoginEditingComponent - should addTheEditedDirectLogin", [
522 MochiKit.Base.method(this, 'addCardDialogComponentWithDirectLogin', someParameters['directLogin'])
523 ], []),
524 MochiKit.Base.method(this, 'refreshDirectLoginComponents'),
525 MochiKit.Base.method(this, 'handleChangedValue'),
526 MochiKit.Base.method(this.cardDialogComponent(), 'hideDirectLoginEditingComponent')
527 ], {trace:false})
528 },
529
530 //=========================================================================
531
532 'handleChangedValue': function () {
533 return Clipperz.Async.callbacks("CardDialogController.handleChangedValue", [
534 MochiKit.Base.method(this, 'updateRecordValues'),
535 MochiKit.Base.method(this.record(), 'hasPendingChanges'),
536 MochiKit.Base.method(this.cardDialogComponent(), 'setShouldEnableSaving')
537 ], {trace:false});
538 },
539
540 //-------------------------------------------------------------------------
541
542 'handleSave': function () {
543 var deferredResult;
544
545 deferredResult = new Clipperz.Async.Deferred("CardDialogController.handleSave", {trace:false});
546 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':8});
547 deferredResult.addMethod(this.cardDialogComponent(), 'showProgressMask');
548 deferredResult.addMethod(this.cardDialogComponent(), 'newFieldHasPendingChanges');
549 deferredResult.addIf([
550 MochiKit.Base.method(this, 'addField')
551 ], [])
552 deferredResult.addMethod(this, 'saveChanges');
553 deferredResult.addMethod(this.cardDialogComponent(), 'deferredHideModal', {closeToElement:null});
554 deferredResult.addMethod(this.cardDialogComponent(), 'remove');
555 deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'cardDialogComponentClosed');
556
557 deferredResult.callback();
558
559 return deferredResult;
560 },
561
562 //.........................................................................
563
564 'saveChanges': function () {
565 var deferredResult;
566
567 deferredResult = new Clipperz.Async.Deferred("CardDialogController.handleSave", {trace:false});
568 deferredResult.addMethod(this.delegate(), 'saveChanges');
569deferredResult.addErrback(function (aValue) { Clipperz.log("SHIT HAPPENS!!"); return aValue; });
570
571 deferredResult.callback();
572
573 return deferredResult;
574 },
575
576 //-------------------------------------------------------------------------
577
578 'handleCancel': function () {
579 var deferredResult;
580
581 if (this.isDirectLoginEditingComponentVisible()) {
582 deferredResult = this.handleHideDirectLoginEditingComponent();
583 } else {
584 deferredResult = new Clipperz.Async.Deferred("CardDialogController.handleCancel", {trace:false});
585 // deferredResult.addMethod(this.record(), 'hasPendingChanges'),
586 deferredResult.addMethod(this.delegate(), 'hasPendingChanges'),
587 deferredResult.addIf([
588 MochiKit.Base.method(this.cardDialogComponent(), 'askConfirmationForLoosingPendingChanges')
589 ], [])
590 deferredResult.addMethod(this.delegate(), 'revertChanges');
591 deferredResult.addMethod(this.cardDialogComponent(), 'deferredHideModal', {closeToElement:this.referenceElement()});
592 deferredResult.addMethod(this.cardDialogComponent(), 'remove');
593 deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'cardDialogComponentClosed');
594
595 deferredResult.callback();
596 }
597
598 return deferredResult;
599 },
600
601 //-------------------------------------------------------------------------
602
603 'handleAddDirectLogin': function () {
604 return Clipperz.Async.callbacks("CardDialogController.handleAddDirectLogin", [
605 MochiKit.Base.method(this.record(), 'createNewDirectLogin'),
606 MochiKit.Base.bind(function (aDirectLogin) {
607 return Clipperz.Async.callbacks("CardDialogController.handleAddDirectLogin - directLogin", [
608 MochiKit.Base.method(this.cardDialogComponent(), 'newFieldHasPendingChanges'),
609 Clipperz.Async.deferredIf("cardDialogComponent.newFieldHasPendingChanges", [
610 MochiKit.Base.method(this, 'handleAddField')
611 ], []),
612
613 MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginReference', aDirectLogin.reference()),
614 MochiKit.Base.method(this.cardDialogComponent(), 'placeDirectLoginEditingComponent'),
615 MochiKit.Base.method(this.directLoginWizardController(), 'runWithDirectLogin', aDirectLogin, true),
616 MochiKit.Base.method(this.directLoginWizardController(), 'fixRulerRendering', this.cardDialogComponent().displayMode()),
617 MochiKit.Base.method(this.cardDialogComponent(), 'showDirectLoginEditingComponent')
618 ], {trace:false});
619 }, this)
620 ], {trace:false});
621 },
622
623 //=========================================================================
624
625 'handleCardDialogComponentKeyPressed': function (anEvent) {
626 if ((anEvent.key().string == 'KEY_TAB') && this.cardDialogComponent().newFieldHasPendingChanges()) {
627 anEvent.preventDefault();
628
629 // MochiKit.Signal.signal(this.cardDialogComponent(), 'addField');
630 this.handleAddField()
631 this.cardDialogComponent().focusOnNewFieldLabel();
632 }
633 },
634
635 //=========================================================================
636
637 'showPasswordTooltip': function (aValue, anElement) {
638 varpasswordTooltip;
639
640 passwordTooltip = new Clipperz.PM.UI.Web.Components.PasswordTooltip({
641 'referebceElement': anElement,
642 'text': aValue
643 });
644
645 passwordTooltip.show();
646
647
648 },
649
650 //=========================================================================
651 __syntaxFix__: "syntax fix"
652});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js
new file mode 100644
index 0000000..b1a34b2
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js
@@ -0,0 +1,207 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
30
31Clipperz.PM.UI.Web.Controllers.CardsController = function() {
32 Clipperz.PM.UI.Web.Controllers.CardsController.superclass.constructor.apply(this, arguments);
33
34 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'cardDialogComponentClosed', this, 'handleHideCard');
35
36 return this;
37}
38
39Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardsController, Clipperz.PM.UI.Web.Controllers.GridController, {
40
41 'toString': function() {
42 return "Clipperz.PM.UI.Web.Controllers.CardsController";
43 },
44
45 'createGrid': function () {
46 var grid;
47
48 grid = new Clipperz.PM.UI.Web.Components.GridComponent({columnsManagers: [
49 new Clipperz.PM.UI.Web.Components.FaviconColumnManager({
50 'name': 'Cards.favicon',
51 'selector': MochiKit.Base.methodcaller('favicon'),
52 'cssClass': 'favicon'
53 }),
54 new Clipperz.PM.UI.Web.Components.LinkColumnManager({
55 'name': 'Cards.title',
56 'selector': MochiKit.Base.methodcaller('label'),
57 'label': 'title',
58 'cssClass': 'title',
59 'comparator': Clipperz.Base.caseInsensitiveCompare,
60 'sortable': true,
61 'sorted': 'ASCENDING',
62 // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'editCard', {objectData:anObject, element:anEvent.src()})}
63 'actionMethod': MochiKit.Base.method(this, 'handleShowCard')
64 }),
65 new Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager({
66 'name': 'Cards.directLogins',
67 'selector': MochiKit.Base.methodcaller('directLoginReferences'),
68 'label': 'direct logins',
69 'cssClass': 'directLogin'
70 }),
71 new Clipperz.PM.UI.Web.Components.DateColumnManager({
72 'name': 'Cards.latestUpdate',
73 'selector': MochiKit.Base.methodcaller('updateDate'),
74 'label': 'latest update',
75 'cssClass': 'latestUpdate',
76 'format': 'd-m-Y',
77 'comparator': MochiKit.Base.compare,
78 'sortable': true,
79 'sorted': 'UNSORTED'
80 }),
81 new Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager({
82 'name': 'Cards.delete',
83 'selector': MochiKit.Base.noop,
84 'cssClass': 'delete',
85 // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'deleteCard', {objectData:anObject, element:anEvent.src()})}
86 'actionMethod': MochiKit.Base.method(this, 'handleDeleteCard')
87 })
88 ]});
89
90 grid.setComponentForSlotNamed(new Clipperz.PM.UI.Web.Components.BookmarkletComponent(), 'headerSlot');
91
92 return grid;
93 },
94
95 //-----------------------------------------------------------------------------
96
97 'getRows': function () {
98 //TODO relying on user() in GridController, bad code smell :|
99 return this.user().getRecords();
100 },
101
102 //=============================================================================
103
104 'displayEmptyContent': function () {
105 varemptyGridComponent;
106
107 emptyGridComponent = new Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent();
108
109 return Clipperz.Async.callbacks("CardsController.displayEmptyContent", [
110 MochiKit.Base.method(this.grid(), 'setNoRowsGridComponent', emptyGridComponent),
111 MochiKit.Base.bind(Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displayEmptyContent, this)
112 ], {trace:false});
113 },
114
115 'displaySelectedRows': function (aFilter) {
116 this.columnManagerWithName('Cards.directLogins').hideDirectLoginListPopup();
117
118 return Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displaySelectedRows.apply(this, arguments);
119 },
120
121 //=============================================================================
122
123 'handleShowCard': function (anObject, anEvent) {
124 var cardDialogController;
125
126 cardDialogController = new Clipperz.PM.UI.Web.Controllers.CardDialogController({record:anObject, delegate:this});
127 this.grid().selectRow(anObject);
128
129 cardDialogController.run(anEvent.src());
130 },
131
132 //.........................................................................
133
134 'handleHideCard': function () {
135 this.focus();
136 },
137
138 //-----------------------------------------------------------------------------
139
140 'addCard': function (aSourceElement) {
141 return Clipperz.Async.callbacks("CardsController.addCard", [
142 Clipperz.Async.collectResults("CardsController.addCard <inner results>", {
143 'record': MochiKit.Base.method(this.user(), 'createNewRecord'),
144 'delegate':MochiKit.Base.partial(MochiKit.Async.succeed, this)
145 }, {trace:false}),
146 function (someParameters) {
147 return new Clipperz.PM.UI.Web.Controllers.CardDialogController(someParameters);
148 },
149 MochiKit.Base.methodcaller('run', aSourceElement)
150 ], {trace:false});
151 },
152
153 //-----------------------------------------------------------------------------
154
155 'handleDeleteCard': function (anObject, anEvent) {
156 var deferredResult;
157 var confirmationDialog;
158
159 // confirmationDialog = new Clipperz.PM.UI.Common.Components.SimpleMessagePanel({
160 confirmationDialog = new Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar({
161 'title':"Delete Card",
162 'text': "Do you want to delete …",
163 'type': 'ALERT',
164 'buttons': [
165 {text:"Cancel",result:'CANCEL'},
166 {text:"Delete", result:'OK', isDefault:true}
167 ],
168 'canCancelWhileProcessing':false
169 });
170
171 deferredResult = new Clipperz.Async.Deferred("AppController.handleDeleteCard", {trace:false});
172 deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':5}),
173 deferredResult.addMethod(this.grid(), 'selectRow', anObject);
174 deferredResult.addMethod(confirmationDialog, 'deferredShowModal', {
175 'openFromElement': anEvent.src(),
176 'onOkCloseToElement': null, //MochiKit.DOM.currentDocument().body,
177 'onCancelCloseToElement':anEvent.src()
178 });
179 // deferredResult.addCallback(function () { Clipperz.log("DELETE: " + anObject.toString(), anObject); });
180 deferredResult.addMethod(this.user(), 'deleteRecord', anObject);
181 deferredResult.addBothPass(MochiKit.Base.method(this.grid(), 'unselectRow', anObject));
182 deferredResult.addMethod(this, 'saveChanges');
183 deferredResult.addMethod(confirmationDialog, 'deferredDone');
184 deferredResult.addErrbackPass(function (anError) {
185 var result;
186
187 if (! (anError instanceof MochiKit.Async.CancelledError)) {
188 result = confirmationDialog.deferredError({
189 'type': 'ALERT',
190 'title':"Error",
191 'text': Clipperz.PM.Strings.errorDescriptionForException(anError),
192 'buttons':[{text:"Close", result:'CANCEL', isDefault:true}]
193 })
194 } else {
195 result = anError;
196 }
197
198 return result;
199 });
200 deferredResult.callback();
201
202 return deferredResult;
203 },
204
205 //=============================================================================
206 __syntaxFix__: "syntax fix"
207});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js
new file mode 100644
index 0000000..38fdc08
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js
@@ -0,0 +1,611 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
30
31Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController = function(args) {
32 this._directLoginEditingComponent = args.directLoginEditingComponent|| Clipperz.Base.exception.raise('MandatoryParameter');
33 this._cardLabel = args.cardLabel || Clipperz.Base.exception.raise('MandatoryParameter');
34
35 MochiKit.Signal.connect(this._directLoginEditingComponent, 'changedValue',this, 'handleChangedValue');
36 MochiKit.Signal.connect(this._directLoginEditingComponent, 'moveForward',this, 'handleMoveForward');
37 MochiKit.Signal.connect(this._directLoginEditingComponent, 'keyPressed',this, 'handleDirectLoginEditingComponentKeyPressed');
38
39 this._directLogin = null;
40 this._directLoginHasJustBeenAdded = false;
41
42 this._rulerComponent = null;
43
44 this._steps = null;
45 this._currentStepIndex = 0;
46 this._isNextEnabled = false;
47
48 this._recordFields = null;
49 this._originalBindings = null;
50
51 this._bindingComponents = [];
52 this._formValueComponents = [];
53
54 return this;
55}
56
57MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController.prototype, {
58
59 'toString': function() {
60 return "Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController";
61 },
62
63 //-------------------------------------------------------------------------
64
65 'directLogin': function () {
66 return this._directLogin;
67 },
68
69 //-------------------------------------------------------------------------
70
71 'directLoginHasJustBeenAdded': function () {
72 return this._directLoginHasJustBeenAdded;
73 },
74
75 'setDirectLoginHasJustBeenAdded': function (aValue) {
76 this._directLoginHasJustBeenAdded = aValue;
77 },
78
79 //-------------------------------------------------------------------------
80
81 'directLoginEditingComponent': function () {
82 return this._directLoginEditingComponent;
83 },
84
85 //=============================================================================
86
87 'cardLabel': function () {
88 return this._cardLabel;
89 },
90
91 //=============================================================================
92
93 'resetCurrentStepIndex': function () {
94 this._currentStepIndex = 0;
95 this.rulerComponent().resetStatus();
96 },
97
98 //-----------------------------------------------------------------------------
99
100 'enableNext': function (aValue) {
101 this.rulerComponent().enableNext(aValue);
102 this._isNextEnabled = aValue;
103 },
104
105 'isNextEnabled': function () {
106 return this._isNextEnabled;
107 },
108
109 //-----------------------------------------------------------------------------
110
111 'enablePrevious': function (aValue) {
112 this.rulerComponent().enablePrevious(aValue);
113 },
114
115 //=============================================================================
116
117 'bindingComponents': function () {
118 return this._bindingComponents;
119 },
120
121 'resetBindingComponents': function () {
122 this.directLoginEditingComponent().clearAllBindingsComponents();
123 this._bindingComponents = [];
124 },
125
126 //=============================================================================
127
128 'formValueComponents': function () {
129 return this._formValueComponents;
130 },
131
132 'resetFormValueComponents': function () {
133 this.directLoginEditingComponent().clearAllFormValueComponents();
134 this._formValueComponents = [];
135 },
136
137 //=============================================================================
138
139 'recordFields': function () {
140 return this._recordFields;
141 },
142
143 'setRecordFields': function (aValue) {
144 this._recordFields = aValue;
145 },
146
147 'recordFieldWithReference': function (aReference) {
148 var matchingValues;
149 var result;
150
151 matchingValues = MochiKit.Base.filter(function (aField) { return aField['reference'] == aReference; }, this.recordFields());
152
153 if (matchingValues.length == 0) {
154 result = null;
155 } else {
156 result = matchingValues[0];
157 }
158
159 return result;
160 },
161
162 //-----------------------------------------------------------------------------
163
164 'originalBindings': function () {
165 return this._originalBindings;
166 },
167
168 'setOriginalBindings': function (aValue) {
169//console.log("BINDINGS", aValue);
170 this._originalBindings = aValue;
171 },
172
173 //=============================================================================
174
175 'rulerComponent': function () {
176 if (this._rulerComponent == null) {
177 this._rulerComponent = new Clipperz.PM.UI.Web.Components.RulerComponent({
178 translationContext:'Wizards.DirectLoginWizard'
179 });
180 this._rulerComponent.render();
181
182 MochiKit.Signal.connect(this._rulerComponent, 'exit', this, 'handleExit');
183 MochiKit.Signal.connect(this._rulerComponent, 'done', this, 'done');
184 MochiKit.Signal.connect(this._rulerComponent, 'moveForward',this, 'handleMoveForward');
185 MochiKit.Signal.connect(this._rulerComponent, 'moveBackward',this, 'handleMoveBackward');
186 MochiKit.Signal.connect(this._rulerComponent, 'cursorMoved',this, 'handleCursorMoved');
187 }
188
189 return this._rulerComponent;
190 },
191
192 //-----------------------------------------------------------------------------
193
194 'showRuler': function (someSteps) {
195 var rulerElement;
196
197 this.setSteps(someSteps);
198
199 rulerElement = this.rulerComponent().element();
200 this.directLoginEditingComponent().disableAllPanels();
201
202 MochiKit.Style.showElement(rulerElement);
203 MochiKit.Style.setElementPosition(rulerElement, {x:-1000, y:this.directLoginEditingComponent().bottomMargin()});
204 new MochiKit.Visual.Move(rulerElement, {
205 x:0, y:this.directLoginEditingComponent().bottomMargin(),
206 mode:'absolute',
207 duration:1,
208 afterFinish:MochiKit.Base.method(this, 'handleCursorMoved')
209 });
210 },
211
212 'fixRulerRendering': function (aValue) {
213 this.rulerComponent().setDisplayMode(aValue);
214 },
215
216 //-----------------------------------------------------------------------------
217
218 'hideRuler': function () {
219 new MochiKit.Visual.Move(this.rulerComponent().element(), {x:-1000, mode:'relative', duration:1});
220 },
221
222 'doneWithRuler': function () {
223 var rulerComponentElement;
224
225 rulerComponentElement = this.rulerComponent().element();
226 new MochiKit.Visual.Move(this.rulerComponent().element(), {
227 x:1000,
228 mode:'relative',
229 duration:1,
230 // afterFinish:MochiKit.Base.partial(MochiKit.Style.hideElement, rulerComponentElement)
231 afterFinish:function () { MochiKit.Style.hideElement(rulerComponentElement); }
232 });
233 },
234
235 //=============================================================================
236
237 'addNewDirectLoginRulerSteps': function () {
238 return MochiKit.Base.concat([ 'LABEL'], this.editDirectLoginRulerSteps());
239
240 },
241
242 'editDirectLoginRulerSteps': function () {
243 return [ /*'TYPE',*/ 'CONFIGURATION', 'BINDINGS','FAVICON', 'DONE'];
244 },
245
246 //-------------------------------------------------------------------------
247
248 'runWithDirectLogin': function (aDirectLogin, hasJustBeenAdded) {
249 this._directLogin = aDirectLogin;
250 this.setDirectLoginHasJustBeenAdded(hasJustBeenAdded);
251
252 return Clipperz.Async.callbacks("DirectLoginWizardController.runWithDirectLogin", [
253 MochiKit.Base.method(aDirectLogin, 'label'),
254 MochiKit.Base.method(this.directLoginEditingComponent(), 'setLabel'),
255
256 MochiKit.Base.method(aDirectLogin, 'favicon'),
257 MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginFavicon'),
258
259 MochiKit.Base.method(aDirectLogin, 'bookmarkletConfiguration'),
260 MochiKit.Base.method(this.directLoginEditingComponent(), 'setBookmarkletConfiguration'),
261
262 MochiKit.Base.method(aDirectLogin, 'bindings'),
263 MochiKit.Base.method(this, 'setOriginalBindings'),
264
265 MochiKit.Base.method(aDirectLogin, 'record'),
266 MochiKit.Base.methodcaller('fields'),
267 MochiKit.Base.values,
268 MochiKit.Base.partial(MochiKit.Base.map, Clipperz.Async.collectResults("Record.directLoginReferences - collectResults", {
269 'reference': MochiKit.Base.methodcaller('reference'),
270 'label': MochiKit.Base.methodcaller('label'),
271 'isHidden': MochiKit.Base.methodcaller('isHidden'),
272 'value': MochiKit.Base.methodcaller('value')
273 }, {trace:false})),
274 Clipperz.Async.collectAll,
275
276 MochiKit.Base.method(this, 'setRecordFields'),
277
278 MochiKit.Base.partial(MochiKit.Async.succeed, hasJustBeenAdded),
279 Clipperz.Async.deferredIf("Direct login has just been added", [
280 MochiKit.Base.method(this, 'addNewDirectLoginRulerSteps')
281 ], [
282 MochiKit.Base.method(this, 'editDirectLoginRulerSteps')
283 ]),
284 MochiKit.Base.method(this, 'showRuler')
285 ], {trace:false});
286 },
287
288 //-----------------------------------------------------------------------------
289
290 'checkState': function () {
291 var enablePrevious;
292 var enableNext;
293
294 enablePrevious = true;
295 enableNext = false;
296
297 this.directLoginEditingComponent().disableAllPanels();
298
299 switch(this.currentStep()) {
300 case 'LABEL':
301 this.directLoginEditingComponent().enableLabelField();
302
303 enableNext = (this.directLoginEditingComponent().label() != '');
304 enablePrevious = false;
305 break;
306 case 'TYPE':
307 this.directLoginEditingComponent().enableTypeField();
308
309 enableNext = true;
310 enablePrevious = true;
311 break
312 case 'CONFIGURATION':
313 this.directLoginEditingComponent().enableConfigurationField();
314
315 enableNext = (this.directLoginEditingComponent().bookmarkletConfiguration() != '');
316
317 if (enableNext == true) {
318 try {
319 Clipperz.PM.DataModel.DirectLogin.checkBookmarkletConfiguration(this.directLoginEditingComponent().bookmarkletConfiguration());
320 this.directLoginEditingComponent().removeHighlightConfigurationSyntaxError();
321 } catch (e) {
322 this.directLoginEditingComponent().highlightConfigurationSyntaxError();
323 enableNext = false;
324 }
325 }
326 break;
327 case 'BINDINGS':
328 enableNext = MochiKit.Iter.every(this.bindingComponents(), function (aBindingComponent) { return aBindingComponent.selectedValue() != null; })
329 this.directLoginEditingComponent().enableBindingFields();
330 break;
331 case 'FAVICON':
332 enableNext = true;
333 this.directLoginEditingComponent().enableFaviconField();
334 break;
335 case 'DONE':
336 enableNext = true;
337 this.directLoginEditingComponent().enableDonePanel();
338 break;
339 }
340
341 if (this.currentStepIndex() > 0) {
342 this.enablePrevious(enablePrevious);
343 } else {
344 this.enablePrevious(false);
345 }
346 this.enableNext(enableNext);
347 },
348
349 //-----------------------------------------------------------------------------
350
351 'setFocus': function () {
352 switch(this.currentStep()) {
353 case 'LABEL':
354 this.directLoginEditingComponent().focusOnLabelElement();
355 break;
356 case 'TYPE':
357 break;
358 case 'CONFIGURATION':
359 this.directLoginEditingComponent().focusOnBookmarkletConfigurationElement();
360 break;
361 case 'BINDINGS':
362 // this.directLoginEditingComponent().getElement('???').focus();
363 break;
364 case 'FAVICON':
365 this.directLoginEditingComponent().focusOnFaviconElement();
366 break;
367 case 'DONE':
368 break;
369 }
370 },
371
372 //=============================================================================
373
374 'steps': function () {
375 return this._steps;
376 },
377
378 'setSteps': function (aValue) {
379 this._steps = aValue;
380
381 this.rulerComponent().setSteps(aValue);
382 this.resetCurrentStepIndex();
383 },
384
385 'currentStepIndex': function () {
386 return this._currentStepIndex;
387 },
388
389 'currentStep': function () {
390 return this.steps()[this.currentStepIndex()];
391 },
392
393 //=============================================================================
394
395 'handleExit': function () {
396 MochiKit.Signal.signal(this, 'exit');
397 },
398
399 'done': function () {
400 this.doneWithRuler();
401
402 Clipperz.Async.callbacks("DirectLoginWizardController.done", [
403 MochiKit.Base.method(this.directLoginEditingComponent(), 'label'),
404 MochiKit.Base.method(this.directLogin(), 'setLabel'),
405
406 MochiKit.Base.method(this.directLoginEditingComponent(), 'bookmarkletConfiguration'),
407 MochiKit.Base.method(this.directLogin(), 'setBookmarkletConfiguration'),
408
409 //Bindings
410 MochiKit.Base.method(this.directLoginEditingComponent(), 'bindingComponents'),
411 // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.bind(function (aBindingComponent) {
412 Clipperz.Async.forEach(MochiKit.Base.bind(function (aBindingComponent) {
413//console.log("aBindingComponent", aBindingComponent);
414 // this.directLogin().
415 return Clipperz.Async.callbacks("DirectLoginWizardController.done - update directLogin bindings", [
416 MochiKit.Base.method(this.directLogin(), 'bindings'),
417 MochiKit.Base.itemgetter(aBindingComponent.formFieldName()),
418 MochiKit.Base.methodcaller('setFieldKey', aBindingComponent.selectedValue())
419 ], {trace:false});
420 }, this)),
421
422 MochiKit.Base.method(this.directLoginEditingComponent(), 'favicon'),
423 MochiKit.Base.method(this.directLogin(), 'setFavicon'),
424
425 MochiKit.Base.partial(MochiKit.Signal.signal, this, 'done', {
426 'directLogin': this.directLogin(),
427 'hasJustBeenAdded':this.directLoginHasJustBeenAdded()
428 })
429 ], {trace:false});
430 },
431
432 //=============================================================================
433
434 'handleMoveBackward': function () {
435 if (this._currentStepIndex > 0) {
436 varafterMoveAction;
437
438 this._currentStepIndex --;
439 afterMoveAction = MochiKit.Base.noop;
440
441 switch(this.currentStep()) {
442 case 'LABEL':
443 break;
444 case 'TYPE':
445 break;
446 case 'CONFIGURATION':
447 break;
448 case 'BINDINGS':
449 break;
450 case 'FAVICON':
451 break;
452 case 'DONE':
453 break;
454 };
455
456 this.rulerComponent().moveBackward(afterMoveAction);
457 }
458
459 if (this._currentStepIndex == 0) {
460 this.enablePrevious(false);
461 }
462 },
463
464 'handleMoveForward': function () {
465 if (this.isNextEnabled()) {
466 varafterMoveAction;
467
468 this._currentStepIndex ++;
469 afterMoveAction = MochiKit.Base.noop;
470
471 switch(this.currentStep()) {
472 case 'LABEL':
473 break;
474 case 'TYPE':
475 break;
476 case 'CONFIGURATION':
477 break;
478 case 'BINDINGS':
479 this.resetBindingComponents();
480 this.resetFormValueComponents();
481
482 afterMoveAction = MochiKit.Base.partial(Clipperz.Async.callbacks, "DirectLoginWizardController.handleMoveForward - BINDINGS", [
483 MochiKit.Base.method(this.directLogin(), 'setBookmarkletConfiguration', this.directLoginEditingComponent().bookmarkletConfiguration()),
484
485 MochiKit.Base.method(this.directLogin(), 'favicon'),
486 MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginFavicon'),
487
488 MochiKit.Base.method(this.directLogin(), 'bindings'),
489 MochiKit.Base.values,
490 Clipperz.Async.forEach(MochiKit.Base.bind(function (aBinding) {
491 var bindingComponent;
492
493 bindingComponent = new Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent({
494 formFieldName: aBinding.key(),
495 fields: this.recordFields(),
496 selectedFieldKey: aBinding.fieldKey()
497 });
498
499 this.bindingComponents().push(bindingComponent);
500
501 MochiKit.Signal.connect(bindingComponent, 'bindChange', this, 'handleBindChange', bindingComponent);
502 this.directLoginEditingComponent().addBindingComponent(bindingComponent);
503
504 }, this)),
505
506 MochiKit.Base.method(this.directLogin(), 'formValues'),
507 MochiKit.Base.values,
508 Clipperz.Async.forEach(MochiKit.Base.bind(function (aFormValue) {
509 var formValueComponent;
510
511 formValueComponent = new Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent({
512 'formFieldName': aFormValue.key(),
513 'fieldOptions': aFormValue.fieldOptions(),
514 'initialValue': aFormValue.value()
515 });
516
517 this.formValueComponents().push(formValueComponent);
518
519 MochiKit.Signal.connect(formValueComponent, 'formValueChange', this, 'handleFormValueChange', formValueComponent);
520 this.directLoginEditingComponent().addFormValueComponent(formValueComponent);
521 }, this))
522
523 ], {trace:false});
524
525 break;
526 case 'FAVICON':
527 break;
528 case 'DONE':
529 this.directLoginEditingComponent().setDoneDescriptionWithKeys({
530 '__cardName__': this.cardLabel(),
531 '__directLoginName__': this.directLoginEditingComponent().label()
532 });
533 break;
534 };
535
536 this.rulerComponent().moveForward(afterMoveAction);
537 };
538 },
539
540 'handleCursorMoved': function () {
541 this.checkState();
542 this.setFocus();
543 },
544
545 //-------------------------------------------------------------------------
546
547 'handleChangedValue': function (anEvent) {
548 this.checkState();
549 },
550
551 //.........................................................................
552
553 'handleBindChange': function (aDirectLoginEditingBindingComponent) {
554 varselectedField;
555
556 selectedField = this.recordFieldWithReference(aDirectLoginEditingBindingComponent.selectedValue());
557
558 return Clipperz.Async.callbacks("DirectLoginWizardController.handleBindChange", [
559 MochiKit.Base.method(this.directLogin(), 'bindings'),
560 MochiKit.Base.itemgetter(aDirectLoginEditingBindingComponent.formFieldName()),
561 MochiKit.Base.methodcaller('setFieldKey', selectedField['reference']),
562 function () {
563 if (selectedField != null) {
564 aDirectLoginEditingBindingComponent.setFieldValue(selectedField['value']);
565 aDirectLoginEditingBindingComponent.setIsHidden(selectedField['isHidden']);
566 } else {
567 aDirectLoginEditingBindingComponent.setFieldValue('');
568 aDirectLoginEditingBindingComponent.setIsHidden(false);
569 }
570 },
571 MochiKit.Base.method(this, 'checkState')
572 ], {trace:false});
573 },
574
575 //.........................................................................
576
577 'handleFormValueChange': function (someOptions) {
578 return Clipperz.Async.callbacks("DirectLoginWizardController.handleFormValueChange", [
579 MochiKit.Base.method(this.directLogin(), 'formValues'),
580 MochiKit.Base.itemgetter(someOptions['fieldName']),
581 MochiKit.Base.methodcaller('setValue', someOptions['selectedValue']),
582 MochiKit.Base.method(this, 'checkState')
583 ], {trace:false});
584 },
585
586 //-------------------------------------------------------------------------
587
588 'handleDirectLoginEditingComponentKeyPressed': function (anEvent) {
589 if (anEvent.key().string == 'KEY_ENTER') {
590 if (anEvent.target().nodeName != 'TEXTAREA') {
591 anEvent.preventDefault();
592 this.handleMoveForward();
593 }
594 } else if (anEvent.key().string == 'KEY_TAB') {
595 this.handleMoveForward();
596 if ((anEvent.target().nodeName == 'INPUT') || (anEvent.target().nodeName == 'TEXTAREA')) {
597 anEvent.preventDefault();
598 }
599 } else if ((anEvent.key().string == 'KEY_ARROW_RIGHT') && (anEvent.modifier().meta == true)) {
600 this.handleMoveForward();
601 } else if ((anEvent.key().string == 'KEY_ARROW_LEFT') && (anEvent.modifier().meta == true)) {
602 this.handleMoveBackward();
603 } else if (anEvent.key().string == 'KEY_ESCAPE') {
604 anEvent.stop();
605 this.handleExit();
606 }
607 },
608
609 //=============================================================================
610 __syntaxFix__: "syntax fix"
611});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js
new file mode 100644
index 0000000..28401a2
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js
@@ -0,0 +1,145 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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/*
30Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
31
32Clipperz.PM.UI.Web.Controllers.DirectLoginsController = function() {
33 Clipperz.PM.UI.Web.Controllers.DirectLoginsController.superclass.constructor.apply(this, arguments);
34
35 return this;
36};
37
38Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.DirectLoginsController, Clipperz.PM.UI.Web.Controllers.GridController, {
39
40 'createGrid': function () {
41 return new Clipperz.PM.UI.Web.Components.GridComponent({columnsManagers: [
42 new Clipperz.PM.UI.Web.Components.FaviconColumnManager({
43 'name': 'DirectLogins.favicon',
44 'selector': MochiKit.Base.methodcaller('favicon'),
45 'cssClass': 'favicon'
46 }),
47 // new Clipperz.PM.UI.Web.Components.LinkColumnManager({
48 new Clipperz.PM.UI.Web.Components.DirectLoginColumnManager({
49 'name': 'DirectLogins.title',
50 'selector': MochiKit.Base.methodcaller('label'),
51 'label': 'title',
52 'cssClass': 'title',
53 'comparator': Clipperz.Base.caseInsensitiveCompare,
54 'sortable': true,
55 'sorted': 'ASCENDING',
56 'actionMethod': MochiKit.Base.methodcaller('runDirectLogin')
57 }),
58 // new Clipperz.PM.UI.Web.Components.TextColumnManager({ //should be StrengthColumnManager
59 // 'label':'strength',
60 // 'cssClass':'title',
61 // 'selector': MochiKit.Base.methodcaller('label') //should be 'strength' or a strenght evaluation function
62 // }),
63 new Clipperz.PM.UI.Web.Components.LinkColumnManager({
64 'name': 'DirectLogins.cardTitle',
65 'selector': MochiKit.Base.compose(MochiKit.Base.methodcaller('label'), MochiKit.Base.methodcaller('record')),
66 'label': 'card',
67 'cssClass': 'cardTitle',
68 'comparator': Clipperz.Base.caseInsensitiveCompare,
69 'sortable': true,
70 'sorted': 'UNSORTED',
71 'actionMethod': MochiKit.Base.method(this, 'handleShowCard')
72 }),
73 // new Clipperz.PM.UI.Web.Components.TextColumnManager({ //should be StrengthColumnManager
74 // 'label':'last access',
75 // 'cssClass':'title',
76 // 'selector': MochiKit.Base.methodcaller('label')
77 // // 'sortable': true,
78 // // 'sorted': 'UNSORTED'
79 // }),
80 // new Clipperz.PM.UI.Web.Components.TextColumnManager({
81 // 'label':'commands',
82 // 'cssClass':'title',
83 // 'selector': MochiKit.Base.methodcaller('label'), //should be a function for commands display
84 // }),
85 new Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager({
86 'name': 'DirectLogins.delete',
87 'selector': MochiKit.Base.noop,
88 'cssClass': 'delete',
89 // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'deleteDirectLogin', {objectData:anObject, element:anEvent.src()})}
90 'actionMethod': MochiKit.Base.method(this, 'handleDeleteDirectLogin')
91 })
92 ]});
93
94 },
95
96 //-----------------------------------------------------------------------------
97
98 'getRows': function () {
99 //TODO: relying on user() in GridController, bad code smell :|
100 return this.user().getDirectLogins();
101 },
102
103 //-----------------------------------------------------------------------------
104
105 'handleShowCard': function (anObject, anEvent) {
106 var cardDialogController;
107
108 cardDialogController = new Clipperz.PM.UI.Web.Controllers.CardDialogController({record:anObject.record()})
109 cardDialogController.run(anEvent.src());
110 },
111
112 //-----------------------------------------------------------------------------
113
114 'handleDeleteDirectLogin': function (anObject, anEvent) {
115 var deferredResult;
116 var confirmationDialog;
117
118 confirmationDialog = new Clipperz.PM.UI.Common.Components.SimpleMessagePanel({
119 title:"Delete DirectLogin",
120 text:"Do you want to delete …",
121 type:'ALERT',
122 buttons: [
123 {text:"Cancel",result:'CANCEL', isDefault:true},
124 {text:"Delete", result:'OK'}
125 ]
126 });
127
128 deferredResult = new Clipperz.Async.Deferred("AppController.handleDeleteCard", {trace:false});
129 // deferredResult = confirmationDialog.deferredShow({openFromElement:anEvent.src(), onOkCloseToElement:MochiKit.DOM.currentDocument().body, onCancelCloseToElement:anEvent.src()});
130 deferredResult.addMethod(confirmationDialog, 'deferredShow', {
131 'openFromElement': anEvent.src(),
132 'onOkCloseToElement': null, //MochiKit.DOM.currentDocument().body,
133 'onCancelCloseToElement':anEvent.src()
134 });
135 deferredResult.addCallback(function () { Clipperz.log("DELETE: " + anObject.toString(), anObject); });
136 deferredResult.addErrbackPass(function () { Clipperz.log("skip deletion: " + anObject.toString(), anObject); });
137 deferredResult.callback();
138
139 return deferredResult;
140 },
141
142 //-----------------------------------------------------------------------------
143 __syntaxFix__: "syntax fix"
144});
145*/ \ No newline at end of file
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js
new file mode 100644
index 0000000..13e02bc
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js
@@ -0,0 +1,158 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
30
31Clipperz.PM.UI.Web.Controllers.FilterController = function(args) {
32 args = args || {};
33
34 Clipperz.PM.UI.Web.Controllers.FilterController.superclass.constructor.call(this, args);
35
36 this._filterElements = [];
37 this._filter = "";
38
39 this._pendingSearchClicks = 0;
40
41 return this;
42};
43
44
45Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.FilterController, Object, {
46
47 //-----------------------------------------------------------------------------
48
49 'getFilter': function () {
50 return this._filter;
51 },
52
53 '_setFilter': function (aFilterElement, aFilter) {
54 if (aFilter != this._filter) {
55 this._filter = aFilter;
56 MochiKit.Signal.signal(this, 'filterUpdated', aFilter);
57 this.updateFilterElements(aFilterElement, aFilter);
58 }
59 },
60
61 'setFilter': function (aFilter) {
62 this._setFilter(null, aFilter);
63 },
64
65 //-----------------------------------------------------------------------------
66
67 'filterElements': function () {
68 return this._filterElements;
69 },
70
71 'registerFilterElement': function (aFilterElement) {
72//Clipperz.log("=== FilterController.registerFilterElement", aFilterElement);
73 this._filterElements.push(aFilterElement);
74 MochiKit.Signal.connect(aFilterElement, 'onkeydown', this, 'searchClickHandler');
75 MochiKit.Signal.connect(aFilterElement, 'onfocus', this, 'searchClickHandler');
76 },
77
78 'removeFilterElement': function (aFilterElement) {
79 var i;
80 var filterElements;
81 for (i=0; i < filterElements; i++) {
82 if (filterElements[i] == aFilterElement);
83 filterElements.splice(i, 1);
84 // TODO unregister/disconnect filterElement ??MochiKit.Signal.disconnect(this.grid().filterElement(), 'updateFilter', this.filterController(), 'handleUpdateFilter');
85 }
86 },
87
88 'updateFilterElements': function (aSourceElement, aFilterString) {
89 MochiKit.Iter.forEach(this.filterElements(),
90 function (aFilterElement) {
91 if (aFilterElement != aSourceElement) {
92 aFilterElement.value = aFilterString;
93 }
94 }
95 );
96
97 if (aSourceElement != null) {
98 aSourceElement.focus();
99 }
100 },
101
102 //-----------------------------------------------------------------------------
103
104 'run': function () {
105//Clipperz.log("=== FilterController.run");
106 },
107
108 //-----------------------------------------------------------------------------
109
110 'pendingSearchClicks': function () {
111 return this._pendingSearchClicks;
112 },
113
114 'incrementPendingSearchClicks': function () {
115 this._pendingSearchClicks++;
116 },
117
118 'decrementPendingSearchClicks': function () {
119 this._pendingSearchClicks--;
120 },
121
122 //-----------------------------------------------------------------------------
123
124 'searchClickHandler': function (anEvent) {
125 if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) {
126 anEvent.preventDefault();
127 } else {
128 var value;
129
130 if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ESCAPE')) {
131 value = ""
132 } else if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ARROW_UP')) {
133 } else if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ARROW_DOWN')) {
134 } else {
135 value = null;
136 }
137
138 this.incrementPendingSearchClicks();
139 MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, "searchClickDeferredHandler", anEvent.src(), value));
140 }
141 },
142
143 //.........................................................................
144
145 'searchClickDeferredHandler': function (aFilterElement, aValue) {
146 if (aValue != null) {
147 aFilterElement.value = aValue;
148 }
149
150 this.decrementPendingSearchClicks();
151 if (this.pendingSearchClicks()==0) {
152 this._setFilter(aFilterElement, aFilterElement.value);
153 }
154 },
155
156 //-----------------------------------------------------------------------------
157 'syntaxFix': 'syntax fix'
158}); \ No newline at end of file
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js
new file mode 100644
index 0000000..740a091
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js
@@ -0,0 +1,374 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
30
31Clipperz.PM.UI.Web.Controllers.GridController = function(args) {
32 args = args || {};
33
34 Clipperz.PM.UI.Web.Controllers.GridController.superclass.constructor.call(this, args);
35
36 this._grid = null;
37 this._user = null;
38 this._sortedColumnManager = null;
39 this._cachedObjects = null;
40 this._filterController = args.filterController || null;
41
42 this._deferredDisplaySelectedRowsInvocation = null;
43
44 return this;
45};
46
47Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.GridController, Object, {
48
49 'toString': function() {
50 return "Clipperz.PM.UI.Web.Controllers.GridController";
51 },
52
53 //-----------------------------------------------------------------------------
54
55 'createGrid': function () {
56 throw Clipperz.Base.exception.AbstractMethod;
57 },
58
59 'setupWithGrid': function (aGrid) {
60 this._grid = aGrid;
61
62 if (this._grid != null) {
63 MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) {
64 if (aColumnManager.isSortable()) {
65 if (aColumnManager.isSorted()) {
66 this.setSortedColumnManager(aColumnManager);
67 }
68 MochiKit.Signal.connect(aColumnManager, 'sort', this, 'handleColumnManagerSort');
69 }
70 MochiKit.Signal.connect(aColumnManager, 'selectRow', this, 'handleColumnManagerSelectRow');
71 MochiKit.Signal.connect(aColumnManager, 'unselectRow', this, 'handleColumnManagerUnselectRow');
72 }, this);
73 }
74 },
75
76 'grid': function() {
77 if (this._grid == null) {
78 this.setupWithGrid(this.createGrid());
79 }
80
81 return this._grid;
82 },
83
84 'filterController': function () {
85//Clipperz.log('GridController.filterController >>>', this._filterController);
86 if (this._filterController == null) {
87 this._filterController = new Clipperz.PM.UI.Web.Controllers.FilterController();
88 }
89//Clipperz.log('GridController.filterController <<<', this._filterController);
90 return this._filterController;
91 },
92
93 //-----------------------------------------------------------------------------
94
95 'columnsManagers': function () {
96 return this.grid().columnsManagers();
97 },
98
99 'columnManagerWithName': function (aName) {
100 varmanagers;
101 var result;
102
103 managers = MochiKit.Base.filter(function (aManager) { return aManager.name() == aName; } , this.columnsManagers());
104
105 if (managers.length == 1) {
106 result = managers[0];
107 } else if (managers.length == 0) {
108 result = null;
109 } else {
110 throw "WTF!!!";
111 }
112
113 return result;
114 },
115
116 'sortedColumnManager': function () {
117 return this._sortedColumnManager;
118 },
119
120 'setSortedColumnManager': function(aValue) {
121 if (aValue.sorted() != 'UNSORTED') {
122 this._sortedColumnManager = aValue;
123 } else {
124 this._sortedColumnManager = null;
125 }
126 },
127
128 //-----------------------------------------------------------------------------
129
130 'handleColumnManagerSort': function(aSelectedColumnManager) {
131 MochiKit.Iter.forEach(this.columnsManagers(), function(aColumnManager) {
132 if (aSelectedColumnManager != aColumnManager) {
133 if (aColumnManager.isSortable()) {
134 aColumnManager.setSorted('UNSORTED');
135 }
136 }
137 });
138
139 aSelectedColumnManager.toggleSorting();
140 this.setSortedColumnManager(aSelectedColumnManager);
141
142 this.displaySelectedRows(this.filterController().getFilter());
143 },
144
145 'handleColumnManagerSelectRow': function (aRowObject) {
146 this.grid().selectRow(aRowObject);
147 },
148
149 'handleColumnManagerUnselectRow': function (aRowObject) {
150 this.grid().unselectRow(aRowObject);
151 },
152
153 //-----------------------------------------------------------------------------
154
155 'handleFilterUpdated': function (aFilter) {
156 if (this.grid().isActive()) {
157 this.displaySelectedRows(aFilter);
158 }
159 },
160
161 //-----------------------------------------------------------------------------
162 //TODO: relying on user() in GridController, bad code smell :|
163 //mhh: a controller should have access to business logic object too. Otherwise it will fail its controller role. [Giulio Cesare]
164
165 'setUser': function(anUser) {
166 this._user = anUser;
167 },
168
169 'user': function() {
170 return this._user;
171 },
172
173 //-----------------------------------------------------------------------------
174
175 'run': function(args) {
176//Clipperz.log("=== GridController.run");
177 var deferredResult;
178
179 this.setUser(args.user);
180 args.slot.setContent(this.grid());
181 this.filterController().registerFilterElement(this.grid().filterElement());
182 MochiKit.Signal.connect(this.filterController(), 'filterUpdated', this, 'handleFilterUpdated');
183
184 return this.displaySelectedRows();
185 },
186
187 //-----------------------------------------------------------------------------
188
189 'handleGenericError': function(anError) {
190 var result;
191
192 if (anError instanceof MochiKit.Async.CancelledError) {
193 result = anError;
194 } else {
195Clipperz.log("## GridController - GENERIC ERROR" + "\n" + "==>> " + anError + " <<==\n" + anError.stack);
196 result = new MochiKit.Async.CancelledError(anError);
197 }
198
199 return result;
200 },
201
202 //-----------------------------------------------------------------------------
203
204 'getRows': function () {
205 throw Clipperz.Base.AbstractMethod;
206 },
207
208 //-----------------------------------------------------------------------------
209
210 'setDeferredDisplaySelectedRowsInvocation': function (aDeferred) {
211 if (this._deferredDisplaySelectedRowsInvocation != null) {
212 this._deferredDisplaySelectedRowsInvocation.cancel();
213 }
214
215 this._deferredDisplaySelectedRowsInvocation = aDeferred;
216 },
217
218 //-----------------------------------------------------------------------------
219
220 'resetDeferredDisplaySelectedRowsInvocation': function () {
221 if (this._deferredDisplaySelectedRowsInvocation != null) {
222 this._deferredDisplaySelectedRowsInvocation.cancel();
223 }
224 },
225
226 //-----------------------------------------------------------------------------
227
228 '_displaySelectedRows': function (aFilter, someRows) {
229 var result;
230 var delay;
231
232 if ((aFilter != null) && (aFilter != '')) {
233 var filter;
234 varfilterRegExp;
235
236 filter = aFilter.replace(/[^A-Za-z0-9]/g, "\\$&");
237 filterRegExp = new RegExp(filter, "i");
238 result = MochiKit.Base.filter(function (aCachedResult) { return filterRegExp.test(aCachedResult['_searchableContent'])}, someRows);
239 delay = 0.002*result.length;
240
241 this.setDeferredDisplaySelectedRowsInvocation(MochiKit.Async.callLater(delay, MochiKit.Base.method(this, "deferredDisplaySelectedRows", result)));
242 } else {
243 result = someRows;
244
245 this.resetDeferredDisplaySelectedRowsInvocation();
246 this.deferredDisplaySelectedRows(result);
247 }
248
249 },
250
251 //-----------------------------------------------------------------------------
252
253 'deferredDisplaySelectedRows': function (someRows) {
254 if (this.sortedColumnManager() != null) {
255 var comparator;
256 var fieldName;
257
258 fieldName = this.sortedColumnManager().name();
259 comparator = this.sortedColumnManager().comparator();
260 if (this.sortedColumnManager().sorted() == 'DESCENDING') {
261 comparator = Clipperz.Base.reverseComparator(comparator);
262 }
263
264 someRows.sort(MochiKit.Base.partial(function(aKey, aComparator, aObject, bObject){
265 return comparator(aObject[aKey], bObject[aKey]);
266 }, this.sortedColumnManager().name(), comparator));
267 }
268
269 this.grid().update(someRows);
270 this.grid().endSearch();
271 },
272
273 //-----------------------------------------------------------------------------
274
275 'getCachedValues': function () {
276 var deferredResult;
277
278 if (this._cachedObjects != null) {
279 deferredResult = MochiKit.Async.succeed(this._cachedObjects);
280 } else {
281 var objectCollectResultsConfiguration;
282
283 objectCollectResultsConfiguration = {
284 '_rowObject': MochiKit.Async.succeed,
285 '_reference': MochiKit.Base.methodcaller('reference'),
286 '_searchableContent':MochiKit.Base.methodcaller('searchableContent')
287 };
288
289 MochiKit.Base.map(function (aColumnManager) {
290 objectCollectResultsConfiguration[aColumnManager.name()] = aColumnManager.selector();
291 }, this.columnsManagers());
292
293 deferredResult = new Clipperz.Async.Deferred("GridController.getCachedValues", {trace:false});
294 deferredResult.addMethod(this, 'getRows');
295 deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("GridController.getCachedValues - collectResults", objectCollectResultsConfiguration, {trace:false}));
296 deferredResult.addCallback(Clipperz.Async.collectAll);
297 deferredResult.addCallback(MochiKit.Base.bind(function (someRows) {
298 this._cachedObjects = someRows;
299 return this._cachedObjects;
300 }, this));
301 deferredResult.callback();
302 }
303
304 return deferredResult;
305 },
306
307 //-----------------------------------------------------------------------------
308
309 'hasPendingChanges': function () {
310 return this.user().hasPendingChanges();
311 },
312
313 'saveChanges': function () {
314 this._cachedObjects = null;
315
316 return Clipperz.Async.callbacks("GridController.saveChanges", [
317 MochiKit.Base.method(this.user(), 'saveChanges'),
318 MochiKit.Base.method(this, 'focus')
319 ], {trace:false});
320 },
321
322 'revertChanges': function () {
323 return this.user().revertChanges();
324 },
325
326 //-----------------------------------------------------------------------------
327
328 'displayEmptyContent': function () {
329 },
330
331 'hideEmptyContent': function () {
332 this.grid().removeNoRowsGridComponent();
333 },
334
335 'displaySelectedRows': function (aFilter) {
336 if ((aFilter != null) && (aFilter != '')){
337 this.grid().startSearch();
338 }
339
340 return Clipperz.Async.callbacks("GridController.displaySelectedrows", [
341 MochiKit.Base.method(this, 'getCachedValues'),
342 MochiKit.Base.itemgetter('length'),
343 Clipperz.Async.deferredIf("There are some items to show in the grid", [
344 MochiKit.Base.method(this, 'hideEmptyContent'),
345 MochiKit.Base.method(this, 'getCachedValues'),
346 MochiKit.Base.method(this, '_displaySelectedRows', aFilter)
347 ], [
348 MochiKit.Base.method(this, 'displayEmptyContent'),
349 MochiKit.Base.method(this.grid(), 'endSearch')
350 ])
351 ], {trace:false});
352 },
353
354 //-----------------------------------------------------------------------------
355
356 'focus': function () {
357 return Clipperz.Async.callbacks("GridController.focus", [
358 MochiKit.Base.method(this, 'displaySelectedRows', this.filterController().getFilter()),
359 MochiKit.Base.method(this.grid(), 'focus')
360 ], {trace:false})
361 //*##*/this.displaySelectedRows(this.filterController().getFilter());
362 // this.grid().focus();
363 },
364
365 //=============================================================================
366
367 'deleteAllCleanTextData': function () {
368 this._cachedObjects = null;
369 this.grid().drawEmpty();
370 },
371
372 //=============================================================================
373 __syntaxFix__: "syntax fix"
374});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js
new file mode 100644
index 0000000..d88af41
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js
@@ -0,0 +1,259 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
30
31Clipperz.PM.UI.Web.Controllers.LoginController = function(args) {
32 this._args = args || {};
33
34 this._loginPage = null;
35
36 this._newUserWizardController = null;
37 this._newUserCreationComponent = null;
38
39 return this;
40}
41
42MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.LoginController.prototype, {
43
44 'toString': function() {
45 return "Clipperz.PM.UI.Web.Controllers.LoginController";
46 },
47
48 'args': function () {
49 return this._args;
50 },
51
52 //-----------------------------------------------------------------------------
53
54 'loginPage': function() {
55 if (this._loginPage == null) {
56 this._loginPage = new Clipperz.PM.UI.Web.Components.LoginPage();
57
58 MochiKit.Signal.connect(this._loginPage, 'createNewAccountClick', this, 'handleCreateNewAccountClick')
59 }
60
61 return this._loginPage;
62 },
63
64 //-----------------------------------------------------------------------------
65
66 'run': function(args) {
67 varslot;
68 varloginPage;
69 varloginForm;
70
71 slot = args.slot;
72
73 loginForm =new Clipperz.PM.UI.Web.Components.LoginForm({'autocomplete': this.args()['autocomplete']});
74
75 slot.setContent(this.loginPage());
76 this.loginPage().slotNamed('loginForm').setContent(loginForm);
77
78 MochiKit.Signal.connect(loginForm, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm));
79 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm));
80 },
81
82 //-----------------------------------------------------------------------------
83
84 'doLogin': function(aLoginForm, anEvent) {
85 var deferredResult;
86 varparameters;
87 // varshouldUseOTP;
88 var loginProgress;
89 varuser;
90 var getPassphraseDelegate;
91
92 parameters = anEvent;
93 // shouldUseOTP = (typeof(parameters.passphrase) == 'undefined');
94
95 getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, parameters.passphrase);
96 user = new Clipperz.PM.DataModel.User({'username':parameters.username, 'getPassphraseFunction':MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'getPassphrase')});
97
98 loginProgress = new Clipperz.PM.UI.Web.Components.LoginProgress();
99
100 deferredResult = new Clipperz.Async.Deferred("LoginController.doLogin", {trace:false});
101 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4});
102 deferredResult.addMethod(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', getPassphraseDelegate);
103 deferredResult.addMethod(loginProgress, 'deferredShowModal', {deferredObject:deferredResult, openFromElement:aLoginForm.submitButtonElement()});
104 deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection');
105 // if (shouldUseOTP == false) {
106 deferredResult.addMethod(user, 'login');
107 // } else {
108 // deferredResult.addMethod(user, 'loginUsingOTP', parameters.username, parameters.otp);
109 // }
110 deferredResult.addCallback(function(aLoginProgress, res) {
111 aLoginProgress.disableCancel();
112 return res;
113 }, loginProgress);
114 deferredResult.addCallback(function () {
115 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN',MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:MochiKit.DOM.currentDocument().body}));
116 })
117 deferredResult.addMethod(this, 'userLoggedIn', user, loginProgress, aLoginForm);
118 deferredResult.addErrback (MochiKit.Base.method(this, 'handleFailedLogin', loginProgress));
119
120 deferredResult.addErrback (MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:aLoginForm.submitButtonElement()}));
121 deferredResult.addErrbackPass (MochiKit.Base.method(aLoginForm, 'focusOnPassphraseField'));
122 deferredResult.addBoth(MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'removePassphraseDelegate', getPassphraseDelegate));
123 deferredResult.callback();
124
125 MochiKit.Signal.connect(loginProgress, 'cancelEvent', deferredResult, 'cancel');
126
127 return deferredResult;
128 },
129
130 //-----------------------------------------------------------------------------
131
132 'userLoggedIn': function(aUser) {
133//Clipperz.log(">>> LoginController.userLoggedIn");
134 MochiKit.Signal.signal(this, 'userLoggedIn', {user: aUser});
135//Clipperz.log("<<< LoginController.userLoggedIn");
136 },
137
138 //=========================================================================
139
140 'handleCreateNewAccountClick': function (aComponent) {
141 // return Clipperz.PM.DataModel.User.registerNewAccount("new", "user");
142 return Clipperz.Async.callbacks("LoginController.handleCreateNewAccountClick", [
143 //' MochiKit.Base.method(this, 'newUserCreationComponent'),
144 // MochiKit.Base.methodcaller('deferredShowModal', {openFromElement:aComponent}),
145 // MochiKit.Base.method(this.newUserWizardController(), 'run')
146
147
148 MochiKit.Base.method(this, 'newUserCreationComponent'),
149 Clipperz.Async.forkAndJoin("Async.test succeedingForkedAndWaitDeferrer", [
150 MochiKit.Base.method(this.newUserCreationComponent(), 'deferredShowModal', {openFromElement:aComponent, duration:0.5}),
151 MochiKit.Base.method(this.newUserWizardController(), 'run')
152 ], {trace:false}),
153 // MochiKit.Base.method(this.newUserCreationComponent(), 'enableCredentialsField')
154 ], {trace:false});
155 },
156
157 //-----------------------------------------------------------------------------
158
159 'newUserWizardController': function () {
160 if (this._newUserWizardController == null) {
161 this._newUserWizardController = new Clipperz.PM.UI.Web.Controllers.NewUserWizardController({
162 'newUserCreationComponent': this.newUserCreationComponent()
163 })
164
165 // MochiKit.Signal.connect(this._newUserWizardController, 'exit',this, 'handleHideNewUserCreationComponent');
166 MochiKit.Signal.connect(this._newUserWizardController, 'done',this, 'handleCompleteNewUserCreationComponent');
167 }
168
169 return this._newUserWizardController;
170 },
171
172 //-------------------------------------------------------------------------
173
174 'newUserCreationComponent': function () {
175 if (this._newUserCreationComponent == null) {
176 this._newUserCreationComponent = new Clipperz.PM.UI.Web.Components.NewUserCreationComponent();
177 }
178
179 return this._newUserCreationComponent;
180 },
181
182 'clearNewUserCreationComponent': function () {
183 if (this._newUserCreationComponent != null) {
184 this._newUserCreationComponent.clear();
185 }
186 this._newUserCreationComponent = null;
187 },
188
189 //-------------------------------------------------------------------------
190
191 'handleHideNewUserCreationComponent': function () {
192 this.clearNewUserCreationComponent();
193 },
194
195 'handleCompleteNewUserCreationComponent': function (someParameters) {
196 vardeferredResult;
197 varuser;
198 varnewUserCreationComponent;
199
200 user = someParameters.user;
201 newUserCreationComponent = this.newUserCreationComponent();
202 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN',MochiKit.Base.method(newUserCreationComponent, 'deferredHideModal', {closeToElement:MochiKit.DOM.currentDocument().body})),
203
204 deferredResult = new Clipperz.Async.Deferred("LoginController.handleCompleteNewUserCreationComponent", {trace:false});
205
206 deferredResult.addCallbackList([
207 MochiKit.Base.method(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'),
208 MochiKit.Base.method(user, 'login'),
209 MochiKit.Base.method(this, 'userLoggedIn', user),
210 MochiKit.Base.method(this, 'clearNewUserCreationComponent')
211 ]);
212 deferredResult.addErrback(function (aValue) { Clipperz.log("WTF!! Error doing the login after creating a new user" + aValue)});
213 deferredResult.callback();
214
215 return deferredResult;
216 },
217
218
219 //=========================================================================
220
221 'handleFailedLogin': function(aLoginProgress, anError) {
222 var result;
223
224//console.log("anError", anError);
225 if (anError instanceof MochiKit.Async.CancelledError) {
226 result = anError;
227 } else {
228 var deferredResult;
229
230MochiKit.Logging.logError("## MainController - FAILED LOGIN: " + anError);
231 deferredResult = new MochiKit.Async.Deferred();
232
233 aLoginProgress.showErrorMessage("failed login");
234 // Clipperz.NotificationCenter.register(loginProgress, 'cancelEvent', deferredResult, 'callback');
235 MochiKit.Signal.connect(aLoginProgress, 'cancelEvent', deferredResult, 'callback');
236 deferredResult.addCallback(MochiKit.Async.fail, anError)
237 result = deferredResult;
238 }
239
240 return result;
241 },
242
243 'handleGenericError': function(anError) {
244 var result;
245
246 if (anError instanceof MochiKit.Async.CancelledError) {
247 result = anError;
248 } else {
249MochiKit.Logging.logError("## MainController - GENERIC ERROR" + "\n" + "==>> " + anError + " <<==\n" + anError.stack);
250//console.log(anError);
251 result = new MochiKit.Async.CancelledError(anError);
252 }
253
254 return result;
255 },
256
257 //-----------------------------------------------------------------------------
258 __syntaxFix__: "syntax fix"
259});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js
new file mode 100644
index 0000000..aa0d6ad
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js
@@ -0,0 +1,218 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
30
31Clipperz.PM.UI.Web.Controllers.MainController = function(args) {
32 this._args = args;
33
34 //controllers
35 this._loginController =null;
36 this._appController =null;
37
38 //components
39 this._headerComponent = null;
40 this._pageComponent =null;
41 this._footerComponent = null;
42
43 this._passphraseDelegateLock = new MochiKit.Async.DeferredLock();
44 this._passphraseDelegateLock.acquire();
45//Clipperz.log('MainController init _passphraseDelegateLock', this._passphraseDelegateLock);
46 this._passphraseDelegate = null;
47
48 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'remoteRequestSent', this, 'handleRemoteRequestSent');
49 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'remoteRequestReceived',this, 'handleRemoteRequestReceived');
50
51 return this;
52}
53
54MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.MainController.prototype, {
55
56 'toString': function() {
57 return "Clipperz.PM.UI.Web.Controllers.MainController";
58 },
59
60 'args': function () {
61 return this._args;
62 },
63
64 //-----------------------------------------------------------------------------
65
66 'headerComponent': function() {
67 if (this._headerComponent == null) {
68 this._headerComponent = new Clipperz.PM.UI.Web.Components.PageHeader();
69 }
70
71 return this._headerComponent;
72 },
73
74 'footerComponent': function() {
75 if (this._footerComponent == null) {
76 this._footerComponent = new Clipperz.PM.UI.Web.Components.PageFooter();
77 }
78
79 return this._footerComponent;
80 },
81
82 //-----------------------------------------------------------------------------
83
84 'pageComponent': function() {
85 if (this._pageComponent == null) {
86 this._pageComponent = new Clipperz.PM.UI.Web.Components.Page({element:MochiKit.DOM.getElement('mainDiv')});
87 }
88
89 return this._pageComponent;
90 },
91
92 //-----------------------------------------------------------------------------
93
94 'loginController': function() {
95 if (this._loginController == null) {
96 this._loginController = new Clipperz.PM.UI.Web.Controllers.LoginController(this.args());
97
98 MochiKit.Signal.connect(this._loginController, 'userLoggedIn', this, 'loginControllerUserLoggedInCallback');
99 }
100
101 return this._loginController;
102 },
103
104 'appController': function() {
105 if (this._appController == null) {
106 this._appController = new Clipperz.PM.UI.Web.Controllers.AppController();
107
108 MochiKit.Signal.connect(this._appController, 'logout', this, 'handleLogout');
109 }
110
111 return this._appController;
112 },
113
114 //-----------------------------------------------------------------------------
115
116 'run': function(shoudShowRegistrationForm) {
117 this.pageComponent().slotNamed('header').setContent(this.headerComponent());
118 this.pageComponent().slotNamed('footer').setContent(this.footerComponent());
119
120 this.pageComponent().render();
121
122 this.loginController().run({slot:this.pageComponent().slotNamed('body')});
123
124 if (shoudShowRegistrationForm) {
125 MochiKit.Signal.signal(this.loginController().loginPage(), 'createNewAccountClick');
126 // this.loginController().handleCreateNewAccountClick();
127 }
128 },
129
130 //-----------------------------------------------------------------------------
131
132 'getPassphrase': function () {
133 var deferredResult;
134
135 deferredResult = new Clipperz.Async.Deferred("MainController.getPassphrase", {trace:false});
136
137 deferredResult.acquireLock(this._passphraseDelegateLock);
138 deferredResult.addMethod(this, 'invokePassphraseDelegate');
139 deferredResult.releaseLock(this._passphraseDelegateLock);
140 deferredResult.callback();
141
142 return deferredResult;
143 },
144
145 //.........................................................................
146
147 'invokePassphraseDelegate': function () {
148 return this._passphraseDelegate();
149 },
150
151 'passphraseDelegateLock': function () {
152 return this._passphraseDelegateLock;
153 },
154
155 //.........................................................................
156
157 'setPassphraseDelegate': function (aDelegate) {
158 var shouldReleaseLock;
159
160 shouldReleaseLock = (this._passphraseDelegate == null);
161
162 this._passphraseDelegate = aDelegate;
163
164 if (shouldReleaseLock) {
165 this._passphraseDelegateLock.release();
166 }
167 },
168
169 //.........................................................................
170
171 'removePassphraseDelegate': function (aDelegate) {
172 if (this._passphraseDelegate == aDelegate) {
173 this._passphraseDelegate = null;
174 this._passphraseDelegateLock.acquire();
175 }
176 },
177
178 //-------------------------------------------------------------------------
179
180 'loginControllerUserLoggedInCallback': function(anEvent) {
181//Clipperz.log(">>> loginControllerUserLoggedInCallback", anEvent);
182 // this.setUser(anEvent.parameters()['user']);
183//console.log("--- loginControllerUserLoggedInCallback - 1");
184
185//console.log("--- loginControllerUserLoggedInCallback - 2");
186 this.headerComponent().switchToLoggedMode();
187 this.appController().run({slot:this.pageComponent().slotNamed('body'), user:anEvent['user']});
188//Clipperz.log("<<< loginControllerUserLoggedInCallback");
189 },
190
191 //-----------------------------------------------------------------------------
192
193 'handleRemoteRequestSent': function () {
194//Clipperz.log("REMOTE REQUEST sent >>>");
195 },
196
197 'handleRemoteRequestReceived': function () {
198//Clipperz.log("REMOTE REQUEST received <<<");
199 },
200
201 //-----------------------------------------------------------------------------
202
203 'handleLogout': function(anEvent) {
204 this.exit('logout.html');
205 },
206
207 //-----------------------------------------------------------------------------
208
209 'exit': function(aPageName) {
210//Clipperz.log("### exit " + aPageName);
211 MochiKit.Async.wait(0).addCallback(function() {
212 window.location.href = "./" + aPageName + "?ln=" + Clipperz.PM.Strings.selectedLanguage;
213 });
214 },
215
216 //-----------------------------------------------------------------------------
217 __syntaxFix__: "syntax fix"
218});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js
new file mode 100644
index 0000000..28d9d20
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js
@@ -0,0 +1,469 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer 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
29Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
30
31Clipperz.PM.UI.Web.Controllers.NewUserWizardController = function(args) {
32 this._newUserCreationComponent = args.newUserCreationComponent|| Clipperz.Base.exception.raise('MandatoryParameter');
33
34 MochiKit.Signal.connect(this._newUserCreationComponent, 'changedValue',this, 'handleChangedValue');
35 MochiKit.Signal.connect(this._newUserCreationComponent, 'moveForward',this, 'handleMoveForward');
36 MochiKit.Signal.connect(this._newUserCreationComponent, 'keyPressed',this, 'handleNewUserCreationComponentKeyPressed');
37
38 this._rulerComponent = null;
39
40 this._steps = null;
41 this._currentStepIndex = 0;
42 this._isNextEnabled = false;
43
44 this._userCreationState = 'IDLE'; //'IN PROGRESS', 'DONE', 'FAILED'
45 this._user = null;
46 return this;
47}
48
49MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prototype, {
50
51 'toString': function() {
52 return "Clipperz.PM.UI.Web.Controllers.NewUserWizardController";
53 },
54
55 //-------------------------------------------------------------------------
56
57 'newUserCreationComponent': function () {
58 return this._newUserCreationComponent;
59 },
60
61 //=============================================================================
62
63 'user': function () {
64 return this._user;
65 },
66
67 'setUser': function (aValue) {
68 this._user = aValue;
69 },
70
71 //-----------------------------------------------------------------------------
72
73 'userCreationState': function () {
74 return this._userCreationState;
75 },
76
77 'setUserCreationState': function (aValue) {
78//console.log("+++ NewUserWizardController.setUserCreationState", aValue);
79 this._userCreationState = aValue;
80 this.checkState();
81 },
82
83 //=============================================================================
84
85 'resetCurrentStepIndex': function () {
86 this._currentStepIndex = 0;
87 this.rulerComponent().resetStatus({animateTransition:true});
88 },
89
90 //-----------------------------------------------------------------------------
91
92 'enableNext': function (aValue) {
93 this.rulerComponent().enableNext(aValue);
94 this._isNextEnabled = aValue;
95 },
96
97 'isNextEnabled': function () {
98 return this._isNextEnabled;
99 },
100
101 //-----------------------------------------------------------------------------
102
103 'enablePrevious': function (aValue) {
104 this.rulerComponent().enablePrevious(aValue);
105 },
106
107 //=============================================================================
108
109 'rulerComponent': function () {
110 if (this._rulerComponent == null) {
111 this._rulerComponent = new Clipperz.PM.UI.Web.Components.RulerComponent({
112 translationContext:'Wizards.NewUserWizard'
113 });
114 this._rulerComponent.render();
115
116 MochiKit.Signal.connect(this._rulerComponent, 'exit', this, 'handleExit');
117 MochiKit.Signal.connect(this._rulerComponent, 'done', this, 'done');
118 MochiKit.Signal.connect(this._rulerComponent, 'moveForward',this, 'handleMoveForward');
119 MochiKit.Signal.connect(this._rulerComponent, 'moveBackward',this, 'handleMoveBackward');
120 MochiKit.Signal.connect(this._rulerComponent, 'cursorMoved',this, 'handleCursorMoved');
121 }
122
123 return this._rulerComponent;
124 },
125
126 'resetRuler': function () {
127 // if (this._rulerComponent != null) {
128 // this._rulerComponent.clear();
129 // }
130 // this._rulerComponent = null;
131 },
132
133 //-----------------------------------------------------------------------------
134
135 'showRuler': function (someSteps) {
136 var rulerElement;
137
138 this.setSteps(someSteps);
139
140 rulerElement = this.rulerComponent().element();
141 this.newUserCreationComponent().disableAllPanels();
142
143 MochiKit.Style.showElement(rulerElement);
144 MochiKit.Style.setElementPosition(rulerElement, {x:-1000, y:this.newUserCreationComponent().bottomMargin()});
145 new MochiKit.Visual.Move(rulerElement, {
146 x:0, y:this.newUserCreationComponent().bottomMargin(),
147 mode:'absolute',
148 duration:0.5,
149 // afterFinish:MochiKit.Base.method(this, 'handleCursorMoved')
150 afterFinish:MochiKit.Base.method(this, 'handleRulerShowed')
151 });
152 },
153
154 //-----------------------------------------------------------------------------
155
156 'handleRulerShowed':function () {
157 return Clipperz.Async.callbacks("NewUserWizardController.handlerRulerShowed", [
158 MochiKit.Base.method(this.newUserCreationComponent(), 'waitUntilFullyRendered'),
159 MochiKit.Base.method(this, 'handleCursorMoved')
160 ], {trace:false});
161 },
162
163 //-----------------------------------------------------------------------------
164
165 'hideRuler': function () {
166 new MochiKit.Visual.Move(this.rulerComponent().element(), {x:-1000, mode:'relative', duration:0.5});
167 },
168
169 'doneWithRuler': function () {
170 var rulerComponentElement;
171
172 rulerComponentElement = this.rulerComponent().element();
173 new MochiKit.Visual.Move(this.rulerComponent().element(), {
174 x:1000,
175 mode:'relative',
176 duration:1,
177 // afterFinish:MochiKit.Base.partial(MochiKit.Style.hideElement, rulerComponentElement)
178 afterFinish:function () { MochiKit.Style.hideElement(rulerComponentElement); }
179 });
180 },
181
182 //=============================================================================
183
184 'createNewUserRulerSteps': function () {
185 return [ 'CREDENTIALS', 'CHECK_CREDENTIALS', 'TERMS_OF_SERVICE', 'CREATE_USER'/*, 'LOGIN' */];
186 },
187
188 //-------------------------------------------------------------------------
189
190 'run': function () {
191 return Clipperz.Async.callbacks("NewUserWizardController.run", [
192 MochiKit.Base.method(this, 'createNewUserRulerSteps'),
193 MochiKit.Base.method(this, 'showRuler')
194 ], {trace:false});
195 },
196
197 //-----------------------------------------------------------------------------
198
199 'checkState': function () {
200 var enablePrevious;
201 var enableNext;
202
203 enablePrevious = true;
204 enableNext = false;
205
206 this.newUserCreationComponent().disableAllPanels();
207
208 switch(this.currentStep()) {
209 case 'CREDENTIALS':
210 this.newUserCreationComponent().enableCredentialsPanel();
211
212 enableNext = (
213 (this.newUserCreationComponent().username() != '')
214 &&
215 (this.newUserCreationComponent().passphrase() != '')
216 );
217 // enablePrevious = false;
218 break;
219 case 'CHECK_CREDENTIALS':
220 this.newUserCreationComponent().enableCheckCredentialsPanel();
221
222 enableNext = (this.newUserCreationComponent().passphrase() == this.newUserCreationComponent().rePassphrase());
223 // enablePrevious = true;
224 break
225 case 'TERMS_OF_SERVICE':
226 this.newUserCreationComponent().enableTermsOfServicePanel();
227
228//console.log("awareOfUnrecoverablePassphrase", this.newUserCreationComponent().awareOfUnrecoverablePassphrase());
229//console.log("readTermsOfService", this.newUserCreationComponent().readTermsOfService());
230 enableNext = (
231 (this.newUserCreationComponent().awareOfUnrecoverablePassphrase() == 'on')
232 &&
233 (this.newUserCreationComponent().readTermsOfService() == 'on')
234 )
235 break;
236 case 'CREATE_USER':
237//console.log(">>> CREATE_USER", this.userCreationState());
238 this.newUserCreationComponent().enableCreateUserPanel();
239
240 switch (this.userCreationState()) {
241 case 'IDLE':
242 this.setUserCreationState('IN PROGRESS');
243 this.preformActualUserRegistration();
244
245 enablePrevious = false;
246 enableNext = false;
247 break;
248 case 'IN PROGRESS':
249 enablePrevious = false;
250 enableNext = false;
251 break;
252 case 'DONE':
253 enablePrevious = false;
254 enableNext = true;
255 break;
256 case 'FAILED':
257 enablePrevious = true;
258 enableNext = false;
259 break;
260 };
261 break;
262 // case 'LOGIN':
263 // this.newUserCreationComponent().enableLoginPanel();
264 // break;
265 }
266
267 if (this.currentStepIndex() > 0) {
268 this.enablePrevious(enablePrevious);
269 } else {
270 this.enablePrevious(false);
271 }
272 this.enableNext(enableNext);
273 },
274
275 //-----------------------------------------------------------------------------
276
277 'setFocus': function () {
278 switch(this.currentStep()) {
279 case 'CREDENTIALS':
280 this.newUserCreationComponent().focusOnUsernameElement();
281 break;
282 case 'CHECK_CREDENTIALS':
283 this.newUserCreationComponent().focusOnRePassphraseElement();
284 break
285 case 'TERMS_OF_SERVICE':
286 break;
287 case 'CREATE_USER':
288 break;
289 // case 'LOGIN':
290 // break;
291 }
292 },
293
294 //=============================================================================
295
296 'steps': function () {
297 return this._steps;
298 },
299
300 'setSteps': function (aValue) {
301 this._steps = aValue;
302
303 this.rulerComponent().setSteps(aValue);
304 this.resetCurrentStepIndex();
305 },
306
307 'currentStepIndex': function () {
308 return this._currentStepIndex;
309 },
310
311 'currentStep': function () {
312 return this.steps()[this.currentStepIndex()];
313 },
314
315 //=============================================================================
316
317 'handleExit': function () {
318 return Clipperz.Async.callbacks("NewUserWizardController.handleExit", [
319 // MochiKit.Base.method(this.newUserCreationComponent(), 'resetContent'),
320 Clipperz.Async.forkAndJoin("NewUserWizardController.handleExit - fork and join", [
321 MochiKit.Base.method(this, 'hideRuler'),
322 MochiKit.Base.method(this.newUserCreationComponent(), 'deferredHideModal')
323 ], {trace:false}),
324 MochiKit.Base.method(this, 'resetRuler'),
325 // MochiKit.Base.method(this.newUserCreationComponent(), 'reset'),
326 MochiKit.Base.partial(MochiKit.Signal.signal, this, 'exit')
327 ], {trace:false})
328 },
329
330 'done': function () {
331 this.doneWithRuler();
332 MochiKit.Signal.signal(this, 'done', {'user': this.user()});
333 },
334
335 //=============================================================================
336
337 'handleMoveBackward': function () {
338 if (this._currentStepIndex > 0) {
339 varafterMoveAction;
340
341 afterMoveAction = MochiKit.Base.noop;
342
343//console.log("<-- backward", this.currentStep());
344 switch(this.currentStep()) {
345 case 'CREDENTIALS':
346 case 'CHECK_CREDENTIALS':
347 case 'TERMS_OF_SERVICE':
348 this._currentStepIndex --;
349 this.rulerComponent().moveBackward(afterMoveAction);
350 break;
351 case 'CREATE_USER':
352 this.setUser(null);
353 this.newUserCreationComponent().hideAllProgeressStates();
354 this.resetCurrentStepIndex();
355 this.setUserCreationState('IDLE');
356 break;
357 // case 'LOGIN':
358 // break;
359 };
360
361 }
362
363 if (this._currentStepIndex == 0) {
364 this.enablePrevious(false);
365 }
366 },
367
368 'handleMoveForward': function () {
369 if (this.isNextEnabled()) {
370 varafterMoveAction;
371
372 this._currentStepIndex ++;
373 afterMoveAction = MochiKit.Base.noop;
374
375 switch(this.currentStep()) {
376 case 'CREDENTIALS':
377 break;
378 case 'CHECK_CREDENTIALS':
379 break
380 case 'TERMS_OF_SERVICE':
381 break;
382 case 'CREATE_USER':
383 break;
384 // case 'LOGIN':
385 // break;
386 };
387
388 this.rulerComponent().moveForward(afterMoveAction);
389 };
390 },
391
392 'handleCursorMoved': function () {
393 // this.checkState();
394 // this.setFocus();
395
396 return Clipperz.Async.callbacks("NewUserWizardController.handleCursorMoved", [
397 MochiKit.Base.method(this.newUserCreationComponent(), 'waitUntilFullyRendered'),
398 MochiKit.Base.method(this, 'checkState'),
399 MochiKit.Base.method(this, 'setFocus')
400 ], {trace:false});
401 },
402
403 //-------------------------------------------------------------------------
404
405 'handleChangedValue': function (anEvent) {
406 this.checkState();
407 },
408
409 //-------------------------------------------------------------------------
410
411 'handleNewUserCreationComponentKeyPressed': function (anEvent) {
412//console.log(">>> handleNewUserCreationComponentKeyPressed", anEvent.key().string);
413 if (anEvent.key().string == 'KEY_ENTER') {
414 if (anEvent.target().nodeName != 'TEXTAREA') {
415 anEvent.preventDefault();
416 this.handleMoveForward();
417 }
418 } else if (anEvent.key().string == 'KEY_TAB') {
419 if (anEvent.target() == this.newUserCreationComponent().usernameElement()) {
420 } else {
421 this.handleMoveForward();
422 if ((anEvent.target().nodeName == 'INPUT') || (anEvent.target().nodeName == 'TEXTAREA')) {
423 anEvent.preventDefault();
424 }
425 }
426 } else if ((anEvent.key().string == 'KEY_ARROW_RIGHT') && (anEvent.modifier().meta == true)) {
427 this.handleMoveForward();
428 } else if ((anEvent.key().string == 'KEY_ARROW_LEFT') && (anEvent.modifier().meta == true)) {
429 this.handleMoveBackward();
430 } else if (anEvent.key().string == 'KEY_ESCAPE') {
431 anEvent.stop();
432 this.handleExit();
433 } else {
434 MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, 'checkState'));
435 }
436 },
437
438 //=============================================================================
439
440 'preformActualUserRegistration': function () {
441 vardeferredResult;
442
443 deferredResult = new Clipperz.Async.Deferred("NewUSerWizardController.preformActualUserRegistration", {trace:false});
444 deferredResult.addMethod(this.newUserCreationComponent(), 'showProgressOnUserCreation');
445 deferredResult.addMethod(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', MochiKit.Base.method(this.newUserCreationComponent(), 'passphrase'));
446 deferredResult.addCallback(Clipperz.PM.DataModel.User.registerNewAccount,
447 this.newUserCreationComponent().username(),
448 MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'getPassphrase')
449 );
450 deferredResult.addMethod(this, 'setUser');
451 deferredResult.addMethod(this.newUserCreationComponent(), 'showUserCreationDone');
452 deferredResult.addMethod(this, 'setUserCreationState', 'DONE');
453
454 // deferredResult.addErrback(MochiKit.Base.method(this.newUserCreationComponent(), 'showUserCreationFailed'));
455 // deferredResult.addErrback(MochiKit.Base.method(this, 'setUser', null));
456 // deferredResult.addErrback(MochiKit.Base.method(this, 'setUserCreationState', 'FAILED'));
457 deferredResult.addErrback(MochiKit.Base.bind(function (aValue) {
458 this.newUserCreationComponent().showUserCreationFailed();
459 this.setUser(null);
460 this.setUserCreationState('FAILED');
461 }, this));
462 deferredResult.callback();
463
464 return deferredResult;
465 },
466
467 //=============================================================================
468 __syntaxFix__: "syntax fix"
469});