add optional parameter $plain to exitError()

if set, the resulting html will only be a html fragment to be embedded
in a page
This commit is contained in:
Uwe Steinmann 2016-08-22 17:01:53 +02:00
parent 34ce80eb3d
commit 3fbfadeebd
2 changed files with 15 additions and 11 deletions

View File

@ -128,12 +128,12 @@ class UI extends UI_Default {
return $themes;
} /* }}} */
static function exitError($pagetitle, $error) {
static function exitError($pagetitle, $error, $noexit=false, $plain=false) {
global $theme, $dms;
$tmp = 'ErrorDlg';
$view = UI::factory($theme, $tmp);
$view->setParam('dms', $dms);
$view->exitError($pagetitle, $error);
$view->exitError($pagetitle, $error, $noexit, $plain);
}
}

View File

@ -1438,20 +1438,24 @@ $('#clearfilename<?php print $formName ?>').click(function(ev) {
echo "</div>\n";
} /* }}} */
function exitError($pagetitle, $error, $noexit=false) { /* {{{ */
$this->htmlStartPage($pagetitle);
$this->globalNavigation();
$this->contentStart();
function exitError($pagetitle, $error, $noexit=false, $plain=false) { /* {{{ */
if(!$plain) {
$this->htmlStartPage($pagetitle);
$this->globalNavigation();
$this->contentStart();
}
print "<div class=\"alert alert-error\">";
print "<h4>".getMLText('error')."!</h4>";
print htmlspecialchars($error);
print "</div>";
print "<div><button class=\"btn history-back\">".getMLText('back')."</button></div>";
$this->contentEnd();
$this->htmlEndPage();
if(!$plain) {
print "<div><button class=\"btn history-back\">".getMLText('back')."</button></div>";
$this->contentEnd();
$this->htmlEndPage();
}
// add_log_line(" UI::exitError error=".$error." pagetitle=".$pagetitle, PEAR_LOG_ERR);