From: Nik Okuntseff Date: Mon, 26 Feb 2018 22:24:10 +0000 (+0000) Subject: A bit more work in progress on roles. X-Git-Tag: timetracker_1.19-1~1081 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=5402d18abe68d10b0b5f500fee4d9ca31d6a7ab0;p=timetracker.git A bit more work in progress on roles. --- diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 0589a0cb..a3b7707b 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- + + + + diff --git a/role_add.php b/role_add.php index 71220089..b44304be 100644 --- a/role_add.php +++ b/role_add.php @@ -61,12 +61,13 @@ if ($request->isPost()) { if ($err->no()) { $existing_role = ttRoleHelper::getRoleByRank($cl_rank); if (!$existing_role) { - // Update role information. + // Insert a role with default user rights. if (ttRoleHelper::insert(array( 'team_id' => $user->team_id, 'name' => $cl_name, 'rank' => $cl_rank, 'description' => $cl_description, + 'rights' => 'data_entry,view_own_data,manage_own_settings,view_users', // Default user rights. 'status' => ACTIVE))) { header('Location: roles.php'); exit(); diff --git a/role_edit.php b/role_edit.php index 21ed258d..b665e6dc 100644 --- a/role_edit.php +++ b/role_edit.php @@ -49,10 +49,12 @@ $available_rights = array_diff($user->rights_array, $assigned_rights); if ($request->isPost()) { $cl_name = trim($request->getParameter('name')); $cl_description = trim($request->getParameter('description')); + $cl_rank = $request->getParameter('rank'); $cl_status = $request->getParameter('status'); } else { $cl_name = $role['name']; $cl_description = $role['description']; + $cl_rank = $role['rank']; $cl_status = $role['status']; } @@ -60,6 +62,14 @@ $form = new Form('roleForm'); $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_role_id)); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','style'=>'width: 250px;','value'=>$cl_name)); $form->addInput(array('type'=>'textarea','name'=>'description','style'=>'width: 250px; height: 40px;','value'=>$cl_description)); +for ($i = 0; $i < $user->role; $i++) { + $existing_role_name = null; + $rank_data[] = $i; +} +$form->addInput(array('type'=>'combobox','name'=>'rank','data'=>$rank_data,'value'=>$cl_rank)); +$form->addInput(array('type'=>'combobox','name'=>'status','value'=>$cl_status, + 'data'=>array(ACTIVE=>$i18n->getKey('dropdown.status_active'),INACTIVE=>$i18n->getKey('dropdown.status_inactive')))); +$form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->getKey('button.save'))); // Multiple select controls for assigned and available rights. $form->addInput(array('type'=>'combobox','name'=>'assigned_rights','style'=>'width: 250px;','multiple'=>true,'data'=>$assigned_rights)); @@ -67,11 +77,6 @@ $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->getK $form->addInput(array('type'=>'combobox','name'=>'available_rights','style'=>'width: 250px;','multiple'=>true,'data'=>$available_rights)); $form->addInput(array('type'=>'submit','name'=>'btn_add','value'=>$i18n->getKey('button.add'))); - -$form->addInput(array('type'=>'combobox','name'=>'status','value'=>$cl_status, - 'data'=>array(ACTIVE=>$i18n->getKey('dropdown.status_active'),INACTIVE=>$i18n->getKey('dropdown.status_inactive')))); -$form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->getKey('button.save'))); - if ($request->isPost()) { if ($request->getParameter('btn_save')) { // Validate user input.
 Anuko Time Tracker 1.17.32.4030 | Copyright © Anuko | +  Anuko Time Tracker 1.17.32.4031 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/role_edit.tpl b/WEB-INF/templates/role_edit.tpl index 6ba4ddce..3ad9e6cf 100644 --- a/WEB-INF/templates/role_edit.tpl +++ b/WEB-INF/templates/role_edit.tpl @@ -11,6 +11,10 @@ {$i18n.label.description}: {$forms.roleForm.description.control}
{$i18n.form.roles.rank}:{$forms.roleForm.rank.control} {$i18n.label.what_is_it}
{$i18n.label.status}: {$forms.roleForm.status.control}