Академический Документы
Профессиональный Документы
Культура Документы
http://www.jahia.com
Summary
1
Introduction ................................................................................................................................................ 3
1.1
Pre-requisites........................................................................................................................................ 3
1.2
1.3
1.3.1
1.3.2
1.3.3
1.4
Page 2 / 15
1 Introduction
In Jahia 6.5, you can now embed spring configuration files directly in your module. The goal of this
documentation is to show you what you can do with this spring files in order to modify / extend Jahias Edit
Mode GUI (created and compiled with GWT).
1.1 Pre-requisites
Page 3 / 15
For that, you just have to define the object to create in your definition.cnd :
[jnt:navMenuImage] > jnt:content, jmix:navMenuItem, mix:title
- image (weakreference, picker[type='image']) mandatory
- type (string, choicelist[linktypechoicelist]) mandatory
And then to create an item in the spring configuration file (springDemo .xml) associated with this type :
Page 4 / 15
In this bean, we of course define values for the different Items attributes (please refer to the related
documentation for more details about that), but we also specify some properties to define where Spring
need to inject the bean.
This is the case of the parent property and positionBefore property. How does it work?
The parent property represents the path of the parent where we want to be injected as child. In our case,
the path is editmode.tabs[0].treeContextMenu it means that we are looking for a bean named
editmode
This bean is in applicationcontext-editmode.xml :
Inside this bean, we want to enter in the first bean of the tabs list:
Page 5 / 15
Page 6 / 15
We are now positioned on the parent. Lets use the positionBefore property to know where to put the
bean to inject. In our case the value of this property is Toolbar.Item.Publish, so we will be injected here:
Page 7 / 15
Depending on the situation, you can use the positionAfter property, which uses the same mechanism, or
the position property, which take a number as value to specify the position.
Now that you know how to inject a GWT Item in a specific path, you can adapt this example to your needs.
Page 8 / 15
One more time, the spring configuration allows doing this directly from modules, here is an example, which
adds a new content tab that only displays modules of type social components:
Here, as there is only one point to insert a side panel tab, we just have to specify the id of the parent bean
and not the full path. Moreover, we need to specify the position where we want to put the item. It will
inject the bean at the right position in the tabs property list:
Page 9 / 15
Some Jahia users create a new tab to display all their specific content types, while default ones provided by
Jahia are located in the standard tab, some others used this technic to regroup domain specific content
types (finance, law, chemistery) then use the permissions to define what group of users can access those
different tabs.
You want to have a dedicated picker to associate a speaker to your video. It should allow to browse the
web site, but only to select nodes of type jnt:speaker.
For that, you will first create a new picker in the springDemo.xml file :
Page 10 / 15
Please take a look at this file \webapp\WEB-INF\etc\spring\uicomponents\applicationcontextcontentpicker.xml in the Jahia install dir to get a full example of picker. The interesting parts of a picker
are, the nodeTypes, it defines the selectable node types; the folderType, it defines the folder types that
can be displayed. And then it is a configuration of what should be displayed in the picker, for example copy
Page 11 / 15
/ paste button, search fields, ect Finally, you can see a repositories property, it allows to define what the
user will be able to browse : site for the current site, sites for all the web site of the platform,
When your new picker is defined, you can now use it in your definition file. For that, take the bean id
value, without the picker post fix:
Its done, you will now use your custom picker to select nodes only of type jnt:speaker, on any site of the
platform.
/!\ Warning, if you define your picker in a module A, and use it in the CND of a module B, you must define a
dependency from B to A. Fo r that add a <depends> tag in the pom.xml of module B, and put the name of
module A inside.
Page 12 / 15
When Jahia is started, Spring loads all the Jahia applicationcontext-xxx.xml files, in the /etc/spring folder,
and then load all the applicationcontext-xxx.files in the org.jahia.config package defined by modules. Thats
why the module configuration overrides the Jahia configuration.
In this file, we have nothing special to do. Just create a bean with the same ID than the bean that you want
to override, and modify or add properties depending of what you want to do. In our cases we just add a
visibility property.
Original beans:
Overridden beans:
Page 13 / 15
Thats all! So you are free to override any beans in Jahia with a specified ID. The main advantage of this
method is to keep standard configuration fi
Page 14 / 15
Page 15 / 15