Skip to content

隱藏頁面上的 評論,註釋,附件,歷史,其他資訊

Other Velocity Variables

Controlling Page Tabs

You can control whether to display Comments/Annotations/History/Attachment/Information tabs or not by setting some velocity variables to false:

#set ($showcomments = false)
#set ($showannotations = false)
#set ($showattachments = false)
#set ($showhistory = false)
#set ($showinformation = false)

To remove them all you can set:

#set($displayDocExtra = false)

You can also control whether shortcuts links are displayed in the page menu:

#set($displayShortcuts = false)

contentFooterAndDocextra

Information about the current user

The following variables (set in the xwikivars.vm template) are shortcuts for checking various information for the current user:

  • $isGuest: checks if the current user is XWiki.XWikiGuest
  • $isSuperAdmin: checks if the current user is the special user superadmin
  • $hasComment: checks comment rights on the current document
  • $hasEdit: checks edit rights on the current document
  • $hasWatch: checks if the user is authenticated and the watch service is available
  • $hasAdmin: checks admin rights on the current document
  • $hasSpaceAdmin: checks admin rights on the XWikiPreferences document of the current space
  • $hasGlobalAdmin: checks admin rights on XWiki.XWikiPreferences
  • $hasCreateSpace: checks edit rights on that page that does not exist, in a space that doesn't exist
  • $hasCreatePage: checks edit rights on that page that does not exist, in the current space
  • $hasProgramming: checks if the current user has programming rights
  • $isAdvancedUser: advanced users: superadmin, users with the usertype property set to "Advanced", guest users with admin rights

Example:

{{velocity}}
#if ($hasAdmin)
  ## This link will only be visible to users that have admin rights on this document
  [[Do some admin action>>Some.Document]]
#end
{{/velocity}}