From 2bfca20c1a73930d2169eac268601cd35b09a5f0 Mon Sep 17 00:00:00 2001
From: Simon Leblanc <contact@leblanc-simon.eu>
Date: Sun, 22 May 2011 02:39:49 +0200
Subject: [PATCH] support line break in comment (poll and user)

---
 adminstuds.php | 6 +++---
 studs.php      | 4 ++--
 style.css      | 8 ++++++++
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/adminstuds.php b/adminstuds.php
index d63b673d..ac921b0d 100644
--- a/adminstuds.php
+++ b/adminstuds.php
@@ -224,7 +224,7 @@ if (isset($_POST["ajoutsujet"]) || isset($_POST["ajoutsujet_x"])) {
     echo '<br><br>'. _("Add a start hour (optional)") .' : <br><br>'."\n";
     echo '<select name="nouvelleheuredebut"> '."\n";
     echo '<OPTION VALUE="vide"></OPTION>'."\n";
-    for ($i = 7; $i < 22; $i++) {
+    for ($i = 0; $i < 24; $i++) {
       echo '<OPTION VALUE="'.$i.'">'.$i.' H</OPTION>'."\n";
     }
     echo '</SELECT>'."\n";
@@ -238,7 +238,7 @@ if (isset($_POST["ajoutsujet"]) || isset($_POST["ajoutsujet_x"])) {
     echo '<br><br>'. _("Add a end hour (optional)") .' : <br><br>'."\n";
     echo '<select name="nouvelleheurefin"> '."\n";
     echo '<OPTION VALUE="vide"></OPTION>'."\n";
-    for ($i = 7; $i < 22; $i++) {
+    for ($i = 0; $i < 24; $i++) {
       echo '<OPTION VALUE="'.$i.'">'.$i.' H</OPTION>'."\n";
     }
     echo '</SELECT>'."\n";
@@ -463,7 +463,7 @@ if (isset($_POST["ajoutercolonne_x"]) && ($dsondage->format == "D" || $dsondage-
       }
     }
     
-    if($_POST["nouvelleheuredebut"] == "vide" || ($_POST["nouvelleheuredebut"] && $_POST["nouvelleheurefin"] && (($_POST["nouvelleheuredebut"] < $_POST["nouvelleheurefin"]) || (($_POST["nouvelleheuredebut"] == $_POST["nouvelleheurefin"]) && ($_POST["nouvelleminutedebut"] < $_POST["nouvelleminutefin"]))))) {
+    if($_POST["nouvelleheuredebut"] == "vide" || (isset($_POST["nouvelleheuredebut"]) && isset($_POST["nouvelleheurefin"]) && (($_POST["nouvelleheuredebut"] < $_POST["nouvelleheurefin"]) || (($_POST["nouvelleheuredebut"] == $_POST["nouvelleheurefin"]) && ($_POST["nouvelleminutedebut"] < $_POST["nouvelleminutefin"]))))) {
       $erreur_ajout_date = false;
     } else {
       $erreur_ajout_date = "yes";
diff --git a/studs.php b/studs.php
index 43badfec..3090bc40 100644
--- a/studs.php
+++ b/studs.php
@@ -244,7 +244,7 @@ echo _("Initiator of the poll") .' : '.$dsondage->nom_admin.'<br><br>'."\n";
 if ($dsondage->commentaires) {
   echo _("Comments") .' :<br>'."\n";
   $commentaires = $dsondage->commentaires;
-  $commentaires=str_replace("\\","",$commentaires);
+  $commentaires=nl2br(str_replace("\\","",$commentaires));
   echo $commentaires;
   echo '<br>'."\n";
 }
@@ -621,7 +621,7 @@ $comment_user=$connect->Execute($sql, array($numsondage));
 if ($comment_user->RecordCount() != 0) {
   print "<br><b>" . _("Comments of polled people") . " :</b><br>\n";
   while($dcomment = $comment_user->FetchNextObject(false)) {
-    print $dcomment->usercomment . ' : ' . $dcomment->comment . '<br />';
+    print '<div class="comment"><span class="usercomment">'.$dcomment->usercomment. ' :</span> <span class="comment">' . nl2br($dcomment->comment) . '</span></div>';
   }
 }
 
diff --git a/style.css b/style.css
index e7fe05d1..8d87f4d2 100644
--- a/style.css
+++ b/style.css
@@ -373,6 +373,14 @@ p.affichageresultats{
 	font-size:13px;
 }
 
+div.comment{
+	width:100%;
+}
+
+div.comment span.usercomment{
+	font-weight:bold;
+}
+
 a.affichageexport{
 	text-align: center;
 	font-family:arial;
-- 
GitLab