Merge branch 'seeddms-4.3.x' into seeddms-5.0.x

This commit is contained in:
Uwe Steinmann 2015-12-14 12:09:16 +01:00
commit 29f4ca0710
8 changed files with 90 additions and 34 deletions

View File

@ -32,7 +32,7 @@ if (!$user->isAdmin()) {
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'contentdir'=>$settings->_contentDir));
if($view) {
$view->show();
$view($_GET);
exit;
}

View File

@ -32,7 +32,7 @@ $exclude = intval($_GET["exclude"]);
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'rootfolderid'=>$settings->_rootFolderID, 'form'=>$form, 'mode'=>$mode, 'exclude'=>$exclude));
if($view) {
$view->show();
$view($_GET);
exit;
}

View File

@ -354,7 +354,7 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"]) {
$pageNumber = (int) $_GET["pg"];
}
elseif (!strcasecmp($_GET["pg"], "all")) {
$limit = 0;
// $limit = 0;
}
}
@ -387,7 +387,7 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"]) {
$totalPages = (int) (count($entries)/$limit);
if(count($entries)%$limit)
$totalPages++;
if($limit > 0)
if (strcasecmp($_GET["pg"], "all"))
$entries = array_slice($entries, ($pageNumber-1)*$limit, $limit);
// }}}
}
@ -433,7 +433,7 @@ if(count($entries) == 1) {
$view->setParam('workflowmode', $settings->_workflowMode);
$view->setParam('enablefullsearch', $settings->_enableFullSearch);
$view->setParam('previewWidthList', $settings->_previewWidthList);
$view->show();
$view($_GET);
exit;
}
}

View File

@ -31,6 +31,12 @@ require_once("class.Bootstrap.php");
*/
class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
function js() { /* {{{ */
$this->printFolderChooserJs("form1");
$this->printFolderChooserJs("form2");
$this->printFolderChooserJs("form3");
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
@ -53,7 +59,7 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
print "<p>".getMLText("versioning_file_creation_warning")."</p>\n";
print "<form class=\"form-inline\" action=\"../op/op.CreateVersioningFiles.php\" name=\"form1\">";
$this->printFolderChooser("form1",M_READWRITE);
$this->printFolderChooserHtml("form1",M_READWRITE);
print "<input type='submit' class='btn' name='' value='".getMLText("versioning_file_creation")."'/>";
print "</form>\n";
@ -66,7 +72,7 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
print "<p>".getMLText("archive_creation_warning")."</p>\n";
print "<form action=\"../op/op.CreateFolderArchive.php\" name=\"form2\">";
$this->printFolderChooser("form2",M_READWRITE);
$this->printFolderChooserHtml("form2",M_READWRITE);
print "<label class=\"checkbox\"><input type=\"checkbox\" name=\"human_readable\" value=\"1\">".getMLText("human_readable")."</label>";
print "<input type='submit' class='btn' name='' value='".getMLText("archive_creation")."'/>";
print "</form>\n";
@ -184,7 +190,7 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
print "<p>".getMLText("files_deletion_warning")."</p>\n";
print "<form class=\"form-inline\" action=\"../out/out.RemoveFolderFiles.php\" name=\"form3\">";
$this->printFolderChooser("form3",M_READWRITE);
$this->printFolderChooserHtml("form3",M_READWRITE);
print "<input type='submit' class='btn' name='' value='".getMLText("files_deletion")."'/>";
print "</form>\n";

View File

@ -51,7 +51,15 @@ class SeedDMS_Bootstrap_Style extends SeedDMS_View_Common {
function htmlStartPage($title="", $bodyClass="", $base="") { /* {{{ */
if(method_exists($this, 'js')) {
$csp_rules = "script-src 'self';"; // style-src 'self';";
/* We still need unsafe-eval, because printDocumentChooserHtml and
* printFolderChooserHtml will include a javascript file with ajax
* which is evaled by jquery
* X-WebKit-CSP is deprecated, Chrome understands Content-Security-Policy
* since version 25+
* X-Content-Security-Policy is deprecated, Firefox understands
* Content-Security-Policy since version 23+
*/
$csp_rules = "script-src 'self' 'unsafe-eval';"; // style-src 'self';";
foreach (array("X-WebKit-CSP", "X-Content-Security-Policy", "Content-Security-Policy") as $csp) {
header($csp . ": " . $csp_rules);
}
@ -310,7 +318,7 @@ $(document).ready(function () {
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
echo " <li><a href=\"../out/out.Help.php?context=".$tmp[1]."\">".getMLText("help")."</a></li>\n";
echo " </ul>\n";
echo " <form action=\"../op/op.Search.php\" class=\"form-inline navbar-search pull-left\" autocomplete=\"off\">";
echo " <form action=\"../out/out.Search.php\" class=\"form-inline navbar-search pull-left\" autocomplete=\"off\">";
if ($folder!=null && is_object($folder) && !strcasecmp(get_class($folder), $dms->getClassname('folder'))) {
echo " <input type=\"hidden\" name=\"folderid\" value=\"".$folder->getID()."\" />";
}
@ -957,7 +965,7 @@ function folderSelected<?php echo $formName ?>(id, name) {
<?php
} /* }}} */
function printFolderChooser($form, $accessMode, $exclude = -1, $default = false, $formname = '') { /* {{{ */
function printFolderChooserHtml($form, $accessMode, $exclude = -1, $default = false, $formname = '') { /* {{{ */
$formid = "targetid".$form;
if(!$formname)
$formname = "targetid";
@ -979,15 +987,28 @@ function folderSelected<?php echo $formName ?>(id, name) {
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true"><?php printMLText("close") ?></button>
</div>
</div>
<script language="JavaScript">
/* Set up a callback which is called when a folder in the tree is selected */
modalFolderChooser<?php echo $form ?> = $('#folderChooser<?php echo $form ?>');
function folderSelected<?php echo $form ?>(id, name) {
$('#<?php echo $formid ?>').val(id);
$('#choosefoldersearch<?php echo $form ?>').val(name);
modalFolderChooser<?php echo $form ?>.modal('hide');
<?php
} /* }}} */
function printFolderChooserJs($formName) { /* {{{ */
?>
modalFolderChooser<?php echo $formName ?> = $('#folderChooser<?php echo $formName ?>');
function folderSelected<?php echo $formName ?>(id, name) {
$('#targetid<?php echo $formName ?>').val(id);
$('#choosefoldersearch<?php echo $formName ?>').val(name);
modalFolderChooser<?php echo $formName ?>.modal('hide');
}
</script>
<?php
} /* }}} */
function printFolderChooser($formName, $accessMode, $exclude = -1, $default = false) { /* {{{ */
$this->printFolderChooserHtml($formName, $accessMode, $exclude, $default);
?>
<script language="JavaScript">
<?php
$this->printFolderChooserJs($formName);
?>
</script>
<?php
} /* }}} */

View File

@ -34,6 +34,8 @@ class SeedDMS_View_DocumentChooser extends SeedDMS_Bootstrap_Style {
function js() { /* {{{ */
$folder = $this->params['folder'];
$form = $this->params['form'];
header('Content-Type: application/json');
$this->printNewTreeNavigationJs($folder->getID(), M_READ, 1, $form);
} /* }}} */
@ -43,12 +45,13 @@ class SeedDMS_View_DocumentChooser extends SeedDMS_Bootstrap_Style {
$folder = $this->params['folder'];
$form = $this->params['form'];
$this->htmlStartPage(getMLText("choose_target_document"));
$this->contentContainerStart();
// $this->htmlStartPage(getMLText("choose_target_document"));
// $this->contentContainerStart();
// $this->printNewTreeNavigationHtml($folder->getID(), M_READ, 1, $form);
$this->printNewTreeNavigationHtml($folder->getID(), M_READ, 1, $form);
$this->contentContainerEnd();
$this->htmlEndPage(true);
// echo "</body>\n</html>\n";
echo '<script src="../out/out.DocumentChooser.php?action=js&'.$_SERVER['QUERY_STRING'].'"></script>'."\n";
// $this->contentContainerEnd();
// $this->htmlEndPage(true);
} /* }}} */
}
?>

View File

@ -31,6 +31,15 @@ require_once("class.Bootstrap.php");
*/
class SeedDMS_View_FolderChooser extends SeedDMS_Bootstrap_Style {
function js() { /* {{{ */
$rootfolderid = $this->params['rootfolderid'];
$form = $this->params['form'];
$mode = $this->params['mode'];
header('Content-Type: application/json');
$this->printNewTreeNavigationJs($rootfolderid, $mode, 0, $form);
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
@ -39,11 +48,16 @@ class SeedDMS_View_FolderChooser extends SeedDMS_Bootstrap_Style {
$form = $this->params['form'];
$rootfolderid = $this->params['rootfolderid'];
$this->htmlStartPage(getMLText("choose_target_folder"));
$this->contentContainerStart();
$this->printNewTreeNavigation($rootfolderid, $mode, 0, $form);
$this->contentContainerEnd();
echo "</body>\n</html>\n";
// $this->htmlStartPage(getMLText("choose_target_folder"));
// $this->contentContainerStart();
if(1) {
$this->printNewTreeNavigationHtml($rootfolderid, $mode, 0, $form);
echo '<script src="../out/out.FolderChooser.php?action=js&'.$_SERVER['QUERY_STRING'].'"></script>'."\n";
} else {
$this->printNewTreeNavigation($rootfolderid, $mode, 0, $form);
}
// $this->contentContainerEnd();
// $this->htmlEndPage(true);
} /* }}} */
}
?>

View File

@ -47,6 +47,16 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
return $str;
} /* }}} */
function js() { /* {{{ */
$user = $this->params['user'];
header('Content-Type: application/json');
$this->printFolderChooserJs("form1");
$this->printDeleteFolderButtonJs();
$this->printDeleteDocumentButtonJs();
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
@ -82,6 +92,8 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
$cachedir = $this->params['cachedir'];
$previewwidth = $this->params['previewWidthList'];
$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/bootbox/bootbox.min.js"></script>'."\n", 'js');
$this->htmlStartPage(getMLText("search_results"));
$this->globalNavigation();
$this->contentStart();
@ -103,7 +115,7 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
</ul>
<div class="tab-content">
<div class="tab-pane <?php echo ($fullsearch == false) ? 'active' : ''; ?>" id="database">
<form action="../op/op.Search.php" name="form1" onsubmit="return checkForm();">
<form action="../out/out.Search.php" name="form1">
<?php
// Database search Form {{{
$this->contentContainerStart();
@ -155,7 +167,7 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
</tr>
<tr>
<td><?php printMLText("under_folder")?>:</td>
<td><?php $this->printFolderChooser("form1", M_READ, -1, $startfolder);?></td>
<td><?php $this->printFolderChooserHtml("form1", M_READ, -1, $startfolder);?></td>
</tr>
<tr>
<td><?php printMLText("creation_date");?>:</td>
@ -356,7 +368,7 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
echo "<div class=\"tab-pane ".(($fullsearch == true) ? 'active' : '')."\" id=\"fulltext\">\n";
$this->contentContainerStart();
?>
<form action="../op/op.Search.php" name="form2" onsubmit="return checkForm();" style="min-height: 330px;">
<form action="../out/out.Search.php" name="form2" style="min-height: 330px;">
<input type="hidden" name="fullsearch" value="1" />
<table class="table-condensed">
<tr>
@ -432,7 +444,7 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
}
*/
print "<div class=\"alert\">".getMLText("search_report", array("doccount" => $totaldocs, "foldercount" => $totalfolders, 'searchtime'=>$searchTime))."</div>";
$this->pageList($pageNumber, $totalpages, "../op/op.Search.php", $urlparams);
$this->pageList($pageNumber, $totalpages, "../out/out.Search.php", $urlparams);
// $this->contentContainerStart();
print "<table class=\"table\">";
@ -607,7 +619,7 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
}
print "</tbody></table>\n";
// $this->contentContainerEnd();
$this->pageList($pageNumber, $totalpages, "../op/op.Search.php", $_GET);
$this->pageList($pageNumber, $totalpages, "../out/out.Search.php", $_GET);
} else {
$numResults = $totaldocs + $totalfolders;
if ($numResults == 0) {