diff options
Diffstat (limited to 'classes/pref/filters.php')
-rwxr-xr-x | classes/pref/filters.php | 162 |
1 files changed, 78 insertions, 84 deletions
diff --git a/classes/pref/filters.php b/classes/pref/filters.php index 99bb885cf..f5a580e78 100755 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -170,10 +170,10 @@ class Pref_Filters extends Handler_Protected { print "<ul class='panel panel-scrollable list list-unstyled' id='prefFilterTestResultList'>"; print "</ul>"; - print "<div style='text-align : center'>"; - print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('filterTestDlg').hide()\">". + print "<footer class='text-center'>"; + print "<button dojoType='dijit.form.Button' onclick=\"dijit.byId('filterTestDlg').hide()\">". __('Close this window')."</button>"; - print "</div>"; + print "</footer>"; } @@ -346,15 +346,13 @@ class Pref_Filters extends Handler_Protected { print_hidden("method", "editSave"); print_hidden("csrf_token", $_SESSION['csrf_token']); - print "<div class='dlgSec'>".__("Caption")."</div>"; - print "<div class='dlgSecCont'>"; - + print "<header>".__("Caption")."</header>"; + print "<section>"; print "<input required=\"true\" dojoType=\"dijit.form.ValidationTextBox\" style=\"width : 20em;\" name=\"title\" value=\"$title\">"; + print "</section>"; - print "</div>"; - - print "<div class='dlgSecHoriz'>".__("Match")."</div>"; - print "<div class='dlgSecCont'>"; + print "<header class='horizontal'>".__("Match")."</header>"; + print "<section>"; print "<div dojoType=\"dijit.Toolbar\">"; @@ -410,11 +408,11 @@ class Pref_Filters extends Handler_Protected { print "</ul>"; - print "</div>"; + print "</section>"; - print "<div class='dlgSecHoriz'>".__("Apply actions")."</div>"; + print "<header class='horizontal'>".__("Apply actions")."</header>"; - print "<div class='dlgSecCont'>"; + print "<section>"; print "<div dojoType=\"dijit.Toolbar\">"; @@ -456,10 +454,10 @@ class Pref_Filters extends Handler_Protected { print "</ul>"; - print "</div>"; + print "</section>"; - print "<div class='dlgSec'>".__("Options")."</div>"; - print "<div class='dlgSecCont'>"; + print "<header>".__("Options")."</header>"; + print "<section>"; if ($enabled) { $checked = "checked=\"1\""; @@ -495,9 +493,9 @@ class Pref_Filters extends Handler_Protected { print "</fieldset>"; - print "</div>"; + print "</section>"; - print "<div class=\"dlgButtons\">"; + print "<footer>"; print "<div style=\"float : left\">"; print "<button dojoType=\"dijit.form.Button\" class=\"alt-danger\" onclick=\"return dijit.byId('filterEditDlg').removeFilter()\">". @@ -513,7 +511,7 @@ class Pref_Filters extends Handler_Protected { print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').hide()\">". __('Cancel')."</button>"; - print "</div>"; + print "</footer>"; print "</form>"; } @@ -849,31 +847,30 @@ class Pref_Filters extends Handler_Protected { print_hidden("method", "add"); print_hidden("csrf_token", $_SESSION['csrf_token']); - print "<div class='dlgSec'>".__("Caption")."</div>"; - - print "<div class='dlgSecCont'>"; - print "<input required=\"true\" dojoType=\"dijit.form.ValidationTextBox\" style=\"width : 20em;\" name=\"title\" value=\"\">"; - print "</div>"; + print "<header>".__("Caption")."</header>"; - print "<div class='dlgSecHoriz'>".__("Match")."</div>"; + print "<section>"; + print "<input required='true' dojoType='dijit.form.ValidationTextBox' style='width : 20em;' name='title' value=''>"; + print "</section>"; - print "<div class='dlgSecCont'>"; + print "<header class='horizontal'>".__("Match")."</header >"; + print "<section>"; - print "<div dojoType=\"dijit.Toolbar\">"; + print "<div dojoType='dijit.Toolbar'>"; - print "<div dojoType=\"dijit.form.DropDownButton\">". + print "<div dojoType='dijit.form.DropDownButton'>". "<span>" . __('Select')."</span>"; - print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; + print "<div dojoType='dijit.Menu' style='display: none'>"; print "<div onclick=\"dijit.byId('filterEditDlg').selectRules(true)\" - dojoType=\"dijit.MenuItem\">".__('All')."</div>"; + dojoType='dijit.MenuItem'>".__('All')."</div>"; print "<div onclick=\"dijit.byId('filterEditDlg').selectRules(false)\" - dojoType=\"dijit.MenuItem\">".__('None')."</div>"; + dojoType='dijit.MenuItem'>".__('None')."</div>"; print "</div></div>"; - print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').addRule()\">". + print "<button dojoType='dijit.form.Button' onclick=\"return dijit.byId('filterEditDlg').addRule()\">". __('Add')."</button> "; - print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').deleteRule()\">". + print "<button dojoType='dijit.form.Button' onclick=\"return dijit.byId('filterEditDlg').deleteRule()\">". __('Delete')."</button> "; print "</div>"; @@ -882,74 +879,69 @@ class Pref_Filters extends Handler_Protected { # print "<li>No rules</li>"; print "</ul>"; - print "</div>"; - print "</div>"; + print "</section>"; - print "<div class='dlgSecHoriz'>".__("Apply actions")."</div>"; + print "<header class='horizontal'>".__("Apply actions")."</header>"; - print "<div class='dlgSecCont'>"; + print "<section>"; - print "<div dojoType=\"dijit.Toolbar\">"; + print "<div dojoType='dijit.Toolbar'>"; - print "<div dojoType=\"dijit.form.DropDownButton\">". + print "<div dojoType='dijit.form.DropDownButton'>". "<span>" . __('Select')."</span>"; - print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; + print "<div dojoType='dijit.Menu' style='display: none'>"; print "<div onclick=\"dijit.byId('filterEditDlg').selectActions(true)\" - dojoType=\"dijit.MenuItem\">".__('All')."</div>"; + dojoType='dijit.MenuItem'>".__('All')."</div>"; print "<div onclick=\"dijit.byId('filterEditDlg').selectActions(false)\" - dojoType=\"dijit.MenuItem\">".__('None')."</div>"; + dojoType='dijit.MenuItem'>".__('None')."</div>"; print "</div></div>"; - print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').addAction()\">". + print "<button dojoType='dijit.form.Button' onclick=\"return dijit.byId('filterEditDlg').addAction()\">". __('Add')."</button> "; - print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').deleteAction()\">". + print "<button dojoType='dijit.form.Button' onclick=\"return dijit.byId('filterEditDlg').deleteAction()\">". __('Delete')."</button> "; print "</div>"; - print "<ul id='filterDlg_Actions'>"; # print "<li>No actions</li>"; print "</ul>"; - print "</div>"; - print "<div class='dlgSec'>".__("Options")."</div>"; + print "</section>"; + + print "<header>".__("Options")."</header>"; - print "<div class='dlgSecCont'>"; + print "<section>"; print "<fieldset class='narrow'>"; - print "<label class='checkbox'><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"enabled\" id=\"enabled\" checked=\"1\"> + print "<label class='checkbox'><input dojoType='dijit.form.CheckBox' type='checkbox' name='enabled' id='enabled' checked='1'> ".__('Enabled')."</label>"; print "</fieldset><fieldset class='narrow'>"; - print "<label class='checkbox'><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"match_any_rule\" id=\"match_any_rule\"> + print "<label class='checkbox'><input dojoType='dijit.form.CheckBox' type='checkbox' name='match_any_rule' id='match_any_rule'> ".__('Match any rule')."</label>"; print "</fieldset><fieldset class='narrow'>"; - print "<label class='checkbox'><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"inverse\" id=\"inverse\"> + print "<label class='checkbox'><input dojoType='dijit.form.CheckBox' type='checkbox' name='inverse' id='inverse'> ".__('Inverse matching')."</label>"; print "</fieldset>"; - print "</div>"; - -// print "</div>"; + print "</section>"; - print "<div class=\"dlgButtons\">"; + print "<footer>"; - print "<button dojoType=\"dijit.form.Button\" class=\"alt-info\" onclick=\"return dijit.byId('filterEditDlg').test()\">". + print "<button dojoType='dijit.form.Button' class='alt-info' onclick=\"return dijit.byId('filterEditDlg').test()\">". __('Test')."</button> "; - - print "<button dojoType=\"dijit.form.Button\" type=\"submit\" class=\"alt-primary\" onclick=\"return dijit.byId('filterEditDlg').execute()\">". + print "<button dojoType='dijit.form.Button' type='submit' class='alt-primary' onclick=\"return dijit.byId('filterEditDlg').execute()\">". __('Create')."</button> "; - - print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').hide()\">". + print "<button dojoType='dijit.form.Button' onclick=\"return dijit.byId('filterEditDlg').hide()\">". __('Cancel')."</button>"; - print "</div>"; + print "</footer>"; } @@ -979,9 +971,9 @@ class Pref_Filters extends Handler_Protected { $filter_types[$line["id"]] = __($line["description"]); } - print "<div class=\"dlgSec\">".__("Match")."</div>"; + print "<header>".__("Match")."</header>"; - print "<div class=\"dlgSecCont\">"; + print "<section>"; print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\" id=\"filterDlg_regExp\" @@ -1015,9 +1007,9 @@ class Pref_Filters extends Handler_Protected { print "</fieldset>"; - print "</div>"; + print "</section>"; - print "<div class='dlgButtons'>"; + print "<footer>"; print "<button dojoType='dijit.form.Button' style='float : left' class='alt-info' onclick='window.open(\"https://tt-rss.org/wiki/ContentFilters\")'> <i class='material-icons'>help</i> ".__("More info...")."</button>"; @@ -1028,7 +1020,7 @@ class Pref_Filters extends Handler_Protected { print "<button dojoType='dijit.form.Button' onclick=\"return dijit.byId('filterNewRuleDlg').hide()\">". __('Cancel')."</button>"; - print "</div>"; + print "</footer>"; print "</form>"; } @@ -1046,12 +1038,12 @@ class Pref_Filters extends Handler_Protected { print "<form name='filter_new_action_form' id='filter_new_action_form' onsubmit='return false;'>"; - print "<div class=\"dlgSec\">".__("Perform Action")."</div>"; + print "<header>".__("Perform Action")."</header>"; - print "<div class=\"dlgSecCont\">"; + print "<section>"; - print "<select name=\"action_id\" dojoType=\"dijit.form.Select\" - onchange=\"Filters.filterDlgCheckAction(this)\">"; + print "<select name='action_id' dojoType='dijit.form.Select' + onchange='Filters.filterDlgCheckAction(this)'>"; $res = $this->pdo->query("SELECT id,description FROM ttrss_filter_actions ORDER BY name"); @@ -1072,16 +1064,16 @@ class Pref_Filters extends Handler_Protected { $label_param_hidden = ($action_id == 7) ? "" : "display : none"; $plugin_param_hidden = ($action_id == 9) ? "" : "display : none"; - print "<span id=\"filterDlg_paramBox\" style=\"$param_box_hidden\">"; + print "<span id='filterDlg_paramBox' style=\"$param_box_hidden\">"; print " "; //print " " . __("with parameters:") . " "; - print "<input dojoType=\"dijit.form.TextBox\" - id=\"filterDlg_actionParam\" style=\"$param_hidden\" - name=\"action_param\" value=\"$action_param\">"; + print "<input dojoType='dijit.form.TextBox' + id='filterDlg_actionParam' style=\"$param_hidden\" + name='action_param' value=\"$action_param\">"; print_label_select("action_param_label", $action_param, - "id=\"filterDlg_actionParamLabel\" style=\"$label_param_hidden\" - dojoType=\"dijit.form.Select\""); + "id='filterDlg_actionParamLabel' style=\"$label_param_hidden\" + dojoType='dijit.form.Select'"); $filter_actions = PluginHost::getInstance()->get_filter_actions(); $filter_action_hash = array(); @@ -1104,24 +1096,24 @@ class Pref_Filters extends Handler_Protected { } print_select_hash("filterDlg_actionParamPlugin", $action_param, $filter_action_hash, - "style=\"$plugin_param_hidden\" dojoType=\"dijit.form.Select\" $filter_plugin_disabled", + "style=\"$plugin_param_hidden\" dojoType='dijit.form.Select' $filter_plugin_disabled", "action_param_plugin"); print "</span>"; print " "; // tiny layout hack - print "</div>"; + print "</section>"; - print "<div class=\"dlgButtons\">"; + print "<footer>"; - print "<button dojoType=\"dijit.form.Button\" class=\"alt-primary\" type=\"submit\" onclick=\"return dijit.byId('filterNewActionDlg').execute()\">". + print "<button dojoType='dijit.form.Button' class='alt-primary' type='submit' onclick=\"return dijit.byId('filterNewActionDlg').execute()\">". ($action ? __("Save action") : __('Add action'))."</button> "; - print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterNewActionDlg').hide()\">". + print "<button dojoType='dijit.form.Button' onclick=\"return dijit.byId('filterNewActionDlg').hide()\">". __('Cancel')."</button>"; - print "</div>"; + print "</footer>"; print "</form>"; } @@ -1129,11 +1121,11 @@ class Pref_Filters extends Handler_Protected { private function getFilterName($id) { $sth = $this->pdo->prepare( - "SELECT title,match_any_rule,COUNT(DISTINCT r.id) AS num_rules,COUNT(DISTINCT a.id) AS num_actions + "SELECT title,match_any_rule,f.inverse AS inverse,COUNT(DISTINCT r.id) AS num_rules,COUNT(DISTINCT a.id) AS num_actions FROM ttrss_filters2 AS f LEFT JOIN ttrss_filters2_rules AS r ON (r.filter_id = f.id) LEFT JOIN ttrss_filters2_actions AS a - ON (a.filter_id = f.id) WHERE f.id = ? GROUP BY f.title, f.match_any_rule"); + ON (a.filter_id = f.id) WHERE f.id = ? GROUP BY f.title, f.match_any_rule, f.inverse"); $sth->execute([$id]); if ($row = $sth->fetch()) { @@ -1142,6 +1134,7 @@ class Pref_Filters extends Handler_Protected { $num_rules = $row["num_rules"]; $num_actions = $row["num_actions"]; $match_any_rule = $row["match_any_rule"]; + $inverse = $row["inverse"]; if (!$title) $title = __("[No caption]"); @@ -1160,6 +1153,7 @@ class Pref_Filters extends Handler_Protected { } if ($match_any_rule) $title .= " (" . __("matches any rule") . ")"; + if ($inverse) $title .= " (" . __("inverse") . ")"; if ($num_actions > 0) $actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions); |