[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Listing also minor events on www.d.o/events



Hi Luca, events team and www team,

[debian-www cc-ed as in my not-completed patch are included template
changes]

On Tue, Oct 04, 2011 at 09:46:56AM +0200, Luca Capello wrote:
> Hi Francesca!
> 
> From an Events POV, is there anything urgent we should do?  Like #613832
> or #634986, as well as the "minor events" modifications, for which IIRC
> you already have a working prototype.
> 
> Best,
> Luca

Sorry for the delay in replying this: Luca is talking here about the idea
to have, in www.d.o/events page, not only the list of upcoming event but
also one for upcoming talk (it happens often that there are interesting
debian-related talks not included in a major event and we discuss during
Debconf the possibility of better promoting them).

Here some explanations about how that part of the site works and what
I've done in the past months about it (hoping that people who already
knows all this will not too bored).

Relevant files for this kind of change are:

1) webwml/english/events/index.wml → this is the source for
   www.d.o/events which contains the list of upcoming (and past) events

2) webwml/english/events/index.include → here there are Perl subroutines
(embedded in wml tags) needed to create the (upcoming|past) events lists
themselves and are called at lines 22 and 43 of the index.wml file

3) all webwml/english/events/$year/$date-event.wml files, which are
modeled on the webwml/english/events/event.form one

4) webwml/english/template/debian/event.wml and
webwml/english/template/debian/event_common.wml: this two are the
templates responsible of the design of each event page and - as it could
be seen on event.form file - are called via #use wml::debian::event line

So, we need first to create the file(s) (and relative templates) for each
talk (using the same structure as the event ones) and then add
subroutines (or change the existent ones) in order to generate also list
for upcoming and past talks.

For the first task, I've simply create templates
(webwml/english/template/debian/talk.wml and
webwml/english/template/debian/talk_common.wml) copying them from the
event's ones; while the file itself for a single talk is based on the
webwml/english/events/talk.form file, in which is shown the use of the
define-tag for talk.

This part of the patch is completed and it works. You can test it using
the file webwml/english/events/2011/0422-slat.wml (attached).

The second part of the patch needs love: my Perl-fu is unexistant, so I
encountered some problems in make it works.

To list also talks file on index.wml page (or better in the html page)
I've added two specific subroutines adapting the existing ones and
modifying the index.wml page.
The idea here was to distinguish between talk and event file (they lie in
the same $year directory) via a regexp based on the use of different
templates. But I can't make it works: I need that the upcoming_events
thinghie distinguish between upcoming and past event AND upcoming and
past talks. 

Obviously we could also put talks and events files on different dir
inside the $year dir: something like $year/events and $year/talks, and
let Perl to parse only the relevant dir. I prefer the first solutions,
but... is up to who will work on it! :)

Thank you Luca for your help on it,

Cheers,
Francesca

ps: I attach new files and the diff of the existent ones.


-- 
"People assume that time is a strict progression of cause to effect,
but actually from a non-linear, non-subjective viewpoint is more 
like a big ball of wibbly wobbly, timey wimey... stuff."
							The Doctor
<define-tag abbr>SLAT</define-tag>
<define-tag year>2011</define-tag>
<define-tag pagetitle><ttitle/></define-tag>
<define-tag where>Taipei, Taiwan</define-tag>
<define-tag date>2011-04-22</define-tag>
<define-tag time>18:30</define-tag>
<define-tag infolink>http://translate.google.com/translate?hl=en&sl=zh-CN&tl=en&u=http%3A%2F%2Fregistrano.com%2Fevents%2Fdebian2</define-tag>

<define-tag ttitle>How to get involved in Debian and Open Source - everyone
counts!</define-tag>
<define-tag author>Joerg Jaspert</define-tag>
<define-tag lang>English</define-tag>
<define-tag abstract>
blabla
</define-tag>

#use wml::debian::talk

<ul>
	<li><a href="http://people.debian.org/~joerg/";>Joerg's page</a></li>
Index: index.include
===================================================================
RCS file: /cvs/webwml/webwml/english/events/index.include,v
retrieving revision 1.18
diff -u -u -r1.18 index.include
--- index.include	15 Apr 2011 21:58:38 -0000	1.18
+++ index.include	27 Oct 2011 15:18:13 -0000
@@ -67,6 +67,7 @@
   my $events = '';
   my @files = ();
   my $upcoming = 0;
+  my @upev = '';
 
   opendir DIR, "$current_dir/$path" || die "Can't open $current_dir/$path: $!";
   @files = grep { /^\d+.*.wml$/ && -f "$current_dir/$path/$_" } readdir DIR;
@@ -74,6 +75,26 @@
   closedir DIR;
 
   foreach (@files) {
+  my $event = '';
+  my @event = ();
+
+    open FILE, "$path/$_" or open FILE, "$current_dir/$path/$_" or die "something went wrong, check permissions on $current_dir/$path/$_";
+    foreach (<FILE>) { if (/^#use wml::debian::event$/) { $event = 'yes'; last; } }
+     close FILE;
+  if ($event eq 'yes') {
+    push @event, <FILE>;
+    last;
+  }
+}
+
+#
+#  foreach (@files) {
+#    open FILE, "$path/$_" or open FILE, "$current_dir/$path/$_" or die "something went wrong, check permissions on $current_dir/$path/$_";
+#    while ($line =~ /^#use wml::debian::event\s*$/) {
+#    push @upev, <FILE> }
+#    close FILE;
+#}
+  foreach (@event) {
     open FILE, "$path/$_" or open FILE, "$current_dir/$path/$_" or die "something went wrong, check permissions on $current_dir/$path/$_";
     if ( /(\d+.*).wml/ ) {
        $base = $1;
@@ -82,10 +103,15 @@
     my $startdate = ''; my $enddate = '';
     foreach $line (<FILE>) {
 <protect pass=2>
-      if ($line =~ /^#use wml::debian::past_event\s*$/) {
-          $past = 'yes';
-          last;
-      }
+#      if ($line =~ /^#use wml::debian::past_event\s*$/) {
+#          $past = 'yes';
+#          last;
+#      }
+#      if ($line =~ /^#use wml::debian::(past_talk|talk)\s*$/) {
+#      	  $talk = 'yes';
+#	  last;
+#	}	
+
       if ($line =~ /^\s*<define-tag pagetitle>(.*)<\/define-tag>\s*$/) {
           $title = $1;
       }
@@ -137,4 +163,126 @@
 return $str;
 }
 
+
+# get_past_talks_list
+#
+
+sub get_past_talks_list {
+my $current_dir = "$(ENGLISHDIR)/events";
+my $path = $CUR_YEAR;
+my $str = '';
+my $past = '';
+
+# check if the current year has any past talks.
+opendir DIR, "$current_dir/$path" || die "Can't open $current_dir/$path: $!";
+@files = grep { /^\d+.*.wml$/ && -f "$current_dir/$path/$_" } readdir DIR;
+@files = sort @files;
+closedir DIR;
+
+foreach (@files) {
+  open FILE, "$path/$_" or open FILE, "$current_dir/$path/$_" or die "something went wrong, check permissions on $current_dir/$path/$_";
+  foreach (<FILE>) { if (/^#use wml::debian::past_talk$/) { $past = 'yes'; last; } }
+  close FILE;
+  if ($past eq 'yes') {
+    $str .= "  <a href=\"$path/\"> $path</a>, ";
+    last;
+  }
+}
+
+# if it's a year that's not the current year and it's > 1999, assume it has at least one
+# past event and thus include it in $str. no need to waste resources
+# checking it.
+for ($path = $(CUR_YEAR) - 1; $path > 1999 ; $path--) {  
+    $str .= "  <a href=\"$path/\"> $path</a>,\n"
+    if -d "$(ENGLISHDIR)/events/$path";
+}
+<bind-gettext-domain domain="vendors" />
+$str .= "  <a href=\"1999/\">1999</a> <gettext domain="vendors">and</gettext> <a href=\"1998/\">1998</a>\.</p> ";
+return $str;
+}
+
+# get_future_talks_list
+
+#sub get_future_talks_list {
+#my $current_dir = "$ENGLISHDIR/events";
+#my $path = $CUR_YEAR;
+#my $str;
+#my @paths;
+#
+#while (1) {
+#  if ( -d "$current_dir/$path") {
+#    push(@paths,$path);
+#    $path++;
+#  } else {
+#    last;
+#  }
+#} 
+#
+#foreach $path (@paths) {
+#  my $talks = '';
+#  my @files = ();
+#  my $upcoming = 0;
+#
+#  opendir DIR, "$current_dir/$path" || die "Can't open $current_dir/$path: $!";
+#  @files = grep { /^\d+.*.wml$/ && -f "$current_dir/$path/$_" } readdir DIR;
+#  @files = sort @files;
+#  closedir DIR;
+#
+#  foreach (@files) {
+#    open FILE, "$path/$_" or open FILE, "$current_dir/$path/$_" or die "something went wrong, check permissions on $current_dir/$path/$_";
+#    if ( /(\d+.*).wml/ ) {
+#       $base = $1;
+#    }
+#    my $title = ''; my $when = ''; my $where = ''; my $author= ''; my $past = '';
+#    foreach $line (<FILE>) {
+#<protect pass=2>
+#      if ($line =~ /^#use wml::debian::past_talk\s*$/) {
+#          $past = 'yes';
+#          last;
+#      }
+#      if ($line =~ /^\s*<define-tag ttitle>(.*)<\/define-tag>\s*$/) {
+#          $title = $1;
+#      }
+#      elsif ($line =~ /^\s*<define-tag date>(.*)<\/define-tag>\s*$/) {
+#         $when = $1;
+#      }
+#      elsif ($line =~ /^\s*<define-tag where>(.*)<\/define-tag>\s*$/) {
+#         $where = $1;
+#      }
+#      elsif ($line =~ /^\s*<define-tag author>(.*)<\/define-tag>\s*$/) {
+#         $author = $1;
+#      }
+#</protect>
+#    }
+#    close FILE;
+#    if ($past ne 'yes') {
+#       if ($title && $author && $when && $where) {
+#          $upcoming++;
+#          $events .= "
+#<tr>\n
+#  <td><tt>[$when]</tt></td>\n
+#  <td><strong> <a href=\"$path/$base\">$title</a>, $author</strong> ($where)</td>\n
+#</tr>\n
+#";
+#       }
+#       elsif ($title && author && $when) {
+#          $events .= "
+#<tr>\n
+#  <td><tt>[$when]</tt></td>\n
+#  <td><strong> <a href=\"$path/$base\">$title</a>, $author</strong></td>\n
+#</tr>\n
+#";
+#       }
+#    }
+#  }
+#  $str .= sprintf "<table>\n<tr><th align=\"left\"><talk_year></th></tr>\n$talks\n</table>\n", $path
+#	if ($upcoming);
+#}
+#
+#return $str;
+#}
+
+
+
+
 </perl>
Index: index.wml
===================================================================
RCS file: /cvs/webwml/webwml/english/events/index.wml,v
retrieving revision 1.43
diff -u -u -r1.43 index.wml
--- index.wml	9 Feb 2011 18:34:23 -0000	1.43
+++ index.wml	27 Oct 2011 15:18:31 -0000
@@ -12,15 +12,21 @@
 &lt;<email "events@debian.org">&gt;.</p>
 
 <define-tag event_year>Events in %d</define-tag>
+<define-tag talk_year>Talks in %d</define-tag>
 <define-tag past_words>past events</define-tag>
 <define-tag none_word>none</define-tag>
 
 #include "$(ENGLISHDIR)/events/index.include"
 
-<h3>Upcoming Events with Debian Involvement</h3>
+<h3>Upcoming Debian events</h3>
 
 <:= get_future_event_list(); :>
 
+<h3>Upcoming Debian talks</h3>
+
+#<:get_future_talks_list(); :>
+
+
 <h3>Organizing Debian presence</h3>
 
 <ul>
@@ -35,10 +41,16 @@
   <li> <a href="admin">Jobs</a> for events@debian.org
 </ul>
 
-<h3>Past Events</h3>
+<h3>Past events</h3>
 
 <p>This year's events that have passed, and the events from the previous
 years can be viewed using the following pages:
 
 <:= get_past_event_list(); :>
 
+<h3>Past talks</h3>
+<p>This year's events that have passed, and the events from the previous
+years can be viewed using the following pages:
+
+<:= get_past_talks_list(); :>
+
<define-tag abbr>CHOOSE AN ABBREVIATION</define-tag>
<define-tag year>2011</define-tag>
<define-tag pagetitle><ttitle/></define-tag>
<define-tag where>LOCATION, COUNTRY</define-tag>
<define-tag date>YYYY-MM-DD</define-tag>
<define-tag time>HH:MM</define-tag>
<define-tag infolink>LINK</define-tag>


<define-tag ttitle>TITLE OF THE TALK</define-tag>
<define-tag author>AUTHOR</define-tag>
<define-tag lang>TALK'S LANGUAGE</define-tag>

<define-tag abstract>
	Put a description of the talk or the abstract if there is one.
</define-tag>

#use wml::debian::talk
#Related Links here (free form)
#use wml::debian::talk_common
#use wml::debian::basic title="<pagetitle/>"
#use wml::debian::languages

{#check_trans#}

<h2><ttitle/></h2>

<strong><langwhen/>:</strong> <date/> <time/><br />

	<strong><langwhere/>:</strong> <where/><br />
<: if (length ("<infolink/>")) { :>
	<strong><langinfo/>:</strong>  <a href="<infolink/>"><infolink/></a><br />
<: } :>
<: if (<year> >= 2003) {
    print qq'    <a href="$(WML_SRC_BASENAME).$(CUR_ISO_LANG).ics"><getics></a>\n';
} :>

<br /><br /><br />

<q><ttitle></q><br />
<langauthor/> <author/><br />
<languages/> <lang><br />

<hrline/>

<abstract/>


<:
  if (open (PAGE, "$WML_SRC_FILENAME")) {
    $go = 0;
    $use = 0;
    while (<PAGE>) {
      next until ($use || /^#use wml::debian::talk/);
      $use = 1;
      next if (/^#/ || /^\s*$/);
      $go =1;
    }
    close (PAGE);
  } else {
    $go = 1;
  }

  if ($go) {
:>

<h2><relatedlinks/></h2>

{#mainbody#}

<: } :>

{#pre_footer#:
<hrlinehidden/>

<:= languages_footer() :>
:#pre_footer#}

{#mainbody#:
#use wml::std::tags
#use wml::debian::common_translation
#use wml::debian::openrecode

<bind-gettext-domain domain="newsevents" />

<define-tag langwhere whitespace=delete>
  <gettext domain="newsevents">Where</gettext>:
</define-tag>
<define-tag langwhen whitespace=delete>
  <gettext domain="newsevents">When</gettext>:<date> <time>
</define-tag>
<define-tag langinfo whitespace=delete>
  <gettext domain="newsevents">More Info</gettext>:
</define-tag>
<define-tag langauthor whitespace=delete>
  <strong><gettext domain="newsevents">Author:</gettext></strong></define-tag>
<define-tag languages whitespace=delete>
 <strong> <gettext domain="newsevents">Language:</gettext></strong>
</define-tag> 
<define-tag relatedlinks whitespace=delete>
  <gettext domain="newsevents">Related Links</gettext>:
</define-tag>
<define-tag getics whitespace=delete>
  <gettext domain="newsevents">Download calendar entry</gettext>
</define-tag>


<perl>
#############################################################################
# grabs the date and title of the last $number news items from directory $path.
# If $number is zero then all the news items are shown.
sub get_event_stuff {
  my ( $path, $number, $current_dir, $match ) = @_;

  opendir(DIR, "$current_dir/$path");
  @files = grep { /^$match.wml$/ && -f "$current_dir/$path/$_" } readdir(DIR);
  @files = sort {$b cmp $a} @files;
  closedir DIR;

	$str = '<tr><td>(<none/>)</td></tr>';

  $count = 0;
  foreach (@files) 
  {
     $count++;
     my $fh = openrecode("$path/$_", "$current_dir/$path/$_");
     if ( /($match).wml/ ) 
	 {
        $base = $1;
     }
     $pagetitle = ''; $date = ''; $time = ''; $author = ''; $title = '';
     $desc = '';
     <protect pass=2>
     foreach $line (<$fh>) 
	 {
        if ($line =~ /^<define-tag pagetitle>(.*)<\/define-tag>/) 
		{
           $pagetitle = $1;
        }
        elsif ($line =~ /^<define-tag date>(.*)<\/define-tag>/) 
		{
           $date = $1;
        }
        elsif ($line =~ /^<define-tag time>(.*)<\/define-tag>/) 
		{
           $time = $1;
        }
        elsif ($line =~ /^<define-tag author>(.*)<\/define-tag>/) 
		{
           $author = $1;
        }
	elsif ($line =~ /^<define-tag ttitle>(.*)<\/define-tag>/)
		{
	   $title = $1;
	}
        elsif ($line =~ /^<define-tag desc>(.*)<\/define-tag>/) 
		{
           $desc = $1;
        }
     </protect>
     		if ($date && $hour && $pagetitle)
		{
           $str = "<tt>[$date $hour]</tt> <strong><a href=\"$path/$base\">$pagetitle</a></strong><br />\n";
           last;
		}
		elsif ($pagetitle && $title && $author && $desc)
		{
           $str = "<tr><td><a href=\"$path/$base\">$pagetitle</a></td><td>$title</td><td>$author</td><td>$desc</td></tr>\n";
		   last;
		}
		elsif ($pagetitle && $author && $desc)
		{
           $str = "<tr><td><a href=\"$path/$base\">$pagetitle</a></td><td>$author</td><td>$desc</td></tr>\n";
		}
     }
     close $fh;
     if ($count eq $number) { last; }
  }
close DIR;
return $str;
}
</perl>

Attachment: signature.asc
Description: Digital signature


Reply to: