From 5d538f4f180e4ffb6dfe00e999373f9e089a1cb4 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 11 Sep 2008 07:45:39 +0100 Subject: [PATCH] batch feed editor: add workaround for Form.serialize() ignoring unchecked checkboxes --- modules/pref-feeds.php | 8 ++++++++ prefs.js | 32 +++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php index 522021917..24996eea9 100644 --- a/modules/pref-feeds.php +++ b/modules/pref-feeds.php @@ -655,6 +655,14 @@ $qpart = "include_in_digest = '$include_in_digest'"; break; + case "cache_images": + $qpart = "cache_images = '$cache_images'"; + break; + + case "rtl_content": + $qpart = "rtl_content = '$rtl_content'"; + break; + case "update_method": $qpart = "update_method = '$update_method'"; break; diff --git a/prefs.js b/prefs.js index 72b72fcba..2f8ca4c3b 100644 --- a/prefs.js +++ b/prefs.js @@ -2250,11 +2250,41 @@ function feedsEditSave() { return } - var ok = confirm(__("Save changes to selected feeds?")); +// var ok = confirm(__("Save changes to selected feeds?")); + var ok = true; if (ok) { + var f = document.forms["batch_edit_feed_form"]; + var query = Form.serialize("batch_edit_feed_form"); + + /* Form.serialize ignores unchecked checkboxes */ + + if (!query.match("hidden=") && + f.hidden.disabled == false) { + query = query + "&hidden=false"; + } + + if (!query.match("rtl_content=") && + f.rtl_content.disabled == false) { + query = query + "&rtl_content=false"; + } + + if (!query.match("private=") && + f.private.disabled == false) { + query = query + "&private=false"; + } + + if (!query.match("cache_images=") && + f.cache_images.disabled == false) { + query = query + "&cache_images=false"; + } + + if (!query.match("include_in_digest=") && + f.include_in_digest.disabled == false) { + query = query + "&include_in_digest=false"; + } closeInfoBox();