prevent creation of filter rules matching no feeds

master
Andrew Dolgov 4 years ago
parent fb471652c0
commit 810afdaf5a

@ -695,7 +695,7 @@ class Pref_Filters extends Handler_Protected {
$feed_ids = explode(",", clean($_REQUEST["ids"])); $feed_ids = explode(",", clean($_REQUEST["ids"]));
print json_encode([ print json_encode([
"multiselect" => $this->_feed_multi_select("feed_id", $feed_ids, 'style="width : 540px; height : 300px" dojoType="dijit.form.MultiSelect"') "multiselect" => $this->_feed_multi_select("feed_id", $feed_ids, 'required="1" style="width : 540px; height : 300px" dojoType="fox.form.ValidationMultiSelect"')
]); ]);
} }

@ -0,0 +1,20 @@
/* global define */
// only supports required for the time being
// TODO: maybe show dojo native error message? i dunno
define(["dojo/_base/declare", "dojo/_base/lang", "dijit/form/MultiSelect", ],
function(declare, lang, MultiSelect) {
return declare('fox.form.ValidationMultiSelect', [MultiSelect], {
constructor: function(params){
this.constraints = {};
this.baseClass += ' dijitValidationMultiSelect';
},
validate: function(/*Boolean*/ isFocused){
if (this.required && this.attr('value').length == 0)
return false;
return true;
},
})
});

@ -53,6 +53,7 @@ require(["dojo/_base/kernel",
"fox/PrefLabelTree", "fox/PrefLabelTree",
"fox/Toolbar", "fox/Toolbar",
"fox/SingleUseDialog", "fox/SingleUseDialog",
"fox/form/ValidationMultiSelect",
"fox/form/ValidationTextArea", "fox/form/ValidationTextArea",
"fox/form/Select", "fox/form/Select",
"fox/form/ComboButton", "fox/form/ComboButton",

@ -51,6 +51,7 @@ require(["dojo/_base/kernel",
"fox/FeedTree", "fox/FeedTree",
"fox/Toolbar", "fox/Toolbar",
"fox/SingleUseDialog", "fox/SingleUseDialog",
"fox/form/ValidationMultiSelect",
"fox/form/ValidationTextArea", "fox/form/ValidationTextArea",
"fox/form/Select", "fox/form/Select",
"fox/form/ComboButton", "fox/form/ComboButton",

Loading…
Cancel
Save