From fbff72e081e812926f89e608cf7af1b7d8c841cb Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 30 May 2013 01:43:52 -0400 Subject: [PATCH] hide purge options when config.php has forced things Showing the purging options to the user isn't useful when the server's config.php has forced a global setting. Rather than mark them disabled, omit them entirely. This cleans up the UI and simplifies the code a bit. --- classes/pref/feeds.php | 2 ++ classes/pref/prefs.php | 22 ++++++---------------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index 8249f756..d6abe232 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -600,6 +600,7 @@ class Pref_Feeds extends Handler_Protected { /* Purge intl */ + if (FORCE_ARTICLE_PURGE == 0) { $purge_interval = $row["purge_interval"]; print "
"; @@ -608,6 +609,7 @@ class Pref_Feeds extends Handler_Protected { print_select_hash("purge_interval", $purge_interval, $purge_intervals, 'dojoType="dijit.form.Select" ' . ((FORCE_ARTICLE_PURGE == 0) ? "" : 'disabled="1"')); + } print ""; diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index 0ae3e1bb..81b19cfb 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -174,6 +174,8 @@ class Pref_Prefs extends Handler_Protected { $digest_options = array("DIGEST_ENABLE", "DIGEST_CATCHUP", "DIGEST_PREFERRED_TIME"); + $purge_options = array("PURGE_UNREAD_ARTICLES", "PURGE_OLD_DAYS"); + $_SESSION["prefs_op_result"] = ""; print "
"; @@ -504,6 +506,8 @@ class Pref_Prefs extends Handler_Protected { } /* Hide options from the user that are disabled in config.php. */ + if (FORCE_ARTICLE_PURGE && in_array($pref_name, $purge_options)) + continue; if (DIGEST_SUBJECT === false && in_array($pref_name, $digest_options)) continue; @@ -575,14 +579,7 @@ class Pref_Prefs extends Handler_Protected { $checked = ($value == "true") ? "checked=\"checked\"" : ""; - if ($pref_name == "PURGE_UNREAD_ARTICLES" && FORCE_ARTICLE_PURGE != 0) { - $disabled = "disabled=\"1\""; - $checked = "checked=\"checked\""; - } else { - $disabled = ""; - } - - print ""; } else if (array_search($pref_name, array('FRESH_ARTICLE_MAX_AGE', @@ -590,15 +587,8 @@ class Pref_Prefs extends Handler_Protected { $regexp = ($type_name == 'integer') ? 'regexp="^\d*$"' : ''; - if ($pref_name == "PURGE_OLD_DAYS" && FORCE_ARTICLE_PURGE != 0) { - $disabled = "disabled=\"1\""; - $value = FORCE_ARTICLE_PURGE; - } else { - $disabled = ""; - } - print ""; } else if ($pref_name == "SSL_CERT_SERIAL") { -- 2.39.2