diff options
author | Andrew Dolgov <[email protected]> | 2005-08-22 06:23:49 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2005-08-22 06:23:49 +0100 |
commit | 83fe4d6db52b8eca0d072f35c44b9683b10c05ed (patch) | |
tree | f649e09edf5715b7926efdef7f0c02b15d707772 | |
parent | 331900c642bbea3f8b7e242975fae4cfec459433 (diff) |
basic functionality pass 11
-rw-r--r-- | backend.php | 43 | ||||
-rw-r--r-- | prefs.js | 56 | ||||
-rw-r--r-- | prefs.php | 8 | ||||
-rw-r--r-- | 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 "<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\"> - Search: <input onchange=\"javascript:search($feed,this);\"></td></tr>"; - print "<tr><td colspan=\"2\" class=\"title\">" . $line["title"] . "</td></tr>"; + Search: <input onchange=\"javascript:search($feed,this);\"></td></tr>"; + print "<tr><td colspan=\"2\" class=\"title\">" . $line["title"] . "</td></tr>"; 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 "<a class=\"button\" href=\"javascript:viewfeed($feed, $prev_skip);\">Previous Page</a>"; print " "; print "<a class=\"button\" href=\"javascript:viewfeed($feed, $next_skip);\">Next Page</a>"; - print " "; - + print " "; print "<a class=\"button\" - href=\"javascript:viewfeed($feed, 0, '');\">Refresh</a>"; - print " "; + href=\"javascript:viewfeed($feed, $skip, '');\">Refresh</a>"; + print " Mark as read: "; + print "<a class=\"button\" + href=\"javascript:viewfeed($feed, $skip, 'MarkPageRead');\">This Page</a>"; + print " "; print "<a class=\"button\" - href=\"javascript:viewfeed($feed, 0, 'MarkAllRead');\">Mark all as read</a>"; + href=\"javascript:viewfeed($feed, $skip, 'MarkAllRead');\">All Posts</a>"; print "</td></tr>"; print "</table>"; @@ -208,6 +215,20 @@ 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") { $ids = split(",", $_GET["ids"]); @@ -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."); } @@ -35,7 +35,13 @@ <div id="feeds"> </div> - <p><a class="button" href="javascript:removeSelectedFeeds()">Remove Selected</a> + <p>Selection: + <a class="buttonWarn" + href="javascript:removeSelectedFeeds()">Remove</a> + <a class="button" + href="javascript:readSelectedFeeds()">Mark as read</a> + <a class="button" + href="javascript:unreadSelectedFeeds()">Mark as unread</a> <hr> 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; +} |