[Debtags-commits] [svn] r1447 -
central-database/branches/alioth/webfrontend
Enrico Zini
enrico at costa.debian.org
Sun Oct 30 21:44:15 UTC 2005
Author: enrico
Date: Sun Oct 30 21:44:11 2005
New Revision: 1447
Modified:
central-database/branches/alioth/webfrontend/browsetemplate.html
central-database/branches/alioth/webfrontend/index.cgi
central-database/branches/alioth/webfrontend/main.css
Log:
Viewing cleanup. Not yet finished, but already substantial.
Modified: central-database/branches/alioth/webfrontend/browsetemplate.html
==============================================================================
--- central-database/branches/alioth/webfrontend/browsetemplate.html (original)
+++ central-database/branches/alioth/webfrontend/browsetemplate.html Sun Oct 30 21:44:11 2005
@@ -11,84 +11,143 @@
<link href="main.css" rel="stylesheet" type="text/css">
</head>
<body>
- <h1>Debian Package Browser</h1>
-
- <TMPL_VAR NAME="LOG">
-
<form name="search" method="get">
- <input type="text" name="words" value='<tmpl_var name="CURWORDS">'>
- <input type="hidden" name="tags" value='<tmpl_var name="CURTAGS">'>
- <input type="submit">
-
- <p><a href="index.cgi">Return to the package browser start page</a></p>
- <p>Please <em>help</em> sorting the
- <a href="index.cgi?tags=special::not-yet-tagged">not yet tagged</a> packages.
- For more information visit the
- <a href="http://debtags.alioth.debian.org/">Debian Usability Project Homepage</a> at <a href="http://alioth.debian.org/">Alioth</a>.</p>
-
- <hr class="close" />
-
- <tmpl_if NAME="HAVETAGS">
- <h2>Selected tags:</h2>
- <TMPL_LOOP NAME="HAVETAGS">
- <b><TMPL_VAR NAME="DESC"></b> (<a href="<TMPL_VAR NAME="URL">">remove</a>)
- </TMPL_LOOP>
- </p>
- </tmpl_if>
-
- <tmpl_if name="NEWFACETS">
- <h2>Automatic Subgroups:</h2>
- <tmpl_loop name="NEWFACETS">
- <p><tmpl_var name="DESC"> (<tmpl_var name="COUNT"> packages):<br />
- <blockquote>
- <tmpl_loop name="SELTAGS">
- <tmpl_var name="DESC"> (<tmpl_var name="COUNT"> packages) <a href='<tmpl_var name="URL">'>[remove]</a><br />
- </tmpl_loop>
- <select name="facet-<tmpl_var name="NAME">">
- <option value=":NONE:">Add one
- <tmpl_loop name="TAGS">
- <option value='<tmpl_var name="TAG">'><tmpl_var name="DESC">
-
- <!--<a href="<TMPL_VAR NAME="URL">"><TMPL_VAR NAME="DESC"></a> (<TMPL_VAR NAME="COUNT"> packages)<br />-->
- </tmpl_loop>
- </select>
- </blockquote>
+ <div id="search">
+ Search: <input type="text" name="words" value='<tmpl_var name="CURWORDS">'>
+ <input type="hidden" name="tags" value='<tmpl_var name="CURTAGS">'>
+ </div>
+
+ <h1><a href="index.cgi">Debian Package Browser</a></h1>
+
+ <div id="log">
+ <TMPL_VAR NAME="LOG">
+ </div>
+
+ <div id="intro">
+ <p>Please <em>help</em> sorting the
+ <a href="index.cgi?tags=special::not-yet-tagged">not yet tagged</a> packages.</p>
+ <p>For more information visit the
+ <a href="http://debtags.alioth.debian.org/">Debtags Homepage</a> at <a href="http://alioth.debian.org/">Alioth</a>.</p>
+ </div>
+
+ <div id="place">
+ <tmpl_if NAME="HAVETAGS">
+ <h2>Selected tags:</h2>
+ <TMPL_LOOP NAME="HAVETAGS">
+ <b><TMPL_VAR NAME="DESC"></b> (<a href="<TMPL_VAR NAME="URL">">remove</a>)
+ </TMPL_LOOP>
</p>
- </tmpl_loop>
- </tmpl_if>
+ </tmpl_if>
+ </div>
- <hr class="close">
-
- <TMPL_UNLESS NAME="NUMPACKAGES">
- <p>No Packages shown. All packages can be found in the subcategories.</p>
- <TMPL_ELSE>
- <p><b><TMPL_VAR NAME="NUMPACKAGES">/<TMPL_VAR NAME="TOTPACKAGES"></b> Packages in this group or in minor subgroups:</p>
- <table border=0>
- <TMPL_LOOP NAME="PACKAGES">
- <TMPL_IF SECTION><tr class="section"><td colspan=2 class="section">
- <TMPL_VAR NAME="SECTION"></td></tr>
- <TMPL_ELSE><TMPL_IF ODDROW><tr class="oddrow">
- <TMPL_ELSE><tr class="evenrow"></TMPL_IF>
- <td valign=top><a href="<TMPL_VAR NAME="URL">"><TMPL_VAR NAME="PACKAGE"></a></td>
- <td valign=top><TMPL_VAR NAME="DESC"></td></tr>
- </TMPL_IF>
- </TMPL_LOOP>
- </table>
- </TMPL_UNLESS>
+ <div id="subgroups">
+ <tmpl_if name="NEWFACETS">
+ <div class="intro">
+ <p>There are <tmpl_var name="NUMNEWTAGS"> tags in
+ <tmpl_var name="NUMNEWFACETS"> subgroups available to further refine
+ the search.</p>
+ </div>
+ <div id="facets">
+ <tmpl_loop name="NEWFACETS">
+ <div class="facet">
+ <div class="facet-title">
+ <tmpl_var name="DESC"> (<tmpl_var name="COUNT"> packages):
+ </div>
+ <div class="facet-body">
+ <tmpl_loop name="SELTAGS">
+ <tmpl_var name="DESC"> (<tmpl_var name="COUNT"> packages) <a href='<tmpl_var name="URL">'>[remove]</a><br />
+ </tmpl_loop>
+
+ <select name="facet-<tmpl_var name="NAME">" onChange='this.form.submit()'>
+ <option value=":NONE:">Add one
+ <tmpl_loop name="TAGS">
+ <option value='<tmpl_var name="TAG">'><tmpl_var name="DESC">
+ </tmpl_loop>
+ </select>
+ </div>
+ </div>
+ </tmpl_loop>
+ </div>
+ <tmpl_else>
+ <div class="intro">
+ <p>There is no further refining and all matching packages are listed
+ below.</p>
+ </div>
+ </tmpl_if>
+ </div>
+
+ <div id="packages">
+ <TMPL_UNLESS NAME="NUMPACKAGES">
+ <div class="intro">
+ <p>No Packages shown. All packages can be found in the subcategories.</p>
+ </div>
+ <TMPL_ELSE>
+ <tmpl_iF name="CURPACKAGES">
+ <div class="intro">
+ <p><b><TMPL_VAR NAME="CURPACKAGES">/<TMPL_VAR NAME="TOTPACKAGES"></b> Packages shown from this group.</p>
+ </div>
+ <div id="curpkgs">
+ <tmpl_loop name="PACKAGES">
+ <a class="pkg" href="<tmpl_var name="URL">"><tmpl_var name="PACKAGE"></a>
+ - <tmpl_var name="DESC"><br />
+ </tmpl_loop>
+ </div>
+ <tmpl_else>
+ <div class="intro">
+ <p>There are no packages shown from this group; some packages from minor categories are displayed below.</p>
+ </div>
+ </tmpl_if>
+
+ <div class="intro">
+ <p><b><TMPL_VAR NAME="SUBPACKAGES">/<TMPL_VAR NAME="TOTPACKAGES"></b> Packages shown from minor subgroups.</p>
+ </div>
+ <table class="pkglist">
+ <tmpl_loop name="SPACKAGES">
+ <tmpl_if SECTION>
+ <tr>
+ <td class="left">
+ <div class="pkggroup">
+ <tmpl_loop name="SECTION">
+ <tmpl_var name="NAME"><br />
+ </tmpl_loop>
+ </div>
+ </td>
+ <td class="right">
+ </tmpl_if>
+ <a class="pkg" href="<tmpl_var name="URL">"><tmpl_var name="PACKAGE"></a>
+ - <tmpl_var name="DESC"><br />
+ <tmpl_if LAST>
+ </td>
+ </tr>
+ </tmpl_if>
+ </tmpl_loop>
+ <tr>
+ <td class='lastleft'>
+ <tmpl_var name="NUMGROUPS"> groups.
+ </td>
+ <td class='lastright'>
+ <tmpl_var name="NUMPACKAGES"> packages.
+ </td>
+ </tr>
+ </table>
+ </TMPL_UNLESS>
+ </div>
</form>
-<table border="0" width="100%" class="close">
-<tr>
- <td align="left" class="close">
- [<a class="close" href="http://lists.alioth.debian.org/mailman/listinfo/debtags-devel">debtags-devel list</a>]
- -
- [<a class="close" href="http://alioth.debian.org/projects/debtags">Alioth project page</a>]
- </td>
- <td align="right" class="close">
- <a class="sign" href="mailto:erich at debian.org">Erich Schubert</a>
- </td>
-</tr>
-</table>
+ <div style="clear: both"></div>
+ <div id="close">
+ <div class="links">
+ [<a href="http://debtags.alioth.debian.org">Debtags</a>]
+ -
+ [<a href="http://lists.alioth.debian.org/mailman/listinfo/debtags-devel">debtags-devel list</a>]
+ -
+ [<a href="http://alioth.debian.org/projects/debtags">Alioth project page</a>]
+ </div>
+ <div class="signature">
+ <a href="mailto:erich at debian.org">Erich Schubert</a>,
+ <a href="mailto:enrico at debian.org">Enrico Zini</a>,
+ </div>
+ </div>
</body></html>
Modified: central-database/branches/alioth/webfrontend/index.cgi
==============================================================================
--- central-database/branches/alioth/webfrontend/index.cgi (original)
+++ central-database/branches/alioth/webfrontend/index.cgi Sun Oct 30 21:44:11 2005
@@ -163,7 +163,7 @@
# Compute tagset statistics
my $ts = join(',', sort map{$_->name} $p->tags);
# Store packages by tagset
- push(@{$ts{$ts}}, $p);
+ push(@{$ts{$ts}}, $p) if $ts ne $curts;
if ($ts eq $curts) {
push @curpkgs, $p
@@ -270,38 +270,95 @@
# Packages in the current view
my @ht_pkgs;
-my $lastsection="";
-my $count=0;
-foreach my $pkg (@pkgs) {
- $count++;
- my @tags = sort { $a->name() cmp $b->name() } $pkg->tags();
- my $tags = join(" ", map { $_->name() } @tags);
- if ($lastsection ne $tags) {
- push @ht_pkgs, {
- SECTION => join(", ",sort(map { $_->sdesc() } @tags)),
- };
- $lastsection = $tags;
+my @ht_subpkgs;
+sub bytagset ($$)
+{
+ my ($a, $b) = @_;
+ my @atags = sort map { $_->name } $a->tags;
+ my @btags = sort map { $_->name } $b->tags;
+
+ # Smallest tagsets first
+ return scalar(@atags) <=> scalar(@btags) if (scalar(@atags) != scalar(@btags));
+
+ for my $i (0 .. $#atags)
+ {
+ return $atags[$i] cmp $btags[$i] if $atags[$i] ne $btags[$i];
+ }
+ return 0;
+}
+
+# Packages in subgroups
+my $count = 0;
+my $groups = 0;
+my $last_sec = 0;
+my $lastsection = '';
+foreach my $pkg (sort bytagset @pkgs)
+{
+ my @tags = sort { $a->name() cmp $b->name() } grep { !$seen{$_->name} } $pkg->tags();
+ my $tags = join(',', @tags);
+
+ my %data;
+ if ($tags eq '')
+ {
+ $data{PACKAGE} = $pkg->name();
+ $data{DESC} = $pkg->sdesc();
+ $data{URL} = "edit.cgi?package=".uri_escape($pkg->name()).
+ "&tags=".uri_escape(join(',', map{$_->name()} @sel_tags)),
+
+ push @ht_pkgs, \%data;
+ next;
}
- my ($description) = $pkg->sdesc();
- push @ht_pkgs, {
- PACKAGE => $pkg->name(),
- URL => "edit.cgi?package=".uri_escape($pkg->name())."&tags=".uri_escape(join(',',map{$_->name()} @sel_tags)),
- ODDROW => ($count % 2),
- DESC => $description
+
+ ++$count;
+ if ($lastsection ne $tags)
+ {
+ # We are at a tagset change
+ ++$groups;
+ $data{SECTION} =
+ [ map { NAME=>$_->sdesc() },
+ sort { $a->sdesc cmp $b->sdesc }
+ grep { !$seen{$_->name} } @tags ];
+
+ # Initialize with current position, we'll subtract it from the start of
+ # next section when it happens
+ $data{COUNT} = $count;
+ if ($count != 1)
+ {
+ $ht_subpkgs[$#ht_subpkgs]{LAST} = 1;
+ $ht_subpkgs[$last_sec]{COUNT} = $count - $last_sec - 1;
+ $last_sec = $count - 1;
+ }
+ $lastsection = $tags;
}
+ $data{PACKAGE} = $pkg->name();
+ $data{DESC} = $pkg->sdesc();
+ $data{URL} = "edit.cgi?package=".uri_escape($pkg->name()).
+ "&tags=".uri_escape(join(',', map{$_->name()} @sel_tags)),
+
+ push @ht_subpkgs, \%data;
}
+$ht_subpkgs[$last_sec]{LAST} = 1;
+$ht_subpkgs[$last_sec]{COUNT} = $count - $last_sec;
# Fill in the template
$template->param(HAVETAGS => \@ht_seltags);
$template->param(NEWFACETS => \@ht_newfacets);
+$template->param(NUMNEWFACETS => scalar(@ht_newfacets));
+$template->param(NUMNEWTAGS => scalar(@tag_newtags));
+$template->param(NUMGROUPS => $groups);
$template->param(NUMPACKAGES => scalar(@pkgs));
-$template->param(SUBPACKAGES => scalar(@subpkgs));
+$template->param(CURPACKAGES => scalar(@ht_pkgs));
+$template->param(SUBPACKAGES => scalar(@ht_subpkgs));
$template->param(TOTPACKAGES => scalar(@pkgs) + scalar(@subpkgs));
$template->param(PACKAGES => \@ht_pkgs);
+$template->param(SPACKAGES => \@ht_subpkgs);
$template->param(CURTAGS => join(',', map{$_->name} @sel_tags));
$template->param(CURWORDS => join(' ', at sel_words));
-$log =~ s/\n/<br>/g;
-$template->param(LOG => $log);
+if ($log)
+{
+ $log =~ s/\n/<br>/g;
+ $template->param(LOG => $log);
+}
# Finally, output
print "Content-Type: text/html\n\n";
Modified: central-database/branches/alioth/webfrontend/main.css
==============================================================================
--- central-database/branches/alioth/webfrontend/main.css (original)
+++ central-database/branches/alioth/webfrontend/main.css Sun Oct 30 21:44:11 2005
@@ -12,8 +12,33 @@
H1 {
color: brown;
-border-bottom: thick solid brown;
-margin-bottom: 1cm;
+border-bottom: 1pt brown solid;
+}
+H1 A {
+color: brown;
+text-decoration: none;
+}
+H1 A:visited {
+color: brown;
+text-decoration: none;
+}
+H1 A:hover {
+color: brown;
+text-decoration: none;
+}
+
+/* Search box */
+#search {
+ float: right;
+}
+
+/* Debugging output */
+#log {
+}
+
+/* Introductory text */
+.intro {
+padding-bottom: 3pt;
}
H2 {
@@ -73,12 +98,72 @@
}
/* for package browser */
-.oddrow { background-color: #FFFFFF; }
-.evenrow { background-color: #FFFFBB; }
-.section { background-color: #DDDDDD; font-size: x-small; text-align: center; }
.addlink { font-size: x-small; }
.removelink { font-size: x-small; }
+/* Display of current location */
+#place {
+}
+
+/* Display of subgroups */
+#subgroups {
+margin-bottom: 2em;
+}
+
+#facets {
+border: 1pt solid black;
+padding: 1em;
+margin-bottom: 2em;
+}
+
+#curpkgs {
+border: 1pt solid black;
+padding: 1em;
+margin-bottom: 2em;
+}
+
+/* Display of packages */
+#packages {
+margin-bottom: 2em;
+}
+
+TABLE {
+width: 100%;
+border-collapse: collapse;
+}
+TD.left {
+border: 1pt solid black;
+width: 30%;
+}
+TD.right {
+border: 1pt solid black;
+padding-left: 3pt;
+}
+TD.lastleft {
+border: 1pt solid black;
+text-align: center;
+width: 30%;
+}
+TD.lastright {
+border: 1pt solid black;
+text-align: center;
+}
+A.pkg {
+text-decoration: none;
+}
+
+#close {
+padding-top: 2px;
+border-top: 1px brown solid;
+}
+#close .links {
+float: left;
+}
+#close .signature {
+float: right;
+font-style: italic;
+}
+
/* Commented out, just for remembering about some P variants
P:first-letter {
font-weight: bold;
More information about the Debtags-commits
mailing list