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

This commit is contained in:
Uwe Steinmann 2021-11-08 14:36:39 +01:00
commit 31fda7e60e
6 changed files with 67 additions and 34 deletions

View File

@ -2215,10 +2215,17 @@ class SeedDMS_Core_DMS {
$searchQuery .= " ORDER BY `tblFolders`.`name` DESC";
break;
case 'na':
default:
$searchQuery .= " ORDER BY `tblFolders`.`name`";
break;
}
case 'id':
$searchQuery .= " ORDER BY `tblFolders`.`id` DESC";
break;
case 'ia':
$searchQuery .= " ORDER BY `tblFolders`.`id`";
break;
default:
break;
}
if($limit) {
$searchQuery .= " LIMIT ".$limit." OFFSET ".$offset;
@ -2562,9 +2569,17 @@ class SeedDMS_Core_DMS {
$orderbyQuery = " ORDER BY `tblDocuments`.`name` DESC";
break;
case 'na':
default:
$orderbyQuery = " ORDER BY `tblDocuments`.`name`";
break;
case 'id':
$orderbyQuery = " ORDER BY `tblDocuments`.`id` DESC";
break;
case 'ia':
$orderbyQuery = " ORDER BY `tblDocuments`.`id`";
break;
default:
$orderbyQuery = "";
break;
}
// calculate the remaining entrїes of the current page

View File

@ -492,7 +492,7 @@ class SeedDMS_Extension_Mgr {
*/
public function updateExtension($file) { /* {{{ */
/* unzip the extension in a temporary directory */
$newdir = $this->cachedir ."/ext.new";
$newdir = addDirSep($this->cachedir)."ext.new";
/* First remove a left over from a previous extension */
if(file_exists($newdir)) {
self::rrmdir($newdir);
@ -533,7 +533,21 @@ class SeedDMS_Extension_Mgr {
$this->rrmdir($this->extdir ."/". $extname);
}
/* Move the temp. created ext directory to the final location */
if(!rename($newdir, $this->extdir ."/". $extname)) {
/* rename() may fail if dirs are moved from one device to another.
* See https://bugs.php.net/bug.php?id=54097
*
* exec("mv ".escapeshellarg($newdir)." ".escapeshellarg($this->extdir ."/". $extname));
*
* It's also sufficient to just copy the extracted archive to the final
* location and leave the extracted archive in place. The next time an
* extension is imported the last extracted archive will be removed.
*/
// if(!rename($newdir, $this->extdir ."/". $extname)) {
if(false === exec('mv '.escapeshellarg($newdir).' '.escapeshellarg($this->extdir."/".$extname))) {
/* If copy didn't succeed, then there is probably nothing to delete,
* but do it anyway, just to be sure not just parts of the extension
* has been copied.
*/
$this->rrmdir($this->extdir ."/". $extname);
return false;
}

View File

@ -68,7 +68,7 @@ elseif ($action == "refresh") { /* {{{ */
$extMgr->createExtensionConf();
$controller->setParam('extmgr', $extMgr);
if (!$controller($_POST)) {
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
UI::exitError(getMLText("admin_tools"),$extMgr->getErrorMsg());
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_extension_refresh')));
add_log_line();

View File

@ -304,6 +304,24 @@ function typeahead() { /* {{{ */
)
);
$options = array();
$options[] = array('', getMLText('orderby_unsorted'));
$options[] = array('dd', getMLText('orderby_date_desc'), 'dd'==$orderby);
$options[] = array('d', getMLText('orderby_date_asc'), 'd'==$orderby);
$options[] = array('nd', getMLText('orderby_name_desc'), 'nd'==$orderby);
$options[] = array('n', getMLText('orderby_name_asc'), 'n'==$orderby);
$options[] = array('id', getMLText('orderby_id_desc'), 'id'==$orderby);
$options[] = array('i', getMLText('orderby_id_asc'), 'i'==$orderby);
$this->formField(
getMLText("orderby"),
array(
'element'=>'select',
'name'=>'orderby',
'class'=>'chzn-select',
'multiple'=>false,
'options'=>$options
)
);
$options = array();
foreach ($allUsers as $currUser) {
if($user->isAdmin() || (!$currUser->isGuest() && (!$currUser->isHidden() || $currUser->getID() == $user->getID())))
$options[] = array($currUser->getID(), htmlspecialchars($currUser->getLogin()), in_array($currUser->getID(), $owner), array(array('data-subtitle', htmlspecialchars($currUser->getFullName()))));
@ -662,14 +680,14 @@ foreach($facets as $facetname=>$values) {
echo $txt;
else {
parse_str($_SERVER['QUERY_STRING'], $tmp);
$tmp['orderby'] = $orderby=="n"||$orderby=="na)"?"nd":"n";
$tmp['orderby'] = ($orderby=="n"||$orderby=="na") ? "nd" : "n";
print "<table class=\"table table-condensed table-sm table-hover\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name");
if(!$fullsearch) {
print " <a href=\"../out/out.Search.php?".http_build_query($tmp)."\" title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' <i class="fa fa-sort-alpha-asc selected"></i>':($orderby=="nd"?' <i class="fa fa-sort-alpha-desc selected"></i>':' <i class="fa fa-sort-alpha-asc"></i>'))."</a>";
$tmp['orderby'] = $orderby=="d"||$orderby=="da)"?"dd":"d";
print $orderby." <a href=\"../out/out.Search.php?".http_build_query($tmp)."\" title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' <i class="fa fa-sort-alpha-asc selected"></i>':($orderby=="nd"?' <i class="fa fa-sort-alpha-desc selected"></i>':' <i class="fa fa-sort-alpha-asc"></i>'))."</a>";
$tmp['orderby'] = ($orderby=="d"||$orderby=="da") ? "dd" : "d";
print " <a href=\"../out/out.Search.php?".http_build_query($tmp)."\" title=\"".getMLText("sort_by_date")."\">".($orderby=="d"||$orderby=="da"?' <i class="fa fa-sort-amount-asc selected"></i>':($orderby=="dd"?' <i class="fa fa-sort-amount-desc selected"></i>':' <i class="fa fa-sort-amount-asc"></i>'))."</a>";
}
print "</th>\n";

View File

@ -33,30 +33,13 @@ class SeedDMS_View_TriggerWorkflow extends SeedDMS_Theme_Style {
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
parent::jsTranslations(array('js_form_error', 'js_form_errors'));
?>
function checkForm()
{
msg = new Array();
if (document.form1.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
if (msg != "") {
noty({
text: msg.join('<br />'),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
_timeout: 1500,
});
return false;
}
else
return true;
}
$(document).ready(function() {
$('body').on('submit', '#form1', function(ev){
if(checkForm()) return;
ev.preventDefault();
$("#form1").validate({
messages: {
comment: "<?php printMLText("js_no_comment");?>"
},
});
});
<?php
@ -69,9 +52,11 @@ $(document).ready(function() {
$accessobject = $this->params['accessobject'];
$document = $this->params['document'];
$transition = $this->params['transition'];
$latestContent = $document->getLatestContent();
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/jquery.validate.js"></script>'."\n", 'js');
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/styles/validation-default.js"></script>'."\n", 'js');
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
@ -116,7 +101,8 @@ $(document).ready(function() {
array(
'element'=>'textarea',
'name'=>'comment',
'rows'=>4
'rows'=>4,
'required'=>false
)
);
$this->formSubmit(getMLText("action_".strtolower($action->getName()), array(), $action->getName()));

View File

@ -126,7 +126,7 @@ class SeedDMS_View_WorkflowSummary extends SeedDMS_Theme_Style {
echo $this->documentListRowStart($document, $class);
echo $this->documentListRow($document, $previewer, true, $st['version']);
print "<td><small>".getLongReadableDate($st["date"])."<br />". htmlspecialchars($moduser->getFullName()) ."</small></td>";
print "<td><small>".getLongReadableDate($st["date"])."<br />". htmlspecialchars($modgroup->getName()) ."</small></td>";
echo $this->documentListRowEnd($document);
$iRev[] = $document->getId();
}