From ad815c71ea70998c1fab0de1fd74e5507799cd60 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 20 Mar 2006 15:30:51 +0100 Subject: [PATCH] simplify update/purge interval selection --- backend.php | 82 ++++++++++++++++++++++++++++++++++++++++++++--------- prefs.js | 10 +++++-- 2 files changed, 76 insertions(+), 16 deletions(-) diff --git a/backend.php b/backend.php index ba73e1a0f..b83ea4496 100644 --- a/backend.php +++ b/backend.php @@ -54,6 +54,25 @@ require_once "functions.php"; require_once "magpierss/rss_fetch.inc"; + $purge_intervals = array( + 0 => "Default", + -1 => "Never purge", + 5 => "1 week", + 14 => "2 weeks", + 31 => "1 month", + 60 => "2 months", + 90 => "3 months"); + + $update_intervals = array( + 0 => "Default", + -1 => "Disable updates", + 30 => "30 minutes", + 60 => "1 hour", + 240 => "4 hours", + 720 => "12 hours", + 1440 => "Daily", + 10080 => "Weekly"); + $script_started = getmicrotime(); $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); @@ -1942,7 +1961,7 @@ print "Feed URL:"; print ""; - + if (get_pref($link, 'ENABLE_FEED_CATS')) { $cat_id = db_fetch_result($result, 0, "cat_id"); @@ -1980,8 +1999,26 @@ $row_class = toggleEvenOdd($row_class); print "Update Interval:"; - print ""; +// print ""; + + print ""; + + print ""; + + print ""; $row_class = toggleEvenOdd($row_class); print "Link to:"; @@ -2034,8 +2071,26 @@ $row_class = toggleEvenOdd($row_class); print "Purge Days:"; - print ""; +// print ""; + + print ""; + + print ""; + + print ""; // print "Authentication"; @@ -2411,7 +2466,7 @@ Title Feed Update Interval - Purge Days"; + Purge Interval"; } $lnum = 0; @@ -2427,14 +2482,13 @@ $edit_link = htmlspecialchars(db_unescape_string($line["feed_url"])); $edit_cat = htmlspecialchars(db_unescape_string($line["category"])); - if ($line["update_interval"] == "0") $line["update_interval"] = "Default"; - if ($line["update_interval"] == "-1") $line["update_interval"] = "Disabled"; - if ($line["purge_interval"] == "0") $line["purge_interval"] = "Default"; - if ($line["purge_interval"] < 0) $line["purge_interval"] = "Disabled"; +// if ($line["update_interval"] == "0") $line["update_interval"] = "Default"; +// if ($line["update_interval"] == "-1") $line["update_interval"] = "Disabled"; +// if ($line["purge_interval"] == "0") $line["purge_interval"] = "Default"; +// if ($line["purge_interval"] < 0) $line["purge_interval"] = "Disabled"; if (!$edit_cat) $edit_cat = "Uncategorized"; - if (get_pref($link, 'ENABLE_FEED_CATS') && $cur_cat_id != $cat_id) { $lnum = 0; @@ -2445,7 +2499,7 @@ Title Feed Update Interval - Purge Days"; + Purge Interval"; $cur_cat_id = $cat_id; } @@ -2488,10 +2542,10 @@ } */ print "" . - $line["update_interval"] . ""; + $update_intervals[$line["update_interval"]] . ""; print "" . - $line["purge_interval"] . ""; + $purge_intervals[$line["purge_interval"]] . ""; print ""; diff --git a/prefs.js b/prefs.js index 8d15d5c22..ce9e8289c 100644 --- a/prefs.js +++ b/prefs.js @@ -697,8 +697,14 @@ function feedEditSave() { var link = document.getElementById("iedit_link").value; var title = document.getElementById("iedit_title").value; - var upd_intl = document.getElementById("iedit_updintl").value; - var purge_intl = document.getElementById("iedit_purgintl").value; + var upd_intl = document.getElementById("iedit_updintl"); + + upd_intl = upd_intl[upd_intl.selectedIndex].id; + + var purge_intl = document.getElementById("iedit_purgintl"); + + purge_intl = purge_intl[purge_intl.selectedIndex].id; + var fcat = document.getElementById("iedit_fcat"); var is_pvt = document.getElementById("iedit_private");