From f37f652212eb6cb31136488d14d2c2a3908fe30a Mon Sep 17 00:00:00 2001 From: short <> Date: Sun, 28 Aug 2005 05:09:22 +0000 Subject: [PATCH] +Support for: $W->{"css_push"} $WebConfig{"web_hostname"} is now optional. +&a_href_inhibit for using &a_href before $W initialization (without URIs). --- Contact.pm | 4 +--- Index.pm | 2 +- WebConfig.pm | 1 - project/Lib.pm | 16 +++++++--------- project/Rel.pm | 4 +--- project/captive/CVS.pm | 3 +-- project/captive/Index.pm | 9 ++++----- project/captive/Press.pm | 4 +--- project/captive/Preview.pm | 4 +--- project/captive/TestimonialBrunoSantos.pm | 4 +--- project/captive/Thanks.pm | 4 +--- project/captive/doc/Macros.pm | 12 ++++-------- resume/ResumeJanKratochvil.pm | 4 +--- 13 files changed, 24 insertions(+), 47 deletions(-) diff --git a/Contact.pm b/Contact.pm index 0a5c947..73e982f 100644 --- a/Contact.pm +++ b/Contact.pm @@ -35,9 +35,7 @@ sub handler my $W=My::Web->init( "title"=>"Contact", "section"=>"Contact", - "head"=><<"HERE", - -HERE + "css_push"=>"./Contact.css", ); My::Web->heading(); diff --git a/Index.pm b/Index.pm index 576b2de..e620822 100644 --- a/Index.pm +++ b/Index.pm @@ -37,7 +37,7 @@ my $W=My::Web->init( $W->{"r"}->status(HTTP_MOVED_TEMPORARILY); -$W->{"r"}->headers_out()->{"Location"}="http://".$W->{"web_hostname"}."/project/"; +$W->{"r"}->headers_out()->{"Location"}=path_web "./project/","abs"=>1; exit 0; diff --git a/WebConfig.pm b/WebConfig.pm index 81d3fa2..9e4b4ea 100644 --- a/WebConfig.pm +++ b/WebConfig.pm @@ -53,7 +53,6 @@ our %WebConfig=( "pserver"=>':pserver:pserver:@cvs.jankratochvil.net', "pserver_path"=>"/cvs", "resume_url"=>$resume_url, - "web_hostname"=>sub { return "www.jankratochvil.net"; }, # $My::Web::W->{"r"}->hostname() "mailman_url" =>sub { return "http://".$My::Web::W->{"web_hostname"}."/mailman/"; }, "pipermail_url"=>sub { return "http://".$My::Web::W->{"web_hostname"}."/pipermail/"; }, "heading"=>sub () { diff --git a/project/Lib.pm b/project/Lib.pm index 67bc50a..86c900f 100644 --- a/project/Lib.pm +++ b/project/Lib.pm @@ -42,14 +42,14 @@ sub LIST_FILENAME() sub print_project { -my($class,$ListItem,%args)=@_; +my($class,$ListItem)=@_; - print "

".$W->{"title"}."

\n"; - do { print $_ if $_; } for ($args{"project_text_after_title"}); + print "

".$class->title($ListItem)."

\n"; + do { print $_ if $_; } for ($W->{"project_text_after_title"}); print $ListItem->{"description"}; print "
\n"; - print($args{"before_project_data"}||""); - return if $args{"no_project_data"}; + print($W->{"before_project_data"}||""); + return if $W->{"no_project_data"}; my @table=( {"key"=>"summary","text"=>"Summary"}, {"key"=>"license","text"=>"License","format"=>sub ($) { @@ -263,14 +263,12 @@ my($class,%args)=@_; or cluck "Error finding project name of the package: ".$args{"__PACKAGE__"}; my $ListItem=$class->name_to_hashref($args{"project_name"}); my $W=$class->SUPER::init( - "title"=>$class->title($ListItem), + "title"=>My::Web->a_href_inhibit(sub { return $class->title($ListItem); }), map(("rel_$_"=>'/project/Rel.pm?rel='.$_.'&project='.$args{"project_name"}),qw(prev next)), "rel_up"=>'/project/', # "rel_start"=>"/", # TODO:homepage + "css_push"=>"/project/Lib.css", %args, - "head"=>($args{"head"}||"").<<"HERE", - -HERE "heading_novskip"=>1, ); $class->heading(); diff --git a/project/Rel.pm b/project/Rel.pm index 196326a..ae0d5f3 100755 --- a/project/Rel.pm +++ b/project/Rel.pm @@ -67,9 +67,7 @@ for (0..$#projects) { } $W->{"r"}->status(HTTP_MOVED_TEMPORARILY); -$W->{"r"}->headers_out()->{"Location"}="http://".$W->{"web_hostname"} -# .":7680" # DEBUG - ."/project/".(!$target ? "" : "$target/"); +$W->{"r"}->headers_out()->{"Location"}=path_web "./".($target && "$target/"),"abs"=>1; exit 0; diff --git a/project/captive/CVS.pm b/project/captive/CVS.pm index 1b6f952..e3c40af 100755 --- a/project/captive/CVS.pm +++ b/project/captive/CVS.pm @@ -32,8 +32,7 @@ sub handler { my $W=project::Lib->init( "project_name"=>"captive", - "before_project_data"=> - '

'.a_href('./','Captive Main Page').'

'."\n", + "before_project_data"=>sub { return '

'.a_href('./','Captive Main Page').'

'."\n"; }, ); diff --git a/project/captive/Index.pm b/project/captive/Index.pm index 68e3114..b261d60 100755 --- a/project/captive/Index.pm +++ b/project/captive/Index.pm @@ -64,10 +64,8 @@ sub handler { my $W=project::Lib->init( "no_project_data"=>1, - "head"=><<"HERE", - -HERE - "project_text_after_title"=>"" + "css_push"=>"./Index.css", + "project_text_after_title"=>sub { return "" .'
' .'' .'' @@ -78,7 +76,8 @@ HERE .'' .'' .'' - .'
', + .''; + }, ); diff --git a/project/captive/Press.pm b/project/captive/Press.pm index 134d65e..245c0ed 100755 --- a/project/captive/Press.pm +++ b/project/captive/Press.pm @@ -31,9 +31,7 @@ sub handler { My::Web->init( "title"=>'Captive NTFS Internet Press', - "head"=><<"HERE", - -HERE + "css_push"=>"./Lib.css", "heading_novskip"=>1, "no_job"=>1, "force_charset"=>"utf-8", diff --git a/project/captive/Preview.pm b/project/captive/Preview.pm index ad82a68..5b485a2 100755 --- a/project/captive/Preview.pm +++ b/project/captive/Preview.pm @@ -31,9 +31,7 @@ sub handler { My::Web->init( "title"=>'Captive NTFS Technology Preview', - "head"=><<"HERE", - -HERE + "css_push"=>"./Preview.css", "heading_novskip"=>1, ); My::Web->heading(); diff --git a/project/captive/TestimonialBrunoSantos.pm b/project/captive/TestimonialBrunoSantos.pm index 69f4dcc..c541be7 100755 --- a/project/captive/TestimonialBrunoSantos.pm +++ b/project/captive/TestimonialBrunoSantos.pm @@ -31,9 +31,7 @@ sub handler { My::Web->init( "title"=>'Captive NTFS - Hospital of Castelo Branco', - "head"=><<"HERE", - -HERE + "css_push"=>"./Lib.css", "heading_novskip"=>1, "no_job"=>1, ); diff --git a/project/captive/Thanks.pm b/project/captive/Thanks.pm index 198d271..f5d14bc 100755 --- a/project/captive/Thanks.pm +++ b/project/captive/Thanks.pm @@ -31,9 +31,7 @@ sub handler { My::Web->init( "title"=>'Captive NTFS Thanks', - "head"=><<"HERE", - -HERE + "css_push"=>"./Lib.css", "heading_novskip"=>1, "no_job"=>1, ); diff --git a/project/captive/doc/Macros.pm b/project/captive/doc/Macros.pm index 3538249..c247d6f 100755 --- a/project/captive/doc/Macros.pm +++ b/project/captive/doc/Macros.pm @@ -105,16 +105,12 @@ sub init ($%) { my($class,%args)=@_; - $args{"__PACKAGE__"}||=caller(); - %args=( - "rel_start"=>"..", - "rel_up"=>".", - %args); My::Web->init( - "head"=><<"HERE", - -HERE + "css_push"=>"./Macros.css", "heading_novskip"=>1, + "rel_start"=>"..", # possibly overridable + "rel_up"=>".", # possibly overridable + "__PACKAGE__"=>caller(), # possibly overridable %args, ); diff --git a/resume/ResumeJanKratochvil.pm b/resume/ResumeJanKratochvil.pm index b2336d7..a59986d 100644 --- a/resume/ResumeJanKratochvil.pm +++ b/resume/ResumeJanKratochvil.pm @@ -59,9 +59,7 @@ my $W=My::Web->init( "section"=>"Resume", "heading"=>undef(), "footer"=>undef(), - "head"=><<"HERE", - -HERE + "css_push"=>"/resume/ResumeJanKratochvil.css", "args_check"=>{ "referees"=>'', # Do not bother with '^(?:(?i)referees)?$' "print"=>'^(?:print)?$', -- 1.8.3.1