$subop = $_GET["subop"];
+ if ($subop == "mark") {
+ $mark = $_GET["mark"];
+ $id = pg_escape_string($_GET["id"]);
+
+ if ($mark == "1") {
+ $mark = "true";
+ } else {
+ $mark = "false";
+ }
+
+ $result = pg_query("UPDATE ttrss_entries SET marked = $mark
+ WHERE id = '$id'");
+ }
+
if ($subop == "updateFeed") {
- $feed_id = $_GET["feed"];
+ $feed_id = pg_escape_string($_GET["feed"]);
$result = pg_query($link,
"SELECT feed_url FROM ttrss_feeds WHERE id = '$feed_id'");
$feed_last_updated = "Updated: " . $line["last_updated"];
- print "<tr><td class=\"search\" colspan=\"3\">
+ print "<tr><td class=\"search\" colspan=\"4\">
Search: <input id=\"searchbox\"
onblur=\"javascript:enableHotkeys()\" onfocus=\"javascript:disableHotkeys()\"
onchange=\"javascript:search($feed);\">
<a class=\"button\" href=\"javascript:resetSearch()\">Reset</a>
</td></tr>";
print "<tr>
- <td colspan=\"3\" class=\"title\">" . $line["title"] . "</td></tr>";
+ <td colspan=\"4\" class=\"title\">" . $line["title"] . "</td></tr>";
$search = $_GET["search"];
$total_entries = pg_fetch_result($result, 0, "total_entries");
$result = pg_query("SELECT
- id,title,updated,unread,feed_id,
+ id,title,updated,unread,feed_id,marked,
EXTRACT(EPOCH FROM last_read) AS last_read_ts,
EXTRACT(EPOCH FROM updated) AS updated_ts
FROM
$id = $line["id"];
$feed_id = $line["feed_id"];
+ if ($line["marked"] == "t") {
+ $marked_pic = "<img id=\"FMARKPIC-$id\" src=\"images/mark_set.png\"
+ alt=\"Reset mark\" onclick='javascript:toggleMark($id, false)'>";
+ } else {
+ $marked_pic = "<img id=\"FMARKPIC-$id\" src=\"images/mark_unset.png\"
+ alt=\"Set mark\" onclick='javascript:toggleMark($id, true)'>";
+ }
+
$content_link = "<a href=\"javascript:view($id,$feed_id);\">" .
$line["title"] . "</a>";
print "<tr class='$class' id='RROW-$id'>";
- print "<td id='FUPDPIC-$id' valign='center' class='headlineUpdateMark'>$update_pic</td>";
+ print "<td id='FUPDPIC-$id' valign='center'
+ class='headlineUpdateMark'>$update_pic</td>";
+
+ print "<td valign='center'
+ class='headlineUpdateMark'>$marked_pic</td>";
print "<td class='headlineUpdated'>
<a href=\"javascript:view($id,$feed_id);\">".$line["updated"]."</a></td>";
// start unholy navbar block
- print "<tr><td colspan=\"3\" class=\"headlineToolbar\">";
+ print "<tr><td colspan=\"4\" class=\"headlineToolbar\">";
$next_skip = $skip + HEADLINES_PER_PAGE;
$prev_skip = $skip - HEADLINES_PER_PAGE;
}
+function toggleMark(id, toggle) {
+
+// notify("Toggle mark: " + id + ", " + toggle);
+
+ if (!xmlhttp_ready(xmlhttp_rpc)) {
+ printLockingError();
+ return;
+ }
+
+ var mark_img = document.getElementById("FMARKPIC-" + id);
+
+ var query = "backend.php?op=rpc&id=" + id + "&subop=mark";
+
+ if (toggle == true) {
+ mark_img.src = "images/mark_set.png";
+ mark_img.alt = "Reset mark";
+ mark_img.setAttribute('onclick', 'javascript:toggleMark('+id+', false)');
+ query = query + "&mark=1";
+ } else {
+ mark_img.src = "images/mark_unset.png";
+ mark_img.alt = "Set mark";
+ mark_img.setAttribute('onclick', 'javascript:toggleMark('+id+', true)');
+ query = query + "&mark=0";
+ }
+
+ xmlhttp_rpc.open("GET", query, true);
+ xmlhttp_rpc.onreadystatechange=rpc_notify_callback;
+ xmlhttp_rpc.send(null);
+
+}
function init() {