search dialog fixes

pgsql: get FTS languages list from the database
master
Andrew Dolgov 5 years ago
parent 063b4f535a
commit f8836ec080

@ -785,16 +785,19 @@ class Feeds extends Handler_Protected {
print "<div class=\"dlgSecCont\">";
print "<fieldset>";
print "<input dojoType=\"dijit.form.ValidationTextBox\"
style=\"font-size : 16px; width : 20em;\"
style=\"font-size : 16px; width : 540px;\"
required=\"1\" name=\"query\" type=\"search\" value=''>";
print "<span style='float : right'>".T_sprintf('in %s', $this->getFeedTitle($active_feed_id, $is_cat))."</span>";
print "</fieldset>";
print "<hr/><span style='float : right'>".T_sprintf('in %s', $this->getFeedTitle($active_feed_id, $is_cat))."</span>";
if (DB_TYPE == "pgsql") {
print "<hr/>";
print_select("search_language", "", Pref_Feeds::$feed_languages,
print "<fieldset>";
print_select("search_language", "", Pref_Feeds::get_ts_languages(),
"dojoType='dijit.form.Select' title=\"".__('Used for word stemming')."\"");
print "</fieldset>";
}
print "</div>";

@ -1,8 +1,5 @@
<?php
class Pref_Feeds extends Handler_Protected {
public static $feed_languages = array("English", "Danish", "Dutch", "Finnish", "French", "German", "Hungarian", "Italian", "Norwegian",
"Portuguese", "Russian", "Spanish", "Swedish", "Turkish", "Simple");
function csrf_ignore($method) {
$csrf_ignored = array("index", "getfeedtree", "add", "editcats", "editfeed",
"savefeedorder", "uploadicon", "feedswitherrors", "inactivefeeds",
@ -11,6 +8,22 @@ class Pref_Feeds extends Handler_Protected {
return array_search($method, $csrf_ignored) !== false;
}
public static function get_ts_languages() {
$rv = [];
if (DB_TYPE == "pgsql") {
$dbh = Db::pdo();
$res = $dbh->query("SELECT cfgname FROM pg_ts_config");
while ($row = $res->fetch()) {
array_push($rv, ucfirst($row['cfgname']));
}
}
return $rv;
}
function batch_edit_cbox($elem, $label = false) {
print "<input type=\"checkbox\" title=\"".__("Check to enable field")."\"
onchange=\"dijit.byId('feedEditDlg').toggleField(this, '$elem', '$label')\">";
@ -590,7 +603,7 @@ class Pref_Feeds extends Handler_Protected {
print "<fieldset>";
print "<label>" . __('Language:') . "</label> ";
print_select("feed_language", $feed_language, $this::$feed_languages,
print_select("feed_language", $feed_language, $this::get_ts_languages(),
'dojoType="dijit.form.Select"');
print "</fieldset>";
@ -859,7 +872,7 @@ class Pref_Feeds extends Handler_Protected {
print "<fieldset>";
print "<label>" . __('Language:') . "</label> ";
print_select("feed_language", "", $this::$feed_languages,
print_select("feed_language", "", $this::get_ts_languages(),
'disabled="1" dojoType="dijit.form.Select"');
$this->batch_edit_cbox("feed_language");

Loading…
Cancel
Save