);
}
+# Putting the following method in open-ils.actor is a bad fit, except in that
+# it serves an interface that lives under 'actor' in the templates directory,
+# and in that there's nowhere else obvious to put it (open-ils.trigger is
+# private).
+__PACKAGE__->register_method(
+ api_name => "open-ils.actor.action_trigger.reactors.all_in_use",
+ method => "get_all_at_reactors_in_use",
+ api_level=> 1,
+ argc => 1,
+ signature=> {
+ params => [
+ { name => 'authtoken', type => 'string' }
+ ],
+ return => {
+ desc => 'list of reactor names', type => 'array'
+ }
+ }
+);
+
+sub get_all_at_reactors_in_use {
+ my ($self, $conn, $auth) = @_;
+
+ my $e = new_editor(authtoken => $auth);
+ $e->checkauth or return $e->die_event;
+ return $e->die_event unless $e->allowed('VIEW_TRIGGER_EVENT_DEF');
+
+ my $reactors = $e->json_query({
+ select => {
+ atevdef => [{column => "reactor", transform => "distinct"}]
+ },
+ from => {atevdef => {}}
+ });
+
+ return $e->die_event unless ref $reactors eq "ARRAY";
+ $e->disconnect;
+
+ return [ map { $_->{reactor} } @$reactors ];
+}
+
1;
grid.filterUi.doApply();
}
+ var _reactors_cache;
+
/* This and its subclasses exist because *FilterPane expect things that
act like AutoFieldWidget, which is a widget /builder/. */
dojo.declare(
"build": function() {
var dijitArgs = dojo.mixin(
{
- "store": this.store,
+ "store": this.store || this.storeBuilder(),
"query": {},
"labelAttr": "label",
"searchAttr": "label",
);
dojo.declare(
+ "openils.widget._FSBuilder.Reactor",
+ [openils.widget._FSBuilder], {
+ "storeBuilder": function() {
+ _reactors_cache = _reactors_cache ||
+ fieldmapper.standardRequest(
+ ["open-ils.actor", "open-ils.actor.action_trigger.reactors.all_in_use"],
+ { "params": [openils.User.authtoken] }
+ ).sort();
+ return new dojo.data.ItemFileReadStore({
+ "data": {
+ "identifier": "name",
+ "items": _reactors_cache.map(
+ function(o) { return {"name": o, "label": o}; }
+ )
+ }
+ });
+ }
+ }
+ );
+
+ dojo.declare(
"openils.widget._FSBuilder.CoreType",
[openils.widget._FSBuilder], {
"store": new dojo.data.ItemFileReadStore({
var filter_widget_builders = {
"ath:core_type": openils.widget._FSBuilder.CoreType,
"atul:state": openils.widget._FSBuilder.EventState,
+ "atul:reactor": openils.widget._FSBuilder.Reactor,
};
function print_all() {
return;
};
+ /* wrap s in %'s unless it already contains at least one %. */
+ this._add_like_wildcards = function(s) {
+ return s.indexOf("%") == -1 ? ("%" + s + "%") : s;
+ };
+
this.get_selected_operator = function() {
if (this.operator_selector)
return this.operator_selector.item;
} else {
var clause = {};
var op = this.get_selected_operator_name();
+
+ var prep_function = function(o) { return o; /* no-op */ };
+ if (String(op).match(/like/))
+ prep_function = this._add_like_wildcards;
+
if (values.length == 1)
- clause[op] = values.pop();
+ clause[op] = prep_function(values.pop());
else
- clause[op] = values;
+ clause[op] = dojo.map(values, prep_function);
return clause;
}
} else {