* @copyright Copyright (C) 2002-2005 Markus Westphal, * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, * 2010-2012 Uwe Steinmann * @version Release: @package_version@ */ /** * Include parent class */ //require_once("class.Bootstrap.php"); /** * Class which outputs the html page for DocumentAccess view * * @category DMS * @package SeedDMS * @author Markus Westphal, Malcolm Cowe, Uwe Steinmann * @copyright Copyright (C) 2002-2005 Markus Westphal, * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, * 2010-2012 Uwe Steinmann * @version Release: @package_version@ */ class SeedDMS_View_DocumentAccess extends SeedDMS_Theme_Style { function printAccessModeSelection($defMode) { /* {{{ */ echo self::getAccessModeSelection($defMode); } /* }}} */ function getAccessModeSelection($defMode) { /* {{{ */ $content = "\n"; return $content; } /* }}} */ function js() { /* {{{ */ header('Content-Type: application/javascript; charset=UTF-8'); ?> function checkForm() { msg = new Array(); if ((document.form1.userid.options[document.form1.userid.selectedIndex].value == -1) && (document.form1.groupid.options[document.form1.groupid.selectedIndex].value == -1)) msg.push(""); if (msg != "") { noty({ text: msg.join('
'), 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(); }); }); params['dms']; $user = $this->params['user']; $document = $this->params['document']; $folder = $this->params['folder']; $allUsers = $this->params['allusers']; $allGroups = $this->params['allgroups']; $this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName())))); $this->globalNavigation($folder); $this->contentStart(); $this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document); $this->contentHeading(getMLText("edit_document_access")); $this->rowStart(); $this->columnStart(4); if ($user->isAdmin()) { ?>
contentContainerStart(); $owner = $document->getOwner(); $options = array(); foreach ($allUsers as $currUser) { if (!$currUser->isGuest()) $options[] = array($currUser->getID(), htmlspecialchars($currUser->getLogin()), ($currUser->getID()==$owner->getID()), array(array('data-subtitle', htmlspecialchars($currUser->getFullName())))); } $this->formField( getMLText("set_owner"), array( 'element'=>'select', 'name'=>'ownerid', 'class'=>'chzn-select', 'options'=>$options ) ); $this->contentContainerEnd(); $this->formSubmit(" ".getMLText('save')); ?>
contentHeading(getMLText("access_inheritance")); if ($document->inheritsAccess()) { $this->infoMsg(getMLText("inherits_access_msg")); ?>

">
">

columnEnd(); $this->rowEnd(); $this->contentEnd(); $this->htmlEndPage(); return; } ?>
">
columnEnd(); $this->columnStart(4); $accessList = $document->getAccessList(); ?>
contentContainerStart(); $this->formField( getMLText("default_access"), $this->getAccessModeSelection($document->getDefaultAccess()) ); $this->contentContainerEnd(); $this->formSubmit(" ".getMLText('save')); ?>
contentContainerStart(); $memusers = array(); foreach ($accessList["users"] as $userAccess) { $userObj = $userAccess->getUser(); $memusers[] = $userObj->getID(); } $options = array(); $options[] = array(-1, getMLText('select_one')); foreach ($allUsers as $currUser) { if (!$currUser->isGuest() && !in_array($currUser->getID(), $memusers)) $options[] = array($currUser->getID(), htmlspecialchars($currUser->getLogin()), false, array(array('data-subtitle', htmlspecialchars($currUser->getFullName())))); } $this->formField( getMLText("user"), array( 'element'=>'select', 'name'=>'userid', 'class'=>'chzn-select', 'options'=>$options ) ); $memgroups = array(); foreach ($accessList["groups"] as $groupAccess) { $groupObj = $groupAccess->getGroup(); $memgroups[] = $groupObj->getID(); } $options = array(); $options[] = array(-1, getMLText('select_one')); foreach ($allGroups as $groupObj) { if(!in_array($groupObj->getID(), $memgroups)) $options[] = array($groupObj->getID(), htmlspecialchars($groupObj->getName())); } $this->formField( getMLText("group"), array( 'element'=>'select', 'name'=>'groupid', 'class'=>'chzn-select', 'attributes'=>array(array('data-placeholder', getMLText('select_group'))), 'options'=>$options ) ); $this->formField( getMLText("access_mode"), $this->getAccessModeSelection(M_READ) ); $this->contentContainerEnd(); $this->formSubmit(" ".getMLText('add')); ?>
columnEnd(); $this->columnStart(4); /* memorize users with access rights */ $memusers = array(); /* memorize groups with access rights */ $memgroups = array(); if (count($accessList["users"]) != 0 || count($accessList["groups"]) != 0) { print ""; foreach ($accessList["users"] as $userAccess) { $userObj = $userAccess->getUser(); $memusers[] = $userObj->getID(); print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } foreach ($accessList["groups"] as $groupAccess) { $groupObj = $groupAccess->getGroup(); $memgroups[] = $groupObj->getID(); $mode = $groupAccess->getMode(); print ""; print ""; print ""; print ""; print "\n"; print "\n"; print ""; print "\n"; print "\n"; print "\n"; } print "
". htmlspecialchars($userObj->getFullName()) . "
\n"; $this->printAccessModeSelection($userAccess->getMode()); print "\n"; echo createHiddenFieldWithKey('documentaccess')."\n"; print "getId()."\">\n"; print "\n"; print "getID()."\">\n"; print ""; print "
\n"; echo createHiddenFieldWithKey('documentaccess')."\n"; print "getId()."\">\n"; print "\n"; print "getID()."\">\n"; print ""; print "
". htmlspecialchars($groupObj->getName()) . "
"; $this->printAccessModeSelection($groupAccess->getMode()); print "\n"; echo createHiddenFieldWithKey('documentaccess')."\n"; print "getId()."\">"; print ""; print "getID()."\">"; print ""; print "
\n"; echo createHiddenFieldWithKey('documentaccess')."\n"; print "getId()."\">\n"; print "\n"; print "getID()."\">\n"; print ""; print ""; print "

"; } $this->columnEnd(); $this->rowEnd(); $this->contentEnd(); $this->htmlEndPage(); } /* }}} */ } ?>