2 # -----------------------------------------------------------------------
3 # Copyright (C) 2005-2008 Georgia Public Library Service
4 # Bill Erickson <billserickson@gmail.com>
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 # -----------------------------------------------------------------------
19 # ---------------------------------------------------------------------------
20 # Make sure we're running as the correct user
21 # ---------------------------------------------------------------------------
22 [ $(whoami) != 'opensrf' ] && echo 'Must run as user "opensrf"' && exit;
26 echo "usage: $0 [-u] -c <c_config>";
28 echo "Mandatory parameters:";
29 echo -e " -c\t\tfull path to C configuration file (opensrf_core.xml)";
31 echo "Optional parameters:";
32 echo -e " -u\t\tupdate proximity of library sites in organization tree";
33 echo -e " \t\t(this is expensive for a large organization tree)";
37 echo " Update organization tree:";
38 echo " $0 -c SYSCONFDIR/opensrf_core.xml";
39 echo " $0 SYSCONFDIR/opensrf_core.xml";
41 echo " Update organization tree and refresh proximity:";
42 echo " $0 -u -c SYSCONFDIR/opensrf_core.xml";
50 if test "$BASEDIR" = "$0" ; then
59 # ---------------------------------------------------------------------------
60 # Load the command line options and set the global vars
61 # ---------------------------------------------------------------------------
62 while getopts "c:u h" flag; do
64 "c") CONFIG="$OPTARG";;
65 "u") PROXIMITY="REFRESH";;
70 [ -z "$CONFIG" ] && usage;
72 JSDIR="LOCALSTATEDIR/web/opac/common/js/";
73 FMDOJODIR="LOCALSTATEDIR/web/js/dojo/fieldmapper/";
74 SLIMPACDIR="LOCALSTATEDIR/web/opac/extras/slimpac/";
76 echo "Updating fieldmapper";
77 perl fieldmapper.pl "$CONFIG" > "$JSDIR/fmall.js";
78 cp "$JSDIR/fmall.js" "$FMDOJODIR/"
80 echo "Updating web_fieldmapper";
81 perl fieldmapper.pl "$CONFIG" "web_core" > "$JSDIR/fmcore.js";
83 echo "Updating OrgTree";
84 perl org_tree_js.pl "$CONFIG" > "$JSDIR/OrgTree.js";
86 echo "Updating OrgTree HTML";
87 perl org_tree_html_options.pl "$CONFIG" "$SLIMPACDIR/lib_list.inc";
88 cp "$JSDIR/OrgTree.js" "$FMDOJODIR/"
90 echo "Updating Search Groups";
91 perl org_lasso_js.pl "$CONFIG" > "$JSDIR/OrgLasso.js";
92 cp "$JSDIR/OrgLasso.js" "$FMDOJODIR/"
96 echo "Refreshing proximity of org units";
97 perl org_tree_proximity.pl "$CONFIG";