From 5717c0323b934fc48759624adb4f1855b991238b Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 3 May 2005 21:50:36 +0000 Subject: [PATCH] config updates... git-svn-id: svn://svn.open-ils.org/ILS/trunk@623 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/cgi-bin/circ-rules.cgi | 4 - Open-ILS/src/cgi-bin/copy_statuses.cgi | 121 +++++++++++++ Open-ILS/src/cgi-bin/lib-setup.cgi | 213 +++++++++++++++++++++++ Open-ILS/src/cgi-bin/superuser-setup.cgi | 1 - Open-ILS/src/cgi-bin/user-profiles.cgi | 2 +- 5 files changed, 335 insertions(+), 6 deletions(-) create mode 100755 Open-ILS/src/cgi-bin/copy_statuses.cgi create mode 100755 Open-ILS/src/cgi-bin/lib-setup.cgi diff --git a/Open-ILS/src/cgi-bin/circ-rules.cgi b/Open-ILS/src/cgi-bin/circ-rules.cgi index 251f6879f5..634aa3191a 100755 --- a/Open-ILS/src/cgi-bin/circ-rules.cgi +++ b/Open-ILS/src/cgi-bin/circ-rules.cgi @@ -98,7 +98,6 @@ if (my $action = $cgi->param('action')) { if ($form eq 'duration') { if ($action eq 'Remove Selected') { for my $id ( ($cgi->param('remove_me')) ) { - warn "========>>> Deleteing $id\n"; config::rules::circ_duration->retrieve($id)->delete; } } elsif ( $action eq 'Add New' ) { @@ -109,7 +108,6 @@ if (my $action = $cgi->param('action')) { } elsif ($form eq 'recuring_fine') { if ($action eq 'Remove Selected') { for my $id ( ($cgi->param('remove_me')) ) { - warn "========>>> Deleteing $id\n"; config::rules::recuring_fine->retrieve($id)->delete; } } elsif ( $action eq 'Add New' ) { @@ -120,7 +118,6 @@ if (my $action = $cgi->param('action')) { } elsif ($form eq 'max_fine') { if ($action eq 'Remove Selected') { for my $id ( ($cgi->param('remove_me')) ) { - warn "========>>> Deleteing $id\n"; config::rules::max_fine->retrieve($id)->delete; } } elsif ( $action eq 'Add New' ) { @@ -131,7 +128,6 @@ if (my $action = $cgi->param('action')) { } elsif ($form eq 'age_hold') { if ($action eq 'Remove Selected') { for my $id ( ($cgi->param('remove_me')) ) { - warn "========>>> Deleteing $id\n"; config::rules::age_hold_protect->retrieve($id)->delete; } } elsif ( $action eq 'Add New' ) { diff --git a/Open-ILS/src/cgi-bin/copy_statuses.cgi b/Open-ILS/src/cgi-bin/copy_statuses.cgi new file mode 100755 index 0000000000..6e49cc9f7e --- /dev/null +++ b/Open-ILS/src/cgi-bin/copy_statuses.cgi @@ -0,0 +1,121 @@ +#!/usr/bin/perl +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_*/; + +OpenILS::Application::Storage::CDBI->connection('dbi:Pg:host=10.0.0.2;dbname=open-ils-dev', 'postgres'); +OpenILS::Application::Storage::CDBI->db_Main->{ AutoCommit } = 1; + +my $cgi = new CGI; + +#------------------------------------------------------------------------------- +# HTML part +#------------------------------------------------------------------------------- + +print < + + + + + +

Copy Status Setup

+
+ +HEADER + +#------------------------------------------------------------------------------- +# setup part +#------------------------------------------------------------------------------- + +my %cs_cols = ( qw/id SysID name Name/ ); + +my @col_display_order = ( qw/id name/ ); + +#------------------------------------------------------------------------------- +# 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->update; + } + } elsif ( $action eq 'Add New' ) { + config::copy_status->create( { name => $cgi->param("name") } ); + } +} + + +#------------------------------------------------------------------------------- +# Form part +#------------------------------------------------------------------------------- +{ + #----------------------------------------------------------------------- + # User form + #----------------------------------------------------------------------- + print "
". + "\n"; + + for my $col ( @col_display_order ) { + print th($cs_cols{$col}); + } + + print ''; + + for my $row ( sort { $a->name cmp $b->name } (config::copy_status->retrieve_all) ) { + print Tr( + td( $row->id() ), + td(""), + td(""), + ); + } + + print Tr( + td(), + td(""), + td(), + ); + print "
Action
"; + print " | "; + print " | "; + print "

"; +} + +print ""; + + diff --git a/Open-ILS/src/cgi-bin/lib-setup.cgi b/Open-ILS/src/cgi-bin/lib-setup.cgi new file mode 100755 index 0000000000..99a5b3e327 --- /dev/null +++ b/Open-ILS/src/cgi-bin/lib-setup.cgi @@ -0,0 +1,213 @@ +#!/usr/bin/perl +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_*/; + +OpenILS::Application::Storage::CDBI->connection('dbi:Pg:host=10.0.0.2;dbname=open-ils-dev', 'postgres'); +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/ ); + +my @col_display_order = ( qw/id name shortname ou_type 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 ) { + $u->$col( $cgi->param($col."_$id") ); + } + $u->update; + } + } elsif ( $action eq 'Add New' ) { + actor::org_unit->create( { map { defined($cgi->param($_)) ? ($_ => $cgi->param($_)) : () } keys %org_cols } ); + } +} + +#------------------------------------------------------------------------------- +# HTML part +#------------------------------------------------------------------------------- + +print < + + + + + + + + +

Library Hierarchy Setup

+
+HEADER + +my $top; +for my $lib ( actor::org_unit->search( {parent_ou=>undef} ) ) { + my $name = $lib->name; + $name =~ s/'/\\'/og; + print <<" HEADER"; +
+ +
+
+ +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 "

Edit ".$node->name."

"; + print "
". + "\n"; + + print Tr( + th($org_cols{id}), + td( $node->id() ), + ); + print Tr( + th($org_cols{name}), + td(""), + ); + print Tr( + th($org_cols{shortname}), + td(""), + ); + print Tr( + th($org_cols{ou_type}), + td(""), + ); + print Tr( + th($org_cols{parent_ou}), + td(""), + ); + + print Tr( "" ); + + print "

"; + + + print "

New Child

"; + + print "
". + "\n"; + + print Tr( + th($org_cols{name}), + td(""), + ); + print Tr( + th($org_cols{shortname}), + td(""), + ); + print Tr( + th($org_cols{ou_type}), + td(""), + ); + print Tr( "" ); + print "
", + "

"; + } + } +} + +print "
"; + + diff --git a/Open-ILS/src/cgi-bin/superuser-setup.cgi b/Open-ILS/src/cgi-bin/superuser-setup.cgi index 4e6e0370b3..ead2dd75b8 100755 --- a/Open-ILS/src/cgi-bin/superuser-setup.cgi +++ b/Open-ILS/src/cgi-bin/superuser-setup.cgi @@ -79,7 +79,6 @@ if (my $action = $cgi->param('action')) { for my $id ( ($cgi->param('id')) ) { my $u = actor::user->retrieve($id); for my $col ( @col_display_order ) { - warn "Updating column $col with ".$cgi->param($col."_$id"); $u->$col( $cgi->param($col."_$id") ); } $u->active( 'f' ) unless ($cgi->param("active_$id")); diff --git a/Open-ILS/src/cgi-bin/user-profiles.cgi b/Open-ILS/src/cgi-bin/user-profiles.cgi index d1bdd46c33..f3b4955b6d 100755 --- a/Open-ILS/src/cgi-bin/user-profiles.cgi +++ b/Open-ILS/src/cgi-bin/user-profiles.cgi @@ -99,7 +99,7 @@ if (my $action = $cgi->param('action')) { for my $row ( sort { $a->name cmp $b->name } (actor::profile->retrieve_all) ) { print Tr( td( $row->id() ), - td(""), + td(""), td(""), ); } -- 2.43.2