|
From: mdw c. <myd...@li...> - 2002-02-21 10:15:15
|
MyDynaWeb CVS committal
Author : sukria
Project : mydynaweb
Module : htdocs
Dir : mydynaweb/htdocs
Modified Files:
comment.php
Log Message:
Comments update
The navbar allows user to sort messages by oldest / newest publication.
===================================================================
RCS file: /cvsroot/mydynaweb/mydynaweb/htdocs/comment.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- comment.php 20 Feb 2002 22:06:32 -0000 1.20
+++ comment.php 21 Feb 2002 10:14:43 -0000 1.21
@@ -40,7 +40,7 @@
// the comments related to that piece of news
// Step 1 : init stuff
-$msg_infos = read_messages($DBH, $news);
+$msg_infos = read_messages($DBH, $news, $orderby);
$get_message = $msg_infos[0];
$get_parents = $msg_infos[1];
$get_children = $msg_infos[2];
@@ -71,30 +71,31 @@
<hr>
<table bgcolor='#eeeeee' align='center' width='100%'>
<tr>
- <td>
+ <td align='center'>
+ <font size='-1'>
<form action='add_comment.php'>
<input type='hidden' name='num_news' value='$news'>
<input type='submit' value='".translate("NEW_THREAD",$DBH)."'>
+ </font>
</form>
</td>
- <td>
+</tr>
+<tr>
+ <td align='center'>
<form action='comment.php'>
+ <font size='-1'>
<input type='hidden' name='news' value='$news'>
- ".translate("THRESHOLD", $DBH)."
<select name='threshold'>
- <option value='-1'>".translate("NONE", $DBH)."</option>
+ <option value='-1'>".translate("SHOW_ALL_MESSAGES", $DBH)."</option>
<option value='0' selected>".translate("ONLY_THREADS", $DBH)."</option>
- <option>1</option>
- <option>2</option>
- <option>3</option>
- <option>4</option>
- <option>5</option>
- <option>10</option>
- <option>15</option>
- <option>20</option>
</select>
+ <select name='orderby'>
+ <option value='desc'>".translate("NEWEST_FIRST", $DBH)."</option>
+ <option value=''>".translate("OLDEST_FIRST", $DBH)."</option>
+ </select>
<input type='submit' value='OK'>
+ </font>
</form>
</td>
@@ -157,7 +158,8 @@
// a new thread
if ($level == 0) {
- $HTML .= "<tr><td>" . get_hash_template($template["thread"], $get_message[$num_cmt]) . "</td></tr>";
+ $HTML .= "<tr><td><p> </p></td></tr>
+ <tr><td>" . get_hash_template($template["thread"], $get_message[$num_cmt]) . "</td></tr>";
}
// a comment fully displayed (under threshold)
@@ -189,7 +191,7 @@
for instance
$message[12][TITLE] send me the title of the #12 comment
*/
-function read_messages($dbh, $num_news)
+function read_messages($dbh, $num_news, $orderby)
{
// the hashtable with the info of the messages
$get_message = Array();
@@ -200,7 +202,7 @@
$sql = "select num_cmt, title, content, user_name, user_mail, date_ins, pere, _num_news
from comments
where _num_news = $num_news
- order by num_cmt";
+ order by num_cmt $orderby";
$rqt = new query($dbh);
$rqt->query($dbh, $sql) or send_sql_error($PHP_SELF, $sql, $rqt->error());
|