From e513a74a6b37a3a406686e0f3cbe9011265d1453 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 18 Dec 2006 06:56:55 +0100 Subject: add edit feed link into firefox from-rss subscribe dialog --- modules/pref-feeds.php | 32 ++++++++++++++++++++++++-------- prefs.js | 24 ++++++++++++++++++++++-- quicksub.css | 5 +++++ 3 files changed, 51 insertions(+), 10 deletions(-) diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php index 0572978dd..1ea63c96f 100644 --- a/modules/pref-feeds.php +++ b/modules/pref-feeds.php @@ -428,7 +428,7 @@ $cat_id = db_escape_string($_GET["cat_id"]); $p_from = db_escape_string($_GET["from"]); - if ($p_from) { + if ($p_from != 'tt-rss') { print " Tiny Tiny RSS - Subscribe to feed... @@ -437,26 +437,42 @@ \"Tiny -

Subscribe to feed...

"; +

Subscribe to feed...

+
"; } if (subscribe_to_feed($link, $feed_url, $cat_id)) { - print "Added feed."; + print "Subscribed to $feed_url."; } else { print "
- Feed $feed_url already exists in the database. + Already subscribed to $feed_url.
"; } - if ($p_from) { + if ($p_from != 'tt-rss') { $tt_uri = 'http://' . $_SERVER['SERVER_NAME'] . preg_replace('/backend\.php.*$/', 'tt-rss.php', $_SERVER["REQUEST_URI"]); - print "

Return to Tiny Tiny RSS or - close this window.

"; + $tp_uri = 'http://' . $_SERVER['SERVER_NAME'] . + preg_replace('/backend\.php.*$/', + 'prefs.php', $_SERVER["REQUEST_URI"]); + + print "

Return to Tiny Tiny RSS |"; + + $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE + feed_url = '$feed_url' AND owner_uid = " . $_SESSION["uid"]); + + $feed_id = db_fetch_result($result, 0, "id"); + + if ($feed_id) { + print " + Edit subscription options | "; + } + + print "Close this window.

"; - print ""; + print "
"; return; } } diff --git a/prefs.js b/prefs.js index 21aa56f54..a072ef03c 100644 --- a/prefs.js +++ b/prefs.js @@ -12,6 +12,8 @@ var xmlhttp = Ajax.getTransport(); var init_params = new Array(); +var caller_subop = false; + function expand_feed_callback() { if (xmlhttp.readyState == 4) { try { @@ -31,6 +33,16 @@ function feedlist_callback() { var container = document.getElementById('prefContent'); container.innerHTML=xmlhttp.responseText; selectTab("feedConfig", true); + + if (caller_subop) { + var tuple = caller_subop.split(":"); + if (tuple[0] == 'editFeed') { + window.setTimeout('editFeed('+tuple[1]+')', 100); + } + + caller_subop = false; + } + notify(""); } catch (e) { exception_error("feedlist_callback", e); @@ -206,7 +218,7 @@ function addFeed() { } else { notify("Adding feed..."); - xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=add&feed_url=" + + xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=add&from=tt-rss&feed_url=" + param_escape(link.value), true); xmlhttp.onreadystatechange=feedlist_callback; xmlhttp.send(null); @@ -1109,7 +1121,7 @@ function updatePrefsList() { } -function selectTab(id, noupdate) { +function selectTab(id, noupdate, subop) { // alert(id); @@ -1239,6 +1251,14 @@ function init_second_stage() { document.onkeydown = pref_hotkey_handler; + var tab = getURLParam('tab'); + + caller_subop = getURLParam('subop'); + + if (tab) { + active_tab = tab; + } + if (navigator.userAgent.match("Opera")) { setTimeout("selectTab()", 500); } else { diff --git a/quicksub.css b/quicksub.css index 931371dca..4f4786289 100644 --- a/quicksub.css +++ b/quicksub.css @@ -19,3 +19,8 @@ a:hover { img.logo { float : right; } + +div.content { + padding : 1em; + border : 1px solid #88b0ff; +} -- cgit v1.2.3