implement a special dialog to show feeds without recent updates (closes #264)

master
Andrew Dolgov 14 years ago
parent a40de1af2c
commit 8ffd20110e

@ -537,6 +537,80 @@
//return;
}
if ($id == "inactiveFeeds") {
if (DB_TYPE == "pgsql") {
$interval_qpart = "NOW() - INTERVAL '3 months'";
} else {
$interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)";
}
$result = db_query($link, "SELECT ttrss_feeds.title, ttrss_feeds.site_url,
ttrss_feeds.feed_url, ttrss_feeds.id, MAX(updated) AS last_article
FROM ttrss_feeds, ttrss_entries, ttrss_user_entries WHERE
(SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
ttrss_entries.id = ref_id AND
ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart
AND ttrss_feeds.owner_uid = ".$_SESSION["uid"]." AND
ttrss_user_entries.feed_id = ttrss_feeds.id AND
ttrss_entries.id = ref_id
GROUP BY ttrss_feeds.title, ttrss_feeds.id, ttrss_feeds.site_url, ttrss_feeds.feed_url
ORDER BY last_article");
print __("These feeds have not been updated with new content for 3 months (oldest first):");
print "<div class=\"inactiveFeedHolder\">";
print "<table width=\"100%\" cellspacing=\"0\" id=\"prefInactiveFeedList\">";
$lnum = 1;
while ($line = db_fetch_assoc($result)) {
$class = ($lnum % 2) ? "even" : "odd";
$feed_id = $line["id"];
$this_row_id = "id=\"FUPDD-$feed_id\"";
print "<tr class=\"\" $this_row_id>";
$edit_title = htmlspecialchars($line["title"]);
print "<td width='5%' align='center'><input
onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\"></td>";
print "<td>";
print "<a target=\"_blank\" class=\"visibleLink\" href=\"".
htmlspecialchars($line["site_url"])."\">".
htmlspecialchars($line["title"])."</a> (".
"<a target=\"_blank\" class=\"visibleLink\"
href=\"".htmlspecialchars($line["feed_url"]).
"\">".__("feed")."</a>)";
print "</td><td class=\"insensitive\" align='right'>";
print make_local_datetime($link, $line['last_article']);
print "</td>";
print "</tr>";
++$lnum;
}
print "</table>";
print "</div>";
print "<div class='dlgButtons'>";
print "<div style='float : left'>";
print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('inactiveFeedsDlg').removeSelected()\">"
.__('Unsubscribe from selected feeds')."</button> ";
print "</div>";
print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('inactiveFeedsDlg').hide()\">".
__('Close this window')."</button>";
print "</div>";
}
if ($id == "feedUpdateErrors") {
print "<title>".__('Feeds with update errors')."</title>";

@ -1183,13 +1183,33 @@
if ($num_errors > 0) {
$error_button = "<button dojoType=\"dijit.form.Button\"
onclick=\"showFeedsWithErrors\" id=\"errorButton\">" .
onclick=\"showFeedsWithErrors()\" id=\"errorButton\">" .
__("Feeds with errors") . "</button>";
// print format_notice("<a href=\"javascript:showFeedsWithErrors()\">".
// __('Some feeds have update errors (click for details)')."</a>");
}
if (DB_TYPE == "pgsql") {
$interval_qpart = "NOW() - INTERVAL '3 months'";
} else {
$interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)";
}
$result = db_query($link, "SELECT COUNT(*) AS num_inactive FROM ttrss_feeds WHERE
(SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
ttrss_entries.id = ref_id AND
ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart AND
ttrss_feeds.owner_uid = ".$_SESSION["uid"]);
$num_inactive = db_fetch_result($result, 0, "num_inactive");
if ($num_inactive > 0) {
$inactive_button = "<button dojoType=\"dijit.form.Button\"
onclick=\"showInactiveFeeds()\">" .
__("Inactive feeds") . "</button>";
}
$feed_search = db_escape_string($_REQUEST["search"]);
if (array_key_exists("search", $_REQUEST)) {
@ -1233,6 +1253,7 @@
}
print $error_button;
print $inactive_button;
print "<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedFeeds()\">"
.__('Unsubscribe')."</button dojoType=\"dijit.form.Button\"> ";

@ -1191,6 +1191,61 @@ function showFeedsWithErrors() {
displayDlg('feedUpdateErrors');
}
function showInactiveFeeds() {
try {
var query = "backend.php?op=dlg&id=inactiveFeeds";
if (dijit.byId("inactiveFeedsDlg"))
dijit.byId("inactiveFeedsDlg").destroyRecursive();
dialog = new dijit.Dialog({
id: "inactiveFeedsDlg",
title: __("Feeds without recent updates"),
style: "width: 600px",
getSelectedFeeds: function() {
return getSelectedTableRowIds("prefInactiveFeedList");
},
removeSelected: function() {
var sel_rows = this.getSelectedFeeds();
console.log(sel_rows);
if (sel_rows.length > 0) {
var ok = confirm(__("Remove selected feeds?"));
if (ok) {
notify_progress("Removing selected feeds...", true);
var query = "?op=pref-feeds&subop=remove&ids="+
param_escape(sel_rows.toString());
new Ajax.Request("backend.php", {
parameters: query,
onComplete: function(transport) {
notify('');
dialog.hide();
updateFeedList();
} });
}
} else {
alert(__("No feeds are selected."));
}
},
execute: function() {
if (this.validate()) {
}
},
href: query});
dialog.show();
} catch (e) {
exception_error("showInactiveFeeds", e);
}
}
function opmlRegenKey() {
try {

@ -383,7 +383,7 @@ table.prefFeedList td.feedSelect {
text-align : center;
}
div.prefFeedCatHolder, div.prefFeedOPMLHolder {
div.prefFeedCatHolder, div.prefFeedOPMLHolder, div.inactiveFeedHolder {
height : 300px;
overflow : auto;
border-width : 0px 1px 1px 1px;
@ -393,7 +393,7 @@ div.prefFeedCatHolder, div.prefFeedOPMLHolder {
background-color : #ecf4ff;
}
div.prefFeedOPMLHolder {
div.prefFeedOPMLHolder, div.inactiveFeedHolder {
border-width : 1px 1px 1px 1px;
}

Loading…
Cancel
Save