[Svn] r3988 - trunk/roundcubemail/program/js

trac at roundcube.net trac at roundcube.net
Sat Sep 25 12:34:54 CEST 2010


Author: alec
Date: 2010-09-25 05:34:54 -0500 (Sat, 25 Sep 2010)
New Revision: 3988

Modified:
   trunk/roundcubemail/program/js/app.js
Log:
- Support action in form of "task/action" in goto_url()


Modified: trunk/roundcubemail/program/js/app.js
===================================================================
--- trunk/roundcubemail/program/js/app.js	2010-09-24 07:17:46 UTC (rev 3987)
+++ trunk/roundcubemail/program/js/app.js	2010-09-25 10:34:54 UTC (rev 3988)
@@ -4887,12 +4887,20 @@
 
   this.goto_url = function(action, query, lock)
   {
-    var querystring = query ? '&'+query : '';
-    this.redirect(this.env.comm_path+'&_action='+action+querystring, lock);
+    var url = this.env.comm_path,
+     querystring = query ? '&'+query : '';
+
+    // overwrite task name
+    if (action.match(/([a-z]+)\/([a-z-_]+)/)) {
+      action = RegExp.$2;
+      url = url.replace(/\_task=[a-z]+/, '_task='+RegExp.$1);
+    }
+
+    this.redirect(url+'&_action='+action+querystring, lock);
   };
 
   // send a http request to the server
-  this.http_request = function(action, querystring, lock)
+  this.http_request = function(action, query, lock)
   {
     var url = this.env.comm_path;
 
@@ -4903,17 +4911,17 @@
     }
 
     // trigger plugin hook
-    var result = this.triggerEvent('request'+action, querystring);
+    var result = this.triggerEvent('request'+action, query);
 
     if (typeof result != 'undefined') {
       // abort if one the handlers returned false
       if (result === false)
         return false;
       else
-        querystring = result;
+        query = result;
     }
 
-    url += '&_remote=1&_action=' + action + (querystring ? '&' : '') + querystring;
+    url += '&_remote=1&_action=' + action + (query ? '&' : '') + query;
 
     // send request
     console.log('HTTP GET: ' + url);

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



More information about the Svn mailing list