diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-04-30 17:13:08 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-04-30 17:13:08 +0000 |
commit | fead09a8de391e2419bdac150a8b63c0228d16a2 (patch) | |
tree | 44b7b853340e8b67ad366674e98339d394700607 /modules/comment | |
parent | c8d16d76f9ca0aa760435388a84482ec29258639 (diff) | |
download | brdo-fead09a8de391e2419bdac150a8b63c0228d16a2.tar.gz brdo-fead09a8de391e2419bdac150a8b63c0228d16a2.tar.bz2 |
Welp. Large commit ahead.
CHANGES:
- Added "read" and "write" permissions into drupal but removed
it again because - when finished after 3 hours of work - it
was considered nothing but added complexity that didn't buy
us anything. :I
(I'll explain this in detail on the mailing list, I guess.)
- Added a very simple help.module to group all available
documentation on a single page.
- Fixed bug in node_control(), book.module: UnConeD forgot to
global $user when updating the combobox code.
- Removed static wishlist.module: in future, the wishlist can
be maintained as a page in our collaborative book.
- Revised most of settings.module: tidied up the code and the
descriptions to accompany the settings and introduced a new
"default maximum number of nodes to display on the main page"
variable.
- Revised most of comment.module: the administration interface
looks better now, integrated node permissions, and -finally-
made it possible to delete comments.
- Polished on:
+ account.module
+ structure.module
+ locale.module
+ module.module
+ forum.module
- Form-ified:
+ account.php
+ account.module
+ setting.module
+ cvs.module
+ submit.php
+ comment.module
+ forum.module
+ book.module
+ page.module
+ locale.module
- Updated CHANGELOG
INFO:
- Designed a "generic tracker system with optional backends"
on paper. The idea is to allow registered users to hot-list
certain topics, individual nodes or threads (comments) and
to "plug-in" output backends like - for instance - an e-mail
digest. The design requires "intelligent blocks" though.
TODO:
- I want to tidy up the headline.module and backend.class as
well as merge in headlineRSS10.module. Julian spent quite
some time working on headline.module but I'm not sure what
he changed and whether he'd contribute it back?
Diffstat (limited to 'modules/comment')
-rw-r--r-- | modules/comment/comment.module | 73 |
1 files changed, 18 insertions, 55 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module index cee88f998..5c2f9005f 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -15,90 +15,53 @@ function comment_find($keys) { function comment_edit($id) { $result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.cid = '$id'"); - $comment = db_fetch_object($result); - $output .= "<FORM ACTION=\"admin.php?mod=comment&op=save&id=$id\" METHOD=\"post\">\n"; - - $output .= "<B>Author:</B><BR>\n"; - $output .= format_username($comment->userid) ."<P>\n"; - - $output .= "<B>Subject:</B><BR>\n"; - $output .= "<INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" VALUE=\"". check_textfield($comment->subject) ."\"><P>\n"; + $form .= form_item(t("Author"), format_username($comment->userid)); + $form .= form_textfield(t("Subject"), "subject", $comment->subject, 50, 128); + $form .= form_textarea(t("Comment"), "comment", $comment->comment, 50, 10); + $form .= form_submit("Save comment"); - $output .= "<B>Comment:</B><BR>\n"; - $output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"comment\">". check_textarea($comment->comment) ."</TEXTAREA><P>\n"; - - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save comment\">\n"; - $output .= "</FORM>\n"; - - print $output; + return form("admin.php?mod=comment&id=$id", $form); } -function comment_save($id, $subject, $comment) { - db_query("UPDATE comments SET subject = '$subject', comment = '$comment' WHERE cid = '$id'"); - watchdog("message", "comment: modified '$subject'"); +function comment_save($id, $edit) { + db_query("UPDATE comments SET subject = '". check_input($edit[subject]) ."', comment = '". check_input($edit[comment]) ."' WHERE cid = '$id'"); + watchdog("message", "comment: modified '$edit[subject]'"); } -function comment_display($order = "date") { - // Initialize variables: - $fields = array("author" => "author", "date" => "timestamp DESC", "subject" => "subject"); - - // Perform SQL query: - $result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON u.id = c.author ORDER BY c.$fields[$order] LIMIT 50"); +function comment_display() { + $result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON u.id = c.author ORDER BY timestamp DESC LIMIT 50"); - // Display comments: $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; - $output .= " <TR>\n"; - $output .= " <TH ALIGN=\"right\" COLSPAN=\"3\">\n"; - $output .= " <FORM ACTION=\"admin.php?mod=comment\" METHOD=\"post\">\n"; - $output .= " <SELECT NAME=\"order\">\n"; - foreach ($fields as $key=>$value) { - $output .= " <OPTION VALUE=\"$key\"". ($key == $order ? " SELECTED" : "") .">Sort by $key</OPTION>\n"; - } - $output .= " </SELECT>\n"; - $output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Update\">\n"; - $output .= " </FORM>\n"; - $output .= " </TH>\n"; - $output .= " </TR>\n"; - - $output .= " <TR>\n"; - $output .= " <TH>subject</TH>\n"; - $output .= " <TH>author</TH>\n"; - $output .= " <TH>operations</TH>\n"; - $output .= " </TR>\n"; - + $output .= " <TR><TH>subject</TH><TH>author</TH><TH>date</TH><TH COLSPAN=\"2\">operations</TH></TR>\n"; while ($comment = db_fetch_object($result)) { - $output .= " <TR><TD><A HREF=\"node.php?id=$comment->lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A></TD><TD>". format_username($comment->userid) ."</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=comment&op=edit&id=$comment->cid\">edit</A></TD></TR>\n"; + $output .= " <TR><TD><A HREF=\"node.php?id=$comment->lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A></TD><TD>". format_username($comment->userid) ."</TD><TD>". format_date($comment->timestamp, "small") ."</TD><TD><A HREF=\"admin.php?mod=comment&op=edit&id=$comment->cid\">edit comment</A></TD><TD><A HREF=\"admin.php?mod=comment&op=delete&id=$comment->cid\">delete comment</A></TD></TR>\n"; } - $output .= "</TABLE>\n"; - print $output; + return $output; } function comment_admin() { - global $op, $id, $mod, $keys, $subject, $comment, $order; + global $op, $id, $edit, $mod, $keys, $order; print "<SMALL><A HREF=\"admin.php?mod=comment\">overview</A> | <A HREF=\"admin.php?mod=comment&op=search\">search comment</A></SMALL><HR>\n"; switch ($op) { case "edit": - comment_edit($id); + print comment_edit($id); break; case "search": print search_form($keys); print search_data($keys, $mod); break; case "Save comment": - comment_save(check_input($id), check_input($subject), check_input($comment)); - comment_display(); - break; - case "Update": - comment_display(check_input($order)); + print status(comment_save(check_input($id), $edit)); + print comment_display(); break; default: - comment_display(); + print comment_display(); } } |