XWiki HowTo's

  1. General information
  2. Layout and Behaviour
  3. Velocity Scripting
    1. Privileges
    2. Create Velocity Macro
  4. Translations
    1. Translation of Panels
  5. Disabling comments, attacments, history and information
  6. Security & Performance

General information

Layout and Behaviour

Velocity Scripting

Privileges

  • Admin rights
    #if ($xwiki.hasAdminRights())
       The current user has admin rights
    #end
  • Edit rights
    #if($hasEdit)
       The current user has edit rights
    #end

Create Velocity Macro

A write access to your XWiki installation directory is required!

  1. Add a new macro to the file "macros.vm"
    • see "<xwiki-installation-root>/xwiki/templates"
    • add at the end of the file your new macro, for example:
      #macro(myMacroName)
      Hello World!
      #end
  2. Register the new macro in the file "macros.txt"
    • see "<xwiki-installation-root>/xwiki/templates"
    • add at the end of the file the line, for example:
      myMacroName=velocity:myMacroName:
  3. After XWiki restart the new velocity macro can be used in a common way: either using the WYSIWYG editor or text mode.

Translations

Translation of Panels

With an if/else-block

  1. Put the following velocity script into your panel
    #panelheader('MyPanel')

    #if ($context.language == "de")
       My German translation
    #elseif ($context.language == "fr")
       My French translation
    #else
       My default translation
    #end

    #panelfooter()
  1. That is all emoticon_smile

Loading a translated page into the panel

Maybe the macro "includeForm()" is not the best choice here, see including macros.

  1. Creates a new wiki page with translated content, for example 'Main.MyMenu'.
  2. Include this page in your panel, for example:
    #panelheader('MyPanel')

    #includeForm('Main.MyMenu')

    #panelfooter()
  1. That is all emoticon_smile

Disabling comments, attacments, history and information

Currently (xwiki-2.0) there is no way to disable this parts from viewing. This parts can be only made invisible at the bottom of pages (tabbed pane).

 This workaround may work only with xwiki default skins 

  1. Change to the Administration page of you xwiki 
  2. Call the class editor  (<server>/xwiki/bin/edit/XWiki/XWikiPreferences?editor=class)
    1. Add the following properties (type Boolean)
      • showcomments
      • showattachments
      • showhistory
      • showinformation
    2. Save changes
  3. Call the object editor (<server>/xwiki/bin/edit/XWiki/XWikiPreferences?editor=object)
    1. Expand "Objects of type XWiki.XWikiPreferences / XWikiPreferences"
    2. Change the values for all new properties to "No"
    3. Save changes
  4. The bottom tabbed pane will disappear, but you can still access this informations through the menu "Show".

See also:

Security & Performance

See also "xwiki.cfg" and "xwiki.properties" under "<xwiki-installation>/WEB-INF".

Tags:
Created by Roman Friesen on 2009/09/15 11:21
    

My Recent Modifications

This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 12.3 - Documentation