viewfeed_offline: add some processing for main toolbar form

master
Andrew Dolgov 16 years ago
parent 67eb253178
commit 6a4a39b95e

@ -227,7 +227,7 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off
rs = db.execute("SELECT title FROM feeds WHERE id = ?", [feed_id]); rs = db.execute("SELECT title FROM feeds WHERE id = ?", [feed_id]);
if (rs.isValidRow() || feed_id == -1) { if (rs.isValidRow() || feed_id == -1 || feed_id == -4) {
feed_title = rs.field(0); feed_title = rs.field(0);
@ -235,6 +235,10 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off
feed_title = __("Starred articles"); feed_title = __("Starred articles");
} }
if (feed_id == -4) {
feed_title = __("All articles");
}
if (offset == 0) { if (offset == 0) {
tmp += "<div id=\"headlinesContainer\">"; tmp += "<div id=\"headlinesContainer\">";
@ -266,14 +270,53 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off
var rs; 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) { if (feed_id > 0) {
rs = db.execute("SELECT * FROM articles WHERE feed_id = ? "+ strategy_qpart = "feed_id = " + feed_id;
"ORDER BY updated DESC", [feed_id]); } else if (feed_id == -1) {
} else if (feed_id = -1) { strategy_qpart = "marked = 1";
rs = db.execute("SELECT * FROM articles WHERE marked = 1 "+ } else if (feed_id == -4) {
"ORDER BY updated DESC"); 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; var line_num = 0;
while (rs.isValidRow()) { while (rs.isValidRow()) {

Loading…
Cancel
Save