package ENH; use base qw (Exporter); BEGIN { use strict; use vars qw( $ustr $sstr @EXPORT ); require 5.000; @EXPORT = qw( OpenFrameSet ProcessFramesFile ProcessNoFramesFile ); use LiveGeez::File; use LiveGeez::Services; use LiveGeez::HTML; use Convert::Ethiopic::Date; use Convert::Ethiopic::String; use Convert::Ethiopic::Number; $ustr = new Convert::Ethiopic::String ( Convert::Ethiopic::System->new ( "UTF8" ) ); $sstr = new Convert::Ethiopic::String; } sub UpdateHTMLBuffer { my $file = shift; $file->{htmlData} =~ s//DateSomething($file->{request})/ie; $file->{htmlData} =~ s/{request})."{request}->{mainPage} eq "true" ); } sub writeMenuHeader { my $request = shift; my $sys = ( $request->{pragma} ) ? "$request->{sysOut}->{sysName}&pragma=$request->{pragma}" : $request->{sysOut}->{sysName} ; < HEADER } sub writeMailToUpdate { my $file = shift; my $string; my $mailToString = ( $file->{request}->{frames} eq "no" ) ? "mailToURL" : "parent.mailToURL" ; $string = qq(\n\n\n); $string; } sub DateSomething { my $r = shift; my $eu = new Convert::Ethiopic::Date ( "today" ); my $et = $eu->convert; # my $number = new Convert::Ethiopic::Number ( $et->{year}, $r->{sysOut} )->convert; # my $number = new Convert::Ethiopic::Number ( $et->{year} )->convert; my $n = new Convert::Ethiopic::Number ( $et->{year} ); $ustr->sysOut ( $r->{sysOut} ); $sstr->sysOut ( $r->{sysOut} ); my $number = $ustr->convert ( $n->convert ); my $etDayName = "" . $ustr->convert ( $et->getEthiopicDayName ) . "" ; $etDayName =~ s/"/\\"/g; my $string = "\n\n"; $string .= "\n \n" . "
" . $eu->getMonthName . " $eu->{date}, $eu->{year}" ; # my $englishName = $et->getEthiopicDayName; my $englishName = "Talbot"; $string .= $sstr->convert ( "ye".$r->{sysOut}->HTMLName." dre geS" ) . "{sysOut}->{sysName}\" onMouseOver=\"popLayer(); status='$englishName';return true;\" onMouseOut=\"hideLayer(-50)\">"; $et->{langOut} = $r->{sysOut}->{lang}; $string .= $ustr->convert ( $et->getMonthName . " $et->{date}፣ " ) . "$number
\n"; my $download = ( $r->{sysOut}->{lang} eq "tir" ) ? "tir-et.exe" : "amh-uni.exe" ; $string .= "
Welcome to the new ENH! You appear to be accessing the site for the first time or your configuration has been lost. The ENH now uses minty fresh Unicode by default. Please try installing our Unicode font and keyboard or any of the free fonts available on the Internet. Help is here for configuring IE 5.x and IE 4 for Ethiopic Unicode." if ( $r->{FirstTime} ); $string; } sub OpenFrameSet { my ( $request, $frame ) = ( shift, shift ); my $frameRoot = "misc/Frames"; my $file = $request->{file}; my $sysOut = $request->{sysOut}->{sysName}; my ( $fileSysOut, $sysPragmaOut ); $sysOut .= ".$request->{sysOut}->{xfer}" if ( $request->{sysOut}->{xfer} ne "notv" ); $sysPragmaOut = ( $request->{pragma} ) ? "$sysOut&pragma=$request->{pragma}" : $sysOut ; $fileSysOut = $request->{sysOut}->{sysName}; $fileSysOut .= ".$request->{sysOut}->{xfer}" if ( $request->{sysOut}->{xfer} ne "notv" ); $fileSysOut .= ".7-bit" if ( $request->{sysOut}->{'7-bit'} ); $fileSysOut .= ".$request->{sysOut}->{options}" if ( $request->{sysOut}->{options} ); $fileSysOut .= ".$request->{sysOut}->{lang}"; my $TOP = ( -e "$FileCacheDir/$frameRoot/addtop.$fileSysOut.html" ) ? "$FileCacheDir/$frameRoot/addtop.$fileSysOut.html" : "$scriptBase?sys=$sysPragmaOut&file=$frameRoot/addtop.sera.html" ; my $LEFT = ( -e "$FileCacheDir/$frameRoot/left.$fileSysOut.html" ) ? "$FileCacheDir/$frameRoot/left.$fileSysOut.html" : "$scriptBase?sys=$sysPragmaOut&file=$frameRoot/left.sera.html" ; my $RIGHT = ( -e "$FileCacheDir/$frameRoot/right.$fileSysOut.html" ) ? "$FileCacheDir/$frameRoot/right.$fileSysOut.html" : "$scriptBase?sysPragmaOut=$fileSysOut&file=$frameRoot/right.sera.html" ; my $cacheFile = $file; $cacheFile =~ s/sera/$fileSysOut/; $cacheFile .= ".gz"; my $FILE = ( -e "$FileCacheDir/$cacheFile" && $ENV{HTTP_ACCEPT_ENCODING} =~ "gzip" && $ENV{HTTP_USER_AGENT} !~ "MSIE" ) ? "$FileCacheDir/$cacheFile" : "$scriptBase?sys=$sysPragmaOut&file=$file&frames=skip" ; # my ( $FILE ) = "$scriptBase?sys=$sysPragmaOut&file=$file&frames=skip"; open (FRAME, "$webRoot/$frame") || $r->DieCgi ( "!: Can't Open $frame\n" ); while ( ) { s/LIVEGEEZFILE/$FILE/; s/LIVEGEEZTOP/$TOP/; s/LIVEGEEZLEFT/$LEFT/; s/LIVEGEEZRIGHT/$RIGHT/; print; } } sub ProcessFramesFile { my $f = LiveGeez::File->new ( $_[0] ); # # Read data into ->{htmlData} if file is cached. # if ( $f->{isCached} ) { $f->DisplayFromCache; } else { # # Translate buffer. # FileBuffer ( $f ); # # Retranslate buffer. # UpdateHTMLBuffer ( $f ); # # Display it! # $f->DisplayFileAndCache; } } sub ProcessNoFramesFile { my $r = shift; my $articleFile = $r->{file}; my $TEMPLATETOP = "misc/NoFrames/left.sera.html"; my $TEMPLATEBOT = "misc/NoFrames/right.sera.html"; my $f = LiveGeez::File->new ( $r ); #======================================================================= # # If we've done this before, just display and quit. # if ( $f->{isCached} ) { $f->DisplayFromCache; } else { #======================================================================= # # Otherwise create the file from components, display and cache. # #======================================================================= # # Top of File # $r->{file} = $TEMPLATETOP; my $top = LiveGeez::File->new ( $r ); #======================================================================= # # Middle of File # $f->{Title} = $1 if ( $f->{htmlData} =~ /([^<]+)<\/title>/is ); $f->{htmlData} =~ s/<(\/)?html>//ogi; $f->{htmlData} =~ s/<(\/)?head>//ogi; $f->{htmlData} =~ s/<title>([^>]+)<\/title>//ois; $f->{htmlData} =~ s/<(\/)?body([^>]+)?>//ogis; # $f->{htmlData} =~ s/<\/body>//i; #======================================================================= # # Bottom of File # $r->{file} = $TEMPLATEBOT; my $bot = LiveGeez::File->new ( $r ); #======================================================================= # # All together now... # $f->{htmlData} = $top->{htmlData} . $f->{htmlData} . $bot->{htmlData} ; $r->{file} = $articleFile; # # Translate buffer. # FileBuffer ( $f ); # # Retranslate buffer. # UpdateHTMLBuffer ( $f ); # # Display it. # $f->DisplayFileAndCache; } } 1; __END__ =head1 NAME ENH -- Specialized Front End to the LiveGe'ez Package. =head1 SYNOPSIS use ENH; =head1 DESCRIPTION ENH.pm is called by the "G.pl" script used at The Ethiopian New Headlines and Tobia for specialized file output for HTML formatting with frames, etc. =head1 AUTHOR Daniel Yacob, L<LibEth@EthiopiaOnline.Net|mailto:LibEth@EthiopiaOnline.Net> =head1 SEE ALSO S<perl(1). LiveGeez(3). Ethiopic(3). L<http://libeth.netpedia.net|http://libeth.netpedia.net>> =cut