diff options
author | thomascube <thomas@roundcube.net> | 2008-06-20 10:40:01 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2008-06-20 10:40:01 +0000 |
commit | c719f3c1e06c00fa4723f2f1298b3c94a1bec7e7 (patch) | |
tree | b343f67ba679e5761c6b27e2cb398de0e6a83a2d /program/include | |
parent | 4e59f63323341b546eaf0dddbb23f38128d7fb14 (diff) |
Store compose parameters in session and redirect to a unique URL
Diffstat (limited to 'program/include')
-rw-r--r-- | program/include/rcmail.php | 22 | ||||
-rw-r--r-- | program/include/rcube_imap.php | 1 | ||||
-rw-r--r-- | program/include/rcube_json_output.php | 21 | ||||
-rwxr-xr-x | program/include/rcube_template.php | 16 |
4 files changed, 55 insertions, 5 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 009ad0448..7c12ef779 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -139,7 +139,7 @@ class rcmail $task = 'mail'; $this->task = $task; - $this->comm_path = './?_task=' . $task; + $this->comm_path = $this->url(array('task' => $task)); if ($this->output) $this->output->set_env('task', $task); @@ -820,6 +820,26 @@ class rcmail return preg_replace('/\x00/', '', $pass); } + + /** + * Build a valid URL to this instance of RoundCube + * + * @param mixed Either a string with the action or url parameters as key-value pairs + * @return string Valid application URL + */ + public function url($p) + { + if (!is_array($p)) + $p = array('action' => @func_get_arg(0)); + + $url = $p['task'] ? './?_task=' . $p['task'] : $this->comm_path; + unset($p['task']); + + foreach ($p as $par => $val) + $url .= sprintf('&%s=%s', urlencode($par), urlencode($val)); + + return $url; + } } diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index fb3870b29..858a1e2c6 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -1487,6 +1487,7 @@ class rcube_imap { $this->_expunge($mailbox, FALSE); $this->_clear_messagecount($mailbox); + unset($this->uid_id_map[$mailbox]); } // remove message ids from search set diff --git a/program/include/rcube_json_output.php b/program/include/rcube_json_output.php index 678b1948a..2f65c19e9 100644 --- a/program/include/rcube_json_output.php +++ b/program/include/rcube_json_output.php @@ -58,12 +58,14 @@ class rcube_json_output } /** - * @ignore + * Issue command to set page title + * + * @param string New page title */ public function set_pagetitle($title) { - $name = $this->config->get('product_name'); - $this->command('set_pagetitle', JQ(empty($name) ? $title : $name.' :: '.$title)); + $name = $this->config->get('product_name'); + $this->command('set_pagetitle', JQ(empty($name) ? $title : $name.' :: '.$title)); } /** @@ -161,6 +163,19 @@ class rcube_json_output $this->commands = array(); } + /** + * Redirect to a certain url + * + * @param mixed Either a string with the action or url parameters as key-value pairs + * @see rcmail::url() + */ + public function redirect($p = array(), $delay = 0) + { + $location = rcmail::get_instance()->url($p); + $this->remote_response("window.setTimeout(\"location.href='{$location}'\", $delay);"); + exit; + } + /** * Send an AJAX response to the client. diff --git a/program/include/rcube_template.php b/program/include/rcube_template.php index 53808bd2b..75a9a601d 100755 --- a/program/include/rcube_template.php +++ b/program/include/rcube_template.php @@ -218,7 +218,7 @@ class rcube_template extends rcube_html_page * @uses self::$js_commands * @uses self::$object_handlers */ - public public function reset() + public function reset() { $this->env = array(); $this->js_env = array(); @@ -229,6 +229,20 @@ class rcube_template extends rcube_html_page /** + * Redirect to a certain url + * + * @param mixed Either a string with the action or url parameters as key-value pairs + * @see rcmail::url() + */ + public function redirect($p = array()) + { + $location = $this->app->url($p); + header('Location: ' . $location); + exit; + } + + + /** * Send the request output to the client. * This will either parse a skin tempalte or send an AJAX response * |