From 9ed133e7a97e4ad591df2557646519a2f451adf3 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 12 Sep 2010 13:38:57 +0400 Subject: api: support published status in getHeadlines; digest: code cleanup --- digest.css | 11 ++++++---- digest.js | 70 +++++++++++++++++++++-------------------------------------- functions.php | 1 + 3 files changed, 33 insertions(+), 49 deletions(-) diff --git a/digest.css b/digest.css index 2c30b0eb8..f7ddff689 100644 --- a/digest.css +++ b/digest.css @@ -159,14 +159,17 @@ a:hover { max-width : 65%; } -#headlines ul#headlines-content img.digest-check { - cursor : pointer; +#headlines ul#headlines-content div.digest-check { + float : right; } -#headlines ul#headlines-content div.digest-check { - float : right; +#headlines ul#headlines-content div.digest-check img { + cursor : pointer; + margin-right : 0px; + margin-left : 3px; } + #headlines ul#headlines-content img.icon { width : 16px; height : 16px; diff --git a/digest.js b/digest.js index ce9c325b5..ba066a15f 100644 --- a/digest.js +++ b/digest.js @@ -14,7 +14,7 @@ function catchup_feed(feed_id, callback) { var is_cat = ""; - if (feed_id == -4) is_cat = "true"; + if (feed_id < 0) is_cat = "true"; // KLUDGE var query = "?op=rpc&subop=catchupFeed&feed_id=" + feed_id + "&is_cat=" + is_cat; @@ -290,18 +290,32 @@ function add_headline_entry(article, feed) { icon_part = ""; + var mark_part = ""; + var publ_part = ""; + + if (article.marked) + mark_part = ""; + else + mark_part = ""; + + if (article.published) + publ_part = ""; + else + publ_part = ""; + + var tmp_html = "
  • " + icon_part + "
    " + - "" + - "" + - "" + + mark_part + + publ_part + + "" + "
    " + "" + article.title + "" + "
    " + - "
    " + + "
    " + article.excerpt + "
    " + "" + @@ -450,41 +464,7 @@ function init() { } } -function tMark_afh_off(effect) { - try { - var elem = effect.effects[0].element; - - console.log("tMark_afh_off : " + elem.id); - - if (elem) { - elem.src = elem.src.replace("mark_set", "mark_unset"); - elem.alt = __("Star article"); - Element.show(elem); - } - - } catch (e) { - exception_error("tMark_afh_off", e); - } -} - -function tPub_afh_off(effect) { - try { - var elem = effect.effects[0].element; - - console.log("tPub_afh_off : " + elem.id); - - if (elem) { - elem.src = elem.src.replace("pub_set", "pub_unset"); - elem.alt = __("Publish article"); - Element.show(elem); - } - - } catch (e) { - exception_error("tPub_afh_off", e); - } -} - -function toggleMark(mark_img, id) { +function toggle_mark(mark_img, id) { try { @@ -510,15 +490,15 @@ function toggleMark(mark_img, id) { new Ajax.Request("backend.php", { parameters: query, onComplete: function(transport) { - // + update(); } }); } catch (e) { - exception_error("toggleMark", e); + exception_error("toggle_mark", e); } } -function togglePub(mark_img, id, note) { +function toggle_pub(mark_img, id, note) { try { @@ -552,11 +532,11 @@ function togglePub(mark_img, id, note) { new Ajax.Request("backend.php", { parameters: query, onComplete: function(transport) { - // + update(); } }); } catch (e) { - exception_error("togglePub", e); + exception_error("toggle_pub", e); } } diff --git a/functions.php b/functions.php index e53995335..2174460b4 100644 --- a/functions.php +++ b/functions.php @@ -6777,6 +6777,7 @@ "id" => (int)$line["id"], "unread" => sql_bool_to_bool($line["unread"]), "marked" => sql_bool_to_bool($line["marked"]), + "published" => sql_bool_to_bool($line["published"]), "updated" => strtotime($line["updated"]), "is_updated" => $is_updated, "title" => $line["title"], -- cgit v1.2.3