aw schriftzug.png aw logo 60x60.png

RenderTagEditor
Render an editor for tags

2017-02-17 - 14:08 | Version 3 |

Documentation

Parameters
  • NAME: name of the formfield to render the editor for
  • VALUE: list of pre-selected tags
  • THEWEB: current web
  • THETOPIC: current topic
  • SIZE: the size of the input field

Implementation

%STARTINCLUDE%<div class="clsTagEditor"><noautolink>
<input type="text" class="foswikiInputField jqTextboxList {autocomplete:'%SCRIPTURL{"rest"}%/RenderPlugin/template?topic=%THEWEB{default="%BASEWEB%"}%.%THETOPIC{default="%BASETOPIC%"}%;name=classificationplugin;expand=querytags'}" name="%NAME%" id="%NAME%" size="%SIZE%" value="%VALUE{default=""}%" />
%IF{"context SolrPluginEnabled" then="$percntDBCALL{\"%WEB%.%TOPIC%\" section=\"tagsuggestion\"}$percnt"}%
</noautolink></div>%STOPINCLUDE%

Tag suggestion via SolrPlugin

%STARTSECTION{"tagsuggestion"}%<!--  -->
%FORMATLIST{
  "%SOLRSIMILAR{
     "id:%THEWEB{default="%BASEWEB%"}%.%THETOPIC{default="%BASETOPIC%"}%"
     like="category,tag"
     facets="tag"
     facetlimit="20"
     facetmincount="5"
     mindocumentfrequency="10"
     rows="0"
     filter="type:topic web:%THEWEB{default="%BASEWEB%"}%"
     format_tag="$key=$count"
     separator_tag=","
  }%"
  exclude="%FORMATLIST{"%VALUE%" split="\s*,\s*" format="\b($1=\d+)\b" separator="|" replace="-=\-,\[=\\[,\]=\\]"}%"
  split="\s*,\s*"
  pattern="(.*)=(.*)"
  header="$n$n<hr />$n$n<h3>%MAKETEXT{"Related tags"}%:</h3><ol>"
  format="<li><a class='clsTagSuggestion' href='#'>$1</a>
    <span class='foswikiGrayText'>... %MAKETEXT{"found in [_1] other topic(s)" args="$2"}%</span>
    </li>"
  footer="</ol>"
  separator="$n"
}%
<!-- -->%ENDSECTION{"tagsuggestion"}%

Test

Copyright

© 2006-2015 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.
Warning: Can't find topic Applications/ClassificationApp.WebLeftBarExample

Impressum © Alexander Weimer GmbH