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

spliting /users



Hi,

I've worked a bit on a way to split the /users page into several shorter
ones, the result can be seen here:
     http://people.debian.org/~bertol/users

modified and new template files are attached.

comments welcome.


Nicolas Bertolissio
-- 
Index: recent_list.wml
===================================================================
RCS file: /cvs/webwml/webwml/english/template/debian/recent_list.wml,v
retrieving revision 1.127
diff -u -r1.127 recent_list.wml
--- recent_list.wml	18 Jan 2005 18:14:24 -0000	1.127
+++ recent_list.wml	6 Mar 2005 18:52:30 -0000
@@ -210,10 +210,20 @@
 	$format, $match, @files) = @_;
     my ($over, $current, $str);
     my (%str, %count, %over, %current);
+    my $is_users;
 
     my $count = 0;
+    # decide, if we reading an users file
+    if ($WML_SRC_DIRNAME =~ /users/) {
+	$is_users = 1;
+	@files = sort {lc($a) cmp lc($b)} @files;
+    }
     foreach $file (@files) {
 	(my $trans_title = $file) =~ s/wml/title/;
+	if ($is_users) {
+	    $eng_dir =~ /^(?:.*\/)?(.*)$/;
+	    $trans_title = "$1/$file"; 
+	}
 	$count++;
 	my $str1 = "";
 	my @str1 = (); # for bydate
@@ -248,7 +258,8 @@
 	 }
 
 	my ($title, $date, $rdate, $rvdate, $hdate, $desc, $status,
-	    $where, $moreinfo, $startdate, $enddate, $repfile, $just);
+	    $where, $moreinfo, $startdate, $enddate, $repfile, $just,
+	    $webpage, $usersfile);
 	my (@hdate, @rdate, @isodate) = ();
 	<protect pass=2>
 	if ($content =~ /^<define-tag pagetitle>\s*(.*?)\s*<\/define-tag>$/ms) {
@@ -276,6 +287,12 @@
 	    $repfile = $1; }        # Report (events)
 	if ($content =~ /<report\s+href="([^"]*)\s*"\/?>/ms) { #"
             $repfile = $1; }        # Report (events)
+	if ($content =~ /^<define-tag webpage>\s*(.*?)\s*<\/define-tag>$/ms) {
+	    $webpage = qq/$1/; }    # users
+	if ($is_users) {
+	    $eng_dir =~ /^(?:.*\/)?(.*)$/;
+	    $usersfile = "$1/$shortfile"; 
+	}
 	</protect>
 	$hdate = $date || $startdate;
 	#warn "file=$file hdate=$hdate date=$date rdate=$rdate\n";
@@ -431,6 +448,9 @@
 	    else { $str1 .= "$status"; }
 	    $str1 .= "<br />$elememptyfoot\n";
 	}
+	elsif ($title && $is_users) { # users
+	    $str .= "$elemhead<a href=\"$usersfile\">$title</a>$elemrelfoot\n";
+	}
 
 	if (!$is_by_date || ($hdate eq "")) {
 	    $hdate = $count;
@@ -476,6 +496,7 @@
 	if ($over) {
 	    $str .= "<h2><past_events/></h2>\n$listhead\n$over\n$listfoot\n";
 	}
+    } elsif ($is_users) {
     } else {
 	$str = pick_recent( $since_date, $minnum, \%str, \%count);
     }
#use wml::debian::common_translation
#use wml::debian::common_tags
#use wml::debian::languages
#use wml::debian::basic title="<pagetitle/>"

<define-tag returnusers whitespace=delete>
  <gettext>Back to the <a href="../">Who's using Debian? page</a>.</gettext>
</define-tag>

{#check_trans#}

<h1>
  <: $t="<pagetitle/>"; $w="<webpage/>"; if ($w eq "") { print "$t"; }
     else { print "<a href=\"$w\">$t</a>"; }
  :>
</h1>

{#mainbody#}

{#pre_footer#:
<hrlinehidden/>

<returnusers/>

<hrline/>

<ifeq "$(NOLANGUAGES)" "" "
<:= languages_footer() :>
"/>
:#pre_footer#}

{#mainbody#:

Attachment: signature.asc
Description: Digital signature


Reply to: