Fix style/navigation on error page depending on authentication state (#6362)

pull/328/merge
Aleksander Machniak 6 years ago
parent e5c6c4f3f3
commit 2c12274d38

@ -11,6 +11,7 @@ CHANGELOG Roundcube Webmail
- Elastic: Improved UX of search dialogs (#6416)
- Elastic: Fix unwanted thread expanding when selecting a collapsed thread in non-mobile mode (#6445)
- Log errors caused by low pcre.backtrack_limit when sending a mail message (#6433)
- Fix style/navigation on error page depending on authentication state (#6362)
- Fix so invalid smtp_helo_host is never used, fallback to localhost (#6408)
- Fix custom logo size in Elastic (#6424)
- Fix listing the same attachment multiple times on forwarded messages

@ -483,8 +483,26 @@ EOF;
public function reset($all = false)
{
$framed = $this->framed;
$task = $this->env['task'];
$env = $all ? null : array_intersect_key($this->env, array('extwin'=>1, 'framed'=>1));
// keep jQuery-UI files
$css_files = $script_files = array();
foreach ($this->css_files as $file) {
if (strpos($file, 'plugins/jqueryui') === 0) {
$css_files[] = $file;
}
}
foreach ($this->script_files as $position => $files) {
foreach ($files as $file) {
if (strpos($file, 'plugins/jqueryui') === 0) {
$script_files[$position][] = $file;
}
}
}
parent::reset();
// let some env variables survive
@ -492,16 +510,23 @@ EOF;
$this->framed = $framed || $this->env['framed'];
$this->js_labels = array();
$this->js_commands = array();
$this->script_files = array();
$this->scripts = array();
$this->header = '';
$this->footer = '';
$this->body = '';
$this->css_files = array();
$this->script_files = array();
// load defaults
if (!$all) {
$this->__construct();
}
// Note: we merge jQuery-UI scripts after jQuery...
$this->css_files = array_merge($this->css_files, $css_files);
$this->script_files = array_merge_recursive($this->script_files, $script_files);
$this->set_env('orig_task', $task);
}
/**
@ -573,7 +598,8 @@ EOF;
// if all js commands go to parent window we can ignore all
// script files and skip rcube_webmail initialization (#1489792)
if ($framed) {
// but not on error pages where skins may need jQuery, etc.
if ($framed && empty($this->js_env['server_error'])) {
$this->scripts = array();
$this->script_files = array();
$this->header = '';
@ -1651,9 +1677,9 @@ EOF;
* @param string $file File URL
* @param string $position Target position [head|foot]
*/
public function include_script($file, $position='head')
public function include_script($file, $position = 'head', $add_path = true)
{
if (!preg_match('|^https?://|i', $file) && $file[0] != '/') {
if ($add_path && !preg_match('|^https?://|i', $file) && $file[0] != '/') {
$file = $this->file_mod($this->scripts_path . $file);
}

@ -1526,7 +1526,7 @@ function rcube_webmail()
if (task == 'mail')
url += '&_mbox=INBOX';
else if (task == 'logout' && !this.env.server_error) {
else if (task == 'logout') {
url = this.secure_url(url);
this.clear_compose_data();
}

@ -596,8 +596,7 @@ class rcube_plugin_api
{
if (is_object($this->output) && $this->output->type == 'html') {
$src = $this->resource_url($fn);
$this->output->add_header(html::tag('script',
array('type' => "text/javascript", 'src' => $src)));
$this->output->include_script($src, 'head', false);
}
}

@ -127,6 +127,7 @@ EOF;
if ($rcmail->output && $rcmail->output->template_exists('error')) {
$rcmail->output->reset();
$rcmail->output->set_env('error_task', 'error' . (empty($rcmail->user) || empty($rcmail->user->ID) ? '-login' : ''));
$rcmail->output->set_env('server_error', $ERROR_CODE);
$rcmail->output->set_env('comm_path', $rcmail->comm_path);
$rcmail->output->send('error');

@ -182,6 +182,12 @@ a {
}
}
body.task-error-login #layout {
& > .menu,
& > .content > .header {
display: none;
}
}
/*** Addressbook UI ***/

@ -3,8 +3,9 @@
<roundcube:if condition="!env:framed && !env:extwin" />
<roundcube:include file="includes/menu.html" />
<div class="content selected" role="main">
<div class="header">
<div class="header" role="toolbar">
<a class="button icon menu-button" href="#menu"><span class="inner"><roundcube:label name="menu" /></span></a>
<span class="header-title"></span>
</div>
<div class="frame-content scroller">
<roundcube:else />

@ -6,6 +6,7 @@
<roundcube:add_label name="previous" />
<roundcube:add_label name="next" />
<roundcube:add_label name="select" />
<roundcube:add_label name="close" />
<roundcube:object name="doctype" value="html5" />
<roundcube:if condition="!env:framed || env:extwin" />
<html>
@ -25,11 +26,8 @@
<link rel="stylesheet" href="/styles/styles.css">
<roundcube:link rel="stylesheet" href="/styles/print.css" condition="env:action == 'print'" />
<roundcube:endif />
<roundcube:if condition="template:name == 'error'" />
<script src="program/js/jquery.min.js"></script>
<roundcube:endif />
</head>
<body class="task-<roundcube:exp expression="env:task ?: 'error'">">
<body class="task-<roundcube:exp expression="env:error_task ?: env:task ?: 'error'">">
<roundcube:if condition="!env:framed || env:extwin" />
<div id="<roundcube:exp expression="env:action == 'print' ? 'print-' : ''">layout">
<roundcube:endif />

@ -4,7 +4,7 @@
<title><roundcube:object name="pagetitle" /></title>
<roundcube:include file="/includes/links.html" />
</head>
<roundcube:if condition="!env:framed" />
<roundcube:if condition="!env:framed && env:error_task != 'error-login'" />
<body class="error<roundcube:exp expression="env:extwin ? ' extwin' : ''" />">
<roundcube:include file="/includes/header.html" />
<roundcube:else />

Loading…
Cancel
Save