basic functionality pass 11

This commit is contained in:
Andrew Dolgov 2005-08-22 06:23:49 +01:00
parent 331900c642
commit 83fe4d6db5
4 changed files with 105 additions and 17 deletions

View File

@ -116,13 +116,17 @@
pg_query("UPDATE ttrss_entries SET unread = false pg_query("UPDATE ttrss_entries SET unread = false
WHERE feed_id = '$feed'"); WHERE feed_id = '$feed'");
} }
if ($ext == "MarkPageRead") {
// pg_query("UPDATE ttrss_entries SET unread = false
// WHERE feed_id = '$feed' ORDER BY updated OFFSET $skip LIMIT 1");
}
} }
} }
print "<table class=\"headlines\" width=\"100%\">"; print "<table class=\"headlines\" width=\"100%\">";
/* print "<tr><td class=\"search\">
Search: <input onchange=\"javascript:search($feed,this);\"></td>";
print "<td class=\"title\">" . $line["title"] . "</td></tr>"; */
print "<tr><td class=\"search\" colspan=\"2\"> print "<tr><td class=\"search\" colspan=\"2\">
Search: <input onchange=\"javascript:search($feed,this);\"></td></tr>"; Search: <input onchange=\"javascript:search($feed,this);\"></td></tr>";
@ -169,18 +173,21 @@
$next_skip = $skip + HEADLINES_PER_PAGE; $next_skip = $skip + HEADLINES_PER_PAGE;
$prev_skip = $skip - HEADLINES_PER_PAGE; $prev_skip = $skip - HEADLINES_PER_PAGE;
print "Navigate: ";
print "<a class=\"button\" print "<a class=\"button\"
href=\"javascript:viewfeed($feed, $prev_skip);\">Previous Page</a>"; href=\"javascript:viewfeed($feed, $prev_skip);\">Previous Page</a>";
print "&nbsp;"; print "&nbsp;";
print "<a class=\"button\" print "<a class=\"button\"
href=\"javascript:viewfeed($feed, $next_skip);\">Next Page</a>"; href=\"javascript:viewfeed($feed, $next_skip);\">Next Page</a>";
print "&nbsp;&nbsp;&nbsp;"; print "&nbsp;";
print "<a class=\"button\" print "<a class=\"button\"
href=\"javascript:viewfeed($feed, 0, '');\">Refresh</a>"; href=\"javascript:viewfeed($feed, $skip, '');\">Refresh</a>";
print "&nbsp;&nbsp;&nbsp;"; print "&nbsp;&nbsp;Mark as read: ";
print "<a class=\"button\" print "<a class=\"button\"
href=\"javascript:viewfeed($feed, 0, 'MarkAllRead');\">Mark all as read</a>"; href=\"javascript:viewfeed($feed, $skip, 'MarkPageRead');\">This Page</a>";
print "&nbsp;";
print "<a class=\"button\"
href=\"javascript:viewfeed($feed, $skip, 'MarkAllRead');\">All Posts</a>";
print "</td></tr>"; print "</td></tr>";
print "</table>"; print "</table>";
@ -208,6 +215,20 @@
print "<p>[Edit feed placeholder]</p>"; print "<p>[Edit feed placeholder]</p>";
} }
if ($subop == "unread") {
$ids = split(",", $_GET["ids"]);
foreach ($ids as $id) {
pg_query("UPDATE ttrss_entries SET unread = true WHERE feed_id = '$id'");
}
}
if ($subop == "read") {
$ids = split(",", $_GET["ids"]);
foreach ($ids as $id) {
pg_query("UPDATE ttrss_entries SET unread = false WHERE feed_id = '$id'");
}
}
if ($subop == "remove") { if ($subop == "remove") {
$ids = split(",", $_GET["ids"]); $ids = split(",", $_GET["ids"]);

View File

@ -60,8 +60,8 @@ function addFeed() {
var link = document.getElementById("fadd_link"); var link = document.getElementById("fadd_link");
if (link.length == 0) { if (link.value.length == 0) {
notify("Missing feed URL."); notify("Error: Missing feed URL.");
} else { } else {
notify("Adding feed..."); notify("Adding feed...");
@ -87,8 +87,7 @@ function editFeed(feed) {
} }
function getSelectedFeeds() {
function removeSelectedFeeds() {
var content = document.getElementById("prefFeedList"); var content = document.getElementById("prefFeedList");
@ -101,6 +100,53 @@ function removeSelectedFeeds() {
} }
} }
return sel_rows;
}
function readSelectedFeeds() {
var sel_rows = getSelectedFeeds();
if (sel_rows.length > 0) {
notify("Marking selected feeds as read...");
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=unread&ids="+
param_escape(sel_rows.toString()), true);
xmlhttp.onreadystatechange=feedlist_callback;
xmlhttp.send(null);
} else {
notify("Error: Please select some feeds first.");
}
}
function unreadSelectedFeeds() {
var sel_rows = getSelectedFeeds();
if (sel_rows.length > 0) {
notify("Marking selected feeds as unread...");
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=unread&ids="+
param_escape(sel_rows.toString()), true);
xmlhttp.onreadystatechange=feedlist_callback;
xmlhttp.send(null);
} else {
notify("Error: Please select some feeds first.");
}
}
function removeSelectedFeeds() {
var sel_rows = getSelectedFeeds();
if (sel_rows.length > 0) { if (sel_rows.length > 0) {
notify("Removing selected feeds..."); notify("Removing selected feeds...");
@ -112,7 +158,7 @@ function removeSelectedFeeds() {
} else { } else {
notify("Please select some feeds first."); notify("Error: Please select some feeds first.");
} }

View File

@ -35,7 +35,13 @@
<div id="feeds">&nbsp;</div> <div id="feeds">&nbsp;</div>
<p><a class="button" href="javascript:removeSelectedFeeds()">Remove Selected</a>&nbsp; <p>Selection:&nbsp;
<a class="buttonWarn"
href="javascript:removeSelectedFeeds()">Remove</a>&nbsp;
<a class="button"
href="javascript:readSelectedFeeds()">Mark as read</a>&nbsp;
<a class="button"
href="javascript:unreadSelectedFeeds()">Mark as unread</a>&nbsp;
<hr> <hr>

View File

@ -247,4 +247,19 @@ a.button:hover {
color : black; color : black;
} }
a.buttonWarn {
border : 1px solid #d0d0d0;
background-image : url("button.png");
background-position : top;
background-repeat : repeat-x;
background-color : white;
color : black;
padding : 2px 10px 2px 10px;
font-size : small;
}
a.buttonWarn:hover {
background : #fff0f0;
text-decoration : none;
color : black;
}