summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/BookmarkletProcessor.js196
-rw-r--r--frontend/gamma/js/Clipperz/PM/Connection.js619
-rw-r--r--frontend/gamma/js/Clipperz/PM/Crypto.js513
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js1076
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js125
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js107
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js203
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js551
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js357
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js167
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js336
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/Record.js881
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js187
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js128
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js53
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js705
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/User.js817
-rw-r--r--frontend/gamma/js/Clipperz/PM/Date.js201
-rw-r--r--frontend/gamma/js/Clipperz/PM/Proxy.js172
-rwxr-xr-xfrontend/gamma/js/Clipperz/PM/Proxy/Proxy.JSON.js94
-rw-r--r--frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js811
-rw-r--r--frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.js67
-rw-r--r--frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Test.js167
-rw-r--r--frontend/gamma/js/Clipperz/PM/Strings.js295
-rw-r--r--frontend/gamma/js/Clipperz/PM/Strings/MessagePanelConfigurations.js389
-rw-r--r--frontend/gamma/js/Clipperz/PM/Strings/Strings_defaults.js390
-rw-r--r--frontend/gamma/js/Clipperz/PM/Strings/Strings_en-US.js1341
-rw-r--r--frontend/gamma/js/Clipperz/PM/Toll.js194
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/download.js120
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/look.js208
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/directLogin.js209
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/protect.js237
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/share.js1719
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/store.js310
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Canvas/GraphicFunctions.js68
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Canvas/Logo/normal.js65
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/exclamationMark.js280
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/info.js391
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/questionMark.js438
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Canvas/RegisterButton/normal.js403
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Canvas/Star/normal.js153
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/close.js156
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/open.js163
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js611
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js108
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js64
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js91
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js164
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js140
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js73
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js282
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js69
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js216
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js170
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js267
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js143
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js188
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js31
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Compact/MainController.js59
-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
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardDetail.js166
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardList.js204
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js181
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/iPhone/Controllers/MainController.js372
107 files changed, 29595 insertions, 0 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/BookmarkletProcessor.js b/frontend/gamma/js/Clipperz/PM/BookmarkletProcessor.js
new file mode 100644
index 0000000..789d6b8
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/BookmarkletProcessor.js
@@ -0,0 +1,196 @@
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/*
30if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
31if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
32
33Clipperz.PM.BookmarkletProcessor = function(aConfiguration) {
34 this._configuration = aConfiguration;
35
36 this._editableFields = null;
37 this._favicon = null;
38
39 return this;
40}
41
42Clipperz.PM.BookmarkletProcessor.prototype = MochiKit.Base.update(null, {
43
44 'toString': function() {
45 return "Clipperz.PM.BookmarkletProcessor";
46 },
47
48 //-------------------------------------------------------------------------
49
50 'configuration': function() {
51 return this._configuration;
52 },
53
54 //-------------------------------------------------------------------------
55
56 'pageTitle': function() {
57 return this.configuration().page.title;
58 },
59
60 //-------------------------------------------------------------------------
61
62 'fields': function() {
63 return this.configuration().form.inputs;
64 },
65
66 //-------------------------------------------------------------------------
67
68 'editableFields': function() {
69 if (this._editableFields == null) {
70 this._editableFields = MochiKit.Base.filter(function(aField) {
71 var result;
72 var type;
73
74 type = aField['type'].toLowerCase();
75 result = ((type != 'hidden') && (type != 'submit') && (type != 'checkbox') && (type != 'radio') && (type != 'select'));
76
77 return result;
78 }, this.fields())
79 }
80
81 return this._editableFields;
82 },
83
84 //-------------------------------------------------------------------------
85
86 'hostname': function() {
87 if (this._hostname == null) {
88 var actionUrl;
89
90 actionUrl = this.configuration()['form']['attributes']['action'];
91 this._hostname = actionUrl.replace(/ ^ h t t p s ? : \ / \ / ( [ ^ \ / ] * ) \ / . * /, '$1');
92 }
93
94 return this._hostname;
95 },
96
97 'favicon': function() {
98 if (this._favicon == null) {
99 this._favicon = "http://" + this.hostname() + "/favicon.ico";
100 }
101
102 return this._favicon;
103 },
104
105 //-------------------------------------------------------------------------
106 __syntaxFix__: "syntax fix"
107});
108
109//#############################################################################
110/ *
111Clipperz.PM.BookmarkletProcessor.createRecordFromBookmarkletConfiguration = function(anUser, aConfiguration) {
112 var processor;
113 var record;
114 var recordVersion;
115 var directLogin;
116 var bindings;
117 var i,c;
118
119 processor = new Clipperz.PM.BookmarkletProcessor(aConfiguration);
120
121 record = new Clipperz.PM.DataModel.Record({
122 'label':processor.pageTitle(),
123 'notes':"",
124 'user': anUser
125 });
126 recordVersion = new Clipperz.PM.DataModel.Record.Version(record, {})
127 record.setCurrentVersion(recordVersion);
128
129 bindings = {};
130
131 c = processor.editableFields().length;
132 for (i=0; i<c; i++) {
133 var formField;
134 var recordField;
135
136 formField = processor.editableFields()[i];
137 recordField = new Clipperz.PM.DataModel.RecordField({
138 'label':formField['name'],
139 'value':formField['value'],
140 'type': Clipperz.PM.Strings.inputTypeToRecordFieldType[formField['type']],
141 'hidden': false,
142 'recordVersion':recordVersion
143 });
144 recordVersion.addField(recordField);
145
146 bindings[formField['name']] = recordField.key();
147 }
148
149 directLogin = new Clipperz.PM.DataModel.DirectLogin({
150 'record': record,
151 'label': processor.pageTitle(),
152 'favicon': processor.favicon(),
153 'formData': processor.configuration()['form'],
154 'bindingData':bindings,
155 'bookmarkletVersion':'0.2'
156 });
157 record.addDirectLogin(directLogin);
158
159 anUser.addRecord(record);
160
161 return record;
162};
163* /
164//-----------------------------------------------------------------------------
165
166Clipperz.PM.BookmarkletProcessor.sanitizeBookmarkletConfiguration = function(aConfiguration) {
167 var result;
168
169 //throw "XSS Bookmarklet attempt";
170
171 result = aConfiguration;
172
173 return result;
174};
175
176//-----------------------------------------------------------------------------
177
178Clipperz.PM.BookmarkletProcessor.checkBookmarkletConfiguration = function(aConfiguration) {
179 var result;
180
181 try {
182 result = Clipperz.Base.evalJSON(aConfiguration);
183 result = Clipperz.PM.BookmarkletProcessor.sanitizeBookmarkletConfiguration(result);
184
185 if (result['version'] != '0.2.3') {
186 throw "WrongBookmarkletVersion";
187 }
188 } catch (exception) {
189 throw exception;
190 }
191
192 return result;
193};
194
195//-----------------------------------------------------------------------------
196*/ \ No newline at end of file
diff --git a/frontend/gamma/js/Clipperz/PM/Connection.js b/frontend/gamma/js/Clipperz/PM/Connection.js
new file mode 100644
index 0000000..6e58c60
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/Connection.js
@@ -0,0 +1,619 @@
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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31
32//-----------------------------------------------------------------------------
33//
34 // Abstract C O N N E C T I O N class
35//
36//-----------------------------------------------------------------------------
37
38Clipperz.PM.Connection = function (args) {
39 args = args || {};
40
41 this._proxy = args.proxy || Clipperz.PM.Proxy.defaultProxy;
42 this._getCredentialsFunction = args.getCredentialsFunction;
43
44 this._clipperz_pm_crypto_version = null;
45 this._connectionId = null;
46 this._sharedSecret = null;
47
48 return this;
49}
50
51Clipperz.PM.Connection.prototype = MochiKit.Base.update(null, {
52
53 'toString': function() {
54 return "Connection [" + this.version() + "]";
55 },
56
57 //=========================================================================
58
59 'version': function() {
60 throw Clipperz.Base.exception.AbstractMethod;
61 },
62
63 'clipperz_pm_crypto_version': function() {
64 if (this._clipperz_pm_crypto_version == null) {
65 var connectionVersions;
66 varversions;
67 varversion;
68 var i, c;
69
70 version = null;
71 connectionVersions = Clipperz.PM.Connection.communicationProtocol.versions;
72 versions = MochiKit.Base.keys(connectionVersions);
73 c = versions.length;
74 for (i=0; i<c; i++) {
75 if (! (versions[i] == 'current')) {
76 if (this instanceof connectionVersions[versions[i]]) {
77 version = versions[i];
78 };
79 }
80 }
81
82 this._clipperz_pm_crypto_version = version;
83 }
84
85 return this._clipperz_pm_crypto_version;
86 },
87
88 //-------------------------------------------------------------------------
89
90 'defaultErrorHandler': function(anErrorString, anException) {
91MochiKit.Logging.logError("### Connection.defaultErrorHandler: " + anErrorString + " (" + anException + ")");
92 },
93
94 //-------------------------------------------------------------------------
95
96 'getCredentialsFunction': function () {
97 return this._getCredentialsFunction;
98 },
99
100 'normalizedCredentials': function(someValues) {
101 throw Clipperz.Base.exception.AbstractMethod;
102 },
103
104 //=========================================================================
105
106 'proxy': function () {
107 return this._proxy;
108 },
109
110 //=========================================================================
111
112 'register': function () {
113 throw Clipperz.Base.exception.AbstractMethod;
114 },
115
116 'login': function() {
117 throw Clipperz.Base.exception.AbstractMethod;
118 },
119
120 //-------------------------------------------------------------------------
121
122 'message': function(someArguments, aCallback) {
123 throw Clipperz.Base.exception.AbstractMethod;
124 },
125
126 //-------------------------------------------------------------------------
127
128 'serverSideUserCredentials': function() {
129 throw Clipperz.Base.exception.AbstractMethod;
130 },
131
132 //=========================================================================
133
134 'sharedSecret': function () {
135 return this._sharedSecret;
136 },
137
138 'setSharedSecret': function (aValue) {
139 this._sharedSecret = aValue;
140 },
141
142 //-------------------------------------------------------------------------
143
144 'connectionId': function() {
145 return this._connectionId;
146 },
147
148 'setConnectionId': function(aValue) {
149 this._connectionId = aValue;
150 },
151
152 //=========================================================================
153/*
154 //TODO: ?????
155 'oneTimePassword': function() {
156 return this._oneTimePassword;
157 },
158
159 'setOneTimePassword': function(aValue) {
160 this._oneTimePassword = aValue;
161 },
162*/
163 //=========================================================================
164
165 'reset': function() {
166 this.setSharedSecret(null);
167 this.setConnectionId(null);
168 },
169
170 //=========================================================================
171 __syntaxFix__: "syntax fix"
172
173}
174);
175
176
177if (typeof(Clipperz.PM.Connection.SRP) == 'undefined') { Clipperz.PM.Connection.SRP = {}; }
178//-----------------------------------------------------------------------------
179//
180 // S R P [ 1 . 0 ] C O N N E C T I O N class
181//
182//-----------------------------------------------------------------------------
183
184Clipperz.PM.Connection.SRP['1.0'] = function (args) {
185 Clipperz.PM.Connection.call(this, args);
186
187 return this;
188}
189
190Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz.PM.Connection(), {
191
192 'version': function() {
193 return '1.0';
194 },
195
196 //=========================================================================
197
198 'register': function (someUserData) {
199 vardeferredResult;
200 var cryptoVersion;
201 var srpConnection;
202
203 cryptoVersion = this.clipperz_pm_crypto_version();
204
205 deferredResult = new Clipperz.Async.Deferred("Connection.registerWithVersion", {trace:false});
206 deferredResult.collectResults({
207 'credentials': [
208 this.getCredentialsFunction(),
209 MochiKit.Base.method(this, 'normalizedCredentials'),
210 MochiKit.Base.bind(function(someCredentials) {
211 var srpConnection;
212 var result;
213
214 srpConnection = new Clipperz.Crypto.SRP.Connection({ C:someCredentials['username'], P:someCredentials['password'], hash:this.hash() });
215 result = srpConnection.serverSideCredentials();
216 result['version'] = Clipperz.PM.Connection.communicationProtocol.currentVersion;
217
218 return result;
219 }, this)
220 ],
221 'user': MochiKit.Base.partial(MochiKit.Async.succeed, someUserData),
222 'version':MochiKit.Base.partial(MochiKit.Async.succeed, Clipperz.PM.Connection.communicationProtocol.currentVersion),
223 'message':MochiKit.Base.partial(MochiKit.Async.succeed, 'completeRegistration')
224 });
225 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
226 deferredResult.addMethod(this.proxy(), 'registration');
227 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
228
229 deferredResult.callback();
230
231 return deferredResult;
232 },
233
234 //-------------------------------------------------------------------------
235
236 'updateCredentials': function (aUsername, aPassphrase, someUserData) {
237 vardeferredResult;
238
239 deferredResult = new Clipperz.Async.Deferred("Connection.updateCredentials", {trace:false});
240 deferredResult.collectResults({
241 'credentials': [
242 MochiKit.Base.method(this, 'normalizedCredentials', {username:aUsername, password:aPassphrase}),
243 MochiKit.Base.bind(function(someCredentials) {
244 var srpConnection;
245 var result;
246
247 srpConnection = new Clipperz.Crypto.SRP.Connection({ C:someCredentials['username'], P:someCredentials['password'], hash:this.hash() });
248 result = srpConnection.serverSideCredentials();
249 result['version'] = Clipperz.PM.Connection.communicationProtocol.currentVersion;
250
251 return result;
252 }, this)
253 ],
254 'user': MochiKit.Base.partial(MochiKit.Async.succeed, someUserData)
255 });
256 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
257 deferredResult.addMethod(this, 'message', 'upgradeUserCredentials');
258 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
259 deferredResult.callback();
260
261 return deferredResult;
262
263 },
264
265 //=========================================================================
266
267 'redeemOneTimePassword': function (someParameters) {
268//console.log("Connections.redeemOneTimePassword", someParameters['username'], someParameters['password']);
269/*
270 //=========================================================================
271 //LOGIN WITH PASSPHRASE, extracted from the TRUNK version (LoginPanel.js)
272 deferredResult.addCallback(function(anUsername, aOneTimePassword) {
273 var args;
274
275 args = {
276 'message': 'oneTimePassword',
277 'version': Clipperz.PM.Crypto.communicationProtocol.currentVersion,
278 'parameters': {
279 'oneTimePasswordKey': Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(anUsername, aOneTimePassword),
280 'oneTimePasswordKeyChecksum': Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(anUsername, aOneTimePassword)
281 }
282 }
283
284 return args;
285 }, anUsername, oneTimePassword);
286 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'OTP_login_loadingOTP');
287 deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Proxy.defaultProxy, 'handshake'));
288 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'OTP_login_extractingPassphrase');
289 deferredResult.addCallback(function(aResult) {
290 return Clipperz.PM.Crypto.deferredDecrypt(oneTimePassword, aResult['data'], aResult['version']);
291 });
292 deferredResult.addCallback(function(aResult) {
293 return (new Clipperz.ByteArray().appendBase64String(aResult['passphrase'])).asString();
294 });
295 deferredResult.addMethod(this, 'doLoginWithUsernameAndPassphrase', anUsername),
296*/
297 var args;
298 var normalizedOTP;
299
300 normalizedOTP = Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword(someParameters['password']);
301
302 args = {
303 'message': 'oneTimePassword',
304 'version': Clipperz.PM.Connection.communicationProtocol.currentVersion,
305 'parameters': {
306 'oneTimePasswordKey': Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(someParameters['username'], normalizedOTP),
307 'oneTimePasswordKeyChecksum':Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(someParameters['username'], normalizedOTP)
308 }
309 }
310
311 return Clipperz.Async.callbacks("Connction.redeemOTP", [
312 MochiKit.Base.method(this.proxy(), 'handshake', args),
313 function(aResult) {
314 return Clipperz.PM.Crypto.deferredDecrypt({
315 value:aResult['data'],
316 key:normalizedOTP,
317 version:aResult['version']
318 });
319 },
320 function(aResult) {
321 return (new Clipperz.ByteArray().appendBase64String(aResult['passphrase'])).asString();
322 }
323 ], {trace:false})
324 },
325
326 'login': function(/*anUsername, aPassphrase*/) {
327 vardeferredResult;
328 var cryptoVersion;
329 var srpConnection;
330
331 cryptoVersion = this.clipperz_pm_crypto_version();
332
333 deferredResult = new Clipperz.Async.Deferred("Connection.login", {trace:false});
334 deferredResult.addCallback(this.getCredentialsFunction());
335 deferredResult.addMethod(this, 'normalizedCredentials');
336 // deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'updatedProgressState', 'connection_sendingCredentials');
337 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
338 deferredResult.addCallback(MochiKit.Base.bind(function(someCredentials) {
339 srpConnection = new Clipperz.Crypto.SRP.Connection({ C:someCredentials['username'], P:someCredentials['password'], hash:this.hash() });
340 }, this));
341 deferredResult.addCallback(function() {
342 var result;
343
344 result = {
345 message: 'connect',
346 version: cryptoVersion,
347 parameters: {
348 C: srpConnection.C(),
349 A: srpConnection.A().asString(16)
350 // reconnecting: this.connectionId()
351 }
352 };
353
354 // TODO: ?????
355 // if (isReconnecting == true) {
356 // args.parameters['reconnecting'] = aConnection.connectionId();
357 // }
358
359 return result;
360 });
361 deferredResult.addMethod(this.proxy(), 'handshake');
362 // deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'updatedProgressState', 'connection_credentialVerification');
363 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
364 deferredResult.addCallback(function(someParameters) {
365 var result;
366
367 srpConnection.set_s(new Clipperz.Crypto.BigInt(someParameters['s'], 16));
368 srpConnection.set_B(new Clipperz.Crypto.BigInt(someParameters['B'], 16));
369
370 //TODO: ?????
371 // if (typeof(someParameters['oneTimePassword']) != 'undefined') {
372 // this.setOneTimePassword(someParameters['oneTimePassword']);
373 // }
374
375 result = {
376 message: 'credentialCheck',
377 version: cryptoVersion,
378 parameters: {
379 M1: srpConnection.M1()
380 }
381 };
382
383 return result;
384 });
385 deferredResult.addMethod(this.proxy(), 'handshake');
386 deferredResult.addCallback(function(someParameters) {
387 var result;
388
389 if (someParameters['M2'] == srpConnection.M2()) {
390 result = MochiKit.Async.succeed(someParameters);
391 } else {
392 result = MochiKit.Async.fail(Clipperz.PM.Connection.exception.WrongChecksum);
393 }
394
395 return result;
396 });
397 deferredResult.addCallback(MochiKit.Base.bind(function(someParameters) {
398 this.setConnectionId(someParameters['connectionId']);
399 this.setSharedSecret(srpConnection.K());
400
401 // TODO: ?????
402 // if (this.oneTimePassword() != null) {
403 /// ?? result = this.user().oneTimePasswordManager().archiveOneTimePassword(this.oneTimePassword()));
404 // }
405 return someParameters;
406 }, this));
407 // deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'updatedProgressState', 'connection_loggedIn');
408 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
409 deferredResult.addCallback(MochiKit.Async.succeed, {result:"done"});
410
411 deferredResult.callback();
412
413 return deferredResult;
414 },
415
416 //=========================================================================
417
418 'logout': function() {
419 return Clipperz.Async.callbacks("Connection.logout", [
420 MochiKit.Base.method(this, 'setSharedSecret'),
421 MochiKit.Base.method(this.proxy(), 'logout', {})
422 ], {trace:false});
423 },
424
425 //=========================================================================
426
427 'ping': function () {
428 //TODO: ping the server in order to have a valid session
429 },
430
431 //=========================================================================
432
433 'message': function(aMessageName, someParameters) {
434 var args;
435
436//console.log(">>> Connection.message", aMessageName, someParameters);
437 args = {
438 message: aMessageName,
439 srpSharedSecret: this.sharedSecret(),
440 parameters: (someParameters || {})
441 }
442
443 return this.sendMessage(args);
444 },
445
446 //-------------------------------------------------------------------------
447
448 'sendMessage': function(someArguments) {
449 vardeferredResult;
450
451 deferredResult = new Clipperz.Async.Deferred("Connection.sendMessage", {trace:false});
452 deferredResult.addMethod(this.proxy(), 'message', someArguments);
453 deferredResult.addCallback(MochiKit.Base.bind(function(res) {
454 if (typeof(res['lock']) != 'undefined') {
455 //TODO: ?????
456 // ?? this.user().setLock(res['lock']);
457 }
458 return res;
459 }, this));
460
461 deferredResult.addErrback(MochiKit.Base.method(this, 'messageExceptionHandler'), someArguments);
462 deferredResult.callback();
463
464 return deferredResult
465 },
466
467 //-------------------------------------------------------------------------
468
469 'messageExceptionHandler': function(anOriginalMessageArguments, anError) {
470 var result;
471
472console.log(">>> Connection.messageExceptionHandler", anError, anError.message);
473 if (anError instanceof MochiKit.Async.CancelledError) {
474 result = anError;
475 } else {
476 if ((anError.message == 'Trying to communicate without an active connection')||
477 (anError.message == 'No tollManager available for current session')
478 ) {
479 result = this.reestablishConnection(anOriginalMessageArguments);
480 } else if (anError.message == 'Session with stale data') {
481 MochiKit.Signal.signal(this, 'EXCEPTION');
482 } else {
483 result = anError;
484 }
485 }
486console.log("<<< Connection.messageExceptionHandler", anError)
487
488 return result;;
489 },
490
491 //=========================================================================
492
493 'reestablishConnection': function(anOriginalMessageArguments) {
494 var deferredResult;
495
496 deferredResult = new Clipperz.Async.Deferred("Connection.reestablishConnection");
497 deferredResult.addMethod(this, 'reset');
498 deferredResult.addMethod(this, 'login', true);
499 deferredResult.addCallback(MochiKit.Base.bind(function(aMessage) {
500 aMessage['srpSharedSecret'] = this.sharedSecret();
501 return aMessage;
502 }, this), anOriginalMessageArguments);
503 deferredResult.addMethod(this, 'sendMessage');
504 deferredResult.addErrback(MochiKit.Signal.signal, this, 'EXCEPTION', null);
505 deferredResult.callback();
506
507 return deferredResult;
508 },
509
510 //=========================================================================
511
512 'serverSideUserCredentials': function(aUsername, aPassword) {
513 varresult;
514 varnewSrpConnection;
515 var normalizedAttributes;
516
517 normalizedAttributes = this.normalizedCredentials({username:aUsername, password:aPassword});
518 newSrpConnection = new Clipperz.Crypto.SRP.Connection({ C:normalizedAttributes['username'], P:normalizedAttributes['password'], hash:this.hash() });
519 result = newSrpConnection.serverSideCredentials();
520 result['version'] = this.clipperz_pm_crypto_version();
521
522 return result;
523 },
524
525 //=========================================================================
526
527 'normalizedCredentials': function(someValues) {
528 var result;
529
530 result = {}
531 result['username'] = this.hash()(new Clipperz.ByteArray(someValues['username'])).toHexString().substring(2);
532 result['password'] = this.hash()(new Clipperz.ByteArray(someValues['password'] + someValues['username'])).toHexString().substring(2);
533
534 return result;
535 },
536
537 //-----------------------------------------------------------------------------
538
539 'hash': function() {
540 return Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].hash;
541 },
542
543 //-----------------------------------------------------------------------------
544 __syntaxFix__: "syntax fix"
545
546});
547
548
549
550//-----------------------------------------------------------------------------
551//
552 // S R P [ 1 . 1 ] C O N N E C T I O N class
553//
554//-----------------------------------------------------------------------------
555
556Clipperz.PM.Connection.SRP['1.1'] = function (args) {
557 Clipperz.PM.Connection.SRP['1.0'].call(this, args);
558
559 return this;
560}
561
562Clipperz.PM.Connection.SRP['1.1'].prototype = MochiKit.Base.update(new Clipperz.PM.Connection.SRP['1.0'](), {
563
564 'version': function() {
565 return '1.1';
566 },
567
568 //-----------------------------------------------------------------------------
569
570 'normalizedCredentials': function(someValues) {
571 var result;
572
573 result = {}
574 result['username'] = this.hash()(new Clipperz.ByteArray(someValues['username'] + someValues['password'])).toHexString().substring(2);
575 result['password'] = this.hash()(new Clipperz.ByteArray(someValues['password'] + someValues['username'])).toHexString().substring(2);
576
577 return result;
578 },
579
580 //-----------------------------------------------------------------------------
581
582 'hash': function() {
583 return Clipperz.PM.Crypto.encryptingFunctions.versions['0.2'].hash;
584 },
585
586 //-----------------------------------------------------------------------------
587 __syntaxFix__: "syntax fix"
588
589});
590
591Clipperz.PM.Connection.exception = {
592 WrongChecksum: new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.InvalidValue"),
593 UnexpectedRequest:new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.UnexpectedRequest")
594};
595
596
597Clipperz.PM.Connection.communicationProtocol = {
598 'currentVersion': '0.2',
599 'versions': {
600 '0.1': Clipperz.PM.Connection.SRP['1.0'],//Clipperz.Crypto.SRP.versions['1.0'].Connection,
601 '0.2': Clipperz.PM.Connection.SRP['1.1']//Clipperz.Crypto.SRP.versions['1.1'].Connection
602 },
603 'fallbackVersions': {
604 // 'current':'0.1',
605 '0.2': '0.1',
606 '0.1': null
607 }
608};
609
610MochiKit.Base.update(Clipperz.PM.Connection.communicationProtocol.versions, {
611 'current': Clipperz.PM.Connection.communicationProtocol.versions[Clipperz.PM.Connection.communicationProtocol.currentVersion]
612});
613
614MochiKit.Base.update(Clipperz.PM.Connection.communicationProtocol.fallbackVersions, {
615 'current': Clipperz.PM.Connection.communicationProtocol.fallbackVersions[Clipperz.PM.Connection.communicationProtocol.currentVersion]
616});
617
618
619
diff --git a/frontend/gamma/js/Clipperz/PM/Crypto.js b/frontend/gamma/js/Clipperz/PM/Crypto.js
new file mode 100644
index 0000000..bfafbea
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/Crypto.js
@@ -0,0 +1,513 @@
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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Crypto) == 'undefined') { Clipperz.PM.Crypto = {}; }
32
33Clipperz.PM.Crypto.VERSION = "0.2";
34Clipperz.PM.Crypto.NAME = "Clipperz.PM.Crypto";
35
36Clipperz.PM.Crypto.encryptingFunctions = {};
37
38MochiKit.Base.update(Clipperz.PM.Crypto, {
39
40 '__repr__': function () {
41 return "[" + this.NAME + " " + this.VERSION + "]";
42 },
43
44 //-------------------------------------------------------------------------
45
46 'toString': function () {
47 return this.__repr__();
48 },
49
50 //-------------------------------------------------------------------------
51/*
52 'communicationProtocol': {
53 'currentVersion': '0.2',
54 'versions': {
55 '0.1': Clipperz.PM.Connection.SRP['1.0'],//Clipperz.Crypto.SRP.versions['1.0'].Connection,
56 '0.2': Clipperz.PM.Connection.SRP['1.1']//Clipperz.Crypto.SRP.versions['1.1'].Connection
57 },
58 'fallbackVersions': {
59 'current':'0.1',
60 '0.2': '0.1',
61 '0.1': null
62 }
63 },
64*/
65 //-------------------------------------------------------------------------
66
67 'encryptingFunctions': {
68 'currentVersion': '0.3',
69 'versions': {
70
71 //#####################################################################
72
73 '0.1': {
74 'encrypt': function(aKey, aValue) {
75 return Clipperz.Crypto.Base.encryptUsingSecretKey(aKey, Clipperz.Base.serializeJSON(aValue));
76 },
77
78 'deferredEncrypt': function(aKey, aValue) {
79 var deferredResult;
80
81 deferredResult = new Clipperz.Async.Deferred("Crypto[0.1].deferredEncrypt");
82 deferredResult.addCallback(Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].encrypt, aKey, aValue);
83 deferredResult.callback();
84
85 return deferredResult;
86 },
87
88 'decrypt': function(aKey, aValue) {
89 var result;
90
91 if (aValue != null) {
92 result = Clipperz.Base.evalJSON(Clipperz.Crypto.Base.decryptUsingSecretKey(aKey, aValue));
93 } else {
94 result = null;
95 }
96
97 return result;
98 },
99
100 'deferredDecrypt': function(aKey, aValue) {
101 var deferredResult;
102
103 deferredResult = new Clipperz.Async.Deferred("Crypto.[0.1].deferredDecrypt");
104 deferredResult.addCallback(Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].decrypt, aKey, aValue);
105 deferredResult.callback();
106
107 return deferredResult;
108 },
109
110 'hash': function(aValue) {
111 var result;
112 var strngResult;
113
114 stringResult = Clipperz.Crypto.Base.computeHashValue(aValue.asString()); //!!!!!!!
115 result = new Clipperz.ByteArray("0x" + stringResult);
116
117 return result;
118 },
119
120 'deriveKey': function(aStringValue) {
121 return Clipperz.Crypto.Base.computeHashValue(aStringValue);
122 }
123 },
124
125 //#####################################################################
126
127 '0.2': {
128 'encrypt': function(aKey, aValue, aNonce) {
129 var result;
130 varkey, value;
131 var dataToEncrypt;
132 var encryptedData;
133
134 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
135 value = new Clipperz.ByteArray(Clipperz.Base.serializeJSON(aValue));
136 dataToEncrypt = Clipperz.Crypto.SHA.sha_d256(value).appendBlock(value);
137 encryptedData = Clipperz.Crypto.AES.encrypt(key, dataToEncrypt, aNonce);
138 result = encryptedData.toBase64String();
139
140 return result;
141 },
142
143 'deferredEncrypt': function(aKey, aValue, aNonce) {
144 var deferredResult;
145 varkey, value;
146 var dataToEncrypt;
147 // var encryptedData;
148
149 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
150 value = new Clipperz.ByteArray(Clipperz.Base.serializeJSON(aValue));
151 dataToEncrypt = Clipperz.Crypto.SHA.sha_d256(value).appendBlock(value);
152
153 deferredResult = new Clipperz.Async.Deferred("Crypto[0.2].deferredEncrypt")
154 deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncrypt, key, dataToEncrypt, aNonce);
155 deferredResult.addCallback(function(aResult) {
156 return aResult.toBase64String();
157 })
158 deferredResult.callback();
159
160 return deferredResult;
161 },
162
163 'decrypt': function(aKey, aValue) {
164 var result;
165
166 if (aValue != null) {
167 var key, value;
168 var decryptedData;
169 var decryptedValue;
170
171 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
172 value = new Clipperz.ByteArray().appendBase64String(aValue);
173
174 decryptedData = Clipperz.Crypto.AES.decrypt(key, value);
175 decryptedValue = decryptedData.split((256/8));
176
177 try {
178 result = Clipperz.Base.evalJSON(decryptedValue.asString());
179 } catch (exception) {
180 MochiKit.Logging.logError("Error while decrypting data [1]");
181 throw Clipperz.Crypto.Base.exception.CorruptedMessage;
182 }
183 } else {
184 result = null;
185 }
186
187 return result;
188 },
189
190 'deferredDecrypt': function(aKey, aValue) {
191 var result;
192
193 if (aValue != null) {
194 var deferredResult;
195 var key, value;
196 // var decryptedData;
197
198 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
199 value = new Clipperz.ByteArray().appendBase64String(aValue);
200
201 deferredResult = new Clipperz.Async.Deferred("Crypto.[0.2].deferredDecrypt");
202 deferredResult.addCallback(Clipperz.Crypto.AES.deferredDecrypt, key, value);
203 deferredResult.addCallback(function(aResult) {
204 var result;
205 var decryptedData;
206
207 decryptedData = aResult.split((256/8));
208
209 try {
210 result = Clipperz.Base.evalJSON(decryptedData.asString());
211 } catch (exception) {
212 MochiKit.Logging.logError("Error while decrypting data [2]");
213 throw Clipperz.Crypto.Base.exception.CorruptedMessage;
214 }
215
216 return result;
217 })
218 deferredResult.callback();
219
220 result = deferredResult;
221 } else {
222 result = MochiKit.Async.succeed(null);
223 }
224
225 return result;
226 },
227
228 'hash': Clipperz.Crypto.SHA.sha_d256,
229
230 'deriveKey': function(aStringValue) {
231 varbyteData;
232 var result;
233
234 byteData = new Clipperz.ByteArray(aStringValue);
235 result = Clipperz.Crypto.SHA.sha_d256(byteData);
236
237 return result;
238 }
239 },
240
241 //#####################################################################
242
243 '0.3': {
244 'encrypt': function(aKey, aValue, aNonce) {
245 var result;
246 varkey, value;
247 var data;
248 var dataToEncrypt;
249 var encryptedData;
250
251 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
252 value = Clipperz.Base.serializeJSON(aValue);
253 data = new Clipperz.ByteArray(value);
254 encryptedData = Clipperz.Crypto.AES.encrypt(key, data, aNonce);
255 result = encryptedData.toBase64String();
256
257 return result;
258 },
259
260 'deferredEncrypt': function(aKey, aValue, aNonce) {
261 var deferredResult;
262 varkey, value;
263 var data;
264 var dataToEncrypt;
265 var encryptedData;
266
267 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
268 value = Clipperz.Base.serializeJSON(aValue);
269 data = new Clipperz.ByteArray(value);
270
271 deferredResult = new Clipperz.Async.Deferred("Crypto[0.3].deferredEncrypt")
272 deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncrypt, key, data, aNonce);
273 deferredResult.addCallback(function(aResult) {
274 return aResult.toBase64String();
275 })
276 deferredResult.callback();
277
278 return deferredResult;
279 },
280
281 'decrypt': function(aKey, aValue) {
282 var result;
283
284 if (aValue != null) {
285 var key, value;
286 var decryptedData;
287
288 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
289 value = new Clipperz.ByteArray().appendBase64String(aValue);
290
291 decryptedData = Clipperz.Crypto.AES.decrypt(key, value);
292
293 value = decryptedData.asString();
294 try {
295 result = Clipperz.Base.evalJSON(value);
296 } catch (exception) {
297 MochiKit.Logging.logError("Error while decrypting data [3]");
298 throw Clipperz.Crypto.Base.exception.CorruptedMessage;
299 }
300 } else {
301 result = null;
302 }
303
304 return result;
305 },
306
307 'deferredDecrypt': function(aKey, aValue) {
308 var deferredResult;
309
310 deferredResult = new Clipperz.Async.Deferred("Crypto[0.3].deferredDecrypt", {trace: false});
311 // now = new Date;
312
313 if (aValue != null) {
314 var key, value;
315 // var decryptedData;
316
317 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
318 value = new Clipperz.ByteArray().appendBase64String(aValue);
319
320 deferredResult.addCallback(Clipperz.Crypto.AES.deferredDecrypt, key, value);
321 deferredResult.addCallback(MochiKit.Async.wait, 0.1);
322 deferredResult.addCallback(function(aResult) {
323 return aResult.asString();
324 });
325 deferredResult.addCallback(MochiKit.Async.wait, 0.1);
326 deferredResult.addCallback(Clipperz.Base.evalJSON);
327 deferredResult.addErrback(function(anError) {
328 MochiKit.Logging.logError("Error while decrypting data [4]");
329 throw Clipperz.Crypto.Base.exception.CorruptedMessage;
330 })
331 } else {
332 deferredResult.addCallback(function() {
333 return null;
334 });
335 }
336 deferredResult.callback();
337
338 return deferredResult;
339 },
340
341 'hash': Clipperz.Crypto.SHA.sha_d256,
342
343 'deriveKey': function(aStringValue) {
344 varbyteData;
345 var result;
346
347 byteData = new Clipperz.ByteArray(aStringValue);
348 result = Clipperz.Crypto.SHA.sha_d256(byteData);
349
350 return result;
351 }
352
353 },
354
355 //#####################################################################
356/*
357 '0.4': {
358 'encrypt': function(aKey, aValue, aNonce) {
359 var result;
360 varkey, value;
361 var data;
362 var dataToEncrypt;
363 var encryptedData;
364
365//MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt");
366 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
367//MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 1");
368 value = Clipperz.Base.serializeJSON(aValue);
369//MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 2");
370/ *
371//MochiKit.Logging.logDebug("--> encrypt.fullSize: " + value.length);
372 value = value.replace(/":{"label":"/g, '":{l:"');
373 value = value.replace(/":{"key":"/g, '":{k:"');
374 value = value.replace(/":{"notes":"/g, '":{n:"');
375 value = value.replace(/":{"record":"/g, '":{r:"');
376 value = value.replace(/", "label":"/g, '",l:"');
377 value = value.replace(/", "favicon":"/g,'",f:"');
378//MochiKit.Logging.logDebug("<-- encrypt.compressed: " + value.length);
379* /
380 data = new Clipperz.ByteArray(value);
381//MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 3");
382 encryptedData = Clipperz.Crypto.AES.encrypt(key, data, aNonce);
383//MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 4");
384 result = encryptedData.toBase64String();
385//MochiKit.Logging.logDebug("<<< [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt");
386
387 return result;
388 },
389
390 'decrypt': function(aKey, aValue) {
391 var result;
392
393 if (aValue != null) {
394 var key, value;
395 var decryptedData;
396
397 key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey));
398 value = new Clipperz.ByteArray().appendBase64String(aValue);
399
400 decryptedData = Clipperz.Crypto.AES.decrypt(key, value);
401
402 value = decryptedData.asString();
403/ *
404 value = value.replace(/":{l:"/g,'":{"label":"');
405 value = value.replace(/":{k:"/g,'":{"key":"');
406 value = value.replace(/":{n:"/g,'":{"notes":"');
407 value = value.replace(/":{r:"/g,'":{"record":"');
408 value = value.replace(/",l:"/g, '", "label":"');
409 value = value.replace(/",f:"/g, '", "favicon":"');
410* /
411 try {
412 result = Clipperz.Base.evalJSON(value);
413 } catch (exception) {
414 MochiKit.Logging.logError("Error while decrypting data");
415 throw Clipperz.Crypto.Base.exception.CorruptedMessage;
416 }
417
418
419 } else {
420 result = null;
421 }
422
423 return result;
424 },
425
426 'hash': Clipperz.Crypto.SHA.sha_d256
427 },
428*/
429 //#####################################################################
430 __syntaxFix__: "syntax fix"
431 }
432 },
433
434 //-------------------------------------------------------------------------
435
436 'encrypt': function(aKey, aValue, aVersion) {
437 return Clipperz.PM.Crypto.encryptingFunctions.versions[aVersion].encrypt(aKey, aValue);
438 },
439
440 'deferredEncrypt': function(someParameters) {
441 return Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters['version']].deferredEncrypt(someParameters['key'], someParameters['value']);
442 },
443
444 //.........................................................................
445
446 'decrypt': function(aKey, aValue, aVersion) {
447 return Clipperz.PM.Crypto.encryptingFunctions.versions[aVersion].decrypt(aKey, aValue);
448 },
449
450 'deferredDecrypt': function(someParameters) {
451 return Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters['version']].deferredDecrypt(someParameters['key'], someParameters['value']);
452 },
453
454 //-------------------------------------------------------------------------
455
456 'hash': function(aValue) {
457 return Clipperz.PM.Crypto.encryptingFunctions.versions[Clipperz.PM.Crypto.encryptingFunctions.currentVersion]['hash'](aValue);
458 },
459
460 //-------------------------------------------------------------------------
461
462 'randomKey': function() {
463 return Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2);
464 },
465
466 //-------------------------------------------------------------------------
467
468 'deriveKey': function(aValue) {
469 return Clipperz.PM.Crypto.encryptingFunctions.versions[Clipperz.PM.Crypto.encryptingFunctions.currentVersion].deriveKey(aValue);
470 },
471
472 //-------------------------------------------------------------------------
473
474 'passwordEntropy': function(aValue) {
475 var result;
476 varbitPerChar;
477
478 bitPerChar = 4;
479 if (/[a-z]/.test(aValue)) {
480 bitPerChar ++;
481 }
482 if (/[A-Z]/.test(aValue)) {
483 bitPerChar ++;
484 }
485 if (/[^a-zA-Z0-9]/.test(aValue)) {
486 bitPerChar ++;
487 }
488
489 result = aValue.length * bitPerChar;
490
491 return result;
492 },
493
494 //-------------------------------------------------------------------------
495
496 'nullValue': '####',
497
498 //-------------------------------------------------------------------------
499 __syntaxFix__: "syntax fix"
500
501});
502
503//*****************************************************************************
504
505//MochiKit.Base.update(Clipperz.PM.Connection.communicationProtocol.versions, {
506 //'current': Clipperz.PM.Connection.communicationProtocol.versions[Clipperz.PM.Connection.communicationProtocol.currentVersion]
507//});
508
509MochiKit.Base.update(Clipperz.PM.Crypto.encryptingFunctions.versions, {
510 'current': Clipperz.PM.Crypto.encryptingFunctions.versions[Clipperz.PM.Crypto.encryptingFunctions.currentVersion]
511});
512
513//*****************************************************************************
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js
new file mode 100644
index 0000000..1d38509
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js
@@ -0,0 +1,1076 @@
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.DataModel');
30
31Clipperz.PM.DataModel.DirectLogin = function(args) {
32 args = args || {};
33
34 Clipperz.PM.DataModel.DirectLogin.superclass.constructor.apply(this, arguments);
35
36 this._reference =args.reference
37 ||Clipperz.PM.Crypto.randomKey();
38 this._record =args.record
39 ||Clipperz.Base.exception.raise('MandatoryParameter');
40
41 this._retrieveIndexDataFunction = args.retrieveIndexDataFunction
42 ||this.record().retrieveDirectLoginIndexDataFunction()
43 ||Clipperz.Base.exception.raise('MandatoryParameter');
44 this._setIndexDataFunction = args.setIndexDataFunction
45 ||this.record().setDirectLoginIndexDataFunction()
46 ||Clipperz.Base.exception.raise('MandatoryParameter');
47 this._removeIndexDataFunction =args.removeIndexDataFunction
48 ||this.record().removeDirectLoginIndexDataFunction()
49 ||Clipperz.Base.exception.raise('MandatoryParameter');
50
51 this._inputs = null;
52 this._bindings = null;
53 this._formValues = null;
54
55 // this._inputsDeferredLock = new MochiKit.Async.DeferredLock();
56 // this._bindingsDeferredLock = new MochiKit.Async.DeferredLock();
57 // this._formValuesDeferredLock = new MochiKit.Async.DeferredLock();
58
59 this._transientState = null;
60
61 this._isBrandNew = MochiKit.Base.isUndefinedOrNull(args.reference);
62
63 this.record().addDirectLogin(this);
64
65 return this;
66}
67
68Clipperz.Base.extend(Clipperz.PM.DataModel.DirectLogin, Object, {
69
70 'toString': function() {
71 return "DirectLogin (" + this.reference() + ")";
72 },
73
74 //=========================================================================
75
76 'reference': function () {
77 return this._reference;
78 },
79
80 //-------------------------------------------------------------------------
81
82 'record': function () {
83 return this._record;
84 },
85
86 //=========================================================================
87
88 'isBrandNew': function () {
89 return this._isBrandNew;
90 },
91
92 //=========================================================================
93
94 'removeIndexDataFunction': function () {
95 return this._removeIndexDataFunction;
96 },
97
98 'remove': function () {
99 return Clipperz.Async.callbacks("DirectLogin.remove", [
100 MochiKit.Base.partial(this.removeIndexDataFunction(), this.reference()),
101 MochiKit.Base.method(this.record(), 'removeDirectLogin', this)
102 ], {trace:false});
103 },
104
105 //=========================================================================
106 /*
107 'inputsDeferredLock': function () {
108 return this._inputsDeferredLock;
109 },
110
111 'bindingsDeferredLock': function () {
112 return this._bindingsDeferredLock;
113 },
114
115 'formValuesDeferredLock': function () {
116 return this._formValuesDeferredLock;
117 },
118*/
119 //=========================================================================
120
121 'label': function () {
122 return this.getIndexDataForKey('label');
123 },
124
125 'setLabelKeepingBackwardCompatibilityWithBeta': function (aValue) {
126 return Clipperz.Async.callbacks("DirectLogin.setLabelKeepingBackwardCompatibilityWithBeta", [
127 MochiKit.Base.method(this, 'setIndexDataForKey', 'label', aValue),
128 MochiKit.Base.method(this, 'setValue', 'label', aValue)
129 ], {trace:false});
130 },
131
132 'setLabel': function (aValue) {
133 return this.setLabelKeepingBackwardCompatibilityWithBeta(aValue);
134 // return this.setIndexDataForKey('label', aValue);
135 },
136
137 //=========================================================================
138
139 'favicon': function () {
140 return this.getIndexDataForKey('favicon');
141 },
142
143 'setFavicon': function (aValue) {
144 return this.setIndexDataForKey('favicon', aValue);
145 },
146
147 'faviconUrlWithBookmarkletConfiguration': function (aBookmarkletConfiguration) {
148 varresult;
149
150 if (! MochiKit.Base.isUndefinedOrNull(aBookmarkletConfiguration['page']['favicon'])) {
151 result = aBookmarkletConfiguration['page']['favicon'];
152 } else if (! MochiKit.Base.isUndefinedOrNull(aBookmarkletConfiguration['form']['attributes']['action'])) {
153 var actionUrl;
154 var hostname;
155
156 actionUrl = aBookmarkletConfiguration['form']['attributes']['action'];
157 hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1');
158 result = "http://" + hostname + "/favicon.ico";
159 } else {
160 result = null;
161 }
162
163
164 return result;
165 },
166
167 //-------------------------------------------------------------------------
168/*
169 'faviconData': function () {
170 var regexp = new RegExp('^data\:\/\/.*', 'i');
171
172 return Clipperz.Async.callbacks("DirectLogin.favicon", [
173 MochiKit.Base.method(this, 'getIndexDataForKey', 'favicon'),
174 MochiKit.Base.method(regexp, 'test'),
175 Clipperz.Async.deferredIf("is data URL", [
176 MochiKit.Base.method(this, 'getIndexDataForKey', 'favicon')
177 ], [
178 MochiKit.Base.method(this, 'transientState'),
179 MochiKit.Base.itemgetter('faviconData'),
180 Clipperz.Async.deferredIf('has a chaced value for the favicon data', [
181 MochiKit.Base.operator.identity
182 ], [
183 MochiKit.Base.method(this, 'getIndexDataForKey', 'favicon'),
184 MochiKit.Base.method(this, 'loadFaviconDataFromURL')
185 ])
186
187 ])
188 ], {trace:false});
189 },
190
191 //-------------------------------------------------------------------------
192
193 'loadFaviconDataFromURL': function (anURL) {
194 var deferredResult;
195 var image;
196
197 deferredResult = new Clipperz.Async.Deferred("DirectLogin.loadFaviconDataFromURL", {trace:false});
198 deferredResult.addCallback(function (anEvent) {
199 var image = anEvent.src();
200 var canvas = document.createElement("canvas");
201 var result;
202
203 canvas.width = image.width;
204 canvas.height = image.height;
205
206 var ctx = canvas.getContext("2d");
207 ctx.drawImage(image, 0, 0);
208
209 result = canvas.toDataURL(/*"image/png"* /);
210
211 return result;
212 });
213 deferredResult.addErrback(MochiKit.Async.succeed, Clipperz.PM.Strings.getValue('defaultFaviconUrl'));
214 deferredResult.addBoth(MochiKit.Base.bind(function (aDataUrl) {
215 this.transientState()['faviconData'] = aDataUrl;
216
217 return aDataUrl;
218 }, this));
219
220 image = new Image();
221 MochiKit.Signal.connect(image, 'onload', MochiKit.Base.method(deferredResult, 'callback'));
222 MochiKit.Signal.connect(image, 'onerror', MochiKit.Base.method(deferredResult, 'errback'));
223 MochiKit.Signal.connect(image, 'onabort', MochiKit.Base.method(deferredResult, 'errback'));
224
225 image.src = anURL;
226
227 return deferredResult;
228 },
229*/
230
231 //=========================================================================
232
233 'type': function () {
234 return this.getValue('formData.attributes.type')
235 },
236
237 //=========================================================================
238
239 'serializedData': function () {
240 return Clipperz.Async.collectResults("DirectLogin.serializedData", {
241 'bookmarkletVersion': MochiKit.Base.method(this, 'getValue', 'bookmarkletVersion'),
242 'formData': MochiKit.Base.method(this, 'getValue', 'formData'),
243 'formValues': MochiKit.Base.method(this, 'getValue', 'formValues'),
244 'bindingData': [
245 MochiKit.Base.method(this, 'bindings'),
246 function (someBindings) {
247 var result;
248 var bindingKey;
249
250 result = {}
251 for (bindingKey in someBindings) {
252 result[bindingKey] = someBindings[bindingKey].serializedData();
253 }
254
255 return result;
256 }
257 ]
258 }, {trace:false})()
259 },
260
261 //=========================================================================
262/*
263 'fixFormDataFromBookmarkletVersion_0_1': function(aValue) {
264//{"type":"radio", "name":"action", "value":"new-user", "checked":false }, { "type":"radio", "name":"action", "value":"sign-in", "checked":true }
265 // ||
266 // \ /
267 // \/
268//{"name":"dominio", "type":"radio", "options":[{"value":"@alice.it", "checked":true}, {"value":"@tin.it", "checked":false}, {"value":"@virgilio.it", "checked":false}, {"value":"@tim.it", "checked":false}]}
269 var result;
270 var inputs;
271 var updatedInputs;
272 var radios;
273
274 result = aValue;
275 inputs = aValue['inputs'];
276
277 updatedInputs = MochiKit.Base.filter(function(anInput) {
278 varresult;
279 var type;
280
281 type = anInput['type'] || 'text';
282 result = type.toLowerCase() != 'radio';
283
284 return result;
285 }, inputs);
286 radios = MochiKit.Base.filter(function(anInput) {
287 varresult;
288 var type;
289
290 type = anInput['type'] || 'text';
291 result = type.toLowerCase() == 'radio';
292
293 return result;
294 }, inputs);
295
296 if (radios.length > 0) {
297 var updatedRadios;
298
299 updatedRadios = {};
300 MochiKit.Iter.forEach(radios, MochiKit.Base.bind(function(aRadio) {
301 varradioConfiguration;
302
303 radioConfiguration = updatedRadios[aRadio['name']];
304 if (radioConfiguration == null) {
305 radioConfiguration = {type:'radio', name:aRadio['name'], options:[]};
306 updatedRadios[aRadio['name']] = radioConfiguration;
307 }
308
309 //TODO: remove the value: field and replace it with element.dom.value = <some value>
310 radioConfiguration.options.push({value:aRadio['value'], checked:aRadio['checked']});
311
312 //TODO: shoud remove the 'formValues' call, as it is now deferred
313 // if ((aRadio['checked'] == true) && (this.formValues()[aRadio['name']] == null)) {
314 // this.formValues()[aRadio['name']] = aRadio['value'];
315 // }
316 }, this))
317
318 updatedInputs = MochiKit.Base.concat(updatedInputs, MochiKit.Base.values(updatedRadios));
319 }
320
321 delete result.inputs;
322 result.inputs = updatedInputs;
323
324 return result;
325 },
326
327 '_fixConfiguration': function (aConfiguration) {
328 var fixedConfiguration;
329 // var inputs;
330 // var bindings;
331 // var i,c;
332
333 fixedConfiguration = Clipperz.Base.deepClone(aConfiguration);
334
335//console.log("PROCESS CONFIGURATION", aConfiguration);
336 switch (aConfiguration['bookmarkletVersion']) {
337 case '0.1':
338 fixedConfiguration['formData'] = this.fixFormDataFromBookmarkletVersion_0_1(aConfiguration['formData']);
339 break;
340 case '0.2':
341 fixedConfiguration['formData'] = aConfiguration['formData'];
342 break;
343 }
344
345 / *
346 aConfiguration['_inputs'] = [];
347 c = formData['inputs'].length;
348 for (i=0; i<c; i++) {
349 aConfiguration['_inputs'].push(new Clipperz.PM.DataModel.DirectLoginInput(formData['inputs'][i]));
350 }
351* /
352/ *
353 aConfiguration['_bindings'] = {};
354 if (aConfiguration['legacyBindingData'] == null) {
355 if (aConfiguration['bindingData'] != null) {
356 var bindingKey;
357
358 for (bindingKey in aConfiguration['bindingData']) {
359 var newBinding;
360
361 newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(bindingKey, {fieldKey:aConfiguration['bindingData'][bindingKey]});
362 aConfiguration['_bindings'][newBinding.key()] = newBinding;
363 }
364 } else {
365 var editableFields;
366
367 editableFields = MochiKit.Base.filter(function(aField) {
368 var result;
369 var type;
370
371 type = aField['type'].toLowerCase();
372 result = ((type != 'hidden') && (type != 'submit') && (type != 'checkbox') && (type != 'radio') && (type != 'select'));
373
374 return result;
375 }, aConfiguration['_inputs']);
376
377 MochiKit.Iter.forEach(editableFields, MochiKit.Base.bind(function(anEditableField) {
378 var newBinding;
379
380 newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(anEditableField['name']);
381 aConfiguration['_bindings'][newBinding.key()] = newBinding;
382 }, this));
383 }
384
385 } else {
386 var bindingKey;
387
388 for (bindingKey in aConfiguration['legacyBindingData']) {
389 var newBinding;
390
391 newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(bindingKey, {fieldName:aConfiguration['legacyBindingData'][bindingKey]});
392 aConfiguration['_bindings'][newBinding.key()] = newBinding;
393 }
394 }
395* /
396
397 return fixedConfiguration;
398 },
399
400 //-------------------------------------------------------------------------
401
402 'getObjectDataStore': function () {
403 var deferredResult;
404
405 deferredResult = new Clipperz.Async.Deferred("DirectLogin.getObjectDataStore", {trace:false});
406 deferredResult.acquireLock(this.objectDataStoreDeferredLock());
407 deferredResult.addCallback(MochiKit.Base.bind(function () {
408 var innerDeferredResult;
409
410 if (this._objectDataStore == null) {
411 this._objectDataStore = new Clipperz.KeyValueObjectStore();
412
413 innerDeferredResult = new Clipperz.Async.Deferred("DirectLogin.getObjectDataStore <inner deferred>", {trace:false});
414 // innerDeferredResult.addMethod(this.record(), 'getValue', 'directLogins' + '.' + this.reference());
415 innerDeferredResult.addMethod(this, 'getValue', ''),
416 innerDeferredResult.addMethod(this, 'setOriginalState');
417 innerDeferredResult.addMethod(this, '_fixConfiguration');
418 innerDeferredResult.addMethod(this._objectDataStore, 'initWithValues');
419 // innerDeferredResult.addMethod(this._objectDataStore, 'setValues');
420 innerDeferredResult.callback();
421 } else {
422 innerDeferredResult = MochiKit.Async.succeed(this._objectDataStore);
423 }
424
425 return innerDeferredResult;
426 }, this));
427 deferredResult.releaseLock(this.objectDataStoreDeferredLock());
428 deferredResult.callback();
429
430 return deferredResult;
431 },
432
433 //-------------------------------------------------------------------------
434
435 'hasInitiatedObjectDataStore': function () {
436 return (this._objectDataStore != null);
437 },
438
439 //-------------------------------------------------------------------------
440
441 'resetObjectDataStore': function () {
442 this._objectDataStore.removeAllData();
443 this._objectDataStore = null;
444 },
445*/
446 //=========================================================================
447
448 'bookmarkletConfiguration': function () {
449 return Clipperz.Async.callbacks("DirectLogin.bookmarkletConfiguration", [
450 Clipperz.Async.collectResults("DirectLogin.bookmarkletConfiguration <inner results>", {
451 'label': MochiKit.Base.method(this, 'label'),
452 'configuration': MochiKit.Base.method(this, 'getValue', '')
453 }, {trace:false}),
454 function (someValues) {
455 var result;
456
457 if (someValues['configuration'] != null) {
458 varconfiguration;
459
460 configuration = {
461 'page': {
462 'title': someValues['label']
463 //'favicon'
464 // 'url'
465 },
466 'form': someValues['configuration']['formData'],
467 'version':someValues['configuration']['bookmarkletVersion']
468 }
469
470 result = Clipperz.Base.formatJSON(configuration);
471 } else {
472 result = '';
473 }
474
475 return result;
476 }
477 ], {trace:false});
478
479 },
480
481 //-------------------------------------------------------------------------
482
483 'setBookmarkletConfiguration': function (aValue) {
484 var bookmarkletConfiguration;
485
486 bookmarkletConfiguration = Clipperz.PM.DataModel.DirectLogin.checkBookmarkletConfiguration(aValue);
487//console.log("BOOKMARKLET CONFIGURATION", bookmarkletConfiguration);
488 return Clipperz.Async.callbacks("DirectLogin.setBookmarkletConfiguration", [
489 MochiKit.Base.method(this, 'setValue', 'formData', bookmarkletConfiguration['form']),
490//function (aValue) { console.log("SET VALUE - formData", aValue); return aValue; },
491 MochiKit.Base.method(this, 'setValue', 'bookmarkletVersion', bookmarkletConfiguration['version']),
492
493 MochiKit.Base.method(this, 'favicon'),
494 Clipperz.Async.deferredIf("the favicon is not set", [
495 ], [
496 MochiKit.Base.method(this, 'faviconUrlWithBookmarkletConfiguration', bookmarkletConfiguration),
497 MochiKit.Base.method(this, 'setFavicon')
498 ]),
499
500 MochiKit.Base.method(this, 'updateInputsAfterChangingBookmarkletConfiguration'),
501 MochiKit.Base.method(this, 'updateFormValuesAfterChangingBookmarkletConfiguration'),
502 MochiKit.Base.method(this, 'updateBindingsAfterChangingBookmarkletConfiguration'),
503
504 MochiKit.Base.noop
505 ], {trace:false});
506 },
507
508 //=========================================================================
509
510 'formAttributes': function () {
511 return this.getValue('formData.attributes');
512 },
513
514 //=========================================================================
515
516 'inputs': function () {
517 return Clipperz.Async.callbacks("DirectLogin.inputs", [
518 Clipperz.Async.deferredIf("this._inputs is defined", [
519 ], [
520 MochiKit.Base.method(this, 'updateInputsAfterChangingBookmarkletConfiguration')
521 ])
522 ], {trace:false}, this._inputs);
523 },
524
525 'setInputWithFormDataConfiguration': function (aFormDataConfiguration) {
526 this._inputs = {};
527
528 if (aFormDataConfiguration != null) {
529 MochiKit.Iter.forEach(aFormDataConfiguration['inputs'], MochiKit.Base.bind(function (anInputData) {
530 var newInput;
531
532 newInput = new Clipperz.PM.DataModel.DirectLoginInput(anInputData);
533 this._inputs[newInput.name()] = newInput;
534 }, this));
535 }
536
537 return this._inputs;
538 },
539
540 'updateInputsAfterChangingBookmarkletConfiguration': function () {
541 return Clipperz.Async.callbacks("DirectLogin.updateInputsAfterChangingBookmarkletConfiguration", [
542 // MochiKit.Base.method(this, 'getValue', ''),
543//function (aValue) { console.log("VALUE", aValue); return aValue },
544 MochiKit.Base.method(this, 'getValue', 'formData'),
545//function (aValue) { console.log("FORM DATA", aValue); return aValue },
546 MochiKit.Base.method(this, 'setInputWithFormDataConfiguration')
547 ], {trace:false});
548 },
549
550 //=========================================================================
551
552 'inputValues': function () {
553 return Clipperz.Async.callbacks("DirectLogin.inputValues", [
554 MochiKit.Base.method(this, 'inputs'),
555 MochiKit.Base.values,
556 //function (aValue) { console.log("INPUTS", aValue); return aValue; },
557 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.partial(MochiKit.Base.method(this, 'inputValue'))),
558 Clipperz.Async.collectAll,
559 Clipperz.Base.mergeItems
560 ], {trace:false});
561 },
562
563 'inputValue': function (anInput) {
564 vardeferredResult;
565
566 deferredResult = new Clipperz.Async.Deferred("DirectLogin.inputValue", {trace:false});
567
568 if (anInput.needsFormValue()) {
569 deferredResult.addMethod(this, 'formValues');
570 deferredResult.addCallback(MochiKit.Base.itemgetter(anInput.name()));
571 deferredResult.addMethodcaller('value');
572 } else if (anInput.needsBinding()) {
573 deferredResult.addMethod(this, 'bindings');
574 deferredResult.addCallback(MochiKit.Base.itemgetter(anInput.name()));
575 deferredResult.addMethodcaller('field');
576 deferredResult.addMethodcaller('value');
577 } else {
578 deferredResult.addCallback(MochiKit.Async.succeed, anInput.value());
579 }
580 deferredResult.addCallback(function (anActualValue) {
581 return [anInput.name(), anActualValue];
582 });
583
584 deferredResult.callback();
585
586 return deferredResult;
587 },
588
589 //=========================================================================
590
591 'bindings': function () {
592 return Clipperz.Async.callbacks("DirectLogin.bindings", [
593 Clipperz.Async.deferredIf("this._bindings is defined", [
594 ], [
595 MochiKit.Base.method(this, 'updateBindingsAfterChangingBookmarkletConfiguration'),
596 MochiKit.Base.bind(function () { return this._bindings;}, this)
597 ])
598 ], {trace:false}, this._bindings);
599 },
600
601 'bindFormFieldWithLabelToRecordFieldWithLabel': function (aFormFieldLabel, aRecordFieldLabel) {
602 return Clipperz.Async.callbacks("DirectLogin.bindFormFieldWithLabelToCardFieldWithLabel", [
603 Clipperz.Async.collectResults("DirectLogin.bindFormFieldWithLabelToCardFieldWithLabel - collect results", {
604 'binding': [
605 MochiKit.Base.method(this, 'bindings'),
606 MochiKit.Base.itemgetter(aFormFieldLabel)
607 ],
608 'field': [
609 MochiKit.Base.method(this.record(), 'fieldWithLabel', aRecordFieldLabel)
610 ]
611 }),
612 function (someValues) {
613 someValues['binding'].setField(someValues['field'])
614 }
615 ], {trace:false});
616 },
617
618 //-------------------------------------------------------------------------
619/*
620 'bindingValues': function () {
621 return Clipperz.Async.callbacks("DirectLogin.bindingValues", [
622 Clipperz.Async.collectResults("DirectLogin.bindingValues [collectResults]", {
623 'fieldValues': [
624 MochiKit.Base.method(this, 'record'),
625 MochiKit.Base.methodcaller('getFieldsValues')
626 ],
627 'bindings': MochiKit.Base.method(this, 'bindings')
628 }, {trace:false}),
629 function (someData) {
630 var result;
631 varbindingKey;
632
633 result = {};
634 for (bindingKey in someData['bindings']) {
635 result[bindingKey] = someData['fieldValues'][someData['bindings'][bindingKey].fieldKey()]['value'];
636 }
637
638 return result;
639 }
640 ], {trace:false});
641 },
642*/
643 //-------------------------------------------------------------------------
644
645 'updateBindingsAfterChangingBookmarkletConfiguration': function () {
646 return Clipperz.Async.callbacks("DirectLogin.updateBindingsAfterChangingBookmarkletConfiguration", [
647 Clipperz.Async.collectResults("DirectLogin.updateBindingsAfterChangingBookmarkletConfiguration<collect results>", {
648 'currentValues':MochiKit.Base.method(this, 'getValue', ''),
649 'originalValues':MochiKit.Base.method(this, 'originalConfiguration'),
650 'inputs': MochiKit.Base.method(this, 'inputs')
651 }, {trace:false}),
652 MochiKit.Base.bind(function (someValues) {
653 var availableBindingValues;
654 var inputRequiringBindingValues;
655 var newBindingValues;
656
657 if (MochiKit.Base.isUndefinedOrNull(someValues['originalValues']) || MochiKit.Base.isUndefinedOrNull(someValues['originalValues']['bindingData'])) {
658 availableBindingValues = {};
659 } else {
660 availableBindingValues = Clipperz.Base.deepClone(someValues['originalValues']['bindingData'])
661 }
662
663 if (someValues['currentValues'] != null) {
664 MochiKit.Base.update(availableBindingValues, someValues['currentValues']['bindingData']);
665 }
666
667 this._bindings = {};
668 newBindingValues = {}
669 MochiKit.Iter.forEach(MochiKit.Base.filter(MochiKit.Base.methodcaller('needsBinding'), MochiKit.Base.values(someValues['inputs'])), MochiKit.Base.bind(function (anInput) {
670 varnewBinding;
671
672 newBindingValues[anInput.name()] = availableBindingValues[anInput.name()];
673 newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, {
674 'key': anInput.name(),
675 'field':availableBindingValues[anInput.name()]
676 });
677
678 this._bindings[anInput.name()] = newBinding;
679 }, this))
680//console.log("THIS._BINDINGS", this._bindings);
681
682 return newBindingValues;
683
684/*
685 this._bindings = {};
686//console.log("CONFIGURATION", aConfiguration);
687
688 if (someValues['currentValues'] != null) {
689 if (someValues['currentValues']['bindingData'] != null) {
690 var bindingKey;
691
692//console.log("BINDING DATA", someValues['currentValues']['bindingData']);
693 for (bindingKey in someValues['currentValues']['bindingData']) {
694 var newBinding;
695
696 newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, {
697 'key': bindingKey,
698 'field':someValues['currentValues']['bindingData'][bindingKey]
699 });
700 this._bindings[newBinding.key()] = newBinding;
701 }
702 } else if (someValues['currentValues']['legacyBindingData'] == null) {
703 var bindingKey;
704
705 for (bindingKey in someValues['currentValues']['legacyBindingData']) {
706 var newBinding;
707
708 newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, {
709 'key': bindingKey,
710 'field':someValues['currentValues']['legacyBindingData'][bindingKey]
711 });
712 this._bindings[newBinding.key()] = newBinding;
713 }
714 } else {
715 WTF = TODO;
716 }
717 }
718
719 return this._bindings;
720*/
721 }, this),
722 MochiKit.Base.method(this, 'setValue', 'bindingData')
723 ], {trace:false});
724 },
725
726 //=========================================================================
727
728 'formValues': function () {
729 return Clipperz.Async.callbacks("DirectLogin.formValues", [
730 Clipperz.Async.deferredIf("this._formValues is defined", [
731 ], [
732 MochiKit.Base.method(this, 'updateFormValuesAfterChangingBookmarkletConfiguration'),
733 MochiKit.Base.bind(function () { return this._formValues;}, this)
734 ])
735 ], {trace:false}, this._formValues);
736 },
737
738 //-------------------------------------------------------------------------
739
740 'updateFormValuesAfterChangingBookmarkletConfiguration': function () {
741 return Clipperz.Async.callbacks("DirectLogin.updateFormValuesAfterChangingBookmarkletConfiguration", [
742 Clipperz.Async.collectResults("DirectLogin.updateFormValuesAfterChangingBookmarkletConfiguration <collect results>", {
743 'currentValues':MochiKit.Base.method(this, 'getValue', ''),
744 'originalValues':MochiKit.Base.method(this, 'originalConfiguration'),
745 'inputs': MochiKit.Base.method(this, 'inputs')
746 }, {trace:false}),
747 MochiKit.Base.bind(function (someValues) {
748 var availableFormValues;
749 var inputRequiringFormValues;
750 var newFormValues;
751
752 if (MochiKit.Base.isUndefinedOrNull(someValues['originalValues']) || MochiKit.Base.isUndefinedOrNull(someValues['originalValues']['formValues'])) {
753 availableFormValues = {};
754 } else {
755 availableFormValues = Clipperz.Base.deepClone(someValues['originalValues']['formValues'])
756 }
757
758 MochiKit.Base.update(availableFormValues, someValues['currentValues']['formValues']);
759
760 this._formValues = {};
761 newFormValues = {};
762 MochiKit.Iter.forEach(MochiKit.Base.filter(MochiKit.Base.methodcaller('needsFormValue'), MochiKit.Base.values(someValues['inputs'])), MochiKit.Base.bind(function (anInput) {
763 varnewFormValue;
764 var fieldOptions;
765
766 fieldOptions = {
767 'type': anInput.type(),
768 'options':anInput.options()
769 };
770
771 newFormValues[anInput.name()] = availableFormValues[anInput.name()]
772 newFormValue = new Clipperz.PM.DataModel.DirectLoginFormValue(this, {
773 'key': anInput.name(),
774 'fieldOptions':fieldOptions,
775 'value': availableFormValues[anInput.name()]
776 });
777
778 this._formValues[anInput.name()] = newFormValue;
779 }, this))
780
781 return newFormValues;
782 }, this),
783 MochiKit.Base.method(this, 'setValue', 'formValues')
784 ], {trace:false});
785 },
786
787 //=========================================================================
788
789 'retrieveIndexDataFunction': function () {
790 return this._retrieveIndexDataFunction;
791 },
792
793 'getIndexDataForKey': function (aKey) {
794 return Clipperz.Async.callbacks("DirectLogin.getIndexDataForKey", [
795 MochiKit.Base.partial(this.retrieveIndexDataFunction(), this.reference()),
796 Clipperz.Async.deferredIf("DirectLogin.getIndexDataForKey - index data not null", [
797 MochiKit.Base.itemgetter(aKey)
798 ],[
799 MochiKit.Async.succeed
800 ])
801 ], {trace:false});
802 },
803
804 //-------------------------------------------------------------------------
805
806 'setIndexDataForKey': function (aKey, aValue) {
807 return Clipperz.Async.callbacks("DirectLogin.setValueForKey", [
808 MochiKit.Base.method(this, 'getIndexDataForKey', aKey),
809 MochiKit.Base.bind(function (anActualValue) {
810 var transientStateKey;
811
812 transientStateKey = 'original_' + aKey;
813 if (MochiKit.Base.isUndefinedOrNull(this.transientState()[transientStateKey])) {
814 if (anActualValue != aValue) {
815 this.transientState()[transientStateKey] = anActualValue;
816 }
817 } else if (this.transientState()[transientStateKey] == aValue) {
818 this.transientState()[transientStateKey] = null;
819 }
820 }, this),
821 MochiKit.Base.partial(this._setIndexDataFunction, this.reference(), aKey, aValue)
822 ], {trace:false})
823 },
824
825 //-------------------------------------------------------------------------
826/*
827 'setValueForKey': function (aKey, aValue) {
828 return Clipperz.Async.callbacks("DirectLogin.setValueForKey", [
829 MochiKit.Base.method(this, 'getIndexDataForKey', aKey),
830 MochiKit.Base.bind(function (anActualValue) {
831 var transientStateKey;
832
833 transientStateKey = 'original_' + aKey;
834 if (MochiKit.Base.isUndefinedOrNull(this.transientState()[transientStateKey])) {
835 if (anActualValue != aValue) {
836 this.transientState()[transientStateKey] = anActualValue;
837 }
838 } else if (this.transientState()[transientStateKey] == aValue) {
839 this.transientState()[transientStateKey] = null;
840 }
841 }, this),
842 MochiKit.Base.method(this, 'setIndexDataForKey', aKey, aValue)
843 ], {trace:false})
844 },
845*/
846 //=========================================================================
847/*
848 'storedConfiguration': function () {
849 return this.record().getValue('directLogins' + '.' + this.reference());
850 },
851
852 //'setStoredConfiguration': function (aValue) {
853 // return this.record().setValue('directLogins' + '.' + this.reference(), aValue);
854 //},
855*/
856 //=========================================================================
857
858 'hasPendingChanges': function () {
859 varresult;
860 var deferredResult;
861
862 result = false;
863 result = result || this.isBrandNew();
864 result = result || (! MochiKit.Base.isUndefinedOrNull(this.transientState()['original_label']));
865 result = result || (! MochiKit.Base.isUndefinedOrNull(this.transientState()['original_favicon']));
866
867 if ((result == false) && (this.originalConfiguration() != null)) {
868 deferredResult = Clipperz.Async.callbacks("DirectLogin.hasPendingChanges", [
869 MochiKit.Base.method(this, 'serializedData'),
870 MochiKit.Base.bind(function (aCurrentConfiguration) {
871 varoriginalConfiguration;
872 var currentConfiguration;
873 var result;
874
875 originalConfiguration = this.originalConfiguration();
876 currentConfiguration = aCurrentConfiguration;
877
878 result = false;
879 result = result || (MochiKit.Base.compare(originalConfiguration['bookmarkletVersion'], currentConfiguration['bookmarkletVersion'])!= 0);
880 result = result || (MochiKit.Base.compare(originalConfiguration['formData'], currentConfiguration['formData']) != 0);
881 result = result || (MochiKit.Base.compare(originalConfiguration['formValues'], currentConfiguration['formValues']) != 0);
882 result = result || (MochiKit.Base.compare(originalConfiguration['bindingData'], currentConfiguration['bindingData']) != 0);
883
884 return result;
885 }, this)
886 ], {trace:false});
887 } else {
888 deferredResult = MochiKit.Async.succeed(result);
889 }
890
891 return deferredResult;
892 },
893
894 //-------------------------------------------------------------------------
895
896 'revertChanges': function () {
897 var deferredResult;
898
899 if (this.transientState()['original_label'] != null) {
900 this.setLabel(this.transientState()['original_label']);
901 }
902
903 if (this.transientState()['original_favicon'] != null) {
904 this.setFavicon(this.transientState()['original_favicon']);
905 }
906
907 if (this.originalConfiguration() != null) {
908 deferredResult = this.setValue('', this.originalConfiguration());
909 } else {
910 deferredResult = MochiKit.Async.succeed();
911 }
912
913 this._inputs = null;
914 this._bindings = null;
915 this._formValues= null;
916
917 this.resetTransientState(false);
918
919/*
920 if (this.hasInitiatedObjectDataStore()) {
921 deferredResult = Clipperz.Async.callbacks("DirectLogin.revertChanges", [
922 // MochiKit.Base.method(this.record(), 'setValue', 'directLogins' + '.' + this.reference(), this.originalState()),
923 MochiKit.Base.method(this, 'setValue', '', this.originalState()),
924 MochiKit.Base.method(this, 'resetObjectDataStore')
925 ], {trace:false})
926 } else {
927 deferredResult = MochiKit.Async.succeed();
928 }
929*/
930 return deferredResult;
931 },
932
933
934 //=========================================================================
935
936 'transientState': function () {
937 if (this._transientState == null) {
938 this._transientState = {}
939 }
940
941 return this._transientState;
942 },
943
944 'resetTransientState': function (isCommitting) {
945 this._transientState = null;
946 },
947
948 'commitTransientState': function (isCommitting) {
949 this._transientState = null;
950 this._isBrandNew = false;
951 },
952
953 //-------------------------------------------------------------------------
954
955 'originalConfiguration': function () {
956 return this.transientState()['original_configuration'];
957 },
958
959 'setOriginalConfiguration': function (aConfiguration) {
960 this.transientState()['original_configuration'] = Clipperz.Base.deepClone(aConfiguration);
961 },
962
963 //=========================================================================
964
965 'actualKey': function (aValueKey) {
966 var actualKey;
967
968 actualKey = 'directLogins' + '.' + this.reference();
969 if (aValueKey != '') {
970 actualKey = actualKey + '.' + aValueKey;
971 }
972
973 return actualKey;
974 },
975
976 //-------------------------------------------------------------------------
977
978 'getValue': function (aValueKey) {
979 return this.record().getValue(this.actualKey(aValueKey));
980 },
981
982 'setValue': function (aValueKey, aValue) {
983 // return this.record().setValue(this.actualKey(aValueKey), aValue);
984
985 return Clipperz.Async.callbacks("DirectLogin.setValue", [
986 MochiKit.Base.method(this, 'getValue', ''),
987 MochiKit.Base.bind(function (aValue) {
988 if (this.originalConfiguration() == null) {
989 this.setOriginalConfiguration(aValue);
990 }
991 }, this),
992 // MochiKit.Base.method(this, 'originalConfiguration'),
993 // Clipperz.Async.deferredIf("originalConfiguration has been set", [
994 // ], [
995 // MochiKit.Base.method(this, 'getValue', ''),
996 // MochiKit.Base.method(this, 'setOriginalConfiguration')
997 // ]),
998 MochiKit.Base.method(this.record(), 'setValue', this.actualKey(aValueKey), aValue)
999 ], {trace:false});
1000 },
1001
1002 'removeValue': function (aValueKey) {
1003 // return this.record().removeValue(this.actualKey(aValueKey));
1004
1005 return Clipperz.Async.callbacks("DirectLogin.setValue", [
1006 MochiKit.Base.method(this, 'originalConfiguration'),
1007 Clipperz.Async.deferredIf("originalConfiguration has been set", [
1008 ], [
1009 MochiKit.Base.method(this, 'getValue', ''),
1010 MochiKit.Base.method(this, 'setOriginalConfiguration')
1011 ]),
1012 MochiKit.Base.method(this.record(), 'removeValue', this.actualKey(aValueKey))
1013 ], {trace:false});
1014 },
1015
1016 //=========================================================================
1017
1018 'deleteAllCleanTextData': function () {
1019 this._inputs = null;
1020 this._bindings = null;
1021 this._formValues = null;
1022
1023 this.resetTransientState();
1024 },
1025
1026 //-------------------------------------------------------------------------
1027
1028 'hasAnyCleanTextData': function () {
1029 var result;
1030
1031 result = false;
1032
1033 result = result || (this._inputs != null);
1034 result = result || (this._bindings != null);
1035 result = result || (this._formValues != null);
1036 result = result || (MochiKit.Base.keys(this.transientState()).length != 0);
1037
1038 return MochiKit.Async.succeed(result);
1039 },
1040
1041 //=========================================================================
1042 __syntaxFix__: "syntax fix"
1043});
1044
1045//#############################################################################
1046
1047Clipperz.PM.DataModel.DirectLogin.exception = {
1048 'WrongBookmarkletConfiguration': new MochiKit.Base.NamedError("Clipperz.PM.DataModel.DirectLogin.exception.WrongBookmarkletConfiguration")
1049};
1050
1051Clipperz.PM.DataModel.DirectLogin.checkBookmarkletConfiguration = function(aConfiguration) {
1052 var configuration;
1053
1054 try {
1055 configuration = Clipperz.Base.evalJSON(aConfiguration);
1056 // configuration = Clipperz.PM.BookmarkletProcessor.sanitizeBookmarkletConfiguration(configuration);
1057
1058 if (MochiKit.Base.isUndefinedOrNull(configuration['page']['title'])
1059 ||MochiKit.Base.isUndefinedOrNull(configuration['form']['attributes']['action'])
1060 // ||MochiKit.Base.isUndefinedOrNull(configuration['form']['attributes']['method'])
1061 ||MochiKit.Base.isUndefinedOrNull(configuration['form']['inputs'])
1062 ||MochiKit.Base.isUndefinedOrNull(configuration['version'])
1063 ) {
1064 throw Clipperz.PM.DataModel.DirectLogin.exception.WrongBookmarkletConfiguration;
1065 }
1066
1067 // if (MochiKit.Base.isUndefinedOrNull(configuration['favicon'])) {
1068 // throw Clipperz.PM.DataModel.DirectLogin.exception.WrongBookmarkletConfiguration;
1069 // }
1070
1071 } catch (exception) {
1072 throw exception;
1073 }
1074
1075 return configuration;
1076};
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js
new file mode 100644
index 0000000..fd55c63
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js
@@ -0,0 +1,125 @@
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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33
34//#############################################################################
35
36Clipperz.PM.DataModel.DirectLoginBinding = function(aDirectLogin, args) {
37 args = args || {};
38
39 this._directLogin = aDirectLogin|| Clipperz.Base.exception.raise('MandatoryParameter');
40
41 this._key = args.key|| Clipperz.Base.exception.raise('MandatoryParameter');
42 this._fieldKey = args.field || /* this.directLogin().fieldWithName(args.fieldName).reference() || */null;
43
44 return this;
45}
46
47Clipperz.PM.DataModel.DirectLoginBinding.prototype = MochiKit.Base.update(null, {
48
49 'toString': function() {
50 return "DirectLoginBinding (" + this.key() + ", " + this.fieldKey() + ")";
51 },
52
53 //-------------------------------------------------------------------------
54
55 'directLogin': function () {
56 return this._directLogin;
57 },
58
59 //-------------------------------------------------------------------------
60
61 'key': function() {
62 return this._key;
63 },
64
65 //-------------------------------------------------------------------------
66
67 'fieldKey': function() {
68 return this._fieldKey;
69 },
70
71 'setFieldKey': function(aValue) {
72 this._fieldKey = aValue;
73
74 return this.directLogin().setValue('bindingData' + '.' + this.key(), aValue);
75 },
76
77 //'fieldName': function() {
78 // return this._fieldName;
79 //},
80
81 //-------------------------------------------------------------------------
82
83 'field': function() {
84 var deferredResult;
85
86 if (this.fieldKey() != null) {
87 deferredResult = Clipperz.Async.callbacks("DirectLoginBinding.field [1]", [
88 MochiKit.Base.method(this.directLogin().record(), 'fields'),
89 MochiKit.Base.itemgetter(this.fieldKey())
90 ], {trace:false});
91 // } else if (this.fieldName() != null) {
92 // WTF = TODO;
93 // result = this.directLogin().record().fieldWithName(this.fieldName());
94 //
95 // this.setFieldKey(result.key());
96 } else {
97 deferredResult = MochiKit.Async.succeed(null);
98 }
99
100 return deferredResult;
101 },
102
103 'setField': function (aField) {
104 this.setFieldKey(aField.reference());
105 },
106
107 //-------------------------------------------------------------------------
108/*
109 'fieldValue': function () {
110 return Clipperz.Async.callbacks("DirectLoginBinding.fieldValue", [
111 MochiKit.Base.method('field'),
112 MochiKit.Base.methodcaller('value')
113 ], {trace:false});
114 },
115*/
116 //-------------------------------------------------------------------------
117
118 'serializedData': function() {
119 return this.fieldKey();
120 },
121
122 //-------------------------------------------------------------------------
123 __syntaxFix__: "syntax fix"
124});
125
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js
new file mode 100644
index 0000000..939ab4b
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js
@@ -0,0 +1,107 @@
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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33
34//#############################################################################
35
36Clipperz.PM.DataModel.DirectLoginFormValue = function(aDirectLogin, args) {
37 args = args || {};
38
39 this._directLogin = aDirectLogin|| Clipperz.Base.exception.raise('MandatoryParameter');
40
41 this._key = args.key || Clipperz.Base.exception.raise('MandatoryParameter');
42 this._fieldOptions = args.fieldOptions|| Clipperz.Base.exception.raise('MandatoryParameter');
43 this._value = args.value || null;
44
45 return this;
46}
47
48Clipperz.PM.DataModel.DirectLoginFormValue.prototype = MochiKit.Base.update(null, {
49
50 'toString': function() {
51 return "DirectLoginFormValue (" + this.key() + ", " + this.value() + ")";
52 },
53
54 //-------------------------------------------------------------------------
55
56 'directLogin': function () {
57 return this._directLogin;
58 },
59
60 //-------------------------------------------------------------------------
61
62 'key': function() {
63 return this._key;
64 },
65
66 //-------------------------------------------------------------------------
67
68 'fieldOptions': function() {
69 return this._fieldOptions;
70 },
71
72 //-------------------------------------------------------------------------
73
74 'type': function () {
75 return this.fieldOptions()['type'];
76 },
77
78 //-------------------------------------------------------------------------
79
80 'value': function() {
81 varresult;
82
83 result = this._value;
84
85 // if ((result == null) && (this.type() == 'checkbox')) {
86 // result = false;
87 // };
88
89 return result;
90 },
91
92 'setValue': function (aValue) {
93//console.log("DirectLoginFormValue.setValue", aValue);
94 this._value = aValue;
95 return this.directLogin().setValue('formValues' + '.' + this.key(), aValue);
96 },
97
98 //-------------------------------------------------------------------------
99/*
100 'serializedData': function() {
101 return this.value();
102 },
103*/
104 //-------------------------------------------------------------------------
105 __syntaxFix__: "syntax fix"
106});
107
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js
new file mode 100644
index 0000000..673d5ee
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33//#############################################################################
34
35Clipperz.PM.DataModel.DirectLoginInput = function(args) {
36 this._args = args;
37
38 return this;
39}
40
41Clipperz.PM.DataModel.DirectLoginInput.prototype = MochiKit.Base.update(null, {
42
43 'args': function() {
44 return this._args;
45 },
46
47 //-------------------------------------------------------------------------
48
49 'name': function() {
50 return this.args()['name'];
51 },
52
53 //-------------------------------------------------------------------------
54
55 'type': function() {
56 var result;
57
58 result = this.args()['type'];
59
60 if (result != null) {
61 result = result.toLowerCase();
62 }
63 return result;
64 },
65
66 //-------------------------------------------------------------------------
67
68 'options': function() {
69 return this.args()['options'];
70 },
71
72 //-------------------------------------------------------------------------
73
74 'value': function() {
75 return this.args()['value'];
76 },
77
78 //-------------------------------------------------------------------------
79 /*
80 'formConfiguration': function(someFormValues, someBindings, someFields) {
81 var result;
82//console.log("### DirectLoginInput.formConfiguration", someFields);
83 if (this.shouldSetValue()) {
84 switch (this.type()) {
85 case 'select':
86 var currentValue;
87 var options;
88
89 // currentValue = this.directLogin()._configuration['formValues'][this.name()];
90 currentValue = someFormValues[this.name()];
91 options = this.args()['options'];
92
93 result = MochiKit.DOM.SELECT({name:this.name()},
94 MochiKit.Base.map(function(anOption) {
95 var options;
96
97 options = {value:anOption['value']};
98 if (currentValue == anOption['value']) {
99 options.selected = true;
100 }
101
102 return MochiKit.DOM.OPTION(options, anOption['label'])
103 }, options)
104 )
105 break;
106 case 'checkbox':
107 var options;
108
109 options = {type:'checkbox', name: this.name()};
110 // if (this.directLogin()._configuration['formValues'][this.name()] == true) {
111 if (someFormValues[this.name()] == true) {
112 options['checked'] = true;
113 };
114
115 result = MochiKit.DOM.INPUT(options, null);
116 break;
117 case 'radio':
118 var currentName;
119 var currentValue;
120 var options;
121
122 currentName = this.name();
123 // currentValue = this.directLogin()._configuration['formValues'][this.name()];
124 currentValue = someFormValues[this.name()];
125 options = this.args()['options'];
126
127 result = MochiKit.DOM.DIV(null,
128 MochiKit.Base.map(function(anOption) {
129 var options;
130 var isChecked;
131 var inputNode;
132 var divNode;
133
134 options = {type:'radio', name:currentName, value:anOption['value']}
135 isChecked = (currentValue == anOption['value']);
136 if (isChecked) {
137 options.checked = true;
138 }
139
140 if (Clipperz_IEisBroken == true) {
141 var checkedValue;
142
143 checkedValue = (isChecked ? " CHECKED" : "");
144 inputNode = MochiKit.DOM.currentDocument().createElement("<INPUT TYPE='RADIO' NAME='" + currentName + "' VALUE='" + anOption['value'] + "'" + checkedValue + ">");
145 } else {
146 inputNode = MochiKit.DOM.INPUT(options, anOption['value']);
147 }
148 divNode = MochiKit.DOM.DIV(null, inputNode);
149
150 return divNode;
151 }, options)
152 );
153 break;
154 }
155 } else {
156 var binding;
157 // binding = this.directLogin().bindings()[this.name()];
158 binding = someBindings[this.name()];
159
160//console.log("### binding", binding);
161//if (binding != null) {
162 ///console.log(" binding.field()", binding.field());
163 ///console.log(" binding.field().value()", binding.field().value());
164 //console.log(" someFields[binding.fieldKey()].value()", someFields[binding.fieldKey()].value());
165//}
166 result = MochiKit.DOM.INPUT({
167 type:((this.type() != 'password') ? this.type() : 'text'),
168 name:this.name(),
169 // value:((binding != null)? binding.field().value() : this.value())
170 value:((binding != null)? someFields[binding.fieldKey()]['value'] : this.value())
171 // value:((binding != null)? someFields[binding.fieldKey()].value() : this.value())
172 }, null);
173 }
174
175 return result;
176 },
177 */
178 //-------------------------------------------------------------------------
179
180 'needsFormValue': function() {
181 var type;
182 var result;
183
184 type = this.type();
185 result = ((type == 'checkbox') || (type == 'radio') || (type == 'select'));
186
187 return result;
188 },
189
190 'needsBinding': function() {
191 var type;
192 var result;
193
194 type = this.type();
195 result = ((type == 'text') || (type == 'password'));
196
197 return result;
198 },
199
200 //-------------------------------------------------------------------------
201 __syntaxFix__: "syntax fix"
202});
203
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js b/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js
new file mode 100644
index 0000000..3408b08
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js
@@ -0,0 +1,551 @@
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
29try { if (typeof(Clipperz.KeyValueObjectStore) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.PM.DataModel.EncryptedRemoteObject depends on Clipperz.KeyValueObjectStore!";
31}
32
33if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
34if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
35
36Clipperz.PM.DataModel.EncryptedRemoteObject = function(args) {
37 args = args || {};
38
39 this._name = args.name || null;
40 this._reference = args.reference || Clipperz.PM.Crypto.randomKey();
41 this._isBrandNew = ((args.reference == null) && (args.remoteData == null));
42
43 if ((this._isBrandNew == false) && (args['retrieveKeyFunction'] == null)) {
44 Clipperz.Base.exception.raise('MandatoryParameter');
45 } else {
46 this._retrieveKeyFunction = args['retrieveKeyFunction'];
47 }
48
49 this._retrieveRemoteDataFunction = args.retrieveRemoteDataFunction|| null;
50 this._remoteData = args.remoteData || null;
51 // this._remoteData = args.remoteData ? Clipperz.Base.deepClone(args.remoteData) : null;
52 if ((!this._isBrandNew) && ((this._retrieveRemoteDataFunction == null) && (this._remoteData == null))) {
53 Clipperz.Base.exception.raise('MandatoryParameter');
54 }
55
56
57 this._encryptedDataKeypath = args.encryptedDataKeypath || 'data'; //Clipperz.Base.exception.raise('MandatoryParameter');
58 this._encryptedVersionKeypath = args.encryptedVersionKeypath || 'version';//Clipperz.Base.exception.raise('MandatoryParameter');
59
60
61 this._transientState = null;
62 this._deferredLocks = {};
63
64 if (this._isBrandNew == true) {
65 this._objectDataStore = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.objectDataStore [1]'}*/);
66 } else {
67 this._objectDataStore = null;
68 }
69
70 return this;
71}
72
73//
74 // Basic data workflow
75 //=======================
76//
77 //getRemoteData
78 // unpackRemoteData
79 // getDecryptData [encryptedDataKeypath, encryptedVersionKeypath]
80 // unpackData
81 //
82 //
83 // ?? packData
84 // ?? encryptDataWithKey
85 // ??packRemoteData [encryptedDataKeypath (?), encryptedVersionKeypath (?)]
86//
87
88Clipperz.PM.DataModel.EncryptedRemoteObject.prototype = MochiKit.Base.update(null, {
89
90 'toString': function () {
91 return "Clipperz.PM.DataModel.EncryptedRemoteObject" + (this.name() != null ? " - " + this.name() : "");
92 },
93
94 //-------------------------------------------------------------------------
95
96 'name': function () {
97 return this._name;
98 },
99
100 //-------------------------------------------------------------------------
101
102 'reference': function () {
103 return this._reference;
104 },
105
106 'setReference': function (aValue) {
107 this._reference = aValue;
108
109 return this._reference;
110 },
111
112 //-------------------------------------------------------------------------
113
114 'transientState': function () {
115 if (this._transientState == null) {
116 this._transientState = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.transientState [2]'}*/);
117 }
118
119 return this._transientState;
120 },
121
122 'resetTransientState': function (isCommitting) {
123 if (this._transientState != null) {
124 this._transientState.removeAllData();
125 }
126
127 this._transientState = null;
128 },
129
130 //-------------------------------------------------------------------------
131
132 'isBrandNew': function () {
133 return this._isBrandNew;
134 },
135
136 //-------------------------------------------------------------------------
137
138 'getKey': function () {
139 var deferredResult;
140 var deferredLock;
141
142 deferredLock = this.getDeferredLockForKey('key');
143
144 deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.getKey", {trace:false});
145 deferredResult.acquireLock(deferredLock);
146 deferredResult.addMethod(
147 this.decryptedDataStore(),
148 'deferredGetOrSet',
149 'decryptionKey',
150 MochiKit.Base.partial(this.retrieveKeyFunction(), this.reference())
151 );
152 deferredResult.releaseLock(deferredLock);
153 deferredResult.callback();
154
155 return deferredResult;
156 },
157
158 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
159
160 'retrieveKeyFunction': function () {
161 return this._retrieveKeyFunction;
162 },
163
164 'setRetrieveKeyFunction': function (aFunction) {
165 this._retrieveKeyFunction = aFunction;
166 },
167
168 //-------------------------------------------------------------------------
169
170 'hasLoadedRemoteData': function () {
171 return (this._remoteData != null);
172 },
173
174 'getRemoteData': function () {
175 var deferredResult;
176 vardeferredLock;
177
178 deferredLock = this.getDeferredLockForKey('remoteData');
179
180 deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObjects.getRemoteData", {trace:false});
181 deferredResult.acquireLock(deferredLock);
182 deferredResult.addCallback(MochiKit.Base.bind(function () {
183 var innerDeferredResult;
184
185 if (this._remoteData != null) {
186 innerDeferredResult = MochiKit.Async.succeed(this._remoteData);
187 } else {
188 innerDeferredResult = Clipperz.Async.callbacks("EncryptedRemoteObjects.getRemoteData <inner deferred>", [
189 MochiKit.Base.partial(this.retrieveRemoteDataFunction(), this.reference()),
190 MochiKit.Base.method(this, 'unpackRemoteData'),
191 MochiKit.Base.bind(function (someData) {
192 this._remoteData = someData;
193 return this._remoteData;
194 }, this)
195 ], {trace:false});
196 }
197
198 return innerDeferredResult;
199 }, this))
200 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
201 deferredResult.releaseLock(deferredLock);
202
203 deferredResult.callback();
204
205 return deferredResult;
206 },
207
208 //-------------------------------------------------------------------------
209
210 'unpackRemoteData': function (someData) {
211 return MochiKit.Async.succeed(someData);
212 },
213
214 //.........................................................................
215
216 'packRemoteData': function (someData) {
217 var result;
218
219 result = {
220 'reference':this.reference(),
221 'data': someData,
222 'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion
223 };
224
225 return MochiKit.Async.succeed(result);
226 },
227
228 //-------------------------------------------------------------------------
229
230 'retrieveRemoteDataFunction': function () {
231 return this._retrieveRemoteDataFunction;
232 },
233
234 'setRetrieveRemoteDataFunction': function (aFunction) {
235 this._retrieveRemoteDataFunction = aFunction;
236 },
237
238 //-------------------------------------------------------------------------
239
240 'decryptedDataStore': function () {
241 if (this._decryptedDataStore == null) {
242 this._decryptedDataStore = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.decryptedDataStore [3]'}*/);
243 };
244
245 return this._decryptedDataStore;
246 },
247
248 //.........................................................................
249
250 'getDecryptedData': function () {
251 var deferredResult;
252 var deferredLock;
253
254 deferredLock = this.getDeferredLockForKey('decryptedData');
255
256 deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.getDecryptedData", {trace:false});
257 deferredResult.acquireLock(deferredLock);
258 deferredResult.addMethod(this, 'decryptedDataStore');
259 deferredResult.addCallback(MochiKit.Base.methodcaller('deferredGetOrSet', 'decryptedData', MochiKit.Base.bind(function () {
260 varinnerDeferredResult;
261
262 innerDeferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.getDecryptedData <inner deferred>", {trace:false});
263
264 innerDeferredResult.addMethod(this, 'getRemoteData');
265 innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
266 innerDeferredResult.collectResults({
267 'key': MochiKit.Base.method(this, 'getKey'),
268 'value':MochiKit.Base.itemgetter(this._encryptedDataKeypath),
269 'version':MochiKit.Base.itemgetter(this._encryptedVersionKeypath)
270 });
271
272 innerDeferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt);
273 innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
274 innerDeferredResult.addMethod(this, 'unpackData');
275 innerDeferredResult.callback();
276
277 return innerDeferredResult;
278 }, this)));
279 deferredResult.releaseLock(deferredLock);
280 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
281 deferredResult.callback();
282
283 return deferredResult;
284 },
285
286 //-------------------------------------------------------------------------
287
288 'setValue': function(aKey, aValue) {
289 var deferredResult;
290
291 deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.setValue", {trace:false});
292 deferredResult.addMethod(this, '_getObjectDataStore');
293 deferredResult.addCallback(MochiKit.Base.methodcaller('setValue', aKey, aValue));
294 deferredResult.callback();
295
296 return deferredResult;
297 },
298
299 //.........................................................................
300
301 'getValue': function (aKey) {
302 return Clipperz.Async.callbacks("EncryptedRemoteObject.getValue", [
303 MochiKit.Base.method(this, '_getObjectDataStore'),
304 MochiKit.Base.methodcaller('getValue', aKey)
305 ], {trace:false});
306 },
307
308 //.........................................................................
309
310 'removeValue': function (aKey) {
311 return Clipperz.Async.callbacks("EncryptedRemoteObject.removeValue", [
312 MochiKit.Base.method(this, '_getObjectDataStore'),
313 MochiKit.Base.methodcaller('removeValue', aKey)
314 ], {trace:false});
315 },
316
317 //.........................................................................
318
319 'values': function () {
320 return Clipperz.Async.callbacks("EncryptedRemoteObject.values", [
321 MochiKit.Base.method(this, '_getObjectDataStore'),
322 MochiKit.Base.methodcaller('values')
323 ], {trace:false});
324 },
325
326 'setValues': function (someValues) {
327 return Clipperz.Async.callbacks("EncryptedRemoteObject.values", [
328 MochiKit.Base.method(this, '_getObjectDataStore'),
329 MochiKit.Base.methodcaller('setValues', someValues)
330 ], {trace:false});
331 },
332
333 //.........................................................................
334
335 '_getObjectDataStore': function () {
336 var deferredResult;
337 var deferredLock;
338
339 deferredLock = this.getDeferredLockForKey('objectDataStore');
340
341 deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject._getObjectDataStore", {trace:false});
342 deferredResult.acquireLock(deferredLock);
343 deferredResult.addCallback(MochiKit.Base.bind(function () {
344 var innerDeferredResult;
345
346 if (this._objectDataStore == null) {
347 this._objectDataStore = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.objectDataStore [4]'}*/);
348
349 innerDeferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject._getObjectDataStore <inner deferred>", {trace:false});
350 innerDeferredResult.addMethod(this, 'getDecryptedData');
351 innerDeferredResult.addMethod(this._objectDataStore, 'initWithValues');
352 innerDeferredResult.callback();
353 } else {
354 innerDeferredResult = MochiKit.Async.succeed(this._objectDataStore);
355 }
356
357 return innerDeferredResult;
358 }, this));
359 deferredResult.releaseLock(deferredLock);
360 deferredResult.callback();
361
362 return deferredResult;
363 },
364
365 'hasInitiatedObjectDataStore': function () {
366 return (this._objectDataStore != null);
367 },
368
369 //-------------------------------------------------------------------------
370
371 'getDeferredLockForKey': function (aKey) {
372 var result;
373
374 result = this._deferredLocks[aKey];
375
376 if (typeof(result) == 'undefined') {
377 result = new MochiKit.Async.DeferredLock();
378 this._deferredLocks[aKey] = result;
379 }
380
381 return result;
382 },
383
384 //-------------------------------------------------------------------------
385
386 'unpackData': function (someData) { //++
387 return someData;
388 },
389
390 'packData': function (someData) { //++
391 return someData;
392 },
393
394 //-------------------------------------------------------------------------
395
396 'hasPendingChanges': function () {
397 var deferredResult;
398 var tempObj = this;
399
400 if (this.isBrandNew()) {
401 // deferredResult = MochiKit.Async.succeed(true);
402 deferredResult = this.hasPendingChangesWhenBrandNew();
403 } else if (this.hasInitiatedObjectDataStore()) {
404 deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.hasPendingChanges", {trace:false});
405 deferredResult.collectResults({
406 'decryptedData': [
407 MochiKit.Base.method(this, 'getDecryptedData'),
408 Clipperz.Base.serializeJSON
409 ],
410 'objectData': [
411 MochiKit.Base.method(this, '_getObjectDataStore'),
412 MochiKit.Base.methodcaller('values'),
413 Clipperz.Base.serializeJSON
414 ]
415 });
416 deferredResult.addCallback(function (someValues) {
417//if (someValues['decryptedData'] != someValues['objectData']) {
418 //console.log("ORIGINAL DATA", '[[[' + someValues['decryptedData'] + ']]]');
419 //console.log("CURRENT DATA", '>>>' + someValues['objectData'] + '<<<');
420//}
421 return (someValues['decryptedData'] != someValues['objectData']);
422 });
423 deferredResult.callback();
424 } else {
425 deferredResult = MochiKit.Async.succeed(false);
426 }
427
428 return deferredResult;
429 },
430
431 'hasPendingChangesWhenBrandNew': function () {
432 return MochiKit.Async.succeed(true);
433 },
434
435 //-------------------------------------------------------------------------
436
437 'commitTransientState': function () {
438 var deferredResult;
439
440 // if (this.transientState().getValue('__prepareRemoteData') == true) {
441 if (this.transientState().getValue('packedRemoteData') != null) {
442 deferredResult = Clipperz.Async.callbacks("EncryptedRemoteObject.commitTransientState - prepareRemoteData", [
443 MochiKit.Base.bind(function (someData) {
444 this._remoteData = this.transientState().getValue('packedRemoteData');
445 }, this),
446
447 MochiKit.Base.method(this, '_getObjectDataStore'),
448 MochiKit.Base.methodcaller('values'),
449 Clipperz.Base.deepClone,
450 MochiKit.Base.method(this.decryptedDataStore(), 'setValue', 'decryptedData'),
451
452 MochiKit.Base.method(this, 'resetTransientState', true)
453 ], {trace:false});
454
455 } else {
456 deferredResult = Clipperz.Async.callbacks("EncryptedRemoteObject.commitTransientState - NO prepareRemoteData", [
457 MochiKit.Base.method(this, 'resetTransientState', true)
458 ], {trace:false});
459 }
460
461 this._isBrandNew = false;
462
463 return deferredResult;
464 },
465
466 //-------------------------------------------------------------------------
467
468 'revertChanges': function () {
469 if (this.hasInitiatedObjectDataStore()) {
470 this._objectDataStore.removeAllData();
471 this._objectDataStore = null;
472 }
473 this.resetTransientState(false);
474
475 return MochiKit.Async.succeed();
476 },
477
478 //-------------------------------------------------------------------------
479
480 'deleteAllCleanTextData': function () {
481 var deferredResult;
482
483 deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.deleteAllCleanTextData", {trace:false});
484
485 deferredResult.addMethod(this, 'resetTransientState', false);
486
487 deferredResult.acquireLock(this.getDeferredLockForKey('decryptedData'));
488 deferredResult.addCallback(MochiKit.Base.bind(function () {
489 if (this._decryptedDataStore != null) {
490 this._decryptedDataStore.removeAllData();
491 }
492 }, this));
493 deferredResult.releaseLock(this.getDeferredLockForKey('decryptedData'));
494
495 deferredResult.acquireLock(this.getDeferredLockForKey('objectDataStore'));
496 deferredResult.addCallback(MochiKit.Base.bind(function () {
497 if (this._objectDataStore != null) {
498 this._objectDataStore.removeAllData();
499 this._objectDataStore = null;
500 }
501 }, this));
502 deferredResult.releaseLock(this.getDeferredLockForKey('objectDataStore'));
503
504 deferredResult.callback();
505
506 return deferredResult;
507 },
508
509 //.........................................................................
510
511 'hasAnyCleanTextData': function () {
512 var result;
513
514 result = false;
515
516 result = result || (! this.decryptedDataStore().isEmpty());
517 result = result || (! this.transientState().isEmpty());
518 if (this.hasInitiatedObjectDataStore()) {
519 result = result || (! this._objectDataStore.isEmpty());
520 }
521
522 return MochiKit.Async.succeed(result);
523 },
524
525 //-------------------------------------------------------------------------
526
527 'prepareRemoteDataWithKey': function (aKey) {
528 return Clipperz.Async.callbacks("EncryptedRemoteObject.prepareRemoteDataWithKey", [
529 // MochiKit.Base.method(this.transientState(), 'setValue', '__prepareRemoteData', true),
530 MochiKit.Base.method(this, '_getObjectDataStore'),
531 MochiKit.Base.methodcaller('values'),
532 MochiKit.Base.method(this, 'packData'),
533 function (someData) {
534 return Clipperz.PM.Crypto.deferredEncrypt({
535 'key': aKey,
536 'value':someData,
537 'version':Clipperz.PM.Crypto.encryptingFunctions.currentVersion
538 })
539 },
540 MochiKit.Base.method(this, 'packRemoteData'),
541 MochiKit.Base.method(this.transientState(), 'setValue', 'packedRemoteData'),
542 function (someData) {
543 MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'advanceProgress');
544 return someData;
545 }
546 ], {trace:false});
547 },
548
549 //-------------------------------------------------------------------------
550 __syntaxFix__: "syntax fix"
551});
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js b/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js
new file mode 100644
index 0000000..9f1c197
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js
@@ -0,0 +1,357 @@
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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33
34//#############################################################################
35
36Clipperz.PM.DataModel.OneTimePassword = function(args) {
37 args = args || {};
38
39 //this._user = args['user'];
40 this._reference = args['reference']|| Clipperz.PM.Crypto.randomKey();
41 this._password = args['password'];
42 this._passwordValue = Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword(args['password']);
43 this._creationDate = args['created'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['created']) : new Date();
44 this._usageDate = args['used'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['used']) : null;
45
46 this._status = args['status'] || 'ACTIVE'; //'REQUESTED', 'USED', 'DISABLED'
47 this._connectionInfo= null;
48
49 this._key = null;
50 this._keyChecksum= null;
51
52 return this;
53}
54
55Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, {
56
57 'toString': function() {
58 return "Clipperz.PM.DataModel.OneTimePassword";
59 },
60/*
61 //-------------------------------------------------------------------------
62
63 'user': function() {
64 return this._user;
65 },
66
67 //-------------------------------------------------------------------------
68
69 'password': function() {
70 return this._password;
71 },
72
73 //-------------------------------------------------------------------------
74
75 'passwordValue': function() {
76 return this._passwordValue;
77 },
78
79 //-------------------------------------------------------------------------
80
81 'creationDate': function() {
82 return this._creationDate;
83 },
84
85 //-------------------------------------------------------------------------
86
87 'reference': function() {
88 return this._reference;
89 },
90
91 //-------------------------------------------------------------------------
92
93 'key': function() {
94 if (this._key == null) {
95 this._key = Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(this.user().username(), this.passwordValue());
96 }
97
98 return this._key;
99 },
100
101 //-------------------------------------------------------------------------
102
103 'keyChecksum': function() {
104 if (this._keyChecksum == null) {
105 this._keyChecksum = Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(this.user().username(), this.passwordValue());
106 }
107
108 return this._keyChecksum;
109 },
110*/
111 //-------------------------------------------------------------------------
112
113 'status': function() {
114 return this._status;
115 },
116
117 'setStatus': function(aValue) {
118 this._status = aValue;
119 },
120
121 //-------------------------------------------------------------------------
122/*
123 'serializedData': function() {
124 var result;
125
126 result = {
127 'password': this.password(),
128 'created': this.creationDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.creationDate()) : null,
129 'used': this.usageDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.usageDate()) : null,
130 'status': this.status()
131 };
132
133 return result;
134 },
135
136 //-------------------------------------------------------------------------
137
138 'packedPassphrase': function() {
139 var result;
140 var packedPassphrase;
141 var encodedPassphrase;
142 varprefixPadding;
143 var suffixPadding;
144 var getRandomBytes;
145
146 getRandomBytes = MochiKit.Base.method(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'getRandomBytes');
147
148 encodedPassphrase = new Clipperz.ByteArray(this.user().passphrase()).toBase64String();
149//MochiKit.Logging.logDebug("--- encodedPassphrase.length: " + encodedPassphrase.length);
150 prefixPadding = getRandomBytes(getRandomBytes(1).byteAtIndex(0)).toBase64String();
151//MochiKit.Logging.logDebug("--- prefixPadding.length: " + prefixPadding.length);
152 suffixPadding = getRandomBytes((500 - prefixPadding.length - encodedPassphrase.length) * 6 / 8).toBase64String();
153//MochiKit.Logging.logDebug("--- suffixPadding.length: " + suffixPadding.length);
154//MochiKit.Logging.logDebug("--- total.length: " + (prefixPadding.length + encodedPassphrase.length + suffixPadding.length));
155
156 packedPassphrase = {
157 'prefix': prefixPadding,
158 'passphrase': encodedPassphrase,
159 'suffix': suffixPadding
160 };
161
162 // result = Clipperz.Base.serializeJSON(packedPassphrase);
163 result = packedPassphrase;
164//MochiKit.Logging.logDebug("===== OTP packedPassprase: [" + result.length + "]" + result);
165//MochiKit.Logging.logDebug("<<< OneTimePassword.packedPassphrase");
166
167 return result;
168 },
169
170 //-------------------------------------------------------------------------
171
172 'encryptedPackedPassphrase': function() {
173 return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(this.passwordValue(), this.packedPassphrase())
174 },
175
176 //-------------------------------------------------------------------------
177
178 'encryptedData': function() {
179 var deferredResult;
180 varresult;
181
182//MochiKit.Logging.logDebug(">>> OneTimePassword.encryptedData");
183//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - id: " + this.reference());
184 result = {
185 'reference': this.reference(),
186 'key': this.key(),
187 'keyChecksum': this.keyChecksum(),
188 'data': "",
189 'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion
190 }
191//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 2: " + Clipperz.Base.serializeJSON(result));
192 deferredResult = new MochiKit.Async.Deferred();
193//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 3");
194//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 1: " + res); return res;});
195 //# deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion, this.passwordValue(), this.packedPassphrase());
196 deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedPackedPassphrase'));
197//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 4");
198//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 2: [" + res.length + "]" + res); return res;});
199 deferredResult.addCallback(function(aResult, res) {
200 aResult['data'] = res;
201 return aResult;
202 }, result);
203//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 5");
204//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 3: " + Clipperz.Base.serializeJSON(res)); return res;});
205 deferredResult.callback();
206//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 6");
207
208 return deferredResult;
209 },
210
211 //-------------------------------------------------------------------------
212
213 'saveChanges': function() {
214 var deferredResult;
215 varresult;
216
217//MochiKit.Logging.logDebug(">>> OneTimePassword.saveChanges");
218 result = {};
219 deferredResult = new MochiKit.Async.Deferred();
220
221 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptUserData');
222 deferredResult.addCallback(MochiKit.Base.method(this.user(), 'encryptedData'));
223 deferredResult.addCallback(function(aResult, res) {
224 aResult['user'] = res;
225 return aResult;
226 }, result);
227
228 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptOTPData');
229 deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedData'));
230 deferredResult.addCallback(function(aResult, res) {
231 aResult['oneTimePassword'] = res;
232 return aResult;
233 }, result);
234
235 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_sendingData');
236//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 1: " + Clipperz.Base.serializeJSON(res)); return res;});
237 deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'addNewOneTimePassword');
238
239 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_updatingInterface');
240//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;});
241 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'notify', 'OTPUpdated');
242 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'oneTimePassword_saveChanges_done', null);
243//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;});
244 deferredResult.callback();
245//MochiKit.Logging.logDebug("<<< OneTimePassword.saveChanges");
246
247 return deferredResult;
248 },
249
250 //-------------------------------------------------------------------------
251
252 'usageDate': function() {
253 return this._usageDate;
254 },
255
256 'setUsageDate': function(aValue) {
257 this._usageDate = aValue;
258 },
259
260 //-------------------------------------------------------------------------
261
262 'connectionInfo': function() {
263 return this._connectionInfo;
264 },
265
266 'setConnectionInfo': function(aValue) {
267 this._connectionInfo = aValue;
268 },
269
270 //-------------------------------------------------------------------------
271
272 'isExpired': function() {
273 return (this.usageDate() != null);
274 },
275
276 //-------------------------------------------------------------------------
277
278 'updateStatusWithValues': function(someValues) {
279 var result;
280
281 result = false;
282
283 if (someValues['status'] != this.status()) {
284 result = true;
285 }
286
287 this.setStatus(someValues['status']);
288 this.setUsageDate(Clipperz.PM.Date.parseDateWithUTCFormat(someValues['requestDate']));
289 this.setConnectionInfo(someValues['connection']);
290
291 return result;
292 },
293 */
294 //-------------------------------------------------------------------------
295 __syntaxFix__: "syntax fix"
296});
297
298//#############################################################################
299
300Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword = function(anUsername, aPassword) {
301 return Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aPassword)).toHexString().substring(2);
302}
303
304Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword = function(anUsername, aPassword) {
305 return Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(anUsername + aPassword)).toHexString().substring(2);
306}
307
308//=============================================================================
309
310Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue = function(aPassword) {
311 var result;
312
313 //"yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg"
314//console.log("Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue", aPassword);
315 if (aPassword.replace(/[\s\-]/g, '').length == 32) {
316 try {
317 var passwordByteArray;
318
319 passwordByteArray = new Clipperz.ByteArray();
320 passwordByteArray.appendBase32String(aPassword);
321
322 result = true;
323 } catch(exception) {
324 result = false;
325 }
326 } else {
327 result = false;
328 }
329
330 return result;
331}
332
333//=============================================================================
334
335Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword = function(aPassword) {
336 varresult;
337
338 if (aPassword.replace(/[\s\-]/g, '').length == 32) {
339 try {
340 var passwordByteArray;
341
342 passwordByteArray = new Clipperz.ByteArray();
343 passwordByteArray.appendBase32String(aPassword);
344
345 result = passwordByteArray.toBase64String();
346 } catch(exception) {
347 result = aPassword;
348 }
349 } else {
350 result = aPassword;
351 }
352
353//console.log("Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword", aPassword, result);
354 return result;
355}
356
357//#############################################################################
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js
new file mode 100644
index 0000000..147aa7d
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js
@@ -0,0 +1,167 @@
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
29try { if (typeof(Clipperz.PM.DataModel.Record.Version) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.PM.DataModel.Record.Version.Field depends on Clipperz.PM.DataModel.Record.Version!";
31}
32
33Clipperz.PM.DataModel.Record.Version.Field = function(args) {
34 Clipperz.PM.DataModel.Record.Version.Field.superclass.constructor.apply(this, arguments);
35
36 this._recordVersion = args.recordVersion|| Clipperz.Base.exception.raise('MandatoryParameter');
37 this._reference = args.reference || Clipperz.PM.Crypto.randomKey();
38
39 return this;
40}
41
42
43Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version.Field, Object, {
44
45 'toString': function() {
46 return "Record.Version.Field (" + this.reference() + ")";
47 },
48
49 //-------------------------------------------------------------------------
50
51 'recordVersion': function () {
52 return this._recordVersion;
53 },
54
55 //-------------------------------------------------------------------------
56
57 'reference': function () {
58 return this._reference;
59 },
60
61 //-------------------------------------------------------------------------
62
63 'getItem': function (aKey) {
64 return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.getItem", [
65 MochiKit.Base.method(this, 'recordVersion'),
66 MochiKit.Base.methodcaller('getValue', 'fields' + '.' + this.reference() + '.' + aKey)
67 ], {trace:false});
68 },
69
70 'setItem': function (aKey, aValue) {
71 return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.getItem", [
72 MochiKit.Base.method(this, 'recordVersion'),
73 MochiKit.Base.methodcaller('setValue', 'fields' + '.' + this.reference() + '.' + aKey, aValue)
74 ], {trace:false});
75 },
76
77 //-------------------------------------------------------------------------
78
79 'label': function () {
80 return this.getItem('label');
81 },
82
83 'setLabel': function (aValue) {
84 return this.setItem('label', aValue);
85 },
86
87 //-------------------------------------------------------------------------
88
89 'value': function () {
90 return this.getItem('value');
91 },
92
93 'setValue': function (aValue) {
94 return this.setItem('value', aValue);
95 },
96
97 //-------------------------------------------------------------------------
98
99 'actionType': function () {
100 return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.actionType", [
101 Clipperz.Async.collectResults("Clipperz.PM.DataModel.Record.Version.Field.actionType [collect results]", {
102 'isHidden':MochiKit.Base.method(this, 'isHidden'),
103 'value':MochiKit.Base.method(this, 'value')
104 }, {trace:false}),
105 function (someValues) {
106 var result; //'NONE', 'URL', 'EMAIL', 'PASSWORD'
107
108 result = 'NONE';
109
110 if (someValues['isHidden']) {
111 result = 'PASSWORD';
112 } else if (Clipperz.Base.isUrl(someValues['value'])) {
113 result = 'URL'
114 } else if (Clipperz.Base.isEmail(someValues['value'])) {
115 result = 'EMAIL'
116 };
117
118 return result;
119 }
120 ], {trace:false});
121 },
122
123 //-------------------------------------------------------------------------
124
125 'isHidden': function () {
126 return this.getItem('hidden');
127 },
128
129 'setIsHidden': function (aValue) {
130 return this.setItem('hidden', aValue);
131 },
132
133 //-------------------------------------------------------------------------
134
135 'isEmpty': function () {
136 var deferredResult;
137
138 deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.Field.isEmpty", {trace:false});
139
140 deferredResult.collectResults({
141 'label': [
142 MochiKit.Base.method(this, 'label'),
143 MochiKit.Base.partial(MochiKit.Base.operator.eq, '')
144 ],
145 'value': [
146 MochiKit.Base.method(this, 'value'),
147 MochiKit.Base.partial(MochiKit.Base.operator.eq, '')
148 ],
149 'isHidden': [
150 MochiKit.Base.method(this, 'isHidden'),
151 MochiKit.Base.partial(MochiKit.Base.operator.eq, false)
152 ]
153 });
154 deferredResult.addCallback(MochiKit.Base.values);
155 deferredResult.addCallback(function(someValues) {
156 return MochiKit.Iter.every(someValues, MochiKit.Base.operator.identity);
157 });
158 deferredResult.callback();
159
160 return deferredResult;
161 },
162
163 //-------------------------------------------------------------------------
164 __syntaxFix__: "syntax fix"
165});
166
167
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js
new file mode 100644
index 0000000..6e50f8e
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js
@@ -0,0 +1,336 @@
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
29try { if (typeof(Clipperz.PM.DataModel.Record) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.PM.DataModel.Record.Version depends on Clipperz.PM.DataModel.Record!";
31}
32
33Clipperz.PM.DataModel.Record.Version = function(args) {
34//console.log(">>> Record.new");
35 Clipperz.PM.DataModel.Record.Version.superclass.constructor.apply(this, arguments);
36
37 this._getVersionFunction = args.getVersion|| Clipperz.Base.exception.raise('MandatoryParameter');
38 this._fields = null;
39
40 return this;
41}
42
43
44Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version, Clipperz.PM.DataModel.EncryptedRemoteObject, {
45
46 'toString': function() {
47 return "Record.Version (" + this.reference() + ")";
48 },
49
50 //-------------------------------------------------------------------------
51
52 'reference': function () {
53 return this._reference;
54 },
55
56 //-------------------------------------------------------------------------
57/*
58 'hasPendingChanges': function () {
59 var deferredResult;
60
61 deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.hasPendingChanges", {trace:false});
62 deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.Version.superclass.hasPendingChanges, this));
63 deferredResult.callback();
64
65 return deferredResult;
66 },
67*/
68 //-------------------------------------------------------------------------
69
70
71 'hasPendingChangesWhenBrandNew': function () {
72 var deferredResult;
73
74 deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.hasPendingChangesWhenBrandNew", {trace:false});
75 deferredResult.addMethod(this, 'fields');
76 deferredResult.addCallback(MochiKit.Base.values);
77 deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.methodcaller('isEmpty'))
78 deferredResult.addCallback(Clipperz.Async.collectAll);
79 deferredResult.addCallback(function(someValues) {
80 return MochiKit.Iter.every(someValues, MochiKit.Base.operator.identity);
81 });
82 deferredResult.addCallback(MochiKit.Base.operator.lognot)
83 deferredResult.callback();
84
85 return deferredResult;
86 },
87
88 //=========================================================================
89
90 'commitTransientState': function () {
91 var deferredResult;
92
93 deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.commitTransientState", {trace:false});
94 deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.Version.superclass.commitTransientState, this));
95 deferredResult.callback();
96
97 return deferredResult;
98 },
99
100 //=========================================================================
101
102 'unpackData': function (someData) { //++
103 varresult;
104
105//console.log("Record.Version - UNPACK DATA", this, someData);
106 result = someData;
107 if ((someData['fields'] != null) && (someData['fields'] instanceof Array)) {
108 varfields;
109 var i,c;
110
111 fields = someData['fields'];
112 delete someData['fields'];
113
114 someData['fields'] = {};
115 c = fields.length;
116 for (i=0; i<c; i++) {
117 someData['fields'][i] = fields[i];
118 }
119 }
120
121
122
123 return result;
124 },
125
126 //=========================================================================
127
128 'fields': function () {
129 vardeferredResult;
130 var deferredLock;
131
132 deferredLock = this.getDeferredLockForKey('fields');
133
134 deferredResult = new Clipperz.Async.Deferred("Record.Version.fields", {trace:false});
135 deferredResult.acquireLock(deferredLock);
136 deferredResult.addCallback(MochiKit.Base.bind(function () {
137 var innerDeferredResult;
138
139 if (this._fields == null) {
140 innerDeferredResult = new Clipperz.Async.Deferred("Record.Version.fields <inner deferred>", {trace:false});
141 innerDeferredResult.addMethod(this, 'getValue', 'fields');
142 innerDeferredResult.addCallback(MochiKit.Base.bind(function (someObjectData) {
143 var reference;
144
145 this._fields = {};
146
147 for (reference in someObjectData) {
148 varrecordVersionField;
149
150 recordVersionField = new Clipperz.PM.DataModel.Record.Version.Field({
151 'recordVersion':this,
152 'reference': reference
153 });
154
155 this._fields[reference] = recordVersionField;
156 }
157
158 return this._fields;
159 }, this));
160 innerDeferredResult.callback();
161 } else {
162 innerDeferredResult = MochiKit.Async.succeed(this._fields);
163 }
164
165 return innerDeferredResult;
166 }, this));
167 deferredResult.releaseLock(deferredLock);
168 deferredResult.callback();
169
170 return deferredResult;
171 },
172
173 //-------------------------------------------------------------------------
174
175 'getFieldsValues': function () {
176 return this.getValue('fields');
177 },
178
179 //-------------------------------------------------------------------------
180
181 'addField': function (someParameters) {
182 varnewField;
183
184 newField = new Clipperz.PM.DataModel.Record.Version.Field({recordVersion:this});
185
186 return Clipperz.Async.callbacks("Record.Version.addField", [
187 MochiKit.Base.method(this, 'fields'),
188
189 MochiKit.Base.method(this, '_getObjectDataStore'),
190 MochiKit.Base.methodcaller('values'),
191 Clipperz.Base.serializeJSON,
192
193 MochiKit.Base.bind(function () { this._fields[newField.reference()] = newField; }, this),
194 MochiKit.Base.method(newField, 'setLabel', someParameters['label']),
195 MochiKit.Base.method(newField, 'setValue', someParameters['value']),
196 MochiKit.Base.method(newField, 'setIsHidden',someParameters['isHidden']),
197
198 MochiKit.Base.method(this, '_getObjectDataStore'),
199 MochiKit.Base.methodcaller('values'),
200 Clipperz.Base.serializeJSON,
201
202 MochiKit.Base.partial(MochiKit.Async.succeed, newField)
203 ], {trace:false});
204 },
205
206 //-------------------------------------------------------------------------
207
208 'removeField': function (aField) {
209 return Clipperz.Async.callbacks("Record.Version.removeField", [
210 MochiKit.Base.method(this, 'fields'),
211 MochiKit.Base.bind(function () { delete this._fields[aField.reference()]; }, this),
212 MochiKit.Base.method(this, 'removeValue', 'fields' + '.' + aField.reference())
213 ], {trace:false});
214 },
215
216 //-------------------------------------------------------------------------
217/*
218 'sortFieldReference': function (someSortedFieldReferences) {
219
220
221
222 },
223*/
224 //=========================================================================
225/*
226 'directLogins': function () {
227 return MochiKit.Base.values(this._directLogins);
228 },
229
230 'addDirectLogin': function (aDirectLogin) {
231 this._directLogins[aDirectLogin.reference()] = aDirectLogin;
232 },
233*/
234
235 //=========================================================================
236/*
237 'updateValues': function (anotherVersion) {
238 return Clipperz.Async.callbacks("Record.Version.updateValue", [
239 MochiKit.Base.partial(MochiKit.Async.succeed, this)
240 ], {trace:false});
241 },
242*/
243 //=========================================================================
244
245 'setRemoteData': function (aValue) {
246 this._remoteData = aValue;
247
248 return aValue;
249 },
250
251 //=========================================================================
252
253 'getVersionFunction': function () {
254 return this._getVersionFunction;
255 },
256
257 'previousVersion': function () {
258 return Clipperz.Async.callbacks("Record.Versions.previousVersion", [
259 MochiKit.Base.method(this, 'previousVersionReference'),
260 this.getVersionFunction()
261 ], {trace:false});
262 },
263
264 'previousVersionReference': function () {
265 return this.getValue('previousVersionReference');
266 },
267
268 'previousVersionKey': function () {
269 //TODO: this value i encrypted on its own. So it can not be saved in the main objectStore!!!
270 return this.getValue('previousVersionKey');
271 },
272
273 //-------------------------------------------------------------------------
274
275 'setPreviousVersionReferenceAndKey': function (aVersionObjectAndKey) {
276 // this._previousVersion = anotherVersion;
277 return Clipperz.Async.callbacks("Record.Version.setPreviousVersion", [
278 MochiKit.Base.method(this, 'setValue', 'previousVersionReference',aVersionObjectAndKey['reference']),
279 MochiKit.Base.method(this, 'setValue', 'previousVersionKey', aVersionObjectAndKey['key'])
280 ], {trace:false});
281 },
282
283 //=========================================================================
284
285 'revertChanges': function () {
286 this.setReference(this.transientState()['originalReference']);
287 Clipperz.PM.DataModel.Record.Version.superclass.revertChanges.apply(this, arguments);
288 },
289
290 //-------------------------------------------------------------------------
291
292 'prepareRemoteDataWithKey': function (aKey) {
293 var deferredResult;
294 var result;
295
296 result = {};
297
298//console.log("prepareRemoteDataWithKey", aKey);
299 deferredResult = new Clipperz.Async.Deferred("Record.Version.prepareRemoteDataWithKey", {trace:false});
300 if (this.isBrandNew() == false) {
301 this.transientState()['originalReference'] = this.reference();
302
303 deferredResult.collectResults({
304 'key':MochiKit.Base.partial(MochiKit.Async.succeed, aKey),
305 'value': MochiKit.Base.method(this, 'getKey'),
306 'version': MochiKit.Base.partial(MochiKit.Async.succeed, Clipperz.PM.Crypto.encryptingFunctions.currentVersion)
307 });
308 deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncrypt);
309 deferredResult.addCallback(Clipperz.Async.setItem, result, 'previousVersionKey');
310 } else {
311 deferredResult.addCallback(Clipperz.Async.setItem, result, 'previousVersionKey', Clipperz.PM.Crypto.nullValue);
312 }
313 deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.prepareRemoteDataWithKey, this, aKey));
314 deferredResult.addCallback(MochiKit.Base.update, result);
315 deferredResult.addMethod(this, 'setRemoteData');
316
317 deferredResult.callback();
318
319 return deferredResult;
320 },
321
322 //=========================================================================
323/*
324 'deleteAllCleanTextData': function () {
325 return Clipperz.PM.DataModel.Record.Version.superclass.deleteAllCleanTextData.apply(this, arguments);
326 },
327
328 'hasAnyCleanTextData': function () {
329 return Clipperz.PM.DataModel.Record.Version.superclass.hasAnyCleanTextData.apply(this, arguments);
330 },
331*/
332 //=========================================================================
333 __syntaxFix__: "syntax fix"
334});
335
336
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/Record.js b/frontend/gamma/js/Clipperz/PM/DataModel/Record.js
new file mode 100644
index 0000000..85dd06b
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/Record.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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33
34Clipperz.PM.DataModel.Record = function(args) {
35//console.log(">>> new Clipperz.PM.DataModel.Record", args);
36 Clipperz.PM.DataModel.Record.superclass.constructor.apply(this, arguments);
37
38 this._updateDate = (args.updateDate ? Clipperz.PM.Date.parse(args.updateDate) : Clipperz.Base.exception.raise('MandatoryParameter'));
39
40 this._retrieveIndexDataFunction = args.retrieveIndexDataFunction|| Clipperz.Base.exception.raise('MandatoryParameter');
41 this._updateIndexDataFunction = args.updateIndexDataFunction || Clipperz.Base.exception.raise('MandatoryParameter');
42
43 this._retrieveDirectLoginIndexDataFunction = args.retrieveDirectLoginIndexDataFunction|| null;
44 this._setDirectLoginIndexDataFunction = args.setDirectLoginIndexDataFunction || null;
45 this._removeDirectLoginIndexDataFunction = args.removeDirectLoginIndexDataFunction|| null;
46
47 this._createNewDirectLoginFunction = args.createNewDirectLoginFunction || null;
48
49 this._directLogins = {};
50
51 this._versions = {};
52
53 this._currentRecordVersion = null;
54 if (this.isBrandNew()) {
55 var newVersion;
56
57 this.setNotes('');
58 newVersion = new Clipperz.PM.DataModel.Record.Version({
59 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'),
60 'getVersion': MochiKit.Base.method(this, 'getVersion')
61
62 });
63 this._versions[newVersion.reference()] = newVersion;
64 this._currentVersionReference = newVersion.reference();
65 // this.setLabel('');
66 }
67
68//console.log("<<< new Clipperz.PM.DataModel.Record", args);
69
70 return this;
71}
72
73
74Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.EncryptedRemoteObject, {
75
76 'toString': function() {
77 return "Record (" + this.reference() + ")";
78 },
79
80 //-------------------------------------------------------------------------
81
82 'reference': function () {
83 return this._reference;
84 },
85
86 //=========================================================================
87
88 'getIndexData': function () {
89 return this._retrieveIndexDataFunction(this.reference());
90 },
91
92 //.........................................................................
93
94 'getIndexDataForKey': function (aKey) {
95 return Clipperz.Async.callbacks("Record.getIndexDataForKey", [
96 MochiKit.Base.method(this, 'getIndexData'),
97 MochiKit.Base.itemgetter(aKey)
98 ], {trace:false});
99 },
100
101 //-------------------------------------------------------------------------
102
103 'setIndexDataForKey': function (aKey, aValue) {
104 // return this._updateIndexDataFunction(this.reference(), aKey, aValue);
105
106 var deferredResult;
107
108 deferredResult = new Clipperz.Async.Deferred("Record.setIndexDataForKey", {trace:false});
109 deferredResult.addMethod(this, 'getIndexDataForKey', aKey);
110 deferredResult.addCallback(MochiKit.Base.bind(function (aCurrentValue) {
111 var result;
112 var originalValue;
113
114 originalValue = this.transientState().getValue('originalValues.indexData.' + aKey);
115 if (originalValue == null) {
116 originalValue = this.transientState().setValue('originalValues.indexData.' + aKey, aCurrentValue);
117 }
118
119 if (aCurrentValue != aValue) {
120 if (originalValue != aValue) {
121 this.transientState().setValue('hasPendingChanges.indexData.' + aKey, true);
122 } else {
123 this.transientState().setValue('hasPendingChanges.indexData.' + aKey, false);
124 }
125
126 result = this._updateIndexDataFunction(this.reference(), aKey, aValue);
127 } else {
128 result = MochiKit.Async.succeed(aValue);
129 }
130
131 return result;
132 }, this));
133
134 deferredResult.callback();
135
136 return deferredResult;
137 },
138
139 //=========================================================================
140/*
141 'key': function () {
142 return this.getIndexDataForKey('key');
143 },
144*/
145 //=========================================================================
146
147 'label': function () {
148 return this.getIndexDataForKey('label');
149 },
150
151 //.........................................................................
152
153 'setLabel': function (aValue) {
154 return this.setIndexDataForKey('label', aValue);
155 },
156
157 //=========================================================================
158
159 'headerNotes': function () {
160 return this.getIndexDataForKey('notes');
161 },
162
163 //-------------------------------------------------------------------------
164
165 'notes': function () {
166 return Clipperz.Async.callbacks("Record.notes", [
167 MochiKit.Base.method(this, 'headerNotes'),
168 MochiKit.Base.bind(function (someHeaderNotes) {
169 var result;
170
171 if ((someHeaderNotes == null) || (typeof(someHeaderNotes) == 'undefined')) {
172 result = this.getValue('notes');
173 } else {
174 result = MochiKit.Async.succeed(someHeaderNotes);
175 }
176
177 return result;
178 }, this)
179 ], {trace:false});
180 },
181
182 //.........................................................................
183
184 'setNotes': function (aValue) {
185 return this.setValue('notes', aValue);
186 },
187
188 //=========================================================================
189
190 'updateDate': function () {
191 return MochiKit.Async.succeed(this._updateDate);
192 },
193
194 //=========================================================================
195
196 'favicon': function () {
197 var result;
198 var directLogins;
199
200 directLogins = MochiKit.Base.values(this.directLogins());
201 if (directLogins.length > 0) {
202 result = directLogins[0].favicon();
203 // } else if (/* is there an URL to use for searching a favicon */){
204 } else {
205 result = null; //MochiKit.Async.succeed(Clipperz.PM.Strings['defaultFaviconUrl']);
206 }
207
208 return result;
209 },
210
211 //-------------------------------------------------------------------------
212
213 'searchableContent': function () {
214 var deferredResult;
215
216//console.log(">>> searchableContent");
217 deferredResult = new Clipperz.Async.Deferred("Record.searchableContent", {trace:false});
218
219 deferredResult.collectResults({
220 'recordLabel': MochiKit.Base.method(this, 'label'),
221 'directLoginLabels': [
222 MochiKit.Base.method(this, 'directLoginReferences'),
223 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.itemgetter('label'))
224 ]
225 })
226 deferredResult.addCallback(function (someValues) {
227 return someValues['recordLabel'] + ' ' + someValues['directLoginLabels'].join(' ');
228 });
229 deferredResult.callback();
230//console.log("<<< searchableContent");
231
232 return deferredResult;
233 },
234
235 //-------------------------------------------------------------------------
236
237 'isMatching': function (aRegExp) {
238 return Clipperz.Async.callbacks("deferredFilterFunction", [
239 MochiKit.Base.method(this, 'searchableContent'),
240 MochiKit.Base.method(aRegExp, 'test'),
241 function (doesItMatch) {
242 var result;
243
244 if (doesItMatch) {
245 result = MochiKit.Async.succeed('match');
246 } else {
247 result = MochiKit.Async.fail('miss');
248 }
249
250 return result;
251 }
252 ], {trace:false});
253 },
254
255 //=========================================================================
256
257 'directLogins': function () {
258 return this._directLogins;
259 },
260
261 'addDirectLogin': function (aDirectLogin) {
262 this._directLogins[aDirectLogin.reference()] = aDirectLogin;
263 },
264
265 'directLoginWithReference': function (aDirectLoginReference) {
266 return this._directLogins[aDirectLoginReference];
267 },
268
269 'createNewDirectLoginFunction': function () {
270 return this._createNewDirectLoginFunction;
271 },
272
273 'saveOriginalDirectLoginStatusToTransientState': function () {
274 if (this.transientState().getValue('directLogins') == null) {
275 // this.transientState().setValue('directLogins', this._directLogins)
276//console.log("SET TRANSIENT STATE", Clipperz.Base.serializeJSON(MochiKit.Base.keys(this.transientState().getValue('directLogins'))))
277 MochiKit.Iter.forEach(MochiKit.Base.keys(this._directLogins), MochiKit.Base.bind(function(aKey) {
278 this.transientState().setValue('directLogins' + '.' + aKey, this._directLogins[aKey])
279 }, this))
280 }
281 },
282
283 'createNewDirectLogin': function () {
284 this.saveOriginalDirectLoginStatusToTransientState();
285
286 return this.createNewDirectLoginFunction()(this);
287 },
288
289 'removeDirectLogin': function(aDirectLogin) {
290 this.saveOriginalDirectLoginStatusToTransientState();
291
292 return Clipperz.Async.callbacks("Record.removeDirectLogin", [
293 MochiKit.Base.method(this, 'removeValue', 'directLogins' + '.' + aDirectLogin.reference()),
294 MochiKit.Base.bind(function () {
295 delete this._directLogins[aDirectLogin.reference()]
296 }, this)
297 ], {trace:false});
298
299 },
300
301 'directLoginReferences': function () {
302 var result;
303
304 result = Clipperz.Async.callbacks("Record.directLoginReferences", [
305 MochiKit.Base.method(this, 'directLogins'),
306 MochiKit.Base.values,
307 function (someDirectLogins) {
308 var result;
309 var i,c;
310
311 result = [];
312 c = someDirectLogins.length;
313 for (i=0; i<c; i++) {
314 result.push(Clipperz.Async.collectResults("Record.directLoginReferences - collectResults", {
315 '_rowObject': MochiKit.Async.succeed,
316 '_reference': MochiKit.Base.methodcaller('reference'),
317 'label': MochiKit.Base.methodcaller('label'),
318 'favicon': MochiKit.Base.methodcaller('favicon')
319 }, {trace:false})(someDirectLogins[i]));
320 };
321
322 return result;
323 },
324 Clipperz.Async.collectAll
325 ], {trace:false});
326
327 return result;
328 },
329
330 //=========================================================================
331
332 'unpackRemoteData': function (someData) {
333 var result;
334
335//console.log("new Clipperz.PM.DataModel.Record.Version [2]");
336/*
337 this._currentRecordVersion = new Clipperz.PM.DataModel.Record.Version({
338 'reference': someData['currentVersion']['reference'],
339 'retrieveKeyFunction': MochiKit.Base.method(this, 'getCurrentRecordVersionKey'),
340 'remoteData': someData['currentVersion'],
341 });
342*/
343 var versionKey;
344
345 for (versionKey in someData['versions']) {
346//console.log("### versionKey", versionKey);
347 this._versions[versionKey] = new Clipperz.PM.DataModel.Record.Version({
348 'reference': versionKey,
349 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'),
350 'remoteData': someData['versions'][versionKey],
351 'getVersion': MochiKit.Base.method(this, 'getVersion')
352 })
353 }
354
355 // this._currentVersionReference = someData['currentVersion']['reference'];
356 this._currentVersionReference = someData['currentVersion'];
357//console.log("=== currentVersionReference", this._currentVersionReference, someData);
358
359 result = Clipperz.PM.DataModel.Record.superclass.unpackRemoteData.apply(this, arguments);
360
361 return result;
362 },
363
364 //-------------------------------------------------------------------------
365
366 'unpackData': function (someData) {
367 var result;
368
369 result = Clipperz.PM.DataModel.Record.superclass.unpackData.apply(this, arguments);
370
371 if (MochiKit.Base.isUndefinedOrNull(result['notes'])) {
372 result['notes'] = ''
373 }
374
375 return result;
376 },
377
378 //-------------------------------------------------------------------------
379
380 'prepareRemoteDataWithKey': function (aKey) {
381 var deferredResult;
382 varnewVersionKey;
383 var result;
384
385 newVersionKey = Clipperz.PM.Crypto.randomKey();
386 result = {};
387
388 deferredResult = new Clipperz.Async.Deferred("Record.prepareRemoteDataWithKey", {trace:false});
389 deferredResult.addCallbackList([
390 Clipperz.Async.collectResults("Record.prepareRemoteDataWithKey - collect results", {
391 'isBrandNew': MochiKit.Base.method(this, 'isBrandNew'),
392 'versionHasPendingChanges':[
393 // MochiKit.Base.method(this, 'getCurrentRecordVersion'),
394 // MochiKit.Base.methodcaller('hasPendingChanges')
395 MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'hasPendingChanges')
396 ]
397 }),
398 Clipperz.Async.or,
399
400 Clipperz.Async.deferredIf("Current Version has pending changes", [
401 MochiKit.Base.method(this, 'createNewRecordVersion'),
402 MochiKit.Base.methodcaller('prepareRemoteDataWithKey', newVersionKey),
403 MochiKit.Base.partial(Clipperz.Async.setItem, result, 'currentRecordVersion'),
404 MochiKit.Base.method(this, 'setCurrentRecordVersionKey', newVersionKey)
405 ], []),
406
407 MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.prepareRemoteDataWithKey, this, aKey),
408 MochiKit.Base.partial(Clipperz.Async.setItem, result, 'record'),
409
410 MochiKit.Base.partial(MochiKit.Async.succeed, result)
411 ]);
412
413 deferredResult.callback();
414
415 return deferredResult;
416 },
417
418 //=========================================================================
419
420 'fields': function () {
421 return this.invokeCurrentRecordVersionMethod('fields');
422 },
423
424 'addField': function (someParameters) {
425 return this.invokeCurrentRecordVersionMethod('addField', someParameters);
426 },
427
428 'removeField': function (someParameters) {
429 return this.invokeCurrentRecordVersionMethod('removeField', someParameters);
430 },
431
432 //'sortFieldReference': function (someSortedFieldReferences) {
433 // return this.invokeCurrentRecordVersionMethod('sortFieldReference', someSortedFieldReferences);
434 //},
435
436 'getFieldsValues': function () {
437 return this.invokeCurrentRecordVersionMethod('getFieldsValues');
438 },
439
440 'fieldWithLabel': function (aLabel) {
441 return Clipperz.Async.callbacks("Record.fieldWithLabel", [
442 MochiKit.Base.method(this, 'fields'),
443 MochiKit.Base.values,
444 MochiKit.Base.partial(Clipperz.Async.deferredFilter, function (aField) {
445 return Clipperz.Async.callbacks("Record.fieldWithLabel - check field label", [
446 MochiKit.Base.methodcaller('label'),
447 MochiKit.Base.partial(MochiKit.Base.operator.eq, aLabel)
448 ], {trace:false}, aField);
449 }),
450 function (someFilteredResults) {
451 var result;
452
453 switch (someFilteredResults.length) {
454 case 0:
455 result = null;
456 break;
457 case 1:
458 result = someFilteredResults[0];
459 break;
460 default:
461 WTF = TODO;
462 break;
463 }
464
465 return result;
466 }
467 ], {trace:false});
468 },
469
470 //=========================================================================
471
472 'getVersion': function (aVersionReference) {
473 return Clipperz.Async.callbacks("Record.getVersion", [
474 MochiKit.Base.method(this, 'getVersions'),
475 MochiKit.Base.itemgetter(aVersionReference)
476 ], {trace:false});
477 },
478
479 //-------------------------------------------------------------------------
480
481 'getVersionKey': function (aVersionReference) {
482 vardeferredResult;
483 var transientStateKey;
484
485 transientStateKey = 'versionKeys' + '.' + aVersionReference;
486 if (this.transientState().getValue(transientStateKey) != null) {
487 deferredResult = MochiKit.Async.succeed(this.transientState().getValue(transientStateKey));
488 } else {
489 deferredResult = Clipperz.Async.callbacks("Record.getVersionKey", [
490 MochiKit.Base.method(this, 'getVersions'),
491 MochiKit.Base.partial(MochiKit.Base.operator.eq, aVersionReference, this.currentVersionReference()),
492 Clipperz.Async.deferredIf("getVersionKey for current version", [
493 MochiKit.Base.method(this, 'getCurrentRecordVersionKey'),
494 MochiKit.Base.method(this.transientState(), 'setValue', transientStateKey)
495 ],[
496 MochiKit.Async.fail
497 ])
498 ], {trace:false});
499 }
500
501 return deferredResult;
502 },
503
504 //-------------------------------------------------------------------------
505
506 'versions': function () {
507 return this._versions;
508 },
509
510 'getVersions': function () {
511 return Clipperz.Async.callbacks("Record.versions", [
512 MochiKit.Base.method(this, 'getValue', 'fakeKey, just to trigger unpackRemoteData'),
513 MochiKit.Base.bind(function () { return this._versions; }, this)
514 ], {trace:false});
515 },
516
517 //-------------------------------------------------------------------------
518
519 'getCurrentRecordVersion': function () {
520 return Clipperz.Async.callbacks("Record.getCurrentRecordVersion", [
521 // MochiKit.Base.method(this, 'getValue', 'fakeKey, just to trigger unpackRemoteData'),
522 // MochiKit.Base.bind(function () { return this._currentRecordVersion; }, this)
523
524 MochiKit.Base.method(this, 'versions'),
525 MochiKit.Base.itemgetter(this.currentVersionReference()),
526 Clipperz.Async.deferredIf("The current version is available", [
527 MochiKit.Async.succeed
528 ], [
529 MochiKit.Base.method(this, 'getVersions'),
530 MochiKit.Base.bind(function (someVersions) { return someVersions[this.currentVersionReference()]}, this)
531 ])
532 ], {trace:false});
533 },
534
535 'setCurrentRecordVersion': function (aRecordVersion) {
536 this._currentVersionReference = aRecordVersion.reference();
537 },
538
539 //.........................................................................
540
541 'currentVersionReference': function () {
542//console.log("currentVersionReference");
543 return this._currentVersionReference;
544 },
545
546 //-------------------------------------------------------------------------
547
548 'createNewRecordVersion': function () {
549 var deferredResult;
550
551 if (this.isBrandNew()) {
552 deferredResult = this.getCurrentRecordVersion();
553 } else {
554 var newVersion;
555
556 newVersion = new Clipperz.PM.DataModel.Record.Version({
557 // 'reference': versionKey,
558 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'),
559 // 'remoteData': {},
560 'getVersion': MochiKit.Base.method(this, 'getVersion')
561 })
562 this._versions[newVersion.reference()] = newVersion;
563
564 deferredResult = Clipperz.Async.callbacks("Record.createNewRecordVersion", [
565 // MochiKit.Base.method(this, 'getCurrentRecordVersion'),
566 // MochiKit.Base.methodcaller('values'),
567 MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'values'),
568 MochiKit.Base.method(newVersion, 'setValues'),
569
570 Clipperz.Async.collectResults("Record.createNewRecordVersion [collect results]", {
571 'reference':MochiKit.Base.method(this, 'currentVersionReference'),
572 'key': MochiKit.Base.method(this, 'getCurrentRecordVersionKey')
573 }, {trace:false}),
574 MochiKit.Base.method(newVersion, 'setPreviousVersionReferenceAndKey'),
575
576 // MochiKit.Base.method(this, 'getCurrentRecordVersion'),
577 // MochiKit.Base.method(this, 'revertChanges'),
578 MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'revertChanges'),
579
580 MochiKit.Base.method(this, 'setCurrentRecordVersion', newVersion),
581 MochiKit.Base.partial(MochiKit.Async.succeed, newVersion)
582 ], {trace:false});
583 }
584
585 return deferredResult;
586 },
587
588 //-------------------------------------------------------------------------
589
590 'getCurrentRecordVersionKey': function () {
591//console.log("getCurrentRecordVersionKey");
592 return Clipperz.Async.callbacks("Record.getCurrentRecordVersionKey", [
593 MochiKit.Base.method(this, 'getValue', 'currentVersionKey'),
594 Clipperz.Async.deferredIf("currentVersionKey is NOT null", [
595 MochiKit.Async.succeed
596 ], [
597 MochiKit.Base.method(this, 'getKey')
598 ])
599 ], {trace:false});
600 },
601
602 'setCurrentRecordVersionKey': function (aValue) {
603 //TODO: triple check this method!
604 return Clipperz.Async.callbacks("Record.setCurrentRecordVersionKey", [
605 MochiKit.Base.method(this, 'setValue', 'currentVersionKey', aValue)
606 ], {trace:false});
607 },
608
609 //-------------------------------------------------------------------------
610
611 'invokeCurrentRecordVersionMethod': function (aMethodName, someValues) {
612//console.log(">>> invokeCurrentRecordVersionMethod", aMethodName);
613 return Clipperz.Async.callbacks("Record.invokeCurrentRecordVersionMethod", [
614 MochiKit.Base.method(this, 'getCurrentRecordVersion'),
615//function (aValue) { console.log("=== getCurrentRecordVersion", aValue); return aValue},
616 MochiKit.Base.methodcaller(aMethodName, someValues)
617 ], {trace:false});
618 },
619
620
621 'lazilyinvokeCurrentRecordVersionMethod': function (aMethodName, someValues, defaultResult) {
622 return Clipperz.Async.callbacks("Record.lazilyinvokeCurrentRecordVersionMethod", [
623 MochiKit.Base.method(this, 'currentVersionReference'),
624//function (aValue) { console.log("LAZY -> versions", aValue); return aValue; },
625 Clipperz.Async.deferredIf("versions has been loaded", [
626//function (aValue) { console.log("LAZY -> then"); return aValue; },
627 MochiKit.Base.method(this, 'getCurrentRecordVersion'),
628 MochiKit.Base.methodcaller(aMethodName, someValues),
629//function (aValue) { console.log("LAZY <- then"); return aValue; }
630 ], [
631//function (aValue) { console.log("LAZY -> else"); return aValue; },
632 MochiKit.Base.partial(MochiKit.Async.succeed, defaultResult),
633//function (aValue) { console.log("LAZY <- else"); return aValue; }
634 ])
635 ], {trace:false});
636 },
637
638 //=========================================================================
639
640 'hasPendingChanges': function () {
641 var deferredResult;
642
643 if (this.hasInitiatedObjectDataStore()) {
644 deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.hasPendingChanges", {trace:false});
645 deferredResult.collectResults({
646 'super': MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.hasPendingChanges, this),
647 'currentVersion': [
648 // MochiKit.Base.method(this, 'getCurrentRecordVersion'),
649 // MochiKit.Base.methodcaller('hasPendingChanges')
650 MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'hasPendingChanges')
651 ],
652 'directLogins': [
653 MochiKit.Base.method(this, 'directLogins'),
654//function (aValue) { console.log("Record.directLogins", aValue); return aValue; },
655 MochiKit.Base.values,
656 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasPendingChanges')),
657 Clipperz.Async.collectAll,
658 Clipperz.Async.or
659 // function(someValues) {
660 // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity);
661 // }
662 ]
663 });
664//deferredResult.addCallback(function (aValue) { console.log("Record.hasPendingResults", aValue); return aValue; });
665 deferredResult.addCallback(MochiKit.Base.values);
666 deferredResult.addCallback(MochiKit.Base.bind(function(someValues) {
667 var result;
668 result = MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity);
669
670 if ((result == false) && (this.isBrandNew() == false)) {
671 result = MochiKit.Iter.some(MochiKit.Base.values(this.transientState().getValue('hasPendingChanges.indexData')), MochiKit.Base.operator.identity);
672 }
673
674 return result;
675 }, this));
676
677 deferredResult.callback();
678 } else {
679 deferredResult = Clipperz.Async.callbacks("Recrod.hasPendingChanges [hasInitiatedObjectDataStore == false]", [
680 MochiKit.Base.method(this, 'directLogins'),
681 MochiKit.Base.values,
682 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasPendingChanges')),
683 Clipperz.Async.collectAll,
684 Clipperz.Async.or
685 // function(someValues) {
686 // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity);
687 // }
688 ], {trace:false})
689 }
690
691 return deferredResult;
692 },
693
694 //-------------------------------------------------------------------------
695
696 'hasPendingChangesWhenBrandNew': function () {
697 var deferredResult;
698
699 deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.hasPendingChangesWhenBrandNew", {trace:false});
700 deferredResult.collectResults({
701 'label': [
702 MochiKit.Base.method(this, 'label'),
703 MochiKit.Base.partial(MochiKit.Base.operator.ne, '')
704 ],
705 'notes': [
706 MochiKit.Base.method(this, 'notes'),
707 MochiKit.Base.partial(MochiKit.Base.operator.ne, '')
708 ]
709 });
710 // deferredResult.addCallback(MochiKit.Base.values);
711 // deferredResult.addCallback(function(someValues) {
712 // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity);
713 // });
714 deferredResult.addCallback(Clipperz.Async.or);
715
716 deferredResult.callback();
717
718 return deferredResult;
719 },
720
721 //-------------------------------------------------------------------------
722
723 'isBrandNewWithNoPendingChanges': function () {
724 vardeferredResult;
725
726 if (this.isBrandNew() == false) {
727 deferredResult = MochiKit.Async.succeed(false);
728 } else {
729 deferredResult = Clipperz.Async.callbacks("Record.isBrandNewWithNoPendingChanges", [
730 MochiKit.Base.method(this, 'hasPendingChanges'),
731 MochiKit.Base.operator.lognot
732 ], {trace:false});
733 }
734
735 return deferredResult;
736 },
737
738 //=========================================================================
739
740 'revertChanges': function () {
741 var deferredResult;
742
743 if (this.isBrandNew() == false) {
744 deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.revertChanges", {trace:false});
745 deferredResult.addMethod(this, 'hasPendingChanges');
746 deferredResult.addIf([
747 // MochiKit.Base.method(this, 'getCurrentRecordVersion'),
748 // MochiKit.Base.methodcaller('revertChanges'),
749 MochiKit.Base.method(this,'invokeCurrentRecordVersionMethod', 'revertChanges'),
750
751 MochiKit.Base.method(this, 'directLogins'),
752 MochiKit.Base.values,
753 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('revertChanges')),
754
755 MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.revertChanges, this)
756 ], [
757 MochiKit.Async.succeed
758 ]);
759 deferredResult.callback();
760 } else {
761 // this.deleteAllCleanTextData();
762 deferredResult = MochiKit.Async.succeed();
763 }
764
765 return deferredResult;
766 },
767
768 //-------------------------------------------------------------------------
769
770 'resetTransientState': function (isCommitting) {
771 // if ((isCommitting == false) && (this.transientState().getValue('directLogins') != null)) {
772 // this._directLogins = this.transientState().getValue('directLogins');
773 // }
774
775 return Clipperz.Async.callbacks("Record.resetTransientState", [
776 //- MochiKit.Base.method(this, 'getCurrentRecordVersion'),
777 //- MochiKit.Base.methodcaller('resetTransientState'),
778 // MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'resetTransientState'),
779 MochiKit.Base.method(this, 'lazilyinvokeCurrentRecordVersionMethod', 'resetTransientState'),
780
781 MochiKit.Base.method(this, 'directLogins'),
782//function (aValue) { console.log("resetTransientState - directLogins", aValue); return aValue; },
783 MochiKit.Base.values,
784 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('resetTransientState')),
785
786 MochiKit.Base.bind(function () {
787 if ((isCommitting == false) && (this.transientState().getValue('directLogins') != null)) {
788 this._directLogins = this.transientState().getValue('directLogins');
789 }
790 }, this),
791
792 MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.resetTransientState, this, isCommitting)
793 ], {trace:false})
794 },
795
796 //-------------------------------------------------------------------------
797
798 'commitTransientState': function () {
799 var deferredResult;
800
801 deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.commitTransientState", {trace:false});
802 deferredResult.addMethod(this, 'hasPendingChanges');
803 deferredResult.addIf([
804 MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.commitTransientState, this),
805 // MochiKit.Base.method(this, 'getCurrentRecordVersion'),
806 // MochiKit.Base.methodcaller('commitTransientState'),
807 MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'commitTransientState'),
808 MochiKit.Base.method(this, 'directLogins'),
809 MochiKit.Base.values,
810 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('commitTransientState'))
811 ], [
812 MochiKit.Async.succeed
813 ]);
814 deferredResult.callback();
815
816 return deferredResult;
817 },
818
819 //=========================================================================
820
821 'retrieveDirectLoginIndexDataFunction': function () {
822//console.log("Record.retrieveDirectLoginIndexDataFunction", this._retrieveDirectLoginIndexDataFunction);
823 return this._retrieveDirectLoginIndexDataFunction;
824 },
825
826 'setDirectLoginIndexDataFunction': function () {
827 return this._setDirectLoginIndexDataFunction;
828 },
829
830 'removeDirectLoginIndexDataFunction': function () {
831 return this._removeDirectLoginIndexDataFunction;
832 },
833
834 //=========================================================================
835
836 'deleteAllCleanTextData': function () {
837 // return Clipperz.PM.DataModel.Record.superclass.deleteAllCleanTextData.apply(this, arguments);
838
839 return Clipperz.Async.callbacks("Record.deleteAllCleanTextData", [
840 MochiKit.Base.method(this, 'versions'),
841 MochiKit.Base.values,
842 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('deleteAllCleanTextData')),
843
844 MochiKit.Base.method(this, 'directLogins'),
845 MochiKit.Base.values,
846 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('deleteAllCleanTextData')),
847
848 MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.deleteAllCleanTextData, this)
849 ], {trace:false});
850 },
851
852 'hasAnyCleanTextData': function () {
853 // return Clipperz.PM.DataModel.Record.superclass.hasAnyCleanTextData.apply(this, arguments);
854
855 return Clipperz.Async.callbacks("Record.hasAnyCleanTextData", [
856 Clipperz.Async.collectResults("Record.hasAnyCleanTextData [collect results]", {
857 'versions':[
858 MochiKit.Base.method(this, 'versions'),
859 MochiKit.Base.values,
860 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasAnyCleanTextData')),
861 Clipperz.Async.collectAll
862 ],
863 'directLogins': [
864 MochiKit.Base.method(this, 'directLogins'),
865 MochiKit.Base.values,
866 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasAnyCleanTextData')),
867 Clipperz.Async.collectAll
868 ],
869 'super': [
870 MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.hasAnyCleanTextData, this)
871 ]
872 }, {trace:false}),
873 Clipperz.Async.or
874 ])
875 },
876
877 //=========================================================================
878 __syntaxFix__: "syntax fix"
879});
880
881
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js
new file mode 100644
index 0000000..e675525
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js
@@ -0,0 +1,187 @@
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
29try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.PM.DataModel.User.Header.Legacy depends on Clipperz.PM.DataModel.User!";
31}
32
33if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; }
34
35Clipperz.PM.DataModel.User.Header.Legacy = function(args) {
36 //args = args || {};
37 Clipperz.PM.DataModel.User.Header.Legacy.superclass.constructor.apply(this, arguments);
38
39 this._retrieveRecordDetailFunction = args.retrieveRecordDetailFunction|| Clipperz.Base.exception.raise('MandatoryParameter');
40 this._records = null;
41 //this._directLogins = null;
42
43 return this;
44}
45
46
47Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.Legacy, Clipperz.PM.DataModel.EncryptedRemoteObject, {
48
49 'toString': function() {
50 return "Clipperz.PM.DataModel.User.Header.Legacy";
51 },
52
53 //-------------------------------------------------------------------------
54
55 'retrieveRecordDetailFunction': function () {
56 return this._retrieveRecordDetailFunction;
57 },
58
59 //-------------------------------------------------------------------------
60
61 'getRecordKey': function (aRecordReference) {
62 var deferredResult;
63
64 deferredResult = new Clipperz.Async.Deferred("User.Header.Legacy.getRecordKey", {trace:false});
65 deferredResult.addMethod(this, 'getRecordIndexData');
66 deferredResult.addCallback(MochiKit.Base.itemgetter('key'))
67 deferredResult.callback();
68
69 return deferredResult;
70 },
71
72 //=========================================================================
73
74 'getRecordIndexData': function (aRecordReference) {
75 return this.getValue('records.' + aRecordReference);
76 },
77
78 'updateRecordIndexData': function (aRecordReference, aKey, aValue) {
79 return this.setValue('records.' + aRecordReference + "." + aKey, aValue);
80 },
81
82 //-------------------------------------------------------------------------
83
84 'getDirectLoginIndexData': function (aDirectLoginReference) {
85 return this.getValue('directLogins.' + aDirectLoginReference);
86 },
87
88 'setDirectLoginIndexData': function (aDirectLoginReference, aKey, aValue) {
89 return this.setValue('directLogins.' + aDirectLoginReference + '.' + aKey, aValue);
90 },
91
92 'removeDirectLoginIndexData': function (aDirectLoginReference) {
93 return this.removeValue('directLogins.' + aDirectLoginReference);
94 },
95
96 //=========================================================================
97
98 'records': function () {
99 vardeferredResult;
100 var deferredLock;
101
102 deferredLock = this.getDeferredLockForKey('records');
103
104 deferredResult = new Clipperz.Async.Deferred("User.Header.Legacy.records", {trace:false});
105 deferredResult.acquireLock(deferredLock);
106 deferredResult.addCallback(MochiKit.Base.bind(function () {
107 var innerDeferredResult;
108
109 if (this._records == null) {
110 innerDeferredResult = new Clipperz.Async.Deferred("User.Header.Legacy.records <inner deferred>", {trace:false});
111 innerDeferredResult.collectResults({
112 'header': [
113 // MochiKit.Base.method(this, 'getObjectDataStore'),
114 // MochiKit.Base.methodcaller('values')
115 MochiKit.Base.method(this, 'values')
116 ],
117 'recordsStats': [
118 MochiKit.Base.method(this, 'getRemoteData'),
119 MochiKit.Base.itemgetter('recordsStats')
120 ]
121 });
122 innerDeferredResult.addCallback(MochiKit.Base.bind(function (someObjectData) {
123 var reference;
124
125 this._records = {};
126 // this._directLogins = {};
127
128 for (reference in someObjectData['header']['records']) {
129 varrecord;
130
131 record = new Clipperz.PM.DataModel.Record({
132 'reference': reference,
133 'retrieveKeyFunction': MochiKit.Base.method(this, 'getRecordKey'),
134 'retrieveRemoteDataFunction':this.retrieveRecordDetailFunction(),
135 // 'encryptedDataKeypath': 'data',
136 // 'encryptedVersionKeypath': 'version',
137
138 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getRecordIndexData'),
139 'updateIndexDataFunction': MochiKit.Base.method(this, 'updateRecordIndexData'),
140 'updateDate': someObjectData['recordsStats'][reference]['updateDate'],
141
142 'retrieveDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'),
143 'setDirectLoginIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'),
144 'removeDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'removeDirectLoginIndexData')
145 });
146
147 this._records[reference] = record;
148 }
149
150 for (reference in someObjectData['header']['directLogins']) {
151 vardirectLogin;
152 var record;
153
154 record = this._records[someObjectData['header']['directLogins'][reference]['record']];
155 if (record != null) {
156 directLogin = new Clipperz.PM.DataModel.DirectLogin({
157 'reference': reference,
158 'record': record//,
159 // 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'),
160 // 'setIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'),
161 // 'removeIndexDataFunction': MochiKit.Base.method(this, 'removeDirectLoginIndexData')
162 });
163 } else {
164Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!");
165 }
166 }
167
168 return this._records;
169 }, this));
170 innerDeferredResult.callback();
171 } else {
172 innerDeferredResult = MochiKit.Async.succeed(this._records);
173 }
174
175 return innerDeferredResult;
176 }, this));
177 deferredResult.releaseLock(deferredLock);
178 deferredResult.callback();
179
180 return deferredResult;
181 },
182
183 //=========================================================================
184 __syntaxFix__: "syntax fix"
185});
186
187
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js
new file mode 100644
index 0000000..0ee8599
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js
@@ -0,0 +1,128 @@
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
29try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.PM.DataModel.User.Header.OneTimePasswords depends on Clipperz.PM.DataModel.User!";
31}
32if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; }
33
34//-----------------------------------------------------------------------------
35
36Clipperz.PM.DataModel.User.Header.OneTimePasswords = function(args) {
37 Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.constructor.apply(this, arguments);
38
39 this._oneTimePasswords = null;
40
41 return this;
42}
43
44//-----------------------------------------------------------------------------
45
46Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.OneTimePasswords, Clipperz.PM.DataModel.EncryptedRemoteObject, {
47
48 'toString': function() {
49 return "Clipperz.PM.DataModel.User.Header.OneTimePasswords";
50 },
51
52 //-------------------------------------------------------------------------
53/*
54 'packData': function (someData) { //++
55 var result;
56
57console.log(">>> OneTimePasswords.packData", someData);
58 result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packData.apply(this, arguments);
59console.log("<<< OneTimePasswords.packData");
60
61 return result;
62 },
63*/
64 //-------------------------------------------------------------------------
65/*
66 'packRemoteData': function (someData) {
67 var result;
68
69console.log(">>> OneTimePasswords.packRemoteData", someData);
70 result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packRemoteData.apply(this, arguments);
71console.log("<<< OneTimePasswords.packRemoteData");
72
73 return result;
74 },
75*/
76 //-------------------------------------------------------------------------
77/*
78 'prepareRemoteDataWithKey': function (aKey) {
79 var result;
80
81console.log(">>> OneTimePasswords.prepareRemoteDataWithKey");
82 result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.prepareRemoteDataWithKey.apply(this, arguments);
83console.log("<<< OneTimePasswords.prepareRemoteDataWithKey");
84
85 return result;
86 },
87*/
88 //=========================================================================
89
90 'oneTimePasswords': function () {
91 vardeferredResult;
92
93 deferredResult = new Clipperz.Async.Deferred("User.Header.OneTimePasswords.oneTimePasswords", {trace:false});
94 if (this._oneTimePasswords == null) {
95 deferredResult.addMethod(this, 'values')
96 deferredResult.addCallback(MochiKit.Base.bind(function (someData) {
97 varotpKey;
98
99 this._oneTimePasswords = {};
100
101 for (otpKey in someData) {
102 var otp;
103 var otpParameters;
104
105 otpParameters = Clipperz.Base.deepClone(someData[otpKey]);
106 otpParameters['reference'] = otpKey;
107
108 otp = new Clipperz.PM.DataModel.OneTimePassword(otpParameters);
109 this._oneTimePasswords[otpKey] = otp;
110 }
111
112 return this._oneTimePasswords;
113
114 }, this));
115 deferredResult.callback();
116 } else {
117 deferredResult = MochiKit.Async.succeed(this._oneTimePasswords);
118 }
119
120 return deferredResult;
121 },
122
123 //=========================================================================
124 __syntaxFix__: "syntax fix"
125});
126
127//-----------------------------------------------------------------------------
128
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js
new file mode 100644
index 0000000..91b981e
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.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
29try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.PM.DataModel.User.Header.Preferences depends on Clipperz.PM.DataModel.User!";
31}
32
33if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; }
34
35Clipperz.PM.DataModel.User.Header.Preferences = function(args) {
36 Clipperz.PM.DataModel.User.Header.Preferences.superclass.constructor.apply(this, arguments);
37
38 return this;
39}
40
41
42Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.Preferences, Clipperz.PM.DataModel.EncryptedRemoteObject, {
43
44 'toString': function() {
45 return "Clipperz.PM.DataModel.User.Header.Preferences";
46 },
47
48 //-------------------------------------------------------------------------
49 //=========================================================================
50 __syntaxFix__: "syntax fix"
51});
52
53
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js
new file mode 100644
index 0000000..6ba58a8
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js
@@ -0,0 +1,705 @@
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
29try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.PM.DataModel.User.Header.RecordIndex depends on Clipperz.PM.DataModel.User!";
31}
32
33if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; }
34
35Clipperz.PM.DataModel.User.Header.RecordIndex = function(args) {
36 Clipperz.PM.DataModel.User.Header.RecordIndex.superclass.constructor.apply(this, arguments);
37
38//console.log("NEW Clipperz.PM.DataModel.User.Header.RecordIndex", args);
39 this._recordsData = new Clipperz.PM.DataModel.EncryptedRemoteObject({
40 'name':'recordsData',
41 'retrieveKeyFunction': args.retrieveKeyFunction,
42 'remoteData': {
43 'data': args.recordsData['data'],
44 'version': args.encryptedDataVersion,
45 'recordsStats': args.recordsStats
46 }//,
47 // 'encryptedDataKeypath': 'data',
48 // 'encryptedVersionKeypath': 'version'
49 });
50
51 this._directLoginsData = new Clipperz.PM.DataModel.EncryptedRemoteObject({
52 'name':'directLoginsData',
53 'retrieveKeyFunction': args.retrieveKeyFunction,
54 'remoteData': {
55 'data': args.directLoginsData['data'],
56 'version': args.encryptedDataVersion
57 }//,
58 // 'encryptedDataKeypath': 'data',
59 // 'encryptedVersionKeypath': 'version'
60 });
61
62 this._lock = new MochiKit.Async.DeferredLock();
63 this._transientState = null;
64
65 this._retrieveRecordDetailFunction = args.retrieveRecordDetailFunction|| Clipperz.Base.exception.raise('MandatoryParameter');
66 this._recordsIndex = args.recordsData['index'] || Clipperz.Base.exception.raise('MandatoryParameter');
67 this._directLoginsIndex = args.directLoginsData['index']|| Clipperz.Base.exception.raise('MandatoryParameter');
68
69 this._records = null;
70
71 return this;
72}
73
74
75Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.RecordIndex, Object, {
76
77 'toString': function() {
78 return "Clipperz.PM.DataModel.User.Header.RecordIndex";
79 },
80
81 //-------------------------------------------------------------------------
82
83 'retrieveRecordDetailFunction': function () {
84 return this._retrieveRecordDetailFunction;
85 },
86
87 //-------------------------------------------------------------------------
88
89 'recordsIndex': function () {
90 return this._recordsIndex;
91 },
92
93 'recordsData': function () {
94 return this._recordsData;
95 },
96
97 //-------------------------------------------------------------------------
98
99 'directLoginsIndex': function () {
100 return this._directLoginsIndex;
101 },
102
103 'directLoginsData': function () {
104 return this._directLoginsData;
105 },
106
107 //-------------------------------------------------------------------------
108
109 'lock': function () {
110 return this._lock;
111 },
112
113 //-------------------------------------------------------------------------
114
115 'transientState': function () {
116 if (this._transientState == null) {
117 this._transientState = new Clipperz.KeyValueObjectStore(/*{'name':'User.Header.RecordIndex.transientState [1]'}*/);
118 }
119
120 return this._transientState;
121 },
122
123 'resetTransientState': function (isCommitting) {
124//console.log("######## UserHeaderRecordIndex - resetTransientState", Clipperz.Base.deepClone(this._transientState));
125 if (this._transientState != null) {
126 this._transientState.removeAllData();
127 }
128
129 this._transientState = null;
130 },
131
132 //-------------------------------------------------------------------------
133
134 'getRecordKey': function (aRecordReference) {
135 return Clipperz.Async.callbacks("User.Header.RecordIndex.getRecordKey", [
136 MochiKit.Base.method(this, 'getRecordIndexData', aRecordReference),
137 MochiKit.Base.itemgetter('key')
138 ], {trace:false});
139 },
140
141 'setRecordKey': function (aRecordReference, aValue) {
142 return this.updateRecordIndexData(aRecordReference, 'key', aValue);
143 },
144
145 //-------------------------------------------------------------------------
146
147 'getRecordIndexData': function (aRecordReference) {
148 return this.recordsData().getValue(this.recordsIndex()[aRecordReference]);
149 },
150
151 //.........................................................................
152
153 'updateRecordIndexData': function (aRecordReference, aKey, aValue) {
154 return this.recordsData().setValue(this.recordsIndex()[aRecordReference]+'.'+aKey, aValue);
155 },
156
157 //-------------------------------------------------------------------------
158
159 'getDirectLoginIndexData': function (aDirectLoginReference) {
160 return this.directLoginsData().getValue(this.directLoginsIndex()[aDirectLoginReference]);
161 },
162
163 'setDirectLoginIndexData': function (aDirectLoginReference, aKey, aValue) {
164//console.log("UserHeaderRecordIndex.setDirectLoginIndexData", aDirectLoginReference, this.directLoginsIndex()[aDirectLoginReference], aKey);
165//if (MochiKit.Base.isUndefinedOrNull(this.directLoginsIndex()[aDirectLoginReference])) {
166 //throw "PIPPO";
167//}
168 return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference] + '.' + aKey, aValue);
169 },
170
171 'addDirectLoginIndexData': function (aDirectLoginReference) {
172//console.log("UserHeaderRecordIndex.addDirectLoginIndexData", aDirectLoginReference, this.directLoginsIndex()[aDirectLoginReference]);
173 return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference], {});
174 },
175
176 'removeDirectLoginIndexData': function (aDirectLoginReference) {
177 return this.directLoginsData().removeValue(this.directLoginsIndex()[aDirectLoginReference])
178 },
179
180 //-------------------------------------------------------------------------
181
182 'records': function () {
183 vardeferredResult;
184
185 deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.records", {trace:false});
186 deferredResult.acquireLock(this.lock());
187 deferredResult.addCallback(MochiKit.Base.bind(function () {
188 var innerDeferredResult;
189
190 if (this._records == null) {
191 innerDeferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.records <inner deferred>", {trace:false});
192 innerDeferredResult.collectResults({
193 'records': [
194 // MochiKit.Base.method(this.recordsData(), 'getObjectDataStore'),
195 // MochiKit.Base.methodcaller('values')
196 MochiKit.Base.method(this.recordsData(), 'values')
197 ],
198 'recordsStats': [
199 MochiKit.Base.method(this.recordsData(), 'getRemoteData'),
200 MochiKit.Base.itemgetter('recordsStats')
201 ],
202 'directLogins': [
203 // MochiKit.Base.method(this.directLoginsData(), 'getObjectDataStore'),
204 // MochiKit.Base.methodcaller('values')
205 MochiKit.Base.method(this.directLoginsData(), 'values')
206 ]
207 })
208 innerDeferredResult.addCallback(MochiKit.Base.bind(function (someData) {
209 var indexReference;
210 var recordsInvertedIndex;
211 var directLoginsInvertedIndex;
212
213 recordsInvertedIndex = Clipperz.PM.DataModel.User.Header.RecordIndex.invertIndex(this.recordsIndex());
214 directLoginsInvertedIndex= Clipperz.PM.DataModel.User.Header.RecordIndex.invertIndex(this.directLoginsIndex());
215
216 this._records = {};
217
218 for (indexReference in someData['records']) {
219 varrecord;
220 var reference;
221 var updateDate;
222
223 reference = recordsInvertedIndex[indexReference];
224
225 if (typeof(someData['recordsStats'][reference]) != 'undefined') {
226 updateDate = someData['recordsStats'][reference]['updateDate'];
227
228 record = new Clipperz.PM.DataModel.Record({
229 'reference': reference,
230 'retrieveKeyFunction': MochiKit.Base.method(this, 'getRecordKey'),
231 'retrieveRemoteDataFunction':this.retrieveRecordDetailFunction(),
232
233 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getRecordIndexData'),
234 'updateIndexDataFunction': MochiKit.Base.method(this, 'updateRecordIndexData'),
235 'updateDate': updateDate,
236
237 'retrieveDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'),
238 'setDirectLoginIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'),
239 'removeDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'removeDirectLoginIndexData'),
240
241 'createNewDirectLoginFunction': MochiKit.Base.method(this, 'createNewDirectLogin')
242 });
243
244 this._records[reference] = record;
245 } else {
246Clipperz.log("SKIPPING record " + reference + " as there are no stas associated - " + Clipperz.Base.serializeJSON(someData['records'][reference]));
247 //# skip the record, as it seems it is not present in the DB
248 //updateDate = Clipperz.PM.Date.formatDateWithUTCFormat(new Date());
249 }
250 }
251
252 for (indexReference in someData['directLogins']) {
253 // vardirectLogin;
254 var reference;
255 var record;
256
257 reference = directLoginsInvertedIndex[indexReference];
258 record = this._records[recordsInvertedIndex[someData['directLogins'][indexReference]['record']]];
259
260 if (record != null) {
261 // directLogin = new Clipperz.PM.DataModel.DirectLogin({
262 new Clipperz.PM.DataModel.DirectLogin({
263 'reference': reference,
264 'record': record
265 });
266 } else {
267Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!");
268//console.log("direct login data", someData['directLogins']);
269//console.log("current direct login data", someData['directLogins'][indexReference])
270//console.log("reference", reference);
271//console.log("record index", this.recordsIndex());
272//console.log("record inverted index", recordsInvertedIndex);
273 }
274 }
275
276 return this._records;
277 }, this));
278 innerDeferredResult.callback();
279 } else {
280 innerDeferredResult = MochiKit.Async.succeed(this._records);
281 }
282
283 return innerDeferredResult;
284 }, this));
285 deferredResult.releaseLock(this.lock());
286 deferredResult.callback();
287
288 return deferredResult;
289 },
290
291 //-------------------------------------------------------------------------
292
293 'updateRecordIndexForNewRecord': function (aNewRecord) {
294 var newRecordIndex;
295 var recordReference;
296
297 recordReference = aNewRecord.reference();
298 newRecordIndex = (MochiKit.Base.listMax(MochiKit.Base.map(MochiKit.Base.partial(MochiKit.Base.operator.mul, 1), MochiKit.Base.values(this.recordsIndex()))) + 1) + '';
299 this.recordsIndex()[recordReference] = newRecordIndex;
300
301 this.transientState().setValue('newlyCreatedRecordsIndex' + '.' + recordReference, newRecordIndex);
302 this.transientState().setValue('newlyCreatedRecordsReferences'+ '.' + recordReference, aNewRecord);
303 },
304
305 //.........................................................................
306
307 'createNewRecord': function () {
308 var deferredResult;
309 var newRecord;
310
311//console.log("#### new Clipperz.PM.DataModel.Record [4]");
312 newRecord = new Clipperz.PM.DataModel.Record({
313 'retrieveKeyFunction': MochiKit.Base.method(this, 'getRecordKey'),
314 'retrieveRemoteDataFunction':this.retrieveRecordDetailFunction(),
315
316 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getRecordIndexData'),
317 'updateIndexDataFunction': MochiKit.Base.method(this, 'updateRecordIndexData'),
318 'updateDate': Clipperz.PM.Date.formatDateWithUTCFormat(new Date()),
319
320 'retrieveDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'),
321 'setDirectLoginIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'),
322 'removeDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'removeDirectLoginIndexData'),
323
324 'createNewDirectLoginFunction': MochiKit.Base.method(this, 'createNewDirectLogin')
325 });
326
327 this.transientState().setValue('newRecordsReferences' + '.' + newRecord.reference(), newRecord);
328 this.updateRecordIndexForNewRecord(newRecord);
329
330 deferredResult = Clipperz.Async.callbacks("User.Header.RecordIndex.createNewRecord", [
331 MochiKit.Base.method(this, 'records'),
332 MochiKit.Base.partial(Clipperz.Async.setItemOnObject, newRecord.reference(), newRecord),
333 MochiKit.Base.method(this, 'setRecordKey', newRecord.reference(), Clipperz.PM.Crypto.randomKey()),
334 MochiKit.Base.method(newRecord, 'setLabel', ''),
335 MochiKit.Base.partial(MochiKit.Async.succeed, newRecord)
336 ], {trace:false});
337
338
339 return deferredResult;
340 },
341
342 //-------------------------------------------------------------------------
343
344 'deleteRecord': function (aRecord) {
345 var deferredResult;
346 var recordReference;
347
348 recordReference = aRecord.reference();
349
350 deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.deleteRecord", {trace:false});
351
352 deferredResult.addMethod(aRecord, 'directLogins');
353 deferredResult.addCallback(MochiKit.Base.values);
354 deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'removeDirectLogin'));
355
356 deferredResult.addMethod(this.recordsData(), 'removeValue', this.recordsIndex()[recordReference]);
357 deferredResult.addCallback(MochiKit.Base.bind(function () {
358 this.transientState().setValue('deleteRecordsIndex' + '.' + recordReference, this.recordsIndex()[recordReference]);
359 delete this.recordsIndex()[recordReference];
360 }, this));
361
362 deferredResult.addMethod(this, 'records');
363 deferredResult.addCallback(MochiKit.Base.itemgetter(recordReference));
364 deferredResult.addMethod(this.transientState(), 'setValue', 'deleteRecordsReferences' + '.' + recordReference);
365
366 deferredResult.addMethod(this, 'records');
367 deferredResult.addCallback(MochiKit.Base.bind(function (someRecords) {
368 delete someRecords[recordReference];
369 }, this));
370 deferredResult.callback();
371
372 return deferredResult;
373 },
374
375 //=========================================================================
376
377 'removeDirectLogin': function (aDirectLogin) {
378 this.directLoginsData().removeValue(this.directLoginsIndex()[aDirectLogin.reference()]);
379 },
380
381 //-------------------------------------------------------------------------
382
383 'createNewDirectLogin': function (aRecord) {
384 var newDirectLogin;
385 varnewDirectLoginIndexValue;
386
387 newDirectLogin = new Clipperz.PM.DataModel.DirectLogin({record:aRecord});
388 newDirectLoginIndexValue = MochiKit.Base.listMax(MochiKit.Base.map(function (aValue) { return aValue * 1; }, MochiKit.Base.values(this.directLoginsIndex()))) + 1;
389
390 this.transientState().setValue('newDirectLoginReferences' + '.' + newDirectLogin.reference(), newDirectLogin);
391
392//console.log("UserHeaderRecordIndex.createNewDirectLogin [1]", newDirectLogin.reference(), newDirectLoginIndexValue);
393 this.directLoginsIndex()[newDirectLogin.reference()] = newDirectLoginIndexValue;
394//console.log("UserHeaderRecordIndex.createNewDirectLogin [2]", newDirectLogin.reference(), this.directLoginsIndex()[newDirectLogin.reference()]);
395 this.directLoginsData().setValue(this.directLoginsIndex()[newDirectLogin.reference()], {'record': this.recordsIndex()[aRecord.reference()]});
396
397 return newDirectLogin;
398 },
399
400 //=========================================================================
401
402 'deleteAllCleanTextData': function () {
403 return Clipperz.Async.callbacks("User.Header.RecordIndex.deleteAllCleanTextData", [
404 // MochiKit.Base.method(this, 'records'),
405 // MochiKit.Base.values,
406 // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('deleteAllCleanTextData')),
407
408 MochiKit.Base.method(this, 'recordsData'),
409 MochiKit.Base.methodcaller('deleteAllCleanTextData'),
410 MochiKit.Base.method(this, 'directLoginsData'),
411 MochiKit.Base.methodcaller('deleteAllCleanTextData')
412 ], {trace:false});
413 },
414
415 //-------------------------------------------------------------------------
416
417 'hasAnyCleanTextData': function () {
418 var deferredResult;
419
420 deferredResult = new Clipperz.Async.Deferred({trace:false});
421 deferredResult.collectResults({
422 'recordsData': [
423 MochiKit.Base.method(this, 'recordsData'),
424 MochiKit.Base.methodcaller('hasAnyCleanTextData')
425 ],
426 'directLoginsData':[
427 MochiKit.Base.method(this, 'directLoginsData'),
428 MochiKit.Base.methodcaller('hasAnyCleanTextData')
429 ],
430 // 'records': [
431 // MochiKit.Base.method(this, 'records'),
432 // MochiKit.Base.values,
433 // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasAnyCleanTextData')),
434 // Clipperz.Async.collectAll
435 // ]
436 });
437//deferredResult.addCallback(function (aValue) { console.log("USER.Header.RecordIndex.hasAnyCleanTextData", aValue); return aValue});
438
439 // deferredResult.addCallback(MochiKit.Base.values);
440 // deferredResult.addCallback(MochiKit.Base.flattenArguments);
441 // deferredResult.addCallback(function(someValues) {
442 // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity);
443 // });
444 deferredResult.addCallback(Clipperz.Async.or);
445
446 deferredResult.callback();
447
448 return deferredResult;
449 },
450
451 //-------------------------------------------------------------------------
452
453 'hasPendingChanges': function () {
454 vardeferredResult;
455
456 deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.hasPendingChanges", {trace:false});
457 deferredResult.collectResults({
458 'recordsData': [
459 MochiKit.Base.method(this, 'recordsData'),
460 MochiKit.Base.methodcaller('hasPendingChanges')
461 ],
462 'directLoginsData': [
463 MochiKit.Base.method(this, 'directLoginsData'),
464 MochiKit.Base.methodcaller('hasPendingChanges')
465 ]
466 });
467//deferredResult.addCallback(function (aValue) { console.log("UserHeaderIndex.hasPendingResults", aValue); return aValue; });
468 deferredResult.addCallback(Clipperz.Async.or);
469 // deferredResult.addCallback(MochiKit.Base.values);
470 // deferredResult.addCallback(MochiKit.Base.flattenArguments);
471 // deferredResult.addCallback(function(someValues) {
472 // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity);
473 // });
474 deferredResult.callback();
475
476 return deferredResult;
477 },
478
479 //-------------------------------------------------------------------------
480
481 'commitTransientState': function () {
482 var deferredResult;
483
484 deferredResut = Clipperz.Async.callbacks("User.Header.RecordIndex.commitTransientState", [
485 MochiKit.Base.method(this, 'recordsData'),
486 MochiKit.Base.methodcaller('commitTransientState'),
487
488 MochiKit.Base.method(this, 'directLoginsData'),
489 MochiKit.Base.methodcaller('commitTransientState'),
490
491 MochiKit.Base.method(this, 'resetTransientState', true)
492 ], {trace:false});
493
494 return deferredResult;
495 },
496
497 //-------------------------------------------------------------------------
498
499 'revertChanges': function () {
500 return Clipperz.Async.callbacks("User.Header.RecordIndex.revertChanges", [
501 MochiKit.Base.method(this, 'recordsData'),
502 MochiKit.Base.methodcaller('revertChanges'),
503
504 // MochiKit.Base.method(this, 'directLoginsData'),
505 // MochiKit.Base.methodcaller('revertChanges'),
506
507 MochiKit.Base.method(this, 'records'),
508 MochiKit.Base.bind(function (someRecords) {
509 varrecordReference;
510
511 for (recordReference in this.transientState().getValue('deleteRecordsReferences')) {
512 this.recordsIndex()[recordReference] = this.transientState().getValue('deleteRecordsIndex' + '.' + recordReference);
513 someRecords[recordReference] = this.transientState().getValue('deleteRecordsReferences' + '.' + recordReference);
514 }
515
516 for (recordReference in this.transientState().getValue('newRecordsReferences')) {
517 delete this.recordsIndex()[recordReference];
518 delete someRecords[recordReference];
519 }
520 }, this),
521
522 // MochiKit.Base.method(this, 'directLogins'),
523 MochiKit.Base.bind(function () {
524 vardirectLoginReference;
525
526 //this.transientState().setValue('newDirectLoginReferences' + '.' + newDirectLogin.reference(), newDirectLogin);
527//
528 //this.directLoginsIndex()[newDirectLogin.reference()] = newDirectLoginIndexValue;
529 //this.directLoginsData().setValue(this.directLoginsIndex()[newDirectLogin.reference()], {'record': this.recordsIndex()[aRecord.reference()]});
530
531
532 // for (directLoginReference in this.transientState().getValue('deleteDirectLoginReferences')) {
533 // someDirectLogins[directLoginReference] = this.transientState().getValue('deleteDirectLoginReferences' + '.' + recordReference);
534 // }
535
536 for (directLoginReference in this.transientState().getValue('newDirectLoginReferences')) {
537 // this.directLoginsData().removeValue(this.directLoginsIndex()[directLoginReference]);
538 delete this.directLoginsIndex()[directLoginReference];
539 }
540 }, this),
541
542 MochiKit.Base.method(this, 'directLoginsData'),
543 MochiKit.Base.methodcaller('revertChanges'),
544
545 MochiKit.Base.method(this, 'resetTransientState', false)
546 ], {trace:false});
547 },
548
549 //-------------------------------------------------------------------------
550
551 'prepareRemoteDataWithKey': function (aKey) {
552 // "records": {
553 // "index": {
554 // "eeda70e0392261967bda71c3764da78989c45bbd2bb7be6b941b90f81d9b81b5": "0",
555 // "13a5e52976337ab210903cd04872588e1b21fb72bc183e91aa25c494b8138551": "1",
556 // ...
557 // "465a067a0bd2b470fa834de5397e38494de0c7707938262fae3427932e219744": "18",
558 // "4fd1dc2ca860b7fb47cef10a84edb3270da05510b0a30a6b0b083898712d4b9e": "19"
559 // },
560 // "data": "n+AzGEEQXaSRSY4d ... BDypotrXgPo94uHfoXvGFzwCn8w="
561 // },
562 // "directLogins": {
563 // "index": {
564 // "61e87fdc4f1d9112e3b30c1f6812d095dcdb24f014c83319091eb6c9899ec348":"0",
565 // "989593d4c48929f0c8f1581aa96969c622807e99619ed4732026e967530a68ad":"1",
566 // ...
567 // "cb9ae0bba1957075ccdbfd3b3481704d62087687a2ac7c411a4f07d444bde0f7":"17",
568 // "7e1d069b7fa57c03bd7bf48807520feb953157834503aaff8c9d493f37dea69d":"18"
569 // },
570 // "data":"5YG9KKU/OZ5guUgFlms6k1 ... ZG/5Fn0uN+LoAsNfHm+EE62x"
571 // },
572
573 var deferredResult;
574 var result;
575
576//console.log("recordsIndex", this.recordsIndex());
577 result = {};
578
579 deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.prepareRemoteDataWithKey", {trace:false});
580 deferredResult.collectResults({
581 'index':MochiKit.Base.partial(MochiKit.Async.succeed, this.recordsIndex()),
582 'data': [
583 MochiKit.Base.method(this.recordsData(), 'prepareRemoteDataWithKey', aKey),
584 MochiKit.Base.itemgetter('data')
585 ]
586 });
587 deferredResult.addCallback(Clipperz.Async.setItem, result, 'records');
588
589 deferredResult.collectResults({
590 'index':MochiKit.Base.partial(MochiKit.Async.succeed, this.directLoginsIndex()),
591 'data': [
592 MochiKit.Base.method(this.directLoginsData(), 'prepareRemoteDataWithKey', aKey),
593 MochiKit.Base.itemgetter('data')
594 ]
595 });
596 deferredResult.addCallback(Clipperz.Async.setItem, result, 'directLogins');
597
598 deferredResult.addCallback(MochiKit.Async.succeed, result);
599
600 deferredResult.callback();
601
602 return deferredResult;
603 },
604
605 //-------------------------------------------------------------------------
606
607 'updateRecordKeyAndPrepareRemoteData': function (aRecord) {
608 varnewRecordKey;
609 var deferredResult;
610
611 newRecordKey = Clipperz.PM.Crypto.randomKey();
612
613 deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.updateRecordKeyAndPrepareRemoteData", {trace:false});
614 deferredResult.addCallback(MochiKit.Base.method(aRecord, 'prepareRemoteDataWithKey', newRecordKey));
615 deferredResult.addCallbackPass(MochiKit.Base.method(this, 'setRecordKey', aRecord.reference(), newRecordKey));
616 deferredResult.callback();
617
618 return deferredResult;
619 },
620
621 //.........................................................................
622
623 'removeNewRecordWithNoChanges': function (aRecord) {
624 var deferredResult;
625 var recordReference;
626
627 recordReference = aRecord.reference();
628
629 deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.removeNewRecordWithNoChanges", {trace:false});
630
631 deferredResult.addMethod(this.recordsData(), 'removeValue', this.recordsIndex()[recordReference]);
632 deferredResult.addCallback(MochiKit.Base.bind(function () {
633 delete this.recordsIndex()[recordReference];
634 }, this));
635
636 deferredResult.addMethod(this, 'records');
637 deferredResult.addCallback(MochiKit.Base.bind(function (someRecords) {
638 delete someRecords[recordReference];
639 }, this));
640 deferredResult.callback();
641
642 return deferredResult;
643 },
644
645 //.........................................................................
646
647 'prepareRemoteDataForChangedRecords': function () {
648 vardeferredResult;
649 varresult;
650
651 result = {};
652
653 deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.prepareRemoteDataForChangedRecords", {trace:false});
654
655 deferredResult.addMethod(this, 'records');
656 deferredResult.addCallback(MochiKit.Base.values);
657 deferredResult.addCallback(Clipperz.Async.deferredFilter, MochiKit.Base.methodcaller('isBrandNewWithNoPendingChanges'));
658 deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'removeNewRecordWithNoChanges'));
659
660 deferredResult.addMethod(this, 'records');
661 deferredResult.addCallback(MochiKit.Base.values);
662 deferredResult.addCallback(Clipperz.Async.deferredFilter, MochiKit.Base.methodcaller('hasPendingChanges'));
663 deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'updateRecordKeyAndPrepareRemoteData'));
664 deferredResult.addCallback(Clipperz.Async.collectAll);
665
666 deferredResult.addCallback(Clipperz.Async.deferredIf("updated records != null", [
667 MochiKit.Base.operator.identity
668 ], [
669 MochiKit.Base.partial(MochiKit.Async.succeed, [])
670 ]));
671 deferredResult.addCallback(Clipperz.Async.setItem, result, 'updated');
672
673 deferredResult.addMethod(this.transientState(), 'getValue', 'deleteRecordsReferences');
674 deferredResult.addCallback(MochiKit.Base.keys);
675 deferredResult.addCallback(Clipperz.Async.deferredIf("deleted records != null", [
676 MochiKit.Base.operator.identity
677 ], [
678 MochiKit.Base.partial(MochiKit.Async.succeed, [])
679 ]));
680 deferredResult.addCallback(Clipperz.Async.setItem, result, 'deleted');
681
682 deferredResult.addCallback(MochiKit.Async.succeed, result);
683 deferredResult.callback();
684
685 return deferredResult;
686 },
687
688 //-------------------------------------------------------------------------
689 __syntaxFix__: "syntax fix"
690});
691
692
693
694Clipperz.PM.DataModel.User.Header.RecordIndex.invertIndex = function (anIndex) {
695 var result;
696 var key;
697
698 result = {};
699
700 for (key in anIndex) {
701 result[anIndex[key]] = key;
702 }
703
704 return result;
705}; \ No newline at end of file
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.js
new file mode 100644
index 0000000..e8afa97
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.js
@@ -0,0 +1,817 @@
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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32
33
34//#############################################################################
35
36Clipperz.PM.DataModel.User = function (args) {
37 args = args || {};
38
39 Clipperz.PM.DataModel.User.superclass.constructor.apply(this, arguments);
40
41 this._username = args.username || null;
42 this._getPassphraseFunction = args.getPassphraseFunction || null;
43
44 this._data = null;
45
46 this._connection = null;
47 this._connectionVersion = 'current';
48
49 this._serverData = null;
50 this._serverLockValue = null;
51 this._transientState = null;
52
53 this._deferredLocks = {
54 'passphrase': new MochiKit.Async.DeferredLock(),
55 'serverData': new MochiKit.Async.DeferredLock(),
56 // 'recordsIndex': new MochiKit.Async.DeferredLock(),
57 // 'directLoginsIndex':new MochiKit.Async.DeferredLock()
58 // 'preferences': new MochiKit.Async.DeferredLock()
59 // 'oneTimePasswords': new MochiKit.Async.DeferredLock()
60 '__syntaxFix__': 'syntax fix'
61 };
62
63 return this;
64}
65
66Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, {
67
68 'toString': function () {
69 return "Clipperz.PM.DataModel.User - " + this.username();
70 },
71
72 //-------------------------------------------------------------------------
73
74 'username': function () {
75 return this._username;
76 },
77
78 'setUsername': function (aValue) {
79 this._username = aValue;
80 },
81
82 //-------------------------------------------------------------------------
83
84 'displayName': function() {
85 return "" + this.username() + "";
86 },
87
88 //-------------------------------------------------------------------------
89
90 'data': function () {
91 if (this._data == null) {
92 this._data = new Clipperz.KeyValueObjectStore(/*{'name':'User.data [1]'}*/);
93 };
94
95 return this._data;
96 },
97
98 //-------------------------------------------------------------------------
99
100 'serverLockValue': function () {
101 return this._serverLockValue;
102 },
103
104 'setServerLockValue': function (aValue) {
105 this._serverLockValue = aValue;
106 },
107
108 //-------------------------------------------------------------------------
109
110 'transientState': function () {
111 if (this._transientState == null) {
112 this._transientState = {}
113 }
114
115 return this._transientState;
116 },
117
118 'resetTransientState': function (isCommitting) {
119 this._transientState = null;
120 },
121
122 //-------------------------------------------------------------------------
123
124 'deferredLockForSection': function(aSectionName) {
125 return this._deferredLocks[aSectionName];
126 },
127
128 //-------------------------------------------------------------------------
129
130 'getPassphrase': function() {
131 var deferredResult;
132
133 deferredResult = new Clipperz.Async.Deferred("User.getPassphrase", {trace:false});
134 deferredResult.acquireLock(this.deferredLockForSection('passphrase'));
135 deferredResult.addMethod(this.data(), 'deferredGetOrSet', 'passphrase', this.getPassphraseFunction());
136 deferredResult.releaseLock(this.deferredLockForSection('passphrase'));
137 deferredResult.callback();
138
139 return deferredResult;
140 },
141
142 'getPassphraseFunction': function () {
143 return this._getPassphraseFunction;
144 },
145
146 //-------------------------------------------------------------------------
147
148 'getCredentials': function () {
149 return Clipperz.Async.collectResults("User; get username and passphrase", {
150 'username': MochiKit.Base.method(this, 'username'),
151 'password': MochiKit.Base.method(this, 'getPassphrase')
152 }, {trace:false})();
153 },
154
155 //-------------------------------------------------------------------------
156
157 'changePassphrase': function (aNewValue) {
158 return this.updateCredentials(this.username(), aNewValue);
159 },
160
161 //.........................................................................
162
163 'updateCredentials': function (aUsername, aPassphrase) {
164 vardeferredResult;
165
166 deferredResult = new Clipperz.Async.Deferred("User.updateCredentials", {trace:false});
167 // deferredResult.addMethod(this, 'getPassphrase');
168 // deferredResult.setValue('currentPassphrase');
169 deferredResult.addMethod(this.connection(), 'ping');
170 deferredResult.addMethod(this, 'setUsername', aUsername)
171 deferredResult.acquireLock(this.deferredLockForSection('passphrase'));
172 deferredResult.addMethod(this.data(), 'deferredGetOrSet', 'passphrase', aPassphrase);
173 deferredResult.releaseLock(this.deferredLockForSection('passphrase'));
174 // deferredResult.getValue('currentPassphrase');
175 deferredResult.addMethod(this, 'prepareRemoteDataWithKey', aPassphrase);
176 deferredResult.addMethod(this.connection(), 'updateCredentials', aUsername, aPassphrase);
177 deferredResult.callback();
178
179 return deferredResult;
180 },
181
182 //-------------------------------------------------------------------------
183
184 'initialSetupWithNoData': function () {
185 this._serverData = {
186 'version': '0.1',
187 'statistics': "",
188 'header': {
189 'data': null,
190 'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion,
191
192 'recordsIndex': new Clipperz.PM.DataModel.User.Header.RecordIndex({
193 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'),
194 'recordsData': {'data':null, 'index':{}},
195 'recordsStats': null,
196 'directLoginsData': {'data':null, 'index':{}},
197 'encryptedDataVersion': Clipperz.PM.Crypto.encryptingFunctions.currentVersion,
198 'retrieveRecordDetailFunction':MochiKit.Base.method(this, 'getRecordDetail')
199 }),
200 'preferences': new Clipperz.PM.DataModel.User.Header.Preferences({
201 'name':'preferences',
202 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase')
203 }),
204 'oneTimePasswords': new Clipperz.PM.DataModel.User.Header.OneTimePasswords({
205 'name':'preferences',
206 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase')
207 })
208 }
209 };
210
211 // this._serverLockValue = Clipperz.PM.Crypto.randomKey();
212 },
213
214 //.........................................................................
215
216 'registerAsNewAccount': function () {
217 var deferredResult;
218
219 deferredResult = new Clipperz.Async.Deferred("User.registerAsNewAccount", {trace:false});
220 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'updateProgress', {'extraSteps':3});
221 deferredResult.addMethod(this, 'initialSetupWithNoData')
222 deferredResult.addMethod(this, 'getPassphrase');
223 deferredResult.addMethod(this, 'prepareRemoteDataWithKey');
224 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
225 deferredResult.addMethod(this.connection(), 'register');
226 deferredResult.addCallback(MochiKit.Base.itemgetter('lock'));
227 deferredResult.addMethod(this, 'setServerLockValue');
228 deferredResult.addCallbackPass(MochiKit.Signal.signal,Clipperz.Signal.NotificationCenter, 'userSuccessfullyRegistered');
229
230 // deferredResult.addErrback (MochiKit.Base.method(this, 'handleRegistrationFailure'));
231
232 deferredResult.callback();
233
234 return deferredResult;
235 },
236
237 //-------------------------------------------------------------------------
238
239 'login': function () {
240 var deferredResult;
241
242 deferredResult = new Clipperz.Async.Deferred("User.login", {trace:false});
243 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'updateProgress', {'extraSteps':3});
244 deferredResult.addMethod(this, 'getPassphrase');
245 deferredResult.addCallback(Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue);
246 deferredResult.addCallback(Clipperz.Async.deferredIf("Is the passphrase an OTP", [
247 MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'updateProgress', {'extraSteps':1}),
248 MochiKit.Base.method(this, 'getCredentials'),
249 MochiKit.Base.method(this.connection(), 'redeemOneTimePassword'),
250 MochiKit.Base.method(this.data(), 'setValue', 'passphrase')
251 ], []));
252 deferredResult.addErrback(MochiKit.Base.method(this, 'getPassphrase'));
253 deferredResult.addMethod(this.connection(), 'login');
254 deferredResult.addCallbackPass(MochiKit.Signal.signal,Clipperz.Signal.NotificationCenter, 'userSuccessfullyLoggedIn');
255 deferredResult.addErrback (MochiKit.Base.method(this, 'handleConnectionFallback'));
256
257 deferredResult.callback();
258
259 return deferredResult;
260 },
261
262 //.........................................................................
263
264 'handleConnectionFallback': function(aValue) {
265 var result;
266
267 if (aValue instanceof MochiKit.Async.CancelledError) {
268 result = aValue;
269 } else {
270 this.setConnectionVersion(Clipperz.PM.Connection.communicationProtocol.fallbackVersions[this.connectionVersion()]);
271
272 if (this.connectionVersion() != null) {
273 result = new Clipperz.Async.Deferred("User.handleConnectionFallback - retry");
274
275 result.addMethod(this, 'login');
276 result.callback();
277 } else {
278 result = Clipperz.Async.callbacks("User.handleConnectionFallback - failed", [
279 MochiKit.Base.method(this.data(), 'removeValue', 'passphrase'),
280 MochiKit.Base.method(this, 'setConnectionVersion', 'current'),
281 MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'userLoginFailed'),
282 MochiKit.Base.partial(MochiKit.Async.fail, Clipperz.PM.DataModel.User.exception.LoginFailed)
283 ], {trace:false});
284 }
285 }
286
287 return result;
288 },
289
290 //-------------------------------------------------------------------------
291
292 'lock': function () {
293 return Clipperz.Async.callbacks("User.lock", [
294 MochiKit.Base.method(this, 'deleteAllCleanTextData')
295 ], {trace:false});
296 },
297
298 //-------------------------------------------------------------------------
299
300 'logout': function () {
301 return Clipperz.Async.callbacks("User.logout", [
302 MochiKit.Base.method(this, 'deleteAllCleanTextData'),
303 MochiKit.Base.method(this.connection(), 'logout')
304 ], {trace:false});
305 },
306
307 //-------------------------------------------------------------------------
308
309 'headerFormatVersion': function(anHeader) {
310 var result;
311
312 if (anHeader.charAt(0) == '{') {
313 varheaderData;
314
315 headerData = Clipperz.Base.evalJSON(anHeader);
316 result = headerData['version'];
317 } else {
318 result = 'LEGACY';
319 }
320
321 return result;
322 },
323
324 //-------------------------------------------------------------------------
325
326 'unpackServerData': function (someServerData) {
327 var unpackedData;
328 var headerVersion;
329
330 varrecordsIndex;
331 var preferences;
332 var oneTimePasswords;
333
334//console.log(">>> ***************** user.unpackServerData", someServerData);
335 this.setServerLockValue(someServerData['lock']);
336
337 headerVersion = this.headerFormatVersion(someServerData['header']);
338
339 switch (headerVersion) {
340 case 'LEGACY':
341 varlegacyHeader;
342
343 legacyHeader = new Clipperz.PM.DataModel.User.Header.Legacy({
344 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'),
345 'remoteData': {
346 'data': someServerData['header'],
347 'version': someServerData['version'],
348 'recordsStats': someServerData['recordsStats']
349 },
350 // 'encryptedDataKeypath': 'data',
351 // 'encryptedVersionKeypath': 'version',
352 'retrieveRecordDetailFunction':MochiKit.Base.method(this, 'getRecordDetail')
353 });
354
355 recordsIndex = legacyHeader;
356 preferences = legacyHeader;
357 oneTimePasswords= legacyHeader;
358 break;
359 case '0.1':
360 varheaderData;
361
362 headerData = Clipperz.Base.evalJSON(someServerData['header']);
363
364 recordsIndex = new Clipperz.PM.DataModel.User.Header.RecordIndex({
365 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'),
366 'recordsData': headerData['records'],
367 'recordsStats': someServerData['recordsStats'],
368 'directLoginsData': headerData['directLogins'],
369 'encryptedDataVersion': someServerData['version'],
370 'retrieveRecordDetailFunction':MochiKit.Base.method(this, 'getRecordDetail')
371 });
372
373 //Still missing a test case that actually fais with the old version of the code, where the check for undefined was missing
374 if (typeof(headerData['preferences']) != 'undefined') {
375 preferences= new Clipperz.PM.DataModel.User.Header.Preferences({
376 'name':'preferences',
377 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'),
378 'remoteData': {
379 'data': headerData['preferences']['data'],
380 'version': someServerData['version']
381 }
382 });
383 } else {
384 preferences= new Clipperz.PM.DataModel.User.Header.Preferences({
385 'name':'preferences',
386 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase')
387 });
388 }
389
390 if (typeof(headerData['oneTimePasswords']) != 'undefined') {
391 oneTimePasswords = new Clipperz.PM.DataModel.User.Header.OneTimePasswords({
392 'name':'preferences',
393 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'),
394 'remoteData': {
395 'data': headerData['oneTimePasswords']['data'],
396 'version': someServerData['version']
397 }
398 });
399 } else {
400 oneTimePasswords = new Clipperz.PM.DataModel.User.Header.OneTimePasswords({
401 'name':'preferences',
402 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase')
403 });
404 }
405
406 break;
407 }
408
409 unpackedData = {
410 'version': someServerData['version'],
411 'statistics': someServerData['statistics'],
412 'header': {
413 'data': someServerData['header'],
414 'version': headerVersion,
415
416 'recordsIndex': recordsIndex,
417 'preferences': preferences,
418 'oneTimePasswords': oneTimePasswords
419 }
420 };
421
422 this._serverData = unpackedData;
423//console.log("<<< ***************** user.unpackServerData", this._serverData);
424
425 return this._serverData;
426 },
427
428 //-------------------------------------------------------------------------
429
430 'getServerData': function() {
431 var deferredResult;
432
433 deferredResult = new Clipperz.Async.Deferred("User.getServerData", {trace:false});
434 deferredResult.acquireLock(this.deferredLockForSection('serverData'));
435 deferredResult.addCallback(MochiKit.Base.bind(function(aResult) {
436 var innerDeferredResult;
437
438 innerDeferredResult = new Clipperz.Async.Deferred("User.getUserDetails.innerDeferred", {trace:false});
439 if (this._serverData == null) {
440 innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'loadingUserDetails');
441 innerDeferredResult.addMethod(this.connection(), 'message', 'getUserDetails');
442 innerDeferredResult.addMethod(this, 'unpackServerData');
443 innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'loadedUserDetails');
444 }
445
446 innerDeferredResult.addCallback(MochiKit.Base.bind(function () {
447 return this._serverData;
448 },this));
449 innerDeferredResult.callback();
450
451 return innerDeferredResult;
452 }, this));
453 deferredResult.releaseLock(this.deferredLockForSection('serverData'));
454 deferredResult.callback();
455
456 return deferredResult;
457 },
458
459 //-------------------------------------------------------------------------
460
461 'connectionVersion': function() {
462 return this._connectionVersion;
463 },
464
465 'setConnectionVersion': function(aValue) {
466 if (this._connectionVersion != aValue) {
467 this.resetConnection();
468 }
469 this._connectionVersion = aValue;
470 },
471
472 //-------------------------------------------------------------------------
473
474 'connection': function() {
475 if ((this._connection == null) && (this.connectionVersion() != null) ){
476 this._connection = new Clipperz.PM.Connection.communicationProtocol.versions[this.connectionVersion()]({
477 getCredentialsFunction: MochiKit.Base.method(this, 'getCredentials')
478 });
479 }
480
481 return this._connection;
482 },
483
484 'resetConnection': function(aValue) {
485 if (this._connection != null) {
486 this._connection.reset();
487 }
488
489 this._connection = null;
490 },
491
492 //=========================================================================
493
494 'getHeaderIndex': function (aKey) {
495 return Clipperz.Async.callbacks("User.getHeaderIndex", [
496 MochiKit.Base.method(this, 'getServerData'),
497 MochiKit.Base.itemgetter('header'),
498 MochiKit.Base.itemgetter(aKey)
499 ], {trace:false})
500 },
501
502 //=========================================================================
503
504 'getRecords': function () {
505 return Clipperz.Async.callbacks("User.getRecords", [
506 MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'),
507 MochiKit.Base.methodcaller('records'),
508 MochiKit.Base.values
509 ], {trace:false});
510 },
511
512 'recordWithLabel': function (aLabel) {
513 return Clipperz.Async.callbacks("User.recordWithLabel", [
514 MochiKit.Base.method(this, 'getRecords'),
515 MochiKit.Base.partial(Clipperz.Async.deferredFilter, function (aRecord) {
516 return Clipperz.Async.callbacks("User.recordWithLabel - check record label", [
517 MochiKit.Base.methodcaller('label'),
518 MochiKit.Base.partial(MochiKit.Base.operator.eq, aLabel)
519 ], {trace:false}, aRecord);
520 }),
521 function (someFilteredResults) {
522 var result;
523
524 switch (someFilteredResults.length) {
525 case 0:
526 result = null;
527 break;
528 case 1:
529 result = someFilteredResults[0];
530 break;
531 default:
532 WTF = TODO;
533 break;
534 }
535
536 return result;
537 }
538 ], {trace:false});
539 },
540
541 //-------------------------------------------------------------------------
542
543 'getRecord': function (aRecordReference) {
544 return Clipperz.Async.callbacks("User.getRecord", [
545 MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'),
546 MochiKit.Base.methodcaller('records'),
547 MochiKit.Base.itemgetter(aRecordReference),
548
549 Clipperz.Async.deferredIf("record != null", [
550 MochiKit.Base.operator.identity
551 ], [
552 function () { throw "Record does not exists"}
553 ])
554 ], {trace:false});
555 },
556
557 //-------------------------------------------------------------------------
558
559 'getRecordDetail': function (aRecordReference) {
560 return this.connection().message('getRecordDetail', {reference: aRecordReference});
561 },
562
563 //-------------------------------------------------------------------------
564
565 'deleteRecord': function (aRecord) {
566 return Clipperz.Async.callbacks("User.deleteRecord", [
567 MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'),
568 MochiKit.Base.methodcaller('deleteRecord', aRecord)
569 ], {trace:false});
570 },
571
572 //-------------------------------------------------------------------------
573
574 'createNewRecord': function () {
575 return Clipperz.Async.callbacks("User.createNewRecord", [
576 MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'),
577 MochiKit.Base.methodcaller('createNewRecord')
578 ], {trace:false});
579 },
580
581 //=========================================================================
582
583 'getDirectLogins': function() {
584 var deferredResult;
585
586 deferredResult = new Clipperz.Async.Deferred("User.getDirectLogins", {trace:false});
587 deferredResult.addMethod(this, 'getRecords');
588 deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.compose(MochiKit.Base.values, MochiKit.Base.methodcaller('directLogins')));
589 deferredResult.addCallback(MochiKit.Base.flattenArray);
590 deferredResult.callback();
591
592 return deferredResult;
593 },
594
595 //=========================================================================
596
597 'getOneTimePasswords': function () {
598 return Clipperz.Async.callbacks("User.getOneTimePasswords", [
599 MochiKit.Base.method(this, 'getHeaderIndex', 'oneTimePasswords'),
600 MochiKit.Base.methodcaller('oneTimePasswords'),
601 MochiKit.Base.values
602 ], {trace:false});
603 },
604
605 //=========================================================================
606
607 'invokeMethodNamedOnHeader': function (aMethodName, aValue) {
608 return Clipperz.Async.collectResults("User.invokeMethodNamedOnHeader [" + aMethodName + "]", {
609 'recordIndex': [
610 MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'),
611 MochiKit.Base.methodcaller(aMethodName, aValue)
612 ],
613 'preferences': [
614 MochiKit.Base.method(this, 'getHeaderIndex', 'preferences'),
615 MochiKit.Base.methodcaller(aMethodName, aValue)
616 ],
617 'oneTimePasswords': [
618 MochiKit.Base.method(this, 'getHeaderIndex', 'oneTimePasswords'),
619 MochiKit.Base.methodcaller(aMethodName, aValue)
620 ]//,
621 // 'statistics': [
622 // MochiKit.Base.method(this, 'getStatistics'),
623 // MochiKit.Base.methodcaller(aMethodName, aValue)
624 // ]
625 }, {trace:false})();
626 },
627
628 //-------------------------------------------------------------------------
629
630 'invokeMethodNamedOnRecords': function (aMethodName, aValue) {
631 return Clipperz.Async.callbacks("User.invokeMethodNamedOnRecords[" + aMethodName + "]", [
632 MochiKit.Base.method(this, 'getRecords'),
633 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller(aMethodName, aValue)),
634 Clipperz.Async.collectAll
635 ], {trace:false});
636 },
637
638 //=========================================================================
639
640 'hasPendingChanges': function () {
641 vardeferredResult;
642
643 deferredResult = new Clipperz.Async.Deferred("User.hasPendingChanges", {trace:false});
644 deferredResult.collectResults({
645 'header': [
646 MochiKit.Base.method(this, 'invokeMethodNamedOnHeader', 'hasPendingChanges'),
647 MochiKit.Base.values
648 ],
649 'records': MochiKit.Base.method(this, 'invokeMethodNamedOnRecords', 'hasPendingChanges')
650 });
651 deferredResult.addCallback(Clipperz.Async.or);
652 deferredResult.callback();
653 // recordsIndex = legacyHeader;
654 // preferences = legacyHeader;
655 // oneTimePasswords= legacyHeader;
656
657 return deferredResult;
658 },
659
660 //=========================================================================
661
662 'commitTransientState': function () {
663 return Clipperz.Async.callbacks("User.commitTransientState", [
664 MochiKit.Base.method(this, 'invokeMethodNamedOnHeader', 'commitTransientState'),
665 MochiKit.Base.method(this, 'invokeMethodNamedOnRecords', 'commitTransientState'),
666
667 MochiKit.Base.method(this, 'transientState'),
668 MochiKit.Base.itemgetter('lock'),
669 MochiKit.Base.method(this, 'setServerLockValue'),
670 MochiKit.Base.method(this, 'resetTransientState', true)
671 ], {trace:false});
672 },
673
674 //-------------------------------------------------------------------------
675
676 'revertChanges': function () {
677 return Clipperz.Async.callbacks("User.revertChanges", [
678 MochiKit.Base.method(this, 'invokeMethodNamedOnHeader', 'revertChanges'),
679 MochiKit.Base.method(this, 'invokeMethodNamedOnRecords', 'revertChanges'),
680 MochiKit.Base.method(this, 'resetTransientState', false)
681 ], {trace:false});
682 },
683
684 //=========================================================================
685
686 'deleteAllCleanTextData': function () {
687 return Clipperz.Async.callbacks("User.deleteAllCleanTextData", [
688 MochiKit.Base.method(this, 'invokeMethodNamedOnRecords', 'deleteAllCleanTextData'),
689 MochiKit.Base.method(this, 'invokeMethodNamedOnHeader', 'deleteAllCleanTextData'),
690
691 MochiKit.Base.method(this.data(), 'removeAllData'),
692 MochiKit.Base.method(this, 'resetTransientState', false)
693 ], {trace:false});
694 },
695
696 //-------------------------------------------------------------------------
697
698 'hasAnyCleanTextData': function () {
699 vardeferredResult;
700
701 deferredResult = new Clipperz.Async.Deferred("User.hasAnyCleanTextData", {trace:false});
702 deferredResult.collectResults({
703 'header':[
704 MochiKit.Base.method(this, 'invokeMethodNamedOnHeader', 'hasAnyCleanTextData'),
705 MochiKit.Base.values
706 ],
707 'records':MochiKit.Base.method(this, 'invokeMethodNamedOnRecords', 'hasAnyCleanTextData'),
708 'data': MochiKit.Base.bind(function () {
709 return MochiKit.Async.succeed(! this.data().isEmpty());
710 }, this),
711 'transientState':MochiKit.Base.bind(function () {
712 return MochiKit.Async.succeed(MochiKit.Base.keys(this.transientState()).length != 0);
713 }, this)
714 });
715 deferredResult.addCallback(Clipperz.Async.or);
716 deferredResult.callback();
717
718 return deferredResult;
719 },
720
721 //=========================================================================
722
723 'prepareRemoteDataWithKey': function (aKey /*, aCurrentKey*/) {
724 var deferredResult;
725 varresult;
726
727 result = {};
728 deferredResult = new Clipperz.Async.Deferred("User.prepareRemoteDataWithKey", {trace:false});
729 deferredResult.addMethod(this, 'invokeMethodNamedOnHeader', 'prepareRemoteDataWithKey', aKey /*, aCurrentKey*/);
730 deferredResult.addCallback(MochiKit.Base.bind(function (aResult, someHeaderPackedData) {
731 var header;
732
733 header = {};
734 header['records'] = someHeaderPackedData['recordIndex']['records'];
735 header['directLogins'] = someHeaderPackedData['recordIndex']['directLogins'];
736 header['preferences'] = {'data': someHeaderPackedData['preferences']['data']}; // this._serverData['header']['preferences']; // Clipperz.Base.evalJSON(this._serverData['header']['data'])['preferences']; //???????????
737 header['oneTimePasswords'] = {'data': someHeaderPackedData['oneTimePasswords']['data']}; // this._serverData['header']['oneTimePasswords']; // Clipperz.Base.evalJSON(this._serverData['header']['data'])['oneTimePasswords']; //???????????
738 header['version'] = '0.1';
739
740 aResult['header'] = Clipperz.Base.serializeJSON(header);
741 aResult['statistics'] = this._serverData['statistics']; //"someHeaderPackedData['statistics']['data']";
742
743 return aResult;
744 }, this), result);
745 deferredResult.addCallback(Clipperz.Async.setItem, result, 'version', Clipperz.PM.Crypto.encryptingFunctions.currentVersion);
746 deferredResult.addCallback(Clipperz.Async.setItem, result, 'lock', this.serverLockValue());
747 deferredResult.callback();
748
749 return deferredResult;
750 },
751
752 //=========================================================================
753
754 'saveChanges': function () {
755 vardeferredResult;
756 var messageParameters;
757
758 messageParameters = {};
759
760 deferredResult = new Clipperz.Async.Deferred("User.saveChangaes", {trace:false});
761
762 deferredResult.addMethod(this, 'getHeaderIndex', 'recordsIndex');
763 deferredResult.addCallback(MochiKit.Base.methodcaller('prepareRemoteDataForChangedRecords'));
764 deferredResult.addCallback(Clipperz.Async.setItem, messageParameters, 'records');
765 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
766
767 deferredResult.addMethod(this, 'getPassphrase');
768 deferredResult.addMethod(this, 'prepareRemoteDataWithKey');
769 deferredResult.addCallback(Clipperz.Async.setItem, messageParameters, 'user');
770 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
771
772 deferredResult.addCallback(MochiKit.Async.succeed, messageParameters);
773 deferredResult.addMethod(this.connection(), 'message', 'saveChanges');
774 deferredResult.addCallback(MochiKit.Base.update, this.transientState())
775 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
776
777 deferredResult.addMethod(this, 'commitTransientState');
778 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
779 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'userDataSuccessfullySaved');
780
781 deferredResult.addErrbackPass(MochiKit.Base.method(this, 'revertChanges'));
782 deferredResult.addErrbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'failureWhileSavingUserData');
783
784 deferredResult.callback();
785
786 return deferredResult;
787 },
788
789 //=========================================================================
790 __syntaxFix__: "syntax fix"
791});
792
793//-----------------------------------------------------------------------------
794
795Clipperz.PM.DataModel.User.registerNewAccount = function (anUsername, aPassphraseFunction) {
796 vardeferredResult;
797 var user;
798
799 user = new Clipperz.PM.DataModel.User({'username':anUsername, 'getPassphraseFunction':aPassphraseFunction});
800
801 deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.User.registerNewAccount", {trace:false});
802 deferredResult.addMethod(user, 'registerAsNewAccount');
803 deferredResult.addMethod(user, 'login');
804 deferredResult.addCallback(MochiKit.Async.succeed, user);
805 deferredResult.callback();
806
807 return deferredResult;
808}
809
810//-----------------------------------------------------------------------------
811
812Clipperz.PM.DataModel.User.exception = {
813 LoginFailed: new MochiKit.Base.NamedError("Clipperz.PM.DataModel.User.exception.LoginFailed"),
814 CredentialUpgradeFailed:new MochiKit.Base.NamedError("Clipperz.PM.DataModel.User.exception.CredentialUpgradeFailed")
815};
816
817//-----------------------------------------------------------------------------
diff --git a/frontend/gamma/js/Clipperz/PM/Date.js b/frontend/gamma/js/Clipperz/PM/Date.js
new file mode 100644
index 0000000..a131357
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/Date.js
@@ -0,0 +1,201 @@
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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Date) == 'undefined') { Clipperz.PM.Date = {}; }
32
33Clipperz.PM.Date.VERSION = "0.1";
34Clipperz.PM.Date.NAME = "Clipperz.PM.Date";
35
36MochiKit.Base.update(Clipperz.PM.Date, {
37
38 '__repr__': function () {
39 return "[" + this.NAME + " " + this.VERSION + "]";
40 },
41
42 //-------------------------------------------------------------------------
43
44 'toString': function () {
45 return this.__repr__();
46 },
47
48 //-------------------------------------------------------------------------
49
50 'locale': function() {
51 return {
52 'amDesignation':Clipperz.PM.Strings.getValue('calendarStrings.amDesignation'),
53 'pmDesignation':Clipperz.PM.Strings.getValue('calendarStrings.pmDesignation'),
54 'days': Clipperz.PM.Strings.getValue('calendarStrings.days'),
55 'shortDays': Clipperz.PM.Strings.getValue('calendarStrings.shortDays'),
56 'shortMonths': Clipperz.PM.Strings.getValue('calendarStrings.shortMonths'),
57 'months': Clipperz.PM.Strings.getValue('calendarStrings.months')
58 }
59 },
60
61 //=========================================================================
62/*
63 'formatDateWithPHPLikeTemplate': function(aDate, aTemplate) {
64 return Clipperz.Date.formatDateWithPHPLikeTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale());
65 },
66
67 'parseDateWithPHPLikeTemplate': function(aDate, aTemplate) {
68 return Clipperz.Date.parseDateWithPHPTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale());
69 },
70
71 //=========================================================================
72
73 'formatDateWithJavaLikeTemplate': function(aDate, aTemplate) {
74 return Clipperz.Date.formatDateWithJavaLikeTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale());
75 },
76
77 'parseDateWithJavaLikeTemplate': function(aDate, aTemplate) {
78 return Clipperz.Date.parseDateWithJavaLikeTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale());
79 },
80*/
81 //=========================================================================
82
83 'formatWithTemplate': function (aTemplate, aDate) {
84 return Clipperz.PM.Date.formatDateWithTemplate(aDate, aTemplate);
85 },
86
87 'formatDateWithTemplate': function(aDate, aTemplate) {
88 var result;
89
90 if (aDate == null) {
91 result = ""
92 } else {
93 result = Clipperz.Date.formatDateWithPHPLikeTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale());
94 };
95
96 return result;
97 },
98
99 'parseDateWithTemplate': function(aValue, aTemplate) {
100 return Clipperz.Date.parseDateWithPHPTemplateAndLocale(aValue, aTemplate, Clipperz.PM.Date.locale());
101 },
102
103 //=========================================================================
104
105 'formatDateWithUTCFormat': function(aDate) {
106 return Clipperz.Date.formatDateWithUTCFormatAndLocale(aDate, Clipperz.PM.Date.locale());
107 },
108
109 'parseDateWithUTCFormat': function(aValue) {
110 var result;
111
112 if (aValue == null) {
113 result = null;
114 } else {
115 result = Clipperz.Date.parseDateWithUTCFormatAndLocale(aValue, Clipperz.PM.Date.locale());
116 }
117
118 return result;
119 },
120
121 //=========================================================================
122
123 'getElapsedTimeDescription': function(aDate) {
124 var result;
125
126 result = ""
127
128 if (aDate != null) {
129 var now;
130 var elapsedTime;
131
132 var millisencondsInAMinute;
133 var millisencondsInAnHour;
134 var millisencondsInADay;
135 var millisencondsInAWeek;
136 var millisencondsInAMonth;
137
138 now = new Date();
139 elapsedTime = now.getTime() - aDate.getTime();
140
141 millisencondsInAMinute = 60 * 1000;
142 millisencondsInAnHour = millisencondsInAMinute * 60;
143 millisencondsInADay = millisencondsInAnHour * 24;
144 millisencondsInAWeek = millisencondsInADay * 7;
145 millisencondsInAMonth = millisencondsInAWeek * 5;
146
147 if ((elapsedTime / millisencondsInAMonth) > 1) {
148 result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.MORE_THAN_A_MONTH_AGO');
149 } else if ((elapsedTime / millisencondsInAWeek) > 1) {
150 var elapsedWeeks;
151
152 elapsedWeeks = Math.floor((elapsedTime / millisencondsInAWeek));
153 if (elapsedWeeks == 1) {
154 result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.MORE_THAN_A_WEEK_AGO');
155 } else {
156 result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.MORE_THAN_*_WEEKS_AGO').replace(/__elapsed__/, elapsedWeeks);
157 }
158 } else if ((elapsedTime / millisencondsInADay) > 1) {
159 var elapsedDays;
160
161 elapsedDays = Math.floor((elapsedTime / millisencondsInADay));
162 if (elapsedDays == 1) {
163 result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.YESTERDAY');
164 } else {
165 result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.*_DAYS_AGO').replace(/__elapsed__/, elapsedDays);
166 }
167 } else if ((elapsedTime / millisencondsInAnHour) > 1) {
168 var elapsedHours;
169
170 elapsedHours = Math.floor((elapsedTime / millisencondsInAnHour));
171 if (elapsedHours == 1) {
172 result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.ABOUT_AN_HOUR_AGO');
173 } else {
174 result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.*_HOURS_AGO').replace(/__elapsed__/, elapsedHours);
175 }
176 } else {
177 var elapsed10Minutes;
178
179 elapsed10Minutes = (Math.floor((elapsedTime / millisencondsInAMinute) / 10)) * 10;
180 if (elapsed10Minutes == 0) {
181 result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.JUST_A_FEW_MINUTES_AGO');
182 } else {
183 result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.ABOUT_*_MINUTES_AGO').replace(/__elapsed__/, elapsed10Minutes+"");
184 }
185 }
186 }
187
188 return result;
189 },
190
191 //-------------------------------------------------------------------------
192
193 'parse': function (aValue) {
194 return Clipperz.PM.Date.parseDateWithUTCFormat(aValue);
195 },
196
197 //-------------------------------------------------------------------------
198 __syntaxFix__: "syntax fix"
199
200});
201
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy.js b/frontend/gamma/js/Clipperz/PM/Proxy.js
new file mode 100644
index 0000000..d90bcb7
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/Proxy.js
@@ -0,0 +1,172 @@
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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31
32//=============================================================================
33
34Clipperz.PM.Proxy = function(args) {
35 args = args || {};
36
37 this._shouldPayTolls = args.shouldPayTolls || false;
38
39 this._tolls = {
40 'CONNECT':[],
41 'REGISTER':[],
42 'MESSAGE':[]
43 };
44
45 if (args.isDefault === true) {
46 Clipperz.PM.Proxy.defaultProxy = this;
47 }
48
49 return this;
50}
51
52Clipperz.PM.Proxy.prototype = MochiKit.Base.update(null, {
53
54 'toString': function() {
55 return "Clipperz.PM.Proxy";
56 },
57
58 //=========================================================================
59
60 'shouldPayTolls': function() {
61 return this._shouldPayTolls;
62 },
63
64 //-------------------------------------------------------------------------
65
66 'tolls': function() {
67 return this._tolls;
68 },
69
70 //-------------------------------------------------------------------------
71
72 'payToll': function(aRequestType, someParameters) {
73 vardeferredResult;
74
75//console.log(">>> Proxy.payToll", aRequestType, someParameters);
76 if (this.shouldPayTolls()) {
77 deferredResult = new Clipperz.Async.Deferred("Proxy.payToll", {trace:false});
78
79 if (this.tolls()[aRequestType].length == 0) {
80 deferredResult.addMethod(this, 'sendMessage', 'knock', {requestType:aRequestType});
81 deferredResult.addMethod(this, 'setTollCallback');
82 }
83 deferredResult.addMethod(this.tolls()[aRequestType], 'pop');
84 deferredResult.addCallback(MochiKit.Base.methodcaller('deferredPay'));
85 deferredResult.addCallback(function(aToll) {
86 var result;
87
88 result = {
89 parameters: someParameters,
90 toll: aToll
91 }
92
93 return result;
94 });
95
96 deferredResult.callback();
97 } else {
98 deferredResult = MochiKit.Async.succeed({parameters:someParameters});
99 }
100//console.log("<<< Proxy.payToll");
101
102 return deferredResult;
103 },
104
105 //-------------------------------------------------------------------------
106
107 'addToll': function(aToll) {
108//console.log(">>> Proxy.addToll", aToll);
109 this.tolls()[aToll.requestType()].push(aToll);
110//console.log("<<< Proxy.addToll");
111 },
112
113 //=========================================================================
114
115 'setTollCallback': function(someParameters) {
116//console.log(">>> Proxy.setTollCallback", someParameters);
117 if (typeof(someParameters['toll']) != 'undefined') {
118//console.log("added a new toll", someParameters['toll']);
119 this.addToll(new Clipperz.PM.Toll(someParameters['toll']));
120 }
121//console.log("<<< Proxy.setTallCallback", someParameters['result']);
122 return someParameters['result'];
123 },
124
125 //=========================================================================
126
127 'registration': function (someParameters) {
128 return this.processMessage('registration', someParameters, 'REGISTER');
129 },
130
131 'handshake': function (someParameters) {
132 return this.processMessage('handshake', someParameters, 'CONNECT');
133 },
134
135 'message': function (someParameters) {
136 return this.processMessage('message', someParameters, 'MESSAGE');
137 },
138
139 'logout': function (someParameters) {
140 return this.processMessage('logout', someParameters, 'MESSAGE');
141 },
142
143 //=========================================================================
144
145 'processMessage': function (aFunctionName, someParameters, aRequestType) {
146 vardeferredResult;
147
148 deferredResult = new Clipperz.Async.Deferred("Proxy.processMessage", {trace:false});
149 deferredResult.addMethod(this, 'payToll', aRequestType);
150 deferredResult.addMethod(this, 'sendMessage', aFunctionName);
151 deferredResult.addMethod(this, 'setTollCallback');
152 deferredResult.callback(someParameters);
153
154 return deferredResult;
155 },
156
157 //=========================================================================
158
159 'sendMessage': function () {
160 throw Clipperz.Base.exception.AbstractMethod;
161 },
162
163 //=========================================================================
164
165 'isReadOnly': function () {
166 return false;
167 },
168
169 //=========================================================================
170 __syntaxFix__: "syntax fix"
171
172});
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.JSON.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.JSON.js
new file mode 100755
index 0000000..65b46de
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.JSON.js
@@ -0,0 +1,94 @@
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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31
32//=============================================================================
33
34Clipperz.PM.Proxy.JSON = function(args) {
35 Clipperz.PM.Proxy.JSON.superclass.constructor.call(this, args);
36
37 this._url = args.url || Clipperz.Base.exception.raise('MandatoryParameter');
38
39 return this;
40}
41
42Clipperz.Base.extend(Clipperz.PM.Proxy.JSON, Clipperz.PM.Proxy, {
43
44 'toString': function() {
45 return "Clipperz.PM.Proxy.JSON";
46 },
47
48 //=========================================================================
49
50 'url': function () {
51 return this._url;
52 },
53
54 //=========================================================================
55
56 'sendMessage': function(aFunctionName, someParameters) {
57 vardeferredResult;
58 var parameters;
59
60 parameters = {
61 method: aFunctionName,
62 // version: someParameters['version'],
63 // message: someParameters['message'],
64 parameters: Clipperz.Base.serializeJSON(someParameters)
65 };
66
67 deferredResult = new Clipperz.Async.Deferred("Proxy.JSON.sendMessage", {trace:false});
68 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'remoteRequestSent');
69 deferredResult.addCallback(MochiKit.Async.doXHR, this.url(), {
70 method:'POST',
71 sendContent:MochiKit.Base.queryString(parameters),
72 headers:{"Content-Type":"application/x-www-form-urlencoded"}
73 });
74 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'remoteRequestReceived');
75 // deferredResult.addCallback(MochiKit.Async.evalJSONRequest);
76 deferredResult.addCallback(MochiKit.Base.itemgetter('responseText'));
77 deferredResult.addCallback(Clipperz.Base.evalJSON);
78 deferredResult.addCallback(function (someValues) {
79 if (someValues['result'] == 'EXCEPTION') {
80 throw someValues['message'];
81 }
82
83 return someValues;
84 })
85 // return MochiKit.Base.evalJSON(req.responseText);
86 deferredResult.callback();
87
88 return deferredResult;
89 },
90
91 //=========================================================================
92 __syntaxFix__: "syntax fix"
93
94});
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js
new file mode 100644
index 0000000..de8e7f6
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js
@@ -0,0 +1,811 @@
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
29try { if (typeof(Clipperz.PM.Proxy.Offline) == 'undefined') { throw ""; }} catch (e) {
30 throw "Clipperz.PM.Proxy.Offline.DataStore depends on Clipperz.PM.Proxy.Offline!";
31}
32
33//=============================================================================
34
35Clipperz.PM.Proxy.Offline.DataStore = function(args) {
36 args = args || {};
37
38 this._data = args.data || (typeof(_clipperz_dump_data_) != 'undefined' ? _clipperz_dump_data_ : null);
39 this._isReadOnly = (typeof(args.readOnly) == 'undefined' ? true : args.readOnly);
40 this._shouldPayTolls = args.shouldPayTolls || false;
41
42 this._tolls = {};
43 this._currentStaticConnection = null;
44
45 return this;
46}
47
48Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, {
49
50 //-------------------------------------------------------------------------
51
52 'isReadOnly': function () {
53 return this._isReadOnly;
54 },
55
56 //-------------------------------------------------------------------------
57
58 'shouldPayTolls': function() {
59 return this._shouldPayTolls;
60 },
61
62 //-------------------------------------------------------------------------
63
64 'data': function () {
65 return this._data;
66 },
67
68 //-------------------------------------------------------------------------
69
70 'tolls': function () {
71 return this._tolls;
72 },
73
74 //=========================================================================
75
76 'resetData': function() {
77 this._data = {
78 'users': {
79 'catchAllUser': {
80 __masterkey_test_value__: 'masterkey',
81 s: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00',
82 v: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00'
83 }
84 }
85 };
86 },
87
88 //-------------------------------------------------------------------------
89
90 'setupWithEncryptedData': function(someData) {
91 this._data = Clipperz.Base.deepClone(someData);
92 },
93
94 //-------------------------------------------------------------------------
95
96 'setupWithData': function(someData) {
97 var deferredResult;
98 var resultData;
99 var i, c;
100
101//Clipperz.log(">>> Proxy.Test.setupWithData");
102 resultData = this._data;
103
104 deferredResult = new Clipperz.Async.Deferred("Proxy.Test.seupWithData", {trace:false});
105 c = someData['users'].length;
106
107 for (i=0; i<c; i++) {
108 varnewConnection;
109 varrecordConfiguration;
110
111 deferredResult.addMethod(this, 'userSerializedEncryptedData', someData['users'][i]);
112 deferredResult.addCallback(MochiKit.Base.bind(function(aUserSerializationContext) {
113//console.log("SERIALIZED USER", aUserSerializationContext);
114 resultData['users'][aUserSerializationContext['credentials']['C']] = {
115 's': aUserSerializationContext['credentials']['s'],
116 'v': aUserSerializationContext['credentials']['v'],
117 'version': aUserSerializationContext['data']['connectionVersion'],
118 'userDetails': aUserSerializationContext['encryptedData']['user']['header'],
119 'userDetailsVersion':aUserSerializationContext['encryptedData']['user']['version'],
120 'statistics': aUserSerializationContext['encryptedData']['user']['statistics'],
121 'lock': aUserSerializationContext['encryptedData']['user']['lock'],
122 'records': this.rearrangeRecordsData(aUserSerializationContext['encryptedData']['records'])
123 }
124 }, this));
125 }
126
127 deferredResult.addCallback(MochiKit.Base.bind(function() {
128//console.log("this._data", resultData);
129 this._data = resultData;
130 }, this));
131
132 deferredResult.callback();
133//Clipperz.log("<<< Proxy.Test.setupWithData");
134
135 return deferredResult;
136 },
137
138 //=========================================================================
139
140 'getTollForRequestType': function (aRequestType) {
141 varresult;
142 vartargetValue;
143 var cost;
144
145 targetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2);
146 switch (aRequestType) {
147 case 'REGISTER':
148 cost = 5;
149 break;
150 case 'CONNECT':
151 cost = 5;
152 break;
153 case 'MESSAGE':
154 cost = 2;
155 break;
156 }
157
158 result = {
159 requestType: aRequestType,
160 targetValue: targetValue,
161 cost: cost
162 }
163
164 if (this.shouldPayTolls()) {
165 this.tolls()[targetValue] = result;
166 }
167
168 return result;
169 },
170
171 //-------------------------------------------------------------------------
172
173 'checkToll': function (aFunctionName, someParameters) {
174 if (this.shouldPayTolls()) {
175 var localToll;
176 vartollParameters;
177
178 tollParameters = someParameters['toll'];
179 localToll = this.tolls()[tollParameters['targetValue']];
180
181 if (localToll != null) {
182 if (! Clipperz.PM.Toll.validate(tollParameters['targetValue'], tollParameters['toll'], localToll['cost'])) {
183 throw "Toll value too low.";
184 };
185 } else {
186 throw "Missing toll";
187 }
188 }
189 },
190
191 //=========================================================================
192
193 'currentStaticConnection': function () {
194 if (this._currentStaticConnection == null) {
195 this._currentStaticConnection = {};
196 }
197
198 return this._currentStaticConnection;
199 },
200
201 //-------------------------------------------------------------------------
202
203 'getConnectionForRequest': function (aFunctionName, someParameters) {
204 varresult;
205
206 if (this.shouldPayTolls()) {
207 if ((typeof(someParameters['toll']) != 'undefined') && (typeof(someParameters['toll']['targetValue']) != 'undefined')) {
208 result = this.tolls()[someParameters['toll']['targetValue']]['connection'];
209 if (typeof(result) == 'undefined') {
210 result = {};
211 }
212 } else {
213 result = {};
214 }
215 } else {
216 result = this.currentStaticConnection();
217 }
218
219 return result;
220 },
221
222 //-------------------------------------------------------------------------
223
224 'storeConnectionForRequestWithConnectionAndResponse': function (aFunctionName, someParameters, aConnection, aResponse) {
225 if (this.shouldPayTolls()) {
226 if ((typeof(aResponse['toll']) != 'undefined')
227 &&(typeof(aResponse['toll']['targetValue']) != 'undefined')
228 &&(typeof(this.tolls()[aResponse['toll']['targetValue']]) != 'undefined')
229 ) {
230 this.tolls()[aResponse['toll']['targetValue']]['connection'] = aConnection;
231 }
232 }
233 },
234
235 //=========================================================================
236
237 'processMessage': function (aFunctionName, someParameters) {
238 var result;
239 varconnection;
240
241 connection = this.getConnectionForRequest(aFunctionName, someParameters);
242
243 switch(aFunctionName) {
244 case 'knock':
245 result = this._knock(connection, someParameters);
246 break;
247 case 'registration':
248 this.checkToll(aFunctionName, someParameters);
249 result = this._registration(connection, someParameters.parameters);
250 break;
251 case 'handshake':
252 this.checkToll(aFunctionName, someParameters);
253 result = this._handshake(connection, someParameters.parameters);
254 break;
255 case 'message':
256 this.checkToll(aFunctionName, someParameters);
257 result = this._message(connection, someParameters.parameters);
258 break;
259 case 'logout':
260 this._currentStaticConnection = null;
261 result = this._logout(connection, someParameters.parameters);
262 break;
263 }
264
265 this.storeConnectionForRequestWithConnectionAndResponse(aFunctionName, someParameters, connection, result);
266
267 return MochiKit.Async.succeed(result);
268 },
269
270 //=========================================================================
271
272 '_knock': function(aConnection, someParameters) {
273 var result;
274
275 result = {
276 toll: this.getTollForRequestType(someParameters['requestType'])
277 }
278
279 return result;
280 },
281
282 //-------------------------------------------------------------------------
283
284 '_registration': function(aConnection, someParameters) {
285 if (this.isReadOnly() == false) {
286 if (typeof(this.data()['users'][someParameters['credentials']['C']]) == 'undefined') {
287 this.data()['users'][someParameters['credentials']['C']] = {
288 's': someParameters['credentials']['s'],
289 'v': someParameters['credentials']['v'],
290 'version':someParameters['credentials']['version'],
291 'lock': Clipperz.Crypto.Base.generateRandomSeed(),
292 'userDetails': someParameters['user']['header'],
293 'statistics': someParameters['user']['statistics'],
294 'userDetailsVersion':someParameters['user']['version'],
295 'records':{}
296 }
297 } else {
298 throw "user already exists";
299 }
300 } else {
301 throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly;
302 }
303
304 result = {
305 result: {
306 'lock': this.data()['users'][someParameters['credentials']['C']]['lock'],
307 'result':'done'
308 },
309 toll: this.getTollForRequestType('CONNECT')
310 }
311
312 return result;
313 },
314
315 //-------------------------------------------------------------------------
316
317 '_handshake': function(aConnection, someParameters) {
318 var result;
319 varnextTollRequestType;
320
321 result = {};
322 if (someParameters.message == "connect") {
323 var userData;
324 var randomBytes;
325 var v;
326
327 userData = this.data()['users'][someParameters.parameters.C];
328
329 if ((typeof(userData) != 'undefined') && (userData['version'] == someParameters.version)) {
330 aConnection['userData'] = userData;
331 aConnection['C'] = someParameters.parameters.C;
332 } else {
333 aConnection['userData'] = this.data()['users']['catchAllUser'];
334 }
335
336 randomBytes = Clipperz.Crypto.Base.generateRandomSeed();
337 aConnection['b'] = new Clipperz.Crypto.BigInt(randomBytes, 16);
338 v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16);
339 aConnection['B'] = v.add(Clipperz.Crypto.SRP.g().powerModule(aConnection['b'], Clipperz.Crypto.SRP.n()));
340
341 aConnection['A'] = someParameters.parameters.A;
342
343 result['s'] = aConnection['userData']['s'];
344 result['B'] = aConnection['B'].asString(16);
345
346 nextTollRequestType = 'CONNECT';
347 } else if (someParameters.message == "credentialCheck") {
348 var v, u, S, A, K, M1;
349
350 v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16);
351 u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(aConnection['B'].asString(10))).toHexString(), 16);
352 A = new Clipperz.Crypto.BigInt(aConnection['A'], 16);
353 S = (A.multiply(v.powerModule(u, Clipperz.Crypto.SRP.n()))).powerModule(aConnection['b'], Clipperz.Crypto.SRP.n());
354
355 K = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(S.asString(10))).toHexString().slice(2);
356
357 M1 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + aConnection['B'].asString(10) + K)).toHexString().slice(2);
358 if (someParameters.parameters.M1 == M1) {
359 var M2;
360
361 M2 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + someParameters.parameters.M1 + K)).toHexString().slice(2);
362 result['M2'] = M2;
363 } else {
364 throw new Error("Client checksum verification failed! Expected <" + M1 + ">, received <" + someParameters.parameters.M1 + ">.", "Error");
365 }
366
367 nextTollRequestType = 'MESSAGE';
368 } else if (someParameters.message == "oneTimePassword") {
369 var otpData;
370
371 otpData = this.data()['onetimePasswords'][someParameters.parameters.oneTimePasswordKey];
372
373 try {
374 if (typeof(otpData) != 'undefined') {
375 if (otpData['status'] == 'ACTIVE') {
376 if (otpData['key_checksum'] == someParameters.parameters.oneTimePasswordKeyChecksum) {
377 result = {
378 'data': otpData['data'],
379 'version':otpData['version']
380 }
381
382 otpData['status'] = 'REQUESTED';
383 } else {
384 otpData['status'] = 'DISABLED';
385 throw "The requested One Time Password has been disabled, due to a wrong keyChecksum";
386 }
387 } else {
388 throw "The requested One Time Password was not active";
389 }
390 } else {
391 throw "The requested One Time Password has not been found"
392 }
393 } catch (exception) {
394 result = {
395 'data': Clipperz.PM.Crypto.randomKey(),
396 'version':Clipperz.PM.Connection.communicationProtocol.currentVersion
397 }
398 }
399 nextTollRequestType = 'CONNECT';
400 } else {
401 MochiKit.Logging.logError("Clipperz.PM.Proxy.Test.handshake - unhandled message: " + someParameters.message);
402 }
403
404 result = {
405 result: result,
406 toll: this.getTollForRequestType(nextTollRequestType)
407 }
408
409 return result;
410 },
411
412 //-------------------------------------------------------------------------
413
414 '_message': function(aConnection, someParameters) {
415 var result;
416
417 result = {};
418
419 //=====================================================================
420 //
421 // R E A D - O N L Y M e t h o d s
422 //
423 //=====================================================================
424 if (someParameters.message == 'getUserDetails') {
425 var recordsStats;
426 var recordReference;
427
428 recordsStats = {};
429 for (recordReference in aConnection['userData']['records']) {
430 recordsStats[recordReference] = {
431 'updateDate': aConnection['userData']['records'][recordReference]['updateDate']
432 }
433 }
434
435 result['header'] = this.userDetails(aConnection);
436 result['statistics'] = this.statistics(aConnection);
437 result['maxNumberOfRecords'] = aConnection['userData']['maxNumberOfRecords'];
438 result['version'] = aConnection['userData']['userDetailsVersion'];
439 result['recordsStats'] = recordsStats;
440
441 if (this.isReadOnly() == false) {
442 varlock;
443
444 if (typeof(aConnection['userData']['lock']) == 'undefined') {
445 aConnection['userData']['lock'] = "<<LOCK>>";
446 }
447
448 result['lock'] = aConnection['userData']['lock'];
449 }
450
451 //=====================================================================
452 } else if (someParameters.message == 'getRecordDetail') {
453/*
454 varrecordData;
455 var currentVersionData;
456
457 recordData = this.userData()['records'][someParameters['parameters']['reference']];
458 result['reference'] = someParameters['parameters']['reference'];
459 result['data'] = recordData['data'];
460 result['version'] = recordData['version'];
461 result['creationData'] = recordData['creationDate'];
462 result['updateDate'] = recordData['updateDate'];
463 result['accessDate'] = recordData['accessDate'];
464
465 currentVersionData = recordData['versions'][recordData['currentVersion']];
466
467 result['currentVersion'] = {};
468 result['currentVersion']['reference'] = recordData['currentVersion'];
469 result['currentVersion']['version'] = currentVersionData['version'];
470 result['currentVersion']['header'] = currentVersionData['header'];
471 result['currentVersion']['data'] = currentVersionData['data'];
472 result['currentVersion']['creationData'] = currentVersionData['creationDate'];
473 result['currentVersion']['updateDate'] = currentVersionData['updateDate'];
474 result['currentVersion']['accessDate'] = currentVersionData['accessDate'];
475 if (typeof(currentVersionData['previousVersion']) != 'undefined') {
476 result['currentVersion']['previousVersionKey'] = currentVersionData['previousVersionKey'];
477 result['currentVersion']['previousVersion'] = currentVersionData['previousVersion'];
478 }
479*/
480 MochiKit.Base.update(result, aConnection['userData']['records'][someParameters['parameters']['reference']]);
481 result['reference'] = someParameters['parameters']['reference'];
482
483 //=====================================================================
484 //
485 // R E A D - W R I T E M e t h o d s
486 //
487 //=====================================================================
488 } else if (someParameters.message == 'upgradeUserCredentials') {
489 if (this.isReadOnly() == false) {
490 var parameters;
491 var credentials;
492
493 parameters = someParameters['parameters'];
494 credentials = parameters['credentials'];
495
496 if ((credentials['C'] == null)
497 ||(credentials['s'] == null)
498 ||(credentials['v'] == null)
499 ||(credentials['version'] != Clipperz.PM.Connection.communicationProtocol.currentVersion)
500 ) {
501 result = Clipperz.PM.DataModel.User.exception.CredentialUpgradeFailed;
502 } else {
503 varoldCValue;
504 oldCValue = aConnection['C'];
505
506 this.data()['users'][credentials['C']] = aConnection['userData'];
507 aConnection['C'] = credentials['C'];
508
509 aConnection['userData']['s'] = credentials['s'];
510 aConnection['userData']['v'] = credentials['v'];
511 aConnection['userData']['version'] = credentials['version'];
512
513 aConnection['userData']['userDetails'] = parameters['user']['header'];
514 aConnection['userData']['userDetailsVersion'] = parameters['user']['version'];
515 aConnection['userData']['statistics'] = parameters['user']['statistics'];
516
517 aConnection['userData']['lock'] = parameters['user']['lock'];
518
519 delete this.data()['users'][oldCValue];
520
521 result = {result:"done", parameters:parameters};
522 }
523 } else {
524 throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly;
525 }
526 //=====================================================================
527 /* } else if (someParameters.message == 'updateData') {
528 if (this.isReadOnly() == false) {
529 var i, c;
530
531//console.log("###===============================================================");
532//console.log("###>>>", Clipperz.Base.serializeJSON(someParameters));
533//console.log("###--- userData", Clipperz.Base.serializeJSON(this.userData()));
534 if (this.userData()['lock']!= someParameters['parameters']['user']['lock']) {
535 throw "the lock attribute is not processed correctly"
536 }
537
538 this.userData()['userDetails'] = someParameters['parameters']['user']['header'];
539 this.userData()['statistics'] = someParameters['parameters']['user']['statistics'];
540 this.userData()['userDetailsVersions']= someParameters['parameters']['user']['version'];
541
542 c = someParameters['parameters']['records'].length;
543 for (i=0; i<c; i++) {
544 var currentRecord;
545 var currentRecordData;
546
547 currentRecordData = someParameters['parameters']['records'][i];
548 currentRecord = this.userData()['records'][currentRecordData['record']['reference']];
549
550 if (currentRecord == null) {
551 }
552
553 currentRecord['data'] = currentRecordData['record']['data'];
554 currentRecord['version'] = currentRecordData['record']['version'];
555 currentRecord['currentVersion'] = currentRecordData['currentRecordVersion']['reference'];
556
557 currentRecord['versions'][currentRecordData['currentRecordVersion']['reference']] = {
558 'data': currentRecordData['currentRecordVersion']['data'],
559 'version': currentRecordData['currentRecordVersion']['version'],
560 'previousVersion': currentRecordData['currentRecordVersion']['previousVersion'],
561 'previousVersionKey':currentRecordData['currentRecordVersion']['previousVersionKey']
562 }
563 }
564
565 this.userData()['lock'] = Clipperz.PM.Crypto.randomKey();
566 result['lock'] = this.userData()['lock'];
567 result['result'] = 'done';
568//console.log("###<<< userData", Clipperz.Base.serializeJSON(this.userData()));
569 } else {
570 throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly;
571 }
572 */ //=====================================================================
573 } else if (someParameters.message == 'saveChanges') {
574 if (this.isReadOnly() == false) {
575 var i, c;
576
577//console.log("###===============================================================");
578//console.log("###>>>", someParameters);
579//console.log("###>>>", Clipperz.Base.serializeJSON(someParameters));
580//console.log("###--- userData", Clipperz.Base.serializeJSON(this.userData()));
581//console.log("###===============================================================");
582//console.log("--- userData.lock ", this.userData()['lock']);
583//console.log("--- parameters.lock", someParameters['parameters']['user']['lock']);
584 if (aConnection['userData']['lock']!= someParameters['parameters']['user']['lock']) {
585 throw "the lock attribute is not processed correctly"
586 }
587
588 aConnection['userData']['userDetails'] = someParameters['parameters']['user']['header'];
589 aConnection['userData']['statistics'] = someParameters['parameters']['user']['statistics'];
590 aConnection['userData']['userDetailsVersions']= someParameters['parameters']['user']['version'];
591
592 c = someParameters['parameters']['records']['updated'].length;
593 for (i=0; i<c; i++) {
594 var currentRecord;
595 var currentRecordData;
596
597 currentRecordData = someParameters['parameters']['records']['updated'][i];
598 currentRecord = aConnection['userData']['records'][currentRecordData['record']['reference']];
599
600 if (
601 (typeof(aConnection['userData']['records'][currentRecordData['record']['reference']]) == 'undefined')
602 &&
603 (typeof(currentRecordData['currentRecordVersion']) == 'undefined')
604 ) {
605//console.log("######## SHIT HAPPENS");
606 throw "Record added without a recordVersion";
607 }
608
609 if (currentRecord == null) {
610 currentRecord = {};
611 currentRecord['versions'] = {};
612 currentRecord['creationDate']= Clipperz.PM.Date.formatDateWithUTCFormat(new Date());
613 currentRecord['accessDate'] = Clipperz.PM.Date.formatDateWithUTCFormat(new Date());
614
615 aConnection['userData']['records'][currentRecordData['record']['reference']] = currentRecord;
616 }
617
618 currentRecord['data'] = currentRecordData['record']['data'];
619 currentRecord['version']= currentRecordData['record']['version'];
620 currentRecord['updateDate']= Clipperz.PM.Date.formatDateWithUTCFormat(new Date());
621
622 if (typeof(currentRecordData['currentRecordVersion']) != 'undefined') {
623 currentRecord['currentVersion'] = currentRecordData['currentRecordVersion']['reference'];
624 currentRecord['versions'][currentRecordData['currentRecordVersion']['reference']] = {
625 'data': currentRecordData['currentRecordVersion']['data'],
626 'version': currentRecordData['currentRecordVersion']['version'],
627 'previousVersion': currentRecordData['currentRecordVersion']['previousVersion'],
628 'previousVersionKey':currentRecordData['currentRecordVersion']['previousVersionKey'],
629 'creationDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date()),
630 'updateDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date()),
631 'accessDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date())
632 }
633 }
634 }
635
636 c = someParameters['parameters']['records']['deleted'].length;
637 for (i=0; i<c; i++) {
638 var currentRecordReference;
639
640 currentRecordReference = someParameters['parameters']['records']['deleted'][i];
641//console.log("DELETING records", currentRecordReference);
642 delete aConnection['userData']['records'][currentRecordReference];
643 }
644
645 aConnection['userData']['lock'] = Clipperz.PM.Crypto.randomKey();
646 result['lock'] = aConnection['userData']['lock'];
647 result['result'] = 'done';
648//console.log("###<<< userData", Clipperz.Base.serializeJSON(this.userData()));
649 } else {
650 throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly;
651 }
652
653 //=====================================================================
654 //
655 // U N H A N D L E D M e t h o d
656 //
657 //=====================================================================
658 } else {
659 MochiKit.Logging.logError("Clipperz.PM.Proxy.Test.message - unhandled message: " + someParameters.message);
660 }
661
662 result = {
663 result: result,
664 toll: this.getTollForRequestType('MESSAGE')
665 }
666
667 // return MochiKit.Async.succeed(result);
668 return result;
669 },
670
671 //-------------------------------------------------------------------------
672
673 '_logout': function(someParameters) {
674 // return MochiKit.Async.succeed({result: 'done'});
675 return {result: 'done'};
676 },
677
678 //=========================================================================
679 //#########################################################################
680
681 'isTestData': function(aConnection) {
682 return (typeof(aConnection['userData']['__masterkey_test_value__']) != 'undefined');
683 },
684
685 'userDetails': function(aConnection) {
686 var result;
687
688 if (this.isTestData(aConnection)) {
689 var serializedHeader;
690 var version;
691
692//MochiKit.Logging.logDebug("### test data");
693 version = aConnection['userData']['userDetailsVersion'];
694 serializedHeader = Clipperz.Base.serializeJSON(aConnection['userData']['userDetails']);
695 result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(aConnection['userData']['__masterkey_test_value__'], serializedHeader);
696 } else {
697//MochiKit.Logging.logDebug("### NOT test data");
698 result = aConnection['userData']['userDetails'];
699 }
700
701 return result;
702 },
703
704 'statistics': function(aConnection) {
705 var result;
706
707 if (aConnection['userData']['statistics'] != null) {
708 if (this.isTestData(aConnection)) {
709 var serializedStatistics;
710 var version;
711
712 version = aConnection['userData']['userDetailsVersion'];
713 serializedStatistics = Clipperz.Base.serializeJSON(aConnection['userData']['statistics']);
714 result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(aConnection['userData']['__masterkey_test_value__'], serializedStatistics);
715 } else {
716 result = aConnection['userData']['statistics'];
717 }
718 } else {
719 result = null;
720 }
721
722 return result;
723 },
724
725/*
726 'userSerializedEncryptedData': function(someData) {
727 var deferredResult;
728 var deferredContext;
729
730 deferredContext = { 'data': someData };
731
732 deferredResult = new Clipperz.Async.Deferred('Proxy.Test.serializeUserEncryptedData', {trace:false});
733 deferredResult.addCallback(MochiKit.Base.bind(function(aDeferredContext) {
734 aDeferredContext['user'] = this.createUserUsingConfigurationData(aDeferredContext['data']);
735 return aDeferredContext;
736 }, this));
737 deferredResult.addCallback(function(aDeferredContext) {
738 // return aDeferredContext['user'].encryptedDataUsingVersion(aDeferredContext['data']['version']);
739 return aDeferredContext['user'].serializedDataUsingVersion(MochiKit.Base.values(aDeferredContext['user'].records()), aDeferredContext['data']['version']);
740 });
741 deferredResult.addCallback(function(aUserEncryptedData) {
742 deferredContext['encryptedData'] = aUserEncryptedData;
743 return deferredContext;
744 });
745 deferredResult.addCallback(function(aDeferredContext) {
746 var connection;
747
748 connection = new Clipperz.PM.Connection.communicationProtocol.versions[aDeferredContext['data']['connectionVersion']]()
749 aDeferredContext['credentials'] = connection.serverSideUserCredentials(aDeferredContext['user'].username(),aDeferredContext['user'].passphrase());
750
751 return aDeferredContext;
752 });
753
754 // deferredResult.addCallback(function(aDeferredContext) {
755//console.log("#-#-#-#-#", aDeferredContext);
756 // return aDeferredContext['user'].serializedDataUsingVersion(MochiKit.Base.values(aDeferredContext['user'].records()), aDeferredContext['data']['version']);
757 // }, deferredContext);
758 // deferredResult.addCallback(function(aUserSerializedData) {
759//console.log("USER SERIALIZED DATA", aUserSerializedData);
760 // });
761//
762 // deferredResult.addCallback(MochiKit.Async.succeed, deferredContext);
763 deferredResult.callback(deferredContext);
764
765 return deferredResult;
766 },
767
768 'createUserUsingConfigurationData': function(someData) {
769 var result;
770 var user;
771 var recordLabel;
772
773 user = new Clipperz.PM.DataModel.User();
774 user.initForTests();
775 user.setUsername(someData['username']);
776 user.setPassphrase(someData['passphrase']);
777
778 for (recordLabel in someData['records']) {
779 var recordData;
780 var record;
781 var i, c;
782
783 recordData = someData['records'][recordLabel];
784 record = new Clipperz.PM.DataModel.Record({user:user, label:recordLabel});
785 record.setNotes(recordData['notes']);
786
787 c = recordData['fields'].length;
788 for (i=0; i<c; i++) {
789 var recordField;
790
791 recordField = new Clipperz.PM.DataModel.RecordField();
792 recordField.setLabel(recordData['fields'][i]['name']);
793 recordField.setValue(recordData['fields'][i]['value']);
794 recordField.setType(recordData['fields'][i]['type']);
795 record.addField(recordField);
796 }
797 user.addRecord(record, true);
798 }
799
800 result = user;
801
802 return result;
803 },
804*/
805 //=========================================================================
806 __syntaxFix__: "syntax fix"
807});
808
809Clipperz.PM.Proxy.Offline.DataStore['exception'] = {
810 'ReadOnly': new MochiKit.Base.NamedError("Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly")
811}; \ No newline at end of file
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.js
new file mode 100644
index 0000000..a15b223
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.js
@@ -0,0 +1,67 @@
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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31
32//=============================================================================
33
34Clipperz.PM.Proxy.Offline = function(args) {
35 args = args || {};
36
37 Clipperz.PM.Proxy.Offline.superclass.constructor.call(this, args);
38
39 this._dataStore = args.dataStore || new Clipperz.PM.Proxy.Offline.DataStore(args);
40
41 return this;
42}
43
44Clipperz.Base.extend(Clipperz.PM.Proxy.Offline, Clipperz.PM.Proxy, {
45
46 'toString': function () {
47 return "Clipperz.PM.Proxy.Offline";
48 },
49
50 //-------------------------------------------------------------------------
51
52 'dataStore': function () {
53 return this._dataStore;
54 },
55
56 //-------------------------------------------------------------------------
57
58 'sendMessage': function(aFunctionName, someParameters) {
59 return this.dataStore().processMessage(aFunctionName, someParameters);
60 },
61
62 //-------------------------------------------------------------------------
63
64 __syntaxFix__: "syntax fix"
65
66});
67
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Test.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Test.js
new file mode 100644
index 0000000..be1c337
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Test.js
@@ -0,0 +1,167 @@
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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Proxy) == 'undefined') { Clipperz.PM.Proxy = {}; }
32
33//=============================================================================
34
35Clipperz.PM.Proxy.Test = function(args) {
36 Clipperz.PM.Proxy.Test.superclass.constructor.call(this, args);
37
38 args = args || {};
39
40 this._expectedRequests = (args.shouldCheckExpectedRequests === true) ? [] : null;
41 this._isExpectingRequests = true;
42 this._unexpectedRequests = [];
43
44 this.dataStore().resetData();
45
46 return this;
47}
48
49Clipperz.Base.extend(Clipperz.PM.Proxy.Test, Clipperz.PM.Proxy.Offline, {
50
51 'toString': function() {
52 return "Clipperz.PM.Proxy.Test";
53 },
54
55 //=========================================================================
56
57 'expectedRequests': function () {
58 return this._expectedRequests;
59 },
60
61 //-------------------------------------------------------------------------
62
63 'shouldCheckExpectedRequests': function () {
64 return (this._expectedRequests != null);
65 },
66
67 'setShouldCheckExpectedRequests': function(aValue) {
68 if (aValue) {
69 this._expectedRequests = aValue;
70 } else {
71 this._expectedRequests = null;
72 }
73 },
74
75 //-------------------------------------------------------------------------
76
77 'shouldNotReceiveAnyFurtherRequest': function () {
78 this._isExpectingRequests = false;
79 },
80
81 'mayReceiveMoreRequests': function () {
82 this._isExpectingRequests = true;
83 this.resetUnexpectedRequests();
84 },
85
86 'isExpectingRequests': function () {
87 return this._isExpectingRequests;
88 },
89
90 //-------------------------------------------------------------------------
91
92 'unexpectedRequests': function () {
93 return this._unexpectedRequests;
94 },
95
96 'resetUnexpectedRequests': function () {
97 this._unexpectedRequests = [];
98 },
99
100 //-------------------------------------------------------------------------
101
102 'testExpectedRequestParameters': function (aPath, anActualRequest, anExpectedRequest) {
103 var aKey;
104//console.log(">>> Proxy.testExpectedRequestParameters [" + aPath + "]", anActualRequest, anExpectedRequest);
105 for (aKey in anExpectedRequest) {
106 if (typeof(anActualRequest[aKey]) == 'undefined') {
107 throw "the expected paramter [" + aKey + "] is missing from the actual request";
108 }
109 if (typeof(anExpectedRequest[aKey]) == 'object') {
110 this.testExpectedRequestParameters(aPath + "." + aKey, anActualRequest[aKey], anExpectedRequest[aKey])
111 } else {
112 if (! anExpectedRequest[aKey](anActualRequest[aKey])) {
113 throw "wrong value for paramter [" + aKey + "]; got '" + anActualRequest[aKey] + "'";
114 }
115 }
116 }
117//console.log("<<< Proxy.testExpectedRequestParameters");
118 },
119
120 //-------------------------------------------------------------------------
121
122 'checkRequest': function(aFunctionName, someParameters) {
123 if (this.shouldCheckExpectedRequests()) {
124 var expectedRequest;
125
126//console.log(">>> Proxy.Test.checkRequest - " + aFunctionName, someParameters);
127 expectedRequest = this.expectedRequests().pop();
128//console.log("--- Proxy.Test.checkRequest - expectedRequest", expectedRequest);
129 if (expectedRequest == null) {
130 throw "Proxy.Test.sentMessage: no expected result specified. Got request '" + aFunctionName + "': " + someParameters;
131 }
132
133 try {
134 if (aFunctionName != expectedRequest.functionName) {
135 throw "wrong function name. Got '" + aFunctionName + "', expected '" + expectedRequest.request.functionName + "'";
136 }
137
138 this.testExpectedRequestParameters("parameters", someParameters, expectedRequest.parameters);
139 } catch(exception) {
140//console.log("EXCEPTION: Proxy.Test.sentMessage[" + expectedRequest.name + "]", exception)
141 throw "Proxy.Test.sentMessage[" + expectedRequest.name + "]: " + exception;
142 }
143 }
144//console.log("<<< Proxy.Test.checkRequest");
145 },
146
147 //=========================================================================
148
149 'sendMessage': function(aFunctionName, someParameters) {
150 var result;
151
152 if (this.isExpectingRequests() == false) {
153 // throw Clipperz.PM.Connection.exception.UnexpectedRequest;
154Clipperz.log("UNEXPECTED REQUEST " + aFunctionName /* + ": " + Clipperz.Base.serializeJSON(someParameters) */);
155 this.unexpectedRequests().push({'functionName':aFunctionName, 'someParameters': someParameters});
156 };
157 this.checkRequest(aFunctionName, someParameters);
158 result = Clipperz.PM.Proxy.Test.superclass.sendMessage.call(this, aFunctionName, someParameters);
159
160 return result;
161 },
162
163 //=========================================================================
164 __syntaxFix__: "syntax fix"
165
166});
167
diff --git a/frontend/gamma/js/Clipperz/PM/Strings.js b/frontend/gamma/js/Clipperz/PM/Strings.js
new file mode 100644
index 0000000..43ef21f
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/Strings.js
@@ -0,0 +1,295 @@
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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; }
32if (typeof(Clipperz.PM.Strings.Languages) == 'undefined') { Clipperz.PM.Strings.Languages = {}; }
33
34//-----------------------------------------------------------------------------
35/*
36Clipperz.PM.Strings.standardStrings = {
37 'loginPanelSwitchLanguageSelectOptions':[
38/ *
39 {tag:'option', html:"Arabic (Oman) (العربية)", value:'ar-OM', disabled:true},
40 {tag:'option', html:"Arabic (Syria) (العربية)", value:'ar-SY', disabled:true},
41 {tag:'option', html:"Bahasa Indonesia", value:'id-ID', disabled:true},
42 {tag:'option', html:"Bulgarian (Български)", value:'bg-BG', disabled:true},
43 {tag:'option', html:"Català", value:'ca-ES', disabled:true},
44 {tag:'option', html:"Chinese (Simplified) (简体中文)", value:'zh-CN', disabled:true},
45 {tag:'option', html:"Chinese (Traditional) (正體中文)", value:'zh-TW', disabled:true},
46 {tag:'option', html:"Czech (Česky)", value:'cs-CZ', disabled:true},
47 {tag:'option', html:"Dansk", value:'da-DK', disabled:true},
48 {tag:'option', html:"Deutsch", value:'de-DE'/ *, disabled:true* /},
49 {tag:'option', html:"English (American)", value:'en-US'/ *, disabled:true* /},
50 {tag:'option', html:"English (British)", value:'en-GB'/ *, disabled:true* /},
51 {tag:'option', html:"English (Canadian)", value:'en-CA'/ *, disabled:true* /},
52 {tag:'option', html:"Español", value:'es-ES', disabled:true},
53 {tag:'option', html:"Eesti", value:'et-EE', disabled:true},
54 {tag:'option', html:"Français", value:'fr-FR', disabled:true},
55 {tag:'option', html:"Galego", value:'gl-ES', disabled:true},
56 {tag:'option', html:"Greek (Ελληνικά)", value:'el-GR', disabled:true},
57 {tag:'option', html:"Íslenska", value:'is-IS', disabled:true},
58 {tag:'option', html:"Italiano", value:'it-IT'/ *, disabled:true* /},
59 {tag:'option', html:"Japanese (日本語)", value:'ja-JP', disabled:true},
60 {tag:'option', html:"Korean (한국어)", value:'ko-KR', disabled:true},
61 {tag:'option', html:"Latviešu", value:'lv-LV', disabled:true},
62 {tag:'option', html:"Lietuvių", value:'lt-LT', disabled:true},
63 {tag:'option', html:"Macedonian (Македонски)", value:'mk-MK', disabled:true},
64 {tag:'option', html:"Magyar", value:'hu-HU', disabled:true},
65 {tag:'option', html:"Nederlands", value:'nl-NL', disabled:true},
66 {tag:'option', html:"Norsk bokmål", value:'nb-NO', disabled:true},
67 {tag:'option', html:"Norsk nynorsk", value:'nn-NO', disabled:true},
68 {tag:'option', html:"Persian (Western) (فارسى)", value:'fa-IR', disabled:true},
69 {tag:'option', html:"Polski", value:'pl-PL', disabled:true},
70 {tag:'option', html:"Português", value:'pt-PT'/ *, disabled:true* /},
71 {tag:'option', html:"Português Brasileiro", value:'pt-BR'/ *, disabled:true* /},
72 {tag:'option', html:"Românä", value:'ro-RO', disabled:true},
73 {tag:'option', html:"Russian (Русский)", value:'ru-RU', disabled:true},
74 {tag:'option', html:"Slovak (Slovenčina)", value:'sk-SK', disabled:true},
75 {tag:'option', html:"Slovenian (Slovenščina)", value:'sl-SI', disabled:true},
76 {tag:'option', html:"Suomi", value:'fi-FI', disabled:true},
77 {tag:'option', html:"Svenska", value:'sv-SE', disabled:true},
78 {tag:'option', html:"Thai (ไทย)", value:'th-TH', disabled:true},
79 {tag:'option', html:"Türkçe", value:'tr-TR', disabled:true},
80 {tag:'option', html:"Ukrainian (Українська)", value:'uk-UA', disabled:true}
81* /
82 {tag:'option', html:"Arabic (العربية)", value:"ar", disabled:true, cls:'disabledOption'},
83 // {tag:'option', html:"Chinese (中文)", value:"zh", disabled:true},
84 {tag:'option', html:"Chinese (Simplified) (简体中文)", value:'zh-CN'},
85 {tag:'option', html:"Dutch (Nederlands)", value:"nl-NL", disabled:true, cls:'disabledOption'},
86 {tag:'option', html:"English", value:"en-US"},
87 {tag:'option', html:"French (Français)", value:"fr-FR"},
88 {tag:'option', html:"German (Deutsch)", value:"de-DE", disabled:true, cls:'disabledOption'},
89 {tag:'option', html:"Greek (Ελληνικά)", value:"el-GR", disabled:true, cls:'disabledOption'},
90 {tag:'option', html:"Hebrew (עברית)", value:"he-IL", disabled:true, cls:'disabledOption'},
91 {tag:'option', html:"Italian (Italiano)", value:"it-IT"},
92 {tag:'option', html:"Japanese (日本語)", value:"ja-JP"},
93 {tag:'option', html:"Korean (한국어)", value:"ko-KR", disabled:true, cls:'disabledOption'},
94 {tag:'option', html:"Norwegian (Norsk)", value:"no", disabled:true, cls:'disabledOption'},
95 {tag:'option', html:"Persian (فارسی)", value:"fa-IR", disabled:true, cls:'disabledOption'},
96 {tag:'option', html:"Polish (Polski)", value:"pl-PL", disabled:true, cls:'disabledOption'},
97 {tag:'option', html:"Portuguese (Português)", value:"pt-BR"},
98 {tag:'option', html:"Russian (Русский)", value:"ru-RU", disabled:true, cls:'disabledOption'},
99 {tag:'option', html:"Spanish (Español)", value:"es-ES"},
100 {tag:'option', html:"Swedish (Svenska)", value:"sv-SE", disabled:true, cls:'disabledOption'},
101 {tag:'option', html:"Turkish (Türkçe)", value:"tr-TR", disabled:true, cls:'disabledOption'},
102 {tag:'option', html:"Vietnamese (Tiếng Việt)", value:"vi-VN", disabled:true, cls:'disabledOption'}
103 ]
104}
105*/
106
107Clipperz.PM.Strings.GeneralSettings = {
108 'defaults': {
109 // 'loginFormAarghThatsBadUrl':"http://www.clipperz.com/support/faq/account_faq",
110 // 'loginFormVerifyTheCodeUrl':"http://www.clipperz.com/learn_more/reviewing_the_code",
111
112 // 'donateHeaderLinkUrl': "http://www.clipperz.com/donations",
113 // 'creditsHeaderLinkUrl': "http://www.clipperz.com/credits",
114 // 'feedbackHeaderLinkUrl': "http://www.clipperz.com/contact",
115 // 'helpHeaderLinkUrl': "http://www.clipperz.com/support/user_guide",
116 // 'forumHeaderLinkUrl': "http://www.clipperz.com/forum",
117
118 // 'httpAuthBookmarkletConfiguration':{tag:'textarea', id:'httpAuthDefaultConfiguration', html:"" +
119 // "{ \"page\":{\"title\":\"HTTP authentication\"}," + "\n" +
120 // " \"form\":{\"attributes\": {" + "\n" +
121 // " \"action\":\"\"," + "\n" +
122 // " \"type\":\"http_auth\"" + "\n" +
123 // " }, \"inputs\": [" + "\n" +
124 // " {\"type\":\"text\",\"name\":\"url\",\"value\":\"\"}," + "\n" +
125 // " {\"type\":\"text\",\"name\":\"username\",\"value\":\"\"}," + "\n" +
126 // " {\"type\":\"password\",\"name\":\"password\",\"value\":\"\"}" + "\n" +
127 // " ]}, \"version\":\"0.2.3\"}"
128 // },
129
130 'directLoginJumpPageUrl':"",
131 'defaultFaviconUrl': "data:application/octet-stream;charset=utf-8;base64,AAABAAEAFxcAAAEAGAD8BgAAFgAAACgAAAAXAAAALgAAAAEAGAAAAAAAAAAAABIXAAASFwAAAAAAAAAAAAD///////////////////////////////////////////////////////////////////////////////////////////9zAC////////////////////////////////////////////////////////////////////////////////////////////9pAG////////////////////////////////////////////////////////////////////////////////////////////9rAC////////////////////////////////////////////////////////////////////////////////////////////9yAHP////////////////////////IyMizs7O6urrq6ur////////////Ozs6zs7Ozs7Pq6ur///////////////////////8AAAD////////////////////V1dWXl5eXl5eXl5elpaX4+Pj////Ozs6Xl5eXl5eXl5eenp7///////////////////////8AAAD////////////////////Ozs6Xl5eXl5eXl5eXl5fBwcHq6uqenp6Xl5eXl5eXl5eXl5f///////////////////////8AAAD////////////////////j4+OXl5eXl5eXl5eXl5eXl5elpaWXl5eXl5eXl5eXl5ezs7P///////////////////////8AAAD////////////////////////IyMiXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eenp7x8fH////////////////////////////////////////////////////4+PilpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5fOzs7////////////////////////////////////////////////////////q6uq6urqXl5eXl5eXl5eXl5eXl5eXl5eenp7V1dX4+Pj///////////////////////8AAAD////////////4+PjOzs6lpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5e6urrj4+P///////////////8AAAD////////////BwcGXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fx8fH///////////8AAAD///////////+zs7OXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fj4+P///////////8AAAD////////////IyMiXl5eXl5eXl5eXl5e6urqXl5eXl5eXl5eXl5esrKylpaWXl5eXl5eXl5eenp7x8fH///////////8AAAD////////////////Ozs7Ozs7V1dX4+Pj///+Xl5eXl5eXl5eXl5fOzs7////q6urOzs7Ozs7q6ur///////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD////////////////////////////////////IyMiXl5eXl5eenp7x8fH///////////////////////////////////8AAAD////////////////////////////////////////j4+Pj4+Px8fH///////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAo=",
132 'defaultFaviconUrl_IE': "https://www.clipperz.com/images/icons/misc/favicon.ico",
133
134 // 'icons_baseUrl':"https://www.clipperz.com/images/icons",
135
136 // 'passwordGeneratorLowercaseCharset':"abcdefghijklmnopqrstuvwxyz",
137 // 'passwordGeneratorUppercaseCharset':"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
138 // 'passwordGeneratorNumberCharset': "0123456789",
139 // 'passwordGeneratorSymbolCharset': "!@#$%^&*+?[]{}/|\\<>,.;:~=-_",
140
141 // 'passwordGenerator': {
142 // 'lowercaseCharset':"abcdefghijklmnopqrstuvwxyz",
143 // 'uppercaseCharset':"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
144 // 'numberCharset':"0123456789",
145 // 'symbolCharset':"!@#$%^&*+?[]{}/|\\<>,.;:~=-_",
146 // },
147
148 '_': ""
149 }
150}
151
152Clipperz.PM.Strings.defaultLanguages = {
153 'default':"en-us",
154
155 // 'de':"de-de",
156 // 'el':"el-gr",
157 // 'he':"he-il",
158 // 'ru':"ru-ru",
159
160 'fr':"fr-fr",
161 'es':"es-es",
162 'zh':"zh-cn",
163 'ja':"ja-jp",
164 'pt':"pt-br",
165 'it':"it-it",
166 'en': "en-us"
167}
168
169Clipperz.PM.Strings.inputTypeToRecordFieldType = {
170 'text': 'TXT',
171 'password': 'PWD',
172 'checkbox': 'CHECK',
173 'radio': 'RADIO',
174 'select': 'SELECT'
175};
176
177//-----------------------------------------------------------------------------
178
179Clipperz.PM.Strings.translateBookmarklet = function (aBookmarkletString) {
180 var result;
181
182 result = aBookmarkletString;
183
184 result = result.replace(/@BOOKMARKLET_NO_EXCEPTION_MESSAGE@/,Clipperz.PM.Strings.getValue('bookmarkletCopy.noExceptionMessage'));
185 result = result.replace(/@BOOKMARKLET_EXCEPTION_MESSAGE@/, Clipperz.PM.Strings.getValue('bookmarkletCopy.exceptionMessage'));
186 result = result.replace(/@BOOKMARKLET_COPY@/, Clipperz.PM.Strings.getValue('bookmarkletCopy.copy'));
187 result = result.replace(/@BOOKMARKLET_SUCCESSFUL_MESSAGE@/, Clipperz.PM.Strings.getValue('bookmarkletCopy.successfulMessage'));
188 result = result.replace(/@BOOKMARKLET_FAIL_MESSAGE@/, Clipperz.PM.Strings.getValue('bookmarkletCopy.failMessage'));
189
190 return result;
191}
192
193//-----------------------------------------------------------------------------
194
195Clipperz.PM.Strings.Languages.setSelectedLanguage = function(aLanguage) {
196 var language;
197 varselectedLanguage;
198
199 language = (aLanguage || Clipperz.PM.Strings.preferredLanguage || 'default').toLowerCase();
200 if (typeof(Clipperz.PM.Strings.defaultLanguages[language]) != 'undefined') {
201 language = Clipperz.PM.Strings.defaultLanguages[language];
202 }
203
204 if (typeof(Clipperz.PM.Strings.Languages[language]) != 'undefined') {
205 selectedLanguage = language;
206 } else if (typeof(Clipperz.PM.Strings.defaultLanguages[language.substr(0,2)]) != 'undefined') {
207 selectedLanguage = Clipperz.PM.Strings.defaultLanguages[language.substr(0,2)];
208 } else {
209 selectedLanguage = Clipperz.PM.Strings.defaultLanguages['default'];
210 }
211
212 if (selectedLanguage != Clipperz.PM.Strings.selectedLanguage) {
213 vartranslations;
214
215 Clipperz.PM.Strings.selectedLanguage = selectedLanguage;
216
217 translations = {};
218 // MochiKit.Base.update(translations, Clipperz.PM.Strings.standardStrings)
219
220 MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.Languages['defaults']);
221 MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.GeneralSettings['defaults']);
222
223 MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.Languages[Clipperz.PM.Strings.defaultLanguages['default']]);
224 MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.GeneralSettings[Clipperz.PM.Strings.defaultLanguages['default']]);
225
226 MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.Languages[selectedLanguage]);
227 MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.GeneralSettings[selectedLanguage]);
228
229 Clipperz.PM.Strings.stringsObjectStore = new Clipperz.KeyValueObjectStore(/*{'name':'String.stringsObjectStore [1]'}*/);
230 Clipperz.PM.Strings.stringsObjectStore.initWithValues(translations);
231
232 if (typeof(bookmarklet) != 'undefined') {
233 Clipperz.PM.Strings.stringsObjectStore.setValue('bookmarklet', Clipperz.PM.Strings.translateBookmarklet(bookmarklet));
234 }
235
236 MochiKit.Signal.signal(Clipperz.PM.Strings.Languages, 'switchLanguage', selectedLanguage);
237 }
238}
239
240//-----------------------------------------------------------------------------
241
242Clipperz.PM.Strings.getValue = function (aKeyPath, someKeyValues) {
243 varresult;
244
245 result = Clipperz.PM.Strings.stringsObjectStore.getValue(aKeyPath);
246
247//try {
248 if (typeof(result) == 'string') {
249 if (typeof (someKeyValues) != 'undefined') {
250 varkey;
251
252 for (key in someKeyValues) {
253 result = result.replace( new RegExp(key), someKeyValues[key]);
254 // result.replace(, '');
255 }
256 }
257
258 result = result.replace(new RegExp('\n'), '<br>');
259 }
260//} catch (exception) {
261 //console.log("####", result, aKeyPath, someKeyValues, exception);
262//}
263
264 return result;
265}
266
267Clipperz.PM.Strings.errorDescriptionForException = function (anException) {
268 var result;
269
270 result = Clipperz.PM.Strings.getValue('exceptionsMessages' + '.' + anException.name);
271
272 if (result == null) {
273 result = anException.message;
274 }
275
276 return result;
277},
278
279//-----------------------------------------------------------------------------
280
281Clipperz.PM.Strings.Languages.initSetup = function() {
282 varlanguage;
283 varlanguageParser;
284
285 language = navigator.language || navigator.userLanguage; //en, en-US, .... "de", "nb-no"
286 languageParser = new RegExp("language=([a-z]{2}(?:\-[a-z]{2})?)(\&|$)", "i");
287 if (languageParser.test(window.location.search)) {
288 language = RegExp.$1;
289 }
290
291 Clipperz.PM.Strings.preferredLanguage = language.toLowerCase();
292 Clipperz.PM.Strings.Languages.setSelectedLanguage(Clipperz.PM.Strings.preferredLanguage);
293}
294
295//-----------------------------------------------------------------------------
diff --git a/frontend/gamma/js/Clipperz/PM/Strings/MessagePanelConfigurations.js b/frontend/gamma/js/Clipperz/PM/Strings/MessagePanelConfigurations.js
new file mode 100644
index 0000000..446e96c
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/Strings/MessagePanelConfigurations.js
@@ -0,0 +1,389 @@
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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; }
32
33Clipperz.PM.Strings.messagePanelConfigurations = {
34
35
36 //-------------------------------------------------------------------------
37 //
38 // Registration - connection
39 //
40 'registration_verify': function() {
41 return {
42 'title': null,
43 'text': Clipperz.PM.Strings['connectionRegistrationSendingRequestMessageText']
44 }
45 },
46
47 'registration_sendingCredentials': function() {
48 return {
49 'title': null,
50 'text': Clipperz.PM.Strings['connectionRegistrationSendingCredentialsMessageText']
51 }
52 },
53
54 //-------------------------------------------------------------------------
55 //
56 // One Time Password login message panel
57 //
58
59 'OTP_login_start': function() {
60 return {
61 'title': Clipperz.PM.Strings['OTPloginMessagePanelInitialTitle'],
62 'text': Clipperz.PM.Strings['OTPloginMessagePanelInitialText'],
63 'steps': '+3',
64 'buttons': {}
65 }
66 },
67
68 'OTP_login_loadingOTP': function() {
69 return {
70 'title': Clipperz.PM.Strings['OTPloginMessagePanelLoadingTitle'],
71 'text': Clipperz.PM.Strings['OTPloginMessagePanelLoadingText']
72 }
73 },
74
75 'OTP_login_extractingPassphrase': function() {
76 return {
77 'title': Clipperz.PM.Strings['OTPloginMessagePanelProcessingTitle'],
78 'text': Clipperz.PM.Strings['OTPloginMessagePanelProcessingText']
79 }
80 },
81
82
83 //-------------------------------------------------------------------------
84 //
85 // Login message panel
86 //
87 'login_start': function() {
88 return {
89 'title': Clipperz.PM.Strings['loginMessagePanelInitialTitle'],
90 'text': Clipperz.PM.Strings['loginMessagePanelInitialText'],
91 'steps': '+7',
92 'buttons': {
93 'ok': Clipperz.PM.Strings['loginMessagePanelInitialButtonLabel']
94 }
95 }
96 },
97
98 'login_connected': function() {
99 return {
100 'title': Clipperz.PM.Strings['loginMessagePanelConnectedTitle'],
101 'text': Clipperz.PM.Strings['loginMessagePanelConnectedText'],
102 'buttons': {}
103 }
104 },
105
106 'login_failed':function() {
107 return {
108 'title': Clipperz.PM.Strings['loginMessagePanelFailureTitle'],
109 'text': Clipperz.PM.Strings['loginMessagePanelFailureText'],
110 'button': Clipperz.PM.Strings['loginMessagePanelFailureButtonLabel']
111 }
112 },
113
114 //-------------------------------------------------------------------------
115 //
116 // Login message panel - connection
117 //
118 'connection_sendingCredentials': function() {
119 return {
120 'title': Clipperz.PM.Strings['connectionLoginSendingCredentialsMessageTitle'],
121 'text': Clipperz.PM.Strings['connectionLoginSendingCredentialsMessageText']
122 }
123 },
124
125 'connection_credentialVerification': function() {
126 return {
127 'title': Clipperz.PM.Strings['connectionLoginCredentialsVerificationMessageTitle'],
128 'text': Clipperz.PM.Strings['connectionLoginCredentialsVerificationMessageText']
129 }
130 },
131
132 'connection_loggedIn': function() {
133 return {
134 'title': Clipperz.PM.Strings['connectionLoginDoneMessageTitle'],
135 'text': Clipperz.PM.Strings['connectionLoginDoneMessageText']
136 }
137 },
138
139 //-------------------------------------------------------------------------
140 //
141 //Login message panel - user
142 //
143 'connection_upgrading': function() {
144 return {
145 'title': Clipperz.PM.Strings['userLoginPanelUpgradingUserCredentialsMessageTitle'],
146 'text': Clipperz.PM.Strings['userLoginPanelUpgradingUserCredentialsMessageText'],
147 'steps': '+1'
148 }
149 },
150
151 'connection_done': function() {
152 return {
153 'title': Clipperz.PM.Strings['userLoginPanelConnectedMessageTitle'],
154 'text': Clipperz.PM.Strings['userLoginPanelConnectedMessageText']
155 }
156 },
157
158 'connection_tryOlderSchema': function() {
159 return {
160 'title': Clipperz.PM.Strings['userLoginPanelTryingAnOlderConnectionSchemaMessageTitle'],
161 'text': Clipperz.PM.Strings['userLoginPanelTryingAnOlderConnectionSchemaMessageText'],
162 'steps': '+4'
163 }
164 },
165
166 'connection_loadingUserData': function() {
167 return {
168 'title': Clipperz.PM.Strings['userLoginPanelLoadingUserDataMessageTitle'],
169 'text': Clipperz.PM.Strings['userLoginPanelLoadingUserDataMessageText']
170 }
171 },
172
173 'connection_decryptingUserData': function() {
174 return {
175 'title': Clipperz.PM.Strings['userLoginPanelDecryptingUserDataMessageTitle'],
176 'text': Clipperz.PM.Strings['userLoginPanelDecryptingUserDataMessageText'],
177 'steps': '+1'
178 }
179 },
180
181 'connection_decryptingUserStatistics': function() {
182 return {
183 'title': Clipperz.PM.Strings['userLoginPanelDecryptingUserStatisticsMessageTitle'],
184 'text': Clipperz.PM.Strings['userLoginPanelDecryptingUserStatisticsMessageText']
185 }
186 },
187
188 'collectingEntropy': function() {
189 return {
190 'text': Clipperz.PM.Strings['panelCollectingEntryopyMessageText'],
191 'steps': '+1'
192 }
193 },
194
195 //-------------------------------------------------------------------------
196 //
197 // Cards block - delete card panel
198 //
199 'deleteRecord_collectData': function() {
200 return {
201 'title': Clipperz.PM.Strings['deleteRecordPanelCollectRecordDataMessageTitle'],
202 'text': Clipperz.PM.Strings['deleteRecordPanelCollectRecordDataMessageText']
203 }
204 },
205
206 'deleteRecord_encryptData': function() {
207 return {
208 'title': Clipperz.PM.Strings['deleteRecordPanelEncryptUserDataMessageTitle'],
209 'text': Clipperz.PM.Strings['deleteRecordPanelEncryptUserDataMessageText']
210 }
211 },
212
213 'deleteRecord_sendingData': function() {
214 return {
215 'title': Clipperz.PM.Strings['deleteRecordPanelSendingDataToTheServerMessageTitle'],
216 'text': Clipperz.PM.Strings['deleteRecordPanelSendingDataToTheServerMessageText']
217 }
218 },
219
220 'deleteRecord_updatingInterface': function() {
221 return {
222 'title': Clipperz.PM.Strings['deleteRecordPanelUpdatingTheInterfaceMessageTitle'],
223 'text': Clipperz.PM.Strings['deleteRecordPanelUpdatingTheInterfaceMessageText']
224 }
225 },
226
227
228 //-------------------------------------------------------------------------
229 //
230 //Cards block - save card panel
231 //
232 'saveCard_collectRecordInfo': function() {
233 return {
234 'title': Clipperz.PM.Strings['recordSaveChangesPanelCollectRecordInfoMessageTitle'],
235 'text': Clipperz.PM.Strings['recordSaveChangesPanelCollectRecordInfoMessageText']
236 }
237 },
238
239 'saveCard_encryptUserData': function() {
240 return {
241 'title': Clipperz.PM.Strings['recordSaveChangesPanelEncryptUserDataMessageTitle'],
242 'text': Clipperz.PM.Strings['recordSaveChangesPanelEncryptUserDataMessageText']
243 }
244 },
245
246 'saveCard_encryptRecordData': function() {
247 return {
248 'title': Clipperz.PM.Strings['recordSaveChangesPanelEncryptRecordDataMessageTitle'],
249 'text': Clipperz.PM.Strings['recordSaveChangesPanelEncryptRecordDataMessageText']
250 }
251 },
252
253 'saveCard_encryptRecordVersions': function() {
254 return {
255 'title': Clipperz.PM.Strings['recordSaveChangesPanelEncryptRecordVersionDataMessageTitle'],
256 'text': Clipperz.PM.Strings['recordSaveChangesPanelEncryptRecordVersionDataMessageText']
257 }
258 },
259
260 'saveCard_sendingData': function() {
261 return {
262 'title': Clipperz.PM.Strings['recordSaveChangesPanelSendingDataToTheServerMessageTitle'],
263 'text': Clipperz.PM.Strings['recordSaveChangesPanelSendingDataToTheServerMessageText']
264 }
265 },
266
267 'saveCard_updatingInterface': function() {
268 return {
269 'title': Clipperz.PM.Strings['recordSaveChangesPanelUpdatingTheInterfaceMessageTitle'],
270 'text': Clipperz.PM.Strings['recordSaveChangesPanelUpdatingTheInterfaceMessageText']
271 }
272 },
273
274 //-------------------------------------------------------------------------
275 //
276 //Account panel - user preferences
277 //
278 'account_savingPreferences_1': function() {
279 return {
280 'title': Clipperz.PM.Strings['accountPreferencesSavingPanelTitle_Step1'],
281 'text': Clipperz.PM.Strings['accountPreferencesSavingPanelText_Step1'],
282 'steps': '+3'
283 }
284 },
285
286 'account_savingPreferences_2': function() {
287 return {
288 'title': Clipperz.PM.Strings['accountPreferencesSavingPanelTitle_Step2'],
289 'text': Clipperz.PM.Strings['accountPreferencesSavingPanelText_Step2']
290 }
291 },
292
293
294 //-------------------------------------------------------------------------
295 //
296 //Account panel - change credentials
297 //
298 'changeCredentials_encryptingData': function() {
299 return {
300 'title': Clipperz.PM.Strings['changeCredentialsPanelEncryptingDataMessageTitle'],
301 'text': Clipperz.PM.Strings['changeCredentialsPanelEncryptingDataMessageText']
302 }
303 },
304
305 'changeCredentials_creatingNewCredentials': function() {
306 return {
307 'title': Clipperz.PM.Strings['changeCredentialsPanelCreatingNewCredentialsMessageTitle'],
308 'text': Clipperz.PM.Strings['changeCredentialsPanelCreatingNewCredentialsMessageText']
309 }
310 },
311
312 'changeCredentials_sendingCredentials': function() {
313 return {
314 'title': Clipperz.PM.Strings['changeCredentialsPanelSendingNewCredentialsToTheServerMessageTitle'],
315 'text': Clipperz.PM.Strings['changeCredentialsPanelSendingNewCredentialsToTheServerMessageText']
316 }
317 },
318
319 'changeCredentials_done': function() {
320 return {
321 'title': Clipperz.PM.Strings['changeCredentialsPanelDoneMessageTitle'],
322 'text': Clipperz.PM.Strings['changeCredentialsPanelDoneMessageText']
323 }
324 },
325
326
327 //-------------------------------------------------------------------------
328 //
329 //Account panel - change credentials
330 //
331 'saveOTP_encryptUserData': function() {
332 return {
333 'title': Clipperz.PM.Strings['saveOTP_encryptUserDataTitle'],
334 'text': Clipperz.PM.Strings['saveOTP_encryptUserDataText'],
335 'steps': '+4'
336 }
337 },
338
339 'saveOTP_encryptOTPData': function() {
340 return {
341 'title': Clipperz.PM.Strings['saveOTP_encryptOTPDataTitle'],
342 'text': Clipperz.PM.Strings['saveOTP_encryptOTPDataText']
343 }
344 },
345
346 'saveOTP_sendingData': function() {
347 return {
348 'title': Clipperz.PM.Strings['saveOTP_sendingDataTitle'],
349 'text': Clipperz.PM.Strings['saveOTP_sendingDataText']
350 }
351 },
352
353 'saveOTP_updatingInterface': function() {
354 return {
355 'title': Clipperz.PM.Strings['saveOTP_updatingInterfaceTitle'],
356 'text': Clipperz.PM.Strings['saveOTP_updatingInterfaceText']
357 }
358 },
359
360
361 //-------------------------------------------------------------------------
362 //
363 //Data panel - processingImportData
364 //
365 'parseImportData': function() {
366 return {
367 'title': Clipperz.PM.Strings['importData_parsingDataTitle'],
368 'text': Clipperz.PM.Strings['importData_parsingDataText']
369 }
370 },
371
372 'previewImportData': function() {
373 return {
374 'title': Clipperz.PM.Strings['importData_previewingDataTitle'],
375 'text': Clipperz.PM.Strings['importData_previewingDataText']
376 }
377 },
378
379 'processingImportData': function() {
380 return {
381 'title': Clipperz.PM.Strings['importData_processingDataTitle'],
382 'text': Clipperz.PM.Strings['importData_processingDataText']
383 }
384 },
385
386 //-------------------------------------------------------------------------
387 __syntaxFix__: "syntax fix"
388
389}
diff --git a/frontend/gamma/js/Clipperz/PM/Strings/Strings_defaults.js b/frontend/gamma/js/Clipperz/PM/Strings/Strings_defaults.js
new file mode 100644
index 0000000..1ad2696
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/Strings/Strings_defaults.js
@@ -0,0 +1,390 @@
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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; }
32if (typeof(Clipperz.PM.Strings.Languages) == 'undefined') { Clipperz.PM.Strings.Languages = {}; }
33
34//=============================================================================
35//
36 // D E F A U L T S ( defaults )
37//
38//=============================================================================
39
40Clipperz.PM.Strings.Languages['defaults'] = {
41
42'elapsedTimeDescriptions': {
43 'MORE_THAN_A_MONTH_AGO': "more than a month ago",
44 'MORE_THAN_A_WEEK_AGO': "more than a week ago",
45 'MORE_THAN_*_WEEKS_AGO': "more than __elapsed__ weeks ago",
46 'YESTERDAY': "yesterday",
47 '*_DAYS_AGO': "__elapsed__ days ago",
48 'ABOUT_AN_HOUR_AGO': "about an hour ago",
49 '*_HOURS_AGO': "__elapsed__ hours ago",
50 'JUST_A_FEW_MINUTES_AGO': "just a few minutes ago",
51 'ABOUT_*_MINUTES_AGO': "about __elapsed__ minutes ago"
52},
53/*
54 'unknown_ip': "unknown",
55
56'countries': {
57 '--': "unknown",
58 'AD': "Andorra",
59 'AE': "United Arab Emirates",
60 'AF': "Afghanistan",
61 'AG': "Antigua and Barbuda",
62 'AI': "Anguilla",
63 'AL': "Albania",
64 'AM': "Armenia",
65 'AN': "Netherlands Antilles",
66 'AO': "Angola",
67 'AP': "Non-Spec Asia Pas Location",
68 'AR': "Argentina",
69 'AS': "American Samoa",
70 'AT': "Austria",
71 'AU': "Australia",
72 'AW': "Aruba",
73 'AX': "Aland Islands",
74 'AZ': "Azerbaijan",
75 'BA': "Bosnia and Herzegowina",
76 'BB': "Barbados",
77 'BD': "Bangladesh",
78 'BE': "Belgium",
79 'BF': "Burkina Faso",
80 'BG': "Bulgaria",
81 'BH': "Bahrain",
82 'BI': "Burundi",
83 'BJ': "Benin",
84 'BM': "Bermuda",
85 'BN': "Brunei Darussalam",
86 'BO': "Bolivia",
87 'BR': "Brazil",
88 'BS': "Bahamas",
89 'BT': "Bhutan",
90 'BW': "Botswana",
91 'BY': "Belarus",
92 'BZ': "Belize",
93 'CA': "Canada",
94 'CD': "Congo the Democratic Republic of the",
95 'CF': "Central African Republic",
96 'CH': "Switzerland",
97 'CI': "Cote D'ivoire",
98 'CK': "Cook Islands",
99 'CL': "Chile",
100 'CM': "Cameroon",
101 'CN': "China",
102 'CO': "Colombia",
103 'CR': "Costa Rica",
104 'CS': "Serbia and Montenegro",
105 'CU': "Cuba",
106 'CY': "Cyprus",
107 'CZ': "Czech Republic",
108 'DE': "Germany",
109 'DJ': "Djibouti",
110 'DK': "Denmark",
111 'DO': "Dominican Republic",
112 'DZ': "Algeria",
113 'EC': "Ecuador",
114 'EE': "Estonia",
115 'EG': "Egypt",
116 'ER': "Eritrea",
117 'ES': "Spain",
118 'ET': "Ethiopia",
119 'EU': "European Union",
120 'FI': "Finland",
121 'FJ': "Fiji",
122 'FM': "Micronesia Federated States of",
123 'FO': "Faroe Islands",
124 'FR': "France",
125 'GA': "Gabon",
126 'GB': "United Kingdom",
127 'GD': "Grenada",
128 'GE': "Georgia",
129 'GF': "French Guiana",
130 'GG': "Guernsey",
131 'GH': "Ghana",
132 'GI': "Gibraltar",
133 'GL': "Greenland",
134 'GM': "Gambia",
135 'GP': "Guadeloupe",
136 'GR': "Greece",
137 'GT': "Guatemala",
138 'GU': "Guam",
139 'GW': "Guinea-Bissau",
140 'GY': "Guyana",
141 'HK': "Hong Kong",
142 'HN': "Honduras",
143 'HR': "Croatia (Local Name: Hrvatska)",
144 'HT': "Haiti",
145 'HU': "Hungary",
146 'ID': "Indonesia",
147 'IE': "Ireland",
148 'IL': "Israel",
149 'IM': "Isle of Man",
150 'IN': "India",
151 'IO': "British Indian Ocean Territory",
152 'IQ': "Iraq",
153 'IR': "Iran (Islamic Republic of)",
154 'IS': "Iceland",
155 'IT': "Italy",
156 'JE': "Jersey",
157 'JM': "Jamaica",
158 'JO': "Jordan",
159 'JP': "Japan",
160 'KE': "Kenya",
161 'KG': "Kyrgyzstan",
162 'KH': "Cambodia",
163 'KI': "Kiribati",
164 'KN': "Saint Kitts and Nevis",
165 'KR': "Korea Republic of",
166 'KW': "Kuwait",
167 'KY': "Cayman Islands",
168 'KZ': "Kazakhstan",
169 'LA': "Lao People's Democratic Republic",
170 'LB': "Lebanon",
171 'LC': "Saint Lucia",
172 'LI': "Liechtenstein",
173 'LK': "Sri Lanka",
174 'LR': "Liberia",
175 'LS': "Lesotho",
176 'LT': "Lithuania",
177 'LU': "Luxembourg",
178 'LV': "Latvia",
179 'LY': "Libyan Arab Jamahiriya",
180 'MA': "Morocco",
181 'MC': "Monaco",
182 'MD': "Moldova Republic of",
183 'MG': "Madagascar",
184 'MH': "Marshall Islands",
185 'MK': "Macedonia the Former Yugoslav Republic of",
186 'ML': "Mali",
187 'MM': "Myanmar",
188 'MN': "Mongolia",
189 'MO': "Macau",
190 'MP': "Northern Mariana Islands",
191 'MR': "Mauritania",
192 'MS': "Montserrat",
193 'MT': "Malta",
194 'MU': "Mauritius",
195 'MV': "Maldives",
196 'MW': "Malawi",
197 'MX': "Mexico",
198 'MY': "Malaysia",
199 'MZ': "Mozambique",
200 'NA': "Namibia",
201 'NC': "New Caledonia",
202 'NF': "Norfolk Island",
203 'NG': "Nigeria",
204 'NI': "Nicaragua",
205 'NL': "Netherlands",
206 'NO': "Norway",
207 'NP': "Nepal",
208 'NR': "Nauru",
209 'NU': "Niue",
210 'NZ': "New Zealand",
211 'OM': "Oman",
212 'PA': "Panama",
213 'PE': "Peru",
214 'PF': "French Polynesia",
215 'PG': "Papua New Guinea",
216 'PH': "Philippines",
217 'PK': "Pakistan",
218 'PL': "Poland",
219 'PR': "Puerto Rico",
220 'PS': "Palestinian Territory Occupied",
221 'PT': "Portugal",
222 'PW': "Palau",
223 'PY': "Paraguay",
224 'QA': "Qatar",
225 'RO': "Romania",
226 'RS': "Serbia",
227 'RU': "Russian Federation",
228 'RW': "Rwanda",
229 'SA': "Saudi Arabia",
230 'SB': "Solomon Islands",
231 'SC': "Seychelles",
232 'SD': "Sudan",
233 'SE': "Sweden",
234 'SG': "Singapore",
235 'SI': "Slovenia",
236 'SK': "Slovakia (Slovak Republic)",
237 'SL': "Sierra Leone",
238 'SM': "San Marino",
239 'SN': "Senegal",
240 'SR': "Suriname",
241 'SV': "El Salvador",
242 'SY': "Syrian Arab Republic",
243 'SZ': "Swaziland",
244 'TC': "Turks and Caicos Islands",
245 'TG': "Togo",
246 'TH': "Thailand",
247 'TJ': "Tajikistan",
248 'TM': "Turkmenistan",
249 'TN': "Tunisia",
250 'TO': "Tonga",
251 'TR': "Turkey",
252 'TT': "Trinidad and Tobago",
253 'TV': "Tuvalu",
254 'TW': "Taiwan Province of China",
255 'TZ': "Tanzania United Republic of",
256 'UA': "Ukraine",
257 'UG': "Uganda",
258 'US': "United States",
259 'UY': "Uruguay",
260 'UZ': "Uzbekistan",
261 'VA': "Holy See (Vatican City State)",
262 'VE': "Venezuela",
263 'VG': "Virgin Islands (British)",
264 'VI': "Virgin Islands (U.S.)",
265 'VN': "Viet Nam",
266 'VU': "Vanuatu",
267 'WF': "Wallis and Futuna Islands",
268 'WS': "Samoa",
269 'YE': "Yemen",
270 'ZA': "South Africa",
271 'ZM': "Zambia",
272 'ZW': "Zimbabwe",
273 'ZZ': "Reserved"
274},
275
276'browsers': {
277 'UNKNOWN': "Unknown",
278 'MSIE': "Internet Explorer",
279 'FIREFOX': "Firefox",
280 'OPERA': "Opera",
281 'SAFARI': "Safari",
282 'OMNIWEB': "OmniWeb",
283 'CAMINO': "Camino",
284 'CHROME': "Chrome"
285},
286
287'operatingSystems': {
288 'UNKNOWN': "Unknown",
289 'WINDOWS': "Windows",
290 'MAC': "Mac",
291 'LINUX': "Linux",
292 'IPHONE': "iPhone",
293 'MOBILE': "Mobile",
294 'OPENBSD': "OpenBSD",
295 'FREEBSD': "FreeBSD",
296 'NETBSD': "NetBSD"
297},
298*/
299
300 //Calendar texts
301'calendarStrings': {
302 'months': {
303 '0':"January",
304 '1':"February",
305 '2':"March",
306 '3':"April",
307 '4':"May",
308 '5':"June",
309 '6':"July",
310 '7':"August",
311 '8':"September",
312 '9':"October",
313 '10':"November",
314 '11':"December"
315 },
316 'shortMonths':{
317 '0':"Jan",
318 '1':"Feb",
319 '2':"Mar",
320 '3':"Apr",
321 '4':"May",
322 '5':"Jun",
323 '6':"Jul",
324 '7':"Aug",
325 '8':"Sep",
326 '9':"Oct",
327 '10':"Nov",
328 '11':"Dec"
329 },
330
331 'days':{
332 '0':"Sunday",
333 '1':"Monday",
334 '2':"Tuesday",
335 '3':"Wednesday",
336 '4':"Thursday",
337 '5':"Friday",
338 '6':"Saturday"
339 },
340
341 'shortDays':{
342 '0':"Sun",
343 '1':"Mon",
344 '2':"Tue",
345 '3':"Wed",
346 '4':"Thu",
347 '5':"Fri",
348 '6':"Sat"
349 },
350
351 'veryShortDays':{
352 '0':"Su",
353 '1':"Mo",
354 '2':"Tu",
355 '3':"We",
356 '4':"Th",
357 '5':"Fr",
358 '6':"Sa"
359 },
360
361 'amDesignation':"am",
362 'pmDesignation':"pm"
363
364},
365
366// Date format
367 'fullDate_format':"l, F d, Y H:i:s",
368
369//################################################################################
370
371'pageHeader': {
372 'donation':"donate",
373 'forum':"forum",
374 'credits':"credits",
375 'feedback':"feedback",
376 'help': "help"
377},
378
379'bookmarkletCopy': {
380 'noExceptionMessage':"The direct login configuration has been collected.",
381 'exceptionMessage': "Sorry! There was an error while processing the page.",
382 'copy': "copy",
383 'successfulMessage':"DONE!",
384 'failMessage': "Failed! :("
385},
386
387//################################################################################
388
389__syntaxFix__: "syntax fix"
390}
diff --git a/frontend/gamma/js/Clipperz/PM/Strings/Strings_en-US.js b/frontend/gamma/js/Clipperz/PM/Strings/Strings_en-US.js
new file mode 100644
index 0000000..eebdb16
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/Strings/Strings_en-US.js
@@ -0,0 +1,1341 @@
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//=============================================================================
30//
31 // E N G L I S H A M E R I C A N ( en_US )
32//
33//=============================================================================
34
35Clipperz.PM.Strings.Languages['en-us'] = {
36/*
37 //Login page - description
38'clipperzServiceDescription': "\
39 <!-- FIX CSS DONE -->\
40 <h2>Keep it to yourself!</h2>\
41 <ul>\
42 <li>\
43 <h3>Clipperz is:</h3>\
44 <ul>\
45 <li><p>a secure and simple password manager</p></li>\
46 <li><p>an effective single sign-on solution</p></li>\
47 <li><p>a digital vault for your personal data</p></li>\
48 </ul>\
49 </li>\
50 <li>\
51 <h3>With Clipperz you can:</h3>\
52 <ul>\
53 <li><p>store and manage your passwords and online credentials</p></li>\
54 <li><p>login to your web services without entering any username or password</p></li>\
55 <li><p>protect all your sensitive data: codes for burglar alarms, PINs, credit card numbers, …</p></li>\
56 <li><p>share secrets with family members and associates (coming soon)</p></li>\
57 </ul>\
58 </li>\
59 <li>\
60 <h3>Clipperz benefits:</h3>\
61 <ul>\
62 <li><p>free and completely anonymous</p></li>\
63 <li><p>access it any time from any computer</p></li>\
64 <li><p>no software to download and nothing to install</p></li>\
65 <li><p>avoid keeping secrets on your PC or on paper</p></li>\
66 </ul>\
67 </li>\
68 <li>\
69 <h3>Clipperz security:</h3>\
70 <ul>\
71 <li><p>your secrets are locally encrypted by your browser before being uploaded to Clipperz</p></li>\
72 <li><p>the encryption key is a passphrase known only to you</p></li>\
73 <li><p>Clipperz hosts your sensitive data in encrypted form and could never actually access the data in its plain form</p></li>\
74 <li><p>Clipperz is built upon standard encryption schemes, nothing fancies or homemade</p></li>\
75 <li><p>you can review the source code anytime you like, but you need to know nothing about cryptography to be an happy user!</p></li>\
76 </ul>\
77 </li>\
78 <li>\
79 <a href=\"http://www.clipperz.com\" target=\"_blank\">Learn more</a>\
80 </li>\
81 </ul>",
82
83
84 'loginFormTitle': "login with your Clipperz account",
85 'loginFormUsernameLabel': "username",
86 'loginFormPassphraseLabel': "passphrase",
87 'loginFormDontHaveAnAccountLabel': "don\'t have an account?",
88 'loginFormCreateOneLabel': "create one",
89 'loginFormForgotYourCredentialsLabel': "forgot your credentials?",
90 'loginFormAarghThatsBadLabel': "aargh! that\'s bad!",
91 'loginFormAfraidOfMaliciousScriptsLabel': "afraid of malicious scripts?",
92 'loginFormVerifyTheCodeLabel': "verify the code",
93 'loginFormButtonLabel': "Login",
94 'loginFormOneTimePasswordCheckboxLabel': "use a one-time passphrase",
95'loginFormOneTimePasswordCheckboxDescription': "",
96
97// Login page - language selection
98 'loginPanelSwithLanguageDescription': "<h5>Switch to your preferred language</h5>",
99
100// Login page - browser compatibility
101 'browserCompatibilityDescription': "<p>Have a better and safer Clipperz experience with Firefox. However Clipperz works just fine also with Opera, Safari and MS Internet Explorer!</p>",
102
103// Login with OTP - message panel
104 'OTPloginMessagePanelInitialTitle': "Logging in using a one-time passphrase",
105 'OTPloginMessagePanelInitialText': "Sending OTP credentials …",
106 'OTPloginMessagePanelLoadingTitle': "Logging in using a one-time passphrase",
107 'OTPloginMessagePanelLoadingText': "Fetching encrypted authentication data from the server …",
108 'OTPloginMessagePanelProcessingTitle': "Logging in using a one-time passphrase",
109 'OTPloginMessagePanelProcessingText': "Local decryption of authentication data",
110
111// Regular login - message panel
112 'loginMessagePanelInitialTitle': "Logging in …",
113 'loginMessagePanelInitialText': "---",
114 'loginMessagePanelInitialButtonLabel': "Cancel",
115 'loginMessagePanelConnectedTitle': "Connected",
116 'loginMessagePanelConnectedText': "Done",
117 'loginMessagePanelFailureTitle': "Error",
118 'loginMessagePanelFailureText': "Login failed",
119 'loginMessagePanelFailureButtonLabel': "Close",
120
121// Regular login - message panel - connection
122 'connectionLoginSendingCredentialsMessageTitle': "Verifying credentials",
123 'connectionLoginSendingCredentialsMessageText': "Sending credentials",
124 'connectionLoginCredentialsVerificationMessageTitle':"Verifying credentials",
125 'connectionLoginCredentialsVerificationMessageText':"Performing SRP authentication",
126 'connectionLoginDoneMessageTitle': "Verifying credentials",
127 'connectionLoginDoneMessageText': "Connected",
128
129 //Regular login - message panel - user
130 'userLoginPanelUpgradingUserCredentialsMessageTitle': "Verifying credentials",
131 'userLoginPanelUpgradingUserCredentialsMessageText': "Upgrading your credentials to a new authentication schema",
132 'userLoginPanelConnectedMessageTitle': "User authenticated",
133 'userLoginPanelConnectedMessageText': "Successfully logged in",
134 'userLoginPanelTryingAnOlderConnectionSchemaMessageTitle': "Verifying credentials",
135 'userLoginPanelTryingAnOlderConnectionSchemaMessageText': "Trying an older authentication schema",
136 'userLoginPanelLoadingUserDataMessageTitle': "User authenticated",
137 'userLoginPanelLoadingUserDataMessageText': "Downloading encrypted card headers from Clipperz",
138 'userLoginPanelDecryptingUserDataMessageTitle': "User authenticated",
139 'userLoginPanelDecryptingUserDataMessageText': "Local decryption of card headers",
140 'userLoginPanelDecryptingUserStatisticsMessageTitle': "User authenticated",
141 'userLoginPanelDecryptingUserStatisticsMessageText': "Local decryption of usage statistics",
142
143 //Registration page - splash alert
144 'splashAlertTitle':"Welcome to Clipperz!",
145'splashAlertText': "\
146 <!-- FIX CSS DONE! -->\
147 <p>Some security advice</p>\
148 <ul>\
149 <li><p>Storing your data at Clipperz is as secure as the passphrase you choose to protect them. Nobody can access them unless they know your passphrase.</p></li>\
150 <li><p>If you are going to use Clipperz for safeguarding sensitive and critical information please make sure to use a strong passphrase. The longer the better!</p></li>\
151 <li><p>Clipperz will not be able to recover a lost passphrase!</p></li>\
152 </ul>\
153 <p>For any further information, please refer to <a href=\"http://www.clipperz.com\" target=\"_blank\">Clipperz</a> website.</p>",
154 'splashAlertCloseButtonLabel':"Ok",
155
156 // Registration page - form
157 'registrationFormTitle': "create your account",
158 'registrationFormUsernameLabel': "username",
159 'registrationFormPassphraseLabel': "passphrase",
160 'registrationFormRetypePassphraseLabel': "re-enter passphrase",
161 'registrationFormSafetyCheckLabel': "I understand that Clipperz will not be able to recover a lost passphrase.",
162 'registrationFormTermsOfServiceCheckLabel': "I have read and agreed to the <a href='http://www.clipperz.com/terms_of_service' target='_blank'>Terms of Service</a>.",
163 'registrationFormDoYouAlreadyHaveAnAccountLabel': "do you already have an account?",
164 'registrationFormSimplyLoginLabel': "simply login",
165 'registrationFormButtonLabel': "Register",
166
167// Registration page - warning messages
168 'registrationFormWarningMessageNotMatchingPassphrases':"Your passphrases don't match, please re-type them.",
169 'registrationFormWarningMessageSafetyCheckNotSelected':"Please read and check all the boxes below.",
170 'registrationFormWarningMessageTermsOfServiceCheckNotSelected':"You need to agree to the Terms of Service.",
171
172 // Registration page - message panel
173 'registrationMessagePanelInitialTitle': "Creating account …",
174 'registrationMessagePanelInitialText': "---",
175 'registrationMessagePanelInitialButtonLabel': "Cancel",
176 'registrationMessagePanelRegistrationDoneTitle': "Registration",
177 'registrationMessagePanelRegistrationDoneText': "Done",
178 'registrationMessagePanelFailureTitle': "Registration failed",
179 'registrationMessagePanelFailureButtonLabel': "Close",
180
181// Registration page - message panel - connection
182 'connectionRegistrationSendingRequestMessageText': "Verifying credentials",
183 'connectionRegistrationSendingCredentialsMessageText':"Sending credentials",
184
185// Registration page - splash panel
186 'registrationSplashPanelTitle': "Security advice",
187 'registrationSplashPanelDescription': "<p>These are your Clipperz credentials, take good care of them. Clipperz will never display your username and passphrase a second time!</p>",
188 'registrationSplashPanelUsernameLabel': "username",
189 'registrationSplashPanelPassphraseLabel':"passphrase",
190
191 'registrationSplashPanelShowPassphraseButtonLabel':"show passphrase",
192
193 //Header links
194 'donateHeaderLinkLabel': "donate",
195 'creditsHeaderLinkLabel': "credits",
196 'feedbackHeaderLinkLabel': "feedback",
197 'helpHeaderLinkLabel': "help",
198 'forumHeaderLinkLabel': "forum",
199
200 //Menu labels
201 'recordMenuLabel': "cards",
202 'accountMenuLabel': "account",
203 'dataMenuLabel': "data",
204 'contactsMenuLabel': "contacts",
205 'toolsMenuLabel': "tools",
206 'logoutMenuLabel': "logout",
207 'lockMenuLabel': "lock",
208
209 //Lock dialog
210 'lockTitle': "The account is locked",
211 'lockDescription': "<p>To unlock your account, please enter your passphrase.</p>",
212 'unlockButtonLabel': "Unlock",
213
214 //Account panel - change passphrase
215 'changePasswordTabLabel': "Change your passphrase",
216 'changePasswordTabTitle': "Change your passphrase",
217
218 'changePasswordFormUsernameLabel': "username",
219 'changePasswordFormOldPassphraseLabel': "old passphrase",
220 'changePasswordFormNewPassphraseLabel': "new passphrase",
221 'changePasswordFormRetypePassphraseLabel':"re-enter new passphrase",
222 'changePasswordFormSafetyCheckboxLabel':"I understand that Clipperz will not be able to recover a lost passphrase.",
223 'changePasswordFormSubmitLabel': "Change passphrase",
224
225 //Account panel - change passphrase - warning messages
226 'changePasswordFormWrongUsernameWarning': "Wrong username",
227 'changePasswordFormWrongPassphraseWarning': "Wrong passphrase",
228 'changePasswordFormWrongRetypePassphraseWarning':"Your passphrases don't match, please re-type them.",
229 'changePasswordFormSafetyCheckWarning': "Please read and check the box below.",
230
231 //Account panel - change passphrase - progress dialog
232 'changePasswordFormProgressDialogTitle': "Changing user credentials",
233 'changePasswordFormProgressDialogEmptyText': "---",
234 'changePasswordFormProgressDialogConnectedMessageTitle': "Connected",
235 'changePasswordFormProgressDialogConnectedMessageText': "Done",
236 'changePasswordFormProgressDialogErrorMessageTitle': "Error",
237 'changePasswordFormProgressDialogErrorMessageText': "Credentials change failed!",
238
239 'changeCredentialsPanelEncryptingDataMessageTitle': "Changing your passphrase",
240 'changeCredentialsPanelEncryptingDataMessageText': "Local encryption of card headers",
241 'changeCredentialsPanelCreatingNewCredentialsMessageTitle': "Changing your passphrase",
242 'changeCredentialsPanelCreatingNewCredentialsMessageText': "Updating your credentials",
243 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageTitle':"Changing your passphrase",
244 'changeCredentialsPanelSendingNewCredentialsToTheServerMessageText':"Uploading your encrypted credentials to Clipperz",
245 'changeCredentialsPanelDoneMessageTitle': "Changing your passphrase",
246 'changeCredentialsPanelDoneMessageText': "Done",
247
248 //Account panel - OTP
249 'manageOTPTabLabel': "Manage your one-time passphrases",
250 'manageOTPTabTitle': "Manage your one-time passphrases",
251
252 'manageOTPTabDescription':"\
253 <p>A one-time passphrase works like your regular passphrase, but can be used only once.</p>\
254 <p>If the same passphrase is used again at a later stage in a login attempt it will be rejected and the login process will fail.</p>\
255 <p>Immediately after a successful login, your one-time passphrase will be deleted preventing any fraudulent access.</p>\
256 <p>One-time passphrases are an excellent choice if one is concerned about keyloggers or spyware infections that may be collecting data from compromised machines.</p>\
257 <p><b>It's strongly advisable to use one-time passphrases when accessing Clipperz from public terminals, such as Internet cafes and libraries.</b></p>",
258
259 //Account panel - OTP - OTP table
260'oneTimePasswordReadOnlyMessage': "\
261 <h6>Sorry!</h6>\
262 <p>You cannot manage your one-time passphrases when using the offline version of Clipperz.</p>",
263
264 'oneTimePasswordLoadingMessage':"\
265 <h6>Loading data</h6>\
266 <p>Please wait …</p>",
267
268 'oneTimePasswordNoPasswordAvailable':"\
269 <h6>No one-time passphrase available</h6>\
270 <p>Click the “New” button above to add one-time passphrases to your account.</p>",
271
272 'createNewOTPButtonLabel': "New",
273 'deleteOTPButtonLabel': "Delete",
274 'printOTPButtonLabel': "Print",
275
276 'disabledOneTimePassword_warning': "disabled",
277
278 'oneTimePasswordSelectionLink_selectLabel':"Select:",
279 'oneTimePasswordSelectionLink_all': "all",
280 'oneTimePasswordSelectionLink_none': "none",
281 'oneTimePasswordSelectionLink_used': "used",
282 'oneTimePasswordSelectionLink_unused': "unused",
283
284//Account panel - OTP - saving new OTP dialog
285 'saveOTP_encryptUserDataTitle': "Saving one-time passphrase",
286 'saveOTP_encryptUserDataText': "Processing new OTP credentials …",
287 'saveOTP_encryptOTPDataTitle': "Saving one-time passphrase",
288 'saveOTP_encryptOTPDataText': "Local encryption of authentication data …",
289 'saveOTP_sendingDataTitle': "Saving one-time passphrase",
290 'saveOTP_sendingDataText': "Sending authentication data to the server …",
291 'saveOTP_updatingInterfaceTitle': "Saving one-time passphrase",
292 'saveOTP_updatingInterfaceText': "Updating interface",
293
294// Account panel - preferences
295 'accountPreferencesLabel': "Preferences",
296 'accountPreferencesTabTitle': "Preferences",
297
298 'accountPreferencesLanguageTitle': "Language",
299 'accountPreferencesLanguageDescription':"<p>Choose your preferred language from the list below.</p>",
300
301 'showDonationReminderPanelTitle': "Donation reminders",
302 'showDonationReminderPanelDescription': "<p>Show donation reminders</p>",
303
304 'saveUserPreferencesFormSubmitLabel': "Save",
305 'cancelUserPreferencesFormSubmitLabel': "Cancel",
306
307// Account panel - preferences - saving dialog
308 'accountPreferencesSavingPanelTitle_Step1': "Saving preferences",
309 'accountPreferencesSavingPanelText_Step1': "Local encryption of your preferences",
310 'accountPreferencesSavingPanelTitle_Step2': "Saving preferences",
311 'accountPreferencesSavingPanelText_Step2': "Sending encrypted preferences to Clipperz",
312
313 //Account panel - login history
314 'accountLoginHistoryLabel': "Login history",
315 'loginHistoryTabTitle': "Login history",
316
317 'loginHistoryReadOnlyMessage': "\
318 <h6>Sorry!</h6>\
319 <p>The login history is not available while using the offline version of Clipperz.</p>",
320
321 'loginHistoryLoadingMessage': "\
322 <h6>Loading data</h6>\
323 <p>Please wait …</p>",
324
325 'loginHistoryLoadedMessage': "\
326 <h6>Your latest 10 logins</h6>\
327 <p></p>",
328
329 'loginHistoryIPLabel': "IP",
330 'loginHistoryTimeLabel': "date",
331 'loginHistoryCurrentSessionText': "current session",
332 'loginHistoryReloadButtonLabel': "Reload login history",
333
334 //Account panel - delete account
335 'deleteAccountTabLabel': "Delete your account",
336 'deleteAccountTabTitle': "Delete your account",
337
338 'deleteAccountFormUsernameLabel': "username",
339 'deleteAccountFormPassphraseLabel': "passphrase",
340 'deleteAccountFormSafetyCheckboxLabel': "I understand that all my data will be deleted and that this action is irreversible.",
341 'deleteAccountFormSubmitLabel': "Delete my account",
342
343//Account panel - delete account - warnings
344 'deleteAccountFormWrongUsernameWarning':"Wrong username",
345 'deleteAccountFormWrongPassphraseWarning':"Wrong passphrase",
346 'deleteAccountFormSafetyCheckWarning': "Please read and check the box below.",
347
348//Account panel - delete account - confirmation
349 'accountPanelDeletingAccountPanelConfirmationTitle':"ATTENTION",
350 'accountPanelDeleteAccountPanelConfirmationText': "Are your sure you want to delete your account?",
351 'accountPanelDeleteAccountPanelConfirmButtonLabel': "Yes",
352 'accountPanelDeleteAccountPanelDenyButtonLabel': "No",
353
354//Account panel - delete account - confirmation
355 'accountPanelDeletingAccountPanelProgressTitle': "Deleting the account data",
356 'accountPanelDeletingAccountPanelProgressText': "The operation could take long, please be patient.",
357
358//Data panel - offline copy
359 'offlineCopyTabLabel': "Offline copy",
360 'offlineCopyTabTitle': "Offline copy",
361
362'offlineCopyTabDescription': "\
363 <!-- FIX CSS DONE! -->\
364 <p>With just one click you can dump all your encrypted data from Clipperz servers to your hard disk and create a read-only offline version of Clipperz to be used when you are not connected to the Internet.</p>\
365 <p>The read-only version is as secure as the read-and-write one and will not expose your data to higher risks since they both share the same code and security architecture.</p>\
366 <ol>\
367 <li><p>Click the link below to start the download.</p></li>\
368 <li><p>The browser will ask you what to do with the “Clipperz_YYYYMMDD.html” file. Save it on your hard disk.</p></li>\
369 <li><p>Double click on the downloaded file to launch the offline version in your browser.</p></li>\
370 <li><p>Enter the usual username and passphrase.</p></li>\
371 </ol>",
372
373 'offlineCopyDownloadLinkLabel': "Download",
374
375 //Data panel - offline copy - not updated
376 'offlineCopyDownloadWarning': "\
377 <!-- FIX CSS DONE! -->\
378 <h4><a href=\"#\" id=\"offlineCopyDownloadWarningLink\">Update your “offline copy”!</a></h4>\
379 <p>You have recently created or modified one or more cards, it would be wise to download a new copy of the offline version.</p>",
380
381 'offlineCopyDownloadOk': "",
382
383 //Data panel - sharing
384 'sharingTabLabel': "Sharing",
385 'sharingTabTitle': "Sharing",
386
387 'sharingTabDescription': "\
388 <p>Quite often a confidential piece of information needs to be shared with one or more persons.</p>\
389 <p>This could be as simple as giving your colleague the access code of your voice mailbox when you are out of the office, or as complicated as enabling the entitled heirs to access your safe deposit box at the local bank when you pass on.</p>\
390 <p>Clipperz can make sharing your secrets a secure and straightforward process.</p>\
391 <p></p>\
392 <p><b>Coming soon …</b></p>",
393
394 // Data panel - import
395 'importTabLabel': "Import",
396 'importTabTitle': "Import",
397
398 'importTabDescription': "<p>You can bulk import data to your Clipperz account from several file formats.</p>",
399
400 //Data panel - export
401 'printingTabLabel': "Export",
402 'printingTabTitle': "Export",
403
404 'printingTabDescription': "\
405 <h5>Printing</h5>\
406 <p>Click on the link below to open a new window displaying all your cards in a printable format.</p>\
407 <p>If you are going to print for backup purposes, please consider the safer option provided by the “offline copy”.</p>",
408
409 'printingLinkLabel': "Printable version",
410
411 'exportTabDescription': "\
412 <h5>Exporting to JSON</h5>\
413 <p>JSON enables a “lossless” export of your cards. All the information will be preserved, including direct login configurations.</p>\
414 <p>This custom format it’s quite convenient if you need to move some of all of your cards to a different Clipperz account. Or if you want to restore a card that has been accidentally deleted.</p>\
415 <p>Click on the link below to start the export process.</p>",
416
417 'exportLinkLabel': "Export to JSON",
418
419 'exportDataInProgressDescription':"<h4>Exporting, please wait while your data are being processed …</h4>",
420
421 'exportDataDescription': "\
422 <h4>Instructions</h4>\
423 <p>Copy the text below to your favorite editor and save it. (e.g. “clipperz_export_20071217.json”)</p>",
424
425 //Contacts panel
426 'contactsTabLabel': "Contacts",
427 'contactsTabTitle': "Contacts",
428
429//Tools panel - password generator
430 'passwordGeneratorTabLabel': "Password generator",
431 'bookmarkletTabLabel': "Bookmarklet",
432 'compactTabLabel': "Compact edition",
433 'httpAuthTabLabel': "HTTP authentication",
434
435 'passwordGeneratorTabTitle': "Password generator",
436 'bookmarkletTabTitle': "Bookmarklet",
437 'compactTabTitle': "Compact edition",
438 'httpAuthTabTitle': "HTTP authentication",
439
440
441 //Tools panel - password generator - description
442 'paswordGeneratorTabDescription':"<p></p>",
443 'passwordGeneratorTabButtonLabel':"Generate password",
444
445 //Tools panel - bookmarklet
446 'bookmarkletTabLabel': "Bookmarklet",
447 'bookmarkletTabTitle': "Bookmarklet",
448
449 'bookmarkletTabDescription': "\
450 <!-- FIX CSS DONE! -->\
451 <p>A bookmarklet is a simple “one-click” tool that can perform very useful tasks. It can be saved and used like a normal web page bookmark.</p>\
452 <p>The Clipperz bookmarklet will help you to quickly create new cards and new “direct logins” within existing cards.</p>\
453 <p><b>Please note that the bookmarklet does not include any information related to your account (e.g. your username or passphrase), the bookmarklet is a general tool containing the same code for every Clipperz user.</b></p>\
454 <h3>How to install the bookmarklet</h3>\
455 <h>Firefox, Camino, Opera, Safari</h5>\
456 <ol>\
457 <li><p>Make sure that the “Bookmarks Bar” is displayed by selecting “View > Toolbars > Bookmarks”, or similar menu items, from the browser menu.</p></li>\
458 <li><p>Drag and drop the “Add to Clipperz” link below to the bookmark bar.</p></li>\
459 </ol>\
460 \
461 <h5>Internet Explorer</h5>\
462 <ol>\
463 <li><p>Make sure that the “Links” toolbar is displayed by selecting “View > Toolbars > Links” from the browser menu.</p></li>\
464 <li><p>Right-click on the “Add to Clipperz” link below.</p></li>\
465 <li><p>Select “Add to favorites” from the contextual menu.</p></li>\
466 <li><p>Click “Yes” for any security message that pops up.</p></li>\
467 <li><p>Open the “Links” folder and click “OK”</p></li>\
468 </ol>",
469
470 'bookmarkletTabBookmarkletTitle':"Add to Clipperz",
471
472 //Tools panel - bookmarklet - instructions
473 'bookmarkletTabInstructions': "\
474 <!-- FIX CSS DONE! -->\
475 <h3>How to create a new card inclusive of a “direct login” link to an online service</h3>\
476 <ol>\
477 <li><p>Open the web page where the login form is hosted. (this is the page where you usually enter your sign-in credentials)</p></li>\
478 <li><p>Launch the bookmarklet by clicking on it: a pop-up window will appear over the web page.</p></li>\
479 <li><p>Copy to the clipboard the content of the large text area within the pop-up. (ctrl-C)</p></li>\
480 <li><p>Enter your Clipperz account and click on the <b>Add new card</b> button.</p></li>\
481 <li><p>Select the “Direct login” template and paste the content of the clipboard to the large text area in the form. (ctrl-V)</p></li>\
482 <li><p>Press the <b>Create</b> button, complete and review the details, then click <b>Save</b>.</p></li>\
483 </ol>\
484 \
485 <h3>How to add a “direct login” link to an existing card</h3>\
486 <ol>\
487 <li><p>Same as above.</p></li>\
488 <li><p>Same as above.</p></li>\
489 <li><p>Same as above.</p></li>\
490 <li><p>Enter your Clipperz account and select the card containing the credentials for the web service you just visited and click the <b>Edit</b> button.</p></li>\
491 <li><p>Paste the content of the clipboard to the large text area in the “Direct logins” section. (ctrl-V)</p></li>\
492 <li><p>Press the <b>Add direct login</b> button, review the details and then click <b>Save</b>.</p></li>\
493 </ol>\
494 \
495 <p></p>\
496 <p>Further information about the bookmarklet are <a href=\"http://www.clipperz.com/support/user_guide/bookmarklet\" target=\"_blank\">available here</a>.</p>",
497
498 //Tools panel - Compact - instructions
499 'compactTabDescription': "\
500 <!-- FIX CSS DONE! -->\
501 <p>Clipperz Compact is a special version of Clipperz designed to be opened in the Firefox sidebar.</p>\
502 <p>Its purpose is to keep your collection of “direct logins” always at hand. Read more <a href=\"http://www.clipperz.com/support/user_guide/clipperz_compact\", target=\"blank\">here</a></p>\
503 \
504 <h3>How to launch Clipperz Compact in the sidebar</h3>\
505 <ol>\
506 <li><p>Get Firefox! Sidebars are only available in Firefox and you need to switch to Firefox in order to enjoy the convenience of Clipperz Compact.</p></li>\
507 <li>\
508 <p>Add the following URL to Firefox bookmarks, or even better, drag it to the bookmark bar.</p>\
509 <div id=\"compactLinkBox\"><a href=\"https://www.clipperz.com/beta/index.html?compact\" target=\"_search\">Clipperz Compact</a></div>\
510 </li>\
511 <li><p>Change the properties of the bookmark so that “load this bookmark in the sidebar” is checked.</p></li>\
512 </ol>\
513 \
514 <h5>Added bonus: Clipperz Compact works also in Opera’s panel.</h5>",
515
516 //Tools panel - HTTP authentication - instructions
517 'httpAuthTabDescription': "\
518 <!-- FIX CSS DONE! -->\
519 <p>HTTP authentication is a method designed to allow a web browser to provide credentials – in the form of a username and password – including them in a website address (HTTP or HTTPS URL).</p>\
520 <p>Nowadays it is rarely used, but it can still be found on small, private websites. You can tell that a website is protected by HTTP authentication when the browser displays a pop-up window to enter username and password.</p>\
521 <p>Unfortunately the Clipperz bookmarklet does not work on websites that use HTTP authentication. However you can still create a “direct login”.</p>\
522 \
523 <h3>How to create a “direct login” for a website that uses HTTP authentication</h3>\
524 <ol>\
525 <li><p>Store website URL, username and password in a new card.</p></li>\
526 <li><p>Copy the configuration below and paste it to the large text area in the “Direct logins” section of the new card.</p></li>\
527 <li><p>Press the <b>Add direct login</b> button, bind URL, username and password fields and then click <b>Save</b>.</p></li>\
528 </ol>\
529 \
530 <h5><a href=\"http://support.microsoft.com/kb/834489\" target=\"_blank\">Warning: Internet Explorer does not support HTTP authentication.</a></h5>",
531
532// Direct logins block
533 'mainPanelDirectLoginBlockLabel': "Direct logins",
534 'directLinkReferenceShowButtonLabel': "show",
535
536// Direct logins - blank slate
537 'mainPanelDirectLoginBlockDescription': "\
538 <!-- FIX CSS DONE! -->\
539 <p>Add “direct logins” to sign in to your web accounts without typing usernames and passwords!</p>\
540 <p>“Direct logins” greatly enhance your password security since you can:</p>\
541 <ul>\
542 <li><p>conveniently adopt and enter complex passwords;</p></li>\
543 <li><p>never re-use the same and easy-to-guess password.</p></li>\
544 </ul>\
545 <p>Simple and quick configuration with the <b>Clipperz bookmarklet</b>.</p>\
546 <a href=\"http://www.clipperz.com/support/user_guide/direct_logins\" target=\"_blank\">Learn more about “direct logins”</a>",
547
548 // Cards block
549 'mainPanelRecordsBlockLabel': "Cards",
550 'mainPanelAddRecordButtonLabel': "Add new card",
551 'mainPanelRemoveRecordButtonLabel': "Delete card",
552
553// Cards block - filter tabs
554 'mainPanelRecordFilterBlockAllLabel': "all",
555 'mainPanelRecordFilterBlockTagsLabel': "tags",
556 'mainPanelRecordFilterBlockSearchLabel':"search",
557
558// Cards block - blank slate
559 'recordDetailNoRecordAtAllTitle': "Welcome to Clipperz!",
560 'recordDetailNoRecordAtAllDescription': "\
561 <h5>Get started by adding cards to your account.</h5>\
562 <p>Cards are simple and flexible forms where you can store your passwords and any other confidential data.</p>\
563 <p>Cards could contain credentials for accessing a web site, the combination of your bicycle lock, details of your credit card, …</p>\
564 \
565 <h5>Don't forget the Clipperz bookmarklet!</h5>\
566 <p>Before you start, install the “Add to Clipperz” bookmarklet: it will make creating cards easier and more fun.</p>\
567 <p>Go to the “Tools” tab to discover how to install it and how it use it.</p>\
568 <p></p>\
569 <p>Then simply click the <b>\"Add new card\"</b> button and enjoy your Clipperz account.</p>\
570 <p></p>\
571 <a href=\"http://www.clipperz.com/support/user_guide/managing_cards\" target=\"_blank\">Learn more about creating and managing cards</a>",
572
573// Cards block - new card wizard - bookmarklet configuration
574 'newRecordWizardTitleBox': "\
575 <h5>Please select a template</h5>\
576 <p>Cards are simple and flexible forms where you can store passwords or any other confidential data.</p>\
577 <p>Start choosing one of the templates below. You can always customize your cards later by adding or removing fields.</p>",
578
579 'newRecordWizardBookmarkletConfigurationTitle': "Direct login",
580 'newRecordWizardBookmarkletConfigurationDescription':"\
581 <p>Paste below the configuration code generated by the Clipperz bookmarklet.</p>\
582 <p>A new card complete with a direct login to your web account will be created.</p>",
583
584 'newRecordWizardCreateButtonLabel': "Create",
585 'newRecordWizardCancelButtonLabel': "Cancel",
586
587 //Create new card - Donation splash
588 'donateSplashPanelTitle': "Support Clipperz, make a donation today!",
589 'donateSplashPanelDescription': "\
590 <!-- FIX CSS DONE! -->\
591 <p>A few good reasons to make a donation:</p>\
592 <ul>\
593 <li><p>support the development of new features</p></li>\
594 <li><p>keep Clipperz free</p></li>\
595 <li><p>show appreciation for our hard work</p></li>\
596 </ul>\
597 <p>For any further information, please visit our <a href=\"http://www.clipperz.com/donations\" target=\"_blank\">Donations page</a>.</p>\
598 <p><b>Ready to donate?</b></p>",
599
600 'donateCloseButtonLabel': "Not yet",
601 'donateDonateButtonLabel': "Yes",
602
603// Card templates
604'recordTemplates': {
605
606//Web password
607 'WebAccount': {
608 'title': "Web password",
609 'description':"<p>A simple card to store login credentials for your online services.</p>",
610 'fields': [
611 {label:"Web address", type:'URL'},
612 {label:"Username or email", type:'TXT'},
613 {label:"Password", type:'PWD'}
614 ]
615 },
616
617 //Bank account
618 'BankAccount': {
619 'title': "Bank account",
620 'description':"<p>Safely store your bank account number and online banking credentials.</p>",
621 'fields': [
622 {label:"Bank", type:'TXT'},
623 {label:"Account number", type:'TXT'},
624 {label:"Bank website", type:'URL'},
625 {label:"Online banking ID", type:'TXT'},
626 {label:"Online banking password", type:'PWD'}
627 ]
628 },
629
630 // Credit card
631 'CreditCard': {
632 'title': "Credit card",
633 'description':"<p>Card number, expire date, CVV2 and PIN always at hand with Clipperz.</p>",
634 'fields': [
635 {label:"Type (Visa, AmEx, …)", type:'TXT'},
636 {label:"Number", type:'TXT'},
637 {label:"Owner name", type:'TXT'},
638 {label:"Expiry date", type:'TXT'},
639 {label:"CVV2", type:'TXT'},
640 {label:"PIN", type:'PWD'},
641 {label:"Card website", type:'URL'},
642 {label:"Username", type:'TXT'},
643 {label:"Password", type:'PWD'}
644 ]
645 },
646
647 // Address book entry
648 'AddressBookEntry': {
649 'title': "Address book entry",
650 'description':"<p>Clipperz could also work as your new private address book. Use this template to easily add a new entry.</p>",
651 'fields': [
652 {label:"Name", type:'TXT'},
653 {label:"Email", type:'TXT'},
654 {label:"Phone", type:'TXT'},
655 {label:"Mobile", type:'TXT'},
656 {label:"Address", type:'ADDR'}
657 ]
658 },
659
660//Custom card
661 'Custom': {
662 'title': "Custom card",
663 'description':"<p>No matter which kind of confidential data you need to protect, create a custom card to match your needs.</p>",
664 'fields': [
665 {label:"Label 1", type:'TXT'},
666 {label:"Label 2", type:'TXT'},
667 {label:"Label 3", type:'TXT'}
668 ]
669 }
670},
671
672
673'recordFieldTypologies': {
674 'TXT': {
675 description: "simple text field",
676 shortDescription: "text"
677 },
678 'PWD': {
679 description: "simple text field, with default status set to hidden",
680 shortDescription: "password"
681 },
682 'URL': {
683 description: "simple text field in edit mode, that became an active url in view mode",
684 shortDescription: "web address"
685 },
686 'DATE': {
687 description: "a value set with a calendar helper",
688 shortDescription: "date"
689 },
690 'ADDR': {
691 description: "just like the URL, but the active link points to Google Maps (or similar service) passing the address value as argument",
692 shortDescription: "street address"
693 },
694 'CHECK': {
695 description: "check description",
696 shortDescription: "check"
697 },
698 'RADIO': {
699 description: "radio description",
700 shortDescription: "radio"
701 },
702 'SELECT': {
703 description: "select description",
704 shortDescription: "select"
705 }
706},
707
708// Cards block - new card - warnings
709 'newRecordPanelGeneralExceptionTitle': "Error",
710 'newRecordPanelGeneralExceptionMessage': "The configuration text is not valid. Make sure to get your text from the bookmarklet pop-up and retry.",
711 'newRecordPanelWrongBookmarkletVersionExceptionTitle': "Error",
712 'newRecordPanelWrongBookmarkletVersionExceptionMessage':"The configuration text has been generated by an old version of the bookmarklet. Please update your bookmarklet and retry.",
713 'newRecordPanelExceptionPanelCloseButtonLabel': "Cancel",
714
715// Cards block - delete card
716 'mainPanelDeletingRecordPanelConfirmationTitle': "Deleting selected card",
717 'mainPanelDeleteRecordPanelConfirmationText': "Do your really want to delete the selected card?",
718 'mainPanelDeleteRecordPanelConfirmButtonLabel': "Yes",
719 'mainPanelDeleteRecordPanelDenyButtonLabel': "No",
720 'mainPanelDeletingRecordPanelInitialTitle': "Deleting selected card",
721 'mainPanelDeletingRecordPanelInitialText': "---",
722 'mainPanelDeletingRecordPanelCompletedText': "Done",
723
724// Cards block - delete card panel
725 'deleteRecordPanelCollectRecordDataMessageTitle': "Delete card",
726 'deleteRecordPanelCollectRecordDataMessageText': "Updating card list",
727 'deleteRecordPanelEncryptUserDataMessageTitle': "Delete card",
728 'deleteRecordPanelEncryptUserDataMessageText': "Local encryption of card headers",
729 'deleteRecordPanelSendingDataToTheServerMessageTitle': "Delete card",
730 'deleteRecordPanelSendingDataToTheServerMessageText': "Uploading encrypted card headers to Clipperz",
731 'deleteRecordPanelUpdatingTheInterfaceMessageTitle': "Delete card",
732 'deleteRecordPanelUpdatingTheInterfaceMessageText': "Updating the interface",
733
734// Cards block - no record selected
735 'recordDetailNoRecordSelectedTitle': "No card selected",
736 'recordDetailNoRecordSelectedDescription': "<p>Please select a card from the list on the left.</p>",
737
738 // Cards block - loading messages
739 'recordDetailLoadingRecordMessage': "Downloading encrypted card from Clipperz",
740 'recordDetailDecryptingRecordMessage': "Local decryption of card\'s data",
741 'recordDetailLoadingRecordVersionMessage': "Downloading latest card version",
742 'recordDetailDecryptingRecordVersionMessage': "Local decryption of latest version",
743 'recordDetailLoadingErrorMessageTitle': "Error while downloading the card",
744
745// Cards block - card details
746 'recordDetailNotesLabel': "Notes",
747 'recordDetailLabelFieldColumnLabel': "Field label",
748 'recordDetailDataFieldColumnLabel': "Field data",
749 'recordDetailTypeFieldColumnLabel': "Type",
750
751 'recordDetailSavingChangesMessagePanelInitialTitle': "Saving card",
752 'recordDetailSavingChangesMessagePanelInitialText': "---",
753
754 'recordDetailRemoveFieldButtonLabel': "-",
755 'recordDetailAddFieldButtonLabel': "Add new field",
756 'recordDetailPasswordFieldHelpLabel': "click the stars to select the password and then Ctrl-C to copy",
757
758 'recordDetailPasswordFieldScrambleLabel': "scramble",
759 'recordDetailPasswordFieldUnscrambleLabel': "unscramble",
760
761 'recordDetailDirectLoginBlockTitle': "Direct logins",
762 'recordDetailNewDirectLoginDescription': "<p>Direct login configuration</p>",
763
764 'recordDetailDirectLoginBlockNoDirectLoginConfiguredDescription':"\
765 <p>Does this card contain credentials to access an online service?</p>\
766 <p>Use the bookmarklet to configure a “direct login” from Clipperz with just one click!</p>",
767
768 'recordDetailDeleteDirectLoginButtonLabel': "-",
769 'recordDetailAddNewDirectLoginButtonLabel': "Add new direct login",
770
771 'recordDetailEditButtonLabel': "Edit",
772 'recordDetailSaveButtonLabel': "Save",
773 'recordDetailCancelButtonLabel': "Cancel",
774
775 'newRecordTitleLabel': "_new card_",
776 'newDirectLoginLabelSuffix': "",
777
778// Cards block - save card panel
779 'recordSaveChangesPanelCollectRecordInfoMessageTitle': "Save card",
780 'recordSaveChangesPanelCollectRecordInfoMessageText': "Updating card headers",
781 'recordSaveChangesPanelEncryptUserDataMessageTitle': "Save card",
782 'recordSaveChangesPanelEncryptUserDataMessageText': "Local encryption of card headers",
783 'recordSaveChangesPanelEncryptRecordDataMessageTitle': "Save card",
784 'recordSaveChangesPanelEncryptRecordDataMessageText': "Local encryption of card's data",
785 'recordSaveChangesPanelEncryptRecordVersionDataMessageTitle':"Save card",
786 'recordSaveChangesPanelEncryptRecordVersionDataMessageText':"Local encryption of card's version data",
787 'recordSaveChangesPanelSendingDataToTheServerMessageTitle': "Save card",
788 'recordSaveChangesPanelSendingDataToTheServerMessageText': "Uploading encrypted card's header to Clipperz",
789 'recordSaveChangesPanelUpdatingTheInterfaceMessageTitle': "Save card",
790 'recordSaveChangesPanelUpdatingTheInterfaceMessageText': "Updating the interface",
791
792 //Password Generator strings
793 'passwordGeneratorPanelTitle': "Password generator",
794 'passwordGeneratorPanelOkLabel': "Ok",
795 'passwordGeneratorPanelCancelLabel': "Cancel",
796
797 'passwordGeneratorLowercaseLabel': "abc",
798 'passwordGeneratorUppercaseLabel': "ABC",
799 'passwordGeneratorNumberLabel': "012",
800 'passwordGeneratorSymbolLabel': "@#$",
801
802 'passwordGeneratorLengthLabel': "length:",
803
804
805 //Miscellaneous strings
806
807 'comingSoon': "coming soon …",
808 'panelCollectingEntryopyMessageText': "Collecting entropy",
809 'directLoginConfigurationCheckBoxFieldSelectedValue': "Yes",
810 'directLoginConfigurationCheckBoxFieldNotSelectedValue': "No",
811
812
813
814// NEW - Import panel
815 'importFormats':{
816 'CSV': {
817 'label': "CSV",
818 'description':"<p>A widely recognized file format that stores tabular data. Several password managers can export data to this format.</p>"
819 },
820 'Excel': {
821 'label': "Excel",
822 'description':"<p>The popular spreadsheet from Microsoft. Storing passwords in Excel files is very common but not advisable.</p>"
823 },
824 'KeePass': {
825 'label': "KeePass",
826 'description':"<p>The custom TXT file created by KeePass password manager.</p>"
827 },
828 'PasswordPlus': {
829 'label': "Password Plus",
830 'description':"<p>The custom CSV format produced by Password Plus, a password manager mostly used on mobile devices.</p>"
831 },
832 'Roboform': {
833 'label': "RoboForm",
834 'description':"<p>The special HTML file created by Roboform password manager when displaying Passcard and Safenotes for printing.</p>"
835 },
836 'ClipperzExport': {
837 'label': "JSON",
838 'description':"<p>The file created by Clipperz itself in JSON format. It preserves all information contained in your cards, even direct login configurations.</p>"
839 }
840},
841
842 //JSON
843 'Clipperz_ImportWizard_Title': "JSON import",
844 'importOptions_clipperz_description': "<p>Open the JSON file exported from Clipperz in a text editor. Then copy and paste its content to the text area below.</p>",
845
846 //CSV
847 'CSV_ImportWizard_Title': "CSV import",
848 'importOptions_csv_description_': "\
849 <p>Open the CSV file in a text editor. Then copy and paste its content to the text area below.</p>\
850 <p>Please select the special characters used within your file.</p>",
851
852 //Excel
853 'Excel_ImportWizard_Title': "Excel import",
854 'importOptions_excel_description_': "<p>Open the Excel file and select the cells you want to import. Then copy and paste them to the text area below.</p>",
855
856 //KeePass
857 'KeePass_ImportWizard_Title': "KeePass import",
858 'importOptions_keePass_description_': "<p>Open the TXT file created by Keepass in a text editor. Then copy and paste its content to the text area below.</p>",
859
860 //PasswordPlus
861 'PasswordPlus_ImportWizard_Title': "Password Plus import",
862 'importOptions_passwordPlus_description':"<p>Open the CSV file created by PasswordPlus in a text editor. Then copy and paste its content to the text area below.</p>",
863
864 //RoboForm
865 'RoboForm_ImportWizard_Title': "RoboForm import",
866 'importOptions_roboForm_description': "<p>Open the HTML file created by RoboForm in a text editor. Then copy and paste its content to the text area below.</p>",
867
868
869 'importData_parsingDataTitle': "Import",
870 'importData_parsingDataText': "Parsing data …",
871
872 'importData_previewingDataTitle': "Import",
873 'importData_previewingDataText': "Processing data …",
874
875 'importData_processingDataTitle': "Import",
876 'importData_processingDataText': "Creating new cards …",
877
878'ImportWizard': {
879 'EDIT': "edit",
880 'PREVIEW': "preview",
881 'IMPORT': "import",
882
883 'KEEPASS_SETTINGS': "settings",
884
885 'CSV_EDIT': "paste",
886 'CSV_COLUMNS': "columns",
887 'CSV_HEADER': "labels",
888 'CSV_TITLE': "titles",
889 'CSV_NOTES': "notes",
890 'CSV_FIELDS': "types",
891
892 'EXCEL_EDIT': "edit"
893},
894
895 'CSV_ImportWizard_Columns': "<p>Select the columns you want to import.</p>",
896 'CSV_ImportWizard_Header': "<p>If the first row of the CSV file contains field labels, tick off the checkbox below.</p>",
897 'CSV_ImportWizard_Header_Settings_firstRowHeaderLabel':"Use the first row as labels?",
898 'CSV_ImportWizard_Title': "<p>Select the column that contains titles of the cards you are importing. (mandatory)</p>",
899 'CSV_ImportWizard_Notes': "<p>Select the column that represents a \"notes\" field. (optional)</p>",
900 'CSV_ImportWizard_Notes_Settings_noSelectionLabel': "\"notes\" field not present",
901 'CSV_ImportWizard_Fields': "<p>Select the correct type for each column from the drop down lists.</p>",
902 'CSV_ImportWizard_Fields_MissingLabelWarning': "Missing label",
903
904 'importData_importConfirmation_title': "Import",
905 'importData_importConfirmation_text': "Do you want to import __numberOfRecords__ cards?",
906
907
908 //Vulnerability warning
909 'VulnerabilityWarning_Panel_title': "Vulnerability warning",
910 'VulnerabilityWarning_Panel_message': "The action as been aborted due to a catched vulnerability",
911 'VulnerabilityWarning_Panel_buttonLabel':"Close",
912
913
914
915 //All the loginInfo panel infos
916
917 'WELCOME_BACK': "Welcome back!",
918
919 'currentConnectionText': "You are connected from ip&nbsp;__ip__, apparently from __country__, using __browser__ on __operatingSystem__.",
920 'latestConnectionText': "Your latest connection was __elapsedTimeDescription__ (__time__) from ip&nbsp;__ip__, apparently from __country__, using __browser__ on __operatingSystem__.",
921
922 'fullLoginHistoryLinkLabel': "show login history",
923
924'elapsedTimeDescriptions': {
925 'MORE_THAN_A_MONTH_AGO': "more than a month ago",
926 'MORE_THAN_A_WEEK_AGO': "more than a week ago",
927 'MORE_THAN_*_WEEKS_AGO': "more than __elapsed__ weeks ago",
928 'YESTERDAY': "yesterday",
929 '*_DAYS_AGO': "__elapsed__ days ago",
930 'ABOUT_AN_HOUR_AGO': "about an hour ago",
931 '*_HOURS_AGO': "__elapsed__ hours ago",
932 'JUST_A_FEW_MINUTES_AGO': "just a few minutes ago",
933 'ABOUT_*_MINUTES_AGO': "about __elapsed__ minutes ago"
934},
935
936 'unknown_ip': "unknown",
937
938'countries': {
939 '--': "unknown",
940 'AD': "Andorra",
941 'AE': "United Arab Emirates",
942 'AF': "Afghanistan",
943 'AG': "Antigua and Barbuda",
944 'AI': "Anguilla",
945 'AL': "Albania",
946 'AM': "Armenia",
947 'AN': "Netherlands Antilles",
948 'AO': "Angola",
949 'AP': "Non-Spec Asia Pas Location",
950 'AR': "Argentina",
951 'AS': "American Samoa",
952 'AT': "Austria",
953 'AU': "Australia",
954 'AW': "Aruba",
955 'AX': "Aland Islands",
956 'AZ': "Azerbaijan",
957 'BA': "Bosnia and Herzegowina",
958 'BB': "Barbados",
959 'BD': "Bangladesh",
960 'BE': "Belgium",
961 'BF': "Burkina Faso",
962 'BG': "Bulgaria",
963 'BH': "Bahrain",
964 'BI': "Burundi",
965 'BJ': "Benin",
966 'BM': "Bermuda",
967 'BN': "Brunei Darussalam",
968 'BO': "Bolivia",
969 'BR': "Brazil",
970 'BS': "Bahamas",
971 'BT': "Bhutan",
972 'BW': "Botswana",
973 'BY': "Belarus",
974 'BZ': "Belize",
975 'CA': "Canada",
976 'CD': "Congo the Democratic Republic of the",
977 'CF': "Central African Republic",
978 'CH': "Switzerland",
979 'CI': "Cote D'ivoire",
980 'CK': "Cook Islands",
981 'CL': "Chile",
982 'CM': "Cameroon",
983 'CN': "China",
984 'CO': "Colombia",
985 'CR': "Costa Rica",
986 'CS': "Serbia and Montenegro",
987 'CU': "Cuba",
988 'CY': "Cyprus",
989 'CZ': "Czech Republic",
990 'DE': "Germany",
991 'DJ': "Djibouti",
992 'DK': "Denmark",
993 'DO': "Dominican Republic",
994 'DZ': "Algeria",
995 'EC': "Ecuador",
996 'EE': "Estonia",
997 'EG': "Egypt",
998 'ER': "Eritrea",
999 'ES': "Spain",
1000 'ET': "Ethiopia",
1001 'EU': "European Union",
1002 'FI': "Finland",
1003 'FJ': "Fiji",
1004 'FM': "Micronesia Federated States of",
1005 'FO': "Faroe Islands",
1006 'FR': "France",
1007 'GA': "Gabon",
1008 'GB': "United Kingdom",
1009 'GD': "Grenada",
1010 'GE': "Georgia",
1011 'GF': "French Guiana",
1012 'GG': "Guernsey",
1013 'GH': "Ghana",
1014 'GI': "Gibraltar",
1015 'GL': "Greenland",
1016 'GM': "Gambia",
1017 'GP': "Guadeloupe",
1018 'GR': "Greece",
1019 'GT': "Guatemala",
1020 'GU': "Guam",
1021 'GW': "Guinea-Bissau",
1022 'GY': "Guyana",
1023 'HK': "Hong Kong",
1024 'HN': "Honduras",
1025 'HR': "Croatia (Local Name: Hrvatska)",
1026 'HT': "Haiti",
1027 'HU': "Hungary",
1028 'ID': "Indonesia",
1029 'IE': "Ireland",
1030 'IL': "Israel",
1031 'IM': "Isle of Man",
1032 'IN': "India",
1033 'IO': "British Indian Ocean Territory",
1034 'IQ': "Iraq",
1035 'IR': "Iran (Islamic Republic of)",
1036 'IS': "Iceland",
1037 'IT': "Italy",
1038 'JE': "Jersey",
1039 'JM': "Jamaica",
1040 'JO': "Jordan",
1041 'JP': "Japan",
1042 'KE': "Kenya",
1043 'KG': "Kyrgyzstan",
1044 'KH': "Cambodia",
1045 'KI': "Kiribati",
1046 'KN': "Saint Kitts and Nevis",
1047 'KR': "Korea Republic of",
1048 'KW': "Kuwait",
1049 'KY': "Cayman Islands",
1050 'KZ': "Kazakhstan",
1051 'LA': "Lao People's Democratic Republic",
1052 'LB': "Lebanon",
1053 'LC': "Saint Lucia",
1054 'LI': "Liechtenstein",
1055 'LK': "Sri Lanka",
1056 'LR': "Liberia",
1057 'LS': "Lesotho",
1058 'LT': "Lithuania",
1059 'LU': "Luxembourg",
1060 'LV': "Latvia",
1061 'LY': "Libyan Arab Jamahiriya",
1062 'MA': "Morocco",
1063 'MC': "Monaco",
1064 'MD': "Moldova Republic of",
1065 'MG': "Madagascar",
1066 'MH': "Marshall Islands",
1067 'MK': "Macedonia the Former Yugoslav Republic of",
1068 'ML': "Mali",
1069 'MM': "Myanmar",
1070 'MN': "Mongolia",
1071 'MO': "Macau",
1072 'MP': "Northern Mariana Islands",
1073 'MR': "Mauritania",
1074 'MS': "Montserrat",
1075 'MT': "Malta",
1076 'MU': "Mauritius",
1077 'MV': "Maldives",
1078 'MW': "Malawi",
1079 'MX': "Mexico",
1080 'MY': "Malaysia",
1081 'MZ': "Mozambique",
1082 'NA': "Namibia",
1083 'NC': "New Caledonia",
1084 'NF': "Norfolk Island",
1085 'NG': "Nigeria",
1086 'NI': "Nicaragua",
1087 'NL': "Netherlands",
1088 'NO': "Norway",
1089 'NP': "Nepal",
1090 'NR': "Nauru",
1091 'NU': "Niue",
1092 'NZ': "New Zealand",
1093 'OM': "Oman",
1094 'PA': "Panama",
1095 'PE': "Peru",
1096 'PF': "French Polynesia",
1097 'PG': "Papua New Guinea",
1098 'PH': "Philippines",
1099 'PK': "Pakistan",
1100 'PL': "Poland",
1101 'PR': "Puerto Rico",
1102 'PS': "Palestinian Territory Occupied",
1103 'PT': "Portugal",
1104 'PW': "Palau",
1105 'PY': "Paraguay",
1106 'QA': "Qatar",
1107 'RO': "Romania",
1108 'RS': "Serbia",
1109 'RU': "Russian Federation",
1110 'RW': "Rwanda",
1111 'SA': "Saudi Arabia",
1112 'SB': "Solomon Islands",
1113 'SC': "Seychelles",
1114 'SD': "Sudan",
1115 'SE': "Sweden",
1116 'SG': "Singapore",
1117 'SI': "Slovenia",
1118 'SK': "Slovakia (Slovak Republic)",
1119 'SL': "Sierra Leone",
1120 'SM': "San Marino",
1121 'SN': "Senegal",
1122 'SR': "Suriname",
1123 'SV': "El Salvador",
1124 'SY': "Syrian Arab Republic",
1125 'SZ': "Swaziland",
1126 'TC': "Turks and Caicos Islands",
1127 'TG': "Togo",
1128 'TH': "Thailand",
1129 'TJ': "Tajikistan",
1130 'TM': "Turkmenistan",
1131 'TN': "Tunisia",
1132 'TO': "Tonga",
1133 'TR': "Turkey",
1134 'TT': "Trinidad and Tobago",
1135 'TV': "Tuvalu",
1136 'TW': "Taiwan Province of China",
1137 'TZ': "Tanzania United Republic of",
1138 'UA': "Ukraine",
1139 'UG': "Uganda",
1140 'US': "United States",
1141 'UY': "Uruguay",
1142 'UZ': "Uzbekistan",
1143 'VA': "Holy See (Vatican City State)",
1144 'VE': "Venezuela",
1145 'VG': "Virgin Islands (British)",
1146 'VI': "Virgin Islands (U.S.)",
1147 'VN': "Viet Nam",
1148 'VU': "Vanuatu",
1149 'WF': "Wallis and Futuna Islands",
1150 'WS': "Samoa",
1151 'YE': "Yemen",
1152 'ZA': "South Africa",
1153 'ZM': "Zambia",
1154 'ZW': "Zimbabwe",
1155 'ZZ': "Reserved"
1156},
1157
1158'browsers': {
1159 'UNKNOWN': "Unknown",
1160 'MSIE': "Internet Explorer",
1161 'FIREFOX': "Firefox",
1162 'OPERA': "Opera",
1163 'SAFARI': "Safari",
1164 'OMNIWEB': "OmniWeb",
1165 'CAMINO': "Camino",
1166 'CHROME': "Chrome"
1167},
1168
1169'operatingSystems': {
1170 'UNKNOWN': "Unknown",
1171 'WINDOWS': "Windows",
1172 'MAC': "Mac",
1173 'LINUX': "Linux",
1174 'IPHONE': "iPhone",
1175 'MOBILE': "Mobile",
1176 'OPENBSD': "OpenBSD",
1177 'FREEBSD': "FreeBSD",
1178 'NETBSD': "NetBSD"
1179},
1180
1181
1182 //Calendar texts
1183'calendarStrings': {
1184 'months': {
1185 '0':"January",
1186 '1':"February",
1187 '2':"March",
1188 '3':"April",
1189 '4':"May",
1190 '5':"June",
1191 '6':"July",
1192 '7':"August",
1193 '8':"September",
1194 '9':"October",
1195 '10':"November",
1196 '11':"December"
1197 },
1198 'shortMonths':{
1199 '0':"Jan",
1200 '1':"Feb",
1201 '2':"Mar",
1202 '3':"Apr",
1203 '4':"May",
1204 '5':"Jun",
1205 '6':"Jul",
1206 '7':"Aug",
1207 '8':"Sep",
1208 '9':"Oct",
1209 '10':"Nov",
1210 '11':"Dec"
1211 },
1212
1213 'days':{
1214 '0':"Sunday",
1215 '1':"Monday",
1216 '2':"Tuesday",
1217 '3':"Wednesday",
1218 '4':"Thursday",
1219 '5':"Friday",
1220 '6':"Saturday"
1221 },
1222
1223 'shortDays':{
1224 '0':"Sun",
1225 '1':"Mon",
1226 '2':"Tue",
1227 '3':"Wed",
1228 '4':"Thu",
1229 '5':"Fri",
1230 '6':"Sat"
1231 },
1232
1233 'veryShortDays':{
1234 '0':"Su",
1235 '1':"Mo",
1236 '2':"Tu",
1237 '3':"We",
1238 '4':"Th",
1239 '5':"Fr",
1240 '6':"Sa"
1241 },
1242
1243 'amDesignation':"am",
1244 'pmDesignation':"pm"
1245
1246},
1247
1248// Date format
1249 'fullDate_format':"l, F d, Y H:i:s",
1250*/
1251//################################################################################
1252/*
1253'pageHeader': {
1254 'donation':"donAte",
1255 'forum':"foRum",
1256 'credits':"creDits",
1257 'feedback':"feeDback",
1258 'help': "hElp"
1259},
1260
1261
1262'bookmarkletCopy': {
1263 'noExceptionMessage':"The direct login configuration has been collected.",
1264 'exceptionMessage': "Sorry! There was an error while processing the page.",
1265 'copy': "copy",
1266 'successfulMessage':"DONE!",
1267 'failMessage': "Failed! :("
1268},
1269*/
1270//################################################################################
1271
1272'Wizards': {
1273 'DirectLoginWizard': {
1274 'LABEL': {
1275 'name': "label",
1276 'description': "Enter a name for your new direct login."
1277 },
1278 'TYPE': {
1279 'name': "type",
1280 'description': "short description of the different types of direct login available"
1281 },
1282 'CONFIGURATION': {
1283 'name': "config", //"bookmarklet config",
1284 'description': "Paste the code collected by the bookmarklet. (To install the bookmarklet drag the link below to the bookmark bar of your browser.)"
1285 },
1286 'BINDINGS': {
1287 'name': "bindings",
1288 'description': "Select the right value for each field from the drop down menus."
1289 },
1290 'FAVICON': {
1291 'name': "favicon",
1292 'description': "If you are not satisfied with the small icon for this direct login, enter the URL of a new image file (.ico, .png, .jpg)."
1293 },
1294 'DONE': {
1295 'name': "done",
1296 'description': "Congratulations! You have created a new direct login using credentials contained in your '__cardName__' card.\nEnjoy 1-clik access to '__directLoginName__'!"
1297 }
1298 },
1299 'NewUserWizard': {
1300 'CREDENTIALS': {
1301 'name': "credentials",
1302 'description': "[choose you credentials]"
1303 },
1304 'CHECK_CREDENTIALS': {
1305 'name': "check credentials",
1306 'description': "[check credentials]"
1307 },
1308 'TERMS_OF_SERVICE': {
1309 'name': "terms of service",
1310 'description': "[terms of service]"
1311 },
1312 'CREATE_USER': {
1313 'name': "login",
1314 'description': "[create user]"
1315 }//,
1316/*
1317 'LOGIN': {
1318 'name': "login",
1319 'description': "[enjoy Clipperz]"
1320 },
1321*/
1322 }
1323},
1324
1325
1326'exceptionsMessages': {
1327 'Clipperz': {
1328 'Crypto': {
1329 'Base': {
1330 'exception': {
1331 'CorruptedMessage': "Corrupted message"
1332 }
1333 }
1334 }
1335 }
1336},
1337
1338
1339__syntaxFix__: "syntax fix"
1340
1341}
diff --git a/frontend/gamma/js/Clipperz/PM/Toll.js b/frontend/gamma/js/Clipperz/PM/Toll.js
new file mode 100644
index 0000000..a533f51
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/Toll.js
@@ -0,0 +1,194 @@
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
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31
32//=============================================================================
33
34Clipperz.PM.Toll = function(args) {
35 args = args || {};
36
37 this._requestType = args.requestType;
38 this._targetValue = args.targetValue;
39 this._cost = args.cost;
40 this._toll = null;
41
42 return this;
43}
44
45Clipperz.PM.Toll.prototype = MochiKit.Base.update(null, {
46
47 'toString': function() {
48 return "Clipperz.PM.Toll (" + this.requestType() + ": " + this.cost() + " - " + ((this.toll() == null)? 'UNPAID' : 'PAID') + ")";
49 },
50
51 //-------------------------------------------------------------------------
52
53 'requestType': function() {
54 return this._requestType;
55 },
56
57 //-------------------------------------------------------------------------
58
59 'targetValue': function() {
60 return this._targetValue;
61 },
62
63 //-------------------------------------------------------------------------
64
65 'cost': function() {
66 return this._cost;
67 },
68
69 //-------------------------------------------------------------------------
70
71 'toll': function() {
72 return this._toll;
73 },
74
75 //-------------------------------------------------------------------------
76/*
77 '__pay': function() {
78 varresult;
79 vartargetData;
80 vartargetMatchSize;
81 var prefixMatchingBits;
82 varpayment;
83 var i;
84
85 if (this.toll() == null) {
86 i = 0;
87 targetData = new Clipperz.ByteArray("0x" + this.targetValue());
88 targetMatchSize = this.cost();
89
90 payment = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32);
91
92 do {
93 varpaymentData;
94
95 //payment = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32);
96 payment.increment();
97 paymentData = Clipperz.Crypto.SHA.sha256(payment);
98 // prefixMatchingBits = this.prefixMatchingBits(targetData, paymentData);
99 prefixMatchingBits = Clipperz.ByteArray.prefixMatchingBits(targetData, paymentData);
100 i++;
101 } while (prefixMatchingBits < targetMatchSize);
102
103 this._toll = payment.toHexString().substring(2)
104 }
105
106 return this;
107 },
108 */
109 //-------------------------------------------------------------------------
110
111 'innerDeferredPay': function (aTargetValue, aCost, aPayment) {
112 var deferredResult;
113 var result;
114 var payment;
115 var i;
116
117 result = null;
118 payment = aPayment;
119 i = 0;
120
121 while ((result == null) && (i < Clipperz.PM.Toll.numberOfCloseLoopIterations)) {
122 if (Clipperz.ByteArray.prefixMatchingBits(aTargetValue, Clipperz.Crypto.SHA.sha256(payment)) > aCost) {
123 result = payment;
124 } else {
125 payment.increment();
126 }
127
128 i ++;
129 }
130
131 if (result == null) {
132 deferredResult = MochiKit.Async.callLater(Clipperz.PM.Toll.pauseBetweenEachCloseLoop, MochiKit.Base.method(this, 'innerDeferredPay', aTargetValue, aCost, aPayment));
133 } else {
134 deferredResult = MochiKit.Async.succeed(result);
135 }
136
137 return deferredResult;
138 },
139
140 'deferredPay': function () {
141 vardeferredResult;
142 vartoll;
143
144 toll = this;
145 deferredResult = new Clipperz.Async.Deferred("Toll.deferredPay");
146//deferredResult.addLog("--->>> deferredPay - " + this.cost());
147 deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'getRandomBytes', 32);
148 deferredResult.addMethod(toll, 'innerDeferredPay', new Clipperz.ByteArray("0x" + this.targetValue()), this.cost());
149 deferredResult.addCallback(MochiKit.Base.bind(function(aPayment) {
150 var result;
151
152 result = {
153 targetValue: this.targetValue(),
154 toll: aPayment.toHexString().substr(2)
155 };
156
157 return result;
158 }, this));
159//deferredResult.addLog("<<<--- deferredPay - " + this.cost());
160 deferredResult.callback();
161
162 return deferredResult;
163 },
164
165 //=========================================================================
166 __syntaxFix__: "syntax fix"
167
168});
169
170
171Clipperz.PM.Toll.validate = function(aTargetValue, aToll, aCost) {
172 var result;
173 vartollValue;
174 var targetValue;
175 var hashedTollValue;
176 var payedToll;
177
178 tollValue = new Clipperz.ByteArray("0x" + aToll);
179 targetValue = new Clipperz.ByteArray("0x" + aTargetValue);
180 hashedTollValue = Clipperz.Crypto.SHA.sha256(tollValue);
181
182 payedToll = Clipperz.ByteArray.prefixMatchingBits(targetValue, hashedTollValue);
183
184 if (payedToll < aCost) {
185 result = false;
186 } else {
187 result = true;
188 }
189
190 return result;
191};
192
193Clipperz.PM.Toll.numberOfCloseLoopIterations = 50;
194Clipperz.PM.Toll.pauseBetweenEachCloseLoop = 0.5; \ No newline at end of file
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/download.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/download.js
new file mode 100644
index 0000000..169946a
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/download.js
@@ -0,0 +1,120 @@
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//
30 //download.js
31 //Download
32//
33 //Created by Giulio Cesare Solaroli on 3/15/10
34 //Copyright 2010 Clipperz
35 //This code was generated by Opacity. You may use or modify it in any way.
36//
37
38var kClipperz_PM_UI_Canvas_CoverActions_downloadWidth = 46.0;
39var kClipperz_PM_UI_Canvas_CoverActions_downloadHeight = 46.0;
40
41function Clipperz_PM_UI_Canvas_CoverActions_download(canvas, aColor, aFillColor, aThickness)
42{
43 var context = canvas.getContext("2d");
44 var alignStroke;
45 var resolution;
46 var stroke;
47 var path;
48 var pointX;
49 var pointY;
50 if (window.devicePixelRatio)
51 resolution = window.devicePixelRatio;
52 else
53 resolution = 1.0;
54 resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_CoverActions_downloadWidth + canvas.height / kClipperz_PM_UI_Canvas_CoverActions_downloadHeight);
55
56 context.save();
57 context.scale(canvas.width / kClipperz_PM_UI_Canvas_CoverActions_downloadWidth, canvas.height / kClipperz_PM_UI_Canvas_CoverActions_downloadHeight);
58 context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_CoverActions_downloadWidth, kClipperz_PM_UI_Canvas_CoverActions_downloadHeight);
59
60 // arrow
61
62 stroke = aThickness;
63 stroke *= resolution;
64 if (stroke < 1.0)
65 stroke = Math.ceil(stroke);
66 else
67 stroke = Math.round(stroke);
68 stroke /= resolution;
69 alignStroke = (0.5 * stroke * resolution) % 1.0;
70 context.beginPath();
71 pointX = 16.5;
72 pointY = 22.5;
73 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
74 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
75 context.moveTo(pointX, pointY);
76 pointX = 19.5;
77 pointY = 8.5;
78 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
79 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
80 context.lineTo(pointX, pointY);
81 pointX = 30.038;
82 pointY = 10.605;
83 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
84 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
85 context.lineTo(pointX, pointY);
86 pointX = 27.354;
87 pointY = 24.354;
88 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
89 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
90 context.lineTo(pointX, pointY);
91 pointX = 33.28;
92 pointY = 25.293;
93 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
94 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
95 context.lineTo(pointX, pointY);
96 pointX = 19.81;
97 pointY = 36.828;
98 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
99 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
100 context.lineTo(pointX, pointY);
101 pointX = 10.07;
102 pointY = 21.617;
103 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
104 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
105 context.lineTo(pointX, pointY);
106 pointX = 16.5;
107 pointY = 22.5;
108 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
109 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
110 context.lineTo(pointX, pointY);
111 context.closePath();
112 context.fillStyle = aFillColor;
113 context.fill();
114 context.strokeStyle = aColor;
115 context.lineWidth = stroke;
116 context.lineCap = "square";
117 context.stroke();
118
119 context.restore();
120}
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/look.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/look.js
new file mode 100644
index 0000000..b8e535b
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/look.js
@@ -0,0 +1,208 @@
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//
30 //look.js
31 //Look
32//
33 //Created by Giulio Cesare Solaroli on 3/15/10
34 //Copyright 2010 Clipperz
35 //This code was generated by Opacity. You may use or modify it in any way.
36//
37
38var kClipperz_PM_UI_Canvas_CoverActions_lookWidth = 46.0;
39var kClipperz_PM_UI_Canvas_CoverActions_lookHeight = 46.0;
40
41function Clipperz_PM_UI_Canvas_CoverActions_look(canvas, aColor, aFillColor, aThickness)
42{
43 var context = canvas.getContext("2d");
44 var alignStroke;
45 var resolution;
46 var stroke;
47 var path;
48 var pointX;
49 var pointY;
50 if (window.devicePixelRatio)
51 resolution = window.devicePixelRatio;
52 else
53 resolution = 1.0;
54 resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_CoverActions_lookWidth + canvas.height / kClipperz_PM_UI_Canvas_CoverActions_lookHeight);
55
56 context.save();
57 context.scale(canvas.width / kClipperz_PM_UI_Canvas_CoverActions_lookWidth, canvas.height / kClipperz_PM_UI_Canvas_CoverActions_lookHeight);
58 context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_CoverActions_lookWidth, kClipperz_PM_UI_Canvas_CoverActions_lookHeight);
59
60 // Layer 6
61
62 stroke = aThickness;
63 stroke *= resolution;
64 if (stroke < 1.0)
65 stroke = Math.ceil(stroke);
66 else
67 stroke = Math.round(stroke);
68 stroke /= resolution;
69 alignStroke = (0.5 * stroke * resolution) % 1.0;
70 context.save();
71 context.translate(17.5, 23.0);
72 context.rotate(-0.503);
73 context.translate(-17.5, -23.0);
74 context.beginPath();
75 pointX = 28.5;
76 pointY = 31.5;
77 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
78 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
79 context.moveTo(pointX, pointY);
80 pointX = 28.5;
81 pointY = 14.5;
82 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
83 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
84 context.lineTo(pointX, pointY);
85 pointX = 6.5;
86 pointY = 14.5;
87 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
88 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
89 context.lineTo(pointX, pointY);
90 pointX = 6.5;
91 pointY = 31.5;
92 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
93 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
94 context.lineTo(pointX, pointY);
95 pointX = 28.5;
96 pointY = 31.5;
97 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
98 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
99 context.lineTo(pointX, pointY);
100 context.closePath();
101 context.fillStyle = aFillColor;
102 context.fill();
103 context.strokeStyle = aColor;
104 context.lineWidth = stroke;
105 context.lineCap = "square";
106 context.stroke();
107 context.restore();
108
109 // Layer 3
110
111 stroke = aThickness;
112 stroke *= resolution;
113 if (stroke < 1.0)
114 stroke = Math.ceil(stroke);
115 else
116 stroke = Math.round(stroke);
117 stroke /= resolution;
118 alignStroke = (0.5 * stroke * resolution) % 1.0;
119 context.save();
120 context.translate(22.5, 20.0);
121 context.rotate(-0.071);
122 context.translate(-22.5, -20.0);
123 context.beginPath();
124 pointX = 33.5;
125 pointY = 28.5;
126 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
127 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
128 context.moveTo(pointX, pointY);
129 pointX = 33.5;
130 pointY = 11.5;
131 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
132 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
133 context.lineTo(pointX, pointY);
134 pointX = 11.5;
135 pointY = 11.5;
136 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
137 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
138 context.lineTo(pointX, pointY);
139 pointX = 11.5;
140 pointY = 28.5;
141 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
142 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
143 context.lineTo(pointX, pointY);
144 pointX = 33.5;
145 pointY = 28.5;
146 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
147 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
148 context.lineTo(pointX, pointY);
149 context.closePath();
150 context.fillStyle = aFillColor;
151 context.fill();
152 context.strokeStyle = aColor;
153 context.lineWidth = stroke;
154 context.lineCap = "square";
155 context.stroke();
156 context.restore();
157
158 // Layer 4
159
160 stroke = aThickness;
161 stroke *= resolution;
162 if (stroke < 1.0)
163 stroke = Math.ceil(stroke);
164 else
165 stroke = Math.round(stroke);
166 stroke /= resolution;
167 alignStroke = (0.5 * stroke * resolution) % 1.0;
168 context.save();
169 context.translate(27.5, 18.0);
170 context.rotate(0.232);
171 context.translate(-27.5, -18.0);
172 context.beginPath();
173 pointX = 38.5;
174 pointY = 26.5;
175 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
176 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
177 context.moveTo(pointX, pointY);
178 pointX = 38.5;
179 pointY = 9.5;
180 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
181 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
182 context.lineTo(pointX, pointY);
183 pointX = 16.5;
184 pointY = 9.5;
185 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
186 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
187 context.lineTo(pointX, pointY);
188 pointX = 16.5;
189 pointY = 26.5;
190 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
191 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
192 context.lineTo(pointX, pointY);
193 pointX = 38.5;
194 pointY = 26.5;
195 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
196 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
197 context.lineTo(pointX, pointY);
198 context.closePath();
199 context.fillStyle = aFillColor;
200 context.fill();
201 context.strokeStyle = aColor;
202 context.lineWidth = stroke;
203 context.lineCap = "square";
204 context.stroke();
205 context.restore();
206
207 context.restore();
208}
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/directLogin.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/directLogin.js
new file mode 100644
index 0000000..9c4e5ba
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/directLogin.js
@@ -0,0 +1,209 @@
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//
30 //directLogin.js
31 //directLogin
32//
33 //Created by Giulio Cesare Solaroli on 3/7/10
34 //Copyright 2010 Clipperz
35 //This code was generated by Opacity. You may use or modify it in any way.
36//
37
38var kClipperz_PM_UI_Canvas_Features_directLoginWidth = 76.0;
39var kClipperz_PM_UI_Canvas_Features_directLoginHeight = 76.0;
40
41function Clipperz_PM_UI_Canvas_Features_directLogin(canvas, aColor, aBannerColor, aBannerBackgroundColor)
42{
43 var context = canvas.getContext("2d");
44 var alignStroke;
45 var resolution;
46 var stroke;
47 var path;
48 var pointX;
49 var pointY;
50 if (window.devicePixelRatio)
51 resolution = window.devicePixelRatio;
52 else
53 resolution = 1.0;
54 resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Features_directLoginWidth + canvas.height / kClipperz_PM_UI_Canvas_Features_directLoginHeight);
55
56 context.save();
57 context.scale(canvas.width / kClipperz_PM_UI_Canvas_Features_directLoginWidth, canvas.height / kClipperz_PM_UI_Canvas_Features_directLoginHeight);
58 context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Features_directLoginWidth, kClipperz_PM_UI_Canvas_Features_directLoginHeight);
59
60 // Layer 2
61
62 stroke = 6.0;
63 stroke *= resolution;
64 if (stroke < 1.0)
65 stroke = Math.ceil(stroke);
66 else
67 stroke = Math.round(stroke);
68 stroke /= resolution;
69 alignStroke = (0.5 * stroke * resolution) % 1.0;
70 context.beginPath();
71 pointX = 30.0;
72 pointY = 41.0;
73 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
74 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
75 context.moveTo(pointX, pointY);
76 pointX = 45.579;
77 pointY = 25.451;
78 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
79 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
80 context.lineTo(pointX, pointY);
81 context.strokeStyle = aColor;
82 context.lineWidth = stroke;
83 context.lineCap = "square";
84 context.stroke();
85
86 alignStroke = 0.0;
87 context.beginPath();
88 pointX = 34.207;
89 pointY = 45.697;
90 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
91 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
92 context.moveTo(pointX, pointY);
93 pointX = 24.101;
94 pointY = 37.52;
95 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
96 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
97 context.lineTo(pointX, pointY);
98 pointX = 24.122;
99 pointY = 47.828;
100 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
101 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
102 context.lineTo(pointX, pointY);
103 pointX = 34.207;
104 pointY = 45.697;
105 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
106 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
107 context.lineTo(pointX, pointY);
108 context.closePath();
109 context.fillStyle = aColor;
110 context.fill();
111
112 stroke = 6.0;
113 stroke *= resolution;
114 if (stroke < 1.0)
115 stroke = Math.ceil(stroke);
116 else
117 stroke = Math.round(stroke);
118 stroke /= resolution;
119 alignStroke = (0.5 * stroke * resolution) % 1.0;
120 context.beginPath();
121 pointX = 24.631;
122 pointY = 28.971;
123 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
124 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
125 context.moveTo(pointX, pointY);
126 pointX = 46.497;
127 pointY = 26.451;
128 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
129 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
130 context.lineTo(pointX, pointY);
131 context.strokeStyle = aColor;
132 context.stroke();
133
134 alignStroke = 0.0;
135 context.beginPath();
136 pointX = 25.014;
137 pointY = 35.265;
138 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
139 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
140 context.moveTo(pointX, pointY);
141 pointX = 22.166;
142 pointY = 22.58;
143 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
144 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
145 context.lineTo(pointX, pointY);
146 pointX = 15.784;
147 pointY = 30.675;
148 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
149 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
150 context.lineTo(pointX, pointY);
151 pointX = 25.014;
152 pointY = 35.265;
153 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
154 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
155 context.lineTo(pointX, pointY);
156 context.closePath();
157 context.fillStyle = aColor;
158 context.fill();
159
160 stroke = 6.0;
161 stroke *= resolution;
162 if (stroke < 1.0)
163 stroke = Math.ceil(stroke);
164 else
165 stroke = Math.round(stroke);
166 stroke /= resolution;
167 alignStroke = (0.5 * stroke * resolution) % 1.0;
168 context.beginPath();
169 pointX = 42.282;
170 pointY = 47.03;
171 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
172 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
173 context.moveTo(pointX, pointY);
174 pointX = 47.771;
175 pointY = 25.714;
176 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
177 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
178 context.lineTo(pointX, pointY);
179 context.strokeStyle = aColor;
180 context.stroke();
181
182 alignStroke = 0.0;
183 context.beginPath();
184 pointX = 48.294;
185 pointY = 48.929;
186 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
187 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
188 context.moveTo(pointX, pointY);
189 pointX = 35.432;
190 pointY = 47.039;
191 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
192 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
193 context.lineTo(pointX, pointY);
194 pointX = 40.7;
195 pointY = 55.899;
196 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
197 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
198 context.lineTo(pointX, pointY);
199 pointX = 48.294;
200 pointY = 48.929;
201 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
202 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
203 context.lineTo(pointX, pointY);
204 context.closePath();
205 context.fillStyle = aColor;
206 context.fill();
207
208 context.restore();
209}
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/protect.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/protect.js
new file mode 100644
index 0000000..501b69b
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/protect.js
@@ -0,0 +1,237 @@
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//
30 //protect.js
31 //protect
32//
33 //Created by Giulio Cesare Solaroli on 3/7/10
34 //Copyright 2010 Clipperz
35 //This code was generated by Opacity. You may use or modify it in any way.
36//
37
38var kClipperz_PM_UI_Canvas_Features_protectWidth = 76.0;
39var kClipperz_PM_UI_Canvas_Features_protectHeight = 76.0;
40
41function Clipperz_PM_UI_Canvas_Features_protect(canvas, aColor, aBannerColor, aBannerBackgroundColor)
42{
43 var context = canvas.getContext("2d");
44 var alignStroke;
45 var resolution;
46 var path;
47 var pointX;
48 var pointY;
49 var controlPoint1X;
50 var controlPoint1Y;
51 var controlPoint2X;
52 var controlPoint2Y;
53 var stroke;
54 if (window.devicePixelRatio)
55 resolution = window.devicePixelRatio;
56 else
57 resolution = 1.0;
58 resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Features_protectWidth + canvas.height / kClipperz_PM_UI_Canvas_Features_protectHeight);
59
60 context.save();
61 context.scale(canvas.width / kClipperz_PM_UI_Canvas_Features_protectWidth, canvas.height / kClipperz_PM_UI_Canvas_Features_protectHeight);
62 context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Features_protectWidth, kClipperz_PM_UI_Canvas_Features_protectHeight);
63
64 // Layer 1
65
66 alignStroke = 0.0;
67 context.beginPath();
68 pointX = 38.5;
69 pointY = 36.0;
70 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
71 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
72 context.moveTo(pointX, pointY);
73 pointX = 37.068;
74 pointY = 38.816;
75 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
76 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
77 controlPoint1X = 37.41;
78 controlPoint1Y = 36.234;
79 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
80 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
81 controlPoint2X = 37.175;
82 controlPoint2Y = 37.907;
83 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
84 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
85 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
86 pointX = 37.031;
87 pointY = 40.802;
88 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
89 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
90 controlPoint1X = 36.991;
91 controlPoint1Y = 39.474;
92 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
93 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
94 controlPoint2X = 36.98;
95 controlPoint2Y = 40.141;
96 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
97 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
98 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
99 pointX = 37.258;
100 pointY = 42.23;
101 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
102 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
103 controlPoint1X = 37.068;
104 controlPoint1Y = 41.283;
105 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
106 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
107 controlPoint2X = 37.139;
108 controlPoint2Y = 41.762;
109 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
110 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
111 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
112 pointX = 38.348;
113 pointY = 43.979;
114 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
115 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
116 controlPoint1X = 37.402;
117 controlPoint1Y = 42.799;
118 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
119 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
120 controlPoint2X = 37.682;
121 controlPoint2Y = 43.798;
122 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
123 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
124 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
125 pointX = 38.5;
126 pointY = 36.0;
127 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
128 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
129 controlPoint1X = 40.249;
130 controlPoint1Y = 44.497;
131 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
132 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
133 controlPoint2X = 40.723;
134 controlPoint2Y = 36.303;
135 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
136 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
137 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
138 pointX = 38.5;
139 pointY = 36.0;
140 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
141 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
142 context.lineTo(pointX, pointY);
143 context.closePath();
144 pointX = 50.0;
145 pointY = 52.0;
146 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
147 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
148 context.moveTo(pointX, pointY);
149 pointX = 26.0;
150 pointY = 52.0;
151 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
152 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
153 context.lineTo(pointX, pointY);
154 pointX = 26.0;
155 pointY = 33.0;
156 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
157 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
158 context.lineTo(pointX, pointY);
159 pointX = 50.0;
160 pointY = 33.0;
161 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
162 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
163 context.lineTo(pointX, pointY);
164 pointX = 50.0;
165 pointY = 52.0;
166 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
167 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
168 context.lineTo(pointX, pointY);
169 context.closePath();
170 context.fillStyle = aColor;
171 context.fill();
172
173 alignStroke = 0.0;
174 context.beginPath();
175 pointX = 47.0;
176 pointY = 32.463;
177 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
178 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
179 context.moveTo(pointX, pointY);
180 pointX = 38.0;
181 pointY = 52.0;
182 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
183 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
184 controlPoint1X = 47.0;
185 controlPoint1Y = 52.925;
186 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
187 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
188 controlPoint2X = 38.0;
189 controlPoint2Y = 52.0;
190 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
191 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
192 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
193 pointX = 29.0;
194 pointY = 32.463;
195 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
196 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
197 controlPoint1X = 38.0;
198 controlPoint1Y = 52.0;
199 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
200 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
201 controlPoint2X = 29.0;
202 controlPoint2Y = 52.925;
203 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
204 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
205 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
206 pointX = 47.0;
207 pointY = 32.463;
208 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
209 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
210 controlPoint1X = 29.0;
211 controlPoint1Y = 12.0;
212 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
213 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
214 controlPoint2X = 47.0;
215 controlPoint2Y = 12.0;
216 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
217 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
218 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
219 context.closePath();
220 context.strokeStyle = aColor;
221 stroke = 4.0;
222 stroke *= resolution;
223 if (stroke < 1.0)
224 stroke = Math.ceil(stroke);
225 else
226 stroke = Math.round(stroke);
227 stroke /= resolution;
228 stroke *= 2.0;
229 context.lineWidth = stroke;
230 context.lineCap = "square";
231 context.save();
232 context.clip();
233 context.stroke();
234 context.restore();
235
236 context.restore();
237}
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/share.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/share.js
new file mode 100644
index 0000000..825a17e
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/share.js
@@ -0,0 +1,1719 @@
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//
30 //share.js
31 //share
32//
33 //Created by Giulio Cesare Solaroli on 3/7/10
34 //Copyright 2010 Clipperz
35 //This code was generated by Opacity. You may use or modify it in any way.
36//
37
38var kClipperz_PM_UI_Canvas_Features_shareWidth = 76.0;
39var kClipperz_PM_UI_Canvas_Features_shareHeight = 76.0;
40
41function Clipperz_PM_UI_Canvas_Features_share(canvas, aColor, aBannerColor, aBannerBackgroundColor)
42{
43 var context = canvas.getContext("2d");
44 var alignStroke;
45 var resolution;
46 var path;
47 var pointX;
48 var pointY;
49 var controlPoint1X;
50 var controlPoint1Y;
51 var controlPoint2X;
52 var controlPoint2Y;
53 var stroke;
54 if (window.devicePixelRatio)
55 resolution = window.devicePixelRatio;
56 else
57 resolution = 1.0;
58 resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Features_shareWidth + canvas.height / kClipperz_PM_UI_Canvas_Features_shareHeight);
59
60 context.save();
61 context.scale(canvas.width / kClipperz_PM_UI_Canvas_Features_shareWidth, canvas.height / kClipperz_PM_UI_Canvas_Features_shareHeight);
62 context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Features_shareWidth, kClipperz_PM_UI_Canvas_Features_shareHeight);
63
64 // Layer 1
65
66 alignStroke = 0.0;
67 context.beginPath();
68 pointX = 43.179;
69 pointY = 18.621;
70 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
71 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
72 context.moveTo(pointX, pointY);
73 pointX = 37.163;
74 pointY = 12.605;
75 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
76 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
77 controlPoint1X = 43.179;
78 controlPoint1Y = 15.32;
79 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
80 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
81 controlPoint2X = 40.463;
82 controlPoint2Y = 12.605;
83 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
84 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
85 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
86 pointX = 31.147;
87 pointY = 18.621;
88 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
89 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
90 controlPoint1X = 33.863;
91 controlPoint1Y = 12.605;
92 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
93 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
94 controlPoint2X = 31.147;
95 controlPoint2Y = 15.32;
96 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
97 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
98 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
99 pointX = 37.163;
100 pointY = 24.637;
101 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
102 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
103 controlPoint1X = 31.147;
104 controlPoint1Y = 21.921;
105 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
106 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
107 controlPoint2X = 33.863;
108 controlPoint2Y = 24.637;
109 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
110 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
111 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
112 pointX = 43.179;
113 pointY = 18.621;
114 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
115 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
116 controlPoint1X = 40.463;
117 controlPoint1Y = 24.637;
118 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
119 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
120 controlPoint2X = 43.179;
121 controlPoint2Y = 21.921;
122 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
123 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
124 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
125 context.closePath();
126 context.fillStyle = aColor;
127 context.fill();
128
129 alignStroke = 0.0;
130 context.beginPath();
131 pointX = 56.548;
132 pointY = 53.379;
133 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
134 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
135 context.moveTo(pointX, pointY);
136 pointX = 51.2;
137 pointY = 48.032;
138 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
139 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
140 controlPoint1X = 56.548;
141 controlPoint1Y = 50.446;
142 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
143 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
144 controlPoint2X = 54.134;
145 controlPoint2Y = 48.032;
146 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
147 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
148 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
149 pointX = 45.853;
150 pointY = 53.379;
151 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
152 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
153 controlPoint1X = 48.267;
154 controlPoint1Y = 48.032;
155 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
156 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
157 controlPoint2X = 45.853;
158 controlPoint2Y = 50.446;
159 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
160 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
161 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
162 pointX = 51.2;
163 pointY = 58.727;
164 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
165 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
166 controlPoint1X = 45.853;
167 controlPoint1Y = 56.313;
168 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
169 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
170 controlPoint2X = 48.267;
171 controlPoint2Y = 58.727;
172 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
173 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
174 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
175 pointX = 56.548;
176 pointY = 53.379;
177 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
178 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
179 controlPoint1X = 54.134;
180 controlPoint1Y = 58.727;
181 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
182 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
183 controlPoint2X = 56.548;
184 controlPoint2Y = 56.313;
185 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
186 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
187 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
188 context.closePath();
189 context.fillStyle = aColor;
190 context.fill();
191
192 alignStroke = 0.0;
193 context.beginPath();
194 pointX = 31.147;
195 pointY = 38.674;
196 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
197 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
198 context.moveTo(pointX, pointY);
199 pointX = 25.8;
200 pointY = 33.326;
201 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
202 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
203 controlPoint1X = 31.147;
204 controlPoint1Y = 35.74;
205 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
206 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
207 controlPoint2X = 28.733;
208 controlPoint2Y = 33.326;
209 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
210 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
211 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
212 pointX = 20.452;
213 pointY = 38.674;
214 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
215 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
216 controlPoint1X = 22.866;
217 controlPoint1Y = 33.326;
218 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
219 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
220 controlPoint2X = 20.452;
221 controlPoint2Y = 35.74;
222 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
223 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
224 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
225 pointX = 25.8;
226 pointY = 44.021;
227 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
228 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
229 controlPoint1X = 20.452;
230 controlPoint1Y = 41.607;
231 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
232 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
233 controlPoint2X = 22.866;
234 controlPoint2Y = 44.021;
235 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
236 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
237 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
238 pointX = 31.147;
239 pointY = 38.674;
240 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
241 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
242 controlPoint1X = 28.733;
243 controlPoint1Y = 44.021;
244 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
245 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
246 controlPoint2X = 31.147;
247 controlPoint2Y = 41.607;
248 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
249 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
250 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
251 context.closePath();
252 context.fillStyle = aColor;
253 context.fill();
254
255 alignStroke = 0.0;
256 context.beginPath();
257 pointX = 39.168;
258 pointY = 48.032;
259 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
260 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
261 context.moveTo(pointX, pointY);
262 pointX = 33.821;
263 pointY = 42.684;
264 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
265 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
266 controlPoint1X = 39.168;
267 controlPoint1Y = 45.098;
268 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
269 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
270 controlPoint2X = 36.754;
271 controlPoint2Y = 42.684;
272 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
273 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
274 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
275 pointX = 28.473;
276 pointY = 48.032;
277 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
278 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
279 controlPoint1X = 30.887;
280 controlPoint1Y = 42.684;
281 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
282 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
283 controlPoint2X = 28.473;
284 controlPoint2Y = 45.098;
285 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
286 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
287 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
288 pointX = 33.821;
289 pointY = 53.379;
290 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
291 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
292 controlPoint1X = 28.473;
293 controlPoint1Y = 50.965;
294 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
295 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
296 controlPoint2X = 30.887;
297 controlPoint2Y = 53.379;
298 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
299 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
300 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
301 pointX = 39.168;
302 pointY = 48.032;
303 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
304 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
305 controlPoint1X = 36.754;
306 controlPoint1Y = 53.379;
307 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
308 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
309 controlPoint2X = 39.168;
310 controlPoint2Y = 50.965;
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 context.closePath();
315 context.fillStyle = aColor;
316 context.fill();
317
318 alignStroke = 0.0;
319 context.beginPath();
320 pointX = 56.548;
321 pointY = 29.984;
322 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
323 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
324 context.moveTo(pointX, pointY);
325 pointX = 53.206;
326 pointY = 26.642;
327 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
328 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
329 controlPoint1X = 56.548;
330 controlPoint1Y = 28.151;
331 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
332 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
333 controlPoint2X = 55.039;
334 controlPoint2Y = 26.642;
335 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
336 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
337 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
338 pointX = 49.863;
339 pointY = 29.984;
340 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
341 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
342 controlPoint1X = 51.372;
343 controlPoint1Y = 26.642;
344 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
345 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
346 controlPoint2X = 49.863;
347 controlPoint2Y = 28.151;
348 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
349 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
350 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
351 pointX = 53.206;
352 pointY = 33.326;
353 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
354 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
355 controlPoint1X = 49.863;
356 controlPoint1Y = 31.817;
357 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
358 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
359 controlPoint2X = 51.372;
360 controlPoint2Y = 33.326;
361 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
362 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
363 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
364 pointX = 56.548;
365 pointY = 29.984;
366 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
367 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
368 controlPoint1X = 55.039;
369 controlPoint1Y = 33.326;
370 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
371 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
372 controlPoint2X = 56.548;
373 controlPoint2Y = 31.817;
374 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
375 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
376 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
377 context.closePath();
378 context.fillStyle = aColor;
379 context.fill();
380
381 alignStroke = 0.0;
382 context.beginPath();
383 pointX = 49.863;
384 pointY = 39.342;
385 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
386 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
387 context.moveTo(pointX, pointY);
388 pointX = 46.521;
389 pointY = 36.0;
390 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
391 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
392 controlPoint1X = 49.863;
393 controlPoint1Y = 37.509;
394 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
395 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
396 controlPoint2X = 48.355;
397 controlPoint2Y = 36.0;
398 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
399 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
400 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
401 pointX = 43.179;
402 pointY = 39.342;
403 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
404 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
405 controlPoint1X = 44.688;
406 controlPoint1Y = 36.0;
407 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
408 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
409 controlPoint2X = 43.179;
410 controlPoint2Y = 37.509;
411 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
412 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
413 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
414 pointX = 46.521;
415 pointY = 42.684;
416 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
417 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
418 controlPoint1X = 43.179;
419 controlPoint1Y = 41.176;
420 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
421 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
422 controlPoint2X = 44.688;
423 controlPoint2Y = 42.684;
424 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
425 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
426 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
427 pointX = 49.863;
428 pointY = 39.342;
429 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
430 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
431 controlPoint1X = 48.355;
432 controlPoint1Y = 42.684;
433 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
434 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
435 controlPoint2X = 49.863;
436 controlPoint2Y = 41.176;
437 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
438 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
439 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
440 context.closePath();
441 context.fillStyle = aColor;
442 context.fill();
443
444 stroke = 1.0;
445 stroke *= resolution;
446 if (stroke < 1.0)
447 stroke = Math.ceil(stroke);
448 else
449 stroke = Math.round(stroke);
450 stroke /= resolution;
451 alignStroke = (0.5 * stroke * resolution) % 1.0;
452 context.beginPath();
453 pointX = 37.163;
454 pointY = 19.289;
455 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
456 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
457 context.moveTo(pointX, pointY);
458 pointX = 53.206;
459 pointY = 29.984;
460 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
461 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
462 context.lineTo(pointX, pointY);
463 context.strokeStyle = aColor;
464 context.lineWidth = stroke;
465 context.lineCap = "square";
466 context.stroke();
467
468 stroke = 1.0;
469 stroke *= resolution;
470 if (stroke < 1.0)
471 stroke = Math.ceil(stroke);
472 else
473 stroke = Math.round(stroke);
474 stroke /= resolution;
475 alignStroke = (0.5 * stroke * resolution) % 1.0;
476 context.beginPath();
477 pointX = 50.532;
478 pointY = 54.048;
479 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
480 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
481 context.moveTo(pointX, pointY);
482 pointX = 37.163;
483 pointY = 48.7;
484 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
485 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
486 context.lineTo(pointX, pointY);
487 context.strokeStyle = aColor;
488 context.stroke();
489
490 stroke = 1.0;
491 stroke *= resolution;
492 if (stroke < 1.0)
493 stroke = Math.ceil(stroke);
494 else
495 stroke = Math.round(stroke);
496 stroke /= resolution;
497 alignStroke = (0.5 * stroke * resolution) % 1.0;
498 context.beginPath();
499 pointX = 27.805;
500 pointY = 33.995;
501 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
502 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
503 context.moveTo(pointX, pointY);
504 pointX = 33.153;
505 pointY = 24.637;
506 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
507 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
508 context.lineTo(pointX, pointY);
509 context.strokeStyle = aColor;
510 context.stroke();
511
512 stroke = 1.0;
513 stroke *= resolution;
514 if (stroke < 1.0)
515 stroke = Math.ceil(stroke);
516 else
517 stroke = Math.round(stroke);
518 stroke /= resolution;
519 alignStroke = (0.5 * stroke * resolution) % 1.0;
520 context.beginPath();
521 pointX = 38.5;
522 pointY = 24.637;
523 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
524 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
525 context.moveTo(pointX, pointY);
526 pointX = 45.184;
527 pointY = 36.668;
528 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
529 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
530 context.lineTo(pointX, pointY);
531 context.strokeStyle = aColor;
532 context.stroke();
533
534 stroke = 1.0;
535 stroke *= resolution;
536 if (stroke < 1.0)
537 stroke = Math.ceil(stroke);
538 else
539 stroke = Math.round(stroke);
540 stroke /= resolution;
541 alignStroke = (0.5 * stroke * resolution) % 1.0;
542 context.beginPath();
543 pointX = 37.163;
544 pointY = 19.289;
545 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
546 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
547 context.moveTo(pointX, pointY);
548 pointX = 34.155;
549 pointY = 44.857;
550 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
551 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
552 context.lineTo(pointX, pointY);
553 context.strokeStyle = aColor;
554 context.stroke();
555
556 stroke = 1.0;
557 stroke *= resolution;
558 if (stroke < 1.0)
559 stroke = Math.ceil(stroke);
560 else
561 stroke = Math.round(stroke);
562 stroke /= resolution;
563 alignStroke = (0.5 * stroke * resolution) % 1.0;
564 context.beginPath();
565 pointX = 26.468;
566 pointY = 36.668;
567 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
568 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
569 context.moveTo(pointX, pointY);
570 pointX = 52.871;
571 pointY = 30.151;
572 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
573 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
574 context.lineTo(pointX, pointY);
575 context.strokeStyle = aColor;
576 context.stroke();
577
578 stroke = 1.0;
579 stroke *= resolution;
580 if (stroke < 1.0)
581 stroke = Math.ceil(stroke);
582 else
583 stroke = Math.round(stroke);
584 stroke /= resolution;
585 alignStroke = (0.5 * stroke * resolution) % 1.0;
586 context.beginPath();
587 pointX = 53.206;
588 pointY = 31.321;
589 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
590 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
591 context.moveTo(pointX, pointY);
592 pointX = 51.535;
593 pointY = 52.878;
594 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
595 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
596 context.lineTo(pointX, pointY);
597 context.strokeStyle = aColor;
598 context.stroke();
599
600 stroke = 1.0;
601 stroke *= resolution;
602 if (stroke < 1.0)
603 stroke = Math.ceil(stroke);
604 else
605 stroke = Math.round(stroke);
606 stroke /= resolution;
607 alignStroke = (0.5 * stroke * resolution) % 1.0;
608 context.beginPath();
609 pointX = 26.468;
610 pointY = 38.005;
611 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
612 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
613 context.moveTo(pointX, pointY);
614 pointX = 46.856;
615 pointY = 39.175;
616 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
617 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
618 context.lineTo(pointX, pointY);
619 context.strokeStyle = aColor;
620 context.stroke();
621
622 stroke = 1.0;
623 stroke *= resolution;
624 if (stroke < 1.0)
625 stroke = Math.ceil(stroke);
626 else
627 stroke = Math.round(stroke);
628 stroke /= resolution;
629 alignStroke = (0.5 * stroke * resolution) % 1.0;
630 context.beginPath();
631 pointX = 26.468;
632 pointY = 38.005;
633 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
634 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
635 context.moveTo(pointX, pointY);
636 pointX = 34.489;
637 pointY = 48.7;
638 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
639 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
640 context.lineTo(pointX, pointY);
641 context.strokeStyle = aColor;
642 context.stroke();
643
644 stroke = 1.0;
645 stroke *= resolution;
646 if (stroke < 1.0)
647 stroke = Math.ceil(stroke);
648 else
649 stroke = Math.round(stroke);
650 stroke /= resolution;
651 alignStroke = (0.5 * stroke * resolution) % 1.0;
652 context.beginPath();
653 pointX = 34.489;
654 pointY = 48.7;
655 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
656 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
657 context.moveTo(pointX, pointY);
658 pointX = 46.521;
659 pointY = 39.342;
660 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
661 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
662 context.lineTo(pointX, pointY);
663 context.strokeStyle = aColor;
664 context.stroke();
665
666 // Layer 2
667
668 alignStroke = 0.0;
669 context.beginPath();
670 pointX = 38.974;
671 pointY = 0.013;
672 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
673 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
674 context.moveTo(pointX, pointY);
675 pointX = 53.593;
676 pointY = 3.386;
677 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
678 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
679 controlPoint1X = 44.035;
680 controlPoint1Y = 0.11;
681 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
682 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
683 controlPoint2X = 48.977;
684 controlPoint2Y = 1.35;
685 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
686 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
687 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
688 pointX = 3.386;
689 pointY = 53.593;
690 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
691 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
692 context.lineTo(pointX, pointY);
693 pointX = 0.011;
694 pointY = 37.17;
695 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
696 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
697 controlPoint1X = 1.013;
698 controlPoint1Y = 48.448;
699 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
700 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
701 controlPoint2X = -0.062;
702 controlPoint2Y = 42.82;
703 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
704 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
705 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
706 pointX = 37.17;
707 pointY = 0.011;
708 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
709 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
710 context.lineTo(pointX, pointY);
711 pointX = 38.974;
712 pointY = 0.013;
713 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
714 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
715 controlPoint1X = 38.325;
716 controlPoint1Y = -0.004;
717 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
718 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
719 controlPoint2X = 37.723;
720 controlPoint2Y = -0.004;
721 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
722 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
723 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
724 pointX = 38.974;
725 pointY = 0.013;
726 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
727 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
728 context.lineTo(pointX, pointY);
729 context.closePath();
730 context.fillStyle = aBannerBackgroundColor;
731 context.fill();
732
733 alignStroke = 0.0;
734 context.beginPath();
735 pointX = 6.58;
736 pointY = 36.628;
737 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
738 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
739 context.moveTo(pointX, pointY);
740 pointX = 7.533;
741 pointY = 34.418;
742 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
743 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
744 controlPoint1X = 6.575;
745 controlPoint1Y = 35.794;
746 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
747 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
748 controlPoint2X = 6.893;
749 controlPoint2Y = 35.058;
750 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
751 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
752 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
753 pointX = 10.253;
754 pointY = 33.382;
755 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
756 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
757 controlPoint1X = 8.389;
758 controlPoint1Y = 33.562;
759 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
760 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
761 controlPoint2X = 9.296;
762 controlPoint2Y = 33.216;
763 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
764 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
765 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
766 pointX = 11.555;
767 pointY = 33.979;
768 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
769 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
770 controlPoint1X = 10.787;
771 controlPoint1Y = 33.479;
772 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
773 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
774 controlPoint2X = 11.221;
775 controlPoint2Y = 33.678;
776 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
777 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
778 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
779 pointX = 10.492;
780 pointY = 35.043;
781 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
782 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
783 context.lineTo(pointX, pointY);
784 pointX = 9.673;
785 pointY = 34.756;
786 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
787 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
788 controlPoint1X = 10.179;
789 controlPoint1Y = 34.868;
790 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
791 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
792 controlPoint2X = 9.906;
793 controlPoint2Y = 34.772;
794 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
795 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
796 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
797 pointX = 8.482;
798 pointY = 35.285;
799 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
800 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
801 controlPoint1X = 9.259;
802 controlPoint1Y = 34.729;
803 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
804 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
805 controlPoint2X = 8.862;
806 controlPoint2Y = 34.905;
807 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
808 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
809 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
810 pointX = 8.035;
811 pointY = 36.667;
812 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
813 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
814 controlPoint1X = 8.095;
815 controlPoint1Y = 35.671;
816 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
817 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
818 controlPoint2X = 7.946;
819 controlPoint2Y = 36.132;
820 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
821 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
822 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
823 pointX = 9.024;
824 pointY = 38.326;
825 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
826 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
827 controlPoint1X = 8.124;
828 controlPoint1Y = 37.203;
829 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
830 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
831 controlPoint2X = 8.453;
832 controlPoint2Y = 37.756;
833 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
834 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
835 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
836 pointX = 10.661;
837 pointY = 39.255;
838 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
839 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
840 controlPoint1X = 9.595;
841 controlPoint1Y = 38.897;
842 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
843 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
844 controlPoint2X = 10.141;
845 controlPoint2Y = 39.207;
846 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
847 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
848 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
849 pointX = 11.987;
850 pointY = 38.782;
851 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
852 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
853 controlPoint1X = 11.181;
854 controlPoint1Y = 39.304;
855 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
856 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
857 controlPoint2X = 11.623;
858 controlPoint2Y = 39.146;
859 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
860 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
861 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
862 pointX = 12.473;
863 pointY = 37.563;
864 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
865 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
866 controlPoint1X = 12.359;
867 controlPoint1Y = 38.409;
868 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
869 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
870 controlPoint2X = 12.522;
871 controlPoint2Y = 38.003;
872 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
873 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
874 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
875 pointX = 12.152;
876 pointY = 36.704;
877 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
878 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
879 controlPoint1X = 12.45;
880 controlPoint1Y = 37.324;
881 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
882 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
883 controlPoint2X = 12.343;
884 controlPoint2Y = 37.037;
885 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
886 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
887 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
888 pointX = 13.205;
889 pointY = 35.651;
890 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
891 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
892 context.lineTo(pointX, pointY);
893 pointX = 13.853;
894 pointY = 37.71;
895 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
896 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
897 controlPoint1X = 13.668;
898 controlPoint1Y = 36.297;
899 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
900 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
901 controlPoint2X = 13.884;
902 controlPoint2Y = 36.984;
903 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
904 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
905 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
906 pointX = 12.919;
907 pointY = 39.687;
908 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
909 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
910 controlPoint1X = 13.822;
911 controlPoint1Y = 38.436;
912 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
913 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
914 controlPoint2X = 13.51;
915 controlPoint2Y = 39.095;
916 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
917 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
918 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
919 pointX = 10.488;
920 pointY = 40.709;
921 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
922 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
923 controlPoint1X = 12.187;
924 controlPoint1Y = 40.419;
925 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
926 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
927 controlPoint2X = 11.377;
928 controlPoint2Y = 40.759;
929 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
930 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
931 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
932 pointX = 7.919;
933 pointY = 39.397;
934 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
935 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
936 controlPoint1X = 9.597;
937 controlPoint1Y = 40.656;
938 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
939 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
940 controlPoint2X = 8.741;
941 controlPoint2Y = 40.218;
942 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
943 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
944 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
945 pointX = 6.58;
946 pointY = 36.628;
947 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
948 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
949 controlPoint1X = 7.031;
950 controlPoint1Y = 38.508;
951 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
952 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
953 controlPoint2X = 6.584;
954 controlPoint2Y = 37.585;
955 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
956 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
957 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
958 pointX = 6.58;
959 pointY = 36.628;
960 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
961 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
962 context.lineTo(pointX, pointY);
963 context.closePath();
964 pointX = 17.778;
965 pointY = 32.093;
966 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
967 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
968 context.moveTo(pointX, pointY);
969 pointX = 16.824;
970 pointY = 30.396;
971 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
972 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
973 controlPoint1X = 17.715;
974 controlPoint1Y = 31.534;
975 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
976 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
977 controlPoint2X = 17.397;
978 controlPoint2Y = 30.969;
979 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
980 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
981 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
982 pointX = 15.129;
983 pointY = 29.443;
984 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
985 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
986 controlPoint1X = 16.253;
987 controlPoint1Y = 29.825;
988 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
989 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
990 controlPoint2X = 15.688;
991 controlPoint2Y = 29.507;
992 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
993 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
994 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
995 pointX = 13.658;
996 pointY = 29.978;
997 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
998 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
999 controlPoint1X = 14.569;
1000 controlPoint1Y = 29.378;
1001 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1002 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1003 controlPoint2X = 14.079;
1004 controlPoint2Y = 29.557;
1005 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1006 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1007 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1008 pointX = 13.116;
1009 pointY = 31.452;
1010 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1011 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1012 controlPoint1X = 13.236;
1013 controlPoint1Y = 30.399;
1014 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1015 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1016 controlPoint2X = 13.056;
1017 controlPoint2Y = 30.891;
1018 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1019 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1020 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1021 pointX = 14.065;
1022 pointY = 33.154;
1023 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1024 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1025 controlPoint1X = 13.175;
1026 controlPoint1Y = 32.014;
1027 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1028 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1029 controlPoint2X = 13.492;
1030 controlPoint2Y = 32.581;
1031 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1032 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1033 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1034 pointX = 15.767;
1035 pointY = 34.104;
1036 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1037 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1038 controlPoint1X = 14.638;
1039 controlPoint1Y = 33.727;
1040 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1041 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1042 controlPoint2X = 15.206;
1043 controlPoint2Y = 34.044;
1044 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1045 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1046 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1047 pointX = 17.242;
1048 pointY = 33.562;
1049 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1050 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1051 controlPoint1X = 16.329;
1052 controlPoint1Y = 34.164;
1053 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1054 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1055 controlPoint2X = 16.82;
1056 controlPoint2Y = 33.983;
1057 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1058 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1059 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1060 pointX = 17.778;
1061 pointY = 32.093;
1062 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1063 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1064 controlPoint1X = 17.663;
1065 controlPoint1Y = 33.14;
1066 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1067 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1068 controlPoint2X = 17.842;
1069 controlPoint2Y = 32.651;
1070 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1071 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1072 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1073 pointX = 17.778;
1074 pointY = 32.093;
1075 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1076 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1077 context.lineTo(pointX, pointY);
1078 context.closePath();
1079 pointX = 19.216;
1080 pointY = 32.201;
1081 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1082 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1083 context.moveTo(pointX, pointY);
1084 pointX = 18.143;
1085 pointY = 34.463;
1086 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1087 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1088 controlPoint1X = 19.228;
1089 controlPoint1Y = 32.982;
1090 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1091 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1092 controlPoint2X = 18.87;
1093 controlPoint2Y = 33.736;
1094 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1095 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1096 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1097 pointX = 15.881;
1098 pointY = 35.537;
1099 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1100 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1101 controlPoint1X = 17.415;
1102 controlPoint1Y = 35.19;
1103 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1104 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1105 controlPoint2X = 16.661;
1106 controlPoint2Y = 35.548;
1107 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1108 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1109 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1110 pointX = 13.009;
1111 pointY = 34.211;
1112 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1113 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1114 controlPoint1X = 14.88;
1115 controlPoint1Y = 35.567;
1116 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1117 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1118 controlPoint2X = 13.922;
1119 controlPoint2Y = 35.125;
1120 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1121 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1122 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1123 pointX = 11.683;
1124 pointY = 31.338;
1125 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1126 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1127 controlPoint1X = 12.076;
1128 controlPoint1Y = 33.279;
1129 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1130 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1131 controlPoint2X = 11.634;
1132 controlPoint2Y = 32.321;
1133 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1134 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1135 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1136 pointX = 12.757;
1137 pointY = 29.077;
1138 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1139 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1140 controlPoint1X = 11.671;
1141 controlPoint1Y = 30.558;
1142 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1143 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1144 controlPoint2X = 12.029;
1145 controlPoint2Y = 29.804;
1146 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1147 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1148 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1149 pointX = 15.018;
1150 pointY = 28.003;
1151 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1152 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1153 controlPoint1X = 13.484;
1154 controlPoint1Y = 28.349;
1155 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1156 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1157 controlPoint2X = 14.238;
1158 controlPoint2Y = 27.991;
1159 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1160 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1161 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1162 pointX = 17.887;
1163 pointY = 29.332;
1164 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1165 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1166 controlPoint1X = 15.999;
1167 controlPoint1Y = 27.957;
1168 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1169 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1170 controlPoint2X = 16.955;
1171 controlPoint2Y = 28.4;
1172 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1173 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1174 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1175 pointX = 19.216;
1176 pointY = 32.201;
1177 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1178 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1179 controlPoint1X = 18.801;
1180 controlPoint1Y = 30.246;
1181 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1182 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1183 controlPoint2X = 19.244;
1184 controlPoint2Y = 31.202;
1185 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1186 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1187 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1188 pointX = 19.216;
1189 pointY = 32.201;
1190 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1191 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1192 context.lineTo(pointX, pointY);
1193 context.closePath();
1194 pointX = 19.534;
1195 pointY = 22.61;
1196 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1197 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1198 context.moveTo(pointX, pointY);
1199 pointX = 21.064;
1200 pointY = 21.08;
1201 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1202 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1203 context.lineTo(pointX, pointY);
1204 pointX = 26.153;
1205 pointY = 26.17;
1206 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1207 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1208 context.lineTo(pointX, pointY);
1209 pointX = 25.162;
1210 pointY = 27.16;
1211 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1212 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1213 context.lineTo(pointX, pointY);
1214 pointX = 21.72;
1215 pointY = 23.718;
1216 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1217 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1218 context.lineTo(pointX, pointY);
1219 pointX = 21.307;
1220 pointY = 23.299;
1221 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1222 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1223 controlPoint1X = 21.621;
1224 controlPoint1Y = 23.619;
1225 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1226 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1227 controlPoint2X = 21.483;
1228 controlPoint2Y = 23.479;
1229 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1230 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1231 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1232 pointX = 20.898;
1233 pointY = 22.883;
1234 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1235 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1236 controlPoint1X = 21.131;
1237 controlPoint1Y = 23.118;
1238 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1239 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1240 controlPoint2X = 20.995;
1241 controlPoint2Y = 22.979;
1242 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1243 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1244 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1245 pointX = 24.206;
1246 pointY = 28.117;
1247 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1248 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1249 context.lineTo(pointX, pointY);
1250 pointX = 23.173;
1251 pointY = 29.149;
1252 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1253 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1254 context.lineTo(pointX, pointY);
1255 pointX = 17.946;
1256 pointY = 25.835;
1257 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1258 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1259 context.lineTo(pointX, pointY);
1260 pointX = 18.362;
1261 pointY = 26.244;
1262 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1263 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1264 controlPoint1X = 18.043;
1265 controlPoint1Y = 25.931;
1266 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1267 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1268 controlPoint2X = 18.181;
1269 controlPoint2Y = 26.068;
1270 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1271 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1272 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1273 pointX = 18.781;
1274 pointY = 26.656;
1275 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1276 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1277 controlPoint1X = 18.543;
1278 controlPoint1Y = 26.42;
1279 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1280 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1281 controlPoint2X = 18.682;
1282 controlPoint2Y = 26.557;
1283 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1284 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1285 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1286 pointX = 22.224;
1287 pointY = 30.099;
1288 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1289 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1290 context.lineTo(pointX, pointY);
1291 pointX = 21.233;
1292 pointY = 31.09;
1293 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1294 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1295 context.lineTo(pointX, pointY);
1296 pointX = 16.144;
1297 pointY = 26;
1298 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1299 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1300 context.lineTo(pointX, pointY);
1301 pointX = 17.69;
1302 pointY = 24.454;
1303 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1304 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1305 context.lineTo(pointX, pointY);
1306 pointX = 22.617;
1307 pointY = 27.53;
1308 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1309 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1310 context.lineTo(pointX, pointY);
1311 pointX = 19.534;
1312 pointY = 22.61;
1313 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1314 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1315 context.lineTo(pointX, pointY);
1316 context.closePath();
1317 pointX = 28.114;
1318 pointY = 24.208;
1319 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1320 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1321 context.moveTo(pointX, pointY);
1322 pointX = 27.057;
1323 pointY = 25.265;
1324 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1325 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1326 context.lineTo(pointX, pointY);
1327 pointX = 21.968;
1328 pointY = 20.176;
1329 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1330 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1331 context.lineTo(pointX, pointY);
1332 pointX = 23.025;
1333 pointY = 19.119;
1334 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1335 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1336 context.lineTo(pointX, pointY);
1337 pointX = 28.114;
1338 pointY = 24.208;
1339 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1340 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1341 context.lineTo(pointX, pointY);
1342 context.closePath();
1343 pointX = 23.998;
1344 pointY = 18.146;
1345 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1346 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1347 context.moveTo(pointX, pointY);
1348 pointX = 25.114;
1349 pointY = 17.03;
1350 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1351 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1352 context.lineTo(pointX, pointY);
1353 pointX = 30.693;
1354 pointY = 18.556;
1355 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1356 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1357 context.lineTo(pointX, pointY);
1358 pointX = 27.14;
1359 pointY = 15.004;
1360 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1361 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1362 context.lineTo(pointX, pointY);
1363 pointX = 28.131;
1364 pointY = 14.013;
1365 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1366 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1367 context.lineTo(pointX, pointY);
1368 pointX = 33.22;
1369 pointY = 19.102;
1370 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1371 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1372 context.lineTo(pointX, pointY);
1373 pointX = 32.157;
1374 pointY = 20.165;
1375 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1376 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1377 context.lineTo(pointX, pointY);
1378 pointX = 26.464;
1379 pointY = 18.629;
1380 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1381 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1382 context.lineTo(pointX, pointY);
1383 pointX = 30.079;
1384 pointY = 22.244;
1385 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1386 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1387 context.lineTo(pointX, pointY);
1388 pointX = 29.088;
1389 pointY = 23.235;
1390 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1391 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1392 context.lineTo(pointX, pointY);
1393 pointX = 23.998;
1394 pointY = 18.146;
1395 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1396 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1397 context.lineTo(pointX, pointY);
1398 context.closePath();
1399 pointX = 34.132;
1400 pointY = 11.188;
1401 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1402 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1403 context.moveTo(pointX, pointY);
1404 pointX = 32.813;
1405 pointY = 11.05;
1406 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1407 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1408 controlPoint1X = 33.704;
1409 controlPoint1Y = 10.921;
1410 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1411 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1412 controlPoint2X = 33.264;
1413 controlPoint2Y = 10.875;
1414 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1415 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1416 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1417 pointX = 32.116;
1418 pointY = 11.52;
1419 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1420 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1421 controlPoint1X = 32.562;
1422 controlPoint1Y = 11.149;
1423 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1424 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1425 controlPoint2X = 32.33;
1426 controlPoint2Y = 11.306;
1427 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1428 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1429 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1430 pointX = 31.57;
1431 pointY = 12.994;
1432 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1433 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1434 controlPoint1X = 31.706;
1435 controlPoint1Y = 11.93;
1436 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1437 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1438 controlPoint2X = 31.524;
1439 controlPoint2Y = 12.421;
1440 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1441 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1442 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1443 pointX = 32.571;
1444 pointY = 14.786;
1445 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1446 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1447 controlPoint1X = 31.616;
1448 controlPoint1Y = 13.567;
1449 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1450 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1451 controlPoint2X = 31.95;
1452 controlPoint2Y = 14.165;
1453 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1454 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1455 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1456 pointX = 34.329;
1457 pointY = 15.687;
1458 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1459 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1460 controlPoint1X = 33.197;
1461 controlPoint1Y = 15.412;
1462 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1463 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1464 controlPoint2X = 33.783;
1465 controlPoint2Y = 15.713;
1466 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1467 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1468 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1469 pointX = 35.693;
1470 pointY = 15.104;
1471 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1472 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1473 controlPoint1X = 34.874;
1474 controlPoint1Y = 15.662;
1475 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1476 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1477 controlPoint2X = 35.329;
1478 controlPoint2Y = 15.467;
1479 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1480 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1481 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1482 pointX = 36.261;
1483 pointY = 13.918;
1484 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1485 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1486 controlPoint1X = 36.049;
1487 controlPoint1Y = 14.747;
1488 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1489 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1490 controlPoint2X = 36.239;
1491 controlPoint2Y = 14.352;
1492 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1493 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1494 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1495 pointX = 35.872;
1496 pointY = 12.687;
1497 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1498 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1499 controlPoint1X = 36.282;
1500 controlPoint1Y = 13.484;
1501 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1502 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1503 controlPoint2X = 36.153;
1504 controlPoint2Y = 13.074;
1505 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1506 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1507 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1508 pointX = 34.695;
1509 pointY = 13.864;
1510 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1511 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1512 context.lineTo(pointX, pointY);
1513 pointX = 33.845;
1514 pointY = 13.015;
1515 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1516 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1517 context.lineTo(pointX, pointY);
1518 pointX = 35.965;
1519 pointY = 10.895;
1520 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1521 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1522 context.lineTo(pointX, pointY);
1523 pointX = 38.696;
1524 pointY = 13.626;
1525 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1526 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1527 context.lineTo(pointX, pointY);
1528 pointX = 37.992;
1529 pointY = 14.33;
1530 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1531 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1532 context.lineTo(pointX, pointY);
1533 pointX = 37.25;
1534 pointY = 13.802;
1535 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1536 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1537 context.lineTo(pointX, pointY);
1538 pointX = 37.208;
1539 pointY = 14.866;
1540 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1541 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1542 controlPoint1X = 37.287;
1543 controlPoint1Y = 14.249;
1544 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1545 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1546 controlPoint2X = 37.273;
1547 controlPoint2Y = 14.603;
1548 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1549 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1550 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1551 pointX = 36.431;
1552 pointY = 16.16;
1553 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1554 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1555 controlPoint1X = 37.1;
1556 controlPoint1Y = 15.319;
1557 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1558 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1559 controlPoint2X = 36.841;
1560 controlPoint2Y = 15.751;
1561 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1562 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1563 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1564 pointX = 34.073;
1565 pointY = 17.117;
1566 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1567 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1568 controlPoint1X = 35.757;
1569 controlPoint1Y = 16.835;
1570 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1571 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1572 controlPoint2X = 34.971;
1573 controlPoint2Y = 17.153;
1574 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1575 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1576 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1577 pointX = 31.473;
1578 pointY = 15.863;
1579 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1580 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1581 controlPoint1X = 33.155;
1582 controlPoint1Y = 17.096;
1583 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1584 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1585 controlPoint2X = 32.288;
1586 controlPoint2Y = 16.678;
1587 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1588 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1589 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1590 pointX = 30.172;
1591 pointY = 13.201;
1592 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1593 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1594 controlPoint1X = 30.649;
1595 controlPoint1Y = 15.039;
1596 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1597 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1598 controlPoint2X = 30.216;
1599 controlPoint2Y = 14.152;
1600 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1601 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1602 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1603 pointX = 31.225;
1604 pointY = 10.657;
1605 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1606 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1607 controlPoint1X = 30.128;
1608 controlPoint1Y = 12.251;
1609 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1610 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1611 controlPoint2X = 30.479;
1612 controlPoint2Y = 11.402;
1613 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1614 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1615 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1616 pointX = 33.276;
1617 pointY = 9.59;
1618 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1619 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1620 controlPoint1X = 31.872;
1621 controlPoint1Y = 10.01;
1622 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1623 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1624 controlPoint2X = 32.555;
1625 controlPoint2Y = 9.654;
1626 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1627 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1628 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1629 pointX = 35.178;
1630 pointY = 10.142;
1631 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1632 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1633 controlPoint1X = 33.996;
1634 controlPoint1Y = 9.525;
1635 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
1636 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
1637 controlPoint2X = 34.63;
1638 controlPoint2Y = 9.71;
1639 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
1640 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
1641 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
1642 pointX = 34.132;
1643 pointY = 11.188;
1644 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1645 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1646 context.lineTo(pointX, pointY);
1647 context.closePath();
1648 pointX = 34.878;
1649 pointY = 7.301;
1650 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1651 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1652 context.moveTo(pointX, pointY);
1653 pointX = 35.958;
1654 pointY = 6.22;
1655 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1656 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1657 context.lineTo(pointX, pointY);
1658 pointX = 37.25;
1659 pointY = 7.511;
1660 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1661 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1662 context.lineTo(pointX, pointY);
1663 pointX = 39.346;
1664 pointY = 10.166;
1665 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1666 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1667 context.lineTo(pointX, pointY);
1668 pointX = 38.831;
1669 pointY = 10.681;
1670 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1671 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1672 context.lineTo(pointX, pointY);
1673 pointX = 36.169;
1674 pointY = 8.592;
1675 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1676 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1677 context.lineTo(pointX, pointY);
1678 pointX = 34.878;
1679 pointY = 7.301;
1680 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1681 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1682 context.lineTo(pointX, pointY);
1683 context.closePath();
1684 pointX = 38.976;
1685 pointY = 11.351;
1686 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1687 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1688 context.moveTo(pointX, pointY);
1689 pointX = 40.005;
1690 pointY = 10.322;
1691 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1692 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1693 context.lineTo(pointX, pointY);
1694 pointX = 41.003;
1695 pointY = 11.32;
1696 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1697 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1698 context.lineTo(pointX, pointY);
1699 pointX = 39.974;
1700 pointY = 12.349;
1701 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1702 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1703 context.lineTo(pointX, pointY);
1704 pointX = 38.976;
1705 pointY = 11.351;
1706 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1707 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1708 context.lineTo(pointX, pointY);
1709 context.closePath();
1710 pointX = 41.528;
1711 pointY = 10.795;
1712 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
1713 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
1714 context.moveTo(pointX, pointY);
1715 context.fillStyle = aBannerColor;
1716 context.fill();
1717
1718 context.restore();
1719}
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/store.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/store.js
new file mode 100644
index 0000000..eaeb7f1
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/store.js
@@ -0,0 +1,310 @@
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//
30 //store.js
31 //store
32//
33 //Created by Giulio Cesare Solaroli on 3/7/10
34 //Copyright 2010 Clipperz
35 //This code was generated by Opacity. You may use or modify it in any way.
36//
37
38var kClipperz_PM_UI_Canvas_Features_storeWidth = 76.0;
39var kClipperz_PM_UI_Canvas_Features_storeHeight = 76.0;
40
41function Clipperz_PM_UI_Canvas_Features_store(canvas, aColor, aBannerColor, aBannerBackgroundColor)
42{
43 var context = canvas.getContext("2d");
44 var alignStroke;
45 var resolution;
46 var path;
47 var pointX;
48 var pointY;
49 if (window.devicePixelRatio)
50 resolution = window.devicePixelRatio;
51 else
52 resolution = 1.0;
53 resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Features_storeWidth + canvas.height / kClipperz_PM_UI_Canvas_Features_storeHeight);
54
55 context.save();
56 context.scale(canvas.width / kClipperz_PM_UI_Canvas_Features_storeWidth, canvas.height / kClipperz_PM_UI_Canvas_Features_storeHeight);
57 context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Features_storeWidth, kClipperz_PM_UI_Canvas_Features_storeHeight);
58
59 // Layer 1
60
61 alignStroke = 0.0;
62 context.beginPath();
63 pointX = 27.0;
64 pointY = 29.5;
65 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
66 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
67 context.moveTo(pointX, pointY);
68 pointX = 27.0;
69 pointY = 24.5;
70 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
71 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
72 context.lineTo(pointX, pointY);
73 pointX = 22.0;
74 pointY = 24.5;
75 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
76 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
77 context.lineTo(pointX, pointY);
78 pointX = 22.0;
79 pointY = 29.5;
80 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
81 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
82 context.lineTo(pointX, pointY);
83 pointX = 27.0;
84 pointY = 29.5;
85 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
86 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
87 context.lineTo(pointX, pointY);
88 context.closePath();
89 context.fillStyle = aColor;
90 context.fill();
91
92 alignStroke = 0.0;
93 context.beginPath();
94 pointX = 54.0;
95 pointY = 29.5;
96 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
97 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
98 context.moveTo(pointX, pointY);
99 pointX = 54.0;
100 pointY = 24.5;
101 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
102 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
103 context.lineTo(pointX, pointY);
104 pointX = 29.0;
105 pointY = 24.5;
106 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
107 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
108 context.lineTo(pointX, pointY);
109 pointX = 29.0;
110 pointY = 29.5;
111 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
112 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
113 context.lineTo(pointX, pointY);
114 pointX = 54.0;
115 pointY = 29.5;
116 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
117 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
118 context.lineTo(pointX, pointY);
119 context.closePath();
120 context.fillStyle = aColor;
121 context.fill();
122
123 alignStroke = 0.0;
124 context.beginPath();
125 pointX = 43.0;
126 pointY = 37.0;
127 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
128 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
129 context.moveTo(pointX, pointY);
130 pointX = 43.0;
131 pointY = 32.0;
132 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
133 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
134 context.lineTo(pointX, pointY);
135 pointX = 29.0;
136 pointY = 32.0;
137 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
138 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
139 context.lineTo(pointX, pointY);
140 pointX = 29.0;
141 pointY = 37.0;
142 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
143 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
144 context.lineTo(pointX, pointY);
145 pointX = 43.0;
146 pointY = 37.0;
147 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
148 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
149 context.lineTo(pointX, pointY);
150 context.closePath();
151 context.fillStyle = aColor;
152 context.fill();
153
154 alignStroke = 0.0;
155 context.beginPath();
156 pointX = 27.0;
157 pointY = 37.0;
158 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
159 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
160 context.moveTo(pointX, pointY);
161 pointX = 27.0;
162 pointY = 32.0;
163 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
164 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
165 context.lineTo(pointX, pointY);
166 pointX = 22.0;
167 pointY = 32.0;
168 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
169 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
170 context.lineTo(pointX, pointY);
171 pointX = 22.0;
172 pointY = 37.0;
173 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
174 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
175 context.lineTo(pointX, pointY);
176 pointX = 27.0;
177 pointY = 37.0;
178 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
179 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
180 context.lineTo(pointX, pointY);
181 context.closePath();
182 context.fillStyle = aColor;
183 context.fill();
184
185 alignStroke = 0.0;
186 context.beginPath();
187 pointX = 27.0;
188 pointY = 44.0;
189 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
190 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
191 context.moveTo(pointX, pointY);
192 pointX = 27.0;
193 pointY = 39.0;
194 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
195 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
196 context.lineTo(pointX, pointY);
197 pointX = 22.0;
198 pointY = 39.0;
199 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
200 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
201 context.lineTo(pointX, pointY);
202 pointX = 22.0;
203 pointY = 44.0;
204 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
205 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
206 context.lineTo(pointX, pointY);
207 pointX = 27.0;
208 pointY = 44.0;
209 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
210 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
211 context.lineTo(pointX, pointY);
212 context.closePath();
213 context.fillStyle = aColor;
214 context.fill();
215
216 alignStroke = 0.0;
217 context.beginPath();
218 pointX = 46.0;
219 pointY = 44.0;
220 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
221 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
222 context.moveTo(pointX, pointY);
223 pointX = 46.0;
224 pointY = 39.0;
225 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
226 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
227 context.lineTo(pointX, pointY);
228 pointX = 29.0;
229 pointY = 39.0;
230 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
231 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
232 context.lineTo(pointX, pointY);
233 pointX = 29.0;
234 pointY = 44.0;
235 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
236 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
237 context.lineTo(pointX, pointY);
238 pointX = 46.0;
239 pointY = 44.0;
240 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
241 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
242 context.lineTo(pointX, pointY);
243 context.closePath();
244 context.fillStyle = aColor;
245 context.fill();
246
247 alignStroke = 0.0;
248 context.beginPath();
249 pointX = 40.0;
250 pointY = 51.0;
251 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
252 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
253 context.moveTo(pointX, pointY);
254 pointX = 40.0;
255 pointY = 46.0;
256 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
257 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
258 context.lineTo(pointX, pointY);
259 pointX = 29.0;
260 pointY = 46.0;
261 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
262 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
263 context.lineTo(pointX, pointY);
264 pointX = 29.0;
265 pointY = 51.0;
266 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
267 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
268 context.lineTo(pointX, pointY);
269 pointX = 40.0;
270 pointY = 51.0;
271 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
272 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
273 context.lineTo(pointX, pointY);
274 context.closePath();
275 context.fillStyle = aColor;
276 context.fill();
277
278 alignStroke = 0.0;
279 context.beginPath();
280 pointX = 27.0;
281 pointY = 51.0;
282 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
283 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
284 context.moveTo(pointX, pointY);
285 pointX = 27.0;
286 pointY = 46.0;
287 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
288 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
289 context.lineTo(pointX, pointY);
290 pointX = 22.0;
291 pointY = 46.0;
292 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
293 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
294 context.lineTo(pointX, pointY);
295 pointX = 22.0;
296 pointY = 51.0;
297 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
298 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
299 context.lineTo(pointX, pointY);
300 pointX = 27.0;
301 pointY = 51.0;
302 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
303 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
304 context.lineTo(pointX, pointY);
305 context.closePath();
306 context.fillStyle = aColor;
307 context.fill();
308
309 context.restore();
310}
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/GraphicFunctions.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/GraphicFunctions.js
new file mode 100644
index 0000000..5de2e96
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/GraphicFunctions.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.Canvas');
30
31MochiKit.Base.update(Clipperz.PM.UI.Canvas , {
32 'marks': {
33 '!':Clipperz_PM_UI_Canvas_Marks_exclamationMark,
34 '?':Clipperz_PM_UI_Canvas_Marks_questionMark,
35 'i':Clipperz_PM_UI_Canvas_Marks_info
36 },
37
38 'features': {
39 'store': Clipperz_PM_UI_Canvas_Features_store,
40 'protect': Clipperz_PM_UI_Canvas_Features_protect,
41 'directLogin':Clipperz_PM_UI_Canvas_Features_directLogin,
42 'share': Clipperz_PM_UI_Canvas_Features_share
43 },
44
45 'tips': {
46 'open': Clipperz_PM_UI_Canvas_Tips_open,
47 'close': Clipperz_PM_UI_Canvas_Tips_close
48 },
49
50 'star': {
51 'normal': Clipperz_PM_UI_Canvas_Star_normal
52 },
53
54 'coverActions': {
55 'look': Clipperz_PM_UI_Canvas_CoverActions_look,
56 'download': Clipperz_PM_UI_Canvas_CoverActions_download
57 },
58
59 'registerButton': {
60 'normal': Clipperz_PM_UI_Canvas_RegisterButton_normal
61 },
62
63 'logo': {
64 'normal': Clipperz_PM_UI_Canvas_Logo_normal
65 },
66
67 __syntaxFix__: "syntax fix"
68});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Logo/normal.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Logo/normal.js
new file mode 100644
index 0000000..e0bea36
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Logo/normal.js
@@ -0,0 +1,65 @@
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//
30 //normal.js
31 //normal
32//
33 //Created by Giulio Cesare Solaroli on 3/25/10
34 //Copyright 2010 Clipperz
35 //This code was generated by Opacity. You may use or modify it in any way.
36//
37
38var kClipperz_PM_UI_Canvas_Logo_normalWidth = 150.0;
39var kClipperz_PM_UI_Canvas_Logo_normalHeight = 39.0;
40
41function Clipperz_PM_UI_Canvas_Logo_normal(canvas, aMainColor, aSecondaryColor)
42{
43 var context = canvas.getContext("2d");
44 var string;
45
46 context.save();
47 context.scale(canvas.width / kClipperz_PM_UI_Canvas_Logo_normalWidth, canvas.height / kClipperz_PM_UI_Canvas_Logo_normalHeight);
48 context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Logo_normalWidth, kClipperz_PM_UI_Canvas_Logo_normalHeight);
49
50 // clipper…
51
52 string = "clipper";
53 context.font = "38.0pt Helvetica-Bold";
54 context.fillStyle = aMainColor;
55 context.fillText(string, -9.0, -9.0);
56
57 // …z
58
59 string = "z";
60 context.font = "38.0pt Helvetica-Bold";
61 context.fillStyle = aSecondaryColor;
62 context.fillText(string, 125.0, -9.0);
63
64 context.restore();
65}
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/exclamationMark.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/exclamationMark.js
new file mode 100644
index 0000000..f3ae04d
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/exclamationMark.js
@@ -0,0 +1,280 @@
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//
30 //exclamationMark.js
31 //!
32//
33 //Created by Giulio Cesare Solaroli on 3/7/10
34 //Copyright 2010 Clipperz
35 //This code was generated by Opacity. You may use or modify it in any way.
36//
37
38var kClipperz_PM_UI_Canvas_Marks_exclamationMarkWidth = 50.0;
39var kClipperz_PM_UI_Canvas_Marks_exclamationMarkHeight = 50.0;
40
41function Clipperz_PM_UI_Canvas_Marks_exclamationMark(canvas, aColor)
42{
43 var context = canvas.getContext("2d");
44 var alignStroke;
45 var resolution;
46 var path;
47 var pointX;
48 var pointY;
49 var controlPoint1X;
50 var controlPoint1Y;
51 var controlPoint2X;
52 var controlPoint2Y;
53 if (window.devicePixelRatio)
54 resolution = window.devicePixelRatio;
55 else
56 resolution = 1.0;
57 resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Marks_exclamationMarkWidth + canvas.height / kClipperz_PM_UI_Canvas_Marks_exclamationMarkHeight);
58
59 context.save();
60 context.scale(canvas.width / kClipperz_PM_UI_Canvas_Marks_exclamationMarkWidth, canvas.height / kClipperz_PM_UI_Canvas_Marks_exclamationMarkHeight);
61 context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Marks_exclamationMarkWidth, kClipperz_PM_UI_Canvas_Marks_exclamationMarkHeight);
62
63 // Layer 1
64
65 alignStroke = 0.0;
66 context.beginPath();
67 pointX = 26.499;
68 pointY = 10.848;
69 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
70 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
71 context.moveTo(pointX, pointY);
72 pointX = 20.887;
73 pointY = 11.584;
74 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
75 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
76 controlPoint1X = 25.395;
77 controlPoint1Y = 10.802;
78 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
79 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
80 controlPoint2X = 22.175;
81 controlPoint2Y = 11.078;
82 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
83 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
84 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
85 pointX = 20.013;
86 pointY = 13.194;
87 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
88 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
89 controlPoint1X = 20.335;
90 controlPoint1Y = 11.814;
91 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
92 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
93 controlPoint2X = 19.921;
94 controlPoint2Y = 12.826;
95 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
96 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
97 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
98 pointX = 23.049;
99 pointY = 28.788;
100 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
101 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
102 controlPoint1X = 20.243;
103 controlPoint1Y = 15.448;
104 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
105 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
106 controlPoint2X = 22.589;
107 controlPoint2Y = 26.35;
108 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
109 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
110 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
111 pointX = 25.027;
112 pointY = 29.156;
113 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
114 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
115 controlPoint1X = 23.279;
116 controlPoint1Y = 29.018;
117 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
118 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
119 controlPoint2X = 24.705;
120 controlPoint2Y = 29.202;
121 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
122 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
123 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
124 pointX = 27.971;
125 pointY = 11.354;
126 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
127 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
128 controlPoint1X = 25.809;
129 controlPoint1Y = 25.384;
130 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
131 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
132 controlPoint2X = 27.971;
133 controlPoint2Y = 12.826;
134 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
135 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
136 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
137 pointX = 26.499;
138 pointY = 10.848;
139 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
140 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
141 controlPoint1X = 27.557;
142 controlPoint1Y = 11.032;
143 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
144 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
145 controlPoint2X = 26.913;
146 controlPoint2Y = 10.848;
147 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
148 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
149 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
150 pointX = 26.499;
151 pointY = 10.848;
152 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
153 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
154 context.lineTo(pointX, pointY);
155 context.closePath();
156 pointX = 24.337;
157 pointY = 31.962;
158 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
159 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
160 context.moveTo(pointX, pointY);
161 pointX = 21.899;
162 pointY = 32.882;
163 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
164 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
165 controlPoint1X = 23.463;
166 controlPoint1Y = 31.962;
167 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
168 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
169 controlPoint2X = 22.589;
170 controlPoint2Y = 32.284;
171 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
172 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
173 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
174 pointX = 20.703;
175 pointY = 35.458;
176 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
177 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
178 controlPoint1X = 21.163;
179 controlPoint1Y = 33.572;
180 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
181 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
182 controlPoint2X = 20.703;
183 controlPoint2Y = 34.538;
184 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
185 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
186 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
187 pointX = 21.669;
188 pointY = 38.08;
189 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
190 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
191 controlPoint1X = 20.703;
192 controlPoint1Y = 36.47;
193 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
194 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
195 controlPoint2X = 20.979;
196 controlPoint2Y = 37.344;
197 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
198 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
199 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
200 pointX = 24.015;
201 pointY = 39.0;
202 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
203 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
204 controlPoint1X = 22.405;
205 controlPoint1Y = 38.77;
206 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
207 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
208 controlPoint2X = 23.325;
209 controlPoint2Y = 39.0;
210 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
211 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
212 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
213 pointX = 26.821;
214 pointY = 38.034;
215 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
216 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
217 controlPoint1X = 25.073;
218 controlPoint1Y = 39.0;
219 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
220 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
221 controlPoint2X = 26.131;
222 controlPoint2Y = 38.724;
223 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
224 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
225 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
226 pointX = 27.833;
227 pointY = 35.55;
228 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
229 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
230 controlPoint1X = 27.465;
231 controlPoint1Y = 37.344;
232 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
233 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
234 controlPoint2X = 27.833;
235 controlPoint2Y = 36.194;
236 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
237 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
238 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
239 pointX = 26.683;
240 pointY = 32.744;
241 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
242 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
243 controlPoint1X = 27.833;
244 controlPoint1Y = 34.676;
245 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
246 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
247 controlPoint2X = 27.557;
248 controlPoint2Y = 33.572;
249 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
250 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
251 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
252 pointX = 24.337;
253 pointY = 31.962;
254 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
255 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
256 controlPoint1X = 26.085;
257 controlPoint1Y = 32.238;
258 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
259 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
260 controlPoint2X = 25.211;
261 controlPoint2Y = 31.962;
262 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
263 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
264 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
265 pointX = 24.337;
266 pointY = 31.962;
267 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
268 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
269 context.lineTo(pointX, pointY);
270 context.closePath();
271 pointX = 30.639;
272 pointY = 38.402;
273 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
274 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
275 context.moveTo(pointX, pointY);
276 context.fillStyle = aColor;
277 context.fill();
278
279 context.restore();
280}
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/info.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/info.js
new file mode 100644
index 0000000..adab74f
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/info.js
@@ -0,0 +1,391 @@
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//
30 //info.js
31 //i
32//
33 //Created by Giulio Cesare Solaroli on 3/7/10
34 //Copyright 2010 Clipperz
35 //This code was generated by Opacity. You may use or modify it in any way.
36//
37
38var kClipperz_PM_UI_Canvas_Marks_infoWidth = 50.0;
39var kClipperz_PM_UI_Canvas_Marks_infoHeight = 50.0;
40
41function Clipperz_PM_UI_Canvas_Marks_info(canvas, aColor)
42{
43 var context = canvas.getContext("2d");
44 var alignStroke;
45 var resolution;
46 var path;
47 var pointX;
48 var pointY;
49 var controlPoint1X;
50 var controlPoint1Y;
51 var controlPoint2X;
52 var controlPoint2Y;
53 var color;
54 if (window.devicePixelRatio)
55 resolution = window.devicePixelRatio;
56 else
57 resolution = 1.0;
58 resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Marks_infoWidth + canvas.height / kClipperz_PM_UI_Canvas_Marks_infoHeight);
59
60 context.save();
61 context.scale(canvas.width / kClipperz_PM_UI_Canvas_Marks_infoWidth, canvas.height / kClipperz_PM_UI_Canvas_Marks_infoHeight);
62 context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Marks_infoWidth, kClipperz_PM_UI_Canvas_Marks_infoHeight);
63
64 // Layer 1
65
66 alignStroke = 0.0;
67 context.beginPath();
68 pointX = 30.253;
69 pointY = 37.436;
70 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
71 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
72 context.moveTo(pointX, pointY);
73 pointX = 28.505;
74 pointY = 37.022;
75 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
76 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
77 context.lineTo(pointX, pointY);
78 pointX = 27.677;
79 pointY = 35.09;
80 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
81 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
82 controlPoint1X = 27.953;
83 controlPoint1Y = 36.792;
84 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
85 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
86 controlPoint2X = 27.677;
87 controlPoint2Y = 36.47;
88 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
89 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
90 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
91 pointX = 27.631;
92 pointY = 27.546;
93 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
94 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
95 controlPoint1X = 27.631;
96 controlPoint1Y = 32.974;
97 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
98 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
99 controlPoint2X = 27.631;
100 controlPoint2Y = 29.892;
101 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
102 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
103 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
104 pointX = 27.677;
105 pointY = 19.726;
106 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
107 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
108 controlPoint1X = 27.631;
109 controlPoint1Y = 24.97;
110 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
111 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
112 controlPoint2X = 27.677;
113 controlPoint2Y = 21.612;
114 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
115 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
116 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
117 pointX = 19.535;
118 pointY = 21.336;
119 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
120 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
121 controlPoint1X = 25.331;
122 controlPoint1Y = 20.692;
123 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
124 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
125 controlPoint2X = 20.593;
126 controlPoint2Y = 21.336;
127 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
128 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
129 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
130 pointX = 19.443;
131 pointY = 22.762;
132 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
133 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
134 controlPoint1X = 19.397;
135 controlPoint1Y = 21.52;
136 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
137 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
138 controlPoint2X = 19.305;
139 controlPoint2Y = 22.532;
140 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
141 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
142 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
143 pointX = 21.283;
144 pointY = 23.82;
145 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
146 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
147 controlPoint1X = 20.639;
148 controlPoint1Y = 23.222;
149 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
150 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
151 controlPoint2X = 20.961;
152 controlPoint2Y = 23.452;
153 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
154 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
155 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
156 pointX = 21.605;
157 pointY = 24.97;
158 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
159 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
160 controlPoint1X = 21.513;
161 controlPoint1Y = 24.05;
162 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
163 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
164 controlPoint2X = 21.605;
165 controlPoint2Y = 24.602;
166 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
167 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
168 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
169 pointX = 21.651;
170 pointY = 29.156;
171 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
172 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
173 controlPoint1X = 21.651;
174 controlPoint1Y = 25.752;
175 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
176 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
177 controlPoint2X = 21.651;
178 controlPoint2Y = 27.592;
179 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
180 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
181 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
182 pointX = 21.605;
183 pointY = 35.228;
184 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
185 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
186 controlPoint1X = 21.651;
187 controlPoint1Y = 31.364;
188 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
189 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
190 controlPoint2X = 21.651;
191 controlPoint2Y = 34.216;
192 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
193 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
194 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
195 pointX = 20.823;
196 pointY = 37.022;
197 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
198 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
199 controlPoint1X = 21.559;
200 controlPoint1Y = 36.332;
201 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
202 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
203 controlPoint2X = 21.467;
204 controlPoint2Y = 36.838;
205 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
206 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
207 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
208 pointX = 19.121;
209 pointY = 37.436;
210 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
211 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
212 controlPoint1X = 20.363;
213 controlPoint1Y = 37.206;
214 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
215 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
216 controlPoint2X = 19.857;
217 controlPoint2Y = 37.298;
218 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
219 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
220 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
221 pointX = 19.121;
222 pointY = 39.0;
223 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
224 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
225 controlPoint1X = 18.937;
226 controlPoint1Y = 37.62;
227 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
228 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
229 controlPoint2X = 18.983;
230 controlPoint2Y = 38.77;
231 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
232 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
233 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
234 pointX = 24.503;
235 pointY = 38.862;
236 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
237 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
238 controlPoint1X = 20.271;
239 controlPoint1Y = 39.0;
240 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
241 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
242 controlPoint2X = 21.927;
243 controlPoint2Y = 38.862;
244 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
245 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
246 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
247 pointX = 30.023;
248 pointY = 39.0;
249 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
250 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
251 controlPoint1X = 27.401;
252 controlPoint1Y = 38.862;
253 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
254 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
255 controlPoint2X = 29.149;
256 controlPoint2Y = 39.0;
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 = 30.253;
261 pointY = 37.436;
262 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
263 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
264 controlPoint1X = 30.299;
265 controlPoint1Y = 38.77;
266 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
267 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
268 controlPoint2X = 30.391;
269 controlPoint2Y = 37.62;
270 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
271 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
272 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
273 pointX = 30.253;
274 pointY = 37.436;
275 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
276 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
277 context.lineTo(pointX, pointY);
278 context.closePath();
279 pointX = 27.493;
280 pointY = 13.976;
281 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
282 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
283 context.moveTo(pointX, pointY);
284 pointX = 27.125;
285 pointY = 12.228;
286 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
287 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
288 controlPoint1X = 27.493;
289 controlPoint1Y = 13.608;
290 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
291 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
292 controlPoint2X = 27.401;
293 controlPoint2Y = 12.688;
294 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
295 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
296 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
297 pointX = 24.963;
298 pointY = 11.63;
299 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
300 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
301 controlPoint1X = 26.849;
302 controlPoint1Y = 11.998;
303 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
304 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
305 controlPoint2X = 26.113;
306 controlPoint2Y = 11.63;
307 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
308 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
309 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
310 pointX = 21.513;
311 pointY = 12.688;
312 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
313 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
314 controlPoint1X = 23.767;
315 controlPoint1Y = 11.63;
316 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
317 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
318 controlPoint2X = 22.203;
319 controlPoint2Y = 12.09;
320 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
321 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
322 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
323 pointX = 21.283;
324 pointY = 14.942;
325 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
326 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
327 controlPoint1X = 21.145;
328 controlPoint1Y = 13.148;
329 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
330 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
331 controlPoint2X = 21.145;
332 controlPoint2Y = 14.436;
333 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
334 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
335 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
336 pointX = 22.801;
337 pointY = 17.012;
338 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
339 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
340 controlPoint1X = 21.513;
341 controlPoint1Y = 15.908;
342 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
343 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
344 controlPoint2X = 21.973;
345 controlPoint2Y = 16.69;
346 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
347 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
348 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
349 pointX = 26.205;
350 pointY = 16.69;
351 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
352 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
353 controlPoint1X = 23.399;
354 controlPoint1Y = 17.288;
355 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
356 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
357 controlPoint2X = 25.791;
358 controlPoint2Y = 17.058;
359 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
360 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
361 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
362 pointX = 27.493;
363 pointY = 13.976;
364 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
365 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
366 controlPoint1X = 26.941;
367 controlPoint1Y = 16.046;
368 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
369 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
370 controlPoint2X = 27.493;
371 controlPoint2Y = 14.896;
372 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
373 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
374 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
375 pointX = 27.493;
376 pointY = 13.976;
377 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
378 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
379 context.lineTo(pointX, pointY);
380 context.closePath();
381 pointX = 30.851;
382 pointY = 38.862;
383 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
384 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
385 context.moveTo(pointX, pointY);
386 color = "#FFFFFF";
387 context.fillStyle = color;
388 context.fill();
389
390 context.restore();
391}
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/questionMark.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/questionMark.js
new file mode 100644
index 0000000..003c4c2
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/questionMark.js
@@ -0,0 +1,438 @@
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//
30 //questionMark.js
31 //?
32//
33 //Created by Giulio Cesare Solaroli on 3/7/10
34 //Copyright 2010 Clipperz
35 //This code was generated by Opacity. You may use or modify it in any way.
36//
37
38var kClipperz_PM_UI_Canvas_Marks_questionMarkWidth = 50.0;
39var kClipperz_PM_UI_Canvas_Marks_questionMarkHeight = 50.0;
40
41function Clipperz_PM_UI_Canvas_Marks_questionMark(canvas, aColor)
42{
43 var context = canvas.getContext("2d");
44 var alignStroke;
45 var resolution;
46 var path;
47 var pointX;
48 var pointY;
49 var controlPoint1X;
50 var controlPoint1Y;
51 var controlPoint2X;
52 var controlPoint2Y;
53 var color;
54 if (window.devicePixelRatio)
55 resolution = window.devicePixelRatio;
56 else
57 resolution = 1.0;
58 resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Marks_questionMarkWidth + canvas.height / kClipperz_PM_UI_Canvas_Marks_questionMarkHeight);
59
60 context.save();
61 context.scale(canvas.width / kClipperz_PM_UI_Canvas_Marks_questionMarkWidth, canvas.height / kClipperz_PM_UI_Canvas_Marks_questionMarkHeight);
62 context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Marks_questionMarkWidth, kClipperz_PM_UI_Canvas_Marks_questionMarkHeight);
63
64 // Layer 1
65
66 alignStroke = 0.0;
67 context.beginPath();
68 pointX = 24.118;
69 pointY = 24.464;
70 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
71 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
72 context.moveTo(pointX, pointY);
73 pointX = 24.854;
74 pointY = 23.406;
75 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
76 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
77 controlPoint1X = 24.118;
78 controlPoint1Y = 24.05;
79 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
80 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
81 controlPoint2X = 24.44;
82 controlPoint2Y = 23.636;
83 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
84 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
85 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
86 pointX = 29.454;
87 pointY = 20.6;
88 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
89 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
90 controlPoint1X = 26.418;
91 controlPoint1Y = 22.532;
92 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
93 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
94 controlPoint2X = 28.534;
95 controlPoint2Y = 21.566;
96 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
97 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
98 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
99 pointX = 30.282;
100 pointY = 17.794;
101 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
102 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
103 controlPoint1X = 29.868;
104 controlPoint1Y = 20.232;
105 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
106 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
107 controlPoint2X = 30.282;
108 controlPoint2Y = 19.082;
109 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
110 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
111 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
112 pointX = 27.2;
113 pointY = 12.688;
114 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
115 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
116 controlPoint1X = 30.282;
117 controlPoint1Y = 16.322;
118 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
119 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
120 controlPoint2X = 29.454;
121 controlPoint2Y = 14.344;
122 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
123 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
124 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
125 pointX = 21.312;
126 pointY = 10.664;
127 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
128 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
129 controlPoint1X = 25.636;
130 controlPoint1Y = 11.492;
131 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
132 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
133 controlPoint2X = 23.382;
134 controlPoint2Y = 10.664;
135 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
136 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
137 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
138 pointX = 19.886;
139 pointY = 11.124;
140 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
141 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
142 controlPoint1X = 20.898;
143 controlPoint1Y = 10.664;
144 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
145 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
146 controlPoint2X = 20.162;
147 controlPoint2Y = 10.894;
148 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
149 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
150 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
151 pointX = 18.0;
152 pointY = 14.666;
153 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
154 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
155 controlPoint1X = 19.104;
156 controlPoint1Y = 11.676;
157 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
158 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
159 controlPoint2X = 18.0;
160 controlPoint2Y = 14.068;
161 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
162 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
163 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
164 pointX = 18.598;
165 pointY = 15.586;
166 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
167 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
168 controlPoint1X = 18.0;
169 controlPoint1Y = 14.896;
170 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
171 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
172 controlPoint2X = 18.138;
173 controlPoint2Y = 15.494;
174 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
175 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
176 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
177 pointX = 19.794;
178 pointY = 15.908;
179 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
180 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
181 controlPoint1X = 19.012;
182 controlPoint1Y = 15.678;
183 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
184 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
185 controlPoint2X = 19.426;
186 controlPoint2Y = 15.77;
187 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
188 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
189 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
190 pointX = 25.36;
191 pointY = 20.002;
192 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
193 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
194 controlPoint1X = 22.508;
195 controlPoint1Y = 16.644;
196 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
197 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
198 controlPoint2X = 25.36;
199 controlPoint2Y = 17.886;
200 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
201 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
202 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
203 pointX = 24.21;
204 pointY = 21.704;
205 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
206 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
207 controlPoint1X = 25.36;
208 controlPoint1Y = 20.738;
209 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
210 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
211 controlPoint2X = 25.084;
212 controlPoint2Y = 21.198;
213 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
214 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
215 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
216 pointX = 19.058;
217 pointY = 24.326;
218 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
219 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
220 controlPoint1X = 23.106;
221 controlPoint1Y = 22.348;
222 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
223 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
224 controlPoint2X = 19.886;
225 controlPoint2Y = 23.774;
226 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
227 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
228 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
229 pointX = 18.506;
230 pointY = 25.936;
231 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
232 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
233 controlPoint1X = 18.736;
234 controlPoint1Y = 24.556;
235 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
236 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
237 controlPoint2X = 18.506;
238 controlPoint2Y = 25.338;
239 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
240 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
241 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
242 pointX = 20.898;
243 pointY = 29.064;
244 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
245 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
246 controlPoint1X = 18.506;
247 controlPoint1Y = 26.948;
248 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
249 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
250 controlPoint2X = 19.334;
251 controlPoint2Y = 28.42;
252 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
253 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
254 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
255 pointX = 22.048;
256 pointY = 29.156;
257 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
258 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
259 controlPoint1X = 21.22;
260 controlPoint1Y = 29.156;
261 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
262 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
263 controlPoint2X = 21.726;
264 controlPoint2Y = 29.202;
265 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
266 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
267 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
268 pointX = 25.268;
269 pointY = 27.592;
270 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
271 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
272 controlPoint1X = 22.508;
273 controlPoint1Y = 29.064;
274 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
275 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
276 controlPoint2X = 24.9;
277 controlPoint2Y = 27.96;
278 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
279 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
280 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
281 pointX = 25.406;
282 pointY = 26.856;
283 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
284 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
285 controlPoint1X = 25.406;
286 controlPoint1Y = 27.454;
287 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
288 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
289 controlPoint2X = 25.544;
290 controlPoint2Y = 26.994;
291 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
292 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
293 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
294 pointX = 24.118;
295 pointY = 24.464;
296 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
297 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
298 controlPoint1X = 24.578;
299 controlPoint1Y = 25.936;
300 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
301 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
302 controlPoint2X = 24.118;
303 controlPoint2Y = 24.786;
304 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
305 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
306 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
307 pointX = 24.118;
308 pointY = 24.464;
309 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
310 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
311 context.lineTo(pointX, pointY);
312 context.closePath();
313 pointX = 23.06;
314 pointY = 31.962;
315 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
316 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
317 context.moveTo(pointX, pointY);
318 pointX = 20.53;
319 pointY = 32.928;
320 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
321 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
322 controlPoint1X = 22.186;
323 controlPoint1Y = 31.962;
324 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
325 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
326 controlPoint2X = 21.22;
327 controlPoint2Y = 32.33;
328 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
329 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
330 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
331 pointX = 19.426;
332 pointY = 35.458;
333 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
334 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
335 controlPoint1X = 19.794;
336 controlPoint1Y = 33.618;
337 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
338 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
339 controlPoint2X = 19.426;
340 controlPoint2Y = 34.538;
341 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
342 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
343 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
344 pointX = 20.392;
345 pointY = 38.08;
346 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
347 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
348 controlPoint1X = 19.426;
349 controlPoint1Y = 36.47;
350 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
351 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
352 controlPoint2X = 19.702;
353 controlPoint2Y = 37.344;
354 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
355 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
356 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
357 pointX = 22.738;
358 pointY = 39.0;
359 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
360 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
361 controlPoint1X = 21.128;
362 controlPoint1Y = 38.77;
363 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
364 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
365 controlPoint2X = 22.048;
366 controlPoint2Y = 39.0;
367 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
368 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
369 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
370 pointX = 25.544;
371 pointY = 38.034;
372 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
373 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
374 controlPoint1X = 23.796;
375 controlPoint1Y = 39.0;
376 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
377 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
378 controlPoint2X = 24.854;
379 controlPoint2Y = 38.724;
380 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
381 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
382 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
383 pointX = 26.556;
384 pointY = 35.55;
385 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
386 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
387 controlPoint1X = 26.188;
388 controlPoint1Y = 37.344;
389 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
390 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
391 controlPoint2X = 26.556;
392 controlPoint2Y = 36.194;
393 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
394 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
395 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
396 pointX = 25.452;
397 pointY = 32.744;
398 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
399 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
400 controlPoint1X = 26.556;
401 controlPoint1Y = 34.676;
402 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
403 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
404 controlPoint2X = 26.326;
405 controlPoint2Y = 33.618;
406 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
407 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
408 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
409 pointX = 23.06;
410 pointY = 31.962;
411 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
412 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
413 controlPoint1X = 24.854;
414 controlPoint1Y = 32.284;
415 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
416 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
417 controlPoint2X = 23.934;
418 controlPoint2Y = 31.962;
419 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
420 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
421 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
422 pointX = 23.06;
423 pointY = 31.962;
424 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
425 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
426 context.lineTo(pointX, pointY);
427 context.closePath();
428 pointX = 32.214;
429 pointY = 38.402;
430 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
431 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
432 context.moveTo(pointX, pointY);
433 color = "#FFFFFF";
434 context.fillStyle = color;
435 context.fill();
436
437 context.restore();
438}
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/RegisterButton/normal.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/RegisterButton/normal.js
new file mode 100644
index 0000000..288e0be
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/RegisterButton/normal.js
@@ -0,0 +1,403 @@
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//
30 //normal.js
31 //normal
32//
33 //Created by Giulio Cesare Solaroli on 3/24/10
34 //Copyright 2010 Clipperz
35 //This code was generated by Opacity. You may use or modify it in any way.
36//
37
38var kClipperz_PM_UI_Canvas_RegisterButton_normalWidth = 282.0;
39var kClipperz_PM_UI_Canvas_RegisterButton_normalHeight = 93.0;
40
41function Clipperz_PM_UI_Canvas_RegisterButton_normal(canvas, aBackgroundColor, aDarkBackgroundColor, aLightColor, aDarkColor, aStarColor)
42{
43 var context = canvas.getContext("2d");
44 var alignStroke;
45 var resolution;
46 var path;
47 var pointX;
48 var pointY;
49 var controlPoint1X;
50 var controlPoint1Y;
51 var controlPoint2X;
52 var controlPoint2Y;
53 var gradient;
54 var color;
55 if (window.devicePixelRatio)
56 resolution = window.devicePixelRatio;
57 else
58 resolution = 1.0;
59 resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_RegisterButton_normalWidth + canvas.height / kClipperz_PM_UI_Canvas_RegisterButton_normalHeight);
60
61 context.save();
62 context.scale(canvas.width / kClipperz_PM_UI_Canvas_RegisterButton_normalWidth, canvas.height / kClipperz_PM_UI_Canvas_RegisterButton_normalHeight);
63 context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_RegisterButton_normalWidth, kClipperz_PM_UI_Canvas_RegisterButton_normalHeight);
64
65 // background
66
67 alignStroke = 0.0;
68 context.beginPath();
69 pointX = 241.0;
70 pointY = 80.0;
71 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
72 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
73 context.moveTo(pointX, pointY);
74 pointX = 274.0;
75 pointY = 47.0;
76 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
77 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
78 controlPoint1X = 259.103;
79 controlPoint1Y = 80.0;
80 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
81 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
82 controlPoint2X = 274.0;
83 controlPoint2Y = 65.103;
84 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
85 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
86 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
87 pointX = 274.0;
88 pointY = 45.0;
89 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
90 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
91 context.lineTo(pointX, pointY);
92 pointX = 241.0;
93 pointY = 12.0;
94 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
95 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
96 controlPoint1X = 274.0;
97 controlPoint1Y = 26.897;
98 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
99 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
100 controlPoint2X = 259.103;
101 controlPoint2Y = 12.0;
102 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
103 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
104 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
105 pointX = 60.0;
106 pointY = 12.0;
107 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
108 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
109 context.lineTo(pointX, pointY);
110 pointX = 27.0;
111 pointY = 45.0;
112 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
113 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
114 controlPoint1X = 41.897;
115 controlPoint1Y = 12.0;
116 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
117 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
118 controlPoint2X = 27.0;
119 controlPoint2Y = 26.897;
120 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
121 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
122 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
123 pointX = 27.0;
124 pointY = 47.0;
125 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
126 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
127 context.lineTo(pointX, pointY);
128 pointX = 60.0;
129 pointY = 80.0;
130 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
131 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
132 controlPoint1X = 27.0;
133 controlPoint1Y = 65.103;
134 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
135 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
136 controlPoint2X = 41.897;
137 controlPoint2Y = 80.0;
138 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
139 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
140 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
141 pointX = 241.0;
142 pointY = 80.0;
143 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
144 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
145 context.lineTo(pointX, pointY);
146 context.closePath();
147 gradient = context.createLinearGradient(150.5, 12.0, 150.5, 80.0);
148 gradient.addColorStop(0.0, aBackgroundColor);
149 gradient.addColorStop(1.0, aDarkBackgroundColor);
150 context.fillStyle = gradient;
151 context.fill();
152
153 // round
154
155 alignStroke = 0.0;
156 context.beginPath();
157 pointX = 44.103;
158 pointY = 4.014;
159 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
160 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
161 context.moveTo(pointX, pointY);
162 pointX = 65.629;
163 pointY = 10.515;
164 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
165 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
166 controlPoint1X = 51.706;
167 controlPoint1Y = 4.217;
168 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
169 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
170 controlPoint2X = 59.185;
171 controlPoint2Y = 6.475;
172 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
173 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
174 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
175 pointX = 78.65;
176 pointY = 70.918;
177 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
178 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
179 context.lineTo(pointX, pointY);
180 pointX = 43.0;
181 pointY = 90.0;
182 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
183 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
184 controlPoint1X = 70.676;
185 controlPoint1Y = 82.788;
186 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
187 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
188 controlPoint2X = 57.23;
189 controlPoint2Y = 89.817;
190 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
191 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
192 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
193 pointX = 0.056;
194 pointY = 44.801;
195 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
196 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
197 controlPoint1X = 18.834;
198 controlPoint1Y = 90.07;
199 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
200 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
201 controlPoint2X = -1.18;
202 controlPoint2Y = 68.879;
203 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
204 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
205 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
206 pointX = 44.103;
207 pointY = 4.014;
208 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
209 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
210 controlPoint1X = 1.242;
211 controlPoint1Y = 21.708;
212 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
213 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
214 controlPoint2X = 21.202;
215 controlPoint2Y = 3.72;
216 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
217 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
218 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
219 pointX = 44.103;
220 pointY = 4.014;
221 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
222 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
223 context.lineTo(pointX, pointY);
224 context.closePath();
225 gradient = context.createLinearGradient(39.326, 90, 39.326, 4.011);
226 gradient.addColorStop(0.0, aDarkColor);
227 gradient.addColorStop(1.0, aLightColor);
228 context.fillStyle = gradient;
229 context.fill();
230
231 // *
232
233 alignStroke = 0.0;
234 context.beginPath();
235 pointX = 23.983;
236 pointY = 35.944;
237 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
238 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
239 context.moveTo(pointX, pointY);
240 pointX = 37.25;
241 pointY = 40.261;
242 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
243 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
244 context.lineTo(pointX, pointY);
245 pointX = 37.25;
246 pointY = 24.963;
247 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
248 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
249 context.lineTo(pointX, pointY);
250 pointX = 48.231;
251 pointY = 24.963;
252 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
253 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
254 context.lineTo(pointX, pointY);
255 pointX = 48.231;
256 pointY = 40.261;
257 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
258 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
259 context.lineTo(pointX, pointY);
260 pointX = 61.498;
261 pointY = 35.944;
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 = 64.481;
266 pointY = 45.402;
267 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
268 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
269 context.lineTo(pointX, pointY);
270 pointX = 50.961;
271 pointY = 49.592;
272 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
273 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
274 context.lineTo(pointX, pointY);
275 pointX = 59.784;
276 pointY = 62.224;
277 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
278 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
279 context.lineTo(pointX, pointY);
280 pointX = 51.659;
281 pointY = 68.0;
282 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
283 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
284 context.lineTo(pointX, pointY);
285 pointX = 42.836;
286 pointY = 56.066;
287 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
288 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
289 context.lineTo(pointX, pointY);
290 pointX = 33.759;
291 pointY = 68.0;
292 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
293 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
294 context.lineTo(pointX, pointY);
295 pointX = 25.634;
296 pointY = 62.224;
297 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
298 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
299 context.lineTo(pointX, pointY);
300 pointX = 34.521;
301 pointY = 49.592;
302 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
303 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
304 context.lineTo(pointX, pointY);
305 pointX = 21.0;
306 pointY = 45.402;
307 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
308 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
309 context.lineTo(pointX, pointY);
310 pointX = 23.983;
311 pointY = 35.944;
312 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
313 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
314 context.lineTo(pointX, pointY);
315 context.closePath();
316 pointX = 68.607;
317 pointY = 119.099;
318 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
319 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
320 context.moveTo(pointX, pointY);
321 context.fillStyle = aStarColor;
322 context.fill();
323
324 alignStroke = 0.0;
325 context.beginPath();
326 pointX = 212.0;
327 pointY = 125.0;
328 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
329 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
330 context.moveTo(pointX, pointY);
331 pointX = 213.0;
332 pointY = 125.0;
333 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
334 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
335 context.lineTo(pointX, pointY);
336 pointX = 212.5;
337 pointY = 124.0;
338 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
339 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
340 context.lineTo(pointX, pointY);
341 pointX = 212.0;
342 pointY = 125.0;
343 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
344 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
345 context.lineTo(pointX, pointY);
346 context.closePath();
347 gradient = context.createLinearGradient(212.5, 125.0, 212.5, 124.0);
348 color = "#FFFFFF";
349 gradient.addColorStop(0.0, color);
350 color = "#A9A9A9";
351 gradient.addColorStop(1.0, color);
352 context.fillStyle = gradient;
353 context.fill();
354
355 // flip
356
357 // Setup for Shadow Effect
358 color = "rgba(0.0%, 0.0%, 0.0%, 0.5)";
359 context.save();
360 context.shadowColor = color;
361 context.shadowBlur = 0.0;
362 context.shadowOffsetX = 2.0 * Math.cos(8.377) * resolution;
363 context.shadowOffsetY = 2.0 * Math.sin(8.377) * resolution;
364
365 // round
366
367 alignStroke = 0.0;
368 context.beginPath();
369 pointX = 78.506;
370 pointY = 70.251;
371 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
372 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
373 context.moveTo(pointX, pointY);
374 pointX = 66.155;
375 pointY = 12.954;
376 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
377 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
378 controlPoint1X = 59.899;
379 controlPoint1Y = 57.427;
380 controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution;
381 controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution;
382 controlPoint2X = 54.678;
383 controlPoint2Y = 32.277;
384 controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution;
385 controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution;
386 context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY);
387 pointX = 78.506;
388 pointY = 70.251;
389 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
390 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
391 context.lineTo(pointX, pointY);
392 context.closePath();
393 gradient = context.createLinearGradient(69.301, 70.251, 69.301, 12.954);
394 gradient.addColorStop(0.0, aDarkColor);
395 gradient.addColorStop(1.0, aLightColor);
396 context.fillStyle = gradient;
397 context.fill();
398
399 // Shadow Effect
400 context.restore();
401
402 context.restore();
403}
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Star/normal.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Star/normal.js
new file mode 100644
index 0000000..e70e3b5
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Star/normal.js
@@ -0,0 +1,153 @@
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//
30 //normal.js
31 //normal
32//
33 //Created by Giulio Cesare Solaroli on 3/15/10
34 //Copyright 2010 Clipperz
35 //This code was generated by Opacity. You may use or modify it in any way.
36//
37
38var kClipperz_PM_UI_Canvas_Star_normalWidth = 46.0;
39var kClipperz_PM_UI_Canvas_Star_normalHeight = 46.0;
40
41function Clipperz_PM_UI_Canvas_Star_normal(canvas, aColor)
42{
43 var context = canvas.getContext("2d");
44 var alignStroke;
45 var resolution;
46 var path;
47 var pointX;
48 var pointY;
49 if (window.devicePixelRatio)
50 resolution = window.devicePixelRatio;
51 else
52 resolution = 1.0;
53 resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Star_normalWidth + canvas.height / kClipperz_PM_UI_Canvas_Star_normalHeight);
54
55 context.save();
56 context.scale(canvas.width / kClipperz_PM_UI_Canvas_Star_normalWidth, canvas.height / kClipperz_PM_UI_Canvas_Star_normalHeight);
57 context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Star_normalWidth, kClipperz_PM_UI_Canvas_Star_normalHeight);
58
59 // *
60
61 alignStroke = 0.0;
62 context.beginPath();
63 pointX = 8.613;
64 pointY = 15.583;
65 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
66 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
67 context.moveTo(pointX, pointY);
68 pointX = 18.563;
69 pointY = 18.821;
70 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
71 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
72 context.lineTo(pointX, pointY);
73 pointX = 18.563;
74 pointY = 7.347;
75 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
76 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
77 context.lineTo(pointX, pointY);
78 pointX = 26.799;
79 pointY = 7.347;
80 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
81 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
82 context.lineTo(pointX, pointY);
83 pointX = 26.799;
84 pointY = 18.821;
85 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
86 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
87 context.lineTo(pointX, pointY);
88 pointX = 36.749;
89 pointY = 15.583;
90 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
91 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
92 context.lineTo(pointX, pointY);
93 pointX = 38.986;
94 pointY = 22.677;
95 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
96 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
97 context.lineTo(pointX, pointY);
98 pointX = 28.846;
99 pointY = 25.819;
100 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
101 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
102 context.lineTo(pointX, pointY);
103 pointX = 35.463;
104 pointY = 35.293;
105 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
106 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
107 context.lineTo(pointX, pointY);
108 pointX = 29.369;
109 pointY = 39.625;
110 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
111 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
112 context.lineTo(pointX, pointY);
113 pointX = 22.752;
114 pointY = 30.675;
115 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
116 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
117 context.lineTo(pointX, pointY);
118 pointX = 15.944;
119 pointY = 39.625;
120 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
121 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
122 context.lineTo(pointX, pointY);
123 pointX = 9.85;
124 pointY = 35.293;
125 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
126 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
127 context.lineTo(pointX, pointY);
128 pointX = 16.515;
129 pointY = 25.819;
130 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
131 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
132 context.lineTo(pointX, pointY);
133 pointX = 6.375;
134 pointY = 22.677;
135 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
136 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
137 context.lineTo(pointX, pointY);
138 pointX = 8.613;
139 pointY = 15.583;
140 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
141 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
142 context.lineTo(pointX, pointY);
143 context.closePath();
144 pointX = 42.081;
145 pointY = 77.949;
146 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
147 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
148 context.moveTo(pointX, pointY);
149 context.fillStyle = aColor;
150 context.fill();
151
152 context.restore();
153}
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/close.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/close.js
new file mode 100644
index 0000000..216fd24
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/close.js
@@ -0,0 +1,156 @@
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//
30 //close.js
31 //close
32//
33 //Created by Giulio Cesare Solaroli on 3/14/10
34 //Copyright 2010 Clipperz
35 //This code was generated by Opacity. You may use or modify it in any way.
36//
37
38var kClipperz_PM_UI_Canvas_Tips_closeWidth = 310.0;
39var kClipperz_PM_UI_Canvas_Tips_closeHeight = 6.0;
40
41function Clipperz_PM_UI_Canvas_Tips_close(canvas, aColor, aBackgroundColor)
42{
43 var context = canvas.getContext("2d");
44 var alignStroke;
45 var resolution;
46 var path;
47 var pointX;
48 var pointY;
49 if (window.devicePixelRatio)
50 resolution = window.devicePixelRatio;
51 else
52 resolution = 1.0;
53 resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Tips_closeWidth + canvas.height / kClipperz_PM_UI_Canvas_Tips_closeHeight);
54
55 context.save();
56 context.scale(canvas.width / kClipperz_PM_UI_Canvas_Tips_closeWidth, canvas.height / kClipperz_PM_UI_Canvas_Tips_closeHeight);
57 context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Tips_closeWidth, kClipperz_PM_UI_Canvas_Tips_closeHeight);
58
59 // background
60
61 alignStroke = 0.0;
62 context.beginPath();
63 pointX = 310.0;
64 pointY = 6.0;
65 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
66 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
67 context.moveTo(pointX, pointY);
68 pointX = 310.0;
69 pointY = 0.0;
70 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
71 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
72 context.lineTo(pointX, pointY);
73 pointX = 0.0;
74 pointY = 0.0;
75 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
76 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
77 context.lineTo(pointX, pointY);
78 pointX = 0.0;
79 pointY = 6.0;
80 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
81 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
82 context.lineTo(pointX, pointY);
83 pointX = 310.0;
84 pointY = 6.0;
85 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
86 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
87 context.lineTo(pointX, pointY);
88 context.closePath();
89 context.fillStyle = aBackgroundColor;
90 context.fill();
91
92 // grid
93
94 // background
95
96 alignStroke = 0.0;
97 context.beginPath();
98 pointX = 310.0;
99 pointY = 6.0;
100 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
101 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
102 context.moveTo(pointX, pointY);
103 pointX = 310.0;
104 pointY = 0.0;
105 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
106 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
107 context.lineTo(pointX, pointY);
108 pointX = 0.0;
109 pointY = 0.0;
110 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
111 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
112 context.lineTo(pointX, pointY);
113 pointX = 0.0;
114 pointY = 6.0;
115 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
116 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
117 context.lineTo(pointX, pointY);
118 pointX = 310.0;
119 pointY = 6.0;
120 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
121 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
122 context.lineTo(pointX, pointY);
123 context.closePath();
124 context.fillStyle = aBackgroundColor;
125 context.fill();
126
127 // toggle
128
129 alignStroke = 0.0;
130 context.beginPath();
131 pointX = 149.0;
132 pointY = 6.0;
133 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
134 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
135 context.moveTo(pointX, pointY);
136 pointX = 161.0;
137 pointY = 6.0;
138 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
139 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
140 context.lineTo(pointX, pointY);
141 pointX = 155.0;
142 pointY = 0.0;
143 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
144 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
145 context.lineTo(pointX, pointY);
146 pointX = 149.0;
147 pointY = 6.0;
148 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
149 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
150 context.lineTo(pointX, pointY);
151 context.closePath();
152 context.fillStyle = aColor;
153 context.fill();
154
155 context.restore();
156}
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/open.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/open.js
new file mode 100644
index 0000000..f1bdaa9
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/open.js
@@ -0,0 +1,163 @@
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//
30 //open.js
31 //open
32//
33 //Created by Giulio Cesare Solaroli on 3/14/10
34 //Copyright 2010 Clipperz
35 //This code was generated by Opacity. You may use or modify it in any way.
36//
37
38var kClipperz_PM_UI_Canvas_Tips_openWidth = 310.0;
39var kClipperz_PM_UI_Canvas_Tips_openHeight = 6.0;
40
41function Clipperz_PM_UI_Canvas_Tips_open(canvas, aColor, aBackgroundColor)
42{
43 var context = canvas.getContext("2d");
44 var alignStroke;
45 var resolution;
46 var path;
47 var pointX;
48 var pointY;
49 var color;
50 if (window.devicePixelRatio)
51 resolution = window.devicePixelRatio;
52 else
53 resolution = 1.0;
54 resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Tips_openWidth + canvas.height / kClipperz_PM_UI_Canvas_Tips_openHeight);
55
56 context.save();
57 context.scale(canvas.width / kClipperz_PM_UI_Canvas_Tips_openWidth, canvas.height / kClipperz_PM_UI_Canvas_Tips_openHeight);
58 context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Tips_openWidth, kClipperz_PM_UI_Canvas_Tips_openHeight);
59
60 // background
61
62 alignStroke = 0.0;
63 context.beginPath();
64 pointX = 310.0;
65 pointY = 6.0;
66 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
67 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
68 context.moveTo(pointX, pointY);
69 pointX = 310.0;
70 pointY = 0.0;
71 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
72 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
73 context.lineTo(pointX, pointY);
74 pointX = 0.0;
75 pointY = 0.0;
76 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
77 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
78 context.lineTo(pointX, pointY);
79 pointX = 0.0;
80 pointY = 6.0;
81 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
82 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
83 context.lineTo(pointX, pointY);
84 pointX = 310.0;
85 pointY = 6.0;
86 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
87 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
88 context.lineTo(pointX, pointY);
89 context.closePath();
90 context.fillStyle = aBackgroundColor;
91 context.fill();
92
93 // grid
94
95 // background
96
97 alignStroke = 0.0;
98 context.beginPath();
99 pointX = 310.0;
100 pointY = 6.0;
101 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
102 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
103 context.moveTo(pointX, pointY);
104 pointX = 310.0;
105 pointY = 0.0;
106 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
107 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
108 context.lineTo(pointX, pointY);
109 pointX = 0.0;
110 pointY = 0.0;
111 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
112 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
113 context.lineTo(pointX, pointY);
114 pointX = 0.0;
115 pointY = 6.0;
116 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
117 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
118 context.lineTo(pointX, pointY);
119 pointX = 310.0;
120 pointY = 6.0;
121 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
122 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
123 context.lineTo(pointX, pointY);
124 context.closePath();
125 context.fillStyle = aBackgroundColor;
126 context.fill();
127
128 // Layer 1
129
130 alignStroke = 0.0;
131 context.save();
132 context.translate(155.0, 3.0);
133 context.rotate(-3.142);
134 context.translate(-155.0, -3.0);
135 context.beginPath();
136 pointX = 149.0;
137 pointY = 6.0;
138 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
139 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
140 context.moveTo(pointX, pointY);
141 pointX = 161.0;
142 pointY = 6.0;
143 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
144 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
145 context.lineTo(pointX, pointY);
146 pointX = 155.0;
147 pointY = 0.0;
148 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
149 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
150 context.lineTo(pointX, pointY);
151 pointX = 149.0;
152 pointY = 6.0;
153 pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution;
154 pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution;
155 context.lineTo(pointX, pointY);
156 context.closePath();
157 color = "#FFFFFF";
158 context.fillStyle = color;
159 context.fill();
160 context.restore();
161
162 context.restore();
163}
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js
new file mode 100644
index 0000000..26f2fc4
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.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.Common.Components');
30
31//#############################################################################
32
33var _Clipperz_PM_Components_base_id_ = 0;
34
35//#############################################################################
36
37Clipperz.PM.UI.Common.Components.BaseComponent = function(args) {
38 args = args || {};
39 Clipperz.PM.UI.Common.Components.BaseComponent.superclass.constructor.call(this, args);
40
41 this._element = args.element || null;
42 this._ids = {};
43
44 this._slots = {};
45 this._slotComponents = {};
46
47 this._components = {};
48
49 this._cachedSlots = {};
50
51 this._isModal = false;
52
53 this._isActive = false;
54 this._elementUsedToEnterModalState;
55
56 this._isFullyRendered = false;
57 this._renderingWaitingQueue = [];
58
59 //this._slots = {
60 // 'header':'header',
61 // 'body': 'body',
62 // 'footer':'footer'
63 //};
64
65 return this;
66}
67
68//=============================================================================
69
70//TODO get back to MochiKit.Base.update as we are not extending anything
71//MochiKit.Base.update(Clipperz.PM.UI.Common.Components.BaseComponent.prototype, {
72Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.BaseComponent, /*Ext.Component*/ Object, {
73
74 'isClipperzPMComponent': true,
75
76 //-------------------------------------------------------------------------
77
78 'toString': function () {
79 return "Clipperz.PM.UI.Common.Components.BaseComponent component";
80 },
81
82 'componentId': function () {
83 return this.getId('_id_');
84 },
85
86 //-------------------------------------------------------------------------
87/*
88 'slots': function() {
89 return this._slots;
90 },
91*/
92 'slotComponents': function() {
93 return this._slotComponents;
94 },
95
96 //-------------------------------------------------------------------------
97
98 'components': function () {
99 return this._components;
100 },
101
102 'addComponent': function (aComponent) {
103 this.components()[aComponent.componentId()] = aComponent;
104 },
105
106 'removeComponent': function (aComponent) {
107 var componentId;
108
109 componentId = aComponent.componentId();
110 this.components()[componentId].remove();
111 delete this.components()[componentId];
112 },
113
114 //-------------------------------------------------------------------------
115/*
116 'domHelper': function() {
117 return Clipperz.YUI.DomHelper;
118 },
119 */
120 //-------------------------------------------------------------------------
121/*
122 'domHelperAppend': function(aValue) {
123 Clipperz.YUI.DomHelper.append(this.element().dom, aValue);
124 },
125 */
126 //-------------------------------------------------------------------------
127
128 'element': function() {
129//MochiKit.Logging.logDebug(">>> BaseComponent.element");
130 return MochiKit.DOM.getElement(this._element);
131 },
132
133 'setElement': function(aNode) {
134 this._element = aNode;
135 },
136
137 //-----------------------------------------------------
138
139 'displayElement': function() {
140 return this.element();
141 },
142
143 //-------------------------------------------------------------------------
144
145 'renderInNode': function(aDomNode) {
146 this.setElement(aDomNode);
147 this.render();
148 },
149
150 'render': function() {
151 this.clear();
152 this.renderSelf();
153 this.renderComponents();
154 if (this.shouldShowTranslationHints()) {
155 this.renderTranslationHints();
156 }
157 if (this.shouldShowElementWhileRendering()) {
158 MochiKit.Style.showElement(this.displayElement());
159 };
160
161 this._isFullyRendered = true;
162
163 MochiKit.Iter.forEach(this.renderingWaitingQueue(), MochiKit.Base.methodcaller('callback'));
164 this.resetRenderingWaitingQueue();
165 },
166
167 'renderSelf': function() {
168 throw Clipperz.Base.exception.AbstractMethod;
169 },
170
171 'renderComponents': function() {
172 varslotName;
173
174 for (slotName in this.slotComponents()) {
175 this.slotComponents()[slotName].renderInNode(this.elementForSlotNamed(slotName));
176 }
177 },
178
179 //.........................................................................
180
181 'isFullyRendered': function () {
182 return this._isFullyRendered;
183 },
184
185 //.........................................................................
186
187 'renderingWaitingQueue': function () {
188 return this._renderingWaitingQueue;
189 },
190
191 'resetRenderingWaitingQueue': function () {
192 this._renderingWaitingQueue = [];
193 },
194
195 //.........................................................................
196
197 'waitUntilFullyRendered': function () {
198 var deferredResult;
199
200 if (this.isFullyRendered() == true) {
201 deferredResult = MochiKit.Async.succeed
202 } else {
203 deferredResult = new Clipperz.Async.Deferred("BaseComponent.waitUntilFullyRendered", {trace:false});
204 this.renderingWaitingQueue().push(deferredResult);
205 }
206
207 return deferredResult;
208 },
209
210 //-----------------------------------------------------
211
212 'renderTranslationHints': function () {
213 vartranslatableItems;
214
215 translatableItems = MochiKit.Selector.findChildElements(this.displayElement(), ['[stringID]']);
216 MochiKit.Iter.forEach(translatableItems, MochiKit.Base.method(this, 'enhanceTranslatableElement'))
217 },
218
219 'enhanceTranslatableElement': function (anElement) {
220//Clipperz.log(">>> enhanceTranslatableElement", anElement);
221 // new Clipperz.PM.UI.Common.Components.TranslatorWidget({
222 // 'element':anElement
223 // });
224
225 MochiKit.Signal.connect(anElement, 'onmouseenter', MochiKit.Base.partial(Clipperz.PM.UI.Common.Components.TranslatorWidget.show, anElement, MochiKit.DOM.getNodeAttribute(anElement, 'stringID')));
226 MochiKit.Signal.connect(anElement, 'onmouseleave', Clipperz.PM.UI.Common.Components.TranslatorWidget.hide);
227//Clipperz.log("<<< enhanceTranslatableElement");
228 },
229
230 //-----------------------------------------------------
231
232 'update': function(args) {
233 throw Clipperz.Base.exception.AbstractMethod;
234 },
235
236 'updateSelf': function(args) {
237 throw Clipperz.Base.exception.AbstractMethod;
238 },
239
240 'updateComponents': function(args) {
241 throw Clipperz.Base.exception.AbstractMethod;
242 },
243
244 //-----------------------------------------------------
245
246 'refresh': function() {
247 throw Clipperz.Base.exception.AbstractMethod;
248 },
249
250 'refreshSelf': function() {
251 throw Clipperz.Base.exception.AbstractMethod;
252 },
253
254 'refreshComponents': function(args) {
255 throw Clipperz.Base.exception.AbstractMethod;
256 },
257
258 //-----------------------------------------------------
259
260 'checkSlotNamed': function(aSlotName) {
261 if (typeof(this._slots[aSlotName]) == 'undefined') {
262 throw new Error("undefined slot");
263 };
264 },
265
266 //-----------------------------------------------------
267
268 'cachedSlots': function() {
269 return this._cachedSlots;
270 },
271
272 'slotNamed': function(aSlotName) {
273 var result;
274
275 this.checkSlotNamed(aSlotName);
276 if (typeof(this.cachedSlots()[aSlotName]) == 'undefined') {
277 this.cachedSlots()[aSlotName] = new Clipperz.PM.UI.Common.Components.ComponentSlot(this,aSlotName);
278 }
279
280 result = this.cachedSlots()[aSlotName];
281
282 return result;
283 },
284
285 //-----------------------------------------------------
286
287 'elementForSlotNamed': function(aSlotName) {
288 return MochiKit.DOM.getElement(this._slots[aSlotName]);
289 },
290
291 //-----------------------------------------------------
292
293 'componentForSlotNamed': function(aSlotName) {
294 return this.slotComponents()[aSlotName];
295 },
296
297 'setComponentForSlotNamed': function(aComponent, aSlotName) {
298 var domNode;
299
300 this.checkSlotNamed(aSlotName);
301
302 if (this.slotComponents()[aSlotName] != null) {
303 this.slotComponents()[aSlotName].remove();
304 }
305
306 this.slotComponents()[aSlotName] = aComponent;
307
308 // domNode = MochiKit.DOM.getElement(this.slotNamed(aSlotName));
309 domNode = this.elementForSlotNamed(aSlotName);
310
311 if (domNode != null) {
312 aComponent.renderInNode(domNode);
313 }
314 },
315
316 //-----------------------------------------------------
317/*
318 'purgeListeners': function() {
319//MochiKit.Logging.logDebug(">>> Clipperz.PM.UI.Common.Components.BaseComponent.purgeListeners [" + this + "]");
320//MochiKit.Logging.logDebug("--- " + this + ".purgeListeners");
321 Clipperz.NotificationCenter.unregister(this);
322 MochiKit.Signal.disconnectAllTo(this);
323//MochiKit.Logging.logDebug("<<< Clipperz.PM.UI.Common.Components.BaseComponent.purgeListeners");
324 },
325 */
326 //-----------------------------------------------------
327
328 'clear': function() {
329 varslotName;
330 var componentId;
331
332 MochiKit.Signal.disconnectAllTo(this);
333
334 for (slotName in this.slotComponents()) {
335 this.slotComponents()[slotName].clear();
336 }
337
338 for (componentId in this.components()) {
339 this.components()[componentId].clear();
340 }
341
342 // if (this.element() != null) {
343 // this.element().innerHTML = "";
344 // }
345
346 if (this.displayElement() != null) {
347 if (this.element() != this.displayElement()) {
348 MochiKit.DOM.removeElement(this.displayElement());
349 } else {
350 this.displayElement().innerHTML = "";
351 }
352 }
353
354 if (this.isModal()) {
355 //TODO: cleanup when the closed element was shown modally.
356 }
357 },
358
359
360 'remove': function() {
361 varslotName;
362 var componentId;
363
364 for (slotName in this.slotComponents()) {
365 this.slotComponents()[slotName].remove();
366 delete this.slotComponents()[slotName];
367 }
368
369 for (componentId in this.components()) {
370 this.components()[componentId].remove();
371 delete this.components()[componentId];
372 }
373
374 this.clear();
375 MochiKit.Signal.disconnectAll(this);
376 },
377
378 'append': function(aNode, aValue) {
379 return Clipperz.DOM.Helper.append(aNode, aValue);
380 },
381
382 'insertBefore': function (aNode, aValue) {
383 return Clipperz.DOM.Helper.insertBefore(aNode, aValue);
384 },
385
386 'insertAfter': function (aNode, aValue) {
387 return Clipperz.DOM.Helper.insertAfter(aNode, aValue);
388 },
389
390 //-------------------------------------------------------------------------
391
392 'getId': function(aValue) {
393 varresult;
394
395 if (typeof(aValue) != 'undefined') {
396 result = this._ids[aValue];
397
398 if (typeof(result) == 'undefined') {
399 _Clipperz_PM_Components_base_id_ ++;
400
401 result = "Clipperz_PM_Components_" + aValue + "_" + _Clipperz_PM_Components_base_id_;
402 this._ids[aValue] = result;
403 }
404 } else {
405 // result = Clipperz.PM.UI.Common.Components.BaseComponent.superclass.getId.call(this);
406 throw "call to BaseComponent.getId with an undefined value";
407 }
408
409 return result;
410 },
411
412 //-------------------------------------------------------------------------
413
414 'getElement': function(aValue) {
415 return Clipperz.DOM.get(this.getId(aValue));
416 },
417
418 //-------------------------------------------------------------------------
419
420 'hideElement': function(anElementName) {
421 MochiKit.Style.hideElement(this.getElement(anElementName));
422 },
423
424 'showElement': function(anElementName) {
425 MochiKit.Style.showElement(this.getElement(anElementName));
426 },
427
428 //-------------------------------------------------------------------------
429
430 'activate': function () {
431 this._isActive = true;
432 },
433
434 'deactivate': function () {
435 this._isActive = false;
436 },
437
438 'isActive': function () {
439 return this._isActive;
440 },
441
442 //-------------------------------------------------------------------------
443
444 'hideSlot': function(aSlotName) {
445 if (this.componentForSlotNamed(aSlotName)) {
446 this.componentForSlotNamed(aSlotName).deactivate();
447 }
448 MochiKit.Style.hideElement(this.elementForSlotNamed(aSlotName));
449 },
450
451 'showSlot': function(aSlotName) {
452 if (this.componentForSlotNamed(aSlotName)) {
453 this.componentForSlotNamed(aSlotName).activate();
454 }
455 MochiKit.Style.showElement(this.elementForSlotNamed(aSlotName));
456 },
457
458 //-------------------------------------------------------------------------
459
460 'shouldShowTranslationHints': function () {
461 return false;
462 },
463
464 'shouldShowElementWhileRendering': function() {
465 return true;
466 },
467
468 //'shouldRemoveElementWhenClearningUp': function () {
469 // return true;
470 //},
471
472 //-------------------------------------------------------------------------
473
474 'isModal': function() {
475 return this._isModal;
476 },
477
478 'setIsModal': function(aValue) {
479 this._isModal = aValue;
480 },
481
482 //-------------------------------------------------------------------------
483
484 'elementUsedToEnterModalState': function () {
485 return this._elementUsedToEnterModalState;
486 },
487
488 'setElementUsedToEnterModalState': function (aValue) {
489 this._elementUsedToEnterModalState = aValue;
490 },
491
492 //-------------------------------------------------------------------------
493
494 'modalDialogMask': function () {
495 return 'modalDialogMask';
496 },
497
498 'modalDialog': function () {
499 return 'modalDialog';
500 },
501
502 'modalDialogFrame': function() {
503 return 'modalDialogFrame'
504 },
505
506 //-------------------------------------------------------------------------
507
508 'deferredShowModal': function(args) {
509 var deferredResult;
510
511 deferredResult = new Clipperz.Async.Deferred("BaseComponent.deferredShowModal", {trace:false});
512
513 deferredResult.addMethod(this, 'setIsModal', true);
514 deferredResult.addCallback(MochiKit.Style.showElement, this.modalDialogMask());
515 deferredResult.addCallback(MochiKit.Base.bind(function(someArgs) {
516 var result;
517 var duration;
518 var from;
519 var to;
520
521 duration = someArgs.duration || 0.4;
522
523 this.setElementUsedToEnterModalState(someArgs.openFromElement);
524 from = Clipperz.Style.getSizeAndPosition(someArgs.openFromElement);
525 this.renderInNode(this.modalDialog());
526 MochiKit.DOM.addElementClass(this.modalDialog(), 'fixed');
527 to = Clipperz.Style.getSizeAndPosition(this.displayElement());
528 Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition = Clipperz.Base.deepClone(to);
529
530 MochiKit.Style.hideElement(this.displayElement());
531 MochiKit.Style.showElement(this.modalDialogFrame());
532
533 result = {from:from, to:to, duration:duration};
534 return result;
535 }, this, args));
536 deferredResult.addCallback(Clipperz.Visual.deferredResize, this.modalDialogFrame());
537 deferredResult.addCallback(MochiKit.Base.bind(function(someArgs) {
538 MochiKit.Style.hideElement(this.modalDialogFrame());
539 MochiKit.Style.showElement(this.displayElement());
540 }, this));
541 deferredResult.addCallback(MochiKit.Async.succeed, arguments[arguments.length - 1]);
542 deferredResult.callback();
543
544 return deferredResult;
545 },
546
547 //-------------------------------------------------------------------------
548
549 'deferredHideModal': function(args) {
550 var deferredResult;
551
552 args = args || {};
553
554 deferredResult = new Clipperz.Async.Deferred("BaseComponent.deferredHideModal", {trace:false});
555 deferredResult.addCallback(MochiKit.Base.bind(function(someArgs) {
556 var result;
557 var from;
558 var toElement;
559 var to;
560 var duration;
561
562 toElement = args.closeToElement || this.elementUsedToEnterModalState();
563 duration = someArgs.duration || 0.4;
564 from = Clipperz.Style.getSizeAndPosition(this.displayElement());
565 to = Clipperz.Style.getSizeAndPosition(toElement);
566
567 MochiKit.Style.hideElement(this.displayElement());
568 MochiKit.Style.showElement(this.modalDialogFrame());
569
570 result = {from:from, to:to, duration:duration};
571 return result;
572 }, this, args));
573 deferredResult.addCallback(Clipperz.Visual.deferredResize, this.modalDialogFrame());
574 deferredResult.addCallback(MochiKit.Base.bind(function() {
575 MochiKit.Style.hideElement(this.modalDialogFrame());
576 MochiKit.Style.hideElement(this.modalDialogMask());
577 }, this));
578 deferredResult.addMethod(this, 'setIsModal', false);
579 deferredResult.addMethod(this, 'clear'); //##############
580 deferredResult.addCallback(MochiKit.Async.succeed, arguments[arguments.length - 1]);
581 deferredResult.callback();
582
583 return deferredResult;
584 },
585
586 //-------------------------------------------------------------------------
587
588 __syntaxFix__: "syntax fix"
589
590});
591
592Clipperz.PM.UI.Common.Components.BaseComponent_modalDialog = function() {
593 Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body,
594 {tag:'div', id:'modalDialogWrapper', cls:'modalDialogWrapper', children:[
595 {tag:'div', id:'modalDialogMask', cls:'modalDialogMask'},
596 {tag:'div', id:'modalDialogFrame', cls:'modalDialogFrame' /*, html:"modal dialog frame"*/},
597 {tag:'div', id:'modalDialog', cls:'modalDialog'}
598 // {tag:'div', id:'modalDialog', cls:'modalDialog', children:[{tag:'div'}]}
599 ]}
600 );
601
602 //MochiKit.Style.hideElement('modalDialogWrapper');
603 MochiKit.Style.hideElement('modalDialogMask');
604 MochiKit.Style.hideElement('modalDialogFrame');
605 //MochiKit.Style.hideElement('modalDialog');
606
607};
608
609//Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition = {'x':'X', 'y':'Y'};
610
611MochiKit.DOM.addLoadEvent(Clipperz.PM.UI.Common.Components.BaseComponent_modalDialog);
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js
new file mode 100644
index 0000000..b2761ea
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js
@@ -0,0 +1,108 @@
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.Common.Components.Button = function(args) {
32 args = args || {};
33
34 Clipperz.PM.UI.Common.Components.Button.superclass.constructor.apply(this, arguments);
35
36 this._element = args.element || Clipperz.Base.exception.raise('MandatoryParameter');
37 this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter');
38 this._isDefault = args.isDefault|| false;
39
40 this.render();
41
42 return this;
43}
44
45//=============================================================================
46
47Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Common.Components.BaseComponent, {
48
49 //-------------------------------------------------------------------------
50
51 'toString': function () {
52 return "Clipperz.PM.UI.Common.Components.Button component";
53 },
54
55 //-------------------------------------------------------------------------
56
57 'text': function () {
58 return this._text;
59 },
60
61 'isDefault': function () {
62 return this._isDefault;
63 },
64
65 //-------------------------------------------------------------------------
66
67 'renderSelf': function () {
68 this.append(this.element(), {tag:'div', id:this.getId('wrapper'), cls:'button_wrapper', children:[
69 {tag:'div', id:this.getId('bodyWrapper'), cls:'button_bodyWrapper', children:[
70 {tag:'div', id:this.getId('body'), cls:'button_body', children:[
71 {tag:'span', html:this.text()}
72 ]},
73 {tag:'div', id:this.getId('footer'), cls:'button_footer'}
74 ]}
75 ]});
76
77 if (this.isDefault()) {
78 MochiKit.DOM.addElementClass(this.getId('wrapper'), 'default');
79 }
80
81 MochiKit.Signal.connect(this.getId('wrapper'), 'onmouseenter',this, 'handleOnMouseEnter');
82 MochiKit.Signal.connect(this.getId('wrapper'), 'onmouseleave',this, 'handleOnMouseLeave');
83 MochiKit.Signal.connect(this.getId('wrapper'), 'onmousedown',this, 'handleOnMouseDown');
84 MochiKit.Signal.connect(this.getId('wrapper'), 'onclick', this, 'handleOnClick');
85 },
86
87 //-------------------------------------------------------------------------
88
89 'handleOnMouseEnter': function (anEvent) {
90 MochiKit.DOM.addElementClass(this.getId('wrapper'), 'hover');
91 },
92
93 'handleOnMouseLeave': function (anEvent) {
94 MochiKit.DOM.removeElementClass(this.getId('wrapper'), 'hover');
95 MochiKit.DOM.removeElementClass(this.getId('wrapper'), 'clicked');
96 },
97
98 'handleOnMouseDown': function (anEvent) {
99 MochiKit.DOM.addElementClass(this.getId('wrapper'), 'clicked');
100 },
101
102 'handleOnClick': function (anEvent) {
103 MochiKit.Signal.signal(this, 'onclick', anEvent);
104 },
105
106 //-------------------------------------------------------------------------
107 __syntaxFix__: "syntax fix"
108});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js
new file mode 100644
index 0000000..0c6e221
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js
@@ -0,0 +1,64 @@
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
31//#############################################################################
32
33
34Clipperz.PM.UI.Common.Components.ComponentSlot = function(aComponent, aSlotName) {
35 this._component = aComponent;
36 this._slotName = aSlotName;
37
38 return this;
39}
40
41//=============================================================================
42
43Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.ComponentSlot, Object, {
44
45 //-------------------------------------------------------------------------
46
47 'slotName': function() {
48 return this._slotName;
49 },
50
51 'component': function() {
52 return this._component;
53 },
54
55 //-------------------------------------------------------------------------
56
57 'setContent': function(aComponent) {
58 this.component().setComponentForSlotNamed(aComponent, this.slotName());
59 },
60
61 //-------------------------------------------------------------------------
62 __syntaxFix__: "syntax fix"
63
64});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js
new file mode 100644
index 0000000..4735f5c
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js
@@ -0,0 +1,91 @@
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.Common.Components.FaviconComponent = function(args) {
32 args = args || {};
33
34 Clipperz.PM.UI.Common.Components.FaviconComponent.superclass.constructor.apply(this, arguments);
35
36 this.render();
37 this.setSrc(args.src);
38
39 return this;
40}
41
42//=============================================================================
43
44Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.FaviconComponent, Clipperz.PM.UI.Common.Components.BaseComponent, {
45
46 //-------------------------------------------------------------------------
47
48 'toString': function () {
49 return "Clipperz.PM.UI.Common.Components.FaviconComponent component";
50 },
51
52 //-------------------------------------------------------------------------
53
54 'src': function () {
55 return this.element().src;
56 },
57
58 'setSrc': function (aValue) {
59 this.element().src = (aValue || Clipperz.PM.Strings.getValue('defaultFaviconUrl'));
60 },
61
62 //-------------------------------------------------------------------------
63
64 'clear': function () {},
65
66 //-------------------------------------------------------------------------
67
68 'renderSelf': function () {
69 MochiKit.Signal.connect(this.element(), 'onerror',this, 'setDefaultFavicon');
70 MochiKit.Signal.connect(this.element(), 'onabort',this, 'setDefaultFavicon');
71 MochiKit.Signal.connect(this.element(), 'onload',this, 'handleOnLoad');
72 },
73
74 //-------------------------------------------------------------------------
75
76 'setDefaultFavicon': function (anEvent) {
77 MochiKit.Signal.disconnectAll(anEvent.src());
78 this.setSrc(null);
79 },
80
81 'handleOnLoad': function (anEvent) {
82 MochiKit.Signal.disconnectAll(anEvent.src());
83//console.log("HANDLE ON LOAD", anEvent, anEvent.src().src);
84 if (anEvent.src().complete == false) {
85 this.setSrc(null);
86 }
87 },
88
89 //-------------------------------------------------------------------------
90 __syntaxFix__: "syntax fix"
91});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js
new file mode 100644
index 0000000..275bbed
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.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.Common.Components.MessagePanelWithProgressBar = function(args) {
32 args = args || {};
33
34 Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar.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._canCancelWhileProcessing= ((typeof(args.canCancelWhileProcessing) == 'undefined') ? true : args.canCancelWhileProcessing);
41
42 return this;
43}
44
45//=============================================================================
46
47Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar, Clipperz.PM.UI.Common.Components.SimpleMessagePanel, {
48
49 //-------------------------------------------------------------------------
50
51 'toString': function () {
52 return "Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar component";
53 },
54
55 //-------------------------------------------------------------------------
56/*
57 'openFromElement': function () {
58 return this._openFromElement;
59 },
60*/
61 //-------------------------------------------------------------------------
62
63 'onOkCloseToElement': function () {
64 return this._onOkCloseToElement;
65 },
66
67 'setOnOkCloseToElement': function (anElement) {
68 this._onOkCloseToElement = anElement;
69 },
70
71 //-------------------------------------------------------------------------
72
73 'onCancelCloseToElement': function () {
74 return this._onCancelCloseToElement;
75 },
76
77 'setOnCancelCloseToElement': function (anElement) {
78 this._onCancelCloseToElement = anElement;
79 },
80
81 //-------------------------------------------------------------------------
82
83 'canCancelWhileProcessing': function () {
84 return this._canCancelWhileProcessing;
85 },
86
87 //-------------------------------------------------------------------------
88
89 'deferredShowModal': function (someArgs, aResult) {
90 if (someArgs['onOkCloseToElement'] != null) {
91 this.setOnOkCloseToElement(someArgs['onOkCloseToElement']);
92 }
93
94 if (someArgs['onCancelCloseToElement'] != null) {
95 this.setOnCancelCloseToElement(someArgs['onCancelCloseToElement']);
96 }
97
98 Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar.superclass.deferredShowModal.apply(this, arguments);
99 return this.deferred();
100 },
101
102 //-------------------------------------------------------------------------
103
104 'showProgressBar': function () {
105 varprogressBarElement;
106
107 this.getElement('container').innerHTML = '';
108
109 progressBarElement = this.append(this.getElement('container'), {tag:'div', cls:'progressBarWrapper'});
110 this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':progressBarElement}));
111
112 if (this.canCancelWhileProcessing() == true) {
113 this.setButtons([{text:"Cancel", result:'CANCEL'}]);
114 } else {
115 this.setButtons([]);
116 }
117 },
118
119 //-------------------------------------------------------------------------
120
121 'showFailure': function (someParameters) {
122 // this.setType('ALERT');
123 this.setType(someParameters['type']);
124 // this.setTitle("Login failed");
125 this.setTitle(someParameters['title']);
126 // this.setText("Wrong passphrase; the unlock has failed.");
127 this.setText(someParameters['text']);
128 // this.getElement('container').innerHTML = '';
129 this.getElement('container').innerHTML = '';
130 // this.setButtons([{text:"Close", result:'CANCEL', isDefault:true}]);
131 this.setButtons(someParameters['buttons']);
132 },
133
134 //-------------------------------------------------------------------------
135
136 'closeOk': function () {
137//console.log("=== closeOk");
138 this.showProgressBar();
139 MochiKit.Async.callLater(0.5, MochiKit.Base.method(this.deferred(), 'callback'));
140 this._deferred = null;
141 },
142
143 'closeCancel': function () {
144//console.log("=== closeCancel");
145 this.deferredHideModal({closeToElement:this.onCancelCloseToElement()});
146 this.deferred().cancel();
147 this._deferred = null;
148 },
149
150 //-------------------------------------------------------------------------
151
152 'deferredDone': function () {
153//console.log("=== deferredDone");
154 return this.deferredHideModal({closeToElement:this.onOkCloseToElement()});
155 },
156
157 'deferredError': function (someParameters) {
158//console.log("=== deferredError");
159 this.showFailure(someParameters);
160 },
161
162 //-------------------------------------------------------------------------
163 __syntaxFix__: "syntax fix"
164});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js
new file mode 100644
index 0000000..c1b4f13
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js
@@ -0,0 +1,140 @@
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.Common.Components.PasswordEntropyDisplay = function(anElement, args) {
32 args = args || {};
33
34//MochiKit.Logging.logDebug(">>> new TextFormField");
35 Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay.superclass.constructor.call(this, anElement, args);
36
37 this._wrapperElement = null;
38 this._entropyElement = null;
39
40 this.render();
41//MochiKit.Logging.logDebug("<<< new TextFormField");
42
43 return this;
44};
45
46Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay, Clipperz.PM.UI.Common.Components.BaseComponent, {
47
48 'toString': function() {
49 return "Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay";
50 },
51
52 //-----------------------------------------------------
53
54 'wrapperElement': function() {
55 return this._wrapperElement;
56 },
57
58 'setWrapperElement': function(aValue) {
59 this._wrapperElement = aValue;
60 },
61
62 //-----------------------------------------------------
63
64 'passwordElement': function() {
65 return this.element();
66 },
67
68 //-----------------------------------------------------
69
70 'entropyElement': function() {
71 return this._entropyElement;
72 },
73
74 'setEntropyElement': function(aValue) {
75 this._entropyElement = aValue;
76 },
77
78 //-----------------------------------------------------
79
80 'render': function() {
81/*
82 MochiKit.Signal.disconnectAllTo(this);
83
84 this.setWrapperElement(this.element().wrap({tag:'div'}));
85 this.setEntropyElement(Clipperz.DOM.Helper.append(this.wrapperElement().dom, {tag:'div', cls:'passwordEntropy', html:"&nbsp;"}, true));
86 // this.setEntropyElement(Clipperz.DOM.Helper.insertBefore(this.element(), {tag:'div', cls:'passwordEntropy', html:"&nbsp;"}, true));
87 this.entropyElement().wrap({tag:'div', cls:'passwordEntropyWrapper'});
88
89 this.updateEntropyElement();
90
91 this.connect('onkeyup', 'updateEntropyElement');
92 this.connect('onchange', 'updateEntropyElement');
93 this.connect('onblur', 'updateEntropyElement');
94*/
95 MochiKit.Signal.disconnectAllTo(this);
96
97 this.setEntropyElement(this.element());
98 this.entropyElement().addClass("entropyLevelIndicator");
99
100 this.updateEntropyElement();
101
102 this.connect('onkeyup', 'updateEntropyElement');
103 this.connect('onchange', 'updateEntropyElement');
104 this.connect('onblur', 'updateEntropyElement');
105 },
106
107 //-----------------------------------------------------
108
109 'computeEntropyForString': function(aValue) {
110 return Clipperz.PM.Crypto.passwordEntropy(aValue);
111 },
112
113 //-----------------------------------------------------
114
115 'updateEntropyElement': function(anEvent) {
116/*
117//MochiKit.Logging.logDebug(">>> PasswordEntropyDisplay.updateEntropyElement");
118 varmaxExtent;
119 varentropy;
120
121 entropy = Math.min(128, this.computeEntropyForString(this.passwordElement().dom.value));
122//MochiKit.Logging.logDebug("--- PasswordEntropyDisplay.updateEntropyElement - entropy: " + entropy);
123 this.entropyElement().setStyle('background-position', "0px " + -entropy + "px");
124 this.entropyElement().setWidth(this.passwordElement().getWidth() * (entropy/128));
125//MochiKit.Logging.logDebug("<<< PasswordEntropyDisplay.updateEntropyElement");
126*/
127 varentropy;
128
129 entropy = Math.min(128, this.computeEntropyForString(this.passwordElement().dom.value));
130
131 if (entropy == 0) {
132 this.entropyElement().setStyle('background-position', "0px 26px");
133 } else {
134 this.entropyElement().setStyle('background-position', "0px -" + (128-entropy)*26 + "px");
135 }
136 },
137
138 //-----------------------------------------------------
139 __syntaxFix__: '__syntaxFix__'
140});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js
new file mode 100644
index 0000000..7e7f8fe
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js
@@ -0,0 +1,73 @@
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.Common.Components.ProgressBar = function(args) {
32 args = args || {};
33
34 Clipperz.PM.UI.Common.Components.ProgressBar.superclass.constructor.apply(this, arguments);
35
36 this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter');
37
38 this.renderSelf();
39
40 MochiKit.Signal.connect(Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController, 'updateProgress', this, 'updateProgressHandler')
41
42 return this;
43}
44
45//=============================================================================
46
47Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.ProgressBar, Clipperz.PM.UI.Common.Components.BaseComponent, {
48
49 //-------------------------------------------------------------------------
50
51 'toString': function () {
52 return "Clipperz.PM.UI.Common.Components.ProgressBar component";
53 },
54
55 //-------------------------------------------------------------------------
56
57 'renderSelf': function() {
58 this.append(this.element(), {tag:'div', cls:'loadingBar', children:[
59 {tag:'div', cls:'loadingBarProgressBox', children:[
60 {tag:'div', id:this.getId('loadingBarProgress'), cls:'loadingBarProgress'}
61 ]}
62 ]});
63 },
64
65 //-------------------------------------------------------------------------
66
67 'updateProgressHandler': function (anEvent) {
68 MochiKit.Style.setElementDimensions(this.getId('loadingBarProgress'), {w:anEvent}, '%');
69 },
70
71 //-------------------------------------------------------------------------
72 __syntaxFix__: "syntax fix"
73});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js
new file mode 100644
index 0000000..b9bb850
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js
@@ -0,0 +1,282 @@
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.Common.Components.SimpleMessagePanel = function(args) {
32 args = args || {};
33
34 Clipperz.PM.UI.Common.Components.SimpleMessagePanel.superclass.constructor.apply(this, arguments);
35
36 this._title = args.title || Clipperz.Base.exception.raise('MandatoryParameter');
37 this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter');
38 this._type = args.type || Clipperz.Base.exception.raise('MandatoryParameter'); //ALERT, INFO, ERROR
39 this._buttons = args.buttons || Clipperz.Base.exception.raise('MandatoryParameter');
40
41 this._buttonComponents = [];
42 this._deferred = null;
43
44 this.renderModalMask();
45
46 return this;
47}
48
49//=============================================================================
50
51Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.SimpleMessagePanel, Clipperz.PM.UI.Common.Components.BaseComponent, {
52
53 //-------------------------------------------------------------------------
54
55 'toString': function () {
56 return "Clipperz.PM.UI.Common.Components.SimpleMessagePanel component";
57 },
58
59 //-------------------------------------------------------------------------
60
61 'deferred': function() {
62 if (this._deferred == null) {
63 this._deferred = new Clipperz.Async.Deferred("SimpleMessagePanel.deferred", {trace:false});
64 }
65
66 return this._deferred;
67 },
68
69 //-------------------------------------------------------------------------
70
71 'title': function () {
72 return this._title;
73 },
74
75 'setTitle': function (aValue) {
76 this._title = aValue;
77
78 if (this.getElement('title') != null) {
79 this.getElement('title').innerHTML = aValue;
80 }
81 },
82
83 //-------------------------------------------------------------------------
84
85 'text': function () {
86 return this._text;
87 },
88
89 'setText': function (aValue) {
90 this._text = aValue;
91
92 if (this.getElement('text') != null) {
93 this.getElement('text').innerHTML = aValue;
94 }
95 },
96
97 //-------------------------------------------------------------------------
98
99 'type': function () {
100 return this._type;
101 },
102
103 'setType': function (aValue) {
104 if (this.getElement('icon') != null) {
105 MochiKit.DOM.removeElementClass(this.getId('icon'), this._type);
106 MochiKit.DOM.addElementClass(this.getId('icon'), aValue);
107 }
108
109 this._type = aValue;
110 },
111
112 //-------------------------------------------------------------------------
113
114 'buttons': function () {
115 return this._buttons;
116 },
117
118 'setButtons': function (someValues) {
119 MochiKit.Iter.forEach(this.buttonComponents(), MochiKit.Base.methodcaller('clear'));
120
121 this._buttons = someValues;
122
123 if (this.getElement('buttonArea') != null) {
124 this.renderButtons();
125 }
126 },
127
128 //.........................................................................
129
130 'buttonComponents': function () {
131 return this._buttonComponents;
132 },
133
134 //-------------------------------------------------------------------------
135
136 'renderSelf': function() {
137 this.append(this.element(), {tag:'div', cls:'SimpleMessagePanel', id:this.getId('panel'), children: [
138 {tag:'div', cls:'header', children:[]},
139 {tag:'div', cls:'body', children:[
140 {tag:'div', id:this.getId('icon'),cls:'img ' + this.type(), children:[{tag:'div'}]},
141 {tag:'h3', id:this.getId('title'),html:this.title()},
142 {tag:'p', id:this.getId('text'),html:this.text()},
143 {tag:'div', id:this.getId('container')},
144 {tag:'div', id:this.getId('buttonArea'), cls:'buttonArea', children:[]}
145 ]},
146 {tag:'div', cls:'footer', children:[]}
147 ]});
148
149 MochiKit.Signal.connect(this.getId('panel'), 'onkeydown', this, 'keyDownHandler');
150
151 this.renderButtons();
152 },
153
154 //-------------------------------------------------------------------------
155
156 'renderButtons': function () {
157 this.getElement('buttonArea').innerHTML = '';
158
159 MochiKit.Base.map(MochiKit.Base.bind(function (aButton) {
160 var buttonElement;
161 var buttonComponent;
162
163 // element = this.append(this.getElement('buttonArea'), {tag:'div', cls:'button' + (aButton['isDefault'] === true ? ' default' : ''), children:[
164 // {tag:'a', href:'#'/*, id:this.getId('buttonLink')*/, html:aButton['text']}
165 // ]});
166
167 buttonElement = this.append(this.getElement('buttonArea'), {tag:'div'});
168 buttonComponent = new Clipperz.PM.UI.Common.Components.Button({'element':buttonElement, 'text':aButton['text'], 'isDefault':aButton['isDefault']});
169 this.buttonComponents().push(buttonComponent);
170
171 MochiKit.Signal.connect(buttonComponent, 'onclick', MochiKit.Base.method(this, 'buttonEventHandler', aButton));
172 }, this), MochiKit.Iter.reversed(this.buttons()));
173 },
174
175 //-------------------------------------------------------------------------
176
177 'displayElement': function() {
178 return this.getElement('panel');
179 },
180
181 //-------------------------------------------------------------------------
182
183 'closeOk': function () {
184 this.deferred().callback();
185 this._deferred = null;
186 },
187
188 'closeCancel': function () {
189 this.deferred().cancel();
190 this._deferred = null;
191 },
192
193 'closeError': function () {
194 this.deferred().errback();
195 this._deferred = null;
196 },
197
198 //-------------------------------------------------------------------------
199
200 'buttonEventHandler': function(aButton, anEvent) {
201 anEvent.preventDefault();
202
203 // MochiKit.Signal.signal(this, 'cancelEvent');
204 switch (aButton['result']) {
205 case 'OK':
206//console.log("==> OK");
207 this.closeOk();
208 break;
209 case 'CANCEL':
210//console.log("==> CANCEL");
211 this.closeCancel();
212 break;
213 default:
214//console.log("==> ????");
215 this.closeError();
216 break;
217 }
218//console.log("<==");
219 },
220
221 //-------------------------------------------------------------------------
222
223 'deferredShow': function (someArgs, aResult) {
224 this.deferredShowModal(someArgs);
225
226 this.deferred().addMethod(this, 'deferredHideModal', {closeToElement:someArgs.onOkCloseToElement });
227 this.deferred().addErrback (MochiKit.Base.method(this, 'deferredHideModal', {closeToElement:someArgs.onCancelCloseToElement }));
228 this.deferred().addCallback(MochiKit.Async.succeed, aResult);
229
230 return this.deferred();
231 },
232
233 //-------------------------------------------------------------------------
234
235 'modalDialogMask': function () {
236 return this.getId('modalDialogMask');
237 },
238
239 'modalDialog': function () {
240 return this.getId('modalDialog');
241 },
242
243 'modalDialogFrame': function() {
244 return this.getId('modalDialogFrame');
245 },
246
247 //-------------------------------------------------------------------------
248
249 'renderModalMask': function () {
250 Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body,
251 {tag:'div', id:this.getId('modalDialogWrapper'), cls:'modalDialogWrapper simpleMessagePanelMask', children:[
252 {tag:'div', id:this.getId('modalDialogMask'), cls:'modalDialogMask simpleMessagePanelMask'},
253 {tag:'div', id:this.getId('modalDialogFrame'), cls:'modalDialogFrame simpleMessagePanelMask'},
254 {tag:'div', id:this.getId('modalDialog'), cls:'modalDialog simpleMessagePanelMask'}
255 ]}
256 );
257
258 MochiKit.Style.hideElement(this.getId('modalDialogMask'));
259 MochiKit.Style.hideElement(this.getId('modalDialogFrame'));
260 },
261
262 //-------------------------------------------------------------------------
263
264 'keyDownHandler': function (anEvent) {
265 if (anEvent.key().string == 'KEY_ENTER') {
266 anEvent.preventDefault();
267//console.log("13 - RETURN ?", this);
268 this.closeOk();
269//console.log('<<< 13')
270 }
271
272 if (anEvent.key().string == 'KEY_ESCAPE') {
273 anEvent.preventDefault();
274//console.log("27 - ESC ?", this);
275 this.closeCancel();
276//console.log("<<< 27");
277 }
278 },
279
280 //-------------------------------------------------------------------------
281 __syntaxFix__: "syntax fix"
282});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js
new file mode 100644
index 0000000..afb3bf9
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js
@@ -0,0 +1,69 @@
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.Common.Components.TabPanelComponent = function(args) {
32 args = args || {};
33 Clipperz.PM.UI.Common.Components.TabPanelComponent.superclass.constructor.call(this, args);
34
35 this._tabPanelController = null;
36
37 return this;
38}
39
40//=============================================================================
41
42Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.TabPanelComponent, Clipperz.PM.UI.Common.Components.BaseComponent, {
43
44 'toString': function () {
45 return "Clipperz.PM.UI.Common.Components.TabPanelComponent component";
46 },
47
48 //-------------------------------------------------------------------------
49
50 'tabPanelControllerConfiguration': function() {
51 return this._tabPanelControllerConfiguration;
52 },
53
54 'tabPanelController': function() {
55 if (this._tabPanelController == null) {
56 this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({component:this, configuration:this.tabPanelControllerConfiguration()});
57 }
58
59 return this._tabPanelController;
60 },
61
62 'initiallySelectedTab': function() {
63 return this._initiallySelectedTab;
64 },
65
66 //-------------------------------------------------------------------------
67 __syntaxFix__: "syntax fix"
68
69});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js
new file mode 100644
index 0000000..7507b86
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js
@@ -0,0 +1,216 @@
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.Common.Components.Tooltip = function(args) {
32 args = args || {};
33
34 Clipperz.PM.UI.Common.Components.Tooltip.superclass.constructor.apply(this, arguments);
35
36 this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter');
37 this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter');
38 this._position = args.position || 'BELOW'; //'BELOW', 'ABOVE', 'LEFT', 'RIGHT'
39
40 this._boxDimensions = null;
41 this._enabled = (typeof(args.enabled) == 'undefined' ? true : args.enabled);
42 this._isVisible = false;
43
44 this.renderSelf();
45
46 return this;
47}
48
49//=============================================================================
50
51Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Tooltip, Clipperz.PM.UI.Common.Components.BaseComponent, {
52
53 //-------------------------------------------------------------------------
54
55 'toString': function () {
56 return "Clipperz.PM.UI.Common.Components.Tooltip component";
57 },
58
59 //-------------------------------------------------------------------------
60
61 'text': function () {
62 return this._text;
63 },
64
65 'setText': function (aValue) {
66 this._text = aValue;
67 },
68
69 //-------------------------------------------------------------------------
70
71 'position': function () {
72 return this._position;
73 },
74
75 'setPosition': function (aValue) {
76 this._position = aValue;
77 },
78
79 //-------------------------------------------------------------------------
80
81 'enabled': function () {
82 return this._enabled;
83 },
84
85 'setIsEnabled': function (aValue) {
86 this._enabled = aValue;
87 },
88
89 //-------------------------------------------------------------------------
90
91 'isVisible': function () {
92 return this._isVisible;
93 },
94
95 'setIsVisible': function (aValue) {
96 this._isVisible = aValue;
97 },
98
99 //-------------------------------------------------------------------------
100
101 'renderSelf': function() {
102 // this.append(this.element(), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[
103 // this.append(MochiKit.DOM.currentDocument().body, {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[
104 this.append(MochiKit.DOM.getElement('Clipperz_PM_UI_Common_Components_Tooltip_wrapperNode'), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[
105 {tag:'div', id:this.getId('body'), cls:'tooltip_body', children:[
106 {tag:'div', cls:'tooltip_text', children:[
107 {tag:'span', html:this.text()}
108 ]},
109 {tag:'div', id:this.getId('footer'), cls:'tooltip_footer'}
110 ]},
111 {tag:'div', id:this.getId('arrow'), cls:'tooltip_arrow'}
112 ]});
113
114 this._boxDimensions = MochiKit.Style.getElementDimensions(this.getId('body'));
115 // this._boxDimensions.h += MochiKit.Style.getElementDimensions(this.getId('footer')).h;
116
117 MochiKit.Style.hideElement(this.displayElement());
118 MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show');
119 MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide');
120 },
121
122 //-----------------------------------------------------
123
124 'displayElement': function() {
125 return this.getElement('tooltip');
126 },
127
128 //-------------------------------------------------------------------------
129
130 'boxDimensions': function () {
131 return this._boxDimensions;
132 },
133
134 //-------------------------------------------------------------------------
135
136 'show': function () {
137 var elementSizeAndPosition;
138 var arrowPosition;
139 var bodyPosition;
140
141 if (this.isVisible() == false) {
142 arrowPosition = {};
143 bodyPosition = {};
144
145 this.setIsVisible(true);
146 elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element());
147//console.log("ELEMENT SIZE AND POSITION", Clipperz.Base.serializeJSON(elementSizeAndPosition));
148//console.log("BOX DIMENSIONS", Clipperz.Base.serializeJSON(this.boxDimensions()));
149 switch (this.position()) {
150 case 'ABOVE':
151//console.log("ABOVE");
152 MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px');
153 bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2);
154 bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13;
155
156 arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2);
157 arrowPosition.y = elementSizeAndPosition.position.y - 13;
158 break;
159 case 'BELOW':
160//console.log("BELOW");
161 MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px');
162 bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2);
163 bodyPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h + 13;
164
165 arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2);
166 arrowPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h;
167 break;
168 case 'LEFT':
169//console.log("LEFT");
170 MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px');
171 bodyPosition.x = elementSizeAndPosition.position.x - this.boxDimensions().w - 13;
172 bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2);
173
174 arrowPosition.x = elementSizeAndPosition.position.x -13;
175 arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2);
176 break;
177 case 'RIGHT':
178//console.log("RIGHT");
179 MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px');
180 bodyPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w + 13;
181 bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2);
182
183 arrowPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w;
184 arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2);
185 break;
186 }
187//console.log("X: " + bodyPosition.x + ", Y: " + bodyPosition.y);
188
189 MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition);
190 MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition);
191 MochiKit.Visual.appear(this.displayElement(), {duration:0.4});
192 }
193 },
194
195 'hide': function () {
196 if (this.isVisible() == true) {
197 MochiKit.Visual.fade(this.displayElement(), {duration:0.4});
198 this.setIsVisible(false);
199 }
200 },
201
202 //-------------------------------------------------------------------------
203/*
204 'shouldRemoveElementWhenClearningUp': function () {
205 return false;
206 },
207*/
208 //-------------------------------------------------------------------------
209 __syntaxFix__: "syntax fix"
210});
211
212Clipperz.PM.UI.Common.Components.Tooltip.initTooltips = function () {
213 Clipperz.DOM.Helper.insertBefore(MochiKit.DOM.currentDocument().body.childNodes[0], {tag:'div', id:'Clipperz_PM_UI_Common_Components_Tooltip_wrapperNode'});
214}
215
216MochiKit.DOM.addLoadEvent(Clipperz.PM.UI.Common.Components.Tooltip.initTooltips);
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js
new file mode 100644
index 0000000..c31969e
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js
@@ -0,0 +1,170 @@
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.Common.Components.TranslatorWidget = function(args) {
32Clipperz.log(">>> TranslatorWidget.new");
33 args = args || {};
34
35 Clipperz.PM.UI.Common.Components.TranslatorWidget.superclass.constructor.apply(this, arguments);
36
37 // this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter');
38 // this._stringID = args.stringID || MochiKit.DOM.getNodeAttribute(this.element(), 'stringID')|| Clipperz.Base.exception.raise('MandatoryParameter');
39
40 //MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show');
41 //MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide');
42
43Clipperz.log("<<< TranslatorWidget.new");
44 return this;
45}
46
47//=============================================================================
48
49Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.TranslatorWidget, Clipperz.PM.UI.Common.Components.BaseComponent, {
50
51 //-------------------------------------------------------------------------
52
53 'toString': function () {
54 return "Clipperz.PM.UI.Common.Components.TranslatorWidget component";
55 },
56
57 //-------------------------------------------------------------------------
58/*
59 'renderSelf': function() {
60 this.append(this.element(), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[
61 {tag:'div', id:this.getId('body'), cls:'tooltip_body', children:[
62 {tag:'div', cls:'tooltip_text', children:[
63 {tag:'span', html:this.text()}
64 ]},
65 {tag:'div', id:this.getId('footer'), cls:'tooltip_footer'}
66 ]},
67 {tag:'div', id:this.getId('arrow'), cls:'tooltip_arrow'}
68 ]});
69
70 this._boxDimensions = MochiKit.Style.getElementDimensions(this.getId('body'));
71 // this._boxDimensions.h += MochiKit.Style.getElementDimensions(this.getId('footer')).h;
72
73 MochiKit.Style.hideElement(this.displayElement());
74 MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show');
75 MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide');
76 },
77*/
78 //-----------------------------------------------------
79/*
80 'displayElement': function() {
81 return this.getElement('tooltip');
82 },
83*/
84 //-------------------------------------------------------------------------
85/*
86 'boxDimensions': function () {
87 return this._boxDimensions;
88 },
89*/
90 //-------------------------------------------------------------------------
91
92 'show': function (anElement, aStringID) {
93 Clipperz.log(">>> Clipperz.PM.UI.Common.Components.TranslatorWidget.show: " + aStringID);
94/*
95 var elementSizeAndPosition;
96 var arrowPosition;
97 var bodyPosition;
98
99 arrowPosition = {};
100 bodyPosition = {};
101
102 elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element());
103 switch (this.position()) {
104 case 'ABOVE':
105 MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px');
106 bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2);
107 bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13;
108
109 arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2);
110 arrowPosition.y = elementSizeAndPosition.position.y - 13;
111 break;
112 case 'BELOW':
113 MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px');
114 bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2);
115 bodyPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h + 13;
116
117 arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2);
118 arrowPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h;
119 break;
120 case 'LEFT':
121 MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px');
122 bodyPosition.x = elementSizeAndPosition.position.x - this.boxDimensions().w - 13;
123 bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2);
124
125 arrowPosition.x = elementSizeAndPosition.position.x -13;
126 arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2);
127 break;
128 case 'RIGHT':
129 MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px');
130 break;
131 }
132
133 // MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition);
134 MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition);
135 MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition);
136 MochiKit.Visual.appear(this.displayElement(), {duration:0.4});
137*/
138 },
139
140 //-------------------------------------------------------------------------
141
142 'hide': function () {
143 Clipperz.log("<<< Clipperz.PM.UI.Common.Components.TranslatorWidget.hide");
144 // MochiKit.Visual.fade(this.displayElement(), {duration:0.4});
145 },
146
147 //-------------------------------------------------------------------------
148 __syntaxFix__: "syntax fix"
149});
150
151//#############################################################################
152
153Clipperz.PM.UI.Common.Components.TranslatorWidget._widget = null;
154
155Clipperz.PM.UI.Common.Components.TranslatorWidget.widget = function () {
156 if (Clipperz.PM.UI.Common.Components.TranslatorWidget._widget == null) {
157 Clipperz.PM.UI.Common.Components.TranslatorWidget._widget = new Clipperz.PM.UI.Common.Components.TranslatorWidget();
158 }
159
160 return Clipperz.PM.UI.Common.Components.TranslatorWidget._widget;
161}
162Clipperz.PM.UI.Common.Components.TranslatorWidget.show = function (anElement, aStringID) {
163 Clipperz.PM.UI.Common.Components.TranslatorWidget.widget().show(anElement, aStringID);
164}
165
166Clipperz.PM.UI.Common.Components.TranslatorWidget.hide = function () {
167 Clipperz.PM.UI.Common.Components.TranslatorWidget.widget().hide();
168}
169
170//#############################################################################
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js
new file mode 100644
index 0000000..e534435
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js
@@ -0,0 +1,267 @@
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.Controllers');
30
31Clipperz.PM.UI.Common.Controllers.DirectLoginRunner = function(args) {
32 this._directLogin = args['directLogin'] || Clipperz.Base.exception.raise('MandatoryParameter');
33 this._target = Clipperz.PM.Crypto.randomKey();
34
35 return this;
36}
37
38MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.prototype, {
39
40 'toString': function() {
41 return "Clipperz.PM.UI.Common.Controllers.DirectLoginRunner";
42 },
43
44 //-----------------------------------------------------------------------------
45
46 'directLogin': function () {
47 return this._directLogin;
48 },
49
50 //-----------------------------------------------------------------------------
51
52 'target': function () {
53 return this._target;
54 },
55
56 //=============================================================================
57
58 'setWindowTitle': function (aWindow, aTitle) {
59 aWindow.document.title = aTitle;
60 },
61
62 'setWindowBody': function (aWindow, anHTML) {
63 aWindow.document.body.innerHTML = anHTML;
64 },
65
66 //=============================================================================
67
68 'initialWindowSetup': function (aWindow) {
69 this.setWindowTitle(aWindow, "Loading Clipperz Direct Login");
70 this.setWindowBody (aWindow, MochiKit.DOM.toHTML(MochiKit.DOM.H3("Loading Clipperz Direct Login ...")));
71 },
72
73 //-----------------------------------------------------------------------------
74
75 'updateWindowWithDirectLoginLabel': function (aWindow, aLabel) {
76 var titleText;
77 var bodyText;
78
79 titleText = "Loading '__label__' Direct Login".replace(/__label__/, aLabel)
80 bodyText = "Loading '__label__' Direct Login... ".replace(/__label__/, aLabel)
81
82 this.setWindowTitle(aWindow, titleText);
83 this.setWindowBody (aWindow, MochiKit.DOM.toHTML(MochiKit.DOM.H3(bodyText)));
84 },
85
86 //-----------------------------------------------------------------------------
87
88 'updateWindowWithHTMLContent': function (aWindow, anHtml) {
89 this.setWindowBody(aWindow, anHtml);
90 },
91
92 //=============================================================================
93
94 'submitLoginForm': function(aWindow, aSubmitFunction) {
95 MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function () {
96 var formElement;
97 var submitButtons;
98
99 formElement = MochiKit.DOM.getElement('directLoginForm');
100
101 submitButtons = MochiKit.Base.filter(function(anInputElement) {
102 return ((anInputElement.tagName.toLowerCase() == 'input') && (anInputElement.getAttribute('type').toLowerCase() == 'submit'));
103 }, formElement.elements);
104
105 if (submitButtons.length == 0) {
106 if (typeof(formElement.submit) == 'function') {
107 formElement.submit();
108 } else {
109 aSubmitFunction.apply(formElement);
110 }
111/*
112 varformSubmitFunction;
113
114 formSubmitFunction = MochiKit.Base.method(formElement, 'submit');
115 if (Clipperz_IEisBroken == true) {
116 formElement.submit();
117 } else {
118 formSubmitFunction();
119 }
120*/
121 } else {
122 submitButtons[0].click();
123 }
124 }, this));
125 },
126
127 //-------------------------------------------------------------------------
128
129 'runSubmitFormDirectLogin': function (aWindow, someAttributes) {
130 var html;
131 var formElement;
132 var submitFunction;
133
134 formElement = MochiKit.DOM.FORM({
135 'id':'directLoginForm',
136 'method':someAttributes['formAttributes']['method'],
137 'action':someAttributes['formAttributes']['action']
138 });
139
140 submitFunction = formElement.submit;
141
142 MochiKit.DOM.appendChildNodes(formElement, MochiKit.Base.map(function (anInputAttributes) {
143 return MochiKit.DOM.INPUT({'type':'hidden', 'name':anInputAttributes[0], 'value':anInputAttributes[1]});
144 }, MochiKit.Base.items(someAttributes['inputValues'])));
145
146 html ='';
147 html += '<h3>Loading ' + someAttributes['label'] + ' ...</h3>';
148 html +=MochiKit.DOM.appendChildNodes(MochiKit.DOM.DIV(), MochiKit.DOM.appendChildNodes(MochiKit.DOM.DIV({style:'display:none; visibility:hidden;'}), formElement)).innerHTML;
149
150 this.updateWindowWithHTMLContent(aWindow, html);
151 this.submitLoginForm(aWindow, submitFunction);
152 },
153
154 //-------------------------------------------------------------------------
155
156 'runHttpAuthDirectLogin': function(aWindow, someAttributes) {
157 var completeUrl;
158 var url;
159
160//console.log("runHttpAuthDirectLogin", someAttributes);
161 url = someAttributes['inputValues']['url'];
162
163 if (/^https?\:\/\//.test(url) == false) {
164 url = 'http://' + url;
165 }
166
167 if (Clipperz_IEisBroken === true) {
168 completeUrl = url;
169 } else {
170 var username;
171 var password;
172
173 username = someAttributes['inputValues']['username'];
174 password = someAttributes['inputValues']['password'];
175 /(^https?\:\/\/)?(.*)/.test(url);
176
177 completeUrl = RegExp.$1 + username + ':' + password + '@' + RegExp.$2;
178 }
179
180 window.open(completeUrl, this.target());
181 },
182
183 //=============================================================================
184
185 'runDirectLogin': function (aWindow) {
186 var deferredResult;
187
188//console.log(">>> runDirectLogin");
189 deferredResult = new Clipperz.Async.Deferred("DirectLoginRunner.openDirectLogin", {trace:false});
190 deferredResult.addMethod(this, 'initialWindowSetup', aWindow);
191 deferredResult.addMethod(this.directLogin(), 'label');
192 deferredResult.addMethod(this, 'updateWindowWithDirectLoginLabel', aWindow);
193 deferredResult.collectResults({
194 'type': MochiKit.Base.method(this.directLogin(), 'type'),
195 'label': MochiKit.Base.method(this.directLogin(), 'label'),
196 'formAttributes':MochiKit.Base.method(this.directLogin(), 'formAttributes'),
197 'inputValues': MochiKit.Base.method(this.directLogin(), 'inputValues')
198 });
199//deferredResult.addCallback(function (aValue) { console.log("SOME ATTRIBUTES", aValue); return aValue; });
200 deferredResult.addCallback(MochiKit.Base.bind(function (someAttributes) {
201//console.log("SOME ATTRIBUTES", someAttributes);
202 switch (someAttributes['type']) {
203 case 'http_auth':
204 this.runHttpAuthDirectLogin(aWindow, someAttributes);
205 break;
206 case 'simple_url':
207 this.runSimpleUrlDirectLogin(aWindow, someAttributes);
208 break;
209 default:
210 this.runSubmitFormDirectLogin(aWindow, someAttributes);
211 break;
212 }
213 }, this));
214 deferredResult.callback();
215//console.log("<<< runDirectLogin");
216
217 return deferredResult;
218 },
219
220 //=============================================================================
221
222 'run': function () {
223 var newWindow;
224
225 newWindow = window.open(Clipperz.PM.Strings.getValue('directLoginJumpPageUrl'), this.target());
226
227 return this.runDirectLogin(newWindow);
228 },
229
230 //=============================================================================
231
232 'test': function () {
233 var iFrame;
234 var newWindow;
235
236 iFrame = MochiKit.DOM.createDOM('iframe');
237 MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, iFrame);
238
239 newWindow = iFrame.contentWindow;
240
241 return this.runDirectLogin(newWindow);
242 },
243
244 //=============================================================================
245 __syntaxFix__: "syntax fix"
246});
247
248//-----------------------------------------------------------------------------
249
250Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.openDirectLogin = function (aDirectLogin) {
251 varrunner;
252
253 runner = new Clipperz.PM.UI.Common.Controllers.DirectLoginRunner({directLogin:aDirectLogin});
254 return runner.run();
255};
256
257//-----------------------------------------------------------------------------
258
259Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.testDirectLogin = function (aDirectLogin) {
260 varrunner;
261
262//console.log(">>>>>> TESTING DIRECT LOGIN");
263 runner = new Clipperz.PM.UI.Common.Controllers.DirectLoginRunner({directLogin:aDirectLogin});
264 return runner.test();
265};
266
267//-----------------------------------------------------------------------------
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js
new file mode 100644
index 0000000..a4fa400
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js
@@ -0,0 +1,143 @@
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.Controllers');
30
31Clipperz.PM.UI.Common.Controllers.ProgressBarController = function(args) {
32 args = args || {};
33
34 this._numberOfSteps= 0;
35 this._currentStep= 0;
36
37 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'initProgress', this, 'initProgressHandle');
38 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'updateProgress',this, 'updateProgressHandle');
39 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'advanceProgress',this, 'advanceProgressHandle');
40 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'progressDone', this, 'progressDoneHandle');
41
42 return this;
43}
44
45MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.ProgressBarController.prototype, {
46
47 'toString': function() {
48 return "Clipperz.PM.UI.Common.Controllers.ProgressBarController";
49 },
50
51 //-----------------------------------------------------------------------------
52
53 'numberOfSteps': function() {
54 return this._numberOfSteps;
55 },
56
57 'setNumberOfSteps': function (aValue) {
58 this._numberOfSteps = aValue;
59 },
60
61 'updateNumberOfSteps': function (aValue) {
62 this._numberOfSteps += aValue;
63 },
64
65 //-----------------------------------------------------------------------------
66
67 'currentStep': function() {
68 return this._currentStep;
69 },
70
71 'advanceCurrentStep': function () {
72 this._currentStep ++;
73 },
74
75 //-----------------------------------------------------------------------------
76
77 'completedPercentage': function () {
78 var result;
79//Clipperz.log(">>> completedPercentage" + this.currentStep() + "/" + this.numberOfSteps(), this.currentStep() / this.numberOfSteps());
80 if (this.numberOfSteps() == 0) {
81 result = 0;
82 } else {
83 result = (Math.min(100, 100 * (this.currentStep() / this.numberOfSteps())));
84 }
85//Clipperz.log("<<< completedPercentage", result);
86 return result;
87 },
88
89 //-----------------------------------------------------------------------------
90
91 'resetStatus': function () {
92 this._numberOfSteps= 0;
93 this._currentStep= 0;
94 },
95
96 //-----------------------------------------------------------------------------
97
98 'updateProgress': function () {
99//Clipperz.log(">>> updateProgress: " + this.completedPercentage() + "%");
100 MochiKit.Signal.signal(this, 'updateProgress', this.completedPercentage());
101 },
102
103 //=============================================================================
104
105 'initProgressHandle': function (anEvent) {
106//Clipperz.log(">>> initProgressHandle - steps: " + (anEvent != null ? anEvent['steps'] : 0));
107 this.resetStatus();
108 if (anEvent != null) {
109 this.setNumberOfSteps(anEvent['steps']);
110 }
111 MochiKit.Signal.signal(this, 'initProgress');
112 this.updateProgress();
113 },
114
115 //.............................................................................
116
117 'updateProgressHandle': function (anEvent) {
118 this.updateNumberOfSteps(anEvent['extraSteps']);
119//Clipperz.log("=== updateProgressHandle - steps: " + this.numberOfSteps() + " (extra " + anEvent['extraSteps'] + ")");
120 this.updateProgress();
121 },
122
123 //.............................................................................
124
125 'advanceProgressHandle': function (anEvent) {
126 this.advanceCurrentStep();
127//Clipperz.log("--- advanceProgressHandle: " + this.currentStep() + "/" + this.numberOfSteps());
128 this.updateProgress();
129 },
130
131 //.............................................................................
132
133 'progressDoneHandle': function (anEvent) {
134//Clipperz.log("<<< progressDoneHandle: " + this.currentStep() + "/" + this.numberOfSteps());
135 this.resetStatus();
136 MochiKit.Signal.signal(this, 'progressDone');
137 },
138
139 //=============================================================================
140 __syntaxFix__: "syntax fix"
141});
142
143Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController = new Clipperz.PM.UI.Common.Controllers.ProgressBarController();
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js
new file mode 100644
index 0000000..fbc5929
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js
@@ -0,0 +1,188 @@
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.Controllers');
30
31Clipperz.PM.UI.Common.Controllers.TabPanelController = function(args) {
32 args = args || {};
33
34 this._component = args.component;
35 this._configuration = args.configuration;
36 this._isEnabled = args.enabled || true;
37
38 this._selectedTab = null;
39 return this;
40}
41
42MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.TabPanelController.prototype, {
43
44 'toString': function() {
45 return "Clipperz.PM.UI.Common.Controllers.TabPanelController";
46 },
47
48 //-----------------------------------------------------------------------------
49
50 'component': function() {
51 return this._component;
52 },
53
54 'configuration': function() {
55 return this._configuration;
56 },
57
58 //-----------------------------------------------------------------------------
59
60 'getElement': function(anElementID) {
61 return this.component().getElement(anElementID);
62 },
63
64 'tabForTabElement': function(anElement) {
65 varresult;
66
67 for (result in this.configuration()) {
68 if (this.getElement(this.configuration()[result]['tab']) == anElement) {
69 break;
70 }
71 }
72
73 return result;
74 },
75
76 //-----------------------------------------------------------------------------
77
78 'setupTab': function(aConfiguration) {
79 vartabElement;
80
81 tabElement = this.getElement(aConfiguration['tab']);
82
83 MochiKit.DOM.removeElementClass(tabElement, 'selected');
84 MochiKit.Signal.connect(tabElement, 'onclick', this, 'handleTabClick')
85 },
86
87 'setupPanel': function(aConfiguration) {
88 this.hidePanel(aConfiguration['panel']);
89 },
90
91 'setup': function(args) {
92 args = args || {};
93
94 MochiKit.Base.map(MochiKit.Base.method(this, 'setupTab'),MochiKit.Base.values(this.configuration()));
95 MochiKit.Base.map(MochiKit.Base.method(this, 'setupPanel'),MochiKit.Base.values(this.configuration()));
96 this.selectTab(args.selected);
97 },
98
99 //-----------------------------------------------------------------------------
100
101 'hidePanel': function(aPanel) {
102 MochiKit.DOM.removeElementClass(this.getElement(aPanel), 'selected');
103 },
104
105 'selectTab': function(aTab) {
106 if ((aTab != this.selectedTab()) && (this.isEnabled())) {
107 if (this.selectedTab() != null) {
108 MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[this.selectedTab()]['tab']),'selected');
109 MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[this.selectedTab()]['panel']),'selected');
110 }
111
112 if (aTab != null) {
113 MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTab]['tab']),'selected');
114 MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTab]['panel']),'selected');
115 }
116
117 this.setSelectedTab(aTab);
118 MochiKit.Signal.signal(this, 'tabSelected', aTab);
119 }
120 },
121
122 //-----------------------------------------------------------------------------
123
124 'selectedTab': function() {
125 return this._selectedTab;
126 },
127
128 'setSelectedTab': function(aTab) {
129 this._selectedTab = aTab;
130 },
131
132 //-----------------------------------------------------------------------------
133
134 'selectedTabElement': function() {
135 var result;
136
137 if (this.selectedTab() != null) {
138 result = this.getElement(this.configuration()[this.selectedTab()]['tab']);
139 } else {
140 result = null;
141 }
142
143 return null;
144 },
145
146 'selectedTabPanelElement': function() {
147 var result;
148
149 if (this.selectedTab() != null) {
150 result = this.getElement(this.configuration()[this.selectedTab()]['panel']);
151 } else {
152 result = null;
153 }
154
155 return result;
156 },
157
158 //-----------------------------------------------------------------------------
159
160 'handleTabClick': function(anEvent) {
161 this.selectTab(this.tabForTabElement(anEvent.src()));
162 anEvent.preventDefault();
163 },
164
165 //=============================================================================
166
167 'isEnabled': function () {
168 return this._isEnabled;
169 },
170
171 'enable': function () {
172 this._isEnabled = true;
173 MochiKit.Base.map(MochiKit.Base.bind(function (aTabComponentID) {
174 MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[aTabComponentID]['tab']), 'disabled');
175 }, this), MochiKit.Base.keys(this.configuration()));
176 },
177
178 'disable': function () {
179 this._isEnabled = false;
180 MochiKit.Base.map(MochiKit.Base.bind(function (aTabComponentID) {
181 MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTabComponentID]['tab']), 'disabled');
182 }, this), MochiKit.Base.keys(this.configuration()));
183 },
184
185 //=============================================================================
186
187 __syntaxFix__: "syntax fix"
188});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js
new file mode 100644
index 0000000..868cea6
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js
@@ -0,0 +1,31 @@
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 //Still empty, but here it should be reasonable to factor in code duplicated between
30 //- DirectLoginWizardController
31 //- NewUserWizardController \ No newline at end of file
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Compact/MainController.js b/frontend/gamma/js/Clipperz/PM/UI/Compact/MainController.js
new file mode 100644
index 0000000..22258f6
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Compact/MainController.js
@@ -0,0 +1,59 @@
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.Compact');
30
31Clipperz.PM.UI.Compact.MainController = function() {
32 //this._loginPanel = null;
33 //this._user = null;
34//
35 //this._isRunningCompact = false;
36 //
37 //Clipperz.NotificationCenter.register(null, 'userConnected', this, 'userConnectedCallback');
38 //Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler');
39//
40 //Clipperz.NotificationCenter.register(null, 'EXCEPTION', this, 'reportException');
41
42 return this;
43}
44
45MochiKit.Base.update(Clipperz.PM.UI.Compact.MainController.prototype, {
46
47 'toString': function() {
48 return "Clipperz.PM.UI.Compact.MainController";
49 },
50
51 //-----------------------------------------------------------------------------
52
53 'run': function(shouldShowRegistrationForm) {
54MochiKit.Logging.logDebug("running " + this.toString());
55 },
56
57 //-----------------------------------------------------------------------------
58 __syntaxFix__: "syntax fix"
59}); \ No newline at end of file
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});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardDetail.js b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardDetail.js
new file mode 100644
index 0000000..23fd236
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardDetail.js
@@ -0,0 +1,166 @@
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.iPhone.Components');
30
31Clipperz.PM.UI.iPhone.Components.CardDetail = function(args) {
32 args = args || {};
33
34 Clipperz.PM.UI.iPhone.Components.CardDetail.superclass.constructor.apply(this, arguments);
35
36 this._cardReference = null;
37
38 return this;
39}
40
41//=============================================================================
42
43Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.CardDetail, Clipperz.PM.UI.Common.Components.BaseComponent, {
44
45 //-------------------------------------------------------------------------
46
47 'toString': function () {
48 return "Clipperz.PM.UI.iPhone.Components.CardDetail component";
49 },
50
51 //-------------------------------------------------------------------------
52
53 'cardReference': function () {
54 return this._cardReference;
55 },
56
57 'setCardReference': function (aValue) {
58 this._cardReference = aValue;
59 },
60
61 //-------------------------------------------------------------------------
62
63 'renderSelf': function(/*aContainer, aPosition*/) {
64 this.append(this.element(), [
65 {tag:'div', cls:'cardDetail', id:this.getId('cardDetail'), children:[
66 {tag:'div', id:this.getId('progressBar')} //,
67 // {tag:'h1', cls:'loading', html:"loading"}
68 ]}
69 ]);
70
71 this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')}));
72 MochiKit.Signal.signal(Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController, 'updateProgress', 0);
73 },
74
75 //=========================================================================
76
77 'showCardDetails': function (someData) {
78 this.element().innerHTML = '';
79 this.append(this.element(), [
80 {tag:'fieldset', id:this.getId('fields'), children:MochiKit.Base.map(function (aFieldData) {
81 return {tag:'div', cls:'row', children:[
82 {tag:'label', html:aFieldData['label']},
83 // {tag:'span', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), html:aFieldData['value']}
84 {tag:'div', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), children:[
85 {tag:'div', children:[{tag:'p', html:aFieldData['value']}]}
86 ]}
87 // {tag:'input', type:'text', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), value:aFieldData['value'], disabled:true}
88
89 ]}
90 }, someData['fields'])}
91 ]);
92
93 MochiKit.Iter.forEach(MochiKit.Selector.findChildElements(this.element(), ['span.password']), MochiKit.Base.bind(function (aPasswordElement) {
94 MochiKit.Signal.connect(aPasswordElement, 'onclick', function (anEvent) { alert(MochiKit.DOM.scrapeText(anEvent.src())); })
95 }, this));
96
97 if (someData['directLogins'].length > 0) {
98 this.append(this.element(), [
99 {tag:'h2', html:"Direct logins"},
100 {tag:'fieldset', id:this.getId('directLogins'), children:MochiKit.Base.map(function (aDirectLoginData) {
101 return {tag:'div', cls:'row', id:('directLogin_' + aDirectLoginData['_reference']), children:[
102 {tag:'img', cls:'favicon', src:aDirectLoginData['favicon']},
103 // {tag:'input', cls:'directLogin', disabled:'disabled', type:'text', name:aDirectLoginData['label'], value:aDirectLoginData['label']}
104 {tag:'span', cls:'directLogin', html:aDirectLoginData['label']}
105 ]}
106 }, someData['directLogins'])}
107 ]);
108
109 MochiKit.Base.map(MochiKit.Base.bind(function (aRowNode) {
110 MochiKit.Signal.connect(aRowNode, 'onclick', this, 'directLoginClickHandler');
111 }, this),
112 MochiKit.Selector.findChildElements(this.getElement('directLogins'), ['div.row'])
113 )
114 };
115
116 if (someData['notes'] != '') {
117 this.append(this.element(), [
118 {tag:'h2', html:"Notes"},
119 {tag:'fieldset', id:this.getId('fieldset'), children:[
120 {tag:'div', cls:'row notes', children:[
121 {tag:'span', html:someData['notes']}
122 ]}
123 ]}
124 ]);
125 };
126
127 return true;
128 },
129
130 //-------------------------------------------------------------------------
131/*
132 'toggleClickHandler': function (anEvent) {
133 varnextState;
134 varfieldValue;
135
136//console.log("TOGGLE");
137 anEvent.preventDefault;
138 fieldValue = MochiKit.Selector.findChildElements(anEvent.src().parentNode.parentNode, ['span.password'])[0];
139
140 nextState = (MochiKit.DOM.getNodeAttribute(anEvent.src(), 'toggled') != 'true');
141 if (nextState) {
142 MochiKit.DOM.removeElementClass(fieldValue, 'clear');
143 } else {
144 MochiKit.DOM.addElementClass(fieldValue, 'clear');
145 }
146
147 MochiKit.DOM.setNodeAttribute(anEvent.src(), 'toggled', nextState);
148 },
149*/
150 //=========================================================================
151
152 'directLoginClickHandler': function (anEvent) {
153 anEvent.preventDefault();
154
155 if (/(directLogin_)/.test(anEvent.src().id)) {
156 var directLoginReference;
157
158 directLoginReference = anEvent.src().id.match(/(directLogin_)(.*)/)[2];
159 MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'selectedDirectLogin', {cardReference:this.cardReference(), directLoginReference:directLoginReference});
160 }
161 },
162
163 //=========================================================================
164
165 __syntaxFix__: "syntax fix"
166});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardList.js b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardList.js
new file mode 100644
index 0000000..770f983
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardList.js
@@ -0,0 +1,204 @@
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.iPhone.Components');
30
31Clipperz.PM.UI.iPhone.Components.CardList = function(args) {
32 args = args || {};
33
34 Clipperz.PM.UI.iPhone.Components.CardList.superclass.constructor.apply(this, arguments);
35
36 this._cardDetail = null;
37
38 return this;
39}
40
41//=============================================================================
42
43Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.CardList, Clipperz.PM.UI.Common.Components.BaseComponent, {
44
45 //-------------------------------------------------------------------------
46
47 'toString': function () {
48 return "Clipperz.PM.UI.iPhone.Components.CardList component";
49 },
50
51 //-------------------------------------------------------------------------
52
53 'renderSelf': function(/*aContainer, aPosition*/) {
54 this.append(this.element(), [
55 {tag:'div', cls:'toolbar', id:'toolbar', children:[
56 {tag:'h1', id:'pageTitle', html:"cards"},
57 {tag:'a', id:'backButton', cls:'button', href:'#', html:"cards"}
58 ]},
59 {tag:'div', cls:'cardList', id:this.getId('cardList'), children:[
60 {tag:'form', title:'search', cls:'panel cardListSearchForm', id:this.getId('cardListSearchForm'), children:[
61 {tag:'input', type:'search', name:'search', value:"", placeholder:"search", id:this.getId('searchField')}
62 ]},
63 {tag:'ul', cls:'panel cardListPanel', id:this.getId('cardListPanel'), children:[]}
64 ]},
65 {tag:'div', cls:'panel cardDetailPanel', id:this.getId('cardDetail')}
66 ]);
67
68 MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onsubmit', this,'searchHandler');
69 MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeydown', this,'searchHandler');
70 MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeyup', this,'searchHandler');
71
72 MochiKit.Signal.connect(this.getElement('cardListPanel'), 'onclick', this,'cardListClickHandler');
73 MochiKit.Signal.connect('backButton', 'onclick', this,'backButtonClickHandler');
74
75 MochiKit.Style.hideElement('backButton');
76 MochiKit.Style.hideElement(this.getElement('cardDetail'));
77 },
78
79 //-------------------------------------------------------------------------
80
81 'searchHandler': function (anEvent) {
82 if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { //RETURN
83 anEvent.preventDefault();
84 } else {
85 if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ESCAPE')) {
86 anEvent.target().value = "";
87 }
88
89 if (anEvent.type() == 'keyup') {
90 MochiKit.Signal.signal(this, 'searchEvent', anEvent.target().value);
91 }
92 }
93 },
94
95 //-------------------------------------------------------------------------
96
97 'update': function (someObjects) {
98 varcardListPanel;
99 var i,c;
100
101 cardListPanel = this.getElement('cardListPanel');
102 cardListPanel.innerHTML = '';
103
104 c = someObjects.length;
105
106 for (i=0; i<c; i++) {
107 this.append(cardListPanel, {tag:'li', cls:'cardListItem', id:('cardListItem_' + someObjects[i]['_reference']), children:[
108 {tag:'img', src:(someObjects[i]['favicon'] ? someObjects[i]['favicon'] : 'data:application/octet-stream;charset=utf-8;base64,AAABAAEAFxcAAAEAGAD8BgAAFgAAACgAAAAXAAAALgAAAAEAGAAAAAAAAAAAABIXAAASFwAAAAAAAAAAAAD///////////////////////////////////////////////////////////////////////////////////////////9zAC////////////////////////////////////////////////////////////////////////////////////////////9pAG////////////////////////////////////////////////////////////////////////////////////////////9rAC////////////////////////////////////////////////////////////////////////////////////////////9yAHP////////////////////////IyMizs7O6urrq6ur////////////Ozs6zs7Ozs7Pq6ur///////////////////////8AAAD////////////////////V1dWXl5eXl5eXl5elpaX4+Pj////Ozs6Xl5eXl5eXl5eenp7///////////////////////8AAAD////////////////////Ozs6Xl5eXl5eXl5eXl5fBwcHq6uqenp6Xl5eXl5eXl5eXl5f///////////////////////8AAAD////////////////////j4+OXl5eXl5eXl5eXl5eXl5elpaWXl5eXl5eXl5eXl5ezs7P///////////////////////8AAAD////////////////////////IyMiXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eenp7x8fH////////////////////////////////////////////////////4+PilpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5fOzs7////////////////////////////////////////////////////////q6uq6urqXl5eXl5eXl5eXl5eXl5eXl5eenp7V1dX4+Pj///////////////////////8AAAD////////////4+PjOzs6lpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5e6urrj4+P///////////////8AAAD////////////BwcGXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fx8fH///////////8AAAD///////////+zs7OXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fj4+P///////////8AAAD////////////IyMiXl5eXl5eXl5eXl5e6urqXl5eXl5eXl5eXl5esrKylpaWXl5eXl5eXl5eenp7x8fH///////////8AAAD////////////////Ozs7Ozs7V1dX4+Pj///+Xl5eXl5eXl5eXl5fOzs7////q6urOzs7Ozs7q6ur///////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD////////////////////////////////////IyMiXl5eXl5eenp7x8fH///////////////////////////////////8AAAD////////////////////////////////////////j4+Pj4+Px8fH///////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAo=')},
109 {tag:'a', id:('cardListReference_' + someObjects[i]['_reference']), href:'#', html:someObjects[i]['label']}
110 ]})
111
112 MochiKit.Signal.connect('cardListItem_' + someObjects[i]['_reference'], 'onclick', this, 'cardListClickHandler');
113 }
114
115 },
116
117 'cardListClickHandler': function (anEvent) {
118 anEvent.preventDefault();
119
120 if (/(cardListReference_|cardListItem_)/.test(anEvent.target().id)) {
121 var cardListReference;
122
123 cardListReference = anEvent.target().id.match(/(cardListReference_|cardListItem_)(.*)/)[2];
124//console.log("Showing detail for card named", cardListReference);
125 MochiKit.Signal.signal(this, 'selectedCard', cardListReference);
126 }
127 },
128
129 //=========================================================================
130
131 'cardDetail': function (someData) {
132 if (this._cardDetail == null) {
133 this._cardDetail = new Clipperz.PM.UI.iPhone.Components.CardDetail({element:this.getElement('cardDetail')});
134 }
135
136 return this._cardDetail;
137 },
138
139 //-------------------------------------------------------------------------
140
141 'removeCardDetail': function () {
142 if (this._cardDetail != null) {
143 this._cardDetail.remove();
144 this._cardDetail = null;
145 }
146 },
147
148 //=========================================================================
149
150 'showCard': function (someData) {
151 vardeferredResult;
152 varoffset;
153
154 offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480);
155 this.cardDetail().render();
156 this.cardDetail().setCardReference(someData['_reference']);
157 MochiKit.Style.setElementPosition(this.cardDetail().element(), {x:offset});
158 new MochiKit.Visual.Sequence([
159 // new MochiKit.Visual.Move(this.cardDetail().element(), {x:offset, y:45, mode:'absolute', duration:0, sync:true}),
160 new MochiKit.Visual.Parallel([
161 new MochiKit.Visual.Move(this.getElement('cardList'), {x:-offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}),
162 new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:0, y:45, mode:'absolute',transition:MochiKit.Visual.Transitions.linear, sync:true}),
163 // new MochiKit.Visual.ScrollTo('toolbar', {sync:true}),
164 MochiKit.Visual.appear ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true})
165 ], {duration:1, sync:true}),
166 MochiKit.Visual.fade(this.getElement('cardList'), {duration:0, sync:true})
167 ], {})
168
169 MochiKit.DOM.getElement('pageTitle').innerHTML = someData['title'];
170
171 return true;
172 },
173
174 //-------------------------------------------------------------------------
175
176 'showCardDetails': function (someData) {
177 return this.cardDetail().showCardDetails(someData);
178 },
179
180 //=========================================================================
181
182 'backButtonClickHandler': function (anEvent) {
183 varoffset;
184
185 anEvent.preventDefault();
186
187 MochiKit.DOM.getElement('pageTitle').innerHTML = "cards";
188
189 offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480);
190 MochiKit.Style.setElementPosition(this.getElement('cardList'), {x:-offset});
191 MochiKit.DOM.showElement(this.getElement('cardList'));
192
193 new MochiKit.Visual.Parallel([
194 new MochiKit.Visual.Move(this.getElement('cardList'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}),
195 new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}),
196 MochiKit.Visual.fade (this.getElement('cardDetail'), { transition:MochiKit.Visual.Transitions.linear, sync:true}),
197 MochiKit.Visual.fade ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true})
198 ], {duration:1, afterFinish:MochiKit.Base.method(this, 'removeCardDetail')})
199
200 },
201
202 //=========================================================================
203 __syntaxFix__: "syntax fix"
204});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js
new file mode 100644
index 0000000..eec83b0
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js
@@ -0,0 +1,181 @@
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.iPhone.Components');
30
31Clipperz.PM.UI.iPhone.Components.LoginForm = function(args) {
32 args = args || {};
33
34 Clipperz.PM.UI.iPhone.Components.LoginForm.superclass.constructor.apply(this, arguments);
35
36 return this;
37}
38
39//=============================================================================
40
41Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, {
42
43 //-------------------------------------------------------------------------
44
45 'toString': function () {
46 return "Clipperz.PM.UI.iPhone.Components.LoginForm component";
47 },
48
49 //-------------------------------------------------------------------------
50
51 'focusOnUsername': function () {
52 this.getElement('username').focus();
53 },
54
55 //-------------------------------------------------------------------------
56
57 'username': function () {
58 return this.getElement('username').value;
59 },
60
61 'passphrase': function () {
62 return this.getElement('passphrase').value;
63 },
64
65 //-------------------------------------------------------------------------
66
67 'renderSelf': function(/*aContainer, aPosition*/) {
68 this.append(this.element(), [
69 {tag:'div', cls:'toolbar iPhoneClipperzToolbar', children:[
70 {tag:'h1', id:'pageTitle', html:'Clipperz'},
71 {tag:'a', id:'backButton', cls:'button', href:'#', html:"back"}
72 ]},
73 {tag:'form', title:'Theaters', cls:'panel toolbarlessPanel loginForm', id:this.getId('loginFormPanel'), children:[
74 {tag:'fieldset', id:this.getId('fieldset'), children:[
75 {tag:'div', cls:'row', children:[
76 {tag:'label', html:"username"},
77 {tag:'input', type:'text', name:'username', value:"", autocorrect:'off', autocapitalize:'off', id:this.getId('username')}
78 ]},
79 {tag:'div', cls:'row', children:[
80 {tag:'label', html:"passphrase"},
81 {tag:'input', type:'password', name:'passphrase', value:"", id:this.getId('passphrase')}
82 ]}
83 ]},
84 {tag:'a', cls:'whiteButton', type:'submit', href:'#', html:"Login", id:this.getId('submit')}
85 ]},
86 {tag:'div', cls:'panel toolbarlessPanel loginProgressPanel', id:this.getId('loginProgressPanel'), children:[
87 {tag:'div', id:this.getId('progressBar')} //,
88 // {tag:'a', cls:'whiteButton', type:'submit', href:'#', html:"Cancel", id:this.getId('cancel')}
89 ]},
90 {tag:'div', cls:'panel loginErrorPanel', id:this.getId('loginErrorPanel'), children:[
91 {tag:'div', cls:'errorMessage', id:this.getId('errorMessageBox'), children:[
92 {tag:'h2', id:this.getId('errorMessage'), html:"Login failed"}
93 ]}
94 ]}
95 ]);
96
97 MochiKit.Signal.connect(this.getElement('submit'), 'onclick',this, 'submitHandler');
98 MochiKit.Signal.connect(this.getElement('loginFormPanel'), 'onsubmit',this, 'submitHandler');
99
100 // MochiKit.Signal.connect(this.getElement('cancel'), 'onclick',this, 'cancelHandler');
101 MochiKit.Signal.connect('backButton', 'onclick',this, 'backHandler');
102
103 this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')}));
104
105 // MochiKit.Style.hideElement(this.getElement('errorMessage'));
106
107 this.showLoginForm();
108 // MochiKit.Async.callLater(0.2, MochiKit.Base.method(this, 'focusOnUsername'));
109 },
110
111 //-------------------------------------------------------------------------
112
113 'showLoginForm': function () {
114 MochiKit.Style.showElement(this.getElement('loginFormPanel'));
115 MochiKit.Style.hideElement(this.getElement('loginProgressPanel'));
116 MochiKit.Style.hideElement(this.getElement('loginErrorPanel'));
117 MochiKit.Style.hideElement('backButton');
118 },
119
120 'slideInLoginForm': function () {
121 varoffset;
122
123 offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480);
124
125 MochiKit.Style.showElement(this.getElement('loginFormPanel'));
126 MochiKit.Style.setElementPosition(this.getElement('loginFormPanel'), {x:-offset, y:0});
127
128 new MochiKit.Visual.Sequence([
129 new MochiKit.Visual.Parallel([
130 new MochiKit.Visual.Move(this.getElement('loginErrorPanel'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}),
131 new MochiKit.Visual.Move(this.getElement('loginFormPanel'), {x:0, y:0, mode:'absolute',transition:MochiKit.Visual.Transitions.linear, sync:true}),
132 MochiKit.Visual.fade ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true})
133 ], {duration:0.5, sync:true}),
134 MochiKit.Visual.fade(this.getElement('loginErrorPanel'), {duration:0, sync:true})
135 ], {})
136 },
137
138 'showLoginProgress': function () {
139 MochiKit.Style.hideElement(this.getElement('loginFormPanel'));
140 MochiKit.Style.showElement(this.getElement('loginProgressPanel'));
141 },
142
143 'showLoginError': function (anError) {
144 this.getElement('errorMessage').innerHTML = "Login error";
145
146 MochiKit.Style.showElement('backButton');
147 MochiKit.Style.hideElement(this.getElement('loginProgressPanel'));
148 MochiKit.Style.showElement(this.getElement('loginErrorPanel'));
149 MochiKit.Style.setElementPosition(this.getElement('loginErrorPanel'), {x:0, y:45});
150 },
151
152 //-------------------------------------------------------------------------
153/*
154 'disableCancelButton': function () {
155 MochiKit.DOM.hideElement(this.getElement('cancel'));
156 },
157*/
158 //-------------------------------------------------------------------------
159
160 'submitHandler': function (anEvent) {
161 anEvent.preventDefault();
162
163 MochiKit.Signal.signal(this, 'doLogin', {'username':this.username(), 'passphrase':this.passphrase()});
164 },
165
166 'cancelHandler': function (anEvent) {
167 anEvent.preventDefault();
168
169//console.log("CANCEL");
170 },
171
172 'backHandler': function (anEvent) {
173 anEvent.preventDefault();
174
175 this.slideInLoginForm();
176 },
177
178 //-------------------------------------------------------------------------
179
180 __syntaxFix__: "syntax fix"
181});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Controllers/MainController.js b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Controllers/MainController.js
new file mode 100644
index 0000000..b43d877
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Controllers/MainController.js
@@ -0,0 +1,372 @@
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.iPhone.Controllers');
30
31 //Some parts of this controller have been derived from the iUI library.
32
33Clipperz.PM.UI.iPhone.Controllers.MainController = function() {
34 this._loginForm = null;
35 this._cardList = null;
36 this._cachedValues =null;
37 this._user = null;
38
39 if (typeof window.onorientationchange == 'object') {
40 MochiKit.Signal.connect(window, 'onorientationchange', this, 'orientationChangeHandler');
41 MochiKit.Async.callLater(0, MochiKit.Base.method(this, 'orientationChangeHandler'));
42 } else {
43 this.setOrientation('portrait');
44 // this.setOrientation('landscape');
45 }
46
47 this.addMetaTag('viewport', 'width=devicewidth; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;');
48 this.addMetaTag('apple-mobile-web-app-capable', 'yes');
49 this.addMetaTag('apple-mobile-web-app-status-bar-style', 'black');
50
51 this.addLinkTag('apple-touch-icon', 'data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAF8AAABfCAYAAACOTBv1AAAACXBIWXMAAAsTAAALEwEAmpwYAAAQC0lEQVR4nO2ce3wU1b3AvzOzz2TzBpKQhIS3CnLxgYoPqAgiQS8igiAqiFprtT571YpKUa9tvVgrVvhc7IXS4lUUvGgR5CWIoiAIYoQgJGDI+0k2yW42szNz7h8pGBHIPmazqeb7+UD4DHt+vzPfPTnnzJkzIwGCLqKCHO0K/JTpkh9FuuRHkS75UaRLfhTpkh9FuuRHkS75UaRLfhTpkh9FLNGuwKnIzc3l9WXLQAIhQILWvwQnjn3vUNtjkoQQ4kSZr77KY+TIkR1/EgHQKeWnp6eTkJiI0P2gqyeOnxD7T+ttxf/wp4SwOOnTp0/UzqM9OqV8oFXygSVIm3/xvePSKf59up/cWfO9z3c2OnmfH646qVMv2XZa+RKtrT8cWruoztv2O6384/15OLSODZ237Xda+W1nMKEiROe+U9Rp5ZtFJ+51Oq/8E/P7MOjE3oFOLL/1Iik8fUJoCF03pT6RoNPKF4Q/2zF0P0J0yQ8aM/pqoesIXQs/UITotPKFYRDuXMXQ/dDV8oNECIShgRGmOKFjGIY5dYoAnVK+QCB0DSNM+Ybmb/0SOylhy8/NzWXYsGFm1OU7hGhd0RThtdrW2Y758kdcdhGLX30h7Dhhr2ouWrSI9PQ0ykrLeHn+fBYsWIDX6w0zqsAwNOQwW77QtbBnTMdJSkzgkfvuZPqkXOJi7SAMLhl2Htt37gk5ZlgtPycnh7TU7oiGo6TH6zz/3DPUVpXz3qp3+Lch54YeWLR2OyLcbkcPf9wY/bNL2fjuMg7uWM09t11PnE1FaSwADB65746wYofV8ufMeQph6MhfvoT09atIWWORBt7GNaOv5urRWyktLeWll//MXxb/FZ/PF3BcgcDQVeRwux1DQxjBz1m7JSfx2IM/Z/J1Y3A5LUiShFK3G3vpWuwVW9Bjs6i/eCGXnjcgrPqF1fJzrxkLuopUuAJJGMhH12LZMA3LG2ej7JxDZmwT//W7uVSVFPDW/y5l4ID+gQUWAmHo4V8g6VrAA64kSYwfM5It//g7+z9Zye2TxxJPDY7CpSRsnUrCzgdwlH2AZPiwNB5CajyMYqjkjhkRcvVCbvnnnzeUBJcDUbIFyVv+/RNprsKSNx/y5mP0uAS53zSuvWoc48duoqi4lD++vIC/vb4cVVVPHVyA0P1hLw0Yhh/EmU8xtXsyv3noHiaMu5xYmwXJ8GMr34ijfB3Wut2nvR3jKN9EU850fnXHNNZs2BpS/UKW/+QTj4GhIxe+fcbPyVXbsVVtR1ifRMueQE7fKbz0u6f5/dzfsGb9JuY8+wJHiopPKmXObAdDwzhFtyPLMhPGjeKRe2cyIDsVCYHiPoCjcB32qi3Imqfd0PaqrTRmTWFw31QURUbXg69ryPKvuOxihN+LXLQ6oM9L/kasBcuwFixDTzwbS+8buf6q8UwYu4bDR8t4cf5/8+bK99C01hmKOfP87/f5PdO6M/vhX3DdmOHYLTKyWo/92zdxlm/A4j0aVGyLrxzFfQDD1ZdpE8exbMX7QdcvJPmjR/2MWJuCVLIBSXUHXV6pz0fZ8yz2vS+gZYymX/ZEXvnDbOY99yjvrd1CwZFiU65wDd0PhsTUieN44O7p9E5PQhI6trrPcJavx1a7E4nQf7uc1Z/gj8nmjptCk39860tQrFu9ksuGDcX+6f1YioNPeir0mEzUrOtQs65FtyYhSWA7uorYr0O/mKm5/C0MJRYhDBRPEc6KjTirNiP7g28wp6yzNZHywfMQsoUBo+7C1+IPqnxILf+ioYMRaj1K2aZQip8SxVuC85uFOA4uwt/9EloyxkOYSwNSyzEcdRtxVm7C2lRoUk2/Q/HXY2vYj881kLumX88ri888/p1M0PKnTr4BRfKjHN2ApAc+dw8USejYqrZhq9qGkJSwYiXv+iVShFc1nXXbaXb2Ydq1VwQtP+h5/r13zUAYOpbiwAbacAhXXKTFA8S492BoPlLjBPGumKDKBiVfURQG9ctCeKuxVH0WVKIfK4rRjLMhD8lQeWDWpKDKBiX/njtngFCxlK7rkFb1r4KrYTeG5ue6kcGtZwUlf8bUCWBo2ErWBZXkx06MJx+hNZFg8dCzR1LA5QKWH+N0kpOeCJ4yLPVfhVTJHyuy0HA17Qeh8+Cs6wMvF+gHH77vTjA0JG85emx2SJX8saLJsaA3I3Q/V52fE3C5gKeaY6+6AmH4UV39qRu2EMVThL1qK47qj7F4S0Kp8780ftlFo3MATc6z8Fp6Ht/ZS0xiMg6bFZ/a/gVXwFe4TqeTqVMmMevm6zk7pwea9xhCGCAEFk8RjpptOGo/xdJcFuZpdV78sotGxwAanQNptvZEIJAkGUtiDnuLmnht+Xo2bNoS8E37kJYXYmNjmXbTjcy8aTwDMpLRmmtb1+CFQPEcIaZuB87a7VhaKoMN3enwy3E0OgfQYO9PsyWt1ZikYEnKIa+oidfe2sj6jZtD2iURkvy2uFwupk+9kRmTc+mT7kLz1CAMAQgsniPEHNtJzLGdWNTqcNJ0KKoST6O9Pw2O/visaQjDQJJlrEl9+KrYy+IVm/hg/YfoYd5vCFt+W+Lj47ll2mRuvWE02d0crV+EECAMbN4iYty7iKnfjcVfa1ZK01CVBBrs/Wi098dnTUUIA0lubeH7in0sXrmZNes2hi28LabKb0tCQgIzpk/h5glXkpko//OLaB0jbM1FxLh3E9uwF6t2LBLpA0JVEmiw9afB3heftUfrLjlZxprUm/wylSXvbOH9DzaiaZHZ+xMx+W1JSkpi5i1TuGn85fSMF2hNVSe6JntzEbGNe3E15WHRzFnqPRMtSiIN9n402Pris3RrHasAW3IfDlT4WfLOVlav3RAx4W3pEPltSUlJYdYtU5g8bjipMS2oDa2DclzDLlJrVkU0twCK4q7DY81AIGFP6UN+ucZfV33M6rUb8PuDW48Plw6X35aZU3J5YvowbGoVWRWvIYvItzZNclIQNxHVlsK4B/5OWXV9xHOejqjt1UzvkcRj04eD5iWtenmHiAewiGYyPZsQ3jqWzp2CIkdvu2pUMsuyxMo/3Y+keehRtxq7Vteh+V16Janql6RY3Lz48IQOzd2WqMh/dc7PSbJ6iG/cSUJzfjSqQKq2D5dWyuV9YPKYoVGpQ4fLv/Ga4YwY6MTmKyO1YUtHpz+BBORon2PVm3h0Yj/6ZAS+FGwWHSo/My2FObMuR9K8ZLjfRya6N2SsqPQWu8DvZsmjY3DYwrtnHCwdJl+WJd78w+2gNtKzaSN2I/Jz+kCI4xgZ4iBOo4ZFj4/v0NwdJn/h0zOJl9wkN+8lQT0cdjyBRAtOE2oGaVIRcUYF/WJr+NVkkx/0OAMdIn/KuEu4OBuc/nLSmneYErNc6k8hF2CY8KizJEFfy0FseJk2zMqFZ6WaUMP2ibj8XunJzJ42FFn3kOXdjBzG9rzjeIinzMjBI2IpNQLcdt4OVkljgO0QQvXw4syBxDkj3/9HVL4iyyx75iaMlnqyfNuwi/Z3/7aHISQO62cj2eOxxCRTbvTEbSSaUFuIUzxk24qR1RqWPnpFxF8XE1H5C2ZPxWXU0K1lP4lGqSkxS4zeeA0HGwqd/N8+G8IwKFD7429nH36gZDjqSJLrSDaKmDvjfFNino6IyZ86bhgXpHtxalVkGHmmxGw04inX0tESB/HEvGU8+6eluBOGoxoShS05puQAGOiqxI6XKzIqGHdRpmlxTyYi8nN6JvPrCX1QdC+99R2mvGxLFzIFLb2R7XHc+8cNJ54yvPnx17B0P4taNZZyNSXsPAAWWXBOQi3oXv7jaomMFLspcU/GdPkWRWbp7FyE6ibH2IMdczbTFqkZeDWZLSUp7N136MTx2to65r5xGMUWw2FPCh7dZkq+eJtG3zg3oqWEhXenYY3A+Gu6/AWPT8ShVtDDKCBRMue+bb3mosyXgEgewuPz3vjB/7+/8RN2egah6xr57m4YwpyBMivOoLsDnL6jvDjLnFlVW0yVf8v4CxmSXItL1JIlFZgSUxMyhzypWOxxPLjgs9PuEnjouSWQOQqPJlHYGGdKboCzUwQOBAMdBdx2lbn9v2ny+2amcN+YZBTdSz9ln2mv1zrs6YZPk9hWm80XeQdP+zld15n5n+uwJedQ0iRT4zOnn7DIMCQNEIKbB9UwqFesKXHBRPnzf/3vGC1udF3jmBZvSszaFgflXgei+1Aem9f+gwdHior5y45YJFmQX2vQYsK6nRBQ3dT6eJhQVZ672bzuxzT5D/75I6SMK9ENQaEvk2+8vdBE6OH9hsQ37ngUu5NH/+frgLdsLF6+nrKECbSosK86vDcUtmiwq0jiYIWEoUnY++by9HvhXygexzT5hwoOM+L2F9mnjES2u6huiWFPQ28aNEdI8Q7Wx9Ki+dnlGcyOPQeCKnvnb9/Gnn0NtR6ZohBv0dY0wceHJKobQFJiqO11K7lPbSRv/6H2CweIAvzWrGCGYfCPjds5ZhvAqGF98R4roaI5BgmDeKsa8DhQ6VU44jawpF3ILXM3BL0VT9M08sqtjD03luraerq7wB7gBbAQcLAS8opB80s4087hrbLBPPXKO6ZvJzFV/nHyDx7m3c+rmXDDJOT6/dSrFtwtFpLtLSjt/K6pOnxZJZBsCcxeBUUlVSHVoayyhoxBo+glDlHnEWQmgtzOl+9TYddhiZJaCYSM45wJ3Pu3YjZ8/EVIdWiPiC0vVFZWcvVd8/nUPxqrqzt1PoMdlQ5qfWdOub9Gwq9J7NNHsG1XcN3NyTy/8B18fabS2Az729k8XemGj/KhpkFCtrqoyJrO+CfX8E3Bt2HV4Ux0yL6dEZdewO9vTaO5cC1CCHrFCfom/bAlljbA/moJS/pljH1qhymbmJKTk1j50CCaDm/jwt6CtJMWQA0D8kuhsEJCGODKOpcl+d14/d0Pw87dHhHpdk6mqLicFZ9Ucc3E27A35lPv1anxQrKTE5ftPj98WS6BEscz66wcKTZne3lzs48q0rm0ZwsV1V4yUr7L6W2B7QehvFYCAc5zJ3H3kkNs3bHXlNzt0WG3Ed1uNzfcv4j368fh6H4Obi98+i2UN7QOcnnlEqoKB61XsvXz/abmXrt5B/tixtCiSuwuaM1XVgeb86DeI6M4Ezjaazrjn1zFkaKOe8omKtsFzx00kFd/eR6evOUgQYJdUN8sYc+8hHHPfnH69/CEgaIorHl+Es1fvU2yS3DMIyOEIC7nfBbujmXF2tDemRMOUdur6XA4WPDUbWRVr0D11CNbY5i3pzebPjNn7f9U9M7O5LWpyTSV5CFJYB08hbvmf0RpWUXEcp6JDunzT4Wmabz74ReIjBEMH9iNQwzhleWRbX317gbktCGcn6ZzICGX2597i4aGxojmbA8R7T/ZvTKF3W7rsHwDB/SL+jkDIqpbxH/qdMrX+f5U6JIfRbrkR5Eu+VGkS34U6ZIfRbrkR5Eu+VGkS34U6ZIfRbrkR5H/Bx8z6HmTXnicAAAAAElFTkSuQmCCCg==');
52 //this.addLinkTag('apple-touch-startup-image', 'default.png');
53
54 // if (!window.navigator.standalone)// not running as an installed app
55
56 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'selectedDirectLogin', this, 'selectedDirectLoginHandler');
57
58 MochiKit.DOM.addElementClass(document.body, 'iPhone');
59 return this;
60}
61
62MochiKit.Base.update(Clipperz.PM.UI.iPhone.Controllers.MainController.prototype, {
63
64 'toString': function () {
65 return "Clipperz.PM.UI.iPhone.Controllers.MainController";
66 },
67
68 //=========================================================================
69
70 'user': function () {
71 return this._user;
72 },
73
74 'setUser': function (aValue) {
75 this._user = aValue;
76 },
77
78 //=========================================================================
79
80 'loginForm': function() {
81 if (this._loginForm == null) {
82 MochiKit.DOM.removeElement('mainDiv');
83 this._loginForm = new Clipperz.PM.UI.iPhone.Components.LoginForm({element:MochiKit.DOM.currentDocument().body});
84 MochiKit.Signal.connect(this._loginForm, 'doLogin', this, 'doLoginHandler')
85 }
86
87 return this._loginForm;
88 },
89
90 'removeLoginForm': function () {
91 if (this._loginForm != null) {
92 this._loginForm.remove();
93 this._loginForm = null;
94 }
95 },
96
97 //-----------------------------------------------------------------------------
98
99 'cardList': function () {
100 if (this._cardList == null) {
101 this._cardList = new Clipperz.PM.UI.iPhone.Components.CardList({element:MochiKit.DOM.currentDocument().body});
102 MochiKit.Signal.connect(this._cardList, 'searchEvent',this, 'searchEventHandler')
103 MochiKit.Signal.connect(this._cardList, 'selectedCard',this, 'selecetedCardHandler')
104 }
105
106 return this._cardList;
107 },
108
109 //=========================================================================
110
111 'currentWidth': function () {
112 return this._currentWidth;
113 },
114
115 'setCurrentWidth': function (aValue) {
116 this._currentWidth = aValue;
117 },
118
119 //=========================================================================
120
121 'orientationChangeHandler': function () {
122 switch(window.orientation) {
123 case 0:
124 this.setOrientation('portrait');
125 break;
126 case 90:
127 case -90:
128 this.setOrientation('landscape');
129 break;
130 }
131 },
132
133 //-------------------------------------------------------------------------
134
135 'setOrientation': function (anOrientation) {
136 document.body.setAttribute('orientation', anOrientation);
137 setTimeout(scrollTo, 100, 0, 1);
138 },
139
140 //-------------------------------------------------------------------------
141
142 'slidePages': function (fromPage, toPage, backwards) {
143 var axis;
144 var slideDone;
145
146 slideDone = function () {
147 // console.log("slideDone");
148 if (!hasClass(toPage, "dialog")) {
149 fromPage.removeAttribute("selected");
150 }
151 checkTimer = setInterval(checkOrientAndLocation, 300);
152 setTimeout(updatePage, 0, toPage, fromPage);
153 fromPage.removeEventListener('webkitTransitionEnd', slideDone, false);
154 }
155
156 axis = (backwards ? fromPage : toPage).getAttribute("axis");
157
158 clearInterval(checkTimer);
159
160 if (canDoSlideAnim() && axis != 'y') {
161 slide2(fromPage, toPage, backwards, slideDone);
162 } else {
163 slide1(fromPage, toPage, backwards, axis, slideDone);
164 }
165 },
166
167 //-------------------------------------------------------------------------
168
169 'getCachedValues': function () {
170 var deferredResult;
171
172 if (this._cachedObjects != null) {
173 deferredResult = MochiKit.Async.succeed(this._cachedObjects);
174 } else {
175 deferredResult = new Clipperz.Async.Deferred("MainController.getCachedValues", {trace:false});
176 deferredResult.addMethod(this.user(), 'getRecords');
177 deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("MainController.getCachedValues - collectResults", {
178 '_rowObject': MochiKit.Async.succeed,
179 '_reference': MochiKit.Base.methodcaller('reference'),
180 'label': MochiKit.Base.methodcaller('label'),
181 'favicon': MochiKit.Base.methodcaller('favicon'),
182 '_searchableContent':MochiKit.Base.methodcaller('searchableContent')
183 }, {trace:false}));
184 deferredResult.addCallback(Clipperz.Async.collectAll);
185 deferredResult.addCallback(MochiKit.Base.bind(function (someRows) {
186 this._cachedObjects = someRows;
187 return this._cachedObjects;
188 }, this));
189 deferredResult.callback();
190 }
191
192 return deferredResult;
193 },
194 //=========================================================================
195
196 'run': function(shouldShowRegistrationForm) {
197 this.loginForm().render();
198 MochiKit.Async.callLater(1, MochiKit.Base.method(this.loginForm(), 'focusOnUsername'));
199 },
200
201 //=========================================================================
202
203 'doLoginHandler': function (someArgs) {
204 var deferredResult;
205 varparameters;
206 varshouldUseOTP;
207 // var loginProgress;
208 varuser;
209 var getPassphraseDelegate;
210
211 parameters = someArgs;
212 shouldUseOTP = (typeof(parameters.passphrase) == 'undefined');
213
214 getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, parameters.passphrase);
215 user = new Clipperz.PM.DataModel.User({'username':parameters.username, 'getPassphraseFunction':getPassphraseDelegate});
216
217 deferredResult = new Clipperz.Async.Deferred("MainController.doLogin", {trace:false});
218 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4});
219 deferredResult.addMethod(this.loginForm(), 'showLoginProgress');
220 deferredResult.addCallback(MochiKit.Async.wait, 0.1);
221 deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection');
222 deferredResult.addMethod(user, 'login');
223 deferredResult.addMethod(this, 'setUser', user);
224 deferredResult.addMethod(user, 'getRecords');
225 deferredResult.addMethod(this, 'removeLoginForm');
226 deferredResult.addMethod(this.cardList(), 'render');
227 deferredResult.addMethod(this, 'displaySelectedRecords', '');
228 deferredResult.addErrback(MochiKit.Base.method(this.loginForm(), 'showLoginError'));
229 deferredResult.callback();
230
231 return deferredResult;
232 },
233
234 //=========================================================================
235
236 'searchEventHandler': function (aValue) {
237//console.log("searching for ... " + aValue);
238 return this.displaySelectedRecords(aValue);
239 },
240
241 //=========================================================================
242
243 '_displaySelectedRows': function (aFilter, someRows) {
244 var result;
245
246 result = someRows;
247
248 if (aFilter != null) {
249 var filter;
250 varfilterRegExp;
251
252 filter = aFilter.replace(/[^A-Za-z0-9]/g, "\\$&");
253 filterRegExp = new RegExp(filter, "i");
254 result = MochiKit.Base.filter(function (aCachedResult) { return filterRegExp.test(aCachedResult['_searchableContent'])}, result);
255 }
256
257
258 result.sort(MochiKit.Base.partial(function (aKey, aComparator, aObject, bObject) {
259 return aComparator(aObject[aKey], bObject[aKey]);
260 }, 'label', Clipperz.Base.caseInsensitiveCompare));
261
262 this.cardList().update(result);
263 },
264
265 //-------------------------------------------------------------------------
266
267 'displaySelectedRecords': function (aFilter) {
268 return Clipperz.Async.callbacks("MainController.displaySelectedrows", [
269 MochiKit.Base.method(this, 'getCachedValues'),
270 MochiKit.Base.method(this, '_displaySelectedRows', aFilter)
271 ], {trace:false});
272 },
273
274 //=========================================================================
275
276 'selecetedCardHandler': function (aRecordReference) {
277 vardeferredResult;
278 varrecordData;
279
280 recordData = {};
281//console.log("Showing detail for card with reference", aRecordReference);
282 deferredResult = new Clipperz.Async.Deferred("MainController.selectedCardHandler", {trace:false});
283 deferredResult.addMethod(this.user(), 'getRecord', aRecordReference);
284 deferredResult.collectResults({
285 '_reference':MochiKit.Base.methodcaller('reference'),
286 'title': MochiKit.Base.methodcaller('label'),
287 'favicon': MochiKit.Base.methodcaller('favicon')
288 });
289 deferredResult.addCallback(function (someData) {
290 MochiKit.Base.update(recordData, someData);
291 })
292 deferredResult.addMethod(this.cardList(), 'showCard', recordData);
293
294 deferredResult.addMethod(this.user(), 'getRecord', aRecordReference);
295 deferredResult.addMethodcaller('notes');
296 deferredResult.addCallback(function (someNotes) {
297 recordData['notes'] = someNotes;
298 })
299
300 deferredResult.addMethod(this.user(), 'getRecord', aRecordReference);
301 deferredResult.addMethodcaller('getCurrentRecordVersion');
302 deferredResult.addMethodcaller('fields');
303 deferredResult.addCallback(MochiKit.Base.values);
304 deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("MainController.selectedCardHandler - fields", {
305 'label':MochiKit.Base.methodcaller('label'),
306 'value':MochiKit.Base.methodcaller('value'),
307 'isHidden':MochiKit.Base.methodcaller('isHidden')
308 }, {trace:false}));
309 deferredResult.addCallback(Clipperz.Async.collectAll);
310 deferredResult.addCallback(function (someData) {
311 recordData['fields'] = someData;
312 });
313
314 deferredResult.addMethod(this.user(), 'getRecord', aRecordReference);
315 deferredResult.addMethodcaller('directLogins');
316 deferredResult.addCallback(MochiKit.Base.values);
317 deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("MainController.selectedCardHandler - directLogins", {
318 'label': MochiKit.Base.methodcaller('label'),
319 'favicon': MochiKit.Base.methodcaller('favicon'),
320 '_reference':MochiKit.Base.methodcaller('reference')
321 }, {trace:false}));
322 deferredResult.addCallback(Clipperz.Async.collectAll);
323 deferredResult.addCallback(function (someData) {
324 recordData['directLogins'] = someData;
325 });
326
327 deferredResult.addMethod(this.cardList(), 'showCardDetails', recordData);
328 deferredResult.callback();
329
330 return deferredResult;
331 },
332
333 //=========================================================================
334
335 'selectedDirectLoginHandler': function (someData) {
336 vardeferredResult;
337
338//console.log("<<< signal - directLogin");
339 deferredResult = new Clipperz.Async.Deferred("MainController.selectedDirectLoginHandler", {trace:false});
340 deferredResult.addMethod(this.user(), 'getRecord', someData['cardReference']);
341 deferredResult.addMethodcaller('directLogins');
342 deferredResult.addCallback(MochiKit.Base.itemgetter(someData['directLoginReference']));
343 // deferredResult.addMethodcaller('runDirectLogin');
344 deferredResult.addCallback(Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.openDirectLogin);
345 deferredResult.callback();
346
347 return deferredResult;
348 },
349
350 //=========================================================================
351
352 'addMetaTag': function (aName, aContent) {
353 varmetaTag;
354
355 metaTag = document.createElement('meta');
356 metaTag.name = aName;
357 metaTag.content = aContent;
358 document.getElementsByTagName('head')[0].appendChild(metaTag);
359 },
360
361 'addLinkTag': function (aRel, anHref) {
362 var linkTag;
363
364 linkTag = document.createElement('link');
365 linkTag.rel = aRel;
366 linkTag.href = anHref;
367 document.getElementsByTagName('head')[0].appendChild(linkTag);
368 },
369
370 //=========================================================================
371 __syntaxFix__: "syntax fix"
372}); \ No newline at end of file