adding lasso data support for use by the OPAC
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 4 Apr 2008 11:58:26 +0000 (11:58 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 4 Apr 2008 11:58:26 +0000 (11:58 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@9222 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/Makefile
Open-ILS/src/extras/autogen.sh
Open-ILS/src/extras/org_lasso_js.pl [new file with mode: 0644]

index 33c191e..335f05a 100644 (file)
@@ -105,6 +105,7 @@ autojs-install:
        @echo $@
        cp extras/fieldmapper.pl $(BINDIR)
        cp extras/org_tree_js.pl $(BINDIR)
+       cp extras/org_lasso_js.pl $(BINDIR)
        cp extras/org_tree_html_options.pl $(BINDIR)
        cp extras/org_tree_proximity.pl $(BINDIR)
        cp extras/autogen.sh $(BINDIR)
index 798c168..58f4530 100755 (executable)
@@ -84,6 +84,9 @@ perl org_tree_js.pl "$CONFIG" > "$JSDIR/OrgTree.js";
 echo "Updating OrgTree HTML";
 perl org_tree_html_options.pl "$CONFIG" "$SLIMPACDIR/lib_list.inc";
 
+echo "Updating Search Groups";
+perl org_lasso_js.pl "$CONFIG" > "$JSDIR/OrgLasso.js";
+
 if [ "$PROXIMITY" ]
 then
        echo "Refreshing proximity of org units";
diff --git a/Open-ILS/src/extras/org_lasso_js.pl b/Open-ILS/src/extras/org_lasso_js.pl
new file mode 100644 (file)
index 0000000..aed1b3e
--- /dev/null
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+use strict; use warnings;
+
+# ------------------------------------------------------------
+# turns the actor.org_lasso table into a js file
+# ------------------------------------------------------------
+
+use OpenSRF::System;
+use OpenILS::Utils::Fieldmapper;
+use OpenSRF::Utils::SettingsClient;
+use OpenSRF::Utils::JSON;
+
+die "usage: perl org_tree_js.pl <bootstrap_config>" unless $ARGV[0];
+OpenSRF::System->bootstrap_client(config_file => $ARGV[0]);
+
+Fieldmapper->import(IDL => OpenSRF::Utils::SettingsClient->new->config_value("IDL"));
+
+# must be loaded after the IDL is parsed
+require OpenILS::Utils::CStoreEditor;
+
+# fetch the org_unit's and org_unit_type's
+my $e = OpenILS::Utils::CStoreEditor->new;
+my $lassos = $e->request(
+    'open-ils.cstore.direct.actor.org_lasso.search.atomic',
+    {id => {"!=" => undef}},
+    {order_by => {lasso => 'name'}}
+);
+
+print
+    "var _lasso = [\n  " .
+    join( ",\n  ", map { OpenSRF::Utils::JSON->perl2JSON( $_ ) } @$lassos ) .
+    "\n]; /* Org Search Groups (Lassos) */ \n";
+
+