[Debtags-commits] [svn] r1448 - central-database/branches/alioth/webfrontend

Enrico Zini enrico at costa.debian.org
Sun Oct 30 22:43:48 UTC 2005


Author: enrico
Date: Sun Oct 30 22:43:47 2005
New Revision: 1448

Modified:
   central-database/branches/alioth/webfrontend/Engine.pm
   central-database/branches/alioth/webfrontend/browsetemplate.html
   central-database/branches/alioth/webfrontend/index.cgi
   central-database/branches/alioth/webfrontend/main.css
Log:
Finished with polishing for today

Modified: central-database/branches/alioth/webfrontend/Engine.pm
==============================================================================
--- central-database/branches/alioth/webfrontend/Engine.pm	(original)
+++ central-database/branches/alioth/webfrontend/Engine.pm	Sun Oct 30 22:43:47 2005
@@ -50,13 +50,16 @@
 	# Load data from disk
 	my $data = $packages{$self->{name}};
 	
-	# If there's nothing to load, give up
-	return if not defined $data;
-	
-	my ($sdesc, $ldesc) = split("\0", $data);
+	# If there's nothing to load, use the name as a fallback
+	if (not defined $data)
+	{
+		$self->{sdesc} = $self->{name};
+	} else {
+		my ($sdesc, $ldesc) = split("\0", $data);
 
-	$self->{sdesc} = $sdesc;
-	$self->{ldesc} = $ldesc;
+		$self->{sdesc} = $sdesc;
+		$self->{ldesc} = $ldesc;
+	}
 }
 
 sub name ($) { return $_[0]->{name}; }
@@ -97,14 +100,17 @@
 	# Load data from disk
 	my $data = $facets{$self->name};
 
-	# If there's nothing to load, give up
-	return if not defined $data;
-	
-	my ($sdesc, $ldesc, $tags) = split("\0", $data);
-	
-	$self->{sdesc} = $sdesc;
-	$self->{ldesc} = $ldesc;
-	$self->{tags} => [ map { Engine::Tag->new($_) } split(', ', ($tags or '')) ],
+	# If there's nothing to load, use the name as a fallback
+	if (not defined $data)
+	{
+		$self->{sdesc} = $self->{name};
+	} else {
+		my ($sdesc, $ldesc, $tags) = split("\0", $data);
+		
+		$self->{sdesc} = $sdesc;
+		$self->{ldesc} = $ldesc;
+		$self->{tags} => [ map { Engine::Tag->new($_) } split(', ', ($tags or '')) ],
+	}
 }
 
 sub name ($) { return $_[0]->{name}; }
@@ -151,10 +157,13 @@
 	# Load data from disk
 	my $data = $tags{$self->{name}};
 	
-	# If there's nothing to load, give up
-	return if not defined $data;
-	
-	($self->{sdesc}, $self->{ldesc}) = split("\0", $data);
+	# If there's nothing to load, use the name as a fallback
+	if (not defined $data)
+	{
+		$self->{sdesc} = $self->{name};
+	} else {
+		($self->{sdesc}, $self->{ldesc}) = split("\0", $data);
+	}
 }
 
 sub name ($) { return $_[0]->{name}; }

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 22:43:47 2005
@@ -31,43 +31,42 @@
     <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_if>
-  </div>
-
   <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>
+	<tmpl_if name="NUMNEWTAGS">
+	  <p><tmpl_var name="NUMSELTAGS_TXT"> currently selected and 
+	     <tmpl_var name="NUMNEWTAGS"> tags in
+	     <tmpl_var name="NUMNEWFACETS"> subgroups available to further
+	     refine the search.</p>
+	<tmpl_else>
+	  <p><tmpl_var name="NUMSELTAGS_TXT"> currently selected.</p>
+	</tmpl_if>
       </div>
       <div id="facets">
       <tmpl_loop name="NEWFACETS">
         <div class="facet">
           <div class="facet-title">
-	    <tmpl_var name="DESC"> (<tmpl_var name="COUNT"> packages):
+	    <tmpl_var name="DESC"> (<tmpl_var name="COUNT">):
 	  </div>
           <div class="facet-body">
+	    <ul>
             <tmpl_loop name="SELTAGS">
-              <tmpl_var name="DESC"> (<tmpl_var name="COUNT"> packages) <a href='<tmpl_var name="URL">'>[remove]</a><br />
+              <li><tmpl_var name="DESC"> (<tmpl_var name="COUNT">) <a href='<tmpl_var name="URL">'>[remove]</a></li>
             </tmpl_loop>
-    
-            <select name="facet-<tmpl_var name="NAME">" onChange='this.form.submit()'>
+	    <tmpl_if name="TAGS">
+            <li><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>
+            </select></li>
+	    </tmpl_if>
+	    </ul>
           </div>
 	</div>
       </tmpl_loop>
+      <div style="clear: both"></div>
       </div>
     <tmpl_else>
       <div class="intro">

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 22:43:47 2005
@@ -245,7 +245,7 @@
 # Further selectable tags in the navigation part
 my $cur_fac;
 my @ht_newfacets;
-foreach my $t (sort { $a->name cmp $b->name } @tag_newtags)
+foreach my $t (sort { $a->name cmp $b->name } @tag_newtags, @sel_tags)
 {
 	my $f = $t->facet();
 	if (not defined $cur_fac or $cur_fac ne $f->name())
@@ -259,6 +259,7 @@
 		};
 		$cur_fac = $f->name();
 	}
+	next if $seen{$t->name()};
 	$ht_newfacets[$#ht_newfacets]{COUNT} += $tag_counts{$t->name()};
 	push @{$ht_newfacets[$#ht_newfacets]{TAGS}}, {
 		TAG => $t->name(),
@@ -267,6 +268,17 @@
 		URL => "?tags=".uri_escape(join(",", map { $_->name } @sel_tags, $t))
 	};
 }
+sub bystats ($$)
+{
+	my ($a, $b) = @_;
+	return @{$b->{SELTAGS}} <=> @{$a->{SELTAGS}}
+		if @{$b->{SELTAGS}} != @{$a->{SELTAGS}};
+	return @{$b->{TAGS}} <=> @{$a->{TAGS}}
+		if @{$b->{TAGS}} != @{$a->{TAGS}};
+	return $a->{DESC} cmp $b->{DESC};
+	
+}
+ at ht_newfacets = sort bystats @ht_newfacets;
 
 # Packages in the current view
 my @ht_pkgs;
@@ -345,6 +357,8 @@
 $template->param(NEWFACETS => \@ht_newfacets);
 $template->param(NUMNEWFACETS => scalar(@ht_newfacets));
 $template->param(NUMNEWTAGS => scalar(@tag_newtags));
+$template->param(NUMSELTAGS => scalar(@sel_tags));
+$template->param(NUMSELTAGS_TXT => scalar(@sel_tags) == 1 ? "There is one tag" : "There are ".scalar(@sel_tags)." tags");
 $template->param(NUMGROUPS => $groups);
 $template->param(NUMPACKAGES => scalar(@pkgs));
 $template->param(CURPACKAGES => scalar(@ht_pkgs));

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 22:43:47 2005
@@ -97,6 +97,15 @@
 text-decoration: none;
 }
 
+UL {
+margin-left: 0;
+padding-left: 1em;
+}
+LI {
+margin-left: 0;
+padding-left: 0;
+}
+
 /* for package browser */
 .addlink { font-size: x-small; }
 .removelink { font-size: x-small; }
@@ -109,12 +118,19 @@
 #subgroups {
 margin-bottom: 2em;
 }
-
+.facet-title {
+font-weight: bold;
+}
+.facet-body {
+margin: 5pt;
+}
 #facets {
 border: 1pt solid black;
 padding: 1em;
 margin-bottom: 2em;
 }
+.facet {
+}
 
 #curpkgs {
 border: 1pt solid black;



More information about the Debtags-commits mailing list