add edit feed link into firefox from-rss subscribe dialog

This commit is contained in:
Andrew Dolgov 2006-12-18 06:56:55 +01:00
parent d507dfd50d
commit e513a74a6b
3 changed files with 51 additions and 10 deletions

View File

@ -428,7 +428,7 @@
$cat_id = db_escape_string($_GET["cat_id"]); $cat_id = db_escape_string($_GET["cat_id"]);
$p_from = db_escape_string($_GET["from"]); $p_from = db_escape_string($_GET["from"]);
if ($p_from) { if ($p_from != 'tt-rss') {
print "<html> print "<html>
<head> <head>
<title>Tiny Tiny RSS - Subscribe to feed...</title> <title>Tiny Tiny RSS - Subscribe to feed...</title>
@ -437,26 +437,42 @@
<body> <body>
<img class=\"logo\" src=\"images/ttrss_logo.png\" <img class=\"logo\" src=\"images/ttrss_logo.png\"
alt=\"Tiny Tiny RSS\"/> alt=\"Tiny Tiny RSS\"/>
<h1>Subscribe to feed...</h1>"; <h1>Subscribe to feed...</h1>
<div class=\"content\">";
} }
if (subscribe_to_feed($link, $feed_url, $cat_id)) { if (subscribe_to_feed($link, $feed_url, $cat_id)) {
print "Added feed."; print "Subscribed to <b>$feed_url</b>.";
} else { } else {
print "<div class=\"warning\"> print "<div class=\"warning\">
Feed <b>$feed_url</b> already exists in the database. Already subscribed to <b>$feed_url</b>.
</div>"; </div>";
} }
if ($p_from) { if ($p_from != 'tt-rss') {
$tt_uri = 'http://' . $_SERVER['SERVER_NAME'] . $tt_uri = 'http://' . $_SERVER['SERVER_NAME'] .
preg_replace('/backend\.php.*$/', preg_replace('/backend\.php.*$/',
'tt-rss.php', $_SERVER["REQUEST_URI"]); 'tt-rss.php', $_SERVER["REQUEST_URI"]);
print "<p><a href='$tt_uri'>Return to Tiny Tiny RSS</a> or $tp_uri = 'http://' . $_SERVER['SERVER_NAME'] .
<a href='javascript:window.close()'>close this window</a>.</p>"; preg_replace('/backend\.php.*$/',
'prefs.php', $_SERVER["REQUEST_URI"]);
print "</body></html>"; print "<p><a href='$tt_uri'>Return to Tiny Tiny RSS</a> |";
$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 "<a href='$tp_uri?tab=feedConfig&subop=editFeed:$feed_id'>
Edit subscription options</a> | ";
}
print "<a href='javascript:window.close()'>Close this window</a>.</p>";
print "</div></body></html>";
return; return;
} }
} }

View File

@ -12,6 +12,8 @@ var xmlhttp = Ajax.getTransport();
var init_params = new Array(); var init_params = new Array();
var caller_subop = false;
function expand_feed_callback() { function expand_feed_callback() {
if (xmlhttp.readyState == 4) { if (xmlhttp.readyState == 4) {
try { try {
@ -31,6 +33,16 @@ function feedlist_callback() {
var container = document.getElementById('prefContent'); var container = document.getElementById('prefContent');
container.innerHTML=xmlhttp.responseText; container.innerHTML=xmlhttp.responseText;
selectTab("feedConfig", true); 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(""); notify("");
} catch (e) { } catch (e) {
exception_error("feedlist_callback", e); exception_error("feedlist_callback", e);
@ -206,7 +218,7 @@ function addFeed() {
} else { } else {
notify("Adding feed..."); 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); param_escape(link.value), true);
xmlhttp.onreadystatechange=feedlist_callback; xmlhttp.onreadystatechange=feedlist_callback;
xmlhttp.send(null); xmlhttp.send(null);
@ -1109,7 +1121,7 @@ function updatePrefsList() {
} }
function selectTab(id, noupdate) { function selectTab(id, noupdate, subop) {
// alert(id); // alert(id);
@ -1239,6 +1251,14 @@ function init_second_stage() {
document.onkeydown = pref_hotkey_handler; document.onkeydown = pref_hotkey_handler;
var tab = getURLParam('tab');
caller_subop = getURLParam('subop');
if (tab) {
active_tab = tab;
}
if (navigator.userAgent.match("Opera")) { if (navigator.userAgent.match("Opera")) {
setTimeout("selectTab()", 500); setTimeout("selectTab()", 500);
} else { } else {

View File

@ -19,3 +19,8 @@ a:hover {
img.logo { img.logo {
float : right; float : right;
} }
div.content {
padding : 1em;
border : 1px solid #88b0ff;
}