%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/waritko/jetty-distribution-9.4.21.v20190926/webapps/ROOT/skins/flamingo/
Upload File :
Create Path :
Current File : //home/waritko/jetty-distribution-9.4.21.v20190926/webapps/ROOT/skins/flamingo/shortcuts.vm

##
##
## Build the list of documents extras to display, if it does not exist (default).
## List format : ["ExtraAnchor",  "ExtraTabText", numberOfItems]
##
#if (!$docextralinks)
  #set($docextralinks = [])
  ## Children & Siblings (show it even if the document doesn't exist since there can be children or siblings)
  #if ($services.parentchild.isParentChildMechanismEnabled())
    #set ($discard = $docextralinks.add(['children', $services.localization.render('docextra.children'), -1, 'folder', {'hierarchy': 'parentchild'}]))
  #else
    #if ($doc.documentReference.name == 'WebHome')
      #set ($discard = $docextralinks.add(['children', $services.localization.render('docextra.children'), -1, 'folder', '', 'tmChildren']))
    #else
      ## Terminal document
      #set ($discard = $docextralinks.add(['siblings', $services.localization.render('docextra.siblings'), -1, 'folder', '', 'tmSiblings']))
    #end
  #end
  #if($xcontext.action == 'view' && $viewer != 'content' && !$doc.isNew())
    #set ($discard = $docextralinks.add(['content', $services.localization.render('core.links.content'), -1, 'file']))
  #end
  #if($viewer != 'comments' && $showcomments && !$doc.isNew())
    #set ($discard = $docextralinks.add(['comments', $services.localization.render('docextra.comments'), $doc.getObjects('XWiki.XWikiComments').size(), 'comment', '', 'tmComment']))
  #end
  #if($showannotations && !$doc.isNew())
    #if(!$annotationCount)
      ## Annotation count is supposed to be defined in xwikivars.vm. If for a reason or another it is not
      ## defined at this point, we tap into the standard annotation class, and do not load again the 
      ## config document. This however should not happen.
      #set ($annotationCount = $services.annotations.getAnnotations($doc).size())
    #end
    #set ($discard = $docextralinks.add(['annotations', $services.localization.render('docextra.annotations'), $annotationCount, 'pushpin']))
  #end
  #if($viewer != 'attachments' && $showattachments && !$doc.isNew())
    #set ($discard = $docextralinks.add(['attachments', $services.localization.render('docextra.attachments'), $doc.getAttachmentList().size(), 'attach', '', 'tmAttachments']))
  #end
  #if($viewer != 'history' && $showhistory && !$doc.isNew())
    #set ($discard = $docextralinks.add(['history', $services.localization.render('docextra.history'), -1, 'time', '', 'tmHistory']))
  #end
  #if($viewer != 'information' && $showinformation && !$doc.isNew())
    #set ($discard = $docextralinks.add(['information', $services.localization.render('docextra.information'), -1, 'information', '', 'tmInformation']))
  #end
#end

#foreach($docextralink in $docextralinks)
  #set ($idHref = '')
  #set ($extraAnchor = $docextralink.get(0))
  #set ($extraText = $docextralink.get(1))
  #set ($extraCount = $docextralink.get(2))
  #set ($glyphIcon = '')
  #if ($docextralink.size()>3)
    #set ($glyphIcon = $docextralink.get(3))
  #end
  #set ($extraParams = '')
  #if ($docextralink.size() > 4)
    #set ($extraParams = $docextralink.get(4))
  #end
  #if ($docextralink.size() > 5)
    #set ($idHref = $docextralink.get(5))
  #end
  #if ($extraCount > 0)
    #set ($extraText = "$extraText ($extraCount)")
  #end
  #if ("$!extraParams" != '')
    #set ($discard = $extraParams.put('viewer', $extraAnchor))
    #set ($url = $doc.getURL('view', $escapetool.url($extraParams)))
  #else
    #set ($url = $doc.getURL('view', "viewer=$escapetool.url($extraAnchor)"))
  #end

  #submenuitem($url, $escapetool.xml($extraText), $idHref, '', $glyphIcon)
#end

###########################################
##        ADD KEYBOARD SHORTCUTS
###########################################
<script type="text/javascript">
  #if($!xcontext.user != 'XWiki.XWikiGuest')
    //<![CDATA[
    /**
     * Perform a PUT on the given REST API. If the request is successful, reload the page.
     *
     * We use this function in order to quickly edit the user properties for developer shortcuts.
     * Also note that JQuery is not supported here, so we use a starndard XMLHttpRequest.
     *
     * @param restUrl the URL to use
     * @param errorMessage the message to display if an error ocurred in the request
     */
    var developerShortcutsRestCall = function(restUrl, errorMessage) {
        const req = new XMLHttpRequest();
        var notification = new XWiki.widgets.Notification(
            "$escapetool.javascript($services.localization.render('core.shortcuts.developer.user.ajax.inprogress'))",
            'inprogress');

        req.onreadystatechange = function(event) {
            if (this.readyState === XMLHttpRequest.DONE) {
                if (this.status >= 200 && this.status < 300) {
                    // Reload the page to apply the user modifications
                    notification.replace(new XWiki.widgets.Notification(
                        "$escapetool.javascript($services.localization.render(
                                'core.shortcuts.developer.user.ajax.success'))", 'done'));
                    location.reload()
                } else if (this.status == 500) {
                    notification.replace(new XWiki.widgets.Notification(this.data, 'error'));
                } else {
                    notification.replace(new XWiki.widgets.Notification(errorMessage, 'error'));
                }
            }
        };

        req.open('PUT', restUrl, true);
        req.send(null);
    };

    // Append developer shortcuts for toggeling userType and hiddenDocuments in the current user profile
    shortcut.add("$services.localization.render('core.shortcuts.developer.user.type')", function() {
        developerShortcutsRestCall("${request.contextPath}/rest/currentuser/properties/usertype/next",
                "$escapetool.javascript($services.localization.render('core.shortcuts.developer.user.type.error'))");
    }, {'type': shortcut.type.SEQUENCE, 'disable_in_input': true });

    shortcut.add("$services.localization.render('core.shortcuts.developer.user.displayHiddenDocs')", function () {
        developerShortcutsRestCall("${request.contextPath}/rest/currentuser/properties/displayHiddenDocuments/next",
                "$escapetool.javascript($services.localization.render('core.shortcuts.developer.user.displayHiddenDocs.error'))");
    }, {'type': shortcut.type.SEQUENCE, 'disable_in_input': true });
    //]]>
  #end
</script>

Zerion Mini Shell 1.0