From 341186de71fff2ecf47786a15adc96178c566e96 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Fri, 23 Mar 2018 21:46:05 +0000 Subject: [PATCH] Added a Cancel button on the swap roles page. --- WEB-INF/templates/admin_team_delete.tpl | 2 +- WEB-INF/templates/footer.tpl | 2 +- WEB-INF/templates/swap_roles.tpl | 2 +- swap_roles.php | 15 ++++++++++++--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/WEB-INF/templates/admin_team_delete.tpl b/WEB-INF/templates/admin_team_delete.tpl index a8b0712f..865c3fa9 100644 --- a/WEB-INF/templates/admin_team_delete.tpl +++ b/WEB-INF/templates/admin_team_delete.tpl @@ -10,7 +10,7 @@   - {$forms.teamForm.btn_delete.control}  + {$forms.teamForm.btn_delete.control}    {$forms.teamForm.btn_cancel.control} diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 6ca757e0..2765c4c8 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- - +
 Anuko Time Tracker 1.17.68.4147 | Copyright © Anuko | +  Anuko Time Tracker 1.17.68.4148 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/swap_roles.tpl b/WEB-INF/templates/swap_roles.tpl index b96334f0..2d308632 100644 --- a/WEB-INF/templates/swap_roles.tpl +++ b/WEB-INF/templates/swap_roles.tpl @@ -8,7 +8,7 @@ {$forms.swapForm.swap_with.control}
{$forms.swapForm.btn_submit.control}{$forms.swapForm.btn_submit.control} {$forms.swapForm.btn_cancel.control}
diff --git a/swap_roles.php b/swap_roles.php index 0c525704..09178cd9 100644 --- a/swap_roles.php +++ b/swap_roles.php @@ -45,16 +45,25 @@ if ($request->isPost()) { $form = new Form('swapForm'); $form->addInput(array('type'=>'combobox','name'=>'swap_with','style'=>'width: 250px;','data'=>$users,'datakeys'=>array('id','name'))); $form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->get('button.submit'))); +$form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->get('button.cancel'))); if ($request->isPost()) { - if (ttTeamHelper::swapRolesWith($cl_id)) { + if ($request->getParameter('btn_submit')) { + if (ttTeamHelper::swapRolesWith($cl_id)) { + header('Location: users.php'); + exit(); + } else + $err->add($i18n->get('error.db')); + } + + if ($request->getParameter('btn_cancel')) { header('Location: users.php'); exit(); - } else - $err->add($i18n->get('error.db')); + } } $smarty->assign('forms', array($form->getName()=>$form->toArray())); +$smarty->assign('onload', 'onLoad="document.swapForm.btn_cancel.focus()"'); $smarty->assign('title', $i18n->get('title.swap_roles')); $smarty->assign('content_page_name', 'swap_roles.tpl'); $smarty->display('index.tpl'); -- 2.20.1