Wiki Tricks - Mark Recently Updated Pages

Problem

The revision info in the upper right of a page tells when the page was last edited.
  • screenshot:
    screenshot

But it's printed in light gray and you need to read it and calculate how long ago that was.

It would be nice if a recently updated page could be marked as having been recently updated, e.g.
  • screenshot:
    screenshot

Solution

Step 1

Create a View override template, e.g. WebViewTemplate, overriding the definition of "content" to test how recently the page was last modified.

%TMPL:INCLUDE{"view"}%

%TMPL:DEF{"content"}%
%TMPL:P{"top"}%
%TMPL:P{"topicpathinfo"}%%TMPL:P{"beforetext"}%%TMPL:P{"formattop"}%%TMPL:P{"attachmentsattop"}%<div class="patternContent"><div class="patternTopic">

%CALC{"$SET(ModDate, %REVINFO{"$epoch"}%)"}%

%CALC{$IF($GET(ModDate) > $TIMEADD($TIME(), -7, day), %ICONURL{updated}% %GRAY% in the past 7 days %ENDCOLOR%, )}%

%TEXT%</div><!-- /patternTopic-->%TMPL:P{"aftertext"}%%TMPL:P{"formatbottom"}%%TMPL:P{"attachmentsatbottom"}%</div><!-- /patternContent-->
%TMPL:P{"topicaction"}%%TMPL:P{"topicinfo"}%%TMPL:END%

Example: WikiTutNewViewTemplate (raw view)

Step 2

Set the VIEW_TEMPLATE variable in your web's WebPreferences topic to use your view template instead of the default.

   * Set VIEW_TEMPLATE = MyWeb.WebViewTemplate

Example

Try it here: TWikiTutUpdatedExample


Topic revision: r2 - 14 Oct 2010, vlb
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email