Re: Commas in draw_table_display

46 views
Skip to first unread message

Klaas van Schelven

unread,
Jan 20, 2010, 9:46:26 PM1/20/10
to Tom Lake, Giles Robertson, tabbie...@googlegroups.com, Anthony Lieu
Tom,

Always happy to hear people are using Tabbie.
I try to not get myself too involved anymore (especially on vacation as I am now).

Giles, do you think you could evaluate this and merge it in? Thanks!

regards,
Klaas

On Sun, Jan 17, 2010 at 6:22 PM, Tom Lake <tsws...@sucs.org> wrote:
Hi Klaas,

Here's a small patch for draw_table_display.php
It fixes a problem I had with commas being displayed after all adjudicator names, even if they were the last adjudicator in the list.
The patch is based off of SVN revision 394.

I'm not sure if there's a proper way to submit patches to the project, the development email list seems pretty dead. If there is, please let me know.

Thanks,

Tom Lake


Index: draw_table_display.php
===================================================================
--- draw_table_display.php      (revision 394)
+++ draw_table_display.php      (working copy)
@@ -85,16 +85,28 @@
                       $db_result = mysql_query("SELECT * FROM `adjud_round_$roundno` WHERE `debate_id` = $debate_id AND `status` = CONVERT ( _utf8 'panelist' USING latin1)");
                       if(mysql_num_rows($db_result)>0){
                               echo ("<div class='panelist'>");
+                               $first=1;
                               while($row=mysql_fetch_assoc($db_result)) {
-                                       echo(adjudicator_name($row["adjud_id"]) . ", ");
+                                       if ($first==1) {
+                                               echo adjudicator_name($row["adjud_id"]);
+                                       }else {
+                                               echo ", " . adjudicator_name($row["adjud_id"]);
+                                       }
+                                       $first=0;
                               }
                               echo ("</div>");
                       }
                       $db_result = mysql_query("SELECT * FROM `adjud_round_$roundno` WHERE `debate_id` = $debate_id AND `status` = CONVERT ( _utf8 'trainee' USING latin1)");
                       if(mysql_num_rows($db_result)>0){
                               echo ("<div class='trainee'>");
+                               $first=1;
                               while($row=mysql_fetch_assoc($db_result)) {
-                                       echo(adjudicator_name($row["adjud_id"]) . " (t), ");
+                                       if ($first==1) {
+                                               echo adjudicator_name($row["adjud_id"]) . " (t)";
+                                       }else {
+                                               echo ", " . adjudicator_name($row["adjud_id"]). " (t)";
+                                       }
+                                       $first=0;
                               }
                               echo ("</div>");
                       }
@@ -106,4 +118,4 @@
               Created with Tabbie, see <a href="http://smoothtournament.com">http://smoothtournament.com</a> and <a href="http://tabbie.wikidot.com">http://tabbie.wikidot.com</a>.
       </div><!-- END class footer-->
 </body>
-</html>
\ No newline at end of file
+</html>




--
www.legalsense.nl
06 811 599 10
Skype: klaasvanschelven
Reply all
Reply to author
Forward
0 new messages