diff --git a/views/bootstrap/class.ViewFolder.php b/views/bootstrap/class.ViewFolder.php index 1cf2fd8fc..813e03499 100644 --- a/views/bootstrap/class.ViewFolder.php +++ b/views/bootstrap/class.ViewFolder.php @@ -31,6 +31,46 @@ require_once("class.Bootstrap.php"); */ class LetoDMS_View_ViewFolder extends LetoDMS_Bootstrap_Style { + function getAccessModeText($defMode) { /* {{{ */ + switch($defMode) { + case M_NONE: + return getMLText("access_mode_none"); + break; + case M_READ: + return getMLText("access_mode_read"); + break; + case M_READWRITE: + return getMLText("access_mode_readwrite"); + break; + case M_ALL: + return getMLText("access_mode_all"); + break; + } + } /* }}} */ + + function printAccessList($obj) { /* {{{ */ + $accessList = $obj->getAccessList(); + if (count($accessList["users"]) == 0 && count($accessList["groups"]) == 0) + return; + + for ($i = 0; $i < count($accessList["groups"]); $i++) + { + $group = $accessList["groups"][$i]->getGroup(); + $accesstext = $this->getAccessModeText($accessList["groups"][$i]->getMode()); + print $accesstext.": ".htmlspecialchars($group->getName()); + if ($i+1 < count($accessList["groups"]) || count($accessList["users"]) > 0) + print "
"; + } + for ($i = 0; $i < count($accessList["users"]); $i++) + { + $user = $accessList["users"][$i]->getUser(); + $accesstext = $this->getAccessModeText($accessList["users"][$i]->getMode()); + print $accesstext.": ".htmlspecialchars($user->getFullName()); + if ($i+1 < count($accessList["users"])) + print "
"; + } + } /* }}} */ + function show() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; @@ -65,10 +105,33 @@ class LetoDMS_View_ViewFolder extends LetoDMS_Bootstrap_Style { echo "".getMLText("owner").":\n"; echo "getEmail())."\">".htmlspecialchars($owner->getFullName())."\n"; echo ""; - echo ""; - echo "".getMLText("comment").":\n"; - echo "".htmlspecialchars($folder->getComment()).""; + if($folder->getComment()) { + echo ""; + echo "".getMLText("comment").":\n"; + echo "".htmlspecialchars($folder->getComment())."\n"; + echo ""; + } + + if($user->isAdmin()) { + if($folder->inheritsAccess()) { + echo ""; + echo "".getMLText("access_mode").":\n"; + echo ""; + echo getMLText("inherited"); + echo ""; + } else { + echo ""; + echo "".getMLText('default_access').""; + echo "".$this->getAccessModeText($folder->getDefaultAccess()).""; + echo ""; + echo ""; + echo "".getMLText('access_mode').""; + echo ""; + $this->printAccessList($folder); + echo ""; + echo ""; + } + } $attributes = $folder->getAttributes(); if($attributes) { foreach($attributes as $attribute) {