# ----------------------------------------------------------------------------------
# System config CGI scripts go here
# ----------------------------------------------------------------------------------
-Alias /cgi-bin/ "/openils/var/cgi-bin/"
-<Directory "/openils/var/cgi-bin">
+Alias /cgi-bin/offline/ "/openils/var/cgi-bin/offline/"
+<Directory "/openils/var/cgi-bin/offline">
AddHandler cgi-script .cgi .pl
AllowOverride None
Options None
+++ /dev/null
-#!/usr/bin/perl -w
-# vim:noet:ts=4
-use strict;
-
-use OpenILS::Application::Storage;
-use OpenILS::Application::Storage::CDBI;
-
-# I need to abstract the driver loading away...
-use OpenILS::Application::Storage::Driver::Pg;
-
-use CGI qw/:standard start_*/;
-
-our %config;
-do '##CONFIG##/live-db-setup.pl';
-
-OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr},$config{pw});
-OpenILS::Application::Storage::CDBI->db_Main->{ AutoCommit } = 1;
-
-my $cgi = new CGI;
-
-#-------------------------------------------------------------------------------
-# HTML part
-#-------------------------------------------------------------------------------
-
-print <<HEADER;
-Content-type: text/html
-
-<html>
-
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta http-equiv="Pragma" content="no-cache" />
- <meta http-equiv="Expires" content="Thu, 01 Dec 2000 16:00:00 GMT" />
- <style>
- table.table_class {
- border: dashed lightgrey 1px;
- background-color: #EEE;
- border-collapse: collapse;
- }
-
- tr.row_class td {
- text-align: right;
- border: solid lightgrey 1px;
- }
-
- tr.new_row_class {
- background: grey;
- }
-
- tr.header_class th {
- background-color: lightblue;
- border: solid blue 1px;
- padding: 2px;
- }
-
- </style>
-<body style='padding: 25px;'>
-
-<a href="$config{index}">Home</a>
-
-<h1>Configure Circulation Rules</h1>
-<hr/>
-
-HEADER
-
-#-------------------------------------------------------------------------------
-# setup part
-#-------------------------------------------------------------------------------
-
-my %dur_cols = (
- name => "Name",
- extended => "Extended",
- normal => "Normal",
- shrt => "Short",
- max_renewals => "Max Renewals",
-);
-
-my @dur_display_order = ( qw/name normal extended shrt max_renewals/ );
-
-my %fine_cols = (
- name => "Name",
- high => "High",
- normal => "Normal",
- low => "Low",
- recurrence_interval => "Interval",
-);
-
-my @fine_display_order = ( qw/name recurrence_interval normal high low/ );
-
-my %age_cols = (
- name => "Name",
- age => "Item Age",
- prox => "Holdable Radius",
-);
-
-my @age_display_order = ( qw/name age prox/ );
-
-my %max_fine_cols = (
- name => "Name",
- amount => "Amount",
-);
-
-my @max_fine_display_order = ( qw/name amount/ );
-
-
-#-------------------------------------------------------------------------------
-# Logic part
-#-------------------------------------------------------------------------------
-
-if (my $action = $cgi->param('action')) {
- my $form = $cgi->param('rules_form');
-
- if ($form eq 'duration') {
- if ($action eq 'Remove Selected') {
- for my $id ( ($cgi->param('remove_me')) ) {
- config::rules::circ_duration->retrieve($id)->delete;
- }
- } elsif ( $action eq 'Add New' ) {
- config::rules::circ_duration->create(
- { map { ($_ => $cgi->param($_)) } keys %dur_cols }
- );
- }
- } elsif ($form eq 'recurring_fine') {
- if ($action eq 'Remove Selected') {
- for my $id ( ($cgi->param('remove_me')) ) {
- config::rules::recurring_fine->retrieve($id)->delete;
- }
- } elsif ( $action eq 'Add New' ) {
- config::rules::recurring_fine->create(
- { map { ($_ => $cgi->param($_)) } keys %fine_cols }
- );
- }
- } elsif ($form eq 'max_fine') {
- if ($action eq 'Remove Selected') {
- for my $id ( ($cgi->param('remove_me')) ) {
- config::rules::max_fine->retrieve($id)->delete;
- }
- } elsif ( $action eq 'Add New' ) {
- config::rules::max_fine->create(
- { map { ($_ => $cgi->param($_)) } keys %max_fine_cols }
- );
- }
- } elsif ($form eq 'age_hold') {
- if ($action eq 'Remove Selected') {
- for my $id ( ($cgi->param('remove_me')) ) {
- config::rules::age_hold_protect->retrieve($id)->delete;
- }
- } elsif ( $action eq 'Add New' ) {
- config::rules::age_hold_protect->create(
- { map { ($_ => $cgi->param($_)) } keys %age_cols }
- );
- }
- }
-
-
-}
-
-
-#-------------------------------------------------------------------------------
-# Form part
-#-------------------------------------------------------------------------------
-{
- #-----------------------------------------------------------------------
- # Duration form
- #-----------------------------------------------------------------------
- print "<form method='POST'>".
- "<input type='hidden' name='rules_form' value='duration'>".
- "<h2>Circulation Duration</h2>".
- "<table class='table_class'><tr class='header_class'>\n";
-
- for my $col ( @dur_display_order ) {
- print th($dur_cols{$col});
- }
-
- print "<td/>\n";
-
- for my $row ( config::rules::circ_duration->retrieve_all ) {
- print "</tr><tr class='row_class'>";
- for my $col ( @dur_display_order ) {
- print td($row->$col);
- }
- print "<td><input type='checkbox' value='$row' name='remove_me'</td>";
- }
- print "</tr><tr class='new_row_class'>\n";
-
- for my $col ( @dur_display_order ) {
- print td("<input type='text' name='$col'>");
- }
-
-
- print "<td/></tr></table>".
- "<input type='submit' name='action' value='Add New'/> | ".
- "<input type='submit' name='action' value='Remove Selected'/>".
- "</form><hr/>";
-}
-
-{
- #-----------------------------------------------------------------------
- # Recurring Fine form
- #-----------------------------------------------------------------------
- print "<form method='POST'>".
- "<input type='hidden' name='rules_form' value='recurring_fine'>".
- "<h2>Recurring Fine Levels</h2>".
- "<table class='table_class'><tr class='header_class'>\n";
-
- for my $col ( @fine_display_order ) {
- print th($fine_cols{$col});
- }
-
- print "<td/>\n";
-
- for my $row ( config::rules::recurring_fine->retrieve_all ) {
- print "</tr><tr class='row_class'>\n";
- for my $col ( @fine_display_order ) {
- print td($row->$col);
- }
- print "<td><input type='checkbox' value='$row' name='remove_me'</td>";
- }
-
- print "</tr><tr class='new_row_class'>\n";
-
- for my $col ( @fine_display_order ) {
- print td("<input type='text' name='$col'>");
- }
-
-
- print "<td/></tr></table>".
- "<input type='submit' name='action' value='Add New'/> | ".
- "<input type='submit' name='action' value='Remove Selected'/>".
- "</form><hr/>";
-}
-
-{
- #-----------------------------------------------------------------------
- # Max Fine form
- #-----------------------------------------------------------------------
- print "<form method='POST'>".
- "<input type='hidden' name='rules_form' value='max_fine'>".
- "<h2>Max Fine Levels</h2>".
- "<table class='table_class'><tr class='header_class'>\n";
-
- for my $col ( @max_fine_display_order ) {
- print th($max_fine_cols{$col});
- }
-
- print "<td/>\n";
-
- for my $row ( config::rules::max_fine->retrieve_all ) {
- print "</tr><tr class='row_class'>\n";
- for my $col ( @max_fine_display_order ) {
- print td($row->$col);
- }
- print "<td><input type='checkbox' value='$row' name='remove_me'</td>";
- }
-
- print "</tr><tr class='new_row_class'>\n";
-
- for my $col ( @max_fine_display_order ) {
- print td("<input type='text' name='$col'>");
- }
-
-
- print "<td/></tr></table>".
- "<input type='submit' name='action' value='Add New'/> | ".
- "<input type='submit' name='action' value='Remove Selected'/>".
- "</form><hr/>";
-}
-
-{
- #-----------------------------------------------------------------------
- # Age hold protect form
- #-----------------------------------------------------------------------
- print "<form method='POST'>".
- "<input type='hidden' name='rules_form' value='age_hold'>".
- "<h2>Item Age Hold Protection</h2>".
- "<table class='table_class'><tr class='header_class'>\n";
-
- for my $col ( @age_display_order ) {
- print th($age_cols{$col});
- }
-
- print "<td/>\n";
-
- for my $row ( config::rules::age_hold_protect->retrieve_all ) {
- print "</tr><tr class='row_class'>\n";
- for my $col ( @age_display_order ) {
- print td($row->$col);
- }
- print "<td><input type='checkbox' value='$row' name='remove_me'</td>";
- }
-
- print "</tr><tr class='new_row_class'>\n";
-
- for my $col ( @age_display_order ) {
- print td("<input type='text' name='$col'>");
- }
-
-
- print "<td/></tr></table>".
- "<input type='submit' name='action' value='Add New'/> | ".
- "<input type='submit' name='action' value='Remove Selected'/>".
- "</form><hr/>";
-}
-
-
-print "</body></html>";
-
-
+++ /dev/null
-#!/usr/bin/perl
-print <<CGI;
-Content-type: text/html
-
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>Open-ILS Bootstrapping Scripts</title>
- </head>
- <body>
- <h2>Open-ILS Bootstrapping Scripts</h2>
- <hr>
- <ul>
- <li><a href='/cgi-bin/org_unit_types.cgi'>Organizational Unit Types </a></li>
- <li><a href='/cgi-bin/lib-setup.cgi'>Organizational Units</a></li>
- <li><a href='/cgi-bin/usr_group-setup.cgi'>User Groups and Group Permissions </a></li>
- <li><a href='/cgi-bin/copy_statuses.cgi'>Copy Statuses</a></li>
- <li><a href='/cgi-bin/circ-rules.cgi'>Circulation and Holds Rules</a></li>
- <li><a href='/cgi-bin/perms-setup.cgi'>System Permission Editor</a> <b>Developers only!<b></li>
- </ul>
- </body>
-</html>
-CGI
+++ /dev/null
-#!/usr/bin/perl
-use strict;
-# vim:noet:ts=4
-
-use OpenILS::Application::Storage;
-use OpenILS::Application::Storage::CDBI;
-
-# I need to abstract the driver loading away...
-use OpenILS::Application::Storage::Driver::Pg;
-
-use CGI qw/:standard start_*/;
-our %config;
-do '##CONFIG##/live-db-setup.pl';
-
-OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr},$config{pw});
-OpenILS::Application::Storage::CDBI->db_Main->{ AutoCommit } = 1;
-
-my $cgi = new CGI;
-
-#-------------------------------------------------------------------------------
-# HTML part
-#-------------------------------------------------------------------------------
-
-print <<HEADER;
-Content-type: text/html
-
-<html>
-
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta http-equiv="Pragma" content="no-cache" />
- <meta http-equiv="Expires" content="Thu, 01 Dec 2000 16:00:00 GMT" />
- <style>
- table.table_class {
- border: dashed lightgrey 1px;
- background-color: #EEE;
- border-collapse: collapse;
- }
-
- deactivated {
- color: lightgrey;
- }
-
- tr.row_class td {
- border: solid lightgrey 1px;
- }
-
- tr.new_row_class {
- background: grey;
- }
-
- tr.header_class th {
- background-color: lightblue;
- border: solid blue 1px;
- padding: 2px;
- }
-
- </style>
-<body style='padding: 25px;'>
-
-<a href="$config{index}">Home</a>
-
-<h1>Copy Status Setup</h1>
-<hr/>
-
-HEADER
-
-#-------------------------------------------------------------------------------
-# setup part
-#-------------------------------------------------------------------------------
-
-my %cs_cols = ( qw/id SysID name Name holdable Unholdable/ );
-
-my @col_display_order = ( qw/id name holdable/ );
-
-#-------------------------------------------------------------------------------
-# Logic part
-#-------------------------------------------------------------------------------
-
-if (my $action = $cgi->param('action')) {
- if ( $action eq 'Remove Selected' ) {
- for my $id ( ($cgi->param('id')) ) {
- next unless ($id > 99);
- config::copy_status->retrieve($id)->delete;
- }
- } elsif ( $action eq 'Update Selected' ) {
- for my $id ( ($cgi->param('id')) ) {
- my $u = config::copy_status->retrieve($id);
- $u->name( $cgi->param("name_$id") );
- $u->holdable( $cgi->param("holdable_$id") );
- $u->update;
- }
- } elsif ( $action eq 'Add New' ) {
- config::copy_status->create( { name => $cgi->param("name") } );
- }
-}
-
-
-#-------------------------------------------------------------------------------
-# Form part
-#-------------------------------------------------------------------------------
-{
- #-----------------------------------------------------------------------
- # User form
- #-----------------------------------------------------------------------
- print "<form method='POST'>".
- "<table class='table_class'><tr class='header_class'>\n";
-
- for my $col ( @col_display_order ) {
- print th($cs_cols{$col});
- }
-
- print '<th>Action</th></tr>';
-
- for my $row ( sort { $a->name cmp $b->name } (config::copy_status->retrieve_all) ) {
- print Tr(
- td( $row->id() ),
- td("<input type='text' name='name_$row' value='". $row->name() ."'>"),
- td("<input type='checkbox' name='holdable_$row' value='f'". do {'checked' unless $row->holdable()} .">"),
- td("<input type='checkbox' value='$row' name='id'>"),
- );
- }
-
- print "<tr class='new_row_class'>",
- td(),
- td("<input type='text' name='name'>"),
- td("<input type='checkbox' name='holdable' value='f'>"),
- td(),
- "</tr>";
-
- print "</table>";
- print "<input type='submit' name='action' value='Remove Selected'/> | ";
- print "<input type='submit' name='action' value='Update Selected'/> | ";
- print "<input type='submit' name='action' value='Add New'/></form><hr/>";
-}
-
-print "</body></html>";
-
-
+++ /dev/null
-#!/usr/bin/perl
-use strict;
-# vim:noet:ts=4
-
-use DateTime;
-use OpenILS::Application::Storage;
-use OpenILS::Application::Storage::CDBI;
-
-# I need to abstract the driver loading away...
-use OpenILS::Application::Storage::Driver::Pg;
-
-use CGI qw/:standard start_*/;
-our %config;
-do '##CONFIG##/live-db-setup.pl';
-#do '/openils/conf/live-db-setup.pl';
-
-OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr},$config{pw});
-OpenILS::Application::Storage::CDBI->db_Main->{ AutoCommit } = 1;
-
-
-my $cgi = new CGI;
-
-#-------------------------------------------------------------------------------
-# setup part
-#-------------------------------------------------------------------------------
-
-my %org_cols = ( qw/id SysID name Name parent_ou Parent ou_type OrgUnitType shortname ShortName email Email phone Phone opac_visible OPACVisible/ );
-
-my @col_display_order = ( qw/id name shortname ou_type email phone opac_visible parent_ou/ );
-
-if (my $action = $cgi->param('action')) {
- if ( $action eq 'Update' ) {
- for my $id ( ($cgi->param('id')) ) {
- my $u = actor::org_unit->retrieve($id);
- for my $col ( keys %org_cols ) {
- next if ($cgi->param($col."_$id") =~ /Select One/o);
- if ($col eq 'shortname') {
- $u->$col( uc( $cgi->param($col."_$id") ) );
- } else {
- $u->$col( $cgi->param($col."_$id") );
- }
- }
- $u->update;
- }
- } elsif ( $action eq 'Update Hours' ) {
- for my $id ( ($cgi->param('id')) ) {
- my $hoo = actor::org_unit::hours_of_operation->retrieve($id);
- for my $col ( $hoo->columns('Essential') ) {
- $hoo->$col( $cgi->param($col) );
- }
- $hoo->update;
- }
- } elsif ( $action eq 'Add New' ) {
- actor::org_unit->create(
- { map {
- defined($cgi->param($_)) ?
- ( $_ eq 'shortname' ?
- ($_ => uc($cgi->param($_))) :
- ($_ => $cgi->param($_))
- ) :
- ()
- } keys %org_cols
- }
- );
- } elsif ( $action eq 'Save Address' ) {
- my $org = actor::org_unit->retrieve($cgi->param('id'));
-
- my $addr = {};
-
- $$addr{org_unit} = $cgi->param('org_unit') || $org->id;
- $$addr{street1} = $cgi->param('street1');
- $$addr{street2} = $cgi->param('street2');
- $$addr{city} = $cgi->param('city');
- $$addr{county} = $cgi->param('county');
- $$addr{state} = $cgi->param('state');
- $$addr{country} = $cgi->param('country');
- $$addr{post_code} = $cgi->param('post_code');
-
- my $a_type = $cgi->param('addr_type');
-
-
- my $a = actor::org_address->retrieve($cgi->param('aid'));
-
- if ($a) {
- for (keys %$addr) {
- next unless $$addr{$_};
- $a->$_($$addr{$_});
- }
- $a->update;
- } else {
- $a = actor::org_address->create( {map {defined($$addr{$_}) ? ($_ => $$addr{$_}) : ()} keys %$addr} );
- }
-
- $org->$a_type($a->id);
- $org->update;
- }
-}
-
-#-------------------------------------------------------------------------------
-# HTML part
-#-------------------------------------------------------------------------------
-
-print <<HEADER;
-Content-type: text/html
-
-<html>
-
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta http-equiv="Pragma" content="no-cache" />
- <meta http-equiv="Expires" content="Thu, 01 Dec 2000 16:00:00 GMT" />
- <style>
- table.table_class {
- border: dashed lightgrey 1px;
- background-color: #EEE;
- border-collapse: collapse;
- }
-
- deactivated {
- color: lightgrey;
- }
-
- tr.new_row_class {
- background: grey;
- }
-
- tr.row_class td {
- border: solid lightgrey 1px;
- }
-
- tr.header_class th {
- background-color: lightblue;
- border: solid blue 1px;
- padding: 2px;
- }
-
-
-/*--------------------------------------------------|
-| dTree 2.05 | www.destroydrop.com/javascript/tree/ |
-|---------------------------------------------------|
-| Copyright (c) 2002-2003 Geir Landrö |
-|--------------------------------------------------*/
-
-.dtree {
- font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
- font-size: 11px;
- color: #666;
- white-space: nowrap;
-}
-.dtree img {
- border: 0px;
- vertical-align: middle;
-}
-.dtree a {
- color: #333;
- text-decoration: none;
-}
-.dtree a.node, .dtree a.nodeSel {
- white-space: nowrap;
- padding: 1px 2px 1px 2px;
-}
-.dtree a.node:hover, .dtree a.nodeSel:hover {
- color: #333;
- text-decoration: underline;
-}
-.dtree a.nodeSel {
- background-color: #c0d2ec;
-}
-.dtree .clip {
- overflow: hidden;
-}
-
-
- </style>
- <script language='javascript' src='support/dtree.js'></script>
-</head>
-
-<body style='padding: 25px;'>
-
-<a href="$config{index}">Home</a>
-
-<h1>Library Hierarchy Setup</h1>
-<hr/>
-HEADER
-
-my $uri = $cgi->url(-relative=>1);
-
-my $top;
-for my $lib ( actor::org_unit->search( {parent_ou=>undef} ) ) {
- my $name = $lib->name;
- $name =~ s/'/\\'/og;
- $top = $lib->id;
- print <<" HEADER";
-<div>
- <script language='javascript'>
- var tree = new dTree("tree");
- tree.add($lib, -1, "$name", "$uri?action=child&id=$lib", "$name");
- HEADER
- $top = $lib->id;
- last;
-}
-
-for my $lib ( actor::org_unit->search_where ( {parent_ou => { '>' => -1 } }, {order_by => 'name'} ) ) {
- my $name = $lib->name;
- $name =~ s/'/\\'/og;
- my $parent = $lib->parent_ou;
- print "\ttree.add($lib, $parent, \"$name\", \"$uri?action=child&id=$lib\", \"$name\");\n";
-}
-
-print <<HEADER;
- tree.closeAllChildren($top);
- document.write(tree.toString());
- </script>
-</div>
-<div>
-
-HEADER
-
-#-------------------------------------------------------------------------------
-# Logic part
-#-------------------------------------------------------------------------------
-
-if (my $action = $cgi->param('action')) {
- if ( $action eq 'child' ) {
- my $id = $cgi->param('id');
- if ($id) {
- my $node = actor::org_unit->retrieve($id);
- #-----------------------------------------------------------------------
- # child form
- #-----------------------------------------------------------------------
-
- print "<hr/><h2>Edit ".$node->name."</h2>";
- print "<form method='POST'>".
- "<table class='table_class'><tr class='header_class'>\n";
-
- print Tr(
- th($org_cols{id}),
- td( $node->id() ),
- );
- print Tr(
- th($org_cols{name}),
- td("<input type='text' name='name_$node' value=\"". $node->name() ."\">"),
- );
- print Tr(
- th($org_cols{shortname}),
- td("<input type='text' name='shortname_$node' value='". $node->shortname() ."'>"),
- );
- print Tr(
- th($org_cols{ou_type}),
- td("<select name='ou_type_$node'>".do{
- my $out = '<option>-- Select One --</option>';
- for my $type ( sort {$a->depth <=> $b->depth} actor::org_unit_type->retrieve_all) {
- $out .= "<option value='$type' ".do {
- if ($node->ou_type == $type->id) {
- "selected";
- }}.'>'.$type->name.'</option>'
- }
- $out;
- }."</select>"),
- );
- print Tr(
- th($org_cols{email}),
- td("<input type='text' name='email_$node' value=\"". $node->email() ."\">"),
- );
-
- print Tr(
- th($org_cols{phone}),
- td("<input type='text' name='phone_$node' value='". $node->phone() ."'>"),
- );
-
- print Tr(
- th($org_cols{opac_visible} .'<span style="color:red">*</span>'),
- td("<select name='opac_visible_$node'>".
- do {
- my $out = "<option value='t' ";
- $out .= ($node->opac_visible =~ /^[y1t]+/i) ? "selected='yes'" : "";
- $out .= ">True</option><option value='f' ";
- $out .= ($node->opac_visible =~ /^[n0f]+/i) ? "selected='yes'" : "";
- $out .= ">False</option>";
- $out;
- }."</select>"
- ),
- );
-
- print Tr(
- th($org_cols{parent_ou}),
- td("<select name='parent_ou_$node'>".do{
- my $out = '<option>-- Select One --</option>';
- for my $org ( sort {$a->id <=> $b->id} actor::org_unit->retrieve_all) {
- $out .= "<option value='$org' ".do {
- if ($node->parent_ou == $org->id) {
- "selected";
- }}.'>'.do{' 'x$org->ou_type->depth}.$org->name.'</option>'
- }
- $out;
- }."</select><input type='hidden' value='$node' name='id'>"),
- );
-
- print Tr( "<td colspan='2'><input type='submit' name='action' value='Update'/></td>" );
- print "</table><span style='color:red;'>*</span>".
- "You must hide every OU you want hidden, not just an ancestor!</form>";
-
- #-------------------------------------------------------------------------
- # Hours of operation form
- #-------------------------------------------------------------------------
-
-
-
- my %dow = (
- 0 => 'Monday',
- 1 => 'Tuesday',
- 2 => 'Wednesday',
- 3 => 'Thursday',
- 4 => 'Friday',
- 5 => 'Saturday',
- 6 => 'Sunday',
- );
-
- print "<hr/><h2>Hours of Operation for ".$node->name."</h2>".
- "<form method='POST'>".
- "<table class='table_class'><tr class='header_class'>\n";
-
- print Tr(
- th('Day of Week'),
- th('Open Time'),
- th('Close Time'),
- );
-
- my $hoo = actor::org_unit::hours_of_operation->find_or_create( { id => $node->id } );
- for my $day ( 0 .. 6 ) {
- my $open = "dow_${day}_open";
- my $close = "dow_${day}_close";
-
- print Tr(
- th($dow{$day}),
- td("<input type='text' name='$open' value=\"". $hoo->$open ."\">"),
- td("<input type='text' name='$close' value=\"". $hoo->$close ."\">"),
- );
- }
-
- print Tr( "<td colspan='3'>".
- "<input type='hidden' value='$node' name='id'>".
- "<input type='submit' name='action' value='Update Hours'/></td>"
- );
- print "</table></form>";
-
-
- #-------------------------------------------------------------------------
- # Address edit form
- #-------------------------------------------------------------------------
-
- print "<hr/><h2>Addresses for ".$node->name."</h2>";
- print "<table cellspacing='20'><tr>";
- my %addrs = ( ill_address => 'ILL Address',
- holds_address => 'Consortial Holds Address',
- mailing_address => 'Mailing Address',
- billing_address => 'Physical Address'
- );
- for my $a (qw/billing_address mailing_address holds_address ill_address/) {
- my $addr = actor::org_address->retrieve( $node->$a ) if ($node->$a);
-
- my %ah = ( street1 => $addr?$addr->street1:'',
- street2 => $addr?$addr->street2:'',
- city => $addr?$addr->city:'',
- county => $addr?$addr->county:'',
- state => $addr?$addr->state:'',
- country => $addr?$addr->country:'US',
- post_code => $addr?$addr->post_code:'',
- org_unit => $addr?$addr->org_unit:$node->id,
- id => $addr?$addr->id:'',
- );
-
- #print '</tr><tr>' if ($a eq 'holds_address');
- print <<" TABLE";
-
-<td>
-<form method='POST'>
-<table class='table_class'>
- <tr>
- <th colspan=2>$addrs{$a}</th>
- </tr>
- <tr>
- <th>SysID</th>
- <td><input type='text' name='aid' value='$ah{id}'></td>
- </tr>
- <tr>
- <th>*Street 1</th>
- <td><input type='text' name='street1' value='$ah{street1}'></td>
- </tr>
- <tr>
- <th>Street 2</th>
- <td><input type='text' name='street2' value='$ah{street2}'></td>
- </tr>
- <tr>
- <th>*City</th>
- <td><input type='text' name='city' value='$ah{city}'></td>
- </tr>
- <tr>
- <th>County</th>
- <td><input type='text' name='county' value='$ah{county}'></td>
- </tr>
- <tr>
- <th>*State</th>
- <td><input type='text' name='state' value='$ah{state}'></td>
- </tr>
- <tr>
- <th>*Country</th>
- <td><input type='text' name='country' value='$ah{country}'></td>
- </tr>
- <tr>
- <th>*ZIP</th>
- <td><input type='text' name='post_code' value='$ah{post_code}'></td>
- </tr>
-</table>
-<input type='hidden' name='org_unit' value='$ah{org_unit}'>
-<input type='hidden' name='addr_type' value='$a'>
-<input type='hidden' name='id' value='$node'>
-<input type='submit' name='action' value='Save Address'>
-</form></td>
-
- TABLE
- }
-
- print "<tr></table><hr><h2>New Child</h2>";
-
- print "<form method='POST'>".
- "<table class='table_class'>\n";
-
- print Tr(
- th($org_cols{name}),
- td("<input type='text' name='name'>"),
- );
- print Tr(
- th($org_cols{shortname}),
- td("<input type='text' name='shortname'>"),
- );
- print Tr(
- th($org_cols{ou_type}),
- td("<select name='ou_type'>".do{
- my $out = '<option>-- Select One --</option>';
- for my $type ( sort {$a->depth <=> $b->depth} actor::org_unit_type->retrieve_all) {
- $out .= "<option value='$type'>".$type->name.'</option>'
- }
- $out;
- }."</select>"),
- );
- print Tr(
- th($org_cols{email}),
- td("<input type='text' name='email'>"),
- );
- print Tr(
- th($org_cols{phone}),
- td("<input type='text' name='phone'>"),
- );
-
- print Tr( "<td colspan='2'><input type='hidden' value='$node' name='parent_ou'>",
- "<input type='submit' name='action' value='Add New'/></td>" );
- print "</table></form><hr/>";
- }
- }
-}
-
-print "</div></body></html>";
-
-
+++ /dev/null
-#!/usr/bin/perl
-use strict;
-# vim:noet:ts=4
-
-use OpenILS::Application::Storage;
-use OpenILS::Application::Storage::CDBI;
-
-# I need to abstract the driver loading away...
-use OpenILS::Application::Storage::Driver::Pg;
-
-use CGI qw/:standard start_*/;
-
-our %config;
-do '##CONFIG##/live-db-setup.pl';
-
-OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr},$config{pw});
-OpenILS::Application::Storage::CDBI->db_Main->{ AutoCommit } = 1;
-
-my $cgi = new CGI;
-
-#-------------------------------------------------------------------------------
-# HTML part
-#-------------------------------------------------------------------------------
-
-print <<HEADER;
-Content-type: text/html
-
-<html>
-
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta http-equiv="Pragma" content="no-cache" />
- <meta http-equiv="Expires" content="Thu, 01 Dec 2000 16:00:00 GMT" />
- <style>
- table.table_class {
- border: dashed lightgrey 1px;
- background-color: #EEE;
- border-collapse: collapse;
- }
-
- deactivated {
- color: lightgrey;
- }
-
- tr.row_class td {
- border: solid lightgrey 1px;
- }
-
- tr.new_row_class {
- background: grey;
- }
-
- tr.header_class th {
- background-color: lightblue;
- border: solid blue 1px;
- padding: 2px;
- }
-
- </style>
-<body style='padding: 25px;'>
-
-<a href="$config{index}">Home</a>
-
-<h1>Organizational Unit Type Setup</h1>
-<hr/>
-
-HEADER
-
-#-------------------------------------------------------------------------------
-# setup part
-#-------------------------------------------------------------------------------
-
-my %ou_cols = ( qw/id SysID name Name opac_label OpacLabel depth Depth parent ParentType can_have_vols CanHaveVolumes can_have_users CanHaveUsers/ );
-
-my @col_display_order = ( qw/id name opac_label depth parent can_have_vols can_have_users/ );
-
-#-------------------------------------------------------------------------------
-# Logic part
-#-------------------------------------------------------------------------------
-
-if (my $action = $cgi->param('action')) {
- if ( $action eq 'Remove Selected' ) {
- for my $id ( ($cgi->param('id')) ) {
- actor::org_unit_type->retrieve($id)->delete;
- }
- } elsif ( $action eq 'Update Selected' ) {
- for my $id ( ($cgi->param('id')) ) {
- my $u = actor::org_unit_type->retrieve($id);
- for my $col (@col_display_order) {
- next if ($cgi->param($col."_$id") =~ /Select One/o);
- $u->$col( $cgi->param($col."_$id") );
- }
- $u->update;
- }
- } elsif ( $action eq 'Add New' ) {
- actor::org_unit_type->create( { map {defined($cgi->param($_)) ? ($_ => $cgi->param($_)) : () } @col_display_order } );
- }
-}
-
-
-#-------------------------------------------------------------------------------
-# Form part
-#-------------------------------------------------------------------------------
-{
- #-----------------------------------------------------------------------
- # User form
- #-----------------------------------------------------------------------
- print "<form method='POST'>".
- "<table class='table_class'><tr class='header_class'>\n";
-
- for my $col ( @col_display_order ) {
- print th($ou_cols{$col});
- }
-
- print '<th>Action</th></tr>';
-
- for my $row ( sort { $a->depth <=> $b->depth } (actor::org_unit_type->retrieve_all) ) {
- print Tr(
- td( $row->id() ),
- td("<input type='text' name='name_$row' value='". $row->name() ."'>"),
- td("<input type='text' name='opac_label_$row' value='". $row->opac_label() ."'>"),
- td("<input type='text' size=3 name='depth_$row' value='". $row->depth() ."'>"),
- td("<select name='parent_$row'><option>-- Select One --</option>".do{
- my $out = '';
- for my $type ( sort {$a->depth <=> $b->depth} actor::org_unit_type->retrieve_all) {
- $out .= "<option value='$type' ".do{
- if ($row->parent == $type->id) {
- "selected";
- }
- }.">".$type->name.'</option>'
- }
- $out;
- }."</select>"),
- td("<input type='checkbox' name='can_have_vols_$row' value='t' ". do{if($row->can_have_vols){"checked"}} .">"),
- td("<input type='checkbox' name='can_have_users_$row' value='t' ". do{if($row->can_have_users){"checked"}} .">"),
- td("<input type='checkbox' value='$row' name='id'>"),
- );
- }
-
- print "<tr class='new_row_class'>",
- td(),
- td("<input type='text' name='name'>"),
- td("<input type='text' name='opac_label'>"),
- td("<input type='text' size=3 name='depth'>"),
- td("<select name='parent'><option>-- Select One --</option>".do{
- my $out = '';
- for my $type ( sort {$a->depth <=> $b->depth} actor::org_unit_type->retrieve_all) {
- $out .= "<option value='$type'>".$type->name.'</option>'
- }
- $out;
- }."</select>"),
- td("<input type='checkbox' name='can_have_vols' value='t'>"),
- td("<input type='checkbox' name='can_have_users' value='t'>"),
- td(),
- "</tr>";
- print "</table>";
- print "<input type='submit' name='action' value='Remove Selected'/> | ";
- print "<input type='submit' name='action' value='Update Selected'/> | ";
- print "<input type='submit' name='action' value='Add New'/></form><hr/>";
-}
-
-print "</body></html>";
-
-
+++ /dev/null
-#!/usr/bin/perl
-use strict;
-# vim:noet:ts=4
-
-use OpenILS::Application::Storage;
-use OpenILS::Application::Storage::CDBI;
-
-# I need to abstract the driver loading away...
-use OpenILS::Application::Storage::Driver::Pg;
-
-use CGI qw/:standard start_*/;
-
-our %config;
-do '##CONFIG##/live-db-setup.pl';
-
-OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr},$config{pw});
-OpenILS::Application::Storage::CDBI->db_Main->{ AutoCommit } = 1;
-
-my $cgi = new CGI;
-
-#-------------------------------------------------------------------------------
-# HTML part
-#-------------------------------------------------------------------------------
-
-print <<HEADER;
-Content-type: text/html
-
-<html>
-
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta http-equiv="Pragma" content="no-cache" />
- <meta http-equiv="Expires" content="Thu, 01 Dec 2000 16:00:00 GMT" />
- <style>
- table.table_class {
- border: dashed lightgrey 1px;
- background-color: #EEE;
- border-collapse: collapse;
- }
-
- deactivated {
- color: lightgrey;
- }
-
- tr.row_class td {
- border: solid lightgrey 1px;
- }
-
- tr.new_row_class {
- background: grey;
- }
-
- tr.header_class th {
- background-color: lightblue;
- border: solid blue 1px;
- padding: 2px;
- }
-
- </style>
-<body style='padding: 25px;'>
-
-<a href="$config{index}">Home</a>
-
-<h1>Permission List Setup</h1>
-<hr/>
-
-HEADER
-
-#-------------------------------------------------------------------------------
-# setup part
-#-------------------------------------------------------------------------------
-
-my %profile_cols = ( qw/id SysID code Name description Description/ );
-
-my @col_display_order = ( qw/id code description/ );
-
-#-------------------------------------------------------------------------------
-# Logic part
-#-------------------------------------------------------------------------------
-
-if (my $action = $cgi->param('action')) {
- if ( $action eq 'Remove Selected' ) {
- for my $id ( ($cgi->param('id')) ) {
- permission::perm_list->retrieve($id)->delete;
- }
- } elsif ( $action eq 'Update Selected' ) {
- for my $id ( ($cgi->param('id')) ) {
- my $u = permission::perm_list->retrieve($id);
- $u->code( $cgi->param("code_$id") );
- $u->description( $cgi->param("description_$id") );
- $u->update;
- }
- } elsif ( $action eq 'Add New' ) {
- permission::perm_list->create(
- { code => $cgi->param("code"),
- description => $cgi->param("description")
- }
- );
- }
-}
-
-
-#-------------------------------------------------------------------------------
-# Form part
-#-------------------------------------------------------------------------------
-{
- #-----------------------------------------------------------------------
- # User form
- #-----------------------------------------------------------------------
- print "<form method='POST'>".
- "<table class='table_class'><tr class='header_class'>\n";
-
- for my $col ( @col_display_order ) {
- print th($profile_cols{$col});
- }
-
- print '<th>Action</th></tr>';
-
- for my $row ( sort { $a->code cmp $b->code } (permission::perm_list->retrieve_all) ) {
- print Tr(
- td( $row->id() ),
- td("<input type='text' name='code_$row' value='". $row->code() ."'>"),
- td("<input type='text' size='50' name='description_$row' value='". $row->description() ."'>"),
- td("<input type='checkbox' value='$row' name='id'>"),
- );
- }
-
- print "<tr class='new_row_class'>",
- td(),
- td("<input type='text' name='code'>"),
- td("<input type='text' size='50' name='description'>"),
- td(),
- "</tr>";
- print "</table>";
- print "<input type='submit' name='action' value='Remove Selected'/> | ";
- print "<input type='submit' name='action' value='Update Selected'/> | ";
- print "<input type='submit' name='action' value='Add New'/></form><hr/>";
-}
-
-print "</body></html>";
-
-
+++ /dev/null
-/*--------------------------------------------------|
-| dTree 2.05 | www.destroydrop.com/javascript/tree/ |
-|---------------------------------------------------|
-| Copyright (c) 2002-2003 Geir Landrö |
-| |
-| This script can be used freely as long as all |
-| copyright messages are intact. |
-| |
-| Updated: 17.04.2003 |
-|--------------------------------------------------*/
-
-function Node(id, pid, name, url, title, target, icon, iconOpen, open) {
- this.id = id;
- this.pid = pid;
- this.name = name;
- this.url = url;
- this.title = title;
- this.target = target;
- this.icon = icon;
- this.iconOpen = iconOpen;
- this._io = open || false;
- this._is = false;
- this._ls = false;
- this._hc = false;
- this._ai = 0;
- this._p;
-};
-
-function dTree(objName) {
- this.config = {
- target : null,
- folderLinks : true,
- useSelection : true,
- useCookies : true,
- useLines : true,
- useIcons : true,
- useStatusText : false,
- closeSameLevel : false,
- inOrder : false
- }
- this.icon = {
- root : 'support/base.gif',
- folder : 'support/folder.gif',
- folderOpen : 'support/folderopen.gif',
- node : 'support/page.gif',
- empty : 'support/empty.gif',
- line : 'support/line.gif',
- join : 'support/join.gif',
- joinBottom : 'support/joinbottom.gif',
- plus : 'support/plus.gif',
- plusBottom : 'support/plusbottom.gif',
- minus : 'support/minus.gif',
- minusBottom : 'support/minusbottom.gif',
- nlPlus : 'support/nolines_plus.gif',
- nlMinus : 'support/nolines_minus.gif'
- };
- this.obj = objName;
- this.aNodes = [];
- this.aIndent = [];
- this.root = new Node(-1);
- this.selectedNode = null;
- this.selectedFound = false;
- this.completed = false;
-};
-
-dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) {
- this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open);
-};
-
-dTree.prototype.openAll = function() {
- this.oAll(true);
-};
-dTree.prototype.closeAll = function() {
- this.oAll(false);
-};
-
-dTree.prototype.toString = function() {
- var str = '<div class="dtree">\n';
- if (document.getElementById) {
- if (this.config.useCookies) this.selectedNode = this.getSelected();
- str += this.addNode(this.root);
- } else str += 'Browser not supported.';
- str += '</div>';
- if (!this.selectedFound) this.selectedNode = null;
- this.completed = true;
- return str;
-};
-
-dTree.prototype.addNode = function(pNode) {
- var str = '';
- var n=0;
- if (this.config.inOrder) n = pNode._ai;
- for (n; n<this.aNodes.length; n++) {
- if (this.aNodes[n].pid == pNode.id) {
- var cn = this.aNodes[n];
- cn._p = pNode;
- cn._ai = n;
- this.setCS(cn);
- if (!cn.target && this.config.target) cn.target = this.config.target;
- if (cn._hc && !cn._io && this.config.useCookies) cn._io = this.isOpen(cn.id);
- if (!this.config.folderLinks && cn._hc) cn.url = null;
- if (this.config.useSelection && cn.id == this.selectedNode && !this.selectedFound) {
- cn._is = true;
- this.selectedNode = n;
- this.selectedFound = true;
- }
- str += this.node(cn, n);
- if (cn._ls) break;
- }
- }
- return str;
-};
-
-dTree.prototype.node = function(node, nodeId) {
- var str = '<div class="dTreeNode">' + this.indent(node, nodeId);
- if (this.config.useIcons) {
- if (!node.icon) node.icon = (this.root.id == node.pid) ? this.icon.root : ((node._hc) ? this.icon.folder : this.icon.node);
- if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node;
- if (this.root.id == node.pid) {
- node.icon = this.icon.root;
- node.iconOpen = this.icon.root;
- }
- str += '<img id="i' + this.obj + nodeId + '" src="' + ((node._io) ? node.iconOpen : node.icon) + '" alt="" />';
- }
- if (node.url) {
- str += '<a id="s' + this.obj + nodeId + '" class="' + ((this.config.useSelection) ? ((node._is ? 'nodeSel' : 'node')) : 'node') + '" href="' + node.url + '"';
- if (node.title) str += ' title="' + node.title + '"';
- if (node.target) str += ' target="' + node.target + '"';
- if (this.config.useStatusText) str += ' onmouseover="window.status=\'' + node.name + '\';return true;" onmouseout="window.status=\'\';return true;" ';
- if (this.config.useSelection && ((node._hc && this.config.folderLinks) || !node._hc))
- str += ' onclick="javascript: ' + this.obj + '.s(' + nodeId + ');"';
- str += '>';
- }
- else if ((!this.config.folderLinks || !node.url) && node._hc && node.pid != this.root.id)
- str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');" class="node">';
- str += node.name;
- if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += '</a>';
- str += '</div>';
- if (node._hc) {
- str += '<div id="d' + this.obj + nodeId + '" class="clip" style="display:' + ((this.root.id == node.pid || node._io) ? 'block' : 'none') + ';">';
- str += this.addNode(node);
- str += '</div>';
- }
- this.aIndent.pop();
- return str;
-};
-
-dTree.prototype.indent = function(node, nodeId) {
- var str = '';
- if (this.root.id != node.pid) {
- for (var n=0; n<this.aIndent.length; n++)
- str += '<img src="' + ( (this.aIndent[n] == 1 && this.config.useLines) ? this.icon.line : this.icon.empty ) + '" alt="" />';
- (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1);
- if (node._hc) {
- str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');"><img id="j' + this.obj + nodeId + '" src="';
- if (!this.config.useLines) str += (node._io) ? this.icon.nlMinus : this.icon.nlPlus;
- else str += ( (node._io) ? ((node._ls && this.config.useLines) ? this.icon.minusBottom : this.icon.minus) : ((node._ls && this.config.useLines) ? this.icon.plusBottom : this.icon.plus ) );
- str += '" alt="" /></a>';
- } else str += '<img src="' + ( (this.config.useLines) ? ((node._ls) ? this.icon.joinBottom : this.icon.join ) : this.icon.empty) + '" alt="" />';
- }
- return str;
-};
-
-dTree.prototype.setCS = function(node) {
- var lastId;
- for (var n=0; n<this.aNodes.length; n++) {
- if (this.aNodes[n].pid == node.id) node._hc = true;
- if (this.aNodes[n].pid == node.pid) lastId = this.aNodes[n].id;
- }
- if (lastId==node.id) node._ls = true;
-};
-
-dTree.prototype.getSelected = function() {
- var sn = this.getCookie('cs' + this.obj);
- return (sn) ? sn : null;
-};
-
-dTree.prototype.s = function(id) {
- if (!this.config.useSelection) return;
- var cn = this.aNodes[id];
- if (cn._hc && !this.config.folderLinks) return;
- if (this.selectedNode != id) {
- if (this.selectedNode || this.selectedNode==0) {
- eOld = document.getElementById("s" + this.obj + this.selectedNode);
- eOld.className = "node";
- }
- eNew = document.getElementById("s" + this.obj + id);
- eNew.className = "nodeSel";
- this.selectedNode = id;
- if (this.config.useCookies) this.setCookie('cs' + this.obj, cn.id);
- }
-};
-
-dTree.prototype.o = function(id) {
- var cn = this.aNodes[id];
- this.nodeStatus(!cn._io, id, cn._ls);
- cn._io = !cn._io;
- if (this.config.closeSameLevel) this.closeLevel(cn);
- if (this.config.useCookies) this.updateCookie();
-};
-
-dTree.prototype.oAll = function(status) {
- for (var n=0; n<this.aNodes.length; n++) {
- if (this.aNodes[n]._hc && this.aNodes[n].pid != this.root.id) {
- this.nodeStatus(status, n, this.aNodes[n]._ls)
- this.aNodes[n]._io = status;
- }
- }
- if (this.config.useCookies) this.updateCookie();
-};
-
-dTree.prototype.openTo = function(nId, bSelect, bFirst) {
- if (!bFirst) {
- for (var n=0; n<this.aNodes.length; n++) {
- if (this.aNodes[n].id == nId) {
- nId=n;
- break;
- }
- }
- }
- var cn=this.aNodes[nId];
- if (cn.pid==this.root.id || !cn._p) return;
- cn._io = true;
- cn._is = bSelect;
- if (this.completed && cn._hc) this.nodeStatus(true, cn._ai, cn._ls);
- if (this.completed && bSelect) this.s(cn._ai);
- else if (bSelect) this._sn=cn._ai;
- this.openTo(cn._p._ai, false, true);
-};
-
-dTree.prototype.closeLevel = function(node) {
- for (var n=0; n<this.aNodes.length; n++) {
- if (this.aNodes[n].pid == node.pid && this.aNodes[n].id != node.id && this.aNodes[n]._hc) {
- this.nodeStatus(false, n, this.aNodes[n]._ls);
- this.aNodes[n]._io = false;
- this.closeAllChildren(this.aNodes[n]);
- }
- }
-}
-
-dTree.prototype.closeAllChildren = function(node) {
- for (var n=0; n<this.aNodes.length; n++) {
- if (this.aNodes[n].pid == node.id && this.aNodes[n]._hc) {
- if (this.aNodes[n]._io) this.nodeStatus(false, n, this.aNodes[n]._ls);
- this.aNodes[n]._io = false;
- this.closeAllChildren(this.aNodes[n]);
- }
- }
-}
-
-dTree.prototype.nodeStatus = function(status, id, bottom) {
- eDiv = document.getElementById('d' + this.obj + id);
- eJoin = document.getElementById('j' + this.obj + id);
- if (this.config.useIcons) {
- eIcon = document.getElementById('i' + this.obj + id);
- eIcon.src = (status) ? this.aNodes[id].iconOpen : this.aNodes[id].icon;
- }
- eJoin.src = (this.config.useLines)?
- ((status)?((bottom)?this.icon.minusBottom:this.icon.minus):((bottom)?this.icon.plusBottom:this.icon.plus)):
- ((status)?this.icon.nlMinus:this.icon.nlPlus);
- eDiv.style.display = (status) ? 'block': 'none';
-};
-
-
-dTree.prototype.clearCookie = function() {
- var now = new Date();
- var yesterday = new Date(now.getTime() - 1000 * 60 * 60 * 24);
- this.setCookie('co'+this.obj, 'cookieValue', yesterday);
- this.setCookie('cs'+this.obj, 'cookieValue', yesterday);
-};
-
-dTree.prototype.setCookie = function(cookieName, cookieValue, expires, path, domain, secure) {
- document.cookie =
- escape(cookieName) + '=' + escape(cookieValue)
- + (expires ? '; expires=' + expires.toGMTString() : '')
- + (path ? '; path=' + path : '')
- + (domain ? '; domain=' + domain : '')
- + (secure ? '; secure' : '');
-};
-
-dTree.prototype.getCookie = function(cookieName) {
- var cookieValue = '';
- var posName = document.cookie.indexOf(escape(cookieName) + '=');
- if (posName != -1) {
- var posValue = posName + (escape(cookieName) + '=').length;
- var endPos = document.cookie.indexOf(';', posValue);
- if (endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos));
- else cookieValue = unescape(document.cookie.substring(posValue));
- }
- return (cookieValue);
-};
-
-dTree.prototype.updateCookie = function() {
- var str = '';
- for (var n=0; n<this.aNodes.length; n++) {
- if (this.aNodes[n]._io && this.aNodes[n].pid != this.root.id) {
- if (str) str += '.';
- str += this.aNodes[n].id;
- }
- }
- this.setCookie('co' + this.obj, str);
-};
-
-dTree.prototype.isOpen = function(id) {
- var aOpen = this.getCookie('co' + this.obj).split('.');
- for (var n=0; n<aOpen.length; n++)
- if (aOpen[n] == id) return true;
- return false;
-};
-
-if (!Array.prototype.push) {
- Array.prototype.push = function array_push() {
- for(var i=0;i<arguments.length;i++)
- this[this.length]=arguments[i];
- return this.length;
- }
-};
-if (!Array.prototype.pop) {
- Array.prototype.pop = function array_pop() {
- lastElement = this[this.length-1];
- this.length = Math.max(this.length-1,0);
- return lastElement;
- }
-};
+++ /dev/null
-#!/usr/bin/perl
-# vim:noet:ts=4
-use strict;
-
-use OpenILS::Application::Storage;
-use OpenILS::Application::Storage::CDBI;
-
-# I need to abstract the driver loading away...
-use OpenILS::Application::Storage::Driver::Pg;
-
-use CGI qw/:standard start_*/;
-
-our %config;
-do '##CONFIG##/live-db-setup.pl';
-
-OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr},$config{pw});
-OpenILS::Application::Storage::CDBI->db_Main->{ AutoCommit } = 1;
-
-my $cgi = new CGI;
-
-#-------------------------------------------------------------------------------
-# setup part
-#-------------------------------------------------------------------------------
-my @perms = sort { $a->code cmp $b->code } permission::perm_list->retrieve_all;
-
-my %org_cols = ( qw/id GroupID name Name parent ParentGroup description Description application_perm ApplicationPermission/ );
-
-my @col_display_order = ( qw/id name parent description application_perm/ );
-
-if (my $action = $cgi->param('action')) {
- if ( $action eq 'Update' ) {
- for my $id ( ($cgi->param('id')) ) {
- my $u = permission::grp_tree->retrieve($id);
- for my $col ( keys %org_cols ) {
- next if ($cgi->param($col."_$id") =~ /Select One/o);
- $u->$col( $cgi->param($col."_$id") );
- }
- $u->update;
- }
- } elsif ( $action eq 'Set Permissions' ) {
- my $grp = permission::grp_tree->retrieve($cgi->param('perms'));
- my @ids = $cgi->param('permission');
- for my $perm ( @perms ) {
- if (my $id = $cgi->param('permission_'.$perm->id) ) {
- my $p = permission::grp_perm_map->search({perm=>$id,grp=>$grp->id})->next;
- my $d = $cgi->param("depth_$id");
- my $g = $cgi->param("grant_$id") || 'f';
- if (!$p) {
- $p = permission::grp_perm_map->create({perm=>$id,grp=>$grp->id,depth=>$d,grantable=>$g});
- } else {
- $p->depth( $d );
- $p->grantable( $g );
- }
- $p->update;
- } else {
- permission::grp_perm_map->search({perm=>$perm->id,grp=>$grp->id})->delete_all;
- }
- }
- $cgi->param('action'=>'child');
- } elsif ( $action eq 'Add New' ) {
- permission::grp_tree->create( { map { defined($cgi->param($_)) ? ($_ => $cgi->param($_)) : () } keys %org_cols } );
- }
-}
-
-#-------------------------------------------------------------------------------
-# HTML part
-#-------------------------------------------------------------------------------
-
-print <<HEADER;
-Content-type: text/html
-
-<html>
-
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta http-equiv="Pragma" content="no-cache" />
- <meta http-equiv="Expires" content="Thu, 01 Dec 2000 16:00:00 GMT" />
- <style>
- table.table_class {
- border: dashed lightgrey 1px;
- background-color: #EEE;
- border-collapse: collapse;
- }
-
- deactivated {
- color: lightgrey;
- }
-
- tr.new_row_class {
- background: grey;
- }
-
- tr.row_class td {
- border: solid lightgrey 1px;
- }
-
- tr.header_class th {
- background-color: lightblue;
- border: solid blue 1px;
- padding: 2px;
- }
-
-/*--------------------------------------------------|
-| dTree 2.05 | www.destroydrop.com/javascript/tree/ |
-|---------------------------------------------------|
-| Copyright (c) 2002-2003 Geir Landrö |
-|--------------------------------------------------*/
-
-.dtree {
- font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
- font-size: 11px;
- color: #666;
- white-space: nowrap;
-}
-.dtree img {
- border: 0px;
- vertical-align: middle;
-}
-.dtree a {
- color: #333;
- text-decoration: none;
-}
-.dtree a.node, .dtree a.nodeSel {
- white-space: nowrap;
- padding: 1px 2px 1px 2px;
-}
-.dtree a.node:hover, .dtree a.nodeSel:hover {
- color: #333;
- text-decoration: underline;
-}
-.dtree a.nodeSel {
- background-color: #c0d2ec;
-}
-.dtree .clip {
- overflow: hidden;
-}
-
-
- </style>
- <script language='javascript' src='support/dtree.js'></script>
-</head>
-
-<body style='padding: 25px;'>
-
-<a href="$config{index}">Home</a>
-
-<h1>User Group Hierarchy Setup</h1>
-<hr/>
-HEADER
-
-my $uri = $cgi->url(-relative=>1);
-
-my $top;
-for my $grp ( permission::grp_tree->search( {parent=>undef} ) ) {
- my $name = $grp->name;
- my $desc = $grp->description || $grp->name;
- $top = $grp->id;
- $name =~ s/'/\\'/og;
- print <<" HEADER";
-<div style="float: left;">
- <script language='javascript'>
- var tree = new dTree("tree");
- tree.add($grp, -1, "$name", "$uri?action=child&id=$grp", "$desc");
- HEADER
- $top = $grp->id;
- last;
-}
-
-for my $grp ( permission::grp_tree->search_like( {parent => '%'}, {order_by => 'name'} ) ) {
- my $name = $grp->name;
- my $desc = $grp->description || $grp->name;
- $name =~ s/'/\\'/og;
- my $parent = $grp->parent;
- print "\ttree.add($grp, $parent, \"$name\", \"$uri?action=child&id=$grp\", \"$desc\");\n";
-}
-
-print <<HEADER;
- tree.closeAllChildren($top);
- document.write(tree.toString());
- </script>
-</div>
-<div style="float:right; width:75%;">
-HEADER
-
-#-------------------------------------------------------------------------------
-# Logic part
-#-------------------------------------------------------------------------------
-
-if (my $action = $cgi->param('action')) {
- if ( $action eq 'child' ) {
- my $id = $cgi->param('id');
- if ($id) {
- my $node = permission::grp_tree->retrieve($id);
- #-----------------------------------------------------------------------
- # child form
- #-----------------------------------------------------------------------
-
- print "<h2>Edit Group '".$node->name."'</h2>";
- print "<form method='POST'>".
- "<table class='table_class'><tr class='header_class'>\n";
-
- print Tr(
- th($org_cols{id}),
- td( $node->id() ),
- );
- print Tr(
- th($org_cols{name}),
- td("<input type='text' name='name_$node' value=\"". $node->name() ."\">"),
- );
- print Tr(
- th($org_cols{parent}),
- td("<select name='parent_$node'>".do{
- my $out = '<option>-- Select One --</option>';
- for my $org ( sort {$a->id <=> $b->id} permission::grp_tree->retrieve_all) {
- $out .= "<option value='$org' ".do {
- if ($node->parent == $org->id) {
- "selected";
- }}.'>'.$org->name.'</option>'
- }
- $out;
- }."</select><input type='hidden' value='$node' name='id'>"),
- );
- print Tr(
- th($org_cols{description}),
- td("<input type='text' name='description_$node' value=\"". $node->description() ."\">"),
- );
- print Tr(
- th($org_cols{application_perm}),
- "<td>".do {
- my $out = '<select name="application_perm_'.$node.'"><option value="">-- Select One --</option>';
- $out .= '<option'.do{
- " selected='selected'" if ($_->code eq $node->application_perm);
- }.'>'. $_->code .'</option>' for ( sort {$a->code cmp $b->code} @perms );
- $out .= '</select>';
- $out;
- }."</td>"
- );
-
- print Tr( "<td colspan='2'><input type='submit' name='action' value='Update'/></td>" );
-
- print "</table></form><hr/>";
-
-
- print "<h2>Group Permissions</h2>";
-
- print "<form method='POST'>".
- "<table class='table_class'>\n".
- "<tr class='header_class'><th>Permission</th><th>Select</th><th>At Depth</th><th>Grantable</th></tr>";
-
- for my $perm ( sort {$a->code cmp $b->code} @perms ) {
- my $grp = $node;
- my $out = '<select name="depth_'.$perm->id.'"><option value="">-- Select One --</option>';
- for my $outype ( actor::org_unit_type->retrieve_all ) {
- my $grp = $node;
- $out .= "<option value='".$outype->depth."' ".do{
- my $stuff = '';
- do {
- if ($grp) {
- my $setting = permission::grp_perm_map->search(
- { grp => $grp->id,
- perm => $perm->id }
- )->next;
- $stuff = "selected " if($setting && $outype->depth == $setting->depth);
- if($stuff && $setting && $setting->grp != $node->id) {
- $out =~ s/^<select/<select disabled/o;
- }
- }
- } while (!$stuff && $grp && ($grp = $grp->parent));
- $stuff;
- }.">".$outype->name."</option>";
- }
- $out .= "</select>";
- $out .= "</td><td><input type='checkbox' name='grant_$perm' value='t' ".
- do{
- my $stuff = '';
- do {
- if ($grp) {
- my $setting = permission::grp_perm_map->search(
- { grp => $grp->id,
- perm => $perm->id }
- )->next;
- $stuff = "checked='checked' " if ($setting && $setting->grantable);
- }
- } while (!$stuff && $grp && ($grp = $grp->parent));
- $stuff;
- }.">";
-
- $grp = $node;
- print Tr( "<td>".$perm->code."</td><td>".
- "<input type='checkbox' name='permission_$perm' value='$perm' ".
- do{
- my $stuff = '';
- do {
- if ($grp) {
- my $setting = permission::grp_perm_map->search(
- { grp => $grp->id,
- perm => $perm->id }
- )->next;
- $stuff = "checked " if ($setting);
- $stuff .= "disabled " if($setting && $setting->grp != $node->id);
- }
- } while (!$stuff && $grp && ($grp = $grp->parent));
- $stuff;
- }.
- "></td><td>$out</td>"
-
- );
- }
-
- print Tr( "<td colspan='3'><input type='hidden' value='$node' name='perms'>",
- "<input type='submit' name='action' value='Set Permissions'/></td>" );
- print "</table></form><hr/>";
-
-
-
- print "<h2>New Child</h2>";
-
- print "<form method='POST'>".
- "<table class='table_class'>\n";
-
- print Tr(
- th($org_cols{name}),
- td("<input type='text' name='name'>"),
- );
- print Tr(
- th($org_cols{description}),
- td("<input type='text' name='description'>"),
- );
- print Tr( "<td colspan='2'><input type='hidden' value='$node' name='parent'>",
- "<input type='submit' name='action' value='Add New'/></td>" );
- print "</table></form><hr/>";
-
- }
- }
-}
-
-print "</div></body></html>";
-
-
my ($dbhost, $dbport, $dbname, $dbuser, $dbpw, $help);
my $config_file = '';
my $build_db_sh = '';
-my $bootstrap_file = '';
my $offline_file = '';
my $prefix = '';
my $sysconfdir = '';
die "ERROR: Failed to update the configuration file '$config_file'\n";
}
-# write out the DB bootstrapping config
-sub create_db_bootstrap {
- my ($setup, $settings) = @_;
-
- open(FH, '>', $setup) or die "Could not write database setup to $setup\n";
-
- print "Writing database bootstrapping configuration to $setup\n";
-
- printf FH "\$main::config{dsn} = 'dbi:Pg:host=%s;dbname=%s;port=%d';\n",
- $settings->{host}, $settings->{db}, $settings->{port};
-
- printf FH "\$main::config{usr} = '%s';\n", $settings->{user};
- printf FH "\$main::config{pw} = '%s';\n", $settings->{pw};
-
- print FH "\$main::config{index} = 'config.cgi';\n";
- close(FH);
-}
-
# write out the offline config
sub create_offline_config {
my ($setup, $settings) = @_;
chdir($script_dir);
}
-my $bootstrap;
my $offline;
my $cschema;
my $uconfig;
my %settings;
GetOptions("create-schema" => \$cschema,
- "create-bootstrap" => \$bootstrap,
"create-offline" => \$offline,
"update-config" => \$uconfig,
- "bootstrap-file=s" => \$bootstrap_file,
"config-file=s" => \$config_file,
"build-db-file=s" => \$build_db_sh,
"service=s" => \@services,
$build_db_sh = File::Spec->catfile($script_dir, '../sql/Pg/build-db.sh');
}
-if (!$bootstrap_file) {
- $bootstrap_file = File::Spec->catfile($sysconfdir, 'live-db-setup.pl');
-}
-
if (!$offline_file) {
$offline_file = File::Spec->catfile($sysconfdir, 'offline-config.pl');
}
get_settings(\%settings);
if ($cschema) { create_schema(\%settings); }
-if ($bootstrap) { create_db_bootstrap($bootstrap_file, \%settings); }
if ($offline) { create_offline_config($offline_file, \%settings); }
-if ((!$cschema && !$uconfig && !$bootstrap && !$offline) || $help) {
+if ((!$cschema && !$uconfig && !$offline) || $help) {
print <<HERE;
SYNOPSIS
--config-file
specifies the opensrf.xml file. Defaults to /openils/conf/opensrf.xml
- --bootstrap-file
- specifies the database bootstrap file required by the CGI setup
- interface. Defaults to /openils/conf/live-db-setup.pl
-
--build-db-file
specifies the script that creates the database schema. Defaults to
Open-ILS/src/sql/pg/build-db.sh
Configures Evergreen database settings in the file specified by
--build-db-file.
- --create-bootstrap
- Creates the database bootstrap file required by the CGI setup interface
-
--create-offline
Creates the database setting file required by the offline data uploader
script with a complete set of commands:
perl Open-ILS/src/support-scripts/eg_db_config.pl --update-config \
- --service all --create-schema --create-bootstrap --create-offline \
+ --service all --create-schema --create-offline \
--user evergreen --password evergreen --hostname localhost --port 5432 \
--database evergreen
reportsdir = $(DESTDIR)$(WEBDIR)/reports/
if BUILDILSWEB
-OILSWEB_INST = webcore-install offline-install cgi-bootstrap
+OILSWEB_INST = webcore-install offline-install
#webcore-install
$(OPENSRF_LIBS)/javascript/opensrf_xmpp.js
endif
-install-exec-local: webcore-install offline-install cgi-bootstrap
+install-exec-local: webcore-install offline-install
uninstall-hook:
rm -R $(opacextrasdir)
cp $(TMP)/offline.pl $(DESTDIR)$(CGIDIR)/offline/
chmod +x $(DESTDIR)$(CGIDIR)/offline/offline.pl
-cgi-bootstrap:
- @echo "Installing cgi's to $(DESTDIR)$(CGIDIR)"
- $(MKDIR_P) $(TMP)/cgi-bin
- $(MKDIR_P) $(DESTDIR)$(CGIDIR)
- for i in @top_srcdir@/Open-ILS/src/cgi-bin/*cgi; do xxx=`basename $$i`; perl -pe "s{##CONFIG##}{@sysconfdir@}" < $$i > $(TMP)/cgi-bin/$$xxx; done
- cp $(TMP)/cgi-bin/*cgi $(DESTDIR)$(CGIDIR)
- cp -r @top_srcdir@/Open-ILS/src/cgi-bin/support $(DESTDIR)$(CGIDIR)
- chmod 755 $(DESTDIR)$(CGIDIR)/*cgi
-
install-data-local:
$(MKDIR_P) $(DESTDIR)$(WEBDIR)/opac/common/js
for i in $(OPACJS); do \