4 use OpenILS::Application::Storage;
5 use OpenILS::Application::Storage::CDBI;
7 # I need to abstract the driver loading away...
8 use OpenILS::Application::Storage::Driver::Pg;
10 use CGI qw/:standard start_*/;
12 OpenILS::Application::Storage::CDBI->connection('dbi:Pg:host=10.0.0.2;dbname=open-ils-dev', 'postgres');
13 OpenILS::Application::Storage::CDBI->db_Main->{ AutoCommit } = 1;
17 #-------------------------------------------------------------------------------
19 #-------------------------------------------------------------------------------
22 Content-type: text/html
29 border: dashed lightgrey 1px;
30 background-color: #EEE;
31 border-collapse: collapse;
39 border: solid lightgrey 1px;
43 background-color: lightblue;
47 <body style='padding: 25px;'>
49 <h1>User Profile Setup</h1>
54 #-------------------------------------------------------------------------------
56 #-------------------------------------------------------------------------------
58 my %profile_cols = ( qw/id SysID name Name/ );
60 my @col_display_order = ( qw/id name/ );
62 #-------------------------------------------------------------------------------
64 #-------------------------------------------------------------------------------
66 if (my $action = $cgi->param('action')) {
67 if ( $action eq 'Remove Selected' ) {
68 for my $id ( ($cgi->param('id')) ) {
69 actor::profile->retrieve($id)->delete;
71 } elsif ( $action eq 'Update Selected' ) {
72 for my $id ( ($cgi->param('id')) ) {
73 my $u = actor::profile->retrieve($id);
74 $u->name( $cgi->param("name_$id") );
77 } elsif ( $action eq 'Add New' ) {
78 actor::profile->create( { name => $cgi->param("name") } );
83 #-------------------------------------------------------------------------------
85 #-------------------------------------------------------------------------------
87 #-----------------------------------------------------------------------
89 #-----------------------------------------------------------------------
90 print "<form method='POST'>".
91 "<table class='table_class'><tr class='header_class'>\n";
93 for my $col ( @col_display_order ) {
94 print th($profile_cols{$col});
97 print '<th>Action</th></tr>';
99 for my $row ( sort { $a->name cmp $b->name } (actor::profile->retrieve_all) ) {
102 td("<input type='text' name='name_$row' value='". $row->name() ."'>"),
103 td("<input type='checkbox' value='$row' name='id'>"),
109 td("<input type='text' name='name'>"),
113 print "<input type='submit' name='action' value='Remove Selected'/> | ";
114 print "<input type='submit' name='action' value='Update Selected'/> | ";
115 print "<input type='submit' name='action' value='Add New'/></form><hr/>";
118 print "</body></html>";