From 180b9a4b7e97d2bd043d6ec66164d402e668bcf3 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 13 Jul 2021 11:48:54 +0200 Subject: [PATCH 01/10] remove some spaces --- views/bootstrap/class.Bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index a79d146ce..6cbf80a1c 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -531,7 +531,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);; return; } /* }}} */ - protected function showNavigationBar($menuitems, $options = array()) { /* {{{ */ + protected function showNavigationBar($menuitems, $options=array()) { /* {{{ */ $content = ''; $content .= "\n"; foreach($menuitems as $menuitem) { From fcff7b2a1df87443420de65d51641e7317417eda Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 13 Jul 2021 12:05:01 +0200 Subject: [PATCH 02/10] add missing access checks, remove old code --- views/bootstrap4/class.Bootstrap4.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index 66f87f76f..512cd011d 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -327,12 +327,15 @@ background-image: linear-gradient(to bottom, #882222, #111111);; echo "
\n"; echo "
    \n"; $menuitems = array(); + /* calendar {{{ */ if ($this->params['enablecalendar'] && $accessobject->check_view_access('Calendar')) $menuitems['calendar'] = array('link'=>$this->params['settings']->_httpRoot.'out/out.Calendar.php?mode='.$this->params['calendardefaultview'], 'label'=>"calendar"); if ($this->params['user']->isAdmin()) $menuitems['admintools'] = array('link'=>$this->params['settings']->_httpRoot.'out/out.AdminTools.php', 'label'=>"admin_tools"); if($this->params['enablehelp']) { $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $menuitems['help'] = array('link'=>$this->params['settings']->_httpRoot.'out/out.Help.php?context='.$tmp[1], 'label'=>"help"); } + /* }}} End of calendar */ + /* Check if hook exists because otherwise callHook() will override $menuitems */ if($this->hasHook('globalNavigationBar')) $menuitems = $this->callHook('globalNavigationBar', $menuitems); @@ -356,13 +359,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);; if($accessobject->check_view_access('Tasks', array('action'=>'menuTasks'))) { echo "
    "; echo "
    "; - // echo "
      \n"; - // echo "
    • \n"; - // echo $this->menuTasks(array('review'=>array(), 'approval'=>array(), 'receipt'=>array(), 'revision'=>array())); - // echo "
    • \n"; - // echo "
    \n"; echo "
    "; - //$this->addFooterJS('checkTasks();'); } } /* }}} End of menu tasks */ @@ -401,8 +398,10 @@ background-image: linear-gradient(to bottom, #882222, #111111);; echo "
    \n"; if (!$this->params['user']->isGuest()) { $menuitems = array(); - $menuitems['my_documents'] = array('link'=>$this->params['settings']->_httpRoot."out/out.MyDocuments.php?inProcess=1", 'label'=>'my_documents'); - $menuitems['my_account'] = array('link'=>$this->params['settings']->_httpRoot."out/out.MyAccount.php", 'label'=>'my_account'); + if ($accessobject->check_view_access('MyDocuments')) + $menuitems['my_documents'] = array('link'=>$this->params['settings']->_httpRoot."out/out.MyDocuments.php?inProcess=1", 'label'=>'my_documents'); + if ($accessobject->check_view_access('MyAccount')) + $menuitems['my_account'] = array('link'=>$this->params['settings']->_httpRoot."out/out.MyAccount.php", 'label'=>'my_account'); if($this->hasHook('userMenuItems')) $menuitems = $this->callHook('userMenuItems', $menuitems); if($menuitems) { From d4b05b61f2e90a31f794128614ca7253f34bbcba Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 13 Jul 2021 12:05:18 +0200 Subject: [PATCH 03/10] remove old code --- views/bootstrap/class.Bootstrap.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 6cbf80a1c..37ee0fe2d 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -386,13 +386,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);; if($accessobject->check_view_access('Tasks', array('action'=>'menuTasks'))) { echo "
    "; echo "
    "; - // echo "
      \n"; - // echo "
    • \n"; - // echo $this->menuTasks(array('review'=>array(), 'approval'=>array(), 'receipt'=>array(), 'revision'=>array())); - // echo "
    • \n"; - // echo "
    \n"; echo "
    "; - //$this->addFooterJS('checkTasks();'); } } /* }}} End of menu tasks */ From ca9e1c8860513b3b19096d48af832b1aea2763d9 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 14 Jul 2021 12:00:47 +0200 Subject: [PATCH 04/10] check for null passed as folder to getFolderList() --- views/bootstrap/class.Bootstrap.php | 5 +++++ views/bootstrap4/class.Bootstrap4.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 3c6fc7978..715a9945d 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -2925,6 +2925,8 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) * @return string */ function getListRowPath($object) { /* {{{ */ + if(!$object) + return ''; $belowtitle = ''; $folder = $object->getParent(); if($folder) { @@ -3187,6 +3189,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $accessop = $this->params['accessobject']; $onepage = $this->params['onepage']; + if(!$subFolder) + return ''; + $owner = $subFolder->getOwner(); $comment = $subFolder->getComment(); if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index 28ad6aee4..a5d3ae9b7 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -2908,6 +2908,8 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) * @return string */ function getListRowPath($object) { /* {{{ */ + if(!$object) + return ''; $belowtitle = ''; $folder = $object->getParent(); if($folder) { @@ -3176,6 +3178,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $accessop = $this->params['accessobject']; $onepage = $this->params['onepage']; + if(!$subFolder) + return ''; + $owner = $subFolder->getOwner(); $comment = $subFolder->getComment(); if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; From 55a7667c1e08054223ccd57542fd375319098350 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 14 Jul 2021 12:00:47 +0200 Subject: [PATCH 05/10] check for null passed as folder to getFolderList() --- views/bootstrap/class.Bootstrap.php | 5 +++++ views/bootstrap4/class.Bootstrap4.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 37ee0fe2d..0785faf8e 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -2803,6 +2803,8 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) * @return string */ function getListRowPath($object) { /* {{{ */ + if(!$object) + return ''; $belowtitle = ''; $folder = $object->getParent(); if($folder) { @@ -3042,6 +3044,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $accessop = $this->params['accessobject']; $onepage = $this->params['onepage']; + if(!$subFolder) + return ''; + $owner = $subFolder->getOwner(); $comment = $subFolder->getComment(); if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index 512cd011d..8fe563fcf 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -2868,6 +2868,8 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) * @return string */ function getListRowPath($object) { /* {{{ */ + if(!$object) + return ''; $belowtitle = ''; $folder = $object->getParent(); if($folder) { @@ -3113,6 +3115,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $accessop = $this->params['accessobject']; $onepage = $this->params['onepage']; + if(!$subFolder) + return ''; + $owner = $subFolder->getOwner(); $comment = $subFolder->getComment(); if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; From 64a5ea3d904bf85881d4994f14c48fd4318241c1 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 14 Jul 2021 13:28:26 +0200 Subject: [PATCH 06/10] allow to cancel checkout if document was not modified --- op/op.CancelCheckOut.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/op/op.CancelCheckOut.php b/op/op.CancelCheckOut.php index bed1b5013..787a9ea84 100644 --- a/op/op.CancelCheckOut.php +++ b/op/op.CancelCheckOut.php @@ -37,7 +37,8 @@ if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval( $documentid = $_POST["documentid"]; $document = $dms->getDocument($documentid); -if(empty($settings->_enableCancelCheckout)) { +$checkoutstatus = $document->checkOutStatus(); +if($checkoutstatus != 3 && empty($settings->_enableCancelCheckout)) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("operation_disallowed")); } From f2b0375df6023dbfca93302e1109f65342a74056 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 14 Jul 2021 13:45:55 +0200 Subject: [PATCH 07/10] user warningMsg() instead of plain html code --- views/bootstrap/class.CheckInDocument.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/views/bootstrap/class.CheckInDocument.php b/views/bootstrap/class.CheckInDocument.php index 904596c8b..8fe539ab5 100644 --- a/views/bootstrap/class.CheckInDocument.php +++ b/views/bootstrap/class.CheckInDocument.php @@ -124,19 +124,13 @@ $(document).ready(function() { if ($checkoutstatus = $document->checkOutStatus()) { switch($checkoutstatus) { case 1: - print "
    "; - printMLText("checkedout_file_has_disappeared"); - print "
    "; + $this->warningMsg(getMLText("checkedout_file_has_disappeared")); break; case 2: - print "
    "; - printMLText("checkedout_file_has_different_version"); - print "
    "; + $this->warningMsg(getMLText("checkedout_file_has_different_version")); break; case 3: - print "
    "; - printMLText("checkedout_file_is_unchanged"); - print "
    "; + $this->warningMsg(getMLText("checkedout_file_is_unchanged")); break; } } From b369ab3d318c2063ed26c6e8fa4f99cebce3dfd2 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 14 Jul 2021 14:52:28 +0200 Subject: [PATCH 08/10] add class fileupload-group to input field of document chooser --- views/bootstrap/class.Bootstrap.php | 2 +- views/bootstrap4/class.Bootstrap4.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 0785faf8e..3c7cd6a78 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1487,7 +1487,7 @@ $(document).ready(function() { $formid = md5($formname.$form); $content = ''; - $content .= "getID() : "") ."\">"; + $content .= "getID() : "") ."\">"; $content .= "
    \n"; $content .= "getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\"".($default ? ' title="'.htmlspecialchars($default->getFolder()->getFolderPathPlain().' / '.$default->getName()).'"' : '')." />"; $content .= ""; diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index 8fe563fcf..4cb3ff9da 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -1512,7 +1512,7 @@ $(document).ready(function() { $formid = md5($formname.$form); $content = ''; - $content .= "getID() : "") ."\">"; + $content .= "getID() : "") ."\">"; $content .= "
    \n"; $content .= "getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" />"; $content .= '
    '; From 34ebc280e8007728abd0c845d5c82f0d042de06c Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 14 Jul 2021 15:45:06 +0200 Subject: [PATCH 09/10] remove extra '/' in path --- views/bootstrap/class.Bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 3c7cd6a78..d6c611ede 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -286,7 +286,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);; echo " \n"; echo "
    \n"; From 7d16ed616867349d98883697b37ee46046d18f72 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 14 Jul 2021 16:31:32 +0200 Subject: [PATCH 10/10] take given name of document if set --- op/op.AddDocument.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/op/op.AddDocument.php b/op/op.AddDocument.php index 5d3a25841..ff6e6f6ca 100644 --- a/op/op.AddDocument.php +++ b/op/op.AddDocument.php @@ -355,7 +355,7 @@ foreach($file_ary as $file) { $userfiletype = $tmpfiletype; } - if (!$file["tmp_name"] && ($_POST["name"]!="")) + if ($_POST["name"]!="") $name = trim($_POST["name"]); else $name = utf8_basename($userfilename);