From fe4e0c644c61d781fb1ee8a071915bef6ccbb2ca Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 23 Sep 2020 07:27:12 +0200 Subject: [PATCH 1/2] do not redirect ajax calls --- index.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.php b/index.php index 7123a957b..98b5511f3 100644 --- a/index.php +++ b/index.php @@ -42,6 +42,9 @@ if(true) { include($file); exit; } + if($request->isXhr()) { + exit; + } // print_r($request->getUri()); // exit; return $c['response'] From ca1dce466d76d62bca968ef25b1865054a7e0ae0 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 23 Sep 2020 08:37:51 +0200 Subject: [PATCH 2/2] backport printVersionAttributes(), nicer output of reviewers and approvers --- views/bootstrap/class.ViewDocument.php | 84 ++++++++++++++++---------- 1 file changed, 52 insertions(+), 32 deletions(-) diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index 516501d67..d785f73cf 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -98,6 +98,23 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { getAttributes(); + if($attributes) { + foreach($attributes as $attribute) { + $arr = $this->callHook('showDocumentContentAttribute', $version, $attribute); + if(is_array($arr)) { + print "
  • ".$arr[0].": ".$arr[1]."
  • \n"; + } else { + $attrdef = $attribute->getAttributeDefinition(); + print "
  • ".htmlspecialchars($attrdef->getName()).": "; + $this->printAttributeValue($attribute); + echo "
  • \n"; + } + } + } + } /* }}} */ + function documentListItem() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; @@ -623,18 +640,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { print "

    ".htmlspecialchars($latestContent->getComment())."

    "; } print "\n"; print ""; @@ -784,6 +790,15 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { print "\n"; foreach ($reviewStatus as $r) { + $class = ''; + switch($r['status']) { + case '-1': + $class = 'error'; + break; + case '1': + $class = 'success'; + break; + } $required = null; $is_reviewer = false; $accesserr = ''; @@ -822,7 +837,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { } break; } - print "\n"; + print "\n"; print "".$reqName."\n"; print "".$r["date"]." - "; /* $updateUser is the user who has done the review */ @@ -834,10 +849,13 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { echo " ".getMLText('download').""; } print "\n"; - print "".getReviewStatusText($r["status"])."\n"; + print ""; + if($class) + echo " "; + print getReviewStatusText($r["status"])."\n"; print "
      "; if($accesserr) - echo "
    • ".$accesserr."
    • "; + echo "
    • ".$accesserr."
    • "; if($accessop->mayReview()) { if ($is_reviewer) { @@ -872,6 +890,15 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { print "\n"; foreach ($approvalStatus as $a) { + $class = ''; + switch($a['status']) { + case '-1': + $class = 'error'; + break; + case '1': + $class = 'success'; + break; + } $required = null; $is_approver = false; $accesserr = ''; @@ -910,7 +937,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { } break; } - print "\n"; + print "\n"; print "".$reqName."\n"; print "".$a["date"]." - "; /* $updateUser is the user who has done the approval */ @@ -922,10 +949,13 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { echo " ".getMLText('download').""; } echo "\n"; - print "".getApprovalStatusText($a["status"])."\n"; + print ""; + if($class) + echo " "; + print getApprovalStatusText($a["status"])."\n"; print "
        "; if($accesserr) - echo "
      • ".$accesserr."
      • "; + echo "
      • ".$accesserr."
      • "; if($accessop->mayApprove()) { if ($is_approver) { @@ -938,7 +968,8 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { } print "
      "; - print "\n\n"; + print "\n"; + print "\n"; } } @@ -947,7 +978,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { print ""; print ""; - if($user->isAdmin()) { + if($user->isAdmin() || $user->getId() == $document->getOwner()->getId()) { ?>
      ".htmlspecialchars($version->getComment())."

      "; } print "
        \n"; - $attributes = $version->getAttributes(); - if($attributes) { - foreach($attributes as $attribute) { - $arr = $this->callHook('showDocumentContentAttribute', $version, $attribute); - if(is_array($arr)) { - print "
      • ".$arr[0].": ".$arr[1]."
      • \n"; - } else { - $attrdef = $attribute->getAttributeDefinition(); - print "
      • ".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $attribute->getValueAsArray()))."
      • \n"; - } - } - } + $this->printVersionAttributes($folder, $version); print "
      \n"; // print "".htmlspecialchars($version->getComment()).""; print "".getOverallStatusText($vstat["status"])."";