Wiki Flavor Application
Manage a list of flavors for the creation of new wikis. |
Type | XAR |
Category | |
Developed by | |
Active Installs | 23 |
Rating | |
License | GNU Lesser General Public License 2.1 |
Table of contents
Description
This application let the user chose a "flavor" when she creates a new wiki. A "flavor", is a wiki configured with a collection of applications corresponding to a theme. For example, you can have a flavor about a Knowledge Base, with all applications installed to manage such a wiki.
Create a new flavored wiki
Go to "Create Wiki".
Here you can select a flavor for the wiki you are going to create. Fill the form like you would have done with the Wiki Manager Application, select the flavor, and click "next".
In the second form, select all parameters concerning the users, and then click "create".
You will have a screen about the creation of the wiki:
Just wait for the creation of the wiki. At the end of the process, there is no "finalize" button anymore, but a "access the wiki" instead.
Add new flavors
To add new flavors, in the wiki, go to the "Wiki Flavors" application, using the icon in the applications panel:
You will have the following screen:
Click to "add a new entry", and enter a name.
You will reach the following screen:
Fill the form. Extension ID is the maven id of the extension that you want to use as Flavor. This extension must have all the applications that it should contain as dependencies.
Then save it.
You now need to create a translation page, to add the new translation keys you just have created. Create a new page and call it "Translations":
Write your new translations keys, like this:
and save the document.
Now go to the "object" editor to add a TranslationDocumentClass object with the scope "Wiki":
and save it.
Now you can go back to the wiki creation page, and enjoy your new flavor:
How to create a new flavor
See: How to create a new flavor.
For developers: Add an extra step during the wiki creation
Implement the step
If you are a Java or a Groovy developer, you can easily add actions to perform during the creation of a new wiki.
Currently, the process is split in 4 different steps, that are executed successively:
- Create Wiki that only create a new empty wiki. (Order: 1000)
- Save Metadata that saves the information about the wiki owner, the user scope, the id of the flavor used, etc... (Order: 2000)
- Provision Wiki that fills the wiki with a flavor or a template. (Order: 3000)
- Add Users that adds the global users that are members of the wiki. (Order: 4000)
It is possible to add new steps everywhere in the process. To do that, you have to create a new component of the WikiCreationStep role (see how to write a new component).
* Step to be executed during the wiki creation job.
*/
@Role
public interface WikiCreationStep
{
/**
* Execute the step.
* @param request wiki creation request with all information about the wiki to create
* @throws WikiFlavorException if problem occurs
*/
void execute(WikiCreationRequest request) throws WikiFlavorException;
/**
* The creation steps are sorted by order before being executed so this method returns the one of the current step.
* @return the order of the step
*/
int getOrder();
}
The getOrder() method returns an number that determines when the step should be executed. For example, if you want your step to be executed between CreateWiki (order 1000) and Save Metadata (order 2000), your method should return a number between 1000 and 2000.
The execute() method contains the code to execute when the step is processed. It takes a WikiCreationRequest parameter that holds the information about the creation of the wiki (eg: the id of the wiki, the pretty name, etc...). It can actually hold all the information you want, since it has generic setProperty() and getProperty() methods.
Customize the Wiki Creation Wizard
Currently, there is no way to properly customize the wizard. The only thing you can do is editing it (it's only velocity code) to add your features. The page to edit is WikiFlavorsCode.CreateWiki.
The interesting thing is that you can store some settings in the WikiCreationRequest object that your step can re-use.
This is how the wiki creation request is created and how you can add your properties:
#set($wikiCreationRequest = $services.wikiflavor.newWikiCreationRequest())
## Set some properties
#set($discard = $wikiCreationRequest.setWikiId($request.wikiname))
#set($discard = $wikiCreationRequest.setOwnerId($request.ownerId))
#set($discard = $wikiCreationRequest.setUserScope($request.userScope))
## Add your own parameters
#set($discard = $wikiCreationRequest.setProperty("myProperty", "some value"))
#set($discard = $wikiCreationRequest.setProperty("myOtherProperty", $request.myOtherProperty))
## etc, etc...
## Finally, start the wiki creation process (it is done asynchronously, in a job)
#set($job = $services.wikiflavor.createWiki($wikiCreationRequest))
In the code of your step, you can re-use these parameters:
public void execute(WikiCreationRequest request) throws WikiFlavorException
{
String myProperty = (String) request.getParameter("myProperty");
String myOtherProperty = (String) request.getParameter("myOtherProperty");
// It could actually be any kind of object
Integer myIntegerProperty = (Integer) request.getParameter("myIntegerProperty");
// etc, etc...
}
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:
- Log in the wiki with a user having Administration rights
- Go to the Administration page and select the Import category
- Follow the on-screen instructions to upload the downloaded XAR
- Click on the uploaded XAR and follow the instructions
- You'll also need to install all dependent Extensions that are not already installed in your wiki
Be careful to install this extensions after the Wiki Application because it overwrites some of its pages.
Release Notes
v2.2
v2.1
v2.0
v1.6
v1.5
v1.4
v1.3
v1.2
v1.1
v1.0
Dependencies
Dependencies for this extension (org.xwiki.contrib:application-wikiflavor-ui 2.2):
- org.xwiki.contrib:application-wikiflavor-api 2.2
- org.xwiki.platform:xwiki-platform-wiki-ui-mainwiki 7.4.1
- org.xwiki.platform:xwiki-platform-icon-ui 7.4.1
- org.xwiki.platform:xwiki-platform-appwithinminutes-ui 7.4.1