Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2018-04-06 16:38:09 +02:00
commit 295a6d0fe7
8 changed files with 73 additions and 14 deletions

View File

@ -140,10 +140,15 @@ class UI extends UI_Default {
static function exitError($pagetitle, $error, $noexit=false, $plain=false) {
global $theme, $dms;
$tmp = 'ErrorDlg';
$view = UI::factory($theme, $tmp);
$view = UI::factory($theme, 'ErrorDlg');
$view->setParam('dms', $dms);
$view->exitError($pagetitle, $error, $noexit, $plain);
$view->setParam('pagetitle', $pagetitle);
$view->setParam('errormsg', $error);
$view->setParam('plain', $plain);
$view();
if($noexit)
return;
exit;
}
}

View File

@ -33,8 +33,7 @@ include $settings->_rootDir . "languages/" . $settings->_language . "/lang.inc";
function _printMessage($heading, $message) { /* {{{ */
global $dms, $theme;
$view = UI::factory($theme, 'Login', array('dms'=>$dms));
$view->exitError($heading, $message, true);
UI::exitError($heading, $message, true);
return;
} /* }}} */

View File

@ -43,7 +43,7 @@ else $end = '';
if(isset($_GET['documentid']) && $_GET['documentid'] && is_numeric($_GET['documentid'])) {
$document = $dms->getDocument($_GET["documentid"]);
if (!is_object($document)) {
$view->exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
}
} else
$document = null;

View File

@ -31,7 +31,7 @@ $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
if (!$accessop->check_view_access($view, $_GET)) {
$view->exitError(getMLText("admin_tools"),getMLText("access_denied"));
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
}
$rootfolder = $dms->getFolder($settings->_rootFolderID);

View File

@ -35,23 +35,23 @@ $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) {
$view->exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
}
$document = $dms->getDocument($_GET["documentid"]);
if (!is_object($document)) {
$view->exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
}
$folder = $document->getFolder();
if ($document->getAccessMode($user) < M_READ || !$document->getLatestContent()) {
$view->exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied"));
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied"));
}
/* Could be that the advanced access rights prohibit access on the content */
if (!$document->getLatestContent()) {
$view->exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied"));
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied"));
}
/* Recalculate the status of a document and reload the page if the status

View File

@ -42,7 +42,7 @@ else {
$folder = $dms->getFolder($folderid);
if (!is_object($folder)) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id"));
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))), getMLText("invalid_folder_id"));
}
if (isset($_GET["orderby"]) && strlen($_GET["orderby"])==1 ) {

View File

@ -1520,7 +1520,7 @@ $(document).ready(function() {
echo "</div>\n";
} /* }}} */
function exitError($pagetitle, $error, $noexit=false, $plain=false) { /* {{{ */
function ___exitError($pagetitle, $error, $noexit=false, $plain=false) { /* {{{ */
/* This is just a hack to prevent creation of js files in an error
* case, because they will contain this error page again. It would be much
@ -1528,7 +1528,7 @@ $(document).ready(function() {
* $view() after setting the action to 'error'. This would also allow to
* set separate error pages for each view.
*/
if(!$noexit) {
if(!$noexit && isset($_REQUEST['action'])) {
if(in_array($_REQUEST['action'], array('js', 'footerjs'))) {
exit;
}
@ -2652,6 +2652,38 @@ mayscript>
parent::show();
} /* }}} */
function error(){ /* {{{ */
parent::error();
$dms = $this->params['dms'];
$user = $this->params['user'];
$pagetitle = $this->params['pagetitle'];
$errormsg = $this->params['errormsg'];
$plain = $this->params['plain'];
$noexit = $this->params['noexit'];
if(!$plain) {
$this->htmlStartPage($pagetitle);
$this->globalNavigation();
$this->contentStart();
}
print "<div class=\"alert alert-error\">";
print "<h4>".getMLText('error')."!</h4>";
print htmlspecialchars($errormsg);
print "</div>";
print "<div><button class=\"btn history-back\">".getMLText('back')."</button></div>";
$this->contentEnd();
$this->htmlEndPage();
add_log_line(" UI::exitError error=".$errormsg." pagetitle=".$pagetitle, PEAR_LOG_ERR);
if($noexit)
return;
exit;
} /* }}} */
/**
* Return HTML Template for jumploader
*

View File

@ -32,7 +32,30 @@ require_once("class.Bootstrap.php");
class SeedDMS_View_ErrorDlg extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$pagetitle = $this->params['pagetitle'];
$errormsg = $this->params['errormsg'];
$plain = $this->params['plain'];
if(!$plain) {
$this->htmlStartPage($pagetitle);
$this->globalNavigation();
$this->contentStart();
}
print "<div class=\"alert alert-error\">";
print "<h4>".getMLText('error')."!</h4>";
print htmlspecialchars($errormsg);
print "</div>";
print "<div><button class=\"btn history-back\">".getMLText('back')."</button></div>";
$this->contentEnd();
$this->htmlEndPage();
add_log_line(" UI::exitError error=".$errormsg." pagetitle=".$pagetitle, PEAR_LOG_ERR);
return;
} /* }}} */
}
?>