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; return $themes;
} /* }}} */ } /* }}} */
static function exitError($pagetitle, $error) { static function exitError($pagetitle, $error, $noexit=false, $plain=false) {
global $theme, $dms; global $theme, $dms;
$tmp = 'ErrorDlg'; $tmp = 'ErrorDlg';
$view = UI::factory($theme, $tmp); $view = UI::factory($theme, $tmp);
$view->setParam('dms', $dms); $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"; echo "</div>\n";
} /* }}} */ } /* }}} */
function exitError($pagetitle, $error, $noexit=false) { /* {{{ */ function exitError($pagetitle, $error, $noexit=false, $plain=false) { /* {{{ */
$this->htmlStartPage($pagetitle); if(!$plain) {
$this->globalNavigation(); $this->htmlStartPage($pagetitle);
$this->contentStart(); $this->globalNavigation();
$this->contentStart();
}
print "<div class=\"alert alert-error\">"; print "<div class=\"alert alert-error\">";
print "<h4>".getMLText('error')."!</h4>"; print "<h4>".getMLText('error')."!</h4>";
print htmlspecialchars($error); print htmlspecialchars($error);
print "</div>"; print "</div>";
print "<div><button class=\"btn history-back\">".getMLText('back')."</button></div>"; if(!$plain) {
print "<div><button class=\"btn history-back\">".getMLText('back')."</button></div>";
$this->contentEnd();
$this->htmlEndPage(); $this->contentEnd();
$this->htmlEndPage();
}
// add_log_line(" UI::exitError error=".$error." pagetitle=".$pagetitle, PEAR_LOG_ERR); // add_log_line(" UI::exitError error=".$error." pagetitle=".$pagetitle, PEAR_LOG_ERR);