diff --git a/core/src/Controllers/Template.php b/core/src/Controllers/Template.php index d450d4290a..eda892c152 100644 --- a/core/src/Controllers/Template.php +++ b/core/src/Controllers/Template.php @@ -159,7 +159,16 @@ protected function parameterData() if ($id > 0) { if (!$data->exists) { - $this->managerTheme->alertAndQuit('No database record has been found for this template.'); + // false: the message is the message, not a lexicon key - and a + // key that does not exist used to resolve to '', so this alert + // was empty. The URL is the page's own Cancel target: without + // one the alert falls back to history.back(-1), straight into + // the request that raised it. + $this->managerTheme->alertAndQuit( + 'No database record has been found for this template.', + false, + 'index.php?a=76&tab=0' + ); } $_SESSION['itemname'] = $data->templatename; diff --git a/core/src/Core.php b/core/src/Core.php index 1d2061e943..d937b554ac 100644 --- a/core/src/Core.php +++ b/core/src/Core.php @@ -3610,8 +3610,8 @@ public function webAlertAndQuit($msg, $url = '') $style = ''; if (IN_MANAGER_MODE) { $path = 'media/style/' . $this->getConfig('manager_theme') . '/'; - if (is_file(EVO_MANAGER_PATH . $path . '/css/styles.min.css')) { - $file_name = '/css/styles.min.css'; + if (is_file(EVO_MANAGER_PATH . $path . 'css/styles.min.css')) { + $file_name = 'css/styles.min.css'; } else { $file_name = 'style.css'; } diff --git a/core/src/ManagerTheme.php b/core/src/ManagerTheme.php index 25e6799b2b..f37a509758 100644 --- a/core/src/ManagerTheme.php +++ b/core/src/ManagerTheme.php @@ -838,12 +838,21 @@ public function getCore(): CoreInterface /** * @inheritdoc */ - public function alertAndQuit(string $message, $lexicon = true): void + /** + * @param string $message a lexicon key, or the message itself when $lexicon is false + * @param bool $lexicon whether $message is a key to look up + * @param string $url where to send the user after the alert. Empty means + * history.back(-1), which on a page that alerts as soon + * as it is opened returns to the page that alerts - a + * loop the user cannot leave. Pass a destination + * whenever the alert ends the page. + */ + public function alertAndQuit(string $message, $lexicon = true, string $url = ''): void { if ($lexicon) { - $message = $this->getLexicon($message); + $message = $this->getLexicon($message, $message); } - $this->getCore()->webAlertAndQuit($message); + $this->getCore()->webAlertAndQuit($message, $url); } public function isLoadDatePicker(): bool