Changeset 4dcd437 in github


Ignore:
Timestamp:
Jun 1, 2011 1:05:18 PM (2 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
4fb6a28
Parents:
3cacf94
Message:

Add collected text labels in one single function call

Location:
program
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcube_template.php

    r8e99ffb r4dcd437  
    3636    private $message = null; 
    3737    private $js_env = array(); 
     38    private $js_labels = array(); 
    3839    private $js_commands = array(); 
    3940    private $object_handlers = array(); 
     
    231232 
    232233        foreach ($args as $name) { 
    233             $this->command('add_label', $name, rcube_label($name)); 
     234            $this->js_labels[$name] = rcube_label($name); 
    234235        } 
    235236    } 
     
    267268        $this->env = array(); 
    268269        $this->js_env = array(); 
     270        $this->js_labels = array(); 
    269271        $this->js_commands = array(); 
    270272        $this->object_handlers = array(); 
     
    452454        if (!$this->framed && !empty($this->js_env)) { 
    453455            $out .= JS_OBJECT_NAME . '.set_env('.json_serialize($this->js_env).");\n"; 
     456        } 
     457        if (!empty($this->js_labels)) { 
     458            $this->command('add_label', $this->js_labels); 
    454459        } 
    455460        foreach ($this->js_commands as $i => $args) { 
  • program/js/app.js

    r3cacf94 r4dcd437  
    7171 
    7272  // add a localized label to the client environment 
    73   this.add_label = function(key, value) 
    74   { 
    75     this.labels[key] = value; 
     73  this.add_label = function(p, value) 
     74  { 
     75    if (typeof p == 'string') 
     76      this.labels[p] = value; 
     77    else if (typeof p == 'object') 
     78      $.extend(this.labels, p); 
    7679  }; 
    7780 
Note: See TracChangeset for help on using the changeset viewer.