From: Andrew Dolgov Date: Wed, 22 Nov 2006 10:11:41 +0000 (+0100) Subject: add quick action to edit current feed X-Git-Tag: 1.2.6~41 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=7086277caf21c8107c97072126bf6b4058a50593;p=tt-rss.git add quick action to edit current feed --- diff --git a/feedlist.js b/feedlist.js index 954215fe..53fc4c6e 100644 --- a/feedlist.js +++ b/feedlist.js @@ -176,6 +176,11 @@ function feedlist_init() { correctPNG(); } + if (getActiveFeedId()) { + debug("some feed is open on feedlist refresh, reloading"); + setTimeout("viewCurrentFeed()", 100); + } + } catch (e) { exception_error("feedlist/init", e); } diff --git a/tt-rss.js b/tt-rss.js index bf673174..472c90a6 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -453,6 +453,10 @@ function quickMenuGo(opid) { displayDlg("quickAddFeed"); return; } + + if (opid == "qmcEditFeed") { + editFeedDlg(getActiveFeedId()); + } if (opid == "qmcRemoveFeed") { var actid = getActiveFeedId(); @@ -596,4 +600,57 @@ function userSwitch() { window.location = "tt-rss.php?swu=" + user; } +function editFeedDlg(feed) { + + if (!feed) { + alert("Please select some feed first."); + return; + } + + if (xmlhttp_ready(xmlhttp)) { + xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" + + param_escape(feed), true); + xmlhttp.onreadystatechange=infobox_callback; + xmlhttp.send(null); + } else { + printLockingError(); + } +} + +/* this functions duplicate those of prefs.js feed editor, with + some differences because there is no feedlist */ + +function feedEditCancel() { + closeInfoBox(); + return false; +} + +function feedEditSave() { + + try { + + if (!xmlhttp_ready(xmlhttp)) { + printLockingError(); + return + } + + // FIXME: add parameter validation + + var query = Form.serialize("edit_feed_form"); + + notify("Saving feed..."); + + xmlhttp.open("POST", "backend.php", true); + xmlhttp.onreadystatechange=dlg_frefresh_callback; + xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xmlhttp.send(query); + + closeInfoBox(); + + return false; + + } catch (e) { + exception_error("feedEditSave (main)", e); + } +} diff --git a/tt-rss.php b/tt-rss.php index 8531c4ca..5ad9c004 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -134,6 +134,7 @@ window.onload = init; +