openpgp: 8A48C6AC
[www.jankratochvil.net.git] / WebConfig.pm
index 1e5db17..514da55 100644 (file)
@@ -20,8 +20,9 @@
 
 package WebConfig;
 require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
-use vars qw($VERSION);
+use vars qw($VERSION $CVS_ID);
 $VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+$CVS_ID=q$Id$;
 use strict;
 use warnings;
 
@@ -30,10 +31,102 @@ use vars qw(@ISA @EXPORT);
 @ISA=qw(Exporter);
 @EXPORT=qw(%WebConfig);
 
+use My::Web;
+
+
+my $resume_url="/resume/ResumeJanKratochvil.pm/ResumeJanKratochvil.html";
+
+sub vskip_hr($) { return "<hr />\n".My::Web::vskip("1ex"); }
+
+# Only to be used privately by My::Web !
 our %WebConfig=(
                "admin_mail"=>'web-www.jankratochvil.net@jankratochvil.net',
-               "viewcvs"=>map({ (!$_ ? $_ : s#^/#http://cvs.jankratochvil.net/viewcvs/energie/#); } $ENV{"SCRIPT_NAME"}),
+               "cvs_id_author_sub"=>sub {
+                       my($name)=@_;
+                               return My::Web::a_href("http://www.jankratochvil.net/","Jan Kratochvil") if 0
+                                               || $name eq "short"
+                                               || $name eq "lace";
+                               return escapeHTML($name);
+                       },
+#              "viewcvs_My"=>"http://cvs.jankratochvil.net/viewcvs/MyWeb/",
+#              "viewcvs"=>"http://cvs.jankratochvil.net/viewcvs/www/www.jankratochvil.net/",
+               "viewcvs_My"=>"http://git.jankratochvil.net/?p=MyWeb.git;a=blob;hb=HEAD;f=",
+               "viewcvs"=>"http://git.jankratochvil.net/?p=www.jankratochvil.net.git;a=blob;hb=HEAD;f=",
                "title_prefix"=>"Jan Kratochvil",
+#              "project_viewcvs"=>"http://cvs.jankratochvil.net/viewcvs/",
+               "project_viewcvs"=>"http://git.jankratochvil.net/",
+#              "pserver"=>':pserver:pserver:@cvs.jankratochvil.net',
+#              "pserver_path"=>"/cvs",
+               "resume_url"=>$resume_url,
+#              "mailman_url"  =>sub { return "http://".$My::Web::W->{"web_hostname"}."/mailman/"; },
+#              "pipermail_url"=>sub { return "http://".("www2.jankratochvil.net"||$My::Web::W->{"web_hostname"})."/pipermail/"; },
+               "heading"=>sub () {
+                       my $r="";
+                       $r.='<table border="0" style="font-size: larger;" class="margin-center"><tr>'."\n";
+                               # Do not: <col width="20%" /><col width="50%" /><col width="20%" />
+                               # as the constant are always bad.
+                               $r.='<td>'."\n";
+                                       $r.='<table border="1"'
+                                                       .' style="border-collapse: collapse; border-style: solid; border-width: 2px;">'
+                                                       .'<tr><td style="padding: 5px; font-weight: bold;">'."\n";
+                                                               $r.='Jan Kratochvil';
+#                                                                      $r.=My::Web::a_href('http://www.jankratochvil.net/','Jan Kratochvil',
+#                                                                                      "attr"=>'style="text-decoration: inherit; /* revoke underline */;"');
+                                       $r.='</td></tr></table>';
+                               $r.='</td>'."\n";
+                               $r.='<td>'."\n";
+                                       $r.='<table border="1"'
+                                                       .' style="text-align: center; border-collapse: collapse; border-style: solid; border-width: 2px;">'
+                                                       .'<tr>'."\n";
+                                               my @sections=(
+                                                               "/project/"=>"Projects",
+                                                               "/product/"=>"Products",
+                                                               "http://git.jankratochvil.net/"=>"GIT",
+#                                                                                      "/News.pm"=>"News",
+                                                               $resume_url=>"Resume",
+                                                               "/Contact.pm"=>"Contact",
+                                                               );
+                                               while (@sections) {
+                                                       my $section_path=shift @sections;
+                                                       my $section_name=shift @sections;
+                                                       my $class="";
+                                                       if ($section_path=~m{^/(.*)$}) {
+                                                               $class=$1;
+                                                               $class=~s{/}{::}g;
+                                                               $class=~s{[.]pm$}{};
+                                                               }
+                                                       my $chosen=($class && $My::Web::W->{"__PACKAGE__"}=~/^\Q$class\E/);
+                                                       $r.='<td style="padding: 5px;">';
+                                                               $r.=(($My::Web::W->{"section"} || "") eq $section_name ? "<b>$section_name</b>"
+                                                                               : My::Web::a_href($section_path,$section_name,
+                                                                                               "attr"=>($chosen
+                                                                                                               ? 'style="text-decoration: underline; font-weight: bold;"'
+                                                                                                               : 'style="text-decoration: inherit; /* revoke underline */"')));
+                                                       $r.="</td>\n";
+                                                       }
+                                       $r.='</tr></table>'."\n";
+                               $r.='</td>'."\n";
+                       $r.='</tr></table>'."\n";
+                       if (!$My::Web::W->{"heading_novskip"}) {
+                               $r.=WebConfig->vskip_hr();
+                               }
+                       return $r;
+                       },
+               ###"footing"=>"<h1>footing</h1>\n",
+               "footing_delimit_sub_push"=>sub () {
+                       return if $My::Web::W->{"no_job"};
+                       print <<"HERE";
+<table border="0" style="padding: 2ex; background: #552222; color: white;" class="margin-center">
+       <tr><td>
+               <b>Contractor - Software Engineer:</b>
+               Please check if your planned project
+               @{[ My::Web::a_href($My::Web::W->{"resume_url"},'matches my experience',"attr"=>'style="color: inherit;"') ]},
+       </td></tr>
+</table>
+HERE
+                       },
+               "no_job"=>1,
+               "css_inherit"=>1,
                );
 
 1;