summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcmail.php46
-rw-r--r--program/include/rcmail_output_html.php70
2 files changed, 82 insertions, 34 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index d4305b505..f4689215c 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -428,7 +428,8 @@ class rcmail extends rcube
}
// add some basic labels to client
- $this->output->add_label('loading', 'servererror', 'connerror', 'requesttimedout', 'refreshing');
+ $this->output->add_label('loading', 'servererror', 'connerror', 'requesttimedout',
+ 'refreshing', 'windowopenerror');
return $this->output;
}
@@ -1076,14 +1077,17 @@ class rcmail extends rcube
}
else {
foreach ($table_data as $row_data) {
- $class = !empty($row_data['class']) ? $row_data['class'] : '';
+ $class = !empty($row_data['class']) ? $row_data['class'] : null;
+ if (!empty($attrib['rowclass']))
+ $class = trim($class . ' ' . $attrib['rowclass']);
$rowid = 'rcmrow' . rcube_utils::html_identifier($row_data[$id_col]);
$table->add_row(array('id' => $rowid, 'class' => $class));
// format each col
foreach ($a_show_cols as $col) {
- $table->add($col, $this->Q(is_array($row_data[$col]) ? $row_data[$col][0] : $row_data[$col]));
+ $val = is_array($row_data[$col]) ? $row_data[$col][0] : $row_data[$col];
+ $table->add($col, empty($attrib['ishtml']) ? $this->Q($val) : $val);
}
}
}
@@ -1321,7 +1325,8 @@ class rcmail extends rcube
*/
public function folder_selector($p = array())
{
- $p += array('maxlength' => 100, 'realnames' => false, 'is_escaped' => true);
+ $realnames = $this->config->get('show_real_foldernames');
+ $p += array('maxlength' => 100, 'realnames' => $realnames, 'is_escaped' => true);
$a_mailboxes = array();
$storage = $this->get_storage();
@@ -1489,7 +1494,7 @@ class rcmail extends rcube
$html_name = $this->Q($foldername) . ($unread ? html::span('unreadcount', sprintf($attrib['unreadwrap'], $unread)) : '');
$link_attrib = $folder['virtual'] ? array() : array(
'href' => $this->url(array('_mbox' => $folder['id'])),
- 'onclick' => sprintf("return %s.command('list','%s',this)", rcmail_output::JS_OBJECT_NAME, $js_name),
+ 'onclick' => sprintf("return %s.command('list','%s',this,event)", rcmail_output::JS_OBJECT_NAME, $js_name),
'rel' => $folder['id'],
'title' => $title,
);
@@ -1769,31 +1774,36 @@ class rcmail extends rcube
return;
}
- $lang = strtolower($_SESSION['language']);
+ $lang_codes = array($_SESSION['language']);
- // TinyMCE uses two-letter lang codes, with exception of Chinese
- if (strpos($lang, 'zh_') === 0) {
- $lang = str_replace('_', '-', $lang);
+ if ($pos = strpos($_SESSION['language'], '_')) {
+ $lang_codes[] = substr($_SESSION['language'], 0, $pos);
}
- else {
- $lang = substr($lang, 0, 2);
+
+ foreach ($lang_codes as $code) {
+ if (file_exists(INSTALL_PATH . 'program/js/tinymce/langs/'.$code.'.js')) {
+ $lang = $code;
+ break;
+ }
}
- if (!file_exists(INSTALL_PATH . 'program/js/tiny_mce/langs/'.$lang.'.js')) {
+ if (empty($lang)) {
$lang = 'en';
}
- $script = json_encode(array(
+ $config = array(
'mode' => $mode,
'lang' => $lang,
'skin_path' => $this->output->get_skin_path(),
'spellcheck' => intval($this->config->get('enable_spellcheck')),
'spelldict' => intval($this->config->get('spellcheck_dictionary'))
- ));
+ );
- $this->output->include_script('tiny_mce/tiny_mce.js');
+ $this->output->add_label('selectimage', 'addimage', 'selectmedia', 'addmedia');
+ $this->output->set_env('editor_config', $config);
+ $this->output->include_css('program/js/tinymce/roundcube/browser.css');
+ $this->output->include_script('tinymce/tinymce.min.js');
$this->output->include_script('editor.js');
- $this->output->add_script("rcmail_editor_init($script)", 'docready');
}
/**
@@ -1825,8 +1835,8 @@ class rcmail extends rcube
);
foreach ($emoticons as $idx => $file) {
- // <img title="Cry" src="http://.../program/js/tiny_mce/plugins/emotions/img/smiley-cry.gif" border="0" alt="Cry" />
- $search[] = '/<img title="[a-z ]+" src="https?:\/\/[a-z0-9_.\/-]+\/tiny_mce\/plugins\/emotions\/img\/'.$file.'.gif"[^>]+\/>/i';
+ // <img title="Cry" src="http://.../program/js/tinymce/plugins/emoticons/img/smiley-cry.gif" border="0" alt="Cry" />
+ $search[] = '/<img title="[a-z ]+" src="https?:\/\/[a-z0-9_.\/-]+\/tinymce\/plugins\/emoticons\/img\/'.$file.'.gif"[^>]+\/>/i';
$replace[] = $idx;
}
diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php
index 2a90f6a01..f5430d95a 100644
--- a/program/include/rcmail_output_html.php
+++ b/program/include/rcmail_output_html.php
@@ -68,6 +68,7 @@ class rcmail_output_html extends rcmail_output
$this->set_env('task', $task);
$this->set_env('x_frame_options', $this->config->get('x_frame_options', 'sameorigin'));
$this->set_env('standard_windows', (bool) $this->config->get('standard_windows'));
+ $this->set_env('locale', $_SESSION['language']);
// add cookie info
$this->set_env('cookie_domain', ini_get('session.cookie_domain'));
@@ -418,15 +419,6 @@ EOF;
*/
public function write($template = '')
{
- // unlock interface after iframe load
- $unlock = preg_replace('/[^a-z0-9]/i', '', $_REQUEST['_unlock']);
- if ($this->framed) {
- array_unshift($this->js_commands, array('iframe_loaded', $unlock));
- }
- else if ($unlock) {
- array_unshift($this->js_commands, array('hide_message', $unlock));
- }
-
if (!empty($this->script_files)) {
$this->set_env('request_token', $this->app->get_request_token());
}
@@ -571,18 +563,31 @@ EOF;
*/
protected function get_js_commands(&$framed = null)
{
+ $out = '';
+ $parent_commands = 0;
+ $top_commands = array();
+
+ // these should be always on top,
+ // e.g. hide_message() below depends on env.framed
if (!$this->framed && !empty($this->js_env)) {
- $this->command('set_env', $this->js_env);
+ $top_commands[] = array('set_env', $this->js_env);
}
-
if (!empty($this->js_labels)) {
- $this->command('add_label', $this->js_labels);
+ $top_commands[] = array('add_label', $this->js_labels);
}
- $out = '';
- $parent_commands = 0;
+ // unlock interface after iframe load
+ $unlock = preg_replace('/[^a-z0-9]/i', '', $_REQUEST['_unlock']);
+ if ($this->framed) {
+ $top_commands[] = array('iframe_loaded', $unlock);
+ }
+ else if ($unlock) {
+ $top_commands[] = array('hide_message', $unlock);
+ }
- foreach ($this->js_commands as $i => $args) {
+ $commands = array_merge($top_commands, $this->js_commands);
+
+ foreach ($commands as $i => $args) {
$method = array_shift($args);
$parent = $this->framed || preg_match('/^parent\./', $method);
@@ -603,7 +608,7 @@ EOF;
$out .= sprintf("%s(%s);\n", $method, implode(',', $args));
}
- $framed = $parent_prefix && $parent_commands == count($this->js_commands);
+ $framed = $parent_prefix && $parent_commands == count($commands);
// make the output more compact if all commands go to parent window
if ($framed) {
@@ -892,6 +897,14 @@ EOF;
return '';
}
+ // localize title and summary attributes
+ if ($command != 'button' && !empty($attrib['title']) && $this->app->text_exists($attrib['title'])) {
+ $attrib['title'] = $this->app->gettext($attrib['title']);
+ }
+ if ($command != 'button' && !empty($attrib['summary']) && $this->app->text_exists($attrib['summary'])) {
+ $attrib['summary'] = $this->app->gettext($attrib['summary']);
+ }
+
// execute command
switch ($command) {
// return a button
@@ -1164,6 +1177,17 @@ EOF;
$attrib['alt'] = html::quote($this->app->gettext($attrib['alt'], $attrib['domain']));
}
+ // set accessibility attributes
+ if (!$attrib['role']) {
+ $attrib['role'] = 'button';
+ }
+ if (!empty($attrib['class']) && !empty($attrib['classact']) || !empty($attrib['imagepas']) && !empty($attrib['imageact'])) {
+ if (array_key_exists('tabindex', $attrib))
+ $attrib['data-tabindex'] = $attrib['tabindex'];
+ $attrib['tabindex'] = '-1'; // disable button by default
+ $attrib['aria-disabled'] = 'true';
+ }
+
// set title to alt attribute for IE browsers
if ($this->browser->ie && !$attrib['title'] && $attrib['alt']) {
$attrib['title'] = $attrib['alt'];
@@ -1352,6 +1376,20 @@ EOF;
$is_empty = true;
}
+ // set default page title
+ if (empty($this->pagetitle)) {
+ $this->pagetitle = 'Roundcube Mail';
+ }
+
+ // declare page language
+ if (!empty($_SESSION['language'])) {
+ $lang = substr($_SESSION['language'], 0, 2);
+ $output = preg_replace('/<html/', '<html lang="' . html::quote($lang) . '"', $output, 1);
+ if (!headers_sent()) {
+ header('Content-Language: ' . $lang);
+ }
+ }
+
// replace specialchars in content
$page_title = html::quote($this->pagetitle);
$page_header = '';