summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorLoui Chang <louipc.ist@gmail.com>2009-01-05 21:59:59 +0100
committerLoui Chang <louipc.ist@gmail.com>2009-01-05 21:59:59 +0100
commit36b44f371bd240fe448d7a22f7295581c9b35633 (patch)
tree7751f75b4cfa54913fcbe52852a2394dd4a1c029 /web
parent6de9b376d8885e93e6b3b638369b8107189e0ecd (diff)
downloadaur-36b44f371bd240fe448d7a22f7295581c9b35633.tar.gz
aur-36b44f371bd240fe448d7a22f7295581c9b35633.tar.xz
Move package comments to a template.
Change layout in the process. Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Diffstat (limited to 'web')
-rw-r--r--web/lib/pkgfuncs.inc69
-rw-r--r--web/template/pkg_comments.php38
2 files changed, 49 insertions, 58 deletions
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc
index 9535f183..b6e93c5f 100644
--- a/web/lib/pkgfuncs.inc
+++ b/web/lib/pkgfuncs.inc
@@ -524,71 +524,24 @@ function package_details($id=0, $SID="") {
}
echo " </form>\n";
+ echo "<br />\n";
+
+ # Add Comments
+ echo "<form action='pkgedit.php' method='post'>\n";
+ echo "<input type='hidden' name='ID' value='".$row["ID"]."'>\n";
+ echo "<input type='submit' class='button' name='add_Comment' value=\"";
+ echo __("Add Comment")."\">\n";
+ echo "</form>\n";
echo " </div>\n";
echo "</div>\n";
- echo "\n<br />\n\n";
+ echo "\n<br />";
}
- # Comments
- #
- echo "<div class=\"pgbox\">\n";
- echo " <div class=\"pgboxtitle\"><span class=\"f3\">".__("Comments")."</span></div>\n";
- echo " <div class=\"pgboxbody-comment\">\n";
- echo " <table width='100%'>\n";
- if (isset($_COOKIE['AURSID'])) {
- echo "<tr><td>";
- echo " <form action='pkgedit.php' method='post'>\n";
- echo " <input type='hidden' name='ID' value='".$row["ID"]."'>\n";
- echo " <input type='submit' class='button' name='add_Comment' value=\"";
- echo __("Add Comment")."\">\n";
- echo " </form>\n";
- echo "</tr></td>";
- //echo "<br />\n";
- }
+ # Print Comments
$comments = package_comments($row["ID"]);
if (!empty($comments)) {
- while (list($indx, $carr) = each($comments)) {
-
- echo " <tr>\n";
- echo " <td valign='top' style='padding-right: 10' colspan='2'>\n";
- echo " <table class='boxSoft' width='100%'>\n";
- echo " <tr>\n";
- echo " <td class='boxSoftTitle'><span class='f3'>";
- if (canDeleteComment($carr["ID"], $atype, $SID)) {
- $durl = "<a href='pkgedit.php?del_Comment=1";
- $durl.= "&comment_id=".$carr["ID"]."&ID=".$row["ID"];
- $durl.= "'><img src='/images/x.png' border='0'";
- $durl.= " alt=\"".__("Delete comment")."\"></a>";
-
- echo $durl . "&nbsp;&nbsp;";
- }
- if ($SID) {
- echo __("Comment by: %h%s%h on %h%s%h",
- array("<a href='account.php?Action=AccountInfo&ID=".$carr["UsersID"]."'><b>",$carr["UserName"],"</b></a>",
- "<i>",gmdate("Ymd [H:i:s]",$carr["CommentTS"]),"</i>"));
- } else {
- echo __("Comment by: %h%s%h on %h%s%h",
- array("<b>",$carr["UserName"],"</b>",
- "<i>",gmdate("Ymd [H:i:s]",$carr["CommentTS"]),"</i>"));
- }
- echo "</span></td>\n";
- echo " </tr>\n";
- echo " <tr>\n";
- echo " <td class='boxSoft'>";
- echo "<code>\n";
- echo nl2br(htmlspecialchars($carr["Comments"]));
- echo "</code></td>\n";
- echo " </tr>\n";
- echo " </table>\n";
- echo " </td>\n";
- echo " </tr>\n";
- }
- } else {
- print "<tr><td>None</td></tr>\n";
+ include('pkg_comments.php');
}
- echo " </table>\n";
- echo " </div>\n";
- echo "</div>\n";
}
}
return;
diff --git a/web/template/pkg_comments.php b/web/template/pkg_comments.php
new file mode 100644
index 00000000..7bcf708b
--- /dev/null
+++ b/web/template/pkg_comments.php
@@ -0,0 +1,38 @@
+<div class="pgbox">
+<table width="100%">
+<?php while (list($indx, $carr) = each($comments)) { ?>
+ <tr class='boxSoft'>
+ <td class='boxSoftTitle' valign='top' style='padding-right: 10' colspan='2'>
+ <span class='f3'>
+<?php
+ if (canDeleteComment($carr['ID'], $atype, $SID)) {
+ $durl = '<a href="pkgedit.php?del_Comment=1';
+ $durl.= '&comment_id=' . $carr['ID'] . '&ID=' . $row['ID'];
+ $durl.= '"><img src="images/x.png" border="0"';
+ $durl.= ' alt="' . __("Delete comment") . '"></a> ';
+
+ echo $durl;
+ }
+ if ($SID) {
+ echo __("Comment by: %h%s%h on %s",
+ "<a href='account.php?Action=AccountInfo&ID=".$carr["UsersID"]."'><b>",
+ $carr["UserName"], "</b></a>", gmdate("Y m d [H:i:s]", $carr["CommentTS"]));
+ } else {
+ echo __("Comment by: %h%s%h on %s",
+ "<b>", $carr["UserName"], "</b>",
+ gmdate("Y m d [H:i:s]", $carr["CommentTS"]));
+ }
+?>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td class="boxSoft">
+ <pre><?php echo htmlspecialchars($carr["Comments"]) ?></pre>
+ </td>
+ </tr>
+<?php
+}
+?>
+</table>
+</div>