2016-02-24 13:36:59 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Implementation of RoleMgr view
|
|
|
|
*
|
|
|
|
* @category DMS
|
|
|
|
* @package SeedDMS
|
|
|
|
* @license GPL 2
|
|
|
|
* @version @version@
|
|
|
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
|
|
|
* @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
|
|
|
|
*/
|
2021-04-19 17:45:40 +00:00
|
|
|
//require_once("class.Bootstrap.php");
|
2016-02-24 13:36:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class which outputs the html page for RoleMgr view
|
|
|
|
*
|
|
|
|
* @category DMS
|
|
|
|
* @package SeedDMS
|
|
|
|
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
|
|
|
|
* @copyright Copyright (C) 2002-2005 Markus Westphal,
|
|
|
|
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
|
|
|
|
* 2010-2012 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
2021-04-19 17:45:40 +00:00
|
|
|
class SeedDMS_View_RoleMgr extends SeedDMS_Theme_Style {
|
2016-02-24 13:36:59 +00:00
|
|
|
|
|
|
|
function js() { /* {{{ */
|
|
|
|
$selrole = $this->params['selrole'];
|
|
|
|
|
|
|
|
header('Content-Type: application/javascript');
|
|
|
|
?>
|
|
|
|
function checkForm()
|
|
|
|
{
|
|
|
|
msg = new Array();
|
|
|
|
|
|
|
|
if($("#name").val() == "") msg.push("<?php printMLText("js_no_name");?>");
|
|
|
|
if (msg != "") {
|
|
|
|
noty({
|
|
|
|
text: msg.join('<br />'),
|
|
|
|
type: 'error',
|
|
|
|
dismissQueue: true,
|
|
|
|
layout: 'topRight',
|
|
|
|
theme: 'defaultTheme',
|
|
|
|
_timeout: 1500,
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready( function() {
|
|
|
|
$('body').on('submit', '#form', function(ev){
|
|
|
|
if(checkForm()) return;
|
|
|
|
event.preventDefault();
|
|
|
|
});
|
|
|
|
$( "#selector" ).change(function() {
|
|
|
|
$('div.ajax').trigger('update', {roleid: $(this).val()});
|
2020-03-13 08:20:12 +00:00
|
|
|
window.history.pushState({"html":"","pageTitle":""},"", '../out/out.RoleMgr.php?roleid=' + $(this).val());
|
2016-02-24 13:36:59 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
<?php
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
function info() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$selrole = $this->params['selrole'];
|
|
|
|
$settings = $this->params['settings'];
|
2019-11-20 12:47:57 +00:00
|
|
|
$accessobject = $this->params['accessobject'];
|
2016-02-24 13:36:59 +00:00
|
|
|
|
|
|
|
if($selrole) {
|
|
|
|
$this->contentHeading(getMLText("role_info"));
|
|
|
|
$users = $selrole->getUsers();
|
2016-03-04 08:38:01 +00:00
|
|
|
if($users) {
|
2021-04-19 17:45:40 +00:00
|
|
|
echo "<table class=\"table table-condensed table-sm\"><thead><tr><th>".getMLText('name')."</th><th></th></tr></thead><tbody>\n";
|
2016-03-04 08:38:01 +00:00
|
|
|
foreach($users as $currUser) {
|
|
|
|
echo "<tr>";
|
|
|
|
echo "<td>";
|
|
|
|
echo htmlspecialchars($currUser->getFullName())." (".htmlspecialchars($currUser->getLogin()).")";
|
2021-01-28 11:01:59 +00:00
|
|
|
echo "<br /><a href=\"mailto:".htmlspecialchars($currUser->getEmail())."\">".htmlspecialchars($currUser->getEmail())."</a>";
|
2016-03-04 08:38:01 +00:00
|
|
|
if($currUser->getComment())
|
|
|
|
echo "<br /><small>".htmlspecialchars($currUser->getComment())."</small>";
|
|
|
|
echo "</td>";
|
|
|
|
echo "<td>";
|
2019-11-20 12:47:57 +00:00
|
|
|
if($accessobject->check_view_access(array('UsrMgr', 'RemoveUser'))) {
|
2016-03-04 08:38:01 +00:00
|
|
|
echo "<div class=\"list-action\">";
|
2020-08-27 06:48:43 +00:00
|
|
|
echo $this->html_link('UsrMgr', array('userid'=>$currUser->getID()), array(), '<i class="fa fa-edit"></i>', false);
|
|
|
|
echo $this->html_link('RemoveUser', array('userid'=>$currUser->getID()), array(), '<i class="fa fa-remove"></i>', false);
|
2016-03-04 08:38:01 +00:00
|
|
|
echo "</div>";
|
|
|
|
}
|
|
|
|
echo "</td>";
|
|
|
|
echo "</tr>";
|
|
|
|
}
|
|
|
|
echo "</tbody></table>";
|
2016-02-24 13:36:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} /* }}} */
|
|
|
|
|
2020-03-13 08:20:12 +00:00
|
|
|
function actionmenu() { /* {{{ */
|
2016-02-24 13:36:59 +00:00
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
2020-03-13 08:20:12 +00:00
|
|
|
$selrole = $this->params['selrole'];
|
2016-04-13 16:31:42 +00:00
|
|
|
$accessop = $this->params['accessobject'];
|
2016-02-24 13:36:59 +00:00
|
|
|
|
2020-03-13 08:20:12 +00:00
|
|
|
if($selrole) {
|
|
|
|
if(!$selrole->isUsed() && $accessop->check_controller_access('RoleMgr', array('action'=>'removerole'))) {
|
2016-02-24 13:36:59 +00:00
|
|
|
?>
|
|
|
|
<form style="display: inline-block;" method="post" action="../op/op.RoleMgr.php" >
|
|
|
|
<?php echo createHiddenFieldWithKey('removerole'); ?>
|
2020-03-13 08:20:12 +00:00
|
|
|
<input type="hidden" name="roleid" value="<?php echo $selrole->getID()?>">
|
2016-02-24 13:36:59 +00:00
|
|
|
<input type="hidden" name="action" value="removerole">
|
2024-04-23 16:26:56 +00:00
|
|
|
<?php $this->formSubmit('<i class="fa fa-remove"></i> '.getMLText('rm_role'),'','','secondary');?>
|
2016-02-24 13:36:59 +00:00
|
|
|
</form>
|
|
|
|
<?php
|
2020-03-13 08:20:12 +00:00
|
|
|
}
|
2016-02-24 13:36:59 +00:00
|
|
|
}
|
2020-03-13 08:20:12 +00:00
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
function form() { /* {{{ */
|
|
|
|
$selrole = $this->params['selrole'];
|
|
|
|
|
|
|
|
$this->showRoleForm($selrole);
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
function showRoleForm($currRole) { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$accessop = $this->params['accessobject'];
|
2016-02-24 13:36:59 +00:00
|
|
|
?>
|
2021-03-01 08:26:37 +00:00
|
|
|
<form class="form-horizontal" action="../op/op.RoleMgr.php" method="post" enctype="multipart/form-data" name="form" id="form">
|
2016-02-24 13:36:59 +00:00
|
|
|
<?php
|
|
|
|
if($currRole) {
|
|
|
|
echo createHiddenFieldWithKey('editrole');
|
|
|
|
?>
|
|
|
|
<input type="hidden" name="roleid" id="roleid" value="<?php print $currRole->getID();?>">
|
|
|
|
<input type="hidden" name="action" value="editrole">
|
|
|
|
<?php
|
|
|
|
} else {
|
|
|
|
echo createHiddenFieldWithKey('addrole');
|
|
|
|
?>
|
|
|
|
<input type="hidden" id="roleid" value="0">
|
|
|
|
<input type="hidden" name="action" value="addrole">
|
|
|
|
<?php
|
|
|
|
}
|
2021-05-03 20:03:37 +00:00
|
|
|
$this->contentContainerStart();
|
2021-03-01 08:26:37 +00:00
|
|
|
$this->formField(
|
|
|
|
getMLText("role_name"),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'text',
|
|
|
|
'id'=>'name',
|
|
|
|
'name'=>'name',
|
|
|
|
'value'=>($currRole ? htmlspecialchars($currRole->getName()) : '')
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$options = array();
|
|
|
|
$options[] = array(SeedDMS_Core_Role::role_user, getMLText("role_user"), $currRole && $currRole->getRole() == SeedDMS_Core_Role::role_user);
|
|
|
|
$options[] = array(SeedDMS_Core_Role::role_admin, getMLText("role_admin"), $currRole && $currRole->getRole() == SeedDMS_Core_Role::role_admin);
|
|
|
|
$options[] = array(SeedDMS_Core_Role::role_guest, getMLText("role_guest"), $currRole && $currRole->getRole() == SeedDMS_Core_Role::role_guest);
|
|
|
|
$this->formField(
|
|
|
|
getMLText("role_type"),
|
|
|
|
array(
|
|
|
|
'element'=>'select',
|
|
|
|
'name'=>'role',
|
|
|
|
'options'=>$options
|
|
|
|
)
|
|
|
|
);
|
2016-04-12 15:22:04 +00:00
|
|
|
if($currRole && $currRole->getRole() != SeedDMS_Core_Role::role_admin) {
|
2021-03-01 08:26:37 +00:00
|
|
|
$options = array();
|
2018-01-30 18:21:57 +00:00
|
|
|
foreach(array(S_DRAFT_REV, S_DRAFT_APP, S_IN_WORKFLOW, S_REJECTED, S_RELEASED, S_IN_REVISION, S_DRAFT, S_EXPIRED, S_OBSOLETE, S_NEEDS_CORRECTION) as $status) {
|
2021-03-01 08:26:37 +00:00
|
|
|
$options[] = array($status, getOverallStatusText($status), in_array($status, $currRole->getNoAccess()));
|
2016-04-12 10:23:04 +00:00
|
|
|
}
|
2021-03-01 08:26:37 +00:00
|
|
|
$this->formField(
|
|
|
|
getMLText("restrict_access"),
|
|
|
|
array(
|
|
|
|
'element'=>'select',
|
|
|
|
'name'=>'noaccess[]',
|
|
|
|
'options'=>$options,
|
|
|
|
'multiple'=>true,
|
|
|
|
)
|
|
|
|
);
|
2016-04-12 10:23:04 +00:00
|
|
|
}
|
2021-05-03 20:03:37 +00:00
|
|
|
$this->contentContainerEnd();
|
2016-04-13 16:31:42 +00:00
|
|
|
if($currRole && $accessop->check_controller_access('RoleMgr', array('action'=>'editrole')) || !$currRole && $accessop->check_controller_access('RoleMgr', array('action'=>'addrole'))) {
|
2021-03-01 08:26:37 +00:00
|
|
|
$this->formSubmit("<i class=\"fa fa-save\"></i> ".getMLText($currRole ? "save" : "add_role"));
|
2016-04-13 16:31:42 +00:00
|
|
|
}
|
|
|
|
?>
|
2016-02-24 13:36:59 +00:00
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
function show() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
2016-04-13 16:31:42 +00:00
|
|
|
$accessop = $this->params['accessobject'];
|
2016-02-24 13:36:59 +00:00
|
|
|
$selrole = $this->params['selrole'];
|
|
|
|
$roles = $this->params['allroles'];
|
|
|
|
|
|
|
|
$this->htmlStartPage(getMLText("admin_tools"));
|
|
|
|
$this->globalNavigation();
|
|
|
|
$this->contentStart();
|
|
|
|
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
|
|
|
|
|
|
|
|
$this->contentHeading(getMLText("role_management"));
|
2021-04-19 17:45:40 +00:00
|
|
|
$this->rowStart();
|
|
|
|
$this->columnStart(4);
|
2016-02-24 13:36:59 +00:00
|
|
|
?>
|
2016-11-03 19:29:45 +00:00
|
|
|
<form class="form-horizontal">
|
2016-02-24 13:36:59 +00:00
|
|
|
<?php
|
2019-11-19 17:45:43 +00:00
|
|
|
$options = array();
|
|
|
|
$options[] = array("-1", getMLText("choose_role"));
|
|
|
|
if($accessop->check_controller_access('RoleMgr', array('action'=>'addrole'))) {
|
|
|
|
$options[] = array("0", getMLText("add_role"));
|
|
|
|
}
|
2016-02-24 13:36:59 +00:00
|
|
|
foreach ($roles as $currRole) {
|
2019-11-19 17:45:43 +00:00
|
|
|
$options[] = array($currRole->getID(), htmlspecialchars($currRole->getName()), $selrole && $currRole->getID()==$selrole->getID());
|
2016-02-24 13:36:59 +00:00
|
|
|
}
|
2019-11-19 17:45:43 +00:00
|
|
|
$this->formField(
|
|
|
|
null, //getMLText("selection"),
|
|
|
|
array(
|
|
|
|
'element'=>'select',
|
|
|
|
'id'=>'selector',
|
|
|
|
'class'=>'chzn-select',
|
|
|
|
'options'=>$options
|
|
|
|
)
|
|
|
|
);
|
2016-02-24 13:36:59 +00:00
|
|
|
?>
|
2016-11-03 19:29:45 +00:00
|
|
|
</form>
|
2020-03-13 08:20:12 +00:00
|
|
|
<div class="ajax" style="margin-bottom: 15px;" data-view="RoleMgr" data-action="actionmenu" <?php echo ($selrole ? "data-query=\"roleid=".$selrole->getID()."\"" : "") ?>></div>
|
2016-04-22 06:23:15 +00:00
|
|
|
<?php if($accessop->check_view_access($this, array('action'=>'info'))) { ?>
|
|
|
|
<div class="ajax" data-view="RoleMgr" data-action="info" <?php echo ($selrole ? "data-query=\"roleid=".$selrole->getID()."\"" : "") ?>></div>
|
2021-04-19 17:45:40 +00:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
$this->columnEnd();
|
|
|
|
$this->columnStart(8);
|
|
|
|
?>
|
2016-04-22 06:23:15 +00:00
|
|
|
<?php if($accessop->check_view_access($this, array('action'=>'form'))) { ?>
|
2016-02-24 13:36:59 +00:00
|
|
|
<div class="ajax" data-view="RoleMgr" data-action="form" <?php echo ($selrole ? "data-query=\"roleid=".$selrole->getID()."\"" : "") ?>></div>
|
2016-08-12 10:42:25 +00:00
|
|
|
<?php } else {
|
|
|
|
$this->errorMsg(getMLText('access_denied'));
|
2021-04-19 17:45:40 +00:00
|
|
|
}
|
|
|
|
$this->rowEnd();
|
|
|
|
$this->columnEnd();
|
2016-03-21 05:42:27 +00:00
|
|
|
$this->contentEnd();
|
2016-02-24 13:36:59 +00:00
|
|
|
$this->htmlEndPage();
|
|
|
|
} /* }}} */
|
|
|
|
}
|