summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-05-16 13:19:46 +0000
committeralecpl <alec@alec.pl>2011-05-16 13:19:46 +0000
commit9b6c82fdc8e0f74a1ca0f838e710c944c5526f65 (patch)
treef87d3fe75a9b59bb506ede61407cc3eb37658633
parent21461dce77dd67a45a22e361dca4ecaf6c580788 (diff)
- Add extended command for saving prefs
-rw-r--r--program/js/app.js18
-rw-r--r--skins/default/functions.js3
2 files changed, 17 insertions, 4 deletions
diff --git a/program/js/app.js b/program/js/app.js
index b0ccf35b5..3f103de65 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -161,7 +161,7 @@ function rcube_webmail()
}
// enable general commands
- this.enable_command('logout', 'mail', 'addressbook', 'settings', true);
+ this.enable_command('logout', 'mail', 'addressbook', 'settings', 'save-pref', true);
if (this.env.permaurl)
this.enable_command('permaurl', true);
@@ -1168,6 +1168,18 @@ function rcube_webmail()
return (this.env.framed && parent.rcmail && parent.rcmail != this && parent.rcmail.command);
};
+ this.save_pref = function(prop)
+ {
+ var request = {'_name': prop.name, '_value': urlencode(prop.value)};
+
+ if (prop.session)
+ request['_session'] = urlencode(prop.session);
+ if (prop.env)
+ this.env[prop.env] = prop.value;
+
+ this.http_post('save-pref', request);
+ };
+
/*********************************************************/
/********* event handling methods *********/
@@ -1360,7 +1372,7 @@ function rcube_webmail()
}
}
- this.http_post('save-pref', '_name=collapsed_folders&_value='+urlencode(this.env.collapsed_folders));
+ this.command('save-pref', { name: collapsed_folders, value: this.env.collapsed_folders });
this.set_unread_count_display(id, false);
};
@@ -1534,7 +1546,7 @@ function rcube_webmail()
if ((found = $.inArray('subject', this.env.coltypes)) >= 0)
this.set_env('subject_col', found);
- this.http_post('save-pref', { '_name':'list_cols', '_value':this.env.coltypes, '_session':'list_attrib/columns' });
+ this.command('save-pref', { name: 'list_cols', value: this.env.coltypes, session: 'list_attrib/columns' });
};
this.check_droptarget = function(id)
diff --git a/skins/default/functions.js b/skins/default/functions.js
index 0b94c68f4..c1dd8c2ab 100644
--- a/skins/default/functions.js
+++ b/skins/default/functions.js
@@ -347,7 +347,8 @@ switch_preview_pane: function(elem)
rcmail.env.contentframe = null;
rcmail.show_contentframe(false);
}
- rcmail.http_post('save-pref', '_name=preview_pane&_value='+(elem.checked?1:0));
+
+ rcmail.command('save-pref', {name: 'preview_pane', value: (elem.checked?1:0)});
},
/* Message composing */