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']; $user = $this->params['user'];
$accessop = $this->params['accessobject']; $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 <?php
if($currRole) { if($currRole) {
echo createHiddenFieldWithKey('editrole'); echo createHiddenFieldWithKey('editrole');
@ -150,37 +150,47 @@ $(document).ready( function() {
<input type="hidden" name="action" value="addrole"> <input type="hidden" name="action" value="addrole">
<?php <?php
} }
?> $this->formField(
<table class="table-condensed"> getMLText("role_name"),
<tr> array(
<td><?php printMLText("role_name");?>:</td> 'element'=>'input',
<td><input type="text" name="name" id="name" value="<?php print $currRole ? htmlspecialchars($currRole->getName()) : "";?>"></td> 'type'=>'text',
</tr> 'id'=>'name',
<tr> 'name'=>'name',
<td><?php printMLText("role_type");?>:</td> 'value'=>($currRole ? htmlspecialchars($currRole->getName()) : '')
<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 $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) { if($currRole && $currRole->getRole() != SeedDMS_Core_Role::role_admin) {
echo "<tr>"; $options = array();
echo "<td>".getMLText('restrict_access')."</td>";
echo "<td>";
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) { 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>"; $this->formField(
echo "</tr>"; 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'))) { if($currRole && $accessop->check_controller_access('RoleMgr', array('action'=>'editrole')) || !$currRole && $accessop->check_controller_access('RoleMgr', array('action'=>'addrole'))) {
?> $this->formSubmit("<i class=\"fa fa-save\"></i> ".getMLText($currRole ? "save" : "add_role"));
<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
} }
?> ?>
</table>
</form> </form>
<?php <?php
} /* }}} */ } /* }}} */