[Home]WikiPatches/GetLastBar

UseModWiki | WikiPatches | RecentChanges | Preferences

New bar about List of wikipages by modification date, as bar (You can put before Adminbar), with max. items by variable $lastWiki in Config File.

And other new action "wmod" in order to the entire list.

 $lastWiki = 5;
 sub GetLastBar {
  my ($page, %pages);
  my (@wiki, $pgwiki, %pgwiki, $lastWiki);
  my $result;

  if (&GetParam('embed', $EmbedWiki)) {
    return $q->end_html;
  }
  foreach $page (&AllPagesList()) {
      $pgwiki{$page} = (-M &GetPageFile($page));
  }
  @wiki = reverse sort {$pgwiki{$b} <=> $pgwiki{$a} || $a cmp $b} keys %pgwiki;
  $lastWiki= 0;
  if ($#wiki > 0) {
    $result .= '<ol>';
    foreach $page (@wiki) {
      ++$lastWiki;
      if ($lastWiki eq 1) {
        $result .= '</div><div class=wikilast>' . Ts('Last Wiki');
        $result .= ' ' . &ScriptLink('action=wmod', '[+]') . '<br>';
      }
      if ($lastWiki < $LastNodes +1) {
        $result .= &GetPageLink($page);
        if ($lastWiki < $LastNodes && $#wiki ne 0) {
          $result .= ' : ';
        }
      }
    }
  }
  return $result;
}

sub DoOtherRequest {
 ...
  } elsif (($action eq 'wmod') {
    &DoIndexing();
 ...
 }

sub DoIndexing {
  my ($page, @page, @pages, @pageList);
  my (%t);

  print &GetHeader('', T('Last Mods'), '');
  foreach $page (&AllPagesList()) {
    if ($action eq 'wmod') {
      &OpenPage($page);
      &OpenDefaultText();
    }
    if ($action eq 'wmod') {
        $t{$page} = $Page{'ts'};
    }
    @pages = sort {$t{$b} <=> $t{$a} || $a cmp $b} keys %t;
  }
  $result .= '<ol>';
  foreach $page (@pages) {
    @page = split (/\//,$page);
    if ($t{$page}) {
      for (1 .. $#page) { print '.. ';}
            print '<li>' - &GetPageLink($page);
            print ' [' . &CalcTimeToText($t{$page}) . ']';
    } else {
        print '<li>';
        for (1 .. $#page) { print '.. ';}
        print '<li>' . &GetPageLink($page) . ' ' . T('No-Dated');
    }
  }
      $result .= '</ol>';
  print GetCommonFooter();
}
-- JuanmaMP

UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited April 25, 2011 10:53 pm by JuanmaMP (diff)
Search: