author | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
commit | 07d0357beef5d9328a2dd8d07ad7b39c87ac55e4 (patch) (unidiff) | |
tree | f7a4aed8848302db153c2a211f8e58b944eb4c5b /frontend/gamma/js/Clipperz/PM | |
parent | 767a3dcf48b6ac911c088af5dd7738a728eb6b99 (diff) | |
download | clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.zip clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.gz clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.bz2 |
Updated Copyright claims
- updated reference dates;
- removed reference to Community Edition;
- normalized logging using Clipperz.log[Warn|Error|Debug]
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM') (more/less context) (ignore whitespace changes)
109 files changed, 1153 insertions, 1593 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/BookmarkletProcessor.js b/frontend/gamma/js/Clipperz/PM/BookmarkletProcessor.js index 897beed..4818b76 100644 --- a/frontend/gamma/js/Clipperz/PM/BookmarkletProcessor.js +++ b/frontend/gamma/js/Clipperz/PM/BookmarkletProcessor.js | |||
@@ -1,193 +1,191 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | /* | 24 | /* |
27 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 25 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
28 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 26 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
29 | 27 | ||
30 | Clipperz.PM.BookmarkletProcessor = function(aConfiguration) { | 28 | Clipperz.PM.BookmarkletProcessor = function(aConfiguration) { |
31 | this._configuration = aConfiguration; | 29 | this._configuration = aConfiguration; |
32 | 30 | ||
33 | this._editableFields = null; | 31 | this._editableFields = null; |
34 | this._favicon = null; | 32 | this._favicon = null; |
35 | 33 | ||
36 | return this; | 34 | return this; |
37 | } | 35 | } |
38 | 36 | ||
39 | Clipperz.PM.BookmarkletProcessor.prototype = MochiKit.Base.update(null, { | 37 | Clipperz.PM.BookmarkletProcessor.prototype = MochiKit.Base.update(null, { |
40 | 38 | ||
41 | 'toString': function() { | 39 | 'toString': function() { |
42 | return "Clipperz.PM.BookmarkletProcessor"; | 40 | return "Clipperz.PM.BookmarkletProcessor"; |
43 | }, | 41 | }, |
44 | 42 | ||
45 | //------------------------------------------------------------------------- | 43 | //------------------------------------------------------------------------- |
46 | 44 | ||
47 | 'configuration': function() { | 45 | 'configuration': function() { |
48 | return this._configuration; | 46 | return this._configuration; |
49 | }, | 47 | }, |
50 | 48 | ||
51 | //------------------------------------------------------------------------- | 49 | //------------------------------------------------------------------------- |
52 | 50 | ||
53 | 'pageTitle': function() { | 51 | 'pageTitle': function() { |
54 | return this.configuration().page.title; | 52 | return this.configuration().page.title; |
55 | }, | 53 | }, |
56 | 54 | ||
57 | //------------------------------------------------------------------------- | 55 | //------------------------------------------------------------------------- |
58 | 56 | ||
59 | 'fields': function() { | 57 | 'fields': function() { |
60 | return this.configuration().form.inputs; | 58 | return this.configuration().form.inputs; |
61 | }, | 59 | }, |
62 | 60 | ||
63 | //------------------------------------------------------------------------- | 61 | //------------------------------------------------------------------------- |
64 | 62 | ||
65 | 'editableFields': function() { | 63 | 'editableFields': function() { |
66 | if (this._editableFields == null) { | 64 | if (this._editableFields == null) { |
67 | this._editableFields = MochiKit.Base.filter(function(aField) { | 65 | this._editableFields = MochiKit.Base.filter(function(aField) { |
68 | var result; | 66 | var result; |
69 | var type; | 67 | var type; |
70 | 68 | ||
71 | type = aField['type'].toLowerCase(); | 69 | type = aField['type'].toLowerCase(); |
72 | result = ((type != 'hidden') && (type != 'submit') && (type != 'checkbox') && (type != 'radio') && (type != 'select')); | 70 | result = ((type != 'hidden') && (type != 'submit') && (type != 'checkbox') && (type != 'radio') && (type != 'select')); |
73 | 71 | ||
74 | return result; | 72 | return result; |
75 | }, this.fields()) | 73 | }, this.fields()) |
76 | } | 74 | } |
77 | 75 | ||
78 | return this._editableFields; | 76 | return this._editableFields; |
79 | }, | 77 | }, |
80 | 78 | ||
81 | //------------------------------------------------------------------------- | 79 | //------------------------------------------------------------------------- |
82 | 80 | ||
83 | 'hostname': function() { | 81 | 'hostname': function() { |
84 | if (this._hostname == null) { | 82 | if (this._hostname == null) { |
85 | var actionUrl; | 83 | var actionUrl; |
86 | 84 | ||
87 | actionUrl = this.configuration()['form']['attributes']['action']; | 85 | actionUrl = this.configuration()['form']['attributes']['action']; |
88 | this._hostname = actionUrl.replace(/ ^ h t t p s ? : \ / \ / ( [ ^ \ / ] * ) \ / . * /, '$1'); | 86 | this._hostname = actionUrl.replace(/ ^ h t t p s ? : \ / \ / ( [ ^ \ / ] * ) \ / . * /, '$1'); |
89 | } | 87 | } |
90 | 88 | ||
91 | return this._hostname; | 89 | return this._hostname; |
92 | }, | 90 | }, |
93 | 91 | ||
94 | 'favicon': function() { | 92 | 'favicon': function() { |
95 | if (this._favicon == null) { | 93 | if (this._favicon == null) { |
96 | this._favicon = "http://" + this.hostname() + "/favicon.ico"; | 94 | this._favicon = "http://" + this.hostname() + "/favicon.ico"; |
97 | } | 95 | } |
98 | 96 | ||
99 | return this._favicon; | 97 | return this._favicon; |
100 | }, | 98 | }, |
101 | 99 | ||
102 | //------------------------------------------------------------------------- | 100 | //------------------------------------------------------------------------- |
103 | __syntaxFix__: "syntax fix" | 101 | __syntaxFix__: "syntax fix" |
104 | }); | 102 | }); |
105 | 103 | ||
106 | //############################################################################# | 104 | //############################################################################# |
107 | / * | 105 | / * |
108 | Clipperz.PM.BookmarkletProcessor.createRecordFromBookmarkletConfiguration = function(anUser, aConfiguration) { | 106 | Clipperz.PM.BookmarkletProcessor.createRecordFromBookmarkletConfiguration = function(anUser, aConfiguration) { |
109 | var processor; | 107 | var processor; |
110 | var record; | 108 | var record; |
111 | var recordVersion; | 109 | var recordVersion; |
112 | var directLogin; | 110 | var directLogin; |
113 | var bindings; | 111 | var bindings; |
114 | var i,c; | 112 | var i,c; |
115 | 113 | ||
116 | processor = new Clipperz.PM.BookmarkletProcessor(aConfiguration); | 114 | processor = new Clipperz.PM.BookmarkletProcessor(aConfiguration); |
117 | 115 | ||
118 | record = new Clipperz.PM.DataModel.Record({ | 116 | record = new Clipperz.PM.DataModel.Record({ |
119 | 'label':processor.pageTitle(), | 117 | 'label':processor.pageTitle(), |
120 | 'notes':"", | 118 | 'notes':"", |
121 | 'user': anUser | 119 | 'user': anUser |
122 | }); | 120 | }); |
123 | recordVersion = new Clipperz.PM.DataModel.Record.Version(record, {}) | 121 | recordVersion = new Clipperz.PM.DataModel.Record.Version(record, {}) |
124 | record.setCurrentVersion(recordVersion); | 122 | record.setCurrentVersion(recordVersion); |
125 | 123 | ||
126 | bindings = {}; | 124 | bindings = {}; |
127 | 125 | ||
128 | c = processor.editableFields().length; | 126 | c = processor.editableFields().length; |
129 | for (i=0; i<c; i++) { | 127 | for (i=0; i<c; i++) { |
130 | var formField; | 128 | var formField; |
131 | var recordField; | 129 | var recordField; |
132 | 130 | ||
133 | formField = processor.editableFields()[i]; | 131 | formField = processor.editableFields()[i]; |
134 | recordField = new Clipperz.PM.DataModel.RecordField({ | 132 | recordField = new Clipperz.PM.DataModel.RecordField({ |
135 | 'label':formField['name'], | 133 | 'label':formField['name'], |
136 | 'value':formField['value'], | 134 | 'value':formField['value'], |
137 | 'type': Clipperz.PM.Strings.inputTypeToRecordFieldType[formField['type']], | 135 | 'type': Clipperz.PM.Strings.inputTypeToRecordFieldType[formField['type']], |
138 | 'hidden': false, | 136 | 'hidden': false, |
139 | 'recordVersion':recordVersion | 137 | 'recordVersion':recordVersion |
140 | }); | 138 | }); |
141 | recordVersion.addField(recordField); | 139 | recordVersion.addField(recordField); |
142 | 140 | ||
143 | bindings[formField['name']] = recordField.key(); | 141 | bindings[formField['name']] = recordField.key(); |
144 | } | 142 | } |
145 | 143 | ||
146 | directLogin = new Clipperz.PM.DataModel.DirectLogin({ | 144 | directLogin = new Clipperz.PM.DataModel.DirectLogin({ |
147 | 'record': record, | 145 | 'record': record, |
148 | 'label': processor.pageTitle(), | 146 | 'label': processor.pageTitle(), |
149 | 'favicon': processor.favicon(), | 147 | 'favicon': processor.favicon(), |
150 | 'formData': processor.configuration()['form'], | 148 | 'formData': processor.configuration()['form'], |
151 | 'bindingData':bindings, | 149 | 'bindingData':bindings, |
152 | 'bookmarkletVersion':'0.2' | 150 | 'bookmarkletVersion':'0.2' |
153 | }); | 151 | }); |
154 | record.addDirectLogin(directLogin); | 152 | record.addDirectLogin(directLogin); |
155 | 153 | ||
156 | anUser.addRecord(record); | 154 | anUser.addRecord(record); |
157 | 155 | ||
158 | return record; | 156 | return record; |
159 | }; | 157 | }; |
160 | * / | 158 | * / |
161 | //----------------------------------------------------------------------------- | 159 | //----------------------------------------------------------------------------- |
162 | 160 | ||
163 | Clipperz.PM.BookmarkletProcessor.sanitizeBookmarkletConfiguration = function(aConfiguration) { | 161 | Clipperz.PM.BookmarkletProcessor.sanitizeBookmarkletConfiguration = function(aConfiguration) { |
164 | var result; | 162 | var result; |
165 | 163 | ||
166 | //throw "XSS Bookmarklet attempt"; | 164 | //throw "XSS Bookmarklet attempt"; |
167 | 165 | ||
168 | result = aConfiguration; | 166 | result = aConfiguration; |
169 | 167 | ||
170 | return result; | 168 | return result; |
171 | }; | 169 | }; |
172 | 170 | ||
173 | //----------------------------------------------------------------------------- | 171 | //----------------------------------------------------------------------------- |
174 | 172 | ||
175 | Clipperz.PM.BookmarkletProcessor.checkBookmarkletConfiguration = function(aConfiguration) { | 173 | Clipperz.PM.BookmarkletProcessor.checkBookmarkletConfiguration = function(aConfiguration) { |
176 | var result; | 174 | var result; |
177 | 175 | ||
178 | try { | 176 | try { |
179 | result = Clipperz.Base.evalJSON(aConfiguration); | 177 | result = Clipperz.Base.evalJSON(aConfiguration); |
180 | result = Clipperz.PM.BookmarkletProcessor.sanitizeBookmarkletConfiguration(result); | 178 | result = Clipperz.PM.BookmarkletProcessor.sanitizeBookmarkletConfiguration(result); |
181 | 179 | ||
182 | if (result['version'] != '0.2.3') { | 180 | if (result['version'] != '0.2.3') { |
183 | throw "WrongBookmarkletVersion"; | 181 | throw "WrongBookmarkletVersion"; |
184 | } | 182 | } |
185 | } catch (exception) { | 183 | } catch (exception) { |
186 | throw exception; | 184 | throw exception; |
187 | } | 185 | } |
188 | 186 | ||
189 | return result; | 187 | return result; |
190 | }; | 188 | }; |
191 | 189 | ||
192 | //----------------------------------------------------------------------------- | 190 | //----------------------------------------------------------------------------- |
193 | */ \ No newline at end of file | 191 | */ \ No newline at end of file |
diff --git a/frontend/gamma/js/Clipperz/PM/Connection.js b/frontend/gamma/js/Clipperz/PM/Connection.js index a05a310..6a8f15e 100644 --- a/frontend/gamma/js/Clipperz/PM/Connection.js +++ b/frontend/gamma/js/Clipperz/PM/Connection.js | |||
@@ -1,640 +1,637 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | 26 | ||
29 | //----------------------------------------------------------------------------- | 27 | //----------------------------------------------------------------------------- |
30 | // | 28 | // |
31 | // Abstract C O N N E C T I O N class | 29 | // Abstract C O N N E C T I O N class |
32 | // | 30 | // |
33 | //----------------------------------------------------------------------------- | 31 | //----------------------------------------------------------------------------- |
34 | 32 | ||
35 | Clipperz.PM.Connection = function (args) { | 33 | Clipperz.PM.Connection = function (args) { |
36 | args = args || {}; | 34 | args = args || {}; |
37 | 35 | ||
38 | this._proxy = args.proxy || Clipperz.PM.Proxy.defaultProxy; | 36 | this._proxy = args.proxy || Clipperz.PM.Proxy.defaultProxy; |
39 | this._getCredentialsFunction = args.getCredentialsFunction; | 37 | this._getCredentialsFunction = args.getCredentialsFunction; |
40 | 38 | ||
41 | this._clipperz_pm_crypto_version = null; | 39 | this._clipperz_pm_crypto_version = null; |
42 | this._connectionId = null; | 40 | this._connectionId = null; |
43 | this._sharedSecret = null; | 41 | this._sharedSecret = null; |
44 | this._serverLockValue = null; | 42 | this._serverLockValue = null; |
45 | 43 | ||
46 | return this; | 44 | return this; |
47 | } | 45 | } |
48 | 46 | ||
49 | Clipperz.PM.Connection.prototype = MochiKit.Base.update(null, { | 47 | Clipperz.PM.Connection.prototype = MochiKit.Base.update(null, { |
50 | 48 | ||
51 | 'toString': function() { | 49 | 'toString': function() { |
52 | return "Connection [" + this.version() + "]"; | 50 | return "Connection [" + this.version() + "]"; |
53 | }, | 51 | }, |
54 | 52 | ||
55 | //========================================================================= | 53 | //========================================================================= |
56 | 54 | ||
57 | 'version': function() { | 55 | 'version': function() { |
58 | throw Clipperz.Base.exception.AbstractMethod; | 56 | throw Clipperz.Base.exception.AbstractMethod; |
59 | }, | 57 | }, |
60 | 58 | ||
61 | 'clipperz_pm_crypto_version': function() { | 59 | 'clipperz_pm_crypto_version': function() { |
62 | if (this._clipperz_pm_crypto_version == null) { | 60 | if (this._clipperz_pm_crypto_version == null) { |
63 | var connectionVersions; | 61 | var connectionVersions; |
64 | varversions; | 62 | varversions; |
65 | varversion; | 63 | varversion; |
66 | var i, c; | 64 | var i, c; |
67 | 65 | ||
68 | version = null; | 66 | version = null; |
69 | connectionVersions = Clipperz.PM.Connection.communicationProtocol.versions; | 67 | connectionVersions = Clipperz.PM.Connection.communicationProtocol.versions; |
70 | versions = MochiKit.Base.keys(connectionVersions); | 68 | versions = MochiKit.Base.keys(connectionVersions); |
71 | c = versions.length; | 69 | c = versions.length; |
72 | for (i=0; i<c; i++) { | 70 | for (i=0; i<c; i++) { |
73 | if (! (versions[i] == 'current')) { | 71 | if (! (versions[i] == 'current')) { |
74 | if (this instanceof connectionVersions[versions[i]]) { | 72 | if (this instanceof connectionVersions[versions[i]]) { |
75 | version = versions[i]; | 73 | version = versions[i]; |
76 | }; | 74 | }; |
77 | } | 75 | } |
78 | } | 76 | } |
79 | 77 | ||
80 | this._clipperz_pm_crypto_version = version; | 78 | this._clipperz_pm_crypto_version = version; |
81 | } | 79 | } |
82 | 80 | ||
83 | return this._clipperz_pm_crypto_version; | 81 | return this._clipperz_pm_crypto_version; |
84 | }, | 82 | }, |
85 | 83 | ||
86 | //------------------------------------------------------------------------- | 84 | //------------------------------------------------------------------------- |
87 | 85 | ||
88 | 'defaultErrorHandler': function(anErrorString, anException) { | 86 | 'defaultErrorHandler': function(anErrorString, anException) { |
89 | MochiKit.Logging.logError("### Connection.defaultErrorHandler: " + anErrorString + " (" + anException + ")"); | 87 | // Clipperz.logError("### Connection.defaultErrorHandler: " + anErrorString, anException); |
88 | Clipperz.logError("### Connection.defaultErrorHandler: " + anErrorString + " (" + anException + ")"); | ||
90 | }, | 89 | }, |
91 | 90 | ||
92 | //------------------------------------------------------------------------- | 91 | //------------------------------------------------------------------------- |
93 | 92 | ||
94 | 'getCredentialsFunction': function () { | 93 | 'getCredentialsFunction': function () { |
95 | return this._getCredentialsFunction; | 94 | return this._getCredentialsFunction; |
96 | }, | 95 | }, |
97 | 96 | ||
98 | 'normalizedCredentials': function(someValues) { | 97 | 'normalizedCredentials': function(someValues) { |
99 | throw Clipperz.Base.exception.AbstractMethod; | 98 | throw Clipperz.Base.exception.AbstractMethod; |
100 | }, | 99 | }, |
101 | 100 | ||
102 | //========================================================================= | 101 | //========================================================================= |
103 | 102 | ||
104 | 'proxy': function () { | 103 | 'proxy': function () { |
105 | return this._proxy; | 104 | return this._proxy; |
106 | }, | 105 | }, |
107 | 106 | ||
108 | //========================================================================= | 107 | //========================================================================= |
109 | 108 | ||
110 | 'register': function () { | 109 | 'register': function () { |
111 | throw Clipperz.Base.exception.AbstractMethod; | 110 | throw Clipperz.Base.exception.AbstractMethod; |
112 | }, | 111 | }, |
113 | 112 | ||
114 | 'login': function() { | 113 | 'login': function() { |
115 | throw Clipperz.Base.exception.AbstractMethod; | 114 | throw Clipperz.Base.exception.AbstractMethod; |
116 | }, | 115 | }, |
117 | 116 | ||
118 | //------------------------------------------------------------------------- | 117 | //------------------------------------------------------------------------- |
119 | 118 | ||
120 | 'message': function(someArguments, aCallback) { | 119 | 'message': function(someArguments, aCallback) { |
121 | throw Clipperz.Base.exception.AbstractMethod; | 120 | throw Clipperz.Base.exception.AbstractMethod; |
122 | }, | 121 | }, |
123 | 122 | ||
124 | //------------------------------------------------------------------------- | 123 | //------------------------------------------------------------------------- |
125 | 124 | ||
126 | 'serverSideUserCredentials': function() { | 125 | 'serverSideUserCredentials': function() { |
127 | throw Clipperz.Base.exception.AbstractMethod; | 126 | throw Clipperz.Base.exception.AbstractMethod; |
128 | }, | 127 | }, |
129 | 128 | ||
130 | //========================================================================= | 129 | //========================================================================= |
131 | 130 | ||
132 | 'sharedSecret': function () { | 131 | 'sharedSecret': function () { |
133 | return this._sharedSecret; | 132 | return this._sharedSecret; |
134 | }, | 133 | }, |
135 | 134 | ||
136 | 'setSharedSecret': function (aValue) { | 135 | 'setSharedSecret': function (aValue) { |
137 | this._sharedSecret = aValue; | 136 | this._sharedSecret = aValue; |
138 | }, | 137 | }, |
139 | 138 | ||
140 | //------------------------------------------------------------------------- | 139 | //------------------------------------------------------------------------- |
141 | 140 | ||
142 | 'connectionId': function() { | 141 | 'connectionId': function() { |
143 | return this._connectionId; | 142 | return this._connectionId; |
144 | }, | 143 | }, |
145 | 144 | ||
146 | 'setConnectionId': function(aValue) { | 145 | 'setConnectionId': function(aValue) { |
147 | this._connectionId = aValue; | 146 | this._connectionId = aValue; |
148 | }, | 147 | }, |
149 | 148 | ||
150 | //------------------------------------------------------------------------- | 149 | //------------------------------------------------------------------------- |
151 | 150 | ||
152 | 'serverLockValue': function () { | 151 | 'serverLockValue': function () { |
153 | return this._serverLockValue; | 152 | return this._serverLockValue; |
154 | }, | 153 | }, |
155 | 154 | ||
156 | 'setServerLockValue': function (aValue) { | 155 | 'setServerLockValue': function (aValue) { |
157 | this._serverLockValue = aValue; | 156 | this._serverLockValue = aValue; |
158 | }, | 157 | }, |
159 | 158 | ||
160 | //========================================================================= | 159 | //========================================================================= |
161 | /* | 160 | /* |
162 | //TODO: ????? | 161 | //TODO: ????? |
163 | 'oneTimePassword': function() { | 162 | 'oneTimePassword': function() { |
164 | return this._oneTimePassword; | 163 | return this._oneTimePassword; |
165 | }, | 164 | }, |
166 | 165 | ||
167 | 'setOneTimePassword': function(aValue) { | 166 | 'setOneTimePassword': function(aValue) { |
168 | this._oneTimePassword = aValue; | 167 | this._oneTimePassword = aValue; |
169 | }, | 168 | }, |
170 | */ | 169 | */ |
171 | //========================================================================= | 170 | //========================================================================= |
172 | 171 | ||
173 | 'reset': function() { | 172 | 'reset': function() { |
174 | this.setSharedSecret(null); | 173 | this.setSharedSecret(null); |
175 | this.setConnectionId(null); | 174 | this.setConnectionId(null); |
176 | }, | 175 | }, |
177 | 176 | ||
178 | //========================================================================= | 177 | //========================================================================= |
179 | __syntaxFix__: "syntax fix" | 178 | __syntaxFix__: "syntax fix" |
180 | 179 | ||
181 | } | 180 | } |
182 | ); | 181 | ); |
183 | 182 | ||
184 | 183 | ||
185 | if (typeof(Clipperz.PM.Connection.SRP) == 'undefined') { Clipperz.PM.Connection.SRP = {}; } | 184 | if (typeof(Clipperz.PM.Connection.SRP) == 'undefined') { Clipperz.PM.Connection.SRP = {}; } |
186 | //----------------------------------------------------------------------------- | 185 | //----------------------------------------------------------------------------- |
187 | // | 186 | // |
188 | // S R P [ 1 . 0 ] C O N N E C T I O N class | 187 | // S R P [ 1 . 0 ] C O N N E C T I O N class |
189 | // | 188 | // |
190 | //----------------------------------------------------------------------------- | 189 | //----------------------------------------------------------------------------- |
191 | 190 | ||
192 | Clipperz.PM.Connection.SRP['1.0'] = function (args) { | 191 | Clipperz.PM.Connection.SRP['1.0'] = function (args) { |
193 | Clipperz.PM.Connection.call(this, args); | 192 | Clipperz.PM.Connection.call(this, args); |
194 | 193 | ||
195 | return this; | 194 | return this; |
196 | } | 195 | } |
197 | 196 | ||
198 | Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz.PM.Connection(), { | 197 | Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz.PM.Connection(), { |
199 | 198 | ||
200 | 'version': function() { | 199 | 'version': function() { |
201 | return '1.0'; | 200 | return '1.0'; |
202 | }, | 201 | }, |
203 | 202 | ||
204 | //========================================================================= | 203 | //========================================================================= |
205 | 204 | ||
206 | 'register': function (someUserData) { | 205 | 'register': function (someUserData) { |
207 | vardeferredResult; | 206 | vardeferredResult; |
208 | var cryptoVersion; | 207 | var cryptoVersion; |
209 | var srpConnection; | 208 | var srpConnection; |
210 | 209 | ||
211 | cryptoVersion = this.clipperz_pm_crypto_version(); | 210 | cryptoVersion = this.clipperz_pm_crypto_version(); |
212 | 211 | ||
213 | deferredResult = new Clipperz.Async.Deferred("Connection.registerWithVersion", {trace:false}); | 212 | deferredResult = new Clipperz.Async.Deferred("Connection.registerWithVersion", {trace:false}); |
214 | deferredResult.collectResults({ | 213 | deferredResult.collectResults({ |
215 | 'credentials': [ | 214 | 'credentials': [ |
216 | this.getCredentialsFunction(), | 215 | this.getCredentialsFunction(), |
217 | MochiKit.Base.method(this, 'normalizedCredentials'), | 216 | MochiKit.Base.method(this, 'normalizedCredentials'), |
218 | MochiKit.Base.bind(function(someCredentials) { | 217 | MochiKit.Base.bind(function(someCredentials) { |
219 | var srpConnection; | 218 | var srpConnection; |
220 | var result; | 219 | var result; |
221 | 220 | ||
222 | srpConnection = new Clipperz.Crypto.SRP.Connection({ C:someCredentials['username'], P:someCredentials['password'], hash:this.hash() }); | 221 | srpConnection = new Clipperz.Crypto.SRP.Connection({ C:someCredentials['username'], P:someCredentials['password'], hash:this.hash() }); |
223 | result = srpConnection.serverSideCredentials(); | 222 | result = srpConnection.serverSideCredentials(); |
224 | result['version'] = Clipperz.PM.Connection.communicationProtocol.currentVersion; | 223 | result['version'] = Clipperz.PM.Connection.communicationProtocol.currentVersion; |
225 | 224 | ||
226 | return result; | 225 | return result; |
227 | }, this) | 226 | }, this) |
228 | ], | 227 | ], |
229 | 'user': MochiKit.Base.partial(MochiKit.Async.succeed, someUserData), | 228 | 'user': MochiKit.Base.partial(MochiKit.Async.succeed, someUserData), |
230 | 'version':MochiKit.Base.partial(MochiKit.Async.succeed, Clipperz.PM.Connection.communicationProtocol.currentVersion), | 229 | 'version':MochiKit.Base.partial(MochiKit.Async.succeed, Clipperz.PM.Connection.communicationProtocol.currentVersion), |
231 | 'message':MochiKit.Base.partial(MochiKit.Async.succeed, 'completeRegistration') | 230 | 'message':MochiKit.Base.partial(MochiKit.Async.succeed, 'completeRegistration') |
232 | }); | 231 | }); |
233 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); | 232 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); |
234 | deferredResult.addMethod(this.proxy(), 'registration'); | 233 | deferredResult.addMethod(this.proxy(), 'registration'); |
235 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); | 234 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); |
236 | 235 | ||
237 | deferredResult.callback(); | 236 | deferredResult.callback(); |
238 | 237 | ||
239 | return deferredResult; | 238 | return deferredResult; |
240 | }, | 239 | }, |
241 | 240 | ||
242 | //------------------------------------------------------------------------- | 241 | //------------------------------------------------------------------------- |
243 | 242 | ||
244 | 'updateCredentials': function (aUsername, aPassphrase, someUserData) { | 243 | 'updateCredentials': function (aUsername, aPassphrase, someUserData) { |
245 | vardeferredResult; | 244 | vardeferredResult; |
246 | 245 | ||
247 | deferredResult = new Clipperz.Async.Deferred("Connection.updateCredentials", {trace:false}); | 246 | deferredResult = new Clipperz.Async.Deferred("Connection.updateCredentials", {trace:false}); |
248 | deferredResult.collectResults({ | 247 | deferredResult.collectResults({ |
249 | 'credentials': [ | 248 | 'credentials': [ |
250 | MochiKit.Base.method(this, 'normalizedCredentials', {username:aUsername, password:aPassphrase}), | 249 | MochiKit.Base.method(this, 'normalizedCredentials', {username:aUsername, password:aPassphrase}), |
251 | MochiKit.Base.bind(function(someCredentials) { | 250 | MochiKit.Base.bind(function(someCredentials) { |
252 | var srpConnection; | 251 | var srpConnection; |
253 | var result; | 252 | var result; |
254 | 253 | ||
255 | srpConnection = new Clipperz.Crypto.SRP.Connection({ C:someCredentials['username'], P:someCredentials['password'], hash:this.hash() }); | 254 | srpConnection = new Clipperz.Crypto.SRP.Connection({ C:someCredentials['username'], P:someCredentials['password'], hash:this.hash() }); |
256 | result = srpConnection.serverSideCredentials(); | 255 | result = srpConnection.serverSideCredentials(); |
257 | result['version'] = Clipperz.PM.Connection.communicationProtocol.currentVersion; | 256 | result['version'] = Clipperz.PM.Connection.communicationProtocol.currentVersion; |
258 | 257 | ||
259 | return result; | 258 | return result; |
260 | }, this) | 259 | }, this) |
261 | ], | 260 | ], |
262 | 'user': MochiKit.Base.partial(MochiKit.Async.succeed, someUserData) | 261 | 'user': MochiKit.Base.partial(MochiKit.Async.succeed, someUserData) |
263 | }); | 262 | }); |
264 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); | 263 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); |
265 | deferredResult.addMethod(this, 'message', 'upgradeUserCredentials'); | 264 | deferredResult.addMethod(this, 'message', 'upgradeUserCredentials'); |
266 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); | 265 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); |
267 | deferredResult.callback(); | 266 | deferredResult.callback(); |
268 | 267 | ||
269 | return deferredResult; | 268 | return deferredResult; |
270 | 269 | ||
271 | }, | 270 | }, |
272 | 271 | ||
273 | //========================================================================= | 272 | //========================================================================= |
274 | 273 | ||
275 | 'redeemOneTimePassword': function (someParameters) { | 274 | 'redeemOneTimePassword': function (someParameters) { |
276 | //console.log("Connections.redeemOneTimePassword", someParameters['username'], someParameters['password']); | ||
277 | /* | 275 | /* |
278 | //========================================================================= | 276 | //========================================================================= |
279 | //LOGIN WITH PASSPHRASE, extracted from the TRUNK version (LoginPanel.js) | 277 | //LOGIN WITH PASSPHRASE, extracted from the TRUNK version (LoginPanel.js) |
280 | deferredResult.addCallback(function(anUsername, aOneTimePassword) { | 278 | deferredResult.addCallback(function(anUsername, aOneTimePassword) { |
281 | var args; | 279 | var args; |
282 | 280 | ||
283 | args = { | 281 | args = { |
284 | 'message': 'oneTimePassword', | 282 | 'message': 'oneTimePassword', |
285 | 'version': Clipperz.PM.Crypto.communicationProtocol.currentVersion, | 283 | 'version': Clipperz.PM.Crypto.communicationProtocol.currentVersion, |
286 | 'parameters': { | 284 | 'parameters': { |
287 | 'oneTimePasswordKey': Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(anUsername, aOneTimePassword), | 285 | 'oneTimePasswordKey': Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(anUsername, aOneTimePassword), |
288 | 'oneTimePasswordKeyChecksum': Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(anUsername, aOneTimePassword) | 286 | 'oneTimePasswordKeyChecksum': Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(anUsername, aOneTimePassword) |
289 | } | 287 | } |
290 | } | 288 | } |
291 | 289 | ||
292 | return args; | 290 | return args; |
293 | }, anUsername, oneTimePassword); | 291 | }, anUsername, oneTimePassword); |
294 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'OTP_login_loadingOTP'); | 292 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'OTP_login_loadingOTP'); |
295 | deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Proxy.defaultProxy, 'handshake')); | 293 | deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Proxy.defaultProxy, 'handshake')); |
296 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'OTP_login_extractingPassphrase'); | 294 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'OTP_login_extractingPassphrase'); |
297 | deferredResult.addCallback(function(aResult) { | 295 | deferredResult.addCallback(function(aResult) { |
298 | return Clipperz.PM.Crypto.deferredDecrypt(oneTimePassword, aResult['data'], aResult['version']); | 296 | return Clipperz.PM.Crypto.deferredDecrypt(oneTimePassword, aResult['data'], aResult['version']); |
299 | }); | 297 | }); |
300 | deferredResult.addCallback(function(aResult) { | 298 | deferredResult.addCallback(function(aResult) { |
301 | return (new Clipperz.ByteArray().appendBase64String(aResult['passphrase'])).asString(); | 299 | return (new Clipperz.ByteArray().appendBase64String(aResult['passphrase'])).asString(); |
302 | }); | 300 | }); |
303 | deferredResult.addMethod(this, 'doLoginWithUsernameAndPassphrase', anUsername), | 301 | deferredResult.addMethod(this, 'doLoginWithUsernameAndPassphrase', anUsername), |
304 | */ | 302 | */ |
305 | var args; | 303 | var args; |
306 | var normalizedOTP; | 304 | var normalizedOTP; |
307 | 305 | ||
308 | normalizedOTP = Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword(someParameters['password']); | 306 | normalizedOTP = Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword(someParameters['password']); |
309 | 307 | ||
310 | args = { | 308 | args = { |
311 | 'message': 'oneTimePassword', | 309 | 'message': 'oneTimePassword', |
312 | 'version': Clipperz.PM.Connection.communicationProtocol.currentVersion, | 310 | 'version': Clipperz.PM.Connection.communicationProtocol.currentVersion, |
313 | 'parameters': { | 311 | 'parameters': { |
314 | 'oneTimePasswordKey': Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(someParameters['username'], normalizedOTP), | 312 | 'oneTimePasswordKey': Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(someParameters['username'], normalizedOTP), |
315 | 'oneTimePasswordKeyChecksum':Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(someParameters['username'], normalizedOTP) | 313 | 'oneTimePasswordKeyChecksum':Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(someParameters['username'], normalizedOTP) |
316 | } | 314 | } |
317 | } | 315 | } |
318 | 316 | ||
319 | return Clipperz.Async.callbacks("Connction.redeemOTP", [ | 317 | return Clipperz.Async.callbacks("Connction.redeemOTP", [ |
320 | MochiKit.Base.method(this.proxy(), 'handshake', args), | 318 | MochiKit.Base.method(this.proxy(), 'handshake', args), |
321 | function(aResult) { | 319 | function(aResult) { |
322 | return Clipperz.PM.Crypto.deferredDecrypt({ | 320 | return Clipperz.PM.Crypto.deferredDecrypt({ |
323 | value:aResult['data'], | 321 | value:aResult['data'], |
324 | key:normalizedOTP, | 322 | key:normalizedOTP, |
325 | version:aResult['version'] | 323 | version:aResult['version'] |
326 | }); | 324 | }); |
327 | }, | 325 | }, |
328 | function(aResult) { | 326 | function(aResult) { |
329 | return (new Clipperz.ByteArray().appendBase64String(aResult['passphrase'])).asString(); | 327 | return (new Clipperz.ByteArray().appendBase64String(aResult['passphrase'])).asString(); |
330 | } | 328 | } |
331 | ], {trace:false}) | 329 | ], {trace:false}) |
332 | }, | 330 | }, |
333 | 331 | ||
334 | 'login': function(isReconnecting) { | 332 | 'login': function(isReconnecting) { |
335 | vardeferredResult; | 333 | vardeferredResult; |
336 | var cryptoVersion; | 334 | var cryptoVersion; |
337 | var srpConnection; | 335 | var srpConnection; |
338 | 336 | ||
339 | cryptoVersion = this.clipperz_pm_crypto_version(); | 337 | cryptoVersion = this.clipperz_pm_crypto_version(); |
340 | deferredResult = new Clipperz.Async.Deferred("Connection.login", {trace:false}); | 338 | deferredResult = new Clipperz.Async.Deferred("Connection.login", {trace:false}); |
341 | deferredResult.addCallback(this.getCredentialsFunction()); | 339 | deferredResult.addCallback(this.getCredentialsFunction()); |
342 | deferredResult.addMethod(this, 'normalizedCredentials'); | 340 | deferredResult.addMethod(this, 'normalizedCredentials'); |
343 | // deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'updatedProgressState', 'connection_sendingCredentials'); | 341 | // deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'updatedProgressState', 'connection_sendingCredentials'); |
344 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); | 342 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); |
345 | deferredResult.addCallback(MochiKit.Base.bind(function(someCredentials) { | 343 | deferredResult.addCallback(MochiKit.Base.bind(function(someCredentials) { |
346 | srpConnection = new Clipperz.Crypto.SRP.Connection({ C:someCredentials['username'], P:someCredentials['password'], hash:this.hash() }); | 344 | srpConnection = new Clipperz.Crypto.SRP.Connection({ C:someCredentials['username'], P:someCredentials['password'], hash:this.hash() }); |
347 | }, this)); | 345 | }, this)); |
348 | deferredResult.addCallback(function() { | 346 | deferredResult.addCallback(function() { |
349 | var result; | 347 | var result; |
350 | 348 | ||
351 | result = { | 349 | result = { |
352 | message: 'connect', | 350 | message: 'connect', |
353 | version: cryptoVersion, | 351 | version: cryptoVersion, |
354 | parameters: { | 352 | parameters: { |
355 | C: srpConnection.C(), | 353 | C: srpConnection.C(), |
356 | A: srpConnection.A().asString(16) | 354 | A: srpConnection.A().asString(16) |
357 | // reconnecting: this.connectionId() | 355 | // reconnecting: this.connectionId() |
358 | } | 356 | } |
359 | }; | 357 | }; |
360 | 358 | ||
361 | // TODO: ????? | 359 | // TODO: ????? |
362 | // if (isReconnecting == true) { | 360 | // if (isReconnecting == true) { |
363 | // args.parameters['reconnecting'] = aConnection.connectionId(); | 361 | // args.parameters['reconnecting'] = aConnection.connectionId(); |
364 | // } | 362 | // } |
365 | 363 | ||
366 | return result; | 364 | return result; |
367 | }); | 365 | }); |
368 | deferredResult.addMethod(this.proxy(), 'handshake'); | 366 | deferredResult.addMethod(this.proxy(), 'handshake'); |
369 | // deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'updatedProgressState', 'connection_credentialVerification'); | 367 | // deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'updatedProgressState', 'connection_credentialVerification'); |
370 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); | 368 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); |
371 | deferredResult.addCallback(function(someParameters) { | 369 | deferredResult.addCallback(function(someParameters) { |
372 | var result; | 370 | var result; |
373 | 371 | ||
374 | srpConnection.set_s(new Clipperz.Crypto.BigInt(someParameters['s'], 16)); | 372 | srpConnection.set_s(new Clipperz.Crypto.BigInt(someParameters['s'], 16)); |
375 | srpConnection.set_B(new Clipperz.Crypto.BigInt(someParameters['B'], 16)); | 373 | srpConnection.set_B(new Clipperz.Crypto.BigInt(someParameters['B'], 16)); |
376 | 374 | ||
377 | //TODO: ????? | 375 | //TODO: ????? |
378 | // if (typeof(someParameters['oneTimePassword']) != 'undefined') { | 376 | // if (typeof(someParameters['oneTimePassword']) != 'undefined') { |
379 | // this.setOneTimePassword(someParameters['oneTimePassword']); | 377 | // this.setOneTimePassword(someParameters['oneTimePassword']); |
380 | // } | 378 | // } |
381 | 379 | ||
382 | result = { | 380 | result = { |
383 | message: 'credentialCheck', | 381 | message: 'credentialCheck', |
384 | version: cryptoVersion, | 382 | version: cryptoVersion, |
385 | parameters: { | 383 | parameters: { |
386 | M1: srpConnection.M1() | 384 | M1: srpConnection.M1() |
387 | } | 385 | } |
388 | }; | 386 | }; |
389 | 387 | ||
390 | return result; | 388 | return result; |
391 | }); | 389 | }); |
392 | deferredResult.addMethod(this.proxy(), 'handshake'); | 390 | deferredResult.addMethod(this.proxy(), 'handshake'); |
393 | deferredResult.addCallback(function(someParameters) { | 391 | deferredResult.addCallback(function(someParameters) { |
394 | var result; | 392 | var result; |
395 | 393 | ||
396 | if (someParameters['M2'] == srpConnection.M2()) { | 394 | if (someParameters['M2'] == srpConnection.M2()) { |
397 | result = MochiKit.Async.succeed(someParameters); | 395 | result = MochiKit.Async.succeed(someParameters); |
398 | } else { | 396 | } else { |
399 | result = MochiKit.Async.fail(Clipperz.PM.Connection.exception.WrongChecksum); | 397 | result = MochiKit.Async.fail(Clipperz.PM.Connection.exception.WrongChecksum); |
400 | } | 398 | } |
401 | 399 | ||
402 | return result; | 400 | return result; |
403 | }); | 401 | }); |
404 | deferredResult.addCallback(MochiKit.Base.bind(function(someParameters) { | 402 | deferredResult.addCallback(MochiKit.Base.bind(function(someParameters) { |
405 | this.setConnectionId(someParameters['connectionId']); | 403 | this.setConnectionId(someParameters['connectionId']); |
406 | this.setSharedSecret(srpConnection.K()); | 404 | this.setSharedSecret(srpConnection.K()); |
407 | 405 | ||
408 | // TODO: ????? | 406 | // TODO: ????? |
409 | // if (this.oneTimePassword() != null) { | 407 | // if (this.oneTimePassword() != null) { |
410 | /// ?? result = this.user().oneTimePasswordManager().archiveOneTimePassword(this.oneTimePassword())); | 408 | /// ?? result = this.user().oneTimePasswordManager().archiveOneTimePassword(this.oneTimePassword())); |
411 | // } | 409 | // } |
412 | 410 | ||
413 | if ((isReconnecting == true) && (this.serverLockValue() != someParameters['lock'])) { | 411 | if ((isReconnecting == true) && (this.serverLockValue() != someParameters['lock'])) { |
414 | throw Clipperz.PM.Connection.exception.StaleData; | 412 | throw Clipperz.PM.Connection.exception.StaleData; |
415 | } else { | 413 | } else { |
416 | this.setServerLockValue(someParameters['lock']); | 414 | this.setServerLockValue(someParameters['lock']); |
417 | } | 415 | } |
418 | 416 | ||
419 | return someParameters; | 417 | return someParameters; |
420 | }, this)); | 418 | }, this)); |
421 | // deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'updatedProgressState', 'connection_loggedIn'); | 419 | // deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'updatedProgressState', 'connection_loggedIn'); |
422 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); | 420 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); |
423 | deferredResult.addCallback(MochiKit.Async.succeed, {result:"done"}); | 421 | deferredResult.addCallback(MochiKit.Async.succeed, {result:"done"}); |
424 | 422 | ||
425 | deferredResult.callback(); | 423 | deferredResult.callback(); |
426 | 424 | ||
427 | return deferredResult; | 425 | return deferredResult; |
428 | }, | 426 | }, |
429 | 427 | ||
430 | //========================================================================= | 428 | //========================================================================= |
431 | 429 | ||
432 | 'logout': function() { | 430 | 'logout': function() { |
433 | return Clipperz.Async.callbacks("Connection.logout", [ | 431 | return Clipperz.Async.callbacks("Connection.logout", [ |
434 | MochiKit.Base.method(this, 'setSharedSecret'), | 432 | MochiKit.Base.method(this, 'setSharedSecret'), |
435 | MochiKit.Base.method(this.proxy(), 'logout', {}) | 433 | MochiKit.Base.method(this.proxy(), 'logout', {}) |
436 | ], {trace:false}); | 434 | ], {trace:false}); |
437 | }, | 435 | }, |
438 | 436 | ||
439 | //========================================================================= | 437 | //========================================================================= |
440 | 438 | ||
441 | 'ping': function () { | 439 | 'ping': function () { |
442 | //TODO: ping the server in order to have a valid session | 440 | //TODO: ping the server in order to have a valid session |
443 | }, | 441 | }, |
444 | 442 | ||
445 | //========================================================================= | 443 | //========================================================================= |
446 | 444 | ||
447 | 'message': function(aMessageName, someParameters) { | 445 | 'message': function(aMessageName, someParameters) { |
448 | var args; | 446 | var args; |
449 | var parameters; | 447 | var parameters; |
450 | 448 | ||
451 | parameters = someParameters || {}; | 449 | parameters = someParameters || {}; |
452 | if (typeof(parameters['user']) != 'undefined') { | 450 | if (typeof(parameters['user']) != 'undefined') { |
453 | parameters['user']['lock'] = this.serverLockValue(); | 451 | parameters['user']['lock'] = this.serverLockValue(); |
454 | } | 452 | } |
455 | 453 | ||
456 | //console.log(">>> Connection.message", aMessageName, someParameters); | ||
457 | args = { | 454 | args = { |
458 | message: aMessageName, | 455 | message: aMessageName, |
459 | srpSharedSecret: this.sharedSecret(), | 456 | srpSharedSecret: this.sharedSecret(), |
460 | // parameters: (someParameters || {}) | 457 | // parameters: (someParameters || {}) |
461 | parameters: parameters | 458 | parameters: parameters |
462 | } | 459 | } |
463 | 460 | ||
464 | return this.sendMessage(args); | 461 | return this.sendMessage(args); |
465 | }, | 462 | }, |
466 | 463 | ||
467 | //------------------------------------------------------------------------- | 464 | //------------------------------------------------------------------------- |
468 | 465 | ||
469 | 'sendMessage': function(someArguments) { | 466 | 'sendMessage': function(someArguments) { |
470 | vardeferredResult; | 467 | vardeferredResult; |
471 | 468 | ||
472 | deferredResult = new Clipperz.Async.Deferred("Connection.sendMessage", {trace:false}); | 469 | deferredResult = new Clipperz.Async.Deferred("Connection.sendMessage", {trace:false}); |
473 | deferredResult.addMethod(this.proxy(), 'message', someArguments); | 470 | deferredResult.addMethod(this.proxy(), 'message', someArguments); |
474 | deferredResult.addCallback(MochiKit.Base.bind(function(res) { | 471 | deferredResult.addCallback(MochiKit.Base.bind(function(res) { |
475 | if (typeof(res['lock']) != 'undefined') { | 472 | if (typeof(res['lock']) != 'undefined') { |
476 | this.setServerLockValue(res['lock']); | 473 | this.setServerLockValue(res['lock']); |
477 | } | 474 | } |
478 | return res; | 475 | return res; |
479 | }, this)); | 476 | }, this)); |
480 | 477 | ||
481 | deferredResult.addErrback(MochiKit.Base.method(this, 'messageExceptionHandler'), someArguments); | 478 | deferredResult.addErrback(MochiKit.Base.method(this, 'messageExceptionHandler'), someArguments); |
482 | deferredResult.callback(); | 479 | deferredResult.callback(); |
483 | 480 | ||
484 | return deferredResult | 481 | return deferredResult |
485 | }, | 482 | }, |
486 | 483 | ||
487 | //------------------------------------------------------------------------- | 484 | //------------------------------------------------------------------------- |
488 | 485 | ||
489 | 'messageExceptionHandler': function(anOriginalMessageArguments, anError) { | 486 | 'messageExceptionHandler': function(anOriginalMessageArguments, anError) { |
490 | var result; | 487 | var result; |
491 | 488 | ||
492 | console.log(">>> Connection.messageExceptionHandler", anError, anError.message); | 489 | Clipperz.log(">>> Connection.messageExceptionHandler: " + anError.message, anError); |
493 | if (anError instanceof MochiKit.Async.CancelledError) { | 490 | if (anError instanceof MochiKit.Async.CancelledError) { |
494 | result = anError; | 491 | result = anError; |
495 | } else { | 492 | } else { |
496 | if ((anError.message == 'Trying to communicate without an active connection')|| | 493 | if ((anError.message == 'Trying to communicate without an active connection')|| |
497 | (anError.message == 'No tollManager available for current session') | 494 | (anError.message == 'No tollManager available for current session') |
498 | ) { | 495 | ) { |
499 | result = this.reestablishConnection(anOriginalMessageArguments); | 496 | result = this.reestablishConnection(anOriginalMessageArguments); |
500 | } else if (anError.message == 'Session with stale data') { | 497 | } else if (anError.message == 'Session with stale data') { |
501 | MochiKit.Signal.signal(this, 'EXCEPTION'); | 498 | MochiKit.Signal.signal(this, 'EXCEPTION'); |
502 | } else { | 499 | } else { |
503 | result = anError; | 500 | result = anError; |
504 | } | 501 | } |
505 | } | 502 | } |
506 | console.log("<<< Connection.messageExceptionHandler", anError) | 503 | Clipperz.log("<<< Connection.messageExceptionHandler") |
507 | 504 | ||
508 | return result;; | 505 | return result;; |
509 | }, | 506 | }, |
510 | 507 | ||
511 | //========================================================================= | 508 | //========================================================================= |
512 | 509 | ||
513 | 'reestablishConnection': function(anOriginalMessageArguments) { | 510 | 'reestablishConnection': function(anOriginalMessageArguments) { |
514 | var deferredResult; | 511 | var deferredResult; |
515 | 512 | ||
516 | deferredResult = new Clipperz.Async.Deferred("Connection.reestablishConnection"); | 513 | deferredResult = new Clipperz.Async.Deferred("Connection.reestablishConnection"); |
517 | deferredResult.addMethod(this, 'reset'); | 514 | deferredResult.addMethod(this, 'reset'); |
518 | deferredResult.addMethod(this, 'login', true); | 515 | deferredResult.addMethod(this, 'login', true); |
519 | deferredResult.addCallback(MochiKit.Base.bind(function(aMessage) { | 516 | deferredResult.addCallback(MochiKit.Base.bind(function(aMessage) { |
520 | aMessage['srpSharedSecret'] = this.sharedSecret(); | 517 | aMessage['srpSharedSecret'] = this.sharedSecret(); |
521 | return aMessage; | 518 | return aMessage; |
522 | }, this), anOriginalMessageArguments); | 519 | }, this), anOriginalMessageArguments); |
523 | deferredResult.addMethod(this, 'sendMessage'); | 520 | deferredResult.addMethod(this, 'sendMessage'); |
524 | deferredResult.addErrback(MochiKit.Signal.signal, this, 'EXCEPTION', null); | 521 | deferredResult.addErrback(MochiKit.Signal.signal, this, 'EXCEPTION', null); |
525 | deferredResult.callback(); | 522 | deferredResult.callback(); |
526 | 523 | ||
527 | return deferredResult; | 524 | return deferredResult; |
528 | }, | 525 | }, |
529 | 526 | ||
530 | //========================================================================= | 527 | //========================================================================= |
531 | 528 | ||
532 | 'serverSideUserCredentials': function(aUsername, aPassword) { | 529 | 'serverSideUserCredentials': function(aUsername, aPassword) { |
533 | varresult; | 530 | varresult; |
534 | varnewSrpConnection; | 531 | varnewSrpConnection; |
535 | var normalizedAttributes; | 532 | var normalizedAttributes; |
536 | 533 | ||
537 | normalizedAttributes = this.normalizedCredentials({username:aUsername, password:aPassword}); | 534 | normalizedAttributes = this.normalizedCredentials({username:aUsername, password:aPassword}); |
538 | newSrpConnection = new Clipperz.Crypto.SRP.Connection({ C:normalizedAttributes['username'], P:normalizedAttributes['password'], hash:this.hash() }); | 535 | newSrpConnection = new Clipperz.Crypto.SRP.Connection({ C:normalizedAttributes['username'], P:normalizedAttributes['password'], hash:this.hash() }); |
539 | result = newSrpConnection.serverSideCredentials(); | 536 | result = newSrpConnection.serverSideCredentials(); |
540 | result['version'] = this.clipperz_pm_crypto_version(); | 537 | result['version'] = this.clipperz_pm_crypto_version(); |
541 | 538 | ||
542 | return result; | 539 | return result; |
543 | }, | 540 | }, |
544 | 541 | ||
545 | //========================================================================= | 542 | //========================================================================= |
546 | 543 | ||
547 | 'normalizedCredentials': function(someValues) { | 544 | 'normalizedCredentials': function(someValues) { |
548 | var result; | 545 | var result; |
549 | 546 | ||
550 | result = {} | 547 | result = {} |
551 | result['username'] = this.hash()(new Clipperz.ByteArray(someValues['username'])).toHexString().substring(2); | 548 | result['username'] = this.hash()(new Clipperz.ByteArray(someValues['username'])).toHexString().substring(2); |
552 | result['password'] = this.hash()(new Clipperz.ByteArray(someValues['password'] + someValues['username'])).toHexString().substring(2); | 549 | result['password'] = this.hash()(new Clipperz.ByteArray(someValues['password'] + someValues['username'])).toHexString().substring(2); |
553 | 550 | ||
554 | return result; | 551 | return result; |
555 | }, | 552 | }, |
556 | 553 | ||
557 | //----------------------------------------------------------------------------- | 554 | //----------------------------------------------------------------------------- |
558 | 555 | ||
559 | 'hash': function() { | 556 | 'hash': function() { |
560 | return Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].hash; | 557 | return Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].hash; |
561 | }, | 558 | }, |
562 | 559 | ||
563 | //----------------------------------------------------------------------------- | 560 | //----------------------------------------------------------------------------- |
564 | __syntaxFix__: "syntax fix" | 561 | __syntaxFix__: "syntax fix" |
565 | 562 | ||
566 | }); | 563 | }); |
567 | 564 | ||
568 | 565 | ||
569 | 566 | ||
570 | //----------------------------------------------------------------------------- | 567 | //----------------------------------------------------------------------------- |
571 | // | 568 | // |
572 | // S R P [ 1 . 1 ] C O N N E C T I O N class | 569 | // S R P [ 1 . 1 ] C O N N E C T I O N class |
573 | // | 570 | // |
574 | //----------------------------------------------------------------------------- | 571 | //----------------------------------------------------------------------------- |
575 | 572 | ||
576 | Clipperz.PM.Connection.SRP['1.1'] = function (args) { | 573 | Clipperz.PM.Connection.SRP['1.1'] = function (args) { |
577 | Clipperz.PM.Connection.SRP['1.0'].call(this, args); | 574 | Clipperz.PM.Connection.SRP['1.0'].call(this, args); |
578 | 575 | ||
579 | return this; | 576 | return this; |
580 | } | 577 | } |
581 | 578 | ||
582 | Clipperz.PM.Connection.SRP['1.1'].prototype = MochiKit.Base.update(new Clipperz.PM.Connection.SRP['1.0'](), { | 579 | Clipperz.PM.Connection.SRP['1.1'].prototype = MochiKit.Base.update(new Clipperz.PM.Connection.SRP['1.0'](), { |
583 | 580 | ||
584 | 'version': function() { | 581 | 'version': function() { |
585 | return '1.1'; | 582 | return '1.1'; |
586 | }, | 583 | }, |
587 | 584 | ||
588 | //----------------------------------------------------------------------------- | 585 | //----------------------------------------------------------------------------- |
589 | 586 | ||
590 | 'normalizedCredentials': function(someValues) { | 587 | 'normalizedCredentials': function(someValues) { |
591 | var result; | 588 | var result; |
592 | 589 | ||
593 | result = {} | 590 | result = {} |
594 | result['username'] = this.hash()(new Clipperz.ByteArray(someValues['username'] + someValues['password'])).toHexString().substring(2); | 591 | result['username'] = this.hash()(new Clipperz.ByteArray(someValues['username'] + someValues['password'])).toHexString().substring(2); |
595 | result['password'] = this.hash()(new Clipperz.ByteArray(someValues['password'] + someValues['username'])).toHexString().substring(2); | 592 | result['password'] = this.hash()(new Clipperz.ByteArray(someValues['password'] + someValues['username'])).toHexString().substring(2); |
596 | 593 | ||
597 | return result; | 594 | return result; |
598 | }, | 595 | }, |
599 | 596 | ||
600 | //----------------------------------------------------------------------------- | 597 | //----------------------------------------------------------------------------- |
601 | 598 | ||
602 | 'hash': function() { | 599 | 'hash': function() { |
603 | return Clipperz.PM.Crypto.encryptingFunctions.versions['0.2'].hash; | 600 | return Clipperz.PM.Crypto.encryptingFunctions.versions['0.2'].hash; |
604 | }, | 601 | }, |
605 | 602 | ||
606 | //----------------------------------------------------------------------------- | 603 | //----------------------------------------------------------------------------- |
607 | __syntaxFix__: "syntax fix" | 604 | __syntaxFix__: "syntax fix" |
608 | 605 | ||
609 | }); | 606 | }); |
610 | 607 | ||
611 | Clipperz.PM.Connection.exception = { | 608 | Clipperz.PM.Connection.exception = { |
612 | WrongChecksum: new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.InvalidValue"), | 609 | WrongChecksum: new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.InvalidValue"), |
613 | StaleData: new MochiKit.Base.NamedError("Stale data"), | 610 | StaleData: new MochiKit.Base.NamedError("Stale data"), |
614 | UnexpectedRequest:new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.UnexpectedRequest") | 611 | UnexpectedRequest:new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.UnexpectedRequest") |
615 | }; | 612 | }; |
616 | 613 | ||
617 | 614 | ||
618 | Clipperz.PM.Connection.communicationProtocol = { | 615 | Clipperz.PM.Connection.communicationProtocol = { |
619 | 'currentVersion': '0.2', | 616 | 'currentVersion': '0.2', |
620 | 'versions': { | 617 | 'versions': { |
621 | '0.1': Clipperz.PM.Connection.SRP['1.0'],//Clipperz.Crypto.SRP.versions['1.0'].Connection, | 618 | '0.1': Clipperz.PM.Connection.SRP['1.0'],//Clipperz.Crypto.SRP.versions['1.0'].Connection, |
622 | '0.2': Clipperz.PM.Connection.SRP['1.1']//Clipperz.Crypto.SRP.versions['1.1'].Connection | 619 | '0.2': Clipperz.PM.Connection.SRP['1.1']//Clipperz.Crypto.SRP.versions['1.1'].Connection |
623 | }, | 620 | }, |
624 | 'fallbackVersions': { | 621 | 'fallbackVersions': { |
625 | // 'current':'0.1', | 622 | // 'current':'0.1', |
626 | '0.2': '0.1', | 623 | '0.2': '0.1', |
627 | '0.1': null | 624 | '0.1': null |
628 | } | 625 | } |
629 | }; | 626 | }; |
630 | 627 | ||
631 | MochiKit.Base.update(Clipperz.PM.Connection.communicationProtocol.versions, { | 628 | MochiKit.Base.update(Clipperz.PM.Connection.communicationProtocol.versions, { |
632 | 'current': Clipperz.PM.Connection.communicationProtocol.versions[Clipperz.PM.Connection.communicationProtocol.currentVersion] | 629 | 'current': Clipperz.PM.Connection.communicationProtocol.versions[Clipperz.PM.Connection.communicationProtocol.currentVersion] |
633 | }); | 630 | }); |
634 | 631 | ||
635 | MochiKit.Base.update(Clipperz.PM.Connection.communicationProtocol.fallbackVersions, { | 632 | MochiKit.Base.update(Clipperz.PM.Connection.communicationProtocol.fallbackVersions, { |
636 | 'current': Clipperz.PM.Connection.communicationProtocol.fallbackVersions[Clipperz.PM.Connection.communicationProtocol.currentVersion] | 633 | 'current': Clipperz.PM.Connection.communicationProtocol.fallbackVersions[Clipperz.PM.Connection.communicationProtocol.currentVersion] |
637 | }); | 634 | }); |
638 | 635 | ||
639 | 636 | ||
640 | 637 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/Crypto.js b/frontend/gamma/js/Clipperz/PM/Crypto.js index 31fe349..cd10e33 100644 --- a/frontend/gamma/js/Clipperz/PM/Crypto.js +++ b/frontend/gamma/js/Clipperz/PM/Crypto.js | |||
@@ -1,510 +1,508 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Crypto) == 'undefined') { Clipperz.PM.Crypto = {}; } | 26 | if (typeof(Clipperz.PM.Crypto) == 'undefined') { Clipperz.PM.Crypto = {}; } |
29 | 27 | ||
30 | Clipperz.PM.Crypto.VERSION = "0.2"; | 28 | Clipperz.PM.Crypto.VERSION = "0.2"; |
31 | Clipperz.PM.Crypto.NAME = "Clipperz.PM.Crypto"; | 29 | Clipperz.PM.Crypto.NAME = "Clipperz.PM.Crypto"; |
32 | 30 | ||
33 | Clipperz.PM.Crypto.encryptingFunctions = {}; | 31 | Clipperz.PM.Crypto.encryptingFunctions = {}; |
34 | 32 | ||
35 | MochiKit.Base.update(Clipperz.PM.Crypto, { | 33 | MochiKit.Base.update(Clipperz.PM.Crypto, { |
36 | 34 | ||
37 | '__repr__': function () { | 35 | '__repr__': function () { |
38 | return "[" + this.NAME + " " + this.VERSION + "]"; | 36 | return "[" + this.NAME + " " + this.VERSION + "]"; |
39 | }, | 37 | }, |
40 | 38 | ||
41 | //------------------------------------------------------------------------- | 39 | //------------------------------------------------------------------------- |
42 | 40 | ||
43 | 'toString': function () { | 41 | 'toString': function () { |
44 | return this.__repr__(); | 42 | return this.__repr__(); |
45 | }, | 43 | }, |
46 | 44 | ||
47 | //------------------------------------------------------------------------- | 45 | //------------------------------------------------------------------------- |
48 | /* | 46 | /* |
49 | 'communicationProtocol': { | 47 | 'communicationProtocol': { |
50 | 'currentVersion': '0.2', | 48 | 'currentVersion': '0.2', |
51 | 'versions': { | 49 | 'versions': { |
52 | '0.1': Clipperz.PM.Connection.SRP['1.0'],//Clipperz.Crypto.SRP.versions['1.0'].Connection, | 50 | '0.1': Clipperz.PM.Connection.SRP['1.0'],//Clipperz.Crypto.SRP.versions['1.0'].Connection, |
53 | '0.2': Clipperz.PM.Connection.SRP['1.1']//Clipperz.Crypto.SRP.versions['1.1'].Connection | 51 | '0.2': Clipperz.PM.Connection.SRP['1.1']//Clipperz.Crypto.SRP.versions['1.1'].Connection |
54 | }, | 52 | }, |
55 | 'fallbackVersions': { | 53 | 'fallbackVersions': { |
56 | 'current':'0.1', | 54 | 'current':'0.1', |
57 | '0.2': '0.1', | 55 | '0.2': '0.1', |
58 | '0.1': null | 56 | '0.1': null |
59 | } | 57 | } |
60 | }, | 58 | }, |
61 | */ | 59 | */ |
62 | //------------------------------------------------------------------------- | 60 | //------------------------------------------------------------------------- |
63 | 61 | ||
64 | 'encryptingFunctions': { | 62 | 'encryptingFunctions': { |
65 | 'currentVersion': '0.3', | 63 | 'currentVersion': '0.3', |
66 | 'versions': { | 64 | 'versions': { |
67 | 65 | ||
68 | //##################################################################### | 66 | //##################################################################### |
69 | 67 | ||
70 | '0.1': { | 68 | '0.1': { |
71 | 'encrypt': function(aKey, aValue) { | 69 | 'encrypt': function(aKey, aValue) { |
72 | return Clipperz.Crypto.Base.encryptUsingSecretKey(aKey, Clipperz.Base.serializeJSON(aValue)); | 70 | return Clipperz.Crypto.Base.encryptUsingSecretKey(aKey, Clipperz.Base.serializeJSON(aValue)); |
73 | }, | 71 | }, |
74 | 72 | ||
75 | 'deferredEncrypt': function(aKey, aValue) { | 73 | 'deferredEncrypt': function(aKey, aValue) { |
76 | var deferredResult; | 74 | var deferredResult; |
77 | 75 | ||
78 | deferredResult = new Clipperz.Async.Deferred("Crypto[0.1].deferredEncrypt"); | 76 | deferredResult = new Clipperz.Async.Deferred("Crypto[0.1].deferredEncrypt"); |
79 | deferredResult.addCallback(Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].encrypt, aKey, aValue); | 77 | deferredResult.addCallback(Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].encrypt, aKey, aValue); |
80 | deferredResult.callback(); | 78 | deferredResult.callback(); |
81 | 79 | ||
82 | return deferredResult; | 80 | return deferredResult; |
83 | }, | 81 | }, |
84 | 82 | ||
85 | 'decrypt': function(aKey, aValue) { | 83 | 'decrypt': function(aKey, aValue) { |
86 | var result; | 84 | var result; |
87 | 85 | ||
88 | if (aValue != null) { | 86 | if (aValue != null) { |
89 | result = Clipperz.Base.evalJSON(Clipperz.Crypto.Base.decryptUsingSecretKey(aKey, aValue)); | 87 | result = Clipperz.Base.evalJSON(Clipperz.Crypto.Base.decryptUsingSecretKey(aKey, aValue)); |
90 | } else { | 88 | } else { |
91 | result = null; | 89 | result = null; |
92 | } | 90 | } |
93 | 91 | ||
94 | return result; | 92 | return result; |
95 | }, | 93 | }, |
96 | 94 | ||
97 | 'deferredDecrypt': function(aKey, aValue) { | 95 | 'deferredDecrypt': function(aKey, aValue) { |
98 | var deferredResult; | 96 | var deferredResult; |
99 | 97 | ||
100 | deferredResult = new Clipperz.Async.Deferred("Crypto.[0.1].deferredDecrypt"); | 98 | deferredResult = new Clipperz.Async.Deferred("Crypto.[0.1].deferredDecrypt"); |
101 | deferredResult.addCallback(Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].decrypt, aKey, aValue); | 99 | deferredResult.addCallback(Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].decrypt, aKey, aValue); |
102 | deferredResult.callback(); | 100 | deferredResult.callback(); |
103 | 101 | ||
104 | return deferredResult; | 102 | return deferredResult; |
105 | }, | 103 | }, |
106 | 104 | ||
107 | 'hash': function(aValue) { | 105 | 'hash': function(aValue) { |
108 | var result; | 106 | var result; |
109 | var strngResult; | 107 | var strngResult; |
110 | 108 | ||
111 | stringResult = Clipperz.Crypto.Base.computeHashValue(aValue.asString()); //!!!!!!! | 109 | stringResult = Clipperz.Crypto.Base.computeHashValue(aValue.asString()); //!!!!!!! |
112 | result = new Clipperz.ByteArray("0x" + stringResult); | 110 | result = new Clipperz.ByteArray("0x" + stringResult); |
113 | 111 | ||
114 | return result; | 112 | return result; |
115 | }, | 113 | }, |
116 | 114 | ||
117 | 'deriveKey': function(aStringValue) { | 115 | 'deriveKey': function(aStringValue) { |
118 | return Clipperz.Crypto.Base.computeHashValue(aStringValue); | 116 | return Clipperz.Crypto.Base.computeHashValue(aStringValue); |
119 | } | 117 | } |
120 | }, | 118 | }, |
121 | 119 | ||
122 | //##################################################################### | 120 | //##################################################################### |
123 | 121 | ||
124 | '0.2': { | 122 | '0.2': { |
125 | 'encrypt': function(aKey, aValue, aNonce) { | 123 | 'encrypt': function(aKey, aValue, aNonce) { |
126 | var result; | 124 | var result; |
127 | varkey, value; | 125 | varkey, value; |
128 | var dataToEncrypt; | 126 | var dataToEncrypt; |
129 | var encryptedData; | 127 | var encryptedData; |
130 | 128 | ||
131 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); | 129 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); |
132 | value = new Clipperz.ByteArray(Clipperz.Base.serializeJSON(aValue)); | 130 | value = new Clipperz.ByteArray(Clipperz.Base.serializeJSON(aValue)); |
133 | dataToEncrypt = Clipperz.Crypto.SHA.sha_d256(value).appendBlock(value); | 131 | dataToEncrypt = Clipperz.Crypto.SHA.sha_d256(value).appendBlock(value); |
134 | encryptedData = Clipperz.Crypto.AES.encrypt(key, dataToEncrypt, aNonce); | 132 | encryptedData = Clipperz.Crypto.AES.encrypt(key, dataToEncrypt, aNonce); |
135 | result = encryptedData.toBase64String(); | 133 | result = encryptedData.toBase64String(); |
136 | 134 | ||
137 | return result; | 135 | return result; |
138 | }, | 136 | }, |
139 | 137 | ||
140 | 'deferredEncrypt': function(aKey, aValue, aNonce) { | 138 | 'deferredEncrypt': function(aKey, aValue, aNonce) { |
141 | var deferredResult; | 139 | var deferredResult; |
142 | varkey, value; | 140 | varkey, value; |
143 | var dataToEncrypt; | 141 | var dataToEncrypt; |
144 | // var encryptedData; | 142 | // var encryptedData; |
145 | 143 | ||
146 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); | 144 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); |
147 | value = new Clipperz.ByteArray(Clipperz.Base.serializeJSON(aValue)); | 145 | value = new Clipperz.ByteArray(Clipperz.Base.serializeJSON(aValue)); |
148 | dataToEncrypt = Clipperz.Crypto.SHA.sha_d256(value).appendBlock(value); | 146 | dataToEncrypt = Clipperz.Crypto.SHA.sha_d256(value).appendBlock(value); |
149 | 147 | ||
150 | deferredResult = new Clipperz.Async.Deferred("Crypto[0.2].deferredEncrypt") | 148 | deferredResult = new Clipperz.Async.Deferred("Crypto[0.2].deferredEncrypt") |
151 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncrypt, key, dataToEncrypt, aNonce); | 149 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncrypt, key, dataToEncrypt, aNonce); |
152 | deferredResult.addCallback(function(aResult) { | 150 | deferredResult.addCallback(function(aResult) { |
153 | return aResult.toBase64String(); | 151 | return aResult.toBase64String(); |
154 | }) | 152 | }) |
155 | deferredResult.callback(); | 153 | deferredResult.callback(); |
156 | 154 | ||
157 | return deferredResult; | 155 | return deferredResult; |
158 | }, | 156 | }, |
159 | 157 | ||
160 | 'decrypt': function(aKey, aValue) { | 158 | 'decrypt': function(aKey, aValue) { |
161 | var result; | 159 | var result; |
162 | 160 | ||
163 | if (aValue != null) { | 161 | if (aValue != null) { |
164 | var key, value; | 162 | var key, value; |
165 | var decryptedData; | 163 | var decryptedData; |
166 | var decryptedValue; | 164 | var decryptedValue; |
167 | 165 | ||
168 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); | 166 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); |
169 | value = new Clipperz.ByteArray().appendBase64String(aValue); | 167 | value = new Clipperz.ByteArray().appendBase64String(aValue); |
170 | 168 | ||
171 | decryptedData = Clipperz.Crypto.AES.decrypt(key, value); | 169 | decryptedData = Clipperz.Crypto.AES.decrypt(key, value); |
172 | decryptedValue = decryptedData.split((256/8)); | 170 | decryptedValue = decryptedData.split((256/8)); |
173 | 171 | ||
174 | try { | 172 | try { |
175 | result = Clipperz.Base.evalJSON(decryptedValue.asString()); | 173 | result = Clipperz.Base.evalJSON(decryptedValue.asString()); |
176 | } catch (exception) { | 174 | } catch (exception) { |
177 | MochiKit.Logging.logError("Error while decrypting data [1]"); | 175 | Clipperz.logError("Error while decrypting data [1]"); |
178 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; | 176 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; |
179 | } | 177 | } |
180 | } else { | 178 | } else { |
181 | result = null; | 179 | result = null; |
182 | } | 180 | } |
183 | 181 | ||
184 | return result; | 182 | return result; |
185 | }, | 183 | }, |
186 | 184 | ||
187 | 'deferredDecrypt': function(aKey, aValue) { | 185 | 'deferredDecrypt': function(aKey, aValue) { |
188 | var result; | 186 | var result; |
189 | 187 | ||
190 | if (aValue != null) { | 188 | if (aValue != null) { |
191 | var deferredResult; | 189 | var deferredResult; |
192 | var key, value; | 190 | var key, value; |
193 | // var decryptedData; | 191 | // var decryptedData; |
194 | 192 | ||
195 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); | 193 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); |
196 | value = new Clipperz.ByteArray().appendBase64String(aValue); | 194 | value = new Clipperz.ByteArray().appendBase64String(aValue); |
197 | 195 | ||
198 | deferredResult = new Clipperz.Async.Deferred("Crypto.[0.2].deferredDecrypt"); | 196 | deferredResult = new Clipperz.Async.Deferred("Crypto.[0.2].deferredDecrypt"); |
199 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredDecrypt, key, value); | 197 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredDecrypt, key, value); |
200 | deferredResult.addCallback(function(aResult) { | 198 | deferredResult.addCallback(function(aResult) { |
201 | var result; | 199 | var result; |
202 | var decryptedData; | 200 | var decryptedData; |
203 | 201 | ||
204 | decryptedData = aResult.split((256/8)); | 202 | decryptedData = aResult.split((256/8)); |
205 | 203 | ||
206 | try { | 204 | try { |
207 | result = Clipperz.Base.evalJSON(decryptedData.asString()); | 205 | result = Clipperz.Base.evalJSON(decryptedData.asString()); |
208 | } catch (exception) { | 206 | } catch (exception) { |
209 | MochiKit.Logging.logError("Error while decrypting data [2]"); | 207 | Clipperz.logError("Error while decrypting data [2]"); |
210 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; | 208 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; |
211 | } | 209 | } |
212 | 210 | ||
213 | return result; | 211 | return result; |
214 | }) | 212 | }) |
215 | deferredResult.callback(); | 213 | deferredResult.callback(); |
216 | 214 | ||
217 | result = deferredResult; | 215 | result = deferredResult; |
218 | } else { | 216 | } else { |
219 | result = MochiKit.Async.succeed(null); | 217 | result = MochiKit.Async.succeed(null); |
220 | } | 218 | } |
221 | 219 | ||
222 | return result; | 220 | return result; |
223 | }, | 221 | }, |
224 | 222 | ||
225 | 'hash': Clipperz.Crypto.SHA.sha_d256, | 223 | 'hash': Clipperz.Crypto.SHA.sha_d256, |
226 | 224 | ||
227 | 'deriveKey': function(aStringValue) { | 225 | 'deriveKey': function(aStringValue) { |
228 | varbyteData; | 226 | varbyteData; |
229 | var result; | 227 | var result; |
230 | 228 | ||
231 | byteData = new Clipperz.ByteArray(aStringValue); | 229 | byteData = new Clipperz.ByteArray(aStringValue); |
232 | result = Clipperz.Crypto.SHA.sha_d256(byteData); | 230 | result = Clipperz.Crypto.SHA.sha_d256(byteData); |
233 | 231 | ||
234 | return result; | 232 | return result; |
235 | } | 233 | } |
236 | }, | 234 | }, |
237 | 235 | ||
238 | //##################################################################### | 236 | //##################################################################### |
239 | 237 | ||
240 | '0.3': { | 238 | '0.3': { |
241 | 'encrypt': function(aKey, aValue, aNonce) { | 239 | 'encrypt': function(aKey, aValue, aNonce) { |
242 | var result; | 240 | var result; |
243 | varkey, value; | 241 | varkey, value; |
244 | var data; | 242 | var data; |
245 | var dataToEncrypt; | 243 | var dataToEncrypt; |
246 | var encryptedData; | 244 | var encryptedData; |
247 | 245 | ||
248 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); | 246 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); |
249 | value = Clipperz.Base.serializeJSON(aValue); | 247 | value = Clipperz.Base.serializeJSON(aValue); |
250 | data = new Clipperz.ByteArray(value); | 248 | data = new Clipperz.ByteArray(value); |
251 | encryptedData = Clipperz.Crypto.AES.encrypt(key, data, aNonce); | 249 | encryptedData = Clipperz.Crypto.AES.encrypt(key, data, aNonce); |
252 | result = encryptedData.toBase64String(); | 250 | result = encryptedData.toBase64String(); |
253 | 251 | ||
254 | return result; | 252 | return result; |
255 | }, | 253 | }, |
256 | 254 | ||
257 | 'deferredEncrypt': function(aKey, aValue, aNonce) { | 255 | 'deferredEncrypt': function(aKey, aValue, aNonce) { |
258 | var deferredResult; | 256 | var deferredResult; |
259 | varkey, value; | 257 | varkey, value; |
260 | var data; | 258 | var data; |
261 | var dataToEncrypt; | 259 | var dataToEncrypt; |
262 | var encryptedData; | 260 | var encryptedData; |
263 | 261 | ||
264 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); | 262 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); |
265 | value = Clipperz.Base.serializeJSON(aValue); | 263 | value = Clipperz.Base.serializeJSON(aValue); |
266 | data = new Clipperz.ByteArray(value); | 264 | data = new Clipperz.ByteArray(value); |
267 | 265 | ||
268 | deferredResult = new Clipperz.Async.Deferred("Crypto[0.3].deferredEncrypt") | 266 | deferredResult = new Clipperz.Async.Deferred("Crypto[0.3].deferredEncrypt") |
269 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncrypt, key, data, aNonce); | 267 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncrypt, key, data, aNonce); |
270 | deferredResult.addCallback(function(aResult) { | 268 | deferredResult.addCallback(function(aResult) { |
271 | return aResult.toBase64String(); | 269 | return aResult.toBase64String(); |
272 | }) | 270 | }) |
273 | deferredResult.callback(); | 271 | deferredResult.callback(); |
274 | 272 | ||
275 | return deferredResult; | 273 | return deferredResult; |
276 | }, | 274 | }, |
277 | 275 | ||
278 | 'decrypt': function(aKey, aValue) { | 276 | 'decrypt': function(aKey, aValue) { |
279 | var result; | 277 | var result; |
280 | 278 | ||
281 | if (aValue != null) { | 279 | if (aValue != null) { |
282 | var key, value; | 280 | var key, value; |
283 | var decryptedData; | 281 | var decryptedData; |
284 | 282 | ||
285 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); | 283 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); |
286 | value = new Clipperz.ByteArray().appendBase64String(aValue); | 284 | value = new Clipperz.ByteArray().appendBase64String(aValue); |
287 | 285 | ||
288 | decryptedData = Clipperz.Crypto.AES.decrypt(key, value); | 286 | decryptedData = Clipperz.Crypto.AES.decrypt(key, value); |
289 | 287 | ||
290 | value = decryptedData.asString(); | 288 | value = decryptedData.asString(); |
291 | try { | 289 | try { |
292 | result = Clipperz.Base.evalJSON(value); | 290 | result = Clipperz.Base.evalJSON(value); |
293 | } catch (exception) { | 291 | } catch (exception) { |
294 | MochiKit.Logging.logError("Error while decrypting data [3]"); | 292 | Clipperz.logError("Error while decrypting data [3]"); |
295 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; | 293 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; |
296 | } | 294 | } |
297 | } else { | 295 | } else { |
298 | result = null; | 296 | result = null; |
299 | } | 297 | } |
300 | 298 | ||
301 | return result; | 299 | return result; |
302 | }, | 300 | }, |
303 | 301 | ||
304 | 'deferredDecrypt': function(aKey, aValue) { | 302 | 'deferredDecrypt': function(aKey, aValue) { |
305 | var deferredResult; | 303 | var deferredResult; |
306 | 304 | ||
307 | deferredResult = new Clipperz.Async.Deferred("Crypto[0.3].deferredDecrypt", {trace: false}); | 305 | deferredResult = new Clipperz.Async.Deferred("Crypto[0.3].deferredDecrypt", {trace: false}); |
308 | // now = new Date; | 306 | // now = new Date; |
309 | 307 | ||
310 | if (aValue != null) { | 308 | if (aValue != null) { |
311 | var key, value; | 309 | var key, value; |
312 | // var decryptedData; | 310 | // var decryptedData; |
313 | 311 | ||
314 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); | 312 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); |
315 | value = new Clipperz.ByteArray().appendBase64String(aValue); | 313 | value = new Clipperz.ByteArray().appendBase64String(aValue); |
316 | 314 | ||
317 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredDecrypt, key, value); | 315 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredDecrypt, key, value); |
318 | deferredResult.addCallback(MochiKit.Async.wait, 0.1); | 316 | deferredResult.addCallback(MochiKit.Async.wait, 0.1); |
319 | deferredResult.addCallback(function(aResult) { | 317 | deferredResult.addCallback(function(aResult) { |
320 | return aResult.asString(); | 318 | return aResult.asString(); |
321 | }); | 319 | }); |
322 | deferredResult.addCallback(MochiKit.Async.wait, 0.1); | 320 | deferredResult.addCallback(MochiKit.Async.wait, 0.1); |
323 | deferredResult.addCallback(Clipperz.Base.evalJSON); | 321 | deferredResult.addCallback(Clipperz.Base.evalJSON); |
324 | deferredResult.addErrback(function(anError) { | 322 | deferredResult.addErrback(function(anError) { |
325 | MochiKit.Logging.logError("Error while decrypting data [4]"); | 323 | Clipperz.logError("Error while decrypting data [4]"); |
326 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; | 324 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; |
327 | }) | 325 | }) |
328 | } else { | 326 | } else { |
329 | deferredResult.addCallback(function() { | 327 | deferredResult.addCallback(function() { |
330 | return null; | 328 | return null; |
331 | }); | 329 | }); |
332 | } | 330 | } |
333 | deferredResult.callback(); | 331 | deferredResult.callback(); |
334 | 332 | ||
335 | return deferredResult; | 333 | return deferredResult; |
336 | }, | 334 | }, |
337 | 335 | ||
338 | 'hash': Clipperz.Crypto.SHA.sha_d256, | 336 | 'hash': Clipperz.Crypto.SHA.sha_d256, |
339 | 337 | ||
340 | 'deriveKey': function(aStringValue) { | 338 | 'deriveKey': function(aStringValue) { |
341 | varbyteData; | 339 | varbyteData; |
342 | var result; | 340 | var result; |
343 | 341 | ||
344 | byteData = new Clipperz.ByteArray(aStringValue); | 342 | byteData = new Clipperz.ByteArray(aStringValue); |
345 | result = Clipperz.Crypto.SHA.sha_d256(byteData); | 343 | result = Clipperz.Crypto.SHA.sha_d256(byteData); |
346 | 344 | ||
347 | return result; | 345 | return result; |
348 | } | 346 | } |
349 | 347 | ||
350 | }, | 348 | }, |
351 | 349 | ||
352 | //##################################################################### | 350 | //##################################################################### |
353 | /* | 351 | /* |
354 | '0.4': { | 352 | '0.4': { |
355 | 'encrypt': function(aKey, aValue, aNonce) { | 353 | 'encrypt': function(aKey, aValue, aNonce) { |
356 | var result; | 354 | var result; |
357 | varkey, value; | 355 | varkey, value; |
358 | var data; | 356 | var data; |
359 | var dataToEncrypt; | 357 | var dataToEncrypt; |
360 | var encryptedData; | 358 | var encryptedData; |
361 | 359 | ||
362 | //MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt"); | 360 | //Clipperz.logDebug(">>> [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt"); |
363 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); | 361 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); |
364 | //MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 1"); | 362 | //Clipperz.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 1"); |
365 | value = Clipperz.Base.serializeJSON(aValue); | 363 | value = Clipperz.Base.serializeJSON(aValue); |
366 | //MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 2"); | 364 | //Clipperz.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 2"); |
367 | / * | 365 | / * |
368 | //MochiKit.Logging.logDebug("--> encrypt.fullSize: " + value.length); | 366 | //Clipperz.logDebug("--> encrypt.fullSize: " + value.length); |
369 | value = value.replace(/":{"label":"/g, '":{l:"'); | 367 | value = value.replace(/":{"label":"/g, '":{l:"'); |
370 | value = value.replace(/":{"key":"/g, '":{k:"'); | 368 | value = value.replace(/":{"key":"/g, '":{k:"'); |
371 | value = value.replace(/":{"notes":"/g, '":{n:"'); | 369 | value = value.replace(/":{"notes":"/g, '":{n:"'); |
372 | value = value.replace(/":{"record":"/g, '":{r:"'); | 370 | value = value.replace(/":{"record":"/g, '":{r:"'); |
373 | value = value.replace(/", "label":"/g, '",l:"'); | 371 | value = value.replace(/", "label":"/g, '",l:"'); |
374 | value = value.replace(/", "favicon":"/g,'",f:"'); | 372 | value = value.replace(/", "favicon":"/g,'",f:"'); |
375 | //MochiKit.Logging.logDebug("<-- encrypt.compressed: " + value.length); | 373 | //Clipperz.logDebug("<-- encrypt.compressed: " + value.length); |
376 | * / | 374 | * / |
377 | data = new Clipperz.ByteArray(value); | 375 | data = new Clipperz.ByteArray(value); |
378 | //MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 3"); | 376 | //Clipperz.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 3"); |
379 | encryptedData = Clipperz.Crypto.AES.encrypt(key, data, aNonce); | 377 | encryptedData = Clipperz.Crypto.AES.encrypt(key, data, aNonce); |
380 | //MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 4"); | 378 | //Clipperz.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 4"); |
381 | result = encryptedData.toBase64String(); | 379 | result = encryptedData.toBase64String(); |
382 | //MochiKit.Logging.logDebug("<<< [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt"); | 380 | //Clipperz.logDebug("<<< [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt"); |
383 | 381 | ||
384 | return result; | 382 | return result; |
385 | }, | 383 | }, |
386 | 384 | ||
387 | 'decrypt': function(aKey, aValue) { | 385 | 'decrypt': function(aKey, aValue) { |
388 | var result; | 386 | var result; |
389 | 387 | ||
390 | if (aValue != null) { | 388 | if (aValue != null) { |
391 | var key, value; | 389 | var key, value; |
392 | var decryptedData; | 390 | var decryptedData; |
393 | 391 | ||
394 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); | 392 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); |
395 | value = new Clipperz.ByteArray().appendBase64String(aValue); | 393 | value = new Clipperz.ByteArray().appendBase64String(aValue); |
396 | 394 | ||
397 | decryptedData = Clipperz.Crypto.AES.decrypt(key, value); | 395 | decryptedData = Clipperz.Crypto.AES.decrypt(key, value); |
398 | 396 | ||
399 | value = decryptedData.asString(); | 397 | value = decryptedData.asString(); |
400 | / * | 398 | / * |
401 | value = value.replace(/":{l:"/g,'":{"label":"'); | 399 | value = value.replace(/":{l:"/g,'":{"label":"'); |
402 | value = value.replace(/":{k:"/g,'":{"key":"'); | 400 | value = value.replace(/":{k:"/g,'":{"key":"'); |
403 | value = value.replace(/":{n:"/g,'":{"notes":"'); | 401 | value = value.replace(/":{n:"/g,'":{"notes":"'); |
404 | value = value.replace(/":{r:"/g,'":{"record":"'); | 402 | value = value.replace(/":{r:"/g,'":{"record":"'); |
405 | value = value.replace(/",l:"/g, '", "label":"'); | 403 | value = value.replace(/",l:"/g, '", "label":"'); |
406 | value = value.replace(/",f:"/g, '", "favicon":"'); | 404 | value = value.replace(/",f:"/g, '", "favicon":"'); |
407 | * / | 405 | * / |
408 | try { | 406 | try { |
409 | result = Clipperz.Base.evalJSON(value); | 407 | result = Clipperz.Base.evalJSON(value); |
410 | } catch (exception) { | 408 | } catch (exception) { |
411 | MochiKit.Logging.logError("Error while decrypting data"); | 409 | Clipperz.logError("Error while decrypting data"); |
412 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; | 410 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; |
413 | } | 411 | } |
414 | 412 | ||
415 | 413 | ||
416 | } else { | 414 | } else { |
417 | result = null; | 415 | result = null; |
418 | } | 416 | } |
419 | 417 | ||
420 | return result; | 418 | return result; |
421 | }, | 419 | }, |
422 | 420 | ||
423 | 'hash': Clipperz.Crypto.SHA.sha_d256 | 421 | 'hash': Clipperz.Crypto.SHA.sha_d256 |
424 | }, | 422 | }, |
425 | */ | 423 | */ |
426 | //##################################################################### | 424 | //##################################################################### |
427 | __syntaxFix__: "syntax fix" | 425 | __syntaxFix__: "syntax fix" |
428 | } | 426 | } |
429 | }, | 427 | }, |
430 | 428 | ||
431 | //------------------------------------------------------------------------- | 429 | //------------------------------------------------------------------------- |
432 | 430 | ||
433 | 'encrypt': function(aKey, aValue, aVersion) { | 431 | 'encrypt': function(aKey, aValue, aVersion) { |
434 | return Clipperz.PM.Crypto.encryptingFunctions.versions[aVersion].encrypt(aKey, aValue); | 432 | return Clipperz.PM.Crypto.encryptingFunctions.versions[aVersion].encrypt(aKey, aValue); |
435 | }, | 433 | }, |
436 | 434 | ||
437 | 'deferredEncrypt': function(someParameters) { | 435 | 'deferredEncrypt': function(someParameters) { |
438 | return Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters['version']].deferredEncrypt(someParameters['key'], someParameters['value']); | 436 | return Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters['version']].deferredEncrypt(someParameters['key'], someParameters['value']); |
439 | }, | 437 | }, |
440 | 438 | ||
441 | //......................................................................... | 439 | //......................................................................... |
442 | 440 | ||
443 | 'decrypt': function(aKey, aValue, aVersion) { | 441 | 'decrypt': function(aKey, aValue, aVersion) { |
444 | return Clipperz.PM.Crypto.encryptingFunctions.versions[aVersion].decrypt(aKey, aValue); | 442 | return Clipperz.PM.Crypto.encryptingFunctions.versions[aVersion].decrypt(aKey, aValue); |
445 | }, | 443 | }, |
446 | 444 | ||
447 | 'deferredDecrypt': function(someParameters) { | 445 | 'deferredDecrypt': function(someParameters) { |
448 | return Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters['version']].deferredDecrypt(someParameters['key'], someParameters['value']); | 446 | return Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters['version']].deferredDecrypt(someParameters['key'], someParameters['value']); |
449 | }, | 447 | }, |
450 | 448 | ||
451 | //------------------------------------------------------------------------- | 449 | //------------------------------------------------------------------------- |
452 | 450 | ||
453 | 'hash': function(aValue) { | 451 | 'hash': function(aValue) { |
454 | return Clipperz.PM.Crypto.encryptingFunctions.versions[Clipperz.PM.Crypto.encryptingFunctions.currentVersion]['hash'](aValue); | 452 | return Clipperz.PM.Crypto.encryptingFunctions.versions[Clipperz.PM.Crypto.encryptingFunctions.currentVersion]['hash'](aValue); |
455 | }, | 453 | }, |
456 | 454 | ||
457 | //------------------------------------------------------------------------- | 455 | //------------------------------------------------------------------------- |
458 | 456 | ||
459 | 'randomKey': function() { | 457 | 'randomKey': function() { |
460 | return Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2); | 458 | return Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2); |
461 | }, | 459 | }, |
462 | 460 | ||
463 | //------------------------------------------------------------------------- | 461 | //------------------------------------------------------------------------- |
464 | 462 | ||
465 | 'deriveKey': function(aValue) { | 463 | 'deriveKey': function(aValue) { |
466 | return Clipperz.PM.Crypto.encryptingFunctions.versions[Clipperz.PM.Crypto.encryptingFunctions.currentVersion].deriveKey(aValue); | 464 | return Clipperz.PM.Crypto.encryptingFunctions.versions[Clipperz.PM.Crypto.encryptingFunctions.currentVersion].deriveKey(aValue); |
467 | }, | 465 | }, |
468 | 466 | ||
469 | //------------------------------------------------------------------------- | 467 | //------------------------------------------------------------------------- |
470 | 468 | ||
471 | 'passwordEntropy': function(aValue) { | 469 | 'passwordEntropy': function(aValue) { |
472 | var result; | 470 | var result; |
473 | varbitPerChar; | 471 | varbitPerChar; |
474 | 472 | ||
475 | bitPerChar = 4; | 473 | bitPerChar = 4; |
476 | if (/[a-z]/.test(aValue)) { | 474 | if (/[a-z]/.test(aValue)) { |
477 | bitPerChar ++; | 475 | bitPerChar ++; |
478 | } | 476 | } |
479 | if (/[A-Z]/.test(aValue)) { | 477 | if (/[A-Z]/.test(aValue)) { |
480 | bitPerChar ++; | 478 | bitPerChar ++; |
481 | } | 479 | } |
482 | if (/[^a-zA-Z0-9]/.test(aValue)) { | 480 | if (/[^a-zA-Z0-9]/.test(aValue)) { |
483 | bitPerChar ++; | 481 | bitPerChar ++; |
484 | } | 482 | } |
485 | 483 | ||
486 | result = aValue.length * bitPerChar; | 484 | result = aValue.length * bitPerChar; |
487 | 485 | ||
488 | return result; | 486 | return result; |
489 | }, | 487 | }, |
490 | 488 | ||
491 | //------------------------------------------------------------------------- | 489 | //------------------------------------------------------------------------- |
492 | 490 | ||
493 | 'nullValue': '####', | 491 | 'nullValue': '####', |
494 | 492 | ||
495 | //------------------------------------------------------------------------- | 493 | //------------------------------------------------------------------------- |
496 | __syntaxFix__: "syntax fix" | 494 | __syntaxFix__: "syntax fix" |
497 | 495 | ||
498 | }); | 496 | }); |
499 | 497 | ||
500 | //***************************************************************************** | 498 | //***************************************************************************** |
501 | 499 | ||
502 | //MochiKit.Base.update(Clipperz.PM.Connection.communicationProtocol.versions, { | 500 | //MochiKit.Base.update(Clipperz.PM.Connection.communicationProtocol.versions, { |
503 | //'current': Clipperz.PM.Connection.communicationProtocol.versions[Clipperz.PM.Connection.communicationProtocol.currentVersion] | 501 | //'current': Clipperz.PM.Connection.communicationProtocol.versions[Clipperz.PM.Connection.communicationProtocol.currentVersion] |
504 | //}); | 502 | //}); |
505 | 503 | ||
506 | MochiKit.Base.update(Clipperz.PM.Crypto.encryptingFunctions.versions, { | 504 | MochiKit.Base.update(Clipperz.PM.Crypto.encryptingFunctions.versions, { |
507 | 'current': Clipperz.PM.Crypto.encryptingFunctions.versions[Clipperz.PM.Crypto.encryptingFunctions.currentVersion] | 505 | 'current': Clipperz.PM.Crypto.encryptingFunctions.versions[Clipperz.PM.Crypto.encryptingFunctions.currentVersion] |
508 | }); | 506 | }); |
509 | 507 | ||
510 | //***************************************************************************** | 508 | //***************************************************************************** |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js index 8f8696d..507ee31 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js | |||
@@ -1,881 +1,871 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.DataModel'); | 24 | Clipperz.Base.module('Clipperz.PM.DataModel'); |
27 | 25 | ||
28 | Clipperz.PM.DataModel.DirectLogin = function(args) { | 26 | Clipperz.PM.DataModel.DirectLogin = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.DataModel.DirectLogin.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.DataModel.DirectLogin.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._reference =args.reference | 31 | this._reference =args.reference |
34 | ||Clipperz.PM.Crypto.randomKey(); | 32 | ||Clipperz.PM.Crypto.randomKey(); |
35 | this._record =args.record | 33 | this._record =args.record |
36 | ||Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | ||Clipperz.Base.exception.raise('MandatoryParameter'); |
37 | 35 | ||
38 | this._retrieveIndexDataFunction = args.retrieveIndexDataFunction | 36 | this._retrieveIndexDataFunction = args.retrieveIndexDataFunction |
39 | ||this.record().retrieveDirectLoginIndexDataFunction() | 37 | ||this.record().retrieveDirectLoginIndexDataFunction() |
40 | ||Clipperz.Base.exception.raise('MandatoryParameter'); | 38 | ||Clipperz.Base.exception.raise('MandatoryParameter'); |
41 | this._setIndexDataFunction = args.setIndexDataFunction | 39 | this._setIndexDataFunction = args.setIndexDataFunction |
42 | ||this.record().setDirectLoginIndexDataFunction() | 40 | ||this.record().setDirectLoginIndexDataFunction() |
43 | ||Clipperz.Base.exception.raise('MandatoryParameter'); | 41 | ||Clipperz.Base.exception.raise('MandatoryParameter'); |
44 | this._removeIndexDataFunction =args.removeIndexDataFunction | 42 | this._removeIndexDataFunction =args.removeIndexDataFunction |
45 | ||this.record().removeDirectLoginIndexDataFunction() | 43 | ||this.record().removeDirectLoginIndexDataFunction() |
46 | ||Clipperz.Base.exception.raise('MandatoryParameter'); | 44 | ||Clipperz.Base.exception.raise('MandatoryParameter'); |
47 | 45 | ||
48 | this._inputs = null; | 46 | this._inputs = null; |
49 | this._bindings = null; | 47 | this._bindings = null; |
50 | this._formValues = null; | 48 | this._formValues = null; |
51 | 49 | ||
52 | // this._inputsDeferredLock = new MochiKit.Async.DeferredLock(); | 50 | // this._inputsDeferredLock = new MochiKit.Async.DeferredLock(); |
53 | // this._bindingsDeferredLock = new MochiKit.Async.DeferredLock(); | 51 | // this._bindingsDeferredLock = new MochiKit.Async.DeferredLock(); |
54 | // this._formValuesDeferredLock = new MochiKit.Async.DeferredLock(); | 52 | // this._formValuesDeferredLock = new MochiKit.Async.DeferredLock(); |
55 | 53 | ||
56 | this._transientState = null; | 54 | this._transientState = null; |
57 | 55 | ||
58 | this._isBrandNew = MochiKit.Base.isUndefinedOrNull(args.reference); | 56 | this._isBrandNew = MochiKit.Base.isUndefinedOrNull(args.reference); |
59 | 57 | ||
60 | this.record().addDirectLogin(this); | 58 | this.record().addDirectLogin(this); |
61 | 59 | ||
62 | return this; | 60 | return this; |
63 | } | 61 | } |
64 | 62 | ||
65 | Clipperz.Base.extend(Clipperz.PM.DataModel.DirectLogin, Object, { | 63 | Clipperz.Base.extend(Clipperz.PM.DataModel.DirectLogin, Object, { |
66 | 64 | ||
67 | 'toString': function() { | 65 | 'toString': function() { |
68 | return "DirectLogin (" + this.reference() + ")"; | 66 | return "DirectLogin (" + this.reference() + ")"; |
69 | }, | 67 | }, |
70 | 68 | ||
71 | //========================================================================= | 69 | //========================================================================= |
72 | 70 | ||
73 | 'reference': function () { | 71 | 'reference': function () { |
74 | return this._reference; | 72 | return this._reference; |
75 | }, | 73 | }, |
76 | 74 | ||
77 | //------------------------------------------------------------------------- | 75 | //------------------------------------------------------------------------- |
78 | 76 | ||
79 | 'record': function () { | 77 | 'record': function () { |
80 | return this._record; | 78 | return this._record; |
81 | }, | 79 | }, |
82 | 80 | ||
83 | //========================================================================= | 81 | //========================================================================= |
84 | 82 | ||
85 | 'isBrandNew': function () { | 83 | 'isBrandNew': function () { |
86 | return this._isBrandNew; | 84 | return this._isBrandNew; |
87 | }, | 85 | }, |
88 | 86 | ||
89 | //========================================================================= | 87 | //========================================================================= |
90 | 88 | ||
91 | 'removeIndexDataFunction': function () { | 89 | 'removeIndexDataFunction': function () { |
92 | return this._removeIndexDataFunction; | 90 | return this._removeIndexDataFunction; |
93 | }, | 91 | }, |
94 | 92 | ||
95 | 'remove': function () { | 93 | 'remove': function () { |
96 | return Clipperz.Async.callbacks("DirectLogin.remove", [ | 94 | return Clipperz.Async.callbacks("DirectLogin.remove", [ |
97 | MochiKit.Base.partial(this.removeIndexDataFunction(), this.reference()), | 95 | MochiKit.Base.partial(this.removeIndexDataFunction(), this.reference()), |
98 | MochiKit.Base.method(this.record(), 'removeDirectLogin', this) | 96 | MochiKit.Base.method(this.record(), 'removeDirectLogin', this) |
99 | ], {trace:false}); | 97 | ], {trace:false}); |
100 | }, | 98 | }, |
101 | 99 | ||
102 | //========================================================================= | 100 | //========================================================================= |
103 | /* | 101 | /* |
104 | 'inputsDeferredLock': function () { | 102 | 'inputsDeferredLock': function () { |
105 | return this._inputsDeferredLock; | 103 | return this._inputsDeferredLock; |
106 | }, | 104 | }, |
107 | 105 | ||
108 | 'bindingsDeferredLock': function () { | 106 | 'bindingsDeferredLock': function () { |
109 | return this._bindingsDeferredLock; | 107 | return this._bindingsDeferredLock; |
110 | }, | 108 | }, |
111 | 109 | ||
112 | 'formValuesDeferredLock': function () { | 110 | 'formValuesDeferredLock': function () { |
113 | return this._formValuesDeferredLock; | 111 | return this._formValuesDeferredLock; |
114 | }, | 112 | }, |
115 | */ | 113 | */ |
116 | //========================================================================= | 114 | //========================================================================= |
117 | 115 | ||
118 | 'label': function () { | 116 | 'label': function () { |
119 | return this.getIndexDataForKey('label'); | 117 | return this.getIndexDataForKey('label'); |
120 | }, | 118 | }, |
121 | 119 | ||
122 | 'setLabelKeepingBackwardCompatibilityWithBeta': function (aValue) { | 120 | 'setLabelKeepingBackwardCompatibilityWithBeta': function (aValue) { |
123 | return Clipperz.Async.callbacks("DirectLogin.setLabelKeepingBackwardCompatibilityWithBeta", [ | 121 | return Clipperz.Async.callbacks("DirectLogin.setLabelKeepingBackwardCompatibilityWithBeta", [ |
124 | MochiKit.Base.method(this, 'setIndexDataForKey', 'label', aValue), | 122 | MochiKit.Base.method(this, 'setIndexDataForKey', 'label', aValue), |
125 | MochiKit.Base.method(this, 'setValue', 'label', aValue) | 123 | MochiKit.Base.method(this, 'setValue', 'label', aValue) |
126 | ], {trace:false}); | 124 | ], {trace:false}); |
127 | }, | 125 | }, |
128 | 126 | ||
129 | 'setLabel': function (aValue) { | 127 | 'setLabel': function (aValue) { |
130 | return this.setLabelKeepingBackwardCompatibilityWithBeta(aValue); | 128 | return this.setLabelKeepingBackwardCompatibilityWithBeta(aValue); |
131 | // return this.setIndexDataForKey('label', aValue); | 129 | // return this.setIndexDataForKey('label', aValue); |
132 | }, | 130 | }, |
133 | 131 | ||
134 | //========================================================================= | 132 | //========================================================================= |
135 | 133 | ||
136 | 'favicon': function () { | 134 | 'favicon': function () { |
137 | return this.getIndexDataForKey('favicon'); | 135 | return this.getIndexDataForKey('favicon'); |
138 | }, | 136 | }, |
139 | 137 | ||
140 | 'setFavicon': function (aValue) { | 138 | 'setFavicon': function (aValue) { |
141 | return this.setIndexDataForKey('favicon', aValue); | 139 | return this.setIndexDataForKey('favicon', aValue); |
142 | }, | 140 | }, |
143 | 141 | ||
144 | 'faviconUrlWithBookmarkletConfiguration': function (aBookmarkletConfiguration) { | 142 | 'faviconUrlWithBookmarkletConfiguration': function (aBookmarkletConfiguration) { |
145 | varresult; | 143 | varresult; |
146 | 144 | ||
147 | if (! MochiKit.Base.isUndefinedOrNull(aBookmarkletConfiguration['page']['favicon'])) { | 145 | if (! MochiKit.Base.isUndefinedOrNull(aBookmarkletConfiguration['page']['favicon'])) { |
148 | result = aBookmarkletConfiguration['page']['favicon']; | 146 | result = aBookmarkletConfiguration['page']['favicon']; |
149 | } else if (! MochiKit.Base.isUndefinedOrNull(aBookmarkletConfiguration['form']['attributes']['action'])) { | 147 | } else if (! MochiKit.Base.isUndefinedOrNull(aBookmarkletConfiguration['form']['attributes']['action'])) { |
150 | var actionUrl; | 148 | var actionUrl; |
151 | var hostname; | 149 | var hostname; |
152 | 150 | ||
153 | actionUrl = aBookmarkletConfiguration['form']['attributes']['action']; | 151 | actionUrl = aBookmarkletConfiguration['form']['attributes']['action']; |
154 | hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1'); | 152 | hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1'); |
155 | result = "http://" + hostname + "/favicon.ico"; | 153 | result = "http://" + hostname + "/favicon.ico"; |
156 | } else { | 154 | } else { |
157 | result = null; | 155 | result = null; |
158 | } | 156 | } |
159 | 157 | ||
160 | 158 | ||
161 | return result; | 159 | return result; |
162 | }, | 160 | }, |
163 | 161 | ||
164 | //------------------------------------------------------------------------- | 162 | //------------------------------------------------------------------------- |
165 | /* | 163 | /* |
166 | 'faviconData': function () { | 164 | 'faviconData': function () { |
167 | var regexp = new RegExp('^data\:\/\/.*', 'i'); | 165 | var regexp = new RegExp('^data\:\/\/.*', 'i'); |
168 | 166 | ||
169 | return Clipperz.Async.callbacks("DirectLogin.favicon", [ | 167 | return Clipperz.Async.callbacks("DirectLogin.favicon", [ |
170 | MochiKit.Base.method(this, 'getIndexDataForKey', 'favicon'), | 168 | MochiKit.Base.method(this, 'getIndexDataForKey', 'favicon'), |
171 | MochiKit.Base.method(regexp, 'test'), | 169 | MochiKit.Base.method(regexp, 'test'), |
172 | Clipperz.Async.deferredIf("is data URL", [ | 170 | Clipperz.Async.deferredIf("is data URL", [ |
173 | MochiKit.Base.method(this, 'getIndexDataForKey', 'favicon') | 171 | MochiKit.Base.method(this, 'getIndexDataForKey', 'favicon') |
174 | ], [ | 172 | ], [ |
175 | MochiKit.Base.method(this, 'transientState'), | 173 | MochiKit.Base.method(this, 'transientState'), |
176 | MochiKit.Base.itemgetter('faviconData'), | 174 | MochiKit.Base.itemgetter('faviconData'), |
177 | Clipperz.Async.deferredIf('has a chaced value for the favicon data', [ | 175 | Clipperz.Async.deferredIf('has a chaced value for the favicon data', [ |
178 | MochiKit.Base.operator.identity | 176 | MochiKit.Base.operator.identity |
179 | ], [ | 177 | ], [ |
180 | MochiKit.Base.method(this, 'getIndexDataForKey', 'favicon'), | 178 | MochiKit.Base.method(this, 'getIndexDataForKey', 'favicon'), |
181 | MochiKit.Base.method(this, 'loadFaviconDataFromURL') | 179 | MochiKit.Base.method(this, 'loadFaviconDataFromURL') |
182 | ]) | 180 | ]) |
183 | 181 | ||
184 | ]) | 182 | ]) |
185 | ], {trace:false}); | 183 | ], {trace:false}); |
186 | }, | 184 | }, |
187 | 185 | ||
188 | //------------------------------------------------------------------------- | 186 | //------------------------------------------------------------------------- |
189 | 187 | ||
190 | 'loadFaviconDataFromURL': function (anURL) { | 188 | 'loadFaviconDataFromURL': function (anURL) { |
191 | var deferredResult; | 189 | var deferredResult; |
192 | var image; | 190 | var image; |
193 | 191 | ||
194 | deferredResult = new Clipperz.Async.Deferred("DirectLogin.loadFaviconDataFromURL", {trace:false}); | 192 | deferredResult = new Clipperz.Async.Deferred("DirectLogin.loadFaviconDataFromURL", {trace:false}); |
195 | deferredResult.addCallback(function (anEvent) { | 193 | deferredResult.addCallback(function (anEvent) { |
196 | var image = anEvent.src(); | 194 | var image = anEvent.src(); |
197 | var canvas = document.createElement("canvas"); | 195 | var canvas = document.createElement("canvas"); |
198 | var result; | 196 | var result; |
199 | 197 | ||
200 | canvas.width = image.width; | 198 | canvas.width = image.width; |
201 | canvas.height = image.height; | 199 | canvas.height = image.height; |
202 | 200 | ||
203 | var ctx = canvas.getContext("2d"); | 201 | var ctx = canvas.getContext("2d"); |
204 | ctx.drawImage(image, 0, 0); | 202 | ctx.drawImage(image, 0, 0); |
205 | 203 | ||
206 | result = canvas.toDataURL(/*"image/png"* /); | 204 | result = canvas.toDataURL(/*"image/png"* /); |
207 | 205 | ||
208 | return result; | 206 | return result; |
209 | }); | 207 | }); |
210 | deferredResult.addErrback(MochiKit.Async.succeed, Clipperz.PM.Strings.getValue('defaultFaviconUrl')); | 208 | deferredResult.addErrback(MochiKit.Async.succeed, Clipperz.PM.Strings.getValue('defaultFaviconUrl')); |
211 | deferredResult.addBoth(MochiKit.Base.bind(function (aDataUrl) { | 209 | deferredResult.addBoth(MochiKit.Base.bind(function (aDataUrl) { |
212 | this.transientState()['faviconData'] = aDataUrl; | 210 | this.transientState()['faviconData'] = aDataUrl; |
213 | 211 | ||
214 | return aDataUrl; | 212 | return aDataUrl; |
215 | }, this)); | 213 | }, this)); |
216 | 214 | ||
217 | image = new Image(); | 215 | image = new Image(); |
218 | MochiKit.Signal.connect(image, 'onload', MochiKit.Base.method(deferredResult, 'callback')); | 216 | MochiKit.Signal.connect(image, 'onload', MochiKit.Base.method(deferredResult, 'callback')); |
219 | MochiKit.Signal.connect(image, 'onerror', MochiKit.Base.method(deferredResult, 'errback')); | 217 | MochiKit.Signal.connect(image, 'onerror', MochiKit.Base.method(deferredResult, 'errback')); |
220 | MochiKit.Signal.connect(image, 'onabort', MochiKit.Base.method(deferredResult, 'errback')); | 218 | MochiKit.Signal.connect(image, 'onabort', MochiKit.Base.method(deferredResult, 'errback')); |
221 | 219 | ||
222 | image.src = anURL; | 220 | image.src = anURL; |
223 | 221 | ||
224 | return deferredResult; | 222 | return deferredResult; |
225 | }, | 223 | }, |
226 | */ | 224 | */ |
227 | 225 | ||
228 | //========================================================================= | 226 | //========================================================================= |
229 | 227 | ||
230 | 'type': function () { | 228 | 'type': function () { |
231 | return this.getValue('formData.attributes.type') | 229 | return this.getValue('formData.attributes.type') |
232 | }, | 230 | }, |
233 | 231 | ||
234 | //========================================================================= | 232 | //========================================================================= |
235 | 233 | ||
236 | 'serializedData': function () { | 234 | 'serializedData': function () { |
237 | return Clipperz.Async.collectResults("DirectLogin.serializedData", { | 235 | return Clipperz.Async.collectResults("DirectLogin.serializedData", { |
238 | 'bookmarkletVersion': MochiKit.Base.method(this, 'getValue', 'bookmarkletVersion'), | 236 | 'bookmarkletVersion': MochiKit.Base.method(this, 'getValue', 'bookmarkletVersion'), |
239 | 'formData': MochiKit.Base.method(this, 'getValue', 'formData'), | 237 | 'formData': MochiKit.Base.method(this, 'getValue', 'formData'), |
240 | 'formValues': MochiKit.Base.method(this, 'getValue', 'formValues'), | 238 | 'formValues': MochiKit.Base.method(this, 'getValue', 'formValues'), |
241 | 'bindingData': [ | 239 | 'bindingData': [ |
242 | MochiKit.Base.method(this, 'bindings'), | 240 | MochiKit.Base.method(this, 'bindings'), |
243 | function (someBindings) { | 241 | function (someBindings) { |
244 | var result; | 242 | var result; |
245 | var bindingKey; | 243 | var bindingKey; |
246 | 244 | ||
247 | result = {} | 245 | result = {} |
248 | for (bindingKey in someBindings) { | 246 | for (bindingKey in someBindings) { |
249 | result[bindingKey] = someBindings[bindingKey].serializedData(); | 247 | result[bindingKey] = someBindings[bindingKey].serializedData(); |
250 | } | 248 | } |
251 | 249 | ||
252 | return result; | 250 | return result; |
253 | } | 251 | } |
254 | ] | 252 | ] |
255 | }, {trace:false})() | 253 | }, {trace:false})() |
256 | }, | 254 | }, |
257 | 255 | ||
258 | //========================================================================= | 256 | //========================================================================= |
259 | /* | 257 | /* |
260 | 'fixFormDataFromBookmarkletVersion_0_1': function(aValue) { | 258 | 'fixFormDataFromBookmarkletVersion_0_1': function(aValue) { |
261 | //{"type":"radio", "name":"action", "value":"new-user", "checked":false }, { "type":"radio", "name":"action", "value":"sign-in", "checked":true } | 259 | //{"type":"radio", "name":"action", "value":"new-user", "checked":false }, { "type":"radio", "name":"action", "value":"sign-in", "checked":true } |
262 | // || | 260 | // || |
263 | // \ / | 261 | // \ / |
264 | // \/ | 262 | // \/ |
265 | //{"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}]} | 263 | //{"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}]} |
266 | var result; | 264 | var result; |
267 | var inputs; | 265 | var inputs; |
268 | var updatedInputs; | 266 | var updatedInputs; |
269 | var radios; | 267 | var radios; |
270 | 268 | ||
271 | result = aValue; | 269 | result = aValue; |
272 | inputs = aValue['inputs']; | 270 | inputs = aValue['inputs']; |
273 | 271 | ||
274 | updatedInputs = MochiKit.Base.filter(function(anInput) { | 272 | updatedInputs = MochiKit.Base.filter(function(anInput) { |
275 | varresult; | 273 | varresult; |
276 | var type; | 274 | var type; |
277 | 275 | ||
278 | type = anInput['type'] || 'text'; | 276 | type = anInput['type'] || 'text'; |
279 | result = type.toLowerCase() != 'radio'; | 277 | result = type.toLowerCase() != 'radio'; |
280 | 278 | ||
281 | return result; | 279 | return result; |
282 | }, inputs); | 280 | }, inputs); |
283 | radios = MochiKit.Base.filter(function(anInput) { | 281 | radios = MochiKit.Base.filter(function(anInput) { |
284 | varresult; | 282 | varresult; |
285 | var type; | 283 | var type; |
286 | 284 | ||
287 | type = anInput['type'] || 'text'; | 285 | type = anInput['type'] || 'text'; |
288 | result = type.toLowerCase() == 'radio'; | 286 | result = type.toLowerCase() == 'radio'; |
289 | 287 | ||
290 | return result; | 288 | return result; |
291 | }, inputs); | 289 | }, inputs); |
292 | 290 | ||
293 | if (radios.length > 0) { | 291 | if (radios.length > 0) { |
294 | var updatedRadios; | 292 | var updatedRadios; |
295 | 293 | ||
296 | updatedRadios = {}; | 294 | updatedRadios = {}; |
297 | MochiKit.Iter.forEach(radios, MochiKit.Base.bind(function(aRadio) { | 295 | MochiKit.Iter.forEach(radios, MochiKit.Base.bind(function(aRadio) { |
298 | varradioConfiguration; | 296 | varradioConfiguration; |
299 | 297 | ||
300 | radioConfiguration = updatedRadios[aRadio['name']]; | 298 | radioConfiguration = updatedRadios[aRadio['name']]; |
301 | if (radioConfiguration == null) { | 299 | if (radioConfiguration == null) { |
302 | radioConfiguration = {type:'radio', name:aRadio['name'], options:[]}; | 300 | radioConfiguration = {type:'radio', name:aRadio['name'], options:[]}; |
303 | updatedRadios[aRadio['name']] = radioConfiguration; | 301 | updatedRadios[aRadio['name']] = radioConfiguration; |
304 | } | 302 | } |
305 | 303 | ||
306 | //TODO: remove the value: field and replace it with element.dom.value = <some value> | 304 | //TODO: remove the value: field and replace it with element.dom.value = <some value> |
307 | radioConfiguration.options.push({value:aRadio['value'], checked:aRadio['checked']}); | 305 | radioConfiguration.options.push({value:aRadio['value'], checked:aRadio['checked']}); |
308 | 306 | ||
309 | //TODO: shoud remove the 'formValues' call, as it is now deferred | 307 | //TODO: shoud remove the 'formValues' call, as it is now deferred |
310 | // if ((aRadio['checked'] == true) && (this.formValues()[aRadio['name']] == null)) { | 308 | // if ((aRadio['checked'] == true) && (this.formValues()[aRadio['name']] == null)) { |
311 | // this.formValues()[aRadio['name']] = aRadio['value']; | 309 | // this.formValues()[aRadio['name']] = aRadio['value']; |
312 | // } | 310 | // } |
313 | }, this)) | 311 | }, this)) |
314 | 312 | ||
315 | updatedInputs = MochiKit.Base.concat(updatedInputs, MochiKit.Base.values(updatedRadios)); | 313 | updatedInputs = MochiKit.Base.concat(updatedInputs, MochiKit.Base.values(updatedRadios)); |
316 | } | 314 | } |
317 | 315 | ||
318 | delete result.inputs; | 316 | delete result.inputs; |
319 | result.inputs = updatedInputs; | 317 | result.inputs = updatedInputs; |
320 | 318 | ||
321 | return result; | 319 | return result; |
322 | }, | 320 | }, |
323 | 321 | ||
324 | '_fixConfiguration': function (aConfiguration) { | 322 | '_fixConfiguration': function (aConfiguration) { |
325 | var fixedConfiguration; | 323 | var fixedConfiguration; |
326 | // var inputs; | 324 | // var inputs; |
327 | // var bindings; | 325 | // var bindings; |
328 | // var i,c; | 326 | // var i,c; |
329 | 327 | ||
330 | fixedConfiguration = Clipperz.Base.deepClone(aConfiguration); | 328 | fixedConfiguration = Clipperz.Base.deepClone(aConfiguration); |
331 | 329 | ||
332 | //console.log("PROCESS CONFIGURATION", aConfiguration); | 330 | //Clipperz.log("PROCESS CONFIGURATION", aConfiguration); |
333 | switch (aConfiguration['bookmarkletVersion']) { | 331 | switch (aConfiguration['bookmarkletVersion']) { |
334 | case '0.1': | 332 | case '0.1': |
335 | fixedConfiguration['formData'] = this.fixFormDataFromBookmarkletVersion_0_1(aConfiguration['formData']); | 333 | fixedConfiguration['formData'] = this.fixFormDataFromBookmarkletVersion_0_1(aConfiguration['formData']); |
336 | break; | 334 | break; |
337 | case '0.2': | 335 | case '0.2': |
338 | fixedConfiguration['formData'] = aConfiguration['formData']; | 336 | fixedConfiguration['formData'] = aConfiguration['formData']; |
339 | break; | 337 | break; |
340 | } | 338 | } |
341 | 339 | ||
342 | / * | 340 | / * |
343 | aConfiguration['_inputs'] = []; | 341 | aConfiguration['_inputs'] = []; |
344 | c = formData['inputs'].length; | 342 | c = formData['inputs'].length; |
345 | for (i=0; i<c; i++) { | 343 | for (i=0; i<c; i++) { |
346 | aConfiguration['_inputs'].push(new Clipperz.PM.DataModel.DirectLoginInput(formData['inputs'][i])); | 344 | aConfiguration['_inputs'].push(new Clipperz.PM.DataModel.DirectLoginInput(formData['inputs'][i])); |
347 | } | 345 | } |
348 | * / | 346 | * / |
349 | / * | 347 | / * |
350 | aConfiguration['_bindings'] = {}; | 348 | aConfiguration['_bindings'] = {}; |
351 | if (aConfiguration['legacyBindingData'] == null) { | 349 | if (aConfiguration['legacyBindingData'] == null) { |
352 | if (aConfiguration['bindingData'] != null) { | 350 | if (aConfiguration['bindingData'] != null) { |
353 | var bindingKey; | 351 | var bindingKey; |
354 | 352 | ||
355 | for (bindingKey in aConfiguration['bindingData']) { | 353 | for (bindingKey in aConfiguration['bindingData']) { |
356 | var newBinding; | 354 | var newBinding; |
357 | 355 | ||
358 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(bindingKey, {fieldKey:aConfiguration['bindingData'][bindingKey]}); | 356 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(bindingKey, {fieldKey:aConfiguration['bindingData'][bindingKey]}); |
359 | aConfiguration['_bindings'][newBinding.key()] = newBinding; | 357 | aConfiguration['_bindings'][newBinding.key()] = newBinding; |
360 | } | 358 | } |
361 | } else { | 359 | } else { |
362 | var editableFields; | 360 | var editableFields; |
363 | 361 | ||
364 | editableFields = MochiKit.Base.filter(function(aField) { | 362 | editableFields = MochiKit.Base.filter(function(aField) { |
365 | var result; | 363 | var result; |
366 | var type; | 364 | var type; |
367 | 365 | ||
368 | type = aField['type'].toLowerCase(); | 366 | type = aField['type'].toLowerCase(); |
369 | result = ((type != 'hidden') && (type != 'submit') && (type != 'checkbox') && (type != 'radio') && (type != 'select')); | 367 | result = ((type != 'hidden') && (type != 'submit') && (type != 'checkbox') && (type != 'radio') && (type != 'select')); |
370 | 368 | ||
371 | return result; | 369 | return result; |
372 | }, aConfiguration['_inputs']); | 370 | }, aConfiguration['_inputs']); |
373 | 371 | ||
374 | MochiKit.Iter.forEach(editableFields, MochiKit.Base.bind(function(anEditableField) { | 372 | MochiKit.Iter.forEach(editableFields, MochiKit.Base.bind(function(anEditableField) { |
375 | var newBinding; | 373 | var newBinding; |
376 | 374 | ||
377 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(anEditableField['name']); | 375 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(anEditableField['name']); |
378 | aConfiguration['_bindings'][newBinding.key()] = newBinding; | 376 | aConfiguration['_bindings'][newBinding.key()] = newBinding; |
379 | }, this)); | 377 | }, this)); |
380 | } | 378 | } |
381 | 379 | ||
382 | } else { | 380 | } else { |
383 | var bindingKey; | 381 | var bindingKey; |
384 | 382 | ||
385 | for (bindingKey in aConfiguration['legacyBindingData']) { | 383 | for (bindingKey in aConfiguration['legacyBindingData']) { |
386 | var newBinding; | 384 | var newBinding; |
387 | 385 | ||
388 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(bindingKey, {fieldName:aConfiguration['legacyBindingData'][bindingKey]}); | 386 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(bindingKey, {fieldName:aConfiguration['legacyBindingData'][bindingKey]}); |
389 | aConfiguration['_bindings'][newBinding.key()] = newBinding; | 387 | aConfiguration['_bindings'][newBinding.key()] = newBinding; |
390 | } | 388 | } |
391 | } | 389 | } |
392 | * / | 390 | * / |
393 | 391 | ||
394 | return fixedConfiguration; | 392 | return fixedConfiguration; |
395 | }, | 393 | }, |
396 | 394 | ||
397 | //------------------------------------------------------------------------- | 395 | //------------------------------------------------------------------------- |
398 | 396 | ||
399 | 'getObjectDataStore': function () { | 397 | 'getObjectDataStore': function () { |
400 | var deferredResult; | 398 | var deferredResult; |
401 | 399 | ||
402 | deferredResult = new Clipperz.Async.Deferred("DirectLogin.getObjectDataStore", {trace:false}); | 400 | deferredResult = new Clipperz.Async.Deferred("DirectLogin.getObjectDataStore", {trace:false}); |
403 | deferredResult.acquireLock(this.objectDataStoreDeferredLock()); | 401 | deferredResult.acquireLock(this.objectDataStoreDeferredLock()); |
404 | deferredResult.addCallback(MochiKit.Base.bind(function () { | 402 | deferredResult.addCallback(MochiKit.Base.bind(function () { |
405 | var innerDeferredResult; | 403 | var innerDeferredResult; |
406 | 404 | ||
407 | if (this._objectDataStore == null) { | 405 | if (this._objectDataStore == null) { |
408 | this._objectDataStore = new Clipperz.KeyValueObjectStore(); | 406 | this._objectDataStore = new Clipperz.KeyValueObjectStore(); |
409 | 407 | ||
410 | innerDeferredResult = new Clipperz.Async.Deferred("DirectLogin.getObjectDataStore <inner deferred>", {trace:false}); | 408 | innerDeferredResult = new Clipperz.Async.Deferred("DirectLogin.getObjectDataStore <inner deferred>", {trace:false}); |
411 | // innerDeferredResult.addMethod(this.record(), 'getValue', 'directLogins' + '.' + this.reference()); | 409 | // innerDeferredResult.addMethod(this.record(), 'getValue', 'directLogins' + '.' + this.reference()); |
412 | innerDeferredResult.addMethod(this, 'getValue', ''), | 410 | innerDeferredResult.addMethod(this, 'getValue', ''), |
413 | innerDeferredResult.addMethod(this, 'setOriginalState'); | 411 | innerDeferredResult.addMethod(this, 'setOriginalState'); |
414 | innerDeferredResult.addMethod(this, '_fixConfiguration'); | 412 | innerDeferredResult.addMethod(this, '_fixConfiguration'); |
415 | innerDeferredResult.addMethod(this._objectDataStore, 'initWithValues'); | 413 | innerDeferredResult.addMethod(this._objectDataStore, 'initWithValues'); |
416 | // innerDeferredResult.addMethod(this._objectDataStore, 'setValues'); | 414 | // innerDeferredResult.addMethod(this._objectDataStore, 'setValues'); |
417 | innerDeferredResult.callback(); | 415 | innerDeferredResult.callback(); |
418 | } else { | 416 | } else { |
419 | innerDeferredResult = MochiKit.Async.succeed(this._objectDataStore); | 417 | innerDeferredResult = MochiKit.Async.succeed(this._objectDataStore); |
420 | } | 418 | } |
421 | 419 | ||
422 | return innerDeferredResult; | 420 | return innerDeferredResult; |
423 | }, this)); | 421 | }, this)); |
424 | deferredResult.releaseLock(this.objectDataStoreDeferredLock()); | 422 | deferredResult.releaseLock(this.objectDataStoreDeferredLock()); |
425 | deferredResult.callback(); | 423 | deferredResult.callback(); |
426 | 424 | ||
427 | return deferredResult; | 425 | return deferredResult; |
428 | }, | 426 | }, |
429 | 427 | ||
430 | //------------------------------------------------------------------------- | 428 | //------------------------------------------------------------------------- |
431 | 429 | ||
432 | 'hasInitiatedObjectDataStore': function () { | 430 | 'hasInitiatedObjectDataStore': function () { |
433 | return (this._objectDataStore != null); | 431 | return (this._objectDataStore != null); |
434 | }, | 432 | }, |
435 | 433 | ||
436 | //------------------------------------------------------------------------- | 434 | //------------------------------------------------------------------------- |
437 | 435 | ||
438 | 'resetObjectDataStore': function () { | 436 | 'resetObjectDataStore': function () { |
439 | this._objectDataStore.removeAllData(); | 437 | this._objectDataStore.removeAllData(); |
440 | this._objectDataStore = null; | 438 | this._objectDataStore = null; |
441 | }, | 439 | }, |
442 | */ | 440 | */ |
443 | //========================================================================= | 441 | //========================================================================= |
444 | 442 | ||
445 | 'bookmarkletConfiguration': function () { | 443 | 'bookmarkletConfiguration': function () { |
446 | return Clipperz.Async.callbacks("DirectLogin.bookmarkletConfiguration", [ | 444 | return Clipperz.Async.callbacks("DirectLogin.bookmarkletConfiguration", [ |
447 | Clipperz.Async.collectResults("DirectLogin.bookmarkletConfiguration <inner results>", { | 445 | Clipperz.Async.collectResults("DirectLogin.bookmarkletConfiguration <inner results>", { |
448 | 'label': MochiKit.Base.method(this, 'label'), | 446 | 'label': MochiKit.Base.method(this, 'label'), |
449 | 'configuration': MochiKit.Base.method(this, 'getValue', '') | 447 | 'configuration': MochiKit.Base.method(this, 'getValue', '') |
450 | }, {trace:false}), | 448 | }, {trace:false}), |
451 | function (someValues) { | 449 | function (someValues) { |
452 | var result; | 450 | var result; |
453 | 451 | ||
454 | if (someValues['configuration'] != null) { | 452 | if (someValues['configuration'] != null) { |
455 | varconfiguration; | 453 | varconfiguration; |
456 | 454 | ||
457 | configuration = { | 455 | configuration = { |
458 | 'page': { | 456 | 'page': { |
459 | 'title': someValues['label'] | 457 | 'title': someValues['label'] |
460 | //'favicon' | 458 | //'favicon' |
461 | // 'url' | 459 | // 'url' |
462 | }, | 460 | }, |
463 | 'form': someValues['configuration']['formData'], | 461 | 'form': someValues['configuration']['formData'], |
464 | 'version':someValues['configuration']['bookmarkletVersion'] | 462 | 'version':someValues['configuration']['bookmarkletVersion'] |
465 | } | 463 | } |
466 | 464 | ||
467 | result = Clipperz.Base.formatJSON(configuration); | 465 | result = Clipperz.Base.formatJSON(configuration); |
468 | } else { | 466 | } else { |
469 | result = ''; | 467 | result = ''; |
470 | } | 468 | } |
471 | 469 | ||
472 | return result; | 470 | return result; |
473 | } | 471 | } |
474 | ], {trace:false}); | 472 | ], {trace:false}); |
475 | 473 | ||
476 | }, | 474 | }, |
477 | 475 | ||
478 | //------------------------------------------------------------------------- | 476 | //------------------------------------------------------------------------- |
479 | 477 | ||
480 | 'setBookmarkletConfiguration': function (aValue) { | 478 | 'setBookmarkletConfiguration': function (aValue) { |
481 | var bookmarkletConfiguration; | 479 | var bookmarkletConfiguration; |
482 | 480 | ||
483 | bookmarkletConfiguration = Clipperz.PM.DataModel.DirectLogin.checkBookmarkletConfiguration(aValue); | 481 | bookmarkletConfiguration = Clipperz.PM.DataModel.DirectLogin.checkBookmarkletConfiguration(aValue); |
484 | //console.log("BOOKMARKLET CONFIGURATION", bookmarkletConfiguration); | 482 | |
485 | return Clipperz.Async.callbacks("DirectLogin.setBookmarkletConfiguration", [ | 483 | return Clipperz.Async.callbacks("DirectLogin.setBookmarkletConfiguration", [ |
486 | MochiKit.Base.method(this, 'setValue', 'formData', bookmarkletConfiguration['form']), | 484 | MochiKit.Base.method(this, 'setValue', 'formData', bookmarkletConfiguration['form']), |
487 | //function (aValue) { console.log("SET VALUE - formData", aValue); return aValue; }, | ||
488 | MochiKit.Base.method(this, 'setValue', 'bookmarkletVersion', bookmarkletConfiguration['version']), | 485 | MochiKit.Base.method(this, 'setValue', 'bookmarkletVersion', bookmarkletConfiguration['version']), |
489 | 486 | ||
490 | MochiKit.Base.method(this, 'favicon'), | 487 | MochiKit.Base.method(this, 'favicon'), |
491 | Clipperz.Async.deferredIf("the favicon is not set", [ | 488 | Clipperz.Async.deferredIf("the favicon is not set", [ |
492 | ], [ | 489 | ], [ |
493 | MochiKit.Base.method(this, 'faviconUrlWithBookmarkletConfiguration', bookmarkletConfiguration), | 490 | MochiKit.Base.method(this, 'faviconUrlWithBookmarkletConfiguration', bookmarkletConfiguration), |
494 | MochiKit.Base.method(this, 'setFavicon') | 491 | MochiKit.Base.method(this, 'setFavicon') |
495 | ]), | 492 | ]), |
496 | 493 | ||
497 | MochiKit.Base.method(this, 'updateInputsAfterChangingBookmarkletConfiguration'), | 494 | MochiKit.Base.method(this, 'updateInputsAfterChangingBookmarkletConfiguration'), |
498 | MochiKit.Base.method(this, 'updateFormValuesAfterChangingBookmarkletConfiguration'), | 495 | MochiKit.Base.method(this, 'updateFormValuesAfterChangingBookmarkletConfiguration'), |
499 | MochiKit.Base.method(this, 'updateBindingsAfterChangingBookmarkletConfiguration'), | 496 | MochiKit.Base.method(this, 'updateBindingsAfterChangingBookmarkletConfiguration'), |
500 | 497 | ||
501 | MochiKit.Base.noop | 498 | MochiKit.Base.noop |
502 | ], {trace:false}); | 499 | ], {trace:false}); |
503 | }, | 500 | }, |
504 | 501 | ||
505 | //========================================================================= | 502 | //========================================================================= |
506 | 503 | ||
507 | 'formAttributes': function () { | 504 | 'formAttributes': function () { |
508 | return this.getValue('formData.attributes'); | 505 | return this.getValue('formData.attributes'); |
509 | }, | 506 | }, |
510 | 507 | ||
511 | //========================================================================= | 508 | //========================================================================= |
512 | 509 | ||
513 | 'inputs': function () { | 510 | 'inputs': function () { |
514 | return Clipperz.Async.callbacks("DirectLogin.inputs", [ | 511 | return Clipperz.Async.callbacks("DirectLogin.inputs", [ |
515 | Clipperz.Async.deferredIf("this._inputs is defined", [ | 512 | Clipperz.Async.deferredIf("this._inputs is defined", [ |
516 | ], [ | 513 | ], [ |
517 | MochiKit.Base.method(this, 'updateInputsAfterChangingBookmarkletConfiguration') | 514 | MochiKit.Base.method(this, 'updateInputsAfterChangingBookmarkletConfiguration') |
518 | ]) | 515 | ]) |
519 | ], {trace:false}, this._inputs); | 516 | ], {trace:false}, this._inputs); |
520 | }, | 517 | }, |
521 | 518 | ||
522 | 'setInputWithFormDataConfiguration': function (aFormDataConfiguration) { | 519 | 'setInputWithFormDataConfiguration': function (aFormDataConfiguration) { |
523 | this._inputs = {}; | 520 | this._inputs = {}; |
524 | 521 | ||
525 | if (aFormDataConfiguration != null) { | 522 | if (aFormDataConfiguration != null) { |
526 | MochiKit.Iter.forEach(aFormDataConfiguration['inputs'], MochiKit.Base.bind(function (anInputData) { | 523 | MochiKit.Iter.forEach(aFormDataConfiguration['inputs'], MochiKit.Base.bind(function (anInputData) { |
527 | var newInput; | 524 | var newInput; |
528 | 525 | ||
529 | newInput = new Clipperz.PM.DataModel.DirectLoginInput(anInputData); | 526 | newInput = new Clipperz.PM.DataModel.DirectLoginInput(anInputData); |
530 | this._inputs[newInput.name()] = newInput; | 527 | this._inputs[newInput.name()] = newInput; |
531 | }, this)); | 528 | }, this)); |
532 | } | 529 | } |
533 | 530 | ||
534 | return this._inputs; | 531 | return this._inputs; |
535 | }, | 532 | }, |
536 | 533 | ||
537 | 'updateInputsAfterChangingBookmarkletConfiguration': function () { | 534 | 'updateInputsAfterChangingBookmarkletConfiguration': function () { |
538 | return Clipperz.Async.callbacks("DirectLogin.updateInputsAfterChangingBookmarkletConfiguration", [ | 535 | return Clipperz.Async.callbacks("DirectLogin.updateInputsAfterChangingBookmarkletConfiguration", [ |
539 | // MochiKit.Base.method(this, 'getValue', ''), | ||
540 | //function (aValue) { console.log("VALUE", aValue); return aValue }, | ||
541 | MochiKit.Base.method(this, 'getValue', 'formData'), | 536 | MochiKit.Base.method(this, 'getValue', 'formData'), |
542 | //function (aValue) { console.log("FORM DATA", aValue); return aValue }, | ||
543 | MochiKit.Base.method(this, 'setInputWithFormDataConfiguration') | 537 | MochiKit.Base.method(this, 'setInputWithFormDataConfiguration') |
544 | ], {trace:false}); | 538 | ], {trace:false}); |
545 | }, | 539 | }, |
546 | 540 | ||
547 | //========================================================================= | 541 | //========================================================================= |
548 | 542 | ||
549 | 'inputValues': function () { | 543 | 'inputValues': function () { |
550 | return Clipperz.Async.callbacks("DirectLogin.inputValues", [ | 544 | return Clipperz.Async.callbacks("DirectLogin.inputValues", [ |
551 | MochiKit.Base.method(this, 'inputs'), | 545 | MochiKit.Base.method(this, 'inputs'), |
552 | MochiKit.Base.values, | 546 | MochiKit.Base.values, |
553 | //function (aValue) { console.log("INPUTS", aValue); return aValue; }, | ||
554 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.partial(MochiKit.Base.method(this, 'inputValue'))), | 547 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.partial(MochiKit.Base.method(this, 'inputValue'))), |
555 | Clipperz.Async.collectAll, | 548 | Clipperz.Async.collectAll, |
556 | Clipperz.Base.mergeItems | 549 | Clipperz.Base.mergeItems |
557 | ], {trace:false}); | 550 | ], {trace:false}); |
558 | }, | 551 | }, |
559 | 552 | ||
560 | 'inputValue': function (anInput) { | 553 | 'inputValue': function (anInput) { |
561 | vardeferredResult; | 554 | vardeferredResult; |
562 | 555 | ||
563 | deferredResult = new Clipperz.Async.Deferred("DirectLogin.inputValue", {trace:false}); | 556 | deferredResult = new Clipperz.Async.Deferred("DirectLogin.inputValue", {trace:false}); |
564 | 557 | ||
565 | if (anInput.needsFormValue()) { | 558 | if (anInput.needsFormValue()) { |
566 | deferredResult.addMethod(this, 'formValues'); | 559 | deferredResult.addMethod(this, 'formValues'); |
567 | deferredResult.addCallback(MochiKit.Base.itemgetter(anInput.name())); | 560 | deferredResult.addCallback(MochiKit.Base.itemgetter(anInput.name())); |
568 | deferredResult.addMethodcaller('value'); | 561 | deferredResult.addMethodcaller('value'); |
569 | } else if (anInput.needsBinding()) { | 562 | } else if (anInput.needsBinding()) { |
570 | deferredResult.addMethod(this, 'bindings'); | 563 | deferredResult.addMethod(this, 'bindings'); |
571 | deferredResult.addCallback(MochiKit.Base.itemgetter(anInput.name())); | 564 | deferredResult.addCallback(MochiKit.Base.itemgetter(anInput.name())); |
572 | deferredResult.addMethodcaller('field'); | 565 | deferredResult.addMethodcaller('field'); |
573 | deferredResult.addMethodcaller('value'); | 566 | deferredResult.addMethodcaller('value'); |
574 | } else { | 567 | } else { |
575 | deferredResult.addCallback(MochiKit.Async.succeed, anInput.value()); | 568 | deferredResult.addCallback(MochiKit.Async.succeed, anInput.value()); |
576 | } | 569 | } |
577 | deferredResult.addCallback(function (anActualValue) { | 570 | deferredResult.addCallback(function (anActualValue) { |
578 | return [anInput.name(), anActualValue]; | 571 | return [anInput.name(), anActualValue]; |
579 | }); | 572 | }); |
580 | 573 | ||
581 | deferredResult.callback(); | 574 | deferredResult.callback(); |
582 | 575 | ||
583 | return deferredResult; | 576 | return deferredResult; |
584 | }, | 577 | }, |
585 | 578 | ||
586 | //========================================================================= | 579 | //========================================================================= |
587 | 580 | ||
588 | 'bindings': function () { | 581 | 'bindings': function () { |
589 | return Clipperz.Async.callbacks("DirectLogin.bindings", [ | 582 | return Clipperz.Async.callbacks("DirectLogin.bindings", [ |
590 | Clipperz.Async.deferredIf("this._bindings is defined", [ | 583 | Clipperz.Async.deferredIf("this._bindings is defined", [ |
591 | ], [ | 584 | ], [ |
592 | MochiKit.Base.method(this, 'updateBindingsAfterChangingBookmarkletConfiguration'), | 585 | MochiKit.Base.method(this, 'updateBindingsAfterChangingBookmarkletConfiguration'), |
593 | MochiKit.Base.bind(function () { return this._bindings;}, this) | 586 | MochiKit.Base.bind(function () { return this._bindings;}, this) |
594 | ]) | 587 | ]) |
595 | ], {trace:false}, this._bindings); | 588 | ], {trace:false}, this._bindings); |
596 | }, | 589 | }, |
597 | 590 | ||
598 | 'bindFormFieldWithLabelToRecordFieldWithLabel': function (aFormFieldLabel, aRecordFieldLabel) { | 591 | 'bindFormFieldWithLabelToRecordFieldWithLabel': function (aFormFieldLabel, aRecordFieldLabel) { |
599 | return Clipperz.Async.callbacks("DirectLogin.bindFormFieldWithLabelToCardFieldWithLabel", [ | 592 | return Clipperz.Async.callbacks("DirectLogin.bindFormFieldWithLabelToCardFieldWithLabel", [ |
600 | Clipperz.Async.collectResults("DirectLogin.bindFormFieldWithLabelToCardFieldWithLabel - collect results", { | 593 | Clipperz.Async.collectResults("DirectLogin.bindFormFieldWithLabelToCardFieldWithLabel - collect results", { |
601 | 'binding': [ | 594 | 'binding': [ |
602 | MochiKit.Base.method(this, 'bindings'), | 595 | MochiKit.Base.method(this, 'bindings'), |
603 | MochiKit.Base.itemgetter(aFormFieldLabel) | 596 | MochiKit.Base.itemgetter(aFormFieldLabel) |
604 | ], | 597 | ], |
605 | 'field': [ | 598 | 'field': [ |
606 | MochiKit.Base.method(this.record(), 'fieldWithLabel', aRecordFieldLabel) | 599 | MochiKit.Base.method(this.record(), 'fieldWithLabel', aRecordFieldLabel) |
607 | ] | 600 | ] |
608 | }), | 601 | }), |
609 | function (someValues) { | 602 | function (someValues) { |
610 | someValues['binding'].setField(someValues['field']) | 603 | someValues['binding'].setField(someValues['field']) |
611 | } | 604 | } |
612 | ], {trace:false}); | 605 | ], {trace:false}); |
613 | }, | 606 | }, |
614 | 607 | ||
615 | //------------------------------------------------------------------------- | 608 | //------------------------------------------------------------------------- |
616 | /* | 609 | /* |
617 | 'bindingValues': function () { | 610 | 'bindingValues': function () { |
618 | return Clipperz.Async.callbacks("DirectLogin.bindingValues", [ | 611 | return Clipperz.Async.callbacks("DirectLogin.bindingValues", [ |
619 | Clipperz.Async.collectResults("DirectLogin.bindingValues [collectResults]", { | 612 | Clipperz.Async.collectResults("DirectLogin.bindingValues [collectResults]", { |
620 | 'fieldValues': [ | 613 | 'fieldValues': [ |
621 | MochiKit.Base.method(this, 'record'), | 614 | MochiKit.Base.method(this, 'record'), |
622 | MochiKit.Base.methodcaller('getFieldsValues') | 615 | MochiKit.Base.methodcaller('getFieldsValues') |
623 | ], | 616 | ], |
624 | 'bindings': MochiKit.Base.method(this, 'bindings') | 617 | 'bindings': MochiKit.Base.method(this, 'bindings') |
625 | }, {trace:false}), | 618 | }, {trace:false}), |
626 | function (someData) { | 619 | function (someData) { |
627 | var result; | 620 | var result; |
628 | varbindingKey; | 621 | varbindingKey; |
629 | 622 | ||
630 | result = {}; | 623 | result = {}; |
631 | for (bindingKey in someData['bindings']) { | 624 | for (bindingKey in someData['bindings']) { |
632 | result[bindingKey] = someData['fieldValues'][someData['bindings'][bindingKey].fieldKey()]['value']; | 625 | result[bindingKey] = someData['fieldValues'][someData['bindings'][bindingKey].fieldKey()]['value']; |
633 | } | 626 | } |
634 | 627 | ||
635 | return result; | 628 | return result; |
636 | } | 629 | } |
637 | ], {trace:false}); | 630 | ], {trace:false}); |
638 | }, | 631 | }, |
639 | */ | 632 | */ |
640 | //------------------------------------------------------------------------- | 633 | //------------------------------------------------------------------------- |
641 | 634 | ||
642 | 'updateBindingsAfterChangingBookmarkletConfiguration': function () { | 635 | 'updateBindingsAfterChangingBookmarkletConfiguration': function () { |
643 | return Clipperz.Async.callbacks("DirectLogin.updateBindingsAfterChangingBookmarkletConfiguration", [ | 636 | return Clipperz.Async.callbacks("DirectLogin.updateBindingsAfterChangingBookmarkletConfiguration", [ |
644 | Clipperz.Async.collectResults("DirectLogin.updateBindingsAfterChangingBookmarkletConfiguration<collect results>", { | 637 | Clipperz.Async.collectResults("DirectLogin.updateBindingsAfterChangingBookmarkletConfiguration<collect results>", { |
645 | 'currentValues':MochiKit.Base.method(this, 'getValue', ''), | 638 | 'currentValues':MochiKit.Base.method(this, 'getValue', ''), |
646 | 'originalValues':MochiKit.Base.method(this, 'originalConfiguration'), | 639 | 'originalValues':MochiKit.Base.method(this, 'originalConfiguration'), |
647 | 'inputs': MochiKit.Base.method(this, 'inputs') | 640 | 'inputs': MochiKit.Base.method(this, 'inputs') |
648 | }, {trace:false}), | 641 | }, {trace:false}), |
649 | MochiKit.Base.bind(function (someValues) { | 642 | MochiKit.Base.bind(function (someValues) { |
650 | var availableBindingValues; | 643 | var availableBindingValues; |
651 | var inputRequiringBindingValues; | 644 | var inputRequiringBindingValues; |
652 | var newBindingValues; | 645 | var newBindingValues; |
653 | 646 | ||
654 | if (MochiKit.Base.isUndefinedOrNull(someValues['originalValues']) || MochiKit.Base.isUndefinedOrNull(someValues['originalValues']['bindingData'])) { | 647 | if (MochiKit.Base.isUndefinedOrNull(someValues['originalValues']) || MochiKit.Base.isUndefinedOrNull(someValues['originalValues']['bindingData'])) { |
655 | availableBindingValues = {}; | 648 | availableBindingValues = {}; |
656 | } else { | 649 | } else { |
657 | availableBindingValues = Clipperz.Base.deepClone(someValues['originalValues']['bindingData']) | 650 | availableBindingValues = Clipperz.Base.deepClone(someValues['originalValues']['bindingData']) |
658 | } | 651 | } |
659 | 652 | ||
660 | if (someValues['currentValues'] != null) { | 653 | if (someValues['currentValues'] != null) { |
661 | MochiKit.Base.update(availableBindingValues, someValues['currentValues']['bindingData']); | 654 | MochiKit.Base.update(availableBindingValues, someValues['currentValues']['bindingData']); |
662 | } | 655 | } |
663 | 656 | ||
664 | this._bindings = {}; | 657 | this._bindings = {}; |
665 | newBindingValues = {} | 658 | newBindingValues = {} |
666 | MochiKit.Iter.forEach(MochiKit.Base.filter(MochiKit.Base.methodcaller('needsBinding'), MochiKit.Base.values(someValues['inputs'])), MochiKit.Base.bind(function (anInput) { | 659 | MochiKit.Iter.forEach(MochiKit.Base.filter(MochiKit.Base.methodcaller('needsBinding'), MochiKit.Base.values(someValues['inputs'])), MochiKit.Base.bind(function (anInput) { |
667 | varnewBinding; | 660 | varnewBinding; |
668 | 661 | ||
669 | newBindingValues[anInput.name()] = availableBindingValues[anInput.name()]; | 662 | newBindingValues[anInput.name()] = availableBindingValues[anInput.name()]; |
670 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, { | 663 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, { |
671 | 'key': anInput.name(), | 664 | 'key': anInput.name(), |
672 | 'field':availableBindingValues[anInput.name()] | 665 | 'field':availableBindingValues[anInput.name()] |
673 | }); | 666 | }); |
674 | 667 | ||
675 | this._bindings[anInput.name()] = newBinding; | 668 | this._bindings[anInput.name()] = newBinding; |
676 | }, this)) | 669 | }, this)) |
677 | //console.log("THIS._BINDINGS", this._bindings); | ||
678 | 670 | ||
679 | return newBindingValues; | 671 | return newBindingValues; |
680 | 672 | ||
681 | /* | 673 | /* |
682 | this._bindings = {}; | 674 | this._bindings = {}; |
683 | //console.log("CONFIGURATION", aConfiguration); | ||
684 | 675 | ||
685 | if (someValues['currentValues'] != null) { | 676 | if (someValues['currentValues'] != null) { |
686 | if (someValues['currentValues']['bindingData'] != null) { | 677 | if (someValues['currentValues']['bindingData'] != null) { |
687 | var bindingKey; | 678 | var bindingKey; |
688 | 679 | ||
689 | //console.log("BINDING DATA", someValues['currentValues']['bindingData']); | ||
690 | for (bindingKey in someValues['currentValues']['bindingData']) { | 680 | for (bindingKey in someValues['currentValues']['bindingData']) { |
691 | var newBinding; | 681 | var newBinding; |
692 | 682 | ||
693 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, { | 683 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, { |
694 | 'key': bindingKey, | 684 | 'key': bindingKey, |
695 | 'field':someValues['currentValues']['bindingData'][bindingKey] | 685 | 'field':someValues['currentValues']['bindingData'][bindingKey] |
696 | }); | 686 | }); |
697 | this._bindings[newBinding.key()] = newBinding; | 687 | this._bindings[newBinding.key()] = newBinding; |
698 | } | 688 | } |
699 | } else if (someValues['currentValues']['legacyBindingData'] == null) { | 689 | } else if (someValues['currentValues']['legacyBindingData'] == null) { |
700 | var bindingKey; | 690 | var bindingKey; |
701 | 691 | ||
702 | for (bindingKey in someValues['currentValues']['legacyBindingData']) { | 692 | for (bindingKey in someValues['currentValues']['legacyBindingData']) { |
703 | var newBinding; | 693 | var newBinding; |
704 | 694 | ||
705 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, { | 695 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, { |
706 | 'key': bindingKey, | 696 | 'key': bindingKey, |
707 | 'field':someValues['currentValues']['legacyBindingData'][bindingKey] | 697 | 'field':someValues['currentValues']['legacyBindingData'][bindingKey] |
708 | }); | 698 | }); |
709 | this._bindings[newBinding.key()] = newBinding; | 699 | this._bindings[newBinding.key()] = newBinding; |
710 | } | 700 | } |
711 | } else { | 701 | } else { |
712 | WTF = TODO; | 702 | WTF = TODO; |
713 | } | 703 | } |
714 | } | 704 | } |
715 | 705 | ||
716 | return this._bindings; | 706 | return this._bindings; |
717 | */ | 707 | */ |
718 | }, this), | 708 | }, this), |
719 | MochiKit.Base.method(this, 'setValue', 'bindingData') | 709 | MochiKit.Base.method(this, 'setValue', 'bindingData') |
720 | ], {trace:false}); | 710 | ], {trace:false}); |
721 | }, | 711 | }, |
722 | 712 | ||
723 | //========================================================================= | 713 | //========================================================================= |
724 | 714 | ||
725 | 'formValues': function () { | 715 | 'formValues': function () { |
726 | return Clipperz.Async.callbacks("DirectLogin.formValues", [ | 716 | return Clipperz.Async.callbacks("DirectLogin.formValues", [ |
727 | Clipperz.Async.deferredIf("this._formValues is defined", [ | 717 | Clipperz.Async.deferredIf("this._formValues is defined", [ |
728 | ], [ | 718 | ], [ |
729 | MochiKit.Base.method(this, 'updateFormValuesAfterChangingBookmarkletConfiguration'), | 719 | MochiKit.Base.method(this, 'updateFormValuesAfterChangingBookmarkletConfiguration'), |
730 | MochiKit.Base.bind(function () { return this._formValues;}, this) | 720 | MochiKit.Base.bind(function () { return this._formValues;}, this) |
731 | ]) | 721 | ]) |
732 | ], {trace:false}, this._formValues); | 722 | ], {trace:false}, this._formValues); |
733 | }, | 723 | }, |
734 | 724 | ||
735 | //------------------------------------------------------------------------- | 725 | //------------------------------------------------------------------------- |
736 | 726 | ||
737 | 'updateFormValuesAfterChangingBookmarkletConfiguration': function () { | 727 | 'updateFormValuesAfterChangingBookmarkletConfiguration': function () { |
738 | return Clipperz.Async.callbacks("DirectLogin.updateFormValuesAfterChangingBookmarkletConfiguration", [ | 728 | return Clipperz.Async.callbacks("DirectLogin.updateFormValuesAfterChangingBookmarkletConfiguration", [ |
739 | Clipperz.Async.collectResults("DirectLogin.updateFormValuesAfterChangingBookmarkletConfiguration <collect results>", { | 729 | Clipperz.Async.collectResults("DirectLogin.updateFormValuesAfterChangingBookmarkletConfiguration <collect results>", { |
740 | 'currentValues':MochiKit.Base.method(this, 'getValue', ''), | 730 | 'currentValues':MochiKit.Base.method(this, 'getValue', ''), |
741 | 'originalValues':MochiKit.Base.method(this, 'originalConfiguration'), | 731 | 'originalValues':MochiKit.Base.method(this, 'originalConfiguration'), |
742 | 'inputs': MochiKit.Base.method(this, 'inputs') | 732 | 'inputs': MochiKit.Base.method(this, 'inputs') |
743 | }, {trace:false}), | 733 | }, {trace:false}), |
744 | MochiKit.Base.bind(function (someValues) { | 734 | MochiKit.Base.bind(function (someValues) { |
745 | var availableFormValues; | 735 | var availableFormValues; |
746 | var inputRequiringFormValues; | 736 | var inputRequiringFormValues; |
747 | var newFormValues; | 737 | var newFormValues; |
748 | 738 | ||
749 | if (MochiKit.Base.isUndefinedOrNull(someValues['originalValues']) || MochiKit.Base.isUndefinedOrNull(someValues['originalValues']['formValues'])) { | 739 | if (MochiKit.Base.isUndefinedOrNull(someValues['originalValues']) || MochiKit.Base.isUndefinedOrNull(someValues['originalValues']['formValues'])) { |
750 | availableFormValues = {}; | 740 | availableFormValues = {}; |
751 | } else { | 741 | } else { |
752 | availableFormValues = Clipperz.Base.deepClone(someValues['originalValues']['formValues']) | 742 | availableFormValues = Clipperz.Base.deepClone(someValues['originalValues']['formValues']) |
753 | } | 743 | } |
754 | 744 | ||
755 | MochiKit.Base.update(availableFormValues, someValues['currentValues']['formValues']); | 745 | MochiKit.Base.update(availableFormValues, someValues['currentValues']['formValues']); |
756 | 746 | ||
757 | this._formValues = {}; | 747 | this._formValues = {}; |
758 | newFormValues = {}; | 748 | newFormValues = {}; |
759 | MochiKit.Iter.forEach(MochiKit.Base.filter(MochiKit.Base.methodcaller('needsFormValue'), MochiKit.Base.values(someValues['inputs'])), MochiKit.Base.bind(function (anInput) { | 749 | MochiKit.Iter.forEach(MochiKit.Base.filter(MochiKit.Base.methodcaller('needsFormValue'), MochiKit.Base.values(someValues['inputs'])), MochiKit.Base.bind(function (anInput) { |
760 | varnewFormValue; | 750 | varnewFormValue; |
761 | var fieldOptions; | 751 | var fieldOptions; |
762 | 752 | ||
763 | fieldOptions = { | 753 | fieldOptions = { |
764 | 'type': anInput.type(), | 754 | 'type': anInput.type(), |
765 | 'options':anInput.options() | 755 | 'options':anInput.options() |
766 | }; | 756 | }; |
767 | 757 | ||
768 | newFormValues[anInput.name()] = availableFormValues[anInput.name()] | 758 | newFormValues[anInput.name()] = availableFormValues[anInput.name()] |
769 | newFormValue = new Clipperz.PM.DataModel.DirectLoginFormValue(this, { | 759 | newFormValue = new Clipperz.PM.DataModel.DirectLoginFormValue(this, { |
770 | 'key': anInput.name(), | 760 | 'key': anInput.name(), |
771 | 'fieldOptions':fieldOptions, | 761 | 'fieldOptions':fieldOptions, |
772 | 'value': availableFormValues[anInput.name()] | 762 | 'value': availableFormValues[anInput.name()] |
773 | }); | 763 | }); |
774 | 764 | ||
775 | this._formValues[anInput.name()] = newFormValue; | 765 | this._formValues[anInput.name()] = newFormValue; |
776 | }, this)) | 766 | }, this)) |
777 | 767 | ||
778 | return newFormValues; | 768 | return newFormValues; |
779 | }, this), | 769 | }, this), |
780 | MochiKit.Base.method(this, 'setValue', 'formValues') | 770 | MochiKit.Base.method(this, 'setValue', 'formValues') |
781 | ], {trace:false}); | 771 | ], {trace:false}); |
782 | }, | 772 | }, |
783 | 773 | ||
784 | //========================================================================= | 774 | //========================================================================= |
785 | 775 | ||
786 | 'retrieveIndexDataFunction': function () { | 776 | 'retrieveIndexDataFunction': function () { |
787 | return this._retrieveIndexDataFunction; | 777 | return this._retrieveIndexDataFunction; |
788 | }, | 778 | }, |
789 | 779 | ||
790 | 'getIndexDataForKey': function (aKey) { | 780 | 'getIndexDataForKey': function (aKey) { |
791 | return Clipperz.Async.callbacks("DirectLogin.getIndexDataForKey", [ | 781 | return Clipperz.Async.callbacks("DirectLogin.getIndexDataForKey", [ |
792 | MochiKit.Base.partial(this.retrieveIndexDataFunction(), this.reference()), | 782 | MochiKit.Base.partial(this.retrieveIndexDataFunction(), this.reference()), |
793 | Clipperz.Async.deferredIf("DirectLogin.getIndexDataForKey - index data not null", [ | 783 | Clipperz.Async.deferredIf("DirectLogin.getIndexDataForKey - index data not null", [ |
794 | MochiKit.Base.itemgetter(aKey) | 784 | MochiKit.Base.itemgetter(aKey) |
795 | ],[ | 785 | ],[ |
796 | MochiKit.Async.succeed | 786 | MochiKit.Async.succeed |
797 | ]) | 787 | ]) |
798 | ], {trace:false}); | 788 | ], {trace:false}); |
799 | }, | 789 | }, |
800 | 790 | ||
801 | //------------------------------------------------------------------------- | 791 | //------------------------------------------------------------------------- |
802 | 792 | ||
803 | 'setIndexDataForKey': function (aKey, aValue) { | 793 | 'setIndexDataForKey': function (aKey, aValue) { |
804 | return Clipperz.Async.callbacks("DirectLogin.setValueForKey", [ | 794 | return Clipperz.Async.callbacks("DirectLogin.setValueForKey", [ |
805 | MochiKit.Base.method(this, 'getIndexDataForKey', aKey), | 795 | MochiKit.Base.method(this, 'getIndexDataForKey', aKey), |
806 | MochiKit.Base.bind(function (anActualValue) { | 796 | MochiKit.Base.bind(function (anActualValue) { |
807 | var transientStateKey; | 797 | var transientStateKey; |
808 | 798 | ||
809 | transientStateKey = 'original_' + aKey; | 799 | transientStateKey = 'original_' + aKey; |
810 | if (MochiKit.Base.isUndefinedOrNull(this.transientState()[transientStateKey])) { | 800 | if (MochiKit.Base.isUndefinedOrNull(this.transientState()[transientStateKey])) { |
811 | if (anActualValue != aValue) { | 801 | if (anActualValue != aValue) { |
812 | this.transientState()[transientStateKey] = anActualValue; | 802 | this.transientState()[transientStateKey] = anActualValue; |
813 | } | 803 | } |
814 | } else if (this.transientState()[transientStateKey] == aValue) { | 804 | } else if (this.transientState()[transientStateKey] == aValue) { |
815 | this.transientState()[transientStateKey] = null; | 805 | this.transientState()[transientStateKey] = null; |
816 | } | 806 | } |
817 | }, this), | 807 | }, this), |
818 | MochiKit.Base.partial(this._setIndexDataFunction, this.reference(), aKey, aValue) | 808 | MochiKit.Base.partial(this._setIndexDataFunction, this.reference(), aKey, aValue) |
819 | ], {trace:false}) | 809 | ], {trace:false}) |
820 | }, | 810 | }, |
821 | 811 | ||
822 | //------------------------------------------------------------------------- | 812 | //------------------------------------------------------------------------- |
823 | /* | 813 | /* |
824 | 'setValueForKey': function (aKey, aValue) { | 814 | 'setValueForKey': function (aKey, aValue) { |
825 | return Clipperz.Async.callbacks("DirectLogin.setValueForKey", [ | 815 | return Clipperz.Async.callbacks("DirectLogin.setValueForKey", [ |
826 | MochiKit.Base.method(this, 'getIndexDataForKey', aKey), | 816 | MochiKit.Base.method(this, 'getIndexDataForKey', aKey), |
827 | MochiKit.Base.bind(function (anActualValue) { | 817 | MochiKit.Base.bind(function (anActualValue) { |
828 | var transientStateKey; | 818 | var transientStateKey; |
829 | 819 | ||
830 | transientStateKey = 'original_' + aKey; | 820 | transientStateKey = 'original_' + aKey; |
831 | if (MochiKit.Base.isUndefinedOrNull(this.transientState()[transientStateKey])) { | 821 | if (MochiKit.Base.isUndefinedOrNull(this.transientState()[transientStateKey])) { |
832 | if (anActualValue != aValue) { | 822 | if (anActualValue != aValue) { |
833 | this.transientState()[transientStateKey] = anActualValue; | 823 | this.transientState()[transientStateKey] = anActualValue; |
834 | } | 824 | } |
835 | } else if (this.transientState()[transientStateKey] == aValue) { | 825 | } else if (this.transientState()[transientStateKey] == aValue) { |
836 | this.transientState()[transientStateKey] = null; | 826 | this.transientState()[transientStateKey] = null; |
837 | } | 827 | } |
838 | }, this), | 828 | }, this), |
839 | MochiKit.Base.method(this, 'setIndexDataForKey', aKey, aValue) | 829 | MochiKit.Base.method(this, 'setIndexDataForKey', aKey, aValue) |
840 | ], {trace:false}) | 830 | ], {trace:false}) |
841 | }, | 831 | }, |
842 | */ | 832 | */ |
843 | //========================================================================= | 833 | //========================================================================= |
844 | /* | 834 | /* |
845 | 'storedConfiguration': function () { | 835 | 'storedConfiguration': function () { |
846 | return this.record().getValue('directLogins' + '.' + this.reference()); | 836 | return this.record().getValue('directLogins' + '.' + this.reference()); |
847 | }, | 837 | }, |
848 | 838 | ||
849 | //'setStoredConfiguration': function (aValue) { | 839 | //'setStoredConfiguration': function (aValue) { |
850 | // return this.record().setValue('directLogins' + '.' + this.reference(), aValue); | 840 | // return this.record().setValue('directLogins' + '.' + this.reference(), aValue); |
851 | //}, | 841 | //}, |
852 | */ | 842 | */ |
853 | //========================================================================= | 843 | //========================================================================= |
854 | 844 | ||
855 | 'hasPendingChanges': function () { | 845 | 'hasPendingChanges': function () { |
856 | varresult; | 846 | varresult; |
857 | var deferredResult; | 847 | var deferredResult; |
858 | 848 | ||
859 | result = false; | 849 | result = false; |
860 | result = result || this.isBrandNew(); | 850 | result = result || this.isBrandNew(); |
861 | result = result || (! MochiKit.Base.isUndefinedOrNull(this.transientState()['original_label'])); | 851 | result = result || (! MochiKit.Base.isUndefinedOrNull(this.transientState()['original_label'])); |
862 | result = result || (! MochiKit.Base.isUndefinedOrNull(this.transientState()['original_favicon'])); | 852 | result = result || (! MochiKit.Base.isUndefinedOrNull(this.transientState()['original_favicon'])); |
863 | 853 | ||
864 | if ((result == false) && (this.originalConfiguration() != null)) { | 854 | if ((result == false) && (this.originalConfiguration() != null)) { |
865 | deferredResult = Clipperz.Async.callbacks("DirectLogin.hasPendingChanges", [ | 855 | deferredResult = Clipperz.Async.callbacks("DirectLogin.hasPendingChanges", [ |
866 | MochiKit.Base.method(this, 'serializedData'), | 856 | MochiKit.Base.method(this, 'serializedData'), |
867 | MochiKit.Base.bind(function (aCurrentConfiguration) { | 857 | MochiKit.Base.bind(function (aCurrentConfiguration) { |
868 | varoriginalConfiguration; | 858 | varoriginalConfiguration; |
869 | var currentConfiguration; | 859 | var currentConfiguration; |
870 | var result; | 860 | var result; |
871 | 861 | ||
872 | originalConfiguration = this.originalConfiguration(); | 862 | originalConfiguration = this.originalConfiguration(); |
873 | currentConfiguration = aCurrentConfiguration; | 863 | currentConfiguration = aCurrentConfiguration; |
874 | 864 | ||
875 | result = false; | 865 | result = false; |
876 | result = result || (MochiKit.Base.compare(originalConfiguration['bookmarkletVersion'], currentConfiguration['bookmarkletVersion'])!= 0); | 866 | result = result || (MochiKit.Base.compare(originalConfiguration['bookmarkletVersion'], currentConfiguration['bookmarkletVersion'])!= 0); |
877 | result = result || (MochiKit.Base.compare(originalConfiguration['formData'], currentConfiguration['formData']) != 0); | 867 | result = result || (MochiKit.Base.compare(originalConfiguration['formData'], currentConfiguration['formData']) != 0); |
878 | result = result || (MochiKit.Base.compare(originalConfiguration['formValues'], currentConfiguration['formValues']) != 0); | 868 | result = result || (MochiKit.Base.compare(originalConfiguration['formValues'], currentConfiguration['formValues']) != 0); |
879 | result = result || (MochiKit.Base.compare(originalConfiguration['bindingData'], currentConfiguration['bindingData']) != 0); | 869 | result = result || (MochiKit.Base.compare(originalConfiguration['bindingData'], currentConfiguration['bindingData']) != 0); |
880 | 870 | ||
881 | return result; | 871 | return result; |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js index 4377853..a8ebb97 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js | |||
@@ -1,122 +1,120 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | 28 | ||
31 | //############################################################################# | 29 | //############################################################################# |
32 | 30 | ||
33 | Clipperz.PM.DataModel.DirectLoginBinding = function(aDirectLogin, args) { | 31 | Clipperz.PM.DataModel.DirectLoginBinding = function(aDirectLogin, args) { |
34 | args = args || {}; | 32 | args = args || {}; |
35 | 33 | ||
36 | this._directLogin = aDirectLogin|| Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | this._directLogin = aDirectLogin|| Clipperz.Base.exception.raise('MandatoryParameter'); |
37 | 35 | ||
38 | this._key = args.key|| Clipperz.Base.exception.raise('MandatoryParameter'); | 36 | this._key = args.key|| Clipperz.Base.exception.raise('MandatoryParameter'); |
39 | this._fieldKey = args.field || /* this.directLogin().fieldWithName(args.fieldName).reference() || */null; | 37 | this._fieldKey = args.field || /* this.directLogin().fieldWithName(args.fieldName).reference() || */null; |
40 | 38 | ||
41 | return this; | 39 | return this; |
42 | } | 40 | } |
43 | 41 | ||
44 | Clipperz.PM.DataModel.DirectLoginBinding.prototype = MochiKit.Base.update(null, { | 42 | Clipperz.PM.DataModel.DirectLoginBinding.prototype = MochiKit.Base.update(null, { |
45 | 43 | ||
46 | 'toString': function() { | 44 | 'toString': function() { |
47 | return "DirectLoginBinding (" + this.key() + ", " + this.fieldKey() + ")"; | 45 | return "DirectLoginBinding (" + this.key() + ", " + this.fieldKey() + ")"; |
48 | }, | 46 | }, |
49 | 47 | ||
50 | //------------------------------------------------------------------------- | 48 | //------------------------------------------------------------------------- |
51 | 49 | ||
52 | 'directLogin': function () { | 50 | 'directLogin': function () { |
53 | return this._directLogin; | 51 | return this._directLogin; |
54 | }, | 52 | }, |
55 | 53 | ||
56 | //------------------------------------------------------------------------- | 54 | //------------------------------------------------------------------------- |
57 | 55 | ||
58 | 'key': function() { | 56 | 'key': function() { |
59 | return this._key; | 57 | return this._key; |
60 | }, | 58 | }, |
61 | 59 | ||
62 | //------------------------------------------------------------------------- | 60 | //------------------------------------------------------------------------- |
63 | 61 | ||
64 | 'fieldKey': function() { | 62 | 'fieldKey': function() { |
65 | return this._fieldKey; | 63 | return this._fieldKey; |
66 | }, | 64 | }, |
67 | 65 | ||
68 | 'setFieldKey': function(aValue) { | 66 | 'setFieldKey': function(aValue) { |
69 | this._fieldKey = aValue; | 67 | this._fieldKey = aValue; |
70 | 68 | ||
71 | return this.directLogin().setValue('bindingData' + '.' + this.key(), aValue); | 69 | return this.directLogin().setValue('bindingData' + '.' + this.key(), aValue); |
72 | }, | 70 | }, |
73 | 71 | ||
74 | //'fieldName': function() { | 72 | //'fieldName': function() { |
75 | // return this._fieldName; | 73 | // return this._fieldName; |
76 | //}, | 74 | //}, |
77 | 75 | ||
78 | //------------------------------------------------------------------------- | 76 | //------------------------------------------------------------------------- |
79 | 77 | ||
80 | 'field': function() { | 78 | 'field': function() { |
81 | var deferredResult; | 79 | var deferredResult; |
82 | 80 | ||
83 | if (this.fieldKey() != null) { | 81 | if (this.fieldKey() != null) { |
84 | deferredResult = Clipperz.Async.callbacks("DirectLoginBinding.field [1]", [ | 82 | deferredResult = Clipperz.Async.callbacks("DirectLoginBinding.field [1]", [ |
85 | MochiKit.Base.method(this.directLogin().record(), 'fields'), | 83 | MochiKit.Base.method(this.directLogin().record(), 'fields'), |
86 | MochiKit.Base.itemgetter(this.fieldKey()) | 84 | MochiKit.Base.itemgetter(this.fieldKey()) |
87 | ], {trace:false}); | 85 | ], {trace:false}); |
88 | // } else if (this.fieldName() != null) { | 86 | // } else if (this.fieldName() != null) { |
89 | // WTF = TODO; | 87 | // WTF = TODO; |
90 | // result = this.directLogin().record().fieldWithName(this.fieldName()); | 88 | // result = this.directLogin().record().fieldWithName(this.fieldName()); |
91 | // | 89 | // |
92 | // this.setFieldKey(result.key()); | 90 | // this.setFieldKey(result.key()); |
93 | } else { | 91 | } else { |
94 | deferredResult = MochiKit.Async.succeed(null); | 92 | deferredResult = MochiKit.Async.succeed(null); |
95 | } | 93 | } |
96 | 94 | ||
97 | return deferredResult; | 95 | return deferredResult; |
98 | }, | 96 | }, |
99 | 97 | ||
100 | 'setField': function (aField) { | 98 | 'setField': function (aField) { |
101 | this.setFieldKey(aField.reference()); | 99 | this.setFieldKey(aField.reference()); |
102 | }, | 100 | }, |
103 | 101 | ||
104 | //------------------------------------------------------------------------- | 102 | //------------------------------------------------------------------------- |
105 | /* | 103 | /* |
106 | 'fieldValue': function () { | 104 | 'fieldValue': function () { |
107 | return Clipperz.Async.callbacks("DirectLoginBinding.fieldValue", [ | 105 | return Clipperz.Async.callbacks("DirectLoginBinding.fieldValue", [ |
108 | MochiKit.Base.method('field'), | 106 | MochiKit.Base.method('field'), |
109 | MochiKit.Base.methodcaller('value') | 107 | MochiKit.Base.methodcaller('value') |
110 | ], {trace:false}); | 108 | ], {trace:false}); |
111 | }, | 109 | }, |
112 | */ | 110 | */ |
113 | //------------------------------------------------------------------------- | 111 | //------------------------------------------------------------------------- |
114 | 112 | ||
115 | 'serializedData': function() { | 113 | 'serializedData': function() { |
116 | return this.fieldKey(); | 114 | return this.fieldKey(); |
117 | }, | 115 | }, |
118 | 116 | ||
119 | //------------------------------------------------------------------------- | 117 | //------------------------------------------------------------------------- |
120 | __syntaxFix__: "syntax fix" | 118 | __syntaxFix__: "syntax fix" |
121 | }); | 119 | }); |
122 | 120 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js index a461197..2429f88 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js | |||
@@ -1,104 +1,101 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | 28 | ||
31 | //############################################################################# | 29 | //############################################################################# |
32 | 30 | ||
33 | Clipperz.PM.DataModel.DirectLoginFormValue = function(aDirectLogin, args) { | 31 | Clipperz.PM.DataModel.DirectLoginFormValue = function(aDirectLogin, args) { |
34 | args = args || {}; | 32 | args = args || {}; |
35 | 33 | ||
36 | this._directLogin = aDirectLogin|| Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | this._directLogin = aDirectLogin|| Clipperz.Base.exception.raise('MandatoryParameter'); |
37 | 35 | ||
38 | this._key = args.key || Clipperz.Base.exception.raise('MandatoryParameter'); | 36 | this._key = args.key || Clipperz.Base.exception.raise('MandatoryParameter'); |
39 | this._fieldOptions = args.fieldOptions|| Clipperz.Base.exception.raise('MandatoryParameter'); | 37 | this._fieldOptions = args.fieldOptions|| Clipperz.Base.exception.raise('MandatoryParameter'); |
40 | this._value = args.value || null; | 38 | this._value = args.value || null; |
41 | 39 | ||
42 | return this; | 40 | return this; |
43 | } | 41 | } |
44 | 42 | ||
45 | Clipperz.PM.DataModel.DirectLoginFormValue.prototype = MochiKit.Base.update(null, { | 43 | Clipperz.PM.DataModel.DirectLoginFormValue.prototype = MochiKit.Base.update(null, { |
46 | 44 | ||
47 | 'toString': function() { | 45 | 'toString': function() { |
48 | return "DirectLoginFormValue (" + this.key() + ", " + this.value() + ")"; | 46 | return "DirectLoginFormValue (" + this.key() + ", " + this.value() + ")"; |
49 | }, | 47 | }, |
50 | 48 | ||
51 | //------------------------------------------------------------------------- | 49 | //------------------------------------------------------------------------- |
52 | 50 | ||
53 | 'directLogin': function () { | 51 | 'directLogin': function () { |
54 | return this._directLogin; | 52 | return this._directLogin; |
55 | }, | 53 | }, |
56 | 54 | ||
57 | //------------------------------------------------------------------------- | 55 | //------------------------------------------------------------------------- |
58 | 56 | ||
59 | 'key': function() { | 57 | 'key': function() { |
60 | return this._key; | 58 | return this._key; |
61 | }, | 59 | }, |
62 | 60 | ||
63 | //------------------------------------------------------------------------- | 61 | //------------------------------------------------------------------------- |
64 | 62 | ||
65 | 'fieldOptions': function() { | 63 | 'fieldOptions': function() { |
66 | return this._fieldOptions; | 64 | return this._fieldOptions; |
67 | }, | 65 | }, |
68 | 66 | ||
69 | //------------------------------------------------------------------------- | 67 | //------------------------------------------------------------------------- |
70 | 68 | ||
71 | 'type': function () { | 69 | 'type': function () { |
72 | return this.fieldOptions()['type']; | 70 | return this.fieldOptions()['type']; |
73 | }, | 71 | }, |
74 | 72 | ||
75 | //------------------------------------------------------------------------- | 73 | //------------------------------------------------------------------------- |
76 | 74 | ||
77 | 'value': function() { | 75 | 'value': function() { |
78 | varresult; | 76 | varresult; |
79 | 77 | ||
80 | result = this._value; | 78 | result = this._value; |
81 | 79 | ||
82 | // if ((result == null) && (this.type() == 'checkbox')) { | 80 | // if ((result == null) && (this.type() == 'checkbox')) { |
83 | // result = false; | 81 | // result = false; |
84 | // }; | 82 | // }; |
85 | 83 | ||
86 | return result; | 84 | return result; |
87 | }, | 85 | }, |
88 | 86 | ||
89 | 'setValue': function (aValue) { | 87 | 'setValue': function (aValue) { |
90 | //console.log("DirectLoginFormValue.setValue", aValue); | ||
91 | this._value = aValue; | 88 | this._value = aValue; |
92 | return this.directLogin().setValue('formValues' + '.' + this.key(), aValue); | 89 | return this.directLogin().setValue('formValues' + '.' + this.key(), aValue); |
93 | }, | 90 | }, |
94 | 91 | ||
95 | //------------------------------------------------------------------------- | 92 | //------------------------------------------------------------------------- |
96 | /* | 93 | /* |
97 | 'serializedData': function() { | 94 | 'serializedData': function() { |
98 | return this.value(); | 95 | return this.value(); |
99 | }, | 96 | }, |
100 | */ | 97 | */ |
101 | //------------------------------------------------------------------------- | 98 | //------------------------------------------------------------------------- |
102 | __syntaxFix__: "syntax fix" | 99 | __syntaxFix__: "syntax fix" |
103 | }); | 100 | }); |
104 | 101 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js index 8188389..d9995fc 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js | |||
@@ -1,200 +1,192 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | //############################################################################# | 28 | //############################################################################# |
31 | 29 | ||
32 | Clipperz.PM.DataModel.DirectLoginInput = function(args) { | 30 | Clipperz.PM.DataModel.DirectLoginInput = function(args) { |
33 | this._args = args; | 31 | this._args = args; |
34 | 32 | ||
35 | return this; | 33 | return this; |
36 | } | 34 | } |
37 | 35 | ||
38 | Clipperz.PM.DataModel.DirectLoginInput.prototype = MochiKit.Base.update(null, { | 36 | Clipperz.PM.DataModel.DirectLoginInput.prototype = MochiKit.Base.update(null, { |
39 | 37 | ||
40 | 'args': function() { | 38 | 'args': function() { |
41 | return this._args; | 39 | return this._args; |
42 | }, | 40 | }, |
43 | 41 | ||
44 | //------------------------------------------------------------------------- | 42 | //------------------------------------------------------------------------- |
45 | 43 | ||
46 | 'name': function() { | 44 | 'name': function() { |
47 | return this.args()['name']; | 45 | return this.args()['name']; |
48 | }, | 46 | }, |
49 | 47 | ||
50 | //------------------------------------------------------------------------- | 48 | //------------------------------------------------------------------------- |
51 | 49 | ||
52 | 'type': function() { | 50 | 'type': function() { |
53 | var result; | 51 | var result; |
54 | 52 | ||
55 | result = this.args()['type']; | 53 | result = this.args()['type']; |
56 | 54 | ||
57 | if (result != null) { | 55 | if (result != null) { |
58 | result = result.toLowerCase(); | 56 | result = result.toLowerCase(); |
59 | } | 57 | } |
60 | return result; | 58 | return result; |
61 | }, | 59 | }, |
62 | 60 | ||
63 | //------------------------------------------------------------------------- | 61 | //------------------------------------------------------------------------- |
64 | 62 | ||
65 | 'options': function() { | 63 | 'options': function() { |
66 | return this.args()['options']; | 64 | return this.args()['options']; |
67 | }, | 65 | }, |
68 | 66 | ||
69 | //------------------------------------------------------------------------- | 67 | //------------------------------------------------------------------------- |
70 | 68 | ||
71 | 'value': function() { | 69 | 'value': function() { |
72 | return this.args()['value']; | 70 | return this.args()['value']; |
73 | }, | 71 | }, |
74 | 72 | ||
75 | //------------------------------------------------------------------------- | 73 | //------------------------------------------------------------------------- |
76 | /* | 74 | /* |
77 | 'formConfiguration': function(someFormValues, someBindings, someFields) { | 75 | 'formConfiguration': function(someFormValues, someBindings, someFields) { |
78 | var result; | 76 | var result; |
79 | //console.log("### DirectLoginInput.formConfiguration", someFields); | 77 | |
80 | if (this.shouldSetValue()) { | 78 | if (this.shouldSetValue()) { |
81 | switch (this.type()) { | 79 | switch (this.type()) { |
82 | case 'select': | 80 | case 'select': |
83 | var currentValue; | 81 | var currentValue; |
84 | var options; | 82 | var options; |
85 | 83 | ||
86 | // currentValue = this.directLogin()._configuration['formValues'][this.name()]; | 84 | // currentValue = this.directLogin()._configuration['formValues'][this.name()]; |
87 | currentValue = someFormValues[this.name()]; | 85 | currentValue = someFormValues[this.name()]; |
88 | options = this.args()['options']; | 86 | options = this.args()['options']; |
89 | 87 | ||
90 | result = MochiKit.DOM.SELECT({name:this.name()}, | 88 | result = MochiKit.DOM.SELECT({name:this.name()}, |
91 | MochiKit.Base.map(function(anOption) { | 89 | MochiKit.Base.map(function(anOption) { |
92 | var options; | 90 | var options; |
93 | 91 | ||
94 | options = {value:anOption['value']}; | 92 | options = {value:anOption['value']}; |
95 | if (currentValue == anOption['value']) { | 93 | if (currentValue == anOption['value']) { |
96 | options.selected = true; | 94 | options.selected = true; |
97 | } | 95 | } |
98 | 96 | ||
99 | return MochiKit.DOM.OPTION(options, anOption['label']) | 97 | return MochiKit.DOM.OPTION(options, anOption['label']) |
100 | }, options) | 98 | }, options) |
101 | ) | 99 | ) |
102 | break; | 100 | break; |
103 | case 'checkbox': | 101 | case 'checkbox': |
104 | var options; | 102 | var options; |
105 | 103 | ||
106 | options = {type:'checkbox', name: this.name()}; | 104 | options = {type:'checkbox', name: this.name()}; |
107 | // if (this.directLogin()._configuration['formValues'][this.name()] == true) { | 105 | // if (this.directLogin()._configuration['formValues'][this.name()] == true) { |
108 | if (someFormValues[this.name()] == true) { | 106 | if (someFormValues[this.name()] == true) { |
109 | options['checked'] = true; | 107 | options['checked'] = true; |
110 | }; | 108 | }; |
111 | 109 | ||
112 | result = MochiKit.DOM.INPUT(options, null); | 110 | result = MochiKit.DOM.INPUT(options, null); |
113 | break; | 111 | break; |
114 | case 'radio': | 112 | case 'radio': |
115 | var currentName; | 113 | var currentName; |
116 | var currentValue; | 114 | var currentValue; |
117 | var options; | 115 | var options; |
118 | 116 | ||
119 | currentName = this.name(); | 117 | currentName = this.name(); |
120 | // currentValue = this.directLogin()._configuration['formValues'][this.name()]; | 118 | // currentValue = this.directLogin()._configuration['formValues'][this.name()]; |
121 | currentValue = someFormValues[this.name()]; | 119 | currentValue = someFormValues[this.name()]; |
122 | options = this.args()['options']; | 120 | options = this.args()['options']; |
123 | 121 | ||
124 | result = MochiKit.DOM.DIV(null, | 122 | result = MochiKit.DOM.DIV(null, |
125 | MochiKit.Base.map(function(anOption) { | 123 | MochiKit.Base.map(function(anOption) { |
126 | var options; | 124 | var options; |
127 | var isChecked; | 125 | var isChecked; |
128 | var inputNode; | 126 | var inputNode; |
129 | var divNode; | 127 | var divNode; |
130 | 128 | ||
131 | options = {type:'radio', name:currentName, value:anOption['value']} | 129 | options = {type:'radio', name:currentName, value:anOption['value']} |
132 | isChecked = (currentValue == anOption['value']); | 130 | isChecked = (currentValue == anOption['value']); |
133 | if (isChecked) { | 131 | if (isChecked) { |
134 | options.checked = true; | 132 | options.checked = true; |
135 | } | 133 | } |
136 | 134 | ||
137 | if (Clipperz_IEisBroken == true) { | 135 | if (Clipperz_IEisBroken == true) { |
138 | var checkedValue; | 136 | var checkedValue; |
139 | 137 | ||
140 | checkedValue = (isChecked ? " CHECKED" : ""); | 138 | checkedValue = (isChecked ? " CHECKED" : ""); |
141 | inputNode = MochiKit.DOM.currentDocument().createElement("<INPUT TYPE='RADIO' NAME='" + currentName + "' VALUE='" + anOption['value'] + "'" + checkedValue + ">"); | 139 | inputNode = MochiKit.DOM.currentDocument().createElement("<INPUT TYPE='RADIO' NAME='" + currentName + "' VALUE='" + anOption['value'] + "'" + checkedValue + ">"); |
142 | } else { | 140 | } else { |
143 | inputNode = MochiKit.DOM.INPUT(options, anOption['value']); | 141 | inputNode = MochiKit.DOM.INPUT(options, anOption['value']); |
144 | } | 142 | } |
145 | divNode = MochiKit.DOM.DIV(null, inputNode); | 143 | divNode = MochiKit.DOM.DIV(null, inputNode); |
146 | 144 | ||
147 | return divNode; | 145 | return divNode; |
148 | }, options) | 146 | }, options) |
149 | ); | 147 | ); |
150 | break; | 148 | break; |
151 | } | 149 | } |
152 | } else { | 150 | } else { |
153 | var binding; | 151 | var binding; |
154 | // binding = this.directLogin().bindings()[this.name()]; | 152 | // binding = this.directLogin().bindings()[this.name()]; |
155 | binding = someBindings[this.name()]; | 153 | binding = someBindings[this.name()]; |
156 | 154 | ||
157 | //console.log("### binding", binding); | ||
158 | //if (binding != null) { | ||
159 | ///console.log(" binding.field()", binding.field()); | ||
160 | ///console.log(" binding.field().value()", binding.field().value()); | ||
161 | //console.log(" someFields[binding.fieldKey()].value()", someFields[binding.fieldKey()].value()); | ||
162 | //} | ||
163 | result = MochiKit.DOM.INPUT({ | 155 | result = MochiKit.DOM.INPUT({ |
164 | type:((this.type() != 'password') ? this.type() : 'text'), | 156 | type:((this.type() != 'password') ? this.type() : 'text'), |
165 | name:this.name(), | 157 | name:this.name(), |
166 | // value:((binding != null)? binding.field().value() : this.value()) | 158 | // value:((binding != null)? binding.field().value() : this.value()) |
167 | value:((binding != null)? someFields[binding.fieldKey()]['value'] : this.value()) | 159 | value:((binding != null)? someFields[binding.fieldKey()]['value'] : this.value()) |
168 | // value:((binding != null)? someFields[binding.fieldKey()].value() : this.value()) | 160 | // value:((binding != null)? someFields[binding.fieldKey()].value() : this.value()) |
169 | }, null); | 161 | }, null); |
170 | } | 162 | } |
171 | 163 | ||
172 | return result; | 164 | return result; |
173 | }, | 165 | }, |
174 | */ | 166 | */ |
175 | //------------------------------------------------------------------------- | 167 | //------------------------------------------------------------------------- |
176 | 168 | ||
177 | 'needsFormValue': function() { | 169 | 'needsFormValue': function() { |
178 | var type; | 170 | var type; |
179 | var result; | 171 | var result; |
180 | 172 | ||
181 | type = this.type(); | 173 | type = this.type(); |
182 | result = ((type == 'checkbox') || (type == 'radio') || (type == 'select')); | 174 | result = ((type == 'checkbox') || (type == 'radio') || (type == 'select')); |
183 | 175 | ||
184 | return result; | 176 | return result; |
185 | }, | 177 | }, |
186 | 178 | ||
187 | 'needsBinding': function() { | 179 | 'needsBinding': function() { |
188 | var type; | 180 | var type; |
189 | var result; | 181 | var result; |
190 | 182 | ||
191 | type = this.type(); | 183 | type = this.type(); |
192 | result = ((type == 'text') || (type == 'password')); | 184 | result = ((type == 'text') || (type == 'password')); |
193 | 185 | ||
194 | return result; | 186 | return result; |
195 | }, | 187 | }, |
196 | 188 | ||
197 | //------------------------------------------------------------------------- | 189 | //------------------------------------------------------------------------- |
198 | __syntaxFix__: "syntax fix" | 190 | __syntaxFix__: "syntax fix" |
199 | }); | 191 | }); |
200 | 192 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js b/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js index cdeec8b..1aa7a52 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js | |||
@@ -1,214 +1,212 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.KeyValueObjectStore) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.KeyValueObjectStore) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.EncryptedRemoteObject depends on Clipperz.KeyValueObjectStore!"; | 25 | throw "Clipperz.PM.DataModel.EncryptedRemoteObject depends on Clipperz.KeyValueObjectStore!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 28 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
31 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 29 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
32 | 30 | ||
33 | Clipperz.PM.DataModel.EncryptedRemoteObject = function(args) { | 31 | Clipperz.PM.DataModel.EncryptedRemoteObject = function(args) { |
34 | args = args || {}; | 32 | args = args || {}; |
35 | 33 | ||
36 | this._name = args.name || null; | 34 | this._name = args.name || null; |
37 | this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); | 35 | this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); |
38 | this._isBrandNew = ((args.reference == null) && (args.remoteData == null)); | 36 | this._isBrandNew = ((args.reference == null) && (args.remoteData == null)); |
39 | 37 | ||
40 | if ((this._isBrandNew == false) && (args['retrieveKeyFunction'] == null)) { | 38 | if ((this._isBrandNew == false) && (args['retrieveKeyFunction'] == null)) { |
41 | Clipperz.Base.exception.raise('MandatoryParameter'); | 39 | Clipperz.Base.exception.raise('MandatoryParameter'); |
42 | } else { | 40 | } else { |
43 | this._retrieveKeyFunction = args['retrieveKeyFunction']; | 41 | this._retrieveKeyFunction = args['retrieveKeyFunction']; |
44 | } | 42 | } |
45 | 43 | ||
46 | this._retrieveRemoteDataFunction = args.retrieveRemoteDataFunction|| null; | 44 | this._retrieveRemoteDataFunction = args.retrieveRemoteDataFunction|| null; |
47 | this._remoteData = args.remoteData || null; | 45 | this._remoteData = args.remoteData || null; |
48 | // this._remoteData = args.remoteData ? Clipperz.Base.deepClone(args.remoteData) : null; | 46 | // this._remoteData = args.remoteData ? Clipperz.Base.deepClone(args.remoteData) : null; |
49 | if ((!this._isBrandNew) && ((this._retrieveRemoteDataFunction == null) && (this._remoteData == null))) { | 47 | if ((!this._isBrandNew) && ((this._retrieveRemoteDataFunction == null) && (this._remoteData == null))) { |
50 | Clipperz.Base.exception.raise('MandatoryParameter'); | 48 | Clipperz.Base.exception.raise('MandatoryParameter'); |
51 | } | 49 | } |
52 | 50 | ||
53 | 51 | ||
54 | this._encryptedDataKeypath = args.encryptedDataKeypath || 'data'; //Clipperz.Base.exception.raise('MandatoryParameter'); | 52 | this._encryptedDataKeypath = args.encryptedDataKeypath || 'data'; //Clipperz.Base.exception.raise('MandatoryParameter'); |
55 | this._encryptedVersionKeypath = args.encryptedVersionKeypath || 'version';//Clipperz.Base.exception.raise('MandatoryParameter'); | 53 | this._encryptedVersionKeypath = args.encryptedVersionKeypath || 'version';//Clipperz.Base.exception.raise('MandatoryParameter'); |
56 | 54 | ||
57 | 55 | ||
58 | this._transientState = null; | 56 | this._transientState = null; |
59 | this._deferredLocks = {}; | 57 | this._deferredLocks = {}; |
60 | 58 | ||
61 | if (this._isBrandNew == true) { | 59 | if (this._isBrandNew == true) { |
62 | this._objectDataStore = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.objectDataStore [1]'}*/); | 60 | this._objectDataStore = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.objectDataStore [1]'}*/); |
63 | } else { | 61 | } else { |
64 | this._objectDataStore = null; | 62 | this._objectDataStore = null; |
65 | } | 63 | } |
66 | 64 | ||
67 | return this; | 65 | return this; |
68 | } | 66 | } |
69 | 67 | ||
70 | // | 68 | // |
71 | // Basic data workflow | 69 | // Basic data workflow |
72 | //======================= | 70 | //======================= |
73 | // | 71 | // |
74 | //getRemoteData | 72 | //getRemoteData |
75 | // unpackRemoteData | 73 | // unpackRemoteData |
76 | // getDecryptData [encryptedDataKeypath, encryptedVersionKeypath] | 74 | // getDecryptData [encryptedDataKeypath, encryptedVersionKeypath] |
77 | // unpackData | 75 | // unpackData |
78 | // | 76 | // |
79 | // | 77 | // |
80 | // ?? packData | 78 | // ?? packData |
81 | // ?? encryptDataWithKey | 79 | // ?? encryptDataWithKey |
82 | // ??packRemoteData [encryptedDataKeypath (?), encryptedVersionKeypath (?)] | 80 | // ??packRemoteData [encryptedDataKeypath (?), encryptedVersionKeypath (?)] |
83 | // | 81 | // |
84 | 82 | ||
85 | Clipperz.PM.DataModel.EncryptedRemoteObject.prototype = MochiKit.Base.update(null, { | 83 | Clipperz.PM.DataModel.EncryptedRemoteObject.prototype = MochiKit.Base.update(null, { |
86 | 84 | ||
87 | 'toString': function () { | 85 | 'toString': function () { |
88 | return "Clipperz.PM.DataModel.EncryptedRemoteObject" + (this.name() != null ? " - " + this.name() : ""); | 86 | return "Clipperz.PM.DataModel.EncryptedRemoteObject" + (this.name() != null ? " - " + this.name() : ""); |
89 | }, | 87 | }, |
90 | 88 | ||
91 | //------------------------------------------------------------------------- | 89 | //------------------------------------------------------------------------- |
92 | 90 | ||
93 | 'name': function () { | 91 | 'name': function () { |
94 | return this._name; | 92 | return this._name; |
95 | }, | 93 | }, |
96 | 94 | ||
97 | //------------------------------------------------------------------------- | 95 | //------------------------------------------------------------------------- |
98 | 96 | ||
99 | 'reference': function () { | 97 | 'reference': function () { |
100 | return this._reference; | 98 | return this._reference; |
101 | }, | 99 | }, |
102 | 100 | ||
103 | 'setReference': function (aValue) { | 101 | 'setReference': function (aValue) { |
104 | this._reference = aValue; | 102 | this._reference = aValue; |
105 | 103 | ||
106 | return this._reference; | 104 | return this._reference; |
107 | }, | 105 | }, |
108 | 106 | ||
109 | //------------------------------------------------------------------------- | 107 | //------------------------------------------------------------------------- |
110 | 108 | ||
111 | 'transientState': function () { | 109 | 'transientState': function () { |
112 | if (this._transientState == null) { | 110 | if (this._transientState == null) { |
113 | this._transientState = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.transientState [2]'}*/); | 111 | this._transientState = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.transientState [2]'}*/); |
114 | } | 112 | } |
115 | 113 | ||
116 | return this._transientState; | 114 | return this._transientState; |
117 | }, | 115 | }, |
118 | 116 | ||
119 | 'resetTransientState': function (isCommitting) { | 117 | 'resetTransientState': function (isCommitting) { |
120 | if (this._transientState != null) { | 118 | if (this._transientState != null) { |
121 | this._transientState.removeAllData(); | 119 | this._transientState.removeAllData(); |
122 | } | 120 | } |
123 | 121 | ||
124 | this._transientState = null; | 122 | this._transientState = null; |
125 | }, | 123 | }, |
126 | 124 | ||
127 | //------------------------------------------------------------------------- | 125 | //------------------------------------------------------------------------- |
128 | 126 | ||
129 | 'isBrandNew': function () { | 127 | 'isBrandNew': function () { |
130 | return this._isBrandNew; | 128 | return this._isBrandNew; |
131 | }, | 129 | }, |
132 | 130 | ||
133 | //------------------------------------------------------------------------- | 131 | //------------------------------------------------------------------------- |
134 | 132 | ||
135 | 'getKey': function () { | 133 | 'getKey': function () { |
136 | var deferredResult; | 134 | var deferredResult; |
137 | var deferredLock; | 135 | var deferredLock; |
138 | 136 | ||
139 | deferredLock = this.getDeferredLockForKey('key'); | 137 | deferredLock = this.getDeferredLockForKey('key'); |
140 | 138 | ||
141 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.getKey", {trace:false}); | 139 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.getKey", {trace:false}); |
142 | deferredResult.acquireLock(deferredLock); | 140 | deferredResult.acquireLock(deferredLock); |
143 | deferredResult.addMethod( | 141 | deferredResult.addMethod( |
144 | this.decryptedDataStore(), | 142 | this.decryptedDataStore(), |
145 | 'deferredGetOrSet', | 143 | 'deferredGetOrSet', |
146 | 'decryptionKey', | 144 | 'decryptionKey', |
147 | MochiKit.Base.partial(this.retrieveKeyFunction(), this.reference()) | 145 | MochiKit.Base.partial(this.retrieveKeyFunction(), this.reference()) |
148 | ); | 146 | ); |
149 | deferredResult.releaseLock(deferredLock); | 147 | deferredResult.releaseLock(deferredLock); |
150 | deferredResult.callback(); | 148 | deferredResult.callback(); |
151 | 149 | ||
152 | return deferredResult; | 150 | return deferredResult; |
153 | }, | 151 | }, |
154 | 152 | ||
155 | // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . | 153 | // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
156 | 154 | ||
157 | 'retrieveKeyFunction': function () { | 155 | 'retrieveKeyFunction': function () { |
158 | return this._retrieveKeyFunction; | 156 | return this._retrieveKeyFunction; |
159 | }, | 157 | }, |
160 | 158 | ||
161 | 'setRetrieveKeyFunction': function (aFunction) { | 159 | 'setRetrieveKeyFunction': function (aFunction) { |
162 | this._retrieveKeyFunction = aFunction; | 160 | this._retrieveKeyFunction = aFunction; |
163 | }, | 161 | }, |
164 | 162 | ||
165 | //------------------------------------------------------------------------- | 163 | //------------------------------------------------------------------------- |
166 | 164 | ||
167 | 'hasLoadedRemoteData': function () { | 165 | 'hasLoadedRemoteData': function () { |
168 | return (this._remoteData != null); | 166 | return (this._remoteData != null); |
169 | }, | 167 | }, |
170 | 168 | ||
171 | 'getRemoteData': function () { | 169 | 'getRemoteData': function () { |
172 | var deferredResult; | 170 | var deferredResult; |
173 | vardeferredLock; | 171 | vardeferredLock; |
174 | 172 | ||
175 | deferredLock = this.getDeferredLockForKey('remoteData'); | 173 | deferredLock = this.getDeferredLockForKey('remoteData'); |
176 | 174 | ||
177 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObjects.getRemoteData", {trace:false}); | 175 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObjects.getRemoteData", {trace:false}); |
178 | deferredResult.acquireLock(deferredLock); | 176 | deferredResult.acquireLock(deferredLock); |
179 | deferredResult.addCallback(MochiKit.Base.bind(function () { | 177 | deferredResult.addCallback(MochiKit.Base.bind(function () { |
180 | var innerDeferredResult; | 178 | var innerDeferredResult; |
181 | 179 | ||
182 | if (this._remoteData != null) { | 180 | if (this._remoteData != null) { |
183 | innerDeferredResult = MochiKit.Async.succeed(this._remoteData); | 181 | innerDeferredResult = MochiKit.Async.succeed(this._remoteData); |
184 | } else { | 182 | } else { |
185 | innerDeferredResult = Clipperz.Async.callbacks("EncryptedRemoteObjects.getRemoteData <inner deferred>", [ | 183 | innerDeferredResult = Clipperz.Async.callbacks("EncryptedRemoteObjects.getRemoteData <inner deferred>", [ |
186 | MochiKit.Base.partial(this.retrieveRemoteDataFunction(), this.reference()), | 184 | MochiKit.Base.partial(this.retrieveRemoteDataFunction(), this.reference()), |
187 | MochiKit.Base.method(this, 'unpackRemoteData'), | 185 | MochiKit.Base.method(this, 'unpackRemoteData'), |
188 | MochiKit.Base.bind(function (someData) { | 186 | MochiKit.Base.bind(function (someData) { |
189 | this._remoteData = someData; | 187 | this._remoteData = someData; |
190 | return this._remoteData; | 188 | return this._remoteData; |
191 | }, this) | 189 | }, this) |
192 | ], {trace:false}); | 190 | ], {trace:false}); |
193 | } | 191 | } |
194 | 192 | ||
195 | return innerDeferredResult; | 193 | return innerDeferredResult; |
196 | }, this)) | 194 | }, this)) |
197 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); | 195 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); |
198 | deferredResult.releaseLock(deferredLock); | 196 | deferredResult.releaseLock(deferredLock); |
199 | 197 | ||
200 | deferredResult.callback(); | 198 | deferredResult.callback(); |
201 | 199 | ||
202 | return deferredResult; | 200 | return deferredResult; |
203 | }, | 201 | }, |
204 | 202 | ||
205 | //------------------------------------------------------------------------- | 203 | //------------------------------------------------------------------------- |
206 | 204 | ||
207 | 'unpackRemoteData': function (someData) { | 205 | 'unpackRemoteData': function (someData) { |
208 | return MochiKit.Async.succeed(someData); | 206 | return MochiKit.Async.succeed(someData); |
209 | }, | 207 | }, |
210 | 208 | ||
211 | //......................................................................... | 209 | //......................................................................... |
212 | 210 | ||
213 | 'packRemoteData': function (someData) { | 211 | 'packRemoteData': function (someData) { |
214 | var result; | 212 | var result; |
@@ -222,327 +220,323 @@ Clipperz.PM.DataModel.EncryptedRemoteObject.prototype = MochiKit.Base.update(nul | |||
222 | return MochiKit.Async.succeed(result); | 220 | return MochiKit.Async.succeed(result); |
223 | }, | 221 | }, |
224 | 222 | ||
225 | //------------------------------------------------------------------------- | 223 | //------------------------------------------------------------------------- |
226 | 224 | ||
227 | 'retrieveRemoteDataFunction': function () { | 225 | 'retrieveRemoteDataFunction': function () { |
228 | return this._retrieveRemoteDataFunction; | 226 | return this._retrieveRemoteDataFunction; |
229 | }, | 227 | }, |
230 | 228 | ||
231 | 'setRetrieveRemoteDataFunction': function (aFunction) { | 229 | 'setRetrieveRemoteDataFunction': function (aFunction) { |
232 | this._retrieveRemoteDataFunction = aFunction; | 230 | this._retrieveRemoteDataFunction = aFunction; |
233 | }, | 231 | }, |
234 | 232 | ||
235 | //------------------------------------------------------------------------- | 233 | //------------------------------------------------------------------------- |
236 | 234 | ||
237 | 'decryptedDataStore': function () { | 235 | 'decryptedDataStore': function () { |
238 | if (this._decryptedDataStore == null) { | 236 | if (this._decryptedDataStore == null) { |
239 | this._decryptedDataStore = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.decryptedDataStore [3]'}*/); | 237 | this._decryptedDataStore = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.decryptedDataStore [3]'}*/); |
240 | }; | 238 | }; |
241 | 239 | ||
242 | return this._decryptedDataStore; | 240 | return this._decryptedDataStore; |
243 | }, | 241 | }, |
244 | 242 | ||
245 | //......................................................................... | 243 | //......................................................................... |
246 | 244 | ||
247 | 'getDecryptedData': function () { | 245 | 'getDecryptedData': function () { |
248 | var deferredResult; | 246 | var deferredResult; |
249 | var deferredLock; | 247 | var deferredLock; |
250 | 248 | ||
251 | deferredLock = this.getDeferredLockForKey('decryptedData'); | 249 | deferredLock = this.getDeferredLockForKey('decryptedData'); |
252 | 250 | ||
253 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.getDecryptedData", {trace:false}); | 251 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.getDecryptedData", {trace:false}); |
254 | deferredResult.acquireLock(deferredLock); | 252 | deferredResult.acquireLock(deferredLock); |
255 | deferredResult.addMethod(this, 'decryptedDataStore'); | 253 | deferredResult.addMethod(this, 'decryptedDataStore'); |
256 | deferredResult.addCallback(MochiKit.Base.methodcaller('deferredGetOrSet', 'decryptedData', MochiKit.Base.bind(function () { | 254 | deferredResult.addCallback(MochiKit.Base.methodcaller('deferredGetOrSet', 'decryptedData', MochiKit.Base.bind(function () { |
257 | varinnerDeferredResult; | 255 | varinnerDeferredResult; |
258 | 256 | ||
259 | innerDeferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.getDecryptedData <inner deferred>", {trace:false}); | 257 | innerDeferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.getDecryptedData <inner deferred>", {trace:false}); |
260 | 258 | ||
261 | innerDeferredResult.addMethod(this, 'getRemoteData'); | 259 | innerDeferredResult.addMethod(this, 'getRemoteData'); |
262 | innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); | 260 | innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); |
263 | innerDeferredResult.collectResults({ | 261 | innerDeferredResult.collectResults({ |
264 | 'key': MochiKit.Base.method(this, 'getKey'), | 262 | 'key': MochiKit.Base.method(this, 'getKey'), |
265 | 'value':MochiKit.Base.itemgetter(this._encryptedDataKeypath), | 263 | 'value':MochiKit.Base.itemgetter(this._encryptedDataKeypath), |
266 | 'version':MochiKit.Base.itemgetter(this._encryptedVersionKeypath) | 264 | 'version':MochiKit.Base.itemgetter(this._encryptedVersionKeypath) |
267 | }); | 265 | }); |
268 | 266 | ||
269 | innerDeferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt); | 267 | innerDeferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt); |
270 | innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); | 268 | innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); |
271 | innerDeferredResult.addMethod(this, 'unpackData'); | 269 | innerDeferredResult.addMethod(this, 'unpackData'); |
272 | innerDeferredResult.callback(); | 270 | innerDeferredResult.callback(); |
273 | 271 | ||
274 | return innerDeferredResult; | 272 | return innerDeferredResult; |
275 | }, this))); | 273 | }, this))); |
276 | deferredResult.releaseLock(deferredLock); | 274 | deferredResult.releaseLock(deferredLock); |
277 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); | 275 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); |
278 | deferredResult.callback(); | 276 | deferredResult.callback(); |
279 | 277 | ||
280 | return deferredResult; | 278 | return deferredResult; |
281 | }, | 279 | }, |
282 | 280 | ||
283 | //------------------------------------------------------------------------- | 281 | //------------------------------------------------------------------------- |
284 | 282 | ||
285 | 'setValue': function(aKey, aValue) { | 283 | 'setValue': function(aKey, aValue) { |
286 | var deferredResult; | 284 | var deferredResult; |
287 | 285 | ||
288 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.setValue", {trace:false}); | 286 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.setValue", {trace:false}); |
289 | deferredResult.addMethod(this, '_getObjectDataStore'); | 287 | deferredResult.addMethod(this, '_getObjectDataStore'); |
290 | deferredResult.addCallback(MochiKit.Base.methodcaller('setValue', aKey, aValue)); | 288 | deferredResult.addCallback(MochiKit.Base.methodcaller('setValue', aKey, aValue)); |
291 | deferredResult.callback(); | 289 | deferredResult.callback(); |
292 | 290 | ||
293 | return deferredResult; | 291 | return deferredResult; |
294 | }, | 292 | }, |
295 | 293 | ||
296 | //......................................................................... | 294 | //......................................................................... |
297 | 295 | ||
298 | 'getValue': function (aKey) { | 296 | 'getValue': function (aKey) { |
299 | return Clipperz.Async.callbacks("EncryptedRemoteObject.getValue", [ | 297 | return Clipperz.Async.callbacks("EncryptedRemoteObject.getValue", [ |
300 | MochiKit.Base.method(this, '_getObjectDataStore'), | 298 | MochiKit.Base.method(this, '_getObjectDataStore'), |
301 | MochiKit.Base.methodcaller('getValue', aKey) | 299 | MochiKit.Base.methodcaller('getValue', aKey) |
302 | ], {trace:false}); | 300 | ], {trace:false}); |
303 | }, | 301 | }, |
304 | 302 | ||
305 | //......................................................................... | 303 | //......................................................................... |
306 | 304 | ||
307 | 'removeValue': function (aKey) { | 305 | 'removeValue': function (aKey) { |
308 | return Clipperz.Async.callbacks("EncryptedRemoteObject.removeValue", [ | 306 | return Clipperz.Async.callbacks("EncryptedRemoteObject.removeValue", [ |
309 | MochiKit.Base.method(this, '_getObjectDataStore'), | 307 | MochiKit.Base.method(this, '_getObjectDataStore'), |
310 | MochiKit.Base.methodcaller('removeValue', aKey) | 308 | MochiKit.Base.methodcaller('removeValue', aKey) |
311 | ], {trace:false}); | 309 | ], {trace:false}); |
312 | }, | 310 | }, |
313 | 311 | ||
314 | //......................................................................... | 312 | //......................................................................... |
315 | 313 | ||
316 | 'values': function () { | 314 | 'values': function () { |
317 | return Clipperz.Async.callbacks("EncryptedRemoteObject.values", [ | 315 | return Clipperz.Async.callbacks("EncryptedRemoteObject.values", [ |
318 | MochiKit.Base.method(this, '_getObjectDataStore'), | 316 | MochiKit.Base.method(this, '_getObjectDataStore'), |
319 | MochiKit.Base.methodcaller('values') | 317 | MochiKit.Base.methodcaller('values') |
320 | ], {trace:false}); | 318 | ], {trace:false}); |
321 | }, | 319 | }, |
322 | 320 | ||
323 | 'setValues': function (someValues) { | 321 | 'setValues': function (someValues) { |
324 | return Clipperz.Async.callbacks("EncryptedRemoteObject.values", [ | 322 | return Clipperz.Async.callbacks("EncryptedRemoteObject.values", [ |
325 | MochiKit.Base.method(this, '_getObjectDataStore'), | 323 | MochiKit.Base.method(this, '_getObjectDataStore'), |
326 | MochiKit.Base.methodcaller('setValues', someValues) | 324 | MochiKit.Base.methodcaller('setValues', someValues) |
327 | ], {trace:false}); | 325 | ], {trace:false}); |
328 | }, | 326 | }, |
329 | 327 | ||
330 | //......................................................................... | 328 | //......................................................................... |
331 | 329 | ||
332 | '_getObjectDataStore': function () { | 330 | '_getObjectDataStore': function () { |
333 | var deferredResult; | 331 | var deferredResult; |
334 | var deferredLock; | 332 | var deferredLock; |
335 | 333 | ||
336 | deferredLock = this.getDeferredLockForKey('objectDataStore'); | 334 | deferredLock = this.getDeferredLockForKey('objectDataStore'); |
337 | 335 | ||
338 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject._getObjectDataStore", {trace:false}); | 336 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject._getObjectDataStore", {trace:false}); |
339 | deferredResult.acquireLock(deferredLock); | 337 | deferredResult.acquireLock(deferredLock); |
340 | deferredResult.addCallback(MochiKit.Base.bind(function () { | 338 | deferredResult.addCallback(MochiKit.Base.bind(function () { |
341 | var innerDeferredResult; | 339 | var innerDeferredResult; |
342 | 340 | ||
343 | if (this._objectDataStore == null) { | 341 | if (this._objectDataStore == null) { |
344 | this._objectDataStore = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.objectDataStore [4]'}*/); | 342 | this._objectDataStore = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.objectDataStore [4]'}*/); |
345 | 343 | ||
346 | innerDeferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject._getObjectDataStore <inner deferred>", {trace:false}); | 344 | innerDeferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject._getObjectDataStore <inner deferred>", {trace:false}); |
347 | innerDeferredResult.addMethod(this, 'getDecryptedData'); | 345 | innerDeferredResult.addMethod(this, 'getDecryptedData'); |
348 | innerDeferredResult.addMethod(this._objectDataStore, 'initWithValues'); | 346 | innerDeferredResult.addMethod(this._objectDataStore, 'initWithValues'); |
349 | innerDeferredResult.callback(); | 347 | innerDeferredResult.callback(); |
350 | } else { | 348 | } else { |
351 | innerDeferredResult = MochiKit.Async.succeed(this._objectDataStore); | 349 | innerDeferredResult = MochiKit.Async.succeed(this._objectDataStore); |
352 | } | 350 | } |
353 | 351 | ||
354 | return innerDeferredResult; | 352 | return innerDeferredResult; |
355 | }, this)); | 353 | }, this)); |
356 | deferredResult.releaseLock(deferredLock); | 354 | deferredResult.releaseLock(deferredLock); |
357 | deferredResult.callback(); | 355 | deferredResult.callback(); |
358 | 356 | ||
359 | return deferredResult; | 357 | return deferredResult; |
360 | }, | 358 | }, |
361 | 359 | ||
362 | 'hasInitiatedObjectDataStore': function () { | 360 | 'hasInitiatedObjectDataStore': function () { |
363 | return (this._objectDataStore != null); | 361 | return (this._objectDataStore != null); |
364 | }, | 362 | }, |
365 | 363 | ||
366 | //------------------------------------------------------------------------- | 364 | //------------------------------------------------------------------------- |
367 | 365 | ||
368 | 'getDeferredLockForKey': function (aKey) { | 366 | 'getDeferredLockForKey': function (aKey) { |
369 | var result; | 367 | var result; |
370 | 368 | ||
371 | result = this._deferredLocks[aKey]; | 369 | result = this._deferredLocks[aKey]; |
372 | 370 | ||
373 | if (typeof(result) == 'undefined') { | 371 | if (typeof(result) == 'undefined') { |
374 | result = new MochiKit.Async.DeferredLock(); | 372 | result = new MochiKit.Async.DeferredLock(); |
375 | this._deferredLocks[aKey] = result; | 373 | this._deferredLocks[aKey] = result; |
376 | } | 374 | } |
377 | 375 | ||
378 | return result; | 376 | return result; |
379 | }, | 377 | }, |
380 | 378 | ||
381 | //------------------------------------------------------------------------- | 379 | //------------------------------------------------------------------------- |
382 | 380 | ||
383 | 'unpackData': function (someData) { //++ | 381 | 'unpackData': function (someData) { //++ |
384 | return someData; | 382 | return someData; |
385 | }, | 383 | }, |
386 | 384 | ||
387 | 'packData': function (someData) { //++ | 385 | 'packData': function (someData) { //++ |
388 | return someData; | 386 | return someData; |
389 | }, | 387 | }, |
390 | 388 | ||
391 | //------------------------------------------------------------------------- | 389 | //------------------------------------------------------------------------- |
392 | 390 | ||
393 | 'hasPendingChanges': function () { | 391 | 'hasPendingChanges': function () { |
394 | var deferredResult; | 392 | var deferredResult; |
395 | var tempObj = this; | 393 | var tempObj = this; |
396 | 394 | ||
397 | if (this.isBrandNew()) { | 395 | if (this.isBrandNew()) { |
398 | // deferredResult = MochiKit.Async.succeed(true); | 396 | // deferredResult = MochiKit.Async.succeed(true); |
399 | deferredResult = this.hasPendingChangesWhenBrandNew(); | 397 | deferredResult = this.hasPendingChangesWhenBrandNew(); |
400 | } else if (this.hasInitiatedObjectDataStore()) { | 398 | } else if (this.hasInitiatedObjectDataStore()) { |
401 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.hasPendingChanges", {trace:false}); | 399 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.hasPendingChanges", {trace:false}); |
402 | deferredResult.collectResults({ | 400 | deferredResult.collectResults({ |
403 | 'decryptedData': [ | 401 | 'decryptedData': [ |
404 | MochiKit.Base.method(this, 'getDecryptedData'), | 402 | MochiKit.Base.method(this, 'getDecryptedData'), |
405 | Clipperz.Base.serializeJSON | 403 | Clipperz.Base.serializeJSON |
406 | ], | 404 | ], |
407 | 'objectData': [ | 405 | 'objectData': [ |
408 | MochiKit.Base.method(this, '_getObjectDataStore'), | 406 | MochiKit.Base.method(this, '_getObjectDataStore'), |
409 | MochiKit.Base.methodcaller('values'), | 407 | MochiKit.Base.methodcaller('values'), |
410 | Clipperz.Base.serializeJSON | 408 | Clipperz.Base.serializeJSON |
411 | ] | 409 | ] |
412 | }); | 410 | }); |
413 | deferredResult.addCallback(function (someValues) { | 411 | deferredResult.addCallback(function (someValues) { |
414 | //if (someValues['decryptedData'] != someValues['objectData']) { | ||
415 | //console.log("ORIGINAL DATA", '[[[' + someValues['decryptedData'] + ']]]'); | ||
416 | //console.log("CURRENT DATA", '>>>' + someValues['objectData'] + '<<<'); | ||
417 | //} | ||
418 | return (someValues['decryptedData'] != someValues['objectData']); | 412 | return (someValues['decryptedData'] != someValues['objectData']); |
419 | }); | 413 | }); |
420 | deferredResult.callback(); | 414 | deferredResult.callback(); |
421 | } else { | 415 | } else { |
422 | deferredResult = MochiKit.Async.succeed(false); | 416 | deferredResult = MochiKit.Async.succeed(false); |
423 | } | 417 | } |
424 | 418 | ||
425 | return deferredResult; | 419 | return deferredResult; |
426 | }, | 420 | }, |
427 | 421 | ||
428 | 'hasPendingChangesWhenBrandNew': function () { | 422 | 'hasPendingChangesWhenBrandNew': function () { |
429 | return MochiKit.Async.succeed(true); | 423 | return MochiKit.Async.succeed(true); |
430 | }, | 424 | }, |
431 | 425 | ||
432 | //------------------------------------------------------------------------- | 426 | //------------------------------------------------------------------------- |
433 | 427 | ||
434 | 'commitTransientState': function () { | 428 | 'commitTransientState': function () { |
435 | var deferredResult; | 429 | var deferredResult; |
436 | 430 | ||
437 | // if (this.transientState().getValue('__prepareRemoteData') == true) { | 431 | // if (this.transientState().getValue('__prepareRemoteData') == true) { |
438 | if (this.transientState().getValue('packedRemoteData') != null) { | 432 | if (this.transientState().getValue('packedRemoteData') != null) { |
439 | deferredResult = Clipperz.Async.callbacks("EncryptedRemoteObject.commitTransientState - prepareRemoteData", [ | 433 | deferredResult = Clipperz.Async.callbacks("EncryptedRemoteObject.commitTransientState - prepareRemoteData", [ |
440 | MochiKit.Base.bind(function (someData) { | 434 | MochiKit.Base.bind(function (someData) { |
441 | this._remoteData = this.transientState().getValue('packedRemoteData'); | 435 | this._remoteData = this.transientState().getValue('packedRemoteData'); |
442 | }, this), | 436 | }, this), |
443 | 437 | ||
444 | MochiKit.Base.method(this, '_getObjectDataStore'), | 438 | MochiKit.Base.method(this, '_getObjectDataStore'), |
445 | MochiKit.Base.methodcaller('values'), | 439 | MochiKit.Base.methodcaller('values'), |
446 | Clipperz.Base.deepClone, | 440 | Clipperz.Base.deepClone, |
447 | MochiKit.Base.method(this.decryptedDataStore(), 'setValue', 'decryptedData'), | 441 | MochiKit.Base.method(this.decryptedDataStore(), 'setValue', 'decryptedData'), |
448 | 442 | ||
449 | MochiKit.Base.method(this, 'resetTransientState', true) | 443 | MochiKit.Base.method(this, 'resetTransientState', true) |
450 | ], {trace:false}); | 444 | ], {trace:false}); |
451 | 445 | ||
452 | } else { | 446 | } else { |
453 | deferredResult = Clipperz.Async.callbacks("EncryptedRemoteObject.commitTransientState - NO prepareRemoteData", [ | 447 | deferredResult = Clipperz.Async.callbacks("EncryptedRemoteObject.commitTransientState - NO prepareRemoteData", [ |
454 | MochiKit.Base.method(this, 'resetTransientState', true) | 448 | MochiKit.Base.method(this, 'resetTransientState', true) |
455 | ], {trace:false}); | 449 | ], {trace:false}); |
456 | } | 450 | } |
457 | 451 | ||
458 | this._isBrandNew = false; | 452 | this._isBrandNew = false; |
459 | 453 | ||
460 | return deferredResult; | 454 | return deferredResult; |
461 | }, | 455 | }, |
462 | 456 | ||
463 | //------------------------------------------------------------------------- | 457 | //------------------------------------------------------------------------- |
464 | 458 | ||
465 | 'revertChanges': function () { | 459 | 'revertChanges': function () { |
466 | if (this.hasInitiatedObjectDataStore()) { | 460 | if (this.hasInitiatedObjectDataStore()) { |
467 | this._objectDataStore.removeAllData(); | 461 | this._objectDataStore.removeAllData(); |
468 | this._objectDataStore = null; | 462 | this._objectDataStore = null; |
469 | } | 463 | } |
470 | this.resetTransientState(false); | 464 | this.resetTransientState(false); |
471 | 465 | ||
472 | return MochiKit.Async.succeed(); | 466 | return MochiKit.Async.succeed(); |
473 | }, | 467 | }, |
474 | 468 | ||
475 | //------------------------------------------------------------------------- | 469 | //------------------------------------------------------------------------- |
476 | 470 | ||
477 | 'deleteAllCleanTextData': function () { | 471 | 'deleteAllCleanTextData': function () { |
478 | var deferredResult; | 472 | var deferredResult; |
479 | 473 | ||
480 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.deleteAllCleanTextData", {trace:false}); | 474 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.deleteAllCleanTextData", {trace:false}); |
481 | 475 | ||
482 | deferredResult.addMethod(this, 'resetTransientState', false); | 476 | deferredResult.addMethod(this, 'resetTransientState', false); |
483 | 477 | ||
484 | deferredResult.acquireLock(this.getDeferredLockForKey('decryptedData')); | 478 | deferredResult.acquireLock(this.getDeferredLockForKey('decryptedData')); |
485 | deferredResult.addCallback(MochiKit.Base.bind(function () { | 479 | deferredResult.addCallback(MochiKit.Base.bind(function () { |
486 | if (this._decryptedDataStore != null) { | 480 | if (this._decryptedDataStore != null) { |
487 | this._decryptedDataStore.removeAllData(); | 481 | this._decryptedDataStore.removeAllData(); |
488 | } | 482 | } |
489 | }, this)); | 483 | }, this)); |
490 | deferredResult.releaseLock(this.getDeferredLockForKey('decryptedData')); | 484 | deferredResult.releaseLock(this.getDeferredLockForKey('decryptedData')); |
491 | 485 | ||
492 | deferredResult.acquireLock(this.getDeferredLockForKey('objectDataStore')); | 486 | deferredResult.acquireLock(this.getDeferredLockForKey('objectDataStore')); |
493 | deferredResult.addCallback(MochiKit.Base.bind(function () { | 487 | deferredResult.addCallback(MochiKit.Base.bind(function () { |
494 | if (this._objectDataStore != null) { | 488 | if (this._objectDataStore != null) { |
495 | this._objectDataStore.removeAllData(); | 489 | this._objectDataStore.removeAllData(); |
496 | this._objectDataStore = null; | 490 | this._objectDataStore = null; |
497 | } | 491 | } |
498 | }, this)); | 492 | }, this)); |
499 | deferredResult.releaseLock(this.getDeferredLockForKey('objectDataStore')); | 493 | deferredResult.releaseLock(this.getDeferredLockForKey('objectDataStore')); |
500 | 494 | ||
501 | deferredResult.callback(); | 495 | deferredResult.callback(); |
502 | 496 | ||
503 | return deferredResult; | 497 | return deferredResult; |
504 | }, | 498 | }, |
505 | 499 | ||
506 | //......................................................................... | 500 | //......................................................................... |
507 | 501 | ||
508 | 'hasAnyCleanTextData': function () { | 502 | 'hasAnyCleanTextData': function () { |
509 | var result; | 503 | var result; |
510 | 504 | ||
511 | result = false; | 505 | result = false; |
512 | 506 | ||
513 | result = result || (! this.decryptedDataStore().isEmpty()); | 507 | result = result || (! this.decryptedDataStore().isEmpty()); |
514 | result = result || (! this.transientState().isEmpty()); | 508 | result = result || (! this.transientState().isEmpty()); |
515 | if (this.hasInitiatedObjectDataStore()) { | 509 | if (this.hasInitiatedObjectDataStore()) { |
516 | result = result || (! this._objectDataStore.isEmpty()); | 510 | result = result || (! this._objectDataStore.isEmpty()); |
517 | } | 511 | } |
518 | 512 | ||
519 | return MochiKit.Async.succeed(result); | 513 | return MochiKit.Async.succeed(result); |
520 | }, | 514 | }, |
521 | 515 | ||
522 | //------------------------------------------------------------------------- | 516 | //------------------------------------------------------------------------- |
523 | 517 | ||
524 | 'prepareRemoteDataWithKey': function (aKey) { | 518 | 'prepareRemoteDataWithKey': function (aKey) { |
525 | return Clipperz.Async.callbacks("EncryptedRemoteObject.prepareRemoteDataWithKey", [ | 519 | return Clipperz.Async.callbacks("EncryptedRemoteObject.prepareRemoteDataWithKey", [ |
526 | // MochiKit.Base.method(this.transientState(), 'setValue', '__prepareRemoteData', true), | 520 | // MochiKit.Base.method(this.transientState(), 'setValue', '__prepareRemoteData', true), |
527 | MochiKit.Base.method(this, '_getObjectDataStore'), | 521 | MochiKit.Base.method(this, '_getObjectDataStore'), |
528 | MochiKit.Base.methodcaller('values'), | 522 | MochiKit.Base.methodcaller('values'), |
529 | MochiKit.Base.method(this, 'packData'), | 523 | MochiKit.Base.method(this, 'packData'), |
530 | function (someData) { | 524 | function (someData) { |
531 | return Clipperz.PM.Crypto.deferredEncrypt({ | 525 | return Clipperz.PM.Crypto.deferredEncrypt({ |
532 | 'key': aKey, | 526 | 'key': aKey, |
533 | 'value':someData, | 527 | 'value':someData, |
534 | 'version':Clipperz.PM.Crypto.encryptingFunctions.currentVersion | 528 | 'version':Clipperz.PM.Crypto.encryptingFunctions.currentVersion |
535 | }) | 529 | }) |
536 | }, | 530 | }, |
537 | MochiKit.Base.method(this, 'packRemoteData'), | 531 | MochiKit.Base.method(this, 'packRemoteData'), |
538 | MochiKit.Base.method(this.transientState(), 'setValue', 'packedRemoteData'), | 532 | MochiKit.Base.method(this.transientState(), 'setValue', 'packedRemoteData'), |
539 | function (someData) { | 533 | function (someData) { |
540 | MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'advanceProgress'); | 534 | MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'advanceProgress'); |
541 | return someData; | 535 | return someData; |
542 | } | 536 | } |
543 | ], {trace:false}); | 537 | ], {trace:false}); |
544 | }, | 538 | }, |
545 | 539 | ||
546 | //------------------------------------------------------------------------- | 540 | //------------------------------------------------------------------------- |
547 | __syntaxFix__: "syntax fix" | 541 | __syntaxFix__: "syntax fix" |
548 | }); | 542 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js b/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js index 834e21b..fbca1ff 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js | |||
@@ -1,354 +1,350 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | 28 | ||
31 | //############################################################################# | 29 | //############################################################################# |
32 | 30 | ||
33 | Clipperz.PM.DataModel.OneTimePassword = function(args) { | 31 | Clipperz.PM.DataModel.OneTimePassword = function(args) { |
34 | args = args || {}; | 32 | args = args || {}; |
35 | 33 | ||
36 | //this._user = args['user']; | 34 | //this._user = args['user']; |
37 | this._reference = args['reference']|| Clipperz.PM.Crypto.randomKey(); | 35 | this._reference = args['reference']|| Clipperz.PM.Crypto.randomKey(); |
38 | this._password = args['password']; | 36 | this._password = args['password']; |
39 | this._passwordValue = Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword(args['password']); | 37 | this._passwordValue = Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword(args['password']); |
40 | this._creationDate = args['created'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['created']) : new Date(); | 38 | this._creationDate = args['created'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['created']) : new Date(); |
41 | this._usageDate = args['used'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['used']) : null; | 39 | this._usageDate = args['used'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['used']) : null; |
42 | 40 | ||
43 | this._status = args['status'] || 'ACTIVE'; //'REQUESTED', 'USED', 'DISABLED' | 41 | this._status = args['status'] || 'ACTIVE'; //'REQUESTED', 'USED', 'DISABLED' |
44 | this._connectionInfo= null; | 42 | this._connectionInfo= null; |
45 | 43 | ||
46 | this._key = null; | 44 | this._key = null; |
47 | this._keyChecksum= null; | 45 | this._keyChecksum= null; |
48 | 46 | ||
49 | return this; | 47 | return this; |
50 | } | 48 | } |
51 | 49 | ||
52 | Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, { | 50 | Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, { |
53 | 51 | ||
54 | 'toString': function() { | 52 | 'toString': function() { |
55 | return "Clipperz.PM.DataModel.OneTimePassword"; | 53 | return "Clipperz.PM.DataModel.OneTimePassword"; |
56 | }, | 54 | }, |
57 | /* | 55 | /* |
58 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
59 | 57 | ||
60 | 'user': function() { | 58 | 'user': function() { |
61 | return this._user; | 59 | return this._user; |
62 | }, | 60 | }, |
63 | 61 | ||
64 | //------------------------------------------------------------------------- | 62 | //------------------------------------------------------------------------- |
65 | 63 | ||
66 | 'password': function() { | 64 | 'password': function() { |
67 | return this._password; | 65 | return this._password; |
68 | }, | 66 | }, |
69 | 67 | ||
70 | //------------------------------------------------------------------------- | 68 | //------------------------------------------------------------------------- |
71 | 69 | ||
72 | 'passwordValue': function() { | 70 | 'passwordValue': function() { |
73 | return this._passwordValue; | 71 | return this._passwordValue; |
74 | }, | 72 | }, |
75 | 73 | ||
76 | //------------------------------------------------------------------------- | 74 | //------------------------------------------------------------------------- |
77 | 75 | ||
78 | 'creationDate': function() { | 76 | 'creationDate': function() { |
79 | return this._creationDate; | 77 | return this._creationDate; |
80 | }, | 78 | }, |
81 | 79 | ||
82 | //------------------------------------------------------------------------- | 80 | //------------------------------------------------------------------------- |
83 | 81 | ||
84 | 'reference': function() { | 82 | 'reference': function() { |
85 | return this._reference; | 83 | return this._reference; |
86 | }, | 84 | }, |
87 | 85 | ||
88 | //------------------------------------------------------------------------- | 86 | //------------------------------------------------------------------------- |
89 | 87 | ||
90 | 'key': function() { | 88 | 'key': function() { |
91 | if (this._key == null) { | 89 | if (this._key == null) { |
92 | this._key = Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(this.user().username(), this.passwordValue()); | 90 | this._key = Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(this.user().username(), this.passwordValue()); |
93 | } | 91 | } |
94 | 92 | ||
95 | return this._key; | 93 | return this._key; |
96 | }, | 94 | }, |
97 | 95 | ||
98 | //------------------------------------------------------------------------- | 96 | //------------------------------------------------------------------------- |
99 | 97 | ||
100 | 'keyChecksum': function() { | 98 | 'keyChecksum': function() { |
101 | if (this._keyChecksum == null) { | 99 | if (this._keyChecksum == null) { |
102 | this._keyChecksum = Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(this.user().username(), this.passwordValue()); | 100 | this._keyChecksum = Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(this.user().username(), this.passwordValue()); |
103 | } | 101 | } |
104 | 102 | ||
105 | return this._keyChecksum; | 103 | return this._keyChecksum; |
106 | }, | 104 | }, |
107 | */ | 105 | */ |
108 | //------------------------------------------------------------------------- | 106 | //------------------------------------------------------------------------- |
109 | 107 | ||
110 | 'status': function() { | 108 | 'status': function() { |
111 | return this._status; | 109 | return this._status; |
112 | }, | 110 | }, |
113 | 111 | ||
114 | 'setStatus': function(aValue) { | 112 | 'setStatus': function(aValue) { |
115 | this._status = aValue; | 113 | this._status = aValue; |
116 | }, | 114 | }, |
117 | 115 | ||
118 | //------------------------------------------------------------------------- | 116 | //------------------------------------------------------------------------- |
119 | /* | 117 | /* |
120 | 'serializedData': function() { | 118 | 'serializedData': function() { |
121 | var result; | 119 | var result; |
122 | 120 | ||
123 | result = { | 121 | result = { |
124 | 'password': this.password(), | 122 | 'password': this.password(), |
125 | 'created': this.creationDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.creationDate()) : null, | 123 | 'created': this.creationDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.creationDate()) : null, |
126 | 'used': this.usageDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.usageDate()) : null, | 124 | 'used': this.usageDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.usageDate()) : null, |
127 | 'status': this.status() | 125 | 'status': this.status() |
128 | }; | 126 | }; |
129 | 127 | ||
130 | return result; | 128 | return result; |
131 | }, | 129 | }, |
132 | 130 | ||
133 | //------------------------------------------------------------------------- | 131 | //------------------------------------------------------------------------- |
134 | 132 | ||
135 | 'packedPassphrase': function() { | 133 | 'packedPassphrase': function() { |
136 | var result; | 134 | var result; |
137 | var packedPassphrase; | 135 | var packedPassphrase; |
138 | var encodedPassphrase; | 136 | var encodedPassphrase; |
139 | varprefixPadding; | 137 | varprefixPadding; |
140 | var suffixPadding; | 138 | var suffixPadding; |
141 | var getRandomBytes; | 139 | var getRandomBytes; |
142 | 140 | ||
143 | getRandomBytes = MochiKit.Base.method(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'getRandomBytes'); | 141 | getRandomBytes = MochiKit.Base.method(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'getRandomBytes'); |
144 | 142 | ||
145 | encodedPassphrase = new Clipperz.ByteArray(this.user().passphrase()).toBase64String(); | 143 | encodedPassphrase = new Clipperz.ByteArray(this.user().passphrase()).toBase64String(); |
146 | //MochiKit.Logging.logDebug("--- encodedPassphrase.length: " + encodedPassphrase.length); | 144 | //Clipperz.logDebug("--- encodedPassphrase.length: " + encodedPassphrase.length); |
147 | prefixPadding = getRandomBytes(getRandomBytes(1).byteAtIndex(0)).toBase64String(); | 145 | prefixPadding = getRandomBytes(getRandomBytes(1).byteAtIndex(0)).toBase64String(); |
148 | //MochiKit.Logging.logDebug("--- prefixPadding.length: " + prefixPadding.length); | 146 | //Clipperz.logDebug("--- prefixPadding.length: " + prefixPadding.length); |
149 | suffixPadding = getRandomBytes((500 - prefixPadding.length - encodedPassphrase.length) * 6 / 8).toBase64String(); | 147 | suffixPadding = getRandomBytes((500 - prefixPadding.length - encodedPassphrase.length) * 6 / 8).toBase64String(); |
150 | //MochiKit.Logging.logDebug("--- suffixPadding.length: " + suffixPadding.length); | 148 | //Clipperz.logDebug("--- suffixPadding.length: " + suffixPadding.length); |
151 | //MochiKit.Logging.logDebug("--- total.length: " + (prefixPadding.length + encodedPassphrase.length + suffixPadding.length)); | 149 | //Clipperz.logDebug("--- total.length: " + (prefixPadding.length + encodedPassphrase.length + suffixPadding.length)); |
152 | 150 | ||
153 | packedPassphrase = { | 151 | packedPassphrase = { |
154 | 'prefix': prefixPadding, | 152 | 'prefix': prefixPadding, |
155 | 'passphrase': encodedPassphrase, | 153 | 'passphrase': encodedPassphrase, |
156 | 'suffix': suffixPadding | 154 | 'suffix': suffixPadding |
157 | }; | 155 | }; |
158 | 156 | ||
159 | // result = Clipperz.Base.serializeJSON(packedPassphrase); | 157 | // result = Clipperz.Base.serializeJSON(packedPassphrase); |
160 | result = packedPassphrase; | 158 | result = packedPassphrase; |
161 | //MochiKit.Logging.logDebug("===== OTP packedPassprase: [" + result.length + "]" + result); | 159 | //Clipperz.logDebug("===== OTP packedPassprase: [" + result.length + "]" + result); |
162 | //MochiKit.Logging.logDebug("<<< OneTimePassword.packedPassphrase"); | 160 | //Clipperz.logDebug("<<< OneTimePassword.packedPassphrase"); |
163 | 161 | ||
164 | return result; | 162 | return result; |
165 | }, | 163 | }, |
166 | 164 | ||
167 | //------------------------------------------------------------------------- | 165 | //------------------------------------------------------------------------- |
168 | 166 | ||
169 | 'encryptedPackedPassphrase': function() { | 167 | 'encryptedPackedPassphrase': function() { |
170 | return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(this.passwordValue(), this.packedPassphrase()) | 168 | return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(this.passwordValue(), this.packedPassphrase()) |
171 | }, | 169 | }, |
172 | 170 | ||
173 | //------------------------------------------------------------------------- | 171 | //------------------------------------------------------------------------- |
174 | 172 | ||
175 | 'encryptedData': function() { | 173 | 'encryptedData': function() { |
176 | var deferredResult; | 174 | var deferredResult; |
177 | varresult; | 175 | varresult; |
178 | 176 | ||
179 | //MochiKit.Logging.logDebug(">>> OneTimePassword.encryptedData"); | 177 | //Clipperz.logDebug(">>> OneTimePassword.encryptedData"); |
180 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - id: " + this.reference()); | 178 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - id: " + this.reference()); |
181 | result = { | 179 | result = { |
182 | 'reference': this.reference(), | 180 | 'reference': this.reference(), |
183 | 'key': this.key(), | 181 | 'key': this.key(), |
184 | 'keyChecksum': this.keyChecksum(), | 182 | 'keyChecksum': this.keyChecksum(), |
185 | 'data': "", | 183 | 'data': "", |
186 | 'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion | 184 | 'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion |
187 | } | 185 | } |
188 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 2: " + Clipperz.Base.serializeJSON(result)); | 186 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - 2: " + Clipperz.Base.serializeJSON(result)); |
189 | deferredResult = new MochiKit.Async.Deferred(); | 187 | deferredResult = new MochiKit.Async.Deferred(); |
190 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 3"); | 188 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - 3"); |
191 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 1: " + res); return res;}); | 189 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.encryptedData - 1: " + res); return res;}); |
192 | //# deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion, this.passwordValue(), this.packedPassphrase()); | 190 | //# deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion, this.passwordValue(), this.packedPassphrase()); |
193 | deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedPackedPassphrase')); | 191 | deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedPackedPassphrase')); |
194 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 4"); | 192 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - 4"); |
195 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 2: [" + res.length + "]" + res); return res;}); | 193 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.encryptedData - 2: [" + res.length + "]" + res); return res;}); |
196 | deferredResult.addCallback(function(aResult, res) { | 194 | deferredResult.addCallback(function(aResult, res) { |
197 | aResult['data'] = res; | 195 | aResult['data'] = res; |
198 | return aResult; | 196 | return aResult; |
199 | }, result); | 197 | }, result); |
200 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 5"); | 198 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - 5"); |
201 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 3: " + Clipperz.Base.serializeJSON(res)); return res;}); | 199 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.encryptedData - 3: " + Clipperz.Base.serializeJSON(res)); return res;}); |
202 | deferredResult.callback(); | 200 | deferredResult.callback(); |
203 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 6"); | 201 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - 6"); |
204 | 202 | ||
205 | return deferredResult; | 203 | return deferredResult; |
206 | }, | 204 | }, |
207 | 205 | ||
208 | //------------------------------------------------------------------------- | 206 | //------------------------------------------------------------------------- |
209 | 207 | ||
210 | 'saveChanges': function() { | 208 | 'saveChanges': function() { |
211 | var deferredResult; | 209 | var deferredResult; |
212 | varresult; | 210 | varresult; |
213 | 211 | ||
214 | //MochiKit.Logging.logDebug(">>> OneTimePassword.saveChanges"); | 212 | //Clipperz.logDebug(">>> OneTimePassword.saveChanges"); |
215 | result = {}; | 213 | result = {}; |
216 | deferredResult = new MochiKit.Async.Deferred(); | 214 | deferredResult = new MochiKit.Async.Deferred(); |
217 | 215 | ||
218 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptUserData'); | 216 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptUserData'); |
219 | deferredResult.addCallback(MochiKit.Base.method(this.user(), 'encryptedData')); | 217 | deferredResult.addCallback(MochiKit.Base.method(this.user(), 'encryptedData')); |
220 | deferredResult.addCallback(function(aResult, res) { | 218 | deferredResult.addCallback(function(aResult, res) { |
221 | aResult['user'] = res; | 219 | aResult['user'] = res; |
222 | return aResult; | 220 | return aResult; |
223 | }, result); | 221 | }, result); |
224 | 222 | ||
225 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptOTPData'); | 223 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptOTPData'); |
226 | deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedData')); | 224 | deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedData')); |
227 | deferredResult.addCallback(function(aResult, res) { | 225 | deferredResult.addCallback(function(aResult, res) { |
228 | aResult['oneTimePassword'] = res; | 226 | aResult['oneTimePassword'] = res; |
229 | return aResult; | 227 | return aResult; |
230 | }, result); | 228 | }, result); |
231 | 229 | ||
232 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_sendingData'); | 230 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_sendingData'); |
233 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 1: " + Clipperz.Base.serializeJSON(res)); return res;}); | 231 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.saveChanges - 1: " + Clipperz.Base.serializeJSON(res)); return res;}); |
234 | deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'addNewOneTimePassword'); | 232 | deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'addNewOneTimePassword'); |
235 | 233 | ||
236 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_updatingInterface'); | 234 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_updatingInterface'); |
237 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;}); | 235 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;}); |
238 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'notify', 'OTPUpdated'); | 236 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'notify', 'OTPUpdated'); |
239 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'oneTimePassword_saveChanges_done', null); | 237 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'oneTimePassword_saveChanges_done', null); |
240 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;}); | 238 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;}); |
241 | deferredResult.callback(); | 239 | deferredResult.callback(); |
242 | //MochiKit.Logging.logDebug("<<< OneTimePassword.saveChanges"); | 240 | //Clipperz.logDebug("<<< OneTimePassword.saveChanges"); |
243 | 241 | ||
244 | return deferredResult; | 242 | return deferredResult; |
245 | }, | 243 | }, |
246 | 244 | ||
247 | //------------------------------------------------------------------------- | 245 | //------------------------------------------------------------------------- |
248 | 246 | ||
249 | 'usageDate': function() { | 247 | 'usageDate': function() { |
250 | return this._usageDate; | 248 | return this._usageDate; |
251 | }, | 249 | }, |
252 | 250 | ||
253 | 'setUsageDate': function(aValue) { | 251 | 'setUsageDate': function(aValue) { |
254 | this._usageDate = aValue; | 252 | this._usageDate = aValue; |
255 | }, | 253 | }, |
256 | 254 | ||
257 | //------------------------------------------------------------------------- | 255 | //------------------------------------------------------------------------- |
258 | 256 | ||
259 | 'connectionInfo': function() { | 257 | 'connectionInfo': function() { |
260 | return this._connectionInfo; | 258 | return this._connectionInfo; |
261 | }, | 259 | }, |
262 | 260 | ||
263 | 'setConnectionInfo': function(aValue) { | 261 | 'setConnectionInfo': function(aValue) { |
264 | this._connectionInfo = aValue; | 262 | this._connectionInfo = aValue; |
265 | }, | 263 | }, |
266 | 264 | ||
267 | //------------------------------------------------------------------------- | 265 | //------------------------------------------------------------------------- |
268 | 266 | ||
269 | 'isExpired': function() { | 267 | 'isExpired': function() { |
270 | return (this.usageDate() != null); | 268 | return (this.usageDate() != null); |
271 | }, | 269 | }, |
272 | 270 | ||
273 | //------------------------------------------------------------------------- | 271 | //------------------------------------------------------------------------- |
274 | 272 | ||
275 | 'updateStatusWithValues': function(someValues) { | 273 | 'updateStatusWithValues': function(someValues) { |
276 | var result; | 274 | var result; |
277 | 275 | ||
278 | result = false; | 276 | result = false; |
279 | 277 | ||
280 | if (someValues['status'] != this.status()) { | 278 | if (someValues['status'] != this.status()) { |
281 | result = true; | 279 | result = true; |
282 | } | 280 | } |
283 | 281 | ||
284 | this.setStatus(someValues['status']); | 282 | this.setStatus(someValues['status']); |
285 | this.setUsageDate(Clipperz.PM.Date.parseDateWithUTCFormat(someValues['requestDate'])); | 283 | this.setUsageDate(Clipperz.PM.Date.parseDateWithUTCFormat(someValues['requestDate'])); |
286 | this.setConnectionInfo(someValues['connection']); | 284 | this.setConnectionInfo(someValues['connection']); |
287 | 285 | ||
288 | return result; | 286 | return result; |
289 | }, | 287 | }, |
290 | */ | 288 | */ |
291 | //------------------------------------------------------------------------- | 289 | //------------------------------------------------------------------------- |
292 | __syntaxFix__: "syntax fix" | 290 | __syntaxFix__: "syntax fix" |
293 | }); | 291 | }); |
294 | 292 | ||
295 | //############################################################################# | 293 | //############################################################################# |
296 | 294 | ||
297 | Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword = function(anUsername, aPassword) { | 295 | Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword = function(anUsername, aPassword) { |
298 | return Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aPassword)).toHexString().substring(2); | 296 | return Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aPassword)).toHexString().substring(2); |
299 | } | 297 | } |
300 | 298 | ||
301 | Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword = function(anUsername, aPassword) { | 299 | Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword = function(anUsername, aPassword) { |
302 | return Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(anUsername + aPassword)).toHexString().substring(2); | 300 | return Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(anUsername + aPassword)).toHexString().substring(2); |
303 | } | 301 | } |
304 | 302 | ||
305 | //============================================================================= | 303 | //============================================================================= |
306 | 304 | ||
307 | Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue = function(aPassword) { | 305 | Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue = function(aPassword) { |
308 | var result; | 306 | var result; |
309 | 307 | ||
310 | //"yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg" | 308 | //"yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg" |
311 | //console.log("Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue", aPassword); | ||
312 | if (aPassword.replace(/[\s\-]/g, '').length == 32) { | 309 | if (aPassword.replace(/[\s\-]/g, '').length == 32) { |
313 | try { | 310 | try { |
314 | var passwordByteArray; | 311 | var passwordByteArray; |
315 | 312 | ||
316 | passwordByteArray = new Clipperz.ByteArray(); | 313 | passwordByteArray = new Clipperz.ByteArray(); |
317 | passwordByteArray.appendBase32String(aPassword); | 314 | passwordByteArray.appendBase32String(aPassword); |
318 | 315 | ||
319 | result = true; | 316 | result = true; |
320 | } catch(exception) { | 317 | } catch(exception) { |
321 | result = false; | 318 | result = false; |
322 | } | 319 | } |
323 | } else { | 320 | } else { |
324 | result = false; | 321 | result = false; |
325 | } | 322 | } |
326 | 323 | ||
327 | return result; | 324 | return result; |
328 | } | 325 | } |
329 | 326 | ||
330 | //============================================================================= | 327 | //============================================================================= |
331 | 328 | ||
332 | Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword = function(aPassword) { | 329 | Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword = function(aPassword) { |
333 | varresult; | 330 | varresult; |
334 | 331 | ||
335 | if (aPassword.replace(/[\s\-]/g, '').length == 32) { | 332 | if (aPassword.replace(/[\s\-]/g, '').length == 32) { |
336 | try { | 333 | try { |
337 | var passwordByteArray; | 334 | var passwordByteArray; |
338 | 335 | ||
339 | passwordByteArray = new Clipperz.ByteArray(); | 336 | passwordByteArray = new Clipperz.ByteArray(); |
340 | passwordByteArray.appendBase32String(aPassword); | 337 | passwordByteArray.appendBase32String(aPassword); |
341 | 338 | ||
342 | result = passwordByteArray.toBase64String(); | 339 | result = passwordByteArray.toBase64String(); |
343 | } catch(exception) { | 340 | } catch(exception) { |
344 | result = aPassword; | 341 | result = aPassword; |
345 | } | 342 | } |
346 | } else { | 343 | } else { |
347 | result = aPassword; | 344 | result = aPassword; |
348 | } | 345 | } |
349 | 346 | ||
350 | //console.log("Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword", aPassword, result); | ||
351 | return result; | 347 | return result; |
352 | } | 348 | } |
353 | 349 | ||
354 | //############################################################################# | 350 | //############################################################################# |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js index f51bbc2..986db40 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js | |||
@@ -1,164 +1,162 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.PM.DataModel.Record.Version) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.Record.Version) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.Record.Version.Field depends on Clipperz.PM.DataModel.Record.Version!"; | 25 | throw "Clipperz.PM.DataModel.Record.Version.Field depends on Clipperz.PM.DataModel.Record.Version!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | Clipperz.PM.DataModel.Record.Version.Field = function(args) { | 28 | Clipperz.PM.DataModel.Record.Version.Field = function(args) { |
31 | Clipperz.PM.DataModel.Record.Version.Field.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.DataModel.Record.Version.Field.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._recordVersion = args.recordVersion|| Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._recordVersion = args.recordVersion|| Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); | 32 | this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); |
35 | 33 | ||
36 | return this; | 34 | return this; |
37 | } | 35 | } |
38 | 36 | ||
39 | 37 | ||
40 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version.Field, Object, { | 38 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version.Field, Object, { |
41 | 39 | ||
42 | 'toString': function() { | 40 | 'toString': function() { |
43 | return "Record.Version.Field (" + this.reference() + ")"; | 41 | return "Record.Version.Field (" + this.reference() + ")"; |
44 | }, | 42 | }, |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
47 | 45 | ||
48 | 'recordVersion': function () { | 46 | 'recordVersion': function () { |
49 | return this._recordVersion; | 47 | return this._recordVersion; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
53 | 51 | ||
54 | 'reference': function () { | 52 | 'reference': function () { |
55 | return this._reference; | 53 | return this._reference; |
56 | }, | 54 | }, |
57 | 55 | ||
58 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
59 | 57 | ||
60 | 'getItem': function (aKey) { | 58 | 'getItem': function (aKey) { |
61 | return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.getItem", [ | 59 | return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.getItem", [ |
62 | MochiKit.Base.method(this, 'recordVersion'), | 60 | MochiKit.Base.method(this, 'recordVersion'), |
63 | MochiKit.Base.methodcaller('getValue', 'fields' + '.' + this.reference() + '.' + aKey) | 61 | MochiKit.Base.methodcaller('getValue', 'fields' + '.' + this.reference() + '.' + aKey) |
64 | ], {trace:false}); | 62 | ], {trace:false}); |
65 | }, | 63 | }, |
66 | 64 | ||
67 | 'setItem': function (aKey, aValue) { | 65 | 'setItem': function (aKey, aValue) { |
68 | return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.getItem", [ | 66 | return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.getItem", [ |
69 | MochiKit.Base.method(this, 'recordVersion'), | 67 | MochiKit.Base.method(this, 'recordVersion'), |
70 | MochiKit.Base.methodcaller('setValue', 'fields' + '.' + this.reference() + '.' + aKey, aValue) | 68 | MochiKit.Base.methodcaller('setValue', 'fields' + '.' + this.reference() + '.' + aKey, aValue) |
71 | ], {trace:false}); | 69 | ], {trace:false}); |
72 | }, | 70 | }, |
73 | 71 | ||
74 | //------------------------------------------------------------------------- | 72 | //------------------------------------------------------------------------- |
75 | 73 | ||
76 | 'label': function () { | 74 | 'label': function () { |
77 | return this.getItem('label'); | 75 | return this.getItem('label'); |
78 | }, | 76 | }, |
79 | 77 | ||
80 | 'setLabel': function (aValue) { | 78 | 'setLabel': function (aValue) { |
81 | return this.setItem('label', aValue); | 79 | return this.setItem('label', aValue); |
82 | }, | 80 | }, |
83 | 81 | ||
84 | //------------------------------------------------------------------------- | 82 | //------------------------------------------------------------------------- |
85 | 83 | ||
86 | 'value': function () { | 84 | 'value': function () { |
87 | return this.getItem('value'); | 85 | return this.getItem('value'); |
88 | }, | 86 | }, |
89 | 87 | ||
90 | 'setValue': function (aValue) { | 88 | 'setValue': function (aValue) { |
91 | return this.setItem('value', aValue); | 89 | return this.setItem('value', aValue); |
92 | }, | 90 | }, |
93 | 91 | ||
94 | //------------------------------------------------------------------------- | 92 | //------------------------------------------------------------------------- |
95 | 93 | ||
96 | 'actionType': function () { | 94 | 'actionType': function () { |
97 | return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.actionType", [ | 95 | return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.actionType", [ |
98 | Clipperz.Async.collectResults("Clipperz.PM.DataModel.Record.Version.Field.actionType [collect results]", { | 96 | Clipperz.Async.collectResults("Clipperz.PM.DataModel.Record.Version.Field.actionType [collect results]", { |
99 | 'isHidden':MochiKit.Base.method(this, 'isHidden'), | 97 | 'isHidden':MochiKit.Base.method(this, 'isHidden'), |
100 | 'value':MochiKit.Base.method(this, 'value') | 98 | 'value':MochiKit.Base.method(this, 'value') |
101 | }, {trace:false}), | 99 | }, {trace:false}), |
102 | function (someValues) { | 100 | function (someValues) { |
103 | var result; //'NONE', 'URL', 'EMAIL', 'PASSWORD' | 101 | var result; //'NONE', 'URL', 'EMAIL', 'PASSWORD' |
104 | 102 | ||
105 | result = 'NONE'; | 103 | result = 'NONE'; |
106 | 104 | ||
107 | if (someValues['isHidden']) { | 105 | if (someValues['isHidden']) { |
108 | result = 'PASSWORD'; | 106 | result = 'PASSWORD'; |
109 | } else if (Clipperz.Base.isUrl(someValues['value'])) { | 107 | } else if (Clipperz.Base.isUrl(someValues['value'])) { |
110 | result = 'URL' | 108 | result = 'URL' |
111 | } else if (Clipperz.Base.isEmail(someValues['value'])) { | 109 | } else if (Clipperz.Base.isEmail(someValues['value'])) { |
112 | result = 'EMAIL' | 110 | result = 'EMAIL' |
113 | }; | 111 | }; |
114 | 112 | ||
115 | return result; | 113 | return result; |
116 | } | 114 | } |
117 | ], {trace:false}); | 115 | ], {trace:false}); |
118 | }, | 116 | }, |
119 | 117 | ||
120 | //------------------------------------------------------------------------- | 118 | //------------------------------------------------------------------------- |
121 | 119 | ||
122 | 'isHidden': function () { | 120 | 'isHidden': function () { |
123 | return this.getItem('hidden'); | 121 | return this.getItem('hidden'); |
124 | }, | 122 | }, |
125 | 123 | ||
126 | 'setIsHidden': function (aValue) { | 124 | 'setIsHidden': function (aValue) { |
127 | return this.setItem('hidden', aValue); | 125 | return this.setItem('hidden', aValue); |
128 | }, | 126 | }, |
129 | 127 | ||
130 | //------------------------------------------------------------------------- | 128 | //------------------------------------------------------------------------- |
131 | 129 | ||
132 | 'isEmpty': function () { | 130 | 'isEmpty': function () { |
133 | var deferredResult; | 131 | var deferredResult; |
134 | 132 | ||
135 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.Field.isEmpty", {trace:false}); | 133 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.Field.isEmpty", {trace:false}); |
136 | 134 | ||
137 | deferredResult.collectResults({ | 135 | deferredResult.collectResults({ |
138 | 'label': [ | 136 | 'label': [ |
139 | MochiKit.Base.method(this, 'label'), | 137 | MochiKit.Base.method(this, 'label'), |
140 | MochiKit.Base.partial(MochiKit.Base.operator.eq, '') | 138 | MochiKit.Base.partial(MochiKit.Base.operator.eq, '') |
141 | ], | 139 | ], |
142 | 'value': [ | 140 | 'value': [ |
143 | MochiKit.Base.method(this, 'value'), | 141 | MochiKit.Base.method(this, 'value'), |
144 | MochiKit.Base.partial(MochiKit.Base.operator.eq, '') | 142 | MochiKit.Base.partial(MochiKit.Base.operator.eq, '') |
145 | ], | 143 | ], |
146 | 'isHidden': [ | 144 | 'isHidden': [ |
147 | MochiKit.Base.method(this, 'isHidden'), | 145 | MochiKit.Base.method(this, 'isHidden'), |
148 | MochiKit.Base.partial(MochiKit.Base.operator.eq, false) | 146 | MochiKit.Base.partial(MochiKit.Base.operator.eq, false) |
149 | ] | 147 | ] |
150 | }); | 148 | }); |
151 | deferredResult.addCallback(MochiKit.Base.values); | 149 | deferredResult.addCallback(MochiKit.Base.values); |
152 | deferredResult.addCallback(function(someValues) { | 150 | deferredResult.addCallback(function(someValues) { |
153 | return MochiKit.Iter.every(someValues, MochiKit.Base.operator.identity); | 151 | return MochiKit.Iter.every(someValues, MochiKit.Base.operator.identity); |
154 | }); | 152 | }); |
155 | deferredResult.callback(); | 153 | deferredResult.callback(); |
156 | 154 | ||
157 | return deferredResult; | 155 | return deferredResult; |
158 | }, | 156 | }, |
159 | 157 | ||
160 | //------------------------------------------------------------------------- | 158 | //------------------------------------------------------------------------- |
161 | __syntaxFix__: "syntax fix" | 159 | __syntaxFix__: "syntax fix" |
162 | }); | 160 | }); |
163 | 161 | ||
164 | 162 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js index dd35fc9..87b319c 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js | |||
@@ -1,333 +1,328 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.PM.DataModel.Record) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.Record) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.Record.Version depends on Clipperz.PM.DataModel.Record!"; | 25 | throw "Clipperz.PM.DataModel.Record.Version depends on Clipperz.PM.DataModel.Record!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | Clipperz.PM.DataModel.Record.Version = function(args) { | 28 | Clipperz.PM.DataModel.Record.Version = function(args) { |
31 | //console.log(">>> Record.new"); | ||
32 | Clipperz.PM.DataModel.Record.Version.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.DataModel.Record.Version.superclass.constructor.apply(this, arguments); |
33 | 30 | ||
34 | this._getVersionFunction = args.getVersion|| Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._getVersionFunction = args.getVersion|| Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | this._fields = null; | 32 | this._fields = null; |
36 | 33 | ||
37 | return this; | 34 | return this; |
38 | } | 35 | } |
39 | 36 | ||
40 | 37 | ||
41 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version, Clipperz.PM.DataModel.EncryptedRemoteObject, { | 38 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version, Clipperz.PM.DataModel.EncryptedRemoteObject, { |
42 | 39 | ||
43 | 'toString': function() { | 40 | 'toString': function() { |
44 | return "Record.Version (" + this.reference() + ")"; | 41 | return "Record.Version (" + this.reference() + ")"; |
45 | }, | 42 | }, |
46 | 43 | ||
47 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
48 | 45 | ||
49 | 'reference': function () { | 46 | 'reference': function () { |
50 | return this._reference; | 47 | return this._reference; |
51 | }, | 48 | }, |
52 | 49 | ||
53 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
54 | /* | 51 | /* |
55 | 'hasPendingChanges': function () { | 52 | 'hasPendingChanges': function () { |
56 | var deferredResult; | 53 | var deferredResult; |
57 | 54 | ||
58 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.hasPendingChanges", {trace:false}); | 55 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.hasPendingChanges", {trace:false}); |
59 | deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.Version.superclass.hasPendingChanges, this)); | 56 | deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.Version.superclass.hasPendingChanges, this)); |
60 | deferredResult.callback(); | 57 | deferredResult.callback(); |
61 | 58 | ||
62 | return deferredResult; | 59 | return deferredResult; |
63 | }, | 60 | }, |
64 | */ | 61 | */ |
65 | //------------------------------------------------------------------------- | 62 | //------------------------------------------------------------------------- |
66 | 63 | ||
67 | 64 | ||
68 | 'hasPendingChangesWhenBrandNew': function () { | 65 | 'hasPendingChangesWhenBrandNew': function () { |
69 | var deferredResult; | 66 | var deferredResult; |
70 | 67 | ||
71 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.hasPendingChangesWhenBrandNew", {trace:false}); | 68 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.hasPendingChangesWhenBrandNew", {trace:false}); |
72 | deferredResult.addMethod(this, 'fields'); | 69 | deferredResult.addMethod(this, 'fields'); |
73 | deferredResult.addCallback(MochiKit.Base.values); | 70 | deferredResult.addCallback(MochiKit.Base.values); |
74 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.methodcaller('isEmpty')) | 71 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.methodcaller('isEmpty')) |
75 | deferredResult.addCallback(Clipperz.Async.collectAll); | 72 | deferredResult.addCallback(Clipperz.Async.collectAll); |
76 | deferredResult.addCallback(function(someValues) { | 73 | deferredResult.addCallback(function(someValues) { |
77 | return MochiKit.Iter.every(someValues, MochiKit.Base.operator.identity); | 74 | return MochiKit.Iter.every(someValues, MochiKit.Base.operator.identity); |
78 | }); | 75 | }); |
79 | deferredResult.addCallback(MochiKit.Base.operator.lognot) | 76 | deferredResult.addCallback(MochiKit.Base.operator.lognot) |
80 | deferredResult.callback(); | 77 | deferredResult.callback(); |
81 | 78 | ||
82 | return deferredResult; | 79 | return deferredResult; |
83 | }, | 80 | }, |
84 | 81 | ||
85 | //========================================================================= | 82 | //========================================================================= |
86 | 83 | ||
87 | 'commitTransientState': function () { | 84 | 'commitTransientState': function () { |
88 | var deferredResult; | 85 | var deferredResult; |
89 | 86 | ||
90 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.commitTransientState", {trace:false}); | 87 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.commitTransientState", {trace:false}); |
91 | deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.Version.superclass.commitTransientState, this)); | 88 | deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.Version.superclass.commitTransientState, this)); |
92 | deferredResult.callback(); | 89 | deferredResult.callback(); |
93 | 90 | ||
94 | return deferredResult; | 91 | return deferredResult; |
95 | }, | 92 | }, |
96 | 93 | ||
97 | //========================================================================= | 94 | //========================================================================= |
98 | 95 | ||
99 | 'unpackData': function (someData) { //++ | 96 | 'unpackData': function (someData) { //++ |
100 | varresult; | 97 | varresult; |
101 | 98 | ||
102 | //console.log("Record.Version - UNPACK DATA", this, someData); | ||
103 | result = someData; | 99 | result = someData; |
104 | if ((someData['fields'] != null) && (someData['fields'] instanceof Array)) { | 100 | if ((someData['fields'] != null) && (someData['fields'] instanceof Array)) { |
105 | varfields; | 101 | varfields; |
106 | var i,c; | 102 | var i,c; |
107 | 103 | ||
108 | fields = someData['fields']; | 104 | fields = someData['fields']; |
109 | delete someData['fields']; | 105 | delete someData['fields']; |
110 | 106 | ||
111 | someData['fields'] = {}; | 107 | someData['fields'] = {}; |
112 | c = fields.length; | 108 | c = fields.length; |
113 | for (i=0; i<c; i++) { | 109 | for (i=0; i<c; i++) { |
114 | someData['fields'][i] = fields[i]; | 110 | someData['fields'][i] = fields[i]; |
115 | } | 111 | } |
116 | } | 112 | } |
117 | 113 | ||
118 | 114 | ||
119 | 115 | ||
120 | return result; | 116 | return result; |
121 | }, | 117 | }, |
122 | 118 | ||
123 | //========================================================================= | 119 | //========================================================================= |
124 | 120 | ||
125 | 'fields': function () { | 121 | 'fields': function () { |
126 | vardeferredResult; | 122 | vardeferredResult; |
127 | var deferredLock; | 123 | var deferredLock; |
128 | 124 | ||
129 | deferredLock = this.getDeferredLockForKey('fields'); | 125 | deferredLock = this.getDeferredLockForKey('fields'); |
130 | 126 | ||
131 | deferredResult = new Clipperz.Async.Deferred("Record.Version.fields", {trace:false}); | 127 | deferredResult = new Clipperz.Async.Deferred("Record.Version.fields", {trace:false}); |
132 | deferredResult.acquireLock(deferredLock); | 128 | deferredResult.acquireLock(deferredLock); |
133 | deferredResult.addCallback(MochiKit.Base.bind(function () { | 129 | deferredResult.addCallback(MochiKit.Base.bind(function () { |
134 | var innerDeferredResult; | 130 | var innerDeferredResult; |
135 | 131 | ||
136 | if (this._fields == null) { | 132 | if (this._fields == null) { |
137 | innerDeferredResult = new Clipperz.Async.Deferred("Record.Version.fields <inner deferred>", {trace:false}); | 133 | innerDeferredResult = new Clipperz.Async.Deferred("Record.Version.fields <inner deferred>", {trace:false}); |
138 | innerDeferredResult.addMethod(this, 'getValue', 'fields'); | 134 | innerDeferredResult.addMethod(this, 'getValue', 'fields'); |
139 | innerDeferredResult.addCallback(MochiKit.Base.bind(function (someObjectData) { | 135 | innerDeferredResult.addCallback(MochiKit.Base.bind(function (someObjectData) { |
140 | var reference; | 136 | var reference; |
141 | 137 | ||
142 | this._fields = {}; | 138 | this._fields = {}; |
143 | 139 | ||
144 | for (reference in someObjectData) { | 140 | for (reference in someObjectData) { |
145 | varrecordVersionField; | 141 | varrecordVersionField; |
146 | 142 | ||
147 | recordVersionField = new Clipperz.PM.DataModel.Record.Version.Field({ | 143 | recordVersionField = new Clipperz.PM.DataModel.Record.Version.Field({ |
148 | 'recordVersion':this, | 144 | 'recordVersion':this, |
149 | 'reference': reference | 145 | 'reference': reference |
150 | }); | 146 | }); |
151 | 147 | ||
152 | this._fields[reference] = recordVersionField; | 148 | this._fields[reference] = recordVersionField; |
153 | } | 149 | } |
154 | 150 | ||
155 | return this._fields; | 151 | return this._fields; |
156 | }, this)); | 152 | }, this)); |
157 | innerDeferredResult.callback(); | 153 | innerDeferredResult.callback(); |
158 | } else { | 154 | } else { |
159 | innerDeferredResult = MochiKit.Async.succeed(this._fields); | 155 | innerDeferredResult = MochiKit.Async.succeed(this._fields); |
160 | } | 156 | } |
161 | 157 | ||
162 | return innerDeferredResult; | 158 | return innerDeferredResult; |
163 | }, this)); | 159 | }, this)); |
164 | deferredResult.releaseLock(deferredLock); | 160 | deferredResult.releaseLock(deferredLock); |
165 | deferredResult.callback(); | 161 | deferredResult.callback(); |
166 | 162 | ||
167 | return deferredResult; | 163 | return deferredResult; |
168 | }, | 164 | }, |
169 | 165 | ||
170 | //------------------------------------------------------------------------- | 166 | //------------------------------------------------------------------------- |
171 | 167 | ||
172 | 'getFieldsValues': function () { | 168 | 'getFieldsValues': function () { |
173 | return this.getValue('fields'); | 169 | return this.getValue('fields'); |
174 | }, | 170 | }, |
175 | 171 | ||
176 | //------------------------------------------------------------------------- | 172 | //------------------------------------------------------------------------- |
177 | 173 | ||
178 | 'addField': function (someParameters) { | 174 | 'addField': function (someParameters) { |
179 | varnewField; | 175 | varnewField; |
180 | 176 | ||
181 | newField = new Clipperz.PM.DataModel.Record.Version.Field({recordVersion:this}); | 177 | newField = new Clipperz.PM.DataModel.Record.Version.Field({recordVersion:this}); |
182 | 178 | ||
183 | return Clipperz.Async.callbacks("Record.Version.addField", [ | 179 | return Clipperz.Async.callbacks("Record.Version.addField", [ |
184 | MochiKit.Base.method(this, 'fields'), | 180 | MochiKit.Base.method(this, 'fields'), |
185 | 181 | ||
186 | MochiKit.Base.method(this, '_getObjectDataStore'), | 182 | MochiKit.Base.method(this, '_getObjectDataStore'), |
187 | MochiKit.Base.methodcaller('values'), | 183 | MochiKit.Base.methodcaller('values'), |
188 | Clipperz.Base.serializeJSON, | 184 | Clipperz.Base.serializeJSON, |
189 | 185 | ||
190 | MochiKit.Base.bind(function () { this._fields[newField.reference()] = newField; }, this), | 186 | MochiKit.Base.bind(function () { this._fields[newField.reference()] = newField; }, this), |
191 | MochiKit.Base.method(newField, 'setLabel', someParameters['label']), | 187 | MochiKit.Base.method(newField, 'setLabel', someParameters['label']), |
192 | MochiKit.Base.method(newField, 'setValue', someParameters['value']), | 188 | MochiKit.Base.method(newField, 'setValue', someParameters['value']), |
193 | MochiKit.Base.method(newField, 'setIsHidden',someParameters['isHidden']), | 189 | MochiKit.Base.method(newField, 'setIsHidden',someParameters['isHidden']), |
194 | 190 | ||
195 | MochiKit.Base.method(this, '_getObjectDataStore'), | 191 | MochiKit.Base.method(this, '_getObjectDataStore'), |
196 | MochiKit.Base.methodcaller('values'), | 192 | MochiKit.Base.methodcaller('values'), |
197 | Clipperz.Base.serializeJSON, | 193 | Clipperz.Base.serializeJSON, |
198 | 194 | ||
199 | MochiKit.Base.partial(MochiKit.Async.succeed, newField) | 195 | MochiKit.Base.partial(MochiKit.Async.succeed, newField) |
200 | ], {trace:false}); | 196 | ], {trace:false}); |
201 | }, | 197 | }, |
202 | 198 | ||
203 | //------------------------------------------------------------------------- | 199 | //------------------------------------------------------------------------- |
204 | 200 | ||
205 | 'removeField': function (aField) { | 201 | 'removeField': function (aField) { |
206 | return Clipperz.Async.callbacks("Record.Version.removeField", [ | 202 | return Clipperz.Async.callbacks("Record.Version.removeField", [ |
207 | MochiKit.Base.method(this, 'fields'), | 203 | MochiKit.Base.method(this, 'fields'), |
208 | MochiKit.Base.bind(function () { delete this._fields[aField.reference()]; }, this), | 204 | MochiKit.Base.bind(function () { delete this._fields[aField.reference()]; }, this), |
209 | MochiKit.Base.method(this, 'removeValue', 'fields' + '.' + aField.reference()) | 205 | MochiKit.Base.method(this, 'removeValue', 'fields' + '.' + aField.reference()) |
210 | ], {trace:false}); | 206 | ], {trace:false}); |
211 | }, | 207 | }, |
212 | 208 | ||
213 | //------------------------------------------------------------------------- | 209 | //------------------------------------------------------------------------- |
214 | /* | 210 | /* |
215 | 'sortFieldReference': function (someSortedFieldReferences) { | 211 | 'sortFieldReference': function (someSortedFieldReferences) { |
216 | 212 | ||
217 | 213 | ||
218 | 214 | ||
219 | }, | 215 | }, |
220 | */ | 216 | */ |
221 | //========================================================================= | 217 | //========================================================================= |
222 | /* | 218 | /* |
223 | 'directLogins': function () { | 219 | 'directLogins': function () { |
224 | return MochiKit.Base.values(this._directLogins); | 220 | return MochiKit.Base.values(this._directLogins); |
225 | }, | 221 | }, |
226 | 222 | ||
227 | 'addDirectLogin': function (aDirectLogin) { | 223 | 'addDirectLogin': function (aDirectLogin) { |
228 | this._directLogins[aDirectLogin.reference()] = aDirectLogin; | 224 | this._directLogins[aDirectLogin.reference()] = aDirectLogin; |
229 | }, | 225 | }, |
230 | */ | 226 | */ |
231 | 227 | ||
232 | //========================================================================= | 228 | //========================================================================= |
233 | /* | 229 | /* |
234 | 'updateValues': function (anotherVersion) { | 230 | 'updateValues': function (anotherVersion) { |
235 | return Clipperz.Async.callbacks("Record.Version.updateValue", [ | 231 | return Clipperz.Async.callbacks("Record.Version.updateValue", [ |
236 | MochiKit.Base.partial(MochiKit.Async.succeed, this) | 232 | MochiKit.Base.partial(MochiKit.Async.succeed, this) |
237 | ], {trace:false}); | 233 | ], {trace:false}); |
238 | }, | 234 | }, |
239 | */ | 235 | */ |
240 | //========================================================================= | 236 | //========================================================================= |
241 | 237 | ||
242 | 'setRemoteData': function (aValue) { | 238 | 'setRemoteData': function (aValue) { |
243 | this._remoteData = aValue; | 239 | this._remoteData = aValue; |
244 | 240 | ||
245 | return aValue; | 241 | return aValue; |
246 | }, | 242 | }, |
247 | 243 | ||
248 | //========================================================================= | 244 | //========================================================================= |
249 | 245 | ||
250 | 'getVersionFunction': function () { | 246 | 'getVersionFunction': function () { |
251 | return this._getVersionFunction; | 247 | return this._getVersionFunction; |
252 | }, | 248 | }, |
253 | 249 | ||
254 | 'previousVersion': function () { | 250 | 'previousVersion': function () { |
255 | return Clipperz.Async.callbacks("Record.Versions.previousVersion", [ | 251 | return Clipperz.Async.callbacks("Record.Versions.previousVersion", [ |
256 | MochiKit.Base.method(this, 'previousVersionReference'), | 252 | MochiKit.Base.method(this, 'previousVersionReference'), |
257 | this.getVersionFunction() | 253 | this.getVersionFunction() |
258 | ], {trace:false}); | 254 | ], {trace:false}); |
259 | }, | 255 | }, |
260 | 256 | ||
261 | 'previousVersionReference': function () { | 257 | 'previousVersionReference': function () { |
262 | return this.getValue('previousVersionReference'); | 258 | return this.getValue('previousVersionReference'); |
263 | }, | 259 | }, |
264 | 260 | ||
265 | 'previousVersionKey': function () { | 261 | 'previousVersionKey': function () { |
266 | //TODO: this value i encrypted on its own. So it can not be saved in the main objectStore!!! | 262 | //TODO: this value i encrypted on its own. So it can not be saved in the main objectStore!!! |
267 | return this.getValue('previousVersionKey'); | 263 | return this.getValue('previousVersionKey'); |
268 | }, | 264 | }, |
269 | 265 | ||
270 | //------------------------------------------------------------------------- | 266 | //------------------------------------------------------------------------- |
271 | 267 | ||
272 | 'setPreviousVersionReferenceAndKey': function (aVersionObjectAndKey) { | 268 | 'setPreviousVersionReferenceAndKey': function (aVersionObjectAndKey) { |
273 | // this._previousVersion = anotherVersion; | 269 | // this._previousVersion = anotherVersion; |
274 | return Clipperz.Async.callbacks("Record.Version.setPreviousVersion", [ | 270 | return Clipperz.Async.callbacks("Record.Version.setPreviousVersion", [ |
275 | MochiKit.Base.method(this, 'setValue', 'previousVersionReference',aVersionObjectAndKey['reference']), | 271 | MochiKit.Base.method(this, 'setValue', 'previousVersionReference',aVersionObjectAndKey['reference']), |
276 | MochiKit.Base.method(this, 'setValue', 'previousVersionKey', aVersionObjectAndKey['key']) | 272 | MochiKit.Base.method(this, 'setValue', 'previousVersionKey', aVersionObjectAndKey['key']) |
277 | ], {trace:false}); | 273 | ], {trace:false}); |
278 | }, | 274 | }, |
279 | 275 | ||
280 | //========================================================================= | 276 | //========================================================================= |
281 | 277 | ||
282 | 'revertChanges': function () { | 278 | 'revertChanges': function () { |
283 | this.setReference(this.transientState()['originalReference']); | 279 | this.setReference(this.transientState()['originalReference']); |
284 | Clipperz.PM.DataModel.Record.Version.superclass.revertChanges.apply(this, arguments); | 280 | Clipperz.PM.DataModel.Record.Version.superclass.revertChanges.apply(this, arguments); |
285 | }, | 281 | }, |
286 | 282 | ||
287 | //------------------------------------------------------------------------- | 283 | //------------------------------------------------------------------------- |
288 | 284 | ||
289 | 'prepareRemoteDataWithKey': function (aKey) { | 285 | 'prepareRemoteDataWithKey': function (aKey) { |
290 | var deferredResult; | 286 | var deferredResult; |
291 | var result; | 287 | var result; |
292 | 288 | ||
293 | result = {}; | 289 | result = {}; |
294 | 290 | ||
295 | //console.log("prepareRemoteDataWithKey", aKey); | ||
296 | deferredResult = new Clipperz.Async.Deferred("Record.Version.prepareRemoteDataWithKey", {trace:false}); | 291 | deferredResult = new Clipperz.Async.Deferred("Record.Version.prepareRemoteDataWithKey", {trace:false}); |
297 | if (this.isBrandNew() == false) { | 292 | if (this.isBrandNew() == false) { |
298 | this.transientState()['originalReference'] = this.reference(); | 293 | this.transientState()['originalReference'] = this.reference(); |
299 | 294 | ||
300 | deferredResult.collectResults({ | 295 | deferredResult.collectResults({ |
301 | 'key':MochiKit.Base.partial(MochiKit.Async.succeed, aKey), | 296 | 'key':MochiKit.Base.partial(MochiKit.Async.succeed, aKey), |
302 | 'value': MochiKit.Base.method(this, 'getKey'), | 297 | 'value': MochiKit.Base.method(this, 'getKey'), |
303 | 'version': MochiKit.Base.partial(MochiKit.Async.succeed, Clipperz.PM.Crypto.encryptingFunctions.currentVersion) | 298 | 'version': MochiKit.Base.partial(MochiKit.Async.succeed, Clipperz.PM.Crypto.encryptingFunctions.currentVersion) |
304 | }); | 299 | }); |
305 | deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncrypt); | 300 | deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncrypt); |
306 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'previousVersionKey'); | 301 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'previousVersionKey'); |
307 | } else { | 302 | } else { |
308 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'previousVersionKey', Clipperz.PM.Crypto.nullValue); | 303 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'previousVersionKey', Clipperz.PM.Crypto.nullValue); |
309 | } | 304 | } |
310 | deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.prepareRemoteDataWithKey, this, aKey)); | 305 | deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.prepareRemoteDataWithKey, this, aKey)); |
311 | deferredResult.addCallback(MochiKit.Base.update, result); | 306 | deferredResult.addCallback(MochiKit.Base.update, result); |
312 | deferredResult.addMethod(this, 'setRemoteData'); | 307 | deferredResult.addMethod(this, 'setRemoteData'); |
313 | 308 | ||
314 | deferredResult.callback(); | 309 | deferredResult.callback(); |
315 | 310 | ||
316 | return deferredResult; | 311 | return deferredResult; |
317 | }, | 312 | }, |
318 | 313 | ||
319 | //========================================================================= | 314 | //========================================================================= |
320 | /* | 315 | /* |
321 | 'deleteAllCleanTextData': function () { | 316 | 'deleteAllCleanTextData': function () { |
322 | return Clipperz.PM.DataModel.Record.Version.superclass.deleteAllCleanTextData.apply(this, arguments); | 317 | return Clipperz.PM.DataModel.Record.Version.superclass.deleteAllCleanTextData.apply(this, arguments); |
323 | }, | 318 | }, |
324 | 319 | ||
325 | 'hasAnyCleanTextData': function () { | 320 | 'hasAnyCleanTextData': function () { |
326 | return Clipperz.PM.DataModel.Record.Version.superclass.hasAnyCleanTextData.apply(this, arguments); | 321 | return Clipperz.PM.DataModel.Record.Version.superclass.hasAnyCleanTextData.apply(this, arguments); |
327 | }, | 322 | }, |
328 | */ | 323 | */ |
329 | //========================================================================= | 324 | //========================================================================= |
330 | __syntaxFix__: "syntax fix" | 325 | __syntaxFix__: "syntax fix" |
331 | }); | 326 | }); |
332 | 327 | ||
333 | 328 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/Record.js b/frontend/gamma/js/Clipperz/PM/DataModel/Record.js index b816f80..3fc1813 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/Record.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/Record.js | |||
@@ -1,878 +1,854 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | 28 | ||
31 | Clipperz.PM.DataModel.Record = function(args) { | 29 | Clipperz.PM.DataModel.Record = function(args) { |
32 | //console.log(">>> new Clipperz.PM.DataModel.Record", args); | ||
33 | Clipperz.PM.DataModel.Record.superclass.constructor.apply(this, arguments); | 30 | Clipperz.PM.DataModel.Record.superclass.constructor.apply(this, arguments); |
34 | 31 | ||
35 | this._updateDate = (args.updateDate ? Clipperz.PM.Date.parse(args.updateDate) : Clipperz.Base.exception.raise('MandatoryParameter')); | 32 | this._updateDate = (args.updateDate ? Clipperz.PM.Date.parse(args.updateDate) : Clipperz.Base.exception.raise('MandatoryParameter')); |
36 | 33 | ||
37 | this._retrieveIndexDataFunction = args.retrieveIndexDataFunction|| Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | this._retrieveIndexDataFunction = args.retrieveIndexDataFunction|| Clipperz.Base.exception.raise('MandatoryParameter'); |
38 | this._updateIndexDataFunction = args.updateIndexDataFunction || Clipperz.Base.exception.raise('MandatoryParameter'); | 35 | this._updateIndexDataFunction = args.updateIndexDataFunction || Clipperz.Base.exception.raise('MandatoryParameter'); |
39 | 36 | ||
40 | this._retrieveDirectLoginIndexDataFunction = args.retrieveDirectLoginIndexDataFunction|| null; | 37 | this._retrieveDirectLoginIndexDataFunction = args.retrieveDirectLoginIndexDataFunction|| null; |
41 | this._setDirectLoginIndexDataFunction = args.setDirectLoginIndexDataFunction || null; | 38 | this._setDirectLoginIndexDataFunction = args.setDirectLoginIndexDataFunction || null; |
42 | this._removeDirectLoginIndexDataFunction = args.removeDirectLoginIndexDataFunction|| null; | 39 | this._removeDirectLoginIndexDataFunction = args.removeDirectLoginIndexDataFunction|| null; |
43 | 40 | ||
44 | this._createNewDirectLoginFunction = args.createNewDirectLoginFunction || null; | 41 | this._createNewDirectLoginFunction = args.createNewDirectLoginFunction || null; |
45 | 42 | ||
46 | this._directLogins = {}; | 43 | this._directLogins = {}; |
47 | 44 | ||
48 | this._versions = {}; | 45 | this._versions = {}; |
49 | 46 | ||
50 | this._currentRecordVersion = null; | 47 | this._currentRecordVersion = null; |
51 | if (this.isBrandNew()) { | 48 | if (this.isBrandNew()) { |
52 | var newVersion; | 49 | var newVersion; |
53 | 50 | ||
54 | this.setNotes(''); | 51 | this.setNotes(''); |
55 | newVersion = new Clipperz.PM.DataModel.Record.Version({ | 52 | newVersion = new Clipperz.PM.DataModel.Record.Version({ |
56 | 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'), | 53 | 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'), |
57 | 'getVersion': MochiKit.Base.method(this, 'getVersion') | 54 | 'getVersion': MochiKit.Base.method(this, 'getVersion') |
58 | 55 | ||
59 | }); | 56 | }); |
60 | this._versions[newVersion.reference()] = newVersion; | 57 | this._versions[newVersion.reference()] = newVersion; |
61 | this._currentVersionReference = newVersion.reference(); | 58 | this._currentVersionReference = newVersion.reference(); |
62 | // this.setLabel(''); | 59 | // this.setLabel(''); |
63 | } | 60 | } |
64 | 61 | ||
65 | //console.log("<<< new Clipperz.PM.DataModel.Record", args); | ||
66 | |||
67 | return this; | 62 | return this; |
68 | } | 63 | } |
69 | 64 | ||
70 | 65 | ||
71 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.EncryptedRemoteObject, { | 66 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.EncryptedRemoteObject, { |
72 | 67 | ||
73 | 'toString': function() { | 68 | 'toString': function() { |
74 | return "Record (" + this.reference() + ")"; | 69 | return "Record (" + this.reference() + ")"; |
75 | }, | 70 | }, |
76 | 71 | ||
77 | //------------------------------------------------------------------------- | 72 | //------------------------------------------------------------------------- |
78 | 73 | ||
79 | 'reference': function () { | 74 | 'reference': function () { |
80 | return this._reference; | 75 | return this._reference; |
81 | }, | 76 | }, |
82 | 77 | ||
83 | //========================================================================= | 78 | //========================================================================= |
84 | 79 | ||
85 | 'getIndexData': function () { | 80 | 'getIndexData': function () { |
86 | return this._retrieveIndexDataFunction(this.reference()); | 81 | return this._retrieveIndexDataFunction(this.reference()); |
87 | }, | 82 | }, |
88 | 83 | ||
89 | //......................................................................... | 84 | //......................................................................... |
90 | 85 | ||
91 | 'getIndexDataForKey': function (aKey) { | 86 | 'getIndexDataForKey': function (aKey) { |
92 | return Clipperz.Async.callbacks("Record.getIndexDataForKey", [ | 87 | return Clipperz.Async.callbacks("Record.getIndexDataForKey", [ |
93 | MochiKit.Base.method(this, 'getIndexData'), | 88 | MochiKit.Base.method(this, 'getIndexData'), |
94 | MochiKit.Base.itemgetter(aKey) | 89 | MochiKit.Base.itemgetter(aKey) |
95 | ], {trace:false}); | 90 | ], {trace:false}); |
96 | }, | 91 | }, |
97 | 92 | ||
98 | //------------------------------------------------------------------------- | 93 | //------------------------------------------------------------------------- |
99 | 94 | ||
100 | 'setIndexDataForKey': function (aKey, aValue) { | 95 | 'setIndexDataForKey': function (aKey, aValue) { |
101 | // return this._updateIndexDataFunction(this.reference(), aKey, aValue); | 96 | // return this._updateIndexDataFunction(this.reference(), aKey, aValue); |
102 | 97 | ||
103 | var deferredResult; | 98 | var deferredResult; |
104 | 99 | ||
105 | deferredResult = new Clipperz.Async.Deferred("Record.setIndexDataForKey", {trace:false}); | 100 | deferredResult = new Clipperz.Async.Deferred("Record.setIndexDataForKey", {trace:false}); |
106 | deferredResult.addMethod(this, 'getIndexDataForKey', aKey); | 101 | deferredResult.addMethod(this, 'getIndexDataForKey', aKey); |
107 | deferredResult.addCallback(MochiKit.Base.bind(function (aCurrentValue) { | 102 | deferredResult.addCallback(MochiKit.Base.bind(function (aCurrentValue) { |
108 | var result; | 103 | var result; |
109 | var originalValue; | 104 | var originalValue; |
110 | 105 | ||
111 | originalValue = this.transientState().getValue('originalValues.indexData.' + aKey); | 106 | originalValue = this.transientState().getValue('originalValues.indexData.' + aKey); |
112 | if (originalValue == null) { | 107 | if (originalValue == null) { |
113 | originalValue = this.transientState().setValue('originalValues.indexData.' + aKey, aCurrentValue); | 108 | originalValue = this.transientState().setValue('originalValues.indexData.' + aKey, aCurrentValue); |
114 | } | 109 | } |
115 | 110 | ||
116 | if (aCurrentValue != aValue) { | 111 | if (aCurrentValue != aValue) { |
117 | if (originalValue != aValue) { | 112 | if (originalValue != aValue) { |
118 | this.transientState().setValue('hasPendingChanges.indexData.' + aKey, true); | 113 | this.transientState().setValue('hasPendingChanges.indexData.' + aKey, true); |
119 | } else { | 114 | } else { |
120 | this.transientState().setValue('hasPendingChanges.indexData.' + aKey, false); | 115 | this.transientState().setValue('hasPendingChanges.indexData.' + aKey, false); |
121 | } | 116 | } |
122 | 117 | ||
123 | result = this._updateIndexDataFunction(this.reference(), aKey, aValue); | 118 | result = this._updateIndexDataFunction(this.reference(), aKey, aValue); |
124 | } else { | 119 | } else { |
125 | result = MochiKit.Async.succeed(aValue); | 120 | result = MochiKit.Async.succeed(aValue); |
126 | } | 121 | } |
127 | 122 | ||
128 | return result; | 123 | return result; |
129 | }, this)); | 124 | }, this)); |
130 | 125 | ||
131 | deferredResult.callback(); | 126 | deferredResult.callback(); |
132 | 127 | ||
133 | return deferredResult; | 128 | return deferredResult; |
134 | }, | 129 | }, |
135 | 130 | ||
136 | //========================================================================= | 131 | //========================================================================= |
137 | /* | 132 | /* |
138 | 'key': function () { | 133 | 'key': function () { |
139 | return this.getIndexDataForKey('key'); | 134 | return this.getIndexDataForKey('key'); |
140 | }, | 135 | }, |
141 | */ | 136 | */ |
142 | //========================================================================= | 137 | //========================================================================= |
143 | 138 | ||
144 | 'label': function () { | 139 | 'label': function () { |
145 | return this.getIndexDataForKey('label'); | 140 | return this.getIndexDataForKey('label'); |
146 | }, | 141 | }, |
147 | 142 | ||
148 | //......................................................................... | 143 | //......................................................................... |
149 | 144 | ||
150 | 'setLabel': function (aValue) { | 145 | 'setLabel': function (aValue) { |
151 | return this.setIndexDataForKey('label', aValue); | 146 | return this.setIndexDataForKey('label', aValue); |
152 | }, | 147 | }, |
153 | 148 | ||
154 | //========================================================================= | 149 | //========================================================================= |
155 | 150 | ||
156 | 'headerNotes': function () { | 151 | 'headerNotes': function () { |
157 | return this.getIndexDataForKey('notes'); | 152 | return this.getIndexDataForKey('notes'); |
158 | }, | 153 | }, |
159 | 154 | ||
160 | //------------------------------------------------------------------------- | 155 | //------------------------------------------------------------------------- |
161 | 156 | ||
162 | 'notes': function () { | 157 | 'notes': function () { |
163 | return Clipperz.Async.callbacks("Record.notes", [ | 158 | return Clipperz.Async.callbacks("Record.notes", [ |
164 | MochiKit.Base.method(this, 'headerNotes'), | 159 | MochiKit.Base.method(this, 'headerNotes'), |
165 | MochiKit.Base.bind(function (someHeaderNotes) { | 160 | MochiKit.Base.bind(function (someHeaderNotes) { |
166 | var result; | 161 | var result; |
167 | 162 | ||
168 | if ((someHeaderNotes == null) || (typeof(someHeaderNotes) == 'undefined')) { | 163 | if ((someHeaderNotes == null) || (typeof(someHeaderNotes) == 'undefined')) { |
169 | result = this.getValue('notes'); | 164 | result = this.getValue('notes'); |
170 | } else { | 165 | } else { |
171 | result = MochiKit.Async.succeed(someHeaderNotes); | 166 | result = MochiKit.Async.succeed(someHeaderNotes); |
172 | } | 167 | } |
173 | 168 | ||
174 | return result; | 169 | return result; |
175 | }, this) | 170 | }, this) |
176 | ], {trace:false}); | 171 | ], {trace:false}); |
177 | }, | 172 | }, |
178 | 173 | ||
179 | //......................................................................... | 174 | //......................................................................... |
180 | 175 | ||
181 | 'setNotes': function (aValue) { | 176 | 'setNotes': function (aValue) { |
182 | return this.setValue('notes', aValue); | 177 | return this.setValue('notes', aValue); |
183 | }, | 178 | }, |
184 | 179 | ||
185 | //========================================================================= | 180 | //========================================================================= |
186 | 181 | ||
187 | 'updateDate': function () { | 182 | 'updateDate': function () { |
188 | return MochiKit.Async.succeed(this._updateDate); | 183 | return MochiKit.Async.succeed(this._updateDate); |
189 | }, | 184 | }, |
190 | 185 | ||
191 | //========================================================================= | 186 | //========================================================================= |
192 | 187 | ||
193 | 'favicon': function () { | 188 | 'favicon': function () { |
194 | var result; | 189 | var result; |
195 | var directLogins; | 190 | var directLogins; |
196 | 191 | ||
197 | directLogins = MochiKit.Base.values(this.directLogins()); | 192 | directLogins = MochiKit.Base.values(this.directLogins()); |
198 | if (directLogins.length > 0) { | 193 | if (directLogins.length > 0) { |
199 | result = directLogins[0].favicon(); | 194 | result = directLogins[0].favicon(); |
200 | // } else if (/* is there an URL to use for searching a favicon */){ | 195 | // } else if (/* is there an URL to use for searching a favicon */){ |
201 | } else { | 196 | } else { |
202 | result = null; //MochiKit.Async.succeed(Clipperz.PM.Strings['defaultFaviconUrl']); | 197 | result = null; //MochiKit.Async.succeed(Clipperz.PM.Strings['defaultFaviconUrl']); |
203 | } | 198 | } |
204 | 199 | ||
205 | return result; | 200 | return result; |
206 | }, | 201 | }, |
207 | 202 | ||
208 | //------------------------------------------------------------------------- | 203 | //------------------------------------------------------------------------- |
209 | 204 | ||
210 | 'searchableContent': function () { | 205 | 'searchableContent': function () { |
211 | var deferredResult; | 206 | var deferredResult; |
212 | 207 | ||
213 | //console.log(">>> searchableContent"); | ||
214 | deferredResult = new Clipperz.Async.Deferred("Record.searchableContent", {trace:false}); | 208 | deferredResult = new Clipperz.Async.Deferred("Record.searchableContent", {trace:false}); |
215 | 209 | ||
216 | deferredResult.collectResults({ | 210 | deferredResult.collectResults({ |
217 | 'recordLabel': MochiKit.Base.method(this, 'label'), | 211 | 'recordLabel': MochiKit.Base.method(this, 'label'), |
218 | 'directLoginLabels': [ | 212 | 'directLoginLabels': [ |
219 | MochiKit.Base.method(this, 'directLoginReferences'), | 213 | MochiKit.Base.method(this, 'directLoginReferences'), |
220 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.itemgetter('label')) | 214 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.itemgetter('label')) |
221 | ] | 215 | ] |
222 | }) | 216 | }) |
223 | deferredResult.addCallback(function (someValues) { | 217 | deferredResult.addCallback(function (someValues) { |
224 | return someValues['recordLabel'] + ' ' + someValues['directLoginLabels'].join(' '); | 218 | return someValues['recordLabel'] + ' ' + someValues['directLoginLabels'].join(' '); |
225 | }); | 219 | }); |
226 | deferredResult.callback(); | 220 | deferredResult.callback(); |
227 | //console.log("<<< searchableContent"); | ||
228 | 221 | ||
229 | return deferredResult; | 222 | return deferredResult; |
230 | }, | 223 | }, |
231 | 224 | ||
232 | //------------------------------------------------------------------------- | 225 | //------------------------------------------------------------------------- |
233 | 226 | ||
234 | 'isMatching': function (aRegExp) { | 227 | 'isMatching': function (aRegExp) { |
235 | return Clipperz.Async.callbacks("deferredFilterFunction", [ | 228 | return Clipperz.Async.callbacks("deferredFilterFunction", [ |
236 | MochiKit.Base.method(this, 'searchableContent'), | 229 | MochiKit.Base.method(this, 'searchableContent'), |
237 | MochiKit.Base.method(aRegExp, 'test'), | 230 | MochiKit.Base.method(aRegExp, 'test'), |
238 | function (doesItMatch) { | 231 | function (doesItMatch) { |
239 | var result; | 232 | var result; |
240 | 233 | ||
241 | if (doesItMatch) { | 234 | if (doesItMatch) { |
242 | result = MochiKit.Async.succeed('match'); | 235 | result = MochiKit.Async.succeed('match'); |
243 | } else { | 236 | } else { |
244 | result = MochiKit.Async.fail('miss'); | 237 | result = MochiKit.Async.fail('miss'); |
245 | } | 238 | } |
246 | 239 | ||
247 | return result; | 240 | return result; |
248 | } | 241 | } |
249 | ], {trace:false}); | 242 | ], {trace:false}); |
250 | }, | 243 | }, |
251 | 244 | ||
252 | //========================================================================= | 245 | //========================================================================= |
253 | 246 | ||
254 | 'directLogins': function () { | 247 | 'directLogins': function () { |
255 | return this._directLogins; | 248 | return this._directLogins; |
256 | }, | 249 | }, |
257 | 250 | ||
258 | 'addDirectLogin': function (aDirectLogin) { | 251 | 'addDirectLogin': function (aDirectLogin) { |
259 | this._directLogins[aDirectLogin.reference()] = aDirectLogin; | 252 | this._directLogins[aDirectLogin.reference()] = aDirectLogin; |
260 | }, | 253 | }, |
261 | 254 | ||
262 | 'directLoginWithReference': function (aDirectLoginReference) { | 255 | 'directLoginWithReference': function (aDirectLoginReference) { |
263 | return this._directLogins[aDirectLoginReference]; | 256 | return this._directLogins[aDirectLoginReference]; |
264 | }, | 257 | }, |
265 | 258 | ||
266 | 'createNewDirectLoginFunction': function () { | 259 | 'createNewDirectLoginFunction': function () { |
267 | return this._createNewDirectLoginFunction; | 260 | return this._createNewDirectLoginFunction; |
268 | }, | 261 | }, |
269 | 262 | ||
270 | 'saveOriginalDirectLoginStatusToTransientState': function () { | 263 | 'saveOriginalDirectLoginStatusToTransientState': function () { |
271 | if (this.transientState().getValue('directLogins') == null) { | 264 | if (this.transientState().getValue('directLogins') == null) { |
272 | // this.transientState().setValue('directLogins', this._directLogins) | 265 | // this.transientState().setValue('directLogins', this._directLogins) |
273 | //console.log("SET TRANSIENT STATE", Clipperz.Base.serializeJSON(MochiKit.Base.keys(this.transientState().getValue('directLogins')))) | ||
274 | MochiKit.Iter.forEach(MochiKit.Base.keys(this._directLogins), MochiKit.Base.bind(function(aKey) { | 266 | MochiKit.Iter.forEach(MochiKit.Base.keys(this._directLogins), MochiKit.Base.bind(function(aKey) { |
275 | this.transientState().setValue('directLogins' + '.' + aKey, this._directLogins[aKey]) | 267 | this.transientState().setValue('directLogins' + '.' + aKey, this._directLogins[aKey]) |
276 | }, this)) | 268 | }, this)) |
277 | } | 269 | } |
278 | }, | 270 | }, |
279 | 271 | ||
280 | 'createNewDirectLogin': function () { | 272 | 'createNewDirectLogin': function () { |
281 | this.saveOriginalDirectLoginStatusToTransientState(); | 273 | this.saveOriginalDirectLoginStatusToTransientState(); |
282 | 274 | ||
283 | return this.createNewDirectLoginFunction()(this); | 275 | return this.createNewDirectLoginFunction()(this); |
284 | }, | 276 | }, |
285 | 277 | ||
286 | 'removeDirectLogin': function(aDirectLogin) { | 278 | 'removeDirectLogin': function(aDirectLogin) { |
287 | this.saveOriginalDirectLoginStatusToTransientState(); | 279 | this.saveOriginalDirectLoginStatusToTransientState(); |
288 | 280 | ||
289 | return Clipperz.Async.callbacks("Record.removeDirectLogin", [ | 281 | return Clipperz.Async.callbacks("Record.removeDirectLogin", [ |
290 | MochiKit.Base.method(this, 'removeValue', 'directLogins' + '.' + aDirectLogin.reference()), | 282 | MochiKit.Base.method(this, 'removeValue', 'directLogins' + '.' + aDirectLogin.reference()), |
291 | MochiKit.Base.bind(function () { | 283 | MochiKit.Base.bind(function () { |
292 | delete this._directLogins[aDirectLogin.reference()] | 284 | delete this._directLogins[aDirectLogin.reference()] |
293 | }, this) | 285 | }, this) |
294 | ], {trace:false}); | 286 | ], {trace:false}); |
295 | 287 | ||
296 | }, | 288 | }, |
297 | 289 | ||
298 | 'directLoginReferences': function () { | 290 | 'directLoginReferences': function () { |
299 | var result; | 291 | var result; |
300 | 292 | ||
301 | result = Clipperz.Async.callbacks("Record.directLoginReferences", [ | 293 | result = Clipperz.Async.callbacks("Record.directLoginReferences", [ |
302 | MochiKit.Base.method(this, 'directLogins'), | 294 | MochiKit.Base.method(this, 'directLogins'), |
303 | MochiKit.Base.values, | 295 | MochiKit.Base.values, |
304 | function (someDirectLogins) { | 296 | function (someDirectLogins) { |
305 | var result; | 297 | var result; |
306 | var i,c; | 298 | var i,c; |
307 | 299 | ||
308 | result = []; | 300 | result = []; |
309 | c = someDirectLogins.length; | 301 | c = someDirectLogins.length; |
310 | for (i=0; i<c; i++) { | 302 | for (i=0; i<c; i++) { |
311 | result.push(Clipperz.Async.collectResults("Record.directLoginReferences - collectResults", { | 303 | result.push(Clipperz.Async.collectResults("Record.directLoginReferences - collectResults", { |
312 | '_rowObject': MochiKit.Async.succeed, | 304 | '_rowObject': MochiKit.Async.succeed, |
313 | '_reference': MochiKit.Base.methodcaller('reference'), | 305 | '_reference': MochiKit.Base.methodcaller('reference'), |
314 | 'label': MochiKit.Base.methodcaller('label'), | 306 | 'label': MochiKit.Base.methodcaller('label'), |
315 | 'favicon': MochiKit.Base.methodcaller('favicon') | 307 | 'favicon': MochiKit.Base.methodcaller('favicon') |
316 | }, {trace:false})(someDirectLogins[i])); | 308 | }, {trace:false})(someDirectLogins[i])); |
317 | }; | 309 | }; |
318 | 310 | ||
319 | return result; | 311 | return result; |
320 | }, | 312 | }, |
321 | Clipperz.Async.collectAll | 313 | Clipperz.Async.collectAll |
322 | ], {trace:false}); | 314 | ], {trace:false}); |
323 | 315 | ||
324 | return result; | 316 | return result; |
325 | }, | 317 | }, |
326 | 318 | ||
327 | //========================================================================= | 319 | //========================================================================= |
328 | 320 | ||
329 | 'unpackRemoteData': function (someData) { | 321 | 'unpackRemoteData': function (someData) { |
330 | var result; | 322 | var result; |
331 | 323 | ||
332 | //console.log("new Clipperz.PM.DataModel.Record.Version [2]"); | ||
333 | /* | 324 | /* |
334 | this._currentRecordVersion = new Clipperz.PM.DataModel.Record.Version({ | 325 | this._currentRecordVersion = new Clipperz.PM.DataModel.Record.Version({ |
335 | 'reference': someData['currentVersion']['reference'], | 326 | 'reference': someData['currentVersion']['reference'], |
336 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getCurrentRecordVersionKey'), | 327 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getCurrentRecordVersionKey'), |
337 | 'remoteData': someData['currentVersion'], | 328 | 'remoteData': someData['currentVersion'], |
338 | }); | 329 | }); |
339 | */ | 330 | */ |
340 | var versionKey; | 331 | var versionKey; |
341 | 332 | ||
342 | for (versionKey in someData['versions']) { | 333 | for (versionKey in someData['versions']) { |
343 | //console.log("### versionKey", versionKey); | ||
344 | this._versions[versionKey] = new Clipperz.PM.DataModel.Record.Version({ | 334 | this._versions[versionKey] = new Clipperz.PM.DataModel.Record.Version({ |
345 | 'reference': versionKey, | 335 | 'reference': versionKey, |
346 | 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'), | 336 | 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'), |
347 | 'remoteData': someData['versions'][versionKey], | 337 | 'remoteData': someData['versions'][versionKey], |
348 | 'getVersion': MochiKit.Base.method(this, 'getVersion') | 338 | 'getVersion': MochiKit.Base.method(this, 'getVersion') |
349 | }) | 339 | }) |
350 | } | 340 | } |
351 | 341 | ||
352 | // this._currentVersionReference = someData['currentVersion']['reference']; | 342 | // this._currentVersionReference = someData['currentVersion']['reference']; |
353 | this._currentVersionReference = someData['currentVersion']; | 343 | this._currentVersionReference = someData['currentVersion']; |
354 | //console.log("=== currentVersionReference", this._currentVersionReference, someData); | ||
355 | 344 | ||
356 | result = Clipperz.PM.DataModel.Record.superclass.unpackRemoteData.apply(this, arguments); | 345 | result = Clipperz.PM.DataModel.Record.superclass.unpackRemoteData.apply(this, arguments); |
357 | 346 | ||
358 | return result; | 347 | return result; |
359 | }, | 348 | }, |
360 | 349 | ||
361 | //------------------------------------------------------------------------- | 350 | //------------------------------------------------------------------------- |
362 | 351 | ||
363 | 'unpackData': function (someData) { | 352 | 'unpackData': function (someData) { |
364 | var result; | 353 | var result; |
365 | 354 | ||
366 | result = Clipperz.PM.DataModel.Record.superclass.unpackData.apply(this, arguments); | 355 | result = Clipperz.PM.DataModel.Record.superclass.unpackData.apply(this, arguments); |
367 | 356 | ||
368 | if (MochiKit.Base.isUndefinedOrNull(result['notes'])) { | 357 | if (MochiKit.Base.isUndefinedOrNull(result['notes'])) { |
369 | result['notes'] = '' | 358 | result['notes'] = '' |
370 | } | 359 | } |
371 | 360 | ||
372 | return result; | 361 | return result; |
373 | }, | 362 | }, |
374 | 363 | ||
375 | //------------------------------------------------------------------------- | 364 | //------------------------------------------------------------------------- |
376 | 365 | ||
377 | 'prepareRemoteDataWithKey': function (aKey) { | 366 | 'prepareRemoteDataWithKey': function (aKey) { |
378 | var deferredResult; | 367 | var deferredResult; |
379 | varnewVersionKey; | 368 | varnewVersionKey; |
380 | var result; | 369 | var result; |
381 | 370 | ||
382 | newVersionKey = Clipperz.PM.Crypto.randomKey(); | 371 | newVersionKey = Clipperz.PM.Crypto.randomKey(); |
383 | result = {}; | 372 | result = {}; |
384 | 373 | ||
385 | deferredResult = new Clipperz.Async.Deferred("Record.prepareRemoteDataWithKey", {trace:false}); | 374 | deferredResult = new Clipperz.Async.Deferred("Record.prepareRemoteDataWithKey", {trace:false}); |
386 | deferredResult.addCallbackList([ | 375 | deferredResult.addCallbackList([ |
387 | Clipperz.Async.collectResults("Record.prepareRemoteDataWithKey - collect results", { | 376 | Clipperz.Async.collectResults("Record.prepareRemoteDataWithKey - collect results", { |
388 | 'isBrandNew': MochiKit.Base.method(this, 'isBrandNew'), | 377 | 'isBrandNew': MochiKit.Base.method(this, 'isBrandNew'), |
389 | 'versionHasPendingChanges':[ | 378 | 'versionHasPendingChanges':[ |
390 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 379 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
391 | // MochiKit.Base.methodcaller('hasPendingChanges') | 380 | // MochiKit.Base.methodcaller('hasPendingChanges') |
392 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'hasPendingChanges') | 381 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'hasPendingChanges') |
393 | ] | 382 | ] |
394 | }), | 383 | }), |
395 | Clipperz.Async.or, | 384 | Clipperz.Async.or, |
396 | 385 | ||
397 | Clipperz.Async.deferredIf("Current Version has pending changes", [ | 386 | Clipperz.Async.deferredIf("Current Version has pending changes", [ |
398 | MochiKit.Base.method(this, 'createNewRecordVersion'), | 387 | MochiKit.Base.method(this, 'createNewRecordVersion'), |
399 | MochiKit.Base.methodcaller('prepareRemoteDataWithKey', newVersionKey), | 388 | MochiKit.Base.methodcaller('prepareRemoteDataWithKey', newVersionKey), |
400 | MochiKit.Base.partial(Clipperz.Async.setItem, result, 'currentRecordVersion'), | 389 | MochiKit.Base.partial(Clipperz.Async.setItem, result, 'currentRecordVersion'), |
401 | MochiKit.Base.method(this, 'setCurrentRecordVersionKey', newVersionKey) | 390 | MochiKit.Base.method(this, 'setCurrentRecordVersionKey', newVersionKey) |
402 | ], []), | 391 | ], []), |
403 | 392 | ||
404 | MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.prepareRemoteDataWithKey, this, aKey), | 393 | MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.prepareRemoteDataWithKey, this, aKey), |
405 | MochiKit.Base.partial(Clipperz.Async.setItem, result, 'record'), | 394 | MochiKit.Base.partial(Clipperz.Async.setItem, result, 'record'), |
406 | 395 | ||
407 | MochiKit.Base.partial(MochiKit.Async.succeed, result) | 396 | MochiKit.Base.partial(MochiKit.Async.succeed, result) |
408 | ]); | 397 | ]); |
409 | 398 | ||
410 | deferredResult.callback(); | 399 | deferredResult.callback(); |
411 | 400 | ||
412 | return deferredResult; | 401 | return deferredResult; |
413 | }, | 402 | }, |
414 | 403 | ||
415 | //========================================================================= | 404 | //========================================================================= |
416 | 405 | ||
417 | 'fields': function () { | 406 | 'fields': function () { |
418 | return this.invokeCurrentRecordVersionMethod('fields'); | 407 | return this.invokeCurrentRecordVersionMethod('fields'); |
419 | }, | 408 | }, |
420 | 409 | ||
421 | 'addField': function (someParameters) { | 410 | 'addField': function (someParameters) { |
422 | return this.invokeCurrentRecordVersionMethod('addField', someParameters); | 411 | return this.invokeCurrentRecordVersionMethod('addField', someParameters); |
423 | }, | 412 | }, |
424 | 413 | ||
425 | 'removeField': function (someParameters) { | 414 | 'removeField': function (someParameters) { |
426 | return this.invokeCurrentRecordVersionMethod('removeField', someParameters); | 415 | return this.invokeCurrentRecordVersionMethod('removeField', someParameters); |
427 | }, | 416 | }, |
428 | 417 | ||
429 | //'sortFieldReference': function (someSortedFieldReferences) { | 418 | //'sortFieldReference': function (someSortedFieldReferences) { |
430 | // return this.invokeCurrentRecordVersionMethod('sortFieldReference', someSortedFieldReferences); | 419 | // return this.invokeCurrentRecordVersionMethod('sortFieldReference', someSortedFieldReferences); |
431 | //}, | 420 | //}, |
432 | 421 | ||
433 | 'getFieldsValues': function () { | 422 | 'getFieldsValues': function () { |
434 | return this.invokeCurrentRecordVersionMethod('getFieldsValues'); | 423 | return this.invokeCurrentRecordVersionMethod('getFieldsValues'); |
435 | }, | 424 | }, |
436 | 425 | ||
437 | 'fieldWithLabel': function (aLabel) { | 426 | 'fieldWithLabel': function (aLabel) { |
438 | return Clipperz.Async.callbacks("Record.fieldWithLabel", [ | 427 | return Clipperz.Async.callbacks("Record.fieldWithLabel", [ |
439 | MochiKit.Base.method(this, 'fields'), | 428 | MochiKit.Base.method(this, 'fields'), |
440 | MochiKit.Base.values, | 429 | MochiKit.Base.values, |
441 | MochiKit.Base.partial(Clipperz.Async.deferredFilter, function (aField) { | 430 | MochiKit.Base.partial(Clipperz.Async.deferredFilter, function (aField) { |
442 | return Clipperz.Async.callbacks("Record.fieldWithLabel - check field label", [ | 431 | return Clipperz.Async.callbacks("Record.fieldWithLabel - check field label", [ |
443 | MochiKit.Base.methodcaller('label'), | 432 | MochiKit.Base.methodcaller('label'), |
444 | MochiKit.Base.partial(MochiKit.Base.operator.eq, aLabel) | 433 | MochiKit.Base.partial(MochiKit.Base.operator.eq, aLabel) |
445 | ], {trace:false}, aField); | 434 | ], {trace:false}, aField); |
446 | }), | 435 | }), |
447 | function (someFilteredResults) { | 436 | function (someFilteredResults) { |
448 | var result; | 437 | var result; |
449 | 438 | ||
450 | switch (someFilteredResults.length) { | 439 | switch (someFilteredResults.length) { |
451 | case 0: | 440 | case 0: |
452 | result = null; | 441 | result = null; |
453 | break; | 442 | break; |
454 | case 1: | 443 | case 1: |
455 | result = someFilteredResults[0]; | 444 | result = someFilteredResults[0]; |
456 | break; | 445 | break; |
457 | default: | 446 | default: |
458 | WTF = TODO; | 447 | WTF = TODO; |
459 | break; | 448 | break; |
460 | } | 449 | } |
461 | 450 | ||
462 | return result; | 451 | return result; |
463 | } | 452 | } |
464 | ], {trace:false}); | 453 | ], {trace:false}); |
465 | }, | 454 | }, |
466 | 455 | ||
467 | //========================================================================= | 456 | //========================================================================= |
468 | 457 | ||
469 | 'getVersion': function (aVersionReference) { | 458 | 'getVersion': function (aVersionReference) { |
470 | return Clipperz.Async.callbacks("Record.getVersion", [ | 459 | return Clipperz.Async.callbacks("Record.getVersion", [ |
471 | MochiKit.Base.method(this, 'getVersions'), | 460 | MochiKit.Base.method(this, 'getVersions'), |
472 | MochiKit.Base.itemgetter(aVersionReference) | 461 | MochiKit.Base.itemgetter(aVersionReference) |
473 | ], {trace:false}); | 462 | ], {trace:false}); |
474 | }, | 463 | }, |
475 | 464 | ||
476 | //------------------------------------------------------------------------- | 465 | //------------------------------------------------------------------------- |
477 | 466 | ||
478 | 'getVersionKey': function (aVersionReference) { | 467 | 'getVersionKey': function (aVersionReference) { |
479 | vardeferredResult; | 468 | vardeferredResult; |
480 | var transientStateKey; | 469 | var transientStateKey; |
481 | 470 | ||
482 | transientStateKey = 'versionKeys' + '.' + aVersionReference; | 471 | transientStateKey = 'versionKeys' + '.' + aVersionReference; |
483 | if (this.transientState().getValue(transientStateKey) != null) { | 472 | if (this.transientState().getValue(transientStateKey) != null) { |
484 | deferredResult = MochiKit.Async.succeed(this.transientState().getValue(transientStateKey)); | 473 | deferredResult = MochiKit.Async.succeed(this.transientState().getValue(transientStateKey)); |
485 | } else { | 474 | } else { |
486 | deferredResult = Clipperz.Async.callbacks("Record.getVersionKey", [ | 475 | deferredResult = Clipperz.Async.callbacks("Record.getVersionKey", [ |
487 | MochiKit.Base.method(this, 'getVersions'), | 476 | MochiKit.Base.method(this, 'getVersions'), |
488 | MochiKit.Base.partial(MochiKit.Base.operator.eq, aVersionReference, this.currentVersionReference()), | 477 | MochiKit.Base.partial(MochiKit.Base.operator.eq, aVersionReference, this.currentVersionReference()), |
489 | Clipperz.Async.deferredIf("getVersionKey for current version", [ | 478 | Clipperz.Async.deferredIf("getVersionKey for current version", [ |
490 | MochiKit.Base.method(this, 'getCurrentRecordVersionKey'), | 479 | MochiKit.Base.method(this, 'getCurrentRecordVersionKey'), |
491 | MochiKit.Base.method(this.transientState(), 'setValue', transientStateKey) | 480 | MochiKit.Base.method(this.transientState(), 'setValue', transientStateKey) |
492 | ],[ | 481 | ],[ |
493 | MochiKit.Async.fail | 482 | MochiKit.Async.fail |
494 | ]) | 483 | ]) |
495 | ], {trace:false}); | 484 | ], {trace:false}); |
496 | } | 485 | } |
497 | 486 | ||
498 | return deferredResult; | 487 | return deferredResult; |
499 | }, | 488 | }, |
500 | 489 | ||
501 | //------------------------------------------------------------------------- | 490 | //------------------------------------------------------------------------- |
502 | 491 | ||
503 | 'versions': function () { | 492 | 'versions': function () { |
504 | return this._versions; | 493 | return this._versions; |
505 | }, | 494 | }, |
506 | 495 | ||
507 | 'getVersions': function () { | 496 | 'getVersions': function () { |
508 | return Clipperz.Async.callbacks("Record.versions", [ | 497 | return Clipperz.Async.callbacks("Record.versions", [ |
509 | MochiKit.Base.method(this, 'getValue', 'fakeKey, just to trigger unpackRemoteData'), | 498 | MochiKit.Base.method(this, 'getValue', 'fakeKey, just to trigger unpackRemoteData'), |
510 | MochiKit.Base.bind(function () { return this._versions; }, this) | 499 | MochiKit.Base.bind(function () { return this._versions; }, this) |
511 | ], {trace:false}); | 500 | ], {trace:false}); |
512 | }, | 501 | }, |
513 | 502 | ||
514 | //------------------------------------------------------------------------- | 503 | //------------------------------------------------------------------------- |
515 | 504 | ||
516 | 'getCurrentRecordVersion': function () { | 505 | 'getCurrentRecordVersion': function () { |
517 | return Clipperz.Async.callbacks("Record.getCurrentRecordVersion", [ | 506 | return Clipperz.Async.callbacks("Record.getCurrentRecordVersion", [ |
518 | // MochiKit.Base.method(this, 'getValue', 'fakeKey, just to trigger unpackRemoteData'), | 507 | // MochiKit.Base.method(this, 'getValue', 'fakeKey, just to trigger unpackRemoteData'), |
519 | // MochiKit.Base.bind(function () { return this._currentRecordVersion; }, this) | 508 | // MochiKit.Base.bind(function () { return this._currentRecordVersion; }, this) |
520 | 509 | ||
521 | MochiKit.Base.method(this, 'versions'), | 510 | MochiKit.Base.method(this, 'versions'), |
522 | MochiKit.Base.itemgetter(this.currentVersionReference()), | 511 | MochiKit.Base.itemgetter(this.currentVersionReference()), |
523 | Clipperz.Async.deferredIf("The current version is available", [ | 512 | Clipperz.Async.deferredIf("The current version is available", [ |
524 | MochiKit.Async.succeed | 513 | MochiKit.Async.succeed |
525 | ], [ | 514 | ], [ |
526 | MochiKit.Base.method(this, 'getVersions'), | 515 | MochiKit.Base.method(this, 'getVersions'), |
527 | MochiKit.Base.bind(function (someVersions) { return someVersions[this.currentVersionReference()]}, this) | 516 | MochiKit.Base.bind(function (someVersions) { return someVersions[this.currentVersionReference()]}, this) |
528 | ]) | 517 | ]) |
529 | ], {trace:false}); | 518 | ], {trace:false}); |
530 | }, | 519 | }, |
531 | 520 | ||
532 | 'setCurrentRecordVersion': function (aRecordVersion) { | 521 | 'setCurrentRecordVersion': function (aRecordVersion) { |
533 | this._currentVersionReference = aRecordVersion.reference(); | 522 | this._currentVersionReference = aRecordVersion.reference(); |
534 | }, | 523 | }, |
535 | 524 | ||
536 | //......................................................................... | 525 | //......................................................................... |
537 | 526 | ||
538 | 'currentVersionReference': function () { | 527 | 'currentVersionReference': function () { |
539 | //console.log("currentVersionReference"); | ||
540 | return this._currentVersionReference; | 528 | return this._currentVersionReference; |
541 | }, | 529 | }, |
542 | 530 | ||
543 | //------------------------------------------------------------------------- | 531 | //------------------------------------------------------------------------- |
544 | 532 | ||
545 | 'createNewRecordVersion': function () { | 533 | 'createNewRecordVersion': function () { |
546 | var deferredResult; | 534 | var deferredResult; |
547 | 535 | ||
548 | if (this.isBrandNew()) { | 536 | if (this.isBrandNew()) { |
549 | deferredResult = this.getCurrentRecordVersion(); | 537 | deferredResult = this.getCurrentRecordVersion(); |
550 | } else { | 538 | } else { |
551 | var newVersion; | 539 | var newVersion; |
552 | 540 | ||
553 | newVersion = new Clipperz.PM.DataModel.Record.Version({ | 541 | newVersion = new Clipperz.PM.DataModel.Record.Version({ |
554 | // 'reference': versionKey, | 542 | // 'reference': versionKey, |
555 | 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'), | 543 | 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'), |
556 | // 'remoteData': {}, | 544 | // 'remoteData': {}, |
557 | 'getVersion': MochiKit.Base.method(this, 'getVersion') | 545 | 'getVersion': MochiKit.Base.method(this, 'getVersion') |
558 | }) | 546 | }) |
559 | this._versions[newVersion.reference()] = newVersion; | 547 | this._versions[newVersion.reference()] = newVersion; |
560 | 548 | ||
561 | deferredResult = Clipperz.Async.callbacks("Record.createNewRecordVersion", [ | 549 | deferredResult = Clipperz.Async.callbacks("Record.createNewRecordVersion", [ |
562 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 550 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
563 | // MochiKit.Base.methodcaller('values'), | 551 | // MochiKit.Base.methodcaller('values'), |
564 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'values'), | 552 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'values'), |
565 | MochiKit.Base.method(newVersion, 'setValues'), | 553 | MochiKit.Base.method(newVersion, 'setValues'), |
566 | 554 | ||
567 | Clipperz.Async.collectResults("Record.createNewRecordVersion [collect results]", { | 555 | Clipperz.Async.collectResults("Record.createNewRecordVersion [collect results]", { |
568 | 'reference':MochiKit.Base.method(this, 'currentVersionReference'), | 556 | 'reference':MochiKit.Base.method(this, 'currentVersionReference'), |
569 | 'key': MochiKit.Base.method(this, 'getCurrentRecordVersionKey') | 557 | 'key': MochiKit.Base.method(this, 'getCurrentRecordVersionKey') |
570 | }, {trace:false}), | 558 | }, {trace:false}), |
571 | MochiKit.Base.method(newVersion, 'setPreviousVersionReferenceAndKey'), | 559 | MochiKit.Base.method(newVersion, 'setPreviousVersionReferenceAndKey'), |
572 | 560 | ||
573 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 561 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
574 | // MochiKit.Base.method(this, 'revertChanges'), | 562 | // MochiKit.Base.method(this, 'revertChanges'), |
575 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'revertChanges'), | 563 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'revertChanges'), |
576 | 564 | ||
577 | MochiKit.Base.method(this, 'setCurrentRecordVersion', newVersion), | 565 | MochiKit.Base.method(this, 'setCurrentRecordVersion', newVersion), |
578 | MochiKit.Base.partial(MochiKit.Async.succeed, newVersion) | 566 | MochiKit.Base.partial(MochiKit.Async.succeed, newVersion) |
579 | ], {trace:false}); | 567 | ], {trace:false}); |
580 | } | 568 | } |
581 | 569 | ||
582 | return deferredResult; | 570 | return deferredResult; |
583 | }, | 571 | }, |
584 | 572 | ||
585 | //------------------------------------------------------------------------- | 573 | //------------------------------------------------------------------------- |
586 | 574 | ||
587 | 'getCurrentRecordVersionKey': function () { | 575 | 'getCurrentRecordVersionKey': function () { |
588 | //console.log("getCurrentRecordVersionKey"); | ||
589 | return Clipperz.Async.callbacks("Record.getCurrentRecordVersionKey", [ | 576 | return Clipperz.Async.callbacks("Record.getCurrentRecordVersionKey", [ |
590 | MochiKit.Base.method(this, 'getValue', 'currentVersionKey'), | 577 | MochiKit.Base.method(this, 'getValue', 'currentVersionKey'), |
591 | Clipperz.Async.deferredIf("currentVersionKey is NOT null", [ | 578 | Clipperz.Async.deferredIf("currentVersionKey is NOT null", [ |
592 | MochiKit.Async.succeed | 579 | MochiKit.Async.succeed |
593 | ], [ | 580 | ], [ |
594 | MochiKit.Base.method(this, 'getKey') | 581 | MochiKit.Base.method(this, 'getKey') |
595 | ]) | 582 | ]) |
596 | ], {trace:false}); | 583 | ], {trace:false}); |
597 | }, | 584 | }, |
598 | 585 | ||
599 | 'setCurrentRecordVersionKey': function (aValue) { | 586 | 'setCurrentRecordVersionKey': function (aValue) { |
600 | //TODO: triple check this method! | 587 | //TODO: triple check this method! |
601 | return Clipperz.Async.callbacks("Record.setCurrentRecordVersionKey", [ | 588 | return Clipperz.Async.callbacks("Record.setCurrentRecordVersionKey", [ |
602 | MochiKit.Base.method(this, 'setValue', 'currentVersionKey', aValue) | 589 | MochiKit.Base.method(this, 'setValue', 'currentVersionKey', aValue) |
603 | ], {trace:false}); | 590 | ], {trace:false}); |
604 | }, | 591 | }, |
605 | 592 | ||
606 | //------------------------------------------------------------------------- | 593 | //------------------------------------------------------------------------- |
607 | 594 | ||
608 | 'invokeCurrentRecordVersionMethod': function (aMethodName, someValues) { | 595 | 'invokeCurrentRecordVersionMethod': function (aMethodName, someValues) { |
609 | //console.log(">>> invokeCurrentRecordVersionMethod", aMethodName); | ||
610 | return Clipperz.Async.callbacks("Record.invokeCurrentRecordVersionMethod", [ | 596 | return Clipperz.Async.callbacks("Record.invokeCurrentRecordVersionMethod", [ |
611 | MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 597 | MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
612 | //function (aValue) { console.log("=== getCurrentRecordVersion", aValue); return aValue}, | ||
613 | MochiKit.Base.methodcaller(aMethodName, someValues) | 598 | MochiKit.Base.methodcaller(aMethodName, someValues) |
614 | ], {trace:false}); | 599 | ], {trace:false}); |
615 | }, | 600 | }, |
616 | 601 | ||
617 | 602 | ||
618 | 'lazilyinvokeCurrentRecordVersionMethod': function (aMethodName, someValues, defaultResult) { | 603 | 'lazilyinvokeCurrentRecordVersionMethod': function (aMethodName, someValues, defaultResult) { |
619 | return Clipperz.Async.callbacks("Record.lazilyinvokeCurrentRecordVersionMethod", [ | 604 | return Clipperz.Async.callbacks("Record.lazilyinvokeCurrentRecordVersionMethod", [ |
620 | MochiKit.Base.method(this, 'currentVersionReference'), | 605 | MochiKit.Base.method(this, 'currentVersionReference'), |
621 | //function (aValue) { console.log("LAZY -> versions", aValue); return aValue; }, | ||
622 | Clipperz.Async.deferredIf("versions has been loaded", [ | 606 | Clipperz.Async.deferredIf("versions has been loaded", [ |
623 | //function (aValue) { console.log("LAZY -> then"); return aValue; }, | ||
624 | MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 607 | MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
625 | MochiKit.Base.methodcaller(aMethodName, someValues), | 608 | MochiKit.Base.methodcaller(aMethodName, someValues), |
626 | //function (aValue) { console.log("LAZY <- then"); return aValue; } | ||
627 | ], [ | 609 | ], [ |
628 | //function (aValue) { console.log("LAZY -> else"); return aValue; }, | ||
629 | MochiKit.Base.partial(MochiKit.Async.succeed, defaultResult), | 610 | MochiKit.Base.partial(MochiKit.Async.succeed, defaultResult), |
630 | //function (aValue) { console.log("LAZY <- else"); return aValue; } | ||
631 | ]) | 611 | ]) |
632 | ], {trace:false}); | 612 | ], {trace:false}); |
633 | }, | 613 | }, |
634 | 614 | ||
635 | //========================================================================= | 615 | //========================================================================= |
636 | 616 | ||
637 | 'hasPendingChanges': function () { | 617 | 'hasPendingChanges': function () { |
638 | var deferredResult; | 618 | var deferredResult; |
639 | 619 | ||
640 | if (this.hasInitiatedObjectDataStore()) { | 620 | if (this.hasInitiatedObjectDataStore()) { |
641 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.hasPendingChanges", {trace:false}); | 621 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.hasPendingChanges", {trace:false}); |
642 | deferredResult.collectResults({ | 622 | deferredResult.collectResults({ |
643 | 'super': MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.hasPendingChanges, this), | 623 | 'super': MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.hasPendingChanges, this), |
644 | 'currentVersion': [ | 624 | 'currentVersion': [ |
645 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 625 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
646 | // MochiKit.Base.methodcaller('hasPendingChanges') | 626 | // MochiKit.Base.methodcaller('hasPendingChanges') |
647 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'hasPendingChanges') | 627 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'hasPendingChanges') |
648 | ], | 628 | ], |
649 | 'directLogins': [ | 629 | 'directLogins': [ |
650 | MochiKit.Base.method(this, 'directLogins'), | 630 | MochiKit.Base.method(this, 'directLogins'), |
651 | //function (aValue) { console.log("Record.directLogins", aValue); return aValue; }, | ||
652 | MochiKit.Base.values, | 631 | MochiKit.Base.values, |
653 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasPendingChanges')), | 632 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasPendingChanges')), |
654 | Clipperz.Async.collectAll, | 633 | Clipperz.Async.collectAll, |
655 | Clipperz.Async.or | 634 | Clipperz.Async.or |
656 | // function(someValues) { | 635 | // function(someValues) { |
657 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); | 636 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); |
658 | // } | 637 | // } |
659 | ] | 638 | ] |
660 | }); | 639 | }); |
661 | //deferredResult.addCallback(function (aValue) { console.log("Record.hasPendingResults", aValue); return aValue; }); | ||
662 | deferredResult.addCallback(MochiKit.Base.values); | 640 | deferredResult.addCallback(MochiKit.Base.values); |
663 | deferredResult.addCallback(MochiKit.Base.bind(function(someValues) { | 641 | deferredResult.addCallback(MochiKit.Base.bind(function(someValues) { |
664 | var result; | 642 | var result; |
665 | result = MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); | 643 | result = MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); |
666 | 644 | ||
667 | if ((result == false) && (this.isBrandNew() == false)) { | 645 | if ((result == false) && (this.isBrandNew() == false)) { |
668 | result = MochiKit.Iter.some(MochiKit.Base.values(this.transientState().getValue('hasPendingChanges.indexData')), MochiKit.Base.operator.identity); | 646 | result = MochiKit.Iter.some(MochiKit.Base.values(this.transientState().getValue('hasPendingChanges.indexData')), MochiKit.Base.operator.identity); |
669 | } | 647 | } |
670 | 648 | ||
671 | return result; | 649 | return result; |
672 | }, this)); | 650 | }, this)); |
673 | 651 | ||
674 | deferredResult.callback(); | 652 | deferredResult.callback(); |
675 | } else { | 653 | } else { |
676 | deferredResult = Clipperz.Async.callbacks("Recrod.hasPendingChanges [hasInitiatedObjectDataStore == false]", [ | 654 | deferredResult = Clipperz.Async.callbacks("Recrod.hasPendingChanges [hasInitiatedObjectDataStore == false]", [ |
677 | MochiKit.Base.method(this, 'directLogins'), | 655 | MochiKit.Base.method(this, 'directLogins'), |
678 | MochiKit.Base.values, | 656 | MochiKit.Base.values, |
679 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasPendingChanges')), | 657 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasPendingChanges')), |
680 | Clipperz.Async.collectAll, | 658 | Clipperz.Async.collectAll, |
681 | Clipperz.Async.or | 659 | Clipperz.Async.or |
682 | // function(someValues) { | 660 | // function(someValues) { |
683 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); | 661 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); |
684 | // } | 662 | // } |
685 | ], {trace:false}) | 663 | ], {trace:false}) |
686 | } | 664 | } |
687 | 665 | ||
688 | return deferredResult; | 666 | return deferredResult; |
689 | }, | 667 | }, |
690 | 668 | ||
691 | //------------------------------------------------------------------------- | 669 | //------------------------------------------------------------------------- |
692 | 670 | ||
693 | 'hasPendingChangesWhenBrandNew': function () { | 671 | 'hasPendingChangesWhenBrandNew': function () { |
694 | var deferredResult; | 672 | var deferredResult; |
695 | 673 | ||
696 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.hasPendingChangesWhenBrandNew", {trace:false}); | 674 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.hasPendingChangesWhenBrandNew", {trace:false}); |
697 | deferredResult.collectResults({ | 675 | deferredResult.collectResults({ |
698 | 'label': [ | 676 | 'label': [ |
699 | MochiKit.Base.method(this, 'label'), | 677 | MochiKit.Base.method(this, 'label'), |
700 | MochiKit.Base.partial(MochiKit.Base.operator.ne, '') | 678 | MochiKit.Base.partial(MochiKit.Base.operator.ne, '') |
701 | ], | 679 | ], |
702 | 'notes': [ | 680 | 'notes': [ |
703 | MochiKit.Base.method(this, 'notes'), | 681 | MochiKit.Base.method(this, 'notes'), |
704 | MochiKit.Base.partial(MochiKit.Base.operator.ne, '') | 682 | MochiKit.Base.partial(MochiKit.Base.operator.ne, '') |
705 | ] | 683 | ] |
706 | }); | 684 | }); |
707 | // deferredResult.addCallback(MochiKit.Base.values); | 685 | // deferredResult.addCallback(MochiKit.Base.values); |
708 | // deferredResult.addCallback(function(someValues) { | 686 | // deferredResult.addCallback(function(someValues) { |
709 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); | 687 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); |
710 | // }); | 688 | // }); |
711 | deferredResult.addCallback(Clipperz.Async.or); | 689 | deferredResult.addCallback(Clipperz.Async.or); |
712 | 690 | ||
713 | deferredResult.callback(); | 691 | deferredResult.callback(); |
714 | 692 | ||
715 | return deferredResult; | 693 | return deferredResult; |
716 | }, | 694 | }, |
717 | 695 | ||
718 | //------------------------------------------------------------------------- | 696 | //------------------------------------------------------------------------- |
719 | 697 | ||
720 | 'isBrandNewWithNoPendingChanges': function () { | 698 | 'isBrandNewWithNoPendingChanges': function () { |
721 | vardeferredResult; | 699 | vardeferredResult; |
722 | 700 | ||
723 | if (this.isBrandNew() == false) { | 701 | if (this.isBrandNew() == false) { |
724 | deferredResult = MochiKit.Async.succeed(false); | 702 | deferredResult = MochiKit.Async.succeed(false); |
725 | } else { | 703 | } else { |
726 | deferredResult = Clipperz.Async.callbacks("Record.isBrandNewWithNoPendingChanges", [ | 704 | deferredResult = Clipperz.Async.callbacks("Record.isBrandNewWithNoPendingChanges", [ |
727 | MochiKit.Base.method(this, 'hasPendingChanges'), | 705 | MochiKit.Base.method(this, 'hasPendingChanges'), |
728 | MochiKit.Base.operator.lognot | 706 | MochiKit.Base.operator.lognot |
729 | ], {trace:false}); | 707 | ], {trace:false}); |
730 | } | 708 | } |
731 | 709 | ||
732 | return deferredResult; | 710 | return deferredResult; |
733 | }, | 711 | }, |
734 | 712 | ||
735 | //========================================================================= | 713 | //========================================================================= |
736 | 714 | ||
737 | 'revertChanges': function () { | 715 | 'revertChanges': function () { |
738 | var deferredResult; | 716 | var deferredResult; |
739 | 717 | ||
740 | if (this.isBrandNew() == false) { | 718 | if (this.isBrandNew() == false) { |
741 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.revertChanges", {trace:false}); | 719 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.revertChanges", {trace:false}); |
742 | deferredResult.addMethod(this, 'hasPendingChanges'); | 720 | deferredResult.addMethod(this, 'hasPendingChanges'); |
743 | deferredResult.addIf([ | 721 | deferredResult.addIf([ |
744 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 722 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
745 | // MochiKit.Base.methodcaller('revertChanges'), | 723 | // MochiKit.Base.methodcaller('revertChanges'), |
746 | MochiKit.Base.method(this,'invokeCurrentRecordVersionMethod', 'revertChanges'), | 724 | MochiKit.Base.method(this,'invokeCurrentRecordVersionMethod', 'revertChanges'), |
747 | 725 | ||
748 | MochiKit.Base.method(this, 'directLogins'), | 726 | MochiKit.Base.method(this, 'directLogins'), |
749 | MochiKit.Base.values, | 727 | MochiKit.Base.values, |
750 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('revertChanges')), | 728 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('revertChanges')), |
751 | 729 | ||
752 | MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.revertChanges, this) | 730 | MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.revertChanges, this) |
753 | ], [ | 731 | ], [ |
754 | MochiKit.Async.succeed | 732 | MochiKit.Async.succeed |
755 | ]); | 733 | ]); |
756 | deferredResult.callback(); | 734 | deferredResult.callback(); |
757 | } else { | 735 | } else { |
758 | // this.deleteAllCleanTextData(); | 736 | // this.deleteAllCleanTextData(); |
759 | deferredResult = MochiKit.Async.succeed(); | 737 | deferredResult = MochiKit.Async.succeed(); |
760 | } | 738 | } |
761 | 739 | ||
762 | return deferredResult; | 740 | return deferredResult; |
763 | }, | 741 | }, |
764 | 742 | ||
765 | //------------------------------------------------------------------------- | 743 | //------------------------------------------------------------------------- |
766 | 744 | ||
767 | 'resetTransientState': function (isCommitting) { | 745 | 'resetTransientState': function (isCommitting) { |
768 | // if ((isCommitting == false) && (this.transientState().getValue('directLogins') != null)) { | 746 | // if ((isCommitting == false) && (this.transientState().getValue('directLogins') != null)) { |
769 | // this._directLogins = this.transientState().getValue('directLogins'); | 747 | // this._directLogins = this.transientState().getValue('directLogins'); |
770 | // } | 748 | // } |
771 | 749 | ||
772 | return Clipperz.Async.callbacks("Record.resetTransientState", [ | 750 | return Clipperz.Async.callbacks("Record.resetTransientState", [ |
773 | //- MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 751 | //- MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
774 | //- MochiKit.Base.methodcaller('resetTransientState'), | 752 | //- MochiKit.Base.methodcaller('resetTransientState'), |
775 | // MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'resetTransientState'), | 753 | // MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'resetTransientState'), |
776 | MochiKit.Base.method(this, 'lazilyinvokeCurrentRecordVersionMethod', 'resetTransientState'), | 754 | MochiKit.Base.method(this, 'lazilyinvokeCurrentRecordVersionMethod', 'resetTransientState'), |
777 | 755 | ||
778 | MochiKit.Base.method(this, 'directLogins'), | 756 | MochiKit.Base.method(this, 'directLogins'), |
779 | //function (aValue) { console.log("resetTransientState - directLogins", aValue); return aValue; }, | ||
780 | MochiKit.Base.values, | 757 | MochiKit.Base.values, |
781 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('resetTransientState')), | 758 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('resetTransientState')), |
782 | 759 | ||
783 | MochiKit.Base.bind(function () { | 760 | MochiKit.Base.bind(function () { |
784 | if ((isCommitting == false) && (this.transientState().getValue('directLogins') != null)) { | 761 | if ((isCommitting == false) && (this.transientState().getValue('directLogins') != null)) { |
785 | this._directLogins = this.transientState().getValue('directLogins'); | 762 | this._directLogins = this.transientState().getValue('directLogins'); |
786 | } | 763 | } |
787 | }, this), | 764 | }, this), |
788 | 765 | ||
789 | MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.resetTransientState, this, isCommitting) | 766 | MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.resetTransientState, this, isCommitting) |
790 | ], {trace:false}) | 767 | ], {trace:false}) |
791 | }, | 768 | }, |
792 | 769 | ||
793 | //------------------------------------------------------------------------- | 770 | //------------------------------------------------------------------------- |
794 | 771 | ||
795 | 'commitTransientState': function () { | 772 | 'commitTransientState': function () { |
796 | var deferredResult; | 773 | var deferredResult; |
797 | 774 | ||
798 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.commitTransientState", {trace:false}); | 775 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.commitTransientState", {trace:false}); |
799 | deferredResult.addMethod(this, 'hasPendingChanges'); | 776 | deferredResult.addMethod(this, 'hasPendingChanges'); |
800 | deferredResult.addIf([ | 777 | deferredResult.addIf([ |
801 | MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.commitTransientState, this), | 778 | MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.commitTransientState, this), |
802 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 779 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
803 | // MochiKit.Base.methodcaller('commitTransientState'), | 780 | // MochiKit.Base.methodcaller('commitTransientState'), |
804 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'commitTransientState'), | 781 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'commitTransientState'), |
805 | MochiKit.Base.method(this, 'directLogins'), | 782 | MochiKit.Base.method(this, 'directLogins'), |
806 | MochiKit.Base.values, | 783 | MochiKit.Base.values, |
807 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('commitTransientState')) | 784 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('commitTransientState')) |
808 | ], [ | 785 | ], [ |
809 | MochiKit.Async.succeed | 786 | MochiKit.Async.succeed |
810 | ]); | 787 | ]); |
811 | deferredResult.callback(); | 788 | deferredResult.callback(); |
812 | 789 | ||
813 | return deferredResult; | 790 | return deferredResult; |
814 | }, | 791 | }, |
815 | 792 | ||
816 | //========================================================================= | 793 | //========================================================================= |
817 | 794 | ||
818 | 'retrieveDirectLoginIndexDataFunction': function () { | 795 | 'retrieveDirectLoginIndexDataFunction': function () { |
819 | //console.log("Record.retrieveDirectLoginIndexDataFunction", this._retrieveDirectLoginIndexDataFunction); | ||
820 | return this._retrieveDirectLoginIndexDataFunction; | 796 | return this._retrieveDirectLoginIndexDataFunction; |
821 | }, | 797 | }, |
822 | 798 | ||
823 | 'setDirectLoginIndexDataFunction': function () { | 799 | 'setDirectLoginIndexDataFunction': function () { |
824 | return this._setDirectLoginIndexDataFunction; | 800 | return this._setDirectLoginIndexDataFunction; |
825 | }, | 801 | }, |
826 | 802 | ||
827 | 'removeDirectLoginIndexDataFunction': function () { | 803 | 'removeDirectLoginIndexDataFunction': function () { |
828 | return this._removeDirectLoginIndexDataFunction; | 804 | return this._removeDirectLoginIndexDataFunction; |
829 | }, | 805 | }, |
830 | 806 | ||
831 | //========================================================================= | 807 | //========================================================================= |
832 | 808 | ||
833 | 'deleteAllCleanTextData': function () { | 809 | 'deleteAllCleanTextData': function () { |
834 | // return Clipperz.PM.DataModel.Record.superclass.deleteAllCleanTextData.apply(this, arguments); | 810 | // return Clipperz.PM.DataModel.Record.superclass.deleteAllCleanTextData.apply(this, arguments); |
835 | 811 | ||
836 | return Clipperz.Async.callbacks("Record.deleteAllCleanTextData", [ | 812 | return Clipperz.Async.callbacks("Record.deleteAllCleanTextData", [ |
837 | MochiKit.Base.method(this, 'versions'), | 813 | MochiKit.Base.method(this, 'versions'), |
838 | MochiKit.Base.values, | 814 | MochiKit.Base.values, |
839 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('deleteAllCleanTextData')), | 815 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('deleteAllCleanTextData')), |
840 | 816 | ||
841 | MochiKit.Base.method(this, 'directLogins'), | 817 | MochiKit.Base.method(this, 'directLogins'), |
842 | MochiKit.Base.values, | 818 | MochiKit.Base.values, |
843 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('deleteAllCleanTextData')), | 819 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('deleteAllCleanTextData')), |
844 | 820 | ||
845 | MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.deleteAllCleanTextData, this) | 821 | MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.deleteAllCleanTextData, this) |
846 | ], {trace:false}); | 822 | ], {trace:false}); |
847 | }, | 823 | }, |
848 | 824 | ||
849 | 'hasAnyCleanTextData': function () { | 825 | 'hasAnyCleanTextData': function () { |
850 | // return Clipperz.PM.DataModel.Record.superclass.hasAnyCleanTextData.apply(this, arguments); | 826 | // return Clipperz.PM.DataModel.Record.superclass.hasAnyCleanTextData.apply(this, arguments); |
851 | 827 | ||
852 | return Clipperz.Async.callbacks("Record.hasAnyCleanTextData", [ | 828 | return Clipperz.Async.callbacks("Record.hasAnyCleanTextData", [ |
853 | Clipperz.Async.collectResults("Record.hasAnyCleanTextData [collect results]", { | 829 | Clipperz.Async.collectResults("Record.hasAnyCleanTextData [collect results]", { |
854 | 'versions':[ | 830 | 'versions':[ |
855 | MochiKit.Base.method(this, 'versions'), | 831 | MochiKit.Base.method(this, 'versions'), |
856 | MochiKit.Base.values, | 832 | MochiKit.Base.values, |
857 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasAnyCleanTextData')), | 833 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasAnyCleanTextData')), |
858 | Clipperz.Async.collectAll | 834 | Clipperz.Async.collectAll |
859 | ], | 835 | ], |
860 | 'directLogins': [ | 836 | 'directLogins': [ |
861 | MochiKit.Base.method(this, 'directLogins'), | 837 | MochiKit.Base.method(this, 'directLogins'), |
862 | MochiKit.Base.values, | 838 | MochiKit.Base.values, |
863 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasAnyCleanTextData')), | 839 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasAnyCleanTextData')), |
864 | Clipperz.Async.collectAll | 840 | Clipperz.Async.collectAll |
865 | ], | 841 | ], |
866 | 'super': [ | 842 | 'super': [ |
867 | MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.hasAnyCleanTextData, this) | 843 | MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.hasAnyCleanTextData, this) |
868 | ] | 844 | ] |
869 | }, {trace:false}), | 845 | }, {trace:false}), |
870 | Clipperz.Async.or | 846 | Clipperz.Async.or |
871 | ]) | 847 | ]) |
872 | }, | 848 | }, |
873 | 849 | ||
874 | //========================================================================= | 850 | //========================================================================= |
875 | __syntaxFix__: "syntax fix" | 851 | __syntaxFix__: "syntax fix" |
876 | }); | 852 | }); |
877 | 853 | ||
878 | 854 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js index d6202ff..cda5a41 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js | |||
@@ -1,184 +1,182 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.User.Header.Legacy depends on Clipperz.PM.DataModel.User!"; | 25 | throw "Clipperz.PM.DataModel.User.Header.Legacy depends on Clipperz.PM.DataModel.User!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } | 28 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } |
31 | 29 | ||
32 | Clipperz.PM.DataModel.User.Header.Legacy = function(args) { | 30 | Clipperz.PM.DataModel.User.Header.Legacy = function(args) { |
33 | //args = args || {}; | 31 | //args = args || {}; |
34 | Clipperz.PM.DataModel.User.Header.Legacy.superclass.constructor.apply(this, arguments); | 32 | Clipperz.PM.DataModel.User.Header.Legacy.superclass.constructor.apply(this, arguments); |
35 | 33 | ||
36 | this._retrieveRecordDetailFunction = args.retrieveRecordDetailFunction|| Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | this._retrieveRecordDetailFunction = args.retrieveRecordDetailFunction|| Clipperz.Base.exception.raise('MandatoryParameter'); |
37 | this._records = null; | 35 | this._records = null; |
38 | //this._directLogins = null; | 36 | //this._directLogins = null; |
39 | 37 | ||
40 | return this; | 38 | return this; |
41 | } | 39 | } |
42 | 40 | ||
43 | 41 | ||
44 | Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.Legacy, Clipperz.PM.DataModel.EncryptedRemoteObject, { | 42 | Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.Legacy, Clipperz.PM.DataModel.EncryptedRemoteObject, { |
45 | 43 | ||
46 | 'toString': function() { | 44 | 'toString': function() { |
47 | return "Clipperz.PM.DataModel.User.Header.Legacy"; | 45 | return "Clipperz.PM.DataModel.User.Header.Legacy"; |
48 | }, | 46 | }, |
49 | 47 | ||
50 | //------------------------------------------------------------------------- | 48 | //------------------------------------------------------------------------- |
51 | 49 | ||
52 | 'retrieveRecordDetailFunction': function () { | 50 | 'retrieveRecordDetailFunction': function () { |
53 | return this._retrieveRecordDetailFunction; | 51 | return this._retrieveRecordDetailFunction; |
54 | }, | 52 | }, |
55 | 53 | ||
56 | //------------------------------------------------------------------------- | 54 | //------------------------------------------------------------------------- |
57 | 55 | ||
58 | 'getRecordKey': function (aRecordReference) { | 56 | 'getRecordKey': function (aRecordReference) { |
59 | var deferredResult; | 57 | var deferredResult; |
60 | 58 | ||
61 | deferredResult = new Clipperz.Async.Deferred("User.Header.Legacy.getRecordKey", {trace:false}); | 59 | deferredResult = new Clipperz.Async.Deferred("User.Header.Legacy.getRecordKey", {trace:false}); |
62 | deferredResult.addMethod(this, 'getRecordIndexData'); | 60 | deferredResult.addMethod(this, 'getRecordIndexData'); |
63 | deferredResult.addCallback(MochiKit.Base.itemgetter('key')) | 61 | deferredResult.addCallback(MochiKit.Base.itemgetter('key')) |
64 | deferredResult.callback(); | 62 | deferredResult.callback(); |
65 | 63 | ||
66 | return deferredResult; | 64 | return deferredResult; |
67 | }, | 65 | }, |
68 | 66 | ||
69 | //========================================================================= | 67 | //========================================================================= |
70 | 68 | ||
71 | 'getRecordIndexData': function (aRecordReference) { | 69 | 'getRecordIndexData': function (aRecordReference) { |
72 | return this.getValue('records.' + aRecordReference); | 70 | return this.getValue('records.' + aRecordReference); |
73 | }, | 71 | }, |
74 | 72 | ||
75 | 'updateRecordIndexData': function (aRecordReference, aKey, aValue) { | 73 | 'updateRecordIndexData': function (aRecordReference, aKey, aValue) { |
76 | return this.setValue('records.' + aRecordReference + "." + aKey, aValue); | 74 | return this.setValue('records.' + aRecordReference + "." + aKey, aValue); |
77 | }, | 75 | }, |
78 | 76 | ||
79 | //------------------------------------------------------------------------- | 77 | //------------------------------------------------------------------------- |
80 | 78 | ||
81 | 'getDirectLoginIndexData': function (aDirectLoginReference) { | 79 | 'getDirectLoginIndexData': function (aDirectLoginReference) { |
82 | return this.getValue('directLogins.' + aDirectLoginReference); | 80 | return this.getValue('directLogins.' + aDirectLoginReference); |
83 | }, | 81 | }, |
84 | 82 | ||
85 | 'setDirectLoginIndexData': function (aDirectLoginReference, aKey, aValue) { | 83 | 'setDirectLoginIndexData': function (aDirectLoginReference, aKey, aValue) { |
86 | return this.setValue('directLogins.' + aDirectLoginReference + '.' + aKey, aValue); | 84 | return this.setValue('directLogins.' + aDirectLoginReference + '.' + aKey, aValue); |
87 | }, | 85 | }, |
88 | 86 | ||
89 | 'removeDirectLoginIndexData': function (aDirectLoginReference) { | 87 | 'removeDirectLoginIndexData': function (aDirectLoginReference) { |
90 | return this.removeValue('directLogins.' + aDirectLoginReference); | 88 | return this.removeValue('directLogins.' + aDirectLoginReference); |
91 | }, | 89 | }, |
92 | 90 | ||
93 | //========================================================================= | 91 | //========================================================================= |
94 | 92 | ||
95 | 'records': function () { | 93 | 'records': function () { |
96 | vardeferredResult; | 94 | vardeferredResult; |
97 | var deferredLock; | 95 | var deferredLock; |
98 | 96 | ||
99 | deferredLock = this.getDeferredLockForKey('records'); | 97 | deferredLock = this.getDeferredLockForKey('records'); |
100 | 98 | ||
101 | deferredResult = new Clipperz.Async.Deferred("User.Header.Legacy.records", {trace:false}); | 99 | deferredResult = new Clipperz.Async.Deferred("User.Header.Legacy.records", {trace:false}); |
102 | deferredResult.acquireLock(deferredLock); | 100 | deferredResult.acquireLock(deferredLock); |
103 | deferredResult.addCallback(MochiKit.Base.bind(function () { | 101 | deferredResult.addCallback(MochiKit.Base.bind(function () { |
104 | var innerDeferredResult; | 102 | var innerDeferredResult; |
105 | 103 | ||
106 | if (this._records == null) { | 104 | if (this._records == null) { |
107 | innerDeferredResult = new Clipperz.Async.Deferred("User.Header.Legacy.records <inner deferred>", {trace:false}); | 105 | innerDeferredResult = new Clipperz.Async.Deferred("User.Header.Legacy.records <inner deferred>", {trace:false}); |
108 | innerDeferredResult.collectResults({ | 106 | innerDeferredResult.collectResults({ |
109 | 'header': [ | 107 | 'header': [ |
110 | // MochiKit.Base.method(this, 'getObjectDataStore'), | 108 | // MochiKit.Base.method(this, 'getObjectDataStore'), |
111 | // MochiKit.Base.methodcaller('values') | 109 | // MochiKit.Base.methodcaller('values') |
112 | MochiKit.Base.method(this, 'values') | 110 | MochiKit.Base.method(this, 'values') |
113 | ], | 111 | ], |
114 | 'recordsStats': [ | 112 | 'recordsStats': [ |
115 | MochiKit.Base.method(this, 'getRemoteData'), | 113 | MochiKit.Base.method(this, 'getRemoteData'), |
116 | MochiKit.Base.itemgetter('recordsStats') | 114 | MochiKit.Base.itemgetter('recordsStats') |
117 | ] | 115 | ] |
118 | }); | 116 | }); |
119 | innerDeferredResult.addCallback(MochiKit.Base.bind(function (someObjectData) { | 117 | innerDeferredResult.addCallback(MochiKit.Base.bind(function (someObjectData) { |
120 | var reference; | 118 | var reference; |
121 | 119 | ||
122 | this._records = {}; | 120 | this._records = {}; |
123 | // this._directLogins = {}; | 121 | // this._directLogins = {}; |
124 | 122 | ||
125 | for (reference in someObjectData['header']['records']) { | 123 | for (reference in someObjectData['header']['records']) { |
126 | varrecord; | 124 | varrecord; |
127 | 125 | ||
128 | record = new Clipperz.PM.DataModel.Record({ | 126 | record = new Clipperz.PM.DataModel.Record({ |
129 | 'reference': reference, | 127 | 'reference': reference, |
130 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getRecordKey'), | 128 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getRecordKey'), |
131 | 'retrieveRemoteDataFunction':this.retrieveRecordDetailFunction(), | 129 | 'retrieveRemoteDataFunction':this.retrieveRecordDetailFunction(), |
132 | // 'encryptedDataKeypath': 'data', | 130 | // 'encryptedDataKeypath': 'data', |
133 | // 'encryptedVersionKeypath': 'version', | 131 | // 'encryptedVersionKeypath': 'version', |
134 | 132 | ||
135 | 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getRecordIndexData'), | 133 | 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getRecordIndexData'), |
136 | 'updateIndexDataFunction': MochiKit.Base.method(this, 'updateRecordIndexData'), | 134 | 'updateIndexDataFunction': MochiKit.Base.method(this, 'updateRecordIndexData'), |
137 | 'updateDate': someObjectData['recordsStats'][reference]['updateDate'], | 135 | 'updateDate': someObjectData['recordsStats'][reference]['updateDate'], |
138 | 136 | ||
139 | 'retrieveDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'), | 137 | 'retrieveDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'), |
140 | 'setDirectLoginIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'), | 138 | 'setDirectLoginIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'), |
141 | 'removeDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'removeDirectLoginIndexData') | 139 | 'removeDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'removeDirectLoginIndexData') |
142 | }); | 140 | }); |
143 | 141 | ||
144 | this._records[reference] = record; | 142 | this._records[reference] = record; |
145 | } | 143 | } |
146 | 144 | ||
147 | for (reference in someObjectData['header']['directLogins']) { | 145 | for (reference in someObjectData['header']['directLogins']) { |
148 | vardirectLogin; | 146 | vardirectLogin; |
149 | var record; | 147 | var record; |
150 | 148 | ||
151 | record = this._records[someObjectData['header']['directLogins'][reference]['record']]; | 149 | record = this._records[someObjectData['header']['directLogins'][reference]['record']]; |
152 | if (record != null) { | 150 | if (record != null) { |
153 | directLogin = new Clipperz.PM.DataModel.DirectLogin({ | 151 | directLogin = new Clipperz.PM.DataModel.DirectLogin({ |
154 | 'reference': reference, | 152 | 'reference': reference, |
155 | 'record': record//, | 153 | 'record': record//, |
156 | // 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'), | 154 | // 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'), |
157 | // 'setIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'), | 155 | // 'setIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'), |
158 | // 'removeIndexDataFunction': MochiKit.Base.method(this, 'removeDirectLoginIndexData') | 156 | // 'removeIndexDataFunction': MochiKit.Base.method(this, 'removeDirectLoginIndexData') |
159 | }); | 157 | }); |
160 | } else { | 158 | } else { |
161 | Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!"); | 159 | Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!"); |
162 | } | 160 | } |
163 | } | 161 | } |
164 | 162 | ||
165 | return this._records; | 163 | return this._records; |
166 | }, this)); | 164 | }, this)); |
167 | innerDeferredResult.callback(); | 165 | innerDeferredResult.callback(); |
168 | } else { | 166 | } else { |
169 | innerDeferredResult = MochiKit.Async.succeed(this._records); | 167 | innerDeferredResult = MochiKit.Async.succeed(this._records); |
170 | } | 168 | } |
171 | 169 | ||
172 | return innerDeferredResult; | 170 | return innerDeferredResult; |
173 | }, this)); | 171 | }, this)); |
174 | deferredResult.releaseLock(deferredLock); | 172 | deferredResult.releaseLock(deferredLock); |
175 | deferredResult.callback(); | 173 | deferredResult.callback(); |
176 | 174 | ||
177 | return deferredResult; | 175 | return deferredResult; |
178 | }, | 176 | }, |
179 | 177 | ||
180 | //========================================================================= | 178 | //========================================================================= |
181 | __syntaxFix__: "syntax fix" | 179 | __syntaxFix__: "syntax fix" |
182 | }); | 180 | }); |
183 | 181 | ||
184 | 182 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js index 3528db6..e82da47 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js | |||
@@ -1,125 +1,117 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.User.Header.OneTimePasswords depends on Clipperz.PM.DataModel.User!"; | 25 | throw "Clipperz.PM.DataModel.User.Header.OneTimePasswords depends on Clipperz.PM.DataModel.User!"; |
28 | } | 26 | } |
29 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } | 27 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } |
30 | 28 | ||
31 | //----------------------------------------------------------------------------- | 29 | //----------------------------------------------------------------------------- |
32 | 30 | ||
33 | Clipperz.PM.DataModel.User.Header.OneTimePasswords = function(args) { | 31 | Clipperz.PM.DataModel.User.Header.OneTimePasswords = function(args) { |
34 | Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.constructor.apply(this, arguments); | 32 | Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.constructor.apply(this, arguments); |
35 | 33 | ||
36 | this._oneTimePasswords = null; | 34 | this._oneTimePasswords = null; |
37 | 35 | ||
38 | return this; | 36 | return this; |
39 | } | 37 | } |
40 | 38 | ||
41 | //----------------------------------------------------------------------------- | 39 | //----------------------------------------------------------------------------- |
42 | 40 | ||
43 | Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.OneTimePasswords, Clipperz.PM.DataModel.EncryptedRemoteObject, { | 41 | Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.OneTimePasswords, Clipperz.PM.DataModel.EncryptedRemoteObject, { |
44 | 42 | ||
45 | 'toString': function() { | 43 | 'toString': function() { |
46 | return "Clipperz.PM.DataModel.User.Header.OneTimePasswords"; | 44 | return "Clipperz.PM.DataModel.User.Header.OneTimePasswords"; |
47 | }, | 45 | }, |
48 | 46 | ||
49 | //------------------------------------------------------------------------- | 47 | //------------------------------------------------------------------------- |
50 | /* | 48 | /* |
51 | 'packData': function (someData) { //++ | 49 | 'packData': function (someData) { //++ |
52 | var result; | 50 | var result; |
53 | 51 | ||
54 | console.log(">>> OneTimePasswords.packData", someData); | ||
55 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packData.apply(this, arguments); | 52 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packData.apply(this, arguments); |
56 | console.log("<<< OneTimePasswords.packData"); | ||
57 | 53 | ||
58 | return result; | 54 | return result; |
59 | }, | 55 | }, |
60 | */ | 56 | */ |
61 | //------------------------------------------------------------------------- | 57 | //------------------------------------------------------------------------- |
62 | /* | 58 | /* |
63 | 'packRemoteData': function (someData) { | 59 | 'packRemoteData': function (someData) { |
64 | var result; | 60 | var result; |
65 | 61 | ||
66 | console.log(">>> OneTimePasswords.packRemoteData", someData); | ||
67 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packRemoteData.apply(this, arguments); | 62 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packRemoteData.apply(this, arguments); |
68 | console.log("<<< OneTimePasswords.packRemoteData"); | ||
69 | 63 | ||
70 | return result; | 64 | return result; |
71 | }, | 65 | }, |
72 | */ | 66 | */ |
73 | //------------------------------------------------------------------------- | 67 | //------------------------------------------------------------------------- |
74 | /* | 68 | /* |
75 | 'prepareRemoteDataWithKey': function (aKey) { | 69 | 'prepareRemoteDataWithKey': function (aKey) { |
76 | var result; | 70 | var result; |
77 | 71 | ||
78 | console.log(">>> OneTimePasswords.prepareRemoteDataWithKey"); | ||
79 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.prepareRemoteDataWithKey.apply(this, arguments); | 72 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.prepareRemoteDataWithKey.apply(this, arguments); |
80 | console.log("<<< OneTimePasswords.prepareRemoteDataWithKey"); | ||
81 | 73 | ||
82 | return result; | 74 | return result; |
83 | }, | 75 | }, |
84 | */ | 76 | */ |
85 | //========================================================================= | 77 | //========================================================================= |
86 | 78 | ||
87 | 'oneTimePasswords': function () { | 79 | 'oneTimePasswords': function () { |
88 | vardeferredResult; | 80 | vardeferredResult; |
89 | 81 | ||
90 | deferredResult = new Clipperz.Async.Deferred("User.Header.OneTimePasswords.oneTimePasswords", {trace:false}); | 82 | deferredResult = new Clipperz.Async.Deferred("User.Header.OneTimePasswords.oneTimePasswords", {trace:false}); |
91 | if (this._oneTimePasswords == null) { | 83 | if (this._oneTimePasswords == null) { |
92 | deferredResult.addMethod(this, 'values') | 84 | deferredResult.addMethod(this, 'values') |
93 | deferredResult.addCallback(MochiKit.Base.bind(function (someData) { | 85 | deferredResult.addCallback(MochiKit.Base.bind(function (someData) { |
94 | varotpKey; | 86 | varotpKey; |
95 | 87 | ||
96 | this._oneTimePasswords = {}; | 88 | this._oneTimePasswords = {}; |
97 | 89 | ||
98 | for (otpKey in someData) { | 90 | for (otpKey in someData) { |
99 | var otp; | 91 | var otp; |
100 | var otpParameters; | 92 | var otpParameters; |
101 | 93 | ||
102 | otpParameters = Clipperz.Base.deepClone(someData[otpKey]); | 94 | otpParameters = Clipperz.Base.deepClone(someData[otpKey]); |
103 | otpParameters['reference'] = otpKey; | 95 | otpParameters['reference'] = otpKey; |
104 | 96 | ||
105 | otp = new Clipperz.PM.DataModel.OneTimePassword(otpParameters); | 97 | otp = new Clipperz.PM.DataModel.OneTimePassword(otpParameters); |
106 | this._oneTimePasswords[otpKey] = otp; | 98 | this._oneTimePasswords[otpKey] = otp; |
107 | } | 99 | } |
108 | 100 | ||
109 | return this._oneTimePasswords; | 101 | return this._oneTimePasswords; |
110 | 102 | ||
111 | }, this)); | 103 | }, this)); |
112 | deferredResult.callback(); | 104 | deferredResult.callback(); |
113 | } else { | 105 | } else { |
114 | deferredResult = MochiKit.Async.succeed(this._oneTimePasswords); | 106 | deferredResult = MochiKit.Async.succeed(this._oneTimePasswords); |
115 | } | 107 | } |
116 | 108 | ||
117 | return deferredResult; | 109 | return deferredResult; |
118 | }, | 110 | }, |
119 | 111 | ||
120 | //========================================================================= | 112 | //========================================================================= |
121 | __syntaxFix__: "syntax fix" | 113 | __syntaxFix__: "syntax fix" |
122 | }); | 114 | }); |
123 | 115 | ||
124 | //----------------------------------------------------------------------------- | 116 | //----------------------------------------------------------------------------- |
125 | 117 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js index b164889..f1f95e8 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js | |||
@@ -1,50 +1,48 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.User.Header.Preferences depends on Clipperz.PM.DataModel.User!"; | 25 | throw "Clipperz.PM.DataModel.User.Header.Preferences depends on Clipperz.PM.DataModel.User!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } | 28 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } |
31 | 29 | ||
32 | Clipperz.PM.DataModel.User.Header.Preferences = function(args) { | 30 | Clipperz.PM.DataModel.User.Header.Preferences = function(args) { |
33 | Clipperz.PM.DataModel.User.Header.Preferences.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.DataModel.User.Header.Preferences.superclass.constructor.apply(this, arguments); |
34 | 32 | ||
35 | return this; | 33 | return this; |
36 | } | 34 | } |
37 | 35 | ||
38 | 36 | ||
39 | Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.Preferences, Clipperz.PM.DataModel.EncryptedRemoteObject, { | 37 | Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.Preferences, Clipperz.PM.DataModel.EncryptedRemoteObject, { |
40 | 38 | ||
41 | 'toString': function() { | 39 | 'toString': function() { |
42 | return "Clipperz.PM.DataModel.User.Header.Preferences"; | 40 | return "Clipperz.PM.DataModel.User.Header.Preferences"; |
43 | }, | 41 | }, |
44 | 42 | ||
45 | //------------------------------------------------------------------------- | 43 | //------------------------------------------------------------------------- |
46 | //========================================================================= | 44 | //========================================================================= |
47 | __syntaxFix__: "syntax fix" | 45 | __syntaxFix__: "syntax fix" |
48 | }); | 46 | }); |
49 | 47 | ||
50 | 48 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js index f77ea80..5681f70 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js | |||
@@ -1,702 +1,685 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.User.Header.RecordIndex depends on Clipperz.PM.DataModel.User!"; | 25 | throw "Clipperz.PM.DataModel.User.Header.RecordIndex depends on Clipperz.PM.DataModel.User!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } | 28 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } |
31 | 29 | ||
32 | Clipperz.PM.DataModel.User.Header.RecordIndex = function(args) { | 30 | Clipperz.PM.DataModel.User.Header.RecordIndex = function(args) { |
33 | Clipperz.PM.DataModel.User.Header.RecordIndex.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.DataModel.User.Header.RecordIndex.superclass.constructor.apply(this, arguments); |
34 | 32 | ||
35 | //console.log("NEW Clipperz.PM.DataModel.User.Header.RecordIndex", args); | ||
36 | this._recordsData = new Clipperz.PM.DataModel.EncryptedRemoteObject({ | 33 | this._recordsData = new Clipperz.PM.DataModel.EncryptedRemoteObject({ |
37 | 'name':'recordsData', | 34 | 'name':'recordsData', |
38 | 'retrieveKeyFunction': args.retrieveKeyFunction, | 35 | 'retrieveKeyFunction': args.retrieveKeyFunction, |
39 | 'remoteData': { | 36 | 'remoteData': { |
40 | 'data': args.recordsData['data'], | 37 | 'data': args.recordsData['data'], |
41 | 'version': args.encryptedDataVersion, | 38 | 'version': args.encryptedDataVersion, |
42 | 'recordsStats': args.recordsStats | 39 | 'recordsStats': args.recordsStats |
43 | }//, | 40 | }//, |
44 | // 'encryptedDataKeypath': 'data', | 41 | // 'encryptedDataKeypath': 'data', |
45 | // 'encryptedVersionKeypath': 'version' | 42 | // 'encryptedVersionKeypath': 'version' |
46 | }); | 43 | }); |
47 | 44 | ||
48 | this._directLoginsData = new Clipperz.PM.DataModel.EncryptedRemoteObject({ | 45 | this._directLoginsData = new Clipperz.PM.DataModel.EncryptedRemoteObject({ |
49 | 'name':'directLoginsData', | 46 | 'name':'directLoginsData', |
50 | 'retrieveKeyFunction': args.retrieveKeyFunction, | 47 | 'retrieveKeyFunction': args.retrieveKeyFunction, |
51 | 'remoteData': { | 48 | 'remoteData': { |
52 | 'data': args.directLoginsData['data'], | 49 | 'data': args.directLoginsData['data'], |
53 | 'version': args.encryptedDataVersion | 50 | 'version': args.encryptedDataVersion |
54 | }//, | 51 | }//, |
55 | // 'encryptedDataKeypath': 'data', | 52 | // 'encryptedDataKeypath': 'data', |
56 | // 'encryptedVersionKeypath': 'version' | 53 | // 'encryptedVersionKeypath': 'version' |
57 | }); | 54 | }); |
58 | 55 | ||
59 | this._lock = new MochiKit.Async.DeferredLock(); | 56 | this._lock = new MochiKit.Async.DeferredLock(); |
60 | this._transientState = null; | 57 | this._transientState = null; |
61 | 58 | ||
62 | this._retrieveRecordDetailFunction = args.retrieveRecordDetailFunction|| Clipperz.Base.exception.raise('MandatoryParameter'); | 59 | this._retrieveRecordDetailFunction = args.retrieveRecordDetailFunction|| Clipperz.Base.exception.raise('MandatoryParameter'); |
63 | this._recordsIndex = args.recordsData['index'] || Clipperz.Base.exception.raise('MandatoryParameter'); | 60 | this._recordsIndex = args.recordsData['index'] || Clipperz.Base.exception.raise('MandatoryParameter'); |
64 | this._directLoginsIndex = args.directLoginsData['index']|| Clipperz.Base.exception.raise('MandatoryParameter'); | 61 | this._directLoginsIndex = args.directLoginsData['index']|| Clipperz.Base.exception.raise('MandatoryParameter'); |
65 | 62 | ||
66 | this._records = null; | 63 | this._records = null; |
67 | 64 | ||
68 | return this; | 65 | return this; |
69 | } | 66 | } |
70 | 67 | ||
71 | 68 | ||
72 | Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.RecordIndex, Object, { | 69 | Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.RecordIndex, Object, { |
73 | 70 | ||
74 | 'toString': function() { | 71 | 'toString': function() { |
75 | return "Clipperz.PM.DataModel.User.Header.RecordIndex"; | 72 | return "Clipperz.PM.DataModel.User.Header.RecordIndex"; |
76 | }, | 73 | }, |
77 | 74 | ||
78 | //------------------------------------------------------------------------- | 75 | //------------------------------------------------------------------------- |
79 | 76 | ||
80 | 'retrieveRecordDetailFunction': function () { | 77 | 'retrieveRecordDetailFunction': function () { |
81 | return this._retrieveRecordDetailFunction; | 78 | return this._retrieveRecordDetailFunction; |
82 | }, | 79 | }, |
83 | 80 | ||
84 | //------------------------------------------------------------------------- | 81 | //------------------------------------------------------------------------- |
85 | 82 | ||
86 | 'recordsIndex': function () { | 83 | 'recordsIndex': function () { |
87 | return this._recordsIndex; | 84 | return this._recordsIndex; |
88 | }, | 85 | }, |
89 | 86 | ||
90 | 'recordsData': function () { | 87 | 'recordsData': function () { |
91 | return this._recordsData; | 88 | return this._recordsData; |
92 | }, | 89 | }, |
93 | 90 | ||
94 | //------------------------------------------------------------------------- | 91 | //------------------------------------------------------------------------- |
95 | 92 | ||
96 | 'directLoginsIndex': function () { | 93 | 'directLoginsIndex': function () { |
97 | return this._directLoginsIndex; | 94 | return this._directLoginsIndex; |
98 | }, | 95 | }, |
99 | 96 | ||
100 | 'directLoginsData': function () { | 97 | 'directLoginsData': function () { |
101 | return this._directLoginsData; | 98 | return this._directLoginsData; |
102 | }, | 99 | }, |
103 | 100 | ||
104 | //------------------------------------------------------------------------- | 101 | //------------------------------------------------------------------------- |
105 | 102 | ||
106 | 'lock': function () { | 103 | 'lock': function () { |
107 | return this._lock; | 104 | return this._lock; |
108 | }, | 105 | }, |
109 | 106 | ||
110 | //------------------------------------------------------------------------- | 107 | //------------------------------------------------------------------------- |
111 | 108 | ||
112 | 'transientState': function () { | 109 | 'transientState': function () { |
113 | if (this._transientState == null) { | 110 | if (this._transientState == null) { |
114 | this._transientState = new Clipperz.KeyValueObjectStore(/*{'name':'User.Header.RecordIndex.transientState [1]'}*/); | 111 | this._transientState = new Clipperz.KeyValueObjectStore(/*{'name':'User.Header.RecordIndex.transientState [1]'}*/); |
115 | } | 112 | } |
116 | 113 | ||
117 | return this._transientState; | 114 | return this._transientState; |
118 | }, | 115 | }, |
119 | 116 | ||
120 | 'resetTransientState': function (isCommitting) { | 117 | 'resetTransientState': function (isCommitting) { |
121 | //console.log("######## UserHeaderRecordIndex - resetTransientState", Clipperz.Base.deepClone(this._transientState)); | ||
122 | if (this._transientState != null) { | 118 | if (this._transientState != null) { |
123 | this._transientState.removeAllData(); | 119 | this._transientState.removeAllData(); |
124 | } | 120 | } |
125 | 121 | ||
126 | this._transientState = null; | 122 | this._transientState = null; |
127 | }, | 123 | }, |
128 | 124 | ||
129 | //------------------------------------------------------------------------- | 125 | //------------------------------------------------------------------------- |
130 | 126 | ||
131 | 'getRecordKey': function (aRecordReference) { | 127 | 'getRecordKey': function (aRecordReference) { |
132 | return Clipperz.Async.callbacks("User.Header.RecordIndex.getRecordKey", [ | 128 | return Clipperz.Async.callbacks("User.Header.RecordIndex.getRecordKey", [ |
133 | MochiKit.Base.method(this, 'getRecordIndexData', aRecordReference), | 129 | MochiKit.Base.method(this, 'getRecordIndexData', aRecordReference), |
134 | MochiKit.Base.itemgetter('key') | 130 | MochiKit.Base.itemgetter('key') |
135 | ], {trace:false}); | 131 | ], {trace:false}); |
136 | }, | 132 | }, |
137 | 133 | ||
138 | 'setRecordKey': function (aRecordReference, aValue) { | 134 | 'setRecordKey': function (aRecordReference, aValue) { |
139 | return this.updateRecordIndexData(aRecordReference, 'key', aValue); | 135 | return this.updateRecordIndexData(aRecordReference, 'key', aValue); |
140 | }, | 136 | }, |
141 | 137 | ||
142 | //------------------------------------------------------------------------- | 138 | //------------------------------------------------------------------------- |
143 | 139 | ||
144 | 'getRecordIndexData': function (aRecordReference) { | 140 | 'getRecordIndexData': function (aRecordReference) { |
145 | return this.recordsData().getValue(this.recordsIndex()[aRecordReference]); | 141 | return this.recordsData().getValue(this.recordsIndex()[aRecordReference]); |
146 | }, | 142 | }, |
147 | 143 | ||
148 | //......................................................................... | 144 | //......................................................................... |
149 | 145 | ||
150 | 'updateRecordIndexData': function (aRecordReference, aKey, aValue) { | 146 | 'updateRecordIndexData': function (aRecordReference, aKey, aValue) { |
151 | return this.recordsData().setValue(this.recordsIndex()[aRecordReference]+'.'+aKey, aValue); | 147 | return this.recordsData().setValue(this.recordsIndex()[aRecordReference]+'.'+aKey, aValue); |
152 | }, | 148 | }, |
153 | 149 | ||
154 | //------------------------------------------------------------------------- | 150 | //------------------------------------------------------------------------- |
155 | 151 | ||
156 | 'getDirectLoginIndexData': function (aDirectLoginReference) { | 152 | 'getDirectLoginIndexData': function (aDirectLoginReference) { |
157 | return this.directLoginsData().getValue(this.directLoginsIndex()[aDirectLoginReference]); | 153 | return this.directLoginsData().getValue(this.directLoginsIndex()[aDirectLoginReference]); |
158 | }, | 154 | }, |
159 | 155 | ||
160 | 'setDirectLoginIndexData': function (aDirectLoginReference, aKey, aValue) { | 156 | 'setDirectLoginIndexData': function (aDirectLoginReference, aKey, aValue) { |
161 | //console.log("UserHeaderRecordIndex.setDirectLoginIndexData", aDirectLoginReference, this.directLoginsIndex()[aDirectLoginReference], aKey); | ||
162 | //if (MochiKit.Base.isUndefinedOrNull(this.directLoginsIndex()[aDirectLoginReference])) { | 157 | //if (MochiKit.Base.isUndefinedOrNull(this.directLoginsIndex()[aDirectLoginReference])) { |
163 | //throw "PIPPO"; | 158 | //throw "PIPPO"; |
164 | //} | 159 | //} |
165 | return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference] + '.' + aKey, aValue); | 160 | return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference] + '.' + aKey, aValue); |
166 | }, | 161 | }, |
167 | 162 | ||
168 | 'addDirectLoginIndexData': function (aDirectLoginReference) { | 163 | 'addDirectLoginIndexData': function (aDirectLoginReference) { |
169 | //console.log("UserHeaderRecordIndex.addDirectLoginIndexData", aDirectLoginReference, this.directLoginsIndex()[aDirectLoginReference]); | ||
170 | return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference], {}); | 164 | return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference], {}); |
171 | }, | 165 | }, |
172 | 166 | ||
173 | 'removeDirectLoginIndexData': function (aDirectLoginReference) { | 167 | 'removeDirectLoginIndexData': function (aDirectLoginReference) { |
174 | return this.directLoginsData().removeValue(this.directLoginsIndex()[aDirectLoginReference]) | 168 | return this.directLoginsData().removeValue(this.directLoginsIndex()[aDirectLoginReference]) |
175 | }, | 169 | }, |
176 | 170 | ||
177 | //------------------------------------------------------------------------- | 171 | //------------------------------------------------------------------------- |
178 | 172 | ||
179 | 'records': function () { | 173 | 'records': function () { |
180 | vardeferredResult; | 174 | vardeferredResult; |
181 | 175 | ||
182 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.records", {trace:false}); | 176 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.records", {trace:false}); |
183 | deferredResult.acquireLock(this.lock()); | 177 | deferredResult.acquireLock(this.lock()); |
184 | deferredResult.addCallback(MochiKit.Base.bind(function () { | 178 | deferredResult.addCallback(MochiKit.Base.bind(function () { |
185 | var innerDeferredResult; | 179 | var innerDeferredResult; |
186 | 180 | ||
187 | if (this._records == null) { | 181 | if (this._records == null) { |
188 | innerDeferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.records <inner deferred>", {trace:false}); | 182 | innerDeferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.records <inner deferred>", {trace:false}); |
189 | innerDeferredResult.collectResults({ | 183 | innerDeferredResult.collectResults({ |
190 | 'records': [ | 184 | 'records': [ |
191 | // MochiKit.Base.method(this.recordsData(), 'getObjectDataStore'), | 185 | // MochiKit.Base.method(this.recordsData(), 'getObjectDataStore'), |
192 | // MochiKit.Base.methodcaller('values') | 186 | // MochiKit.Base.methodcaller('values') |
193 | MochiKit.Base.method(this.recordsData(), 'values') | 187 | MochiKit.Base.method(this.recordsData(), 'values') |
194 | ], | 188 | ], |
195 | 'recordsStats': [ | 189 | 'recordsStats': [ |
196 | MochiKit.Base.method(this.recordsData(), 'getRemoteData'), | 190 | MochiKit.Base.method(this.recordsData(), 'getRemoteData'), |
197 | MochiKit.Base.itemgetter('recordsStats') | 191 | MochiKit.Base.itemgetter('recordsStats') |
198 | ], | 192 | ], |
199 | 'directLogins': [ | 193 | 'directLogins': [ |
200 | // MochiKit.Base.method(this.directLoginsData(), 'getObjectDataStore'), | 194 | // MochiKit.Base.method(this.directLoginsData(), 'getObjectDataStore'), |
201 | // MochiKit.Base.methodcaller('values') | 195 | // MochiKit.Base.methodcaller('values') |
202 | MochiKit.Base.method(this.directLoginsData(), 'values') | 196 | MochiKit.Base.method(this.directLoginsData(), 'values') |
203 | ] | 197 | ] |
204 | }) | 198 | }) |
205 | innerDeferredResult.addCallback(MochiKit.Base.bind(function (someData) { | 199 | innerDeferredResult.addCallback(MochiKit.Base.bind(function (someData) { |
206 | var indexReference; | 200 | var indexReference; |
207 | var recordsInvertedIndex; | 201 | var recordsInvertedIndex; |
208 | var directLoginsInvertedIndex; | 202 | var directLoginsInvertedIndex; |
209 | 203 | ||
210 | recordsInvertedIndex = Clipperz.PM.DataModel.User.Header.RecordIndex.invertIndex(this.recordsIndex()); | 204 | recordsInvertedIndex = Clipperz.PM.DataModel.User.Header.RecordIndex.invertIndex(this.recordsIndex()); |
211 | directLoginsInvertedIndex= Clipperz.PM.DataModel.User.Header.RecordIndex.invertIndex(this.directLoginsIndex()); | 205 | directLoginsInvertedIndex= Clipperz.PM.DataModel.User.Header.RecordIndex.invertIndex(this.directLoginsIndex()); |
212 | 206 | ||
213 | this._records = {}; | 207 | this._records = {}; |
214 | 208 | ||
215 | for (indexReference in someData['records']) { | 209 | for (indexReference in someData['records']) { |
216 | varrecord; | 210 | varrecord; |
217 | var reference; | 211 | var reference; |
218 | var updateDate; | 212 | var updateDate; |
219 | 213 | ||
220 | reference = recordsInvertedIndex[indexReference]; | 214 | reference = recordsInvertedIndex[indexReference]; |
221 | 215 | ||
222 | if (typeof(someData['recordsStats'][reference]) != 'undefined') { | 216 | if (typeof(someData['recordsStats'][reference]) != 'undefined') { |
223 | updateDate = someData['recordsStats'][reference]['updateDate']; | 217 | updateDate = someData['recordsStats'][reference]['updateDate']; |
224 | 218 | ||
225 | record = new Clipperz.PM.DataModel.Record({ | 219 | record = new Clipperz.PM.DataModel.Record({ |
226 | 'reference': reference, | 220 | 'reference': reference, |
227 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getRecordKey'), | 221 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getRecordKey'), |
228 | 'retrieveRemoteDataFunction':this.retrieveRecordDetailFunction(), | 222 | 'retrieveRemoteDataFunction':this.retrieveRecordDetailFunction(), |
229 | 223 | ||
230 | 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getRecordIndexData'), | 224 | 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getRecordIndexData'), |
231 | 'updateIndexDataFunction': MochiKit.Base.method(this, 'updateRecordIndexData'), | 225 | 'updateIndexDataFunction': MochiKit.Base.method(this, 'updateRecordIndexData'), |
232 | 'updateDate': updateDate, | 226 | 'updateDate': updateDate, |
233 | 227 | ||
234 | 'retrieveDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'), | 228 | 'retrieveDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'), |
235 | 'setDirectLoginIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'), | 229 | 'setDirectLoginIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'), |
236 | 'removeDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'removeDirectLoginIndexData'), | 230 | 'removeDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'removeDirectLoginIndexData'), |
237 | 231 | ||
238 | 'createNewDirectLoginFunction': MochiKit.Base.method(this, 'createNewDirectLogin') | 232 | 'createNewDirectLoginFunction': MochiKit.Base.method(this, 'createNewDirectLogin') |
239 | }); | 233 | }); |
240 | 234 | ||
241 | this._records[reference] = record; | 235 | this._records[reference] = record; |
242 | } else { | 236 | } else { |
243 | Clipperz.log("SKIPPING record " + reference + " as there are no stas associated - " + Clipperz.Base.serializeJSON(someData['records'][reference])); | 237 | Clipperz.log("SKIPPING record " + reference + " as there are no stas associated - " + Clipperz.Base.serializeJSON(someData['records'][reference])); |
244 | //# skip the record, as it seems it is not present in the DB | 238 | //# skip the record, as it seems it is not present in the DB |
245 | //updateDate = Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); | 239 | //updateDate = Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); |
246 | } | 240 | } |
247 | } | 241 | } |
248 | 242 | ||
249 | for (indexReference in someData['directLogins']) { | 243 | for (indexReference in someData['directLogins']) { |
250 | // vardirectLogin; | 244 | // vardirectLogin; |
251 | var reference; | 245 | var reference; |
252 | var record; | 246 | var record; |
253 | 247 | ||
254 | reference = directLoginsInvertedIndex[indexReference]; | 248 | reference = directLoginsInvertedIndex[indexReference]; |
255 | record = this._records[recordsInvertedIndex[someData['directLogins'][indexReference]['record']]]; | 249 | record = this._records[recordsInvertedIndex[someData['directLogins'][indexReference]['record']]]; |
256 | 250 | ||
257 | if (record != null) { | 251 | if (record != null) { |
258 | // directLogin = new Clipperz.PM.DataModel.DirectLogin({ | 252 | // directLogin = new Clipperz.PM.DataModel.DirectLogin({ |
259 | new Clipperz.PM.DataModel.DirectLogin({ | 253 | new Clipperz.PM.DataModel.DirectLogin({ |
260 | 'reference': reference, | 254 | 'reference': reference, |
261 | 'record': record | 255 | 'record': record |
262 | }); | 256 | }); |
263 | } else { | 257 | } else { |
264 | Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!"); | 258 | Clipperz.logWarning("WARNING: DIRECT LOGIN without a matching RECORD!!"); |
265 | //console.log("direct login data", someData['directLogins']); | ||
266 | //console.log("current direct login data", someData['directLogins'][indexReference]) | ||
267 | //console.log("reference", reference); | ||
268 | //console.log("record index", this.recordsIndex()); | ||
269 | //console.log("record inverted index", recordsInvertedIndex); | ||
270 | } | 259 | } |
271 | } | 260 | } |
272 | 261 | ||
273 | return this._records; | 262 | return this._records; |
274 | }, this)); | 263 | }, this)); |
275 | innerDeferredResult.callback(); | 264 | innerDeferredResult.callback(); |
276 | } else { | 265 | } else { |
277 | innerDeferredResult = MochiKit.Async.succeed(this._records); | 266 | innerDeferredResult = MochiKit.Async.succeed(this._records); |
278 | } | 267 | } |
279 | 268 | ||
280 | return innerDeferredResult; | 269 | return innerDeferredResult; |
281 | }, this)); | 270 | }, this)); |
282 | deferredResult.releaseLock(this.lock()); | 271 | deferredResult.releaseLock(this.lock()); |
283 | deferredResult.callback(); | 272 | deferredResult.callback(); |
284 | 273 | ||
285 | return deferredResult; | 274 | return deferredResult; |
286 | }, | 275 | }, |
287 | 276 | ||
288 | //------------------------------------------------------------------------- | 277 | //------------------------------------------------------------------------- |
289 | 278 | ||
290 | 'updateRecordIndexForNewRecord': function (aNewRecord) { | 279 | 'updateRecordIndexForNewRecord': function (aNewRecord) { |
291 | var newRecordIndex; | 280 | var newRecordIndex; |
292 | var recordReference; | 281 | var recordReference; |
293 | 282 | ||
294 | recordReference = aNewRecord.reference(); | 283 | recordReference = aNewRecord.reference(); |
295 | newRecordIndex = (MochiKit.Base.listMax(MochiKit.Base.map(MochiKit.Base.partial(MochiKit.Base.operator.mul, 1), MochiKit.Base.values(this.recordsIndex()))) + 1) + ''; | 284 | newRecordIndex = (MochiKit.Base.listMax(MochiKit.Base.map(MochiKit.Base.partial(MochiKit.Base.operator.mul, 1), MochiKit.Base.values(this.recordsIndex()))) + 1) + ''; |
296 | this.recordsIndex()[recordReference] = newRecordIndex; | 285 | this.recordsIndex()[recordReference] = newRecordIndex; |
297 | 286 | ||
298 | this.transientState().setValue('newlyCreatedRecordsIndex' + '.' + recordReference, newRecordIndex); | 287 | this.transientState().setValue('newlyCreatedRecordsIndex' + '.' + recordReference, newRecordIndex); |
299 | this.transientState().setValue('newlyCreatedRecordsReferences'+ '.' + recordReference, aNewRecord); | 288 | this.transientState().setValue('newlyCreatedRecordsReferences'+ '.' + recordReference, aNewRecord); |
300 | }, | 289 | }, |
301 | 290 | ||
302 | //......................................................................... | 291 | //......................................................................... |
303 | 292 | ||
304 | 'createNewRecord': function () { | 293 | 'createNewRecord': function () { |
305 | var deferredResult; | 294 | var deferredResult; |
306 | var newRecord; | 295 | var newRecord; |
307 | 296 | ||
308 | //console.log("#### new Clipperz.PM.DataModel.Record [4]"); | ||
309 | newRecord = new Clipperz.PM.DataModel.Record({ | 297 | newRecord = new Clipperz.PM.DataModel.Record({ |
310 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getRecordKey'), | 298 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getRecordKey'), |
311 | 'retrieveRemoteDataFunction':this.retrieveRecordDetailFunction(), | 299 | 'retrieveRemoteDataFunction':this.retrieveRecordDetailFunction(), |
312 | 300 | ||
313 | 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getRecordIndexData'), | 301 | 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getRecordIndexData'), |
314 | 'updateIndexDataFunction': MochiKit.Base.method(this, 'updateRecordIndexData'), | 302 | 'updateIndexDataFunction': MochiKit.Base.method(this, 'updateRecordIndexData'), |
315 | 'updateDate': Clipperz.PM.Date.formatDateWithUTCFormat(new Date()), | 303 | 'updateDate': Clipperz.PM.Date.formatDateWithUTCFormat(new Date()), |
316 | 304 | ||
317 | 'retrieveDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'), | 305 | 'retrieveDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'getDirectLoginIndexData'), |
318 | 'setDirectLoginIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'), | 306 | 'setDirectLoginIndexDataFunction': MochiKit.Base.method(this, 'setDirectLoginIndexData'), |
319 | 'removeDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'removeDirectLoginIndexData'), | 307 | 'removeDirectLoginIndexDataFunction':MochiKit.Base.method(this, 'removeDirectLoginIndexData'), |
320 | 308 | ||
321 | 'createNewDirectLoginFunction': MochiKit.Base.method(this, 'createNewDirectLogin') | 309 | 'createNewDirectLoginFunction': MochiKit.Base.method(this, 'createNewDirectLogin') |
322 | }); | 310 | }); |
323 | 311 | ||
324 | this.transientState().setValue('newRecordsReferences' + '.' + newRecord.reference(), newRecord); | 312 | this.transientState().setValue('newRecordsReferences' + '.' + newRecord.reference(), newRecord); |
325 | this.updateRecordIndexForNewRecord(newRecord); | 313 | this.updateRecordIndexForNewRecord(newRecord); |
326 | 314 | ||
327 | deferredResult = Clipperz.Async.callbacks("User.Header.RecordIndex.createNewRecord", [ | 315 | deferredResult = Clipperz.Async.callbacks("User.Header.RecordIndex.createNewRecord", [ |
328 | MochiKit.Base.method(this, 'records'), | 316 | MochiKit.Base.method(this, 'records'), |
329 | MochiKit.Base.partial(Clipperz.Async.setItemOnObject, newRecord.reference(), newRecord), | 317 | MochiKit.Base.partial(Clipperz.Async.setItemOnObject, newRecord.reference(), newRecord), |
330 | MochiKit.Base.method(this, 'setRecordKey', newRecord.reference(), Clipperz.PM.Crypto.randomKey()), | 318 | MochiKit.Base.method(this, 'setRecordKey', newRecord.reference(), Clipperz.PM.Crypto.randomKey()), |
331 | MochiKit.Base.method(newRecord, 'setLabel', ''), | 319 | MochiKit.Base.method(newRecord, 'setLabel', ''), |
332 | MochiKit.Base.partial(MochiKit.Async.succeed, newRecord) | 320 | MochiKit.Base.partial(MochiKit.Async.succeed, newRecord) |
333 | ], {trace:false}); | 321 | ], {trace:false}); |
334 | 322 | ||
335 | 323 | ||
336 | return deferredResult; | 324 | return deferredResult; |
337 | }, | 325 | }, |
338 | 326 | ||
339 | //------------------------------------------------------------------------- | 327 | //------------------------------------------------------------------------- |
340 | 328 | ||
341 | 'deleteRecord': function (aRecord) { | 329 | 'deleteRecord': function (aRecord) { |
342 | var deferredResult; | 330 | var deferredResult; |
343 | var recordReference; | 331 | var recordReference; |
344 | 332 | ||
345 | recordReference = aRecord.reference(); | 333 | recordReference = aRecord.reference(); |
346 | 334 | ||
347 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.deleteRecord", {trace:false}); | 335 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.deleteRecord", {trace:false}); |
348 | 336 | ||
349 | deferredResult.addMethod(aRecord, 'directLogins'); | 337 | deferredResult.addMethod(aRecord, 'directLogins'); |
350 | deferredResult.addCallback(MochiKit.Base.values); | 338 | deferredResult.addCallback(MochiKit.Base.values); |
351 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'removeDirectLogin')); | 339 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'removeDirectLogin')); |
352 | 340 | ||
353 | deferredResult.addMethod(this.recordsData(), 'removeValue', this.recordsIndex()[recordReference]); | 341 | deferredResult.addMethod(this.recordsData(), 'removeValue', this.recordsIndex()[recordReference]); |
354 | deferredResult.addCallback(MochiKit.Base.bind(function () { | 342 | deferredResult.addCallback(MochiKit.Base.bind(function () { |
355 | this.transientState().setValue('deleteRecordsIndex' + '.' + recordReference, this.recordsIndex()[recordReference]); | 343 | this.transientState().setValue('deleteRecordsIndex' + '.' + recordReference, this.recordsIndex()[recordReference]); |
356 | delete this.recordsIndex()[recordReference]; | 344 | delete this.recordsIndex()[recordReference]; |
357 | }, this)); | 345 | }, this)); |
358 | 346 | ||
359 | deferredResult.addMethod(this, 'records'); | 347 | deferredResult.addMethod(this, 'records'); |
360 | deferredResult.addCallback(MochiKit.Base.itemgetter(recordReference)); | 348 | deferredResult.addCallback(MochiKit.Base.itemgetter(recordReference)); |
361 | deferredResult.addMethod(this.transientState(), 'setValue', 'deleteRecordsReferences' + '.' + recordReference); | 349 | deferredResult.addMethod(this.transientState(), 'setValue', 'deleteRecordsReferences' + '.' + recordReference); |
362 | 350 | ||
363 | deferredResult.addMethod(this, 'records'); | 351 | deferredResult.addMethod(this, 'records'); |
364 | deferredResult.addCallback(MochiKit.Base.bind(function (someRecords) { | 352 | deferredResult.addCallback(MochiKit.Base.bind(function (someRecords) { |
365 | delete someRecords[recordReference]; | 353 | delete someRecords[recordReference]; |
366 | }, this)); | 354 | }, this)); |
367 | deferredResult.callback(); | 355 | deferredResult.callback(); |
368 | 356 | ||
369 | return deferredResult; | 357 | return deferredResult; |
370 | }, | 358 | }, |
371 | 359 | ||
372 | //========================================================================= | 360 | //========================================================================= |
373 | 361 | ||
374 | 'removeDirectLogin': function (aDirectLogin) { | 362 | 'removeDirectLogin': function (aDirectLogin) { |
375 | this.directLoginsData().removeValue(this.directLoginsIndex()[aDirectLogin.reference()]); | 363 | this.directLoginsData().removeValue(this.directLoginsIndex()[aDirectLogin.reference()]); |
376 | }, | 364 | }, |
377 | 365 | ||
378 | //------------------------------------------------------------------------- | 366 | //------------------------------------------------------------------------- |
379 | 367 | ||
380 | 'createNewDirectLogin': function (aRecord) { | 368 | 'createNewDirectLogin': function (aRecord) { |
381 | var newDirectLogin; | 369 | var newDirectLogin; |
382 | varnewDirectLoginIndexValue; | 370 | varnewDirectLoginIndexValue; |
383 | 371 | ||
384 | newDirectLogin = new Clipperz.PM.DataModel.DirectLogin({record:aRecord}); | 372 | newDirectLogin = new Clipperz.PM.DataModel.DirectLogin({record:aRecord}); |
385 | newDirectLoginIndexValue = MochiKit.Base.listMax(MochiKit.Base.map(function (aValue) { return aValue * 1; }, MochiKit.Base.values(this.directLoginsIndex()))) + 1; | 373 | newDirectLoginIndexValue = MochiKit.Base.listMax(MochiKit.Base.map(function (aValue) { return aValue * 1; }, MochiKit.Base.values(this.directLoginsIndex()))) + 1; |
386 | 374 | ||
387 | this.transientState().setValue('newDirectLoginReferences' + '.' + newDirectLogin.reference(), newDirectLogin); | 375 | this.transientState().setValue('newDirectLoginReferences' + '.' + newDirectLogin.reference(), newDirectLogin); |
388 | 376 | ||
389 | //console.log("UserHeaderRecordIndex.createNewDirectLogin [1]", newDirectLogin.reference(), newDirectLoginIndexValue); | ||
390 | this.directLoginsIndex()[newDirectLogin.reference()] = newDirectLoginIndexValue; | 377 | this.directLoginsIndex()[newDirectLogin.reference()] = newDirectLoginIndexValue; |
391 | //console.log("UserHeaderRecordIndex.createNewDirectLogin [2]", newDirectLogin.reference(), this.directLoginsIndex()[newDirectLogin.reference()]); | ||
392 | this.directLoginsData().setValue(this.directLoginsIndex()[newDirectLogin.reference()], {'record': this.recordsIndex()[aRecord.reference()]}); | 378 | this.directLoginsData().setValue(this.directLoginsIndex()[newDirectLogin.reference()], {'record': this.recordsIndex()[aRecord.reference()]}); |
393 | 379 | ||
394 | return newDirectLogin; | 380 | return newDirectLogin; |
395 | }, | 381 | }, |
396 | 382 | ||
397 | //========================================================================= | 383 | //========================================================================= |
398 | 384 | ||
399 | 'deleteAllCleanTextData': function () { | 385 | 'deleteAllCleanTextData': function () { |
400 | return Clipperz.Async.callbacks("User.Header.RecordIndex.deleteAllCleanTextData", [ | 386 | return Clipperz.Async.callbacks("User.Header.RecordIndex.deleteAllCleanTextData", [ |
401 | // MochiKit.Base.method(this, 'records'), | 387 | // MochiKit.Base.method(this, 'records'), |
402 | // MochiKit.Base.values, | 388 | // MochiKit.Base.values, |
403 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('deleteAllCleanTextData')), | 389 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('deleteAllCleanTextData')), |
404 | 390 | ||
405 | MochiKit.Base.method(this, 'recordsData'), | 391 | MochiKit.Base.method(this, 'recordsData'), |
406 | MochiKit.Base.methodcaller('deleteAllCleanTextData'), | 392 | MochiKit.Base.methodcaller('deleteAllCleanTextData'), |
407 | MochiKit.Base.method(this, 'directLoginsData'), | 393 | MochiKit.Base.method(this, 'directLoginsData'), |
408 | MochiKit.Base.methodcaller('deleteAllCleanTextData') | 394 | MochiKit.Base.methodcaller('deleteAllCleanTextData') |
409 | ], {trace:false}); | 395 | ], {trace:false}); |
410 | }, | 396 | }, |
411 | 397 | ||
412 | //------------------------------------------------------------------------- | 398 | //------------------------------------------------------------------------- |
413 | 399 | ||
414 | 'hasAnyCleanTextData': function () { | 400 | 'hasAnyCleanTextData': function () { |
415 | var deferredResult; | 401 | var deferredResult; |
416 | 402 | ||
417 | deferredResult = new Clipperz.Async.Deferred({trace:false}); | 403 | deferredResult = new Clipperz.Async.Deferred({trace:false}); |
418 | deferredResult.collectResults({ | 404 | deferredResult.collectResults({ |
419 | 'recordsData': [ | 405 | 'recordsData': [ |
420 | MochiKit.Base.method(this, 'recordsData'), | 406 | MochiKit.Base.method(this, 'recordsData'), |
421 | MochiKit.Base.methodcaller('hasAnyCleanTextData') | 407 | MochiKit.Base.methodcaller('hasAnyCleanTextData') |
422 | ], | 408 | ], |
423 | 'directLoginsData':[ | 409 | 'directLoginsData':[ |
424 | MochiKit.Base.method(this, 'directLoginsData'), | 410 | MochiKit.Base.method(this, 'directLoginsData'), |
425 | MochiKit.Base.methodcaller('hasAnyCleanTextData') | 411 | MochiKit.Base.methodcaller('hasAnyCleanTextData') |
426 | ], | 412 | ], |
427 | // 'records': [ | 413 | // 'records': [ |
428 | // MochiKit.Base.method(this, 'records'), | 414 | // MochiKit.Base.method(this, 'records'), |
429 | // MochiKit.Base.values, | 415 | // MochiKit.Base.values, |
430 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasAnyCleanTextData')), | 416 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasAnyCleanTextData')), |
431 | // Clipperz.Async.collectAll | 417 | // Clipperz.Async.collectAll |
432 | // ] | 418 | // ] |
433 | }); | 419 | }); |
434 | //deferredResult.addCallback(function (aValue) { console.log("USER.Header.RecordIndex.hasAnyCleanTextData", aValue); return aValue}); | ||
435 | 420 | ||
436 | // deferredResult.addCallback(MochiKit.Base.values); | 421 | // deferredResult.addCallback(MochiKit.Base.values); |
437 | // deferredResult.addCallback(MochiKit.Base.flattenArguments); | 422 | // deferredResult.addCallback(MochiKit.Base.flattenArguments); |
438 | // deferredResult.addCallback(function(someValues) { | 423 | // deferredResult.addCallback(function(someValues) { |
439 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); | 424 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); |
440 | // }); | 425 | // }); |
441 | deferredResult.addCallback(Clipperz.Async.or); | 426 | deferredResult.addCallback(Clipperz.Async.or); |
442 | 427 | ||
443 | deferredResult.callback(); | 428 | deferredResult.callback(); |
444 | 429 | ||
445 | return deferredResult; | 430 | return deferredResult; |
446 | }, | 431 | }, |
447 | 432 | ||
448 | //------------------------------------------------------------------------- | 433 | //------------------------------------------------------------------------- |
449 | 434 | ||
450 | 'hasPendingChanges': function () { | 435 | 'hasPendingChanges': function () { |
451 | vardeferredResult; | 436 | vardeferredResult; |
452 | 437 | ||
453 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.hasPendingChanges", {trace:false}); | 438 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.hasPendingChanges", {trace:false}); |
454 | deferredResult.collectResults({ | 439 | deferredResult.collectResults({ |
455 | 'recordsData': [ | 440 | 'recordsData': [ |
456 | MochiKit.Base.method(this, 'recordsData'), | 441 | MochiKit.Base.method(this, 'recordsData'), |
457 | MochiKit.Base.methodcaller('hasPendingChanges') | 442 | MochiKit.Base.methodcaller('hasPendingChanges') |
458 | ], | 443 | ], |
459 | 'directLoginsData': [ | 444 | 'directLoginsData': [ |
460 | MochiKit.Base.method(this, 'directLoginsData'), | 445 | MochiKit.Base.method(this, 'directLoginsData'), |
461 | MochiKit.Base.methodcaller('hasPendingChanges') | 446 | MochiKit.Base.methodcaller('hasPendingChanges') |
462 | ] | 447 | ] |
463 | }); | 448 | }); |
464 | //deferredResult.addCallback(function (aValue) { console.log("UserHeaderIndex.hasPendingResults", aValue); return aValue; }); | ||
465 | deferredResult.addCallback(Clipperz.Async.or); | 449 | deferredResult.addCallback(Clipperz.Async.or); |
466 | // deferredResult.addCallback(MochiKit.Base.values); | 450 | // deferredResult.addCallback(MochiKit.Base.values); |
467 | // deferredResult.addCallback(MochiKit.Base.flattenArguments); | 451 | // deferredResult.addCallback(MochiKit.Base.flattenArguments); |
468 | // deferredResult.addCallback(function(someValues) { | 452 | // deferredResult.addCallback(function(someValues) { |
469 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); | 453 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); |
470 | // }); | 454 | // }); |
471 | deferredResult.callback(); | 455 | deferredResult.callback(); |
472 | 456 | ||
473 | return deferredResult; | 457 | return deferredResult; |
474 | }, | 458 | }, |
475 | 459 | ||
476 | //------------------------------------------------------------------------- | 460 | //------------------------------------------------------------------------- |
477 | 461 | ||
478 | 'commitTransientState': function () { | 462 | 'commitTransientState': function () { |
479 | var deferredResult; | 463 | var deferredResult; |
480 | 464 | ||
481 | deferredResut = Clipperz.Async.callbacks("User.Header.RecordIndex.commitTransientState", [ | 465 | deferredResut = Clipperz.Async.callbacks("User.Header.RecordIndex.commitTransientState", [ |
482 | MochiKit.Base.method(this, 'recordsData'), | 466 | MochiKit.Base.method(this, 'recordsData'), |
483 | MochiKit.Base.methodcaller('commitTransientState'), | 467 | MochiKit.Base.methodcaller('commitTransientState'), |
484 | 468 | ||
485 | MochiKit.Base.method(this, 'directLoginsData'), | 469 | MochiKit.Base.method(this, 'directLoginsData'), |
486 | MochiKit.Base.methodcaller('commitTransientState'), | 470 | MochiKit.Base.methodcaller('commitTransientState'), |
487 | 471 | ||
488 | MochiKit.Base.method(this, 'resetTransientState', true) | 472 | MochiKit.Base.method(this, 'resetTransientState', true) |
489 | ], {trace:false}); | 473 | ], {trace:false}); |
490 | 474 | ||
491 | return deferredResult; | 475 | return deferredResult; |
492 | }, | 476 | }, |
493 | 477 | ||
494 | //------------------------------------------------------------------------- | 478 | //------------------------------------------------------------------------- |
495 | 479 | ||
496 | 'revertChanges': function () { | 480 | 'revertChanges': function () { |
497 | return Clipperz.Async.callbacks("User.Header.RecordIndex.revertChanges", [ | 481 | return Clipperz.Async.callbacks("User.Header.RecordIndex.revertChanges", [ |
498 | MochiKit.Base.method(this, 'recordsData'), | 482 | MochiKit.Base.method(this, 'recordsData'), |
499 | MochiKit.Base.methodcaller('revertChanges'), | 483 | MochiKit.Base.methodcaller('revertChanges'), |
500 | 484 | ||
501 | // MochiKit.Base.method(this, 'directLoginsData'), | 485 | // MochiKit.Base.method(this, 'directLoginsData'), |
502 | // MochiKit.Base.methodcaller('revertChanges'), | 486 | // MochiKit.Base.methodcaller('revertChanges'), |
503 | 487 | ||
504 | MochiKit.Base.method(this, 'records'), | 488 | MochiKit.Base.method(this, 'records'), |
505 | MochiKit.Base.bind(function (someRecords) { | 489 | MochiKit.Base.bind(function (someRecords) { |
506 | varrecordReference; | 490 | varrecordReference; |
507 | 491 | ||
508 | for (recordReference in this.transientState().getValue('deleteRecordsReferences')) { | 492 | for (recordReference in this.transientState().getValue('deleteRecordsReferences')) { |
509 | this.recordsIndex()[recordReference] = this.transientState().getValue('deleteRecordsIndex' + '.' + recordReference); | 493 | this.recordsIndex()[recordReference] = this.transientState().getValue('deleteRecordsIndex' + '.' + recordReference); |
510 | someRecords[recordReference] = this.transientState().getValue('deleteRecordsReferences' + '.' + recordReference); | 494 | someRecords[recordReference] = this.transientState().getValue('deleteRecordsReferences' + '.' + recordReference); |
511 | } | 495 | } |
512 | 496 | ||
513 | for (recordReference in this.transientState().getValue('newRecordsReferences')) { | 497 | for (recordReference in this.transientState().getValue('newRecordsReferences')) { |
514 | delete this.recordsIndex()[recordReference]; | 498 | delete this.recordsIndex()[recordReference]; |
515 | delete someRecords[recordReference]; | 499 | delete someRecords[recordReference]; |
516 | } | 500 | } |
517 | }, this), | 501 | }, this), |
518 | 502 | ||
519 | // MochiKit.Base.method(this, 'directLogins'), | 503 | // MochiKit.Base.method(this, 'directLogins'), |
520 | MochiKit.Base.bind(function () { | 504 | MochiKit.Base.bind(function () { |
521 | vardirectLoginReference; | 505 | vardirectLoginReference; |
522 | 506 | ||
523 | //this.transientState().setValue('newDirectLoginReferences' + '.' + newDirectLogin.reference(), newDirectLogin); | 507 | //this.transientState().setValue('newDirectLoginReferences' + '.' + newDirectLogin.reference(), newDirectLogin); |
524 | // | 508 | // |
525 | //this.directLoginsIndex()[newDirectLogin.reference()] = newDirectLoginIndexValue; | 509 | //this.directLoginsIndex()[newDirectLogin.reference()] = newDirectLoginIndexValue; |
526 | //this.directLoginsData().setValue(this.directLoginsIndex()[newDirectLogin.reference()], {'record': this.recordsIndex()[aRecord.reference()]}); | 510 | //this.directLoginsData().setValue(this.directLoginsIndex()[newDirectLogin.reference()], {'record': this.recordsIndex()[aRecord.reference()]}); |
527 | 511 | ||
528 | 512 | ||
529 | // for (directLoginReference in this.transientState().getValue('deleteDirectLoginReferences')) { | 513 | // for (directLoginReference in this.transientState().getValue('deleteDirectLoginReferences')) { |
530 | // someDirectLogins[directLoginReference] = this.transientState().getValue('deleteDirectLoginReferences' + '.' + recordReference); | 514 | // someDirectLogins[directLoginReference] = this.transientState().getValue('deleteDirectLoginReferences' + '.' + recordReference); |
531 | // } | 515 | // } |
532 | 516 | ||
533 | for (directLoginReference in this.transientState().getValue('newDirectLoginReferences')) { | 517 | for (directLoginReference in this.transientState().getValue('newDirectLoginReferences')) { |
534 | // this.directLoginsData().removeValue(this.directLoginsIndex()[directLoginReference]); | 518 | // this.directLoginsData().removeValue(this.directLoginsIndex()[directLoginReference]); |
535 | delete this.directLoginsIndex()[directLoginReference]; | 519 | delete this.directLoginsIndex()[directLoginReference]; |
536 | } | 520 | } |
537 | }, this), | 521 | }, this), |
538 | 522 | ||
539 | MochiKit.Base.method(this, 'directLoginsData'), | 523 | MochiKit.Base.method(this, 'directLoginsData'), |
540 | MochiKit.Base.methodcaller('revertChanges'), | 524 | MochiKit.Base.methodcaller('revertChanges'), |
541 | 525 | ||
542 | MochiKit.Base.method(this, 'resetTransientState', false) | 526 | MochiKit.Base.method(this, 'resetTransientState', false) |
543 | ], {trace:false}); | 527 | ], {trace:false}); |
544 | }, | 528 | }, |
545 | 529 | ||
546 | //------------------------------------------------------------------------- | 530 | //------------------------------------------------------------------------- |
547 | 531 | ||
548 | 'prepareRemoteDataWithKey': function (aKey) { | 532 | 'prepareRemoteDataWithKey': function (aKey) { |
549 | // "records": { | 533 | // "records": { |
550 | // "index": { | 534 | // "index": { |
551 | // "eeda70e0392261967bda71c3764da78989c45bbd2bb7be6b941b90f81d9b81b5": "0", | 535 | // "eeda70e0392261967bda71c3764da78989c45bbd2bb7be6b941b90f81d9b81b5": "0", |
552 | // "13a5e52976337ab210903cd04872588e1b21fb72bc183e91aa25c494b8138551": "1", | 536 | // "13a5e52976337ab210903cd04872588e1b21fb72bc183e91aa25c494b8138551": "1", |
553 | // ... | 537 | // ... |
554 | // "465a067a0bd2b470fa834de5397e38494de0c7707938262fae3427932e219744": "18", | 538 | // "465a067a0bd2b470fa834de5397e38494de0c7707938262fae3427932e219744": "18", |
555 | // "4fd1dc2ca860b7fb47cef10a84edb3270da05510b0a30a6b0b083898712d4b9e": "19" | 539 | // "4fd1dc2ca860b7fb47cef10a84edb3270da05510b0a30a6b0b083898712d4b9e": "19" |
556 | // }, | 540 | // }, |
557 | // "data": "n+AzGEEQXaSRSY4d ... BDypotrXgPo94uHfoXvGFzwCn8w=" | 541 | // "data": "n+AzGEEQXaSRSY4d ... BDypotrXgPo94uHfoXvGFzwCn8w=" |
558 | // }, | 542 | // }, |
559 | // "directLogins": { | 543 | // "directLogins": { |
560 | // "index": { | 544 | // "index": { |
561 | // "61e87fdc4f1d9112e3b30c1f6812d095dcdb24f014c83319091eb6c9899ec348":"0", | 545 | // "61e87fdc4f1d9112e3b30c1f6812d095dcdb24f014c83319091eb6c9899ec348":"0", |
562 | // "989593d4c48929f0c8f1581aa96969c622807e99619ed4732026e967530a68ad":"1", | 546 | // "989593d4c48929f0c8f1581aa96969c622807e99619ed4732026e967530a68ad":"1", |
563 | // ... | 547 | // ... |
564 | // "cb9ae0bba1957075ccdbfd3b3481704d62087687a2ac7c411a4f07d444bde0f7":"17", | 548 | // "cb9ae0bba1957075ccdbfd3b3481704d62087687a2ac7c411a4f07d444bde0f7":"17", |
565 | // "7e1d069b7fa57c03bd7bf48807520feb953157834503aaff8c9d493f37dea69d":"18" | 549 | // "7e1d069b7fa57c03bd7bf48807520feb953157834503aaff8c9d493f37dea69d":"18" |
566 | // }, | 550 | // }, |
567 | // "data":"5YG9KKU/OZ5guUgFlms6k1 ... ZG/5Fn0uN+LoAsNfHm+EE62x" | 551 | // "data":"5YG9KKU/OZ5guUgFlms6k1 ... ZG/5Fn0uN+LoAsNfHm+EE62x" |
568 | // }, | 552 | // }, |
569 | 553 | ||
570 | var deferredResult; | 554 | var deferredResult; |
571 | var result; | 555 | var result; |
572 | 556 | ||
573 | //console.log("recordsIndex", this.recordsIndex()); | ||
574 | result = {}; | 557 | result = {}; |
575 | 558 | ||
576 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.prepareRemoteDataWithKey", {trace:false}); | 559 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.prepareRemoteDataWithKey", {trace:false}); |
577 | deferredResult.collectResults({ | 560 | deferredResult.collectResults({ |
578 | 'index':MochiKit.Base.partial(MochiKit.Async.succeed, this.recordsIndex()), | 561 | 'index':MochiKit.Base.partial(MochiKit.Async.succeed, this.recordsIndex()), |
579 | 'data': [ | 562 | 'data': [ |
580 | MochiKit.Base.method(this.recordsData(), 'prepareRemoteDataWithKey', aKey), | 563 | MochiKit.Base.method(this.recordsData(), 'prepareRemoteDataWithKey', aKey), |
581 | MochiKit.Base.itemgetter('data') | 564 | MochiKit.Base.itemgetter('data') |
582 | ] | 565 | ] |
583 | }); | 566 | }); |
584 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'records'); | 567 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'records'); |
585 | 568 | ||
586 | deferredResult.collectResults({ | 569 | deferredResult.collectResults({ |
587 | 'index':MochiKit.Base.partial(MochiKit.Async.succeed, this.directLoginsIndex()), | 570 | 'index':MochiKit.Base.partial(MochiKit.Async.succeed, this.directLoginsIndex()), |
588 | 'data': [ | 571 | 'data': [ |
589 | MochiKit.Base.method(this.directLoginsData(), 'prepareRemoteDataWithKey', aKey), | 572 | MochiKit.Base.method(this.directLoginsData(), 'prepareRemoteDataWithKey', aKey), |
590 | MochiKit.Base.itemgetter('data') | 573 | MochiKit.Base.itemgetter('data') |
591 | ] | 574 | ] |
592 | }); | 575 | }); |
593 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'directLogins'); | 576 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'directLogins'); |
594 | 577 | ||
595 | deferredResult.addCallback(MochiKit.Async.succeed, result); | 578 | deferredResult.addCallback(MochiKit.Async.succeed, result); |
596 | 579 | ||
597 | deferredResult.callback(); | 580 | deferredResult.callback(); |
598 | 581 | ||
599 | return deferredResult; | 582 | return deferredResult; |
600 | }, | 583 | }, |
601 | 584 | ||
602 | //------------------------------------------------------------------------- | 585 | //------------------------------------------------------------------------- |
603 | 586 | ||
604 | 'updateRecordKeyAndPrepareRemoteData': function (aRecord) { | 587 | 'updateRecordKeyAndPrepareRemoteData': function (aRecord) { |
605 | varnewRecordKey; | 588 | varnewRecordKey; |
606 | var deferredResult; | 589 | var deferredResult; |
607 | 590 | ||
608 | newRecordKey = Clipperz.PM.Crypto.randomKey(); | 591 | newRecordKey = Clipperz.PM.Crypto.randomKey(); |
609 | 592 | ||
610 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.updateRecordKeyAndPrepareRemoteData", {trace:false}); | 593 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.updateRecordKeyAndPrepareRemoteData", {trace:false}); |
611 | deferredResult.addCallback(MochiKit.Base.method(aRecord, 'prepareRemoteDataWithKey', newRecordKey)); | 594 | deferredResult.addCallback(MochiKit.Base.method(aRecord, 'prepareRemoteDataWithKey', newRecordKey)); |
612 | deferredResult.addCallbackPass(MochiKit.Base.method(this, 'setRecordKey', aRecord.reference(), newRecordKey)); | 595 | deferredResult.addCallbackPass(MochiKit.Base.method(this, 'setRecordKey', aRecord.reference(), newRecordKey)); |
613 | deferredResult.callback(); | 596 | deferredResult.callback(); |
614 | 597 | ||
615 | return deferredResult; | 598 | return deferredResult; |
616 | }, | 599 | }, |
617 | 600 | ||
618 | //......................................................................... | 601 | //......................................................................... |
619 | 602 | ||
620 | 'removeNewRecordWithNoChanges': function (aRecord) { | 603 | 'removeNewRecordWithNoChanges': function (aRecord) { |
621 | var deferredResult; | 604 | var deferredResult; |
622 | var recordReference; | 605 | var recordReference; |
623 | 606 | ||
624 | recordReference = aRecord.reference(); | 607 | recordReference = aRecord.reference(); |
625 | 608 | ||
626 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.removeNewRecordWithNoChanges", {trace:false}); | 609 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.removeNewRecordWithNoChanges", {trace:false}); |
627 | 610 | ||
628 | deferredResult.addMethod(this.recordsData(), 'removeValue', this.recordsIndex()[recordReference]); | 611 | deferredResult.addMethod(this.recordsData(), 'removeValue', this.recordsIndex()[recordReference]); |
629 | deferredResult.addCallback(MochiKit.Base.bind(function () { | 612 | deferredResult.addCallback(MochiKit.Base.bind(function () { |
630 | delete this.recordsIndex()[recordReference]; | 613 | delete this.recordsIndex()[recordReference]; |
631 | }, this)); | 614 | }, this)); |
632 | 615 | ||
633 | deferredResult.addMethod(this, 'records'); | 616 | deferredResult.addMethod(this, 'records'); |
634 | deferredResult.addCallback(MochiKit.Base.bind(function (someRecords) { | 617 | deferredResult.addCallback(MochiKit.Base.bind(function (someRecords) { |
635 | delete someRecords[recordReference]; | 618 | delete someRecords[recordReference]; |
636 | }, this)); | 619 | }, this)); |
637 | deferredResult.callback(); | 620 | deferredResult.callback(); |
638 | 621 | ||
639 | return deferredResult; | 622 | return deferredResult; |
640 | }, | 623 | }, |
641 | 624 | ||
642 | //......................................................................... | 625 | //......................................................................... |
643 | 626 | ||
644 | 'prepareRemoteDataForChangedRecords': function () { | 627 | 'prepareRemoteDataForChangedRecords': function () { |
645 | vardeferredResult; | 628 | vardeferredResult; |
646 | varresult; | 629 | varresult; |
647 | 630 | ||
648 | result = {}; | 631 | result = {}; |
649 | 632 | ||
650 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.prepareRemoteDataForChangedRecords", {trace:false}); | 633 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.prepareRemoteDataForChangedRecords", {trace:false}); |
651 | 634 | ||
652 | deferredResult.addMethod(this, 'records'); | 635 | deferredResult.addMethod(this, 'records'); |
653 | deferredResult.addCallback(MochiKit.Base.values); | 636 | deferredResult.addCallback(MochiKit.Base.values); |
654 | deferredResult.addCallback(Clipperz.Async.deferredFilter, MochiKit.Base.methodcaller('isBrandNewWithNoPendingChanges')); | 637 | deferredResult.addCallback(Clipperz.Async.deferredFilter, MochiKit.Base.methodcaller('isBrandNewWithNoPendingChanges')); |
655 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'removeNewRecordWithNoChanges')); | 638 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'removeNewRecordWithNoChanges')); |
656 | 639 | ||
657 | deferredResult.addMethod(this, 'records'); | 640 | deferredResult.addMethod(this, 'records'); |
658 | deferredResult.addCallback(MochiKit.Base.values); | 641 | deferredResult.addCallback(MochiKit.Base.values); |
659 | deferredResult.addCallback(Clipperz.Async.deferredFilter, MochiKit.Base.methodcaller('hasPendingChanges')); | 642 | deferredResult.addCallback(Clipperz.Async.deferredFilter, MochiKit.Base.methodcaller('hasPendingChanges')); |
660 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'updateRecordKeyAndPrepareRemoteData')); | 643 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'updateRecordKeyAndPrepareRemoteData')); |
661 | deferredResult.addCallback(Clipperz.Async.collectAll); | 644 | deferredResult.addCallback(Clipperz.Async.collectAll); |
662 | 645 | ||
663 | deferredResult.addCallback(Clipperz.Async.deferredIf("updated records != null", [ | 646 | deferredResult.addCallback(Clipperz.Async.deferredIf("updated records != null", [ |
664 | MochiKit.Base.operator.identity | 647 | MochiKit.Base.operator.identity |
665 | ], [ | 648 | ], [ |
666 | MochiKit.Base.partial(MochiKit.Async.succeed, []) | 649 | MochiKit.Base.partial(MochiKit.Async.succeed, []) |
667 | ])); | 650 | ])); |
668 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'updated'); | 651 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'updated'); |
669 | 652 | ||
670 | deferredResult.addMethod(this.transientState(), 'getValue', 'deleteRecordsReferences'); | 653 | deferredResult.addMethod(this.transientState(), 'getValue', 'deleteRecordsReferences'); |
671 | deferredResult.addCallback(MochiKit.Base.keys); | 654 | deferredResult.addCallback(MochiKit.Base.keys); |
672 | deferredResult.addCallback(Clipperz.Async.deferredIf("deleted records != null", [ | 655 | deferredResult.addCallback(Clipperz.Async.deferredIf("deleted records != null", [ |
673 | MochiKit.Base.operator.identity | 656 | MochiKit.Base.operator.identity |
674 | ], [ | 657 | ], [ |
675 | MochiKit.Base.partial(MochiKit.Async.succeed, []) | 658 | MochiKit.Base.partial(MochiKit.Async.succeed, []) |
676 | ])); | 659 | ])); |
677 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'deleted'); | 660 | deferredResult.addCallback(Clipperz.Async.setItem, result, 'deleted'); |
678 | 661 | ||
679 | deferredResult.addCallback(MochiKit.Async.succeed, result); | 662 | deferredResult.addCallback(MochiKit.Async.succeed, result); |
680 | deferredResult.callback(); | 663 | deferredResult.callback(); |
681 | 664 | ||
682 | return deferredResult; | 665 | return deferredResult; |
683 | }, | 666 | }, |
684 | 667 | ||
685 | //------------------------------------------------------------------------- | 668 | //------------------------------------------------------------------------- |
686 | __syntaxFix__: "syntax fix" | 669 | __syntaxFix__: "syntax fix" |
687 | }); | 670 | }); |
688 | 671 | ||
689 | 672 | ||
690 | 673 | ||
691 | Clipperz.PM.DataModel.User.Header.RecordIndex.invertIndex = function (anIndex) { | 674 | Clipperz.PM.DataModel.User.Header.RecordIndex.invertIndex = function (anIndex) { |
692 | var result; | 675 | var result; |
693 | var key; | 676 | var key; |
694 | 677 | ||
695 | result = {}; | 678 | result = {}; |
696 | 679 | ||
697 | for (key in anIndex) { | 680 | for (key in anIndex) { |
698 | result[anIndex[key]] = key; | 681 | result[anIndex[key]] = key; |
699 | } | 682 | } |
700 | 683 | ||
701 | return result; | 684 | return result; |
702 | }; \ No newline at end of file | 685 | }; \ 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 index 646ce21..fd18faf 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/User.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.js | |||
@@ -1,612 +1,608 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | 28 | ||
31 | //############################################################################# | 29 | //############################################################################# |
32 | 30 | ||
33 | Clipperz.PM.DataModel.User = function (args) { | 31 | Clipperz.PM.DataModel.User = function (args) { |
34 | args = args || {}; | 32 | args = args || {}; |
35 | 33 | ||
36 | Clipperz.PM.DataModel.User.superclass.constructor.apply(this, arguments); | 34 | Clipperz.PM.DataModel.User.superclass.constructor.apply(this, arguments); |
37 | 35 | ||
38 | this._username = args.username || null; | 36 | this._username = args.username || null; |
39 | this._getPassphraseFunction = args.getPassphraseFunction || null; | 37 | this._getPassphraseFunction = args.getPassphraseFunction || null; |
40 | 38 | ||
41 | this._data = null; | 39 | this._data = null; |
42 | 40 | ||
43 | this._connection = null; | 41 | this._connection = null; |
44 | this._connectionVersion = 'current'; | 42 | this._connectionVersion = 'current'; |
45 | 43 | ||
46 | this._serverData = null; | 44 | this._serverData = null; |
47 | //this._serverLockValue = null; | 45 | //this._serverLockValue = null; |
48 | this._transientState = null; | 46 | this._transientState = null; |
49 | 47 | ||
50 | this._deferredLocks = { | 48 | this._deferredLocks = { |
51 | 'passphrase': new MochiKit.Async.DeferredLock(), | 49 | 'passphrase': new MochiKit.Async.DeferredLock(), |
52 | 'serverData': new MochiKit.Async.DeferredLock(), | 50 | 'serverData': new MochiKit.Async.DeferredLock(), |
53 | // 'recordsIndex': new MochiKit.Async.DeferredLock(), | 51 | // 'recordsIndex': new MochiKit.Async.DeferredLock(), |
54 | // 'directLoginsIndex':new MochiKit.Async.DeferredLock() | 52 | // 'directLoginsIndex':new MochiKit.Async.DeferredLock() |
55 | // 'preferences': new MochiKit.Async.DeferredLock() | 53 | // 'preferences': new MochiKit.Async.DeferredLock() |
56 | // 'oneTimePasswords': new MochiKit.Async.DeferredLock() | 54 | // 'oneTimePasswords': new MochiKit.Async.DeferredLock() |
57 | '__syntaxFix__': 'syntax fix' | 55 | '__syntaxFix__': 'syntax fix' |
58 | }; | 56 | }; |
59 | 57 | ||
60 | return this; | 58 | return this; |
61 | } | 59 | } |
62 | 60 | ||
63 | Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, { | 61 | Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, { |
64 | 62 | ||
65 | 'toString': function () { | 63 | 'toString': function () { |
66 | return "Clipperz.PM.DataModel.User - " + this.username(); | 64 | return "Clipperz.PM.DataModel.User - " + this.username(); |
67 | }, | 65 | }, |
68 | 66 | ||
69 | //------------------------------------------------------------------------- | 67 | //------------------------------------------------------------------------- |
70 | 68 | ||
71 | 'username': function () { | 69 | 'username': function () { |
72 | return this._username; | 70 | return this._username; |
73 | }, | 71 | }, |
74 | 72 | ||
75 | 'setUsername': function (aValue) { | 73 | 'setUsername': function (aValue) { |
76 | this._username = aValue; | 74 | this._username = aValue; |
77 | }, | 75 | }, |
78 | 76 | ||
79 | //------------------------------------------------------------------------- | 77 | //------------------------------------------------------------------------- |
80 | 78 | ||
81 | 'displayName': function() { | 79 | 'displayName': function() { |
82 | return "" + this.username() + ""; | 80 | return "" + this.username() + ""; |
83 | }, | 81 | }, |
84 | 82 | ||
85 | //------------------------------------------------------------------------- | 83 | //------------------------------------------------------------------------- |
86 | 84 | ||
87 | 'data': function () { | 85 | 'data': function () { |
88 | if (this._data == null) { | 86 | if (this._data == null) { |
89 | this._data = new Clipperz.KeyValueObjectStore(/*{'name':'User.data [1]'}*/); | 87 | this._data = new Clipperz.KeyValueObjectStore(/*{'name':'User.data [1]'}*/); |
90 | }; | 88 | }; |
91 | 89 | ||
92 | return this._data; | 90 | return this._data; |
93 | }, | 91 | }, |
94 | 92 | ||
95 | //------------------------------------------------------------------------- | 93 | //------------------------------------------------------------------------- |
96 | /* | 94 | /* |
97 | 'serverLockValue': function () { | 95 | 'serverLockValue': function () { |
98 | return this._serverLockValue; | 96 | return this._serverLockValue; |
99 | }, | 97 | }, |
100 | 98 | ||
101 | 'setServerLockValue': function (aValue) { | 99 | 'setServerLockValue': function (aValue) { |
102 | this._serverLockValue = aValue; | 100 | this._serverLockValue = aValue; |
103 | }, | 101 | }, |
104 | */ | 102 | */ |
105 | //------------------------------------------------------------------------- | 103 | //------------------------------------------------------------------------- |
106 | 104 | ||
107 | 'transientState': function () { | 105 | 'transientState': function () { |
108 | if (this._transientState == null) { | 106 | if (this._transientState == null) { |
109 | this._transientState = {} | 107 | this._transientState = {} |
110 | } | 108 | } |
111 | 109 | ||
112 | return this._transientState; | 110 | return this._transientState; |
113 | }, | 111 | }, |
114 | 112 | ||
115 | 'resetTransientState': function (isCommitting) { | 113 | 'resetTransientState': function (isCommitting) { |
116 | this._transientState = null; | 114 | this._transientState = null; |
117 | }, | 115 | }, |
118 | 116 | ||
119 | //------------------------------------------------------------------------- | 117 | //------------------------------------------------------------------------- |
120 | 118 | ||
121 | 'deferredLockForSection': function(aSectionName) { | 119 | 'deferredLockForSection': function(aSectionName) { |
122 | return this._deferredLocks[aSectionName]; | 120 | return this._deferredLocks[aSectionName]; |
123 | }, | 121 | }, |
124 | 122 | ||
125 | //------------------------------------------------------------------------- | 123 | //------------------------------------------------------------------------- |
126 | 124 | ||
127 | 'getPassphrase': function() { | 125 | 'getPassphrase': function() { |
128 | var deferredResult; | 126 | var deferredResult; |
129 | 127 | ||
130 | deferredResult = new Clipperz.Async.Deferred("User.getPassphrase", {trace:false}); | 128 | deferredResult = new Clipperz.Async.Deferred("User.getPassphrase", {trace:false}); |
131 | deferredResult.acquireLock(this.deferredLockForSection('passphrase')); | 129 | deferredResult.acquireLock(this.deferredLockForSection('passphrase')); |
132 | deferredResult.addMethod(this.data(), 'deferredGetOrSet', 'passphrase', this.getPassphraseFunction()); | 130 | deferredResult.addMethod(this.data(), 'deferredGetOrSet', 'passphrase', this.getPassphraseFunction()); |
133 | deferredResult.releaseLock(this.deferredLockForSection('passphrase')); | 131 | deferredResult.releaseLock(this.deferredLockForSection('passphrase')); |
134 | deferredResult.callback(); | 132 | deferredResult.callback(); |
135 | 133 | ||
136 | return deferredResult; | 134 | return deferredResult; |
137 | }, | 135 | }, |
138 | 136 | ||
139 | 'getPassphraseFunction': function () { | 137 | 'getPassphraseFunction': function () { |
140 | return this._getPassphraseFunction; | 138 | return this._getPassphraseFunction; |
141 | }, | 139 | }, |
142 | 140 | ||
143 | //------------------------------------------------------------------------- | 141 | //------------------------------------------------------------------------- |
144 | 142 | ||
145 | 'getCredentials': function () { | 143 | 'getCredentials': function () { |
146 | return Clipperz.Async.collectResults("User; get username and passphrase", { | 144 | return Clipperz.Async.collectResults("User; get username and passphrase", { |
147 | 'username': MochiKit.Base.method(this, 'username'), | 145 | 'username': MochiKit.Base.method(this, 'username'), |
148 | 'password': MochiKit.Base.method(this, 'getPassphrase') | 146 | 'password': MochiKit.Base.method(this, 'getPassphrase') |
149 | }, {trace:false})(); | 147 | }, {trace:false})(); |
150 | }, | 148 | }, |
151 | 149 | ||
152 | //------------------------------------------------------------------------- | 150 | //------------------------------------------------------------------------- |
153 | 151 | ||
154 | 'changePassphrase': function (aNewValue) { | 152 | 'changePassphrase': function (aNewValue) { |
155 | return this.updateCredentials(this.username(), aNewValue); | 153 | return this.updateCredentials(this.username(), aNewValue); |
156 | }, | 154 | }, |
157 | 155 | ||
158 | //......................................................................... | 156 | //......................................................................... |
159 | 157 | ||
160 | 'updateCredentials': function (aUsername, aPassphrase) { | 158 | 'updateCredentials': function (aUsername, aPassphrase) { |
161 | vardeferredResult; | 159 | vardeferredResult; |
162 | 160 | ||
163 | deferredResult = new Clipperz.Async.Deferred("User.updateCredentials", {trace:false}); | 161 | deferredResult = new Clipperz.Async.Deferred("User.updateCredentials", {trace:false}); |
164 | // deferredResult.addMethod(this, 'getPassphrase'); | 162 | // deferredResult.addMethod(this, 'getPassphrase'); |
165 | // deferredResult.setValue('currentPassphrase'); | 163 | // deferredResult.setValue('currentPassphrase'); |
166 | deferredResult.addMethod(this.connection(), 'ping'); | 164 | deferredResult.addMethod(this.connection(), 'ping'); |
167 | deferredResult.addMethod(this, 'setUsername', aUsername) | 165 | deferredResult.addMethod(this, 'setUsername', aUsername) |
168 | deferredResult.acquireLock(this.deferredLockForSection('passphrase')); | 166 | deferredResult.acquireLock(this.deferredLockForSection('passphrase')); |
169 | deferredResult.addMethod(this.data(), 'deferredGetOrSet', 'passphrase', aPassphrase); | 167 | deferredResult.addMethod(this.data(), 'deferredGetOrSet', 'passphrase', aPassphrase); |
170 | deferredResult.releaseLock(this.deferredLockForSection('passphrase')); | 168 | deferredResult.releaseLock(this.deferredLockForSection('passphrase')); |
171 | // deferredResult.getValue('currentPassphrase'); | 169 | // deferredResult.getValue('currentPassphrase'); |
172 | deferredResult.addMethod(this, 'prepareRemoteDataWithKey', aPassphrase); | 170 | deferredResult.addMethod(this, 'prepareRemoteDataWithKey', aPassphrase); |
173 | deferredResult.addMethod(this.connection(), 'updateCredentials', aUsername, aPassphrase); | 171 | deferredResult.addMethod(this.connection(), 'updateCredentials', aUsername, aPassphrase); |
174 | deferredResult.callback(); | 172 | deferredResult.callback(); |
175 | 173 | ||
176 | return deferredResult; | 174 | return deferredResult; |
177 | }, | 175 | }, |
178 | 176 | ||
179 | //------------------------------------------------------------------------- | 177 | //------------------------------------------------------------------------- |
180 | 178 | ||
181 | 'initialSetupWithNoData': function () { | 179 | 'initialSetupWithNoData': function () { |
182 | this._serverData = { | 180 | this._serverData = { |
183 | 'version': '0.1', | 181 | 'version': '0.1', |
184 | 'statistics': "", | 182 | 'statistics': "", |
185 | 'header': { | 183 | 'header': { |
186 | 'data': null, | 184 | 'data': null, |
187 | 'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion, | 185 | 'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion, |
188 | 186 | ||
189 | 'recordsIndex': new Clipperz.PM.DataModel.User.Header.RecordIndex({ | 187 | 'recordsIndex': new Clipperz.PM.DataModel.User.Header.RecordIndex({ |
190 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), | 188 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), |
191 | 'recordsData': {'data':null, 'index':{}}, | 189 | 'recordsData': {'data':null, 'index':{}}, |
192 | 'recordsStats': null, | 190 | 'recordsStats': null, |
193 | 'directLoginsData': {'data':null, 'index':{}}, | 191 | 'directLoginsData': {'data':null, 'index':{}}, |
194 | 'encryptedDataVersion': Clipperz.PM.Crypto.encryptingFunctions.currentVersion, | 192 | 'encryptedDataVersion': Clipperz.PM.Crypto.encryptingFunctions.currentVersion, |
195 | 'retrieveRecordDetailFunction':MochiKit.Base.method(this, 'getRecordDetail') | 193 | 'retrieveRecordDetailFunction':MochiKit.Base.method(this, 'getRecordDetail') |
196 | }), | 194 | }), |
197 | 'preferences': new Clipperz.PM.DataModel.User.Header.Preferences({ | 195 | 'preferences': new Clipperz.PM.DataModel.User.Header.Preferences({ |
198 | 'name':'preferences', | 196 | 'name':'preferences', |
199 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase') | 197 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase') |
200 | }), | 198 | }), |
201 | 'oneTimePasswords': new Clipperz.PM.DataModel.User.Header.OneTimePasswords({ | 199 | 'oneTimePasswords': new Clipperz.PM.DataModel.User.Header.OneTimePasswords({ |
202 | 'name':'preferences', | 200 | 'name':'preferences', |
203 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase') | 201 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase') |
204 | }) | 202 | }) |
205 | } | 203 | } |
206 | }; | 204 | }; |
207 | 205 | ||
208 | // this._serverLockValue = Clipperz.PM.Crypto.randomKey(); | 206 | // this._serverLockValue = Clipperz.PM.Crypto.randomKey(); |
209 | }, | 207 | }, |
210 | 208 | ||
211 | //......................................................................... | 209 | //......................................................................... |
212 | 210 | ||
213 | 'registerAsNewAccount': function () { | 211 | 'registerAsNewAccount': function () { |
214 | var deferredResult; | 212 | var deferredResult; |
215 | 213 | ||
216 | deferredResult = new Clipperz.Async.Deferred("User.registerAsNewAccount", {trace:false}); | 214 | deferredResult = new Clipperz.Async.Deferred("User.registerAsNewAccount", {trace:false}); |
217 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'updateProgress', {'extraSteps':3}); | 215 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'updateProgress', {'extraSteps':3}); |
218 | deferredResult.addMethod(this, 'initialSetupWithNoData') | 216 | deferredResult.addMethod(this, 'initialSetupWithNoData') |
219 | deferredResult.addMethod(this, 'getPassphrase'); | 217 | deferredResult.addMethod(this, 'getPassphrase'); |
220 | deferredResult.addMethod(this, 'prepareRemoteDataWithKey'); | 218 | deferredResult.addMethod(this, 'prepareRemoteDataWithKey'); |
221 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); | 219 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); |
222 | deferredResult.addMethod(this.connection(), 'register'); | 220 | deferredResult.addMethod(this.connection(), 'register'); |
223 | // deferredResult.addCallback(MochiKit.Base.itemgetter('lock')); | 221 | // deferredResult.addCallback(MochiKit.Base.itemgetter('lock')); |
224 | // deferredResult.addMethod(this, 'setServerLockValue'); | 222 | // deferredResult.addMethod(this, 'setServerLockValue'); |
225 | deferredResult.addCallbackPass(MochiKit.Signal.signal,Clipperz.Signal.NotificationCenter, 'userSuccessfullyRegistered'); | 223 | deferredResult.addCallbackPass(MochiKit.Signal.signal,Clipperz.Signal.NotificationCenter, 'userSuccessfullyRegistered'); |
226 | 224 | ||
227 | // deferredResult.addErrback (MochiKit.Base.method(this, 'handleRegistrationFailure')); | 225 | // deferredResult.addErrback (MochiKit.Base.method(this, 'handleRegistrationFailure')); |
228 | 226 | ||
229 | deferredResult.callback(); | 227 | deferredResult.callback(); |
230 | 228 | ||
231 | return deferredResult; | 229 | return deferredResult; |
232 | }, | 230 | }, |
233 | 231 | ||
234 | //------------------------------------------------------------------------- | 232 | //------------------------------------------------------------------------- |
235 | 233 | ||
236 | 'login': function () { | 234 | 'login': function () { |
237 | var deferredResult; | 235 | var deferredResult; |
238 | 236 | ||
239 | deferredResult = new Clipperz.Async.Deferred("User.login", {trace:false}); | 237 | deferredResult = new Clipperz.Async.Deferred("User.login", {trace:false}); |
240 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'updateProgress', {'extraSteps':3}); | 238 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'updateProgress', {'extraSteps':3}); |
241 | deferredResult.addMethod(this, 'getPassphrase'); | 239 | deferredResult.addMethod(this, 'getPassphrase'); |
242 | deferredResult.addCallback(Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue); | 240 | deferredResult.addCallback(Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue); |
243 | deferredResult.addCallback(Clipperz.Async.deferredIf("Is the passphrase an OTP", [ | 241 | deferredResult.addCallback(Clipperz.Async.deferredIf("Is the passphrase an OTP", [ |
244 | MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'updateProgress', {'extraSteps':1}), | 242 | MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'updateProgress', {'extraSteps':1}), |
245 | MochiKit.Base.method(this, 'getCredentials'), | 243 | MochiKit.Base.method(this, 'getCredentials'), |
246 | MochiKit.Base.method(this.connection(), 'redeemOneTimePassword'), | 244 | MochiKit.Base.method(this.connection(), 'redeemOneTimePassword'), |
247 | MochiKit.Base.method(this.data(), 'setValue', 'passphrase') | 245 | MochiKit.Base.method(this.data(), 'setValue', 'passphrase') |
248 | ], [])); | 246 | ], [])); |
249 | deferredResult.addErrback(MochiKit.Base.method(this, 'getPassphrase')); | 247 | deferredResult.addErrback(MochiKit.Base.method(this, 'getPassphrase')); |
250 | deferredResult.addMethod(this.connection(), 'login', false); | 248 | deferredResult.addMethod(this.connection(), 'login', false); |
251 | deferredResult.addCallbackPass(MochiKit.Signal.signal,Clipperz.Signal.NotificationCenter, 'userSuccessfullyLoggedIn'); | 249 | deferredResult.addCallbackPass(MochiKit.Signal.signal,Clipperz.Signal.NotificationCenter, 'userSuccessfullyLoggedIn'); |
252 | deferredResult.addErrback (MochiKit.Base.method(this, 'handleConnectionFallback')); | 250 | deferredResult.addErrback (MochiKit.Base.method(this, 'handleConnectionFallback')); |
253 | 251 | ||
254 | deferredResult.callback(); | 252 | deferredResult.callback(); |
255 | 253 | ||
256 | return deferredResult; | 254 | return deferredResult; |
257 | }, | 255 | }, |
258 | 256 | ||
259 | //......................................................................... | 257 | //......................................................................... |
260 | 258 | ||
261 | 'handleConnectionFallback': function(aValue) { | 259 | 'handleConnectionFallback': function(aValue) { |
262 | var result; | 260 | var result; |
263 | 261 | ||
264 | if (aValue instanceof MochiKit.Async.CancelledError) { | 262 | if (aValue instanceof MochiKit.Async.CancelledError) { |
265 | result = aValue; | 263 | result = aValue; |
266 | } else { | 264 | } else { |
267 | this.setConnectionVersion(Clipperz.PM.Connection.communicationProtocol.fallbackVersions[this.connectionVersion()]); | 265 | this.setConnectionVersion(Clipperz.PM.Connection.communicationProtocol.fallbackVersions[this.connectionVersion()]); |
268 | 266 | ||
269 | if (this.connectionVersion() != null) { | 267 | if (this.connectionVersion() != null) { |
270 | result = new Clipperz.Async.Deferred("User.handleConnectionFallback - retry"); | 268 | result = new Clipperz.Async.Deferred("User.handleConnectionFallback - retry"); |
271 | 269 | ||
272 | result.addMethod(this, 'login'); | 270 | result.addMethod(this, 'login'); |
273 | result.callback(); | 271 | result.callback(); |
274 | } else { | 272 | } else { |
275 | result = Clipperz.Async.callbacks("User.handleConnectionFallback - failed", [ | 273 | result = Clipperz.Async.callbacks("User.handleConnectionFallback - failed", [ |
276 | MochiKit.Base.method(this.data(), 'removeValue', 'passphrase'), | 274 | MochiKit.Base.method(this.data(), 'removeValue', 'passphrase'), |
277 | MochiKit.Base.method(this, 'setConnectionVersion', 'current'), | 275 | MochiKit.Base.method(this, 'setConnectionVersion', 'current'), |
278 | MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'userLoginFailed'), | 276 | MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'userLoginFailed'), |
279 | MochiKit.Base.partial(MochiKit.Async.fail, Clipperz.PM.DataModel.User.exception.LoginFailed) | 277 | MochiKit.Base.partial(MochiKit.Async.fail, Clipperz.PM.DataModel.User.exception.LoginFailed) |
280 | ], {trace:false}); | 278 | ], {trace:false}); |
281 | } | 279 | } |
282 | } | 280 | } |
283 | 281 | ||
284 | return result; | 282 | return result; |
285 | }, | 283 | }, |
286 | 284 | ||
287 | //------------------------------------------------------------------------- | 285 | //------------------------------------------------------------------------- |
288 | 286 | ||
289 | 'lock': function () { | 287 | 'lock': function () { |
290 | return Clipperz.Async.callbacks("User.lock", [ | 288 | return Clipperz.Async.callbacks("User.lock", [ |
291 | MochiKit.Base.method(this, 'deleteAllCleanTextData') | 289 | MochiKit.Base.method(this, 'deleteAllCleanTextData') |
292 | ], {trace:false}); | 290 | ], {trace:false}); |
293 | }, | 291 | }, |
294 | 292 | ||
295 | //------------------------------------------------------------------------- | 293 | //------------------------------------------------------------------------- |
296 | 294 | ||
297 | 'logout': function () { | 295 | 'logout': function () { |
298 | return Clipperz.Async.callbacks("User.logout", [ | 296 | return Clipperz.Async.callbacks("User.logout", [ |
299 | MochiKit.Base.method(this, 'deleteAllCleanTextData'), | 297 | MochiKit.Base.method(this, 'deleteAllCleanTextData'), |
300 | MochiKit.Base.method(this.connection(), 'logout') | 298 | MochiKit.Base.method(this.connection(), 'logout') |
301 | ], {trace:false}); | 299 | ], {trace:false}); |
302 | }, | 300 | }, |
303 | 301 | ||
304 | //------------------------------------------------------------------------- | 302 | //------------------------------------------------------------------------- |
305 | 303 | ||
306 | 'headerFormatVersion': function(anHeader) { | 304 | 'headerFormatVersion': function(anHeader) { |
307 | var result; | 305 | var result; |
308 | 306 | ||
309 | if (anHeader.charAt(0) == '{') { | 307 | if (anHeader.charAt(0) == '{') { |
310 | varheaderData; | 308 | varheaderData; |
311 | 309 | ||
312 | headerData = Clipperz.Base.evalJSON(anHeader); | 310 | headerData = Clipperz.Base.evalJSON(anHeader); |
313 | result = headerData['version']; | 311 | result = headerData['version']; |
314 | } else { | 312 | } else { |
315 | result = 'LEGACY'; | 313 | result = 'LEGACY'; |
316 | } | 314 | } |
317 | 315 | ||
318 | return result; | 316 | return result; |
319 | }, | 317 | }, |
320 | 318 | ||
321 | //------------------------------------------------------------------------- | 319 | //------------------------------------------------------------------------- |
322 | 320 | ||
323 | 'unpackServerData': function (someServerData) { | 321 | 'unpackServerData': function (someServerData) { |
324 | var unpackedData; | 322 | var unpackedData; |
325 | var headerVersion; | 323 | var headerVersion; |
326 | 324 | ||
327 | varrecordsIndex; | 325 | varrecordsIndex; |
328 | var preferences; | 326 | var preferences; |
329 | var oneTimePasswords; | 327 | var oneTimePasswords; |
330 | 328 | ||
331 | //console.log(">>> ***************** user.unpackServerData", someServerData); | ||
332 | // this.setServerLockValue(someServerData['lock']); | 329 | // this.setServerLockValue(someServerData['lock']); |
333 | 330 | ||
334 | headerVersion = this.headerFormatVersion(someServerData['header']); | 331 | headerVersion = this.headerFormatVersion(someServerData['header']); |
335 | 332 | ||
336 | switch (headerVersion) { | 333 | switch (headerVersion) { |
337 | case 'LEGACY': | 334 | case 'LEGACY': |
338 | varlegacyHeader; | 335 | varlegacyHeader; |
339 | 336 | ||
340 | legacyHeader = new Clipperz.PM.DataModel.User.Header.Legacy({ | 337 | legacyHeader = new Clipperz.PM.DataModel.User.Header.Legacy({ |
341 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), | 338 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), |
342 | 'remoteData': { | 339 | 'remoteData': { |
343 | 'data': someServerData['header'], | 340 | 'data': someServerData['header'], |
344 | 'version': someServerData['version'], | 341 | 'version': someServerData['version'], |
345 | 'recordsStats': someServerData['recordsStats'] | 342 | 'recordsStats': someServerData['recordsStats'] |
346 | }, | 343 | }, |
347 | // 'encryptedDataKeypath': 'data', | 344 | // 'encryptedDataKeypath': 'data', |
348 | // 'encryptedVersionKeypath': 'version', | 345 | // 'encryptedVersionKeypath': 'version', |
349 | 'retrieveRecordDetailFunction':MochiKit.Base.method(this, 'getRecordDetail') | 346 | 'retrieveRecordDetailFunction':MochiKit.Base.method(this, 'getRecordDetail') |
350 | }); | 347 | }); |
351 | 348 | ||
352 | recordsIndex = legacyHeader; | 349 | recordsIndex = legacyHeader; |
353 | preferences = legacyHeader; | 350 | preferences = legacyHeader; |
354 | oneTimePasswords= legacyHeader; | 351 | oneTimePasswords= legacyHeader; |
355 | break; | 352 | break; |
356 | case '0.1': | 353 | case '0.1': |
357 | varheaderData; | 354 | varheaderData; |
358 | 355 | ||
359 | headerData = Clipperz.Base.evalJSON(someServerData['header']); | 356 | headerData = Clipperz.Base.evalJSON(someServerData['header']); |
360 | 357 | ||
361 | recordsIndex = new Clipperz.PM.DataModel.User.Header.RecordIndex({ | 358 | recordsIndex = new Clipperz.PM.DataModel.User.Header.RecordIndex({ |
362 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), | 359 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), |
363 | 'recordsData': headerData['records'], | 360 | 'recordsData': headerData['records'], |
364 | 'recordsStats': someServerData['recordsStats'], | 361 | 'recordsStats': someServerData['recordsStats'], |
365 | 'directLoginsData': headerData['directLogins'], | 362 | 'directLoginsData': headerData['directLogins'], |
366 | 'encryptedDataVersion': someServerData['version'], | 363 | 'encryptedDataVersion': someServerData['version'], |
367 | 'retrieveRecordDetailFunction':MochiKit.Base.method(this, 'getRecordDetail') | 364 | 'retrieveRecordDetailFunction':MochiKit.Base.method(this, 'getRecordDetail') |
368 | }); | 365 | }); |
369 | 366 | ||
370 | //Still missing a test case that actually fais with the old version of the code, where the check for undefined was missing | 367 | //Still missing a test case that actually fais with the old version of the code, where the check for undefined was missing |
371 | if (typeof(headerData['preferences']) != 'undefined') { | 368 | if (typeof(headerData['preferences']) != 'undefined') { |
372 | preferences= new Clipperz.PM.DataModel.User.Header.Preferences({ | 369 | preferences= new Clipperz.PM.DataModel.User.Header.Preferences({ |
373 | 'name':'preferences', | 370 | 'name':'preferences', |
374 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), | 371 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), |
375 | 'remoteData': { | 372 | 'remoteData': { |
376 | 'data': headerData['preferences']['data'], | 373 | 'data': headerData['preferences']['data'], |
377 | 'version': someServerData['version'] | 374 | 'version': someServerData['version'] |
378 | } | 375 | } |
379 | }); | 376 | }); |
380 | } else { | 377 | } else { |
381 | preferences= new Clipperz.PM.DataModel.User.Header.Preferences({ | 378 | preferences= new Clipperz.PM.DataModel.User.Header.Preferences({ |
382 | 'name':'preferences', | 379 | 'name':'preferences', |
383 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase') | 380 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase') |
384 | }); | 381 | }); |
385 | } | 382 | } |
386 | 383 | ||
387 | if (typeof(headerData['oneTimePasswords']) != 'undefined') { | 384 | if (typeof(headerData['oneTimePasswords']) != 'undefined') { |
388 | oneTimePasswords = new Clipperz.PM.DataModel.User.Header.OneTimePasswords({ | 385 | oneTimePasswords = new Clipperz.PM.DataModel.User.Header.OneTimePasswords({ |
389 | 'name':'preferences', | 386 | 'name':'preferences', |
390 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), | 387 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'), |
391 | 'remoteData': { | 388 | 'remoteData': { |
392 | 'data': headerData['oneTimePasswords']['data'], | 389 | 'data': headerData['oneTimePasswords']['data'], |
393 | 'version': someServerData['version'] | 390 | 'version': someServerData['version'] |
394 | } | 391 | } |
395 | }); | 392 | }); |
396 | } else { | 393 | } else { |
397 | oneTimePasswords = new Clipperz.PM.DataModel.User.Header.OneTimePasswords({ | 394 | oneTimePasswords = new Clipperz.PM.DataModel.User.Header.OneTimePasswords({ |
398 | 'name':'preferences', | 395 | 'name':'preferences', |
399 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase') | 396 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase') |
400 | }); | 397 | }); |
401 | } | 398 | } |
402 | 399 | ||
403 | break; | 400 | break; |
404 | } | 401 | } |
405 | 402 | ||
406 | unpackedData = { | 403 | unpackedData = { |
407 | 'version': someServerData['version'], | 404 | 'version': someServerData['version'], |
408 | 'statistics': someServerData['statistics'], | 405 | 'statistics': someServerData['statistics'], |
409 | 'header': { | 406 | 'header': { |
410 | 'data': someServerData['header'], | 407 | 'data': someServerData['header'], |
411 | 'version': headerVersion, | 408 | 'version': headerVersion, |
412 | 409 | ||
413 | 'recordsIndex': recordsIndex, | 410 | 'recordsIndex': recordsIndex, |
414 | 'preferences': preferences, | 411 | 'preferences': preferences, |
415 | 'oneTimePasswords': oneTimePasswords | 412 | 'oneTimePasswords': oneTimePasswords |
416 | } | 413 | } |
417 | }; | 414 | }; |
418 | 415 | ||
419 | this._serverData = unpackedData; | 416 | this._serverData = unpackedData; |
420 | //console.log("<<< ***************** user.unpackServerData", this._serverData); | ||
421 | 417 | ||
422 | return this._serverData; | 418 | return this._serverData; |
423 | }, | 419 | }, |
424 | 420 | ||
425 | //------------------------------------------------------------------------- | 421 | //------------------------------------------------------------------------- |
426 | 422 | ||
427 | 'getServerData': function() { | 423 | 'getServerData': function() { |
428 | var deferredResult; | 424 | var deferredResult; |
429 | 425 | ||
430 | deferredResult = new Clipperz.Async.Deferred("User.getServerData", {trace:false}); | 426 | deferredResult = new Clipperz.Async.Deferred("User.getServerData", {trace:false}); |
431 | deferredResult.acquireLock(this.deferredLockForSection('serverData')); | 427 | deferredResult.acquireLock(this.deferredLockForSection('serverData')); |
432 | deferredResult.addCallback(MochiKit.Base.bind(function(aResult) { | 428 | deferredResult.addCallback(MochiKit.Base.bind(function(aResult) { |
433 | var innerDeferredResult; | 429 | var innerDeferredResult; |
434 | 430 | ||
435 | innerDeferredResult = new Clipperz.Async.Deferred("User.getUserDetails.innerDeferred", {trace:false}); | 431 | innerDeferredResult = new Clipperz.Async.Deferred("User.getUserDetails.innerDeferred", {trace:false}); |
436 | if (this._serverData == null) { | 432 | if (this._serverData == null) { |
437 | innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'loadingUserDetails'); | 433 | innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'loadingUserDetails'); |
438 | innerDeferredResult.addMethod(this.connection(), 'message', 'getUserDetails'); | 434 | innerDeferredResult.addMethod(this.connection(), 'message', 'getUserDetails'); |
439 | innerDeferredResult.addMethod(this, 'unpackServerData'); | 435 | innerDeferredResult.addMethod(this, 'unpackServerData'); |
440 | innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'loadedUserDetails'); | 436 | innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'loadedUserDetails'); |
441 | } | 437 | } |
442 | 438 | ||
443 | innerDeferredResult.addCallback(MochiKit.Base.bind(function () { | 439 | innerDeferredResult.addCallback(MochiKit.Base.bind(function () { |
444 | return this._serverData; | 440 | return this._serverData; |
445 | },this)); | 441 | },this)); |
446 | innerDeferredResult.callback(); | 442 | innerDeferredResult.callback(); |
447 | 443 | ||
448 | return innerDeferredResult; | 444 | return innerDeferredResult; |
449 | }, this)); | 445 | }, this)); |
450 | deferredResult.releaseLock(this.deferredLockForSection('serverData')); | 446 | deferredResult.releaseLock(this.deferredLockForSection('serverData')); |
451 | deferredResult.callback(); | 447 | deferredResult.callback(); |
452 | 448 | ||
453 | return deferredResult; | 449 | return deferredResult; |
454 | }, | 450 | }, |
455 | 451 | ||
456 | //------------------------------------------------------------------------- | 452 | //------------------------------------------------------------------------- |
457 | 453 | ||
458 | 'connectionVersion': function() { | 454 | 'connectionVersion': function() { |
459 | return this._connectionVersion; | 455 | return this._connectionVersion; |
460 | }, | 456 | }, |
461 | 457 | ||
462 | 'setConnectionVersion': function(aValue) { | 458 | 'setConnectionVersion': function(aValue) { |
463 | if (this._connectionVersion != aValue) { | 459 | if (this._connectionVersion != aValue) { |
464 | this.resetConnection(); | 460 | this.resetConnection(); |
465 | } | 461 | } |
466 | this._connectionVersion = aValue; | 462 | this._connectionVersion = aValue; |
467 | }, | 463 | }, |
468 | 464 | ||
469 | //------------------------------------------------------------------------- | 465 | //------------------------------------------------------------------------- |
470 | 466 | ||
471 | 'connection': function() { | 467 | 'connection': function() { |
472 | if ((this._connection == null) && (this.connectionVersion() != null) ){ | 468 | if ((this._connection == null) && (this.connectionVersion() != null) ){ |
473 | this._connection = new Clipperz.PM.Connection.communicationProtocol.versions[this.connectionVersion()]({ | 469 | this._connection = new Clipperz.PM.Connection.communicationProtocol.versions[this.connectionVersion()]({ |
474 | getCredentialsFunction: MochiKit.Base.method(this, 'getCredentials') | 470 | getCredentialsFunction: MochiKit.Base.method(this, 'getCredentials') |
475 | }); | 471 | }); |
476 | } | 472 | } |
477 | 473 | ||
478 | return this._connection; | 474 | return this._connection; |
479 | }, | 475 | }, |
480 | 476 | ||
481 | 'resetConnection': function(aValue) { | 477 | 'resetConnection': function(aValue) { |
482 | if (this._connection != null) { | 478 | if (this._connection != null) { |
483 | this._connection.reset(); | 479 | this._connection.reset(); |
484 | } | 480 | } |
485 | 481 | ||
486 | this._connection = null; | 482 | this._connection = null; |
487 | }, | 483 | }, |
488 | 484 | ||
489 | //========================================================================= | 485 | //========================================================================= |
490 | 486 | ||
491 | 'getHeaderIndex': function (aKey) { | 487 | 'getHeaderIndex': function (aKey) { |
492 | return Clipperz.Async.callbacks("User.getHeaderIndex", [ | 488 | return Clipperz.Async.callbacks("User.getHeaderIndex", [ |
493 | MochiKit.Base.method(this, 'getServerData'), | 489 | MochiKit.Base.method(this, 'getServerData'), |
494 | MochiKit.Base.itemgetter('header'), | 490 | MochiKit.Base.itemgetter('header'), |
495 | MochiKit.Base.itemgetter(aKey) | 491 | MochiKit.Base.itemgetter(aKey) |
496 | ], {trace:false}) | 492 | ], {trace:false}) |
497 | }, | 493 | }, |
498 | 494 | ||
499 | //========================================================================= | 495 | //========================================================================= |
500 | 496 | ||
501 | 'getRecords': function () { | 497 | 'getRecords': function () { |
502 | return Clipperz.Async.callbacks("User.getRecords", [ | 498 | return Clipperz.Async.callbacks("User.getRecords", [ |
503 | MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'), | 499 | MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'), |
504 | MochiKit.Base.methodcaller('records'), | 500 | MochiKit.Base.methodcaller('records'), |
505 | MochiKit.Base.values | 501 | MochiKit.Base.values |
506 | ], {trace:false}); | 502 | ], {trace:false}); |
507 | }, | 503 | }, |
508 | 504 | ||
509 | 'recordWithLabel': function (aLabel) { | 505 | 'recordWithLabel': function (aLabel) { |
510 | return Clipperz.Async.callbacks("User.recordWithLabel", [ | 506 | return Clipperz.Async.callbacks("User.recordWithLabel", [ |
511 | MochiKit.Base.method(this, 'getRecords'), | 507 | MochiKit.Base.method(this, 'getRecords'), |
512 | MochiKit.Base.partial(Clipperz.Async.deferredFilter, function (aRecord) { | 508 | MochiKit.Base.partial(Clipperz.Async.deferredFilter, function (aRecord) { |
513 | return Clipperz.Async.callbacks("User.recordWithLabel - check record label", [ | 509 | return Clipperz.Async.callbacks("User.recordWithLabel - check record label", [ |
514 | MochiKit.Base.methodcaller('label'), | 510 | MochiKit.Base.methodcaller('label'), |
515 | MochiKit.Base.partial(MochiKit.Base.operator.eq, aLabel) | 511 | MochiKit.Base.partial(MochiKit.Base.operator.eq, aLabel) |
516 | ], {trace:false}, aRecord); | 512 | ], {trace:false}, aRecord); |
517 | }), | 513 | }), |
518 | function (someFilteredResults) { | 514 | function (someFilteredResults) { |
519 | var result; | 515 | var result; |
520 | 516 | ||
521 | switch (someFilteredResults.length) { | 517 | switch (someFilteredResults.length) { |
522 | case 0: | 518 | case 0: |
523 | result = null; | 519 | result = null; |
524 | break; | 520 | break; |
525 | case 1: | 521 | case 1: |
526 | result = someFilteredResults[0]; | 522 | result = someFilteredResults[0]; |
527 | break; | 523 | break; |
528 | default: | 524 | default: |
529 | WTF = TODO; | 525 | WTF = TODO; |
530 | break; | 526 | break; |
531 | } | 527 | } |
532 | 528 | ||
533 | return result; | 529 | return result; |
534 | } | 530 | } |
535 | ], {trace:false}); | 531 | ], {trace:false}); |
536 | }, | 532 | }, |
537 | 533 | ||
538 | //------------------------------------------------------------------------- | 534 | //------------------------------------------------------------------------- |
539 | 535 | ||
540 | 'getRecord': function (aRecordReference) { | 536 | 'getRecord': function (aRecordReference) { |
541 | return Clipperz.Async.callbacks("User.getRecord", [ | 537 | return Clipperz.Async.callbacks("User.getRecord", [ |
542 | MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'), | 538 | MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'), |
543 | MochiKit.Base.methodcaller('records'), | 539 | MochiKit.Base.methodcaller('records'), |
544 | MochiKit.Base.itemgetter(aRecordReference), | 540 | MochiKit.Base.itemgetter(aRecordReference), |
545 | 541 | ||
546 | Clipperz.Async.deferredIf("record != null", [ | 542 | Clipperz.Async.deferredIf("record != null", [ |
547 | MochiKit.Base.operator.identity | 543 | MochiKit.Base.operator.identity |
548 | ], [ | 544 | ], [ |
549 | function () { throw "Record does not exists"} | 545 | function () { throw "Record does not exists"} |
550 | ]) | 546 | ]) |
551 | ], {trace:false}); | 547 | ], {trace:false}); |
552 | }, | 548 | }, |
553 | 549 | ||
554 | //------------------------------------------------------------------------- | 550 | //------------------------------------------------------------------------- |
555 | 551 | ||
556 | 'getRecordDetail': function (aRecordReference) { | 552 | 'getRecordDetail': function (aRecordReference) { |
557 | return this.connection().message('getRecordDetail', {reference: aRecordReference}); | 553 | return this.connection().message('getRecordDetail', {reference: aRecordReference}); |
558 | }, | 554 | }, |
559 | 555 | ||
560 | //------------------------------------------------------------------------- | 556 | //------------------------------------------------------------------------- |
561 | 557 | ||
562 | 'deleteRecord': function (aRecord) { | 558 | 'deleteRecord': function (aRecord) { |
563 | return Clipperz.Async.callbacks("User.deleteRecord", [ | 559 | return Clipperz.Async.callbacks("User.deleteRecord", [ |
564 | MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'), | 560 | MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'), |
565 | MochiKit.Base.methodcaller('deleteRecord', aRecord) | 561 | MochiKit.Base.methodcaller('deleteRecord', aRecord) |
566 | ], {trace:false}); | 562 | ], {trace:false}); |
567 | }, | 563 | }, |
568 | 564 | ||
569 | //------------------------------------------------------------------------- | 565 | //------------------------------------------------------------------------- |
570 | 566 | ||
571 | 'createNewRecord': function () { | 567 | 'createNewRecord': function () { |
572 | return Clipperz.Async.callbacks("User.createNewRecord", [ | 568 | return Clipperz.Async.callbacks("User.createNewRecord", [ |
573 | MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'), | 569 | MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'), |
574 | MochiKit.Base.methodcaller('createNewRecord') | 570 | MochiKit.Base.methodcaller('createNewRecord') |
575 | ], {trace:false}); | 571 | ], {trace:false}); |
576 | }, | 572 | }, |
577 | 573 | ||
578 | //========================================================================= | 574 | //========================================================================= |
579 | 575 | ||
580 | 'getDirectLogins': function() { | 576 | 'getDirectLogins': function() { |
581 | var deferredResult; | 577 | var deferredResult; |
582 | 578 | ||
583 | deferredResult = new Clipperz.Async.Deferred("User.getDirectLogins", {trace:false}); | 579 | deferredResult = new Clipperz.Async.Deferred("User.getDirectLogins", {trace:false}); |
584 | deferredResult.addMethod(this, 'getRecords'); | 580 | deferredResult.addMethod(this, 'getRecords'); |
585 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.compose(MochiKit.Base.values, MochiKit.Base.methodcaller('directLogins'))); | 581 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.compose(MochiKit.Base.values, MochiKit.Base.methodcaller('directLogins'))); |
586 | deferredResult.addCallback(MochiKit.Base.flattenArray); | 582 | deferredResult.addCallback(MochiKit.Base.flattenArray); |
587 | deferredResult.callback(); | 583 | deferredResult.callback(); |
588 | 584 | ||
589 | return deferredResult; | 585 | return deferredResult; |
590 | }, | 586 | }, |
591 | 587 | ||
592 | //========================================================================= | 588 | //========================================================================= |
593 | 589 | ||
594 | 'getOneTimePasswords': function () { | 590 | 'getOneTimePasswords': function () { |
595 | return Clipperz.Async.callbacks("User.getOneTimePasswords", [ | 591 | return Clipperz.Async.callbacks("User.getOneTimePasswords", [ |
596 | MochiKit.Base.method(this, 'getHeaderIndex', 'oneTimePasswords'), | 592 | MochiKit.Base.method(this, 'getHeaderIndex', 'oneTimePasswords'), |
597 | MochiKit.Base.methodcaller('oneTimePasswords'), | 593 | MochiKit.Base.methodcaller('oneTimePasswords'), |
598 | MochiKit.Base.values | 594 | MochiKit.Base.values |
599 | ], {trace:false}); | 595 | ], {trace:false}); |
600 | }, | 596 | }, |
601 | 597 | ||
602 | //========================================================================= | 598 | //========================================================================= |
603 | 599 | ||
604 | 'invokeMethodNamedOnHeader': function (aMethodName, aValue) { | 600 | 'invokeMethodNamedOnHeader': function (aMethodName, aValue) { |
605 | return Clipperz.Async.collectResults("User.invokeMethodNamedOnHeader [" + aMethodName + "]", { | 601 | return Clipperz.Async.collectResults("User.invokeMethodNamedOnHeader [" + aMethodName + "]", { |
606 | 'recordIndex': [ | 602 | 'recordIndex': [ |
607 | MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'), | 603 | MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'), |
608 | MochiKit.Base.methodcaller(aMethodName, aValue) | 604 | MochiKit.Base.methodcaller(aMethodName, aValue) |
609 | ], | 605 | ], |
610 | 'preferences': [ | 606 | 'preferences': [ |
611 | MochiKit.Base.method(this, 'getHeaderIndex', 'preferences'), | 607 | MochiKit.Base.method(this, 'getHeaderIndex', 'preferences'), |
612 | MochiKit.Base.methodcaller(aMethodName, aValue) | 608 | MochiKit.Base.methodcaller(aMethodName, aValue) |
diff --git a/frontend/gamma/js/Clipperz/PM/Date.js b/frontend/gamma/js/Clipperz/PM/Date.js index 96a2700..a62857e 100644 --- a/frontend/gamma/js/Clipperz/PM/Date.js +++ b/frontend/gamma/js/Clipperz/PM/Date.js | |||
@@ -1,198 +1,196 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Date) == 'undefined') { Clipperz.PM.Date = {}; } | 26 | if (typeof(Clipperz.PM.Date) == 'undefined') { Clipperz.PM.Date = {}; } |
29 | 27 | ||
30 | Clipperz.PM.Date.VERSION = "0.1"; | 28 | Clipperz.PM.Date.VERSION = "0.1"; |
31 | Clipperz.PM.Date.NAME = "Clipperz.PM.Date"; | 29 | Clipperz.PM.Date.NAME = "Clipperz.PM.Date"; |
32 | 30 | ||
33 | MochiKit.Base.update(Clipperz.PM.Date, { | 31 | MochiKit.Base.update(Clipperz.PM.Date, { |
34 | 32 | ||
35 | '__repr__': function () { | 33 | '__repr__': function () { |
36 | return "[" + this.NAME + " " + this.VERSION + "]"; | 34 | return "[" + this.NAME + " " + this.VERSION + "]"; |
37 | }, | 35 | }, |
38 | 36 | ||
39 | //------------------------------------------------------------------------- | 37 | //------------------------------------------------------------------------- |
40 | 38 | ||
41 | 'toString': function () { | 39 | 'toString': function () { |
42 | return this.__repr__(); | 40 | return this.__repr__(); |
43 | }, | 41 | }, |
44 | 42 | ||
45 | //------------------------------------------------------------------------- | 43 | //------------------------------------------------------------------------- |
46 | 44 | ||
47 | 'locale': function() { | 45 | 'locale': function() { |
48 | return { | 46 | return { |
49 | 'amDesignation':Clipperz.PM.Strings.getValue('calendarStrings.amDesignation'), | 47 | 'amDesignation':Clipperz.PM.Strings.getValue('calendarStrings.amDesignation'), |
50 | 'pmDesignation':Clipperz.PM.Strings.getValue('calendarStrings.pmDesignation'), | 48 | 'pmDesignation':Clipperz.PM.Strings.getValue('calendarStrings.pmDesignation'), |
51 | 'days': Clipperz.PM.Strings.getValue('calendarStrings.days'), | 49 | 'days': Clipperz.PM.Strings.getValue('calendarStrings.days'), |
52 | 'shortDays': Clipperz.PM.Strings.getValue('calendarStrings.shortDays'), | 50 | 'shortDays': Clipperz.PM.Strings.getValue('calendarStrings.shortDays'), |
53 | 'shortMonths': Clipperz.PM.Strings.getValue('calendarStrings.shortMonths'), | 51 | 'shortMonths': Clipperz.PM.Strings.getValue('calendarStrings.shortMonths'), |
54 | 'months': Clipperz.PM.Strings.getValue('calendarStrings.months') | 52 | 'months': Clipperz.PM.Strings.getValue('calendarStrings.months') |
55 | } | 53 | } |
56 | }, | 54 | }, |
57 | 55 | ||
58 | //========================================================================= | 56 | //========================================================================= |
59 | /* | 57 | /* |
60 | 'formatDateWithPHPLikeTemplate': function(aDate, aTemplate) { | 58 | 'formatDateWithPHPLikeTemplate': function(aDate, aTemplate) { |
61 | return Clipperz.Date.formatDateWithPHPLikeTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale()); | 59 | return Clipperz.Date.formatDateWithPHPLikeTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale()); |
62 | }, | 60 | }, |
63 | 61 | ||
64 | 'parseDateWithPHPLikeTemplate': function(aDate, aTemplate) { | 62 | 'parseDateWithPHPLikeTemplate': function(aDate, aTemplate) { |
65 | return Clipperz.Date.parseDateWithPHPTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale()); | 63 | return Clipperz.Date.parseDateWithPHPTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale()); |
66 | }, | 64 | }, |
67 | 65 | ||
68 | //========================================================================= | 66 | //========================================================================= |
69 | 67 | ||
70 | 'formatDateWithJavaLikeTemplate': function(aDate, aTemplate) { | 68 | 'formatDateWithJavaLikeTemplate': function(aDate, aTemplate) { |
71 | return Clipperz.Date.formatDateWithJavaLikeTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale()); | 69 | return Clipperz.Date.formatDateWithJavaLikeTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale()); |
72 | }, | 70 | }, |
73 | 71 | ||
74 | 'parseDateWithJavaLikeTemplate': function(aDate, aTemplate) { | 72 | 'parseDateWithJavaLikeTemplate': function(aDate, aTemplate) { |
75 | return Clipperz.Date.parseDateWithJavaLikeTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale()); | 73 | return Clipperz.Date.parseDateWithJavaLikeTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale()); |
76 | }, | 74 | }, |
77 | */ | 75 | */ |
78 | //========================================================================= | 76 | //========================================================================= |
79 | 77 | ||
80 | 'formatWithTemplate': function (aTemplate, aDate) { | 78 | 'formatWithTemplate': function (aTemplate, aDate) { |
81 | return Clipperz.PM.Date.formatDateWithTemplate(aDate, aTemplate); | 79 | return Clipperz.PM.Date.formatDateWithTemplate(aDate, aTemplate); |
82 | }, | 80 | }, |
83 | 81 | ||
84 | 'formatDateWithTemplate': function(aDate, aTemplate) { | 82 | 'formatDateWithTemplate': function(aDate, aTemplate) { |
85 | var result; | 83 | var result; |
86 | 84 | ||
87 | if (aDate == null) { | 85 | if (aDate == null) { |
88 | result = "" | 86 | result = "" |
89 | } else { | 87 | } else { |
90 | result = Clipperz.Date.formatDateWithPHPLikeTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale()); | 88 | result = Clipperz.Date.formatDateWithPHPLikeTemplateAndLocale(aDate, aTemplate, Clipperz.PM.Date.locale()); |
91 | }; | 89 | }; |
92 | 90 | ||
93 | return result; | 91 | return result; |
94 | }, | 92 | }, |
95 | 93 | ||
96 | 'parseDateWithTemplate': function(aValue, aTemplate) { | 94 | 'parseDateWithTemplate': function(aValue, aTemplate) { |
97 | return Clipperz.Date.parseDateWithPHPTemplateAndLocale(aValue, aTemplate, Clipperz.PM.Date.locale()); | 95 | return Clipperz.Date.parseDateWithPHPTemplateAndLocale(aValue, aTemplate, Clipperz.PM.Date.locale()); |
98 | }, | 96 | }, |
99 | 97 | ||
100 | //========================================================================= | 98 | //========================================================================= |
101 | 99 | ||
102 | 'formatDateWithUTCFormat': function(aDate) { | 100 | 'formatDateWithUTCFormat': function(aDate) { |
103 | return Clipperz.Date.formatDateWithUTCFormatAndLocale(aDate, Clipperz.PM.Date.locale()); | 101 | return Clipperz.Date.formatDateWithUTCFormatAndLocale(aDate, Clipperz.PM.Date.locale()); |
104 | }, | 102 | }, |
105 | 103 | ||
106 | 'parseDateWithUTCFormat': function(aValue) { | 104 | 'parseDateWithUTCFormat': function(aValue) { |
107 | var result; | 105 | var result; |
108 | 106 | ||
109 | if (aValue == null) { | 107 | if (aValue == null) { |
110 | result = null; | 108 | result = null; |
111 | } else { | 109 | } else { |
112 | result = Clipperz.Date.parseDateWithUTCFormatAndLocale(aValue, Clipperz.PM.Date.locale()); | 110 | result = Clipperz.Date.parseDateWithUTCFormatAndLocale(aValue, Clipperz.PM.Date.locale()); |
113 | } | 111 | } |
114 | 112 | ||
115 | return result; | 113 | return result; |
116 | }, | 114 | }, |
117 | 115 | ||
118 | //========================================================================= | 116 | //========================================================================= |
119 | 117 | ||
120 | 'getElapsedTimeDescription': function(aDate) { | 118 | 'getElapsedTimeDescription': function(aDate) { |
121 | var result; | 119 | var result; |
122 | 120 | ||
123 | result = "" | 121 | result = "" |
124 | 122 | ||
125 | if (aDate != null) { | 123 | if (aDate != null) { |
126 | var now; | 124 | var now; |
127 | var elapsedTime; | 125 | var elapsedTime; |
128 | 126 | ||
129 | var millisencondsInAMinute; | 127 | var millisencondsInAMinute; |
130 | var millisencondsInAnHour; | 128 | var millisencondsInAnHour; |
131 | var millisencondsInADay; | 129 | var millisencondsInADay; |
132 | var millisencondsInAWeek; | 130 | var millisencondsInAWeek; |
133 | var millisencondsInAMonth; | 131 | var millisencondsInAMonth; |
134 | 132 | ||
135 | now = new Date(); | 133 | now = new Date(); |
136 | elapsedTime = now.getTime() - aDate.getTime(); | 134 | elapsedTime = now.getTime() - aDate.getTime(); |
137 | 135 | ||
138 | millisencondsInAMinute = 60 * 1000; | 136 | millisencondsInAMinute = 60 * 1000; |
139 | millisencondsInAnHour = millisencondsInAMinute * 60; | 137 | millisencondsInAnHour = millisencondsInAMinute * 60; |
140 | millisencondsInADay = millisencondsInAnHour * 24; | 138 | millisencondsInADay = millisencondsInAnHour * 24; |
141 | millisencondsInAWeek = millisencondsInADay * 7; | 139 | millisencondsInAWeek = millisencondsInADay * 7; |
142 | millisencondsInAMonth = millisencondsInAWeek * 5; | 140 | millisencondsInAMonth = millisencondsInAWeek * 5; |
143 | 141 | ||
144 | if ((elapsedTime / millisencondsInAMonth) > 1) { | 142 | if ((elapsedTime / millisencondsInAMonth) > 1) { |
145 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.MORE_THAN_A_MONTH_AGO'); | 143 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.MORE_THAN_A_MONTH_AGO'); |
146 | } else if ((elapsedTime / millisencondsInAWeek) > 1) { | 144 | } else if ((elapsedTime / millisencondsInAWeek) > 1) { |
147 | var elapsedWeeks; | 145 | var elapsedWeeks; |
148 | 146 | ||
149 | elapsedWeeks = Math.floor((elapsedTime / millisencondsInAWeek)); | 147 | elapsedWeeks = Math.floor((elapsedTime / millisencondsInAWeek)); |
150 | if (elapsedWeeks == 1) { | 148 | if (elapsedWeeks == 1) { |
151 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.MORE_THAN_A_WEEK_AGO'); | 149 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.MORE_THAN_A_WEEK_AGO'); |
152 | } else { | 150 | } else { |
153 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.MORE_THAN_*_WEEKS_AGO').replace(/__elapsed__/, elapsedWeeks); | 151 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.MORE_THAN_*_WEEKS_AGO').replace(/__elapsed__/, elapsedWeeks); |
154 | } | 152 | } |
155 | } else if ((elapsedTime / millisencondsInADay) > 1) { | 153 | } else if ((elapsedTime / millisencondsInADay) > 1) { |
156 | var elapsedDays; | 154 | var elapsedDays; |
157 | 155 | ||
158 | elapsedDays = Math.floor((elapsedTime / millisencondsInADay)); | 156 | elapsedDays = Math.floor((elapsedTime / millisencondsInADay)); |
159 | if (elapsedDays == 1) { | 157 | if (elapsedDays == 1) { |
160 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.YESTERDAY'); | 158 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.YESTERDAY'); |
161 | } else { | 159 | } else { |
162 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.*_DAYS_AGO').replace(/__elapsed__/, elapsedDays); | 160 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.*_DAYS_AGO').replace(/__elapsed__/, elapsedDays); |
163 | } | 161 | } |
164 | } else if ((elapsedTime / millisencondsInAnHour) > 1) { | 162 | } else if ((elapsedTime / millisencondsInAnHour) > 1) { |
165 | var elapsedHours; | 163 | var elapsedHours; |
166 | 164 | ||
167 | elapsedHours = Math.floor((elapsedTime / millisencondsInAnHour)); | 165 | elapsedHours = Math.floor((elapsedTime / millisencondsInAnHour)); |
168 | if (elapsedHours == 1) { | 166 | if (elapsedHours == 1) { |
169 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.ABOUT_AN_HOUR_AGO'); | 167 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.ABOUT_AN_HOUR_AGO'); |
170 | } else { | 168 | } else { |
171 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.*_HOURS_AGO').replace(/__elapsed__/, elapsedHours); | 169 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.*_HOURS_AGO').replace(/__elapsed__/, elapsedHours); |
172 | } | 170 | } |
173 | } else { | 171 | } else { |
174 | var elapsed10Minutes; | 172 | var elapsed10Minutes; |
175 | 173 | ||
176 | elapsed10Minutes = (Math.floor((elapsedTime / millisencondsInAMinute) / 10)) * 10; | 174 | elapsed10Minutes = (Math.floor((elapsedTime / millisencondsInAMinute) / 10)) * 10; |
177 | if (elapsed10Minutes == 0) { | 175 | if (elapsed10Minutes == 0) { |
178 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.JUST_A_FEW_MINUTES_AGO'); | 176 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.JUST_A_FEW_MINUTES_AGO'); |
179 | } else { | 177 | } else { |
180 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.ABOUT_*_MINUTES_AGO').replace(/__elapsed__/, elapsed10Minutes+""); | 178 | result = Clipperz.PM.Strings.getValue('elapsedTimeDescriptions.ABOUT_*_MINUTES_AGO').replace(/__elapsed__/, elapsed10Minutes+""); |
181 | } | 179 | } |
182 | } | 180 | } |
183 | } | 181 | } |
184 | 182 | ||
185 | return result; | 183 | return result; |
186 | }, | 184 | }, |
187 | 185 | ||
188 | //------------------------------------------------------------------------- | 186 | //------------------------------------------------------------------------- |
189 | 187 | ||
190 | 'parse': function (aValue) { | 188 | 'parse': function (aValue) { |
191 | return Clipperz.PM.Date.parseDateWithUTCFormat(aValue); | 189 | return Clipperz.PM.Date.parseDateWithUTCFormat(aValue); |
192 | }, | 190 | }, |
193 | 191 | ||
194 | //------------------------------------------------------------------------- | 192 | //------------------------------------------------------------------------- |
195 | __syntaxFix__: "syntax fix" | 193 | __syntaxFix__: "syntax fix" |
196 | 194 | ||
197 | }); | 195 | }); |
198 | 196 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/PIN.js b/frontend/gamma/js/Clipperz/PM/PIN.js index bc932b2..a32889a 100644 --- a/frontend/gamma/js/Clipperz/PM/PIN.js +++ b/frontend/gamma/js/Clipperz/PM/PIN.js | |||
@@ -1,134 +1,132 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.PIN) == 'undefined') { Clipperz.PM.PIN = {}; } | 26 | if (typeof(Clipperz.PM.PIN) == 'undefined') { Clipperz.PM.PIN = {}; } |
29 | 27 | ||
30 | MochiKit.Base.update(Clipperz.PM.PIN, { | 28 | MochiKit.Base.update(Clipperz.PM.PIN, { |
31 | 29 | ||
32 | //------------------------------------------------------------------------- | 30 | //------------------------------------------------------------------------- |
33 | 31 | ||
34 | '__repr__': function () { | 32 | '__repr__': function () { |
35 | return "[" + this.NAME + " " + this.VERSION + "]"; | 33 | return "[" + this.NAME + " " + this.VERSION + "]"; |
36 | }, | 34 | }, |
37 | 35 | ||
38 | //------------------------------------------------------------------------- | 36 | //------------------------------------------------------------------------- |
39 | 37 | ||
40 | 'toString': function () { | 38 | 'toString': function () { |
41 | return this.__repr__(); | 39 | return this.__repr__(); |
42 | }, | 40 | }, |
43 | 41 | ||
44 | 'CREDENTIALS': 'CLIPPERZ.CREDENTIALS', | 42 | 'CREDENTIALS': 'CLIPPERZ.CREDENTIALS', |
45 | 'FAILURE_COUNT': 'CLIPPERZ.FAILED_LOGIN_COUNT', | 43 | 'FAILURE_COUNT': 'CLIPPERZ.FAILED_LOGIN_COUNT', |
46 | 'ALLOWED_RETRY': 3, | 44 | 'ALLOWED_RETRY': 3, |
47 | 45 | ||
48 | //------------------------------------------------------------------------- | 46 | //------------------------------------------------------------------------- |
49 | 47 | ||
50 | 'isSet': function () { | 48 | 'isSet': function () { |
51 | return (this.storedCredentials() != null); | 49 | return (this.storedCredentials() != null); |
52 | }, | 50 | }, |
53 | 51 | ||
54 | 'storedCredentials': function () { | 52 | 'storedCredentials': function () { |
55 | return localStorage[this.CREDENTIALS]; | 53 | return localStorage[this.CREDENTIALS]; |
56 | }, | 54 | }, |
57 | 55 | ||
58 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
59 | 57 | ||
60 | 'recordFailedAttempt': function () { | 58 | 'recordFailedAttempt': function () { |
61 | varfailureCount; | 59 | varfailureCount; |
62 | varresult; | 60 | varresult; |
63 | 61 | ||
64 | failureCount = localStorage[this.FAILURE_COUNT]; | 62 | failureCount = localStorage[this.FAILURE_COUNT]; |
65 | 63 | ||
66 | if (failureCount == null) { | 64 | if (failureCount == null) { |
67 | failureCount = 0 | 65 | failureCount = 0 |
68 | } | 66 | } |
69 | 67 | ||
70 | failureCount ++; | 68 | failureCount ++; |
71 | 69 | ||
72 | if (failureCount < this.ALLOWED_RETRY) { | 70 | if (failureCount < this.ALLOWED_RETRY) { |
73 | localStorage[this.FAILURE_COUNT] = failureCount; | 71 | localStorage[this.FAILURE_COUNT] = failureCount; |
74 | result = failureCount; | 72 | result = failureCount; |
75 | } else { | 73 | } else { |
76 | this.removeLocalCredentials(); | 74 | this.removeLocalCredentials(); |
77 | result = -1; | 75 | result = -1; |
78 | } | 76 | } |
79 | 77 | ||
80 | return result; | 78 | return result; |
81 | }, | 79 | }, |
82 | 80 | ||
83 | 'resetFailedAttemptCount': function () { | 81 | 'resetFailedAttemptCount': function () { |
84 | localStorage.removeItem(this.FAILURE_COUNT); | 82 | localStorage.removeItem(this.FAILURE_COUNT); |
85 | }, | 83 | }, |
86 | 84 | ||
87 | 'failureCount': function () { | 85 | 'failureCount': function () { |
88 | return localStorage[this.FAILURE_COUNT]; | 86 | return localStorage[this.FAILURE_COUNT]; |
89 | }, | 87 | }, |
90 | 88 | ||
91 | //------------------------------------------------------------------------- | 89 | //------------------------------------------------------------------------- |
92 | 90 | ||
93 | 'deriveKeyFromPin': function (aPIN) { | 91 | 'deriveKeyFromPin': function (aPIN) { |
94 | return Clipperz.Crypto.SHA.sha256(new Clipperz.ByteArray(aPIN)); | 92 | return Clipperz.Crypto.SHA.sha256(new Clipperz.ByteArray(aPIN)); |
95 | }, | 93 | }, |
96 | 94 | ||
97 | 'credentialsWithPIN': function (aPIN) { | 95 | 'credentialsWithPIN': function (aPIN) { |
98 | varbyteArrayValue; | 96 | varbyteArrayValue; |
99 | var decryptedValue; | 97 | var decryptedValue; |
100 | varresult; | 98 | varresult; |
101 | 99 | ||
102 | byteArrayValue = (new Clipperz.ByteArray()).appendBase64String(localStorage[this.CREDENTIALS]); | 100 | byteArrayValue = (new Clipperz.ByteArray()).appendBase64String(localStorage[this.CREDENTIALS]); |
103 | decryptedValue = Clipperz.Crypto.AES.decrypt(this.deriveKeyFromPin(aPIN), byteArrayValue).asString(); | 101 | decryptedValue = Clipperz.Crypto.AES.decrypt(this.deriveKeyFromPin(aPIN), byteArrayValue).asString(); |
104 | try { | 102 | try { |
105 | result = Clipperz.Base.evalJSON(decryptedValue); | 103 | result = Clipperz.Base.evalJSON(decryptedValue); |
106 | } catch (error) { | 104 | } catch (error) { |
107 | result = {'username':'fakeusername', 'passphrase':'fakepassphrase'}; | 105 | result = {'username':'fakeusername', 'passphrase':'fakepassphrase'}; |
108 | } | 106 | } |
109 | 107 | ||
110 | return result; | 108 | return result; |
111 | }, | 109 | }, |
112 | 110 | ||
113 | 'setCredentialsWithPIN': function (aPIN, someCredentials) { | 111 | 'setCredentialsWithPIN': function (aPIN, someCredentials) { |
114 | varencodedValue; | 112 | varencodedValue; |
115 | varbyteArrayValue; | 113 | varbyteArrayValue; |
116 | var encryptedValue; | 114 | var encryptedValue; |
117 | 115 | ||
118 | encodedValue = Clipperz.Base.serializeJSON(someCredentials); | 116 | encodedValue = Clipperz.Base.serializeJSON(someCredentials); |
119 | byteArrayValue = new Clipperz.ByteArray(encodedValue); | 117 | byteArrayValue = new Clipperz.ByteArray(encodedValue); |
120 | encryptedValue = Clipperz.Crypto.AES.encrypt(this.deriveKeyFromPin(aPIN), byteArrayValue).toBase64String(); | 118 | encryptedValue = Clipperz.Crypto.AES.encrypt(this.deriveKeyFromPin(aPIN), byteArrayValue).toBase64String(); |
121 | 119 | ||
122 | localStorage[this.CREDENTIALS] = encryptedValue; | 120 | localStorage[this.CREDENTIALS] = encryptedValue; |
123 | }, | 121 | }, |
124 | 122 | ||
125 | 'removeLocalCredentials': function () { | 123 | 'removeLocalCredentials': function () { |
126 | localStorage.removeItem(this.CREDENTIALS); | 124 | localStorage.removeItem(this.CREDENTIALS); |
127 | localStorage.removeItem(this.FAILURE_COUNT); | 125 | localStorage.removeItem(this.FAILURE_COUNT); |
128 | }, | 126 | }, |
129 | 127 | ||
130 | //------------------------------------------------------------------------- | 128 | //------------------------------------------------------------------------- |
131 | __syntaxFix__: "syntax fix" | 129 | __syntaxFix__: "syntax fix" |
132 | 130 | ||
133 | }); | 131 | }); |
134 | 132 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy.js b/frontend/gamma/js/Clipperz/PM/Proxy.js index 190bffd..a5eaae6 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy.js | |||
@@ -1,169 +1,161 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | 26 | ||
29 | //============================================================================= | 27 | //============================================================================= |
30 | 28 | ||
31 | Clipperz.PM.Proxy = function(args) { | 29 | Clipperz.PM.Proxy = function(args) { |
32 | args = args || {}; | 30 | args = args || {}; |
33 | 31 | ||
34 | this._shouldPayTolls = args.shouldPayTolls || false; | 32 | this._shouldPayTolls = args.shouldPayTolls || false; |
35 | 33 | ||
36 | this._tolls = { | 34 | this._tolls = { |
37 | 'CONNECT':[], | 35 | 'CONNECT':[], |
38 | 'REGISTER':[], | 36 | 'REGISTER':[], |
39 | 'MESSAGE':[] | 37 | 'MESSAGE':[] |
40 | }; | 38 | }; |
41 | 39 | ||
42 | if (args.isDefault === true) { | 40 | if (args.isDefault === true) { |
43 | Clipperz.PM.Proxy.defaultProxy = this; | 41 | Clipperz.PM.Proxy.defaultProxy = this; |
44 | } | 42 | } |
45 | 43 | ||
46 | return this; | 44 | return this; |
47 | } | 45 | } |
48 | 46 | ||
49 | Clipperz.PM.Proxy.prototype = MochiKit.Base.update(null, { | 47 | Clipperz.PM.Proxy.prototype = MochiKit.Base.update(null, { |
50 | 48 | ||
51 | 'toString': function() { | 49 | 'toString': function() { |
52 | return "Clipperz.PM.Proxy"; | 50 | return "Clipperz.PM.Proxy"; |
53 | }, | 51 | }, |
54 | 52 | ||
55 | //========================================================================= | 53 | //========================================================================= |
56 | 54 | ||
57 | 'shouldPayTolls': function() { | 55 | 'shouldPayTolls': function() { |
58 | return this._shouldPayTolls; | 56 | return this._shouldPayTolls; |
59 | }, | 57 | }, |
60 | 58 | ||
61 | //------------------------------------------------------------------------- | 59 | //------------------------------------------------------------------------- |
62 | 60 | ||
63 | 'tolls': function() { | 61 | 'tolls': function() { |
64 | return this._tolls; | 62 | return this._tolls; |
65 | }, | 63 | }, |
66 | 64 | ||
67 | //------------------------------------------------------------------------- | 65 | //------------------------------------------------------------------------- |
68 | 66 | ||
69 | 'payToll': function(aRequestType, someParameters) { | 67 | 'payToll': function(aRequestType, someParameters) { |
70 | vardeferredResult; | 68 | vardeferredResult; |
71 | 69 | ||
72 | //console.log(">>> Proxy.payToll", aRequestType, someParameters); | ||
73 | if (this.shouldPayTolls()) { | 70 | if (this.shouldPayTolls()) { |
74 | deferredResult = new Clipperz.Async.Deferred("Proxy.payToll", {trace:false}); | 71 | deferredResult = new Clipperz.Async.Deferred("Proxy.payToll", {trace:false}); |
75 | 72 | ||
76 | if (this.tolls()[aRequestType].length == 0) { | 73 | if (this.tolls()[aRequestType].length == 0) { |
77 | deferredResult.addMethod(this, 'sendMessage', 'knock', {requestType:aRequestType}); | 74 | deferredResult.addMethod(this, 'sendMessage', 'knock', {requestType:aRequestType}); |
78 | deferredResult.addMethod(this, 'setTollCallback'); | 75 | deferredResult.addMethod(this, 'setTollCallback'); |
79 | } | 76 | } |
80 | deferredResult.addMethod(this.tolls()[aRequestType], 'pop'); | 77 | deferredResult.addMethod(this.tolls()[aRequestType], 'pop'); |
81 | deferredResult.addCallback(MochiKit.Base.methodcaller('deferredPay')); | 78 | deferredResult.addCallback(MochiKit.Base.methodcaller('deferredPay')); |
82 | deferredResult.addCallback(function(aToll) { | 79 | deferredResult.addCallback(function(aToll) { |
83 | var result; | 80 | var result; |
84 | 81 | ||
85 | result = { | 82 | result = { |
86 | parameters: someParameters, | 83 | parameters: someParameters, |
87 | toll: aToll | 84 | toll: aToll |
88 | } | 85 | } |
89 | 86 | ||
90 | return result; | 87 | return result; |
91 | }); | 88 | }); |
92 | 89 | ||
93 | deferredResult.callback(); | 90 | deferredResult.callback(); |
94 | } else { | 91 | } else { |
95 | deferredResult = MochiKit.Async.succeed({parameters:someParameters}); | 92 | deferredResult = MochiKit.Async.succeed({parameters:someParameters}); |
96 | } | 93 | } |
97 | //console.log("<<< Proxy.payToll"); | ||
98 | 94 | ||
99 | return deferredResult; | 95 | return deferredResult; |
100 | }, | 96 | }, |
101 | 97 | ||
102 | //------------------------------------------------------------------------- | 98 | //------------------------------------------------------------------------- |
103 | 99 | ||
104 | 'addToll': function(aToll) { | 100 | 'addToll': function(aToll) { |
105 | //console.log(">>> Proxy.addToll", aToll); | ||
106 | this.tolls()[aToll.requestType()].push(aToll); | 101 | this.tolls()[aToll.requestType()].push(aToll); |
107 | //console.log("<<< Proxy.addToll"); | ||
108 | }, | 102 | }, |
109 | 103 | ||
110 | //========================================================================= | 104 | //========================================================================= |
111 | 105 | ||
112 | 'setTollCallback': function(someParameters) { | 106 | 'setTollCallback': function(someParameters) { |
113 | //console.log(">>> Proxy.setTollCallback", someParameters); | ||
114 | if (typeof(someParameters['toll']) != 'undefined') { | 107 | if (typeof(someParameters['toll']) != 'undefined') { |
115 | //console.log("added a new toll", someParameters['toll']); | ||
116 | this.addToll(new Clipperz.PM.Toll(someParameters['toll'])); | 108 | this.addToll(new Clipperz.PM.Toll(someParameters['toll'])); |
117 | } | 109 | } |
118 | //console.log("<<< Proxy.setTallCallback", someParameters['result']); | 110 | |
119 | return someParameters['result']; | 111 | return someParameters['result']; |
120 | }, | 112 | }, |
121 | 113 | ||
122 | //========================================================================= | 114 | //========================================================================= |
123 | 115 | ||
124 | 'registration': function (someParameters) { | 116 | 'registration': function (someParameters) { |
125 | return this.processMessage('registration', someParameters, 'REGISTER'); | 117 | return this.processMessage('registration', someParameters, 'REGISTER'); |
126 | }, | 118 | }, |
127 | 119 | ||
128 | 'handshake': function (someParameters) { | 120 | 'handshake': function (someParameters) { |
129 | return this.processMessage('handshake', someParameters, 'CONNECT'); | 121 | return this.processMessage('handshake', someParameters, 'CONNECT'); |
130 | }, | 122 | }, |
131 | 123 | ||
132 | 'message': function (someParameters) { | 124 | 'message': function (someParameters) { |
133 | return this.processMessage('message', someParameters, 'MESSAGE'); | 125 | return this.processMessage('message', someParameters, 'MESSAGE'); |
134 | }, | 126 | }, |
135 | 127 | ||
136 | 'logout': function (someParameters) { | 128 | 'logout': function (someParameters) { |
137 | return this.processMessage('logout', someParameters, 'MESSAGE'); | 129 | return this.processMessage('logout', someParameters, 'MESSAGE'); |
138 | }, | 130 | }, |
139 | 131 | ||
140 | //========================================================================= | 132 | //========================================================================= |
141 | 133 | ||
142 | 'processMessage': function (aFunctionName, someParameters, aRequestType) { | 134 | 'processMessage': function (aFunctionName, someParameters, aRequestType) { |
143 | vardeferredResult; | 135 | vardeferredResult; |
144 | 136 | ||
145 | deferredResult = new Clipperz.Async.Deferred("Proxy.processMessage", {trace:false}); | 137 | deferredResult = new Clipperz.Async.Deferred("Proxy.processMessage", {trace:false}); |
146 | deferredResult.addMethod(this, 'payToll', aRequestType); | 138 | deferredResult.addMethod(this, 'payToll', aRequestType); |
147 | deferredResult.addMethod(this, 'sendMessage', aFunctionName); | 139 | deferredResult.addMethod(this, 'sendMessage', aFunctionName); |
148 | deferredResult.addMethod(this, 'setTollCallback'); | 140 | deferredResult.addMethod(this, 'setTollCallback'); |
149 | deferredResult.callback(someParameters); | 141 | deferredResult.callback(someParameters); |
150 | 142 | ||
151 | return deferredResult; | 143 | return deferredResult; |
152 | }, | 144 | }, |
153 | 145 | ||
154 | //========================================================================= | 146 | //========================================================================= |
155 | 147 | ||
156 | 'sendMessage': function () { | 148 | 'sendMessage': function () { |
157 | throw Clipperz.Base.exception.AbstractMethod; | 149 | throw Clipperz.Base.exception.AbstractMethod; |
158 | }, | 150 | }, |
159 | 151 | ||
160 | //========================================================================= | 152 | //========================================================================= |
161 | 153 | ||
162 | 'isReadOnly': function () { | 154 | 'isReadOnly': function () { |
163 | return false; | 155 | return false; |
164 | }, | 156 | }, |
165 | 157 | ||
166 | //========================================================================= | 158 | //========================================================================= |
167 | __syntaxFix__: "syntax fix" | 159 | __syntaxFix__: "syntax fix" |
168 | 160 | ||
169 | }); | 161 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.JSON.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.JSON.js index 5b39b4a..7d10dd4 100755 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.JSON.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.JSON.js | |||
@@ -1,91 +1,89 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | 26 | ||
29 | //============================================================================= | 27 | //============================================================================= |
30 | 28 | ||
31 | Clipperz.PM.Proxy.JSON = function(args) { | 29 | Clipperz.PM.Proxy.JSON = function(args) { |
32 | Clipperz.PM.Proxy.JSON.superclass.constructor.call(this, args); | 30 | Clipperz.PM.Proxy.JSON.superclass.constructor.call(this, args); |
33 | 31 | ||
34 | this._url = args.url || Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | this._url = args.url || Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | 33 | ||
36 | return this; | 34 | return this; |
37 | } | 35 | } |
38 | 36 | ||
39 | Clipperz.Base.extend(Clipperz.PM.Proxy.JSON, Clipperz.PM.Proxy, { | 37 | Clipperz.Base.extend(Clipperz.PM.Proxy.JSON, Clipperz.PM.Proxy, { |
40 | 38 | ||
41 | 'toString': function() { | 39 | 'toString': function() { |
42 | return "Clipperz.PM.Proxy.JSON"; | 40 | return "Clipperz.PM.Proxy.JSON"; |
43 | }, | 41 | }, |
44 | 42 | ||
45 | //========================================================================= | 43 | //========================================================================= |
46 | 44 | ||
47 | 'url': function () { | 45 | 'url': function () { |
48 | return this._url; | 46 | return this._url; |
49 | }, | 47 | }, |
50 | 48 | ||
51 | //========================================================================= | 49 | //========================================================================= |
52 | 50 | ||
53 | 'sendMessage': function(aFunctionName, someParameters) { | 51 | 'sendMessage': function(aFunctionName, someParameters) { |
54 | vardeferredResult; | 52 | vardeferredResult; |
55 | var parameters; | 53 | var parameters; |
56 | 54 | ||
57 | parameters = { | 55 | parameters = { |
58 | method: aFunctionName, | 56 | method: aFunctionName, |
59 | // version: someParameters['version'], | 57 | // version: someParameters['version'], |
60 | // message: someParameters['message'], | 58 | // message: someParameters['message'], |
61 | parameters: Clipperz.Base.serializeJSON(someParameters) | 59 | parameters: Clipperz.Base.serializeJSON(someParameters) |
62 | }; | 60 | }; |
63 | 61 | ||
64 | deferredResult = new Clipperz.Async.Deferred("Proxy.JSON.sendMessage", {trace:false}); | 62 | deferredResult = new Clipperz.Async.Deferred("Proxy.JSON.sendMessage", {trace:false}); |
65 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'remoteRequestSent'); | 63 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'remoteRequestSent'); |
66 | deferredResult.addCallback(MochiKit.Async.doXHR, this.url(), { | 64 | deferredResult.addCallback(MochiKit.Async.doXHR, this.url(), { |
67 | method:'POST', | 65 | method:'POST', |
68 | sendContent:MochiKit.Base.queryString(parameters), | 66 | sendContent:MochiKit.Base.queryString(parameters), |
69 | headers:{"Content-Type":"application/x-www-form-urlencoded"} | 67 | headers:{"Content-Type":"application/x-www-form-urlencoded"} |
70 | }); | 68 | }); |
71 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'remoteRequestReceived'); | 69 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'remoteRequestReceived'); |
72 | // deferredResult.addCallback(MochiKit.Async.evalJSONRequest); | 70 | // deferredResult.addCallback(MochiKit.Async.evalJSONRequest); |
73 | deferredResult.addCallback(MochiKit.Base.itemgetter('responseText')); | 71 | deferredResult.addCallback(MochiKit.Base.itemgetter('responseText')); |
74 | deferredResult.addCallback(Clipperz.Base.evalJSON); | 72 | deferredResult.addCallback(Clipperz.Base.evalJSON); |
75 | deferredResult.addCallback(function (someValues) { | 73 | deferredResult.addCallback(function (someValues) { |
76 | if (someValues['result'] == 'EXCEPTION') { | 74 | if (someValues['result'] == 'EXCEPTION') { |
77 | throw someValues['message']; | 75 | throw someValues['message']; |
78 | } | 76 | } |
79 | 77 | ||
80 | return someValues; | 78 | return someValues; |
81 | }) | 79 | }) |
82 | // return MochiKit.Base.evalJSON(req.responseText); | 80 | // return MochiKit.Base.evalJSON(req.responseText); |
83 | deferredResult.callback(); | 81 | deferredResult.callback(); |
84 | 82 | ||
85 | return deferredResult; | 83 | return deferredResult; |
86 | }, | 84 | }, |
87 | 85 | ||
88 | //========================================================================= | 86 | //========================================================================= |
89 | __syntaxFix__: "syntax fix" | 87 | __syntaxFix__: "syntax fix" |
90 | 88 | ||
91 | }); | 89 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js index 01ba122..326022c 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js | |||
@@ -1,808 +1,788 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.PM.Proxy.Offline) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.Proxy.Offline) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.Proxy.Offline.DataStore depends on Clipperz.PM.Proxy.Offline!"; | 25 | throw "Clipperz.PM.Proxy.Offline.DataStore depends on Clipperz.PM.Proxy.Offline!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | //============================================================================= | 28 | //============================================================================= |
31 | 29 | ||
32 | Clipperz.PM.Proxy.Offline.DataStore = function(args) { | 30 | Clipperz.PM.Proxy.Offline.DataStore = function(args) { |
33 | args = args || {}; | 31 | args = args || {}; |
34 | 32 | ||
35 | this._data = args.data || (typeof(_clipperz_dump_data_) != 'undefined' ? _clipperz_dump_data_ : null); | 33 | this._data = args.data || (typeof(_clipperz_dump_data_) != 'undefined' ? _clipperz_dump_data_ : null); |
36 | this._isReadOnly = (typeof(args.readOnly) == 'undefined' ? true : args.readOnly); | 34 | this._isReadOnly = (typeof(args.readOnly) == 'undefined' ? true : args.readOnly); |
37 | this._shouldPayTolls = args.shouldPayTolls || false; | 35 | this._shouldPayTolls = args.shouldPayTolls || false; |
38 | 36 | ||
39 | this._tolls = {}; | 37 | this._tolls = {}; |
40 | this._currentStaticConnection = null; | 38 | this._currentStaticConnection = null; |
41 | 39 | ||
42 | return this; | 40 | return this; |
43 | } | 41 | } |
44 | 42 | ||
45 | Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | 43 | Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { |
46 | 44 | ||
47 | //------------------------------------------------------------------------- | 45 | //------------------------------------------------------------------------- |
48 | 46 | ||
49 | 'isReadOnly': function () { | 47 | 'isReadOnly': function () { |
50 | return this._isReadOnly; | 48 | return this._isReadOnly; |
51 | }, | 49 | }, |
52 | 50 | ||
53 | //------------------------------------------------------------------------- | 51 | //------------------------------------------------------------------------- |
54 | 52 | ||
55 | 'shouldPayTolls': function() { | 53 | 'shouldPayTolls': function() { |
56 | return this._shouldPayTolls; | 54 | return this._shouldPayTolls; |
57 | }, | 55 | }, |
58 | 56 | ||
59 | //------------------------------------------------------------------------- | 57 | //------------------------------------------------------------------------- |
60 | 58 | ||
61 | 'data': function () { | 59 | 'data': function () { |
62 | return this._data; | 60 | return this._data; |
63 | }, | 61 | }, |
64 | 62 | ||
65 | //------------------------------------------------------------------------- | 63 | //------------------------------------------------------------------------- |
66 | 64 | ||
67 | 'tolls': function () { | 65 | 'tolls': function () { |
68 | return this._tolls; | 66 | return this._tolls; |
69 | }, | 67 | }, |
70 | 68 | ||
71 | //========================================================================= | 69 | //========================================================================= |
72 | 70 | ||
73 | 'resetData': function() { | 71 | 'resetData': function() { |
74 | this._data = { | 72 | this._data = { |
75 | 'users': { | 73 | 'users': { |
76 | 'catchAllUser': { | 74 | 'catchAllUser': { |
77 | __masterkey_test_value__: 'masterkey', | 75 | __masterkey_test_value__: 'masterkey', |
78 | s: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00', | 76 | s: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00', |
79 | v: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00' | 77 | v: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00' |
80 | } | 78 | } |
81 | } | 79 | } |
82 | }; | 80 | }; |
83 | }, | 81 | }, |
84 | 82 | ||
85 | //------------------------------------------------------------------------- | 83 | //------------------------------------------------------------------------- |
86 | 84 | ||
87 | 'setupWithEncryptedData': function(someData) { | 85 | 'setupWithEncryptedData': function(someData) { |
88 | this._data = Clipperz.Base.deepClone(someData); | 86 | this._data = Clipperz.Base.deepClone(someData); |
89 | }, | 87 | }, |
90 | 88 | ||
91 | //------------------------------------------------------------------------- | 89 | //------------------------------------------------------------------------- |
92 | 90 | ||
93 | 'setupWithData': function(someData) { | 91 | 'setupWithData': function(someData) { |
94 | var deferredResult; | 92 | var deferredResult; |
95 | var resultData; | 93 | var resultData; |
96 | var i, c; | 94 | var i, c; |
97 | 95 | ||
98 | //Clipperz.log(">>> Proxy.Test.setupWithData"); | 96 | //Clipperz.log(">>> Proxy.Test.setupWithData"); |
99 | resultData = this._data; | 97 | resultData = this._data; |
100 | 98 | ||
101 | deferredResult = new Clipperz.Async.Deferred("Proxy.Test.seupWithData", {trace:false}); | 99 | deferredResult = new Clipperz.Async.Deferred("Proxy.Test.seupWithData", {trace:false}); |
102 | c = someData['users'].length; | 100 | c = someData['users'].length; |
103 | 101 | ||
104 | for (i=0; i<c; i++) { | 102 | for (i=0; i<c; i++) { |
105 | varnewConnection; | 103 | varnewConnection; |
106 | varrecordConfiguration; | 104 | varrecordConfiguration; |
107 | 105 | ||
108 | deferredResult.addMethod(this, 'userSerializedEncryptedData', someData['users'][i]); | 106 | deferredResult.addMethod(this, 'userSerializedEncryptedData', someData['users'][i]); |
109 | deferredResult.addCallback(MochiKit.Base.bind(function(aUserSerializationContext) { | 107 | deferredResult.addCallback(MochiKit.Base.bind(function(aUserSerializationContext) { |
110 | //console.log("SERIALIZED USER", aUserSerializationContext); | ||
111 | resultData['users'][aUserSerializationContext['credentials']['C']] = { | 108 | resultData['users'][aUserSerializationContext['credentials']['C']] = { |
112 | 's': aUserSerializationContext['credentials']['s'], | 109 | 's': aUserSerializationContext['credentials']['s'], |
113 | 'v': aUserSerializationContext['credentials']['v'], | 110 | 'v': aUserSerializationContext['credentials']['v'], |
114 | 'version': aUserSerializationContext['data']['connectionVersion'], | 111 | 'version': aUserSerializationContext['data']['connectionVersion'], |
115 | 'userDetails': aUserSerializationContext['encryptedData']['user']['header'], | 112 | 'userDetails': aUserSerializationContext['encryptedData']['user']['header'], |
116 | 'userDetailsVersion':aUserSerializationContext['encryptedData']['user']['version'], | 113 | 'userDetailsVersion':aUserSerializationContext['encryptedData']['user']['version'], |
117 | 'statistics': aUserSerializationContext['encryptedData']['user']['statistics'], | 114 | 'statistics': aUserSerializationContext['encryptedData']['user']['statistics'], |
118 | 'lock': aUserSerializationContext['encryptedData']['user']['lock'], | 115 | 'lock': aUserSerializationContext['encryptedData']['user']['lock'], |
119 | 'records': this.rearrangeRecordsData(aUserSerializationContext['encryptedData']['records']) | 116 | 'records': this.rearrangeRecordsData(aUserSerializationContext['encryptedData']['records']) |
120 | } | 117 | } |
121 | }, this)); | 118 | }, this)); |
122 | } | 119 | } |
123 | 120 | ||
124 | deferredResult.addCallback(MochiKit.Base.bind(function() { | 121 | deferredResult.addCallback(MochiKit.Base.bind(function() { |
125 | //console.log("this._data", resultData); | ||
126 | this._data = resultData; | 122 | this._data = resultData; |
127 | }, this)); | 123 | }, this)); |
128 | 124 | ||
129 | deferredResult.callback(); | 125 | deferredResult.callback(); |
130 | //Clipperz.log("<<< Proxy.Test.setupWithData"); | 126 | //Clipperz.log("<<< Proxy.Test.setupWithData"); |
131 | 127 | ||
132 | return deferredResult; | 128 | return deferredResult; |
133 | }, | 129 | }, |
134 | 130 | ||
135 | //========================================================================= | 131 | //========================================================================= |
136 | 132 | ||
137 | 'getTollForRequestType': function (aRequestType) { | 133 | 'getTollForRequestType': function (aRequestType) { |
138 | varresult; | 134 | varresult; |
139 | vartargetValue; | 135 | vartargetValue; |
140 | var cost; | 136 | var cost; |
141 | 137 | ||
142 | targetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2); | 138 | targetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2); |
143 | switch (aRequestType) { | 139 | switch (aRequestType) { |
144 | case 'REGISTER': | 140 | case 'REGISTER': |
145 | cost = 5; | 141 | cost = 5; |
146 | break; | 142 | break; |
147 | case 'CONNECT': | 143 | case 'CONNECT': |
148 | cost = 5; | 144 | cost = 5; |
149 | break; | 145 | break; |
150 | case 'MESSAGE': | 146 | case 'MESSAGE': |
151 | cost = 2; | 147 | cost = 2; |
152 | break; | 148 | break; |
153 | } | 149 | } |
154 | 150 | ||
155 | result = { | 151 | result = { |
156 | requestType: aRequestType, | 152 | requestType: aRequestType, |
157 | targetValue: targetValue, | 153 | targetValue: targetValue, |
158 | cost: cost | 154 | cost: cost |
159 | } | 155 | } |
160 | 156 | ||
161 | if (this.shouldPayTolls()) { | 157 | if (this.shouldPayTolls()) { |
162 | this.tolls()[targetValue] = result; | 158 | this.tolls()[targetValue] = result; |
163 | } | 159 | } |
164 | 160 | ||
165 | return result; | 161 | return result; |
166 | }, | 162 | }, |
167 | 163 | ||
168 | //------------------------------------------------------------------------- | 164 | //------------------------------------------------------------------------- |
169 | 165 | ||
170 | 'checkToll': function (aFunctionName, someParameters) { | 166 | 'checkToll': function (aFunctionName, someParameters) { |
171 | if (this.shouldPayTolls()) { | 167 | if (this.shouldPayTolls()) { |
172 | var localToll; | 168 | var localToll; |
173 | vartollParameters; | 169 | vartollParameters; |
174 | 170 | ||
175 | tollParameters = someParameters['toll']; | 171 | tollParameters = someParameters['toll']; |
176 | localToll = this.tolls()[tollParameters['targetValue']]; | 172 | localToll = this.tolls()[tollParameters['targetValue']]; |
177 | 173 | ||
178 | if (localToll != null) { | 174 | if (localToll != null) { |
179 | if (! Clipperz.PM.Toll.validate(tollParameters['targetValue'], tollParameters['toll'], localToll['cost'])) { | 175 | if (! Clipperz.PM.Toll.validate(tollParameters['targetValue'], tollParameters['toll'], localToll['cost'])) { |
180 | throw "Toll value too low."; | 176 | throw "Toll value too low."; |
181 | }; | 177 | }; |
182 | } else { | 178 | } else { |
183 | throw "Missing toll"; | 179 | throw "Missing toll"; |
184 | } | 180 | } |
185 | } | 181 | } |
186 | }, | 182 | }, |
187 | 183 | ||
188 | //========================================================================= | 184 | //========================================================================= |
189 | 185 | ||
190 | 'currentStaticConnection': function () { | 186 | 'currentStaticConnection': function () { |
191 | if (this._currentStaticConnection == null) { | 187 | if (this._currentStaticConnection == null) { |
192 | this._currentStaticConnection = {}; | 188 | this._currentStaticConnection = {}; |
193 | } | 189 | } |
194 | 190 | ||
195 | return this._currentStaticConnection; | 191 | return this._currentStaticConnection; |
196 | }, | 192 | }, |
197 | 193 | ||
198 | //------------------------------------------------------------------------- | 194 | //------------------------------------------------------------------------- |
199 | 195 | ||
200 | 'getConnectionForRequest': function (aFunctionName, someParameters) { | 196 | 'getConnectionForRequest': function (aFunctionName, someParameters) { |
201 | varresult; | 197 | varresult; |
202 | 198 | ||
203 | if (this.shouldPayTolls()) { | 199 | if (this.shouldPayTolls()) { |
204 | if ((typeof(someParameters['toll']) != 'undefined') && (typeof(someParameters['toll']['targetValue']) != 'undefined')) { | 200 | if ((typeof(someParameters['toll']) != 'undefined') && (typeof(someParameters['toll']['targetValue']) != 'undefined')) { |
205 | result = this.tolls()[someParameters['toll']['targetValue']]['connection']; | 201 | result = this.tolls()[someParameters['toll']['targetValue']]['connection']; |
206 | if (typeof(result) == 'undefined') { | 202 | if (typeof(result) == 'undefined') { |
207 | result = {}; | 203 | result = {}; |
208 | } | 204 | } |
209 | } else { | 205 | } else { |
210 | result = {}; | 206 | result = {}; |
211 | } | 207 | } |
212 | } else { | 208 | } else { |
213 | result = this.currentStaticConnection(); | 209 | result = this.currentStaticConnection(); |
214 | } | 210 | } |
215 | 211 | ||
216 | return result; | 212 | return result; |
217 | }, | 213 | }, |
218 | 214 | ||
219 | //------------------------------------------------------------------------- | 215 | //------------------------------------------------------------------------- |
220 | 216 | ||
221 | 'storeConnectionForRequestWithConnectionAndResponse': function (aFunctionName, someParameters, aConnection, aResponse) { | 217 | 'storeConnectionForRequestWithConnectionAndResponse': function (aFunctionName, someParameters, aConnection, aResponse) { |
222 | if (this.shouldPayTolls()) { | 218 | if (this.shouldPayTolls()) { |
223 | if ((typeof(aResponse['toll']) != 'undefined') | 219 | if ((typeof(aResponse['toll']) != 'undefined') |
224 | &&(typeof(aResponse['toll']['targetValue']) != 'undefined') | 220 | &&(typeof(aResponse['toll']['targetValue']) != 'undefined') |
225 | &&(typeof(this.tolls()[aResponse['toll']['targetValue']]) != 'undefined') | 221 | &&(typeof(this.tolls()[aResponse['toll']['targetValue']]) != 'undefined') |
226 | ) { | 222 | ) { |
227 | this.tolls()[aResponse['toll']['targetValue']]['connection'] = aConnection; | 223 | this.tolls()[aResponse['toll']['targetValue']]['connection'] = aConnection; |
228 | } | 224 | } |
229 | } | 225 | } |
230 | }, | 226 | }, |
231 | 227 | ||
232 | //========================================================================= | 228 | //========================================================================= |
233 | 229 | ||
234 | 'processMessage': function (aFunctionName, someParameters) { | 230 | 'processMessage': function (aFunctionName, someParameters) { |
235 | var result; | 231 | var result; |
236 | varconnection; | 232 | varconnection; |
237 | 233 | ||
238 | connection = this.getConnectionForRequest(aFunctionName, someParameters); | 234 | connection = this.getConnectionForRequest(aFunctionName, someParameters); |
239 | 235 | ||
240 | switch(aFunctionName) { | 236 | switch(aFunctionName) { |
241 | case 'knock': | 237 | case 'knock': |
242 | result = this._knock(connection, someParameters); | 238 | result = this._knock(connection, someParameters); |
243 | break; | 239 | break; |
244 | case 'registration': | 240 | case 'registration': |
245 | this.checkToll(aFunctionName, someParameters); | 241 | this.checkToll(aFunctionName, someParameters); |
246 | result = this._registration(connection, someParameters.parameters); | 242 | result = this._registration(connection, someParameters.parameters); |
247 | break; | 243 | break; |
248 | case 'handshake': | 244 | case 'handshake': |
249 | this.checkToll(aFunctionName, someParameters); | 245 | this.checkToll(aFunctionName, someParameters); |
250 | result = this._handshake(connection, someParameters.parameters); | 246 | result = this._handshake(connection, someParameters.parameters); |
251 | break; | 247 | break; |
252 | case 'message': | 248 | case 'message': |
253 | this.checkToll(aFunctionName, someParameters); | 249 | this.checkToll(aFunctionName, someParameters); |
254 | result = this._message(connection, someParameters.parameters); | 250 | result = this._message(connection, someParameters.parameters); |
255 | break; | 251 | break; |
256 | case 'logout': | 252 | case 'logout': |
257 | this._currentStaticConnection = null; | 253 | this._currentStaticConnection = null; |
258 | result = this._logout(connection, someParameters.parameters); | 254 | result = this._logout(connection, someParameters.parameters); |
259 | break; | 255 | break; |
260 | } | 256 | } |
261 | 257 | ||
262 | this.storeConnectionForRequestWithConnectionAndResponse(aFunctionName, someParameters, connection, result); | 258 | this.storeConnectionForRequestWithConnectionAndResponse(aFunctionName, someParameters, connection, result); |
263 | 259 | ||
264 | return MochiKit.Async.succeed(result); | 260 | return MochiKit.Async.succeed(result); |
265 | }, | 261 | }, |
266 | 262 | ||
267 | //========================================================================= | 263 | //========================================================================= |
268 | 264 | ||
269 | '_knock': function(aConnection, someParameters) { | 265 | '_knock': function(aConnection, someParameters) { |
270 | var result; | 266 | var result; |
271 | 267 | ||
272 | result = { | 268 | result = { |
273 | toll: this.getTollForRequestType(someParameters['requestType']) | 269 | toll: this.getTollForRequestType(someParameters['requestType']) |
274 | } | 270 | } |
275 | 271 | ||
276 | return result; | 272 | return result; |
277 | }, | 273 | }, |
278 | 274 | ||
279 | //------------------------------------------------------------------------- | 275 | //------------------------------------------------------------------------- |
280 | 276 | ||
281 | '_registration': function(aConnection, someParameters) { | 277 | '_registration': function(aConnection, someParameters) { |
282 | if (this.isReadOnly() == false) { | 278 | if (this.isReadOnly() == false) { |
283 | if (typeof(this.data()['users'][someParameters['credentials']['C']]) == 'undefined') { | 279 | if (typeof(this.data()['users'][someParameters['credentials']['C']]) == 'undefined') { |
284 | this.data()['users'][someParameters['credentials']['C']] = { | 280 | this.data()['users'][someParameters['credentials']['C']] = { |
285 | 's': someParameters['credentials']['s'], | 281 | 's': someParameters['credentials']['s'], |
286 | 'v': someParameters['credentials']['v'], | 282 | 'v': someParameters['credentials']['v'], |
287 | 'version':someParameters['credentials']['version'], | 283 | 'version':someParameters['credentials']['version'], |
288 | 'lock': Clipperz.Crypto.Base.generateRandomSeed(), | 284 | 'lock': Clipperz.Crypto.Base.generateRandomSeed(), |
289 | 'userDetails': someParameters['user']['header'], | 285 | 'userDetails': someParameters['user']['header'], |
290 | 'statistics': someParameters['user']['statistics'], | 286 | 'statistics': someParameters['user']['statistics'], |
291 | 'userDetailsVersion':someParameters['user']['version'], | 287 | 'userDetailsVersion':someParameters['user']['version'], |
292 | 'records':{} | 288 | 'records':{} |
293 | } | 289 | } |
294 | } else { | 290 | } else { |
295 | throw "user already exists"; | 291 | throw "user already exists"; |
296 | } | 292 | } |
297 | } else { | 293 | } else { |
298 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; | 294 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; |
299 | } | 295 | } |
300 | 296 | ||
301 | result = { | 297 | result = { |
302 | result: { | 298 | result: { |
303 | 'lock': this.data()['users'][someParameters['credentials']['C']]['lock'], | 299 | 'lock': this.data()['users'][someParameters['credentials']['C']]['lock'], |
304 | 'result':'done' | 300 | 'result':'done' |
305 | }, | 301 | }, |
306 | toll: this.getTollForRequestType('CONNECT') | 302 | toll: this.getTollForRequestType('CONNECT') |
307 | } | 303 | } |
308 | 304 | ||
309 | return result; | 305 | return result; |
310 | }, | 306 | }, |
311 | 307 | ||
312 | //------------------------------------------------------------------------- | 308 | //------------------------------------------------------------------------- |
313 | 309 | ||
314 | '_handshake': function(aConnection, someParameters) { | 310 | '_handshake': function(aConnection, someParameters) { |
315 | var result; | 311 | var result; |
316 | varnextTollRequestType; | 312 | varnextTollRequestType; |
317 | 313 | ||
318 | result = {}; | 314 | result = {}; |
319 | if (someParameters.message == "connect") { | 315 | if (someParameters.message == "connect") { |
320 | var userData; | 316 | var userData; |
321 | var randomBytes; | 317 | var randomBytes; |
322 | var v; | 318 | var v; |
323 | 319 | ||
324 | userData = this.data()['users'][someParameters.parameters.C]; | 320 | userData = this.data()['users'][someParameters.parameters.C]; |
325 | 321 | ||
326 | if ((typeof(userData) != 'undefined') && (userData['version'] == someParameters.version)) { | 322 | if ((typeof(userData) != 'undefined') && (userData['version'] == someParameters.version)) { |
327 | aConnection['userData'] = userData; | 323 | aConnection['userData'] = userData; |
328 | aConnection['C'] = someParameters.parameters.C; | 324 | aConnection['C'] = someParameters.parameters.C; |
329 | } else { | 325 | } else { |
330 | aConnection['userData'] = this.data()['users']['catchAllUser']; | 326 | aConnection['userData'] = this.data()['users']['catchAllUser']; |
331 | } | 327 | } |
332 | 328 | ||
333 | randomBytes = Clipperz.Crypto.Base.generateRandomSeed(); | 329 | randomBytes = Clipperz.Crypto.Base.generateRandomSeed(); |
334 | aConnection['b'] = new Clipperz.Crypto.BigInt(randomBytes, 16); | 330 | aConnection['b'] = new Clipperz.Crypto.BigInt(randomBytes, 16); |
335 | v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16); | 331 | v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16); |
336 | aConnection['B'] = v.add(Clipperz.Crypto.SRP.g().powerModule(aConnection['b'], Clipperz.Crypto.SRP.n())); | 332 | aConnection['B'] = v.add(Clipperz.Crypto.SRP.g().powerModule(aConnection['b'], Clipperz.Crypto.SRP.n())); |
337 | 333 | ||
338 | aConnection['A'] = someParameters.parameters.A; | 334 | aConnection['A'] = someParameters.parameters.A; |
339 | 335 | ||
340 | result['s'] = aConnection['userData']['s']; | 336 | result['s'] = aConnection['userData']['s']; |
341 | result['B'] = aConnection['B'].asString(16); | 337 | result['B'] = aConnection['B'].asString(16); |
342 | 338 | ||
343 | nextTollRequestType = 'CONNECT'; | 339 | nextTollRequestType = 'CONNECT'; |
344 | } else if (someParameters.message == "credentialCheck") { | 340 | } else if (someParameters.message == "credentialCheck") { |
345 | var v, u, S, A, K, M1; | 341 | var v, u, S, A, K, M1; |
346 | 342 | ||
347 | v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16); | 343 | v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16); |
348 | u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(aConnection['B'].asString(10))).toHexString(), 16); | 344 | u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(aConnection['B'].asString(10))).toHexString(), 16); |
349 | A = new Clipperz.Crypto.BigInt(aConnection['A'], 16); | 345 | A = new Clipperz.Crypto.BigInt(aConnection['A'], 16); |
350 | S = (A.multiply(v.powerModule(u, Clipperz.Crypto.SRP.n()))).powerModule(aConnection['b'], Clipperz.Crypto.SRP.n()); | 346 | S = (A.multiply(v.powerModule(u, Clipperz.Crypto.SRP.n()))).powerModule(aConnection['b'], Clipperz.Crypto.SRP.n()); |
351 | 347 | ||
352 | K = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(S.asString(10))).toHexString().slice(2); | 348 | K = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(S.asString(10))).toHexString().slice(2); |
353 | 349 | ||
354 | M1 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + aConnection['B'].asString(10) + K)).toHexString().slice(2); | 350 | M1 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + aConnection['B'].asString(10) + K)).toHexString().slice(2); |
355 | if (someParameters.parameters.M1 == M1) { | 351 | if (someParameters.parameters.M1 == M1) { |
356 | var M2; | 352 | var M2; |
357 | 353 | ||
358 | M2 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + someParameters.parameters.M1 + K)).toHexString().slice(2); | 354 | M2 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + someParameters.parameters.M1 + K)).toHexString().slice(2); |
359 | result['M2'] = M2; | 355 | result['M2'] = M2; |
360 | } else { | 356 | } else { |
361 | throw new Error("Client checksum verification failed! Expected <" + M1 + ">, received <" + someParameters.parameters.M1 + ">.", "Error"); | 357 | throw new Error("Client checksum verification failed! Expected <" + M1 + ">, received <" + someParameters.parameters.M1 + ">.", "Error"); |
362 | } | 358 | } |
363 | 359 | ||
364 | nextTollRequestType = 'MESSAGE'; | 360 | nextTollRequestType = 'MESSAGE'; |
365 | } else if (someParameters.message == "oneTimePassword") { | 361 | } else if (someParameters.message == "oneTimePassword") { |
366 | var otpData; | 362 | var otpData; |
367 | 363 | ||
368 | otpData = this.data()['onetimePasswords'][someParameters.parameters.oneTimePasswordKey]; | 364 | otpData = this.data()['onetimePasswords'][someParameters.parameters.oneTimePasswordKey]; |
369 | 365 | ||
370 | try { | 366 | try { |
371 | if (typeof(otpData) != 'undefined') { | 367 | if (typeof(otpData) != 'undefined') { |
372 | if (otpData['status'] == 'ACTIVE') { | 368 | if (otpData['status'] == 'ACTIVE') { |
373 | if (otpData['key_checksum'] == someParameters.parameters.oneTimePasswordKeyChecksum) { | 369 | if (otpData['key_checksum'] == someParameters.parameters.oneTimePasswordKeyChecksum) { |
374 | result = { | 370 | result = { |
375 | 'data': otpData['data'], | 371 | 'data': otpData['data'], |
376 | 'version':otpData['version'] | 372 | 'version':otpData['version'] |
377 | } | 373 | } |
378 | 374 | ||
379 | otpData['status'] = 'REQUESTED'; | 375 | otpData['status'] = 'REQUESTED'; |
380 | } else { | 376 | } else { |
381 | otpData['status'] = 'DISABLED'; | 377 | otpData['status'] = 'DISABLED'; |
382 | throw "The requested One Time Password has been disabled, due to a wrong keyChecksum"; | 378 | throw "The requested One Time Password has been disabled, due to a wrong keyChecksum"; |
383 | } | 379 | } |
384 | } else { | 380 | } else { |
385 | throw "The requested One Time Password was not active"; | 381 | throw "The requested One Time Password was not active"; |
386 | } | 382 | } |
387 | } else { | 383 | } else { |
388 | throw "The requested One Time Password has not been found" | 384 | throw "The requested One Time Password has not been found" |
389 | } | 385 | } |
390 | } catch (exception) { | 386 | } catch (exception) { |
391 | result = { | 387 | result = { |
392 | 'data': Clipperz.PM.Crypto.randomKey(), | 388 | 'data': Clipperz.PM.Crypto.randomKey(), |
393 | 'version':Clipperz.PM.Connection.communicationProtocol.currentVersion | 389 | 'version':Clipperz.PM.Connection.communicationProtocol.currentVersion |
394 | } | 390 | } |
395 | } | 391 | } |
396 | nextTollRequestType = 'CONNECT'; | 392 | nextTollRequestType = 'CONNECT'; |
397 | } else { | 393 | } else { |
398 | MochiKit.Logging.logError("Clipperz.PM.Proxy.Test.handshake - unhandled message: " + someParameters.message); | 394 | Clipperz.logError("Clipperz.PM.Proxy.Test.handshake - unhandled message: " + someParameters.message); |
399 | } | 395 | } |
400 | 396 | ||
401 | result = { | 397 | result = { |
402 | result: result, | 398 | result: result, |
403 | toll: this.getTollForRequestType(nextTollRequestType) | 399 | toll: this.getTollForRequestType(nextTollRequestType) |
404 | } | 400 | } |
405 | 401 | ||
406 | return result; | 402 | return result; |
407 | }, | 403 | }, |
408 | 404 | ||
409 | //------------------------------------------------------------------------- | 405 | //------------------------------------------------------------------------- |
410 | 406 | ||
411 | '_message': function(aConnection, someParameters) { | 407 | '_message': function(aConnection, someParameters) { |
412 | var result; | 408 | var result; |
413 | 409 | ||
414 | result = {}; | 410 | result = {}; |
415 | 411 | ||
416 | //===================================================================== | 412 | //===================================================================== |
417 | // | 413 | // |
418 | // R E A D - O N L Y M e t h o d s | 414 | // R E A D - O N L Y M e t h o d s |
419 | // | 415 | // |
420 | //===================================================================== | 416 | //===================================================================== |
421 | if (someParameters.message == 'getUserDetails') { | 417 | if (someParameters.message == 'getUserDetails') { |
422 | var recordsStats; | 418 | var recordsStats; |
423 | var recordReference; | 419 | var recordReference; |
424 | 420 | ||
425 | recordsStats = {}; | 421 | recordsStats = {}; |
426 | for (recordReference in aConnection['userData']['records']) { | 422 | for (recordReference in aConnection['userData']['records']) { |
427 | recordsStats[recordReference] = { | 423 | recordsStats[recordReference] = { |
428 | 'updateDate': aConnection['userData']['records'][recordReference]['updateDate'] | 424 | 'updateDate': aConnection['userData']['records'][recordReference]['updateDate'] |
429 | } | 425 | } |
430 | } | 426 | } |
431 | 427 | ||
432 | result['header'] = this.userDetails(aConnection); | 428 | result['header'] = this.userDetails(aConnection); |
433 | result['statistics'] = this.statistics(aConnection); | 429 | result['statistics'] = this.statistics(aConnection); |
434 | result['maxNumberOfRecords'] = aConnection['userData']['maxNumberOfRecords']; | 430 | result['maxNumberOfRecords'] = aConnection['userData']['maxNumberOfRecords']; |
435 | result['version'] = aConnection['userData']['userDetailsVersion']; | 431 | result['version'] = aConnection['userData']['userDetailsVersion']; |
436 | result['recordsStats'] = recordsStats; | 432 | result['recordsStats'] = recordsStats; |
437 | 433 | ||
438 | if (this.isReadOnly() == false) { | 434 | if (this.isReadOnly() == false) { |
439 | varlock; | 435 | varlock; |
440 | 436 | ||
441 | if (typeof(aConnection['userData']['lock']) == 'undefined') { | 437 | if (typeof(aConnection['userData']['lock']) == 'undefined') { |
442 | aConnection['userData']['lock'] = "<<LOCK>>"; | 438 | aConnection['userData']['lock'] = "<<LOCK>>"; |
443 | } | 439 | } |
444 | 440 | ||
445 | result['lock'] = aConnection['userData']['lock']; | 441 | result['lock'] = aConnection['userData']['lock']; |
446 | } | 442 | } |
447 | 443 | ||
448 | //===================================================================== | 444 | //===================================================================== |
449 | } else if (someParameters.message == 'getRecordDetail') { | 445 | } else if (someParameters.message == 'getRecordDetail') { |
450 | /* | 446 | /* |
451 | varrecordData; | 447 | varrecordData; |
452 | var currentVersionData; | 448 | var currentVersionData; |
453 | 449 | ||
454 | recordData = this.userData()['records'][someParameters['parameters']['reference']]; | 450 | recordData = this.userData()['records'][someParameters['parameters']['reference']]; |
455 | result['reference'] = someParameters['parameters']['reference']; | 451 | result['reference'] = someParameters['parameters']['reference']; |
456 | result['data'] = recordData['data']; | 452 | result['data'] = recordData['data']; |
457 | result['version'] = recordData['version']; | 453 | result['version'] = recordData['version']; |
458 | result['creationData'] = recordData['creationDate']; | 454 | result['creationData'] = recordData['creationDate']; |
459 | result['updateDate'] = recordData['updateDate']; | 455 | result['updateDate'] = recordData['updateDate']; |
460 | result['accessDate'] = recordData['accessDate']; | 456 | result['accessDate'] = recordData['accessDate']; |
461 | 457 | ||
462 | currentVersionData = recordData['versions'][recordData['currentVersion']]; | 458 | currentVersionData = recordData['versions'][recordData['currentVersion']]; |
463 | 459 | ||
464 | result['currentVersion'] = {}; | 460 | result['currentVersion'] = {}; |
465 | result['currentVersion']['reference'] = recordData['currentVersion']; | 461 | result['currentVersion']['reference'] = recordData['currentVersion']; |
466 | result['currentVersion']['version'] = currentVersionData['version']; | 462 | result['currentVersion']['version'] = currentVersionData['version']; |
467 | result['currentVersion']['header'] = currentVersionData['header']; | 463 | result['currentVersion']['header'] = currentVersionData['header']; |
468 | result['currentVersion']['data'] = currentVersionData['data']; | 464 | result['currentVersion']['data'] = currentVersionData['data']; |
469 | result['currentVersion']['creationData'] = currentVersionData['creationDate']; | 465 | result['currentVersion']['creationData'] = currentVersionData['creationDate']; |
470 | result['currentVersion']['updateDate'] = currentVersionData['updateDate']; | 466 | result['currentVersion']['updateDate'] = currentVersionData['updateDate']; |
471 | result['currentVersion']['accessDate'] = currentVersionData['accessDate']; | 467 | result['currentVersion']['accessDate'] = currentVersionData['accessDate']; |
472 | if (typeof(currentVersionData['previousVersion']) != 'undefined') { | 468 | if (typeof(currentVersionData['previousVersion']) != 'undefined') { |
473 | result['currentVersion']['previousVersionKey'] = currentVersionData['previousVersionKey']; | 469 | result['currentVersion']['previousVersionKey'] = currentVersionData['previousVersionKey']; |
474 | result['currentVersion']['previousVersion'] = currentVersionData['previousVersion']; | 470 | result['currentVersion']['previousVersion'] = currentVersionData['previousVersion']; |
475 | } | 471 | } |
476 | */ | 472 | */ |
477 | MochiKit.Base.update(result, aConnection['userData']['records'][someParameters['parameters']['reference']]); | 473 | MochiKit.Base.update(result, aConnection['userData']['records'][someParameters['parameters']['reference']]); |
478 | result['reference'] = someParameters['parameters']['reference']; | 474 | result['reference'] = someParameters['parameters']['reference']; |
479 | 475 | ||
480 | //===================================================================== | 476 | //===================================================================== |
481 | // | 477 | // |
482 | // R E A D - W R I T E M e t h o d s | 478 | // R E A D - W R I T E M e t h o d s |
483 | // | 479 | // |
484 | //===================================================================== | 480 | //===================================================================== |
485 | } else if (someParameters.message == 'upgradeUserCredentials') { | 481 | } else if (someParameters.message == 'upgradeUserCredentials') { |
486 | if (this.isReadOnly() == false) { | 482 | if (this.isReadOnly() == false) { |
487 | var parameters; | 483 | var parameters; |
488 | var credentials; | 484 | var credentials; |
489 | 485 | ||
490 | parameters = someParameters['parameters']; | 486 | parameters = someParameters['parameters']; |
491 | credentials = parameters['credentials']; | 487 | credentials = parameters['credentials']; |
492 | 488 | ||
493 | if ((credentials['C'] == null) | 489 | if ((credentials['C'] == null) |
494 | ||(credentials['s'] == null) | 490 | ||(credentials['s'] == null) |
495 | ||(credentials['v'] == null) | 491 | ||(credentials['v'] == null) |
496 | ||(credentials['version'] != Clipperz.PM.Connection.communicationProtocol.currentVersion) | 492 | ||(credentials['version'] != Clipperz.PM.Connection.communicationProtocol.currentVersion) |
497 | ) { | 493 | ) { |
498 | result = Clipperz.PM.DataModel.User.exception.CredentialUpgradeFailed; | 494 | result = Clipperz.PM.DataModel.User.exception.CredentialUpgradeFailed; |
499 | } else { | 495 | } else { |
500 | varoldCValue; | 496 | varoldCValue; |
501 | oldCValue = aConnection['C']; | 497 | oldCValue = aConnection['C']; |
502 | 498 | ||
503 | this.data()['users'][credentials['C']] = aConnection['userData']; | 499 | this.data()['users'][credentials['C']] = aConnection['userData']; |
504 | aConnection['C'] = credentials['C']; | 500 | aConnection['C'] = credentials['C']; |
505 | 501 | ||
506 | aConnection['userData']['s'] = credentials['s']; | 502 | aConnection['userData']['s'] = credentials['s']; |
507 | aConnection['userData']['v'] = credentials['v']; | 503 | aConnection['userData']['v'] = credentials['v']; |
508 | aConnection['userData']['version'] = credentials['version']; | 504 | aConnection['userData']['version'] = credentials['version']; |
509 | 505 | ||
510 | aConnection['userData']['userDetails'] = parameters['user']['header']; | 506 | aConnection['userData']['userDetails'] = parameters['user']['header']; |
511 | aConnection['userData']['userDetailsVersion'] = parameters['user']['version']; | 507 | aConnection['userData']['userDetailsVersion'] = parameters['user']['version']; |
512 | aConnection['userData']['statistics'] = parameters['user']['statistics']; | 508 | aConnection['userData']['statistics'] = parameters['user']['statistics']; |
513 | 509 | ||
514 | aConnection['userData']['lock'] = parameters['user']['lock']; | 510 | aConnection['userData']['lock'] = parameters['user']['lock']; |
515 | 511 | ||
516 | delete this.data()['users'][oldCValue]; | 512 | delete this.data()['users'][oldCValue]; |
517 | 513 | ||
518 | result = {result:"done", parameters:parameters}; | 514 | result = {result:"done", parameters:parameters}; |
519 | } | 515 | } |
520 | } else { | 516 | } else { |
521 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; | 517 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; |
522 | } | 518 | } |
523 | //===================================================================== | 519 | //===================================================================== |
524 | /* } else if (someParameters.message == 'updateData') { | 520 | /* } else if (someParameters.message == 'updateData') { |
525 | if (this.isReadOnly() == false) { | 521 | if (this.isReadOnly() == false) { |
526 | var i, c; | 522 | var i, c; |
527 | 523 | ||
528 | //console.log("###==============================================================="); | ||
529 | //console.log("###>>>", Clipperz.Base.serializeJSON(someParameters)); | ||
530 | //console.log("###--- userData", Clipperz.Base.serializeJSON(this.userData())); | ||
531 | if (this.userData()['lock']!= someParameters['parameters']['user']['lock']) { | 524 | if (this.userData()['lock']!= someParameters['parameters']['user']['lock']) { |
532 | throw "the lock attribute is not processed correctly" | 525 | throw "the lock attribute is not processed correctly" |
533 | } | 526 | } |
534 | 527 | ||
535 | this.userData()['userDetails'] = someParameters['parameters']['user']['header']; | 528 | this.userData()['userDetails'] = someParameters['parameters']['user']['header']; |
536 | this.userData()['statistics'] = someParameters['parameters']['user']['statistics']; | 529 | this.userData()['statistics'] = someParameters['parameters']['user']['statistics']; |
537 | this.userData()['userDetailsVersions']= someParameters['parameters']['user']['version']; | 530 | this.userData()['userDetailsVersions']= someParameters['parameters']['user']['version']; |
538 | 531 | ||
539 | c = someParameters['parameters']['records'].length; | 532 | c = someParameters['parameters']['records'].length; |
540 | for (i=0; i<c; i++) { | 533 | for (i=0; i<c; i++) { |
541 | var currentRecord; | 534 | var currentRecord; |
542 | var currentRecordData; | 535 | var currentRecordData; |
543 | 536 | ||
544 | currentRecordData = someParameters['parameters']['records'][i]; | 537 | currentRecordData = someParameters['parameters']['records'][i]; |
545 | currentRecord = this.userData()['records'][currentRecordData['record']['reference']]; | 538 | currentRecord = this.userData()['records'][currentRecordData['record']['reference']]; |
546 | 539 | ||
547 | if (currentRecord == null) { | 540 | if (currentRecord == null) { |
548 | } | 541 | } |
549 | 542 | ||
550 | currentRecord['data'] = currentRecordData['record']['data']; | 543 | currentRecord['data'] = currentRecordData['record']['data']; |
551 | currentRecord['version'] = currentRecordData['record']['version']; | 544 | currentRecord['version'] = currentRecordData['record']['version']; |
552 | currentRecord['currentVersion'] = currentRecordData['currentRecordVersion']['reference']; | 545 | currentRecord['currentVersion'] = currentRecordData['currentRecordVersion']['reference']; |
553 | 546 | ||
554 | currentRecord['versions'][currentRecordData['currentRecordVersion']['reference']] = { | 547 | currentRecord['versions'][currentRecordData['currentRecordVersion']['reference']] = { |
555 | 'data': currentRecordData['currentRecordVersion']['data'], | 548 | 'data': currentRecordData['currentRecordVersion']['data'], |
556 | 'version': currentRecordData['currentRecordVersion']['version'], | 549 | 'version': currentRecordData['currentRecordVersion']['version'], |
557 | 'previousVersion': currentRecordData['currentRecordVersion']['previousVersion'], | 550 | 'previousVersion': currentRecordData['currentRecordVersion']['previousVersion'], |
558 | 'previousVersionKey':currentRecordData['currentRecordVersion']['previousVersionKey'] | 551 | 'previousVersionKey':currentRecordData['currentRecordVersion']['previousVersionKey'] |
559 | } | 552 | } |
560 | } | 553 | } |
561 | 554 | ||
562 | this.userData()['lock'] = Clipperz.PM.Crypto.randomKey(); | 555 | this.userData()['lock'] = Clipperz.PM.Crypto.randomKey(); |
563 | result['lock'] = this.userData()['lock']; | 556 | result['lock'] = this.userData()['lock']; |
564 | result['result'] = 'done'; | 557 | result['result'] = 'done'; |
565 | //console.log("###<<< userData", Clipperz.Base.serializeJSON(this.userData())); | ||
566 | } else { | 558 | } else { |
567 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; | 559 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; |
568 | } | 560 | } |
569 | */ //===================================================================== | 561 | */ //===================================================================== |
570 | } else if (someParameters.message == 'saveChanges') { | 562 | } else if (someParameters.message == 'saveChanges') { |
571 | if (this.isReadOnly() == false) { | 563 | if (this.isReadOnly() == false) { |
572 | var i, c; | 564 | var i, c; |
573 | 565 | ||
574 | //console.log("###==============================================================="); | ||
575 | //console.log("###>>>", someParameters); | ||
576 | //console.log("###>>>", Clipperz.Base.serializeJSON(someParameters)); | ||
577 | //console.log("###--- userData", Clipperz.Base.serializeJSON(this.userData())); | ||
578 | //console.log("###==============================================================="); | ||
579 | //console.log("--- userData.lock ", this.userData()['lock']); | ||
580 | //console.log("--- parameters.lock", someParameters['parameters']['user']['lock']); | ||
581 | if (aConnection['userData']['lock']!= someParameters['parameters']['user']['lock']) { | 566 | if (aConnection['userData']['lock']!= someParameters['parameters']['user']['lock']) { |
582 | throw "the lock attribute is not processed correctly" | 567 | throw "the lock attribute is not processed correctly" |
583 | } | 568 | } |
584 | 569 | ||
585 | aConnection['userData']['userDetails'] = someParameters['parameters']['user']['header']; | 570 | aConnection['userData']['userDetails'] = someParameters['parameters']['user']['header']; |
586 | aConnection['userData']['statistics'] = someParameters['parameters']['user']['statistics']; | 571 | aConnection['userData']['statistics'] = someParameters['parameters']['user']['statistics']; |
587 | aConnection['userData']['userDetailsVersions']= someParameters['parameters']['user']['version']; | 572 | aConnection['userData']['userDetailsVersions']= someParameters['parameters']['user']['version']; |
588 | 573 | ||
589 | c = someParameters['parameters']['records']['updated'].length; | 574 | c = someParameters['parameters']['records']['updated'].length; |
590 | for (i=0; i<c; i++) { | 575 | for (i=0; i<c; i++) { |
591 | var currentRecord; | 576 | var currentRecord; |
592 | var currentRecordData; | 577 | var currentRecordData; |
593 | 578 | ||
594 | currentRecordData = someParameters['parameters']['records']['updated'][i]; | 579 | currentRecordData = someParameters['parameters']['records']['updated'][i]; |
595 | currentRecord = aConnection['userData']['records'][currentRecordData['record']['reference']]; | 580 | currentRecord = aConnection['userData']['records'][currentRecordData['record']['reference']]; |
596 | 581 | ||
597 | if ( | 582 | if ( |
598 | (typeof(aConnection['userData']['records'][currentRecordData['record']['reference']]) == 'undefined') | 583 | (typeof(aConnection['userData']['records'][currentRecordData['record']['reference']]) == 'undefined') |
599 | && | 584 | && |
600 | (typeof(currentRecordData['currentRecordVersion']) == 'undefined') | 585 | (typeof(currentRecordData['currentRecordVersion']) == 'undefined') |
601 | ) { | 586 | ) { |
602 | //console.log("######## SHIT HAPPENS"); | ||
603 | throw "Record added without a recordVersion"; | 587 | throw "Record added without a recordVersion"; |
604 | } | 588 | } |
605 | 589 | ||
606 | if (currentRecord == null) { | 590 | if (currentRecord == null) { |
607 | currentRecord = {}; | 591 | currentRecord = {}; |
608 | currentRecord['versions'] = {}; | 592 | currentRecord['versions'] = {}; |
609 | currentRecord['creationDate']= Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); | 593 | currentRecord['creationDate']= Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); |
610 | currentRecord['accessDate'] = Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); | 594 | currentRecord['accessDate'] = Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); |
611 | 595 | ||
612 | aConnection['userData']['records'][currentRecordData['record']['reference']] = currentRecord; | 596 | aConnection['userData']['records'][currentRecordData['record']['reference']] = currentRecord; |
613 | } | 597 | } |
614 | 598 | ||
615 | currentRecord['data'] = currentRecordData['record']['data']; | 599 | currentRecord['data'] = currentRecordData['record']['data']; |
616 | currentRecord['version']= currentRecordData['record']['version']; | 600 | currentRecord['version']= currentRecordData['record']['version']; |
617 | currentRecord['updateDate']= Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); | 601 | currentRecord['updateDate']= Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); |
618 | 602 | ||
619 | if (typeof(currentRecordData['currentRecordVersion']) != 'undefined') { | 603 | if (typeof(currentRecordData['currentRecordVersion']) != 'undefined') { |
620 | currentRecord['currentVersion'] = currentRecordData['currentRecordVersion']['reference']; | 604 | currentRecord['currentVersion'] = currentRecordData['currentRecordVersion']['reference']; |
621 | currentRecord['versions'][currentRecordData['currentRecordVersion']['reference']] = { | 605 | currentRecord['versions'][currentRecordData['currentRecordVersion']['reference']] = { |
622 | 'data': currentRecordData['currentRecordVersion']['data'], | 606 | 'data': currentRecordData['currentRecordVersion']['data'], |
623 | 'version': currentRecordData['currentRecordVersion']['version'], | 607 | 'version': currentRecordData['currentRecordVersion']['version'], |
624 | 'previousVersion': currentRecordData['currentRecordVersion']['previousVersion'], | 608 | 'previousVersion': currentRecordData['currentRecordVersion']['previousVersion'], |
625 | 'previousVersionKey':currentRecordData['currentRecordVersion']['previousVersionKey'], | 609 | 'previousVersionKey':currentRecordData['currentRecordVersion']['previousVersionKey'], |
626 | 'creationDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date()), | 610 | 'creationDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date()), |
627 | 'updateDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date()), | 611 | 'updateDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date()), |
628 | 'accessDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date()) | 612 | 'accessDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date()) |
629 | } | 613 | } |
630 | } | 614 | } |
631 | } | 615 | } |
632 | 616 | ||
633 | c = someParameters['parameters']['records']['deleted'].length; | 617 | c = someParameters['parameters']['records']['deleted'].length; |
634 | for (i=0; i<c; i++) { | 618 | for (i=0; i<c; i++) { |
635 | var currentRecordReference; | 619 | var currentRecordReference; |
636 | 620 | ||
637 | currentRecordReference = someParameters['parameters']['records']['deleted'][i]; | 621 | currentRecordReference = someParameters['parameters']['records']['deleted'][i]; |
638 | //console.log("DELETING records", currentRecordReference); | ||
639 | delete aConnection['userData']['records'][currentRecordReference]; | 622 | delete aConnection['userData']['records'][currentRecordReference]; |
640 | } | 623 | } |
641 | 624 | ||
642 | aConnection['userData']['lock'] = Clipperz.PM.Crypto.randomKey(); | 625 | aConnection['userData']['lock'] = Clipperz.PM.Crypto.randomKey(); |
643 | result['lock'] = aConnection['userData']['lock']; | 626 | result['lock'] = aConnection['userData']['lock']; |
644 | result['result'] = 'done'; | 627 | result['result'] = 'done'; |
645 | //console.log("###<<< userData", Clipperz.Base.serializeJSON(this.userData())); | ||
646 | } else { | 628 | } else { |
647 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; | 629 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; |
648 | } | 630 | } |
649 | 631 | ||
650 | //===================================================================== | 632 | //===================================================================== |
651 | // | 633 | // |
652 | // U N H A N D L E D M e t h o d | 634 | // U N H A N D L E D M e t h o d |
653 | // | 635 | // |
654 | //===================================================================== | 636 | //===================================================================== |
655 | } else { | 637 | } else { |
656 | MochiKit.Logging.logError("Clipperz.PM.Proxy.Test.message - unhandled message: " + someParameters.message); | 638 | Clipperz.logError("Clipperz.PM.Proxy.Test.message - unhandled message: " + someParameters.message); |
657 | } | 639 | } |
658 | 640 | ||
659 | result = { | 641 | result = { |
660 | result: result, | 642 | result: result, |
661 | toll: this.getTollForRequestType('MESSAGE') | 643 | toll: this.getTollForRequestType('MESSAGE') |
662 | } | 644 | } |
663 | 645 | ||
664 | // return MochiKit.Async.succeed(result); | 646 | // return MochiKit.Async.succeed(result); |
665 | return result; | 647 | return result; |
666 | }, | 648 | }, |
667 | 649 | ||
668 | //------------------------------------------------------------------------- | 650 | //------------------------------------------------------------------------- |
669 | 651 | ||
670 | '_logout': function(someParameters) { | 652 | '_logout': function(someParameters) { |
671 | // return MochiKit.Async.succeed({result: 'done'}); | 653 | // return MochiKit.Async.succeed({result: 'done'}); |
672 | return {result: 'done'}; | 654 | return {result: 'done'}; |
673 | }, | 655 | }, |
674 | 656 | ||
675 | //========================================================================= | 657 | //========================================================================= |
676 | //######################################################################### | 658 | //######################################################################### |
677 | 659 | ||
678 | 'isTestData': function(aConnection) { | 660 | 'isTestData': function(aConnection) { |
679 | return (typeof(aConnection['userData']['__masterkey_test_value__']) != 'undefined'); | 661 | return (typeof(aConnection['userData']['__masterkey_test_value__']) != 'undefined'); |
680 | }, | 662 | }, |
681 | 663 | ||
682 | 'userDetails': function(aConnection) { | 664 | 'userDetails': function(aConnection) { |
683 | var result; | 665 | var result; |
684 | 666 | ||
685 | if (this.isTestData(aConnection)) { | 667 | if (this.isTestData(aConnection)) { |
686 | var serializedHeader; | 668 | var serializedHeader; |
687 | var version; | 669 | var version; |
688 | 670 | ||
689 | //MochiKit.Logging.logDebug("### test data"); | 671 | //Clipperz.logDebug("### test data"); |
690 | version = aConnection['userData']['userDetailsVersion']; | 672 | version = aConnection['userData']['userDetailsVersion']; |
691 | serializedHeader = Clipperz.Base.serializeJSON(aConnection['userData']['userDetails']); | 673 | serializedHeader = Clipperz.Base.serializeJSON(aConnection['userData']['userDetails']); |
692 | result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(aConnection['userData']['__masterkey_test_value__'], serializedHeader); | 674 | result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(aConnection['userData']['__masterkey_test_value__'], serializedHeader); |
693 | } else { | 675 | } else { |
694 | //MochiKit.Logging.logDebug("### NOT test data"); | 676 | //Clipperz.logDebug("### NOT test data"); |
695 | result = aConnection['userData']['userDetails']; | 677 | result = aConnection['userData']['userDetails']; |
696 | } | 678 | } |
697 | 679 | ||
698 | return result; | 680 | return result; |
699 | }, | 681 | }, |
700 | 682 | ||
701 | 'statistics': function(aConnection) { | 683 | 'statistics': function(aConnection) { |
702 | var result; | 684 | var result; |
703 | 685 | ||
704 | if (aConnection['userData']['statistics'] != null) { | 686 | if (aConnection['userData']['statistics'] != null) { |
705 | if (this.isTestData(aConnection)) { | 687 | if (this.isTestData(aConnection)) { |
706 | var serializedStatistics; | 688 | var serializedStatistics; |
707 | var version; | 689 | var version; |
708 | 690 | ||
709 | version = aConnection['userData']['userDetailsVersion']; | 691 | version = aConnection['userData']['userDetailsVersion']; |
710 | serializedStatistics = Clipperz.Base.serializeJSON(aConnection['userData']['statistics']); | 692 | serializedStatistics = Clipperz.Base.serializeJSON(aConnection['userData']['statistics']); |
711 | result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(aConnection['userData']['__masterkey_test_value__'], serializedStatistics); | 693 | result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(aConnection['userData']['__masterkey_test_value__'], serializedStatistics); |
712 | } else { | 694 | } else { |
713 | result = aConnection['userData']['statistics']; | 695 | result = aConnection['userData']['statistics']; |
714 | } | 696 | } |
715 | } else { | 697 | } else { |
716 | result = null; | 698 | result = null; |
717 | } | 699 | } |
718 | 700 | ||
719 | return result; | 701 | return result; |
720 | }, | 702 | }, |
721 | 703 | ||
722 | /* | 704 | /* |
723 | 'userSerializedEncryptedData': function(someData) { | 705 | 'userSerializedEncryptedData': function(someData) { |
724 | var deferredResult; | 706 | var deferredResult; |
725 | var deferredContext; | 707 | var deferredContext; |
726 | 708 | ||
727 | deferredContext = { 'data': someData }; | 709 | deferredContext = { 'data': someData }; |
728 | 710 | ||
729 | deferredResult = new Clipperz.Async.Deferred('Proxy.Test.serializeUserEncryptedData', {trace:false}); | 711 | deferredResult = new Clipperz.Async.Deferred('Proxy.Test.serializeUserEncryptedData', {trace:false}); |
730 | deferredResult.addCallback(MochiKit.Base.bind(function(aDeferredContext) { | 712 | deferredResult.addCallback(MochiKit.Base.bind(function(aDeferredContext) { |
731 | aDeferredContext['user'] = this.createUserUsingConfigurationData(aDeferredContext['data']); | 713 | aDeferredContext['user'] = this.createUserUsingConfigurationData(aDeferredContext['data']); |
732 | return aDeferredContext; | 714 | return aDeferredContext; |
733 | }, this)); | 715 | }, this)); |
734 | deferredResult.addCallback(function(aDeferredContext) { | 716 | deferredResult.addCallback(function(aDeferredContext) { |
735 | // return aDeferredContext['user'].encryptedDataUsingVersion(aDeferredContext['data']['version']); | 717 | // return aDeferredContext['user'].encryptedDataUsingVersion(aDeferredContext['data']['version']); |
736 | return aDeferredContext['user'].serializedDataUsingVersion(MochiKit.Base.values(aDeferredContext['user'].records()), aDeferredContext['data']['version']); | 718 | return aDeferredContext['user'].serializedDataUsingVersion(MochiKit.Base.values(aDeferredContext['user'].records()), aDeferredContext['data']['version']); |
737 | }); | 719 | }); |
738 | deferredResult.addCallback(function(aUserEncryptedData) { | 720 | deferredResult.addCallback(function(aUserEncryptedData) { |
739 | deferredContext['encryptedData'] = aUserEncryptedData; | 721 | deferredContext['encryptedData'] = aUserEncryptedData; |
740 | return deferredContext; | 722 | return deferredContext; |
741 | }); | 723 | }); |
742 | deferredResult.addCallback(function(aDeferredContext) { | 724 | deferredResult.addCallback(function(aDeferredContext) { |
743 | var connection; | 725 | var connection; |
744 | 726 | ||
745 | connection = new Clipperz.PM.Connection.communicationProtocol.versions[aDeferredContext['data']['connectionVersion']]() | 727 | connection = new Clipperz.PM.Connection.communicationProtocol.versions[aDeferredContext['data']['connectionVersion']]() |
746 | aDeferredContext['credentials'] = connection.serverSideUserCredentials(aDeferredContext['user'].username(),aDeferredContext['user'].passphrase()); | 728 | aDeferredContext['credentials'] = connection.serverSideUserCredentials(aDeferredContext['user'].username(),aDeferredContext['user'].passphrase()); |
747 | 729 | ||
748 | return aDeferredContext; | 730 | return aDeferredContext; |
749 | }); | 731 | }); |
750 | 732 | ||
751 | // deferredResult.addCallback(function(aDeferredContext) { | 733 | // deferredResult.addCallback(function(aDeferredContext) { |
752 | //console.log("#-#-#-#-#", aDeferredContext); | ||
753 | // return aDeferredContext['user'].serializedDataUsingVersion(MochiKit.Base.values(aDeferredContext['user'].records()), aDeferredContext['data']['version']); | 734 | // return aDeferredContext['user'].serializedDataUsingVersion(MochiKit.Base.values(aDeferredContext['user'].records()), aDeferredContext['data']['version']); |
754 | // }, deferredContext); | 735 | // }, deferredContext); |
755 | // deferredResult.addCallback(function(aUserSerializedData) { | 736 | // deferredResult.addCallback(function(aUserSerializedData) { |
756 | //console.log("USER SERIALIZED DATA", aUserSerializedData); | ||
757 | // }); | 737 | // }); |
758 | // | 738 | // |
759 | // deferredResult.addCallback(MochiKit.Async.succeed, deferredContext); | 739 | // deferredResult.addCallback(MochiKit.Async.succeed, deferredContext); |
760 | deferredResult.callback(deferredContext); | 740 | deferredResult.callback(deferredContext); |
761 | 741 | ||
762 | return deferredResult; | 742 | return deferredResult; |
763 | }, | 743 | }, |
764 | 744 | ||
765 | 'createUserUsingConfigurationData': function(someData) { | 745 | 'createUserUsingConfigurationData': function(someData) { |
766 | var result; | 746 | var result; |
767 | var user; | 747 | var user; |
768 | var recordLabel; | 748 | var recordLabel; |
769 | 749 | ||
770 | user = new Clipperz.PM.DataModel.User(); | 750 | user = new Clipperz.PM.DataModel.User(); |
771 | user.initForTests(); | 751 | user.initForTests(); |
772 | user.setUsername(someData['username']); | 752 | user.setUsername(someData['username']); |
773 | user.setPassphrase(someData['passphrase']); | 753 | user.setPassphrase(someData['passphrase']); |
774 | 754 | ||
775 | for (recordLabel in someData['records']) { | 755 | for (recordLabel in someData['records']) { |
776 | var recordData; | 756 | var recordData; |
777 | var record; | 757 | var record; |
778 | var i, c; | 758 | var i, c; |
779 | 759 | ||
780 | recordData = someData['records'][recordLabel]; | 760 | recordData = someData['records'][recordLabel]; |
781 | record = new Clipperz.PM.DataModel.Record({user:user, label:recordLabel}); | 761 | record = new Clipperz.PM.DataModel.Record({user:user, label:recordLabel}); |
782 | record.setNotes(recordData['notes']); | 762 | record.setNotes(recordData['notes']); |
783 | 763 | ||
784 | c = recordData['fields'].length; | 764 | c = recordData['fields'].length; |
785 | for (i=0; i<c; i++) { | 765 | for (i=0; i<c; i++) { |
786 | var recordField; | 766 | var recordField; |
787 | 767 | ||
788 | recordField = new Clipperz.PM.DataModel.RecordField(); | 768 | recordField = new Clipperz.PM.DataModel.RecordField(); |
789 | recordField.setLabel(recordData['fields'][i]['name']); | 769 | recordField.setLabel(recordData['fields'][i]['name']); |
790 | recordField.setValue(recordData['fields'][i]['value']); | 770 | recordField.setValue(recordData['fields'][i]['value']); |
791 | recordField.setType(recordData['fields'][i]['type']); | 771 | recordField.setType(recordData['fields'][i]['type']); |
792 | record.addField(recordField); | 772 | record.addField(recordField); |
793 | } | 773 | } |
794 | user.addRecord(record, true); | 774 | user.addRecord(record, true); |
795 | } | 775 | } |
796 | 776 | ||
797 | result = user; | 777 | result = user; |
798 | 778 | ||
799 | return result; | 779 | return result; |
800 | }, | 780 | }, |
801 | */ | 781 | */ |
802 | //========================================================================= | 782 | //========================================================================= |
803 | __syntaxFix__: "syntax fix" | 783 | __syntaxFix__: "syntax fix" |
804 | }); | 784 | }); |
805 | 785 | ||
806 | Clipperz.PM.Proxy.Offline.DataStore['exception'] = { | 786 | Clipperz.PM.Proxy.Offline.DataStore['exception'] = { |
807 | 'ReadOnly': new MochiKit.Base.NamedError("Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly") | 787 | 'ReadOnly': new MochiKit.Base.NamedError("Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly") |
808 | }; \ No newline at end of file | 788 | }; \ 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 index a86ac4f..5764bda 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.js | |||
@@ -1,64 +1,62 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | 26 | ||
29 | //============================================================================= | 27 | //============================================================================= |
30 | 28 | ||
31 | Clipperz.PM.Proxy.Offline = function(args) { | 29 | Clipperz.PM.Proxy.Offline = function(args) { |
32 | args = args || {}; | 30 | args = args || {}; |
33 | 31 | ||
34 | Clipperz.PM.Proxy.Offline.superclass.constructor.call(this, args); | 32 | Clipperz.PM.Proxy.Offline.superclass.constructor.call(this, args); |
35 | 33 | ||
36 | this._dataStore = args.dataStore || new Clipperz.PM.Proxy.Offline.DataStore(args); | 34 | this._dataStore = args.dataStore || new Clipperz.PM.Proxy.Offline.DataStore(args); |
37 | 35 | ||
38 | return this; | 36 | return this; |
39 | } | 37 | } |
40 | 38 | ||
41 | Clipperz.Base.extend(Clipperz.PM.Proxy.Offline, Clipperz.PM.Proxy, { | 39 | Clipperz.Base.extend(Clipperz.PM.Proxy.Offline, Clipperz.PM.Proxy, { |
42 | 40 | ||
43 | 'toString': function () { | 41 | 'toString': function () { |
44 | return "Clipperz.PM.Proxy.Offline"; | 42 | return "Clipperz.PM.Proxy.Offline"; |
45 | }, | 43 | }, |
46 | 44 | ||
47 | //------------------------------------------------------------------------- | 45 | //------------------------------------------------------------------------- |
48 | 46 | ||
49 | 'dataStore': function () { | 47 | 'dataStore': function () { |
50 | return this._dataStore; | 48 | return this._dataStore; |
51 | }, | 49 | }, |
52 | 50 | ||
53 | //------------------------------------------------------------------------- | 51 | //------------------------------------------------------------------------- |
54 | 52 | ||
55 | 'sendMessage': function(aFunctionName, someParameters) { | 53 | 'sendMessage': function(aFunctionName, someParameters) { |
56 | return this.dataStore().processMessage(aFunctionName, someParameters); | 54 | return this.dataStore().processMessage(aFunctionName, someParameters); |
57 | }, | 55 | }, |
58 | 56 | ||
59 | //------------------------------------------------------------------------- | 57 | //------------------------------------------------------------------------- |
60 | 58 | ||
61 | __syntaxFix__: "syntax fix" | 59 | __syntaxFix__: "syntax fix" |
62 | 60 | ||
63 | }); | 61 | }); |
64 | 62 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.OfflineCache.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.OfflineCache.js index 803c590..f628975 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.OfflineCache.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.OfflineCache.js | |||
@@ -1,65 +1,63 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | 26 | ||
29 | //============================================================================= | 27 | //============================================================================= |
30 | 28 | ||
31 | Clipperz.PM.Proxy.OfflineCache = function(args) { | 29 | Clipperz.PM.Proxy.OfflineCache = function(args) { |
32 | args = args || {}; | 30 | args = args || {}; |
33 | 31 | ||
34 | Clipperz.PM.Proxy.Offline.superclass.constructor.call(this, args); | 32 | Clipperz.PM.Proxy.Offline.superclass.constructor.call(this, args); |
35 | 33 | ||
36 | //this._dataStore = args.dataStore || new Clipperz.PM.Proxy.Offline.DataStore(args); | 34 | //this._dataStore = args.dataStore || new Clipperz.PM.Proxy.Offline.DataStore(args); |
37 | 35 | ||
38 | return this; | 36 | return this; |
39 | } | 37 | } |
40 | 38 | ||
41 | Clipperz.Base.extend(Clipperz.PM.Proxy.OfflineCache, Clipperz.PM.Proxy, { | 39 | Clipperz.Base.extend(Clipperz.PM.Proxy.OfflineCache, Clipperz.PM.Proxy, { |
42 | 40 | ||
43 | 'toString': function () { | 41 | 'toString': function () { |
44 | return "Clipperz.PM.Proxy.OfflineCache"; | 42 | return "Clipperz.PM.Proxy.OfflineCache"; |
45 | }, | 43 | }, |
46 | 44 | ||
47 | //------------------------------------------------------------------------- | 45 | //------------------------------------------------------------------------- |
48 | 46 | ||
49 | //'dataStore': function () { | 47 | //'dataStore': function () { |
50 | // return this._dataStore; | 48 | // return this._dataStore; |
51 | //}, | 49 | //}, |
52 | 50 | ||
53 | //------------------------------------------------------------------------- | 51 | //------------------------------------------------------------------------- |
54 | 52 | ||
55 | 'sendMessage': function(aFunctionName, someParameters) { | 53 | 'sendMessage': function(aFunctionName, someParameters) { |
56 | throw Clipperz.Base.exception.MethodNotImplementedYet; | 54 | throw Clipperz.Base.exception.MethodNotImplementedYet; |
57 | // return this.dataStore().processMessage(aFunctionName, someParameters); | 55 | // return this.dataStore().processMessage(aFunctionName, someParameters); |
58 | }, | 56 | }, |
59 | 57 | ||
60 | //------------------------------------------------------------------------- | 58 | //------------------------------------------------------------------------- |
61 | 59 | ||
62 | __syntaxFix__: "syntax fix" | 60 | __syntaxFix__: "syntax fix" |
63 | 61 | ||
64 | }); | 62 | }); |
65 | 63 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Test.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Test.js index d554c6a..d459726 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Test.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Test.js | |||
@@ -1,164 +1,156 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Proxy) == 'undefined') { Clipperz.PM.Proxy = {}; } | 26 | if (typeof(Clipperz.PM.Proxy) == 'undefined') { Clipperz.PM.Proxy = {}; } |
29 | 27 | ||
30 | //============================================================================= | 28 | //============================================================================= |
31 | 29 | ||
32 | Clipperz.PM.Proxy.Test = function(args) { | 30 | Clipperz.PM.Proxy.Test = function(args) { |
33 | Clipperz.PM.Proxy.Test.superclass.constructor.call(this, args); | 31 | Clipperz.PM.Proxy.Test.superclass.constructor.call(this, args); |
34 | 32 | ||
35 | args = args || {}; | 33 | args = args || {}; |
36 | 34 | ||
37 | this._expectedRequests = (args.shouldCheckExpectedRequests === true) ? [] : null; | 35 | this._expectedRequests = (args.shouldCheckExpectedRequests === true) ? [] : null; |
38 | this._isExpectingRequests = true; | 36 | this._isExpectingRequests = true; |
39 | this._unexpectedRequests = []; | 37 | this._unexpectedRequests = []; |
40 | 38 | ||
41 | this.dataStore().resetData(); | 39 | this.dataStore().resetData(); |
42 | 40 | ||
43 | return this; | 41 | return this; |
44 | } | 42 | } |
45 | 43 | ||
46 | Clipperz.Base.extend(Clipperz.PM.Proxy.Test, Clipperz.PM.Proxy.Offline, { | 44 | Clipperz.Base.extend(Clipperz.PM.Proxy.Test, Clipperz.PM.Proxy.Offline, { |
47 | 45 | ||
48 | 'toString': function() { | 46 | 'toString': function() { |
49 | return "Clipperz.PM.Proxy.Test"; | 47 | return "Clipperz.PM.Proxy.Test"; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | //========================================================================= | 50 | //========================================================================= |
53 | 51 | ||
54 | 'expectedRequests': function () { | 52 | 'expectedRequests': function () { |
55 | return this._expectedRequests; | 53 | return this._expectedRequests; |
56 | }, | 54 | }, |
57 | 55 | ||
58 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
59 | 57 | ||
60 | 'shouldCheckExpectedRequests': function () { | 58 | 'shouldCheckExpectedRequests': function () { |
61 | return (this._expectedRequests != null); | 59 | return (this._expectedRequests != null); |
62 | }, | 60 | }, |
63 | 61 | ||
64 | 'setShouldCheckExpectedRequests': function(aValue) { | 62 | 'setShouldCheckExpectedRequests': function(aValue) { |
65 | if (aValue) { | 63 | if (aValue) { |
66 | this._expectedRequests = aValue; | 64 | this._expectedRequests = aValue; |
67 | } else { | 65 | } else { |
68 | this._expectedRequests = null; | 66 | this._expectedRequests = null; |
69 | } | 67 | } |
70 | }, | 68 | }, |
71 | 69 | ||
72 | //------------------------------------------------------------------------- | 70 | //------------------------------------------------------------------------- |
73 | 71 | ||
74 | 'shouldNotReceiveAnyFurtherRequest': function () { | 72 | 'shouldNotReceiveAnyFurtherRequest': function () { |
75 | this._isExpectingRequests = false; | 73 | this._isExpectingRequests = false; |
76 | }, | 74 | }, |
77 | 75 | ||
78 | 'mayReceiveMoreRequests': function () { | 76 | 'mayReceiveMoreRequests': function () { |
79 | this._isExpectingRequests = true; | 77 | this._isExpectingRequests = true; |
80 | this.resetUnexpectedRequests(); | 78 | this.resetUnexpectedRequests(); |
81 | }, | 79 | }, |
82 | 80 | ||
83 | 'isExpectingRequests': function () { | 81 | 'isExpectingRequests': function () { |
84 | return this._isExpectingRequests; | 82 | return this._isExpectingRequests; |
85 | }, | 83 | }, |
86 | 84 | ||
87 | //------------------------------------------------------------------------- | 85 | //------------------------------------------------------------------------- |
88 | 86 | ||
89 | 'unexpectedRequests': function () { | 87 | 'unexpectedRequests': function () { |
90 | return this._unexpectedRequests; | 88 | return this._unexpectedRequests; |
91 | }, | 89 | }, |
92 | 90 | ||
93 | 'resetUnexpectedRequests': function () { | 91 | 'resetUnexpectedRequests': function () { |
94 | this._unexpectedRequests = []; | 92 | this._unexpectedRequests = []; |
95 | }, | 93 | }, |
96 | 94 | ||
97 | //------------------------------------------------------------------------- | 95 | //------------------------------------------------------------------------- |
98 | 96 | ||
99 | 'testExpectedRequestParameters': function (aPath, anActualRequest, anExpectedRequest) { | 97 | 'testExpectedRequestParameters': function (aPath, anActualRequest, anExpectedRequest) { |
100 | var aKey; | 98 | var aKey; |
101 | //console.log(">>> Proxy.testExpectedRequestParameters [" + aPath + "]", anActualRequest, anExpectedRequest); | ||
102 | for (aKey in anExpectedRequest) { | 99 | for (aKey in anExpectedRequest) { |
103 | if (typeof(anActualRequest[aKey]) == 'undefined') { | 100 | if (typeof(anActualRequest[aKey]) == 'undefined') { |
104 | throw "the expected paramter [" + aKey + "] is missing from the actual request"; | 101 | throw "the expected paramter [" + aKey + "] is missing from the actual request"; |
105 | } | 102 | } |
106 | if (typeof(anExpectedRequest[aKey]) == 'object') { | 103 | if (typeof(anExpectedRequest[aKey]) == 'object') { |
107 | this.testExpectedRequestParameters(aPath + "." + aKey, anActualRequest[aKey], anExpectedRequest[aKey]) | 104 | this.testExpectedRequestParameters(aPath + "." + aKey, anActualRequest[aKey], anExpectedRequest[aKey]) |
108 | } else { | 105 | } else { |
109 | if (! anExpectedRequest[aKey](anActualRequest[aKey])) { | 106 | if (! anExpectedRequest[aKey](anActualRequest[aKey])) { |
110 | throw "wrong value for paramter [" + aKey + "]; got '" + anActualRequest[aKey] + "'"; | 107 | throw "wrong value for paramter [" + aKey + "]; got '" + anActualRequest[aKey] + "'"; |
111 | } | 108 | } |
112 | } | 109 | } |
113 | } | 110 | } |
114 | //console.log("<<< Proxy.testExpectedRequestParameters"); | ||
115 | }, | 111 | }, |
116 | 112 | ||
117 | //------------------------------------------------------------------------- | 113 | //------------------------------------------------------------------------- |
118 | 114 | ||
119 | 'checkRequest': function(aFunctionName, someParameters) { | 115 | 'checkRequest': function(aFunctionName, someParameters) { |
120 | if (this.shouldCheckExpectedRequests()) { | 116 | if (this.shouldCheckExpectedRequests()) { |
121 | var expectedRequest; | 117 | var expectedRequest; |
122 | 118 | ||
123 | //console.log(">>> Proxy.Test.checkRequest - " + aFunctionName, someParameters); | ||
124 | expectedRequest = this.expectedRequests().pop(); | 119 | expectedRequest = this.expectedRequests().pop(); |
125 | //console.log("--- Proxy.Test.checkRequest - expectedRequest", expectedRequest); | ||
126 | if (expectedRequest == null) { | 120 | if (expectedRequest == null) { |
127 | throw "Proxy.Test.sentMessage: no expected result specified. Got request '" + aFunctionName + "': " + someParameters; | 121 | throw "Proxy.Test.sentMessage: no expected result specified. Got request '" + aFunctionName + "': " + someParameters; |
128 | } | 122 | } |
129 | 123 | ||
130 | try { | 124 | try { |
131 | if (aFunctionName != expectedRequest.functionName) { | 125 | if (aFunctionName != expectedRequest.functionName) { |
132 | throw "wrong function name. Got '" + aFunctionName + "', expected '" + expectedRequest.request.functionName + "'"; | 126 | throw "wrong function name. Got '" + aFunctionName + "', expected '" + expectedRequest.request.functionName + "'"; |
133 | } | 127 | } |
134 | 128 | ||
135 | this.testExpectedRequestParameters("parameters", someParameters, expectedRequest.parameters); | 129 | this.testExpectedRequestParameters("parameters", someParameters, expectedRequest.parameters); |
136 | } catch(exception) { | 130 | } catch(exception) { |
137 | //console.log("EXCEPTION: Proxy.Test.sentMessage[" + expectedRequest.name + "]", exception) | ||
138 | throw "Proxy.Test.sentMessage[" + expectedRequest.name + "]: " + exception; | 131 | throw "Proxy.Test.sentMessage[" + expectedRequest.name + "]: " + exception; |
139 | } | 132 | } |
140 | } | 133 | } |
141 | //console.log("<<< Proxy.Test.checkRequest"); | ||
142 | }, | 134 | }, |
143 | 135 | ||
144 | //========================================================================= | 136 | //========================================================================= |
145 | 137 | ||
146 | 'sendMessage': function(aFunctionName, someParameters) { | 138 | 'sendMessage': function(aFunctionName, someParameters) { |
147 | var result; | 139 | var result; |
148 | 140 | ||
149 | if (this.isExpectingRequests() == false) { | 141 | if (this.isExpectingRequests() == false) { |
150 | // throw Clipperz.PM.Connection.exception.UnexpectedRequest; | 142 | // throw Clipperz.PM.Connection.exception.UnexpectedRequest; |
151 | Clipperz.log("UNEXPECTED REQUEST " + aFunctionName /* + ": " + Clipperz.Base.serializeJSON(someParameters) */); | 143 | Clipperz.log("UNEXPECTED REQUEST " + aFunctionName /* + ": " + Clipperz.Base.serializeJSON(someParameters) */); |
152 | this.unexpectedRequests().push({'functionName':aFunctionName, 'someParameters': someParameters}); | 144 | this.unexpectedRequests().push({'functionName':aFunctionName, 'someParameters': someParameters}); |
153 | }; | 145 | }; |
154 | this.checkRequest(aFunctionName, someParameters); | 146 | this.checkRequest(aFunctionName, someParameters); |
155 | result = Clipperz.PM.Proxy.Test.superclass.sendMessage.call(this, aFunctionName, someParameters); | 147 | result = Clipperz.PM.Proxy.Test.superclass.sendMessage.call(this, aFunctionName, someParameters); |
156 | 148 | ||
157 | return result; | 149 | return result; |
158 | }, | 150 | }, |
159 | 151 | ||
160 | //========================================================================= | 152 | //========================================================================= |
161 | __syntaxFix__: "syntax fix" | 153 | __syntaxFix__: "syntax fix" |
162 | 154 | ||
163 | }); | 155 | }); |
164 | 156 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/Strings.js b/frontend/gamma/js/Clipperz/PM/Strings.js index a051365..7e855ff 100644 --- a/frontend/gamma/js/Clipperz/PM/Strings.js +++ b/frontend/gamma/js/Clipperz/PM/Strings.js | |||
@@ -1,292 +1,285 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; } | 26 | if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; } |
29 | if (typeof(Clipperz.PM.Strings.Languages) == 'undefined') { Clipperz.PM.Strings.Languages = {}; } | 27 | if (typeof(Clipperz.PM.Strings.Languages) == 'undefined') { Clipperz.PM.Strings.Languages = {}; } |
30 | 28 | ||
31 | //----------------------------------------------------------------------------- | 29 | //----------------------------------------------------------------------------- |
32 | /* | 30 | /* |
33 | Clipperz.PM.Strings.standardStrings = { | 31 | Clipperz.PM.Strings.standardStrings = { |
34 | 'loginPanelSwitchLanguageSelectOptions':[ | 32 | 'loginPanelSwitchLanguageSelectOptions':[ |
35 | / * | 33 | / * |
36 | {tag:'option', html:"Arabic (Oman) (العربية)", value:'ar-OM', disabled:true}, | 34 | {tag:'option', html:"Arabic (Oman) (العربية)", value:'ar-OM', disabled:true}, |
37 | {tag:'option', html:"Arabic (Syria) (العربية)", value:'ar-SY', disabled:true}, | 35 | {tag:'option', html:"Arabic (Syria) (العربية)", value:'ar-SY', disabled:true}, |
38 | {tag:'option', html:"Bahasa Indonesia", value:'id-ID', disabled:true}, | 36 | {tag:'option', html:"Bahasa Indonesia", value:'id-ID', disabled:true}, |
39 | {tag:'option', html:"Bulgarian (Български)", value:'bg-BG', disabled:true}, | 37 | {tag:'option', html:"Bulgarian (Български)", value:'bg-BG', disabled:true}, |
40 | {tag:'option', html:"Català", value:'ca-ES', disabled:true}, | 38 | {tag:'option', html:"Català", value:'ca-ES', disabled:true}, |
41 | {tag:'option', html:"Chinese (Simplified) (简体中文)", value:'zh-CN', disabled:true}, | 39 | {tag:'option', html:"Chinese (Simplified) (简体中文)", value:'zh-CN', disabled:true}, |
42 | {tag:'option', html:"Chinese (Traditional) (正體中文)", value:'zh-TW', disabled:true}, | 40 | {tag:'option', html:"Chinese (Traditional) (正體中文)", value:'zh-TW', disabled:true}, |
43 | {tag:'option', html:"Czech (Česky)", value:'cs-CZ', disabled:true}, | 41 | {tag:'option', html:"Czech (Česky)", value:'cs-CZ', disabled:true}, |
44 | {tag:'option', html:"Dansk", value:'da-DK', disabled:true}, | 42 | {tag:'option', html:"Dansk", value:'da-DK', disabled:true}, |
45 | {tag:'option', html:"Deutsch", value:'de-DE'/ *, disabled:true* /}, | 43 | {tag:'option', html:"Deutsch", value:'de-DE'/ *, disabled:true* /}, |
46 | {tag:'option', html:"English (American)", value:'en-US'/ *, disabled:true* /}, | 44 | {tag:'option', html:"English (American)", value:'en-US'/ *, disabled:true* /}, |
47 | {tag:'option', html:"English (British)", value:'en-GB'/ *, disabled:true* /}, | 45 | {tag:'option', html:"English (British)", value:'en-GB'/ *, disabled:true* /}, |
48 | {tag:'option', html:"English (Canadian)", value:'en-CA'/ *, disabled:true* /}, | 46 | {tag:'option', html:"English (Canadian)", value:'en-CA'/ *, disabled:true* /}, |
49 | {tag:'option', html:"Español", value:'es-ES', disabled:true}, | 47 | {tag:'option', html:"Español", value:'es-ES', disabled:true}, |
50 | {tag:'option', html:"Eesti", value:'et-EE', disabled:true}, | 48 | {tag:'option', html:"Eesti", value:'et-EE', disabled:true}, |
51 | {tag:'option', html:"Français", value:'fr-FR', disabled:true}, | 49 | {tag:'option', html:"Français", value:'fr-FR', disabled:true}, |
52 | {tag:'option', html:"Galego", value:'gl-ES', disabled:true}, | 50 | {tag:'option', html:"Galego", value:'gl-ES', disabled:true}, |
53 | {tag:'option', html:"Greek (Ελληνικά)", value:'el-GR', disabled:true}, | 51 | {tag:'option', html:"Greek (Ελληνικά)", value:'el-GR', disabled:true}, |
54 | {tag:'option', html:"Íslenska", value:'is-IS', disabled:true}, | 52 | {tag:'option', html:"Íslenska", value:'is-IS', disabled:true}, |
55 | {tag:'option', html:"Italiano", value:'it-IT'/ *, disabled:true* /}, | 53 | {tag:'option', html:"Italiano", value:'it-IT'/ *, disabled:true* /}, |
56 | {tag:'option', html:"Japanese (日本語)", value:'ja-JP', disabled:true}, | 54 | {tag:'option', html:"Japanese (日本語)", value:'ja-JP', disabled:true}, |
57 | {tag:'option', html:"Korean (한국어)", value:'ko-KR', disabled:true}, | 55 | {tag:'option', html:"Korean (한국어)", value:'ko-KR', disabled:true}, |
58 | {tag:'option', html:"Latviešu", value:'lv-LV', disabled:true}, | 56 | {tag:'option', html:"Latviešu", value:'lv-LV', disabled:true}, |
59 | {tag:'option', html:"Lietuvių", value:'lt-LT', disabled:true}, | 57 | {tag:'option', html:"Lietuvių", value:'lt-LT', disabled:true}, |
60 | {tag:'option', html:"Macedonian (Македонски)", value:'mk-MK', disabled:true}, | 58 | {tag:'option', html:"Macedonian (Македонски)", value:'mk-MK', disabled:true}, |
61 | {tag:'option', html:"Magyar", value:'hu-HU', disabled:true}, | 59 | {tag:'option', html:"Magyar", value:'hu-HU', disabled:true}, |
62 | {tag:'option', html:"Nederlands", value:'nl-NL', disabled:true}, | 60 | {tag:'option', html:"Nederlands", value:'nl-NL', disabled:true}, |
63 | {tag:'option', html:"Norsk bokmål", value:'nb-NO', disabled:true}, | 61 | {tag:'option', html:"Norsk bokmål", value:'nb-NO', disabled:true}, |
64 | {tag:'option', html:"Norsk nynorsk", value:'nn-NO', disabled:true}, | 62 | {tag:'option', html:"Norsk nynorsk", value:'nn-NO', disabled:true}, |
65 | {tag:'option', html:"Persian (Western) (فارسى)", value:'fa-IR', disabled:true}, | 63 | {tag:'option', html:"Persian (Western) (فارسى)", value:'fa-IR', disabled:true}, |
66 | {tag:'option', html:"Polski", value:'pl-PL', disabled:true}, | 64 | {tag:'option', html:"Polski", value:'pl-PL', disabled:true}, |
67 | {tag:'option', html:"Português", value:'pt-PT'/ *, disabled:true* /}, | 65 | {tag:'option', html:"Português", value:'pt-PT'/ *, disabled:true* /}, |
68 | {tag:'option', html:"Português Brasileiro", value:'pt-BR'/ *, disabled:true* /}, | 66 | {tag:'option', html:"Português Brasileiro", value:'pt-BR'/ *, disabled:true* /}, |
69 | {tag:'option', html:"Românä", value:'ro-RO', disabled:true}, | 67 | {tag:'option', html:"Românä", value:'ro-RO', disabled:true}, |
70 | {tag:'option', html:"Russian (Русский)", value:'ru-RU', disabled:true}, | 68 | {tag:'option', html:"Russian (Русский)", value:'ru-RU', disabled:true}, |
71 | {tag:'option', html:"Slovak (Slovenčina)", value:'sk-SK', disabled:true}, | 69 | {tag:'option', html:"Slovak (Slovenčina)", value:'sk-SK', disabled:true}, |
72 | {tag:'option', html:"Slovenian (Slovenščina)", value:'sl-SI', disabled:true}, | 70 | {tag:'option', html:"Slovenian (Slovenščina)", value:'sl-SI', disabled:true}, |
73 | {tag:'option', html:"Suomi", value:'fi-FI', disabled:true}, | 71 | {tag:'option', html:"Suomi", value:'fi-FI', disabled:true}, |
74 | {tag:'option', html:"Svenska", value:'sv-SE', disabled:true}, | 72 | {tag:'option', html:"Svenska", value:'sv-SE', disabled:true}, |
75 | {tag:'option', html:"Thai (ไทย)", value:'th-TH', disabled:true}, | 73 | {tag:'option', html:"Thai (ไทย)", value:'th-TH', disabled:true}, |
76 | {tag:'option', html:"Türkçe", value:'tr-TR', disabled:true}, | 74 | {tag:'option', html:"Türkçe", value:'tr-TR', disabled:true}, |
77 | {tag:'option', html:"Ukrainian (Українська)", value:'uk-UA', disabled:true} | 75 | {tag:'option', html:"Ukrainian (Українська)", value:'uk-UA', disabled:true} |
78 | * / | 76 | * / |
79 | {tag:'option', html:"Arabic (العربية)", value:"ar", disabled:true, cls:'disabledOption'}, | 77 | {tag:'option', html:"Arabic (العربية)", value:"ar", disabled:true, cls:'disabledOption'}, |
80 | // {tag:'option', html:"Chinese (中文)", value:"zh", disabled:true}, | 78 | // {tag:'option', html:"Chinese (中文)", value:"zh", disabled:true}, |
81 | {tag:'option', html:"Chinese (Simplified) (简体中文)", value:'zh-CN'}, | 79 | {tag:'option', html:"Chinese (Simplified) (简体中文)", value:'zh-CN'}, |
82 | {tag:'option', html:"Dutch (Nederlands)", value:"nl-NL", disabled:true, cls:'disabledOption'}, | 80 | {tag:'option', html:"Dutch (Nederlands)", value:"nl-NL", disabled:true, cls:'disabledOption'}, |
83 | {tag:'option', html:"English", value:"en-US"}, | 81 | {tag:'option', html:"English", value:"en-US"}, |
84 | {tag:'option', html:"French (Français)", value:"fr-FR"}, | 82 | {tag:'option', html:"French (Français)", value:"fr-FR"}, |
85 | {tag:'option', html:"German (Deutsch)", value:"de-DE", disabled:true, cls:'disabledOption'}, | 83 | {tag:'option', html:"German (Deutsch)", value:"de-DE", disabled:true, cls:'disabledOption'}, |
86 | {tag:'option', html:"Greek (Ελληνικά)", value:"el-GR", disabled:true, cls:'disabledOption'}, | 84 | {tag:'option', html:"Greek (Ελληνικά)", value:"el-GR", disabled:true, cls:'disabledOption'}, |
87 | {tag:'option', html:"Hebrew (עברית)", value:"he-IL", disabled:true, cls:'disabledOption'}, | 85 | {tag:'option', html:"Hebrew (עברית)", value:"he-IL", disabled:true, cls:'disabledOption'}, |
88 | {tag:'option', html:"Italian (Italiano)", value:"it-IT"}, | 86 | {tag:'option', html:"Italian (Italiano)", value:"it-IT"}, |
89 | {tag:'option', html:"Japanese (日本語)", value:"ja-JP"}, | 87 | {tag:'option', html:"Japanese (日本語)", value:"ja-JP"}, |
90 | {tag:'option', html:"Korean (한국어)", value:"ko-KR", disabled:true, cls:'disabledOption'}, | 88 | {tag:'option', html:"Korean (한국어)", value:"ko-KR", disabled:true, cls:'disabledOption'}, |
91 | {tag:'option', html:"Norwegian (Norsk)", value:"no", disabled:true, cls:'disabledOption'}, | 89 | {tag:'option', html:"Norwegian (Norsk)", value:"no", disabled:true, cls:'disabledOption'}, |
92 | {tag:'option', html:"Persian (فارسی)", value:"fa-IR", disabled:true, cls:'disabledOption'}, | 90 | {tag:'option', html:"Persian (فارسی)", value:"fa-IR", disabled:true, cls:'disabledOption'}, |
93 | {tag:'option', html:"Polish (Polski)", value:"pl-PL", disabled:true, cls:'disabledOption'}, | 91 | {tag:'option', html:"Polish (Polski)", value:"pl-PL", disabled:true, cls:'disabledOption'}, |
94 | {tag:'option', html:"Portuguese (Português)", value:"pt-BR"}, | 92 | {tag:'option', html:"Portuguese (Português)", value:"pt-BR"}, |
95 | {tag:'option', html:"Russian (Русский)", value:"ru-RU", disabled:true, cls:'disabledOption'}, | 93 | {tag:'option', html:"Russian (Русский)", value:"ru-RU", disabled:true, cls:'disabledOption'}, |
96 | {tag:'option', html:"Spanish (Español)", value:"es-ES"}, | 94 | {tag:'option', html:"Spanish (Español)", value:"es-ES"}, |
97 | {tag:'option', html:"Swedish (Svenska)", value:"sv-SE", disabled:true, cls:'disabledOption'}, | 95 | {tag:'option', html:"Swedish (Svenska)", value:"sv-SE", disabled:true, cls:'disabledOption'}, |
98 | {tag:'option', html:"Turkish (Türkçe)", value:"tr-TR", disabled:true, cls:'disabledOption'}, | 96 | {tag:'option', html:"Turkish (Türkçe)", value:"tr-TR", disabled:true, cls:'disabledOption'}, |
99 | {tag:'option', html:"Vietnamese (Tiếng Việt)", value:"vi-VN", disabled:true, cls:'disabledOption'} | 97 | {tag:'option', html:"Vietnamese (Tiếng Việt)", value:"vi-VN", disabled:true, cls:'disabledOption'} |
100 | ] | 98 | ] |
101 | } | 99 | } |
102 | */ | 100 | */ |
103 | 101 | ||
104 | Clipperz.PM.Strings.GeneralSettings = { | 102 | Clipperz.PM.Strings.GeneralSettings = { |
105 | 'defaults': { | 103 | 'defaults': { |
106 | // 'loginFormAarghThatsBadUrl':"http://www.clipperz.com/support/faq/account_faq", | 104 | // 'loginFormAarghThatsBadUrl':"http://www.clipperz.com/support/faq/account_faq", |
107 | // 'loginFormVerifyTheCodeUrl':"http://www.clipperz.com/learn_more/reviewing_the_code", | 105 | // 'loginFormVerifyTheCodeUrl':"http://www.clipperz.com/learn_more/reviewing_the_code", |
108 | 106 | ||
109 | // 'donateHeaderLinkUrl': "http://www.clipperz.com/donations", | 107 | // 'donateHeaderLinkUrl': "http://www.clipperz.com/donations", |
110 | // 'creditsHeaderLinkUrl': "http://www.clipperz.com/credits", | 108 | // 'creditsHeaderLinkUrl': "http://www.clipperz.com/credits", |
111 | // 'feedbackHeaderLinkUrl': "http://www.clipperz.com/contact", | 109 | // 'feedbackHeaderLinkUrl': "http://www.clipperz.com/contact", |
112 | // 'helpHeaderLinkUrl': "http://www.clipperz.com/support/user_guide", | 110 | // 'helpHeaderLinkUrl': "http://www.clipperz.com/support/user_guide", |
113 | // 'forumHeaderLinkUrl': "http://www.clipperz.com/forum", | 111 | // 'forumHeaderLinkUrl': "http://www.clipperz.com/forum", |
114 | 112 | ||
115 | // 'httpAuthBookmarkletConfiguration':{tag:'textarea', id:'httpAuthDefaultConfiguration', html:"" + | 113 | // 'httpAuthBookmarkletConfiguration':{tag:'textarea', id:'httpAuthDefaultConfiguration', html:"" + |
116 | // "{ \"page\":{\"title\":\"HTTP authentication\"}," + "\n" + | 114 | // "{ \"page\":{\"title\":\"HTTP authentication\"}," + "\n" + |
117 | // " \"form\":{\"attributes\": {" + "\n" + | 115 | // " \"form\":{\"attributes\": {" + "\n" + |
118 | // " \"action\":\"\"," + "\n" + | 116 | // " \"action\":\"\"," + "\n" + |
119 | // " \"type\":\"http_auth\"" + "\n" + | 117 | // " \"type\":\"http_auth\"" + "\n" + |
120 | // " }, \"inputs\": [" + "\n" + | 118 | // " }, \"inputs\": [" + "\n" + |
121 | // " {\"type\":\"text\",\"name\":\"url\",\"value\":\"\"}," + "\n" + | 119 | // " {\"type\":\"text\",\"name\":\"url\",\"value\":\"\"}," + "\n" + |
122 | // " {\"type\":\"text\",\"name\":\"username\",\"value\":\"\"}," + "\n" + | 120 | // " {\"type\":\"text\",\"name\":\"username\",\"value\":\"\"}," + "\n" + |
123 | // " {\"type\":\"password\",\"name\":\"password\",\"value\":\"\"}" + "\n" + | 121 | // " {\"type\":\"password\",\"name\":\"password\",\"value\":\"\"}" + "\n" + |
124 | // " ]}, \"version\":\"0.2.3\"}" | 122 | // " ]}, \"version\":\"0.2.3\"}" |
125 | // }, | 123 | // }, |
126 | 124 | ||
127 | 'directLoginJumpPageUrl':"", | 125 | 'directLoginJumpPageUrl':"", |
128 | '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=", | 126 | '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=", |
129 | 'defaultFaviconUrl_IE': "https://www.clipperz.com/images/icons/misc/favicon.ico", | 127 | 'defaultFaviconUrl_IE': "https://www.clipperz.com/images/icons/misc/favicon.ico", |
130 | 128 | ||
131 | // 'icons_baseUrl':"https://www.clipperz.com/images/icons", | 129 | // 'icons_baseUrl':"https://www.clipperz.com/images/icons", |
132 | 130 | ||
133 | // 'passwordGeneratorLowercaseCharset':"abcdefghijklmnopqrstuvwxyz", | 131 | // 'passwordGeneratorLowercaseCharset':"abcdefghijklmnopqrstuvwxyz", |
134 | // 'passwordGeneratorUppercaseCharset':"ABCDEFGHIJKLMNOPQRSTUVWXYZ", | 132 | // 'passwordGeneratorUppercaseCharset':"ABCDEFGHIJKLMNOPQRSTUVWXYZ", |
135 | // 'passwordGeneratorNumberCharset': "0123456789", | 133 | // 'passwordGeneratorNumberCharset': "0123456789", |
136 | // 'passwordGeneratorSymbolCharset': "!@#$%^&*+?[]{}/|\\<>,.;:~=-_", | 134 | // 'passwordGeneratorSymbolCharset': "!@#$%^&*+?[]{}/|\\<>,.;:~=-_", |
137 | 135 | ||
138 | // 'passwordGenerator': { | 136 | // 'passwordGenerator': { |
139 | // 'lowercaseCharset':"abcdefghijklmnopqrstuvwxyz", | 137 | // 'lowercaseCharset':"abcdefghijklmnopqrstuvwxyz", |
140 | // 'uppercaseCharset':"ABCDEFGHIJKLMNOPQRSTUVWXYZ", | 138 | // 'uppercaseCharset':"ABCDEFGHIJKLMNOPQRSTUVWXYZ", |
141 | // 'numberCharset':"0123456789", | 139 | // 'numberCharset':"0123456789", |
142 | // 'symbolCharset':"!@#$%^&*+?[]{}/|\\<>,.;:~=-_", | 140 | // 'symbolCharset':"!@#$%^&*+?[]{}/|\\<>,.;:~=-_", |
143 | // }, | 141 | // }, |
144 | 142 | ||
145 | '_': "" | 143 | '_': "" |
146 | } | 144 | } |
147 | } | 145 | } |
148 | 146 | ||
149 | Clipperz.PM.Strings.defaultLanguages = { | 147 | Clipperz.PM.Strings.defaultLanguages = { |
150 | 'default':"en-us", | 148 | 'default':"en-us", |
151 | 149 | ||
152 | // 'de':"de-de", | 150 | // 'de':"de-de", |
153 | // 'el':"el-gr", | 151 | // 'el':"el-gr", |
154 | // 'he':"he-il", | 152 | // 'he':"he-il", |
155 | // 'ru':"ru-ru", | 153 | // 'ru':"ru-ru", |
156 | 154 | ||
157 | 'fr':"fr-fr", | 155 | 'fr':"fr-fr", |
158 | 'es':"es-es", | 156 | 'es':"es-es", |
159 | 'zh':"zh-cn", | 157 | 'zh':"zh-cn", |
160 | 'ja':"ja-jp", | 158 | 'ja':"ja-jp", |
161 | 'pt':"pt-br", | 159 | 'pt':"pt-br", |
162 | 'it':"it-it", | 160 | 'it':"it-it", |
163 | 'en': "en-us" | 161 | 'en': "en-us" |
164 | } | 162 | } |
165 | 163 | ||
166 | Clipperz.PM.Strings.inputTypeToRecordFieldType = { | 164 | Clipperz.PM.Strings.inputTypeToRecordFieldType = { |
167 | 'text': 'TXT', | 165 | 'text': 'TXT', |
168 | 'password': 'PWD', | 166 | 'password': 'PWD', |
169 | 'checkbox': 'CHECK', | 167 | 'checkbox': 'CHECK', |
170 | 'radio': 'RADIO', | 168 | 'radio': 'RADIO', |
171 | 'select': 'SELECT' | 169 | 'select': 'SELECT' |
172 | }; | 170 | }; |
173 | 171 | ||
174 | //----------------------------------------------------------------------------- | 172 | //----------------------------------------------------------------------------- |
175 | 173 | ||
176 | Clipperz.PM.Strings.translateBookmarklet = function (aBookmarkletString) { | 174 | Clipperz.PM.Strings.translateBookmarklet = function (aBookmarkletString) { |
177 | var result; | 175 | var result; |
178 | 176 | ||
179 | result = aBookmarkletString; | 177 | result = aBookmarkletString; |
180 | 178 | ||
181 | result = result.replace(/@BOOKMARKLET_NO_EXCEPTION_MESSAGE@/,Clipperz.PM.Strings.getValue('bookmarkletCopy.noExceptionMessage')); | 179 | result = result.replace(/@BOOKMARKLET_NO_EXCEPTION_MESSAGE@/,Clipperz.PM.Strings.getValue('bookmarkletCopy.noExceptionMessage')); |
182 | result = result.replace(/@BOOKMARKLET_EXCEPTION_MESSAGE@/, Clipperz.PM.Strings.getValue('bookmarkletCopy.exceptionMessage')); | 180 | result = result.replace(/@BOOKMARKLET_EXCEPTION_MESSAGE@/, Clipperz.PM.Strings.getValue('bookmarkletCopy.exceptionMessage')); |
183 | result = result.replace(/@BOOKMARKLET_COPY@/, Clipperz.PM.Strings.getValue('bookmarkletCopy.copy')); | 181 | result = result.replace(/@BOOKMARKLET_COPY@/, Clipperz.PM.Strings.getValue('bookmarkletCopy.copy')); |
184 | result = result.replace(/@BOOKMARKLET_SUCCESSFUL_MESSAGE@/, Clipperz.PM.Strings.getValue('bookmarkletCopy.successfulMessage')); | 182 | result = result.replace(/@BOOKMARKLET_SUCCESSFUL_MESSAGE@/, Clipperz.PM.Strings.getValue('bookmarkletCopy.successfulMessage')); |
185 | result = result.replace(/@BOOKMARKLET_FAIL_MESSAGE@/, Clipperz.PM.Strings.getValue('bookmarkletCopy.failMessage')); | 183 | result = result.replace(/@BOOKMARKLET_FAIL_MESSAGE@/, Clipperz.PM.Strings.getValue('bookmarkletCopy.failMessage')); |
186 | 184 | ||
187 | return result; | 185 | return result; |
188 | } | 186 | } |
189 | 187 | ||
190 | //----------------------------------------------------------------------------- | 188 | //----------------------------------------------------------------------------- |
191 | 189 | ||
192 | Clipperz.PM.Strings.Languages.setSelectedLanguage = function(aLanguage) { | 190 | Clipperz.PM.Strings.Languages.setSelectedLanguage = function(aLanguage) { |
193 | var language; | 191 | var language; |
194 | varselectedLanguage; | 192 | varselectedLanguage; |
195 | 193 | ||
196 | language = (aLanguage || Clipperz.PM.Strings.preferredLanguage || 'default').toLowerCase(); | 194 | language = (aLanguage || Clipperz.PM.Strings.preferredLanguage || 'default').toLowerCase(); |
197 | if (typeof(Clipperz.PM.Strings.defaultLanguages[language]) != 'undefined') { | 195 | if (typeof(Clipperz.PM.Strings.defaultLanguages[language]) != 'undefined') { |
198 | language = Clipperz.PM.Strings.defaultLanguages[language]; | 196 | language = Clipperz.PM.Strings.defaultLanguages[language]; |
199 | } | 197 | } |
200 | 198 | ||
201 | if (typeof(Clipperz.PM.Strings.Languages[language]) != 'undefined') { | 199 | if (typeof(Clipperz.PM.Strings.Languages[language]) != 'undefined') { |
202 | selectedLanguage = language; | 200 | selectedLanguage = language; |
203 | } else if (typeof(Clipperz.PM.Strings.defaultLanguages[language.substr(0,2)]) != 'undefined') { | 201 | } else if (typeof(Clipperz.PM.Strings.defaultLanguages[language.substr(0,2)]) != 'undefined') { |
204 | selectedLanguage = Clipperz.PM.Strings.defaultLanguages[language.substr(0,2)]; | 202 | selectedLanguage = Clipperz.PM.Strings.defaultLanguages[language.substr(0,2)]; |
205 | } else { | 203 | } else { |
206 | selectedLanguage = Clipperz.PM.Strings.defaultLanguages['default']; | 204 | selectedLanguage = Clipperz.PM.Strings.defaultLanguages['default']; |
207 | } | 205 | } |
208 | 206 | ||
209 | if (selectedLanguage != Clipperz.PM.Strings.selectedLanguage) { | 207 | if (selectedLanguage != Clipperz.PM.Strings.selectedLanguage) { |
210 | vartranslations; | 208 | vartranslations; |
211 | 209 | ||
212 | Clipperz.PM.Strings.selectedLanguage = selectedLanguage; | 210 | Clipperz.PM.Strings.selectedLanguage = selectedLanguage; |
213 | 211 | ||
214 | translations = {}; | 212 | translations = {}; |
215 | // MochiKit.Base.update(translations, Clipperz.PM.Strings.standardStrings) | 213 | // MochiKit.Base.update(translations, Clipperz.PM.Strings.standardStrings) |
216 | 214 | ||
217 | MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.Languages['defaults']); | 215 | MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.Languages['defaults']); |
218 | MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.GeneralSettings['defaults']); | 216 | MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.GeneralSettings['defaults']); |
219 | 217 | ||
220 | MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.Languages[Clipperz.PM.Strings.defaultLanguages['default']]); | 218 | MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.Languages[Clipperz.PM.Strings.defaultLanguages['default']]); |
221 | MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.GeneralSettings[Clipperz.PM.Strings.defaultLanguages['default']]); | 219 | MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.GeneralSettings[Clipperz.PM.Strings.defaultLanguages['default']]); |
222 | 220 | ||
223 | MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.Languages[selectedLanguage]); | 221 | MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.Languages[selectedLanguage]); |
224 | MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.GeneralSettings[selectedLanguage]); | 222 | MochiKit.Base.updatetree(translations, Clipperz.PM.Strings.GeneralSettings[selectedLanguage]); |
225 | 223 | ||
226 | Clipperz.PM.Strings.stringsObjectStore = new Clipperz.KeyValueObjectStore(/*{'name':'String.stringsObjectStore [1]'}*/); | 224 | Clipperz.PM.Strings.stringsObjectStore = new Clipperz.KeyValueObjectStore(/*{'name':'String.stringsObjectStore [1]'}*/); |
227 | Clipperz.PM.Strings.stringsObjectStore.initWithValues(translations); | 225 | Clipperz.PM.Strings.stringsObjectStore.initWithValues(translations); |
228 | 226 | ||
229 | if (typeof(bookmarklet) != 'undefined') { | 227 | if (typeof(bookmarklet) != 'undefined') { |
230 | Clipperz.PM.Strings.stringsObjectStore.setValue('bookmarklet', Clipperz.PM.Strings.translateBookmarklet(bookmarklet)); | 228 | Clipperz.PM.Strings.stringsObjectStore.setValue('bookmarklet', Clipperz.PM.Strings.translateBookmarklet(bookmarklet)); |
231 | } | 229 | } |
232 | 230 | ||
233 | MochiKit.Signal.signal(Clipperz.PM.Strings.Languages, 'switchLanguage', selectedLanguage); | 231 | MochiKit.Signal.signal(Clipperz.PM.Strings.Languages, 'switchLanguage', selectedLanguage); |
234 | } | 232 | } |
235 | } | 233 | } |
236 | 234 | ||
237 | //----------------------------------------------------------------------------- | 235 | //----------------------------------------------------------------------------- |
238 | 236 | ||
239 | Clipperz.PM.Strings.getValue = function (aKeyPath, someKeyValues) { | 237 | Clipperz.PM.Strings.getValue = function (aKeyPath, someKeyValues) { |
240 | varresult; | 238 | varresult; |
241 | 239 | ||
242 | result = Clipperz.PM.Strings.stringsObjectStore.getValue(aKeyPath); | 240 | result = Clipperz.PM.Strings.stringsObjectStore.getValue(aKeyPath); |
243 | 241 | ||
244 | //try { | ||
245 | if (typeof(result) == 'string') { | 242 | if (typeof(result) == 'string') { |
246 | if (typeof (someKeyValues) != 'undefined') { | 243 | if (typeof (someKeyValues) != 'undefined') { |
247 | varkey; | 244 | varkey; |
248 | 245 | ||
249 | for (key in someKeyValues) { | 246 | for (key in someKeyValues) { |
250 | result = result.replace( new RegExp(key), someKeyValues[key]); | 247 | result = result.replace( new RegExp(key), someKeyValues[key]); |
251 | // result.replace(, ''); | ||
252 | } | 248 | } |
253 | } | 249 | } |
254 | 250 | ||
255 | result = result.replace(new RegExp('\n'), '<br>'); | 251 | result = result.replace(new RegExp('\n'), '<br>'); |
256 | } | 252 | } |
257 | //} catch (exception) { | ||
258 | //console.log("####", result, aKeyPath, someKeyValues, exception); | ||
259 | //} | ||
260 | 253 | ||
261 | return result; | 254 | return result; |
262 | } | 255 | } |
263 | 256 | ||
264 | Clipperz.PM.Strings.errorDescriptionForException = function (anException) { | 257 | Clipperz.PM.Strings.errorDescriptionForException = function (anException) { |
265 | var result; | 258 | var result; |
266 | 259 | ||
267 | result = Clipperz.PM.Strings.getValue('exceptionsMessages' + '.' + anException.name); | 260 | result = Clipperz.PM.Strings.getValue('exceptionsMessages' + '.' + anException.name); |
268 | 261 | ||
269 | if (result == null) { | 262 | if (result == null) { |
270 | result = anException.message; | 263 | result = anException.message; |
271 | } | 264 | } |
272 | 265 | ||
273 | return result; | 266 | return result; |
274 | }, | 267 | }, |
275 | 268 | ||
276 | //----------------------------------------------------------------------------- | 269 | //----------------------------------------------------------------------------- |
277 | 270 | ||
278 | Clipperz.PM.Strings.Languages.initSetup = function() { | 271 | Clipperz.PM.Strings.Languages.initSetup = function() { |
279 | varlanguage; | 272 | varlanguage; |
280 | varlanguageParser; | 273 | varlanguageParser; |
281 | 274 | ||
282 | language = navigator.language || navigator.userLanguage; //en, en-US, .... "de", "nb-no" | 275 | language = navigator.language || navigator.userLanguage; //en, en-US, .... "de", "nb-no" |
283 | languageParser = new RegExp("language=([a-z]{2}(?:\-[a-z]{2})?)(\&|$)", "i"); | 276 | languageParser = new RegExp("language=([a-z]{2}(?:\-[a-z]{2})?)(\&|$)", "i"); |
284 | if (languageParser.test(window.location.search)) { | 277 | if (languageParser.test(window.location.search)) { |
285 | language = RegExp.$1; | 278 | language = RegExp.$1; |
286 | } | 279 | } |
287 | 280 | ||
288 | Clipperz.PM.Strings.preferredLanguage = language.toLowerCase(); | 281 | Clipperz.PM.Strings.preferredLanguage = language.toLowerCase(); |
289 | Clipperz.PM.Strings.Languages.setSelectedLanguage(Clipperz.PM.Strings.preferredLanguage); | 282 | Clipperz.PM.Strings.Languages.setSelectedLanguage(Clipperz.PM.Strings.preferredLanguage); |
290 | } | 283 | } |
291 | 284 | ||
292 | //----------------------------------------------------------------------------- | 285 | //----------------------------------------------------------------------------- |
diff --git a/frontend/gamma/js/Clipperz/PM/Strings/MessagePanelConfigurations.js b/frontend/gamma/js/Clipperz/PM/Strings/MessagePanelConfigurations.js index 7f6c52f..7565d2d 100644 --- a/frontend/gamma/js/Clipperz/PM/Strings/MessagePanelConfigurations.js +++ b/frontend/gamma/js/Clipperz/PM/Strings/MessagePanelConfigurations.js | |||
@@ -1,214 +1,212 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; } | 26 | if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; } |
29 | 27 | ||
30 | Clipperz.PM.Strings.messagePanelConfigurations = { | 28 | Clipperz.PM.Strings.messagePanelConfigurations = { |
31 | 29 | ||
32 | 30 | ||
33 | //------------------------------------------------------------------------- | 31 | //------------------------------------------------------------------------- |
34 | // | 32 | // |
35 | // Registration - connection | 33 | // Registration - connection |
36 | // | 34 | // |
37 | 'registration_verify': function() { | 35 | 'registration_verify': function() { |
38 | return { | 36 | return { |
39 | 'title': null, | 37 | 'title': null, |
40 | 'text': Clipperz.PM.Strings['connectionRegistrationSendingRequestMessageText'] | 38 | 'text': Clipperz.PM.Strings['connectionRegistrationSendingRequestMessageText'] |
41 | } | 39 | } |
42 | }, | 40 | }, |
43 | 41 | ||
44 | 'registration_sendingCredentials': function() { | 42 | 'registration_sendingCredentials': function() { |
45 | return { | 43 | return { |
46 | 'title': null, | 44 | 'title': null, |
47 | 'text': Clipperz.PM.Strings['connectionRegistrationSendingCredentialsMessageText'] | 45 | 'text': Clipperz.PM.Strings['connectionRegistrationSendingCredentialsMessageText'] |
48 | } | 46 | } |
49 | }, | 47 | }, |
50 | 48 | ||
51 | //------------------------------------------------------------------------- | 49 | //------------------------------------------------------------------------- |
52 | // | 50 | // |
53 | // One Time Password login message panel | 51 | // One Time Password login message panel |
54 | // | 52 | // |
55 | 53 | ||
56 | 'OTP_login_start': function() { | 54 | 'OTP_login_start': function() { |
57 | return { | 55 | return { |
58 | 'title': Clipperz.PM.Strings['OTPloginMessagePanelInitialTitle'], | 56 | 'title': Clipperz.PM.Strings['OTPloginMessagePanelInitialTitle'], |
59 | 'text': Clipperz.PM.Strings['OTPloginMessagePanelInitialText'], | 57 | 'text': Clipperz.PM.Strings['OTPloginMessagePanelInitialText'], |
60 | 'steps': '+3', | 58 | 'steps': '+3', |
61 | 'buttons': {} | 59 | 'buttons': {} |
62 | } | 60 | } |
63 | }, | 61 | }, |
64 | 62 | ||
65 | 'OTP_login_loadingOTP': function() { | 63 | 'OTP_login_loadingOTP': function() { |
66 | return { | 64 | return { |
67 | 'title': Clipperz.PM.Strings['OTPloginMessagePanelLoadingTitle'], | 65 | 'title': Clipperz.PM.Strings['OTPloginMessagePanelLoadingTitle'], |
68 | 'text': Clipperz.PM.Strings['OTPloginMessagePanelLoadingText'] | 66 | 'text': Clipperz.PM.Strings['OTPloginMessagePanelLoadingText'] |
69 | } | 67 | } |
70 | }, | 68 | }, |
71 | 69 | ||
72 | 'OTP_login_extractingPassphrase': function() { | 70 | 'OTP_login_extractingPassphrase': function() { |
73 | return { | 71 | return { |
74 | 'title': Clipperz.PM.Strings['OTPloginMessagePanelProcessingTitle'], | 72 | 'title': Clipperz.PM.Strings['OTPloginMessagePanelProcessingTitle'], |
75 | 'text': Clipperz.PM.Strings['OTPloginMessagePanelProcessingText'] | 73 | 'text': Clipperz.PM.Strings['OTPloginMessagePanelProcessingText'] |
76 | } | 74 | } |
77 | }, | 75 | }, |
78 | 76 | ||
79 | 77 | ||
80 | //------------------------------------------------------------------------- | 78 | //------------------------------------------------------------------------- |
81 | // | 79 | // |
82 | // Login message panel | 80 | // Login message panel |
83 | // | 81 | // |
84 | 'login_start': function() { | 82 | 'login_start': function() { |
85 | return { | 83 | return { |
86 | 'title': Clipperz.PM.Strings['loginMessagePanelInitialTitle'], | 84 | 'title': Clipperz.PM.Strings['loginMessagePanelInitialTitle'], |
87 | 'text': Clipperz.PM.Strings['loginMessagePanelInitialText'], | 85 | 'text': Clipperz.PM.Strings['loginMessagePanelInitialText'], |
88 | 'steps': '+7', | 86 | 'steps': '+7', |
89 | 'buttons': { | 87 | 'buttons': { |
90 | 'ok': Clipperz.PM.Strings['loginMessagePanelInitialButtonLabel'] | 88 | 'ok': Clipperz.PM.Strings['loginMessagePanelInitialButtonLabel'] |
91 | } | 89 | } |
92 | } | 90 | } |
93 | }, | 91 | }, |
94 | 92 | ||
95 | 'login_connected': function() { | 93 | 'login_connected': function() { |
96 | return { | 94 | return { |
97 | 'title': Clipperz.PM.Strings['loginMessagePanelConnectedTitle'], | 95 | 'title': Clipperz.PM.Strings['loginMessagePanelConnectedTitle'], |
98 | 'text': Clipperz.PM.Strings['loginMessagePanelConnectedText'], | 96 | 'text': Clipperz.PM.Strings['loginMessagePanelConnectedText'], |
99 | 'buttons': {} | 97 | 'buttons': {} |
100 | } | 98 | } |
101 | }, | 99 | }, |
102 | 100 | ||
103 | 'login_failed':function() { | 101 | 'login_failed':function() { |
104 | return { | 102 | return { |
105 | 'title': Clipperz.PM.Strings['loginMessagePanelFailureTitle'], | 103 | 'title': Clipperz.PM.Strings['loginMessagePanelFailureTitle'], |
106 | 'text': Clipperz.PM.Strings['loginMessagePanelFailureText'], | 104 | 'text': Clipperz.PM.Strings['loginMessagePanelFailureText'], |
107 | 'button': Clipperz.PM.Strings['loginMessagePanelFailureButtonLabel'] | 105 | 'button': Clipperz.PM.Strings['loginMessagePanelFailureButtonLabel'] |
108 | } | 106 | } |
109 | }, | 107 | }, |
110 | 108 | ||
111 | //------------------------------------------------------------------------- | 109 | //------------------------------------------------------------------------- |
112 | // | 110 | // |
113 | // Login message panel - connection | 111 | // Login message panel - connection |
114 | // | 112 | // |
115 | 'connection_sendingCredentials': function() { | 113 | 'connection_sendingCredentials': function() { |
116 | return { | 114 | return { |
117 | 'title': Clipperz.PM.Strings['connectionLoginSendingCredentialsMessageTitle'], | 115 | 'title': Clipperz.PM.Strings['connectionLoginSendingCredentialsMessageTitle'], |
118 | 'text': Clipperz.PM.Strings['connectionLoginSendingCredentialsMessageText'] | 116 | 'text': Clipperz.PM.Strings['connectionLoginSendingCredentialsMessageText'] |
119 | } | 117 | } |
120 | }, | 118 | }, |
121 | 119 | ||
122 | 'connection_credentialVerification': function() { | 120 | 'connection_credentialVerification': function() { |
123 | return { | 121 | return { |
124 | 'title': Clipperz.PM.Strings['connectionLoginCredentialsVerificationMessageTitle'], | 122 | 'title': Clipperz.PM.Strings['connectionLoginCredentialsVerificationMessageTitle'], |
125 | 'text': Clipperz.PM.Strings['connectionLoginCredentialsVerificationMessageText'] | 123 | 'text': Clipperz.PM.Strings['connectionLoginCredentialsVerificationMessageText'] |
126 | } | 124 | } |
127 | }, | 125 | }, |
128 | 126 | ||
129 | 'connection_loggedIn': function() { | 127 | 'connection_loggedIn': function() { |
130 | return { | 128 | return { |
131 | 'title': Clipperz.PM.Strings['connectionLoginDoneMessageTitle'], | 129 | 'title': Clipperz.PM.Strings['connectionLoginDoneMessageTitle'], |
132 | 'text': Clipperz.PM.Strings['connectionLoginDoneMessageText'] | 130 | 'text': Clipperz.PM.Strings['connectionLoginDoneMessageText'] |
133 | } | 131 | } |
134 | }, | 132 | }, |
135 | 133 | ||
136 | //------------------------------------------------------------------------- | 134 | //------------------------------------------------------------------------- |
137 | // | 135 | // |
138 | //Login message panel - user | 136 | //Login message panel - user |
139 | // | 137 | // |
140 | 'connection_upgrading': function() { | 138 | 'connection_upgrading': function() { |
141 | return { | 139 | return { |
142 | 'title': Clipperz.PM.Strings['userLoginPanelUpgradingUserCredentialsMessageTitle'], | 140 | 'title': Clipperz.PM.Strings['userLoginPanelUpgradingUserCredentialsMessageTitle'], |
143 | 'text': Clipperz.PM.Strings['userLoginPanelUpgradingUserCredentialsMessageText'], | 141 | 'text': Clipperz.PM.Strings['userLoginPanelUpgradingUserCredentialsMessageText'], |
144 | 'steps': '+1' | 142 | 'steps': '+1' |
145 | } | 143 | } |
146 | }, | 144 | }, |
147 | 145 | ||
148 | 'connection_done': function() { | 146 | 'connection_done': function() { |
149 | return { | 147 | return { |
150 | 'title': Clipperz.PM.Strings['userLoginPanelConnectedMessageTitle'], | 148 | 'title': Clipperz.PM.Strings['userLoginPanelConnectedMessageTitle'], |
151 | 'text': Clipperz.PM.Strings['userLoginPanelConnectedMessageText'] | 149 | 'text': Clipperz.PM.Strings['userLoginPanelConnectedMessageText'] |
152 | } | 150 | } |
153 | }, | 151 | }, |
154 | 152 | ||
155 | 'connection_tryOlderSchema': function() { | 153 | 'connection_tryOlderSchema': function() { |
156 | return { | 154 | return { |
157 | 'title': Clipperz.PM.Strings['userLoginPanelTryingAnOlderConnectionSchemaMessageTitle'], | 155 | 'title': Clipperz.PM.Strings['userLoginPanelTryingAnOlderConnectionSchemaMessageTitle'], |
158 | 'text': Clipperz.PM.Strings['userLoginPanelTryingAnOlderConnectionSchemaMessageText'], | 156 | 'text': Clipperz.PM.Strings['userLoginPanelTryingAnOlderConnectionSchemaMessageText'], |
159 | 'steps': '+4' | 157 | 'steps': '+4' |
160 | } | 158 | } |
161 | }, | 159 | }, |
162 | 160 | ||
163 | 'connection_loadingUserData': function() { | 161 | 'connection_loadingUserData': function() { |
164 | return { | 162 | return { |
165 | 'title': Clipperz.PM.Strings['userLoginPanelLoadingUserDataMessageTitle'], | 163 | 'title': Clipperz.PM.Strings['userLoginPanelLoadingUserDataMessageTitle'], |
166 | 'text': Clipperz.PM.Strings['userLoginPanelLoadingUserDataMessageText'] | 164 | 'text': Clipperz.PM.Strings['userLoginPanelLoadingUserDataMessageText'] |
167 | } | 165 | } |
168 | }, | 166 | }, |
169 | 167 | ||
170 | 'connection_decryptingUserData': function() { | 168 | 'connection_decryptingUserData': function() { |
171 | return { | 169 | return { |
172 | 'title': Clipperz.PM.Strings['userLoginPanelDecryptingUserDataMessageTitle'], | 170 | 'title': Clipperz.PM.Strings['userLoginPanelDecryptingUserDataMessageTitle'], |
173 | 'text': Clipperz.PM.Strings['userLoginPanelDecryptingUserDataMessageText'], | 171 | 'text': Clipperz.PM.Strings['userLoginPanelDecryptingUserDataMessageText'], |
174 | 'steps': '+1' | 172 | 'steps': '+1' |
175 | } | 173 | } |
176 | }, | 174 | }, |
177 | 175 | ||
178 | 'connection_decryptingUserStatistics': function() { | 176 | 'connection_decryptingUserStatistics': function() { |
179 | return { | 177 | return { |
180 | 'title': Clipperz.PM.Strings['userLoginPanelDecryptingUserStatisticsMessageTitle'], | 178 | 'title': Clipperz.PM.Strings['userLoginPanelDecryptingUserStatisticsMessageTitle'], |
181 | 'text': Clipperz.PM.Strings['userLoginPanelDecryptingUserStatisticsMessageText'] | 179 | 'text': Clipperz.PM.Strings['userLoginPanelDecryptingUserStatisticsMessageText'] |
182 | } | 180 | } |
183 | }, | 181 | }, |
184 | 182 | ||
185 | 'collectingEntropy': function() { | 183 | 'collectingEntropy': function() { |
186 | return { | 184 | return { |
187 | 'text': Clipperz.PM.Strings['panelCollectingEntryopyMessageText'], | 185 | 'text': Clipperz.PM.Strings['panelCollectingEntryopyMessageText'], |
188 | 'steps': '+1' | 186 | 'steps': '+1' |
189 | } | 187 | } |
190 | }, | 188 | }, |
191 | 189 | ||
192 | //------------------------------------------------------------------------- | 190 | //------------------------------------------------------------------------- |
193 | // | 191 | // |
194 | // Cards block - delete card panel | 192 | // Cards block - delete card panel |
195 | // | 193 | // |
196 | 'deleteRecord_collectData': function() { | 194 | 'deleteRecord_collectData': function() { |
197 | return { | 195 | return { |
198 | 'title': Clipperz.PM.Strings['deleteRecordPanelCollectRecordDataMessageTitle'], | 196 | 'title': Clipperz.PM.Strings['deleteRecordPanelCollectRecordDataMessageTitle'], |
199 | 'text': Clipperz.PM.Strings['deleteRecordPanelCollectRecordDataMessageText'] | 197 | 'text': Clipperz.PM.Strings['deleteRecordPanelCollectRecordDataMessageText'] |
200 | } | 198 | } |
201 | }, | 199 | }, |
202 | 200 | ||
203 | 'deleteRecord_encryptData': function() { | 201 | 'deleteRecord_encryptData': function() { |
204 | return { | 202 | return { |
205 | 'title': Clipperz.PM.Strings['deleteRecordPanelEncryptUserDataMessageTitle'], | 203 | 'title': Clipperz.PM.Strings['deleteRecordPanelEncryptUserDataMessageTitle'], |
206 | 'text': Clipperz.PM.Strings['deleteRecordPanelEncryptUserDataMessageText'] | 204 | 'text': Clipperz.PM.Strings['deleteRecordPanelEncryptUserDataMessageText'] |
207 | } | 205 | } |
208 | }, | 206 | }, |
209 | 207 | ||
210 | 'deleteRecord_sendingData': function() { | 208 | 'deleteRecord_sendingData': function() { |
211 | return { | 209 | return { |
212 | 'title': Clipperz.PM.Strings['deleteRecordPanelSendingDataToTheServerMessageTitle'], | 210 | 'title': Clipperz.PM.Strings['deleteRecordPanelSendingDataToTheServerMessageTitle'], |
213 | 'text': Clipperz.PM.Strings['deleteRecordPanelSendingDataToTheServerMessageText'] | 211 | 'text': Clipperz.PM.Strings['deleteRecordPanelSendingDataToTheServerMessageText'] |
214 | } | 212 | } |
diff --git a/frontend/gamma/js/Clipperz/PM/Strings/Strings_defaults.js b/frontend/gamma/js/Clipperz/PM/Strings/Strings_defaults.js index 101ed3f..aefd94a 100644 --- a/frontend/gamma/js/Clipperz/PM/Strings/Strings_defaults.js +++ b/frontend/gamma/js/Clipperz/PM/Strings/Strings_defaults.js | |||
@@ -1,214 +1,212 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; } | 26 | if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; } |
29 | if (typeof(Clipperz.PM.Strings.Languages) == 'undefined') { Clipperz.PM.Strings.Languages = {}; } | 27 | if (typeof(Clipperz.PM.Strings.Languages) == 'undefined') { Clipperz.PM.Strings.Languages = {}; } |
30 | 28 | ||
31 | //============================================================================= | 29 | //============================================================================= |
32 | // | 30 | // |
33 | // D E F A U L T S ( defaults ) | 31 | // D E F A U L T S ( defaults ) |
34 | // | 32 | // |
35 | //============================================================================= | 33 | //============================================================================= |
36 | 34 | ||
37 | Clipperz.PM.Strings.Languages['defaults'] = { | 35 | Clipperz.PM.Strings.Languages['defaults'] = { |
38 | 36 | ||
39 | 'elapsedTimeDescriptions': { | 37 | 'elapsedTimeDescriptions': { |
40 | 'MORE_THAN_A_MONTH_AGO': "more than a month ago", | 38 | 'MORE_THAN_A_MONTH_AGO': "more than a month ago", |
41 | 'MORE_THAN_A_WEEK_AGO': "more than a week ago", | 39 | 'MORE_THAN_A_WEEK_AGO': "more than a week ago", |
42 | 'MORE_THAN_*_WEEKS_AGO': "more than __elapsed__ weeks ago", | 40 | 'MORE_THAN_*_WEEKS_AGO': "more than __elapsed__ weeks ago", |
43 | 'YESTERDAY': "yesterday", | 41 | 'YESTERDAY': "yesterday", |
44 | '*_DAYS_AGO': "__elapsed__ days ago", | 42 | '*_DAYS_AGO': "__elapsed__ days ago", |
45 | 'ABOUT_AN_HOUR_AGO': "about an hour ago", | 43 | 'ABOUT_AN_HOUR_AGO': "about an hour ago", |
46 | '*_HOURS_AGO': "__elapsed__ hours ago", | 44 | '*_HOURS_AGO': "__elapsed__ hours ago", |
47 | 'JUST_A_FEW_MINUTES_AGO': "just a few minutes ago", | 45 | 'JUST_A_FEW_MINUTES_AGO': "just a few minutes ago", |
48 | 'ABOUT_*_MINUTES_AGO': "about __elapsed__ minutes ago" | 46 | 'ABOUT_*_MINUTES_AGO': "about __elapsed__ minutes ago" |
49 | }, | 47 | }, |
50 | /* | 48 | /* |
51 | 'unknown_ip': "unknown", | 49 | 'unknown_ip': "unknown", |
52 | 50 | ||
53 | 'countries': { | 51 | 'countries': { |
54 | '--': "unknown", | 52 | '--': "unknown", |
55 | 'AD': "Andorra", | 53 | 'AD': "Andorra", |
56 | 'AE': "United Arab Emirates", | 54 | 'AE': "United Arab Emirates", |
57 | 'AF': "Afghanistan", | 55 | 'AF': "Afghanistan", |
58 | 'AG': "Antigua and Barbuda", | 56 | 'AG': "Antigua and Barbuda", |
59 | 'AI': "Anguilla", | 57 | 'AI': "Anguilla", |
60 | 'AL': "Albania", | 58 | 'AL': "Albania", |
61 | 'AM': "Armenia", | 59 | 'AM': "Armenia", |
62 | 'AN': "Netherlands Antilles", | 60 | 'AN': "Netherlands Antilles", |
63 | 'AO': "Angola", | 61 | 'AO': "Angola", |
64 | 'AP': "Non-Spec Asia Pas Location", | 62 | 'AP': "Non-Spec Asia Pas Location", |
65 | 'AR': "Argentina", | 63 | 'AR': "Argentina", |
66 | 'AS': "American Samoa", | 64 | 'AS': "American Samoa", |
67 | 'AT': "Austria", | 65 | 'AT': "Austria", |
68 | 'AU': "Australia", | 66 | 'AU': "Australia", |
69 | 'AW': "Aruba", | 67 | 'AW': "Aruba", |
70 | 'AX': "Aland Islands", | 68 | 'AX': "Aland Islands", |
71 | 'AZ': "Azerbaijan", | 69 | 'AZ': "Azerbaijan", |
72 | 'BA': "Bosnia and Herzegowina", | 70 | 'BA': "Bosnia and Herzegowina", |
73 | 'BB': "Barbados", | 71 | 'BB': "Barbados", |
74 | 'BD': "Bangladesh", | 72 | 'BD': "Bangladesh", |
75 | 'BE': "Belgium", | 73 | 'BE': "Belgium", |
76 | 'BF': "Burkina Faso", | 74 | 'BF': "Burkina Faso", |
77 | 'BG': "Bulgaria", | 75 | 'BG': "Bulgaria", |
78 | 'BH': "Bahrain", | 76 | 'BH': "Bahrain", |
79 | 'BI': "Burundi", | 77 | 'BI': "Burundi", |
80 | 'BJ': "Benin", | 78 | 'BJ': "Benin", |
81 | 'BM': "Bermuda", | 79 | 'BM': "Bermuda", |
82 | 'BN': "Brunei Darussalam", | 80 | 'BN': "Brunei Darussalam", |
83 | 'BO': "Bolivia", | 81 | 'BO': "Bolivia", |
84 | 'BR': "Brazil", | 82 | 'BR': "Brazil", |
85 | 'BS': "Bahamas", | 83 | 'BS': "Bahamas", |
86 | 'BT': "Bhutan", | 84 | 'BT': "Bhutan", |
87 | 'BW': "Botswana", | 85 | 'BW': "Botswana", |
88 | 'BY': "Belarus", | 86 | 'BY': "Belarus", |
89 | 'BZ': "Belize", | 87 | 'BZ': "Belize", |
90 | 'CA': "Canada", | 88 | 'CA': "Canada", |
91 | 'CD': "Congo the Democratic Republic of the", | 89 | 'CD': "Congo the Democratic Republic of the", |
92 | 'CF': "Central African Republic", | 90 | 'CF': "Central African Republic", |
93 | 'CH': "Switzerland", | 91 | 'CH': "Switzerland", |
94 | 'CI': "Cote D'ivoire", | 92 | 'CI': "Cote D'ivoire", |
95 | 'CK': "Cook Islands", | 93 | 'CK': "Cook Islands", |
96 | 'CL': "Chile", | 94 | 'CL': "Chile", |
97 | 'CM': "Cameroon", | 95 | 'CM': "Cameroon", |
98 | 'CN': "China", | 96 | 'CN': "China", |
99 | 'CO': "Colombia", | 97 | 'CO': "Colombia", |
100 | 'CR': "Costa Rica", | 98 | 'CR': "Costa Rica", |
101 | 'CS': "Serbia and Montenegro", | 99 | 'CS': "Serbia and Montenegro", |
102 | 'CU': "Cuba", | 100 | 'CU': "Cuba", |
103 | 'CY': "Cyprus", | 101 | 'CY': "Cyprus", |
104 | 'CZ': "Czech Republic", | 102 | 'CZ': "Czech Republic", |
105 | 'DE': "Germany", | 103 | 'DE': "Germany", |
106 | 'DJ': "Djibouti", | 104 | 'DJ': "Djibouti", |
107 | 'DK': "Denmark", | 105 | 'DK': "Denmark", |
108 | 'DO': "Dominican Republic", | 106 | 'DO': "Dominican Republic", |
109 | 'DZ': "Algeria", | 107 | 'DZ': "Algeria", |
110 | 'EC': "Ecuador", | 108 | 'EC': "Ecuador", |
111 | 'EE': "Estonia", | 109 | 'EE': "Estonia", |
112 | 'EG': "Egypt", | 110 | 'EG': "Egypt", |
113 | 'ER': "Eritrea", | 111 | 'ER': "Eritrea", |
114 | 'ES': "Spain", | 112 | 'ES': "Spain", |
115 | 'ET': "Ethiopia", | 113 | 'ET': "Ethiopia", |
116 | 'EU': "European Union", | 114 | 'EU': "European Union", |
117 | 'FI': "Finland", | 115 | 'FI': "Finland", |
118 | 'FJ': "Fiji", | 116 | 'FJ': "Fiji", |
119 | 'FM': "Micronesia Federated States of", | 117 | 'FM': "Micronesia Federated States of", |
120 | 'FO': "Faroe Islands", | 118 | 'FO': "Faroe Islands", |
121 | 'FR': "France", | 119 | 'FR': "France", |
122 | 'GA': "Gabon", | 120 | 'GA': "Gabon", |
123 | 'GB': "United Kingdom", | 121 | 'GB': "United Kingdom", |
124 | 'GD': "Grenada", | 122 | 'GD': "Grenada", |
125 | 'GE': "Georgia", | 123 | 'GE': "Georgia", |
126 | 'GF': "French Guiana", | 124 | 'GF': "French Guiana", |
127 | 'GG': "Guernsey", | 125 | 'GG': "Guernsey", |
128 | 'GH': "Ghana", | 126 | 'GH': "Ghana", |
129 | 'GI': "Gibraltar", | 127 | 'GI': "Gibraltar", |
130 | 'GL': "Greenland", | 128 | 'GL': "Greenland", |
131 | 'GM': "Gambia", | 129 | 'GM': "Gambia", |
132 | 'GP': "Guadeloupe", | 130 | 'GP': "Guadeloupe", |
133 | 'GR': "Greece", | 131 | 'GR': "Greece", |
134 | 'GT': "Guatemala", | 132 | 'GT': "Guatemala", |
135 | 'GU': "Guam", | 133 | 'GU': "Guam", |
136 | 'GW': "Guinea-Bissau", | 134 | 'GW': "Guinea-Bissau", |
137 | 'GY': "Guyana", | 135 | 'GY': "Guyana", |
138 | 'HK': "Hong Kong", | 136 | 'HK': "Hong Kong", |
139 | 'HN': "Honduras", | 137 | 'HN': "Honduras", |
140 | 'HR': "Croatia (Local Name: Hrvatska)", | 138 | 'HR': "Croatia (Local Name: Hrvatska)", |
141 | 'HT': "Haiti", | 139 | 'HT': "Haiti", |
142 | 'HU': "Hungary", | 140 | 'HU': "Hungary", |
143 | 'ID': "Indonesia", | 141 | 'ID': "Indonesia", |
144 | 'IE': "Ireland", | 142 | 'IE': "Ireland", |
145 | 'IL': "Israel", | 143 | 'IL': "Israel", |
146 | 'IM': "Isle of Man", | 144 | 'IM': "Isle of Man", |
147 | 'IN': "India", | 145 | 'IN': "India", |
148 | 'IO': "British Indian Ocean Territory", | 146 | 'IO': "British Indian Ocean Territory", |
149 | 'IQ': "Iraq", | 147 | 'IQ': "Iraq", |
150 | 'IR': "Iran (Islamic Republic of)", | 148 | 'IR': "Iran (Islamic Republic of)", |
151 | 'IS': "Iceland", | 149 | 'IS': "Iceland", |
152 | 'IT': "Italy", | 150 | 'IT': "Italy", |
153 | 'JE': "Jersey", | 151 | 'JE': "Jersey", |
154 | 'JM': "Jamaica", | 152 | 'JM': "Jamaica", |
155 | 'JO': "Jordan", | 153 | 'JO': "Jordan", |
156 | 'JP': "Japan", | 154 | 'JP': "Japan", |
157 | 'KE': "Kenya", | 155 | 'KE': "Kenya", |
158 | 'KG': "Kyrgyzstan", | 156 | 'KG': "Kyrgyzstan", |
159 | 'KH': "Cambodia", | 157 | 'KH': "Cambodia", |
160 | 'KI': "Kiribati", | 158 | 'KI': "Kiribati", |
161 | 'KN': "Saint Kitts and Nevis", | 159 | 'KN': "Saint Kitts and Nevis", |
162 | 'KR': "Korea Republic of", | 160 | 'KR': "Korea Republic of", |
163 | 'KW': "Kuwait", | 161 | 'KW': "Kuwait", |
164 | 'KY': "Cayman Islands", | 162 | 'KY': "Cayman Islands", |
165 | 'KZ': "Kazakhstan", | 163 | 'KZ': "Kazakhstan", |
166 | 'LA': "Lao People's Democratic Republic", | 164 | 'LA': "Lao People's Democratic Republic", |
167 | 'LB': "Lebanon", | 165 | 'LB': "Lebanon", |
168 | 'LC': "Saint Lucia", | 166 | 'LC': "Saint Lucia", |
169 | 'LI': "Liechtenstein", | 167 | 'LI': "Liechtenstein", |
170 | 'LK': "Sri Lanka", | 168 | 'LK': "Sri Lanka", |
171 | 'LR': "Liberia", | 169 | 'LR': "Liberia", |
172 | 'LS': "Lesotho", | 170 | 'LS': "Lesotho", |
173 | 'LT': "Lithuania", | 171 | 'LT': "Lithuania", |
174 | 'LU': "Luxembourg", | 172 | 'LU': "Luxembourg", |
175 | 'LV': "Latvia", | 173 | 'LV': "Latvia", |
176 | 'LY': "Libyan Arab Jamahiriya", | 174 | 'LY': "Libyan Arab Jamahiriya", |
177 | 'MA': "Morocco", | 175 | 'MA': "Morocco", |
178 | 'MC': "Monaco", | 176 | 'MC': "Monaco", |
179 | 'MD': "Moldova Republic of", | 177 | 'MD': "Moldova Republic of", |
180 | 'MG': "Madagascar", | 178 | 'MG': "Madagascar", |
181 | 'MH': "Marshall Islands", | 179 | 'MH': "Marshall Islands", |
182 | 'MK': "Macedonia the Former Yugoslav Republic of", | 180 | 'MK': "Macedonia the Former Yugoslav Republic of", |
183 | 'ML': "Mali", | 181 | 'ML': "Mali", |
184 | 'MM': "Myanmar", | 182 | 'MM': "Myanmar", |
185 | 'MN': "Mongolia", | 183 | 'MN': "Mongolia", |
186 | 'MO': "Macau", | 184 | 'MO': "Macau", |
187 | 'MP': "Northern Mariana Islands", | 185 | 'MP': "Northern Mariana Islands", |
188 | 'MR': "Mauritania", | 186 | 'MR': "Mauritania", |
189 | 'MS': "Montserrat", | 187 | 'MS': "Montserrat", |
190 | 'MT': "Malta", | 188 | 'MT': "Malta", |
191 | 'MU': "Mauritius", | 189 | 'MU': "Mauritius", |
192 | 'MV': "Maldives", | 190 | 'MV': "Maldives", |
193 | 'MW': "Malawi", | 191 | 'MW': "Malawi", |
194 | 'MX': "Mexico", | 192 | 'MX': "Mexico", |
195 | 'MY': "Malaysia", | 193 | 'MY': "Malaysia", |
196 | 'MZ': "Mozambique", | 194 | 'MZ': "Mozambique", |
197 | 'NA': "Namibia", | 195 | 'NA': "Namibia", |
198 | 'NC': "New Caledonia", | 196 | 'NC': "New Caledonia", |
199 | 'NF': "Norfolk Island", | 197 | 'NF': "Norfolk Island", |
200 | 'NG': "Nigeria", | 198 | 'NG': "Nigeria", |
201 | 'NI': "Nicaragua", | 199 | 'NI': "Nicaragua", |
202 | 'NL': "Netherlands", | 200 | 'NL': "Netherlands", |
203 | 'NO': "Norway", | 201 | 'NO': "Norway", |
204 | 'NP': "Nepal", | 202 | 'NP': "Nepal", |
205 | 'NR': "Nauru", | 203 | 'NR': "Nauru", |
206 | 'NU': "Niue", | 204 | 'NU': "Niue", |
207 | 'NZ': "New Zealand", | 205 | 'NZ': "New Zealand", |
208 | 'OM': "Oman", | 206 | 'OM': "Oman", |
209 | 'PA': "Panama", | 207 | 'PA': "Panama", |
210 | 'PE': "Peru", | 208 | 'PE': "Peru", |
211 | 'PF': "French Polynesia", | 209 | 'PF': "French Polynesia", |
212 | 'PG': "Papua New Guinea", | 210 | 'PG': "Papua New Guinea", |
213 | 'PH': "Philippines", | 211 | 'PH': "Philippines", |
214 | 'PK': "Pakistan", | 212 | 'PK': "Pakistan", |
diff --git a/frontend/gamma/js/Clipperz/PM/Strings/Strings_en-US.js b/frontend/gamma/js/Clipperz/PM/Strings/Strings_en-US.js index b540633..85d55c0 100644 --- a/frontend/gamma/js/Clipperz/PM/Strings/Strings_en-US.js +++ b/frontend/gamma/js/Clipperz/PM/Strings/Strings_en-US.js | |||
@@ -1,214 +1,212 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | //============================================================================= | 24 | //============================================================================= |
27 | // | 25 | // |
28 | // E N G L I S H A M E R I C A N ( en_US ) | 26 | // E N G L I S H A M E R I C A N ( en_US ) |
29 | // | 27 | // |
30 | //============================================================================= | 28 | //============================================================================= |
31 | 29 | ||
32 | Clipperz.PM.Strings.Languages['en-us'] = { | 30 | Clipperz.PM.Strings.Languages['en-us'] = { |
33 | /* | 31 | /* |
34 | //Login page - description | 32 | //Login page - description |
35 | 'clipperzServiceDescription': "\ | 33 | 'clipperzServiceDescription': "\ |
36 | <!-- FIX CSS DONE -->\ | 34 | <!-- FIX CSS DONE -->\ |
37 | <h2>Keep it to yourself!</h2>\ | 35 | <h2>Keep it to yourself!</h2>\ |
38 | <ul>\ | 36 | <ul>\ |
39 | <li>\ | 37 | <li>\ |
40 | <h3>Clipperz is:</h3>\ | 38 | <h3>Clipperz is:</h3>\ |
41 | <ul>\ | 39 | <ul>\ |
42 | <li><p>a secure and simple password manager</p></li>\ | 40 | <li><p>a secure and simple password manager</p></li>\ |
43 | <li><p>an effective single sign-on solution</p></li>\ | 41 | <li><p>an effective single sign-on solution</p></li>\ |
44 | <li><p>a digital vault for your personal data</p></li>\ | 42 | <li><p>a digital vault for your personal data</p></li>\ |
45 | </ul>\ | 43 | </ul>\ |
46 | </li>\ | 44 | </li>\ |
47 | <li>\ | 45 | <li>\ |
48 | <h3>With Clipperz you can:</h3>\ | 46 | <h3>With Clipperz you can:</h3>\ |
49 | <ul>\ | 47 | <ul>\ |
50 | <li><p>store and manage your passwords and online credentials</p></li>\ | 48 | <li><p>store and manage your passwords and online credentials</p></li>\ |
51 | <li><p>login to your web services without entering any username or password</p></li>\ | 49 | <li><p>login to your web services without entering any username or password</p></li>\ |
52 | <li><p>protect all your sensitive data: codes for burglar alarms, PINs, credit card numbers, …</p></li>\ | 50 | <li><p>protect all your sensitive data: codes for burglar alarms, PINs, credit card numbers, …</p></li>\ |
53 | <li><p>share secrets with family members and associates (coming soon)</p></li>\ | 51 | <li><p>share secrets with family members and associates (coming soon)</p></li>\ |
54 | </ul>\ | 52 | </ul>\ |
55 | </li>\ | 53 | </li>\ |
56 | <li>\ | 54 | <li>\ |
57 | <h3>Clipperz benefits:</h3>\ | 55 | <h3>Clipperz benefits:</h3>\ |
58 | <ul>\ | 56 | <ul>\ |
59 | <li><p>free and completely anonymous</p></li>\ | 57 | <li><p>free and completely anonymous</p></li>\ |
60 | <li><p>access it any time from any computer</p></li>\ | 58 | <li><p>access it any time from any computer</p></li>\ |
61 | <li><p>no software to download and nothing to install</p></li>\ | 59 | <li><p>no software to download and nothing to install</p></li>\ |
62 | <li><p>avoid keeping secrets on your PC or on paper</p></li>\ | 60 | <li><p>avoid keeping secrets on your PC or on paper</p></li>\ |
63 | </ul>\ | 61 | </ul>\ |
64 | </li>\ | 62 | </li>\ |
65 | <li>\ | 63 | <li>\ |
66 | <h3>Clipperz security:</h3>\ | 64 | <h3>Clipperz security:</h3>\ |
67 | <ul>\ | 65 | <ul>\ |
68 | <li><p>your secrets are locally encrypted by your browser before being uploaded to Clipperz</p></li>\ | 66 | <li><p>your secrets are locally encrypted by your browser before being uploaded to Clipperz</p></li>\ |
69 | <li><p>the encryption key is a passphrase known only to you</p></li>\ | 67 | <li><p>the encryption key is a passphrase known only to you</p></li>\ |
70 | <li><p>Clipperz hosts your sensitive data in encrypted form and could never actually access the data in its plain form</p></li>\ | 68 | <li><p>Clipperz hosts your sensitive data in encrypted form and could never actually access the data in its plain form</p></li>\ |
71 | <li><p>Clipperz is built upon standard encryption schemes, nothing fancies or homemade</p></li>\ | 69 | <li><p>Clipperz is built upon standard encryption schemes, nothing fancies or homemade</p></li>\ |
72 | <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>\ | 70 | <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>\ |
73 | </ul>\ | 71 | </ul>\ |
74 | </li>\ | 72 | </li>\ |
75 | <li>\ | 73 | <li>\ |
76 | <a href=\"http://www.clipperz.com\" target=\"_blank\">Learn more</a>\ | 74 | <a href=\"http://www.clipperz.com\" target=\"_blank\">Learn more</a>\ |
77 | </li>\ | 75 | </li>\ |
78 | </ul>", | 76 | </ul>", |
79 | 77 | ||
80 | 78 | ||
81 | 'loginFormTitle': "login with your Clipperz account", | 79 | 'loginFormTitle': "login with your Clipperz account", |
82 | 'loginFormUsernameLabel': "username", | 80 | 'loginFormUsernameLabel': "username", |
83 | 'loginFormPassphraseLabel': "passphrase", | 81 | 'loginFormPassphraseLabel': "passphrase", |
84 | 'loginFormDontHaveAnAccountLabel': "don\'t have an account?", | 82 | 'loginFormDontHaveAnAccountLabel': "don\'t have an account?", |
85 | 'loginFormCreateOneLabel': "create one", | 83 | 'loginFormCreateOneLabel': "create one", |
86 | 'loginFormForgotYourCredentialsLabel': "forgot your credentials?", | 84 | 'loginFormForgotYourCredentialsLabel': "forgot your credentials?", |
87 | 'loginFormAarghThatsBadLabel': "aargh! that\'s bad!", | 85 | 'loginFormAarghThatsBadLabel': "aargh! that\'s bad!", |
88 | 'loginFormAfraidOfMaliciousScriptsLabel': "afraid of malicious scripts?", | 86 | 'loginFormAfraidOfMaliciousScriptsLabel': "afraid of malicious scripts?", |
89 | 'loginFormVerifyTheCodeLabel': "verify the code", | 87 | 'loginFormVerifyTheCodeLabel': "verify the code", |
90 | 'loginFormButtonLabel': "Login", | 88 | 'loginFormButtonLabel': "Login", |
91 | 'loginFormOneTimePasswordCheckboxLabel': "use a one-time passphrase", | 89 | 'loginFormOneTimePasswordCheckboxLabel': "use a one-time passphrase", |
92 | 'loginFormOneTimePasswordCheckboxDescription': "", | 90 | 'loginFormOneTimePasswordCheckboxDescription': "", |
93 | 91 | ||
94 | // Login page - language selection | 92 | // Login page - language selection |
95 | 'loginPanelSwithLanguageDescription': "<h5>Switch to your preferred language</h5>", | 93 | 'loginPanelSwithLanguageDescription': "<h5>Switch to your preferred language</h5>", |
96 | 94 | ||
97 | // Login page - browser compatibility | 95 | // Login page - browser compatibility |
98 | '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>", | 96 | '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>", |
99 | 97 | ||
100 | // Login with OTP - message panel | 98 | // Login with OTP - message panel |
101 | 'OTPloginMessagePanelInitialTitle': "Logging in using a one-time passphrase", | 99 | 'OTPloginMessagePanelInitialTitle': "Logging in using a one-time passphrase", |
102 | 'OTPloginMessagePanelInitialText': "Sending OTP credentials …", | 100 | 'OTPloginMessagePanelInitialText': "Sending OTP credentials …", |
103 | 'OTPloginMessagePanelLoadingTitle': "Logging in using a one-time passphrase", | 101 | 'OTPloginMessagePanelLoadingTitle': "Logging in using a one-time passphrase", |
104 | 'OTPloginMessagePanelLoadingText': "Fetching encrypted authentication data from the server …", | 102 | 'OTPloginMessagePanelLoadingText': "Fetching encrypted authentication data from the server …", |
105 | 'OTPloginMessagePanelProcessingTitle': "Logging in using a one-time passphrase", | 103 | 'OTPloginMessagePanelProcessingTitle': "Logging in using a one-time passphrase", |
106 | 'OTPloginMessagePanelProcessingText': "Local decryption of authentication data", | 104 | 'OTPloginMessagePanelProcessingText': "Local decryption of authentication data", |
107 | 105 | ||
108 | // Regular login - message panel | 106 | // Regular login - message panel |
109 | 'loginMessagePanelInitialTitle': "Logging in …", | 107 | 'loginMessagePanelInitialTitle': "Logging in …", |
110 | 'loginMessagePanelInitialText': "---", | 108 | 'loginMessagePanelInitialText': "---", |
111 | 'loginMessagePanelInitialButtonLabel': "Cancel", | 109 | 'loginMessagePanelInitialButtonLabel': "Cancel", |
112 | 'loginMessagePanelConnectedTitle': "Connected", | 110 | 'loginMessagePanelConnectedTitle': "Connected", |
113 | 'loginMessagePanelConnectedText': "Done", | 111 | 'loginMessagePanelConnectedText': "Done", |
114 | 'loginMessagePanelFailureTitle': "Error", | 112 | 'loginMessagePanelFailureTitle': "Error", |
115 | 'loginMessagePanelFailureText': "Login failed", | 113 | 'loginMessagePanelFailureText': "Login failed", |
116 | 'loginMessagePanelFailureButtonLabel': "Close", | 114 | 'loginMessagePanelFailureButtonLabel': "Close", |
117 | 115 | ||
118 | // Regular login - message panel - connection | 116 | // Regular login - message panel - connection |
119 | 'connectionLoginSendingCredentialsMessageTitle': "Verifying credentials", | 117 | 'connectionLoginSendingCredentialsMessageTitle': "Verifying credentials", |
120 | 'connectionLoginSendingCredentialsMessageText': "Sending credentials", | 118 | 'connectionLoginSendingCredentialsMessageText': "Sending credentials", |
121 | 'connectionLoginCredentialsVerificationMessageTitle':"Verifying credentials", | 119 | 'connectionLoginCredentialsVerificationMessageTitle':"Verifying credentials", |
122 | 'connectionLoginCredentialsVerificationMessageText':"Performing SRP authentication", | 120 | 'connectionLoginCredentialsVerificationMessageText':"Performing SRP authentication", |
123 | 'connectionLoginDoneMessageTitle': "Verifying credentials", | 121 | 'connectionLoginDoneMessageTitle': "Verifying credentials", |
124 | 'connectionLoginDoneMessageText': "Connected", | 122 | 'connectionLoginDoneMessageText': "Connected", |
125 | 123 | ||
126 | //Regular login - message panel - user | 124 | //Regular login - message panel - user |
127 | 'userLoginPanelUpgradingUserCredentialsMessageTitle': "Verifying credentials", | 125 | 'userLoginPanelUpgradingUserCredentialsMessageTitle': "Verifying credentials", |
128 | 'userLoginPanelUpgradingUserCredentialsMessageText': "Upgrading your credentials to a new authentication schema", | 126 | 'userLoginPanelUpgradingUserCredentialsMessageText': "Upgrading your credentials to a new authentication schema", |
129 | 'userLoginPanelConnectedMessageTitle': "User authenticated", | 127 | 'userLoginPanelConnectedMessageTitle': "User authenticated", |
130 | 'userLoginPanelConnectedMessageText': "Successfully logged in", | 128 | 'userLoginPanelConnectedMessageText': "Successfully logged in", |
131 | 'userLoginPanelTryingAnOlderConnectionSchemaMessageTitle': "Verifying credentials", | 129 | 'userLoginPanelTryingAnOlderConnectionSchemaMessageTitle': "Verifying credentials", |
132 | 'userLoginPanelTryingAnOlderConnectionSchemaMessageText': "Trying an older authentication schema", | 130 | 'userLoginPanelTryingAnOlderConnectionSchemaMessageText': "Trying an older authentication schema", |
133 | 'userLoginPanelLoadingUserDataMessageTitle': "User authenticated", | 131 | 'userLoginPanelLoadingUserDataMessageTitle': "User authenticated", |
134 | 'userLoginPanelLoadingUserDataMessageText': "Downloading encrypted card headers from Clipperz", | 132 | 'userLoginPanelLoadingUserDataMessageText': "Downloading encrypted card headers from Clipperz", |
135 | 'userLoginPanelDecryptingUserDataMessageTitle': "User authenticated", | 133 | 'userLoginPanelDecryptingUserDataMessageTitle': "User authenticated", |
136 | 'userLoginPanelDecryptingUserDataMessageText': "Local decryption of card headers", | 134 | 'userLoginPanelDecryptingUserDataMessageText': "Local decryption of card headers", |
137 | 'userLoginPanelDecryptingUserStatisticsMessageTitle': "User authenticated", | 135 | 'userLoginPanelDecryptingUserStatisticsMessageTitle': "User authenticated", |
138 | 'userLoginPanelDecryptingUserStatisticsMessageText': "Local decryption of usage statistics", | 136 | 'userLoginPanelDecryptingUserStatisticsMessageText': "Local decryption of usage statistics", |
139 | 137 | ||
140 | //Registration page - splash alert | 138 | //Registration page - splash alert |
141 | 'splashAlertTitle':"Welcome to Clipperz!", | 139 | 'splashAlertTitle':"Welcome to Clipperz!", |
142 | 'splashAlertText': "\ | 140 | 'splashAlertText': "\ |
143 | <!-- FIX CSS DONE! -->\ | 141 | <!-- FIX CSS DONE! -->\ |
144 | <p>Some security advice</p>\ | 142 | <p>Some security advice</p>\ |
145 | <ul>\ | 143 | <ul>\ |
146 | <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>\ | 144 | <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>\ |
147 | <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>\ | 145 | <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>\ |
148 | <li><p>Clipperz will not be able to recover a lost passphrase!</p></li>\ | 146 | <li><p>Clipperz will not be able to recover a lost passphrase!</p></li>\ |
149 | </ul>\ | 147 | </ul>\ |
150 | <p>For any further information, please refer to <a href=\"http://www.clipperz.com\" target=\"_blank\">Clipperz</a> website.</p>", | 148 | <p>For any further information, please refer to <a href=\"http://www.clipperz.com\" target=\"_blank\">Clipperz</a> website.</p>", |
151 | 'splashAlertCloseButtonLabel':"Ok", | 149 | 'splashAlertCloseButtonLabel':"Ok", |
152 | 150 | ||
153 | // Registration page - form | 151 | // Registration page - form |
154 | 'registrationFormTitle': "create your account", | 152 | 'registrationFormTitle': "create your account", |
155 | 'registrationFormUsernameLabel': "username", | 153 | 'registrationFormUsernameLabel': "username", |
156 | 'registrationFormPassphraseLabel': "passphrase", | 154 | 'registrationFormPassphraseLabel': "passphrase", |
157 | 'registrationFormRetypePassphraseLabel': "re-enter passphrase", | 155 | 'registrationFormRetypePassphraseLabel': "re-enter passphrase", |
158 | 'registrationFormSafetyCheckLabel': "I understand that Clipperz will not be able to recover a lost passphrase.", | 156 | 'registrationFormSafetyCheckLabel': "I understand that Clipperz will not be able to recover a lost passphrase.", |
159 | 'registrationFormTermsOfServiceCheckLabel': "I have read and agreed to the <a href='http://www.clipperz.com/terms_of_service' target='_blank'>Terms of Service</a>.", | 157 | 'registrationFormTermsOfServiceCheckLabel': "I have read and agreed to the <a href='http://www.clipperz.com/terms_of_service' target='_blank'>Terms of Service</a>.", |
160 | 'registrationFormDoYouAlreadyHaveAnAccountLabel': "do you already have an account?", | 158 | 'registrationFormDoYouAlreadyHaveAnAccountLabel': "do you already have an account?", |
161 | 'registrationFormSimplyLoginLabel': "simply login", | 159 | 'registrationFormSimplyLoginLabel': "simply login", |
162 | 'registrationFormButtonLabel': "Register", | 160 | 'registrationFormButtonLabel': "Register", |
163 | 161 | ||
164 | // Registration page - warning messages | 162 | // Registration page - warning messages |
165 | 'registrationFormWarningMessageNotMatchingPassphrases':"Your passphrases don't match, please re-type them.", | 163 | 'registrationFormWarningMessageNotMatchingPassphrases':"Your passphrases don't match, please re-type them.", |
166 | 'registrationFormWarningMessageSafetyCheckNotSelected':"Please read and check all the boxes below.", | 164 | 'registrationFormWarningMessageSafetyCheckNotSelected':"Please read and check all the boxes below.", |
167 | 'registrationFormWarningMessageTermsOfServiceCheckNotSelected':"You need to agree to the Terms of Service.", | 165 | 'registrationFormWarningMessageTermsOfServiceCheckNotSelected':"You need to agree to the Terms of Service.", |
168 | 166 | ||
169 | // Registration page - message panel | 167 | // Registration page - message panel |
170 | 'registrationMessagePanelInitialTitle': "Creating account …", | 168 | 'registrationMessagePanelInitialTitle': "Creating account …", |
171 | 'registrationMessagePanelInitialText': "---", | 169 | 'registrationMessagePanelInitialText': "---", |
172 | 'registrationMessagePanelInitialButtonLabel': "Cancel", | 170 | 'registrationMessagePanelInitialButtonLabel': "Cancel", |
173 | 'registrationMessagePanelRegistrationDoneTitle': "Registration", | 171 | 'registrationMessagePanelRegistrationDoneTitle': "Registration", |
174 | 'registrationMessagePanelRegistrationDoneText': "Done", | 172 | 'registrationMessagePanelRegistrationDoneText': "Done", |
175 | 'registrationMessagePanelFailureTitle': "Registration failed", | 173 | 'registrationMessagePanelFailureTitle': "Registration failed", |
176 | 'registrationMessagePanelFailureButtonLabel': "Close", | 174 | 'registrationMessagePanelFailureButtonLabel': "Close", |
177 | 175 | ||
178 | // Registration page - message panel - connection | 176 | // Registration page - message panel - connection |
179 | 'connectionRegistrationSendingRequestMessageText': "Verifying credentials", | 177 | 'connectionRegistrationSendingRequestMessageText': "Verifying credentials", |
180 | 'connectionRegistrationSendingCredentialsMessageText':"Sending credentials", | 178 | 'connectionRegistrationSendingCredentialsMessageText':"Sending credentials", |
181 | 179 | ||
182 | // Registration page - splash panel | 180 | // Registration page - splash panel |
183 | 'registrationSplashPanelTitle': "Security advice", | 181 | 'registrationSplashPanelTitle': "Security advice", |
184 | 'registrationSplashPanelDescription': "<p>These are your Clipperz credentials, take good care of them. Clipperz will never display your username and passphrase a second time!</p>", | 182 | 'registrationSplashPanelDescription': "<p>These are your Clipperz credentials, take good care of them. Clipperz will never display your username and passphrase a second time!</p>", |
185 | 'registrationSplashPanelUsernameLabel': "username", | 183 | 'registrationSplashPanelUsernameLabel': "username", |
186 | 'registrationSplashPanelPassphraseLabel':"passphrase", | 184 | 'registrationSplashPanelPassphraseLabel':"passphrase", |
187 | 185 | ||
188 | 'registrationSplashPanelShowPassphraseButtonLabel':"show passphrase", | 186 | 'registrationSplashPanelShowPassphraseButtonLabel':"show passphrase", |
189 | 187 | ||
190 | //Header links | 188 | //Header links |
191 | 'donateHeaderLinkLabel': "donate", | 189 | 'donateHeaderLinkLabel': "donate", |
192 | 'creditsHeaderLinkLabel': "credits", | 190 | 'creditsHeaderLinkLabel': "credits", |
193 | 'feedbackHeaderLinkLabel': "feedback", | 191 | 'feedbackHeaderLinkLabel': "feedback", |
194 | 'helpHeaderLinkLabel': "help", | 192 | 'helpHeaderLinkLabel': "help", |
195 | 'forumHeaderLinkLabel': "forum", | 193 | 'forumHeaderLinkLabel': "forum", |
196 | 194 | ||
197 | //Menu labels | 195 | //Menu labels |
198 | 'recordMenuLabel': "cards", | 196 | 'recordMenuLabel': "cards", |
199 | 'accountMenuLabel': "account", | 197 | 'accountMenuLabel': "account", |
200 | 'dataMenuLabel': "data", | 198 | 'dataMenuLabel': "data", |
201 | 'contactsMenuLabel': "contacts", | 199 | 'contactsMenuLabel': "contacts", |
202 | 'toolsMenuLabel': "tools", | 200 | 'toolsMenuLabel': "tools", |
203 | 'logoutMenuLabel': "logout", | 201 | 'logoutMenuLabel': "logout", |
204 | 'lockMenuLabel': "lock", | 202 | 'lockMenuLabel': "lock", |
205 | 203 | ||
206 | //Lock dialog | 204 | //Lock dialog |
207 | 'lockTitle': "The account is locked", | 205 | 'lockTitle': "The account is locked", |
208 | 'lockDescription': "<p>To unlock your account, please enter your passphrase.</p>", | 206 | 'lockDescription': "<p>To unlock your account, please enter your passphrase.</p>", |
209 | 'unlockButtonLabel': "Unlock", | 207 | 'unlockButtonLabel': "Unlock", |
210 | 208 | ||
211 | //Account panel - change passphrase | 209 | //Account panel - change passphrase |
212 | 'changePasswordTabLabel': "Change your passphrase", | 210 | 'changePasswordTabLabel': "Change your passphrase", |
213 | 'changePasswordTabTitle': "Change your passphrase", | 211 | 'changePasswordTabTitle': "Change your passphrase", |
214 | 212 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/Toll.js b/frontend/gamma/js/Clipperz/PM/Toll.js index bb31c43..e9c3092 100644 --- a/frontend/gamma/js/Clipperz/PM/Toll.js +++ b/frontend/gamma/js/Clipperz/PM/Toll.js | |||
@@ -1,191 +1,189 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | 26 | ||
29 | //============================================================================= | 27 | //============================================================================= |
30 | 28 | ||
31 | Clipperz.PM.Toll = function(args) { | 29 | Clipperz.PM.Toll = function(args) { |
32 | args = args || {}; | 30 | args = args || {}; |
33 | 31 | ||
34 | this._requestType = args.requestType; | 32 | this._requestType = args.requestType; |
35 | this._targetValue = args.targetValue; | 33 | this._targetValue = args.targetValue; |
36 | this._cost = args.cost; | 34 | this._cost = args.cost; |
37 | this._toll = null; | 35 | this._toll = null; |
38 | 36 | ||
39 | return this; | 37 | return this; |
40 | } | 38 | } |
41 | 39 | ||
42 | Clipperz.PM.Toll.prototype = MochiKit.Base.update(null, { | 40 | Clipperz.PM.Toll.prototype = MochiKit.Base.update(null, { |
43 | 41 | ||
44 | 'toString': function() { | 42 | 'toString': function() { |
45 | return "Clipperz.PM.Toll (" + this.requestType() + ": " + this.cost() + " - " + ((this.toll() == null)? 'UNPAID' : 'PAID') + ")"; | 43 | return "Clipperz.PM.Toll (" + this.requestType() + ": " + this.cost() + " - " + ((this.toll() == null)? 'UNPAID' : 'PAID') + ")"; |
46 | }, | 44 | }, |
47 | 45 | ||
48 | //------------------------------------------------------------------------- | 46 | //------------------------------------------------------------------------- |
49 | 47 | ||
50 | 'requestType': function() { | 48 | 'requestType': function() { |
51 | return this._requestType; | 49 | return this._requestType; |
52 | }, | 50 | }, |
53 | 51 | ||
54 | //------------------------------------------------------------------------- | 52 | //------------------------------------------------------------------------- |
55 | 53 | ||
56 | 'targetValue': function() { | 54 | 'targetValue': function() { |
57 | return this._targetValue; | 55 | return this._targetValue; |
58 | }, | 56 | }, |
59 | 57 | ||
60 | //------------------------------------------------------------------------- | 58 | //------------------------------------------------------------------------- |
61 | 59 | ||
62 | 'cost': function() { | 60 | 'cost': function() { |
63 | return this._cost; | 61 | return this._cost; |
64 | }, | 62 | }, |
65 | 63 | ||
66 | //------------------------------------------------------------------------- | 64 | //------------------------------------------------------------------------- |
67 | 65 | ||
68 | 'toll': function() { | 66 | 'toll': function() { |
69 | return this._toll; | 67 | return this._toll; |
70 | }, | 68 | }, |
71 | 69 | ||
72 | //------------------------------------------------------------------------- | 70 | //------------------------------------------------------------------------- |
73 | /* | 71 | /* |
74 | '__pay': function() { | 72 | '__pay': function() { |
75 | varresult; | 73 | varresult; |
76 | vartargetData; | 74 | vartargetData; |
77 | vartargetMatchSize; | 75 | vartargetMatchSize; |
78 | var prefixMatchingBits; | 76 | var prefixMatchingBits; |
79 | varpayment; | 77 | varpayment; |
80 | var i; | 78 | var i; |
81 | 79 | ||
82 | if (this.toll() == null) { | 80 | if (this.toll() == null) { |
83 | i = 0; | 81 | i = 0; |
84 | targetData = new Clipperz.ByteArray("0x" + this.targetValue()); | 82 | targetData = new Clipperz.ByteArray("0x" + this.targetValue()); |
85 | targetMatchSize = this.cost(); | 83 | targetMatchSize = this.cost(); |
86 | 84 | ||
87 | payment = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32); | 85 | payment = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32); |
88 | 86 | ||
89 | do { | 87 | do { |
90 | varpaymentData; | 88 | varpaymentData; |
91 | 89 | ||
92 | //payment = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32); | 90 | //payment = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32); |
93 | payment.increment(); | 91 | payment.increment(); |
94 | paymentData = Clipperz.Crypto.SHA.sha256(payment); | 92 | paymentData = Clipperz.Crypto.SHA.sha256(payment); |
95 | // prefixMatchingBits = this.prefixMatchingBits(targetData, paymentData); | 93 | // prefixMatchingBits = this.prefixMatchingBits(targetData, paymentData); |
96 | prefixMatchingBits = Clipperz.ByteArray.prefixMatchingBits(targetData, paymentData); | 94 | prefixMatchingBits = Clipperz.ByteArray.prefixMatchingBits(targetData, paymentData); |
97 | i++; | 95 | i++; |
98 | } while (prefixMatchingBits < targetMatchSize); | 96 | } while (prefixMatchingBits < targetMatchSize); |
99 | 97 | ||
100 | this._toll = payment.toHexString().substring(2) | 98 | this._toll = payment.toHexString().substring(2) |
101 | } | 99 | } |
102 | 100 | ||
103 | return this; | 101 | return this; |
104 | }, | 102 | }, |
105 | */ | 103 | */ |
106 | //------------------------------------------------------------------------- | 104 | //------------------------------------------------------------------------- |
107 | 105 | ||
108 | 'innerDeferredPay': function (aTargetValue, aCost, aPayment) { | 106 | 'innerDeferredPay': function (aTargetValue, aCost, aPayment) { |
109 | var deferredResult; | 107 | var deferredResult; |
110 | var result; | 108 | var result; |
111 | var payment; | 109 | var payment; |
112 | var i; | 110 | var i; |
113 | 111 | ||
114 | result = null; | 112 | result = null; |
115 | payment = aPayment; | 113 | payment = aPayment; |
116 | i = 0; | 114 | i = 0; |
117 | 115 | ||
118 | while ((result == null) && (i < Clipperz.PM.Toll.numberOfCloseLoopIterations)) { | 116 | while ((result == null) && (i < Clipperz.PM.Toll.numberOfCloseLoopIterations)) { |
119 | if (Clipperz.ByteArray.prefixMatchingBits(aTargetValue, Clipperz.Crypto.SHA.sha256(payment)) > aCost) { | 117 | if (Clipperz.ByteArray.prefixMatchingBits(aTargetValue, Clipperz.Crypto.SHA.sha256(payment)) > aCost) { |
120 | result = payment; | 118 | result = payment; |
121 | } else { | 119 | } else { |
122 | payment.increment(); | 120 | payment.increment(); |
123 | } | 121 | } |
124 | 122 | ||
125 | i ++; | 123 | i ++; |
126 | } | 124 | } |
127 | 125 | ||
128 | if (result == null) { | 126 | if (result == null) { |
129 | deferredResult = MochiKit.Async.callLater(Clipperz.PM.Toll.pauseBetweenEachCloseLoop, MochiKit.Base.method(this, 'innerDeferredPay', aTargetValue, aCost, aPayment)); | 127 | deferredResult = MochiKit.Async.callLater(Clipperz.PM.Toll.pauseBetweenEachCloseLoop, MochiKit.Base.method(this, 'innerDeferredPay', aTargetValue, aCost, aPayment)); |
130 | } else { | 128 | } else { |
131 | deferredResult = MochiKit.Async.succeed(result); | 129 | deferredResult = MochiKit.Async.succeed(result); |
132 | } | 130 | } |
133 | 131 | ||
134 | return deferredResult; | 132 | return deferredResult; |
135 | }, | 133 | }, |
136 | 134 | ||
137 | 'deferredPay': function () { | 135 | 'deferredPay': function () { |
138 | vardeferredResult; | 136 | vardeferredResult; |
139 | vartoll; | 137 | vartoll; |
140 | 138 | ||
141 | toll = this; | 139 | toll = this; |
142 | deferredResult = new Clipperz.Async.Deferred("Toll.deferredPay"); | 140 | deferredResult = new Clipperz.Async.Deferred("Toll.deferredPay"); |
143 | //deferredResult.addLog("--->>> deferredPay - " + this.cost()); | 141 | //deferredResult.addLog("--->>> deferredPay - " + this.cost()); |
144 | deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'getRandomBytes', 32); | 142 | deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'getRandomBytes', 32); |
145 | deferredResult.addMethod(toll, 'innerDeferredPay', new Clipperz.ByteArray("0x" + this.targetValue()), this.cost()); | 143 | deferredResult.addMethod(toll, 'innerDeferredPay', new Clipperz.ByteArray("0x" + this.targetValue()), this.cost()); |
146 | deferredResult.addCallback(MochiKit.Base.bind(function(aPayment) { | 144 | deferredResult.addCallback(MochiKit.Base.bind(function(aPayment) { |
147 | var result; | 145 | var result; |
148 | 146 | ||
149 | result = { | 147 | result = { |
150 | targetValue: this.targetValue(), | 148 | targetValue: this.targetValue(), |
151 | toll: aPayment.toHexString().substr(2) | 149 | toll: aPayment.toHexString().substr(2) |
152 | }; | 150 | }; |
153 | 151 | ||
154 | return result; | 152 | return result; |
155 | }, this)); | 153 | }, this)); |
156 | //deferredResult.addLog("<<<--- deferredPay - " + this.cost()); | 154 | //deferredResult.addLog("<<<--- deferredPay - " + this.cost()); |
157 | deferredResult.callback(); | 155 | deferredResult.callback(); |
158 | 156 | ||
159 | return deferredResult; | 157 | return deferredResult; |
160 | }, | 158 | }, |
161 | 159 | ||
162 | //========================================================================= | 160 | //========================================================================= |
163 | __syntaxFix__: "syntax fix" | 161 | __syntaxFix__: "syntax fix" |
164 | 162 | ||
165 | }); | 163 | }); |
166 | 164 | ||
167 | 165 | ||
168 | Clipperz.PM.Toll.validate = function(aTargetValue, aToll, aCost) { | 166 | Clipperz.PM.Toll.validate = function(aTargetValue, aToll, aCost) { |
169 | var result; | 167 | var result; |
170 | vartollValue; | 168 | vartollValue; |
171 | var targetValue; | 169 | var targetValue; |
172 | var hashedTollValue; | 170 | var hashedTollValue; |
173 | var payedToll; | 171 | var payedToll; |
174 | 172 | ||
175 | tollValue = new Clipperz.ByteArray("0x" + aToll); | 173 | tollValue = new Clipperz.ByteArray("0x" + aToll); |
176 | targetValue = new Clipperz.ByteArray("0x" + aTargetValue); | 174 | targetValue = new Clipperz.ByteArray("0x" + aTargetValue); |
177 | hashedTollValue = Clipperz.Crypto.SHA.sha256(tollValue); | 175 | hashedTollValue = Clipperz.Crypto.SHA.sha256(tollValue); |
178 | 176 | ||
179 | payedToll = Clipperz.ByteArray.prefixMatchingBits(targetValue, hashedTollValue); | 177 | payedToll = Clipperz.ByteArray.prefixMatchingBits(targetValue, hashedTollValue); |
180 | 178 | ||
181 | if (payedToll < aCost) { | 179 | if (payedToll < aCost) { |
182 | result = false; | 180 | result = false; |
183 | } else { | 181 | } else { |
184 | result = true; | 182 | result = true; |
185 | } | 183 | } |
186 | 184 | ||
187 | return result; | 185 | return result; |
188 | }; | 186 | }; |
189 | 187 | ||
190 | Clipperz.PM.Toll.numberOfCloseLoopIterations = 50; | 188 | Clipperz.PM.Toll.numberOfCloseLoopIterations = 50; |
191 | Clipperz.PM.Toll.pauseBetweenEachCloseLoop = 0.5; \ No newline at end of file | 189 | Clipperz.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 index 25e82ca..f667526 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/download.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/download.js | |||
@@ -1,117 +1,115 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //download.js | 25 | //download.js |
28 | //Download | 26 | //Download |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/15/10 | 28 | //Created by Giulio Cesare Solaroli on 3/15/10 |
31 | //Copyright 2010 Clipperz | 29 | //Copyright 2010 Clipperz |
32 | //This code was generated by Opacity. You may use or modify it in any way. | 30 | //This code was generated by Opacity. You may use or modify it in any way. |
33 | // | 31 | // |
34 | 32 | ||
35 | var kClipperz_PM_UI_Canvas_CoverActions_downloadWidth = 46.0; | 33 | var kClipperz_PM_UI_Canvas_CoverActions_downloadWidth = 46.0; |
36 | var kClipperz_PM_UI_Canvas_CoverActions_downloadHeight = 46.0; | 34 | var kClipperz_PM_UI_Canvas_CoverActions_downloadHeight = 46.0; |
37 | 35 | ||
38 | function Clipperz_PM_UI_Canvas_CoverActions_download(canvas, aColor, aFillColor, aThickness) | 36 | function Clipperz_PM_UI_Canvas_CoverActions_download(canvas, aColor, aFillColor, aThickness) |
39 | { | 37 | { |
40 | var context = canvas.getContext("2d"); | 38 | var context = canvas.getContext("2d"); |
41 | var alignStroke; | 39 | var alignStroke; |
42 | var resolution; | 40 | var resolution; |
43 | var stroke; | 41 | var stroke; |
44 | var path; | 42 | var path; |
45 | var pointX; | 43 | var pointX; |
46 | var pointY; | 44 | var pointY; |
47 | if (window.devicePixelRatio) | 45 | if (window.devicePixelRatio) |
48 | resolution = window.devicePixelRatio; | 46 | resolution = window.devicePixelRatio; |
49 | else | 47 | else |
50 | resolution = 1.0; | 48 | resolution = 1.0; |
51 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_CoverActions_downloadWidth + canvas.height / kClipperz_PM_UI_Canvas_CoverActions_downloadHeight); | 49 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_CoverActions_downloadWidth + canvas.height / kClipperz_PM_UI_Canvas_CoverActions_downloadHeight); |
52 | 50 | ||
53 | context.save(); | 51 | context.save(); |
54 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_CoverActions_downloadWidth, canvas.height / kClipperz_PM_UI_Canvas_CoverActions_downloadHeight); | 52 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_CoverActions_downloadWidth, canvas.height / kClipperz_PM_UI_Canvas_CoverActions_downloadHeight); |
55 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_CoverActions_downloadWidth, kClipperz_PM_UI_Canvas_CoverActions_downloadHeight); | 53 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_CoverActions_downloadWidth, kClipperz_PM_UI_Canvas_CoverActions_downloadHeight); |
56 | 54 | ||
57 | // arrow | 55 | // arrow |
58 | 56 | ||
59 | stroke = aThickness; | 57 | stroke = aThickness; |
60 | stroke *= resolution; | 58 | stroke *= resolution; |
61 | if (stroke < 1.0) | 59 | if (stroke < 1.0) |
62 | stroke = Math.ceil(stroke); | 60 | stroke = Math.ceil(stroke); |
63 | else | 61 | else |
64 | stroke = Math.round(stroke); | 62 | stroke = Math.round(stroke); |
65 | stroke /= resolution; | 63 | stroke /= resolution; |
66 | alignStroke = (0.5 * stroke * resolution) % 1.0; | 64 | alignStroke = (0.5 * stroke * resolution) % 1.0; |
67 | context.beginPath(); | 65 | context.beginPath(); |
68 | pointX = 16.5; | 66 | pointX = 16.5; |
69 | pointY = 22.5; | 67 | pointY = 22.5; |
70 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 68 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
71 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 69 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
72 | context.moveTo(pointX, pointY); | 70 | context.moveTo(pointX, pointY); |
73 | pointX = 19.5; | 71 | pointX = 19.5; |
74 | pointY = 8.5; | 72 | pointY = 8.5; |
75 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 73 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
76 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 74 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
77 | context.lineTo(pointX, pointY); | 75 | context.lineTo(pointX, pointY); |
78 | pointX = 30.038; | 76 | pointX = 30.038; |
79 | pointY = 10.605; | 77 | pointY = 10.605; |
80 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 78 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
81 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 79 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
82 | context.lineTo(pointX, pointY); | 80 | context.lineTo(pointX, pointY); |
83 | pointX = 27.354; | 81 | pointX = 27.354; |
84 | pointY = 24.354; | 82 | pointY = 24.354; |
85 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 83 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
86 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 84 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
87 | context.lineTo(pointX, pointY); | 85 | context.lineTo(pointX, pointY); |
88 | pointX = 33.28; | 86 | pointX = 33.28; |
89 | pointY = 25.293; | 87 | pointY = 25.293; |
90 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 88 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
91 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 89 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
92 | context.lineTo(pointX, pointY); | 90 | context.lineTo(pointX, pointY); |
93 | pointX = 19.81; | 91 | pointX = 19.81; |
94 | pointY = 36.828; | 92 | pointY = 36.828; |
95 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 93 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
96 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 94 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
97 | context.lineTo(pointX, pointY); | 95 | context.lineTo(pointX, pointY); |
98 | pointX = 10.07; | 96 | pointX = 10.07; |
99 | pointY = 21.617; | 97 | pointY = 21.617; |
100 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 98 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
101 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 99 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
102 | context.lineTo(pointX, pointY); | 100 | context.lineTo(pointX, pointY); |
103 | pointX = 16.5; | 101 | pointX = 16.5; |
104 | pointY = 22.5; | 102 | pointY = 22.5; |
105 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 103 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
106 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 104 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
107 | context.lineTo(pointX, pointY); | 105 | context.lineTo(pointX, pointY); |
108 | context.closePath(); | 106 | context.closePath(); |
109 | context.fillStyle = aFillColor; | 107 | context.fillStyle = aFillColor; |
110 | context.fill(); | 108 | context.fill(); |
111 | context.strokeStyle = aColor; | 109 | context.strokeStyle = aColor; |
112 | context.lineWidth = stroke; | 110 | context.lineWidth = stroke; |
113 | context.lineCap = "square"; | 111 | context.lineCap = "square"; |
114 | context.stroke(); | 112 | context.stroke(); |
115 | 113 | ||
116 | context.restore(); | 114 | context.restore(); |
117 | } | 115 | } |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/look.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/look.js index ba425ec..dae5a2d 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/look.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/look.js | |||
@@ -1,205 +1,203 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //look.js | 25 | //look.js |
28 | //Look | 26 | //Look |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/15/10 | 28 | //Created by Giulio Cesare Solaroli on 3/15/10 |
31 | //Copyright 2010 Clipperz | 29 | //Copyright 2010 Clipperz |
32 | //This code was generated by Opacity. You may use or modify it in any way. | 30 | //This code was generated by Opacity. You may use or modify it in any way. |
33 | // | 31 | // |
34 | 32 | ||
35 | var kClipperz_PM_UI_Canvas_CoverActions_lookWidth = 46.0; | 33 | var kClipperz_PM_UI_Canvas_CoverActions_lookWidth = 46.0; |
36 | var kClipperz_PM_UI_Canvas_CoverActions_lookHeight = 46.0; | 34 | var kClipperz_PM_UI_Canvas_CoverActions_lookHeight = 46.0; |
37 | 35 | ||
38 | function Clipperz_PM_UI_Canvas_CoverActions_look(canvas, aColor, aFillColor, aThickness) | 36 | function Clipperz_PM_UI_Canvas_CoverActions_look(canvas, aColor, aFillColor, aThickness) |
39 | { | 37 | { |
40 | var context = canvas.getContext("2d"); | 38 | var context = canvas.getContext("2d"); |
41 | var alignStroke; | 39 | var alignStroke; |
42 | var resolution; | 40 | var resolution; |
43 | var stroke; | 41 | var stroke; |
44 | var path; | 42 | var path; |
45 | var pointX; | 43 | var pointX; |
46 | var pointY; | 44 | var pointY; |
47 | if (window.devicePixelRatio) | 45 | if (window.devicePixelRatio) |
48 | resolution = window.devicePixelRatio; | 46 | resolution = window.devicePixelRatio; |
49 | else | 47 | else |
50 | resolution = 1.0; | 48 | resolution = 1.0; |
51 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_CoverActions_lookWidth + canvas.height / kClipperz_PM_UI_Canvas_CoverActions_lookHeight); | 49 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_CoverActions_lookWidth + canvas.height / kClipperz_PM_UI_Canvas_CoverActions_lookHeight); |
52 | 50 | ||
53 | context.save(); | 51 | context.save(); |
54 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_CoverActions_lookWidth, canvas.height / kClipperz_PM_UI_Canvas_CoverActions_lookHeight); | 52 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_CoverActions_lookWidth, canvas.height / kClipperz_PM_UI_Canvas_CoverActions_lookHeight); |
55 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_CoverActions_lookWidth, kClipperz_PM_UI_Canvas_CoverActions_lookHeight); | 53 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_CoverActions_lookWidth, kClipperz_PM_UI_Canvas_CoverActions_lookHeight); |
56 | 54 | ||
57 | // Layer 6 | 55 | // Layer 6 |
58 | 56 | ||
59 | stroke = aThickness; | 57 | stroke = aThickness; |
60 | stroke *= resolution; | 58 | stroke *= resolution; |
61 | if (stroke < 1.0) | 59 | if (stroke < 1.0) |
62 | stroke = Math.ceil(stroke); | 60 | stroke = Math.ceil(stroke); |
63 | else | 61 | else |
64 | stroke = Math.round(stroke); | 62 | stroke = Math.round(stroke); |
65 | stroke /= resolution; | 63 | stroke /= resolution; |
66 | alignStroke = (0.5 * stroke * resolution) % 1.0; | 64 | alignStroke = (0.5 * stroke * resolution) % 1.0; |
67 | context.save(); | 65 | context.save(); |
68 | context.translate(17.5, 23.0); | 66 | context.translate(17.5, 23.0); |
69 | context.rotate(-0.503); | 67 | context.rotate(-0.503); |
70 | context.translate(-17.5, -23.0); | 68 | context.translate(-17.5, -23.0); |
71 | context.beginPath(); | 69 | context.beginPath(); |
72 | pointX = 28.5; | 70 | pointX = 28.5; |
73 | pointY = 31.5; | 71 | pointY = 31.5; |
74 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 72 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
75 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 73 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
76 | context.moveTo(pointX, pointY); | 74 | context.moveTo(pointX, pointY); |
77 | pointX = 28.5; | 75 | pointX = 28.5; |
78 | pointY = 14.5; | 76 | pointY = 14.5; |
79 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 77 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
80 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 78 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
81 | context.lineTo(pointX, pointY); | 79 | context.lineTo(pointX, pointY); |
82 | pointX = 6.5; | 80 | pointX = 6.5; |
83 | pointY = 14.5; | 81 | pointY = 14.5; |
84 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 82 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
85 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 83 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
86 | context.lineTo(pointX, pointY); | 84 | context.lineTo(pointX, pointY); |
87 | pointX = 6.5; | 85 | pointX = 6.5; |
88 | pointY = 31.5; | 86 | pointY = 31.5; |
89 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 87 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
90 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 88 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
91 | context.lineTo(pointX, pointY); | 89 | context.lineTo(pointX, pointY); |
92 | pointX = 28.5; | 90 | pointX = 28.5; |
93 | pointY = 31.5; | 91 | pointY = 31.5; |
94 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 92 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
95 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 93 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
96 | context.lineTo(pointX, pointY); | 94 | context.lineTo(pointX, pointY); |
97 | context.closePath(); | 95 | context.closePath(); |
98 | context.fillStyle = aFillColor; | 96 | context.fillStyle = aFillColor; |
99 | context.fill(); | 97 | context.fill(); |
100 | context.strokeStyle = aColor; | 98 | context.strokeStyle = aColor; |
101 | context.lineWidth = stroke; | 99 | context.lineWidth = stroke; |
102 | context.lineCap = "square"; | 100 | context.lineCap = "square"; |
103 | context.stroke(); | 101 | context.stroke(); |
104 | context.restore(); | 102 | context.restore(); |
105 | 103 | ||
106 | // Layer 3 | 104 | // Layer 3 |
107 | 105 | ||
108 | stroke = aThickness; | 106 | stroke = aThickness; |
109 | stroke *= resolution; | 107 | stroke *= resolution; |
110 | if (stroke < 1.0) | 108 | if (stroke < 1.0) |
111 | stroke = Math.ceil(stroke); | 109 | stroke = Math.ceil(stroke); |
112 | else | 110 | else |
113 | stroke = Math.round(stroke); | 111 | stroke = Math.round(stroke); |
114 | stroke /= resolution; | 112 | stroke /= resolution; |
115 | alignStroke = (0.5 * stroke * resolution) % 1.0; | 113 | alignStroke = (0.5 * stroke * resolution) % 1.0; |
116 | context.save(); | 114 | context.save(); |
117 | context.translate(22.5, 20.0); | 115 | context.translate(22.5, 20.0); |
118 | context.rotate(-0.071); | 116 | context.rotate(-0.071); |
119 | context.translate(-22.5, -20.0); | 117 | context.translate(-22.5, -20.0); |
120 | context.beginPath(); | 118 | context.beginPath(); |
121 | pointX = 33.5; | 119 | pointX = 33.5; |
122 | pointY = 28.5; | 120 | pointY = 28.5; |
123 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 121 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
124 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 122 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
125 | context.moveTo(pointX, pointY); | 123 | context.moveTo(pointX, pointY); |
126 | pointX = 33.5; | 124 | pointX = 33.5; |
127 | pointY = 11.5; | 125 | pointY = 11.5; |
128 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 126 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
129 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 127 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
130 | context.lineTo(pointX, pointY); | 128 | context.lineTo(pointX, pointY); |
131 | pointX = 11.5; | 129 | pointX = 11.5; |
132 | pointY = 11.5; | 130 | pointY = 11.5; |
133 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 131 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
134 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 132 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
135 | context.lineTo(pointX, pointY); | 133 | context.lineTo(pointX, pointY); |
136 | pointX = 11.5; | 134 | pointX = 11.5; |
137 | pointY = 28.5; | 135 | pointY = 28.5; |
138 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 136 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
139 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 137 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
140 | context.lineTo(pointX, pointY); | 138 | context.lineTo(pointX, pointY); |
141 | pointX = 33.5; | 139 | pointX = 33.5; |
142 | pointY = 28.5; | 140 | pointY = 28.5; |
143 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 141 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
144 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 142 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
145 | context.lineTo(pointX, pointY); | 143 | context.lineTo(pointX, pointY); |
146 | context.closePath(); | 144 | context.closePath(); |
147 | context.fillStyle = aFillColor; | 145 | context.fillStyle = aFillColor; |
148 | context.fill(); | 146 | context.fill(); |
149 | context.strokeStyle = aColor; | 147 | context.strokeStyle = aColor; |
150 | context.lineWidth = stroke; | 148 | context.lineWidth = stroke; |
151 | context.lineCap = "square"; | 149 | context.lineCap = "square"; |
152 | context.stroke(); | 150 | context.stroke(); |
153 | context.restore(); | 151 | context.restore(); |
154 | 152 | ||
155 | // Layer 4 | 153 | // Layer 4 |
156 | 154 | ||
157 | stroke = aThickness; | 155 | stroke = aThickness; |
158 | stroke *= resolution; | 156 | stroke *= resolution; |
159 | if (stroke < 1.0) | 157 | if (stroke < 1.0) |
160 | stroke = Math.ceil(stroke); | 158 | stroke = Math.ceil(stroke); |
161 | else | 159 | else |
162 | stroke = Math.round(stroke); | 160 | stroke = Math.round(stroke); |
163 | stroke /= resolution; | 161 | stroke /= resolution; |
164 | alignStroke = (0.5 * stroke * resolution) % 1.0; | 162 | alignStroke = (0.5 * stroke * resolution) % 1.0; |
165 | context.save(); | 163 | context.save(); |
166 | context.translate(27.5, 18.0); | 164 | context.translate(27.5, 18.0); |
167 | context.rotate(0.232); | 165 | context.rotate(0.232); |
168 | context.translate(-27.5, -18.0); | 166 | context.translate(-27.5, -18.0); |
169 | context.beginPath(); | 167 | context.beginPath(); |
170 | pointX = 38.5; | 168 | pointX = 38.5; |
171 | pointY = 26.5; | 169 | pointY = 26.5; |
172 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 170 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
173 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 171 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
174 | context.moveTo(pointX, pointY); | 172 | context.moveTo(pointX, pointY); |
175 | pointX = 38.5; | 173 | pointX = 38.5; |
176 | pointY = 9.5; | 174 | pointY = 9.5; |
177 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 175 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
178 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 176 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
179 | context.lineTo(pointX, pointY); | 177 | context.lineTo(pointX, pointY); |
180 | pointX = 16.5; | 178 | pointX = 16.5; |
181 | pointY = 9.5; | 179 | pointY = 9.5; |
182 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 180 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
183 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 181 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
184 | context.lineTo(pointX, pointY); | 182 | context.lineTo(pointX, pointY); |
185 | pointX = 16.5; | 183 | pointX = 16.5; |
186 | pointY = 26.5; | 184 | pointY = 26.5; |
187 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 185 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
188 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 186 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
189 | context.lineTo(pointX, pointY); | 187 | context.lineTo(pointX, pointY); |
190 | pointX = 38.5; | 188 | pointX = 38.5; |
191 | pointY = 26.5; | 189 | pointY = 26.5; |
192 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 190 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
193 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 191 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
194 | context.lineTo(pointX, pointY); | 192 | context.lineTo(pointX, pointY); |
195 | context.closePath(); | 193 | context.closePath(); |
196 | context.fillStyle = aFillColor; | 194 | context.fillStyle = aFillColor; |
197 | context.fill(); | 195 | context.fill(); |
198 | context.strokeStyle = aColor; | 196 | context.strokeStyle = aColor; |
199 | context.lineWidth = stroke; | 197 | context.lineWidth = stroke; |
200 | context.lineCap = "square"; | 198 | context.lineCap = "square"; |
201 | context.stroke(); | 199 | context.stroke(); |
202 | context.restore(); | 200 | context.restore(); |
203 | 201 | ||
204 | context.restore(); | 202 | context.restore(); |
205 | } | 203 | } |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/directLogin.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/directLogin.js index 5c1f860..497fd05 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/directLogin.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/directLogin.js | |||
@@ -1,206 +1,204 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //directLogin.js | 25 | //directLogin.js |
28 | //directLogin | 26 | //directLogin |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/7/10 | 28 | //Created by Giulio Cesare Solaroli on 3/7/10 |
31 | //Copyright 2010 Clipperz | 29 | //Copyright 2010 Clipperz |
32 | //This code was generated by Opacity. You may use or modify it in any way. | 30 | //This code was generated by Opacity. You may use or modify it in any way. |
33 | // | 31 | // |
34 | 32 | ||
35 | var kClipperz_PM_UI_Canvas_Features_directLoginWidth = 76.0; | 33 | var kClipperz_PM_UI_Canvas_Features_directLoginWidth = 76.0; |
36 | var kClipperz_PM_UI_Canvas_Features_directLoginHeight = 76.0; | 34 | var kClipperz_PM_UI_Canvas_Features_directLoginHeight = 76.0; |
37 | 35 | ||
38 | function Clipperz_PM_UI_Canvas_Features_directLogin(canvas, aColor, aBannerColor, aBannerBackgroundColor) | 36 | function Clipperz_PM_UI_Canvas_Features_directLogin(canvas, aColor, aBannerColor, aBannerBackgroundColor) |
39 | { | 37 | { |
40 | var context = canvas.getContext("2d"); | 38 | var context = canvas.getContext("2d"); |
41 | var alignStroke; | 39 | var alignStroke; |
42 | var resolution; | 40 | var resolution; |
43 | var stroke; | 41 | var stroke; |
44 | var path; | 42 | var path; |
45 | var pointX; | 43 | var pointX; |
46 | var pointY; | 44 | var pointY; |
47 | if (window.devicePixelRatio) | 45 | if (window.devicePixelRatio) |
48 | resolution = window.devicePixelRatio; | 46 | resolution = window.devicePixelRatio; |
49 | else | 47 | else |
50 | resolution = 1.0; | 48 | resolution = 1.0; |
51 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Features_directLoginWidth + canvas.height / kClipperz_PM_UI_Canvas_Features_directLoginHeight); | 49 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Features_directLoginWidth + canvas.height / kClipperz_PM_UI_Canvas_Features_directLoginHeight); |
52 | 50 | ||
53 | context.save(); | 51 | context.save(); |
54 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Features_directLoginWidth, canvas.height / kClipperz_PM_UI_Canvas_Features_directLoginHeight); | 52 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Features_directLoginWidth, canvas.height / kClipperz_PM_UI_Canvas_Features_directLoginHeight); |
55 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Features_directLoginWidth, kClipperz_PM_UI_Canvas_Features_directLoginHeight); | 53 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Features_directLoginWidth, kClipperz_PM_UI_Canvas_Features_directLoginHeight); |
56 | 54 | ||
57 | // Layer 2 | 55 | // Layer 2 |
58 | 56 | ||
59 | stroke = 6.0; | 57 | stroke = 6.0; |
60 | stroke *= resolution; | 58 | stroke *= resolution; |
61 | if (stroke < 1.0) | 59 | if (stroke < 1.0) |
62 | stroke = Math.ceil(stroke); | 60 | stroke = Math.ceil(stroke); |
63 | else | 61 | else |
64 | stroke = Math.round(stroke); | 62 | stroke = Math.round(stroke); |
65 | stroke /= resolution; | 63 | stroke /= resolution; |
66 | alignStroke = (0.5 * stroke * resolution) % 1.0; | 64 | alignStroke = (0.5 * stroke * resolution) % 1.0; |
67 | context.beginPath(); | 65 | context.beginPath(); |
68 | pointX = 30.0; | 66 | pointX = 30.0; |
69 | pointY = 41.0; | 67 | pointY = 41.0; |
70 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 68 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
71 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 69 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
72 | context.moveTo(pointX, pointY); | 70 | context.moveTo(pointX, pointY); |
73 | pointX = 45.579; | 71 | pointX = 45.579; |
74 | pointY = 25.451; | 72 | pointY = 25.451; |
75 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 73 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
76 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 74 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
77 | context.lineTo(pointX, pointY); | 75 | context.lineTo(pointX, pointY); |
78 | context.strokeStyle = aColor; | 76 | context.strokeStyle = aColor; |
79 | context.lineWidth = stroke; | 77 | context.lineWidth = stroke; |
80 | context.lineCap = "square"; | 78 | context.lineCap = "square"; |
81 | context.stroke(); | 79 | context.stroke(); |
82 | 80 | ||
83 | alignStroke = 0.0; | 81 | alignStroke = 0.0; |
84 | context.beginPath(); | 82 | context.beginPath(); |
85 | pointX = 34.207; | 83 | pointX = 34.207; |
86 | pointY = 45.697; | 84 | pointY = 45.697; |
87 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 85 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
88 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 86 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
89 | context.moveTo(pointX, pointY); | 87 | context.moveTo(pointX, pointY); |
90 | pointX = 24.101; | 88 | pointX = 24.101; |
91 | pointY = 37.52; | 89 | pointY = 37.52; |
92 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 90 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
93 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 91 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
94 | context.lineTo(pointX, pointY); | 92 | context.lineTo(pointX, pointY); |
95 | pointX = 24.122; | 93 | pointX = 24.122; |
96 | pointY = 47.828; | 94 | pointY = 47.828; |
97 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 95 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
98 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 96 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
99 | context.lineTo(pointX, pointY); | 97 | context.lineTo(pointX, pointY); |
100 | pointX = 34.207; | 98 | pointX = 34.207; |
101 | pointY = 45.697; | 99 | pointY = 45.697; |
102 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 100 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
103 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 101 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
104 | context.lineTo(pointX, pointY); | 102 | context.lineTo(pointX, pointY); |
105 | context.closePath(); | 103 | context.closePath(); |
106 | context.fillStyle = aColor; | 104 | context.fillStyle = aColor; |
107 | context.fill(); | 105 | context.fill(); |
108 | 106 | ||
109 | stroke = 6.0; | 107 | stroke = 6.0; |
110 | stroke *= resolution; | 108 | stroke *= resolution; |
111 | if (stroke < 1.0) | 109 | if (stroke < 1.0) |
112 | stroke = Math.ceil(stroke); | 110 | stroke = Math.ceil(stroke); |
113 | else | 111 | else |
114 | stroke = Math.round(stroke); | 112 | stroke = Math.round(stroke); |
115 | stroke /= resolution; | 113 | stroke /= resolution; |
116 | alignStroke = (0.5 * stroke * resolution) % 1.0; | 114 | alignStroke = (0.5 * stroke * resolution) % 1.0; |
117 | context.beginPath(); | 115 | context.beginPath(); |
118 | pointX = 24.631; | 116 | pointX = 24.631; |
119 | pointY = 28.971; | 117 | pointY = 28.971; |
120 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 118 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
121 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 119 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
122 | context.moveTo(pointX, pointY); | 120 | context.moveTo(pointX, pointY); |
123 | pointX = 46.497; | 121 | pointX = 46.497; |
124 | pointY = 26.451; | 122 | pointY = 26.451; |
125 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 123 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
126 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 124 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
127 | context.lineTo(pointX, pointY); | 125 | context.lineTo(pointX, pointY); |
128 | context.strokeStyle = aColor; | 126 | context.strokeStyle = aColor; |
129 | context.stroke(); | 127 | context.stroke(); |
130 | 128 | ||
131 | alignStroke = 0.0; | 129 | alignStroke = 0.0; |
132 | context.beginPath(); | 130 | context.beginPath(); |
133 | pointX = 25.014; | 131 | pointX = 25.014; |
134 | pointY = 35.265; | 132 | pointY = 35.265; |
135 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 133 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
136 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 134 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
137 | context.moveTo(pointX, pointY); | 135 | context.moveTo(pointX, pointY); |
138 | pointX = 22.166; | 136 | pointX = 22.166; |
139 | pointY = 22.58; | 137 | pointY = 22.58; |
140 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 138 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
141 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 139 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
142 | context.lineTo(pointX, pointY); | 140 | context.lineTo(pointX, pointY); |
143 | pointX = 15.784; | 141 | pointX = 15.784; |
144 | pointY = 30.675; | 142 | pointY = 30.675; |
145 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 143 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
146 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 144 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
147 | context.lineTo(pointX, pointY); | 145 | context.lineTo(pointX, pointY); |
148 | pointX = 25.014; | 146 | pointX = 25.014; |
149 | pointY = 35.265; | 147 | pointY = 35.265; |
150 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 148 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
151 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 149 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
152 | context.lineTo(pointX, pointY); | 150 | context.lineTo(pointX, pointY); |
153 | context.closePath(); | 151 | context.closePath(); |
154 | context.fillStyle = aColor; | 152 | context.fillStyle = aColor; |
155 | context.fill(); | 153 | context.fill(); |
156 | 154 | ||
157 | stroke = 6.0; | 155 | stroke = 6.0; |
158 | stroke *= resolution; | 156 | stroke *= resolution; |
159 | if (stroke < 1.0) | 157 | if (stroke < 1.0) |
160 | stroke = Math.ceil(stroke); | 158 | stroke = Math.ceil(stroke); |
161 | else | 159 | else |
162 | stroke = Math.round(stroke); | 160 | stroke = Math.round(stroke); |
163 | stroke /= resolution; | 161 | stroke /= resolution; |
164 | alignStroke = (0.5 * stroke * resolution) % 1.0; | 162 | alignStroke = (0.5 * stroke * resolution) % 1.0; |
165 | context.beginPath(); | 163 | context.beginPath(); |
166 | pointX = 42.282; | 164 | pointX = 42.282; |
167 | pointY = 47.03; | 165 | pointY = 47.03; |
168 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 166 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
169 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 167 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
170 | context.moveTo(pointX, pointY); | 168 | context.moveTo(pointX, pointY); |
171 | pointX = 47.771; | 169 | pointX = 47.771; |
172 | pointY = 25.714; | 170 | pointY = 25.714; |
173 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 171 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
174 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 172 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
175 | context.lineTo(pointX, pointY); | 173 | context.lineTo(pointX, pointY); |
176 | context.strokeStyle = aColor; | 174 | context.strokeStyle = aColor; |
177 | context.stroke(); | 175 | context.stroke(); |
178 | 176 | ||
179 | alignStroke = 0.0; | 177 | alignStroke = 0.0; |
180 | context.beginPath(); | 178 | context.beginPath(); |
181 | pointX = 48.294; | 179 | pointX = 48.294; |
182 | pointY = 48.929; | 180 | pointY = 48.929; |
183 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 181 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
184 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 182 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
185 | context.moveTo(pointX, pointY); | 183 | context.moveTo(pointX, pointY); |
186 | pointX = 35.432; | 184 | pointX = 35.432; |
187 | pointY = 47.039; | 185 | pointY = 47.039; |
188 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 186 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
189 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 187 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
190 | context.lineTo(pointX, pointY); | 188 | context.lineTo(pointX, pointY); |
191 | pointX = 40.7; | 189 | pointX = 40.7; |
192 | pointY = 55.899; | 190 | pointY = 55.899; |
193 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 191 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
194 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 192 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
195 | context.lineTo(pointX, pointY); | 193 | context.lineTo(pointX, pointY); |
196 | pointX = 48.294; | 194 | pointX = 48.294; |
197 | pointY = 48.929; | 195 | pointY = 48.929; |
198 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 196 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
199 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 197 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
200 | context.lineTo(pointX, pointY); | 198 | context.lineTo(pointX, pointY); |
201 | context.closePath(); | 199 | context.closePath(); |
202 | context.fillStyle = aColor; | 200 | context.fillStyle = aColor; |
203 | context.fill(); | 201 | context.fill(); |
204 | 202 | ||
205 | context.restore(); | 203 | context.restore(); |
206 | } | 204 | } |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/protect.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/protect.js index b829ed6..f015535 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/protect.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/protect.js | |||
@@ -1,214 +1,212 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //protect.js | 25 | //protect.js |
28 | //protect | 26 | //protect |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/7/10 | 28 | //Created by Giulio Cesare Solaroli on 3/7/10 |
31 | //Copyright 2010 Clipperz | 29 | //Copyright 2010 Clipperz |
32 | //This code was generated by Opacity. You may use or modify it in any way. | 30 | //This code was generated by Opacity. You may use or modify it in any way. |
33 | // | 31 | // |
34 | 32 | ||
35 | var kClipperz_PM_UI_Canvas_Features_protectWidth = 76.0; | 33 | var kClipperz_PM_UI_Canvas_Features_protectWidth = 76.0; |
36 | var kClipperz_PM_UI_Canvas_Features_protectHeight = 76.0; | 34 | var kClipperz_PM_UI_Canvas_Features_protectHeight = 76.0; |
37 | 35 | ||
38 | function Clipperz_PM_UI_Canvas_Features_protect(canvas, aColor, aBannerColor, aBannerBackgroundColor) | 36 | function Clipperz_PM_UI_Canvas_Features_protect(canvas, aColor, aBannerColor, aBannerBackgroundColor) |
39 | { | 37 | { |
40 | var context = canvas.getContext("2d"); | 38 | var context = canvas.getContext("2d"); |
41 | var alignStroke; | 39 | var alignStroke; |
42 | var resolution; | 40 | var resolution; |
43 | var path; | 41 | var path; |
44 | var pointX; | 42 | var pointX; |
45 | var pointY; | 43 | var pointY; |
46 | var controlPoint1X; | 44 | var controlPoint1X; |
47 | var controlPoint1Y; | 45 | var controlPoint1Y; |
48 | var controlPoint2X; | 46 | var controlPoint2X; |
49 | var controlPoint2Y; | 47 | var controlPoint2Y; |
50 | var stroke; | 48 | var stroke; |
51 | if (window.devicePixelRatio) | 49 | if (window.devicePixelRatio) |
52 | resolution = window.devicePixelRatio; | 50 | resolution = window.devicePixelRatio; |
53 | else | 51 | else |
54 | resolution = 1.0; | 52 | resolution = 1.0; |
55 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Features_protectWidth + canvas.height / kClipperz_PM_UI_Canvas_Features_protectHeight); | 53 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Features_protectWidth + canvas.height / kClipperz_PM_UI_Canvas_Features_protectHeight); |
56 | 54 | ||
57 | context.save(); | 55 | context.save(); |
58 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Features_protectWidth, canvas.height / kClipperz_PM_UI_Canvas_Features_protectHeight); | 56 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Features_protectWidth, canvas.height / kClipperz_PM_UI_Canvas_Features_protectHeight); |
59 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Features_protectWidth, kClipperz_PM_UI_Canvas_Features_protectHeight); | 57 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Features_protectWidth, kClipperz_PM_UI_Canvas_Features_protectHeight); |
60 | 58 | ||
61 | // Layer 1 | 59 | // Layer 1 |
62 | 60 | ||
63 | alignStroke = 0.0; | 61 | alignStroke = 0.0; |
64 | context.beginPath(); | 62 | context.beginPath(); |
65 | pointX = 38.5; | 63 | pointX = 38.5; |
66 | pointY = 36.0; | 64 | pointY = 36.0; |
67 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 65 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
68 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 66 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
69 | context.moveTo(pointX, pointY); | 67 | context.moveTo(pointX, pointY); |
70 | pointX = 37.068; | 68 | pointX = 37.068; |
71 | pointY = 38.816; | 69 | pointY = 38.816; |
72 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 70 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
73 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 71 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
74 | controlPoint1X = 37.41; | 72 | controlPoint1X = 37.41; |
75 | controlPoint1Y = 36.234; | 73 | controlPoint1Y = 36.234; |
76 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 74 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
77 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 75 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
78 | controlPoint2X = 37.175; | 76 | controlPoint2X = 37.175; |
79 | controlPoint2Y = 37.907; | 77 | controlPoint2Y = 37.907; |
80 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 78 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
81 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 79 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
82 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 80 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
83 | pointX = 37.031; | 81 | pointX = 37.031; |
84 | pointY = 40.802; | 82 | pointY = 40.802; |
85 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 83 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
86 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 84 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
87 | controlPoint1X = 36.991; | 85 | controlPoint1X = 36.991; |
88 | controlPoint1Y = 39.474; | 86 | controlPoint1Y = 39.474; |
89 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 87 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
90 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 88 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
91 | controlPoint2X = 36.98; | 89 | controlPoint2X = 36.98; |
92 | controlPoint2Y = 40.141; | 90 | controlPoint2Y = 40.141; |
93 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 91 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
94 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 92 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
95 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 93 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
96 | pointX = 37.258; | 94 | pointX = 37.258; |
97 | pointY = 42.23; | 95 | pointY = 42.23; |
98 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 96 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
99 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 97 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
100 | controlPoint1X = 37.068; | 98 | controlPoint1X = 37.068; |
101 | controlPoint1Y = 41.283; | 99 | controlPoint1Y = 41.283; |
102 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 100 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
103 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 101 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
104 | controlPoint2X = 37.139; | 102 | controlPoint2X = 37.139; |
105 | controlPoint2Y = 41.762; | 103 | controlPoint2Y = 41.762; |
106 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 104 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
107 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 105 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
108 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 106 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
109 | pointX = 38.348; | 107 | pointX = 38.348; |
110 | pointY = 43.979; | 108 | pointY = 43.979; |
111 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 109 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
112 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 110 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
113 | controlPoint1X = 37.402; | 111 | controlPoint1X = 37.402; |
114 | controlPoint1Y = 42.799; | 112 | controlPoint1Y = 42.799; |
115 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 113 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
116 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 114 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
117 | controlPoint2X = 37.682; | 115 | controlPoint2X = 37.682; |
118 | controlPoint2Y = 43.798; | 116 | controlPoint2Y = 43.798; |
119 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 117 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
120 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 118 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
121 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 119 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
122 | pointX = 38.5; | 120 | pointX = 38.5; |
123 | pointY = 36.0; | 121 | pointY = 36.0; |
124 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 122 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
125 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 123 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
126 | controlPoint1X = 40.249; | 124 | controlPoint1X = 40.249; |
127 | controlPoint1Y = 44.497; | 125 | controlPoint1Y = 44.497; |
128 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 126 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
129 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 127 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
130 | controlPoint2X = 40.723; | 128 | controlPoint2X = 40.723; |
131 | controlPoint2Y = 36.303; | 129 | controlPoint2Y = 36.303; |
132 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 130 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
133 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 131 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
134 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 132 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
135 | pointX = 38.5; | 133 | pointX = 38.5; |
136 | pointY = 36.0; | 134 | pointY = 36.0; |
137 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 135 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
138 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 136 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
139 | context.lineTo(pointX, pointY); | 137 | context.lineTo(pointX, pointY); |
140 | context.closePath(); | 138 | context.closePath(); |
141 | pointX = 50.0; | 139 | pointX = 50.0; |
142 | pointY = 52.0; | 140 | pointY = 52.0; |
143 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 141 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
144 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 142 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
145 | context.moveTo(pointX, pointY); | 143 | context.moveTo(pointX, pointY); |
146 | pointX = 26.0; | 144 | pointX = 26.0; |
147 | pointY = 52.0; | 145 | pointY = 52.0; |
148 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 146 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
149 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 147 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
150 | context.lineTo(pointX, pointY); | 148 | context.lineTo(pointX, pointY); |
151 | pointX = 26.0; | 149 | pointX = 26.0; |
152 | pointY = 33.0; | 150 | pointY = 33.0; |
153 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 151 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
154 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 152 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
155 | context.lineTo(pointX, pointY); | 153 | context.lineTo(pointX, pointY); |
156 | pointX = 50.0; | 154 | pointX = 50.0; |
157 | pointY = 33.0; | 155 | pointY = 33.0; |
158 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 156 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
159 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 157 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
160 | context.lineTo(pointX, pointY); | 158 | context.lineTo(pointX, pointY); |
161 | pointX = 50.0; | 159 | pointX = 50.0; |
162 | pointY = 52.0; | 160 | pointY = 52.0; |
163 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 161 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
164 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 162 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
165 | context.lineTo(pointX, pointY); | 163 | context.lineTo(pointX, pointY); |
166 | context.closePath(); | 164 | context.closePath(); |
167 | context.fillStyle = aColor; | 165 | context.fillStyle = aColor; |
168 | context.fill(); | 166 | context.fill(); |
169 | 167 | ||
170 | alignStroke = 0.0; | 168 | alignStroke = 0.0; |
171 | context.beginPath(); | 169 | context.beginPath(); |
172 | pointX = 47.0; | 170 | pointX = 47.0; |
173 | pointY = 32.463; | 171 | pointY = 32.463; |
174 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 172 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
175 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 173 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
176 | context.moveTo(pointX, pointY); | 174 | context.moveTo(pointX, pointY); |
177 | pointX = 38.0; | 175 | pointX = 38.0; |
178 | pointY = 52.0; | 176 | pointY = 52.0; |
179 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 177 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
180 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 178 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
181 | controlPoint1X = 47.0; | 179 | controlPoint1X = 47.0; |
182 | controlPoint1Y = 52.925; | 180 | controlPoint1Y = 52.925; |
183 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 181 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
184 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 182 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
185 | controlPoint2X = 38.0; | 183 | controlPoint2X = 38.0; |
186 | controlPoint2Y = 52.0; | 184 | controlPoint2Y = 52.0; |
187 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 185 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
188 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 186 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
189 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 187 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
190 | pointX = 29.0; | 188 | pointX = 29.0; |
191 | pointY = 32.463; | 189 | pointY = 32.463; |
192 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 190 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
193 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 191 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
194 | controlPoint1X = 38.0; | 192 | controlPoint1X = 38.0; |
195 | controlPoint1Y = 52.0; | 193 | controlPoint1Y = 52.0; |
196 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 194 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
197 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 195 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
198 | controlPoint2X = 29.0; | 196 | controlPoint2X = 29.0; |
199 | controlPoint2Y = 52.925; | 197 | controlPoint2Y = 52.925; |
200 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 198 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
201 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 199 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
202 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 200 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
203 | pointX = 47.0; | 201 | pointX = 47.0; |
204 | pointY = 32.463; | 202 | pointY = 32.463; |
205 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 203 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
206 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 204 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
207 | controlPoint1X = 29.0; | 205 | controlPoint1X = 29.0; |
208 | controlPoint1Y = 12.0; | 206 | controlPoint1Y = 12.0; |
209 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 207 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
210 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 208 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
211 | controlPoint2X = 47.0; | 209 | controlPoint2X = 47.0; |
212 | controlPoint2Y = 12.0; | 210 | controlPoint2Y = 12.0; |
213 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 211 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
214 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 212 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/share.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/share.js index 8d73cc7..47972fc 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/share.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/share.js | |||
@@ -1,214 +1,212 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //share.js | 25 | //share.js |
28 | //share | 26 | //share |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/7/10 | 28 | //Created by Giulio Cesare Solaroli on 3/7/10 |
31 | //Copyright 2010 Clipperz | 29 | //Copyright 2010 Clipperz |
32 | //This code was generated by Opacity. You may use or modify it in any way. | 30 | //This code was generated by Opacity. You may use or modify it in any way. |
33 | // | 31 | // |
34 | 32 | ||
35 | var kClipperz_PM_UI_Canvas_Features_shareWidth = 76.0; | 33 | var kClipperz_PM_UI_Canvas_Features_shareWidth = 76.0; |
36 | var kClipperz_PM_UI_Canvas_Features_shareHeight = 76.0; | 34 | var kClipperz_PM_UI_Canvas_Features_shareHeight = 76.0; |
37 | 35 | ||
38 | function Clipperz_PM_UI_Canvas_Features_share(canvas, aColor, aBannerColor, aBannerBackgroundColor) | 36 | function Clipperz_PM_UI_Canvas_Features_share(canvas, aColor, aBannerColor, aBannerBackgroundColor) |
39 | { | 37 | { |
40 | var context = canvas.getContext("2d"); | 38 | var context = canvas.getContext("2d"); |
41 | var alignStroke; | 39 | var alignStroke; |
42 | var resolution; | 40 | var resolution; |
43 | var path; | 41 | var path; |
44 | var pointX; | 42 | var pointX; |
45 | var pointY; | 43 | var pointY; |
46 | var controlPoint1X; | 44 | var controlPoint1X; |
47 | var controlPoint1Y; | 45 | var controlPoint1Y; |
48 | var controlPoint2X; | 46 | var controlPoint2X; |
49 | var controlPoint2Y; | 47 | var controlPoint2Y; |
50 | var stroke; | 48 | var stroke; |
51 | if (window.devicePixelRatio) | 49 | if (window.devicePixelRatio) |
52 | resolution = window.devicePixelRatio; | 50 | resolution = window.devicePixelRatio; |
53 | else | 51 | else |
54 | resolution = 1.0; | 52 | resolution = 1.0; |
55 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Features_shareWidth + canvas.height / kClipperz_PM_UI_Canvas_Features_shareHeight); | 53 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Features_shareWidth + canvas.height / kClipperz_PM_UI_Canvas_Features_shareHeight); |
56 | 54 | ||
57 | context.save(); | 55 | context.save(); |
58 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Features_shareWidth, canvas.height / kClipperz_PM_UI_Canvas_Features_shareHeight); | 56 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Features_shareWidth, canvas.height / kClipperz_PM_UI_Canvas_Features_shareHeight); |
59 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Features_shareWidth, kClipperz_PM_UI_Canvas_Features_shareHeight); | 57 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Features_shareWidth, kClipperz_PM_UI_Canvas_Features_shareHeight); |
60 | 58 | ||
61 | // Layer 1 | 59 | // Layer 1 |
62 | 60 | ||
63 | alignStroke = 0.0; | 61 | alignStroke = 0.0; |
64 | context.beginPath(); | 62 | context.beginPath(); |
65 | pointX = 43.179; | 63 | pointX = 43.179; |
66 | pointY = 18.621; | 64 | pointY = 18.621; |
67 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 65 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
68 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 66 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
69 | context.moveTo(pointX, pointY); | 67 | context.moveTo(pointX, pointY); |
70 | pointX = 37.163; | 68 | pointX = 37.163; |
71 | pointY = 12.605; | 69 | pointY = 12.605; |
72 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 70 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
73 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 71 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
74 | controlPoint1X = 43.179; | 72 | controlPoint1X = 43.179; |
75 | controlPoint1Y = 15.32; | 73 | controlPoint1Y = 15.32; |
76 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 74 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
77 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 75 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
78 | controlPoint2X = 40.463; | 76 | controlPoint2X = 40.463; |
79 | controlPoint2Y = 12.605; | 77 | controlPoint2Y = 12.605; |
80 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 78 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
81 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 79 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
82 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 80 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
83 | pointX = 31.147; | 81 | pointX = 31.147; |
84 | pointY = 18.621; | 82 | pointY = 18.621; |
85 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 83 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
86 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 84 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
87 | controlPoint1X = 33.863; | 85 | controlPoint1X = 33.863; |
88 | controlPoint1Y = 12.605; | 86 | controlPoint1Y = 12.605; |
89 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 87 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
90 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 88 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
91 | controlPoint2X = 31.147; | 89 | controlPoint2X = 31.147; |
92 | controlPoint2Y = 15.32; | 90 | controlPoint2Y = 15.32; |
93 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 91 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
94 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 92 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
95 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 93 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
96 | pointX = 37.163; | 94 | pointX = 37.163; |
97 | pointY = 24.637; | 95 | pointY = 24.637; |
98 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 96 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
99 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 97 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
100 | controlPoint1X = 31.147; | 98 | controlPoint1X = 31.147; |
101 | controlPoint1Y = 21.921; | 99 | controlPoint1Y = 21.921; |
102 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 100 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
103 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 101 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
104 | controlPoint2X = 33.863; | 102 | controlPoint2X = 33.863; |
105 | controlPoint2Y = 24.637; | 103 | controlPoint2Y = 24.637; |
106 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 104 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
107 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 105 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
108 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 106 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
109 | pointX = 43.179; | 107 | pointX = 43.179; |
110 | pointY = 18.621; | 108 | pointY = 18.621; |
111 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 109 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
112 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 110 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
113 | controlPoint1X = 40.463; | 111 | controlPoint1X = 40.463; |
114 | controlPoint1Y = 24.637; | 112 | controlPoint1Y = 24.637; |
115 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 113 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
116 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 114 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
117 | controlPoint2X = 43.179; | 115 | controlPoint2X = 43.179; |
118 | controlPoint2Y = 21.921; | 116 | controlPoint2Y = 21.921; |
119 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 117 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
120 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 118 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
121 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 119 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
122 | context.closePath(); | 120 | context.closePath(); |
123 | context.fillStyle = aColor; | 121 | context.fillStyle = aColor; |
124 | context.fill(); | 122 | context.fill(); |
125 | 123 | ||
126 | alignStroke = 0.0; | 124 | alignStroke = 0.0; |
127 | context.beginPath(); | 125 | context.beginPath(); |
128 | pointX = 56.548; | 126 | pointX = 56.548; |
129 | pointY = 53.379; | 127 | pointY = 53.379; |
130 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 128 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
131 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 129 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
132 | context.moveTo(pointX, pointY); | 130 | context.moveTo(pointX, pointY); |
133 | pointX = 51.2; | 131 | pointX = 51.2; |
134 | pointY = 48.032; | 132 | pointY = 48.032; |
135 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 133 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
136 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 134 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
137 | controlPoint1X = 56.548; | 135 | controlPoint1X = 56.548; |
138 | controlPoint1Y = 50.446; | 136 | controlPoint1Y = 50.446; |
139 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 137 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
140 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 138 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
141 | controlPoint2X = 54.134; | 139 | controlPoint2X = 54.134; |
142 | controlPoint2Y = 48.032; | 140 | controlPoint2Y = 48.032; |
143 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 141 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
144 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 142 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
145 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 143 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
146 | pointX = 45.853; | 144 | pointX = 45.853; |
147 | pointY = 53.379; | 145 | pointY = 53.379; |
148 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 146 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
149 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 147 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
150 | controlPoint1X = 48.267; | 148 | controlPoint1X = 48.267; |
151 | controlPoint1Y = 48.032; | 149 | controlPoint1Y = 48.032; |
152 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 150 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
153 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 151 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
154 | controlPoint2X = 45.853; | 152 | controlPoint2X = 45.853; |
155 | controlPoint2Y = 50.446; | 153 | controlPoint2Y = 50.446; |
156 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 154 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
157 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 155 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
158 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 156 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
159 | pointX = 51.2; | 157 | pointX = 51.2; |
160 | pointY = 58.727; | 158 | pointY = 58.727; |
161 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 159 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
162 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 160 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
163 | controlPoint1X = 45.853; | 161 | controlPoint1X = 45.853; |
164 | controlPoint1Y = 56.313; | 162 | controlPoint1Y = 56.313; |
165 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 163 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
166 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 164 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
167 | controlPoint2X = 48.267; | 165 | controlPoint2X = 48.267; |
168 | controlPoint2Y = 58.727; | 166 | controlPoint2Y = 58.727; |
169 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 167 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
170 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 168 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
171 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 169 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
172 | pointX = 56.548; | 170 | pointX = 56.548; |
173 | pointY = 53.379; | 171 | pointY = 53.379; |
174 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 172 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
175 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 173 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
176 | controlPoint1X = 54.134; | 174 | controlPoint1X = 54.134; |
177 | controlPoint1Y = 58.727; | 175 | controlPoint1Y = 58.727; |
178 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 176 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
179 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 177 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
180 | controlPoint2X = 56.548; | 178 | controlPoint2X = 56.548; |
181 | controlPoint2Y = 56.313; | 179 | controlPoint2Y = 56.313; |
182 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 180 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
183 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 181 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
184 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 182 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
185 | context.closePath(); | 183 | context.closePath(); |
186 | context.fillStyle = aColor; | 184 | context.fillStyle = aColor; |
187 | context.fill(); | 185 | context.fill(); |
188 | 186 | ||
189 | alignStroke = 0.0; | 187 | alignStroke = 0.0; |
190 | context.beginPath(); | 188 | context.beginPath(); |
191 | pointX = 31.147; | 189 | pointX = 31.147; |
192 | pointY = 38.674; | 190 | pointY = 38.674; |
193 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 191 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
194 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 192 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
195 | context.moveTo(pointX, pointY); | 193 | context.moveTo(pointX, pointY); |
196 | pointX = 25.8; | 194 | pointX = 25.8; |
197 | pointY = 33.326; | 195 | pointY = 33.326; |
198 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 196 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
199 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 197 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
200 | controlPoint1X = 31.147; | 198 | controlPoint1X = 31.147; |
201 | controlPoint1Y = 35.74; | 199 | controlPoint1Y = 35.74; |
202 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 200 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
203 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 201 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
204 | controlPoint2X = 28.733; | 202 | controlPoint2X = 28.733; |
205 | controlPoint2Y = 33.326; | 203 | controlPoint2Y = 33.326; |
206 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 204 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
207 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 205 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
208 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 206 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
209 | pointX = 20.452; | 207 | pointX = 20.452; |
210 | pointY = 38.674; | 208 | pointY = 38.674; |
211 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 209 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
212 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 210 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
213 | controlPoint1X = 22.866; | 211 | controlPoint1X = 22.866; |
214 | controlPoint1Y = 33.326; | 212 | controlPoint1Y = 33.326; |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/store.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/store.js index 572d9be..a4f30b2 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/store.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/store.js | |||
@@ -1,214 +1,212 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //store.js | 25 | //store.js |
28 | //store | 26 | //store |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/7/10 | 28 | //Created by Giulio Cesare Solaroli on 3/7/10 |
31 | //Copyright 2010 Clipperz | 29 | //Copyright 2010 Clipperz |
32 | //This code was generated by Opacity. You may use or modify it in any way. | 30 | //This code was generated by Opacity. You may use or modify it in any way. |
33 | // | 31 | // |
34 | 32 | ||
35 | var kClipperz_PM_UI_Canvas_Features_storeWidth = 76.0; | 33 | var kClipperz_PM_UI_Canvas_Features_storeWidth = 76.0; |
36 | var kClipperz_PM_UI_Canvas_Features_storeHeight = 76.0; | 34 | var kClipperz_PM_UI_Canvas_Features_storeHeight = 76.0; |
37 | 35 | ||
38 | function Clipperz_PM_UI_Canvas_Features_store(canvas, aColor, aBannerColor, aBannerBackgroundColor) | 36 | function Clipperz_PM_UI_Canvas_Features_store(canvas, aColor, aBannerColor, aBannerBackgroundColor) |
39 | { | 37 | { |
40 | var context = canvas.getContext("2d"); | 38 | var context = canvas.getContext("2d"); |
41 | var alignStroke; | 39 | var alignStroke; |
42 | var resolution; | 40 | var resolution; |
43 | var path; | 41 | var path; |
44 | var pointX; | 42 | var pointX; |
45 | var pointY; | 43 | var pointY; |
46 | if (window.devicePixelRatio) | 44 | if (window.devicePixelRatio) |
47 | resolution = window.devicePixelRatio; | 45 | resolution = window.devicePixelRatio; |
48 | else | 46 | else |
49 | resolution = 1.0; | 47 | resolution = 1.0; |
50 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Features_storeWidth + canvas.height / kClipperz_PM_UI_Canvas_Features_storeHeight); | 48 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Features_storeWidth + canvas.height / kClipperz_PM_UI_Canvas_Features_storeHeight); |
51 | 49 | ||
52 | context.save(); | 50 | context.save(); |
53 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Features_storeWidth, canvas.height / kClipperz_PM_UI_Canvas_Features_storeHeight); | 51 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Features_storeWidth, canvas.height / kClipperz_PM_UI_Canvas_Features_storeHeight); |
54 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Features_storeWidth, kClipperz_PM_UI_Canvas_Features_storeHeight); | 52 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Features_storeWidth, kClipperz_PM_UI_Canvas_Features_storeHeight); |
55 | 53 | ||
56 | // Layer 1 | 54 | // Layer 1 |
57 | 55 | ||
58 | alignStroke = 0.0; | 56 | alignStroke = 0.0; |
59 | context.beginPath(); | 57 | context.beginPath(); |
60 | pointX = 27.0; | 58 | pointX = 27.0; |
61 | pointY = 29.5; | 59 | pointY = 29.5; |
62 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 60 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
63 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 61 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
64 | context.moveTo(pointX, pointY); | 62 | context.moveTo(pointX, pointY); |
65 | pointX = 27.0; | 63 | pointX = 27.0; |
66 | pointY = 24.5; | 64 | pointY = 24.5; |
67 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 65 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
68 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 66 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
69 | context.lineTo(pointX, pointY); | 67 | context.lineTo(pointX, pointY); |
70 | pointX = 22.0; | 68 | pointX = 22.0; |
71 | pointY = 24.5; | 69 | pointY = 24.5; |
72 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 70 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
73 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 71 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
74 | context.lineTo(pointX, pointY); | 72 | context.lineTo(pointX, pointY); |
75 | pointX = 22.0; | 73 | pointX = 22.0; |
76 | pointY = 29.5; | 74 | pointY = 29.5; |
77 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 75 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
78 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 76 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
79 | context.lineTo(pointX, pointY); | 77 | context.lineTo(pointX, pointY); |
80 | pointX = 27.0; | 78 | pointX = 27.0; |
81 | pointY = 29.5; | 79 | pointY = 29.5; |
82 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 80 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
83 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 81 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
84 | context.lineTo(pointX, pointY); | 82 | context.lineTo(pointX, pointY); |
85 | context.closePath(); | 83 | context.closePath(); |
86 | context.fillStyle = aColor; | 84 | context.fillStyle = aColor; |
87 | context.fill(); | 85 | context.fill(); |
88 | 86 | ||
89 | alignStroke = 0.0; | 87 | alignStroke = 0.0; |
90 | context.beginPath(); | 88 | context.beginPath(); |
91 | pointX = 54.0; | 89 | pointX = 54.0; |
92 | pointY = 29.5; | 90 | pointY = 29.5; |
93 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 91 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
94 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 92 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
95 | context.moveTo(pointX, pointY); | 93 | context.moveTo(pointX, pointY); |
96 | pointX = 54.0; | 94 | pointX = 54.0; |
97 | pointY = 24.5; | 95 | pointY = 24.5; |
98 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 96 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
99 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 97 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
100 | context.lineTo(pointX, pointY); | 98 | context.lineTo(pointX, pointY); |
101 | pointX = 29.0; | 99 | pointX = 29.0; |
102 | pointY = 24.5; | 100 | pointY = 24.5; |
103 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 101 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
104 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 102 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
105 | context.lineTo(pointX, pointY); | 103 | context.lineTo(pointX, pointY); |
106 | pointX = 29.0; | 104 | pointX = 29.0; |
107 | pointY = 29.5; | 105 | pointY = 29.5; |
108 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 106 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
109 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 107 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
110 | context.lineTo(pointX, pointY); | 108 | context.lineTo(pointX, pointY); |
111 | pointX = 54.0; | 109 | pointX = 54.0; |
112 | pointY = 29.5; | 110 | pointY = 29.5; |
113 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 111 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
114 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 112 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
115 | context.lineTo(pointX, pointY); | 113 | context.lineTo(pointX, pointY); |
116 | context.closePath(); | 114 | context.closePath(); |
117 | context.fillStyle = aColor; | 115 | context.fillStyle = aColor; |
118 | context.fill(); | 116 | context.fill(); |
119 | 117 | ||
120 | alignStroke = 0.0; | 118 | alignStroke = 0.0; |
121 | context.beginPath(); | 119 | context.beginPath(); |
122 | pointX = 43.0; | 120 | pointX = 43.0; |
123 | pointY = 37.0; | 121 | pointY = 37.0; |
124 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 122 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
125 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 123 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
126 | context.moveTo(pointX, pointY); | 124 | context.moveTo(pointX, pointY); |
127 | pointX = 43.0; | 125 | pointX = 43.0; |
128 | pointY = 32.0; | 126 | pointY = 32.0; |
129 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 127 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
130 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 128 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
131 | context.lineTo(pointX, pointY); | 129 | context.lineTo(pointX, pointY); |
132 | pointX = 29.0; | 130 | pointX = 29.0; |
133 | pointY = 32.0; | 131 | pointY = 32.0; |
134 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 132 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
135 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 133 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
136 | context.lineTo(pointX, pointY); | 134 | context.lineTo(pointX, pointY); |
137 | pointX = 29.0; | 135 | pointX = 29.0; |
138 | pointY = 37.0; | 136 | pointY = 37.0; |
139 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 137 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
140 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 138 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
141 | context.lineTo(pointX, pointY); | 139 | context.lineTo(pointX, pointY); |
142 | pointX = 43.0; | 140 | pointX = 43.0; |
143 | pointY = 37.0; | 141 | pointY = 37.0; |
144 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 142 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
145 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 143 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
146 | context.lineTo(pointX, pointY); | 144 | context.lineTo(pointX, pointY); |
147 | context.closePath(); | 145 | context.closePath(); |
148 | context.fillStyle = aColor; | 146 | context.fillStyle = aColor; |
149 | context.fill(); | 147 | context.fill(); |
150 | 148 | ||
151 | alignStroke = 0.0; | 149 | alignStroke = 0.0; |
152 | context.beginPath(); | 150 | context.beginPath(); |
153 | pointX = 27.0; | 151 | pointX = 27.0; |
154 | pointY = 37.0; | 152 | pointY = 37.0; |
155 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 153 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
156 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 154 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
157 | context.moveTo(pointX, pointY); | 155 | context.moveTo(pointX, pointY); |
158 | pointX = 27.0; | 156 | pointX = 27.0; |
159 | pointY = 32.0; | 157 | pointY = 32.0; |
160 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 158 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
161 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 159 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
162 | context.lineTo(pointX, pointY); | 160 | context.lineTo(pointX, pointY); |
163 | pointX = 22.0; | 161 | pointX = 22.0; |
164 | pointY = 32.0; | 162 | pointY = 32.0; |
165 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 163 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
166 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 164 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
167 | context.lineTo(pointX, pointY); | 165 | context.lineTo(pointX, pointY); |
168 | pointX = 22.0; | 166 | pointX = 22.0; |
169 | pointY = 37.0; | 167 | pointY = 37.0; |
170 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 168 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
171 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 169 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
172 | context.lineTo(pointX, pointY); | 170 | context.lineTo(pointX, pointY); |
173 | pointX = 27.0; | 171 | pointX = 27.0; |
174 | pointY = 37.0; | 172 | pointY = 37.0; |
175 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 173 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
176 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 174 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
177 | context.lineTo(pointX, pointY); | 175 | context.lineTo(pointX, pointY); |
178 | context.closePath(); | 176 | context.closePath(); |
179 | context.fillStyle = aColor; | 177 | context.fillStyle = aColor; |
180 | context.fill(); | 178 | context.fill(); |
181 | 179 | ||
182 | alignStroke = 0.0; | 180 | alignStroke = 0.0; |
183 | context.beginPath(); | 181 | context.beginPath(); |
184 | pointX = 27.0; | 182 | pointX = 27.0; |
185 | pointY = 44.0; | 183 | pointY = 44.0; |
186 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 184 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
187 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 185 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
188 | context.moveTo(pointX, pointY); | 186 | context.moveTo(pointX, pointY); |
189 | pointX = 27.0; | 187 | pointX = 27.0; |
190 | pointY = 39.0; | 188 | pointY = 39.0; |
191 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 189 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
192 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 190 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
193 | context.lineTo(pointX, pointY); | 191 | context.lineTo(pointX, pointY); |
194 | pointX = 22.0; | 192 | pointX = 22.0; |
195 | pointY = 39.0; | 193 | pointY = 39.0; |
196 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 194 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
197 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 195 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
198 | context.lineTo(pointX, pointY); | 196 | context.lineTo(pointX, pointY); |
199 | pointX = 22.0; | 197 | pointX = 22.0; |
200 | pointY = 44.0; | 198 | pointY = 44.0; |
201 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 199 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
202 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 200 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
203 | context.lineTo(pointX, pointY); | 201 | context.lineTo(pointX, pointY); |
204 | pointX = 27.0; | 202 | pointX = 27.0; |
205 | pointY = 44.0; | 203 | pointY = 44.0; |
206 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 204 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
207 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 205 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
208 | context.lineTo(pointX, pointY); | 206 | context.lineTo(pointX, pointY); |
209 | context.closePath(); | 207 | context.closePath(); |
210 | context.fillStyle = aColor; | 208 | context.fillStyle = aColor; |
211 | context.fill(); | 209 | context.fill(); |
212 | 210 | ||
213 | alignStroke = 0.0; | 211 | alignStroke = 0.0; |
214 | context.beginPath(); | 212 | context.beginPath(); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/GraphicFunctions.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/GraphicFunctions.js index b9443bd..dccefab 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/GraphicFunctions.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/GraphicFunctions.js | |||
@@ -1,65 +1,63 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Canvas'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Canvas'); |
27 | 25 | ||
28 | MochiKit.Base.update(Clipperz.PM.UI.Canvas , { | 26 | MochiKit.Base.update(Clipperz.PM.UI.Canvas , { |
29 | 'marks': { | 27 | 'marks': { |
30 | '!':Clipperz_PM_UI_Canvas_Marks_exclamationMark, | 28 | '!':Clipperz_PM_UI_Canvas_Marks_exclamationMark, |
31 | '?':Clipperz_PM_UI_Canvas_Marks_questionMark, | 29 | '?':Clipperz_PM_UI_Canvas_Marks_questionMark, |
32 | 'i':Clipperz_PM_UI_Canvas_Marks_info | 30 | 'i':Clipperz_PM_UI_Canvas_Marks_info |
33 | }, | 31 | }, |
34 | 32 | ||
35 | 'features': { | 33 | 'features': { |
36 | 'store': Clipperz_PM_UI_Canvas_Features_store, | 34 | 'store': Clipperz_PM_UI_Canvas_Features_store, |
37 | 'protect': Clipperz_PM_UI_Canvas_Features_protect, | 35 | 'protect': Clipperz_PM_UI_Canvas_Features_protect, |
38 | 'directLogin':Clipperz_PM_UI_Canvas_Features_directLogin, | 36 | 'directLogin':Clipperz_PM_UI_Canvas_Features_directLogin, |
39 | 'share': Clipperz_PM_UI_Canvas_Features_share | 37 | 'share': Clipperz_PM_UI_Canvas_Features_share |
40 | }, | 38 | }, |
41 | 39 | ||
42 | 'tips': { | 40 | 'tips': { |
43 | 'open': Clipperz_PM_UI_Canvas_Tips_open, | 41 | 'open': Clipperz_PM_UI_Canvas_Tips_open, |
44 | 'close': Clipperz_PM_UI_Canvas_Tips_close | 42 | 'close': Clipperz_PM_UI_Canvas_Tips_close |
45 | }, | 43 | }, |
46 | 44 | ||
47 | 'star': { | 45 | 'star': { |
48 | 'normal': Clipperz_PM_UI_Canvas_Star_normal | 46 | 'normal': Clipperz_PM_UI_Canvas_Star_normal |
49 | }, | 47 | }, |
50 | 48 | ||
51 | 'coverActions': { | 49 | 'coverActions': { |
52 | 'look': Clipperz_PM_UI_Canvas_CoverActions_look, | 50 | 'look': Clipperz_PM_UI_Canvas_CoverActions_look, |
53 | 'download': Clipperz_PM_UI_Canvas_CoverActions_download | 51 | 'download': Clipperz_PM_UI_Canvas_CoverActions_download |
54 | }, | 52 | }, |
55 | 53 | ||
56 | 'registerButton': { | 54 | 'registerButton': { |
57 | 'normal': Clipperz_PM_UI_Canvas_RegisterButton_normal | 55 | 'normal': Clipperz_PM_UI_Canvas_RegisterButton_normal |
58 | }, | 56 | }, |
59 | 57 | ||
60 | 'logo': { | 58 | 'logo': { |
61 | 'normal': Clipperz_PM_UI_Canvas_Logo_normal | 59 | 'normal': Clipperz_PM_UI_Canvas_Logo_normal |
62 | }, | 60 | }, |
63 | 61 | ||
64 | __syntaxFix__: "syntax fix" | 62 | __syntaxFix__: "syntax fix" |
65 | }); | 63 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Logo/normal.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Logo/normal.js index cc60bba..24c0bc3 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Logo/normal.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Logo/normal.js | |||
@@ -1,54 +1,52 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //normal.js | 25 | //normal.js |
28 | //New Image | 26 | //New Image |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 2/13/12 | 28 | //Created by Giulio Cesare Solaroli on 2/13/12 |
31 | //Copyright 2012 Clipperz | 29 | //Copyright 2012 Clipperz |
32 | //This code was generated by Opacity. You may use or modify it in any way. | 30 | //This code was generated by Opacity. You may use or modify it in any way. |
33 | // | 31 | // |
34 | 32 | ||
35 | var kClipperz_PM_UI_Canvas_Logo_normalWidth = 150.0; | 33 | var kClipperz_PM_UI_Canvas_Logo_normalWidth = 150.0; |
36 | var kClipperz_PM_UI_Canvas_Logo_normalHeight = 39.0; | 34 | var kClipperz_PM_UI_Canvas_Logo_normalHeight = 39.0; |
37 | 35 | ||
38 | function Clipperz_PM_UI_Canvas_Logo_normal(canvas, logo, fontSize, text_color) | 36 | function Clipperz_PM_UI_Canvas_Logo_normal(canvas, logo, fontSize, text_color) |
39 | { | 37 | { |
40 | var context = canvas.getContext("2d"); | 38 | var context = canvas.getContext("2d"); |
41 | 39 | ||
42 | canvas.width = kClipperz_PM_UI_Canvas_Logo_normalWidth; | 40 | canvas.width = kClipperz_PM_UI_Canvas_Logo_normalWidth; |
43 | canvas.height = kClipperz_PM_UI_Canvas_Logo_normalHeight; | 41 | canvas.height = kClipperz_PM_UI_Canvas_Logo_normalHeight; |
44 | 42 | ||
45 | context.save(); | 43 | context.save(); |
46 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Logo_normalWidth, canvas.height / kClipperz_PM_UI_Canvas_Logo_normalHeight); | 44 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Logo_normalWidth, canvas.height / kClipperz_PM_UI_Canvas_Logo_normalHeight); |
47 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Logo_normalWidth, kClipperz_PM_UI_Canvas_Logo_normalHeight); | 45 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Logo_normalWidth, kClipperz_PM_UI_Canvas_Logo_normalHeight); |
48 | 46 | ||
49 | context.font = fontSize + " HelveticaNeue-Bold"; | 47 | context.font = fontSize + " HelveticaNeue-Bold"; |
50 | context.fillStyle = text_color; | 48 | context.fillStyle = text_color; |
51 | context.fillText(logo, 3, 30); | 49 | context.fillText(logo, 3, 30); |
52 | 50 | ||
53 | context.restore(); | 51 | context.restore(); |
54 | } | 52 | } |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/exclamationMark.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/exclamationMark.js index 02f2f80..5982f0d 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/exclamationMark.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/exclamationMark.js | |||
@@ -1,214 +1,212 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //exclamationMark.js | 25 | //exclamationMark.js |
28 | //! | 26 | //! |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/7/10 | 28 | //Created by Giulio Cesare Solaroli on 3/7/10 |
31 | //Copyright 2010 Clipperz | 29 | //Copyright 2010 Clipperz |
32 | //This code was generated by Opacity. You may use or modify it in any way. | 30 | //This code was generated by Opacity. You may use or modify it in any way. |
33 | // | 31 | // |
34 | 32 | ||
35 | var kClipperz_PM_UI_Canvas_Marks_exclamationMarkWidth = 50.0; | 33 | var kClipperz_PM_UI_Canvas_Marks_exclamationMarkWidth = 50.0; |
36 | var kClipperz_PM_UI_Canvas_Marks_exclamationMarkHeight = 50.0; | 34 | var kClipperz_PM_UI_Canvas_Marks_exclamationMarkHeight = 50.0; |
37 | 35 | ||
38 | function Clipperz_PM_UI_Canvas_Marks_exclamationMark(canvas, aColor) | 36 | function Clipperz_PM_UI_Canvas_Marks_exclamationMark(canvas, aColor) |
39 | { | 37 | { |
40 | var context = canvas.getContext("2d"); | 38 | var context = canvas.getContext("2d"); |
41 | var alignStroke; | 39 | var alignStroke; |
42 | var resolution; | 40 | var resolution; |
43 | var path; | 41 | var path; |
44 | var pointX; | 42 | var pointX; |
45 | var pointY; | 43 | var pointY; |
46 | var controlPoint1X; | 44 | var controlPoint1X; |
47 | var controlPoint1Y; | 45 | var controlPoint1Y; |
48 | var controlPoint2X; | 46 | var controlPoint2X; |
49 | var controlPoint2Y; | 47 | var controlPoint2Y; |
50 | if (window.devicePixelRatio) | 48 | if (window.devicePixelRatio) |
51 | resolution = window.devicePixelRatio; | 49 | resolution = window.devicePixelRatio; |
52 | else | 50 | else |
53 | resolution = 1.0; | 51 | resolution = 1.0; |
54 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Marks_exclamationMarkWidth + canvas.height / kClipperz_PM_UI_Canvas_Marks_exclamationMarkHeight); | 52 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Marks_exclamationMarkWidth + canvas.height / kClipperz_PM_UI_Canvas_Marks_exclamationMarkHeight); |
55 | 53 | ||
56 | context.save(); | 54 | context.save(); |
57 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Marks_exclamationMarkWidth, canvas.height / kClipperz_PM_UI_Canvas_Marks_exclamationMarkHeight); | 55 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Marks_exclamationMarkWidth, canvas.height / kClipperz_PM_UI_Canvas_Marks_exclamationMarkHeight); |
58 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Marks_exclamationMarkWidth, kClipperz_PM_UI_Canvas_Marks_exclamationMarkHeight); | 56 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Marks_exclamationMarkWidth, kClipperz_PM_UI_Canvas_Marks_exclamationMarkHeight); |
59 | 57 | ||
60 | // Layer 1 | 58 | // Layer 1 |
61 | 59 | ||
62 | alignStroke = 0.0; | 60 | alignStroke = 0.0; |
63 | context.beginPath(); | 61 | context.beginPath(); |
64 | pointX = 26.499; | 62 | pointX = 26.499; |
65 | pointY = 10.848; | 63 | pointY = 10.848; |
66 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 64 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
67 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 65 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
68 | context.moveTo(pointX, pointY); | 66 | context.moveTo(pointX, pointY); |
69 | pointX = 20.887; | 67 | pointX = 20.887; |
70 | pointY = 11.584; | 68 | pointY = 11.584; |
71 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 69 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
72 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 70 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
73 | controlPoint1X = 25.395; | 71 | controlPoint1X = 25.395; |
74 | controlPoint1Y = 10.802; | 72 | controlPoint1Y = 10.802; |
75 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 73 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
76 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 74 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
77 | controlPoint2X = 22.175; | 75 | controlPoint2X = 22.175; |
78 | controlPoint2Y = 11.078; | 76 | controlPoint2Y = 11.078; |
79 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 77 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
80 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 78 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
81 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 79 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
82 | pointX = 20.013; | 80 | pointX = 20.013; |
83 | pointY = 13.194; | 81 | pointY = 13.194; |
84 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 82 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
85 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 83 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
86 | controlPoint1X = 20.335; | 84 | controlPoint1X = 20.335; |
87 | controlPoint1Y = 11.814; | 85 | controlPoint1Y = 11.814; |
88 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 86 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
89 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 87 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
90 | controlPoint2X = 19.921; | 88 | controlPoint2X = 19.921; |
91 | controlPoint2Y = 12.826; | 89 | controlPoint2Y = 12.826; |
92 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 90 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
93 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 91 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
94 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 92 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
95 | pointX = 23.049; | 93 | pointX = 23.049; |
96 | pointY = 28.788; | 94 | pointY = 28.788; |
97 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 95 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
98 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 96 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
99 | controlPoint1X = 20.243; | 97 | controlPoint1X = 20.243; |
100 | controlPoint1Y = 15.448; | 98 | controlPoint1Y = 15.448; |
101 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 99 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
102 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 100 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
103 | controlPoint2X = 22.589; | 101 | controlPoint2X = 22.589; |
104 | controlPoint2Y = 26.35; | 102 | controlPoint2Y = 26.35; |
105 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 103 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
106 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 104 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
107 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 105 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
108 | pointX = 25.027; | 106 | pointX = 25.027; |
109 | pointY = 29.156; | 107 | pointY = 29.156; |
110 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 108 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
111 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 109 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
112 | controlPoint1X = 23.279; | 110 | controlPoint1X = 23.279; |
113 | controlPoint1Y = 29.018; | 111 | controlPoint1Y = 29.018; |
114 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 112 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
115 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 113 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
116 | controlPoint2X = 24.705; | 114 | controlPoint2X = 24.705; |
117 | controlPoint2Y = 29.202; | 115 | controlPoint2Y = 29.202; |
118 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 116 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
119 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 117 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
120 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 118 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
121 | pointX = 27.971; | 119 | pointX = 27.971; |
122 | pointY = 11.354; | 120 | pointY = 11.354; |
123 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 121 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
124 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 122 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
125 | controlPoint1X = 25.809; | 123 | controlPoint1X = 25.809; |
126 | controlPoint1Y = 25.384; | 124 | controlPoint1Y = 25.384; |
127 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 125 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
128 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 126 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
129 | controlPoint2X = 27.971; | 127 | controlPoint2X = 27.971; |
130 | controlPoint2Y = 12.826; | 128 | controlPoint2Y = 12.826; |
131 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 129 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
132 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 130 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
133 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 131 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
134 | pointX = 26.499; | 132 | pointX = 26.499; |
135 | pointY = 10.848; | 133 | pointY = 10.848; |
136 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 134 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
137 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 135 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
138 | controlPoint1X = 27.557; | 136 | controlPoint1X = 27.557; |
139 | controlPoint1Y = 11.032; | 137 | controlPoint1Y = 11.032; |
140 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 138 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
141 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 139 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
142 | controlPoint2X = 26.913; | 140 | controlPoint2X = 26.913; |
143 | controlPoint2Y = 10.848; | 141 | controlPoint2Y = 10.848; |
144 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 142 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
145 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 143 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
146 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 144 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
147 | pointX = 26.499; | 145 | pointX = 26.499; |
148 | pointY = 10.848; | 146 | pointY = 10.848; |
149 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 147 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
150 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 148 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
151 | context.lineTo(pointX, pointY); | 149 | context.lineTo(pointX, pointY); |
152 | context.closePath(); | 150 | context.closePath(); |
153 | pointX = 24.337; | 151 | pointX = 24.337; |
154 | pointY = 31.962; | 152 | pointY = 31.962; |
155 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 153 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
156 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 154 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
157 | context.moveTo(pointX, pointY); | 155 | context.moveTo(pointX, pointY); |
158 | pointX = 21.899; | 156 | pointX = 21.899; |
159 | pointY = 32.882; | 157 | pointY = 32.882; |
160 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 158 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
161 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 159 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
162 | controlPoint1X = 23.463; | 160 | controlPoint1X = 23.463; |
163 | controlPoint1Y = 31.962; | 161 | controlPoint1Y = 31.962; |
164 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 162 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
165 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 163 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
166 | controlPoint2X = 22.589; | 164 | controlPoint2X = 22.589; |
167 | controlPoint2Y = 32.284; | 165 | controlPoint2Y = 32.284; |
168 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 166 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
169 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 167 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
170 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 168 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
171 | pointX = 20.703; | 169 | pointX = 20.703; |
172 | pointY = 35.458; | 170 | pointY = 35.458; |
173 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 171 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
174 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 172 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
175 | controlPoint1X = 21.163; | 173 | controlPoint1X = 21.163; |
176 | controlPoint1Y = 33.572; | 174 | controlPoint1Y = 33.572; |
177 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 175 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
178 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 176 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
179 | controlPoint2X = 20.703; | 177 | controlPoint2X = 20.703; |
180 | controlPoint2Y = 34.538; | 178 | controlPoint2Y = 34.538; |
181 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 179 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
182 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 180 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
183 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 181 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
184 | pointX = 21.669; | 182 | pointX = 21.669; |
185 | pointY = 38.08; | 183 | pointY = 38.08; |
186 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 184 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
187 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 185 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
188 | controlPoint1X = 20.703; | 186 | controlPoint1X = 20.703; |
189 | controlPoint1Y = 36.47; | 187 | controlPoint1Y = 36.47; |
190 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 188 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
191 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 189 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
192 | controlPoint2X = 20.979; | 190 | controlPoint2X = 20.979; |
193 | controlPoint2Y = 37.344; | 191 | controlPoint2Y = 37.344; |
194 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 192 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
195 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 193 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
196 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 194 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
197 | pointX = 24.015; | 195 | pointX = 24.015; |
198 | pointY = 39.0; | 196 | pointY = 39.0; |
199 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 197 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
200 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 198 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
201 | controlPoint1X = 22.405; | 199 | controlPoint1X = 22.405; |
202 | controlPoint1Y = 38.77; | 200 | controlPoint1Y = 38.77; |
203 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 201 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
204 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 202 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
205 | controlPoint2X = 23.325; | 203 | controlPoint2X = 23.325; |
206 | controlPoint2Y = 39.0; | 204 | controlPoint2Y = 39.0; |
207 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 205 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
208 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 206 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
209 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 207 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
210 | pointX = 26.821; | 208 | pointX = 26.821; |
211 | pointY = 38.034; | 209 | pointY = 38.034; |
212 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 210 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
213 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 211 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
214 | controlPoint1X = 25.073; | 212 | controlPoint1X = 25.073; |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/info.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/info.js index fad5c10..2501992 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/info.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/info.js | |||
@@ -1,214 +1,212 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //info.js | 25 | //info.js |
28 | //i | 26 | //i |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/7/10 | 28 | //Created by Giulio Cesare Solaroli on 3/7/10 |
31 | //Copyright 2010 Clipperz | 29 | //Copyright 2010 Clipperz |
32 | //This code was generated by Opacity. You may use or modify it in any way. | 30 | //This code was generated by Opacity. You may use or modify it in any way. |
33 | // | 31 | // |
34 | 32 | ||
35 | var kClipperz_PM_UI_Canvas_Marks_infoWidth = 50.0; | 33 | var kClipperz_PM_UI_Canvas_Marks_infoWidth = 50.0; |
36 | var kClipperz_PM_UI_Canvas_Marks_infoHeight = 50.0; | 34 | var kClipperz_PM_UI_Canvas_Marks_infoHeight = 50.0; |
37 | 35 | ||
38 | function Clipperz_PM_UI_Canvas_Marks_info(canvas, aColor) | 36 | function Clipperz_PM_UI_Canvas_Marks_info(canvas, aColor) |
39 | { | 37 | { |
40 | var context = canvas.getContext("2d"); | 38 | var context = canvas.getContext("2d"); |
41 | var alignStroke; | 39 | var alignStroke; |
42 | var resolution; | 40 | var resolution; |
43 | var path; | 41 | var path; |
44 | var pointX; | 42 | var pointX; |
45 | var pointY; | 43 | var pointY; |
46 | var controlPoint1X; | 44 | var controlPoint1X; |
47 | var controlPoint1Y; | 45 | var controlPoint1Y; |
48 | var controlPoint2X; | 46 | var controlPoint2X; |
49 | var controlPoint2Y; | 47 | var controlPoint2Y; |
50 | var color; | 48 | var color; |
51 | if (window.devicePixelRatio) | 49 | if (window.devicePixelRatio) |
52 | resolution = window.devicePixelRatio; | 50 | resolution = window.devicePixelRatio; |
53 | else | 51 | else |
54 | resolution = 1.0; | 52 | resolution = 1.0; |
55 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Marks_infoWidth + canvas.height / kClipperz_PM_UI_Canvas_Marks_infoHeight); | 53 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Marks_infoWidth + canvas.height / kClipperz_PM_UI_Canvas_Marks_infoHeight); |
56 | 54 | ||
57 | context.save(); | 55 | context.save(); |
58 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Marks_infoWidth, canvas.height / kClipperz_PM_UI_Canvas_Marks_infoHeight); | 56 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Marks_infoWidth, canvas.height / kClipperz_PM_UI_Canvas_Marks_infoHeight); |
59 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Marks_infoWidth, kClipperz_PM_UI_Canvas_Marks_infoHeight); | 57 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Marks_infoWidth, kClipperz_PM_UI_Canvas_Marks_infoHeight); |
60 | 58 | ||
61 | // Layer 1 | 59 | // Layer 1 |
62 | 60 | ||
63 | alignStroke = 0.0; | 61 | alignStroke = 0.0; |
64 | context.beginPath(); | 62 | context.beginPath(); |
65 | pointX = 30.253; | 63 | pointX = 30.253; |
66 | pointY = 37.436; | 64 | pointY = 37.436; |
67 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 65 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
68 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 66 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
69 | context.moveTo(pointX, pointY); | 67 | context.moveTo(pointX, pointY); |
70 | pointX = 28.505; | 68 | pointX = 28.505; |
71 | pointY = 37.022; | 69 | pointY = 37.022; |
72 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 70 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
73 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 71 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
74 | context.lineTo(pointX, pointY); | 72 | context.lineTo(pointX, pointY); |
75 | pointX = 27.677; | 73 | pointX = 27.677; |
76 | pointY = 35.09; | 74 | pointY = 35.09; |
77 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 75 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
78 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 76 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
79 | controlPoint1X = 27.953; | 77 | controlPoint1X = 27.953; |
80 | controlPoint1Y = 36.792; | 78 | controlPoint1Y = 36.792; |
81 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 79 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
82 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 80 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
83 | controlPoint2X = 27.677; | 81 | controlPoint2X = 27.677; |
84 | controlPoint2Y = 36.47; | 82 | controlPoint2Y = 36.47; |
85 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 83 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
86 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 84 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
87 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 85 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
88 | pointX = 27.631; | 86 | pointX = 27.631; |
89 | pointY = 27.546; | 87 | pointY = 27.546; |
90 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 88 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
91 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 89 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
92 | controlPoint1X = 27.631; | 90 | controlPoint1X = 27.631; |
93 | controlPoint1Y = 32.974; | 91 | controlPoint1Y = 32.974; |
94 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 92 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
95 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 93 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
96 | controlPoint2X = 27.631; | 94 | controlPoint2X = 27.631; |
97 | controlPoint2Y = 29.892; | 95 | controlPoint2Y = 29.892; |
98 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 96 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
99 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 97 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
100 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 98 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
101 | pointX = 27.677; | 99 | pointX = 27.677; |
102 | pointY = 19.726; | 100 | pointY = 19.726; |
103 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 101 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
104 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 102 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
105 | controlPoint1X = 27.631; | 103 | controlPoint1X = 27.631; |
106 | controlPoint1Y = 24.97; | 104 | controlPoint1Y = 24.97; |
107 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 105 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
108 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 106 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
109 | controlPoint2X = 27.677; | 107 | controlPoint2X = 27.677; |
110 | controlPoint2Y = 21.612; | 108 | controlPoint2Y = 21.612; |
111 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 109 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
112 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 110 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
113 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 111 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
114 | pointX = 19.535; | 112 | pointX = 19.535; |
115 | pointY = 21.336; | 113 | pointY = 21.336; |
116 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 114 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
117 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 115 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
118 | controlPoint1X = 25.331; | 116 | controlPoint1X = 25.331; |
119 | controlPoint1Y = 20.692; | 117 | controlPoint1Y = 20.692; |
120 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 118 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
121 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 119 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
122 | controlPoint2X = 20.593; | 120 | controlPoint2X = 20.593; |
123 | controlPoint2Y = 21.336; | 121 | controlPoint2Y = 21.336; |
124 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 122 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
125 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 123 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
126 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 124 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
127 | pointX = 19.443; | 125 | pointX = 19.443; |
128 | pointY = 22.762; | 126 | pointY = 22.762; |
129 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 127 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
130 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 128 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
131 | controlPoint1X = 19.397; | 129 | controlPoint1X = 19.397; |
132 | controlPoint1Y = 21.52; | 130 | controlPoint1Y = 21.52; |
133 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 131 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
134 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 132 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
135 | controlPoint2X = 19.305; | 133 | controlPoint2X = 19.305; |
136 | controlPoint2Y = 22.532; | 134 | controlPoint2Y = 22.532; |
137 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 135 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
138 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 136 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
139 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 137 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
140 | pointX = 21.283; | 138 | pointX = 21.283; |
141 | pointY = 23.82; | 139 | pointY = 23.82; |
142 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 140 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
143 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 141 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
144 | controlPoint1X = 20.639; | 142 | controlPoint1X = 20.639; |
145 | controlPoint1Y = 23.222; | 143 | controlPoint1Y = 23.222; |
146 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 144 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
147 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 145 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
148 | controlPoint2X = 20.961; | 146 | controlPoint2X = 20.961; |
149 | controlPoint2Y = 23.452; | 147 | controlPoint2Y = 23.452; |
150 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 148 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
151 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 149 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
152 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 150 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
153 | pointX = 21.605; | 151 | pointX = 21.605; |
154 | pointY = 24.97; | 152 | pointY = 24.97; |
155 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 153 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
156 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 154 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
157 | controlPoint1X = 21.513; | 155 | controlPoint1X = 21.513; |
158 | controlPoint1Y = 24.05; | 156 | controlPoint1Y = 24.05; |
159 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 157 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
160 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 158 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
161 | controlPoint2X = 21.605; | 159 | controlPoint2X = 21.605; |
162 | controlPoint2Y = 24.602; | 160 | controlPoint2Y = 24.602; |
163 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 161 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
164 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 162 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
165 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 163 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
166 | pointX = 21.651; | 164 | pointX = 21.651; |
167 | pointY = 29.156; | 165 | pointY = 29.156; |
168 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 166 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
169 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 167 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
170 | controlPoint1X = 21.651; | 168 | controlPoint1X = 21.651; |
171 | controlPoint1Y = 25.752; | 169 | controlPoint1Y = 25.752; |
172 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 170 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
173 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 171 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
174 | controlPoint2X = 21.651; | 172 | controlPoint2X = 21.651; |
175 | controlPoint2Y = 27.592; | 173 | controlPoint2Y = 27.592; |
176 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 174 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
177 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 175 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
178 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 176 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
179 | pointX = 21.605; | 177 | pointX = 21.605; |
180 | pointY = 35.228; | 178 | pointY = 35.228; |
181 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 179 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
182 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 180 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
183 | controlPoint1X = 21.651; | 181 | controlPoint1X = 21.651; |
184 | controlPoint1Y = 31.364; | 182 | controlPoint1Y = 31.364; |
185 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 183 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
186 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 184 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
187 | controlPoint2X = 21.651; | 185 | controlPoint2X = 21.651; |
188 | controlPoint2Y = 34.216; | 186 | controlPoint2Y = 34.216; |
189 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 187 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
190 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 188 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
191 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 189 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
192 | pointX = 20.823; | 190 | pointX = 20.823; |
193 | pointY = 37.022; | 191 | pointY = 37.022; |
194 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 192 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
195 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 193 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
196 | controlPoint1X = 21.559; | 194 | controlPoint1X = 21.559; |
197 | controlPoint1Y = 36.332; | 195 | controlPoint1Y = 36.332; |
198 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 196 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
199 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 197 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
200 | controlPoint2X = 21.467; | 198 | controlPoint2X = 21.467; |
201 | controlPoint2Y = 36.838; | 199 | controlPoint2Y = 36.838; |
202 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 200 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
203 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 201 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
204 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 202 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
205 | pointX = 19.121; | 203 | pointX = 19.121; |
206 | pointY = 37.436; | 204 | pointY = 37.436; |
207 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 205 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
208 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 206 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
209 | controlPoint1X = 20.363; | 207 | controlPoint1X = 20.363; |
210 | controlPoint1Y = 37.206; | 208 | controlPoint1Y = 37.206; |
211 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 209 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
212 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 210 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
213 | controlPoint2X = 19.857; | 211 | controlPoint2X = 19.857; |
214 | controlPoint2Y = 37.298; | 212 | controlPoint2Y = 37.298; |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/questionMark.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/questionMark.js index 5842828..9a8ac7d 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/questionMark.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/questionMark.js | |||
@@ -1,214 +1,212 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //questionMark.js | 25 | //questionMark.js |
28 | //? | 26 | //? |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/7/10 | 28 | //Created by Giulio Cesare Solaroli on 3/7/10 |
31 | //Copyright 2010 Clipperz | 29 | //Copyright 2010 Clipperz |
32 | //This code was generated by Opacity. You may use or modify it in any way. | 30 | //This code was generated by Opacity. You may use or modify it in any way. |
33 | // | 31 | // |
34 | 32 | ||
35 | var kClipperz_PM_UI_Canvas_Marks_questionMarkWidth = 50.0; | 33 | var kClipperz_PM_UI_Canvas_Marks_questionMarkWidth = 50.0; |
36 | var kClipperz_PM_UI_Canvas_Marks_questionMarkHeight = 50.0; | 34 | var kClipperz_PM_UI_Canvas_Marks_questionMarkHeight = 50.0; |
37 | 35 | ||
38 | function Clipperz_PM_UI_Canvas_Marks_questionMark(canvas, aColor) | 36 | function Clipperz_PM_UI_Canvas_Marks_questionMark(canvas, aColor) |
39 | { | 37 | { |
40 | var context = canvas.getContext("2d"); | 38 | var context = canvas.getContext("2d"); |
41 | var alignStroke; | 39 | var alignStroke; |
42 | var resolution; | 40 | var resolution; |
43 | var path; | 41 | var path; |
44 | var pointX; | 42 | var pointX; |
45 | var pointY; | 43 | var pointY; |
46 | var controlPoint1X; | 44 | var controlPoint1X; |
47 | var controlPoint1Y; | 45 | var controlPoint1Y; |
48 | var controlPoint2X; | 46 | var controlPoint2X; |
49 | var controlPoint2Y; | 47 | var controlPoint2Y; |
50 | var color; | 48 | var color; |
51 | if (window.devicePixelRatio) | 49 | if (window.devicePixelRatio) |
52 | resolution = window.devicePixelRatio; | 50 | resolution = window.devicePixelRatio; |
53 | else | 51 | else |
54 | resolution = 1.0; | 52 | resolution = 1.0; |
55 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Marks_questionMarkWidth + canvas.height / kClipperz_PM_UI_Canvas_Marks_questionMarkHeight); | 53 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Marks_questionMarkWidth + canvas.height / kClipperz_PM_UI_Canvas_Marks_questionMarkHeight); |
56 | 54 | ||
57 | context.save(); | 55 | context.save(); |
58 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Marks_questionMarkWidth, canvas.height / kClipperz_PM_UI_Canvas_Marks_questionMarkHeight); | 56 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Marks_questionMarkWidth, canvas.height / kClipperz_PM_UI_Canvas_Marks_questionMarkHeight); |
59 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Marks_questionMarkWidth, kClipperz_PM_UI_Canvas_Marks_questionMarkHeight); | 57 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Marks_questionMarkWidth, kClipperz_PM_UI_Canvas_Marks_questionMarkHeight); |
60 | 58 | ||
61 | // Layer 1 | 59 | // Layer 1 |
62 | 60 | ||
63 | alignStroke = 0.0; | 61 | alignStroke = 0.0; |
64 | context.beginPath(); | 62 | context.beginPath(); |
65 | pointX = 24.118; | 63 | pointX = 24.118; |
66 | pointY = 24.464; | 64 | pointY = 24.464; |
67 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 65 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
68 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 66 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
69 | context.moveTo(pointX, pointY); | 67 | context.moveTo(pointX, pointY); |
70 | pointX = 24.854; | 68 | pointX = 24.854; |
71 | pointY = 23.406; | 69 | pointY = 23.406; |
72 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 70 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
73 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 71 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
74 | controlPoint1X = 24.118; | 72 | controlPoint1X = 24.118; |
75 | controlPoint1Y = 24.05; | 73 | controlPoint1Y = 24.05; |
76 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 74 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
77 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 75 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
78 | controlPoint2X = 24.44; | 76 | controlPoint2X = 24.44; |
79 | controlPoint2Y = 23.636; | 77 | controlPoint2Y = 23.636; |
80 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 78 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
81 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 79 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
82 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 80 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
83 | pointX = 29.454; | 81 | pointX = 29.454; |
84 | pointY = 20.6; | 82 | pointY = 20.6; |
85 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 83 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
86 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 84 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
87 | controlPoint1X = 26.418; | 85 | controlPoint1X = 26.418; |
88 | controlPoint1Y = 22.532; | 86 | controlPoint1Y = 22.532; |
89 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 87 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
90 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 88 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
91 | controlPoint2X = 28.534; | 89 | controlPoint2X = 28.534; |
92 | controlPoint2Y = 21.566; | 90 | controlPoint2Y = 21.566; |
93 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 91 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
94 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 92 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
95 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 93 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
96 | pointX = 30.282; | 94 | pointX = 30.282; |
97 | pointY = 17.794; | 95 | pointY = 17.794; |
98 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 96 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
99 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 97 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
100 | controlPoint1X = 29.868; | 98 | controlPoint1X = 29.868; |
101 | controlPoint1Y = 20.232; | 99 | controlPoint1Y = 20.232; |
102 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 100 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
103 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 101 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
104 | controlPoint2X = 30.282; | 102 | controlPoint2X = 30.282; |
105 | controlPoint2Y = 19.082; | 103 | controlPoint2Y = 19.082; |
106 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 104 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
107 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 105 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
108 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 106 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
109 | pointX = 27.2; | 107 | pointX = 27.2; |
110 | pointY = 12.688; | 108 | pointY = 12.688; |
111 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 109 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
112 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 110 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
113 | controlPoint1X = 30.282; | 111 | controlPoint1X = 30.282; |
114 | controlPoint1Y = 16.322; | 112 | controlPoint1Y = 16.322; |
115 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 113 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
116 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 114 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
117 | controlPoint2X = 29.454; | 115 | controlPoint2X = 29.454; |
118 | controlPoint2Y = 14.344; | 116 | controlPoint2Y = 14.344; |
119 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 117 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
120 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 118 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
121 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 119 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
122 | pointX = 21.312; | 120 | pointX = 21.312; |
123 | pointY = 10.664; | 121 | pointY = 10.664; |
124 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 122 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
125 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 123 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
126 | controlPoint1X = 25.636; | 124 | controlPoint1X = 25.636; |
127 | controlPoint1Y = 11.492; | 125 | controlPoint1Y = 11.492; |
128 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 126 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
129 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 127 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
130 | controlPoint2X = 23.382; | 128 | controlPoint2X = 23.382; |
131 | controlPoint2Y = 10.664; | 129 | controlPoint2Y = 10.664; |
132 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 130 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
133 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 131 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
134 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 132 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
135 | pointX = 19.886; | 133 | pointX = 19.886; |
136 | pointY = 11.124; | 134 | pointY = 11.124; |
137 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 135 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
138 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 136 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
139 | controlPoint1X = 20.898; | 137 | controlPoint1X = 20.898; |
140 | controlPoint1Y = 10.664; | 138 | controlPoint1Y = 10.664; |
141 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 139 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
142 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 140 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
143 | controlPoint2X = 20.162; | 141 | controlPoint2X = 20.162; |
144 | controlPoint2Y = 10.894; | 142 | controlPoint2Y = 10.894; |
145 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 143 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
146 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 144 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
147 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 145 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
148 | pointX = 18.0; | 146 | pointX = 18.0; |
149 | pointY = 14.666; | 147 | pointY = 14.666; |
150 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 148 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
151 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 149 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
152 | controlPoint1X = 19.104; | 150 | controlPoint1X = 19.104; |
153 | controlPoint1Y = 11.676; | 151 | controlPoint1Y = 11.676; |
154 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 152 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
155 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 153 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
156 | controlPoint2X = 18.0; | 154 | controlPoint2X = 18.0; |
157 | controlPoint2Y = 14.068; | 155 | controlPoint2Y = 14.068; |
158 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 156 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
159 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 157 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
160 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 158 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
161 | pointX = 18.598; | 159 | pointX = 18.598; |
162 | pointY = 15.586; | 160 | pointY = 15.586; |
163 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 161 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
164 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 162 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
165 | controlPoint1X = 18.0; | 163 | controlPoint1X = 18.0; |
166 | controlPoint1Y = 14.896; | 164 | controlPoint1Y = 14.896; |
167 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 165 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
168 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 166 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
169 | controlPoint2X = 18.138; | 167 | controlPoint2X = 18.138; |
170 | controlPoint2Y = 15.494; | 168 | controlPoint2Y = 15.494; |
171 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 169 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
172 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 170 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
173 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 171 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
174 | pointX = 19.794; | 172 | pointX = 19.794; |
175 | pointY = 15.908; | 173 | pointY = 15.908; |
176 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 174 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
177 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 175 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
178 | controlPoint1X = 19.012; | 176 | controlPoint1X = 19.012; |
179 | controlPoint1Y = 15.678; | 177 | controlPoint1Y = 15.678; |
180 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 178 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
181 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 179 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
182 | controlPoint2X = 19.426; | 180 | controlPoint2X = 19.426; |
183 | controlPoint2Y = 15.77; | 181 | controlPoint2Y = 15.77; |
184 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 182 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
185 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 183 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
186 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 184 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
187 | pointX = 25.36; | 185 | pointX = 25.36; |
188 | pointY = 20.002; | 186 | pointY = 20.002; |
189 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 187 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
190 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 188 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
191 | controlPoint1X = 22.508; | 189 | controlPoint1X = 22.508; |
192 | controlPoint1Y = 16.644; | 190 | controlPoint1Y = 16.644; |
193 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 191 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
194 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 192 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
195 | controlPoint2X = 25.36; | 193 | controlPoint2X = 25.36; |
196 | controlPoint2Y = 17.886; | 194 | controlPoint2Y = 17.886; |
197 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 195 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
198 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 196 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
199 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 197 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
200 | pointX = 24.21; | 198 | pointX = 24.21; |
201 | pointY = 21.704; | 199 | pointY = 21.704; |
202 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 200 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
203 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 201 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
204 | controlPoint1X = 25.36; | 202 | controlPoint1X = 25.36; |
205 | controlPoint1Y = 20.738; | 203 | controlPoint1Y = 20.738; |
206 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 204 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
207 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 205 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
208 | controlPoint2X = 25.084; | 206 | controlPoint2X = 25.084; |
209 | controlPoint2Y = 21.198; | 207 | controlPoint2Y = 21.198; |
210 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 208 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
211 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 209 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
212 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 210 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
213 | pointX = 19.058; | 211 | pointX = 19.058; |
214 | pointY = 24.326; | 212 | pointY = 24.326; |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/RegisterButton/normal.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/RegisterButton/normal.js index 2462d0e..65e5ca6 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/RegisterButton/normal.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/RegisterButton/normal.js | |||
@@ -1,214 +1,212 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //normal.js | 25 | //normal.js |
28 | //normal | 26 | //normal |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/24/10 | 28 | //Created by Giulio Cesare Solaroli on 3/24/10 |
31 | //Copyright 2010 Clipperz | 29 | //Copyright 2010 Clipperz |
32 | //This code was generated by Opacity. You may use or modify it in any way. | 30 | //This code was generated by Opacity. You may use or modify it in any way. |
33 | // | 31 | // |
34 | 32 | ||
35 | var kClipperz_PM_UI_Canvas_RegisterButton_normalWidth = 282.0; | 33 | var kClipperz_PM_UI_Canvas_RegisterButton_normalWidth = 282.0; |
36 | var kClipperz_PM_UI_Canvas_RegisterButton_normalHeight = 93.0; | 34 | var kClipperz_PM_UI_Canvas_RegisterButton_normalHeight = 93.0; |
37 | 35 | ||
38 | function Clipperz_PM_UI_Canvas_RegisterButton_normal(canvas, aBackgroundColor, aDarkBackgroundColor, aLightColor, aDarkColor, aStarColor) | 36 | function Clipperz_PM_UI_Canvas_RegisterButton_normal(canvas, aBackgroundColor, aDarkBackgroundColor, aLightColor, aDarkColor, aStarColor) |
39 | { | 37 | { |
40 | var context = canvas.getContext("2d"); | 38 | var context = canvas.getContext("2d"); |
41 | var alignStroke; | 39 | var alignStroke; |
42 | var resolution; | 40 | var resolution; |
43 | var path; | 41 | var path; |
44 | var pointX; | 42 | var pointX; |
45 | var pointY; | 43 | var pointY; |
46 | var controlPoint1X; | 44 | var controlPoint1X; |
47 | var controlPoint1Y; | 45 | var controlPoint1Y; |
48 | var controlPoint2X; | 46 | var controlPoint2X; |
49 | var controlPoint2Y; | 47 | var controlPoint2Y; |
50 | var gradient; | 48 | var gradient; |
51 | var color; | 49 | var color; |
52 | if (window.devicePixelRatio) | 50 | if (window.devicePixelRatio) |
53 | resolution = window.devicePixelRatio; | 51 | resolution = window.devicePixelRatio; |
54 | else | 52 | else |
55 | resolution = 1.0; | 53 | resolution = 1.0; |
56 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_RegisterButton_normalWidth + canvas.height / kClipperz_PM_UI_Canvas_RegisterButton_normalHeight); | 54 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_RegisterButton_normalWidth + canvas.height / kClipperz_PM_UI_Canvas_RegisterButton_normalHeight); |
57 | 55 | ||
58 | context.save(); | 56 | context.save(); |
59 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_RegisterButton_normalWidth, canvas.height / kClipperz_PM_UI_Canvas_RegisterButton_normalHeight); | 57 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_RegisterButton_normalWidth, canvas.height / kClipperz_PM_UI_Canvas_RegisterButton_normalHeight); |
60 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_RegisterButton_normalWidth, kClipperz_PM_UI_Canvas_RegisterButton_normalHeight); | 58 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_RegisterButton_normalWidth, kClipperz_PM_UI_Canvas_RegisterButton_normalHeight); |
61 | 59 | ||
62 | // background | 60 | // background |
63 | 61 | ||
64 | alignStroke = 0.0; | 62 | alignStroke = 0.0; |
65 | context.beginPath(); | 63 | context.beginPath(); |
66 | pointX = 241.0; | 64 | pointX = 241.0; |
67 | pointY = 80.0; | 65 | pointY = 80.0; |
68 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 66 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
69 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 67 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
70 | context.moveTo(pointX, pointY); | 68 | context.moveTo(pointX, pointY); |
71 | pointX = 274.0; | 69 | pointX = 274.0; |
72 | pointY = 47.0; | 70 | pointY = 47.0; |
73 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 71 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
74 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 72 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
75 | controlPoint1X = 259.103; | 73 | controlPoint1X = 259.103; |
76 | controlPoint1Y = 80.0; | 74 | controlPoint1Y = 80.0; |
77 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 75 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
78 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 76 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
79 | controlPoint2X = 274.0; | 77 | controlPoint2X = 274.0; |
80 | controlPoint2Y = 65.103; | 78 | controlPoint2Y = 65.103; |
81 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 79 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
82 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 80 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
83 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 81 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
84 | pointX = 274.0; | 82 | pointX = 274.0; |
85 | pointY = 45.0; | 83 | pointY = 45.0; |
86 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 84 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
87 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 85 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
88 | context.lineTo(pointX, pointY); | 86 | context.lineTo(pointX, pointY); |
89 | pointX = 241.0; | 87 | pointX = 241.0; |
90 | pointY = 12.0; | 88 | pointY = 12.0; |
91 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 89 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
92 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 90 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
93 | controlPoint1X = 274.0; | 91 | controlPoint1X = 274.0; |
94 | controlPoint1Y = 26.897; | 92 | controlPoint1Y = 26.897; |
95 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 93 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
96 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 94 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
97 | controlPoint2X = 259.103; | 95 | controlPoint2X = 259.103; |
98 | controlPoint2Y = 12.0; | 96 | controlPoint2Y = 12.0; |
99 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 97 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
100 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 98 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
101 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 99 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
102 | pointX = 60.0; | 100 | pointX = 60.0; |
103 | pointY = 12.0; | 101 | pointY = 12.0; |
104 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 102 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
105 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 103 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
106 | context.lineTo(pointX, pointY); | 104 | context.lineTo(pointX, pointY); |
107 | pointX = 27.0; | 105 | pointX = 27.0; |
108 | pointY = 45.0; | 106 | pointY = 45.0; |
109 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 107 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
110 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 108 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
111 | controlPoint1X = 41.897; | 109 | controlPoint1X = 41.897; |
112 | controlPoint1Y = 12.0; | 110 | controlPoint1Y = 12.0; |
113 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 111 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
114 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 112 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
115 | controlPoint2X = 27.0; | 113 | controlPoint2X = 27.0; |
116 | controlPoint2Y = 26.897; | 114 | controlPoint2Y = 26.897; |
117 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 115 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
118 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 116 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
119 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 117 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
120 | pointX = 27.0; | 118 | pointX = 27.0; |
121 | pointY = 47.0; | 119 | pointY = 47.0; |
122 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 120 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
123 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 121 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
124 | context.lineTo(pointX, pointY); | 122 | context.lineTo(pointX, pointY); |
125 | pointX = 60.0; | 123 | pointX = 60.0; |
126 | pointY = 80.0; | 124 | pointY = 80.0; |
127 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 125 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
128 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 126 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
129 | controlPoint1X = 27.0; | 127 | controlPoint1X = 27.0; |
130 | controlPoint1Y = 65.103; | 128 | controlPoint1Y = 65.103; |
131 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 129 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
132 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 130 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
133 | controlPoint2X = 41.897; | 131 | controlPoint2X = 41.897; |
134 | controlPoint2Y = 80.0; | 132 | controlPoint2Y = 80.0; |
135 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 133 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
136 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 134 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
137 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 135 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
138 | pointX = 241.0; | 136 | pointX = 241.0; |
139 | pointY = 80.0; | 137 | pointY = 80.0; |
140 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 138 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
141 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 139 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
142 | context.lineTo(pointX, pointY); | 140 | context.lineTo(pointX, pointY); |
143 | context.closePath(); | 141 | context.closePath(); |
144 | gradient = context.createLinearGradient(150.5, 12.0, 150.5, 80.0); | 142 | gradient = context.createLinearGradient(150.5, 12.0, 150.5, 80.0); |
145 | gradient.addColorStop(0.0, aBackgroundColor); | 143 | gradient.addColorStop(0.0, aBackgroundColor); |
146 | gradient.addColorStop(1.0, aDarkBackgroundColor); | 144 | gradient.addColorStop(1.0, aDarkBackgroundColor); |
147 | context.fillStyle = gradient; | 145 | context.fillStyle = gradient; |
148 | context.fill(); | 146 | context.fill(); |
149 | 147 | ||
150 | // round | 148 | // round |
151 | 149 | ||
152 | alignStroke = 0.0; | 150 | alignStroke = 0.0; |
153 | context.beginPath(); | 151 | context.beginPath(); |
154 | pointX = 44.103; | 152 | pointX = 44.103; |
155 | pointY = 4.014; | 153 | pointY = 4.014; |
156 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 154 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
157 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 155 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
158 | context.moveTo(pointX, pointY); | 156 | context.moveTo(pointX, pointY); |
159 | pointX = 65.629; | 157 | pointX = 65.629; |
160 | pointY = 10.515; | 158 | pointY = 10.515; |
161 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 159 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
162 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 160 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
163 | controlPoint1X = 51.706; | 161 | controlPoint1X = 51.706; |
164 | controlPoint1Y = 4.217; | 162 | controlPoint1Y = 4.217; |
165 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 163 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
166 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 164 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
167 | controlPoint2X = 59.185; | 165 | controlPoint2X = 59.185; |
168 | controlPoint2Y = 6.475; | 166 | controlPoint2Y = 6.475; |
169 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 167 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
170 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 168 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
171 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 169 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
172 | pointX = 78.65; | 170 | pointX = 78.65; |
173 | pointY = 70.918; | 171 | pointY = 70.918; |
174 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 172 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
175 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 173 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
176 | context.lineTo(pointX, pointY); | 174 | context.lineTo(pointX, pointY); |
177 | pointX = 43.0; | 175 | pointX = 43.0; |
178 | pointY = 90.0; | 176 | pointY = 90.0; |
179 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 177 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
180 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 178 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
181 | controlPoint1X = 70.676; | 179 | controlPoint1X = 70.676; |
182 | controlPoint1Y = 82.788; | 180 | controlPoint1Y = 82.788; |
183 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 181 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
184 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 182 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
185 | controlPoint2X = 57.23; | 183 | controlPoint2X = 57.23; |
186 | controlPoint2Y = 89.817; | 184 | controlPoint2Y = 89.817; |
187 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 185 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
188 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 186 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
189 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 187 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
190 | pointX = 0.056; | 188 | pointX = 0.056; |
191 | pointY = 44.801; | 189 | pointY = 44.801; |
192 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 190 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
193 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 191 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
194 | controlPoint1X = 18.834; | 192 | controlPoint1X = 18.834; |
195 | controlPoint1Y = 90.07; | 193 | controlPoint1Y = 90.07; |
196 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 194 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
197 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 195 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
198 | controlPoint2X = -1.18; | 196 | controlPoint2X = -1.18; |
199 | controlPoint2Y = 68.879; | 197 | controlPoint2Y = 68.879; |
200 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 198 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
201 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 199 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
202 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 200 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
203 | pointX = 44.103; | 201 | pointX = 44.103; |
204 | pointY = 4.014; | 202 | pointY = 4.014; |
205 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 203 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
206 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 204 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
207 | controlPoint1X = 1.242; | 205 | controlPoint1X = 1.242; |
208 | controlPoint1Y = 21.708; | 206 | controlPoint1Y = 21.708; |
209 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 207 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
210 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 208 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
211 | controlPoint2X = 21.202; | 209 | controlPoint2X = 21.202; |
212 | controlPoint2Y = 3.72; | 210 | controlPoint2Y = 3.72; |
213 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 211 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
214 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 212 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Star/normal.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Star/normal.js index cf475c6..5b344ef 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Star/normal.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Star/normal.js | |||
@@ -1,150 +1,148 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //normal.js | 25 | //normal.js |
28 | //normal | 26 | //normal |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/15/10 | 28 | //Created by Giulio Cesare Solaroli on 3/15/10 |
31 | //Copyright 2010 Clipperz | 29 | //Copyright 2010 Clipperz |
32 | //This code was generated by Opacity. You may use or modify it in any way. | 30 | //This code was generated by Opacity. You may use or modify it in any way. |
33 | // | 31 | // |
34 | 32 | ||
35 | var kClipperz_PM_UI_Canvas_Star_normalWidth = 46.0; | 33 | var kClipperz_PM_UI_Canvas_Star_normalWidth = 46.0; |
36 | var kClipperz_PM_UI_Canvas_Star_normalHeight = 46.0; | 34 | var kClipperz_PM_UI_Canvas_Star_normalHeight = 46.0; |
37 | 35 | ||
38 | function Clipperz_PM_UI_Canvas_Star_normal(canvas, aColor) | 36 | function Clipperz_PM_UI_Canvas_Star_normal(canvas, aColor) |
39 | { | 37 | { |
40 | var context = canvas.getContext("2d"); | 38 | var context = canvas.getContext("2d"); |
41 | var alignStroke; | 39 | var alignStroke; |
42 | var resolution; | 40 | var resolution; |
43 | var path; | 41 | var path; |
44 | var pointX; | 42 | var pointX; |
45 | var pointY; | 43 | var pointY; |
46 | if (window.devicePixelRatio) | 44 | if (window.devicePixelRatio) |
47 | resolution = window.devicePixelRatio; | 45 | resolution = window.devicePixelRatio; |
48 | else | 46 | else |
49 | resolution = 1.0; | 47 | resolution = 1.0; |
50 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Star_normalWidth + canvas.height / kClipperz_PM_UI_Canvas_Star_normalHeight); | 48 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Star_normalWidth + canvas.height / kClipperz_PM_UI_Canvas_Star_normalHeight); |
51 | 49 | ||
52 | context.save(); | 50 | context.save(); |
53 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Star_normalWidth, canvas.height / kClipperz_PM_UI_Canvas_Star_normalHeight); | 51 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Star_normalWidth, canvas.height / kClipperz_PM_UI_Canvas_Star_normalHeight); |
54 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Star_normalWidth, kClipperz_PM_UI_Canvas_Star_normalHeight); | 52 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Star_normalWidth, kClipperz_PM_UI_Canvas_Star_normalHeight); |
55 | 53 | ||
56 | // * | 54 | // * |
57 | 55 | ||
58 | alignStroke = 0.0; | 56 | alignStroke = 0.0; |
59 | context.beginPath(); | 57 | context.beginPath(); |
60 | pointX = 8.613; | 58 | pointX = 8.613; |
61 | pointY = 15.583; | 59 | pointY = 15.583; |
62 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 60 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
63 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 61 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
64 | context.moveTo(pointX, pointY); | 62 | context.moveTo(pointX, pointY); |
65 | pointX = 18.563; | 63 | pointX = 18.563; |
66 | pointY = 18.821; | 64 | pointY = 18.821; |
67 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 65 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
68 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 66 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
69 | context.lineTo(pointX, pointY); | 67 | context.lineTo(pointX, pointY); |
70 | pointX = 18.563; | 68 | pointX = 18.563; |
71 | pointY = 7.347; | 69 | pointY = 7.347; |
72 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 70 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
73 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 71 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
74 | context.lineTo(pointX, pointY); | 72 | context.lineTo(pointX, pointY); |
75 | pointX = 26.799; | 73 | pointX = 26.799; |
76 | pointY = 7.347; | 74 | pointY = 7.347; |
77 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 75 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
78 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 76 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
79 | context.lineTo(pointX, pointY); | 77 | context.lineTo(pointX, pointY); |
80 | pointX = 26.799; | 78 | pointX = 26.799; |
81 | pointY = 18.821; | 79 | pointY = 18.821; |
82 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 80 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
83 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 81 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
84 | context.lineTo(pointX, pointY); | 82 | context.lineTo(pointX, pointY); |
85 | pointX = 36.749; | 83 | pointX = 36.749; |
86 | pointY = 15.583; | 84 | pointY = 15.583; |
87 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 85 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
88 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 86 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
89 | context.lineTo(pointX, pointY); | 87 | context.lineTo(pointX, pointY); |
90 | pointX = 38.986; | 88 | pointX = 38.986; |
91 | pointY = 22.677; | 89 | pointY = 22.677; |
92 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 90 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
93 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 91 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
94 | context.lineTo(pointX, pointY); | 92 | context.lineTo(pointX, pointY); |
95 | pointX = 28.846; | 93 | pointX = 28.846; |
96 | pointY = 25.819; | 94 | pointY = 25.819; |
97 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 95 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
98 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 96 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
99 | context.lineTo(pointX, pointY); | 97 | context.lineTo(pointX, pointY); |
100 | pointX = 35.463; | 98 | pointX = 35.463; |
101 | pointY = 35.293; | 99 | pointY = 35.293; |
102 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 100 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
103 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 101 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
104 | context.lineTo(pointX, pointY); | 102 | context.lineTo(pointX, pointY); |
105 | pointX = 29.369; | 103 | pointX = 29.369; |
106 | pointY = 39.625; | 104 | pointY = 39.625; |
107 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 105 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
108 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 106 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
109 | context.lineTo(pointX, pointY); | 107 | context.lineTo(pointX, pointY); |
110 | pointX = 22.752; | 108 | pointX = 22.752; |
111 | pointY = 30.675; | 109 | pointY = 30.675; |
112 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 110 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
113 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 111 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
114 | context.lineTo(pointX, pointY); | 112 | context.lineTo(pointX, pointY); |
115 | pointX = 15.944; | 113 | pointX = 15.944; |
116 | pointY = 39.625; | 114 | pointY = 39.625; |
117 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 115 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
118 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 116 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
119 | context.lineTo(pointX, pointY); | 117 | context.lineTo(pointX, pointY); |
120 | pointX = 9.85; | 118 | pointX = 9.85; |
121 | pointY = 35.293; | 119 | pointY = 35.293; |
122 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 120 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
123 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 121 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
124 | context.lineTo(pointX, pointY); | 122 | context.lineTo(pointX, pointY); |
125 | pointX = 16.515; | 123 | pointX = 16.515; |
126 | pointY = 25.819; | 124 | pointY = 25.819; |
127 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 125 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
128 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 126 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
129 | context.lineTo(pointX, pointY); | 127 | context.lineTo(pointX, pointY); |
130 | pointX = 6.375; | 128 | pointX = 6.375; |
131 | pointY = 22.677; | 129 | pointY = 22.677; |
132 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 130 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
133 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 131 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
134 | context.lineTo(pointX, pointY); | 132 | context.lineTo(pointX, pointY); |
135 | pointX = 8.613; | 133 | pointX = 8.613; |
136 | pointY = 15.583; | 134 | pointY = 15.583; |
137 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 135 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
138 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 136 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
139 | context.lineTo(pointX, pointY); | 137 | context.lineTo(pointX, pointY); |
140 | context.closePath(); | 138 | context.closePath(); |
141 | pointX = 42.081; | 139 | pointX = 42.081; |
142 | pointY = 77.949; | 140 | pointY = 77.949; |
143 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 141 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
144 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 142 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
145 | context.moveTo(pointX, pointY); | 143 | context.moveTo(pointX, pointY); |
146 | context.fillStyle = aColor; | 144 | context.fillStyle = aColor; |
147 | context.fill(); | 145 | context.fill(); |
148 | 146 | ||
149 | context.restore(); | 147 | context.restore(); |
150 | } | 148 | } |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/close.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/close.js index cd7ed90..21dfcc0 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/close.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/close.js | |||
@@ -1,153 +1,151 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //close.js | 25 | //close.js |
28 | //close | 26 | //close |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/14/10 | 28 | //Created by Giulio Cesare Solaroli on 3/14/10 |
31 | //Copyright 2010 Clipperz | 29 | //Copyright 2010 Clipperz |
32 | //This code was generated by Opacity. You may use or modify it in any way. | 30 | //This code was generated by Opacity. You may use or modify it in any way. |
33 | // | 31 | // |
34 | 32 | ||
35 | var kClipperz_PM_UI_Canvas_Tips_closeWidth = 310.0; | 33 | var kClipperz_PM_UI_Canvas_Tips_closeWidth = 310.0; |
36 | var kClipperz_PM_UI_Canvas_Tips_closeHeight = 6.0; | 34 | var kClipperz_PM_UI_Canvas_Tips_closeHeight = 6.0; |
37 | 35 | ||
38 | function Clipperz_PM_UI_Canvas_Tips_close(canvas, aColor, aBackgroundColor) | 36 | function Clipperz_PM_UI_Canvas_Tips_close(canvas, aColor, aBackgroundColor) |
39 | { | 37 | { |
40 | var context = canvas.getContext("2d"); | 38 | var context = canvas.getContext("2d"); |
41 | var alignStroke; | 39 | var alignStroke; |
42 | var resolution; | 40 | var resolution; |
43 | var path; | 41 | var path; |
44 | var pointX; | 42 | var pointX; |
45 | var pointY; | 43 | var pointY; |
46 | if (window.devicePixelRatio) | 44 | if (window.devicePixelRatio) |
47 | resolution = window.devicePixelRatio; | 45 | resolution = window.devicePixelRatio; |
48 | else | 46 | else |
49 | resolution = 1.0; | 47 | resolution = 1.0; |
50 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Tips_closeWidth + canvas.height / kClipperz_PM_UI_Canvas_Tips_closeHeight); | 48 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Tips_closeWidth + canvas.height / kClipperz_PM_UI_Canvas_Tips_closeHeight); |
51 | 49 | ||
52 | context.save(); | 50 | context.save(); |
53 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Tips_closeWidth, canvas.height / kClipperz_PM_UI_Canvas_Tips_closeHeight); | 51 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Tips_closeWidth, canvas.height / kClipperz_PM_UI_Canvas_Tips_closeHeight); |
54 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Tips_closeWidth, kClipperz_PM_UI_Canvas_Tips_closeHeight); | 52 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Tips_closeWidth, kClipperz_PM_UI_Canvas_Tips_closeHeight); |
55 | 53 | ||
56 | // background | 54 | // background |
57 | 55 | ||
58 | alignStroke = 0.0; | 56 | alignStroke = 0.0; |
59 | context.beginPath(); | 57 | context.beginPath(); |
60 | pointX = 310.0; | 58 | pointX = 310.0; |
61 | pointY = 6.0; | 59 | pointY = 6.0; |
62 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 60 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
63 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 61 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
64 | context.moveTo(pointX, pointY); | 62 | context.moveTo(pointX, pointY); |
65 | pointX = 310.0; | 63 | pointX = 310.0; |
66 | pointY = 0.0; | 64 | pointY = 0.0; |
67 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 65 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
68 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 66 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
69 | context.lineTo(pointX, pointY); | 67 | context.lineTo(pointX, pointY); |
70 | pointX = 0.0; | 68 | pointX = 0.0; |
71 | pointY = 0.0; | 69 | pointY = 0.0; |
72 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 70 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
73 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 71 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
74 | context.lineTo(pointX, pointY); | 72 | context.lineTo(pointX, pointY); |
75 | pointX = 0.0; | 73 | pointX = 0.0; |
76 | pointY = 6.0; | 74 | pointY = 6.0; |
77 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 75 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
78 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 76 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
79 | context.lineTo(pointX, pointY); | 77 | context.lineTo(pointX, pointY); |
80 | pointX = 310.0; | 78 | pointX = 310.0; |
81 | pointY = 6.0; | 79 | pointY = 6.0; |
82 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 80 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
83 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 81 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
84 | context.lineTo(pointX, pointY); | 82 | context.lineTo(pointX, pointY); |
85 | context.closePath(); | 83 | context.closePath(); |
86 | context.fillStyle = aBackgroundColor; | 84 | context.fillStyle = aBackgroundColor; |
87 | context.fill(); | 85 | context.fill(); |
88 | 86 | ||
89 | // grid | 87 | // grid |
90 | 88 | ||
91 | // background | 89 | // background |
92 | 90 | ||
93 | alignStroke = 0.0; | 91 | alignStroke = 0.0; |
94 | context.beginPath(); | 92 | context.beginPath(); |
95 | pointX = 310.0; | 93 | pointX = 310.0; |
96 | pointY = 6.0; | 94 | pointY = 6.0; |
97 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 95 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
98 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 96 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
99 | context.moveTo(pointX, pointY); | 97 | context.moveTo(pointX, pointY); |
100 | pointX = 310.0; | 98 | pointX = 310.0; |
101 | pointY = 0.0; | 99 | pointY = 0.0; |
102 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 100 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
103 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 101 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
104 | context.lineTo(pointX, pointY); | 102 | context.lineTo(pointX, pointY); |
105 | pointX = 0.0; | 103 | pointX = 0.0; |
106 | pointY = 0.0; | 104 | pointY = 0.0; |
107 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 105 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
108 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 106 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
109 | context.lineTo(pointX, pointY); | 107 | context.lineTo(pointX, pointY); |
110 | pointX = 0.0; | 108 | pointX = 0.0; |
111 | pointY = 6.0; | 109 | pointY = 6.0; |
112 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 110 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
113 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 111 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
114 | context.lineTo(pointX, pointY); | 112 | context.lineTo(pointX, pointY); |
115 | pointX = 310.0; | 113 | pointX = 310.0; |
116 | pointY = 6.0; | 114 | pointY = 6.0; |
117 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 115 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
118 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 116 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
119 | context.lineTo(pointX, pointY); | 117 | context.lineTo(pointX, pointY); |
120 | context.closePath(); | 118 | context.closePath(); |
121 | context.fillStyle = aBackgroundColor; | 119 | context.fillStyle = aBackgroundColor; |
122 | context.fill(); | 120 | context.fill(); |
123 | 121 | ||
124 | // toggle | 122 | // toggle |
125 | 123 | ||
126 | alignStroke = 0.0; | 124 | alignStroke = 0.0; |
127 | context.beginPath(); | 125 | context.beginPath(); |
128 | pointX = 149.0; | 126 | pointX = 149.0; |
129 | pointY = 6.0; | 127 | pointY = 6.0; |
130 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 128 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
131 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 129 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
132 | context.moveTo(pointX, pointY); | 130 | context.moveTo(pointX, pointY); |
133 | pointX = 161.0; | 131 | pointX = 161.0; |
134 | pointY = 6.0; | 132 | pointY = 6.0; |
135 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 133 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
136 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 134 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
137 | context.lineTo(pointX, pointY); | 135 | context.lineTo(pointX, pointY); |
138 | pointX = 155.0; | 136 | pointX = 155.0; |
139 | pointY = 0.0; | 137 | pointY = 0.0; |
140 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 138 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
141 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 139 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
142 | context.lineTo(pointX, pointY); | 140 | context.lineTo(pointX, pointY); |
143 | pointX = 149.0; | 141 | pointX = 149.0; |
144 | pointY = 6.0; | 142 | pointY = 6.0; |
145 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 143 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
146 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 144 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
147 | context.lineTo(pointX, pointY); | 145 | context.lineTo(pointX, pointY); |
148 | context.closePath(); | 146 | context.closePath(); |
149 | context.fillStyle = aColor; | 147 | context.fillStyle = aColor; |
150 | context.fill(); | 148 | context.fill(); |
151 | 149 | ||
152 | context.restore(); | 150 | context.restore(); |
153 | } | 151 | } |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/open.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/open.js index 30c1c69..9c76865 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/open.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/open.js | |||
@@ -1,160 +1,158 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //open.js | 25 | //open.js |
28 | //open | 26 | //open |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/14/10 | 28 | //Created by Giulio Cesare Solaroli on 3/14/10 |
31 | //Copyright 2010 Clipperz | 29 | //Copyright 2010 Clipperz |
32 | //This code was generated by Opacity. You may use or modify it in any way. | 30 | //This code was generated by Opacity. You may use or modify it in any way. |
33 | // | 31 | // |
34 | 32 | ||
35 | var kClipperz_PM_UI_Canvas_Tips_openWidth = 310.0; | 33 | var kClipperz_PM_UI_Canvas_Tips_openWidth = 310.0; |
36 | var kClipperz_PM_UI_Canvas_Tips_openHeight = 6.0; | 34 | var kClipperz_PM_UI_Canvas_Tips_openHeight = 6.0; |
37 | 35 | ||
38 | function Clipperz_PM_UI_Canvas_Tips_open(canvas, aColor, aBackgroundColor) | 36 | function Clipperz_PM_UI_Canvas_Tips_open(canvas, aColor, aBackgroundColor) |
39 | { | 37 | { |
40 | var context = canvas.getContext("2d"); | 38 | var context = canvas.getContext("2d"); |
41 | var alignStroke; | 39 | var alignStroke; |
42 | var resolution; | 40 | var resolution; |
43 | var path; | 41 | var path; |
44 | var pointX; | 42 | var pointX; |
45 | var pointY; | 43 | var pointY; |
46 | var color; | 44 | var color; |
47 | if (window.devicePixelRatio) | 45 | if (window.devicePixelRatio) |
48 | resolution = window.devicePixelRatio; | 46 | resolution = window.devicePixelRatio; |
49 | else | 47 | else |
50 | resolution = 1.0; | 48 | resolution = 1.0; |
51 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Tips_openWidth + canvas.height / kClipperz_PM_UI_Canvas_Tips_openHeight); | 49 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Tips_openWidth + canvas.height / kClipperz_PM_UI_Canvas_Tips_openHeight); |
52 | 50 | ||
53 | context.save(); | 51 | context.save(); |
54 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Tips_openWidth, canvas.height / kClipperz_PM_UI_Canvas_Tips_openHeight); | 52 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Tips_openWidth, canvas.height / kClipperz_PM_UI_Canvas_Tips_openHeight); |
55 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Tips_openWidth, kClipperz_PM_UI_Canvas_Tips_openHeight); | 53 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Tips_openWidth, kClipperz_PM_UI_Canvas_Tips_openHeight); |
56 | 54 | ||
57 | // background | 55 | // background |
58 | 56 | ||
59 | alignStroke = 0.0; | 57 | alignStroke = 0.0; |
60 | context.beginPath(); | 58 | context.beginPath(); |
61 | pointX = 310.0; | 59 | pointX = 310.0; |
62 | pointY = 6.0; | 60 | pointY = 6.0; |
63 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 61 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
64 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 62 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
65 | context.moveTo(pointX, pointY); | 63 | context.moveTo(pointX, pointY); |
66 | pointX = 310.0; | 64 | pointX = 310.0; |
67 | pointY = 0.0; | 65 | pointY = 0.0; |
68 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 66 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
69 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 67 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
70 | context.lineTo(pointX, pointY); | 68 | context.lineTo(pointX, pointY); |
71 | pointX = 0.0; | 69 | pointX = 0.0; |
72 | pointY = 0.0; | 70 | pointY = 0.0; |
73 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 71 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
74 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 72 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
75 | context.lineTo(pointX, pointY); | 73 | context.lineTo(pointX, pointY); |
76 | pointX = 0.0; | 74 | pointX = 0.0; |
77 | pointY = 6.0; | 75 | pointY = 6.0; |
78 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 76 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
79 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 77 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
80 | context.lineTo(pointX, pointY); | 78 | context.lineTo(pointX, pointY); |
81 | pointX = 310.0; | 79 | pointX = 310.0; |
82 | pointY = 6.0; | 80 | pointY = 6.0; |
83 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 81 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
84 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 82 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
85 | context.lineTo(pointX, pointY); | 83 | context.lineTo(pointX, pointY); |
86 | context.closePath(); | 84 | context.closePath(); |
87 | context.fillStyle = aBackgroundColor; | 85 | context.fillStyle = aBackgroundColor; |
88 | context.fill(); | 86 | context.fill(); |
89 | 87 | ||
90 | // grid | 88 | // grid |
91 | 89 | ||
92 | // background | 90 | // background |
93 | 91 | ||
94 | alignStroke = 0.0; | 92 | alignStroke = 0.0; |
95 | context.beginPath(); | 93 | context.beginPath(); |
96 | pointX = 310.0; | 94 | pointX = 310.0; |
97 | pointY = 6.0; | 95 | pointY = 6.0; |
98 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 96 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
99 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 97 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
100 | context.moveTo(pointX, pointY); | 98 | context.moveTo(pointX, pointY); |
101 | pointX = 310.0; | 99 | pointX = 310.0; |
102 | pointY = 0.0; | 100 | pointY = 0.0; |
103 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 101 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
104 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 102 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
105 | context.lineTo(pointX, pointY); | 103 | context.lineTo(pointX, pointY); |
106 | pointX = 0.0; | 104 | pointX = 0.0; |
107 | pointY = 0.0; | 105 | pointY = 0.0; |
108 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 106 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
109 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 107 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
110 | context.lineTo(pointX, pointY); | 108 | context.lineTo(pointX, pointY); |
111 | pointX = 0.0; | 109 | pointX = 0.0; |
112 | pointY = 6.0; | 110 | pointY = 6.0; |
113 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 111 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
114 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 112 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
115 | context.lineTo(pointX, pointY); | 113 | context.lineTo(pointX, pointY); |
116 | pointX = 310.0; | 114 | pointX = 310.0; |
117 | pointY = 6.0; | 115 | pointY = 6.0; |
118 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 116 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
119 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 117 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
120 | context.lineTo(pointX, pointY); | 118 | context.lineTo(pointX, pointY); |
121 | context.closePath(); | 119 | context.closePath(); |
122 | context.fillStyle = aBackgroundColor; | 120 | context.fillStyle = aBackgroundColor; |
123 | context.fill(); | 121 | context.fill(); |
124 | 122 | ||
125 | // Layer 1 | 123 | // Layer 1 |
126 | 124 | ||
127 | alignStroke = 0.0; | 125 | alignStroke = 0.0; |
128 | context.save(); | 126 | context.save(); |
129 | context.translate(155.0, 3.0); | 127 | context.translate(155.0, 3.0); |
130 | context.rotate(-3.142); | 128 | context.rotate(-3.142); |
131 | context.translate(-155.0, -3.0); | 129 | context.translate(-155.0, -3.0); |
132 | context.beginPath(); | 130 | context.beginPath(); |
133 | pointX = 149.0; | 131 | pointX = 149.0; |
134 | pointY = 6.0; | 132 | pointY = 6.0; |
135 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 133 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
136 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 134 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
137 | context.moveTo(pointX, pointY); | 135 | context.moveTo(pointX, pointY); |
138 | pointX = 161.0; | 136 | pointX = 161.0; |
139 | pointY = 6.0; | 137 | pointY = 6.0; |
140 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 138 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
141 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 139 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
142 | context.lineTo(pointX, pointY); | 140 | context.lineTo(pointX, pointY); |
143 | pointX = 155.0; | 141 | pointX = 155.0; |
144 | pointY = 0.0; | 142 | pointY = 0.0; |
145 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 143 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
146 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 144 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
147 | context.lineTo(pointX, pointY); | 145 | context.lineTo(pointX, pointY); |
148 | pointX = 149.0; | 146 | pointX = 149.0; |
149 | pointY = 6.0; | 147 | pointY = 6.0; |
150 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 148 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
151 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 149 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
152 | context.lineTo(pointX, pointY); | 150 | context.lineTo(pointX, pointY); |
153 | context.closePath(); | 151 | context.closePath(); |
154 | color = "#FFFFFF"; | 152 | color = "#FFFFFF"; |
155 | context.fillStyle = color; | 153 | context.fillStyle = color; |
156 | context.fill(); | 154 | context.fill(); |
157 | context.restore(); | 155 | context.restore(); |
158 | 156 | ||
159 | context.restore(); | 157 | context.restore(); |
160 | } | 158 | } |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js index b9d7adf..58b7593 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js | |||
@@ -1,512 +1,506 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | var _Clipperz_PM_Components_base_id_ = 0; | 28 | var _Clipperz_PM_Components_base_id_ = 0; |
31 | 29 | ||
32 | //############################################################################# | 30 | //############################################################################# |
33 | 31 | ||
34 | Clipperz.PM.UI.Common.Components.BaseComponent = function(args) { | 32 | Clipperz.PM.UI.Common.Components.BaseComponent = function(args) { |
35 | args = args || {}; | 33 | args = args || {}; |
36 | Clipperz.PM.UI.Common.Components.BaseComponent.superclass.constructor.call(this, args); | 34 | Clipperz.PM.UI.Common.Components.BaseComponent.superclass.constructor.call(this, args); |
37 | 35 | ||
38 | this._element = args.element || null; | 36 | this._element = args.element || null; |
39 | this._ids = {}; | 37 | this._ids = {}; |
40 | 38 | ||
41 | this._slots = {}; | 39 | this._slots = {}; |
42 | this._slotComponents = {}; | 40 | this._slotComponents = {}; |
43 | 41 | ||
44 | this._components = {}; | 42 | this._components = {}; |
45 | 43 | ||
46 | this._cachedSlots = {}; | 44 | this._cachedSlots = {}; |
47 | 45 | ||
48 | this._isModal = false; | 46 | this._isModal = false; |
49 | 47 | ||
50 | this._isActive = false; | 48 | this._isActive = false; |
51 | this._elementUsedToEnterModalState; | 49 | this._elementUsedToEnterModalState; |
52 | 50 | ||
53 | this._isFullyRendered = false; | 51 | this._isFullyRendered = false; |
54 | this._renderingWaitingQueue = []; | 52 | this._renderingWaitingQueue = []; |
55 | 53 | ||
56 | //this._slots = { | 54 | //this._slots = { |
57 | // 'header':'header', | 55 | // 'header':'header', |
58 | // 'body': 'body', | 56 | // 'body': 'body', |
59 | // 'footer':'footer' | 57 | // 'footer':'footer' |
60 | //}; | 58 | //}; |
61 | 59 | ||
62 | return this; | 60 | return this; |
63 | } | 61 | } |
64 | 62 | ||
65 | //============================================================================= | 63 | //============================================================================= |
66 | 64 | ||
67 | //TODO get back to MochiKit.Base.update as we are not extending anything | 65 | //TODO get back to MochiKit.Base.update as we are not extending anything |
68 | //MochiKit.Base.update(Clipperz.PM.UI.Common.Components.BaseComponent.prototype, { | 66 | //MochiKit.Base.update(Clipperz.PM.UI.Common.Components.BaseComponent.prototype, { |
69 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.BaseComponent, /*Ext.Component*/ Object, { | 67 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.BaseComponent, /*Ext.Component*/ Object, { |
70 | 68 | ||
71 | 'isClipperzPMComponent': true, | 69 | 'isClipperzPMComponent': true, |
72 | 70 | ||
73 | //------------------------------------------------------------------------- | 71 | //------------------------------------------------------------------------- |
74 | 72 | ||
75 | 'toString': function () { | 73 | 'toString': function () { |
76 | return "Clipperz.PM.UI.Common.Components.BaseComponent component"; | 74 | return "Clipperz.PM.UI.Common.Components.BaseComponent component"; |
77 | }, | 75 | }, |
78 | 76 | ||
79 | 'componentId': function () { | 77 | 'componentId': function () { |
80 | return this.getId('_id_'); | 78 | return this.getId('_id_'); |
81 | }, | 79 | }, |
82 | 80 | ||
83 | //------------------------------------------------------------------------- | 81 | //------------------------------------------------------------------------- |
84 | /* | 82 | /* |
85 | 'slots': function() { | 83 | 'slots': function() { |
86 | return this._slots; | 84 | return this._slots; |
87 | }, | 85 | }, |
88 | */ | 86 | */ |
89 | 'slotComponents': function() { | 87 | 'slotComponents': function() { |
90 | return this._slotComponents; | 88 | return this._slotComponents; |
91 | }, | 89 | }, |
92 | 90 | ||
93 | //------------------------------------------------------------------------- | 91 | //------------------------------------------------------------------------- |
94 | 92 | ||
95 | 'components': function () { | 93 | 'components': function () { |
96 | return this._components; | 94 | return this._components; |
97 | }, | 95 | }, |
98 | 96 | ||
99 | 'addComponent': function (aComponent) { | 97 | 'addComponent': function (aComponent) { |
100 | this.components()[aComponent.componentId()] = aComponent; | 98 | this.components()[aComponent.componentId()] = aComponent; |
101 | }, | 99 | }, |
102 | 100 | ||
103 | 'removeComponent': function (aComponent) { | 101 | 'removeComponent': function (aComponent) { |
104 | var componentId; | 102 | var componentId; |
105 | 103 | ||
106 | componentId = aComponent.componentId(); | 104 | componentId = aComponent.componentId(); |
107 | this.components()[componentId].remove(); | 105 | this.components()[componentId].remove(); |
108 | delete this.components()[componentId]; | 106 | delete this.components()[componentId]; |
109 | }, | 107 | }, |
110 | 108 | ||
111 | //------------------------------------------------------------------------- | 109 | //------------------------------------------------------------------------- |
112 | /* | 110 | /* |
113 | 'domHelper': function() { | 111 | 'domHelper': function() { |
114 | return Clipperz.YUI.DomHelper; | 112 | return Clipperz.YUI.DomHelper; |
115 | }, | 113 | }, |
116 | */ | 114 | */ |
117 | //------------------------------------------------------------------------- | 115 | //------------------------------------------------------------------------- |
118 | /* | 116 | /* |
119 | 'domHelperAppend': function(aValue) { | 117 | 'domHelperAppend': function(aValue) { |
120 | Clipperz.YUI.DomHelper.append(this.element().dom, aValue); | 118 | Clipperz.YUI.DomHelper.append(this.element().dom, aValue); |
121 | }, | 119 | }, |
122 | */ | 120 | */ |
123 | //------------------------------------------------------------------------- | 121 | //------------------------------------------------------------------------- |
124 | 122 | ||
125 | 'element': function() { | 123 | 'element': function() { |
126 | //MochiKit.Logging.logDebug(">>> BaseComponent.element"); | ||
127 | return MochiKit.DOM.getElement(this._element); | 124 | return MochiKit.DOM.getElement(this._element); |
128 | }, | 125 | }, |
129 | 126 | ||
130 | 'setElement': function(aNode) { | 127 | 'setElement': function(aNode) { |
131 | this._element = aNode; | 128 | this._element = aNode; |
132 | }, | 129 | }, |
133 | 130 | ||
134 | //----------------------------------------------------- | 131 | //----------------------------------------------------- |
135 | 132 | ||
136 | 'displayElement': function() { | 133 | 'displayElement': function() { |
137 | return this.element(); | 134 | return this.element(); |
138 | }, | 135 | }, |
139 | 136 | ||
140 | //------------------------------------------------------------------------- | 137 | //------------------------------------------------------------------------- |
141 | 138 | ||
142 | 'renderInNode': function(aDomNode) { | 139 | 'renderInNode': function(aDomNode) { |
143 | this.setElement(aDomNode); | 140 | this.setElement(aDomNode); |
144 | this.render(); | 141 | this.render(); |
145 | }, | 142 | }, |
146 | 143 | ||
147 | 'render': function() { | 144 | 'render': function() { |
148 | this.clear(); | 145 | this.clear(); |
149 | this.renderSelf(); | 146 | this.renderSelf(); |
150 | this.renderComponents(); | 147 | this.renderComponents(); |
151 | if (this.shouldShowTranslationHints()) { | 148 | if (this.shouldShowTranslationHints()) { |
152 | this.renderTranslationHints(); | 149 | this.renderTranslationHints(); |
153 | } | 150 | } |
154 | if (this.shouldShowElementWhileRendering()) { | 151 | if (this.shouldShowElementWhileRendering()) { |
155 | MochiKit.Style.showElement(this.displayElement()); | 152 | MochiKit.Style.showElement(this.displayElement()); |
156 | }; | 153 | }; |
157 | 154 | ||
158 | this._isFullyRendered = true; | 155 | this._isFullyRendered = true; |
159 | 156 | ||
160 | MochiKit.Iter.forEach(this.renderingWaitingQueue(), MochiKit.Base.methodcaller('callback')); | 157 | MochiKit.Iter.forEach(this.renderingWaitingQueue(), MochiKit.Base.methodcaller('callback')); |
161 | this.resetRenderingWaitingQueue(); | 158 | this.resetRenderingWaitingQueue(); |
162 | }, | 159 | }, |
163 | 160 | ||
164 | 'renderSelf': function() { | 161 | 'renderSelf': function() { |
165 | throw Clipperz.Base.exception.AbstractMethod; | 162 | throw Clipperz.Base.exception.AbstractMethod; |
166 | }, | 163 | }, |
167 | 164 | ||
168 | 'renderComponents': function() { | 165 | 'renderComponents': function() { |
169 | varslotName; | 166 | varslotName; |
170 | 167 | ||
171 | for (slotName in this.slotComponents()) { | 168 | for (slotName in this.slotComponents()) { |
172 | this.slotComponents()[slotName].renderInNode(this.elementForSlotNamed(slotName)); | 169 | this.slotComponents()[slotName].renderInNode(this.elementForSlotNamed(slotName)); |
173 | } | 170 | } |
174 | }, | 171 | }, |
175 | 172 | ||
176 | //......................................................................... | 173 | //......................................................................... |
177 | 174 | ||
178 | 'isFullyRendered': function () { | 175 | 'isFullyRendered': function () { |
179 | return this._isFullyRendered; | 176 | return this._isFullyRendered; |
180 | }, | 177 | }, |
181 | 178 | ||
182 | //......................................................................... | 179 | //......................................................................... |
183 | 180 | ||
184 | 'renderingWaitingQueue': function () { | 181 | 'renderingWaitingQueue': function () { |
185 | return this._renderingWaitingQueue; | 182 | return this._renderingWaitingQueue; |
186 | }, | 183 | }, |
187 | 184 | ||
188 | 'resetRenderingWaitingQueue': function () { | 185 | 'resetRenderingWaitingQueue': function () { |
189 | this._renderingWaitingQueue = []; | 186 | this._renderingWaitingQueue = []; |
190 | }, | 187 | }, |
191 | 188 | ||
192 | //......................................................................... | 189 | //......................................................................... |
193 | 190 | ||
194 | 'waitUntilFullyRendered': function () { | 191 | 'waitUntilFullyRendered': function () { |
195 | var deferredResult; | 192 | var deferredResult; |
196 | 193 | ||
197 | if (this.isFullyRendered() == true) { | 194 | if (this.isFullyRendered() == true) { |
198 | deferredResult = MochiKit.Async.succeed | 195 | deferredResult = MochiKit.Async.succeed |
199 | } else { | 196 | } else { |
200 | deferredResult = new Clipperz.Async.Deferred("BaseComponent.waitUntilFullyRendered", {trace:false}); | 197 | deferredResult = new Clipperz.Async.Deferred("BaseComponent.waitUntilFullyRendered", {trace:false}); |
201 | this.renderingWaitingQueue().push(deferredResult); | 198 | this.renderingWaitingQueue().push(deferredResult); |
202 | } | 199 | } |
203 | 200 | ||
204 | return deferredResult; | 201 | return deferredResult; |
205 | }, | 202 | }, |
206 | 203 | ||
207 | //----------------------------------------------------- | 204 | //----------------------------------------------------- |
208 | 205 | ||
209 | 'renderTranslationHints': function () { | 206 | 'renderTranslationHints': function () { |
210 | vartranslatableItems; | 207 | vartranslatableItems; |
211 | 208 | ||
212 | translatableItems = MochiKit.Selector.findChildElements(this.displayElement(), ['[stringID]']); | 209 | translatableItems = MochiKit.Selector.findChildElements(this.displayElement(), ['[stringID]']); |
213 | MochiKit.Iter.forEach(translatableItems, MochiKit.Base.method(this, 'enhanceTranslatableElement')) | 210 | MochiKit.Iter.forEach(translatableItems, MochiKit.Base.method(this, 'enhanceTranslatableElement')) |
214 | }, | 211 | }, |
215 | 212 | ||
216 | 'enhanceTranslatableElement': function (anElement) { | 213 | 'enhanceTranslatableElement': function (anElement) { |
217 | //Clipperz.log(">>> enhanceTranslatableElement", anElement); | 214 | //Clipperz.log(">>> enhanceTranslatableElement", anElement); |
218 | // new Clipperz.PM.UI.Common.Components.TranslatorWidget({ | 215 | // new Clipperz.PM.UI.Common.Components.TranslatorWidget({ |
219 | // 'element':anElement | 216 | // 'element':anElement |
220 | // }); | 217 | // }); |
221 | 218 | ||
222 | MochiKit.Signal.connect(anElement, 'onmouseenter', MochiKit.Base.partial(Clipperz.PM.UI.Common.Components.TranslatorWidget.show, anElement, MochiKit.DOM.getNodeAttribute(anElement, 'stringID'))); | 219 | MochiKit.Signal.connect(anElement, 'onmouseenter', MochiKit.Base.partial(Clipperz.PM.UI.Common.Components.TranslatorWidget.show, anElement, MochiKit.DOM.getNodeAttribute(anElement, 'stringID'))); |
223 | MochiKit.Signal.connect(anElement, 'onmouseleave', Clipperz.PM.UI.Common.Components.TranslatorWidget.hide); | 220 | MochiKit.Signal.connect(anElement, 'onmouseleave', Clipperz.PM.UI.Common.Components.TranslatorWidget.hide); |
224 | //Clipperz.log("<<< enhanceTranslatableElement"); | 221 | //Clipperz.log("<<< enhanceTranslatableElement"); |
225 | }, | 222 | }, |
226 | 223 | ||
227 | //----------------------------------------------------- | 224 | //----------------------------------------------------- |
228 | 225 | ||
229 | 'update': function(args) { | 226 | 'update': function(args) { |
230 | throw Clipperz.Base.exception.AbstractMethod; | 227 | throw Clipperz.Base.exception.AbstractMethod; |
231 | }, | 228 | }, |
232 | 229 | ||
233 | 'updateSelf': function(args) { | 230 | 'updateSelf': function(args) { |
234 | throw Clipperz.Base.exception.AbstractMethod; | 231 | throw Clipperz.Base.exception.AbstractMethod; |
235 | }, | 232 | }, |
236 | 233 | ||
237 | 'updateComponents': function(args) { | 234 | 'updateComponents': function(args) { |
238 | throw Clipperz.Base.exception.AbstractMethod; | 235 | throw Clipperz.Base.exception.AbstractMethod; |
239 | }, | 236 | }, |
240 | 237 | ||
241 | //----------------------------------------------------- | 238 | //----------------------------------------------------- |
242 | 239 | ||
243 | 'refresh': function() { | 240 | 'refresh': function() { |
244 | throw Clipperz.Base.exception.AbstractMethod; | 241 | throw Clipperz.Base.exception.AbstractMethod; |
245 | }, | 242 | }, |
246 | 243 | ||
247 | 'refreshSelf': function() { | 244 | 'refreshSelf': function() { |
248 | throw Clipperz.Base.exception.AbstractMethod; | 245 | throw Clipperz.Base.exception.AbstractMethod; |
249 | }, | 246 | }, |
250 | 247 | ||
251 | 'refreshComponents': function(args) { | 248 | 'refreshComponents': function(args) { |
252 | throw Clipperz.Base.exception.AbstractMethod; | 249 | throw Clipperz.Base.exception.AbstractMethod; |
253 | }, | 250 | }, |
254 | 251 | ||
255 | //----------------------------------------------------- | 252 | //----------------------------------------------------- |
256 | 253 | ||
257 | 'checkSlotNamed': function(aSlotName) { | 254 | 'checkSlotNamed': function(aSlotName) { |
258 | if (typeof(this._slots[aSlotName]) == 'undefined') { | 255 | if (typeof(this._slots[aSlotName]) == 'undefined') { |
259 | throw new Error("undefined slot"); | 256 | throw new Error("undefined slot"); |
260 | }; | 257 | }; |
261 | }, | 258 | }, |
262 | 259 | ||
263 | //----------------------------------------------------- | 260 | //----------------------------------------------------- |
264 | 261 | ||
265 | 'cachedSlots': function() { | 262 | 'cachedSlots': function() { |
266 | return this._cachedSlots; | 263 | return this._cachedSlots; |
267 | }, | 264 | }, |
268 | 265 | ||
269 | 'slotNamed': function(aSlotName) { | 266 | 'slotNamed': function(aSlotName) { |
270 | var result; | 267 | var result; |
271 | 268 | ||
272 | this.checkSlotNamed(aSlotName); | 269 | this.checkSlotNamed(aSlotName); |
273 | if (typeof(this.cachedSlots()[aSlotName]) == 'undefined') { | 270 | if (typeof(this.cachedSlots()[aSlotName]) == 'undefined') { |
274 | this.cachedSlots()[aSlotName] = new Clipperz.PM.UI.Common.Components.ComponentSlot(this,aSlotName); | 271 | this.cachedSlots()[aSlotName] = new Clipperz.PM.UI.Common.Components.ComponentSlot(this,aSlotName); |
275 | } | 272 | } |
276 | 273 | ||
277 | result = this.cachedSlots()[aSlotName]; | 274 | result = this.cachedSlots()[aSlotName]; |
278 | 275 | ||
279 | return result; | 276 | return result; |
280 | }, | 277 | }, |
281 | 278 | ||
282 | //----------------------------------------------------- | 279 | //----------------------------------------------------- |
283 | 280 | ||
284 | 'elementForSlotNamed': function(aSlotName) { | 281 | 'elementForSlotNamed': function(aSlotName) { |
285 | return MochiKit.DOM.getElement(this._slots[aSlotName]); | 282 | return MochiKit.DOM.getElement(this._slots[aSlotName]); |
286 | }, | 283 | }, |
287 | 284 | ||
288 | //----------------------------------------------------- | 285 | //----------------------------------------------------- |
289 | 286 | ||
290 | 'componentForSlotNamed': function(aSlotName) { | 287 | 'componentForSlotNamed': function(aSlotName) { |
291 | return this.slotComponents()[aSlotName]; | 288 | return this.slotComponents()[aSlotName]; |
292 | }, | 289 | }, |
293 | 290 | ||
294 | 'setComponentForSlotNamed': function(aComponent, aSlotName) { | 291 | 'setComponentForSlotNamed': function(aComponent, aSlotName) { |
295 | var domNode; | 292 | var domNode; |
296 | 293 | ||
297 | this.checkSlotNamed(aSlotName); | 294 | this.checkSlotNamed(aSlotName); |
298 | 295 | ||
299 | if (this.slotComponents()[aSlotName] != null) { | 296 | if (this.slotComponents()[aSlotName] != null) { |
300 | this.slotComponents()[aSlotName].remove(); | 297 | this.slotComponents()[aSlotName].remove(); |
301 | } | 298 | } |
302 | 299 | ||
303 | this.slotComponents()[aSlotName] = aComponent; | 300 | this.slotComponents()[aSlotName] = aComponent; |
304 | 301 | ||
305 | // domNode = MochiKit.DOM.getElement(this.slotNamed(aSlotName)); | 302 | // domNode = MochiKit.DOM.getElement(this.slotNamed(aSlotName)); |
306 | domNode = this.elementForSlotNamed(aSlotName); | 303 | domNode = this.elementForSlotNamed(aSlotName); |
307 | 304 | ||
308 | if (domNode != null) { | 305 | if (domNode != null) { |
309 | aComponent.renderInNode(domNode); | 306 | aComponent.renderInNode(domNode); |
310 | } | 307 | } |
311 | }, | 308 | }, |
312 | 309 | ||
313 | //----------------------------------------------------- | 310 | //----------------------------------------------------- |
314 | /* | 311 | /* |
315 | 'purgeListeners': function() { | 312 | 'purgeListeners': function() { |
316 | //MochiKit.Logging.logDebug(">>> Clipperz.PM.UI.Common.Components.BaseComponent.purgeListeners [" + this + "]"); | ||
317 | //MochiKit.Logging.logDebug("--- " + this + ".purgeListeners"); | ||
318 | Clipperz.NotificationCenter.unregister(this); | 313 | Clipperz.NotificationCenter.unregister(this); |
319 | MochiKit.Signal.disconnectAllTo(this); | 314 | MochiKit.Signal.disconnectAllTo(this); |
320 | //MochiKit.Logging.logDebug("<<< Clipperz.PM.UI.Common.Components.BaseComponent.purgeListeners"); | ||
321 | }, | 315 | }, |
322 | */ | 316 | */ |
323 | //----------------------------------------------------- | 317 | //----------------------------------------------------- |
324 | 318 | ||
325 | 'clear': function() { | 319 | 'clear': function() { |
326 | varslotName; | 320 | varslotName; |
327 | var componentId; | 321 | var componentId; |
328 | 322 | ||
329 | MochiKit.Signal.disconnectAllTo(this); | 323 | MochiKit.Signal.disconnectAllTo(this); |
330 | 324 | ||
331 | for (slotName in this.slotComponents()) { | 325 | for (slotName in this.slotComponents()) { |
332 | this.slotComponents()[slotName].clear(); | 326 | this.slotComponents()[slotName].clear(); |
333 | } | 327 | } |
334 | 328 | ||
335 | for (componentId in this.components()) { | 329 | for (componentId in this.components()) { |
336 | this.components()[componentId].clear(); | 330 | this.components()[componentId].clear(); |
337 | } | 331 | } |
338 | 332 | ||
339 | // if (this.element() != null) { | 333 | // if (this.element() != null) { |
340 | // this.element().innerHTML = ""; | 334 | // this.element().innerHTML = ""; |
341 | // } | 335 | // } |
342 | 336 | ||
343 | if (this.displayElement() != null) { | 337 | if (this.displayElement() != null) { |
344 | if (this.element() != this.displayElement()) { | 338 | if (this.element() != this.displayElement()) { |
345 | MochiKit.DOM.removeElement(this.displayElement()); | 339 | MochiKit.DOM.removeElement(this.displayElement()); |
346 | } else { | 340 | } else { |
347 | this.displayElement().innerHTML = ""; | 341 | this.displayElement().innerHTML = ""; |
348 | } | 342 | } |
349 | } | 343 | } |
350 | 344 | ||
351 | if (this.isModal()) { | 345 | if (this.isModal()) { |
352 | //TODO: cleanup when the closed element was shown modally. | 346 | //TODO: cleanup when the closed element was shown modally. |
353 | } | 347 | } |
354 | }, | 348 | }, |
355 | 349 | ||
356 | 350 | ||
357 | 'remove': function() { | 351 | 'remove': function() { |
358 | varslotName; | 352 | varslotName; |
359 | var componentId; | 353 | var componentId; |
360 | 354 | ||
361 | for (slotName in this.slotComponents()) { | 355 | for (slotName in this.slotComponents()) { |
362 | this.slotComponents()[slotName].remove(); | 356 | this.slotComponents()[slotName].remove(); |
363 | delete this.slotComponents()[slotName]; | 357 | delete this.slotComponents()[slotName]; |
364 | } | 358 | } |
365 | 359 | ||
366 | for (componentId in this.components()) { | 360 | for (componentId in this.components()) { |
367 | this.components()[componentId].remove(); | 361 | this.components()[componentId].remove(); |
368 | delete this.components()[componentId]; | 362 | delete this.components()[componentId]; |
369 | } | 363 | } |
370 | 364 | ||
371 | this.clear(); | 365 | this.clear(); |
372 | MochiKit.Signal.disconnectAll(this); | 366 | MochiKit.Signal.disconnectAll(this); |
373 | }, | 367 | }, |
374 | 368 | ||
375 | 'append': function(aNode, aValue) { | 369 | 'append': function(aNode, aValue) { |
376 | return Clipperz.DOM.Helper.append(aNode, aValue); | 370 | return Clipperz.DOM.Helper.append(aNode, aValue); |
377 | }, | 371 | }, |
378 | 372 | ||
379 | 'insertBefore': function (aNode, aValue) { | 373 | 'insertBefore': function (aNode, aValue) { |
380 | return Clipperz.DOM.Helper.insertBefore(aNode, aValue); | 374 | return Clipperz.DOM.Helper.insertBefore(aNode, aValue); |
381 | }, | 375 | }, |
382 | 376 | ||
383 | 'insertAfter': function (aNode, aValue) { | 377 | 'insertAfter': function (aNode, aValue) { |
384 | return Clipperz.DOM.Helper.insertAfter(aNode, aValue); | 378 | return Clipperz.DOM.Helper.insertAfter(aNode, aValue); |
385 | }, | 379 | }, |
386 | 380 | ||
387 | //------------------------------------------------------------------------- | 381 | //------------------------------------------------------------------------- |
388 | 382 | ||
389 | 'getId': function(aValue) { | 383 | 'getId': function(aValue) { |
390 | varresult; | 384 | varresult; |
391 | 385 | ||
392 | if (typeof(aValue) != 'undefined') { | 386 | if (typeof(aValue) != 'undefined') { |
393 | result = this._ids[aValue]; | 387 | result = this._ids[aValue]; |
394 | 388 | ||
395 | if (typeof(result) == 'undefined') { | 389 | if (typeof(result) == 'undefined') { |
396 | _Clipperz_PM_Components_base_id_ ++; | 390 | _Clipperz_PM_Components_base_id_ ++; |
397 | 391 | ||
398 | result = "Clipperz_PM_Components_" + aValue + "_" + _Clipperz_PM_Components_base_id_; | 392 | result = "Clipperz_PM_Components_" + aValue + "_" + _Clipperz_PM_Components_base_id_; |
399 | this._ids[aValue] = result; | 393 | this._ids[aValue] = result; |
400 | } | 394 | } |
401 | } else { | 395 | } else { |
402 | // result = Clipperz.PM.UI.Common.Components.BaseComponent.superclass.getId.call(this); | 396 | // result = Clipperz.PM.UI.Common.Components.BaseComponent.superclass.getId.call(this); |
403 | throw "call to BaseComponent.getId with an undefined value"; | 397 | throw "call to BaseComponent.getId with an undefined value"; |
404 | } | 398 | } |
405 | 399 | ||
406 | return result; | 400 | return result; |
407 | }, | 401 | }, |
408 | 402 | ||
409 | 'getAnchor': function (aValue) { | 403 | 'getAnchor': function (aValue) { |
410 | return '#' + this.getId(aValue); | 404 | return '#' + this.getId(aValue); |
411 | }, | 405 | }, |
412 | 406 | ||
413 | //------------------------------------------------------------------------- | 407 | //------------------------------------------------------------------------- |
414 | 408 | ||
415 | 'getElement': function(aValue) { | 409 | 'getElement': function(aValue) { |
416 | return Clipperz.DOM.get(this.getId(aValue)); | 410 | return Clipperz.DOM.get(this.getId(aValue)); |
417 | }, | 411 | }, |
418 | 412 | ||
419 | //------------------------------------------------------------------------- | 413 | //------------------------------------------------------------------------- |
420 | 414 | ||
421 | 'hideElement': function(anElementName) { | 415 | 'hideElement': function(anElementName) { |
422 | MochiKit.Style.hideElement(this.getElement(anElementName)); | 416 | MochiKit.Style.hideElement(this.getElement(anElementName)); |
423 | }, | 417 | }, |
424 | 418 | ||
425 | 'showElement': function(anElementName) { | 419 | 'showElement': function(anElementName) { |
426 | MochiKit.Style.showElement(this.getElement(anElementName)); | 420 | MochiKit.Style.showElement(this.getElement(anElementName)); |
427 | }, | 421 | }, |
428 | 422 | ||
429 | //------------------------------------------------------------------------- | 423 | //------------------------------------------------------------------------- |
430 | 424 | ||
431 | 'activate': function () { | 425 | 'activate': function () { |
432 | this._isActive = true; | 426 | this._isActive = true; |
433 | }, | 427 | }, |
434 | 428 | ||
435 | 'deactivate': function () { | 429 | 'deactivate': function () { |
436 | this._isActive = false; | 430 | this._isActive = false; |
437 | }, | 431 | }, |
438 | 432 | ||
439 | 'isActive': function () { | 433 | 'isActive': function () { |
440 | return this._isActive; | 434 | return this._isActive; |
441 | }, | 435 | }, |
442 | 436 | ||
443 | //------------------------------------------------------------------------- | 437 | //------------------------------------------------------------------------- |
444 | 438 | ||
445 | 'hideSlot': function(aSlotName) { | 439 | 'hideSlot': function(aSlotName) { |
446 | if (this.componentForSlotNamed(aSlotName)) { | 440 | if (this.componentForSlotNamed(aSlotName)) { |
447 | this.componentForSlotNamed(aSlotName).deactivate(); | 441 | this.componentForSlotNamed(aSlotName).deactivate(); |
448 | } | 442 | } |
449 | MochiKit.Style.hideElement(this.elementForSlotNamed(aSlotName)); | 443 | MochiKit.Style.hideElement(this.elementForSlotNamed(aSlotName)); |
450 | }, | 444 | }, |
451 | 445 | ||
452 | 'showSlot': function(aSlotName) { | 446 | 'showSlot': function(aSlotName) { |
453 | if (this.componentForSlotNamed(aSlotName)) { | 447 | if (this.componentForSlotNamed(aSlotName)) { |
454 | this.componentForSlotNamed(aSlotName).activate(); | 448 | this.componentForSlotNamed(aSlotName).activate(); |
455 | } | 449 | } |
456 | MochiKit.Style.showElement(this.elementForSlotNamed(aSlotName)); | 450 | MochiKit.Style.showElement(this.elementForSlotNamed(aSlotName)); |
457 | }, | 451 | }, |
458 | 452 | ||
459 | //------------------------------------------------------------------------- | 453 | //------------------------------------------------------------------------- |
460 | 454 | ||
461 | 'shouldShowTranslationHints': function () { | 455 | 'shouldShowTranslationHints': function () { |
462 | return false; | 456 | return false; |
463 | }, | 457 | }, |
464 | 458 | ||
465 | 'shouldShowElementWhileRendering': function() { | 459 | 'shouldShowElementWhileRendering': function() { |
466 | return true; | 460 | return true; |
467 | }, | 461 | }, |
468 | 462 | ||
469 | //'shouldRemoveElementWhenClearningUp': function () { | 463 | //'shouldRemoveElementWhenClearningUp': function () { |
470 | // return true; | 464 | // return true; |
471 | //}, | 465 | //}, |
472 | 466 | ||
473 | //------------------------------------------------------------------------- | 467 | //------------------------------------------------------------------------- |
474 | 468 | ||
475 | 'isModal': function() { | 469 | 'isModal': function() { |
476 | return this._isModal; | 470 | return this._isModal; |
477 | }, | 471 | }, |
478 | 472 | ||
479 | 'setIsModal': function(aValue) { | 473 | 'setIsModal': function(aValue) { |
480 | this._isModal = aValue; | 474 | this._isModal = aValue; |
481 | }, | 475 | }, |
482 | 476 | ||
483 | //------------------------------------------------------------------------- | 477 | //------------------------------------------------------------------------- |
484 | 478 | ||
485 | 'elementUsedToEnterModalState': function () { | 479 | 'elementUsedToEnterModalState': function () { |
486 | return this._elementUsedToEnterModalState; | 480 | return this._elementUsedToEnterModalState; |
487 | }, | 481 | }, |
488 | 482 | ||
489 | 'setElementUsedToEnterModalState': function (aValue) { | 483 | 'setElementUsedToEnterModalState': function (aValue) { |
490 | this._elementUsedToEnterModalState = aValue; | 484 | this._elementUsedToEnterModalState = aValue; |
491 | }, | 485 | }, |
492 | 486 | ||
493 | //------------------------------------------------------------------------- | 487 | //------------------------------------------------------------------------- |
494 | 488 | ||
495 | 'modalDialogMask': function () { | 489 | 'modalDialogMask': function () { |
496 | return 'modalDialogMask'; | 490 | return 'modalDialogMask'; |
497 | }, | 491 | }, |
498 | 492 | ||
499 | 'modalDialog': function () { | 493 | 'modalDialog': function () { |
500 | return 'modalDialog'; | 494 | return 'modalDialog'; |
501 | }, | 495 | }, |
502 | 496 | ||
503 | 'modalDialogFrame': function() { | 497 | 'modalDialogFrame': function() { |
504 | return 'modalDialogFrame' | 498 | return 'modalDialogFrame' |
505 | }, | 499 | }, |
506 | 500 | ||
507 | //------------------------------------------------------------------------- | 501 | //------------------------------------------------------------------------- |
508 | 502 | ||
509 | 'deferredShowModal': function(args) { | 503 | 'deferredShowModal': function(args) { |
510 | var deferredResult; | 504 | var deferredResult; |
511 | 505 | ||
512 | deferredResult = new Clipperz.Async.Deferred("BaseComponent.deferredShowModal", {trace:false}); | 506 | deferredResult = new Clipperz.Async.Deferred("BaseComponent.deferredShowModal", {trace:false}); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js index 1010c9d..1268118 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js | |||
@@ -1,113 +1,111 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.Button = function(args) { | 26 | Clipperz.PM.UI.Common.Components.Button = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Common.Components.Button.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Common.Components.Button.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._element = args.element || Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._element = args.element || Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | this._isDefault = args.isDefault|| false; | 33 | this._isDefault = args.isDefault|| false; |
36 | 34 | ||
37 | this.render(); | 35 | this.render(); |
38 | 36 | ||
39 | return this; | 37 | return this; |
40 | } | 38 | } |
41 | 39 | ||
42 | //============================================================================= | 40 | //============================================================================= |
43 | 41 | ||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Common.Components.BaseComponent, { | 42 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Common.Components.BaseComponent, { |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
47 | 45 | ||
48 | 'toString': function () { | 46 | 'toString': function () { |
49 | return "Clipperz.PM.UI.Common.Components.Button component"; | 47 | return "Clipperz.PM.UI.Common.Components.Button component"; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
53 | 51 | ||
54 | 'text': function () { | 52 | 'text': function () { |
55 | return this._text; | 53 | return this._text; |
56 | }, | 54 | }, |
57 | 55 | ||
58 | 'isDefault': function () { | 56 | 'isDefault': function () { |
59 | return this._isDefault; | 57 | return this._isDefault; |
60 | }, | 58 | }, |
61 | 59 | ||
62 | //------------------------------------------------------------------------- | 60 | //------------------------------------------------------------------------- |
63 | 61 | ||
64 | 'renderSelf': function () { | 62 | 'renderSelf': function () { |
65 | /* | 63 | /* |
66 | this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button_wrapper', children:[ | 64 | this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button_wrapper', children:[ |
67 | {tag:'div', id:this.getId('bodyWrapper'), cls:'button_bodyWrapper', children:[ | 65 | {tag:'div', id:this.getId('bodyWrapper'), cls:'button_bodyWrapper', children:[ |
68 | {tag:'div', id:this.getId('body'), cls:'button_body', children:[ | 66 | {tag:'div', id:this.getId('body'), cls:'button_body', children:[ |
69 | {tag:'span', html:this.text()} | 67 | {tag:'span', html:this.text()} |
70 | ]}, | 68 | ]}, |
71 | {tag:'div', id:this.getId('footer'), cls:'button_footer'} | 69 | {tag:'div', id:this.getId('footer'), cls:'button_footer'} |
72 | ]} | 70 | ]} |
73 | ]}); | 71 | ]}); |
74 | */ | 72 | */ |
75 | /* | 73 | /* |
76 | this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button', children:[ | 74 | this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button', children:[ |
77 | {tag:'span', html:this.text()} | 75 | {tag:'span', html:this.text()} |
78 | ]}); | 76 | ]}); |
79 | */ | 77 | */ |
80 | this.append(this.element(), {tag:'a', id:this.getId('button'), cls:'button', html:this.text()}); | 78 | this.append(this.element(), {tag:'a', id:this.getId('button'), cls:'button', html:this.text()}); |
81 | 79 | ||
82 | if (this.isDefault()) { | 80 | if (this.isDefault()) { |
83 | MochiKit.DOM.addElementClass(this.getId('button'), 'default'); | 81 | MochiKit.DOM.addElementClass(this.getId('button'), 'default'); |
84 | } | 82 | } |
85 | 83 | ||
86 | // MochiKit.Signal.connect(this.getId('button'), 'onmouseenter',this, 'handleOnMouseEnter'); | 84 | // MochiKit.Signal.connect(this.getId('button'), 'onmouseenter',this, 'handleOnMouseEnter'); |
87 | // MochiKit.Signal.connect(this.getId('button'), 'onmouseleave',this, 'handleOnMouseLeave'); | 85 | // MochiKit.Signal.connect(this.getId('button'), 'onmouseleave',this, 'handleOnMouseLeave'); |
88 | // MochiKit.Signal.connect(this.getId('button'), 'onmousedown',this, 'handleOnMouseDown'); | 86 | // MochiKit.Signal.connect(this.getId('button'), 'onmousedown',this, 'handleOnMouseDown'); |
89 | MochiKit.Signal.connect(this.getId('button'), 'onclick', this, 'handleOnClick'); | 87 | MochiKit.Signal.connect(this.getId('button'), 'onclick', this, 'handleOnClick'); |
90 | }, | 88 | }, |
91 | 89 | ||
92 | //------------------------------------------------------------------------- | 90 | //------------------------------------------------------------------------- |
93 | /* | 91 | /* |
94 | 'handleOnMouseEnter': function (anEvent) { | 92 | 'handleOnMouseEnter': function (anEvent) { |
95 | MochiKit.DOM.addElementClass(this.getId('button'), 'hover'); | 93 | MochiKit.DOM.addElementClass(this.getId('button'), 'hover'); |
96 | }, | 94 | }, |
97 | 95 | ||
98 | 'handleOnMouseLeave': function (anEvent) { | 96 | 'handleOnMouseLeave': function (anEvent) { |
99 | MochiKit.DOM.removeElementClass(this.getId('button'), 'hover'); | 97 | MochiKit.DOM.removeElementClass(this.getId('button'), 'hover'); |
100 | MochiKit.DOM.removeElementClass(this.getId('button'), 'clicked'); | 98 | MochiKit.DOM.removeElementClass(this.getId('button'), 'clicked'); |
101 | }, | 99 | }, |
102 | 100 | ||
103 | 'handleOnMouseDown': function (anEvent) { | 101 | 'handleOnMouseDown': function (anEvent) { |
104 | MochiKit.DOM.addElementClass(this.getId('button'), 'clicked'); | 102 | MochiKit.DOM.addElementClass(this.getId('button'), 'clicked'); |
105 | }, | 103 | }, |
106 | */ | 104 | */ |
107 | 'handleOnClick': function (anEvent) { | 105 | 'handleOnClick': function (anEvent) { |
108 | MochiKit.Signal.signal(this, 'onclick', anEvent); | 106 | MochiKit.Signal.signal(this, 'onclick', anEvent); |
109 | }, | 107 | }, |
110 | 108 | ||
111 | //------------------------------------------------------------------------- | 109 | //------------------------------------------------------------------------- |
112 | __syntaxFix__: "syntax fix" | 110 | __syntaxFix__: "syntax fix" |
113 | }); | 111 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js index 7f56c1e..2f82359 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js | |||
@@ -1,61 +1,59 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | 28 | ||
31 | Clipperz.PM.UI.Common.Components.ComponentSlot = function(aComponent, aSlotName) { | 29 | Clipperz.PM.UI.Common.Components.ComponentSlot = function(aComponent, aSlotName) { |
32 | this._component = aComponent; | 30 | this._component = aComponent; |
33 | this._slotName = aSlotName; | 31 | this._slotName = aSlotName; |
34 | 32 | ||
35 | return this; | 33 | return this; |
36 | } | 34 | } |
37 | 35 | ||
38 | //============================================================================= | 36 | //============================================================================= |
39 | 37 | ||
40 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.ComponentSlot, Object, { | 38 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.ComponentSlot, Object, { |
41 | 39 | ||
42 | //------------------------------------------------------------------------- | 40 | //------------------------------------------------------------------------- |
43 | 41 | ||
44 | 'slotName': function() { | 42 | 'slotName': function() { |
45 | return this._slotName; | 43 | return this._slotName; |
46 | }, | 44 | }, |
47 | 45 | ||
48 | 'component': function() { | 46 | 'component': function() { |
49 | return this._component; | 47 | return this._component; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
53 | 51 | ||
54 | 'setContent': function(aComponent) { | 52 | 'setContent': function(aComponent) { |
55 | this.component().setComponentForSlotNamed(aComponent, this.slotName()); | 53 | this.component().setComponentForSlotNamed(aComponent, this.slotName()); |
56 | }, | 54 | }, |
57 | 55 | ||
58 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
59 | __syntaxFix__: "syntax fix" | 57 | __syntaxFix__: "syntax fix" |
60 | 58 | ||
61 | }); | 59 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js index 2db2489..bf00ffc 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js | |||
@@ -1,88 +1,86 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.FaviconComponent = function(args) { | 26 | Clipperz.PM.UI.Common.Components.FaviconComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Common.Components.FaviconComponent.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Common.Components.FaviconComponent.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this.render(); | 31 | this.render(); |
34 | this.setSrc(args.src); | 32 | this.setSrc(args.src); |
35 | 33 | ||
36 | return this; | 34 | return this; |
37 | } | 35 | } |
38 | 36 | ||
39 | //============================================================================= | 37 | //============================================================================= |
40 | 38 | ||
41 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.FaviconComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 39 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.FaviconComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { |
42 | 40 | ||
43 | //------------------------------------------------------------------------- | 41 | //------------------------------------------------------------------------- |
44 | 42 | ||
45 | 'toString': function () { | 43 | 'toString': function () { |
46 | return "Clipperz.PM.UI.Common.Components.FaviconComponent component"; | 44 | return "Clipperz.PM.UI.Common.Components.FaviconComponent component"; |
47 | }, | 45 | }, |
48 | 46 | ||
49 | //------------------------------------------------------------------------- | 47 | //------------------------------------------------------------------------- |
50 | 48 | ||
51 | 'src': function () { | 49 | 'src': function () { |
52 | return this.element().src; | 50 | return this.element().src; |
53 | }, | 51 | }, |
54 | 52 | ||
55 | 'setSrc': function (aValue) { | 53 | 'setSrc': function (aValue) { |
56 | this.element().src = (aValue || Clipperz.PM.Strings.getValue('defaultFaviconUrl')); | 54 | this.element().src = (aValue || Clipperz.PM.Strings.getValue('defaultFaviconUrl')); |
57 | }, | 55 | }, |
58 | 56 | ||
59 | //------------------------------------------------------------------------- | 57 | //------------------------------------------------------------------------- |
60 | 58 | ||
61 | 'clear': function () {}, | 59 | 'clear': function () {}, |
62 | 60 | ||
63 | //------------------------------------------------------------------------- | 61 | //------------------------------------------------------------------------- |
64 | 62 | ||
65 | 'renderSelf': function () { | 63 | 'renderSelf': function () { |
66 | MochiKit.Signal.connect(this.element(), 'onerror',this, 'setDefaultFavicon'); | 64 | MochiKit.Signal.connect(this.element(), 'onerror',this, 'setDefaultFavicon'); |
67 | MochiKit.Signal.connect(this.element(), 'onabort',this, 'setDefaultFavicon'); | 65 | MochiKit.Signal.connect(this.element(), 'onabort',this, 'setDefaultFavicon'); |
68 | MochiKit.Signal.connect(this.element(), 'onload',this, 'handleOnLoad'); | 66 | MochiKit.Signal.connect(this.element(), 'onload',this, 'handleOnLoad'); |
69 | }, | 67 | }, |
70 | 68 | ||
71 | //------------------------------------------------------------------------- | 69 | //------------------------------------------------------------------------- |
72 | 70 | ||
73 | 'setDefaultFavicon': function (anEvent) { | 71 | 'setDefaultFavicon': function (anEvent) { |
74 | MochiKit.Signal.disconnectAll(anEvent.src()); | 72 | MochiKit.Signal.disconnectAll(anEvent.src()); |
75 | this.setSrc(null); | 73 | this.setSrc(null); |
76 | }, | 74 | }, |
77 | 75 | ||
78 | 'handleOnLoad': function (anEvent) { | 76 | 'handleOnLoad': function (anEvent) { |
79 | MochiKit.Signal.disconnectAll(anEvent.src()); | 77 | MochiKit.Signal.disconnectAll(anEvent.src()); |
80 | //console.log("HANDLE ON LOAD", anEvent, anEvent.src().src); | 78 | |
81 | if (anEvent.src().complete == false) { | 79 | if (anEvent.src().complete == false) { |
82 | this.setSrc(null); | 80 | this.setSrc(null); |
83 | } | 81 | } |
84 | }, | 82 | }, |
85 | 83 | ||
86 | //------------------------------------------------------------------------- | 84 | //------------------------------------------------------------------------- |
87 | __syntaxFix__: "syntax fix" | 85 | __syntaxFix__: "syntax fix" |
88 | }); | 86 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js index 2788b79..020290b 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js | |||
@@ -1,161 +1,155 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar = function(args) { | 26 | Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | // this._openFromElement = args.openFromElement || null; | 31 | // this._openFromElement = args.openFromElement || null; |
34 | this._onOkCloseToElement = args.onOkCloseToElement || null; | 32 | this._onOkCloseToElement = args.onOkCloseToElement || null; |
35 | this._onCancelCloseToElement = args.onCancelCloseToElement|| null; | 33 | this._onCancelCloseToElement = args.onCancelCloseToElement|| null; |
36 | 34 | ||
37 | this._canCancelWhileProcessing= ((typeof(args.canCancelWhileProcessing) == 'undefined') ? true : args.canCancelWhileProcessing); | 35 | this._canCancelWhileProcessing= ((typeof(args.canCancelWhileProcessing) == 'undefined') ? true : args.canCancelWhileProcessing); |
38 | 36 | ||
39 | return this; | 37 | return this; |
40 | } | 38 | } |
41 | 39 | ||
42 | //============================================================================= | 40 | //============================================================================= |
43 | 41 | ||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar, Clipperz.PM.UI.Common.Components.SimpleMessagePanel, { | 42 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar, Clipperz.PM.UI.Common.Components.SimpleMessagePanel, { |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
47 | 45 | ||
48 | 'toString': function () { | 46 | 'toString': function () { |
49 | return "Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar component"; | 47 | return "Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar component"; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
53 | /* | 51 | /* |
54 | 'openFromElement': function () { | 52 | 'openFromElement': function () { |
55 | return this._openFromElement; | 53 | return this._openFromElement; |
56 | }, | 54 | }, |
57 | */ | 55 | */ |
58 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
59 | 57 | ||
60 | 'onOkCloseToElement': function () { | 58 | 'onOkCloseToElement': function () { |
61 | return this._onOkCloseToElement; | 59 | return this._onOkCloseToElement; |
62 | }, | 60 | }, |
63 | 61 | ||
64 | 'setOnOkCloseToElement': function (anElement) { | 62 | 'setOnOkCloseToElement': function (anElement) { |
65 | this._onOkCloseToElement = anElement; | 63 | this._onOkCloseToElement = anElement; |
66 | }, | 64 | }, |
67 | 65 | ||
68 | //------------------------------------------------------------------------- | 66 | //------------------------------------------------------------------------- |
69 | 67 | ||
70 | 'onCancelCloseToElement': function () { | 68 | 'onCancelCloseToElement': function () { |
71 | return this._onCancelCloseToElement; | 69 | return this._onCancelCloseToElement; |
72 | }, | 70 | }, |
73 | 71 | ||
74 | 'setOnCancelCloseToElement': function (anElement) { | 72 | 'setOnCancelCloseToElement': function (anElement) { |
75 | this._onCancelCloseToElement = anElement; | 73 | this._onCancelCloseToElement = anElement; |
76 | }, | 74 | }, |
77 | 75 | ||
78 | //------------------------------------------------------------------------- | 76 | //------------------------------------------------------------------------- |
79 | 77 | ||
80 | 'canCancelWhileProcessing': function () { | 78 | 'canCancelWhileProcessing': function () { |
81 | return this._canCancelWhileProcessing; | 79 | return this._canCancelWhileProcessing; |
82 | }, | 80 | }, |
83 | 81 | ||
84 | //------------------------------------------------------------------------- | 82 | //------------------------------------------------------------------------- |
85 | 83 | ||
86 | 'deferredShowModal': function (someArgs, aResult) { | 84 | 'deferredShowModal': function (someArgs, aResult) { |
87 | if (someArgs['onOkCloseToElement'] != null) { | 85 | if (someArgs['onOkCloseToElement'] != null) { |
88 | this.setOnOkCloseToElement(someArgs['onOkCloseToElement']); | 86 | this.setOnOkCloseToElement(someArgs['onOkCloseToElement']); |
89 | } | 87 | } |
90 | 88 | ||
91 | if (someArgs['onCancelCloseToElement'] != null) { | 89 | if (someArgs['onCancelCloseToElement'] != null) { |
92 | this.setOnCancelCloseToElement(someArgs['onCancelCloseToElement']); | 90 | this.setOnCancelCloseToElement(someArgs['onCancelCloseToElement']); |
93 | } | 91 | } |
94 | 92 | ||
95 | Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar.superclass.deferredShowModal.apply(this, arguments); | 93 | Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar.superclass.deferredShowModal.apply(this, arguments); |
96 | return this.deferred(); | 94 | return this.deferred(); |
97 | }, | 95 | }, |
98 | 96 | ||
99 | //------------------------------------------------------------------------- | 97 | //------------------------------------------------------------------------- |
100 | 98 | ||
101 | 'showProgressBar': function () { | 99 | 'showProgressBar': function () { |
102 | varprogressBarElement; | 100 | varprogressBarElement; |
103 | 101 | ||
104 | this.getElement('container').innerHTML = ''; | 102 | this.getElement('container').innerHTML = ''; |
105 | 103 | ||
106 | progressBarElement = this.append(this.getElement('container'), {tag:'div', cls:'progressBarWrapper'}); | 104 | progressBarElement = this.append(this.getElement('container'), {tag:'div', cls:'progressBarWrapper'}); |
107 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':progressBarElement})); | 105 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':progressBarElement})); |
108 | 106 | ||
109 | if (this.canCancelWhileProcessing() == true) { | 107 | if (this.canCancelWhileProcessing() == true) { |
110 | this.setButtons([{text:"Cancel", result:'CANCEL'}]); | 108 | this.setButtons([{text:"Cancel", result:'CANCEL'}]); |
111 | } else { | 109 | } else { |
112 | this.setButtons([]); | 110 | this.setButtons([]); |
113 | } | 111 | } |
114 | }, | 112 | }, |
115 | 113 | ||
116 | //------------------------------------------------------------------------- | 114 | //------------------------------------------------------------------------- |
117 | 115 | ||
118 | 'showFailure': function (someParameters) { | 116 | 'showFailure': function (someParameters) { |
119 | // this.setType('ALERT'); | 117 | // this.setType('ALERT'); |
120 | this.setType(someParameters['type']); | 118 | this.setType(someParameters['type']); |
121 | // this.setTitle("Login failed"); | 119 | // this.setTitle("Login failed"); |
122 | this.setTitle(someParameters['title']); | 120 | this.setTitle(someParameters['title']); |
123 | // this.setText("Wrong passphrase; the unlock has failed."); | 121 | // this.setText("Wrong passphrase; the unlock has failed."); |
124 | this.setText(someParameters['text']); | 122 | this.setText(someParameters['text']); |
125 | // this.getElement('container').innerHTML = ''; | 123 | // this.getElement('container').innerHTML = ''; |
126 | this.getElement('container').innerHTML = ''; | 124 | this.getElement('container').innerHTML = ''; |
127 | // this.setButtons([{text:"Close", result:'CANCEL', isDefault:true}]); | 125 | // this.setButtons([{text:"Close", result:'CANCEL', isDefault:true}]); |
128 | this.setButtons(someParameters['buttons']); | 126 | this.setButtons(someParameters['buttons']); |
129 | }, | 127 | }, |
130 | 128 | ||
131 | //------------------------------------------------------------------------- | 129 | //------------------------------------------------------------------------- |
132 | 130 | ||
133 | 'closeOk': function () { | 131 | 'closeOk': function () { |
134 | //console.log("=== closeOk"); | ||
135 | this.showProgressBar(); | 132 | this.showProgressBar(); |
136 | MochiKit.Async.callLater(0.5, MochiKit.Base.method(this.deferred(), 'callback')); | 133 | MochiKit.Async.callLater(0.5, MochiKit.Base.method(this.deferred(), 'callback')); |
137 | this._deferred = null; | 134 | this._deferred = null; |
138 | }, | 135 | }, |
139 | 136 | ||
140 | 'closeCancel': function () { | 137 | 'closeCancel': function () { |
141 | //console.log("=== closeCancel"); | ||
142 | this.deferredHideModal({closeToElement:this.onCancelCloseToElement()}); | 138 | this.deferredHideModal({closeToElement:this.onCancelCloseToElement()}); |
143 | this.deferred().cancel(); | 139 | this.deferred().cancel(); |
144 | this._deferred = null; | 140 | this._deferred = null; |
145 | }, | 141 | }, |
146 | 142 | ||
147 | //------------------------------------------------------------------------- | 143 | //------------------------------------------------------------------------- |
148 | 144 | ||
149 | 'deferredDone': function () { | 145 | 'deferredDone': function () { |
150 | //console.log("=== deferredDone"); | ||
151 | return this.deferredHideModal({closeToElement:this.onOkCloseToElement()}); | 146 | return this.deferredHideModal({closeToElement:this.onOkCloseToElement()}); |
152 | }, | 147 | }, |
153 | 148 | ||
154 | 'deferredError': function (someParameters) { | 149 | 'deferredError': function (someParameters) { |
155 | //console.log("=== deferredError"); | ||
156 | this.showFailure(someParameters); | 150 | this.showFailure(someParameters); |
157 | }, | 151 | }, |
158 | 152 | ||
159 | //------------------------------------------------------------------------- | 153 | //------------------------------------------------------------------------- |
160 | __syntaxFix__: "syntax fix" | 154 | __syntaxFix__: "syntax fix" |
161 | }); | 155 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js index 089e3d4..78e8c9b 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js | |||
@@ -1,137 +1,122 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay = function(anElement, args) { | 26 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay = function(anElement, args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | //MochiKit.Logging.logDebug(">>> new TextFormField"); | ||
32 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay.superclass.constructor.call(this, anElement, args); | 29 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay.superclass.constructor.call(this, anElement, args); |
33 | 30 | ||
34 | this._wrapperElement = null; | 31 | this._wrapperElement = null; |
35 | this._entropyElement = null; | 32 | this._entropyElement = null; |
36 | 33 | ||
37 | this.render(); | 34 | this.render(); |
38 | //MochiKit.Logging.logDebug("<<< new TextFormField"); | ||
39 | 35 | ||
40 | return this; | 36 | return this; |
41 | }; | 37 | }; |
42 | 38 | ||
43 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay, Clipperz.PM.UI.Common.Components.BaseComponent, { | 39 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay, Clipperz.PM.UI.Common.Components.BaseComponent, { |
44 | 40 | ||
45 | 'toString': function() { | 41 | 'toString': function() { |
46 | return "Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay"; | 42 | return "Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay"; |
47 | }, | 43 | }, |
48 | 44 | ||
49 | //----------------------------------------------------- | 45 | //----------------------------------------------------- |
50 | 46 | ||
51 | 'wrapperElement': function() { | 47 | 'wrapperElement': function() { |
52 | return this._wrapperElement; | 48 | return this._wrapperElement; |
53 | }, | 49 | }, |
54 | 50 | ||
55 | 'setWrapperElement': function(aValue) { | 51 | 'setWrapperElement': function(aValue) { |
56 | this._wrapperElement = aValue; | 52 | this._wrapperElement = aValue; |
57 | }, | 53 | }, |
58 | 54 | ||
59 | //----------------------------------------------------- | 55 | //----------------------------------------------------- |
60 | 56 | ||
61 | 'passwordElement': function() { | 57 | 'passwordElement': function() { |
62 | return this.element(); | 58 | return this.element(); |
63 | }, | 59 | }, |
64 | 60 | ||
65 | //----------------------------------------------------- | 61 | //----------------------------------------------------- |
66 | 62 | ||
67 | 'entropyElement': function() { | 63 | 'entropyElement': function() { |
68 | return this._entropyElement; | 64 | return this._entropyElement; |
69 | }, | 65 | }, |
70 | 66 | ||
71 | 'setEntropyElement': function(aValue) { | 67 | 'setEntropyElement': function(aValue) { |
72 | this._entropyElement = aValue; | 68 | this._entropyElement = aValue; |
73 | }, | 69 | }, |
74 | 70 | ||
75 | //----------------------------------------------------- | 71 | //----------------------------------------------------- |
76 | 72 | ||
77 | 'render': function() { | 73 | 'render': function() { |
78 | /* | 74 | /* |
79 | MochiKit.Signal.disconnectAllTo(this); | 75 | MochiKit.Signal.disconnectAllTo(this); |
80 | 76 | ||
81 | this.setWrapperElement(this.element().wrap({tag:'div'})); | 77 | this.setWrapperElement(this.element().wrap({tag:'div'})); |
82 | this.setEntropyElement(Clipperz.DOM.Helper.append(this.wrapperElement().dom, {tag:'div', cls:'passwordEntropy', html:" "}, true)); | 78 | this.setEntropyElement(Clipperz.DOM.Helper.append(this.wrapperElement().dom, {tag:'div', cls:'passwordEntropy', html:" "}, true)); |
83 | // this.setEntropyElement(Clipperz.DOM.Helper.insertBefore(this.element(), {tag:'div', cls:'passwordEntropy', html:" "}, true)); | 79 | // this.setEntropyElement(Clipperz.DOM.Helper.insertBefore(this.element(), {tag:'div', cls:'passwordEntropy', html:" "}, true)); |
84 | this.entropyElement().wrap({tag:'div', cls:'passwordEntropyWrapper'}); | 80 | this.entropyElement().wrap({tag:'div', cls:'passwordEntropyWrapper'}); |
85 | 81 | ||
86 | this.updateEntropyElement(); | 82 | this.updateEntropyElement(); |
87 | 83 | ||
88 | this.connect('onkeyup', 'updateEntropyElement'); | 84 | this.connect('onkeyup', 'updateEntropyElement'); |
89 | this.connect('onchange', 'updateEntropyElement'); | 85 | this.connect('onchange', 'updateEntropyElement'); |
90 | this.connect('onblur', 'updateEntropyElement'); | 86 | this.connect('onblur', 'updateEntropyElement'); |
91 | */ | 87 | */ |
92 | MochiKit.Signal.disconnectAllTo(this); | 88 | MochiKit.Signal.disconnectAllTo(this); |
93 | 89 | ||
94 | this.setEntropyElement(this.element()); | 90 | this.setEntropyElement(this.element()); |
95 | this.entropyElement().addClass("entropyLevelIndicator"); | 91 | this.entropyElement().addClass("entropyLevelIndicator"); |
96 | 92 | ||
97 | this.updateEntropyElement(); | 93 | this.updateEntropyElement(); |
98 | 94 | ||
99 | this.connect('onkeyup', 'updateEntropyElement'); | 95 | this.connect('onkeyup', 'updateEntropyElement'); |
100 | this.connect('onchange', 'updateEntropyElement'); | 96 | this.connect('onchange', 'updateEntropyElement'); |
101 | this.connect('onblur', 'updateEntropyElement'); | 97 | this.connect('onblur', 'updateEntropyElement'); |
102 | }, | 98 | }, |
103 | 99 | ||
104 | //----------------------------------------------------- | 100 | //----------------------------------------------------- |
105 | 101 | ||
106 | 'computeEntropyForString': function(aValue) { | 102 | 'computeEntropyForString': function(aValue) { |
107 | return Clipperz.PM.Crypto.passwordEntropy(aValue); | 103 | return Clipperz.PM.Crypto.passwordEntropy(aValue); |
108 | }, | 104 | }, |
109 | 105 | ||
110 | //----------------------------------------------------- | 106 | //----------------------------------------------------- |
111 | 107 | ||
112 | 'updateEntropyElement': function(anEvent) { | 108 | 'updateEntropyElement': function(anEvent) { |
113 | /* | ||
114 | //MochiKit.Logging.logDebug(">>> PasswordEntropyDisplay.updateEntropyElement"); | ||
115 | varmaxExtent; | ||
116 | varentropy; | ||
117 | |||
118 | entropy = Math.min(128, this.computeEntropyForString(this.passwordElement().dom.value)); | ||
119 | //MochiKit.Logging.logDebug("--- PasswordEntropyDisplay.updateEntropyElement - entropy: " + entropy); | ||
120 | this.entropyElement().setStyle('background-position', "0px " + -entropy + "px"); | ||
121 | this.entropyElement().setWidth(this.passwordElement().getWidth() * (entropy/128)); | ||
122 | //MochiKit.Logging.logDebug("<<< PasswordEntropyDisplay.updateEntropyElement"); | ||
123 | */ | ||
124 | varentropy; | 109 | varentropy; |
125 | 110 | ||
126 | entropy = Math.min(128, this.computeEntropyForString(this.passwordElement().dom.value)); | 111 | entropy = Math.min(128, this.computeEntropyForString(this.passwordElement().dom.value)); |
127 | 112 | ||
128 | if (entropy == 0) { | 113 | if (entropy == 0) { |
129 | this.entropyElement().setStyle('background-position', "0px 26px"); | 114 | this.entropyElement().setStyle('background-position', "0px 26px"); |
130 | } else { | 115 | } else { |
131 | this.entropyElement().setStyle('background-position', "0px -" + (128-entropy)*26 + "px"); | 116 | this.entropyElement().setStyle('background-position', "0px -" + (128-entropy)*26 + "px"); |
132 | } | 117 | } |
133 | }, | 118 | }, |
134 | 119 | ||
135 | //----------------------------------------------------- | 120 | //----------------------------------------------------- |
136 | __syntaxFix__: '__syntaxFix__' | 121 | __syntaxFix__: '__syntaxFix__' |
137 | }); | 122 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js index 5991530..6638008 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js | |||
@@ -1,70 +1,68 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.ProgressBar = function(args) { | 26 | Clipperz.PM.UI.Common.Components.ProgressBar = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Common.Components.ProgressBar.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Common.Components.ProgressBar.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | 32 | ||
35 | this.renderSelf(); | 33 | this.renderSelf(); |
36 | 34 | ||
37 | MochiKit.Signal.connect(Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController, 'updateProgress', this, 'updateProgressHandler') | 35 | MochiKit.Signal.connect(Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController, 'updateProgress', this, 'updateProgressHandler') |
38 | 36 | ||
39 | return this; | 37 | return this; |
40 | } | 38 | } |
41 | 39 | ||
42 | //============================================================================= | 40 | //============================================================================= |
43 | 41 | ||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.ProgressBar, Clipperz.PM.UI.Common.Components.BaseComponent, { | 42 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.ProgressBar, Clipperz.PM.UI.Common.Components.BaseComponent, { |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
47 | 45 | ||
48 | 'toString': function () { | 46 | 'toString': function () { |
49 | return "Clipperz.PM.UI.Common.Components.ProgressBar component"; | 47 | return "Clipperz.PM.UI.Common.Components.ProgressBar component"; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
53 | 51 | ||
54 | 'renderSelf': function() { | 52 | 'renderSelf': function() { |
55 | this.append(this.element(), {tag:'div', cls:'loadingBar', children:[ | 53 | this.append(this.element(), {tag:'div', cls:'loadingBar', children:[ |
56 | {tag:'div', cls:'loadingBarProgressBox', children:[ | 54 | {tag:'div', cls:'loadingBarProgressBox', children:[ |
57 | {tag:'div', id:this.getId('loadingBarProgress'), cls:'loadingBarProgress'} | 55 | {tag:'div', id:this.getId('loadingBarProgress'), cls:'loadingBarProgress'} |
58 | ]} | 56 | ]} |
59 | ]}); | 57 | ]}); |
60 | }, | 58 | }, |
61 | 59 | ||
62 | //------------------------------------------------------------------------- | 60 | //------------------------------------------------------------------------- |
63 | 61 | ||
64 | 'updateProgressHandler': function (anEvent) { | 62 | 'updateProgressHandler': function (anEvent) { |
65 | MochiKit.Style.setElementDimensions(this.getId('loadingBarProgress'), {w:anEvent}, '%'); | 63 | MochiKit.Style.setElementDimensions(this.getId('loadingBarProgress'), {w:anEvent}, '%'); |
66 | }, | 64 | }, |
67 | 65 | ||
68 | //------------------------------------------------------------------------- | 66 | //------------------------------------------------------------------------- |
69 | __syntaxFix__: "syntax fix" | 67 | __syntaxFix__: "syntax fix" |
70 | }); | 68 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js index 1d816a9..8c98811 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js | |||
@@ -1,297 +1,287 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.SimpleMessagePanel = function(args) { | 26 | Clipperz.PM.UI.Common.Components.SimpleMessagePanel = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Common.Components.SimpleMessagePanel.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Common.Components.SimpleMessagePanel.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._title = args.title || Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._title = args.title || Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | this._type = args.type || Clipperz.Base.exception.raise('MandatoryParameter'); //ALERT, INFO, ERROR | 33 | this._type = args.type || Clipperz.Base.exception.raise('MandatoryParameter'); //ALERT, INFO, ERROR |
36 | this._buttons = args.buttons || Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | this._buttons = args.buttons || Clipperz.Base.exception.raise('MandatoryParameter'); |
37 | 35 | ||
38 | this._buttonComponents = []; | 36 | this._buttonComponents = []; |
39 | this._deferred = null; | 37 | this._deferred = null; |
40 | 38 | ||
41 | this.renderModalMask(); | 39 | this.renderModalMask(); |
42 | 40 | ||
43 | return this; | 41 | return this; |
44 | } | 42 | } |
45 | 43 | ||
46 | //============================================================================= | 44 | //============================================================================= |
47 | 45 | ||
48 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.SimpleMessagePanel, Clipperz.PM.UI.Common.Components.BaseComponent, { | 46 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.SimpleMessagePanel, Clipperz.PM.UI.Common.Components.BaseComponent, { |
49 | 47 | ||
50 | //------------------------------------------------------------------------- | 48 | //------------------------------------------------------------------------- |
51 | 49 | ||
52 | 'toString': function () { | 50 | 'toString': function () { |
53 | return "Clipperz.PM.UI.Common.Components.SimpleMessagePanel component"; | 51 | return "Clipperz.PM.UI.Common.Components.SimpleMessagePanel component"; |
54 | }, | 52 | }, |
55 | 53 | ||
56 | //------------------------------------------------------------------------- | 54 | //------------------------------------------------------------------------- |
57 | 55 | ||
58 | 'deferred': function() { | 56 | 'deferred': function() { |
59 | if (this._deferred == null) { | 57 | if (this._deferred == null) { |
60 | this._deferred = new Clipperz.Async.Deferred("SimpleMessagePanel.deferred", {trace:false}); | 58 | this._deferred = new Clipperz.Async.Deferred("SimpleMessagePanel.deferred", {trace:false}); |
61 | } | 59 | } |
62 | 60 | ||
63 | return this._deferred; | 61 | return this._deferred; |
64 | }, | 62 | }, |
65 | 63 | ||
66 | //------------------------------------------------------------------------- | 64 | //------------------------------------------------------------------------- |
67 | 65 | ||
68 | 'title': function () { | 66 | 'title': function () { |
69 | return this._title; | 67 | return this._title; |
70 | }, | 68 | }, |
71 | 69 | ||
72 | 'setTitle': function (aValue) { | 70 | 'setTitle': function (aValue) { |
73 | this._title = aValue; | 71 | this._title = aValue; |
74 | 72 | ||
75 | if (this.getElement('title') != null) { | 73 | if (this.getElement('title') != null) { |
76 | this.getElement('title').innerHTML = aValue; | 74 | this.getElement('title').innerHTML = aValue; |
77 | } | 75 | } |
78 | }, | 76 | }, |
79 | 77 | ||
80 | //------------------------------------------------------------------------- | 78 | //------------------------------------------------------------------------- |
81 | 79 | ||
82 | 'text': function () { | 80 | 'text': function () { |
83 | return this._text; | 81 | return this._text; |
84 | }, | 82 | }, |
85 | 83 | ||
86 | 'setText': function (aValue) { | 84 | 'setText': function (aValue) { |
87 | this._text = aValue; | 85 | this._text = aValue; |
88 | 86 | ||
89 | if (this.getElement('text') != null) { | 87 | if (this.getElement('text') != null) { |
90 | this.getElement('text').innerHTML = aValue; | 88 | this.getElement('text').innerHTML = aValue; |
91 | } | 89 | } |
92 | }, | 90 | }, |
93 | 91 | ||
94 | //------------------------------------------------------------------------- | 92 | //------------------------------------------------------------------------- |
95 | 93 | ||
96 | 'type': function () { | 94 | 'type': function () { |
97 | return this._type; | 95 | return this._type; |
98 | }, | 96 | }, |
99 | 97 | ||
100 | 'setType': function (aValue) { | 98 | 'setType': function (aValue) { |
101 | // if (this.getElement('icon') != null) { | 99 | // if (this.getElement('icon') != null) { |
102 | // MochiKit.DOM.removeElementClass(this.getId('icon'), this._type); | 100 | // MochiKit.DOM.removeElementClass(this.getId('icon'), this._type); |
103 | // MochiKit.DOM.addElementClass(this.getId('icon'), aValue); | 101 | // MochiKit.DOM.addElementClass(this.getId('icon'), aValue); |
104 | // } | 102 | // } |
105 | 103 | ||
106 | this._type = aValue; | 104 | this._type = aValue; |
107 | }, | 105 | }, |
108 | 106 | ||
109 | 'icon': function () { | 107 | 'icon': function () { |
110 | var type = this.type(); | 108 | var type = this.type(); |
111 | var result; | 109 | var result; |
112 | 110 | ||
113 | if (type == 'ALERT') { | 111 | if (type == 'ALERT') { |
114 | result = '!'; | 112 | result = '!'; |
115 | } else if (type == 'INFO') { | 113 | } else if (type == 'INFO') { |
116 | result = 'i'; | 114 | result = 'i'; |
117 | } else if (type == 'ERROR') { | 115 | } else if (type == 'ERROR') { |
118 | result = '!'; | 116 | result = '!'; |
119 | } | 117 | } |
120 | 118 | ||
121 | return result; | 119 | return result; |
122 | }, | 120 | }, |
123 | 121 | ||
124 | //------------------------------------------------------------------------- | 122 | //------------------------------------------------------------------------- |
125 | 123 | ||
126 | 'buttons': function () { | 124 | 'buttons': function () { |
127 | return this._buttons; | 125 | return this._buttons; |
128 | }, | 126 | }, |
129 | 127 | ||
130 | 'setButtons': function (someValues) { | 128 | 'setButtons': function (someValues) { |
131 | MochiKit.Iter.forEach(this.buttonComponents(), MochiKit.Base.methodcaller('clear')); | 129 | MochiKit.Iter.forEach(this.buttonComponents(), MochiKit.Base.methodcaller('clear')); |
132 | 130 | ||
133 | this._buttons = someValues; | 131 | this._buttons = someValues; |
134 | 132 | ||
135 | if (this.getElement('buttonArea') != null) { | 133 | if (this.getElement('buttonArea') != null) { |
136 | this.renderButtons(); | 134 | this.renderButtons(); |
137 | } | 135 | } |
138 | }, | 136 | }, |
139 | 137 | ||
140 | //......................................................................... | 138 | //......................................................................... |
141 | 139 | ||
142 | 'buttonComponents': function () { | 140 | 'buttonComponents': function () { |
143 | return this._buttonComponents; | 141 | return this._buttonComponents; |
144 | }, | 142 | }, |
145 | 143 | ||
146 | //------------------------------------------------------------------------- | 144 | //------------------------------------------------------------------------- |
147 | 145 | ||
148 | 'renderSelf': function() { | 146 | 'renderSelf': function() { |
149 | this.append(this.element(), {tag:'div', cls:'SimpleMessagePanel', id:this.getId('panel'), children: [ | 147 | this.append(this.element(), {tag:'div', cls:'SimpleMessagePanel', id:this.getId('panel'), children: [ |
150 | // {tag:'div', cls:'header', children:[]}, | 148 | // {tag:'div', cls:'header', children:[]}, |
151 | {tag:'div', cls:'body', children:[ | 149 | {tag:'div', cls:'body', children:[ |
152 | // {tag:'div', id:this.getId('icon'),cls:'img ' + this.type(), children:[{tag:'div'}]}, | 150 | // {tag:'div', id:this.getId('icon'),cls:'img ' + this.type(), children:[{tag:'div'}]}, |
153 | {tag:'div', /*id:this.getId('icon'),*/cls:'img ' + this.type(), children:[{tag:'canvas', id:this.getId('icon')}]}, | 151 | {tag:'div', /*id:this.getId('icon'),*/cls:'img ' + this.type(), children:[{tag:'canvas', id:this.getId('icon')}]}, |
154 | {tag:'h3', id:this.getId('title'),html:this.title()}, | 152 | {tag:'h3', id:this.getId('title'),html:this.title()}, |
155 | {tag:'p', id:this.getId('text'),html:this.text()}, | 153 | {tag:'p', id:this.getId('text'),html:this.text()}, |
156 | {tag:'div', id:this.getId('container')}, | 154 | {tag:'div', id:this.getId('container')}, |
157 | {tag:'div', id:this.getId('buttonArea'), cls:'buttonArea', children:[]} | 155 | {tag:'div', id:this.getId('buttonArea'), cls:'buttonArea', children:[]} |
158 | ]} | 156 | ]} |
159 | // {tag:'div', cls:'footer', children:[]} | 157 | // {tag:'div', cls:'footer', children:[]} |
160 | ]}); | 158 | ]}); |
161 | 159 | ||
162 | Clipperz.PM.UI.Canvas.marks[this.icon()](this.getElement('icon'), "#ffffff"); | 160 | Clipperz.PM.UI.Canvas.marks[this.icon()](this.getElement('icon'), "#ffffff"); |
163 | 161 | ||
164 | MochiKit.Signal.connect(this.getId('panel'), 'onkeydown', this, 'keyDownHandler'); | 162 | MochiKit.Signal.connect(this.getId('panel'), 'onkeydown', this, 'keyDownHandler'); |
165 | 163 | ||
166 | this.renderButtons(); | 164 | this.renderButtons(); |
167 | }, | 165 | }, |
168 | 166 | ||
169 | //------------------------------------------------------------------------- | 167 | //------------------------------------------------------------------------- |
170 | 168 | ||
171 | 'renderButtons': function () { | 169 | 'renderButtons': function () { |
172 | this.getElement('buttonArea').innerHTML = ''; | 170 | this.getElement('buttonArea').innerHTML = ''; |
173 | 171 | ||
174 | MochiKit.Base.map(MochiKit.Base.bind(function (aButton) { | 172 | MochiKit.Base.map(MochiKit.Base.bind(function (aButton) { |
175 | var buttonElement; | 173 | var buttonElement; |
176 | var buttonComponent; | 174 | var buttonComponent; |
177 | 175 | ||
178 | // element = this.append(this.getElement('buttonArea'), {tag:'div', cls:'button' + (aButton['isDefault'] === true ? ' default' : ''), children:[ | 176 | // element = this.append(this.getElement('buttonArea'), {tag:'div', cls:'button' + (aButton['isDefault'] === true ? ' default' : ''), children:[ |
179 | // {tag:'a', href:'#'/*, id:this.getId('buttonLink')*/, html:aButton['text']} | 177 | // {tag:'a', href:'#'/*, id:this.getId('buttonLink')*/, html:aButton['text']} |
180 | // ]}); | 178 | // ]}); |
181 | 179 | ||
182 | buttonElement = this.append(this.getElement('buttonArea'), {tag:'div'}); | 180 | buttonElement = this.append(this.getElement('buttonArea'), {tag:'div'}); |
183 | buttonComponent = new Clipperz.PM.UI.Common.Components.Button({'element':buttonElement, 'text':aButton['text'], 'isDefault':aButton['isDefault']}); | 181 | buttonComponent = new Clipperz.PM.UI.Common.Components.Button({'element':buttonElement, 'text':aButton['text'], 'isDefault':aButton['isDefault']}); |
184 | this.buttonComponents().push(buttonComponent); | 182 | this.buttonComponents().push(buttonComponent); |
185 | 183 | ||
186 | MochiKit.Signal.connect(buttonComponent, 'onclick', MochiKit.Base.method(this, 'buttonEventHandler', aButton)); | 184 | MochiKit.Signal.connect(buttonComponent, 'onclick', MochiKit.Base.method(this, 'buttonEventHandler', aButton)); |
187 | }, this), MochiKit.Iter.reversed(this.buttons())); | 185 | }, this), MochiKit.Iter.reversed(this.buttons())); |
188 | }, | 186 | }, |
189 | 187 | ||
190 | //------------------------------------------------------------------------- | 188 | //------------------------------------------------------------------------- |
191 | 189 | ||
192 | 'displayElement': function() { | 190 | 'displayElement': function() { |
193 | return this.getElement('panel'); | 191 | return this.getElement('panel'); |
194 | }, | 192 | }, |
195 | 193 | ||
196 | //------------------------------------------------------------------------- | 194 | //------------------------------------------------------------------------- |
197 | 195 | ||
198 | 'closeOk': function () { | 196 | 'closeOk': function () { |
199 | this.deferred().callback(); | 197 | this.deferred().callback(); |
200 | this._deferred = null; | 198 | this._deferred = null; |
201 | }, | 199 | }, |
202 | 200 | ||
203 | 'closeCancel': function () { | 201 | 'closeCancel': function () { |
204 | this.deferred().cancel(); | 202 | this.deferred().cancel(); |
205 | this._deferred = null; | 203 | this._deferred = null; |
206 | }, | 204 | }, |
207 | 205 | ||
208 | 'closeError': function () { | 206 | 'closeError': function () { |
209 | this.deferred().errback(); | 207 | this.deferred().errback(); |
210 | this._deferred = null; | 208 | this._deferred = null; |
211 | }, | 209 | }, |
212 | 210 | ||
213 | //------------------------------------------------------------------------- | 211 | //------------------------------------------------------------------------- |
214 | 212 | ||
215 | 'buttonEventHandler': function(aButton, anEvent) { | 213 | 'buttonEventHandler': function(aButton, anEvent) { |
216 | anEvent.preventDefault(); | 214 | anEvent.preventDefault(); |
217 | 215 | ||
218 | // MochiKit.Signal.signal(this, 'cancelEvent'); | 216 | // MochiKit.Signal.signal(this, 'cancelEvent'); |
219 | switch (aButton['result']) { | 217 | switch (aButton['result']) { |
220 | case 'OK': | 218 | case 'OK': |
221 | //console.log("==> OK"); | ||
222 | this.closeOk(); | 219 | this.closeOk(); |
223 | break; | 220 | break; |
224 | case 'CANCEL': | 221 | case 'CANCEL': |
225 | //console.log("==> CANCEL"); | ||
226 | this.closeCancel(); | 222 | this.closeCancel(); |
227 | break; | 223 | break; |
228 | default: | 224 | default: |
229 | //console.log("==> ????"); | ||
230 | this.closeError(); | 225 | this.closeError(); |
231 | break; | 226 | break; |
232 | } | 227 | } |
233 | //console.log("<=="); | ||
234 | }, | 228 | }, |
235 | 229 | ||
236 | //------------------------------------------------------------------------- | 230 | //------------------------------------------------------------------------- |
237 | 231 | ||
238 | 'deferredShow': function (someArgs, aResult) { | 232 | 'deferredShow': function (someArgs, aResult) { |
239 | this.deferredShowModal(someArgs); | 233 | this.deferredShowModal(someArgs); |
240 | 234 | ||
241 | this.deferred().addMethod(this, 'deferredHideModal', {closeToElement:someArgs.onOkCloseToElement }); | 235 | this.deferred().addMethod(this, 'deferredHideModal', {closeToElement:someArgs.onOkCloseToElement }); |
242 | this.deferred().addErrback (MochiKit.Base.method(this, 'deferredHideModal', {closeToElement:someArgs.onCancelCloseToElement })); | 236 | this.deferred().addErrback (MochiKit.Base.method(this, 'deferredHideModal', {closeToElement:someArgs.onCancelCloseToElement })); |
243 | this.deferred().addCallback(MochiKit.Async.succeed, aResult); | 237 | this.deferred().addCallback(MochiKit.Async.succeed, aResult); |
244 | 238 | ||
245 | return this.deferred(); | 239 | return this.deferred(); |
246 | }, | 240 | }, |
247 | 241 | ||
248 | //------------------------------------------------------------------------- | 242 | //------------------------------------------------------------------------- |
249 | 243 | ||
250 | 'modalDialogMask': function () { | 244 | 'modalDialogMask': function () { |
251 | return this.getId('modalDialogMask'); | 245 | return this.getId('modalDialogMask'); |
252 | }, | 246 | }, |
253 | 247 | ||
254 | 'modalDialog': function () { | 248 | 'modalDialog': function () { |
255 | return this.getId('modalDialog'); | 249 | return this.getId('modalDialog'); |
256 | }, | 250 | }, |
257 | 251 | ||
258 | 'modalDialogFrame': function() { | 252 | 'modalDialogFrame': function() { |
259 | return this.getId('modalDialogFrame'); | 253 | return this.getId('modalDialogFrame'); |
260 | }, | 254 | }, |
261 | 255 | ||
262 | //------------------------------------------------------------------------- | 256 | //------------------------------------------------------------------------- |
263 | 257 | ||
264 | 'renderModalMask': function () { | 258 | 'renderModalMask': function () { |
265 | Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body, | 259 | Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body, |
266 | {tag:'div', id:this.getId('modalDialogWrapper'), cls:'modalDialogWrapper simpleMessagePanelMask', children:[ | 260 | {tag:'div', id:this.getId('modalDialogWrapper'), cls:'modalDialogWrapper simpleMessagePanelMask', children:[ |
267 | {tag:'div', id:this.getId('modalDialogMask'), cls:'modalDialogMask simpleMessagePanelMask'}, | 261 | {tag:'div', id:this.getId('modalDialogMask'), cls:'modalDialogMask simpleMessagePanelMask'}, |
268 | {tag:'div', id:this.getId('modalDialogFrame'), cls:'modalDialogFrame simpleMessagePanelMask'}, | 262 | {tag:'div', id:this.getId('modalDialogFrame'), cls:'modalDialogFrame simpleMessagePanelMask'}, |
269 | {tag:'div', id:this.getId('modalDialog'), cls:'modalDialog simpleMessagePanelMask'} | 263 | {tag:'div', id:this.getId('modalDialog'), cls:'modalDialog simpleMessagePanelMask'} |
270 | ]} | 264 | ]} |
271 | ); | 265 | ); |
272 | 266 | ||
273 | MochiKit.Style.hideElement(this.getId('modalDialogMask')); | 267 | MochiKit.Style.hideElement(this.getId('modalDialogMask')); |
274 | MochiKit.Style.hideElement(this.getId('modalDialogFrame')); | 268 | MochiKit.Style.hideElement(this.getId('modalDialogFrame')); |
275 | }, | 269 | }, |
276 | 270 | ||
277 | //------------------------------------------------------------------------- | 271 | //------------------------------------------------------------------------- |
278 | 272 | ||
279 | 'keyDownHandler': function (anEvent) { | 273 | 'keyDownHandler': function (anEvent) { |
280 | if (anEvent.key().string == 'KEY_ENTER') { | 274 | if (anEvent.key().string == 'KEY_ENTER') { |
281 | anEvent.preventDefault(); | 275 | anEvent.preventDefault(); |
282 | //console.log("13 - RETURN ?", this); | ||
283 | this.closeOk(); | 276 | this.closeOk(); |
284 | //console.log('<<< 13') | ||
285 | } | 277 | } |
286 | 278 | ||
287 | if (anEvent.key().string == 'KEY_ESCAPE') { | 279 | if (anEvent.key().string == 'KEY_ESCAPE') { |
288 | anEvent.preventDefault(); | 280 | anEvent.preventDefault(); |
289 | //console.log("27 - ESC ?", this); | ||
290 | this.closeCancel(); | 281 | this.closeCancel(); |
291 | //console.log("<<< 27"); | ||
292 | } | 282 | } |
293 | }, | 283 | }, |
294 | 284 | ||
295 | //------------------------------------------------------------------------- | 285 | //------------------------------------------------------------------------- |
296 | __syntaxFix__: "syntax fix" | 286 | __syntaxFix__: "syntax fix" |
297 | }); | 287 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js index 936514a..1e2a690 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js | |||
@@ -1,66 +1,64 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.TabPanelComponent = function(args) { | 26 | Clipperz.PM.UI.Common.Components.TabPanelComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | Clipperz.PM.UI.Common.Components.TabPanelComponent.superclass.constructor.call(this, args); | 28 | Clipperz.PM.UI.Common.Components.TabPanelComponent.superclass.constructor.call(this, args); |
31 | 29 | ||
32 | this._tabPanelController = null; | 30 | this._tabPanelController = null; |
33 | 31 | ||
34 | return this; | 32 | return this; |
35 | } | 33 | } |
36 | 34 | ||
37 | //============================================================================= | 35 | //============================================================================= |
38 | 36 | ||
39 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.TabPanelComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 37 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.TabPanelComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { |
40 | 38 | ||
41 | 'toString': function () { | 39 | 'toString': function () { |
42 | return "Clipperz.PM.UI.Common.Components.TabPanelComponent component"; | 40 | return "Clipperz.PM.UI.Common.Components.TabPanelComponent component"; |
43 | }, | 41 | }, |
44 | 42 | ||
45 | //------------------------------------------------------------------------- | 43 | //------------------------------------------------------------------------- |
46 | 44 | ||
47 | 'tabPanelControllerConfiguration': function() { | 45 | 'tabPanelControllerConfiguration': function() { |
48 | return this._tabPanelControllerConfiguration; | 46 | return this._tabPanelControllerConfiguration; |
49 | }, | 47 | }, |
50 | 48 | ||
51 | 'tabPanelController': function() { | 49 | 'tabPanelController': function() { |
52 | if (this._tabPanelController == null) { | 50 | if (this._tabPanelController == null) { |
53 | this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({component:this, configuration:this.tabPanelControllerConfiguration()}); | 51 | this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({component:this, configuration:this.tabPanelControllerConfiguration()}); |
54 | } | 52 | } |
55 | 53 | ||
56 | return this._tabPanelController; | 54 | return this._tabPanelController; |
57 | }, | 55 | }, |
58 | 56 | ||
59 | 'initiallySelectedTab': function() { | 57 | 'initiallySelectedTab': function() { |
60 | return this._initiallySelectedTab; | 58 | return this._initiallySelectedTab; |
61 | }, | 59 | }, |
62 | 60 | ||
63 | //------------------------------------------------------------------------- | 61 | //------------------------------------------------------------------------- |
64 | __syntaxFix__: "syntax fix" | 62 | __syntaxFix__: "syntax fix" |
65 | 63 | ||
66 | }); | 64 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js index 8df7e0e..6517d2a 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js | |||
@@ -1,214 +1,205 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.Tooltip = function(args) { | 26 | Clipperz.PM.UI.Common.Components.Tooltip = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Common.Components.Tooltip.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Common.Components.Tooltip.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | this._position = args.position || 'BELOW'; //'BELOW', 'ABOVE', 'LEFT', 'RIGHT' | 33 | this._position = args.position || 'BELOW'; //'BELOW', 'ABOVE', 'LEFT', 'RIGHT' |
36 | 34 | ||
37 | this._boxDimensions = null; | 35 | this._boxDimensions = null; |
38 | this._enabled = (typeof(args.enabled) == 'undefined' ? true : args.enabled); | 36 | this._enabled = (typeof(args.enabled) == 'undefined' ? true : args.enabled); |
39 | this._isVisible = false; | 37 | this._isVisible = false; |
40 | 38 | ||
41 | this.renderSelf(); | 39 | this.renderSelf(); |
42 | 40 | ||
43 | return this; | 41 | return this; |
44 | } | 42 | } |
45 | 43 | ||
46 | //============================================================================= | 44 | //============================================================================= |
47 | 45 | ||
48 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Tooltip, Clipperz.PM.UI.Common.Components.BaseComponent, { | 46 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Tooltip, Clipperz.PM.UI.Common.Components.BaseComponent, { |
49 | 47 | ||
50 | //------------------------------------------------------------------------- | 48 | //------------------------------------------------------------------------- |
51 | 49 | ||
52 | 'toString': function () { | 50 | 'toString': function () { |
53 | return "Clipperz.PM.UI.Common.Components.Tooltip component"; | 51 | return "Clipperz.PM.UI.Common.Components.Tooltip component"; |
54 | }, | 52 | }, |
55 | 53 | ||
56 | //------------------------------------------------------------------------- | 54 | //------------------------------------------------------------------------- |
57 | 55 | ||
58 | 'text': function () { | 56 | 'text': function () { |
59 | return this._text; | 57 | return this._text; |
60 | }, | 58 | }, |
61 | 59 | ||
62 | 'setText': function (aValue) { | 60 | 'setText': function (aValue) { |
63 | this._text = aValue; | 61 | this._text = aValue; |
64 | }, | 62 | }, |
65 | 63 | ||
66 | //------------------------------------------------------------------------- | 64 | //------------------------------------------------------------------------- |
67 | 65 | ||
68 | 'position': function () { | 66 | 'position': function () { |
69 | return this._position; | 67 | return this._position; |
70 | }, | 68 | }, |
71 | 69 | ||
72 | 'setPosition': function (aValue) { | 70 | 'setPosition': function (aValue) { |
73 | this._position = aValue; | 71 | this._position = aValue; |
74 | }, | 72 | }, |
75 | 73 | ||
76 | //------------------------------------------------------------------------- | 74 | //------------------------------------------------------------------------- |
77 | 75 | ||
78 | 'enabled': function () { | 76 | 'enabled': function () { |
79 | return this._enabled; | 77 | return this._enabled; |
80 | }, | 78 | }, |
81 | 79 | ||
82 | 'setIsEnabled': function (aValue) { | 80 | 'setIsEnabled': function (aValue) { |
83 | this._enabled = aValue; | 81 | this._enabled = aValue; |
84 | }, | 82 | }, |
85 | 83 | ||
86 | //------------------------------------------------------------------------- | 84 | //------------------------------------------------------------------------- |
87 | 85 | ||
88 | 'isVisible': function () { | 86 | 'isVisible': function () { |
89 | return this._isVisible; | 87 | return this._isVisible; |
90 | }, | 88 | }, |
91 | 89 | ||
92 | 'setIsVisible': function (aValue) { | 90 | 'setIsVisible': function (aValue) { |
93 | this._isVisible = aValue; | 91 | this._isVisible = aValue; |
94 | }, | 92 | }, |
95 | 93 | ||
96 | //------------------------------------------------------------------------- | 94 | //------------------------------------------------------------------------- |
97 | 95 | ||
98 | 'renderSelf': function() { | 96 | 'renderSelf': function() { |
99 | // this.append(this.element(), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ | 97 | // this.append(this.element(), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ |
100 | // this.append(MochiKit.DOM.currentDocument().body, {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ | 98 | // this.append(MochiKit.DOM.currentDocument().body, {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ |
101 | this.append(MochiKit.DOM.getElement('Clipperz_PM_UI_Common_Components_Tooltip_wrapperNode'), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ | 99 | this.append(MochiKit.DOM.getElement('Clipperz_PM_UI_Common_Components_Tooltip_wrapperNode'), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ |
102 | {tag:'div', id:this.getId('body'), cls:'tooltip_body', children:[ | 100 | {tag:'div', id:this.getId('body'), cls:'tooltip_body', children:[ |
103 | {tag:'div', cls:'tooltip_text', children:[ | 101 | {tag:'div', cls:'tooltip_text', children:[ |
104 | {tag:'span', html:this.text()} | 102 | {tag:'span', html:this.text()} |
105 | ]}//, | 103 | ]}//, |
106 | // {tag:'div', id:this.getId('footer'), cls:'tooltip_footer'} | 104 | // {tag:'div', id:this.getId('footer'), cls:'tooltip_footer'} |
107 | ]}, | 105 | ]}, |
108 | {tag:'div', id:this.getId('arrow'), cls:'tooltip_arrow'} | 106 | {tag:'div', id:this.getId('arrow'), cls:'tooltip_arrow'} |
109 | ]}); | 107 | ]}); |
110 | 108 | ||
111 | this._boxDimensions = MochiKit.Style.getElementDimensions(this.getId('body')); | 109 | this._boxDimensions = MochiKit.Style.getElementDimensions(this.getId('body')); |
112 | // this._boxDimensions.h += MochiKit.Style.getElementDimensions(this.getId('footer')).h; | 110 | // this._boxDimensions.h += MochiKit.Style.getElementDimensions(this.getId('footer')).h; |
113 | 111 | ||
114 | MochiKit.Style.hideElement(this.displayElement()); | 112 | MochiKit.Style.hideElement(this.displayElement()); |
115 | MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); | 113 | MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); |
116 | MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); | 114 | MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); |
117 | }, | 115 | }, |
118 | 116 | ||
119 | //----------------------------------------------------- | 117 | //----------------------------------------------------- |
120 | 118 | ||
121 | 'displayElement': function() { | 119 | 'displayElement': function() { |
122 | return this.getElement('tooltip'); | 120 | return this.getElement('tooltip'); |
123 | }, | 121 | }, |
124 | 122 | ||
125 | //------------------------------------------------------------------------- | 123 | //------------------------------------------------------------------------- |
126 | 124 | ||
127 | 'boxDimensions': function () { | 125 | 'boxDimensions': function () { |
128 | return this._boxDimensions; | 126 | return this._boxDimensions; |
129 | }, | 127 | }, |
130 | 128 | ||
131 | //------------------------------------------------------------------------- | 129 | //------------------------------------------------------------------------- |
132 | 130 | ||
133 | 'show': function () { | 131 | 'show': function () { |
134 | var elementSizeAndPosition; | 132 | var elementSizeAndPosition; |
135 | var arrowPosition; | 133 | var arrowPosition; |
136 | var bodyPosition; | 134 | var bodyPosition; |
137 | 135 | ||
138 | if (this.isVisible() == false) { | 136 | if (this.isVisible() == false) { |
139 | arrowPosition = {}; | 137 | arrowPosition = {}; |
140 | bodyPosition = {}; | 138 | bodyPosition = {}; |
141 | 139 | ||
142 | this.setIsVisible(true); | 140 | this.setIsVisible(true); |
143 | elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element()); | 141 | elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element()); |
144 | //console.log("ELEMENT SIZE AND POSITION", Clipperz.Base.serializeJSON(elementSizeAndPosition)); | ||
145 | //console.log("BOX DIMENSIONS", Clipperz.Base.serializeJSON(this.boxDimensions())); | ||
146 | switch (this.position()) { | 142 | switch (this.position()) { |
147 | case 'ABOVE': | 143 | case 'ABOVE': |
148 | //console.log("ABOVE"); | ||
149 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); | 144 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); |
150 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); | 145 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); |
151 | bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13; | 146 | bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13; |
152 | 147 | ||
153 | // arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); | 148 | // arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); |
154 | // arrowPosition.y = elementSizeAndPosition.position.y - 13; | 149 | // arrowPosition.y = elementSizeAndPosition.position.y - 13; |
155 | break; | 150 | break; |
156 | case 'BELOW': | 151 | case 'BELOW': |
157 | //console.log("BELOW"); | ||
158 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); | 152 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); |
159 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); | 153 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); |
160 | bodyPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h + 13; | 154 | bodyPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h + 13; |
161 | 155 | ||
162 | // arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); | 156 | // arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); |
163 | // arrowPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h; | 157 | // arrowPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h; |
164 | break; | 158 | break; |
165 | case 'LEFT': | 159 | case 'LEFT': |
166 | //console.log("LEFT"); | ||
167 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); | 160 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); |
168 | bodyPosition.x = elementSizeAndPosition.position.x - this.boxDimensions().w - 13; | 161 | bodyPosition.x = elementSizeAndPosition.position.x - this.boxDimensions().w - 13; |
169 | bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); | 162 | bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); |
170 | 163 | ||
171 | // arrowPosition.x = elementSizeAndPosition.position.x -13; | 164 | // arrowPosition.x = elementSizeAndPosition.position.x -13; |
172 | // arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); | 165 | // arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); |
173 | break; | 166 | break; |
174 | case 'RIGHT': | 167 | case 'RIGHT': |
175 | //console.log("RIGHT"); | ||
176 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); | 168 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); |
177 | bodyPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w + 13; | 169 | bodyPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w + 13; |
178 | bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); | 170 | bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); |
179 | 171 | ||
180 | // arrowPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w; | 172 | // arrowPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w; |
181 | // arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); | 173 | // arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); |
182 | break; | 174 | break; |
183 | } | 175 | } |
184 | //console.log("X: " + bodyPosition.x + ", Y: " + bodyPosition.y); | ||
185 | 176 | ||
186 | MochiKit.Style.setElementPosition(this.getId('tooltip'), bodyPosition); | 177 | MochiKit.Style.setElementPosition(this.getId('tooltip'), bodyPosition); |
187 | // MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); | 178 | // MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); |
188 | // MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition); | 179 | // MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition); |
189 | MochiKit.Visual.appear(this.displayElement(), {duration:0.4}); | 180 | MochiKit.Visual.appear(this.displayElement(), {duration:0.4}); |
190 | } | 181 | } |
191 | }, | 182 | }, |
192 | 183 | ||
193 | 'hide': function () { | 184 | 'hide': function () { |
194 | if (this.isVisible() == true) { | 185 | if (this.isVisible() == true) { |
195 | MochiKit.Visual.fade(this.displayElement(), {duration:0.4}); | 186 | MochiKit.Visual.fade(this.displayElement(), {duration:0.4}); |
196 | this.setIsVisible(false); | 187 | this.setIsVisible(false); |
197 | } | 188 | } |
198 | }, | 189 | }, |
199 | 190 | ||
200 | //------------------------------------------------------------------------- | 191 | //------------------------------------------------------------------------- |
201 | /* | 192 | /* |
202 | 'shouldRemoveElementWhenClearningUp': function () { | 193 | 'shouldRemoveElementWhenClearningUp': function () { |
203 | return false; | 194 | return false; |
204 | }, | 195 | }, |
205 | */ | 196 | */ |
206 | //------------------------------------------------------------------------- | 197 | //------------------------------------------------------------------------- |
207 | __syntaxFix__: "syntax fix" | 198 | __syntaxFix__: "syntax fix" |
208 | }); | 199 | }); |
209 | 200 | ||
210 | Clipperz.PM.UI.Common.Components.Tooltip.initTooltips = function () { | 201 | Clipperz.PM.UI.Common.Components.Tooltip.initTooltips = function () { |
211 | Clipperz.DOM.Helper.insertBefore(MochiKit.DOM.currentDocument().body.childNodes[0], {tag:'div', id:'Clipperz_PM_UI_Common_Components_Tooltip_wrapperNode'}); | 202 | Clipperz.DOM.Helper.insertBefore(MochiKit.DOM.currentDocument().body.childNodes[0], {tag:'div', id:'Clipperz_PM_UI_Common_Components_Tooltip_wrapperNode'}); |
212 | } | 203 | } |
213 | 204 | ||
214 | MochiKit.DOM.addLoadEvent(Clipperz.PM.UI.Common.Components.Tooltip.initTooltips); | 205 | MochiKit.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 index c41fc7c..ba58edd 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js | |||
@@ -1,167 +1,165 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.TranslatorWidget = function(args) { | 26 | Clipperz.PM.UI.Common.Components.TranslatorWidget = function(args) { |
29 | Clipperz.log(">>> TranslatorWidget.new"); | 27 | Clipperz.log(">>> TranslatorWidget.new"); |
30 | args = args || {}; | 28 | args = args || {}; |
31 | 29 | ||
32 | Clipperz.PM.UI.Common.Components.TranslatorWidget.superclass.constructor.apply(this, arguments); | 30 | Clipperz.PM.UI.Common.Components.TranslatorWidget.superclass.constructor.apply(this, arguments); |
33 | 31 | ||
34 | // this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | // this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | // this._stringID = args.stringID || MochiKit.DOM.getNodeAttribute(this.element(), 'stringID')|| Clipperz.Base.exception.raise('MandatoryParameter'); | 33 | // this._stringID = args.stringID || MochiKit.DOM.getNodeAttribute(this.element(), 'stringID')|| Clipperz.Base.exception.raise('MandatoryParameter'); |
36 | 34 | ||
37 | //MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); | 35 | //MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); |
38 | //MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); | 36 | //MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); |
39 | 37 | ||
40 | Clipperz.log("<<< TranslatorWidget.new"); | 38 | Clipperz.log("<<< TranslatorWidget.new"); |
41 | return this; | 39 | return this; |
42 | } | 40 | } |
43 | 41 | ||
44 | //============================================================================= | 42 | //============================================================================= |
45 | 43 | ||
46 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.TranslatorWidget, Clipperz.PM.UI.Common.Components.BaseComponent, { | 44 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.TranslatorWidget, Clipperz.PM.UI.Common.Components.BaseComponent, { |
47 | 45 | ||
48 | //------------------------------------------------------------------------- | 46 | //------------------------------------------------------------------------- |
49 | 47 | ||
50 | 'toString': function () { | 48 | 'toString': function () { |
51 | return "Clipperz.PM.UI.Common.Components.TranslatorWidget component"; | 49 | return "Clipperz.PM.UI.Common.Components.TranslatorWidget component"; |
52 | }, | 50 | }, |
53 | 51 | ||
54 | //------------------------------------------------------------------------- | 52 | //------------------------------------------------------------------------- |
55 | /* | 53 | /* |
56 | 'renderSelf': function() { | 54 | 'renderSelf': function() { |
57 | this.append(this.element(), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ | 55 | this.append(this.element(), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ |
58 | {tag:'div', id:this.getId('body'), cls:'tooltip_body', children:[ | 56 | {tag:'div', id:this.getId('body'), cls:'tooltip_body', children:[ |
59 | {tag:'div', cls:'tooltip_text', children:[ | 57 | {tag:'div', cls:'tooltip_text', children:[ |
60 | {tag:'span', html:this.text()} | 58 | {tag:'span', html:this.text()} |
61 | ]}, | 59 | ]}, |
62 | {tag:'div', id:this.getId('footer'), cls:'tooltip_footer'} | 60 | {tag:'div', id:this.getId('footer'), cls:'tooltip_footer'} |
63 | ]}, | 61 | ]}, |
64 | {tag:'div', id:this.getId('arrow'), cls:'tooltip_arrow'} | 62 | {tag:'div', id:this.getId('arrow'), cls:'tooltip_arrow'} |
65 | ]}); | 63 | ]}); |
66 | 64 | ||
67 | this._boxDimensions = MochiKit.Style.getElementDimensions(this.getId('body')); | 65 | this._boxDimensions = MochiKit.Style.getElementDimensions(this.getId('body')); |
68 | // this._boxDimensions.h += MochiKit.Style.getElementDimensions(this.getId('footer')).h; | 66 | // this._boxDimensions.h += MochiKit.Style.getElementDimensions(this.getId('footer')).h; |
69 | 67 | ||
70 | MochiKit.Style.hideElement(this.displayElement()); | 68 | MochiKit.Style.hideElement(this.displayElement()); |
71 | MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); | 69 | MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); |
72 | MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); | 70 | MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); |
73 | }, | 71 | }, |
74 | */ | 72 | */ |
75 | //----------------------------------------------------- | 73 | //----------------------------------------------------- |
76 | /* | 74 | /* |
77 | 'displayElement': function() { | 75 | 'displayElement': function() { |
78 | return this.getElement('tooltip'); | 76 | return this.getElement('tooltip'); |
79 | }, | 77 | }, |
80 | */ | 78 | */ |
81 | //------------------------------------------------------------------------- | 79 | //------------------------------------------------------------------------- |
82 | /* | 80 | /* |
83 | 'boxDimensions': function () { | 81 | 'boxDimensions': function () { |
84 | return this._boxDimensions; | 82 | return this._boxDimensions; |
85 | }, | 83 | }, |
86 | */ | 84 | */ |
87 | //------------------------------------------------------------------------- | 85 | //------------------------------------------------------------------------- |
88 | 86 | ||
89 | 'show': function (anElement, aStringID) { | 87 | 'show': function (anElement, aStringID) { |
90 | Clipperz.log(">>> Clipperz.PM.UI.Common.Components.TranslatorWidget.show: " + aStringID); | 88 | Clipperz.log(">>> Clipperz.PM.UI.Common.Components.TranslatorWidget.show: " + aStringID); |
91 | /* | 89 | /* |
92 | var elementSizeAndPosition; | 90 | var elementSizeAndPosition; |
93 | var arrowPosition; | 91 | var arrowPosition; |
94 | var bodyPosition; | 92 | var bodyPosition; |
95 | 93 | ||
96 | arrowPosition = {}; | 94 | arrowPosition = {}; |
97 | bodyPosition = {}; | 95 | bodyPosition = {}; |
98 | 96 | ||
99 | elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element()); | 97 | elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element()); |
100 | switch (this.position()) { | 98 | switch (this.position()) { |
101 | case 'ABOVE': | 99 | case 'ABOVE': |
102 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); | 100 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); |
103 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); | 101 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); |
104 | bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13; | 102 | bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13; |
105 | 103 | ||
106 | arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); | 104 | arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); |
107 | arrowPosition.y = elementSizeAndPosition.position.y - 13; | 105 | arrowPosition.y = elementSizeAndPosition.position.y - 13; |
108 | break; | 106 | break; |
109 | case 'BELOW': | 107 | case 'BELOW': |
110 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); | 108 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); |
111 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); | 109 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); |
112 | bodyPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h + 13; | 110 | bodyPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h + 13; |
113 | 111 | ||
114 | arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); | 112 | arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); |
115 | arrowPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h; | 113 | arrowPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h; |
116 | break; | 114 | break; |
117 | case 'LEFT': | 115 | case 'LEFT': |
118 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); | 116 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); |
119 | bodyPosition.x = elementSizeAndPosition.position.x - this.boxDimensions().w - 13; | 117 | bodyPosition.x = elementSizeAndPosition.position.x - this.boxDimensions().w - 13; |
120 | bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); | 118 | bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); |
121 | 119 | ||
122 | arrowPosition.x = elementSizeAndPosition.position.x -13; | 120 | arrowPosition.x = elementSizeAndPosition.position.x -13; |
123 | arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); | 121 | arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); |
124 | break; | 122 | break; |
125 | case 'RIGHT': | 123 | case 'RIGHT': |
126 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); | 124 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); |
127 | break; | 125 | break; |
128 | } | 126 | } |
129 | 127 | ||
130 | // MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); | 128 | // MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); |
131 | MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); | 129 | MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); |
132 | MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition); | 130 | MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition); |
133 | MochiKit.Visual.appear(this.displayElement(), {duration:0.4}); | 131 | MochiKit.Visual.appear(this.displayElement(), {duration:0.4}); |
134 | */ | 132 | */ |
135 | }, | 133 | }, |
136 | 134 | ||
137 | //------------------------------------------------------------------------- | 135 | //------------------------------------------------------------------------- |
138 | 136 | ||
139 | 'hide': function () { | 137 | 'hide': function () { |
140 | Clipperz.log("<<< Clipperz.PM.UI.Common.Components.TranslatorWidget.hide"); | 138 | Clipperz.log("<<< Clipperz.PM.UI.Common.Components.TranslatorWidget.hide"); |
141 | // MochiKit.Visual.fade(this.displayElement(), {duration:0.4}); | 139 | // MochiKit.Visual.fade(this.displayElement(), {duration:0.4}); |
142 | }, | 140 | }, |
143 | 141 | ||
144 | //------------------------------------------------------------------------- | 142 | //------------------------------------------------------------------------- |
145 | __syntaxFix__: "syntax fix" | 143 | __syntaxFix__: "syntax fix" |
146 | }); | 144 | }); |
147 | 145 | ||
148 | //############################################################################# | 146 | //############################################################################# |
149 | 147 | ||
150 | Clipperz.PM.UI.Common.Components.TranslatorWidget._widget = null; | 148 | Clipperz.PM.UI.Common.Components.TranslatorWidget._widget = null; |
151 | 149 | ||
152 | Clipperz.PM.UI.Common.Components.TranslatorWidget.widget = function () { | 150 | Clipperz.PM.UI.Common.Components.TranslatorWidget.widget = function () { |
153 | if (Clipperz.PM.UI.Common.Components.TranslatorWidget._widget == null) { | 151 | if (Clipperz.PM.UI.Common.Components.TranslatorWidget._widget == null) { |
154 | Clipperz.PM.UI.Common.Components.TranslatorWidget._widget = new Clipperz.PM.UI.Common.Components.TranslatorWidget(); | 152 | Clipperz.PM.UI.Common.Components.TranslatorWidget._widget = new Clipperz.PM.UI.Common.Components.TranslatorWidget(); |
155 | } | 153 | } |
156 | 154 | ||
157 | return Clipperz.PM.UI.Common.Components.TranslatorWidget._widget; | 155 | return Clipperz.PM.UI.Common.Components.TranslatorWidget._widget; |
158 | } | 156 | } |
159 | Clipperz.PM.UI.Common.Components.TranslatorWidget.show = function (anElement, aStringID) { | 157 | Clipperz.PM.UI.Common.Components.TranslatorWidget.show = function (anElement, aStringID) { |
160 | Clipperz.PM.UI.Common.Components.TranslatorWidget.widget().show(anElement, aStringID); | 158 | Clipperz.PM.UI.Common.Components.TranslatorWidget.widget().show(anElement, aStringID); |
161 | } | 159 | } |
162 | 160 | ||
163 | Clipperz.PM.UI.Common.Components.TranslatorWidget.hide = function () { | 161 | Clipperz.PM.UI.Common.Components.TranslatorWidget.hide = function () { |
164 | Clipperz.PM.UI.Common.Components.TranslatorWidget.widget().hide(); | 162 | Clipperz.PM.UI.Common.Components.TranslatorWidget.widget().hide(); |
165 | } | 163 | } |
166 | 164 | ||
167 | //############################################################################# | 165 | //############################################################################# |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js index 5fd10f9..77d59a5 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js | |||
@@ -1,264 +1,256 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner = function(args) { | 26 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner = function(args) { |
29 | this._directLogin = args['directLogin'] || Clipperz.Base.exception.raise('MandatoryParameter'); | 27 | this._directLogin = args['directLogin'] || Clipperz.Base.exception.raise('MandatoryParameter'); |
30 | this._target = Clipperz.PM.Crypto.randomKey(); | 28 | this._target = Clipperz.PM.Crypto.randomKey(); |
31 | 29 | ||
32 | return this; | 30 | return this; |
33 | } | 31 | } |
34 | 32 | ||
35 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.prototype, { | 33 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.prototype, { |
36 | 34 | ||
37 | 'toString': function() { | 35 | 'toString': function() { |
38 | return "Clipperz.PM.UI.Common.Controllers.DirectLoginRunner"; | 36 | return "Clipperz.PM.UI.Common.Controllers.DirectLoginRunner"; |
39 | }, | 37 | }, |
40 | 38 | ||
41 | //----------------------------------------------------------------------------- | 39 | //----------------------------------------------------------------------------- |
42 | 40 | ||
43 | 'directLogin': function () { | 41 | 'directLogin': function () { |
44 | return this._directLogin; | 42 | return this._directLogin; |
45 | }, | 43 | }, |
46 | 44 | ||
47 | //----------------------------------------------------------------------------- | 45 | //----------------------------------------------------------------------------- |
48 | 46 | ||
49 | 'target': function () { | 47 | 'target': function () { |
50 | return this._target; | 48 | return this._target; |
51 | }, | 49 | }, |
52 | 50 | ||
53 | //============================================================================= | 51 | //============================================================================= |
54 | 52 | ||
55 | 'setWindowTitle': function (aWindow, aTitle) { | 53 | 'setWindowTitle': function (aWindow, aTitle) { |
56 | aWindow.document.title = aTitle; | 54 | aWindow.document.title = aTitle; |
57 | }, | 55 | }, |
58 | 56 | ||
59 | 'setWindowBody': function (aWindow, anHTML) { | 57 | 'setWindowBody': function (aWindow, anHTML) { |
60 | aWindow.document.body.innerHTML = anHTML; | 58 | aWindow.document.body.innerHTML = anHTML; |
61 | }, | 59 | }, |
62 | 60 | ||
63 | //============================================================================= | 61 | //============================================================================= |
64 | 62 | ||
65 | 'initialWindowSetup': function (aWindow) { | 63 | 'initialWindowSetup': function (aWindow) { |
66 | this.setWindowTitle(aWindow, "Loading Clipperz Direct Login"); | 64 | this.setWindowTitle(aWindow, "Loading Clipperz Direct Login"); |
67 | this.setWindowBody (aWindow, MochiKit.DOM.toHTML(MochiKit.DOM.H3("Loading Clipperz Direct Login ..."))); | 65 | this.setWindowBody (aWindow, MochiKit.DOM.toHTML(MochiKit.DOM.H3("Loading Clipperz Direct Login ..."))); |
68 | }, | 66 | }, |
69 | 67 | ||
70 | //----------------------------------------------------------------------------- | 68 | //----------------------------------------------------------------------------- |
71 | 69 | ||
72 | 'updateWindowWithDirectLoginLabel': function (aWindow, aLabel) { | 70 | 'updateWindowWithDirectLoginLabel': function (aWindow, aLabel) { |
73 | var titleText; | 71 | var titleText; |
74 | var bodyText; | 72 | var bodyText; |
75 | 73 | ||
76 | titleText = "Loading '__label__' Direct Login".replace(/__label__/, aLabel) | 74 | titleText = "Loading '__label__' Direct Login".replace(/__label__/, aLabel) |
77 | bodyText = "Loading '__label__' Direct Login... ".replace(/__label__/, aLabel) | 75 | bodyText = "Loading '__label__' Direct Login... ".replace(/__label__/, aLabel) |
78 | 76 | ||
79 | this.setWindowTitle(aWindow, titleText); | 77 | this.setWindowTitle(aWindow, titleText); |
80 | this.setWindowBody (aWindow, MochiKit.DOM.toHTML(MochiKit.DOM.H3(bodyText))); | 78 | this.setWindowBody (aWindow, MochiKit.DOM.toHTML(MochiKit.DOM.H3(bodyText))); |
81 | }, | 79 | }, |
82 | 80 | ||
83 | //----------------------------------------------------------------------------- | 81 | //----------------------------------------------------------------------------- |
84 | 82 | ||
85 | 'updateWindowWithHTMLContent': function (aWindow, anHtml) { | 83 | 'updateWindowWithHTMLContent': function (aWindow, anHtml) { |
86 | this.setWindowBody(aWindow, anHtml); | 84 | this.setWindowBody(aWindow, anHtml); |
87 | }, | 85 | }, |
88 | 86 | ||
89 | //============================================================================= | 87 | //============================================================================= |
90 | 88 | ||
91 | 'submitLoginForm': function(aWindow, aSubmitFunction) { | 89 | 'submitLoginForm': function(aWindow, aSubmitFunction) { |
92 | MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function () { | 90 | MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function () { |
93 | var formElement; | 91 | var formElement; |
94 | var submitButtons; | 92 | var submitButtons; |
95 | 93 | ||
96 | formElement = MochiKit.DOM.getElement('directLoginForm'); | 94 | formElement = MochiKit.DOM.getElement('directLoginForm'); |
97 | 95 | ||
98 | submitButtons = MochiKit.Base.filter(function(anInputElement) { | 96 | submitButtons = MochiKit.Base.filter(function(anInputElement) { |
99 | return ((anInputElement.tagName.toLowerCase() == 'input') && (anInputElement.getAttribute('type').toLowerCase() == 'submit')); | 97 | return ((anInputElement.tagName.toLowerCase() == 'input') && (anInputElement.getAttribute('type').toLowerCase() == 'submit')); |
100 | }, formElement.elements); | 98 | }, formElement.elements); |
101 | 99 | ||
102 | if (submitButtons.length == 0) { | 100 | if (submitButtons.length == 0) { |
103 | if (typeof(formElement.submit) == 'function') { | 101 | if (typeof(formElement.submit) == 'function') { |
104 | formElement.submit(); | 102 | formElement.submit(); |
105 | } else { | 103 | } else { |
106 | aSubmitFunction.apply(formElement); | 104 | aSubmitFunction.apply(formElement); |
107 | } | 105 | } |
108 | /* | 106 | /* |
109 | varformSubmitFunction; | 107 | varformSubmitFunction; |
110 | 108 | ||
111 | formSubmitFunction = MochiKit.Base.method(formElement, 'submit'); | 109 | formSubmitFunction = MochiKit.Base.method(formElement, 'submit'); |
112 | if (Clipperz_IEisBroken == true) { | 110 | if (Clipperz_IEisBroken == true) { |
113 | formElement.submit(); | 111 | formElement.submit(); |
114 | } else { | 112 | } else { |
115 | formSubmitFunction(); | 113 | formSubmitFunction(); |
116 | } | 114 | } |
117 | */ | 115 | */ |
118 | } else { | 116 | } else { |
119 | submitButtons[0].click(); | 117 | submitButtons[0].click(); |
120 | } | 118 | } |
121 | }, this)); | 119 | }, this)); |
122 | }, | 120 | }, |
123 | 121 | ||
124 | //------------------------------------------------------------------------- | 122 | //------------------------------------------------------------------------- |
125 | 123 | ||
126 | 'runSubmitFormDirectLogin': function (aWindow, someAttributes) { | 124 | 'runSubmitFormDirectLogin': function (aWindow, someAttributes) { |
127 | var html; | 125 | var html; |
128 | var formElement; | 126 | var formElement; |
129 | var submitFunction; | 127 | var submitFunction; |
130 | 128 | ||
131 | formElement = MochiKit.DOM.FORM({ | 129 | formElement = MochiKit.DOM.FORM({ |
132 | 'id':'directLoginForm', | 130 | 'id':'directLoginForm', |
133 | 'method':someAttributes['formAttributes']['method'], | 131 | 'method':someAttributes['formAttributes']['method'], |
134 | 'action':someAttributes['formAttributes']['action'] | 132 | 'action':someAttributes['formAttributes']['action'] |
135 | }); | 133 | }); |
136 | 134 | ||
137 | submitFunction = formElement.submit; | 135 | submitFunction = formElement.submit; |
138 | 136 | ||
139 | MochiKit.DOM.appendChildNodes(formElement, MochiKit.Base.map(function (anInputAttributes) { | 137 | MochiKit.DOM.appendChildNodes(formElement, MochiKit.Base.map(function (anInputAttributes) { |
140 | return MochiKit.DOM.INPUT({'type':'hidden', 'name':anInputAttributes[0], 'value':anInputAttributes[1]}); | 138 | return MochiKit.DOM.INPUT({'type':'hidden', 'name':anInputAttributes[0], 'value':anInputAttributes[1]}); |
141 | }, MochiKit.Base.items(someAttributes['inputValues']))); | 139 | }, MochiKit.Base.items(someAttributes['inputValues']))); |
142 | 140 | ||
143 | html =''; | 141 | html =''; |
144 | html += '<h3>Loading ' + someAttributes['label'] + ' ...</h3>'; | 142 | html += '<h3>Loading ' + someAttributes['label'] + ' ...</h3>'; |
145 | html +=MochiKit.DOM.appendChildNodes(MochiKit.DOM.DIV(), MochiKit.DOM.appendChildNodes(MochiKit.DOM.DIV({style:'display:none; visibility:hidden;'}), formElement)).innerHTML; | 143 | html +=MochiKit.DOM.appendChildNodes(MochiKit.DOM.DIV(), MochiKit.DOM.appendChildNodes(MochiKit.DOM.DIV({style:'display:none; visibility:hidden;'}), formElement)).innerHTML; |
146 | 144 | ||
147 | this.updateWindowWithHTMLContent(aWindow, html); | 145 | this.updateWindowWithHTMLContent(aWindow, html); |
148 | this.submitLoginForm(aWindow, submitFunction); | 146 | this.submitLoginForm(aWindow, submitFunction); |
149 | }, | 147 | }, |
150 | 148 | ||
151 | //------------------------------------------------------------------------- | 149 | //------------------------------------------------------------------------- |
152 | 150 | ||
153 | 'runHttpAuthDirectLogin': function(aWindow, someAttributes) { | 151 | 'runHttpAuthDirectLogin': function(aWindow, someAttributes) { |
154 | var completeUrl; | 152 | var completeUrl; |
155 | var url; | 153 | var url; |
156 | 154 | ||
157 | //console.log("runHttpAuthDirectLogin", someAttributes); | ||
158 | url = someAttributes['inputValues']['url']; | 155 | url = someAttributes['inputValues']['url']; |
159 | 156 | ||
160 | if (/^https?\:\/\//.test(url) == false) { | 157 | if (/^https?\:\/\//.test(url) == false) { |
161 | url = 'http://' + url; | 158 | url = 'http://' + url; |
162 | } | 159 | } |
163 | 160 | ||
164 | if (Clipperz_IEisBroken === true) { | 161 | if (Clipperz_IEisBroken === true) { |
165 | completeUrl = url; | 162 | completeUrl = url; |
166 | } else { | 163 | } else { |
167 | var username; | 164 | var username; |
168 | var password; | 165 | var password; |
169 | 166 | ||
170 | username = someAttributes['inputValues']['username']; | 167 | username = someAttributes['inputValues']['username']; |
171 | password = someAttributes['inputValues']['password']; | 168 | password = someAttributes['inputValues']['password']; |
172 | /(^https?\:\/\/)?(.*)/.test(url); | 169 | /(^https?\:\/\/)?(.*)/.test(url); |
173 | 170 | ||
174 | completeUrl = RegExp.$1 + username + ':' + password + '@' + RegExp.$2; | 171 | completeUrl = RegExp.$1 + username + ':' + password + '@' + RegExp.$2; |
175 | } | 172 | } |
176 | 173 | ||
177 | window.open(completeUrl, this.target()); | 174 | window.open(completeUrl, this.target()); |
178 | }, | 175 | }, |
179 | 176 | ||
180 | //============================================================================= | 177 | //============================================================================= |
181 | 178 | ||
182 | 'runDirectLogin': function (aWindow) { | 179 | 'runDirectLogin': function (aWindow) { |
183 | var deferredResult; | 180 | var deferredResult; |
184 | 181 | ||
185 | //console.log(">>> runDirectLogin"); | ||
186 | deferredResult = new Clipperz.Async.Deferred("DirectLoginRunner.openDirectLogin", {trace:false}); | 182 | deferredResult = new Clipperz.Async.Deferred("DirectLoginRunner.openDirectLogin", {trace:false}); |
187 | deferredResult.addMethod(this, 'initialWindowSetup', aWindow); | 183 | deferredResult.addMethod(this, 'initialWindowSetup', aWindow); |
188 | deferredResult.addMethod(this.directLogin(), 'label'); | 184 | deferredResult.addMethod(this.directLogin(), 'label'); |
189 | deferredResult.addMethod(this, 'updateWindowWithDirectLoginLabel', aWindow); | 185 | deferredResult.addMethod(this, 'updateWindowWithDirectLoginLabel', aWindow); |
190 | deferredResult.collectResults({ | 186 | deferredResult.collectResults({ |
191 | 'type': MochiKit.Base.method(this.directLogin(), 'type'), | 187 | 'type': MochiKit.Base.method(this.directLogin(), 'type'), |
192 | 'label': MochiKit.Base.method(this.directLogin(), 'label'), | 188 | 'label': MochiKit.Base.method(this.directLogin(), 'label'), |
193 | 'formAttributes':MochiKit.Base.method(this.directLogin(), 'formAttributes'), | 189 | 'formAttributes':MochiKit.Base.method(this.directLogin(), 'formAttributes'), |
194 | 'inputValues': MochiKit.Base.method(this.directLogin(), 'inputValues') | 190 | 'inputValues': MochiKit.Base.method(this.directLogin(), 'inputValues') |
195 | }); | 191 | }); |
196 | //deferredResult.addCallback(function (aValue) { console.log("SOME ATTRIBUTES", aValue); return aValue; }); | ||
197 | deferredResult.addCallback(MochiKit.Base.bind(function (someAttributes) { | 192 | deferredResult.addCallback(MochiKit.Base.bind(function (someAttributes) { |
198 | //console.log("SOME ATTRIBUTES", someAttributes); | ||
199 | switch (someAttributes['type']) { | 193 | switch (someAttributes['type']) { |
200 | case 'http_auth': | 194 | case 'http_auth': |
201 | this.runHttpAuthDirectLogin(aWindow, someAttributes); | 195 | this.runHttpAuthDirectLogin(aWindow, someAttributes); |
202 | break; | 196 | break; |
203 | case 'simple_url': | 197 | case 'simple_url': |
204 | this.runSimpleUrlDirectLogin(aWindow, someAttributes); | 198 | this.runSimpleUrlDirectLogin(aWindow, someAttributes); |
205 | break; | 199 | break; |
206 | default: | 200 | default: |
207 | this.runSubmitFormDirectLogin(aWindow, someAttributes); | 201 | this.runSubmitFormDirectLogin(aWindow, someAttributes); |
208 | break; | 202 | break; |
209 | } | 203 | } |
210 | }, this)); | 204 | }, this)); |
211 | deferredResult.callback(); | 205 | deferredResult.callback(); |
212 | //console.log("<<< runDirectLogin"); | ||
213 | 206 | ||
214 | return deferredResult; | 207 | return deferredResult; |
215 | }, | 208 | }, |
216 | 209 | ||
217 | //============================================================================= | 210 | //============================================================================= |
218 | 211 | ||
219 | 'run': function () { | 212 | 'run': function () { |
220 | var newWindow; | 213 | var newWindow; |
221 | 214 | ||
222 | newWindow = window.open(Clipperz.PM.Strings.getValue('directLoginJumpPageUrl'), this.target()); | 215 | newWindow = window.open(Clipperz.PM.Strings.getValue('directLoginJumpPageUrl'), this.target()); |
223 | 216 | ||
224 | return this.runDirectLogin(newWindow); | 217 | return this.runDirectLogin(newWindow); |
225 | }, | 218 | }, |
226 | 219 | ||
227 | //============================================================================= | 220 | //============================================================================= |
228 | 221 | ||
229 | 'test': function () { | 222 | 'test': function () { |
230 | var iFrame; | 223 | var iFrame; |
231 | var newWindow; | 224 | var newWindow; |
232 | 225 | ||
233 | iFrame = MochiKit.DOM.createDOM('iframe'); | 226 | iFrame = MochiKit.DOM.createDOM('iframe'); |
234 | MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, iFrame); | 227 | MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, iFrame); |
235 | 228 | ||
236 | newWindow = iFrame.contentWindow; | 229 | newWindow = iFrame.contentWindow; |
237 | 230 | ||
238 | return this.runDirectLogin(newWindow); | 231 | return this.runDirectLogin(newWindow); |
239 | }, | 232 | }, |
240 | 233 | ||
241 | //============================================================================= | 234 | //============================================================================= |
242 | __syntaxFix__: "syntax fix" | 235 | __syntaxFix__: "syntax fix" |
243 | }); | 236 | }); |
244 | 237 | ||
245 | //----------------------------------------------------------------------------- | 238 | //----------------------------------------------------------------------------- |
246 | 239 | ||
247 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.openDirectLogin = function (aDirectLogin) { | 240 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.openDirectLogin = function (aDirectLogin) { |
248 | varrunner; | 241 | varrunner; |
249 | 242 | ||
250 | runner = new Clipperz.PM.UI.Common.Controllers.DirectLoginRunner({directLogin:aDirectLogin}); | 243 | runner = new Clipperz.PM.UI.Common.Controllers.DirectLoginRunner({directLogin:aDirectLogin}); |
251 | return runner.run(); | 244 | return runner.run(); |
252 | }; | 245 | }; |
253 | 246 | ||
254 | //----------------------------------------------------------------------------- | 247 | //----------------------------------------------------------------------------- |
255 | 248 | ||
256 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.testDirectLogin = function (aDirectLogin) { | 249 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.testDirectLogin = function (aDirectLogin) { |
257 | varrunner; | 250 | varrunner; |
258 | 251 | ||
259 | //console.log(">>>>>> TESTING DIRECT LOGIN"); | ||
260 | runner = new Clipperz.PM.UI.Common.Controllers.DirectLoginRunner({directLogin:aDirectLogin}); | 252 | runner = new Clipperz.PM.UI.Common.Controllers.DirectLoginRunner({directLogin:aDirectLogin}); |
261 | return runner.test(); | 253 | return runner.test(); |
262 | }; | 254 | }; |
263 | 255 | ||
264 | //----------------------------------------------------------------------------- | 256 | //----------------------------------------------------------------------------- |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js index 41fe17f..52d81d4 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js | |||
@@ -1,140 +1,138 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Controllers.ProgressBarController = function(args) { | 26 | Clipperz.PM.UI.Common.Controllers.ProgressBarController = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | this._numberOfSteps= 0; | 29 | this._numberOfSteps= 0; |
32 | this._currentStep= 0; | 30 | this._currentStep= 0; |
33 | 31 | ||
34 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'initProgress', this, 'initProgressHandle'); | 32 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'initProgress', this, 'initProgressHandle'); |
35 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'updateProgress',this, 'updateProgressHandle'); | 33 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'updateProgress',this, 'updateProgressHandle'); |
36 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'advanceProgress',this, 'advanceProgressHandle'); | 34 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'advanceProgress',this, 'advanceProgressHandle'); |
37 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'progressDone', this, 'progressDoneHandle'); | 35 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'progressDone', this, 'progressDoneHandle'); |
38 | 36 | ||
39 | return this; | 37 | return this; |
40 | } | 38 | } |
41 | 39 | ||
42 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.ProgressBarController.prototype, { | 40 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.ProgressBarController.prototype, { |
43 | 41 | ||
44 | 'toString': function() { | 42 | 'toString': function() { |
45 | return "Clipperz.PM.UI.Common.Controllers.ProgressBarController"; | 43 | return "Clipperz.PM.UI.Common.Controllers.ProgressBarController"; |
46 | }, | 44 | }, |
47 | 45 | ||
48 | //----------------------------------------------------------------------------- | 46 | //----------------------------------------------------------------------------- |
49 | 47 | ||
50 | 'numberOfSteps': function() { | 48 | 'numberOfSteps': function() { |
51 | return this._numberOfSteps; | 49 | return this._numberOfSteps; |
52 | }, | 50 | }, |
53 | 51 | ||
54 | 'setNumberOfSteps': function (aValue) { | 52 | 'setNumberOfSteps': function (aValue) { |
55 | this._numberOfSteps = aValue; | 53 | this._numberOfSteps = aValue; |
56 | }, | 54 | }, |
57 | 55 | ||
58 | 'updateNumberOfSteps': function (aValue) { | 56 | 'updateNumberOfSteps': function (aValue) { |
59 | this._numberOfSteps += aValue; | 57 | this._numberOfSteps += aValue; |
60 | }, | 58 | }, |
61 | 59 | ||
62 | //----------------------------------------------------------------------------- | 60 | //----------------------------------------------------------------------------- |
63 | 61 | ||
64 | 'currentStep': function() { | 62 | 'currentStep': function() { |
65 | return this._currentStep; | 63 | return this._currentStep; |
66 | }, | 64 | }, |
67 | 65 | ||
68 | 'advanceCurrentStep': function () { | 66 | 'advanceCurrentStep': function () { |
69 | this._currentStep ++; | 67 | this._currentStep ++; |
70 | }, | 68 | }, |
71 | 69 | ||
72 | //----------------------------------------------------------------------------- | 70 | //----------------------------------------------------------------------------- |
73 | 71 | ||
74 | 'completedPercentage': function () { | 72 | 'completedPercentage': function () { |
75 | var result; | 73 | var result; |
76 | //Clipperz.log(">>> completedPercentage" + this.currentStep() + "/" + this.numberOfSteps(), this.currentStep() / this.numberOfSteps()); | 74 | //Clipperz.log(">>> completedPercentage" + this.currentStep() + "/" + this.numberOfSteps(), this.currentStep() / this.numberOfSteps()); |
77 | if (this.numberOfSteps() == 0) { | 75 | if (this.numberOfSteps() == 0) { |
78 | result = 0; | 76 | result = 0; |
79 | } else { | 77 | } else { |
80 | result = (Math.min(100, 100 * (this.currentStep() / this.numberOfSteps()))); | 78 | result = (Math.min(100, 100 * (this.currentStep() / this.numberOfSteps()))); |
81 | } | 79 | } |
82 | //Clipperz.log("<<< completedPercentage", result); | 80 | //Clipperz.log("<<< completedPercentage", result); |
83 | return result; | 81 | return result; |
84 | }, | 82 | }, |
85 | 83 | ||
86 | //----------------------------------------------------------------------------- | 84 | //----------------------------------------------------------------------------- |
87 | 85 | ||
88 | 'resetStatus': function () { | 86 | 'resetStatus': function () { |
89 | this._numberOfSteps= 0; | 87 | this._numberOfSteps= 0; |
90 | this._currentStep= 0; | 88 | this._currentStep= 0; |
91 | }, | 89 | }, |
92 | 90 | ||
93 | //----------------------------------------------------------------------------- | 91 | //----------------------------------------------------------------------------- |
94 | 92 | ||
95 | 'updateProgress': function () { | 93 | 'updateProgress': function () { |
96 | //Clipperz.log(">>> updateProgress: " + this.completedPercentage() + "%"); | 94 | //Clipperz.log(">>> updateProgress: " + this.completedPercentage() + "%"); |
97 | MochiKit.Signal.signal(this, 'updateProgress', this.completedPercentage()); | 95 | MochiKit.Signal.signal(this, 'updateProgress', this.completedPercentage()); |
98 | }, | 96 | }, |
99 | 97 | ||
100 | //============================================================================= | 98 | //============================================================================= |
101 | 99 | ||
102 | 'initProgressHandle': function (anEvent) { | 100 | 'initProgressHandle': function (anEvent) { |
103 | //Clipperz.log(">>> initProgressHandle - steps: " + (anEvent != null ? anEvent['steps'] : 0)); | 101 | //Clipperz.log(">>> initProgressHandle - steps: " + (anEvent != null ? anEvent['steps'] : 0)); |
104 | this.resetStatus(); | 102 | this.resetStatus(); |
105 | if (anEvent != null) { | 103 | if (anEvent != null) { |
106 | this.setNumberOfSteps(anEvent['steps']); | 104 | this.setNumberOfSteps(anEvent['steps']); |
107 | } | 105 | } |
108 | MochiKit.Signal.signal(this, 'initProgress'); | 106 | MochiKit.Signal.signal(this, 'initProgress'); |
109 | this.updateProgress(); | 107 | this.updateProgress(); |
110 | }, | 108 | }, |
111 | 109 | ||
112 | //............................................................................. | 110 | //............................................................................. |
113 | 111 | ||
114 | 'updateProgressHandle': function (anEvent) { | 112 | 'updateProgressHandle': function (anEvent) { |
115 | this.updateNumberOfSteps(anEvent['extraSteps']); | 113 | this.updateNumberOfSteps(anEvent['extraSteps']); |
116 | //Clipperz.log("=== updateProgressHandle - steps: " + this.numberOfSteps() + " (extra " + anEvent['extraSteps'] + ")"); | 114 | //Clipperz.log("=== updateProgressHandle - steps: " + this.numberOfSteps() + " (extra " + anEvent['extraSteps'] + ")"); |
117 | this.updateProgress(); | 115 | this.updateProgress(); |
118 | }, | 116 | }, |
119 | 117 | ||
120 | //............................................................................. | 118 | //............................................................................. |
121 | 119 | ||
122 | 'advanceProgressHandle': function (anEvent) { | 120 | 'advanceProgressHandle': function (anEvent) { |
123 | this.advanceCurrentStep(); | 121 | this.advanceCurrentStep(); |
124 | //Clipperz.log("--- advanceProgressHandle: " + this.currentStep() + "/" + this.numberOfSteps()); | 122 | //Clipperz.log("--- advanceProgressHandle: " + this.currentStep() + "/" + this.numberOfSteps()); |
125 | this.updateProgress(); | 123 | this.updateProgress(); |
126 | }, | 124 | }, |
127 | 125 | ||
128 | //............................................................................. | 126 | //............................................................................. |
129 | 127 | ||
130 | 'progressDoneHandle': function (anEvent) { | 128 | 'progressDoneHandle': function (anEvent) { |
131 | //Clipperz.log("<<< progressDoneHandle: " + this.currentStep() + "/" + this.numberOfSteps()); | 129 | //Clipperz.log("<<< progressDoneHandle: " + this.currentStep() + "/" + this.numberOfSteps()); |
132 | this.resetStatus(); | 130 | this.resetStatus(); |
133 | MochiKit.Signal.signal(this, 'progressDone'); | 131 | MochiKit.Signal.signal(this, 'progressDone'); |
134 | }, | 132 | }, |
135 | 133 | ||
136 | //============================================================================= | 134 | //============================================================================= |
137 | __syntaxFix__: "syntax fix" | 135 | __syntaxFix__: "syntax fix" |
138 | }); | 136 | }); |
139 | 137 | ||
140 | Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController = new Clipperz.PM.UI.Common.Controllers.ProgressBarController(); | 138 | Clipperz.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 index 341fde9..d3e86de 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js | |||
@@ -1,185 +1,183 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Controllers.TabPanelController = function(args) { | 26 | Clipperz.PM.UI.Common.Controllers.TabPanelController = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | this._component = args.component; | 29 | this._component = args.component; |
32 | this._configuration = args.configuration; | 30 | this._configuration = args.configuration; |
33 | this._isEnabled = args.enabled || true; | 31 | this._isEnabled = args.enabled || true; |
34 | 32 | ||
35 | this._selectedTab = null; | 33 | this._selectedTab = null; |
36 | return this; | 34 | return this; |
37 | } | 35 | } |
38 | 36 | ||
39 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.TabPanelController.prototype, { | 37 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.TabPanelController.prototype, { |
40 | 38 | ||
41 | 'toString': function() { | 39 | 'toString': function() { |
42 | return "Clipperz.PM.UI.Common.Controllers.TabPanelController"; | 40 | return "Clipperz.PM.UI.Common.Controllers.TabPanelController"; |
43 | }, | 41 | }, |
44 | 42 | ||
45 | //----------------------------------------------------------------------------- | 43 | //----------------------------------------------------------------------------- |
46 | 44 | ||
47 | 'component': function() { | 45 | 'component': function() { |
48 | return this._component; | 46 | return this._component; |
49 | }, | 47 | }, |
50 | 48 | ||
51 | 'configuration': function() { | 49 | 'configuration': function() { |
52 | return this._configuration; | 50 | return this._configuration; |
53 | }, | 51 | }, |
54 | 52 | ||
55 | //----------------------------------------------------------------------------- | 53 | //----------------------------------------------------------------------------- |
56 | 54 | ||
57 | 'getElement': function(anElementID) { | 55 | 'getElement': function(anElementID) { |
58 | return this.component().getElement(anElementID); | 56 | return this.component().getElement(anElementID); |
59 | }, | 57 | }, |
60 | 58 | ||
61 | 'tabForTabElement': function(anElement) { | 59 | 'tabForTabElement': function(anElement) { |
62 | varresult; | 60 | varresult; |
63 | 61 | ||
64 | for (result in this.configuration()) { | 62 | for (result in this.configuration()) { |
65 | if (this.getElement(this.configuration()[result]['tab']) == anElement) { | 63 | if (this.getElement(this.configuration()[result]['tab']) == anElement) { |
66 | break; | 64 | break; |
67 | } | 65 | } |
68 | } | 66 | } |
69 | 67 | ||
70 | return result; | 68 | return result; |
71 | }, | 69 | }, |
72 | 70 | ||
73 | //----------------------------------------------------------------------------- | 71 | //----------------------------------------------------------------------------- |
74 | 72 | ||
75 | 'setupTab': function(aConfiguration) { | 73 | 'setupTab': function(aConfiguration) { |
76 | vartabElement; | 74 | vartabElement; |
77 | 75 | ||
78 | tabElement = this.getElement(aConfiguration['tab']); | 76 | tabElement = this.getElement(aConfiguration['tab']); |
79 | 77 | ||
80 | MochiKit.DOM.removeElementClass(tabElement, 'selected'); | 78 | MochiKit.DOM.removeElementClass(tabElement, 'selected'); |
81 | MochiKit.Signal.connect(tabElement, 'onclick', this, 'handleTabClick') | 79 | MochiKit.Signal.connect(tabElement, 'onclick', this, 'handleTabClick') |
82 | }, | 80 | }, |
83 | 81 | ||
84 | 'setupPanel': function(aConfiguration) { | 82 | 'setupPanel': function(aConfiguration) { |
85 | this.hidePanel(aConfiguration['panel']); | 83 | this.hidePanel(aConfiguration['panel']); |
86 | }, | 84 | }, |
87 | 85 | ||
88 | 'setup': function(args) { | 86 | 'setup': function(args) { |
89 | args = args || {}; | 87 | args = args || {}; |
90 | 88 | ||
91 | MochiKit.Base.map(MochiKit.Base.method(this, 'setupTab'),MochiKit.Base.values(this.configuration())); | 89 | MochiKit.Base.map(MochiKit.Base.method(this, 'setupTab'),MochiKit.Base.values(this.configuration())); |
92 | MochiKit.Base.map(MochiKit.Base.method(this, 'setupPanel'),MochiKit.Base.values(this.configuration())); | 90 | MochiKit.Base.map(MochiKit.Base.method(this, 'setupPanel'),MochiKit.Base.values(this.configuration())); |
93 | this.selectTab(args.selected); | 91 | this.selectTab(args.selected); |
94 | }, | 92 | }, |
95 | 93 | ||
96 | //----------------------------------------------------------------------------- | 94 | //----------------------------------------------------------------------------- |
97 | 95 | ||
98 | 'hidePanel': function(aPanel) { | 96 | 'hidePanel': function(aPanel) { |
99 | MochiKit.DOM.removeElementClass(this.getElement(aPanel), 'selected'); | 97 | MochiKit.DOM.removeElementClass(this.getElement(aPanel), 'selected'); |
100 | }, | 98 | }, |
101 | 99 | ||
102 | 'selectTab': function(aTab) { | 100 | 'selectTab': function(aTab) { |
103 | if ((aTab != this.selectedTab()) && (this.isEnabled())) { | 101 | if ((aTab != this.selectedTab()) && (this.isEnabled())) { |
104 | if (this.selectedTab() != null) { | 102 | if (this.selectedTab() != null) { |
105 | MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[this.selectedTab()]['tab']),'selected'); | 103 | MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[this.selectedTab()]['tab']),'selected'); |
106 | MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[this.selectedTab()]['panel']),'selected'); | 104 | MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[this.selectedTab()]['panel']),'selected'); |
107 | } | 105 | } |
108 | 106 | ||
109 | if (aTab != null) { | 107 | if (aTab != null) { |
110 | MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTab]['tab']),'selected'); | 108 | MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTab]['tab']),'selected'); |
111 | MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTab]['panel']),'selected'); | 109 | MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTab]['panel']),'selected'); |
112 | } | 110 | } |
113 | 111 | ||
114 | this.setSelectedTab(aTab); | 112 | this.setSelectedTab(aTab); |
115 | MochiKit.Signal.signal(this, 'tabSelected', aTab); | 113 | MochiKit.Signal.signal(this, 'tabSelected', aTab); |
116 | } | 114 | } |
117 | }, | 115 | }, |
118 | 116 | ||
119 | //----------------------------------------------------------------------------- | 117 | //----------------------------------------------------------------------------- |
120 | 118 | ||
121 | 'selectedTab': function() { | 119 | 'selectedTab': function() { |
122 | return this._selectedTab; | 120 | return this._selectedTab; |
123 | }, | 121 | }, |
124 | 122 | ||
125 | 'setSelectedTab': function(aTab) { | 123 | 'setSelectedTab': function(aTab) { |
126 | this._selectedTab = aTab; | 124 | this._selectedTab = aTab; |
127 | }, | 125 | }, |
128 | 126 | ||
129 | //----------------------------------------------------------------------------- | 127 | //----------------------------------------------------------------------------- |
130 | 128 | ||
131 | 'selectedTabElement': function() { | 129 | 'selectedTabElement': function() { |
132 | var result; | 130 | var result; |
133 | 131 | ||
134 | if (this.selectedTab() != null) { | 132 | if (this.selectedTab() != null) { |
135 | result = this.getElement(this.configuration()[this.selectedTab()]['tab']); | 133 | result = this.getElement(this.configuration()[this.selectedTab()]['tab']); |
136 | } else { | 134 | } else { |
137 | result = null; | 135 | result = null; |
138 | } | 136 | } |
139 | 137 | ||
140 | return null; | 138 | return null; |
141 | }, | 139 | }, |
142 | 140 | ||
143 | 'selectedTabPanelElement': function() { | 141 | 'selectedTabPanelElement': function() { |
144 | var result; | 142 | var result; |
145 | 143 | ||
146 | if (this.selectedTab() != null) { | 144 | if (this.selectedTab() != null) { |
147 | result = this.getElement(this.configuration()[this.selectedTab()]['panel']); | 145 | result = this.getElement(this.configuration()[this.selectedTab()]['panel']); |
148 | } else { | 146 | } else { |
149 | result = null; | 147 | result = null; |
150 | } | 148 | } |
151 | 149 | ||
152 | return result; | 150 | return result; |
153 | }, | 151 | }, |
154 | 152 | ||
155 | //----------------------------------------------------------------------------- | 153 | //----------------------------------------------------------------------------- |
156 | 154 | ||
157 | 'handleTabClick': function(anEvent) { | 155 | 'handleTabClick': function(anEvent) { |
158 | this.selectTab(this.tabForTabElement(anEvent.src())); | 156 | this.selectTab(this.tabForTabElement(anEvent.src())); |
159 | anEvent.preventDefault(); | 157 | anEvent.preventDefault(); |
160 | }, | 158 | }, |
161 | 159 | ||
162 | //============================================================================= | 160 | //============================================================================= |
163 | 161 | ||
164 | 'isEnabled': function () { | 162 | 'isEnabled': function () { |
165 | return this._isEnabled; | 163 | return this._isEnabled; |
166 | }, | 164 | }, |
167 | 165 | ||
168 | 'enable': function () { | 166 | 'enable': function () { |
169 | this._isEnabled = true; | 167 | this._isEnabled = true; |
170 | MochiKit.Base.map(MochiKit.Base.bind(function (aTabComponentID) { | 168 | MochiKit.Base.map(MochiKit.Base.bind(function (aTabComponentID) { |
171 | MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[aTabComponentID]['tab']), 'disabled'); | 169 | MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[aTabComponentID]['tab']), 'disabled'); |
172 | }, this), MochiKit.Base.keys(this.configuration())); | 170 | }, this), MochiKit.Base.keys(this.configuration())); |
173 | }, | 171 | }, |
174 | 172 | ||
175 | 'disable': function () { | 173 | 'disable': function () { |
176 | this._isEnabled = false; | 174 | this._isEnabled = false; |
177 | MochiKit.Base.map(MochiKit.Base.bind(function (aTabComponentID) { | 175 | MochiKit.Base.map(MochiKit.Base.bind(function (aTabComponentID) { |
178 | MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTabComponentID]['tab']), 'disabled'); | 176 | MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTabComponentID]['tab']), 'disabled'); |
179 | }, this), MochiKit.Base.keys(this.configuration())); | 177 | }, this), MochiKit.Base.keys(this.configuration())); |
180 | }, | 178 | }, |
181 | 179 | ||
182 | //============================================================================= | 180 | //============================================================================= |
183 | 181 | ||
184 | __syntaxFix__: "syntax fix" | 182 | __syntaxFix__: "syntax fix" |
185 | }); | 183 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js index ef38bc6..c13d96a 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js | |||
@@ -1,28 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | //Still empty, but here it should be reasonable to factor in code duplicated between | 24 | //Still empty, but here it should be reasonable to factor in code duplicated between |
27 | //- DirectLoginWizardController | 25 | //- DirectLoginWizardController |
28 | //- NewUserWizardController \ No newline at end of file | 26 | //- 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 index ea987cd..f0ccdfb 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Compact/MainController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Compact/MainController.js | |||
@@ -1,56 +1,54 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Compact'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Compact'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Compact.MainController = function() { | 26 | Clipperz.PM.UI.Compact.MainController = function() { |
29 | //this._loginPanel = null; | 27 | //this._loginPanel = null; |
30 | //this._user = null; | 28 | //this._user = null; |
31 | // | 29 | // |
32 | //this._isRunningCompact = false; | 30 | //this._isRunningCompact = false; |
33 | // | 31 | // |
34 | //Clipperz.NotificationCenter.register(null, 'userConnected', this, 'userConnectedCallback'); | 32 | //Clipperz.NotificationCenter.register(null, 'userConnected', this, 'userConnectedCallback'); |
35 | //Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler'); | 33 | //Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler'); |
36 | // | 34 | // |
37 | //Clipperz.NotificationCenter.register(null, 'EXCEPTION', this, 'reportException'); | 35 | //Clipperz.NotificationCenter.register(null, 'EXCEPTION', this, 'reportException'); |
38 | 36 | ||
39 | return this; | 37 | return this; |
40 | } | 38 | } |
41 | 39 | ||
42 | MochiKit.Base.update(Clipperz.PM.UI.Compact.MainController.prototype, { | 40 | MochiKit.Base.update(Clipperz.PM.UI.Compact.MainController.prototype, { |
43 | 41 | ||
44 | 'toString': function() { | 42 | 'toString': function() { |
45 | return "Clipperz.PM.UI.Compact.MainController"; | 43 | return "Clipperz.PM.UI.Compact.MainController"; |
46 | }, | 44 | }, |
47 | 45 | ||
48 | //----------------------------------------------------------------------------- | 46 | //----------------------------------------------------------------------------- |
49 | 47 | ||
50 | 'run': function(shouldShowRegistrationForm) { | 48 | 'run': function(shouldShowRegistrationForm) { |
51 | MochiKit.Logging.logDebug("running " + this.toString()); | 49 | Clipperz.logDebug("running " + this.toString()); |
52 | }, | 50 | }, |
53 | 51 | ||
54 | //----------------------------------------------------------------------------- | 52 | //----------------------------------------------------------------------------- |
55 | __syntaxFix__: "syntax fix" | 53 | __syntaxFix__: "syntax fix" |
56 | }); \ No newline at end of file | 54 | }); \ No newline at end of file |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js index 32dfa63..abf4758 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js | |||
@@ -1,299 +1,293 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Mobile.Components.CardDetail = function(args) { | 26 | Clipperz.PM.UI.Mobile.Components.CardDetail = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Mobile.Components.CardDetail.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Mobile.Components.CardDetail.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | //this._cardReference = null; | 31 | //this._cardReference = null; |
34 | 32 | ||
35 | return this; | 33 | return this; |
36 | } | 34 | } |
37 | 35 | ||
38 | //============================================================================= | 36 | //============================================================================= |
39 | 37 | ||
40 | Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardDetail, Clipperz.PM.UI.Common.Components.BaseComponent, { | 38 | Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardDetail, Clipperz.PM.UI.Common.Components.BaseComponent, { |
41 | 39 | ||
42 | //------------------------------------------------------------------------- | 40 | //------------------------------------------------------------------------- |
43 | 41 | ||
44 | 'toString': function () { | 42 | 'toString': function () { |
45 | return "Clipperz.PM.UI.Mobile.Components.CardDetail component"; | 43 | return "Clipperz.PM.UI.Mobile.Components.CardDetail component"; |
46 | }, | 44 | }, |
47 | 45 | ||
48 | //------------------------------------------------------------------------- | 46 | //------------------------------------------------------------------------- |
49 | /* | 47 | /* |
50 | 'cardReference': function () { | 48 | 'cardReference': function () { |
51 | return this._cardReference; | 49 | return this._cardReference; |
52 | }, | 50 | }, |
53 | 51 | ||
54 | 'setCardReference': function (aValue) { | 52 | 'setCardReference': function (aValue) { |
55 | this._cardReference = aValue; | 53 | this._cardReference = aValue; |
56 | }, | 54 | }, |
57 | */ | 55 | */ |
58 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
59 | 57 | ||
60 | 'renderSelf': function () { | 58 | 'renderSelf': function () { |
61 | console.log("CardDetail.renderSelf"); | ||
62 | this.append(this.element(), {tag:'div', cls:'cardDetail', children:[ | 59 | this.append(this.element(), {tag:'div', cls:'cardDetail', children:[ |
63 | {tag:'div', cls:'toolbar', children:[ | 60 | {tag:'div', cls:'toolbar', children:[ |
64 | {tag:'a', href:'#', cls:'back', html:"List"}, | 61 | {tag:'a', href:'#', cls:'back', html:"List"}, |
65 | {tag:'h1', id:this.getId('cardTitle'), html:"…"} | 62 | {tag:'h1', id:this.getId('cardTitle'), html:"…"} |
66 | ]}, | 63 | ]}, |
67 | {tag:'div', cls:'scroll', id:this.getId('cardDetails'), children:[ | 64 | {tag:'div', cls:'scroll', id:this.getId('cardDetails'), children:[ |
68 | ]} | 65 | ]} |
69 | ]}); | 66 | ]}); |
70 | }, | 67 | }, |
71 | /* | 68 | /* |
72 | 'renderSelf': function() { | 69 | 'renderSelf': function() { |
73 | this.append(this.element(), [ | 70 | this.append(this.element(), [ |
74 | {tag:'div', cls:'cardDetail', id:this.getId('cardDetail'), children:[ | 71 | {tag:'div', cls:'cardDetail', id:this.getId('cardDetail'), children:[ |
75 | {tag:'div', id:this.getId('progressBar')} //, | 72 | {tag:'div', id:this.getId('progressBar')} //, |
76 | ]} | 73 | ]} |
77 | ]); | 74 | ]); |
78 | 75 | ||
79 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); | 76 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); |
80 | MochiKit.Signal.signal(Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController, 'updateProgress', 0); | 77 | MochiKit.Signal.signal(Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController, 'updateProgress', 0); |
81 | }, | 78 | }, |
82 | */ | 79 | */ |
83 | 80 | ||
84 | 'setTitle': function (aValue) { | 81 | 'setTitle': function (aValue) { |
85 | this.getElement('cardTitle').innerHTML = aValue; | 82 | this.getElement('cardTitle').innerHTML = aValue; |
86 | }, | 83 | }, |
87 | 84 | ||
88 | 'fieldListElement': function () { | 85 | 'fieldListElement': function () { |
89 | varresult; | 86 | varresult; |
90 | 87 | ||
91 | result = this.getElement('fieldList'); | 88 | result = this.getElement('fieldList'); |
92 | if (result == null) { | 89 | if (result == null) { |
93 | result = this.append(this.getElement('cardDetails'), {tag:'ul', cls:'rounded', id:this.getId('fieldList')}); | 90 | result = this.append(this.getElement('cardDetails'), {tag:'ul', cls:'rounded', id:this.getId('fieldList')}); |
94 | } | 91 | } |
95 | 92 | ||
96 | return result; | 93 | return result; |
97 | }, | 94 | }, |
98 | 95 | ||
99 | 'renderFieldValues': function (someFieldValues) { | 96 | 'renderFieldValues': function (someFieldValues) { |
100 | varfieldClass; | 97 | varfieldClass; |
101 | 98 | ||
102 | if ((someFieldValues['actionType'] != 'NONE') || (someFieldValues['label'] != '') && (someFieldValues['value'] != '')) { | 99 | if ((someFieldValues['actionType'] != 'NONE') || (someFieldValues['label'] != '') && (someFieldValues['value'] != '')) { |
103 | if (someFieldValues['isHidden'] == true) { | 100 | if (someFieldValues['isHidden'] == true) { |
104 | fieldClass = 'password'; | 101 | fieldClass = 'password'; |
105 | } else { | 102 | } else { |
106 | fieldClass = ''; | 103 | fieldClass = ''; |
107 | } | 104 | } |
108 | 105 | ||
109 | this.append(this.fieldListElement(), {tag:'li', cls:'cardField', children:[ | 106 | this.append(this.fieldListElement(), {tag:'li', cls:'cardField', children:[ |
110 | {tag:'a', href:'#', cls:fieldClass, html:someFieldValues['value'], children:[ | 107 | {tag:'a', href:'#', cls:fieldClass, html:someFieldValues['value'], children:[ |
111 | {tag:'small', cls:'label', html:someFieldValues['label']} | 108 | {tag:'small', cls:'label', html:someFieldValues['label']} |
112 | ]} | 109 | ]} |
113 | ]}) | 110 | ]}) |
114 | } | 111 | } |
115 | }, | 112 | }, |
116 | 113 | ||
117 | 'addField': function (aField) { | 114 | 'addField': function (aField) { |
118 | var deferredResult; | 115 | var deferredResult; |
119 | varfieldValues; | 116 | varfieldValues; |
120 | 117 | ||
121 | fieldValues = {}; | 118 | fieldValues = {}; |
122 | deferredResult = new Clipperz.Async.Deferred("CardDetail.addField", {trace:false}); | 119 | deferredResult = new Clipperz.Async.Deferred("CardDetail.addField", {trace:false}); |
123 | deferredResult.addMethod(aField, 'label'); | 120 | deferredResult.addMethod(aField, 'label'); |
124 | deferredResult.addCallback(function (aValue) { fieldValues['label'] = aValue; }); | 121 | deferredResult.addCallback(function (aValue) { fieldValues['label'] = aValue; }); |
125 | deferredResult.addMethod(aField, 'value'); | 122 | deferredResult.addMethod(aField, 'value'); |
126 | deferredResult.addCallback(function (aValue) { fieldValues['value'] = aValue; }); | 123 | deferredResult.addCallback(function (aValue) { fieldValues['value'] = aValue; }); |
127 | deferredResult.addMethod(aField, 'actionType'); | 124 | deferredResult.addMethod(aField, 'actionType'); |
128 | deferredResult.addCallback(function (aValue) { fieldValues['actionType'] = aValue; }); | 125 | deferredResult.addCallback(function (aValue) { fieldValues['actionType'] = aValue; }); |
129 | deferredResult.addMethod(aField, 'isHidden'); | 126 | deferredResult.addMethod(aField, 'isHidden'); |
130 | deferredResult.addCallback(function (aValue) { fieldValues['isHidden'] = aValue; }); | 127 | deferredResult.addCallback(function (aValue) { fieldValues['isHidden'] = aValue; }); |
131 | deferredResult.addMethod(this, 'renderFieldValues', fieldValues); | 128 | deferredResult.addMethod(this, 'renderFieldValues', fieldValues); |
132 | deferredResult.callback(); | 129 | deferredResult.callback(); |
133 | 130 | ||
134 | return deferredResult; | 131 | return deferredResult; |
135 | }, | 132 | }, |
136 | 133 | ||
137 | //------------------------------------------------------------------------- | 134 | //------------------------------------------------------------------------- |
138 | 135 | ||
139 | 'directLoginElement': function () { | 136 | 'directLoginElement': function () { |
140 | varresult; | 137 | varresult; |
141 | 138 | ||
142 | result = this.getElement('directLoginList'); | 139 | result = this.getElement('directLoginList'); |
143 | if (result == null) { | 140 | if (result == null) { |
144 | this.append(this.getElement('cardDetails'), {tag:'h2', html:"Direct login"}); | 141 | this.append(this.getElement('cardDetails'), {tag:'h2', html:"Direct login"}); |
145 | result = this.append(this.getElement('cardDetails'), {tag:'ul', cls:'rounded', id:this.getId('directLoginList')}); | 142 | result = this.append(this.getElement('cardDetails'), {tag:'ul', cls:'rounded', id:this.getId('directLoginList')}); |
146 | } | 143 | } |
147 | 144 | ||
148 | return result; | 145 | return result; |
149 | }, | 146 | }, |
150 | 147 | ||
151 | 'addDirectLogin': function (aDirectLogin) { | 148 | 'addDirectLogin': function (aDirectLogin) { |
152 | this.append(this.directLoginElement(), {tag:'li', cls:'directLogin forward', children:[ | 149 | this.append(this.directLoginElement(), {tag:'li', cls:'directLogin forward', children:[ |
153 | {tag:'a', href:'#', html:"direct login", children:[ | 150 | {tag:'a', href:'#', html:"direct login", children:[ |
154 | {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:'http://www.clipperz.com/favicon.ico'}]} | 151 | {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:'http://www.clipperz.com/favicon.ico'}]} |
155 | ]} | 152 | ]} |
156 | ]}) | 153 | ]}) |
157 | 154 | ||
158 | console.log("ADD DIRECT LOGIN", aDirectLogin); | ||
159 | }, | 155 | }, |
160 | 156 | ||
161 | //========================================================================= | 157 | //========================================================================= |
162 | 158 | ||
163 | 'showCard': function (aCard) { | 159 | 'showCard': function (aCard) { |
164 | var deferredResult; | 160 | var deferredResult; |
165 | 161 | ||
166 | // this.render(); | 162 | // this.render(); |
167 | 163 | ||
168 | console.log("CardDetail.showCard", aCard); | ||
169 | deferredResult = new Clipperz.Async.Deferred("CardDetail.showCard", {trace:false}); | 164 | deferredResult = new Clipperz.Async.Deferred("CardDetail.showCard", {trace:false}); |
170 | deferredResult.addMethod(aCard, 'label'); | 165 | deferredResult.addMethod(aCard, 'label'); |
171 | deferredResult.addMethod(this, 'setTitle'); | 166 | deferredResult.addMethod(this, 'setTitle'); |
172 | 167 | ||
173 | deferredResult.addMethod(aCard, 'fields'); | 168 | deferredResult.addMethod(aCard, 'fields'); |
174 | deferredResult.addCallback(MochiKit.Base.values); | 169 | deferredResult.addCallback(MochiKit.Base.values); |
175 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'addField')); | 170 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'addField')); |
176 | 171 | ||
177 | deferredResult.addMethod(aCard, 'directLogins'); | 172 | deferredResult.addMethod(aCard, 'directLogins'); |
178 | deferredResult.addCallback(MochiKit.Base.values); | 173 | deferredResult.addCallback(MochiKit.Base.values); |
179 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'addDirectLogin')); | 174 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'addDirectLogin')); |
180 | 175 | ||
181 | 176 | ||
182 | deferredResult.callback(); | 177 | deferredResult.callback(); |
183 | 178 | ||
184 | return deferredResult; | 179 | return deferredResult; |
185 | // return Clipperz.Async.callbacks("CardDialogController.updateComponentState", [ | 180 | // return Clipperz.Async.callbacks("CardDialogController.updateComponentState", [ |
186 | // MochiKit.Base.method(this.record(), 'hasPendingChanges'), | 181 | // MochiKit.Base.method(this.record(), 'hasPendingChanges'), |
187 | // MochiKit.Base.method(this.cardDialogComponent(), 'setShouldEnableSaving'), | 182 | // MochiKit.Base.method(this.cardDialogComponent(), 'setShouldEnableSaving'), |
188 | // | 183 | // |
189 | // MochiKit.Base.method(this.record(), 'label'), | 184 | // MochiKit.Base.method(this.record(), 'label'), |
190 | // MochiKit.Base.method(this.cardDialogComponent(), 'setTitle'), | 185 | // MochiKit.Base.method(this.cardDialogComponent(), 'setTitle'), |
191 | // MochiKit.Base.method(this.record(), 'notes'), | 186 | // MochiKit.Base.method(this.record(), 'notes'), |
192 | // MochiKit.Base.method(this.cardDialogComponent(), 'setNotes'), | 187 | // MochiKit.Base.method(this.cardDialogComponent(), 'setNotes'), |
193 | // | 188 | // |
194 | // MochiKit.Base.method(this.record(), 'fields'), | 189 | // MochiKit.Base.method(this.record(), 'fields'), |
195 | // MochiKit.Base.values, | 190 | // MochiKit.Base.values, |
196 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'addCardDialogComponentWithField')), | 191 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'addCardDialogComponentWithField')), |
197 | // | 192 | // |
198 | // MochiKit.Base.method(this.record(), 'directLogins'), | 193 | // MochiKit.Base.method(this.record(), 'directLogins'), |
199 | // MochiKit.Base.values, | 194 | // MochiKit.Base.values, |
200 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'addCardDialogComponentWithDirectLogin')), | 195 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'addCardDialogComponentWithDirectLogin')), |
201 | // | 196 | // |
202 | // MochiKit.Base.method(this.cardDialogComponent(), 'resetNewFieldInputs'), | 197 | // MochiKit.Base.method(this.cardDialogComponent(), 'resetNewFieldInputs'), |
203 | // MochiKit.Base.noop | 198 | // MochiKit.Base.noop |
204 | // ], {trace:false}); | 199 | // ], {trace:false}); |
205 | 200 | ||
206 | }, | 201 | }, |
207 | 202 | ||
208 | //========================================================================= | 203 | //========================================================================= |
209 | 204 | ||
210 | 'showCardDetails': function (someData) { | 205 | 'showCardDetails': function (someData) { |
211 | this.element().innerHTML = ''; | 206 | this.element().innerHTML = ''; |
212 | this.append(this.element(), [ | 207 | this.append(this.element(), [ |
213 | {tag:'fieldset', id:this.getId('fields'), children:MochiKit.Base.map(function (aFieldData) { | 208 | {tag:'fieldset', id:this.getId('fields'), children:MochiKit.Base.map(function (aFieldData) { |
214 | return {tag:'div', cls:'row', children:[ | 209 | return {tag:'div', cls:'row', children:[ |
215 | {tag:'label', html:aFieldData['label']}, | 210 | {tag:'label', html:aFieldData['label']}, |
216 | // {tag:'span', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), html:aFieldData['value']} | 211 | // {tag:'span', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), html:aFieldData['value']} |
217 | {tag:'div', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), children:[ | 212 | {tag:'div', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), children:[ |
218 | {tag:'div', children:[{tag:'p', html:aFieldData['value']}]} | 213 | {tag:'div', children:[{tag:'p', html:aFieldData['value']}]} |
219 | ]} | 214 | ]} |
220 | // {tag:'input', type:'text', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), value:aFieldData['value'], disabled:true} | 215 | // {tag:'input', type:'text', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), value:aFieldData['value'], disabled:true} |
221 | 216 | ||
222 | ]} | 217 | ]} |
223 | }, someData['fields'])} | 218 | }, someData['fields'])} |
224 | ]); | 219 | ]); |
225 | 220 | ||
226 | MochiKit.Iter.forEach(MochiKit.Selector.findChildElements(this.element(), ['span.password']), MochiKit.Base.bind(function (aPasswordElement) { | 221 | MochiKit.Iter.forEach(MochiKit.Selector.findChildElements(this.element(), ['span.password']), MochiKit.Base.bind(function (aPasswordElement) { |
227 | MochiKit.Signal.connect(aPasswordElement, 'onclick', function (anEvent) { alert(MochiKit.DOM.scrapeText(anEvent.src())); }) | 222 | MochiKit.Signal.connect(aPasswordElement, 'onclick', function (anEvent) { alert(MochiKit.DOM.scrapeText(anEvent.src())); }) |
228 | }, this)); | 223 | }, this)); |
229 | 224 | ||
230 | if (someData['directLogins'].length > 0) { | 225 | if (someData['directLogins'].length > 0) { |
231 | this.append(this.element(), [ | 226 | this.append(this.element(), [ |
232 | {tag:'h2', html:"Direct logins"}, | 227 | {tag:'h2', html:"Direct logins"}, |
233 | {tag:'fieldset', id:this.getId('directLogins'), children:MochiKit.Base.map(function (aDirectLoginData) { | 228 | {tag:'fieldset', id:this.getId('directLogins'), children:MochiKit.Base.map(function (aDirectLoginData) { |
234 | return {tag:'div', cls:'row', id:('directLogin_' + aDirectLoginData['_reference']), children:[ | 229 | return {tag:'div', cls:'row', id:('directLogin_' + aDirectLoginData['_reference']), children:[ |
235 | {tag:'img', cls:'favicon', src:aDirectLoginData['favicon']}, | 230 | {tag:'img', cls:'favicon', src:aDirectLoginData['favicon']}, |
236 | // {tag:'input', cls:'directLogin', disabled:'disabled', type:'text', name:aDirectLoginData['label'], value:aDirectLoginData['label']} | 231 | // {tag:'input', cls:'directLogin', disabled:'disabled', type:'text', name:aDirectLoginData['label'], value:aDirectLoginData['label']} |
237 | {tag:'span', cls:'directLogin', html:aDirectLoginData['label']} | 232 | {tag:'span', cls:'directLogin', html:aDirectLoginData['label']} |
238 | ]} | 233 | ]} |
239 | }, someData['directLogins'])} | 234 | }, someData['directLogins'])} |
240 | ]); | 235 | ]); |
241 | 236 | ||
242 | MochiKit.Base.map(MochiKit.Base.bind(function (aRowNode) { | 237 | MochiKit.Base.map(MochiKit.Base.bind(function (aRowNode) { |
243 | MochiKit.Signal.connect(aRowNode, 'onclick', this, 'directLoginClickHandler'); | 238 | MochiKit.Signal.connect(aRowNode, 'onclick', this, 'directLoginClickHandler'); |
244 | }, this), | 239 | }, this), |
245 | MochiKit.Selector.findChildElements(this.getElement('directLogins'), ['div.row']) | 240 | MochiKit.Selector.findChildElements(this.getElement('directLogins'), ['div.row']) |
246 | ) | 241 | ) |
247 | }; | 242 | }; |
248 | 243 | ||
249 | if (someData['notes'] != '') { | 244 | if (someData['notes'] != '') { |
250 | this.append(this.element(), [ | 245 | this.append(this.element(), [ |
251 | {tag:'h2', html:"Notes"}, | 246 | {tag:'h2', html:"Notes"}, |
252 | {tag:'fieldset', id:this.getId('fieldset'), children:[ | 247 | {tag:'fieldset', id:this.getId('fieldset'), children:[ |
253 | {tag:'div', cls:'row notes', children:[ | 248 | {tag:'div', cls:'row notes', children:[ |
254 | {tag:'span', html:someData['notes']} | 249 | {tag:'span', html:someData['notes']} |
255 | ]} | 250 | ]} |
256 | ]} | 251 | ]} |
257 | ]); | 252 | ]); |
258 | }; | 253 | }; |
259 | 254 | ||
260 | return true; | 255 | return true; |
261 | }, | 256 | }, |
262 | 257 | ||
263 | //------------------------------------------------------------------------- | 258 | //------------------------------------------------------------------------- |
264 | /* | 259 | /* |
265 | 'toggleClickHandler': function (anEvent) { | 260 | 'toggleClickHandler': function (anEvent) { |
266 | varnextState; | 261 | varnextState; |
267 | varfieldValue; | 262 | varfieldValue; |
268 | 263 | ||
269 | //console.log("TOGGLE"); | ||
270 | anEvent.preventDefault; | 264 | anEvent.preventDefault; |
271 | fieldValue = MochiKit.Selector.findChildElements(anEvent.src().parentNode.parentNode, ['span.password'])[0]; | 265 | fieldValue = MochiKit.Selector.findChildElements(anEvent.src().parentNode.parentNode, ['span.password'])[0]; |
272 | 266 | ||
273 | nextState = (MochiKit.DOM.getNodeAttribute(anEvent.src(), 'toggled') != 'true'); | 267 | nextState = (MochiKit.DOM.getNodeAttribute(anEvent.src(), 'toggled') != 'true'); |
274 | if (nextState) { | 268 | if (nextState) { |
275 | MochiKit.DOM.removeElementClass(fieldValue, 'clear'); | 269 | MochiKit.DOM.removeElementClass(fieldValue, 'clear'); |
276 | } else { | 270 | } else { |
277 | MochiKit.DOM.addElementClass(fieldValue, 'clear'); | 271 | MochiKit.DOM.addElementClass(fieldValue, 'clear'); |
278 | } | 272 | } |
279 | 273 | ||
280 | MochiKit.DOM.setNodeAttribute(anEvent.src(), 'toggled', nextState); | 274 | MochiKit.DOM.setNodeAttribute(anEvent.src(), 'toggled', nextState); |
281 | }, | 275 | }, |
282 | * / | 276 | * / |
283 | //========================================================================= | 277 | //========================================================================= |
284 | /* | 278 | /* |
285 | 'directLoginClickHandler': function (anEvent) { | 279 | 'directLoginClickHandler': function (anEvent) { |
286 | anEvent.preventDefault(); | 280 | anEvent.preventDefault(); |
287 | 281 | ||
288 | if (/(directLogin_)/.test(anEvent.src().id)) { | 282 | if (/(directLogin_)/.test(anEvent.src().id)) { |
289 | var directLoginReference; | 283 | var directLoginReference; |
290 | 284 | ||
291 | directLoginReference = anEvent.src().id.match(/(directLogin_)(.*)/)[2]; | 285 | directLoginReference = anEvent.src().id.match(/(directLogin_)(.*)/)[2]; |
292 | MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'selectedDirectLogin', {cardReference:this.cardReference(), directLoginReference:directLoginReference}); | 286 | MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'selectedDirectLogin', {cardReference:this.cardReference(), directLoginReference:directLoginReference}); |
293 | } | 287 | } |
294 | }, | 288 | }, |
295 | */ | 289 | */ |
296 | //========================================================================= | 290 | //========================================================================= |
297 | 291 | ||
298 | __syntaxFix__: "syntax fix" | 292 | __syntaxFix__: "syntax fix" |
299 | }); | 293 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js index a4aa212..a0e4879 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js | |||
@@ -1,254 +1,248 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Mobile.Components.CardList = function(args) { | 26 | Clipperz.PM.UI.Mobile.Components.CardList = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Mobile.Components.CardList.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Mobile.Components.CardList.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._cardDetail = null; | 31 | this._cardDetail = null; |
34 | 32 | ||
35 | return this; | 33 | return this; |
36 | } | 34 | } |
37 | 35 | ||
38 | //============================================================================= | 36 | //============================================================================= |
39 | 37 | ||
40 | Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardList, Clipperz.PM.UI.Common.Components.BaseComponent, { | 38 | Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardList, Clipperz.PM.UI.Common.Components.BaseComponent, { |
41 | 39 | ||
42 | //------------------------------------------------------------------------- | 40 | //------------------------------------------------------------------------- |
43 | 41 | ||
44 | 'toString': function () { | 42 | 'toString': function () { |
45 | return "Clipperz.PM.UI.Mobile.Components.CardList component"; | 43 | return "Clipperz.PM.UI.Mobile.Components.CardList component"; |
46 | }, | 44 | }, |
47 | 45 | ||
48 | //------------------------------------------------------------------------- | 46 | //------------------------------------------------------------------------- |
49 | 47 | ||
50 | 'renderSelf': function () { | 48 | 'renderSelf': function () { |
51 | this.append(this.element(), {tag:'div', cls:'cardList', children:[ | 49 | this.append(this.element(), {tag:'div', cls:'cardList', children:[ |
52 | {tag:'div', cls:'toolbar', children:[ | 50 | {tag:'div', cls:'toolbar', children:[ |
53 | {tag:'h1', html:"clipperz"}, | 51 | {tag:'h1', html:"clipperz"}, |
54 | // {tag:'input', name:'search', type:'search', autocomplete:'off', placeholder:"search", id:this.getId('search')}, | 52 | // {tag:'input', name:'search', type:'search', autocomplete:'off', placeholder:"search", id:this.getId('search')}, |
55 | {tag:'a', href:'#', id:'settings', cls:'button', html:"*"} | 53 | {tag:'a', href:'#', id:'settings', cls:'button', html:"*"} |
56 | ]}, | 54 | ]}, |
57 | {tag:'div', cls:'scroll', id:this.getId('listBox'), children:[ | 55 | {tag:'div', cls:'scroll', id:this.getId('listBox'), children:[ |
58 | {tag:'ul', cls:'rounded', id:this.getId('list'), children:[ | 56 | {tag:'ul', cls:'rounded', id:this.getId('list'), children:[ |
59 | {tag:'li', html:'loading'} | 57 | {tag:'li', html:'loading'} |
60 | ]} | 58 | ]} |
61 | ]} | 59 | ]} |
62 | ]}); | 60 | ]}); |
63 | 61 | ||
64 | MochiKit.Signal.connect(this.getElement('list'), 'onclick', this, 'cardSelectionHandler'); | 62 | MochiKit.Signal.connect(this.getElement('list'), 'onclick', this, 'cardSelectionHandler'); |
65 | MochiKit.Signal.connect(this.getElement('list'), 'ontouchstart',this, 'cardSelectionHandler'); | 63 | MochiKit.Signal.connect(this.getElement('list'), 'ontouchstart',this, 'cardSelectionHandler'); |
66 | // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onsubmit', this,'searchHandler'); | 64 | // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onsubmit', this,'searchHandler'); |
67 | // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeydown', this,'searchHandler'); | 65 | // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeydown', this,'searchHandler'); |
68 | // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeyup', this,'searchHandler'); | 66 | // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeyup', this,'searchHandler'); |
69 | 67 | ||
70 | // MochiKit.Signal.connect(this.getElement('cardListPanel'), 'onclick', this,'cardListClickHandler'); | 68 | // MochiKit.Signal.connect(this.getElement('cardListPanel'), 'onclick', this,'cardListClickHandler'); |
71 | // MochiKit.Signal.connect('backButton', 'onclick', this,'backButtonClickHandler'); | 69 | // MochiKit.Signal.connect('backButton', 'onclick', this,'backButtonClickHandler'); |
72 | 70 | ||
73 | // MochiKit.Style.hideElement('backButton'); | 71 | // MochiKit.Style.hideElement('backButton'); |
74 | // MochiKit.Style.hideElement(this.getElement('cardDetail')); | 72 | // MochiKit.Style.hideElement(this.getElement('cardDetail')); |
75 | }, | 73 | }, |
76 | 74 | ||
77 | 'showCards': function (someCards) { | 75 | 'showCards': function (someCards) { |
78 | varcardListElement; | 76 | varcardListElement; |
79 | if (this.isFullyRendered() == false) { | 77 | if (this.isFullyRendered() == false) { |
80 | this.render(); | 78 | this.render(); |
81 | }; | 79 | }; |
82 | 80 | ||
83 | cardListElement = this.getElement('list') | 81 | cardListElement = this.getElement('list') |
84 | 82 | ||
85 | cardInfo = { | 83 | cardInfo = { |
86 | '_rowObject': MochiKit.Async.succeed, | 84 | '_rowObject': MochiKit.Async.succeed, |
87 | '_reference': MochiKit.Base.methodcaller('reference'), | 85 | '_reference': MochiKit.Base.methodcaller('reference'), |
88 | '_searchableContent':MochiKit.Base.methodcaller('searchableContent'), | 86 | '_searchableContent':MochiKit.Base.methodcaller('searchableContent'), |
89 | 'label': MochiKit.Base.methodcaller('label'), | 87 | 'label': MochiKit.Base.methodcaller('label'), |
90 | 'favicon': MochiKit.Base.methodcaller('favicon') | 88 | 'favicon': MochiKit.Base.methodcaller('favicon') |
91 | }; | 89 | }; |
92 | 90 | ||
93 | //console.log("someCards", someCards); | ||
94 | deferredResult = new Clipperz.Async.Deferred("CardList.showCards", {trace:false}); | 91 | deferredResult = new Clipperz.Async.Deferred("CardList.showCards", {trace:false}); |
95 | deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("CardList.value - collectResults", cardInfo, {trace:false})); | 92 | deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("CardList.value - collectResults", cardInfo, {trace:false})); |
96 | deferredResult.addCallback(Clipperz.Async.collectAll); | 93 | deferredResult.addCallback(Clipperz.Async.collectAll); |
97 | deferredResult.addCallback(MochiKit.Base.methodcaller('sort', Clipperz.Base.caseInsensitiveKeyComparator('label'))); | 94 | deferredResult.addCallback(MochiKit.Base.methodcaller('sort', Clipperz.Base.caseInsensitiveKeyComparator('label'))); |
98 | deferredResult.addCallbackPass(MochiKit.DOM.replaceChildNodes, cardListElement); | 95 | deferredResult.addCallbackPass(MochiKit.DOM.replaceChildNodes, cardListElement); |
99 | // deferredResult.addCallbackPass(MochiKit.DOM.removeElementClass, cardListElement, 'loading'); | 96 | // deferredResult.addCallbackPass(MochiKit.DOM.removeElementClass, cardListElement, 'loading'); |
100 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'appendCardToList', cardListElement)); | 97 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'appendCardToList', cardListElement)); |
101 | deferredResult.callback(someCards); | 98 | deferredResult.callback(someCards); |
102 | }, | 99 | }, |
103 | 100 | ||
104 | 'appendCardToList': function (aCardListElement, aCardInfo) { | 101 | 'appendCardToList': function (aCardListElement, aCardInfo) { |
105 | //console.log("appendCardToList", aCardInfo); | ||
106 | this.append(aCardListElement, {tag:'li', cls:'cardListItem arrow', cardreference:aCardInfo['_reference'], children:[ | 102 | this.append(aCardListElement, {tag:'li', cls:'cardListItem arrow', cardreference:aCardInfo['_reference'], children:[ |
107 | {tag:'a', href:'#', html:aCardInfo['label'], children:[ | 103 | {tag:'a', href:'#', html:aCardInfo['label'], children:[ |
108 | {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:aCardInfo['favicon']}]} | 104 | {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:aCardInfo['favicon']}]} |
109 | ]} | 105 | ]} |
110 | ]}); | 106 | ]}); |
111 | }, | 107 | }, |
112 | 108 | ||
113 | 'cardSelectionHandler': function (anEvent) { | 109 | 'cardSelectionHandler': function (anEvent) { |
114 | var listElement; | 110 | var listElement; |
115 | varcardReference; | 111 | varcardReference; |
116 | 112 | ||
117 | anEvent.preventDefault(); | 113 | anEvent.preventDefault(); |
118 | 114 | ||
119 | listElement = anEvent.target(); | 115 | listElement = anEvent.target(); |
120 | if (MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') == null) { | 116 | if (MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') == null) { |
121 | listElement = MochiKit.DOM.getFirstParentByTagAndClassName(anEvent.target(), tagName='li', className='cardListItem'); | 117 | listElement = MochiKit.DOM.getFirstParentByTagAndClassName(anEvent.target(), tagName='li', className='cardListItem'); |
122 | } | 118 | } |
123 | cardReference = MochiKit.DOM.getNodeAttribute(listElement, 'cardreference'); | 119 | cardReference = MochiKit.DOM.getNodeAttribute(listElement, 'cardreference'); |
124 | console.log("###", listElement, cardReference); | ||
125 | //TODO: Notify card with reference MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') has been selected | 120 | //TODO: Notify card with reference MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') has been selected |
126 | MochiKit.Signal.signal(this, 'selectedCard', cardReference); | 121 | MochiKit.Signal.signal(this, 'selectedCard', cardReference); |
127 | }, | 122 | }, |
128 | 123 | ||
129 | //------------------------------------------------------------------------- | 124 | //------------------------------------------------------------------------- |
130 | /* | 125 | /* |
131 | 'searchHandler': function (anEvent) { | 126 | 'searchHandler': function (anEvent) { |
132 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { //RETURN | 127 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { //RETURN |
133 | anEvent.preventDefault(); | 128 | anEvent.preventDefault(); |
134 | } else { | 129 | } else { |
135 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ESCAPE')) { | 130 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ESCAPE')) { |
136 | anEvent.target().value = ""; | 131 | anEvent.target().value = ""; |
137 | } | 132 | } |
138 | 133 | ||
139 | if (anEvent.type() == 'keyup') { | 134 | if (anEvent.type() == 'keyup') { |
140 | MochiKit.Signal.signal(this, 'searchEvent', anEvent.target().value); | 135 | MochiKit.Signal.signal(this, 'searchEvent', anEvent.target().value); |
141 | } | 136 | } |
142 | } | 137 | } |
143 | }, | 138 | }, |
144 | 139 | ||
145 | //------------------------------------------------------------------------- | 140 | //------------------------------------------------------------------------- |
146 | 141 | ||
147 | 'update': function (someObjects) { | 142 | 'update': function (someObjects) { |
148 | varcardListPanel; | 143 | varcardListPanel; |
149 | var i,c; | 144 | var i,c; |
150 | 145 | ||
151 | cardListPanel = this.getElement('cardListPanel'); | 146 | cardListPanel = this.getElement('cardListPanel'); |
152 | cardListPanel.innerHTML = ''; | 147 | cardListPanel.innerHTML = ''; |
153 | 148 | ||
154 | c = someObjects.length; | 149 | c = someObjects.length; |
155 | 150 | ||
156 | for (i=0; i<c; i++) { | 151 | for (i=0; i<c; i++) { |
157 | this.append(cardListPanel, {tag:'li', cls:'cardListItem', id:('cardListItem_' + someObjects[i]['_reference']), children:[ | 152 | this.append(cardListPanel, {tag:'li', cls:'cardListItem', id:('cardListItem_' + someObjects[i]['_reference']), children:[ |
158 | {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=')}, | 153 | {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=')}, |
159 | {tag:'a', id:('cardListReference_' + someObjects[i]['_reference']), href:'#', html:someObjects[i]['label']} | 154 | {tag:'a', id:('cardListReference_' + someObjects[i]['_reference']), href:'#', html:someObjects[i]['label']} |
160 | ]}) | 155 | ]}) |
161 | 156 | ||
162 | MochiKit.Signal.connect('cardListItem_' + someObjects[i]['_reference'], 'onclick', this, 'cardListClickHandler'); | 157 | MochiKit.Signal.connect('cardListItem_' + someObjects[i]['_reference'], 'onclick', this, 'cardListClickHandler'); |
163 | } | 158 | } |
164 | 159 | ||
165 | }, | 160 | }, |
166 | 161 | ||
167 | 'cardListClickHandler': function (anEvent) { | 162 | 'cardListClickHandler': function (anEvent) { |
168 | anEvent.preventDefault(); | 163 | anEvent.preventDefault(); |
169 | 164 | ||
170 | if (/(cardListReference_|cardListItem_)/.test(anEvent.target().id)) { | 165 | if (/(cardListReference_|cardListItem_)/.test(anEvent.target().id)) { |
171 | var cardListReference; | 166 | var cardListReference; |
172 | 167 | ||
173 | cardListReference = anEvent.target().id.match(/(cardListReference_|cardListItem_)(.*)/)[2]; | 168 | cardListReference = anEvent.target().id.match(/(cardListReference_|cardListItem_)(.*)/)[2]; |
174 | //console.log("Showing detail for card named", cardListReference); | ||
175 | MochiKit.Signal.signal(this, 'selectedCard', cardListReference); | 169 | MochiKit.Signal.signal(this, 'selectedCard', cardListReference); |
176 | } | 170 | } |
177 | }, | 171 | }, |
178 | 172 | ||
179 | //========================================================================= | 173 | //========================================================================= |
180 | 174 | ||
181 | 'cardDetail': function (someData) { | 175 | 'cardDetail': function (someData) { |
182 | if (this._cardDetail == null) { | 176 | if (this._cardDetail == null) { |
183 | this._cardDetail = new Clipperz.PM.UI.Mobile.Components.CardDetail({element:this.getElement('cardDetail')}); | 177 | this._cardDetail = new Clipperz.PM.UI.Mobile.Components.CardDetail({element:this.getElement('cardDetail')}); |
184 | } | 178 | } |
185 | 179 | ||
186 | return this._cardDetail; | 180 | return this._cardDetail; |
187 | }, | 181 | }, |
188 | 182 | ||
189 | //------------------------------------------------------------------------- | 183 | //------------------------------------------------------------------------- |
190 | 184 | ||
191 | 'removeCardDetail': function () { | 185 | 'removeCardDetail': function () { |
192 | if (this._cardDetail != null) { | 186 | if (this._cardDetail != null) { |
193 | this._cardDetail.remove(); | 187 | this._cardDetail.remove(); |
194 | this._cardDetail = null; | 188 | this._cardDetail = null; |
195 | } | 189 | } |
196 | }, | 190 | }, |
197 | 191 | ||
198 | //========================================================================= | 192 | //========================================================================= |
199 | 193 | ||
200 | 'showCard': function (someData) { | 194 | 'showCard': function (someData) { |
201 | vardeferredResult; | 195 | vardeferredResult; |
202 | varoffset; | 196 | varoffset; |
203 | 197 | ||
204 | offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); | 198 | offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); |
205 | this.cardDetail().render(); | 199 | this.cardDetail().render(); |
206 | this.cardDetail().setCardReference(someData['_reference']); | 200 | this.cardDetail().setCardReference(someData['_reference']); |
207 | MochiKit.Style.setElementPosition(this.cardDetail().element(), {x:offset}); | 201 | MochiKit.Style.setElementPosition(this.cardDetail().element(), {x:offset}); |
208 | new MochiKit.Visual.Sequence([ | 202 | new MochiKit.Visual.Sequence([ |
209 | // new MochiKit.Visual.Move(this.cardDetail().element(), {x:offset, y:45, mode:'absolute', duration:0, sync:true}), | 203 | // new MochiKit.Visual.Move(this.cardDetail().element(), {x:offset, y:45, mode:'absolute', duration:0, sync:true}), |
210 | new MochiKit.Visual.Parallel([ | 204 | new MochiKit.Visual.Parallel([ |
211 | new MochiKit.Visual.Move(this.getElement('cardList'), {x:-offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), | 205 | new MochiKit.Visual.Move(this.getElement('cardList'), {x:-offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), |
212 | new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:0, y:45, mode:'absolute',transition:MochiKit.Visual.Transitions.linear, sync:true}), | 206 | new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:0, y:45, mode:'absolute',transition:MochiKit.Visual.Transitions.linear, sync:true}), |
213 | // new MochiKit.Visual.ScrollTo('toolbar', {sync:true}), | 207 | // new MochiKit.Visual.ScrollTo('toolbar', {sync:true}), |
214 | MochiKit.Visual.appear ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) | 208 | MochiKit.Visual.appear ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) |
215 | ], {duration:1, sync:true}), | 209 | ], {duration:1, sync:true}), |
216 | MochiKit.Visual.fade(this.getElement('cardList'), {duration:0, sync:true}) | 210 | MochiKit.Visual.fade(this.getElement('cardList'), {duration:0, sync:true}) |
217 | ], {}) | 211 | ], {}) |
218 | 212 | ||
219 | MochiKit.DOM.getElement('pageTitle').innerHTML = someData['title']; | 213 | MochiKit.DOM.getElement('pageTitle').innerHTML = someData['title']; |
220 | 214 | ||
221 | return true; | 215 | return true; |
222 | }, | 216 | }, |
223 | 217 | ||
224 | //------------------------------------------------------------------------- | 218 | //------------------------------------------------------------------------- |
225 | 219 | ||
226 | 'showCardDetails': function (someData) { | 220 | 'showCardDetails': function (someData) { |
227 | return this.cardDetail().showCardDetails(someData); | 221 | return this.cardDetail().showCardDetails(someData); |
228 | }, | 222 | }, |
229 | 223 | ||
230 | //========================================================================= | 224 | //========================================================================= |
231 | 225 | ||
232 | 'backButtonClickHandler': function (anEvent) { | 226 | 'backButtonClickHandler': function (anEvent) { |
233 | varoffset; | 227 | varoffset; |
234 | 228 | ||
235 | anEvent.preventDefault(); | 229 | anEvent.preventDefault(); |
236 | 230 | ||
237 | MochiKit.DOM.getElement('pageTitle').innerHTML = "cards"; | 231 | MochiKit.DOM.getElement('pageTitle').innerHTML = "cards"; |
238 | 232 | ||
239 | offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); | 233 | offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); |
240 | MochiKit.Style.setElementPosition(this.getElement('cardList'), {x:-offset}); | 234 | MochiKit.Style.setElementPosition(this.getElement('cardList'), {x:-offset}); |
241 | MochiKit.DOM.showElement(this.getElement('cardList')); | 235 | MochiKit.DOM.showElement(this.getElement('cardList')); |
242 | 236 | ||
243 | new MochiKit.Visual.Parallel([ | 237 | new MochiKit.Visual.Parallel([ |
244 | new MochiKit.Visual.Move(this.getElement('cardList'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), | 238 | new MochiKit.Visual.Move(this.getElement('cardList'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), |
245 | new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), | 239 | new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), |
246 | MochiKit.Visual.fade (this.getElement('cardDetail'), { transition:MochiKit.Visual.Transitions.linear, sync:true}), | 240 | MochiKit.Visual.fade (this.getElement('cardDetail'), { transition:MochiKit.Visual.Transitions.linear, sync:true}), |
247 | MochiKit.Visual.fade ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) | 241 | MochiKit.Visual.fade ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) |
248 | ], {duration:1, afterFinish:MochiKit.Base.method(this, 'removeCardDetail')}) | 242 | ], {duration:1, afterFinish:MochiKit.Base.method(this, 'removeCardDetail')}) |
249 | 243 | ||
250 | }, | 244 | }, |
251 | */ | 245 | */ |
252 | //========================================================================= | 246 | //========================================================================= |
253 | __syntaxFix__: "syntax fix" | 247 | __syntaxFix__: "syntax fix" |
254 | }); | 248 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js index eafcdbc..3aeac0c 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js | |||
@@ -1,356 +1,347 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Mobile.Components.LoginForm = function(args) { | 26 | Clipperz.PM.UI.Mobile.Components.LoginForm = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | this._pin = ''; | 29 | this._pin = ''; |
32 | 30 | ||
33 | this._message = null; | 31 | this._message = null; |
34 | this._steps = 0; | 32 | this._steps = 0; |
35 | this._actualSteps = 0; | 33 | this._actualSteps = 0; |
36 | 34 | ||
37 | this._callback = null; | 35 | this._callback = null; |
38 | this._errorCallback = null; | 36 | this._errorCallback = null; |
39 | 37 | ||
40 | this._mode = 'CREDENTIALS'; | 38 | this._mode = 'CREDENTIALS'; |
41 | 39 | ||
42 | Clipperz.PM.UI.Mobile.Components.LoginForm.superclass.constructor.apply(this, arguments); | 40 | Clipperz.PM.UI.Mobile.Components.LoginForm.superclass.constructor.apply(this, arguments); |
43 | 41 | ||
44 | return this; | 42 | return this; |
45 | } | 43 | } |
46 | 44 | ||
47 | //============================================================================= | 45 | //============================================================================= |
48 | 46 | ||
49 | Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, { | 47 | Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, { |
50 | 48 | ||
51 | //------------------------------------------------------------------------- | 49 | //------------------------------------------------------------------------- |
52 | 50 | ||
53 | 'toString': function () { | 51 | 'toString': function () { |
54 | return "Clipperz.PM.UI.Mobile.Components.LoginForm component"; | 52 | return "Clipperz.PM.UI.Mobile.Components.LoginForm component"; |
55 | }, | 53 | }, |
56 | 54 | ||
57 | //------------------------------------------------------------------------- | 55 | //------------------------------------------------------------------------- |
58 | 56 | ||
59 | 'callback': function () { | 57 | 'callback': function () { |
60 | return this._callback; | 58 | return this._callback; |
61 | }, | 59 | }, |
62 | 60 | ||
63 | 'errorCallback': function () { | 61 | 'errorCallback': function () { |
64 | return this._errorCallback; | 62 | return this._errorCallback; |
65 | }, | 63 | }, |
66 | 64 | ||
67 | //------------------------------------------------------------------------- | 65 | //------------------------------------------------------------------------- |
68 | 66 | ||
69 | 'mode': function () { | 67 | 'mode': function () { |
70 | return this._mode; | 68 | return this._mode; |
71 | }, | 69 | }, |
72 | 70 | ||
73 | 'setMode': function (aValue) { | 71 | 'setMode': function (aValue) { |
74 | this._mode = aValue; | 72 | this._mode = aValue; |
75 | }, | 73 | }, |
76 | 74 | ||
77 | //.......................................................................... | 75 | //.......................................................................... |
78 | 76 | ||
79 | 'pin': function () { | 77 | 'pin': function () { |
80 | return this._pin; | 78 | return this._pin; |
81 | }, | 79 | }, |
82 | 80 | ||
83 | 'setPin': function (aValue) { | 81 | 'setPin': function (aValue) { |
84 | this._pin = aValue; | 82 | this._pin = aValue; |
85 | }, | 83 | }, |
86 | 84 | ||
87 | //.......................................................................... | 85 | //.......................................................................... |
88 | 86 | ||
89 | 'username': function () { | 87 | 'username': function () { |
90 | return this._username; | 88 | return this._username; |
91 | }, | 89 | }, |
92 | 90 | ||
93 | 'setUsername': function (aValue) { | 91 | 'setUsername': function (aValue) { |
94 | this._username = aValue; | 92 | this._username = aValue; |
95 | }, | 93 | }, |
96 | 94 | ||
97 | //.......................................................................... | 95 | //.......................................................................... |
98 | 96 | ||
99 | 'passphrase': function () { | 97 | 'passphrase': function () { |
100 | return this._passphrase; | 98 | return this._passphrase; |
101 | }, | 99 | }, |
102 | 100 | ||
103 | 'setPassphrase': function (aValue) { | 101 | 'setPassphrase': function (aValue) { |
104 | this._passphrase = aValue; | 102 | this._passphrase = aValue; |
105 | }, | 103 | }, |
106 | 104 | ||
107 | //------------------------------------------------------------------------- | 105 | //------------------------------------------------------------------------- |
108 | 106 | ||
109 | 'message': function () { | 107 | 'message': function () { |
110 | return this._message; | 108 | return this._message; |
111 | }, | 109 | }, |
112 | 110 | ||
113 | '_setMessage': function (aValue) { | 111 | '_setMessage': function (aValue) { |
114 | this._message = aValue; | 112 | this._message = aValue; |
115 | 113 | ||
116 | if (aValue == null) { | 114 | if (aValue == null) { |
117 | MochiKit.Style.hideElement(this.getElement('credentialsMessage')); | 115 | MochiKit.Style.hideElement(this.getElement('credentialsMessage')); |
118 | } else { | 116 | } else { |
119 | this.getElement('message').innerHTML = aValue; | 117 | this.getElement('message').innerHTML = aValue; |
120 | MochiKit.Style.showElement(this.getElement('credentialsMessage')); | 118 | MochiKit.Style.showElement(this.getElement('credentialsMessage')); |
121 | } | 119 | } |
122 | }, | 120 | }, |
123 | 121 | ||
124 | 'setMessage': function (aValue) { | 122 | 'setMessage': function (aValue) { |
125 | this._setMessage(aValue); | 123 | this._setMessage(aValue); |
126 | MochiKit.DOM.removeElementClass(this.getElement('credentialsMessage'), 'error'); | 124 | MochiKit.DOM.removeElementClass(this.getElement('credentialsMessage'), 'error'); |
127 | }, | 125 | }, |
128 | 126 | ||
129 | 'setErrorMessage': function (aValue) { | 127 | 'setErrorMessage': function (aValue) { |
130 | this._setMessage(aValue); | 128 | this._setMessage(aValue); |
131 | MochiKit.DOM.addElementClass(this.getElement('credentialsMessage'), 'error'); | 129 | MochiKit.DOM.addElementClass(this.getElement('credentialsMessage'), 'error'); |
132 | }, | 130 | }, |
133 | 131 | ||
134 | //------------------------------------------------------------------------- | 132 | //------------------------------------------------------------------------- |
135 | 133 | ||
136 | 'setCallbacks': function (args) { | 134 | 'setCallbacks': function (args) { |
137 | this._callback = args['callback']; | 135 | this._callback = args['callback']; |
138 | this._errorCallback = args['errorCallback']; | 136 | this._errorCallback = args['errorCallback']; |
139 | }, | 137 | }, |
140 | 138 | ||
141 | 'showErrors': function (args) { | 139 | 'showErrors': function (args) { |
142 | //console.log("LoginForm.showErrors", args); | ||
143 | if (args['previousFailedAttempt'] == 'LOGIN') { | 140 | if (args['previousFailedAttempt'] == 'LOGIN') { |
144 | this.setErrorMessage("Wrong credentials"); | 141 | this.setErrorMessage("Wrong credentials"); |
145 | } else if (args['previousFailedAttempt'] == 'PIN') { | 142 | } else if (args['previousFailedAttempt'] == 'PIN') { |
146 | if (args['failedAttempts'] == -1) { | 143 | if (args['failedAttempts'] == -1) { |
147 | this.setErrorMessage("Wrong PIN - Resetted"); | 144 | this.setErrorMessage("Wrong PIN - Resetted"); |
148 | } else { | 145 | } else { |
149 | this.setErrorMessage("Wrong PIN"); | 146 | this.setErrorMessage("Wrong PIN"); |
150 | } | 147 | } |
151 | } else { | 148 | } else { |
152 | this.setMessage(null); | 149 | this.setMessage(null); |
153 | } | 150 | } |
154 | }, | 151 | }, |
155 | 152 | ||
156 | 'updateWithArgs': function (args) { | 153 | 'updateWithArgs': function (args) { |
157 | this.renderIfNeeded(); | 154 | this.renderIfNeeded(); |
158 | this.setCallbacks(args); | 155 | this.setCallbacks(args); |
159 | this.showErrors(args); | 156 | this.showErrors(args); |
160 | this.updateRendering(); | 157 | this.updateRendering(); |
161 | }, | 158 | }, |
162 | 159 | ||
163 | 'showPinLogin': function (args) { | 160 | 'showPinLogin': function (args) { |
164 | this.setPin(''); | 161 | this.setPin(''); |
165 | this.setMode('PIN'); | 162 | this.setMode('PIN'); |
166 | this.updateWithArgs(args); | 163 | this.updateWithArgs(args); |
167 | 164 | ||
168 | // $(this.getAnchor('PIN')).focus(); | 165 | // $(this.getAnchor('PIN')).focus(); |
169 | this.getElement('PIN').focus(); | 166 | this.getElement('PIN').focus(); |
170 | }, | 167 | }, |
171 | 168 | ||
172 | 'showCredentialsLogin': function (args) { | 169 | 'showCredentialsLogin': function (args) { |
173 | this.setMode('CREDENTIALS'); | 170 | this.setMode('CREDENTIALS'); |
174 | this.updateWithArgs(args); | 171 | this.updateWithArgs(args); |
175 | 172 | ||
176 | if (this.getElement('usernameField').value.length == 0) { | 173 | if (this.getElement('usernameField').value.length == 0) { |
177 | // $(this.getAnchor('usernameField')).focus(); | 174 | // $(this.getAnchor('usernameField')).focus(); |
178 | this.getElement('usernameField').focus(); | 175 | this.getElement('usernameField').focus(); |
179 | } else { | 176 | } else { |
180 | // $(this.getAnchor('passphraseField')).focus(); | 177 | // $(this.getAnchor('passphraseField')).focus(); |
181 | this.getElement('passphraseField').focus(); | 178 | this.getElement('passphraseField').focus(); |
182 | this.getElement('passphraseField').select(); | 179 | this.getElement('passphraseField').select(); |
183 | } | 180 | } |
184 | }, | 181 | }, |
185 | 182 | ||
186 | //------------------------------------------------------------------------- | 183 | //------------------------------------------------------------------------- |
187 | 184 | ||
188 | 'renderIfNeeded': function () { | 185 | 'renderIfNeeded': function () { |
189 | if (this.isFullyRendered() == false) { | 186 | if (this.isFullyRendered() == false) { |
190 | this.render(); | 187 | this.render(); |
191 | }; | 188 | }; |
192 | this.updateRendering(); | 189 | this.updateRendering(); |
193 | }, | 190 | }, |
194 | 191 | ||
195 | 'updateRendering': function () { | 192 | 'updateRendering': function () { |
196 | MochiKit.Style.showElement(this.getElement('credentialsBody')); | 193 | MochiKit.Style.showElement(this.getElement('credentialsBody')); |
197 | MochiKit.Style.hideElement(this.getElement('validating')); | 194 | MochiKit.Style.hideElement(this.getElement('validating')); |
198 | 195 | ||
199 | // this.hideAllPanes(); | 196 | // this.hideAllPanes(); |
200 | MochiKit.Base.map(function (aNode) { MochiKit.Style.hideElement(aNode); }, MochiKit.Selector.findDocElements('div.credentialsBody > div')); | 197 | MochiKit.Base.map(function (aNode) { MochiKit.Style.hideElement(aNode); }, MochiKit.Selector.findDocElements('div.credentialsBody > div')); |
201 | if (this.mode() == 'CREDENTIALS') { | 198 | if (this.mode() == 'CREDENTIALS') { |
202 | selectedPanel = this.getElement('credentials') | 199 | selectedPanel = this.getElement('credentials') |
203 | } else if (this.mode() == 'PIN') { | 200 | } else if (this.mode() == 'PIN') { |
204 | selectedPanel = this.getElement('pin') | 201 | selectedPanel = this.getElement('pin') |
205 | // this.updatePinDisplay(); | 202 | // this.updatePinDisplay(); |
206 | } else { | 203 | } else { |
207 | throw 'Unhandled login form mode'; | 204 | throw 'Unhandled login form mode'; |
208 | } | 205 | } |
209 | MochiKit.Style.showElement(selectedPanel); | 206 | MochiKit.Style.showElement(selectedPanel); |
210 | 207 | ||
211 | MochiKit.Style.hideElement(this.getElement('validating')); | 208 | MochiKit.Style.hideElement(this.getElement('validating')); |
212 | }, | 209 | }, |
213 | 210 | ||
214 | 'renderSelf': function() { | 211 | 'renderSelf': function() { |
215 | var selectedPanel; | 212 | var selectedPanel; |
216 | this.append(this.element(), {tag:'div', id:'login', children:[ | 213 | this.append(this.element(), {tag:'div', id:'login', children:[ |
217 | {tag:'div', cls:'toolbar', children:[ | 214 | {tag:'div', cls:'toolbar', children:[ |
218 | {tag:'h1', html:"clipperz"} | 215 | {tag:'h1', html:"clipperz"} |
219 | ]}, | 216 | ]}, |
220 | {tag:'div', cls:'scroll', children:[ | 217 | {tag:'div', cls:'scroll', children:[ |
221 | //================================================================== | 218 | //================================================================== |
222 | {tag:'div', cls:'credentialsMessage', id:this.getId('credentialsMessage'), children:[ | 219 | {tag:'div', cls:'credentialsMessage', id:this.getId('credentialsMessage'), children:[ |
223 | {tag:'h1', cls:'message', id:this.getId('message'), html:"Message"} | 220 | {tag:'h1', cls:'message', id:this.getId('message'), html:"Message"} |
224 | ]}, | 221 | ]}, |
225 | //================================================================== | 222 | //================================================================== |
226 | {tag:'div', cls:'credentialsBody', id:this.getId('credentialsBody'), children:[ | 223 | {tag:'div', cls:'credentialsBody', id:this.getId('credentialsBody'), children:[ |
227 | //-------------------------------------------------------------- | 224 | //-------------------------------------------------------------- |
228 | {tag:'div', cls:'pin', id:this.getId('pin'), children:[ | 225 | {tag:'div', cls:'pin', id:this.getId('pin'), children:[ |
229 | {tag:'form', cls:'scroll', id:this.getId('pinForm'), children:[ | 226 | {tag:'form', cls:'scroll', id:this.getId('pinForm'), children:[ |
230 | {tag:'ul', cls:'edit rounded', children:[ | 227 | {tag:'ul', cls:'edit rounded', children:[ |
231 | {tag:'li', children:[{tag:'input', type:'number', name:'PIN', placeholder:"PIN", id:this.getId('PIN') }]}, | 228 | {tag:'li', children:[{tag:'input', type:'number', name:'PIN', placeholder:"PIN", id:this.getId('PIN') }]}, |
232 | ]}, | 229 | ]}, |
233 | {tag:'a', href:'#', cls:'greenButton', id:this.getId('pinSubmitButton'), html:"Login"} | 230 | {tag:'a', href:'#', cls:'greenButton', id:this.getId('pinSubmitButton'), html:"Login"} |
234 | ]} | 231 | ]} |
235 | ]}, | 232 | ]}, |
236 | //-------------------------------------------------------------- | 233 | //-------------------------------------------------------------- |
237 | {tag:'div', cls:'credentials', id:this.getId('credentials'), children:[ | 234 | {tag:'div', cls:'credentials', id:this.getId('credentials'), children:[ |
238 | {tag:'form', cls:'scroll', id:this.getId('credentialsForm'), children:[ | 235 | {tag:'form', cls:'scroll', id:this.getId('credentialsForm'), children:[ |
239 | {tag:'ul', cls:'edit rounded', children:[ | 236 | {tag:'ul', cls:'edit rounded', children:[ |
240 | {tag:'li', children:[{tag:'input', type:'email', name:'name', /*value:'joe',*/ placeholder:"username", id:this.getId('usernameField') }]}, | 237 | {tag:'li', children:[{tag:'input', type:'email', name:'name', /*value:'joe',*/ placeholder:"username", id:this.getId('usernameField') }]}, |
241 | {tag:'li', children:[{tag:'input', type:'password', name:'passphrase', /*value:'clipperz',*/placeholder:"passphrase", id:this.getId('passphraseField') }]} | 238 | {tag:'li', children:[{tag:'input', type:'password', name:'passphrase', /*value:'clipperz',*/placeholder:"passphrase", id:this.getId('passphraseField') }]} |
242 | ]}, | 239 | ]}, |
243 | {tag:'a', href:'#', cls:'greenButton', id:this.getId('credentialsSubmitButton'), html:"Login"} | 240 | {tag:'a', href:'#', cls:'greenButton', id:this.getId('credentialsSubmitButton'), html:"Login"} |
244 | // {tag:'input', type:'submit', cls:'greenButton', id:this.getId('credentialsSubmitButton'), value:"Login"} | 241 | // {tag:'input', type:'submit', cls:'greenButton', id:this.getId('credentialsSubmitButton'), value:"Login"} |
245 | 242 | ||
246 | ]} | 243 | ]} |
247 | ]}, | 244 | ]}, |
248 | //-------------------------------------------------------------- | 245 | //-------------------------------------------------------------- |
249 | ]}, | 246 | ]}, |
250 | //================================================================== | 247 | //================================================================== |
251 | {tag:'div', cls:'validating', id:this.getId('validating'), children:[ | 248 | {tag:'div', cls:'validating', id:this.getId('validating'), children:[ |
252 | {tag:'div', cls:'loading', children:[ | 249 | {tag:'div', cls:'loading', children:[ |
253 | {tag:'div', cls:'spinner', children:[ | 250 | {tag:'div', cls:'spinner', children:[ |
254 | {tag:'div', cls:'bar01'}, | 251 | {tag:'div', cls:'bar01'}, |
255 | {tag:'div', cls:'bar02'}, | 252 | {tag:'div', cls:'bar02'}, |
256 | {tag:'div', cls:'bar03'}, | 253 | {tag:'div', cls:'bar03'}, |
257 | {tag:'div', cls:'bar04'}, | 254 | {tag:'div', cls:'bar04'}, |
258 | {tag:'div', cls:'bar05'}, | 255 | {tag:'div', cls:'bar05'}, |
259 | {tag:'div', cls:'bar06'}, | 256 | {tag:'div', cls:'bar06'}, |
260 | {tag:'div', cls:'bar07'}, | 257 | {tag:'div', cls:'bar07'}, |
261 | {tag:'div', cls:'bar08'}, | 258 | {tag:'div', cls:'bar08'}, |
262 | {tag:'div', cls:'bar09'}, | 259 | {tag:'div', cls:'bar09'}, |
263 | {tag:'div', cls:'bar10'}, | 260 | {tag:'div', cls:'bar10'}, |
264 | {tag:'div', cls:'bar11'}, | 261 | {tag:'div', cls:'bar11'}, |
265 | {tag:'div', cls:'bar12'} | 262 | {tag:'div', cls:'bar12'} |
266 | ]} | 263 | ]} |
267 | ]}, | 264 | ]}, |
268 | {tag:'div', id:this.getId('loadingMessage')}, | 265 | {tag:'div', id:this.getId('loadingMessage')}, |
269 | {tag:'a', href:'#', cls:'grayButton', id:this.getId('loginCancelButton'), html:"Cancel"} | 266 | {tag:'a', href:'#', cls:'grayButton', id:this.getId('loginCancelButton'), html:"Cancel"} |
270 | ]} | 267 | ]} |
271 | //================================================================== | 268 | //================================================================== |
272 | ]} | 269 | ]} |
273 | ]}); | 270 | ]}); |
274 | 271 | ||
275 | MochiKit.Signal.connect(this.getElement('credentialsForm'), 'onsubmit', this, 'submitCredentialsHandler'); | 272 | MochiKit.Signal.connect(this.getElement('credentialsForm'), 'onsubmit', this, 'submitCredentialsHandler'); |
276 | MochiKit.Signal.connect(this.getElement('credentialsSubmitButton'), 'onclick', this, 'submitCredentialsHandler'); | 273 | MochiKit.Signal.connect(this.getElement('credentialsSubmitButton'), 'onclick', this, 'submitCredentialsHandler'); |
277 | 274 | ||
278 | MochiKit.Signal.connect(this.getElement('pinForm'), 'onsubmit', this, 'submitPinHandler'); | 275 | MochiKit.Signal.connect(this.getElement('pinForm'), 'onsubmit', this, 'submitPinHandler'); |
279 | MochiKit.Signal.connect(this.getElement('pinSubmitButton'), 'onclick', this, 'submitPinHandler'); | 276 | MochiKit.Signal.connect(this.getElement('pinSubmitButton'), 'onclick', this, 'submitPinHandler'); |
280 | 277 | ||
281 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'initProgress', this, 'initProgressHandle'); | 278 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'initProgress', this, 'initProgressHandle'); |
282 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'updateProgress',this, 'updateProgressHandle'); | 279 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'updateProgress',this, 'updateProgressHandle'); |
283 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'advanceProgress',this, 'advanceProgressHandle'); | 280 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'advanceProgress',this, 'advanceProgressHandle'); |
284 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'progressDone', this, 'progressDoneHandle'); | 281 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'progressDone', this, 'progressDoneHandle'); |
285 | }, | 282 | }, |
286 | 283 | ||
287 | //------------------------------------------------------------------------- | 284 | //------------------------------------------------------------------------- |
288 | 285 | ||
289 | 'submitPinHandler': function (anEvent) { | 286 | 'submitPinHandler': function (anEvent) { |
290 | varpin; | 287 | varpin; |
291 | 288 | ||
292 | this.setMessage(null); | 289 | this.setMessage(null); |
293 | pin = this.getElement('PIN').value; | 290 | pin = this.getElement('PIN').value; |
294 | // $(this.getAnchor('PIN')).blur(); | 291 | // $(this.getAnchor('PIN')).blur(); |
295 | this.getElement('PIN').blur(); | 292 | this.getElement('PIN').blur(); |
296 | 293 | ||
297 | credentials = Clipperz.PM.PIN.credentialsWithPIN(pin); | 294 | credentials = Clipperz.PM.PIN.credentialsWithPIN(pin); |
298 | this.loginWithCredentials(credentials); | 295 | this.loginWithCredentials(credentials); |
299 | }, | 296 | }, |
300 | 297 | ||
301 | 'submitCredentialsHandler': function (anEvent) { | 298 | 'submitCredentialsHandler': function (anEvent) { |
302 | //console.log("submitCredentialsHandler"); | ||
303 | varcredentials; | 299 | varcredentials; |
304 | 300 | ||
305 | this.setMessage(null); | 301 | this.setMessage(null); |
306 | 302 | ||
307 | credentials = {}; | 303 | credentials = {}; |
308 | credentials['username'] = this.getElement('usernameField').value; | 304 | credentials['username'] = this.getElement('usernameField').value; |
309 | credentials['passphrase'] = this.getElement('passphraseField').value; | 305 | credentials['passphrase'] = this.getElement('passphraseField').value; |
310 | // $(this.getAnchor('passphraseField')).blur(); | 306 | // $(this.getAnchor('passphraseField')).blur(); |
311 | this.getElement('passphraseField').blur(); | 307 | this.getElement('passphraseField').blur(); |
312 | 308 | ||
313 | this.loginWithCredentials(credentials); | 309 | this.loginWithCredentials(credentials); |
314 | }, | 310 | }, |
315 | 311 | ||
316 | //------------------------------------------------------------------------- | 312 | //------------------------------------------------------------------------- |
317 | 313 | ||
318 | 'loginWithCredentials': function (someCredentials) { | 314 | 'loginWithCredentials': function (someCredentials) { |
319 | varargs; | 315 | varargs; |
320 | 316 | ||
321 | args = {}; | 317 | args = {}; |
322 | args['credentials'] = someCredentials; | 318 | args['credentials'] = someCredentials; |
323 | args['errorCallback'] = this.errorCallback(); | 319 | args['errorCallback'] = this.errorCallback(); |
324 | 320 | ||
325 | MochiKit.Style.hideElement(this.getElement('credentialsBody')); | 321 | MochiKit.Style.hideElement(this.getElement('credentialsBody')); |
326 | MochiKit.Style.showElement(this.getElement('validating')); | 322 | MochiKit.Style.showElement(this.getElement('validating')); |
327 | 323 | ||
328 | MochiKit.Async.callLater(0.1, this.callback(), args); | 324 | MochiKit.Async.callLater(0.1, this.callback(), args); |
329 | }, | 325 | }, |
330 | 326 | ||
331 | //------------------------------------------------------------------------- | 327 | //------------------------------------------------------------------------- |
332 | 328 | ||
333 | 'initProgressHandle': function (anEvent) { | 329 | 'initProgressHandle': function (anEvent) { |
334 | //console.log("** initProgressHandle", anEvent); | ||
335 | this._steps = anEvent['steps']; | 330 | this._steps = anEvent['steps']; |
336 | this._actualSteps = 0; | 331 | this._actualSteps = 0; |
337 | }, | 332 | }, |
338 | 333 | ||
339 | 'updateProgressHandle': function (anEvent) { | 334 | 'updateProgressHandle': function (anEvent) { |
340 | //console.log("** updateProgressHandle", anEvent); | ||
341 | this._steps += anEvent['extraSteps']; | 335 | this._steps += anEvent['extraSteps']; |
342 | }, | 336 | }, |
343 | 337 | ||
344 | 'advanceProgressHandle': function (anEvent) { | 338 | 'advanceProgressHandle': function (anEvent) { |
345 | //console.log("** advanceProgressHandle", anEvent); | ||
346 | this._actualSteps ++; | 339 | this._actualSteps ++; |
347 | //console.log("STEPS: " + this._actualSteps + "/" + this._steps); | ||
348 | }, | 340 | }, |
349 | 341 | ||
350 | 'progressDoneHandle': function (anEvent) { | 342 | 'progressDoneHandle': function (anEvent) { |
351 | //console.log("** progressDoneHandle", anEvent); | ||
352 | }, | 343 | }, |
353 | 344 | ||
354 | //------------------------------------------------------------------------- | 345 | //------------------------------------------------------------------------- |
355 | __syntaxFix__: "syntax fix" | 346 | __syntaxFix__: "syntax fix" |
356 | }); | 347 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js index 12a61f7..9951f44 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js | |||
@@ -1,393 +1,381 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Mobile.Controllers.MainController = function() { | 26 | Clipperz.PM.UI.Mobile.Controllers.MainController = function() { |
29 | this._jQTouch = null; | 27 | // this._jQTouch = null; |
30 | this._user = null; | 28 | this._user = null; |
31 | this._proxy = null; | 29 | this._proxy = null; |
32 | this._loginForm = null; | 30 | this._loginForm = null; |
33 | this._cardList = null; | 31 | this._cardList = null; |
34 | this._cardDetail= null; | 32 | this._cardDetail= null; |
35 | 33 | ||
36 | return this; | 34 | return this; |
37 | } | 35 | } |
38 | 36 | ||
39 | MochiKit.Base.update(Clipperz.PM.UI.Mobile.Controllers.MainController.prototype, { | 37 | MochiKit.Base.update(Clipperz.PM.UI.Mobile.Controllers.MainController.prototype, { |
40 | 38 | ||
41 | 'toString': function () { | 39 | 'toString': function () { |
42 | return "Clipperz.PM.UI.Mobile.Controllers.MainController"; | 40 | return "Clipperz.PM.UI.Mobile.Controllers.MainController"; |
43 | }, | 41 | }, |
44 | 42 | ||
45 | //------------------------------------------------------------------------- | 43 | //------------------------------------------------------------------------- |
46 | 44 | ||
47 | 'user': function () { | 45 | 'user': function () { |
48 | return this._user; | 46 | return this._user; |
49 | }, | 47 | }, |
50 | 48 | ||
51 | 'setUser': function (aValue) { | 49 | 'setUser': function (aValue) { |
52 | this._user = aValue; | 50 | this._user = aValue; |
53 | }, | 51 | }, |
54 | 52 | ||
55 | //------------------------------------------------------------------------- | 53 | //------------------------------------------------------------------------- |
56 | 54 | /* | |
57 | 'jQTouch': function () { | 55 | 'jQTouch': function () { |
58 | return this._jQTouch; | 56 | return this._jQTouch; |
59 | }, | 57 | }, |
60 | 58 | ||
61 | 'setJQTouch': function (aValue) { | 59 | 'setJQTouch': function (aValue) { |
62 | this._jQTouch = aValue; | 60 | this._jQTouch = aValue; |
63 | }, | 61 | }, |
64 | 62 | */ | |
65 | //========================================================================= | 63 | //========================================================================= |
66 | 64 | ||
67 | 'run': function () { | 65 | 'run': function () { |
68 | console.log("MainController.run"); | ||
69 | |||
70 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin')); | 66 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin')); |
71 | Clipperz.DOM.Helper.overwrite(MochiKit.DOM.currentDocument().body, {tag:'div', id:'jqt', children:[ | 67 | Clipperz.DOM.Helper.overwrite(MochiKit.DOM.currentDocument().body, {tag:'div', id:'jqt', children:[ |
72 | {tag:'div', id:'loginForm'}, | 68 | {tag:'div', id:'loginForm'}, |
73 | {tag:'div', id:'cardList'}, | 69 | {tag:'div', id:'cardList'}, |
74 | {tag:'div', id:'cardDetail'}, | 70 | {tag:'div', id:'cardDetail'}, |
75 | {tag:'div', id:'preferences'} | 71 | {tag:'div', id:'preferences'} |
76 | ]}); | 72 | ]}); |
77 | 73 | ||
78 | this.showLoginForm(); | 74 | this.showLoginForm(); |
79 | 75 | ||
80 | this.initjQTouch(); | 76 | // this.initjQTouch(); |
81 | 77 | ||
82 | 78 | ||
83 | // this.showAddToHomeScreenBaloon(); | 79 | // this.showAddToHomeScreenBaloon(); |
84 | // this.selectInitialProxy(); | 80 | // this.selectInitialProxy(); |
85 | }, | 81 | }, |
86 | 82 | /* | |
87 | 'initjQTouch': function () { | 83 | 'initjQTouch': function () { |
88 | var jqt; | 84 | var jqt; |
89 | 85 | ||
90 | jqt = new $.jQTouch({ | 86 | jqt = new $.jQTouch({ |
91 | icon: 'data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAHIAAAByCAIAAAAAvxIqAAAD8GlDQ1BJQ0MgUHJvZmlsZQAAKJGNVd1v21QUP4lvXKQWP6Cxjg4Vi69VU1u5GxqtxgZJk6XpQhq5zdgqpMl1bhpT1za2021Vn/YCbwz4A4CyBx6QeEIaDMT2su0BtElTQRXVJKQ9dNpAaJP2gqpwrq9Tu13GuJGvfznndz7v0TVAx1ea45hJGWDe8l01n5GPn5iWO1YhCc9BJ/RAp6Z7TrpcLgIuxoVH1sNfIcHeNwfa6/9zdVappwMknkJsVz19HvFpgJSpO64PIN5G+fAp30Hc8TziHS4miFhheJbjLMMzHB8POFPqKGKWi6TXtSriJcT9MzH5bAzzHIK1I08t6hq6zHpRdu2aYdJYuk9Q/881bzZa8Xrx6fLmJo/iu4/VXnfH1BB/rmu5ScQvI77m+BkmfxXxvcZcJY14L0DymZp7pML5yTcW61PvIN6JuGr4halQvmjNlCa4bXJ5zj6qhpxrujeKPYMXEd+q00KR5yNAlWZzrF+Ie+uNsdC/MO4tTOZafhbroyXuR3Df08bLiHsQf+ja6gTPWVimZl7l/oUrjl8OcxDWLbNU5D6JRL2gxkDu16fGuC054OMhclsyXTOOFEL+kmMGs4i5kfNuQ62EnBuam8tzP+Q+tSqhz9SuqpZlvR1EfBiOJTSgYMMM7jpYsAEyqJCHDL4dcFFTAwNMlFDUUpQYiadhDmXteeWAw3HEmA2s15k1RmnP4RHuhBybdBOF7MfnICmSQ2SYjIBM3iRvkcMki9IRcnDTthyLz2Ld2fTzPjTQK+Mdg8y5nkZfFO+se9LQr3/09xZr+5GcaSufeAfAww60mAPx+q8u/bAr8rFCLrx7s+vqEkw8qb+p26n11Aruq6m1iJH6PbWGv1VIY25mkNE8PkaQhxfLIF7DZXx80HD/A3l2jLclYs061xNpWCfoB6WHJTjbH0mV35Q/lRXlC+W8cndbl9t2SfhU+Fb4UfhO+F74GWThknBZ+Em4InwjXIyd1ePnY/Psg3pb1TJNu15TMKWMtFt6ScpKL0ivSMXIn9QtDUlj0h7U7N48t3i8eC0GnMC91dX2sTivgloDTgUVeEGHLTizbf5Da9JLhkhh29QOs1luMcScmBXTIIt7xRFxSBxnuJWfuAd1I7jntkyd/pgKaIwVr3MgmDo2q8x6IdB5QH162mcX7ajtnHGN2bov71OU1+U0fqqoXLD0wX5ZM005UHmySz3qLtDqILDvIL+iH6jB9y2x83ok898GOPQX3lk3Itl0A+BrD6D7tUjWh3fis58BXDigN9yF8M5PJH4B8Gr79/F/XRm8m241mw/wvur4BGDj42bzn+Vmc+NL9L8GcMn8F1kAcXjEKMJAAAAACXBIWXMAAAsTAAALEwEAmpwYAAABbmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNC40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iPgogICAgICAgICA8ZGM6c3ViamVjdD4KICAgICAgICAgICAgPHJkZjpCYWcvPgogICAgICAgICA8L2RjOnN1YmplY3Q+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgrlPw1BAAAd7klEQVR4nO19eZQV13nn797a3tr7yg5ikxCIHRohkACBEFqsJY4z8T52nPHYPp74JJ54bMfOsRMf2Z44OZ7EJ16iDLIsS5ZlydJY+2Ii1haiAQFCNGvTNHS/9/pt9Wq93/xRb+9u6OU1wif9O3Wq6223bv3qu7/vu9+9txqYwAQmMIEJTGACE5jABCbwnxTs/a4AHnjggY0bNwohxl4U5/xnP/tZe3v72Iv6g8fDDz9MlcOHP/zh9/uCAEB+vysA27YBkHAh7KK3aSRlMIDAFcZl13UrW73R4f2nNQvXYGYMjANUROkVyWXZvbBIDcLXOH4VHBGuGVoBgAMMYGAAERhAeekfyC8r+svA3n8nUYxrilYXxAFkScz6sKENlgHkfc5AYmSyMc64dmglEOW4pOyOUSlZxS9Y4RVjIHeEcjy+uGZoJYBErmlTdk/5V0NQxnLkUgXiswrimqEVAIkcTQU685+BioJsyikAkDXbCVqHABWslcpopcJfopIuTIFZMSECQ0GAWBGJA2j13mQspw8MeRumayJczeNaorVMW7MxVqkUgIEox6Yo7CdEYAhQji+UuKxyWgcFA0SWWbompODaoRUD7K40Hri8dJIgIVjRt99fXEu0FhNKpWabbfulYJTthjGAXLqW5PVapRUYwGyuj1AcGGTBQAJiQgQGotDFQkFkBwkGcpZbiAK8nqsgEsC10te6FmglAESCeZFAltPiMGvQSAtALhYAsrSSmLDWLIg8Wt0iQgdoa7nXKupm5TuvwgW5NEFrFp6kilyEVGAWGERSvT0rsWgwkEtZeZ2g1YNnX1llRIHNYlq9Dy6Tc4EgciHcPzwRuP/++9Pp9KuvvuoNk1QKRAQIKjBSrABFx9l2P2jvgIFcCAFyxyNunTVj2h/dt82nad/8zg+G+ZPh0ur3+7/70HdnXTdrz54927dvf+qpp7q7u0dbzxJkaaVSESjYbFHbz3NKJSksIOuySFTSZQX8/lvWrPjQg3dvWr92UktTV/eFH/30kYu9fcP57XBpXbOmbebMGURi1apVq1at+upX/9czTz+9/ZGf79q1a8yjciKrjCgKPEvcF8o7tRggBiRIuCQqE2DNnjXjvrs2P3jvHTfMn6sosmmayWSiqaF2w/q2X/zqt8MpYbi0Pvjgg4xzYaXgpIhrLY31f/aZP//EJz6+e/fu7du3P/3Ms5cuXRrlRQjynHhRp55KDgbpdJUIQDbf6hnsGKw1FAysu3nlnzxw94Z1bfX1dY5tO44BV6gwDVcmId+7dWMlaa2urr5j8+0kXLgW4yoTJukpwSQu+2+5Ze0t69Z9/aunnvnts9t//os9e/aO/MIIwi2JBMqZ9YS1zGXlDgRlIwHhQjijE4F5c2Y9eM8dH7hr8/Vzr+MSt03TTPerkutTuCSrINW2kpaptK1YNG3KpLNdV1a/YdG6fv26GTNnuJbByQWTwRQmSZKwyYoLMya4Nqml4bOf+++f/PhHd+7c9cijjz373O96+4alQQCIBIQrhFuqrQNsVgwwWO/TbEfLJRJCjEyOqsKhDevaPnT/tnVrVtbVVlu27ZhpmVl+iWRNYpIMcIDAFZU5KcdsrK3efNuan2z/1RVLHhatD95/Hxgn12CMgbw0vgBjjKuMXC4M0pOOLklycMNt6zZsuPXUyZO/efq3jz72RPv+t69culegtxXKH0DrQB3wDgi5/quLgt+7AhbMn/PgvVvu2bpp7uyZnDPbNKx0ROW2ooBzCVwCGIQAIxCBQ1EVltZdV7l787qfPvLkFVvklWltbGzccNt6YWUYOeBK9pqLXQqXGeOycMiOuWZEcN/USY3/44uf+/QnP/YfO3c98ugvf/fiy9FobKjyCUTCpWy/s6jkkoNSqS3skR0vIEFCkHAvf7011VWb1q/54/vvXLt6WU11tW2ZrpngyAS5KyscXAI4iCBcMMpOWgBBEJd9CqKm6Vu2aP6cWdOOd54ZK60bb1s/eXKrldEVr7kVsZGj2LMRxrgqMUcSGaEnbV1SpNDmjetu33jric7Op37z7GNP/Lrj0DuD8SqyXU+IrHqW8VvSNSjrdCH7KYmsvA4RCSxaMO/Be7bcs3XDdTOnc8ZsM+2kuzVmKpwYl8A4gKx5gmXbfvYAAIFLqkyGaVZXBbfc2lYBWh+47wMggrCYoiBvU0DBlLIXKbLHTOIS4+SQExHxXof5Zk5p/PKXPv+ZT33s9zvefPTxJ198+fX+eKLAKuWttcxlDTDYEmXIcQoAjMj1rLXMZdXX1tx+25oPfmDrmpVLqsJh28oIIyKTHuK2JDEwzzxF1iVmzbOYU++MHIIpisYyumPL226/+V8efsK5bFh5BVqnTpmybm2bbegcAkzKznIgKr0wkXtHZAc/iAAwLktMSCIjMklHl/xSeNuWW7du3nj8vfd+/fRzv3zymSPHjgPw4k0ityhuHZTZPK2D9LgYuQRBJNyc11qy6Po/uueOu7asnzl9GgM5ZkKkzviZoXABzzwJIBdMADyXEfemKnnH3mwwBpY9KVc0hSVM01w0f9YN82YdPPLe6GndvOm2pqYGQ0+qipQjseiCy7qSVEqHRzTjXFI4OYrb5yZ6BfPNmd70lb/8/H/79Eff2LHz4UceD/h9wnUgRDmVA5kt7hqIXMo1a7ACwhWO01BX88cf2PpfHty2avnicDDgWDrpFxSk/MzmHGBSzr95I7gsSxwxMAbGQBxEYLl9Yd4CgUk+hWUyZtAf2Lph9eVpvdyMMMbYs089dsfmjbaR0nwhICthOZPMbdmXOUdMBLjZg8KnORUWthC2Q7LLw5K/1rJhGBlVVbmTCIme3J27jPvK39ocoV7YKpwENTtyfSaTqQqHOBPCjMsirrGMxAisaNJc9oCVHGT3vGjPAF7yDpfITvdG01wJH363c+uffskwraGou5y1zr5u1uoVSy0jI3MGzpF3CESFrcRsaWhNyHk2xjlXVHIh+pxkrwyfxqtclzMigmBe4UPSivLj3I6RICJBIqQJnjmnIqkwh/Gcz/ES5IUpiGzAxnPdNZ4z5LywMoDAOASYrGk8plvW/FlTFi+YvXv/kdHQeueWjbU11YaelNRAzsGW+qtyTUCRBytuy6LoHuQsl0myRDLpqptwhOxCAs9rqyj9eZk4oLQO3idCdmM+iqtM53nz9NpNfg4s5ayVsQK/xLPBMssJQj6uyjLLCxVgkk9T0knDFwjcuWHVaGiVJeneu7Y4tsVATFJzjRrZRsGkrBV4zV84gAPk55rJhebPvD6lneUUZVwzzmWVuSCzkJwelNlifoGi9gGAGEOIp4rUMN8pYIWDPJtULAI5YSWWlVTPeIlyFFPhJUHVfFKy3zLljWsWPxTwp/TMyGi94fp5S2+60TIzmqqAK1lCyYGdgHEJ+jlkeqB3I9MFMwonBWHBixaYDK5BqYIShlYPtR5qPbQGyAFwDRAQTqny5oKY7LG4HLNsqN6Bd0fzg4zFhKJgsN5Bll9WOChQyQr+iigXJOReCmKy6pPchG3Omtq84qZ5r+06MDJa7966KRTwZwxD0kIw+hB/B5G30H8QyfeQPgs7CVE6U7d4CmUxOMBlKGH4WhCYjPBchGbBPwVKFZgMYQFOSc+isC8S2WJmB0lxFZ14YAWGVFWAeM6JFcWqlJvmhXw8kL/xAJP9fiWRMWUlsO225SOjVVXVbXdstB3B4wfZwR8jfgiZbm9MpETlhwlyYMZgxNB/FHgZnEFrRGg2ahai5kb4WsEVCCvX0Sp2WZcV2QKzrNxy84QWuGalNpu3guIDzzsxEM/63oIs5E4toGh+hfWZlrxu5Q211aFYPDVcWpfedOON82dbtu07sx3nXoAMMEAaNo8DwQrXCBCMS8hcQu9OyBpCs1G/HLVL4WsGOMgqUl5RwmNJQrbIa5U4MZQ2HFa6L9PWHJvFzT8byeZdmWe2yPcLmKT6VYrp1pTm2jVL5z/32iDLwAan6rOf+si6taudZLev8/uM9MtGt6NC3mLIRaYXsQ707kD6JJgMrR5czWW1Sw22oLmicFDwhKUDt1lac28ylN+M4o0V3R42YI+8TXg/55ysVNqQZcVx3f/3+lsDr28Qaw0GA1s23mLarhTbzY3eETT20cEr30mjdw/69iA0E03rUbccchCuVS61JRRjQGCAIXWgzGAHD12pYLnFCpv3ltnvQPUFVClhWmbb4tnNDTUX+/rLrmkQa13btvxzn/pTx3H8p34o6acrb6qDIn91Vj+iB9D/NiDga4akFSVSS0W2kJbNezYxiCWiKH4o2CYKRoqylyh6M49SlyjJZCXTGVETDhzpPH/kRFfZ1Qxiivdu3SjLEqwos/rAclW9avDsJnMBpx7Fse8hsjuX3i7rK3sKkGfcBTyP5w6yCe99J7sXInec/0L+uLgXXlaOyKVmBFxTljiERcLdesvCgYvCyq21vq7277/2xYBPcUmyGjba1ctJDjA3ye1EiQ8Yb3iWaycQexv6afiaoNYOYrPFCuvZLyu24sGkEwXnM0iSM29BeYvOvvT8mG0Z6VS8Pxrpj6dcIsZITGqpf+a1t+NJvbj65dpaU1PTr4sWpgb8ZJrMrl5pVa9mdkxJHVajv1fi+ySjuxCNjDe8U/QfReokmtajcT0kDcIq19ZiOkRx+82FBPluqxdpZV96LTUfsRYrbD4lyMEIwrIsR8/YaUOYFhPEOGc+nyakQHfMfvPAKcMub86DcOMPBJctWXzX1k0bb1k5e3qzyoVlmrZgIMacmJI8rMb+Q020S2bP1eMXgABC0zH5bgSmQtil6RgM5rtQFJaiaPVmPmWFLI8exWVJLAYIsmxHN9y0CdOWXMEkiWmaRrK/O+buPnT2+df37W7viEUHGQy9HCWBYGjZ0sXbNm/YtG7ldVMbFeaYpukIBjBmx+TUEV//m2qyXTIvXSV+CZA0tNyO+lUA5TJqZfkt76v5lFXRz7MdqhyhJblBno1bGSCEabm6ibTJTVcWgnHONE2D7L8QFzs7zjz/RvvetzqikcsNLQ+LiVAovHz50js337rx5uUzJ9fJcEzTyPOrpo9o8Z1a8m3J6h13fj2aapegdQskX26tvCgIAkoNtpjZgoWiQKuXnQFBkGmLtMl1SzZdxSUmsSybPQnadfDM82+8tbu9IxrpHU41R0ZAuKp6xfKl225ff9vNS6a31Mhk5+2X21FFP+KL79bSHZLVN778CiA4FVPugVoHYZcSStkeUZmdUqm1slyClYRpU9qS05ZquqogLnFoqgol0JOgXYfOvfBG++72jkjfsNgsPuFoUFVds3LF0m2333rr6oXTmqs4WZZh2h6/TlRNH/Un92rpg5IdGdt5hgYBai0m3w3/lFzWsTgILRNZrw4sqwwgEmTZSFtK2tZMVxPEOSefpkEO9CRo9+FzL/x+/659HZG+Uc6AGuvlVtfUrlq5bNumdetWLpjaFOaukbNfcCem6cd8qX0+/bBkRytxtlIQIPsx6S6EZmXDg9IkbHZNYtZIyWPTdFjaUnXbbwgtZ5sKU4IXE9j9zrnn39i/u72jr3e088lyqNiF1tTWrV65bNumW25ZccOUBj9cwzQMhyQQSU5Myxzzp9p9maOSE6vkaT0n1roFoTmlNlv8DUFCmLaUtrW07TeFTxCXGGmaytTgxQT2HDn//Bv7d+07MHY286i8+NXW1betXHbnprVrl82bXOeHq5uG6RAHSLKjmvFuIH3AZxyR3HhlzkcAV9C6BaHZEFbuLQJAwjVsnra1tBOwXJ8LLjFomsKU4KUk9h7pfmHH2zv3Hui9dLEyNSnCOMZEdfUNa1Yvv3PjzTcvnt1aq1qZpG074DKE3dLzkM94r6I2q6J1CwLTiz2YcO2uRH1a1HLmSpxrgareFPYevfDCjgM79x64dLGnQqcfBFcjlG9oaFq9atmXPrF1drNmu7y2/8ma+PPjo7NboTVCONm3GExTnE22giu9Kf7dR/fs2nfgYs+Fip54cIx31g8A+vouvXfkQLWccYgH0vuqEy+NSwLXyaDnFVj9YJRPoGiq0+S7IFwnLOvxC+9eHU4xtoz/cFFbFfzJ331mxtRWlulqivxUEplxaSQMcE1YUQSn5YYLCUQ+2XZs02Hhm2+asWP/yUhcv3JRY8a408oY+9YXP7ipbaFppJqjD2t29zgKDwPsFIQF/6RszhAEICDrKZ35/eEFsxqf33ncssd90fG40/qRe9d+/sO3G5Zbl3gmnNk/7mLOACsCOQC1Nve4IcE480vpaEqZ3FRXHVJff+vUOFdinGldcv2M7//Vh7ikBvX2huSzjF2tfLjRC18zJBVwvTFwWRYK9IjuWzS7uTemHz5ZsRB1UIwjrXXVwX/+2kcmN9dzs6s18XNO5vidqxzChZNCYFJhDJHIp9iObacs36oFre3HLlzoG2QgulIYL1o5Y9/6wn23rZxvGqnW5KOqc+kqpWU9MMBOg6vQaiGc7AgCQ1DNJHXGJf+S2Y0vt59OG5VcDlmM8aL1o/e0ffZD6zOW25j+Xdg8dFU59cAAKw5/E7iUHxtnHAFFj6TkxprQpMbgK+1nhRgXXRoXWpfdMP2hv7iPMTlk7G/KvPg+cOpBuCAbvgbAzU/LlWWhwuhLaXOn1tiOaD82LiJbeVrra0I//OsPtjTUSGbXJP1JjiHn1g4fBObCx71JicOHJwVqFSStMEWDyKfZruP069ryufXHz/Wf7kmOvYZlqDCtnLNvf+6utUuvs8zU5MyTmohc+TfDQIJd183XVtNJjhGGnEQQJnz12bHu7KA3hTQjlWGuUJfNrdtxsKc/VYF7X4wK0/qxu1f+2QOrM6bbYr4Udt6tSJk2AmfZBh2NAAujfKLDFcAA14AczAVb3ui3YJyCqh5JKOGgOnty+OX9F2ynkg8oqyStyxdM/fvP30lMqrY7mqw3KlXsebQl0crI1NHoR9THRphRJIAs+Gqy8oqcyCpC40ZvXJveHPCr0puHRzascnlUjNaGmuA//dU9TXXVitU9xXp2xDo4BGI0s4dukmVFVv2upaepqYadldhIAiMGuBYUPyRvAVQu3iLh1yzhuNGUsmhWuCdqvNtVMZGtDK0SZ9/+7Ja2hdMcMznV+q1K5VO9RgcLwTNiraJoz3ck955yls/UdJMsBGt5F8NIAiMCIKAGQE7OYL2NQj4jpTPDkpbPDe873t8br4zIVobWT9y97JP3LDFMp9V5vYoq1eNmZ90VGTREDPVLP3jx1Z2Hbm5b0RpIJu2QDCvEoyMpCRA2VB84gRzABhwv6mJMhLRMJKFqsnTjjMArB6KGVQGRrQCtqxZM+daf3yZIqnEONou9Yy/QQ8Sd2ePMUzXtO788tq/juOvYh08n7ly3ULEjSVEX5n0qN0ZQHBE4QeagHKdwAAfkyIrjk81Lca2lRmmslt84FB84aDtSjJXWxtrgD/5iS311UHW6p4lXRhwADQGTQqesFYqqvPKO+Y+PvE4kAPT1RVJUs2Fxo5nRdVFdJ1/gbNiWxQC4UBhgAhZgASZgAzbI8fsM4VJfUp0/WdNN9+DpseZkx0SrJPFvf+bWlTe0OlZqOr2soTKST2Cn7SWGqIrZvr/84Y54vOD63zl+dsacBTe0WClDEiTVKMN9GAQACIJsg9s5g/U2G8wCOeFAOq3L6Yy89DrtaFemKzKmdMGYBl0+vm3hllXTM4bZSrsDGMkVXha99rSY1aCoyv95uvPc+ZJhEhLOd37y4ul0k8rNi2ZzxGoaQc+YADu3uqx4E4AQnNmzWroVnpK58+X7aifVjekJYaO31tU3TvrGJ9oEsTpxpIV1jKUSxciI0CljoSrLb7wn/uHnO2jAv9DJ6OnOXtq6ZiYykYRTXadEZD68YM67AXLpxKwiyIrwK+bFqFwToBmN/LXDpjta7zVKWptrg//7C+trw37N7ZkuvclRmS4KgZ/M3GC4wYQT/PKP9sX6B4/8z3f3SOFpa+aqum4YQmvwRYdrsjQ0rQQQ/D4HwrnUL2Y2urIk9p4Y5XWNhlZZ4t/6dNuyeQ2ulZol7VBZhQbdGHrMKT3GJJ9P/YdnL7751rHLfLfj3a6FixbPDEcSpswhqrT0cM/C8wsrSk6dR1XQSet2Im0vnCbOR9E5qrkZo9HWj985f9Oy1kzGnCy95WeVifwBpJ3QeX2KT3Z3nMCTLw6+Oi8P28x8+2c7+9gMmTLnUnVxMzBckXUGW7UhChtjmDtFaDKRiy9sYXNaRnMtI7bWpddP/btPLXcsUxAx2CEek1gF+qkC/ERytumqKVH11z85FIld+W4lEvGLRvj2pXVWui9l+xr8aWk4Y2UMkIdeZMIAwsUI+uLMcRFWae7U0IsdrjvCbPeIrTWq4534ZH+4hgkjYk9512hLuA0jLaQcDN16c9wMaKr845d6T545P8zfvfjavicO+INBLWWIU7HwsAw299C9QWyWwbJw5CSOnWa2RTKRG75+b3SRSyNmacTW2h9PPPf7w0r93KXzW5lx0XDkqNMCICTHR9ZPz4MhaQVPJqZqktjdFfrez9tH8pQw6jjeu2rFTc3y6f4MfLIb0obhZNhgXoujP4nDJ1kkwRmRX9N6fau/+ZT79ItvjfSpZRidy3Jsa+e+g8f7fCuWLq6VopZlxp26tBsKyYnhxjpFcIkf759qOUxntV95+L2+yJBPzBoUlmUcvcC2tE3imZP9GdQHSLlixMkHLIslnL2Io6eZYUEiClQ37+xf/pV/e+/YuydGejkeRh+3njp99qW3umdcv2JOM3P0vrQTiNl1Gjf88uBPLhgcDOcS9Zf0kN+n/vOr9ut7j4+iJn19EV2etm6+m0kldIs1hYfxT8nywQCHaeHoaZy5yEmQwsFqb/zZ/inff2RvMj6SbE4pxtR5TSbiz+84bIfmLF8wVTZ7TIeiVp0jpLCS5nxY3iNu+Dr76zXJab9Q/71fHBLuKL3fkc7emfOWzavp6U/ZnKE2dKWVj7k1WdF+HOpk0QTjRH6fv0dr+8avjedebSd3TJ3XsaZaSDhvdRw90MWXLl3WpMYsI5mwwgk7EFJ0VboCR47g70ZqLUeYvP6rj1y41Dey5l9aD/dAp75+9Y1V7tlomlX74fddllkJRDjTjSNnmGlBAgVqWndEl3714WMnOk+OvhqF4iuB890XXth7rmX2iuunqK7ek3HkSCascCekmkN6Z4bTsWBvSgoElH/dob2yp3OMdcjo6dPx6s3L6p1UbyLDmqsgDXVxHIaNd07iTA8jQSpnVLfox+0t//iLPelkZcLwig26ZPT0SzuP9MszVy6aqVldluVEjYDh8CrNlAYKAkNMlzojiipnDvRO/u5jJ12nAhNMzl/oleuuXzU1nUzoloOmmsG+xHEphoOdLJZgnCjgD5z3tf3Nr1Mv7dhPojIDRajwyCuJw0dP7OmkhUtWTQpGLD2SsNRYRgkqtk8pinsYbAdHLjLbMS25+euPGT2XRu8cynD4RN/Cm5ZNVbqiCfKpqCoWWQZBONHFjp1llg0Z5K+d/Fp0ydf+/cjp06crVQEPlZ9+0dvb+7td56qmrVw0Q6X0qYzt9qXBmQj7Csv4Tvay3hQF/P5/293y0q5KTot0Xftwl7tx1Vw10xVNsoYqaJq3bAO6gYOd7HwfANIkJuoX/6i98YeP7zbSiSsWO1KMy2Qh28rs2HOsy565csnsoHPaMs1omqUtVPkgK+hLoLOXaRIO9c9+6JdnnUo0/2Ik4vE+0brhBl8mEUtnWEs9uISLEXScYHEdEigYCp1V277+ZPy1nW+P07+FG7+JmPRe55nfH8W8m9ZPr07YeiJlskiKSRyne5ltk6O2fuMJ58LFykx7KcPJsxfrpy++qSHSnzCFYLEEjp5ljoDCyF8/7YWLi/7m3w+eO3duPE7tYXynDff3x17YdU5qWr1kTg1Lnzcs9CWY7SDg9/3f/a0v7By/WdHU0RlbvWJJI85GkoimGAP5ZG7XLf2nndU//tVu0xjHya24CpPcXcfae+D48cSU5cuWVotuy7RUiR1NXvfQ4+ccp8Izn4phW8a7vcqWldOYfoERgqGqTrnta4/3vrn3ICqUdL8MrsZKFwBnz51/9VBm+oL1cxuMjKt+8zfifE/Fxr6GQl8kmvHNXD9HSP7a57pv/NvtHd3dw82N/SGBy75P/cmW//rA6qv1xAwwSf2fn77z3ttXXBP/FGiccTXW2L1/p5vABCYwgQlMYAL/2fH/AdkCEQl+/Ar/AAAAAElFTkSuQmCCCg==', | 87 | icon: 'data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAHIAAAByCAIAAAAAvxIqAAAD8GlDQ1BJQ0MgUHJvZmlsZQAAKJGNVd1v21QUP4lvXKQWP6Cxjg4Vi69VU1u5GxqtxgZJk6XpQhq5zdgqpMl1bhpT1za2021Vn/YCbwz4A4CyBx6QeEIaDMT2su0BtElTQRXVJKQ9dNpAaJP2gqpwrq9Tu13GuJGvfznndz7v0TVAx1ea45hJGWDe8l01n5GPn5iWO1YhCc9BJ/RAp6Z7TrpcLgIuxoVH1sNfIcHeNwfa6/9zdVappwMknkJsVz19HvFpgJSpO64PIN5G+fAp30Hc8TziHS4miFhheJbjLMMzHB8POFPqKGKWi6TXtSriJcT9MzH5bAzzHIK1I08t6hq6zHpRdu2aYdJYuk9Q/881bzZa8Xrx6fLmJo/iu4/VXnfH1BB/rmu5ScQvI77m+BkmfxXxvcZcJY14L0DymZp7pML5yTcW61PvIN6JuGr4halQvmjNlCa4bXJ5zj6qhpxrujeKPYMXEd+q00KR5yNAlWZzrF+Ie+uNsdC/MO4tTOZafhbroyXuR3Df08bLiHsQf+ja6gTPWVimZl7l/oUrjl8OcxDWLbNU5D6JRL2gxkDu16fGuC054OMhclsyXTOOFEL+kmMGs4i5kfNuQ62EnBuam8tzP+Q+tSqhz9SuqpZlvR1EfBiOJTSgYMMM7jpYsAEyqJCHDL4dcFFTAwNMlFDUUpQYiadhDmXteeWAw3HEmA2s15k1RmnP4RHuhBybdBOF7MfnICmSQ2SYjIBM3iRvkcMki9IRcnDTthyLz2Ld2fTzPjTQK+Mdg8y5nkZfFO+se9LQr3/09xZr+5GcaSufeAfAww60mAPx+q8u/bAr8rFCLrx7s+vqEkw8qb+p26n11Aruq6m1iJH6PbWGv1VIY25mkNE8PkaQhxfLIF7DZXx80HD/A3l2jLclYs061xNpWCfoB6WHJTjbH0mV35Q/lRXlC+W8cndbl9t2SfhU+Fb4UfhO+F74GWThknBZ+Em4InwjXIyd1ePnY/Psg3pb1TJNu15TMKWMtFt6ScpKL0ivSMXIn9QtDUlj0h7U7N48t3i8eC0GnMC91dX2sTivgloDTgUVeEGHLTizbf5Da9JLhkhh29QOs1luMcScmBXTIIt7xRFxSBxnuJWfuAd1I7jntkyd/pgKaIwVr3MgmDo2q8x6IdB5QH162mcX7ajtnHGN2bov71OU1+U0fqqoXLD0wX5ZM005UHmySz3qLtDqILDvIL+iH6jB9y2x83ok898GOPQX3lk3Itl0A+BrD6D7tUjWh3fis58BXDigN9yF8M5PJH4B8Gr79/F/XRm8m241mw/wvur4BGDj42bzn+Vmc+NL9L8GcMn8F1kAcXjEKMJAAAAACXBIWXMAAAsTAAALEwEAmpwYAAABbmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNC40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iPgogICAgICAgICA8ZGM6c3ViamVjdD4KICAgICAgICAgICAgPHJkZjpCYWcvPgogICAgICAgICA8L2RjOnN1YmplY3Q+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgrlPw1BAAAd7klEQVR4nO19eZQV13nn797a3tr7yg5ikxCIHRohkACBEFqsJY4z8T52nPHYPp74JJ54bMfOsRMf2Z44OZ7EJ16iDLIsS5ZlydJY+2Ii1haiAQFCNGvTNHS/9/pt9Wq93/xRb+9u6OU1wif9O3Wq6223bv3qu7/vu9+9txqYwAQmMIEJTGACE5jABCbwnxTs/a4AHnjggY0bNwohxl4U5/xnP/tZe3v72Iv6g8fDDz9MlcOHP/zh9/uCAEB+vysA27YBkHAh7KK3aSRlMIDAFcZl13UrW73R4f2nNQvXYGYMjANUROkVyWXZvbBIDcLXOH4VHBGuGVoBgAMMYGAAERhAeekfyC8r+svA3n8nUYxrilYXxAFkScz6sKENlgHkfc5AYmSyMc64dmglEOW4pOyOUSlZxS9Y4RVjIHeEcjy+uGZoJYBErmlTdk/5V0NQxnLkUgXiswrimqEVAIkcTQU685+BioJsyikAkDXbCVqHABWslcpopcJfopIuTIFZMSECQ0GAWBGJA2j13mQspw8MeRumayJczeNaorVMW7MxVqkUgIEox6Yo7CdEYAhQji+UuKxyWgcFA0SWWbompODaoRUD7K40Hri8dJIgIVjRt99fXEu0FhNKpWabbfulYJTthjGAXLqW5PVapRUYwGyuj1AcGGTBQAJiQgQGotDFQkFkBwkGcpZbiAK8nqsgEsC10te6FmglAESCeZFAltPiMGvQSAtALhYAsrSSmLDWLIg8Wt0iQgdoa7nXKupm5TuvwgW5NEFrFp6kilyEVGAWGERSvT0rsWgwkEtZeZ2g1YNnX1llRIHNYlq9Dy6Tc4EgciHcPzwRuP/++9Pp9KuvvuoNk1QKRAQIKjBSrABFx9l2P2jvgIFcCAFyxyNunTVj2h/dt82nad/8zg+G+ZPh0ur3+7/70HdnXTdrz54927dvf+qpp7q7u0dbzxJkaaVSESjYbFHbz3NKJSksIOuySFTSZQX8/lvWrPjQg3dvWr92UktTV/eFH/30kYu9fcP57XBpXbOmbebMGURi1apVq1at+upX/9czTz+9/ZGf79q1a8yjciKrjCgKPEvcF8o7tRggBiRIuCQqE2DNnjXjvrs2P3jvHTfMn6sosmmayWSiqaF2w/q2X/zqt8MpYbi0Pvjgg4xzYaXgpIhrLY31f/aZP//EJz6+e/fu7du3P/3Ms5cuXRrlRQjynHhRp55KDgbpdJUIQDbf6hnsGKw1FAysu3nlnzxw94Z1bfX1dY5tO44BV6gwDVcmId+7dWMlaa2urr5j8+0kXLgW4yoTJukpwSQu+2+5Ze0t69Z9/aunnvnts9t//os9e/aO/MIIwi2JBMqZ9YS1zGXlDgRlIwHhQjijE4F5c2Y9eM8dH7hr8/Vzr+MSt03TTPerkutTuCSrINW2kpaptK1YNG3KpLNdV1a/YdG6fv26GTNnuJbByQWTwRQmSZKwyYoLMya4Nqml4bOf+++f/PhHd+7c9cijjz373O96+4alQQCIBIQrhFuqrQNsVgwwWO/TbEfLJRJCjEyOqsKhDevaPnT/tnVrVtbVVlu27ZhpmVl+iWRNYpIMcIDAFZU5KcdsrK3efNuan2z/1RVLHhatD95/Hxgn12CMgbw0vgBjjKuMXC4M0pOOLklycMNt6zZsuPXUyZO/efq3jz72RPv+t69culegtxXKH0DrQB3wDgi5/quLgt+7AhbMn/PgvVvu2bpp7uyZnDPbNKx0ROW2ooBzCVwCGIQAIxCBQ1EVltZdV7l787qfPvLkFVvklWltbGzccNt6YWUYOeBK9pqLXQqXGeOycMiOuWZEcN/USY3/44uf+/QnP/YfO3c98ugvf/fiy9FobKjyCUTCpWy/s6jkkoNSqS3skR0vIEFCkHAvf7011VWb1q/54/vvXLt6WU11tW2ZrpngyAS5KyscXAI4iCBcMMpOWgBBEJd9CqKm6Vu2aP6cWdOOd54ZK60bb1s/eXKrldEVr7kVsZGj2LMRxrgqMUcSGaEnbV1SpNDmjetu33jric7Op37z7GNP/Lrj0DuD8SqyXU+IrHqW8VvSNSjrdCH7KYmsvA4RCSxaMO/Be7bcs3XDdTOnc8ZsM+2kuzVmKpwYl8A4gKx5gmXbfvYAAIFLqkyGaVZXBbfc2lYBWh+47wMggrCYoiBvU0DBlLIXKbLHTOIS4+SQExHxXof5Zk5p/PKXPv+ZT33s9zvefPTxJ198+fX+eKLAKuWttcxlDTDYEmXIcQoAjMj1rLXMZdXX1tx+25oPfmDrmpVLqsJh28oIIyKTHuK2JDEwzzxF1iVmzbOYU++MHIIpisYyumPL226/+V8efsK5bFh5BVqnTpmybm2bbegcAkzKznIgKr0wkXtHZAc/iAAwLktMSCIjMklHl/xSeNuWW7du3nj8vfd+/fRzv3zymSPHjgPw4k0ityhuHZTZPK2D9LgYuQRBJNyc11qy6Po/uueOu7asnzl9GgM5ZkKkzviZoXABzzwJIBdMADyXEfemKnnH3mwwBpY9KVc0hSVM01w0f9YN82YdPPLe6GndvOm2pqYGQ0+qipQjseiCy7qSVEqHRzTjXFI4OYrb5yZ6BfPNmd70lb/8/H/79Eff2LHz4UceD/h9wnUgRDmVA5kt7hqIXMo1a7ACwhWO01BX88cf2PpfHty2avnicDDgWDrpFxSk/MzmHGBSzr95I7gsSxwxMAbGQBxEYLl9Yd4CgUk+hWUyZtAf2Lph9eVpvdyMMMbYs089dsfmjbaR0nwhICthOZPMbdmXOUdMBLjZg8KnORUWthC2Q7LLw5K/1rJhGBlVVbmTCIme3J27jPvK39ocoV7YKpwENTtyfSaTqQqHOBPCjMsirrGMxAisaNJc9oCVHGT3vGjPAF7yDpfITvdG01wJH363c+uffskwraGou5y1zr5u1uoVSy0jI3MGzpF3CESFrcRsaWhNyHk2xjlXVHIh+pxkrwyfxqtclzMigmBe4UPSivLj3I6RICJBIqQJnjmnIqkwh/Gcz/ES5IUpiGzAxnPdNZ4z5LywMoDAOASYrGk8plvW/FlTFi+YvXv/kdHQeueWjbU11YaelNRAzsGW+qtyTUCRBytuy6LoHuQsl0myRDLpqptwhOxCAs9rqyj9eZk4oLQO3idCdmM+iqtM53nz9NpNfg4s5ayVsQK/xLPBMssJQj6uyjLLCxVgkk9T0knDFwjcuWHVaGiVJeneu7Y4tsVATFJzjRrZRsGkrBV4zV84gAPk55rJhebPvD6lneUUZVwzzmWVuSCzkJwelNlifoGi9gGAGEOIp4rUMN8pYIWDPJtULAI5YSWWlVTPeIlyFFPhJUHVfFKy3zLljWsWPxTwp/TMyGi94fp5S2+60TIzmqqAK1lCyYGdgHEJ+jlkeqB3I9MFMwonBWHBixaYDK5BqYIShlYPtR5qPbQGyAFwDRAQTqny5oKY7LG4HLNsqN6Bd0fzg4zFhKJgsN5Bll9WOChQyQr+iigXJOReCmKy6pPchG3Omtq84qZ5r+06MDJa7966KRTwZwxD0kIw+hB/B5G30H8QyfeQPgs7CVE6U7d4CmUxOMBlKGH4WhCYjPBchGbBPwVKFZgMYQFOSc+isC8S2WJmB0lxFZ14YAWGVFWAeM6JFcWqlJvmhXw8kL/xAJP9fiWRMWUlsO225SOjVVXVbXdstB3B4wfZwR8jfgiZbm9MpETlhwlyYMZgxNB/FHgZnEFrRGg2ahai5kb4WsEVCCvX0Sp2WZcV2QKzrNxy84QWuGalNpu3guIDzzsxEM/63oIs5E4toGh+hfWZlrxu5Q211aFYPDVcWpfedOON82dbtu07sx3nXoAMMEAaNo8DwQrXCBCMS8hcQu9OyBpCs1G/HLVL4WsGOMgqUl5RwmNJQrbIa5U4MZQ2HFa6L9PWHJvFzT8byeZdmWe2yPcLmKT6VYrp1pTm2jVL5z/32iDLwAan6rOf+si6taudZLev8/uM9MtGt6NC3mLIRaYXsQ707kD6JJgMrR5czWW1Sw22oLmicFDwhKUDt1lac28ylN+M4o0V3R42YI+8TXg/55ysVNqQZcVx3f/3+lsDr28Qaw0GA1s23mLarhTbzY3eETT20cEr30mjdw/69iA0E03rUbccchCuVS61JRRjQGCAIXWgzGAHD12pYLnFCpv3ltnvQPUFVClhWmbb4tnNDTUX+/rLrmkQa13btvxzn/pTx3H8p34o6acrb6qDIn91Vj+iB9D/NiDga4akFSVSS0W2kJbNezYxiCWiKH4o2CYKRoqylyh6M49SlyjJZCXTGVETDhzpPH/kRFfZ1Qxiivdu3SjLEqwos/rAclW9avDsJnMBpx7Fse8hsjuX3i7rK3sKkGfcBTyP5w6yCe99J7sXInec/0L+uLgXXlaOyKVmBFxTljiERcLdesvCgYvCyq21vq7277/2xYBPcUmyGjba1ctJDjA3ye1EiQ8Yb3iWaycQexv6afiaoNYOYrPFCuvZLyu24sGkEwXnM0iSM29BeYvOvvT8mG0Z6VS8Pxrpj6dcIsZITGqpf+a1t+NJvbj65dpaU1PTr4sWpgb8ZJrMrl5pVa9mdkxJHVajv1fi+ySjuxCNjDe8U/QfReokmtajcT0kDcIq19ZiOkRx+82FBPluqxdpZV96LTUfsRYrbD4lyMEIwrIsR8/YaUOYFhPEOGc+nyakQHfMfvPAKcMub86DcOMPBJctWXzX1k0bb1k5e3qzyoVlmrZgIMacmJI8rMb+Q020S2bP1eMXgABC0zH5bgSmQtil6RgM5rtQFJaiaPVmPmWFLI8exWVJLAYIsmxHN9y0CdOWXMEkiWmaRrK/O+buPnT2+df37W7viEUHGQy9HCWBYGjZ0sXbNm/YtG7ldVMbFeaYpukIBjBmx+TUEV//m2qyXTIvXSV+CZA0tNyO+lUA5TJqZfkt76v5lFXRz7MdqhyhJblBno1bGSCEabm6ibTJTVcWgnHONE2D7L8QFzs7zjz/RvvetzqikcsNLQ+LiVAovHz50js337rx5uUzJ9fJcEzTyPOrpo9o8Z1a8m3J6h13fj2aapegdQskX26tvCgIAkoNtpjZgoWiQKuXnQFBkGmLtMl1SzZdxSUmsSybPQnadfDM82+8tbu9IxrpHU41R0ZAuKp6xfKl225ff9vNS6a31Mhk5+2X21FFP+KL79bSHZLVN778CiA4FVPugVoHYZcSStkeUZmdUqm1slyClYRpU9qS05ZquqogLnFoqgol0JOgXYfOvfBG++72jkjfsNgsPuFoUFVds3LF0m2333rr6oXTmqs4WZZh2h6/TlRNH/Un92rpg5IdGdt5hgYBai0m3w3/lFzWsTgILRNZrw4sqwwgEmTZSFtK2tZMVxPEOSefpkEO9CRo9+FzL/x+/659HZG+Uc6AGuvlVtfUrlq5bNumdetWLpjaFOaukbNfcCem6cd8qX0+/bBkRytxtlIQIPsx6S6EZmXDg9IkbHZNYtZIyWPTdFjaUnXbbwgtZ5sKU4IXE9j9zrnn39i/u72jr3e088lyqNiF1tTWrV65bNumW25ZccOUBj9cwzQMhyQQSU5Myxzzp9p9maOSE6vkaT0n1roFoTmlNlv8DUFCmLaUtrW07TeFTxCXGGmaytTgxQT2HDn//Bv7d+07MHY286i8+NXW1betXHbnprVrl82bXOeHq5uG6RAHSLKjmvFuIH3AZxyR3HhlzkcAV9C6BaHZEFbuLQJAwjVsnra1tBOwXJ8LLjFomsKU4KUk9h7pfmHH2zv3Hui9dLEyNSnCOMZEdfUNa1Yvv3PjzTcvnt1aq1qZpG074DKE3dLzkM94r6I2q6J1CwLTiz2YcO2uRH1a1HLmSpxrgareFPYevfDCjgM79x64dLGnQqcfBFcjlG9oaFq9atmXPrF1drNmu7y2/8ma+PPjo7NboTVCONm3GExTnE22giu9Kf7dR/fs2nfgYs+Fip54cIx31g8A+vouvXfkQLWccYgH0vuqEy+NSwLXyaDnFVj9YJRPoGiq0+S7IFwnLOvxC+9eHU4xtoz/cFFbFfzJ331mxtRWlulqivxUEplxaSQMcE1YUQSn5YYLCUQ+2XZs02Hhm2+asWP/yUhcv3JRY8a408oY+9YXP7ipbaFppJqjD2t29zgKDwPsFIQF/6RszhAEICDrKZ35/eEFsxqf33ncssd90fG40/qRe9d+/sO3G5Zbl3gmnNk/7mLOACsCOQC1Nve4IcE480vpaEqZ3FRXHVJff+vUOFdinGldcv2M7//Vh7ikBvX2huSzjF2tfLjRC18zJBVwvTFwWRYK9IjuWzS7uTemHz5ZsRB1UIwjrXXVwX/+2kcmN9dzs6s18XNO5vidqxzChZNCYFJhDJHIp9iObacs36oFre3HLlzoG2QgulIYL1o5Y9/6wn23rZxvGqnW5KOqc+kqpWU9MMBOg6vQaiGc7AgCQ1DNJHXGJf+S2Y0vt59OG5VcDlmM8aL1o/e0ffZD6zOW25j+Xdg8dFU59cAAKw5/E7iUHxtnHAFFj6TkxprQpMbgK+1nhRgXXRoXWpfdMP2hv7iPMTlk7G/KvPg+cOpBuCAbvgbAzU/LlWWhwuhLaXOn1tiOaD82LiJbeVrra0I//OsPtjTUSGbXJP1JjiHn1g4fBObCx71JicOHJwVqFSStMEWDyKfZruP069ryufXHz/Wf7kmOvYZlqDCtnLNvf+6utUuvs8zU5MyTmohc+TfDQIJd183XVtNJjhGGnEQQJnz12bHu7KA3hTQjlWGuUJfNrdtxsKc/VYF7X4wK0/qxu1f+2QOrM6bbYr4Udt6tSJk2AmfZBh2NAAujfKLDFcAA14AczAVb3ui3YJyCqh5JKOGgOnty+OX9F2ynkg8oqyStyxdM/fvP30lMqrY7mqw3KlXsebQl0crI1NHoR9THRphRJIAs+Gqy8oqcyCpC40ZvXJveHPCr0puHRzascnlUjNaGmuA//dU9TXXVitU9xXp2xDo4BGI0s4dukmVFVv2upaepqYadldhIAiMGuBYUPyRvAVQu3iLh1yzhuNGUsmhWuCdqvNtVMZGtDK0SZ9/+7Ja2hdMcMznV+q1K5VO9RgcLwTNiraJoz3ck955yls/UdJMsBGt5F8NIAiMCIKAGQE7OYL2NQj4jpTPDkpbPDe873t8br4zIVobWT9y97JP3LDFMp9V5vYoq1eNmZ90VGTREDPVLP3jx1Z2Hbm5b0RpIJu2QDCvEoyMpCRA2VB84gRzABhwv6mJMhLRMJKFqsnTjjMArB6KGVQGRrQCtqxZM+daf3yZIqnEONou9Yy/QQ8Sd2ePMUzXtO788tq/juOvYh08n7ly3ULEjSVEX5n0qN0ZQHBE4QeagHKdwAAfkyIrjk81Lca2lRmmslt84FB84aDtSjJXWxtrgD/5iS311UHW6p4lXRhwADQGTQqesFYqqvPKO+Y+PvE4kAPT1RVJUs2Fxo5nRdVFdJ1/gbNiWxQC4UBhgAhZgASZgAzbI8fsM4VJfUp0/WdNN9+DpseZkx0SrJPFvf+bWlTe0OlZqOr2soTKST2Cn7SWGqIrZvr/84Y54vOD63zl+dsacBTe0WClDEiTVKMN9GAQACIJsg9s5g/U2G8wCOeFAOq3L6Yy89DrtaFemKzKmdMGYBl0+vm3hllXTM4bZSrsDGMkVXha99rSY1aCoyv95uvPc+ZJhEhLOd37y4ul0k8rNi2ZzxGoaQc+YADu3uqx4E4AQnNmzWroVnpK58+X7aifVjekJYaO31tU3TvrGJ9oEsTpxpIV1jKUSxciI0CljoSrLb7wn/uHnO2jAv9DJ6OnOXtq6ZiYykYRTXadEZD68YM67AXLpxKwiyIrwK+bFqFwToBmN/LXDpjta7zVKWptrg//7C+trw37N7ZkuvclRmS4KgZ/M3GC4wYQT/PKP9sX6B4/8z3f3SOFpa+aqum4YQmvwRYdrsjQ0rQQQ/D4HwrnUL2Y2urIk9p4Y5XWNhlZZ4t/6dNuyeQ2ulZol7VBZhQbdGHrMKT3GJJ9P/YdnL7751rHLfLfj3a6FixbPDEcSpswhqrT0cM/C8wsrSk6dR1XQSet2Im0vnCbOR9E5qrkZo9HWj985f9Oy1kzGnCy95WeVifwBpJ3QeX2KT3Z3nMCTLw6+Oi8P28x8+2c7+9gMmTLnUnVxMzBckXUGW7UhChtjmDtFaDKRiy9sYXNaRnMtI7bWpddP/btPLXcsUxAx2CEek1gF+qkC/ERytumqKVH11z85FIld+W4lEvGLRvj2pXVWui9l+xr8aWk4Y2UMkIdeZMIAwsUI+uLMcRFWae7U0IsdrjvCbPeIrTWq4534ZH+4hgkjYk9512hLuA0jLaQcDN16c9wMaKr845d6T545P8zfvfjavicO+INBLWWIU7HwsAw299C9QWyWwbJw5CSOnWa2RTKRG75+b3SRSyNmacTW2h9PPPf7w0r93KXzW5lx0XDkqNMCICTHR9ZPz4MhaQVPJqZqktjdFfrez9tH8pQw6jjeu2rFTc3y6f4MfLIb0obhZNhgXoujP4nDJ1kkwRmRX9N6fau/+ZT79ItvjfSpZRidy3Jsa+e+g8f7fCuWLq6VopZlxp26tBsKyYnhxjpFcIkf759qOUxntV95+L2+yJBPzBoUlmUcvcC2tE3imZP9GdQHSLlixMkHLIslnL2Io6eZYUEiClQ37+xf/pV/e+/YuydGejkeRh+3njp99qW3umdcv2JOM3P0vrQTiNl1Gjf88uBPLhgcDOcS9Zf0kN+n/vOr9ut7j4+iJn19EV2etm6+m0kldIs1hYfxT8nywQCHaeHoaZy5yEmQwsFqb/zZ/inff2RvMj6SbE4pxtR5TSbiz+84bIfmLF8wVTZ7TIeiVp0jpLCS5nxY3iNu+Dr76zXJab9Q/71fHBLuKL3fkc7emfOWzavp6U/ZnKE2dKWVj7k1WdF+HOpk0QTjRH6fv0dr+8avjedebSd3TJ3XsaZaSDhvdRw90MWXLl3WpMYsI5mwwgk7EFJ0VboCR47g70ZqLUeYvP6rj1y41Dey5l9aD/dAp75+9Y1V7tlomlX74fddllkJRDjTjSNnmGlBAgVqWndEl3714WMnOk+OvhqF4iuB890XXth7rmX2iuunqK7ek3HkSCascCekmkN6Z4bTsWBvSgoElH/dob2yp3OMdcjo6dPx6s3L6p1UbyLDmqsgDXVxHIaNd07iTA8jQSpnVLfox+0t//iLPelkZcLwig26ZPT0SzuP9MszVy6aqVldluVEjYDh8CrNlAYKAkNMlzojiipnDvRO/u5jJ12nAhNMzl/oleuuXzU1nUzoloOmmsG+xHEphoOdLJZgnCjgD5z3tf3Nr1Mv7dhPojIDRajwyCuJw0dP7OmkhUtWTQpGLD2SsNRYRgkqtk8pinsYbAdHLjLbMS25+euPGT2XRu8cynD4RN/Cm5ZNVbqiCfKpqCoWWQZBONHFjp1llg0Z5K+d/Fp0ydf+/cjp06crVQEPlZ9+0dvb+7td56qmrVw0Q6X0qYzt9qXBmQj7Csv4Tvay3hQF/P5/293y0q5KTot0Xftwl7tx1Vw10xVNsoYqaJq3bAO6gYOd7HwfANIkJuoX/6i98YeP7zbSiSsWO1KMy2Qh28rs2HOsy565csnsoHPaMs1omqUtVPkgK+hLoLOXaRIO9c9+6JdnnUo0/2Ik4vE+0brhBl8mEUtnWEs9uISLEXScYHEdEigYCp1V277+ZPy1nW+P07+FG7+JmPRe55nfH8W8m9ZPr07YeiJlskiKSRyne5ltk6O2fuMJ58LFykx7KcPJsxfrpy++qSHSnzCFYLEEjp5ljoDCyF8/7YWLi/7m3w+eO3duPE7tYXynDff3x17YdU5qWr1kTg1Lnzcs9CWY7SDg9/3f/a0v7By/WdHU0RlbvWJJI85GkoimGAP5ZG7XLf2nndU//tVu0xjHya24CpPcXcfae+D48cSU5cuWVotuy7RUiR1NXvfQ4+ccp8Izn4phW8a7vcqWldOYfoERgqGqTrnta4/3vrn3ICqUdL8MrsZKFwBnz51/9VBm+oL1cxuMjKt+8zfifE/Fxr6GQl8kmvHNXD9HSP7a57pv/NvtHd3dw82N/SGBy75P/cmW//rA6qv1xAwwSf2fn77z3ttXXBP/FGiccTXW2L1/p5vABCYwgQlMYAL/2fH/AdkCEQl+/Ar/AAAAAElFTkSuQmCCCg==', |
92 | // icon4: 'jqtouch4.png', | 88 | // icon4: 'jqtouch4.png', |
93 | // startupScreen: null, //Pass a string path to a 320px x 460px startup screen for full screen apps. | 89 | // startupScreen: null, //Pass a string path to a 320px x 460px startup screen for full screen apps. |
94 | statusBar: 'black-translucent', //Styles the status bar when running as a fullscreen app. Other options are `default`, `black`, and `black-translucent`. | 90 | statusBar: 'black-translucent', //Styles the status bar when running as a fullscreen app. Other options are `default`, `black`, and `black-translucent`. |
95 | // addGlossToIcon: true, //Set to 'false' to prevent automatic glossy button effect on icon. | 91 | // addGlossToIcon: true, //Set to 'false' to prevent automatic glossy button effect on icon. |
96 | preloadImages: false, //Pass an array of image paths to load them before page loads. Ex: `['images/link_over.png', 'images/link_select.png']` | 92 | preloadImages: false, //Pass an array of image paths to load them before page loads. Ex: `['images/link_over.png', 'images/link_select.png']` |
97 | fixedViewport: true, //Removes the user's ability to scale the page. Ensures the site behaves more like an application. | 93 | fixedViewport: true, //Removes the user's ability to scale the page. Ensures the site behaves more like an application. |
98 | // fullScreen: true, //The website will become a fullscreen application when saved to a user's home screen. Set to `false` to disable. | 94 | // fullScreen: true, //The website will become a fullscreen application when saved to a user's home screen. Set to `false` to disable. |
99 | // fullScreenClass: 'fullscreen' //Adds a class to the `<body>` when running in full-screen mode, to allow for easy detection and styling. Set to `false` to disable. | 95 | // fullScreenClass: 'fullscreen' //Adds a class to the `<body>` when running in full-screen mode, to allow for easy detection and styling. Set to `false` to disable. |
100 | // themeSelectionSelector: '#jqt #themes ul', //??? | 96 | // themeSelectionSelector: '#jqt #themes ul', //??? |
101 | 97 | ||
102 | // useAnimations: true, //Set to `false` to disable all animations. | 98 | // useAnimations: true, //Set to `false` to disable all animations. |
103 | // useFastTouch: true, //Removes ~350ms onClick delay when tapping a link (use in conjunction with the .tap() event) **Experimental** | 99 | // useFastTouch: true, //Removes ~350ms onClick delay when tapping a link (use in conjunction with the .tap() event) **Experimental** |
104 | // useTouchScroll: true, //Adds support for iOS5 scrolling. Set to false to disable. **Experimental** | 100 | // useTouchScroll: true, //Adds support for iOS5 scrolling. Set to false to disable. **Experimental** |
105 | 101 | ||
106 | cacheGetRequests: false, //Automatically caches GET requests, so subsequent taps reference the pre-loaded views. (default: true) | 102 | cacheGetRequests: false, //Automatically caches GET requests, so subsequent taps reference the pre-loaded views. (default: true) |
107 | 103 | ||
108 | // backSelector: '.back, .cancel, .goback', //A CSS selector for back links/buttons. When clicked, the page history goes back one, automatically reversing whichever entrance animation was used. | 104 | // backSelector: '.back, .cancel, .goback', //A CSS selector for back links/buttons. When clicked, the page history goes back one, automatically reversing whichever entrance animation was used. |
109 | 105 | ||
110 | // cubeSelector: '.cube', //Link selector for a cube animation. | 106 | // cubeSelector: '.cube', //Link selector for a cube animation. |
111 | // dissolveSelector: '.dissolve', //Link selector for a dissolve animation. | 107 | // dissolveSelector: '.dissolve', //Link selector for a dissolve animation. |
112 | // fadeSelector: '.fade', //Link selector for a fade animation. | 108 | // fadeSelector: '.fade', //Link selector for a fade animation. |
113 | // flipSelector: '.flip', //Link selector for a 3d flip animation. | 109 | // flipSelector: '.flip', //Link selector for a 3d flip animation. |
114 | formSelector: null, //Sets which forms are automatically submitted via Ajax. (default: 'form') | 110 | formSelector: null, //Sets which forms are automatically submitted via Ajax. (default: 'form') |
115 | // popSelector: '.pop', //Link selector for a pop animation. (default: '.pop') | 111 | // popSelector: '.pop', //Link selector for a pop animation. (default: '.pop') |
116 | // slideSelector: 'body > * > ul li a', //Link selector for the default slide-left transition. By default applies to all links within an unordered list. Accepts any jQuery-capable selector `'li > a, a:not(.dontslide)'`, etc. (default: 'body > * > ul li a') | 112 | // slideSelector: 'body > * > ul li a', //Link selector for the default slide-left transition. By default applies to all links within an unordered list. Accepts any jQuery-capable selector `'li > a, a:not(.dontslide)'`, etc. (default: 'body > * > ul li a') |
117 | // slideupSelector: '.slideup', //Link selector for a slide up animation. (default: '.slideup') | 113 | // slideupSelector: '.slideup', //Link selector for a slide up animation. (default: '.slideup') |
118 | // submitSelector: '.submit', //Selector which, when clicked, will submit its parent form (and close keyboard if open). (default: '.submit') | 114 | // submitSelector: '.submit', //Selector which, when clicked, will submit its parent form (and close keyboard if open). (default: '.submit') |
119 | // swapSelector: '.swap', //Link selector for 3d swap animation. (default: '.swap') | 115 | // swapSelector: '.swap', //Link selector for 3d swap animation. (default: '.swap') |
120 | // touchSelector: 'a, .touch', //Selector for items which are automatically given expanded touch events. This makes ordinary links more responsive and provides trigger events like `swipe` (default: 'a, .touch') | 116 | // touchSelector: 'a, .touch', //Selector for items which are automatically given expanded touch events. This makes ordinary links more responsive and provides trigger events like `swipe` (default: 'a, .touch') |
121 | 117 | ||
122 | debug: false | 118 | debug: false |
123 | }); | 119 | }); |
124 | 120 | ||
125 | this.setJQTouch(jqt); | 121 | this.setJQTouch(jqt); |
126 | }, | 122 | }, |
127 | 123 | */ | |
128 | //========================================================================= | 124 | //========================================================================= |
129 | 125 | ||
130 | 'showAddToHomeScreenBaloon': function () { | 126 | 'showAddToHomeScreenBaloon': function () { |
131 | console.log(">>> showAddToHomeScreenBaloon"); | ||
132 | }, | 127 | }, |
133 | 128 | ||
134 | //------------------------------------------------------------------------- | 129 | //------------------------------------------------------------------------- |
135 | 130 | ||
136 | 'selectInitialProxy': function () { | 131 | 'selectInitialProxy': function () { |
137 | //console.log(">>> selectInitialProxy"); | ||
138 | if (this.isOnline()) { | 132 | if (this.isOnline()) { |
139 | //console.log("--- selectInitialProxy: using default proxy"); | ||
140 | this._proxy = Clipperz.PM.Proxy.defaultProxy; | 133 | this._proxy = Clipperz.PM.Proxy.defaultProxy; |
141 | } else { | 134 | } else { |
142 | if (this.hasLocalData()) { | 135 | if (this.hasLocalData()) { |
143 | //console.log("--- selectInitialProxy: using local cache proxy"); | ||
144 | this._proxy = new Clipperz.PM.Proxy.OfflineCache({'shouldPayTolls':false}); | 136 | this._proxy = new Clipperz.PM.Proxy.OfflineCache({'shouldPayTolls':false}); |
145 | } else { | 137 | } else { |
146 | this.showOfflineError(); | 138 | this.showOfflineError(); |
147 | } | 139 | } |
148 | } | 140 | } |
149 | }, | 141 | }, |
150 | 142 | ||
151 | //------------------------------------------------------------------------- | 143 | //------------------------------------------------------------------------- |
152 | 144 | ||
153 | 'showLoginForm': function (args) { | 145 | 'showLoginForm': function (args) { |
154 | args = args || {}; | 146 | args = args || {}; |
155 | 147 | ||
156 | args['callback'] = MochiKit.Base.method(this, 'doLogin'); | 148 | args['callback'] = MochiKit.Base.method(this, 'doLogin'); |
157 | 149 | ||
158 | if (Clipperz.PM.PIN.isSet()) { | 150 | if (Clipperz.PM.PIN.isSet()) { |
159 | args['errorCallback'] = MochiKit.Base.method(this, 'handleFailedPinLogin'); | 151 | args['errorCallback'] = MochiKit.Base.method(this, 'handleFailedPinLogin'); |
160 | this.loginForm().showPinLogin(args); | 152 | this.loginForm().showPinLogin(args); |
161 | } else { | 153 | } else { |
162 | args['errorCallback'] = MochiKit.Base.method(this, 'handleFailedCredentialsLogin'); | 154 | args['errorCallback'] = MochiKit.Base.method(this, 'handleFailedCredentialsLogin'); |
163 | this.loginForm().showCredentialsLogin(args); | 155 | this.loginForm().showCredentialsLogin(args); |
164 | } | 156 | } |
165 | }, | 157 | }, |
166 | 158 | ||
167 | //......................................................................... | 159 | //......................................................................... |
168 | 160 | ||
169 | 'handleFailedCredentialsLogin': function () { | 161 | 'handleFailedCredentialsLogin': function () { |
170 | console.log("LOGIN FAILED"); | ||
171 | this.showLoginForm({'previousFailedAttempt':'LOGIN'}); | 162 | this.showLoginForm({'previousFailedAttempt':'LOGIN'}); |
172 | }, | 163 | }, |
173 | 164 | ||
174 | //......................................................................... | 165 | //......................................................................... |
175 | 166 | ||
176 | 'handleFailedPinLogin': function () { | 167 | 'handleFailedPinLogin': function () { |
177 | varfailedAttempts; | 168 | varfailedAttempts; |
178 | varstatus; | 169 | varstatus; |
179 | 170 | ||
180 | failedAttempts = Clipperz.PM.PIN.recordFailedAttempt(); | 171 | failedAttempts = Clipperz.PM.PIN.recordFailedAttempt(); |
181 | this.showLoginForm({'previousFailedAttempt':'PIN', 'failedAttempts': failedAttempts}); | 172 | this.showLoginForm({'previousFailedAttempt':'PIN', 'failedAttempts': failedAttempts}); |
182 | }, | 173 | }, |
183 | 174 | ||
184 | //------------------------------------------------------------------------- | 175 | //------------------------------------------------------------------------- |
185 | 176 | ||
186 | 'doLogin': function (someArgs) { | 177 | 'doLogin': function (someArgs) { |
187 | var deferredResult; | 178 | var deferredResult; |
188 | var credentials; | 179 | var credentials; |
189 | var errorCallback; | 180 | var errorCallback; |
190 | var user; | 181 | var user; |
191 | var getPassphraseDelegate; | 182 | var getPassphraseDelegate; |
192 | 183 | ||
193 | //console.log(">>> MainController.doLogin", someArgs); | ||
194 | credentials = someArgs['credentials']; | 184 | credentials = someArgs['credentials']; |
195 | errorCallback = someArgs['errorCallback'] || MochiKit.Base.noop; | 185 | errorCallback = someArgs['errorCallback'] || MochiKit.Base.noop; |
196 | 186 | ||
197 | getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, credentials.passphrase); | 187 | getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, credentials.passphrase); |
198 | user = new Clipperz.PM.DataModel.User({'username':credentials.username, 'getPassphraseFunction':getPassphraseDelegate}); | 188 | user = new Clipperz.PM.DataModel.User({'username':credentials.username, 'getPassphraseFunction':getPassphraseDelegate}); |
199 | 189 | ||
200 | deferredResult = new Clipperz.Async.Deferred('MainController.doLogin', {trace:false}); | 190 | deferredResult = new Clipperz.Async.Deferred('MainController.doLogin', {trace:false}); |
201 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4}); | 191 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4}); |
202 | deferredResult.addCallback(MochiKit.Async.wait, 0.1); | 192 | deferredResult.addCallback(MochiKit.Async.wait, 0.1); |
203 | deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'); | 193 | deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'); |
204 | deferredResult.addMethod(user, 'login'); | 194 | deferredResult.addMethod(user, 'login'); |
205 | deferredResult.addCallbacks( | 195 | deferredResult.addCallbacks( |
206 | MochiKit.Base.method(this, 'processSuccessfulLogin', user), | 196 | MochiKit.Base.method(this, 'processSuccessfulLogin', user), |
207 | errorCallback | 197 | errorCallback |
208 | ); | 198 | ); |
209 | deferredResult.callback(); | 199 | deferredResult.callback(); |
210 | 200 | ||
211 | return deferredResult; | 201 | return deferredResult; |
212 | }, | 202 | }, |
213 | 203 | ||
214 | //.......................................................................... | 204 | //.......................................................................... |
215 | 205 | ||
216 | 'processSuccessfulLogin': function (aUser) { | 206 | 'processSuccessfulLogin': function (aUser) { |
217 | var deferredResult; | 207 | var deferredResult; |
218 | 208 | ||
219 | deferredResult = new Clipperz.Async.Deferred('MainController.processSuccessfulLogin', {trace:false}); | 209 | deferredResult = new Clipperz.Async.Deferred('MainController.processSuccessfulLogin', {trace:false}); |
220 | deferredResult.addMethod(Clipperz.PM.PIN, 'resetFailedAttemptCount'); | 210 | deferredResult.addMethod(Clipperz.PM.PIN, 'resetFailedAttemptCount'); |
221 | // deferredResult.addMethod(this, 'removeLoginForm'); | 211 | // deferredResult.addMethod(this, 'removeLoginForm'); |
222 | deferredResult.addMethod(this, 'setUser', aUser); | 212 | deferredResult.addMethod(this, 'setUser', aUser); |
223 | deferredResult.addMethod(this, 'setupApplication'); | 213 | deferredResult.addMethod(this, 'setupApplication'); |
224 | deferredResult.addMethod(this, 'runApplication'); | 214 | deferredResult.addMethod(this, 'runApplication'); |
225 | deferredResult.callback(); | 215 | deferredResult.callback(); |
226 | 216 | ||
227 | return deferredResult; | 217 | return deferredResult; |
228 | }, | 218 | }, |
229 | 219 | ||
230 | //------------------------------------------------------------------------- | 220 | //------------------------------------------------------------------------- |
231 | 221 | ||
232 | 'setupApplication': function () { | 222 | 'setupApplication': function () { |
233 | vardeferredResult; | 223 | vardeferredResult; |
234 | 224 | ||
235 | console.log(">>> setupApplication"); | ||
236 | deferredResult = new Clipperz.Async.Deferred("MainController.setupApplication", {trace:false}); | 225 | deferredResult = new Clipperz.Async.Deferred("MainController.setupApplication", {trace:false}); |
237 | deferredResult.addMethod(this, 'welcomeFirstTimeUser'); | 226 | deferredResult.addMethod(this, 'welcomeFirstTimeUser'); |
238 | deferredResult.addMethod(this, 'showPaymentReminder'); | 227 | deferredResult.addMethod(this, 'showPaymentReminder'); |
239 | deferredResult.addMethod(this, 'copyDataLocally'); | 228 | deferredResult.addMethod(this, 'copyDataLocally'); |
240 | deferredResult.callback(arguments); | 229 | deferredResult.callback(arguments); |
241 | 230 | ||
242 | return deferredResult; | 231 | return deferredResult; |
243 | }, | 232 | }, |
244 | 233 | ||
245 | 234 | ||
246 | //.......................................................................... | 235 | //.......................................................................... |
247 | 236 | ||
248 | 'isFirstTimeUser': function () { | 237 | 'isFirstTimeUser': function () { |
249 | return false; | 238 | return false; |
250 | }, | 239 | }, |
251 | 240 | ||
252 | 'welcomeFirstTimeUser': function () { | 241 | 'welcomeFirstTimeUser': function () { |
253 | vardeferredResult; | 242 | vardeferredResult; |
254 | 243 | ||
255 | deferredResult = new Clipperz.Async.Deferred('MainController.welcomeFirstTimeUser', {trace:false}); | 244 | deferredResult = new Clipperz.Async.Deferred('MainController.welcomeFirstTimeUser', {trace:false}); |
256 | 245 | ||
257 | if (this.isFirstTimeUser()) { | 246 | if (this.isFirstTimeUser()) { |
258 | deferredResult.addCallback(function () { console.log("--> welcome"); }); | 247 | deferredResult.addCallback(function () { Clipperz.log("--> welcome"); }); |
259 | } | 248 | } |
260 | deferredResult.callback(); | 249 | deferredResult.callback(); |
261 | 250 | ||
262 | return deferredResult; | 251 | return deferredResult; |
263 | }, | 252 | }, |
264 | 253 | ||
265 | //.......................................................................... | 254 | //.......................................................................... |
266 | 255 | ||
267 | 'shouldShowPaymentReminder': function () { | 256 | 'shouldShowPaymentReminder': function () { |
268 | return true; | 257 | return true; |
269 | }, | 258 | }, |
270 | 259 | ||
271 | 'showPaymentReminder': function () { | 260 | 'showPaymentReminder': function () { |
272 | vardeferredResult; | 261 | vardeferredResult; |
273 | 262 | ||
274 | deferredResult = new Clipperz.Async.Deferred('MainController.showPaymentReminder', {trace:false}); | 263 | deferredResult = new Clipperz.Async.Deferred('MainController.showPaymentReminder', {trace:false}); |
275 | 264 | ||
276 | if (this.shouldShowPaymentReminder()) { | 265 | if (this.shouldShowPaymentReminder()) { |
277 | deferredResult.addCallback(function () { console.log("--> payment reminder"); }); | 266 | deferredResult.addCallback(function () { Clipperz.log("--> payment reminder"); }); |
278 | } | 267 | } |
279 | deferredResult.callback(); | 268 | deferredResult.callback(); |
280 | 269 | ||
281 | return deferredResult; | 270 | return deferredResult; |
282 | }, | 271 | }, |
283 | 272 | ||
284 | //.......................................................................... | 273 | //.......................................................................... |
285 | 274 | ||
286 | 'canCopyDataLocally': function () { | 275 | 'canCopyDataLocally': function () { |
287 | return false; | 276 | return false; |
288 | }, | 277 | }, |
289 | 278 | ||
290 | 'copyDataLocally': function () { | 279 | 'copyDataLocally': function () { |
291 | vardeferredResult; | 280 | vardeferredResult; |
292 | 281 | ||
293 | deferredResult = new Clipperz.Async.Deferred('MainController.copyDataLocally', {trace:false}); | 282 | deferredResult = new Clipperz.Async.Deferred('MainController.copyDataLocally', {trace:false}); |
294 | 283 | ||
295 | if (this.canCopyDataLocally()) { | 284 | if (this.canCopyDataLocally()) { |
296 | deferredResult.addCallback(function () { console.log("--> copy data locally"); }); | 285 | deferredResult.addCallback(function () { Clipperz.log("--> copy data locally"); }); |
297 | } | 286 | } |
298 | deferredResult.callback(); | 287 | deferredResult.callback(); |
299 | 288 | ||
300 | return deferredResult; | 289 | return deferredResult; |
301 | 290 | ||
302 | }, | 291 | }, |
303 | 292 | ||
304 | //------------------------------------------------------------------------- | 293 | //------------------------------------------------------------------------- |
305 | 294 | ||
306 | 'runApplication': function () { | 295 | 'runApplication': function () { |
307 | var deferredResult; | 296 | var deferredResult; |
308 | 297 | ||
309 | //console.log(">>> runApplication"); | ||
310 | deferredResult = new Clipperz.Async.Deferred('MainController.runApplication', {trace:true}); | 298 | deferredResult = new Clipperz.Async.Deferred('MainController.runApplication', {trace:true}); |
311 | deferredResult.addMethod(this.user(), 'getRecords'); | 299 | deferredResult.addMethod(this.user(), 'getRecords'); |
312 | deferredResult.addMethod(this, 'showCards'); | 300 | deferredResult.addMethod(this, 'showCards'); |
313 | deferredResult.callback(); | 301 | deferredResult.callback(); |
314 | 302 | ||
315 | return deferredResult; | 303 | return deferredResult; |
316 | }, | 304 | }, |
317 | 305 | ||
318 | //========================================================================= | 306 | //========================================================================= |
319 | 307 | ||
320 | 'showOfflineError': function (anException) { | 308 | 'showOfflineError': function (anException) { |
321 | alert("Error: " + anException); | 309 | alert("Error: " + anException); |
322 | throw anException; | 310 | throw anException; |
323 | }, | 311 | }, |
324 | 312 | ||
325 | //========================================================================= | 313 | //========================================================================= |
326 | 314 | ||
327 | 'isOnline': function() { | 315 | 'isOnline': function() { |
328 | return navigator.onLine; | 316 | return navigator.onLine; |
329 | }, | 317 | }, |
330 | 318 | ||
331 | 'hasLocalData': function() { | 319 | 'hasLocalData': function() { |
332 | return false; | 320 | return false; |
333 | }, | 321 | }, |
334 | 322 | ||
335 | //========================================================================= | 323 | //========================================================================= |
336 | 324 | ||
337 | 'loginForm': function() { | 325 | 'loginForm': function() { |
338 | if (this._loginForm == null) { | 326 | if (this._loginForm == null) { |
339 | this._loginForm = new Clipperz.PM.UI.Mobile.Components.LoginForm({element:MochiKit.DOM.getElement('loginForm')}); | 327 | this._loginForm = new Clipperz.PM.UI.Mobile.Components.LoginForm({element:MochiKit.DOM.getElement('loginForm')}); |
340 | } | 328 | } |
341 | 329 | ||
342 | return this._loginForm; | 330 | return this._loginForm; |
343 | }, | 331 | }, |
344 | 332 | ||
345 | 'removeLoginForm': function () { | 333 | 'removeLoginForm': function () { |
346 | if (this._loginForm != null) { | 334 | if (this._loginForm != null) { |
347 | this._loginForm.remove(); | 335 | this._loginForm.remove(); |
348 | this._loginForm = null; | 336 | this._loginForm = null; |
349 | } | 337 | } |
350 | }, | 338 | }, |
351 | 339 | ||
352 | //------------------------------------------------------------------------- | 340 | //------------------------------------------------------------------------- |
353 | 341 | ||
354 | 'cardList': function () { | 342 | 'cardList': function () { |
355 | if (this._cardList == null) { | 343 | if (this._cardList == null) { |
356 | this._cardList = new Clipperz.PM.UI.Mobile.Components.CardList({element:MochiKit.DOM.getElement('cardList')}); | 344 | this._cardList = new Clipperz.PM.UI.Mobile.Components.CardList({element:MochiKit.DOM.getElement('cardList')}); |
357 | MochiKit.Signal.connect(this._cardList, 'selectedCard', this, 'selectCardHandler'); | 345 | MochiKit.Signal.connect(this._cardList, 'selectedCard', this, 'selectCardHandler'); |
358 | } | 346 | } |
359 | 347 | ||
360 | return this._cardList; | 348 | return this._cardList; |
361 | }, | 349 | }, |
362 | 350 | ||
363 | 'showCards': function (someCards) { | 351 | 'showCards': function (someCards) { |
364 | this.cardList().showCards(someCards); | 352 | this.cardList().showCards(someCards); |
365 | this.jQTouch().goTo('#cardList', 'slideleft'); | 353 | // this.jQTouch().goTo('#cardList', 'slideleft'); |
366 | }, | 354 | }, |
367 | 355 | ||
368 | //------------------------------------------------------------------------- | 356 | //------------------------------------------------------------------------- |
369 | 357 | ||
370 | 'cardDetail': function () { | 358 | 'cardDetail': function () { |
371 | if (this._cardDetail == null) { | 359 | if (this._cardDetail == null) { |
372 | this._cardDetail = new Clipperz.PM.UI.Mobile.Components.CardDetail({element:MochiKit.DOM.getElement('cardDetail')}); | 360 | this._cardDetail = new Clipperz.PM.UI.Mobile.Components.CardDetail({element:MochiKit.DOM.getElement('cardDetail')}); |
373 | } | 361 | } |
374 | 362 | ||
375 | return this._cardDetail; | 363 | return this._cardDetail; |
376 | }, | 364 | }, |
377 | 365 | ||
378 | 'selectCardHandler': function (aCardReference) { | 366 | 'selectCardHandler': function (aCardReference) { |
379 | var deferredResult; | 367 | var deferredResult; |
380 | 368 | ||
381 | deferredResult = new Clipperz.Async.Deferred("MainController.selectCardHandler", {trace:true}); | 369 | deferredResult = new Clipperz.Async.Deferred("MainController.selectCardHandler", {trace:true}); |
382 | deferredResult.addMethod(this.cardDetail(), 'render'); | 370 | deferredResult.addMethod(this.cardDetail(), 'render'); |
383 | deferredResult.addMethod(this.jQTouch(), 'goTo', '#cardDetail', 'slideleft'); | 371 | // deferredResult.addMethod(this.jQTouch(), 'goTo', '#cardDetail', 'slideleft'); |
384 | deferredResult.addMethod(this.user(), 'getRecord', aCardReference); | 372 | deferredResult.addMethod(this.user(), 'getRecord', aCardReference); |
385 | deferredResult.addMethod(this.cardDetail(), 'showCard'); | 373 | deferredResult.addMethod(this.cardDetail(), 'showCard'); |
386 | deferredResult.callback(); | 374 | deferredResult.callback(); |
387 | 375 | ||
388 | return deferredResult; | 376 | return deferredResult; |
389 | }, | 377 | }, |
390 | 378 | ||
391 | //========================================================================= | 379 | //========================================================================= |
392 | __syntaxFix__: "syntax fix" | 380 | __syntaxFix__: "syntax fix" |
393 | }); | 381 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js index d6b0574..82c8dfd 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js | |||
@@ -1,150 +1,148 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.AccountPanel = function(args) { | 26 | Clipperz.PM.UI.Web.Components.AccountPanel = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.AccountPanel.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.AccountPanel.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | //this._initiallySelectedTab = args.selected || 'ACCOUNT'; | 31 | //this._initiallySelectedTab = args.selected || 'ACCOUNT'; |
34 | this._initiallySelectedTab = args.selected || 'PASSPHRASE'; | 32 | this._initiallySelectedTab = args.selected || 'PASSPHRASE'; |
35 | this._tabPanelControllerConfiguration = { | 33 | this._tabPanelControllerConfiguration = { |
36 | // 'ACCOUNT': { | 34 | // 'ACCOUNT': { |
37 | // tab:'accountTab', | 35 | // tab:'accountTab', |
38 | // panel:'accountPanel' | 36 | // panel:'accountPanel' |
39 | // }, | 37 | // }, |
40 | 'PASSPHRASE': { | 38 | 'PASSPHRASE': { |
41 | tab:'passphraseTab', | 39 | tab:'passphraseTab', |
42 | panel:'passphrasePanel' | 40 | panel:'passphrasePanel' |
43 | }, | 41 | }, |
44 | 'OTP': { | 42 | 'OTP': { |
45 | tab:'OTPTab', | 43 | tab:'OTPTab', |
46 | panel:'OTPPanel' | 44 | panel:'OTPPanel' |
47 | }, | 45 | }, |
48 | 'PREFERENCES': { | 46 | 'PREFERENCES': { |
49 | tab:'preferencesTab', | 47 | tab:'preferencesTab', |
50 | panel:'preferencesPanel' | 48 | panel:'preferencesPanel' |
51 | }, | 49 | }, |
52 | 'LOGIN_HISTORY': { | 50 | 'LOGIN_HISTORY': { |
53 | tab:'loginHistoryTab', | 51 | tab:'loginHistoryTab', |
54 | panel:'loginHistoryPanel' | 52 | panel:'loginHistoryPanel' |
55 | } | 53 | } |
56 | }; | 54 | }; |
57 | 55 | ||
58 | return this; | 56 | return this; |
59 | } | 57 | } |
60 | 58 | ||
61 | //============================================================================= | 59 | //============================================================================= |
62 | 60 | ||
63 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.AccountPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, { | 61 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.AccountPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, { |
64 | 62 | ||
65 | //------------------------------------------------------------------------- | 63 | //------------------------------------------------------------------------- |
66 | 64 | ||
67 | 'toString': function () { | 65 | 'toString': function () { |
68 | return "Clipperz.PM.UI.Web.Components.AccountPanel component"; | 66 | return "Clipperz.PM.UI.Web.Components.AccountPanel component"; |
69 | }, | 67 | }, |
70 | 68 | ||
71 | //------------------------------------------------------------------------- | 69 | //------------------------------------------------------------------------- |
72 | 70 | ||
73 | 'renderSelf': function(/*aContainer, aPosition*/) { | 71 | 'renderSelf': function(/*aContainer, aPosition*/) { |
74 | //Clipperz.log("AccountPanel.renderSelf element", this.element()); | 72 | //Clipperz.log("AccountPanel.renderSelf element", this.element()); |
75 | this.append(this.element(), [ | 73 | this.append(this.element(), [ |
76 | {tag:'div', cls:'header', children:[ | 74 | {tag:'div', cls:'header', children:[ |
77 | {tag:'div', cls:'subPanelTabs', children:[ | 75 | {tag:'div', cls:'subPanelTabs', children:[ |
78 | {tag:'ul', children:[ | 76 | {tag:'ul', children:[ |
79 | // {tag:'li', id:this.getId('accountTab'), children:[{tag:'a', href:'#', html:'Account'}], cls:'first'}, | 77 | // {tag:'li', id:this.getId('accountTab'), children:[{tag:'a', href:'#', html:'Account'}], cls:'first'}, |
80 | {tag:'li', id:this.getId('passphraseTab'), children:[{tag:'a', href:'#', html:'Passphrase'}], cls:'first'}, | 78 | {tag:'li', id:this.getId('passphraseTab'), children:[{tag:'a', href:'#', html:'Passphrase'}], cls:'first'}, |
81 | {tag:'li', id:this.getId('OTPTab'), children:[{tag:'a', href:'#', html:'One Time Passwords'}]}, | 79 | {tag:'li', id:this.getId('OTPTab'), children:[{tag:'a', href:'#', html:'One Time Passwords'}]}, |
82 | {tag:'li', id:this.getId('preferencesTab'), children:[{tag:'a', href:'#', html:'Preferences'}]}, | 80 | {tag:'li', id:this.getId('preferencesTab'), children:[{tag:'a', href:'#', html:'Preferences'}]}, |
83 | {tag:'li', id:this.getId('loginHistoryTab'),children:[{tag:'a', href:'#', html:'Login history'}]} | 81 | {tag:'li', id:this.getId('loginHistoryTab'),children:[{tag:'a', href:'#', html:'Login history'}]} |
84 | ]} | 82 | ]} |
85 | ]} | 83 | ]} |
86 | ]}, | 84 | ]}, |
87 | {tag:'div', cls:'body', children:[ | 85 | {tag:'div', cls:'body', children:[ |
88 | {tag:'div', cls:'accountPanel', children:[ | 86 | {tag:'div', cls:'accountPanel', children:[ |
89 | {tag:'div', cls:'subPanelContent', children:[ | 87 | {tag:'div', cls:'subPanelContent', children:[ |
90 | {tag:'ul', children:[ | 88 | {tag:'ul', children:[ |
91 | // {tag:'li', id:this.getId('accountPanel'),children:[ | 89 | // {tag:'li', id:this.getId('accountPanel'),children:[ |
92 | // {tag:'h3', html:"-- Account --"} | 90 | // {tag:'h3', html:"-- Account --"} |
93 | // ]}, | 91 | // ]}, |
94 | {tag:'li', id:this.getId('passphrasePanel'),children:[ | 92 | {tag:'li', id:this.getId('passphrasePanel'),children:[ |
95 | {tag:'h3', cls:'changePassphrase', html:"Change passphrase"}, | 93 | {tag:'h3', cls:'changePassphrase', html:"Change passphrase"}, |
96 | {tag:'form', id:this.getId('changePassphrase'), cls:'changePassphrase', children:[ | 94 | {tag:'form', id:this.getId('changePassphrase'), cls:'changePassphrase', children:[ |
97 | {tag:'div', cls:'currentCredentials', children:[ | 95 | {tag:'div', cls:'currentCredentials', children:[ |
98 | {tag:'div', cls:'field username', children:[ | 96 | {tag:'div', cls:'field username', children:[ |
99 | {tag:'label', html:"username", 'for':this.getId('currentUsername')}, | 97 | {tag:'label', html:"username", 'for':this.getId('currentUsername')}, |
100 | {tag:'input', id:this.getId('currentUsername')} | 98 | {tag:'input', id:this.getId('currentUsername')} |
101 | ]}, | 99 | ]}, |
102 | {tag:'div', cls:'field passphrase', children:[ | 100 | {tag:'div', cls:'field passphrase', children:[ |
103 | {tag:'label', html:"passphrase", 'for':this.getId('currentPassphrase')}, | 101 | {tag:'label', html:"passphrase", 'for':this.getId('currentPassphrase')}, |
104 | {tag:'input', id:this.getId('currentPassphrase')} | 102 | {tag:'input', id:this.getId('currentPassphrase')} |
105 | ]} | 103 | ]} |
106 | ]}, | 104 | ]}, |
107 | {tag:'div', cls:'newPassphrase', children:[ | 105 | {tag:'div', cls:'newPassphrase', children:[ |
108 | {tag:'div', cls:'field', children:[ | 106 | {tag:'div', cls:'field', children:[ |
109 | {tag:'label', html:"new passphrase", 'for':this.getId('newPassphrase')}, | 107 | {tag:'label', html:"new passphrase", 'for':this.getId('newPassphrase')}, |
110 | {tag:'input', id:this.getId('newPassphrase')} | 108 | {tag:'input', id:this.getId('newPassphrase')} |
111 | ]}, | 109 | ]}, |
112 | {tag:'div', cls:'field', children:[ | 110 | {tag:'div', cls:'field', children:[ |
113 | {tag:'label', html:"re-new passphrase", 'for':this.getId('reNewPassphrase')}, | 111 | {tag:'label', html:"re-new passphrase", 'for':this.getId('reNewPassphrase')}, |
114 | {tag:'input', id:this.getId('reNewPassphrase')} | 112 | {tag:'input', id:this.getId('reNewPassphrase')} |
115 | ]} | 113 | ]} |
116 | ]}, | 114 | ]}, |
117 | {tag:'div', cls:'confirm', children:[ | 115 | {tag:'div', cls:'confirm', children:[ |
118 | {tag:'input', type:'checkbox', id:this.getId('confirm')}, | 116 | {tag:'input', type:'checkbox', id:this.getId('confirm')}, |
119 | {tag:'label', html:"I understand that Clipperz will not be able to recover a lost passphrase", 'for':this.getId('confirm')} | 117 | {tag:'label', html:"I understand that Clipperz will not be able to recover a lost passphrase", 'for':this.getId('confirm')} |
120 | ]} | 118 | ]} |
121 | ]}, | 119 | ]}, |
122 | {tag:'div', cls:'clear'}, | 120 | {tag:'div', cls:'clear'}, |
123 | {tag:'div', cls:'confirmButton', id:this.getId('confirmationButton'), children:[ | 121 | {tag:'div', cls:'confirmButton', id:this.getId('confirmationButton'), children:[ |
124 | {tag:'span', html:"change passphrase"} | 122 | {tag:'span', html:"change passphrase"} |
125 | ]} | 123 | ]} |
126 | ]}, | 124 | ]}, |
127 | {tag:'li', id:this.getId('OTPPanel'), children:[ | 125 | {tag:'li', id:this.getId('OTPPanel'), children:[ |
128 | // {tag:'h3', html:"Manage One-Time Passphrases"} | 126 | // {tag:'h3', html:"Manage One-Time Passphrases"} |
129 | ]}, | 127 | ]}, |
130 | {tag:'li', id:this.getId('preferencesPanel'), children:[ | 128 | {tag:'li', id:this.getId('preferencesPanel'), children:[ |
131 | // {tag:'h3', html:"-- Preferences --"} | 129 | // {tag:'h3', html:"-- Preferences --"} |
132 | ]}, | 130 | ]}, |
133 | {tag:'li', id:this.getId('loginHistoryPanel'), children:[ | 131 | {tag:'li', id:this.getId('loginHistoryPanel'), children:[ |
134 | // {tag:'h3', html:"-- Login History --"} | 132 | // {tag:'h3', html:"-- Login History --"} |
135 | ]} | 133 | ]} |
136 | ]} | 134 | ]} |
137 | ]} | 135 | ]} |
138 | ]} | 136 | ]} |
139 | ]}, | 137 | ]}, |
140 | {tag:'div', cls:'footer'} | 138 | {tag:'div', cls:'footer'} |
141 | ]); | 139 | ]); |
142 | 140 | ||
143 | this.tabPanelController().setup({selected:this.initiallySelectedTab()}); | 141 | this.tabPanelController().setup({selected:this.initiallySelectedTab()}); |
144 | }, | 142 | }, |
145 | 143 | ||
146 | //------------------------------------------------------------------------- | 144 | //------------------------------------------------------------------------- |
147 | 145 | ||
148 | 146 | ||
149 | __syntaxFix__: "syntax fix" | 147 | __syntaxFix__: "syntax fix" |
150 | }); | 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 index 3b3c8b4..da5fd76 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AppPage.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AppPage.js | |||
@@ -1,75 +1,73 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.AppPage = function(args) { | 26 | Clipperz.PM.UI.Web.Components.AppPage = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | Clipperz.PM.UI.Web.Components.AppPage.superclass.constructor.call(this, args); | 28 | Clipperz.PM.UI.Web.Components.AppPage.superclass.constructor.call(this, args); |
31 | 29 | ||
32 | this._element = args.element || null; | 30 | this._element = args.element || null; |
33 | 31 | ||
34 | this._slots = { | 32 | this._slots = { |
35 | 'cardGrid' : this.getId('cardGrid'), | 33 | 'cardGrid' : this.getId('cardGrid'), |
36 | // 'directLoginGrid' : this.getId('directLoginGrid'), | 34 | // 'directLoginGrid' : this.getId('directLoginGrid'), |
37 | 'accountPanel': this.getId('accountPanel'), | 35 | 'accountPanel': this.getId('accountPanel'), |
38 | 'dataPanel': this.getId('dataPanel'), | 36 | 'dataPanel': this.getId('dataPanel'), |
39 | 'toolsPanel': this.getId('toolsPanel'), | 37 | 'toolsPanel': this.getId('toolsPanel'), |
40 | 'userInfoBox': this.getId('userInfoBox'), | 38 | 'userInfoBox': this.getId('userInfoBox'), |
41 | 'tabSidePanel': this.getId('tabSidePanel') | 39 | 'tabSidePanel': this.getId('tabSidePanel') |
42 | }; | 40 | }; |
43 | 41 | ||
44 | return this; | 42 | return this; |
45 | } | 43 | } |
46 | 44 | ||
47 | //============================================================================= | 45 | //============================================================================= |
48 | 46 | ||
49 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.AppPage, Clipperz.PM.UI.Common.Components.BaseComponent, { | 47 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.AppPage, Clipperz.PM.UI.Common.Components.BaseComponent, { |
50 | 48 | ||
51 | //------------------------------------------------------------------------- | 49 | //------------------------------------------------------------------------- |
52 | 50 | ||
53 | 'toString': function () { | 51 | 'toString': function () { |
54 | return "Clipperz.PM.UI.Web.Components.AppPage component"; | 52 | return "Clipperz.PM.UI.Web.Components.AppPage component"; |
55 | }, | 53 | }, |
56 | 54 | ||
57 | //------------------------------------------------------------------------- | 55 | //------------------------------------------------------------------------- |
58 | 56 | ||
59 | 'renderSelf': function(/*aContainer, aPosition*/) { | 57 | 'renderSelf': function(/*aContainer, aPosition*/) { |
60 | this.append(this.element(), {tag:'div', id:this.getId('userInfoBox'), cls:'userInfoBox'}); | 58 | this.append(this.element(), {tag:'div', id:this.getId('userInfoBox'), cls:'userInfoBox'}); |
61 | this.append(this.element(), {tag:'div', id:this.getId('sidePanels'), cls:'sidePanels'}); | 59 | this.append(this.element(), {tag:'div', id:this.getId('sidePanels'), cls:'sidePanels'}); |
62 | this.append(this.getId('sidePanels'),{tag:'div', id:this.getId('tabSidePanel'), cls:'tabSidePanel', children:[]}); | 60 | this.append(this.getId('sidePanels'),{tag:'div', id:this.getId('tabSidePanel'), cls:'tabSidePanel', children:[]}); |
63 | 61 | ||
64 | this.append(this.element(), {tag:'div', id:this.getId('mainPanels'), cls:'mainPanels'}); | 62 | this.append(this.element(), {tag:'div', id:this.getId('mainPanels'), cls:'mainPanels'}); |
65 | this.append(this.getId('mainPanels'), {tag:'div', id:this.getId('cardGrid'), cls:'gridComponent cardGrid'}); | 63 | this.append(this.getId('mainPanels'), {tag:'div', id:this.getId('cardGrid'), cls:'gridComponent cardGrid'}); |
66 | // this.append(this.getId('mainPanels'), {tag:'div', id:this.getId('directLoginGrid'), cls:'gridComponent directLoginGrid'}); | 64 | // this.append(this.getId('mainPanels'), {tag:'div', id:this.getId('directLoginGrid'), cls:'gridComponent directLoginGrid'}); |
67 | this.append(this.getId('mainPanels'), {tag:'div', id:this.getId('accountPanel'), cls:'otherPanel'}); | 65 | this.append(this.getId('mainPanels'), {tag:'div', id:this.getId('accountPanel'), cls:'otherPanel'}); |
68 | this.append(this.getId('mainPanels'), {tag:'div', id:this.getId('dataPanel'), cls:'otherPanel'}); | 66 | this.append(this.getId('mainPanels'), {tag:'div', id:this.getId('dataPanel'), cls:'otherPanel'}); |
69 | this.append(this.getId('mainPanels'), {tag:'div', id:this.getId('toolsPanel'), cls:'otherPanel'}); | 67 | this.append(this.getId('mainPanels'), {tag:'div', id:this.getId('toolsPanel'), cls:'otherPanel'}); |
70 | }, | 68 | }, |
71 | 69 | ||
72 | //------------------------------------------------------------------------- | 70 | //------------------------------------------------------------------------- |
73 | 71 | ||
74 | __syntaxFix__: "syntax fix" | 72 | __syntaxFix__: "syntax fix" |
75 | }); | 73 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/BookmarkletComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/BookmarkletComponent.js index 1835ca9..4cfca32 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/BookmarkletComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/BookmarkletComponent.js | |||
@@ -1,106 +1,104 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.BookmarkletComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.BookmarkletComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.BookmarkletComponent.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.BookmarkletComponent.superclass.constructor.apply(this, arguments); |
32 | MochiKit.Signal.connect(Clipperz.PM.Strings.Languages, 'switchLanguage', this, 'updateBookmarkletURLs'); | 30 | MochiKit.Signal.connect(Clipperz.PM.Strings.Languages, 'switchLanguage', this, 'updateBookmarkletURLs'); |
33 | 31 | ||
34 | return this; | 32 | return this; |
35 | } | 33 | } |
36 | 34 | ||
37 | //============================================================================= | 35 | //============================================================================= |
38 | 36 | ||
39 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.BookmarkletComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 37 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.BookmarkletComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { |
40 | 38 | ||
41 | //------------------------------------------------------------------------- | 39 | //------------------------------------------------------------------------- |
42 | 40 | ||
43 | 'toString': function () { | 41 | 'toString': function () { |
44 | return "Clipperz.PM.UI.Web.Components.BookmarkletComponent component"; | 42 | return "Clipperz.PM.UI.Web.Components.BookmarkletComponent component"; |
45 | }, | 43 | }, |
46 | 44 | ||
47 | //------------------------------------------------------------------------- | 45 | //------------------------------------------------------------------------- |
48 | 46 | ||
49 | 'renderSelf': function() { | 47 | 'renderSelf': function() { |
50 | // var bookmarkletUrl; | 48 | // var bookmarkletUrl; |
51 | // | 49 | // |
52 | // if (Clipperz_IEisBroken == true) { | 50 | // if (Clipperz_IEisBroken == true) { |
53 | // bookmarkletUrl = bookmarklet_ie; | 51 | // bookmarkletUrl = bookmarklet_ie; |
54 | // } else { | 52 | // } else { |
55 | /// bookmarkletUrl = bookmarklet; | 53 | /// bookmarkletUrl = bookmarklet; |
56 | // bookmarkletUrl = Clipperz.PM.Strings['bookmarklet']; | 54 | // bookmarkletUrl = Clipperz.PM.Strings['bookmarklet']; |
57 | // } | 55 | // } |
58 | 56 | ||
59 | this.append(this.element(), {tag:'div', cls:'bookmarklet', children: [ | 57 | this.append(this.element(), {tag:'div', cls:'bookmarklet', children: [ |
60 | {tag:'div', id:this.getId('linkBlock'), cls:'bookmarklet_link', children:[ | 58 | {tag:'div', id:this.getId('linkBlock'), cls:'bookmarklet_link', children:[ |
61 | // {tag:'a', id:this.getId('link'), href:bookmarkletUrl, children:[ | 59 | // {tag:'a', id:this.getId('link'), href:bookmarkletUrl, children:[ |
62 | {tag:'a', id:this.getId('link'), href:'#', children:[ | 60 | {tag:'a', id:this.getId('link'), href:'#', children:[ |
63 | {tag:'div', cls:'icon'}, | 61 | {tag:'div', cls:'icon'}, |
64 | {tag:'div', cls:'text', children:[ | 62 | {tag:'div', cls:'text', children:[ |
65 | {tag:'span', html:"add to Clipperz"} | 63 | {tag:'span', html:"add to Clipperz"} |
66 | ]} | 64 | ]} |
67 | ]} | 65 | ]} |
68 | ]} | 66 | ]} |
69 | ]}); | 67 | ]}); |
70 | 68 | ||
71 | new Clipperz.PM.UI.Common.Components.Tooltip({ | 69 | new Clipperz.PM.UI.Common.Components.Tooltip({ |
72 | element:this.getElement('linkBlock'), | 70 | element:this.getElement('linkBlock'), |
73 | text: "Drag and drop the \"add to Clipperz\" link above to the bookmark bar.", | 71 | text: "Drag and drop the \"add to Clipperz\" link above to the bookmark bar.", |
74 | position:'BELOW' | 72 | position:'BELOW' |
75 | }); | 73 | }); |
76 | 74 | ||
77 | MochiKit.Signal.connect(this.getId('link'), 'onclick', this, 'handleOnclick'); | 75 | MochiKit.Signal.connect(this.getId('link'), 'onclick', this, 'handleOnclick'); |
78 | this.updateBookmarkletURLs(); | 76 | this.updateBookmarkletURLs(); |
79 | }, | 77 | }, |
80 | 78 | ||
81 | //------------------------------------------------------------------------- | 79 | //------------------------------------------------------------------------- |
82 | 80 | ||
83 | 'handleOnclick': function (anEvent) { | 81 | 'handleOnclick': function (anEvent) { |
84 | anEvent.preventDefault(); | 82 | anEvent.preventDefault(); |
85 | 83 | ||
86 | Clipperz.log("BOOKMARKLET CLICK"); | 84 | Clipperz.log("BOOKMARKLET CLICK"); |
87 | }, | 85 | }, |
88 | 86 | ||
89 | //------------------------------------------------------------------------- | 87 | //------------------------------------------------------------------------- |
90 | 88 | ||
91 | 'updateBookmarkletURLs': function () { | 89 | 'updateBookmarkletURLs': function () { |
92 | var bookmarkletUrl; | 90 | var bookmarkletUrl; |
93 | 91 | ||
94 | if (Clipperz_IEisBroken == true) { | 92 | if (Clipperz_IEisBroken == true) { |
95 | bookmarkletUrl = bookmarklet_ie; | 93 | bookmarkletUrl = bookmarklet_ie; |
96 | } else { | 94 | } else { |
97 | // bookmarkletUrl = bookmarklet; | 95 | // bookmarkletUrl = bookmarklet; |
98 | bookmarkletUrl = Clipperz.PM.Strings.getValue('bookmarklet'); | 96 | bookmarkletUrl = Clipperz.PM.Strings.getValue('bookmarklet'); |
99 | } | 97 | } |
100 | 98 | ||
101 | this.getElement('link').href = bookmarkletUrl; | 99 | this.getElement('link').href = bookmarkletUrl; |
102 | }, | 100 | }, |
103 | 101 | ||
104 | //------------------------------------------------------------------------- | 102 | //------------------------------------------------------------------------- |
105 | __syntaxFix__: "syntax fix" | 103 | __syntaxFix__: "syntax fix" |
106 | }); | 104 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js index af33d85..8bb64f5 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js | |||
@@ -1,214 +1,212 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.CardDialogComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.CardDialogComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.CardDialogComponent.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.CardDialogComponent.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._tabPanelController = null; | 31 | this._tabPanelController = null; |
34 | 32 | ||
35 | this._tabPanelControllerConfiguration = { | 33 | this._tabPanelControllerConfiguration = { |
36 | 'DETAILS': { | 34 | 'DETAILS': { |
37 | tab:'detailTab', | 35 | tab:'detailTab', |
38 | panel:'detailTabpanel' | 36 | panel:'detailTabpanel' |
39 | }, | 37 | }, |
40 | 'DIRECT_LOGINS': { | 38 | 'DIRECT_LOGINS': { |
41 | tab:'directLoginTab', | 39 | tab:'directLoginTab', |
42 | panel:'directLoginTabpanel' | 40 | panel:'directLoginTabpanel' |
43 | }, | 41 | }, |
44 | 'SHARING': { | 42 | 'SHARING': { |
45 | tab:'sharingTab', | 43 | tab:'sharingTab', |
46 | panel:'sharingTabpanel' | 44 | panel:'sharingTabpanel' |
47 | } | 45 | } |
48 | }; | 46 | }; |
49 | 47 | ||
50 | this._tooltips = null; | 48 | this._tooltips = null; |
51 | 49 | ||
52 | this._isSavingEnabled = false; | 50 | this._isSavingEnabled = false; |
53 | this._hintMode = 'OFF'; //'ON' | 51 | this._hintMode = 'OFF'; //'ON' |
54 | 52 | ||
55 | this._fieldComponents = {}; | 53 | this._fieldComponents = {}; |
56 | this._directLoginComponents = {}; | 54 | this._directLoginComponents = {}; |
57 | 55 | ||
58 | this._displayMode = 'fixed'; //'scrollable'; | 56 | this._displayMode = 'fixed'; //'scrollable'; |
59 | 57 | ||
60 | return this; | 58 | return this; |
61 | } | 59 | } |
62 | 60 | ||
63 | //============================================================================= | 61 | //============================================================================= |
64 | 62 | ||
65 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 63 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { |
66 | 64 | ||
67 | //------------------------------------------------------------------------- | 65 | //------------------------------------------------------------------------- |
68 | 66 | ||
69 | 'toString': function () { | 67 | 'toString': function () { |
70 | return "Clipperz.PM.UI.Web.Components.CardDialogComponent component"; | 68 | return "Clipperz.PM.UI.Web.Components.CardDialogComponent component"; |
71 | }, | 69 | }, |
72 | 70 | ||
73 | //------------------------------------------------------------------------- | 71 | //------------------------------------------------------------------------- |
74 | 72 | ||
75 | 'tabPanelController': function () { | 73 | 'tabPanelController': function () { |
76 | if (this._tabPanelController == null) { | 74 | if (this._tabPanelController == null) { |
77 | this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({ | 75 | this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({ |
78 | component:this, | 76 | component:this, |
79 | configuration:this._tabPanelControllerConfiguration | 77 | configuration:this._tabPanelControllerConfiguration |
80 | }); | 78 | }); |
81 | 79 | ||
82 | MochiKit.Signal.connect(this._tabPanelController, 'tabSelected', this, 'handleTabSelected') | 80 | MochiKit.Signal.connect(this._tabPanelController, 'tabSelected', this, 'handleTabSelected') |
83 | } | 81 | } |
84 | 82 | ||
85 | return this._tabPanelController; | 83 | return this._tabPanelController; |
86 | }, | 84 | }, |
87 | 85 | ||
88 | //------------------------------------------------------------------------- | 86 | //------------------------------------------------------------------------- |
89 | 87 | ||
90 | 'renderSelf': function() { | 88 | 'renderSelf': function() { |
91 | this.append(this.element(), {tag:'div', cls:'CardDialog mainDialog loading', id:this.getId('panel'), children: [ | 89 | this.append(this.element(), {tag:'div', cls:'CardDialog mainDialog loading', id:this.getId('panel'), children: [ |
92 | {tag:'form', id:this.getId('form'), children:[ | 90 | {tag:'form', id:this.getId('form'), children:[ |
93 | // {tag:'input', type:'text', id:this.getId('hidden'), cls:'hidden'}, | 91 | // {tag:'input', type:'text', id:this.getId('hidden'), cls:'hidden'}, |
94 | {tag:'div', cls:'header', children:[ | 92 | {tag:'div', cls:'header', children:[ |
95 | {tag:'div', cls:'title', children:[ | 93 | {tag:'div', cls:'title', children:[ |
96 | {tag:'input', type:'text', id:this.getId('title')} | 94 | {tag:'input', type:'text', id:this.getId('title')} |
97 | ]} | 95 | ]} |
98 | ]}, | 96 | ]}, |
99 | {tag:'div', id:this.getId('body'), cls:'body', children:[ | 97 | {tag:'div', id:this.getId('body'), cls:'body', children:[ |
100 | {tag:'div', cls:'tabs', children:[ | 98 | {tag:'div', cls:'tabs', children:[ |
101 | {tag:'ul', cls:'tabs', children:[ | 99 | {tag:'ul', cls:'tabs', children:[ |
102 | {tag:'li', id:this.getId('detailTab'), children:[{tag:'span', html:"details"}]}, | 100 | {tag:'li', id:this.getId('detailTab'), children:[{tag:'span', html:"details"}]}, |
103 | {tag:'li', id:this.getId('directLoginTab'), children:[ | 101 | {tag:'li', id:this.getId('directLoginTab'), children:[ |
104 | {tag:'span', html:"direct logins"}//, | 102 | {tag:'span', html:"direct logins"}//, |
105 | // {tag:'div', id:this.getId('addDirectLoginButton'), cls:'addDirectLoginButton', children:[ | 103 | // {tag:'div', id:this.getId('addDirectLoginButton'), cls:'addDirectLoginButton', children:[ |
106 | // {tag:'span', html:"+"} | 104 | // {tag:'span', html:"+"} |
107 | // ]} | 105 | // ]} |
108 | ]}, | 106 | ]}, |
109 | {tag:'li', id:this.getId('sharingTab'), children:[{tag:'span', html:"sharing"}]} | 107 | {tag:'li', id:this.getId('sharingTab'), children:[{tag:'span', html:"sharing"}]} |
110 | ]} | 108 | ]} |
111 | ]}, | 109 | ]}, |
112 | {tag:'div', cls:'tabPanels', children:[ | 110 | {tag:'div', cls:'tabPanels', children:[ |
113 | {tag:'ul', cls:'tabPanels', children:[ | 111 | {tag:'ul', cls:'tabPanels', children:[ |
114 | {tag:'li', id:this.getId('detailTabpanel'), cls:'tabPanel', children:[ | 112 | {tag:'li', id:this.getId('detailTabpanel'), cls:'tabPanel', children:[ |
115 | {tag:'div', id:this.getId('recordFields'), children:[ | 113 | {tag:'div', id:this.getId('recordFields'), children:[ |
116 | {tag:'table', cls:'fields', cellpadding:'0', id:this.getId('fieldTable'), cellspacing:'0', children:[ | 114 | {tag:'table', cls:'fields', cellpadding:'0', id:this.getId('fieldTable'), cellspacing:'0', children:[ |
117 | {tag:'thead', children:[ | 115 | {tag:'thead', children:[ |
118 | {tag:'tr', children:[ | 116 | {tag:'tr', children:[ |
119 | {tag:'th', cls:'fieldStateTH',html:""}, | 117 | {tag:'th', cls:'fieldStateTH',html:""}, |
120 | {tag:'th', cls:'fieldLabelTH',html:"label"}, | 118 | {tag:'th', cls:'fieldLabelTH',html:"label"}, |
121 | {tag:'th', cls:'fieldLockTH',html:""}, | 119 | {tag:'th', cls:'fieldLockTH',html:""}, |
122 | {tag:'th', cls:'fieldValueTH',html:"value"}, | 120 | {tag:'th', cls:'fieldValueTH',html:"value"}, |
123 | {tag:'th', cls:'fieldActionTH',html:""}, | 121 | {tag:'th', cls:'fieldActionTH',html:""}, |
124 | {tag:'th', cls:'fieldDeleteTH',html:""} | 122 | {tag:'th', cls:'fieldDeleteTH',html:""} |
125 | ]} | 123 | ]} |
126 | ]}, | 124 | ]}, |
127 | {tag:'tfoot'}, | 125 | {tag:'tfoot'}, |
128 | {tag:'tbody', id:this.getId('tableBody'), children:[ | 126 | {tag:'tbody', id:this.getId('tableBody'), children:[ |
129 | {tag:'tr', id:this.getId('newFieldTR'), cls:'newFieldTR', children:[ | 127 | {tag:'tr', id:this.getId('newFieldTR'), cls:'newFieldTR', children:[ |
130 | {tag:'td', cls:'fieldState'}, | 128 | {tag:'td', cls:'fieldState'}, |
131 | {tag:'td', cls:'fieldLabel', children:[ | 129 | {tag:'td', cls:'fieldLabel', children:[ |
132 | {tag:'input', cls:'label', id:this.getId('newFieldLabel')} | 130 | {tag:'input', cls:'label', id:this.getId('newFieldLabel')} |
133 | ]}, | 131 | ]}, |
134 | {tag:'td', cls:'fieldLock', children:[ | 132 | {tag:'td', cls:'fieldLock', children:[ |
135 | {tag:'div', cls:'unlocked', id:this.getId('newFieldIsLocked')} | 133 | {tag:'div', cls:'unlocked', id:this.getId('newFieldIsLocked')} |
136 | ]}, | 134 | ]}, |
137 | {tag:'td', cls:'fieldValue', children:[ | 135 | {tag:'td', cls:'fieldValue', children:[ |
138 | {tag:'div', cls:'unlocked', id:this.getId('newFieldValueWrapper'), children:[ | 136 | {tag:'div', cls:'unlocked', id:this.getId('newFieldValueWrapper'), children:[ |
139 | {tag:'input',type:'text', cls:'value', id:this.getId('newFieldValue')} | 137 | {tag:'input',type:'text', cls:'value', id:this.getId('newFieldValue')} |
140 | ]} | 138 | ]} |
141 | ]}, | 139 | ]}, |
142 | {tag:'td', cls:'fieldAction', children:[ | 140 | {tag:'td', cls:'fieldAction', children:[ |
143 | {tag:'div', html:' '} | 141 | {tag:'div', html:' '} |
144 | ]}, | 142 | ]}, |
145 | {tag:'td', cls:'fieldAddDelete', children:[ | 143 | {tag:'td', cls:'fieldAddDelete', children:[ |
146 | {tag:'div', cls:'new', children:[ | 144 | {tag:'div', cls:'new', children:[ |
147 | {tag:'span', children:[ | 145 | {tag:'span', children:[ |
148 | {tag:'a', href:'#', id:this.getId('newFieldAddButton'), html:"add"} | 146 | {tag:'a', href:'#', id:this.getId('newFieldAddButton'), html:"add"} |
149 | ]} | 147 | ]} |
150 | ]} | 148 | ]} |
151 | ]} | 149 | ]} |
152 | ]} | 150 | ]} |
153 | ]} | 151 | ]} |
154 | ]} | 152 | ]} |
155 | ]}, | 153 | ]}, |
156 | {tag:'div', cls:'notes', children:[ | 154 | {tag:'div', cls:'notes', children:[ |
157 | {tag:'div', children:[ | 155 | {tag:'div', children:[ |
158 | {tag:'textarea', id:this.getId('recordNote'), value:""} | 156 | {tag:'textarea', id:this.getId('recordNote'), value:""} |
159 | ]} | 157 | ]} |
160 | ]} | 158 | ]} |
161 | ]}, | 159 | ]}, |
162 | {tag:'li', id:this.getId('directLoginTabpanel'), cls:'tabPanel', children:[ | 160 | {tag:'li', id:this.getId('directLoginTabpanel'), cls:'tabPanel', children:[ |
163 | {tag:'div', id:this.getId('directLoginsComponentContainer'), cls:'directLoginsComponentContainer', children:[ | 161 | {tag:'div', id:this.getId('directLoginsComponentContainer'), cls:'directLoginsComponentContainer', children:[ |
164 | {tag:'div', id:this.getId('directLogins'), cls:'directLogins', children:[ | 162 | {tag:'div', id:this.getId('directLogins'), cls:'directLogins', children:[ |
165 | {tag:'div', id:this.getId('addNewDirectLoginSplash'), cls:'addNewDirectLoginSplash', children:[ | 163 | {tag:'div', id:this.getId('addNewDirectLoginSplash'), cls:'addNewDirectLoginSplash', children:[ |
166 | {tag:'h3', html:"Here you can add a Direct Login for this card: instant access to your favorit website!"}, | 164 | {tag:'h3', html:"Here you can add a Direct Login for this card: instant access to your favorit website!"}, |
167 | {tag:'a', href:'#', id:this.getId('addNewDirectLoginSplashButton'), children:[{tag:'span', html:"Add Direct Login"}]} | 165 | {tag:'a', href:'#', id:this.getId('addNewDirectLoginSplashButton'), children:[{tag:'span', html:"Add Direct Login"}]} |
168 | ]}, | 166 | ]}, |
169 | {tag:'div', id:this.getId('directLoginsList')}, | 167 | {tag:'div', id:this.getId('directLoginsList')}, |
170 | {tag:'div', cls:'addDirectLoginListItem', id:this.getId('addDirectLoginListItem'), children:[{tag:'a', href:'#', id:this.getId('addNewDirectLoginListItemButton'), children:[{tag:'span', html:"Add Direct Login"}]}]} | 168 | {tag:'div', cls:'addDirectLoginListItem', id:this.getId('addDirectLoginListItem'), children:[{tag:'a', href:'#', id:this.getId('addNewDirectLoginListItemButton'), children:[{tag:'span', html:"Add Direct Login"}]}]} |
171 | ]}, | 169 | ]}, |
172 | {tag:'div', id:this.getId('directLoginEditDetail'), cls:'directLoginEditDetail'} | 170 | {tag:'div', id:this.getId('directLoginEditDetail'), cls:'directLoginEditDetail'} |
173 | ]} | 171 | ]} |
174 | ]}, | 172 | ]}, |
175 | {tag:'li', id:this.getId('sharingTabpanel'), cls:'tabPanel', children:[ | 173 | {tag:'li', id:this.getId('sharingTabpanel'), cls:'tabPanel', children:[ |
176 | {tag:'h2', html:"Coming soon!"} | 174 | {tag:'h2', html:"Coming soon!"} |
177 | ]} | 175 | ]} |
178 | ]} | 176 | ]} |
179 | ]}, | 177 | ]}, |
180 | {tag:'div', cls:'mask', children:[ | 178 | {tag:'div', cls:'mask', children:[ |
181 | {tag:'div', id:this.getId('progress'), children:[ | 179 | {tag:'div', id:this.getId('progress'), children:[ |
182 | {tag:'h3', id:this.getId('progressDescription'), cls:'progressDescription', html:"Loading"}, | 180 | {tag:'h3', id:this.getId('progressDescription'), cls:'progressDescription', html:"Loading"}, |
183 | {tag:'div', id:this.getId('progressBar')} | 181 | {tag:'div', id:this.getId('progressBar')} |
184 | ]}, | 182 | ]}, |
185 | {tag:'div', id:this.getId('error'), cls:'error', children:[ | 183 | {tag:'div', id:this.getId('error'), cls:'error', children:[ |
186 | {tag:'div', cls:'img'}, | 184 | {tag:'div', cls:'img'}, |
187 | {tag:'p', id:this.getId('errorMessage')} | 185 | {tag:'p', id:this.getId('errorMessage')} |
188 | ]} | 186 | ]} |
189 | ]} | 187 | ]} |
190 | ]}, | 188 | ]}, |
191 | {tag:'div', cls:'footer', children:[ | 189 | {tag:'div', cls:'footer', children:[ |
192 | {tag:'div', cls:'buttonArea', children:[ | 190 | {tag:'div', cls:'buttonArea', children:[ |
193 | {tag:'div', cls:'cancel', id:this.getId('cancelButton'), html:"cancel"}, | 191 | {tag:'div', cls:'cancel', id:this.getId('cancelButton'), html:"cancel"}, |
194 | {tag:'div', cls:'save disabled', id:this.getId('saveButton'), html:"save"} | 192 | {tag:'div', cls:'save disabled', id:this.getId('saveButton'), html:"save"} |
195 | ]} | 193 | ]} |
196 | ]} | 194 | ]} |
197 | ]} | 195 | ]} |
198 | ]}); | 196 | ]}); |
199 | 197 | ||
200 | 198 | ||
201 | this.insertAllTooltips(); | 199 | this.insertAllTooltips(); |
202 | 200 | ||
203 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); | 201 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); |
204 | 202 | ||
205 | this.tabPanelController().setup({selected:'DETAILS'}); | 203 | this.tabPanelController().setup({selected:'DETAILS'}); |
206 | // this.tabPanelController().setup({selected:'DIRECT_LOGINS'}); | 204 | // this.tabPanelController().setup({selected:'DIRECT_LOGINS'}); |
207 | 205 | ||
208 | MochiKit.Style.hideElement(this.getId('error')); | 206 | MochiKit.Style.hideElement(this.getId('error')); |
209 | MochiKit.Style.hideElement(this.getElement('directLoginEditDetail')); | 207 | MochiKit.Style.hideElement(this.getElement('directLoginEditDetail')); |
210 | MochiKit.Style.hideElement(this.getElement('addDirectLoginListItem')); | 208 | MochiKit.Style.hideElement(this.getElement('addDirectLoginListItem')); |
211 | this.plumbDetailsPanel(); | 209 | this.plumbDetailsPanel(); |
212 | 210 | ||
213 | MochiKit.Signal.connect(this.getId('cancelButton'), 'onclick', this, 'handleCancelEvent'); | 211 | MochiKit.Signal.connect(this.getId('cancelButton'), 'onclick', this, 'handleCancelEvent'); |
214 | MochiKit.Signal.connect(this.getId('saveButton'), 'onclick', this, 'handleSaveEvent'); | 212 | MochiKit.Signal.connect(this.getId('saveButton'), 'onclick', this, 'handleSaveEvent'); |
@@ -493,386 +491,382 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogComponent, Clipperz | |||
493 | }, | 491 | }, |
494 | 492 | ||
495 | 'placeDirectLoginEditingComponent': function () { | 493 | 'placeDirectLoginEditingComponent': function () { |
496 | var width; | 494 | var width; |
497 | 495 | ||
498 | width = MochiKit.Style.getElementDimensions(this.getElement('directLoginsComponentContainer'))['w']; | 496 | width = MochiKit.Style.getElementDimensions(this.getElement('directLoginsComponentContainer'))['w']; |
499 | 497 | ||
500 | return Clipperz.Async.callbacks("CardDialogComponent.renderDirectLoginEditingComponent", [ | 498 | return Clipperz.Async.callbacks("CardDialogComponent.renderDirectLoginEditingComponent", [ |
501 | MochiKit.Base.bind(function () { | 499 | MochiKit.Base.bind(function () { |
502 | MochiKit.Style.setElementPosition (this.getElement('directLoginEditDetail'), {x:width, y:-MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}); | 500 | MochiKit.Style.setElementPosition (this.getElement('directLoginEditDetail'), {x:width, y:-MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}); |
503 | MochiKit.Style.setElementDimensions(this.getElement('directLoginEditDetail'), {w:width}); | 501 | MochiKit.Style.setElementDimensions(this.getElement('directLoginEditDetail'), {w:width}); |
504 | }, this), | 502 | }, this), |
505 | 503 | ||
506 | MochiKit.Base.noop | 504 | MochiKit.Base.noop |
507 | ], {trace:false}); | 505 | ], {trace:false}); |
508 | }, | 506 | }, |
509 | 507 | ||
510 | //========================================================================= | 508 | //========================================================================= |
511 | 509 | ||
512 | 'newFieldLabel': function () { | 510 | 'newFieldLabel': function () { |
513 | return this.getElement('newFieldLabel').value; | 511 | return this.getElement('newFieldLabel').value; |
514 | }, | 512 | }, |
515 | 513 | ||
516 | 'setNewFieldLabel': function (aValue) { | 514 | 'setNewFieldLabel': function (aValue) { |
517 | this.getElement('newFieldLabel').value = aValue; | 515 | this.getElement('newFieldLabel').value = aValue; |
518 | }, | 516 | }, |
519 | 517 | ||
520 | //------------------------------------------------------------------------- | 518 | //------------------------------------------------------------------------- |
521 | 519 | ||
522 | 'newFieldValue': function () { | 520 | 'newFieldValue': function () { |
523 | return this.getElement('newFieldValue').value; | 521 | return this.getElement('newFieldValue').value; |
524 | }, | 522 | }, |
525 | 523 | ||
526 | 'setNewFieldValue': function (aValue) { | 524 | 'setNewFieldValue': function (aValue) { |
527 | this.getElement('newFieldValue').value = aValue; | 525 | this.getElement('newFieldValue').value = aValue; |
528 | }, | 526 | }, |
529 | 527 | ||
530 | //------------------------------------------------------------------------- | 528 | //------------------------------------------------------------------------- |
531 | 529 | ||
532 | 'newFieldIsHidden': function () { | 530 | 'newFieldIsHidden': function () { |
533 | return MochiKit.DOM.hasElementClass(this.getElement('newFieldIsLocked'), 'locked'); | 531 | return MochiKit.DOM.hasElementClass(this.getElement('newFieldIsLocked'), 'locked'); |
534 | }, | 532 | }, |
535 | 533 | ||
536 | 'setNewFieldIsHidden': function (aValue) { | 534 | 'setNewFieldIsHidden': function (aValue) { |
537 | MochiKit.DOM.setElementClass(this.getElement('newFieldIsLocked'), (aValue ? 'locked': 'unlocked')); | 535 | MochiKit.DOM.setElementClass(this.getElement('newFieldIsLocked'), (aValue ? 'locked': 'unlocked')); |
538 | MochiKit.DOM.setElementClass(this.getElement('newFieldValueWrapper'), (aValue ? 'locked': 'unlocked')); | 536 | MochiKit.DOM.setElementClass(this.getElement('newFieldValueWrapper'), (aValue ? 'locked': 'unlocked')); |
539 | }, | 537 | }, |
540 | 538 | ||
541 | 'toggleNewFieldIsHidden': function (anEvent) { | 539 | 'toggleNewFieldIsHidden': function (anEvent) { |
542 | anEvent.preventDefault(); | 540 | anEvent.preventDefault(); |
543 | 541 | ||
544 | this.setNewFieldIsHidden(! this.newFieldIsHidden()); | 542 | this.setNewFieldIsHidden(! this.newFieldIsHidden()); |
545 | MochiKit.Signal.signal(this, 'changedValue'); | 543 | MochiKit.Signal.signal(this, 'changedValue'); |
546 | }, | 544 | }, |
547 | 545 | ||
548 | //------------------------------------------------------------------------- | 546 | //------------------------------------------------------------------------- |
549 | 547 | ||
550 | 'newFieldHasPendingChanges': function () { | 548 | 'newFieldHasPendingChanges': function () { |
551 | return ((this.newFieldLabel() != '') || (this.newFieldValue() != '') || (this.newFieldIsHidden() == true)); | 549 | return ((this.newFieldLabel() != '') || (this.newFieldValue() != '') || (this.newFieldIsHidden() == true)); |
552 | }, | 550 | }, |
553 | 551 | ||
554 | 'resetNewFieldInputs': function () { | 552 | 'resetNewFieldInputs': function () { |
555 | this.setNewFieldLabel(''); | 553 | this.setNewFieldLabel(''); |
556 | this.setNewFieldValue(''); | 554 | this.setNewFieldValue(''); |
557 | this.setNewFieldIsHidden(false); | 555 | this.setNewFieldIsHidden(false); |
558 | }, | 556 | }, |
559 | 557 | ||
560 | //========================================================================= | 558 | //========================================================================= |
561 | 559 | ||
562 | 'handleKeyDownOnNewFieldValue': function (anEvent) { | 560 | 'handleKeyDownOnNewFieldValue': function (anEvent) { |
563 | MochiKit.Signal.signal(this, 'keyPressed', anEvent); | 561 | MochiKit.Signal.signal(this, 'keyPressed', anEvent); |
564 | /* | 562 | /* |
565 | if ((anEvent.key().string == 'KEY_TAB') && this.newFieldHasPendingChanges()) { | 563 | if ((anEvent.key().string == 'KEY_TAB') && this.newFieldHasPendingChanges()) { |
566 | anEvent.preventDefault(); | 564 | anEvent.preventDefault(); |
567 | 565 | ||
568 | MochiKit.Signal.signal(this, 'addField'); | 566 | MochiKit.Signal.signal(this, 'addField'); |
569 | this.getElement('newFieldLabel').focus(); | 567 | this.getElement('newFieldLabel').focus(); |
570 | } | 568 | } |
571 | */ | 569 | */ |
572 | }, | 570 | }, |
573 | 571 | ||
574 | //------------------------------------------------------------------------- | 572 | //------------------------------------------------------------------------- |
575 | 573 | ||
576 | 'handleAddClick': function (anEvent) { | 574 | 'handleAddClick': function (anEvent) { |
577 | anEvent.preventDefault(); | 575 | anEvent.preventDefault(); |
578 | MochiKit.Signal.signal(this, 'addField'); | 576 | MochiKit.Signal.signal(this, 'addField'); |
579 | this.getElement('newFieldLabel').focus(); | 577 | this.getElement('newFieldLabel').focus(); |
580 | }, | 578 | }, |
581 | 579 | ||
582 | //========================================================================= | 580 | //========================================================================= |
583 | 581 | ||
584 | 'handleDeleteClick': function (aFieldKey, anEvent) { | 582 | 'handleDeleteClick': function (aFieldKey, anEvent) { |
585 | anEvent.preventDefault(); | 583 | anEvent.preventDefault(); |
586 | MochiKit.Signal.signal(this, 'deleteField', aFieldKey); | 584 | MochiKit.Signal.signal(this, 'deleteField', aFieldKey); |
587 | }, | 585 | }, |
588 | 586 | ||
589 | //------------------------------------------------------------------------- | 587 | //------------------------------------------------------------------------- |
590 | 588 | ||
591 | 'toggleLock': function (aFieldKey, anEvent) { | 589 | 'toggleLock': function (aFieldKey, anEvent) { |
592 | var shouldRedrawAsLocked; | 590 | var shouldRedrawAsLocked; |
593 | var currentTRElement; | 591 | var currentTRElement; |
594 | 592 | ||
595 | anEvent.preventDefault(); | 593 | anEvent.preventDefault(); |
596 | 594 | ||
597 | currentTRElement = Clipperz.DOM.get(aFieldKey); | 595 | currentTRElement = Clipperz.DOM.get(aFieldKey); |
598 | shouldRedrawAsLocked = (MochiKit.DOM.hasElementClass(currentTRElement, 'locked') ? false : true); | 596 | shouldRedrawAsLocked = (MochiKit.DOM.hasElementClass(currentTRElement, 'locked') ? false : true); |
599 | 597 | ||
600 | this.renderFieldTR(currentTRElement, { | 598 | this.renderFieldTR(currentTRElement, { |
601 | label:MochiKit.Selector.findChildElements(currentTRElement, ['td.fieldLabel input'])[0].value, | 599 | label:MochiKit.Selector.findChildElements(currentTRElement, ['td.fieldLabel input'])[0].value, |
602 | value:MochiKit.Selector.findChildElements(currentTRElement, ['td.fieldValue input'])[0].value | 600 | value:MochiKit.Selector.findChildElements(currentTRElement, ['td.fieldValue input'])[0].value |
603 | }, shouldRedrawAsLocked, MochiKit.DOM.hasElementClass(currentTRElement, 'new')); | 601 | }, shouldRedrawAsLocked, MochiKit.DOM.hasElementClass(currentTRElement, 'new')); |
604 | }, | 602 | }, |
605 | 603 | ||
606 | //========================================================================= | 604 | //========================================================================= |
607 | 605 | ||
608 | 'fixNotesHeight': function () { | 606 | 'fixNotesHeight': function () { |
609 | var element; | 607 | var element; |
610 | 608 | ||
611 | element = this.getElement('recordNote'); | 609 | element = this.getElement('recordNote'); |
612 | 610 | ||
613 | if (element.scrollHeight == 0) { | 611 | if (element.scrollHeight == 0) { |
614 | MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, 'fixNotesHeight')); | 612 | MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, 'fixNotesHeight')); |
615 | } else { | 613 | } else { |
616 | var textareaHeight; | 614 | var textareaHeight; |
617 | 615 | ||
618 | textareaHeight = Math.min(Math.max(50, element.scrollHeight), 500); | 616 | textareaHeight = Math.min(Math.max(50, element.scrollHeight), 500); |
619 | 617 | ||
620 | MochiKit.Style.setElementDimensions(element, {h:textareaHeight}, 'px'); | 618 | MochiKit.Style.setElementDimensions(element, {h:textareaHeight}, 'px'); |
621 | MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, 'fixRendering')); | 619 | MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, 'fixRendering')); |
622 | } | 620 | } |
623 | }, | 621 | }, |
624 | 622 | ||
625 | //------------------------------------------------------------------------- | 623 | //------------------------------------------------------------------------- |
626 | 624 | ||
627 | 'fixRendering': function () { | 625 | 'fixRendering': function () { |
628 | // varheight; | 626 | // varheight; |
629 | var y; | 627 | var y; |
630 | varscrollHeight; | 628 | varscrollHeight; |
631 | var viewportHeight; | 629 | var viewportHeight; |
632 | var viewportY; | 630 | var viewportY; |
633 | var footerElement; | 631 | var footerElement; |
634 | var footerElementPosition; | 632 | var footerElementPosition; |
635 | var footerElementDimensions; | 633 | var footerElementDimensions; |
636 | var footerComputedHeight; | 634 | var footerComputedHeight; |
637 | 635 | ||
638 | // height = MochiKit.Style.getElementDimensions(this.displayElement())['h']; | 636 | // height = MochiKit.Style.getElementDimensions(this.displayElement())['h']; |
639 | y = MochiKit.Style.getElementPosition(this.displayElement())['y']; | 637 | y = MochiKit.Style.getElementPosition(this.displayElement())['y']; |
640 | 638 | ||
641 | footerElement = MochiKit.Selector.findChildElements(this.displayElement(), ['div.footer'])[0]; | 639 | footerElement = MochiKit.Selector.findChildElements(this.displayElement(), ['div.footer'])[0]; |
642 | footerElementPosition = MochiKit.Style.getElementPosition(footerElement); | 640 | footerElementPosition = MochiKit.Style.getElementPosition(footerElement); |
643 | footerElementDimensions = MochiKit.Style.getElementDimensions(footerElement); | 641 | footerElementDimensions = MochiKit.Style.getElementDimensions(footerElement); |
644 | footerComputedHeight = footerElementPosition['y'] + footerElementDimensions['h'] - y; | 642 | footerComputedHeight = footerElementPosition['y'] + footerElementDimensions['h'] - y; |
645 | 643 | ||
646 | // scrollHeight = this.displayElement().scrollHeight; | 644 | // scrollHeight = this.displayElement().scrollHeight; |
647 | scrollHeight = footerComputedHeight; | 645 | scrollHeight = footerComputedHeight; |
648 | 646 | ||
649 | viewportHeight = MochiKit.Style.getViewportDimensions()['h']; | 647 | viewportHeight = MochiKit.Style.getViewportDimensions()['h']; |
650 | viewportY = MochiKit.Style.getViewportPosition()['y']; | 648 | viewportY = MochiKit.Style.getViewportPosition()['y']; |
651 | 649 | ||
652 | if ((y + scrollHeight) > (viewportY + viewportHeight)) { | 650 | if ((y + scrollHeight) > (viewportY + viewportHeight)) { |
653 | this.setDisplayMode('scrollable'); | 651 | this.setDisplayMode('scrollable'); |
654 | MochiKit.DOM.addElementClass(this.element(), 'scrollable'); | 652 | MochiKit.DOM.addElementClass(this.element(), 'scrollable'); |
655 | MochiKit.DOM.removeElementClass(this.element(), 'fixed'); | 653 | MochiKit.DOM.removeElementClass(this.element(), 'fixed'); |
656 | MochiKit.Style.setElementPosition(this.displayElement(), {y:Math.max(0, Math.min(y, (viewportY + viewportHeight) - scrollHeight))}, 'px'); | 654 | MochiKit.Style.setElementPosition(this.displayElement(), {y:Math.max(0, Math.min(y, (viewportY + viewportHeight) - scrollHeight))}, 'px'); |
657 | MochiKit.Visual.ScrollTo(this.displayElement(), {duration:0.5}); | 655 | MochiKit.Visual.ScrollTo(this.displayElement(), {duration:0.5}); |
658 | } else { | 656 | } else { |
659 | this.setDisplayMode('fixed'); | 657 | this.setDisplayMode('fixed'); |
660 | MochiKit.DOM.removeElementClass(this.element(), 'scrollable'); | 658 | MochiKit.DOM.removeElementClass(this.element(), 'scrollable'); |
661 | MochiKit.DOM.addElementClass(this.element(), 'fixed'); | 659 | MochiKit.DOM.addElementClass(this.element(), 'fixed'); |
662 | } | 660 | } |
663 | }, | 661 | }, |
664 | 662 | ||
665 | //========================================================================= | 663 | //========================================================================= |
666 | 664 | ||
667 | 'unselectCurrentSelectedItems': function () { | 665 | 'unselectCurrentSelectedItems': function () { |
668 | MochiKit.Iter.forEach(MochiKit.Selector.findChildElements(this.displayElement(), ['.selectedField']), function (anElement) { | 666 | MochiKit.Iter.forEach(MochiKit.Selector.findChildElements(this.displayElement(), ['.selectedField']), function (anElement) { |
669 | MochiKit.DOM.removeElementClass(anElement, 'selectedField'); | 667 | MochiKit.DOM.removeElementClass(anElement, 'selectedField'); |
670 | }); | 668 | }); |
671 | }, | 669 | }, |
672 | 670 | ||
673 | //========================================================================= | 671 | //========================================================================= |
674 | 672 | ||
675 | 'hideProgressMask': function () { | 673 | 'hideProgressMask': function () { |
676 | MochiKit.DOM.removeElementClass(this.getId('panel'), 'loading'); | 674 | MochiKit.DOM.removeElementClass(this.getId('panel'), 'loading'); |
677 | }, | 675 | }, |
678 | 676 | ||
679 | 'showProgressMask': function () { | 677 | 'showProgressMask': function () { |
680 | this.getElement('progressDescription').innerHTML = "Saving"; | 678 | this.getElement('progressDescription').innerHTML = "Saving"; |
681 | MochiKit.DOM.addElementClass(this.getId('panel'), 'loading'); | 679 | MochiKit.DOM.addElementClass(this.getId('panel'), 'loading'); |
682 | }, | 680 | }, |
683 | 681 | ||
684 | 'showError': function (anError) { | 682 | 'showError': function (anError) { |
685 | //console.log(">>> showError", anError); | ||
686 | MochiKit.Style.hideElement(this.getId('progress')); | 683 | MochiKit.Style.hideElement(this.getId('progress')); |
687 | this.getElement('errorMessage').innerHTML = Clipperz.PM.Strings.errorDescriptionForException(anError['message']); | 684 | this.getElement('errorMessage').innerHTML = Clipperz.PM.Strings.errorDescriptionForException(anError['message']); |
688 | MochiKit.Style.showElement(this.getId('error')); | 685 | MochiKit.Style.showElement(this.getId('error')); |
689 | }, | 686 | }, |
690 | 687 | ||
691 | //------------------------------------------------------------------------- | 688 | //------------------------------------------------------------------------- |
692 | 689 | ||
693 | 'cancel': function () { | 690 | 'cancel': function () { |
694 | /* | 691 | /* |
695 | var deferredResult; | 692 | var deferredResult; |
696 | 693 | ||
697 | deferredResult = new Clipperz.Async.Deferred("CardDialogComponent.cancel", {trace:false}); | 694 | deferredResult = new Clipperz.Async.Deferred("CardDialogComponent.cancel", {trace:false}); |
698 | deferredResult.addCallback(MochiKit.Base.method(this, 'isSavingEnabled')); | 695 | deferredResult.addCallback(MochiKit.Base.method(this, 'isSavingEnabled')); |
699 | deferredResult.addIf([ | 696 | deferredResult.addIf([ |
700 | MochiKit.Base.method(this, 'askConfirmationForLoosingPendingChanges') | 697 | MochiKit.Base.method(this, 'askConfirmationForLoosingPendingChanges') |
701 | ], []); | 698 | ], []); |
702 | deferredResult.addCallback(MochiKit.Base.partial(MochiKit.Signal.signal, this, 'cancel')); | 699 | deferredResult.addCallback(MochiKit.Base.partial(MochiKit.Signal.signal, this, 'cancel')); |
703 | deferredResult.callback(); | 700 | deferredResult.callback(); |
704 | 701 | ||
705 | return deferredResult; | 702 | return deferredResult; |
706 | */ | 703 | */ |
707 | MochiKit.Signal.signal(this, 'cancel'); | 704 | MochiKit.Signal.signal(this, 'cancel'); |
708 | }, | 705 | }, |
709 | 706 | ||
710 | 'handleCancelEvent': function (anEvent) { | 707 | 'handleCancelEvent': function (anEvent) { |
711 | anEvent.preventDefault(); | 708 | anEvent.preventDefault(); |
712 | this.cancel(); | 709 | this.cancel(); |
713 | }, | 710 | }, |
714 | 711 | ||
715 | //------------------------------------------------------------------------- | 712 | //------------------------------------------------------------------------- |
716 | 713 | ||
717 | 'handleSaveEvent': function (anEvent) { | 714 | 'handleSaveEvent': function (anEvent) { |
718 | anEvent.preventDefault(); | 715 | anEvent.preventDefault(); |
719 | 716 | ||
720 | if (! MochiKit.DOM.hasElementClass(anEvent.src(), 'disabled')) { | 717 | if (! MochiKit.DOM.hasElementClass(anEvent.src(), 'disabled')) { |
721 | MochiKit.Signal.signal(this, 'save'); | 718 | MochiKit.Signal.signal(this, 'save'); |
722 | } | 719 | } |
723 | }, | 720 | }, |
724 | 721 | ||
725 | //------------------------------------------------------------------------- | 722 | //------------------------------------------------------------------------- |
726 | 723 | ||
727 | 'handleAddDirectLogin': function (anEvent) { | 724 | 'handleAddDirectLogin': function (anEvent) { |
728 | anEvent.preventDefault(); | 725 | anEvent.preventDefault(); |
729 | 726 | ||
730 | MochiKit.Signal.signal(this, 'addDirectLogin'); | 727 | MochiKit.Signal.signal(this, 'addDirectLogin'); |
731 | }, | 728 | }, |
732 | 729 | ||
733 | //------------------------------------------------------------------------- | 730 | //------------------------------------------------------------------------- |
734 | 731 | ||
735 | 'handleOnFocusEvent': function (anElement, anEvent) { | 732 | 'handleOnFocusEvent': function (anElement, anEvent) { |
736 | this.unselectCurrentSelectedItems(); | 733 | this.unselectCurrentSelectedItems(); |
737 | MochiKit.DOM.addElementClass(anElement, 'selectedField'); | 734 | MochiKit.DOM.addElementClass(anElement, 'selectedField'); |
738 | }, | 735 | }, |
739 | 736 | ||
740 | 'handleLooseFocusEvent': function (anElement, anEvent) { | 737 | 'handleLooseFocusEvent': function (anElement, anEvent) { |
741 | this.unselectCurrentSelectedItems(); | 738 | this.unselectCurrentSelectedItems(); |
742 | }, | 739 | }, |
743 | 740 | ||
744 | //------------------------------------------------------------------------- | 741 | //------------------------------------------------------------------------- |
745 | 742 | ||
746 | 'handleTabSelected': function (aSelectedTab) { | 743 | 'handleTabSelected': function (aSelectedTab) { |
747 | this.unselectCurrentSelectedItems(); | 744 | this.unselectCurrentSelectedItems(); |
748 | 745 | ||
749 | switch (aSelectedTab) { | 746 | switch (aSelectedTab) { |
750 | case 'DETAILS': | 747 | case 'DETAILS': |
751 | // MochiKit.Style.hideElement(this.getElement('addDirectLoginButton')); | 748 | // MochiKit.Style.hideElement(this.getElement('addDirectLoginButton')); |
752 | break; | 749 | break; |
753 | case 'DIRECT_LOGINS': | 750 | case 'DIRECT_LOGINS': |
754 | // MochiKit.Style.showElement(this.getElement('addDirectLoginButton')); | 751 | // MochiKit.Style.showElement(this.getElement('addDirectLoginButton')); |
755 | break; | 752 | break; |
756 | case 'SHARING': | 753 | case 'SHARING': |
757 | // MochiKit.Style.hideElement(this.getElement('addDirectLoginButton')); | 754 | // MochiKit.Style.hideElement(this.getElement('addDirectLoginButton')); |
758 | break; | 755 | break; |
759 | } | 756 | } |
760 | }, | 757 | }, |
761 | 758 | ||
762 | //------------------------------------------------------------------------- | 759 | //------------------------------------------------------------------------- |
763 | 760 | ||
764 | 'handleKeyEvent': function (anEvent) { | 761 | 'handleKeyEvent': function (anEvent) { |
765 | //console.log("####", anEvent.key().string); | ||
766 | if (anEvent.key().string == 'KEY_ESCAPE') { | 762 | if (anEvent.key().string == 'KEY_ESCAPE') { |
767 | MochiKit.Signal.signal(this, 'changedValue'); | 763 | MochiKit.Signal.signal(this, 'changedValue'); |
768 | this.cancel(); | 764 | this.cancel(); |
769 | } else if (anEvent.key().string == 'KEY_ENTER') { | 765 | } else if (anEvent.key().string == 'KEY_ENTER') { |
770 | if (anEvent.target().nodeName == 'TEXTAREA') { | 766 | if (anEvent.target().nodeName == 'TEXTAREA') { |
771 | 767 | ||
772 | } else { | 768 | } else { |
773 | anEvent.preventDefault(); | 769 | anEvent.preventDefault(); |
774 | } | 770 | } |
775 | } | 771 | } |
776 | }, | 772 | }, |
777 | 773 | ||
778 | //========================================================================= | 774 | //========================================================================= |
779 | 775 | ||
780 | 'askConfirmationForLoosingPendingChanges': function () { | 776 | 'askConfirmationForLoosingPendingChanges': function () { |
781 | var deferredResult; | 777 | var deferredResult; |
782 | var confirmationDialog; | 778 | var confirmationDialog; |
783 | 779 | ||
784 | confirmationDialog = new Clipperz.PM.UI.Common.Components.SimpleMessagePanel({ | 780 | confirmationDialog = new Clipperz.PM.UI.Common.Components.SimpleMessagePanel({ |
785 | title:"Alert", | 781 | title:"Alert", |
786 | text:"Should lost pending changes?", | 782 | text:"Should lost pending changes?", |
787 | type:'ALERT', | 783 | type:'ALERT', |
788 | buttons: [ | 784 | buttons: [ |
789 | {text:"Cancel",result:'CANCEL', isDefault:true}, | 785 | {text:"Cancel",result:'CANCEL', isDefault:true}, |
790 | {text:"Ok", result:'OK'} | 786 | {text:"Ok", result:'OK'} |
791 | ] | 787 | ] |
792 | }); | 788 | }); |
793 | 789 | ||
794 | deferredResult = new Clipperz.Async.Deferred("CardDialogComponent.askConfirmationForLoosingPendingChanges", {trace:false}); | 790 | deferredResult = new Clipperz.Async.Deferred("CardDialogComponent.askConfirmationForLoosingPendingChanges", {trace:false}); |
795 | // deferredResult = confirmationDialog.deferredShow({openFromElement:anEvent.src(), onOkCloseToElement:MochiKit.DOM.currentDocument().body, onCancelCloseToElement:anEvent.src()}); | 791 | // deferredResult = confirmationDialog.deferredShow({openFromElement:anEvent.src(), onOkCloseToElement:MochiKit.DOM.currentDocument().body, onCancelCloseToElement:anEvent.src()}); |
796 | deferredResult.addMethod(confirmationDialog, 'deferredShow', { | 792 | deferredResult.addMethod(confirmationDialog, 'deferredShow', { |
797 | 'openFromElement': this.getElement('cancelButton'), | 793 | 'openFromElement': this.getElement('cancelButton'), |
798 | 'onOkCloseToElement': null, //this.getElement('cancelButton'), | 794 | 'onOkCloseToElement': null, //this.getElement('cancelButton'), |
799 | 'onCancelCloseToElement':this.getElement('cancelButton') | 795 | 'onCancelCloseToElement':this.getElement('cancelButton') |
800 | }); | 796 | }); |
801 | // deferredResult.addCallback(function () { console.log("DELETE: " + anObject.toString(), anObject); }); | ||
802 | // deferredResult.addErrbackPass(function () { console.log("skip deletion: " + anObject.toString(), anObject); }); | ||
803 | deferredResult.callback(); | 797 | deferredResult.callback(); |
804 | 798 | ||
805 | return deferredResult; | 799 | return deferredResult; |
806 | }, | 800 | }, |
807 | 801 | ||
808 | //========================================================================= | 802 | //========================================================================= |
809 | 803 | ||
810 | 'showDirectLoginEditingComponent': function () { | 804 | 'showDirectLoginEditingComponent': function () { |
811 | varwidth; | 805 | varwidth; |
812 | var transition; | 806 | var transition; |
813 | var duration; | 807 | var duration; |
814 | 808 | ||
815 | width = MochiKit.Style.getElementDimensions(this.getElement('directLoginsComponentContainer'))['w']; | 809 | width = MochiKit.Style.getElementDimensions(this.getElement('directLoginsComponentContainer'))['w']; |
816 | transition = MochiKit.Visual.Transitions.sinoidal; | 810 | transition = MochiKit.Visual.Transitions.sinoidal; |
817 | duration = 1; | 811 | duration = 1; |
818 | 812 | ||
819 | return Clipperz.Async.callbacks("CardDialogComponent.showDirectLoginEditingComponent", [ | 813 | return Clipperz.Async.callbacks("CardDialogComponent.showDirectLoginEditingComponent", [ |
820 | MochiKit.Base.method(this, 'disableCardTitleEditing'), | 814 | MochiKit.Base.method(this, 'disableCardTitleEditing'), |
821 | MochiKit.Base.method(this.tabPanelController(), 'disable'), | 815 | MochiKit.Base.method(this.tabPanelController(), 'disable'), |
822 | 816 | ||
823 | MochiKit.Base.bind(function () { | 817 | MochiKit.Base.bind(function () { |
824 | MochiKit.Style.setElementPosition (this.getElement('directLoginEditDetail'), {x:width, y:-MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}); | 818 | MochiKit.Style.setElementPosition (this.getElement('directLoginEditDetail'), {x:width, y:-MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}); |
825 | MochiKit.Style.setElementDimensions(this.getElement('directLoginEditDetail'), {w:width}); | 819 | MochiKit.Style.setElementDimensions(this.getElement('directLoginEditDetail'), {w:width}); |
826 | MochiKit.Style.showElement(this.getElement('directLoginEditDetail')); | 820 | MochiKit.Style.showElement(this.getElement('directLoginEditDetail')); |
827 | MochiKit.Style.setOpacity(this.getElement('directLoginEditDetail'), 0); | 821 | MochiKit.Style.setOpacity(this.getElement('directLoginEditDetail'), 0); |
828 | MochiKit.Style.setElementDimensions(this.getElement('directLoginsComponentContainer'), { | 822 | MochiKit.Style.setElementDimensions(this.getElement('directLoginsComponentContainer'), { |
829 | h:Math.max( | 823 | h:Math.max( |
830 | MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h'], | 824 | MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h'], |
831 | MochiKit.Style.getElementDimensions(this.getElement('directLoginEditDetail'))['h'] | 825 | MochiKit.Style.getElementDimensions(this.getElement('directLoginEditDetail'))['h'] |
832 | ) | 826 | ) |
833 | }); | 827 | }); |
834 | // MochiKit.Style.setElementDimensions(this.getElement('directLoginsComponentContainer'), {h:MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}); | 828 | // MochiKit.Style.setElementDimensions(this.getElement('directLoginsComponentContainer'), {h:MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}); |
835 | }, this), | 829 | }, this), |
836 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimations,MochiKit.Visual.Parallel, [ | 830 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimations,MochiKit.Visual.Parallel, [ |
837 | new MochiKit.Visual.Move(this.getElement('directLogins'), {x:-width, y:0, mode:'relative', transition:transition, sync:true}), | 831 | new MochiKit.Visual.Move(this.getElement('directLogins'), {x:-width, y:0, mode:'relative', transition:transition, sync:true}), |
838 | new MochiKit.Visual.Opacity(this.getElement('directLogins'), {from:1.0, to:0.0, transition:transition, sync:true}), | 832 | new MochiKit.Visual.Opacity(this.getElement('directLogins'), {from:1.0, to:0.0, transition:transition, sync:true}), |
839 | new MochiKit.Visual.Move(this.getElement('directLoginEditDetail'), {x:-width, y:0, mode:'relative', transition:transition, sync:true}), | 833 | new MochiKit.Visual.Move(this.getElement('directLoginEditDetail'), {x:-width, y:0, mode:'relative', transition:transition, sync:true}), |
840 | new MochiKit.Visual.Opacity(this.getElement('directLoginEditDetail'),{from:0.0, to:1.0, transition:transition, sync:true}) | 834 | new MochiKit.Visual.Opacity(this.getElement('directLoginEditDetail'),{from:0.0, to:1.0, transition:transition, sync:true}) |
841 | ], {duration:duration}), | 835 | ], {duration:duration}), |
842 | 836 | ||
843 | MochiKit.Base.noop | 837 | MochiKit.Base.noop |
844 | ], {trace:false}); | 838 | ], {trace:false}); |
845 | }, | 839 | }, |
846 | 840 | ||
847 | //------------------------------------------------------------------------- | 841 | //------------------------------------------------------------------------- |
848 | 842 | ||
849 | 'hideDirectLoginEditingComponent': function () { | 843 | 'hideDirectLoginEditingComponent': function () { |
850 | varwidth; | 844 | varwidth; |
851 | var transition; | 845 | var transition; |
852 | var duration; | 846 | var duration; |
853 | 847 | ||
854 | width = MochiKit.Style.getElementDimensions(this.getElement('directLoginsComponentContainer'))['w']; | 848 | width = MochiKit.Style.getElementDimensions(this.getElement('directLoginsComponentContainer'))['w']; |
855 | transition = MochiKit.Visual.Transitions.sinoidal; | 849 | transition = MochiKit.Visual.Transitions.sinoidal; |
856 | duration = 1; | 850 | duration = 1; |
857 | 851 | ||
858 | return Clipperz.Async.callbacks("CardDialogComponent.hideDirectLoginEditingComponent", [ | 852 | return Clipperz.Async.callbacks("CardDialogComponent.hideDirectLoginEditingComponent", [ |
859 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimations,MochiKit.Visual.Parallel, [ | 853 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimations,MochiKit.Visual.Parallel, [ |
860 | new MochiKit.Visual.Move(this.getElement('directLogins'), {x:width, y:0, mode:'relative', transition:transition, sync:true}), | 854 | new MochiKit.Visual.Move(this.getElement('directLogins'), {x:width, y:0, mode:'relative', transition:transition, sync:true}), |
861 | new MochiKit.Visual.Opacity(this.getElement('directLogins'), {from:0.0, to:1.0, transition:transition, sync:true}), | 855 | new MochiKit.Visual.Opacity(this.getElement('directLogins'), {from:0.0, to:1.0, transition:transition, sync:true}), |
862 | new MochiKit.Visual.Move(this.getElement('directLoginEditDetail'), {x:width, y:0, mode:'relative', transition:transition, sync:true}), | 856 | new MochiKit.Visual.Move(this.getElement('directLoginEditDetail'), {x:width, y:0, mode:'relative', transition:transition, sync:true}), |
863 | new MochiKit.Visual.Opacity(this.getElement('directLoginEditDetail'),{from:1.0, to:0.0, transition:transition, sync:true}) | 857 | new MochiKit.Visual.Opacity(this.getElement('directLoginEditDetail'),{from:1.0, to:0.0, transition:transition, sync:true}) |
864 | ], {duration:duration}), | 858 | ], {duration:duration}), |
865 | // MochiKit.Base.partial(MochiKit.Visual.appear, this.getElement('addDirectLoginButton'), {duration:0.3}), | 859 | // MochiKit.Base.partial(MochiKit.Visual.appear, this.getElement('addDirectLoginButton'), {duration:0.3}), |
866 | Clipperz.Async.clearResult, | 860 | Clipperz.Async.clearResult, |
867 | MochiKit.Base.partial(MochiKit.Style.hideElement, this.getElement('directLoginEditDetail')), | 861 | MochiKit.Base.partial(MochiKit.Style.hideElement, this.getElement('directLoginEditDetail')), |
868 | // MochiKit.Base.partial(MochiKit.Style.showElement, this.getElement('directLogins')), | 862 | // MochiKit.Base.partial(MochiKit.Style.showElement, this.getElement('directLogins')), |
869 | MochiKit.Base.partial(MochiKit.Style.setElementDimensions, this.getElement('directLoginsComponentContainer'), {h:MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}), | 863 | MochiKit.Base.partial(MochiKit.Style.setElementDimensions, this.getElement('directLoginsComponentContainer'), {h:MochiKit.Style.getElementDimensions(this.getElement('directLogins'))['h']}), |
870 | 864 | ||
871 | MochiKit.Base.method(this, 'enableCardTitleEditing'), | 865 | MochiKit.Base.method(this, 'enableCardTitleEditing'), |
872 | MochiKit.Base.method(this.tabPanelController(), 'enable') | 866 | MochiKit.Base.method(this.tabPanelController(), 'enable') |
873 | ], {trace:false}); | 867 | ], {trace:false}); |
874 | }, | 868 | }, |
875 | 869 | ||
876 | //========================================================================= | 870 | //========================================================================= |
877 | __syntaxFix__: "syntax fix" | 871 | __syntaxFix__: "syntax fix" |
878 | }); | 872 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordDirectLoginComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordDirectLoginComponent.js index 2e61f5f..0cee650 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordDirectLoginComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordDirectLoginComponent.js | |||
@@ -1,179 +1,173 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginComponent.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginComponent.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._reference = args.reference|| Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._reference = args.reference|| Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._faviconComponent = null; | 32 | this._faviconComponent = null; |
35 | 33 | ||
36 | return this; | 34 | return this; |
37 | } | 35 | } |
38 | 36 | ||
39 | //============================================================================= | 37 | //============================================================================= |
40 | 38 | ||
41 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 39 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { |
42 | 40 | ||
43 | //------------------------------------------------------------------------- | 41 | //------------------------------------------------------------------------- |
44 | 42 | ||
45 | 'toString': function () { | 43 | 'toString': function () { |
46 | return "Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginComponent component"; | 44 | return "Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginComponent component"; |
47 | }, | 45 | }, |
48 | 46 | ||
49 | //------------------------------------------------------------------------- | 47 | //------------------------------------------------------------------------- |
50 | 48 | ||
51 | 'reference': function () { | 49 | 'reference': function () { |
52 | return this._reference; | 50 | return this._reference; |
53 | }, | 51 | }, |
54 | 52 | ||
55 | //------------------------------------------------------------------------- | 53 | //------------------------------------------------------------------------- |
56 | 54 | ||
57 | 'renderSelf': function() { | 55 | 'renderSelf': function() { |
58 | //console.log(">>> CardDialogRecordDirectLoginComponent.renderSelf"); | ||
59 | this.append(this.element(), [ | 56 | this.append(this.element(), [ |
60 | {tag:'div', cls:'cardDialogRecordDirectLoginComponent_favicon', children:[ | 57 | {tag:'div', cls:'cardDialogRecordDirectLoginComponent_favicon', children:[ |
61 | {tag:'img', cls:'favicon', id:this.getId('favicon')} | 58 | {tag:'img', cls:'favicon', id:this.getId('favicon')} |
62 | ]}, | 59 | ]}, |
63 | {tag:'div', cls:'cardDialogRecordDirectLoginComponent_label', children:[ | 60 | {tag:'div', cls:'cardDialogRecordDirectLoginComponent_label', children:[ |
64 | {tag:'input', id:this.getId('label'), type:'text'} | 61 | {tag:'input', id:this.getId('label'), type:'text'} |
65 | ]}, | 62 | ]}, |
66 | {tag:'div', cls:'open', children:[ | 63 | {tag:'div', cls:'open', children:[ |
67 | {tag:'span', children:[ | 64 | {tag:'span', children:[ |
68 | {tag:'a', href:'open', id:this.getId('open'), html:' '} | 65 | {tag:'a', href:'open', id:this.getId('open'), html:' '} |
69 | ]} | 66 | ]} |
70 | ]}, | 67 | ]}, |
71 | {tag:'div', cls:'edit', children:[ | 68 | {tag:'div', cls:'edit', children:[ |
72 | {tag:'span', children:[ | 69 | {tag:'span', children:[ |
73 | {tag:'a', href:'edit', id:this.getId('edit'), html:"edit"} | 70 | {tag:'a', href:'edit', id:this.getId('edit'), html:"edit"} |
74 | ]} | 71 | ]} |
75 | ]}, | 72 | ]}, |
76 | {tag:'div', cls:'delete', children:[ | 73 | {tag:'div', cls:'delete', children:[ |
77 | {tag:'span', children:[ | 74 | {tag:'span', children:[ |
78 | {tag:'a', href:'delete', id:this.getId('delete'), html:"delete"} | 75 | {tag:'a', href:'delete', id:this.getId('delete'), html:"delete"} |
79 | ]} | 76 | ]} |
80 | ]} | 77 | ]} |
81 | /* | 78 | /* |
82 | {tag:'td', cls:'fieldState'}, | 79 | {tag:'td', cls:'fieldState'}, |
83 | {tag:'td', cls:'fieldLabel', children:[ | 80 | {tag:'td', cls:'fieldLabel', children:[ |
84 | {tag:'input', cls:'label', id:this.getId('label')} | 81 | {tag:'input', cls:'label', id:this.getId('label')} |
85 | ]}, | 82 | ]}, |
86 | {tag:'td', cls:'fieldLock', children:[ | 83 | {tag:'td', cls:'fieldLock', children:[ |
87 | {tag:'div', cls:'unlocked', id:this.getId('isHidden')} | 84 | {tag:'div', cls:'unlocked', id:this.getId('isHidden')} |
88 | ]}, | 85 | ]}, |
89 | {tag:'td', cls:'fieldValue', children:[ | 86 | {tag:'td', cls:'fieldValue', children:[ |
90 | {tag:'div', cls:'unlocked', id:this.getId('valueWrapper'), children:[ | 87 | {tag:'div', cls:'unlocked', id:this.getId('valueWrapper'), children:[ |
91 | {tag:'input', type:'text', cls:'value', id:this.getId('value')} | 88 | {tag:'input', type:'text', cls:'value', id:this.getId('value')} |
92 | ]} | 89 | ]} |
93 | ]}, | 90 | ]}, |
94 | {tag:'td', cls:'fieldAddDelete', children:[ | 91 | {tag:'td', cls:'fieldAddDelete', children:[ |
95 | {tag:'div', cls:'delete', children:[ | 92 | {tag:'div', cls:'delete', children:[ |
96 | {tag:'span', children:[ | 93 | {tag:'span', children:[ |
97 | {tag:'a', href:'#', id:this.getId('delete'), html:"delete"} | 94 | {tag:'a', href:'#', id:this.getId('delete'), html:"delete"} |
98 | ]} | 95 | ]} |
99 | ]} | 96 | ]} |
100 | ]} | 97 | ]} |
101 | */ | 98 | */ |
102 | ]); | 99 | ]); |
103 | 100 | ||
104 | MochiKit.Signal.connect(this.getId('label'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | 101 | MochiKit.Signal.connect(this.getId('label'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); |
105 | MochiKit.Signal.connect(this.getId('open'), 'onclick',this, 'openDirectLogin'); | 102 | MochiKit.Signal.connect(this.getId('open'), 'onclick',this, 'openDirectLogin'); |
106 | MochiKit.Signal.connect(this.getId('edit'), 'onclick',this, 'editDirectLogin'); | 103 | MochiKit.Signal.connect(this.getId('edit'), 'onclick',this, 'editDirectLogin'); |
107 | MochiKit.Signal.connect(this.getId('delete'), 'onclick',this, 'deleteDirectLogin'); | 104 | MochiKit.Signal.connect(this.getId('delete'), 'onclick',this, 'deleteDirectLogin'); |
108 | }, | 105 | }, |
109 | 106 | ||
110 | //------------------------------------------------------------------------- | 107 | //------------------------------------------------------------------------- |
111 | 108 | ||
112 | 'shouldShowElementWhileRendering': function () { | 109 | 'shouldShowElementWhileRendering': function () { |
113 | return false; | 110 | return false; |
114 | }, | 111 | }, |
115 | 112 | ||
116 | //------------------------------------------------------------------------- | 113 | //------------------------------------------------------------------------- |
117 | 114 | ||
118 | 'faviconComponent': function () { | 115 | 'faviconComponent': function () { |
119 | if (this._faviconComponent == null) { | 116 | if (this._faviconComponent == null) { |
120 | //console.log("created the FAVICON component"); | ||
121 | this._faviconComponent = new Clipperz.PM.UI.Common.Components.FaviconComponent({element:this.getId('favicon')}); | 117 | this._faviconComponent = new Clipperz.PM.UI.Common.Components.FaviconComponent({element:this.getId('favicon')}); |
122 | } | 118 | } |
123 | 119 | ||
124 | return this._faviconComponent; | 120 | return this._faviconComponent; |
125 | }, | 121 | }, |
126 | 122 | ||
127 | //========================================================================= | 123 | //========================================================================= |
128 | 124 | ||
129 | 'label': function () { | 125 | 'label': function () { |
130 | return this.getElement('label').value; | 126 | return this.getElement('label').value; |
131 | }, | 127 | }, |
132 | 128 | ||
133 | 'setLabel': function (aValue) { | 129 | 'setLabel': function (aValue) { |
134 | this.getElement('label').value = Clipperz.Base.sanitizeString(aValue); | 130 | this.getElement('label').value = Clipperz.Base.sanitizeString(aValue); |
135 | }, | 131 | }, |
136 | 132 | ||
137 | //------------------------------------------------------------------------- | 133 | //------------------------------------------------------------------------- |
138 | 134 | ||
139 | 'favicon': function () { | 135 | 'favicon': function () { |
140 | // return this.getElement('favicon').src; | 136 | // return this.getElement('favicon').src; |
141 | return this.faviconComponent().src(); | 137 | return this.faviconComponent().src(); |
142 | }, | 138 | }, |
143 | 139 | ||
144 | 'setFavicon': function (aValue) { | 140 | 'setFavicon': function (aValue) { |
145 | // this.getElement('favicon').src = Clipperz.Base.sanitizeString(aValue); | 141 | // this.getElement('favicon').src = Clipperz.Base.sanitizeString(aValue); |
146 | this.faviconComponent().setSrc(Clipperz.Base.sanitizeString(aValue)); | 142 | this.faviconComponent().setSrc(Clipperz.Base.sanitizeString(aValue)); |
147 | }, | 143 | }, |
148 | 144 | ||
149 | //========================================================================= | 145 | //========================================================================= |
150 | 146 | ||
151 | 'openDirectLogin': function (anEvent) { | 147 | 'openDirectLogin': function (anEvent) { |
152 | anEvent.preventDefault(); | 148 | anEvent.preventDefault(); |
153 | 149 | ||
154 | MochiKit.Signal.signal(this, 'openDirectLogin', this.reference()); | 150 | MochiKit.Signal.signal(this, 'openDirectLogin', this.reference()); |
155 | }, | 151 | }, |
156 | 152 | ||
157 | //------------------------------------------------------------------------- | 153 | //------------------------------------------------------------------------- |
158 | 154 | ||
159 | 'editDirectLogin': function (anEvent) { | 155 | 'editDirectLogin': function (anEvent) { |
160 | anEvent.preventDefault(); | 156 | anEvent.preventDefault(); |
161 | 157 | ||
162 | MochiKit.Signal.signal(this, 'editDirectLogin', this.reference()); | 158 | MochiKit.Signal.signal(this, 'editDirectLogin', this.reference()); |
163 | //console.log("EDIT DIRECT LOGIN"); | ||
164 | }, | 159 | }, |
165 | 160 | ||
166 | //------------------------------------------------------------------------- | 161 | //------------------------------------------------------------------------- |
167 | 162 | ||
168 | 'deleteDirectLogin': function (anEvent) { | 163 | 'deleteDirectLogin': function (anEvent) { |
169 | anEvent.preventDefault(); | 164 | anEvent.preventDefault(); |
170 | 165 | ||
171 | MochiKit.Signal.signal(this, 'deleteDirectLogin', this.reference()); | 166 | MochiKit.Signal.signal(this, 'deleteDirectLogin', this.reference()); |
172 | //console.log("DELETE DIRECT LOGIN"); | ||
173 | }, | 167 | }, |
174 | 168 | ||
175 | 169 | ||
176 | 170 | ||
177 | //========================================================================= | 171 | //========================================================================= |
178 | __syntaxFix__: "syntax fix" | 172 | __syntaxFix__: "syntax fix" |
179 | }); | 173 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js index b58062c..689406a 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js | |||
@@ -1,187 +1,183 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._reference = args.reference|| Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._reference = args.reference|| Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._actionType = null; | 32 | this._actionType = null; |
35 | 33 | ||
36 | return this; | 34 | return this; |
37 | } | 35 | } |
38 | 36 | ||
39 | //============================================================================= | 37 | //============================================================================= |
40 | 38 | ||
41 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 39 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { |
42 | 40 | ||
43 | //------------------------------------------------------------------------- | 41 | //------------------------------------------------------------------------- |
44 | 42 | ||
45 | 'toString': function () { | 43 | 'toString': function () { |
46 | return "Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent component"; | 44 | return "Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent component"; |
47 | }, | 45 | }, |
48 | 46 | ||
49 | //------------------------------------------------------------------------- | 47 | //------------------------------------------------------------------------- |
50 | 48 | ||
51 | 'renderSelf': function() { | 49 | 'renderSelf': function() { |
52 | this.append(this.element(), [ | 50 | this.append(this.element(), [ |
53 | {tag:'td', cls:'fieldState'}, | 51 | {tag:'td', cls:'fieldState'}, |
54 | {tag:'td', cls:'fieldLabel', children:[ | 52 | {tag:'td', cls:'fieldLabel', children:[ |
55 | {tag:'input', cls:'label', id:this.getId('label')} | 53 | {tag:'input', cls:'label', id:this.getId('label')} |
56 | ]}, | 54 | ]}, |
57 | {tag:'td', cls:'fieldLock', children:[ | 55 | {tag:'td', cls:'fieldLock', children:[ |
58 | {tag:'div', cls:'unlocked', id:this.getId('isHidden')} | 56 | {tag:'div', cls:'unlocked', id:this.getId('isHidden')} |
59 | ]}, | 57 | ]}, |
60 | {tag:'td', cls:'fieldValue', children:[ | 58 | {tag:'td', cls:'fieldValue', children:[ |
61 | {tag:'div', cls:'unlocked', id:this.getId('valueWrapper'), children:[ | 59 | {tag:'div', cls:'unlocked', id:this.getId('valueWrapper'), children:[ |
62 | {tag:'input', type:'text', cls:'value', id:this.getId('value')} | 60 | {tag:'input', type:'text', cls:'value', id:this.getId('value')} |
63 | ]} | 61 | ]} |
64 | ]}, | 62 | ]}, |
65 | {tag:'td', cls:'fieldAction', children:[ | 63 | {tag:'td', cls:'fieldAction', children:[ |
66 | {tag:'a', href:'#', id:this.getId('actionLink'), html:' '} | 64 | {tag:'a', href:'#', id:this.getId('actionLink'), html:' '} |
67 | ]}, | 65 | ]}, |
68 | {tag:'td', cls:'fieldAddDelete', children:[ | 66 | {tag:'td', cls:'fieldAddDelete', children:[ |
69 | {tag:'div', cls:'delete', children:[ | 67 | {tag:'div', cls:'delete', children:[ |
70 | {tag:'span', children:[ | 68 | {tag:'span', children:[ |
71 | {tag:'a', href:'#', id:this.getId('delete'), html:"delete"} | 69 | {tag:'a', href:'#', id:this.getId('delete'), html:"delete"} |
72 | ]} | 70 | ]} |
73 | ]} | 71 | ]} |
74 | ]} | 72 | ]} |
75 | ]); | 73 | ]); |
76 | 74 | ||
77 | MochiKit.Signal.connect(this.getId('label'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | 75 | MochiKit.Signal.connect(this.getId('label'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); |
78 | MochiKit.Signal.connect(this.getId('isHidden'), 'onclick',this, 'toggleIsHidden'); | 76 | MochiKit.Signal.connect(this.getId('isHidden'), 'onclick',this, 'toggleIsHidden'); |
79 | MochiKit.Signal.connect(this.getId('value'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); | 77 | MochiKit.Signal.connect(this.getId('value'), 'onkeyup',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'changedValue')); |
80 | MochiKit.Signal.connect(this.getId('actionLink'), 'onclick',this, 'handleActionLink'); | 78 | MochiKit.Signal.connect(this.getId('actionLink'), 'onclick',this, 'handleActionLink'); |
81 | MochiKit.Signal.connect(this.getId('delete'), 'onclick',this, 'deleteField'); | 79 | MochiKit.Signal.connect(this.getId('delete'), 'onclick',this, 'deleteField'); |
82 | // MochiKit.Signal.connect(this.getId('delete'), 'onclick',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'deleteField', this.reference())); | 80 | // MochiKit.Signal.connect(this.getId('delete'), 'onclick',MochiKit.Base.partial(MochiKit.Signal.signal, this, 'deleteField', this.reference())); |
83 | }, | 81 | }, |
84 | 82 | ||
85 | //------------------------------------------------------------------------- | 83 | //------------------------------------------------------------------------- |
86 | 84 | ||
87 | 'shouldShowElementWhileRendering': function () { | 85 | 'shouldShowElementWhileRendering': function () { |
88 | return false; | 86 | return false; |
89 | }, | 87 | }, |
90 | 88 | ||
91 | //========================================================================= | 89 | //========================================================================= |
92 | 90 | ||
93 | 'reference': function () { | 91 | 'reference': function () { |
94 | return this._reference; | 92 | return this._reference; |
95 | }, | 93 | }, |
96 | 94 | ||
97 | //========================================================================= | 95 | //========================================================================= |
98 | 96 | ||
99 | 'label': function () { | 97 | 'label': function () { |
100 | return this.getElement('label').value; | 98 | return this.getElement('label').value; |
101 | }, | 99 | }, |
102 | 100 | ||
103 | 'setLabel': function (aValue) { | 101 | 'setLabel': function (aValue) { |
104 | // this.getElement('label').value = Clipperz.Base.sanitizeString(aValue); | 102 | // this.getElement('label').value = Clipperz.Base.sanitizeString(aValue); |
105 | this.getElement('label').value = aValue; | 103 | this.getElement('label').value = aValue; |
106 | }, | 104 | }, |
107 | 105 | ||
108 | //========================================================================= | 106 | //========================================================================= |
109 | 107 | ||
110 | 'value': function () { | 108 | 'value': function () { |
111 | return this.getElement('value').value; | 109 | return this.getElement('value').value; |
112 | }, | 110 | }, |
113 | 111 | ||
114 | 'setValue': function (aValue) { | 112 | 'setValue': function (aValue) { |
115 | // this.getElement('value').value = Clipperz.Base.sanitizeString(aValue); | 113 | // this.getElement('value').value = Clipperz.Base.sanitizeString(aValue); |
116 | this.getElement('value').value = aValue; | 114 | this.getElement('value').value = aValue; |
117 | }, | 115 | }, |
118 | 116 | ||
119 | //------------------------------------------------------------------------- | 117 | //------------------------------------------------------------------------- |
120 | 118 | ||
121 | 'actionType': function () { | 119 | 'actionType': function () { |
122 | return this._actionType; | 120 | return this._actionType; |
123 | }, | 121 | }, |
124 | 122 | ||
125 | 'setActionType': function (anActionType) { | 123 | 'setActionType': function (anActionType) { |
126 | this._actionType = anActionType; | 124 | this._actionType = anActionType; |
127 | 125 | ||
128 | switch (this._actionType) { | 126 | switch (this._actionType) { |
129 | case 'NONE': | 127 | case 'NONE': |
130 | MochiKit.Style.hideElement(this.getId('actionLink')); | 128 | MochiKit.Style.hideElement(this.getId('actionLink')); |
131 | MochiKit.DOM.setElementClass(this.getId('actionLink'), ''); | 129 | MochiKit.DOM.setElementClass(this.getId('actionLink'), ''); |
132 | break; | 130 | break; |
133 | case 'URL': | 131 | case 'URL': |
134 | MochiKit.Style.showElement(this.getId('actionLink')); | 132 | MochiKit.Style.showElement(this.getId('actionLink')); |
135 | MochiKit.DOM.setElementClass(this.getId('actionLink'), 'url'); | 133 | MochiKit.DOM.setElementClass(this.getId('actionLink'), 'url'); |
136 | break; | 134 | break; |
137 | case 'EMAIL': | 135 | case 'EMAIL': |
138 | MochiKit.Style.showElement(this.getId('actionLink')); | 136 | MochiKit.Style.showElement(this.getId('actionLink')); |
139 | MochiKit.DOM.setElementClass(this.getId('actionLink'), 'email'); | 137 | MochiKit.DOM.setElementClass(this.getId('actionLink'), 'email'); |
140 | break; | 138 | break; |
141 | case 'PASSWORD': | 139 | case 'PASSWORD': |
142 | MochiKit.Style.showElement(this.getId('actionLink')); | 140 | MochiKit.Style.showElement(this.getId('actionLink')); |
143 | MochiKit.DOM.setElementClass(this.getId('actionLink'), 'password'); | 141 | MochiKit.DOM.setElementClass(this.getId('actionLink'), 'password'); |
144 | break; | 142 | break; |
145 | } | 143 | } |
146 | }, | 144 | }, |
147 | 145 | ||
148 | //========================================================================= | 146 | //========================================================================= |
149 | 147 | ||
150 | 'isHidden': function () { | 148 | 'isHidden': function () { |
151 | // return this.getElement('value').value; | 149 | // return this.getElement('value').value; |
152 | return MochiKit.DOM.hasElementClass(this.getElement('isHidden'), 'locked'); | 150 | return MochiKit.DOM.hasElementClass(this.getElement('isHidden'), 'locked'); |
153 | }, | 151 | }, |
154 | 152 | ||
155 | 'setIsHidden': function (aValue) { | 153 | 'setIsHidden': function (aValue) { |
156 | // this.getElement('value').value = Clipperz.Base.sanitizeString(aValue); | 154 | // this.getElement('value').value = Clipperz.Base.sanitizeString(aValue); |
157 | MochiKit.DOM.setElementClass(this.getElement('isHidden'), (aValue ? 'locked': 'unlocked')); | 155 | MochiKit.DOM.setElementClass(this.getElement('isHidden'), (aValue ? 'locked': 'unlocked')); |
158 | MochiKit.DOM.setElementClass(this.getElement('valueWrapper'), (aValue ? 'locked': 'unlocked')); | 156 | MochiKit.DOM.setElementClass(this.getElement('valueWrapper'), (aValue ? 'locked': 'unlocked')); |
159 | }, | 157 | }, |
160 | 158 | ||
161 | 'toggleIsHidden': function (anEvent) { | 159 | 'toggleIsHidden': function (anEvent) { |
162 | anEvent.preventDefault(); | 160 | anEvent.preventDefault(); |
163 | 161 | ||
164 | this.setIsHidden(! this.isHidden()); | 162 | this.setIsHidden(! this.isHidden()); |
165 | MochiKit.Signal.signal(this, 'changedValue'); | 163 | MochiKit.Signal.signal(this, 'changedValue'); |
166 | }, | 164 | }, |
167 | 165 | ||
168 | //========================================================================= | 166 | //========================================================================= |
169 | 167 | ||
170 | 'handleActionLink': function (anEvent) { | 168 | 'handleActionLink': function (anEvent) { |
171 | anEvent.preventDefault(); | 169 | anEvent.preventDefault(); |
172 | |||
173 | //console.log("ACTION LINK - " + this.actionType()); | ||
174 | MochiKit.Signal.signal(this, 'performAction', this.reference(), anEvent.target()); | 170 | MochiKit.Signal.signal(this, 'performAction', this.reference(), anEvent.target()); |
175 | }, | 171 | }, |
176 | 172 | ||
177 | //========================================================================= | 173 | //========================================================================= |
178 | 174 | ||
179 | 'deleteField': function (anEvent) { | 175 | 'deleteField': function (anEvent) { |
180 | anEvent.preventDefault(); | 176 | anEvent.preventDefault(); |
181 | 177 | ||
182 | MochiKit.Signal.signal(this, 'deleteField', this.reference()); | 178 | MochiKit.Signal.signal(this, 'deleteField', this.reference()); |
183 | }, | 179 | }, |
184 | 180 | ||
185 | //========================================================================= | 181 | //========================================================================= |
186 | __syntaxFix__: "syntax fix" | 182 | __syntaxFix__: "syntax fix" |
187 | }); | 183 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js index 391c379..41e32a0 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js | |||
@@ -1,200 +1,198 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.ColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.ColumnManager = function(args) { |
31 | args = args || {}; | 29 | args = args || {}; |
32 | Clipperz.PM.UI.Web.Components.ColumnManager.superclass.constructor.call(this, args); | 30 | Clipperz.PM.UI.Web.Components.ColumnManager.superclass.constructor.call(this, args); |
33 | 31 | ||
34 | this._name = args.name || Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | this._name = args.name || Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | this._selector = args.selector|| Clipperz.Base.exception.raise('MandatoryParameter');; | 33 | this._selector = args.selector|| Clipperz.Base.exception.raise('MandatoryParameter');; |
36 | this._label = args.label || null; | 34 | this._label = args.label || null; |
37 | this._isSortable = args.sortable|| false; | 35 | this._isSortable = args.sortable|| false; |
38 | this._comparator = args.comparator|| null; | 36 | this._comparator = args.comparator|| null; |
39 | this._sorted = args.sorted || 'UNSORTED'; //'ASCENDING' | 'DESCENDING' | 'UNSORTED' | 37 | this._sorted = args.sorted || 'UNSORTED'; //'ASCENDING' | 'DESCENDING' | 'UNSORTED' |
40 | this._cssClass = args.cssClass|| ''; | 38 | this._cssClass = args.cssClass|| ''; |
41 | 39 | ||
42 | this._signalIdentifiers = []; | 40 | this._signalIdentifiers = []; |
43 | 41 | ||
44 | return this; | 42 | return this; |
45 | } | 43 | } |
46 | 44 | ||
47 | //============================================================================= | 45 | //============================================================================= |
48 | 46 | ||
49 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.ColumnManager, Clipperz.PM.UI.Common.Components.BaseComponent, { | 47 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.ColumnManager, Clipperz.PM.UI.Common.Components.BaseComponent, { |
50 | 48 | ||
51 | 'toString': function () { | 49 | 'toString': function () { |
52 | return "Clipperz.PM.UI.Web.Components.ColumnManager - " + this._name; | 50 | return "Clipperz.PM.UI.Web.Components.ColumnManager - " + this._name; |
53 | }, | 51 | }, |
54 | 52 | ||
55 | 'name': function () { | 53 | 'name': function () { |
56 | return this._name; | 54 | return this._name; |
57 | }, | 55 | }, |
58 | 56 | ||
59 | 'label': function () { | 57 | 'label': function () { |
60 | return this._label; | 58 | return this._label; |
61 | }, | 59 | }, |
62 | 60 | ||
63 | 'selector': function () { | 61 | 'selector': function () { |
64 | return this._selector; | 62 | return this._selector; |
65 | }, | 63 | }, |
66 | 64 | ||
67 | 'comparator': function() { | 65 | 'comparator': function() { |
68 | return this._comparator; | 66 | return this._comparator; |
69 | }, | 67 | }, |
70 | 68 | ||
71 | 'cssClass': function() { | 69 | 'cssClass': function() { |
72 | return this._cssClass; | 70 | return this._cssClass; |
73 | }, | 71 | }, |
74 | 72 | ||
75 | //------------------------------------------------------------------------- | 73 | //------------------------------------------------------------------------- |
76 | 74 | ||
77 | 'isSortable': function () { | 75 | 'isSortable': function () { |
78 | return this._isSortable; | 76 | return this._isSortable; |
79 | }, | 77 | }, |
80 | 78 | ||
81 | //------------------------------------------------------------------------- | 79 | //------------------------------------------------------------------------- |
82 | 80 | ||
83 | 'sorted': function () { | 81 | 'sorted': function () { |
84 | return this._sorted; | 82 | return this._sorted; |
85 | }, | 83 | }, |
86 | 84 | ||
87 | 'isSorted': function () { | 85 | 'isSorted': function () { |
88 | return (this.sorted() != 'UNSORTED'); | 86 | return (this.sorted() != 'UNSORTED'); |
89 | }, | 87 | }, |
90 | 88 | ||
91 | 'setSorted': function(aValue) { | 89 | 'setSorted': function(aValue) { |
92 | this._sorted = aValue; | 90 | this._sorted = aValue; |
93 | this.updateSortIcon(); | 91 | this.updateSortIcon(); |
94 | }, | 92 | }, |
95 | 93 | ||
96 | //------------------------------------------------------------------------- | 94 | //------------------------------------------------------------------------- |
97 | 95 | ||
98 | 'signalIdentifiers': function () { | 96 | 'signalIdentifiers': function () { |
99 | return this._signalIdentifiers; | 97 | return this._signalIdentifiers; |
100 | }, | 98 | }, |
101 | 99 | ||
102 | 'resetSignalIdentifiers': function () { | 100 | 'resetSignalIdentifiers': function () { |
103 | this._signalIdentifiers = []; | 101 | this._signalIdentifiers = []; |
104 | }, | 102 | }, |
105 | 103 | ||
106 | //------------------------------------------------------------------------- | 104 | //------------------------------------------------------------------------- |
107 | 105 | ||
108 | 'disconnectRowsSignals': function () { | 106 | 'disconnectRowsSignals': function () { |
109 | MochiKit.Base.map(MochiKit.Signal.disconnect, this.signalIdentifiers()); | 107 | MochiKit.Base.map(MochiKit.Signal.disconnect, this.signalIdentifiers()); |
110 | this.resetSignalIdentifiers(); | 108 | this.resetSignalIdentifiers(); |
111 | }, | 109 | }, |
112 | 110 | ||
113 | 'connectEvent': function () { | 111 | 'connectEvent': function () { |
114 | var ident; | 112 | var ident; |
115 | 113 | ||
116 | ident = MochiKit.Signal.connect.apply(null, arguments); | 114 | ident = MochiKit.Signal.connect.apply(null, arguments); |
117 | this.signalIdentifiers().push(ident); | 115 | this.signalIdentifiers().push(ident); |
118 | }, | 116 | }, |
119 | 117 | ||
120 | //------------------------------------------------------------------------- | 118 | //------------------------------------------------------------------------- |
121 | 119 | ||
122 | 'renderHeader': function(aTRElement) { | 120 | 'renderHeader': function(aTRElement) { |
123 | varthElement; | 121 | varthElement; |
124 | 122 | ||
125 | thElement = Clipperz.DOM.Helper.append(aTRElement, {tag:'th', cls:(this.cssClass() + 'TH'), id:this.getId('sortLink'), children:[ | 123 | thElement = Clipperz.DOM.Helper.append(aTRElement, {tag:'th', cls:(this.cssClass() + 'TH'), id:this.getId('sortLink'), children:[ |
126 | {tag:'span', html:this.label() ? this.label() : ' '} | 124 | {tag:'span', html:this.label() ? this.label() : ' '} |
127 | ]}); | 125 | ]}); |
128 | 126 | ||
129 | if (this.isSortable()) { | 127 | if (this.isSortable()) { |
130 | Clipperz.DOM.Helper.append(thElement, {tag:'span', cls:'sortable', children:[ | 128 | Clipperz.DOM.Helper.append(thElement, {tag:'span', cls:'sortable', children:[ |
131 | {tag:'a', href:'#'/*, id:this.getId('sortLink')*/, html:' '} | 129 | {tag:'a', href:'#'/*, id:this.getId('sortLink')*/, html:' '} |
132 | ]}); | 130 | ]}); |
133 | 131 | ||
134 | MochiKit.DOM.addElementClass(thElement, 'sortable'); | 132 | MochiKit.DOM.addElementClass(thElement, 'sortable'); |
135 | MochiKit.Signal.connect(thElement, 'onclick', this, 'handleClickOnSortingCriteria'); | 133 | MochiKit.Signal.connect(thElement, 'onclick', this, 'handleClickOnSortingCriteria'); |
136 | }; | 134 | }; |
137 | 135 | ||
138 | this.updateSortIcon(); | 136 | this.updateSortIcon(); |
139 | }, | 137 | }, |
140 | 138 | ||
141 | //------------------------------------------------------------------------- | 139 | //------------------------------------------------------------------------- |
142 | 140 | ||
143 | 'toggleSorting': function () { | 141 | 'toggleSorting': function () { |
144 | var result; | 142 | var result; |
145 | switch (this.sorted()) { | 143 | switch (this.sorted()) { |
146 | case 'UNSORTED': | 144 | case 'UNSORTED': |
147 | result = 'ASCENDING'; | 145 | result = 'ASCENDING'; |
148 | break; | 146 | break; |
149 | case 'ASCENDING': | 147 | case 'ASCENDING': |
150 | result = 'DESCENDING'; | 148 | result = 'DESCENDING'; |
151 | break; | 149 | break; |
152 | case 'DESCENDING': | 150 | case 'DESCENDING': |
153 | result = 'ASCENDING'; | 151 | result = 'ASCENDING'; |
154 | break; | 152 | break; |
155 | default: | 153 | default: |
156 | result = 'UNSORTED'; | 154 | result = 'UNSORTED'; |
157 | break; | 155 | break; |
158 | } | 156 | } |
159 | 157 | ||
160 | this.setSorted(result); | 158 | this.setSorted(result); |
161 | 159 | ||
162 | return result; | 160 | return result; |
163 | }, | 161 | }, |
164 | 162 | ||
165 | //------------------------------------------------------------------------- | 163 | //------------------------------------------------------------------------- |
166 | 164 | ||
167 | 'sortElementClass': function () { | 165 | 'sortElementClass': function () { |
168 | return this.sorted().toLowerCase(); | 166 | return this.sorted().toLowerCase(); |
169 | }, | 167 | }, |
170 | 168 | ||
171 | //------------------------------------------------------------------------- | 169 | //------------------------------------------------------------------------- |
172 | 170 | ||
173 | 'updateSortIcon': function () { | 171 | 'updateSortIcon': function () { |
174 | if (this.isSortable()) { | 172 | if (this.isSortable()) { |
175 | MochiKit.DOM.removeElementClass(this.getId('sortLink'), 'ascending'); | 173 | MochiKit.DOM.removeElementClass(this.getId('sortLink'), 'ascending'); |
176 | MochiKit.DOM.removeElementClass(this.getId('sortLink'), 'descending'); | 174 | MochiKit.DOM.removeElementClass(this.getId('sortLink'), 'descending'); |
177 | MochiKit.DOM.removeElementClass(this.getId('sortLink'), 'unsorted'); | 175 | MochiKit.DOM.removeElementClass(this.getId('sortLink'), 'unsorted'); |
178 | 176 | ||
179 | MochiKit.DOM.addElementClass(this.getId('sortLink'), this.sortElementClass()); | 177 | MochiKit.DOM.addElementClass(this.getId('sortLink'), this.sortElementClass()); |
180 | } | 178 | } |
181 | }, | 179 | }, |
182 | 180 | ||
183 | //------------------------------------------------------------------------- | 181 | //------------------------------------------------------------------------- |
184 | 182 | ||
185 | 'renderCell': function(aRowElement, anObject) { | 183 | 'renderCell': function(aRowElement, anObject) { |
186 | Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[{tag:'span', html:anObject[this.name()]}]}); | 184 | Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[{tag:'span', html:anObject[this.name()]}]}); |
187 | }, | 185 | }, |
188 | 186 | ||
189 | //----------------------------------------------------- | 187 | //----------------------------------------------------- |
190 | 188 | ||
191 | 'handleClickOnSortingCriteria': function (anEvent) { | 189 | 'handleClickOnSortingCriteria': function (anEvent) { |
192 | anEvent.preventDefault(); | 190 | anEvent.preventDefault(); |
193 | MochiKit.Signal.signal(this, 'sort', this); | 191 | MochiKit.Signal.signal(this, 'sort', this); |
194 | }, | 192 | }, |
195 | 193 | ||
196 | //----------------------------------------------------- | 194 | //----------------------------------------------------- |
197 | '__syntax_fix__' : 'syntax fix' | 195 | '__syntax_fix__' : 'syntax fix' |
198 | 196 | ||
199 | }); | 197 | }); |
200 | 198 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CreateNewCardSplashComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CreateNewCardSplashComponent.js index d3aa175..3d0ba76 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CreateNewCardSplashComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CreateNewCardSplashComponent.js | |||
@@ -1,68 +1,66 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | return this; | 31 | return this; |
34 | } | 32 | } |
35 | 33 | ||
36 | //============================================================================= | 34 | //============================================================================= |
37 | 35 | ||
38 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 36 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { |
39 | 37 | ||
40 | //------------------------------------------------------------------------- | 38 | //------------------------------------------------------------------------- |
41 | 39 | ||
42 | 'toString': function () { | 40 | 'toString': function () { |
43 | return "Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent component"; | 41 | return "Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent component"; |
44 | }, | 42 | }, |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
47 | 45 | ||
48 | 'renderSelf': function() { | 46 | 'renderSelf': function() { |
49 | this.append(this.element(), [ | 47 | this.append(this.element(), [ |
50 | {tag:'div', cls:'createNewCardSplash', id:this.getId('button'), children:[ | 48 | {tag:'div', cls:'createNewCardSplash', id:this.getId('button'), children:[ |
51 | {tag:'span', html:"Create New Card"} | 49 | {tag:'span', html:"Create New Card"} |
52 | ]} | 50 | ]} |
53 | ]); | 51 | ]); |
54 | 52 | ||
55 | MochiKit.Signal.connect(this.getElement('button'), 'onclick', this, 'handleClick'); | 53 | MochiKit.Signal.connect(this.getElement('button'), 'onclick', this, 'handleClick'); |
56 | }, | 54 | }, |
57 | 55 | ||
58 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
59 | 57 | ||
60 | 'handleClick': function (anEvent) { | 58 | 'handleClick': function (anEvent) { |
61 | anEvent.preventDefault(); | 59 | anEvent.preventDefault(); |
62 | MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'addCard', this.element()); | 60 | MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'addCard', this.element()); |
63 | }, | 61 | }, |
64 | 62 | ||
65 | //------------------------------------------------------------------------- | 63 | //------------------------------------------------------------------------- |
66 | 64 | ||
67 | __syntaxFix__: "syntax fix" | 65 | __syntaxFix__: "syntax fix" |
68 | }); | 66 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js index 462d864..23f6710 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js | |||
@@ -1,116 +1,114 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.DataPanel = function(args) { | 26 | Clipperz.PM.UI.Web.Components.DataPanel = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.DataPanel.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.DataPanel.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._initiallySelectedTab = args.selected || 'OFFLINE_COPY'; | 31 | this._initiallySelectedTab = args.selected || 'OFFLINE_COPY'; |
34 | this._tabPanelControllerConfiguration = { | 32 | this._tabPanelControllerConfiguration = { |
35 | 'OFFLINE_COPY': { | 33 | 'OFFLINE_COPY': { |
36 | tab:'offlineCopyTab', | 34 | tab:'offlineCopyTab', |
37 | panel:'offlineCopyPanel' | 35 | panel:'offlineCopyPanel' |
38 | }, | 36 | }, |
39 | 'SHARING': { | 37 | 'SHARING': { |
40 | tab:'sharingTab', | 38 | tab:'sharingTab', |
41 | panel:'sharingPanel' | 39 | panel:'sharingPanel' |
42 | }, | 40 | }, |
43 | 'IMPORT': { | 41 | 'IMPORT': { |
44 | tab:'importTab', | 42 | tab:'importTab', |
45 | panel:'importPanel' | 43 | panel:'importPanel' |
46 | }, | 44 | }, |
47 | 'EXPORT': { | 45 | 'EXPORT': { |
48 | tab:'exportTab', | 46 | tab:'exportTab', |
49 | panel:'exportPanel' | 47 | panel:'exportPanel' |
50 | } | 48 | } |
51 | }; | 49 | }; |
52 | 50 | ||
53 | return this; | 51 | return this; |
54 | } | 52 | } |
55 | 53 | ||
56 | //============================================================================= | 54 | //============================================================================= |
57 | 55 | ||
58 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DataPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, { | 56 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DataPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, { |
59 | 57 | ||
60 | //------------------------------------------------------------------------- | 58 | //------------------------------------------------------------------------- |
61 | 59 | ||
62 | 'toString': function () { | 60 | 'toString': function () { |
63 | return "Clipperz.PM.UI.Web.Components.DataPanel component"; | 61 | return "Clipperz.PM.UI.Web.Components.DataPanel component"; |
64 | }, | 62 | }, |
65 | 63 | ||
66 | //------------------------------------------------------------------------- | 64 | //------------------------------------------------------------------------- |
67 | 65 | ||
68 | 'renderSelf': function(/*aContainer, aPosition*/) { | 66 | 'renderSelf': function(/*aContainer, aPosition*/) { |
69 | this.append(this.element(), [ | 67 | this.append(this.element(), [ |
70 | {tag:'div', cls:'header', children:[ | 68 | {tag:'div', cls:'header', children:[ |
71 | {tag:'div', cls:'subPanelTabs', children:[ | 69 | {tag:'div', cls:'subPanelTabs', children:[ |
72 | {tag:'ul', children:[ | 70 | {tag:'ul', children:[ |
73 | {tag:'li', id:this.getId('offlineCopyTab'),children:[{tag:'a', href:'#', html:'Offline copy'}], cls:'first'}, | 71 | {tag:'li', id:this.getId('offlineCopyTab'),children:[{tag:'a', href:'#', html:'Offline copy'}], cls:'first'}, |
74 | {tag:'li', id:this.getId('sharingTab'), children:[{tag:'a', href:'#', html:'Sharing'}]}, | 72 | {tag:'li', id:this.getId('sharingTab'), children:[{tag:'a', href:'#', html:'Sharing'}]}, |
75 | {tag:'li', id:this.getId('importTab'), children:[{tag:'a', href:'#', html:'Import'}]}, | 73 | {tag:'li', id:this.getId('importTab'), children:[{tag:'a', href:'#', html:'Import'}]}, |
76 | {tag:'li', id:this.getId('exportTab'), children:[{tag:'a', href:'#', html:'Export'}]} | 74 | {tag:'li', id:this.getId('exportTab'), children:[{tag:'a', href:'#', html:'Export'}]} |
77 | ]} | 75 | ]} |
78 | ]} | 76 | ]} |
79 | ]}, | 77 | ]}, |
80 | {tag:'div', cls:'body', children:[ | 78 | {tag:'div', cls:'body', children:[ |
81 | {tag:'div', cls:'accountPanel', children:[ | 79 | {tag:'div', cls:'accountPanel', children:[ |
82 | {tag:'div', cls:'subPanelContent', children:[ | 80 | {tag:'div', cls:'subPanelContent', children:[ |
83 | {tag:'ul', children:[ | 81 | {tag:'ul', children:[ |
84 | {tag:'li', id:this.getId('offlineCopyPanel'),children:[ | 82 | {tag:'li', id:this.getId('offlineCopyPanel'),children:[ |
85 | // {tag:'h3', html:"Offline copy"}, | 83 | // {tag:'h3', html:"Offline copy"}, |
86 | {tag:'p', html:"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."}, | 84 | {tag:'p', html:"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."}, |
87 | {tag:'a', id:this.getId('offlineCopyDownloadLink'), href:'#', html:"Download", cls:'downloadOfflineCopy'} | 85 | {tag:'a', id:this.getId('offlineCopyDownloadLink'), href:'#', html:"Download", cls:'downloadOfflineCopy'} |
88 | ]}, | 86 | ]}, |
89 | {tag:'li', id:this.getId('sharingPanel'),children:[ | 87 | {tag:'li', id:this.getId('sharingPanel'),children:[ |
90 | // {tag:'h3', html:"Sharing"} | 88 | // {tag:'h3', html:"Sharing"} |
91 | ]}, | 89 | ]}, |
92 | {tag:'li', id:this.getId('importPanel'), children:[ | 90 | {tag:'li', id:this.getId('importPanel'), children:[ |
93 | // {tag:'h3', html:"Import"} | 91 | // {tag:'h3', html:"Import"} |
94 | ]}, | 92 | ]}, |
95 | {tag:'li', id:this.getId('exportPanel'), children:[ | 93 | {tag:'li', id:this.getId('exportPanel'), children:[ |
96 | // {tag:'h3', html:"Export"} | 94 | // {tag:'h3', html:"Export"} |
97 | ]} | 95 | ]} |
98 | ]} | 96 | ]} |
99 | ]} | 97 | ]} |
100 | ]} | 98 | ]} |
101 | ]}, | 99 | ]}, |
102 | {tag:'div', cls:'footer'} | 100 | {tag:'div', cls:'footer'} |
103 | ]); | 101 | ]); |
104 | 102 | ||
105 | this.tabPanelController().setup({selected:this.initiallySelectedTab()}); | 103 | this.tabPanelController().setup({selected:this.initiallySelectedTab()}); |
106 | MochiKit.Signal.connect(this.getId('offlineCopyDownloadLink'), 'onclick', this, 'downloadOfflineCopy'); | 104 | MochiKit.Signal.connect(this.getId('offlineCopyDownloadLink'), 'onclick', this, 'downloadOfflineCopy'); |
107 | }, | 105 | }, |
108 | 106 | ||
109 | 'downloadOfflineCopy': function (anEvent) { | 107 | 'downloadOfflineCopy': function (anEvent) { |
110 | anEvent.preventDefault(); | 108 | anEvent.preventDefault(); |
111 | MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'downloadOfflineCopy', anEvent.src()); | 109 | MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'downloadOfflineCopy', anEvent.src()); |
112 | }, | 110 | }, |
113 | 111 | ||
114 | //------------------------------------------------------------------------- | 112 | //------------------------------------------------------------------------- |
115 | __syntaxFix__: "syntax fix" | 113 | __syntaxFix__: "syntax fix" |
116 | }); | 114 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DateColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DateColumnManager.js index ea55ba4..b305045 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DateColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DateColumnManager.js | |||
@@ -1,69 +1,67 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.DateColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.DateColumnManager = function(args) { |
31 | args = args || {}; | 29 | args = args || {}; |
32 | Clipperz.PM.UI.Web.Components.DateColumnManager.superclass.constructor.call(this, args); | 30 | Clipperz.PM.UI.Web.Components.DateColumnManager.superclass.constructor.call(this, args); |
33 | 31 | ||
34 | this._format = args.format|| Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | this._format = args.format|| Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | 33 | ||
36 | return this; | 34 | return this; |
37 | } | 35 | } |
38 | 36 | ||
39 | //============================================================================= | 37 | //============================================================================= |
40 | 38 | ||
41 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DateColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { | 39 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DateColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { |
42 | 40 | ||
43 | 'toString': function () { | 41 | 'toString': function () { |
44 | return "Clipperz.PM.UI.Web.Components.DateColumnManager component"; | 42 | return "Clipperz.PM.UI.Web.Components.DateColumnManager component"; |
45 | }, | 43 | }, |
46 | 44 | ||
47 | //------------------------------------------------------------------------- | 45 | //------------------------------------------------------------------------- |
48 | 46 | ||
49 | 'format': function () { | 47 | 'format': function () { |
50 | return this._format; | 48 | return this._format; |
51 | }, | 49 | }, |
52 | 50 | ||
53 | //------------------------------------------------------------------------- | 51 | //------------------------------------------------------------------------- |
54 | 52 | ||
55 | 'renderCell': function(aRowElement, anObject) { | 53 | 'renderCell': function(aRowElement, anObject) { |
56 | Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ | 54 | Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ |
57 | { | 55 | { |
58 | tag:'span', | 56 | tag:'span', |
59 | title:Clipperz.PM.Date.formatDateWithTemplate(anObject[this.name()], "D, d M Y H:i:s"), | 57 | title:Clipperz.PM.Date.formatDateWithTemplate(anObject[this.name()], "D, d M Y H:i:s"), |
60 | html:Clipperz.PM.Date.formatDateWithTemplate(anObject[this.name()], this.format()) | 58 | html:Clipperz.PM.Date.formatDateWithTemplate(anObject[this.name()], this.format()) |
61 | } | 59 | } |
62 | ]}); | 60 | ]}); |
63 | }, | 61 | }, |
64 | 62 | ||
65 | //----------------------------------------------------- | 63 | //----------------------------------------------------- |
66 | 64 | ||
67 | '__syntax_fix__' : 'syntax fix' | 65 | '__syntax_fix__' : 'syntax fix' |
68 | }); | 66 | }); |
69 | 67 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DeleteObjectColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DeleteObjectColumnManager.js index fe59494..6efe4c6 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DeleteObjectColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DeleteObjectColumnManager.js | |||
@@ -1,67 +1,65 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager = function(args) { |
31 | args = args || {}; | 29 | args = args || {}; |
32 | Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager.superclass.constructor.call(this, args); | 30 | Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager.superclass.constructor.call(this, args); |
33 | 31 | ||
34 | return this; | 32 | return this; |
35 | } | 33 | } |
36 | 34 | ||
37 | //============================================================================= | 35 | //============================================================================= |
38 | 36 | ||
39 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager, Clipperz.PM.UI.Web.Components.LinkColumnManager, { | 37 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager, Clipperz.PM.UI.Web.Components.LinkColumnManager, { |
40 | 38 | ||
41 | 'toString': function () { | 39 | 'toString': function () { |
42 | return "Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager component"; | 40 | return "Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager component"; |
43 | }, | 41 | }, |
44 | 42 | ||
45 | //------------------------------------------------------------------------- | 43 | //------------------------------------------------------------------------- |
46 | 44 | ||
47 | 'renderCell': function(aRowElement, anObject) { | 45 | 'renderCell': function(aRowElement, anObject) { |
48 | var tdElement; | 46 | var tdElement; |
49 | var linkElement; | 47 | var linkElement; |
50 | 48 | ||
51 | tdElement = Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ | 49 | tdElement = Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ |
52 | {tag:'div', cls:'delete', children:[ | 50 | {tag:'div', cls:'delete', children:[ |
53 | {tag:'span', children:[ | 51 | {tag:'span', children:[ |
54 | {tag:'a', href:'delete', html:"delete"} | 52 | {tag:'a', href:'delete', html:"delete"} |
55 | ]} | 53 | ]} |
56 | ]} | 54 | ]} |
57 | ]}); | 55 | ]}); |
58 | 56 | ||
59 | linkElement = MochiKit.DOM.getFirstElementByTagAndClassName('a', null, tdElement); | 57 | linkElement = MochiKit.DOM.getFirstElementByTagAndClassName('a', null, tdElement); |
60 | // MochiKit.Signal.connect(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); | 58 | // MochiKit.Signal.connect(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); |
61 | this.connectEvent(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); | 59 | this.connectEvent(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); |
62 | }, | 60 | }, |
63 | 61 | ||
64 | //----------------------------------------------------- | 62 | //----------------------------------------------------- |
65 | '__syntax_fix__' : 'syntax fix' | 63 | '__syntax_fix__' : 'syntax fix' |
66 | }); | 64 | }); |
67 | 65 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginColumnManager.js index a1f0f9f..2dad703 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginColumnManager.js | |||
@@ -1,87 +1,85 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | /* | 24 | /* |
27 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 25 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
28 | 26 | ||
29 | //############################################################################# | 27 | //############################################################################# |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.DirectLoginColumnManager = function(args) { | 29 | Clipperz.PM.UI.Web.Components.DirectLoginColumnManager = function(args) { |
32 | args = args || {}; | 30 | args = args || {}; |
33 | Clipperz.PM.UI.Web.Components.DirectLoginColumnManager.superclass.constructor.call(this, args); | 31 | Clipperz.PM.UI.Web.Components.DirectLoginColumnManager.superclass.constructor.call(this, args); |
34 | 32 | ||
35 | this._actionMethod = args.actionMethod || null; | 33 | this._actionMethod = args.actionMethod || null; |
36 | 34 | ||
37 | return this; | 35 | return this; |
38 | } | 36 | } |
39 | 37 | ||
40 | //============================================================================= | 38 | //============================================================================= |
41 | 39 | ||
42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { | 40 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { |
43 | 41 | ||
44 | 'toString': function () { | 42 | 'toString': function () { |
45 | return "Clipperz.PM.UI.Web.Components.DateColumnManager component"; | 43 | return "Clipperz.PM.UI.Web.Components.DateColumnManager component"; |
46 | }, | 44 | }, |
47 | 45 | ||
48 | //------------------------------------------------------------------------- | 46 | //------------------------------------------------------------------------- |
49 | 47 | ||
50 | 'actionMethod': function () { | 48 | 'actionMethod': function () { |
51 | return this._actionMethod; | 49 | return this._actionMethod; |
52 | }, | 50 | }, |
53 | 51 | ||
54 | //------------------------------------------------------------------------- | 52 | //------------------------------------------------------------------------- |
55 | 53 | ||
56 | 'renderCell': function(aRowElement, anObject) { | 54 | 'renderCell': function(aRowElement, anObject) { |
57 | vartdElement; | 55 | vartdElement; |
58 | varlinkElement; | 56 | varlinkElement; |
59 | 57 | ||
60 | tdElement = Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ | 58 | tdElement = Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ |
61 | {tag:'div', cls:'directLogin_directLogin', children:[ | 59 | {tag:'div', cls:'directLogin_directLogin', children:[ |
62 | {tag:'div', cls:'directLogin_directLogin_body', children:[ | 60 | {tag:'div', cls:'directLogin_directLogin_body', children:[ |
63 | {tag:'a', href:'#', html:anObject[this.name()]} | 61 | {tag:'a', href:'#', html:anObject[this.name()]} |
64 | ]} | 62 | ]} |
65 | ]} | 63 | ]} |
66 | ]}); | 64 | ]}); |
67 | 65 | ||
68 | linkElement = MochiKit.DOM.getFirstElementByTagAndClassName('a', null, tdElement); | 66 | linkElement = MochiKit.DOM.getFirstElementByTagAndClassName('a', null, tdElement); |
69 | // MochiKit.Signal.connect(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); | 67 | // MochiKit.Signal.connect(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); |
70 | this.connectEvent(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); | 68 | this.connectEvent(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); |
71 | }, | 69 | }, |
72 | 70 | ||
73 | //----------------------------------------------------- | 71 | //----------------------------------------------------- |
74 | 72 | ||
75 | 'handleLinkClick': function (anObject, anEvent) { | 73 | 'handleLinkClick': function (anObject, anEvent) { |
76 | anEvent.preventDefault(); | 74 | anEvent.preventDefault(); |
77 | 75 | ||
78 | if (this.actionMethod() != null) { | 76 | if (this.actionMethod() != null) { |
79 | this.actionMethod()(anObject, anEvent); | 77 | this.actionMethod()(anObject, anEvent); |
80 | } | 78 | } |
81 | }, | 79 | }, |
82 | 80 | ||
83 | //----------------------------------------------------- | 81 | //----------------------------------------------------- |
84 | '__syntax_fix__' : 'syntax fix' | 82 | '__syntax_fix__' : 'syntax fix' |
85 | }); | 83 | }); |
86 | 84 | ||
87 | */ \ No newline at end of file | 85 | */ \ 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 index 1a76b0c..f5f99d4 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingBindingComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingBindingComponent.js | |||
@@ -1,165 +1,163 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._formFieldName = args.formFieldName|| Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._formFieldName = args.formFieldName|| Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._fields = args.fields || Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | this._fields = args.fields || Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | this._initiallySelectedFieldKey = args.selectedFieldKey|| null; | 33 | this._initiallySelectedFieldKey = args.selectedFieldKey|| null; |
36 | 34 | ||
37 | return this; | 35 | return this; |
38 | } | 36 | } |
39 | 37 | ||
40 | //============================================================================= | 38 | //============================================================================= |
41 | 39 | ||
42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 40 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { |
43 | 41 | ||
44 | //------------------------------------------------------------------------- | 42 | //------------------------------------------------------------------------- |
45 | 43 | ||
46 | 'toString': function () { | 44 | 'toString': function () { |
47 | return "Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent component"; | 45 | return "Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent component"; |
48 | }, | 46 | }, |
49 | 47 | ||
50 | //------------------------------------------------------------------------- | 48 | //------------------------------------------------------------------------- |
51 | 49 | ||
52 | 'formFieldName': function () { | 50 | 'formFieldName': function () { |
53 | return this._formFieldName; | 51 | return this._formFieldName; |
54 | }, | 52 | }, |
55 | 53 | ||
56 | //------------------------------------------------------------------------- | 54 | //------------------------------------------------------------------------- |
57 | 55 | ||
58 | 'fields': function () { | 56 | 'fields': function () { |
59 | return this._fields; | 57 | return this._fields; |
60 | }, | 58 | }, |
61 | 59 | ||
62 | //------------------------------------------------------------------------- | 60 | //------------------------------------------------------------------------- |
63 | 61 | ||
64 | 'selectedValue': function () { | 62 | 'selectedValue': function () { |
65 | var result; | 63 | var result; |
66 | 64 | ||
67 | result = this.getElement('select').value; | 65 | result = this.getElement('select').value; |
68 | 66 | ||
69 | if (result == '---') { | 67 | if (result == '---') { |
70 | result = null; | 68 | result = null; |
71 | } | 69 | } |
72 | 70 | ||
73 | return result; | 71 | return result; |
74 | }, | 72 | }, |
75 | 73 | ||
76 | 'initiallySelectedFieldKey': function () { | 74 | 'initiallySelectedFieldKey': function () { |
77 | return this._initiallySelectedFieldKey; | 75 | return this._initiallySelectedFieldKey; |
78 | }, | 76 | }, |
79 | 77 | ||
80 | //========================================================================= | 78 | //========================================================================= |
81 | 79 | ||
82 | 'renderSelf': function() { | 80 | 'renderSelf': function() { |
83 | var initiallySelectedOptions; | 81 | var initiallySelectedOptions; |
84 | 82 | ||
85 | this.append(this.element(), {tag:'div', id:this.getId('div'), cls:'binding', children:[ | 83 | this.append(this.element(), {tag:'div', id:this.getId('div'), cls:'binding', children:[ |
86 | {tag:'span', cls:'formFieldName', html:this.formFieldName()}, | 84 | {tag:'span', cls:'formFieldName', html:this.formFieldName()}, |
87 | {tag:'span', cls:'fieldLock', id:this.getId('isHidden'), children:[ | 85 | {tag:'span', cls:'fieldLock', id:this.getId('isHidden'), children:[ |
88 | {tag:'a', href:'#', id:this.getId('showHide'), html:' '} | 86 | {tag:'a', href:'#', id:this.getId('showHide'), html:' '} |
89 | ]}, | 87 | ]}, |
90 | {tag:'input', id:this.getId('input'), cls:'formFieldExampleValue', disabled:true, value:''}, | 88 | {tag:'input', id:this.getId('input'), cls:'formFieldExampleValue', disabled:true, value:''}, |
91 | {tag:'select', name:this.formFieldName(), id:this.getId('select'), cls:'formFieldMatchinCardField', children: | 89 | {tag:'select', name:this.formFieldName(), id:this.getId('select'), cls:'formFieldMatchinCardField', children: |
92 | MochiKit.Base.flattenArguments( | 90 | MochiKit.Base.flattenArguments( |
93 | {tag:'option', value:'---', html:"---"}, | 91 | {tag:'option', value:'---', html:"---"}, |
94 | MochiKit.Base.map( | 92 | MochiKit.Base.map( |
95 | MochiKit.Base.bind(function (aField) { return {tag:'option', value:aField['reference'], html:aField['label']}; }, this), | 93 | MochiKit.Base.bind(function (aField) { return {tag:'option', value:aField['reference'], html:aField['label']}; }, this), |
96 | this.fields() | 94 | this.fields() |
97 | ) | 95 | ) |
98 | ) | 96 | ) |
99 | } | 97 | } |
100 | ]}); | 98 | ]}); |
101 | 99 | ||
102 | MochiKit.Signal.connect(this.getElement('select'), 'onchange', this, 'handleSelectChange'); | 100 | MochiKit.Signal.connect(this.getElement('select'), 'onchange', this, 'handleSelectChange'); |
103 | MochiKit.Signal.connect(this.getElement('showHide'), 'onclick', this, 'handleShowHide'); | 101 | MochiKit.Signal.connect(this.getElement('showHide'), 'onclick', this, 'handleShowHide'); |
104 | 102 | ||
105 | if (! MochiKit.Base.isUndefinedOrNull(this.initiallySelectedFieldKey())) { | 103 | if (! MochiKit.Base.isUndefinedOrNull(this.initiallySelectedFieldKey())) { |
106 | initiallySelectedOptions = MochiKit.Selector.findChildElements(this.element(), ['option[value=' + this.initiallySelectedFieldKey() + ']']); | 104 | initiallySelectedOptions = MochiKit.Selector.findChildElements(this.element(), ['option[value=' + this.initiallySelectedFieldKey() + ']']); |
107 | if (initiallySelectedOptions.length == 1) { | 105 | if (initiallySelectedOptions.length == 1) { |
108 | MochiKit.DOM.updateNodeAttributes(initiallySelectedOptions[0], {selected:true}); | 106 | MochiKit.DOM.updateNodeAttributes(initiallySelectedOptions[0], {selected:true}); |
109 | this.handleSelectChange(); | 107 | this.handleSelectChange(); |
110 | } | 108 | } |
111 | } | 109 | } |
112 | }, | 110 | }, |
113 | 111 | ||
114 | //------------------------------------------------------------------------- | 112 | //------------------------------------------------------------------------- |
115 | 113 | ||
116 | 'setFieldValue': function (aValue) { | 114 | 'setFieldValue': function (aValue) { |
117 | this.getElement('input').value = aValue; | 115 | this.getElement('input').value = aValue; |
118 | }, | 116 | }, |
119 | 117 | ||
120 | 'isHidden': function () { | 118 | 'isHidden': function () { |
121 | return MochiKit.DOM.hasElementClass(this.getElement('div'), 'locked'); | 119 | return MochiKit.DOM.hasElementClass(this.getElement('div'), 'locked'); |
122 | }, | 120 | }, |
123 | 121 | ||
124 | 'setIsHidden': function (aValue) { | 122 | 'setIsHidden': function (aValue) { |
125 | if (aValue == true) { | 123 | if (aValue == true) { |
126 | MochiKit.DOM.addElementClass(this.getElement('div'), 'locked'); | 124 | MochiKit.DOM.addElementClass(this.getElement('div'), 'locked'); |
127 | MochiKit.DOM.addElementClass(this.getElement('div'), 'showLocked'); | 125 | MochiKit.DOM.addElementClass(this.getElement('div'), 'showLocked'); |
128 | } else { | 126 | } else { |
129 | MochiKit.DOM.removeElementClass(this.getElement('div'), 'locked'); | 127 | MochiKit.DOM.removeElementClass(this.getElement('div'), 'locked'); |
130 | MochiKit.DOM.removeElementClass(this.getElement('div'), 'showLocked'); | 128 | MochiKit.DOM.removeElementClass(this.getElement('div'), 'showLocked'); |
131 | } | 129 | } |
132 | }, | 130 | }, |
133 | 131 | ||
134 | 'isShowLocked': function () { | 132 | 'isShowLocked': function () { |
135 | return MochiKit.DOM.hasElementClass(this.getElement('div'), 'showLocked'); | 133 | return MochiKit.DOM.hasElementClass(this.getElement('div'), 'showLocked'); |
136 | }, | 134 | }, |
137 | 135 | ||
138 | //------------------------------------------------------------------------- | 136 | //------------------------------------------------------------------------- |
139 | 137 | ||
140 | 'handleSelectChange': function (anEvent) { | 138 | 'handleSelectChange': function (anEvent) { |
141 | // this.getElement('input').value = this.valueOfField(anEvent.src().value); | 139 | // this.getElement('input').value = this.valueOfField(anEvent.src().value); |
142 | MochiKit.Signal.signal(this, 'bindChange', this); | 140 | MochiKit.Signal.signal(this, 'bindChange', this); |
143 | }, | 141 | }, |
144 | 142 | ||
145 | 'handleShowHide': function (anEvent) { | 143 | 'handleShowHide': function (anEvent) { |
146 | anEvent.preventDefault(); | 144 | anEvent.preventDefault(); |
147 | 145 | ||
148 | if (this.isShowLocked()) { | 146 | if (this.isShowLocked()) { |
149 | MochiKit.DOM.removeElementClass(this.getElement('div'), 'showLocked'); | 147 | MochiKit.DOM.removeElementClass(this.getElement('div'), 'showLocked'); |
150 | } else { | 148 | } else { |
151 | MochiKit.DOM.addElementClass(this.getElement('div'), 'showLocked'); | 149 | MochiKit.DOM.addElementClass(this.getElement('div'), 'showLocked'); |
152 | } | 150 | } |
153 | }, | 151 | }, |
154 | 152 | ||
155 | //========================================================================= | 153 | //========================================================================= |
156 | __syntaxFix__: "syntax fix" | 154 | __syntaxFix__: "syntax fix" |
157 | }); | 155 | }); |
158 | 156 | ||
159 | 157 | ||
160 | 158 | ||
161 | 159 | ||
162 | 160 | ||
163 | 161 | ||
164 | 162 | ||
165 | 163 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js index 5114b1d..55d2c01 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js | |||
@@ -1,300 +1,297 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._tabPanelController = null; | 31 | this._tabPanelController = null; |
34 | 32 | ||
35 | this._initiallySelectedTab = args.selected || 'TYPE'; | 33 | this._initiallySelectedTab = args.selected || 'TYPE'; |
36 | this._tabPanelControllerConfiguration = { | 34 | this._tabPanelControllerConfiguration = { |
37 | 'LABEL': { | 35 | 'LABEL': { |
38 | tab:'labelTab', | 36 | tab:'labelTab', |
39 | panel:'labelTabpanel' | 37 | panel:'labelTabpanel' |
40 | }, | 38 | }, |
41 | 'TYPE': { | 39 | 'TYPE': { |
42 | tab:'typeTab', | 40 | tab:'typeTab', |
43 | panel:'typeTabpanel' | 41 | panel:'typeTabpanel' |
44 | }, | 42 | }, |
45 | 'CONFIGURATION': { | 43 | 'CONFIGURATION': { |
46 | tab:'configurationTab', | 44 | tab:'configurationTab', |
47 | panel:'configurationTabpanel' | 45 | panel:'configurationTabpanel' |
48 | }, | 46 | }, |
49 | 'BINDINGS': { | 47 | 'BINDINGS': { |
50 | tab:'bindingsTab', | 48 | tab:'bindingsTab', |
51 | panel:'bindingsTabpanel' | 49 | panel:'bindingsTabpanel' |
52 | }, | 50 | }, |
53 | 'FAVICON': { | 51 | 'FAVICON': { |
54 | tab:'faviconTab', | 52 | tab:'faviconTab', |
55 | panel:'faviconTabpanel' | 53 | panel:'faviconTabpanel' |
56 | }, | 54 | }, |
57 | 'DONE': { | 55 | 'DONE': { |
58 | tab:'doneTab', | 56 | tab:'doneTab', |
59 | panel:'doneTabpanel' | 57 | panel:'doneTabpanel' |
60 | } | 58 | } |
61 | }; | 59 | }; |
62 | 60 | ||
63 | this._directLoginReference = null; | 61 | this._directLoginReference = null; |
64 | 62 | ||
65 | this._directLoginFavicon = null; | 63 | this._directLoginFavicon = null; |
66 | 64 | ||
67 | this._updateFaviconCounter = 0; | 65 | this._updateFaviconCounter = 0; |
68 | this._faviconComponent = null; | 66 | this._faviconComponent = null; |
69 | 67 | ||
70 | this._bindingComponents= []; | 68 | this._bindingComponents= []; |
71 | this._formValueComponents = []; | 69 | this._formValueComponents = []; |
72 | 70 | ||
73 | return this; | 71 | return this; |
74 | } | 72 | } |
75 | 73 | ||
76 | //============================================================================= | 74 | //============================================================================= |
77 | 75 | ||
78 | //Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 76 | //Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { |
79 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent, Clipperz.PM.UI.Common.Components.TabPanelComponent, { | 77 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent, Clipperz.PM.UI.Common.Components.TabPanelComponent, { |
80 | 78 | ||
81 | //------------------------------------------------------------------------- | 79 | //------------------------------------------------------------------------- |
82 | 80 | ||
83 | 'toString': function () { | 81 | 'toString': function () { |
84 | return "Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent component"; | 82 | return "Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent component"; |
85 | }, | 83 | }, |
86 | 84 | ||
87 | //========================================================================= | 85 | //========================================================================= |
88 | 86 | ||
89 | 'directLoginReference': function () { | 87 | 'directLoginReference': function () { |
90 | return this._directLoginReference; | 88 | return this._directLoginReference; |
91 | }, | 89 | }, |
92 | 90 | ||
93 | //------------------------------------------------------------------------- | 91 | //------------------------------------------------------------------------- |
94 | 92 | ||
95 | 'setDirectLoginReference': function (aDirectLoginReference) { | 93 | 'setDirectLoginReference': function (aDirectLoginReference) { |
96 | this._directLoginReference = aDirectLoginReference; | 94 | this._directLoginReference = aDirectLoginReference; |
97 | 95 | ||
98 | return this._directLoginReference; | 96 | return this._directLoginReference; |
99 | }, | 97 | }, |
100 | 98 | ||
101 | //========================================================================= | 99 | //========================================================================= |
102 | 100 | ||
103 | 'label': function () { | 101 | 'label': function () { |
104 | return this.getElement('label').value | 102 | return this.getElement('label').value |
105 | }, | 103 | }, |
106 | 104 | ||
107 | 'setLabel': function (aValue) { | 105 | 'setLabel': function (aValue) { |
108 | //console.log("##> LABEL: " + aValue); | ||
109 | this.getElement('label').value = (aValue ? aValue : ''); | 106 | this.getElement('label').value = (aValue ? aValue : ''); |
110 | }, | 107 | }, |
111 | 108 | ||
112 | //------------------------------------------------------------------------- | 109 | //------------------------------------------------------------------------- |
113 | 110 | ||
114 | 'favicon': function () { | 111 | 'favicon': function () { |
115 | return this.getElement('faviconURL').value; | 112 | return this.getElement('faviconURL').value; |
116 | }, | 113 | }, |
117 | 114 | ||
118 | 'setFavicon': function (aValue) { | 115 | 'setFavicon': function (aValue) { |
119 | var regexp; | 116 | var regexp; |
120 | var displayValue; | 117 | var displayValue; |
121 | 118 | ||
122 | regexp = new RegExp('^data\:\/\/.*', 'i'); | 119 | regexp = new RegExp('^data\:\/\/.*', 'i'); |
123 | if (regexp.test(aValue)) { | 120 | if (regexp.test(aValue)) { |
124 | displayValue = '' | 121 | displayValue = '' |
125 | } else { | 122 | } else { |
126 | displayValue = (aValue ? aValue : ''); | 123 | displayValue = (aValue ? aValue : ''); |
127 | } | 124 | } |
128 | 125 | ||
129 | this.getElement('faviconURL').value = displayValue; | 126 | this.getElement('faviconURL').value = displayValue; |
130 | this.faviconComponent().setSrc(aValue); | 127 | this.faviconComponent().setSrc(aValue); |
131 | }, | 128 | }, |
132 | 129 | ||
133 | //'setFaviconData': function (aValue) { | 130 | //'setFaviconData': function (aValue) { |
134 | // this.getElement('faviconIcon').src = aValue; | 131 | // this.getElement('faviconIcon').src = aValue; |
135 | //}, | 132 | //}, |
136 | 133 | ||
137 | 'directLoginFavicon': function () { | 134 | 'directLoginFavicon': function () { |
138 | return this._directLoginFavicon; | 135 | return this._directLoginFavicon; |
139 | }, | 136 | }, |
140 | 137 | ||
141 | 'setDirectLoginFavicon': function (aValue) { | 138 | 'setDirectLoginFavicon': function (aValue) { |
142 | this._directLoginFavicon = aValue; | 139 | this._directLoginFavicon = aValue; |
143 | this.setFavicon(aValue); | 140 | this.setFavicon(aValue); |
144 | }, | 141 | }, |
145 | 142 | ||
146 | //------------------------------------------------------------------------- | 143 | //------------------------------------------------------------------------- |
147 | 144 | ||
148 | 'bookmarkletConfiguration': function () { | 145 | 'bookmarkletConfiguration': function () { |
149 | return this.getElement('bookmarkletConfiguration').value | 146 | return this.getElement('bookmarkletConfiguration').value |
150 | }, | 147 | }, |
151 | 148 | ||
152 | 'setBookmarkletConfiguration': function (aValue) { | 149 | 'setBookmarkletConfiguration': function (aValue) { |
153 | this.getElement('bookmarkletConfiguration').value = aValue; | 150 | this.getElement('bookmarkletConfiguration').value = aValue; |
154 | }, | 151 | }, |
155 | 152 | ||
156 | 'highlightConfigurationSyntaxError': function () { | 153 | 'highlightConfigurationSyntaxError': function () { |
157 | MochiKit.DOM.addElementClass(this.getElement('bookmarkletConfiguration'), 'error'); | 154 | MochiKit.DOM.addElementClass(this.getElement('bookmarkletConfiguration'), 'error'); |
158 | }, | 155 | }, |
159 | 156 | ||
160 | 'removeHighlightConfigurationSyntaxError': function () { | 157 | 'removeHighlightConfigurationSyntaxError': function () { |
161 | MochiKit.DOM.removeElementClass(this.getElement('bookmarkletConfiguration'), 'error'); | 158 | MochiKit.DOM.removeElementClass(this.getElement('bookmarkletConfiguration'), 'error'); |
162 | }, | 159 | }, |
163 | 160 | ||
164 | //========================================================================= | 161 | //========================================================================= |
165 | 162 | ||
166 | 'disableAllPanels': function () { | 163 | 'disableAllPanels': function () { |
167 | this.getElement('label').disabled = true; | 164 | this.getElement('label').disabled = true; |
168 | MochiKit.DOM.addElementClass(this.getElement('label').parentNode, 'disabled'); | 165 | MochiKit.DOM.addElementClass(this.getElement('label').parentNode, 'disabled'); |
169 | 166 | ||
170 | this.tabPanelController().selectTab(null); | 167 | this.tabPanelController().selectTab(null); |
171 | }, | 168 | }, |
172 | 169 | ||
173 | //------------------------------------------------------------------------- | 170 | //------------------------------------------------------------------------- |
174 | 171 | ||
175 | //'disableLabelField': function () { | 172 | //'disableLabelField': function () { |
176 | // this.getElement('label').disabled = true; | 173 | // this.getElement('label').disabled = true; |
177 | // MochiKit.DOM.addElementClass(this.getElement('label').parentNode, 'disabled'); | 174 | // MochiKit.DOM.addElementClass(this.getElement('label').parentNode, 'disabled'); |
178 | //}, | 175 | //}, |
179 | 176 | ||
180 | 'enableLabelField': function () { | 177 | 'enableLabelField': function () { |
181 | this.getElement('label').disabled = false; | 178 | this.getElement('label').disabled = false; |
182 | MochiKit.DOM.removeElementClass(this.getElement('label').parentNode, 'disabled'); | 179 | MochiKit.DOM.removeElementClass(this.getElement('label').parentNode, 'disabled'); |
183 | this.tabPanelController().selectTab('LABEL'); | 180 | this.tabPanelController().selectTab('LABEL'); |
184 | }, | 181 | }, |
185 | 182 | ||
186 | //------------------------------------------------------------------------- | 183 | //------------------------------------------------------------------------- |
187 | 184 | ||
188 | //'disableTypeField': function () { | 185 | //'disableTypeField': function () { |
189 | // this.tabPanelController().selectTab(null); | 186 | // this.tabPanelController().selectTab(null); |
190 | //}, | 187 | //}, |
191 | 188 | ||
192 | 'enableTypeField': function () { | 189 | 'enableTypeField': function () { |
193 | this.tabPanelController().selectTab('TYPE'); | 190 | this.tabPanelController().selectTab('TYPE'); |
194 | }, | 191 | }, |
195 | 192 | ||
196 | //------------------------------------------------------------------------- | 193 | //------------------------------------------------------------------------- |
197 | 194 | ||
198 | //'disableConfigurationField': function () { | 195 | //'disableConfigurationField': function () { |
199 | // this.tabPanelController().selectTab(null); | 196 | // this.tabPanelController().selectTab(null); |
200 | //}, | 197 | //}, |
201 | 198 | ||
202 | 'enableConfigurationField': function () { | 199 | 'enableConfigurationField': function () { |
203 | this.tabPanelController().selectTab('CONFIGURATION'); | 200 | this.tabPanelController().selectTab('CONFIGURATION'); |
204 | }, | 201 | }, |
205 | 202 | ||
206 | //------------------------------------------------------------------------- | 203 | //------------------------------------------------------------------------- |
207 | 204 | ||
208 | //'disableBindingFields': function () { | 205 | //'disableBindingFields': function () { |
209 | // this.tabPanelController().selectTab(null); | 206 | // this.tabPanelController().selectTab(null); |
210 | //}, | 207 | //}, |
211 | 208 | ||
212 | 'enableBindingFields': function () { | 209 | 'enableBindingFields': function () { |
213 | this.tabPanelController().selectTab('BINDINGS'); | 210 | this.tabPanelController().selectTab('BINDINGS'); |
214 | }, | 211 | }, |
215 | 212 | ||
216 | //------------------------------------------------------------------------- | 213 | //------------------------------------------------------------------------- |
217 | 214 | ||
218 | //'disableFaviconField': function () { | 215 | //'disableFaviconField': function () { |
219 | // this.tabPanelController().selectTab(null); | 216 | // this.tabPanelController().selectTab(null); |
220 | //}, | 217 | //}, |
221 | 218 | ||
222 | 'enableFaviconField': function () { | 219 | 'enableFaviconField': function () { |
223 | this.tabPanelController().selectTab('FAVICON'); | 220 | this.tabPanelController().selectTab('FAVICON'); |
224 | }, | 221 | }, |
225 | 222 | ||
226 | //------------------------------------------------------------------------- | 223 | //------------------------------------------------------------------------- |
227 | 224 | ||
228 | 'enableDonePanel': function () { | 225 | 'enableDonePanel': function () { |
229 | this.tabPanelController().selectTab('DONE'); | 226 | this.tabPanelController().selectTab('DONE'); |
230 | }, | 227 | }, |
231 | 228 | ||
232 | //========================================================================= | 229 | //========================================================================= |
233 | 230 | ||
234 | 'shouldShowElementWhileRendering': function() { | 231 | 'shouldShowElementWhileRendering': function() { |
235 | return false; | 232 | return false; |
236 | }, | 233 | }, |
237 | 234 | ||
238 | //========================================================================= | 235 | //========================================================================= |
239 | 236 | ||
240 | 'faviconComponent': function () { | 237 | 'faviconComponent': function () { |
241 | if (this._faviconComponent == null) { | 238 | if (this._faviconComponent == null) { |
242 | this._faviconComponent = new Clipperz.PM.UI.Common.Components.FaviconComponent({element:this.getId('favicon')}); | 239 | this._faviconComponent = new Clipperz.PM.UI.Common.Components.FaviconComponent({element:this.getId('favicon')}); |
243 | } | 240 | } |
244 | 241 | ||
245 | return this._faviconComponent; | 242 | return this._faviconComponent; |
246 | }, | 243 | }, |
247 | 244 | ||
248 | //========================================================================= | 245 | //========================================================================= |
249 | 246 | ||
250 | 'tabPanelController': function () { | 247 | 'tabPanelController': function () { |
251 | if (this._tabPanelController == null) { | 248 | if (this._tabPanelController == null) { |
252 | this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({ | 249 | this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({ |
253 | component:this, | 250 | component:this, |
254 | configuration:this._tabPanelControllerConfiguration | 251 | configuration:this._tabPanelControllerConfiguration |
255 | }); | 252 | }); |
256 | 253 | ||
257 | MochiKit.Signal.connect(this._tabPanelController, 'tabSelected', this, 'handleTabSelected') | 254 | MochiKit.Signal.connect(this._tabPanelController, 'tabSelected', this, 'handleTabSelected') |
258 | } | 255 | } |
259 | 256 | ||
260 | return this._tabPanelController; | 257 | return this._tabPanelController; |
261 | }, | 258 | }, |
262 | 259 | ||
263 | //------------------------------------------------------------------------- | 260 | //------------------------------------------------------------------------- |
264 | 261 | ||
265 | 'renderSelf': function() { | 262 | 'renderSelf': function() { |
266 | varbookmarkletComponent; | 263 | varbookmarkletComponent; |
267 | 264 | ||
268 | this.append(this.element(), {tag:'div', cls:'directLoginEditing', id:this.getId('panel'), children: [ | 265 | this.append(this.element(), {tag:'div', cls:'directLoginEditing', id:this.getId('panel'), children: [ |
269 | // {tag:'div', cls:'back', children:[ | 266 | // {tag:'div', cls:'back', children:[ |
270 | // {tag:'a', href:'#', id:this.getId('back'), html:" "} | 267 | // {tag:'a', href:'#', id:this.getId('back'), html:" "} |
271 | // ]}, | 268 | // ]}, |
272 | {tag:'form', id:this.getId('form'), cls:'directLoginEditingForm', children:[ | 269 | {tag:'form', id:this.getId('form'), cls:'directLoginEditingForm', children:[ |
273 | {tag:'div', cls:'title', children:[ | 270 | {tag:'div', cls:'title', children:[ |
274 | {tag:'img', id:this.getId('favicon'), cls:'favicon'}, | 271 | {tag:'img', id:this.getId('favicon'), cls:'favicon'}, |
275 | {tag:'input', type:'text', id:this.getId('label')}//, | 272 | {tag:'input', type:'text', id:this.getId('label')}//, |
276 | // {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.LABEL.description')}]}, | 273 | // {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.LABEL.description')}]}, |
277 | ]}, | 274 | ]}, |
278 | {tag:'div', cls:'tabContainer', children:[ | 275 | {tag:'div', cls:'tabContainer', children:[ |
279 | {tag:'ul', cls:'tabs', children:[ | 276 | {tag:'ul', cls:'tabs', children:[ |
280 | {tag:'li', id:this.getId('labelTab'), children:[{tag:'span', html:"label"}]}, | 277 | {tag:'li', id:this.getId('labelTab'), children:[{tag:'span', html:"label"}]}, |
281 | {tag:'li', id:this.getId('typeTab'), children:[{tag:'span', html:"type"}]}, | 278 | {tag:'li', id:this.getId('typeTab'), children:[{tag:'span', html:"type"}]}, |
282 | {tag:'li', id:this.getId('configurationTab'),children:[{tag:'span', html:"configuration"}]}, | 279 | {tag:'li', id:this.getId('configurationTab'),children:[{tag:'span', html:"configuration"}]}, |
283 | {tag:'li', id:this.getId('bindingsTab'), children:[{tag:'span', html:"bindings"}]}, | 280 | {tag:'li', id:this.getId('bindingsTab'), children:[{tag:'span', html:"bindings"}]}, |
284 | {tag:'li', id:this.getId('faviconTab'), children:[{tag:'span', html:"favicon"}]}, | 281 | {tag:'li', id:this.getId('faviconTab'), children:[{tag:'span', html:"favicon"}]}, |
285 | {tag:'li', id:this.getId('doneTab'), children:[{tag:'span', html:"done"}]} | 282 | {tag:'li', id:this.getId('doneTab'), children:[{tag:'span', html:"done"}]} |
286 | ]}, | 283 | ]}, |
287 | {tag:'ul', cls:'tabPanels', children:[ | 284 | {tag:'ul', cls:'tabPanels', children:[ |
288 | {tag:'li', id:this.getId('labelTabpanel'), cls:'tabPanel label', children:[ | 285 | {tag:'li', id:this.getId('labelTabpanel'), cls:'tabPanel label', children:[ |
289 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.LABEL.description')}]} | 286 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.LABEL.description')}]} |
290 | ]}, | 287 | ]}, |
291 | {tag:'li', id:this.getId('typeTabpanel'), cls:'tabPanel type', children:[ | 288 | {tag:'li', id:this.getId('typeTabpanel'), cls:'tabPanel type', children:[ |
292 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.TYPE.description')}]}, | 289 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.TYPE.description')}]}, |
293 | {tag:'h2', html:"type"} | 290 | {tag:'h2', html:"type"} |
294 | ]}, | 291 | ]}, |
295 | {tag:'li', id:this.getId('configurationTabpanel'), cls:'tabPanel configuration', children:[ | 292 | {tag:'li', id:this.getId('configurationTabpanel'), cls:'tabPanel configuration', children:[ |
296 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.CONFIGURATION.description')}]}, | 293 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.DirectLoginWizard.CONFIGURATION.description')}]}, |
297 | {tag:'div', cls:'bookmarkletConfigurationWrapper', children:[ | 294 | {tag:'div', cls:'bookmarkletConfigurationWrapper', children:[ |
298 | {tag:'textarea', id:this.getId('bookmarkletConfiguration'), value:""}, | 295 | {tag:'textarea', id:this.getId('bookmarkletConfiguration'), value:""}, |
299 | // {tag:'div', cls:'bookmarkletComponentWrapper', children:[{tag:'div', id:this.getId('bookmarkletComponent'), cls:'bookmarkletComponent'}]} | 296 | // {tag:'div', cls:'bookmarkletComponentWrapper', children:[{tag:'div', id:this.getId('bookmarkletComponent'), cls:'bookmarkletComponent'}]} |
300 | {tag:'div', id:this.getId('bookmarkletComponent'), cls:'bookmarkletComponent'} | 297 | {tag:'div', id:this.getId('bookmarkletComponent'), cls:'bookmarkletComponent'} |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js index fa57233..58b5b26 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js | |||
@@ -1,176 +1,169 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._formFieldName = args.formFieldName|| Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._formFieldName = args.formFieldName|| Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._fieldOptions = args.fieldOptions || Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | this._fieldOptions = args.fieldOptions || Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | this._initialValue = args.initialValue || null; | 33 | this._initialValue = args.initialValue || null; |
36 | 34 | ||
37 | return this; | 35 | return this; |
38 | } | 36 | } |
39 | 37 | ||
40 | //============================================================================= | 38 | //============================================================================= |
41 | 39 | ||
42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 40 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { |
43 | 41 | ||
44 | //------------------------------------------------------------------------- | 42 | //------------------------------------------------------------------------- |
45 | 43 | ||
46 | 'toString': function () { | 44 | 'toString': function () { |
47 | return "Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent component"; | 45 | return "Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent component"; |
48 | }, | 46 | }, |
49 | 47 | ||
50 | //------------------------------------------------------------------------- | 48 | //------------------------------------------------------------------------- |
51 | 49 | ||
52 | 'formFieldName': function () { | 50 | 'formFieldName': function () { |
53 | return this._formFieldName; | 51 | return this._formFieldName; |
54 | }, | 52 | }, |
55 | 53 | ||
56 | //------------------------------------------------------------------------- | 54 | //------------------------------------------------------------------------- |
57 | 55 | ||
58 | 'fieldOptions': function () { | 56 | 'fieldOptions': function () { |
59 | return this._fieldOptions; | 57 | return this._fieldOptions; |
60 | }, | 58 | }, |
61 | 59 | ||
62 | 'fieldType': function () { | 60 | 'fieldType': function () { |
63 | return this.fieldOptions()['type']; | 61 | return this.fieldOptions()['type']; |
64 | }, | 62 | }, |
65 | 63 | ||
66 | 'optionValues': function () { | 64 | 'optionValues': function () { |
67 | return MochiKit.Base.map(function (anOptionValue) { | 65 | return MochiKit.Base.map(function (anOptionValue) { |
68 | return { | 66 | return { |
69 | 'label': anOptionValue['label'] || anOptionValue['value'], | 67 | 'label': anOptionValue['label'] || anOptionValue['value'], |
70 | 'value': anOptionValue['value'] | 68 | 'value': anOptionValue['value'] |
71 | } | 69 | } |
72 | }, this.fieldOptions()['options']); | 70 | }, this.fieldOptions()['options']); |
73 | }, | 71 | }, |
74 | 72 | ||
75 | //------------------------------------------------------------------------- | 73 | //------------------------------------------------------------------------- |
76 | 74 | ||
77 | 'selectedValue': function () { | 75 | 'selectedValue': function () { |
78 | var result; | 76 | var result; |
79 | 77 | ||
80 | result = this.getElement('select').value; | 78 | result = this.getElement('select').value; |
81 | 79 | ||
82 | if (result == '---') { | 80 | if (result == '---') { |
83 | result = null; | 81 | result = null; |
84 | } | 82 | } |
85 | 83 | ||
86 | return result; | 84 | return result; |
87 | }, | 85 | }, |
88 | 86 | ||
89 | 'initialValue': function () { | 87 | 'initialValue': function () { |
90 | return this._initialValue; | 88 | return this._initialValue; |
91 | }, | 89 | }, |
92 | 90 | ||
93 | //========================================================================= | 91 | //========================================================================= |
94 | 92 | ||
95 | 'renderSelf': function() { | 93 | 'renderSelf': function() { |
96 | //console.log(">>> DirectLoginEditingFormValueComponent.renderSelf"); | ||
97 | //console.log("FIELD OPTIONS", this.fieldOptions()); | ||
98 | //console.log("OPTION VALUES", this.optionValues()); | ||
99 | this.append(this.element(), {tag:'div', id:this.getId('div'), cls:'formValue', children:[ | 94 | this.append(this.element(), {tag:'div', id:this.getId('div'), cls:'formValue', children:[ |
100 | {tag:'span', cls:'formFieldName', html:this.formFieldName()}, | 95 | {tag:'span', cls:'formFieldName', html:this.formFieldName()}, |
101 | {tag:'div', id:this.getId('values')} | 96 | {tag:'div', id:this.getId('values')} |
102 | ]}); | 97 | ]}); |
103 | 98 | ||
104 | if ((this.fieldType() == 'radio') || (this.fieldType() == 'select')) { | 99 | if ((this.fieldType() == 'radio') || (this.fieldType() == 'select')) { |
105 | this.append(this.getElement('values'), | 100 | this.append(this.getElement('values'), |
106 | {tag:'select', name:this.formFieldName(), id:this.getId('select'), cls:'formFieldMatchinCardField', children: | 101 | {tag:'select', name:this.formFieldName(), id:this.getId('select'), cls:'formFieldMatchinCardField', children: |
107 | MochiKit.Base.flattenArguments( | 102 | MochiKit.Base.flattenArguments( |
108 | // {tag:'option', value:'---', html:"---"}, | 103 | // {tag:'option', value:'---', html:"---"}, |
109 | MochiKit.Base.map( | 104 | MochiKit.Base.map( |
110 | MochiKit.Base.bind(function (aValue) { return {tag:'option', value:aValue['value'], html:aValue['label']}; }, this), | 105 | MochiKit.Base.bind(function (aValue) { return {tag:'option', value:aValue['value'], html:aValue['label']}; }, this), |
111 | this.optionValues() | 106 | this.optionValues() |
112 | ) | 107 | ) |
113 | ) | 108 | ) |
114 | } | 109 | } |
115 | ); | 110 | ); |
116 | 111 | ||
117 | MochiKit.Signal.connect(this.getElement('select'), 'onchange', this, 'handleSelectChange'); | 112 | MochiKit.Signal.connect(this.getElement('select'), 'onchange', this, 'handleSelectChange'); |
118 | 113 | ||
119 | if (! MochiKit.Base.isUndefinedOrNull(this.initialValue())) { | 114 | if (! MochiKit.Base.isUndefinedOrNull(this.initialValue())) { |
120 | var initiallySelectedOptions; | 115 | var initiallySelectedOptions; |
121 | initiallySelectedOptions = MochiKit.Selector.findChildElements(this.element(), ['option[value=' + this.initialValue() + ']']); | 116 | initiallySelectedOptions = MochiKit.Selector.findChildElements(this.element(), ['option[value=' + this.initialValue() + ']']); |
122 | if (initiallySelectedOptions.length == 1) { | 117 | if (initiallySelectedOptions.length == 1) { |
123 | MochiKit.DOM.updateNodeAttributes(initiallySelectedOptions[0], {selected:true}); | 118 | MochiKit.DOM.updateNodeAttributes(initiallySelectedOptions[0], {selected:true}); |
124 | this.handleSelectChange(); | 119 | this.handleSelectChange(); |
125 | } else { | 120 | } else { |
126 | Clipperz.DOM.Helper.insertBefore(this.getElement('select').childNodes[0], {tag:'option', value:'---', html:"", selected:true}); | 121 | Clipperz.DOM.Helper.insertBefore(this.getElement('select').childNodes[0], {tag:'option', value:'---', html:"", selected:true}); |
127 | } | 122 | } |
128 | } else { | 123 | } else { |
129 | Clipperz.DOM.Helper.insertBefore(this.getElement('select').childNodes[0], {tag:'option', value:'---', html:"", selected:true}); | 124 | Clipperz.DOM.Helper.insertBefore(this.getElement('select').childNodes[0], {tag:'option', value:'---', html:"", selected:true}); |
130 | } | 125 | } |
131 | } else if (this.fieldType() == 'checkbox') { | 126 | } else if (this.fieldType() == 'checkbox') { |
132 | this.append(this.getElement('values'), | 127 | this.append(this.getElement('values'), |
133 | {tag:'input', type:'checkbox', name:this.formFieldName(), id:this.getId('checkbox'), cls:'formFieldMatchinCardField'} | 128 | {tag:'input', type:'checkbox', name:this.formFieldName(), id:this.getId('checkbox'), cls:'formFieldMatchinCardField'} |
134 | ); | 129 | ); |
135 | 130 | ||
136 | MochiKit.Signal.connect(this.getElement('checkbox'), 'onchange', this, 'handleSelectChange'); | 131 | MochiKit.Signal.connect(this.getElement('checkbox'), 'onchange', this, 'handleSelectChange'); |
137 | 132 | ||
138 | if (this.initialValue()) { | 133 | if (this.initialValue()) { |
139 | MochiKit.DOM.updateNodeAttributes(this.getElement('checkbox'), {checked:true}); | 134 | MochiKit.DOM.updateNodeAttributes(this.getElement('checkbox'), {checked:true}); |
140 | } | 135 | } |
141 | } else { | 136 | } else { |
142 | WTF = TODO; | 137 | WTF = TODO; |
143 | } | 138 | } |
144 | //console.log("<<< DirectLoginEditingFormValueComponent.renderSelf"); | ||
145 | }, | 139 | }, |
146 | 140 | ||
147 | //========================================================================= | 141 | //========================================================================= |
148 | 142 | ||
149 | 'handleSelectChange': function (anEvent) { | 143 | 'handleSelectChange': function (anEvent) { |
150 | //console.log("handleSelectChange", anEvent, anEvent.src(), anEvent.src().value); | ||
151 | var options; | 144 | var options; |
152 | 145 | ||
153 | options = {}; | 146 | options = {}; |
154 | 147 | ||
155 | options['fieldName'] = this.formFieldName(); | 148 | options['fieldName'] = this.formFieldName(); |
156 | 149 | ||
157 | if (this.fieldType() == 'checkbox') { | 150 | if (this.fieldType() == 'checkbox') { |
158 | options['selectedValue'] = (this.getElement('checkbox').checked ? 1 : null); | 151 | options['selectedValue'] = (this.getElement('checkbox').checked ? 1 : null); |
159 | } else { | 152 | } else { |
160 | options['selectedValue'] = this.selectedValue(); | 153 | options['selectedValue'] = this.selectedValue(); |
161 | } | 154 | } |
162 | 155 | ||
163 | MochiKit.Signal.signal(this, 'formValueChange', options); | 156 | MochiKit.Signal.signal(this, 'formValueChange', options); |
164 | }, | 157 | }, |
165 | 158 | ||
166 | //========================================================================= | 159 | //========================================================================= |
167 | __syntaxFix__: "syntax fix" | 160 | __syntaxFix__: "syntax fix" |
168 | }); | 161 | }); |
169 | 162 | ||
170 | 163 | ||
171 | 164 | ||
172 | 165 | ||
173 | 166 | ||
174 | 167 | ||
175 | 168 | ||
176 | 169 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js index d8dc941..b4fc24e 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js | |||
@@ -1,214 +1,212 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager = function(args) { |
31 | args = args || {}; | 29 | args = args || {}; |
32 | Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager.superclass.constructor.call(this, args); | 30 | Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager.superclass.constructor.call(this, args); |
33 | 31 | ||
34 | this._enterLeaveCounter = 0; | 32 | this._enterLeaveCounter = 0; |
35 | this._selectedRowObject = null; | 33 | this._selectedRowObject = null; |
36 | 34 | ||
37 | return this; | 35 | return this; |
38 | } | 36 | } |
39 | 37 | ||
40 | //============================================================================= | 38 | //============================================================================= |
41 | 39 | ||
42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { | 40 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { |
43 | 41 | ||
44 | 'toString': function () { | 42 | 'toString': function () { |
45 | return "Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager component"; | 43 | return "Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager component"; |
46 | }, | 44 | }, |
47 | 45 | ||
48 | //------------------------------------------------------------------------- | 46 | //------------------------------------------------------------------------- |
49 | 47 | ||
50 | 'renderHeader': function(aTRElement) { | 48 | 'renderHeader': function(aTRElement) { |
51 | Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager.superclass.renderHeader.call(this, aTRElement); | 49 | Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager.superclass.renderHeader.call(this, aTRElement); |
52 | 50 | ||
53 | Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body, {tag:'div', cls:'DirectLoginListPopup', id:this.getId('DirectLoginListPopup'), children:[ | 51 | Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body, {tag:'div', cls:'DirectLoginListPopup', id:this.getId('DirectLoginListPopup'), children:[ |
54 | {tag:'div', cls:'DirectLoginListPopup_body', children:[ | 52 | {tag:'div', cls:'DirectLoginListPopup_body', children:[ |
55 | {tag:'ul', id:this.getId('DirectLoginListPopup_list'), children:[ | 53 | {tag:'ul', id:this.getId('DirectLoginListPopup_list'), children:[ |
56 | // {tag:'li', children:[ | 54 | // {tag:'li', children:[ |
57 | // {tag:'img', cls:'favicon', src:'http://www.microsoft.com/favicon.ico'}, | 55 | // {tag:'img', cls:'favicon', src:'http://www.microsoft.com/favicon.ico'}, |
58 | // {tag:'a', href:'#', html:"Google Mail"} | 56 | // {tag:'a', href:'#', html:"Google Mail"} |
59 | // ]}, | 57 | // ]}, |
60 | // ... | 58 | // ... |
61 | ]} | 59 | ]} |
62 | ]}, | 60 | ]}, |
63 | {tag:'div', cls:'DirectLoginListPopup_footer'} | 61 | {tag:'div', cls:'DirectLoginListPopup_footer'} |
64 | ]}); | 62 | ]}); |
65 | 63 | ||
66 | MochiKit.Style.hideElement(this.getId('DirectLoginListPopup')); | 64 | MochiKit.Style.hideElement(this.getId('DirectLoginListPopup')); |
67 | 65 | ||
68 | //BEWARE: use MochiKit.Signal.connect instead of this.connectEvent, as the HEADER is NOT redrawn after each refresh | 66 | //BEWARE: use MochiKit.Signal.connect instead of this.connectEvent, as the HEADER is NOT redrawn after each refresh |
69 | MochiKit.Signal.connect(this.getId('DirectLoginListPopup'), 'onmouseenter', this, 'handleDirectLoginListPopupEnter'); | 67 | MochiKit.Signal.connect(this.getId('DirectLoginListPopup'), 'onmouseenter', this, 'handleDirectLoginListPopupEnter'); |
70 | MochiKit.Signal.connect(this.getId('DirectLoginListPopup'), 'onmouseleave', this, 'handleDirectLoginListPopupLeave'); | 68 | MochiKit.Signal.connect(this.getId('DirectLoginListPopup'), 'onmouseleave', this, 'handleDirectLoginListPopupLeave'); |
71 | }, | 69 | }, |
72 | 70 | ||
73 | //------------------------------------------------------------------------- | 71 | //------------------------------------------------------------------------- |
74 | 72 | ||
75 | 'renderCell': function(aRowElement, anObject) { | 73 | 'renderCell': function(aRowElement, anObject) { |
76 | var i,c; | 74 | var i,c; |
77 | var directLoginsInfo; | 75 | var directLoginsInfo; |
78 | 76 | ||
79 | directLoginsInfo = anObject[this.name()]; | 77 | directLoginsInfo = anObject[this.name()]; |
80 | 78 | ||
81 | TDElement = Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:'card_directLogins'}); | 79 | TDElement = Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:'card_directLogins'}); |
82 | 80 | ||
83 | c = Math.min(2, directLoginsInfo.length); | 81 | c = Math.min(2, directLoginsInfo.length); |
84 | for (i=0; i<c; i++) { | 82 | for (i=0; i<c; i++) { |
85 | var elementID; | 83 | var elementID; |
86 | 84 | ||
87 | elementID = 'directLogin_' + directLoginsInfo[i]['_reference']; | 85 | elementID = 'directLogin_' + directLoginsInfo[i]['_reference']; |
88 | 86 | ||
89 | Clipperz.DOM.Helper.append(TDElement, {tag:'div', cls:'card_directLogin', children:[ | 87 | Clipperz.DOM.Helper.append(TDElement, {tag:'div', cls:'card_directLogin', children:[ |
90 | {tag:'div', cls:'card_directLogin_body', children:[ | 88 | {tag:'div', cls:'card_directLogin_body', children:[ |
91 | {tag:'a', href:'#', id:elementID, html:directLoginsInfo[i]['label']} | 89 | {tag:'a', href:'#', id:elementID, html:directLoginsInfo[i]['label']} |
92 | ]} | 90 | ]} |
93 | ]}); | 91 | ]}); |
94 | // MochiKit.Signal.connect(elementID, 'onclick', MochiKit.Base.method(this, 'handleDirectLoginClick', directLoginsInfo[i]['_rowObject'])); | 92 | // MochiKit.Signal.connect(elementID, 'onclick', MochiKit.Base.method(this, 'handleDirectLoginClick', directLoginsInfo[i]['_rowObject'])); |
95 | this.connectEvent(elementID, 'onclick', MochiKit.Base.method(this, 'handleDirectLoginClick', directLoginsInfo[i]['_rowObject'])); | 93 | this.connectEvent(elementID, 'onclick', MochiKit.Base.method(this, 'handleDirectLoginClick', directLoginsInfo[i]['_rowObject'])); |
96 | } | 94 | } |
97 | 95 | ||
98 | if (directLoginsInfo.length > 2) { | 96 | if (directLoginsInfo.length > 2) { |
99 | var ellipsesElement; | 97 | var ellipsesElement; |
100 | 98 | ||
101 | ellipsesElement = Clipperz.DOM.Helper.append(TDElement, {tag:'div', cls:'card_directLogin_ellipses', children:[ | 99 | ellipsesElement = Clipperz.DOM.Helper.append(TDElement, {tag:'div', cls:'card_directLogin_ellipses', children:[ |
102 | {tag:'div', cls:'card_directLogin_ellipses_body', children:[ | 100 | {tag:'div', cls:'card_directLogin_ellipses_body', children:[ |
103 | {tag:'span', html:'…'} | 101 | {tag:'span', html:'…'} |
104 | ]} | 102 | ]} |
105 | ]}); | 103 | ]}); |
106 | 104 | ||
107 | /// MochiKit.Signal.connect(ellipsesElement, 'onmouseenter', MochiKit.Base.method(this, 'handleEllipsesEnter', anObject)); | 105 | /// MochiKit.Signal.connect(ellipsesElement, 'onmouseenter', MochiKit.Base.method(this, 'handleEllipsesEnter', anObject)); |
108 | /// MochiKit.Signal.connect(ellipsesElement, 'onmouseleave', MochiKit.Base.method(this, 'handleEllipsesLeave')); | 106 | /// MochiKit.Signal.connect(ellipsesElement, 'onmouseleave', MochiKit.Base.method(this, 'handleEllipsesLeave')); |
109 | // MochiKit.Signal.connect(TDElement, 'onmouseleave', MochiKit.Base.method(this, 'handleTDLeave')); | 107 | // MochiKit.Signal.connect(TDElement, 'onmouseleave', MochiKit.Base.method(this, 'handleTDLeave')); |
110 | this.connectEvent(TDElement, 'onmouseleave', MochiKit.Base.method(this, 'handleTDLeave')); | 108 | this.connectEvent(TDElement, 'onmouseleave', MochiKit.Base.method(this, 'handleTDLeave')); |
111 | } | 109 | } |
112 | // MochiKit.Signal.connect(TDElement, 'onmouseenter', MochiKit.Base.method(this, 'handleTDEnter', anObject)); | 110 | // MochiKit.Signal.connect(TDElement, 'onmouseenter', MochiKit.Base.method(this, 'handleTDEnter', anObject)); |
113 | this.connectEvent(TDElement, 'onmouseenter', MochiKit.Base.method(this, 'handleTDEnter', anObject)); | 111 | this.connectEvent(TDElement, 'onmouseenter', MochiKit.Base.method(this, 'handleTDEnter', anObject)); |
114 | 112 | ||
115 | }, | 113 | }, |
116 | 114 | ||
117 | //========================================================================= | 115 | //========================================================================= |
118 | /* | 116 | /* |
119 | 'handleEllipsesEnter': function (aRecordInfo, anEvent) { | 117 | 'handleEllipsesEnter': function (aRecordInfo, anEvent) { |
120 | this._enterLeaveCounter ++; | 118 | this._enterLeaveCounter ++; |
121 | if (this._enterLeaveCounter > 2) { | 119 | if (this._enterLeaveCounter > 2) { |
122 | this._enterLeaveCounter = 2; | 120 | this._enterLeaveCounter = 2; |
123 | } | 121 | } |
124 | 122 | ||
125 | if (this._enterLeaveCounter == 1) { | 123 | if (this._enterLeaveCounter == 1) { |
126 | this.showDirectLoginListPopup(aRecordInfo, anEvent.src()); | 124 | this.showDirectLoginListPopup(aRecordInfo, anEvent.src()); |
127 | } | 125 | } |
128 | }, | 126 | }, |
129 | 127 | ||
130 | 'handleEllipsesLeave': function (anEvent) { | 128 | 'handleEllipsesLeave': function (anEvent) { |
131 | this._enterLeaveCounter --; | 129 | this._enterLeaveCounter --; |
132 | 130 | ||
133 | MochiKit.Async.callLater(0.3, MochiKit.Base.bind(function () { | 131 | MochiKit.Async.callLater(0.3, MochiKit.Base.bind(function () { |
134 | if (this._enterLeaveCounter == 0) { | 132 | if (this._enterLeaveCounter == 0) { |
135 | this.hideDirectLoginListPopup(); | 133 | this.hideDirectLoginListPopup(); |
136 | } | 134 | } |
137 | }, this)) | 135 | }, this)) |
138 | }, | 136 | }, |
139 | */ | 137 | */ |
140 | //------------------------------------------------------------------------- | 138 | //------------------------------------------------------------------------- |
141 | 139 | ||
142 | 'handleTDEnter': function (aRecordInfo, anEvent) { | 140 | 'handleTDEnter': function (aRecordInfo, anEvent) { |
143 | if (MochiKit.Selector.findChildElements(anEvent.src(), ['div.card_directLogin_ellipses']).length > 0) { | 141 | if (MochiKit.Selector.findChildElements(anEvent.src(), ['div.card_directLogin_ellipses']).length > 0) { |
144 | this._enterLeaveCounter ++; | 142 | this._enterLeaveCounter ++; |
145 | if (this._enterLeaveCounter > 2) { | 143 | if (this._enterLeaveCounter > 2) { |
146 | this._enterLeaveCounter = 2; | 144 | this._enterLeaveCounter = 2; |
147 | } | 145 | } |
148 | 146 | ||
149 | if (this._enterLeaveCounter == 1) { | 147 | if (this._enterLeaveCounter == 1) { |
150 | this.showDirectLoginListPopup(aRecordInfo, anEvent.src()); | 148 | this.showDirectLoginListPopup(aRecordInfo, anEvent.src()); |
151 | } | 149 | } |
152 | } else { | 150 | } else { |
153 | if (this._selectedRowObject != null) { | 151 | if (this._selectedRowObject != null) { |
154 | this.hideDirectLoginListPopup(); | 152 | this.hideDirectLoginListPopup(); |
155 | } | 153 | } |
156 | } | 154 | } |
157 | }, | 155 | }, |
158 | 156 | ||
159 | 'handleTDLeave': function (anEvent) { | 157 | 'handleTDLeave': function (anEvent) { |
160 | this._enterLeaveCounter --; | 158 | this._enterLeaveCounter --; |
161 | if (this._enterLeaveCounter < 0) { | 159 | if (this._enterLeaveCounter < 0) { |
162 | this._enterLeaveCounter = 0; | 160 | this._enterLeaveCounter = 0; |
163 | } | 161 | } |
164 | 162 | ||
165 | MochiKit.Async.callLater(0.3, MochiKit.Base.bind(function () { | 163 | MochiKit.Async.callLater(0.3, MochiKit.Base.bind(function () { |
166 | if (this._enterLeaveCounter == 0) { | 164 | if (this._enterLeaveCounter == 0) { |
167 | this.hideDirectLoginListPopup(); | 165 | this.hideDirectLoginListPopup(); |
168 | } | 166 | } |
169 | }, this)) | 167 | }, this)) |
170 | }, | 168 | }, |
171 | 169 | ||
172 | //------------------------------------------------------------------------- | 170 | //------------------------------------------------------------------------- |
173 | 171 | ||
174 | 'handleDirectLoginListPopupEnter': function (anEvent) { | 172 | 'handleDirectLoginListPopupEnter': function (anEvent) { |
175 | this._enterLeaveCounter ++; | 173 | this._enterLeaveCounter ++; |
176 | if (this._enterLeaveCounter > 2) { | 174 | if (this._enterLeaveCounter > 2) { |
177 | this._enterLeaveCounter = 2; | 175 | this._enterLeaveCounter = 2; |
178 | } | 176 | } |
179 | }, | 177 | }, |
180 | 178 | ||
181 | 'handleDirectLoginListPopupLeave': function (anEvent) { | 179 | 'handleDirectLoginListPopupLeave': function (anEvent) { |
182 | this._enterLeaveCounter --; | 180 | this._enterLeaveCounter --; |
183 | if (this._enterLeaveCounter < 0) { | 181 | if (this._enterLeaveCounter < 0) { |
184 | this._enterLeaveCounter = 0; | 182 | this._enterLeaveCounter = 0; |
185 | } | 183 | } |
186 | 184 | ||
187 | MochiKit.Async.callLater(0.3, MochiKit.Base.bind(function () { | 185 | MochiKit.Async.callLater(0.3, MochiKit.Base.bind(function () { |
188 | if (this._enterLeaveCounter == 0) { | 186 | if (this._enterLeaveCounter == 0) { |
189 | this.hideDirectLoginListPopup(); | 187 | this.hideDirectLoginListPopup(); |
190 | } | 188 | } |
191 | }, this)) | 189 | }, this)) |
192 | }, | 190 | }, |
193 | 191 | ||
194 | //========================================================================= | 192 | //========================================================================= |
195 | 193 | ||
196 | 'showDirectLoginListPopup': function (aRecordInfo, anElement) { | 194 | 'showDirectLoginListPopup': function (aRecordInfo, anElement) { |
197 | var position; | 195 | var position; |
198 | var directLoginsInfo; | 196 | var directLoginsInfo; |
199 | var directLoginsListElement; | 197 | var directLoginsListElement; |
200 | var ellipsesElement; | 198 | var ellipsesElement; |
201 | 199 | ||
202 | 200 | ||
203 | ellipsesElement = MochiKit.Selector.findChildElements(anElement, ['div.card_directLogin_ellipses'])[0]; | 201 | ellipsesElement = MochiKit.Selector.findChildElements(anElement, ['div.card_directLogin_ellipses'])[0]; |
204 | position = MochiKit.Style.getElementPosition(ellipsesElement); | 202 | position = MochiKit.Style.getElementPosition(ellipsesElement); |
205 | // position = MochiKit.Style.getElementPosition(anElement); | 203 | // position = MochiKit.Style.getElementPosition(anElement); |
206 | position.x += 14; | 204 | position.x += 14; |
207 | position.y -= 26; | 205 | position.y -= 26; |
208 | 206 | ||
209 | MochiKit.Style.setElementPosition(this.getId('DirectLoginListPopup'), position /*[, units='px'] */); | 207 | MochiKit.Style.setElementPosition(this.getId('DirectLoginListPopup'), position /*[, units='px'] */); |
210 | 208 | ||
211 | directLoginsListElement = this.getElement('DirectLoginListPopup_list'); | 209 | directLoginsListElement = this.getElement('DirectLoginListPopup_list'); |
212 | directLoginsListElement.innerHTML = ''; | 210 | directLoginsListElement.innerHTML = ''; |
213 | 211 | ||
214 | directLoginsInfo = aRecordInfo[this.name()]; | 212 | directLoginsInfo = aRecordInfo[this.name()]; |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/FaviconColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/FaviconColumnManager.js index 6297002..bdb044a 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/FaviconColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/FaviconColumnManager.js | |||
@@ -1,86 +1,84 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.FaviconColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.FaviconColumnManager = function(args) { |
31 | args = args || {}; | 29 | args = args || {}; |
32 | Clipperz.PM.UI.Web.Components.FaviconColumnManager.superclass.constructor.call(this, args); | 30 | Clipperz.PM.UI.Web.Components.FaviconColumnManager.superclass.constructor.call(this, args); |
33 | 31 | ||
34 | return this; | 32 | return this; |
35 | } | 33 | } |
36 | 34 | ||
37 | //============================================================================= | 35 | //============================================================================= |
38 | 36 | ||
39 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.FaviconColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { | 37 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.FaviconColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { |
40 | 38 | ||
41 | 'toString': function () { | 39 | 'toString': function () { |
42 | return "Clipperz.PM.UI.Web.Components.FaviconColumnManager component"; | 40 | return "Clipperz.PM.UI.Web.Components.FaviconColumnManager component"; |
43 | }, | 41 | }, |
44 | 42 | ||
45 | //------------------------------------------------------------------------- | 43 | //------------------------------------------------------------------------- |
46 | 44 | ||
47 | 'renderCell': function(aRowElement, anObject) { | 45 | 'renderCell': function(aRowElement, anObject) { |
48 | varfaviconImageElement; | 46 | varfaviconImageElement; |
49 | var faviconUrl; | 47 | var faviconUrl; |
50 | 48 | ||
51 | faviconImageElement = this.getId('favicon'); | 49 | faviconImageElement = this.getId('favicon'); |
52 | faviconUrl = anObject[this.name()]; | 50 | faviconUrl = anObject[this.name()]; |
53 | 51 | ||
54 | if (faviconUrl == null) { | 52 | if (faviconUrl == null) { |
55 | faviconUrl = Clipperz.PM.Strings.getValue('defaultFaviconUrl'); | 53 | faviconUrl = Clipperz.PM.Strings.getValue('defaultFaviconUrl'); |
56 | } | 54 | } |
57 | 55 | ||
58 | Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ | 56 | Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ |
59 | {tag:'img', id:faviconImageElement, src:faviconUrl} | 57 | {tag:'img', id:faviconImageElement, src:faviconUrl} |
60 | ]}); | 58 | ]}); |
61 | 59 | ||
62 | MochiKit.Signal.connect(faviconImageElement, 'onload', this, 'handleLoadedFaviconImage'); | 60 | MochiKit.Signal.connect(faviconImageElement, 'onload', this, 'handleLoadedFaviconImage'); |
63 | MochiKit.Signal.connect(faviconImageElement, 'onerror', this, 'handleMissingFaviconImage'); | 61 | MochiKit.Signal.connect(faviconImageElement, 'onerror', this, 'handleMissingFaviconImage'); |
64 | MochiKit.Signal.connect(faviconImageElement, 'onabort', this, 'handleMissingFaviconImage'); | 62 | MochiKit.Signal.connect(faviconImageElement, 'onabort', this, 'handleMissingFaviconImage'); |
65 | }, | 63 | }, |
66 | 64 | ||
67 | //----------------------------------------------------- | 65 | //----------------------------------------------------- |
68 | 66 | ||
69 | 'handleLoadedFaviconImage': function(anEvent) { | 67 | 'handleLoadedFaviconImage': function(anEvent) { |
70 | MochiKit.Signal.disconnectAllTo(anEvent.src()); | 68 | MochiKit.Signal.disconnectAllTo(anEvent.src()); |
71 | if (anEvent.src().complete == false) { | 69 | if (anEvent.src().complete == false) { |
72 | anEvent.src().src = Clipperz.PM.Strings.getValue('defaultFaviconUrl'); | 70 | anEvent.src().src = Clipperz.PM.Strings.getValue('defaultFaviconUrl'); |
73 | } | 71 | } |
74 | }, | 72 | }, |
75 | 73 | ||
76 | //----------------------------------------------------- | 74 | //----------------------------------------------------- |
77 | 75 | ||
78 | 'handleMissingFaviconImage': function(anEvent) { | 76 | 'handleMissingFaviconImage': function(anEvent) { |
79 | MochiKit.Signal.disconnectAllTo(anEvent.src()); | 77 | MochiKit.Signal.disconnectAllTo(anEvent.src()); |
80 | anEvent.src().src = Clipperz.PM.Strings.getValue('defaultFaviconUrl'); | 78 | anEvent.src().src = Clipperz.PM.Strings.getValue('defaultFaviconUrl'); |
81 | }, | 79 | }, |
82 | 80 | ||
83 | //----------------------------------------------------- | 81 | //----------------------------------------------------- |
84 | '__syntax_fix__' : 'syntax fix' | 82 | '__syntax_fix__' : 'syntax fix' |
85 | }); | 83 | }); |
86 | 84 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/GridComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/GridComponent.js index 51d55f4..21dddc9 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/GridComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/GridComponent.js | |||
@@ -1,259 +1,255 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.GridComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.GridComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.GridComponent.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.GridComponent.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._columnsManagers = args.columnsManagers; | 31 | this._columnsManagers = args.columnsManagers; |
34 | 32 | ||
35 | this._rowsObjects = []; | 33 | this._rowsObjects = []; |
36 | this._noRowsGridComponent = null; | 34 | this._noRowsGridComponent = null; |
37 | 35 | ||
38 | this._slots = { | 36 | this._slots = { |
39 | 'headerSlot':this.getId('headerSlot') | 37 | 'headerSlot':this.getId('headerSlot') |
40 | }; | 38 | }; |
41 | 39 | ||
42 | return this; | 40 | return this; |
43 | } | 41 | } |
44 | 42 | ||
45 | //============================================================================= | 43 | //============================================================================= |
46 | 44 | ||
47 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.GridComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 45 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.GridComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { |
48 | 46 | ||
49 | //------------------------------------------------------------------------- | 47 | //------------------------------------------------------------------------- |
50 | 48 | ||
51 | 'toString': function () { | 49 | 'toString': function () { |
52 | return "Clipperz.PM.UI.Web.Components.GridComponent component"; | 50 | return "Clipperz.PM.UI.Web.Components.GridComponent component"; |
53 | }, | 51 | }, |
54 | 52 | ||
55 | //------------------------------------------------------------------------- | 53 | //------------------------------------------------------------------------- |
56 | 54 | ||
57 | 'rows': function () { | 55 | 'rows': function () { |
58 | throw Clipperz.Base.exception.AbstractMethod; | 56 | throw Clipperz.Base.exception.AbstractMethod; |
59 | // return this._rows; | 57 | // return this._rows; |
60 | }, | 58 | }, |
61 | 59 | ||
62 | //------------------------------------------------------------------------- | 60 | //------------------------------------------------------------------------- |
63 | 61 | ||
64 | 'columnsManagers': function () { | 62 | 'columnsManagers': function () { |
65 | return this._columnsManagers; | 63 | return this._columnsManagers; |
66 | }, | 64 | }, |
67 | 65 | ||
68 | //------------------------------------------------------------------------- | 66 | //------------------------------------------------------------------------- |
69 | 67 | ||
70 | 'renderSelf': function(/*aContainer, aPosition*/) { | 68 | 'renderSelf': function(/*aContainer, aPosition*/) { |
71 | this.append(this.element(), [ | 69 | this.append(this.element(), [ |
72 | {tag:'div', cls:'header', children:[ | 70 | {tag:'div', cls:'header', children:[ |
73 | {tag:'form', id:this.getId('searchForm'), cls:'search', children:[ | 71 | {tag:'form', id:this.getId('searchForm'), cls:'search', children:[ |
74 | {tag:'div', cls:'search', children:[ | 72 | {tag:'div', cls:'search', children:[ |
75 | {tag:'input', type:'text', id:this.getId('search'), cls:'search', placeholder:"search", name:'textToSearch'/*, value:"clipperz"*/} | 73 | {tag:'input', type:'text', id:this.getId('search'), cls:'search', placeholder:"search", name:'textToSearch'/*, value:"clipperz"*/} |
76 | ]}, | 74 | ]}, |
77 | {tag:'div', cls:'clearSearchButton', id:this.getId('clearSearch')}, | 75 | {tag:'div', cls:'clearSearchButton', id:this.getId('clearSearch')}, |
78 | // {tag:'input', type:'button', cls:'searchButton', name:'searchButton', value:"search"}, | 76 | // {tag:'input', type:'button', cls:'searchButton', name:'searchButton', value:"search"}, |
79 | {tag:'div', cls:'headerSlot', id:this.getId('headerSlot')} | 77 | {tag:'div', cls:'headerSlot', id:this.getId('headerSlot')} |
80 | ]} | 78 | ]} |
81 | ]}, | 79 | ]}, |
82 | {tag:'div', cls:'body', children:[ | 80 | {tag:'div', cls:'body', children:[ |
83 | {tag:'div', cls:'rows', id:this.getId('rows'), children:[ | 81 | {tag:'div', cls:'rows', id:this.getId('rows'), children:[ |
84 | {tag:'table', cellpadding:'0', cellspacing:'0', cls:'rows', children:[ | 82 | {tag:'table', cellpadding:'0', cellspacing:'0', cls:'rows', children:[ |
85 | {tag:'thead', children:[ | 83 | {tag:'thead', children:[ |
86 | {tag:'tr', id:this.getId('thead_tr'), children:[]} | 84 | {tag:'tr', id:this.getId('thead_tr'), children:[]} |
87 | ]}, | 85 | ]}, |
88 | {tag:'tbody', id:this.getId('gridRows'), children:[]} | 86 | {tag:'tbody', id:this.getId('gridRows'), children:[]} |
89 | ]} | 87 | ]} |
90 | ]}, | 88 | ]}, |
91 | {tag:'div', cls:'noRowsBlock', id:this.getId('noRowsBlock'), children:[]} | 89 | {tag:'div', cls:'noRowsBlock', id:this.getId('noRowsBlock'), children:[]} |
92 | ]}, | 90 | ]}, |
93 | {tag:'div', cls:'footer'} | 91 | {tag:'div', cls:'footer'} |
94 | ]); | 92 | ]); |
95 | 93 | ||
96 | this.renderHeader(); | 94 | this.renderHeader(); |
97 | MochiKit.Signal.connect(this.getId('clearSearch'), 'onclick', this, 'clearSearchHandler'); | 95 | MochiKit.Signal.connect(this.getId('clearSearch'), 'onclick', this, 'clearSearchHandler'); |
98 | }, | 96 | }, |
99 | 97 | ||
100 | //------------------------------------------------------------------------- | 98 | //------------------------------------------------------------------------- |
101 | 99 | ||
102 | 'renderHeader': function () { | 100 | 'renderHeader': function () { |
103 | var headerElement; | 101 | var headerElement; |
104 | 102 | ||
105 | headerElement = this.getElement('thead_tr'); | 103 | headerElement = this.getElement('thead_tr'); |
106 | headerElement.innerHTML = ""; | 104 | headerElement.innerHTML = ""; |
107 | 105 | ||
108 | MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) { | 106 | MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) { |
109 | aColumnManager.renderHeader(headerElement); | 107 | aColumnManager.renderHeader(headerElement); |
110 | }); | 108 | }); |
111 | }, | 109 | }, |
112 | 110 | ||
113 | //------------------------------------------------------------------------- | 111 | //------------------------------------------------------------------------- |
114 | 112 | ||
115 | 'update': function (someObjects) { | 113 | 'update': function (someObjects) { |
116 | this._rowsObjects = someObjects | 114 | this._rowsObjects = someObjects |
117 | this.refresh(); | 115 | this.refresh(); |
118 | this.focus(); | 116 | this.focus(); |
119 | }, | 117 | }, |
120 | 118 | ||
121 | 'focus': function () { | 119 | 'focus': function () { |
122 | this.getElement('search').focus(); | 120 | this.getElement('search').focus(); |
123 | }, | 121 | }, |
124 | 122 | ||
125 | //------------------------------------------------------------------------- | 123 | //------------------------------------------------------------------------- |
126 | 124 | ||
127 | 'startSearch': function () { | 125 | 'startSearch': function () { |
128 | //console.log("--> startSearch"); | ||
129 | MochiKit.DOM.addElementClass(this.getElement('search'), 'running'); | 126 | MochiKit.DOM.addElementClass(this.getElement('search'), 'running'); |
130 | }, | 127 | }, |
131 | 128 | ||
132 | 'endSearch': function () { | 129 | 'endSearch': function () { |
133 | MochiKit.DOM.removeElementClass(this.getElement('search'), 'running'); | 130 | MochiKit.DOM.removeElementClass(this.getElement('search'), 'running'); |
134 | //console.log("<-- startSearch"); | ||
135 | }, | 131 | }, |
136 | 132 | ||
137 | //------------------------------------------------------------------------- | 133 | //------------------------------------------------------------------------- |
138 | 134 | ||
139 | 'disconnectColumnManagersRowsSignals': function () { | 135 | 'disconnectColumnManagersRowsSignals': function () { |
140 | MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) { | 136 | MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) { |
141 | aColumnManager.disconnectRowsSignals(); | 137 | aColumnManager.disconnectRowsSignals(); |
142 | }); | 138 | }); |
143 | }, | 139 | }, |
144 | 140 | ||
145 | //------------------------------------------------------------------------- | 141 | //------------------------------------------------------------------------- |
146 | 142 | ||
147 | 'refresh': function () { | 143 | 'refresh': function () { |
148 | var gridRowsElement; | 144 | var gridRowsElement; |
149 | var rowClass; | 145 | var rowClass; |
150 | 146 | ||
151 | this.disconnectColumnManagersRowsSignals(); | 147 | this.disconnectColumnManagersRowsSignals(); |
152 | 148 | ||
153 | { | 149 | { |
154 | MochiKit.DOM.removeElementClass(this.getElement('search'), 'disabled'); | 150 | MochiKit.DOM.removeElementClass(this.getElement('search'), 'disabled'); |
155 | // MochiKit.DOM.setNodeAttribute(this.getElement('search'), 'disabled', null); | 151 | // MochiKit.DOM.setNodeAttribute(this.getElement('search'), 'disabled', null); |
156 | MochiKit.DOM.removeElementClass(this.element(), 'empty'); | 152 | MochiKit.DOM.removeElementClass(this.element(), 'empty'); |
157 | MochiKit.DOM.removeElementClass(this.element(), 'noRows'); | 153 | MochiKit.DOM.removeElementClass(this.element(), 'noRows'); |
158 | } | 154 | } |
159 | 155 | ||
160 | 156 | ||
161 | gridRowsElement = this.getElement('gridRows'); | 157 | gridRowsElement = this.getElement('gridRows'); |
162 | gridRowsElement.innerHTML = ""; | 158 | gridRowsElement.innerHTML = ""; |
163 | 159 | ||
164 | MochiKit.DOM.removeElementClass(this.element(), 'empty'); | 160 | MochiKit.DOM.removeElementClass(this.element(), 'empty'); |
165 | 161 | ||
166 | rowClass = 'odd'; | 162 | rowClass = 'odd'; |
167 | MochiKit.Iter.forEach(this._rowsObjects, MochiKit.Base.bind(function (aRowObject) { | 163 | MochiKit.Iter.forEach(this._rowsObjects, MochiKit.Base.bind(function (aRowObject) { |
168 | var cardRowElement; | 164 | var cardRowElement; |
169 | 165 | ||
170 | cardRowElement = this.append(gridRowsElement, {tag:'tr', id:this.getId(aRowObject['_reference']), cls:rowClass}); | 166 | cardRowElement = this.append(gridRowsElement, {tag:'tr', id:this.getId(aRowObject['_reference']), cls:rowClass}); |
171 | MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) { | 167 | MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) { |
172 | aColumnManager.renderCell(cardRowElement, aRowObject); | 168 | aColumnManager.renderCell(cardRowElement, aRowObject); |
173 | }); | 169 | }); |
174 | 170 | ||
175 | rowClass = (rowClass == 'odd') ? 'even' : 'odd'; | 171 | rowClass = (rowClass == 'odd') ? 'even' : 'odd'; |
176 | }, this)); | 172 | }, this)); |
177 | }, | 173 | }, |
178 | 174 | ||
179 | //----------------------------------------------------------------------------- | 175 | //----------------------------------------------------------------------------- |
180 | 176 | ||
181 | 'filterElement': function () { | 177 | 'filterElement': function () { |
182 | return this.getElement('search'); | 178 | return this.getElement('search'); |
183 | }, | 179 | }, |
184 | 180 | ||
185 | //------------------------------------------------------------------------- | 181 | //------------------------------------------------------------------------- |
186 | 182 | ||
187 | 'shouldShowElementWhileRendering': function () { | 183 | 'shouldShowElementWhileRendering': function () { |
188 | return false; | 184 | return false; |
189 | }, | 185 | }, |
190 | 186 | ||
191 | //------------------------------------------------------------------------- | 187 | //------------------------------------------------------------------------- |
192 | 188 | ||
193 | 'selectRow': function (aRowObject) { | 189 | 'selectRow': function (aRowObject) { |
194 | MochiKit.DOM.addElementClass(this.getId(aRowObject['_reference']), 'selected'); | 190 | MochiKit.DOM.addElementClass(this.getId(aRowObject['_reference']), 'selected'); |
195 | }, | 191 | }, |
196 | 192 | ||
197 | 'unselectRow': function (aRowObject) { | 193 | 'unselectRow': function (aRowObject) { |
198 | MochiKit.DOM.removeElementClass(this.getId(aRowObject['_reference']), 'selected'); | 194 | MochiKit.DOM.removeElementClass(this.getId(aRowObject['_reference']), 'selected'); |
199 | }, | 195 | }, |
200 | 196 | ||
201 | //------------------------------------------------------------------------- | 197 | //------------------------------------------------------------------------- |
202 | /* | 198 | /* |
203 | 'passOpenDirectLogin': function(aDirectLoginReferenceId) { | 199 | 'passOpenDirectLogin': function(aDirectLoginReferenceId) { |
204 | MochiKit.Signal.signal(this, 'openDirectLogin', aDirectLoginReferenceId); | 200 | MochiKit.Signal.signal(this, 'openDirectLogin', aDirectLoginReferenceId); |
205 | }, | 201 | }, |
206 | */ | 202 | */ |
207 | //------------------------------------------------------------------------- | 203 | //------------------------------------------------------------------------- |
208 | 204 | ||
209 | 'clearSearchHandler': function (anEvent) { | 205 | 'clearSearchHandler': function (anEvent) { |
210 | var searchElement; | 206 | var searchElement; |
211 | 207 | ||
212 | anEvent.preventDefault(); | 208 | anEvent.preventDefault(); |
213 | 209 | ||
214 | searchElement = this.getElement('search'); | 210 | searchElement = this.getElement('search'); |
215 | searchElement.value = ""; | 211 | searchElement.value = ""; |
216 | searchElement.focus(); | 212 | searchElement.focus(); |
217 | }, | 213 | }, |
218 | 214 | ||
219 | //------------------------------------------------------------------------- | 215 | //------------------------------------------------------------------------- |
220 | 216 | ||
221 | 'drawEmpty': function () { | 217 | 'drawEmpty': function () { |
222 | this.disconnectColumnManagersRowsSignals(); | 218 | this.disconnectColumnManagersRowsSignals(); |
223 | MochiKit.DOM.addElementClass(this.getElement('search'), 'disabled'); | 219 | MochiKit.DOM.addElementClass(this.getElement('search'), 'disabled'); |
224 | // MochiKit.DOM.setNodeAttribute(this.getElement('search'), 'disabled', 'disabled'); | 220 | // MochiKit.DOM.setNodeAttribute(this.getElement('search'), 'disabled', 'disabled'); |
225 | 221 | ||
226 | gridRowsElement = this.getElement('gridRows'); | 222 | gridRowsElement = this.getElement('gridRows'); |
227 | gridRowsElement.innerHTML = ""; | 223 | gridRowsElement.innerHTML = ""; |
228 | MochiKit.DOM.addElementClass(this.element(), 'empty'); | 224 | MochiKit.DOM.addElementClass(this.element(), 'empty'); |
229 | }, | 225 | }, |
230 | 226 | ||
231 | //------------------------------------------------------------------------- | 227 | //------------------------------------------------------------------------- |
232 | 228 | ||
233 | 'setNoRowsGridComponent': function (aComponent) { | 229 | 'setNoRowsGridComponent': function (aComponent) { |
234 | this.removeNoRowsGridComponent(); | 230 | this.removeNoRowsGridComponent(); |
235 | this._noRowsGridComponent = aComponent; | 231 | this._noRowsGridComponent = aComponent; |
236 | 232 | ||
237 | this.disconnectColumnManagersRowsSignals(); | 233 | this.disconnectColumnManagersRowsSignals(); |
238 | MochiKit.DOM.addElementClass(this.getElement('search'), 'disabled'); | 234 | MochiKit.DOM.addElementClass(this.getElement('search'), 'disabled'); |
239 | // MochiKit.DOM.setNodeAttribute(this.getElement('search'), 'disabled', 'disabled'); | 235 | // MochiKit.DOM.setNodeAttribute(this.getElement('search'), 'disabled', 'disabled'); |
240 | 236 | ||
241 | gridRowsElement = this.getElement('gridRows'); | 237 | gridRowsElement = this.getElement('gridRows'); |
242 | gridRowsElement.innerHTML = ""; | 238 | gridRowsElement.innerHTML = ""; |
243 | MochiKit.DOM.addElementClass(this.element(), 'noRows'); | 239 | MochiKit.DOM.addElementClass(this.element(), 'noRows'); |
244 | 240 | ||
245 | if (aComponent != null) { | 241 | if (aComponent != null) { |
246 | aComponent.renderInNode(this.getElement('noRowsBlock')); | 242 | aComponent.renderInNode(this.getElement('noRowsBlock')); |
247 | } | 243 | } |
248 | }, | 244 | }, |
249 | 245 | ||
250 | 'removeNoRowsGridComponent': function () { | 246 | 'removeNoRowsGridComponent': function () { |
251 | if (this._noRowsGridComponent != null) { | 247 | if (this._noRowsGridComponent != null) { |
252 | this._noRowsGridComponent.remove(); | 248 | this._noRowsGridComponent.remove(); |
253 | this._noRowsGridComponent = null; | 249 | this._noRowsGridComponent = null; |
254 | } | 250 | } |
255 | }, | 251 | }, |
256 | 252 | ||
257 | //------------------------------------------------------------------------- | 253 | //------------------------------------------------------------------------- |
258 | __syntaxFix__: "syntax fix" | 254 | __syntaxFix__: "syntax fix" |
259 | }); | 255 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ImageColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ImageColumnManager.js index 3e03fcf..d1d9d7f 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ImageColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ImageColumnManager.js | |||
@@ -1,65 +1,63 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.ImageColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.ImageColumnManager = function(args) { |
31 | args = args || {}; | 29 | args = args || {}; |
32 | Clipperz.PM.UI.Web.Components.ImageColumnManager.superclass.constructor.call(this, args); | 30 | Clipperz.PM.UI.Web.Components.ImageColumnManager.superclass.constructor.call(this, args); |
33 | 31 | ||
34 | return this; | 32 | return this; |
35 | } | 33 | } |
36 | 34 | ||
37 | //============================================================================= | 35 | //============================================================================= |
38 | 36 | ||
39 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.ImageColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { | 37 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.ImageColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { |
40 | 38 | ||
41 | 'toString': function () { | 39 | 'toString': function () { |
42 | return "Clipperz.PM.UI.Web.Components.ImageColumnManager component"; | 40 | return "Clipperz.PM.UI.Web.Components.ImageColumnManager component"; |
43 | }, | 41 | }, |
44 | 42 | ||
45 | //------------------------------------------------------------------------- | 43 | //------------------------------------------------------------------------- |
46 | 44 | ||
47 | 'renderCell': function(aRowElement, anObject) { | 45 | 'renderCell': function(aRowElement, anObject) { |
48 | Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ | 46 | Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ |
49 | {tag:'img', src:anObject[this.name()]} | 47 | {tag:'img', src:anObject[this.name()]} |
50 | ]}); | 48 | ]}); |
51 | 49 | ||
52 | // return Clipperz.Async.callbacks("ImageColumnManager.renderCell", [ | 50 | // return Clipperz.Async.callbacks("ImageColumnManager.renderCell", [ |
53 | // this.selector(), | 51 | // this.selector(), |
54 | // MochiKit.Base.bind(function (aValue) { | 52 | // MochiKit.Base.bind(function (aValue) { |
55 | // Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ | 53 | // Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ |
56 | // {tag:'img', src:aValue} | 54 | // {tag:'img', src:aValue} |
57 | // ]}); | 55 | // ]}); |
58 | // }, this) | 56 | // }, this) |
59 | // ], {trace:false}, anObject); | 57 | // ], {trace:false}, anObject); |
60 | }, | 58 | }, |
61 | 59 | ||
62 | //----------------------------------------------------- | 60 | //----------------------------------------------------- |
63 | '__syntax_fix__' : 'syntax fix' | 61 | '__syntax_fix__' : 'syntax fix' |
64 | }); | 62 | }); |
65 | 63 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LinkColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LinkColumnManager.js index f3f9cd5..69f735b 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LinkColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LinkColumnManager.js | |||
@@ -1,89 +1,87 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.LinkColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.LinkColumnManager = function(args) { |
31 | args = args || {}; | 29 | args = args || {}; |
32 | Clipperz.PM.UI.Web.Components.LinkColumnManager.superclass.constructor.call(this, args); | 30 | Clipperz.PM.UI.Web.Components.LinkColumnManager.superclass.constructor.call(this, args); |
33 | 31 | ||
34 | this._actionMethod = args.actionMethod || null; | 32 | this._actionMethod = args.actionMethod || null; |
35 | 33 | ||
36 | return this; | 34 | return this; |
37 | } | 35 | } |
38 | 36 | ||
39 | //============================================================================= | 37 | //============================================================================= |
40 | 38 | ||
41 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LinkColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { | 39 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LinkColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { |
42 | 40 | ||
43 | 'toString': function () { | 41 | 'toString': function () { |
44 | return "Clipperz.PM.UI.Web.Components.DateColumnManager component"; | 42 | return "Clipperz.PM.UI.Web.Components.DateColumnManager component"; |
45 | }, | 43 | }, |
46 | 44 | ||
47 | //------------------------------------------------------------------------- | 45 | //------------------------------------------------------------------------- |
48 | 46 | ||
49 | 'actionMethod': function () { | 47 | 'actionMethod': function () { |
50 | return this._actionMethod; | 48 | return this._actionMethod; |
51 | }, | 49 | }, |
52 | 50 | ||
53 | //------------------------------------------------------------------------- | 51 | //------------------------------------------------------------------------- |
54 | 52 | ||
55 | 'renderCell': function(aRowElement, anObject) { | 53 | 'renderCell': function(aRowElement, anObject) { |
56 | vartdElement; | 54 | vartdElement; |
57 | varlinkElement; | 55 | varlinkElement; |
58 | 56 | ||
59 | tdElement = Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ | 57 | tdElement = Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ |
60 | {tag:'span', children:[ | 58 | {tag:'span', children:[ |
61 | {tag:'a', href:'#', html:anObject[this.name()]} | 59 | {tag:'a', href:'#', html:anObject[this.name()]} |
62 | ]} | 60 | ]} |
63 | ]}); | 61 | ]}); |
64 | 62 | ||
65 | linkElement = MochiKit.DOM.getFirstElementByTagAndClassName('a', null, tdElement); | 63 | linkElement = MochiKit.DOM.getFirstElementByTagAndClassName('a', null, tdElement); |
66 | // MochiKit.Signal.connect(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); | 64 | // MochiKit.Signal.connect(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); |
67 | this.connectEvent(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); | 65 | this.connectEvent(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); |
68 | }, | 66 | }, |
69 | 67 | ||
70 | //----------------------------------------------------- | 68 | //----------------------------------------------------- |
71 | 69 | ||
72 | 'handleLinkClick': function (anObject, anEvent) { | 70 | 'handleLinkClick': function (anObject, anEvent) { |
73 | anEvent.preventDefault(); | 71 | anEvent.preventDefault(); |
74 | 72 | ||
75 | if (this.actionMethod() != null) { | 73 | if (this.actionMethod() != null) { |
76 | var deferredResult; | 74 | var deferredResult; |
77 | 75 | ||
78 | deferredResult = new Clipperz.Async.Deferred("LinkColumnManager.handleLinkClick", {trace:false}); | 76 | deferredResult = new Clipperz.Async.Deferred("LinkColumnManager.handleLinkClick", {trace:false}); |
79 | // deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'selectRow', anObject); | 77 | // deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'selectRow', anObject); |
80 | deferredResult.addCallback(this.actionMethod(), anObject, anEvent); | 78 | deferredResult.addCallback(this.actionMethod(), anObject, anEvent); |
81 | // deferredResult.addBothPass(MochiKit.Signal.signal, this, 'unselectRow', anObject); | 79 | // deferredResult.addBothPass(MochiKit.Signal.signal, this, 'unselectRow', anObject); |
82 | deferredResult.callback(); | 80 | deferredResult.callback(); |
83 | } | 81 | } |
84 | }, | 82 | }, |
85 | 83 | ||
86 | //----------------------------------------------------- | 84 | //----------------------------------------------------- |
87 | '__syntax_fix__' : 'syntax fix' | 85 | '__syntax_fix__' : 'syntax fix' |
88 | }); | 86 | }); |
89 | 87 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js index a10ba4f..38a9421 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js | |||
@@ -1,178 +1,176 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.LoginForm = function(args) { | 26 | Clipperz.PM.UI.Web.Components.LoginForm = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | this._autocomplete = args.autocomplete || 'off'; | 29 | this._autocomplete = args.autocomplete || 'off'; |
32 | 30 | ||
33 | Clipperz.PM.UI.Web.Components.LoginForm.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.UI.Web.Components.LoginForm.superclass.constructor.apply(this, arguments); |
34 | 32 | ||
35 | this._slots = { | 33 | this._slots = { |
36 | 'passphraseEntropy':this.getId('passphraseEntropy') | 34 | 'passphraseEntropy':this.getId('passphraseEntropy') |
37 | }; | 35 | }; |
38 | 36 | ||
39 | return this; | 37 | return this; |
40 | } | 38 | } |
41 | 39 | ||
42 | //============================================================================= | 40 | //============================================================================= |
43 | 41 | ||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, { | 42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, { |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
47 | 45 | ||
48 | 'toString': function () { | 46 | 'toString': function () { |
49 | return "Clipperz.PM.UI.Web.Components.LoginForm component"; | 47 | return "Clipperz.PM.UI.Web.Components.LoginForm component"; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | 'autocomplete': function () { | 50 | 'autocomplete': function () { |
53 | return this._autocomplete; | 51 | return this._autocomplete; |
54 | }, | 52 | }, |
55 | 53 | ||
56 | //------------------------------------------------------------------------- | 54 | //------------------------------------------------------------------------- |
57 | 55 | ||
58 | 'renderSelf': function() { | 56 | 'renderSelf': function() { |
59 | this.append(this.element(), {tag:'div', id:'loginBox', children:[ | 57 | this.append(this.element(), {tag:'div', id:'loginBox', children:[ |
60 | {tag:'div', cls:'header'}, | 58 | {tag:'div', cls:'header'}, |
61 | {tag:'div', cls:'body', id:this.getId('body'), children:[ | 59 | {tag:'div', cls:'body', id:this.getId('body'), children:[ |
62 | {tag:'div', id:this.getId('loginForm'), children:[ | 60 | {tag:'div', id:this.getId('loginForm'), children:[ |
63 | {tag:'div', children:[ | 61 | {tag:'div', children:[ |
64 | {tag:'h4', html:'Login'}, | 62 | {tag:'h4', html:'Login'}, |
65 | // {tag:'form', cls:'loginForm', autocomplete:this.autocomplete(), children:[ | 63 | // {tag:'form', cls:'loginForm', autocomplete:this.autocomplete(), children:[ |
66 | {tag:'form', id:this.getId('form'), cls:'loginForm', children:[ | 64 | {tag:'form', id:this.getId('form'), cls:'loginForm', children:[ |
67 | {tag:'label', html:'username', 'for':this.getId('usernameField')}, | 65 | {tag:'label', html:'username', 'for':this.getId('usernameField')}, |
68 | {tag:'input', id:this.getId('usernameField'), type:'text', cls:'username'}, | 66 | {tag:'input', id:this.getId('usernameField'), type:'text', cls:'username'}, |
69 | {tag:'label', html:'passphrase / OTP', 'for':this.getId('passphraseField')}, | 67 | {tag:'label', html:'passphrase / OTP', 'for':this.getId('passphraseField')}, |
70 | {tag:'input', id:this.getId('passphraseField'), type:'password', cls:'password'}, | 68 | {tag:'input', id:this.getId('passphraseField'), type:'password', cls:'password'}, |
71 | 69 | ||
72 | {tag:'div', cls:'translations', children:[ | 70 | {tag:'div', cls:'translations', children:[ |
73 | {tag:'h4', html:'choose your language'}, | 71 | {tag:'h4', html:'choose your language'}, |
74 | {tag:'ul', children:[ | 72 | {tag:'ul', children:[ |
75 | {tag:'li', cls:'selected', html:'english'}, | 73 | {tag:'li', cls:'selected', html:'english'}, |
76 | {tag:'li', html:'italiano'}, | 74 | {tag:'li', html:'italiano'}, |
77 | {tag:'li', html:'dutch'}, | 75 | {tag:'li', html:'dutch'}, |
78 | {tag:'li', html:'french'}, | 76 | {tag:'li', html:'french'}, |
79 | {tag:'li', html:'spanish'}, | 77 | {tag:'li', html:'spanish'}, |
80 | {tag:'li', html:'chinese'}, | 78 | {tag:'li', html:'chinese'}, |
81 | {tag:'li', html:'japanese'}, | 79 | {tag:'li', html:'japanese'}, |
82 | {tag:'li', html:'portugal'}, | 80 | {tag:'li', html:'portugal'}, |
83 | {tag:'li', html:'arabic'} | 81 | {tag:'li', html:'arabic'} |
84 | ]} | 82 | ]} |
85 | ]}, | 83 | ]}, |
86 | 84 | ||
87 | {tag:'input', id:this.getId('submitButton'), type:'submit', value:'login', cls:'submit'} | 85 | {tag:'input', id:this.getId('submitButton'), type:'submit', value:'login', cls:'submit'} |
88 | ]} | 86 | ]} |
89 | ]} | 87 | ]} |
90 | ]} | 88 | ]} |
91 | ]}, | 89 | ]}, |
92 | {tag:'div', cls:'footer'} | 90 | {tag:'div', cls:'footer'} |
93 | ]}); | 91 | ]}); |
94 | 92 | ||
95 | if (this.autocomplete() == 'off') { | 93 | if (this.autocomplete() == 'off') { |
96 | MochiKit.DOM.updateNodeAttributes(this.getElement('form'), {autocomplete:'off'}); | 94 | MochiKit.DOM.updateNodeAttributes(this.getElement('form'), {autocomplete:'off'}); |
97 | } | 95 | } |
98 | 96 | ||
99 | // Clipperz.Style.setBackgroundGradient(this.getElement('body'), {from:"#ff9955", to:"#ff6622"}) | 97 | // Clipperz.Style.setBackgroundGradient(this.getElement('body'), {from:"#ff9955", to:"#ff6622"}) |
100 | 98 | ||
101 | // this.setEntropyDisplay(new Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay(this.getElement('passphraseField'))); | 99 | // this.setEntropyDisplay(new Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay(this.getElement('passphraseField'))); |
102 | 100 | ||
103 | // MochiKit.Signal.connect(this.getId('otpCheckbox'), 'onclick', this, 'togglePasswordFields'); | 101 | // MochiKit.Signal.connect(this.getId('otpCheckbox'), 'onclick', this, 'togglePasswordFields'); |
104 | // this.showPassphraseField(); | 102 | // this.showPassphraseField(); |
105 | 103 | ||
106 | this.getElement('usernameField').focus(); | 104 | this.getElement('usernameField').focus(); |
107 | 105 | ||
108 | MochiKit.Signal.connect(this.getElement('loginForm'), 'onsubmit', this, 'loginEventHandler'); | 106 | MochiKit.Signal.connect(this.getElement('loginForm'), 'onsubmit', this, 'loginEventHandler'); |
109 | }, | 107 | }, |
110 | 108 | ||
111 | //----------------------------------------------------------------------------- | 109 | //----------------------------------------------------------------------------- |
112 | /* | 110 | /* |
113 | 'togglePasswordFields': function(anEvent) { | 111 | 'togglePasswordFields': function(anEvent) { |
114 | var shouldUseOTP; | 112 | var shouldUseOTP; |
115 | 113 | ||
116 | shouldUseOTP = this.getElement('otpCheckbox').checked; | 114 | shouldUseOTP = this.getElement('otpCheckbox').checked; |
117 | 115 | ||
118 | if (shouldUseOTP == false) { | 116 | if (shouldUseOTP == false) { |
119 | this.showPassphraseField(); | 117 | this.showPassphraseField(); |
120 | } else { | 118 | } else { |
121 | this.showOTPFields(); | 119 | this.showOTPFields(); |
122 | } | 120 | } |
123 | }, | 121 | }, |
124 | */ | 122 | */ |
125 | //----------------------------------------------------------------------------- | 123 | //----------------------------------------------------------------------------- |
126 | /* | 124 | /* |
127 | 'showPassphraseField': function() { | 125 | 'showPassphraseField': function() { |
128 | this.showElement('passphraseOption'); | 126 | this.showElement('passphraseOption'); |
129 | this.hideElement('otpOption'); | 127 | this.hideElement('otpOption'); |
130 | }, | 128 | }, |
131 | */ | 129 | */ |
132 | //----------------------------------------------------------------------------- | 130 | //----------------------------------------------------------------------------- |
133 | 131 | ||
134 | 'focusOnPassphraseField': function () { | 132 | 'focusOnPassphraseField': function () { |
135 | this.getElement('passphraseField').focus(); | 133 | this.getElement('passphraseField').focus(); |
136 | this.getElement('passphraseField').select(); | 134 | this.getElement('passphraseField').select(); |
137 | }, | 135 | }, |
138 | 136 | ||
139 | //----------------------------------------------------------------------------- | 137 | //----------------------------------------------------------------------------- |
140 | /* | 138 | /* |
141 | 'showOTPFields': function() { | 139 | 'showOTPFields': function() { |
142 | this.hideElement('passphraseOption'); | 140 | this.hideElement('passphraseOption'); |
143 | this.showElement('otpOption'); | 141 | this.showElement('otpOption'); |
144 | }, | 142 | }, |
145 | */ | 143 | */ |
146 | //------------------------------------------------------------------------- | 144 | //------------------------------------------------------------------------- |
147 | 145 | ||
148 | 'loginEventHandler': function(anEvent) { | 146 | 'loginEventHandler': function(anEvent) { |
149 | // varusername; | 147 | // varusername; |
150 | // var passphrase; | 148 | // var passphrase; |
151 | var signalArguments; | 149 | var signalArguments; |
152 | 150 | ||
153 | anEvent.preventDefault(); | 151 | anEvent.preventDefault(); |
154 | 152 | ||
155 | // username = this.getElement('usernameField').value; | 153 | // username = this.getElement('usernameField').value; |
156 | // passphrase = this.getElement('passphraseField').value; | 154 | // passphrase = this.getElement('passphraseField').value; |
157 | 155 | ||
158 | // signalArguments = {username:username}; | 156 | // signalArguments = {username:username}; |
159 | // signalArguments.passphrase = passphrase; | 157 | // signalArguments.passphrase = passphrase; |
160 | 158 | ||
161 | signalArguments = { | 159 | signalArguments = { |
162 | 'username': this.getElement('usernameField').value, | 160 | 'username': this.getElement('usernameField').value, |
163 | 'passphrase':this.getElement('passphraseField').value | 161 | 'passphrase':this.getElement('passphraseField').value |
164 | }; | 162 | }; |
165 | 163 | ||
166 | MochiKit.Signal.signal(this, 'doLogin', signalArguments); | 164 | MochiKit.Signal.signal(this, 'doLogin', signalArguments); |
167 | }, | 165 | }, |
168 | 166 | ||
169 | //------------------------------------------------------------------------- | 167 | //------------------------------------------------------------------------- |
170 | 168 | ||
171 | 'submitButtonElement': function() { | 169 | 'submitButtonElement': function() { |
172 | return this.getElement('submitButton'); | 170 | return this.getElement('submitButton'); |
173 | }, | 171 | }, |
174 | 172 | ||
175 | //------------------------------------------------------------------------- | 173 | //------------------------------------------------------------------------- |
176 | 174 | ||
177 | __syntaxFix__: "syntax fix" | 175 | __syntaxFix__: "syntax fix" |
178 | }); | 176 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginPage.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginPage.js index 2894af8..3498e3f 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginPage.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginPage.js | |||
@@ -1,203 +1,201 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.LoginPage = function(args) { | 26 | Clipperz.PM.UI.Web.Components.LoginPage = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.LoginPage.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.LoginPage.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._slots = { | 31 | this._slots = { |
34 | 'loginForm':this.getId('loginBoxSlot') | 32 | 'loginForm':this.getId('loginBoxSlot') |
35 | }; | 33 | }; |
36 | 34 | ||
37 | return this; | 35 | return this; |
38 | } | 36 | } |
39 | 37 | ||
40 | //============================================================================= | 38 | //============================================================================= |
41 | 39 | ||
42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginPage, Clipperz.PM.UI.Common.Components.BaseComponent, { | 40 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginPage, Clipperz.PM.UI.Common.Components.BaseComponent, { |
43 | 41 | ||
44 | //------------------------------------------------------------------------- | 42 | //------------------------------------------------------------------------- |
45 | 43 | ||
46 | 'toString': function () { | 44 | 'toString': function () { |
47 | return "Clipperz.PM.UI.Web.Components.LoginPage component"; | 45 | return "Clipperz.PM.UI.Web.Components.LoginPage component"; |
48 | }, | 46 | }, |
49 | 47 | ||
50 | //------------------------------------------------------------------------- | 48 | //------------------------------------------------------------------------- |
51 | 49 | ||
52 | 'renderSelf': function(/*aContainer, aPosition*/) { | 50 | 'renderSelf': function(/*aContainer, aPosition*/) { |
53 | this.append(this.element(), [ | 51 | this.append(this.element(), [ |
54 | {tag:'div', id:this.getId('loginBoxSlot')}, | 52 | {tag:'div', id:this.getId('loginBoxSlot')}, |
55 | {tag:'div', id:'main', children:[ | 53 | {tag:'div', id:'main', children:[ |
56 | {tag:'div', id:'featurePoints', children:[ | 54 | {tag:'div', id:'featurePoints', children:[ |
57 | {tag:'table', children:[ | 55 | {tag:'table', children:[ |
58 | {tag:'tr', children:[ | 56 | {tag:'tr', children:[ |
59 | {tag:'td', children:[ | 57 | {tag:'td', children:[ |
60 | {tag:'div', cls:'block', children:[ | 58 | {tag:'div', cls:'block', children:[ |
61 | {tag:'h3', html:'Clipperz is:'}, | 59 | {tag:'h3', html:'Clipperz is:'}, |
62 | {tag:'ul', children:[ | 60 | {tag:'ul', children:[ |
63 | {tag:'li', html:'a secure and simple password manager'}, | 61 | {tag:'li', html:'a secure and simple password manager'}, |
64 | {tag:'li', html:'an effective single sign-on solution'}, | 62 | {tag:'li', html:'an effective single sign-on solution'}, |
65 | {tag:'li', html:'a digital vault for your personal data'} | 63 | {tag:'li', html:'a digital vault for your personal data'} |
66 | ]} | 64 | ]} |
67 | ]}, | 65 | ]}, |
68 | {tag:'div', cls:'block', children:[ | 66 | {tag:'div', cls:'block', children:[ |
69 | {tag:'h3', html:'Clipperz benefits:'}, | 67 | {tag:'h3', html:'Clipperz benefits:'}, |
70 | {tag:'ul', children:[ | 68 | {tag:'ul', children:[ |
71 | {tag:'li', html:'free and completely anonymous'}, | 69 | {tag:'li', html:'free and completely anonymous'}, |
72 | {tag:'li', html:'access it any time from any computer'}, | 70 | {tag:'li', html:'access it any time from any computer'}, |
73 | {tag:'li', html:'no software to download and nothing to install'}, | 71 | {tag:'li', html:'no software to download and nothing to install'}, |
74 | {tag:'li', html:'avoid keeping secrets on your PC or on paper'} | 72 | {tag:'li', html:'avoid keeping secrets on your PC or on paper'} |
75 | ]} | 73 | ]} |
76 | ]} | 74 | ]} |
77 | ]}, {tag:'td', children:[ | 75 | ]}, {tag:'td', children:[ |
78 | {tag:'div', cls:'block', children:[ | 76 | {tag:'div', cls:'block', children:[ |
79 | {tag:'h3', html:'Clipperz security:'}, | 77 | {tag:'h3', html:'Clipperz security:'}, |
80 | {tag:'ul', children:[ | 78 | {tag:'ul', children:[ |
81 | {tag:'li', html:'your secretes are locally encrypted by your browser before being uploaded to Clipperz'}, | 79 | {tag:'li', html:'your secretes are locally encrypted by your browser before being uploaded to Clipperz'}, |
82 | {tag:'li', html:'the encryption key is a passphrase known only to you'}, | 80 | {tag:'li', html:'the encryption key is a passphrase known only to you'}, |
83 | {tag:'li', html:'Clipperz hosts your sensitive data in an encrypted form and could never access the data in its plain form'}, | 81 | {tag:'li', html:'Clipperz hosts your sensitive data in an encrypted form and could never access the data in its plain form'}, |
84 | {tag:'li', html:'Clipperz is built upon standard encryption schemes, nothing fancies of homemade'}, | 82 | {tag:'li', html:'Clipperz is built upon standard encryption schemes, nothing fancies of homemade'}, |
85 | {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!'} | 83 | {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!'} |
86 | ]} | 84 | ]} |
87 | ]} | 85 | ]} |
88 | ]} | 86 | ]} |
89 | ]} | 87 | ]} |
90 | ]} | 88 | ]} |
91 | ]}, | 89 | ]}, |
92 | {tag:'div', cls:'activeFeatures', children:[ | 90 | {tag:'div', cls:'activeFeatures', children:[ |
93 | {tag:'div', id:this.getId('registerButton'), cls:'createAccountLink', children:[ | 91 | {tag:'div', id:this.getId('registerButton'), cls:'createAccountLink', children:[ |
94 | {tag:'canvas', id:this.getId('registerButtonIcon')}, | 92 | {tag:'canvas', id:this.getId('registerButtonIcon')}, |
95 | {tag:'a', href:'#', id:this.getId('createAccountLink'), cls:'createAccountLink', children:[ | 93 | {tag:'a', href:'#', id:this.getId('createAccountLink'), cls:'createAccountLink', children:[ |
96 | {tag:'span', cls:'payoff', html:"Free sign up!"}, | 94 | {tag:'span', cls:'payoff', html:"Free sign up!"}, |
97 | {tag:'span', cls:'link', html:"Create account >>"} | 95 | {tag:'span', cls:'link', html:"Create account >>"} |
98 | ]} | 96 | ]} |
99 | ]}, | 97 | ]}, |
100 | {tag:'div', cls:'keepTogether', children:[ | 98 | {tag:'div', cls:'keepTogether', children:[ |
101 | {tag:'div', id:this.getId('screenshotLink'), cls:'screenshotLink', children:[ | 99 | {tag:'div', id:this.getId('screenshotLink'), cls:'screenshotLink', children:[ |
102 | {tag:'canvas', id:this.getId('lookIcon')}, | 100 | {tag:'canvas', id:this.getId('lookIcon')}, |
103 | {tag:'a', href:'#', cls:'screenshotLink', children:[ | 101 | {tag:'a', href:'#', cls:'screenshotLink', children:[ |
104 | {tag:'span', cls:'payoff', html:"Look Clipperz!"}, | 102 | {tag:'span', cls:'payoff', html:"Look Clipperz!"}, |
105 | {tag:'span', cls:'link', html:"screenshot tour >>"} | 103 | {tag:'span', cls:'link', html:"screenshot tour >>"} |
106 | ]} | 104 | ]} |
107 | ]}, | 105 | ]}, |
108 | {tag:'div', id:this.getId('offlineLink'), cls:'offlineLink', children:[ | 106 | {tag:'div', id:this.getId('offlineLink'), cls:'offlineLink', children:[ |
109 | {tag:'canvas', id:this.getId('downloadIcon')}, | 107 | {tag:'canvas', id:this.getId('downloadIcon')}, |
110 | {tag:'a', href:'#', cls:'offlineLink', children:[ | 108 | {tag:'a', href:'#', cls:'offlineLink', children:[ |
111 | {tag:'span', cls:'payoff', html:"Download!"}, | 109 | {tag:'span', cls:'payoff', html:"Download!"}, |
112 | {tag:'span', cls:'link', html:"Offline version >>"} | 110 | {tag:'span', cls:'link', html:"Offline version >>"} |
113 | ]} | 111 | ]} |
114 | ]} | 112 | ]} |
115 | ]} | 113 | ]} |
116 | ]} | 114 | ]} |
117 | ]} | 115 | ]} |
118 | ]); | 116 | ]); |
119 | 117 | ||
120 | this.setRegistrationButtonIconDefaultColors(); | 118 | this.setRegistrationButtonIconDefaultColors(); |
121 | this.setLookIconDefaultColors(); | 119 | this.setLookIconDefaultColors(); |
122 | this.setDownloadIconDefaultColors(); | 120 | this.setDownloadIconDefaultColors(); |
123 | 121 | ||
124 | // MochiKit.Signal.connect(this.getElement('createAccountLink'), 'onclick', this, 'handleCreateAccountLink') | 122 | // MochiKit.Signal.connect(this.getElement('createAccountLink'), 'onclick', this, 'handleCreateAccountLink') |
125 | 123 | ||
126 | MochiKit.Signal.connect(this.getElement('registerButton'), 'onmouseenter', this, 'handleMouseEnterOnRegisterButtonIcon'); | 124 | MochiKit.Signal.connect(this.getElement('registerButton'), 'onmouseenter', this, 'handleMouseEnterOnRegisterButtonIcon'); |
127 | MochiKit.Signal.connect(this.getElement('registerButton'), 'onmouseleave', this, 'handleMouseLeaveOnRegisterButtonIcon'); | 125 | MochiKit.Signal.connect(this.getElement('registerButton'), 'onmouseleave', this, 'handleMouseLeaveOnRegisterButtonIcon'); |
128 | 126 | ||
129 | MochiKit.Signal.connect(this.getElement('screenshotLink'), 'onmouseenter', this, 'handleMouseEnterOnLookIcon'); | 127 | MochiKit.Signal.connect(this.getElement('screenshotLink'), 'onmouseenter', this, 'handleMouseEnterOnLookIcon'); |
130 | MochiKit.Signal.connect(this.getElement('screenshotLink'), 'onmouseleave', this, 'handleMouseLeaveOnLookIcon'); | 128 | MochiKit.Signal.connect(this.getElement('screenshotLink'), 'onmouseleave', this, 'handleMouseLeaveOnLookIcon'); |
131 | 129 | ||
132 | MochiKit.Signal.connect(this.getElement('offlineLink'), 'onmouseenter', this, 'handleMouseEnterOnDownloadIcon'); | 130 | MochiKit.Signal.connect(this.getElement('offlineLink'), 'onmouseenter', this, 'handleMouseEnterOnDownloadIcon'); |
133 | MochiKit.Signal.connect(this.getElement('offlineLink'), 'onmouseleave', this, 'handleMouseLeaveOnDownloadIcon'); | 131 | MochiKit.Signal.connect(this.getElement('offlineLink'), 'onmouseleave', this, 'handleMouseLeaveOnDownloadIcon'); |
134 | 132 | ||
135 | MochiKit.Signal.connect(this.getElement('createAccountLink'), 'onclick', this, 'handleCreateAccountLink') | 133 | MochiKit.Signal.connect(this.getElement('createAccountLink'), 'onclick', this, 'handleCreateAccountLink') |
136 | }, | 134 | }, |
137 | 135 | ||
138 | //------------------------------------------------------------------------- | 136 | //------------------------------------------------------------------------- |
139 | 137 | ||
140 | 'setRegistrationButtonIconDefaultColors': function () { | 138 | 'setRegistrationButtonIconDefaultColors': function () { |
141 | Clipperz.PM.UI.Canvas.registerButton.normal(this.getElement('registerButtonIcon'), "#eeeeee", "#eeeeee", "#ecab12", "#e14624", "#ffffff"); | 139 | Clipperz.PM.UI.Canvas.registerButton.normal(this.getElement('registerButtonIcon'), "#eeeeee", "#eeeeee", "#ecab12", "#e14624", "#ffffff"); |
142 | }, | 140 | }, |
143 | 141 | ||
144 | 'setRegistrationButtonIconHoverColors': function () { | 142 | 'setRegistrationButtonIconHoverColors': function () { |
145 | Clipperz.PM.UI.Canvas.registerButton.normal(this.getElement('registerButtonIcon'), "#cccccc", "#999999", "#ffb710", "#ff4d27", "#ffffff"); | 143 | Clipperz.PM.UI.Canvas.registerButton.normal(this.getElement('registerButtonIcon'), "#cccccc", "#999999", "#ffb710", "#ff4d27", "#ffffff"); |
146 | }, | 144 | }, |
147 | 145 | ||
148 | 'handleMouseEnterOnRegisterButtonIcon': function (anEvent) { | 146 | 'handleMouseEnterOnRegisterButtonIcon': function (anEvent) { |
149 | this.setRegistrationButtonIconHoverColors(); | 147 | this.setRegistrationButtonIconHoverColors(); |
150 | }, | 148 | }, |
151 | 149 | ||
152 | 'handleMouseLeaveOnRegisterButtonIcon': function (anEvent) { | 150 | 'handleMouseLeaveOnRegisterButtonIcon': function (anEvent) { |
153 | this.setRegistrationButtonIconDefaultColors(); | 151 | this.setRegistrationButtonIconDefaultColors(); |
154 | }, | 152 | }, |
155 | 153 | ||
156 | //------------------------------------------------------------------------- | 154 | //------------------------------------------------------------------------- |
157 | 155 | ||
158 | 'setLookIconDefaultColors': function () { | 156 | 'setLookIconDefaultColors': function () { |
159 | Clipperz.PM.UI.Canvas.coverActions.look(this.getElement('lookIcon'), "#7e7e7e", "#ffffff", 1); | 157 | Clipperz.PM.UI.Canvas.coverActions.look(this.getElement('lookIcon'), "#7e7e7e", "#ffffff", 1); |
160 | }, | 158 | }, |
161 | 159 | ||
162 | 'setLookIconHoverColors': function () { | 160 | 'setLookIconHoverColors': function () { |
163 | Clipperz.PM.UI.Canvas.coverActions.look(this.getElement('lookIcon'), "#666666", "#ffffff", 2); | 161 | Clipperz.PM.UI.Canvas.coverActions.look(this.getElement('lookIcon'), "#666666", "#ffffff", 2); |
164 | }, | 162 | }, |
165 | 163 | ||
166 | 'handleMouseEnterOnLookIcon': function (anEvent) { | 164 | 'handleMouseEnterOnLookIcon': function (anEvent) { |
167 | this.setLookIconHoverColors(); | 165 | this.setLookIconHoverColors(); |
168 | }, | 166 | }, |
169 | 167 | ||
170 | 'handleMouseLeaveOnLookIcon': function (anEvent) { | 168 | 'handleMouseLeaveOnLookIcon': function (anEvent) { |
171 | this.setLookIconDefaultColors(); | 169 | this.setLookIconDefaultColors(); |
172 | }, | 170 | }, |
173 | 171 | ||
174 | //------------------------------------------------------------------------- | 172 | //------------------------------------------------------------------------- |
175 | 173 | ||
176 | 'setDownloadIconDefaultColors': function () { | 174 | 'setDownloadIconDefaultColors': function () { |
177 | Clipperz.PM.UI.Canvas.coverActions.download(this.getElement('downloadIcon'), "#7e7e7e", "#ffffff", 1); | 175 | Clipperz.PM.UI.Canvas.coverActions.download(this.getElement('downloadIcon'), "#7e7e7e", "#ffffff", 1); |
178 | }, | 176 | }, |
179 | 177 | ||
180 | 'setDownloadIconHoverColors': function () { | 178 | 'setDownloadIconHoverColors': function () { |
181 | Clipperz.PM.UI.Canvas.coverActions.download(this.getElement('downloadIcon'), "#666666", "#ffffff", 2); | 179 | Clipperz.PM.UI.Canvas.coverActions.download(this.getElement('downloadIcon'), "#666666", "#ffffff", 2); |
182 | }, | 180 | }, |
183 | 181 | ||
184 | 'handleMouseEnterOnDownloadIcon': function (anEvent) { | 182 | 'handleMouseEnterOnDownloadIcon': function (anEvent) { |
185 | this.setDownloadIconHoverColors(); | 183 | this.setDownloadIconHoverColors(); |
186 | }, | 184 | }, |
187 | 185 | ||
188 | 'handleMouseLeaveOnDownloadIcon': function (anEvent) { | 186 | 'handleMouseLeaveOnDownloadIcon': function (anEvent) { |
189 | this.setDownloadIconDefaultColors(); | 187 | this.setDownloadIconDefaultColors(); |
190 | }, | 188 | }, |
191 | 189 | ||
192 | //------------------------------------------------------------------------- | 190 | //------------------------------------------------------------------------- |
193 | 191 | ||
194 | 'handleCreateAccountLink': function (anEvent) { | 192 | 'handleCreateAccountLink': function (anEvent) { |
195 | anEvent.preventDefault(); | 193 | anEvent.preventDefault(); |
196 | 194 | ||
197 | MochiKit.Signal.signal(this, 'createNewAccountClick', anEvent.src()); | 195 | MochiKit.Signal.signal(this, 'createNewAccountClick', anEvent.src()); |
198 | }, | 196 | }, |
199 | 197 | ||
200 | //------------------------------------------------------------------------- | 198 | //------------------------------------------------------------------------- |
201 | 199 | ||
202 | __syntaxFix__: "syntax fix" | 200 | __syntaxFix__: "syntax fix" |
203 | }); | 201 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js index 26506e7..3fef6c5 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js | |||
@@ -1,156 +1,153 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.LoginProgress = function(args) { | 26 | Clipperz.PM.UI.Web.Components.LoginProgress = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.LoginProgress.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.LoginProgress.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._deferred = null; | 31 | this._deferred = null; |
34 | 32 | ||
35 | return this; | 33 | return this; |
36 | } | 34 | } |
37 | 35 | ||
38 | //============================================================================= | 36 | //============================================================================= |
39 | 37 | ||
40 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginProgress, Clipperz.PM.UI.Common.Components.BaseComponent, { | 38 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginProgress, Clipperz.PM.UI.Common.Components.BaseComponent, { |
41 | 39 | ||
42 | //------------------------------------------------------------------------- | 40 | //------------------------------------------------------------------------- |
43 | 41 | ||
44 | 'toString': function () { | 42 | 'toString': function () { |
45 | return "Clipperz.PM.UI.Web.Components.LoginProgress component"; | 43 | return "Clipperz.PM.UI.Web.Components.LoginProgress component"; |
46 | }, | 44 | }, |
47 | 45 | ||
48 | //------------------------------------------------------------------------- | 46 | //------------------------------------------------------------------------- |
49 | 47 | ||
50 | 'deferred': function() { | 48 | 'deferred': function() { |
51 | return this._deferred; | 49 | return this._deferred; |
52 | }, | 50 | }, |
53 | 51 | ||
54 | 'setDeferred': function(aValue) { | 52 | 'setDeferred': function(aValue) { |
55 | this._deferred = aValue; | 53 | this._deferred = aValue; |
56 | }, | 54 | }, |
57 | 55 | ||
58 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
59 | 57 | ||
60 | 'renderSelf': function() { | 58 | 'renderSelf': function() { |
61 | // var loginProgressElement; | 59 | // var loginProgressElement; |
62 | // | 60 | // |
63 | // loginProgressElement = MochiKit.DOM.getElement('loginProgress'); | 61 | // loginProgressElement = MochiKit.DOM.getElement('loginProgress'); |
64 | // | 62 | // |
65 | // if (loginProgressElement == null) { | 63 | // if (loginProgressElement == null) { |
66 | // loginProgressElement = this.append(this.element(), {tag:'div', id:'loginProgress', cls:'LoginProgress'}, true); | 64 | // loginProgressElement = this.append(this.element(), {tag:'div', id:'loginProgress', cls:'LoginProgress'}, true); |
67 | // } | 65 | // } |
68 | 66 | ||
69 | //console.log(">> LoginProgress.renderSelf", this.element()); | ||
70 | this.append(this.element(), {tag:'div', id:'loginProgress', cls:'LoginProgress', children: [ | 67 | this.append(this.element(), {tag:'div', id:'loginProgress', cls:'LoginProgress', children: [ |
71 | // this.append(loginProgressElement, [ | 68 | // this.append(loginProgressElement, [ |
72 | {tag:'div', cls:'header', children:[ | 69 | {tag:'div', cls:'header', children:[ |
73 | {tag:'h3', id:this.getId('title'), html:"login progress"} | 70 | {tag:'h3', id:this.getId('title'), html:"login progress"} |
74 | ]}, | 71 | ]}, |
75 | {tag:'div', cls:'body', children:[ | 72 | {tag:'div', cls:'body', children:[ |
76 | {tag:'div', id:this.getId('progressBar')}, | 73 | {tag:'div', id:this.getId('progressBar')}, |
77 | {tag:'div', id:this.getId('errorBox'), cls:'errorBox', children:[ | 74 | {tag:'div', id:this.getId('errorBox'), cls:'errorBox', children:[ |
78 | // {tag:'div',cls:'img ALERT', children:[{tag:'div'}]}, | 75 | // {tag:'div',cls:'img ALERT', children:[{tag:'div'}]}, |
79 | {tag:'div',cls:'img ALERT', children:[{tag:'canvas', id:this.getId('canvas')}]}, | 76 | {tag:'div',cls:'img ALERT', children:[{tag:'canvas', id:this.getId('canvas')}]}, |
80 | {tag:'p', html:"Login failed"} | 77 | {tag:'p', html:"Login failed"} |
81 | ]} | 78 | ]} |
82 | ]}, | 79 | ]}, |
83 | {tag:'div', cls:'footer', children:[ | 80 | {tag:'div', cls:'footer', children:[ |
84 | {tag:'div', cls:'buttonArea', id:this.getId('buttonArea'), children:[ | 81 | {tag:'div', cls:'buttonArea', id:this.getId('buttonArea'), children:[ |
85 | // {tag:'div', cls:'button', id:this.getId('button'), children:[ | 82 | // {tag:'div', cls:'button', id:this.getId('button'), children:[ |
86 | // {tag:'a', href:'#', id:this.getId('buttonLink'), html:"cancel"} | 83 | // {tag:'a', href:'#', id:this.getId('buttonLink'), html:"cancel"} |
87 | // ]} | 84 | // ]} |
88 | {tag:'a', cls:'button', id:this.getId('button'), html:"cancel"} | 85 | {tag:'a', cls:'button', id:this.getId('button'), html:"cancel"} |
89 | ]} | 86 | ]} |
90 | ]} | 87 | ]} |
91 | ]}); | 88 | ]}); |
92 | // ]); | 89 | // ]); |
93 | 90 | ||
94 | Clipperz.PM.UI.Canvas.marks['!'](this.getElement('canvas'), "#ffffff"); | 91 | Clipperz.PM.UI.Canvas.marks['!'](this.getElement('canvas'), "#ffffff"); |
95 | 92 | ||
96 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); | 93 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); |
97 | MochiKit.Style.hideElement(this.getElement('errorBox')); | 94 | MochiKit.Style.hideElement(this.getElement('errorBox')); |
98 | 95 | ||
99 | // MochiKit.Signal.connect(this.getId('buttonLink'), 'onclick', this, 'cancelEventHandler'); | 96 | // MochiKit.Signal.connect(this.getId('buttonLink'), 'onclick', this, 'cancelEventHandler'); |
100 | MochiKit.Signal.connect(this.getId('button'), 'onclick', this, 'cancelEventHandler'); | 97 | MochiKit.Signal.connect(this.getId('button'), 'onclick', this, 'cancelEventHandler'); |
101 | }, | 98 | }, |
102 | 99 | ||
103 | //------------------------------------------------------------------------- | 100 | //------------------------------------------------------------------------- |
104 | 101 | ||
105 | 'displayElement': function() { | 102 | 'displayElement': function() { |
106 | return MochiKit.DOM.getElement('loginProgress'); | 103 | return MochiKit.DOM.getElement('loginProgress'); |
107 | }, | 104 | }, |
108 | 105 | ||
109 | //------------------------------------------------------------------------- | 106 | //------------------------------------------------------------------------- |
110 | 107 | ||
111 | 'cancelEventHandler': function(anEvent) { | 108 | 'cancelEventHandler': function(anEvent) { |
112 | anEvent.preventDefault(); | 109 | anEvent.preventDefault(); |
113 | 110 | ||
114 | MochiKit.Signal.signal(this, 'cancelEvent'); | 111 | MochiKit.Signal.signal(this, 'cancelEvent'); |
115 | }, | 112 | }, |
116 | 113 | ||
117 | //------------------------------------------------------------------------- | 114 | //------------------------------------------------------------------------- |
118 | 115 | ||
119 | 'disableCancel': function() { | 116 | 'disableCancel': function() { |
120 | MochiKit.Style.hideElement(this.getElement('buttonArea')); | 117 | MochiKit.Style.hideElement(this.getElement('buttonArea')); |
121 | }, | 118 | }, |
122 | 119 | ||
123 | //------------------------------------------------------------------------- | 120 | //------------------------------------------------------------------------- |
124 | 121 | ||
125 | 'showErrorMessage': function() { | 122 | 'showErrorMessage': function() { |
126 | // this.getElement('buttonLink').innerHTML = "close"; | 123 | // this.getElement('buttonLink').innerHTML = "close"; |
127 | this.getElement('button').innerHTML = "close"; | 124 | this.getElement('button').innerHTML = "close"; |
128 | MochiKit.DOM.addElementClass(this.getElement('button'), 'default'); | 125 | MochiKit.DOM.addElementClass(this.getElement('button'), 'default'); |
129 | 126 | ||
130 | MochiKit.Style.hideElement(this.getElement('progressBar')); | 127 | MochiKit.Style.hideElement(this.getElement('progressBar')); |
131 | 128 | ||
132 | this.getElement('title').innerHTML = "Error"; | 129 | this.getElement('title').innerHTML = "Error"; |
133 | MochiKit.Style.showElement(this.getElement('errorBox')); | 130 | MochiKit.Style.showElement(this.getElement('errorBox')); |
134 | MochiKit.Style.showElement(this.getElement('buttonArea')); | 131 | MochiKit.Style.showElement(this.getElement('buttonArea')); |
135 | }, | 132 | }, |
136 | 133 | ||
137 | //------------------------------------------------------------------------- | 134 | //------------------------------------------------------------------------- |
138 | 135 | ||
139 | 'deferredHideModalAndRemove': function(someParameters, aResult) { | 136 | 'deferredHideModalAndRemove': function(someParameters, aResult) { |
140 | vardeferredResult; | 137 | vardeferredResult; |
141 | 138 | ||
142 | deferredResult = new Clipperz.Async.Deferred("LoginProgress.deferredHideModalAndRemove", {trace:false}); | 139 | deferredResult = new Clipperz.Async.Deferred("LoginProgress.deferredHideModalAndRemove", {trace:false}); |
143 | deferredResult.addMethod(this, 'deferredHideModal'); | 140 | deferredResult.addMethod(this, 'deferredHideModal'); |
144 | deferredResult.addMethod(this, 'remove'); | 141 | deferredResult.addMethod(this, 'remove'); |
145 | deferredResult.addCallback(function () { | 142 | deferredResult.addCallback(function () { |
146 | return aResult; | 143 | return aResult; |
147 | }); | 144 | }); |
148 | deferredResult.callback(someParameters); | 145 | deferredResult.callback(someParameters); |
149 | 146 | ||
150 | return deferredResult; | 147 | return deferredResult; |
151 | }, | 148 | }, |
152 | 149 | ||
153 | //------------------------------------------------------------------------- | 150 | //------------------------------------------------------------------------- |
154 | 151 | ||
155 | __syntaxFix__: "syntax fix" | 152 | __syntaxFix__: "syntax fix" |
156 | }); | 153 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/NewUserCreationComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/NewUserCreationComponent.js index feb16ad..06746d1 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/NewUserCreationComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/NewUserCreationComponent.js | |||
@@ -1,427 +1,419 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.NewUserCreationComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.NewUserCreationComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.NewUserCreationComponent.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.NewUserCreationComponent.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._tabPanelController = null; | 31 | this._tabPanelController = null; |
34 | 32 | ||
35 | this._initiallySelectedTab = args.selected || 'CREDENTIALS'; | 33 | this._initiallySelectedTab = args.selected || 'CREDENTIALS'; |
36 | this._tabPanelControllerConfiguration = { | 34 | this._tabPanelControllerConfiguration = { |
37 | 'CREDENTIALS': { | 35 | 'CREDENTIALS': { |
38 | tab:'credentialsTab', | 36 | tab:'credentialsTab', |
39 | panel:'credentialsTabpanel' | 37 | panel:'credentialsTabpanel' |
40 | }, | 38 | }, |
41 | 'CHECK_CREDENTIALS': { | 39 | 'CHECK_CREDENTIALS': { |
42 | tab:'checkCredentialsTab', | 40 | tab:'checkCredentialsTab', |
43 | panel:'checkCredentialsTabpanel' | 41 | panel:'checkCredentialsTabpanel' |
44 | }, | 42 | }, |
45 | 'TERMS_OF_SERVICE': { | 43 | 'TERMS_OF_SERVICE': { |
46 | tab:'termsOfServiceTab', | 44 | tab:'termsOfServiceTab', |
47 | panel:'termsOfServiceTabpanel' | 45 | panel:'termsOfServiceTabpanel' |
48 | }, | 46 | }, |
49 | 'CREATE_USER': { | 47 | 'CREATE_USER': { |
50 | tab:'createUserTab', | 48 | tab:'createUserTab', |
51 | panel:'createUserTabpanel' | 49 | panel:'createUserTabpanel' |
52 | }//, | 50 | }//, |
53 | /* | 51 | /* |
54 | 'LOGIN': { | 52 | 'LOGIN': { |
55 | tab:'loginTab', | 53 | tab:'loginTab', |
56 | panel:'loginTabpanel' | 54 | panel:'loginTabpanel' |
57 | } | 55 | } |
58 | */ | 56 | */ |
59 | }; | 57 | }; |
60 | 58 | ||
61 | return this; | 59 | return this; |
62 | } | 60 | } |
63 | 61 | ||
64 | //============================================================================= | 62 | //============================================================================= |
65 | 63 | ||
66 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.NewUserCreationComponent, Clipperz.PM.UI.Common.Components.TabPanelComponent, { | 64 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.NewUserCreationComponent, Clipperz.PM.UI.Common.Components.TabPanelComponent, { |
67 | 65 | ||
68 | //------------------------------------------------------------------------- | 66 | //------------------------------------------------------------------------- |
69 | 67 | ||
70 | 'toString': function () { | 68 | 'toString': function () { |
71 | return "Clipperz.PM.UI.Web.Components.NewUserCreationComponent component"; | 69 | return "Clipperz.PM.UI.Web.Components.NewUserCreationComponent component"; |
72 | }, | 70 | }, |
73 | 71 | ||
74 | //========================================================================= | 72 | //========================================================================= |
75 | 73 | ||
76 | 'disableAllPanels': function () { | 74 | 'disableAllPanels': function () { |
77 | this.tabPanelController().selectTab(null); | 75 | this.tabPanelController().selectTab(null); |
78 | }, | 76 | }, |
79 | 77 | ||
80 | //------------------------------------------------------------------------- | 78 | //------------------------------------------------------------------------- |
81 | 79 | ||
82 | 'enableCredentialsPanel': function () { | 80 | 'enableCredentialsPanel': function () { |
83 | this.tabPanelController().selectTab('CREDENTIALS'); | 81 | this.tabPanelController().selectTab('CREDENTIALS'); |
84 | }, | 82 | }, |
85 | 83 | ||
86 | 'enableCheckCredentialsPanel': function () { | 84 | 'enableCheckCredentialsPanel': function () { |
87 | this.tabPanelController().selectTab('CHECK_CREDENTIALS'); | 85 | this.tabPanelController().selectTab('CHECK_CREDENTIALS'); |
88 | }, | 86 | }, |
89 | 87 | ||
90 | 'enableTermsOfServicePanel': function () { | 88 | 'enableTermsOfServicePanel': function () { |
91 | this.tabPanelController().selectTab('TERMS_OF_SERVICE'); | 89 | this.tabPanelController().selectTab('TERMS_OF_SERVICE'); |
92 | }, | 90 | }, |
93 | 91 | ||
94 | 'enableCreateUserPanel': function () { | 92 | 'enableCreateUserPanel': function () { |
95 | this.tabPanelController().selectTab('CREATE_USER'); | 93 | this.tabPanelController().selectTab('CREATE_USER'); |
96 | }, | 94 | }, |
97 | 95 | ||
98 | //'enableLoginPanel': function () { | 96 | //'enableLoginPanel': function () { |
99 | // this.tabPanelController().selectTab('LOGIN'); | 97 | // this.tabPanelController().selectTab('LOGIN'); |
100 | //}, | 98 | //}, |
101 | 99 | ||
102 | //========================================================================= | 100 | //========================================================================= |
103 | 101 | ||
104 | 'shouldShowElementWhileRendering': function() { | 102 | 'shouldShowElementWhileRendering': function() { |
105 | return false; | 103 | return false; |
106 | }, | 104 | }, |
107 | 105 | ||
108 | //========================================================================= | 106 | //========================================================================= |
109 | 107 | ||
110 | 'tabPanelController': function () { | 108 | 'tabPanelController': function () { |
111 | if (this._tabPanelController == null) { | 109 | if (this._tabPanelController == null) { |
112 | this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({ | 110 | this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({ |
113 | component:this, | 111 | component:this, |
114 | configuration:this._tabPanelControllerConfiguration | 112 | configuration:this._tabPanelControllerConfiguration |
115 | }); | 113 | }); |
116 | 114 | ||
117 | MochiKit.Signal.connect(this._tabPanelController, 'tabSelected', this, 'handleTabSelected') | 115 | MochiKit.Signal.connect(this._tabPanelController, 'tabSelected', this, 'handleTabSelected') |
118 | } | 116 | } |
119 | 117 | ||
120 | return this._tabPanelController; | 118 | return this._tabPanelController; |
121 | }, | 119 | }, |
122 | 120 | ||
123 | //------------------------------------------------------------------------- | 121 | //------------------------------------------------------------------------- |
124 | 122 | ||
125 | 'renderSelf': function() { | 123 | 'renderSelf': function() { |
126 | //console.log('** Clipperz.targetModalDimensionsAndPosition', Clipperz.Base.serializeJSON(Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition)); | ||
127 | |||
128 | this.append(this.element(), {tag:'div', cls:'NewUserCreation mainDialog', id:this.getId('panel'), children: [ | 124 | this.append(this.element(), {tag:'div', cls:'NewUserCreation mainDialog', id:this.getId('panel'), children: [ |
129 | {tag:'form', id:this.getId('form'), cls:'newUserCreationForm', children:[ | 125 | {tag:'form', id:this.getId('form'), cls:'newUserCreationForm', children:[ |
130 | {tag:'div', cls:'header', children:[ | 126 | {tag:'div', cls:'header', children:[ |
131 | {tag:'div', cls:'title', children:[ | 127 | {tag:'div', cls:'title', children:[ |
132 | {tag:'h3', id:this.getId('title'), html:"Create new user"} | 128 | {tag:'h3', id:this.getId('title'), html:"Create new user"} |
133 | ]} | 129 | ]} |
134 | ]}, | 130 | ]}, |
135 | {tag:'div', id:this.getId('body'), cls:'body', children:[ | 131 | {tag:'div', id:this.getId('body'), cls:'body', children:[ |
136 | {tag:'div', cls:'tabContainer', children:[ | 132 | {tag:'div', cls:'tabContainer', children:[ |
137 | {tag:'ul', cls:'tabs', children:[ | 133 | {tag:'ul', cls:'tabs', children:[ |
138 | {tag:'li', id:this.getId('credentialsTab'), children:[{tag:'span', html:"credentials"}]}, | 134 | {tag:'li', id:this.getId('credentialsTab'), children:[{tag:'span', html:"credentials"}]}, |
139 | {tag:'li', id:this.getId('checkCredentialsTab'),children:[{tag:'span', html:"credentials check"}]}, | 135 | {tag:'li', id:this.getId('checkCredentialsTab'),children:[{tag:'span', html:"credentials check"}]}, |
140 | {tag:'li', id:this.getId('termsOfServiceTab'), children:[{tag:'span', html:"terms of service"}]}, | 136 | {tag:'li', id:this.getId('termsOfServiceTab'), children:[{tag:'span', html:"terms of service"}]}, |
141 | {tag:'li', id:this.getId('createUserTab'), children:[{tag:'span', html:"create user"}]}//, | 137 | {tag:'li', id:this.getId('createUserTab'), children:[{tag:'span', html:"create user"}]}//, |
142 | // {tag:'li', id:this.getId('loginTab'), children:[{tag:'span', html:"login"}]}, | 138 | // {tag:'li', id:this.getId('loginTab'), children:[{tag:'span', html:"login"}]}, |
143 | ]}, | 139 | ]}, |
144 | {tag:'ul', cls:'tabPanels', children:[ | 140 | {tag:'ul', cls:'tabPanels', children:[ |
145 | {tag:'li', id:this.getId('credentialsTabpanel'), cls:'tabPanel credentials', children:[ | 141 | {tag:'li', id:this.getId('credentialsTabpanel'), cls:'tabPanel credentials', children:[ |
146 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.NewUserWizard.CREDENTIALS.description')}]}, | 142 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.NewUserWizard.CREDENTIALS.description')}]}, |
147 | {tag:'ul', cls:'credentials', children:[ | 143 | {tag:'ul', cls:'credentials', children:[ |
148 | {tag:'li', children:[{tag:'span', cls:'label', html:"username"},{tag:'input', type:'text', id:this.getId('username')/*, value:'test'*/}]}, | 144 | {tag:'li', children:[{tag:'span', cls:'label', html:"username"},{tag:'input', type:'text', id:this.getId('username')/*, value:'test'*/}]}, |
149 | {tag:'li', children:[{tag:'span', cls:'label', html:"passphrase"},{tag:'input', type:'password', id:this.getId('passphrase')/*, value:'test'*/}]} | 145 | {tag:'li', children:[{tag:'span', cls:'label', html:"passphrase"},{tag:'input', type:'password', id:this.getId('passphrase')/*, value:'test'*/}]} |
150 | ]} | 146 | ]} |
151 | ]}, | 147 | ]}, |
152 | {tag:'li', id:this.getId('checkCredentialsTabpanel'), cls:'tabPanel checkCredentials', children:[ | 148 | {tag:'li', id:this.getId('checkCredentialsTabpanel'), cls:'tabPanel checkCredentials', children:[ |
153 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.NewUserWizard.CHECK_CREDENTIALS.description')}]}, | 149 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.NewUserWizard.CHECK_CREDENTIALS.description')}]}, |
154 | {tag:'ul', cls:'credentials', children:[ | 150 | {tag:'ul', cls:'credentials', children:[ |
155 | {tag:'li', children:[{tag:'span', cls:'label', html:"re-passphrase"},{tag:'input', type:'password', id:this.getId('re-passphrase')/*, value:'test'*/}]} | 151 | {tag:'li', children:[{tag:'span', cls:'label', html:"re-passphrase"},{tag:'input', type:'password', id:this.getId('re-passphrase')/*, value:'test'*/}]} |
156 | ]} | 152 | ]} |
157 | ]}, | 153 | ]}, |
158 | {tag:'li', id:this.getId('termsOfServiceTabpanel'), cls:'tabPanel termsOfService', children:[ | 154 | {tag:'li', id:this.getId('termsOfServiceTabpanel'), cls:'tabPanel termsOfService', children:[ |
159 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.NewUserWizard.TERMS_OF_SERVICE.description')}]}, | 155 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.NewUserWizard.TERMS_OF_SERVICE.description')}]}, |
160 | {tag:'ul', cls:'termsOfService', children:[ | 156 | {tag:'ul', cls:'termsOfService', children:[ |
161 | {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."}]}, | 157 | {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."}]}, |
162 | {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>."}]} | 158 | {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>."}]} |
163 | ]} | 159 | ]} |
164 | ]}, | 160 | ]}, |
165 | {tag:'li', id:this.getId('createUserTabpanel'), cls:'tabPanel createUser', children:[ | 161 | {tag:'li', id:this.getId('createUserTabpanel'), cls:'tabPanel createUser', children:[ |
166 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.NewUserWizard.CREATE_USER.description')}]}, | 162 | {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.NewUserWizard.CREATE_USER.description')}]}, |
167 | {tag:'ul', cls:'createUserStates', children:[ | 163 | {tag:'ul', cls:'createUserStates', children:[ |
168 | {tag:'li', cls:'creating', id:this.getId('creatingRegistering'), children:[{tag:'span', html:"registering user"}]}, | 164 | {tag:'li', cls:'creating', id:this.getId('creatingRegistering'), children:[{tag:'span', html:"registering user"}]}, |
169 | {tag:'li', cls:'done', id:this.getId('creatingDone'), children:[{tag:'span', html:"done"}]}, | 165 | {tag:'li', cls:'done', id:this.getId('creatingDone'), children:[{tag:'span', html:"done"}]}, |
170 | {tag:'li', cls:'fail', id:this.getId('creatingFailed'), children:[{tag:'span', html:"fail"}]} | 166 | {tag:'li', cls:'fail', id:this.getId('creatingFailed'), children:[{tag:'span', html:"fail"}]} |
171 | ]} | 167 | ]} |
172 | ]}//, | 168 | ]}//, |
173 | // {tag:'li', id:this.getId('loginTabpanel'), cls:'tabPanel login', children:[ | 169 | // {tag:'li', id:this.getId('loginTabpanel'), cls:'tabPanel login', children:[ |
174 | // {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.NewUserWizard.LOGIN.description')}]}, | 170 | // {tag:'div', cls:'wizardStepDescription', children:[{tag:'span', html:Clipperz.PM.Strings.getValue('Wizards.NewUserWizard.LOGIN.description')}]}, |
175 | // ]} | 171 | // ]} |
176 | ]} | 172 | ]} |
177 | ]} | 173 | ]} |
178 | ]}, | 174 | ]}, |
179 | {tag:'div', id:this.getId('footer'), cls:'footer', children:[ | 175 | {tag:'div', id:this.getId('footer'), cls:'footer', children:[ |
180 | {tag:'div', cls:'buttonArea', children:[ | 176 | {tag:'div', cls:'buttonArea', children:[ |
181 | // {tag:'div', cls:'cancel', id:this.getId('cancelButton'), html:"cancel"}, | 177 | // {tag:'div', cls:'cancel', id:this.getId('cancelButton'), html:"cancel"}, |
182 | // {tag:'div', cls:'save disabled', id:this.getId('saveButton'), html:"save"} | 178 | // {tag:'div', cls:'save disabled', id:this.getId('saveButton'), html:"save"} |
183 | ]} | 179 | ]} |
184 | ]} | 180 | ]} |
185 | ]}, | 181 | ]}, |
186 | {tag:'div', cls:'clear'} | 182 | {tag:'div', cls:'clear'} |
187 | ]}); | 183 | ]}); |
188 | 184 | ||
189 | this.tabPanelController().setup(); | 185 | this.tabPanelController().setup(); |
190 | // MochiKit.Signal.connect(this.getId('panel'), 'onkeydown', this, 'handleKeyEvent'); | 186 | // MochiKit.Signal.connect(this.getId('panel'), 'onkeydown', this, 'handleKeyEvent'); |
191 | MochiKit.Signal.connect(MochiKit.DOM.currentDocument().body, 'onkeydown', this, 'handleKeyEvent'); | 187 | MochiKit.Signal.connect(MochiKit.DOM.currentDocument().body, 'onkeydown', this, 'handleKeyEvent'); |
192 | MochiKit.Signal.connect(this.getId('awareOfUnrecoverablePassphrase'), 'onchange', this, 'handleTermsOfServiceCheckboxChange'); | 188 | MochiKit.Signal.connect(this.getId('awareOfUnrecoverablePassphrase'), 'onchange', this, 'handleTermsOfServiceCheckboxChange'); |
193 | MochiKit.Signal.connect(this.getId('readTermsOfService'), 'onchange', this, 'handleTermsOfServiceCheckboxChange'); | 189 | MochiKit.Signal.connect(this.getId('readTermsOfService'), 'onchange', this, 'handleTermsOfServiceCheckboxChange'); |
194 | }, | 190 | }, |
195 | 191 | ||
196 | //------------------------------------------------------------------------- | 192 | //------------------------------------------------------------------------- |
197 | /* | 193 | /* |
198 | 'resetContent': function () { | 194 | 'resetContent': function () { |
199 | this.getElement('username').value = ''; | 195 | this.getElement('username').value = ''; |
200 | this.getElement('passphrase').value = ''; | 196 | this.getElement('passphrase').value = ''; |
201 | }, | 197 | }, |
202 | */ | 198 | */ |
203 | //------------------------------------------------------------------------- | 199 | //------------------------------------------------------------------------- |
204 | 200 | ||
205 | 'displayElement': function() { | 201 | 'displayElement': function() { |
206 | return this.getElement('panel'); | 202 | return this.getElement('panel'); |
207 | }, | 203 | }, |
208 | 204 | ||
209 | //------------------------------------------------------------------------- | 205 | //------------------------------------------------------------------------- |
210 | 206 | ||
211 | 'handleTabSelected': function (aSelectedTab) { | 207 | 'handleTabSelected': function (aSelectedTab) { |
212 | /* | 208 | /* |
213 | switch (aSelectedTab) { | 209 | switch (aSelectedTab) { |
214 | case 'DETAILS': | 210 | case 'DETAILS': |
215 | break; | 211 | break; |
216 | case 'DIRECT_LOGINS': | 212 | case 'DIRECT_LOGINS': |
217 | MochiKit.Style.hideElement(this.getElement('backToDirectLoginList')); | 213 | MochiKit.Style.hideElement(this.getElement('backToDirectLoginList')); |
218 | break; | 214 | break; |
219 | case 'SHARING': | 215 | case 'SHARING': |
220 | break; | 216 | break; |
221 | } | 217 | } |
222 | */ | 218 | */ |
223 | }, | 219 | }, |
224 | 220 | ||
225 | //========================================================================= | 221 | //========================================================================= |
226 | 222 | ||
227 | 'username': function () { | 223 | 'username': function () { |
228 | return this.getElement('username').value; | 224 | return this.getElement('username').value; |
229 | }, | 225 | }, |
230 | 226 | ||
231 | 'usernameElement': function () { | 227 | 'usernameElement': function () { |
232 | return this.getElement('username'); | 228 | return this.getElement('username'); |
233 | }, | 229 | }, |
234 | 230 | ||
235 | 'passphrase': function () { | 231 | 'passphrase': function () { |
236 | return this.getElement('passphrase').value; | 232 | return this.getElement('passphrase').value; |
237 | }, | 233 | }, |
238 | 234 | ||
239 | 'rePassphrase': function () { | 235 | 'rePassphrase': function () { |
240 | return this.getElement('re-passphrase').value; | 236 | return this.getElement('re-passphrase').value; |
241 | }, | 237 | }, |
242 | 238 | ||
243 | 'awareOfUnrecoverablePassphrase': function () { | 239 | 'awareOfUnrecoverablePassphrase': function () { |
244 | return this.getElement('awareOfUnrecoverablePassphrase').value; | 240 | return this.getElement('awareOfUnrecoverablePassphrase').value; |
245 | }, | 241 | }, |
246 | 242 | ||
247 | 'readTermsOfService': function () { | 243 | 'readTermsOfService': function () { |
248 | return this.getElement('readTermsOfService').value; | 244 | return this.getElement('readTermsOfService').value; |
249 | }, | 245 | }, |
250 | 246 | ||
251 | //========================================================================= | 247 | //========================================================================= |
252 | /* | 248 | /* |
253 | 'incrementUpdateFaviconCounter': function () { | 249 | 'incrementUpdateFaviconCounter': function () { |
254 | this._updateFaviconCounter ++; | 250 | this._updateFaviconCounter ++; |
255 | }, | 251 | }, |
256 | 252 | ||
257 | 'decrementUpdateFaviconCounter': function () { | 253 | 'decrementUpdateFaviconCounter': function () { |
258 | this._updateFaviconCounter --; | 254 | this._updateFaviconCounter --; |
259 | }, | 255 | }, |
260 | 256 | ||
261 | 'updateFaviconCounter': function () { | 257 | 'updateFaviconCounter': function () { |
262 | return this._updateFaviconCounter; | 258 | return this._updateFaviconCounter; |
263 | }, | 259 | }, |
264 | */ | 260 | */ |
265 | //------------------------------------------------------------------------- | 261 | //------------------------------------------------------------------------- |
266 | /* | 262 | /* |
267 | 'updateFavicon': function () { | 263 | 'updateFavicon': function () { |
268 | this.decrementUpdateFaviconCounter(); | 264 | this.decrementUpdateFaviconCounter(); |
269 | 265 | ||
270 | if (this.updateFaviconCounter() == 0) { | 266 | if (this.updateFaviconCounter() == 0) { |
271 | this.setFavicon(this.favicon()); | 267 | this.setFavicon(this.favicon()); |
272 | } | 268 | } |
273 | }, | 269 | }, |
274 | */ | 270 | */ |
275 | //========================================================================= | 271 | //========================================================================= |
276 | /* | 272 | /* |
277 | 'bindingComponents': function () { | 273 | 'bindingComponents': function () { |
278 | return this._bindingComponents; | 274 | return this._bindingComponents; |
279 | }, | 275 | }, |
280 | 276 | ||
281 | 'clearAllBindingsComponents': function () { | 277 | 'clearAllBindingsComponents': function () { |
282 | MochiKit.Iter.forEach(this.bindingComponents(), MochiKit.Base.methodcaller('remove')); | 278 | MochiKit.Iter.forEach(this.bindingComponents(), MochiKit.Base.methodcaller('remove')); |
283 | this._bindingComponents = []; | 279 | this._bindingComponents = []; |
284 | this.getElement('bindings').innerHTML = ''; | 280 | this.getElement('bindings').innerHTML = ''; |
285 | }, | 281 | }, |
286 | 282 | ||
287 | 'addBindingComponent': function (aBindingComponent) { | 283 | 'addBindingComponent': function (aBindingComponent) { |
288 | this.bindingComponents().push(aBindingComponent); | 284 | this.bindingComponents().push(aBindingComponent); |
289 | aBindingComponent.renderInNode(this.append(this.getElement('bindings'), {tag:'div'})); | 285 | aBindingComponent.renderInNode(this.append(this.getElement('bindings'), {tag:'div'})); |
290 | }, | 286 | }, |
291 | */ | 287 | */ |
292 | //========================================================================= | 288 | //========================================================================= |
293 | /* | 289 | /* |
294 | 'formValueComponents': function () { | 290 | 'formValueComponents': function () { |
295 | return this._formValueComponents; | 291 | return this._formValueComponents; |
296 | }, | 292 | }, |
297 | 293 | ||
298 | 'clearAllFormValueComponents': function () { | 294 | 'clearAllFormValueComponents': function () { |
299 | MochiKit.Iter.forEach(this.formValueComponents(), MochiKit.Base.methodcaller('remove')); | 295 | MochiKit.Iter.forEach(this.formValueComponents(), MochiKit.Base.methodcaller('remove')); |
300 | this._formValueComponents = []; | 296 | this._formValueComponents = []; |
301 | this.getElement('formValues').innerHTML = ''; | 297 | this.getElement('formValues').innerHTML = ''; |
302 | }, | 298 | }, |
303 | 299 | ||
304 | 'addFormValueComponent': function (aFormValueComponent) { | 300 | 'addFormValueComponent': function (aFormValueComponent) { |
305 | this.formValueComponents().push(aFormValueComponent); | 301 | this.formValueComponents().push(aFormValueComponent); |
306 | aFormValueComponent.renderInNode(this.append(this.getElement('formValues'), {tag:'div'})); | 302 | aFormValueComponent.renderInNode(this.append(this.getElement('formValues'), {tag:'div'})); |
307 | }, | 303 | }, |
308 | */ | 304 | */ |
309 | //========================================================================= | 305 | //========================================================================= |
310 | 306 | ||
311 | 'changedValue': function (anEvent) { | 307 | 'changedValue': function (anEvent) { |
312 | MochiKit.Signal.signal(this, 'changedValue', anEvent); | 308 | MochiKit.Signal.signal(this, 'changedValue', anEvent); |
313 | 309 | ||
314 | this.incrementUpdateFaviconCounter(); | 310 | this.incrementUpdateFaviconCounter(); |
315 | MochiKit.Async.callLater(1, MochiKit.Base.method(this, 'updateFavicon')); | 311 | MochiKit.Async.callLater(1, MochiKit.Base.method(this, 'updateFavicon')); |
316 | }, | 312 | }, |
317 | 313 | ||
318 | //------------------------------------------------------------------------- | 314 | //------------------------------------------------------------------------- |
319 | 315 | ||
320 | 'handleBackClick': function (anEvent) { | 316 | 'handleBackClick': function (anEvent) { |
321 | anEvent.preventDefault(); | 317 | anEvent.preventDefault(); |
322 | 318 | ||
323 | MochiKit.Signal.signal(this, 'back'); | 319 | MochiKit.Signal.signal(this, 'back'); |
324 | }, | 320 | }, |
325 | 321 | ||
326 | //========================================================================= | 322 | //========================================================================= |
327 | 323 | ||
328 | 'bottomMargin': function () { | 324 | 'bottomMargin': function () { |
329 | var result; | 325 | var result; |
330 | 326 | ||
331 | //TODO: WTF!!! | 327 | //TODO: WTF!!! |
332 | // result =MochiKit.Style.getElementPosition(this.element())['y'] + | 328 | // result =MochiKit.Style.getElementPosition(this.element())['y'] + |
333 | // MochiKit.Style.getElementDimensions(this.element())['h']; | 329 | // MochiKit.Style.getElementDimensions(this.element())['h']; |
334 | 330 | ||
335 | // result =MochiKit.Style.getElementPosition(this.getElement('footer'))['y']; | 331 | // result =MochiKit.Style.getElementPosition(this.getElement('footer'))['y']; |
336 | //console.log("### bottomMargin"); | ||
337 | //console.log('displayElement', this.displayElement()); | ||
338 | //console.log('-- Clipperz.targetModalDimensionsAndPosition', Clipperz.Base.serializeJSON(Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition)); | ||
339 | //console.log('element', MochiKit.Style.getElementPosition('modalDialog') ['y'], MochiKit.Style.getElementDimensions('modalDialog')['h']); | ||
340 | // result = 450; | 332 | // result = 450; |
341 | 333 | ||
342 | result =Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition['position']['y'] + | 334 | result =Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition['position']['y'] + |
343 | Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition['dimensions']['h'] - | 335 | Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition['dimensions']['h'] - |
344 | 60; | 336 | 60; |
345 | 337 | ||
346 | return result; | 338 | return result; |
347 | }, | 339 | }, |
348 | 340 | ||
349 | //========================================================================= | 341 | //========================================================================= |
350 | 342 | ||
351 | 'focusOnUsernameElement': function () { | 343 | 'focusOnUsernameElement': function () { |
352 | MochiKit.Async.callLater(0.1, MochiKit.Base.method(this.getElement('username'), 'focus')); | 344 | MochiKit.Async.callLater(0.1, MochiKit.Base.method(this.getElement('username'), 'focus')); |
353 | }, | 345 | }, |
354 | 346 | ||
355 | 'focusOnRePassphraseElement': function () { | 347 | 'focusOnRePassphraseElement': function () { |
356 | this.getElement('re-passphrase').focus(); | 348 | this.getElement('re-passphrase').focus(); |
357 | }, | 349 | }, |
358 | /* | 350 | /* |
359 | 'focusOnBookmarkletConfigurationElement': function () { | 351 | 'focusOnBookmarkletConfigurationElement': function () { |
360 | this.getElement('bookmarkletConfiguration').focus(); | 352 | this.getElement('bookmarkletConfiguration').focus(); |
361 | }, | 353 | }, |
362 | 354 | ||
363 | 'focusOnFaviconElement': function () { | 355 | 'focusOnFaviconElement': function () { |
364 | this.getElement('faviconURL').focus(); | 356 | this.getElement('faviconURL').focus(); |
365 | }, | 357 | }, |
366 | */ | 358 | */ |
367 | 359 | ||
368 | //========================================================================= | 360 | //========================================================================= |
369 | 361 | ||
370 | 'hideAllProgeressStates': function () { | 362 | 'hideAllProgeressStates': function () { |
371 | MochiKit.Style.hideElement(this.getElement('creatingRegistering')); | 363 | MochiKit.Style.hideElement(this.getElement('creatingRegistering')); |
372 | MochiKit.Style.hideElement(this.getElement('creatingDone')); | 364 | MochiKit.Style.hideElement(this.getElement('creatingDone')); |
373 | MochiKit.Style.hideElement(this.getElement('creatingFailed')); | 365 | MochiKit.Style.hideElement(this.getElement('creatingFailed')); |
374 | }, | 366 | }, |
375 | 367 | ||
376 | 'showProgressOnUserCreation': function () { | 368 | 'showProgressOnUserCreation': function () { |
377 | //Clipperz.log(">>> NewUserCreationComponent.showProgressOnUserCreation"); | 369 | //Clipperz.log(">>> NewUserCreationComponent.showProgressOnUserCreation"); |
378 | this.hideAllProgeressStates(); | 370 | this.hideAllProgeressStates(); |
379 | MochiKit.Style.showElement(this.getElement('creatingRegistering')); | 371 | MochiKit.Style.showElement(this.getElement('creatingRegistering')); |
380 | }, | 372 | }, |
381 | 373 | ||
382 | 'showUserCreationDone': function () { | 374 | 'showUserCreationDone': function () { |
383 | //Clipperz.log(">>> NewUserCreationComponent.showUserCreationDone"); | 375 | //Clipperz.log(">>> NewUserCreationComponent.showUserCreationDone"); |
384 | this.hideAllProgeressStates(); | 376 | this.hideAllProgeressStates(); |
385 | MochiKit.Style.showElement(this.getElement('creatingDone')); | 377 | MochiKit.Style.showElement(this.getElement('creatingDone')); |
386 | //Clipperz.log("<<< NewUserCreationComponent.showUserCreationDone"); | 378 | //Clipperz.log("<<< NewUserCreationComponent.showUserCreationDone"); |
387 | }, | 379 | }, |
388 | 380 | ||
389 | 'showUserCreationFailed': function () { | 381 | 'showUserCreationFailed': function () { |
390 | //Clipperz.log(">>> NewUserCreationComponent.showUserCreationFailed"); | 382 | //Clipperz.log(">>> NewUserCreationComponent.showUserCreationFailed"); |
391 | this.hideAllProgeressStates(); | 383 | this.hideAllProgeressStates(); |
392 | MochiKit.Style.showElement(this.getElement('creatingFailed')); | 384 | MochiKit.Style.showElement(this.getElement('creatingFailed')); |
393 | }, | 385 | }, |
394 | 386 | ||
395 | //========================================================================= | 387 | //========================================================================= |
396 | 388 | ||
397 | 'handleKeyEvent': function (anEvent) { | 389 | 'handleKeyEvent': function (anEvent) { |
398 | MochiKit.Signal.signal(this, 'keyPressed', anEvent); | 390 | MochiKit.Signal.signal(this, 'keyPressed', anEvent); |
399 | /* | 391 | /* |
400 | if (anEvent.key().string == 'KEY_ENTER') { | 392 | if (anEvent.key().string == 'KEY_ENTER') { |
401 | if (anEvent.target().nodeName != 'TEXTAREA') { | 393 | if (anEvent.target().nodeName != 'TEXTAREA') { |
402 | MochiKit.Signal.signal(this, 'moveForward'); | 394 | MochiKit.Signal.signal(this, 'moveForward'); |
403 | anEvent.preventDefault(); | 395 | anEvent.preventDefault(); |
404 | } | 396 | } |
405 | } else if (anEvent.key().string == 'KEY_TAB') { | 397 | } else if (anEvent.key().string == 'KEY_TAB') { |
406 | if ((anEvent.target().nodeName == 'INPUT') || (anEvent.target().nodeName == 'TEXTAREA')) { | 398 | if ((anEvent.target().nodeName == 'INPUT') || (anEvent.target().nodeName == 'TEXTAREA')) { |
407 | MochiKit.Signal.signal(this, 'moveForward'); | 399 | MochiKit.Signal.signal(this, 'moveForward'); |
408 | anEvent.preventDefault(); | 400 | anEvent.preventDefault(); |
409 | } | 401 | } |
410 | } | 402 | } |
411 | */ | 403 | */ |
412 | }, | 404 | }, |
413 | 405 | ||
414 | 'handleTermsOfServiceCheckboxChange': function (anEvent) { | 406 | 'handleTermsOfServiceCheckboxChange': function (anEvent) { |
415 | MochiKit.Signal.signal(this, 'changedValue'); | 407 | MochiKit.Signal.signal(this, 'changedValue'); |
416 | }, | 408 | }, |
417 | 409 | ||
418 | //========================================================================= | 410 | //========================================================================= |
419 | 411 | ||
420 | 'clear': function () { | 412 | 'clear': function () { |
421 | this.tabPanelController().selectTab(null); | 413 | this.tabPanelController().selectTab(null); |
422 | Clipperz.PM.UI.Web.Components.NewUserCreationComponent.superclass.clear.apply(this, arguments); | 414 | Clipperz.PM.UI.Web.Components.NewUserCreationComponent.superclass.clear.apply(this, arguments); |
423 | }, | 415 | }, |
424 | 416 | ||
425 | //========================================================================= | 417 | //========================================================================= |
426 | __syntaxFix__: "syntax fix" | 418 | __syntaxFix__: "syntax fix" |
427 | }); | 419 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/Page.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/Page.js index 3cc5a37..30cbeb2 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/Page.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/Page.js | |||
@@ -1,68 +1,66 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.Page = function(args) { | 26 | Clipperz.PM.UI.Web.Components.Page = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.Page.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.Page.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._slots = { | 31 | this._slots = { |
34 | 'header':'pageHeader', | 32 | 'header':'pageHeader', |
35 | 'body': 'pageBody', | 33 | 'body': 'pageBody', |
36 | 'footer':'pageFooter' | 34 | 'footer':'pageFooter' |
37 | }; | 35 | }; |
38 | 36 | ||
39 | return this; | 37 | return this; |
40 | } | 38 | } |
41 | 39 | ||
42 | //============================================================================= | 40 | //============================================================================= |
43 | 41 | ||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.Page, Clipperz.PM.UI.Common.Components.BaseComponent, { | 42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.Page, Clipperz.PM.UI.Common.Components.BaseComponent, { |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
47 | 45 | ||
48 | 'toString': function () { | 46 | 'toString': function () { |
49 | return "Clipperz.PM.UI.Web.Components.Page component"; | 47 | return "Clipperz.PM.UI.Web.Components.Page component"; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
53 | 51 | ||
54 | 'renderSelf': function(/*aContainer, aPosition*/) { | 52 | 'renderSelf': function(/*aContainer, aPosition*/) { |
55 | this.append(this.element(), [ | 53 | this.append(this.element(), [ |
56 | {tag:'div', id:'pageHeaderAndBody', cls:'pageHeaderAndBody', children:[ | 54 | {tag:'div', id:'pageHeaderAndBody', cls:'pageHeaderAndBody', children:[ |
57 | {tag:'div', id:'pageHeader', cls:'pageHeader'}, | 55 | {tag:'div', id:'pageHeader', cls:'pageHeader'}, |
58 | {tag:'div', id:'pageBody', cls:'pageBody'} | 56 | {tag:'div', id:'pageBody', cls:'pageBody'} |
59 | ]}, | 57 | ]}, |
60 | {tag:'div', id:'pageFooter', cls:'pageFooter'} | 58 | {tag:'div', id:'pageFooter', cls:'pageFooter'} |
61 | ]); | 59 | ]); |
62 | 60 | ||
63 | }, | 61 | }, |
64 | 62 | ||
65 | //------------------------------------------------------------------------- | 63 | //------------------------------------------------------------------------- |
66 | 64 | ||
67 | __syntaxFix__: "syntax fix" | 65 | __syntaxFix__: "syntax fix" |
68 | }); | 66 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageFooter.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageFooter.js index dcf506f..df3ca0c 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageFooter.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageFooter.js | |||
@@ -1,67 +1,65 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.PageFooter = function(args) { | 26 | Clipperz.PM.UI.Web.Components.PageFooter = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.PageFooter.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.PageFooter.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | return this; | 31 | return this; |
34 | } | 32 | } |
35 | 33 | ||
36 | //============================================================================= | 34 | //============================================================================= |
37 | 35 | ||
38 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.PageFooter, Clipperz.PM.UI.Common.Components.BaseComponent, { | 36 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.PageFooter, Clipperz.PM.UI.Common.Components.BaseComponent, { |
39 | 37 | ||
40 | //------------------------------------------------------------------------- | 38 | //------------------------------------------------------------------------- |
41 | 39 | ||
42 | 'toString': function () { | 40 | 'toString': function () { |
43 | return "Clipperz.PM.UI.Web.Components.PageFooter component"; | 41 | return "Clipperz.PM.UI.Web.Components.PageFooter component"; |
44 | }, | 42 | }, |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
47 | 45 | ||
48 | 'renderSelf': function(/*aContainer, aPosition*/) { | 46 | 'renderSelf': function(/*aContainer, aPosition*/) { |
49 | this.append(this.element(), [ | 47 | this.append(this.element(), [ |
50 | {tag:'div', cls:'footerWrapper', children:[ | 48 | {tag:'div', cls:'footerWrapper', children:[ |
51 | {tag:'div', cls:'footerContent', children:[ | 49 | {tag:'div', cls:'footerContent', children:[ |
52 | {tag:'canvas', id:this.getId('footerStarIcon'), cls:'footerStarIcon'}, | 50 | {tag:'canvas', id:this.getId('footerStarIcon'), cls:'footerStarIcon'}, |
53 | {tag:'span', cls:'copyright', html:'Copyright © 2009-2013 Clipperz Srl'}, | 51 | {tag:'span', cls:'copyright', html:'Copyright © 2009-2013 Clipperz Srl'}, |
54 | {tag:'a', href:'http://www.clipperz.com/terms_of_service',target:'_blank', html:'terms of service'}, | 52 | {tag:'a', href:'http://www.clipperz.com/terms_of_service',target:'_blank', html:'terms of service'}, |
55 | {tag:'a', href:'http://www.clipperz.com/privacy_policy',target:'_blank', html:'privacy policy'}, | 53 | {tag:'a', href:'http://www.clipperz.com/privacy_policy',target:'_blank', html:'privacy policy'}, |
56 | {tag:'div', cls:'applicationVersion', htmlString:'application version: <a href="https://github.com/clipperz/password-manager/tree/' + Clipperz_version + '" target="github">' + Clipperz_version + '</a>'} | 54 | {tag:'div', cls:'applicationVersion', htmlString:'application version: <a href="https://github.com/clipperz/password-manager/tree/' + Clipperz_version + '" target="github">' + Clipperz_version + '</a>'} |
57 | ]} | 55 | ]} |
58 | ]} | 56 | ]} |
59 | ]); | 57 | ]); |
60 | 58 | ||
61 | Clipperz.PM.UI.Canvas.star.normal(this.getElement('footerStarIcon'), "#7e7e7e"); | 59 | Clipperz.PM.UI.Canvas.star.normal(this.getElement('footerStarIcon'), "#7e7e7e"); |
62 | }, | 60 | }, |
63 | 61 | ||
64 | //------------------------------------------------------------------------- | 62 | //------------------------------------------------------------------------- |
65 | 63 | ||
66 | __syntaxFix__: "syntax fix" | 64 | __syntaxFix__: "syntax fix" |
67 | }); | 65 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageHeader.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageHeader.js index b8f3b05..5e49fb5 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageHeader.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageHeader.js | |||
@@ -1,191 +1,189 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.PageHeader = function(args) { | 26 | Clipperz.PM.UI.Web.Components.PageHeader = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.PageHeader.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.PageHeader.superclass.constructor.apply(this, arguments); |
32 | this._newsIsOpen = args.newsIsOpen || false; | 30 | this._newsIsOpen = args.newsIsOpen || false; |
33 | this._animationDuration = args.animationDuration || 0.5; | 31 | this._animationDuration = args.animationDuration || 0.5; |
34 | 32 | ||
35 | this._offset = 82; | 33 | this._offset = 82; |
36 | 34 | ||
37 | return this; | 35 | return this; |
38 | } | 36 | } |
39 | 37 | ||
40 | //============================================================================= | 38 | //============================================================================= |
41 | 39 | ||
42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.PageHeader, Clipperz.PM.UI.Common.Components.BaseComponent, { | 40 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.PageHeader, Clipperz.PM.UI.Common.Components.BaseComponent, { |
43 | 41 | ||
44 | //------------------------------------------------------------------------- | 42 | //------------------------------------------------------------------------- |
45 | 43 | ||
46 | 'toString': function () { | 44 | 'toString': function () { |
47 | return "Clipperz.PM.UI.Web.Components.PageHeader component"; | 45 | return "Clipperz.PM.UI.Web.Components.PageHeader component"; |
48 | }, | 46 | }, |
49 | 47 | ||
50 | //------------------------------------------------------------------------- | 48 | //------------------------------------------------------------------------- |
51 | 49 | ||
52 | 'iframeURL': function () { | 50 | 'iframeURL': function () { |
53 | // return './rss_view.html'; | 51 | // return './rss_view.html'; |
54 | return 'http://www.clipperz.com/files/clipperz.com/appTips/index.html'; | 52 | return 'http://www.clipperz.com/files/clipperz.com/appTips/index.html'; |
55 | }, | 53 | }, |
56 | 54 | ||
57 | //------------------------------------------------------------------------- | 55 | //------------------------------------------------------------------------- |
58 | 56 | ||
59 | 'renderSelf': function(/*aContainer, aPosition*/) { | 57 | 'renderSelf': function(/*aContainer, aPosition*/) { |
60 | this.append(this.element(), [ | 58 | this.append(this.element(), [ |
61 | {tag:'div', id:'miscLinks', children:[ | 59 | {tag:'div', id:'miscLinks', children:[ |
62 | {tag:'ul', children:[ | 60 | {tag:'ul', children:[ |
63 | {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')}]}, | 61 | {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')}]}, |
64 | {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')}]}, | 62 | {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')}]}, |
65 | {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')}]}, | 63 | {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')}]}, |
66 | {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')}]}, | 64 | {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')}]}, |
67 | {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')}]} | 65 | {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')}]} |
68 | ]} | 66 | ]} |
69 | ]}, | 67 | ]}, |
70 | {tag:'div', id:'logoFrame', children:[ | 68 | {tag:'div', id:'logoFrame', children:[ |
71 | {tag:'a', href:'http://www.clipperz.com', target:'_blank', children:[ | 69 | {tag:'a', href:'http://www.clipperz.com', target:'_blank', children:[ |
72 | // {tag:'h1', cls:'logo', html:"clipperz"}, | 70 | // {tag:'h1', cls:'logo', html:"clipperz"}, |
73 | {tag:'canvas', id:this.getId('logo'), cls:'logo'}, | 71 | {tag:'canvas', id:this.getId('logo'), cls:'logo'}, |
74 | {tag:'h5', cls:'clipperzPayoff', html:"keep it to yourself!"} | 72 | {tag:'h5', cls:'clipperzPayoff', html:"keep it to yourself!"} |
75 | ]} | 73 | ]} |
76 | ]}, | 74 | ]}, |
77 | {tag:'div', id:'news', cls:'hidden', children:[ | 75 | {tag:'div', id:'news', cls:'hidden', children:[ |
78 | // {tag:'div', cls:'close', children:[ | 76 | // {tag:'div', cls:'close', children:[ |
79 | // {tag:'a', href:'#', id:this.getId('closeTips'), html:'x'} | 77 | // {tag:'a', href:'#', id:this.getId('closeTips'), html:'x'} |
80 | // ]}, | 78 | // ]}, |
81 | {tag:'div', id:'newsframe', children:[ | 79 | {tag:'div', id:'newsframe', children:[ |
82 | {tag:'iframe', id:this.getId('iframe'), src:this.iframeURL()} | 80 | {tag:'iframe', id:this.getId('iframe'), src:this.iframeURL()} |
83 | ]}, | 81 | ]}, |
84 | {tag:'div', id:this.getId('newsGrip'), cls:'grip', children:[ | 82 | {tag:'div', id:this.getId('newsGrip'), cls:'grip', children:[ |
85 | {tag:'div', cls:'gripHandler', children:[]} | 83 | {tag:'div', cls:'gripHandler', children:[]} |
86 | ]} | 84 | ]} |
87 | ]}, | 85 | ]}, |
88 | {tag:'div', id:'featureTabs', children:[ | 86 | {tag:'div', id:'featureTabs', children:[ |
89 | {tag:'table', children:[{tag:'tr', children:[ | 87 | {tag:'table', children:[{tag:'tr', children:[ |
90 | {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"}]}]}, | 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"}]}]}, |
91 | {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"}]}]}, | 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"}]}]}, |
92 | {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"}]}]}, | 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"}]}]}, |
93 | {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"}]}]} | 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"}]}]} |
94 | ]}]} | 92 | ]}]} |
95 | ]} | 93 | ]} |
96 | ]); | 94 | ]); |
97 | 95 | ||
98 | Clipperz.PM.UI.Canvas.features.store(this.getElement('storeIcon'), "#ffffff"); | 96 | Clipperz.PM.UI.Canvas.features.store(this.getElement('storeIcon'), "#ffffff"); |
99 | Clipperz.PM.UI.Canvas.features.protect(this.getElement('protectIcon'), "#ffffff"); | 97 | Clipperz.PM.UI.Canvas.features.protect(this.getElement('protectIcon'), "#ffffff"); |
100 | Clipperz.PM.UI.Canvas.features.directLogin(this.getElement('directLoginIcon'), "#ffffff"); | 98 | Clipperz.PM.UI.Canvas.features.directLogin(this.getElement('directLoginIcon'), "#ffffff"); |
101 | Clipperz.PM.UI.Canvas.features.share(this.getElement('shareIcon'), "#ffffff", "#ffffff", "#ff0000"); | 99 | Clipperz.PM.UI.Canvas.features.share(this.getElement('shareIcon'), "#ffffff", "#ffffff", "#ff0000"); |
102 | 100 | ||
103 | MochiKit.Signal.connect(this.getElement('newsGrip'), 'onclick', this, 'toggleTips'); | 101 | MochiKit.Signal.connect(this.getElement('newsGrip'), 'onclick', this, 'toggleTips'); |
104 | MochiKit.Signal.connect(this.getElement('iframe'), 'onload', this, 'handleIframeDidLoad'); | 102 | MochiKit.Signal.connect(this.getElement('iframe'), 'onload', this, 'handleIframeDidLoad'); |
105 | this.setLogoDefaultColors(); | 103 | this.setLogoDefaultColors(); |
106 | }, | 104 | }, |
107 | 105 | ||
108 | //------------------------------------------------------------------------- | 106 | //------------------------------------------------------------------------- |
109 | 107 | ||
110 | 'switchToLoggedMode': function() { | 108 | 'switchToLoggedMode': function() { |
111 | // MochiKit.Style.addElementClass(this.element(), 'logged'); | 109 | // MochiKit.Style.addElementClass(this.element(), 'logged'); |
112 | MochiKit.Style.hideElement('featureTabs'); | 110 | MochiKit.Style.hideElement('featureTabs'); |
113 | }, | 111 | }, |
114 | 112 | ||
115 | //------------------------------------------------------------------------- | 113 | //------------------------------------------------------------------------- |
116 | 114 | ||
117 | 'animationDuration': function () { | 115 | 'animationDuration': function () { |
118 | return this._animationDuration; | 116 | return this._animationDuration; |
119 | }, | 117 | }, |
120 | 118 | ||
121 | 'offset': function () { | 119 | 'offset': function () { |
122 | return this._offset; | 120 | return this._offset; |
123 | }, | 121 | }, |
124 | 122 | ||
125 | //------------------------------------------------------------------------- | 123 | //------------------------------------------------------------------------- |
126 | 124 | ||
127 | 'isNewsOpen': function () { | 125 | 'isNewsOpen': function () { |
128 | return this._newsIsOpen; | 126 | return this._newsIsOpen; |
129 | }, | 127 | }, |
130 | 128 | ||
131 | 'toggleNewsIsOpen': function () { | 129 | 'toggleNewsIsOpen': function () { |
132 | this._newsIsOpen = !this._newsIsOpen; | 130 | this._newsIsOpen = !this._newsIsOpen; |
133 | }, | 131 | }, |
134 | 132 | ||
135 | 'toggleTips': function(anEvent) { | 133 | 'toggleTips': function(anEvent) { |
136 | anEvent.preventDefault(); | 134 | anEvent.preventDefault(); |
137 | 135 | ||
138 | if (this.isNewsOpen() == true) { | 136 | if (this.isNewsOpen() == true) { |
139 | MochiKit.Visual.Move(Clipperz.DOM.get('news'), { | 137 | MochiKit.Visual.Move(Clipperz.DOM.get('news'), { |
140 | x: 0, | 138 | x: 0, |
141 | y: -this.offset(), | 139 | y: -this.offset(), |
142 | mode: 'relative', | 140 | mode: 'relative', |
143 | duration: this.animationDuration(), | 141 | duration: this.animationDuration(), |
144 | beforeStart: function () { | 142 | beforeStart: function () { |
145 | MochiKit.DOM.setElementClass(Clipperz.DOM.get('news'), 'hiding'); | 143 | MochiKit.DOM.setElementClass(Clipperz.DOM.get('news'), 'hiding'); |
146 | }, | 144 | }, |
147 | afterFinish: function () { | 145 | afterFinish: function () { |
148 | Clipperz.DOM.get('newsframe').innerHTML = ""; | 146 | Clipperz.DOM.get('newsframe').innerHTML = ""; |
149 | MochiKit.DOM.setElementClass(Clipperz.DOM.get('news'), 'hidden'); | 147 | MochiKit.DOM.setElementClass(Clipperz.DOM.get('news'), 'hidden'); |
150 | } | 148 | } |
151 | }) | 149 | }) |
152 | this.toggleNewsIsOpen(); | 150 | this.toggleNewsIsOpen(); |
153 | } else { | 151 | } else { |
154 | MochiKit.DOM.addElementClass('newsframe', 'loading'); | 152 | MochiKit.DOM.addElementClass('newsframe', 'loading'); |
155 | MochiKit.Visual.Move(Clipperz.DOM.get('news'), { | 153 | MochiKit.Visual.Move(Clipperz.DOM.get('news'), { |
156 | x: 0, | 154 | x: 0, |
157 | y: this.offset(), | 155 | y: this.offset(), |
158 | mode: 'relative', | 156 | mode: 'relative', |
159 | duration: this.animationDuration(), | 157 | duration: this.animationDuration(), |
160 | beforeStart: MochiKit.Base.bind(function () { | 158 | beforeStart: MochiKit.Base.bind(function () { |
161 | this.append(Clipperz.DOM.get('newsframe'), {tag:'iframe', id:this.getId('iframe'), src:this.iframeURL()}); | 159 | this.append(Clipperz.DOM.get('newsframe'), {tag:'iframe', id:this.getId('iframe'), src:this.iframeURL()}); |
162 | 160 | ||
163 | MochiKit.Signal.connect(this.getElement('iframe'), 'onload', this, 'handleIframeDidLoad'); | 161 | MochiKit.Signal.connect(this.getElement('iframe'), 'onload', this, 'handleIframeDidLoad'); |
164 | MochiKit.DOM.setElementClass(Clipperz.DOM.get('news'), 'opening'); | 162 | MochiKit.DOM.setElementClass(Clipperz.DOM.get('news'), 'opening'); |
165 | }, this), | 163 | }, this), |
166 | afterFinish: function () { | 164 | afterFinish: function () { |
167 | MochiKit.DOM.setElementClass(Clipperz.DOM.get('news'), 'open'); | 165 | MochiKit.DOM.setElementClass(Clipperz.DOM.get('news'), 'open'); |
168 | } | 166 | } |
169 | }) | 167 | }) |
170 | this.toggleNewsIsOpen(); | 168 | this.toggleNewsIsOpen(); |
171 | } | 169 | } |
172 | }, | 170 | }, |
173 | 171 | ||
174 | 'setLogoDefaultColors': function () { | 172 | 'setLogoDefaultColors': function () { |
175 | Clipperz.PM.UI.Canvas.logo.normal(this.getElement('logo'), "clipperz", "28.0pt", "#ffffff"); | 173 | Clipperz.PM.UI.Canvas.logo.normal(this.getElement('logo'), "clipperz", "28.0pt", "#ffffff"); |
176 | }, | 174 | }, |
177 | 175 | ||
178 | //------------------------------------------------------------------------- | 176 | //------------------------------------------------------------------------- |
179 | 177 | ||
180 | 'handleIframeDidLoad': function (anEvent) { | 178 | 'handleIframeDidLoad': function (anEvent) { |
181 | if (this.isNewsOpen() == false) { | 179 | if (this.isNewsOpen() == false) { |
182 | this.toggleTips(anEvent); | 180 | this.toggleTips(anEvent); |
183 | } | 181 | } |
184 | 182 | ||
185 | MochiKit.DOM.removeElementClass('newsframe', 'loading'); | 183 | MochiKit.DOM.removeElementClass('newsframe', 'loading'); |
186 | MochiKit.Signal.disconnectAllTo(this.getElement('iframe')); | 184 | MochiKit.Signal.disconnectAllTo(this.getElement('iframe')); |
187 | }, | 185 | }, |
188 | 186 | ||
189 | //------------------------------------------------------------------------- | 187 | //------------------------------------------------------------------------- |
190 | __syntaxFix__: "syntax fix" | 188 | __syntaxFix__: "syntax fix" |
191 | }); | 189 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PasswordTooltip.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PasswordTooltip.js index 987e51e..5eb0c1f 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PasswordTooltip.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PasswordTooltip.js | |||
@@ -1,161 +1,159 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.PasswordTooltip = function(args) { | 26 | Clipperz.PM.UI.Web.Components.PasswordTooltip = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.PasswordTooltip.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.PasswordTooltip.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._referenceElement = args.referenceElement|| Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._referenceElement = args.referenceElement|| Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | 33 | ||
36 | this._boxDimensions = null; | 34 | this._boxDimensions = null; |
37 | this._isVisible = false; | 35 | this._isVisible = false; |
38 | 36 | ||
39 | this.renderSelf(); | 37 | this.renderSelf(); |
40 | 38 | ||
41 | return this; | 39 | return this; |
42 | } | 40 | } |
43 | 41 | ||
44 | //============================================================================= | 42 | //============================================================================= |
45 | 43 | ||
46 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.PasswordTooltip, Clipperz.PM.UI.Common.Components.BaseComponent, { | 44 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.PasswordTooltip, Clipperz.PM.UI.Common.Components.BaseComponent, { |
47 | 45 | ||
48 | //------------------------------------------------------------------------- | 46 | //------------------------------------------------------------------------- |
49 | 47 | ||
50 | 'toString': function () { | 48 | 'toString': function () { |
51 | return "Clipperz.PM.UI.Web.Components.PasswordTooltip component"; | 49 | return "Clipperz.PM.UI.Web.Components.PasswordTooltip component"; |
52 | }, | 50 | }, |
53 | 51 | ||
54 | //------------------------------------------------------------------------- | 52 | //------------------------------------------------------------------------- |
55 | 53 | ||
56 | 'referenceElement': function () { | 54 | 'referenceElement': function () { |
57 | return this._referenceElement; | 55 | return this._referenceElement; |
58 | }, | 56 | }, |
59 | 57 | ||
60 | //------------------------------------------------------------------------- | 58 | //------------------------------------------------------------------------- |
61 | 59 | ||
62 | 'text': function () { | 60 | 'text': function () { |
63 | return this._text; | 61 | return this._text; |
64 | }, | 62 | }, |
65 | 63 | ||
66 | 'setText': function (aValue) { | 64 | 'setText': function (aValue) { |
67 | this._text = aValue; | 65 | this._text = aValue; |
68 | }, | 66 | }, |
69 | 67 | ||
70 | //------------------------------------------------------------------------- | 68 | //------------------------------------------------------------------------- |
71 | 69 | ||
72 | 'isVisible': function () { | 70 | 'isVisible': function () { |
73 | return this._isVisible; | 71 | return this._isVisible; |
74 | }, | 72 | }, |
75 | 73 | ||
76 | 'setIsVisible': function (aValue) { | 74 | 'setIsVisible': function (aValue) { |
77 | this._isVisible = aValue; | 75 | this._isVisible = aValue; |
78 | }, | 76 | }, |
79 | 77 | ||
80 | //------------------------------------------------------------------------- | 78 | //------------------------------------------------------------------------- |
81 | 79 | ||
82 | 'renderSelf': function() { | 80 | 'renderSelf': function() { |
83 | this.append(MochiKit.DOM.getElement('Clipperz_PM_UI_Common_Components_Tooltip_wrapperNode'), {tag:'div', id:this.getId('tooltip'), cls:'passwordTooltip', children:[ | 81 | this.append(MochiKit.DOM.getElement('Clipperz_PM_UI_Common_Components_Tooltip_wrapperNode'), {tag:'div', id:this.getId('tooltip'), cls:'passwordTooltip', children:[ |
84 | {tag:'div', id:this.getId('body'), cls:'passwordTooltip_body', children:[ | 82 | {tag:'div', id:this.getId('body'), cls:'passwordTooltip_body', children:[ |
85 | {tag:'div', cls:'passwordTooltip_text', children:[ | 83 | {tag:'div', cls:'passwordTooltip_text', children:[ |
86 | {tag:'span', html:this.text()} | 84 | {tag:'span', html:this.text()} |
87 | ]}, | 85 | ]}, |
88 | {tag:'div', id:this.getId('footer'), cls:'passwordTooltip_footer'} | 86 | {tag:'div', id:this.getId('footer'), cls:'passwordTooltip_footer'} |
89 | ]}, | 87 | ]}, |
90 | {tag:'div', id:this.getId('arrow'), cls:'passwordTooltip_arrow'} | 88 | {tag:'div', id:this.getId('arrow'), cls:'passwordTooltip_arrow'} |
91 | ]}); | 89 | ]}); |
92 | 90 | ||
93 | this._boxDimensions = MochiKit.Style.getElementDimensions(this.getId('body')); | 91 | this._boxDimensions = MochiKit.Style.getElementDimensions(this.getId('body')); |
94 | // this._boxDimensions.h += MochiKit.Style.getElementDimensions(this.getId('footer')).h; | 92 | // this._boxDimensions.h += MochiKit.Style.getElementDimensions(this.getId('footer')).h; |
95 | 93 | ||
96 | MochiKit.Style.hideElement(this.displayElement()); | 94 | MochiKit.Style.hideElement(this.displayElement()); |
97 | MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); | 95 | MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); |
98 | MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); | 96 | MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); |
99 | }, | 97 | }, |
100 | 98 | ||
101 | //----------------------------------------------------- | 99 | //----------------------------------------------------- |
102 | 100 | ||
103 | 'displayElement': function() { | 101 | 'displayElement': function() { |
104 | return this.getElement('tooltip'); | 102 | return this.getElement('tooltip'); |
105 | }, | 103 | }, |
106 | 104 | ||
107 | //------------------------------------------------------------------------- | 105 | //------------------------------------------------------------------------- |
108 | 106 | ||
109 | 'boxDimensions': function () { | 107 | 'boxDimensions': function () { |
110 | return this._boxDimensions; | 108 | return this._boxDimensions; |
111 | }, | 109 | }, |
112 | 110 | ||
113 | //------------------------------------------------------------------------- | 111 | //------------------------------------------------------------------------- |
114 | 112 | ||
115 | 'show': function () { | 113 | 'show': function () { |
116 | var elementSizeAndPosition; | 114 | var elementSizeAndPosition; |
117 | var arrowPosition; | 115 | var arrowPosition; |
118 | var bodyPosition; | 116 | var bodyPosition; |
119 | 117 | ||
120 | if (this.isVisible() == false) { | 118 | if (this.isVisible() == false) { |
121 | arrowPosition = {}; | 119 | arrowPosition = {}; |
122 | bodyPosition = {}; | 120 | bodyPosition = {}; |
123 | 121 | ||
124 | this.setIsVisible(true); | 122 | this.setIsVisible(true); |
125 | elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element()); | 123 | elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element()); |
126 | 124 | ||
127 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); | 125 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); |
128 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); | 126 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); |
129 | bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13; | 127 | bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13; |
130 | 128 | ||
131 | arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); | 129 | arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); |
132 | arrowPosition.y = elementSizeAndPosition.position.y - 13; | 130 | arrowPosition.y = elementSizeAndPosition.position.y - 13; |
133 | 131 | ||
134 | MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); | 132 | MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); |
135 | MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition); | 133 | MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition); |
136 | MochiKit.Visual.appear(this.displayElement(), {duration:0.4}); | 134 | MochiKit.Visual.appear(this.displayElement(), {duration:0.4}); |
137 | } | 135 | } |
138 | }, | 136 | }, |
139 | 137 | ||
140 | 'hide': function () { | 138 | 'hide': function () { |
141 | if (this.isVisible() == true) { | 139 | if (this.isVisible() == true) { |
142 | MochiKit.Visual.fade(this.displayElement(), {duration:0.4}); | 140 | MochiKit.Visual.fade(this.displayElement(), {duration:0.4}); |
143 | this.setIsVisible(false); | 141 | this.setIsVisible(false); |
144 | } | 142 | } |
145 | }, | 143 | }, |
146 | 144 | ||
147 | //------------------------------------------------------------------------- | 145 | //------------------------------------------------------------------------- |
148 | /* | 146 | /* |
149 | 'shouldRemoveElementWhenClearningUp': function () { | 147 | 'shouldRemoveElementWhenClearningUp': function () { |
150 | return false; | 148 | return false; |
151 | }, | 149 | }, |
152 | */ | 150 | */ |
153 | //------------------------------------------------------------------------- | 151 | //------------------------------------------------------------------------- |
154 | __syntaxFix__: "syntax fix" | 152 | __syntaxFix__: "syntax fix" |
155 | }); | 153 | }); |
156 | 154 | ||
157 | Clipperz.PM.UI.Web.Components.PasswordTooltip.initTooltips = function () { | 155 | Clipperz.PM.UI.Web.Components.PasswordTooltip.initTooltips = function () { |
158 | Clipperz.DOM.Helper.insertBefore(MochiKit.DOM.currentDocument().body.childNodes[0], {tag:'div', id:'Clipperz_PM_UI_Web_Components_PasswordTooltip_wrapperNode'}); | 156 | Clipperz.DOM.Helper.insertBefore(MochiKit.DOM.currentDocument().body.childNodes[0], {tag:'div', id:'Clipperz_PM_UI_Web_Components_PasswordTooltip_wrapperNode'}); |
159 | } | 157 | } |
160 | 158 | ||
161 | MochiKit.DOM.addLoadEvent(Clipperz.PM.UI.Web.Components.PasswordTooltip.initTooltips); | 159 | MochiKit.DOM.addLoadEvent(Clipperz.PM.UI.Web.Components.PasswordTooltip.initTooltips); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/RulerComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/RulerComponent.js index 69c1ede..ad8d677 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/RulerComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/RulerComponent.js | |||
@@ -1,307 +1,304 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.RulerComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.RulerComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | Clipperz.PM.UI.Web.Components.RulerComponent.superclass.constructor.apply(this, arguments); | 28 | Clipperz.PM.UI.Web.Components.RulerComponent.superclass.constructor.apply(this, arguments); |
31 | 29 | ||
32 | this._translationContext = args.translationContext|| Clipperz.Base.exception.raise('MandatoryParameter'); | 30 | this._translationContext = args.translationContext|| Clipperz.Base.exception.raise('MandatoryParameter'); |
33 | // this._steps = args.steps || Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | // this._steps = args.steps || Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._steps = args.steps; | 32 | this._steps = args.steps; |
35 | 33 | ||
36 | this._currentStep = -1; | 34 | this._currentStep = -1; |
37 | 35 | ||
38 | return this; | 36 | return this; |
39 | } | 37 | } |
40 | 38 | ||
41 | //============================================================================= | 39 | //============================================================================= |
42 | 40 | ||
43 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.RulerComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 41 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.RulerComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { |
44 | 42 | ||
45 | //------------------------------------------------------------------------- | 43 | //------------------------------------------------------------------------- |
46 | 44 | ||
47 | 'toString': function () { | 45 | 'toString': function () { |
48 | return "Clipperz.PM.UI.Web.Components.RulerComponent component"; | 46 | return "Clipperz.PM.UI.Web.Components.RulerComponent component"; |
49 | }, | 47 | }, |
50 | 48 | ||
51 | //------------------------------------------------------------------------- | 49 | //------------------------------------------------------------------------- |
52 | 50 | ||
53 | 'resetStatus': function (args) { | 51 | 'resetStatus': function (args) { |
54 | args = args || {}; | 52 | args = args || {}; |
55 | 53 | ||
56 | if (this.currentStep() != 0) { | 54 | if (this.currentStep() != 0) { |
57 | var shouldAnimateTransition; | 55 | var shouldAnimateTransition; |
58 | 56 | ||
59 | shouldAnimateTransition = args.animateTransition || false; | 57 | shouldAnimateTransition = args.animateTransition || false; |
60 | 58 | ||
61 | if (shouldAnimateTransition) { | 59 | if (shouldAnimateTransition) { |
62 | this.moveToFirstStep(MochiKit.Base.method(this, 'cursorMoved')); | 60 | this.moveToFirstStep(MochiKit.Base.method(this, 'cursorMoved')); |
63 | } else { | 61 | } else { |
64 | this._currentStep = 0; | 62 | this._currentStep = 0; |
65 | this.cursorMoved(); | 63 | this.cursorMoved(); |
66 | } | 64 | } |
67 | } | 65 | } |
68 | }, | 66 | }, |
69 | 67 | ||
70 | //------------------------------------------------------------------------- | 68 | //------------------------------------------------------------------------- |
71 | 69 | ||
72 | 'translationContext': function () { | 70 | 'translationContext': function () { |
73 | return this._translationContext; | 71 | return this._translationContext; |
74 | }, | 72 | }, |
75 | 73 | ||
76 | 'steps': function () { | 74 | 'steps': function () { |
77 | return this._steps; | 75 | return this._steps; |
78 | }, | 76 | }, |
79 | 77 | ||
80 | 'setSteps': function (aValue) { | 78 | 'setSteps': function (aValue) { |
81 | this._steps = aValue; | 79 | this._steps = aValue; |
82 | this.renderStepsComponents(); | 80 | this.renderStepsComponents(); |
83 | this.resetStatus(); | 81 | this.resetStatus(); |
84 | }, | 82 | }, |
85 | 83 | ||
86 | 'translatedStepDescription': function (aStep) { | 84 | 'translatedStepDescription': function (aStep) { |
87 | return Clipperz.PM.Strings.getValue(this.translationContext() + '.' + aStep + '.' + 'name'); | 85 | return Clipperz.PM.Strings.getValue(this.translationContext() + '.' + aStep + '.' + 'name'); |
88 | }, | 86 | }, |
89 | 87 | ||
90 | //------------------------------------------------------------------------- | 88 | //------------------------------------------------------------------------- |
91 | 89 | ||
92 | 'renderSelf': function(/*aContainer, aPosition*/) { | 90 | 'renderSelf': function(/*aContainer, aPosition*/) { |
93 | this.setElement(this.append(MochiKit.DOM.currentDocument().body, [ | 91 | this.setElement(this.append(MochiKit.DOM.currentDocument().body, [ |
94 | {tag:'div', id:this.getId('rulerWrapper'), cls:'rulerWrapper fixed', children:[ | 92 | {tag:'div', id:this.getId('rulerWrapper'), cls:'rulerWrapper fixed', children:[ |
95 | {tag:'div', cls:'ruler', children:[ | 93 | {tag:'div', cls:'ruler', children:[ |
96 | {tag:'a', href:'#', id:this.getId('exit'), cls:'exit', html:' '}, | 94 | {tag:'a', href:'#', id:this.getId('exit'), cls:'exit', html:' '}, |
97 | {tag:'a', href:'#', id:this.getId('smallPreviousButton'),cls:'smallButton previous', html:' '}, | 95 | {tag:'a', href:'#', id:this.getId('smallPreviousButton'),cls:'smallButton previous', html:' '}, |
98 | {tag:'a', href:'#', id:this.getId('smallNextButton'), cls:'smallButton next', html:' '}, | 96 | {tag:'a', href:'#', id:this.getId('smallNextButton'), cls:'smallButton next', html:' '}, |
99 | {tag:'div', cls:'marker', id:this.getId('marker'), children:[ | 97 | {tag:'div', cls:'marker', id:this.getId('marker'), children:[ |
100 | {tag:'div', cls:'previous', id:this.getId('previousButton')}, | 98 | {tag:'div', cls:'previous', id:this.getId('previousButton')}, |
101 | {tag:'div', cls:'markerBody'}, | 99 | {tag:'div', cls:'markerBody'}, |
102 | {tag:'div', cls:'next', id:this.getId('nextButton')} | 100 | {tag:'div', cls:'next', id:this.getId('nextButton')} |
103 | ]}, | 101 | ]}, |
104 | {tag:'div', cls:'steps', id:this.getId('stepsFrame')}, | 102 | {tag:'div', cls:'steps', id:this.getId('stepsFrame')}, |
105 | // {tag:'div', cls:'steps' + ' ' + 'steps_' + this.steps().length, children:[ | 103 | // {tag:'div', cls:'steps' + ' ' + 'steps_' + this.steps().length, children:[ |
106 | // {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())} | 104 | // {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())} |
107 | // ]}, | 105 | // ]}, |
108 | {tag:'div', cls:'dots', id:this.getId('dotsFrame')} | 106 | {tag:'div', cls:'dots', id:this.getId('dotsFrame')} |
109 | // {tag:'div', cls:'dots' + ' ' + 'steps_' + this.steps().length, children:[ | 107 | // {tag:'div', cls:'dots' + ' ' + 'steps_' + this.steps().length, children:[ |
110 | // {tag:'ul', id:this.getId('dots'), children:MochiKit.Base.map(function (aStep) { return {tag:'li', children:[{tag:'span', html:'*'}]}}, this.steps())} | 108 | // {tag:'ul', id:this.getId('dots'), children:MochiKit.Base.map(function (aStep) { return {tag:'li', children:[{tag:'span', html:'*'}]}}, this.steps())} |
111 | // ]} | 109 | // ]} |
112 | ]} | 110 | ]} |
113 | ]} | 111 | ]} |
114 | ])); | 112 | ])); |
115 | //console.log("ELEMENT", this.element()); | ||
116 | 113 | ||
117 | MochiKit.Signal.connect(this.getElement('exit'), 'onclick', this, 'handleExit'); | 114 | MochiKit.Signal.connect(this.getElement('exit'), 'onclick', this, 'handleExit'); |
118 | 115 | ||
119 | MochiKit.Signal.connect(this.getElement('previousButton'), 'onclick', this, 'handlePrevious'); | 116 | MochiKit.Signal.connect(this.getElement('previousButton'), 'onclick', this, 'handlePrevious'); |
120 | MochiKit.Signal.connect(this.getElement('smallPreviousButton'),'onclick', this, 'handlePrevious'); | 117 | MochiKit.Signal.connect(this.getElement('smallPreviousButton'),'onclick', this, 'handlePrevious'); |
121 | 118 | ||
122 | MochiKit.Signal.connect(this.getElement('nextButton'), 'onclick', this, 'handleNext'); | 119 | MochiKit.Signal.connect(this.getElement('nextButton'), 'onclick', this, 'handleNext'); |
123 | MochiKit.Signal.connect(this.getElement('smallNextButton'), 'onclick', this, 'handleNext'); | 120 | MochiKit.Signal.connect(this.getElement('smallNextButton'), 'onclick', this, 'handleNext'); |
124 | 121 | ||
125 | this.enablePrevious(false); | 122 | this.enablePrevious(false); |
126 | this.enableNext(false); | 123 | this.enableNext(false); |
127 | 124 | ||
128 | // this.cursorMoved(); | 125 | // this.cursorMoved(); |
129 | }, | 126 | }, |
130 | 127 | ||
131 | //......................................................................... | 128 | //......................................................................... |
132 | 129 | ||
133 | 'renderStepsComponents': function () { | 130 | 'renderStepsComponents': function () { |
134 | varstepsFrame; | 131 | varstepsFrame; |
135 | var dotsFrame; | 132 | var dotsFrame; |
136 | 133 | ||
137 | stepsFrames = this.getElement('stepsFrame'); | 134 | stepsFrames = this.getElement('stepsFrame'); |
138 | MochiKit.DOM.setElementClass(stepsFrames, 'steps'); | 135 | MochiKit.DOM.setElementClass(stepsFrames, 'steps'); |
139 | MochiKit.DOM.addElementClass(stepsFrames, 'steps_' + this.steps().length); | 136 | MochiKit.DOM.addElementClass(stepsFrames, 'steps_' + this.steps().length); |
140 | 137 | ||
141 | stepsFrames.innerHTML = ""; | 138 | stepsFrames.innerHTML = ""; |
142 | this.append(stepsFrames, {tag:'ul', id:this.getId('steps'), children:MochiKit.Base.map( | 139 | this.append(stepsFrames, {tag:'ul', id:this.getId('steps'), children:MochiKit.Base.map( |
143 | MochiKit.Base.bind(function (aStep) { return {tag:'li', children:[{tag:'span', html:this.translatedStepDescription(aStep)}]}}, this), | 140 | MochiKit.Base.bind(function (aStep) { return {tag:'li', children:[{tag:'span', html:this.translatedStepDescription(aStep)}]}}, this), |
144 | this.steps())} | 141 | this.steps())} |
145 | ); | 142 | ); |
146 | 143 | ||
147 | dotsFrames = this.getElement('dotsFrame'); | 144 | dotsFrames = this.getElement('dotsFrame'); |
148 | MochiKit.DOM.setElementClass(dotsFrames, 'dots'); | 145 | MochiKit.DOM.setElementClass(dotsFrames, 'dots'); |
149 | MochiKit.DOM.addElementClass(dotsFrames, 'steps_' + this.steps().length); | 146 | MochiKit.DOM.addElementClass(dotsFrames, 'steps_' + this.steps().length); |
150 | 147 | ||
151 | dotsFrames.innerHTML = ""; | 148 | dotsFrames.innerHTML = ""; |
152 | this.append(dotsFrames, {tag:'ul', id:this.getId('dots'), children:MochiKit.Base.map( | 149 | this.append(dotsFrames, {tag:'ul', id:this.getId('dots'), children:MochiKit.Base.map( |
153 | function (aStep) { return {tag:'li', children:[{tag:'span', html:'*'}]}; }, | 150 | function (aStep) { return {tag:'li', children:[{tag:'span', html:'*'}]}; }, |
154 | this.steps())} | 151 | this.steps())} |
155 | ); | 152 | ); |
156 | }, | 153 | }, |
157 | 154 | ||
158 | //------------------------------------------------------------------------- | 155 | //------------------------------------------------------------------------- |
159 | 156 | ||
160 | 'handleExit': function (anEvent) { | 157 | 'handleExit': function (anEvent) { |
161 | anEvent.preventDefault(); | 158 | anEvent.preventDefault(); |
162 | 159 | ||
163 | MochiKit.Signal.signal(this, 'exit'); | 160 | MochiKit.Signal.signal(this, 'exit'); |
164 | }, | 161 | }, |
165 | 162 | ||
166 | //------------------------------------------------------------------------- | 163 | //------------------------------------------------------------------------- |
167 | 164 | ||
168 | 'handlePrevious': function (anEvent) { | 165 | 'handlePrevious': function (anEvent) { |
169 | anEvent.preventDefault(); | 166 | anEvent.preventDefault(); |
170 | 167 | ||
171 | // if (!MochiKit.DOM.hasElementClass(this.getElement('previousButton'), 'disabled')) { | 168 | // if (!MochiKit.DOM.hasElementClass(this.getElement('previousButton'), 'disabled')) { |
172 | // this.moveBackward(); | 169 | // this.moveBackward(); |
173 | // } | 170 | // } |
174 | 171 | ||
175 | MochiKit.Signal.signal(this, 'moveBackward'); | 172 | MochiKit.Signal.signal(this, 'moveBackward'); |
176 | }, | 173 | }, |
177 | 174 | ||
178 | 'handleNext': function (anEvent) { | 175 | 'handleNext': function (anEvent) { |
179 | anEvent.preventDefault(); | 176 | anEvent.preventDefault(); |
180 | 177 | ||
181 | // if (!MochiKit.DOM.hasElementClass(this.getElement('nextButton'), 'disabled')) { | 178 | // if (!MochiKit.DOM.hasElementClass(this.getElement('nextButton'), 'disabled')) { |
182 | // this.moveForward(); | 179 | // this.moveForward(); |
183 | // } | 180 | // } |
184 | 181 | ||
185 | MochiKit.Signal.signal(this, 'moveForward'); | 182 | MochiKit.Signal.signal(this, 'moveForward'); |
186 | }, | 183 | }, |
187 | 184 | ||
188 | //------------------------------------------------------------------------- | 185 | //------------------------------------------------------------------------- |
189 | 186 | ||
190 | 'currentStep': function () { | 187 | 'currentStep': function () { |
191 | return this._currentStep; | 188 | return this._currentStep; |
192 | }, | 189 | }, |
193 | 190 | ||
194 | 'markerInitialOffset': function () { | 191 | 'markerInitialOffset': function () { |
195 | return -246; | 192 | return -246; |
196 | }, | 193 | }, |
197 | 194 | ||
198 | 'markerStepOffset': function () { | 195 | 'markerStepOffset': function () { |
199 | return 410 / (this.steps().length - 1); | 196 | return 410 / (this.steps().length - 1); |
200 | // return 100; | 197 | // return 100; |
201 | }, | 198 | }, |
202 | 199 | ||
203 | //------------------------------------------------------------------------- | 200 | //------------------------------------------------------------------------- |
204 | 201 | ||
205 | 'moveToFirstStep': function (aCallback) { | 202 | 'moveToFirstStep': function (aCallback) { |
206 | varstepsToMove; | 203 | varstepsToMove; |
207 | 204 | ||
208 | stepsToMove = this._currentStep; | 205 | stepsToMove = this._currentStep; |
209 | this._currentStep = 0; | 206 | this._currentStep = 0; |
210 | 207 | ||
211 | this.enablePrevious(false); | 208 | this.enablePrevious(false); |
212 | this.enableNext(false); | 209 | this.enableNext(false); |
213 | // MochiKit.Signal.signal(this, 'moveBackward'); | 210 | // MochiKit.Signal.signal(this, 'moveBackward'); |
214 | MochiKit.Base.map( | 211 | MochiKit.Base.map( |
215 | function (anElement) { MochiKit.DOM.removeElementClass(anElement, 'selected'); }, | 212 | function (anElement) { MochiKit.DOM.removeElementClass(anElement, 'selected'); }, |
216 | MochiKit.Selector.findChildElements(this.element(), ['li.selected']) | 213 | MochiKit.Selector.findChildElements(this.element(), ['li.selected']) |
217 | ); | 214 | ); |
218 | new MochiKit.Visual.Move(this.getElement('marker'), { | 215 | new MochiKit.Visual.Move(this.getElement('marker'), { |
219 | x:-(this.markerStepOffset() * stepsToMove), | 216 | x:-(this.markerStepOffset() * stepsToMove), |
220 | mode:'relative', | 217 | mode:'relative', |
221 | duration:(0.5 * (stepsToMove/2)), | 218 | duration:(0.5 * (stepsToMove/2)), |
222 | // afterFinish:MochiKit.Base.method(this, 'cursorMoved') | 219 | // afterFinish:MochiKit.Base.method(this, 'cursorMoved') |
223 | afterFinish:MochiKit.Base.compose(MochiKit.Base.method(this, 'cursorMoved'), aCallback) | 220 | afterFinish:MochiKit.Base.compose(MochiKit.Base.method(this, 'cursorMoved'), aCallback) |
224 | }); | 221 | }); |
225 | }, | 222 | }, |
226 | 223 | ||
227 | 'moveBackward': function (aCallback) { | 224 | 'moveBackward': function (aCallback) { |
228 | this._currentStep --; | 225 | this._currentStep --; |
229 | 226 | ||
230 | this.enablePrevious(false); | 227 | this.enablePrevious(false); |
231 | this.enableNext(false); | 228 | this.enableNext(false); |
232 | // MochiKit.Signal.signal(this, 'moveBackward'); | 229 | // MochiKit.Signal.signal(this, 'moveBackward'); |
233 | MochiKit.Base.map( | 230 | MochiKit.Base.map( |
234 | function (anElement) { MochiKit.DOM.removeElementClass(anElement, 'selected'); }, | 231 | function (anElement) { MochiKit.DOM.removeElementClass(anElement, 'selected'); }, |
235 | MochiKit.Selector.findChildElements(this.element(), ['li.selected']) | 232 | MochiKit.Selector.findChildElements(this.element(), ['li.selected']) |
236 | ); | 233 | ); |
237 | new MochiKit.Visual.Move(this.getElement('marker'), { | 234 | new MochiKit.Visual.Move(this.getElement('marker'), { |
238 | x:-this.markerStepOffset(), | 235 | x:-this.markerStepOffset(), |
239 | mode:'relative', | 236 | mode:'relative', |
240 | duration:0.5, | 237 | duration:0.5, |
241 | // afterFinish:MochiKit.Base.method(this, 'cursorMoved') | 238 | // afterFinish:MochiKit.Base.method(this, 'cursorMoved') |
242 | afterFinish:MochiKit.Base.compose(MochiKit.Base.method(this, 'cursorMoved'), aCallback) | 239 | afterFinish:MochiKit.Base.compose(MochiKit.Base.method(this, 'cursorMoved'), aCallback) |
243 | }); | 240 | }); |
244 | }, | 241 | }, |
245 | 242 | ||
246 | 'moveForward': function (aCallback) { | 243 | 'moveForward': function (aCallback) { |
247 | this._currentStep ++; | 244 | this._currentStep ++; |
248 | 245 | ||
249 | if (this._currentStep < this.steps().length) { | 246 | if (this._currentStep < this.steps().length) { |
250 | this.enablePrevious(false); | 247 | this.enablePrevious(false); |
251 | this.enableNext(false); | 248 | this.enableNext(false); |
252 | // MochiKit.Signal.signal(this, 'moveForward'); | 249 | // MochiKit.Signal.signal(this, 'moveForward'); |
253 | MochiKit.Base.map( | 250 | MochiKit.Base.map( |
254 | function (anElement) { MochiKit.DOM.removeElementClass(anElement, 'selected'); }, | 251 | function (anElement) { MochiKit.DOM.removeElementClass(anElement, 'selected'); }, |
255 | MochiKit.Selector.findChildElements(this.element(), ['li.selected']) | 252 | MochiKit.Selector.findChildElements(this.element(), ['li.selected']) |
256 | ); | 253 | ); |
257 | new MochiKit.Visual.Move(this.getElement('marker'), { | 254 | new MochiKit.Visual.Move(this.getElement('marker'), { |
258 | x:this.markerStepOffset(), | 255 | x:this.markerStepOffset(), |
259 | mode:'relative', | 256 | mode:'relative', |
260 | duration:0.5, | 257 | duration:0.5, |
261 | // afterFinish:MochiKit.Base.method(this, 'cursorMoved') | 258 | // afterFinish:MochiKit.Base.method(this, 'cursorMoved') |
262 | afterFinish:MochiKit.Base.compose(MochiKit.Base.method(this, 'cursorMoved'), aCallback) | 259 | afterFinish:MochiKit.Base.compose(MochiKit.Base.method(this, 'cursorMoved'), aCallback) |
263 | }); | 260 | }); |
264 | } else { | 261 | } else { |
265 | MochiKit.Signal.signal(this, 'done'); | 262 | MochiKit.Signal.signal(this, 'done'); |
266 | } | 263 | } |
267 | }, | 264 | }, |
268 | 265 | ||
269 | //------------------------------------------------------------------------- | 266 | //------------------------------------------------------------------------- |
270 | 267 | ||
271 | 'enablePrevious': function (aValue) { | 268 | 'enablePrevious': function (aValue) { |
272 | if (aValue == true) { | 269 | if (aValue == true) { |
273 | MochiKit.DOM.removeElementClass(this.getElement('previousButton'), 'disabled'); | 270 | MochiKit.DOM.removeElementClass(this.getElement('previousButton'), 'disabled'); |
274 | MochiKit.DOM.removeElementClass(this.getElement('smallPreviousButton'), 'disabled'); | 271 | MochiKit.DOM.removeElementClass(this.getElement('smallPreviousButton'), 'disabled'); |
275 | } else { | 272 | } else { |
276 | MochiKit.DOM.addElementClass(this.getElement('previousButton'), 'disabled'); | 273 | MochiKit.DOM.addElementClass(this.getElement('previousButton'), 'disabled'); |
277 | MochiKit.DOM.addElementClass(this.getElement('smallPreviousButton'), 'disabled'); | 274 | MochiKit.DOM.addElementClass(this.getElement('smallPreviousButton'), 'disabled'); |
278 | } | 275 | } |
279 | }, | 276 | }, |
280 | 277 | ||
281 | //'disablePrevious': function () { | 278 | //'disablePrevious': function () { |
282 | // MochiKit.DOM.addElementClass(this.getElement('previousButton'), 'disabled'); | 279 | // MochiKit.DOM.addElementClass(this.getElement('previousButton'), 'disabled'); |
283 | //}, | 280 | //}, |
284 | 281 | ||
285 | //......................................................................... | 282 | //......................................................................... |
286 | 283 | ||
287 | 'enableNext': function (aValue) { | 284 | 'enableNext': function (aValue) { |
288 | if (aValue == true) { | 285 | if (aValue == true) { |
289 | MochiKit.DOM.removeElementClass(this.getElement('nextButton'), 'disabled'); | 286 | MochiKit.DOM.removeElementClass(this.getElement('nextButton'), 'disabled'); |
290 | MochiKit.DOM.removeElementClass(this.getElement('smallNextButton'), 'disabled'); | 287 | MochiKit.DOM.removeElementClass(this.getElement('smallNextButton'), 'disabled'); |
291 | } else { | 288 | } else { |
292 | MochiKit.DOM.addElementClass(this.getElement('nextButton'), 'disabled'); | 289 | MochiKit.DOM.addElementClass(this.getElement('nextButton'), 'disabled'); |
293 | MochiKit.DOM.addElementClass(this.getElement('smallNextButton'), 'disabled'); | 290 | MochiKit.DOM.addElementClass(this.getElement('smallNextButton'), 'disabled'); |
294 | } | 291 | } |
295 | }, | 292 | }, |
296 | 293 | ||
297 | //'disableNext': function () { | 294 | //'disableNext': function () { |
298 | // MochiKit.DOM.addElementClass(this.getElement('nextButton'), 'disabled'); | 295 | // MochiKit.DOM.addElementClass(this.getElement('nextButton'), 'disabled'); |
299 | //}, | 296 | //}, |
300 | 297 | ||
301 | //------------------------------------------------------------------------- | 298 | //------------------------------------------------------------------------- |
302 | 299 | ||
303 | 'cursorMoved': function () { | 300 | 'cursorMoved': function () { |
304 | MochiKit.Style.setElementPosition(this.getElement('marker'), {x:this.markerStepOffset() * this.currentStep() + this.markerInitialOffset()}) | 301 | MochiKit.Style.setElementPosition(this.getElement('marker'), {x:this.markerStepOffset() * this.currentStep() + this.markerInitialOffset()}) |
305 | MochiKit.Signal.signal(this, 'cursorMoved'); | 302 | MochiKit.Signal.signal(this, 'cursorMoved'); |
306 | 303 | ||
307 | MochiKit.DOM.addElementClass(this.getElement('steps').childNodes[this.currentStep()], 'selected'); | 304 | MochiKit.DOM.addElementClass(this.getElement('steps').childNodes[this.currentStep()], 'selected'); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js index 666afe9..edcdb62 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js | |||
@@ -1,190 +1,188 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.TabSidePanel = function(args) { | 26 | Clipperz.PM.UI.Web.Components.TabSidePanel = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | Clipperz.PM.UI.Web.Components.TabSidePanel.superclass.constructor.call(this, args); | 28 | Clipperz.PM.UI.Web.Components.TabSidePanel.superclass.constructor.call(this, args); |
31 | 29 | ||
32 | this._element = args.element || null; | 30 | this._element = args.element || null; |
33 | 31 | ||
34 | this._slots = { | 32 | this._slots = { |
35 | }; | 33 | }; |
36 | 34 | ||
37 | return this; | 35 | return this; |
38 | } | 36 | } |
39 | 37 | ||
40 | //============================================================================= | 38 | //============================================================================= |
41 | 39 | ||
42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.TabSidePanel, Clipperz.PM.UI.Common.Components.BaseComponent, { | 40 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.TabSidePanel, Clipperz.PM.UI.Common.Components.BaseComponent, { |
43 | 41 | ||
44 | //------------------------------------------------------------------------- | 42 | //------------------------------------------------------------------------- |
45 | 43 | ||
46 | 'toString': function () { | 44 | 'toString': function () { |
47 | return "Clipperz.PM.UI.Web.Components.TabSidePanel component"; | 45 | return "Clipperz.PM.UI.Web.Components.TabSidePanel component"; |
48 | }, | 46 | }, |
49 | 47 | ||
50 | //------------------------------------------------------------------------- | 48 | //------------------------------------------------------------------------- |
51 | 49 | ||
52 | 'deselectAllTabs': function() { | 50 | 'deselectAllTabs': function() { |
53 | var tabListItems; | 51 | var tabListItems; |
54 | 52 | ||
55 | tabListItems = [ | 53 | tabListItems = [ |
56 | 'cardsLI', | 54 | 'cardsLI', |
57 | // 'directLoginLI', | 55 | // 'directLoginLI', |
58 | 'accountLI', | 56 | 'accountLI', |
59 | 'dataLI', | 57 | 'dataLI', |
60 | 'toolsLI' | 58 | 'toolsLI' |
61 | ]; | 59 | ]; |
62 | 60 | ||
63 | //Clipperz.log("=== TabSidePanel.tabSelected anEvent.src().id", anEvent.src().id); | 61 | //Clipperz.log("=== TabSidePanel.tabSelected anEvent.src().id", anEvent.src().id); |
64 | for (var i in tabListItems) { | 62 | for (var i in tabListItems) { |
65 | //Clipperz.log("=== TabSidePanel.tabSelected aTabListItem", tabListItems[i]); | 63 | //Clipperz.log("=== TabSidePanel.tabSelected aTabListItem", tabListItems[i]); |
66 | MochiKit.DOM.removeElementClass(this.getId(tabListItems[i]), 'selected'); | 64 | MochiKit.DOM.removeElementClass(this.getId(tabListItems[i]), 'selected'); |
67 | } | 65 | } |
68 | }, | 66 | }, |
69 | 67 | ||
70 | 'selectTab': function(aTabName) { | 68 | 'selectTab': function(aTabName) { |
71 | this.deselectAllTabs(); | 69 | this.deselectAllTabs(); |
72 | MochiKit.DOM.addElementClass(this.getId(this.listItemIdForTabNamed(aTabName)), 'selected'); | 70 | MochiKit.DOM.addElementClass(this.getId(this.listItemIdForTabNamed(aTabName)), 'selected'); |
73 | MochiKit.Signal.signal(this, 'tabSelected', aTabName); | 71 | MochiKit.Signal.signal(this, 'tabSelected', aTabName); |
74 | }, | 72 | }, |
75 | 73 | ||
76 | 'tabNameForAnchorId': function(anId) { | 74 | 'tabNameForAnchorId': function(anId) { |
77 | var result; | 75 | var result; |
78 | 76 | ||
79 | switch(anId) { | 77 | switch(anId) { |
80 | case 'cards_tabSidePanel': | 78 | case 'cards_tabSidePanel': |
81 | result = 'cards'; | 79 | result = 'cards'; |
82 | break; | 80 | break; |
83 | // case 'directLogins_tabSidePanel': | 81 | // case 'directLogins_tabSidePanel': |
84 | // result = 'directLogins'; | 82 | // result = 'directLogins'; |
85 | // break; | 83 | // break; |
86 | case 'account_tabSidePanel': | 84 | case 'account_tabSidePanel': |
87 | result = 'account'; | 85 | result = 'account'; |
88 | break; | 86 | break; |
89 | case 'data_tabSidePanel': | 87 | case 'data_tabSidePanel': |
90 | result = 'data'; | 88 | result = 'data'; |
91 | break; | 89 | break; |
92 | case 'tools_tabSidePanel': | 90 | case 'tools_tabSidePanel': |
93 | result = 'tools'; | 91 | result = 'tools'; |
94 | break; | 92 | break; |
95 | } | 93 | } |
96 | 94 | ||
97 | return result; | 95 | return result; |
98 | }, | 96 | }, |
99 | 97 | ||
100 | 'listItemIdForTabNamed': function(aTabName) { | 98 | 'listItemIdForTabNamed': function(aTabName) { |
101 | var result; | 99 | var result; |
102 | 100 | ||
103 | switch (aTabName) { | 101 | switch (aTabName) { |
104 | case 'cards': | 102 | case 'cards': |
105 | result = 'cardsLI'; | 103 | result = 'cardsLI'; |
106 | break; | 104 | break; |
107 | // case 'directLogins': | 105 | // case 'directLogins': |
108 | // result = 'directLoginLI'; | 106 | // result = 'directLoginLI'; |
109 | // break; | 107 | // break; |
110 | case 'account': | 108 | case 'account': |
111 | result = 'accountLI'; | 109 | result = 'accountLI'; |
112 | break; | 110 | break; |
113 | case 'data': | 111 | case 'data': |
114 | result = 'dataLI'; | 112 | result = 'dataLI'; |
115 | break; | 113 | break; |
116 | case 'tools': | 114 | case 'tools': |
117 | result = 'toolsLI'; | 115 | result = 'toolsLI'; |
118 | break; | 116 | break; |
119 | } | 117 | } |
120 | 118 | ||
121 | return result; | 119 | return result; |
122 | }, | 120 | }, |
123 | 121 | ||
124 | 'tabSelected': function (anEvent) { | 122 | 'tabSelected': function (anEvent) { |
125 | this.selectTab(this.tabNameForAnchorId(anEvent.src().id)); | 123 | this.selectTab(this.tabNameForAnchorId(anEvent.src().id)); |
126 | // anEvent.stop(); | 124 | // anEvent.stop(); |
127 | anEvent.preventDefault(); | 125 | anEvent.preventDefault(); |
128 | }, | 126 | }, |
129 | 127 | ||
130 | //------------------------------------------------------------------------- | 128 | //------------------------------------------------------------------------- |
131 | 129 | ||
132 | 'addCard': function (anEvent) { | 130 | 'addCard': function (anEvent) { |
133 | anEvent.stop(); | 131 | anEvent.stop(); |
134 | MochiKit.Signal.signal(this, 'addCard', anEvent.src()); | 132 | MochiKit.Signal.signal(this, 'addCard', anEvent.src()); |
135 | }, | 133 | }, |
136 | 134 | ||
137 | //------------------------------------------------------------------------- | 135 | //------------------------------------------------------------------------- |
138 | 136 | ||
139 | 'renderSelf': function(/*aContainer, aPosition*/) { | 137 | 'renderSelf': function(/*aContainer, aPosition*/) { |
140 | this.append(this.element(), [ | 138 | this.append(this.element(), [ |
141 | {tag:'div', cls:'header'}, | 139 | {tag:'div', cls:'header'}, |
142 | {tag:'div', cls:'body', children:[ | 140 | {tag:'div', cls:'body', children:[ |
143 | {tag:'ul', cls:'mainTabs', children:[ | 141 | {tag:'ul', cls:'mainTabs', children:[ |
144 | {tag:'li', id:this.getId('cardsLI'), cls:'cards', children:[ | 142 | {tag:'li', id:this.getId('cardsLI'), cls:'cards', children:[ |
145 | {tag:'a', id:'cards_tabSidePanel', href:'#', html:"cards"}, | 143 | {tag:'a', id:'cards_tabSidePanel', href:'#', html:"cards"}, |
146 | {tag:'div', cls:'selectionHighlighter', children:[ | 144 | {tag:'div', cls:'selectionHighlighter', children:[ |
147 | {tag:'img', src:'./images/old/main/tabs/selectionHighligher.png'}, | 145 | {tag:'img', src:'./images/old/main/tabs/selectionHighligher.png'}, |
148 | {tag:'a', id:this.getId('addCardA'), cls:'add', href:'#', children:[ | 146 | {tag:'a', id:this.getId('addCardA'), cls:'add', href:'#', children:[ |
149 | {tag:'span', html:"add"}, | 147 | {tag:'span', html:"add"}, |
150 | {tag:'h3', html:"+"} | 148 | {tag:'h3', html:"+"} |
151 | ]} | 149 | ]} |
152 | ]} | 150 | ]} |
153 | ]} | 151 | ]} |
154 | ]}, | 152 | ]}, |
155 | {tag:'ul', cls:'otherTabs', children:[ | 153 | {tag:'ul', cls:'otherTabs', children:[ |
156 | {tag:'li', id:this.getId('accountLI'), children:[ | 154 | {tag:'li', id:this.getId('accountLI'), children:[ |
157 | {tag:'a', id:'account_tabSidePanel', href:'#', html:"account"}, | 155 | {tag:'a', id:'account_tabSidePanel', href:'#', html:"account"}, |
158 | {tag:'div', cls:'selectionHighlighter', children:[ | 156 | {tag:'div', cls:'selectionHighlighter', children:[ |
159 | {tag:'img', src:'./images/old/main/tabs/selectionHighligherGray.png'} | 157 | {tag:'img', src:'./images/old/main/tabs/selectionHighligherGray.png'} |
160 | ]} | 158 | ]} |
161 | ]}, | 159 | ]}, |
162 | {tag:'li', id:this.getId('dataLI'), children:[ | 160 | {tag:'li', id:this.getId('dataLI'), children:[ |
163 | {tag:'a', id:'data_tabSidePanel', href:'#', html:"data"}, | 161 | {tag:'a', id:'data_tabSidePanel', href:'#', html:"data"}, |
164 | {tag:'div', cls:'selectionHighlighter', children:[ | 162 | {tag:'div', cls:'selectionHighlighter', children:[ |
165 | {tag:'img', src:'./images/old/main/tabs/selectionHighligherGray.png'} | 163 | {tag:'img', src:'./images/old/main/tabs/selectionHighligherGray.png'} |
166 | ]} | 164 | ]} |
167 | ]}, | 165 | ]}, |
168 | {tag:'li', id:this.getId('toolsLI'), children:[ | 166 | {tag:'li', id:this.getId('toolsLI'), children:[ |
169 | {tag:'a', id:'tools_tabSidePanel', href:'#', html:"tools"}, | 167 | {tag:'a', id:'tools_tabSidePanel', href:'#', html:"tools"}, |
170 | {tag:'div', cls:'selectionHighlighter', children:[ | 168 | {tag:'div', cls:'selectionHighlighter', children:[ |
171 | {tag:'img', src:'./images/old/main/tabs/selectionHighligherGray.png'} | 169 | {tag:'img', src:'./images/old/main/tabs/selectionHighligherGray.png'} |
172 | ]} | 170 | ]} |
173 | ]} | 171 | ]} |
174 | ]} | 172 | ]} |
175 | ]}, | 173 | ]}, |
176 | {tag:'div', cls:'footer'} | 174 | {tag:'div', cls:'footer'} |
177 | ]); | 175 | ]); |
178 | 176 | ||
179 | MochiKit.Signal.connect('cards_tabSidePanel', 'onclick', this, 'tabSelected'); | 177 | MochiKit.Signal.connect('cards_tabSidePanel', 'onclick', this, 'tabSelected'); |
180 | // MochiKit.Signal.connect('directLogins_tabSidePanel', 'onclick', this, 'tabSelected'); | 178 | // MochiKit.Signal.connect('directLogins_tabSidePanel', 'onclick', this, 'tabSelected'); |
181 | MochiKit.Signal.connect('account_tabSidePanel', 'onclick', this, 'tabSelected'); | 179 | MochiKit.Signal.connect('account_tabSidePanel', 'onclick', this, 'tabSelected'); |
182 | MochiKit.Signal.connect('data_tabSidePanel', 'onclick', this, 'tabSelected'); | 180 | MochiKit.Signal.connect('data_tabSidePanel', 'onclick', this, 'tabSelected'); |
183 | MochiKit.Signal.connect('tools_tabSidePanel', 'onclick', this, 'tabSelected'); | 181 | MochiKit.Signal.connect('tools_tabSidePanel', 'onclick', this, 'tabSelected'); |
184 | MochiKit.Signal.connect(this.getId('addCardA'), 'onclick', this, 'addCard'); | 182 | MochiKit.Signal.connect(this.getId('addCardA'), 'onclick', this, 'addCard'); |
185 | }, | 183 | }, |
186 | 184 | ||
187 | //------------------------------------------------------------------------- | 185 | //------------------------------------------------------------------------- |
188 | 186 | ||
189 | __syntaxFix__: "syntax fix" | 187 | __syntaxFix__: "syntax fix" |
190 | }); | 188 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TextColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TextColumnManager.js index 3dc9ce9..9b1796a 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TextColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TextColumnManager.js | |||
@@ -1,50 +1,48 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.TextColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.TextColumnManager = function(args) { |
31 | args = args || {}; | 29 | args = args || {}; |
32 | Clipperz.PM.UI.Web.Components.TextColumnManager.superclass.constructor.call(this, args); | 30 | Clipperz.PM.UI.Web.Components.TextColumnManager.superclass.constructor.call(this, args); |
33 | 31 | ||
34 | return this; | 32 | return this; |
35 | } | 33 | } |
36 | 34 | ||
37 | //============================================================================= | 35 | //============================================================================= |
38 | 36 | ||
39 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.TextColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { | 37 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.TextColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { |
40 | 38 | ||
41 | 'toString': function () { | 39 | 'toString': function () { |
42 | return "Clipperz.PM.UI.Web.Components.TextColumnManager component"; | 40 | return "Clipperz.PM.UI.Web.Components.TextColumnManager component"; |
43 | }, | 41 | }, |
44 | 42 | ||
45 | //----------------------------------------------------- | 43 | //----------------------------------------------------- |
46 | 44 | ||
47 | '__syntax_fix__' : 'syntax fix' | 45 | '__syntax_fix__' : 'syntax fix' |
48 | 46 | ||
49 | }); | 47 | }); |
50 | 48 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js index 0fa369f..034ed91 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js | |||
@@ -1,110 +1,108 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.ToolsPanel = function(args) { | 26 | Clipperz.PM.UI.Web.Components.ToolsPanel = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.ToolsPanel.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.ToolsPanel.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._initiallySelectedTab = args.selected || 'PASSWORD_GENERATOR'; | 31 | this._initiallySelectedTab = args.selected || 'PASSWORD_GENERATOR'; |
34 | this._tabPanelControllerConfiguration = { | 32 | this._tabPanelControllerConfiguration = { |
35 | 'PASSWORD_GENERATOR': { | 33 | 'PASSWORD_GENERATOR': { |
36 | tab:'passwordGeneratorTab', | 34 | tab:'passwordGeneratorTab', |
37 | panel:'passwordGeneratorPanel' | 35 | panel:'passwordGeneratorPanel' |
38 | }, | 36 | }, |
39 | 'BOOKMARKLET': { | 37 | 'BOOKMARKLET': { |
40 | tab:'bookmarkletTab', | 38 | tab:'bookmarkletTab', |
41 | panel:'bookmarkletPanel' | 39 | panel:'bookmarkletPanel' |
42 | }, | 40 | }, |
43 | 'COMPACT_EDITION': { | 41 | 'COMPACT_EDITION': { |
44 | tab:'compactEditionTab', | 42 | tab:'compactEditionTab', |
45 | panel:'compactEditionPanel' | 43 | panel:'compactEditionPanel' |
46 | }, | 44 | }, |
47 | 'HTTP_AUTH': { | 45 | 'HTTP_AUTH': { |
48 | tab:'httpAuthTab', | 46 | tab:'httpAuthTab', |
49 | panel:'httpAuthPanel' | 47 | panel:'httpAuthPanel' |
50 | } | 48 | } |
51 | }; | 49 | }; |
52 | 50 | ||
53 | return this; | 51 | return this; |
54 | } | 52 | } |
55 | 53 | ||
56 | //============================================================================= | 54 | //============================================================================= |
57 | 55 | ||
58 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.ToolsPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, { | 56 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.ToolsPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, { |
59 | 57 | ||
60 | //------------------------------------------------------------------------- | 58 | //------------------------------------------------------------------------- |
61 | 59 | ||
62 | 'toString': function () { | 60 | 'toString': function () { |
63 | return "Clipperz.PM.UI.Web.Components.ToolsPanel component"; | 61 | return "Clipperz.PM.UI.Web.Components.ToolsPanel component"; |
64 | }, | 62 | }, |
65 | 63 | ||
66 | //------------------------------------------------------------------------- | 64 | //------------------------------------------------------------------------- |
67 | 65 | ||
68 | 'renderSelf': function(/*aContainer, aPosition*/) { | 66 | 'renderSelf': function(/*aContainer, aPosition*/) { |
69 | this.append(this.element(), [ | 67 | this.append(this.element(), [ |
70 | {tag:'div', cls:'header', children:[ | 68 | {tag:'div', cls:'header', children:[ |
71 | {tag:'div', cls:'subPanelTabs', children:[ | 69 | {tag:'div', cls:'subPanelTabs', children:[ |
72 | {tag:'ul', children:[ | 70 | {tag:'ul', children:[ |
73 | {tag:'li', id:this.getId('passwordGeneratorTab'),children:[{tag:'a', href:'#', html:'Password generator'}], cls:'first'}, | 71 | {tag:'li', id:this.getId('passwordGeneratorTab'),children:[{tag:'a', href:'#', html:'Password generator'}], cls:'first'}, |
74 | {tag:'li', id:this.getId('bookmarkletTab'), children:[{tag:'a', href:'#', html:'Bookmarklet'}]}, | 72 | {tag:'li', id:this.getId('bookmarkletTab'), children:[{tag:'a', href:'#', html:'Bookmarklet'}]}, |
75 | {tag:'li', id:this.getId('compactEditionTab'), children:[{tag:'a', href:'#', html:'Compact edition'}]}, | 73 | {tag:'li', id:this.getId('compactEditionTab'), children:[{tag:'a', href:'#', html:'Compact edition'}]}, |
76 | {tag:'li', id:this.getId('httpAuthTab'), children:[{tag:'a', href:'#', html:'HTTP Auth'}]} | 74 | {tag:'li', id:this.getId('httpAuthTab'), children:[{tag:'a', href:'#', html:'HTTP Auth'}]} |
77 | ]} | 75 | ]} |
78 | ]} | 76 | ]} |
79 | ]}, | 77 | ]}, |
80 | {tag:'div', cls:'body', children:[ | 78 | {tag:'div', cls:'body', children:[ |
81 | {tag:'div', cls:'accountPanel', children:[ | 79 | {tag:'div', cls:'accountPanel', children:[ |
82 | {tag:'div', cls:'subPanelContent', children:[ | 80 | {tag:'div', cls:'subPanelContent', children:[ |
83 | {tag:'ul', children:[ | 81 | {tag:'ul', children:[ |
84 | {tag:'li', id:this.getId('passwordGeneratorPanel'),children:[ | 82 | {tag:'li', id:this.getId('passwordGeneratorPanel'),children:[ |
85 | // {tag:'h3', html:"Password generator"} | 83 | // {tag:'h3', html:"Password generator"} |
86 | ]}, | 84 | ]}, |
87 | {tag:'li', id:this.getId('bookmarkletPanel'),children:[ | 85 | {tag:'li', id:this.getId('bookmarkletPanel'),children:[ |
88 | // {tag:'h3', html:"Bookmarklet"} | 86 | // {tag:'h3', html:"Bookmarklet"} |
89 | ]}, | 87 | ]}, |
90 | {tag:'li', id:this.getId('compactEditionPanel'), children:[ | 88 | {tag:'li', id:this.getId('compactEditionPanel'), children:[ |
91 | // {tag:'h3', html:"Compact edition"} | 89 | // {tag:'h3', html:"Compact edition"} |
92 | ]}, | 90 | ]}, |
93 | {tag:'li', id:this.getId('httpAuthPanel'), children:[ | 91 | {tag:'li', id:this.getId('httpAuthPanel'), children:[ |
94 | // {tag:'h3', html:"HTTP Auth"} | 92 | // {tag:'h3', html:"HTTP Auth"} |
95 | ]} | 93 | ]} |
96 | ]} | 94 | ]} |
97 | ]} | 95 | ]} |
98 | ]} | 96 | ]} |
99 | ]}, | 97 | ]}, |
100 | {tag:'div', cls:'footer'} | 98 | {tag:'div', cls:'footer'} |
101 | ]); | 99 | ]); |
102 | 100 | ||
103 | this.tabPanelController().setup({selected:this.initiallySelectedTab()}); | 101 | this.tabPanelController().setup({selected:this.initiallySelectedTab()}); |
104 | }, | 102 | }, |
105 | 103 | ||
106 | //------------------------------------------------------------------------- | 104 | //------------------------------------------------------------------------- |
107 | 105 | ||
108 | 106 | ||
109 | __syntaxFix__: "syntax fix" | 107 | __syntaxFix__: "syntax fix" |
110 | }); | 108 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js index 21ccf2a..fe46729 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js | |||
@@ -1,181 +1,178 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.UnlockPasswordComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.UnlockPasswordComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.UnlockPasswordComponent.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.UnlockPasswordComponent.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._openFromElement = args.openFromElement || null; | 31 | this._openFromElement = args.openFromElement || null; |
34 | this._onOkCloseToElement = args.onOkCloseToElement || null; | 32 | this._onOkCloseToElement = args.onOkCloseToElement || null; |
35 | this._onCancelCloseToElement = args.onCancelCloseToElement|| null; | 33 | this._onCancelCloseToElement = args.onCancelCloseToElement|| null; |
36 | 34 | ||
37 | this._progressBarComponent = null; | 35 | this._progressBarComponent = null; |
38 | 36 | ||
39 | return this; | 37 | return this; |
40 | } | 38 | } |
41 | 39 | ||
42 | //============================================================================= | 40 | //============================================================================= |
43 | 41 | ||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.UnlockPasswordComponent, Clipperz.PM.UI.Common.Components.SimpleMessagePanel, { | 42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.UnlockPasswordComponent, Clipperz.PM.UI.Common.Components.SimpleMessagePanel, { |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
47 | 45 | ||
48 | 'toString': function () { | 46 | 'toString': function () { |
49 | return "Clipperz.PM.UI.Web.Components.UnlockPasswordComponent component"; | 47 | return "Clipperz.PM.UI.Web.Components.UnlockPasswordComponent component"; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
53 | 51 | ||
54 | 'getPassphrase': function () { | 52 | 'getPassphrase': function () { |
55 | /* var deferredResult; | 53 | /* var deferredResult; |
56 | 54 | ||
57 | if (this.passphrase() == null) { | 55 | if (this.passphrase() == null) { |
58 | this.deferredShowModal({'openFromElement': this.openFromElement()}); | 56 | this.deferredShowModal({'openFromElement': this.openFromElement()}); |
59 | deferredResult = this.deferred(); | 57 | deferredResult = this.deferred(); |
60 | } else { | 58 | } else { |
61 | deferredResult = MochiKit.Async.succeed(this.passphrase()); | 59 | deferredResult = MochiKit.Async.succeed(this.passphrase()); |
62 | } | 60 | } |
63 | 61 | ||
64 | return deferredResult; | 62 | return deferredResult; |
65 | */ | 63 | */ |
66 | 64 | ||
67 | this.deferredShowModal({'openFromElement': this.openFromElement()}); | 65 | this.deferredShowModal({'openFromElement': this.openFromElement()}); |
68 | 66 | ||
69 | return this.deferred(); | 67 | return this.deferred(); |
70 | }, | 68 | }, |
71 | 69 | ||
72 | //------------------------------------------------------------------------- | 70 | //------------------------------------------------------------------------- |
73 | 71 | ||
74 | 'deferredShowModal': function (someParameters) { | 72 | 'deferredShowModal': function (someParameters) { |
75 | return Clipperz.Async.callbacks("UnlockPasswordComponent.deferredShowModal", [ | 73 | return Clipperz.Async.callbacks("UnlockPasswordComponent.deferredShowModal", [ |
76 | MochiKit.Base.bind(Clipperz.PM.UI.Web.Components.UnlockPasswordComponent.superclass.deferredShowModal, this, someParameters), | 74 | MochiKit.Base.bind(Clipperz.PM.UI.Web.Components.UnlockPasswordComponent.superclass.deferredShowModal, this, someParameters), |
77 | MochiKit.Base.method(this, 'getElement', 'passphrase'), | 75 | MochiKit.Base.method(this, 'getElement', 'passphrase'), |
78 | MochiKit.Base.methodcaller('focus') | 76 | MochiKit.Base.methodcaller('focus') |
79 | ], {trace:false}) | 77 | ], {trace:false}) |
80 | }, | 78 | }, |
81 | 79 | ||
82 | //------------------------------------------------------------------------- | 80 | //------------------------------------------------------------------------- |
83 | 81 | ||
84 | 'openFromElement': function () { | 82 | 'openFromElement': function () { |
85 | return this._openFromElement; | 83 | return this._openFromElement; |
86 | }, | 84 | }, |
87 | 85 | ||
88 | 'onOkCloseToElement': function () { | 86 | 'onOkCloseToElement': function () { |
89 | return this._onOkCloseToElement; | 87 | return this._onOkCloseToElement; |
90 | }, | 88 | }, |
91 | 89 | ||
92 | 'onCancelCloseToElement': function () { | 90 | 'onCancelCloseToElement': function () { |
93 | return this._onCancelCloseToElement; | 91 | return this._onCancelCloseToElement; |
94 | }, | 92 | }, |
95 | 93 | ||
96 | //------------------------------------------------------------------------- | 94 | //------------------------------------------------------------------------- |
97 | 95 | ||
98 | 'renderSelf': function() { | 96 | 'renderSelf': function() { |
99 | Clipperz.PM.UI.Web.Components.UnlockPasswordComponent.superclass.renderSelf.apply(this, arguments); | 97 | Clipperz.PM.UI.Web.Components.UnlockPasswordComponent.superclass.renderSelf.apply(this, arguments); |
100 | 98 | ||
101 | this.append(this.getElement('container'), {tag:'div', cls:'passphrase', children: [ | 99 | this.append(this.getElement('container'), {tag:'div', cls:'passphrase', children: [ |
102 | // {tag:'form', id:this.getId('passphraseForm'), children:[ | 100 | // {tag:'form', id:this.getId('passphraseForm'), children:[ |
103 | {tag:'input', id:this.getId('passphrase'), type:'password', name:'passphrase', value:''} | 101 | {tag:'input', id:this.getId('passphrase'), type:'password', name:'passphrase', value:''} |
104 | // ]} | 102 | // ]} |
105 | ]}); | 103 | ]}); |
106 | 104 | ||
107 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'userSuccessfullyLoggedIn', this, 'userSuccessfullyLoggedInHandler'); | 105 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'userSuccessfullyLoggedIn', this, 'userSuccessfullyLoggedInHandler'); |
108 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'userLoginFailed', this, 'userLoginFailedHandler'); | 106 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'userLoginFailed', this, 'userLoginFailedHandler'); |
109 | 107 | ||
110 | 108 | ||
111 | // MochiKit.Async.callLater(0.1, MochiKit.Base.method(this.getElement('passphrase'), 'focus')); | 109 | // MochiKit.Async.callLater(0.1, MochiKit.Base.method(this.getElement('passphrase'), 'focus')); |
112 | // this.getElement('passphrase').select(); | 110 | // this.getElement('passphrase').select(); |
113 | }, | 111 | }, |
114 | 112 | ||
115 | //------------------------------------------------------------------------- | 113 | //------------------------------------------------------------------------- |
116 | 114 | ||
117 | 'showProgressBar': function () { | 115 | 'showProgressBar': function () { |
118 | varprogressBarElement; | 116 | varprogressBarElement; |
119 | 117 | ||
120 | this.getElement('container').innerHTML = ''; | 118 | this.getElement('container').innerHTML = ''; |
121 | 119 | ||
122 | progressBarElement = this.append(this.getElement('container'), {tag:'div', cls:'progressBarWrapper'}); | 120 | progressBarElement = this.append(this.getElement('container'), {tag:'div', cls:'progressBarWrapper'}); |
123 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':progressBarElement})); | 121 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':progressBarElement})); |
124 | 122 | ||
125 | this.setButtons([{text:"Cancel", result:'CANCEL'}]); | 123 | this.setButtons([{text:"Cancel", result:'CANCEL'}]); |
126 | }, | 124 | }, |
127 | 125 | ||
128 | //------------------------------------------------------------------------- | 126 | //------------------------------------------------------------------------- |
129 | 127 | ||
130 | 'showFailure': function () { | 128 | 'showFailure': function () { |
131 | this.setType('ALERT'); | 129 | this.setType('ALERT'); |
132 | this.setTitle("Login failed"); | 130 | this.setTitle("Login failed"); |
133 | this.setText("Wrong passphrase; the unlock has failed."); | 131 | this.setText("Wrong passphrase; the unlock has failed."); |
134 | this.getElement('container').innerHTML = ''; | 132 | this.getElement('container').innerHTML = ''; |
135 | this.setButtons([{text:"Close", result:'CANCEL', isDefault:true}]); | 133 | this.setButtons([{text:"Close", result:'CANCEL', isDefault:true}]); |
136 | }, | 134 | }, |
137 | 135 | ||
138 | //------------------------------------------------------------------------- | 136 | //------------------------------------------------------------------------- |
139 | 137 | ||
140 | 'closeOk': function () { | 138 | 'closeOk': function () { |
141 | var passphrase; | 139 | var passphrase; |
142 | 140 | ||
143 | passphrase = this.getElement('passphrase').value; | 141 | passphrase = this.getElement('passphrase').value; |
144 | this.showProgressBar(); | 142 | this.showProgressBar(); |
145 | // this.deferred().callback(passphrase); | 143 | // this.deferred().callback(passphrase); |
146 | MochiKit.Async.callLater(0.5, MochiKit.Base.method(this.deferred(), 'callback', passphrase)); | 144 | MochiKit.Async.callLater(0.5, MochiKit.Base.method(this.deferred(), 'callback', passphrase)); |
147 | this._deferred = null; | 145 | this._deferred = null; |
148 | }, | 146 | }, |
149 | 147 | ||
150 | 'closeCancel': function () { | 148 | 'closeCancel': function () { |
151 | this.deferredHideModal({closeToElement:this.onCancelCloseToElement()}); | 149 | this.deferredHideModal({closeToElement:this.onCancelCloseToElement()}); |
152 | this.deferred().cancel(); | 150 | this.deferred().cancel(); |
153 | this._deferred = null; | 151 | this._deferred = null; |
154 | }, | 152 | }, |
155 | 153 | ||
156 | //------------------------------------------------------------------------- | 154 | //------------------------------------------------------------------------- |
157 | 155 | ||
158 | 'userSuccessfullyLoggedInHandler': function (anEvent) { | 156 | 'userSuccessfullyLoggedInHandler': function (anEvent) { |
159 | this.deferredHideModal({closeToElement:this.onOkCloseToElement()}); | 157 | this.deferredHideModal({closeToElement:this.onOkCloseToElement()}); |
160 | }, | 158 | }, |
161 | 159 | ||
162 | 'userLoginFailedHandler': function (anEvent) { | 160 | 'userLoginFailedHandler': function (anEvent) { |
163 | //console.log("############### FAILED LOGIN ################"); | ||
164 | this.showFailure(); | 161 | this.showFailure(); |
165 | }, | 162 | }, |
166 | 163 | ||
167 | //------------------------------------------------------------------------- | 164 | //------------------------------------------------------------------------- |
168 | /* | 165 | /* |
169 | 'deferredShow': function (someArgs, aResult) { | 166 | 'deferredShow': function (someArgs, aResult) { |
170 | this.deferredShowModal(someArgs); | 167 | this.deferredShowModal(someArgs); |
171 | 168 | ||
172 | // this.deferred().addMethod(this, 'deferredHideModal', {closeToElement:someArgs.onOkCloseToElement }); | 169 | // this.deferred().addMethod(this, 'deferredHideModal', {closeToElement:someArgs.onOkCloseToElement }); |
173 | // this.deferred().addErrback (MochiKit.Base.method(this, 'deferredHideModal', {closeToElement:someArgs.onCancelCloseToElement })); | 170 | // this.deferred().addErrback (MochiKit.Base.method(this, 'deferredHideModal', {closeToElement:someArgs.onCancelCloseToElement })); |
174 | // this.deferred().addCallback(MochiKit.Async.succeed, aResult); | 171 | // this.deferred().addCallback(MochiKit.Async.succeed, aResult); |
175 | 172 | ||
176 | return this.deferred(); | 173 | return this.deferred(); |
177 | }, | 174 | }, |
178 | */ | 175 | */ |
179 | //------------------------------------------------------------------------- | 176 | //------------------------------------------------------------------------- |
180 | __syntaxFix__: "syntax fix" | 177 | __syntaxFix__: "syntax fix" |
181 | }); | 178 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UserInfoBox.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UserInfoBox.js index d699dc6..fbf58e0 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UserInfoBox.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UserInfoBox.js | |||
@@ -1,341 +1,335 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.UserInfoBox = function(args) { | 26 | Clipperz.PM.UI.Web.Components.UserInfoBox = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Components.UserInfoBox.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Components.UserInfoBox.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._slots = {}; | 31 | this._slots = {}; |
34 | this._isLocked = false; | 32 | this._isLocked = false; |
35 | this._lockTooltip = null; | 33 | this._lockTooltip = null; |
36 | 34 | ||
37 | return this; | 35 | return this; |
38 | } | 36 | } |
39 | 37 | ||
40 | //============================================================================= | 38 | //============================================================================= |
41 | 39 | ||
42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.UserInfoBox, Clipperz.PM.UI.Common.Components.BaseComponent, { | 40 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.UserInfoBox, Clipperz.PM.UI.Common.Components.BaseComponent, { |
43 | 41 | ||
44 | //------------------------------------------------------------------------- | 42 | //------------------------------------------------------------------------- |
45 | 43 | ||
46 | 'toString': function () { | 44 | 'toString': function () { |
47 | return "Clipperz.PM.UI.Web.Components.UserInfoBox component"; | 45 | return "Clipperz.PM.UI.Web.Components.UserInfoBox component"; |
48 | }, | 46 | }, |
49 | 47 | ||
50 | //------------------------------------------------------------------------- | 48 | //------------------------------------------------------------------------- |
51 | 49 | ||
52 | 'handleLogout': function(anEvent) { | 50 | 'handleLogout': function(anEvent) { |
53 | //Clipperz.log(">>> UserInfoBox.handleLogout"); | 51 | //Clipperz.log(">>> UserInfoBox.handleLogout"); |
54 | anEvent.preventDefault(); | 52 | anEvent.preventDefault(); |
55 | MochiKit.Signal.signal(this, 'logout'); | 53 | MochiKit.Signal.signal(this, 'logout'); |
56 | //Clipperz.log("<<< UserInfoBox.handleLogout"); | 54 | //Clipperz.log("<<< UserInfoBox.handleLogout"); |
57 | }, | 55 | }, |
58 | 56 | ||
59 | //------------------------------------------------------------------------- | 57 | //------------------------------------------------------------------------- |
60 | 58 | ||
61 | 'lockTooltip': function () { | 59 | 'lockTooltip': function () { |
62 | return this._lockTooltip; | 60 | return this._lockTooltip; |
63 | }, | 61 | }, |
64 | 62 | ||
65 | //------------------------------------------------------------------------- | 63 | //------------------------------------------------------------------------- |
66 | 64 | ||
67 | 'isLocked': function () { | 65 | 'isLocked': function () { |
68 | return this._isLocked; | 66 | return this._isLocked; |
69 | }, | 67 | }, |
70 | 68 | ||
71 | 'setIsLocked': function (aValue) { | 69 | 'setIsLocked': function (aValue) { |
72 | this._isLocked = aValue; | 70 | this._isLocked = aValue; |
73 | }, | 71 | }, |
74 | 72 | ||
75 | 'toggleLock': function(anEvent) { | 73 | 'toggleLock': function(anEvent) { |
76 | var deferredResult; | 74 | var deferredResult; |
77 | var shouldLock; | 75 | var shouldLock; |
78 | 76 | ||
79 | //console.log(">>> UserInfoBox.toggleLock [locked: " + this.isLocked() + "]"); | ||
80 | anEvent.preventDefault(); | 77 | anEvent.preventDefault(); |
81 | this.lockTooltip().hide(); | 78 | this.lockTooltip().hide(); |
82 | 79 | ||
83 | shouldLock = (this.isLocked() == false); | 80 | shouldLock = (this.isLocked() == false); |
84 | 81 | ||
85 | if (shouldLock) { | 82 | if (shouldLock) { |
86 | var maskElement; | 83 | var maskElement; |
87 | 84 | ||
88 | this.setIsLocked(true); | 85 | this.setIsLocked(true); |
89 | maskElement = this.getId('modalDialogMask'); | 86 | maskElement = this.getId('modalDialogMask'); |
90 | deferredResult = Clipperz.Async.callbacks("UserInfoBox.toggleLock [lock]", [ | 87 | deferredResult = Clipperz.Async.callbacks("UserInfoBox.toggleLock [lock]", [ |
91 | MochiKit.Base.partial(MochiKit.DOM.addElementClass, this.element(), 'locked'), | 88 | MochiKit.Base.partial(MochiKit.DOM.addElementClass, this.element(), 'locked'), |
92 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimation, MochiKit.Visual.appear, maskElement, {from:0.0, to:0.75, duration:0.5}), | 89 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimation, MochiKit.Visual.appear, maskElement, {from:0.0, to:0.75, duration:0.5}), |
93 | MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', MochiKit.Base.method(this, 'askForPassphrase')), | 90 | MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', MochiKit.Base.method(this, 'askForPassphrase')), |
94 | MochiKit.Base.partial(MochiKit.Signal.signal, this, 'lock') | 91 | MochiKit.Base.partial(MochiKit.Signal.signal, this, 'lock') |
95 | ], {trace:false}); | 92 | ], {trace:false}); |
96 | } else { | 93 | } else { |
97 | deferredResult = Clipperz.Async.callbacks("UserInfoBox.toggleLock [unlock]", [ | 94 | deferredResult = Clipperz.Async.callbacks("UserInfoBox.toggleLock [unlock]", [ |
98 | MochiKit.Base.partial(MochiKit.Signal.signal, this, 'unlock') | 95 | MochiKit.Base.partial(MochiKit.Signal.signal, this, 'unlock') |
99 | ], {trace:false}); | 96 | ], {trace:false}); |
100 | } | 97 | } |
101 | //console.log("<<< UserInfoBox.toggleLock"); | ||
102 | 98 | ||
103 | return deferredResult; | 99 | return deferredResult; |
104 | }, | 100 | }, |
105 | 101 | ||
106 | //------------------------------------------------------------------------- | 102 | //------------------------------------------------------------------------- |
107 | 103 | ||
108 | 'unlock': function () { | 104 | 'unlock': function () { |
109 | var deferredResult; | 105 | var deferredResult; |
110 | var maskElement; | 106 | var maskElement; |
111 | 107 | ||
112 | this.setIsLocked(false); | 108 | this.setIsLocked(false); |
113 | maskElement = this.getId('modalDialogMask'); | 109 | maskElement = this.getId('modalDialogMask'); |
114 | 110 | ||
115 | deferredResult = Clipperz.Async.callbacks("UserInfoBox.unlock", [ | 111 | deferredResult = Clipperz.Async.callbacks("UserInfoBox.unlock", [ |
116 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimation, MochiKit.Visual.fade, maskElement, {from:0.75, to:0.0, duration:0.5}), | 112 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimation, MochiKit.Visual.fade, maskElement, {from:0.75, to:0.0, duration:0.5}), |
117 | // Clipperz.Visual.deferredAnimation(MochiKit.Visual.fade, maskElement, {from:0.75, to:0.0, duration:0.5}), | 113 | // Clipperz.Visual.deferredAnimation(MochiKit.Visual.fade, maskElement, {from:0.75, to:0.0, duration:0.5}), |
118 | MochiKit.Base.partial(MochiKit.DOM.removeElementClass, this.element(), 'locked') | 114 | MochiKit.Base.partial(MochiKit.DOM.removeElementClass, this.element(), 'locked') |
119 | ], {trace:false}); | 115 | ], {trace:false}); |
120 | }, | 116 | }, |
121 | 117 | ||
122 | //------------------------------------------------------------------------- | 118 | //------------------------------------------------------------------------- |
123 | 119 | ||
124 | 'askForPassphrase': function () { | 120 | 'askForPassphrase': function () { |
125 | varunlockPasswordComponent; | 121 | varunlockPasswordComponent; |
126 | /* | 122 | /* |
127 | vardeferredResult; | 123 | vardeferredResult; |
128 | 124 | ||
129 | deferredResult = new Clipperz.Async.Deferred("UserInfoBox.askForPassphrase", {trace:false}); | 125 | deferredResult = new Clipperz.Async.Deferred("UserInfoBox.askForPassphrase", {trace:false}); |
130 | deferredResult.addCallback(MochiKit.Async.succeed, 'test'); | 126 | deferredResult.addCallback(MochiKit.Async.succeed, 'test'); |
131 | 127 | ||
132 | deferredResult.callback(); | 128 | deferredResult.callback(); |
133 | 129 | ||
134 | return deferredResult; | 130 | return deferredResult; |
135 | */ | 131 | */ |
136 | //console.log(">>> UserInfoBox.askForPassphrase"); | ||
137 | unlockPasswordComponent = new Clipperz.PM.UI.Web.Components.UnlockPasswordComponent({ | 132 | unlockPasswordComponent = new Clipperz.PM.UI.Web.Components.UnlockPasswordComponent({ |
138 | 'title':"Unlock account", | 133 | 'title':"Unlock account", |
139 | 'text': "Insert the passprase to unlock the account", | 134 | 'text': "Insert the passprase to unlock the account", |
140 | 'type': 'INFO', | 135 | 'type': 'INFO', |
141 | 'buttons': [ | 136 | 'buttons': [ |
142 | {text:"Cancel",result:'CANCEL'}, | 137 | {text:"Cancel",result:'CANCEL'}, |
143 | {text:"Unlock", result:'OK',isDefault:true} | 138 | {text:"Unlock", result:'OK',isDefault:true} |
144 | ], | 139 | ], |
145 | 'openFromElement': this.getElement('lock'), | 140 | 'openFromElement': this.getElement('lock'), |
146 | 'onOkCloseToElement': null, | 141 | 'onOkCloseToElement': null, |
147 | 'onCancelCloseToElement':this.getId('lock') | 142 | 'onCancelCloseToElement':this.getId('lock') |
148 | }); | 143 | }); |
149 | //console.log("<<< UserInfoBox.askForPassphrase"); | ||
150 | 144 | ||
151 | return unlockPasswordComponent.getPassphrase(); | 145 | return unlockPasswordComponent.getPassphrase(); |
152 | }, | 146 | }, |
153 | 147 | ||
154 | //========================================================================= | 148 | //========================================================================= |
155 | 149 | ||
156 | 'renderSelf': function(/*aContainer, aPosition*/) { | 150 | 'renderSelf': function(/*aContainer, aPosition*/) { |
157 | this.append(this.element(), [ | 151 | this.append(this.element(), [ |
158 | // {tag:'canvas', id:this.getId('canvas'), cls:'canvas', width:'188', height:'154'}, | 152 | // {tag:'canvas', id:this.getId('canvas'), cls:'canvas', width:'188', height:'154'}, |
159 | {tag:'div', cls:'header', children:[ | 153 | {tag:'div', cls:'header', children:[ |
160 | {tag:'h1', html:"Welcome"}, | 154 | {tag:'h1', html:"Welcome"}, |
161 | {tag:'a', cls:'lockButton', href:'#', id:this.getId('lock'), html:' '} | 155 | {tag:'a', cls:'lockButton', href:'#', id:this.getId('lock'), html:' '} |
162 | ]}, | 156 | ]}, |
163 | {tag:'div', cls:'body', children:[ | 157 | {tag:'div', cls:'body', children:[ |
164 | {tag:'h3', id:this.getId('username'), html:""}, | 158 | {tag:'h3', id:this.getId('username'), html:""}, |
165 | {tag:'ul', children:[ | 159 | {tag:'ul', children:[ |
166 | {tag:'li', id:this.getId('cards'), children:[ | 160 | {tag:'li', id:this.getId('cards'), children:[ |
167 | {tag:'span', id:this.getId('cardsNumber'), cls:'number', html:"-"}, | 161 | {tag:'span', id:this.getId('cardsNumber'), cls:'number', html:"-"}, |
168 | {tag:'span', id:this.getId('cardsLabel'), html:"cards"} | 162 | {tag:'span', id:this.getId('cardsLabel'), html:"cards"} |
169 | ]}, | 163 | ]}, |
170 | {tag:'li', id:this.getId('directLogins'), children:[ | 164 | {tag:'li', id:this.getId('directLogins'), children:[ |
171 | {tag:'span', id:this.getId('directLoginsNumber'), cls:'number', html:"-"}, | 165 | {tag:'span', id:this.getId('directLoginsNumber'), cls:'number', html:"-"}, |
172 | {tag:'span', id:this.getId('directLoginsLabel'), html:"direct logins"} | 166 | {tag:'span', id:this.getId('directLoginsLabel'), html:"direct logins"} |
173 | ]} | 167 | ]} |
174 | ]}, | 168 | ]}, |
175 | {tag:'a', href:'#', id:this.getId('logout'), html:"logout >"} | 169 | {tag:'a', href:'#', id:this.getId('logout'), html:"logout >"} |
176 | ]}, | 170 | ]}, |
177 | {tag:'div', cls:'footer'} | 171 | {tag:'div', cls:'footer'} |
178 | ]); | 172 | ]); |
179 | 173 | ||
180 | MochiKit.Signal.connect(this.getElement('logout'), 'onclick', this, 'handleLogout'); | 174 | MochiKit.Signal.connect(this.getElement('logout'), 'onclick', this, 'handleLogout'); |
181 | MochiKit.Signal.connect(this.getElement('lock'), 'onclick', this, 'toggleLock'); | 175 | MochiKit.Signal.connect(this.getElement('lock'), 'onclick', this, 'toggleLock'); |
182 | 176 | ||
183 | this._lockTooltip = new Clipperz.PM.UI.Common.Components.Tooltip({ | 177 | this._lockTooltip = new Clipperz.PM.UI.Common.Components.Tooltip({ |
184 | element:this.getElement('lock'), | 178 | element:this.getElement('lock'), |
185 | text: "Click here to lock/unlock your account.", | 179 | text: "Click here to lock/unlock your account.", |
186 | position:'RIGHT' | 180 | position:'RIGHT' |
187 | }); | 181 | }); |
188 | 182 | ||
189 | Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body, | 183 | Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body, |
190 | {tag:'div', id:this.getId('modalDialogWrapper'), cls:'modalDialogWrapper', children:[ | 184 | {tag:'div', id:this.getId('modalDialogWrapper'), cls:'modalDialogWrapper', children:[ |
191 | {tag:'div', id:this.getId('modalDialogMask'), cls:'modalDialogMask userInfoBoxMask'} | 185 | {tag:'div', id:this.getId('modalDialogMask'), cls:'modalDialogMask userInfoBoxMask'} |
192 | ]} | 186 | ]} |
193 | ); | 187 | ); |
194 | MochiKit.Style.hideElement(this.getId('modalDialogMask')); | 188 | MochiKit.Style.hideElement(this.getId('modalDialogMask')); |
195 | 189 | ||
196 | // this.drawUserInfoBackground(this.getElement('canvas')); | 190 | // this.drawUserInfoBackground(this.getElement('canvas')); |
197 | }, | 191 | }, |
198 | 192 | ||
199 | //------------------------------------------------------------------------- | 193 | //------------------------------------------------------------------------- |
200 | /* | 194 | /* |
201 | 'drawUserInfoBackground': function (canvas) { | 195 | 'drawUserInfoBackground': function (canvas) { |
202 | var kMyDrawingFunctionWidth = 188.0; | 196 | var kMyDrawingFunctionWidth = 188.0; |
203 | var kMyDrawingFunctionHeight = 154.0; | 197 | var kMyDrawingFunctionHeight = 154.0; |
204 | 198 | ||
205 | var context = canvas.getContext("2d"); | 199 | var context = canvas.getContext("2d"); |
206 | var color; | 200 | var color; |
207 | var resolution; | 201 | var resolution; |
208 | var alignStroke; | 202 | var alignStroke; |
209 | var path; | 203 | var path; |
210 | var pointX; | 204 | var pointX; |
211 | var pointY; | 205 | var pointY; |
212 | var controlPoint1X; | 206 | var controlPoint1X; |
213 | var controlPoint1Y; | 207 | var controlPoint1Y; |
214 | var controlPoint2X; | 208 | var controlPoint2X; |
215 | var controlPoint2Y; | 209 | var controlPoint2Y; |
216 | var gradient; | 210 | var gradient; |
217 | if (window.devicePixelRatio) | 211 | if (window.devicePixelRatio) |
218 | resolution = window.devicePixelRatio; | 212 | resolution = window.devicePixelRatio; |
219 | else | 213 | else |
220 | resolution = 1.0; | 214 | resolution = 1.0; |
221 | resolution *= 0.5 * (canvas.width / kMyDrawingFunctionWidth + canvas.height / kMyDrawingFunctionHeight); | 215 | resolution *= 0.5 * (canvas.width / kMyDrawingFunctionWidth + canvas.height / kMyDrawingFunctionHeight); |
222 | 216 | ||
223 | context.save(); | 217 | context.save(); |
224 | context.scale(canvas.width / kMyDrawingFunctionWidth, canvas.height / kMyDrawingFunctionHeight); | 218 | context.scale(canvas.width / kMyDrawingFunctionWidth, canvas.height / kMyDrawingFunctionHeight); |
225 | context.clearRect(0.0, 0.0, kMyDrawingFunctionWidth, kMyDrawingFunctionHeight); | 219 | context.clearRect(0.0, 0.0, kMyDrawingFunctionWidth, kMyDrawingFunctionHeight); |
226 | 220 | ||
227 | // Setup for Shadow Effect | 221 | // Setup for Shadow Effect |
228 | color = "rgba(0.0%, 0.0%, 0.0%, 0.667)"; | 222 | color = "rgba(0.0%, 0.0%, 0.0%, 0.667)"; |
229 | context.save(); | 223 | context.save(); |
230 | context.shadowColor = color; | 224 | context.shadowColor = color; |
231 | context.shadowBlur = 3.0; | 225 | context.shadowBlur = 3.0; |
232 | context.shadowOffsetX = 5.729 * Math.cos(7.592) * resolution; | 226 | context.shadowOffsetX = 5.729 * Math.cos(7.592) * resolution; |
233 | context.shadowOffsetY = 5.729 * Math.sin(7.592) * resolution; | 227 | context.shadowOffsetY = 5.729 * Math.sin(7.592) * resolution; |
234 | 228 | ||
235 | // Layer 1 | 229 | // Layer 1 |
236 | 230 | ||
237 | alignStroke = 0.0; | 231 | alignStroke = 0.0; |
238 | context.beginPath(); | 232 | context.beginPath(); |
239 | pointX = 169.5; | 233 | pointX = 169.5; |
240 | pointY = 141.5; | 234 | pointY = 141.5; |
241 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 235 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
242 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 236 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
243 | context.moveTo(pointX, pointY); | 237 | context.moveTo(pointX, pointY); |
244 | pointX = 177.5; | 238 | pointX = 177.5; |
245 | pointY = 133.5; | 239 | pointY = 133.5; |
246 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 240 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
247 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 241 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
248 | controlPoint1X = 173.889; | 242 | controlPoint1X = 173.889; |
249 | controlPoint1Y = 141.5; | 243 | controlPoint1Y = 141.5; |
250 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 244 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
251 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 245 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
252 | controlPoint2X = 177.5; | 246 | controlPoint2X = 177.5; |
253 | controlPoint2Y = 137.889; | 247 | controlPoint2Y = 137.889; |
254 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 248 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
255 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 249 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
256 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 250 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
257 | pointX = 177.5; | 251 | pointX = 177.5; |
258 | pointY = 19.5; | 252 | pointY = 19.5; |
259 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 253 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
260 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 254 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
261 | context.lineTo(pointX, pointY); | 255 | context.lineTo(pointX, pointY); |
262 | pointX = 169.5; | 256 | pointX = 169.5; |
263 | pointY = 11.5; | 257 | pointY = 11.5; |
264 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 258 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
265 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 259 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
266 | controlPoint1X = 177.5; | 260 | controlPoint1X = 177.5; |
267 | controlPoint1Y = 15.111; | 261 | controlPoint1Y = 15.111; |
268 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 262 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
269 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 263 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
270 | controlPoint2X = 173.889; | 264 | controlPoint2X = 173.889; |
271 | controlPoint2Y = 11.5; | 265 | controlPoint2Y = 11.5; |
272 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 266 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
273 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 267 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
274 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 268 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
275 | pointX = 18.5; | 269 | pointX = 18.5; |
276 | pointY = 11.5; | 270 | pointY = 11.5; |
277 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 271 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
278 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 272 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
279 | context.lineTo(pointX, pointY); | 273 | context.lineTo(pointX, pointY); |
280 | pointX = 10.5; | 274 | pointX = 10.5; |
281 | pointY = 19.5; | 275 | pointY = 19.5; |
282 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 276 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
283 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 277 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
284 | controlPoint1X = 14.111; | 278 | controlPoint1X = 14.111; |
285 | controlPoint1Y = 11.5; | 279 | controlPoint1Y = 11.5; |
286 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 280 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
287 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 281 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
288 | controlPoint2X = 10.5; | 282 | controlPoint2X = 10.5; |
289 | controlPoint2Y = 15.111; | 283 | controlPoint2Y = 15.111; |
290 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 284 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
291 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 285 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
292 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 286 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
293 | pointX = 10.5; | 287 | pointX = 10.5; |
294 | pointY = 133.5; | 288 | pointY = 133.5; |
295 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 289 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
296 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 290 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
297 | context.lineTo(pointX, pointY); | 291 | context.lineTo(pointX, pointY); |
298 | pointX = 18.5; | 292 | pointX = 18.5; |
299 | pointY = 141.5; | 293 | pointY = 141.5; |
300 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 294 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
301 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 295 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
302 | controlPoint1X = 10.5; | 296 | controlPoint1X = 10.5; |
303 | controlPoint1Y = 137.889; | 297 | controlPoint1Y = 137.889; |
304 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | 298 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; |
305 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | 299 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; |
306 | controlPoint2X = 14.111; | 300 | controlPoint2X = 14.111; |
307 | controlPoint2Y = 141.5; | 301 | controlPoint2Y = 141.5; |
308 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | 302 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; |
309 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | 303 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; |
310 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | 304 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); |
311 | pointX = 169.5; | 305 | pointX = 169.5; |
312 | pointY = 141.5; | 306 | pointY = 141.5; |
313 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 307 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
314 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 308 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
315 | context.lineTo(pointX, pointY); | 309 | context.lineTo(pointX, pointY); |
316 | context.closePath(); | 310 | context.closePath(); |
317 | gradient = context.createLinearGradient(94.0, 11.5, 94.0, 141.5); | 311 | gradient = context.createLinearGradient(94.0, 11.5, 94.0, 141.5); |
318 | color = "#EE9B69"; | 312 | color = "#EE9B69"; |
319 | gradient.addColorStop(0.0, color); | 313 | gradient.addColorStop(0.0, color); |
320 | color = "#E38D62"; | 314 | color = "#E38D62"; |
321 | gradient.addColorStop(1.0, color); | 315 | gradient.addColorStop(1.0, color); |
322 | context.fillStyle = gradient; | 316 | context.fillStyle = gradient; |
323 | context.fill(); | 317 | context.fill(); |
324 | 318 | ||
325 | // Shadow Effect | 319 | // Shadow Effect |
326 | context.restore(); | 320 | context.restore(); |
327 | 321 | ||
328 | context.restore(); | 322 | context.restore(); |
329 | }, | 323 | }, |
330 | */ | 324 | */ |
331 | //------------------------------------------------------------------------- | 325 | //------------------------------------------------------------------------- |
332 | 326 | ||
333 | 'updateUserDetails': function (someUserInfo) { | 327 | 'updateUserDetails': function (someUserInfo) { |
334 | varelementName; | 328 | varelementName; |
335 | 329 | ||
336 | for (elementName in someUserInfo) { | 330 | for (elementName in someUserInfo) { |
337 | this.getElement(elementName).innerHTML = someUserInfo[elementName]; | 331 | this.getElement(elementName).innerHTML = someUserInfo[elementName]; |
338 | } | 332 | } |
339 | }, | 333 | }, |
340 | 334 | ||
341 | //------------------------------------------------------------------------- | 335 | //------------------------------------------------------------------------- |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js index 1ab2e69..3d9d6d3 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js | |||
@@ -1,351 +1,348 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.AppController = function(args) { | 26 | Clipperz.PM.UI.Web.Controllers.AppController = function(args) { |
29 | 27 | ||
30 | this._user = null; | 28 | this._user = null; |
31 | this._tabSlotNames = { | 29 | this._tabSlotNames = { |
32 | //tabName: slotName | 30 | //tabName: slotName |
33 | 'cards': 'cardGrid', | 31 | 'cards': 'cardGrid', |
34 | // 'directLogins':'directLoginGrid', | 32 | // 'directLogins':'directLoginGrid', |
35 | 'account': 'accountPanel', | 33 | 'account': 'accountPanel', |
36 | 'data': 'dataPanel', | 34 | 'data': 'dataPanel', |
37 | 'tools': 'toolsPanel' | 35 | 'tools': 'toolsPanel' |
38 | }; | 36 | }; |
39 | 37 | ||
40 | //controllers | 38 | //controllers |
41 | this._cardsController= null; | 39 | this._cardsController= null; |
42 | //this._directLoginsController = null; | 40 | //this._directLoginsController = null; |
43 | this._filterController = null; //new Clipperz.PM.UI.Web.Controllers.FilterController(); | 41 | this._filterController = null; //new Clipperz.PM.UI.Web.Controllers.FilterController(); |
44 | 42 | ||
45 | //components | 43 | //components |
46 | this._appPage = null; | 44 | this._appPage = null; |
47 | this._userInfoBox = null; | 45 | this._userInfoBox = null; |
48 | this._tabSidePanel = null; | 46 | this._tabSidePanel = null; |
49 | 47 | ||
50 | // MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'editCard', this, 'handleEditCard'); | 48 | // MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'editCard', this, 'handleEditCard'); |
51 | // MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'deleteCard',this, 'handleDeleteCard'); | 49 | // MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'deleteCard',this, 'handleDeleteCard'); |
52 | 50 | ||
53 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'userDataSuccessfullySaved',this, 'userDataSuccessfullySavedHandler'); | 51 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'userDataSuccessfullySaved',this, 'userDataSuccessfullySavedHandler'); |
54 | 52 | ||
55 | return this; | 53 | return this; |
56 | } | 54 | } |
57 | 55 | ||
58 | MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.AppController.prototype, { | 56 | MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.AppController.prototype, { |
59 | 57 | ||
60 | 'toString': function() { | 58 | 'toString': function() { |
61 | return "Clipperz.PM.UI.Web.Controllers.AppController"; | 59 | return "Clipperz.PM.UI.Web.Controllers.AppController"; |
62 | }, | 60 | }, |
63 | 61 | ||
64 | //----------------------------------------------------------------------------- | 62 | //----------------------------------------------------------------------------- |
65 | 63 | ||
66 | 'setUser': function(anUser) { | 64 | 'setUser': function(anUser) { |
67 | this._user = anUser; | 65 | this._user = anUser; |
68 | }, | 66 | }, |
69 | 67 | ||
70 | 'user': function() { | 68 | 'user': function() { |
71 | return this._user; | 69 | return this._user; |
72 | }, | 70 | }, |
73 | 71 | ||
74 | //----------------------------------------------------------------------------- | 72 | //----------------------------------------------------------------------------- |
75 | /* | 73 | /* |
76 | 'tabSlotNames': function() { | 74 | 'tabSlotNames': function() { |
77 | return this._tabSlotNames; | 75 | return this._tabSlotNames; |
78 | }, | 76 | }, |
79 | */ | 77 | */ |
80 | 'slotNameForTab': function(aTabName) { | 78 | 'slotNameForTab': function(aTabName) { |
81 | return this._tabSlotNames[aTabName]; | 79 | return this._tabSlotNames[aTabName]; |
82 | }, | 80 | }, |
83 | 81 | ||
84 | 'hideAllAppPageTabSlots': function() { | 82 | 'hideAllAppPageTabSlots': function() { |
85 | var aTabName; | 83 | var aTabName; |
86 | 84 | ||
87 | for (aTabName in this._tabSlotNames) { | 85 | for (aTabName in this._tabSlotNames) { |
88 | this.appPage().hideSlot(this.slotNameForTab(aTabName)); | 86 | this.appPage().hideSlot(this.slotNameForTab(aTabName)); |
89 | } | 87 | } |
90 | }, | 88 | }, |
91 | 89 | ||
92 | //----------------------------------------------------------------------------- | 90 | //----------------------------------------------------------------------------- |
93 | 91 | ||
94 | 'appPage': function() { | 92 | 'appPage': function() { |
95 | if (this._appPage == null) { | 93 | if (this._appPage == null) { |
96 | this._appPage = new Clipperz.PM.UI.Web.Components.AppPage(); | 94 | this._appPage = new Clipperz.PM.UI.Web.Components.AppPage(); |
97 | } | 95 | } |
98 | 96 | ||
99 | return this._appPage; | 97 | return this._appPage; |
100 | }, | 98 | }, |
101 | 99 | ||
102 | //----------------------------------------------------------------------------- | 100 | //----------------------------------------------------------------------------- |
103 | 101 | ||
104 | 'tabSidePanel': function() { | 102 | 'tabSidePanel': function() { |
105 | if (this._tabSidePanel == null) { | 103 | if (this._tabSidePanel == null) { |
106 | this._tabSidePanel = new Clipperz.PM.UI.Web.Components.TabSidePanel(); | 104 | this._tabSidePanel = new Clipperz.PM.UI.Web.Components.TabSidePanel(); |
107 | } | 105 | } |
108 | 106 | ||
109 | return this._tabSidePanel; | 107 | return this._tabSidePanel; |
110 | }, | 108 | }, |
111 | 109 | ||
112 | //----------------------------------------------------------------------------- | 110 | //----------------------------------------------------------------------------- |
113 | 111 | ||
114 | 'userInfoBox': function() { | 112 | 'userInfoBox': function() { |
115 | if (this._userInfoBox == null) { | 113 | if (this._userInfoBox == null) { |
116 | this._userInfoBox = new Clipperz.PM.UI.Web.Components.UserInfoBox(); | 114 | this._userInfoBox = new Clipperz.PM.UI.Web.Components.UserInfoBox(); |
117 | 115 | ||
118 | MochiKit.Signal.connect(this._userInfoBox, 'logout',this, 'handleLogout'); | 116 | MochiKit.Signal.connect(this._userInfoBox, 'logout',this, 'handleLogout'); |
119 | MochiKit.Signal.connect(this._userInfoBox, 'lock', this, 'handleLock'); | 117 | MochiKit.Signal.connect(this._userInfoBox, 'lock', this, 'handleLock'); |
120 | MochiKit.Signal.connect(this._userInfoBox, 'unlock',this, 'handleUnlock'); | 118 | MochiKit.Signal.connect(this._userInfoBox, 'unlock',this, 'handleUnlock'); |
121 | } | 119 | } |
122 | 120 | ||
123 | return this._userInfoBox; | 121 | return this._userInfoBox; |
124 | }, | 122 | }, |
125 | 123 | ||
126 | //----------------------------------------------------------------------------- | 124 | //----------------------------------------------------------------------------- |
127 | 125 | ||
128 | 'accountPanel': function () { | 126 | 'accountPanel': function () { |
129 | if (this._accountPanel == null) { | 127 | if (this._accountPanel == null) { |
130 | this._accountPanel = new Clipperz.PM.UI.Web.Components.AccountPanel(/*{selected:'Preferences'}*/); | 128 | this._accountPanel = new Clipperz.PM.UI.Web.Components.AccountPanel(/*{selected:'Preferences'}*/); |
131 | } | 129 | } |
132 | 130 | ||
133 | return this._accountPanel; | 131 | return this._accountPanel; |
134 | }, | 132 | }, |
135 | 133 | ||
136 | //......................................................................... | 134 | //......................................................................... |
137 | 135 | ||
138 | 'dataPanel': function () { | 136 | 'dataPanel': function () { |
139 | if (this._dataPanel == null) { | 137 | if (this._dataPanel == null) { |
140 | this._dataPanel = new Clipperz.PM.UI.Web.Components.DataPanel(); | 138 | this._dataPanel = new Clipperz.PM.UI.Web.Components.DataPanel(); |
141 | } | 139 | } |
142 | 140 | ||
143 | return this._dataPanel; | 141 | return this._dataPanel; |
144 | }, | 142 | }, |
145 | 143 | ||
146 | //......................................................................... | 144 | //......................................................................... |
147 | 145 | ||
148 | 'toolsPanel': function () { | 146 | 'toolsPanel': function () { |
149 | if (this._toolsPanel == null) { | 147 | if (this._toolsPanel == null) { |
150 | this._toolsPanel = new Clipperz.PM.UI.Web.Components.ToolsPanel(); | 148 | this._toolsPanel = new Clipperz.PM.UI.Web.Components.ToolsPanel(); |
151 | } | 149 | } |
152 | 150 | ||
153 | return this._toolsPanel; | 151 | return this._toolsPanel; |
154 | }, | 152 | }, |
155 | 153 | ||
156 | //----------------------------------------------------------------------------- | 154 | //----------------------------------------------------------------------------- |
157 | 155 | ||
158 | 'filterController': function () { | 156 | 'filterController': function () { |
159 | if (this._filterController == null) { | 157 | if (this._filterController == null) { |
160 | this._filterController = new Clipperz.PM.UI.Web.Controllers.FilterController(); | 158 | this._filterController = new Clipperz.PM.UI.Web.Controllers.FilterController(); |
161 | } | 159 | } |
162 | 160 | ||
163 | return this._filterController; | 161 | return this._filterController; |
164 | }, | 162 | }, |
165 | 163 | ||
166 | 'cardsController': function() { | 164 | 'cardsController': function() { |
167 | if (this._cardsController == null) { | 165 | if (this._cardsController == null) { |
168 | this._cardsController = new Clipperz.PM.UI.Web.Controllers.CardsController({'filterController':this._filterController}); | 166 | this._cardsController = new Clipperz.PM.UI.Web.Controllers.CardsController({'filterController':this._filterController}); |
169 | } | 167 | } |
170 | 168 | ||
171 | return this._cardsController; | 169 | return this._cardsController; |
172 | }, | 170 | }, |
173 | 171 | ||
174 | //----------------------------------------------------------------------------- | 172 | //----------------------------------------------------------------------------- |
175 | /* | 173 | /* |
176 | 'directLoginsController': function() { | 174 | 'directLoginsController': function() { |
177 | //Clipperz.log(">>> AppController.directLoginsController"); | 175 | //Clipperz.log(">>> AppController.directLoginsController"); |
178 | if (this._directLoginsController == null) { | 176 | if (this._directLoginsController == null) { |
179 | this._directLoginsController = new Clipperz.PM.UI.Web.Controllers.DirectLoginsController({'filterController':this._filterController}); | 177 | this._directLoginsController = new Clipperz.PM.UI.Web.Controllers.DirectLoginsController({'filterController':this._filterController}); |
180 | } | 178 | } |
181 | //Clipperz.log("<<< AppController.directLoginsController"); | 179 | //Clipperz.log("<<< AppController.directLoginsController"); |
182 | 180 | ||
183 | return this._directLoginsController; | 181 | return this._directLoginsController; |
184 | }, | 182 | }, |
185 | */ | 183 | */ |
186 | //----------------------------------------------------------------------------- | 184 | //----------------------------------------------------------------------------- |
187 | 185 | ||
188 | 'populateUserInfo': function() { | 186 | 'populateUserInfo': function() { |
189 | var deferredResult; | 187 | var deferredResult; |
190 | 188 | ||
191 | deferredResult = new Clipperz.Async.Deferred("AppController.populateUserInfo", {trace:false}); | 189 | deferredResult = new Clipperz.Async.Deferred("AppController.populateUserInfo", {trace:false}); |
192 | deferredResult.collectResults({ | 190 | deferredResult.collectResults({ |
193 | 'username':MochiKit.Base.methodcaller('displayName'), | 191 | 'username':MochiKit.Base.methodcaller('displayName'), |
194 | 'cardsNumber':[ | 192 | 'cardsNumber':[ |
195 | MochiKit.Base.methodcaller('getRecords'), | 193 | MochiKit.Base.methodcaller('getRecords'), |
196 | function (someResults) { return someResults.length; } | 194 | function (someResults) { return someResults.length; } |
197 | ], | 195 | ], |
198 | 'directLoginsNumber': [ | 196 | 'directLoginsNumber': [ |
199 | MochiKit.Base.methodcaller('getDirectLogins'), | 197 | MochiKit.Base.methodcaller('getDirectLogins'), |
200 | function (someResults) { return someResults.length; } | 198 | function (someResults) { return someResults.length; } |
201 | ] | 199 | ] |
202 | }) | 200 | }) |
203 | deferredResult.addMethod(this.userInfoBox(), 'updateUserDetails'); | 201 | deferredResult.addMethod(this.userInfoBox(), 'updateUserDetails'); |
204 | deferredResult.callback(this.user()); | 202 | deferredResult.callback(this.user()); |
205 | 203 | ||
206 | return deferredResult; | 204 | return deferredResult; |
207 | }, | 205 | }, |
208 | 206 | ||
209 | //----------------------------------------------------------------------------- | 207 | //----------------------------------------------------------------------------- |
210 | 208 | ||
211 | 'run': function(args) { | 209 | 'run': function(args) { |
212 | var deferredResult; | 210 | var deferredResult; |
213 | varslot; | 211 | varslot; |
214 | varpage; | 212 | varpage; |
215 | var user; | 213 | var user; |
216 | 214 | ||
217 | slot = args.slot; | 215 | slot = args.slot; |
218 | user = args.user; | 216 | user = args.user; |
219 | 217 | ||
220 | this.setUser(user); | 218 | this.setUser(user); |
221 | 219 | ||
222 | slot.setContent(this.appPage()); | 220 | slot.setContent(this.appPage()); |
223 | 221 | ||
224 | this.appPage().slotNamed('userInfoBox').setContent(this.userInfoBox()); | 222 | this.appPage().slotNamed('userInfoBox').setContent(this.userInfoBox()); |
225 | this.appPage().slotNamed('tabSidePanel').setContent(this.tabSidePanel()); | 223 | this.appPage().slotNamed('tabSidePanel').setContent(this.tabSidePanel()); |
226 | 224 | ||
227 | this.appPage().slotNamed('accountPanel').setContent(this.accountPanel()); | 225 | this.appPage().slotNamed('accountPanel').setContent(this.accountPanel()); |
228 | this.appPage().slotNamed('dataPanel').setContent(this.dataPanel()); | 226 | this.appPage().slotNamed('dataPanel').setContent(this.dataPanel()); |
229 | this.appPage().slotNamed('toolsPanel').setContent(this.toolsPanel()); | 227 | this.appPage().slotNamed('toolsPanel').setContent(this.toolsPanel()); |
230 | 228 | ||
231 | this.hideAllAppPageTabSlots(); | 229 | this.hideAllAppPageTabSlots(); |
232 | this.appPage().showSlot(this.slotNameForTab('cards')); | 230 | this.appPage().showSlot(this.slotNameForTab('cards')); |
233 | 231 | ||
234 | MochiKit.Signal.connect(this.tabSidePanel(), 'tabSelected', this, 'handleTabSelected'); | 232 | MochiKit.Signal.connect(this.tabSidePanel(), 'tabSelected', this, 'handleTabSelected'); |
235 | MochiKit.Signal.connect(this.tabSidePanel(), 'addCard', this, 'handleAddCard'); | 233 | MochiKit.Signal.connect(this.tabSidePanel(), 'addCard', this, 'handleAddCard'); |
236 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'addCard', this, 'handleAddCard'); | 234 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'addCard', this, 'handleAddCard'); |
237 | 235 | ||
238 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'downloadOfflineCopy',this, 'handleDownloadOfflineCopy'); | 236 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'downloadOfflineCopy',this, 'handleDownloadOfflineCopy'); |
239 | 237 | ||
240 | deferredResult = new Clipperz.Async.Deferred("AppController.run", {trace:false}); | 238 | deferredResult = new Clipperz.Async.Deferred("AppController.run", {trace:false}); |
241 | 239 | ||
242 | deferredResult.addMethod(this.cardsController(), 'run', {slot:this.appPage().slotNamed('cardGrid'), user:user}); | 240 | deferredResult.addMethod(this.cardsController(), 'run', {slot:this.appPage().slotNamed('cardGrid'), user:user}); |
243 | // deferredResult.addMethod(this.directLoginsController(), 'run', {slot:this.appPage().slotNamed('directLoginGrid'), user:user}); | 241 | // deferredResult.addMethod(this.directLoginsController(), 'run', {slot:this.appPage().slotNamed('directLoginGrid'), user:user}); |
244 | deferredResult.addMethod(this, 'populateUserInfo'); | 242 | deferredResult.addMethod(this, 'populateUserInfo'); |
245 | 243 | ||
246 | deferredResult.addCallback(MochiKit.Visual.ScrollTo, 'miscLinks', {duration:0}); | 244 | deferredResult.addCallback(MochiKit.Visual.ScrollTo, 'miscLinks', {duration:0}); |
247 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN'); | 245 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN'); |
248 | deferredResult.addMethod(this.tabSidePanel(), 'selectTab', 'cards'); | 246 | deferredResult.addMethod(this.tabSidePanel(), 'selectTab', 'cards'); |
249 | deferredResult.callback(); | 247 | deferredResult.callback(); |
250 | }, | 248 | }, |
251 | 249 | ||
252 | //----------------------------------------------------------------------------- | 250 | //----------------------------------------------------------------------------- |
253 | 251 | ||
254 | 'handleTabSelected': function (selectedTabName) { | 252 | 'handleTabSelected': function (selectedTabName) { |
255 | var aTabName; | 253 | var aTabName; |
256 | var aSlotName; | 254 | var aSlotName; |
257 | 255 | ||
258 | //Clipperz.log(">>> AppController.handleTabSelected", selectedTabName); | 256 | //Clipperz.log(">>> AppController.handleTabSelected", selectedTabName); |
259 | this.hideAllAppPageTabSlots(); | 257 | this.hideAllAppPageTabSlots(); |
260 | this.appPage().showSlot(this.slotNameForTab(selectedTabName)); | 258 | this.appPage().showSlot(this.slotNameForTab(selectedTabName)); |
261 | 259 | ||
262 | switch (selectedTabName) { | 260 | switch (selectedTabName) { |
263 | case 'cards': | 261 | case 'cards': |
264 | this.cardsController().focus(); | 262 | this.cardsController().focus(); |
265 | break; | 263 | break; |
266 | // case 'directLogins': | 264 | // case 'directLogins': |
267 | // this.directLoginsController().focus(); | 265 | // this.directLoginsController().focus(); |
268 | // break; | 266 | // break; |
269 | case 'data': | 267 | case 'data': |
270 | break; | 268 | break; |
271 | case 'account': | 269 | case 'account': |
272 | break; | 270 | break; |
273 | case 'tools': | 271 | case 'tools': |
274 | break; | 272 | break; |
275 | } | 273 | } |
276 | //Clipperz.log("<-- AppController.handleTabSelected", aTabName); | 274 | //Clipperz.log("<-- AppController.handleTabSelected", aTabName); |
277 | }, | 275 | }, |
278 | 276 | ||
279 | //============================================================================= | 277 | //============================================================================= |
280 | 278 | ||
281 | 'handleAddCard': function (aSourceElement) { | 279 | 'handleAddCard': function (aSourceElement) { |
282 | //Clipperz.log("=== AppController.addCard", aSourceElement); | 280 | //Clipperz.log("=== AppController.addCard", aSourceElement); |
283 | this.cardsController().addCard(aSourceElement); | 281 | this.cardsController().addCard(aSourceElement); |
284 | }, | 282 | }, |
285 | 283 | ||
286 | //============================================================================= | 284 | //============================================================================= |
287 | 285 | ||
288 | 'userDataSuccessfullySavedHandler': function (anEvent) { | 286 | 'userDataSuccessfullySavedHandler': function (anEvent) { |
289 | this.populateUserInfo(); | 287 | this.populateUserInfo(); |
290 | }, | 288 | }, |
291 | 289 | ||
292 | //============================================================================= | 290 | //============================================================================= |
293 | 291 | ||
294 | 'handleLogout': function(anEvent) { | 292 | 'handleLogout': function(anEvent) { |
295 | var deferredResult; | 293 | var deferredResult; |
296 | 294 | ||
297 | deferredResult = new Clipperz.Async.Deferred("AppController.handleLogout", {trace:false}); | 295 | deferredResult = new Clipperz.Async.Deferred("AppController.handleLogout", {trace:false}); |
298 | deferredResult.addMethod(this.user(), 'logout'); | 296 | deferredResult.addMethod(this.user(), 'logout'); |
299 | deferredResult.addCallback(MochiKit.Signal.signal, this, 'logout'); | 297 | deferredResult.addCallback(MochiKit.Signal.signal, this, 'logout'); |
300 | deferredResult.callback(); | 298 | deferredResult.callback(); |
301 | 299 | ||
302 | return deferredResult; | 300 | return deferredResult; |
303 | }, | 301 | }, |
304 | 302 | ||
305 | //----------------------------------------------------------------------------- | 303 | //----------------------------------------------------------------------------- |
306 | 304 | ||
307 | 'handleLock': function (anEvent) { | 305 | 'handleLock': function (anEvent) { |
308 | return Clipperz.Async.callbacks("AppController.handleLock", [ | 306 | return Clipperz.Async.callbacks("AppController.handleLock", [ |
309 | MochiKit.Base.method(this.cardsController(), 'deleteAllCleanTextData'), | 307 | MochiKit.Base.method(this.cardsController(), 'deleteAllCleanTextData'), |
310 | MochiKit.Base.method(this.user(), 'lock') | 308 | MochiKit.Base.method(this.user(), 'lock') |
311 | ], {trace:false}); | 309 | ], {trace:false}); |
312 | }, | 310 | }, |
313 | 311 | ||
314 | //............................................................................. | 312 | //............................................................................. |
315 | 313 | ||
316 | 'handleUnlock': function (anEvent) { | 314 | 'handleUnlock': function (anEvent) { |
317 | return Clipperz.Async.callbacks("AppController.handleUnock", [ | 315 | return Clipperz.Async.callbacks("AppController.handleUnock", [ |
318 | MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress'), | 316 | MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress'), |
319 | MochiKit.Base.method(this.user(), 'login'), | 317 | MochiKit.Base.method(this.user(), 'login'), |
320 | MochiKit.Base.method(this.cardsController(), 'focus'), | 318 | MochiKit.Base.method(this.cardsController(), 'focus'), |
321 | MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'progressDone'), | 319 | MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'progressDone'), |
322 | MochiKit.Base.method(this.userInfoBox(), 'unlock') | 320 | MochiKit.Base.method(this.userInfoBox(), 'unlock') |
323 | ], {trace:false}); | 321 | ], {trace:false}); |
324 | }, | 322 | }, |
325 | 323 | ||
326 | 'handleDownloadOfflineCopy': function (anEvent) { | 324 | 'handleDownloadOfflineCopy': function (anEvent) { |
327 | console.log("AppController.handleDownloadOfflineCopy"); | ||
328 | var downloadHref; | 325 | var downloadHref; |
329 | 326 | ||
330 | downloadHref = window.location.href.replace(/\/[^\/]*$/,'') + Clipperz_dumpUrl; | 327 | downloadHref = window.location.href.replace(/\/[^\/]*$/,'') + Clipperz_dumpUrl; |
331 | 328 | ||
332 | if (Clipperz_IEisBroken == true) { | 329 | if (Clipperz_IEisBroken == true) { |
333 | window.open(downloadHref, ""); | 330 | window.open(downloadHref, ""); |
334 | } else { | 331 | } else { |
335 | vardeferredResult; | 332 | vardeferredResult; |
336 | var newWindow; | 333 | var newWindow; |
337 | 334 | ||
338 | newWindow = window.open("", ""); | 335 | newWindow = window.open("", ""); |
339 | 336 | ||
340 | deferredResult = new Clipperz.Async.Deferred("AppController.handleDownloadOfflineCopy", {trace:true}); | 337 | deferredResult = new Clipperz.Async.Deferred("AppController.handleDownloadOfflineCopy", {trace:true}); |
341 | deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'echo', {'echo':"echo"}); | 338 | deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'echo', {'echo':"echo"}); |
342 | deferredResult.addCallback(function(aWindow) { | 339 | deferredResult.addCallback(function(aWindow) { |
343 | aWindow.location.href = downloadHref; | 340 | aWindow.location.href = downloadHref; |
344 | }, newWindow); | 341 | }, newWindow); |
345 | deferredResult.callback(); | 342 | deferredResult.callback(); |
346 | } | 343 | } |
347 | }, | 344 | }, |
348 | 345 | ||
349 | //============================================================================= | 346 | //============================================================================= |
350 | __syntaxFix__: "syntax fix" | 347 | __syntaxFix__: "syntax fix" |
351 | }); | 348 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js index effde31..b1ff81f 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js | |||
@@ -1,569 +1,566 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.CardDialogController = function(args) { | 26 | Clipperz.PM.UI.Web.Controllers.CardDialogController = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Controllers.CardDialogController.superclass.constructor.call(this, args); | 29 | Clipperz.PM.UI.Web.Controllers.CardDialogController.superclass.constructor.call(this, args); |
32 | 30 | ||
33 | this._record = args.record || Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._record = args.record || Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._delegate = args.delegate || Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | this._delegate = args.delegate || Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | 33 | ||
36 | this._referenceElement = null; | 34 | this._referenceElement = null; |
37 | this._cardDialogComponent = null; | 35 | this._cardDialogComponent = null; |
38 | 36 | ||
39 | this._fieldsReferences = {}; | 37 | this._fieldsReferences = {}; |
40 | this._directLoginReferences = {}; | 38 | this._directLoginReferences = {}; |
41 | 39 | ||
42 | this._directLoginWizardController = null; | 40 | this._directLoginWizardController = null; |
43 | this._directLoginEditingComponent = null; | 41 | this._directLoginEditingComponent = null; |
44 | this._isDirectLoginEditingComponentVisible = false; | 42 | this._isDirectLoginEditingComponentVisible = false; |
45 | 43 | ||
46 | return this; | 44 | return this; |
47 | }; | 45 | }; |
48 | 46 | ||
49 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardDialogController, Object, { | 47 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardDialogController, Object, { |
50 | 48 | ||
51 | 'toString': function() { | 49 | 'toString': function() { |
52 | return "Clipperz.PM.UI.Web.Controllers.CardDialogController"; | 50 | return "Clipperz.PM.UI.Web.Controllers.CardDialogController"; |
53 | }, | 51 | }, |
54 | 52 | ||
55 | //------------------------------------------------------------------------- | 53 | //------------------------------------------------------------------------- |
56 | 54 | ||
57 | 'record': function () { | 55 | 'record': function () { |
58 | return this._record; | 56 | return this._record; |
59 | }, | 57 | }, |
60 | 58 | ||
61 | 'delegate': function () { | 59 | 'delegate': function () { |
62 | return this._delegate; | 60 | return this._delegate; |
63 | }, | 61 | }, |
64 | 62 | ||
65 | //------------------------------------------------------------------------- | 63 | //------------------------------------------------------------------------- |
66 | 64 | ||
67 | 'fieldsReferences': function () { | 65 | 'fieldsReferences': function () { |
68 | return this._fieldsReferences; | 66 | return this._fieldsReferences; |
69 | }, | 67 | }, |
70 | 68 | ||
71 | 'directLoginReferences': function () { | 69 | 'directLoginReferences': function () { |
72 | return this._directLoginReferences; | 70 | return this._directLoginReferences; |
73 | }, | 71 | }, |
74 | 72 | ||
75 | //------------------------------------------------------------------------- | 73 | //------------------------------------------------------------------------- |
76 | 74 | ||
77 | 'referenceElement': function () { | 75 | 'referenceElement': function () { |
78 | return this._referenceElement; | 76 | return this._referenceElement; |
79 | }, | 77 | }, |
80 | 78 | ||
81 | 'setReferenceElement': function (anElement) { | 79 | 'setReferenceElement': function (anElement) { |
82 | this._referenceElement = anElement; | 80 | this._referenceElement = anElement; |
83 | }, | 81 | }, |
84 | 82 | ||
85 | //------------------------------------------------------------------------- | 83 | //------------------------------------------------------------------------- |
86 | 84 | ||
87 | 'cardDialogComponent': function () { | 85 | 'cardDialogComponent': function () { |
88 | if (this._cardDialogComponent == null) { | 86 | if (this._cardDialogComponent == null) { |
89 | this._cardDialogComponent = new Clipperz.PM.UI.Web.Components.CardDialogComponent(); | 87 | this._cardDialogComponent = new Clipperz.PM.UI.Web.Components.CardDialogComponent(); |
90 | 88 | ||
91 | MochiKit.Signal.connect(this._cardDialogComponent, 'cancel', this, 'handleCancel'); | 89 | MochiKit.Signal.connect(this._cardDialogComponent, 'cancel', this, 'handleCancel'); |
92 | MochiKit.Signal.connect(this._cardDialogComponent, 'save', this, 'handleSave'); | 90 | MochiKit.Signal.connect(this._cardDialogComponent, 'save', this, 'handleSave'); |
93 | 91 | ||
94 | MochiKit.Signal.connect(this._cardDialogComponent, 'addField', this, 'handleAddField'); | 92 | MochiKit.Signal.connect(this._cardDialogComponent, 'addField', this, 'handleAddField'); |
95 | MochiKit.Signal.connect(this._cardDialogComponent, 'changedValue',this, 'handleChangedValue'); | 93 | MochiKit.Signal.connect(this._cardDialogComponent, 'changedValue',this, 'handleChangedValue'); |
96 | 94 | ||
97 | MochiKit.Signal.connect(this._cardDialogComponent, 'addDirectLogin',this, 'handleAddDirectLogin'); | 95 | MochiKit.Signal.connect(this._cardDialogComponent, 'addDirectLogin',this, 'handleAddDirectLogin'); |
98 | MochiKit.Signal.connect(this._cardDialogComponent, 'keyPressed',this, 'handleCardDialogComponentKeyPressed'); | 96 | MochiKit.Signal.connect(this._cardDialogComponent, 'keyPressed',this, 'handleCardDialogComponentKeyPressed'); |
99 | } | 97 | } |
100 | 98 | ||
101 | return this._cardDialogComponent; | 99 | return this._cardDialogComponent; |
102 | }, | 100 | }, |
103 | 101 | ||
104 | //========================================================================= | 102 | //========================================================================= |
105 | 103 | ||
106 | 'directLoginWizardController': function () { | 104 | 'directLoginWizardController': function () { |
107 | if (this._directLoginWizardController == null) { | 105 | if (this._directLoginWizardController == null) { |
108 | this._directLoginWizardController = new Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController({ | 106 | this._directLoginWizardController = new Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController({ |
109 | 'cardLabel': this.cardDialogComponent().title(), | 107 | 'cardLabel': this.cardDialogComponent().title(), |
110 | 'directLoginEditingComponent': this.directLoginEditingComponent() | 108 | 'directLoginEditingComponent': this.directLoginEditingComponent() |
111 | }) | 109 | }) |
112 | 110 | ||
113 | MochiKit.Signal.connect(this._directLoginWizardController, 'exit',this, 'handleHideDirectLoginEditingComponent'); | 111 | MochiKit.Signal.connect(this._directLoginWizardController, 'exit',this, 'handleHideDirectLoginEditingComponent'); |
114 | MochiKit.Signal.connect(this._directLoginWizardController, 'done',this, 'handleCompleteDirectLoginEditingComponent'); | 112 | MochiKit.Signal.connect(this._directLoginWizardController, 'done',this, 'handleCompleteDirectLoginEditingComponent'); |
115 | } | 113 | } |
116 | 114 | ||
117 | return this._directLoginWizardController; | 115 | return this._directLoginWizardController; |
118 | }, | 116 | }, |
119 | 117 | ||
120 | //------------------------------------------------------------------------- | 118 | //------------------------------------------------------------------------- |
121 | 119 | ||
122 | 'directLoginEditingComponent': function () { | 120 | 'directLoginEditingComponent': function () { |
123 | if (this._directLoginEditingComponent == null) { | 121 | if (this._directLoginEditingComponent == null) { |
124 | this._directLoginEditingComponent = new Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent(); | 122 | this._directLoginEditingComponent = new Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent(); |
125 | 123 | ||
126 | this.cardDialogComponent().renderDirectLoginEditingComponent(this._directLoginEditingComponent); | 124 | this.cardDialogComponent().renderDirectLoginEditingComponent(this._directLoginEditingComponent); |
127 | 125 | ||
128 | // MochiKit.Signal.connect(this._directLoginEditingComponent, 'back', this, 'handleHideDirectLoginEditingComponent') | 126 | // MochiKit.Signal.connect(this._directLoginEditingComponent, 'back', this, 'handleHideDirectLoginEditingComponent') |
129 | // MochiKit.Signal.connect(this._directLoginEditingComponent, 'changedValue',this, 'handleChangedValue'); | 127 | // MochiKit.Signal.connect(this._directLoginEditingComponent, 'changedValue',this, 'handleChangedValue'); |
130 | // MochiKit.Signal.connect(this.__directLoginEditingComponent, 'keyPressed',this, 'handleDirectLoginEditingComponentKeyPressed'); | 128 | // MochiKit.Signal.connect(this.__directLoginEditingComponent, 'keyPressed',this, 'handleDirectLoginEditingComponentKeyPressed'); |
131 | } | 129 | } |
132 | 130 | ||
133 | return this._directLoginEditingComponent; | 131 | return this._directLoginEditingComponent; |
134 | }, | 132 | }, |
135 | 133 | ||
136 | //------------------------------------------------------------------------- | 134 | //------------------------------------------------------------------------- |
137 | 135 | ||
138 | 'isDirectLoginEditingComponentVisible': function () { | 136 | 'isDirectLoginEditingComponentVisible': function () { |
139 | return this._isDirectLoginEditingComponentVisible; | 137 | return this._isDirectLoginEditingComponentVisible; |
140 | }, | 138 | }, |
141 | 139 | ||
142 | 'setIsDirectLoginEditingComponentVisible': function (aValue) { | 140 | 'setIsDirectLoginEditingComponentVisible': function (aValue) { |
143 | this._isDirectLoginEditingComponentVisible = aValue; | 141 | this._isDirectLoginEditingComponentVisible = aValue; |
144 | }, | 142 | }, |
145 | 143 | ||
146 | //========================================================================= | 144 | //========================================================================= |
147 | 145 | ||
148 | 'run': function (anElement) { | 146 | 'run': function (anElement) { |
149 | var deferredResult; | 147 | var deferredResult; |
150 | 148 | ||
151 | this.setReferenceElement(anElement); | 149 | this.setReferenceElement(anElement); |
152 | 150 | ||
153 | deferredResult = new Clipperz.Async.Deferred("CardDialogController.run", {trace:false}); | 151 | deferredResult = new Clipperz.Async.Deferred("CardDialogController.run", {trace:false}); |
154 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':11}); | 152 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':11}); |
155 | 153 | ||
156 | deferredResult.addMethod(this.cardDialogComponent(), 'deferredShowModal', {openFromElement:this.referenceElement()}); | 154 | deferredResult.addMethod(this.cardDialogComponent(), 'deferredShowModal', {openFromElement:this.referenceElement()}); |
157 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); | 155 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); |
158 | 156 | ||
159 | deferredResult.addMethod(this.record(), 'label'); | 157 | deferredResult.addMethod(this.record(), 'label'); |
160 | deferredResult.addMethod(this.cardDialogComponent(), 'setTitle'); | 158 | deferredResult.addMethod(this.cardDialogComponent(), 'setTitle'); |
161 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); | 159 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); |
162 | 160 | ||
163 | deferredResult.addMethod(this, 'updateComponentState'); | 161 | deferredResult.addMethod(this, 'updateComponentState'); |
164 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); | 162 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress'); |
165 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'progressDone'); | 163 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'progressDone'); |
166 | 164 | ||
167 | deferredResult.addMethod(this.cardDialogComponent(), 'fixRendering'); | 165 | deferredResult.addMethod(this.cardDialogComponent(), 'fixRendering'); |
168 | deferredResult.addMethod(this.cardDialogComponent(), 'hideProgressMask'); | 166 | deferredResult.addMethod(this.cardDialogComponent(), 'hideProgressMask'); |
169 | 167 | ||
170 | if (this.record().isBrandNew()) { | 168 | if (this.record().isBrandNew()) { |
171 | deferredResult.addMethod(this.cardDialogComponent(), 'setHintMode', 'ON'); | 169 | deferredResult.addMethod(this.cardDialogComponent(), 'setHintMode', 'ON'); |
172 | deferredResult.addMethod(this.cardDialogComponent(), 'setFocusOnTitleField'); | 170 | deferredResult.addMethod(this.cardDialogComponent(), 'setFocusOnTitleField'); |
173 | } | 171 | } |
174 | 172 | ||
175 | deferredResult.addErrback(MochiKit.Base.method(this.cardDialogComponent(), 'showError')); | 173 | deferredResult.addErrback(MochiKit.Base.method(this.cardDialogComponent(), 'showError')); |
176 | deferredResult.callback(); | 174 | deferredResult.callback(); |
177 | 175 | ||
178 | return deferredResult; | 176 | return deferredResult; |
179 | }, | 177 | }, |
180 | 178 | ||
181 | //========================================================================= | 179 | //========================================================================= |
182 | 180 | ||
183 | 'updateComponentState': function () { | 181 | 'updateComponentState': function () { |
184 | return Clipperz.Async.callbacks("CardDialogController.updateComponentState", [ | 182 | return Clipperz.Async.callbacks("CardDialogController.updateComponentState", [ |
185 | MochiKit.Base.method(this.record(), 'hasPendingChanges'), | 183 | MochiKit.Base.method(this.record(), 'hasPendingChanges'), |
186 | MochiKit.Base.method(this.cardDialogComponent(), 'setShouldEnableSaving'), | 184 | MochiKit.Base.method(this.cardDialogComponent(), 'setShouldEnableSaving'), |
187 | 185 | ||
188 | MochiKit.Base.method(this.record(), 'label'), | 186 | MochiKit.Base.method(this.record(), 'label'), |
189 | MochiKit.Base.method(this.cardDialogComponent(), 'setTitle'), | 187 | MochiKit.Base.method(this.cardDialogComponent(), 'setTitle'), |
190 | MochiKit.Base.method(this.record(), 'notes'), | 188 | MochiKit.Base.method(this.record(), 'notes'), |
191 | MochiKit.Base.method(this.cardDialogComponent(), 'setNotes'), | 189 | MochiKit.Base.method(this.cardDialogComponent(), 'setNotes'), |
192 | 190 | ||
193 | MochiKit.Base.method(this.record(), 'fields'), | 191 | MochiKit.Base.method(this.record(), 'fields'), |
194 | MochiKit.Base.values, | 192 | MochiKit.Base.values, |
195 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'addCardDialogComponentWithField')), | 193 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'addCardDialogComponentWithField')), |
196 | 194 | ||
197 | MochiKit.Base.method(this.record(), 'directLogins'), | 195 | MochiKit.Base.method(this.record(), 'directLogins'), |
198 | MochiKit.Base.values, | 196 | MochiKit.Base.values, |
199 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'addCardDialogComponentWithDirectLogin')), | 197 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'addCardDialogComponentWithDirectLogin')), |
200 | 198 | ||
201 | MochiKit.Base.method(this.cardDialogComponent(), 'resetNewFieldInputs'), | 199 | MochiKit.Base.method(this.cardDialogComponent(), 'resetNewFieldInputs'), |
202 | MochiKit.Base.noop | 200 | MochiKit.Base.noop |
203 | ], {trace:false}); | 201 | ], {trace:false}); |
204 | }, | 202 | }, |
205 | 203 | ||
206 | //------------------------------------------------------------------------- | 204 | //------------------------------------------------------------------------- |
207 | 205 | ||
208 | 'addCardDialogComponentWithField': function (aField) { | 206 | 'addCardDialogComponentWithField': function (aField) { |
209 | varfieldComponent; | 207 | varfieldComponent; |
210 | 208 | ||
211 | fieldComponent = new Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent({reference: aField.reference()}); | 209 | fieldComponent = new Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent({reference: aField.reference()}); |
212 | MochiKit.Signal.connect(fieldComponent, 'changedValue',this, 'handleChangedValue'); | 210 | MochiKit.Signal.connect(fieldComponent, 'changedValue',this, 'handleChangedValue'); |
213 | MochiKit.Signal.connect(fieldComponent, 'performAction',this, 'handlePerformFieldAction'); | 211 | MochiKit.Signal.connect(fieldComponent, 'performAction',this, 'handlePerformFieldAction'); |
214 | MochiKit.Signal.connect(fieldComponent, 'deleteField',this, 'handleDeleteField'); | 212 | MochiKit.Signal.connect(fieldComponent, 'deleteField',this, 'handleDeleteField'); |
215 | 213 | ||
216 | // this.fieldsReferences().push({'field':aField, 'component':fieldComponent}); | 214 | // this.fieldsReferences().push({'field':aField, 'component':fieldComponent}); |
217 | this.fieldsReferences()[aField.reference()] = {'field':aField, 'component':fieldComponent}; | 215 | this.fieldsReferences()[aField.reference()] = {'field':aField, 'component':fieldComponent}; |
218 | 216 | ||
219 | return Clipperz.Async.callbacks("CardDialogController.addCardDialogComponentWithField", [ | 217 | return Clipperz.Async.callbacks("CardDialogController.addCardDialogComponentWithField", [ |
220 | MochiKit.Base.method(this.cardDialogComponent(), 'addFieldRowComponent', fieldComponent), | 218 | MochiKit.Base.method(this.cardDialogComponent(), 'addFieldRowComponent', fieldComponent), |
221 | 219 | ||
222 | MochiKit.Base.method(aField, 'label'), | 220 | MochiKit.Base.method(aField, 'label'), |
223 | MochiKit.Base.method(fieldComponent, 'setLabel'), | 221 | MochiKit.Base.method(fieldComponent, 'setLabel'), |
224 | MochiKit.Base.method(aField, 'value'), | 222 | MochiKit.Base.method(aField, 'value'), |
225 | MochiKit.Base.method(fieldComponent, 'setValue'), | 223 | MochiKit.Base.method(fieldComponent, 'setValue'), |
226 | MochiKit.Base.method(aField, 'actionType'), | 224 | MochiKit.Base.method(aField, 'actionType'), |
227 | MochiKit.Base.method(fieldComponent, 'setActionType'), | 225 | MochiKit.Base.method(fieldComponent, 'setActionType'), |
228 | MochiKit.Base.method(aField, 'isHidden'), | 226 | MochiKit.Base.method(aField, 'isHidden'), |
229 | MochiKit.Base.method(fieldComponent, 'setIsHidden') | 227 | MochiKit.Base.method(fieldComponent, 'setIsHidden') |
230 | ], {trace:false}); | 228 | ], {trace:false}); |
231 | }, | 229 | }, |
232 | 230 | ||
233 | //------------------------------------------------------------------------- | 231 | //------------------------------------------------------------------------- |
234 | 232 | ||
235 | 'addCardDialogComponentWithDirectLogin': function (aDirectLogin) { | 233 | 'addCardDialogComponentWithDirectLogin': function (aDirectLogin) { |
236 | var directLoginComponent; | 234 | var directLoginComponent; |
237 | 235 | ||
238 | directLoginComponent = new Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginComponent({reference: aDirectLogin.reference()}); | 236 | directLoginComponent = new Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginComponent({reference: aDirectLogin.reference()}); |
239 | MochiKit.Signal.connect(directLoginComponent, 'changedValue', this, 'handleChangedValue'); | 237 | MochiKit.Signal.connect(directLoginComponent, 'changedValue', this, 'handleChangedValue'); |
240 | MochiKit.Signal.connect(directLoginComponent, 'deleteDirectLogin',this, 'handleDeleteDirectLogin'); | 238 | MochiKit.Signal.connect(directLoginComponent, 'deleteDirectLogin',this, 'handleDeleteDirectLogin'); |
241 | MochiKit.Signal.connect(directLoginComponent, 'editDirectLogin',this, 'handleEditDirectLogin'); | 239 | MochiKit.Signal.connect(directLoginComponent, 'editDirectLogin',this, 'handleEditDirectLogin'); |
242 | MochiKit.Signal.connect(directLoginComponent, 'openDirectLogin',this, 'handleOpenDirectLogin'); | 240 | MochiKit.Signal.connect(directLoginComponent, 'openDirectLogin',this, 'handleOpenDirectLogin'); |
243 | 241 | ||
244 | this.directLoginReferences()[aDirectLogin.reference()] = {'directLogin':aDirectLogin, 'component':directLoginComponent}; | 242 | this.directLoginReferences()[aDirectLogin.reference()] = {'directLogin':aDirectLogin, 'component':directLoginComponent}; |
245 | 243 | ||
246 | return Clipperz.Async.callbacks("CardDialogController.addCardDialogComponentWithDirectLogin", [ | 244 | return Clipperz.Async.callbacks("CardDialogController.addCardDialogComponentWithDirectLogin", [ |
247 | MochiKit.Base.method(this.cardDialogComponent(), 'addDirectLoginComponent', directLoginComponent), | 245 | MochiKit.Base.method(this.cardDialogComponent(), 'addDirectLoginComponent', directLoginComponent), |
248 | MochiKit.Base.method(this, 'refreshDirectLoginComponent', this.directLoginReferences()[aDirectLogin.reference()]) | 246 | MochiKit.Base.method(this, 'refreshDirectLoginComponent', this.directLoginReferences()[aDirectLogin.reference()]) |
249 | ], {trace:false}); | 247 | ], {trace:false}); |
250 | }, | 248 | }, |
251 | 249 | ||
252 | //------------------------------------------------------------------------- | 250 | //------------------------------------------------------------------------- |
253 | 251 | ||
254 | 'refreshDirectLoginComponent': function (aDirectLoginReference) { | 252 | 'refreshDirectLoginComponent': function (aDirectLoginReference) { |
255 | return Clipperz.Async.callbacks("CardDialogController.refreshDirectLoginComponent", [ | 253 | return Clipperz.Async.callbacks("CardDialogController.refreshDirectLoginComponent", [ |
256 | MochiKit.Base.method(aDirectLoginReference['directLogin'],'favicon'), | 254 | MochiKit.Base.method(aDirectLoginReference['directLogin'],'favicon'), |
257 | // MochiKit.Base.method(aDirectLoginReference['directLogin'],'faviconData'), | 255 | // MochiKit.Base.method(aDirectLoginReference['directLogin'],'faviconData'), |
258 | MochiKit.Base.method(aDirectLoginReference['component'],'setFavicon'), | 256 | MochiKit.Base.method(aDirectLoginReference['component'],'setFavicon'), |
259 | MochiKit.Base.method(aDirectLoginReference['directLogin'],'label'), | 257 | MochiKit.Base.method(aDirectLoginReference['directLogin'],'label'), |
260 | MochiKit.Base.method(aDirectLoginReference['component'],'setLabel') | 258 | MochiKit.Base.method(aDirectLoginReference['component'],'setLabel') |
261 | ], {trace:false}); | 259 | ], {trace:false}); |
262 | }, | 260 | }, |
263 | 261 | ||
264 | 'refreshDirectLoginComponents': function () { | 262 | 'refreshDirectLoginComponents': function () { |
265 | return Clipperz.Async.callbacks("CardDialogController.refreshDirectLoginComponents", [ | 263 | return Clipperz.Async.callbacks("CardDialogController.refreshDirectLoginComponents", [ |
266 | MochiKit.Base.method(this, 'directLoginReferences'), | 264 | MochiKit.Base.method(this, 'directLoginReferences'), |
267 | MochiKit.Base.values, | 265 | MochiKit.Base.values, |
268 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'refreshDirectLoginComponent')), | 266 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'refreshDirectLoginComponent')), |
269 | Clipperz.Async.collectAll | 267 | Clipperz.Async.collectAll |
270 | ]) | 268 | ]) |
271 | }, | 269 | }, |
272 | 270 | ||
273 | //------------------------------------------------------------------------- | 271 | //------------------------------------------------------------------------- |
274 | 272 | ||
275 | 'updateRecordValues': function () { | 273 | 'updateRecordValues': function () { |
276 | return Clipperz.Async.callbacks('CardDialogController.updateRecordValues', [ | 274 | return Clipperz.Async.callbacks('CardDialogController.updateRecordValues', [ |
277 | MochiKit.Base.method(this.cardDialogComponent(), 'title'), | 275 | MochiKit.Base.method(this.cardDialogComponent(), 'title'), |
278 | MochiKit.Base.method(this.record(), 'setLabel'), | 276 | MochiKit.Base.method(this.record(), 'setLabel'), |
279 | MochiKit.Base.method(this.cardDialogComponent(), 'notes'), | 277 | MochiKit.Base.method(this.cardDialogComponent(), 'notes'), |
280 | MochiKit.Base.method(this.record(), 'setNotes'), | 278 | MochiKit.Base.method(this.record(), 'setNotes'), |
281 | 279 | ||
282 | MochiKit.Base.method(this, 'fieldsReferences'), | 280 | MochiKit.Base.method(this, 'fieldsReferences'), |
283 | MochiKit.Base.values, | 281 | MochiKit.Base.values, |
284 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'updateRecordFieldValues')), | 282 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'updateRecordFieldValues')), |
285 | 283 | ||
286 | MochiKit.Base.method(this, 'directLoginReferences'), | 284 | MochiKit.Base.method(this, 'directLoginReferences'), |
287 | MochiKit.Base.values, | 285 | MochiKit.Base.values, |
288 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'updateRecordDirectLoginValues')), | 286 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'updateRecordDirectLoginValues')), |
289 | 287 | ||
290 | MochiKit.Base.method(this.directLoginEditingComponent(), 'directLoginReference'), | 288 | MochiKit.Base.method(this.directLoginEditingComponent(), 'directLoginReference'), |
291 | MochiKit.Base.method(this.record(), 'directLoginWithReference'), | 289 | MochiKit.Base.method(this.record(), 'directLoginWithReference'), |
292 | MochiKit.Base.method(this, 'updateRecordDirectLoginDetails'), | 290 | MochiKit.Base.method(this, 'updateRecordDirectLoginDetails'), |
293 | 291 | ||
294 | MochiKit.Base.noop | 292 | MochiKit.Base.noop |
295 | ], {trace:false}); | 293 | ], {trace:false}); |
296 | }, | 294 | }, |
297 | 295 | ||
298 | //------------------------------------------------------------------------- | 296 | //------------------------------------------------------------------------- |
299 | 297 | ||
300 | 'updateRecordFieldValues': function (aFieldReference) { | 298 | 'updateRecordFieldValues': function (aFieldReference) { |
301 | var deferredResult; | 299 | var deferredResult; |
302 | 300 | ||
303 | deferredResult = Clipperz.Async.callbacks('CardDialogController.updateRecordFieldValues', [ | 301 | deferredResult = Clipperz.Async.callbacks('CardDialogController.updateRecordFieldValues', [ |
304 | MochiKit.Base.method(aFieldReference['component'],'label'), | 302 | MochiKit.Base.method(aFieldReference['component'],'label'), |
305 | MochiKit.Base.method(aFieldReference['field'], 'setLabel'), | 303 | MochiKit.Base.method(aFieldReference['field'], 'setLabel'), |
306 | 304 | ||
307 | MochiKit.Base.method(aFieldReference['component'],'value'), | 305 | MochiKit.Base.method(aFieldReference['component'],'value'), |
308 | MochiKit.Base.method(aFieldReference['field'], 'setValue'), | 306 | MochiKit.Base.method(aFieldReference['field'], 'setValue'), |
309 | 307 | ||
310 | MochiKit.Base.method(aFieldReference['component'],'isHidden'), | 308 | MochiKit.Base.method(aFieldReference['component'],'isHidden'), |
311 | MochiKit.Base.method(aFieldReference['field'], 'setIsHidden'), | 309 | MochiKit.Base.method(aFieldReference['field'], 'setIsHidden'), |
312 | 310 | ||
313 | MochiKit.Base.method(aFieldReference['field'], 'actionType'), | 311 | MochiKit.Base.method(aFieldReference['field'], 'actionType'), |
314 | MochiKit.Base.method(aFieldReference['component'],'setActionType') | 312 | MochiKit.Base.method(aFieldReference['component'],'setActionType') |
315 | ], {trace:false}); | 313 | ], {trace:false}); |
316 | 314 | ||
317 | return deferredResult; | 315 | return deferredResult; |
318 | }, | 316 | }, |
319 | 317 | ||
320 | //------------------------------------------------------------------------- | 318 | //------------------------------------------------------------------------- |
321 | 319 | ||
322 | 'updateRecordDirectLoginValues': function (aDirectLoginReference) { | 320 | 'updateRecordDirectLoginValues': function (aDirectLoginReference) { |
323 | var deferredResult; | 321 | var deferredResult; |
324 | 322 | ||
325 | deferredResult = Clipperz.Async.callbacks('CardDialogController.updateRecordDirectLoginValues', [ | 323 | deferredResult = Clipperz.Async.callbacks('CardDialogController.updateRecordDirectLoginValues', [ |
326 | MochiKit.Base.method(aDirectLoginReference['component'], 'label'), | 324 | MochiKit.Base.method(aDirectLoginReference['component'], 'label'), |
327 | MochiKit.Base.method(aDirectLoginReference['directLogin'], 'setLabel') | 325 | MochiKit.Base.method(aDirectLoginReference['directLogin'], 'setLabel') |
328 | ], {trace:false}); | 326 | ], {trace:false}); |
329 | 327 | ||
330 | return deferredResult; | 328 | return deferredResult; |
331 | }, | 329 | }, |
332 | 330 | ||
333 | //------------------------------------------------------------------------- | 331 | //------------------------------------------------------------------------- |
334 | 332 | ||
335 | 'updateRecordDirectLoginDetails': function (aDirectLogin) { | 333 | 'updateRecordDirectLoginDetails': function (aDirectLogin) { |
336 | var result; | 334 | var result; |
337 | 335 | ||
338 | if (MochiKit.Base.isUndefinedOrNull(aDirectLogin)) { | 336 | if (MochiKit.Base.isUndefinedOrNull(aDirectLogin)) { |
339 | result = MochiKit.Async.succeed(); | 337 | result = MochiKit.Async.succeed(); |
340 | } else { | 338 | } else { |
341 | result = Clipperz.Async.callbacks("CardDialogController.updateRecordDirectLoginDetails", [ | 339 | result = Clipperz.Async.callbacks("CardDialogController.updateRecordDirectLoginDetails", [ |
342 | MochiKit.Base.method(this.directLoginEditingComponent(), 'label'), | 340 | MochiKit.Base.method(this.directLoginEditingComponent(), 'label'), |
343 | MochiKit.Base.method(aDirectLogin, 'setLabel'), | 341 | MochiKit.Base.method(aDirectLogin, 'setLabel'), |
344 | MochiKit.Base.method(this.directLoginEditingComponent(), 'favicon'), | 342 | MochiKit.Base.method(this.directLoginEditingComponent(), 'favicon'), |
345 | MochiKit.Base.method(aDirectLogin, 'setFavicon') | 343 | MochiKit.Base.method(aDirectLogin, 'setFavicon') |
346 | ], {trace:false}); | 344 | ], {trace:false}); |
347 | } | 345 | } |
348 | 346 | ||
349 | return result; | 347 | return result; |
350 | }, | 348 | }, |
351 | 349 | ||
352 | //========================================================================= | 350 | //========================================================================= |
353 | 351 | ||
354 | 'addField': function () { | 352 | 'addField': function () { |
355 | return this.record().addField({ | 353 | return this.record().addField({ |
356 | 'label':this.cardDialogComponent().newFieldLabel(), | 354 | 'label':this.cardDialogComponent().newFieldLabel(), |
357 | 'value':this.cardDialogComponent().newFieldValue(), | 355 | 'value':this.cardDialogComponent().newFieldValue(), |
358 | 'isHidden':this.cardDialogComponent().newFieldIsHidden() | 356 | 'isHidden':this.cardDialogComponent().newFieldIsHidden() |
359 | }); | 357 | }); |
360 | }, | 358 | }, |
361 | 359 | ||
362 | 'handleAddField': function () { | 360 | 'handleAddField': function () { |
363 | return Clipperz.Async.callbacks("CardDialogController.handleAddField", [ | 361 | return Clipperz.Async.callbacks("CardDialogController.handleAddField", [ |
364 | MochiKit.Base.method(this, 'addField'), | 362 | MochiKit.Base.method(this, 'addField'), |
365 | 363 | ||
366 | MochiKit.Base.method(this, 'addCardDialogComponentWithField'), | 364 | MochiKit.Base.method(this, 'addCardDialogComponentWithField'), |
367 | MochiKit.Base.method(this.cardDialogComponent(), 'resetNewFieldInputs'), | 365 | MochiKit.Base.method(this.cardDialogComponent(), 'resetNewFieldInputs'), |
368 | 366 | ||
369 | MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'), | 367 | MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'), |
370 | MochiKit.Base.method(this, 'handleChangedValue') | 368 | MochiKit.Base.method(this, 'handleChangedValue') |
371 | ], {trace:false}) | 369 | ], {trace:false}) |
372 | }, | 370 | }, |
373 | 371 | ||
374 | //------------------------------------------------------------------------- | 372 | //------------------------------------------------------------------------- |
375 | 373 | ||
376 | 'handlePerformFieldAction': function (aFieldID, aTargetElement) { | 374 | 'handlePerformFieldAction': function (aFieldID, aTargetElement) { |
377 | //console.log("### targetElement", aTargetElement); | ||
378 | return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [ | 375 | return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [ |
379 | MochiKit.Base.method(this.record(), 'fields'), | 376 | MochiKit.Base.method(this.record(), 'fields'), |
380 | MochiKit.Base.itemgetter(aFieldID), | 377 | MochiKit.Base.itemgetter(aFieldID), |
381 | Clipperz.Async.collectResults("CardDialogController.handleDeleteField <collect results>", { | 378 | Clipperz.Async.collectResults("CardDialogController.handleDeleteField <collect results>", { |
382 | 'value':MochiKit.Base.methodcaller('value'), | 379 | 'value':MochiKit.Base.methodcaller('value'), |
383 | 'type': MochiKit.Base.methodcaller('actionType') | 380 | 'type': MochiKit.Base.methodcaller('actionType') |
384 | }, {trace:false}), | 381 | }, {trace:false}), |
385 | MochiKit.Base.bind(function (someValues) { | 382 | MochiKit.Base.bind(function (someValues) { |
386 | switch (someValues['type']) { | 383 | switch (someValues['type']) { |
387 | case 'NONE': | 384 | case 'NONE': |
388 | throw "this event handler should not be triggered for fields with type 'NONE'"; | 385 | throw "this event handler should not be triggered for fields with type 'NONE'"; |
389 | break; | 386 | break; |
390 | case 'URL': | 387 | case 'URL': |
391 | var url; | 388 | var url; |
392 | 389 | ||
393 | url = someValues['value']; | 390 | url = someValues['value']; |
394 | if (/^https?\:\/\//.test(url) == false) { | 391 | if (/^https?\:\/\//.test(url) == false) { |
395 | url = 'http://' + url; | 392 | url = 'http://' + url; |
396 | } | 393 | } |
397 | 394 | ||
398 | window.open(url); | 395 | window.open(url); |
399 | break; | 396 | break; |
400 | case 'EMAIL': | 397 | case 'EMAIL': |
401 | var url; | 398 | var url; |
402 | 399 | ||
403 | url = 'mailto:' + someValues['value']; | 400 | url = 'mailto:' + someValues['value']; |
404 | 401 | ||
405 | MochiKit.DOM.currentWindow().location = url; | 402 | MochiKit.DOM.currentWindow().location = url; |
406 | break; | 403 | break; |
407 | case 'PASSWORD': | 404 | case 'PASSWORD': |
408 | //Clipperz.log("SHOW PASSWORD " + someValues['value']); | 405 | //Clipperz.log("SHOW PASSWORD " + someValues['value']); |
409 | this.showPasswordTooltip(someValues['value'], aTargetElement); | 406 | this.showPasswordTooltip(someValues['value'], aTargetElement); |
410 | break; | 407 | break; |
411 | } | 408 | } |
412 | }, this) | 409 | }, this) |
413 | ], {trace:false}); | 410 | ], {trace:false}); |
414 | }, | 411 | }, |
415 | 412 | ||
416 | //------------------------------------------------------------------------- | 413 | //------------------------------------------------------------------------- |
417 | 414 | ||
418 | 'handleDeleteField': function (aFieldID) { | 415 | 'handleDeleteField': function (aFieldID) { |
419 | return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [ | 416 | return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [ |
420 | MochiKit.Base.method(this.record(), 'fields'), | 417 | MochiKit.Base.method(this.record(), 'fields'), |
421 | MochiKit.Base.itemgetter(aFieldID), | 418 | MochiKit.Base.itemgetter(aFieldID), |
422 | MochiKit.Base.method(this.record(), 'removeField'), | 419 | MochiKit.Base.method(this.record(), 'removeField'), |
423 | 420 | ||
424 | MochiKit.Base.method(this, 'fieldsReferences'), | 421 | MochiKit.Base.method(this, 'fieldsReferences'), |
425 | MochiKit.Base.itemgetter(aFieldID), | 422 | MochiKit.Base.itemgetter(aFieldID), |
426 | MochiKit.Base.itemgetter('component'), | 423 | MochiKit.Base.itemgetter('component'), |
427 | 424 | ||
428 | function (aComponent) { | 425 | function (aComponent) { |
429 | return Clipperz.Async.callbacks("CardDialogController.handleDeleteField [fade and remove]", [ | 426 | return Clipperz.Async.callbacks("CardDialogController.handleDeleteField [fade and remove]", [ |
430 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimation, MochiKit.Visual.fade, aComponent.element(), {from:1.0, to:0.0, duration:0.5}), | 427 | MochiKit.Base.partial(Clipperz.Visual.deferredAnimation, MochiKit.Visual.fade, aComponent.element(), {from:1.0, to:0.0, duration:0.5}), |
431 | // Clipperz.Visual.deferredAnimation(MochiKit.Visual.fade, aComponent.element(), {from:1.0, to:0.0, duration:0.5}), | 428 | // Clipperz.Visual.deferredAnimation(MochiKit.Visual.fade, aComponent.element(), {from:1.0, to:0.0, duration:0.5}), |
432 | MochiKit.Base.method(aComponent, 'remove') | 429 | MochiKit.Base.method(aComponent, 'remove') |
433 | ], {trace:false}); | 430 | ], {trace:false}); |
434 | }, | 431 | }, |
435 | 432 | ||
436 | MochiKit.Base.bind(function () { | 433 | MochiKit.Base.bind(function () { |
437 | delete this.fieldsReferences()[aFieldID]; | 434 | delete this.fieldsReferences()[aFieldID]; |
438 | }, this), | 435 | }, this), |
439 | 436 | ||
440 | MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'), | 437 | MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'), |
441 | MochiKit.Base.method(this, 'handleChangedValue') | 438 | MochiKit.Base.method(this, 'handleChangedValue') |
442 | ], {trace:false}); | 439 | ], {trace:false}); |
443 | }, | 440 | }, |
444 | 441 | ||
445 | //========================================================================= | 442 | //========================================================================= |
446 | 443 | ||
447 | 'handleDeleteDirectLogin': function(aDirectLoginReference) { | 444 | 'handleDeleteDirectLogin': function(aDirectLoginReference) { |
448 | var cardDialogComponent; | 445 | var cardDialogComponent; |
449 | 446 | ||
450 | cardDialogComponent = this.cardDialogComponent(); | 447 | cardDialogComponent = this.cardDialogComponent(); |
451 | 448 | ||
452 | return Clipperz.Async.callbacks("CardDialogController.handleDeleteDirectLogin", [ | 449 | return Clipperz.Async.callbacks("CardDialogController.handleDeleteDirectLogin", [ |
453 | MochiKit.Base.method(this.record(), 'directLogins'), | 450 | MochiKit.Base.method(this.record(), 'directLogins'), |
454 | MochiKit.Base.itemgetter(aDirectLoginReference), | 451 | MochiKit.Base.itemgetter(aDirectLoginReference), |
455 | MochiKit.Base.methodcaller('remove'), | 452 | MochiKit.Base.methodcaller('remove'), |
456 | 453 | ||
457 | MochiKit.Base.method(this, 'directLoginReferences'), | 454 | MochiKit.Base.method(this, 'directLoginReferences'), |
458 | MochiKit.Base.itemgetter(aDirectLoginReference), | 455 | MochiKit.Base.itemgetter(aDirectLoginReference), |
459 | MochiKit.Base.itemgetter('component'), | 456 | MochiKit.Base.itemgetter('component'), |
460 | 457 | ||
461 | function (aComponent) { | 458 | function (aComponent) { |
462 | return Clipperz.Async.callbacks("CardDialogController.handleDeleteDirectLogin [fade and remove]", [ | 459 | return Clipperz.Async.callbacks("CardDialogController.handleDeleteDirectLogin [fade and remove]", [ |
463 | 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}), | 460 | 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}), |
464 | /// MochiKit.Base.method(aComponent, 'remove') | 461 | /// MochiKit.Base.method(aComponent, 'remove') |
465 | MochiKit.Base.method(cardDialogComponent, 'removeDirectLoginComponent', aComponent) | 462 | MochiKit.Base.method(cardDialogComponent, 'removeDirectLoginComponent', aComponent) |
466 | ], {trace:false}); | 463 | ], {trace:false}); |
467 | }, | 464 | }, |
468 | 465 | ||
469 | MochiKit.Base.bind(function () { | 466 | MochiKit.Base.bind(function () { |
470 | delete this.directLoginReferences()[aDirectLoginReference]; | 467 | delete this.directLoginReferences()[aDirectLoginReference]; |
471 | }, this), | 468 | }, this), |
472 | 469 | ||
473 | MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'), | 470 | MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'), |
474 | MochiKit.Base.method(this, 'handleChangedValue') | 471 | MochiKit.Base.method(this, 'handleChangedValue') |
475 | ], {trace:false}); | 472 | ], {trace:false}); |
476 | }, | 473 | }, |
477 | 474 | ||
478 | //------------------------------------------------------------------------- | 475 | //------------------------------------------------------------------------- |
479 | 476 | ||
480 | 'handleOpenDirectLogin': function (aDirectLoginReference) { | 477 | 'handleOpenDirectLogin': function (aDirectLoginReference) { |
481 | return Clipperz.Async.callbacks("CardDialogController.handleOpenDirectLogin", [ | 478 | return Clipperz.Async.callbacks("CardDialogController.handleOpenDirectLogin", [ |
482 | MochiKit.Base.method(this.record(), 'directLoginWithReference', aDirectLoginReference), | 479 | MochiKit.Base.method(this.record(), 'directLoginWithReference', aDirectLoginReference), |
483 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.openDirectLogin | 480 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.openDirectLogin |
484 | ], {trace:false}); | 481 | ], {trace:false}); |
485 | }, | 482 | }, |
486 | 483 | ||
487 | //------------------------------------------------------------------------- | 484 | //------------------------------------------------------------------------- |
488 | 485 | ||
489 | 'handleEditDirectLogin': function (aDirectLoginReference) { | 486 | 'handleEditDirectLogin': function (aDirectLoginReference) { |
490 | return Clipperz.Async.callbacks("CardDialogController.handleEditDirectLogin", [ | 487 | return Clipperz.Async.callbacks("CardDialogController.handleEditDirectLogin", [ |
491 | MochiKit.Base.method(this, 'setIsDirectLoginEditingComponentVisible', true), | 488 | MochiKit.Base.method(this, 'setIsDirectLoginEditingComponentVisible', true), |
492 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginReference', aDirectLoginReference), | 489 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginReference', aDirectLoginReference), |
493 | MochiKit.Base.method(this.cardDialogComponent(), 'placeDirectLoginEditingComponent'), | 490 | MochiKit.Base.method(this.cardDialogComponent(), 'placeDirectLoginEditingComponent'), |
494 | MochiKit.Base.method(this.record(), 'directLoginWithReference', aDirectLoginReference), | 491 | MochiKit.Base.method(this.record(), 'directLoginWithReference', aDirectLoginReference), |
495 | MochiKit.Base.method(this.directLoginWizardController(), 'runWithDirectLogin'), | 492 | MochiKit.Base.method(this.directLoginWizardController(), 'runWithDirectLogin'), |
496 | MochiKit.Base.method(this.directLoginWizardController(), 'fixRulerRendering', this.cardDialogComponent().displayMode()), | 493 | MochiKit.Base.method(this.directLoginWizardController(), 'fixRulerRendering', this.cardDialogComponent().displayMode()), |
497 | MochiKit.Base.method(this.cardDialogComponent(), 'showDirectLoginEditingComponent') | 494 | MochiKit.Base.method(this.cardDialogComponent(), 'showDirectLoginEditingComponent') |
498 | ], {trace:false}); | 495 | ], {trace:false}); |
499 | }, | 496 | }, |
500 | 497 | ||
501 | //------------------------------------------------------------------------- | 498 | //------------------------------------------------------------------------- |
502 | 499 | ||
503 | 'handleHideDirectLoginEditingComponent': function () { | 500 | 'handleHideDirectLoginEditingComponent': function () { |
504 | return Clipperz.Async.callbacks("CardDialogController.handleHideDirectLoginEditingComponent", [ | 501 | return Clipperz.Async.callbacks("CardDialogController.handleHideDirectLoginEditingComponent", [ |
505 | MochiKit.Base.method(this, 'setIsDirectLoginEditingComponentVisible', false), | 502 | MochiKit.Base.method(this, 'setIsDirectLoginEditingComponentVisible', false), |
506 | MochiKit.Base.method(this.directLoginWizardController(), 'hideRuler'), | 503 | MochiKit.Base.method(this.directLoginWizardController(), 'hideRuler'), |
507 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginReference', null), | 504 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginReference', null), |
508 | MochiKit.Base.method(this, 'refreshDirectLoginComponents'), | 505 | MochiKit.Base.method(this, 'refreshDirectLoginComponents'), |
509 | MochiKit.Base.method(this.cardDialogComponent(), 'hideDirectLoginEditingComponent') | 506 | MochiKit.Base.method(this.cardDialogComponent(), 'hideDirectLoginEditingComponent') |
510 | ], {trace:false}) | 507 | ], {trace:false}) |
511 | }, | 508 | }, |
512 | 509 | ||
513 | 'handleCompleteDirectLoginEditingComponent': function (someParameters) { | 510 | 'handleCompleteDirectLoginEditingComponent': function (someParameters) { |
514 | return Clipperz.Async.callbacks("CardDialogController.handleCompleteDirectLoginEditingComponent", [ | 511 | return Clipperz.Async.callbacks("CardDialogController.handleCompleteDirectLoginEditingComponent", [ |
515 | MochiKit.Base.method(this, 'setIsDirectLoginEditingComponentVisible', false), | 512 | MochiKit.Base.method(this, 'setIsDirectLoginEditingComponentVisible', false), |
516 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginReference', null), | 513 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginReference', null), |
517 | MochiKit.Base.partial(MochiKit.Async.succeed, someParameters['hasJustBeenAdded']), | 514 | MochiKit.Base.partial(MochiKit.Async.succeed, someParameters['hasJustBeenAdded']), |
518 | Clipperz.Async.deferredIf("CardDialogController.handleCompleteDirectLoginEditingComponent - should addTheEditedDirectLogin", [ | 515 | Clipperz.Async.deferredIf("CardDialogController.handleCompleteDirectLoginEditingComponent - should addTheEditedDirectLogin", [ |
519 | MochiKit.Base.method(this, 'addCardDialogComponentWithDirectLogin', someParameters['directLogin']) | 516 | MochiKit.Base.method(this, 'addCardDialogComponentWithDirectLogin', someParameters['directLogin']) |
520 | ], []), | 517 | ], []), |
521 | MochiKit.Base.method(this, 'refreshDirectLoginComponents'), | 518 | MochiKit.Base.method(this, 'refreshDirectLoginComponents'), |
522 | MochiKit.Base.method(this, 'handleChangedValue'), | 519 | MochiKit.Base.method(this, 'handleChangedValue'), |
523 | MochiKit.Base.method(this.cardDialogComponent(), 'hideDirectLoginEditingComponent') | 520 | MochiKit.Base.method(this.cardDialogComponent(), 'hideDirectLoginEditingComponent') |
524 | ], {trace:false}) | 521 | ], {trace:false}) |
525 | }, | 522 | }, |
526 | 523 | ||
527 | //========================================================================= | 524 | //========================================================================= |
528 | 525 | ||
529 | 'handleChangedValue': function () { | 526 | 'handleChangedValue': function () { |
530 | return Clipperz.Async.callbacks("CardDialogController.handleChangedValue", [ | 527 | return Clipperz.Async.callbacks("CardDialogController.handleChangedValue", [ |
531 | MochiKit.Base.method(this, 'updateRecordValues'), | 528 | MochiKit.Base.method(this, 'updateRecordValues'), |
532 | MochiKit.Base.method(this.record(), 'hasPendingChanges'), | 529 | MochiKit.Base.method(this.record(), 'hasPendingChanges'), |
533 | MochiKit.Base.method(this.cardDialogComponent(), 'setShouldEnableSaving') | 530 | MochiKit.Base.method(this.cardDialogComponent(), 'setShouldEnableSaving') |
534 | ], {trace:false}); | 531 | ], {trace:false}); |
535 | }, | 532 | }, |
536 | 533 | ||
537 | //------------------------------------------------------------------------- | 534 | //------------------------------------------------------------------------- |
538 | 535 | ||
539 | 'handleSave': function () { | 536 | 'handleSave': function () { |
540 | var deferredResult; | 537 | var deferredResult; |
541 | 538 | ||
542 | deferredResult = new Clipperz.Async.Deferred("CardDialogController.handleSave", {trace:false}); | 539 | deferredResult = new Clipperz.Async.Deferred("CardDialogController.handleSave", {trace:false}); |
543 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':8}); | 540 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':8}); |
544 | deferredResult.addMethod(this.cardDialogComponent(), 'showProgressMask'); | 541 | deferredResult.addMethod(this.cardDialogComponent(), 'showProgressMask'); |
545 | deferredResult.addMethod(this.cardDialogComponent(), 'newFieldHasPendingChanges'); | 542 | deferredResult.addMethod(this.cardDialogComponent(), 'newFieldHasPendingChanges'); |
546 | deferredResult.addIf([ | 543 | deferredResult.addIf([ |
547 | MochiKit.Base.method(this, 'addField') | 544 | MochiKit.Base.method(this, 'addField') |
548 | ], []) | 545 | ], []) |
549 | deferredResult.addMethod(this, 'saveChanges'); | 546 | deferredResult.addMethod(this, 'saveChanges'); |
550 | deferredResult.addMethod(this.cardDialogComponent(), 'deferredHideModal', {closeToElement:null}); | 547 | deferredResult.addMethod(this.cardDialogComponent(), 'deferredHideModal', {closeToElement:null}); |
551 | deferredResult.addMethod(this.cardDialogComponent(), 'remove'); | 548 | deferredResult.addMethod(this.cardDialogComponent(), 'remove'); |
552 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'cardDialogComponentClosed'); | 549 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'cardDialogComponentClosed'); |
553 | 550 | ||
554 | deferredResult.callback(); | 551 | deferredResult.callback(); |
555 | 552 | ||
556 | return deferredResult; | 553 | return deferredResult; |
557 | }, | 554 | }, |
558 | 555 | ||
559 | //......................................................................... | 556 | //......................................................................... |
560 | 557 | ||
561 | 'saveChanges': function () { | 558 | 'saveChanges': function () { |
562 | var deferredResult; | 559 | var deferredResult; |
563 | 560 | ||
564 | deferredResult = new Clipperz.Async.Deferred("CardDialogController.handleSave", {trace:false}); | 561 | deferredResult = new Clipperz.Async.Deferred("CardDialogController.handleSave", {trace:false}); |
565 | deferredResult.addMethod(this.delegate(), 'saveChanges'); | 562 | deferredResult.addMethod(this.delegate(), 'saveChanges'); |
566 | deferredResult.addErrback(function (aValue) { Clipperz.log("SHIT HAPPENS!!"); return aValue; }); | 563 | deferredResult.addErrback(function (aValue) { Clipperz.log("SHIT HAPPENS!!"); return aValue; }); |
567 | 564 | ||
568 | deferredResult.callback(); | 565 | deferredResult.callback(); |
569 | 566 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js index f58f0b8..68b5b9f 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js | |||
@@ -1,204 +1,202 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.CardsController = function() { | 26 | Clipperz.PM.UI.Web.Controllers.CardsController = function() { |
29 | Clipperz.PM.UI.Web.Controllers.CardsController.superclass.constructor.apply(this, arguments); | 27 | Clipperz.PM.UI.Web.Controllers.CardsController.superclass.constructor.apply(this, arguments); |
30 | 28 | ||
31 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'cardDialogComponentClosed', this, 'handleHideCard'); | 29 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'cardDialogComponentClosed', this, 'handleHideCard'); |
32 | 30 | ||
33 | return this; | 31 | return this; |
34 | } | 32 | } |
35 | 33 | ||
36 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardsController, Clipperz.PM.UI.Web.Controllers.GridController, { | 34 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardsController, Clipperz.PM.UI.Web.Controllers.GridController, { |
37 | 35 | ||
38 | 'toString': function() { | 36 | 'toString': function() { |
39 | return "Clipperz.PM.UI.Web.Controllers.CardsController"; | 37 | return "Clipperz.PM.UI.Web.Controllers.CardsController"; |
40 | }, | 38 | }, |
41 | 39 | ||
42 | 'createGrid': function () { | 40 | 'createGrid': function () { |
43 | var grid; | 41 | var grid; |
44 | 42 | ||
45 | grid = new Clipperz.PM.UI.Web.Components.GridComponent({columnsManagers: [ | 43 | grid = new Clipperz.PM.UI.Web.Components.GridComponent({columnsManagers: [ |
46 | new Clipperz.PM.UI.Web.Components.FaviconColumnManager({ | 44 | new Clipperz.PM.UI.Web.Components.FaviconColumnManager({ |
47 | 'name': 'Cards.favicon', | 45 | 'name': 'Cards.favicon', |
48 | 'selector': MochiKit.Base.methodcaller('favicon'), | 46 | 'selector': MochiKit.Base.methodcaller('favicon'), |
49 | 'cssClass': 'favicon' | 47 | 'cssClass': 'favicon' |
50 | }), | 48 | }), |
51 | new Clipperz.PM.UI.Web.Components.LinkColumnManager({ | 49 | new Clipperz.PM.UI.Web.Components.LinkColumnManager({ |
52 | 'name': 'Cards.title', | 50 | 'name': 'Cards.title', |
53 | 'selector': MochiKit.Base.methodcaller('label'), | 51 | 'selector': MochiKit.Base.methodcaller('label'), |
54 | 'label': 'title', | 52 | 'label': 'title', |
55 | 'cssClass': 'title', | 53 | 'cssClass': 'title', |
56 | 'comparator': Clipperz.Base.caseInsensitiveCompare, | 54 | 'comparator': Clipperz.Base.caseInsensitiveCompare, |
57 | 'sortable': true, | 55 | 'sortable': true, |
58 | 'sorted': 'ASCENDING', | 56 | 'sorted': 'ASCENDING', |
59 | // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'editCard', {objectData:anObject, element:anEvent.src()})} | 57 | // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'editCard', {objectData:anObject, element:anEvent.src()})} |
60 | 'actionMethod': MochiKit.Base.method(this, 'handleShowCard') | 58 | 'actionMethod': MochiKit.Base.method(this, 'handleShowCard') |
61 | }), | 59 | }), |
62 | new Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager({ | 60 | new Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager({ |
63 | 'name': 'Cards.directLogins', | 61 | 'name': 'Cards.directLogins', |
64 | 'selector': MochiKit.Base.methodcaller('directLoginReferences'), | 62 | 'selector': MochiKit.Base.methodcaller('directLoginReferences'), |
65 | 'label': 'direct logins', | 63 | 'label': 'direct logins', |
66 | 'cssClass': 'directLogin' | 64 | 'cssClass': 'directLogin' |
67 | }), | 65 | }), |
68 | new Clipperz.PM.UI.Web.Components.DateColumnManager({ | 66 | new Clipperz.PM.UI.Web.Components.DateColumnManager({ |
69 | 'name': 'Cards.latestUpdate', | 67 | 'name': 'Cards.latestUpdate', |
70 | 'selector': MochiKit.Base.methodcaller('updateDate'), | 68 | 'selector': MochiKit.Base.methodcaller('updateDate'), |
71 | 'label': 'latest update', | 69 | 'label': 'latest update', |
72 | 'cssClass': 'latestUpdate', | 70 | 'cssClass': 'latestUpdate', |
73 | 'format': 'd-m-Y', | 71 | 'format': 'd-m-Y', |
74 | 'comparator': MochiKit.Base.compare, | 72 | 'comparator': MochiKit.Base.compare, |
75 | 'sortable': true, | 73 | 'sortable': true, |
76 | 'sorted': 'UNSORTED' | 74 | 'sorted': 'UNSORTED' |
77 | }), | 75 | }), |
78 | new Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager({ | 76 | new Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager({ |
79 | 'name': 'Cards.delete', | 77 | 'name': 'Cards.delete', |
80 | 'selector': MochiKit.Base.noop, | 78 | 'selector': MochiKit.Base.noop, |
81 | 'cssClass': 'delete', | 79 | 'cssClass': 'delete', |
82 | // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'deleteCard', {objectData:anObject, element:anEvent.src()})} | 80 | // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'deleteCard', {objectData:anObject, element:anEvent.src()})} |
83 | 'actionMethod': MochiKit.Base.method(this, 'handleDeleteCard') | 81 | 'actionMethod': MochiKit.Base.method(this, 'handleDeleteCard') |
84 | }) | 82 | }) |
85 | ]}); | 83 | ]}); |
86 | 84 | ||
87 | grid.setComponentForSlotNamed(new Clipperz.PM.UI.Web.Components.BookmarkletComponent(), 'headerSlot'); | 85 | grid.setComponentForSlotNamed(new Clipperz.PM.UI.Web.Components.BookmarkletComponent(), 'headerSlot'); |
88 | 86 | ||
89 | return grid; | 87 | return grid; |
90 | }, | 88 | }, |
91 | 89 | ||
92 | //----------------------------------------------------------------------------- | 90 | //----------------------------------------------------------------------------- |
93 | 91 | ||
94 | 'getRows': function () { | 92 | 'getRows': function () { |
95 | //TODO relying on user() in GridController, bad code smell :| | 93 | //TODO relying on user() in GridController, bad code smell :| |
96 | return this.user().getRecords(); | 94 | return this.user().getRecords(); |
97 | }, | 95 | }, |
98 | 96 | ||
99 | //============================================================================= | 97 | //============================================================================= |
100 | 98 | ||
101 | 'displayEmptyContent': function () { | 99 | 'displayEmptyContent': function () { |
102 | varemptyGridComponent; | 100 | varemptyGridComponent; |
103 | 101 | ||
104 | emptyGridComponent = new Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent(); | 102 | emptyGridComponent = new Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent(); |
105 | 103 | ||
106 | return Clipperz.Async.callbacks("CardsController.displayEmptyContent", [ | 104 | return Clipperz.Async.callbacks("CardsController.displayEmptyContent", [ |
107 | MochiKit.Base.method(this.grid(), 'setNoRowsGridComponent', emptyGridComponent), | 105 | MochiKit.Base.method(this.grid(), 'setNoRowsGridComponent', emptyGridComponent), |
108 | MochiKit.Base.bind(Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displayEmptyContent, this) | 106 | MochiKit.Base.bind(Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displayEmptyContent, this) |
109 | ], {trace:false}); | 107 | ], {trace:false}); |
110 | }, | 108 | }, |
111 | 109 | ||
112 | 'displaySelectedRows': function (aFilter) { | 110 | 'displaySelectedRows': function (aFilter) { |
113 | this.columnManagerWithName('Cards.directLogins').hideDirectLoginListPopup(); | 111 | this.columnManagerWithName('Cards.directLogins').hideDirectLoginListPopup(); |
114 | 112 | ||
115 | return Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displaySelectedRows.apply(this, arguments); | 113 | return Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displaySelectedRows.apply(this, arguments); |
116 | }, | 114 | }, |
117 | 115 | ||
118 | //============================================================================= | 116 | //============================================================================= |
119 | 117 | ||
120 | 'handleShowCard': function (anObject, anEvent) { | 118 | 'handleShowCard': function (anObject, anEvent) { |
121 | var cardDialogController; | 119 | var cardDialogController; |
122 | 120 | ||
123 | cardDialogController = new Clipperz.PM.UI.Web.Controllers.CardDialogController({record:anObject, delegate:this}); | 121 | cardDialogController = new Clipperz.PM.UI.Web.Controllers.CardDialogController({record:anObject, delegate:this}); |
124 | this.grid().selectRow(anObject); | 122 | this.grid().selectRow(anObject); |
125 | 123 | ||
126 | cardDialogController.run(anEvent.src()); | 124 | cardDialogController.run(anEvent.src()); |
127 | }, | 125 | }, |
128 | 126 | ||
129 | //......................................................................... | 127 | //......................................................................... |
130 | 128 | ||
131 | 'handleHideCard': function () { | 129 | 'handleHideCard': function () { |
132 | this.focus(); | 130 | this.focus(); |
133 | }, | 131 | }, |
134 | 132 | ||
135 | //----------------------------------------------------------------------------- | 133 | //----------------------------------------------------------------------------- |
136 | 134 | ||
137 | 'addCard': function (aSourceElement) { | 135 | 'addCard': function (aSourceElement) { |
138 | return Clipperz.Async.callbacks("CardsController.addCard", [ | 136 | return Clipperz.Async.callbacks("CardsController.addCard", [ |
139 | Clipperz.Async.collectResults("CardsController.addCard <inner results>", { | 137 | Clipperz.Async.collectResults("CardsController.addCard <inner results>", { |
140 | 'record': MochiKit.Base.method(this.user(), 'createNewRecord'), | 138 | 'record': MochiKit.Base.method(this.user(), 'createNewRecord'), |
141 | 'delegate':MochiKit.Base.partial(MochiKit.Async.succeed, this) | 139 | 'delegate':MochiKit.Base.partial(MochiKit.Async.succeed, this) |
142 | }, {trace:false}), | 140 | }, {trace:false}), |
143 | function (someParameters) { | 141 | function (someParameters) { |
144 | return new Clipperz.PM.UI.Web.Controllers.CardDialogController(someParameters); | 142 | return new Clipperz.PM.UI.Web.Controllers.CardDialogController(someParameters); |
145 | }, | 143 | }, |
146 | MochiKit.Base.methodcaller('run', aSourceElement) | 144 | MochiKit.Base.methodcaller('run', aSourceElement) |
147 | ], {trace:false}); | 145 | ], {trace:false}); |
148 | }, | 146 | }, |
149 | 147 | ||
150 | //----------------------------------------------------------------------------- | 148 | //----------------------------------------------------------------------------- |
151 | 149 | ||
152 | 'handleDeleteCard': function (anObject, anEvent) { | 150 | 'handleDeleteCard': function (anObject, anEvent) { |
153 | var deferredResult; | 151 | var deferredResult; |
154 | var confirmationDialog; | 152 | var confirmationDialog; |
155 | 153 | ||
156 | // confirmationDialog = new Clipperz.PM.UI.Common.Components.SimpleMessagePanel({ | 154 | // confirmationDialog = new Clipperz.PM.UI.Common.Components.SimpleMessagePanel({ |
157 | confirmationDialog = new Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar({ | 155 | confirmationDialog = new Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar({ |
158 | 'title':"Delete Card", | 156 | 'title':"Delete Card", |
159 | 'text': "Do you want to delete …", | 157 | 'text': "Do you want to delete …", |
160 | 'type': 'ALERT', | 158 | 'type': 'ALERT', |
161 | 'buttons': [ | 159 | 'buttons': [ |
162 | {text:"Cancel",result:'CANCEL'}, | 160 | {text:"Cancel",result:'CANCEL'}, |
163 | {text:"Delete", result:'OK', isDefault:true} | 161 | {text:"Delete", result:'OK', isDefault:true} |
164 | ], | 162 | ], |
165 | 'canCancelWhileProcessing':false | 163 | 'canCancelWhileProcessing':false |
166 | }); | 164 | }); |
167 | 165 | ||
168 | deferredResult = new Clipperz.Async.Deferred("AppController.handleDeleteCard", {trace:false}); | 166 | deferredResult = new Clipperz.Async.Deferred("AppController.handleDeleteCard", {trace:false}); |
169 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':5}), | 167 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':5}), |
170 | deferredResult.addMethod(this.grid(), 'selectRow', anObject); | 168 | deferredResult.addMethod(this.grid(), 'selectRow', anObject); |
171 | deferredResult.addMethod(confirmationDialog, 'deferredShowModal', { | 169 | deferredResult.addMethod(confirmationDialog, 'deferredShowModal', { |
172 | 'openFromElement': anEvent.src(), | 170 | 'openFromElement': anEvent.src(), |
173 | 'onOkCloseToElement': null, //MochiKit.DOM.currentDocument().body, | 171 | 'onOkCloseToElement': null, //MochiKit.DOM.currentDocument().body, |
174 | 'onCancelCloseToElement':anEvent.src() | 172 | 'onCancelCloseToElement':anEvent.src() |
175 | }); | 173 | }); |
176 | // deferredResult.addCallback(function () { Clipperz.log("DELETE: " + anObject.toString(), anObject); }); | 174 | // deferredResult.addCallback(function () { Clipperz.log("DELETE: " + anObject.toString(), anObject); }); |
177 | deferredResult.addMethod(this.user(), 'deleteRecord', anObject); | 175 | deferredResult.addMethod(this.user(), 'deleteRecord', anObject); |
178 | deferredResult.addBothPass(MochiKit.Base.method(this.grid(), 'unselectRow', anObject)); | 176 | deferredResult.addBothPass(MochiKit.Base.method(this.grid(), 'unselectRow', anObject)); |
179 | deferredResult.addMethod(this, 'saveChanges'); | 177 | deferredResult.addMethod(this, 'saveChanges'); |
180 | deferredResult.addMethod(confirmationDialog, 'deferredDone'); | 178 | deferredResult.addMethod(confirmationDialog, 'deferredDone'); |
181 | deferredResult.addErrbackPass(function (anError) { | 179 | deferredResult.addErrbackPass(function (anError) { |
182 | var result; | 180 | var result; |
183 | 181 | ||
184 | if (! (anError instanceof MochiKit.Async.CancelledError)) { | 182 | if (! (anError instanceof MochiKit.Async.CancelledError)) { |
185 | result = confirmationDialog.deferredError({ | 183 | result = confirmationDialog.deferredError({ |
186 | 'type': 'ALERT', | 184 | 'type': 'ALERT', |
187 | 'title':"Error", | 185 | 'title':"Error", |
188 | 'text': Clipperz.PM.Strings.errorDescriptionForException(anError), | 186 | 'text': Clipperz.PM.Strings.errorDescriptionForException(anError), |
189 | 'buttons':[{text:"Close", result:'CANCEL', isDefault:true}] | 187 | 'buttons':[{text:"Close", result:'CANCEL', isDefault:true}] |
190 | }) | 188 | }) |
191 | } else { | 189 | } else { |
192 | result = anError; | 190 | result = anError; |
193 | } | 191 | } |
194 | 192 | ||
195 | return result; | 193 | return result; |
196 | }); | 194 | }); |
197 | deferredResult.callback(); | 195 | deferredResult.callback(); |
198 | 196 | ||
199 | return deferredResult; | 197 | return deferredResult; |
200 | }, | 198 | }, |
201 | 199 | ||
202 | //============================================================================= | 200 | //============================================================================= |
203 | __syntaxFix__: "syntax fix" | 201 | __syntaxFix__: "syntax fix" |
204 | }); | 202 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js index c025a51..92ed6e3 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js | |||
@@ -1,603 +1,598 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController = function(args) { | 26 | Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController = function(args) { |
29 | this._directLoginEditingComponent = args.directLoginEditingComponent|| Clipperz.Base.exception.raise('MandatoryParameter'); | 27 | this._directLoginEditingComponent = args.directLoginEditingComponent|| Clipperz.Base.exception.raise('MandatoryParameter'); |
30 | this._cardLabel = args.cardLabel || Clipperz.Base.exception.raise('MandatoryParameter'); | 28 | this._cardLabel = args.cardLabel || Clipperz.Base.exception.raise('MandatoryParameter'); |
31 | 29 | ||
32 | MochiKit.Signal.connect(this._directLoginEditingComponent, 'changedValue',this, 'handleChangedValue'); | 30 | MochiKit.Signal.connect(this._directLoginEditingComponent, 'changedValue',this, 'handleChangedValue'); |
33 | MochiKit.Signal.connect(this._directLoginEditingComponent, 'moveForward',this, 'handleMoveForward'); | 31 | MochiKit.Signal.connect(this._directLoginEditingComponent, 'moveForward',this, 'handleMoveForward'); |
34 | MochiKit.Signal.connect(this._directLoginEditingComponent, 'keyPressed',this, 'handleDirectLoginEditingComponentKeyPressed'); | 32 | MochiKit.Signal.connect(this._directLoginEditingComponent, 'keyPressed',this, 'handleDirectLoginEditingComponentKeyPressed'); |
35 | 33 | ||
36 | this._directLogin = null; | 34 | this._directLogin = null; |
37 | this._directLoginHasJustBeenAdded = false; | 35 | this._directLoginHasJustBeenAdded = false; |
38 | 36 | ||
39 | this._rulerComponent = null; | 37 | this._rulerComponent = null; |
40 | 38 | ||
41 | this._steps = null; | 39 | this._steps = null; |
42 | this._currentStepIndex = 0; | 40 | this._currentStepIndex = 0; |
43 | this._isNextEnabled = false; | 41 | this._isNextEnabled = false; |
44 | 42 | ||
45 | this._recordFields = null; | 43 | this._recordFields = null; |
46 | this._originalBindings = null; | 44 | this._originalBindings = null; |
47 | 45 | ||
48 | this._bindingComponents = []; | 46 | this._bindingComponents = []; |
49 | this._formValueComponents = []; | 47 | this._formValueComponents = []; |
50 | 48 | ||
51 | return this; | 49 | return this; |
52 | } | 50 | } |
53 | 51 | ||
54 | MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController.prototype, { | 52 | MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController.prototype, { |
55 | 53 | ||
56 | 'toString': function() { | 54 | 'toString': function() { |
57 | return "Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController"; | 55 | return "Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController"; |
58 | }, | 56 | }, |
59 | 57 | ||
60 | //------------------------------------------------------------------------- | 58 | //------------------------------------------------------------------------- |
61 | 59 | ||
62 | 'directLogin': function () { | 60 | 'directLogin': function () { |
63 | return this._directLogin; | 61 | return this._directLogin; |
64 | }, | 62 | }, |
65 | 63 | ||
66 | //------------------------------------------------------------------------- | 64 | //------------------------------------------------------------------------- |
67 | 65 | ||
68 | 'directLoginHasJustBeenAdded': function () { | 66 | 'directLoginHasJustBeenAdded': function () { |
69 | return this._directLoginHasJustBeenAdded; | 67 | return this._directLoginHasJustBeenAdded; |
70 | }, | 68 | }, |
71 | 69 | ||
72 | 'setDirectLoginHasJustBeenAdded': function (aValue) { | 70 | 'setDirectLoginHasJustBeenAdded': function (aValue) { |
73 | this._directLoginHasJustBeenAdded = aValue; | 71 | this._directLoginHasJustBeenAdded = aValue; |
74 | }, | 72 | }, |
75 | 73 | ||
76 | //------------------------------------------------------------------------- | 74 | //------------------------------------------------------------------------- |
77 | 75 | ||
78 | 'directLoginEditingComponent': function () { | 76 | 'directLoginEditingComponent': function () { |
79 | return this._directLoginEditingComponent; | 77 | return this._directLoginEditingComponent; |
80 | }, | 78 | }, |
81 | 79 | ||
82 | //============================================================================= | 80 | //============================================================================= |
83 | 81 | ||
84 | 'cardLabel': function () { | 82 | 'cardLabel': function () { |
85 | return this._cardLabel; | 83 | return this._cardLabel; |
86 | }, | 84 | }, |
87 | 85 | ||
88 | //============================================================================= | 86 | //============================================================================= |
89 | 87 | ||
90 | 'resetCurrentStepIndex': function () { | 88 | 'resetCurrentStepIndex': function () { |
91 | this._currentStepIndex = 0; | 89 | this._currentStepIndex = 0; |
92 | this.rulerComponent().resetStatus(); | 90 | this.rulerComponent().resetStatus(); |
93 | }, | 91 | }, |
94 | 92 | ||
95 | //----------------------------------------------------------------------------- | 93 | //----------------------------------------------------------------------------- |
96 | 94 | ||
97 | 'enableNext': function (aValue) { | 95 | 'enableNext': function (aValue) { |
98 | this.rulerComponent().enableNext(aValue); | 96 | this.rulerComponent().enableNext(aValue); |
99 | this._isNextEnabled = aValue; | 97 | this._isNextEnabled = aValue; |
100 | }, | 98 | }, |
101 | 99 | ||
102 | 'isNextEnabled': function () { | 100 | 'isNextEnabled': function () { |
103 | return this._isNextEnabled; | 101 | return this._isNextEnabled; |
104 | }, | 102 | }, |
105 | 103 | ||
106 | //----------------------------------------------------------------------------- | 104 | //----------------------------------------------------------------------------- |
107 | 105 | ||
108 | 'enablePrevious': function (aValue) { | 106 | 'enablePrevious': function (aValue) { |
109 | this.rulerComponent().enablePrevious(aValue); | 107 | this.rulerComponent().enablePrevious(aValue); |
110 | }, | 108 | }, |
111 | 109 | ||
112 | //============================================================================= | 110 | //============================================================================= |
113 | 111 | ||
114 | 'bindingComponents': function () { | 112 | 'bindingComponents': function () { |
115 | return this._bindingComponents; | 113 | return this._bindingComponents; |
116 | }, | 114 | }, |
117 | 115 | ||
118 | 'resetBindingComponents': function () { | 116 | 'resetBindingComponents': function () { |
119 | this.directLoginEditingComponent().clearAllBindingsComponents(); | 117 | this.directLoginEditingComponent().clearAllBindingsComponents(); |
120 | this._bindingComponents = []; | 118 | this._bindingComponents = []; |
121 | }, | 119 | }, |
122 | 120 | ||
123 | //============================================================================= | 121 | //============================================================================= |
124 | 122 | ||
125 | 'formValueComponents': function () { | 123 | 'formValueComponents': function () { |
126 | return this._formValueComponents; | 124 | return this._formValueComponents; |
127 | }, | 125 | }, |
128 | 126 | ||
129 | 'resetFormValueComponents': function () { | 127 | 'resetFormValueComponents': function () { |
130 | this.directLoginEditingComponent().clearAllFormValueComponents(); | 128 | this.directLoginEditingComponent().clearAllFormValueComponents(); |
131 | this._formValueComponents = []; | 129 | this._formValueComponents = []; |
132 | }, | 130 | }, |
133 | 131 | ||
134 | //============================================================================= | 132 | //============================================================================= |
135 | 133 | ||
136 | 'recordFields': function () { | 134 | 'recordFields': function () { |
137 | return this._recordFields; | 135 | return this._recordFields; |
138 | }, | 136 | }, |
139 | 137 | ||
140 | 'setRecordFields': function (aValue) { | 138 | 'setRecordFields': function (aValue) { |
141 | this._recordFields = aValue; | 139 | this._recordFields = aValue; |
142 | }, | 140 | }, |
143 | 141 | ||
144 | 'recordFieldWithReference': function (aReference) { | 142 | 'recordFieldWithReference': function (aReference) { |
145 | var matchingValues; | 143 | var matchingValues; |
146 | var result; | 144 | var result; |
147 | 145 | ||
148 | matchingValues = MochiKit.Base.filter(function (aField) { return aField['reference'] == aReference; }, this.recordFields()); | 146 | matchingValues = MochiKit.Base.filter(function (aField) { return aField['reference'] == aReference; }, this.recordFields()); |
149 | 147 | ||
150 | if (matchingValues.length == 0) { | 148 | if (matchingValues.length == 0) { |
151 | result = null; | 149 | result = null; |
152 | } else { | 150 | } else { |
153 | result = matchingValues[0]; | 151 | result = matchingValues[0]; |
154 | } | 152 | } |
155 | 153 | ||
156 | return result; | 154 | return result; |
157 | }, | 155 | }, |
158 | 156 | ||
159 | //----------------------------------------------------------------------------- | 157 | //----------------------------------------------------------------------------- |
160 | 158 | ||
161 | 'originalBindings': function () { | 159 | 'originalBindings': function () { |
162 | return this._originalBindings; | 160 | return this._originalBindings; |
163 | }, | 161 | }, |
164 | 162 | ||
165 | 'setOriginalBindings': function (aValue) { | 163 | 'setOriginalBindings': function (aValue) { |
166 | //console.log("BINDINGS", aValue); | ||
167 | this._originalBindings = aValue; | 164 | this._originalBindings = aValue; |
168 | }, | 165 | }, |
169 | 166 | ||
170 | //============================================================================= | 167 | //============================================================================= |
171 | 168 | ||
172 | 'rulerComponent': function () { | 169 | 'rulerComponent': function () { |
173 | if (this._rulerComponent == null) { | 170 | if (this._rulerComponent == null) { |
174 | this._rulerComponent = new Clipperz.PM.UI.Web.Components.RulerComponent({ | 171 | this._rulerComponent = new Clipperz.PM.UI.Web.Components.RulerComponent({ |
175 | translationContext:'Wizards.DirectLoginWizard' | 172 | translationContext:'Wizards.DirectLoginWizard' |
176 | }); | 173 | }); |
177 | this._rulerComponent.render(); | 174 | this._rulerComponent.render(); |
178 | 175 | ||
179 | MochiKit.Signal.connect(this._rulerComponent, 'exit', this, 'handleExit'); | 176 | MochiKit.Signal.connect(this._rulerComponent, 'exit', this, 'handleExit'); |
180 | MochiKit.Signal.connect(this._rulerComponent, 'done', this, 'done'); | 177 | MochiKit.Signal.connect(this._rulerComponent, 'done', this, 'done'); |
181 | MochiKit.Signal.connect(this._rulerComponent, 'moveForward',this, 'handleMoveForward'); | 178 | MochiKit.Signal.connect(this._rulerComponent, 'moveForward',this, 'handleMoveForward'); |
182 | MochiKit.Signal.connect(this._rulerComponent, 'moveBackward',this, 'handleMoveBackward'); | 179 | MochiKit.Signal.connect(this._rulerComponent, 'moveBackward',this, 'handleMoveBackward'); |
183 | MochiKit.Signal.connect(this._rulerComponent, 'cursorMoved',this, 'handleCursorMoved'); | 180 | MochiKit.Signal.connect(this._rulerComponent, 'cursorMoved',this, 'handleCursorMoved'); |
184 | } | 181 | } |
185 | 182 | ||
186 | return this._rulerComponent; | 183 | return this._rulerComponent; |
187 | }, | 184 | }, |
188 | 185 | ||
189 | //----------------------------------------------------------------------------- | 186 | //----------------------------------------------------------------------------- |
190 | 187 | ||
191 | 'showRuler': function (someSteps) { | 188 | 'showRuler': function (someSteps) { |
192 | var rulerElement; | 189 | var rulerElement; |
193 | 190 | ||
194 | this.setSteps(someSteps); | 191 | this.setSteps(someSteps); |
195 | 192 | ||
196 | rulerElement = this.rulerComponent().element(); | 193 | rulerElement = this.rulerComponent().element(); |
197 | this.directLoginEditingComponent().disableAllPanels(); | 194 | this.directLoginEditingComponent().disableAllPanels(); |
198 | 195 | ||
199 | MochiKit.Style.showElement(rulerElement); | 196 | MochiKit.Style.showElement(rulerElement); |
200 | MochiKit.Style.setElementPosition(rulerElement, {x:-1000, y:this.directLoginEditingComponent().bottomMargin()}); | 197 | MochiKit.Style.setElementPosition(rulerElement, {x:-1000, y:this.directLoginEditingComponent().bottomMargin()}); |
201 | new MochiKit.Visual.Move(rulerElement, { | 198 | new MochiKit.Visual.Move(rulerElement, { |
202 | x:0, y:this.directLoginEditingComponent().bottomMargin(), | 199 | x:0, y:this.directLoginEditingComponent().bottomMargin(), |
203 | mode:'absolute', | 200 | mode:'absolute', |
204 | duration:1, | 201 | duration:1, |
205 | afterFinish:MochiKit.Base.method(this, 'handleCursorMoved') | 202 | afterFinish:MochiKit.Base.method(this, 'handleCursorMoved') |
206 | }); | 203 | }); |
207 | }, | 204 | }, |
208 | 205 | ||
209 | 'fixRulerRendering': function (aValue) { | 206 | 'fixRulerRendering': function (aValue) { |
210 | this.rulerComponent().setDisplayMode(aValue); | 207 | this.rulerComponent().setDisplayMode(aValue); |
211 | }, | 208 | }, |
212 | 209 | ||
213 | //----------------------------------------------------------------------------- | 210 | //----------------------------------------------------------------------------- |
214 | 211 | ||
215 | 'hideRuler': function () { | 212 | 'hideRuler': function () { |
216 | new MochiKit.Visual.Move(this.rulerComponent().element(), {x:-1000, mode:'relative', duration:1}); | 213 | new MochiKit.Visual.Move(this.rulerComponent().element(), {x:-1000, mode:'relative', duration:1}); |
217 | }, | 214 | }, |
218 | 215 | ||
219 | 'doneWithRuler': function () { | 216 | 'doneWithRuler': function () { |
220 | var rulerComponentElement; | 217 | var rulerComponentElement; |
221 | 218 | ||
222 | rulerComponentElement = this.rulerComponent().element(); | 219 | rulerComponentElement = this.rulerComponent().element(); |
223 | new MochiKit.Visual.Move(this.rulerComponent().element(), { | 220 | new MochiKit.Visual.Move(this.rulerComponent().element(), { |
224 | x:1000, | 221 | x:1000, |
225 | mode:'relative', | 222 | mode:'relative', |
226 | duration:1, | 223 | duration:1, |
227 | // afterFinish:MochiKit.Base.partial(MochiKit.Style.hideElement, rulerComponentElement) | 224 | // afterFinish:MochiKit.Base.partial(MochiKit.Style.hideElement, rulerComponentElement) |
228 | afterFinish:function () { MochiKit.Style.hideElement(rulerComponentElement); } | 225 | afterFinish:function () { MochiKit.Style.hideElement(rulerComponentElement); } |
229 | }); | 226 | }); |
230 | }, | 227 | }, |
231 | 228 | ||
232 | //============================================================================= | 229 | //============================================================================= |
233 | 230 | ||
234 | 'addNewDirectLoginRulerSteps': function () { | 231 | 'addNewDirectLoginRulerSteps': function () { |
235 | return MochiKit.Base.concat([ 'LABEL'], this.editDirectLoginRulerSteps()); | 232 | return MochiKit.Base.concat([ 'LABEL'], this.editDirectLoginRulerSteps()); |
236 | 233 | ||
237 | }, | 234 | }, |
238 | 235 | ||
239 | 'editDirectLoginRulerSteps': function () { | 236 | 'editDirectLoginRulerSteps': function () { |
240 | return [ /*'TYPE',*/ 'CONFIGURATION', 'BINDINGS','FAVICON', 'DONE']; | 237 | return [ /*'TYPE',*/ 'CONFIGURATION', 'BINDINGS','FAVICON', 'DONE']; |
241 | }, | 238 | }, |
242 | 239 | ||
243 | //------------------------------------------------------------------------- | 240 | //------------------------------------------------------------------------- |
244 | 241 | ||
245 | 'runWithDirectLogin': function (aDirectLogin, hasJustBeenAdded) { | 242 | 'runWithDirectLogin': function (aDirectLogin, hasJustBeenAdded) { |
246 | this._directLogin = aDirectLogin; | 243 | this._directLogin = aDirectLogin; |
247 | this.setDirectLoginHasJustBeenAdded(hasJustBeenAdded); | 244 | this.setDirectLoginHasJustBeenAdded(hasJustBeenAdded); |
248 | 245 | ||
249 | return Clipperz.Async.callbacks("DirectLoginWizardController.runWithDirectLogin", [ | 246 | return Clipperz.Async.callbacks("DirectLoginWizardController.runWithDirectLogin", [ |
250 | MochiKit.Base.method(aDirectLogin, 'label'), | 247 | MochiKit.Base.method(aDirectLogin, 'label'), |
251 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setLabel'), | 248 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setLabel'), |
252 | 249 | ||
253 | MochiKit.Base.method(aDirectLogin, 'favicon'), | 250 | MochiKit.Base.method(aDirectLogin, 'favicon'), |
254 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginFavicon'), | 251 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginFavicon'), |
255 | 252 | ||
256 | MochiKit.Base.method(aDirectLogin, 'bookmarkletConfiguration'), | 253 | MochiKit.Base.method(aDirectLogin, 'bookmarkletConfiguration'), |
257 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setBookmarkletConfiguration'), | 254 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setBookmarkletConfiguration'), |
258 | 255 | ||
259 | MochiKit.Base.method(aDirectLogin, 'bindings'), | 256 | MochiKit.Base.method(aDirectLogin, 'bindings'), |
260 | MochiKit.Base.method(this, 'setOriginalBindings'), | 257 | MochiKit.Base.method(this, 'setOriginalBindings'), |
261 | 258 | ||
262 | MochiKit.Base.method(aDirectLogin, 'record'), | 259 | MochiKit.Base.method(aDirectLogin, 'record'), |
263 | MochiKit.Base.methodcaller('fields'), | 260 | MochiKit.Base.methodcaller('fields'), |
264 | MochiKit.Base.values, | 261 | MochiKit.Base.values, |
265 | MochiKit.Base.partial(MochiKit.Base.map, Clipperz.Async.collectResults("Record.directLoginReferences - collectResults", { | 262 | MochiKit.Base.partial(MochiKit.Base.map, Clipperz.Async.collectResults("Record.directLoginReferences - collectResults", { |
266 | 'reference': MochiKit.Base.methodcaller('reference'), | 263 | 'reference': MochiKit.Base.methodcaller('reference'), |
267 | 'label': MochiKit.Base.methodcaller('label'), | 264 | 'label': MochiKit.Base.methodcaller('label'), |
268 | 'isHidden': MochiKit.Base.methodcaller('isHidden'), | 265 | 'isHidden': MochiKit.Base.methodcaller('isHidden'), |
269 | 'value': MochiKit.Base.methodcaller('value') | 266 | 'value': MochiKit.Base.methodcaller('value') |
270 | }, {trace:false})), | 267 | }, {trace:false})), |
271 | Clipperz.Async.collectAll, | 268 | Clipperz.Async.collectAll, |
272 | 269 | ||
273 | MochiKit.Base.method(this, 'setRecordFields'), | 270 | MochiKit.Base.method(this, 'setRecordFields'), |
274 | 271 | ||
275 | MochiKit.Base.partial(MochiKit.Async.succeed, hasJustBeenAdded), | 272 | MochiKit.Base.partial(MochiKit.Async.succeed, hasJustBeenAdded), |
276 | Clipperz.Async.deferredIf("Direct login has just been added", [ | 273 | Clipperz.Async.deferredIf("Direct login has just been added", [ |
277 | MochiKit.Base.method(this, 'addNewDirectLoginRulerSteps') | 274 | MochiKit.Base.method(this, 'addNewDirectLoginRulerSteps') |
278 | ], [ | 275 | ], [ |
279 | MochiKit.Base.method(this, 'editDirectLoginRulerSteps') | 276 | MochiKit.Base.method(this, 'editDirectLoginRulerSteps') |
280 | ]), | 277 | ]), |
281 | MochiKit.Base.method(this, 'showRuler') | 278 | MochiKit.Base.method(this, 'showRuler') |
282 | ], {trace:false}); | 279 | ], {trace:false}); |
283 | }, | 280 | }, |
284 | 281 | ||
285 | //----------------------------------------------------------------------------- | 282 | //----------------------------------------------------------------------------- |
286 | 283 | ||
287 | 'checkState': function () { | 284 | 'checkState': function () { |
288 | var enablePrevious; | 285 | var enablePrevious; |
289 | var enableNext; | 286 | var enableNext; |
290 | 287 | ||
291 | enablePrevious = true; | 288 | enablePrevious = true; |
292 | enableNext = false; | 289 | enableNext = false; |
293 | 290 | ||
294 | this.directLoginEditingComponent().disableAllPanels(); | 291 | this.directLoginEditingComponent().disableAllPanels(); |
295 | 292 | ||
296 | switch(this.currentStep()) { | 293 | switch(this.currentStep()) { |
297 | case 'LABEL': | 294 | case 'LABEL': |
298 | this.directLoginEditingComponent().enableLabelField(); | 295 | this.directLoginEditingComponent().enableLabelField(); |
299 | 296 | ||
300 | enableNext = (this.directLoginEditingComponent().label() != ''); | 297 | enableNext = (this.directLoginEditingComponent().label() != ''); |
301 | enablePrevious = false; | 298 | enablePrevious = false; |
302 | break; | 299 | break; |
303 | case 'TYPE': | 300 | case 'TYPE': |
304 | this.directLoginEditingComponent().enableTypeField(); | 301 | this.directLoginEditingComponent().enableTypeField(); |
305 | 302 | ||
306 | enableNext = true; | 303 | enableNext = true; |
307 | enablePrevious = true; | 304 | enablePrevious = true; |
308 | break | 305 | break |
309 | case 'CONFIGURATION': | 306 | case 'CONFIGURATION': |
310 | this.directLoginEditingComponent().enableConfigurationField(); | 307 | this.directLoginEditingComponent().enableConfigurationField(); |
311 | 308 | ||
312 | enableNext = (this.directLoginEditingComponent().bookmarkletConfiguration() != ''); | 309 | enableNext = (this.directLoginEditingComponent().bookmarkletConfiguration() != ''); |
313 | 310 | ||
314 | if (enableNext == true) { | 311 | if (enableNext == true) { |
315 | try { | 312 | try { |
316 | Clipperz.PM.DataModel.DirectLogin.checkBookmarkletConfiguration(this.directLoginEditingComponent().bookmarkletConfiguration()); | 313 | Clipperz.PM.DataModel.DirectLogin.checkBookmarkletConfiguration(this.directLoginEditingComponent().bookmarkletConfiguration()); |
317 | this.directLoginEditingComponent().removeHighlightConfigurationSyntaxError(); | 314 | this.directLoginEditingComponent().removeHighlightConfigurationSyntaxError(); |
318 | } catch (e) { | 315 | } catch (e) { |
319 | this.directLoginEditingComponent().highlightConfigurationSyntaxError(); | 316 | this.directLoginEditingComponent().highlightConfigurationSyntaxError(); |
320 | enableNext = false; | 317 | enableNext = false; |
321 | } | 318 | } |
322 | } | 319 | } |
323 | break; | 320 | break; |
324 | case 'BINDINGS': | 321 | case 'BINDINGS': |
325 | enableNext = MochiKit.Iter.every(this.bindingComponents(), function (aBindingComponent) { return aBindingComponent.selectedValue() != null; }) | 322 | enableNext = MochiKit.Iter.every(this.bindingComponents(), function (aBindingComponent) { return aBindingComponent.selectedValue() != null; }) |
326 | this.directLoginEditingComponent().enableBindingFields(); | 323 | this.directLoginEditingComponent().enableBindingFields(); |
327 | break; | 324 | break; |
328 | case 'FAVICON': | 325 | case 'FAVICON': |
329 | enableNext = true; | 326 | enableNext = true; |
330 | this.directLoginEditingComponent().enableFaviconField(); | 327 | this.directLoginEditingComponent().enableFaviconField(); |
331 | break; | 328 | break; |
332 | case 'DONE': | 329 | case 'DONE': |
333 | enableNext = true; | 330 | enableNext = true; |
334 | this.directLoginEditingComponent().enableDonePanel(); | 331 | this.directLoginEditingComponent().enableDonePanel(); |
335 | break; | 332 | break; |
336 | } | 333 | } |
337 | 334 | ||
338 | if (this.currentStepIndex() > 0) { | 335 | if (this.currentStepIndex() > 0) { |
339 | this.enablePrevious(enablePrevious); | 336 | this.enablePrevious(enablePrevious); |
340 | } else { | 337 | } else { |
341 | this.enablePrevious(false); | 338 | this.enablePrevious(false); |
342 | } | 339 | } |
343 | this.enableNext(enableNext); | 340 | this.enableNext(enableNext); |
344 | }, | 341 | }, |
345 | 342 | ||
346 | //----------------------------------------------------------------------------- | 343 | //----------------------------------------------------------------------------- |
347 | 344 | ||
348 | 'setFocus': function () { | 345 | 'setFocus': function () { |
349 | switch(this.currentStep()) { | 346 | switch(this.currentStep()) { |
350 | case 'LABEL': | 347 | case 'LABEL': |
351 | this.directLoginEditingComponent().focusOnLabelElement(); | 348 | this.directLoginEditingComponent().focusOnLabelElement(); |
352 | break; | 349 | break; |
353 | case 'TYPE': | 350 | case 'TYPE': |
354 | break; | 351 | break; |
355 | case 'CONFIGURATION': | 352 | case 'CONFIGURATION': |
356 | this.directLoginEditingComponent().focusOnBookmarkletConfigurationElement(); | 353 | this.directLoginEditingComponent().focusOnBookmarkletConfigurationElement(); |
357 | break; | 354 | break; |
358 | case 'BINDINGS': | 355 | case 'BINDINGS': |
359 | // this.directLoginEditingComponent().getElement('???').focus(); | 356 | // this.directLoginEditingComponent().getElement('???').focus(); |
360 | break; | 357 | break; |
361 | case 'FAVICON': | 358 | case 'FAVICON': |
362 | this.directLoginEditingComponent().focusOnFaviconElement(); | 359 | this.directLoginEditingComponent().focusOnFaviconElement(); |
363 | break; | 360 | break; |
364 | case 'DONE': | 361 | case 'DONE': |
365 | break; | 362 | break; |
366 | } | 363 | } |
367 | }, | 364 | }, |
368 | 365 | ||
369 | //============================================================================= | 366 | //============================================================================= |
370 | 367 | ||
371 | 'steps': function () { | 368 | 'steps': function () { |
372 | return this._steps; | 369 | return this._steps; |
373 | }, | 370 | }, |
374 | 371 | ||
375 | 'setSteps': function (aValue) { | 372 | 'setSteps': function (aValue) { |
376 | this._steps = aValue; | 373 | this._steps = aValue; |
377 | 374 | ||
378 | this.rulerComponent().setSteps(aValue); | 375 | this.rulerComponent().setSteps(aValue); |
379 | this.resetCurrentStepIndex(); | 376 | this.resetCurrentStepIndex(); |
380 | }, | 377 | }, |
381 | 378 | ||
382 | 'currentStepIndex': function () { | 379 | 'currentStepIndex': function () { |
383 | return this._currentStepIndex; | 380 | return this._currentStepIndex; |
384 | }, | 381 | }, |
385 | 382 | ||
386 | 'currentStep': function () { | 383 | 'currentStep': function () { |
387 | return this.steps()[this.currentStepIndex()]; | 384 | return this.steps()[this.currentStepIndex()]; |
388 | }, | 385 | }, |
389 | 386 | ||
390 | //============================================================================= | 387 | //============================================================================= |
391 | 388 | ||
392 | 'handleExit': function () { | 389 | 'handleExit': function () { |
393 | MochiKit.Signal.signal(this, 'exit'); | 390 | MochiKit.Signal.signal(this, 'exit'); |
394 | }, | 391 | }, |
395 | 392 | ||
396 | 'done': function () { | 393 | 'done': function () { |
397 | this.doneWithRuler(); | 394 | this.doneWithRuler(); |
398 | 395 | ||
399 | Clipperz.Async.callbacks("DirectLoginWizardController.done", [ | 396 | Clipperz.Async.callbacks("DirectLoginWizardController.done", [ |
400 | MochiKit.Base.method(this.directLoginEditingComponent(), 'label'), | 397 | MochiKit.Base.method(this.directLoginEditingComponent(), 'label'), |
401 | MochiKit.Base.method(this.directLogin(), 'setLabel'), | 398 | MochiKit.Base.method(this.directLogin(), 'setLabel'), |
402 | 399 | ||
403 | MochiKit.Base.method(this.directLoginEditingComponent(), 'bookmarkletConfiguration'), | 400 | MochiKit.Base.method(this.directLoginEditingComponent(), 'bookmarkletConfiguration'), |
404 | MochiKit.Base.method(this.directLogin(), 'setBookmarkletConfiguration'), | 401 | MochiKit.Base.method(this.directLogin(), 'setBookmarkletConfiguration'), |
405 | 402 | ||
406 | //Bindings | 403 | //Bindings |
407 | MochiKit.Base.method(this.directLoginEditingComponent(), 'bindingComponents'), | 404 | MochiKit.Base.method(this.directLoginEditingComponent(), 'bindingComponents'), |
408 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.bind(function (aBindingComponent) { | 405 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.bind(function (aBindingComponent) { |
409 | Clipperz.Async.forEach(MochiKit.Base.bind(function (aBindingComponent) { | 406 | Clipperz.Async.forEach(MochiKit.Base.bind(function (aBindingComponent) { |
410 | //console.log("aBindingComponent", aBindingComponent); | ||
411 | // this.directLogin(). | ||
412 | return Clipperz.Async.callbacks("DirectLoginWizardController.done - update directLogin bindings", [ | 407 | return Clipperz.Async.callbacks("DirectLoginWizardController.done - update directLogin bindings", [ |
413 | MochiKit.Base.method(this.directLogin(), 'bindings'), | 408 | MochiKit.Base.method(this.directLogin(), 'bindings'), |
414 | MochiKit.Base.itemgetter(aBindingComponent.formFieldName()), | 409 | MochiKit.Base.itemgetter(aBindingComponent.formFieldName()), |
415 | MochiKit.Base.methodcaller('setFieldKey', aBindingComponent.selectedValue()) | 410 | MochiKit.Base.methodcaller('setFieldKey', aBindingComponent.selectedValue()) |
416 | ], {trace:false}); | 411 | ], {trace:false}); |
417 | }, this)), | 412 | }, this)), |
418 | 413 | ||
419 | MochiKit.Base.method(this.directLoginEditingComponent(), 'favicon'), | 414 | MochiKit.Base.method(this.directLoginEditingComponent(), 'favicon'), |
420 | MochiKit.Base.method(this.directLogin(), 'setFavicon'), | 415 | MochiKit.Base.method(this.directLogin(), 'setFavicon'), |
421 | 416 | ||
422 | MochiKit.Base.partial(MochiKit.Signal.signal, this, 'done', { | 417 | MochiKit.Base.partial(MochiKit.Signal.signal, this, 'done', { |
423 | 'directLogin': this.directLogin(), | 418 | 'directLogin': this.directLogin(), |
424 | 'hasJustBeenAdded':this.directLoginHasJustBeenAdded() | 419 | 'hasJustBeenAdded':this.directLoginHasJustBeenAdded() |
425 | }) | 420 | }) |
426 | ], {trace:false}); | 421 | ], {trace:false}); |
427 | }, | 422 | }, |
428 | 423 | ||
429 | //============================================================================= | 424 | //============================================================================= |
430 | 425 | ||
431 | 'handleMoveBackward': function () { | 426 | 'handleMoveBackward': function () { |
432 | if (this._currentStepIndex > 0) { | 427 | if (this._currentStepIndex > 0) { |
433 | varafterMoveAction; | 428 | varafterMoveAction; |
434 | 429 | ||
435 | this._currentStepIndex --; | 430 | this._currentStepIndex --; |
436 | afterMoveAction = MochiKit.Base.noop; | 431 | afterMoveAction = MochiKit.Base.noop; |
437 | 432 | ||
438 | switch(this.currentStep()) { | 433 | switch(this.currentStep()) { |
439 | case 'LABEL': | 434 | case 'LABEL': |
440 | break; | 435 | break; |
441 | case 'TYPE': | 436 | case 'TYPE': |
442 | break; | 437 | break; |
443 | case 'CONFIGURATION': | 438 | case 'CONFIGURATION': |
444 | break; | 439 | break; |
445 | case 'BINDINGS': | 440 | case 'BINDINGS': |
446 | break; | 441 | break; |
447 | case 'FAVICON': | 442 | case 'FAVICON': |
448 | break; | 443 | break; |
449 | case 'DONE': | 444 | case 'DONE': |
450 | break; | 445 | break; |
451 | }; | 446 | }; |
452 | 447 | ||
453 | this.rulerComponent().moveBackward(afterMoveAction); | 448 | this.rulerComponent().moveBackward(afterMoveAction); |
454 | } | 449 | } |
455 | 450 | ||
456 | if (this._currentStepIndex == 0) { | 451 | if (this._currentStepIndex == 0) { |
457 | this.enablePrevious(false); | 452 | this.enablePrevious(false); |
458 | } | 453 | } |
459 | }, | 454 | }, |
460 | 455 | ||
461 | 'handleMoveForward': function () { | 456 | 'handleMoveForward': function () { |
462 | if (this.isNextEnabled()) { | 457 | if (this.isNextEnabled()) { |
463 | varafterMoveAction; | 458 | varafterMoveAction; |
464 | 459 | ||
465 | this._currentStepIndex ++; | 460 | this._currentStepIndex ++; |
466 | afterMoveAction = MochiKit.Base.noop; | 461 | afterMoveAction = MochiKit.Base.noop; |
467 | 462 | ||
468 | switch(this.currentStep()) { | 463 | switch(this.currentStep()) { |
469 | case 'LABEL': | 464 | case 'LABEL': |
470 | break; | 465 | break; |
471 | case 'TYPE': | 466 | case 'TYPE': |
472 | break; | 467 | break; |
473 | case 'CONFIGURATION': | 468 | case 'CONFIGURATION': |
474 | break; | 469 | break; |
475 | case 'BINDINGS': | 470 | case 'BINDINGS': |
476 | this.resetBindingComponents(); | 471 | this.resetBindingComponents(); |
477 | this.resetFormValueComponents(); | 472 | this.resetFormValueComponents(); |
478 | 473 | ||
479 | afterMoveAction = MochiKit.Base.partial(Clipperz.Async.callbacks, "DirectLoginWizardController.handleMoveForward - BINDINGS", [ | 474 | afterMoveAction = MochiKit.Base.partial(Clipperz.Async.callbacks, "DirectLoginWizardController.handleMoveForward - BINDINGS", [ |
480 | MochiKit.Base.method(this.directLogin(), 'setBookmarkletConfiguration', this.directLoginEditingComponent().bookmarkletConfiguration()), | 475 | MochiKit.Base.method(this.directLogin(), 'setBookmarkletConfiguration', this.directLoginEditingComponent().bookmarkletConfiguration()), |
481 | 476 | ||
482 | MochiKit.Base.method(this.directLogin(), 'favicon'), | 477 | MochiKit.Base.method(this.directLogin(), 'favicon'), |
483 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginFavicon'), | 478 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginFavicon'), |
484 | 479 | ||
485 | MochiKit.Base.method(this.directLogin(), 'bindings'), | 480 | MochiKit.Base.method(this.directLogin(), 'bindings'), |
486 | MochiKit.Base.values, | 481 | MochiKit.Base.values, |
487 | Clipperz.Async.forEach(MochiKit.Base.bind(function (aBinding) { | 482 | Clipperz.Async.forEach(MochiKit.Base.bind(function (aBinding) { |
488 | var bindingComponent; | 483 | var bindingComponent; |
489 | 484 | ||
490 | bindingComponent = new Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent({ | 485 | bindingComponent = new Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent({ |
491 | formFieldName: aBinding.key(), | 486 | formFieldName: aBinding.key(), |
492 | fields: this.recordFields(), | 487 | fields: this.recordFields(), |
493 | selectedFieldKey: aBinding.fieldKey() | 488 | selectedFieldKey: aBinding.fieldKey() |
494 | }); | 489 | }); |
495 | 490 | ||
496 | this.bindingComponents().push(bindingComponent); | 491 | this.bindingComponents().push(bindingComponent); |
497 | 492 | ||
498 | MochiKit.Signal.connect(bindingComponent, 'bindChange', this, 'handleBindChange', bindingComponent); | 493 | MochiKit.Signal.connect(bindingComponent, 'bindChange', this, 'handleBindChange', bindingComponent); |
499 | this.directLoginEditingComponent().addBindingComponent(bindingComponent); | 494 | this.directLoginEditingComponent().addBindingComponent(bindingComponent); |
500 | 495 | ||
501 | }, this)), | 496 | }, this)), |
502 | 497 | ||
503 | MochiKit.Base.method(this.directLogin(), 'formValues'), | 498 | MochiKit.Base.method(this.directLogin(), 'formValues'), |
504 | MochiKit.Base.values, | 499 | MochiKit.Base.values, |
505 | Clipperz.Async.forEach(MochiKit.Base.bind(function (aFormValue) { | 500 | Clipperz.Async.forEach(MochiKit.Base.bind(function (aFormValue) { |
506 | var formValueComponent; | 501 | var formValueComponent; |
507 | 502 | ||
508 | formValueComponent = new Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent({ | 503 | formValueComponent = new Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent({ |
509 | 'formFieldName': aFormValue.key(), | 504 | 'formFieldName': aFormValue.key(), |
510 | 'fieldOptions': aFormValue.fieldOptions(), | 505 | 'fieldOptions': aFormValue.fieldOptions(), |
511 | 'initialValue': aFormValue.value() | 506 | 'initialValue': aFormValue.value() |
512 | }); | 507 | }); |
513 | 508 | ||
514 | this.formValueComponents().push(formValueComponent); | 509 | this.formValueComponents().push(formValueComponent); |
515 | 510 | ||
516 | MochiKit.Signal.connect(formValueComponent, 'formValueChange', this, 'handleFormValueChange', formValueComponent); | 511 | MochiKit.Signal.connect(formValueComponent, 'formValueChange', this, 'handleFormValueChange', formValueComponent); |
517 | this.directLoginEditingComponent().addFormValueComponent(formValueComponent); | 512 | this.directLoginEditingComponent().addFormValueComponent(formValueComponent); |
518 | }, this)) | 513 | }, this)) |
519 | 514 | ||
520 | ], {trace:false}); | 515 | ], {trace:false}); |
521 | 516 | ||
522 | break; | 517 | break; |
523 | case 'FAVICON': | 518 | case 'FAVICON': |
524 | break; | 519 | break; |
525 | case 'DONE': | 520 | case 'DONE': |
526 | this.directLoginEditingComponent().setDoneDescriptionWithKeys({ | 521 | this.directLoginEditingComponent().setDoneDescriptionWithKeys({ |
527 | '__cardName__': this.cardLabel(), | 522 | '__cardName__': this.cardLabel(), |
528 | '__directLoginName__': this.directLoginEditingComponent().label() | 523 | '__directLoginName__': this.directLoginEditingComponent().label() |
529 | }); | 524 | }); |
530 | break; | 525 | break; |
531 | }; | 526 | }; |
532 | 527 | ||
533 | this.rulerComponent().moveForward(afterMoveAction); | 528 | this.rulerComponent().moveForward(afterMoveAction); |
534 | }; | 529 | }; |
535 | }, | 530 | }, |
536 | 531 | ||
537 | 'handleCursorMoved': function () { | 532 | 'handleCursorMoved': function () { |
538 | this.checkState(); | 533 | this.checkState(); |
539 | this.setFocus(); | 534 | this.setFocus(); |
540 | }, | 535 | }, |
541 | 536 | ||
542 | //------------------------------------------------------------------------- | 537 | //------------------------------------------------------------------------- |
543 | 538 | ||
544 | 'handleChangedValue': function (anEvent) { | 539 | 'handleChangedValue': function (anEvent) { |
545 | this.checkState(); | 540 | this.checkState(); |
546 | }, | 541 | }, |
547 | 542 | ||
548 | //......................................................................... | 543 | //......................................................................... |
549 | 544 | ||
550 | 'handleBindChange': function (aDirectLoginEditingBindingComponent) { | 545 | 'handleBindChange': function (aDirectLoginEditingBindingComponent) { |
551 | varselectedField; | 546 | varselectedField; |
552 | 547 | ||
553 | selectedField = this.recordFieldWithReference(aDirectLoginEditingBindingComponent.selectedValue()); | 548 | selectedField = this.recordFieldWithReference(aDirectLoginEditingBindingComponent.selectedValue()); |
554 | 549 | ||
555 | return Clipperz.Async.callbacks("DirectLoginWizardController.handleBindChange", [ | 550 | return Clipperz.Async.callbacks("DirectLoginWizardController.handleBindChange", [ |
556 | MochiKit.Base.method(this.directLogin(), 'bindings'), | 551 | MochiKit.Base.method(this.directLogin(), 'bindings'), |
557 | MochiKit.Base.itemgetter(aDirectLoginEditingBindingComponent.formFieldName()), | 552 | MochiKit.Base.itemgetter(aDirectLoginEditingBindingComponent.formFieldName()), |
558 | MochiKit.Base.methodcaller('setFieldKey', selectedField['reference']), | 553 | MochiKit.Base.methodcaller('setFieldKey', selectedField['reference']), |
559 | function () { | 554 | function () { |
560 | if (selectedField != null) { | 555 | if (selectedField != null) { |
561 | aDirectLoginEditingBindingComponent.setFieldValue(selectedField['value']); | 556 | aDirectLoginEditingBindingComponent.setFieldValue(selectedField['value']); |
562 | aDirectLoginEditingBindingComponent.setIsHidden(selectedField['isHidden']); | 557 | aDirectLoginEditingBindingComponent.setIsHidden(selectedField['isHidden']); |
563 | } else { | 558 | } else { |
564 | aDirectLoginEditingBindingComponent.setFieldValue(''); | 559 | aDirectLoginEditingBindingComponent.setFieldValue(''); |
565 | aDirectLoginEditingBindingComponent.setIsHidden(false); | 560 | aDirectLoginEditingBindingComponent.setIsHidden(false); |
566 | } | 561 | } |
567 | }, | 562 | }, |
568 | MochiKit.Base.method(this, 'checkState') | 563 | MochiKit.Base.method(this, 'checkState') |
569 | ], {trace:false}); | 564 | ], {trace:false}); |
570 | }, | 565 | }, |
571 | 566 | ||
572 | //......................................................................... | 567 | //......................................................................... |
573 | 568 | ||
574 | 'handleFormValueChange': function (someOptions) { | 569 | 'handleFormValueChange': function (someOptions) { |
575 | return Clipperz.Async.callbacks("DirectLoginWizardController.handleFormValueChange", [ | 570 | return Clipperz.Async.callbacks("DirectLoginWizardController.handleFormValueChange", [ |
576 | MochiKit.Base.method(this.directLogin(), 'formValues'), | 571 | MochiKit.Base.method(this.directLogin(), 'formValues'), |
577 | MochiKit.Base.itemgetter(someOptions['fieldName']), | 572 | MochiKit.Base.itemgetter(someOptions['fieldName']), |
578 | MochiKit.Base.methodcaller('setValue', someOptions['selectedValue']), | 573 | MochiKit.Base.methodcaller('setValue', someOptions['selectedValue']), |
579 | MochiKit.Base.method(this, 'checkState') | 574 | MochiKit.Base.method(this, 'checkState') |
580 | ], {trace:false}); | 575 | ], {trace:false}); |
581 | }, | 576 | }, |
582 | 577 | ||
583 | //------------------------------------------------------------------------- | 578 | //------------------------------------------------------------------------- |
584 | 579 | ||
585 | 'handleDirectLoginEditingComponentKeyPressed': function (anEvent) { | 580 | 'handleDirectLoginEditingComponentKeyPressed': function (anEvent) { |
586 | if (anEvent.key().string == 'KEY_ENTER') { | 581 | if (anEvent.key().string == 'KEY_ENTER') { |
587 | if (anEvent.target().nodeName != 'TEXTAREA') { | 582 | if (anEvent.target().nodeName != 'TEXTAREA') { |
588 | anEvent.preventDefault(); | 583 | anEvent.preventDefault(); |
589 | this.handleMoveForward(); | 584 | this.handleMoveForward(); |
590 | } | 585 | } |
591 | } else if (anEvent.key().string == 'KEY_TAB') { | 586 | } else if (anEvent.key().string == 'KEY_TAB') { |
592 | this.handleMoveForward(); | 587 | this.handleMoveForward(); |
593 | if ((anEvent.target().nodeName == 'INPUT') || (anEvent.target().nodeName == 'TEXTAREA')) { | 588 | if ((anEvent.target().nodeName == 'INPUT') || (anEvent.target().nodeName == 'TEXTAREA')) { |
594 | anEvent.preventDefault(); | 589 | anEvent.preventDefault(); |
595 | } | 590 | } |
596 | } else if ((anEvent.key().string == 'KEY_ARROW_RIGHT') && (anEvent.modifier().meta == true)) { | 591 | } else if ((anEvent.key().string == 'KEY_ARROW_RIGHT') && (anEvent.modifier().meta == true)) { |
597 | this.handleMoveForward(); | 592 | this.handleMoveForward(); |
598 | } else if ((anEvent.key().string == 'KEY_ARROW_LEFT') && (anEvent.modifier().meta == true)) { | 593 | } else if ((anEvent.key().string == 'KEY_ARROW_LEFT') && (anEvent.modifier().meta == true)) { |
599 | this.handleMoveBackward(); | 594 | this.handleMoveBackward(); |
600 | } else if (anEvent.key().string == 'KEY_ESCAPE') { | 595 | } else if (anEvent.key().string == 'KEY_ESCAPE') { |
601 | anEvent.stop(); | 596 | anEvent.stop(); |
602 | this.handleExit(); | 597 | this.handleExit(); |
603 | } | 598 | } |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js index 6ca3be4..7ab512a 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js | |||
@@ -1,142 +1,140 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | /* | 24 | /* |
27 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 25 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
28 | 26 | ||
29 | Clipperz.PM.UI.Web.Controllers.DirectLoginsController = function() { | 27 | Clipperz.PM.UI.Web.Controllers.DirectLoginsController = function() { |
30 | Clipperz.PM.UI.Web.Controllers.DirectLoginsController.superclass.constructor.apply(this, arguments); | 28 | Clipperz.PM.UI.Web.Controllers.DirectLoginsController.superclass.constructor.apply(this, arguments); |
31 | 29 | ||
32 | return this; | 30 | return this; |
33 | }; | 31 | }; |
34 | 32 | ||
35 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.DirectLoginsController, Clipperz.PM.UI.Web.Controllers.GridController, { | 33 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.DirectLoginsController, Clipperz.PM.UI.Web.Controllers.GridController, { |
36 | 34 | ||
37 | 'createGrid': function () { | 35 | 'createGrid': function () { |
38 | return new Clipperz.PM.UI.Web.Components.GridComponent({columnsManagers: [ | 36 | return new Clipperz.PM.UI.Web.Components.GridComponent({columnsManagers: [ |
39 | new Clipperz.PM.UI.Web.Components.FaviconColumnManager({ | 37 | new Clipperz.PM.UI.Web.Components.FaviconColumnManager({ |
40 | 'name': 'DirectLogins.favicon', | 38 | 'name': 'DirectLogins.favicon', |
41 | 'selector': MochiKit.Base.methodcaller('favicon'), | 39 | 'selector': MochiKit.Base.methodcaller('favicon'), |
42 | 'cssClass': 'favicon' | 40 | 'cssClass': 'favicon' |
43 | }), | 41 | }), |
44 | // new Clipperz.PM.UI.Web.Components.LinkColumnManager({ | 42 | // new Clipperz.PM.UI.Web.Components.LinkColumnManager({ |
45 | new Clipperz.PM.UI.Web.Components.DirectLoginColumnManager({ | 43 | new Clipperz.PM.UI.Web.Components.DirectLoginColumnManager({ |
46 | 'name': 'DirectLogins.title', | 44 | 'name': 'DirectLogins.title', |
47 | 'selector': MochiKit.Base.methodcaller('label'), | 45 | 'selector': MochiKit.Base.methodcaller('label'), |
48 | 'label': 'title', | 46 | 'label': 'title', |
49 | 'cssClass': 'title', | 47 | 'cssClass': 'title', |
50 | 'comparator': Clipperz.Base.caseInsensitiveCompare, | 48 | 'comparator': Clipperz.Base.caseInsensitiveCompare, |
51 | 'sortable': true, | 49 | 'sortable': true, |
52 | 'sorted': 'ASCENDING', | 50 | 'sorted': 'ASCENDING', |
53 | 'actionMethod': MochiKit.Base.methodcaller('runDirectLogin') | 51 | 'actionMethod': MochiKit.Base.methodcaller('runDirectLogin') |
54 | }), | 52 | }), |
55 | // new Clipperz.PM.UI.Web.Components.TextColumnManager({ //should be StrengthColumnManager | 53 | // new Clipperz.PM.UI.Web.Components.TextColumnManager({ //should be StrengthColumnManager |
56 | // 'label':'strength', | 54 | // 'label':'strength', |
57 | // 'cssClass':'title', | 55 | // 'cssClass':'title', |
58 | // 'selector': MochiKit.Base.methodcaller('label') //should be 'strength' or a strenght evaluation function | 56 | // 'selector': MochiKit.Base.methodcaller('label') //should be 'strength' or a strenght evaluation function |
59 | // }), | 57 | // }), |
60 | new Clipperz.PM.UI.Web.Components.LinkColumnManager({ | 58 | new Clipperz.PM.UI.Web.Components.LinkColumnManager({ |
61 | 'name': 'DirectLogins.cardTitle', | 59 | 'name': 'DirectLogins.cardTitle', |
62 | 'selector': MochiKit.Base.compose(MochiKit.Base.methodcaller('label'), MochiKit.Base.methodcaller('record')), | 60 | 'selector': MochiKit.Base.compose(MochiKit.Base.methodcaller('label'), MochiKit.Base.methodcaller('record')), |
63 | 'label': 'card', | 61 | 'label': 'card', |
64 | 'cssClass': 'cardTitle', | 62 | 'cssClass': 'cardTitle', |
65 | 'comparator': Clipperz.Base.caseInsensitiveCompare, | 63 | 'comparator': Clipperz.Base.caseInsensitiveCompare, |
66 | 'sortable': true, | 64 | 'sortable': true, |
67 | 'sorted': 'UNSORTED', | 65 | 'sorted': 'UNSORTED', |
68 | 'actionMethod': MochiKit.Base.method(this, 'handleShowCard') | 66 | 'actionMethod': MochiKit.Base.method(this, 'handleShowCard') |
69 | }), | 67 | }), |
70 | // new Clipperz.PM.UI.Web.Components.TextColumnManager({ //should be StrengthColumnManager | 68 | // new Clipperz.PM.UI.Web.Components.TextColumnManager({ //should be StrengthColumnManager |
71 | // 'label':'last access', | 69 | // 'label':'last access', |
72 | // 'cssClass':'title', | 70 | // 'cssClass':'title', |
73 | // 'selector': MochiKit.Base.methodcaller('label') | 71 | // 'selector': MochiKit.Base.methodcaller('label') |
74 | // // 'sortable': true, | 72 | // // 'sortable': true, |
75 | // // 'sorted': 'UNSORTED' | 73 | // // 'sorted': 'UNSORTED' |
76 | // }), | 74 | // }), |
77 | // new Clipperz.PM.UI.Web.Components.TextColumnManager({ | 75 | // new Clipperz.PM.UI.Web.Components.TextColumnManager({ |
78 | // 'label':'commands', | 76 | // 'label':'commands', |
79 | // 'cssClass':'title', | 77 | // 'cssClass':'title', |
80 | // 'selector': MochiKit.Base.methodcaller('label'), //should be a function for commands display | 78 | // 'selector': MochiKit.Base.methodcaller('label'), //should be a function for commands display |
81 | // }), | 79 | // }), |
82 | new Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager({ | 80 | new Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager({ |
83 | 'name': 'DirectLogins.delete', | 81 | 'name': 'DirectLogins.delete', |
84 | 'selector': MochiKit.Base.noop, | 82 | 'selector': MochiKit.Base.noop, |
85 | 'cssClass': 'delete', | 83 | 'cssClass': 'delete', |
86 | // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'deleteDirectLogin', {objectData:anObject, element:anEvent.src()})} | 84 | // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'deleteDirectLogin', {objectData:anObject, element:anEvent.src()})} |
87 | 'actionMethod': MochiKit.Base.method(this, 'handleDeleteDirectLogin') | 85 | 'actionMethod': MochiKit.Base.method(this, 'handleDeleteDirectLogin') |
88 | }) | 86 | }) |
89 | ]}); | 87 | ]}); |
90 | 88 | ||
91 | }, | 89 | }, |
92 | 90 | ||
93 | //----------------------------------------------------------------------------- | 91 | //----------------------------------------------------------------------------- |
94 | 92 | ||
95 | 'getRows': function () { | 93 | 'getRows': function () { |
96 | //TODO: relying on user() in GridController, bad code smell :| | 94 | //TODO: relying on user() in GridController, bad code smell :| |
97 | return this.user().getDirectLogins(); | 95 | return this.user().getDirectLogins(); |
98 | }, | 96 | }, |
99 | 97 | ||
100 | //----------------------------------------------------------------------------- | 98 | //----------------------------------------------------------------------------- |
101 | 99 | ||
102 | 'handleShowCard': function (anObject, anEvent) { | 100 | 'handleShowCard': function (anObject, anEvent) { |
103 | var cardDialogController; | 101 | var cardDialogController; |
104 | 102 | ||
105 | cardDialogController = new Clipperz.PM.UI.Web.Controllers.CardDialogController({record:anObject.record()}) | 103 | cardDialogController = new Clipperz.PM.UI.Web.Controllers.CardDialogController({record:anObject.record()}) |
106 | cardDialogController.run(anEvent.src()); | 104 | cardDialogController.run(anEvent.src()); |
107 | }, | 105 | }, |
108 | 106 | ||
109 | //----------------------------------------------------------------------------- | 107 | //----------------------------------------------------------------------------- |
110 | 108 | ||
111 | 'handleDeleteDirectLogin': function (anObject, anEvent) { | 109 | 'handleDeleteDirectLogin': function (anObject, anEvent) { |
112 | var deferredResult; | 110 | var deferredResult; |
113 | var confirmationDialog; | 111 | var confirmationDialog; |
114 | 112 | ||
115 | confirmationDialog = new Clipperz.PM.UI.Common.Components.SimpleMessagePanel({ | 113 | confirmationDialog = new Clipperz.PM.UI.Common.Components.SimpleMessagePanel({ |
116 | title:"Delete DirectLogin", | 114 | title:"Delete DirectLogin", |
117 | text:"Do you want to delete …", | 115 | text:"Do you want to delete …", |
118 | type:'ALERT', | 116 | type:'ALERT', |
119 | buttons: [ | 117 | buttons: [ |
120 | {text:"Cancel",result:'CANCEL', isDefault:true}, | 118 | {text:"Cancel",result:'CANCEL', isDefault:true}, |
121 | {text:"Delete", result:'OK'} | 119 | {text:"Delete", result:'OK'} |
122 | ] | 120 | ] |
123 | }); | 121 | }); |
124 | 122 | ||
125 | deferredResult = new Clipperz.Async.Deferred("AppController.handleDeleteCard", {trace:false}); | 123 | deferredResult = new Clipperz.Async.Deferred("AppController.handleDeleteCard", {trace:false}); |
126 | // deferredResult = confirmationDialog.deferredShow({openFromElement:anEvent.src(), onOkCloseToElement:MochiKit.DOM.currentDocument().body, onCancelCloseToElement:anEvent.src()}); | 124 | // deferredResult = confirmationDialog.deferredShow({openFromElement:anEvent.src(), onOkCloseToElement:MochiKit.DOM.currentDocument().body, onCancelCloseToElement:anEvent.src()}); |
127 | deferredResult.addMethod(confirmationDialog, 'deferredShow', { | 125 | deferredResult.addMethod(confirmationDialog, 'deferredShow', { |
128 | 'openFromElement': anEvent.src(), | 126 | 'openFromElement': anEvent.src(), |
129 | 'onOkCloseToElement': null, //MochiKit.DOM.currentDocument().body, | 127 | 'onOkCloseToElement': null, //MochiKit.DOM.currentDocument().body, |
130 | 'onCancelCloseToElement':anEvent.src() | 128 | 'onCancelCloseToElement':anEvent.src() |
131 | }); | 129 | }); |
132 | deferredResult.addCallback(function () { Clipperz.log("DELETE: " + anObject.toString(), anObject); }); | 130 | deferredResult.addCallback(function () { Clipperz.log("DELETE: " + anObject.toString(), anObject); }); |
133 | deferredResult.addErrbackPass(function () { Clipperz.log("skip deletion: " + anObject.toString(), anObject); }); | 131 | deferredResult.addErrbackPass(function () { Clipperz.log("skip deletion: " + anObject.toString(), anObject); }); |
134 | deferredResult.callback(); | 132 | deferredResult.callback(); |
135 | 133 | ||
136 | return deferredResult; | 134 | return deferredResult; |
137 | }, | 135 | }, |
138 | 136 | ||
139 | //----------------------------------------------------------------------------- | 137 | //----------------------------------------------------------------------------- |
140 | __syntaxFix__: "syntax fix" | 138 | __syntaxFix__: "syntax fix" |
141 | }); | 139 | }); |
142 | */ \ No newline at end of file | 140 | */ \ 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 index bfc093a..de59ec3 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js | |||
@@ -1,155 +1,153 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.FilterController = function(args) { | 26 | Clipperz.PM.UI.Web.Controllers.FilterController = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Controllers.FilterController.superclass.constructor.call(this, args); | 29 | Clipperz.PM.UI.Web.Controllers.FilterController.superclass.constructor.call(this, args); |
32 | 30 | ||
33 | this._filterElements = []; | 31 | this._filterElements = []; |
34 | this._filter = ""; | 32 | this._filter = ""; |
35 | 33 | ||
36 | this._pendingSearchClicks = 0; | 34 | this._pendingSearchClicks = 0; |
37 | 35 | ||
38 | return this; | 36 | return this; |
39 | }; | 37 | }; |
40 | 38 | ||
41 | 39 | ||
42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.FilterController, Object, { | 40 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.FilterController, Object, { |
43 | 41 | ||
44 | //----------------------------------------------------------------------------- | 42 | //----------------------------------------------------------------------------- |
45 | 43 | ||
46 | 'getFilter': function () { | 44 | 'getFilter': function () { |
47 | return this._filter; | 45 | return this._filter; |
48 | }, | 46 | }, |
49 | 47 | ||
50 | '_setFilter': function (aFilterElement, aFilter) { | 48 | '_setFilter': function (aFilterElement, aFilter) { |
51 | if (aFilter != this._filter) { | 49 | if (aFilter != this._filter) { |
52 | this._filter = aFilter; | 50 | this._filter = aFilter; |
53 | MochiKit.Signal.signal(this, 'filterUpdated', aFilter); | 51 | MochiKit.Signal.signal(this, 'filterUpdated', aFilter); |
54 | this.updateFilterElements(aFilterElement, aFilter); | 52 | this.updateFilterElements(aFilterElement, aFilter); |
55 | } | 53 | } |
56 | }, | 54 | }, |
57 | 55 | ||
58 | 'setFilter': function (aFilter) { | 56 | 'setFilter': function (aFilter) { |
59 | this._setFilter(null, aFilter); | 57 | this._setFilter(null, aFilter); |
60 | }, | 58 | }, |
61 | 59 | ||
62 | //----------------------------------------------------------------------------- | 60 | //----------------------------------------------------------------------------- |
63 | 61 | ||
64 | 'filterElements': function () { | 62 | 'filterElements': function () { |
65 | return this._filterElements; | 63 | return this._filterElements; |
66 | }, | 64 | }, |
67 | 65 | ||
68 | 'registerFilterElement': function (aFilterElement) { | 66 | 'registerFilterElement': function (aFilterElement) { |
69 | //Clipperz.log("=== FilterController.registerFilterElement", aFilterElement); | 67 | //Clipperz.log("=== FilterController.registerFilterElement", aFilterElement); |
70 | this._filterElements.push(aFilterElement); | 68 | this._filterElements.push(aFilterElement); |
71 | MochiKit.Signal.connect(aFilterElement, 'onkeydown', this, 'searchClickHandler'); | 69 | MochiKit.Signal.connect(aFilterElement, 'onkeydown', this, 'searchClickHandler'); |
72 | MochiKit.Signal.connect(aFilterElement, 'onfocus', this, 'searchClickHandler'); | 70 | MochiKit.Signal.connect(aFilterElement, 'onfocus', this, 'searchClickHandler'); |
73 | }, | 71 | }, |
74 | 72 | ||
75 | 'removeFilterElement': function (aFilterElement) { | 73 | 'removeFilterElement': function (aFilterElement) { |
76 | var i; | 74 | var i; |
77 | var filterElements; | 75 | var filterElements; |
78 | for (i=0; i < filterElements; i++) { | 76 | for (i=0; i < filterElements; i++) { |
79 | if (filterElements[i] == aFilterElement); | 77 | if (filterElements[i] == aFilterElement); |
80 | filterElements.splice(i, 1); | 78 | filterElements.splice(i, 1); |
81 | // TODO unregister/disconnect filterElement ??MochiKit.Signal.disconnect(this.grid().filterElement(), 'updateFilter', this.filterController(), 'handleUpdateFilter'); | 79 | // TODO unregister/disconnect filterElement ??MochiKit.Signal.disconnect(this.grid().filterElement(), 'updateFilter', this.filterController(), 'handleUpdateFilter'); |
82 | } | 80 | } |
83 | }, | 81 | }, |
84 | 82 | ||
85 | 'updateFilterElements': function (aSourceElement, aFilterString) { | 83 | 'updateFilterElements': function (aSourceElement, aFilterString) { |
86 | MochiKit.Iter.forEach(this.filterElements(), | 84 | MochiKit.Iter.forEach(this.filterElements(), |
87 | function (aFilterElement) { | 85 | function (aFilterElement) { |
88 | if (aFilterElement != aSourceElement) { | 86 | if (aFilterElement != aSourceElement) { |
89 | aFilterElement.value = aFilterString; | 87 | aFilterElement.value = aFilterString; |
90 | } | 88 | } |
91 | } | 89 | } |
92 | ); | 90 | ); |
93 | 91 | ||
94 | if (aSourceElement != null) { | 92 | if (aSourceElement != null) { |
95 | aSourceElement.focus(); | 93 | aSourceElement.focus(); |
96 | } | 94 | } |
97 | }, | 95 | }, |
98 | 96 | ||
99 | //----------------------------------------------------------------------------- | 97 | //----------------------------------------------------------------------------- |
100 | 98 | ||
101 | 'run': function () { | 99 | 'run': function () { |
102 | //Clipperz.log("=== FilterController.run"); | 100 | //Clipperz.log("=== FilterController.run"); |
103 | }, | 101 | }, |
104 | 102 | ||
105 | //----------------------------------------------------------------------------- | 103 | //----------------------------------------------------------------------------- |
106 | 104 | ||
107 | 'pendingSearchClicks': function () { | 105 | 'pendingSearchClicks': function () { |
108 | return this._pendingSearchClicks; | 106 | return this._pendingSearchClicks; |
109 | }, | 107 | }, |
110 | 108 | ||
111 | 'incrementPendingSearchClicks': function () { | 109 | 'incrementPendingSearchClicks': function () { |
112 | this._pendingSearchClicks++; | 110 | this._pendingSearchClicks++; |
113 | }, | 111 | }, |
114 | 112 | ||
115 | 'decrementPendingSearchClicks': function () { | 113 | 'decrementPendingSearchClicks': function () { |
116 | this._pendingSearchClicks--; | 114 | this._pendingSearchClicks--; |
117 | }, | 115 | }, |
118 | 116 | ||
119 | //----------------------------------------------------------------------------- | 117 | //----------------------------------------------------------------------------- |
120 | 118 | ||
121 | 'searchClickHandler': function (anEvent) { | 119 | 'searchClickHandler': function (anEvent) { |
122 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { | 120 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { |
123 | anEvent.preventDefault(); | 121 | anEvent.preventDefault(); |
124 | } else { | 122 | } else { |
125 | var value; | 123 | var value; |
126 | 124 | ||
127 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ESCAPE')) { | 125 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ESCAPE')) { |
128 | value = "" | 126 | value = "" |
129 | } else if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ARROW_UP')) { | 127 | } else if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ARROW_UP')) { |
130 | } else if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ARROW_DOWN')) { | 128 | } else if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ARROW_DOWN')) { |
131 | } else { | 129 | } else { |
132 | value = null; | 130 | value = null; |
133 | } | 131 | } |
134 | 132 | ||
135 | this.incrementPendingSearchClicks(); | 133 | this.incrementPendingSearchClicks(); |
136 | MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, "searchClickDeferredHandler", anEvent.src(), value)); | 134 | MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, "searchClickDeferredHandler", anEvent.src(), value)); |
137 | } | 135 | } |
138 | }, | 136 | }, |
139 | 137 | ||
140 | //......................................................................... | 138 | //......................................................................... |
141 | 139 | ||
142 | 'searchClickDeferredHandler': function (aFilterElement, aValue) { | 140 | 'searchClickDeferredHandler': function (aFilterElement, aValue) { |
143 | if (aValue != null) { | 141 | if (aValue != null) { |
144 | aFilterElement.value = aValue; | 142 | aFilterElement.value = aValue; |
145 | } | 143 | } |
146 | 144 | ||
147 | this.decrementPendingSearchClicks(); | 145 | this.decrementPendingSearchClicks(); |
148 | if (this.pendingSearchClicks()==0) { | 146 | if (this.pendingSearchClicks()==0) { |
149 | this._setFilter(aFilterElement, aFilterElement.value); | 147 | this._setFilter(aFilterElement, aFilterElement.value); |
150 | } | 148 | } |
151 | }, | 149 | }, |
152 | 150 | ||
153 | //----------------------------------------------------------------------------- | 151 | //----------------------------------------------------------------------------- |
154 | 'syntaxFix': 'syntax fix' | 152 | 'syntaxFix': 'syntax fix' |
155 | }); \ No newline at end of file | 153 | }); \ 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 index 8bb3016..44fbdef 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js | |||
@@ -1,214 +1,212 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.GridController = function(args) { | 26 | Clipperz.PM.UI.Web.Controllers.GridController = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Controllers.GridController.superclass.constructor.call(this, args); | 29 | Clipperz.PM.UI.Web.Controllers.GridController.superclass.constructor.call(this, args); |
32 | 30 | ||
33 | this._grid = null; | 31 | this._grid = null; |
34 | this._user = null; | 32 | this._user = null; |
35 | this._sortedColumnManager = null; | 33 | this._sortedColumnManager = null; |
36 | this._cachedObjects = null; | 34 | this._cachedObjects = null; |
37 | this._filterController = args.filterController || null; | 35 | this._filterController = args.filterController || null; |
38 | 36 | ||
39 | this._deferredDisplaySelectedRowsInvocation = null; | 37 | this._deferredDisplaySelectedRowsInvocation = null; |
40 | 38 | ||
41 | return this; | 39 | return this; |
42 | }; | 40 | }; |
43 | 41 | ||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.GridController, Object, { | 42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.GridController, Object, { |
45 | 43 | ||
46 | 'toString': function() { | 44 | 'toString': function() { |
47 | return "Clipperz.PM.UI.Web.Controllers.GridController"; | 45 | return "Clipperz.PM.UI.Web.Controllers.GridController"; |
48 | }, | 46 | }, |
49 | 47 | ||
50 | //----------------------------------------------------------------------------- | 48 | //----------------------------------------------------------------------------- |
51 | 49 | ||
52 | 'createGrid': function () { | 50 | 'createGrid': function () { |
53 | throw Clipperz.Base.exception.AbstractMethod; | 51 | throw Clipperz.Base.exception.AbstractMethod; |
54 | }, | 52 | }, |
55 | 53 | ||
56 | 'setupWithGrid': function (aGrid) { | 54 | 'setupWithGrid': function (aGrid) { |
57 | this._grid = aGrid; | 55 | this._grid = aGrid; |
58 | 56 | ||
59 | if (this._grid != null) { | 57 | if (this._grid != null) { |
60 | MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) { | 58 | MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) { |
61 | if (aColumnManager.isSortable()) { | 59 | if (aColumnManager.isSortable()) { |
62 | if (aColumnManager.isSorted()) { | 60 | if (aColumnManager.isSorted()) { |
63 | this.setSortedColumnManager(aColumnManager); | 61 | this.setSortedColumnManager(aColumnManager); |
64 | } | 62 | } |
65 | MochiKit.Signal.connect(aColumnManager, 'sort', this, 'handleColumnManagerSort'); | 63 | MochiKit.Signal.connect(aColumnManager, 'sort', this, 'handleColumnManagerSort'); |
66 | } | 64 | } |
67 | MochiKit.Signal.connect(aColumnManager, 'selectRow', this, 'handleColumnManagerSelectRow'); | 65 | MochiKit.Signal.connect(aColumnManager, 'selectRow', this, 'handleColumnManagerSelectRow'); |
68 | MochiKit.Signal.connect(aColumnManager, 'unselectRow', this, 'handleColumnManagerUnselectRow'); | 66 | MochiKit.Signal.connect(aColumnManager, 'unselectRow', this, 'handleColumnManagerUnselectRow'); |
69 | }, this); | 67 | }, this); |
70 | } | 68 | } |
71 | }, | 69 | }, |
72 | 70 | ||
73 | 'grid': function() { | 71 | 'grid': function() { |
74 | if (this._grid == null) { | 72 | if (this._grid == null) { |
75 | this.setupWithGrid(this.createGrid()); | 73 | this.setupWithGrid(this.createGrid()); |
76 | } | 74 | } |
77 | 75 | ||
78 | return this._grid; | 76 | return this._grid; |
79 | }, | 77 | }, |
80 | 78 | ||
81 | 'filterController': function () { | 79 | 'filterController': function () { |
82 | //Clipperz.log('GridController.filterController >>>', this._filterController); | 80 | //Clipperz.log('GridController.filterController >>>', this._filterController); |
83 | if (this._filterController == null) { | 81 | if (this._filterController == null) { |
84 | this._filterController = new Clipperz.PM.UI.Web.Controllers.FilterController(); | 82 | this._filterController = new Clipperz.PM.UI.Web.Controllers.FilterController(); |
85 | } | 83 | } |
86 | //Clipperz.log('GridController.filterController <<<', this._filterController); | 84 | //Clipperz.log('GridController.filterController <<<', this._filterController); |
87 | return this._filterController; | 85 | return this._filterController; |
88 | }, | 86 | }, |
89 | 87 | ||
90 | //----------------------------------------------------------------------------- | 88 | //----------------------------------------------------------------------------- |
91 | 89 | ||
92 | 'columnsManagers': function () { | 90 | 'columnsManagers': function () { |
93 | return this.grid().columnsManagers(); | 91 | return this.grid().columnsManagers(); |
94 | }, | 92 | }, |
95 | 93 | ||
96 | 'columnManagerWithName': function (aName) { | 94 | 'columnManagerWithName': function (aName) { |
97 | varmanagers; | 95 | varmanagers; |
98 | var result; | 96 | var result; |
99 | 97 | ||
100 | managers = MochiKit.Base.filter(function (aManager) { return aManager.name() == aName; } , this.columnsManagers()); | 98 | managers = MochiKit.Base.filter(function (aManager) { return aManager.name() == aName; } , this.columnsManagers()); |
101 | 99 | ||
102 | if (managers.length == 1) { | 100 | if (managers.length == 1) { |
103 | result = managers[0]; | 101 | result = managers[0]; |
104 | } else if (managers.length == 0) { | 102 | } else if (managers.length == 0) { |
105 | result = null; | 103 | result = null; |
106 | } else { | 104 | } else { |
107 | throw "WTF!!!"; | 105 | throw "WTF!!!"; |
108 | } | 106 | } |
109 | 107 | ||
110 | return result; | 108 | return result; |
111 | }, | 109 | }, |
112 | 110 | ||
113 | 'sortedColumnManager': function () { | 111 | 'sortedColumnManager': function () { |
114 | return this._sortedColumnManager; | 112 | return this._sortedColumnManager; |
115 | }, | 113 | }, |
116 | 114 | ||
117 | 'setSortedColumnManager': function(aValue) { | 115 | 'setSortedColumnManager': function(aValue) { |
118 | if (aValue.sorted() != 'UNSORTED') { | 116 | if (aValue.sorted() != 'UNSORTED') { |
119 | this._sortedColumnManager = aValue; | 117 | this._sortedColumnManager = aValue; |
120 | } else { | 118 | } else { |
121 | this._sortedColumnManager = null; | 119 | this._sortedColumnManager = null; |
122 | } | 120 | } |
123 | }, | 121 | }, |
124 | 122 | ||
125 | //----------------------------------------------------------------------------- | 123 | //----------------------------------------------------------------------------- |
126 | 124 | ||
127 | 'handleColumnManagerSort': function(aSelectedColumnManager) { | 125 | 'handleColumnManagerSort': function(aSelectedColumnManager) { |
128 | MochiKit.Iter.forEach(this.columnsManagers(), function(aColumnManager) { | 126 | MochiKit.Iter.forEach(this.columnsManagers(), function(aColumnManager) { |
129 | if (aSelectedColumnManager != aColumnManager) { | 127 | if (aSelectedColumnManager != aColumnManager) { |
130 | if (aColumnManager.isSortable()) { | 128 | if (aColumnManager.isSortable()) { |
131 | aColumnManager.setSorted('UNSORTED'); | 129 | aColumnManager.setSorted('UNSORTED'); |
132 | } | 130 | } |
133 | } | 131 | } |
134 | }); | 132 | }); |
135 | 133 | ||
136 | aSelectedColumnManager.toggleSorting(); | 134 | aSelectedColumnManager.toggleSorting(); |
137 | this.setSortedColumnManager(aSelectedColumnManager); | 135 | this.setSortedColumnManager(aSelectedColumnManager); |
138 | 136 | ||
139 | this.displaySelectedRows(this.filterController().getFilter()); | 137 | this.displaySelectedRows(this.filterController().getFilter()); |
140 | }, | 138 | }, |
141 | 139 | ||
142 | 'handleColumnManagerSelectRow': function (aRowObject) { | 140 | 'handleColumnManagerSelectRow': function (aRowObject) { |
143 | this.grid().selectRow(aRowObject); | 141 | this.grid().selectRow(aRowObject); |
144 | }, | 142 | }, |
145 | 143 | ||
146 | 'handleColumnManagerUnselectRow': function (aRowObject) { | 144 | 'handleColumnManagerUnselectRow': function (aRowObject) { |
147 | this.grid().unselectRow(aRowObject); | 145 | this.grid().unselectRow(aRowObject); |
148 | }, | 146 | }, |
149 | 147 | ||
150 | //----------------------------------------------------------------------------- | 148 | //----------------------------------------------------------------------------- |
151 | 149 | ||
152 | 'handleFilterUpdated': function (aFilter) { | 150 | 'handleFilterUpdated': function (aFilter) { |
153 | if (this.grid().isActive()) { | 151 | if (this.grid().isActive()) { |
154 | this.displaySelectedRows(aFilter); | 152 | this.displaySelectedRows(aFilter); |
155 | } | 153 | } |
156 | }, | 154 | }, |
157 | 155 | ||
158 | //----------------------------------------------------------------------------- | 156 | //----------------------------------------------------------------------------- |
159 | //TODO: relying on user() in GridController, bad code smell :| | 157 | //TODO: relying on user() in GridController, bad code smell :| |
160 | //mhh: a controller should have access to business logic object too. Otherwise it will fail its controller role. [Giulio Cesare] | 158 | //mhh: a controller should have access to business logic object too. Otherwise it will fail its controller role. [Giulio Cesare] |
161 | 159 | ||
162 | 'setUser': function(anUser) { | 160 | 'setUser': function(anUser) { |
163 | this._user = anUser; | 161 | this._user = anUser; |
164 | }, | 162 | }, |
165 | 163 | ||
166 | 'user': function() { | 164 | 'user': function() { |
167 | return this._user; | 165 | return this._user; |
168 | }, | 166 | }, |
169 | 167 | ||
170 | //----------------------------------------------------------------------------- | 168 | //----------------------------------------------------------------------------- |
171 | 169 | ||
172 | 'run': function(args) { | 170 | 'run': function(args) { |
173 | //Clipperz.log("=== GridController.run"); | 171 | //Clipperz.log("=== GridController.run"); |
174 | var deferredResult; | 172 | var deferredResult; |
175 | 173 | ||
176 | this.setUser(args.user); | 174 | this.setUser(args.user); |
177 | args.slot.setContent(this.grid()); | 175 | args.slot.setContent(this.grid()); |
178 | this.filterController().registerFilterElement(this.grid().filterElement()); | 176 | this.filterController().registerFilterElement(this.grid().filterElement()); |
179 | MochiKit.Signal.connect(this.filterController(), 'filterUpdated', this, 'handleFilterUpdated'); | 177 | MochiKit.Signal.connect(this.filterController(), 'filterUpdated', this, 'handleFilterUpdated'); |
180 | 178 | ||
181 | return this.displaySelectedRows(); | 179 | return this.displaySelectedRows(); |
182 | }, | 180 | }, |
183 | 181 | ||
184 | //----------------------------------------------------------------------------- | 182 | //----------------------------------------------------------------------------- |
185 | 183 | ||
186 | 'handleGenericError': function(anError) { | 184 | 'handleGenericError': function(anError) { |
187 | var result; | 185 | var result; |
188 | 186 | ||
189 | if (anError instanceof MochiKit.Async.CancelledError) { | 187 | if (anError instanceof MochiKit.Async.CancelledError) { |
190 | result = anError; | 188 | result = anError; |
191 | } else { | 189 | } else { |
192 | Clipperz.log("## GridController - GENERIC ERROR" + "\n" + "==>> " + anError + " <<==\n" + anError.stack); | 190 | Clipperz.log("## GridController - GENERIC ERROR" + "\n" + "==>> " + anError + " <<==\n" + anError.stack); |
193 | result = new MochiKit.Async.CancelledError(anError); | 191 | result = new MochiKit.Async.CancelledError(anError); |
194 | } | 192 | } |
195 | 193 | ||
196 | return result; | 194 | return result; |
197 | }, | 195 | }, |
198 | 196 | ||
199 | //----------------------------------------------------------------------------- | 197 | //----------------------------------------------------------------------------- |
200 | 198 | ||
201 | 'getRows': function () { | 199 | 'getRows': function () { |
202 | throw Clipperz.Base.AbstractMethod; | 200 | throw Clipperz.Base.AbstractMethod; |
203 | }, | 201 | }, |
204 | 202 | ||
205 | //----------------------------------------------------------------------------- | 203 | //----------------------------------------------------------------------------- |
206 | 204 | ||
207 | 'setDeferredDisplaySelectedRowsInvocation': function (aDeferred) { | 205 | 'setDeferredDisplaySelectedRowsInvocation': function (aDeferred) { |
208 | if (this._deferredDisplaySelectedRowsInvocation != null) { | 206 | if (this._deferredDisplaySelectedRowsInvocation != null) { |
209 | this._deferredDisplaySelectedRowsInvocation.cancel(); | 207 | this._deferredDisplaySelectedRowsInvocation.cancel(); |
210 | } | 208 | } |
211 | 209 | ||
212 | this._deferredDisplaySelectedRowsInvocation = aDeferred; | 210 | this._deferredDisplaySelectedRowsInvocation = aDeferred; |
213 | }, | 211 | }, |
214 | 212 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js index a57152d..ac85d36 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js | |||
@@ -1,250 +1,246 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.LoginController = function(args) { | 26 | Clipperz.PM.UI.Web.Controllers.LoginController = function(args) { |
29 | this._args = args || {}; | 27 | this._args = args || {}; |
30 | 28 | ||
31 | this._loginPage = null; | 29 | this._loginPage = null; |
32 | 30 | ||
33 | this._newUserWizardController = null; | 31 | this._newUserWizardController = null; |
34 | this._newUserCreationComponent = null; | 32 | this._newUserCreationComponent = null; |
35 | 33 | ||
36 | return this; | 34 | return this; |
37 | } | 35 | } |
38 | 36 | ||
39 | MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.LoginController.prototype, { | 37 | MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.LoginController.prototype, { |
40 | 38 | ||
41 | 'toString': function() { | 39 | 'toString': function() { |
42 | return "Clipperz.PM.UI.Web.Controllers.LoginController"; | 40 | return "Clipperz.PM.UI.Web.Controllers.LoginController"; |
43 | }, | 41 | }, |
44 | 42 | ||
45 | 'args': function () { | 43 | 'args': function () { |
46 | return this._args; | 44 | return this._args; |
47 | }, | 45 | }, |
48 | 46 | ||
49 | //----------------------------------------------------------------------------- | 47 | //----------------------------------------------------------------------------- |
50 | 48 | ||
51 | 'loginPage': function() { | 49 | 'loginPage': function() { |
52 | if (this._loginPage == null) { | 50 | if (this._loginPage == null) { |
53 | this._loginPage = new Clipperz.PM.UI.Web.Components.LoginPage(); | 51 | this._loginPage = new Clipperz.PM.UI.Web.Components.LoginPage(); |
54 | 52 | ||
55 | MochiKit.Signal.connect(this._loginPage, 'createNewAccountClick', this, 'handleCreateNewAccountClick') | 53 | MochiKit.Signal.connect(this._loginPage, 'createNewAccountClick', this, 'handleCreateNewAccountClick') |
56 | } | 54 | } |
57 | 55 | ||
58 | return this._loginPage; | 56 | return this._loginPage; |
59 | }, | 57 | }, |
60 | 58 | ||
61 | //----------------------------------------------------------------------------- | 59 | //----------------------------------------------------------------------------- |
62 | 60 | ||
63 | 'run': function(args) { | 61 | 'run': function(args) { |
64 | varslot; | 62 | varslot; |
65 | varloginPage; | 63 | varloginPage; |
66 | varloginForm; | 64 | varloginForm; |
67 | 65 | ||
68 | slot = args.slot; | 66 | slot = args.slot; |
69 | 67 | ||
70 | loginForm =new Clipperz.PM.UI.Web.Components.LoginForm({'autocomplete': this.args()['autocomplete']}); | 68 | loginForm =new Clipperz.PM.UI.Web.Components.LoginForm({'autocomplete': this.args()['autocomplete']}); |
71 | 69 | ||
72 | slot.setContent(this.loginPage()); | 70 | slot.setContent(this.loginPage()); |
73 | this.loginPage().slotNamed('loginForm').setContent(loginForm); | 71 | this.loginPage().slotNamed('loginForm').setContent(loginForm); |
74 | 72 | ||
75 | MochiKit.Signal.connect(loginForm, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm)); | 73 | MochiKit.Signal.connect(loginForm, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm)); |
76 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm)); | 74 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm)); |
77 | }, | 75 | }, |
78 | 76 | ||
79 | //----------------------------------------------------------------------------- | 77 | //----------------------------------------------------------------------------- |
80 | 78 | ||
81 | 'doLogin': function(aLoginForm, anEvent) { | 79 | 'doLogin': function(aLoginForm, anEvent) { |
82 | var deferredResult; | 80 | var deferredResult; |
83 | varparameters; | 81 | varparameters; |
84 | var loginProgress; | 82 | var loginProgress; |
85 | varuser; | 83 | varuser; |
86 | var getPassphraseDelegate; | 84 | var getPassphraseDelegate; |
87 | 85 | ||
88 | parameters = anEvent; | 86 | parameters = anEvent; |
89 | 87 | ||
90 | getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, parameters.passphrase); | 88 | getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, parameters.passphrase); |
91 | user = new Clipperz.PM.DataModel.User({'username':parameters.username, 'getPassphraseFunction':MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'getPassphrase')}); | 89 | user = new Clipperz.PM.DataModel.User({'username':parameters.username, 'getPassphraseFunction':MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'getPassphrase')}); |
92 | 90 | ||
93 | loginProgress = new Clipperz.PM.UI.Web.Components.LoginProgress(); | 91 | loginProgress = new Clipperz.PM.UI.Web.Components.LoginProgress(); |
94 | 92 | ||
95 | deferredResult = new Clipperz.Async.Deferred("LoginController.doLogin", {trace:false}); | 93 | deferredResult = new Clipperz.Async.Deferred("LoginController.doLogin", {trace:false}); |
96 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4}); | 94 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4}); |
97 | deferredResult.addMethod(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', getPassphraseDelegate); | 95 | deferredResult.addMethod(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', getPassphraseDelegate); |
98 | deferredResult.addMethod(loginProgress, 'deferredShowModal', {deferredObject:deferredResult, openFromElement:aLoginForm.submitButtonElement()}); | 96 | deferredResult.addMethod(loginProgress, 'deferredShowModal', {deferredObject:deferredResult, openFromElement:aLoginForm.submitButtonElement()}); |
99 | deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'); | 97 | deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'); |
100 | deferredResult.addMethod(user, 'login'); | 98 | deferredResult.addMethod(user, 'login'); |
101 | deferredResult.addCallback(function(aLoginProgress, res) { | 99 | deferredResult.addCallback(function(aLoginProgress, res) { |
102 | aLoginProgress.disableCancel(); | 100 | aLoginProgress.disableCancel(); |
103 | return res; | 101 | return res; |
104 | }, loginProgress); | 102 | }, loginProgress); |
105 | deferredResult.addCallback(function () { | 103 | deferredResult.addCallback(function () { |
106 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN',MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:MochiKit.DOM.currentDocument().body})); | 104 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN',MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:MochiKit.DOM.currentDocument().body})); |
107 | }) | 105 | }) |
108 | deferredResult.addMethod(this, 'userLoggedIn', user, loginProgress, aLoginForm); | 106 | deferredResult.addMethod(this, 'userLoggedIn', user, loginProgress, aLoginForm); |
109 | deferredResult.addErrback (MochiKit.Base.method(this, 'handleFailedLogin', loginProgress)); | 107 | deferredResult.addErrback (MochiKit.Base.method(this, 'handleFailedLogin', loginProgress)); |
110 | 108 | ||
111 | deferredResult.addErrback (MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:aLoginForm.submitButtonElement()})); | 109 | deferredResult.addErrback (MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:aLoginForm.submitButtonElement()})); |
112 | deferredResult.addErrbackPass (MochiKit.Base.method(aLoginForm, 'focusOnPassphraseField')); | 110 | deferredResult.addErrbackPass (MochiKit.Base.method(aLoginForm, 'focusOnPassphraseField')); |
113 | deferredResult.addBoth(MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'removePassphraseDelegate', getPassphraseDelegate)); | 111 | deferredResult.addBoth(MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'removePassphraseDelegate', getPassphraseDelegate)); |
114 | deferredResult.callback(); | 112 | deferredResult.callback(); |
115 | 113 | ||
116 | MochiKit.Signal.connect(loginProgress, 'cancelEvent', deferredResult, 'cancel'); | 114 | MochiKit.Signal.connect(loginProgress, 'cancelEvent', deferredResult, 'cancel'); |
117 | 115 | ||
118 | return deferredResult; | 116 | return deferredResult; |
119 | }, | 117 | }, |
120 | 118 | ||
121 | //----------------------------------------------------------------------------- | 119 | //----------------------------------------------------------------------------- |
122 | 120 | ||
123 | 'userLoggedIn': function(aUser) { | 121 | 'userLoggedIn': function(aUser) { |
124 | //Clipperz.log(">>> LoginController.userLoggedIn"); | 122 | //Clipperz.log(">>> LoginController.userLoggedIn"); |
125 | MochiKit.Signal.signal(this, 'userLoggedIn', {user: aUser}); | 123 | MochiKit.Signal.signal(this, 'userLoggedIn', {user: aUser}); |
126 | //Clipperz.log("<<< LoginController.userLoggedIn"); | 124 | //Clipperz.log("<<< LoginController.userLoggedIn"); |
127 | }, | 125 | }, |
128 | 126 | ||
129 | //========================================================================= | 127 | //========================================================================= |
130 | 128 | ||
131 | 'handleCreateNewAccountClick': function (aComponent) { | 129 | 'handleCreateNewAccountClick': function (aComponent) { |
132 | // return Clipperz.PM.DataModel.User.registerNewAccount("new", "user"); | 130 | // return Clipperz.PM.DataModel.User.registerNewAccount("new", "user"); |
133 | return Clipperz.Async.callbacks("LoginController.handleCreateNewAccountClick", [ | 131 | return Clipperz.Async.callbacks("LoginController.handleCreateNewAccountClick", [ |
134 | //' MochiKit.Base.method(this, 'newUserCreationComponent'), | 132 | //' MochiKit.Base.method(this, 'newUserCreationComponent'), |
135 | // MochiKit.Base.methodcaller('deferredShowModal', {openFromElement:aComponent}), | 133 | // MochiKit.Base.methodcaller('deferredShowModal', {openFromElement:aComponent}), |
136 | // MochiKit.Base.method(this.newUserWizardController(), 'run') | 134 | // MochiKit.Base.method(this.newUserWizardController(), 'run') |
137 | 135 | ||
138 | 136 | ||
139 | MochiKit.Base.method(this, 'newUserCreationComponent'), | 137 | MochiKit.Base.method(this, 'newUserCreationComponent'), |
140 | Clipperz.Async.forkAndJoin("Async.test succeedingForkedAndWaitDeferrer", [ | 138 | Clipperz.Async.forkAndJoin("Async.test succeedingForkedAndWaitDeferrer", [ |
141 | MochiKit.Base.method(this.newUserCreationComponent(), 'deferredShowModal', {openFromElement:aComponent, duration:0.5}), | 139 | MochiKit.Base.method(this.newUserCreationComponent(), 'deferredShowModal', {openFromElement:aComponent, duration:0.5}), |
142 | MochiKit.Base.method(this.newUserWizardController(), 'run') | 140 | MochiKit.Base.method(this.newUserWizardController(), 'run') |
143 | ], {trace:false}), | 141 | ], {trace:false}), |
144 | // MochiKit.Base.method(this.newUserCreationComponent(), 'enableCredentialsField') | 142 | // MochiKit.Base.method(this.newUserCreationComponent(), 'enableCredentialsField') |
145 | ], {trace:false}); | 143 | ], {trace:false}); |
146 | }, | 144 | }, |
147 | 145 | ||
148 | //----------------------------------------------------------------------------- | 146 | //----------------------------------------------------------------------------- |
149 | 147 | ||
150 | 'newUserWizardController': function () { | 148 | 'newUserWizardController': function () { |
151 | if (this._newUserWizardController == null) { | 149 | if (this._newUserWizardController == null) { |
152 | this._newUserWizardController = new Clipperz.PM.UI.Web.Controllers.NewUserWizardController({ | 150 | this._newUserWizardController = new Clipperz.PM.UI.Web.Controllers.NewUserWizardController({ |
153 | 'newUserCreationComponent': this.newUserCreationComponent() | 151 | 'newUserCreationComponent': this.newUserCreationComponent() |
154 | }) | 152 | }) |
155 | 153 | ||
156 | // MochiKit.Signal.connect(this._newUserWizardController, 'exit',this, 'handleHideNewUserCreationComponent'); | 154 | // MochiKit.Signal.connect(this._newUserWizardController, 'exit',this, 'handleHideNewUserCreationComponent'); |
157 | MochiKit.Signal.connect(this._newUserWizardController, 'done',this, 'handleCompleteNewUserCreationComponent'); | 155 | MochiKit.Signal.connect(this._newUserWizardController, 'done',this, 'handleCompleteNewUserCreationComponent'); |
158 | } | 156 | } |
159 | 157 | ||
160 | return this._newUserWizardController; | 158 | return this._newUserWizardController; |
161 | }, | 159 | }, |
162 | 160 | ||
163 | //------------------------------------------------------------------------- | 161 | //------------------------------------------------------------------------- |
164 | 162 | ||
165 | 'newUserCreationComponent': function () { | 163 | 'newUserCreationComponent': function () { |
166 | if (this._newUserCreationComponent == null) { | 164 | if (this._newUserCreationComponent == null) { |
167 | this._newUserCreationComponent = new Clipperz.PM.UI.Web.Components.NewUserCreationComponent(); | 165 | this._newUserCreationComponent = new Clipperz.PM.UI.Web.Components.NewUserCreationComponent(); |
168 | } | 166 | } |
169 | 167 | ||
170 | return this._newUserCreationComponent; | 168 | return this._newUserCreationComponent; |
171 | }, | 169 | }, |
172 | 170 | ||
173 | 'clearNewUserCreationComponent': function () { | 171 | 'clearNewUserCreationComponent': function () { |
174 | if (this._newUserCreationComponent != null) { | 172 | if (this._newUserCreationComponent != null) { |
175 | this._newUserCreationComponent.clear(); | 173 | this._newUserCreationComponent.clear(); |
176 | } | 174 | } |
177 | this._newUserCreationComponent = null; | 175 | this._newUserCreationComponent = null; |
178 | }, | 176 | }, |
179 | 177 | ||
180 | //------------------------------------------------------------------------- | 178 | //------------------------------------------------------------------------- |
181 | 179 | ||
182 | 'handleHideNewUserCreationComponent': function () { | 180 | 'handleHideNewUserCreationComponent': function () { |
183 | this.clearNewUserCreationComponent(); | 181 | this.clearNewUserCreationComponent(); |
184 | }, | 182 | }, |
185 | 183 | ||
186 | 'handleCompleteNewUserCreationComponent': function (someParameters) { | 184 | 'handleCompleteNewUserCreationComponent': function (someParameters) { |
187 | vardeferredResult; | 185 | vardeferredResult; |
188 | varuser; | 186 | varuser; |
189 | varnewUserCreationComponent; | 187 | varnewUserCreationComponent; |
190 | 188 | ||
191 | user = someParameters.user; | 189 | user = someParameters.user; |
192 | newUserCreationComponent = this.newUserCreationComponent(); | 190 | newUserCreationComponent = this.newUserCreationComponent(); |
193 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN',MochiKit.Base.method(newUserCreationComponent, 'deferredHideModal', {closeToElement:MochiKit.DOM.currentDocument().body})), | 191 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN',MochiKit.Base.method(newUserCreationComponent, 'deferredHideModal', {closeToElement:MochiKit.DOM.currentDocument().body})), |
194 | 192 | ||
195 | deferredResult = new Clipperz.Async.Deferred("LoginController.handleCompleteNewUserCreationComponent", {trace:false}); | 193 | deferredResult = new Clipperz.Async.Deferred("LoginController.handleCompleteNewUserCreationComponent", {trace:false}); |
196 | 194 | ||
197 | deferredResult.addCallbackList([ | 195 | deferredResult.addCallbackList([ |
198 | MochiKit.Base.method(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'), | 196 | MochiKit.Base.method(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'), |
199 | MochiKit.Base.method(user, 'login'), | 197 | MochiKit.Base.method(user, 'login'), |
200 | MochiKit.Base.method(this, 'userLoggedIn', user), | 198 | MochiKit.Base.method(this, 'userLoggedIn', user), |
201 | MochiKit.Base.method(this, 'clearNewUserCreationComponent') | 199 | MochiKit.Base.method(this, 'clearNewUserCreationComponent') |
202 | ]); | 200 | ]); |
203 | deferredResult.addErrback(function (aValue) { Clipperz.log("WTF!! Error doing the login after creating a new user" + aValue)}); | 201 | deferredResult.addErrback(function (aValue) { Clipperz.log("WTF!! Error doing the login after creating a new user" + aValue)}); |
204 | deferredResult.callback(); | 202 | deferredResult.callback(); |
205 | 203 | ||
206 | return deferredResult; | 204 | return deferredResult; |
207 | }, | 205 | }, |
208 | 206 | ||
209 | 207 | ||
210 | //========================================================================= | 208 | //========================================================================= |
211 | 209 | ||
212 | 'handleFailedLogin': function(aLoginProgress, anError) { | 210 | 'handleFailedLogin': function(aLoginProgress, anError) { |
213 | var result; | 211 | var result; |
214 | 212 | ||
215 | //console.log("anError", anError); | ||
216 | if (anError instanceof MochiKit.Async.CancelledError) { | 213 | if (anError instanceof MochiKit.Async.CancelledError) { |
217 | result = anError; | 214 | result = anError; |
218 | } else { | 215 | } else { |
219 | var deferredResult; | 216 | var deferredResult; |
220 | 217 | ||
221 | MochiKit.Logging.logError("## MainController - FAILED LOGIN: " + anError); | 218 | Clipperz.logError("## MainController - FAILED LOGIN: " + anError); |
222 | deferredResult = new MochiKit.Async.Deferred(); | 219 | deferredResult = new MochiKit.Async.Deferred(); |
223 | 220 | ||
224 | aLoginProgress.showErrorMessage("failed login"); | 221 | aLoginProgress.showErrorMessage("failed login"); |
225 | // Clipperz.NotificationCenter.register(loginProgress, 'cancelEvent', deferredResult, 'callback'); | 222 | // Clipperz.NotificationCenter.register(loginProgress, 'cancelEvent', deferredResult, 'callback'); |
226 | MochiKit.Signal.connect(aLoginProgress, 'cancelEvent', deferredResult, 'callback'); | 223 | MochiKit.Signal.connect(aLoginProgress, 'cancelEvent', deferredResult, 'callback'); |
227 | deferredResult.addCallback(MochiKit.Async.fail, anError) | 224 | deferredResult.addCallback(MochiKit.Async.fail, anError) |
228 | result = deferredResult; | 225 | result = deferredResult; |
229 | } | 226 | } |
230 | 227 | ||
231 | return result; | 228 | return result; |
232 | }, | 229 | }, |
233 | 230 | ||
234 | 'handleGenericError': function(anError) { | 231 | 'handleGenericError': function(anError) { |
235 | var result; | 232 | var result; |
236 | 233 | ||
237 | if (anError instanceof MochiKit.Async.CancelledError) { | 234 | if (anError instanceof MochiKit.Async.CancelledError) { |
238 | result = anError; | 235 | result = anError; |
239 | } else { | 236 | } else { |
240 | MochiKit.Logging.logError("## MainController - GENERIC ERROR" + "\n" + "==>> " + anError + " <<==\n" + anError.stack); | 237 | Clipperz.logError("## MainController - GENERIC ERROR" + "\n" + "==>> " + anError + " <<==\n" + anError.stack); |
241 | //console.log(anError); | ||
242 | result = new MochiKit.Async.CancelledError(anError); | 238 | result = new MochiKit.Async.CancelledError(anError); |
243 | } | 239 | } |
244 | 240 | ||
245 | return result; | 241 | return result; |
246 | }, | 242 | }, |
247 | 243 | ||
248 | //----------------------------------------------------------------------------- | 244 | //----------------------------------------------------------------------------- |
249 | __syntaxFix__: "syntax fix" | 245 | __syntaxFix__: "syntax fix" |
250 | }); | 246 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js index c83e3c0..9194125 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js | |||
@@ -1,215 +1,207 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.MainController = function(args) { | 26 | Clipperz.PM.UI.Web.Controllers.MainController = function(args) { |
29 | this._args = args; | 27 | this._args = args; |
30 | 28 | ||
31 | //controllers | 29 | //controllers |
32 | this._loginController =null; | 30 | this._loginController =null; |
33 | this._appController =null; | 31 | this._appController =null; |
34 | 32 | ||
35 | //components | 33 | //components |
36 | this._headerComponent = null; | 34 | this._headerComponent = null; |
37 | this._pageComponent =null; | 35 | this._pageComponent =null; |
38 | this._footerComponent = null; | 36 | this._footerComponent = null; |
39 | 37 | ||
40 | this._passphraseDelegateLock = new MochiKit.Async.DeferredLock(); | 38 | this._passphraseDelegateLock = new MochiKit.Async.DeferredLock(); |
41 | this._passphraseDelegateLock.acquire(); | 39 | this._passphraseDelegateLock.acquire(); |
42 | //Clipperz.log('MainController init _passphraseDelegateLock', this._passphraseDelegateLock); | 40 | //Clipperz.log('MainController init _passphraseDelegateLock', this._passphraseDelegateLock); |
43 | this._passphraseDelegate = null; | 41 | this._passphraseDelegate = null; |
44 | 42 | ||
45 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'remoteRequestSent', this, 'handleRemoteRequestSent'); | 43 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'remoteRequestSent', this, 'handleRemoteRequestSent'); |
46 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'remoteRequestReceived',this, 'handleRemoteRequestReceived'); | 44 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'remoteRequestReceived',this, 'handleRemoteRequestReceived'); |
47 | 45 | ||
48 | return this; | 46 | return this; |
49 | } | 47 | } |
50 | 48 | ||
51 | MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.MainController.prototype, { | 49 | MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.MainController.prototype, { |
52 | 50 | ||
53 | 'toString': function() { | 51 | 'toString': function() { |
54 | return "Clipperz.PM.UI.Web.Controllers.MainController"; | 52 | return "Clipperz.PM.UI.Web.Controllers.MainController"; |
55 | }, | 53 | }, |
56 | 54 | ||
57 | 'args': function () { | 55 | 'args': function () { |
58 | return this._args; | 56 | return this._args; |
59 | }, | 57 | }, |
60 | 58 | ||
61 | //----------------------------------------------------------------------------- | 59 | //----------------------------------------------------------------------------- |
62 | 60 | ||
63 | 'headerComponent': function() { | 61 | 'headerComponent': function() { |
64 | if (this._headerComponent == null) { | 62 | if (this._headerComponent == null) { |
65 | this._headerComponent = new Clipperz.PM.UI.Web.Components.PageHeader(); | 63 | this._headerComponent = new Clipperz.PM.UI.Web.Components.PageHeader(); |
66 | } | 64 | } |
67 | 65 | ||
68 | return this._headerComponent; | 66 | return this._headerComponent; |
69 | }, | 67 | }, |
70 | 68 | ||
71 | 'footerComponent': function() { | 69 | 'footerComponent': function() { |
72 | if (this._footerComponent == null) { | 70 | if (this._footerComponent == null) { |
73 | this._footerComponent = new Clipperz.PM.UI.Web.Components.PageFooter(); | 71 | this._footerComponent = new Clipperz.PM.UI.Web.Components.PageFooter(); |
74 | } | 72 | } |
75 | 73 | ||
76 | return this._footerComponent; | 74 | return this._footerComponent; |
77 | }, | 75 | }, |
78 | 76 | ||
79 | //----------------------------------------------------------------------------- | 77 | //----------------------------------------------------------------------------- |
80 | 78 | ||
81 | 'pageComponent': function() { | 79 | 'pageComponent': function() { |
82 | if (this._pageComponent == null) { | 80 | if (this._pageComponent == null) { |
83 | this._pageComponent = new Clipperz.PM.UI.Web.Components.Page({element:MochiKit.DOM.getElement('mainDiv')}); | 81 | this._pageComponent = new Clipperz.PM.UI.Web.Components.Page({element:MochiKit.DOM.getElement('mainDiv')}); |
84 | } | 82 | } |
85 | 83 | ||
86 | return this._pageComponent; | 84 | return this._pageComponent; |
87 | }, | 85 | }, |
88 | 86 | ||
89 | //----------------------------------------------------------------------------- | 87 | //----------------------------------------------------------------------------- |
90 | 88 | ||
91 | 'loginController': function() { | 89 | 'loginController': function() { |
92 | if (this._loginController == null) { | 90 | if (this._loginController == null) { |
93 | this._loginController = new Clipperz.PM.UI.Web.Controllers.LoginController(this.args()); | 91 | this._loginController = new Clipperz.PM.UI.Web.Controllers.LoginController(this.args()); |
94 | 92 | ||
95 | MochiKit.Signal.connect(this._loginController, 'userLoggedIn', this, 'loginControllerUserLoggedInCallback'); | 93 | MochiKit.Signal.connect(this._loginController, 'userLoggedIn', this, 'loginControllerUserLoggedInCallback'); |
96 | } | 94 | } |
97 | 95 | ||
98 | return this._loginController; | 96 | return this._loginController; |
99 | }, | 97 | }, |
100 | 98 | ||
101 | 'appController': function() { | 99 | 'appController': function() { |
102 | if (this._appController == null) { | 100 | if (this._appController == null) { |
103 | this._appController = new Clipperz.PM.UI.Web.Controllers.AppController(); | 101 | this._appController = new Clipperz.PM.UI.Web.Controllers.AppController(); |
104 | 102 | ||
105 | MochiKit.Signal.connect(this._appController, 'logout', this, 'handleLogout'); | 103 | MochiKit.Signal.connect(this._appController, 'logout', this, 'handleLogout'); |
106 | } | 104 | } |
107 | 105 | ||
108 | return this._appController; | 106 | return this._appController; |
109 | }, | 107 | }, |
110 | 108 | ||
111 | //----------------------------------------------------------------------------- | 109 | //----------------------------------------------------------------------------- |
112 | 110 | ||
113 | 'run': function(shoudShowRegistrationForm) { | 111 | 'run': function(shoudShowRegistrationForm) { |
114 | this.pageComponent().slotNamed('header').setContent(this.headerComponent()); | 112 | this.pageComponent().slotNamed('header').setContent(this.headerComponent()); |
115 | this.pageComponent().slotNamed('footer').setContent(this.footerComponent()); | 113 | this.pageComponent().slotNamed('footer').setContent(this.footerComponent()); |
116 | 114 | ||
117 | this.pageComponent().render(); | 115 | this.pageComponent().render(); |
118 | 116 | ||
119 | this.loginController().run({slot:this.pageComponent().slotNamed('body')}); | 117 | this.loginController().run({slot:this.pageComponent().slotNamed('body')}); |
120 | 118 | ||
121 | if (shoudShowRegistrationForm) { | 119 | if (shoudShowRegistrationForm) { |
122 | MochiKit.Signal.signal(this.loginController().loginPage(), 'createNewAccountClick'); | 120 | MochiKit.Signal.signal(this.loginController().loginPage(), 'createNewAccountClick'); |
123 | // this.loginController().handleCreateNewAccountClick(); | 121 | // this.loginController().handleCreateNewAccountClick(); |
124 | } | 122 | } |
125 | }, | 123 | }, |
126 | 124 | ||
127 | //----------------------------------------------------------------------------- | 125 | //----------------------------------------------------------------------------- |
128 | 126 | ||
129 | 'getPassphrase': function () { | 127 | 'getPassphrase': function () { |
130 | var deferredResult; | 128 | var deferredResult; |
131 | 129 | ||
132 | deferredResult = new Clipperz.Async.Deferred("MainController.getPassphrase", {trace:false}); | 130 | deferredResult = new Clipperz.Async.Deferred("MainController.getPassphrase", {trace:false}); |
133 | 131 | ||
134 | deferredResult.acquireLock(this._passphraseDelegateLock); | 132 | deferredResult.acquireLock(this._passphraseDelegateLock); |
135 | deferredResult.addMethod(this, 'invokePassphraseDelegate'); | 133 | deferredResult.addMethod(this, 'invokePassphraseDelegate'); |
136 | deferredResult.releaseLock(this._passphraseDelegateLock); | 134 | deferredResult.releaseLock(this._passphraseDelegateLock); |
137 | deferredResult.callback(); | 135 | deferredResult.callback(); |
138 | 136 | ||
139 | return deferredResult; | 137 | return deferredResult; |
140 | }, | 138 | }, |
141 | 139 | ||
142 | //......................................................................... | 140 | //......................................................................... |
143 | 141 | ||
144 | 'invokePassphraseDelegate': function () { | 142 | 'invokePassphraseDelegate': function () { |
145 | return this._passphraseDelegate(); | 143 | return this._passphraseDelegate(); |
146 | }, | 144 | }, |
147 | 145 | ||
148 | 'passphraseDelegateLock': function () { | 146 | 'passphraseDelegateLock': function () { |
149 | return this._passphraseDelegateLock; | 147 | return this._passphraseDelegateLock; |
150 | }, | 148 | }, |
151 | 149 | ||
152 | //......................................................................... | 150 | //......................................................................... |
153 | 151 | ||
154 | 'setPassphraseDelegate': function (aDelegate) { | 152 | 'setPassphraseDelegate': function (aDelegate) { |
155 | var shouldReleaseLock; | 153 | var shouldReleaseLock; |
156 | 154 | ||
157 | shouldReleaseLock = (this._passphraseDelegate == null); | 155 | shouldReleaseLock = (this._passphraseDelegate == null); |
158 | 156 | ||
159 | this._passphraseDelegate = aDelegate; | 157 | this._passphraseDelegate = aDelegate; |
160 | 158 | ||
161 | if (shouldReleaseLock) { | 159 | if (shouldReleaseLock) { |
162 | this._passphraseDelegateLock.release(); | 160 | this._passphraseDelegateLock.release(); |
163 | } | 161 | } |
164 | }, | 162 | }, |
165 | 163 | ||
166 | //......................................................................... | 164 | //......................................................................... |
167 | 165 | ||
168 | 'removePassphraseDelegate': function (aDelegate) { | 166 | 'removePassphraseDelegate': function (aDelegate) { |
169 | if (this._passphraseDelegate == aDelegate) { | 167 | if (this._passphraseDelegate == aDelegate) { |
170 | this._passphraseDelegate = null; | 168 | this._passphraseDelegate = null; |
171 | this._passphraseDelegateLock.acquire(); | 169 | this._passphraseDelegateLock.acquire(); |
172 | } | 170 | } |
173 | }, | 171 | }, |
174 | 172 | ||
175 | //------------------------------------------------------------------------- | 173 | //------------------------------------------------------------------------- |
176 | 174 | ||
177 | 'loginControllerUserLoggedInCallback': function(anEvent) { | 175 | 'loginControllerUserLoggedInCallback': function(anEvent) { |
178 | //Clipperz.log(">>> loginControllerUserLoggedInCallback", anEvent); | ||
179 | // this.setUser(anEvent.parameters()['user']); | ||
180 | //console.log("--- loginControllerUserLoggedInCallback - 1"); | ||
181 | |||
182 | //console.log("--- loginControllerUserLoggedInCallback - 2"); | ||
183 | this.headerComponent().switchToLoggedMode(); | 176 | this.headerComponent().switchToLoggedMode(); |
184 | this.appController().run({slot:this.pageComponent().slotNamed('body'), user:anEvent['user']}); | 177 | this.appController().run({slot:this.pageComponent().slotNamed('body'), user:anEvent['user']}); |
185 | //Clipperz.log("<<< loginControllerUserLoggedInCallback"); | ||
186 | }, | 178 | }, |
187 | 179 | ||
188 | //----------------------------------------------------------------------------- | 180 | //----------------------------------------------------------------------------- |
189 | 181 | ||
190 | 'handleRemoteRequestSent': function () { | 182 | 'handleRemoteRequestSent': function () { |
191 | //Clipperz.log("REMOTE REQUEST sent >>>"); | 183 | //Clipperz.log("REMOTE REQUEST sent >>>"); |
192 | }, | 184 | }, |
193 | 185 | ||
194 | 'handleRemoteRequestReceived': function () { | 186 | 'handleRemoteRequestReceived': function () { |
195 | //Clipperz.log("REMOTE REQUEST received <<<"); | 187 | //Clipperz.log("REMOTE REQUEST received <<<"); |
196 | }, | 188 | }, |
197 | 189 | ||
198 | //----------------------------------------------------------------------------- | 190 | //----------------------------------------------------------------------------- |
199 | 191 | ||
200 | 'handleLogout': function(anEvent) { | 192 | 'handleLogout': function(anEvent) { |
201 | this.exit('logout.html'); | 193 | this.exit('logout.html'); |
202 | }, | 194 | }, |
203 | 195 | ||
204 | //----------------------------------------------------------------------------- | 196 | //----------------------------------------------------------------------------- |
205 | 197 | ||
206 | 'exit': function(aPageName) { | 198 | 'exit': function(aPageName) { |
207 | //Clipperz.log("### exit " + aPageName); | 199 | //Clipperz.log("### exit " + aPageName); |
208 | MochiKit.Async.wait(0).addCallback(function() { | 200 | MochiKit.Async.wait(0).addCallback(function() { |
209 | window.location.href = "./" + aPageName + "?ln=" + Clipperz.PM.Strings.selectedLanguage; | 201 | window.location.href = "./" + aPageName + "?ln=" + Clipperz.PM.Strings.selectedLanguage; |
210 | }); | 202 | }); |
211 | }, | 203 | }, |
212 | 204 | ||
213 | //----------------------------------------------------------------------------- | 205 | //----------------------------------------------------------------------------- |
214 | __syntaxFix__: "syntax fix" | 206 | __syntaxFix__: "syntax fix" |
215 | }); | 207 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js index 7db6888..b70aa17 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js | |||
@@ -1,466 +1,458 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.NewUserWizardController = function(args) { | 26 | Clipperz.PM.UI.Web.Controllers.NewUserWizardController = function(args) { |
29 | this._newUserCreationComponent = args.newUserCreationComponent|| Clipperz.Base.exception.raise('MandatoryParameter'); | 27 | this._newUserCreationComponent = args.newUserCreationComponent|| Clipperz.Base.exception.raise('MandatoryParameter'); |
30 | 28 | ||
31 | MochiKit.Signal.connect(this._newUserCreationComponent, 'changedValue',this, 'handleChangedValue'); | 29 | MochiKit.Signal.connect(this._newUserCreationComponent, 'changedValue',this, 'handleChangedValue'); |
32 | MochiKit.Signal.connect(this._newUserCreationComponent, 'moveForward',this, 'handleMoveForward'); | 30 | MochiKit.Signal.connect(this._newUserCreationComponent, 'moveForward',this, 'handleMoveForward'); |
33 | MochiKit.Signal.connect(this._newUserCreationComponent, 'keyPressed',this, 'handleNewUserCreationComponentKeyPressed'); | 31 | MochiKit.Signal.connect(this._newUserCreationComponent, 'keyPressed',this, 'handleNewUserCreationComponentKeyPressed'); |
34 | 32 | ||
35 | this._rulerComponent = null; | 33 | this._rulerComponent = null; |
36 | 34 | ||
37 | this._steps = null; | 35 | this._steps = null; |
38 | this._currentStepIndex = 0; | 36 | this._currentStepIndex = 0; |
39 | this._isNextEnabled = false; | 37 | this._isNextEnabled = false; |
40 | 38 | ||
41 | this._userCreationState = 'IDLE'; //'IN PROGRESS', 'DONE', 'FAILED' | 39 | this._userCreationState = 'IDLE'; //'IN PROGRESS', 'DONE', 'FAILED' |
42 | this._user = null; | 40 | this._user = null; |
43 | return this; | 41 | return this; |
44 | } | 42 | } |
45 | 43 | ||
46 | MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prototype, { | 44 | MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prototype, { |
47 | 45 | ||
48 | 'toString': function() { | 46 | 'toString': function() { |
49 | return "Clipperz.PM.UI.Web.Controllers.NewUserWizardController"; | 47 | return "Clipperz.PM.UI.Web.Controllers.NewUserWizardController"; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
53 | 51 | ||
54 | 'newUserCreationComponent': function () { | 52 | 'newUserCreationComponent': function () { |
55 | return this._newUserCreationComponent; | 53 | return this._newUserCreationComponent; |
56 | }, | 54 | }, |
57 | 55 | ||
58 | //============================================================================= | 56 | //============================================================================= |
59 | 57 | ||
60 | 'user': function () { | 58 | 'user': function () { |
61 | return this._user; | 59 | return this._user; |
62 | }, | 60 | }, |
63 | 61 | ||
64 | 'setUser': function (aValue) { | 62 | 'setUser': function (aValue) { |
65 | this._user = aValue; | 63 | this._user = aValue; |
66 | }, | 64 | }, |
67 | 65 | ||
68 | //----------------------------------------------------------------------------- | 66 | //----------------------------------------------------------------------------- |
69 | 67 | ||
70 | 'userCreationState': function () { | 68 | 'userCreationState': function () { |
71 | return this._userCreationState; | 69 | return this._userCreationState; |
72 | }, | 70 | }, |
73 | 71 | ||
74 | 'setUserCreationState': function (aValue) { | 72 | 'setUserCreationState': function (aValue) { |
75 | //console.log("+++ NewUserWizardController.setUserCreationState", aValue); | ||
76 | this._userCreationState = aValue; | 73 | this._userCreationState = aValue; |
77 | this.checkState(); | 74 | this.checkState(); |
78 | }, | 75 | }, |
79 | 76 | ||
80 | //============================================================================= | 77 | //============================================================================= |
81 | 78 | ||
82 | 'resetCurrentStepIndex': function () { | 79 | 'resetCurrentStepIndex': function () { |
83 | this._currentStepIndex = 0; | 80 | this._currentStepIndex = 0; |
84 | this.rulerComponent().resetStatus({animateTransition:true}); | 81 | this.rulerComponent().resetStatus({animateTransition:true}); |
85 | }, | 82 | }, |
86 | 83 | ||
87 | //----------------------------------------------------------------------------- | 84 | //----------------------------------------------------------------------------- |
88 | 85 | ||
89 | 'enableNext': function (aValue) { | 86 | 'enableNext': function (aValue) { |
90 | this.rulerComponent().enableNext(aValue); | 87 | this.rulerComponent().enableNext(aValue); |
91 | this._isNextEnabled = aValue; | 88 | this._isNextEnabled = aValue; |
92 | }, | 89 | }, |
93 | 90 | ||
94 | 'isNextEnabled': function () { | 91 | 'isNextEnabled': function () { |
95 | return this._isNextEnabled; | 92 | return this._isNextEnabled; |
96 | }, | 93 | }, |
97 | 94 | ||
98 | //----------------------------------------------------------------------------- | 95 | //----------------------------------------------------------------------------- |
99 | 96 | ||
100 | 'enablePrevious': function (aValue) { | 97 | 'enablePrevious': function (aValue) { |
101 | this.rulerComponent().enablePrevious(aValue); | 98 | this.rulerComponent().enablePrevious(aValue); |
102 | }, | 99 | }, |
103 | 100 | ||
104 | //============================================================================= | 101 | //============================================================================= |
105 | 102 | ||
106 | 'rulerComponent': function () { | 103 | 'rulerComponent': function () { |
107 | if (this._rulerComponent == null) { | 104 | if (this._rulerComponent == null) { |
108 | this._rulerComponent = new Clipperz.PM.UI.Web.Components.RulerComponent({ | 105 | this._rulerComponent = new Clipperz.PM.UI.Web.Components.RulerComponent({ |
109 | translationContext:'Wizards.NewUserWizard' | 106 | translationContext:'Wizards.NewUserWizard' |
110 | }); | 107 | }); |
111 | this._rulerComponent.render(); | 108 | this._rulerComponent.render(); |
112 | 109 | ||
113 | MochiKit.Signal.connect(this._rulerComponent, 'exit', this, 'handleExit'); | 110 | MochiKit.Signal.connect(this._rulerComponent, 'exit', this, 'handleExit'); |
114 | MochiKit.Signal.connect(this._rulerComponent, 'done', this, 'done'); | 111 | MochiKit.Signal.connect(this._rulerComponent, 'done', this, 'done'); |
115 | MochiKit.Signal.connect(this._rulerComponent, 'moveForward',this, 'handleMoveForward'); | 112 | MochiKit.Signal.connect(this._rulerComponent, 'moveForward',this, 'handleMoveForward'); |
116 | MochiKit.Signal.connect(this._rulerComponent, 'moveBackward',this, 'handleMoveBackward'); | 113 | MochiKit.Signal.connect(this._rulerComponent, 'moveBackward',this, 'handleMoveBackward'); |
117 | MochiKit.Signal.connect(this._rulerComponent, 'cursorMoved',this, 'handleCursorMoved'); | 114 | MochiKit.Signal.connect(this._rulerComponent, 'cursorMoved',this, 'handleCursorMoved'); |
118 | } | 115 | } |
119 | 116 | ||
120 | return this._rulerComponent; | 117 | return this._rulerComponent; |
121 | }, | 118 | }, |
122 | 119 | ||
123 | 'resetRuler': function () { | 120 | 'resetRuler': function () { |
124 | // if (this._rulerComponent != null) { | 121 | // if (this._rulerComponent != null) { |
125 | // this._rulerComponent.clear(); | 122 | // this._rulerComponent.clear(); |
126 | // } | 123 | // } |
127 | // this._rulerComponent = null; | 124 | // this._rulerComponent = null; |
128 | }, | 125 | }, |
129 | 126 | ||
130 | //----------------------------------------------------------------------------- | 127 | //----------------------------------------------------------------------------- |
131 | 128 | ||
132 | 'showRuler': function (someSteps) { | 129 | 'showRuler': function (someSteps) { |
133 | var rulerElement; | 130 | var rulerElement; |
134 | 131 | ||
135 | this.setSteps(someSteps); | 132 | this.setSteps(someSteps); |
136 | 133 | ||
137 | rulerElement = this.rulerComponent().element(); | 134 | rulerElement = this.rulerComponent().element(); |
138 | this.newUserCreationComponent().disableAllPanels(); | 135 | this.newUserCreationComponent().disableAllPanels(); |
139 | 136 | ||
140 | MochiKit.Style.showElement(rulerElement); | 137 | MochiKit.Style.showElement(rulerElement); |
141 | MochiKit.Style.setElementPosition(rulerElement, {x:-1000, y:this.newUserCreationComponent().bottomMargin()}); | 138 | MochiKit.Style.setElementPosition(rulerElement, {x:-1000, y:this.newUserCreationComponent().bottomMargin()}); |
142 | new MochiKit.Visual.Move(rulerElement, { | 139 | new MochiKit.Visual.Move(rulerElement, { |
143 | x:0, y:this.newUserCreationComponent().bottomMargin(), | 140 | x:0, y:this.newUserCreationComponent().bottomMargin(), |
144 | mode:'absolute', | 141 | mode:'absolute', |
145 | duration:0.5, | 142 | duration:0.5, |
146 | // afterFinish:MochiKit.Base.method(this, 'handleCursorMoved') | 143 | // afterFinish:MochiKit.Base.method(this, 'handleCursorMoved') |
147 | afterFinish:MochiKit.Base.method(this, 'handleRulerShowed') | 144 | afterFinish:MochiKit.Base.method(this, 'handleRulerShowed') |
148 | }); | 145 | }); |
149 | }, | 146 | }, |
150 | 147 | ||
151 | //----------------------------------------------------------------------------- | 148 | //----------------------------------------------------------------------------- |
152 | 149 | ||
153 | 'handleRulerShowed':function () { | 150 | 'handleRulerShowed':function () { |
154 | return Clipperz.Async.callbacks("NewUserWizardController.handlerRulerShowed", [ | 151 | return Clipperz.Async.callbacks("NewUserWizardController.handlerRulerShowed", [ |
155 | MochiKit.Base.method(this.newUserCreationComponent(), 'waitUntilFullyRendered'), | 152 | MochiKit.Base.method(this.newUserCreationComponent(), 'waitUntilFullyRendered'), |
156 | MochiKit.Base.method(this, 'handleCursorMoved') | 153 | MochiKit.Base.method(this, 'handleCursorMoved') |
157 | ], {trace:false}); | 154 | ], {trace:false}); |
158 | }, | 155 | }, |
159 | 156 | ||
160 | //----------------------------------------------------------------------------- | 157 | //----------------------------------------------------------------------------- |
161 | 158 | ||
162 | 'hideRuler': function () { | 159 | 'hideRuler': function () { |
163 | new MochiKit.Visual.Move(this.rulerComponent().element(), {x:-1000, mode:'relative', duration:0.5}); | 160 | new MochiKit.Visual.Move(this.rulerComponent().element(), {x:-1000, mode:'relative', duration:0.5}); |
164 | }, | 161 | }, |
165 | 162 | ||
166 | 'doneWithRuler': function () { | 163 | 'doneWithRuler': function () { |
167 | var rulerComponentElement; | 164 | var rulerComponentElement; |
168 | 165 | ||
169 | rulerComponentElement = this.rulerComponent().element(); | 166 | rulerComponentElement = this.rulerComponent().element(); |
170 | new MochiKit.Visual.Move(this.rulerComponent().element(), { | 167 | new MochiKit.Visual.Move(this.rulerComponent().element(), { |
171 | x:1000, | 168 | x:1000, |
172 | mode:'relative', | 169 | mode:'relative', |
173 | duration:1, | 170 | duration:1, |
174 | // afterFinish:MochiKit.Base.partial(MochiKit.Style.hideElement, rulerComponentElement) | 171 | // afterFinish:MochiKit.Base.partial(MochiKit.Style.hideElement, rulerComponentElement) |
175 | afterFinish:function () { MochiKit.Style.hideElement(rulerComponentElement); } | 172 | afterFinish:function () { MochiKit.Style.hideElement(rulerComponentElement); } |
176 | }); | 173 | }); |
177 | }, | 174 | }, |
178 | 175 | ||
179 | //============================================================================= | 176 | //============================================================================= |
180 | 177 | ||
181 | 'createNewUserRulerSteps': function () { | 178 | 'createNewUserRulerSteps': function () { |
182 | return [ 'CREDENTIALS', 'CHECK_CREDENTIALS', 'TERMS_OF_SERVICE', 'CREATE_USER'/*, 'LOGIN' */]; | 179 | return [ 'CREDENTIALS', 'CHECK_CREDENTIALS', 'TERMS_OF_SERVICE', 'CREATE_USER'/*, 'LOGIN' */]; |
183 | }, | 180 | }, |
184 | 181 | ||
185 | //------------------------------------------------------------------------- | 182 | //------------------------------------------------------------------------- |
186 | 183 | ||
187 | 'run': function () { | 184 | 'run': function () { |
188 | return Clipperz.Async.callbacks("NewUserWizardController.run", [ | 185 | return Clipperz.Async.callbacks("NewUserWizardController.run", [ |
189 | MochiKit.Base.method(this, 'createNewUserRulerSteps'), | 186 | MochiKit.Base.method(this, 'createNewUserRulerSteps'), |
190 | MochiKit.Base.method(this, 'showRuler') | 187 | MochiKit.Base.method(this, 'showRuler') |
191 | ], {trace:false}); | 188 | ], {trace:false}); |
192 | }, | 189 | }, |
193 | 190 | ||
194 | //----------------------------------------------------------------------------- | 191 | //----------------------------------------------------------------------------- |
195 | 192 | ||
196 | 'checkState': function () { | 193 | 'checkState': function () { |
197 | var enablePrevious; | 194 | var enablePrevious; |
198 | var enableNext; | 195 | var enableNext; |
199 | 196 | ||
200 | enablePrevious = true; | 197 | enablePrevious = true; |
201 | enableNext = false; | 198 | enableNext = false; |
202 | 199 | ||
203 | this.newUserCreationComponent().disableAllPanels(); | 200 | this.newUserCreationComponent().disableAllPanels(); |
204 | 201 | ||
205 | switch(this.currentStep()) { | 202 | switch(this.currentStep()) { |
206 | case 'CREDENTIALS': | 203 | case 'CREDENTIALS': |
207 | this.newUserCreationComponent().enableCredentialsPanel(); | 204 | this.newUserCreationComponent().enableCredentialsPanel(); |
208 | 205 | ||
209 | enableNext = ( | 206 | enableNext = ( |
210 | (this.newUserCreationComponent().username() != '') | 207 | (this.newUserCreationComponent().username() != '') |
211 | && | 208 | && |
212 | (this.newUserCreationComponent().passphrase() != '') | 209 | (this.newUserCreationComponent().passphrase() != '') |
213 | ); | 210 | ); |
214 | // enablePrevious = false; | 211 | // enablePrevious = false; |
215 | break; | 212 | break; |
216 | case 'CHECK_CREDENTIALS': | 213 | case 'CHECK_CREDENTIALS': |
217 | this.newUserCreationComponent().enableCheckCredentialsPanel(); | 214 | this.newUserCreationComponent().enableCheckCredentialsPanel(); |
218 | 215 | ||
219 | enableNext = (this.newUserCreationComponent().passphrase() == this.newUserCreationComponent().rePassphrase()); | 216 | enableNext = (this.newUserCreationComponent().passphrase() == this.newUserCreationComponent().rePassphrase()); |
220 | // enablePrevious = true; | 217 | // enablePrevious = true; |
221 | break | 218 | break |
222 | case 'TERMS_OF_SERVICE': | 219 | case 'TERMS_OF_SERVICE': |
223 | this.newUserCreationComponent().enableTermsOfServicePanel(); | 220 | this.newUserCreationComponent().enableTermsOfServicePanel(); |
224 | 221 | ||
225 | //console.log("awareOfUnrecoverablePassphrase", this.newUserCreationComponent().awareOfUnrecoverablePassphrase()); | ||
226 | //console.log("readTermsOfService", this.newUserCreationComponent().readTermsOfService()); | ||
227 | enableNext = ( | 222 | enableNext = ( |
228 | (this.newUserCreationComponent().awareOfUnrecoverablePassphrase() == 'on') | 223 | (this.newUserCreationComponent().awareOfUnrecoverablePassphrase() == 'on') |
229 | && | 224 | && |
230 | (this.newUserCreationComponent().readTermsOfService() == 'on') | 225 | (this.newUserCreationComponent().readTermsOfService() == 'on') |
231 | ) | 226 | ) |
232 | break; | 227 | break; |
233 | case 'CREATE_USER': | 228 | case 'CREATE_USER': |
234 | //console.log(">>> CREATE_USER", this.userCreationState()); | ||
235 | this.newUserCreationComponent().enableCreateUserPanel(); | 229 | this.newUserCreationComponent().enableCreateUserPanel(); |
236 | 230 | ||
237 | switch (this.userCreationState()) { | 231 | switch (this.userCreationState()) { |
238 | case 'IDLE': | 232 | case 'IDLE': |
239 | this.setUserCreationState('IN PROGRESS'); | 233 | this.setUserCreationState('IN PROGRESS'); |
240 | this.preformActualUserRegistration(); | 234 | this.preformActualUserRegistration(); |
241 | 235 | ||
242 | enablePrevious = false; | 236 | enablePrevious = false; |
243 | enableNext = false; | 237 | enableNext = false; |
244 | break; | 238 | break; |
245 | case 'IN PROGRESS': | 239 | case 'IN PROGRESS': |
246 | enablePrevious = false; | 240 | enablePrevious = false; |
247 | enableNext = false; | 241 | enableNext = false; |
248 | break; | 242 | break; |
249 | case 'DONE': | 243 | case 'DONE': |
250 | enablePrevious = false; | 244 | enablePrevious = false; |
251 | enableNext = true; | 245 | enableNext = true; |
252 | break; | 246 | break; |
253 | case 'FAILED': | 247 | case 'FAILED': |
254 | enablePrevious = true; | 248 | enablePrevious = true; |
255 | enableNext = false; | 249 | enableNext = false; |
256 | break; | 250 | break; |
257 | }; | 251 | }; |
258 | break; | 252 | break; |
259 | // case 'LOGIN': | 253 | // case 'LOGIN': |
260 | // this.newUserCreationComponent().enableLoginPanel(); | 254 | // this.newUserCreationComponent().enableLoginPanel(); |
261 | // break; | 255 | // break; |
262 | } | 256 | } |
263 | 257 | ||
264 | if (this.currentStepIndex() > 0) { | 258 | if (this.currentStepIndex() > 0) { |
265 | this.enablePrevious(enablePrevious); | 259 | this.enablePrevious(enablePrevious); |
266 | } else { | 260 | } else { |
267 | this.enablePrevious(false); | 261 | this.enablePrevious(false); |
268 | } | 262 | } |
269 | this.enableNext(enableNext); | 263 | this.enableNext(enableNext); |
270 | }, | 264 | }, |
271 | 265 | ||
272 | //----------------------------------------------------------------------------- | 266 | //----------------------------------------------------------------------------- |
273 | 267 | ||
274 | 'setFocus': function () { | 268 | 'setFocus': function () { |
275 | switch(this.currentStep()) { | 269 | switch(this.currentStep()) { |
276 | case 'CREDENTIALS': | 270 | case 'CREDENTIALS': |
277 | this.newUserCreationComponent().focusOnUsernameElement(); | 271 | this.newUserCreationComponent().focusOnUsernameElement(); |
278 | break; | 272 | break; |
279 | case 'CHECK_CREDENTIALS': | 273 | case 'CHECK_CREDENTIALS': |
280 | this.newUserCreationComponent().focusOnRePassphraseElement(); | 274 | this.newUserCreationComponent().focusOnRePassphraseElement(); |
281 | break | 275 | break |
282 | case 'TERMS_OF_SERVICE': | 276 | case 'TERMS_OF_SERVICE': |
283 | break; | 277 | break; |
284 | case 'CREATE_USER': | 278 | case 'CREATE_USER': |
285 | break; | 279 | break; |
286 | // case 'LOGIN': | 280 | // case 'LOGIN': |
287 | // break; | 281 | // break; |
288 | } | 282 | } |
289 | }, | 283 | }, |
290 | 284 | ||
291 | //============================================================================= | 285 | //============================================================================= |
292 | 286 | ||
293 | 'steps': function () { | 287 | 'steps': function () { |
294 | return this._steps; | 288 | return this._steps; |
295 | }, | 289 | }, |
296 | 290 | ||
297 | 'setSteps': function (aValue) { | 291 | 'setSteps': function (aValue) { |
298 | this._steps = aValue; | 292 | this._steps = aValue; |
299 | 293 | ||
300 | this.rulerComponent().setSteps(aValue); | 294 | this.rulerComponent().setSteps(aValue); |
301 | this.resetCurrentStepIndex(); | 295 | this.resetCurrentStepIndex(); |
302 | }, | 296 | }, |
303 | 297 | ||
304 | 'currentStepIndex': function () { | 298 | 'currentStepIndex': function () { |
305 | return this._currentStepIndex; | 299 | return this._currentStepIndex; |
306 | }, | 300 | }, |
307 | 301 | ||
308 | 'currentStep': function () { | 302 | 'currentStep': function () { |
309 | return this.steps()[this.currentStepIndex()]; | 303 | return this.steps()[this.currentStepIndex()]; |
310 | }, | 304 | }, |
311 | 305 | ||
312 | //============================================================================= | 306 | //============================================================================= |
313 | 307 | ||
314 | 'handleExit': function () { | 308 | 'handleExit': function () { |
315 | return Clipperz.Async.callbacks("NewUserWizardController.handleExit", [ | 309 | return Clipperz.Async.callbacks("NewUserWizardController.handleExit", [ |
316 | // MochiKit.Base.method(this.newUserCreationComponent(), 'resetContent'), | 310 | // MochiKit.Base.method(this.newUserCreationComponent(), 'resetContent'), |
317 | Clipperz.Async.forkAndJoin("NewUserWizardController.handleExit - fork and join", [ | 311 | Clipperz.Async.forkAndJoin("NewUserWizardController.handleExit - fork and join", [ |
318 | MochiKit.Base.method(this, 'hideRuler'), | 312 | MochiKit.Base.method(this, 'hideRuler'), |
319 | MochiKit.Base.method(this.newUserCreationComponent(), 'deferredHideModal') | 313 | MochiKit.Base.method(this.newUserCreationComponent(), 'deferredHideModal') |
320 | ], {trace:false}), | 314 | ], {trace:false}), |
321 | MochiKit.Base.method(this, 'resetRuler'), | 315 | MochiKit.Base.method(this, 'resetRuler'), |
322 | // MochiKit.Base.method(this.newUserCreationComponent(), 'reset'), | 316 | // MochiKit.Base.method(this.newUserCreationComponent(), 'reset'), |
323 | MochiKit.Base.partial(MochiKit.Signal.signal, this, 'exit') | 317 | MochiKit.Base.partial(MochiKit.Signal.signal, this, 'exit') |
324 | ], {trace:false}) | 318 | ], {trace:false}) |
325 | }, | 319 | }, |
326 | 320 | ||
327 | 'done': function () { | 321 | 'done': function () { |
328 | this.doneWithRuler(); | 322 | this.doneWithRuler(); |
329 | MochiKit.Signal.signal(this, 'done', {'user': this.user()}); | 323 | MochiKit.Signal.signal(this, 'done', {'user': this.user()}); |
330 | }, | 324 | }, |
331 | 325 | ||
332 | //============================================================================= | 326 | //============================================================================= |
333 | 327 | ||
334 | 'handleMoveBackward': function () { | 328 | 'handleMoveBackward': function () { |
335 | if (this._currentStepIndex > 0) { | 329 | if (this._currentStepIndex > 0) { |
336 | varafterMoveAction; | 330 | varafterMoveAction; |
337 | 331 | ||
338 | afterMoveAction = MochiKit.Base.noop; | 332 | afterMoveAction = MochiKit.Base.noop; |
339 | 333 | ||
340 | //console.log("<-- backward", this.currentStep()); | ||
341 | switch(this.currentStep()) { | 334 | switch(this.currentStep()) { |
342 | case 'CREDENTIALS': | 335 | case 'CREDENTIALS': |
343 | case 'CHECK_CREDENTIALS': | 336 | case 'CHECK_CREDENTIALS': |
344 | case 'TERMS_OF_SERVICE': | 337 | case 'TERMS_OF_SERVICE': |
345 | this._currentStepIndex --; | 338 | this._currentStepIndex --; |
346 | this.rulerComponent().moveBackward(afterMoveAction); | 339 | this.rulerComponent().moveBackward(afterMoveAction); |
347 | break; | 340 | break; |
348 | case 'CREATE_USER': | 341 | case 'CREATE_USER': |
349 | this.setUser(null); | 342 | this.setUser(null); |
350 | this.newUserCreationComponent().hideAllProgeressStates(); | 343 | this.newUserCreationComponent().hideAllProgeressStates(); |
351 | this.resetCurrentStepIndex(); | 344 | this.resetCurrentStepIndex(); |
352 | this.setUserCreationState('IDLE'); | 345 | this.setUserCreationState('IDLE'); |
353 | break; | 346 | break; |
354 | // case 'LOGIN': | 347 | // case 'LOGIN': |
355 | // break; | 348 | // break; |
356 | }; | 349 | }; |
357 | 350 | ||
358 | } | 351 | } |
359 | 352 | ||
360 | if (this._currentStepIndex == 0) { | 353 | if (this._currentStepIndex == 0) { |
361 | this.enablePrevious(false); | 354 | this.enablePrevious(false); |
362 | } | 355 | } |
363 | }, | 356 | }, |
364 | 357 | ||
365 | 'handleMoveForward': function () { | 358 | 'handleMoveForward': function () { |
366 | if (this.isNextEnabled()) { | 359 | if (this.isNextEnabled()) { |
367 | varafterMoveAction; | 360 | varafterMoveAction; |
368 | 361 | ||
369 | this._currentStepIndex ++; | 362 | this._currentStepIndex ++; |
370 | afterMoveAction = MochiKit.Base.noop; | 363 | afterMoveAction = MochiKit.Base.noop; |
371 | 364 | ||
372 | switch(this.currentStep()) { | 365 | switch(this.currentStep()) { |
373 | case 'CREDENTIALS': | 366 | case 'CREDENTIALS': |
374 | break; | 367 | break; |
375 | case 'CHECK_CREDENTIALS': | 368 | case 'CHECK_CREDENTIALS': |
376 | break | 369 | break |
377 | case 'TERMS_OF_SERVICE': | 370 | case 'TERMS_OF_SERVICE': |
378 | break; | 371 | break; |
379 | case 'CREATE_USER': | 372 | case 'CREATE_USER': |
380 | break; | 373 | break; |
381 | // case 'LOGIN': | 374 | // case 'LOGIN': |
382 | // break; | 375 | // break; |
383 | }; | 376 | }; |
384 | 377 | ||
385 | this.rulerComponent().moveForward(afterMoveAction); | 378 | this.rulerComponent().moveForward(afterMoveAction); |
386 | }; | 379 | }; |
387 | }, | 380 | }, |
388 | 381 | ||
389 | 'handleCursorMoved': function () { | 382 | 'handleCursorMoved': function () { |
390 | // this.checkState(); | 383 | // this.checkState(); |
391 | // this.setFocus(); | 384 | // this.setFocus(); |
392 | 385 | ||
393 | return Clipperz.Async.callbacks("NewUserWizardController.handleCursorMoved", [ | 386 | return Clipperz.Async.callbacks("NewUserWizardController.handleCursorMoved", [ |
394 | MochiKit.Base.method(this.newUserCreationComponent(), 'waitUntilFullyRendered'), | 387 | MochiKit.Base.method(this.newUserCreationComponent(), 'waitUntilFullyRendered'), |
395 | MochiKit.Base.method(this, 'checkState'), | 388 | MochiKit.Base.method(this, 'checkState'), |
396 | MochiKit.Base.method(this, 'setFocus') | 389 | MochiKit.Base.method(this, 'setFocus') |
397 | ], {trace:false}); | 390 | ], {trace:false}); |
398 | }, | 391 | }, |
399 | 392 | ||
400 | //------------------------------------------------------------------------- | 393 | //------------------------------------------------------------------------- |
401 | 394 | ||
402 | 'handleChangedValue': function (anEvent) { | 395 | 'handleChangedValue': function (anEvent) { |
403 | this.checkState(); | 396 | this.checkState(); |
404 | }, | 397 | }, |
405 | 398 | ||
406 | //------------------------------------------------------------------------- | 399 | //------------------------------------------------------------------------- |
407 | 400 | ||
408 | 'handleNewUserCreationComponentKeyPressed': function (anEvent) { | 401 | 'handleNewUserCreationComponentKeyPressed': function (anEvent) { |
409 | //console.log(">>> handleNewUserCreationComponentKeyPressed", anEvent.key().string); | ||
410 | if (anEvent.key().string == 'KEY_ENTER') { | 402 | if (anEvent.key().string == 'KEY_ENTER') { |
411 | if (anEvent.target().nodeName != 'TEXTAREA') { | 403 | if (anEvent.target().nodeName != 'TEXTAREA') { |
412 | anEvent.preventDefault(); | 404 | anEvent.preventDefault(); |
413 | this.handleMoveForward(); | 405 | this.handleMoveForward(); |
414 | } | 406 | } |
415 | } else if (anEvent.key().string == 'KEY_TAB') { | 407 | } else if (anEvent.key().string == 'KEY_TAB') { |
416 | if (anEvent.target() == this.newUserCreationComponent().usernameElement()) { | 408 | if (anEvent.target() == this.newUserCreationComponent().usernameElement()) { |
417 | } else { | 409 | } else { |
418 | this.handleMoveForward(); | 410 | this.handleMoveForward(); |
419 | if ((anEvent.target().nodeName == 'INPUT') || (anEvent.target().nodeName == 'TEXTAREA')) { | 411 | if ((anEvent.target().nodeName == 'INPUT') || (anEvent.target().nodeName == 'TEXTAREA')) { |
420 | anEvent.preventDefault(); | 412 | anEvent.preventDefault(); |
421 | } | 413 | } |
422 | } | 414 | } |
423 | } else if ((anEvent.key().string == 'KEY_ARROW_RIGHT') && (anEvent.modifier().meta == true)) { | 415 | } else if ((anEvent.key().string == 'KEY_ARROW_RIGHT') && (anEvent.modifier().meta == true)) { |
424 | this.handleMoveForward(); | 416 | this.handleMoveForward(); |
425 | } else if ((anEvent.key().string == 'KEY_ARROW_LEFT') && (anEvent.modifier().meta == true)) { | 417 | } else if ((anEvent.key().string == 'KEY_ARROW_LEFT') && (anEvent.modifier().meta == true)) { |
426 | this.handleMoveBackward(); | 418 | this.handleMoveBackward(); |
427 | } else if (anEvent.key().string == 'KEY_ESCAPE') { | 419 | } else if (anEvent.key().string == 'KEY_ESCAPE') { |
428 | anEvent.stop(); | 420 | anEvent.stop(); |
429 | this.handleExit(); | 421 | this.handleExit(); |
430 | } else { | 422 | } else { |
431 | MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, 'checkState')); | 423 | MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, 'checkState')); |
432 | } | 424 | } |
433 | }, | 425 | }, |
434 | 426 | ||
435 | //============================================================================= | 427 | //============================================================================= |
436 | 428 | ||
437 | 'preformActualUserRegistration': function () { | 429 | 'preformActualUserRegistration': function () { |
438 | vardeferredResult; | 430 | vardeferredResult; |
439 | 431 | ||
440 | deferredResult = new Clipperz.Async.Deferred("NewUSerWizardController.preformActualUserRegistration", {trace:false}); | 432 | deferredResult = new Clipperz.Async.Deferred("NewUSerWizardController.preformActualUserRegistration", {trace:false}); |
441 | deferredResult.addMethod(this.newUserCreationComponent(), 'showProgressOnUserCreation'); | 433 | deferredResult.addMethod(this.newUserCreationComponent(), 'showProgressOnUserCreation'); |
442 | deferredResult.addMethod(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', MochiKit.Base.method(this.newUserCreationComponent(), 'passphrase')); | 434 | deferredResult.addMethod(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', MochiKit.Base.method(this.newUserCreationComponent(), 'passphrase')); |
443 | deferredResult.addCallback(Clipperz.PM.DataModel.User.registerNewAccount, | 435 | deferredResult.addCallback(Clipperz.PM.DataModel.User.registerNewAccount, |
444 | this.newUserCreationComponent().username(), | 436 | this.newUserCreationComponent().username(), |
445 | MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'getPassphrase') | 437 | MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'getPassphrase') |
446 | ); | 438 | ); |
447 | deferredResult.addMethod(this, 'setUser'); | 439 | deferredResult.addMethod(this, 'setUser'); |
448 | deferredResult.addMethod(this.newUserCreationComponent(), 'showUserCreationDone'); | 440 | deferredResult.addMethod(this.newUserCreationComponent(), 'showUserCreationDone'); |
449 | deferredResult.addMethod(this, 'setUserCreationState', 'DONE'); | 441 | deferredResult.addMethod(this, 'setUserCreationState', 'DONE'); |
450 | 442 | ||
451 | // deferredResult.addErrback(MochiKit.Base.method(this.newUserCreationComponent(), 'showUserCreationFailed')); | 443 | // deferredResult.addErrback(MochiKit.Base.method(this.newUserCreationComponent(), 'showUserCreationFailed')); |
452 | // deferredResult.addErrback(MochiKit.Base.method(this, 'setUser', null)); | 444 | // deferredResult.addErrback(MochiKit.Base.method(this, 'setUser', null)); |
453 | // deferredResult.addErrback(MochiKit.Base.method(this, 'setUserCreationState', 'FAILED')); | 445 | // deferredResult.addErrback(MochiKit.Base.method(this, 'setUserCreationState', 'FAILED')); |
454 | deferredResult.addErrback(MochiKit.Base.bind(function (aValue) { | 446 | deferredResult.addErrback(MochiKit.Base.bind(function (aValue) { |
455 | this.newUserCreationComponent().showUserCreationFailed(); | 447 | this.newUserCreationComponent().showUserCreationFailed(); |
456 | this.setUser(null); | 448 | this.setUser(null); |
457 | this.setUserCreationState('FAILED'); | 449 | this.setUserCreationState('FAILED'); |
458 | }, this)); | 450 | }, this)); |
459 | deferredResult.callback(); | 451 | deferredResult.callback(); |
460 | 452 | ||
461 | return deferredResult; | 453 | return deferredResult; |
462 | }, | 454 | }, |
463 | 455 | ||
464 | //============================================================================= | 456 | //============================================================================= |
465 | __syntaxFix__: "syntax fix" | 457 | __syntaxFix__: "syntax fix" |
466 | }); | 458 | }); |