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

trac at roundcube.net trac at roundcube.net
Wed Jun 1 19:05:18 CEST 2011


Author: thomasb
Date: 2011-06-01 12:05:18 -0500 (Wed, 01 Jun 2011)
New Revision: 4825

Modified:
   trunk/roundcubemail/program/include/rcube_template.php
   trunk/roundcubemail/program/js/app.js
Log:
Add collected text labels in one single function call

Modified: trunk/roundcubemail/program/include/rcube_template.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_template.php	2011-06-01 17:02:03 UTC (rev 4824)
+++ trunk/roundcubemail/program/include/rcube_template.php	2011-06-01 17:05:18 UTC (rev 4825)
@@ -35,6 +35,7 @@
     private $pagetitle = '';
     private $message = null;
     private $js_env = array();
+    private $js_labels = array();
     private $js_commands = array();
     private $object_handlers = array();
     private $plugin_skin_path;
@@ -230,7 +231,7 @@
           $args = $args[0];
 
         foreach ($args as $name) {
-            $this->command('add_label', $name, rcube_label($name));
+            $this->js_labels[$name] = rcube_label($name);
         }
     }
 
@@ -266,6 +267,7 @@
     {
         $this->env = array();
         $this->js_env = array();
+        $this->js_labels = array();
         $this->js_commands = array();
         $this->object_handlers = array();
         parent::reset();
@@ -452,6 +454,9 @@
         if (!$this->framed && !empty($this->js_env)) {
             $out .= JS_OBJECT_NAME . '.set_env('.json_serialize($this->js_env).");\n";
         }
+        if (!empty($this->js_labels)) {
+            $this->command('add_label', $this->js_labels);
+        }
         foreach ($this->js_commands as $i => $args) {
             $method = array_shift($args);
             foreach ($args as $i => $arg) {

Modified: trunk/roundcubemail/program/js/app.js
===================================================================
--- trunk/roundcubemail/program/js/app.js	2011-06-01 17:02:03 UTC (rev 4824)
+++ trunk/roundcubemail/program/js/app.js	2011-06-01 17:05:18 UTC (rev 4825)
@@ -70,9 +70,12 @@
   };
 
   // add a localized label to the client environment
-  this.add_label = function(key, value)
+  this.add_label = function(p, value)
   {
-    this.labels[key] = value;
+    if (typeof p == 'string')
+      this.labels[p] = value;
+    else if (typeof p == 'object')
+      $.extend(this.labels, p);
   };
 
   // add a button to the button list

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



More information about the Svn mailing list