From 758e1c4ad905d10a31e0749ec22973b8a4055764 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 11 Sep 2008 07:06:25 +0100 Subject: [PATCH] implement (incomplete) batch feed editor --- modules/pref-feeds.php | 159 +++++++++++++++++++++++++++++++++++++++++ prefs.js | 78 ++++++++++++++++++++ 2 files changed, 237 insertions(+) diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php index 50b8013e..7a3695da 100644 --- a/modules/pref-feeds.php +++ b/modules/pref-feeds.php @@ -1,5 +1,10 @@ "; + } + function module_pref_feeds($link) { global $update_intervals; @@ -378,6 +383,159 @@ return; } + if ($subop == "editfeeds") { + + $feed_ids = db_escape_string($_REQUEST["ids"]); + + print "
".__('Batch Feed Editor')."
"; + + print "
"; + + print "[$feed_ids]
"; + + print "
"; + + print ""; + print ""; + print ""; + + print "
".__("Feed")."
"; + print "
"; + + /* Title */ + + print ""; + + batch_edit_cbox("title"); + + /* Feed URL */ + + print "
"; + + print __('URL:') . " "; + print ""; + + batch_edit_cbox("feed_url"); + + /* Category */ + + if (get_pref($link, 'ENABLE_FEED_CATS')) { + + print "
"; + + print __('Place in category:') . " "; + + print_feed_cat_select($link, "cat_id", $cat_id, "disabled"); + + batch_edit_cbox("cat_id"); + + } + + print "
"; + + print "
".__("Update")."
"; + print "
"; + + /* Update Interval */ + + print_select_hash("update_interval", $update_interval, $update_intervals, + "disabled"); + + batch_edit_cbox("update_interval"); + + /* Update method */ + + if (ALLOW_SELECT_UPDATE_METHOD) { + print " " . __('using') . " "; + print_select_hash("update_method", $update_method, $update_methods, + "disabled"); + batch_edit_cbox("update_method"); + } + + /* Purge intl */ + + print "
"; + + print __('Article purging:') . " "; + + print_select_hash("purge_interval", $purge_interval, $purge_intervals, + "disabled"); + + batch_edit_cbox("purge_interval"); + + print "
"; + print "
".__("Authentication")."
"; + print "
"; + + print __('Login:') . " "; + print ""; + + batch_edit_cbox("auth_login"); + + print " " . __("Password:") . " "; + + print ""; + + batch_edit_cbox("auth_pass"); + + print "
"; + print "
".__("Options")."
"; + print "
"; + + print "
"; + + print " "; + + print " "; batch_edit_cbox("private", "private_l"); + + print "
 "; + + print " "; batch_edit_cbox("rtl_content", "rtl_content_l"); + + print "
 "; + + print " "; batch_edit_cbox("hidden", "hidden_l"); + + print "
 "; + + print " "; batch_edit_cbox("include_in_digest", "include_in_digest_l"); + + print "
 "; + + + if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) { + print " "; batch_edit_cbox("cache_images", "cache_images_l"); + } + + print "
"; + print "
"; + + print "
"; + + print "
+ + +
"; + + return; + } + if ($subop == "editSave") { $feed_title = db_escape_string(trim($_POST["title"])); @@ -1113,6 +1271,7 @@ + diff --git a/prefs.js b/prefs.js index 7baea6a2..b8422391 100644 --- a/prefs.js +++ b/prefs.js @@ -1188,6 +1188,34 @@ function editSelectedFeed() { } +function editSelectedFeeds() { + + if (!xmlhttp_ready(xmlhttp)) { + printLockingError(); + return + } + + var rows = getSelectedFeeds(); + + if (rows.length == 0) { + alert(__("No feeds are selected.")); + return; + } + + notify(""); + + disableHotkeys(); + + notify_progress("Loading, please wait..."); + + xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editfeeds&ids=" + + param_escape(rows.toString()), true); + + xmlhttp.onreadystatechange=infobox_callback; + xmlhttp.send(null); + +} + function editSelectedFeedCat() { var rows = getSelectedFeedCats(); @@ -2096,6 +2124,10 @@ function feedActionGo(op) { removeSelectedFeeds(); } + if (op == "facBatchEdit") { + editSelectedFeeds(); + } + } catch (e) { exception_error("feedActionGo", e); @@ -2210,3 +2242,49 @@ function unsubscribeFeed(id, title) { } +function feedsEditSave() { + try { + + if (!xmlhttp_ready(xmlhttp)) { + printLockingError(); + return + } + + var query = Form.serialize("batch_edit_feed_form"); + + alert(query); + + return false; + } catch (e) { + exception_error("feedsEditSave", e); + } +} + +function batchFeedsToggleField(cb, elem, label) { + try { + var f = document.forms["batch_edit_feed_form"]; + var l = document.getElementById(label); + + if (cb.checked) { + f[elem].disabled = false; + + if (l) { + l.className = ""; + }; + +// new Effect.Highlight(f[elem], {duration: 1, startcolor: "#fff7d5", +// queue: { position:'end', scope: 'BPEFQ', limit: 1 } } ); + + } else { + f[elem].disabled = true; + + if (l) { + l.className = "insensitive"; + }; + + } + } catch (e) { + exception_error("batchFeedsToggleField", e); + } +} + -- 2.39.5