From: Andrew Dolgov Date: Fri, 6 Feb 2009 11:05:40 +0000 (+0300) Subject: viewfeed_offline: show article labels X-Git-Tag: 1.3.1~67 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=6da82466dfc8bf21a371892e4ea71aaf124996be;p=tt-rss.git viewfeed_offline: show article labels --- diff --git a/offline.js b/offline.js index f9f35796..b218639a 100644 --- a/offline.js +++ b/offline.js @@ -247,7 +247,15 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off if (rs.fieldByName("unread") == "1") { row_class += "Unread"; } - + + var labels = get_local_article_labels(id); + + debug(labels); + + var labels_str = ""; + labels_str += format_article_labels(labels, id); + labels_str += ""; + if (rs.fieldByName("marked") == "1") { marked_pic = ""+ "("+entry_feed_title+")"; @@ -1069,6 +1081,34 @@ function is_local_cat_collapsed(id) { } } +function get_local_article_labels(id) { + try { + var rs = db.execute("SELECT DISTINCT label_id,caption,fg_color,bg_color "+ + "FROM labels, article_labels "+ + "WHERE labels.id = label_id AND article_labels.id = ?", [id]); + + var tmp = new Array(); + + while (rs.isValidRow()) { + var e = new Array(); + + e[0] = rs.field(0); + e[1] = rs.field(1); + e[2] = rs.field(2); + e[3] = rs.field(3); + + tmp.push(e); + + rs.next(); + } + + return tmp; + + } catch (e) { + exception_error("get_local_article_labels", e); + } +} + function label_local_add_article(id, label_id) { try { debug("label_local_add_article " + id + " => " + label_id); @@ -1128,3 +1168,25 @@ function get_local_feed_title(id) { exception_error("get_local_feed_title", e); } } + +function format_article_labels(labels, id) { + try { + + var labels_str = ""; + + if (!labels) return ""; + + for (var i = 0; i < labels.length; i++) { + var l = labels[i]; + + labels_str += ""+l[1]+""; + } + + return labels_str; + + } catch (e) { + exception_error("format_article_labels", e); + } +} +