remove old table layout and use formField()

This commit is contained in:
Uwe Steinmann 2021-03-01 09:26:37 +01:00
parent 7292ceb83c
commit b9e12a82ae

View File

@ -135,7 +135,7 @@ $(document).ready( function() {
$user = $this->params['user'];
$accessop = $this->params['accessobject'];
?>
<form action="../op/op.RoleMgr.php" method="post" enctype="multipart/form-data" name="form" id="form">
<form class="form-horizontal" action="../op/op.RoleMgr.php" method="post" enctype="multipart/form-data" name="form" id="form">
<?php
if($currRole) {
echo createHiddenFieldWithKey('editrole');
@ -150,37 +150,47 @@ $(document).ready( function() {
<input type="hidden" name="action" value="addrole">
<?php
}
?>
<table class="table-condensed">
<tr>
<td><?php printMLText("role_name");?>:</td>
<td><input type="text" name="name" id="name" value="<?php print $currRole ? htmlspecialchars($currRole->getName()) : "";?>"></td>
</tr>
<tr>
<td><?php printMLText("role_type");?>:</td>
<td><select name="role"><option value="<?php echo SeedDMS_Core_Role::role_user ?>"><?php printMLText("role_user"); ?></option><option value="<?php echo SeedDMS_Core_Role::role_admin ?>" <?php if($currRole && $currRole->getRole() == SeedDMS_Core_Role::role_admin) echo "selected"; ?>><?php printMLText("role_admin"); ?></option><option value="<?php echo SeedDMS_Core_Role::role_guest ?>" <?php if($currRole && $currRole->getRole() == SeedDMS_Core_Role::role_guest) echo "selected"; ?>><?php printMLText("role_guest"); ?></option></select></td>
</tr>
<?php
$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
)
);
if($currRole && $currRole->getRole() != SeedDMS_Core_Role::role_admin) {
echo "<tr>";
echo "<td>".getMLText('restrict_access')."</td>";
echo "<td>";
$options = array();
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) {
echo "<input type=\"checkbox\" name=\"noaccess[]\" value=\"".$status."\" ".(in_array($status, $currRole->getNoAccess()) ? "checked" : "")."> ".getOverallStatusText($status)."<br />";
$options[] = array($status, getOverallStatusText($status), in_array($status, $currRole->getNoAccess()));
}
echo "</td>";
echo "</tr>";
$this->formField(
getMLText("restrict_access"),
array(
'element'=>'select',
'name'=>'noaccess[]',
'options'=>$options,
'multiple'=>true,
)
);
}
if($currRole && $accessop->check_controller_access('RoleMgr', array('action'=>'editrole')) || !$currRole && $accessop->check_controller_access('RoleMgr', array('action'=>'addrole'))) {
?>
<tr>
<td></td>
<td><button type="submit" class="btn"><i class="fa fa-save"></i> <?php printMLText($currRole ? "save" : "add_role")?></button></td>
</tr>
<?php
$this->formSubmit("<i class=\"fa fa-save\"></i> ".getMLText($currRole ? "save" : "add_role"));
}
?>
</table>
</form>
<?php
} /* }}} */