cogDraws styled boxes around wiki content
TypeXAR
Developed by

Asiri Rathnayake, Denis Gervalle

Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1
Installable with the Extension Manager

Description

This wiki macro allows drawing styled boxes around wiki content. Layout of these styled boxes are different from that of Box Macro generated boxes and the look and feel of these boxes can be centrally controlled by editing the associated style sheet extension attached to the wiki macro document.

The first version of this macro was written by Asiri Rathnayake, this version is appropriate for wikis in version earlier than 3.0, or for those wanting strict compatibility with that version of the macro.
This first version was not installable with EM, and should be uninstalled manually before installing version 2.0 (delete the macro document Macro.MBox).

Version 2.0 is mostly compatible with this first version, with the following slight changes:

  • works almost seamlessly with Colibri and Flamingo skins
  • slight spacing change could happen compare to the earlier macro
  • the generated HTML differs, so if you have customized the styles, this may need to be adapted
  • the macro content should stick strictly to the initial documentation which requires XWiki syntax only (while the implementation was accepting HTML content)
  • the icon parameter syntax is now more relaxed, accepting the same syntax as the image syntax.
  • the XWiki Syntax supported by the macro is now 2.1 (while it was 2.0 in previous implementation)
This macro install itself globally, so you should install it only on the main wiki

Macro Name

mbox

Parameters

title (required)
A title for the box.
subTitle
An optional subtitle.
icon
An 22x22 pixel icon to be displayed on top-left corner of the box. Icon reference should be of the form wiki:[email protected] or icon:iconname. A default cog icon is used when none is provided.
width
Width of the box, can be any css length specification (75%, 100px, 3em, ...).
color
Background color of the box, can be any css color specification (red, #1A2B6E, ...).

Exemples

Code

{{mbox title="A Title" subTitle="An Optional **Sub-Title**"}}
Any **xwiki** content.
{{/mbox}}
{{mbox title="A Title" icon="[email protected]" color="lightblue"}}
Any **xwiki** content.
{{/mbox}}

Results

mbox2.png

Documentation of initial version by Asiri Rathnayake

This wiki macro allows drawing styled boxes around wiki content. Layout of these styled boxes are different from that of Box Macro generated boxes and the look and feel of these boxes can be centrally controlled by editing the associated style sheet extension attached to the wiki macro document. Also, MBox macro can be easily extended to create new sub macros for convenience.

Installation

Wiki macros are only available for XE versions greater than 2.0M2

You can install the MBox macro by downloading the XAR bundle and importing it to your wiki with programming rights. Note that if you are running an XWiki farm, the installation needs to happen on the main wiki.

Usage

{{mbox title="A Title"}}
Any **xwiki** content.
{{/mbox}}

Parameters Definition

NameOptionalDefault ValueDescription
titleNoNoneTitle of the box (to be displayed on top of the content)
subTitleYesNoneAn optional sub-title to further describe the content
iconYesxwiki:[email protected]A 22x22 pixel image to be displayed on top-left corner of the box (Eg. wiki:[email protected])
widthYesautoWidth of the box, can be any css width specification (Eg. 75%)
colorYes#CCCC99Background color of the box, can be any css color specification (Eg. red)

Example

{{mbox title="A Title" subTitle="An Optional **Sub-Title**" width="75%"}}
Any **xwiki** content.
{{/mbox}}

Screenshot

mbox.png

Notes

Please refer to this blog post for more examples and information on customizing the MBox macro.

Tested on

This extension has been tested with the following configurations.

Extension VersionXWiki FlavorNotes
2.0XWiki Enterprise 3.5.1 - 7.3M1

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

This macro install itself globally, so you should install it only on the main wiki

Created by Asiri Rathnayake on 2009/11/15 10:11
    

Get Connected