JCR browser is a Magnolia CMS tool that allows you to view and edit content and associated configuration at the repository level. It allows you to see details that are not readily visible in the AdminCentral treeview. In many cases it provides a quicker alternative than editing content through a dialog. For example, you can copy a paragraph and paste it to another page.
A JCR browser displays the contents of one repository at a time. Magnolia has three readily configured browsers that display the
config repositories. You can also configure a custom JCR browser to display any other repository.
- Website JCR browser
- Data JCR browser
- Config JCR browser
- Configuring a custom JCR browser
Website JCR browser
The website JCR browser, accessed in Tools > JCR Browser (Website), displays the
website repository. This repository contains pages and paragraphs and is organized according to site hierarchy.
The website JCR browser is useful for looking at details that you would not see in the default AdminCentral website view.
Example: Below is page
/demo-project/news-and-events/news-overview/news03 in page editing mode. The page has a News Header paragraph followed by a Text & Image paragraph.
Here is the same page viewed in the website JCR browser.
news03is the page. It contains paragraphs and page properties. The tree hierarchy above it is the same as you would see in the AdminCentral treeview:
extrasare collections of paragraphs.
maincontains the news paragraph starting with the words "The main part of news..." Typically any paragraphs located in the
mainarea of the page are in the
extrascollection is empty. It doesn't have any subnodes because this news page doesn't have any extra elements.
- The remaining data nodes are properties of the page itself, such as
keywords, and properties of the News Header paragraph such as
date. The News Header paragraph is considered part of the page rather than the
stkNewsHeaderdialog definition. Note how
dateand other fields in the dialog have identically named data nodes in the JCR view above. If a field is left empty then no value is stored in the JCR and no value can be seen in the JCR browser either.
As content is added to a page, it is stored in the repository as content nodes and properties. To demonstrate this we added two paragraphs to the
main area of the
stkQuotedText. Previously the main area contained only the
After adding the paragraphs, the content and configuration nodes of the paragraphs can be seen in the JCR browser.
Editing website content
Besides being a handy tool for viewing the content of a repository, the JCR browser can also be used to add and edit content.
The commands in the JCR browser work the same way as the corresponding commands in the AdminCentral tree views. You can move, copy, delete, activate and deactivate content, import and export to XML, and create folders, content nodes and data nodes (limited to certain repositories).
The JCR browser can speed up repetitive tasks. For example, you can duplicate a paragraph, edit the duplicate and place it on a different web page, or add multiple new data items by duplicating and editing existing ones.
To demonstrate this in the website JCR browser, we made two copies (
02) of an existing
stkTextImage paragraph (
0) on the
demo-project/about/history page. Then we edited the HTML code in the
text data node.
The new paragraphs are rendered on the page like this.
Data JCR browser
The data JCR browser, accessed in Data > JCR Browser, displays the
data repository. This browser works the same way as the website browser. It displays data types, their associated dialogs and data items stored in the
Contact is an example of a custom data type. In the default installation this data type contains one sample item (
JMustermann). Here is the dialog used to edit a contact.
As in the case of the website JCR browser, the dialog field names determine the names of data nodes displayed in the browser. (Data module dialogs are configured at
Contact dialog has three tabs, each containing several fields.
When a contact is stored in the repository, a child folder (
/contacts/JMustermann) is created for the data item. The value of each dialog field is stored in a correspondingly named data node:
familyName and so on.
The Data module allows you to create hierarchical data types. The hierarchical structure is stored in the repository and can be seen in the JCR browser.
company is a hierarchical data type. Companies are top level items whereas
employees reside below them in the hierarchy. You can see this order in the JCR browser.
Where configuration is more complex it is often helpful to view it in the JCR browser to understand how configuration is stored in the underlying repository.
RSS feeds are a relatively complex example. The RSS Aggregator module is used to fetch RSS feeds. Feed URLs are configured in the Data module and feed content entries are stored in the JCR. Below is the example
news RSS aggregator which retrieves content from BBC New and Wired Magazine and stores it in the repository for use on web pages.
The JCR Browser allows you to view the RSS configuration and the fetched content entries on a single screen.
- The name of the aggregator, in this case
news, is defined by the user in the Name field in the
/modules/data/dialogs/RssAggregator/mainTab/name). It is stored in the
nameproperty and also used to name the aggregator folder.
- The retrieved news items (feed content entries) are stored under the
datafolder. These are dynamic nodes that change with each import run.
filtersare stored as content nodes (as opposed to data nodes) because they have properties. Feeds contain the feed URL and an optional name. Filters control which entries from the feed are aggregated.
importStatedata node identifies the imported content as "new", as opposed to "old" which, depending on the configuration, may be required to be deleted.
usedImporterTargetdata node identifies the target to which the imported data should be stored (configured at
Config JCR browser
The third readily configured JCR browser displays the
config repository. This is where configuration for Magnolia core and all modules is stored. To access the browser click the Configuration menu.
Configuration specific to Magnolia core is in the
server folder. Modules store their configuration in the
Configuring a custom JCR browser
You can configure a browser to display any Magnolia repository.
- Go to
- Copy the
website-jcrcontent node and name the new content node according to the repository you want to view, for example
- Set the
repositorydata node to the name of the repository you want to display.
- Go to
- Copy the
websiteJCRcontent node and rename the new content node according to the repository it displays, for example
imagingJCR. Place the copy under the
toolscontent node or another menu of your choice. This is the menu command that you will click when you want to see the JCR browser. You can move it to a logical place such as below JCR Browser (website).
- Edit the
labelchild data node. Replace
menu.tools.websiteJCRwith a label you want to display on the menu such as
JCR Browser (imaging). Note that
menu.tools.websiteJCRis a key that refers to a message bundle where the actual menu name string is stored. To learn more see Internationalization and localization.
- Edit the
onclickchild data node. Set it to show the tree you configured above,