mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Add notify column in search results and notify button
Adds a column to search results showing if a package has comment notification enabled and adds support for toggling notify for multiple packages from search Signed-off-by: Callan Barrett <wizzomafizzo@gmail.com>
This commit is contained in:
parent
bf5c28cf22
commit
8c94552042
5 changed files with 65 additions and 40 deletions
|
@ -509,44 +509,36 @@ if (isset($_REQUEST["do_Flag"])) {
|
|||
# There currently shouldn't be multiple requests here, but the format in which
|
||||
# it's sent requires this
|
||||
while (list($pid, $v) = each($ids)) {
|
||||
$q = "INSERT INTO CommentNotify (PkgID, UserID) VALUES (".$pid.', '.$uid.')';
|
||||
db_query($q, $dbh);
|
||||
print '<p>';
|
||||
print __("You have been added to the comment notification list.");
|
||||
print '<br /></p>';
|
||||
pkgdetails_link($pid);
|
||||
$q = "SELECT Name FROM Packages WHERE ID = " . $pid;
|
||||
$pkgname = mysql_result(db_query($q, $dbh), 0);
|
||||
|
||||
$q = "SELECT * FROM CommentNotify WHERE UserID = ".$uid;
|
||||
$q.= " AND PkgID = ".$pid;
|
||||
|
||||
if (!mysql_num_rows(db_query($q, $dbh))) {
|
||||
$q = "INSERT INTO CommentNotify (PkgID, UserID) VALUES (".$pid.', '.$uid.')';
|
||||
db_query($q, $dbh);
|
||||
print '<p>';
|
||||
print __("You have been added to the comment notification list for %s.",
|
||||
array("<b>" . $pkgname . "</b>"));
|
||||
print '<br /></p>';
|
||||
} else {
|
||||
$q = "DELETE FROM CommentNotify WHERE PkgID = ".$pid;
|
||||
$q.= " AND UserID = ".$uid;
|
||||
db_query($q, $dbh);
|
||||
print '<p>';
|
||||
print __("You have been removed from the comment notification list for %s.",
|
||||
array("<b>" . $pkgname . "</b>"));
|
||||
print '<br /></p>';
|
||||
}
|
||||
}
|
||||
pkgdetails_link($pid);
|
||||
} else {
|
||||
print '<p>';
|
||||
print __("Couldn't add to notification list.");
|
||||
print '<br /></p>';
|
||||
}
|
||||
}
|
||||
} elseif (isset($_REQUEST["do_UnNotify"])) {
|
||||
if (!$atype) {
|
||||
print __("You must be logged in before you can cancel notification on comments.");
|
||||
print "<br />\n";
|
||||
} else {
|
||||
if (!empty($ids)) {
|
||||
$dbh = db_connect();
|
||||
$uid = uid_from_sid($_COOKIE["AURSID"]);
|
||||
# There currently shouldn't be multiple requests here, but the format in which
|
||||
# it's sent requires this
|
||||
while (list($pid, $v) = each($ids)) {
|
||||
$q = "DELETE FROM CommentNotify WHERE PkgID = ".$pid;
|
||||
$q.= " AND UserID = ".$uid;
|
||||
db_query($q, $dbh);
|
||||
print '<p>';
|
||||
print __("You have been removed from the comment notification list.");
|
||||
print '<br /></p>';
|
||||
pkgdetails_link($pid);
|
||||
}
|
||||
} else {
|
||||
print '<p>';
|
||||
print __("Couldn't remove from notification list.");
|
||||
print '<br /></p>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# do_More/do_Less/do_Search/do_MyPackages - just do a search
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue