diff --git a/adminstuds.php b/adminstuds.php index 997788e..07ee442 100644 --- a/adminstuds.php +++ b/adminstuds.php @@ -70,7 +70,7 @@ if (!$poll) { if (isset($_POST['update_poll_info'])) { $updated = false; - $field = $inputService->filterAllowedValues($_POST['update_poll_info'], ['title', 'admin_mail', 'description', 'rules', 'expiration_date', 'name']); + $field = $inputService->filterAllowedValues($_POST['update_poll_info'], ['title', 'admin_mail', 'description', 'rules', 'expiration_date', 'name', 'hidden']); // Update the right poll field if ($field == 'title') { @@ -128,6 +128,13 @@ if (isset($_POST['update_poll_info'])) { $poll->admin_name = $admin_name; $updated = true; } + } elseif ($field == 'hidden') { + $hidden = filter_input(INPUT_POST, 'hidden', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => BOOLEAN_REGEX]]); + $hidden = $hidden==null?false:true; + if ($hidden != $poll->hidden) { + $poll->hidden = $hidden; + $updated = true; + } } // Update poll in database diff --git a/app/classes/Framadate/FramaDB.php b/app/classes/Framadate/FramaDB.php index 8159b33..830d50c 100644 --- a/app/classes/Framadate/FramaDB.php +++ b/app/classes/Framadate/FramaDB.php @@ -90,9 +90,9 @@ class FramaDB { } function updatePoll($poll) { - $prepared = $this->prepare('UPDATE `' . Utils::table('poll') . '` SET title=?, admin_name=?, admin_mail=?, description=?, end_date=?, active=?, editable=? WHERE id = ?'); + $prepared = $this->prepare('UPDATE `' . Utils::table('poll') . '` SET title=?, admin_name=?, admin_mail=?, description=?, end_date=?, active=?, editable=?, hidden=? WHERE id = ?'); - return $prepared->execute([$poll->title, $poll->admin_name, $poll->admin_mail, $poll->description, $poll->end_date, $poll->active, $poll->editable, $poll->id]); + return $prepared->execute([$poll->title, $poll->admin_name, $poll->admin_mail, $poll->description, $poll->end_date, $poll->active, $poll->editable, $poll->hidden, $poll->id]); } function allCommentsByPollId($poll_id) { diff --git a/css/style.css b/css/style.css index 469f019..ffac6ca 100644 --- a/css/style.css +++ b/css/style.css @@ -124,6 +124,7 @@ caption { #email-form .btn-edit, #description-form .btn-edit, #poll-rules-form .btn-edit, +#poll-hidden-form .btn-edit, #expiration-form .btn-edit, #name-form .btn-edit { position:absolute; @@ -138,6 +139,8 @@ caption { #description-form:hover .btn-edit, #poll-rules-form .btn-edit:focus, #poll-rules-form:hover .btn-edit, +#poll-hidden-form .btn-edit:focus, +#poll-hidden-form:hover .btn-edit, #expiration-form .btn-edit:focus, #expiration-form:hover .btn-edit, #name-form .btn-edit:focus, @@ -155,7 +158,7 @@ caption { margin-bottom:0; } -#poll-rules-form p, +#poll-rules-form p, #poll-hidden-form p, .jumbotron p.well { font-size:16px; } diff --git a/js/core.js b/js/core.js index 4667c90..34fd84a 100644 --- a/js/core.js +++ b/js/core.js @@ -98,6 +98,20 @@ $(document).ready(function() { return false; }); + $('#poll-hidden-form .btn-edit').on('click', function() { + $('#poll-hidden-form p').hide(); + $('#poll-hidden-form .js-poll-hidden').removeClass("hidden"); + $('.js-poll-hidden input[type=checkbox]').focus(); + return false; + }); + + $('#poll-hidden-form .btn-cancel').on('click', function() { + $('#poll-hidden-form p').show(); + $('#poll-hidden-form .js-poll-hidden').addClass("hidden"); + $('.js-poll-hidden .btn-edit').focus(); + return false; + }); + $('#expiration-form .btn-edit').on('click', function() { $('#expiration-form p').hide(); $('.js-expiration').removeClass("hidden"); diff --git a/locale/de.json b/locale/de.json index 185e54e..09c148a 100644 --- a/locale/de.json +++ b/locale/de.json @@ -114,7 +114,9 @@ "Votes are editable solely by their owner.": "DE_Les votes sont modifiables uniquement par leur créateur", "Save the new rules": "Neue Regeln speichern", "Cancel the rules edit": "Neue Regeln nicht speichern", - "The name is invalid.": "Der Name ist ungültig." + "The name is invalid.": "Der Name ist ungültig.", + "Results are hidden.": "DE_Les résultats sont cachés.", + "Results are visible.": "DE_Les résultats sont visibles." }, "Poll results": { "Votes of the poll": "Abstimmungen der Umfrage ", @@ -302,7 +304,7 @@ "Framadate is not properly installed, please check the \"INSTALL\" to setup the database before continuing.": "Framadate ist nicht richtig installiert, überprüfen Sie bitte die Schaltfläche \"INSTALL\", um das Setup der Datenbank, bevor Sie fortfahren.", "Failed to save poll": "Fehlgeschlagen Umfrage sparen", "Update vote failed": "Update vote failed", - "Adding vote failed": "Adding vote failed" + "Adding vote failed": "Adding vote failed", "You can't create a poll with hidden results with the following edition option : ": "DE_Vous ne pouvez pas créer de sondage avec résulats cachés avec les options d'éditions suivantes : " } } \ No newline at end of file diff --git a/locale/en.json b/locale/en.json index 6408140..3096931 100644 --- a/locale/en.json +++ b/locale/en.json @@ -115,7 +115,9 @@ "Votes are editable solely by their owner.": "Votes are editable solely by their owner", "Save the new rules": "Save the new rules", "Cancel the rules edit": "Cancel the rules edit", - "The name is invalid.": "The name is invalid." + "The name is invalid.": "The name is invalid.", + "Results are hidden.": "Results are hidden.", + "Results are visible.": "Results are visible." }, "Poll results": { "Votes of the poll": "Votes of the poll", diff --git a/locale/es.json b/locale/es.json index 5005976..13604ea 100644 --- a/locale/es.json +++ b/locale/es.json @@ -114,7 +114,9 @@ "Votes are editable solely by their owner.": "ES_Les votes sont modifiables uniquement par leur créateur", "Save the new rules": "ES_Enregistrer les nouvelles permissions", "Cancel the rules edit": "ES_Annuler le changement de permissions", - "The name is invalid.": "ES_Le nom n'est pas valide." + "The name is invalid.": "ES_Le nom n'est pas valide.", + "Results are hidden.": "ES_Les résultats sont cachés.", + "Results are visible.": "ES_Les résultats sont visibles." }, "Poll results": { "Votes of the poll": "ES_Votes du sondage", diff --git a/locale/fr.json b/locale/fr.json index 1fa44d5..49d923c 100644 --- a/locale/fr.json +++ b/locale/fr.json @@ -114,7 +114,9 @@ "Votes are editable solely by their owner.": "Les votes sont modifiables uniquement par leur créateur", "Save the new rules": "Enregistrer les nouvelles permissions", "Cancel the rules edit": "Annuler le changement de permissions", - "The name is invalid.": "Le nom n'est pas valide." + "The name is invalid.": "Le nom n'est pas valide.", + "Results are hidden.": "Les résultats sont cachés.", + "Results are visible.": "Les résultats sont visibles." }, "Poll results": { "Votes of the poll": "Votes du sondage", diff --git a/studs.php b/studs.php index 142a371..ad5e323 100644 --- a/studs.php +++ b/studs.php @@ -212,6 +212,7 @@ $smarty->assign('comments', $comments); $smarty->assign('editingVoteId', $editingVoteId); $smarty->assign('message', $message); $smarty->assign('admin', false); +$smarty->assign('hidden', $poll->hidden); $smarty->assign('parameter_name_regex', NAME_REGEX); $smarty->display('studs.tpl'); diff --git a/tpl/part/poll_info.tpl b/tpl/part/poll_info.tpl index 645f9b1..9af9067 100644 --- a/tpl/part/poll_info.tpl +++ b/tpl/part/poll_info.tpl @@ -118,14 +118,41 @@ {if $admin}
{__('Poll results', 'The best choice at this time is:')}
- {elseif $count_bests > 1} -{__('Poll results', 'The bests choices at this time are:')}
- {/if} +{__('Poll results', 'The best choice at this time is:')}
+ {elseif $count_bests > 1} +{__('Poll results', 'The bests choices at this time are:')}
+ {/if} - {$i = 0} -{__('Generic', 'with')} {$max|html} {if $max==1}{__('Generic', 'vote')}{else}{__('Generic', 'votes')}{/if}.
+ {$i = 0} +{__('Generic', 'with')} {$max|html} {if $max==1}{__('Generic', 'vote')}{else}{__('Generic', 'votes')}{/if}.
+{__('Poll results', 'The best choice at this time is:')}
- {elseif $count_bests > 1} -{__('Poll results', 'The bests choices at this time are:')}
- {/if} +{__('Poll results', 'The best choice at this time is:')}
+ {elseif $count_bests > 1} +{__('Poll results', 'The bests choices at this time are:')}
+ {/if} - {$i = 0} -{__('Generic', 'with')} {$max|html} {if $max==1}{__('Generic', 'vote')}{else}{__('Generic', 'votes')}{/if}.
+{__('Generic', 'with')} {$max|html} {if $max==1}{__('Generic', 'vote')}{else}{__('Generic', 'votes')}{/if}.
+