From b8210a2eb72e55e6e06356b200f23e519f77441f Mon Sep 17 00:00:00 2001 From: Nikos Date: Sat, 31 Oct 2015 20:02:41 +0100 Subject: [PATCH 01/22] traduzione italiana --- locale/it.json | 58 +++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/locale/it.json b/locale/it.json index e976a44..68d0334 100644 --- a/locale/it.json +++ b/locale/it.json @@ -28,15 +28,15 @@ "Yes": "Sì", "Ifneedbe": "Se necessario", "No": "No", - "Legend:": "Lgenda:", - "Date": "IT_Date", - "Classic": "IT_Classique", - "Page generated in": "IT_Page générée en", - "seconds": "IT_secondes", + "Legend:": "Legenda:", + "Date": "Data", + "Classic": "Classico", + "Page generated in": "Pagina generata in", + "seconds": "secondi", "Choice": "Scelta", "Link": "Link", - "Search": "IT_Chercher", - "Creation date:": "IT_Date de création :", + "Search": "Cercare", + "Creation date:": "Data di creazione:", "ASTERISK": "*" }, "Date": { @@ -98,9 +98,9 @@ "Save the new title": "Salvare il nuovo titolo", "Cancel the title edit": "Annullare la modifica del titolo", "Initiator of the poll": "Autore del sondaggio", - "Edit the name": "Modifica dell'autore", - "Save the new name": "Salvare l'autore", - "Cancel the name edit": "Annulla il cambio di dell'autore", + "Edit the name": "Modifica il nome", + "Save the new name": "Salvare il nuovo nome", + "Cancel the name edit": "Annulla il cambio di nome", "Email": "Email", "Edit the email adress": "Modificare l'email", "Save the email address": "Salvare l'email", @@ -140,10 +140,10 @@ "The bests choices at this time are:": "Le migliori scelte per ora sono :", "Scroll to the left": "Spostare a sinistra", "Scroll to the right": "Spostare a destra", - "polled user": "IT_votant", - "polled users": "IT_votants", - "Display the chart of the results": "IT_Afficher le graphique des résultats", - "Chart": "IT_Graphique" + "polled user": "Votante", + "polled users": "Votanti", + "Display the chart of the results": "Mostra il grafico dei risultati", + "Chart": "Grafico" }, "Comments": { "Comments of polled people": "Commenti dei partecipanti", @@ -313,29 +313,29 @@ "Error": { "Error!": "Errore!", "Enter a title": "È necessario inserire un titolo !", - "Something is going wrong...": "IT_Quelque chose ne va pas...", - "Something is wrong with the format": "IT_Quelque chose ne va pas avec le format", + "Something is going wrong...": "Qualcosa non è corretto...", + "Something is wrong with the format": "Qualche errore nel formato", "Enter an email address": "È necessario inserire un indirizzo e-mail!", "The address is not correct! You should enter a valid email address (like r.stallman@outlock.com) in order to receive the link to your poll.": "L'indirizzo inserito non è corretto ! È necessario un indirizzo e-mail valido (per esempio r.stallman@outlock.com) per ricevere il link del sondaggio.", - "No polls found": "IT_Aucun sondage n'a été trouvé", - "There is a problem with your choices": "IT_Il y a un problème avec vos choix", + "No polls found": "Nessun sondaggio trovato", + "There is a problem with your choices": "C'è un problema con la vostra scelta", "You haven't filled the first section of the poll creation.": "Non avete completato la prima pagina del sondaggio", - "Javascript is disabled on your browser. Its activation is required to create a poll.": "IT_Javascript est désactivé sur votre navigateur. Son activation est requise pour la création d'un sondage.", - "Cookies are disabled on your browser. Theirs activation is required to create a poll.": "IT_Les cookies sont désactivés sur votre navigateur. Leur activation est requise pour la création d'un sondage.", + "Javascript is disabled on your browser. Its activation is required to create a poll.": "Javascript è disattivato sul vostro browser. E' necessario attivarlo per creare un sondaggio.", + "Cookies are disabled on your browser. Theirs activation is required to create a poll.": "I cookies non sono permessi sul vostro browser. E' necessario permetterli per creare un sondaggio.", "This poll doesn't exist !": "Questo sondaggio non esiste più !", "Enter a name": "Non avete inserito il nome !", - "The name is invalid.": "IT_Le nom n'est pas valide.", + "The name is invalid.": "Nome non valido.", "The name you've chosen already exist in this poll!": "Il nome che avete scelto esiste già !", "Enter a name and a comment!": "Inserire un nome e un commento!", "Failed to insert the comment!": "Errore nell'inserimento del commento !", - "Framadate is not properly installed, please check the \"INSTALL\" to setup the database before continuing.": "IT_Framadate n'est pas installé correctement, lisez le fichier INSTALL pour configurer la base de données avant de continuer.", - "Failed to save poll": "IT_Echec de la sauvegarde du sondage", - "Update vote failed": "IT_Mise à jour du vote échoué", - "Adding vote failed": "IT_Ajout d'un vote échoué", - "Comment failed": "IT_Commentaire échoué", - "You can't create a poll with hidden results with the following edition option:": "IT_Vous ne pouvez pas créer de sondage avec résulats cachés avec les options d'éditions suivantes : ", - "Failed to delete column": "Impossibile eliminare colonna", + "Framadate is not properly installed, please check the \"INSTALL\" to setup the database before continuing.": "Framadate non è installato correttamente, leggete la cartella INSTALL per configurare il database prima di continuare.", + "Failed to save poll": "Errore nel salvataggio del sondaggio", + "Update vote failed": "Aggiornamento del voto fallito", + "Adding vote failed": "Aggiunta del voto fallito", + "Comment failed": "Commento fallito", + "You can't create a poll with hidden results with the following edition option:": "Non potete creare un sondaggio con i risultati nascosti con queste opzioni: ", + "Failed to delete column": "Impossibile eliminare la colonna", "MISSING_VALUES": "Valori mancanti", "CANT_CONNECT_TO_DATABASE": "Impossibile connettersi al database" } -} +} \ No newline at end of file From b590768a140f48033d8cf9f46448c8f21c7f9932 Mon Sep 17 00:00:00 2001 From: Nikos Date: Sat, 31 Oct 2015 20:16:56 +0100 Subject: [PATCH 02/22] Traduzione italiana completata --- locale/it.json | 56 +++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/locale/it.json b/locale/it.json index 68d0334..87854d0 100644 --- a/locale/it.json +++ b/locale/it.json @@ -255,52 +255,52 @@ "Archiving date:": "Archivio Data:" }, "Admin": { - "Back to administration": "IT_Retour à l'administration", - "Administration": "IT_Administration", - "Polls": "IT_Sondages", - "Migration": "IT_Migration", - "Purge": "IT_Purge", + "Back to administration": "Ritorna all'amministrazione", + "Administration": "Amministrazione", + "Polls": "Sondaggi", + "Migration": "Migrazione", + "Purge": "Depurare", "Logs": "Log", "Installation": "Installazione", - "Poll ID": "ID sondaggio", + "Poll ID": "ID del sondaggio", "Format": "Formato", "Title": "Titolo", "Author": "Autore", "Email": "Email", - "Expiration date": "IT_Expiration", - "Votes": "voti", + "Expiration date": "Scadenza", + "Votes": "Voti", "Actions": "Azioni", "See the poll": "Vedere il sondaggio", "Change the poll": "Modificare il sondaggio", - "Deleted the poll": "IT_Supprimer le sondage", - "Summary": "IT_Résumé", - "Success": "IT_Réussite", - "Fail": "IT_Échèc", - "Nothing": "IT_Rien", - "Succeeded:": "IT_Réussit:", - "Failed:": "IT_Échoué:", - "Skipped:": "IT_Passé:", - "Pages:": "IT_Pages :", - "Purged:": "IT_Purgés :", + "Deleted the poll": "Cancellare il sondaggio", + "Summary": "Sommario", + "Success": "Successo", + "Fail": "Fallimento", + "Nothing": "Niente", + "Succeeded:": "Successo:", + "Failed:": "Fallito:", + "Skipped:": "Saltato:", + "Pages:": "Pagine:", + "Purged:": "Depurati:", "Confirm removal of the poll": "Confermare l'eliminazione del sondaggio ", "polls in the database at this time": "sondaggi presenti nel database attualmente", - "Purge the polls": "IT_Purger les sondages" + "Purge the polls": "Depurare i sondaggi" }, "FindPolls": { - "Here are your polls": "IT_Voici tes sondages", - "Send me my polls": "IT_Envoyer mes sondages", - "Polls sent": "IT_Sondages envoyés" + "Here are your polls": "Ecco i tuoi sondaggi", + "Send me my polls": "Inviare i miei sondaggi", + "Polls sent": "Sondaggi inviati" }, "Mail": { "Poll's participation: %s": "Partecipazione al sondaggio: %s", "Notification of poll: %s": "Notifica di sondaggio: %s", - "filled a vote.\nYou can find your poll at the link": "IT_vient de voter.\nVous pouvez retrouver votre sondage avec le lien suivant", - "updated a vote.\nYou can find your poll at the link": "IT_vient de mettre à jour un vote.\nVous pouvez retrouver votre sondage avec le lien suivant", - "wrote a comment.\nYou can find your poll at the link": "IT_vient de rédiger un commentaire.\nVous pouvez retrouver votre sondage avec le lien suivant", - "Someone just change your poll available at the following link %s.": "Qualcuno basta cambiare il vostro sondaggio disponibile al seguente link %1$s.", - "Someone just delete your poll %s.": "Qualcuno ha appena cancellare il tuo sondaggio \"%s\".", + "filled a vote.\nYou can find your poll at the link": "ha appena votato.\nPotete trovare il vostro sondaggio con il link seguente", + "updated a vote.\nYou can find your poll at the link": "ha appena aggiornato un voto.\nPotete trovare il vostro sondaggio con il link seguente", + "wrote a comment.\nYou can find your poll at the link": "ha appena inserito un commento.\nPotete trovare il vostro sondaggio con il link seguente", + "Someone just change your poll available at the following link %s.": "Qualcuno ha appena cambiato il vostro sondaggio disponibile al seguente link %1$s.", + "Someone just delete your poll %s.": "Qualcuno ha appena cancellato il tuo sondaggio \"%s\".", "Thanks for your trust.": "Grazie per la vostra fiducia.", - "FOOTER": "IT_« La route est longue, mais la voie est libre… »\nFramasoft ne vit que par vos dons (déductibles des impôts).\nMerci d'avance pour votre soutien http://soutenir.framasoft.org.", + "FOOTER": "« La strada è lunga, ma la via è libera… »\nFramasoft vive solo grazie alle vostre donazioni (deducibili dalle imposte).\nGrazie in anticipo per il vostro sostegno http://soutenir.framasoft.org.", "[ADMINISTRATOR] New settings for your poll": "[AMMINISTRATORE] Modifica di configurazione del sondaggio", "You have changed the settings of your poll. \nYou can modify this poll with this link": "Avete modificato la configurazione del vostro sondaggio. \nPotete modificare questo sondaggio con le Link seguente", "This is the message you have to send to the people you want to poll. \nNow, you have to send this message to everyone you want to poll.": "Questo è il messaggio che deve essere inviato ai partecipanti. \nPotete ora inviare questo messaggio a tutte le persone a cui volete chiedere il voto.", From 40f2a1729cdefe1d7406de1a99e25678b14f6b94 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Tue, 3 Nov 2015 21:15:47 +0100 Subject: [PATCH 03/22] Better message when fail to create column --- adminstuds.php | 25 ++++++++++--------- .../MomentAlreadyExistsException.php | 9 +++++++ .../Framadate/Services/AdminPollService.php | 18 +++++-------- locale/de.json | 3 ++- locale/en.json | 1 + locale/es.json | 1 + locale/fr.json | 1 + locale/it.json | 1 + 8 files changed, 34 insertions(+), 25 deletions(-) create mode 100644 app/classes/Framadate/Exception/MomentAlreadyExistsException.php diff --git a/adminstuds.php b/adminstuds.php index 9c7ac25..29f3d27 100644 --- a/adminstuds.php +++ b/adminstuds.php @@ -17,6 +17,7 @@ * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) */ use Framadate\Editable; +use Framadate\Exception\MomentAlreadyExistsException; use Framadate\Message; use Framadate\Services\AdminPollService; use Framadate\Services\InputService; @@ -393,21 +394,21 @@ if (isset($_GET['add_slot'])) { exit; } if (isset($_POST['confirm_add_slot'])) { - if ($poll->format === 'D') { - $newdate = strip_tags($_POST['newdate']); - $newmoment = str_replace(',', '-', strip_tags($_POST['newmoment'])); + try { + if ($poll->format === 'D') { + $newdate = strip_tags($_POST['newdate']); + $newmoment = str_replace(',', '-', strip_tags($_POST['newmoment'])); - $ex = explode('/', $newdate); - $result = $adminPollService->addDateSlot($poll_id, mktime(0, 0, 0, $ex[1], $ex[0], $ex[2]), $newmoment); - } else { - $newslot = str_replace(',', '-', strip_tags($_POST['choice'])); - $result = $adminPollService->addClassicSlot($poll_id, $newslot); - } + $ex = explode('/', $newdate); + $adminPollService->addDateSlot($poll_id, mktime(0, 0, 0, $ex[1], $ex[0], $ex[2]), $newmoment); + } else { + $newslot = str_replace(',', '-', strip_tags($_POST['choice'])); + $adminPollService->addClassicSlot($poll_id, $newslot); + } - if ($result) { $message = new Message('success', __('adminstuds', 'Choice added')); - } else { - $message = new Message('danger', __('Error', 'Failed to add the column')); + } catch (MomentAlreadyExistsException $e) { + $message = new Message('danger', __('Error', 'The column already exists')); } } diff --git a/app/classes/Framadate/Exception/MomentAlreadyExistsException.php b/app/classes/Framadate/Exception/MomentAlreadyExistsException.php new file mode 100644 index 0000000..11723e9 --- /dev/null +++ b/app/classes/Framadate/Exception/MomentAlreadyExistsException.php @@ -0,0 +1,9 @@ +logService->log('ADD_SLOT', 'id:' . $poll_id . ', datetime:' . $datetime . ', moment:' . $new_moment); @@ -207,16 +208,13 @@ class AdminPollService { // Begin transaction $this->connect->beginTransaction(); - if ($result == null) { - // The moment already exists - return false; - } elseif ($result->slot != null) { + if ($result->slot != null) { $slot = $result->slot; $moments = explode(',', $slot->moments); // Check if moment already exists (maybe not necessary) if (in_array($new_moment, $moments)) { - return false; + throw new MomentAlreadyExistsException(); } // Update found slot @@ -232,8 +230,6 @@ class AdminPollService { // Commit transaction $this->connect->commit(); - return true; - } /** @@ -244,7 +240,7 @@ class AdminPollService { * * @param $poll_id int The ID of the poll * @param $title int The title - * @return bool true if added + * @throws MomentAlreadyExistsException When the moment to add already exists in database */ public function addClassicSlot($poll_id, $title) { $this->logService->log('ADD_SLOT', 'id:' . $poll_id . ', title:' . $title); @@ -257,7 +253,7 @@ class AdminPollService { }, $slots); if (in_array($title, $titles)) { // The moment already exists - return false; + throw new MomentAlreadyExistsException(); } @@ -272,8 +268,6 @@ class AdminPollService { // Commit transaction $this->connect->commit(); - return true; - } /** diff --git a/locale/de.json b/locale/de.json index 06d1c32..0096ec0 100644 --- a/locale/de.json +++ b/locale/de.json @@ -335,7 +335,8 @@ "Comment failed": "Abgabe des Kommentars gescheitert", "You can't create a poll with hidden results with the following edition option:": "Sie können mit der folgenden Editier-Option keine Umfrage mit versteckten Ergebnissen erzeugen:", "Failed to delete column": "Löschen der Spalte fehlgeschlagen", + "The column already exists": "DE_La colonne existe déjà", "MISSING_VALUES": "Fehlende Werte", "CANT_CONNECT_TO_DATABASE": "Kann nicht mit der Datenbank verbinden" } -} \ No newline at end of file +} diff --git a/locale/en.json b/locale/en.json index ab727f8..756caa6 100644 --- a/locale/en.json +++ b/locale/en.json @@ -335,6 +335,7 @@ "Comment failed": "Comment failed", "You can't create a poll with hidden results with the following edition option:": "You can't create a poll with hidden results with the following option: ", "Failed to delete column": "Failed to delete column", + "The column already exists": "The column already exists", "MISSING_VALUES": "Missing values", "CANT_CONNECT_TO_DATABASE": "Unable to connect to database" } diff --git a/locale/es.json b/locale/es.json index 96c0d69..36ab06c 100644 --- a/locale/es.json +++ b/locale/es.json @@ -335,6 +335,7 @@ "Comment failed": "ES_Commentaire échoué", "You can't create a poll with hidden results with the following edition option:": "ES_Vous ne pouvez pas créer de sondage avec résulats cachés avec les options d'éditions suivantes : ", "Failed to delete column": "Error al eliminar la columna", + "The column already exists": "ES_La colonne existe déjà", "MISSING_VALUES": "Los valores perdidos", "CANT_CONNECT_TO_DATABASE": "No se puede conectar a la base de datos" } diff --git a/locale/fr.json b/locale/fr.json index be0d838..57a20ad 100644 --- a/locale/fr.json +++ b/locale/fr.json @@ -350,6 +350,7 @@ "Comment failed": "Commentaire échoué", "You can't create a poll with hidden results with the following edition option:": "Vous ne pouvez pas créer de sondage avec résulats cachés avec les options d'éditions suivantes : ", "Failed to delete column": "Échec de la suppression de colonne", + "The column already exists": "La colonne existe déjà", "MISSING_VALUES": "Il manque des valeurs", "CANT_CONNECT_TO_DATABASE": "Impossible de se connecter à la base de données" } diff --git a/locale/it.json b/locale/it.json index e976a44..59595a4 100644 --- a/locale/it.json +++ b/locale/it.json @@ -335,6 +335,7 @@ "Comment failed": "IT_Commentaire échoué", "You can't create a poll with hidden results with the following edition option:": "IT_Vous ne pouvez pas créer de sondage avec résulats cachés avec les options d'éditions suivantes : ", "Failed to delete column": "Impossibile eliminare colonna", + "The column already exists": "IT_La colonne existe déjà", "MISSING_VALUES": "Valori mancanti", "CANT_CONNECT_TO_DATABASE": "Impossibile connettersi al database" } From c3b48b885d7aea588a182427f5eb3903c996c168 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Tue, 3 Nov 2015 21:17:00 +0100 Subject: [PATCH 04/22] Refactor something :-) --- .../Framadate/Services/AdminPollService.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/app/classes/Framadate/Services/AdminPollService.php b/app/classes/Framadate/Services/AdminPollService.php index 409511d..0f19192 100644 --- a/app/classes/Framadate/Services/AdminPollService.php +++ b/app/classes/Framadate/Services/AdminPollService.php @@ -277,34 +277,29 @@ class AdminPollService { * * @param $slots array All the slots of the poll * @param $datetime int The datetime of the new slot - * @return null|\stdClass An object like this one: {insert:X, slot:Y} where Y can be null. + * @return \stdClass An object like this one: {insert:X, slot:Y} where Y can be null. */ private function findInsertPosition($slots, $datetime) { $result = new \stdClass(); $result->slot = null; - $result->insert = -1; - - $i = 0; + $result->insert = 0; foreach ($slots as $slot) { $rowDatetime = $slot->title; $moments = explode(',', $slot->moments); if ($datetime == $rowDatetime) { - $i += count($moments); - // Here we have to insert at the end of a slot + $result->insert += count($moments); $result->slot = $slot; - $result->insert = $i; break; } elseif ($datetime < $rowDatetime) { - // Here we have to insert a new slot + // We have to insert before this slot break; } else { - $i += count($moments); + $result->insert += count($moments); } } - $result->insert = $i; return $result; } From acbf7db8b5812269871f2e97b770f9ca175753f6 Mon Sep 17 00:00:00 2001 From: Olivier Perez Date: Wed, 4 Nov 2015 12:37:53 +0100 Subject: [PATCH 05/22] Fixes #114 - Can't delete last column anymore --- app/classes/Framadate/Services/AdminPollService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/classes/Framadate/Services/AdminPollService.php b/app/classes/Framadate/Services/AdminPollService.php index 35e40c7..169423f 100644 --- a/app/classes/Framadate/Services/AdminPollService.php +++ b/app/classes/Framadate/Services/AdminPollService.php @@ -118,7 +118,7 @@ class AdminPollService { $slots = $this->pollService->allSlotsByPoll($poll); // We can't delete the last slot - if ($poll->format == 'D' && count($slots) === 1 && strpos($slots[0]->moments, ',') === -1) { + if ($poll->format == 'D' && count($slots) === 1 && strpos($slots[0]->moments, ',') === false) { return false; } elseif ($poll->format == 'A' && count($slots) === 1) { return false; From afe8eac89be801088a58e9ccc40988a6b1cc0e0c Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Thu, 5 Nov 2015 21:02:49 +0100 Subject: [PATCH 06/22] Fixes issue #109 - Urlencode title of column to delete for classical polls too --- tpl/part/vote_table_classic.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tpl/part/vote_table_classic.tpl b/tpl/part/vote_table_classic.tpl index 20fe885..cb01b08 100644 --- a/tpl/part/vote_table_classic.tpl +++ b/tpl/part/vote_table_classic.tpl @@ -14,7 +14,7 @@ {foreach $slots as $id=>$slot} - {__('Generic', 'Remove')} From 3f774d5445c1cdd6aa54d8d56ce07e41371c1851 Mon Sep 17 00:00:00 2001 From: Antonin Date: Thu, 5 Nov 2015 21:26:59 +0100 Subject: [PATCH 07/22] =?UTF-8?q?On=20permet=20d'=C3=A9diter=20son=20vote?= =?UTF-8?q?=20=C3=A0=20la=20vol=C3=A9e.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dans le cas d'un vote ou l'utilisateur ne peut modifier que son propre vote, après qu'il ait ajouté (ou édité) son vote, on affiche le crayon qui permet d'éditer son vote. Fix #116 --- studs.php | 7 +++++-- tpl/part/vote_table_classic.tpl | 9 ++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/studs.php b/studs.php index 52b9096..6a57efb 100644 --- a/studs.php +++ b/studs.php @@ -39,6 +39,7 @@ $poll_id = null; $poll = null; $message = null; $editingVoteId = 0; +$editedVoteUniqueId = null; /* Services */ /*----------*/ @@ -133,8 +134,8 @@ if (!empty($_POST['save'])) { // Save edition of an old vote $result = $pollService->updateVote($poll_id, $editedVote, $name, $choices); if ($result) { if ($poll->editable == Editable::EDITABLE_BY_OWN) { - $editedVoteUniqId = filter_input(INPUT_POST, 'edited_vote', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => POLL_REGEX]]); - $urlEditVote = Utils::getUrlSondage($poll_id, false, $editedVoteUniqId); + $editedVoteUniqueId = filter_input(INPUT_POST, 'edited_vote', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => POLL_REGEX]]); + $urlEditVote = Utils::getUrlSondage($poll_id, false, $editedVoteUniqueId); $message = new Message('success', __('studs', 'Your vote has been registered successfully, but be careful: regarding this poll options, you need to keep this personal link to edit your own vote:'), $urlEditVote); } else { $message = new Message('success', __('studs', 'Update vote succeeded')); @@ -161,6 +162,7 @@ if (!empty($_POST['save'])) { // Save edition of an old vote if ($result) { if ($poll->editable == Editable::EDITABLE_BY_OWN) { $urlEditVote = Utils::getUrlSondage($poll_id, false, $result->uniqId); + $editedVoteUniqueId = $result->uniqId; $message = new Message('success', __('studs', 'Your vote has been registered successfully, but be careful: regarding this poll options, you need to keep this personal link to edit your own vote:'), $urlEditVote); } else { $message = new Message('success', __('studs', 'Adding the vote succeeded')); @@ -216,5 +218,6 @@ $smarty->assign('editingVoteId', $editingVoteId); $smarty->assign('message', $message); $smarty->assign('admin', false); $smarty->assign('hidden', $poll->hidden); +$smarty->assign('editedVoteUniqueId', $editedVoteUniqueId); $smarty->display('studs.tpl'); diff --git a/tpl/part/vote_table_classic.tpl b/tpl/part/vote_table_classic.tpl index 20fe885..4330968 100644 --- a/tpl/part/vote_table_classic.tpl +++ b/tpl/part/vote_table_classic.tpl @@ -94,7 +94,14 @@ {/foreach} - {if $active && !$expired && ($poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL') or $admin)} + {if $active && !$expired && + ( + $poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL') + or ($poll->editable == constant('Framadate\Editable::EDITABLE_BY_OWN') && $editedVoteUniqueId == $vote->uniqId) + or $admin + ) + } + {__('Generic', 'Edit')} From 964310e8c0e21d74f581713d479c8266d83193a9 Mon Sep 17 00:00:00 2001 From: Nikos Date: Sat, 31 Oct 2015 20:40:44 +0100 Subject: [PATCH 08/22] traduzione italiana --- locale/it.json | 68 +++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/locale/it.json b/locale/it.json index e976a44..ee5cab7 100644 --- a/locale/it.json +++ b/locale/it.json @@ -11,7 +11,7 @@ "Edit": "Modificare", "Next": "Continua", "Back": "Precedente", - "Close": "Chiuedere", + "Close": "Chiudere", "Your name": "Il vostro nome", "Your email address": "Il vostro indirizzo e-mail", "(in the format name@mail.com)": "(nel formato nome@mail.com)", @@ -29,14 +29,14 @@ "Ifneedbe": "Se necessario", "No": "No", "Legend:": "Lgenda:", - "Date": "IT_Date", - "Classic": "IT_Classique", - "Page generated in": "IT_Page générée en", - "seconds": "IT_secondes", + "Date": "Data", + "Classic": "Classico", + "Page generated in": "Pagina generata in", + "seconds": "secondi", "Choice": "Scelta", "Link": "Link", - "Search": "IT_Chercher", - "Creation date:": "IT_Date de création :", + "Search": "Ricerca", + "Creation date:": "Data di creazione:", "ASTERISK": "*" }, "Date": { @@ -140,10 +140,10 @@ "The bests choices at this time are:": "Le migliori scelte per ora sono :", "Scroll to the left": "Spostare a sinistra", "Scroll to the right": "Spostare a destra", - "polled user": "IT_votant", - "polled users": "IT_votants", - "Display the chart of the results": "IT_Afficher le graphique des résultats", - "Chart": "IT_Graphique" + "polled user": "votante", + "polled users": "votanti", + "Display the chart of the results": "Visualizzare il grafico dei risultati", + "Chart": "Grafico" }, "Comments": { "Comments of polled people": "Commenti dei partecipanti", @@ -255,41 +255,41 @@ "Archiving date:": "Archivio Data:" }, "Admin": { - "Back to administration": "IT_Retour à l'administration", - "Administration": "IT_Administration", - "Polls": "IT_Sondages", - "Migration": "IT_Migration", - "Purge": "IT_Purge", + "Back to administration": "Ritornare all'amministrazione", + "Administration": "Amministrazione", + "Polls": "Sondaggi", + "Migration": "Migrazione", + "Purge": "Depurazione", "Logs": "Log", "Installation": "Installazione", - "Poll ID": "ID sondaggio", + "Poll ID": "ID del sondaggio", "Format": "Formato", "Title": "Titolo", "Author": "Autore", "Email": "Email", - "Expiration date": "IT_Expiration", - "Votes": "voti", + "Expiration date": "Scadenza", + "Votes": "Voti", "Actions": "Azioni", "See the poll": "Vedere il sondaggio", "Change the poll": "Modificare il sondaggio", - "Deleted the poll": "IT_Supprimer le sondage", - "Summary": "IT_Résumé", - "Success": "IT_Réussite", - "Fail": "IT_Échèc", - "Nothing": "IT_Rien", - "Succeeded:": "IT_Réussit:", - "Failed:": "IT_Échoué:", - "Skipped:": "IT_Passé:", - "Pages:": "IT_Pages :", - "Purged:": "IT_Purgés :", + "Deleted the poll": "Cancellare il sondaggio", + "Summary": "Sommario", + "Success": "Successo", + "Fail": "Fallimento", + "Nothing": "Niente", + "Succeeded:": "Successo:", + "Failed:": "Fallito:", + "Skipped:": "Saltato:", + "Pages:": "Pagine:", + "Purged:": "Depurati:", "Confirm removal of the poll": "Confermare l'eliminazione del sondaggio ", "polls in the database at this time": "sondaggi presenti nel database attualmente", - "Purge the polls": "IT_Purger les sondages" + "Purge the polls": "Depurare i sondaggi" }, "FindPolls": { - "Here are your polls": "IT_Voici tes sondages", - "Send me my polls": "IT_Envoyer mes sondages", - "Polls sent": "IT_Sondages envoyés" + "Here are your polls": "Ecco i tuoi sondaggi", + "Send me my polls": "Inviare i miei sondaggi", + "Polls sent": "Sondaggi inviati" }, "Mail": { "Poll's participation: %s": "Partecipazione al sondaggio: %s", @@ -338,4 +338,4 @@ "MISSING_VALUES": "Valori mancanti", "CANT_CONNECT_TO_DATABASE": "Impossibile connettersi al database" } -} +} \ No newline at end of file From 3a4b6b79c8eaf1947f90e00d565911c922ee64fd Mon Sep 17 00:00:00 2001 From: Nikos Date: Sat, 31 Oct 2015 20:53:11 +0100 Subject: [PATCH 09/22] Traduzione italiana completata --- locale/it.json | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/locale/it.json b/locale/it.json index ee5cab7..272389e 100644 --- a/locale/it.json +++ b/locale/it.json @@ -204,10 +204,10 @@ "Required fields cannot be left blank.": "Riempire i campi obbligatori, segnati con *.", "Poll title": "Titolo del sondaggio", "Votes cannot be modified.": "No voto non può essere modificato", - "All voters can modify any vote": "Tutti i sondaggi possono cambiare tutti i voti", + "All voters can modify any vote": "Tutti i votanti possono cambiare tutti i voti", "Voters can modify their vote themselves": "I partecipanti possono modificare il loro voto in autonomia", - "To receive an email for each new vote": "Per ricevere un'email per ogni voto nuovo", - "To receive an email for each new comment": "Ricevi una e-mail ogni commento", + "To receive an email for each new vote": "Per ricevere un'email per ogni nuovo voto", + "To receive an email for each new comment": "Per ricevere una e-mail per ogni nuovo commento", "Only the poll maker can see the poll's results": "Solo il creatore sondaggio possono vedere i risultati", "Go to step 2": "Andare al punto 2" }, @@ -294,13 +294,13 @@ "Mail": { "Poll's participation: %s": "Partecipazione al sondaggio: %s", "Notification of poll: %s": "Notifica di sondaggio: %s", - "filled a vote.\nYou can find your poll at the link": "IT_vient de voter.\nVous pouvez retrouver votre sondage avec le lien suivant", - "updated a vote.\nYou can find your poll at the link": "IT_vient de mettre à jour un vote.\nVous pouvez retrouver votre sondage avec le lien suivant", - "wrote a comment.\nYou can find your poll at the link": "IT_vient de rédiger un commentaire.\nVous pouvez retrouver votre sondage avec le lien suivant", - "Someone just change your poll available at the following link %s.": "Qualcuno basta cambiare il vostro sondaggio disponibile al seguente link %1$s.", - "Someone just delete your poll %s.": "Qualcuno ha appena cancellare il tuo sondaggio \"%s\".", + "filled a vote.\nYou can find your poll at the link": "ha appena votato.\nPotete trovare il vostro sondaggio con il link seguente", + "updated a vote.\nYou can find your poll at the link": "ha appena aggiornato un voto.\nPotete trovare il vostro sondaggio con il link seguente", + "wrote a comment.\nYou can find your poll at the link": "ha appena inserito un commento.\nPotete trovare il vostro sondaggio con il link seguente", + "Someone just change your poll available at the following link %s.": "Qualcuno ha appena cambiato il vostro sondaggio disponibile al seguente link %1$s.", + "Someone just delete your poll %s.": "Qualcuno ha appena cancellato il vostro sondaggio \"%s\".", "Thanks for your trust.": "Grazie per la vostra fiducia.", - "FOOTER": "IT_« La route est longue, mais la voie est libre… »\nFramasoft ne vit que par vos dons (déductibles des impôts).\nMerci d'avance pour votre soutien http://soutenir.framasoft.org.", + "FOOTER": "La strada è lunga, ma la via è libera… »\nFramasoft vive solo grazie alle vostre donazioni (deducibili dalle imposte).\nGrazie in anticipo per il vostro sostegno http://soutenir.framasoft.org.", "[ADMINISTRATOR] New settings for your poll": "[AMMINISTRATORE] Modifica di configurazione del sondaggio", "You have changed the settings of your poll. \nYou can modify this poll with this link": "Avete modificato la configurazione del vostro sondaggio. \nPotete modificare questo sondaggio con le Link seguente", "This is the message you have to send to the people you want to poll. \nNow, you have to send this message to everyone you want to poll.": "Questo è il messaggio che deve essere inviato ai partecipanti. \nPotete ora inviare questo messaggio a tutte le persone a cui volete chiedere il voto.", @@ -313,29 +313,29 @@ "Error": { "Error!": "Errore!", "Enter a title": "È necessario inserire un titolo !", - "Something is going wrong...": "IT_Quelque chose ne va pas...", - "Something is wrong with the format": "IT_Quelque chose ne va pas avec le format", + "Something is going wrong...": "Qualcosa non è corretto...", + "Something is wrong with the format": "Qualche errore nel formato", "Enter an email address": "È necessario inserire un indirizzo e-mail!", "The address is not correct! You should enter a valid email address (like r.stallman@outlock.com) in order to receive the link to your poll.": "L'indirizzo inserito non è corretto ! È necessario un indirizzo e-mail valido (per esempio r.stallman@outlock.com) per ricevere il link del sondaggio.", - "No polls found": "IT_Aucun sondage n'a été trouvé", - "There is a problem with your choices": "IT_Il y a un problème avec vos choix", + "No polls found": "Nessun sondaggio trovato", + "There is a problem with your choices": "C'è un problema con la vostra scelta", "You haven't filled the first section of the poll creation.": "Non avete completato la prima pagina del sondaggio", - "Javascript is disabled on your browser. Its activation is required to create a poll.": "IT_Javascript est désactivé sur votre navigateur. Son activation est requise pour la création d'un sondage.", - "Cookies are disabled on your browser. Theirs activation is required to create a poll.": "IT_Les cookies sont désactivés sur votre navigateur. Leur activation est requise pour la création d'un sondage.", + "Javascript is disabled on your browser. Its activation is required to create a poll.": "Javascript è disattivato sul vostro browser. E' necessario attivarlo per creare un sondaggio.", + "Cookies are disabled on your browser. Theirs activation is required to create a poll.": "I cookies non sono permessi sul vostro browser. E' necessario permetterli per creare un sondaggio.", "This poll doesn't exist !": "Questo sondaggio non esiste più !", "Enter a name": "Non avete inserito il nome !", - "The name is invalid.": "IT_Le nom n'est pas valide.", + "The name is invalid.": "Le nome non è valido.", "The name you've chosen already exist in this poll!": "Il nome che avete scelto esiste già !", "Enter a name and a comment!": "Inserire un nome e un commento!", "Failed to insert the comment!": "Errore nell'inserimento del commento !", - "Framadate is not properly installed, please check the \"INSTALL\" to setup the database before continuing.": "IT_Framadate n'est pas installé correctement, lisez le fichier INSTALL pour configurer la base de données avant de continuer.", - "Failed to save poll": "IT_Echec de la sauvegarde du sondage", - "Update vote failed": "IT_Mise à jour du vote échoué", - "Adding vote failed": "IT_Ajout d'un vote échoué", - "Comment failed": "IT_Commentaire échoué", - "You can't create a poll with hidden results with the following edition option:": "IT_Vous ne pouvez pas créer de sondage avec résulats cachés avec les options d'éditions suivantes : ", - "Failed to delete column": "Impossibile eliminare colonna", + "Framadate is not properly installed, please check the \"INSTALL\" to setup the database before continuing.": "Framadate non è installato correttamente, leggete la cartella INSTALL per configurare il database prima di continuare.", + "Failed to save poll": "Errore nel salvataggio del sondaggio", + "Update vote failed": "Aggiornamento del voto fallito", + "Adding vote failed": "Aggiunta del voto fallita", + "Comment failed": "Commento fallito", + "You can't create a poll with hidden results with the following edition option:": "Non potete creare un sondaggio con i risultati nascosti con queste opzioni: : ", + "Failed to delete column": "Impossibile eliminare la colonna", "MISSING_VALUES": "Valori mancanti", "CANT_CONNECT_TO_DATABASE": "Impossibile connettersi al database" } -} \ No newline at end of file +} From e1221b5a9096bcbc655c2a2893e5be06a1b0a9c0 Mon Sep 17 00:00:00 2001 From: Antonin Date: Thu, 5 Nov 2015 21:37:51 +0100 Subject: [PATCH 10/22] It's better to also correct the date poll... --- tpl/part/vote_table_date.tpl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tpl/part/vote_table_date.tpl b/tpl/part/vote_table_date.tpl index 029e11f..f891f5e 100644 --- a/tpl/part/vote_table_date.tpl +++ b/tpl/part/vote_table_date.tpl @@ -145,7 +145,13 @@ {/foreach} - {if $active && !$expired && ($poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL') or $admin)} + {if $active && !$expired && + ( + $poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL') + or ($poll->editable == constant('Framadate\Editable::EDITABLE_BY_OWN') && $editedVoteUniqueId == $vote->uniqId) + or $admin + ) + } {__('Generic', 'Edit')} From 79b3cc2b43a652a6275490e4201b9dee5067147b Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Thu, 5 Nov 2015 22:20:13 +0100 Subject: [PATCH 11/22] Fixes #117 - Fix url rewriting example --- htaccess.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htaccess.txt b/htaccess.txt index e1495ff..5f74a57 100644 --- a/htaccess.txt +++ b/htaccess.txt @@ -6,9 +6,11 @@ RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d + RewriteRule . - [L] - RewriteRule ^([a-zA-Z0-9]{16})$ studs.php?poll=$1 + RewriteRule ^([a-zA-Z0-9]+)$ studs.php?poll=$1 [L] RewriteRule ^([a-zA-Z0-9]{16})/action/([a-zA-Z]+)/(.+)$ studs.php?poll=$1&$2=$3 - RewriteRule ^([a-zA-Z0-9]{16})/vote/([a-zA-Z0-9]{16})$ studs.php?poll=$1&vote_id=$2 + RewriteRule ^([a-zA-Z0-9]{16})/vote/([a-zA-Z0-9]{16})$ studs.php?poll=$1&vote=$2 RewriteRule ^([a-zA-Z0-9]{24})/admin$ adminstuds.php?poll=$1 + RewriteRule ^([a-zA-Z0-9]{24})/admin/vote/([a-zA-Z0-9]{16})$ adminstuds.php?poll=$1&vote=$2 \ No newline at end of file From 171d45938c2c9c497c5749db99a4766483929e35 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Thu, 5 Nov 2015 22:43:54 +0100 Subject: [PATCH 12/22] Move URL encore to Utils::getUrlSondage --- app/classes/Framadate/Utils.php | 3 +++ app/inc/smarty.php | 2 +- tpl/part/vote_table_classic.tpl | 2 +- tpl/part/vote_table_date.tpl | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/classes/Framadate/Utils.php b/app/classes/Framadate/Utils.php index 250528b..3565a70 100644 --- a/app/classes/Framadate/Utils.php +++ b/app/classes/Framadate/Utils.php @@ -104,6 +104,9 @@ class Utils { * @return string The poll's URL. */ public static function getUrlSondage($id, $admin = false, $vote_id = '', $action = null, $action_value = null) { + // URL-Encode $action_value + $action_value = $action_value == null ? null : urlencode($action_value); + if (URL_PROPRE) { if ($admin === true) { $url = self::get_server_name() . $id . '/admin'; diff --git a/app/inc/smarty.php b/app/inc/smarty.php index c265bf1..7dfb2a4 100644 --- a/app/inc/smarty.php +++ b/app/inc/smarty.php @@ -49,7 +49,7 @@ function smarty_function_poll_url($params, Smarty_Internal_Template $template) { $poll_id = filter_var($params['id'], FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => POLL_REGEX]]); $admin = (isset($params['admin']) && $params['admin']) ? true : false; $action = (isset($params['action']) && !empty($params['action'])) ? Utils::htmlEscape($params['action']) : false; - $action_value = (isset($params['action_value']) && !empty($params['action_value'])) ? Utils::htmlEscape($params['action_value']) : false; + $action_value = (isset($params['action_value']) && !empty($params['action_value'])) ? $params['action_value'] : false; $vote_unique_id = isset($params['vote_id']) ? filter_var($params['vote_id'], FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => POLL_REGEX]]) : ''; // If filter_var fails (i.e.: hack tentative), it will return false. At least no leak is possible from this. diff --git a/tpl/part/vote_table_classic.tpl b/tpl/part/vote_table_classic.tpl index cb01b08..20fe885 100644 --- a/tpl/part/vote_table_classic.tpl +++ b/tpl/part/vote_table_classic.tpl @@ -14,7 +14,7 @@ {foreach $slots as $id=>$slot} - {__('Generic', 'Remove')} diff --git a/tpl/part/vote_table_date.tpl b/tpl/part/vote_table_date.tpl index 029e11f..7bd6781 100644 --- a/tpl/part/vote_table_date.tpl +++ b/tpl/part/vote_table_date.tpl @@ -17,7 +17,7 @@ {foreach $slots as $slot} {foreach $slot->moments as $id=>$moment} - {__('Generic', 'Remove')} From 109e72bdc1abbadfd0645e3ee976af445c1d4019 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Thu, 5 Nov 2015 22:48:00 +0100 Subject: [PATCH 13/22] Tiens ta correction --- htaccess.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htaccess.txt b/htaccess.txt index 5f74a57..7bbc669 100644 --- a/htaccess.txt +++ b/htaccess.txt @@ -8,9 +8,9 @@ RewriteCond %{REQUEST_FILENAME} -d RewriteRule . - [L] - RewriteRule ^([a-zA-Z0-9]+)$ studs.php?poll=$1 [L] + RewriteRule ^([a-zA-Z0-9]{16})$ studs.php?poll=$1 [L] RewriteRule ^([a-zA-Z0-9]{16})/action/([a-zA-Z]+)/(.+)$ studs.php?poll=$1&$2=$3 RewriteRule ^([a-zA-Z0-9]{16})/vote/([a-zA-Z0-9]{16})$ studs.php?poll=$1&vote=$2 RewriteRule ^([a-zA-Z0-9]{24})/admin$ adminstuds.php?poll=$1 RewriteRule ^([a-zA-Z0-9]{24})/admin/vote/([a-zA-Z0-9]{16})$ adminstuds.php?poll=$1&vote=$2 - \ No newline at end of file + From c019cd08b4f24b7be33d7e61a7d2f944fe28a24c Mon Sep 17 00:00:00 2001 From: Olivier Perez Date: Fri, 6 Nov 2015 14:16:05 +0100 Subject: [PATCH 14/22] =?UTF-8?q?Mise=20=C3=A0=20jour=20du=20changelog=20p?= =?UTF-8?q?our=200.9.2=20et=200.9.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2588a99..403ad91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog de framadate +## Version 0.9.3 (Antonin - Olivier - Nikos) + - Fix : Traduction de textes en Italien + - Fix : Empêchement de la suppression de la dernière colonne + - Fix : Possiblité de supprimer des colonnes contenant des caractères spéciaux (par exemple "&") + - Fix : Correction de l'exemple d'URL rewriting (des efforts restent à faire) + - Amélioration : (Mode chacun son vote) Possiblité d'éditer son vote directement après un vote + - Amélioration : Message plus parlant lors de la création d'une colonne +## Version 0.9.2 (Olivier) + - Fix : Completion d'un manque de contrôle sur les ID ## Version 0.9.1 (JosephK - Olivier - Antonin - Michael - Paul) - Fix : Correction des lenteurs de défilement - Fix : Arrêt du défilement auto à gauche qu'on clique sur un choix From 4544dfc5de63617262a87aed064a0fe7320be22e Mon Sep 17 00:00:00 2001 From: Olivier Perez Date: Wed, 18 Nov 2015 17:45:39 +0100 Subject: [PATCH 15/22] URL rewriting: Add "_-" to regex for action names --- htaccess.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htaccess.txt b/htaccess.txt index 7bbc669..2627d9a 100644 --- a/htaccess.txt +++ b/htaccess.txt @@ -9,8 +9,8 @@ RewriteRule . - [L] RewriteRule ^([a-zA-Z0-9]{16})$ studs.php?poll=$1 [L] - RewriteRule ^([a-zA-Z0-9]{16})/action/([a-zA-Z]+)/(.+)$ studs.php?poll=$1&$2=$3 + RewriteRule ^([a-zA-Z0-9]{16})/action/([a-zA-Z_-]+)/(.+)$ studs.php?poll=$1&$2=$3 RewriteRule ^([a-zA-Z0-9]{16})/vote/([a-zA-Z0-9]{16})$ studs.php?poll=$1&vote=$2 RewriteRule ^([a-zA-Z0-9]{24})/admin$ adminstuds.php?poll=$1 RewriteRule ^([a-zA-Z0-9]{24})/admin/vote/([a-zA-Z0-9]{16})$ adminstuds.php?poll=$1&vote=$2 - + \ No newline at end of file From 36b79e539047803e124c9d142e6d979277efd63b Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Thu, 19 Nov 2015 08:19:10 +0100 Subject: [PATCH 16/22] URL rewriting: Add _- to regex for admin action names --- htaccess.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/htaccess.txt b/htaccess.txt index 2627d9a..a77c0f7 100644 --- a/htaccess.txt +++ b/htaccess.txt @@ -13,4 +13,5 @@ RewriteRule ^([a-zA-Z0-9]{16})/vote/([a-zA-Z0-9]{16})$ studs.php?poll=$1&vote=$2 RewriteRule ^([a-zA-Z0-9]{24})/admin$ adminstuds.php?poll=$1 RewriteRule ^([a-zA-Z0-9]{24})/admin/vote/([a-zA-Z0-9]{16})$ adminstuds.php?poll=$1&vote=$2 + RewriteRule ^([a-zA-Z0-9]{24})/admin/action/([a-zA-Z_-]+)/(.+)$ adminstuds.php?poll=$1&$2=$3 \ No newline at end of file From 18f488c4f6596e3f8d11b0afb605afb94f296d44 Mon Sep 17 00:00:00 2001 From: JosephK Date: Fri, 20 Nov 2015 09:12:10 +0100 Subject: [PATCH 17/22] Only one day needed to submit --- js/app/date_poll.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/js/app/date_poll.js b/js/app/date_poll.js index d63684d..6e894d2 100644 --- a/js/app/date_poll.js +++ b/js/app/date_poll.js @@ -23,24 +23,18 @@ $(document).ready(function () { var $selected_days = $('#selected-days'); var $removeaday_and_copyhours = $('#remove-a-day, #copyhours'); - // at least 1 day and 1 hour filled and you can submit + // at least 1 day filled and you can submit var submitDaysAvalaible = function () { var nb_filled_days = 0; - var nb_filled_hours = 0; $selected_days.find('fieldset legend input').each(function () { if ($(this).val() != '') { nb_filled_days++; } }); - $selected_days.find('.hours').each(function () { - if ($(this).val() != '') { - nb_filled_hours++; - } - }); - if (nb_filled_days >= 1 && nb_filled_hours >= 1) { + if (nb_filled_days >= 1) { $('button[name="choixheures"]').removeClass('disabled'); return true; } else { From 4f908958821aa62ff8f9f9ea3499881d0e5b42af Mon Sep 17 00:00:00 2001 From: Nikos Date: Sat, 21 Nov 2015 18:22:20 +0100 Subject: [PATCH 18/22] qualche correzione --- locale/it.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/it.json b/locale/it.json index 87854d0..70fc8a4 100644 --- a/locale/it.json +++ b/locale/it.json @@ -203,12 +203,12 @@ "You are in the poll creation section.": "Avete scelto di creare un nuovo sondaggio.", "Required fields cannot be left blank.": "Riempire i campi obbligatori, segnati con *.", "Poll title": "Titolo del sondaggio", - "Votes cannot be modified.": "No voto non può essere modificato", + "Votes cannot be modified.": "Nessun voto può essere modificato", "All voters can modify any vote": "Tutti i sondaggi possono cambiare tutti i voti", "Voters can modify their vote themselves": "I partecipanti possono modificare il loro voto in autonomia", - "To receive an email for each new vote": "Per ricevere un'email per ogni voto nuovo", - "To receive an email for each new comment": "Ricevi una e-mail ogni commento", - "Only the poll maker can see the poll's results": "Solo il creatore sondaggio possono vedere i risultati", + "To receive an email for each new vote": "Per ricevere un'email per ogni nuovo voto", + "To receive an email for each new comment": "Ricevi un'e-mail per ogni nuovo commento", + "Only the poll maker can see the poll's results": "Solo il creatore sondaggio può vedere i risultati", "Go to step 2": "Andare al punto 2" }, "Step 2": { From f588a3945e1f42f6905bba4616cd4f1380262083 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Mon, 23 Nov 2015 16:30:29 +0100 Subject: [PATCH 19/22] Fixes #109 - Keep url encoding while URLRewriting --- htaccess.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htaccess.txt b/htaccess.txt index a77c0f7..a59fcd7 100644 --- a/htaccess.txt +++ b/htaccess.txt @@ -9,9 +9,9 @@ RewriteRule . - [L] RewriteRule ^([a-zA-Z0-9]{16})$ studs.php?poll=$1 [L] - RewriteRule ^([a-zA-Z0-9]{16})/action/([a-zA-Z_-]+)/(.+)$ studs.php?poll=$1&$2=$3 + RewriteRule ^([a-zA-Z0-9]{16})/action/([a-zA-Z_-]+)/(.+)$ studs.php?poll=$1&$2=$3 [B] RewriteRule ^([a-zA-Z0-9]{16})/vote/([a-zA-Z0-9]{16})$ studs.php?poll=$1&vote=$2 RewriteRule ^([a-zA-Z0-9]{24})/admin$ adminstuds.php?poll=$1 RewriteRule ^([a-zA-Z0-9]{24})/admin/vote/([a-zA-Z0-9]{16})$ adminstuds.php?poll=$1&vote=$2 - RewriteRule ^([a-zA-Z0-9]{24})/admin/action/([a-zA-Z_-]+)/(.+)$ adminstuds.php?poll=$1&$2=$3 + RewriteRule ^([a-zA-Z0-9]{24})/admin/action/([a-zA-Z_-]+)/(.+)$ adminstuds.php?poll=$1&$2=$3 [B] \ No newline at end of file From 9b4b72e3d465058bc1a2116d376473aaf6fe1bed Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Wed, 25 Nov 2015 01:35:10 +0100 Subject: [PATCH 20/22] Fix title of button to add column --- tpl/part/vote_table_classic.tpl | 2 +- tpl/part/vote_table_date.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tpl/part/vote_table_classic.tpl b/tpl/part/vote_table_classic.tpl index 4330968..a00af34 100644 --- a/tpl/part/vote_table_classic.tpl +++ b/tpl/part/vote_table_classic.tpl @@ -22,7 +22,7 @@ {/foreach} + class="btn btn-link btn-sm" title="{__('adminstuds', 'Add a column')}"> {__('Poll results', 'Add a column')} diff --git a/tpl/part/vote_table_date.tpl b/tpl/part/vote_table_date.tpl index c5bd54e..4ba4347 100644 --- a/tpl/part/vote_table_date.tpl +++ b/tpl/part/vote_table_date.tpl @@ -28,7 +28,7 @@ {/foreach} + class="btn btn-link btn-sm" title="{__('adminstuds', 'Add a column')}"> {__('Poll results', 'Add a column')} From 5d4958e1f4ffe74ff3141254c88075c46d130070 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Mon, 30 Nov 2015 20:26:23 +0100 Subject: [PATCH 21/22] Encode action values in base64 instead of url_encode (because of UrlRewrite) --- adminstuds.php | 2 ++ app/classes/Framadate/Utils.php | 26 +++++++++++++++++++++----- htaccess.txt | 4 ++-- tpl/part/vote_table_classic.tpl | 2 +- tpl/part/vote_table_date.tpl | 2 +- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/adminstuds.php b/adminstuds.php index 29f3d27..b47ea03 100644 --- a/adminstuds.php +++ b/adminstuds.php @@ -246,6 +246,7 @@ if (!empty($_POST['save'])) { // Save edition of an old vote if (!empty($_GET['delete_vote'])) { $vote_id = filter_input(INPUT_GET, 'delete_vote', FILTER_VALIDATE_INT); + $vote_id = Utils::base64url_decode($vote_id); if ($adminPollService->deleteVote($poll_id, $vote_id)) { $message = new Message('success', __('adminstuds', 'Vote deleted')); } else { @@ -361,6 +362,7 @@ if (isset($_POST['confirm_delete_poll'])) { if (!empty($_GET['delete_column'])) { $column = filter_input(INPUT_GET, 'delete_column', FILTER_DEFAULT); + $column = Utils::base64url_decode($column); if ($poll->format === 'D') { $ex = explode('@', $column); diff --git a/app/classes/Framadate/Utils.php b/app/classes/Framadate/Utils.php index 3565a70..b340bad 100644 --- a/app/classes/Framadate/Utils.php +++ b/app/classes/Framadate/Utils.php @@ -105,7 +105,7 @@ class Utils { */ public static function getUrlSondage($id, $admin = false, $vote_id = '', $action = null, $action_value = null) { // URL-Encode $action_value - $action_value = $action_value == null ? null : urlencode($action_value); + $action_value = $action_value == null ? null : Utils::base64url_encode($action_value); if (URL_PROPRE) { if ($admin === true) { @@ -115,8 +115,12 @@ class Utils { } if ($vote_id != '') { $url .= '/vote/' . $vote_id . "#edit"; - } elseif ($action != null && $action_value != null) { - $url .= '/action/' . $action . '/' . $action_value; + } elseif ($action != null) { + if ($action_value != null) { + $url .= '/action/' . $action . '/' . $action_value; + } else { + $url .= '/action/' . $action; + } } } else { if ($admin === true) { @@ -126,8 +130,12 @@ class Utils { } if ($vote_id != '') { $url .= '&vote=' . $vote_id . "#edit"; - } elseif ($action != null && $action_value != null) { - $url .= '&' . $action . "=" . $action_value; + } elseif ($action != null) { + if ($action_value != null) { + $url .= '&' . $action . "=" . $action_value; + } else { + $url .= '&' . $action . "="; + } } } @@ -200,4 +208,12 @@ class Utils { public static function fromPostOrDefault($postKey, $default = '') { return !empty($_POST[$postKey]) ? Utils::htmlEscape($_POST[$postKey]) : $default; } + + public static function base64url_encode($input) { + return rtrim(strtr(base64_encode($input), '+/', '-_'), '='); + } + + public static function base64url_decode($input) { + return base64_decode(str_pad(strtr($input, '-_', '+/'), strlen($input) % 4, '=', STR_PAD_RIGHT)); + } } diff --git a/htaccess.txt b/htaccess.txt index a59fcd7..640cb13 100644 --- a/htaccess.txt +++ b/htaccess.txt @@ -9,9 +9,9 @@ RewriteRule . - [L] RewriteRule ^([a-zA-Z0-9]{16})$ studs.php?poll=$1 [L] - RewriteRule ^([a-zA-Z0-9]{16})/action/([a-zA-Z_-]+)/(.+)$ studs.php?poll=$1&$2=$3 [B] + RewriteRule ^([a-zA-Z0-9]{16})/action/([a-zA-Z_-]+)/(.+)$ studs.php?poll=$1&$2=$3 RewriteRule ^([a-zA-Z0-9]{16})/vote/([a-zA-Z0-9]{16})$ studs.php?poll=$1&vote=$2 RewriteRule ^([a-zA-Z0-9]{24})/admin$ adminstuds.php?poll=$1 RewriteRule ^([a-zA-Z0-9]{24})/admin/vote/([a-zA-Z0-9]{16})$ adminstuds.php?poll=$1&vote=$2 - RewriteRule ^([a-zA-Z0-9]{24})/admin/action/([a-zA-Z_-]+)/(.+)$ adminstuds.php?poll=$1&$2=$3 [B] + RewriteRule ^([a-zA-Z0-9]{24})/admin/action/([a-zA-Z_-]+)(/(.+))?$ adminstuds.php?poll=$1&$2=$4 \ No newline at end of file diff --git a/tpl/part/vote_table_classic.tpl b/tpl/part/vote_table_classic.tpl index a00af34..fa496ef 100644 --- a/tpl/part/vote_table_classic.tpl +++ b/tpl/part/vote_table_classic.tpl @@ -21,7 +21,7 @@ {/foreach} - {__('Poll results', 'Add a column')} diff --git a/tpl/part/vote_table_date.tpl b/tpl/part/vote_table_date.tpl index 4ba4347..2afb20b 100644 --- a/tpl/part/vote_table_date.tpl +++ b/tpl/part/vote_table_date.tpl @@ -27,7 +27,7 @@ {/foreach} {/foreach} - {__('Poll results', 'Add a column')} From 5750a361723be21ebe2ac76c6285a956049907f9 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Mon, 30 Nov 2015 20:38:53 +0100 Subject: [PATCH 22/22] Rename add_slot by add_column --- adminstuds.php | 6 +++--- app/classes/Framadate/Services/AdminPollService.php | 4 ++-- tpl/{add_slot.tpl => add_column.tpl} | 2 +- tpl/part/vote_table_classic.tpl | 2 +- tpl/part/vote_table_date.tpl | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) rename tpl/{add_slot.tpl => add_column.tpl} (93%) diff --git a/adminstuds.php b/adminstuds.php index b47ea03..b9497dd 100644 --- a/adminstuds.php +++ b/adminstuds.php @@ -387,15 +387,15 @@ if (!empty($_GET['delete_column'])) { // Add a slot // ------------------------------- -if (isset($_GET['add_slot'])) { +if (isset($_GET['add_column'])) { $smarty->assign('poll_id', $poll_id); $smarty->assign('admin_poll_id', $admin_poll_id); $smarty->assign('format', $poll->format); $smarty->assign('title', __('Generic', 'Poll') . ' - ' . $poll->title); - $smarty->display('add_slot.tpl'); + $smarty->display('add_column.tpl'); exit; } -if (isset($_POST['confirm_add_slot'])) { +if (isset($_POST['confirm_add_column'])) { try { if ($poll->format === 'D') { $newdate = strip_tags($_POST['newdate']); diff --git a/app/classes/Framadate/Services/AdminPollService.php b/app/classes/Framadate/Services/AdminPollService.php index de63509..500e528 100644 --- a/app/classes/Framadate/Services/AdminPollService.php +++ b/app/classes/Framadate/Services/AdminPollService.php @@ -200,7 +200,7 @@ class AdminPollService { * @throws MomentAlreadyExistsException When the moment to add already exists in database */ public function addDateSlot($poll_id, $datetime, $new_moment) { - $this->logService->log('ADD_SLOT', 'id:' . $poll_id . ', datetime:' . $datetime . ', moment:' . $new_moment); + $this->logService->log('ADD_COLUMN', 'id:' . $poll_id . ', datetime:' . $datetime . ', moment:' . $new_moment); $slots = $this->slotRepository->listByPollId($poll_id); $result = $this->findInsertPosition($slots, $datetime); @@ -243,7 +243,7 @@ class AdminPollService { * @throws MomentAlreadyExistsException When the moment to add already exists in database */ public function addClassicSlot($poll_id, $title) { - $this->logService->log('ADD_SLOT', 'id:' . $poll_id . ', title:' . $title); + $this->logService->log('ADD_COLUMN', 'id:' . $poll_id . ', title:' . $title); $slots = $this->slotRepository->listByPollId($poll_id); diff --git a/tpl/add_slot.tpl b/tpl/add_column.tpl similarity index 93% rename from tpl/add_slot.tpl rename to tpl/add_column.tpl index 3ef5e5e..8fa0c55 100644 --- a/tpl/add_slot.tpl +++ b/tpl/add_column.tpl @@ -32,7 +32,7 @@ {/if}
- +
diff --git a/tpl/part/vote_table_classic.tpl b/tpl/part/vote_table_classic.tpl index fa496ef..c321cc0 100644 --- a/tpl/part/vote_table_classic.tpl +++ b/tpl/part/vote_table_classic.tpl @@ -21,7 +21,7 @@ {/foreach} - {__('Poll results', 'Add a column')} diff --git a/tpl/part/vote_table_date.tpl b/tpl/part/vote_table_date.tpl index 2afb20b..03ad351 100644 --- a/tpl/part/vote_table_date.tpl +++ b/tpl/part/vote_table_date.tpl @@ -27,7 +27,7 @@ {/foreach} {/foreach} - {__('Poll results', 'Add a column')}