From: Andrew Dolgov Date: Thu, 18 Oct 2007 04:51:29 +0000 (+0100) Subject: rework feed-prefs ops toolbar X-Git-Tag: 1.2.16~5 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=c4a36709cdd6e27ea414d98c00a6f8607dda83a3;p=tt-rss.git rework feed-prefs ops toolbar --- diff --git a/functions.js b/functions.js index 0211d2f5..dab019c7 100644 --- a/functions.js +++ b/functions.js @@ -1716,3 +1716,5 @@ function getSelectedArticleIds2() { return ids; } + + diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php index 6df9804b..b8671c4e 100644 --- a/modules/pref-feeds.php +++ b/modules/pref-feeds.php @@ -983,16 +983,35 @@ print ""; print "

"; - - print " + + + + + + + "; + + if (get_pref($link, 'ENABLE_FEED_CATS')) { + + print " + + "; + } + + print ""; + + /* print " "; + value=\"".__('Unsubscribe')."\">"; */ if (get_pref($link, 'ENABLE_FEED_CATS')) { - print " | "; + print " | " . __('Selection:'); print_feed_cat_select($link, "sfeed_set_fcat", "", "disabled"); @@ -1005,9 +1024,9 @@ if (get_pref($link, 'ENABLE_FEED_CATS')) { - print " "; + __("Edit categories")."\">"; */ # print " | "; diff --git a/prefs.js b/prefs.js index ac07e8f0..3d95f01c 100644 --- a/prefs.js +++ b/prefs.js @@ -668,6 +668,38 @@ function removeSelectedFeeds() { return false; } +function clearSelectedFeeds() { + + if (!xmlhttp_ready(xmlhttp)) { + printLockingError(); + return + } + + var sel_rows = getSelectedFeeds(); + + if (sel_rows.length > 1) { + alert(__("Please select only one feed.")); + return; + } + + if (sel_rows.length > 0) { + + var ok = confirm(__("Erase all non-starred articles in selected feed?")); + + if (ok) { + notify_progress("Clearing selected feed..."); + clearFeedArticles(sel_rows[0]); + } + + } else { + + alert(__("No feeds are selected.")); + + } + + return false; +} + function removeSelectedFeedCats() { if (!xmlhttp_ready(xmlhttp)) { @@ -1781,3 +1813,55 @@ function validatePrefsSave() { return false; } + +function feedActionChange() { + try { + var chooser = document.getElementById("feedActionChooser"); + var opid = chooser[chooser.selectedIndex].value; + + chooser.selectedIndex = 0; + feedActionGo(opid); + } catch (e) { + exception_error("feedActionChange", e); + } +} + +function feedActionGo(op) { + try { + if (op == "facEdit") { + editSelectedFeed(); + } + + if (op == "facClear") { + clearSelectedFeeds(); + } + + if (op == "facPurge") { + purgeSelectedFeeds(); + } + + if (op == "facUnsubscribe") { + removeSelectedFeeds(); + } + + } catch (e) { + exception_error("feedActionGo", e); + + } +} + +function clearFeedArticles(feed_id) { + + notify_progress("Clearing feed..."); + + var query = "backend.php?op=pref-feeds&quiet=1&subop=clear&id=" + feed_id; + + new Ajax.Request(query, { + onComplete: function(transport) { + notify(''); + } }); + + return false; +} + + diff --git a/tt-rss.js b/tt-rss.js index e918af0f..a18f95cd 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -525,20 +525,6 @@ function unsubscribeFeed(feed_id) { return false; } -function clearFeedArticles(feed_id) { - - notify_progress("Clearing feed..."); - - var query = "backend.php?op=pref-feeds&quiet=1&subop=clear&id=" + feed_id; - - new Ajax.Request(query, { - onComplete: function(transport) { - dlg_frefresh_callback(transport, feed_id); - } }); - - return false; -} - function updateFeedTitle(t) { active_title_text = t; @@ -729,3 +715,18 @@ function labelEditSave() { } +function clearFeedArticles(feed_id) { + + notify_progress("Clearing feed..."); + + var query = "backend.php?op=pref-feeds&quiet=1&subop=clear&id=" + feed_id; + + new Ajax.Request(query, { + onComplete: function(transport) { + dlg_frefresh_callback(transport, feed_id); + } }); + + return false; +} + + diff --git a/tt-rss.php b/tt-rss.php index ca7dd216..caf8f9c4 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -134,7 +134,7 @@ window.onload = init; - +