[Debian-l10n-commits] r1183 - in /dl10n/trunk: Changelog lib/Debian/L10n/Html.pm

nekral-guest at users.alioth.debian.org nekral-guest at users.alioth.debian.org
Mon Aug 11 22:15:35 UTC 2008


Author: nekral-guest
Date: Mon Aug 11 22:15:35 2008
New Revision: 1183

URL: http://svn.debian.org/wsvn/?sc=1&rev=1183
Log:
	* lib/Debian/L10n/Html.pm: Added support for database with
	history. Generate the history in the coordination pages for
	by_package, by_type (not for by_date, by_translator, by_status,
	by_bug). Compared to the previous version, the tables look more
	similar from one sorting method to the other. More lines are
	displayed (except for the by_bug pages).

Modified:
    dl10n/trunk/Changelog
    dl10n/trunk/lib/Debian/L10n/Html.pm

Modified: dl10n/trunk/Changelog
URL: http://svn.debian.org/wsvn/dl10n/trunk/Changelog?rev=1183&op=diff
==============================================================================
--- dl10n/trunk/Changelog (original)
+++ dl10n/trunk/Changelog Mon Aug 11 22:15:35 2008
@@ -1,3 +1,12 @@
+2008-08-11  Nicolas François  <nicolas.francois at centraliens.net>
+
+	* lib/Debian/L10n/Html.pm: Added support for database with
+	history. Generate the history in the coordination pages for
+	by_package, by_type (not for by_date, by_translator, by_status,
+	by_bug). Compared to the previous version, the tables look more
+	similar from one sorting method to the other. More lines are
+	displayed (except for the by_bug pages).
+
 2008-08-11  Nicolas François  <nicolas.francois at centraliens.net>
 
 	* lib/Debian/L10n/Spider.pm: Define the SOAP object global. This

Modified: dl10n/trunk/lib/Debian/L10n/Html.pm
URL: http://svn.debian.org/wsvn/dl10n/trunk/lib/Debian/L10n/Html.pm?rev=1183&op=diff
==============================================================================
--- dl10n/trunk/lib/Debian/L10n/Html.pm (original)
+++ dl10n/trunk/lib/Debian/L10n/Html.pm Mon Aug 11 22:15:35 2008
@@ -124,7 +124,9 @@
       <th>File</th>
       <th><a href="$lang.by_translator.html">Translator</a></th>
       <th><a href="$lang.by_status.html">Status</a></th>
+      <th>Date</th>
       <th>Message</th>
+      <th><a href="$lang.by_bug.html">Bug</a></th>
     </tr>
   </thead>
 
@@ -132,66 +134,64 @@
 	;
 	my %t;
 	foreach my $pkg (sort (grep { $db->has_status($_) } $db->list_packages())) {
+		my %list = ();
+
+		# Only keep the last status per pkg#$type#$file (no history)
 		foreach my $statusline (@{$db->status($pkg)}) {
 			my ($type, $file, $date, $status, $translator, $list, $url, $bug_nb) = @{$statusline};
-			next	unless $status =~ /^(taf|maj|itt|rfr|lcfc)$/;
+			$list{"$type#$file"} = $statusline;
+		}
+
+		foreach my $k (keys %list) {
+			my ($type, $file, $date, $status, $translator, $list, $url, $bug_nb) = @{$list{$k}};
+
 			$date =~ s/^(\d\d\d\d)-(\d\d)-(\d\d).*$/$1$2$3/;
-			$t{$date} = 1;
-		}
-	}
-	foreach my $t (sort keys %t) {
-		my $curdate = $t;
+
+			push @{$t{$date}{$pkg}{$type}{$file}}, $list{$k};
+		}
+	}
+	foreach my $date (sort keys %t) {
+		my $curdate = $date;
 		$curdate =~ s/^(\d\d\d\d)(\d\d)(\d\d)$/$1-$2-$3/;
 		print $fh <<EOF
   <tbody>
-    <tr>
-      <td colspan="7"><h3>$curdate</h3></td>
-    </tr>
-EOF
-		;
-		foreach my $pkg (sort (grep { $db->has_status($_) } $db->list_packages())) {
-			my %l;
-			foreach my $statusline (@{$db->status($pkg)}) {
-				my ($type, $file, $date, $status, $translator, $list, $url, $bug_nb) = @{$statusline};
-				$date =~ s/^(\d\d\d\d)-(\d\d)-(\d\d).*$/$1$2$3/;
-				warn "$pkg\:$type\:$file does not specify the status\n"
-					unless defined $status;
-				next	unless defined $status;
-				next	unless $status =~ /^(taf|maj|itt|rfr|lcfc)$/;
-				$translator = "" if $status eq "taf";
-				$translator = "" if $status eq "maj";
-				next	unless $date == $t;
-
-				$date =~ s/\ \+0000//;
-				$list =~ /^(\d\d\d\d)-(\d\d)-(\d\d\d\d\d)$/;
-				$list = "<a href=\"http://lists.debian.org/debian-l10n-$LanguageList{$lang}/$1/debian-l10n-$LanguageList{$lang}-$1$2/msg$3.html\">[$1-$2-$3]</a>";
-
-				$bug_nb = $bug_nb ? "<a href=\"http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$bug_nb\">#$bug_nb</a>"
-						: "";
-
-				$l{$file} = [$type, $date, $status, $translator, $list, $url, $bug_nb];
-			}
-			foreach (sort keys %l) {
-				@_ = @{$l{$_}};
-				my $type = $_[0];
-				my $file = $_;
-				my $date = $_[1];
-				my $status = $_[2];
-				my $translator = $_[3];
-				my $list = $_[4];
-				my $url = $_[5];
-				my $bug_nb = $_[6];
-				print $fh <<EOF
+    <!--tr>
+      <td colspan="8"><h3>$curdate</h3></td>
+    </tr-->
+EOF
+		;
+		foreach my $pkg (sort keys %{$t{$date}}) {
+			foreach my $type (sort keys %{$t{$date}{$pkg}}) {
+				foreach my $file (sort keys %{$t{$date}{$pkg}{$type}}) {
+					foreach my $statusline (@{$t{$date}{$pkg}{$type}{$file}}) {
+						my ($stype, $sfile, $sdate, $status, $translator, $list, $url, $bug_nb) = @{$statusline};
+
+						$sdate =~ s/\ \+0000//;
+
+						$translator = "" if $status eq "taf";
+						$translator = "" if $status eq "todo";
+						$translator = "" if $status eq "maj";
+
+						$list =~ /^(\d\d\d\d)-(\d\d)-(\d\d\d\d\d)$/;
+						$list = "<a href=\"http://lists.debian.org/debian-l10n-$LanguageList{$lang}/$1/debian-l10n-$LanguageList{$lang}-$1$2/msg$3.html\">[$1-$2-$3]</a>";
+
+						$bug_nb = $bug_nb ? "<a href=\"http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$bug_nb\">#$bug_nb</a>"
+						                  : "";
+						print $fh <<EOF
 	  <tr class="$status">
 	    <td>$pkg</td>
 	    <td>$type</td>
 	    <td>$file</td>
 	    <td>$translator</td>
 	    <td>$status</td>
+	    <td>$sdate</td>
 	    <td>$list</td>
+	    <td>$bug_nb</td>
 	  </tr>
 EOF
-				;
+						;
+					}
+				}
 			}
 		}
 		print $fh <<EOF
@@ -221,57 +221,55 @@
       <th><a href="$lang.by_status.html">Status</a></th>
       <th><a href="$lang.by_date.html">Date</a></th>
       <th>Message</th>
+      <th>Bug</th>
     </tr>
   </thead>
 
 EOF
 	;
+
 	my %t;
+
 	foreach my $pkg (sort (grep { $db->has_status($_) } $db->list_packages())) {
+		my %list = ();
+
+		# Only keep the last status per pkg#$type#$file (no history)
 		foreach my $statusline (@{$db->status($pkg)}) {
 			my ($type, $file, $date, $status, $translator, $list, $url, $bug_nb) = @{$statusline};
+			$list{"$type#$file"} = $statusline;
+		}
+
+		foreach my $k (keys %list) {
+			my ($type, $file, $date, $status, $translator, $list, $url, $bug_nb) = @{$list{$k}};
+
 			next unless $bug_nb;
-			$t{$bug_nb} = 1;
-		}
-	}
-	foreach my $t (sort keys %t) {
+
+			push @{$t{$bug_nb}{$pkg}{$type}{$file}}, $list{$k};
+		}
+	}
+
+	foreach my $bug_nb (sort keys %t) {
 		print $fh <<EOF
   <tbody>
-    <tr>
-      <td colspan="7"><h3><a href=\"http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$t\">#$t</a></h3></td>
-    </tr>
-EOF
-		;
-		foreach my $pkg (sort (grep { $db->has_status($_) } $db->list_packages())) {
-			my %l;
-			foreach my $statusline (@{$db->status($pkg)}) {
-				my ($type, $file, $date, $status, $translator, $list, $url, $bug_nb) = @{$statusline};
-				warn "$pkg\:$type\:$file does not specify the status\n"
-					unless defined $status;
-				next	unless defined $status;
-				next	unless defined $bug_nb;
-				next	unless $bug_nb == $t;
-
-				$date =~ s/\ \+0000//;
-				$list =~ /^(\d\d\d\d)-(\d\d)-(\d\d\d\d\d)$/;
-				$list = "<a href=\"http://lists.debian.org/debian-l10n-$LanguageList{$lang}/$1/debian-l10n-$LanguageList{$lang}-$1$2/msg$3.html\">[$1-$2-$3]</a>";
-
-				$bug_nb = $bug_nb ? "<a href=\"http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$bug_nb\">#$bug_nb</a>"
-						: "";
-
-				$l{$file} = [$type, $date, $status, $translator, $list, $url, $bug_nb];
-			}
-			foreach (sort keys %l) {
-				@_ = @{$l{$_}};
-				my $type = $_[0];
-				my $file = $_;
-				my $date = $_[1];
-				my $status = $_[2];
-				my $translator = $_[3];
-				my $list = $_[4];
-				my $url = $_[5];
-				my $bug_nb = $_[6];
-				print $fh <<EOF
+    <!--tr>
+      <td colspan="8"><h3><a href=\"http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$bug_nb\">#$bug_nb</a></h3></td>
+    </tr-->
+EOF
+		;
+		foreach my $pkg (sort keys %{$t{$bug_nb}}) {
+			foreach my $type (sort keys %{$t{$bug_nb}{$pkg}}) {
+				foreach my $file (sort keys %{$t{$bug_nb}{$pkg}{$type}}) {
+					foreach my $statusline (@{$t{$bug_nb}{$pkg}{$type}{$file}}) {
+						my ($stype, $sfile, $date, $status, $translator, $list, $url, $sbug_nb) = @{$statusline};
+
+						$date =~ s/\ \+0000//;
+
+						$list =~ /^(\d\d\d\d)-(\d\d)-(\d\d\d\d\d)$/;
+						$list = "<a href=\"http://lists.debian.org/debian-l10n-$LanguageList{$lang}/$1/debian-l10n-$LanguageList{$lang}-$1$2/msg$3.html\">[$1-$2-$3]</a>";
+
+						$sbug_nb = $sbug_nb ? "<a href=\"http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$sbug_nb\">#$sbug_nb</a>"
+						                  : "";
+						print $fh <<EOF
 	  <tr class="$status">
 	    <td>$pkg</td>
 	    <td>$type</td>
@@ -280,9 +278,12 @@
 	    <td>$status</td>
 	    <td>$date</td>
 	    <td>$list</td>
+	    <td>$sbug_nb</td>
 	  </tr>
 EOF
-				;
+						;
+					}
+				}
 			}
 		}
 		print $fh <<EOF
@@ -308,6 +309,7 @@
       <th><a href="$lang.by_package.html">Package</a></th>
       <th><a href="$lang.by_type.html">Type</a></th>
       <th>File</th>
+      <th>Translator</th>
       <th><a href="$lang.by_status.html">Status</a></th>
       <th><a href="$lang.by_date.html">Date</a></th>
       <th>Message</th>
@@ -318,65 +320,79 @@
 EOF
 	;
 	my %t;
+
 	foreach my $pkg (sort (grep { $db->has_status($_) } $db->list_packages())) {
+		my %list = ();
+
+		# Only keep the last status per pkg#$type#$file (no history)
 		foreach my $statusline (@{$db->status($pkg)}) {
 			my ($type, $file, $date, $status, $translator, $list, $url, $bug_nb) = @{$statusline};
-			$t{$translator} = 1;
-		}
-	}
-	foreach my $t (sort keys %t) {
-		my $anchor = $t;
+			$list{"$type#$file"} = $statusline;
+		}
+
+		foreach my $k (keys %list) {
+			my ($type, $file, $date, $status, $translator, $list, $url, $bug_nb) = @{$list{$k}};
+
+			$translator = "" if $status eq "taf";
+			$translator = "" if $status eq "todo";
+			$translator = "" if $status eq "maj";
+
+			push @{$t{$translator}{$pkg}{$type}{$file}}, $list{$k};
+		}
+	}
+
+	foreach my $translator (sort keys %t) {
+		my $anchor = $translator;
 		$anchor =~ s/\s//g;
+
 		print $fh <<EOF
   <tbody>
-    <tr>
-      <td colspan="7"><h3 id="$anchor"><a href="$lang.by_translator.html#$anchor">$t</a></h3></td>
-    </tr>
-EOF
-		;
-		foreach my $pkg (sort (grep { $db->has_status($_) } $db->list_packages())) {
-			my %l;
-			foreach my $statusline (@{$db->status($pkg)}) {
-				my ($type, $file, $date, $status, $translator, $list, $url, $bug_nb) = @{$statusline};
-				warn "$pkg\:$type\:$file does not specify the status\n"
-					unless defined $status;
-				next	unless defined $status;
-				next	unless defined $translator;
-				$translator = "" if $status eq "taf";
-				$translator = "" if $status eq "maj";
-				next	unless $translator eq $t;
-
-				$date =~ s/\ \+0000//;
-				$list =~ /^(\d\d\d\d)-(\d\d)-(\d\d\d\d\d)$/;
-				$list = "<a href=\"http://lists.debian.org/debian-l10n-$LanguageList{$lang}/$1/debian-l10n-$LanguageList{$lang}-$1$2/msg$3.html\">[$1-$2-$3]</a>";
-
-				$bug_nb = $bug_nb ? "<a href=\"http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$bug_nb\">#$bug_nb</a>"
-						: "";
-
-				$l{$file} = [$type, $date, $status, $translator, $list, $url, $bug_nb];
-			}
-			foreach (sort keys %l) {
-				@_ = @{$l{$_}};
-				my $type = $_[0];
-				my $file = $_;
-				my $date = $_[1];
-				my $status = $_[2];
-				my $translator = $_[3];
-				my $list = $_[4];
-				my $url = $_[5];
-				my $bug_nb = $_[6];
-				print $fh <<EOF
-	  <tr class="$status">
+    <!--tr>
+      <td colspan="8"><h3 id="$anchor"><a href="$lang.by_translator.html#$anchor">$translator</a></h3></td>
+    </tr-->
+EOF
+		;
+		foreach my $pkg (sort keys %{$t{$translator}}) {
+			foreach my $type (sort keys %{$t{$translator}{$pkg}}) {
+				foreach my $file (sort keys %{$t{$translator}{$pkg}{$type}}) {
+					my $lastline = "";
+					foreach my $statusline (@{$t{$translator}{$pkg}{$type}{$file}}) {
+						my ($stype, $sfile, $date, $status, $stranslator, $list, $url, $bug_nb) = @{$statusline};
+
+						$date =~ s/\ \+0000//;
+
+						$list =~ /^(\d\d\d\d)-(\d\d)-(\d\d\d\d\d)$/;
+						$list = "<a href=\"http://lists.debian.org/debian-l10n-$LanguageList{$lang}/$1/debian-l10n-$LanguageList{$lang}-$1$2/msg$3.html\">[$1-$2-$3]</a>";
+
+						$bug_nb = $bug_nb ? "<a href=\"http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$bug_nb\">#$bug_nb</a>"
+						                  : "";
+						if ("#$pkg#$type#$file" ne $lastline) {
+							$lastline = "#$pkg#$type#$file";
+							print $fh <<EOF
+	  <tr class="$status" style="border-top: thin solid black">
 	    <td>$pkg</td>
 	    <td>$type</td>
 	    <td>$file</td>
+EOF
+							;
+						} else {
+							print $fh <<EOF
+	  <tr class="$status">
+	    <td colspan=3></td>
+EOF
+							;
+						}
+						print $fh <<EOF
+	    <td>$translator</td>
 	    <td>$status</td>
 	    <td>$date</td>
 	    <td>$list</td>
 	    <td>$bug_nb</td>
 	  </tr>
 EOF
-				;
+						;
+					}
+				}
 			}
 		}
 		print $fh <<EOF
@@ -400,6 +416,7 @@
   <thead>
     <tr>
       <th><a href="$lang.by_package.html">Package</a></th>
+      <th>Type</th>
       <th>File</th>
       <th><a href="$lang.by_translator.html">Translator</a></th>
       <th><a href="$lang.by_status.html">Status</a></th>
@@ -413,54 +430,147 @@
 	;
 	my %t;
 	foreach my $pkg (sort (grep { $db->has_status($_) } $db->list_packages())) {
+		my %list = ();
+
 		foreach my $statusline (@{$db->status($pkg)}) {
 			my ($type, $file, $date, $status, $translator, $list, $url, $bug_nb) = @{$statusline};
-			$t{$type} = 1;
-		}
-	}
-	foreach my $t (sort keys %t) {
-		my $anchor = $t;
+
+			push @{$t{$type}{$pkg}{$file}}, $statusline;
+		}
+	}
+
+	foreach my $type (sort keys %t) {
+		my $anchor = $type;
+
 		print $fh <<EOF
   <tbody>
+    <!--tr>
+      <td colspan="8"><h3 id="$anchor"><a href="$lang.by_type.html#$anchor">$type</a></h3></td>
+    </tr-->
+EOF
+		;
+		foreach my $pkg (sort keys %{$t{$type}}) {
+			foreach my $file (sort keys %{$t{$type}{$pkg}}) {
+				my $lastline = "";
+				foreach my $statusline (@{$t{$type}{$pkg}{$file}}) {
+					my ($stype, $sfile, $date, $status, $translator, $list, $url, $bug_nb) = @{$statusline};
+
+					$date =~ s/\ \+0000//;
+
+					$list =~ /^(\d\d\d\d)-(\d\d)-(\d\d\d\d\d)$/;
+					$list = "<a href=\"http://lists.debian.org/debian-l10n-$LanguageList{$lang}/$1/debian-l10n-$LanguageList{$lang}-$1$2/msg$3.html\">[$1-$2-$3]</a>";
+
+					$bug_nb = $bug_nb ? "<a href=\"http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$bug_nb\">#$bug_nb</a>"
+							  : "";
+					if ("#$pkg#$type#$file" ne $lastline) {
+						$lastline = "#$pkg#$type#$file";
+						print $fh <<EOF
+	  <tr class="$status" style="border-top: thin solid black">
+	    <td>$pkg</td>
+	    <td>$type</td>
+	    <td>$file</td>
+EOF
+						;
+					} else {
+						print $fh <<EOF
+	  <tr class="$status">
+	    <td colspan=3></td>
+EOF
+						;
+					}
+					print $fh <<EOF
+	    <td>$translator</td>
+	    <td>$status</td>
+	    <td>$date</td>
+	    <td>$list</td>
+	    <td>$bug_nb</td>
+	  </tr>
+EOF
+					;
+				}
+			}
+		}
+		print $fh <<EOF
+  </tbody>
+EOF
+		;
+	}
+	print $fh <<EOF
+</table>
+EOF
+	;
+}
+
+sub by_status($$$) {
+	my $db   = shift;
+	my $lang = shift;
+	my $fh   = shift;
+
+	print $fh <<EOF
+<table rules="groups" frame="box" style="border:white;">
+  <thead>
     <tr>
-      <td colspan="7"><h3 id="$anchor"><a href="$lang.by_type.html#$anchor">$t</a></h3></td>
+      <th><a href="$lang.by_package.html">Package</a></th>
+      <th><a href="$lang.by_type.html">Type</a></th>
+      <th>File</th>
+      <th><a href="$lang.by_translator.html">Translator</a></th>
+      <th>Status</th>
+      <th><a href="$lang.by_date.html">Date</a></th>
+      <th>Message</th>
+      <th><a href="$lang.by_bug.html">Bug</a></th>
     </tr>
-EOF
-		;
-		foreach my $pkg (sort (grep { $db->has_status($_) } $db->list_packages())) {
-			my %l;
-			foreach my $statusline (@{$db->status($pkg)}) {
-				my ($type, $file, $date, $status, $translator, $list, $url, $bug_nb) = @{$statusline};
-				warn "$pkg\:$type\:$file does not specify the status\n"
-					unless defined $status;
-				next	unless defined $status;
-				next	unless defined $type;
-				next	unless $type eq $t;
-
-				$translator = "" if $status eq "taf";
-				$translator = "" if $status eq "maj";
-				$date =~ s/\ \+0000//;
-				$list =~ /^(\d\d\d\d)-(\d\d)-(\d\d\d\d\d)$/;
-				$list = "<a href=\"http://lists.debian.org/debian-l10n-$LanguageList{$lang}/$1/debian-l10n-$LanguageList{$lang}-$1$2/msg$3.html\">[$1-$2-$3]</a>";
-
-				$bug_nb = $bug_nb ? "<a href=\"http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$bug_nb\">#$bug_nb</a>"
-						: "";
-	
-				$l{$file} = [$type, $date, $status, $translator, $list, $url, $bug_nb];
-			}
-			foreach (sort keys %l) {
-				@_ = @{$l{$_}};
-				my $type = $_[0];
-				my $file = $_;
-				my $date = $_[1];
-				my $status = $_[2];
-				my $translator = $_[3];
-				my $list = $_[4];
-				my $url = $_[5];
-				my $bug_nb = $_[6];
-				print $fh <<EOF
+  </thead>
+
+EOF
+	;
+
+	my %t;
+
+	foreach my $pkg (sort (grep { $db->has_status($_) } $db->list_packages())) {
+		my %list = ();
+
+		# Only keep the last status per pkg#$type#$file (no history)
+		foreach my $statusline (@{$db->status($pkg)}) {
+			my ($type, $file, $date, $status, $translator, $list, $url, $bug_nb) = @{$statusline};
+			$list{"$type#$file"} = $statusline;
+		}
+
+		foreach my $k (keys %list) {
+			my ($type, $file, $date, $status, $translator, $list, $url, $bug_nb) = @{$list{$k}};
+
+			push @{$t{$status}{$pkg}{$type}{$file}}, $list{$k};
+		}
+	}
+
+	my %s = reverse %Status;
+	foreach my $score (sort keys %s) {
+		my $status = $s{$score};
+		my $anchor = $status;
+
+		print $fh <<EOF
+  <tbody>
+    <!--tr>
+      <td colspan="8"><h3 id="$anchor"><a href="$lang.by_status.html#$anchor">$status</a></h3></td>
+    </tr-->
+EOF
+		;
+		foreach my $pkg (sort keys %{$t{$status}}) {
+			foreach my $type (sort keys %{$t{$status}{$pkg}}) {
+				foreach my $file (sort keys %{$t{$status}{$pkg}{$type}}) {
+					foreach my $statusline (@{$t{$status}{$pkg}{$type}{$file}}) {
+						my ($stype, $sfile, $date, $sstatus, $translator, $list, $url, $bug_nb) = @{$statusline};
+
+						$date =~ s/\ \+0000//;
+
+						$list =~ /^(\d\d\d\d)-(\d\d)-(\d\d\d\d\d)$/;
+						$list = "<a href=\"http://lists.debian.org/debian-l10n-$LanguageList{$lang}/$1/debian-l10n-$LanguageList{$lang}-$1$2/msg$3.html\">[$1-$2-$3]</a>";
+
+						$bug_nb = $bug_nb ? "<a href=\"http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$bug_nb\">#$bug_nb</a>"
+						                  : "";
+						print $fh <<EOF
 	  <tr class="$status">
 	    <td>$pkg</td>
+	    <td>$type</td>
 	    <td>$file</td>
 	    <td>$translator</td>
 	    <td>$status</td>
@@ -469,93 +579,9 @@
 	    <td>$bug_nb</td>
 	  </tr>
 EOF
-				;
-			}
-		}
-		print $fh <<EOF
-  </tbody>
-EOF
-		;
-	}
-	print $fh <<EOF
-</table>
-EOF
-	;
-}
-
-sub by_status($$$) {
-	my $db   = shift;
-	my $lang = shift;
-	my $fh   = shift;
-
-	print $fh <<EOF
-<table rules="groups" frame="box" style="border:white;">
-  <thead>
-    <tr>
-      <th><a href="$lang.by_package.html">Package</a></th>
-      <th><a href="$lang.by_type.html">Type</a></th>
-      <th>File</th>
-      <th><a href="$lang.by_translator.html">Translator</a></th>
-      <th><a href="$lang.by_date.html">Date</a></th>
-      <th>Message</th>
-      <th><a href="$lang.by_bug.html">Bug</a></th>
-    </tr>
-  </thead>
-
-EOF
-	;
-	my %s = reverse %Status;
-	foreach my $s (sort keys %s) {
-		my $anchor = $s{$s};
-		print $fh <<EOF
-  <tbody>
-    <tr>
-      <td colspan="7"><h3 id="$anchor"><a href="$lang.by_status.html#$anchor">$s{$s}</a></h3></td>
-    </tr>
-EOF
-		;
-		foreach my $pkg (sort (grep { $db->has_status($_) } $db->list_packages())) {
-			my %l;
-			foreach my $statusline (@{$db->status($pkg)}) {
-				my ($type, $file, $date, $status, $translator, $list, $url, $bug_nb) = @{$statusline};
-				warn "$pkg\:$type\:$file does not specify the status\n"
-					unless defined $status;
-				next	unless defined $status;
-				next	unless $status eq $s{$s};
-
-				$translator = "" if $status eq "taf";
-				$translator = "" if $status eq "maj";
-				$date =~ s/\ \+0000//;
-				$list =~ /^(\d\d\d\d)-(\d\d)-(\d\d\d\d\d)$/;
-				$list = "<a href=\"http://lists.debian.org/debian-l10n-$LanguageList{$lang}/$1/debian-l10n-$LanguageList{$lang}-$1$2/msg$3.html\">[$1-$2-$3]</a>";
-
-				$bug_nb = $bug_nb ? "<a href=\"http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$bug_nb\">#$bug_nb</a>"
-						: "";
-
-				$l{$file} = [$type, $date, $status, $translator, $list, $url, $bug_nb];
-			}
-			foreach (sort keys %l) {
-				@_ = @{$l{$_}};
-				my $type = $_[0];
-				my $file = $_;
-				my $date = $_[1];
-				my $status = $_[2];
-				my $translator = $_[3];
-				my $list = $_[4];
-				my $url = $_[5];
-				my $bug_nb = $_[6];
-				print $fh <<EOF
-	  <tr class="$status">
-	    <td>$pkg</td>
-	    <td>$type</td>
-	    <td>$file</td>
-	    <td>$translator</td>
-	    <td>$date</td>
-	    <td>$list</td>
-	    <td>$bug_nb</td>
-	  </tr>
-EOF
-				;
+						;
+					}
+				}
 			}
 		}
 		print $fh <<EOF
@@ -578,6 +604,7 @@
 <table rules="groups" frame="box" style="border:white;">
   <thead>
     <tr>
+      <th>Package</th>
       <th><a href="$lang.by_type.html">Type</a></th>
       <th>File</th>
       <th><a href="$lang.by_translator.html">Translator</a></th>
@@ -590,47 +617,59 @@
 
 EOF
 	;
+
+	my %t;
+
 	foreach my $pkg (sort (grep { $db->has_status($_) } $db->list_packages())) {
-		my $anchor = $pkg;
-		print $fh <<EOF
-  <tbody>
-    <tr>
-      <td colspan="7"><h3 id="$anchor">$pkg</h3></td>
-    </tr>
-EOF
-		;
-		my %l;
+		my %list = ();
+
 		foreach my $statusline (@{$db->status($pkg)}) {
 			my ($type, $file, $date, $status, $translator, $list, $url, $bug_nb) = @{$statusline};
-			warn "$pkg\:$type\:$file does not specify the status\n"
-				unless defined $status;
-			next	unless defined $status;
-
-			$translator = "" if $status eq "taf";
-			$translator = "" if $status eq "maj";
-			$date =~ s/\ \+0000//;
-			$list =~ /^(\d\d\d\d)-(\d\d)-(\d\d\d\d\d)$/;
-			$list = "<a href=\"http://lists.debian.org/debian-l10n-$LanguageList{$lang}/$1/debian-l10n-$LanguageList{$lang}-$1$2/msg$3.html\">[$1-$2-$3]</a>";
-
-			$bug_nb = $bug_nb ? "<a href=\"http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$bug_nb\">#$bug_nb</a>"
-					: "";
-
-			$l{$file} = [$type, $date, $status, $translator, $list, $url, $bug_nb];
-		}
-		foreach (sort keys %l) {
-			@_ = @{$l{$_}};
-			my $type = $_[0];
-			my $file = $_;
-			my $date = $_[1];
-			my $status = $_[2];
-			my $translator = $_[3];
-			my $list = $_[4];
-			my $url = $_[5];
-			my $bug_nb = $_[6];
-			print $fh <<EOF
-	  <tr class="$status">
+
+			push @{$t{$pkg}{$type}{$file}}, $statusline;
+		}
+	}
+
+	foreach my $pkg (sort keys %t) {
+		my $anchor = $pkg;
+
+		print $fh <<EOF
+  <tbody>
+    <!--tr>
+      <td colspan="8"><h3 id="$anchor"><a href="$lang.by_type.html#$anchor">$pkg</a></h3></td>
+    </tr-->
+EOF
+		;
+		foreach my $type (sort keys %{$t{$pkg}}) {
+			foreach my $file (sort keys %{$t{$pkg}{$type}}) {
+				my $lastline = "";
+				foreach my $statusline (@{$t{$pkg}{$type}{$file}}) {
+					my ($stype, $sfile, $date, $status, $translator, $list, $url, $bug_nb) = @{$statusline};
+
+					$date =~ s/\ \+0000//;
+
+					$list =~ /^(\d\d\d\d)-(\d\d)-(\d\d\d\d\d)$/;
+					$list = "<a href=\"http://lists.debian.org/debian-l10n-$LanguageList{$lang}/$1/debian-l10n-$LanguageList{$lang}-$1$2/msg$3.html\">[$1-$2-$3]</a>";
+
+					$bug_nb = $bug_nb ? "<a href=\"http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$bug_nb\">#$bug_nb</a>"
+							  : "";
+					if ("#$pkg#$type#$file" ne $lastline) {
+						$lastline = "#$pkg#$type#$file";
+						print $fh <<EOF
+	  <tr class="$status" style="border-top: thin solid black">
+	    <td>$pkg</td>
 	    <td>$type</td>
 	    <td>$file</td>
+EOF
+						;
+					} else {
+						print $fh <<EOF
+	  <tr class="$status">
+	    <td colspan=3></td>
+EOF
+						;
+					}
+					print $fh <<EOF
 	    <td>$translator</td>
 	    <td>$status</td>
 	    <td>$date</td>
@@ -638,7 +677,9 @@
 	    <td>$bug_nb</td>
 	  </tr>
 EOF
-			;
+					;
+				}
+			}
 		}
 		print $fh <<EOF
   </tbody>
@@ -720,6 +761,7 @@
  2003,2004 Tim Dijkstra
  2004 Nicolas Bertolissio
  2004 Martin Quinson
+ 2008 Nicolas François
 
 =cut
 




More information about the Debian-l10n-commits mailing list