Skip to content
Permalink
Fetching contributors…
Cannot retrieve contributors at this time
137 lines (137 sloc) 7.27 KB
## Make sure this template is not executed more than necessary
##!unique=request
#template("frequentlyUsedDocs.vm")
#set ($isGuest = $xcontext.getUser().equals('XWiki.XWikiGuest'))
#set ($isSuperAdmin = ($xcontext.user == 'XWiki.superadmin'))
## Does the current user have edit rights on the current document
#set ($hasEdit = $services.security.authorization.hasAccess('edit'))
## Does the current user have admin rights on the current document
#set ($hasAdmin = $services.security.authorization.hasAccess('admin'))
## Does the current user have comment rights on the current document
#set ($hasComment = $services.security.authorization.hasAccess('comment'))
## Does the current user have the right to create a space in the current wiki. Since there's no Create right, we test
## this by checking the edit right on the current wiki
#set ($hasCreateSpace = $services.security.authorization.hasAccess('edit', $services.model.getEntityReference('WIKI')))
## Does the current user have the right to create a page in the current wiki and current space. Since there's no
## Create right, we test this by checking the edit right on the current space and current wiki
#set ($hasCreatePage = $services.security.authorization.hasAccess('edit', $services.model.resolveSpace('')))
## Does the current user have admin rights on the current wiki. We check for admin rights on the wiki preferences page.
#set ($wikiPreferencesReference = $services.model.resolveDocument('XWiki.XWikiPreferences'))
#set ($hasGlobalAdmin = $services.security.authorization.hasAccess('admin', $wikiPreferencesReference))
## Does the current user have programming rights
#set ($hasProgramming = $services.security.authorization.hasAccess('programming', $xcontext.userReference, $NULL))
## Does the current user have the right to create new wiki. We check for the create wiki right on the wiki preferences
## page.
#set ($hasCreateWiki = $services.security.authorization.hasAccess('createwiki', $wikiPreferencesReference))
## Does the current user have admin rights on the current space. We check for admin rights on the current space's
## preferences page.
#set ($spacePreferencesDocumentReference = $services.model.resolveDocument('WebPreferences'))
#set ($hasSpaceAdmin = $services.security.authorization.hasAccess('admin', $spacePreferencesDocumentReference))
#set ($hasWatch = $services.watchlist && $services.watchlist.isEnabled() && !$isGuest && !$isSuperAdmin
&& $xwiki.exists($services.model.serialize(
$services.model.createDocumentReference($xcontext.database, 'XWiki', 'XWikiUserWatchListSheet'), 'local')))
#set ($hasDashboard = $xwiki.exists($services.model.serialize(
$services.model.createDocumentReference($xcontext.database, 'Dashboard', 'XWikiUserDashboardSheet'), 'local')))
##
## Are comments, attachments, history etc. enabled?
##
#macro (retrieveSetting $settingName $settingValue)
#set ($settingValue = "$!{xwiki.getSpacePreference($settingName)}")
#if ($settingValue != 'false' && $settingValue != 'no' && $settingValue != '0')
#set ($settingValue = true)
#else
#set ($settingValue = false)
#end
#end
#retrieveSetting('showcomments' $settingValue)
#set ($showcomments = $settingValue)
#retrieveSetting('showattachments' $settingValue)
#set ($showattachments = $settingValue)
#retrieveSetting('showhistory' $settingValue)
#set ($showhistory = $settingValue)
#retrieveSetting('showinformation' $settingValue)
#set ($showinformation = $settingValue)
##
## Annotations are special, they can be hidden from the Page Elements administrative settings,
## and they can be disabled per-space from the Annotations administration category.
#retrieveSetting('showannotations' $settingValue)
#set ($showannotations = $settingValue)
#if ($showannotations)
## The general settings allow displaying the tab
#set ($showannotations = false)
#if ($xwiki.exists('AnnotationCode.AnnotationConfig'))
#set ($annotationConfigObject = $xwiki.getDocument('AnnotationCode.AnnotationConfig').getObject('AnnotationCode.AnnotationConfig'))
#if ($annotationConfigObject.getProperty('activated').value != 0 && !$annotationConfigObject.getProperty('exceptionSpaces').value.contains($doc.space))
#set ($showannotations = true)
#set ($annotationClass = $annotationConfigObject.getProperty('annotationClass').value)
#set ($annotationCount = $services.annotations.getAnnotations($doc).size())
#end
#end
#end
##
##
#set ($isReadOnly = $xwiki.isReadOnly())
#set ($spaceViewUrl = $spaceDoc.getURL('view'))
#set ($viewUrl = $doc.getURL('view'))
#set ($userObj = $!crtUserDoc.getObject('XWiki.XWikiUsers', 0))
## =====================================================================================
## Advanced users are:
## - super admin
## - user documents who have their usertype property set to "Advanced"
## - guest users who have admin rights (i.e. when the wiki is empty with no rights set)
## =====================================================================================
#if ($isSuperAdmin)
#set ($isAdvancedUser = true)
#elseif ($isGuest && $hasAdmin)
#set ($isAdvancedUser = true)
#elseif (!$userObj.getProperty('usertype').value)
#set ($isAdvancedUser = false)
#else
#set ($isAdvancedUser = ($userObj.getProperty('usertype').value == 'Advanced'))
#end
## ======================================================================================
## Compute list of spaces to blacklist so that simple users don't see them.
## TODO : replace this list by a hidden space feature.
## ======================================================================================
#if ($hasAdmin || $isAdvancedUser)
#set ($blacklistedSpaces = [])
#else
#set ($blacklistedSpaces = ['Import', 'Panels', 'Scheduler', 'Stats', 'XAppClasses', 'XAppSheets', 'XAppTemplates', 'XWiki', 'WatchCode', 'WatchSheets', 'XApp', 'WatchAdmin', 'Watch', 'ColorThemes', 'AnnotationCode'])
#end
#set ($parent ="<a href='$parentDoc.getURL()'>$escapetool.xml(${parentDoc.displayTitle})</a>")
#if ($tdoc)
#set ($headertitle = "<a href='$viewUrl'>$escapetool.xml(${tdoc.displayTitle})</a>")
#else
#set ($headertitle = "<a href='$viewUrl'>$escapetool.xml(${doc.displayTitle})</a>")
#end
#set ($skin = $xwiki.getSkin())
## Compute the copyright and evaluate its content with Velocity to allow users to put some scripts inside
#set ($copyright = "#evaluate($xwiki.getSpaceCopyright())")
#set ($xwikimode = $xcontext.getMode())
#set ($logredir = $escapetool.xml($xwiki.relativeRequestURL))
##
#if ($xwiki.exists('XWiki.MaintenanceInfo'))
#set ($maintenanceinfo = 'XWiki.MaintenanceInfo')
#elseif ($xwiki.exists('xwiki:XWiki.MaintenanceInfo'))
#set ($maintenanceinfo = 'xwiki:XWiki.MaintenanceInfo')
#end
## Check language option
#set ($languageparams = '')
#if ($xwiki.isMultiLingual() && ("$!{tdoc.realLocale}" != ''))
#set ($languageparams = "language=${tdoc.realLocale}")
#end
## Check revision option
#if ($request.rev)
#set ($revparams = "rev=$!{escapetool.url(${request.rev})}")
#else
#set ($revparams = '')
#end
#if ($revparams != '' && $languageparams != '')
#set ($docvariant = "$languageparams&amp;$revparams")
#else
#set ($docvariant = "${languageparams}${revparams}")
#end
#set ($keyboardShortcutsEnabled = $isAdvancedUser)
#set ($isInPortletMode = $xwikimode == 1 || "$!request.getAttribute('javax.portlet.request')" != '')
#set ($isInServletMode = $xwikimode == 0 && !$isInPortletMode)
#template("deprecatedVars.vm")
You can’t perform that action at this time.