  
                    





                
                
  
  



<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  <head>
                    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                                    <title>Custom configurable sections</title>
                        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
                <link rel="shortcut icon" href="resources/icons/xwiki/favicon.ico" />
        <link rel="icon" href="resources/icons/xwiki/favicon16.png" type="image/png" />
        <link rel="icon" href="resources/icons/xwiki/favicon.svg" type="image/svg+xml" />
        <link rel="apple-touch-icon" href="resources/icons/xwiki/favicon144.png" />
                <meta http-equiv="Content-Script-Type" content="text/javascript" />
                        <meta http-equiv="imagetoolbar" content="no"/>
                                <link rel="canonical" href="xwiki.XWiki.ConfigurableClass.html" />
                            <meta name="document" content="XWiki.ConfigurableClass"/>
    <meta name="wiki" content="xwiki"/>
    <meta name="space" content="XWiki"/>
    <meta name="page" content="ConfigurableClass"/>
    <meta name="version" content="1.1"/>
    <meta name="restURL" content="/rest/wikis/xwiki/spaces/XWiki/pages/ConfigurableClass"/>
    <meta name="form_token" content="suaDmCPLcw0lOb28p5xPuw"/>
                <meta name="gwt:property" content="locale=en" />
                <meta name="revisit-after" content="7 days" />
<meta name="description" content="Custom configurable sections" />
<meta name="keywords" content="wiki" />
<meta name="distribution" content="GLOBAL" />
<meta name="rating" content="General" />
<meta name="author" content="Administrator" />
<meta http-equiv="reply-to" content="" />
<meta name="language" content="en" />
<meta name="google-site-verification" content="qE1BFB2hw6qPJgzEuttEuj-GlvC4aWOtFVY4rJKYhWw" />
<link rel="icon" href="attachment/xwiki.XWiki.DefaultSkin.favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="attachment/xwiki.XWiki.DefaultSkin.favicon.ico" type="image/x-icon"/>
<link rel="alternate" type="application/rss+xml" title="Wiki Feed RSS" href="http://scm.bytebang.at/Main/WebRss?xpage=rdf" />
<link rel="alternate" type="application/rss+xml" title="Blog RSS Feed" href="http://scm.bytebang.at/Blog/GlobalBlogRss?xpage=plain" />

                <!-- com.xpn.xwiki.plugin.skinx.LinkExtensionPlugin -->
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
<link href="skins/colibri/style.css?colorTheme=ColorThemes.DefaultColorTheme" rel="stylesheet" type="text/css" media="all" />
<link href="skins/colibri/print.css?colorTheme=ColorThemes.DefaultColorTheme" rel="stylesheet" type="text/css" media="print" />
        <!--[if IE]>
  <link href="skins/colibri/ie-all.css?colorTheme=ColorThemes.DefaultColorTheme" rel="stylesheet" type="text/css" />
<![endif]-->
    <!-- com.xpn.xwiki.plugin.skinx.CssResourceSkinExtensionPlugin -->
  <!-- com.xpn.xwiki.plugin.skinx.CssSkinExtensionPlugin -->
  <!-- com.xpn.xwiki.plugin.skinx.CssSkinFileExtensionPlugin -->

                                                                                                                                                                                                                                                        <!-- com.xpn.xwiki.plugin.skinx.JsResourceSkinExtensionPlugin -->
    <!-- com.xpn.xwiki.plugin.skinx.JsSkinFileExtensionPlugin -->
    <!-- com.xpn.xwiki.plugin.skinx.JsSkinExtensionPlugin -->

<script type="text/javascript" src="resources/js/xwiki/compatibility.js" defer="defer"></script>
<script type="text/javascript" src="resources/js/xwiki/markerScript.js" defer="defer"></script>
<script type="text/javascript">
// <![CDATA[
require.config({
  baseUrl: '/',
    paths: { 'jquery': "resources/js/amd/jquery" },
  map: {
    '*': { 'jquery': 'jQueryNoConflict' },
    'jQueryNoConflict': { 'jquery': 'jquery' }
  }
});
define('jQueryNoConflict', ['jquery'], function($) { $.noConflict(); return $; });
XWiki.webapppath = "";
XWiki.servletpath = "bin/";
XWiki.contextPath = "";
XWiki.mainWiki = "xwiki";
XWiki.currentWiki = "xwiki";
XWiki.currentSpace = "XWiki";
XWiki.currentPage = "ConfigurableClass";
XWiki.editor = "";
XWiki.viewer = "";
XWiki.contextaction = "export";
XWiki.docisnew = false;
XWiki.docsyntax = "xwiki/2.0";
XWiki.docvariant = "";
XWiki.blacklistedSpaces = [ "Import","Panels","Scheduler","Stats","XAppClasses","XAppSheets","XAppTemplates","XWiki","WatchCode","WatchSheets","XApp","WatchAdmin","Watch","ColorThemes","AnnotationCode" ];
XWiki.hasEdit = false;
XWiki.hasProgramming = false;
XWiki.hasBackupPackImportRights = false;
XWiki.hasRenderer = true;
window.docviewurl = "xwiki.XWiki.ConfigurableClass.html";
window.docediturl = "http://scm.bytebang.at/bin/edit/XWiki/ConfigurableClass";
window.docsaveurl = "http://scm.bytebang.at/bin/save/XWiki/ConfigurableClass";
window.docgeturl = "http://scm.bytebang.at/bin/get/XWiki/ConfigurableClass";
// ]]>
</script>

  </head>
  <body id="body" class="skin-colibri wiki-xwiki space-XWiki viewbody hidelefthideright">
<div id="xwikimaincontainer">
<div id="xwikimaincontainerinner">

  <div id="menuview">
    <div id="mainmenu" class="layoutsubsection actionmenu">
<div class="gradientfilterIE"></div>
<div class="componentcontainer">
<strong id="xwikimenutitle" class="hidden">General Actions:</strong>
<div class="rightmenu">
      <div id="tmLogin" class="tmLogin topmenuentry ">
   <a class="tme" href="http://scm.bytebang.at/bin/login/XWiki/XWikiLogin?xredirect=http%3A%2F%2Fscm.bytebang.at%2Fbin%2Fexport%2FXWiki%2FConfigurableClass%3Fformat%3Dhtml%26showlinenumbers%3D0%26viewer%3Dcode"><strong>Log-in</strong></a>
  </div>
    <div id="tmRegister" class="tmRegister topmenuentry ">
   <a class="tme" href="http://scm.bytebang.at/bin/register/XWiki/Register"><strong>Register</strong></a>
  </div>
</div>
<div class="leftmenu">
  <div id="tmMainWiki" class="tmMainWiki topmenuentry dropdownmenuentry  hasIcon" onmouseover="showsubmenu(this);" onmouseout="hidesubmenu(this);">
<span class="tme-extensible">
   <a class="tme" href="http://scm.bytebang.at/bin/Main/"><strong>Home</strong></a>
    <span class="menuarrow">&#9660;</span><span class="hidden menucolon">: </span>
</span><span class="submenu hidden">
        <span class="submenuitem "><a href="http://scm.bytebang.at/bin/WikiManager/" id="tmWikiIndex" class="tmWikiIndex">Wiki Index</a></span>
      </span></div>
<div class="topmenuentry"><span class="separator">&raquo;</span></div>
  <div id="tmSpace" class="tmSpace topmenuentry hasIcon">
      <span class="tmetype">Space: </span><a class="tme hastype" href="http://scm.bytebang.at/bin/XWiki/"><strong>XWiki</strong></a>
  </div>
<div class="topmenuentry"><span class="separator">&raquo;</span></div>
  <div id="tmPage" class="tmPage topmenuentry hasIcon">
      <span class="tmetype">Page: </span><a class="tme hastype" href="xwiki.XWiki.ConfigurableClass.html"><strong>ConfigurableClass</strong></a>
  </div>
</div>
</div>
</div>

  </div>
 <div id="headerglobal" class="layoutsection">
<div class="minwidthd"></div>
  <div id="company">
  <div id="companylogo">
    <a href="http://scm.bytebang.at/bin/Main/" title="Home" rel="home">
    <img src="attachment/xwiki.ColorThemes.DefaultColorTheme.logo.png" alt="Wiki Logo"/>
    </a>
  </div>   </div>   <div id="globallinks">
      <span class="glink" id="headerlanguages">
            <a href="xwiki.XWiki.ConfigurableClass.html" class="language-default language-current">default</a>
      </span>
  </div>   <div class="clearfloats"></div>
  </div> 

<div class="contenthidelefthideright" id="contentcontainer">
<div id="contentcontainerinner">
<div class="leftsidecolumns">
  <div id="contentcolumn"> 
        <div class="main layoutsubsection">
      <div id="contentmenu" class="actionmenu">
    <div class="gradientfilterIE"></div>
<div class="componentcontainer">
<strong id="xwikicontentmenutitle" class="hidden">Page Actions:</strong>
<div class="rightmenu">
</div>
<div class="leftmenu">
  <div id="tmExport" class="tmExport topmenuentry dropdownmenuentry dropdownnolink " onmouseover="showsubmenu(this);" onmouseout="hidesubmenu(this);">
<span class="tme-extensible">
   <a class="tme"><strong>Export</strong></a>
    <span class="menuarrow">&#9660;</span><span class="hidden menucolon">: </span>
</span><span class="submenu hidden">
    <span class="submenuitem "><a href="xwiki.XWiki.ConfigurableClass.html" id="tmExportPdf" class="tmExportPdf">Export as PDF</a></span>
    <span class="submenuitem "><a href="http://scm.bytebang.at/bin/export/XWiki/ConfigurableClass?format=rtf&amp;format=html&amp;showlinenumbers=0&amp;viewer=code" id="tmExportRtf" class="tmExportRtf">Export as RTF</a></span>
  <span class="submenuitem "><a href="http://scm.bytebang.at/bin/export/XWiki/ConfigurableClass?format=html&amp;format=html&amp;showlinenumbers=0&amp;viewer=code" id="tmExportHtml" class="tmExportHtml">Export as HTML</a></span>
    </span></div>
  <div id="tmMoreActions" class="tmMoreActions topmenuentry dropdownmenuentry dropdownnolink " onmouseover="showsubmenu(this);" onmouseout="hidesubmenu(this);">
<span class="tme-extensible">
   <a class="tme"><strong>More actions</strong></a>
    <span class="menuarrow">&#9660;</span><span class="hidden menucolon">: </span>
</span><span class="submenu hidden">
  <span class="submenuitem "><a href="xwiki.XWiki.ConfigurableClass.html" id="tmPrintPreview" class="tmPrintPreview">Print preview</a></span>
  <span class="submenuitem "><a href="xwiki.XWiki.ConfigurableClass.html" id="tmViewSource" class="tmViewSource">View Source</a></span>
  </span></div>
  </div>
</div>
    </div>
    <div id="mainContentArea">
  
   <div id="hierarchy">
                                          <a href='http://scm.bytebang.at/bin/Main/'>Welcome to bytebang</a> <span class='separator'>&#187;</span> <a href='http://scm.bytebang.at/bin/XWiki/'>XWiki Space</a> <span class='separator'>&#187;</span> <span class='current'>Custom configurable sections</span>
                      </div>

      <div id="document-title"><h1>Wiki source code of <a href="xwiki.XWiki.ConfigurableClass.html">Custom configurable sections</a></h1></div>
                    <div id="document-info">
    <div class="xdocLastModification">       Last modified by <span class="wikilink"><a href="http://scm.bytebang.at/bin/XWiki/Admin">Administrator</a></span> on 2014/06/29 19:28
    </div>
    <div>
                      <span id="attachmentsshortcut"><a href="xwiki.XWiki.ConfigurableClass.html">Attachments</a> <span class="itemCount">(1)</span></span>
               <span class="separator">&#183;</span>         <span id="informationshortcut"><a href="xwiki.XWiki.ConfigurableClass.html">Information</a></span>
          </div>
    <div class="clearfloats"></div>
  </div>

<div>
  <a href="xwiki.XWiki.ConfigurableClass.html" id="toggleLineNumbers">Show line numbers</a>
  <textarea readonly="readonly" class="wiki-code" rows="25" cols="80">{{include reference=&quot;XWiki.ConfigurableClassMacros&quot; /}}

{{velocity}}
#*
 * This part takes the configuration from any documents containing XWiki.ConfigurableClass objects and creates a form
 * for each. To includeForm this document, you may specify:
 *
 * $section - String - The section which we are administrating eg: &quot;Registration&quot;, &quot;Users&quot;, or &quot;Import&quot;.
 *                     If none is specified then it checks for a request parameter called &quot;section&quot; and uses that,
 *                     if no parameter, then this code assumes that it is part of the admin icons sheet and adds icons
 *                     for any section which is not in $sections, in that event, this code assumes it is being run
 *                     inside of a &lt;ul&gt; block.
 *
 * $sections - List&lt;String&gt; - If section is not specified, any sections on this list will not have icons made for them,
 *                            the assumption being that the icons are already there. If section is specified then this
 *                            is not taken into account and may safely be undefined.
 *
 * $currentDoc - String (document.fullName) - The administration document, users who don't have permission to edit
 *                                            it will not be able to include applications (possibly injecting
 *                                            arbitrary code.) if none specified then $doc.getFullName() is used.
 *
 * $globaladmin - boolean - If set true then we will assume we are administrationg the entire wiki.
 *                          If not set then we look for a request parameter called &quot;editor&quot; if that exists and equals
 *                          &quot;globaladmin&quot; then $globaladmin is true, if it doesn't exist then we check to see if
 *                          $currentDoc.getFullName() equals &quot;XWiki.XWikiPreferences&quot;.
 *###
##
## Form submission depends on this.
$xwiki.jsfx.use('js/xwiki/actionbuttons/actionButtons.js', true)
##
#if(!$section)
  #set($section = $request.getParameter('section'))
#end
#if(!$currentDoc)
  #set($currentDoc = $doc.getFullName())
#end
## Get value of $globaladmin if not specified.
#if(&quot;$!globaladmin&quot; == '')
  #if($editor != 'globaladmin'
      &amp;&amp; $request.getParameter('editor') != 'globaladmin'
      &amp;&amp; $currentDoc != 'XWiki.XWikiPreferences')
  ##
    #set($globaladmin = false)
  #else
    #set($globaladmin = true)
  #end
#end
#set($currentSpace = $xwiki.getDocument($currentDoc).getSpace())
##
## This application should not run with programming rights because it evaluates code which may not be trustworthy.
## Removing the next line will open a security hole.
$doc.dropPermissions()##
##
##------------------------------------------------------------------------------------------------------------
## If $section exists then we are viewing the admin page for a particular section.
## eg: 'Registration', 'Presentation', 'Import' etc.
##------------------------------------------------------------------------------------------------------------
##
#if($section &amp;&amp; $section != '')
  ##
  ## This is for keeping track of whether we have shown the heading yet or not.
  ## If the heading doesn't need to be shown, but an error occurs in processing, then we show the heading
  ## so that the user knows what the error relates to.
  #set($headingShowing = false)
  ##
  ## Searches the database for names of apps to be configured
  #set($outputList = [])
  #findNamesOfAppsToConfigure($section, $globaladmin, $xwiki.getDocument($currentDoc).getSpace(), $outputList)
  ##
  #foreach($appName in $outputList)
    ##
    ## Make sure the current user has permission to edit the configurable application.
    #set($userHasAccessToDocument = $xcontext.hasAccessLevel('edit', $appName))
    ##
    ## If the document was not last saved by a user with edit privilege on this page
    ## then we can't safely display the page but we should warn the viewer.
    #if($userHasAccessToDocument)
      ## Get the configurable application
      #set($app = $xwiki.getDocument($appName))
      ##
      #set($documentSavedByAuthorizedUser = false)
      #checkDocumentSavedByAuthorizedUser($app, $currentDoc, $documentSavedByAuthorizedUser)
    #end
    ##
    ## There is no need to display a heading unless:
    ## 1. There was already a section before this document.
    ## 2. This is not the first document in this section.
    ##
    ## If we are displaying the heading and there is an error to be shown Javascript will not strip the heading.
    #if(!$appName.equals($outputList.get(0)) || $sections.contains($section))
      ## Create a document heading.
      #showHeading($appName, $headingShowing)
    #end
    ##
    #if(!$userHasAccessToDocument)
      #showHeading($appName, $headingShowing)

      {{error}}{{translation key=&quot;xe.admin.configurable.noPermissionThisApplication&quot;/}}{{/error}}

    #elseif(!$documentSavedByAuthorizedUser)
      #showHeading($appName, $headingShowing)

      {{error}}{{translation key=&quot;xe.admin.configurable.applicationAuthorNoAdmin&quot; parameters=&quot;$app.Author&quot;/}}{{/error}}

    ##
    ##------------------------------------------------------------------------------------------------------------
    ## If the document is locked and not by the current user and forceEdit is not set true,
    #elseif($app.getLocked() &amp;&amp; $app.getLockingUser() != $xcontext.getUser() &amp;&amp; !$request.getParameter('forceEdit'))
      #set($requestURL = &quot;$request.getRequestURL()&quot;)
      #if($requestURL.indexOf('?') == -1)
        #set($requestURL = &quot;${requestURL}?&quot;)
      #end
      #showHeading($appName, $headingShowing)

      {{error}}{{translation key=&quot;doclockedby&quot;/}} $app.getLockingUser() [[{{translation key=&quot;forcelock&quot;/}}&gt;&gt;${requestURL}&amp;forceEdit=1]]{{/error}}

    #else
      ## If the document is not already locked, attempt to acquire the lock.
      #if(!$app.getLocked())

        {{html wiki=true}}
          &lt;noscript&gt;

            {{warning}}{{translation key=&quot;xe.admin.configurable.cannotLockNoJavascript&quot;/}}{{/warning}}

          &lt;/noscript&gt;
          &lt;script type=&quot;text/javascript&quot;&gt;
            document.observe(&quot;xwiki:dom:loaded&quot;, function() {
              new XWiki.DocumentLock('$escapetool.javascript($app.fullName)').lock();
            });
          &lt;/script&gt;
        {{/html}}
      #end
      ##------------------------------------------------------------------------------------------------------------
      ## Done Locking.
      ##
      ## Get all objects of the &quot;ConfigurableClass&quot; from this document.
      #set($allConfigurableObjs = $app.getObjects($nameOfThisDocument))
      ## Separate out the objects which are for this section.
      #set($configurableObjs = [])
      #foreach($configurableObj in $allConfigurableObjs)
        #if($app.getValue('displayInSection', $configurableObj) == $section)
          ## If this is space admin, then don't display global, if global don't display space.
          #if($globaladmin == ($app.getValue('configureGlobally', $configurableObj) == 1))
            #set($discard = $configurableObjs.add($configurableObj))
          #end
        #end
      #end
      #if($configurableObjs.size() == 0)
        ## Internal error, not translated.
        #showHeading($appName, $headingShowing)

        {{error}}Internal error: All objects were filtered out for application: $appName.{{/error}}

      #else
        #set($formAction = $xwiki.getURL($app.getFullName(), 'save'))
        #set($formId = &quot;${section.toLowerCase()}_${app.getFullName()}&quot;)
        #set($escapedAppName = $escapetool.xml($app.getFullName()))
        #foreach($configurableObj in $configurableObjs)
          ## Display the header if one exists.
          #set($heading = $app.getValue('heading', $configurableObj))
          #if($heading &amp;&amp; $heading != '')
            == #evaluate($heading) ==
          #end
          ##
          #set($codeToExecute = &quot;$!app.getValue('codeToExecute', $configurableObj)&quot;)
          #if($codeToExecute != '')
            (%class=&quot;codeToExecute&quot;%)(((##
              #evaluate($codeToExecute)##
            )))
          #end
          ##
          ## If propertiesToShow is set, then we will only show the properties contained therein.
          #set($propertiesToShow = $app.getValue('propertiesToShow', $configurableObj))
          #if(!$propertiesToShow || $propertiesToShow.getClass().getName().indexOf('List') == -1)
            #set($propertiesToShow = [])
          #end
          ##
          ## If linkPrefix is set, then we will make each property label a link which starts with that prefix.
          #set($linkPrefix = &quot;$!app.getValue('linkPrefix', $configurableObj)&quot;)
          ##
          ## If the Configurable object specifies a configuration class, use it,
          ## otherwise assume custom forms are used instead.
          #set($configClassName = &quot;$!app.getValue('configurationClass', $configurableObj)&quot;)
          #if($configClassName != '')
            #set($objClass = $xwiki.getDocument($configClassName).getxWikiClass())
            #if(!$objClass || $objClass.getClass().getName().indexOf('.Class') == -1)
              #showHeading($appName, $headingShowing)

              {{error}}{{translation key=&quot;xe.admin.configurable.configurationClassNonexistant&quot;/}}{{/error}}

            #else
              ## Use the first object from the document which is of the configuration class.
              #set($obj = $app.getObject($objClass.getName()))
              ##
              #if(!$obj || $obj.getClass().getName().indexOf('.Object') == -1)
                #showHeading($appName, $headingShowing)

                {{error}}
                  {{translation key=&quot;xe.admin.configurable.noObjectOfConfigurationClassFound&quot; parameters=&quot;$objClass.getName(), $app.getFullName()&quot;/}}
                {{/error}}

              #else
                ##
                ## Merge save buttons, remove headings from subsections, and make information links into popups.
                ## This is not done if there is only a custom defined form.
                $xwiki.jsx.use($nameOfThisDocument)##
                ##
                ## We don't begin the form until we have content for it so that a configurable can specify a
                ## custom form in codeToExecute and if that configurable object is the first of it's kind in that
                ## document, the custom form will not be put inside of our form.
                #if(!$insideForm)
                  ## We are opening a form and fieldset without closing it, thus we cannot clean this html.

                  {{html clean=false}}
                    &lt;form id=&quot;$formId&quot; method=&quot;post&quot; action=&quot;$formAction&quot; class=&quot;xform half&quot;&gt;
                      &lt;fieldset&gt;
                  {{/html}}
                  #set($insideForm = true)
                #end

                {{html}}
                  $formHtml.toString()
                {{/html}}
              #end## If object exists
            #end## If class exists
          #end## If class name is specified.
        #end## Foreach configurable object found in this document
        ## If a form was started then we end it.
        #if($insideForm)

          ## This is closing an open form which was opened above, we cannot clean this html.
          {{html clean=false}}
          ## We add in a redirect field to prevent the user from being carried away when they save
          ## if they don't have javascript.
          #set($thisURL = $request.getRequestURL())
          #if($request.getQueryString() &amp;&amp; $request.getQueryString().length() &gt; 0)
            #set($thisURL = &quot;${thisURL}?$request.getQueryString()&quot;)
          #end
          &lt;input type=&quot;hidden&quot; id=&quot;${escapedAppName}_redirect&quot; name=&quot;$redirectParameter&quot; value=&quot;$escapetool.xml($thisURL)&quot; /&gt;
          &lt;input type=&quot;hidden&quot; name=&quot;form_token&quot; value=&quot;$!{services.csrf.getToken()}&quot; /&gt;
          &lt;/fieldset&gt;
          &lt;div class=&quot;bottombuttons&quot;&gt;
            &lt;p class=&quot;admin-buttons&quot;&gt;
              &lt;span class=&quot;buttonwrapper&quot;&gt;
                ## Text to display on the button. If there is a heading then this button should be labeled
                ## that it is for saving this section. Otherwise it should be a generic &quot;save&quot; button.
                #if($headingShowing)
                  #set($buttonText = &quot;$services.localization.render('admin.save') $escapedAppName&quot;)
                #else
                  #set($buttonText = &quot;$services.localization.render('admin.save')&quot;)
                #end
                &lt;input class=&quot;button&quot; type=&quot;submit&quot; name=&quot;action_saveandcontinue&quot; value=&quot;$buttonText&quot; /&gt;
              &lt;/span&gt;
            &lt;/p&gt;
          &lt;/div&gt; ## bottombuttons
          &lt;/form&gt;
          #set($insideForm = false)
          {{/html}}
        #end
      #end## If there are configurable objects
    #end## If document is not locked or forceEdit is enabled
  #end## Foreach document name in names to configure

  {{html}}
  &lt;script type=&quot;text/javascript&quot;&gt;
  /* &lt;![CDATA[ */
  ## Alt+Shift+S presses the first saveAndContinue button it finds, not what we want so we will disable edit shortcuts.
  document.observe('xwiki:dom:loaded', function() {
    XWiki.actionButtons.EditActions = Object.extend(XWiki.actionButtons.EditActions, {addShortcuts : function() { }});
  });
  //]]&gt;
  &lt;/script&gt;
  {{/html}}##
  ##
#else
  ##
  ##------------------------------------------------------------------------------------------------------------
  ## If section is not set then we are viewing the main administration page.
  ##------------------------------------------------------------------------------------------------------------
  ##
  ## If there is no list called sections then we set sections to an empty list.
  #if(!$sections || $sections.getClass().getName().indexOf('List') == -1)
    #set($sections = [])
  #end
  ##
  ## We have to create a list of documents which the current user doesn't have permission to view.
  ## So we can add an error message to the bottom of the page if there are any.
  #set($appsUserCannotView = [])
  ##
  ## A list of sections (to be added) which the user is not allowed to edit, icons will be displayed with a message
  #set($sectionsUserCannotEdit = [])
  ## List of sections to be added, in order by creationDate of oldest contained application.
  #set($sectionsToAdd = [])
  ## Map of URL of icon to use by the name of the section to use that icon on.
  #set($iconBySection = {})
  ##
  #set($outputList = [])
  #findNamesOfAppsToConfigure(&quot;&quot;, $globaladmin, $currentSpace, $outputList)
  ##
  #foreach($appName in $outputList)
    ##
    ## Get the configurable application
    #set($app = $xwiki.getDocument($appName))
    ##
    ## If getDocument returns null, then warn the user that they don't have view access to that application.
    #if(!$app)
      #set($discard = $appsUserCannotView.add($appName))
    #end
    ##
    #set($configurableObjects = $app.getObjects($nameOfThisDocument))
    #foreach($configurableObject in $configurableObjects)
      #set($displayInSection = $app.getValue('displayInSection', $configurableObject))
      ##
      ## If there is no section for this configurable or if the section cannot be edited, then check if the
      ## application can be edited by the current user, if so then we display the icon from the current app and
      ## don't display any message to tell the user they can't edit that section.
      #if(!$sections.contains($displayInSection) || $sectionsUserCannotEdit.contains($displayInSection))
        ##
        ## If there is no section for this configurable, then we will have to add one.
        #if(!$sections.contains($displayInSection) &amp;&amp; !$sectionsToAdd.contains($displayInSection))
          #set($discard = $sectionsToAdd.add($displayInSection))
        #end
        ##
        ## If an attachment by the filename iconAttachment exists and is an image
        #set($attachment = $app.getAttachment(&quot;$app.getValue('iconAttachment', $configurableObject)&quot;))
        #if($attachment &amp;&amp; $attachment.isImage())
          ## Set the icon for this section as the attachment URL.
          #set($discard = $iconBySection.put($displayInSection, $app.getAttachmentURL($attachment.getFilename())))
        #end
        ##
        ## If the user doesn't have edit access to the application, we want to show a message on the icon
        #if(!$xcontext.hasAccessLevel(&quot;edit&quot;, $app.getFullName()))
          #if(!$sectionsUserCannotEdit.contains($displayInSection))
            #set($discard = $sectionsUserCannotEdit.add($displayInSection))
          #end
        #elseif($sectionsUserCannotEdit.contains($displayInSection))
          ## If the user didn't have access to the section before but does have access to _this_ app which is
          ## configured in the section, then the section becomes accessible.
          #set($discard = $sectionsUserCannotEdit.remove($displayInSection))
        #end
      #end## If section doesn't exist or user doesn't have access.
    #end## Foreach configurable object in this app.
  #end## Foreach application which is configurable.
  ##
  ## Now we go through sectionsToAdd and generate icons for them
  #set($defaultIcon = $xwiki.getAttachmentURL($nameOfThisDocument, 'DefaultAdminSectionIcon.png'))
  #if($globaladmin)
    #set($queryString = &quot;editor=globaladmin&amp;amp;section=&quot;)
  #else
    #set($queryString = &quot;space=${currentSpace}&amp;amp;section=&quot;)
    #if($request.getParameter('editor'))
      #set($queryString = &quot;editor=$escapetool.url($request.getParameter('editor'))&amp;amp;$queryString&quot;)
    #end
  #end

  ## This is an html fragment and thus cannot be cleaned
  {{html clean=false}}
  #foreach($sectionToAdd in $sectionsToAdd)
    #set($icon = $iconBySection.get($sectionToAdd))
    #if(!$icon)
      #set($icon = $defaultIcon)
    #end
    &lt;li class=&quot;$escapetool.xml($sectionToAdd).replaceAll(' ', '_')&quot;&gt;
      #set($hasAccess = !$sectionsUserCannotEdit.contains($sectionToAdd))
      #if($hasAccess)
        &lt;a href=&quot;$xwiki.getURL($currentDoc, $xcontext.getAction(), &quot;$queryString$escapetool.url($sectionToAdd)&quot;)&quot;&gt;
      #else
        &lt;a title=&quot;$services.localization.render('xe.admin.configurable.sectionIconNoAccessTooltip')&quot;&gt;
      #end
      &lt;span&gt;
      &lt;img src=&quot;$icon&quot; alt=&quot;$escapetool.xml($sectionToAdd) icon&quot;/&gt;
      ## Try to translate the names of the sections, build the key by adding an &quot;admin.&quot; in front. 
      ## Not the best way to translate, but very inline with the way the translations are done in XWiki.AdminSheet for individual administration page titles.
      ## If there is no translation (translated message is equals to key), don't display the message key, but the section name instead.
      #if($services.localization.get(&quot;admin.${sectionToAdd.toLowerCase()}&quot;)) 
        #set($sectionDisplayName = $services.localization.render(&quot;admin.${sectionToAdd.toLowerCase()}&quot;)) 
      #else
        #set($sectionDisplayName = $sectionToAdd)
      #end
      $escapetool.xml($sectionDisplayName)
      &lt;/span&gt;
      #if(!$hasAccess)
        &lt;br/&gt;&lt;span class=&quot;errormessage&quot;&gt;$services.localization.render('xe.admin.configurable.sectionIconNoAccess')&lt;/span&gt;
      #end
      &lt;/a&gt;
    &lt;/li&gt;
  #end
  {{/html}}

  ## Finally we display an error message if there are any applications which we were unable to view.
  #if($appsUserCannotView.size() &gt; 0)

    {{error}}$services.localization.render('xe.admin.configurable.noViewAccessSomeApplications', [$appsUserCannotView]){{/error}}

  #end
#end## If we should be looking at the main administration page.
{{/velocity}}</textarea>
</div>

    <div class="clearfloats"></div>
  </div>    </div>      </div>
  </div>
<div class="clearfloats"></div>
  </div></div><div id="footerglobal" class="layoutsection">
<div class="minwidth"></div>
<hr/>
  <div id="xwikilicence">(c) 2025,  by bytebang e.U. - <a href="http://www.bytebang.at/About+us/Impressum">Impressum</a> - <a href="http://www.bytebang.at/About+us/PrivacyAndTermsOfUsage">Datenschutz / Nutzungsbedingungen</a></div>
          <div id="xwikiplatformversion">-</div>
<hr/>
</div>

</div></div></body>
</html>


