[open-ils-commits] [GIT] Evergreen ILS branch master updated. 4d424d03934f7ebb4e5ffe3ae2d7335586a6c5e4

Evergreen Git git at git.evergreen-ils.org
Wed Aug 1 17:33:15 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  4d424d03934f7ebb4e5ffe3ae2d7335586a6c5e4 (commit)
       via  176078548035aa3781b91e66d7df578b0a43858d (commit)
       via  e9771beffe8ffcdb0d7f02eb2bfce6962a4e1ac5 (commit)
       via  67095d5acccdd7947aef2a7bcc4a2c232e0db33c (commit)
       via  42505e6c89ef51cdba62d112222739114e8de8dd (commit)
      from  5d355e3262c3cf5a528762d5162a8526649efcbb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4d424d03934f7ebb4e5ffe3ae2d7335586a6c5e4
Author: Bill Erickson <berick at esilibrary.com>
Date:   Wed Jul 25 09:43:43 2012 -0400

    Search filter group doc repair
    
    Change the example in the docs to have correct syntax:
    
    filter_group=reading_level becomes filter_group='reading_level'
    
    Thanks to kmlussier for pointing this out.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/docs/RELEASE_NOTES_NEXT/search-filter-groups.txt b/docs/RELEASE_NOTES_NEXT/search-filter-groups.txt
index 3473166..2d2c83d 100644
--- a/docs/RELEASE_NOTES_NEXT/search-filter-groups.txt
+++ b/docs/RELEASE_NOTES_NEXT/search-filter-groups.txt
@@ -30,7 +30,7 @@ Using the filter in a template
 <span>
 [%
     INCLUDE 'opac/parts/filter_group_selector.tt2'
-    filter_group=reading_level
+    filter_group='reading_level'
     none_ok=1
     none_label=l('All')
 %]

commit 176078548035aa3781b91e66d7df578b0a43858d
Author: Bill Erickson <berick at esilibrary.com>
Date:   Thu May 31 10:06:17 2012 -0400

    Add missing search filter group view/admin perm
    
    ADMIN_SEARCH_FILTER_GROUP
    VIEW_SEARCH_FILTER_GROUP
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
index 94ca8f2..d8d91ba 100644
--- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql
+++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
@@ -1561,7 +1561,11 @@ INSERT INTO permission.perm_list ( id, code, description ) VALUES
 ( 535, 'VIEW_TRIGGER_EVENT', oils_i18n_gettext( 535,
     'Allows a user to view circ- and hold-related action/trigger events', 'ppl', 'description')),
 ( 536, 'IMPORT_OVERLAY_COPY', oils_i18n_gettext( 536,
-    'Allows a user to overlay copy data in MARC import', 'ppl', 'description'))
+    'Allows a user to overlay copy data in MARC import', 'ppl', 'description')),
+ ( 537, 'ADMIN_SEARCH_FILTER_GROUP', oils_i18n_gettext( 537,
+    'Allows staff to manage search filter groups and entries', 'ppl', 'description' )),
+ ( 538, 'VIEW_SEARCH_FILTER_GROUP', oils_i18n_gettext( 538,
+    'Allows staff to view search filter groups and entries', 'ppl', 'description' ))
 ;
 
 
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.search_filter_group_perms.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.search_filter_group_perms.sql
new file mode 100644
index 0000000..a0310e9
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.search_filter_group_perms.sql
@@ -0,0 +1,29 @@
+BEGIN;
+
+-- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+-- TODO: verify IDs before merging
+INSERT INTO permission.perm_list ( id, code, description ) 
+    VALUES ( 
+        537, 
+        'ADMIN_SEARCH_FILTER_GROUP',
+        oils_i18n_gettext( 
+            537,
+            'Allows staff to manage search filter groups and entries',
+            'ppl', 
+            'description' 
+        )
+    ),
+    (
+        538, 
+        'VIEW_SEARCH_FILTER_GROUP',
+        oils_i18n_gettext( 
+            538,
+            'Allows staff to view search filter groups and entries',
+            'ppl', 
+            'description' 
+        )
+
+    );
+
+COMMIT;

commit e9771beffe8ffcdb0d7f02eb2bfce6962a4e1ac5
Author: Bill Erickson <berick at esilibrary.com>
Date:   Thu May 31 09:27:40 2012 -0400

    Search filter groups release notes
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/docs/RELEASE_NOTES_NEXT/search-filter-groups.txt b/docs/RELEASE_NOTES_NEXT/search-filter-groups.txt
new file mode 100644
index 0000000..3473166
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/search-filter-groups.txt
@@ -0,0 +1,38 @@
+Search Filter Groups
+--------------------
+
+Search filter groups support the collection of free-form search queries into
+named groups of named filters which can be applied to searches.  The purpose 
+is to allow systems to fine tune filters in the catalog.
+
+Editing the groups and their entries is done in the staff client at
+Admin -> Local Administration -> Search Filter Groups.
+
+Example
+~~~~~~~
+
+Consider a new filter called "reading_level".  It uses a combination of 
+MARC audience and shelving location to differentiate items.  It might have
+entries that look like this:
+
+Children's Materials => audience(a,b,c) locations(1,2,3,4,5,6,7)
+
+Young Adult => audience(j,d) locations(5,6,7,8,9,10)
+
+Adult => audience(e,f,g, ) -locations(1,2,3,4,5,6,7,8,9)
+
+Using the filter in a template
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+[source, html]
+---------------------------------------------------
+<span>[% ctx.filter_groups.reading_level.label %]<span>
+<span>
+[%
+    INCLUDE 'opac/parts/filter_group_selector.tt2'
+    filter_group=reading_level
+    none_ok=1
+    none_label=l('All')
+%]
+<span>
+---------------------------------------------------

commit 67095d5acccdd7947aef2a7bcc4a2c232e0db33c
Author: Bill Erickson <berick at esilibrary.com>
Date:   Thu May 31 09:37:58 2012 -0400

    Search filter groups admin UI staff menu entry
    
    Admin -> Local Administration -> Search Filter Groups
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd
index c67c1b6..055f2e3 100644
--- a/Open-ILS/web/opac/locale/en-US/lang.dtd
+++ b/Open-ILS/web/opac/locale/en-US/lang.dtd
@@ -746,6 +746,7 @@
 <!ENTITY staff.main.menu.admin.local_admin.address_alert.label "Address Alerts">
 <!ENTITY staff.main.menu.admin.local_admin.circ_limit_set.label "Circulation Limit Sets">
 <!ENTITY staff.main.menu.admin.local_admin.copy_location_group.label "Copy Location Groups">
+<!ENTITY staff.main.menu.admin.local_admin.search_filter_group.label "Search Filter Groups">
 
 <!ENTITY staff.main.menu.admin.server_admin.label "Server Administration">
 <!ENTITY staff.main.menu.admin.server_admin.conify.org_unit_type.label "Organization Types">
diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js
index 1ef0da6..c08bbe2 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js
+++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js
@@ -1055,6 +1055,10 @@ main.menu.prototype = {
                 ['oncommand'],
                 function(event) { open_eg_web_page('conify/global/asset/copy_location_group', null, event); }
             ],
+            'cmd_local_admin_search_filter_group' : [
+                ['oncommand'],
+                function(event) { open_eg_web_page('conify/global/actor/search_filter_group', null, event); }
+            ],
             'cmd_acq_create_invoice' : [
                 ['oncommand'],
                 function(event) { open_eg_web_page('acq/invoice/view?create=1', 'menu.cmd_acq_create_invoice.tab', event); }
diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
index 54bd6bb..70128a9 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
+++ b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
@@ -156,6 +156,8 @@
              />
     <command id="cmd_local_admin_copy_location_group"
              perm="ADMIN_COPY_LOCATION_GROUP VIEW_COPY_LOCATION_GROUP" />
+    <command id="cmd_local_admin_search_filter_group"
+             perm="ADMIN_SEARCH_FILTER_GROUP VIEW_SEARCH_FILTER_GROUP" />
 
     <!-- server admin menu commands -->
     <command id="cmd_server_admin_org_type"
@@ -515,6 +517,7 @@
                 <menuitem label="&staff.main.menu.admin.local_admin.patrons_due_refunds.label;" accesskey="&staff.main.menu.admin.local_admin.patrons_due_refunds.accesskey;" command="cmd_local_admin_patrons_due_refunds"/>
                 <menuitem command="cmd_local_admin_do_not_auto_attempt_print_setting" label="&staff.server.admin.index.do_not_auto_attempt_print_setting.label;" accesskey="&staff.server.admin.index.do_not_auto_attempt_print_setting.accesskey;"/>
                 <menuitem label="&staff.server.admin.index.reports;" command="cmd_local_admin_reports"/>
+                <menuitem label="&staff.main.menu.admin.local_admin.search_filter_group.label;" command="cmd_local_admin_search_filter_group"/>
                 <menuitem label="&staff.main.menu.admin.local_admin.conify.standing_penalty.label;" command="cmd_local_admin_standing_penalty"/>
                 <menuitem label="&staff.server.admin.index.statistical_categories;" command="cmd_local_admin_stat_cats"/>
                 <menuitem label="&staff.main.menu.admin.local_admin.conify.survey.label;" command="cmd_local_admin_survey"/>

commit 42505e6c89ef51cdba62d112222739114e8de8dd
Author: Bill Erickson <berick at esilibrary.com>
Date:   Fri May 25 09:22:36 2012 -0400

    Search filter groups admin UI / API
    
    UI for managing search filter groups and group entries.
    
    This inclues a new API call for performing CRUD actions on filter
    group entries:
    
    open-ils.actor.filter_group_entry.crud
    
    This new API call was necessary because entries link to
    actor.search_query's, whose write access cannot be controled by pcrud.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index 7170638..eb75532 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -4934,13 +4934,13 @@ SELECT  usr,
 	</class>
 	<class id="asfge" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="actor::search_filter_group_entry" oils_persist:tablename="actor.search_filter_group_entry" reporter:label="Search Filter Group Entry" oils_persist:field_safe="true">
 		<fields oils_persist:primary="id" oils_persist:sequence="actor.search_filter_group_entry_id_seq">
-			<field name="id" reporter:datatype="id" reporter:selector="label"/>
+			<field name="id" reporter:datatype="id"/>
 			<field name="grp" reporter:datatype="link"/>
 			<field name="pos" reporter:datatype="int"/>
 			<field name="query" reporter:datatype="link"/>
 		</fields>
 		<links>
-			<link field="grp" reltype="has_a" key="id" map="" class="asfge"/>
+			<link field="grp" reltype="has_a" key="id" map="" class="asfg"/>
 			<link field="query" reltype="has_a" key="id" map="" class="asq"/>
 		</links>
         <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
index 50cff13..660cebd 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
@@ -4644,4 +4644,116 @@ sub get_all_at_reactors_in_use {
     return [ map { $_->{reactor} } @$reactors ];
 }
 
+__PACKAGE__->register_method(
+    method   => "filter_group_entry_crud",
+    api_name => "open-ils.actor.filter_group_entry.crud",
+    signature => {
+        desc => q/
+            Provides CRUD access to filter group entry objects.  These are not full accessible
+            via PCRUD, since they requre "asq" objects for storing the query, and "asq" objects
+            are not accessible via PCRUD (because they have no fields against which to link perms)
+            /,
+        params => [
+            {desc => "Authentication token", type => "string"},
+            {desc => "Entry ID / Entry Object", type => "number"},
+            {desc => "Additional note text (optional)", type => "string"},
+            {desc => "penalty org unit ID (optional, default to top of org tree)",
+                type => "number"}
+        ],
+        return => {
+            desc => "Entry fleshed with query on Create, Retrieve, and Uupdate.  1 on Delete", 
+            type => "object"
+        }
+    }
+);
+
+sub filter_group_entry_crud {
+    my ($self, $conn, $auth, $arg) = @_;
+
+    return OpenILS::Event->new('BAD_PARAMS') unless $arg;
+    my $e = new_editor(authtoken => $auth, xact => 1);
+    return $e->die_event unless $e->checkauth;
+
+    if (ref $arg) {
+
+        if ($arg->isnew) {
+            
+            my $grp = $e->retrieve_actor_search_filter_group($arg->grp)
+                or return $e->die_event;
+
+            return $e->die_event unless $e->allowed(
+                'ADMIN_SEARCH_FILTER_GROUP', $grp->owner);
+
+            my $query = $arg->query;
+            $query = $e->create_actor_search_query($query) or return $e->die_event;
+            $arg->query($query->id);
+            my $entry = $e->create_actor_search_filter_group_entry($arg) or return $e->die_event;
+            $entry->query($query);
+
+            $e->commit;
+            return $entry;
+
+        } elsif ($arg->ischanged) {
+
+            my $entry = $e->retrieve_actor_search_filter_group_entry([
+                $arg->id, {
+                    flesh => 1,
+                    flesh_fields => {asfge => ['grp']}
+                }
+            ]) or return $e->die_event;
+
+            return $e->die_event unless $e->allowed(
+                'ADMIN_SEARCH_FILTER_GROUP', $entry->grp->owner);
+
+            my $query = $e->update_actor_search_query($arg->query) or return $e->die_event;
+            $arg->query($arg->query->id);
+            $e->update_actor_search_filter_group_entry($arg) or return $e->die_event;
+            $arg->query($query);
+
+            $e->commit;
+            return $arg;
+
+        } elsif ($arg->isdeleted) {
+
+            my $entry = $e->retrieve_actor_search_filter_group_entry([
+                $arg->id, {
+                    flesh => 1,
+                    flesh_fields => {asfge => ['grp', 'query']}
+                }
+            ]) or return $e->die_event;
+
+            return $e->die_event unless $e->allowed(
+                'ADMIN_SEARCH_FILTER_GROUP', $entry->grp->owner);
+
+            $e->delete_actor_search_filter_group_entry($entry) or return $e->die_event;
+            $e->delete_actor_search_query($entry->query) or return $e->die_event;
+
+            $e->commit;
+            return 1;
+
+        } else {
+
+            $e->rollback;
+            return undef;
+        }
+
+    } else {
+
+        my $entry = $e->retrieve_actor_search_filter_group_entry([
+            $arg, {
+                flesh => 1,
+                flesh_fields => {asfge => ['grp', 'query']}
+            }
+        ]) or return $e->die_event;
+
+        return $e->die_event unless $e->allowed(
+            ['ADMIN_SEARCH_FILTER_GROUP', 'VIEW_SEARCH_FILTER_GROUP'], 
+            $entry->grp->owner);
+
+        $e->rollback;
+        $entry->grp($entry->grp->id); # for consistency
+        return $entry;
+    }
+}
+
 1;
diff --git a/Open-ILS/src/templates/conify/global/actor/search_filter_group.tt2 b/Open-ILS/src/templates/conify/global/actor/search_filter_group.tt2
new file mode 100644
index 0000000..4118015
--- /dev/null
+++ b/Open-ILS/src/templates/conify/global/actor/search_filter_group.tt2
@@ -0,0 +1,104 @@
+[% 
+    WRAPPER base.tt2;
+    ctx.page_title = l('Search Filter Group');
+    filter_group_id = ctx.page_args.0;
+%]
+
+<style>
+    #fge-edit-div {margin-top: 20px;}
+    #fge-edit-div td {padding : 5px;}
+</style>
+
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+
+    [% IF filter_group_id %]
+
+    <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
+        <div>[% l('Search Filter Group') %]</div>
+        <div>
+            <button dojoType='dijit.form.Button' onClick='showFgeEditor(null, true)'>[% l('New') %]</button>
+            <button dojoType='dijit.form.Button' onClick='fgeDelete()'>[% l('Delete Selected') %]</button>
+        </div>
+    </div>
+
+    <a href="[% ctx.base_path %]/conify/global/actor/search_filter_group">&#x2196; [% l('Return to Filter Groups') %]</a>
+    <br/> <br/>
+
+    <table
+        id="fgeGrid"
+        jsid="fgeGrid"
+        dojoType="openils.widget.FlattenerGrid"
+        columnPersistKey='"conify.actor.search_filter_group_entry"'
+        autoHeight="true"
+        showLoadFilter="true"
+        fmClass="'asfge'"
+        defaultSort="['pos']"
+        _mapExtras="{id : {path : 'id'}}"
+        query="{'grp': ['[% filter_group_id %]']}">
+        <thead>
+            <tr>
+                <th field="query_label" fpath="query.label" ffilter="true" get='getFgeLabel' formatter='formatFgeLabel'>[% l('Label') %]</th>
+                <th field="query_text" fpath="query.query_text" ffilter="true">[% l('Query Text') %]</th>
+                <th field="pos">[% l('Sort Position') %]</th>
+                <!-- mapExtras should cover "id", but it's not working;  investigate.. -->
+                <th field="id">[% l('ID') %]</th>
+            </tr>
+        </thead>
+    </table>
+
+    <div id='fge-edit-div' class='hidden'>
+        <table>
+            <tr><td>[% l('Label') %]</td><td><div id='fge-edit-label'></div></td></tr>
+            <tr><td>[% l('Query') %]</td><td><div id='fge-edit-query'></div></td></tr>
+            <tr><td>[% l('Position') %]</td><td><div id='fge-edit-pos'></div></td></tr>
+            <tr>
+                <td><button dojoType='dijit.form.Button' jsId='fgeSave'>[% l('Save') %]</button></td>
+                <td><button dojoType='dijit.form.Button' jsId='fgeCancel'>[% l('Cancel') %]</button></td>
+            </tr>
+        </table>
+    </div>
+
+    [% ELSE %]
+
+    <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
+        <div>[% l('Search Filter Group') %]</div>
+        <div>
+            <button dojoType='dijit.form.Button' onClick='fgGrid.showCreateDialog()'>[% l('New') %]</button>
+            <button dojoType='dijit.form.Button' onClick='fgGrid.deleteSelected()'>[% l('Delete Selected') %]</button>
+        </div>
+    </div>
+
+    <table
+        id="fgGrid"
+        jsid="fgGrid"
+        dojoType="openils.widget.FlattenerGrid"
+        columnPersistKey='"conify.actor.search_filter_group"'
+        autoHeight="true"
+        editOnEnter="true"
+        editStyle="pane"
+        showLoadFilter="true"
+        fmClass="'asfg'"
+        defaultSort="['code']"
+        mapExtras="{owner: {path: 'owner.id'}}"
+        fetchLock="true">
+        <thead>
+            <tr>
+                <th field="code" fpath="code" ffilter="true" get='getFgCode' formatter='formatFgCode'>[% l('Code') %]</th>
+                <th field="owner_sn" fpath="owner.shortname" ffilter="true">[% l('Owner') %]</th>
+                <th field="label" fpath="label" ffilter="true">[% l('Label') %]</th>
+                <th field="create_date" fpath="create_date" ffilter="true">[% l('Create Date') %]</th>
+            </tr>
+        </thead>
+    </table>
+
+    <br/><br/>
+    <div><i>[% l('To view groups for a different location, use the "Filter" option') %]</i></div>
+
+    [% END %]
+</div>
+
+<script type="text/javascript">var filterGroupId = '[% filter_group_id %]'</script>
+<script type="text/javascript" src='[% ctx.media_prefix %]/js/ui/default/conify/global/actor/search_filter_group.js'> </script>
+[% END %]
+
+
diff --git a/Open-ILS/web/js/ui/default/conify/global/actor/search_filter_group.js b/Open-ILS/web/js/ui/default/conify/global/actor/search_filter_group.js
new file mode 100644
index 0000000..3aadee7
--- /dev/null
+++ b/Open-ILS/web/js/ui/default/conify/global/actor/search_filter_group.js
@@ -0,0 +1,182 @@
+dojo.require('dijit.form.TextBox');
+dojo.require('openils.Util');
+dojo.require('openils.User');
+dojo.require('fieldmapper.OrgUtils');
+dojo.require("openils.widget.FlattenerGrid");
+dojo.require('openils.widget.AutoFieldWidget');
+dojo.require('openils.PermaCrud');
+
+var fgeEditLabel, fgeEditQuery, fgeEditPos;
+var curEntry, ocHandler;
+
+// Builds an editor table for filter group entries
+function showFgeEditor(fgeId, create) {
+
+    dojo.addClass(fgeGrid.domNode, 'hidden');
+    dojo.removeClass(dojo.byId('fge-edit-div'), 'hidden');
+
+    function cancelHandler() {
+        dojo.removeClass(fgeGrid.domNode, 'hidden');
+        dojo.addClass(dojo.byId('fge-edit-div'), 'hidden');
+    }
+
+    if (!fgeEditLabel) { 
+
+        // first time loading the editor.  build the widgets.
+
+        fgeEditLabel = new openils.widget.AutoFieldWidget({
+            fmField : 'label',
+            fmClass : 'asq',
+            parentNode : dojo.byId('fge-edit-label')
+        });
+
+        fgeEditLabel.build();
+
+        fgeEditQuery = new openils.widget.AutoFieldWidget({
+            fmField : 'query_text',
+            fmClass : 'asq',
+            parentNode : dojo.byId('fge-edit-query')
+        });
+
+        fgeEditQuery.build();
+
+        fgeEditPos = new openils.widget.AutoFieldWidget({
+            fmField : 'pos',
+            fmClass : 'asfge',
+            parentNode : dojo.byId('fge-edit-pos')
+        });
+
+        fgeEditPos.build();
+        dojo.connect(fgeCancel, 'onClick', cancelHandler);
+    }
+
+    var pcrud = new openils.PermaCrud({authtoken : openils.User.authtoken});
+
+    if (create) {
+
+        curEntry = new fieldmapper.asfge();
+        curEntry.isnew(true);
+        curEntry.grp(filterGroupId);
+        curEntry.query(new fieldmapper.asq());
+
+        fgeEditLabel.widget.attr('value', '');
+        fgeEditQuery.widget.attr('value', '');
+        fgeEditPos.widget.attr('value', '');
+
+    } else {
+
+        // we're editing an existing entry, fetch it first
+
+        curEntry = fieldmapper.standardRequest(
+            ['open-ils.actor', 'open-ils.actor.filter_group_entry.crud'],
+            {params : [openils.User.authtoken, fgeId], async : false}
+        );
+
+        fgeEditLabel.widget.attr('value', curEntry.query().label());
+        fgeEditQuery.widget.attr('value', curEntry.query().query_text());
+        fgeEditPos.widget.attr('value', curEntry.pos());
+        curEntry.ischanged(true);
+    }
+
+    if (ocHandler) dojo.disconnect(ocHandler);
+    ocHandler = dojo.connect(fgeSave, 'onClick',
+        function() {
+
+            // creates / updates entries
+
+            curEntry.query().label(fgeEditLabel.widget.attr('value'));
+            curEntry.query().query_text(fgeEditQuery.widget.attr('value'));
+            curEntry.pos(fgeEditPos.widget.attr('value'));
+            
+            var stat = fieldmapper.standardRequest(
+                ['open-ils.actor', 'open-ils.actor.filter_group_entry.crud'],
+                {params : [openils.User.authtoken, curEntry], async : false}
+            );
+
+            cancelHandler();
+            fgeGrid.refresh();
+        }
+    );
+}
+
+// deletes filter group entries (after fetching them first)
+function fgeDelete() {
+
+    dojo.forEach(
+        fgeGrid.getSelectedItems(),
+        function(item) {
+
+            console.log(item);
+            var id = fgeGrid.store.getValue(item, 'id');
+
+            var entry = fieldmapper.standardRequest(
+                ['open-ils.actor', 'open-ils.actor.filter_group_entry.crud'],
+                {params : [openils.User.authtoken, id], async : false}
+            );
+
+            entry.isdeleted(true);
+
+            var stat = fieldmapper.standardRequest(
+                ['open-ils.actor', 'open-ils.actor.filter_group_entry.crud'],
+                {params : [openils.User.authtoken, entry], async : false}
+            );
+        }
+    );
+
+    fgeGrid.refresh();
+}
+
+// builds a link to show the editor table
+function getFgeLabel(rowIdx, item) {
+    if (item) {
+        return {
+            id : this.grid.store.getValue(item, 'id'),
+            label : this.grid.store.getValue(item, 'query_label')
+        };
+    }
+}
+
+function formatFgeLabel(args) {
+    if (!args) return '';
+    return '<a href="javascript:showFgeEditor(' + args.id + ')">' + args.label + '</a>';
+}
+
+// builds a link to this group's entries page
+function getFgCode(rowIdx, item) {
+    if (item) {
+        return {
+            id : this.grid.store.getValue(item, 'id'),
+            code : this.grid.store.getValue(item, 'code')
+        };
+    }
+}
+
+function formatFgCode(args) {
+    if (!args) return '';
+    return '<a href="' + oilsBasePath + '/conify/global/actor/search_filter_group/' + args.id + '">' + args.code + '</a>';
+}
+
+function load() {
+
+    if (filterGroupId) {
+
+        // entries grid loads itself from template data.  
+        // nothing for us to do.
+
+    } else {
+
+        // filter groups by where we have edit permission
+        new openils.User().getPermOrgList(
+            ['ADMIN_SEARCH_FILTER_GROUP'],
+            function(list) { 
+                fgGrid.query = {owner : list};
+                fgGrid.refresh(); 
+                fgGrid.suppressEditFields = ['id', 'create_date'];
+            },
+            false, true
+        );
+    }
+}
+
+openils.Util.addOnLoad(load);
+

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/examples/fm_IDL.xml                       |    4 +-
 .../src/perlmods/lib/OpenILS/Application/Actor.pm  |  112 ++++++++++++
 Open-ILS/src/sql/Pg/950.data.seed-values.sql       |    6 +-
 .../XXXX.data.search_filter_group_perms.sql        |   29 +++
 .../conify/global/actor/search_filter_group.tt2    |  104 +++++++++++
 .../conify/global/actor/search_filter_group.js     |  182 ++++++++++++++++++++
 Open-ILS/web/opac/locale/en-US/lang.dtd            |    1 +
 .../xul/staff_client/chrome/content/main/menu.js   |    4 +
 .../chrome/content/main/menu_frame_menus.xul       |    3 +
 docs/RELEASE_NOTES_NEXT/search-filter-groups.txt   |   38 ++++
 10 files changed, 480 insertions(+), 3 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.data.search_filter_group_perms.sql
 create mode 100644 Open-ILS/src/templates/conify/global/actor/search_filter_group.tt2
 create mode 100644 Open-ILS/web/js/ui/default/conify/global/actor/search_filter_group.js
 create mode 100644 docs/RELEASE_NOTES_NEXT/search-filter-groups.txt


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list