RenderWikiTopicView

%REVINFO{ " $date - $hour:$min " rev=" IF{ "%NATMAXREV%!=%CURREV%" then="%CURREV%" }: Syntax error in '%NATMAXREV%!=%CURREV%' at '%NATMAXREV%!=%CURREV%' " topic="Applications.RenderWikiTopicView" }% | Version 1 |

Documentation

This function renders a view for a wiki topic, showing its title and the summary line.

Parameters

  • OBJECT: the topic to render the view for, defaults to %BASEWEB%.%BASETOPIC%
  • TITLE_PREFIX: optional string put before the topic title
  • TITLE_EXTRA: optional addition put behind the topic title
  • DISPLAYREVISIONINFO: boolean flag to switch on/off revinfo rendered underneath the h1 element

Implementation

%STARTINCLUDE%<noautolink><h1 itemprop='headline'>%IF{
   "defined TITLE_PREFIX and not isempty TITLE_PREFIX"
   then="<span class='foswikiTopicPrefix'>%TITLE_PREFIX%</span>"
}%<a href="%DBQUERY{topic="%OBJECT{default="%BASEWEB%.%BASETOPIC%"}%" format="%SCRIPTURLPATH{"view"}%/$web/$topic"}%"><span itemprop='name'>%TRANSLATE{"%GETTOPICTITLE{topic="%OBJECT{default="%BASEWEB%.%BASETOPIC%"}%" rev="%URLPARAM{"rev"}%"}%"}%</span></a> %IF{
   "defined TITLE_EXTRA and not isempty TITLE_EXTRA" 
   then="<span class='foswikiTopicExtra'>%TITLE_EXTRA%</span>"
}%%IF{
   "'%OBJECT{default="%BASEWEB%.%BASETOPIC%"}%'/Summary"
   then="<div class='foswikiTopicSummary'>$percntTRANSLATE{\"$percntFORMFIELD{\"Summary\" topic=\"%OBJECT{default="%BASEWEB%.%BASETOPIC%"}%\" rev=\"%URLPARAM{"rev"}%\"}$percnt\"}$percnt</div>"
}%</h1>
%IF{"'%DISPLAYREVISIONINFO{default="on"}%'='on'"
   then="$percntDBCALL{\"%WEB%.%TOPIC%\" OBJECT=\"%OBJECT%\" section=\"revinfo\"}$percnt"
}%</noautolink>%STOPINCLUDE%

Revision Info

%STARTSECTION{"revinfo"}%<span class="foswikiRevision">
   <span class='foswikiRevisionDate'>%JQICON{"fa-calendar"}%
      %REVINFO{
         "<a href='%SCRIPTURLPATH{"diff"}%/$web/$topic?rev=%CURREV{topic="%OBJECT{default="%BASEWEB%.%BASETOPIC%"}%"}%'>
            <span itemprop='dateModified' content='$iso'>$date - $hour:$min</span>
         </a>" 
         rev="%IF{"%NATMAXREV%!=%CURREV%" then="%CURREV%"}%" topic="%OBJECT{default="%BASEWEB%.%BASETOPIC%"}%"
      }%
  </span>
  <span class='foswikiRevisionSep'>&#124;</span>
  <span class='foswikiRevisionID'>
   %JQICON{"fa-flag"}%
   %TRANSLATE{"Version [_1]" args="%REVINFO{"<span itemprop='version'>$rev</span>" rev="%IF{"%NATMAXREV%!=%CURREV%" then="%CURREV%"}%" topic="%OBJECT{default="%BASEWEB%.%BASETOPIC%"}%"}%"}%
  </span>
  <span class='foswikiRevisionSep'>&#124;</span>
  <span class='foswikiRevisionAuthor' itemprop='author'>
   %JQICON{"fa-user"}%
   %REVINFO{
      "$percntIF{
         \"istopic '$wikiusername'\"
         then=\"[[$wikiusername][<span itemprop='name'>$percntGETTOPICTITLE{\"$wikiusername\"}$percnt</span>]]\"
         else=\"<nop>$wikiname\"
      }$percnt"
      rev="%IF{"%NATMAXREV%!=%CURREV%" then="%CURREV%"}%" 
      topic="%OBJECT{default="%BASEWEB%.%BASETOPIC%"}%"}%</span> 
  %DBQUERY{"total_likes>0"
     topic="%OBJECT{default="%BASEWEB%.%BASETOPIC%"}%"
     format="<span class='foswikiRevisionSep'>&#124;</span> %JQICON{"fa-thumbs-o-up" class="fa-flip-horizontal"}% $expand(total_likes)"
  }%<!-- -->
</span>%ENDSECTION{"revinfo"}%

Test

RenderWikiTopicView (approved)

%REVINFO{ " $date - $hour:$min " rev=" IF{ "%NATMAXREV%!=%CURREV%" then="%CURREV%" }: Syntax error in '%NATMAXREV%!=%CURREV%' at '%NATMAXREV%!=%CURREV%' " topic="Applications.RenderWikiTopicView" }% | Version 1 |

Calls to 'RenderWikiTopicView'

Copyright

© 2006-2019 Michael Daum http://michaeldaumconsulting.com

This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For more details read the LICENSE.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, to the extent permitted by law; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback