array_push($topmost_article_ids, $id);
}
- if ($line["unread"] == "t" || $line["unread"] == "1") {
+ if (sql_bool_to_bool($line["unread"])) {
$class .= " Unread";
++$num_unread;
- $is_unread = true;
- } else {
- $is_unread = false;
}
- if ($line["marked"] == "t" || $line["marked"] == "1") {
- $marked_pic = "<img id=\"FMPIC-$id\"
+ if (sql_bool_to_bool($line["marked"])) {
+ $marked_pic = "<img
src=\"images/mark_set.svg\"
class=\"markedPic\" alt=\"Unstar article\"
- onclick='javascript:toggleMark($id)'>";
+ onclick='toggleMark($id)'>";
+ $class .= " marked";
} else {
- $marked_pic = "<img id=\"FMPIC-$id\"
+ $marked_pic = "<img
src=\"images/mark_unset.svg\"
class=\"markedPic\" alt=\"Star article\"
- onclick='javascript:toggleMark($id)'>";
+ onclick='toggleMark($id)'>";
}
- if ($line["published"] == "t" || $line["published"] == "1") {
- $published_pic = "<img id=\"FPPIC-$id\" src=\"images/pub_set.svg\"
- class=\"markedPic\"
- alt=\"Unpublish article\" onclick='javascript:togglePub($id)'>";
+ if (sql_bool_to_bool($line["published"])) {
+ $published_pic = "<img src=\"images/pub_set.svg\"
+ class=\"pubPic\"
+ alt=\"Unpublish article\" onclick='togglePub($id)'>";
+ $class .= " published";
} else {
- $published_pic = "<img id=\"FPPIC-$id\" src=\"images/pub_unset.svg\"
- class=\"markedPic\"
- alt=\"Publish article\" onclick='javascript:togglePub($id)'>";
+ $published_pic = "<img src=\"images/pub_unset.svg\"
+ class=\"pubPic\"
+ alt=\"Publish article\" onclick='togglePub($id)'>";
}
# $content_link = "<a target=\"_blank\" href=\"".$line["link"]."\">" .
$reply['content'] .= "<div style=\"float : right\">";
+// $reply['content'] .= "$marked_pic";
+// $reply['content'] .= "$published_pic";
+
foreach ($pluginhost->get_hooks($pluginhost::HOOK_ARTICLE_BUTTON) as $p) {
$reply['content'] .= $p->hook_article_button($line);
}
try {
var query = "?op=rpc&id=" + id + "&method=mark";
- var img = $("FMPIC-" + id);
+ var row = $("RROW-" + id);
+ if (!row) return;
- if (!img) return;
+ var imgs = row.getElementsByClassName("markedPic");
- if (img.src.match("mark_unset")) {
- img.src = img.src.replace("mark_unset", "mark_set");
- img.alt = __("Unstar article");
- query = query + "&mark=1";
+ for (i = 0; i < imgs.length; i++) {
+ var img = imgs[i];
- } else {
- img.src = img.src.replace("mark_set", "mark_unset");
- img.alt = __("Star article");
- query = query + "&mark=0";
+ if (!row.hasClassName("marked")) {
+ img.src = img.src.replace("mark_unset", "mark_set");
+ img.alt = __("Unstar article");
+ query = query + "&mark=1";
+ } else {
+ img.src = img.src.replace("mark_set", "mark_unset");
+ img.alt = __("Star article");
+ query = query + "&mark=0";
+ }
}
+ row.toggleClassName("marked");
+
if (!client_only) {
new Ajax.Request("backend.php", {
parameters: query,
query = query + "¬e=undefined";
}
- var img = $("FPPIC-" + id);
-
- if (!img) return;
+ var row = $("RROW-" + id);
+ if (!row) return;
- if (img.src.match("pub_unset") || note != undefined) {
- img.src = img.src.replace("pub_unset", "pub_set");
- img.alt = __("Unpublish article");
- query = query + "&pub=1";
+ var imgs = row.getElementsByClassName("pubPic");
- } else {
- img.src = img.src.replace("pub_set", "pub_unset");
- img.alt = __("Publish article");
+ for (i = 0; i < imgs.length; i++) {
+ var img = imgs[i];
- query = query + "&pub=0";
+ if (!row.hasClassName("published") || note != undefined) {
+ img.src = img.src.replace("pub_unset", "pub_set");
+ img.alt = __("Unpublish article");
+ query = query + "&pub=1";
+ } else {
+ img.src = img.src.replace("pub_set", "pub_unset");
+ img.alt = __("Publish article");
+ query = query + "&pub=0";
+ }
}
+ if (note != undefined)
+ row.addClassName("published");
+ else
+ row.toggleClassName("published");
+
if (!client_only) {
new Ajax.Request("backend.php", {
parameters: query,
if (cb) cb.attr("checked", false);
}
} else if (mode == "marked") {
- var img = $("FMPIC-" + child.id.replace("RROW-", ""));
-
- if (img && img.src.match("mark_set")) {
+ if (child.hasClassName("marked")) {
child.addClassName("Selected");
if (cb) cb.attr("checked", true);
} else {
if (cb) cb.attr("checked", false);
}
} else if (mode == "published") {
- var img = $("FPPIC-" + child.id.replace("RROW-", ""));
-
- if (img && img.src.match("pub_set")) {
+ if (child.hasClassName("published")) {
child.addClassName("Selected");
if (cb) cb.attr("checked", true);
} else {
--- /dev/null
+<?php
+class Mark_Button extends Plugin {
+ private $link;
+ private $host;
+
+ function init($host) {
+ $this->link = $host->get_link();
+ $this->host = $host;
+
+ $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
+ }
+
+ function about() {
+ return array(1.0,
+ "Bottom un/star button for the combined mode",
+ "fox");
+ }
+
+ function hook_article_button($line) {
+ $marked_pic = "";
+
+ if (get_pref($this->link, "COMBINED_DISPLAY_MODE")) {
+ if (sql_bool_to_bool($line["marked"])) {
+ $marked_pic = "<img
+ src=\"images/mark_set.svg\"
+ class=\"markedPic\" alt=\"Unstar article\"
+ onclick='toggleMark($id)'>";
+ } else {
+ $marked_pic = "<img
+ src=\"images/mark_unset.svg\"
+ class=\"markedPic\" alt=\"Star article\"
+ onclick='toggleMark($id)'>";
+ }
+ }
+
+ return $marked_pic;
+ }
+}
+?>