[Svn] r4826 - in trunk/roundcubemail/program: include js

trac at roundcube.net trac at roundcube.net
Wed Jun 1 21:31:55 CEST 2011


Author: alec
Date: 2011-06-01 14:31:53 -0500 (Wed, 01 Jun 2011)
New Revision: 4826

Modified:
   trunk/roundcubemail/program/include/main.inc
   trunk/roundcubemail/program/js/app.js
Log:
- Fix doubled encoding in save-pref request (#1487941), small code improvements


Modified: trunk/roundcubemail/program/include/main.inc
===================================================================
--- trunk/roundcubemail/program/include/main.inc	2011-06-01 17:05:18 UTC (rev 4825)
+++ trunk/roundcubemail/program/include/main.inc	2011-06-01 19:31:53 UTC (rev 4826)
@@ -1205,7 +1205,7 @@
 
     $RCMAIL->output->add_gui_object('mailboxlist', $attrib['id']);
     $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;

Modified: trunk/roundcubemail/program/js/app.js
===================================================================
--- trunk/roundcubemail/program/js/app.js	2011-06-01 17:05:18 UTC (rev 4825)
+++ trunk/roundcubemail/program/js/app.js	2011-06-01 19:31:53 UTC (rev 4826)
@@ -280,7 +280,6 @@
 
         break;
 
-
       case 'addressbook':
         if (this.gui_objects.folderlist)
           this.env.contactfolders = $.extend($.extend({}, this.env.address_sources), this.env.contactgroups);
@@ -1178,10 +1177,10 @@
 
   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)
-      request['_session'] = urlencode(prop.session);
+      request['_session'] = prop.session;
     if (prop.env)
       this.env[prop.env] = prop.value;
 
@@ -2606,33 +2605,35 @@
   // set class to read/unread
   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
-    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));
 
-    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
     if (this.env.search_request)
       url += '&_search='+this.env.search_request;
 
     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);
   };
 
   // set image to flagged or unflagged
   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
-    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));
 
-    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
     if (this.env.search_request)
       url += '&_search='+this.env.search_request;
@@ -2643,9 +2644,11 @@
   // mark all message rows as deleted/undeleted
   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))
         this.flag_as_deleted(a_uids);
       else
@@ -2654,8 +2657,7 @@
       return true;
     }
 
-    var uid, all_deleted = true;
-    for (var i=0, len=a_uids.length; i<len; i++) {
+    for (i=0; i<len; i++) {
       uid = a_uids[i];
       if (rows[uid] && !rows[uid].deleted) {
         all_deleted = false;
@@ -2673,12 +2675,13 @@
 
   this.flag_as_undeleted = function(a_uids)
   {
-    for (var i=0, len=a_uids.length; i<len; i++)
+    var i, len=a_uids.length,
+      url = '_uid='+this.uids_to_list(a_uids)+'&_flag=undelete',
+      lock = this.display_message(this.get_label('markingmessage'), 'loading');
+
+    for (i=0; i<len; i++)
       this.set_message(a_uids[i], 'deleted', false);
 
-    var url = '_uid='+this.uids_to_list(a_uids)+'&_flag=undelete',
-      lock = this.display_message(this.get_label('markingmessage'), 'loading');
-
     // also send search request to get the right messages
     if (this.env.search_request)
       url += '&_search='+this.env.search_request;
@@ -2744,13 +2747,13 @@
   // argument should be a coma-separated list of uids
   this.flag_deleted_as_read = function(uids)
   {
-    var icn_src, uid,
-      rows = this.message_list ? this.message_list.rows : [],
-      str = String(uids),
-      a_uids = str.split(',');
+    var icn_src, uid, i, len,
+      rows = this.message_list ? this.message_list.rows : [];
 
-    for (var i=0; i<a_uids.length; i++) {
-      uid = a_uids[i];
+    uids = String(uids).split(',');
+
+    for (i=0, len=uids.length; i<len; i++) {
+      uid = uids[i];
       if (rows[uid])
         this.set_message(uid, 'unread', false);
     }

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list