From 83fe4d6db52b8eca0d072f35c44b9683b10c05ed Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 22 Aug 2005 06:23:49 +0100 Subject: [PATCH] basic functionality pass 11 --- backend.php | 43 +++++++++++++++++++++++++++++----------- prefs.js | 56 ++++++++++++++++++++++++++++++++++++++++++++++++----- prefs.php | 8 +++++++- tt-rss.css | 15 ++++++++++++++ 4 files changed, 105 insertions(+), 17 deletions(-) diff --git a/backend.php b/backend.php index 6ea1355b9..4a1d52ce7 100644 --- a/backend.php +++ b/backend.php @@ -116,17 +116,21 @@ pg_query("UPDATE ttrss_entries SET unread = false 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 ""; -/* print ""; - print ""; */ print ""; - print ""; + Search: "; + print ""; if ($ext == "SEARCH") { $search = $_GET["search"]; @@ -168,19 +172,22 @@ $next_skip = $skip + HEADLINES_PER_PAGE; $prev_skip = $skip - HEADLINES_PER_PAGE; - + + print "Navigate: "; print "Previous Page"; print " "; print "Next Page"; - print "   "; - + print " "; print "Refresh"; - print "   "; + href=\"javascript:viewfeed($feed, $skip, '');\">Refresh"; + print "  Mark as read: "; print "Mark all as read"; + href=\"javascript:viewfeed($feed, $skip, 'MarkPageRead');\">This Page"; + print " "; + print "All Posts"; print ""; print "
- Search: " . $line["title"] . "
- Search:
" . $line["title"] . "
" . $line["title"] . "
"; @@ -208,6 +215,20 @@ print "

[Edit feed placeholder]

"; } + 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") { $ids = split(",", $_GET["ids"]); diff --git a/prefs.js b/prefs.js index 7fb4562f7..001d5b0a8 100644 --- a/prefs.js +++ b/prefs.js @@ -60,8 +60,8 @@ function addFeed() { var link = document.getElementById("fadd_link"); - if (link.length == 0) { - notify("Missing feed URL."); + if (link.value.length == 0) { + notify("Error: Missing feed URL."); } else { notify("Adding feed..."); @@ -87,8 +87,7 @@ function editFeed(feed) { } - -function removeSelectedFeeds() { +function getSelectedFeeds() { 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) { notify("Removing selected feeds..."); @@ -112,7 +158,7 @@ function removeSelectedFeeds() { } else { - notify("Please select some feeds first."); + notify("Error: Please select some feeds first."); } diff --git a/prefs.php b/prefs.php index 7f2a8cb36..79ffcf111 100644 --- a/prefs.php +++ b/prefs.php @@ -35,7 +35,13 @@
 
-

Remove Selected  +

Selection:  + Remove  + Mark as read  + Mark as unread 


diff --git a/tt-rss.css b/tt-rss.css index 38187380e..63a2fc26c 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -247,4 +247,19 @@ a.button:hover { 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; +}