thomascube
2010-10-06 2fe8d6bdebbaa160ee062b18e78fe7e77b430e00
program/include/rcube_json_output.php
@@ -4,8 +4,8 @@
 +-----------------------------------------------------------------------+
 | program/include/rcube_json_output.php                                 |
 |                                                                       |
 | This file is part of the RoundCube Webmail client                     |
 | Copyright (C) 2008-2009, RoundCube Dev. - Switzerland                 |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2008-2010, Roundcube Dev. - Switzerland                 |
 | Licensed under the GNU GPL                                            |
 |                                                                       |
 | PURPOSE:                                                              |
@@ -36,19 +36,21 @@
    private $callbacks = array();
    private $message = null;
    public $browser;
    public $type = 'js';
    public $ajax_call = true;
    /**
     * Constructor
     */
    public function __construct($task)
    public function __construct($task=null)
    {
        $this->config = rcmail::get_instance()->config;
        $this->config  = rcmail::get_instance()->config;
        $this->browser = new rcube_browser();
    }
    /**
     * Set environment variable
     *
@@ -59,7 +61,8 @@
    {
        $this->env[$name] = $value;
    }
    /**
     * Issue command to set page title
     *
@@ -70,6 +73,7 @@
        $name = $this->config->get('product_name');
        $this->command('set_pagetitle', empty($name) ? $title : $name.' :: '.$title);
    }
    /**
     * @ignore
@@ -103,6 +107,7 @@
        // ignore
    }
    /**
     * Register a list of template object handlers
     *
@@ -113,8 +118,8 @@
    {
        // ignore
    }
    /**
     * Call a client method
     *
@@ -145,7 +150,7 @@
            $this->texts[$name] = rcube_label($name);
        }
    }
    /**
     * Invoke display_message command
@@ -167,7 +172,8 @@
            );
        }
    }
    /**
     * Delete all stored env variables and commands
     */
@@ -177,7 +183,8 @@
        $this->texts = array();
        $this->commands = array();
    }
    /**
     * Redirect to a certain url
     *
@@ -227,21 +234,21 @@
        $response = array('action' => $rcmail->action, 'unlock' => (bool)$_REQUEST['_unlock']);
        
        if (!empty($this->env))
          $response['env'] = $this->env;
            $response['env'] = $this->env;
          
        if (!empty($this->texts))
          $response['texts'] = $this->texts;
            $response['texts'] = $this->texts;
        // send function calls
        $response['exec'] = $this->get_js_commands() . $add;
        
        if (!empty($this->callbacks))
          $response['callbacks'] = $this->callbacks;
            $response['callbacks'] = $this->callbacks;
        echo json_serialize($response);
    }
    /**
     * Return executable javascript code for all registered commands
     *
@@ -267,5 +274,3 @@
        return $out;
    }
}