|
|
|
@ -187,226 +187,6 @@ function viewNextFeedPage() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, offset) {
|
|
|
|
|
try {
|
|
|
|
|
notify('');
|
|
|
|
|
|
|
|
|
|
if (!offset) offset = 0;
|
|
|
|
|
|
|
|
|
|
loading_set_progress(100);
|
|
|
|
|
|
|
|
|
|
clean_feed_selections();
|
|
|
|
|
|
|
|
|
|
setActiveFeedId(feed_id, is_cat);
|
|
|
|
|
|
|
|
|
|
if (!is_cat) {
|
|
|
|
|
var feedr = document.getElementById("FEEDR-" + feed_id);
|
|
|
|
|
if (feedr && !feedr.className.match("Selected")) {
|
|
|
|
|
feedr.className = feedr.className + "Selected";
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var feedr = document.getElementById("FCAT-" + feed_id);
|
|
|
|
|
if (feedr && !feedr.className.match("Selected")) {
|
|
|
|
|
feedr.className = feedr.className + "Selected";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
disableContainerChildren("headlinesToolbar", false);
|
|
|
|
|
Form.enable("main_toolbar_form");
|
|
|
|
|
|
|
|
|
|
var f = document.getElementById("headlines-frame");
|
|
|
|
|
try {
|
|
|
|
|
if (reply.offset == 0) {
|
|
|
|
|
debug("resetting headlines scrollTop");
|
|
|
|
|
f.scrollTop = 0;
|
|
|
|
|
}
|
|
|
|
|
} catch (e) { };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var container = document.getElementById("headlines-frame");
|
|
|
|
|
|
|
|
|
|
var tmp = "";
|
|
|
|
|
|
|
|
|
|
rs = db.execute("SELECT title FROM feeds WHERE id = ?", [feed_id]);
|
|
|
|
|
|
|
|
|
|
if (rs.isValidRow() || feed_id == -1 || feed_id == -4) {
|
|
|
|
|
|
|
|
|
|
feed_title = rs.field(0);
|
|
|
|
|
|
|
|
|
|
if (feed_id == -1) {
|
|
|
|
|
feed_title = __("Starred articles");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (feed_id == -4) {
|
|
|
|
|
feed_title = __("All articles");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (offset == 0) {
|
|
|
|
|
tmp += "<div id=\"headlinesContainer\">";
|
|
|
|
|
|
|
|
|
|
tmp += "<div class=\"headlinesSubToolbar\">";
|
|
|
|
|
tmp += "<div id=\"subtoolbar_ftitle\">";
|
|
|
|
|
tmp += feed_title;
|
|
|
|
|
tmp += "</div>";
|
|
|
|
|
|
|
|
|
|
var sel_all_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, '', true)";
|
|
|
|
|
var sel_unread_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true)";
|
|
|
|
|
var sel_none_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false)";
|
|
|
|
|
var sel_inv_link = "javascript:invertHeadlineSelection()";
|
|
|
|
|
|
|
|
|
|
tmp += __('Select:')+
|
|
|
|
|
" <a href=\""+sel_all_link+"\">"+__('All')+"</a>, "+
|
|
|
|
|
"<a href=\""+sel_unread_link+"\">"+__('Unread')+"</a>, "+
|
|
|
|
|
"<a href=\""+sel_inv_link+"\">"+__('Invert')+"</a>, "+
|
|
|
|
|
"<a href=\""+sel_none_link+"\">"+__('None')+"</a>";
|
|
|
|
|
|
|
|
|
|
tmp += " ";
|
|
|
|
|
|
|
|
|
|
tmp += "</div>";
|
|
|
|
|
|
|
|
|
|
tmp += "<div id=\"headlinesInnerContainer\" onscroll=\"headlines_scroll_handler()\">";
|
|
|
|
|
|
|
|
|
|
tmp += "<table class=\"headlinesList\" id=\"headlinesList\" cellspacing=\"0\">";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var rs;
|
|
|
|
|
|
|
|
|
|
var limit = 30;
|
|
|
|
|
|
|
|
|
|
var toolbar_form = document.forms["main_toolbar_form"];
|
|
|
|
|
|
|
|
|
|
var limit = toolbar_form.limit[toolbar_form.limit.selectedIndex].value;
|
|
|
|
|
var view_mode = toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value;
|
|
|
|
|
|
|
|
|
|
var limit_qpart = "";
|
|
|
|
|
var strategy_qpart = "";
|
|
|
|
|
var mode_qpart = "";
|
|
|
|
|
|
|
|
|
|
if (limit != 0) {
|
|
|
|
|
limit_qpart = "LIMIT " + limit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (view_mode == "all_articles") {
|
|
|
|
|
mode_qpart = "1";
|
|
|
|
|
} else if (view_mode == "adaptive") {
|
|
|
|
|
if (get_local_feed_unread(feed_id) > 0) {
|
|
|
|
|
mode_qpart = "unread = 1";
|
|
|
|
|
} else {
|
|
|
|
|
mode_qpart = "1";
|
|
|
|
|
}
|
|
|
|
|
} else if (view_mode == "marked") {
|
|
|
|
|
mode_qpart = "marked = 1";
|
|
|
|
|
} else if (view_mode == "unread") {
|
|
|
|
|
mode_qpart = "unread = 1";
|
|
|
|
|
} else {
|
|
|
|
|
mode_qpart = "1";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (feed_id > 0) {
|
|
|
|
|
strategy_qpart = "feed_id = " + feed_id;
|
|
|
|
|
} else if (feed_id == -1) {
|
|
|
|
|
strategy_qpart = "marked = 1";
|
|
|
|
|
} else if (feed_id == -4) {
|
|
|
|
|
strategy_qpart = "1";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var query = "SELECT * FROM articles WHERE " +
|
|
|
|
|
strategy_qpart +
|
|
|
|
|
" AND " + mode_qpart +
|
|
|
|
|
" ORDER BY updated DESC "+
|
|
|
|
|
limit_qpart;
|
|
|
|
|
|
|
|
|
|
var rs = db.execute(query);
|
|
|
|
|
|
|
|
|
|
var line_num = 0;
|
|
|
|
|
|
|
|
|
|
while (rs.isValidRow()) {
|
|
|
|
|
|
|
|
|
|
var id = rs.fieldByName("id");
|
|
|
|
|
var feed_id = rs.fieldByName("feed_id");
|
|
|
|
|
|
|
|
|
|
var marked_pic;
|
|
|
|
|
|
|
|
|
|
var row_class = (line_num % 2) ? "even" : "odd";
|
|
|
|
|
|
|
|
|
|
if (rs.fieldByName("unread") == "1") {
|
|
|
|
|
row_class += "Unread";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (rs.fieldByName("marked") == "1") {
|
|
|
|
|
marked_pic = "<img id=\"FMPIC-"+id+"\" "+
|
|
|
|
|
"src=\"images/mark_set.png\" class=\"markedPic\""+
|
|
|
|
|
"alt=\"Unstar article\" onclick='javascript:tMark("+id+")'>";
|
|
|
|
|
} else {
|
|
|
|
|
marked_pic = "<img id=\"FMPIC-"+id+"\" "+
|
|
|
|
|
"src=\"images/mark_unset.png\" class=\"markedPic\""+
|
|
|
|
|
"alt=\"Star article\" onclick='javascript:tMark("+id+")'>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var mouseover_attrs = "onmouseover='postMouseIn($id)' "+
|
|
|
|
|
"onmouseout='postMouseOut($id)'";
|
|
|
|
|
|
|
|
|
|
tmp += "<tr class='"+row_class+"' id='RROW-"+id+"' "+mouseover_attrs+">";
|
|
|
|
|
|
|
|
|
|
tmp += "<td class='hlUpdPic'> </td>";
|
|
|
|
|
|
|
|
|
|
tmp += "<td class='hlSelectRow'>"+
|
|
|
|
|
"<input type=\"checkbox\" onclick=\"tSR(this)\" id=\"RCHK-"+id+"\"></td>";
|
|
|
|
|
|
|
|
|
|
tmp += "<td class='hlMarkedPic'>"+marked_pic+"</td>";
|
|
|
|
|
|
|
|
|
|
tmp += "<td onclick='view("+id+","+feed_id+")' "+
|
|
|
|
|
"class='hlContent' valign='middle'>";
|
|
|
|
|
|
|
|
|
|
tmp += "<a target=\"_blank\" id=\"RTITLE-$id\" href=\"" +
|
|
|
|
|
rs.fieldByName("link") + "\"" +
|
|
|
|
|
"onclick=\"return view("+id+","+feed_id+");\">"+
|
|
|
|
|
rs.fieldByName("title");
|
|
|
|
|
|
|
|
|
|
var content_preview = truncate_string(strip_tags(rs.fieldByName("content")),
|
|
|
|
|
100);
|
|
|
|
|
|
|
|
|
|
tmp += "<span class=\"contentPreview\"> - "+content_preview+"</span>";
|
|
|
|
|
|
|
|
|
|
tmp += "</a>";
|
|
|
|
|
|
|
|
|
|
tmp += "</td>";
|
|
|
|
|
|
|
|
|
|
tmp += "<td class=\"hlUpdated\" onclick='view("+id+","+feed_id+")'>"+
|
|
|
|
|
"<nobr>"+rs.fieldByName("updated").substring(0,16)+"</nobr></td>";
|
|
|
|
|
|
|
|
|
|
tmp += "</tr>";
|
|
|
|
|
|
|
|
|
|
rs.next();
|
|
|
|
|
line_num++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (offset == 0) {
|
|
|
|
|
tmp += "</table>";
|
|
|
|
|
tmp += "</div></div>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (offset == 0) {
|
|
|
|
|
container.innerHTML = tmp;
|
|
|
|
|
} else {
|
|
|
|
|
var ids = getSelectedArticleIds2();
|
|
|
|
|
|
|
|
|
|
//container.innerHTML = container.innerHTML + tmp;
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < ids.length; i++) {
|
|
|
|
|
markHeadline(ids[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
remove_splash();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
exception_error("viewfeed_offline", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
|
|
|
|
|
try {
|
|
|
|
@ -1013,77 +793,4 @@ function request_counters() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function set_feedlist_counter(id, ctr) {
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
var feedctr = document.getElementById("FEEDCTR-" + id);
|
|
|
|
|
var feedu = document.getElementById("FEEDU-" + id);
|
|
|
|
|
var feedr = document.getElementById("FEEDR-" + id);
|
|
|
|
|
|
|
|
|
|
if (feedctr && feedu && feedr) {
|
|
|
|
|
|
|
|
|
|
var row_needs_hl = (ctr > 0 && ctr > parseInt(feedu.innerHTML));
|
|
|
|
|
|
|
|
|
|
feedu.innerHTML = ctr;
|
|
|
|
|
|
|
|
|
|
if (ctr > 0) {
|
|
|
|
|
feedctr.className = "feedCtrHasUnread";
|
|
|
|
|
if (!feedr.className.match("Unread")) {
|
|
|
|
|
var is_selected = feedr.className.match("Selected");
|
|
|
|
|
|
|
|
|
|
feedr.className = feedr.className.replace("Selected", "");
|
|
|
|
|
feedr.className = feedr.className.replace("Unread", "");
|
|
|
|
|
|
|
|
|
|
feedr.className = feedr.className + "Unread";
|
|
|
|
|
|
|
|
|
|
if (is_selected) {
|
|
|
|
|
feedr.className = feedr.className + "Selected";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (row_needs_hl) {
|
|
|
|
|
new Effect.Highlight(feedr, {duration: 1, startcolor: "#fff7d5",
|
|
|
|
|
queue: { position:'end', scope: 'EFQ-' + id, limit: 1 } } );
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
feedctr.className = "feedCtrNoUnread";
|
|
|
|
|
feedr.className = feedr.className.replace("Unread", "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
exception_error("set_feedlist_counter", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function update_local_feedlist_counters() {
|
|
|
|
|
try {
|
|
|
|
|
if (!db) return;
|
|
|
|
|
|
|
|
|
|
var rs = db.execute("SELECT feeds.id,COUNT(articles.id) "+
|
|
|
|
|
"FROM feeds LEFT JOIN articles ON (feed_id = feeds.id) "+
|
|
|
|
|
"WHERE unread = 1 OR unread IS NULL GROUP BY feeds.id "+
|
|
|
|
|
"ORDER BY feeds.title");
|
|
|
|
|
|
|
|
|
|
while (rs.isValidRow()) {
|
|
|
|
|
var id = rs.field(0);
|
|
|
|
|
var ctr = rs.field(1);
|
|
|
|
|
|
|
|
|
|
set_feedlist_counter(id, ctr);
|
|
|
|
|
|
|
|
|
|
rs.next();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set_feedlist_counter(-4, get_local_feed_unread(-4));
|
|
|
|
|
set_feedlist_counter(-1, get_local_feed_unread(-1));
|
|
|
|
|
|
|
|
|
|
hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
|
|
|
|
|
|
|
|
|
|
global_unread = get_local_feed_unread(-4);
|
|
|
|
|
updateTitle();
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
exception_error("update_local_feedlist_counters", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|