RenderCategoryEditor
Renders an edit widget for a category formfield

02 May 2019 - 20:19 | Version 1 |

Documentation

This function is deprecated. Please use RenderCategoryBrowser

Parameters
  • THEWEB: the web where to look for classes, defaults to BASEWEB
  • NAME: name of the formfield to render the browser for
  • VALUE: list of pre-selected categories
  • TOP: node from where to start the category
  • EXCLUDE: pattern of categories to be excluded from the tree
  • BUTTONS: "on", "off", "top", "bottom": defines where to display the buttons, defaults to on (same as top)
  • FILTER: optional default text for the search box
  • ONCLICK: javascript handler to be called when a category is clicked, defaults to selecting the category
  • HIDENULL: "on" or "off", hide empty categories, defaults to off
  • NRLEAFS: list of cat:count values that specify the number of leaf nodes per category
  • NRTOPICS: list of cat:count values that specify the number of topics nodes per category
  • THEFORMAT: format of the link text; this is a named section as defined in RenderHierarchyAsJSON, defaults to editor
  • DEPTH: number of levels to extract, defaults to infinite depth
  • CLASSES: css classes for the input element

Implementation

%STARTINCLUDE%<noautolink>
<div id="clsCatSelector_%IF{"defined NAME" then="%NAME%" else="Category"}%" class="clsCatSelector { nothingFound:'%TRANSLATE{"Nothing found"}%', web:'%IF{"defined THEWEB" then="%THEWEB%" else="%BASEWEB%"}%', topic:'%BASEWEB%.%BASETOPIC%', fieldname:'%IF{"defined NAME" then="%NAME%" else="Category"}%', hidenull: '%IF{"defined HIDENULL" then="%HIDENULL%" else="off"}%', root:'%IF{"defined TOP" then="%TOP%" else="TopCategory"}%', exclude:'%IF{"defined EXCLUDE" then="%EXCLUDE%"}%', format:'%IF{"defined THEFORMAT" then="%THEFORMAT%" else="editor"}%' %IF{"defined DEPTH" then=", depth: '%DEPTH%'"}% %IF{"defined NRLEAFS" then=", nrleafs: '%NRLEAFS%'"}% %IF{"defined NRTOPICS" then=", nrtopics: '%NRTOPICS%'"}% %IF{"defined ONCLICK" then=", onclick: function(elem, editor) {$percntONCLICK$percnt}"}% }">
<input type="hidden" name="%IF{"defined NAME" then="%NAME%" else="Category"}%" class="clsCategoryField" value="%IF{"defined VALUE" then="%VALUE%"}%" />
  %IF{"$'BUTTONS'='top' or $'BUTTONS'='on' or not defined BUTTONS" 
    then="$percntDBCALL{\"%WEB%.%TOPIC%\" section=\"buttons\"}$percnt"
    else="<!-- no buttons -->"
  }%
  <div class="clsBrowser"></div>
  %IF{"$'BUTTONS'='bottom'" 
    then="$percntDBCALL{\"%WEB%.%TOPIC%\" section=\"buttons\"}$percnt"
    else="<!-- no buttons -->"
  }%
</div>
%DBCALL{"%WEB%.%TOPIC%" section="init"}%
</noautolink>%STOPINCLUDE%

init

%STARTSECTION{"init"}%<!-- -->
%JQREQUIRE{"treeview, ui"}%<!-- -->
%ADDTOZONE{"script" 
  id="CLASSIFICATIONPLUGIN::CATSELECTOR" 
  text="<script type='text/javascript' src='%PUBURLPATH%/%SYSTEMWEB%/ClassificationPlugin/jquery.catselector.js'></script>" 
  requires="JQUERYPLUGIN::TREEVIEW, JQUERYPLUGIN::UI"
}%<!-- -->
%ADDTOZONE{"head"
  id="CLASSIFICATIONPLUGIN::CSS"
  text="<link rel='stylesheet' href='%PUBURLPATH%/%SYSTEMWEB%/ClassificationPlugin/styles.css' media='all' />"
  requires="JQUERYPLUGIN::TREEVIEW"
}%<!-- -->%ENDSECTION{"init"}%

Buttons

%STARTSECTION{"buttons"}%<!-- -->
<div class="clsButtonBox">
  %BUTTON{"%TRANSLATE{"Clear"}%" icon="application" class="clsClearButton"}%
  %BUTTON{"%TRANSLATE{"Undo"}%" icon="arrow_refresh" class="clsUndoButton"}%
  %BUTTON{"%TRANSLATE{"Filter"}%" icon="find" class="clsFilterButton"}%
  <input type="text" name="filter" size="30" value="%IF{"defined FILTER" then="%FILTER%"}%" class="foswikiInputField clsFilterField" style="display:none" />
  %CLEAR%
</div>
<literal><style>
.clsButtonBox .jqButton {
  margin-top:2px;
  margin-bottom:3px;
}
</style></literal>
<!-- -->%ENDSECTION{"buttons"}%

Test

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 AustLII Communities? Send feedback
This website is using cookies. More info. That's Fine