MISP/app/View/Roles/admin_add.ctp

66 lines
2.7 KiB
Plaintext
Raw Normal View History

<div class="roles form">
<?php echo $this->Form->create('Role');?>
<fieldset>
2013-06-01 08:13:18 +02:00
<legend>Add Role</legend>
<?php
2012-10-31 17:10:59 +01:00
echo $this->Form->input('name');?>
<?php echo $this->Form->input('permission', array('type' => 'select', 'options' => $options), array('value' => '3'));?>
<div class = 'input clear'></div>
2013-06-01 08:13:18 +02:00
<?php echo $this->Form->input('perm_sync', array(
'type' => 'checkbox',
'checked' => false,
));?>
<?php echo $this->Form->input('perm_admin', array('type' => 'checkbox', 'checked' => false));?>
<?php echo $this->Form->input('perm_audit', array('type' => 'checkbox', 'checked' => false));?>
<?php echo $this->Form->input('perm_auth', array('type' => 'checkbox', 'checked' => false));?>
2012-10-31 17:10:59 +01:00
</fieldset>
2013-06-01 08:13:18 +02:00
<?php
echo $this->Form->button('Add', array('class' => 'btn btn-primary'));
echo $this->Form->end();
?>
</div>
<div class="actions <?php echo $debugMode;?>">
2013-06-01 08:13:18 +02:00
<ul class="nav nav-list">
<li><?php echo $this->Html->link('New User', array('controller' => 'users', 'action' => 'add', 'admin' => true)); ?> </li>
<li><?php echo $this->Html->link('List Users', array('controller' => 'users', 'action' => 'index', 'admin' => true)); ?> </li>
<li class="divider"></li>
<?php if ($isSiteAdmin): ?>
<li class="active"><?php echo $this->Html->link('New Role', array('controller' => 'roles', 'action' => 'add', 'admin' => true)); ?> </li>
<?php endif; ?>
<li><?php echo $this->Html->link('List Roles', array('controller' => 'roles', 'action' => 'index', 'admin' => true)); ?> </li>
<?php if ($isSiteAdmin): ?>
<li class="divider"></li>
<li><?php echo $this->Html->link('Contact users', array('controller' => 'users', 'action' => 'email', 'admin' => true)); ?> </li>
<?php endif; ?>
</ul>
</div>
<?php
$this->Js->get('#RolePermission')->event('change', 'deactivateActions()');
$this->Js->get('#RolePermSync')->event('change', 'checkPerms("RolePermSync")');
$this->Js->get('#RolePermAdmin')->event('change', 'checkPerms("RolePermAdmin")');
$this->Js->get('#RolePermAudit')->event('change', 'checkPerms("RolePermAudit")');
?>
<script type="text/javascript">
// only be able to tick perm_sync if manage org events and above.
function deactivateActions() {
var e = document.getElementById("RolePermission");
if (e.options[e.selectedIndex].value == '0' || e.options[e.selectedIndex].value == '1') {
document.getElementById("RolePermSync").checked = false;
document.getElementById("RolePermAdmin").checked = false;
document.getElementById("RolePermAudit").checked = false;
}
}
function checkPerms(id) {
var e = document.getElementById("RolePermission");
if (e.options[e.selectedIndex].value == '0' || e.options[e.selectedIndex].value == '1') {
document.getElementById(id).checked = false;
}
}
</script>
<?php echo $this->Js->writeBuffer();