summaryrefslogtreecommitdiff
path: root/classes/pref/prefs.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/pref/prefs.php')
-rw-r--r--classes/pref/prefs.php192
1 files changed, 79 insertions, 113 deletions
diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php
index fb1c1db06..cb19998ce 100644
--- a/classes/pref/prefs.php
+++ b/classes/pref/prefs.php
@@ -28,6 +28,7 @@ class Pref_Prefs extends Handler_Protected {
__('Feeds') => [
'DEFAULT_UPDATE_INTERVAL',
'FRESH_ARTICLE_MAX_AGE',
+ 'DEFAULT_SEARCH_LANGUAGE',
'BLOCK_SEPARATOR',
'ENABLE_FEED_CATS',
'BLOCK_SEPARATOR',
@@ -68,6 +69,7 @@ class Pref_Prefs extends Handler_Protected {
$this->pref_help = [
"ALLOW_DUPLICATE_POSTS" => array(__("Allow duplicate articles"), ""),
"BLACKLISTED_TAGS" => array(__("Blacklisted tags"), __("Never apply these tags automatically (comma-separated list).")),
+ "DEFAULT_SEARCH_LANGUAGE" => array(__("Default language"), __("Used for full-text search")),
"CDM_AUTO_CATCHUP" => array(__("Mark read on scroll"), __("Mark articles as read as you scroll past them")),
"CDM_EXPANDED" => array(__("Always expand articles")),
"COMBINED_DISPLAY_MODE" => array(__("Combined mode"), __("Show flat list of articles instead of separate panels")),
@@ -560,11 +562,15 @@ class Pref_Prefs extends Handler_Protected {
continue;
}
+ if ($pref_name == "DEFAULT_SEARCH_LANGUAGE" && DB_TYPE != "pgsql") {
+ continue;
+ }
+
if ($item = $prefs_available[$pref_name]) {
- print "<fieldset class='prefs-set'>";
+ print "<fieldset class='prefs'>";
- print "<label for='CB_$pref_name' style='width : 300px'>";
+ print "<label for='CB_$pref_name'>";
print $item['short_desc'] . ":";
print "</label>";
@@ -573,7 +579,7 @@ class Pref_Prefs extends Handler_Protected {
if ($pref_name == "USER_LANGUAGE") {
print_select_hash($pref_name, $value, get_translations(),
- "style='width : 220px; margin : 0px' dojoType='dijit.form.Select'");
+ "style='width : 220px; margin : 0px' dojoType='fox.form.Select'");
} else if ($pref_name == "USER_TIMEZONE") {
@@ -589,7 +595,7 @@ class Pref_Prefs extends Handler_Protected {
if (!theme_exists($value)) $value = "default.php";
- print "<select name='$pref_name' id='$pref_name' dojoType='dijit.form.Select'>";
+ print "<select name='$pref_name' id='$pref_name' dojoType='fox.form.Select'>";
$issel = $value == "default.php" ? "selected='selected'" : "";
print "<option $issel value='default.php'>".__("default")."</option>";
@@ -612,7 +618,11 @@ class Pref_Prefs extends Handler_Protected {
global $update_intervals_nodefault;
print_select_hash($pref_name, $value, $update_intervals_nodefault,
- 'dojoType="dijit.form.Select"');
+ 'dojoType="fox.form.Select"');
+ } else if ($pref_name == "DEFAULT_SEARCH_LANGUAGE") {
+
+ print_select($pref_name, $value, Pref_Feeds::get_ts_languages(),
+ 'dojoType="fox.form.Select"');
} else if ($type_name == "bool") {
@@ -685,7 +695,7 @@ class Pref_Prefs extends Handler_Protected {
}
if ($item['help_text'])
- print "<div class='help-text insensitive'><label for='CB_$pref_name'>".$item['help_text']."</label></div>";
+ print "<div class='help-text text-muted'><label for='CB_$pref_name'>".$item['help_text']."</label></div>";
print "</fieldset>";
}
@@ -705,7 +715,7 @@ class Pref_Prefs extends Handler_Protected {
print_hidden("op", "pref-prefs");
print_hidden("method", "saveconfig");
- print "<div dojoType=\"dijit.form.ComboButton\" type=\"submit\" class=\"alt-primary\">
+ print "<div dojoType=\"fox.form.ComboButton\" type=\"submit\" class=\"alt-primary\">
<span>".__('Save configuration')."</span>
<div dojoType=\"dijit.DropDownMenu\">
<div dojoType=\"dijit.MenuItem\"
@@ -763,18 +773,8 @@ class Pref_Prefs extends Handler_Protected {
print_warning("Your PHP configuration has open_basedir restrictions enabled. Some plugins relying on CURL for functionality may not work correctly.");
}
- print "<table width='100%' class='prefPluginsList'>";
-
- print "<tr><td colspan='5'><h2>".__("System plugins")."</h2>".
- format_notice(__("System plugins are enabled in <strong>config.php</strong> for all users.")).
- "</td></tr>";
-
- print "<tr>
- <th width=\"5%\">&nbsp;</th>
- <th width='10%'>".__('Plugin')."</th>
- <th width=''>".__('Description')."</th>
- <th width='5%'>".__('Version')."</th>
- <th width='10%'>".__('Author')."</th></tr>";
+ print "<h2>".__("System plugins")."</h2>";
+ print_notice("System plugins are enabled in <strong>config.php</strong> for all users.");
$system_enabled = array_map("trim", explode(",", PLUGINS));
$user_enabled = array_map("trim", explode(",", get_pref("_ENABLED_PLUGINS")));
@@ -793,102 +793,73 @@ class Pref_Prefs extends Handler_Protected {
$checked = "";
}
- print "<tr>";
-
- print "<td align='center'><input disabled='1'
- dojoType=\"dijit.form.CheckBox\" $checked
- type=\"checkbox\"></td>";
-
- $icon_class = $checked ? "plugin-enabled" : "plugin-disabled";
+ print "<fieldset class='prefs plugin'>
+ <label>$name:</label>
+ <label class='checkbox description text-muted' id='PLABEL-$name'>
+ <input disabled='1'
+ dojoType='dijit.form.CheckBox' $checked type='checkbox'>
+ ".htmlspecialchars($about[1]). "</label>";
- print "<td><label><i class='material-icons $icon_class'>extension</i> $name</label></td>";
- print "<td>" . htmlspecialchars($about[1]);
- if (@$about[4]) {
- print " &mdash; <a target=\"_blank\" rel=\"noopener noreferrer\" class=\"visibleLink\"
- href=\"".htmlspecialchars($about[4])."\">".__("more info")."</a>";
- }
- print "</td>";
- print "<td>" . htmlspecialchars(sprintf("%.2f", $about[0])) . "</td>";
- print "<td>" . htmlspecialchars($about[2]) . "</td>";
-
- if (count($tmppluginhost->get_all($plugin)) > 0) {
- if (in_array($name, $system_enabled)) {
- print "<td><a href='#' onclick=\"Helpers.clearPluginData('$name')\"
- class='visibleLink'>".__("Clear data")."</a></td>";
+ if (@$about[4]) {
+ print "<button dojoType='dijit.form.Button' class='alt-info'
+ onclick='window.open(\"".htmlspecialchars($about[4])."\")'>
+ <i class='material-icons'>open_in_new</i> ".__("More info...")."</button>";
}
- }
- print "</tr>";
+ print "<div dojoType='dijit.Tooltip' connectId='PLABEL-$name' position='after'>".
+ htmlspecialchars(T_sprintf("v%.2f, by %s", $about[0], $about[2])).
+ "</div>";
+
+ print "</fieldset>";
}
}
- print "<tr><td colspan='4'><br/><h2>".__("User plugins")."</h2></td></tr>";
-
- print "<tr>
- <th width=\"5%\">&nbsp;</th>
- <th width='10%'>".__('Plugin')."</th>
- <th width=''>".__('Description')."</th>
- <th width='5%'>".__('Version')."</th>
- <th width='10%'>".__('Author')."</th></tr>";
-
+ print "<h2>".__("User plugins")."</h2>";
foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
$about = $plugin->about();
if (!$about[3]) {
+ $checked = "";
+ $disabled = "";
+
if (in_array($name, $system_enabled)) {
$checked = "checked='1'";
$disabled = "disabled='1'";
- $rowclass = '';
} else if (in_array($name, $user_enabled)) {
$checked = "checked='1'";
- $disabled = "";
- $rowclass = "Selected";
- } else {
- $checked = "";
- $disabled = "";
- $rowclass = '';
- }
-
- print "<tr class='$rowclass'>";
-
- $icon_class = $checked ? "plugin-enabled" : "plugin-disabled";
-
- print "<td align='center'><input id='FPCHK-$name' name='plugins[]' value='$name' onclick='Tables.onRowChecked(this);'
- dojoType=\"dijit.form.CheckBox\" $checked $disabled
- type=\"checkbox\"></td>";
-
- print "<td><label for='FPCHK-$name'><i class='material-icons $icon_class'>extension</i> $name</label></td>";
- print "<td><label for='FPCHK-$name'>" . htmlspecialchars($about[1]) . "</label>";
- if (@$about[4]) {
- print " &mdash; <a target=\"_blank\" rel=\"noopener noreferrer\" class=\"visibleLink\"
- href=\"".htmlspecialchars($about[4])."\">".__("more info")."</a>";
}
- print "</td>";
- print "<td>" . htmlspecialchars(sprintf("%.2f", $about[0])) . "</td>";
- print "<td>" . htmlspecialchars($about[2]) . "</td>";
+ print "<fieldset class='prefs plugin'>
+ <label>$name:</label>
+ <label class='checkbox description text-muted' id='PLABEL-$name'>
+ <input name='plugins[]' value='$name' dojoType='dijit.form.CheckBox' $checked $disabled type='checkbox'>
+ ".htmlspecialchars($about[1])."</label>";
if (count($tmppluginhost->get_all($plugin)) > 0) {
if (in_array($name, $system_enabled) || in_array($name, $user_enabled)) {
- print "<td><a href='#' onclick=\"Helpers.clearPluginData('$name')\" class='visibleLink'>".__("Clear data")."</a></td>";
+ print " <button dojoType='dijit.form.Button'
+ onclick=\"Helpers.clearPluginData('$name')\">
+ <i class='material-icons'>clear</i> ".__("Clear data")."</button>";
}
}
- print "</tr>";
-
+ if (@$about[4]) {
+ print " <button dojoType='dijit.form.Button' class='alt-info'
+ onclick='window.open(\"".htmlspecialchars($about[4])."\")'>
+ <i class='material-icons'>open_in_new</i> ".__("More info...")."</button>";
+ }
+ print "<div dojoType='dijit.Tooltip' connectId='PLABEL-$name' position='after'>".
+ htmlspecialchars(T_sprintf("v%.2f, by %s", $about[0], $about[2])).
+ "</div>";
+ print "</fieldset>";
}
-
}
- print "</table>";
-
- //print "<p>" . __("You will need to reload Tiny Tiny RSS for plugin changes to take effect.") . "</p>";
-
print "</div>"; #content-pane
print '<div dojoType="dijit.layout.ContentPane" region="bottom">';
@@ -904,7 +875,6 @@ class Pref_Prefs extends Handler_Protected {
print "</form>";
-
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB,
"hook_prefs_tab", "prefPrefs");
@@ -1039,35 +1009,34 @@ class Pref_Prefs extends Handler_Protected {
print_hidden("key", "USER_STYLESHEET");
print "<textarea class='panel user-css-editor' dojoType='dijit.form.SimpleTextarea'
- style='font-size : 12px;'
- name='value'>$value</textarea>";
+ style='font-size : 12px;' name='value'>$value</textarea>";
- print "<div class='dlgButtons'>";
- print "<button dojoType=\"dijit.form.Button\"
+ print "<footer>";
+ print "<button dojoType='dijit.form.Button'
onclick=\"dijit.byId('cssEditDlg').execute()\">".__('Save')."</button> ";
- print "<button dojoType=\"dijit.form.Button\"
+ print "<button dojoType='dijit.form.Button'
onclick=\"dijit.byId('cssEditDlg').hide()\">".__('Cancel')."</button>";
- print "</div>";
+ print "</footer>";
}
function editPrefProfiles() {
- print "<div dojoType=\"dijit.Toolbar\">";
+ print "<div dojoType='fox.Toolbar'>";
- print "<div dojoType=\"dijit.form.DropDownButton\">".
+ print "<div dojoType='fox.form.DropDownButton'>".
"<span>" . __('Select')."</span>";
- print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
+ print "<div dojoType='dijit.Menu' style='display: none'>";
print "<div onclick=\"Tables.select('pref-profiles-list', true)\"
- dojoType=\"dijit.MenuItem\">".__('All')."</div>";
+ dojoType='dijit.MenuItem'>".__('All')."</div>";
print "<div onclick=\"Tables.select('pref-profiles-list', false)\"
- dojoType=\"dijit.MenuItem\">".__('None')."</div>";
+ dojoType='dijit.MenuItem'>".__('None')."</div>";
print "</div></div>";
- print "<div style=\"float : right\">";
+ print "<div style='float : right'>";
- print "<input name=\"newprofile\" dojoType=\"dijit.form.ValidationTextBox\"
- required=\"1\">
- <button dojoType=\"dijit.form.Button\"
+ print "<input name='newprofile' dojoType='dijit.form.ValidationTextBox'
+ required='1'>
+ <button dojoType='dijit.form.Button'
onclick=\"dijit.byId('profileEditDlg').addProfile()\">".
__('Create profile')."</button></div>";
@@ -1113,10 +1082,10 @@ class Pref_Prefs extends Handler_Protected {
$is_active = "";
}
- print "<td><span dojoType=\"dijit.InlineEditBox\"
- width=\"300px\" autoSave=\"false\"
- profile-id=\"$profile_id\">" . $edit_title .
- "<script type=\"dojo/method\" event=\"onChange\" args=\"item\">
+ print "<td><span dojoType='dijit.InlineEditBox'
+ width='300px' autoSave='false'
+ profile-id='$profile_id'>" . $edit_title .
+ "<script type='dojo/method' event='onChange' args='item'>
var elem = this;
dojo.xhrPost({
url: 'backend.php',
@@ -1137,17 +1106,14 @@ class Pref_Prefs extends Handler_Protected {
print "</form>";
print "</div>";
- print "<div class='dlgButtons'>
- <div style='float : left'>
- <button class=\"alt-danger\" dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').removeSelected()\">".
+ print "<footer>
+ <button style='float : left' class='alt-danger' dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').removeSelected()\">".
__('Remove selected profiles')."</button>
- <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').activateProfile()\">".
+ <button dojoType='dijit.form.Button' class='alt-primary' type='submit' onclick=\"dijit.byId('profileEditDlg').activateProfile()\">".
__('Activate profile')."</button>
- </div>";
-
- print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').hide()\">".
- __('Close this window')."</button>";
- print "</div>";
+ <button dojoType='dijit.form.Button' onclick=\"dijit.byId('profileEditDlg').hide()\">".
+ __('Cancel')."</button>";
+ print "</footer>";
}