From: Andrew Dolgov Date: Tue, 3 Feb 2009 13:11:44 +0000 (+0300) Subject: implement dumb article downloader X-Git-Tag: 1.3.1~131 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=6a1cd59192bf4319b90319f7d623fae9011728ff;p=tt-rss.git implement dumb article downloader --- diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php index 55ab73a2..53635f96 100644 --- a/modules/backend-rpc.php +++ b/modules/backend-rpc.php @@ -516,6 +516,10 @@ if ($subop == "download") { $stage = (int) $_REQUEST["stage"]; + $amount = (int) $_REQUEST["amount"]; + $unread_only = db_escape_string($_REQUEST["unread_only"]); + + if (!$amount) $amount = 50; print ""; @@ -537,6 +541,43 @@ } + if ($stage > 0) { + + print ""; + + $limit = 50; + $skip = $limit*($stage-1); + + if ($amount > 0) $amount -= $skip; + + if ($amount > 0) { + + $limit = min($limit, $amount); + + if ($unread_only) { + $unread_qpart = "unread = true AND "; + } + + $result = db_query($link, + "SELECT DISTINCT id,title,guid,link, + feed_id,content,updated,unread,marked FROM + ttrss_user_entries,ttrss_entries + WHERE $unread_qpart + ref_id = id AND owner_uid = ".$_SESSION["uid"]." + ORDER BY updated DESC LIMIT $limit OFFSET $skip"); + + while ($line = db_fetch_assoc($result)) { + print "
"; + } + + } + + print "
"; + + } + print "
"; return; diff --git a/modules/popup-dialog.php b/modules/popup-dialog.php index d89547fe..e62f84e9 100644 --- a/modules/popup-dialog.php +++ b/modules/popup-dialog.php @@ -474,20 +474,22 @@ $amount = array( 50 => 50, 100 => 100, - 0 => "All unread"); + 250 => 250); print_select_hash("amount", 50, $amount); print " " . __("newest articles for offline reading."); + print "
"; + + print ""; + print ""; + print ""; print ""; print "
-
-
-
0) { + window.setTimeout("initiate_offline_download("+(stage+1)+")", 50); + } + } - new Effect.Scale(o, p, { - scaleY : false, - scaleFrom : download_progress_last, - scaleMode: { originalWidth : 100 }, - queue: { position: 'end', scope: 'LSP-Q', limit: 3 } }); + notify_info("All done."); - download_progress_last = p; + } } catch (e) { - exception_error("download_progress", e); + exception_error("offline_download_parse", e); } } @@ -1587,8 +1589,7 @@ function initiate_offline_download(stage) { if (!stage) stage = 0; - notify_progress("Loading, please wait... S" + stage, true); - download_set_progress(20); + notify_progress("Loading, please wait... (" + stage +")", true); var query = "backend.php?op=rpc&subop=download&stage=" + stage;