From 39b9f8fa6b3c9683db9d92f683c23548de57f94d Mon Sep 17 00:00:00 2001 From: oliver Date: Sun, 19 Apr 2015 14:20:10 +0200 Subject: [PATCH] ask for confirmation for moving Questgroups (issue #88) --- agents/intermediate/QuestgroupsAgent.inc | 24 +++++ controllers/QuestgroupsController.inc | 100 ++++++++++++++------ locale/de_DE/LC_MESSAGES/The Legend of Z.mo | Bin 25673 -> 25931 bytes locale/de_DE/LC_MESSAGES/The Legend of Z.po | 48 ++++++---- views/html/questgroups/movedown.tpl | 19 ++++ views/html/questgroups/moveup.tpl | 19 ++++ 6 files changed, 165 insertions(+), 45 deletions(-) diff --git a/agents/intermediate/QuestgroupsAgent.inc b/agents/intermediate/QuestgroupsAgent.inc index 2d2a4996..7f71eafa 100644 --- a/agents/intermediate/QuestgroupsAgent.inc +++ b/agents/intermediate/QuestgroupsAgent.inc @@ -59,6 +59,30 @@ } + /** + * Action: moveup. + * + * @param \nre\core\Request $request Current request + * @param \nre\core\Response $response Current response + */ + public function moveup(\nre\core\Request $request, \nre\core\Response $response) + { + $this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4)); + } + + + /** + * Action: movedown. + * + * @param \nre\core\Request $request Current request + * @param \nre\core\Response $response Current response + */ + public function movedown(\nre\core\Request $request, \nre\core\Response $response) + { + $this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4)); + } + + /** * Action: delete. * diff --git a/controllers/QuestgroupsController.inc b/controllers/QuestgroupsController.inc index 0f601060..08f32132 100644 --- a/controllers/QuestgroupsController.inc +++ b/controllers/QuestgroupsController.inc @@ -580,22 +580,44 @@ $questgroup = $this->Questgroups->getQuestgroupByUrl($seminary['id'], $questgroupUrl); $questgroup['hierarchy'] = $this->Questgroupshierarchy->getHierarchyForQuestgroup($questgroup['id']); - // Set position - $this->Questgroups->moveQuestgroup($questgroup, true); - - - // Redirect - $referer = $this->request->getGetParam('referer'); - if(!is_null($referer)) + // Check request method + if($this->request->getRequestMethod() == 'POST') { - try { - $questgroup = $this->Questgroups->getQuestgroupById($referer); - $this->redirect($this->linker->link(array('questgroups', 'questgroup', $seminary['url'], $questgroup['url']))); - } - catch(IdNotFoundException $e) { - } + // Check confirmation + if(!is_null($this->request->getPostParam('move'))) + { + // Set position + $this->Questgroups->moveQuestgroup($questgroup, true); + } + + // Redirect + $referer = $this->request->getGetParam('referer'); + if(!is_null($referer)) + { + try { + $questgroup = $this->Questgroups->getQuestgroupById($referer); + $this->redirect($this->linker->link(array('questgroups', 'questgroup', $seminary['url'], $questgroup['url']))); + } + catch(IdNotFoundException $e) { + } + } + $this->redirect($this->linker->link(array('seminaries', 'seminary', $seminary['url']))); + } + + // Media + $picture = null; + if(!is_null($questgroup['questgroupspicture_id'])) { + $picture = $this->Media->getSeminaryMediaById($questgroup['questgroupspicture_id']); } - $this->redirect($this->linker->link(array('seminaries', 'seminary', $seminary['url']))); + + + // Set titile + $this->addTitleLocalized('Move Questgroup'); + + // Show confirmation + $this->set('seminary', $seminary); + $this->set('questgroup', $questgroup); + $this->set('picture', $picture); } @@ -617,22 +639,44 @@ $questgroup = $this->Questgroups->getQuestgroupByUrl($seminary['id'], $questgroupUrl); $questgroup['hierarchy'] = $this->Questgroupshierarchy->getHierarchyForQuestgroup($questgroup['id']); - // Set position - $this->Questgroups->moveQuestgroup($questgroup, false); - - - // Redirect - $referer = $this->request->getGetParam('referer'); - if(!is_null($referer)) + // Check request method + if($this->request->getRequestMethod() == 'POST') { - try { - $questgroup = $this->Questgroups->getQuestgroupById($referer); - $this->redirect($this->linker->link(array('questgroups', 'questgroup', $seminary['url'], $questgroup['url']))); - } - catch(IdNotFoundException $e) { - } + // Check confirmation + if(!is_null($this->request->getPostParam('move'))) + { + // Set position + $this->Questgroups->moveQuestgroup($questgroup, false); + } + + // Redirect + $referer = $this->request->getGetParam('referer'); + if(!is_null($referer)) + { + try { + $questgroup = $this->Questgroups->getQuestgroupById($referer); + $this->redirect($this->linker->link(array('questgroups', 'questgroup', $seminary['url'], $questgroup['url']))); + } + catch(IdNotFoundException $e) { + } + } + $this->redirect($this->linker->link(array('seminaries', 'seminary', $seminary['url']))); + } + + // Media + $picture = null; + if(!is_null($questgroup['questgroupspicture_id'])) { + $picture = $this->Media->getSeminaryMediaById($questgroup['questgroupspicture_id']); } - $this->redirect($this->linker->link(array('seminaries', 'seminary', $seminary['url']))); + + + // Set titile + $this->addTitleLocalized('Move Questgroup'); + + // Show confirmation + $this->set('seminary', $seminary); + $this->set('questgroup', $questgroup); + $this->set('picture', $picture); } diff --git a/locale/de_DE/LC_MESSAGES/The Legend of Z.mo b/locale/de_DE/LC_MESSAGES/The Legend of Z.mo index 4bf816844a5f090441e10674ae733bd87e91aaf1..2f802ca9b240c043c37c77d5b775d9306eeb3d96 100644 GIT binary patch delta 8477 zcmY+{3w+P@9>?+DW*58IX09`vnYoP3n9X&Fxy~hX8>854A=kzxq`xB7x`^e{O}VQ` z%&8PzmdYX}C5cpY#Nw1sPWeHvLmzs1z7F?U`-$ zT?uOC+fXY%iduOUYM}wl!lRjokoZXeXP{QP80+9V)XwZi4Oos5 zSb@5)zARTAN2BsdSPuuF-oMo>z)Pg8UQ~z2EPoF5;$K+3 z685!vC8&ueqxu4eo+!=#$6l&mH%TGmZWf5uz z?l)JW26zUwLmN>O*^WA@Jy!n-s^8J33oj@!$ zBA<-va0u4I5vb2F2SafQYHLeS6JCokxE(dIk1T%@^*dgs-4>)1vOAFb3E!y z=b<`$%<`Ksg#3QgL=K|{IEgxn^QayA$;$oOy93rim8YWG4QkK+hmjabfo^3!HpgPr zz%Qd-C`WDG8PpD)N9~YLvb*v))MuN5svnGMKNb0zckaMYTxI#qsPW1@B-HRS>Wr?T zX7(p)tNl8-6AVV3Sri6gE7T873ab4;tc}A_N1BJ~Z>Hr7Q4{cB9bArDm}jFE>@`0^ zt^8Zm&iroWK`HLpHbG4|4%J}->Il+M6Ujgw#R$}dCZgIEpeBB=9 zK9Aw#cVZnZL#_Ncs-tgF6Zjds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b/views/html/questgroups/moveup.tpl index e69de29b..4d265c95 100644 --- a/views/html/questgroups/moveup.tpl +++ b/views/html/questgroups/moveup.tpl @@ -0,0 +1,19 @@ + +
+ +
+ + + + +

:

+ +

+ + +

+ +
+ + +