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

Enrico Zini enrico at costa.debian.org
Tue Nov 15 10:23:49 UTC 2005


Author: enrico
Date: Tue Nov 15 10:23:48 2005
New Revision: 1497

Modified:
   central-database/branches/alioth/webfrontend/search.cgi
   central-database/branches/alioth/webfrontend/searchtemplate.html
Log:
Find redundant tags and move them down in the 'top list'

Modified: central-database/branches/alioth/webfrontend/search.cgi
==============================================================================
--- central-database/branches/alioth/webfrontend/search.cgi	(original)
+++ central-database/branches/alioth/webfrontend/search.cgi	Tue Nov 15 10:23:48 2005
@@ -192,7 +192,20 @@
 	};
 }
 
-my @top_tags = Engine::tag((sort { $tags{$b} <=> $tags{$a} } keys %tags)[0 .. $max_tags]);
+my $pkg_count = scalar @ht_pkgs;
+my @top_tags = sort { $tags{$b} <=> $tags{$a} } keys %tags;
+
+# Move redundant tags to the bottom
+for (my $i = 0; $i < @top_tags; $i++)
+{
+	if ($tags{$top_tags[0]} == $pkg_count)
+	{
+		push(@top_tags, shift @top_tags);
+	}
+}
+
+# Choose the most important ones
+ at top_tags = Engine::tag(@top_tags[0 .. $max_tags]);
 
 #Navigation::build(@sel_tags, @sel_words);
 
@@ -284,6 +297,7 @@
 		WAURL => linkself("addwa=".uri_escape($t->name)),
 		UNWURL => linkself("addun=".uri_escape($t->name)),
 		IGURL => linkself("addig=".uri_escape($t->name)),
+		REDUNDANT => ($tags{$t->name} == $pkg_count),
 	};
 }
 

Modified: central-database/branches/alioth/webfrontend/searchtemplate.html
==============================================================================
--- central-database/branches/alioth/webfrontend/searchtemplate.html	(original)
+++ central-database/branches/alioth/webfrontend/searchtemplate.html	Tue Nov 15 10:23:48 2005
@@ -136,11 +136,17 @@
               <div class="setag">
                 <span title="<tmpl_var name='NAME'>: <tmpl_var name='LDESC'>"><tmpl_var name="SDESC"></span> <!-- tmpl_var name="COUNT" -->
               </div>
-              <div class="sebuttons">
-                <a href='<tmpl_var name="WAURL">'>[Want]</a>
-                <a href='<tmpl_var name="UNWURL">'>[Don't want]</a>
-                <a href='<tmpl_var name="IGURL">'>[Ignore]</a>
-              </div>
+	      <tmpl_if name="REDUNDANT">
+                <div class="sebuttons">
+		  (already in all results)
+                </div>
+	      <tmpl_else>
+                <div class="sebuttons">
+                  <a href='<tmpl_var name="WAURL">'>[Want]</a>
+                  <a href='<tmpl_var name="UNWURL">'>[Don't want]</a>
+                  <a href='<tmpl_var name="IGURL">'>[Ignore]</a>
+                </div>
+	      </tmpl_if>
             </li>
           </tmpl_loop>
           </ul>



More information about the Debtags-commits mailing list