digest: support tags

master
Andrew Dolgov 14 years ago
parent ef1ef3bc29
commit 78ac6caf00

@ -18,6 +18,10 @@ a:hover {
color : gray; color : gray;
} }
#header a:hover, #footer a:hover {
color : #0069D8;
}
#header { #header {
font-weight : bold; font-weight : bold;
font-size : 14px; font-size : 14px;
@ -159,6 +163,18 @@ a:hover {
max-width : 65%; max-width : 65%;
} }
#headlines h1 a {
color : #684C99;
}
#headlines h1 a:hover {
color : gray;
}
#headlines h1 #headlines-title {
color : gray;
}
#headlines ul#headlines-content div.digest-check { #headlines ul#headlines-content div.digest-check {
float : right; float : right;
} }
@ -214,15 +230,23 @@ a:hover {
} }
#headlines ul#headlines-content div.info { #headlines ul#headlines-content div.info {
margin-top : 2px;
font-size : 11px; font-size : 11px;
} }
#headlines ul#headlines-content div.info a { #headlines ul#headlines-content div.info a {
color : gray; color : gray;
font-weight : bold;
} }
#headlines ul#headlines-content div.info a:hover { #headlines ul#headlines-content span.tags {
font-size : 11px;
margin-bottom : 2px;
}
#headlines ul#headlines-content span.tags a {
color : #684C99;
}
#headlines ul#headlines-content div.info a:hover,
#headlines ul#headlines-content span.tags a:hover {
color : #659a4c; color : #659a4c;
} }

@ -186,8 +186,10 @@ function viewfeed(feed_id, offset) {
offset = _active_feed_offset + offset; offset = _active_feed_offset + offset;
} }
var query = "backend.php?op=rpc&subop=digest-update&feed_id=" + feed_id + var query = "backend.php?op=rpc&subop=digest-update&feed_id=" +
"&offset=" + offset; param_escape(feed_id) + "&offset=" + offset;
console.log(query);
new Ajax.Request("backend.php", { new Ajax.Request("backend.php", {
parameters: query, parameters: query,
@ -293,6 +295,22 @@ function add_headline_entry(article, feed) {
var mark_part = ""; var mark_part = "";
var publ_part = ""; var publ_part = "";
var tags_part = "";
if (article.tags.length > 0) {
tags_part = " " + __("in") + " ";
for (var i = 0; i < Math.min(5, article.tags.length); i++) {
tags_part += "<a href=\"#\" onclick=\"viewfeed('" +
article.tags[i] + "')\">" +
article.tags[i] + "</a>, ";
}
tags_part = tags_part.replace(/, $/, "");
tags_part = "<span class=\"tags\">" + tags_part + "</span>";
}
if (article.marked) if (article.marked)
mark_part = "<img title='"+ __("Unstar article")+"' onclick=\"toggle_mark(this, "+article.id+")\" src='images/mark_set.png'>"; mark_part = "<img title='"+ __("Unstar article")+"' onclick=\"toggle_mark(this, "+article.id+")\" src='images/mark_set.png'>";
else else
@ -320,7 +338,7 @@ function add_headline_entry(article, feed) {
"<div style='display : none' class='content'>" + "<div style='display : none' class='content'>" +
article.content + "</div>" + article.content + "</div>" +
"<div class='info'><a href=\#\" onclick=\"viewfeed("+feed.id+")\">" + "<div class='info'><a href=\#\" onclick=\"viewfeed("+feed.id+")\">" +
feed.title + "</a> " + " @ " + feed.title + "</a> " + tags_part + " @ " +
new Date(article.updated * 1000) + "</div>" + new Date(article.updated * 1000) + "</div>" +
"</div></li>"; "</div></li>";
@ -410,10 +428,15 @@ function parse_headlines(transport, replace) {
if (!transport.responseXML) return; if (!transport.responseXML) return;
var headlines = transport.responseXML.getElementsByTagName('headlines')[0]; var headlines = transport.responseXML.getElementsByTagName('headlines')[0];
var headlines_title = transport.responseXML.getElementsByTagName('headlines-title')[0];
if (headlines) { if (headlines && headlines_title) {
headlines = eval("(" + headlines.firstChild.nodeValue + ")"); headlines = eval("(" + headlines.firstChild.nodeValue + ")");
var title = headlines_title.firstChild.nodeValue;
$("headlines-title").innerHTML = title;
if (replace) $('headlines-content').innerHTML = ''; if (replace) $('headlines-content').innerHTML = '';
var pr = $('H-MORE-PROMPT'); var pr = $('H-MORE-PROMPT');

@ -91,7 +91,8 @@
</div> </div>
<div id="headlines"> <div id="headlines">
<h1><?php echo __('headlines') ?></h1> <h1><a href="#" onclick="viewfeed(-4)"><?php echo __('headlines') ?></a>:
<span id="headlines-title"></span></h1>
<ul id="headlines-content"> </ul> <ul id="headlines-content"> </ul>
</div> </div>
@ -107,6 +108,13 @@
v<?php echo VERSION ?> v<?php echo VERSION ?>
<?php } ?> <?php } ?>
&copy; 2005&ndash;<?php echo date('Y') ?> &copy; 2005&ndash;<?php echo date('Y') ?>
<a href="http://fakecake.org/">Andrew Dolgov</a></div> <a href="http://fakecake.org/">Andrew Dolgov</a>
<br/>
<a href="tt-rss.php">
<?php echo __("You are viewing the digest page. Click to open full version.") ?></a>
</div>
</body> </body>

@ -6783,6 +6783,7 @@
"title" => $line["title"], "title" => $line["title"],
"link" => $line["link"], "link" => $line["link"],
"feed_id" => $line["feed_id"], "feed_id" => $line["feed_id"],
"tags" => get_article_tags($link, $line["id"]),
); );
if ($show_excerpt) { if ($show_excerpt) {

@ -984,8 +984,6 @@
if (!$feed_id) $feed_id = -4; if (!$feed_id) $feed_id = -4;
if (!$offset) $offset = 0; if (!$offset) $offset = 0;
print "<rpc-reply>"; print "<rpc-reply>";
$headlines = api_get_headlines($link, $feed_id, 10, $offset, $headlines = api_get_headlines($link, $feed_id, 10, $offset,
@ -994,6 +992,9 @@
//function api_get_headlines($link, $feed_id, $limit, $offset, //function api_get_headlines($link, $feed_id, $limit, $offset,
// $filter, $is_cat, $show_excerpt, $show_content, $view_mode) { // $filter, $is_cat, $show_excerpt, $show_content, $view_mode) {
print "<headlines-title><![CDATA[" . getFeedTitle($link, $feed_id) .
"]]></headlines-title>";
print "<headlines><![CDATA[" . json_encode($headlines) . "]]></headlines>"; print "<headlines><![CDATA[" . json_encode($headlines) . "]]></headlines>";
print "</rpc-reply>"; print "</rpc-reply>";

Loading…
Cancel
Save