if ($op == "dlg") {
$id = $_GET["id"];
+ $param = $_GET["param"];
if ($id == "quickAddFeed") {
print "Feed URL: <input id=\"qafInput\">
type=\"submit\" onclick=\"javascript:closeDlg()\"
value=\"Cancel\">";
}
+
+ if ($id == "quickDelFeed") {
+
+ $param = db_escape_string($param);
+
+ $result = db_query($link, "SELECT title FROM ttrss_feeds WHERE id = '$param'");
+
+ if ($result) {
+
+ $f_title = db_fetch_result($result, 0, "title");
+
+ print "Remove current feed ($f_title)?
+ <input class=\"button\"
+ type=\"submit\" onclick=\"javascript:qfdDelete($param)\" value=\"Remove\">
+ <input class=\"button\"
+ type=\"submit\" onclick=\"javascript:closeDlg()\"
+ value=\"Cancel\">";
+ } else {
+ print "Error: Feed $param not found.
+ <input class=\"button\"
+ type=\"submit\" onclick=\"javascript:closeDlg()\"
+ value=\"Cancel\">";
+ }
+ }
+
}
db_close($link);
updateFeedList();
}
-function qaf_add_callback() {
+function dlg_frefresh_callback() {
if (xmlhttp.readyState == 4) {
updateFeedList(false, false);
closeDlg();
var opname = chooser[chooser.selectedIndex].text;
- if (opname == "Preferences") {
+ if (opname.match("Preferences")) {
gotoPreferences();
}
- if (opname == "Add new feed") {
+ if (opname.match("Add new feed")) {
displayDlg("quickAddFeed");
+ return;
+ }
+
+ if (opname.match("Remove this feed")) {
+ var actid = getActiveFeedId();
+
+ if (!actid) {
+ notify("Please select some feed first.");
+ return;
+ }
+
+ displayDlg("quickDelFeed", actid);
+ return;
}
+
}
function qafAdd() {
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=add&link=" +
param_escape(link.value), true);
- xmlhttp.onreadystatechange=qaf_add_callback;
+ xmlhttp.onreadystatechange=dlg_frefresh_callback;
xmlhttp.send(null);
link.value = "";
}
}
-function displayDlg(id) {
+function displayDlg(id, param) {
xmlhttp.open("GET", "backend.php?op=dlg&id=" +
- param_escape(id), true);
+ param_escape(id) + "¶m=" + param_escape(param), true);
xmlhttp.onreadystatechange=dialog_refresh_callback;
xmlhttp.send(null);
dlg.style.display = "none";
}
+function qfdDelete(feed_id) {
+
+ notify("Removing feed...");
+
+ var feeds_doc = window.frames["feeds-frame"].document;
+ feeds_doc.location.href = "backend.php?op=error&msg=Loading,%20please wait...";
+
+ xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids=" + feed_id);
+ xmlhttp.onreadystatechange=dlg_frefresh_callback;
+ xmlhttp.send(null);
+
+}
</td>
<td align="right">
- <select id="quickMenuChooser">
+ Actions: <select id="quickMenuChooser">
<option selected>Preferences</option>
- <option>Add new feed</option>
+ <option disabled>-----</option>
+ <option disabled>Feed actions:</option>
+ <option> Add new feed</option>
+ <option> Remove this feed</option>
<!-- <option>Edit this feed</option> -->
</select>
<input type="submit" class="button" onclick="quickMenuGo()" value="Go">