From e4b61ff54b73781e105feb28a4f2249a5597f3f2 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ <olivier@olivierperez.fr> Date: Sat, 11 Apr 2015 17:03:10 +0200 Subject: [PATCH] Don't redirect to studs when you edit a vote from adminstuds --- app/classes/Framadate/Utils.php | 20 ++++++++++---------- tpl/part/vote_table_classic.tpl | 4 ++-- tpl/part/vote_table_date.tpl | 5 +++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/app/classes/Framadate/Utils.php b/app/classes/Framadate/Utils.php index 9c0ab32d..6d5254d8 100644 --- a/app/classes/Framadate/Utils.php +++ b/app/classes/Framadate/Utils.php @@ -106,21 +106,21 @@ class Utils { public static function getUrlSondage($id, $admin = false, $vote_id='') { if (URL_PROPRE) { if ($admin === true) { - $url = str_replace('/admin', '', self::get_server_name()) . $id . '/admin'; + $url = self::get_server_name() . $id . '/admin'; } else { - $url = str_replace('/admin', '', self::get_server_name()) . $id; - if ($vote_id != '') { - $url .= '/vote/'.$vote_id."#edit"; - } + $url = self::get_server_name() . $id; + } + if ($vote_id != '') { + $url .= '/vote/'.$vote_id."#edit"; } } else { if ($admin === true) { - $url = str_replace('/admin', '', self::get_server_name()) . 'adminstuds.php?poll=' . $id; + $url = self::get_server_name() . 'adminstuds.php?poll=' . $id; } else { - $url = str_replace('/admin', '', self::get_server_name()) . 'studs.php?poll=' . $id; - if ($vote_id != '') { - $url .= '&vote='.$vote_id."#edit"; - } + $url = self::get_server_name() . 'studs.php?poll=' . $id; + } + if ($vote_id != '') { + $url .= '&vote='.$vote_id."#edit"; } } diff --git a/tpl/part/vote_table_classic.tpl b/tpl/part/vote_table_classic.tpl index 5ec4db53..cc482366 100644 --- a/tpl/part/vote_table_classic.tpl +++ b/tpl/part/vote_table_classic.tpl @@ -5,7 +5,7 @@ <h3>{__('Poll results', 'Votes of the poll')}Â {if $hidden}<i>({__('PollInfo', 'Results are hidden.')})</i>{/if}</h3> <div id="tableContainer" class="tableContainer"> - <form action="{poll_url id=$poll_id}" method="POST" id="poll_form"> + <form action="{if $admin}{poll_url id=$admin_poll_id admin=true}{else}{poll_url id=$poll_id}{/if}" method="POST" id="poll_form"> <table class="results"> <caption class="sr-only">{__('Poll results', 'Votes of the poll')} {$poll->title|html}</caption> <thead> @@ -89,7 +89,7 @@ {if $active && !$expired && ($poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL') or $admin)} <td> - <a href="{poll_url id=$poll->id vote_id=$vote->uniqId}" class="btn btn-link btn-sm" title="{__('Poll results', 'Edit the line:')|html} {$vote->name|html}"> + <a href="{if $admin}{poll_url id=$poll->admin_id vote_id=$vote->uniqId admin=true}{else}{poll_url id=$poll->id vote_id=$vote->uniqId}{/if}" class="btn btn-link btn-sm" title="{__('Poll results', 'Edit the line:')|html} {$vote->name|html}"> <span class="glyphicon glyphicon-pencil"></span><span class="sr-only">{__('Generic', 'Edit')}</span> </a> {if $admin} diff --git a/tpl/part/vote_table_date.tpl b/tpl/part/vote_table_date.tpl index f8bc22e6..37fa8768 100644 --- a/tpl/part/vote_table_date.tpl +++ b/tpl/part/vote_table_date.tpl @@ -4,8 +4,9 @@ <h3>{__('Poll results', 'Votes of the poll')}Â {if $hidden}<i>({__('PollInfo', 'Results are hidden.')})</i>{/if}</h3> + <div id="tableContainer" class="tableContainer"> - <form action="{poll_url id=$poll_id}" method="POST" id="poll_form"> + <form action="{if $admin}{poll_url id=$admin_poll_id admin=true}{else}{poll_url id=$poll_id}{/if}" method="POST" id="poll_form"> <table class="results"> <caption class="sr-only">{__('Poll results', 'Votes of the poll')} {$poll->title|html}</caption> <thead> @@ -136,7 +137,7 @@ {if $active && !$expired && ($poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL') or $admin)} <td> - <a href="{poll_url id=$poll->id vote_id=$vote->uniqId}" class="btn btn-link btn-sm" title="{__('Poll results', 'Edit the line:')|escape} {$vote->name|html}"> + <a href="{if $admin}{poll_url id=$poll->admin_id vote_id=$vote->uniqId admin=true}{else}{poll_url id=$poll->id vote_id=$vote->uniqId}{/if}" class="btn btn-link btn-sm" title="{__('Poll results', 'Edit the line:')|escape} {$vote->name|html}"> <span class="glyphicon glyphicon-pencil"></span><span class="sr-only">{__('Generic', 'Edit')}</span> </a> {if $admin} -- GitLab