From 269434aa7c132681f9507c370e340b3dbcb3081c Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 17 Nov 2005 11:34:50 +0000 Subject: [PATCH] reporter stuff git-svn-id: svn://svn.open-ils.org/ILS/trunk@2052 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/Makefile | 11 + Open-ILS/src/perlmods/OpenILS/WWW/Reporter.pm | 6 +- .../OpenILS/WWW/Reporter/transforms.pm | 77 ++++++ Open-ILS/src/reporter/clark-kent.pl | 244 +++++++++++++++++ Open-ILS/src/reporter/config.sql | 25 ++ Open-ILS/src/reporter/report_base.example.xml | 6 +- Open-ILS/src/reporter/tables.example.xml | 116 +++++++- Open-ILS/src/reporter/templates/class_manip | 79 +----- Open-ILS/src/reporter/templates/dashboard.ttk | 6 +- Open-ILS/src/reporter/templates/html/body | 25 ++ Open-ILS/src/reporter/templates/html/cell | 24 ++ Open-ILS/src/reporter/templates/html/html | 6 + Open-ILS/src/reporter/templates/html/row | 17 ++ Open-ILS/src/reporter/templates/html/table | 18 ++ .../src/reporter/templates/logic_header.ttk | 6 +- Open-ILS/src/reporter/templates/stage1.ttk | 22 +- Open-ILS/src/reporter/templates/stage2.ttk | 257 ++++++++++++------ Open-ILS/src/reporter/templates/stage3.ttk | 4 +- Open-ILS/src/reporter/templates/utils | 18 ++ Open-ILS/src/reporter/templates/widget_manip | 32 ++- .../widgets/string-choose.multiselect | 2 +- Open-ILS/src/sql/Pg/002.schema.config.sql | 3 + Open-ILS/src/sql/Pg/020.schema.functions.sql | 4 + Open-ILS/src/sql/Pg/040.schema.asset.sql | 20 ++ config.sh | 4 + install.sh | 14 +- 26 files changed, 865 insertions(+), 181 deletions(-) create mode 100644 Open-ILS/src/perlmods/OpenILS/WWW/Reporter/transforms.pm create mode 100755 Open-ILS/src/reporter/clark-kent.pl create mode 100644 Open-ILS/src/reporter/templates/html/body create mode 100644 Open-ILS/src/reporter/templates/html/cell create mode 100644 Open-ILS/src/reporter/templates/html/html create mode 100644 Open-ILS/src/reporter/templates/html/row create mode 100644 Open-ILS/src/reporter/templates/html/table create mode 100644 Open-ILS/src/reporter/templates/utils diff --git a/Open-ILS/src/Makefile b/Open-ILS/src/Makefile index b723fb1902..8dd7265320 100644 --- a/Open-ILS/src/Makefile +++ b/Open-ILS/src/Makefile @@ -81,6 +81,17 @@ perl-install: # ----------------------------------------------------------------------------------- +reporter-install: + @echo $@ + @echo "Installing Reporter templates to $(REPORTERDIR) and example configs to $(ETCDIR)" + cp reporter/report_base.example.xml $(ETCDIR)/reporter.example.xml + cp reporter/tables.example.xml $(ETCDIR) + cp reporter/widgets.example.xml $(ETCDIR) + mkdir -p $(REPORTERDIR) + cp -r reporter/templates/* $(REPORTERDIR) + +# ----------------------------------------------------------------------------------- + cgi-bootstrap: @echo "Installing cgi's to $(CGIDIR)" mkdir -p $(TMP)/cgi-bin diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/Reporter.pm b/Open-ILS/src/perlmods/OpenILS/WWW/Reporter.pm index 64b786ab41..ecbb273914 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/Reporter.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/Reporter.pm @@ -1,6 +1,8 @@ package OpenILS::WWW::Reporter; use strict; use warnings; +use vars qw/$dtype_xform_map $dtype_xform/; + use Apache2 (); use Apache2::Log; use Apache2::Const -compile => qw(OK REDIRECT :log); @@ -18,7 +20,7 @@ use XML::LibXML; use OpenSRF::Utils::SettingsParser; use OpenILS::Utils::Fieldmapper; - +use OpenILS::WWW::Reporter::transforms; # set the bootstrap config and template include directory when @@ -88,6 +90,8 @@ sub _process_template { my $ttk = $params{template} || return undef; my $apache = $params{apache} || undef; my $param_hash = $params{params} || {}; + $$param_hash{dtype_xform_map} = $OpenILS::WWW::Reporter::dtype_xform_map; + $$param_hash{dtype_xform} = $OpenILS::WWW::Reporter::dtype_xform; my $template; diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/Reporter/transforms.pm b/Open-ILS/src/perlmods/OpenILS/WWW/Reporter/transforms.pm new file mode 100644 index 0000000000..d3b3c2d7e3 --- /dev/null +++ b/Open-ILS/src/perlmods/OpenILS/WWW/Reporter/transforms.pm @@ -0,0 +1,77 @@ +#!/usr/bin/perl + +package OpenILS::WWW::Reporter; + +our $dtype_xform_map = { + 'int' => [ 'avg','stddev','sum','count','count_dist','numformat'], + 'numeric' => [ 'avg','stddev','sum','count','count_dist','numformat'], + 'float' => [ 'avg','stddev','sum','count','count_dist','numformat'], + 'time' => [ 'count', 'dateformat'], + 'date' => [ 'count', 'age','dateformat'], + 'timestamp' => [ 'count', 'age','dateformat'], + 'timestamptz' => [ 'count', 'age','dateformat'], + 'text' => [ 'count','count_dist','lower','upper','substr','dewy','dewy_prefix'], +}; + + + +our $dtype_xforms = { + 'avg' => { + 'name' => 'Average per group', + 'select' => 'AVG(?COLNAME?)', + 'group' => 0 }, + 'stddev' => { + 'label' => 'Standard Deviation per group', + 'select' => 'STDDEV(?COLNAME?)', + 'group' => 0 }, + 'sum' => { + 'label' => 'Sum per group', + 'select' => 'SUM(?COLNAME?)', + 'group' => 0 }, + 'count' => { + 'label' => 'Count per group', + 'select' => 'COUNT(?COLNAME?)', + 'group' => 0 }, + 'count_dist' => { + 'label' => 'Distinct Count per group', + 'select' => 'COUNT(DISTINCT ?COLNAME?)', + 'group' => 0 }, + 'dewy_prefix' => { + 'label' => 'Extract Dewey number prefix from call number', + 'select' => 'call_number_dewey(?COLNAME?,?PARAM?)', + 'param' => 1, + 'group' => 1 }, + 'dewy' => { + 'label' => 'Extract Dewey number from call number', + 'select' => 'call_number_dewey(?COLNAME?)', + 'group' => 1 }, + 'lower' => { + 'label' => 'Transform string to lower case', + 'select' => 'LOWER(?COLNAME?)', + 'group' => 1 }, + 'upper' => { + 'label' => 'Transform string to upper case', + 'select' => 'UPPER(?COLNAME?)', + 'group' => 1 }, + 'substr' => { + 'label' => 'Trim string length', + 'select' => 'substr(?COLNAME?,1,?PARAM?)', + 'param' => 1, + 'group' => 1 }, + 'age' => { + 'label' => 'Age as of runtime -- day granularity', + 'select' => 'AGE(?COLNAME?::DATE)', + 'group' => 1 }, + 'dateformat' => { # see http://www.postgresql.org/docs/8.0/interactive/functions-formatting.html + 'label' => 'Format date and time', + 'select' => 'TO_CHAR(?COLNAME?,?PARAM?)', + 'param' => 1, + 'group' => 1 }, + 'numformat' => { # see http://www.postgresql.org/docs/8.0/interactive/functions-formatting.html + 'label' => 'Format Numeric data', + 'select' => 'TO_CHAR(?COLNAME?,?PARAM?)', + 'param' => 1, + 'group' => 1 }, +}; + +; diff --git a/Open-ILS/src/reporter/clark-kent.pl b/Open-ILS/src/reporter/clark-kent.pl new file mode 100755 index 0000000000..438efb6cca --- /dev/null +++ b/Open-ILS/src/reporter/clark-kent.pl @@ -0,0 +1,244 @@ +#!/usr/bin/perl -w + +use strict; +use DBI; +use XML::LibXML; +use Getopt::Long; +use DateTime; +use DateTime::Format::ISO8601; +use JSON; +use Data::Dumper; +use OpenILS::WWW::Reporter::transforms; + +my $current_time = DateTime->from_epoch( epoch => time() )->strftime('%FT%T%z'); + +my ($base_xml, $count) = ('/openils/conf/reporter.xml', 1); + +GetOptions( + "file=s" => \$base_xml, + "concurrency=i" => \$count, +); + +my $parser = XML::LibXML->new; +$parser->expand_xinclude(1); + +my $doc = $parser->parse_file($base_xml); + +warn $doc->toString; + +my $db_driver = $doc->findvalue('/reporter/setup/database/driver'); +my $db_host = $doc->findvalue('/reporter/setup/database/host'); +my $db_name = $doc->findvalue('/reporter/setup/database/name'); +my $db_user = $doc->findvalue('/reporter/setup/database/user'); +my $db_pw = $doc->findvalue('/reporter/setup/database/password'); + +my $dsn = "dbi:" . $db_driver . ":dbname=" . $db_name .';host=' . $db_host; + +my $dbh = DBI->connect($dsn,$db_user,$db_pw); + +# make sure we're not already running $count reports +my ($running) = $dbh->selectrow_array(<prepare(<execute($current_time); + +my @reports; +while (my $r = $sth->fetchrow_hashref) { + $r->{sql} = generate_query( $r ); + push @reports, $r; +} +$sth->finish; + +for my $r ( @reports ) { + my $sql = shift @{ $r->{sql} }; + + $sth = $dbh->prepare($sql); + + $sth->execute(@{ $r->{sql} }); + while (my $row = $sth->fetchrow_hashref) { + print join(', ', map {"$_\t=> $$row{$_}"} keys %$row)."\n"; + } +} + + +#------------------------------------------------------------------- + +sub table_by_id { + my $id = shift; + my ($node) = $doc->findnodes("//*[\@id='$id']"); + if ($node && $node->findvalue('@table')) { + ($node) = $doc->findnodes("//*[\@id='".$node->getAttribute('table')."']"); + } + return $node; +} + +sub generate_query { + my $s3 = shift; + warn Dumper($s3); + + my $r = JSON->JSON2perl( $s3->{params} ); + warn Dumper($r); + + my $s2 = $dbh->selectrow_hashref(<<" SQL", {}, $s3->{stage2}); + SELECT * + FROM reporter.stage2 + WHERE id = ? + SQL + warn Dumper($s2); + + my @group_by; + my @aggs; + my $core = $s2->{stage1}; + my @dims; + + for my $t (keys %{$$r{filter}}) { + if ($t ne $core) { + push @dims, $t; + } + } + + for my $t (keys %{$$r{output}}) { + if ($t ne $core && !grep { $t } @dims ) { + push @dims, $t; + } + } + warn Dumper(\@dims); + + my @dim_select; + my @dim_from; + for my $d (@dims) { + my $t = table_by_id($d); + my $t_name = $t->findvalue('tablename'); + push @dim_from, "$t_name AS \"$d\""; + + my $k = $doc->findvalue("//*[\@id='$d']/\@key"); + push @dim_select, "\"$d\".\"$k\" AS \"${d}_${k}\""; + + for my $c ( keys %{$$r{output}{$d}} ) { + push @dim_select, "\"$d\".\"$c\" AS \"${d}_${c}\""; + } + + for my $c ( keys %{$$r{filter}{$d}} ) { + next if (exists $$r{output}{$d}{$c}); + push @dim_select, "\"$d\".\"$c\" AS \"${d}_${c}\""; + } + } + + my $d_select = + '(SELECT ' . join(',', @dim_select) . + ' FROM ' . join(',', @dim_from) . ') AS dims'; + + warn "*** [$d_select]\n"; + + my $col = 1; + my @groupby; + my @output; + my @join; + for my $t ( keys %{$$r{output}} ) { + my $t_name = $t; + $t_name = "dims" if ($t ne $core); + + my $t_node = table_by_id($t); + + for my $c ( keys %{$$r{output}{$t}} ) { + my $label = $t_node->findvalue("fields/field[\@name='$c']/label"); + + my $full_col = $c; + $full_col = "${t}_${c}" if ($t ne $t_name); + $full_col = "\"$t_name\".\"$full_col\""; + + + if (my $xform_type = $$r{xform}{type}{$t}{$c}) { + my $xform = $$OpenILS::WWW::Reporter::dtype_xforms{$xform_type}; + if ($xform->{group}) { + push @groupby, $col; + } + $label = "$$xform{label} -- $label"; + + my $tmp = $xform->{'select'}; + $tmp =~ s/\?COLNAME\?/$full_col/gs; + $tmp =~ s/\?PARAM\?/$$r{xform}{param}{$t}{$c}/gs; + $full_col = $tmp; + } else { + push @groupby, $col; + } + + push @output, "$full_col AS \"$label\""; + $col++; + } + + if ($t ne $t_name) { + my $k = $doc->findvalue("//*[\@id='$t']/\@key"); + my $f = $doc->findvalue("//*[\@id='$t']/\@field"); + push @join, "dims.\"${t}_${k}\" = \"$core\".\"$f\""; + } + } + + my @where; + my @bind; + for my $t ( keys %{$$r{filter}} ) { + my $t_name = $t; + $t_name = "dims" if ($t ne $core); + + my $t_node = table_by_id($t); + + for my $c ( keys %{$$r{filter}{$t}} ) { + my $label = $t_node->findvalue("fields/field[\@name='$c']/label"); + + my $full_col = $c; + $full_col = "${t}_${c}" if ($t ne $t_name); + $full_col = "\"$t_name\".\"$full_col\""; + + # XXX make this use widget specific code + + my ($fam) = keys %{ $$r{filter}{$t}{$c} }; + my ($w) = keys %{ $$r{filter}{$t}{$c}{$fam} }; + my $val = $$r{filter}{$t}{$c}{$fam}{$w}; + + if (ref $val) { + push @where, "$full_col IN (".join(",",map {'?'}@$val).")"; + push @bind, @$val; + } else { + push @where, "$full_col = ?"; + push @bind, $val; + } + } + } + + my $t = table_by_id($core)->findvalue('tablename'); + my $from = " FROM $t AS \"$core\" RIGHT JOIN $d_select ON (". join(' AND ', @join).")"; + my $select = + "SELECT ".join(',', @output). + $from. + ' WHERE '.join(' AND ', @where). + ' GROUP BY '.join(',',@groupby); + + warn " !!! [$select]\n"; + warn " !!! [".join(', ',@bind)."]\n"; + + return [ $select, @bind ]; +} + + + + + + diff --git a/Open-ILS/src/reporter/config.sql b/Open-ILS/src/reporter/config.sql index d8454c6df3..9cc8bd8d7d 100644 --- a/Open-ILS/src/reporter/config.sql +++ b/Open-ILS/src/reporter/config.sql @@ -46,5 +46,30 @@ CREATE TABLE reporter.stage3 ( recurrence interval ); +CREATE TABLE reporter.run_queue ( + id serial primary key, + stage3 int not null + references reporter.stage3 (id) + on delete restrict + deferrable + initially deferred, + queue_time timestamp with time zone not null default now(), + run_time timestamp with time zone, + complete_time timestamp with time zone, + state text check (state in ('wait','running','complete')) +); + +CREATE TABLE reporter.output ( + id int primary key, + stage3 int not null + references reporter.stage3 (id) + on delete restrict + deferrable + initially deferred, + queue_time timestamp with time zone not null default now(), + run_time timestamp with time zone not null, + complete_time timestamp with time zone not null +); + COMMIT; diff --git a/Open-ILS/src/reporter/report_base.example.xml b/Open-ILS/src/reporter/report_base.example.xml index a7cca599e0..ae03ac3819 100644 --- a/Open-ILS/src/reporter/report_base.example.xml +++ b/Open-ILS/src/reporter/report_base.example.xml @@ -3,12 +3,10 @@ - /tmp/reporter/ - /tmp/reporter/ - /tmp/reporter/ - /tmp/reporter/ + /tmp/reporter/ + Pg 10.0.0.2 demo-dev postgres diff --git a/Open-ILS/src/reporter/tables.example.xml b/Open-ILS/src/reporter/tables.example.xml index 4d4ec28a66..a84287cda2 100644 --- a/Open-ILS/src/reporter/tables.example.xml +++ b/Open-ILS/src/reporter/tables.example.xml @@ -1,7 +1,121 @@ - +
+ + Base table for creating snapshot reports on copy information + stats.fleshed_copy + + + + + Copy ID + + + + Copy Barcode + + + + ID of the Owning Library + + + + ID of the Circulating Library + + + + Timestamp of the copy's cataloging + + + + MARC Item Language + + + + MARC Item Form of Material + + + + MARC Item Type + + + + Copy Call Number Label + + + + + + + + +
+ + + + Table containing library hierarchy definition + actor.org_unit + + + + + Library ID + + + + Library Name + + + + Library Short (Policy) Name + + +
+ + Base table for creating reports on silly wordsstats.silly_fact diff --git a/Open-ILS/src/reporter/templates/class_manip b/Open-ILS/src/reporter/templates/class_manip index 5fdd59b318..dd01c20229 100644 --- a/Open-ILS/src/reporter/templates/class_manip +++ b/Open-ILS/src/reporter/templates/class_manip @@ -2,67 +2,6 @@ PROCESS inputs; -dtype_xforms = { - 'avg' => { - 'name' => 'Average per group', - 'select' => 'AVG(?COLNAME?)', - 'group' => 0 }, - 'stddev' => { - 'label' => 'Standard Deviation per group', - 'select' => 'STDDEV(?COLNAME?)', - 'group' => 0 }, - 'sum' => { - 'label' => 'Sum per group', - 'select' => 'SUM(?COLNAME?)', - 'group' => 0 }, - 'count' => { - 'label' => 'Count per group', - 'select' => 'COUNT(?COLNAME?)', - 'group' => 0 }, - 'count_dist' => { - 'label' => 'Distinct Count per group', - 'select' => 'COUNT(DISTINCT ?COLNAME?)', - 'group' => 0 }, - 'lower' => { - 'label' => 'Transform string to lower case', - 'select' => 'LOWER(?COLNAME?)', - 'group' => 1 }, - 'upper' => { - 'label' => 'Transform string to upper case', - 'select' => 'UPPER(?COLNAME?)', - 'group' => 1 }, - 'substr' => { - 'label' => 'Trim string length', - 'select' => 'substr(?COLNAME?,1,?PARAM?)', - 'param' => 1, - 'group' => 1 }, - 'age' => { - 'label' => 'Age as of runtime -- day granularity', - 'select' => 'AGE(?COLNAME?::DATE)', - 'group' => 1 }, - 'dateformat' => { # see http://www.postgresql.org/docs/8.0/interactive/functions-formatting.html - 'label' => 'Format date and time', - 'select' => 'TO_CHAR(?COLNAME?,?PARAM?)', - 'param' => 1, - 'group' => 1 }, - 'numformat' => { # see http://www.postgresql.org/docs/8.0/interactive/functions-formatting.html - 'label' => 'Format Numeric data', - 'select' => 'TO_CHAR(?COLNAME?,?PARAM?)', - 'param' => 1, - 'group' => 1 }, -}; - -dtype_xform_map = { - 'int' => [ 'avg','stddev','sum','count','count_dist','numformat'], - 'numeric' => [ 'avg','stddev','sum','count','count_dist','numformat'], - 'float' => [ 'avg','stddev','sum','count','count_dist','numformat'], - 'time' => [ 'count', 'dateformat'], - 'date' => [ 'count', 'age','dateformat'], - 'timestamp' => [ 'count', 'age','dateformat'], - 'timestamptz' => [ 'count', 'age','dateformat'], - 'text' => [ 'count','count_dist','lower','upper','substr'], -}; - BLOCK class_table; WRAPPER html/table width='100%' style='border-top: 1px solid black'; WRAPPER html/row; @@ -70,7 +9,7 @@ BLOCK class_table; %]Name:[% END; WRAPPER html/cell; - class.findvalue('label'); + classname.findvalue('label'); END; END; WRAPPER html/row; @@ -78,10 +17,10 @@ BLOCK class_table; %]Description:[% END; WRAPPER html/cell; - class.findvalue('description'); + classname.findvalue('description'); END; END; - IF class.findvalue('@fact-table') == 'true' AND CGI.param('create_stage2') != 1; + IF classname.findvalue('@fact-table') == 'true' AND CGI.param('create_stage2') != 1; WRAPPER html/row; WRAPPER html/cell align="right"; %]Actions:[% @@ -100,7 +39,7 @@ BLOCK class_table; WRAPPER html/cell; q = 'select * from reporter.stage2 ' _ 'where pub is true or owner = ' _ DBI.quote(user.id()); - FOR r IN DBI.query(q); + FOR r = DBI.query(q); INCLUDE anchor href="stage2?id=" _ r.id content=utils.JSON2perl(r.params).templatename; @@ -120,7 +59,7 @@ END; BLOCK class_fields; - FOR f IN class.findnodes('fields/field'); + FOR f = classname.findnodes('fields/field'); WRAPPER html/row; WRAPPER html/cell align="right"; f.findvalue('label'); @@ -146,15 +85,15 @@ BLOCK class_detail; INCLUDE class_fields; - IF class.findvalue('@fact-table') == 'true' AND nosub != 1; + IF classname.findvalue('@fact-table') == 'true' AND nosub != 1; WRAPPER html/row; WRAPPER html/cell align="right"; %]Report Dimensions
and Attributes:
[% END; WRAPPER html/cell; - incs = class.findnodes('links/link/@field'); + incs = classname.findnodes('links/link/@field'); - FOR dim IN incs; + FOR dim = incs; link_xpath = '/reporter/tables/table[@id="' _ fact_table _'"]'_ '/links/link[@field="' _ dim.value() _ '"]/@table'; logme(link_xpath); @@ -166,7 +105,7 @@ BLOCK class_detail; dim_def = config.findnodes(dim_xpath); - INCLUDE class_table class = dim_def; + INCLUDE class_table classname = dim_def; END; END; END; diff --git a/Open-ILS/src/reporter/templates/dashboard.ttk b/Open-ILS/src/reporter/templates/dashboard.ttk index 56edd33dcc..e5a6f2b22a 100644 --- a/Open-ILS/src/reporter/templates/dashboard.ttk +++ b/Open-ILS/src/reporter/templates/dashboard.ttk @@ -193,7 +193,9 @@ BLOCK fact_tables; INCLUDE html/cell content='Fact table' nowrap='nowrap' col='lightgray' style='border:solid gray 1px;'; INCLUDE html/cell content='Description' nowrap='nowrap' col='lightgray' style='border:solid gray 1px;'; END; - FOR tab IN config.findnodes("/reporter/tables/table[@fact-table='true']"); + + fact_table_xpath = "/reporter/tables/table[@fact-table='true']"; + FOR tab = config.findnodes(fact_table_xpath); tid = tab.findvalue('@id'); bg='lightblue'; IF loop.count % 2; @@ -203,7 +205,7 @@ BLOCK fact_tables; p = utils.JSON2perl( template.params ); INCLUDE html/cell col=bg - content=link(content=tab.findvalue('tablename'),href="stage1?id=$tid") style='border:solid gray 1px;'; + content=link(content=tab.findvalue('label'),href="stage1?id=$tid") style='border:solid gray 1px;'; INCLUDE html/cell content=tab.findvalue('description') style='border:solid gray 1px;'; END; END; diff --git a/Open-ILS/src/reporter/templates/html/body b/Open-ILS/src/reporter/templates/html/body new file mode 100644 index 0000000000..9593f6da15 --- /dev/null +++ b/Open-ILS/src/reporter/templates/html/body @@ -0,0 +1,25 @@ +[% + + #--------------------------------------------------------------------------------- + #html/body: ... element for HTML pages + # + # ARGS: + # + # content # body content + #--------------------------------------------------------------------------------- + + ""; + + content; + + ""; + +%] diff --git a/Open-ILS/src/reporter/templates/html/cell b/Open-ILS/src/reporter/templates/html/cell new file mode 100644 index 0000000000..890ab80a06 --- /dev/null +++ b/Open-ILS/src/reporter/templates/html/cell @@ -0,0 +1,24 @@ +[%# html/cell: an empty and orphaned HTML table cell, + # ARGS: + # col # background colour (default: none) + # align # horizontal alignment (default: none) + # valign # vertical alignment (default: none) + # colspan # span multiple columns (defualt: none) + # rowspan # span multiple rows (defualt: none) + # content # box content +-%] + + + diff --git a/Open-ILS/src/reporter/templates/html/html b/Open-ILS/src/reporter/templates/html/html new file mode 100644 index 0000000000..20f02456ee --- /dev/null +++ b/Open-ILS/src/reporter/templates/html/html @@ -0,0 +1,6 @@ + + + +[% "\n" _ content _ "\n" %] + diff --git a/Open-ILS/src/reporter/templates/html/row b/Open-ILS/src/reporter/templates/html/row new file mode 100644 index 0000000000..a1ecd266c3 --- /dev/null +++ b/Open-ILS/src/reporter/templates/html/row @@ -0,0 +1,17 @@ +[%# row: an empty and orphaned HTML table row, . . . + # ARGS: + # col # background colour (default: none) + # valign # vertical alignment (default: none) + # align # horizontal alignment (default: none) + # content # box content +-%] + + +[%- content -%] + + diff --git a/Open-ILS/src/reporter/templates/html/table b/Open-ILS/src/reporter/templates/html/table new file mode 100644 index 0000000000..7b0095941a --- /dev/null +++ b/Open-ILS/src/reporter/templates/html/table @@ -0,0 +1,18 @@ +[%# table: an empty HTML table
. . . +[%- content -%] +
. . .
+ # ARGS: + # border # border width (default: 0) + # col # background colour (default: none) + # width # width of box (default: none, grow to fit content) + # pad # cellpadding (default: none) + # cellspace # cellspacing (default: none) + # content # box content +-%] + +[%- content -%] +
diff --git a/Open-ILS/src/reporter/templates/logic_header.ttk b/Open-ILS/src/reporter/templates/logic_header.ttk index d7a0804530..185be269e5 100644 --- a/Open-ILS/src/reporter/templates/logic_header.ttk +++ b/Open-ILS/src/reporter/templates/logic_header.ttk @@ -5,6 +5,8 @@ [% +PROCESS utils; + BLOCK logme_block; "\n\t\n"; END; @@ -17,15 +19,17 @@ USE WebSession; USE utils = WebUtils; USE config = XML.LibXML(config_xml, expand_xinclude => 1); + dir = '/reporter/setup/files/' _ stage_dir; dir = config.findvalue(dir); +dbdriver = config.findvalue('/reporter/setup/database/driver'); dbname = config.findvalue('/reporter/setup/database/name'); dbhost = config.findvalue('/reporter/setup/database/host'); d_u = config.findvalue('/reporter/setup/database/user'); d_p = config.findvalue('/reporter/setup/database/password'); -dsn = "dbi:Pg:dbname=" _ dbname _';host=' _ dbhost; +dsn = "dbi:" _ dbdriver _ ":dbname=" _ dbname _';host=' _ dbhost; logme([dsn,d_u,d_p]); diff --git a/Open-ILS/src/reporter/templates/stage1.ttk b/Open-ILS/src/reporter/templates/stage1.ttk index 82c8f15ab2..8aed7c2d36 100644 --- a/Open-ILS/src/reporter/templates/stage1.ttk +++ b/Open-ILS/src/reporter/templates/stage1.ttk @@ -47,7 +47,7 @@ BLOCK one_stage1; fact_table = table.findvalue('@id'); logme(fact_table); - INCLUDE class_table class=table; + INCLUDE class_table classname=table; INCLUDE stage2_new IF CGI.param('create_stage2') == 1; @@ -59,14 +59,14 @@ END; BLOCK all_stage1; '
    '; - FOR tab IN config.findnodes("//tables/table[@fact-table='true']"); + FOR tab = config.findnodes("/reporter/tables/table[@fact-table='true']"); fact_table = tab.findvalue("@id"); logme("Fact Table is $fact_table"); '
  • '; - INCLUDE class_table class=tab; + INCLUDE class_table classname=tab; IF loop.count != loop.size; '
    '; @@ -116,9 +116,10 @@ BLOCK stage2_new; INCLUDE widget_selector tableid=fact_table columns=config.findnodes(col_xpath) force=1; END; - dim_xpath = "/reporter/tables/table[@id='$fact_table']/links/link/@table"; - FOR dim_table IN config.findnodes(dim_xpath); - dim_table = dim_table.value(); + dim_xpath = "/reporter/tables/table[@id='$fact_table']/links/link"; + FOR dim_link = config.findnodes(dim_xpath); + dim_table = dim_link.findvalue('@table'); + link_id = dim_link.findvalue('@id'); dimension = config.findnodes("/reporter/tables/table[@id='$dim_table']"); '

    '; @@ -138,12 +139,17 @@ BLOCK stage2_new; WRAPPER html/row; WRAPPER html/cell colspan=2; # checkbox input here ... - INCLUDE checkbox name="filter" value=dim_table checked=1; + INCLUDE checkbox name="filter" value=link_id checked=1; + + link_label_xpath = '../../fields/field[@name="' _ dim_link.findvalue('@field') _ '"]/label'; + dim_link.findvalue(link_label_xpath); + + ' -- '; dimension.findvalue('label'); ' Dimension'; END; END; - INCLUDE widget_selector tableid=dim_table; + INCLUDE widget_selector tableid=link_id; END; END; diff --git a/Open-ILS/src/reporter/templates/stage2.ttk b/Open-ILS/src/reporter/templates/stage2.ttk index 3928e7ce4a..0bd913e78e 100644 --- a/Open-ILS/src/reporter/templates/stage2.ttk +++ b/Open-ILS/src/reporter/templates/stage2.ttk @@ -41,7 +41,7 @@ BLOCK save_stage2; owner = user.id(); p_obj = {}; - FOR p IN CGI.param(); + FOR p = CGI.param(); logme([p,CGI.param(p)]); @@ -52,9 +52,9 @@ BLOCK save_stage2; p4 = parts.3; IF p4 - AND (CGI.param("$p1:$p2:$p3") == p4) - AND (CGI.param("$p1:$p2").list.grep(p3).size > 0) - AND (CGI.param("$p1").list.grep(p2).size > 0); + AND (CGI.param("$p1").list.grep("^$p2$").size > 0) + AND (CGI.param("$p1:$p2").list.grep("^$p3$").size > 0) + AND (CGI.param("$p1:$p2:$p3").list.grep("^$p4$").size > 0); p_obj.$p1.$p2.$p3.$p4 = CGI.param(p); @@ -113,19 +113,43 @@ BLOCK view_stage2; INCLUDE html/cell colspan=4 content="Filterable Attributes:"; END; - FOR f_table IN params.filter.keys; - logme([f_table]); + core_table = params.stage1; + + tables = params.filter.keys; + tables.unshift(core_table); + tables = tables.unique; + + FOR t = tables; + logme(['table id or link id', t]); + + f_table = INCLUDE find_table_id id=t; + table = config.findnodes( "/reporter/tables/table[@id='$f_table']"); WRAPPER html/row; INCLUDE html/cell; - INCLUDE html/cell colspan=4 align='left' content=table.findvalue( 'label' ); + WRAPPER html/cell colspan=4 align='left'; + + IF t != f_table; + link_xpath = '//*[@id="' _ t _ '"]'; + dim_link = config.findnodes(link_xpath); + + link_label_xpath = + '../../fields/field[@name="' _ + dim_link.findvalue('@field') _ '"]/label'; + dim_link.findvalue(link_label_xpath); + + ' -- '; + END; + + table.findvalue( 'label' ); + END; END; - FOR f_field IN params.filter.$f_table.keys; + FOR f_field = params.filter.$t.keys; logme([f_table,f_field]); - FOR f_fam IN params.filter.$f_table.$f_field.keys; + FOR f_fam = params.filter.$t.$f_field.keys; logme([f_table,f_field,f_fam]); - f_widget = params.filter.$f_table.$f_field.$f_fam; + f_widget = params.filter.$t.$f_field.$f_fam; logme([f_table,f_field,f_fam,f_widget]); WRAPPER html/row; @@ -150,20 +174,44 @@ BLOCK view_stage2; INCLUDE html/cell colspan=5 content="Attributes Available for Output"; END; - FOR f_table IN params.dims.keys; + tables = params.dims.keys; + tables.unshift(core_table); + tables = tables.unique; + + FOR t = tables; + + f_table = INCLUDE find_table_id id=t; + table = config.findnodes( "/reporter/tables/table[@id='$f_table']"); tname = table.findvalue( "label" ); tdesc = table.findvalue( "desription" ); - NEXT IF table.findvalue('@fact-table') == 'true'; + #NEXT IF table.findvalue('@fact-table') == 'true'; WRAPPER html/row; INCLUDE html/cell; - INCLUDE html/cell colspan=4 align='left' content=tname; + WRAPPER html/cell colspan=4 align='left'; + IF t != f_table; + link_xpath = '//*[@id="' _ t _ '"]'; + dim_link = config.findnodes(link_xpath); + + link_label_xpath = + '../../fields/field[@name="' _ + dim_link.findvalue('@field') _ '"]/label'; + dim_link.findvalue(link_label_xpath); + + ' -- '; + END; + tname; + END; END; - FOR field IN table.findnodes('fields/field[not(@primary) or @primary != "true"]'); + FOR field = table.findnodes('fields/field[not(@primary) or @primary != "true"]'); + link_test = '../../links/link[@field="' _ field.findvalue('@name') _ '"]'; + logme(['link_test',link_test]); + NEXT IF field.findnodes( link_test ); + fname = field.findvalue( "label" ); fdesc = field.findvalue( "desription" ); @@ -180,9 +228,6 @@ BLOCK view_stage2; END; - - - BLOCK run_stage2; logme(tmpl.params); params = utils.JSON2perl( tmpl.params ); @@ -209,18 +254,38 @@ BLOCK run_stage2; INCLUDE html/cell colspan=4 content="Filterable Attributes:"; END; - FOR f_table IN params.filter.keys; + core_table = params.stage1; + + tables = params.filter.keys; + tables.unshift(core_table); + tables = tables.unique; + + FOR t = tables; + f_table = INCLUDE find_table_id id=t; logme([f_table]); table = config.findnodes( "/reporter/tables/table[@id='$f_table']"); WRAPPER html/row; - INCLUDE html/cell colspan=3 align='left' content=table.findvalue( 'label' ); + WRAPPER html/cell colspan=3 align='left'; + IF t != f_table; + link_xpath = '//*[@id="' _ t _ '"]'; + dim_link = config.findnodes(link_xpath); + + link_label_xpath = + '../../fields/field[@name="' _ + dim_link.findvalue('@field') _ '"]/label'; + dim_link.findvalue(link_label_xpath); + + ' -- '; + END; + table.findvalue( 'label' ); + END; END; - FOR f_field IN params.filter.$f_table.keys; + FOR f_field = params.filter.$t.keys; logme([f_table,f_field]); - FOR f_fam IN params.filter.$f_table.$f_field.keys; + FOR f_fam = params.filter.$t.$f_field.keys; logme([f_table,f_field,f_fam]); - f_widget = params.filter.$f_table.$f_field.$f_fam; + f_widget = params.filter.$t.$f_field.$f_fam; logme([f_table,f_field,f_fam,f_widget]); WRAPPER html/row; @@ -239,7 +304,7 @@ BLOCK run_stage2; widgetname = widget.findvalue('@name'); famname = fam.findvalue('@name'); - input_prefix = "filter:$classname:$fieldname:$famname:$widgetname"; + input_prefix = "filter:$t:$fieldname:$famname:$widgetname"; INCLUDE $w_file widget_family=fam; CATCH; @@ -259,66 +324,39 @@ BLOCK run_stage2; INCLUDE html/cell colspan=4 content="Attributes Available for Output"; END; - FOR f_table IN params.dims.keys; - table = config.findnodes( "/reporter/tables/table[@id='$f_table']"); - classname = table.findvalue( "@id" ); - tname = table.findvalue( "label" ); - tdesc = table.findvalue( "desription" ); - - WRAPPER html/row; - INCLUDE html/cell colspan=4 align='left' content=tname; - END; + table = config.findnodes( "/reporter/tables/table[@id='$core_table']" ); + classname = table.findvalue( "@id" ); + tname = table.findvalue( "label" ); + tdesc = table.findvalue( "desription" ); - IF loop.first; - pkey_field = table.findnodes('fields/field[@primary = "true"]'); - pid = pkey_field.findvalue('@name'); - plabel = pkey_field.findvalue('label'); - - WRAPPER html/row; - WRAPPER html/cell align='right'; - INCLUDE checkbox checked='checked' name="output:$classname:$pid" value="include"; - INCLUDE hidden name="xform:type:$classname:$pid" value="count_dist"; - END; - INCLUDE html/cell align='right' content="Per group count of $plabel"; - INCLUDE html/cell align='center'; - END; + WRAPPER html/row; + INCLUDE html/cell colspan=4 align='left' content=tname; + END; + + pkey_field = table.findnodes('fields/field[@primary = "true"]'); + pid = pkey_field.findvalue('@name'); + plabel = pkey_field.findvalue('label'); + + WRAPPER html/row; + WRAPPER html/cell align='right'; + INCLUDE checkbox checked='checked' name="output:$classname:$pid" value="include"; + INCLUDE hidden name="xform:type:$classname:$pid" value="count_dist"; END; + INCLUDE html/cell align='right' content="Per group count of $plabel"; + INCLUDE html/cell align='center'; + END; - fields_xpath = - 'fields/field[not(@primary) or @primary != "true"]'; - FOR field IN table.findnodes(fields_xpath); - link_test = '../../links/link[@field="' _ field.findvalue('@name') _ '"]'; - logme(['link_test',link_test]); - NEXT IF field.findnodes( link_test ); - - fname = field.findvalue( "label" ); - fid = field.findvalue( "@name" ); - WRAPPER html/row; + tables = params.dims.keys; + tables.unshift(core_table); + tables = tables.unique; - WRAPPER html/cell align='right'; - INCLUDE checkbox name="output:$classname:$fid" value="include"; - END; - INCLUDE html/cell align='right' content=fname; - WRAPPER html/cell align='center'; - 'Output Transformation: '; - dtype = field.findvalue('@datatype'); - WRAPPER select name="xform:type:$classname:$fid"; - INCLUDE option value='' content='None' selected=1; - FOR xform IN dtype_xform_map.$dtype; - xform_label = dtype_xforms.$xform.label; - IF dtype_xforms.$xform.param; - xform_label = "$xform_label (*)"; - END; - INCLUDE option value=xform content=xform_label; - END; - END; - '
    '; - '*Output Tranformation Parameter: '; - INCLUDE text name="xform:param:$classname:$fid"; - END; - END; - END; + core_done = 0; + + FOR f_table = tables; + noheader = 0; + noheader = 1 IF f_table == core_table; + INCLUDE show_filter_atts; END; END; @@ -330,4 +368,67 @@ BLOCK run_stage2; END; END; +BLOCK show_filter_atts; + t = f_table; + f_table = INCLUDE find_table_id id=t; + table = config.findnodes( "/reporter/tables/table[@id='$f_table']"); + classname = table.findvalue( "@id" ); + tname = table.findvalue( "label" ); + tdesc = table.findvalue( "desription" ); + + IF ! noheader; + WRAPPER html/row; + WRAPPER html/cell colspan=4 align='left'; + IF t != f_table; + link_xpath = '//*[@id="' _ t _ '"]'; + dim_link = config.findnodes(link_xpath); + + link_label_xpath = + '../../fields/field[@name="' _ + dim_link.findvalue('@field') _ '"]/label'; + dim_link.findvalue(link_label_xpath); + + ' -- '; + END; + tname; + END; + END; + END; + + fields_xpath = 'fields/field[not(@primary) or @primary != "true"]'; + + FOR field = table.findnodes(fields_xpath); + link_test = '../../links/link[@field="' _ field.findvalue('@name') _ '"]'; + logme(['link_test',link_test]); + NEXT IF field.findnodes( link_test ); + + fname = field.findvalue( "label" ); + fid = field.findvalue( "@name" ); + + WRAPPER html/row; + + WRAPPER html/cell align='right'; + INCLUDE checkbox name="output:$t:$fid" value="include"; + END; + INCLUDE html/cell align='right' content=fname; + WRAPPER html/cell align='center'; + 'Output Transformation: '; + dtype = field.findvalue('@datatype'); + WRAPPER select name="xform:type:$t:$fid"; + INCLUDE option value='' content='None' selected=1; + FOR xform = dtype_xform_map.$dtype; + xform_label = dtype_xforms.$xform.label; + IF dtype_xforms.$xform.param; + xform_label = "$xform_label (*)"; + END; + INCLUDE option value=xform content=xform_label; + END; + END; + '
    '; + '*Output Tranformation Parameter: '; + INCLUDE text name="xform:param:$t:$fid"; + END; + END; + END; +END; %] diff --git a/Open-ILS/src/reporter/templates/stage3.ttk b/Open-ILS/src/reporter/templates/stage3.ttk index 16fd804dce..06a2c8aad4 100644 --- a/Open-ILS/src/reporter/templates/stage3.ttk +++ b/Open-ILS/src/reporter/templates/stage3.ttk @@ -53,7 +53,7 @@ BLOCK schedule_stage3; INCLUDE option value='months' content='Month(s)'; END; - FOR p IN CGI.param(); + FOR p = CGI.param(); NEXT IF p == 'action'; NEXT IF p == 'runtime'; INCLUDE hidden name=p value=CGI.param(p); @@ -74,7 +74,7 @@ BLOCK save_stage3; owner = user.id(); p_obj = {}; - FOR p IN CGI.param(); + FOR p = CGI.param(); logme([p,CGI.param(p)]); diff --git a/Open-ILS/src/reporter/templates/utils b/Open-ILS/src/reporter/templates/utils new file mode 100644 index 0000000000..f983766912 --- /dev/null +++ b/Open-ILS/src/reporter/templates/utils @@ -0,0 +1,18 @@ +[% + +BLOCK find_table_id; + xpath = '//*[@id="' _ id _ '"]'; + node = config.findnodes(xpath); + IF node; + t = node.findvalue('@table'); + IF t; + xpath = '//*[@id="' _ t _ '"]'; + node = config.findnodes(xpath); + END; + node.findvalue('@id'); + ELSE; + logme(['arrrrrgggg!!!',id]); + END; +END; + +%] diff --git a/Open-ILS/src/reporter/templates/widget_manip b/Open-ILS/src/reporter/templates/widget_manip index 1d09eb88af..a470b5be87 100644 --- a/Open-ILS/src/reporter/templates/widget_manip +++ b/Open-ILS/src/reporter/templates/widget_manip @@ -1,33 +1,45 @@ [% PROCESS inputs; +PROCESS utils; BLOCK widget_selector; logme("widget_selector called for table $tableid"); + linkid = tableid; + tableid = INCLUDE find_table_id id=tableid; + + choose_base_cols = 0; + # if we got some columns, use them. if not, get all non-primary columns IF ! columns; + columns = []; + choose_base_cols = 1; columns_xpath = '/reporter/tables/table[@id="' _ tableid _ - '"]/fields/field[not(@primary) or @primary!="true"]' - columns = config.findnodes(columns_xpath); - logme("widget_selector had to grab columns for table $tableid!"); + '"]/fields/field[not(@primary) or @primary!="true"]'; + FOR c = config.findnodes(columns_xpath); + link_text_xpath = "../../links/link[@field='" _ c.findvalue('@name') _ "']"; + NEXT IF c.findnodes(link_text_xpath); + columns.push(c); + END; + logme("widget_selector had to grab columns for table $tableid linked from $linkid"); END; column_input_type="checkbox"; - IF force; + IF force && ! choose_base_cols; column_input_type="hidden"; END; - FOR column IN columns; + FOR column = columns; column_name=column.findvalue('@name'); WRAPPER html/row; WRAPPER html/cell valign='top' align='right'; # checkbox for column filter here ... INCLUDE $column_input_type - name="filter:$tableid" + name="filter:$linkid" value=column_name checked=1; column.findvalue('label'); @@ -49,7 +61,7 @@ BLOCK widget_selector; widget_fams = config.findnodes(col_widget_fams_xpath); '
      '; - FOR fam IN widget_fams; + FOR fam = widget_fams; fam_input = 'radio'; IF loop.size == 1; @@ -65,12 +77,12 @@ BLOCK widget_selector; # radio for widget family here ... '
    • '; INCLUDE $fam_input - name="filter:$tableid:$column_name" + name="filter:$linkid:$column_name" value= fam_name; fam.findvalue('label'); '
        '; - FOR widget IN fam.findnodes('widget'); + FOR widget = fam.findnodes('widget'); fam_input = 'radio'; IF loop.size == 1; @@ -86,7 +98,7 @@ BLOCK widget_selector; # radio for widget here ... '
      • '; INCLUDE $fam_input - name="filter:$tableid:$column_name:$fam_name" + name="filter:$linkid:$column_name:$fam_name" value= widget_name; widget.findvalue('label'); '
      • '; diff --git a/Open-ILS/src/reporter/templates/widgets/string-choose.multiselect b/Open-ILS/src/reporter/templates/widgets/string-choose.multiselect index c012756f11..6e9019c0f8 100644 --- a/Open-ILS/src/reporter/templates/widgets/string-choose.multiselect +++ b/Open-ILS/src/reporter/templates/widgets/string-choose.multiselect @@ -2,7 +2,7 @@ PROCESS inputs; -q = 'SELECT * FROM ' _ table.findvalue('tablename') _ ' ORDER BY ' _ fieldname _ ';'; +q = 'SELECT DISTINCT ' _ fieldname _ ' FROM ' _ table.findvalue('tablename') _ ' ORDER BY ' _ fieldname _ ';'; WRAPPER select name=input_prefix multi=1 size=3; FOR f = DBI.query(q); diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index a4930ae5ac..c395419bc2 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -1,7 +1,10 @@ +DROP SCHEMA stats CASCADE; DROP SCHEMA config CASCADE; BEGIN; +CREATE SCHEMA stats; + CREATE SCHEMA config; COMMENT ON SCHEMA config IS $$ /* diff --git a/Open-ILS/src/sql/Pg/020.schema.functions.sql b/Open-ILS/src/sql/Pg/020.schema.functions.sql index 64f7be3a52..04e361a3dc 100644 --- a/Open-ILS/src/sql/Pg/020.schema.functions.sql +++ b/Open-ILS/src/sql/Pg/020.schema.functions.sql @@ -10,6 +10,10 @@ CREATE OR REPLACE FUNCTION public.call_number_dewey( TEXT ) RETURNS TEXT AS $$ } $$ LANGUAGE 'plperl' STRICT IMMUTABLE; +CREATE OR REPLACE FUNCTION public.call_number_dewey( TEXT, INT ) RETURNS TEXT AS $$ + SELECT SUBSTRING(call_number_dewey($1) FROM 1 FOR $2); +$$ LANGUAGE SQL STRICT IMMUTABLE; + CREATE OR REPLACE FUNCTION public.first_agg ( anyelement, anyelement ) RETURNS anyelement AS $$ SELECT CASE WHEN $1 IS NULL THEN $2 ELSE $1 END; $$ LANGUAGE SQL STABLE; diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql index 0a569f5be8..38c4733009 100644 --- a/Open-ILS/src/sql/Pg/040.schema.asset.sql +++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql @@ -133,4 +133,24 @@ CREATE TABLE asset.call_number_note ( ); +CREATE VIEW stats.fleshed_copy AS + SELECT cp.*, + cn.label as call_number_label, + cn.owning_lib, + rd.item_lang, + rd.item_type, + rd.item_form + FROM asset.copy cp + JOIN asset.call_number cn ON (cp.call_number = cn.id) + JOIN metabib.rec_descriptor rd ON (rd.record = cn.record); + +CREATE VIEW stats.fleshed_call_number AS + SELECT cn.*, + rd.item_lang, + rd.item_type, + rd.item_form + FROM asset.call_number cn + JOIN metabib.rec_descriptor rd ON (rd.record = cn.record); + + COMMIT; diff --git a/config.sh b/config.sh index 7363f40323..223240db53 100755 --- a/config.sh +++ b/config.sh @@ -50,6 +50,7 @@ function buildConfig { TEMPLATEDIR="$PREFIX/var/templates"; CIRCRULESDIR="$PREFIX/var/circ"; XSLDIR="$PREFIX/var/xsl"; + REPORTERDIR="$PREFIX/var/reporter"; TMP="$(pwd)/.tmp"; prompt "Web domain for OPAC in Staff Client [$NEW_OPAC_URL] " @@ -91,6 +92,9 @@ function buildConfig { prompt "Bootstrapping Database Password [$DBPW] " read X; if [ ! -z "$X" ]; then DBPW="$X"; fi; + prompt "Reporter Template Directory [$REPORTERDIR] " + read X; if [ ! -z "$X" ]; then REPORTERDIR="$X"; fi; + writeConfig; } diff --git a/install.sh b/install.sh index 91a99eab56..aa605752e2 100755 --- a/install.sh +++ b/install.sh @@ -119,7 +119,7 @@ function runInstall { MAKE="make $verbose APXS2=$APXS2 PREFIX=$PREFIX TMP=$TMP APR_HEADERS=$APR_HEADERS \ APACHE2_HEADERS=$APACHE2_HEADERS LIBXML2_HEADERS=$LIBXML2_HEADERS \ BINDIR=$BINDIR LIBDIR=$LIBDIR PERLDIR=$PERLDIR INCLUDEDIR=$INCLUDEDIR \ - WEBDIR=$WEBDIR TEMPLATEDIR=$TEMPLATEDIR ETCDIR=$ETCDIR \ + WEBDIR=$WEBDIR TEMPLATEDIR=$TEMPLATEDIR ETCDIR=$ETCDIR REPORTERDIR=$REPORTERDIR\ OPENSRFDIR=$OPENSRFDIR OPENILSDIR=$OPENILSDIR EVERGREENDIR=$EVERGREENDIR \ CIRCRULESDIR=$CIRCRULESDIR CGIDIR=$CGIDIR DBDRVR=$DBDRVR DBHOST=$DBHOST \ DBNAME=$DBNAME DBUSER=$DBUSER DBPW=$DBPW XSLDIR=$XSLDIR NEW_OPAC_URL=$NEW_OPAC_URL \ @@ -181,8 +181,11 @@ function runInstall { "openils_web" ) if building; then $MAKE -C "$OPENILSDIR" "mod_xmlbuilder"; fi; if building; then $MAKE -C "$OPENILSDIR" "mod_ils_rest_gateway"; fi; - if installing; then $MAKE -C "$OPENILSDIR" "web-install"; fi; - if installing; then $MAKE -C "$OPENILSDIR" "cgi-bootstrap"; fi; + if installing; then + $MAKE -C "$OPENILSDIR" "web-install"; + $MAKE -C "$OPENILSDIR" "cgi-bootstrap"; + $MAKE -C "$OPENILSDIR" "reporter-install"; + fi; ;; "openils_marcdumper" ) @@ -196,6 +199,11 @@ function runInstall { fi; ;; + "openils_reporter" ) + if installing; then + $MAKE -C "$OPENILSDIR" "reporter-install"; + fi; + ;; # Evergreen --- -- 2.43.2