appwrap-cvs Mailing List for AppWrap web frontend to workgroup data
Status: Beta
Brought to you by:
planetman
You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(30) |
Oct
(27) |
Nov
(86) |
Dec
(65) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(12) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(2) |
Dec
|
|
From: <pla...@us...> - 2003-11-02 07:55:21
|
Update of /cvsroot/appwrap/AppWrap/conf
In directory sc8-pr-cvs1:/tmp/cvs-serv21471
Modified Files:
startup.pl.template
Log Message:
changes to allow appwrap to run as q subset of an existing website
Index: startup.pl.template
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/conf/startup.pl.template,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** startup.pl.template 29 Nov 2002 13:27:57 -0000 1.13
--- startup.pl.template 2 Nov 2003 07:55:18 -0000 1.14
***************
*** 26,30 ****
);
use AppWrap qw(%config);
! use AppWrap;
# save restarting the development server
use Apache::StatINC;
--- 26,30 ----
);
use AppWrap qw(%config);
! # use AppWrap;
# save restarting the development server
use Apache::StatINC;
***************
*** 106,114 ****
# per column db info (all tables)
! my ($table_meta, $column_meta) = Apache::AppWrap::Subs::column_meta();
! $config{table_meta} = $table_meta;
! # $Apache::AppWrap::Config::config{table_meta} = $table_meta;
! $config{column_meta} = $column_meta;
! # $Apache::AppWrap::Config::config{column_meta} = $column_meta;
--- 106,112 ----
# per column db info (all tables)
! my ($table_meta, $column_meta) = Apache::AppWrap::Subs::column_meta();
! $config{table_meta} = $table_meta;
! $config{column_meta} = $column_meta;
|
|
From: <pla...@us...> - 2003-11-02 07:54:02
|
Update of /cvsroot/appwrap/AppWrap/Apache/AppWrap
In directory sc8-pr-cvs1:/tmp/cvs-serv21271
Modified Files:
Doorknob.pm Pager.pm Subs.pm
Log Message:
Many undocumented robustness and refactoring changes.
Index: Doorknob.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Doorknob.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** Doorknob.pm 25 Aug 2003 14:00:35 -0000 1.16
--- Doorknob.pm 2 Nov 2003 07:53:58 -0000 1.17
***************
*** 41,46 ****
# bug out immediately on images and CGI (Apache::Registry modules
# in /perl)
! return DECLINED if $r->uri =~ m!^/images!;
! return DECLINED if $r->uri =~ m!^/includes!;
if ($r->uri =~ m!^/perl!) {
return DECLINED unless $r->uri eq "/perl-status";
--- 41,48 ----
# bug out immediately on images and CGI (Apache::Registry modules
# in /perl)
! return DECLINED if $r->uri =~ m!^/$config{images}!;
! # return DECLINED if $r->uri =~ m!^/images!;
! return DECLINED if $r->uri =~ m!^/$config{includes}!;
! # return DECLINED if $r->uri =~ m!^/includes!;
if ($r->uri =~ m!^/perl!) {
return DECLINED unless $r->uri eq "/perl-status";
***************
*** 50,71 ****
my $test;
# get the table and phase. This site presently defines no
# path components beyond the phase: http://domain/$table/$phase
! my (undef, $table, $phase, undef) = split('/', $r->uri);
return DECLINED unless $table;
#$log->debug("\nDoorknob: got table: $table") if $table;
- #$log->debug("\nDoorknob: got phase: $phase") if $phase;
# use %opts to pass info between subs. &Verify might have set
! # $r->notes if fields were missing from user input.
my %opts;
# load my_defaults before my_tables so that we have default
# values when required.
! $opts{my_defaults} = Apache::AppWrap::Subs::get_my_defaults();
# get the contents of table:my_tables. Its OK that %opts is
# currently empty, my_tables stores a ref in it
my $my_tables = Apache::AppWrap::Subs::get_my_tables(\%opts);
# bug out if request is not a valid table name
--- 52,94 ----
my $test;
+ # Experimental. Attempt to capture the location of
+ # this particular place in URI space used by AppWrap tables
+ my $aw_dir = $r->dir_config('AppWrap_Directory');
+
+
# get the table and phase. This site presently defines no
# path components beyond the phase: http://domain/$table/$phase
! my $uri = $r->uri;
! #$log->debug("\nDoorknob: uri: $uri.");
! $uri =~ s/^$aw_dir// if $aw_dir;
! my (undef, $table, $phase, undef) = split('/', $uri);
! # my (undef, $table, $phase, undef) = split('/', $r->uri);
return DECLINED unless $table;
#$log->debug("\nDoorknob: got table: $table") if $table;
# use %opts to pass info between subs. &Verify might have set
! # $r->pnotes if fields were missing from user input.
my %opts;
+ # preload data commonly used by downstream handlers and subs
# load my_defaults before my_tables so that we have default
# values when required.
! my $my_defaults = Apache::AppWrap::Subs::get_my_defaults();
! unless ($my_defaults) {
! my $msg = qq{Doorknob: no data from Subs::get_my_defaults()};
! $r->log_error($msg);
! return SERVER_ERROR;
! }
! $opts{my_defaults} = $my_defaults;
# get the contents of table:my_tables. Its OK that %opts is
# currently empty, my_tables stores a ref in it
my $my_tables = Apache::AppWrap::Subs::get_my_tables(\%opts);
+ unless ($my_tables) {
+ my $msg = qq{Doorknob: no data from Subs::get_my_tables()};
+ $r->log_error($msg);
+ return SERVER_ERROR;
+ }
+ $opts{my_tables} = $my_tables;
# bug out if request is not a valid table name
***************
*** 79,86 ****
# focus audit calendar generate_form verify confirm]
! # preload data commonly used by downstream handlers and subs
! $opts{my_tables} = $my_tables;
! $opts{my_columns} = Apache::AppWrap::Subs::get_my_columns(\%opts);
! # $opts{my_exceptions}= Apache::AppWrap::Subs::get_my_exceptions();
# enforce some rules for tables. These are directives
--- 102,112 ----
# focus audit calendar generate_form verify confirm]
! my $my_columns = Apache::AppWrap::Subs::get_my_columns(\%opts);
! unless ($my_columns) {
! my $msg = qq{Doorknob: no data from Subs::get_my_columns()};
! $r->log_error($msg);
! return SERVER_ERROR;
! }
! $opts{my_columns} = $my_columns;
# enforce some rules for tables. These are directives
***************
*** 241,245 ****
# these are the desirable my_tables directives
! my @my_tables_dirs = qw(table_type label menu_order menu_tab);
# these are the desirable my_tables directives
--- 267,272 ----
# these are the desirable my_tables directives
! my @my_tables_dirs = qw(table_type label );
! # my @my_tables_dirs = qw(table_type label menu_order menu_tab);
# these are the desirable my_tables directives
Index: Pager.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Pager.pm,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** Pager.pm 19 Jan 2003 23:29:24 -0000 1.20
--- Pager.pm 2 Nov 2003 07:53:58 -0000 1.21
***************
*** 302,306 ****
my $row_count = scalar(@$to_display) if $to_display;
! $opts->{row_count} = $row_count;
######## this is the data_header section ########
--- 302,306 ----
my $row_count = scalar(@$to_display) if $to_display;
! $opts->{row_count} = $row_count || 1;
######## this is the data_header section ########
Index: Subs.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Subs.pm,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** Subs.pm 25 Aug 2003 14:00:35 -0000 1.38
--- Subs.pm 2 Nov 2003 07:53:58 -0000 1.39
***************
*** 29,32 ****
--- 29,33 ----
use Apache::Util ();
use Apache::File ();
+ use Apache::Request ();
use File::Spec ();
***************
*** 299,307 ****
# add the field information to the data structure
$column_meta->{$table}{$column} = {
! 'scale' =>$scale,
! 'precision' =>$prec,
! 'type' =>$type,
! 'nullable' =>$nullable
! };
}
# Explicitly de-allocate the statement resources
--- 300,308 ----
# add the field information to the data structure
$column_meta->{$table}{$column} = {
! 'scale' => $scale,
! 'precision' => $prec,
! 'type' => $type,
! 'nullable' => $nullable,
! };
}
# Explicitly de-allocate the statement resources
***************
*** 1560,1564 ****
$icon = '<link rel="shortcut icon" href="' . $img;
$icon .= ' type="' . $my_defaults->{favicontype};
! $icon = '" title="Favorite" />' . $HNL;
}
# print the opening html
--- 1561,1565 ----
$icon = '<link rel="shortcut icon" href="' . $img;
$icon .= ' type="' . $my_defaults->{favicontype};
! $icon .= '" title="Favorite" />' . $HNL;
}
# print the opening html
***************
*** 1568,1575 ****
my $header = $doc_type;
# my $header = '<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">' . $HNL;
! $header .= '<head><title>' . $screen_title . '</title>' . $HNL;
! $header .= "<!-- This is AppWrap $AppWrap::VERSION -->" . $HNL;
$header .= $icon if $iconfile;
! $header .= '<link rev="made" href="' . $my_defaults->{emailaddy};
$header .= '" />' . $HNL;
--- 1569,1576 ----
my $header = $doc_type;
# my $header = '<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">' . $HNL;
! $header .= qq{<head><title>$screen_title</title>$HNL};
! $header .= qq{<!-- This is AppWrap $AppWrap::VERSION -->$HNL};
$header .= $icon if $iconfile;
! $header .= qq{<link rev="made" href="$my_defaults->{emailaddy}};
$header .= '" />' . $HNL;
***************
*** 1597,1620 ****
$header .= $HNL;
! # link-in the javascript library. With thanks to the phpMyAdmin team
! $header .= '<script src="' . '/';
! $header .= $config{includes} . '/' . $my_defaults->{javascript_lib};
! $header .= '" type="text/javascript" language="javascript"></script>';
! $header .= $HNL . '</head>' . $HNL . '<body>';
! push @output, $header;
! # this is the width of yer basic display device
! my $screen_width = '960';
! my $main_table_width = $opts->{main_table_width};
! $main_table_width ||= $my_defaults->{main_table_width};
! my $vbar_width = $opts->{vbar_width};
! $vbar_width ||= $my_tables->{$table}{vbar_width} if $table;
! $vbar_width ||= $my_defaults->{vbar_width};
! my $vbar_class = $opts->{vbar_class} ||= 'vbar';
! # start a div for logo and motd. Want motd to cling to right side
! # of table or screen. Leave 600 px for the motd
! my @header;
# first float in the motd area into the upper right of the screen.
push @header, '<!-- default screen width is 960px -->' . $HNL;
--- 1598,1621 ----
$header .= $HNL;
! # link-in the javascript library. With thanks to phpMyAdmin.
! $header .= '<script src="/' . $config{includes};
! $header .= '/' . $my_defaults->{javascript_lib} . '"';
! $header .= qq{ type="text/javascript" language="javascript">};
! $header .= qq{</script>$HNL</head>$HNL<body>};
! push @output, $header;
! # this is the width of yer basic display device
! my $screen_width = '960';
! my $main_table_width = $opts->{main_table_width};
! $main_table_width ||= $my_defaults->{main_table_width};
! my $vbar_width = $opts->{vbar_width};
! $vbar_width ||= $my_tables->{$table}{vbar_width} if $table;
! $vbar_width ||= $my_defaults->{vbar_width};
! my $vbar_class = $opts->{vbar_class} ||= 'vbar';
! # start a div for logo and motd. Want motd to cling to right side
! # of table or screen. Leave 600 px for the motd
! my @header;
# first float in the motd area into the upper right of the screen.
push @header, '<!-- default screen width is 960px -->' . $HNL;
***************
*** 1659,1677 ****
# run &tab_bar before starting the table so that we have the width
# of all the tabs
! my $tab_bar = tab_bar($opts);
! #$log->debug("\nWebify: $tab_bar");
! # Get tabs for tabbed user interface.
! if ($tab_bar && scalar(@$tab_bar)) {
! foreach my $tab (@$tab_bar) {
! push @output, $tab if $tab;
! }
! }
! ### This is where to add new JavScript header logic or sub() call.
! # Long term solution should have subroutine call replace the logic
! # in startup.pl which populates
! # $config{header}. For now, do it here so
! # changes are reloaded without restarting the server.
! # page titles, start with header file
# Setup the div for the vertical bar on the left side
--- 1660,1679 ----
# run &tab_bar before starting the table so that we have the width
# of all the tabs
! if ($my_defaults->{tabbed_menus}) {
! my $tab_bar = tab_bar($opts);
! # Get tabs for tabbed user interface.
! if ($tab_bar && scalar(@$tab_bar)) {
! foreach my $tab (@$tab_bar) {
! push @output, $tab if $tab;
! }
! }
! }
! ### This is where to add new JavScript header logic or sub() call.
! # Long term solution should have subroutine call replace the logic
! # in startup.pl which populates
! # $config{header}. For now, do it here so
! # changes are reloaded without restarting the server.
! # page titles, start with header file
# Setup the div for the vertical bar on the left side
***************
*** 1696,1719 ****
my $width = $my_defaults->{vbar_table_width};
! push @output, ' <!-- This is the daily stats table -->' . $HNL;
! my $daily_stats = daily_stats( $opts );
! if ($daily_stats && scalar(@$daily_stats)) {
! push @output, join("", @$daily_stats);
! }
! $text = '</div> <!-- This ends the leftvbar div -->';
! push @output, $text . $HNL;
! # this will print nothing if no $opts->{Title} defined
! my $title = $opts->{Title};
! if ($title) {
! push @output, ' <p id="title">' . $title . '</p>' . $HNL;
! }
! # some pages set no subtitle, so check for it.
! my $subtitle = $opts->{SubTitle};
! if ($subtitle) {
! push @output, ' <p id="subtitle">' . $subtitle;
! push @output, '</p>' . $HNL;
! }
# start the main body area
# Body of page
--- 1698,1721 ----
my $width = $my_defaults->{vbar_table_width};
! # skip if stats aren't enbled
! if ($my_defaults->{dailystats_enabled}) {
! push @output, qq{ <!-- This is the daily stats table -->$HNL};
! my $daily_stats = daily_stats( $opts );
! if ($daily_stats && scalar(@$daily_stats)) {
! push @output, join "", @$daily_stats;
! }
! }
! $text = '</div> <!-- This ends the leftvbar div -->';
! push @output, $text . $HNL;
! # this will print nothing if no $opts->{Title} defined
! my $title = $opts->{Title};
! push @output, qq{ <p id="title">$title</p>$HNL} if $title;
! # some pages set no subtitle, so check for it.
! my $subtitle = $opts->{SubTitle};
! if ($subtitle) {
! push @output, qq{ <p id="subtitle">$subtitle</p>$HNL};
! }
# start the main body area
# Body of page
***************
*** 2060,2076 ****
###############################
sub get_my_tables {
! my $opts = shift;
! my %my_tables;
! my $ref = sqlSelectArrayRef('*', 'my_tables');
! my $log = Apache->request->log;
my $test;
# my $test = join (", ", map {$_ . '=' . $args->{$_} } %$args);
#$log->debug("\nget_my_tqbles: args=$test");
! foreach my $row (@$ref) {
! my ($idnum, $tablename, $admin_name, $admin_value) = @$row;
! $my_tables{$tablename}{$admin_name} = $admin_value;
! }
!
##############################
# here we will fudge just a bit. Want to get all text labels
--- 2062,2079 ----
###############################
sub get_my_tables {
! my $opts = shift;
! my %my_tables;
! my $ref = sqlSelectArrayRef('*', 'my_tables');
! my $r = Apache->request;
! my $log = $r->log;
my $test;
# my $test = join (", ", map {$_ . '=' . $args->{$_} } %$args);
#$log->debug("\nget_my_tqbles: args=$test");
! foreach my $row (@$ref) {
! my ($idnum, $tablename, $admin_name, $admin_value) = @$row;
! $my_tables{$tablename}{$admin_name} = $admin_value;
! }
!
##############################
# here we will fudge just a bit. Want to get all text labels
***************
*** 2080,2108 ****
# AppWrap lot. This is good.
##############################
! my $my_text = $opts->{my_text};
! $my_text ||= get_my_text($opts);
! $opts->{my_text} = $my_text;
# foreach my $tablename (%$my_text) {
# foreach my $tablename (%$my_text) {
# }
!
! # while we are here, lets store a list of all valid tables
! my @valid_tables;
! foreach (keys %my_tables) {
! next unless $_;
! # some tables have no key_type, so allow this.
! next unless $my_tables{$_}{parent};
! next unless $my_tables{$_}{menu_order};
! next if ($my_tables{$_}{table_type} &&
$my_tables{$_}{table_type} eq 'report');
! # next if $my_tables{$_}{report};
! next if $my_tables{$_}{beta};
! # store a list of valid tables, which will generate no
! # 'uninitialized value' errors
! push @valid_tables, $_;
! }
! $opts->{valid_tables} = \@valid_tables;
! return \%my_tables;
} # end my_tables sub
--- 2083,2115 ----
# AppWrap lot. This is good.
##############################
! # my $my_text = $opts->{my_text};
! # $my_text ||= get_my_text($opts);
! # unless ($my_text) {
! # my $msg = q{Subs::get_my_tables: no data from &get_my_text};
! # $r->log_error($msg);
! # return;
! # }
! # $opts->{my_text} = $my_text;
# foreach my $tablename (%$my_text) {
# foreach my $tablename (%$my_text) {
# }
! # while we are here, lets store a list of all valid tables
! my @valid_tables;
! foreach (keys %my_tables) {
! next unless $_;
! # some tables have no key_type, so allow this.
! next unless $my_tables{$_}{parent};
! next unless $my_tables{$_}{menu_order};
! next if ($my_tables{$_}{table_type} &&
$my_tables{$_}{table_type} eq 'report');
! # next if $my_tables{$_}{report};
! next if $my_tables{$_}{beta};
! # store a list of valid tables, which will generate no
! # 'uninitialized value' errors
! push @valid_tables, $_;
! }
! $opts->{valid_tables} = \@valid_tables;
! return \%my_tables;
} # end my_tables sub
***************
*** 2138,2141 ****
--- 2145,2150 ----
sub get_my_text {
my ($opts, $args) = @_;
+ my $r = Apache->request;
+
my $text;
my $test;
***************
*** 2148,2162 ****
$lang ||= get_language($opts);
$opts->{language} ||= $lang;
- my $r = Apache->request;
my $log = $r->log;
! $test = join (", ", map {$_ . '=' . $args->{$_} } %$args);
#$log->debug("\nget_my_text: args=$test");
my $user = $r->pnotes('authed_email');
! unless ($lang) {
! $text = $r->as_string;
! # $r->log_error("get_my_text: request: $text");
! return SERVER_ERROR;
}
# because language can be specified in a query string arg,
# we must test for the existence of the specified language
--- 2157,2180 ----
$lang ||= get_language($opts);
$opts->{language} ||= $lang;
+ unless ($lang) {
+ my $msg = qq{Subs::get_my_text: no language found};
+ $r->log_error($msg);
+ return;
+ }
my $log = $r->log;
! # $test = join (", ", map {$_ . '=' . $args->{$_} } %$args);
#$log->debug("\nget_my_text: args=$test");
+ # get user from AppWrap, or see if another app stuffed
+ # it into the browser
my $user = $r->pnotes('authed_email');
! $user ||= $r->connection->user;
!
! unless ($user) {
! my $msg = q{Subs::get_my_text: no user name found};
! $r->log_error($msg);
! return;
}
+
# because language can be specified in a query string arg,
# we must test for the existence of the specified language
***************
*** 2167,2179 ****
s/^lang_//
} keys %{ $config{column_meta}{my_text} };
#$test = join(", ", @languages);
#$log->debug("\nget_my_text: langs=$test");
unless (grep(/$lang/, @languages)) {
! $text = qq{get_my_text: language $text requested by};
$text .= qq{ $user not found: };
$text .= $r->as_string;
$r->log_error($text);
# set the language to the default
! $lang = $opts->{my_defaults}{language_default};
}
--- 2185,2205 ----
s/^lang_//
} keys %{ $config{column_meta}{my_text} };
+
#$test = join(", ", @languages);
#$log->debug("\nget_my_text: langs=$test");
+
+ unless (scalar(@languages)) {
+ my $msg = q{Subs::get_my_text(): no language fields};
+ $msg .= q{ found in table my_text.};
+ $r->log_error($msg);
+ return;
+ }
unless (grep(/$lang/, @languages)) {
! $text = qq{Subs::get_my_text: language "$lang" requested by};
$text .= qq{ $user not found: };
$text .= $r->as_string;
$r->log_error($text);
# set the language to the default
! $lang = $opts->{my_defaults}{language};
}
***************
*** 2203,2206 ****
--- 2229,2233 ----
$my_text{$tablename}{$caller}{$element} = $text;
}
+ $opts->{my_text} = \%my_text;
return \%my_text;
} # end get_my_text sub
***************
*** 3247,3260 ****
sub daily_stats {
my $opts = shift;
my $my_tables = $opts->{my_tables};
my $table = $opts->{table};
- my $my_defaults = $opts->{my_defaults};
my $r = Apache->request;
my $log = $r->log;
- # bail out if stats aren't enbled
- return unless $my_defaults->{dailystats_enabled};
-
# start is the day we began collecting stats. Should be the first
# entry in the 'sitestats' table
--- 3274,3285 ----
sub daily_stats {
my $opts = shift;
+ my $my_defaults = $opts->{my_defaults};
+
my $my_tables = $opts->{my_tables};
my $table = $opts->{table};
my $r = Apache->request;
my $log = $r->log;
# start is the day we began collecting stats. Should be the first
# entry in the 'sitestats' table
***************
*** 4467,4471 ****
my $test;
- #$log->debug("\nget_display_text: phase=$phase");
# set arguments to pass to &get_my_text. First up, a language
# this bit probably belongs in an initialization handler
--- 4492,4495 ----
***************
*** 4476,4480 ****
# get text messages for this caller
my $my_text = $opts->{my_text};
! $my_text ||= get_my_text ($opts, \%my_text_args);
$opts->{my_text} ||= $my_text;
#$log->debug("\nget_display_text: my_text=$my_text");
--- 4500,4509 ----
# get text messages for this caller
my $my_text = $opts->{my_text};
! $my_text ||= get_my_text($opts);
! unless ($my_text) {
! my $msg = q{Subs::get_txt: no data from &get_my_text};
! $r->log_error($msg);
! return;
! }
$opts->{my_text} ||= $my_text;
#$log->debug("\nget_display_text: my_text=$my_text");
***************
*** 4584,4587 ****
--- 4613,4621 ----
my $my_text = $opts->{my_text};
$my_text ||= get_my_text($opts);
+ unless ($my_text) {
+ my $msg = q{Subs::get_txt: no data from &get_my_text};
+ $r->log_error($msg);
+ return;
+ }
$opts->{my_text} = $my_text;
#$test = scalar(keys %$my_text);
|
|
From: <pla...@us...> - 2003-08-26 05:24:54
|
Update of /cvsroot/appwrap/AppWrap/Apache/AppWrap
In directory sc8-pr-cvs1:/tmp/cvs-serv20689
Modified Files:
Doorknob.pm GetPage.pm POST2GET.pm Subs.pm
Log Message:
many minor bug fixes and documentation updates. Welcome back.
Index: Doorknob.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Doorknob.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Doorknob.pm 19 Jan 2003 23:29:24 -0000 1.15
--- Doorknob.pm 25 Aug 2003 14:00:35 -0000 1.16
***************
*** 61,64 ****
--- 61,68 ----
my %opts;
+ # load my_defaults before my_tables so that we have default
+ # values when required.
+ $opts{my_defaults} = Apache::AppWrap::Subs::get_my_defaults();
+
# get the contents of table:my_tables. Its OK that %opts is
# currently empty, my_tables stores a ref in it
***************
*** 79,83 ****
$opts{my_columns} = Apache::AppWrap::Subs::get_my_columns(\%opts);
# $opts{my_exceptions}= Apache::AppWrap::Subs::get_my_exceptions();
- $opts{my_defaults} = Apache::AppWrap::Subs::get_my_defaults();
# enforce some rules for tables. These are directives
--- 83,86 ----
Index: GetPage.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/GetPage.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** GetPage.pm 10 Dec 2002 12:04:53 -0000 1.9
--- GetPage.pm 25 Aug 2003 14:00:35 -0000 1.10
***************
*** 703,707 ****
my @book;
my $chpt_guide = $args->{chpt_guide};
! if ($chpt_guide eq 'pod') {
# here get the list of PODs using Pod::Find::find_pod
my $pod_list = $args->{pod_list} || pod_list($opts);
--- 703,707 ----
my @book;
my $chpt_guide = $args->{chpt_guide};
! if ($chpt_guide && $chpt_guide eq 'pod') {
# here get the list of PODs using Pod::Find::find_pod
my $pod_list = $args->{pod_list} || pod_list($opts);
Index: POST2GET.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/POST2GET.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** POST2GET.pm 1 Dec 2002 01:08:28 -0000 1.3
--- POST2GET.pm 25 Aug 2003 14:00:35 -0000 1.4
***************
*** 29,37 ****
and put this line in the mod_perl startup file:
! use Apache::AppWrap::POST2GET;
=head1 DESCRIPTION
! Apache::AppWrap::POST2GET converts all POST parameters into GET style query string arguments. It declines to handle all non-POST requests. Afterconverting the arguments and setting the METHOD to C<POST> it then returns OK, thus passing control to the next phase in the Apache request lifecycle.
=head1 EXPORT
--- 29,37 ----
and put this line in the mod_perl startup file:
! use Apache::AppWrap::POST2GET ();
=head1 DESCRIPTION
! Apache::AppWrap::POST2GET converts all POST parameters into GET style query string arguments. It declines to handle all non-POST requests. After converting the arguments and setting the METHOD to C<POST> it then returns OK, thus passing control to the next phase in the Apache request lifecycle.
=head1 EXPORT
Index: Subs.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Subs.pm,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** Subs.pm 19 Jan 2003 23:29:24 -0000 1.37
--- Subs.pm 25 Aug 2003 14:00:35 -0000 1.38
***************
*** 1558,1565 ****
$img = $img_dir if $img_dir;
$img .= '/' . $config{images} . '/favicon.ico"';
- #$log->debug("\nWebify: img=$img");
$icon = '<link rel="shortcut icon" href="' . $img;
$icon .= ' type="' . $my_defaults->{favicontype};
! $icon .= '" />' . $HNL;
}
# print the opening html
--- 1558,1564 ----
$img = $img_dir if $img_dir;
$img .= '/' . $config{images} . '/favicon.ico"';
$icon = '<link rel="shortcut icon" href="' . $img;
$icon .= ' type="' . $my_defaults->{favicontype};
! $icon = '" title="Favorite" />' . $HNL;
}
# print the opening html
***************
*** 2061,2067 ****
###############################
sub get_my_tables {
! my $opts = shift;
! my %my_tables;
! my $ref = sqlSelectArrayRef('*', 'my_tables');
foreach my $row (@$ref) {
--- 2060,2070 ----
###############################
sub get_my_tables {
! my $opts = shift;
! my %my_tables;
! my $ref = sqlSelectArrayRef('*', 'my_tables');
! my $log = Apache->request->log;
! my $test;
! # my $test = join (", ", map {$_ . '=' . $args->{$_} } %$args);
! #$log->debug("\nget_my_tqbles: args=$test");
foreach my $row (@$ref) {
***************
*** 2069,2072 ****
--- 2072,2091 ----
$my_tables{$tablename}{$admin_name} = $admin_value;
}
+
+ ##############################
+ # here we will fudge just a bit. Want to get all text labels
+ # from table:my_text. Formerly thay have been sourced from
+ # table:my_tables. By poking the labels from my_text into the
+ # my_tables data structure, we avoid having to recode the whole
+ # AppWrap lot. This is good.
+ ##############################
+ my $my_text = $opts->{my_text};
+ $my_text ||= get_my_text($opts);
+ $opts->{my_text} = $my_text;
+ # foreach my $tablename (%$my_text) {
+ # foreach my $tablename (%$my_text) {
+ # }
+
+
# while we are here, lets store a list of all valid tables
my @valid_tables;
***************
*** 2120,2123 ****
--- 2139,2143 ----
my ($opts, $args) = @_;
my $text;
+ my $test;
# get the language for this request. Precedence is %args, then
***************
*** 2131,2140 ****
my $r = Apache->request;
my $log = $r->log;
! # my $test = join (", ", map {$_ . '=' . $args->{$_} } %$args);
#$log->debug("\nget_my_text: args=$test");
my $user = $r->pnotes('authed_email');
unless ($lang) {
$text = $r->as_string;
! $r->log_error("get_my_text: request: $text");
return SERVER_ERROR;
}
--- 2151,2160 ----
my $r = Apache->request;
my $log = $r->log;
! $test = join (", ", map {$_ . '=' . $args->{$_} } %$args);
#$log->debug("\nget_my_text: args=$test");
my $user = $r->pnotes('authed_email');
unless ($lang) {
$text = $r->as_string;
! # $r->log_error("get_my_text: request: $text");
return SERVER_ERROR;
}
***************
*** 2147,2151 ****
s/^lang_//
} keys %{ $config{column_meta}{my_text} };
! #my $test = join(", ", @lang_cols);
#$log->debug("\nget_my_text: langs=$test");
unless (grep(/$lang/, @languages)) {
--- 2167,2171 ----
s/^lang_//
} keys %{ $config{column_meta}{my_text} };
! #$test = join(", ", @languages);
#$log->debug("\nget_my_text: langs=$test");
unless (grep(/$lang/, @languages)) {
***************
*** 4458,4468 ****
$my_text ||= get_my_text ($opts, \%my_text_args);
$opts->{my_text} ||= $my_text;
! unless ($my_text && scalar(keys %$my_text)) {
! my $text = 'get_display_text: did not load row data from';
! $text .= ' table my_text';
! $r->log_error($text);
! return SERVER_ERROR;
! }
my %msgs;
--- 4478,4489 ----
$my_text ||= get_my_text ($opts, \%my_text_args);
$opts->{my_text} ||= $my_text;
+ #$log->debug("\nget_display_text: my_text=$my_text");
! # unless ($my_text && scalar(keys %$my_text)) {
! # my $text = 'get_display_text: did not load row data from';
! # $text .= ' table my_text';
! # $r->log_error($text);
! # return SERVER_ERROR;
! # }
my %msgs;
***************
*** 4513,4516 ****
--- 4534,4538 ----
my $log = Apache->request->log;
+ my $test;
# this bit probably belongs in an initialization handler
# primary importance is the requested URI. If it includes
***************
*** 4525,4532 ****
--- 4547,4557 ----
# a preferred language, consult my_tables for a language
$language ||= $opts->{my_tables}{language};
+ #$test = scalar(keys %{ $opts->{my_tables} });
+ #$log->debug("\nget_language: my_tables=$test");
# lastly, if all the above have still not yielded a language,
# use my_defaults
$language ||= $opts->{my_defaults}{language};
+ #$test = scalar(keys %{ $opts->{my_defaults} });
#$log->debug("\nget_language: language=$language");
return $language
|
|
From: <pla...@us...> - 2003-01-21 08:37:02
|
Update of /cvsroot/appwrap/AppWrap In directory sc8-pr-cvs1:/tmp/cvs-serv2744 Modified Files: MANIFEST Log Message: removed .bak file Index: MANIFEST =================================================================== RCS file: /cvsroot/appwrap/AppWrap/MANIFEST,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** MANIFEST 20 Jan 2003 09:32:19 -0000 1.14 --- MANIFEST 21 Jan 2003 08:36:54 -0000 1.15 *************** *** 35,38 **** --- 35,100 ---- Apache/t/02plugins.t Apache/t/test_module.pl + AppWrap-0.10/Apache/AW_User.pm + AppWrap-0.10/Apache/AppWrap.pm + AppWrap-0.10/Apache/AppWrap/AuthAnon.pm + AppWrap-0.10/Apache/AppWrap/AuthSession.pm + AppWrap-0.10/Apache/AppWrap/Catalyst.pm + AppWrap-0.10/Apache/AppWrap/Chart_Counts.pm + AppWrap-0.10/Apache/AppWrap/Confirm.pm + AppWrap-0.10/Apache/AppWrap/Counter.pm + AppWrap-0.10/Apache/AppWrap/DBILogConfig.pm + AppWrap-0.10/Apache/AppWrap/Doorknob.pm + AppWrap-0.10/Apache/AppWrap/Download.pm + AppWrap-0.10/Apache/AppWrap/Download_strip.pm + AppWrap-0.10/Apache/AppWrap/Favicon.pm + AppWrap-0.10/Apache/AppWrap/Focus.pm + AppWrap-0.10/Apache/AppWrap/Graph.pm + AppWrap-0.10/Apache/AppWrap/KPI.pm + AppWrap-0.10/Apache/AppWrap/LDAP_subs.pm + AppWrap-0.10/Apache/AppWrap/List.pm + AppWrap-0.10/Apache/AppWrap/My.pm + AppWrap-0.10/Apache/AppWrap/POST2GET.pm + AppWrap-0.10/Apache/AppWrap/Search.pm + AppWrap-0.10/Apache/AppWrap/Subs.pm + AppWrap-0.10/Apache/AppWrap/Verify.pm + AppWrap-0.10/Apache/MANIFEST + AppWrap-0.10/Apache/Makefile.PL + AppWrap-0.10/Apache/t/00basic.t + AppWrap-0.10/Apache/t/01core.t + AppWrap-0.10/Apache/t/test_module.pl + AppWrap-0.10/AppWrap.pm.template + AppWrap-0.10/COPYING + AppWrap-0.10/How_AppWrap_Works.pod + AppWrap-0.10/INSTALL.pod + AppWrap-0.10/MANIFEST + AppWrap-0.10/Makefile.PL + AppWrap-0.10/bin/htmlify.pl + AppWrap-0.10/conf/AppWrap.conf.template + AppWrap-0.10/create_dbuser.txt + AppWrap-0.10/demo_db.txt + AppWrap-0.10/htdocs/index.html + AppWrap-0.10/images/AppWrap_logo.gif + AppWrap-0.10/images/all.gif + AppWrap-0.10/images/calendar.gif + AppWrap-0.10/images/chart.gif + AppWrap-0.10/images/contact_pass.gif + AppWrap-0.10/images/docs_pass.gif + AppWrap-0.10/images/edit.gif + AppWrap-0.10/images/favicon.gif + AppWrap-0.10/images/favicon.ico + AppWrap-0.10/images/greynext.gif + AppWrap-0.10/images/greyprevious.gif + AppWrap-0.10/images/history.gif + AppWrap-0.10/images/misc_act.gif + AppWrap-0.10/images/misc_pass.gif + AppWrap-0.10/images/next.gif + AppWrap-0.10/images/project_id_act.gif + AppWrap-0.10/images/project_id_pass.gif + AppWrap-0.10/images/question.gif + AppWrap-0.10/images/reports_act.gif + AppWrap-0.10/images/reports_pass.gif + AppWrap-0.10/images/up.gif + AppWrap-0.10/includes/footer.include + AppWrap.pm AppWrap.pm.template COPYING *************** *** 41,45 **** INSTALL.pod MANIFEST - MANIFEST.bak Makefile.PL README --- 103,106 ---- *************** *** 48,52 **** --- 109,115 ---- bin/htmlify.pl bin/link_checker.pl + conf/AppWrap.conf conf/AppWrap.conf.template + conf/startup.pl conf/startup.pl.template create_dbuser.txt |
|
From: <pla...@us...> - 2003-01-21 08:27:22
|
Update of /cvsroot/appwrap/AppWrap/Apache/AppWrap
In directory sc8-pr-cvs1:/tmp/cvs-serv27502
Modified Files:
Audit.pm
Log Message:
detected and flagged minor bug for later repair
Index: Audit.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Audit.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Audit.pm 14 Jan 2003 08:35:22 -0000 1.8
--- Audit.pm 21 Jan 2003 08:27:18 -0000 1.9
***************
*** 78,83 ****
my @final;
! # store current record, after applying func_focus subs, in %record. There
! # should be code to flag any columns that changed.
my %converts;
my $ref;
--- 78,84 ----
my @final;
! # store current record, after applying func_focus subs,
! # in %record. There should be code to flag any columns
! # that changed.
my %converts;
my $ref;
***************
*** 119,123 ****
# this list is the rows of historical data, in descending date order
foreach my $date (sort { $b <=> $a } keys %record) {
! # func_focus subs are expecting data to be in an arg called $row->{$column};
my $row = $record{$date};
foreach my $column (@$col_order) {
--- 120,125 ----
# this list is the rows of historical data, in descending date order
foreach my $date (sort { $b <=> $a } keys %record) {
! # func_focus subs are expecting data to be in an arg
! # called $row->{$column};
my $row = $record{$date};
foreach my $column (@$col_order) {
***************
*** 219,239 ****
push @rows, $text . $HNL;
! ######## left side links (vbar phase) #########
! my $menu_func = $my_tables->{$table}{func_audit};
! $menu_func ||= $my_defaults->{func_audit};
! $menu_func ||= $my_defaults->{func_default};
! # call functions if defined. Functions return array of
! # to data wrapped in <td> tags
! if ($menu_func) {
! my @subs = split(/\s*;\s*/, $menu_func );
! foreach (@subs) {
! my $ref = eval $_;
! if ($ref && scalar(@$ref)) {
! push @{ $opts->{menuitems} }, join("", @$ref);
! }
! }
! }
!
! $opts->{Rows} = \@rows;
# comply with HEAD reques
--- 221,239 ----
push @rows, $text . $HNL;
! ######## left side links (vbar phase) #########
! my $menu_func = $my_tables->{$table}{func_audit};
! $menu_func ||= $my_defaults->{func_audit};
! $menu_func ||= $my_defaults->{func_default};
! # call functions if defined. Functions return array of
! # to data wrapped in <td> tags
! if ($menu_func) {
! my @subs = split(/\s*;\s*/, $menu_func );
! foreach (@subs) {
! my $ref = eval $_;
! if ($ref && scalar(@$ref)) {
! push @{ $opts->{menuitems} }, join("", @$ref);
! }
! }
! }
# comply with HEAD reques
***************
*** 242,245 ****
--- 242,246 ----
return OK;
}
+ $opts->{Rows} = \@rows;
Apache::AppWrap::Subs::Webify($opts);
|
|
From: <pla...@us...> - 2003-01-21 08:25:33
|
Update of /cvsroot/appwrap/AppWrap/Apache/AppWrap
In directory sc8-pr-cvs1:/tmp/cvs-serv25795
Modified Files:
Verify.pm
Log Message:
turned off debug logging
Index: Verify.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Verify.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Verify.pm 14 Jan 2003 08:35:23 -0000 1.6
--- Verify.pm 21 Jan 2003 08:25:28 -0000 1.7
***************
*** 34,38 ****
my $idnum = $opts->{args}{idnum};
! $log->debug("\nVerify: idnum=$idnum");
# store output in @rows;
--- 34,38 ----
my $idnum = $opts->{args}{idnum};
! #$log->debug("\nVerify: idnum=$idnum");
# store output in @rows;
|
|
From: <pla...@us...> - 2003-01-20 09:32:23
|
Update of /cvsroot/appwrap/AppWrap In directory sc8-pr-cvs1:/tmp/cvs-serv29071 Modified Files: MANIFEST Log Message: added add.gif and ChangeLog Index: MANIFEST =================================================================== RCS file: /cvsroot/appwrap/AppWrap/MANIFEST,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** MANIFEST 1 Dec 2002 07:53:38 -0000 1.13 --- MANIFEST 20 Jan 2003 09:32:19 -0000 1.14 *************** *** 1,3 **** - README About.pod Apache/AW_User.pm --- 1,2 ---- *************** *** 41,46 **** How_AppWrap_Works.pod INSTALL.pod ! MANIFEST This list of files Makefile.PL Webify.pod bin/AppWrap_admin.pl --- 40,47 ---- How_AppWrap_Works.pod INSTALL.pod ! MANIFEST ! MANIFEST.bak Makefile.PL + README Webify.pod bin/AppWrap_admin.pl *************** *** 53,56 **** --- 54,58 ---- htdocs/index.html images/AppWrap_logo.gif + images/add.gif images/admin_act.gif images/admin_pass.gif |
|
From: <pla...@us...> - 2003-01-20 09:15:34
|
Update of /cvsroot/appwrap/AppWrap
In directory sc8-pr-cvs1:/tmp/cvs-serv12683
Modified Files:
demo_db.txt
Log Message:
database for release 0.10
Index: demo_db.txt
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/demo_db.txt,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** demo_db.txt 10 Dec 2002 07:26:49 -0000 1.8
--- demo_db.txt 20 Jan 2003 09:15:28 -0000 1.9
***************
*** 72,75 ****
--- 72,83 ----
INSERT INTO accesses VALUES (5401,12702,'guest',200,'2002-12-09 06:45:07','/tripreports/edit','?idnum=18','Opera/6.0 (Windows 98; U) [en]');
INSERT INTO accesses VALUES (5400,10935,'guest',200,'2002-12-09 06:45:04','/tripreports/focus','?idnum=18&sb=1','Opera/6.0 (Windows 98; U) [en]');
+ INSERT INTO accesses VALUES (5459,6260,'guest',200,'2002-12-10 03:40:55','/getpage','?guide=user','Opera/6.0 (Windows 98; U) [en]');
+ INSERT INTO accesses VALUES (5460,7123,'guest',200,'2002-12-10 03:41:00','/getpage','?chpt=help_project','Opera/6.0 (Windows 98; U) [en]');
+ INSERT INTO accesses VALUES (5458,4664,'guest',200,'2002-12-10 03:40:46','/admin','','Opera/6.0 (Windows 98; U) [en]');
+ INSERT INTO accesses VALUES (5457,14288,'guest',200,'2002-12-10 03:40:43','/projectssummary','','Opera/6.0 (Windows 98; U) [en]');
+ INSERT INTO accesses VALUES (5454,409,NULL,401,'2002-12-10 03:40:21','/reports','','Opera/6.0 (Windows 98; U) [en]');
+ INSERT INTO accesses VALUES (5456,25272,'guest',200,'2002-12-10 03:40:38','/contactssummary','','Opera/6.0 (Windows 98; U) [en]');
+ INSERT INTO accesses VALUES (5455,5657,'guest',200,'2002-12-10 03:40:25','/reports','','Opera/6.0 (Windows 98; U) [en]');
[...3765 lines suppressed...]
! INSERT INTO my_text VALUES (79,'DEFAULT','DEFAULT','required_field','\'Fields marked with \' . $args->{reqd_flag} . \' require input.\'','');
! INSERT INTO my_text VALUES (76,'DEFAULT','modify','title','\'Modify input\'','');
! INSERT INTO my_text VALUES (78,'DEFAULT','modify','subtitle','\'Modify the field values as appropriate, then click <em>Verify</em>.\'','');
! INSERT INTO my_text VALUES (77,'DEFAULT','edit','subtitle','\'Modify the fields as appropriate, then click <em>Verify</em>.\'','');
! INSERT INTO my_text VALUES (80,'DEFAULT','top_menu','title','\'Related Tables\'','');
#
***************
*** 3038,3042 ****
INSERT INTO status VALUES (39,107,989249119,'smokey',1,'continue to move forward on testing',989249123);
INSERT INTO status VALUES (40,133,989168400,'',2,'Changed to test the Audit module.',989249878);
! INSERT INTO status VALUES (41,125,1032159600,'guest',1,'Testing 0.05',1032244403);
#
--- 3129,3133 ----
INSERT INTO status VALUES (39,107,989249119,'smokey',1,'continue to move forward on testing',989249123);
INSERT INTO status VALUES (40,133,989168400,'',2,'Changed to test the Audit module.',989249878);
! INSERT INTO status VALUES (41,125,1032159600,'guest',2,'Testing 0.05, modified.',1032244403);
#
|
|
From: <pla...@us...> - 2003-01-20 09:10:16
|
Update of /cvsroot/appwrap/AppWrap In directory sc8-pr-cvs1:/tmp/cvs-serv10883 Modified Files: AppWrap.pm.template Log Message: edits for release 0.10 Index: AppWrap.pm.template =================================================================== RCS file: /cvsroot/appwrap/AppWrap/AppWrap.pm.template,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AppWrap.pm.template 10 Dec 2002 10:20:56 -0000 1.3 --- AppWrap.pm.template 20 Jan 2003 09:10:12 -0000 1.4 *************** *** 14,18 **** our @EXPORT_OK = qw(%config); ! our $VERSION = '0.09'; =head1 NAME --- 14,18 ---- our @EXPORT_OK = qw(%config); ! our $VERSION = '0.10'; =head1 NAME *************** *** 227,231 **** =over 4 ! =item * All text displayed onscreen is stored in the DB, rather than hard-coded, for iternationalization. With release 0.07 this effort has begun. =item * Notification via email, SMS, IM, etc when a table or record of ointerest changes --- 227,231 ---- =over 4 ! =item * All text displayed onscreen is stored in the DB, rather than hard-coded, for iternationalization. With release 0.10 this project is almost complete, with text strings formerly hard-coded now stored in table my_text. Labels stored in other meta-data tables yet must be moved to my_text. Our goal is to allow AppWrap to be localized simply by translating the text strings stored in a single table. =item * Notification via email, SMS, IM, etc when a table or record of ointerest changes |
|
From: <pla...@us...> - 2003-01-20 09:03:10
|
Update of /cvsroot/appwrap/AppWrap/Apache
In directory sc8-pr-cvs1:/tmp/cvs-serv4986
Modified Files:
AW_User.pm
Log Message:
i18n
Index: AW_User.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AW_User.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** AW_User.pm 26 Dec 2002 01:30:08 -0000 1.9
--- AW_User.pm 20 Jan 2003 09:03:06 -0000 1.10
***************
*** 2316,2320 ****
my $log = $r->log;
my $test;
- #$log->debug("\nunpack_contact: contact_id=$contact_id");
# get info for project, shove in an array
--- 2316,2319 ----
***************
*** 2340,2343 ****
--- 2339,2343 ----
# kill warnings cause this can be quite verbose
no warnings;
+ #$log->debug("\nunpack_contact: moreopts");
if (scalar(@contact)) {
# get all the query string args
***************
*** 2356,2366 ****
}
else {
! my $out = join(" ", @contact);
! $out .= ' (' . $contact_id . ')' unless $moreopts{hide_id};
push @result, $out;
} # end IF
} # end @contact IF
} # end block
! # want all the products separated by commas. Newline converted to
# <br> in &paginator et al
my $contact_string = join(", \n", @result);
--- 2356,2368 ----
}
else {
! my $out = join(" ", @contact);
! $out .= ' (' . $contact_id . ')' unless $moreopts{hide_id};
push @result, $out;
} # end IF
} # end @contact IF
+ #my $test = join(", ", @result);
+ #$log->debug("\nunpack_contact: end moreopts, $test") if $test;
} # end block
! # want all the items separated by commas. Newline converted to
# <br> in &paginator et al
my $contact_string = join(", \n", @result);
|
|
From: <pla...@us...> - 2003-01-20 09:01:53
|
Update of /cvsroot/appwrap/AppWrap/images In directory sc8-pr-cvs1:/tmp/cvs-serv4539 Added Files: add.gif Log Message: to align img name with URI --- NEW FILE: add.gif --- (This appears to be a binary file; contents omitted.) |
|
From: <pla...@us...> - 2003-01-19 23:29:27
|
Update of /cvsroot/appwrap/AppWrap/Apache/AppWrap
In directory sc8-pr-cvs1:/tmp/cvs-serv15183
Modified Files:
Chart_Counts.pm Doorknob.pm Pager.pm Subs.pm
Log Message:
i18n
Index: Chart_Counts.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Chart_Counts.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Chart_Counts.pm 9 Dec 2002 10:05:43 -0000 1.7
--- Chart_Counts.pm 19 Jan 2003 23:29:24 -0000 1.8
***************
*** 24,120 ****
use vars qw($VERSION);
! $Apache::AppWrap::Chart_Counts::VERSION = '0.04';
############################
# 08Dec02. CSS, warnings pragma.
# 12Nov02. handle HEAD requests
############################
! sub handler {
! my $r = Apache::Request->instance( Apache->request );
! my $opts = $r->pnotes('opts');
! my $table = $opts->{table};
! my $my_tables = $opts->{my_tables};
! my $my_columns = $opts->{my_columns};
! my $my_defaults = $opts->{my_defaults};
! my $log = $r->log;
! my $test;
! my %args;
! # get the arguments
! my $date_field = $opts->{args}{date_field};
! my $where = $opts->{args}{where};
! $args{start_date} = $opts->{args}{start_date};
! $args{end_date} = $opts->{args}{end_date};
! $args{interval} = $opts->{args}{interval};
! $args{interval} ||= $my_tables->{$table}{chartcount_default_interval};
! $args{interval} ||= $my_defaults->{chartcount_default_interval};
! $args{interval} ||= 'week';
! # get the db data
! my $select;
! $date_field ? ($select = $date_field) : ($select = 'created_date');
! $select .= ' AS date_field';
! my $from = $table;
! my $ref = Apache::AppWrap::Subs::sqlSelectHashRef($select, $from, $where);
- # slotify the data by the specified period
- my $src = Apache::AppWrap::Subs::slotify($opts, $ref, \%args);
! # x axis label
! $args{x_label} = 'Date added';
! # skip label display on x axis
! # my $x_count = scalar(keys %$src);
! my $x_count = scalar(@{$src->[0]});
! $args{x_label_skip} = int($x_count / 2.5);
! #$log->debug("\n x_label_skip=$args{x_label_skip}");
! # y axis label
! $args{y_label} = 'number of adds on this date';
! # chart title
! my $label = $my_tables->{$table}{label};
! $args{chart_title} = 'Count of ' . $label . ' entries by ';
! $args{chart_title} .= $args{interval};
! # maximum value
! # $src->[0] is x labels, [1] is x values
! # $args{y_max} = $src;
! # chart title
! # $args{y_tick};
! # my ($out, @x, @y);
! # foreach my $interval (sort {$a <=> $b} keys %$src) {
! # my $date = &Date::Format::time2str("%d-%h-%y", $interval);
! # push @x, $date;
! # push @y, scalar(@{ $src->{$interval} });
! ## push @y, $counts{$int};
! # }
! # push @$out, \@x;
! # push @$out, \@y;
!
! # return $out;
! # save source data for other subs
! $opts->{source_dataset} = $src;
- # my $check = &graph( $opts, $out, \%args);
- my $check = graph( $opts, $src, \%args);
- # error unless check
- # end of former &counts_body
! my $link_vars = Apache::AppWrap::Subs::cclinks($opts);
! # $opts->{Title} = 'Calendar of ' . $link_vars->{label};
! # $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
--- 24,123 ----
use vars qw($VERSION);
! $Apache::AppWrap::Chart_Counts::VERSION = '0.05';
############################
# 08Dec02. CSS, warnings pragma.
# 12Nov02. handle HEAD requests
############################
+ sub handler {
+ my $r = Apache::Request->instance( Apache->request );
+ my $opts = $r->pnotes('opts');
+ my $table = $opts->{table};
+ my $my_tables = $opts->{my_tables};
+ my $my_columns = $opts->{my_columns};
+ my $my_defaults = $opts->{my_defaults};
+ my $log = $r->log;
+ my $test;
+ my %args;
+ # get the arguments
+ my $date_field = $opts->{args}{date_field};
+ my $where = $opts->{args}{where};
+ $args{start_date} = $opts->{args}{start_date};
+ $args{end_date} = $opts->{args}{end_date};
! $args{interval} = $opts->{args}{interval};
! $args{interval} ||= $my_tables->{$table}{chartcount_default_interval};
! $args{interval} ||= $my_defaults->{chartcount_default_interval};
! unless ($args{interval}) {
! my $msg = 'Chart_Counts::handler: directive table:my_defaults';
! $msg .= ' chartcount_default_interval" defined.';
! $r->log_error($msg);
! return SERVER_ERROR;
! }
! # get the db data. the select wants fields having
! # date-type values.
! my $select;
! $date_field ? ($select = $date_field) : ($select = 'created_date');
! $select .= ' AS date_field';
! my $from = $table;
! my $ref = Apache::AppWrap::Subs::sqlSelectHashRef($select, $from);
! # slotify orders the data by number of table records per the
! # specified period
! my $src = Apache::AppWrap::Subs::slotify($opts, $ref, \%args);
! # x axis label
! $args{element} = 'x_label';
! $args{x_label} = Apache::AppWrap::Subs::get_txt($opts, \%args);
! # skip label display on x axis
! my $x_count = scalar(@{$src->[0]});
! $args{x_label_skip} = int($x_count / 2.5);
! #$log->debug("\n x_label_skip=$args{x_label_skip}");
! # y axis label
! $args{element} = 'y_label';
! $args{y_label} = Apache::AppWrap::Subs::get_txt($opts, \%args);
! # chart title
! $args{label} = $my_tables->{$table}{label};
! $args{element} = 'title';
! $args{title} = Apache::AppWrap::Subs::get_txt($opts, \%args);
+ # maximum value
+ # $src->[0] is x labels, [1] is x values
+ # $args{y_max} = $src;
+ # chart title
+ # $args{y_tick};
! # my ($out, @x, @y);
! # foreach my $interval (sort {$a <=> $b} keys %$src) {
! # my $date = &Date::Format::time2str("%d-%h-%y", $interval);
! # push @x, $date;
! # push @y, scalar(@{ $src->{$interval} });
! ## push @y, $counts{$int};
! # }
! # push @$out, \@x;
! # push @$out, \@y;
!
! # return $out;
+ # save source data for other subs
+ $opts->{source_dataset} = $src;
! my $check = graph( $opts, $src, \%args);
! # error unless check
! # comply with HEAD request
! if ($r->header_only) {
! $r->send_http_header;
! return OK;
! }
! Apache::AppWrap::Subs::Webify($opts);
! return OK;
} # end handler
***************
*** 125,168 ****
###############################
sub graph {
! my ($opts, $data, $args) = @_;
! my $r = Apache::Request->instance( Apache->request );
! my $log = $r->log;
! # store output in @rows;
! my @rows;
! # store data and other optional info in %args;
! ##### defined chart info #####
! # x axis label
! my $x_label = $args->{x_label} || 'Date';
! # y axis label
! my $y_label = $args->{y_label} || 'Y Label';
! # chart title
! my $chart_title = $args->{chart_title} || 'Some simple Chart';
! my $graph = GD::Graph::bars->new(600, 450);
! # my $graph = GD::Graph::lines->new;
! # these get set for all tables, all charts
! $graph->set(
! x_label => $x_label,
! y_label => $y_label,
! title => $chart_title,
! );
! $graph->set(y_tick_number => $args->{y_tick_number}) if $args->{y_tick_number};
! $graph->set(x_label_skip => $args->{x_label_skip}) if $args->{x_label_skip};
! $graph->set(y_label_skip => $args->{y_label_skip}) if $args->{y_label_skip};
! $graph->set(y_max_value => $args->{y_max_value}) if $args->{y_max_value};
! # $graph->set(x_tick_length => $args->{x_tick_length}) if $args->{x_tick_length};
! # get a temporary filehandle to write the image to.
! # bug out if we don't get a graph object
! unless ($graph->plot($data)) {
! $r->warn($graph->error);
! return SERVER_ERROR;
! };
# truly lame implementation. Need to be able to hold the
! # image in memory until we print it. But cannot do that yet.
my $fh = Apache::File->new;
#$log->debug("\ngraph(): image path = $tempfile.");
--- 128,198 ----
###############################
sub graph {
! my ($opts, $data, $args) = @_;
! my $r = Apache::Request->instance( Apache->request );
! my $log = $r->log;
! # store output in @rows;
! my @rows;
! # store data and other optional info in %args;
! ##### defined chart info #####
! # x axis label
! my $x_label = $args->{x_label};
! unless ($x_label) {
! my $msg = 'Chart_Counts::Chart: caller passed no x_label value';
! $r->log_error($msg);
! return SERVER_ERROR;
! }
! # y axis label
! my $y_label = $args->{y_label};
! unless ($y_label) {
! my $msg = 'Chart_Counts::Chart: caller passed no y_label value';
! $r->log_error($msg);
! return SERVER_ERROR;
! }
! # chart title
! my $title = $args->{title};
! unless ($title) {
! my $msg = 'Chart_Counts::Chart: caller passed no title value';
! $r->log_error($msg);
! return SERVER_ERROR;
! }
! my $graph = GD::Graph::bars->new(600, 450);
! # my $graph = GD::Graph::lines->new;
! # these get set for all tables, all charts
! $graph->set(
! x_label => $x_label,
! y_label => $y_label,
! title => $title,
! );
! if ($args->{y_tick_number}) {
! $graph->set(y_tick_number => $args->{y_tick_number});
! }
! if ($args->{x_label_skip}) {
! $graph->set(x_label_skip => $args->{x_label_skip});
! }
! if ($args->{y_label_skip}) {
! $graph->set(y_label_skip => $args->{y_label_skip});
! }
! if ($args->{y_max_value}) {
! $graph->set(y_max_value => $args->{y_max_value});
! }
! if ($args->{x_tick_length}) {
! $graph->set(x_tick_length => $args->{x_tick_length});
! }
!
! # get a temporary filehandle to write the image to.
! # bug out if we don't get a graph object
! unless ($graph->plot($data)) {
! $r->log_error($graph->error);
! return SERVER_ERROR;
! };
# truly lame implementation. Need to be able to hold the
! # image in memory until we print it. But don't know how
! # to do that yet.
my $fh = Apache::File->new;
#$log->debug("\ngraph(): image path = $tempfile.");
***************
*** 176,186 ****
$fh->close;
- push @rows, '<h2>This is from Apache::AppWrap::Subs::graph</h2>';
-
my $test = scalar(@rows);
#$log->debug("\n $test rows detected.");
! ########################
! $opts->{Image} = $file;
# this works
# binmode STDOUT;
--- 206,214 ----
$fh->close;
my $test = scalar(@rows);
#$log->debug("\n $test rows detected.");
! ########################
! $opts->{Image} = $file;
# this works
# binmode STDOUT;
***************
*** 190,194 ****
# &Apache::AppWrap::Subs::Webify($opts);
! return 1;
# return \@rows;
# return OK;
--- 218,222 ----
# &Apache::AppWrap::Subs::Webify($opts);
! return 1;
# return \@rows;
# return OK;
***************
*** 202,217 ****
###############################
sub localtime_rerange {
! my $time = shift;
! my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($time);
! $sec += 1;
! $min += 1;
! $hour += 1;
! $mday += 1;
! $mon += 1;
! $year += 1900;
! $wday += 1;
! $yday += 1;
! return ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst);
}
--- 230,245 ----
###############################
sub localtime_rerange {
! my $time = shift;
! my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($time);
! $sec += 1;
! $min += 1;
! $hour += 1;
! $mday += 1;
! $mon += 1;
! $year += 1900;
! $wday += 1;
! $yday += 1;
! return ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst);
}
Index: Doorknob.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Doorknob.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** Doorknob.pm 14 Jan 2003 08:35:23 -0000 1.14
--- Doorknob.pm 19 Jan 2003 23:29:24 -0000 1.15
***************
*** 260,264 ****
$my_tables->{$table}{table_type} eq 'script';
unless ($directive) {
- # unless (exists $my_tables->{$table}{$dir}) {
my $msg = 'Doorknob: Directive my_tables->{';
$msg .= $table . '}{' . $dir . '} not defined.';
--- 260,263 ----
Index: Pager.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Pager.pm,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** Pager.pm 14 Jan 2003 08:35:23 -0000 1.19
--- Pager.pm 19 Jan 2003 23:29:24 -0000 1.20
***************
*** 728,738 ****
$args->{'caller'} = 'visualize';
! $args->{element} = 'visualize_title';
! my $visualize_title = Apache::AppWrap::Subs::get_txt($opts, $args);
!
# add a little space to make the HTML more readable
! push @rows, ' ' . $visualize_title . $HNL;
# wrap the images in a <div> tag
push @rows, ' <div class="icons">' . $HNL;
# create the links
foreach my $dv (@dv_types) {
--- 728,740 ----
$args->{'caller'} = 'visualize';
! $args->{element} = 'title';
! my $visualize = Apache::AppWrap::Subs::get_txt($opts, $args);
! my $text = '<h2>' . $visualize . '</h2>';
# add a little space to make the HTML more readable
! push @rows, ' ' . $text . $HNL;
!
# wrap the images in a <div> tag
push @rows, ' <div class="icons">' . $HNL;
+
# create the links
foreach my $dv (@dv_types) {
***************
*** 746,751 ****
--- 748,755 ----
# get ALT msg to display
+ $args->{'caller'} = $dv;
$args->{element} = $dv . '_alt';
my $alt = Apache::AppWrap::Subs::get_txt($opts, $args);
+
# get img height + width
my $height = $my_defaults->{ $dv . '_img_height'};
***************
*** 758,761 ****
--- 762,766 ----
$img .= '" width="' . $width . '" />';
# the url
+
my $link = '/' . $table . '/' . $dv;
# check for query string args
***************
*** 765,774 ****
my $atag = '<a href="' . $link . '">' . $img . '</a>';
# set up output
! push @rows, $atag;
}
# close the <div> image tag
! push @rows, $HNL;
! my $text = '</div> <!-- end of icons div -->';
! push @rows, $text . $HNL;
$text = '</div> <!-- end of visualize div -->';
push @rows, $text . $HNL;
--- 770,778 ----
my $atag = '<a href="' . $link . '">' . $img . '</a>';
# set up output
! push @rows, ' ' . $atag . $HNL;
}
# close the <div> image tag
! $text = '</div> <!-- end of icons div -->';
! push @rows, ' ' . $text . $HNL;
$text = '</div> <!-- end of visualize div -->';
push @rows, $text . $HNL;
***************
*** 808,814 ****
# $args is a hash ref so that receiving subs can modify
! # values which later subs will see. Respect 'caller'
! # value set by upstream subs.
! $args->{'caller'} ||= 'navigate';
$args->{label} = $link_vars->{label};
$args->{sb} = $sb;
--- 812,817 ----
# $args is a hash ref so that receiving subs can modify
! # values which later subs will see.
! $args->{'caller'} = 'navigate';
$args->{label} = $link_vars->{label};
$args->{sb} = $sb;
***************
*** 834,850 ****
push @rows, '<div id="navigate">' . $HNL;
! # give us a heading
! $args->{element} = 'navigate_title';
my $navigate_title = Apache::AppWrap::Subs::get_txt($opts, $args);
# add a little space to make the HTML more readable
! push @rows, ' ' . $navigate_title . $HNL if $navigate_title;
# get the sequence info. Dynamic values are embedding
! # in the 'navigate_sequence' value in my_text.
! $text = $msgs->{navigate_sequence};
! $args->{element} = 'navigate_sequence';
my $sequence = Apache::AppWrap::Subs::get_txt($opts, $args);
# add a little space to make the HTML more readable
! push @rows, ' ' . $sequence . $HNL if $sequence;
# call the sub to populate navigation icons
--- 837,855 ----
push @rows, '<div id="navigate">' . $HNL;
! # give us a heading. 'caller' set above to 'navigate'
! $args->{element} = 'title';
my $navigate_title = Apache::AppWrap::Subs::get_txt($opts, $args);
# add a little space to make the HTML more readable
! $text = '<h2>' . $navigate_title . '</h2>';
! push @rows, ' ' . $text . $HNL if $navigate_title;
# get the sequence info. Dynamic values are embedding
! # in the 'sequence' value in my_text.
! $text = $msgs->{sequence};
! $args->{element} = 'sequence';
my $sequence = Apache::AppWrap::Subs::get_txt($opts, $args);
# add a little space to make the HTML more readable
! $text = '<h3>' . $sequence . '</h3>';
! push @rows, ' ' . $text . $HNL if $sequence;
# call the sub to populate navigation icons
Index: Subs.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Subs.pm,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** Subs.pm 14 Jan 2003 08:35:23 -0000 1.36
--- Subs.pm 19 Jan 2003 23:29:24 -0000 1.37
***************
*** 1512,1528 ****
########################################################
sub Webify {
! my $opts = shift;
! my $r = Apache::Request->instance(Apache->request);
! my $my_tables = $opts->{my_tables};
! my $table = $opts->{table};
! my $my_defaults = $opts->{my_defaults};
! my $cookie = $opts->{cookie};
! my $log = $r->log;
! # store all output, in order, in @output
! my @output;
! # Initial header info
! # these lines disable caching
# $r->header_out('Pragma'=>'No-cache');
# $r->header_out('Cache-control'=>'No-cache');
--- 1512,1530 ----
########################################################
sub Webify {
! my $opts = shift;
! my $r = Apache::Request->instance(Apache->request);
! my $my_tables = $opts->{my_tables};
! my $table = $opts->{table};
! my $my_defaults = $opts->{my_defaults};
! my $cookie = $opts->{cookie};
! my $log = $r->log;
! # use this toi pass values to get_txt()
! my %args;
! # store all output, in order, in @output
! my @output;
! # Initial header info
! # these lines disable caching
# $r->header_out('Pragma'=>'No-cache');
# $r->header_out('Cache-control'=>'No-cache');
***************
*** 1531,1544 ****
#$log->debug("\nGraph: $t1");
! # set up outgoing header.
! $r->content_type('text/html');
! $r->header_out('Set-cookie' => $cookie) if $cookie;
! $r->send_http_header;
! my $default_title = $my_defaults->{title} || 'AppWrap';
! my $screen_title = $default_title;
! if ($opts->{ScreenTitle}) {
! $screen_title = $opts->{ScreenTitle} . ' - ' . $default_title;
! }
# images could come from a remote server, so check for that
--- 1533,1546 ----
#$log->debug("\nGraph: $t1");
! # set up outgoing header.
! $r->content_type('text/html');
! $r->header_out('Set-cookie' => $cookie) if $cookie;
! $r->send_http_header;
! my $default_title = $my_defaults->{title} || 'AppWrap';
! my $screen_title = $default_title;
! if ($opts->{ScreenTitle}) {
! $screen_title = $opts->{ScreenTitle} . ' - ' . $default_title;
! }
# images could come from a remote server, so check for that
***************
*** 1573,1577 ****
$header .= '" />' . $HNL;
! # link to the stylesheet
my $stylesheet = $opts->{args}{StyleSheet};
$stylesheet ||= $my_defaults->{stylesheet_name};
--- 1575,1579 ----
$header .= '" />' . $HNL;
! # link to the stylesheet
my $stylesheet = $opts->{args}{StyleSheet};
$stylesheet ||= $my_defaults->{stylesheet_name};
***************
*** 1629,1650 ****
my $logo = $my_defaults->{logo_img} || 'AppWrap_logo.gif';
my $splash = '/' . $config{images} . '/' . $logo;
! my $logo_alt = $my_defaults->{logo_alt} || $my_defaults->{title};
! my $link = ' <a href="';
$link .= $my_defaults->{homepage} . '">';
$link .= '<img src="' . $splash . '"';
$link .= ' height="' . $my_defaults->{logo_height} . '"';
$link .= ' width="' . $my_defaults->{logo_width} . '"';
! $link .= ' title="' . $logo_alt . '" /></a>';
! push @header, $link . $HNL;
push @header, '</div>' . $HNL;
! # now print the header table
! push @output, join("", @header);
! # start a table for the tabs, links and motd.
! my @ui;
! # run &tab_bar before starting the table so that we have the width
! # of all the tabs
! my $tab_bar = tab_bar($opts);
#$log->debug("\nWebify: $tab_bar");
--- 1631,1664 ----
my $logo = $my_defaults->{logo_img} || 'AppWrap_logo.gif';
my $splash = '/' . $config{images} . '/' . $logo;
!
! # get a title/ALT message for the logo
! $args{'caller'} = 'webify';
! $args{element} = 'logo_title';
! my $logo_title = get_txt($opts, \%args);
! unless ($logo_title) {
! my $msg = qq{Webify: "logo_title" does not exist};
! $msg .= ' for caller="Webify" in table:my_text.';
! $r->warn($msg);
! }
!
! my $link = '<a href="';
$link .= $my_defaults->{homepage} . '">';
$link .= '<img src="' . $splash . '"';
$link .= ' height="' . $my_defaults->{logo_height} . '"';
$link .= ' width="' . $my_defaults->{logo_width} . '"';
! $link .= ' title="' . $logo_title . '"' if $logo_title;
! $link .= ' /></a>';
! push @header, ' ' . $link . $HNL;
! # close out the logo div
push @header, '</div>' . $HNL;
! # now print the header table
! push @output, join("", @header);
! # start a table for the tabs, links and motd.
! my @ui;
! # run &tab_bar before starting the table so that we have the width
! # of all the tabs
! my $tab_bar = tab_bar($opts);
#$log->debug("\nWebify: $tab_bar");
***************
*** 1662,1679 ****
# page titles, start with header file
! # Setup the div for the vertical bar on the left side
! push @output, '<!-- Start the leftvbar div -->' . $HNL;
! push @output, '<div id="leftvbar">' . $HNL;
! # This creates the links on the left side of the screen
! if (exists($opts->{menuitems}) ) {
! push @output, join("", @{ $opts->{menuitems} });
! }
# add a link to search. Get the displayed text from table my_text
! my %args = (
! 'caller' => 'search',
! element => 'title',
! );
my $text = get_txt($opts, \%args);
my $search = '<a id="search" href="/search">';
--- 1676,1691 ----
# page titles, start with header file
! # Setup the div for the vertical bar on the left side
! push @output, '<!-- Start the leftvbar div -->' . $HNL;
! push @output, '<div id="leftvbar">' . $HNL;
! # This creates the links on the left side of the screen
! if (exists($opts->{menuitems}) ) {
! push @output, join("", @{ $opts->{menuitems} });
! }
# add a link to search. Get the displayed text from table my_text
! $args{'caller'} = 'search';
! $args{element} = 'title';
my $text = get_txt($opts, \%args);
my $search = '<a id="search" href="/search">';
***************
*** 2506,2576 ****
############################
sub top_menu {
! my $opts = shift;
! my $my_tables = $opts->{my_tables};
! my $table = $opts->{table};
! $table = $opts->{args}{top_summary} if $table eq 'summary';
!
! # title in left side
! $opts->{vbar_title} = 'Other Tables in this Family';
!
! # show family members and record count only. Start by determining
! # parent table, then get siblings, then record counts, then display.
! my $r = Apache::Request->new(Apache->request);
! my $log = $r->log;
#my $test;
#$log->debug("\ntop_menu: valid_tables=$table");
! # get parent table
! my $parent_table = $my_tables->{$table}{parent};
! # determine the key_type
! my $kt = $my_tables->{$parent_table}{key_type};
! # now get all valid tables
! my (@valid_tables, @rents);
! foreach (keys %$my_tables) {
! next unless $_;
! # skip tables under development
! next if $my_tables->{$_}{beta};
! next unless $my_tables->{$_}{key_type};
! next unless $my_tables->{$_}{parent};
! next unless $my_tables->{$_}{menu_order};
! # store a list of valid tables, which will generate no
! # 'uninitialized value' errors
! push @valid_tables, $_;
! }
! # get siblings or children
! my @ordered_sibs =
! sort { $my_tables->{$a}{menu_order} <=> $my_tables->{$b}{menu_order} }
! grep {$my_tables->{$_}{parent} eq $parent_table } @valid_tables;
! # make parent table first in the list if it is, in fact, a table
! # Now get the qty records for each table
! my %counts;
! foreach my $kid (@ordered_sibs) {
! # set up query to count number of entries for each key_type
! my $select = 'COUNT(*)';
! my $ref = sqlSelectArrayRef($select, $kid);
! $counts{$kid} = $ref->[0][0];
! } # end FOREACH
!
! my @rows; # store values temporarily
! push @rows, '<p class="topicheader">Related Tables</p>';
! foreach my $kid (@ordered_sibs) {
! next unless $kid;
! # don't display if no records
! next unless exists $counts{$kid};
! next if $my_tables->{$kid}{beta};
! # put the url in the returned array.
! my $link_vars = cclinks( $opts, (table=>$kid) );
! my $label = $link_vars->{label};
! # get the plurals count right
! $label .= sprintf " (%d record%s)", $counts{$kid}, ($counts{$kid} == 1) ? '' : "s";
! push @rows, '<p>' . $label . '</p>' . $HNL;
! }
! return \@rows;
} # end &top_menu
--- 2518,2606 ----
############################
sub top_menu {
! my $opts = shift;
! my $my_tables = $opts->{my_tables};
! my $table = $opts->{table};
! $table = $opts->{args}{top_summary} if $table eq 'summary';
! # show family members and record count only. Start by determining
! # parent table, then get siblings, then record counts, then display.
! my $r = Apache::Request->new(Apache->request);
! my $log = $r->log;
#my $test;
#$log->debug("\ntop_menu: valid_tables=$table");
! # get parent table
! my $parent_table = $my_tables->{$table}{parent};
! # determine the key_type
! my $kt = $my_tables->{$parent_table}{key_type};
! # now get all valid tables
! my (@valid_tables, @rents);
! foreach (keys %$my_tables) {
! next unless $_;
! # skip tables under development
! next if $my_tables->{$_}{beta};
! next unless $my_tables->{$_}{key_type};
! next unless $my_tables->{$_}{parent};
! next unless $my_tables->{$_}{menu_order};
! # store a list of valid tables, which will generate no
! # 'uninitialized value' errors
! push @valid_tables, $_;
! }
! # get siblings or children
! my @ordered_sibs = sort {
! $my_tables->{$a}{menu_order} <=> $my_tables->{$b}{menu_order}
! }
! grep {
! $my_tables->{$_}{parent} eq $parent_table
! } @valid_tables;
! # make parent table first in the list if it is, in fact, a table
! # Now get the qty records for each table
! my %counts;
! foreach my $kid (@ordered_sibs) {
! # set up query to count number of entries for each key_type
! my $select = 'COUNT(*)';
! my $ref = sqlSelectArrayRef($select, $kid);
! $counts{$kid} = $ref->[0][0];
! } # end FOREACH
!
! # store values temporarily
! my @rows;
! # pass values to get_txt()
! my %args;
! $args{'caller'} = 'top_menu';
! $args{element} = 'title';
! my $text = get_txt($opts, \%args);
! push @rows, qq{ <p class="topicheader">$text</p>} . $HNL;
!
! $args{element} = 'records';
! my $records = get_txt($opts, \%args);
!
! $args{element} = 'record';
! my $record = get_txt($opts, \%args);
!
! # loop through each related table and display the
! # table name and number of records
! foreach my $kid (@ordered_sibs) {
! next unless $kid;
! # don't display if no records
! next unless exists $counts{$kid};
! next if $my_tables->{$kid}{beta};
!
! # put the url in the returned array.
! my $link_vars = cclinks( $opts, (table=>$kid) );
!
! # get the plurals count right
! my $plural = ($counts{$kid} == 1) ? $record : $records;
!
! $text = '<p>' . $link_vars->{label} . ' (';
! $text .= $counts{$kid} . ' ' . $plural . ')</p>';
! push @rows, ' ' . $text . $HNL;
! }
! return \@rows;
} # end &top_menu
***************
*** 2856,2872 ****
push @hdr_links, $alink;
}
- # use this to space the links in a pretty way. Although this is a
- # blunt instrument, 'tis better than naught. If there are more
- # than 5 links, OR if motd is not enabled. Would be better to
- # measure the length of the link string, comparing that to the
- # width of the displayed tabs, rather than counting the links
- my $sp;
- if (scalar(@link_order) > 5 || $my_defaults->{enable_motd}) {
- $sp = ' ';
- }
- else {
- $sp = ' ';
- }
-
push @links, join("", @hdr_links);
} # end IF
--- 2886,2889 ----
***************
*** 2877,2884 ****
push @links, '</div>' . $HNL;
}
! # whitespace for pretty printing HTML
! push @rows, ' ' . join("", @links) . $HNL;
! push @rows, '</div>' . $HNL;
return \@rows;
} # end tab_bar
--- 2894,2904 ----
push @links, '</div>' . $HNL;
}
! # wrap anchor tags in a paragraph tag for alignment and
! # so that a full page of crumbs will wrap around (eg,
! # admin tab)
! push @rows, ' <p>' . join("", @links) . '</p>' . $HNL;
! # close the div
! push @rows, '</div> <!-- close the crumbs div -->' . $HNL;
return \@rows;
} # end tab_bar
***************
*** 4458,4477 ****
if ($tablename eq $table && $caller eq $phase) {
$value = $my_text->{$table}{$phase}{$admin};
- # my $value = $my_text->{$table}{$phase}{$admin};
}
elsif ($tablename eq 'DEFAULT' && $caller eq $phase) {
! # value same for all tables
$value = $my_text->{DEFAULT}{$phase}{$admin};
- # $value ||= $my_text->{DEFAULT}{$phase}{$admin};
}
elsif ($tablename eq $table && $caller eq 'DEFAULT') {
! # value same for all phases of this table
$value = $my_text->{$table}{DEFAULT}{$admin};
- # $value ||= $my_text->{$table}{DEFAULT}{$admin};
}
else {
! # value same for all phases of all tables (eg, ALT)
$value = $my_text->{DEFAULT}{DEFAULT}{$admin};
- # $value ||= $my_text->{DEFAULT}{DEFAULT}{$admin};
}
$msgs{$admin} = $value;
--- 4478,4493 ----
if ($tablename eq $table && $caller eq $phase) {
$value = $my_text->{$table}{$phase}{$admin};
}
elsif ($tablename eq 'DEFAULT' && $caller eq $phase) {
! # value same for all tables
$value = $my_text->{DEFAULT}{$phase}{$admin};
}
elsif ($tablename eq $table && $caller eq 'DEFAULT') {
! # value same for all phases of this table
$value = $my_text->{$table}{DEFAULT}{$admin};
}
else {
! # value same for all phases of all tables (eg, ALT)
$value = $my_text->{DEFAULT}{DEFAULT}{$admin};
}
$msgs{$admin} = $value;
|
|
From: <pla...@us...> - 2003-01-19 23:27:18
|
Update of /cvsroot/appwrap/AppWrap/includes
In directory sc8-pr-cvs1:/tmp/cvs-serv14970
Modified Files:
AppWrap.css
Log Message:
tweaks, mostly in the dataheader div
Index: AppWrap.css
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/includes/AppWrap.css,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** AppWrap.css 14 Jan 2003 08:36:44 -0000 1.8
--- AppWrap.css 19 Jan 2003 23:27:15 -0000 1.9
***************
*** 9,12 ****
--- 9,20 ----
margin: 0.5em 0.5em;
}
+ div h3 {
+ font-size: 10pt;
+ font-family: arial;
+ font-weight: normal;
+ text-align: center;
+ padding: 0.2em 0;
+ margin: 0 0 -0.2em;
+ }
div#motdarea { float: right; width: 52%; z-index: 10; }
/* "tabbar" is a class as there may be more than one of 'em */
***************
*** 32,38 ****
font-size: 11pt;
}
div#crumbs a {
margin: 0;
! padding: 0 0.6em;
color: #f93;
}
--- 40,50 ----
font-size: 11pt;
}
+ div#crumbs p {
+ margin: 0;
+ text-align: left;
+ }
div#crumbs a {
margin: 0;
! padding: 0 0.4em;
color: #f93;
}
***************
*** 146,150 ****
padding: -0.2em 0;
margin: 0.4em 0 -0.2em 0;
- /* border: 1px red solid; */
}
div.icons a {
--- 158,161 ----
***************
*** 156,167 ****
margin: 0 -0.2em;
}
- div#navigate h3 {
- font-size: 10pt;
- font-family: arial;
- font-weight: normal;
- text-align: center;
- padding: 0.2em 0;
- margin: 0 0 -0.2em;
- }
div#noteleft {
float: right;
--- 167,170 ----
***************
*** 204,208 ****
div#buttons input {
margin: 0 -0.2em;
- border: 1px red solid;
}
div#searchform {
--- 207,210 ----
|
|
From: <pla...@us...> - 2003-01-14 08:36:48
|
Update of /cvsroot/appwrap/AppWrap/includes
In directory sc8-pr-cvs1:/tmp/cvs-serv15596
Modified Files:
AppWrap.css
Log Message:
Continue to refine (and shrink) the stylesheet
Index: AppWrap.css
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/includes/AppWrap.css,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** AppWrap.css 21 Dec 2002 11:10:36 -0000 1.7
--- AppWrap.css 14 Jan 2003 08:36:44 -0000 1.8
***************
*** 1,3 ****
--- 1,6 ----
<style type="text/css">
+ img { border: none; }
+ p { text-align: center; }
+ form { display: inline; }
body {
width: auto;
***************
*** 6,14 ****
margin: 0.5em 0.5em;
}
- img {
- border: none;
- }
- div#logo {
- }
div#motdarea { float: right; width: 52%; z-index: 10; }
/* "tabbar" is a class as there may be more than one of 'em */
--- 9,12 ----
***************
*** 48,52 ****
position: absolute; top: -70px; left: -165px; width: 125px;
padding: 5px; margin: 10px; z-index: 100;
! color: #AAA; background: black;
font: 10px Verdana, sans-serif; text-align: center;
}
--- 46,50 ----
position: absolute; top: -70px; left: -165px; width: 125px;
padding: 5px; margin: 10px; z-index: 100;
! color: #aaa; background: black;
font: 10px Verdana, sans-serif; text-align: center;
}
***************
*** 84,91 ****
text-align: left;
}
! div#leftvbar a#search {
! padding: 2em 0 1em 1em;
! text-decoration: underline;
font-weight: bold;
}
div#leftvbar p {
--- 82,91 ----
text-align: left;
}
! div#leftvbar a#search {
! margin: 1em 0em;
! display: block;
font-weight: bold;
+ text-decoration: none;
+ text-decoration: underline;
}
div#leftvbar p {
***************
*** 93,98 ****
}
p#title {
- color: #000000;
- text-align: center;
font-size: 14pt;
font-weight: bold;
--- 93,96 ----
***************
*** 101,106 ****
}
p#subtitle {
- color: #000000;
- text-align: center;
font-family: Arial;
font-size: 12pt;
--- 99,102 ----
***************
*** 130,134 ****
}
div#dataheader p {
- text-align: center;
padding: 0 0 -3em 0;
}
--- 126,129 ----
***************
*** 143,150 ****
div#navigate {
float: right;
! width: 30%;
padding: 0 0 0 0;
margin: 0 0 0 0;
- /* border: 3px blue dotted; */
}
div.icons {
--- 138,144 ----
div#navigate {
float: right;
! width: 33%;
padding: 0 0 0 0;
margin: 0 0 0 0;
}
div.icons {
***************
*** 169,177 ****
padding: 0.2em 0;
margin: 0 0 -0.2em;
- /* border: 1px blue solid; */
}
- div#navigate form { display: inline; }
div#noteleft {
- /* border: 1px red dotted */;
float: right;
width: 30%;
--- 163,168 ----
***************
*** 179,183 ****
}
div#notecenter {
- /* border: 1px red dotted; */
float: right;
width: 30%;
--- 170,173 ----
***************
*** 205,215 ****
}
div#buttons {
text-align: center;
}
div#buttons form {
display: inline;
}
div#navfoot {
- color: #000000;
vertical-align: center;
text-align: center;
--- 195,225 ----
}
div#buttons {
+ clear: right;
+ margin: 0 0 0 26%;
text-align: center;
}
div#buttons form {
+ margin: 0 auto;
+ }
+ div#buttons input {
+ margin: 0 -0.2em;
+ border: 1px red solid;
+ }
+ div#searchform {
+ clear: right;
+ margin: 0 0 0 26%;
+ }
+ div#searchform form {
display: inline;
}
+ div#searchform table {
+ width: 50%;
+ margin: 0 auto;
+ }
+ div#searchform td,th {
+ border: 1px solid #aaa;
+ text-align: center;
+ }
div#navfoot {
vertical-align: center;
text-align: center;
***************
*** 222,243 ****
}
p#mailto { text-align: center; font-weight: bold; }
-
em { font-style: italic; color: green; }
! h1 { margin-top: 12pt; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; font-size: 14pt; font-family: Helvetica; color: #000000; font-weight: bold; }
h2 { font-size: 12pt; }
! h4 { font-size: 10pt; font-family: Helvetica; color: #000000; font-weight: bold; }
sup { font-size: x-small; text-decoration: underline; vertical-align: super; }
! /* debug
! table { border: 1px solid red; }
! td { border: 1px solid purple; }
! th { border: 1px solid purple; }
! */
! table { }
! th { color: #000000; background: #ddd; font-size: 11pt; font-family: serif; }
! td { color: #000000; font-family: Arial; margin-top: 0; }
ul { margin: 0pt 0pt 0.5em 0.5em }
li { margin-left: 0.5em; }
- p { color: #000000; }
.advice { font-size: 8pt; color: #24007e; background: #7e7e7e; font-family: Arial; }
p.bodyheader { text-align: center; font-weight: bold; margin-top: 12pt; margin-bottom: 3pt; margin-right: 18pt; }
--- 232,245 ----
}
p#mailto { text-align: center; font-weight: bold; }
em { font-style: italic; color: green; }
! h1 { margin-top: 12pt; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; font-size: 14pt; font-family: Helvetica; font-weight: bold; }
h2 { font-size: 12pt; }
! h4 { font-size: 10pt; font-family: Helvetica; font-weight: bold; }
sup { font-size: x-small; text-decoration: underline; vertical-align: super; }
! th { background: #ddd; font-size: 11pt; font-family: serif; }
! td { font-family: Arial; margin-top: 0; }
ul { margin: 0pt 0pt 0.5em 0.5em }
li { margin-left: 0.5em; }
.advice { font-size: 8pt; color: #24007e; background: #7e7e7e; font-family: Arial; }
p.bodyheader { text-align: center; font-weight: bold; margin-top: 12pt; margin-bottom: 3pt; margin-right: 18pt; }
***************
*** 246,250 ****
.flag { color: red; vertical-align: super; }
.formlabel { padding-right: 6pt; text-align: right; vertical-align: center; text-family: Arial; }
! .historyFlag { color: #0000ff; vertical-align: 40%; }
.history { color: #848484; }
.left { padding-right: 6pt; text-align: right; vertical-align: top; }
--- 248,252 ----
.flag { color: red; vertical-align: super; }
.formlabel { padding-right: 6pt; text-align: right; vertical-align: center; text-family: Arial; }
! .historyFlag { color: #00f; vertical-align: 40%; }
.history { color: #848484; }
.left { padding-right: 6pt; text-align: right; vertical-align: top; }
***************
*** 254,295 ****
.motd { text-align: center; }
.red { color: #fc0000; font-family: Arial; }
! .required { color: #000000; vertical-align: 40%; }
.smaller { font-size: smaller; }
.smallCenter { font-size: 8pt; text-align: center; }
.sst { color: #ff9933; font-family: Arial; }
! .subtitle { color: #000000; text-align: center; font-family: Arial; font-size: medium; }
.tiny { font-size: 8pt; font-family: Arial; line-height: 60% }
! .title { color: #000000; text-align: center; font-size: larger; font-weight: bold; margin-top: 12pt; border-bottom-width: thin; font-family: Arial; }
.topicheader { text-align: center; font-weight: bold; }
.topictext { text-align: left; }
.helpHeader1 { text-align: left; font-weight: bold; font-size: larger; }
.helpHeader2 { text-align: left; }
! .tripreportsCell { background: #ff9933; color: #000000; }
! .tripreportsText { color: #ff9933; }
! .testCell { background: #888888; color: #bbbbbb; }
! .testText { color: #888888; }
!
/* *Cell styles are used to define table cell colors and fonts */
! .doneCell { color: #000000; }
! .noneCell { color: #000000; }
! .redCell { background: #ff0000; color: #00ffff; }
! .yellowCell { background: #ffff00; color: #0000ff; }
! .greenCell { background: #00ff00; color: #ff00ff; }
!
/* *SevCell styles are used to define table cell colors and fonts */
! .doneSevCell { color: #000000; text-align: center}
! .noneSevCell { color: #000000; text-align: center}
! .redSevCell { background: #ff0000; color: #000000; text-align: center}
! .yellowSevCell { background: #ffb400; color: #000000; text-align: center}
! .greenSevCell { background: #00b400; color: #000000; text-align: center}
! .doneText { color: #000000; }
! .noneText { color: #000000; }
! .redText { color: #ff0000; }
.yellowText { color: #ffb400; }
! .greenText { color: #00ff00; }
! .doneText { color: #000000; }
! .noneText { color: #000000; }
! .redSevText { color: #00ffff; }
! .yellowSevText { color: #ffb400; }
! .greenSevText { color: #0000ff; }
! .vbar { color: #b4b4b4; background: #ffffff; font-size: 10pt; }
--- 256,295 ----
.motd { text-align: center; }
.red { color: #fc0000; font-family: Arial; }
! .required { vertical-align: 40%; }
.smaller { font-size: smaller; }
.smallCenter { font-size: 8pt; text-align: center; }
.sst { color: #ff9933; font-family: Arial; }
! .subtitle { text-align: center; font-family: Arial; font-size: medium; }
.tiny { font-size: 8pt; font-family: Arial; line-height: 60% }
! .title { text-align: center; font-size: larger; font-weight: bold; margin-top: 12pt; border-bottom-width: thin; font-family: Arial; }
.topicheader { text-align: center; font-weight: bold; }
.topictext { text-align: left; }
.helpHeader1 { text-align: left; font-weight: bold; font-size: larger; }
.helpHeader2 { text-align: left; }
! .tripreportsCell { background: #f93; }
! .tripreportsText { color: #f93; }
! .testCell { background: #888; color: #bbb; }
! .testText { color: #888; }
/* *Cell styles are used to define table cell colors and fonts */
! .doneCell { }
! .noneCell { }
! .redCell { background: #f00; color: #0ff; }
! .yellowCell { background: #ff0; color: #00f; }
! .greenCell { background: #0f0; color: #f0f; }
/* *SevCell styles are used to define table cell colors and fonts */
! .doneSevCell { text-align: center}
! .noneSevCell { text-align: center}
! .redSevCell { background: #f00; text-align: center}
! .yellowSevCell { background: #ffb400; text-align: center}
! .greenSevCell { background: #00b400; text-align: center}
! .doneText { }
! .noneText { }
! .redText { color: #f00; }
.yellowText { color: #ffb400; }
! .greenText { color: #0f0; }
! .doneText { }
! .noneText { }
! .redSevText { color: #0ff; }
! .yellowSevText { color: #ffb400; }
! .greenSevText { color: #00f; }
! .vbar { color: #b4b4b4; background: #fff; font-size: 10pt; }
|
Update of /cvsroot/appwrap/AppWrap/Apache/AppWrap
In directory sc8-pr-cvs1:/tmp/cvs-serv14863
Modified Files:
Audit.pm Calendar.pm Catalyst.pm Display.pm Doorknob.pm
Focus.pm Generate_form.pm Pager.pm Search.pm Subs.pm Verify.pm
Log Message:
extensive i18n modifications
Index: Audit.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Audit.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Audit.pm 21 Dec 2002 11:01:08 -0000 1.7
--- Audit.pm 14 Jan 2003 08:35:22 -0000 1.8
***************
*** 42,50 ****
$args{element} = 'title';
$args{label} = $link_vars->{label},
! $opts->{Title} = Apache::AppWrap::Subs::chk_txt($opts, \%args);
$args{element} = 'subtitle';
$args{idnum} = $idnum;
! $opts->{SubTitle} = Apache::AppWrap::Subs::chk_txt($opts, \%args);
# order to display columns
--- 42,50 ----
$args{element} = 'title';
$args{label} = $link_vars->{label},
! $opts->{Title} = Apache::AppWrap::Subs::get_txt($opts, \%args);
$args{element} = 'subtitle';
$args{idnum} = $idnum;
! $opts->{SubTitle} = Apache::AppWrap::Subs::get_txt($opts, \%args);
# order to display columns
Index: Calendar.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Calendar.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Calendar.pm 21 Dec 2002 11:01:48 -0000 1.9
--- Calendar.pm 14 Jan 2003 08:35:22 -0000 1.10
***************
*** 53,57 ****
$args{element} = 'title';
$args{label} = $link_vars->{label},
! $opts->{Title} = Apache::AppWrap::Subs::chk_txt($opts, \%args);
my $log = $r->log;
--- 53,57 ----
$args{element} = 'title';
$args{label} = $link_vars->{label},
! $opts->{Title} = Apache::AppWrap::Subs::get_txt($opts, \%args);
my $log = $r->log;
Index: Catalyst.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Catalyst.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Catalyst.pm 7 Dec 2002 02:09:05 -0000 1.8
--- Catalyst.pm 14 Jan 2003 08:35:22 -0000 1.9
***************
*** 39,48 ****
my $table = $opts->{table};
# fudge for tab summary reports. set table name to "top_summary" and
# query string argument to the "key_type"
! if ( $table && $table =~ s/^(.*)summary/summary/ ) {
! $opts->{args}{top_summary} = $1;
! }
my $msgs = $opts->{display_text};
--- 39,54 ----
my $table = $opts->{table};
+ #$log->debug("Catalyst: table=$table\n");
# fudge for tab summary reports. set table name to "top_summary" and
# query string argument to the "key_type"
! if ( $table =~ s/^(.*)summary/summary/ ) {
! $opts->{args}{top_summary} = $1;
! $opts->{table} = 'summary';
! }
! # think above is a mistake. Better to leave the tablename
! # sacrosanct, and pass the data needed to handle the exception
! # in $opts->{args}{topsummary} as we've done.
! # $opts->{args}{top_summary} = $1 if $table =~ s/^(.*)summary/summary/;
my $msgs = $opts->{display_text};
Index: Display.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Display.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Display.pm 30 Dec 2002 09:31:17 -0000 1.9
--- Display.pm 14 Jan 2003 08:35:22 -0000 1.10
***************
*** 14,21 ****
use Apache::AppWrap::Subs qw($dbh $HNL);
use vars qw($VERSION);
! $Apache::AppWrap::Display::VERSION = '0.05';
############################
- # 28Dec02. Fixed bug in handling of subtitle
# 16Nov02. use warnings pragma; split on optional whitespace for vbar subs.
# 13Nov02. i18n
--- 14,20 ----
use Apache::AppWrap::Subs qw($dbh $HNL);
use vars qw($VERSION);
! $Apache::AppWrap::Display::VERSION = '0.06';
############################
# 16Nov02. use warnings pragma; split on optional whitespace for vbar subs.
# 13Nov02. i18n
***************
*** 24,67 ****
############################
sub handler {
! my $r = Apache::Request->instance( Apache->request );
! my $opts = $r->pnotes('opts');
!
! my $log = $r->log;
!
! my $table = $opts->{table};
! 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 $msgs = $opts->{display_text};
! $msgs ||= Apache::AppWrap::Subs::get_display_text($opts);
! $opts->{display_text} ||= $msgs;
! $opts->{msgs} = $msgs;
! # order to display columns
! my $col_order = $opts->{col_order};
! my ($row, $type);
! my @rows;
! # valid_idnum cheat
! $opts->{valid_kv} = Apache::AppWrap::Subs::valid_kv($opts);
! my $kv = $opts->{valid_kv};
! my $kt = $my_tables->{$table}{key_type};
! # set vars for the page navigation data
! my $kv_esc = Apache::Util::escape_uri ( $kv );
! # page_url is the the part before the query string,
! $opts->{page_url} = '/' . $table . '/display?kv=' . $kv_esc . '&';
! $opts->{new_url} = '/' . $table . '/add?kv=' . $kv_esc;
! # subtitle
! my %args = (
! 'caller' => 'display',
! element => 'subtitle',
! label => $my_tables->{$table}{label},
! );
! $opts->{SubTitle} = Apache::AppWrap::Subs::chk_txt($opts, \%args);
# tell paginator about any per column function assigned in the db.
--- 23,73 ----
############################
sub handler {
! my $r = Apache::Request->instance( Apache->request );
! my $opts = $r->pnotes('opts');
! my $log = $r->log;
! my $table = $opts->{table};
! my $my_tables = $opts->{my_tables};
! my $my_columns = $opts->{my_columns};
! my $my_defaults = $opts->{my_defaults};
! # my $msgs = $opts->{display_text};
! # $msgs ||= Apache::AppWrap::Subs::get_display_text($opts);
! # $opts->{display_text} ||= $msgs;
! # $opts->{msgs} = $msgs;
! # order to display columns
! my $col_order = $opts->{col_order};
!
! my ($row, $type);
! my @rows;
! my $kv_label;
! # valid_idnum cheat
! $opts->{valid_kv} = Apache::AppWrap::Subs::valid_kv($opts);
! # use these vars to get a title. Put the $kv in the title
! # if it exists. oOtherwise let &paginator get a title.
! my $kv = $opts->{valid_kv};
! my $kt = $my_tables->{$table}{key_type};
! my $parent = $my_tables->{$table}{parent};
! my $unpacked_kt = $my_tables->{$parent}{unpacked_kt} if $parent;
! if ($unpacked_kt) {
! $kv_label = eval $unpacked_kt;
! unless ($kv_label) {
! my $msg = 'Display: unsuccessful eval of';
! $msg .= qq{"$unpacked_kt".};
! $r->log_error($msg);
! return SERVER_ERROR;
! }
! my $label = $my_tables->{$table}{label};
! $opts->{Title} = $kv_label . ' ' . $label;
! }
! # set vars for the page navigation data
! my $kv_esc = Apache::Util::escape_uri ( $kv );
! # page_url is the the part before the query string,
! $opts->{page_url} = '/' . $table . '/display?kv=' . $kv_esc . '&';
! $opts->{new_url} = '/' . $table . '/add?kv=' . $kv_esc;
# tell paginator about any per column function assigned in the db.
Index: Doorknob.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Doorknob.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** Doorknob.pm 30 Dec 2002 09:33:09 -0000 1.13
--- Doorknob.pm 14 Jan 2003 08:35:23 -0000 1.14
***************
*** 78,82 ****
$opts{my_tables} = $my_tables;
$opts{my_columns} = Apache::AppWrap::Subs::get_my_columns(\%opts);
! $opts{my_exceptions}= Apache::AppWrap::Subs::get_my_exceptions();
$opts{my_defaults} = Apache::AppWrap::Subs::get_my_defaults();
--- 78,82 ----
$opts{my_tables} = $my_tables;
$opts{my_columns} = Apache::AppWrap::Subs::get_my_columns(\%opts);
! # $opts{my_exceptions}= Apache::AppWrap::Subs::get_my_exceptions();
$opts{my_defaults} = Apache::AppWrap::Subs::get_my_defaults();
***************
*** 156,162 ****
if ($phase) {
if ($phase eq 'confirm') {
! # Do we nee to weed out incomplete and possibly subversive
! # POSTs?
! # run the &confirm sub, then redirect to $birthplace
$r->set_handlers( PerlHandler => [ \&Apache::AppWrap::Confirm::handler ]);
} # end 'Confirm'
--- 156,162 ----
if ($phase) {
if ($phase eq 'confirm') {
! # Do we nee to weed out incomplete and possibly
! # subversive POSTs? run the &confirm sub, then
! # redirect to $birthplace
$r->set_handlers( PerlHandler => [ \&Apache::AppWrap::Confirm::handler ]);
} # end 'Confirm'
Index: Focus.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Focus.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Focus.pm 30 Dec 2002 09:33:57 -0000 1.11
--- Focus.pm 14 Jan 2003 08:35:23 -0000 1.12
***************
*** 73,82 ****
$args{element} = 'title';
$args{idnum} = $idnum;
! my $title = Apache::AppWrap::Subs::chk_txt($opts, \%args);
$opts->{Title} = $title;
$args{element} = 'subtitle';
$args{label} = $link_vars->{label};
! my $subtitle = Apache::AppWrap::Subs::chk_txt($opts, \%args);
$opts->{SubTitle} = $subtitle;
--- 73,82 ----
$args{element} = 'title';
$args{idnum} = $idnum;
! my $title = Apache::AppWrap::Subs::get_txt($opts, \%args);
$opts->{Title} = $title;
$args{element} = 'subtitle';
$args{label} = $link_vars->{label};
! my $subtitle = Apache::AppWrap::Subs::get_txt($opts, \%args);
$opts->{SubTitle} = $subtitle;
***************
*** 226,231 ****
push @rows, '<table>' . $HNL;
$args{label} = $label,
! #$log->debug("\nfocus_stats2: before chk_txt.");
! my $text = Apache::AppWrap::Subs::chk_txt($opts, \%args);
push @rows, ' ' . $text . $HNL if $text;
--- 226,231 ----
push @rows, '<table>' . $HNL;
$args{label} = $label,
! #$log->debug("\nfocus_stats2: before get_txt.");
! my $text = Apache::AppWrap::Subs::get_txt($opts, \%args);
push @rows, ' ' . $text . $HNL if $text;
***************
*** 309,317 ****
if ($i > 1) {
$args{element} = 'values';
! $args{unit} = Apache::AppWrap::Subs::chk_txt($opts, \%args);
}
else {
$args{element} = 'value';
! $args{unit} = Apache::AppWrap::Subs::chk_txt($opts, \%args);
}
--- 309,317 ----
if ($i > 1) {
$args{element} = 'values';
! $args{unit} = Apache::AppWrap::Subs::get_txt($opts, \%args);
}
else {
$args{element} = 'value';
! $args{unit} = Apache::AppWrap::Subs::get_txt($opts, \%args);
}
***************
*** 325,329 ****
$args{count} = $i;
$args{label} = $my_columns->{$table}{$by}{label};
! my $text = Apache::AppWrap::Subs::chk_txt($opts, \%args);
push @rows, ' ' . $text . $HNL if $text;
}
--- 325,329 ----
$args{count} = $i;
$args{label} = $my_columns->{$table}{$by}{label};
! my $text = Apache::AppWrap::Subs::get_txt($opts, \%args);
push @rows, ' ' . $text . $HNL if $text;
}
Index: Generate_form.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Generate_form.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Generate_form.pm 10 Dec 2002 07:12:49 -0000 1.7
--- Generate_form.pm 14 Jan 2003 08:35:23 -0000 1.8
***************
*** 20,27 ****
use AppWrap qw(%config);
! use Apache::AppWrap::Subs qw($HNL);
use vars qw($VERSION);
! $Apache::AppWrap::Generate_form::VERSION = '0.06';
# 09Dec02. CSS, general code cleanup.
# 03Nov02. Missing semi-colon, apparently unimportant, replaced.
--- 20,28 ----
use AppWrap qw(%config);
! use Apache::AppWrap::Subs qw($dbh $HNL);
use vars qw($VERSION);
! $Apache::AppWrap::Generate_form::VERSION = '0.07';
! # 09Jan03. i18n.
# 09Dec02. CSS, general code cleanup.
# 03Nov02. Missing semi-colon, apparently unimportant, replaced.
***************
*** 29,112 ****
sub handler {
! my $r = Apache::Request->instance( Apache->request );
! my $opts = $r->pnotes('opts');
! my $table = $opts->{table};
! my $my_tables = $opts->{my_tables};
! my $my_columns = $opts->{my_columns};
! my $my_exceptions = $opts->{my_exceptions};
! my $my_defaults = $opts->{my_defaults};
! my $idnum = $opts->{args}{idnum};
!
! # store output in @rows;
! my (@rows, %args, $test);
! # order to display columns
! my $col_order = $opts->{col_order};
! my $log = $r->log;
!
! # determine key_type and key_value (if any)
! my $kt = $my_tables->{$table}{key_type};
! $opts->{valid_kv} = Apache::AppWrap::Subs::valid_kv($opts);
! my $kv = $opts->{valid_kv};
! #$log->debug("\nGenerate_form: $t1 params: $test");
! # set titles
! my $link_vars = Apache::AppWrap::Subs::cclinks( $opts);
! my $label = $link_vars->{label};
! my ($select, $from, $where, $ref);
! # set titles
! $opts->{Title} = $opts->{args}{Title};
! my $title = $my_exceptions->{$table}{edit}{title};
! $opts->{Title} ||= eval $title if $title;
! # subtitle
! $opts->{SubTitle} = $opts->{args}{SubTitle};
! my $subtitle = $my_exceptions->{$table}{edit}{SubTitle};
! $opts->{SubTitle} ||= eval $subtitle if $subtitle;
! if ($opts->{args}{edit_flag}) {
! # if the edit_flag is set we can get data and assign titles
! # appropriately. The id already has been validated, so we get
! # the data from the db
! $select = '*';
! $from = $table;
! $where = 'idnum=' . $idnum;
! $ref = Apache::AppWrap::Subs::sqlSelectHashRef( $select, $from, $where );
! # set titles
! # first see if another handler, probably Verify::reqd_fields, set the titles
! $opts->{Title} ||= 'Edit idnum ' . $idnum . ' of ' . $label;
! $opts->{SubTitle} ||= 'Modify the fields as appropriate, then click <em>Verify</em>.';
! }
! else {
! # here the edit_flag is not set, so this is an 'add'.
! my $title = 'Add a ';
! $title .= $kv . ' ' if $kv;
! $title .= 'record to ' . $label;
! $opts->{Title} ||= $title;
! $opts->{SubTitle} ||= 'Input the fields as appropriate, then click <em>Verify</em>.';
! }
! ######## left side links (vbar phase) #########
! # possibly these commands should appear in table:my_exceptions rather than my_tables.
! my $menu_func = $my_tables->{$table}{func_generate_form};
! $menu_func ||= $my_defaults->{func_generate_form};
! $menu_func ||= $my_defaults->{func_default};
! # call functions if defined. Functions return array of to data wrapped in <td> tags
! if ($menu_func) {
! my @subs = split(/\s*;\s*/, $menu_func );
! foreach (@subs) {
! my $ref = eval $_;
! push @{ $opts->{menuitems} }, join("", @$ref) if $ref && scalar(@$ref);
! }
! }
# start the <div>
push @rows, '<div id="pager">' . $HNL;
! # manually set the url to redirect to
! my $url = '/' . $table . '/verify';
my $start_form = ' <form method="POST" action="' . $url;
--- 30,122 ----
sub handler {
! my $r = Apache::Request->instance( Apache->request );
! my $opts = $r->pnotes('opts');
! my $table = $opts->{table};
! my $my_tables = $opts->{my_tables};
! my $my_columns = $opts->{my_columns};
! my $my_exceptions = $opts->{my_exceptions};
! my $my_defaults = $opts->{my_defaults};
! my $idnum = $opts->{args}{idnum};
! # store output in @rows;
! my (@rows, %args, $test);
! # order to display columns
! my $col_order = $opts->{col_order};
! my $log = $r->log;
! # determine key_type and key_value (if any)
! my $kt = $my_tables->{$table}{key_type};
! $opts->{valid_kv} = Apache::AppWrap::Subs::valid_kv($opts);
! my $kv = $opts->{valid_kv};
! #$log->debug("\nGenerate_form: idnum: $idnum");
! my $link_vars = Apache::AppWrap::Subs::cclinks( $opts);
! # the title or subtitle may want this.
! $args{idnum} = $idnum if $idnum;
! my ($select, $from, $where, $ref);
! if ($opts->{args}{edit_flag}) {
! # if the edit_flag is set we can get data and assign titles
! # appropriately. The id already has been validated, so we get
! # the data from the db
! my $sql = qq{SelecT * frOm $table WHERE idnum=?};
! my $sth = $dbh->prepare_cached($sql);
! my $rc = $sth->execute($idnum);
! unless ($rc) {
! my $msg = q{SQLERROR. Generate_form couldn't execute};
! $msg .= qq{"$sql"};
! $r->log_error($msg);
! return SERVER_ERROR;
! }
! # should only return a single row; we only want the first
! $ref = $sth->fetchrow_hashref();
! $sth->finish;
! }
! # titles want to see these vars defined. Needn't worry
! # about setting $args{caller}. get_txt() defaults to
! # the AppWrap phase if the caller is undefined.
! unless (exists $opts->{Title}) {
! $args{element} = 'title';
! $args{label} = $link_vars->{label},
! my $title = Apache::AppWrap::Subs::get_txt($opts, \%args);
! $opts->{Title} = $title;
! }
! # subtitle
! unless (exists $opts->{SubTitle}) {
! $args{element} = 'subtitle';
! my $subtitle = Apache::AppWrap::Subs::get_txt($opts, \%args);
! $opts->{SubTitle} = $subtitle;
! }
! ######## left side links (vbar phase) #########
! my $menu_func = $my_tables->{$table}{func_generate_form};
! $menu_func ||= $my_defaults->{func_generate_form};
! $menu_func ||= $my_defaults->{func_default};
! # call functions if defined. Functions return array of
! # to data wrapped in <td> tags
! if ($menu_func) {
! my @subs = split(/\s*;\s*/, $menu_func );
! foreach my $sub (@subs) {
! my $ref = eval $sub;
! unless ($ref) {
! my $msg = 'Generate_form: Eval error:';
! $msg .= qq{ "$sub"};
! $r->log_error($msg);
! return SERVER_ERROR;
! }
! if (scalar(@$ref)) {
! push @{ $opts->{menuitems} }, join("", @$ref);
! }
! }
! }
# start the <div>
push @rows, '<div id="pager">' . $HNL;
! # manually set the url to redirect to
! my $url = '/' . $table . '/verify';
my $start_form = ' <form method="POST" action="' . $url;
***************
*** 117,304 ****
# set the idnum and key_values param if available
if ($idnum) {
! $text = ' <input type="hidden" name="idnum" value="';
! $text .= $idnum . '" />' if $idnum;
! push @rows, $text . $HNL;
}
if ($kv && $kt && $kt ne 'idnum') {
! $text = ' <input type="hidden" name="' . $kt;
$text .= '" value="' . $kv . '" />';
! push @rows, $text . $HNL;
}
! my $birthplace = $opts->{args}{birthplace};
! $birthplace ||= $config{homeurl} . '/' . $table;
! # reset $birthplac if it has awkward URI
! $birthplace = $config{homeurl} . '/' . $table if $birthplace =~ m/verify|confirm|add|edit|modify/;
! # $birthplace = $config{homeurl} . $table if $birthplace && $birthplace =~ m/verify|confirm|add|edit/;
! $birthplace = Apache::Util::escape_uri( $birthplace ) if $birthplace;
#$log->debug("\nGenerate_form: birthplace=$birthplace");
! $text = ' <input type="hidden" name="birthplace" value="';
$text .= $birthplace . '" />';
! push @rows, $text . $HNL;
# pass this edit_flag to set whether to INSERT or UPDATE db.
if ($opts->{args}{edit_flag}) {
! $text = ' <input type="hidden" name="edit_flag" value="1" />';
! push @rows, $text . $HNL;
}
# show a ''Verify' button
! $text = ' <p align="center"><input type="submit" name=".submit"';
$text .= ' value="Verify" /></p>';
! push @rows, $text . $HNL;
! push @rows, ' <table border="1">' . $HNL;
! my ($column, $default, $val);
! # loop thru each column to display form fields and default
! # values, if any
! my @col_order = @{ $opts->{col_order} };
! { # -w off
no warnings qw(uninitialized numeric);
! # local $ = 0;
! foreach $column (@col_order) {
! # these columns are handled exceptionally, so don't
! # process them here for all tables
! next if $column eq 'idnum';
! next if $column eq 'email';
! next if $column eq 'created_date';
! # we skip some fields. Skip the key_type field if the
! # key value is set.
! next if $kv && $column eq $kt;
!
! # called subs can use this to identify fields
! $opts->{column} = $column;
!
! # if this is an edit, get the fields from the DB.
! # However, always override them with the %args hash
! my $default;
! if ($opts->{args}{$column}) {
! $default = $opts->{args}{$column};
! }
! elsif ($opts->{args}{$column} == 0 && $opts->{args}{$column} eq '0') {
! $default = $opts->{args}{$column};
! }
! else {
! $default = $ref->[0]{$column} ;
! $opts->{args}{$column} = $default;
! }
#$log->debug("\nargs: column=$column, arg=$test");
! # flag fields which are required
! my $label = Apache::AppWrap::Subs::mark_required ($opts, $column);
! # display the label and the description
! my $help = $my_columns->{$table}{$column}{help};
! my $text = eval $help if $help;
! $text ||= ' ';
! my $display = ' <tr valign="top">';
! $display .= '<th';
if (exists $link_vars->{cell_class}) {
$display .= ' class="' . $link_vars->{cell_class} . '"';
}
! $display .= '>' . $label . '</th>';
! $display .= '<td class="advice">' . $text . '</td>';
! push @rows, $display . $HNL;
!
! # Run the external function. All external functions are required
! # to return a reference to an array which contain no <td>-
! # delimited data. # case a) there is a function.
! my $func = $my_columns->{$table}{$column}{func_generate_form};
! if ($func) {
! #$log->debug("\ngenerate_form: func=$func") if $func;
! my $func_ref = eval $func;
! $val = join("", @$func_ref) if $func_ref && scalar(@$func_ref);
! $val ||= ' ';
! push @rows, ' <td>' . $val . '</td></tr>' . $HNL;
! next;
! }
! # In Perl, strings are numerically equal to zero if they are
! # not null. # case b) no function, and value of $default is
! # NOT zero (RE [\w\d]+)
! elsif ($default) {
! push @rows, ' <td>' . $default . '</td></tr>' . $HNL;
! next;
! }
! # case c) no function, and value of $default IS zero ('0')
! elsif ($default == 0 && $default eq '0') {
! # could be blank or null string
! push @rows, ' <td>0</td></tr>' . $HNL;
! next;
! }
! # case d) no function, and value of $default is blank
! else {
! push @rows, ' <td> </td></tr>' . $HNL;
! next;
! }
! } # end column treatment
! } # -w on
! # close table and show another 'Verify' button for
! # convenience on long forms
! $text = $HNL . ' </table>';
! push @rows, $text . $HNL;
! $text = ' <p>Fields marked with ' . $my_defaults->{reqd_flag};
! $text .= ' require input.</p>';
! push @rows, $text . $HNL;
! $text = ' <p align="center">';
! $text .= '<input type="submit" name=".submit" value="Verify"';
! $text .= ' /></p>' . $HNL;
! $text .= ' </form>' . $HNL;
! push @rows, $text;
!
! # close the <div>
! push @rows, '</div>' . $HNL;
!
! $opts->{Rows} = \@rows;
! Apache::AppWrap::Subs::Webify($opts);
! return OK;
! } # end handler
!
! sub get_fields { # this is from 'edit'
! my $opts = shift;
! my $table = $opts->{table};
! my $my_exceptions = $opts->{my_exceptions};
! my $my_tables = $opts->{my_tables};
! my $r = Apache::Request->instance(Apache->request);
! my $log = $r->log;
! my $test;
! my $idnum = $opts->{args}{idnum};
!
! # the id already has been validated, so we get the data from the db
! my ($select, $from, $where, $other);
! $select = '*';
! $from = $table;
! $where = 'idnum=' . $idnum;
! my $ref = Apache::AppWrap::Subs::sqlSelectHashRef( $select, $from, $where );
!
! my $col_order = $opts->{col_order};
! # since there will only be 1 row we need no loop
! foreach my $row (@$ref) {
! foreach my $column (@$col_order) {
! next if $column eq 'idnum';
! # from the query array ref, count of first element = 0. If the arg was
! # already set, meaning this is a 'Modify', then don't overwrite it. This
! # leaves the value as the user might have (re) set it.
! $opts->{args}{$column} ||= $row->{$column};
! # $opts->{args}{$column} = $row->{$column};
! }
! }
! my $link_vars = Apache::AppWrap::Subs::cclinks( $opts);
! my $label = $link_vars->{label};
! # set titles
! my $title = $my_exceptions->{$table}{edit}{title};
! $opts->{Title} = eval $title if $title;
! $opts->{Title} ||= 'Edit idnum ' . $idnum . ' of ' . $label;
- my $subtitle = $my_exceptions->{$table}{edit}{subtitle};
- $opts->{SubTitle} = eval $subtitle if $subtitle;
- $opts->{SubTitle} ||= 'Modify the fields as appropriate, then click <em>Verify</em>.'
- } # end &get_fields
--- 127,284 ----
# set the idnum and key_values param if available
if ($idnum) {
! $text = '<input type="hidden" name="idnum" value="';
! $text .= $idnum . '" />';
! push @rows, ' ' . $text . $HNL;
}
if ($kv && $kt && $kt ne 'idnum') {
! $text = '<input type="hidden" name="' . $kt;
$text .= '" value="' . $kv . '" />';
! push @rows, ' ' . $text . $HNL;
}
! my $birthplace = $opts->{args}{birthplace};
! $birthplace ||= $config{homeurl} . '/' . $table;
! # reset $birthplac if it has awkward URI
! if ($birthplace =~ m/verify|confirm|add|edit|modify/) {
! $birthplace = $config{homeurl} . '/' . $table;
! }
! if ($birthplace) {
! $birthplace = Apache::Util::escape_uri( $birthplace );
! }
#$log->debug("\nGenerate_form: birthplace=$birthplace");
! $text = '<input type="hidden" name="birthplace" value="';
$text .= $birthplace . '" />';
! push @rows, ' ' . $text . $HNL;
# pass this edit_flag to set whether to INSERT or UPDATE db.
if ($opts->{args}{edit_flag}) {
! $text = '<input type="hidden" name="edit_flag" value="1" />';
! push @rows, ' ' . $text . $HNL;
}
# show a ''Verify' button
! $text = '<p><input type="submit" name=".submit"';
$text .= ' value="Verify" /></p>';
! push @rows, ' ' . $text . $HNL;
! push @rows, ' <table>' . $HNL;
! my ($column, $default, $val);
! # loop thru each column to display form fields and default
! # values, if any
! my @col_order = @{ $opts->{col_order} };
! { # -w off
no warnings qw(uninitialized numeric);
! foreach $column (@col_order) {
! # these columns are handled exceptionally, so don't
! # process them here for all tables
! next if $column eq 'idnum';
! next if $column eq 'email';
! next if $column eq 'created_date';
! # we skip some fields. Skip the key_type field if the
! # key value is set.
! next if $kv && $column eq $kt;
!
! # called subs can use this to identify fields
! $opts->{column} = $column;
!
! # if this is an edit, get the fields from the DB.
! # However, always override them with the %args hash
! my $default;
! if ($opts->{args}{$column}) {
! $default = $opts->{args}{$column};
! }
! elsif ($opts->{args}{$column} == 0 &&
! $opts->{args}{$column} eq '0') {
! $default = $opts->{args}{$column};
! }
! else {
! $default = $ref->{$column} ;
! $opts->{args}{$column} = $default;
! }
#$log->debug("\nargs: column=$column, arg=$test");
! # flag fields which are required
! my $label = Apache::AppWrap::Subs::mark_required($opts, $column);
! # display the label and the description
! my $help = $my_columns->{$table}{$column}{help};
! my $text = eval $help if $help;
! $text ||= ' ';
! my $display = '<tr valign="top">';
! $display .= '<th';
if (exists $link_vars->{cell_class}) {
$display .= ' class="' . $link_vars->{cell_class} . '"';
}
! $display .= '>' . $label . '</th>';
! $display .= '<td class="advice">' . $text . '</td>';
! push @rows, ' ' . $display . $HNL;
+ # Run the external function. All external functions
+ # must return a reference to an array which contain
+ # no <td>-delimited data. case a) there is a function.
+ my $func = $my_columns->{$table}{$column}{func_generate_form};
+ if ($func) {
+ #$log->debug("\ngenerate_form: func=$func") if $func;
+ my $func_ref = eval $func;
+ if ($func_ref && scalar(@$func_ref)) {
+ $val = join("", @$func_ref);
+ }
+ $val ||= ' ';
+ $display = '<td>' . $val . '</td></tr>';
+ push @rows, ' ' . $display . $HNL;
+ next;
+ }
+ # In Perl, strings are numerically equal to zero if they are
+ # not null. # case b) no function, and value of $default is
+ # NOT zero (RE [\w\d]+)
+ elsif ($default) {
+ $display = '<td>' . $default . '</td></tr>';
+ push @rows, ' ' . $display . $HNL;
+ next;
+ }
+ # case c) no function, and value of $default IS zero ('0')
+ elsif ($default == 0 && $default eq '0') {
+ # could be blank or null string
+ $display = '<td>0</td></tr>';
+ push @rows, ' ' . $display . $HNL;
+ next;
+ }
+ # case d) no function, and value of $default is blank
+ else {
+ $display = '<td> </td></tr>' . $HNL;
+ push @rows, ' ' . $display . $HNL;
+ next;
+ }
+ } # end column treatment
+ } # -w on
+ # close table and show another 'Verify' button for
+ # convenience on long forms
+ $text = $HNL . ' </table>';
+ push @rows, $text . $HNL;
! # get the label to explain the "required fields" mark.
! $args{reqd_flag} = $my_defaults->{reqd_flag};
! $args{element} = 'required_field';
! $text = Apache::AppWrap::Subs::get_txt($opts, \%args);
! push @rows, ' <p>' . $text . '</p>' . $HNL;
! $text = '<p>';
! $text .= '<input type="submit" name=".submit" value="Verify"';
! $text .= ' /></p>';
! push @rows, ' ' . $text . $HNL;
! $text = '</form>';
! push @rows, ' ' . $text . $HNL;
! # close the <div>
! push @rows, '</div>' . $HNL;
!
! $opts->{Rows} = \@rows;
! Apache::AppWrap::Subs::Webify($opts);
! return OK;
! } # end handler
Index: Pager.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Pager.pm,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** Pager.pm 30 Dec 2002 09:32:11 -0000 1.18
--- Pager.pm 14 Jan 2003 08:35:23 -0000 1.19
***************
*** 23,27 ****
use Apache::Constants qw(:common);
! $Apache::AppWrap::Pager::VERSION = "0.08";
# 28Dec02. Fixed bug in alt_up handling
# 13Dec02. Replaced "alt" attributes with "title" in <img> tags
--- 23,28 ----
use Apache::Constants qw(:common);
! $Apache::AppWrap::Pager::VERSION = "0.09";
! # 06Jan03. i18n for sort order label.
# 28Dec02. Fixed bug in alt_up handling
# 13Dec02. Replaced "alt" attributes with "title" in <img> tags
***************
*** 58,61 ****
--- 59,66 ----
my $my_defaults = $opts->{my_defaults};
+ # %args shares with downstream subs data which should
+ # not be persistent between requests. $args{caller} will
+ # come from $opts->{phase}.
+ my %args;
my $kv = $opts->{valid_kv} || $opts->{args}{kv};
***************
*** 131,157 ****
$label ||= $my_columns->{$src_table}{$src_column}{label};
# use the column's sort order to drive $sb. This allows
# proper sorting URI even if the column order has gaps
# in the series. In some cases no sort_order is available,
# so increment an integer, $i.
my $order = $my_columns->{$table}{$column}{order};
$order ||= $i++;
my $sb = $order * 2 - 1;
! $sort_hash{$sb} = fill_sort($sb, $column, $label);
$sb = $order * 2;
! $sort_hash{$sb} = fill_sort($sb, $column, $label);
}
- #$test = join("\n", map {$_ . '=>' . $sort_hash{$_}{label} } sort {$a <=> $b} keys %sort_hash);
#$log->debug("\npaginator: sort_hash=\n$test.");
my $sort_by = $sort_hash{$sb}{sql};
! # %args shares with downstream subs data which should
! # not be persistent between requests. $args{caller} will
! # come from $opts->{phase}.
! my %args = (
! element => 'title',
! sort_hash => \%sort_hash,
! );
$args{kv} = $kv if $kv;
--- 136,164 ----
$label ||= $my_columns->{$src_table}{$src_column}{label};
+ # get the language text for sort order
+ $args{element} = 'ascending';
+ my %order_label;
+ $order_label{asc} = Apache::AppWrap::Subs::get_txt($opts, \%args);
+ $args{element} = 'descending';
+ $order_label{desc} = Apache::AppWrap::Subs::get_txt($opts, \%args);
+
# use the column's sort order to drive $sb. This allows
# proper sorting URI even if the column order has gaps
# in the series. In some cases no sort_order is available,
# so increment an integer, $i.
+
my $order = $my_columns->{$table}{$column}{order};
$order ||= $i++;
my $sb = $order * 2 - 1;
! $sort_hash{$sb} = fill_sort($sb, $column, $label, \%order_label);
$sb = $order * 2;
! $sort_hash{$sb} = fill_sort($sb, $column, $label, \%order_label);
}
#$log->debug("\npaginator: sort_hash=\n$test.");
my $sort_by = $sort_hash{$sb}{sql};
! $args{element} = 'title';
! $args{sort_hash} = \%sort_hash;
$args{kv} = $kv if $kv;
***************
*** 167,171 ****
unless (exists $opts->{Title}) {
$args{element} = 'title';
! my $title = Apache::AppWrap::Subs::chk_txt($opts, \%args);
$opts->{Title} = $title;
}
--- 174,178 ----
unless (exists $opts->{Title}) {
$args{element} = 'title';
! my $title = Apache::AppWrap::Subs::get_txt($opts, \%args);
$opts->{Title} = $title;
}
***************
*** 173,183 ****
# subtitles are not mandatory: some tables have none.
unless (exists $opts->{SubTitle}) {
! $args{element} = 'subtitle';
! $args{sb_label} = $sort_hash{$sb}{label};
! # save subitle for &Webify
! $opts->{SubTitle} = Apache::AppWrap::Subs::chk_txt($opts, \%args);
}
!
! #$log->debug("\npaginator: sb=$sb, $sort_hash{$sb}{column}.");
# sort the provided data according to the selected sort order
my $sort_column = $sort_hash{$sb}{column};
--- 180,191 ----
# subtitles are not mandatory: some tables have none.
unless (exists $opts->{SubTitle}) {
! $args{element} = 'subtitle';
! $args{sb_label} = $sort_hash{$sb}{label};
! # save subitle for &Webify
! $opts->{SubTitle} = Apache::AppWrap::Subs::get_txt($opts, \%args);
}
! else {
! #$log->debug("\npaginator: sb=$sb, $sort_hash{$sb}{column}, SubTitle=$opts->{SubTitle}.");
! }
# sort the provided data according to the selected sort order
my $sort_column = $sort_hash{$sb}{column};
***************
*** 599,603 ****
################################
sub fill_sort {
! my ($sb, $column, $label) = @_;
unless ($sb) {
--- 607,612 ----
################################
sub fill_sort {
! my ($sb, $column, $label, $args) = @_;
! # my ($sb, $column, $label) = @_;
unless ($sb) {
***************
*** 607,611 ****
# the next script invocation how to reverse the sort from presently.
return {
! 'label' => 'descending <em>' . $label . '</em>',
'column' => $column,
'by' => 'by ' . $column,
--- 616,620 ----
# the next script invocation how to reverse the sort from presently.
return {
! 'label' => $args->{desc} . ' <em>' . $label . '</em>',
'column' => $column,
'by' => 'by ' . $column,
***************
*** 615,619 ****
else {
return {
! 'label' => 'ascending <em>' . $label . '</em>',
'column' => $column,
'by' => 'by ' . $column,
--- 624,628 ----
else {
return {
! 'label' => $args->{asc} . ' <em>' . $label . '</em>',
'column' => $column,
'by' => 'by ' . $column,
***************
*** 720,724 ****
$args->{'caller'} = 'visualize';
$args->{element} = 'visualize_title';
! my $visualize_title = Apache::AppWrap::Subs::chk_txt($opts, $args);
# add a little space to make the HTML more readable
--- 729,733 ----
$args->{'caller'} = 'visualize';
$args->{element} = 'visualize_title';
! my $visualize_title = Apache::AppWrap::Subs::get_txt($opts, $args);
# add a little space to make the HTML more readable
***************
*** 738,742 ****
# get ALT msg to display
$args->{element} = $dv . '_alt';
! my $alt = Apache::AppWrap::Subs::chk_txt($opts, $args);
# get img height + width
my $height = $my_defaults->{ $dv . '_img_height'};
--- 747,751 ----
# get ALT msg to display
$args->{element} = $dv . '_alt';
! my $alt = Apache::AppWrap::Subs::get_txt($opts, $args);
# get img height + width
my $height = $my_defaults->{ $dv . '_img_height'};
***************
*** 827,831 ****
# give us a heading
$args->{element} = 'navigate_title';
! my $navigate_title = Apache::AppWrap::Subs::chk_txt($opts, $args);
# add a little space to make the HTML more readable
push @rows, ' ' . $navigate_title . $HNL if $navigate_title;
--- 836,840 ----
# give us a heading
$args->{element} = 'navigate_title';
! my $navigate_title = Apache::AppWrap::Subs::get_txt($opts, $args);
# add a little space to make the HTML more readable
push @rows, ' ' . $navigate_title . $HNL if $navigate_title;
***************
*** 835,839 ****
$text = $msgs->{navigate_sequence};
$args->{element} = 'navigate_sequence';
! my $sequence = Apache::AppWrap::Subs::chk_txt($opts, $args);
# add a little space to make the HTML more readable
push @rows, ' ' . $sequence . $HNL if $sequence;
--- 844,848 ----
$text = $msgs->{navigate_sequence};
$args->{element} = 'navigate_sequence';
! my $sequence = Apache::AppWrap::Subs::get_txt($opts, $args);
# add a little space to make the HTML more readable
push @rows, ' ' . $sequence . $HNL if $sequence;
***************
*** 907,910 ****
--- 916,926 ----
#$log->debug("\nnav_series: keys=$test");
+ # get the language text for sort order
+ $args->{element} = 'ascending';
+ my %order_label;
+ $order_label{asc} = Apache::AppWrap::Subs::get_txt($opts, $args);
+ $args->{element} = 'descending';
+ $order_label{desc} = Apache::AppWrap::Subs::get_txt($opts, $args);
+
# get the sort hash. This is used to map different values.
my %sort_hash;
***************
*** 918,924 ****
my $order = $my_columns->{$table}{$column}{order};
my $sb = $order * 2 - 1;
! $sort_hash{$sb} = fill_sort($sb, $column, $label);
$sb = $order * 2;
! $sort_hash{$sb} = fill_sort($sb, $column, $label);
}
}
--- 934,940 ----
my $order = $my_columns->{$table}{$column}{order};
my $sb = $order * 2 - 1;
! $sort_hash{$sb} = fill_sort($sb, $column, $label, \%order_label);
$sb = $order * 2;
! $sort_hash{$sb} = fill_sort($sb, $column, $label, \%order_label);
}
}
***************
*** 1111,1115 ****
last if (! exists $opts->{args}{idnum} && $icon eq 'edit');
$args->{element} = 'alt_' . $icon;
! my $alt = Apache::AppWrap::Subs::chk_txt($opts, $args);
my $url = $config{homeurl} . '/' . $table . '/' . $icon;
if ($icon eq 'edit') {
--- 1127,1131 ----
last if (! exists $opts->{args}{idnum} && $icon eq 'edit');
$args->{element} = 'alt_' . $icon;
! my $alt = Apache::AppWrap::Subs::get_txt($opts, $args);
my $url = $config{homeurl} . '/' . $table . '/' . $icon;
if ($icon eq 'edit') {
***************
*** 1132,1136 ****
$args->{element} = 'alt_' . $icon;
$args->{'caller'} = $opts->{phase};
! my $alt = Apache::AppWrap::Subs::chk_txt($opts, $args);
my $up_url = $config{homeurl} . '/' . $table;
# # uplink could point at the display page
--- 1148,1152 ----
$args->{element} = 'alt_' . $icon;
$args->{'caller'} = $opts->{phase};
! my $alt = Apache::AppWrap::Subs::get_txt($opts, $args);
my $up_url = $config{homeurl} . '/' . $table;
# # uplink could point at the display page
***************
*** 1157,1161 ****
if ($candidate) {
$args->{element} = 'alt_' . $icon;
! $alt = Apache::AppWrap::Subs::chk_txt($opts, $args);
$url = $config{homeurl} . '/' . $table;
$url .= '/focus' if $opts->{phase} eq 'focus';
--- 1173,1177 ----
if ($candidate) {
$args->{element} = 'alt_' . $icon;
! $alt = Apache::AppWrap::Subs::get_txt($opts, $args);
$url = $config{homeurl} . '/' . $table;
$url .= '/focus' if $opts->{phase} eq 'focus';
***************
*** 1169,1173 ****
$image = 'grey' . $icon;
$args->{element} = 'alt_no_' . $icon;
! $alt = Apache::AppWrap::Subs::chk_txt($opts, $args);
$url = '';
}
--- 1185,1189 ----
$image = 'grey' . $icon;
$args->{element} = 'alt_no_' . $icon;
! $alt = Apache::AppWrap::Subs::get_txt($opts, $args);
$url = '';
}
Index: Search.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Search.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Search.pm 30 Dec 2002 09:26:59 -0000 1.6
--- Search.pm 14 Jan 2003 08:35:23 -0000 1.7
***************
*** 20,33 ****
use vars qw($VERSION);
! $Apache::AppWrap::Search::VERSION = '0.04';
# 28Dec02. i18n
# 10Dec02. CSS, warnings pragma.
sub handler {
! my $r = Apache::Request->instance( Apache->request );
! my $opts = $r->pnotes('opts');
! my $my_tables = $opts->{my_tables};
! my $my_columns = $opts->{my_columns};
! my $my_defaults = $opts->{my_defaults};
my %args = (
--- 20,33 ----
use vars qw($VERSION);
! $Apache::AppWrap::Search::VERSION = '0.05';
# 28Dec02. i18n
# 10Dec02. CSS, warnings pragma.
sub handler {
! my $r = Apache::Request->instance( Apache->request );
! my $opts = $r->pnotes('opts');
! my $my_tables = $opts->{my_tables};
! my $my_columns = $opts->{my_columns};
! my $my_defaults = $opts->{my_defaults};
my %args = (
***************
*** 35,99 ****
);
! # store output in @rows;
! my (@rows, $results);
! # store data and other optional info in %args;
! my $log = $r->log;
! # shorthand the important args
! my $kt = $opts->{args}{key_type};
! my $kv = $opts->{args}{key_value};
! # determine and run the body content. First part is if the args are
! # both present. Neither will ever have a value of "0" (zero), so
! # this test is OK.
! if ($kt && $kv) {
! # user might click "Go" without selecting anything
! if ($kv =~ $my_defaults->{default_picklist}) {
! $r->header_out(Location => $config{homeurl} . '/search');
! return REDIRECT;
! }
! # body of search results
! my $ref = search_results($opts);
! push @rows, join("", @$ref) if $ref && scalar(@$ref);
! # get the label for this search
! my ($tables, $parent) = &table_list($opts, $kt);
! my $eval = $my_tables->{$parent}{unpacked_kt};
! # try it as a string
! my $unpacked = eval $eval;
! unless ($unpacked) {
}
- $args{'caller'} = 'search_results';
- $args{element} = 'title';
- my $text = Apache::AppWrap::Subs::chk_txt($opts, \%args);
- $opts->{Title} = $text . '<br />' . $unpacked;
- }
- else {
- # Args were not present so run the default code to display the
- # key_type popup menus
- my $rows = search_form($opts);
- push @rows, join("", @$rows) if $rows && scalar(@$rows);
- $args{element} = 'title';
- $opts->{Title} = Apache::AppWrap::Subs::chk_txt($opts, \%args);
- }
! ######## left side links (vbar phase) #########
! my $menu_func = $my_tables->{search}{phase_vbar};
! $menu_func ||= $my_defaults->{func_default};
! # call functions if defined. Functions return array of to data
! # wrapped in <td> tags
! if ($menu_func) {
! my @subs = split(/\s*;\s*/, $menu_func );
! foreach (@subs) {
! my $ref = eval $_;
! if ($ref and scalar(@$ref)) {
! push @{ $opts->{menuitems} }, join("", @$ref);
! }
! }
! }
! $opts->{Rows} = \@rows;
! Apache::AppWrap::Subs::Webify($opts);
! return OK;
} # end handler
--- 35,108 ----
);
! # store output in @rows;
! my (@rows, $results);
! # store data and other optional info in %args;
! my $log = $r->log;
! # shorthand the important args
! my $kt = $opts->{args}{key_type};
! my $kv = $opts->{args}{key_value};
! # determine and run the body content. First part is if the args are
! # both present. Neither will ever have a value of "0" (zero), so
! # this test is OK.
! if ($kt && $kv) {
! # user might click "Go" without selecting anything
! if ($kv =~ $my_defaults->{default_picklist}) {
! $r->header_out(Location => $config{homeurl} . '/search');
! return REDIRECT;
! }
! # body of search results
! my $ref = search_results($opts);
! push @rows, join("", @$ref) if $ref && scalar(@$ref);
! # get the label for this search
! my ($tables, $parent) = &table_list($opts, $kt);
! my $eval = $my_tables->{$parent}{unpacked_kt};
! unless ($eval) {
! my $msg = 'Search: no \$my_tables->{';
! $msg .= $parent . '}{unpacked_kt} defined.';
! $r->log_error($msg);
! return SERVER_ERROR;
! }
! # try it as a string
! my $unpacked = eval $eval;
! unless ($unpacked) {
! my $msg = qq{Search: unsuccessful eval of "$eval".};
! $r->log_error($msg);
! return SERVER_ERROR;
! }
! $args{'caller'} = 'search_results';
! $args{element} = 'title';
! my $text = Apache::AppWrap::Subs::get_txt($opts, \%args);
! $opts->{Title} = $text . '<br />' . $unpacked;
! }
! else {
! # Args were not present so run the default code to display the
! # key_type popup menus
! my $rows = search_form($opts);
! push @rows, join("", @$rows) if $rows && scalar(@$rows);
! $args{element} = 'title';
! $opts->{Title} = Apache::AppWrap::Subs::get_txt($opts, \%args);
}
! ######## left side links (vbar phase) #########
! my $menu_func = $my_tables->{search}{phase_vbar};
! $menu_func ||= $my_defaults->{func_default};
! # call functions if defined. Functions return array of to data
! # wrapped in <td> tags
! if ($menu_func) {
! my @subs = split(/\s*;\s*/, $menu_func );
! foreach (@subs) {
! my $ref = eval $_;
! if ($ref and scalar(@$ref)) {
! push @{ $opts->{menuitems} }, join("", @$ref);
! }
! }
! }
! $opts->{Rows} = \@rows;
! Apache::AppWrap::Subs::Webify($opts);
! return OK;
} # end handler
***************
*** 159,163 ****
#start the <div>
! push @rows, '<div id="pager">' . $HNL;
# start a table for holding this whole bit
--- 168,172 ----
#start the <div>
! push @rows, '<div id="searchform">' . $HNL;
# start a table for holding this whole bit
***************
*** 168,223 ****
$args{'caller'} = 'search';
$args{element} = 'title';
! my $label = Apache::AppWrap::Subs::chk_txt($opts, \%args);
$display = qq{<tr><th>$label</th></tr>};
! push @rows, '' . $display . $HNL;
!
! # this loop generates a popup menu and form for each key_type
! foreach my $tablename (keys %tables) {
! my $key_type = $tables{$tablename};
! $opts->{column} = 'key_value';
! my $eval_sub = $my_tables->{$tablename}{search};
! unless ($eval_sub) {
! my $msg = 'Search::search_form: no defined';
! $msg .= qq{ my_tables->{$tablename}{search} function};
! $r->log_error($msg);
! return SERVER_ERROR;
! }
! $display = eval $eval_sub;
! if ($display) {
! # the called sub wants a column defined
! # skip 'idnum's
! my $label = $my_tables->{$tablename}{label};
! my $text = ' <tr valign="top">';
! $text .= '<td align="left">' . $label;
! push @rows, $text;
!
! my $url = $config{homeurl};
! $url .= '/search';
! $text = '<form name="search" method="POST"';
! $text .= ' enctype="application/x-www-form-urlencoded"';
! $text .= ' action="' . $url . '">' . $HNL;
! push @rows, $text;
!
! $text = ' <input type="hidden" name="key_type" value="';
! $text .= $key_type . '" />' . $HNL;
! push @rows, $text;
!
! push @rows, join("", @$display) if scalar(@$display);
!
! $text = '<input type="submit" name="submit"';
! $text .= ' name="submit" value="Go" />';
! push @rows, ' ' . $text . $HNL;
! $text = ' </form>' . $HNL;
! $text .= ' </td>' . $HNL;
! $text .= ' </tr>' . $HNL;
! push @rows, $text;
! }
! } # end %key_data loop
! push @rows, ' </table>' . $HNL;
! #close the <div>
! push @rows, '</div>' . $HNL;
! return \@rows;
} # end search_form
--- 177,232 ----
$args{'caller'} = 'search';
$args{element} = 'title';
! my $label = Apache::AppWrap::Subs::get_txt($opts, \%args);
$display = qq{<tr><th>$label</th></tr>};
! push @rows, ' ' . $display . $HNL;
! # this loop generates a popup menu and form for each key_type
! foreach my $tablename (keys %tables) {
! my $key_type = $tables{$tablename};
! $opts->{column} = 'key_value';
! my $eval_sub = $my_tables->{$tablename}{search};
! unless ($eval_sub) {
! my $msg = 'Search::search_form: no defined';
! $msg .= qq{ my_tables->{$tablename}{search} function};
! $r->log_error($msg);
! return SERVER_ERROR;
! }
! $display = eval $eval_sub;
! if ($display) {
! # the called sub wants a column defined
! # skip 'idnum's
! my $label = $my_tables->{$tablename}{label};
! my $text = ' <tr>';
! $text .= '<td>' . $label;
! push @rows, $text;
!
! my $url = $config{homeurl};
! $url .= '/search';
! $text = '<form name="search" method="POST"';
! $text .= ' enctype="application/x-www-form-urlencoded"';
! $text .= ' action="' . $url . '">' . $HNL;
! push @rows, $text;
!
! $text = '<input type="hidden" name="key_type" value="';
! $text .= $key_type . '" />';
! push @rows, ' ' . $text . $HNL;
!
! push @rows, join("", @$display) if scalar(@$display);
!
! $text = '<input type="submit" name="submit"';
! $text .= ' name="submit" value="Go" />';
! push @rows, ' ' . $text . $HNL;
!
! $text = ' </form>' . $HNL;
! $text .= ' </td>' . $HNL;
! $text .= ' </tr>' . $HNL;
! push @rows, $text;
! }
! } # end %key_data loop
! push @rows, ' </table>' . $HNL;
! #close the <div>
! push @rows, '</div>' . $HNL;
! return \@rows;
} # end search_form
***************
*** 229,240 ****
#######################################################################
sub search_results {
! my $opts = shift;
! my $my_tables = $opts->{my_tables};
! my $my_columns = $opts->{my_columns};
! my $my_defaults = $opts->{my_defaults};
! my $valid_tables = $opts->{valid_tables};
! my $r = Apache->request;
! my $log = $r->log;
! my (@rows, $text, $sth);
my $kt = $opts->{args}{key_type};
--- 238,249 ----
#######################################################################
sub search_results {
! my $opts = shift;
! my $my_tables = $opts->{my_tables};
! my $my_columns = $opts->{my_columns};
! my $my_defaults = $opts->{my_defaults};
! my $valid_tables = $opts->{valid_tables};
! my $r = Apache->request;
! my $log = $r->log;
! my (@rows, $text, $sth);
my $kt = $opts->{args}{key_type};
***************
*** 280,284 ****
#start the <div>
! push @rows, '<div id="pager">' . $HNL;
# build tabular output
--- 289,293 ----
#start the <div>
! push @rows, '<div id="searchform">' . $HNL;
# build tabular output
***************
*** 286,295 ****
push @rows, ' <tr>' . $HNL;
! # get the label for the results table columns
my %args = (
'caller' => 'DEFAULT',
element => 'table',
);
! my $label = Apache::AppWrap::Subs::chk_txt($opts, \%args);
$text = '<th>';
$text .= ucfirst($label);
--- 295,306 ----
push @rows, ' <tr>' . $HNL;
! # get labels for the column headings. First column
! # holkds the name of the table have the the requested
! # search parameter.
my %args = (
'caller' => 'DEFAULT',
element => 'table',
);
! my $label = Apache::AppWrap::Subs::get_txt($opts, \%args);
$text = '<th>';
$text .= ucfirst($label);
***************
*** 297,304 ****
#$log->debug("\nsearch_results: label=$label, text=$text");
! # get the label for other column
$args{'caller'} = 'search_results';
$args{element} = 'subtitle';
! $label = Apache::AppWrap::Subs::chk_txt($opts, \%args);
$text .= qq{<th>$label</th></tr>};
push @rows, ' ' . $text . $HNL;
--- 308,316 ----
#$log->debug("\nsearch_results: label=$label, text=$text");
! # Second column contains links to the specific record
! # having the requested search parameter.
$args{'caller'} = 'search_results';
$args{element} = 'subtitle';
! $label = Apache::AppWrap::Subs::get_txt($opts, \%args);
$text .= qq{<th>$label</th></tr>};
push @rows, ' ' . $text . $HNL;
***************
*** 321,329 ****
push @rows, ' ' . $text . $HNL;
foreach my $row (@$results) {
my $tablename = $row->{tablename};
my $idnum = $row->{idnum};
! # the sub to eval requires this
$opts->{column} = 'idnum';
$text = ' <tr>';
--- 333,343 ----
push @rows, ' ' . $text . $HNL;
+ my $temp_table = $opts->{table};
foreach my $row (@$results) {
my $tablename = $row->{tablename};
my $idnum = $row->{idnum};
! # the sub to eval requires these
$opts->{column} = 'idnum';
+ $opts->{table} = $tablename;
$text = ' <tr>';
***************
*** 353,359 ****
# $focus is the link to an individual record
my $focus = $config{homeurl} . '/' . $tablename;
! $text = ' <td>' . $name;
! $text .= '</td>';
! push @rows, $text . $HNL;
$text = ' </tr>';
push @rows, $text . $HNL;
--- 367,372 ----
# $focus is the link to an individual record
my $focus = $config{homeurl} . '/' . $tablename;
! $text = '<td>' . $name . '</td>';
! push @rows, ' ' . $text . $HNL;
$text = ' </tr>';
push @rows, $text . $HNL;
***************
*** 361,364 ****
--- 374,380 ----
$text = ' </table>';
push @rows, $text . $HNL;
+
+ # restore the tablename
+ $opts->{table} = $temp_table;
#close the <div>
Index: Subs.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Subs.pm,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** Subs.pm 30 Dec 2002 09:40:17 -0000 1.35
--- Subs.pm 14 Jan 2003 08:35:23 -0000 1.36
***************
*** 564,581 ****
############################
sub make_download_links {
! my $opts = shift;
! my $log = Apache->request->log;
! my $table = $opts->{table};
! my $my_tables = $opts->{my_tables};
! my $my_columns = $opts->{my_columns};
! my $idnum;
! my $kt = $my_tables->{$table}{key_type};
[...1254 lines suppressed...]
return $out;
! } # end chk_txt
sub specific_msg {
my ($my_text, $table, $phase, $element) = @_;
--- 4581,4593 ----
}
return $out;
! } # end get_txt
+ ################################
+ # this is simply a way to isolate this really messy stretch.
+ # This looks for the specified table and caller in the my_text
+ # data. If not found, each defaults to a value of 'DEFAULT
+ # and looks for that.
+ ################################
sub specific_msg {
my ($my_text, $table, $phase, $element) = @_;
Index: Verify.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Verify.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Verify.pm 10 Dec 2002 07:11:40 -0000 1.5
--- Verify.pm 14 Jan 2003 08:35:23 -0000 1.6
***************
*** 19,165 ****
use vars qw($VERSION);
! $Apache::AppWrap::Verify::VERSION = '0.03';
sub handler {
! my $r = Apache::Request->instance( Apache->request );
! my $opts = $r->pnotes('opts');
! my $table = $opts->{table};
! my $my_tables = $opts->{my_tables};
! my $my_columns = $opts->{my_columns};
! my $my_exceptions = $opts->{my_exceptions};
! my $my_defaults = $opts->{my_defaults};
! my $idnum = $opts->{args}{idnum};
! # store output in @rows;
! my @rows;
! # store data and other optional info in %args;
! my %args;
! # order to display columns
! my $col_order = $opts->{col_order};
! my $log = $r->log;
! my ($column, $ref);
! # if we got here all reqd fields were input
!
! # for title and link information
! my $link_vars = Apache::AppWrap::Subs::cclinks( $opts);
! ######## left side links (vbar phase) #########
! my $menu_func = $my_tables->{$table}{func_verify};
! $menu_func ||= $my_defaults->{func_verify};
! $menu_func ||= $my_defaults->{func_default};
! # call functions if defined. Functions return array of to
! # data wrapped in <td> tags
! if ($menu_func) {
! foreach ( split(/\s*;\s*/, $menu_func ) ) {
! my $ref = eval $_;
! if ($ref && scalar(@$ref)) {
! push @{ $opts->{menuitems} }, join("", @$ref);
}
! }
! }
! my $url = '/' . $table . '/';
! my %temp;
! ############ button creating loop ##############
! # not elegant code, but we want 2 separate forms: one for
! # the confirm button, with it's associated URL, and one
! # for the Modify button and it's URL
! my $out = ' <div id="buttons">' . $HNL;
push @rows, $out;
foreach my $button (qw/confirm modify/) {
# start the form
! $out .= ' <form method="POST" action="' . $url . $button;
$out .= '" enctype="application/x-www-form-urlencoded">';
! $out .= ' <input type="submit" name=".submit" value="';
$out .= ucfirst($button) . '">';
! push @rows, $out;
!
my $birthplace = $opts->{args}{birthplace};
! $out = ' <input type="hidden" name="birthplace" value="';
$out .= $birthplace . '" />';
!
#$log->debug("\nVerify: birthplace=$birthplace");
push @rows, $out;
# catch the idnum if present
! if ( $idnum ) {
! my $text = ' <input type="hidden" name="idnum" value="';
$text .= $idnum . '" />';
! push @rows, $text;
}
!
! # catch the 'edit_flag' flag which may have been set by
! # &generate_form
! if ( $opts->{args}{edit_flag} ) {
! my $text = ' <input type="hidden" name="edit_flag"';
! $text .= ' value="1" />';
! push @rows, $text;
! }
! # what would it take to delete use of %temp in this bit?
! # also, if we store the hidden fields in the table we can
! # eliminate one loop
! foreach $column (@$col_order) {
! # skip these columns for &verify
! next if $column eq 'idnum' || $column eq 'email' || $column eq 'created_date';
! $temp{$column} = $opts->{args}{$column};
!
! # unrequired fields with a picklist might retain the
! # default value, so delete it.
! if (exists $temp{$column}) {
! if ($temp{$column} =~ $my_defaults->{default_picklist}) {
! $temp{$column} = '';
! }
}
!
! # try to catch a zero value
! { # -w off
! no warnings qw(numeric uninitialized);
! # non-zero numbers and text
! #$log->debug("\nVerify: col=$column, val=$temp{$column}");
! if ($temp{$column}) {
! my $out = ' <input type="hidden" name="' . $column;
! $out .= '" value="' . Apache::Util::escape_uri($temp{$column});
! $out .= '" />';
! push @rows, $out;
! }
! # zero values
! elsif ($temp{$column} == 0 && $temp{$column} eq '0') {
! my $out = ' <input type="hidden" name="' . $column;
! $out .= '" value="0" />';
! push @rows, $out;
! }
! # blanks
! else {
! my $out = ' <input type="hidden" name="' . $column;
! $out .= '" value="" />';
! push @rows, $out;
! }
! } # -w off
! } # end of FOREACH of hidden fields
! push @rows, ' </form>';
! } # this ends the button creating loop
########################################
# close out the <div id="buttons> tag
! push @rows, ' </div>' . $HNL;
# start the div for proper display
push @rows, '<div id="pager">' . $HNL;
- push @rows, ' <table width="100%" border="1" cellpadding="7">' . $HNL;
! { # -w off
! no warnings qw(numeric uninitialized);
! # startloop to display field values
! foreach $column (@$col_order) { # add column labels
! # set the column to be used by called subs
! $opts->{column} = $column;
! # skip 'idnum', 'email' and 'created_date' because user
! # is not allowed to influence these
! next if $column eq 'idnum' || $column eq 'email' || $column ...
[truncated message content] |
|
From: <pla...@us...> - 2002-12-30 09:40:21
|
Update of /cvsroot/appwrap/AppWrap/Apache/AppWrap
In directory sc8-pr-cvs1:/tmp/cvs-serv15957
Modified Files:
Subs.pm
Log Message:
MOdified several subroutines for i18n
Index: Subs.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Subs.pm,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** Subs.pm 26 Dec 2002 01:34:50 -0000 1.34
--- Subs.pm 30 Dec 2002 09:40:17 -0000 1.35
***************
*** 331,459 ****
}
} # -w on
! }
!
!
! ##############################################################
! # my $ref = &focus_stats2(\%opts)
! # A list of all unique entries of the selected control, and a count of
! # ids for that control value.
! # 28 Dec 01. Removed CGI dependency.
! # 10 Jun 01. Fixed logic to handle varied input including dates, and
! # utilize my_columns func_focus subroutine.
! # 09 Jun 01. Squashed bug - extra space between query string args.
! ##############################################################
! #sub focus_stats2 {
! # my $opts = shift;
! # my $by = $opts->{args}{by};
! # my $table = $opts->{table};
! # my @rows;
! # my ($select, $from, $where, $other);
! # my $my_columns = $opts->{my_columns};
! # my ($result);
! # my $log = Apache->request->log;
! #
! # # list distict db entries for this control except if control =
! # # (idnum|date). We make these 2 exceptions because an itemized list
! # # of them would not be meaningful. Naming convention for date fields
! # # in the db is 'date' or ends with '_date'
! # if ( $by ne 'idnum' && $by ne 'date' && $by !~ /_date$/) {
! #
! # # get the column name.
! # my $column = $by;
! # # make a header row
! # my $label = $my_columns->{$table}{$column}{label};
! # push @rows, '<table>' . $HNL;
! # my $text = ' <tr><th>' . $label;
! # $text .= '</th><th>Count</th></tr>';
! # push @rows, $text . $HNL;
! #
! # my $sql = qq{SeLecT disTInct($by),MAX(idnum),COUNT($by)};
! # $sql .= qq{ FROM $table GROUP BY $by};
! # my $sth = $dbh->prepare_cached($sql);
! # my $rc = $sth-execute();
! #
! # # make a link (idnum & $by) for each distinct db entry
! # while (my $row = $sth->fetchrow_hashref) {
! ## foreach my $row (@$ref) {
! # # Handle the varied column inputs by processing with the
! # # func_focus subroutine in my_columns. This is a bit ugly now so
! # # needs work. But it functions correctly.
! # my ($ary, $val);
! # # get the func_focus sub
! # my $func_focus;
! # if ($my_columns->{$table}{$column}{func_focus}) {
! # $func_focus = $my_columns->{$table}{$column}{func_focus};
! # }
! # # if it exists, run it. if not, use the input value directly
! # if ($func_focus) {
! # $ary = eval $func_focus;
! # if ($ary && scalar(@$ary)) {
! # $val = join("", @$ary);
! # }
! # }
! # else {
! # $val = $row->{$column};
! # }
! # # could be some newlines in the data, so delete them
! # $val =~ s/\n/<br \/>/g if $val;
! # $result = html_blank ($val);
! # # this hash element key is a messy string with the column embedded.
! # my $count = 'COUNT(' . $by . ')';
! # # now fromat the html output
! # my $stat = ' <tr><td class="first"><a href="/' . $table;
! # $stat .= '/focus?idnum=' . $row->{'MAX(idnum)'} . '&by=';
! # $stat .= $by . '">' . $result . '</a></td><td>';
! # $stat .= $row->{$count} . '</td></tr>' . $HNL;
! # push @rows, $stat;
! # }
! # push @rows, '</table>' . $HNL;
! # }
! # return \@rows;
! #} # end &focus_stats2
!
!
! ##############################################################
! # my $ref = &focus_stats1(\%opts)
! # Summarize the data in the app's db
! # 03Dec02. Removed table cruft, replaced with CSS
! # 13Jan 02. Simplified logic.
! # 11 Aug 01. Modified for color coded links
! # 10 Jun 01. Fixed logic to utilize my_columns func_focus subroutine.
! ##############################################################
! #sub focus_stats1 {
! # my $opts = shift;
! # my $table = $opts->{table};
! # my $my_tables = $opts->{my_tables};
! # my $my_columns = $opts->{my_columns};
! # my (@rows, @fields);
! #
! # ### color coded links
! # my $link_vars = cclinks($opts);
! # my $label = $link_vars->{label};
! #
! # # push the header
! # # get count of distinct entries in each sortable field
! # foreach my $by (@{ $opts->{col_order} }) {
! # next unless $my_columns->{$table}{$by}{page_sort};
! # my $sql = qq{SeLecT DisTInct($by) From $table};
! # my $sth = $dbh->prepare_cached($sql);
! # my $rc = $sth->execute;
! # my $i = $sth->rows;
! # $sth->finish;
! # if ($by eq 'idnum') {
! # my $text = ' <p class="bodyheader">' . $label;
! # $text .= ' records.</p>' . $HNL;
! # push @rows, $text;
! # next;
! # }
! # my $unit = ' value';
! # $i > 1 ? $unit .= 's</p>' : $unit .= '</p>';
! # my $label = $my_columns->{$table}{$by}{label};
! # push @rows, ' <p>' . $i . ' unique ';
! # push @rows, $label . $unit . $HNL;
! # }
! # ###
! # return \@rows;
! #} # end &focus_stats1
--- 331,335 ----
}
} # -w on
! } # end html_blank
***************
*** 639,648 ****
$sth->execute;
return $sth->fetchall_arrayref;
- # my $ref = $dbh->selectall_arrayref($sql);
# if I remove this I get 'Database handle destroyed...' errors in the
# log
# &Apache::AppWrap::Subs::db_disconnect();
- # return $ref;
} # end &sqlSelectArrayRef
--- 515,522 ----
***************
*** 662,666 ****
$sql .= ' ' . $other if $other;
- # my $sth = $dbh->prepare($sql);
my $sth;
# cache standard, frequently-used queries. Jumble case
--- 536,539 ----
***************
*** 675,683 ****
$sth->execute;
! my $rows;
! while (my $row = $sth->fetchrow_hashref) {
! push @$rows, { %$row };
! }
! return $rows;
} # end &sqlSelectHashRef
--- 548,556 ----
$sth->execute;
! my $rows;
! while (my $row = $sth->fetchrow_hashref) {
! push @$rows, { %$row };
! }
! return $rows;
} # end &sqlSelectHashRef
***************
*** 705,709 ****
my $label = $link_vars->{label};
my (@rows,$link);
! push @rows, '<p class="topicheader">Download</p>' . $HNL;
# push @rows, '<p class="topicheader">Download</p>' . $HNL;
--- 578,589 ----
my $label = $link_vars->{label};
my (@rows,$link);
! my $text = '<p class="topicheader">';
! my %args = (
! 'caller' => 'download',
! element => 'title',
! );
! $text .= chk_txt($opts, \%args);
! $text .= '</p>';
! push @rows, ' ' . $text . $HNL;
# push @rows, '<p class="topicheader">Download</p>' . $HNL;
***************
*** 1649,1669 ****
}
! # images could come from a remote server, so check for that
! my $img_dir = $config{imageurl};
! # The icon is a 16x16 image that appears in the URL location window.
! # No default so as to avoid 'file not found' messages if it doesn't
! # exist.
! my $iconfile = $my_defaults->{favicon};
! my $icontype = $my_defaults->{favicontype} || 'image/x-icon';
! # works for mozilla
! my $icon;
! if ($iconfile) {
! my $img = $img_dir if $img_dir;
$img .= '/' . $config{images} . '/favicon.ico"';
$icon = '<link rel="shortcut icon" href="' . $img;
$icon .= ' type="' . $my_defaults->{favicontype};
$icon .= '" />' . $HNL;
! }
# print the opening html
my $doc_type = "<!doctype html public '-//W3C//DTD HTML 4.01//EN'";
--- 1529,1551 ----
}
! # images could come from a remote server, so check for that
! my $img_dir = $config{imageurl};
! # The icon is a 16x16 image that appears in the URL location window.
! # No default so as to avoid 'file not found' messages if it doesn't
! # exist.
! my $iconfile = $my_defaults->{favicon};
! my $icontype = $my_defaults->{favicontype} || 'image/x-icon';
! # works for mozilla
! my $icon;
! if ($iconfile) {
! my $img;
! $img = $img_dir if $img_dir;
$img .= '/' . $config{images} . '/favicon.ico"';
+ #$log->debug("\nWebify: img=$img");
$icon = '<link rel="shortcut icon" href="' . $img;
$icon .= ' type="' . $my_defaults->{favicontype};
$icon .= '" />' . $HNL;
! }
# print the opening html
my $doc_type = "<!doctype html public '-//W3C//DTD HTML 4.01//EN'";
***************
*** 1695,1699 ****
my $style_url = '/' . $config{includes};
$style_url .= '/' . $stylesheet;
- # $style_url .= '/' . $my_defaults->{stylesheet_name};
#$log->debug("\nWebify: $style_url");
--- 1577,1580 ----
***************
*** 1703,1707 ****
# link-in the javascript library. With thanks to the phpMyAdmin team
- # $header .= '<script src="' . $config{homeurl} . '/';
$header .= '<script src="' . '/';
$header .= $config{includes} . '/' . $my_defaults->{javascript_lib};
--- 1584,1587 ----
***************
*** 1779,1790 ****
push @output, join("", @{ $opts->{menuitems} });
}
- # add a link to search
- my $search = '<a id="search" href="';
- # $search .= $config{homeurl} . '/search">Search this site</a>';
- $search .= '/search">Search this site</a>';
- my $width = $my_defaults->{vbar_table_width};
! push @output, '<!-- This is the search link -->' . $HNL;
! push @output, $search . $HNL;
push @output, $HNL . '<!-- This is the daily stats table -->' . $HNL;
--- 1659,1676 ----
push @output, join("", @{ $opts->{menuitems} });
}
! # add a link to search. Get the displayed text from table my_text
! my %args = (
! 'caller' => 'search',
! element => 'title',
! );
! my $text = chk_txt($opts, \%args);
! my $search = '<a id="search" href="/search">';
! $search .= $text . '</a>';
!
! push @output, ' <!-- This is the search link -->' . $HNL;
! push @output, ' ' . $search . $HNL;
!
! my $width = $my_defaults->{vbar_table_width};
push @output, $HNL . '<!-- This is the daily stats table -->' . $HNL;
***************
*** 1793,1808 ****
push @output, join(" ", @$daily_stats);
}
! my $text = '</div> <!-- This ends the leftvbar div -->';
push @output, $text . $HNL;
push @output, $HNL;
- ### This creates the main body of the screen ###
- my $table_width = $opts->{body_table_width};
- $table_width ||= $my_defaults->{body_table_width};
- my $table_align = $opts->{body_table_align};
- $table_align ||= $my_defaults->{body_table_align};
- my $table_valign = $opts->{body_table_valign};
- $table_valign ||= $my_defaults->{body_table_valign};
-
# this will print nothing if no $opts->{Title} defined
my $title = $opts->{Title};
--- 1679,1686 ----
push @output, join(" ", @$daily_stats);
}
! $text = '</div> <!-- This ends the leftvbar div -->';
push @output, $text . $HNL;
push @output, $HNL;
# this will print nothing if no $opts->{Title} defined
my $title = $opts->{Title};
***************
*** 1831,1839 ****
my $text = '<img src="' . $imgfile;
- # my $text = '<img src="' . $imgfile . '" height="auto"';
- # my $text = '<img src="' . $imgfile . '" height="300"';
$text .= '" alt="my image" />' . $HNL;
- # $text .= ' width="auto" alt="my image" />' . $HNL;
- # $text .= ' width="400" alt="my image" />' . $HNL;
push @output, $text;
--- 1709,1713 ----
***************
*** 3341,3351 ****
my $today = str2time($today_str);
! # yesterday. Subtract 1 from $today, then repeat as for the today
! # proces, above
! my $yesterday_str = time2str("%d-%h-%y", $today - 1);
! my $yesterday = str2time( $yesterday_str);
! # what is the first date in the 'dailystats' table? We only count
! # db entries, not day difference between start and now.
my $sql = q{SeLecT MIN(stats_date),COUNT(*) FROM dailystats};
my $sth = $dbh->prepare_cached($sql);
--- 3215,3225 ----
my $today = str2time($today_str);
! # yesterday. Subtract 1 from $today, then repeat as for the today
! # proces, above
! my $yesterday_str = time2str("%d-%h-%y", $today - 1);
! my $yesterday = str2time( $yesterday_str);
! # what is the first date in the 'dailystats' table? We only count
! # db entries, not day difference between start and now.
my $sql = q{SeLecT MIN(stats_date),COUNT(*) FROM dailystats};
my $sth = $dbh->prepare_cached($sql);
***************
*** 3353,3384 ****
my $ref = $sth->fetchall_arrayref;
! # my $ref = sqlSelectArrayRef('MIN(stats_date),COUNT(*)', 'dailystats');
! my $start = $ref->[0][0];
! my $start_str = time2str("%d-%h-%y", $start);
! my $db_days = $ref->[0][1];
! # this ordered array of hashes feeds data to the loop wich creates
! # the rows of the stats table. First table row is 'today' stats
! my (@rows, %cells);
%cells = (
'label' => $today_str . ' (Today)',
'select' => 'stats_date,views,bytes',
! 'where' => $today
);
! push @rows, { %cells };
! # second table row is 'yesterday' stats
%cells = (
'label' => $yesterday_str . ' (Yesterday)',
'select' => 'stats_date,views,bytes',
'where' => $yesterday,
);
! push @rows, { %cells };
! # third table row is 'average daily' stats
%cells = (
'label' => 'Daily Average (during ' . $db_days . ' days)',
'select' => 'AVG(views) AS views,AVG(bytes) AS bytes',
'where' => undef,
);
push @rows, { %cells };
--- 3227,3263 ----
my $ref = $sth->fetchall_arrayref;
! my $start = $ref->[0][0];
! my $start_str = time2str("%d-%h-%y", $start);
! my $db_days = $ref->[0][1];
! # this ordered array of hashes feeds data to the loop wich creates
! # the rows of the stats table. First table row is 'today' stats
! my (@rows, %cells);
%cells = (
'label' => $today_str . ' (Today)',
'select' => 'stats_date,views,bytes',
! 'where' => $today,
! 'caller' => 'daily_stats',
! 'element' => 'row_today',
);
! push @rows, { %cells };
! # second table row is 'yesterday' stats
%cells = (
'label' => $yesterday_str . ' (Yesterday)',
'select' => 'stats_date,views,bytes',
'where' => $yesterday,
+ 'caller' => 'daily_stats',
+ 'element' => 'row_yesterday',
);
! push @rows, { %cells };
! # third table row is 'average daily' stats
%cells = (
'label' => 'Daily Average (during ' . $db_days . ' days)',
'select' => 'AVG(views) AS views,AVG(bytes) AS bytes',
'where' => undef,
+ 'caller' => 'daily_stats',
+ 'element' => 'row_average',
);
push @rows, { %cells };
***************
*** 3389,3392 ****
--- 3268,3273 ----
'select' => 'SUM(views) AS views, SUM(bytes) AS bytes',
'where' => undef,
+ 'caller' => 'daily_stats',
+ 'element' => 'row_total',
);
push @rows, { %cells };
***************
*** 3397,3402 ****
my $width = $my_tables->{$table}{vbar_table_width};
$width ||= $my_defaults->{vbar_table_width};
! my $show = ' <table>' . $HNL;
! push @stats, $show;
# now get the title info from my_text
--- 3278,3283 ----
my $width = $my_tables->{$table}{vbar_table_width};
$width ||= $my_defaults->{vbar_table_width};
! my $text = ' <table>' . $HNL;
! push @stats, $text;
# now get the title info from my_text
***************
*** 3405,3498 ****
element => 'table_heading',
);
! $show = ' ';
! my $text = Apache::AppWrap::Subs::chk_txt($opts, \%args);
! $show .= $text if $text;
! push @stats, $show . $HNL;
! # push @rows, $text . $HNL;
!
! # $show = ' <tr><th>When</th><th>Views</th><th>M Bytes</th></tr>' . $HNL;
! # $show = ' <tr><th>When</th><th>Views</th>';
! # $show .= '<th>M Bytes</th></tr>' . $HNL;
! # push @stats, $show;
! # now loop thru @rows to populate table
! foreach my $row (@rows) {
# set up query for data
! my $where = $row->{where} if $row->{where};
!
! # define the SQL statement
! my $sql = 'SeLeCt ' . $row->{'select'} . ' FroM dailystats';
!
! my ($sth, $rc);
! if ($where) {
! $sql .= ' WHERE stats_date=?';
! # prepare the query
! $sth = $dbh->prepare_cached($sql);
! # execute
! $rc = $sth->execute($where);
! }
! else {
! # prepare the query
! $sth = $dbh->prepare($sql);
! # execute
! $rc = $sth->execute();
! }
! # error check
! unless ($rc) {
! my $msg = 'SQLERROR. Subs::daily_stats: "' . $sql . '"';
! $r->log_error($msg);
! }
! my $ref;
! my $i = 1;
! while (my $row = $sth->fetchrow_hashref) {
! push @$ref, { %$row };
! last if $i++ >= 1;
! }
! $sth->finish;
! my $label = $row->{label};
! my $view_data = $ref->[0]{views};
! my $views = sprintf("%d", $view_data) if $view_data;
! # adjust display for number of bytes. If less than 1M, show .xxx
! my $byte_data= $ref->[0]{bytes};
! my $bytes = $byte_data / 1000 if $byte_data;
! my $bytes_out;
! # if bytes sent = 0, show a blank
! if ($bytes) {
! if ($bytes < 1000) {
! $bytes_out = sprintf("%0.3f", $bytes / 1000);
}
! elsif ( $bytes < 10000) {
! $bytes_out = sprintf("%1.2f", $bytes / 1000);
}
! elsif ( $bytes < 100000) {
! $bytes_out = sprintf("%2.1f", $bytes / 1000);
}
else {
! $bytes_out = sprintf("%d", $bytes / 1000);
}
! } # end test for byte value
!
! # display today's stats
! $show = ' <tr><td class="first">' . $label;
! if ($views) {
! $show .= '</td><td>' . $views;
! }
! else {
! $show .= '</td><td>0';
! }
!
! if ($bytes_out) {
! $show .= '</td><td>' . $bytes_out;
! }
! else {
! $show .= '</td><td>0';
}
!
! $show .= '</td></tr>' . $HNL;
! push @stats, $show;
! }
! push @stats, ' </table>' . $HNL;
! return \@stats;
} # end &daily_stats
--- 3286,3366 ----
element => 'table_heading',
);
! $text = Apache::AppWrap::Subs::chk_txt($opts, \%args);
! push @stats, ' ' . $text . $HNL;
! # now loop thru @rows to populate table
! foreach my $args (@rows) {
# set up query for data
! my $where = $args->{where} if $args->{where};
! # define the SQL statement
! my $sql = 'SeLeCt ' . $args->{'select'} . ' FroM dailystats';
!
! my ($sth, $rc);
! if ($where) {
! $sql .= ' WHERE stats_date=?';
! # prepare the query
! $sth = $dbh->prepare_cached($sql);
! # execute
! $rc = $sth->execute($where);
}
! else {
! # prepare the query
! $sth = $dbh->prepare($sql);
! # execute
! $rc = $sth->execute();
}
! # error check
! unless ($rc) {
! my $msg = 'SQLERROR. Subs::daily_stats: "' . $sql . '"';
! $r->log_error($msg);
! }
! my $ref;
! my $i = 1;
! while (my $row = $sth->fetchrow_hashref) {
! push @$ref, { %$row };
! last if $i++ >= 1;
! }
! $sth->finish;
!
! my $label = $args->{label};
! my $view_data = $ref->[0]{views};
! if ($view_data) {
! $args->{views} = sprintf("%d", $view_data);
}
else {
! $args->{views} = '0';
}
!
! # adjust display for number of bytes. If less than 1M, show .xxx
! my $byte_data= $ref->[0]{bytes};
! # if bytes sent = 0, show a blank
! my $bytes_out;
! if ($byte_data) {
! my $bytes = $byte_data / 1000;
! if ($bytes < 1000) {
! $bytes_out = sprintf("%0.3f", $bytes / 1000);
! }
! elsif ( $bytes < 10000) {
! $bytes_out = sprintf("%1.2f", $bytes / 1000);
! }
! elsif ( $bytes < 100000) {
! $bytes_out = sprintf("%2.1f", $bytes / 1000);
! }
! else {
! $bytes_out = sprintf("%d", $bytes / 1000);
! }
! $args->{bytes_out} = $bytes_out;
! } # end test for byte value
! else {
! $args->{bytes_out} = '0';
! }
!
! # display today's stats
! my $show = chk_txt($opts, $args);
! push @stats, ' ' . $show . $HNL;
}
! push @stats, ' </table>' . $HNL;
! return \@stats;
} # end &daily_stats
***************
*** 3612,3616 ****
my $limit = $my_defaults->{favorites_qty};
unless ($limit) {
! my $msg = 'DBILogConfig: favorites_qty must be set in';
$msg .= ' table:my_defaults';
$r->log_error($msg);
--- 3480,3484 ----
my $limit = $my_defaults->{favorites_qty};
unless ($limit) {
! my $msg = 'Subs::favorites: favorites_qty must be set in';
$msg .= ' table:my_defaults';
$r->log_error($msg);
***************
*** 3627,3631 ****
$logtable ||= $my_defaults->{DBILogConfig_table};
unless ($logtable) {
! my $msg = 'DBILogConfig: Logging table not defined';
$r->log_error($msg);
return SERVER_ERROR;
--- 3495,3499 ----
$logtable ||= $my_defaults->{DBILogConfig_table};
unless ($logtable) {
! my $msg = 'Subs::favorites: Logging table not defined';
$r->log_error($msg);
return SERVER_ERROR;
***************
*** 3651,3655 ****
# error check
unless ($rc) {
! my $msg = 'SQLERROR. DBILogConfig: "' . $sql . '"';
$r->log_error($msg);
}
--- 3519,3523 ----
# error check
unless ($rc) {
! my $msg = 'SQLERROR. Subs::favorites: "' . $sql . '"';
$r->log_error($msg);
}
***************
*** 3676,3680 ****
);
$text = chk_txt($opts, \%args);
! push @rows, $text . $HNL;
#$log->debug("\nfavorites: start html loop");
--- 3544,3548 ----
);
$text = chk_txt($opts, \%args);
! push @rows, ' ' . $text . $HNL;
#$log->debug("\nfavorites: start html loop");
***************
*** 3687,3692 ****
$link .= $url . '</a>';
! push @rows, ' <tr><td class="first">' . $link . '</td>';
! push @rows, '<td>' . $qty . '</td></tr>' . $HNL;
}
#$log->debug("\nfavorites: end html loop");
--- 3555,3563 ----
$link .= $url . '</a>';
! $args{element} = 'row_data';
! $args{'link'} = $link;
! $args{qty} = $qty;
! $text = chk_txt($opts, \%args);
! push @rows, ' ' . $text . $HNL;
}
#$log->debug("\nfavorites: end html loop");
***************
*** 4643,4646 ****
--- 4514,4518 ----
}
+ #$log->debug("\nchk_txt: passed $table:$caller.");
# check for the specified my_text element
my $raw_text = specific_msg($my_text, $table, $caller, $element);
***************
*** 4654,4658 ****
# we have an element, so eval and test it
my $out = eval $raw_text;
! if ($@) {
$text = qq{$table:$caller. Display element "$element"};
$text .= qq{ errored on eval of "$raw_text".};
--- 4526,4531 ----
# we have an element, so eval and test it
my $out = eval $raw_text;
! #$log->debug("\nchk_txt: evaled $raw_text, result=:$out.");
! unless ($out) {
$text = qq{$table:$caller. Display element "$element"};
$text .= qq{ errored on eval of "$raw_text".};
|
|
From: <pla...@us...> - 2002-12-30 09:34:02
|
Update of /cvsroot/appwrap/AppWrap/Apache/AppWrap
In directory sc8-pr-cvs1:/tmp/cvs-serv13945
Modified Files:
Focus.pm
Log Message:
Completed i18n on related subroutines
Index: Focus.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Focus.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Focus.pm 26 Dec 2002 01:35:47 -0000 1.10
--- Focus.pm 30 Dec 2002 09:33:57 -0000 1.11
***************
*** 17,21 ****
use vars qw($VERSION);
! $Apache::AppWrap::Focus::VERSION = '0.06';
# 13Dec02. Sub'd out &nav_popup; added prepare_cached DBI calls
# 11Dec02. 1i18n; navigate_img_(height|width) directives added
--- 17,22 ----
use vars qw($VERSION);
! $Apache::AppWrap::Focus::VERSION = '0.07';
! # 26Dec02. Completed i18n on subs
# 13Dec02. Sub'd out &nav_popup; added prepare_cached DBI calls
# 11Dec02. 1i18n; navigate_img_(height|width) directives added
***************
*** 80,84 ****
$opts->{SubTitle} = $subtitle;
-
# get the data_header section
my $dh = Apache::AppWrap::Pager::data_header($opts, \%args);
--- 81,84 ----
***************
*** 163,189 ****
$menu_func ||= $my_defaults->{func_focus};
$menu_func ||= $my_defaults->{func_default};
!
! # call functions if defined. Functions return array of to
! # data wrapped in <td> tags
! if ($menu_func) {
! my @subs = split(/\s*;\s*/, $menu_func );
! foreach my $sub (@subs) {
! $log->debug("\nFocus: eval_sub=$sub");
! my $ref = eval $sub;
! if ($ref && scalar(@$ref)) {
! push @{ $opts->{menuitems} }, join("", @$ref);
! }
! }
! }
! push @{ $opts->{Rows} }, join("", @rows);
! # comply with HEAD request
! if ($r->header_only) {
! $r->send_http_header;
! return OK;
! }
! Apache::AppWrap::Subs::Webify($opts);
! return OK;
} # end handler
--- 163,189 ----
$menu_func ||= $my_defaults->{func_focus};
$menu_func ||= $my_defaults->{func_default};
!
! # call functions if defined. Functions return array of to
! # data wrapped in <td> tags
! if ($menu_func) {
! my @subs = split(/\s*;\s*/, $menu_func );
! foreach my $sub (@subs) {
! my $ref = eval $sub;
! if ($ref && scalar(@$ref)) {
! my $result = join("", @$ref);
! push @{ $opts->{menuitems} }, join("", @$ref);
! }
! }
! }
! push @{ $opts->{Rows} }, join("", @rows);
! # comply with HEAD request
! if ($r->header_only) {
! $r->send_http_header;
! return OK;
! }
! Apache::AppWrap::Subs::Webify($opts);
! return OK;
} # end handler
***************
*** 208,212 ****
my $log = Apache->request->log;
! $log->debug("\nfocus_stats2: here.");
# list distict db entries for this control except if
# control = (idnum|date). We make these 2 exceptions
--- 208,216 ----
my $log = Apache->request->log;
! my %args = (
! table => $table,
! 'caller' => 'focus_stats2',
! element => 'table_heading',
! );
# list distict db entries for this control except if
# control = (idnum|date). We make these 2 exceptions
***************
*** 221,256 ****
my $label = $my_columns->{$table}{$column}{label};
push @rows, '<table>' . $HNL;
! # my $text = ' <tr><th>' . $label;
! # $text .= '</th><th>Count</th></tr>';
! my %args = (
! 'caller' => 'focus_stats2',
! element => 'table_heading',
! label => $label,
! );
! my $show = ' ';
my $text = Apache::AppWrap::Subs::chk_txt($opts, \%args);
! $show .= $text if $text;
! push @rows, $show . $HNL;
!
! # my $text = '<tr><th>' . $args->{label} . '</th><th>Count</th></tr>';
! # push @rows, $text . $HNL;
! my $sql = qq{SeLecT disTInct($by),MAX(idnum),COUNT($by)};
! $sql .= qq{ FROM $table GROUP BY $by};
my $sth = $dbh->prepare_cached($sql);
! my $rc = $sth-execute();
!
# make a link (idnum & $by) for each distinct db entry
while (my $row = $sth->fetchrow_hashref) {
# Handle the varied column inputs by processing with the
! # func_focus subroutine in my_columns. This is a bit ugly
! # now so needs work. But it functions correctly.
my ($ary, $val);
# get the func_focus sub
! my $func_focus;
! if ($my_columns->{$table}{$column}{func_focus}) {
! $func_focus = $my_columns->{$table}{$column}{func_focus};
! }
! # if it exists, run it. if not, use the input value directly
if ($func_focus) {
$ary = eval $func_focus;
--- 225,249 ----
my $label = $my_columns->{$table}{$column}{label};
push @rows, '<table>' . $HNL;
! $args{label} = $label,
! #$log->debug("\nfocus_stats2: before chk_txt.");
my $text = Apache::AppWrap::Subs::chk_txt($opts, \%args);
! push @rows, ' ' . $text . $HNL if $text;
! my $sql = qq{
! SeLecT disTInct($by), MAX(idnum) AS max_id, COUNT($by) as qty FROM $table GROUP BY $by
! };
my $sth = $dbh->prepare_cached($sql);
! my $rc = $sth->execute();
!
! # set the element for data rows
# make a link (idnum & $by) for each distinct db entry
while (my $row = $sth->fetchrow_hashref) {
# Handle the varied column inputs by processing with the
! # func_focus subroutine in my_columns.
my ($ary, $val);
# get the func_focus sub
! my $func_focus = $my_columns->{$table}{$column}{func_focus};
!
! # if a sub exists, eval it, otherwise show the data
if ($func_focus) {
$ary = eval $func_focus;
***************
*** 262,279 ****
$val = $row->{$column};
}
! # could be some newlines in the data, so delete them
$val =~ s/\n/<br \/>/g if $val;
! $result = html_blank($val);
! # this hash element key is a messy string with the
! # column embedded.
! my $count = 'COUNT(' . $by . ')';
! # now fromat the html output
! my $stat = ' <tr><td class="first"><a href="/' . $table;
! $stat .= '/focus?idnum=' . $row->{'MAX(idnum)'} . '&by=';
! $stat .= $by . '">' . $result . '</a></td><td>';
! $stat .= $row->{$count} . '</td></tr>' . $HNL;
! push @rows, $stat;
} # close the WHILE
! push @rows, '</table>' . $HNL;
} # close the IF
return \@rows;
--- 255,270 ----
$val = $row->{$column};
}
! #$log->debug("\nfocus_stats2: val=$val.");
! # could be some newlines in the data, so replace
$val =~ s/\n/<br \/>/g if $val;
!
! # now format the html output
! my $text = '<tr><td class="first">';
! $text .= qq{<a href="/$table/focus?idnum=$row->{max_id}};
! $text .= '&by=' . $by . '">' . $val . '</a></td>';
! $text .= '<td>' . $row->{qty} . '</td></tr>';
! push @rows, ' ' . $text . $HNL;
} # close the WHILE
! push @rows, ' </table>' . $HNL;
} # close the IF
return \@rows;
***************
*** 295,303 ****
my $my_columns = $opts->{my_columns};
my (@rows, @fields);
! ### color coded links
! my $link_vars = cclinks($opts);
my $label = $link_vars->{label};
# push the header
# get count of distinct entries in each sortable field
--- 286,299 ----
my $my_columns = $opts->{my_columns};
my (@rows, @fields);
+ my $log = Apache->request->log;
! # color coded links
! my $link_vars = Apache::AppWrap::Subs::cclinks($opts);
my $label = $link_vars->{label};
+ my %args = (
+ 'caller' => 'focus_stats1',
+ );
+ #$log->debug("\nfocus_stats1.");
# push the header
# get count of distinct entries in each sortable field
***************
*** 309,325 ****
my $i = $sth->rows;
$sth->finish;
if ($by eq 'idnum') {
! my $text = ' <p class="bodyheader">' . $label;
! $text .= ' records.</p>' . $HNL;
! push @rows, $text;
! next;
}
! my $unit = ' value';
! $i > 1 ? $unit .= 's</p>' : $unit .= '</p>';
! my $label = $my_columns->{$table}{$by}{label};
! push @rows, ' <p>' . $i . ' unique ';
! push @rows, $label . $unit . $HNL;
}
- ###
return \@rows;
} # end &focus_stats1
--- 305,331 ----
my $i = $sth->rows;
$sth->finish;
+
+ # get the correct unit
+ if ($i > 1) {
+ $args{element} = 'values';
+ $args{unit} = Apache::AppWrap::Subs::chk_txt($opts, \%args);
+ }
+ else {
+ $args{element} = 'value';
+ $args{unit} = Apache::AppWrap::Subs::chk_txt($opts, \%args);
+ }
+
if ($by eq 'idnum') {
! $args{element} = 'table_heading';
}
! else {
! $args{element} = 'row_data';
! }
!
! $args{count} = $i;
! $args{label} = $my_columns->{$table}{$by}{label};
! my $text = Apache::AppWrap::Subs::chk_txt($opts, \%args);
! push @rows, ' ' . $text . $HNL if $text;
}
return \@rows;
} # end &focus_stats1
|
|
From: <pla...@us...> - 2002-12-30 09:33:13
|
Update of /cvsroot/appwrap/AppWrap/Apache/AppWrap
In directory sc8-pr-cvs1:/tmp/cvs-serv13710
Modified Files:
Doorknob.pm
Log Message:
modified tests for required directives
Index: Doorknob.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Doorknob.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** Doorknob.pm 21 Dec 2002 11:04:26 -0000 1.12
--- Doorknob.pm 30 Dec 2002 09:33:09 -0000 1.13
***************
*** 17,21 ****
use strict;
! use warnings qw(redefine);
our @ISA = qw(Exporter DynaLoader);
--- 17,22 ----
use strict;
! use warnings;
! no warnings qw(redefine);
our @ISA = qw(Exporter DynaLoader);
***************
*** 254,258 ****
# these are the required my_tables directives
foreach my $dir (@my_tables_dirs) {
! unless (exists $my_tables->{$table}{$dir}) {
my $msg = 'Doorknob: Directive my_tables->{';
$msg .= $table . '}{' . $dir . '} not defined.';
--- 255,264 ----
# these are the required my_tables directives
foreach my $dir (@my_tables_dirs) {
! my $directive = $my_tables->{$table}{$dir};
! # first exception. table_type 'script' needs no menu_order
! next if $dir eq 'menu_order' &&
! $my_tables->{$table}{table_type} eq 'script';
! unless ($directive) {
! # unless (exists $my_tables->{$table}{$dir}) {
my $msg = 'Doorknob: Directive my_tables->{';
$msg .= $table . '}{' . $dir . '} not defined.';
***************
*** 270,274 ****
$msg .= $table . '}{' . $dir . '} not defined.';
$msg .= ' Assigning an appropriate value is';
! $msg .= ' helpful to users. However it is not required.';
$r->log_error($msg);
}
--- 276,280 ----
$msg .= $table . '}{' . $dir . '} not defined.';
$msg .= ' Assigning an appropriate value is';
! $msg .= ' helpful to users. It is not required, however.';
$r->log_error($msg);
}
|
|
From: <pla...@us...> - 2002-12-30 09:32:13
|
Update of /cvsroot/appwrap/AppWrap/Apache/AppWrap
In directory sc8-pr-cvs1:/tmp/cvs-serv13357
Modified Files:
Pager.pm
Log Message:
Fixed bug in handling of ALT message for up icon
Index: Pager.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Pager.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** Pager.pm 26 Dec 2002 01:31:53 -0000 1.17
--- Pager.pm 30 Dec 2002 09:32:11 -0000 1.18
***************
*** 24,27 ****
--- 24,28 ----
$Apache::AppWrap::Pager::VERSION = "0.08";
+ # 28Dec02. Fixed bug in alt_up handling
# 13Dec02. Replaced "alt" attributes with "title" in <img> tags
# 03Dec02. convert to my_tables table_type directive
***************
*** 1130,1133 ****
--- 1131,1135 ----
my $icon = 'up';
$args->{element} = 'alt_' . $icon;
+ $args->{'caller'} = $opts->{phase};
my $alt = Apache::AppWrap::Subs::chk_txt($opts, $args);
my $up_url = $config{homeurl} . '/' . $table;
|
|
From: <pla...@us...> - 2002-12-30 09:31:21
|
Update of /cvsroot/appwrap/AppWrap/Apache/AppWrap
In directory sc8-pr-cvs1:/tmp/cvs-serv13147
Modified Files:
Display.pm
Log Message:
Fixed bug in handling of i18n subtitles
Index: Display.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Display.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Display.pm 9 Dec 2002 10:06:32 -0000 1.8
--- Display.pm 30 Dec 2002 09:31:17 -0000 1.9
***************
*** 14,24 ****
use Apache::AppWrap::Subs qw($dbh $HNL);
use vars qw($VERSION);
! $Apache::AppWrap::Display::VERSION = '0.04';
############################
! # 16 Nov 02. use warnings pragma; split on optional whitespace for vbar subs.
! # 13 Nov 02. i18n
! # 05 Nov 02. Comply with HEAD requests
! # 02 Jan 02. Created.
############################
sub handler {
--- 14,25 ----
use Apache::AppWrap::Subs qw($dbh $HNL);
use vars qw($VERSION);
! $Apache::AppWrap::Display::VERSION = '0.05';
############################
! # 28Dec02. Fixed bug in handling of subtitle
! # 16Nov02. use warnings pragma; split on optional whitespace for vbar subs.
! # 13Nov02. i18n
! # 05Nov02. Comply with HEAD requests
! # 02Jan02. Created.
############################
sub handler {
***************
*** 56,67 ****
$opts->{new_url} = '/' . $table . '/add?kv=' . $kv_esc;
! # subtitle handled by &paginator
!
! # assign messages for &paginator alt tags. This allows &paginator to
! # be called by &display, &focus and by &list, while retaining
! # context sensitivity.
! # foreach (keys %{ $my_exceptions->{$table}{display} }) {
! # $msgs->{$_} = $my_exceptions->{$table}{display}{$_} if $_ =~ /^alt_/;
! # }
# tell paginator about any per column function assigned in the db.
--- 57,67 ----
$opts->{new_url} = '/' . $table . '/add?kv=' . $kv_esc;
! # subtitle
! my %args = (
! 'caller' => 'display',
! element => 'subtitle',
! label => $my_tables->{$table}{label},
! );
! $opts->{SubTitle} = Apache::AppWrap::Subs::chk_txt($opts, \%args);
# tell paginator about any per column function assigned in the db.
|
|
From: <pla...@us...> - 2002-12-30 09:27:02
|
Update of /cvsroot/appwrap/AppWrap/Apache/AppWrap
In directory sc8-pr-cvs1:/tmp/cvs-serv11882
Modified Files:
Search.pm
Log Message:
i18n recoding
Index: Search.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Search.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Search.pm 10 Dec 2002 07:03:57 -0000 1.5
--- Search.pm 30 Dec 2002 09:26:59 -0000 1.6
***************
*** 16,24 ****
use Apache::Util ();
! use Apache::AppWrap::Subs qw($HNL);
use AppWrap qw(%config);
use vars qw($VERSION);
! $Apache::AppWrap::Search::VERSION = '0.02';
# 10Dec02. CSS, warnings pragma.
--- 16,25 ----
use Apache::Util ();
! use Apache::AppWrap::Subs qw($dbh $HNL);
use AppWrap qw(%config);
use vars qw($VERSION);
! $Apache::AppWrap::Search::VERSION = '0.04';
! # 28Dec02. i18n
# 10Dec02. CSS, warnings pragma.
***************
*** 30,33 ****
--- 31,38 ----
my $my_defaults = $opts->{my_defaults};
+ my %args = (
+ 'caller' => 'search',
+ );
+
# store output in @rows;
my (@rows, $results);
***************
*** 48,52 ****
}
# body of search results
! my $ref = &search_results($opts);
push @rows, join("", @$ref) if $ref && scalar(@$ref);
--- 53,57 ----
}
# body of search results
! my $ref = search_results($opts);
push @rows, join("", @$ref) if $ref && scalar(@$ref);
***************
*** 56,67 ****
# try it as a string
my $unpacked = eval $eval;
! $opts->{Title} = 'Search Results for <br />' . $unpacked;
}
else {
# Args were not present so run the default code to display the
# key_type popup menus
! my $rows = &search_form($opts);
push @rows, join("", @$rows) if $rows && scalar(@$rows);
! $opts->{Title} = 'Search this Site';
}
--- 61,78 ----
# try it as a string
my $unpacked = eval $eval;
! unless ($unpacked) {
! }
! $args{'caller'} = 'search_results';
! $args{element} = 'title';
! my $text = Apache::AppWrap::Subs::chk_txt($opts, \%args);
! $opts->{Title} = $text . '<br />' . $unpacked;
}
else {
# Args were not present so run the default code to display the
# key_type popup menus
! my $rows = search_form($opts);
push @rows, join("", @$rows) if $rows && scalar(@$rows);
! $args{element} = 'title';
! $opts->{Title} = Apache::AppWrap::Subs::chk_txt($opts, \%args);
}
***************
*** 129,136 ****
my $my_tables = $opts->{my_tables};
my $my_columns = $opts->{my_columns};
! my $log = Apache->request->log;
my @rows;
# get all values of 'key_type', excluding 'idnum'
my (@key_types, $test);
# $test = join(", ", @$valid_tables);
--- 140,149 ----
my $my_tables = $opts->{my_tables};
my $my_columns = $opts->{my_columns};
! my $r = Apache->request;
! my $log = $r->log;
my @rows;
# get all values of 'key_type', excluding 'idnum'
my (@key_types, $test);
+ my %args;
# $test = join(", ", @$valid_tables);
***************
*** 145,159 ****
}
! #start the <div>
! push @rows, '<div id="pager">' . $HNL;
! # start a table for holding this whole bot
! my $display = ' <table border="1" width="95%" align="center"';
! $display .= ' class="vbar">' . $HNL;
! push @rows, $display;
! $display = ' <tr valign="bottom">' . $HNL;
! $display .= ' <th align="center">Search</th>' . $HNL;
! $display .= ' </tr>' . $HNL;
! push @rows, $display;
# this loop generates a popup menu and form for each key_type
--- 158,174 ----
}
! #start the <div>
! push @rows, '<div id="pager">' . $HNL;
! # start a table for holding this whole bit
! my $display = ' <table>';
! push @rows, $display . $HNL;
!
! # get another label
! $args{'caller'} = 'search';
! $args{element} = 'title';
! my $label = Apache::AppWrap::Subs::chk_txt($opts, \%args);
! $display = qq{<tr><th>$label</th></tr>};
! push @rows, '' . $display . $HNL;
# this loop generates a popup menu and form for each key_type
***************
*** 162,165 ****
--- 177,186 ----
$opts->{column} = 'key_value';
my $eval_sub = $my_tables->{$tablename}{search};
+ unless ($eval_sub) {
+ my $msg = 'Search::search_form: no defined';
+ $msg .= qq{ my_tables->{$tablename}{search} function};
+ $r->log_error($msg);
+ return SERVER_ERROR;
+ }
$display = eval $eval_sub;
if ($display) {
***************
*** 167,171 ****
# skip 'idnum's
my $label = $my_tables->{$tablename}{label};
! my $text = ' <tr valign="top">';
$text .= '<td align="left">' . $label;
push @rows, $text;
--- 188,192 ----
# skip 'idnum's
my $label = $my_tables->{$tablename}{label};
! my $text = ' <tr valign="top">';
$text .= '<td align="left">' . $label;
push @rows, $text;
***************
*** 178,182 ****
push @rows, $text;
! $text = ' <input type="hidden" name="key_type" value="';
$text .= $key_type . '" />' . $HNL;
push @rows, $text;
--- 199,203 ----
push @rows, $text;
! $text = ' <input type="hidden" name="key_type" value="';
$text .= $key_type . '" />' . $HNL;
push @rows, $text;
***************
*** 184,201 ****
push @rows, join("", @$display) if scalar(@$display);
! $text = '<input type="submit" name="submit" value="Go" />' . $HNL;
! push @rows, $text;
! $text = ' </form>' . $HNL;
! $text .= ' </td>' . $HNL;
! $text .= ' </tr>' . $HNL;
push @rows, $text;
}
} # end %key_data loop
! push @rows, ' </table>' . $HNL;
#close the <div>
push @rows, '</div>' . $HNL;
- # push @rows, ' <br />' . $HNL;
return \@rows;
} # end search_form
--- 205,222 ----
push @rows, join("", @$display) if scalar(@$display);
! $text = '<input type="submit" name="submit"';
! $text .= ' name="submit" value="Go" />';
! push @rows, ' ' . $text . $HNL;
! $text = ' </form>' . $HNL;
! $text .= ' </td>' . $HNL;
! $text .= ' </tr>' . $HNL;
push @rows, $text;
}
} # end %key_data loop
! push @rows, ' </table>' . $HNL;
#close the <div>
push @rows, '</div>' . $HNL;
return \@rows;
} # end search_form
***************
*** 213,329 ****
my $my_defaults = $opts->{my_defaults};
my $valid_tables = $opts->{valid_tables};
! my $log = Apache->request->log;
! my @rows;
! my $kt = $opts->{args}{key_type};
! my $kv = $opts->{args}{key_value};
! # get the list of tables and the parent for the selected key_type
! my ($tables, $parent) = &table_list($opts, $kt);
#my $test = join(", ", @$tables);
#$log->debug("\nkt=$kt, tables=$test, parent=$parent");
! my ($select, $from, $where, $ref, $results);
! foreach my $tablename (@$tables) {
! $select = 'idnum,' . $kt;
! $from = $tablename;
! $where = $kt . '=' . $kv;
! $ref = Apache::AppWrap::Subs::sqlSelectHashRef($select, $from, $where);
! foreach my $row (@$ref) {
! $row->{tablename} = $tablename;
! push @$results, $row;
! }
! }
!
! # scan the parent table
! $select = '*';
! $from = $parent;
! $where = 'idnum=' . $kv;
! $ref = Apache::AppWrap::Subs::sqlSelectHashRef($select, $from, $where);
! my $parent_result = $ref->[0];
! #start the <div>
! push @rows, '<div id="pager">' . $HNL;
! # build tabular output
! my $text = ' <table align="center" border="1" width="';
! $text .= $my_defaults->{main_table_width} . '">';
! push @rows, $text . $HNL;
! $text = ' <tr valign="bottom">';
! push @rows, $text . $HNL;
! $text = ' <th>Table</th><th>Link to Focus page</th>';
! push @rows, $text . $HNL;
! $text = ' </tr>';
! push @rows, $text . $HNL;
! # count table entries
! my %tablecount;
! grep ($_->{tablename} && $tablecount{$_->{tablename}}++, @$results);
! # start with the parent table
! $text = ' <tr valign="top">';
! push @rows, $text . $HNL;
! my $label = $my_tables->{$parent}{label};
! $text = ' <td>' . $label . '</td>';
! push @rows, $text . $HNL;
! # this is the hyperlink
! $text = ' <td><a href="' . $config{homeurl};
! $text .= '/' . $parent . '/focus?idnum=' . $kv . '">';
! $text .= $kv . '</a></td>';
push @rows, $text . $HNL;
! $text = ' </tr>';
push @rows, $text . $HNL;
! # foreach my $row ($parent_result, @$results) {
! foreach my $row (@$results) {
! my $tablename = $row->{tablename};
! my $idnum = $row->{idnum};
! # the sub to eval requires this
! $opts->{column} = 'idnum';
!
! $text = ' <tr valign="top">';
! push @rows, $text . $HNL;
! my $label = $my_tables->{$tablename}{label};
! # if >1 record per table, show a link to &display
! if ($tablecount{$row->{tablename}} >1) {
! # $display is the link to an all records
! my $display = $config{homeurl} . '/';
! $display .= $tablename . '/display?kv=' . $kv . '">';
! $text = ' <td><a href="' . $display . $label . '</a></td>';
! }
! else {
! $text = ' <td>' . $label . '</td>';
! }
! push @rows, $text . $HNL;
! # get the label for this idnum
! # get the page_list function to display a label for the focus link
! my $eval = $my_columns->{$tablename}{idnum}{func_list};
! my $ref = eval $eval;
! my $name = join("", @$ref) if $ref && scalar(@$ref);
! # skip this table if there are no records
! next unless $name;
! # $focus is the link to an individual record
! my $focus = $config{homeurl} . '/' . $tablename;
! # my $focus = $my_defaults->{homeurl} . $tablename;
! $text = ' <td>' . $name;
! $text .= '</td>';
! push @rows, $text . $HNL;
! $text = ' </tr>';
! push @rows, $text . $HNL;
! }
! $text = ' </table>';
! push @rows, $text . $HNL;
! #close the <div>
! push @rows, '</div>' . $HNL;
! return \@rows;
} # end search_results
--- 234,369 ----
my $my_defaults = $opts->{my_defaults};
my $valid_tables = $opts->{valid_tables};
! my $r = Apache->request;
! my $log = $r->log;
! my (@rows, $text, $sth);
! my $kt = $opts->{args}{key_type};
! my $kv = $opts->{args}{key_value};
! # get the list of tables and the parent for the selected key_type
! my ($tables, $parent) = table_list($opts, $kt);
#my $test = join(", ", @$tables);
#$log->debug("\nkt=$kt, tables=$test, parent=$parent");
! my ($select, $from, $where, $ref, $results);
! foreach my $tablename (@$tables) {
! my $sql = qq{SeLecT idnum, $kt frOm $tablename};
! $sql .= qq{ WHERE $kt=?};
! $sth = $dbh->prepare($sql);
! $sth->execute($kv);
!
! # populate the results ref to an array of hashes
! while (my $row = $sth->fetchrow_hashref) {
! $row->{tablename} = $tablename;
! push @$results, $row;
! }
! }
! $sth->finish;
! # scan the parent table
! my $sql = qq{SeLect * frOm $parent WHERE idnum=?};
! $sth = $dbh->prepare_cached($sql);
! $sth->execute($kv);
! # expect only a single row to be returned
! if ($sth->rows > 1) {
! my $msg = qq{Subs::search_results: "$sql" returned more};
! $msg .= ' than 1 idnum';
! $r->log_error($msg);
! return SERVER_ERROR;
! }
! my $parent_result;
! while (my $row = $sth->fetchrow_hashref) {
! $parent_result = $row;
! }
! $sth->finish;
! #start the <div>
! push @rows, '<div id="pager">' . $HNL;
! # build tabular output
! push @rows, ' <table>' . $HNL;
! push @rows, ' <tr>' . $HNL;
! # get the label for the results table columns
! my %args = (
! 'caller' => 'DEFAULT',
! element => 'table',
! );
! my $label = Apache::AppWrap::Subs::chk_txt($opts, \%args);
! $text = '<th>';
! $text .= ucfirst($label);
! $text .= '</th>';
! #$log->debug("\nsearch_results: label=$label, text=$text");
!
! # get the label for other column
! $args{'caller'} = 'search_results';
! $args{element} = 'subtitle';
! $label = Apache::AppWrap::Subs::chk_txt($opts, \%args);
! $text .= qq{<th>$label</th></tr>};
! push @rows, ' ' . $text . $HNL;
!
! # count table entries
! my %tablecount;
! grep ($_->{tablename} && $tablecount{$_->{tablename}}++, @$results);
!
! # start with the parent table
! $text = ' <tr>';
push @rows, $text . $HNL;
! $label = $my_tables->{$parent}{label};
! $text = ' <td>' . $label . '</td>';
push @rows, $text . $HNL;
! # this is the hyperlink
! $text = '<td><a href="/' . $parent;
! $text .= '/focus?idnum=' . $kv . '">' . $kv . '</a></td></tr>';
! push @rows, ' ' . $text . $HNL;
! foreach my $row (@$results) {
! my $tablename = $row->{tablename};
! my $idnum = $row->{idnum};
! # the sub to eval requires this
! $opts->{column} = 'idnum';
! $text = ' <tr>';
! my $label = $my_tables->{$tablename}{label};
! # if >1 record per table, show a link to &display
! if ($tablecount{$row->{tablename}} >1) {
! # $display is the link to an all records
! my $display = $config{homeurl} . '/';
! $display .= $tablename . '/display?kv=' . $kv . '">';
! $text = '<td><a href="' . $display . $label . '</a></td>';
! }
! else {
! $text = '<td>' . $label . '</td>';
! }
! push @rows, ' ' . $text . $HNL;
! # get the page_list function to display a label
! # for the focus link
! my $eval = $my_columns->{$tablename}{idnum}{func_list};
! my $ref = eval $eval;
! my $name = join("", @$ref) if $ref && scalar(@$ref);
! # skip this table if there are no records
! next unless $name;
! # $focus is the link to an individual record
! my $focus = $config{homeurl} . '/' . $tablename;
! $text = ' <td>' . $name;
! $text .= '</td>';
! push @rows, $text . $HNL;
! $text = ' </tr>';
! push @rows, $text . $HNL;
! }
! $text = ' </table>';
! push @rows, $text . $HNL;
! #close the <div>
! push @rows, '</div>' . $HNL;
!
! return \@rows;
} # end search_results
|
|
From: <pla...@us...> - 2002-12-26 01:35:50
|
Update of /cvsroot/appwrap/AppWrap/Apache/AppWrap
In directory sc8-pr-cvs1:/tmp/cvs-serv32269
Modified Files:
Focus.pm
Log Message:
More i18n tweaks
Index: Focus.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Focus.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Focus.pm 21 Dec 2002 11:09:25 -0000 1.9
--- Focus.pm 26 Dec 2002 01:35:47 -0000 1.10
***************
*** 56,60 ****
my $sql = qq{SeLEcT * FrOm $table WHERE idnum=?};
! my $sth = $dbh->prepare($sql);
$sth->execute($idnum);
# should only return a single row; we only want the first
--- 56,60 ----
my $sql = qq{SeLEcT * FrOm $table WHERE idnum=?};
! my $sth = $dbh->prepare_cached($sql);
$sth->execute($idnum);
# should only return a single row; we only want the first
***************
*** 69,89 ****
# assign messages for alt tags. this is how we get display text
! my $msgs = $opts->{display_text};
! $msgs ||= Apache::AppWrap::Subs::get_display_text($opts);
! $opts->{display_text} ||= $msgs;
! my $title = eval $msgs->{title} if $msgs->{title};
! # this may be a fudge to regret later
! $title ||= $opts->{Title};
! unless ($title) {
! $r->log_error("Pager: no title eval'd: $msgs->{title}");
! return SERVER_ERROR;
! }
! $opts->{Title} = $title;
- # subtitles are not mandatory: some tables have none.
- my $subtitle = eval $msgs->{subtitle} if $msgs->{subtitle};
- $subtitle ||= $opts->{SubTitle};
- $opts->{SubTitle} = $subtitle if $subtitle;
# get the data_header section
--- 69,83 ----
# assign messages for alt tags. this is how we get display text
! $args{'caller'} = $opts->{phase};
! $args{element} = 'title';
! $args{idnum} = $idnum;
! my $title = Apache::AppWrap::Subs::chk_txt($opts, \%args);
! $opts->{Title} = $title;
! $args{element} = 'subtitle';
! $args{label} = $link_vars->{label};
! my $subtitle = Apache::AppWrap::Subs::chk_txt($opts, \%args);
! $opts->{SubTitle} = $subtitle;
# get the data_header section
***************
*** 175,179 ****
my @subs = split(/\s*;\s*/, $menu_func );
foreach my $sub (@subs) {
! #$log->debug("\nFocus: eval_sub=$sub");
my $ref = eval $sub;
if ($ref && scalar(@$ref)) {
--- 169,173 ----
my @subs = split(/\s*;\s*/, $menu_func );
foreach my $sub (@subs) {
! $log->debug("\nFocus: eval_sub=$sub");
my $ref = eval $sub;
if ($ref && scalar(@$ref)) {
***************
*** 193,196 ****
--- 187,328 ----
return OK;
} # end handler
+
+
+ ##############################################################
+ # $ref = &focus_stats2(\%opts)
+ # A list of all unique entries of the selected control, and
+ # a count of records having that control value.
+ # 28 Dec 01. Removed CGI dependency.
+ # 10 Jun 01. Fixed logic to handle varied input including dates, and
+ # utilize my_columns func_focus subroutine.
+ # 09 Jun 01. Squashed bug - extra space between query string args.
+ ##############################################################
+ sub focus_stats2 {
+ my $opts = shift;
+ my $by = $opts->{args}{by};
+ my $table = $opts->{table};
+ my @rows;
+ my ($select, $from, $where, $other);
+ my $my_columns = $opts->{my_columns};
+ my ($result);
+ my $log = Apache->request->log;
+
+ $log->debug("\nfocus_stats2: here.");
+ # list distict db entries for this control except if
+ # control = (idnum|date). We make these 2 exceptions
+ # because an itemized list of them would not be meaningful.
+ # Naming convention for date fields in the db is 'date'
+ # or ends with '_date'
+ if ( $by ne 'idnum' && $by ne 'date' && $by !~ /_date$/) {
+
+ # get the column name.
+ my $column = $by;
+ # make a header row
+ my $label = $my_columns->{$table}{$column}{label};
+ push @rows, '<table>' . $HNL;
+ # my $text = ' <tr><th>' . $label;
+ # $text .= '</th><th>Count</th></tr>';
+ my %args = (
+ 'caller' => 'focus_stats2',
+ element => 'table_heading',
+ label => $label,
+ );
+ my $show = ' ';
+ my $text = Apache::AppWrap::Subs::chk_txt($opts, \%args);
+ $show .= $text if $text;
+ push @rows, $show . $HNL;
+
+ # my $text = '<tr><th>' . $args->{label} . '</th><th>Count</th></tr>';
+ # push @rows, $text . $HNL;
+
+ my $sql = qq{SeLecT disTInct($by),MAX(idnum),COUNT($by)};
+ $sql .= qq{ FROM $table GROUP BY $by};
+ my $sth = $dbh->prepare_cached($sql);
+ my $rc = $sth-execute();
+
+ # make a link (idnum & $by) for each distinct db entry
+ while (my $row = $sth->fetchrow_hashref) {
+ # Handle the varied column inputs by processing with the
+ # func_focus subroutine in my_columns. This is a bit ugly
+ # now so needs work. But it functions correctly.
+ my ($ary, $val);
+ # get the func_focus sub
+ my $func_focus;
+ if ($my_columns->{$table}{$column}{func_focus}) {
+ $func_focus = $my_columns->{$table}{$column}{func_focus};
+ }
+ # if it exists, run it. if not, use the input value directly
+ if ($func_focus) {
+ $ary = eval $func_focus;
+ if ($ary && scalar(@$ary)) {
+ $val = join("", @$ary);
+ }
+ }
+ else {
+ $val = $row->{$column};
+ }
+ # could be some newlines in the data, so delete them
+ $val =~ s/\n/<br \/>/g if $val;
+ $result = html_blank($val);
+ # this hash element key is a messy string with the
+ # column embedded.
+ my $count = 'COUNT(' . $by . ')';
+ # now fromat the html output
+ my $stat = ' <tr><td class="first"><a href="/' . $table;
+ $stat .= '/focus?idnum=' . $row->{'MAX(idnum)'} . '&by=';
+ $stat .= $by . '">' . $result . '</a></td><td>';
+ $stat .= $row->{$count} . '</td></tr>' . $HNL;
+ push @rows, $stat;
+ } # close the WHILE
+ push @rows, '</table>' . $HNL;
+ } # close the IF
+ return \@rows;
+ } # end &focus_stats2
+
+
+ ##############################################################
+ # my $ref = &focus_stats1(\%opts)
+ # Summarize the data in the app's db
+ # 03Dec02. Removed table cruft, replaced with CSS
+ # 13Jan 02. Simplified logic.
+ # 11 Aug 01. Modified for color coded links
+ # 10 Jun 01. Fixed logic to utilize my_columns func_focus subroutine.
+ ##############################################################
+ sub focus_stats1 {
+ my $opts = shift;
+ my $table = $opts->{table};
+ my $my_tables = $opts->{my_tables};
+ my $my_columns = $opts->{my_columns};
+ my (@rows, @fields);
+
+ ### color coded links
+ my $link_vars = cclinks($opts);
+ my $label = $link_vars->{label};
+
+ # push the header
+ # get count of distinct entries in each sortable field
+ foreach my $by (@{ $opts->{col_order} }) {
+ next unless $my_columns->{$table}{$by}{page_sort};
+ my $sql = qq{SeLecT DisTInct($by) From $table};
+ my $sth = $dbh->prepare_cached($sql);
+ my $rc = $sth->execute;
+ my $i = $sth->rows;
+ $sth->finish;
+ if ($by eq 'idnum') {
+ my $text = ' <p class="bodyheader">' . $label;
+ $text .= ' records.</p>' . $HNL;
+ push @rows, $text;
+ next;
+ }
+ my $unit = ' value';
+ $i > 1 ? $unit .= 's</p>' : $unit .= '</p>';
+ my $label = $my_columns->{$table}{$by}{label};
+ push @rows, ' <p>' . $i . ' unique ';
+ push @rows, $label . $unit . $HNL;
+ }
+ ###
+ return \@rows;
+ } # end &focus_stats1
+
|
|
From: <pla...@us...> - 2002-12-26 01:34:53
|
Update of /cvsroot/appwrap/AppWrap/Apache/AppWrap
In directory sc8-pr-cvs1:/tmp/cvs-serv31941
Modified Files:
Subs.pm
Log Message:
Many i18n changes
Index: Subs.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Subs.pm,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** Subs.pm 21 Dec 2002 11:06:51 -0000 1.33
--- Subs.pm 26 Dec 2002 01:34:50 -0000 1.34
***************
*** 20,24 ****
use Date::Parse qw(str2time);
use Date::Calc qw(Add_Delta_YMD);
! use Data::Dumper;
use GD::Graph ();
--- 20,24 ----
use Date::Parse qw(str2time);
use Date::Calc qw(Add_Delta_YMD);
! use Data::Dumper ();
[...1129 lines suppressed...]
+ if ($my_text->{$table}{$phase}{$element}) {
+ return $my_text->{$table}{$phase}{$element};
+ }
+ # value same for all tables
+ elsif ($my_text->{DEFAULT}{$phase}{$element}) {
+ return $my_text->{DEFAULT}{$phase}{$element};
+ }
+ # value same for all phases of this table
+ elsif ($my_text->{$table}{DEFAULT}{$element}) {
+ return $my_text->{$table}{DEFAULT}{$element};
+ }
+ # value same for all phases, all tables
+ elsif ($my_text->{DEFAULT}{DEFAULT}{$element}) {
+ return $my_text->{DEFAULT}{DEFAULT}{$element};
+ }
+ # no match whatsoever
+ return;
+ } # end specific_msg
|
|
From: <pla...@us...> - 2002-12-26 01:31:56
|
Update of /cvsroot/appwrap/AppWrap/Apache/AppWrap
In directory sc8-pr-cvs1:/tmp/cvs-serv31488
Modified Files:
Pager.pm
Log Message:
fixed bug in even numbered 'sb' query string args; more i18n.
Index: Pager.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AppWrap/Pager.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** Pager.pm 21 Dec 2002 11:08:21 -0000 1.16
--- Pager.pm 26 Dec 2002 01:31:53 -0000 1.17
***************
*** 18,25 ****
use AppWrap qw(%config);
use Apache::AppWrap::Subs qw($dbh $HNL);
- use Date::Format;
- use Date::Parse;
- use Date::Calc qw(Week_of_Year);
- use Data::Dumper;
use vars qw($VERSION);
use Apache::Log ();
--- 18,21 ----
***************
*** 27,31 ****
use Apache::Constants qw(:common);
! $Apache::AppWrap::Pager::VERSION = "0.07";
# 13Dec02. Replaced "alt" attributes with "title" in <img> tags
# 03Dec02. convert to my_tables table_type directive
--- 23,27 ----
use Apache::Constants qw(:common);
! $Apache::AppWrap::Pager::VERSION = "0.08";
# 13Dec02. Replaced "alt" attributes with "title" in <img> tags
# 03Dec02. convert to my_tables table_type directive
***************
*** 62,73 ****
! my $kv = $opts->{valid_kv} || $opts->{args}{kv};
! $kv ||= $opts->{args}{idnum};
! # default sort order for this table
! my $sb = $opts->{args}{sb} || $args->{default_sort};
! $sb ||= $my_tables->{$table}{default_sort} || 1;
! #print Dumper($source);
! my $r = Apache::Request->instance( Apache->request );
#$test = scalar(@$source);
#$log->debug("\npaginator: source=$test.");
--- 58,68 ----
! my $kv = $opts->{valid_kv} || $opts->{args}{kv};
! $kv ||= $opts->{args}{idnum};
! # default sort order for this table
! my $sb = $opts->{args}{sb} || $args->{default_sort};
! $sb ||= $my_tables->{$table}{default_sort} || 1;
! my $r = Apache::Request->instance( Apache->request );
#$test = scalar(@$source);
#$log->debug("\npaginator: source=$test.");
***************
*** 143,171 ****
my $sb = $order * 2 - 1;
$sort_hash{$sb} = fill_sort($sb, $column, $label);
! $sb = $order * 2 - 1;
$sort_hash{$sb} = fill_sort($sb, $column, $label);
}
my $sort_by = $sort_hash{$sb}{sql};
# %args shares with downstream subs data which should
! # not be persistent between requests.
my %args = (
- 'caller' => 'paginator',
element => 'title',
sort_hash => \%sort_hash,
);
- # this is how we get display text
- my $msgs = $opts->{display_text};
- $msgs ||= Apache::AppWrap::Subs::get_display_text($opts);
- unless ($msgs) {
- my $text = 'paginator: display_text not found in %opts.';
- $r->log_error($text);
- return SERVER_ERROR;
- }
- $opts->{display_text} ||= $msgs;
- $opts->{msgs} = $msgs;
-
$args{kv} = $kv if $kv;
--- 138,157 ----
my $sb = $order * 2 - 1;
$sort_hash{$sb} = fill_sort($sb, $column, $label);
! $sb = $order * 2;
$sort_hash{$sb} = fill_sort($sb, $column, $label);
}
+ #$test = join("\n", map {$_ . '=>' . $sort_hash{$_}{label} } sort {$a <=> $b} keys %sort_hash);
+ #$log->debug("\npaginator: sort_hash=\n$test.");
my $sort_by = $sort_hash{$sb}{sql};
# %args shares with downstream subs data which should
! # not be persistent between requests. $args{caller} will
! # come from $opts->{phase}.
my %args = (
element => 'title',
sort_hash => \%sort_hash,
);
$args{kv} = $kv if $kv;
***************
*** 176,187 ****
}
! # save title for &Webify
! $opts->{Title} = Apache::AppWrap::Subs::chk_txt($opts, \%args);
# subtitles are not mandatory: some tables have none.
$args{element} = 'subtitle';
$args{sb_label} = $sort_hash{$sb}{label};
# save subitle for &Webify
$opts->{SubTitle} = Apache::AppWrap::Subs::chk_txt($opts, \%args);
#$log->debug("\npaginator: sb=$sb, $sort_hash{$sb}{column}.");
--- 162,180 ----
}
! # save title for &Webify. Upstream sub may already have
! # populated the Title element, so test for that
! unless (exists $opts->{Title}) {
! $args{element} = 'title';
! my $title = Apache::AppWrap::Subs::chk_txt($opts, \%args);
! $opts->{Title} = $title;
! }
# subtitles are not mandatory: some tables have none.
+ unless (exists $opts->{SubTitle}) {
$args{element} = 'subtitle';
$args{sb_label} = $sort_hash{$sb}{label};
# save subitle for &Webify
$opts->{SubTitle} = Apache::AppWrap::Subs::chk_txt($opts, \%args);
+ }
#$log->debug("\npaginator: sb=$sb, $sort_hash{$sb}{column}.");
***************
*** 230,236 ****
# an array ref.
sort { lc($b->[3][0]) cmp lc($a->[3][0]) }
! map {
! [$_, $row = $_, $column = $sort_column, eval $sort_eval]
! } @$source;
}
else {
--- 223,229 ----
# an array ref.
sort { lc($b->[3][0]) cmp lc($a->[3][0]) }
! map {
! [$_, $row = $_, $column = $sort_column, eval $sort_eval]
! } @$source;
}
else {
***************
*** 238,242 ****
@$sorted_data = map { $_->[0] }
sort { lc($a->[3][0]) cmp lc($b->[3][0]) }
! map { [$_, $row = $_, $column = $sort_column, eval $sort_eval] } @$source;
} # end $sb IF
} # end 'indirect_sort' IF
--- 231,237 ----
@$sorted_data = map { $_->[0] }
sort { lc($a->[3][0]) cmp lc($b->[3][0]) }
! map {
! [$_, $row = $_, $column = $sort_column, eval $sort_eval]
! } @$source;
} # end $sb IF
} # end 'indirect_sort' IF
***************
*** 267,271 ****
#$test = scalar(@$sorted_data);
#$log->debug("\npaginator: rows=$test.");
! ############## end of massive sort section ####################
# Calculate which rows to grab for this page. We want to grab one
--- 262,266 ----
#$test = scalar(@$sorted_data);
#$log->debug("\npaginator: rows=$test.");
! ############## end of sort section ####################
# Calculate which rows to grab for this page. We want to grab one
***************
*** 297,307 ****
}
! my $row_count = scalar(@$to_display) if $to_display;
! $opts->{row_count} = $row_count;
! ######## this is the visualization icon section ########
! # start the table with a div so we can control it a bit.
! # This <div> actually encompasses more than a single table.
! # We could manage that better, but we are trying to hurry
! # to get the site presentable again for the next release.
# get the data_header section
--- 292,303 ----
}
! my $row_count = scalar(@$to_display) if $to_display;
! $opts->{row_count} = $row_count;
!
! ######## this is the data_header section ########
! # start the table with a div so we can control it a bit.
! # This <div> actually encompasses more than a single table.
! # We could manage that better, but we are trying to hurry
! # to get the site presentable again for the next release.
# get the data_header section
***************
*** 310,320 ****
push @rows, map $_, @$data_header;
}
! push @rows, '<!-- start the table data from &paginator -->' . $HNL;
! push @rows, '<div id="pager">' . $HNL;
- ############################################################
- # code works, but display not working, possible issue with browser
- # compliance to standards?
- ############################################################
# print the data column headings.
# hash "%hh" <col> tags preceed the <tr> tags so we have to loop an
--- 306,312 ----
push @rows, map $_, @$data_header;
}
! push @rows, '<!-- start the table data from &paginator -->' . $HNL;
! push @rows, '<div id="pager">' . $HNL;
# print the data column headings.
# hash "%hh" <col> tags preceed the <tr> tags so we have to loop an
***************
*** 418,422 ****
$all .= '<a href="' . $config{homeurl} . $r->uri;
$all .= '?sb=' . $sort{$column};
- # $all .= '<a href="' . $r->uri . '?sb=' . $sort{$column};
# this is used by Display handler, $kv won't exist for
# reports
--- 410,413 ----
***************
*** 551,556 ****
# convert a line of all white space to a html space
$value =~ s/^\s+$/\ /;
! $value =~ s!(
! )!<br />!g;
$value =~ s!\n!<br />!g;
$out .= $value;
--- 542,547 ----
# convert a line of all white space to a html space
$value =~ s/^\s+$/\ /;
! # trying to replace a newline embedded in the data
! # $value =~ s!()!<br />!g;
$value =~ s!\n!<br />!g;
$out .= $value;
***************
*** 571,575 ****
push @rows, $out;
} # end of columns loop
- # $opts->{table} = $table;
push @rows, '</tr>' . $HNL;
--- 562,565 ----
***************
*** 675,679 ****
# right cell, get any data navigation icons
my $nav;
! unless (exists $opts->{args}{top_summary}) {
$nav = navigate($opts, $args);
}
--- 665,670 ----
# right cell, get any data navigation icons
my $nav;
! unless (exists $opts->{args}{top_summary} ||
! $my_tables->{$table}{table_type} eq 'report') {
$nav = navigate($opts, $args);
}
***************
*** 698,720 ****
###############################
sub visualize {
! my ($opts, $args) = @_;
! my $r = Apache->request;
! my $log = $r->log;
! my $my_tables = $opts->{my_tables};
! my $table = $opts->{table};
! my $my_columns = $opts->{my_columns};
! my $my_defaults = $opts->{my_defaults};
! my $msgs = $opts->{display_text};
! # bail if visualization not enabled
! # might also check for the existence of the required CPAN modules(s)
! # and bail if not found
! return unless $my_defaults->{dv_enabled};
! # bail if this is a tab summary, visualization useless.
! # bail if visualization would be meaningless
! return if $r->uri =~ m/focus|audit/;
! # list of visualizations. Must exist in table:my_defaults, and
! # have TRUE value. We use the name with leading 'dv_' removed.
my @dv_types = grep {
/^dv_/ && $my_defaults->{$_} && s/^dv_//
--- 689,711 ----
###############################
sub visualize {
! my ($opts, $args) = @_;
! my $r = Apache->request;
! my $log = $r->log;
! my $my_tables = $opts->{my_tables};
! my $table = $opts->{table};
! my $my_columns = $opts->{my_columns};
! my $my_defaults = $opts->{my_defaults};
! my $msgs = $opts->{display_text};
! # bail if visualization not enabled
! # might also check for the existence of the required CPAN modules(s)
! # and bail if not found
! return unless $my_defaults->{dv_enabled};
! # bail if this is a tab summary, visualization useless.
! # bail if visualization would be meaningless
! return if $r->uri =~ m/focus|audit/;
! # list of visualizations. Must exist in table:my_defaults, and
! # have TRUE value. We use the name with leading 'dv_' removed.
my @dv_types = grep {
/^dv_/ && $my_defaults->{$_} && s/^dv_//
***************
*** 734,739 ****
# wrap the images in a <div> tag
push @rows, ' <div class="icons">' . $HNL;
- # # wrap the images in a <p> tag
- # push @rows, ' <p>';
# create the links
foreach my $dv (@dv_types) {
--- 725,728 ----
***************
*** 788,799 ****
############################
sub navigate {
! my ($opts, $args) = @_;
! my $table = $opts->{table};
! my $my_tables = $opts->{my_tables};
! my $my_columns = $opts->{my_columns};
! my $my_defaults = $opts->{my_defaults};
! my $msgs = $opts->{display_text};
! my $r = Apache->request;
! my $idnum = $opts->{args}{idnum};
my $sb = $opts->{args}{sb};
--- 777,788 ----
############################
sub navigate {
! my ($opts, $args) = @_;
! my $table = $opts->{table};
! my $my_tables = $opts->{my_tables};
! my $my_columns = $opts->{my_columns};
! my $my_defaults = $opts->{my_defaults};
! my $msgs = $opts->{display_text};
! my $r = Apache->request;
! my $idnum = $opts->{args}{idnum};
my $sb = $opts->{args}{sb};
***************
*** 809,819 ****
# $args is a hash ref so that receiving subs can modify
! # values which later subs will see.
! $args->{'caller'} = 'navigate';
$args->{label} = $link_vars->{label};
$args->{sb} = $sb;
$args->{current_unit} = $opts->{args}{page} || 1;
- # $test = join(", ", keys %$args);
- #$log->debug("\nnavigate: keys=$test");
my $rc = nav_series($opts, $args);
--- 798,807 ----
# $args is a hash ref so that receiving subs can modify
! # values which later subs will see. Respect 'caller'
! # value set by upstream subs.
! $args->{'caller'} ||= 'navigate';
$args->{label} = $link_vars->{label};
$args->{sb} = $sb;
$args->{current_unit} = $opts->{args}{page} || 1;
my $rc = nav_series($opts, $args);
***************
*** 830,834 ****
} @{ $opts->{col_order} };
-
my @rows;
# start the <div>
--- 818,821 ----
***************
*** 841,845 ****
my $navigate_title = Apache::AppWrap::Subs::chk_txt($opts, $args);
# add a little space to make the HTML more readable
! push @rows, ' ' . $navigate_title . $HNL;
# get the sequence info. Dynamic values are embedding
--- 828,832 ----
my $navigate_title = Apache::AppWrap::Subs::chk_txt($opts, $args);
# add a little space to make the HTML more readable
! push @rows, ' ' . $navigate_title . $HNL if $navigate_title;
# get the sequence info. Dynamic values are embedding
***************
*** 849,853 ****
my $sequence = Apache::AppWrap::Subs::chk_txt($opts, $args);
# add a little space to make the HTML more readable
! push @rows, ' ' . $sequence . $HNL;
# call the sub to populate navigation icons
--- 836,840 ----
my $sequence = Apache::AppWrap::Subs::chk_txt($opts, $args);
# add a little space to make the HTML more readable
! push @rows, ' ' . $sequence . $HNL if $sequence;
# call the sub to populate navigation icons
***************
*** 876,884 ****
$args->{by_vals} = \@by_vals;
my $nav_popup = nav_popup($opts, $args);
! # unless ($nav_popup ) {
! # my $msg = 'navigate: nav_popup returned undef or no data.';
! # $r->log_error($msg);
! # return SERVER_ERROR;
! # }
push @rows, map ($_, @$nav_popup);
}
--- 863,871 ----
$args->{by_vals} = \@by_vals;
my $nav_popup = nav_popup($opts, $args);
! unless ($nav_popup || scalar(@$nav_popup)) {
! my $msg = 'navigate: nav_popup returned undef or no data.';
! $r->log_error($msg);
! return SERVER_ERROR;
! }
push @rows, map ($_, @$nav_popup);
}
***************
*** 886,894 ****
push @rows, $text . $HNL;
! # close the <div>
! $text = '</div> <!-- end of navigate section -->';
! push @rows, $text . $HNL;
! return \@rows;
} # end &navigate
--- 873,881 ----
push @rows, $text . $HNL;
! # close the <div>
! $text = '</div> <!-- end of navigate section -->';
! push @rows, $text . $HNL;
! return \@rows;
} # end &navigate
***************
*** 931,935 ****
my $sb = $order * 2 - 1;
$sort_hash{$sb} = fill_sort($sb, $column, $label);
! $sb = $order * 2 - 1;
$sort_hash{$sb} = fill_sort($sb, $column, $label);
}
--- 918,922 ----
my $sb = $order * 2 - 1;
$sort_hash{$sb} = fill_sort($sb, $column, $label);
! $sb = $order * 2;
$sort_hash{$sb} = fill_sort($sb, $column, $label);
}
***************
*** 961,969 ****
if ($sb) {
$order_by = $sort_hash{$sb}{column};
- # $order_by = $sort_hash{$sb}{column} . ' ASC';
}
else {
$order_by = $by;
- # $order_by = $by . ' ASC';
}
--- 948,954 ----
***************
*** 1031,1034 ****
--- 1016,1020 ----
$rows_per ||= $my_defaults->{rows_per};
+ # error check the value is available.
unless ($row_count) {
my $msg = 'nav_series: number id rows undefined.';
***************
*** 1047,1055 ****
$args->{previous_unit} = $page - 1;
}
! #$log->debug("\nnav_series: total_rows=$total_rows, row_count=$row_count, rows_per=$rows_per.");
! # to get the value of the highest row number in
! # the current data set subtract 1 from the page,
! # then multiply this value time the number of rows
! # on each page, finally add 1.
my $max_current_row = $page * $rows_per + 1;
if ( $total_rows >= $max_current_row ) {
--- 1033,1040 ----
$args->{previous_unit} = $page - 1;
}
! # to get the value of the highest row number in the
! # current data set subtract 1 from the page, then
! # multiply this value time the number of rows on each
! # page, finally add 1.
my $max_current_row = $page * $rows_per + 1;
if ( $total_rows >= $max_current_row ) {
***************
*** 1080,1085 ****
my $by = $opts->{args}{by} || 'idnum';
! # these values are used by some of the ALT messages
! $args->{'caller'} = 'nav_icons';
my $img_dir = $config{imageurl} || $config{homeurl};
--- 1065,1071 ----
my $by = $opts->{args}{by} || 'idnum';
! # these values are used by the ALT messages. An upstream
! # sub may have set the value.
! $args->{'caller'} ||= 'nav_icons';
my $img_dir = $config{imageurl} || $config{homeurl};
***************
*** 1091,1095 ****
$img_dir .= '/' . $config{images};
! # get the height and width of the navigation icons
my $img_height = $my_defaults->{navigate_img_height};
unless ($img_height) {
--- 1077,1082 ----
$img_dir .= '/' . $config{images};
! # get the height and width of the navigation icons. They
! # must exist so test for them
my $img_height = $my_defaults->{navigate_img_height};
unless ($img_height) {
***************
*** 1123,1127 ****
last if (! exists $opts->{args}{idnum} && $icon eq 'edit');
$args->{element} = 'alt_' . $icon;
- #$log->debug("\nnavigate: icon=$icon, raw_alt=$raw_alt.");
my $alt = Apache::AppWrap::Subs::chk_txt($opts, $args);
my $url = $config{homeurl} . '/' . $table . '/' . $icon;
--- 1110,1113 ----
***************
*** 1230,1238 ****
my $selected = '';
# @values is the list of product_id to display
foreach my $column (@{ $args->{by_vals} }) {
- # next if $column =~ /$my_defaults->{default_picklist}/o;
my $label = $my_columns->{$table}{$column}{label};
- # determine if a value is among the defaults by comparing each
- # default ($_) with the current product number ($value)
my $menu = ' <option';
# make this the displayed column if it is the $by value
--- 1216,1223 ----
my $selected = '';
# @values is the list of product_id to display
+ # populate the popup menu. 'selected' is set for the
+ # field indicated by the value of $sb
foreach my $column (@{ $args->{by_vals} }) {
my $label = $my_columns->{$table}{$column}{label};
my $menu = ' <option';
# make this the displayed column if it is the $by value
|
|
From: <pla...@us...> - 2002-12-26 01:30:12
|
Update of /cvsroot/appwrap/AppWrap/Apache
In directory sc8-pr-cvs1:/tmp/cvs-serv31044
Modified Files:
AW_User.pm
Log Message:
Cleaned up treatment of source column in &query_source.
Index: AW_User.pm
===================================================================
RCS file: /cvsroot/appwrap/AppWrap/Apache/AW_User.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** AW_User.pm 5 Dec 2002 04:02:56 -0000 1.8
--- AW_User.pm 26 Dec 2002 01:30:08 -0000 1.9
***************
*** 30,34 ****
use Apache::File ();
! $Apache::AW_User::VERSION = "0.05";
# 30Nov02. &make_download_catalyst links display nicer with
# non-breaking spaces.
--- 30,35 ----
use Apache::File ();
! $Apache::AW_User::VERSION = "0.06";
! # 22Dec02. Cleaned up treatment of source column in &query_source.
# 30Nov02. &make_download_catalyst links display nicer with
# non-breaking spaces.
***************
*** 917,921 ****
# passes.
$hash_row = { 'tablename'=>$tablename, 'date'=>$date, 'idnum'=>$idnum, 'col_list'=>[ @col_list] };
- # $hash_row = { 'tablename'=>$tablename, 'date'=>$date, 'idnum'=>$idnum, 'col_list'=>[ @col_list] };
push @$chgs, $hash_row;
# re-initialize @col_list
--- 918,921 ----
***************
*** 1193,1248 ****
# 20 Jan. Same as &my_columns, except returns a hash ref
###############################
! sub ops_vbar {
! my $opts = shift;
!
! my $table = $opts->{table};
! my $label;
! my $vb_style = $opts->{my_tables}{$table}{vbar_table_style};
! my @rows;
!
! my $log = Apache->request->log;
! # is this a summary?
! my $summary = $opts->{args}{top_summary};
! $label = ucfirst($summary) . ' Summary' if $summary;
! $label ||= $opts->{my_tables}{$table}{label};
!
! # make vbar a table
! my $tab_start = '<table';
! $tab_start .= ' style="' . $vb_style . '"' if $vb_style;
! $tab_start .= ' width="100%"><tr><td>' . $HNL;
! push @rows, $tab_start;
!
! # not tested yet
! my $link_vars = Apache::AppWrap::Subs::cclinks($opts);
! $label = $link_vars->{label};
! my $region = $opts->{args}{region};
! my $regional = '<p class="topicheader">' . $label . '<br /> by Region</p>' . $HNL;
! push @rows, $regional if $region;
!
! # actual regional links
! my $ref = region_links($opts);
! # if ($region && $ref) {
! if ($region && $ref && scalar(@$ref)) {
! push @rows, join("", @$ref);
! # foreach (@$ref) {
! # push @rows, $_ . $HNL;
! # }
! }
!
! # display recently changed items in the left side area
! $ref = Apache::AppWrap::Subs::recent_changes($opts);
! push @rows, join("", @$ref) if $ref && scalar(@$ref);
!
! $ref = make_download_catalyst ($opts);
! push @rows, join("", @$ref) if $ref && scalar(@$ref);
!
! $ref = Apache::AppWrap::Subs::favorites ($opts);
! push @rows, join("", @$ref) if $ref && scalar(@$ref);
!
! # close out the vbar table wrapper
! push @rows, '</td></tr></table>';
!
! return \@rows;
! } # end &ops_vbar
--- 1193,1248 ----
# 20 Jan. Same as &my_columns, except returns a hash ref
###############################
! #sub ops_vbar {
! # my $opts = shift;
! #
! # my $table = $opts->{table};
! # my $label;
! # my $vb_style = $opts->{my_tables}{$table}{vbar_table_style};
! # my @rows;
! #
! # my $log = Apache->request->log;
! # # is this a summary?
! # my $summary = $opts->{args}{top_summary};
! # $label = ucfirst($summary) . ' Summary' if $summary;
! # $label ||= $opts->{my_tables}{$table}{label};
! #
! # # make vbar a table
! # my $tab_start = '<table';
! # $tab_start .= ' style="' . $vb_style . '"' if $vb_style;
! # $tab_start .= ' width="100%"><tr><td>' . $HNL;
! # push @rows, $tab_start;
! #
! # # not tested yet
! # my $link_vars = Apache::AppWrap::Subs::cclinks($opts);
! # $label = $link_vars->{label};
! # my $region = $opts->{args}{region};
! #
! # if ($region) {
! # my $regional = '<p class="topicheader">' . $label;
! # $regional .= '<br /> by Region</p>' . $HNL;
! # push @rows, $regional;
! #
! # # actual regional links
! # my $ref = region_links($opts);
! # if ($ref && scalar(@$ref)) {
! # push @rows, join("", @$ref);
! # }
! # }
! #
! # # display recently changed items in the left side area
! # my $ref = Apache::AppWrap::Subs::recent_changes($opts);
! # push @rows, join("", @$ref) if $ref && scalar(@$ref);
! #
! # $ref = make_download_catalyst ($opts);
! # push @rows, join("", @$ref) if $ref && scalar(@$ref);
! #
! # $ref = Apache::AppWrap::Subs::favorites ($opts);
! # push @rows, join("", @$ref) if $ref && scalar(@$ref);
! #
! # # close out the vbar table wrapper
! # push @rows, '</td></tr></table>';
! #
! # return \@rows;
! #} # end &ops_vbar
***************
*** 1255,1276 ****
###############################
sub ops_header {
! my $opts = shift;
! my $table = $opts->{table};
! my $my_tables = $opts->{my_tables};
! my $label;
! # is this a summary request?
! my $summary = $opts->{args}{top_summary};
! if ($summary) {
! $label = ucfirst($summary) . ' Summary';
! # SubTitle usually added by paginator, but summary's don't use
! # paginator
! $opts->{SubTitle} = eval $my_tables->{summary}{subtitle};
! }
! # if its not a summary, get the traditional label
! $label ||= $my_tables->{$table}{label};
! my $region = $opts->{args}{region};
$table = $summary . 'summary' if $summary;
--- 1255,1270 ----
###############################
sub ops_header {
! my $opts = shift;
! my $table = $opts->{table};
! my $my_tables = $opts->{my_tables};
! my $label;
! # is this a summary request?
! my $summary = $opts->{args}{top_summary};
! # if its not a summary, get the traditional label
! $label = $my_tables->{$table}{label};
! my $region = $opts->{args}{region};
$table = $summary . 'summary' if $summary;
***************
*** 1930,1986 ****
# returns a reference to an array of hashes.
# create query statement for dashboard info
! # 13 Aug. 01. repairs allowing 'contact' to be an integer like '
# 'project_id' and 'product_id'
# 24 Jan. 01. repairs for download
###################################
sub get_dashboard_data {
! my $opts = shift;
! my $table = $opts->{table};
! # set the label for display titles
! my $link_vars = Apache::AppWrap::Subs::cclinks( $opts );
! my $label = $link_vars->{label};
! # my $log = Apache->request->log;
#$log->debug("\nget_dashboard_data: got here.");
! my $src_fields = Apache::AppWrap::Subs::query_source($opts);
! $opts->{src_fields} = $src_fields;
! # list the column names for query
! my $select = $src_fields->{select};
! my $from = $src_fields->{from};
! $from .= ',contacts';
!
! my $where = 'projects.contact=contacts.idnum AND contacts.country=regions.country';
! $where .= ' AND projects.stage>11 AND projects.stage<21';
! my $other = '';
! my $filter = $opts->{args}{filter};
! if ($filter && $filter eq 'none') {
! $where = 'projects.contact=contacts.idnum AND contacts.country=regions.country';
! }
! elsif ($filter && $filter eq 'completed') {
! $where = 'projects.contact=contacts.idnum AND contacts.country=regions.country';
! $where .= ' AND projects.stage>16 AND projects.stage <21';
! }
#$log->debug("\nget_dashboard_data: where1=$where.");
! $opts->{Title} = $label;
! # loop through all args, skipping some. This is what makes the
! # cumulative filter by column value work.
! # foreach (my ($k,$v) = each %{ $opts->{args} }) {
! while (my ($k,$v) = each %{ $opts->{args} }) {
! # skip $sb and $page, as they may be in the query string, but
! # they are not in the table
! next if $k eq 'sb';
! next if $k eq 'page';
! next if $k eq 'filter';
! next if $k eq 'download_flag';
! # quote the data
! my $v_q = $dbh->quote( $v ) if $v;
! $where .= ' AND ' . $k . '=' . $v_q;
! # $where .= ' AND ' . $k . '=' . $v;
! }
#$log->debug("\nget_dashboard_data: where2=$where.");
! return Apache::AppWrap::Subs::sqlSelectHashRef($select,$from,$where,$other);
} # end get_dashboard_data
--- 1924,1981 ----
# returns a reference to an array of hashes.
# create query statement for dashboard info
! # 13 Aug. 01. repairs allowing 'contact' to be an integer like
# 'project_id' and 'product_id'
# 24 Jan. 01. repairs for download
###################################
sub get_dashboard_data {
! my $opts = shift;
! my $table = $opts->{table};
! # set the label for display titles
! my $link_vars = Apache::AppWrap::Subs::cclinks( $opts );
! my $label = $link_vars->{label};
! my $log = Apache->request->log;
#$log->debug("\nget_dashboard_data: got here.");
+ my $src_fields = Apache::AppWrap::Subs::query_source($opts);
+ $opts->{src_fields} = $src_fields;
+ # list the column names for query
+ my $select = $src_fields->{select};
+ #$log->debug("\nget_dashboard_data: select=$select.");
+ my $from = $src_fields->{from};
+ $from .= ',contacts';
! my $where = 'projects.contact=contacts.idnum';
! $where .= ' AND contacts.country=regions.country';
! $where .= ' AND projects.stage>11 AND projects.stage<21';
! my $other;
! my $filter = $opts->{args}{filter};
! if ($filter && $filter eq 'none') {
! $where = 'projects.contact=contacts.idnum';
! $where .= ' AND contacts.country=regions.country';
! }
! elsif ($filter && $filter eq 'completed') {
! $where = 'projects.contact=contacts.idnum';
! $where .= ' AND contacts.country=regions.country';
! $where .= ' AND projects.stage>16 AND projects.stage<21';
! }
#$log->debug("\nget_dashboard_data: where1=$where.");
! $opts->{Title} = $label;
! # loop through all args, skipping some. This is what makes the
! # cumulative filter by column value work.
! while (my ($k,$v) = each %{ $opts->{args} }) {
! # skip $sb and $page, as they may be in the query string, but
! # they are not in the table
! next if $k eq 'sb';
! next if $k eq 'page';
! next if $k eq 'filter';
! next if $k eq 'download_flag';
! # quote the data
! my $v_q = $dbh->quote( $v ) if $v;
! $where .= ' AND ' . $k . '=' . $v_q;
! }
#$log->debug("\nget_dashboard_data: where2=$where.");
! return Apache::AppWrap::Subs::sqlSelectHashRef($select,$from,$where,$other);
} # end get_dashboard_data
|