summaryrefslogtreecommitdiff
authorClipperz <info@clipperz.com>2013-01-10 08:37:28 (UTC)
committer Clipperz <info@clipperz.com>2013-01-10 08:37:28 (UTC)
commitfac609cf1507ae82e7069b21724e089a9ac93869 (patch) (unidiff)
tree89267c7c02b4cf56e261cfcdcb9290014ff7879d
parent6642b868f781e8e6689db630877a092472ff0f0b (diff)
downloadclipperz-fac609cf1507ae82e7069b21724e089a9ac93869.zip
clipperz-fac609cf1507ae82e7069b21724e089a9ac93869.tar.gz
clipperz-fac609cf1507ae82e7069b21724e089a9ac93869.tar.bz2
Fixed account preference saving
Saving preferences was still invoking an old method removed since the unification of the backend
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js b/frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js
index 9e80b3a..919289d 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js
@@ -1,194 +1,195 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz Community Edition.
6Clipperz Community Edition is an online password manager. 6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 7For further information about its features and functionalities please
8refer to http://www.clipperz.com. 8refer to http://www.clipperz.com.
9 9
10* Clipperz Community Edition is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
11 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
12 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
13 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
14 14
15* Clipperz Community Edition is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
19 19
20* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 21 License along with Clipperz Community Edition. If not, see
22 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
23 23
24*/ 24*/
25 25
26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
29 29
30 30
31//############################################################################# 31//#############################################################################
32 32
33Clipperz.PM.DataModel.UserPreferences = function(args) { 33Clipperz.PM.DataModel.UserPreferences = function(args) {
34 args = args || {}; 34 args = args || {};
35 35
36 this._user = args['user']; delete args['user']; 36 this._user = args['user']; delete args['user'];
37 this._config = args; 37 this._config = args;
38 38
39 return this; 39 return this;
40} 40}
41 41
42Clipperz.PM.DataModel.UserPreferences.prototype = MochiKit.Base.update(null, { 42Clipperz.PM.DataModel.UserPreferences.prototype = MochiKit.Base.update(null, {
43 43
44 //------------------------------------------------------------------------- 44 //-------------------------------------------------------------------------
45 45
46 'config': function() { 46 'config': function() {
47 return this._config; 47 return this._config;
48 }, 48 },
49 49
50 //------------------------------------------------------------------------- 50 //-------------------------------------------------------------------------
51 51
52 'user': function() { 52 'user': function() {
53 return this._user; 53 return this._user;
54 }, 54 },
55 55
56 //------------------------------------------------------------------------- 56 //-------------------------------------------------------------------------
57 57
58 'updateWithData': function(someValues) { 58 'updateWithData': function(someValues) {
59 var currentLanguage; 59 var currentLanguage;
60 60
61//MochiKit.Logging.logDebug(">>> Clipperz.PM.DataModel.UserPreferences.updateWithData: " + Clipperz.Base.serializeJSON(someValues)); 61//MochiKit.Logging.logDebug(">>> Clipperz.PM.DataModel.UserPreferences.updateWithData: " + Clipperz.Base.serializeJSON(someValues));
62 currentLanguage = this.preferredLanguage(); 62 currentLanguage = this.preferredLanguage();
63 63
64 MochiKit.Base.update(this._config, someValues); 64 MochiKit.Base.update(this._config, someValues);
65 65
66 if (this.preferredLanguage() != currentLanguage) { 66 if (this.preferredLanguage() != currentLanguage) {
67 Clipperz.PM.Strings.Languages.setSelectedLanguage(this.preferredLanguage()); 67 Clipperz.PM.Strings.Languages.setSelectedLanguage(this.preferredLanguage());
68 } else { 68 } else {
69//MochiKit.Logging.logDebug("### keepping the browser selected language: " + Clipperz.PM.Strings.selectedLanguage); 69//MochiKit.Logging.logDebug("### keepping the browser selected language: " + Clipperz.PM.Strings.selectedLanguage);
70 } 70 }
71 71
72 return this; 72 return this;
73 }, 73 },
74 74
75 //------------------------------------------------------------------------- 75 //-------------------------------------------------------------------------
76 76
77 'configValue': function(aConfigName, aDefaultValue) { 77 'configValue': function(aConfigName, aDefaultValue) {
78 var result; 78 var result;
79 79
80//MochiKit.Logging.logDebug(">>> UserPreferences.configValue - config: " + Clipperz.Base.serializeJSON(this.config())); 80//MochiKit.Logging.logDebug(">>> UserPreferences.configValue - config: " + Clipperz.Base.serializeJSON(this.config()));
81 if (typeof(this.config()[aConfigName]) == 'undefined') { 81 if (typeof(this.config()[aConfigName]) == 'undefined') {
82 result = aDefaultValue; 82 result = aDefaultValue;
83 } else { 83 } else {
84 result = this.config()[aConfigName]; 84 result = this.config()[aConfigName];
85 } 85 }
86//MochiKit.Logging.logDebug("<<< UserPreferences.configValue"); 86//MochiKit.Logging.logDebug("<<< UserPreferences.configValue");
87 87
88 return result; 88 return result;
89 }, 89 },
90 90
91 'setConfigValue': function(aConfigName, aValue) { 91 'setConfigValue': function(aConfigName, aValue) {
92 var result; 92 var result;
93 93
94 if (aValue != this.configValue(aConfigName)) { 94 if (aValue != this.configValue(aConfigName)) {
95 if (aValue == null) { 95 if (aValue == null) {
96 delete this.config()[aConfigName] 96 delete this.config()[aConfigName]
97 } else { 97 } else {
98 this.config()[aConfigName] = aValue; 98 this.config()[aConfigName] = aValue;
99 } 99 }
100 100
101 Clipperz.NotificationCenter.notify(this.user(), 'updatedSection', 'preferences', true); 101 Clipperz.NotificationCenter.notify(this.user(), 'updatedSection', 'preferences', true);
102 102
103 result = true; 103 result = true;
104 } else { 104 } else {
105 result = false; 105 result = false;
106 } 106 }
107 107
108 return result; 108 return result;
109 }, 109 },
110 110
111 //------------------------------------------------------------------------- 111 //-------------------------------------------------------------------------
112 112
113 'useSafeEditMode': function() { 113 'useSafeEditMode': function() {
114 return this.configValue('useSafeEditMode', true); 114 return this.configValue('useSafeEditMode', true);
115 }, 115 },
116 116
117 'setUseSafeEditMode': function(aValue) { 117 'setUseSafeEditMode': function(aValue) {
118 this.setConfigValue('useSafeEditMode', aValue); 118 this.setConfigValue('useSafeEditMode', aValue);
119 }, 119 },
120 120
121 //------------------------------------------------------------------------- 121 //-------------------------------------------------------------------------
122 122
123 'preferredLanguage': function() { 123 'preferredLanguage': function() {
124 return this.configValue('preferredLanguage', null); 124 return this.configValue('preferredLanguage', null);
125 }, 125 },
126 126
127 'setPreferredLanguage': function(aValue) { 127 'setPreferredLanguage': function(aValue) {
128 if (this.setConfigValue('preferredLanguage', aValue)) { 128 if (this.setConfigValue('preferredLanguage', aValue)) {
129 Clipperz.PM.Strings.Languages.setSelectedLanguage(this.preferredLanguage()); 129 Clipperz.PM.Strings.Languages.setSelectedLanguage(this.preferredLanguage());
130 } 130 }
131 }, 131 },
132 132
133 //------------------------------------------------------------------------- 133 //-------------------------------------------------------------------------
134 134
135 'shouldShowDonationPanel': function() { 135 'shouldShowDonationPanel': function() {
136 return this.configValue('shouldShowDonationPanel', true); 136 return this.configValue('shouldShowDonationPanel', true);
137 }, 137 },
138 138
139 'setShouldShowDonationPanel': function(aValue) { 139 'setShouldShowDonationPanel': function(aValue) {
140 this.setConfigValue('shouldShowDonationPanel', aValue); 140 this.setConfigValue('shouldShowDonationPanel', aValue);
141 }, 141 },
142 142
143 //------------------------------------------------------------------------- 143 //-------------------------------------------------------------------------
144 144
145 'disableUnsecureFaviconLoadingForIE': function() { 145 'disableUnsecureFaviconLoadingForIE': function() {
146 return this.configValue('disableUnsecureFaviconLoadingForIE', false); 146 return this.configValue('disableUnsecureFaviconLoadingForIE', false);
147 }, 147 },
148 148
149 'setDisableUnsecureFaviconLoadingForIE': function(aValue) { 149 'setDisableUnsecureFaviconLoadingForIE': function(aValue) {
150 this.setConfigValue('disableUnsecureFaviconLoadingForIE', aValue); 150 this.setConfigValue('disableUnsecureFaviconLoadingForIE', aValue);
151 }, 151 },
152 152
153 //------------------------------------------------------------------------- 153 //-------------------------------------------------------------------------
154 154
155 'serializedData': function() { 155 'serializedData': function() {
156 return this.config(); 156 return this.config();
157 }, 157 },
158 158
159 //------------------------------------------------------------------------- 159 //-------------------------------------------------------------------------
160 160
161 'saveChanges': function(aReferenceElement) { 161 'saveChanges': function(aReferenceElement) {
162 vardeferredResult; 162 vardeferredResult;
163 163
164 deferredResult = new MochiKit.Async.Deferred(); 164 deferredResult = new MochiKit.Async.Deferred();
165 165
166 deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'), 166 deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'),
167 { 167 {
168 title:"", //Clipperz.PM.Strings['accountPreferencesSavingPanelTitle_Step1'], 168 title:"", //Clipperz.PM.Strings['accountPreferencesSavingPanelTitle_Step1'],
169 text:"", //Clipperz.PM.Strings['accountPreferencesSavingPanelText_Step1'], 169 text:"", //Clipperz.PM.Strings['accountPreferencesSavingPanelText_Step1'],
170 width:240, 170 width:240,
171 showProgressBar:true, 171 showProgressBar:true,
172 showCloseButton:false 172 showCloseButton:false
173 }, 173 },
174 aReferenceElement 174 aReferenceElement
175 ); 175 );
176 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'account_savingPreferences_1'); 176 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'account_savingPreferences_1');
177 deferredResult.addCallback(MochiKit.Base.method(this.user(), 'encryptedData')); 177 deferredResult.addCallback(MochiKit.Base.method(this.user(), 'encryptedData'));
178 deferredResult.addCallback(function(res) { 178 deferredResult.addCallback(function(res) {
179 return {user:res}; 179 return {user:res};
180 }) 180 })
181 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'account_savingPreferences_2'); 181 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'account_savingPreferences_2');
182 deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'updateData'); 182 // deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'updateData');
183 deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'saveChanges');
183 deferredResult.addCallback(Clipperz.PM.Components.MessageBox().hide, YAHOO.ext.Element.get('main')); 184 deferredResult.addCallback(Clipperz.PM.Components.MessageBox().hide, YAHOO.ext.Element.get('main'));
184 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedPreferences', null); 185 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedPreferences', null);
185 186
186 deferredResult.callback(); 187 deferredResult.callback();
187 188
188 return deferredResult; 189 return deferredResult;
189 }, 190 },
190 191
191 //------------------------------------------------------------------------- 192 //-------------------------------------------------------------------------
192 __syntaxFix__: "syntax fix" 193 __syntaxFix__: "syntax fix"
193}); 194});
194 195