diff options
Diffstat (limited to 'classes/pref/prefs.php')
-rw-r--r-- | classes/pref/prefs.php | 89 |
1 files changed, 47 insertions, 42 deletions
diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index af827af58..4af0bef33 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -101,20 +101,23 @@ class Pref_Prefs extends Handler_Protected { $value = $_POST[$pref_name]; - if ($pref_name == 'DIGEST_PREFERRED_TIME') { - if (get_pref('DIGEST_PREFERRED_TIME') != $value) { + switch ($pref_name) { + case 'DIGEST_PREFERRED_TIME': + if (get_pref('DIGEST_PREFERRED_TIME') != $value) { - $sth = $this->pdo->prepare("UPDATE ttrss_users SET + $sth = $this->pdo->prepare("UPDATE ttrss_users SET last_digest_sent = NULL WHERE id = ?"); - $sth->execute([$_SESSION['uid']]); - - } - } + $sth->execute([$_SESSION['uid']]); - if ($pref_name == "USER_LANGUAGE") { - if ($_SESSION["language"] != $value) { - $need_reload = true; - } + } + break; + case 'USER_LANGUAGE': + if (!$need_reload) $need_reload = $_SESSION["language"] != $value; + break; + + case 'USER_CSS_THEME': + if (!$need_reload) $need_reload = get_pref($pref_name) != $value; + break; } set_pref($pref_name, $value); @@ -176,7 +179,8 @@ class Pref_Prefs extends Handler_Protected { $_SESSION["prefs_op_result"] = ""; print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">"; - print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Personal data / Authentication')."\">"; + print "<div dojoType=\"dijit.layout.AccordionPane\" + title=\"<i class='material-icons'>person</i> ".__('Personal data / Authentication')."\">"; print "<form dojoType=\"dijit.form.Form\" id=\"changeUserdataForm\">"; @@ -422,7 +426,8 @@ class Pref_Prefs extends Handler_Protected { print "</div>"; #pane - print "<div dojoType=\"dijit.layout.AccordionPane\" selected=\"true\" title=\"".__('Preferences')."\">"; + print "<div dojoType=\"dijit.layout.AccordionPane\" selected=\"true\" + title=\"<i class='material-icons'>settings</i> ".__('Preferences')."\">"; print "<form dojoType=\"dijit.form.Form\" id=\"changeSettingsForm\">"; @@ -454,13 +459,9 @@ class Pref_Prefs extends Handler_Protected { $profile = $_SESSION["profile"]; - if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null; - if ($profile) { print_notice(__("Some preferences are only available in default profile.")); - } - if ($_SESSION["profile"]) { initialize_user_prefs($_SESSION["uid"], $profile); } else { initialize_user_prefs($_SESSION["uid"]); @@ -544,20 +545,29 @@ class Pref_Prefs extends Handler_Protected { print_select($pref_name, $value, $timezones, 'dojoType="dijit.form.FilteringSelect"'); } else if ($pref_name == "USER_STYLESHEET") { - print "<button dojoType=\"dijit.form.Button\" + print "<button dojoType=\"dijit.form.Button\" class='alt-info' onclick=\"Helpers.customizeCSS()\">" . __('Customize') . "</button>"; } else if ($pref_name == "USER_CSS_THEME") { $themes = array_merge(glob("themes/*.php"), glob("themes/*.css"), glob("themes.local/*.css")); $themes = array_map("basename", $themes); - $themes = array_filter($themes, "theme_valid"); + $themes = array_filter($themes, "theme_exists"); asort($themes); - if (!theme_valid($value)) $value = "default.php"; + if (!theme_exists($value)) $value = "default.php"; - print_select($pref_name, $value, $themes, - 'dojoType="dijit.form.Select"'); + print "<select name='$pref_name' id='$pref_name' dojoType='dijit.form.Select'>"; + + $issel = $value == "default.php" ? "selected='selected'" : ""; + print "<option $issel value='default.php'>".__("default")."</option>"; + + foreach ($themes as $theme) { + $issel = $value == $theme ? "selected='selected'" : ""; + print "<option $issel value='$theme'>$theme</option>"; + } + + print "</select>"; } else if ($pref_name == "DEFAULT_UPDATE_INTERVAL") { @@ -679,7 +689,8 @@ class Pref_Prefs extends Handler_Protected { print "</div>"; #pane - print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Plugins')."\">"; + print "<div dojoType=\"dijit.layout.AccordionPane\" + title=\"<i class='material-icons'>extension</i> ".__('Plugins')."\">"; print "<form dojoType=\"dijit.form.Form\" id=\"changePluginsForm\">"; @@ -843,14 +854,16 @@ class Pref_Prefs extends Handler_Protected { print "</div>"; #pane print "</div>"; #pane - print "</doiv>"; #border-container + print "</div>"; #border-container print "</form>"; + PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB, "hook_prefs_tab", "prefPrefs"); print "</div>"; #container + } function toggleAdvanced() { @@ -1002,9 +1015,9 @@ class Pref_Prefs extends Handler_Protected { print "<div dojoType=\"dijit.form.DropDownButton\">". "<span>" . __('Select')."</span>"; print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; - print "<div onclick=\"Tables.select('prefFeedProfileList', true)\" + print "<div onclick=\"Tables.select('pref-profiles-list', true)\" dojoType=\"dijit.MenuItem\">".__('All')."</div>"; - print "<div onclick=\"Tables.select('prefFeedProfileList', false)\" + print "<div onclick=\"Tables.select('pref-profiles-list', false)\" dojoType=\"dijit.MenuItem\">".__('None')."</div>"; print "</div></div>"; @@ -1022,19 +1035,15 @@ class Pref_Prefs extends Handler_Protected { WHERE owner_uid = ? ORDER BY title"); $sth->execute([$_SESSION['uid']]); - print "<div class=\"prefProfileHolder\">"; + print "<div class='panel panel-scrollable'>"; - print "<form id=\"profile_edit_form\" onsubmit=\"return false\">"; + print "<form id='profile_edit_form' onsubmit='return false'>"; - print "<table width=\"100%\" class=\"prefFeedProfileList\" - cellspacing=\"0\" id=\"prefFeedProfileList\">"; + print "<table width='100%' id='pref-profiles-list'>"; - print "<tr class=\"placeholder\">"; # data-row-id='0' <-- no point, shouldn't be removed + print "<tr>"; # data-row-id='0' <-- no point, shouldn't be removed - print "<td width='5%' align='center'><input - onclick='Tables.onRowChecked(this);' - dojoType=\"dijit.form.CheckBox\" - type=\"checkbox\"></td>"; + print "<td><input onclick='Tables.onRowChecked(this);' dojoType='dijit.form.CheckBox' type='checkbox'></td>"; if (!$_SESSION["profile"]) { $is_active = __("(active)"); @@ -1042,8 +1051,7 @@ class Pref_Prefs extends Handler_Protected { $is_active = ""; } - print "<td><span>" . - __("Default profile") . " $is_active</span></td>"; + print "<td width='100%'><span>" . __("Default profile") . " $is_active</span></td>"; print "</tr>"; @@ -1053,14 +1061,11 @@ class Pref_Prefs extends Handler_Protected { $profile_id = $line["id"]; - print "<tr class=\"placeholder\" data-row-id='$profile_id'>"; + print "<tr data-row-id='$profile_id'>"; $edit_title = htmlspecialchars($line["title"]); - print "<td width='5%' align='center'><input - onclick='Tables.onRowChecked(this);' - dojoType=\"dijit.form.CheckBox\" - type=\"checkbox\"></td>"; + print "<td><input onclick='Tables.onRowChecked(this);' dojoType='dijit.form.CheckBox' type='checkbox'></td>"; if ($_SESSION["profile"] == $line["id"]) { $is_active = __("(active)"); |