* @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 FolderAccess 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_FolderAccess 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']; $folder = $this->params['folder']; $allUsers = $this->params['allusers']; $allGroups = $this->params['allgroups']; $rootfolderid = $this->params['rootfolderid']; $this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName())))); $this->globalNavigation($folder); $this->contentStart(); $this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder); $this->contentHeading(getMLText("edit_folder_access")); $this->rowStart(); $this->columnStart(4); if ($user->isAdmin()) { ?>
contentContainerStart(); $owner = $folder->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')); ?>
getID() != $rootfolderid && $folder->getParent()){ $this->contentHeading(getMLText("access_inheritance")); if ($folder->inheritsAccess()) { $this->infoMsg(getMLText("inherits_access_msg")); ?>

">
">

columnEnd(); $this->rowEnd(); $this->contentEnd(); $this->htmlEndPage(); return; } ?>
">
columnEnd(); $this->columnStart(4); $accessList = $folder->getAccessList(); ?>
contentContainerStart(); $this->formField( getMLText("default_access"), $this->getAccessModeSelection($folder->getDefaultAccess()) ); $this->contentContainerEnd(); $this->formSubmit(" ".getMLText('save')); ?>
contentContainerStart(); $options = array(); $options[] = array(-1, getMLText('select_one')); foreach ($allUsers as $currUser) { if (!$currUser->isGuest()) $options[] = array($currUser->getID(), htmlspecialchars($currUser->getLogin()), false, array(array('data-subtitle', htmlspecialchars($currUser->getFullName())))); } $this->formField( getMLText("user"), array( 'element'=>'select', 'name'=>'userid', 'id'=>'userid', 'class'=>'chzn-select', 'attributes'=>array(array('data-allow-clear', 'true'), array('data-placeholder',getMLText('select_user'))), 'options'=>$options ) ); $options = array(); $options[] = array(-1, getMLText('select_one')); foreach ($allGroups as $groupObj) { $options[] = array($groupObj->getID(), htmlspecialchars($groupObj->getName())); } $this->formField( getMLText("group"), array( 'element'=>'select', 'name'=>'groupid', 'class'=>'chzn-select', 'attributes'=>array(array('data-allow-clear', 'true'), 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); if ((count($accessList["users"]) != 0) || (count($accessList["groups"]) != 0)) { print ""; foreach ($accessList["users"] as $userAccess) { $userObj = $userAccess->getUser(); print "\n"; print "\n"; print "\n"; print "\n"; echo createHiddenFieldWithKey('folderaccess')."\n"; print "getID()."\">\n"; print "\n"; print "getID()."\">\n"; print "\n"; print "\n"; print "\n"; print "\n"; echo createHiddenFieldWithKey('folderaccess')."\n"; print "getID()."\">\n"; print "\n"; print "getID()."\">\n"; print "\n"; print "\n"; print "\n"; } foreach ($accessList["groups"] as $groupAccess) { $groupObj = $groupAccess->getGroup(); $mode = $groupAccess->getMode(); print ""; print ""; print ""; print ""; echo createHiddenFieldWithKey('folderaccess')."\n"; print "getID()."\">"; print ""; print "getID()."\">"; print "\n"; print "\n"; print ""; print "\n"; echo createHiddenFieldWithKey('folderaccess')."\n"; print "getID()."\">\n"; print "\n"; print "getID()."\">\n"; print "\n"; print ""; print "\n"; } print "
". htmlspecialchars($userObj->getFullName()) . "
\n"; $this->printAccessModeSelection($userAccess->getMode()); print "\n"; print ""; print "
\n"; print ""; print "
". htmlspecialchars($groupObj->getName()) . "
"; $this->printAccessModeSelection($groupAccess->getMode()); print "\n"; print ""; print "
"; print ""; print "

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