- Fix doubled encoding in save-pref request (#1487941), small code improvements

release-0.6
alecpl 14 years ago
parent 4dcd437ade
commit 4fb6a28be2

@ -1205,7 +1205,7 @@ function rcmail_mailbox_list($attrib)
$RCMAIL->output->add_gui_object('mailboxlist', $attrib['id']); $RCMAIL->output->add_gui_object('mailboxlist', $attrib['id']);
$RCMAIL->output->set_env('mailboxes', $js_mailboxlist); $RCMAIL->output->set_env('mailboxes', $js_mailboxlist);
$RCMAIL->output->set_env('collapsed_folders', $RCMAIL->config->get('collapsed_folders')); $RCMAIL->output->set_env('collapsed_folders', (string)$RCMAIL->config->get('collapsed_folders'));
} }
return $out; return $out;

@ -280,7 +280,6 @@ function rcube_webmail()
break; break;
case 'addressbook': case 'addressbook':
if (this.gui_objects.folderlist) if (this.gui_objects.folderlist)
this.env.contactfolders = $.extend($.extend({}, this.env.address_sources), this.env.contactgroups); this.env.contactfolders = $.extend($.extend({}, this.env.address_sources), this.env.contactgroups);
@ -1178,10 +1177,10 @@ function rcube_webmail()
this.save_pref = function(prop) this.save_pref = function(prop)
{ {
var request = {'_name': prop.name, '_value': urlencode(prop.value)}; var request = {'_name': prop.name, '_value': prop.value};
if (prop.session) if (prop.session)
request['_session'] = urlencode(prop.session); request['_session'] = prop.session;
if (prop.env) if (prop.env)
this.env[prop.env] = prop.value; this.env[prop.env] = prop.value;
@ -2606,33 +2605,35 @@ function rcube_webmail()
// set class to read/unread // set class to read/unread
this.toggle_read_status = function(flag, a_uids) this.toggle_read_status = function(flag, a_uids)
{ {
var i, len = a_uids.length,
url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag,
lock = this.display_message(this.get_label('markingmessage'), 'loading');
// mark all message rows as read/unread // mark all message rows as read/unread
for (var i=0; i<a_uids.length; i++) for (i=0; i<len; i++)
this.set_message(a_uids[i], 'unread', (flag=='unread' ? true : false)); this.set_message(a_uids[i], 'unread', (flag=='unread' ? true : false));
var url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag,
lock = this.display_message(this.get_label('markingmessage'), 'loading');
// also send search request to get the right messages // also send search request to get the right messages
if (this.env.search_request) if (this.env.search_request)
url += '&_search='+this.env.search_request; url += '&_search='+this.env.search_request;
this.http_post('mark', url, lock); this.http_post('mark', url, lock);
for (var i=0; i<a_uids.length; i++) for (i=0; i<len; i++)
this.update_thread_root(a_uids[i], flag); this.update_thread_root(a_uids[i], flag);
}; };
// set image to flagged or unflagged // set image to flagged or unflagged
this.toggle_flagged_status = function(flag, a_uids) this.toggle_flagged_status = function(flag, a_uids)
{ {
var i, len = a_uids.length,
url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag,
lock = this.display_message(this.get_label('markingmessage'), 'loading');
// mark all message rows as flagged/unflagged // mark all message rows as flagged/unflagged
for (var i=0; i<a_uids.length; i++) for (i=0; i<len; i++)
this.set_message(a_uids[i], 'flagged', (flag=='flagged' ? true : false)); this.set_message(a_uids[i], 'flagged', (flag=='flagged' ? true : false));
var url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag,
lock = this.display_message(this.get_label('markingmessage'), 'loading');
// also send search request to get the right messages // also send search request to get the right messages
if (this.env.search_request) if (this.env.search_request)
url += '&_search='+this.env.search_request; url += '&_search='+this.env.search_request;
@ -2643,9 +2644,11 @@ function rcube_webmail()
// mark all message rows as deleted/undeleted // mark all message rows as deleted/undeleted
this.toggle_delete_status = function(a_uids) this.toggle_delete_status = function(a_uids)
{ {
var rows = this.message_list ? this.message_list.rows : []; var len = a_uids.length,
i, uid, all_deleted = true,
rows = this.message_list ? this.message_list.rows : [];
if (a_uids.length==1) { if (len == 1) {
if (!rows.length || (rows[a_uids[0]] && !rows[a_uids[0]].deleted)) if (!rows.length || (rows[a_uids[0]] && !rows[a_uids[0]].deleted))
this.flag_as_deleted(a_uids); this.flag_as_deleted(a_uids);
else else
@ -2654,8 +2657,7 @@ function rcube_webmail()
return true; return true;
} }
var uid, all_deleted = true; for (i=0; i<len; i++) {
for (var i=0, len=a_uids.length; i<len; i++) {
uid = a_uids[i]; uid = a_uids[i];
if (rows[uid] && !rows[uid].deleted) { if (rows[uid] && !rows[uid].deleted) {
all_deleted = false; all_deleted = false;
@ -2673,12 +2675,13 @@ function rcube_webmail()
this.flag_as_undeleted = function(a_uids) this.flag_as_undeleted = function(a_uids)
{ {
for (var i=0, len=a_uids.length; i<len; i++) var i, len=a_uids.length,
this.set_message(a_uids[i], 'deleted', false); url = '_uid='+this.uids_to_list(a_uids)+'&_flag=undelete',
var url = '_uid='+this.uids_to_list(a_uids)+'&_flag=undelete',
lock = this.display_message(this.get_label('markingmessage'), 'loading'); lock = this.display_message(this.get_label('markingmessage'), 'loading');
for (i=0; i<len; i++)
this.set_message(a_uids[i], 'deleted', false);
// also send search request to get the right messages // also send search request to get the right messages
if (this.env.search_request) if (this.env.search_request)
url += '&_search='+this.env.search_request; url += '&_search='+this.env.search_request;
@ -2744,13 +2747,13 @@ function rcube_webmail()
// argument should be a coma-separated list of uids // argument should be a coma-separated list of uids
this.flag_deleted_as_read = function(uids) this.flag_deleted_as_read = function(uids)
{ {
var icn_src, uid, var icn_src, uid, i, len,
rows = this.message_list ? this.message_list.rows : [], rows = this.message_list ? this.message_list.rows : [];
str = String(uids),
a_uids = str.split(',');
for (var i=0; i<a_uids.length; i++) { uids = String(uids).split(',');
uid = a_uids[i];
for (i=0, len=uids.length; i<len; i++) {
uid = uids[i];
if (rows[uid]) if (rows[uid])
this.set_message(uid, 'unread', false); this.set_message(uid, 'unread', false);
} }

Loading…
Cancel
Save