[AppWrap-cvs] AppWrap/Apache/AppWrap Audit.pm,1.5,1.6
Status: Beta
Brought to you by:
planetman
From: <pla...@us...> - 2002-12-07 01:48:17
|
Update of /cvsroot/appwrap/AppWrap/Apache/AppWrap In directory sc8-pr-cvs1:/tmp/cvs-serv3719 Modified Files: Audit.pm Log Message: i18n complete; CSS complete Index: Audit.pm =================================================================== RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Audit.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Audit.pm 22 Nov 2002 10:05:55 -0000 1.5 --- Audit.pm 7 Dec 2002 01:48:14 -0000 1.6 *************** *** 8,13 **** use strict; ! use Date::Format; ! use Date::Parse; use Apache::Request; use Apache::Constants qw(:common); --- 8,14 ---- use strict; ! use warnings; ! use Date::Format qw(time2str); ! use Apache::Request; use Apache::Constants qw(:common); *************** *** 18,22 **** use vars qw($VERSION); ! $Apache::AppWrap::Audit::VERSION = '0.04'; ############################ --- 19,23 ---- use vars qw($VERSION); ! $Apache::AppWrap::Audit::VERSION = '0.05'; ############################ *************** *** 25,40 **** ############################ sub handler { ! my $r = Apache::Request->instance( Apache->request ); ! my $opts = $r->pnotes('opts'); ! my $table = $opts->{table}; ! my $idnum = $opts->{args}{idnum}; ! my $my_exceptions = $opts->{my_exceptions}; ! my $my_tables = $opts->{my_tables}; ! my $my_columns = $opts->{my_columns}; ! my $my_defaults = $opts->{my_defaults}; ! my $log = $r->log; #$log->debug("\nAudit: idnum=$idnum, table=$table"); # order to display columns --- 26,67 ---- ############################ sub handler { ! my $r = Apache::Request->instance( Apache->request ); ! my $opts = $r->pnotes('opts'); ! my $table = $opts->{table}; ! my $idnum = $opts->{args}{idnum}; ! my $my_exceptions = $opts->{my_exceptions}; ! my $my_tables = $opts->{my_tables}; ! my $my_columns = $opts->{my_columns}; ! my $my_defaults = $opts->{my_defaults}; #$log->debug("\nAudit: idnum=$idnum, table=$table"); + my $msgs = $opts->{display_text}; + $msgs ||= Apache::AppWrap::Subs::get_display_text($opts); + $opts->{display_text} ||= $msgs; + $opts->{msgs} = $msgs; + + # titles want to see these vars defined + my $link_vars = Apache::AppWrap::Subs::cclinks($opts); + my $link = '<a href="' . $config{homeurl} . '/'; + $link .= $table . '/focus?idnum=' . $idnum . '">'; + $link .= $idnum . '</a>'; + + my $title = eval $msgs->{title} if $msgs->{title}; + unless ($title) { + $r->log_error("Audit: no title eval'd: $msgs->{title}"); + return SERVER_ERROR; + } + $opts->{Title} = $title; + my $log = $r->log; + + my $subtitle = eval $msgs->{subtitle} if $msgs->{subtitle}; + unless ($subtitle) { + $r->log_error("Audit: no subtitle eval'd: $msgs->{subtitle}"); + return SERVER_ERROR; + } + # app color, app name, col name + $opts->{SubTitle} = $subtitle; + # order to display columns *************** *** 44,48 **** # format them like a table record, and write to an array of hash # refs. Array is ordered as most recent history enty first. ! $opts->{history} ||= &Apache::AppWrap::Subs::get_history( $opts); my $history = $opts->{history}; my @changes; --- 71,75 ---- # format them like a table record, and write to an array of hash # refs. Array is ordered as most recent history enty first. ! $opts->{history} ||= Apache::AppWrap::Subs::get_history( $opts); my $history = $opts->{history}; my @changes; *************** *** 51,55 **** foreach my $h_column (keys %{ $history->{$table}{$idnum} }) { foreach my $date (keys %{ $history->{$table}{$idnum}{$h_column} }) { ! # the hash is an array ref, but we only want the last possible element $record{$date}{$h_column} = $history->{$table}{$idnum}{$h_column}{$date}[-1]; } # date --- 78,83 ---- foreach my $h_column (keys %{ $history->{$table}{$idnum} }) { foreach my $date (keys %{ $history->{$table}{$idnum}{$h_column} }) { ! # the hash is an array ref, but we only want the last ! # possible element $record{$date}{$h_column} = $history->{$table}{$idnum}{$h_column}{$date}[-1]; } # date *************** *** 58,62 **** # get current record from source table my $where = 'idnum=' . $idnum; ! my $ref = &Apache::AppWrap::Subs::sqlSelectHashRef ('*', $table, $where); # @final is the combined data structure my @final; --- 86,90 ---- # get current record from source table my $where = 'idnum=' . $idnum; ! my $ref = Apache::AppWrap::Subs::sqlSelectHashRef ('*', $table, $where); # @final is the combined data structure my @final; *************** *** 84,88 **** } $val =~ s/\n/<br \/>/g if $val; ! my $result = &Apache::AppWrap::Subs::html_blank ($val); if ($result) { $converts{$column} = $result if $result; --- 112,116 ---- } $val =~ s/\n/<br \/>/g if $val; ! my $result = Apache::AppWrap::Subs::html_blank ($val); if ($result) { $converts{$column} = $result if $result; *************** *** 125,135 **** } $val =~ s/\n/<br \/>/g if $val; ! my $result = &Apache::AppWrap::Subs::html_blank ($val); - # if ($row->{$column}) { # if here, the field changed from the previous row, so mark same # field in previous row, ghost this field this row. ! # The $array[-1] construct represents the last entry in the array. ! $test = $row->{$column}; #$log->debug("\nAudit: (delta) row=$row, col=$column, row->{column}=$test"); --- 153,162 ---- } $val =~ s/\n/<br \/>/g if $val; ! my $result = Apache::AppWrap::Subs::html_blank ($val); # if here, the field changed from the previous row, so mark same # field in previous row, ghost this field this row. ! # The $array[-1] construct represents the last entry in the array. ! #$test = $row->{$column}; #$log->debug("\nAudit: (delta) row=$row, col=$column, row->{column}=$test"); *************** *** 157,161 **** # now make the output. Start with the header. my @rows; ! push @rows, ' <table border="1">' . $HNL . ' <tr valign="bottom">'; foreach my $column (@$col_order) { next if $column eq 'idnum'; --- 184,191 ---- # now make the output. Start with the header. my @rows; ! # add the CSS <div> ! push @rows, '<div id="pager">' . $HNL; ! push @rows, ' <table>' . $HNL . ' <tr>'; ! ## push @rows, ' <table border="1">' . $HNL . ' <tr valign="bottom">'; foreach my $column (@$col_order) { next if $column eq 'idnum'; *************** *** 170,174 **** # now format the rows output foreach my $row (@final) { ! push @rows, ' <tr valign="top">'; foreach my $column (@$col_order) { next if $column eq 'idnum'; --- 200,204 ---- # now format the rows output foreach my $row (@final) { ! push @rows, ' <tr valign="top">'; foreach my $column (@$col_order) { next if $column eq 'idnum'; *************** *** 177,181 **** #$log->debug("\nAudit: col=$column, row->{column}=$out"); { # -w off ! local $ = 0; if ($out) { push @rows, '<td>' . $out . '</td>' if $out; --- 207,212 ---- #$log->debug("\nAudit: col=$column, row->{column}=$out"); { # -w off ! ## local $ = 0; ! no warnings qw(numeric uninitialized); if ($out) { push @rows, '<td>' . $out . '</td>' if $out; *************** *** 190,197 **** } # end ,column loop # add change date data ! my $h_date = &time2str("%d-%h-%y %H:%m", $row->{h_date}); push @rows, '<td>' . $h_date . '</td></tr>' . $HNL; } # end row loop push @rows, ' </table>' . $HNL; ######## left side links (vbar phase) ######### --- 221,229 ---- } # end ,column loop # add change date data ! my $h_date = time2str("%d-%h-%y %H:%m", $row->{h_date}); push @rows, '<td>' . $h_date . '</td></tr>' . $HNL; } # end row loop push @rows, ' </table>' . $HNL; + push @rows, '</div>' . $HNL; ######## left side links (vbar phase) ######### *************** *** 208,230 **** } } - my $link_vars = &Apache::AppWrap::Subs::cclinks($opts); - - $opts->{Title} = 'Audit of ' . $link_vars->{label}; - my $link = '<a href="/' . $table . '/focus?idnum=' . $idnum . '">'; - $link .= $idnum . '</a>'; ! my $subtitle = 'A history of all changes to Idnum ' . $link . '.'; ! # app color, app name, col name ! $opts->{SubTitle} = $subtitle; ! $opts->{Rows} = \@rows; ! # comply with HEAD request ! if ($r->header_only) { ! $r->send_http_header; ! return OK; ! } ! &Apache::AppWrap::Subs::Webify($opts); ! return OK; } # end handler --- 240,254 ---- } } ! $opts->{Rows} = \@rows; ! # comply with HEAD reques ! if ($r->header_only) { ! $r->send_http_header; ! return OK; ! } ! Apache::AppWrap::Subs::Webify($opts); ! return OK; } # end handler |