edit filter dialog: cleanup

This commit is contained in:
Andrew Dolgov 2021-02-12 12:12:47 +03:00
parent 9804a17b79
commit 0f7af07c6e
1 changed files with 58 additions and 74 deletions

View File

@ -333,32 +333,28 @@ class Pref_Filters extends Handler_Protected {
print_hidden("method", "editSave"); print_hidden("method", "editSave");
print_hidden("csrf_token", $_SESSION['csrf_token']); print_hidden("csrf_token", $_SESSION['csrf_token']);
print "<header>".__("Caption")."</header>"; print "<header>".__("Caption")."</header>
print "<section>"; <section>
print "<input required=\"true\" dojoType=\"dijit.form.ValidationTextBox\" style=\"width : 20em;\" name=\"title\" value=\"$title\">"; <input required='true' dojoType='dijit.form.ValidationTextBox' style='width : 20em;' name=\"title\" value=\"$title\">
print "</section>"; </section>
<header class='horizontal'>".__("Match")."</header>
print "<header class='horizontal'>".__("Match")."</header>"; <section>
print "<section>"; <div dojoType='fox.Toolbar'>
<div dojoType='fox.form.DropDownButton'>
print "<div dojoType=\"fox.Toolbar\">"; <span>" . __('Select')."</span>
<div dojoType='dijit.Menu' style='display: none;'>
print "<div dojoType=\"fox.form.DropDownButton\">". <!-- can't use App.dialogOf() here because DropDownButton is not a child of the Dialog -->
"<span>" . __('Select')."</span>"; <div onclick='dijit.byId(\"filterEditDlg\").selectRules(true)'
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; dojoType='dijit.MenuItem'>".__('All')."</div>
print "<div onclick=\"dijit.byId('filterEditDlg').selectRules(true)\" <div onclick='dijit.byId(\"filterEditDlg\").selectRules(false)'
dojoType=\"dijit.MenuItem\">".__('All')."</div>"; dojoType='dijit.MenuItem'>".__('None')."</div>
print "<div onclick=\"dijit.byId('filterEditDlg').selectRules(false)\" </div>
dojoType=\"dijit.MenuItem\">".__('None')."</div>"; </div>
print "</div></div>"; <button dojoType='dijit.form.Button' onclick='App.dialogOf(this).addRule()'>".
__('Add')."</button>
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').addRule()\">". <button dojoType='dijit.form.Button' onclick='App.dialogOf(this).deleteRule()'>".
__('Add')."</button> "; __('Delete')."</button>
</div>";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').deleteRule()\">".
__('Delete')."</button> ";
print "</div>";
print "<ul id='filterDlg_Matches'>"; print "<ul id='filterDlg_Matches'>";
@ -386,39 +382,33 @@ class Pref_Filters extends Handler_Protected {
if (!$line["inverse"]) unset($line["inverse"]); if (!$line["inverse"]) unset($line["inverse"]);
unset($line["match_on"]); unset($line["match_on"]);
$data = htmlspecialchars(json_encode($line)); $data = htmlspecialchars((string)json_encode($line));
print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='Lists.onRowChecked(this)'>". print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='Lists.onRowChecked(this)'>".
"<span onclick=\"dijit.byId('filterEditDlg').editRule(this)\">".$this->getRuleName($line)."</span>". "<span onclick='console.log(this);App.dialogOf(this).editRule(this)'>".$this->getRuleName($line)."</span>".
"<input type='hidden' name='rule[]' value=\"$data\"/></li>"; "<input type='hidden' name='rule[]' value=\"$data\"/></li>";
} }
print "</ul>"; print "</ul>
</section>";
print "</section>"; print "<header class='horizontal'>".__("Apply actions")."</header>
<section>
print "<header class='horizontal'>".__("Apply actions")."</header>"; <div dojoType='fox.Toolbar'>
<div dojoType='fox.form.DropDownButton'>
print "<section>"; <span>".__('Select')."</span>
<div dojoType='dijit.Menu' style='display: none'>
print "<div dojoType=\"fox.Toolbar\">"; <div onclick='dijit.byId(\"filterEditDlg\").selectActions(true)'
dojoType='dijit.MenuItem'>".__('All')."</div>
print "<div dojoType=\"fox.form.DropDownButton\">". <div onclick='dijit.byId(\"filterEditDlg\").selectActions(false)'
"<span>" . __('Select')."</span>"; dojoType='dijit.MenuItem'>".__('None')."</div>
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; </div>
print "<div onclick=\"dijit.byId('filterEditDlg').selectActions(true)\" </div>
dojoType=\"dijit.MenuItem\">".__('All')."</div>"; <button dojoType='dijit.form.Button' onclick='App.dialogOf(this).addAction()'>".
print "<div onclick=\"dijit.byId('filterEditDlg').selectActions(false)\" __('Add')."</button>
dojoType=\"dijit.MenuItem\">".__('None')."</div>"; <button dojoType='dijit.form.Button' onclick='App.dialogOf(this).deleteAction()'>".
print "</div></div>"; __('Delete')."</button>
</div>";
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()\">".
__('Delete')."</button> ";
print "</div>";
print "<ul id='filterDlg_Actions'>"; print "<ul id='filterDlg_Actions'>";
@ -432,10 +422,10 @@ class Pref_Filters extends Handler_Protected {
unset($line["filter_id"]); unset($line["filter_id"]);
unset($line["id"]); unset($line["id"]);
$data = htmlspecialchars(json_encode($line)); $data = htmlspecialchars((string)json_encode($line));
print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='Lists.onRowChecked(this)'>". print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='Lists.onRowChecked(this)'>".
"<span onclick=\"dijit.byId('filterEditDlg').editAction(this)\">".$this->getActionName($line)."</span>". "<span onclick='App.dialogOf(this).editAction(this)'>".$this->getActionName($line)."</span>".
"<input type='hidden' name='action[]' value=\"$data\"/></li>"; "<input type='hidden' name='action[]' value=\"$data\"/></li>";
} }
@ -482,25 +472,19 @@ class Pref_Filters extends Handler_Protected {
print "</section>"; print "</section>";
print "<footer>"; print "<footer>
<div style='float : left'>
print "<div style=\"float : left\">"; <button dojoType='dijit.form.Button' class='alt-danger' onclick='App.dialogOf(this).removeFilter()'>".
print "<button dojoType=\"dijit.form.Button\" class=\"alt-danger\" onclick=\"return dijit.byId('filterEditDlg').removeFilter()\">". __('Remove')."</button>
__('Remove')."</button>"; </div>
print "</div>"; <button dojoType='dijit.form.Button' class='alt-info' onclick='App.dialogOf(this).test()'>".
__('Test')."</button>
print "<button dojoType=\"dijit.form.Button\" class=\"alt-info\" onclick=\"return dijit.byId('filterEditDlg').test()\">". <button dojoType='dijit.form.Button' type='submit' class='alt-primary' onclick='App.dialogOf(this).execute()'>".
__('Test')."</button> "; __('Save')."</button>
<button dojoType='dijit.form.Button' onclick='App.dialogOf(this).hide()'>".
print "<button dojoType=\"dijit.form.Button\" type=\"submit\" class=\"alt-primary\" onclick=\"return dijit.byId('filterEditDlg').execute()\">". __('Cancel')."</button>
__('Save')."</button> "; </footer>
</form>";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').hide()\">".
__('Cancel')."</button>";
print "</footer>";
print "</form>";
} }
} }