[Home]WikiPatches/RevCloud

UseModWiki | WikiPatches | RecentChanges | Preferences

This is an attempt for implementing in Usemod a patch about a "Rev Cloud".

Tag Cloud have been very popular lately on web. "Rev Cloud" collects number of revisions instead Tags from pages.

During this sorting page that is modified multiple times will have a bigger font size to stand out against the ones that are not modified a lot.

Patch

sub DoOtherRequest {
...
      &DoIndex();
+} elsif ($action eq "revcloud") {
+      &DoRevCloud();

+sub DoRevCloud {
+    my ($page, %pgrev, @pages, $min, $max, $minFont, $maxFont);
+
+    print &GetHeader('',Ts('Rev Cloud'), '');
+    foreach $page (&AllPagesList()) {
+      &OpenPage($page);
+      &OpenDefaultText();	 
+      $pgrev{$page} = $Page{'revision'};
+      @pages = sort {$pgrev{$b} <=> $pgrev{$a} || $a cmp $b} keys %pgrev; 
+      $max = $pgrev{$pages[0]};
+      }
+   foreach $page (&AllPagesList()) {
+      &OpenPage($page);
+      &OpenDefaultText();	
+      $pgrev{$page} = $Page{'revision'};
+      $min = 1;
+      $max = $pgrev{$page} if $pgrev{$page} > $max;
+      $min = $pgrev{$page} if not $min or $pgrev{$page} < $min;
+      $maxFont =75;
+      $minFont = 10;
+      print $q->a({-href  => "$ScriptName?" . $page,-style => 'font-size:' .
+      # thanks to http://www.mileswjohnson.com/read/creating-a-tag-cloud-with-a-database
+      # Note: pending to reuse with permission!:
+      ($minFont + ($pgrev{$page} - $min) * ($maxFont - $minFont)
+      /(($max - $min == 0) ? 1 : $max - $min)) . "px", -title => "$pgrev{$page}"}, $page), (' ... ');	
+      }
+    print &GetCommonFooter();
+    }

sub GetFooterText {
...
      $result .= &GetPageLinkText($id, T('View current revision'));
     }
+    $result .= ' | ';
+    $result .= &ScriptLink("action=revcloud", T("Rev Cloud")); 

--JuanmaMP


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited November 22, 2009 6:25 pm by JuanmaMP (diff)
Search: