From 96040765552d7e06a86b8df8de6d2e758954a139 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 14 Jul 2015 21:27:41 +0200 Subject: [PATCH] printAttributeEditField() can be passed a default value document menu can be extended by a hook --- views/bootstrap/class.Bootstrap.php | 54 +++++++++++++++++------------ 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index be80f32ac..fca389356 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -532,47 +532,56 @@ $(document).ready(function () { echo "".getMLText("document")."\n"; echo "
\n"; echo "
    \n"; + $menuitems = array(); if ($accessMode >= M_READWRITE) { if (!$document->isLocked()) { - echo "
  • ".getMLText("update_document")."
  • "; - echo "
  • ".getMLText("lock_document")."
  • "; + $menuitems['update_document'] = array('link'=>"../out/out.UpdateDocument".$docid, 'label'=>'update_document'); + $menuitems['lock_document'] = array('link'=>"../op/op.LockDocument".$docid, 'label'=>'lock_document'); if($document->isCheckedOut()) - echo "
  • ".getMLText("checkin_document")."
  • "; + $menuitems['checkin_document'] = array('link'=>"../out/out.CheckInDocument".$docid, 'label'=>'checkin_document'); else { if($this->params['checkoutdir']) { - echo "
  • ".getMLText("checkout_document")."
  • "; + $menuitems['checkout_document'] = array('link'=>"../op/op.CheckOutDocument".$docid, 'label'=>'checkout_document'); } } - echo "
  • ".getMLText("edit_document_props")."
  • "; - echo "
  • ".getMLText("move_document")."
  • "; + $menuitems['edit_document_props'] = array('link'=>"../out/out.EditDocument".$docid , 'label'=>'edit_document_props'); + $menuitems['move_document'] = array('link'=>"../out/out.MoveDocument".$docid, 'label'=>'move_document'); } else { $lockingUser = $document->getLockingUser(); if (($lockingUser->getID() == $this->params['user']->getID()) || ($document->getAccessMode($this->params['user']) == M_ALL)) { - echo "
  • ".getMLText("update_document")."
  • "; - echo "
  • ".getMLText("unlock_document")."
  • "; - if($document->isCheckedOut()) - echo "
  • ".getMLText("checkin_document")."
  • "; - else { + $menuitems['update_document'] = array('link'=>"../out/out.UpdateDocument".$docid, 'label'=>'update_document'); + $menuitems['unlock_document'] = array('link'=>"../op/op.UnlockDocument".$docid, 'label'=>'unlock_document'); + if($document->isCheckedOut()) { + $menuitems['checkin_document'] = array('link'=>"../out/out.CheckInDocument".$docid, 'label'=>'checkin_document'); + } else { if($this->params['checkoutdir']) { - echo "
  • ".getMLText("checkout_document")."
  • "; + $menuitems['checkout_document'] = array('link'=>"../op/op.CheckOutDocument".$docid, 'label'=>'checkout_document'); } } - echo "
  • ".getMLText("edit_document_props")."
  • "; - echo "
  • ".getMLText("move_document")."
  • "; + $menuitems['edit_document_props'] = array('link'=>"../out/out.EditDocument".$docid, 'label'=>'edit_document_props'); + $menuitems['move_document'] = array('link'=>"../out/out.MoveDocument".$docid, 'label'=>'move_document'); } } if($this->params['accessobject']->maySetExpires()) { - echo "
  • ".getMLText("expires")."
  • "; + $menuitems['expires'] = array('link'=>"../out/out.SetExpires".$docid, 'label'=>'expires'); + // $menuitems[''] = array('link'=>"", 'label'=>''); } } if ($accessMode == M_ALL) { - echo "
  • ".getMLText("rm_document")."
  • "; - echo "
  • ".getMLText("edit_document_access")."
  • "; + $menuitems['rm_document'] = array('link'=>"../out/out.RemoveDocument".$docid, 'label'=>'rm_document'); + $menuitems['edit_document_access'] = array('link'=>"../out/out.DocumentAccess". $docid, 'label'=>'edit_document_access'); } if ($accessMode >= M_READ && !$this->params['user']->isGuest()) { - echo "
  • ".getMLText("edit_existing_notify")."
  • "; + $menuitems['edit_existing_notify'] = array('link'=>"../out/out.DocumentNotify". $docid, 'label'=>'edit_existing_notify'); + } + + $this->hasHook('documentNavigationBar'); + $this->callHook('documentNavigationBar', $document, $menuitems); + + foreach($menuitems as $menuitem) { + echo "
  • ".getMLText($menuitem['label'])."
  • "; } echo "
\n"; echo "
\n"; @@ -1140,7 +1149,7 @@ function folderSelected(id, name) { if(!$attrdef->getMultipleValues()) { echo ""; } - $objvalue = $attribute ? $attribute->getValueAsArray() : array(); + $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : $attribute) : array(); foreach($valueset as $value) { if($value) { echo "