add ability to hide feeds from browser (closes #21)

This commit is contained in:
Andrew Dolgov 2005-12-30 05:11:48 +01:00
parent 5b35b4de9b
commit e3c99f3b63
3 changed files with 32 additions and 4 deletions

View File

@ -1531,7 +1531,8 @@
print "<p>Showing top 50 registered feeds, sorted by popularity:</p>";
$result = db_query($link, "SELECT feed_url,count(id) AS subscribers
FROM ttrss_feeds WHERE auth_login = '' AND auth_pass = ''
FROM ttrss_feeds
WHERE auth_login = '' AND auth_pass = '' AND private = false
GROUP BY feed_url ORDER BY subscribers DESC LIMIT 50");
print "<ul class='browseFeedList' id='browseFeedList'>";
@ -1738,6 +1739,19 @@
print "<td><input type=\"password\" id=\"iedit_pass\"
value=\"$auth_pass\"></td></tr>";
$row_class = toggleEvenOdd($row_class);
$private = sql_bool_to_bool(db_fetch_result($result, 0, "private"));
if ($private) {
$checked = "checked";
} else {
$checked = "";
}
print "<tr class='$row_class'><td>Options:</td>";
print "<td><input type=\"checkbox\" id=\"iedit_private\"
$checked> Hide from feed browser</td></tr>";
print "</table>";
print "</div>";
@ -1759,6 +1773,7 @@
$auth_login = db_escape_string($_POST["login"]);
$auth_pass = db_escape_string($_POST["pass"]);
$parent_feed = db_escape_string($_POST["pfeed"]);
$private = db_escape_string($_POST["private"]);
if (strtoupper($upd_intl) == "DEFAULT")
$upd_intl = 0;
@ -1791,7 +1806,8 @@
update_interval = '$upd_intl',
purge_interval = '$purge_intl',
auth_login = '$auth_login',
auth_pass = '$auth_pass'
auth_pass = '$auth_pass',
private = '$private'
WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
}

View File

@ -867,7 +867,16 @@
return "false";
}
}
function sql_bool_to_bool($s) {
if ($s == "t" || $s == "1") {
return true;
} else {
return false;
}
}
function toggleEvenOdd($a) {
if ($a == "even")
return "odd";

View File

@ -675,6 +675,8 @@ function feedEditSave() {
var upd_intl = document.getElementById("iedit_updintl").value;
var purge_intl = document.getElementById("iedit_purgintl").value;
var fcat = document.getElementById("iedit_fcat");
var private = document.getElementById("iedit_private").checked;
var fcat_id = 0;
@ -705,8 +707,9 @@ function feedEditSave() {
var query = "op=pref-feeds&subop=editSave&id=" +
feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) +
"&ui=" + param_escape(upd_intl) + "&pi=" + param_escape(purge_intl) +
"&catid=" + param_escape(fcat_id) + "&login=" + param_escape(auth_login) +
"&pfeed=" + param_escape(parent_feed_id) + "&pass=" + param_escape(auth_pass);
"&catid=" + param_escape(fcat_id) + "&login=" + param_escape(auth_login) +
"&pfeed=" + param_escape(parent_feed_id) + "&pass=" + param_escape(auth_pass) +
"&private=" + param_escape(private);
xmlhttp.open("POST", "backend.php", true);
xmlhttp.onreadystatechange=feedlist_callback;