diff options
author | Events <events> | 1999-08-02 01:30:13 +0000 |
---|---|---|
committer | Events <events> | 1999-08-02 01:30:13 +0000 |
commit | 5f39d3c86364e81469f6f973099fb7974b7181aa (patch) | |
tree | a6e2cf0e09b889dfae264be271034c752730bf8e /english/events/index.wml | |
parent | 46cd58ca4fc79684c9e1d6d0976485bf75392b2b (diff) |
This contains the docs for the new index.wml functions. Please read and
comment.
CVS version numbers
english/events/index.wml: 1.16 -> 1.17
english/events/index.wml.README: INITIAL -> 1.1
Diffstat (limited to 'english/events/index.wml')
-rw-r--r-- | english/events/index.wml | 166 |
1 files changed, 156 insertions, 10 deletions
diff --git a/english/events/index.wml b/english/events/index.wml index 05378baaabd..d109d604121 100644 --- a/english/events/index.wml +++ b/english/events/index.wml @@ -85,7 +85,6 @@ sub get_event_list { close FILE; if ($count eq $number) { last; } } -close DIR; if ( $over eq "" && $current eq "" && $unknown eq "" ) { $str = "$path - [<none_word>]<BR>"; @@ -99,27 +98,174 @@ else } return $str; } + +# get_past_event_list +# This finds out if the given year (or any years if none are given) has any +# events that have past. If there are it provides links. +# +# Sun Aug 1 18:11:02 EDT 1999 +# Added. Code is mostly stolen from get_event_list(); +# - blackie@sfcc.net + + +sub get_past_event_list { +my $str = ''; +my @paths = (); +my ($current_dir, $path, $monthorder, $yearorder ) = @_; +if ($path ne '') { + push(@paths,$path); +} + +if ($path eq '') { + ($sec,$min,$hour,$mday,$month,$year,$wday,$yday,$isdst) = localtime(time); + # This is not a y2k bug. + $year += '1900'; + $path = $year; + while (1) { + if ( -d "$current_dir/$path") { + push(@paths,$path); + $path--; + } else { + last; + } + } + if ($yearorder ne 'futurefirst') { + @paths = reverse @paths; + } +} + +foreach $path (@paths) { + opendir(DIR, "$current_dir/$path") || last; + @files = grep { /^\d+.*.wml$/ && -f "$current_dir/$path/$_" } readdir(DIR); + @files = sort @files; + closedir DIR; + foreach (@files) { + open(FILE, "<$path/$_") || open(FILE, "<$current_dir/$path/$_"); + if ( /(\d+.*).wml/ ) { + $base = $1; + } + my $past = ''; + foreach $line (<FILE>) { + if ($line =~ /^#use wml::debian::past_event$/) { + $past = 'yes'; + last; + } + } + if ($past eq 'yes') { + $str .= "<A HREF=\"./$path/\">$path - <past_words></A><BR>"; + last; + } + close FILE; + } +} +return $str; +} + + +# get_future_event_list +# This displays future events in whatever order the translator asks. +# +# Sun Aug 1 18:11:02 EDT 1999 +# Added. Code is mostly stolen from get_event_list(); +# - blackie@sfcc.net + +sub get_future_event_list { +my $str; +my @paths; +my ($current_dir, $path, $monthorder, $yearorder ) = @_; + +if ($path ne '') { + push(@paths,$path); +} +if ($path eq '') { + ($sec,$min,$hour,$mday,$month,$year,$wday,$yday,$isdst) = localtime(time); + # This is not a y2k bug. + $year += '1900'; + $path = $year; + while (1) { + if ( -d "$current_dir/$path") { + push(@paths,$path); + $path++; + } else { + last; + } + } + if ($yearorder eq 'futurefirst') { + @paths = reverse @paths; + } +} + +foreach $path (@paths) { +my $events = ''; +my @files = (); +opendir(DIR, "$current_dir/$path") || last; +@files = grep { /^\d+.*.wml$/ && -f "$current_dir/$path/$_" } readdir(DIR); +@files = sort @files; +if ($monthorder eq 'decfirst') { + @files = reverse @files; +} + +closedir DIR; +foreach (@files) { +open(FILE, "<$path/$_") || open(FILE, "<$current_dir/$path/$_"); + if ( /(\d+.*).wml/ ) { + $base = $1; + } +my $title = ''; my $when = ''; my $where = ''; my $desc = ''; my $past = ''; + foreach $line (<FILE>) { + if ($line =~ /^#use wml::debian::past_event$/) { + $past = 'yes'; + last; + } + if ($line =~ /^<define-tag pagetitle>(.*)<\/define-tag>$/) { + $title = $1; + } + elsif ($line =~ /^<define-tag date>(.*)<\/define-tag>$/) { + $when = $1; + } + elsif ($line =~ /^<define-tag where>(.*)<\/define-tag>$/) { + $where = $1; + } + elsif ($line =~ /^<define-tag desc>(.*)<\/define-tag>$/) { + $desc = $1; + } + } +if ($past ne 'yes') { + if ($title && $when && $where) { + $events .= "<TR><TD width=120><TT>[$when]</TT></TD><TD><STRONG> <A HREF=\"$path/$base\">$title</A></STRONG> ($where)</TD></TR>\n"; + } + elsif ($title && $when) { + $events .= "<TR><TD width=120><TT>[$when]</TT></TD><TD><STRONG> <A HREF=\"$path/$base\">$title</A></STRONG></TD></TR>\n"; + } +} +close FILE; +} +$str .= "<H3>$path <event_word></H3><TABLE>$events</TABLE>"; +} + +return $str; +} + </perl> <p> <intro> # -# I'm not exactly sure how this design is mentally conceptualized by others. -# So, at the request of the all important user, I've moved these around -# to be more asthetically pleasing. -# -# All I've done thus far is comment out the 1999 line and add it to the top. +# This has been redone. See index.wml.README for details. Email me if +# you have any difficulties. # # - blackie@sfcc.net -<:= get_event_list ('1999', '0', '$(ENGLISHDIR)/events' ) :> +<:= get_future_event_list('$(ENGLISHDIR)/events','','','futurefirst') :> + +#<:= get_event_list ('1999', '0', '$(ENGLISHDIR)/events' ) :> -<:= get_event_list ('2000', '0', '$(ENGLISHDIR)/events' ) :> +#<:= get_event_list ('2000', '0', '$(ENGLISHDIR)/events' ) :> -# <:= get_event_list ('1999', '0', '$(ENGLISHDIR)/events' ) :> +#<:= get_event_list ('1998', '0', '$(ENGLISHDIR)/events' ) :> -<:= get_event_list ('1998', '0', '$(ENGLISHDIR)/events' ) :> +<:= get_past_event_list('$(ENGLISHDIR)/events','','','futurefirst') :> <:= languages() :> #use wml::debian::footer |