%PDF- %PDF-
Direktori : /home/waritko/jetty-distribution-9.4.21.v20190926/webapps/ROOT/skins/flamingo/ |
Current File : //home/waritko/jetty-distribution-9.4.21.v20190926/webapps/ROOT/skins/flamingo/macros.vm |
############################################################### ## Contains various standard Velocity macros automatically ## loaded and usable everywhere (in Velocity). ## ## It actually extends the macros.vm defined in the templates ## directory by redefining or adding new macros. ## ## Note that if you modify that file you will need to restart. ############################################################### ### ### Message box ### #macro(xwikimessageboxstart $title $message) <div class="centered panel panel-default xwikimessage"> <div class="panel-heading"> <div class="panel-title">$title</div> </div> <div class="panel-body"> <p class="xwikimessage">$message</p> #end #macro(xwikimessageboxend) </div> </div> #end #macro(xwikimessagebox $title $message $urlyes $urlno $msgyes $msgno) #xwikimessageboxstart($title $message) <div class="buttons"><a href="$urlyes" class="buttonwrapper"><input type="button" class="button" value="$msgyes" onclick="location='$urlyes'; return false;"/></a> <a href="$urlno" class="buttonwrapper"><input type="button" class="button secondary" value="$msgno" onclick="location='$urlno'; return false;"/></a></div> #xwikimessageboxend() #end #** * Displays a submit button, i.e. an <tt>input</tt> element with <tt>type=submit</tt>. * For styling purposes, the button is wrapped in a span element. * @param name The value of the <tt>name</tt> attribute * @param shortcut The keyboard shortcut for this button. The value will be displayed * as the title of the element. The actual shortcut is attached elsewhere, in * the javascript code. * @param value The value of the <tt>value</tt> attribute, i.e. the text displayed on * the button. * @param class The class to use. *# #macro(submitButton $name $shortcut $value $class) <input class="btn $!class" type="submit" name="$name"#if($keyboardShortcutsEnabled) title="$shortcut"#end value="$value"/> #end #** * Displays a submit button for the editor. This macro calls submitButton, * composing all its parameters based on the action's identifier and the * identifier of the corresponding localized resources. * @param action The identifier of the button's action. * @param resourceIdentifier The key used to identify the localized resources. * @param class The class to use. *# #macro(editActionButton $action $resourceIdentifier $class) #submitButton("action_${action}", $services.localization.render("core.shortcuts.edit.${resourceIdentifier}"), $services.localization.render($resourceIdentifier), $class) #end #** * AJAX Live table that displays XWiki data. * * Example of usage, in syntax 2.0: * <code> * {{velocity}} * #set($columns = [ "_avatar", "first_name", "last_name", "email"]) * #set($columnsProperties = { * "first_name" : { "type" : "text" , "size" : 10, "link" : "view"}, * "last_name" : { "type" : "text" , "size" : 10, "link" : "view"}, * "email" : { "type" : "text" , "size" : 20, "link" : "editor"}, * "_avatar" : { "type" : "none" , "size" : 20, "link" : "none", "html" : "true", "sortable":false } * }) * #set($options = { "className":"XWiki.XWikiUsers", * "translationPrefix" : "platform.index.", * "tagCloud" : true, * "rowCount": 15, * "javascriptName" : "MyModule.myTable", * "description: "The description of this table here", }) * #livetable("userstable" $columns $columnsProperties $options) * {{/velocity}} * </code> * * @param divid the id of the table div * @param collist the column list * @param colprops the columns properties * @param options the livetable options. *# #macro(livetable $divid $collist $colprops $options) ## Open wiki syntax wrappers. #if("$!options.outputOnlyHtml" != 'true') ## Do not indent: #if($xwiki.getCurrentContentSyntaxId() != "xwiki/1.0") ## We don't clean the HTML because we control the markup and because we want to preserve the whitespace characters in the ## attribute values (e.g. if the live table id contains whitespaces) {{html clean="false"}} #else {pre} #end #end ## ## SX deps. ## #set($ok = $xwiki.jsfx.use('js/xwiki/table/livetable.js', true)) #set($ok = $xwiki.ssfx.use('js/xwiki/table/livetable.css', true)) ## ## Options / defaults ## #if("$!options.translationPrefix" != '') #set($transprefix = $options.translationPrefix) #else #set($transprefix = '') #end #if("$!options.defaultOrder" == 'desc') #set($defaultOrder = 'desc') #else #set($defaultOrder = 'asc') #end #if("$!options.rowCount" != '') #set($count = $options.rowCount) #else #set($count = 15) #end #if("$!options.maxPages" != '') #set($maxPages = $options.maxPages) #else #set($maxPages = 10) #end #if("$!options.selectedColumn" != '') #set($selectedColumn = $options.selectedColumn) #end #if("$!options.callback" != '') #set($callback = $options.callback) #else #set($callback = '') #end #if("$!options.tagCloud" == '' || $options.tagCloud == false) #set($tagcloud=false) #else #set($tagcloud = true) #end #if ($options.selectedTags && $options.selectedTags.size() > 0) #set ($selectedTags = $options.selectedTags) #else #set ($selectedTags = []) #end #if("$!options.javascriptName" != '') #set($jsName = $options.javascriptName) #else #set($jsName = "livetable_$divid") #end #set ($topfilters = $options.topFilters) #if("$options.pageSize" == '' || $!options.pageSize == false) #set($hasPageSize=false) #else #set($hasPageSize = true) #end #if("$!options.pageSizeBounds" != '') #set($pageSizeBounds = $options.pageSizeBounds) #end #set ($queryFilters = $options.queryFilters) #if (!$queryFilters) #set ($queryFilters = 'currentlanguage,hidden') #end #set($classname = "$!options.className") ## ## Columns informations ## #set ($dataColumns = []) #set ($classParams = {}) #foreach($colname in $collist) ## If the live table options don't specify which column to select then select the first non-special column. #if("$!selectedColumn" == '' && !$colname.startsWith('_')) #set($selectedColumn = $colname) #end #if($colname != '_actions') #set ($discard = $dataColumns.add($colname)) #set($propClassName = "$!{colprops.get($colname).get('class')}") #if($propClassName != '') #set ($discard = $classParams.put("${colname}_class", $propClassName)) #end #set ($propMatchType = "$!colprops.get($colname).match") #if ($propMatchType != '') #set ($discard = $classParams.put("${colname}_match", $propMatchType)) #end #end #end #if("$!options.url" != '') #set($dataurl = $options.url) #else #set ($parameters = { 'outputSyntax': 'plain', 'transprefix': $transprefix, 'classname': $classname, 'collist': $stringtool.join($dataColumns, ','), 'queryFilters': $queryFilters }) #set ($discard = $parameters.putAll($classParams)) #set ($resultPage = $options.resultPage) #if ("$!resultPage" == '') #set ($resultPage = 'XWiki.LiveTableResults') #end #set ($dataurl = $xwiki.getURL($resultPage, 'get', "$escapetool.url($parameters)&$!options.extraParams")) #end ## ## HTML Table ## #set ($htmlLiveTableId = $escapetool.xml($divid)) <div class="xwiki-livetable-container"> #if("$!topfilters" !='') #set($hasTopFilters = true) #else #set($hasTopFilters = false) #end #if($tagcloud || $hasTopFilters) <div class="tipfilters"> #end #if($hasTopFilters) <div id="${htmlLiveTableId}-topfilters" class="xwiki-livetable-topfilters-tip #if($tagcloud)splitted#end"> <div> <div class="xwiki-livetable-topfilters-container"> $topfilters </div> <div class="tippointer"> <div></div> </div> </div> </div> #end #if($tagcloud) #set($discard = $xwiki.ssx.use('XWiki.TagCloud')) <div id="${htmlLiveTableId}-tagcloud" class="xwiki-livetable-tagcloud-tip hidden #if($hasTopFilters)splitted#end"> <div> <div class="xwiki-livetable-tagcloud-container"> <h2>$services.localization.render('platform.livetable.tagsHelp') $services.localization.render('platform.livetable.tagsHelpCancel')</h2> <div class="xwiki-livetable-tagcloud"></div> </div> <div class="tippointer"> <div></div> </div> </div> </div> #end #if($tagcloud || $hasTopFilters) </div> #end <table id="${htmlLiveTableId}" class="xwiki-livetable"> #if("$!options.description" != '') <caption class="sr-only">$options.description</caption> #end <tr> <td class="xwiki-livetable-pagination"> <span id="${htmlLiveTableId}-limits" class="xwiki-livetable-limits"></span> #if($hasPageSize) <span id="${htmlLiveTableId}-pagesize" class="xwiki-livetable-pagesize"> <span>$services.localization.render('platform.livetable.pagesizeLabel')</span> <span class="xwiki-livetable-pagesize-content" ></span> </span> #end <span id="${htmlLiveTableId}-ajax-loader" class="xwiki-livetable-loader hidden"> <img src="$xwiki.getSkinFile('icons/xwiki/ajax-loader-large.gif')" alt="$escapetool.xml($services.localization.render('platform.livetable.loading'))" title="" /> </span> <span class="controlPagination"> <a title="$escapetool.xml($services.localization.render('platform.livetable.paginationPagePrevTitle'))" class="prevPagination" href="#"><span class="hidden">$services.localization.render('platform.livetable.paginationPagePrevTitle')</span></a> <a title="$escapetool.xml($services.localization.render('platform.livetable.paginationPageNextTitle'))" class="nextPagination" href="#"><span class="hidden">$services.localization.render('platform.livetable.paginationPageNextTitle')</span></a> </span> <span class="pagination"> <span class="xwiki-livetable-pagination-text">$services.localization.render('platform.livetable.paginationPage')</span> <span class="xwiki-livetable-pagination-content" ></span> </span> </td> </tr> <tr> <td class="xwiki-livetable-display-container"> <table class="xwiki-livetable-display"> <thead class="xwiki-livetable-display-header"> <tr> #set($columnCount = 0) #foreach($colname in $collist) #set($colprop = $colprops.get($colname)) #set ($isFilterable = $colprop.filterable != false && $colname != '_actions' && $colprop.type != 'hidden') #set ($isSortable = $colprop.sortable != false && $colname != '_actions' && $colprop.type != 'hidden') ## Get the column's display name to use in the header. #set($displayName = "#getLivetableColumnDisplayName($colname, $colprop, $transprefix)") #set ($defaultHeaderClass = {'_actions': 'actions', '_avatar': 'avatar'}) #set ($discard = $colprop.putIfAbsent('headerClass', $defaultHeaderClass.get($colname))) <th scope="col" class="xwiki-livetable-display-header-text $!colprop.headerClass #if ($!colprop.type == 'hidden')hidden#end #if ($isSortable)sortable #if ($colname == $selectedColumn)selected $defaultOrder#else asc#end#end"> #if($isFilterable)<label for="xwiki-livetable-${htmlLiveTableId}-filter-${velocityCount}">#end #if($isSortable)<a data-rel="${colname}">#end $displayName #if($isSortable)</a>#end #if($isFilterable)</label>#end #set($columnCount = $mathtool.add($columnCount, 1)) </th> #end </tr> #livetable_filters($collist $colprops $classname) <tr class="xwiki-livetable-initial-message"> <td colspan="${columnCount}"> <div class="warningmessage">$services.localization.render('platform.livetable.environmentCannotLoadTableMessage')</div> </td> </tr> </thead> <tbody id="${htmlLiveTableId}-display" class="xwiki-livetable-display-body"><tr><td> </td></tr></tbody> </table> </td> </tr> <tr> <td class="xwiki-livetable-pagination"> <span class="xwiki-livetable-limits"></span> <span class="controlPagination"> <a title="$escapetool.xml($services.localization.render('platform.livetable.paginationPagePrevTitle'))" class="prevPagination" href="#"><span class="hidden">$services.localization.render('platform.livetable.paginationPagePrevTitle')</span></a> <a title="$escapetool.xml($services.localization.render('platform.livetable.paginationPageNextTitle'))" class="nextPagination" href="#"><span class="hidden">$services.localization.render('platform.livetable.paginationPageNextTitle')</span></a> </span> <span class="pagination"> <span class="xwiki-livetable-pagination-text">$services.localization.render('platform.livetable.paginationPage')</span> <span class="xwiki-livetable-pagination-content" ></span> </span> </td> </tr> </table> <div id="${htmlLiveTableId}-inaccessible-docs" class="hidden"> #info($services.localization.render('rightsmanager.documentrequireviewrights')) </div> <div id="${htmlLiveTableId}-computed-title-docs" class="hidden"> #info("(<span class='docTitleComputed'></span>) $services.localization.render('platform.livetable.docTitleComputedHint')") </div> <script type="text/javascript"> //<![CDATA[ (function() { var startup = function(container) { // Make sure the LiveTable code is loaded (the WYSIWYG editor doesn't load the JavaScript code for instance). var liveTableCodeLoaded = XWiki && XWiki.widgets && XWiki.widgets.LiveTable; // Also make sure the live table is not already initialized. #set ($jsLiveTableId = $escapetool.javascript($divid)) var liveTableElement = $('$jsLiveTableId'); if (liveTableCodeLoaded && liveTableElement && !liveTableElement.__liveTable && (liveTableElement == container || liveTableElement.descendantOf(container))) { #set ($liveTableParams = { 'maxPages': $maxPages, 'limit': $count, 'selectedTags': $selectedTags }) #if ($hasTopFilters) #set ($cssLiveTableId = $escapetool.css($divid)) #set ($discard = $liveTableParams.put('filterNodes', [ "$escapetool.h$cssLiveTableId .xwiki-livetable-display-filters", "${jsLiveTableId}-topfilters" ])) #end #if ($hasPageSize && "$!pageSizeBounds" != '') #set ($discard = $liveTableParams.put('pageSizeBounds', $pageSizeBounds)) #end #set ($callbackParam = "#livetablecallback($divid $collist $colprops $transprefix), ") #if ($!callback != '') #set ($callbackParam = "$callback, ") #end window[$jsontool.serialize($jsName)] = liveTableElement.__liveTable = new XWiki.widgets.LiveTable("$dataurl", "$jsLiveTableId", $callbackParam$jsontool.serialize($liveTableParams)); #if ($hasPageSize) document.observe("xwiki:livetable:${jsLiveTableId}:loadingEntries", function() { $('${jsLiveTableId}-pagesize').addClassName("hidden"); }); document.observe("xwiki:livetable:${jsLiveTableId}:loadingComplete", function() { $('${jsLiveTableId}-pagesize').removeClassName("hidden"); }); #end return true; } return false; }; var init = function(event) { var elements = (event && event.memo.elements) || [$('body')]; return elements.length > 0 && elements.some(startup); }; // Initialize the live table on page load or after the live table code has been loaded. (XWiki && XWiki.isInitialized && init()) || document.observe('xwiki:livetable:loading', init); // Initialize the live table when it is added after the page is loaded. document.observe('xwiki:dom:updated', init); })(); //]]> </script> </div>## xwiki-livetable-container ## Close wiki syntax wrappers. Do not modify the indentation below or it will generate unwanted paragraphs! #if("$!options.outputOnlyHtml" != 'true')#if($xwiki.getCurrentContentSyntaxId() != "xwiki/1.0"){{/html}} #else{/pre}#end## #end## end-wrappers #end## end-livetable-macro #macro (livetable_filter $column $columnProperties $xproperty) #set ($filterType = $columnProperties.type) #if ("$!filterType" == '') ## Determine the filter type from the xproperty type. #set ($filterTypeByXPropertyType = { 'Boolean': 'boolean', 'DBList': 'suggest', 'DBTreeList': 'suggest', 'Date': 'date', 'Email': 'text', 'Groups': 'suggest', 'Number': 'number', 'Page': 'suggest', 'StaticList': 'list', 'String': 'text', 'TextArea': 'text', 'Users': 'suggest' }) #set ($filterType = $filterTypeByXPropertyType.get($xproperty.classType)) #if ("$!filterType" == '') ## If we get here then it means the column is filterable but we could not determine the filter type. Use the text ## filter in this case because it is the most generic. #set ($filterType = 'text') #end #end #if ($filterType == 'list' || $filterType == 'multilist') <select id="xwiki-livetable-${htmlLiveTableId}-filter-$velocityCount" name="$column" #if ($filterType == 'multilist') #set ($discard = $xwiki.jsfx.use('js/xwiki/table/livetablemulti.js', true)) #set ($discard = $xwiki.linkx.use($services.webjars.url('bootstrap-select', 'css/bootstrap-select.css'), {'type': 'text/css', 'rel': 'stylesheet'})) class="xwiki-livetable-multilist" multiple="multiple"> #else ><option value="">$services.localization.render('platform.livetable.selectAll')</option> <option disabled="disabled">────</option> #end #set ($storedValues = $xproperty.listValues) #set ($displayedValues = $xproperty.mapValues) #foreach ($storedValue in $storedValues) #set ($l10nKey = "${xproperty.className}_${column}_$storedValue") #set ($displayedValue = $services.localization.render($l10nKey)) #if ($displayedValue == $l10nKey) #set ($displayedValue = $displayedValues.get($storedValue).value) #end <option value="$storedValue">$displayedValue</option> #end </select> #elseif ($filterType == 'boolean') <select id="xwiki-livetable-${htmlLiveTableId}-filter-$velocityCount" name="$column"> <option value="">$services.localization.render('platform.livetable.selectAll')</option> <option value="0">$services.localization.render('no')</option> <option value="1">$services.localization.render('yes')</option> </select> #elseif ($filterType == 'text' || $filterType == 'number') <input id="xwiki-livetable-${htmlLiveTableId}-filter-$velocityCount" name="$column" type="text" #if ("$!columnProperties.size" != '')size="$!escapetool.xml($columnProperties.size)"#end title="$escapetool.xml($services.localization.render('platform.livetable.filtersTitle', [$services.localization.render("${transprefix}$column")]))" /> #elseif ($filterType == 'date') #set ($discard = $xwiki.jsfx.use('js/xwiki/table/livetabledate.js', true)) #set ($discard = $xwiki.linkx.use($services.webjars.url('bootstrap-daterangepicker', 'css/bootstrap-daterangepicker.css'), {'type': 'text/css', 'rel': 'stylesheet'})) ## Hidden input for date fields allows us to send timestamps to the server while displaying pretty dates. <input name="$column" type="hidden" /> #set ($dateFormat = $xproperty.getValue('dateFormat')) #if ("$!dateFormat" == '') #set ($dateFormat = $xwiki.getXWikiPreference('dateformat', 'yyyy/MM/dd HH:mm')) #end <input id="xwiki-livetable-${htmlLiveTableId}-filter-$velocityCount" type="text" data-type="date" data-dateformat="$escapetool.xml($dateFormat)" #if ("$!columnProperties.size" != '')size="$!escapetool.xml($columnProperties.size)"#end title="$escapetool.xml($services.localization.render('platform.livetable.filtersTitle', [$services.localization.render("${transprefix}$column")]))" /> #elseif ($filterType == 'suggest' && $xproperty) #set ($discard = $xwiki.linkx.use($services.webjars.url('selectize.js', 'css/selectize.bootstrap3.css'), {'type': 'text/css', 'rel': 'stylesheet'})) #set ($discard = $xwiki.ssfx.use('uicomponents/suggest/xwiki.selectize.css', true)) #set ($discard = $xwiki.jsfx.use('uicomponents/suggest/suggestPropertyValues.js', {'forceSkinAction' : true, 'language' : $xcontext.locale})) <select id="xwiki-livetable-${htmlLiveTableId}-filter-$velocityCount" name="$!escapetool.xml($column)" class="suggest-propertyValues" multiple="multiple" size="1" data-className="$!escapetool.xml($xproperty.className)" data-propertyName="$!escapetool.xml($xproperty.name)"> </select> #end #end ## ## #** * Generates a vertical menu item from an object (a map) * * Expected format: * item = map with the following fields: * 'id' : mandatory * 'name' : the text displayed for the corresponding menu item; * optional, defaults to * $services.localization.render("$!{translationPrefix}${item.id}") * 'url' : the "action" of the menu item; optional * 'cssClass' : a specific css class for the menu item for custom * styling; optional, defaults to '' * 'children' : vector of items, allowing to recursively define submenus * * @param $item the menu item object, in the format described above * @param $level the current level of the item, of the form '\*+'; the number of * stars indicates the depth of the item in the menu * @param $options a map of options, where the following entries are currently used: * 'translationPrefix' : the translation prefix added to the id of each * item, in order to generate the name; ignored for items whose * name is specified * 'crtItemId': identifier of the current menu item (for differential styling) *# #macro(verticalNavigationItem $item $level $options) #set ($class = "$!{item.cssClass}") #set ($hasChildren = ($item.children && $item.children.size() > 0)) #if ($hasChildren) #set ($class = "$class group") #end #if ($options.crtItemId == $item.id) #set ($class = "$class current") #if ($hasChildren) #set ($class = "$class current-group") #end #end #set ($class = $class.trim()) #set ($name = "$!{item.name}") #if ($name == '') #set ($name = $services.localization.render("$!{options.translationPrefix}${item.id}")) #end $level (% id="vertical-menu-${item.id}" class="${class}" %){{html}}<a #if ("$!{item.url}" != '')href="$item.url"#{end}>#if($item.glyphicon)$services.icon.renderHTML($item.glyphicon) #end$name</a>{{/html}} #if ($hasChildren) #set ($children = []) #sortCollectionOfMapsByField($item.children, 'order', 99999, 'asc', $children) #foreach ($child in $children) #verticalNavigationItem($child $level.concat('*') $options) #end #end #end #** * Start a breadcrumb. * * Should be used in HTML. *# #macro(breadcrumb_start) <ol class="breadcrumb"> #end #** * End of a breadcrumb * * Should be used in HTML. *# #macro(breadcrumb_end) </ol> #end #** * Display a line in the breadcrumb * * Should be used in HTML. *# #macro(breadcrumb_line $link $title) <li><a href="$link">$title</a></li> #end #** * Display the current line in the breadcrumb * * Should be used in HTML. *# #macro(breadcrumb_current_line $title) <li class="active">$title</li> #end ### ### Glyph Icon ### ### @param iconName The name of the icon to display, without the glyphicon prefix (eg: 'globe') #macro(glyphicon $iconName) #if("$!iconName"!='')<span class="glyphicon glyphicon-${iconName}"></span>#end #end #macro(displayDocumentTitle $stepTitle $titleHint) <div class="row document-header"> <div class="document-info col-xs-12"> <div id="document-title"><h1>$stepTitle</h1></div> #if ($titleHint) <div class="xdocLastModification">$titleHint</div> #end </div> </div> <hr/> #end #** * Pulls all the JavaScript and CSS resources needed by the date & time picker. *# #macro (dateTimePicker_import) #set ($discard = $xwiki.linkx.use( $services.webjars.url('Eonasdan-bootstrap-datetimepicker', 'css/bootstrap-datetimepicker.min.css'), {'type': 'text/css', 'rel': 'stylesheet'} )) #set ($discard = $xwiki.jsfx.use('dateTimePicker.js', true)) #end #** * Pulls all the JavaScript and CSS resources needed by the color picker. *# #macro (colorPicker_import) #set ($discard = $xwiki.linkx.use($services.webjars.url('colpick', 'css/colpick.css'), {'type': 'text/css', 'rel': 'stylesheet'})) #set ($discard = $xwiki.ssfx.use('colorPicker.css')) #set ($discard = $xwiki.jsfx.use('colorPicker.js', true)) #end #macro (colorPicker_input $parameters) #set ($discard = $parameters.putIfAbsent('class', 'form-control color-picker type-color')) #if ("$!parameters.disabled" == 'true') #set ($parameters.disabled = 'disabled') #else #set ($discard = $parameters.remove('disabled')) #end <div class="input-group"> <input type="text" #foreach ($parameter in $parameters.entrySet()) $escapetool.xml($parameter.key)="$!escapetool.xml($parameter.value)" #end /> <span class="input-group-addon"><span class="color-preview"></span></span> </div> #end