Magnolia 4.5 reached end of life on June 30, 2016. This branch is no longer supported, see End-of-life policy.

Page tree
Skip to end of metadata
Go to start of metadata

JCR browser is a Magnolia 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 component and paste it to another page.

A JCR browser displays the contents of one workspace at a time. Magnolia has three readily configured browsers that display the website, data and config workspaces. You can also configure a custom JCR browser to display any other workspace.

Website JCR browser

The website JCR browser, accessed in Tools > JCR Browser (Website), displays the website workspace. This workspace contains pages and components 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 component followed by a Text & Image component.

Here is the same page viewed in the website JCR browser.

Numbered items:

  1. Folder news03 is the page. It contains components and page properties. The tree hierarchy above it is the same as you would see in the AdminCentral treeview: /demo-project/news-and-events/news-overview.
  2. main and extras are collections of components. {{ main}} contains the news component starting with the words "The main part of news..." Typically any components located in the main area of the page are in the main collection. The extras collection is empty. It doesn't have any subnodes because this news page doesn't have any extra elements.
  3. The remaining data nodes are properties of the page itself, such as navigationTitle and keywords, and properties of the News Header component such as author and date. The News Header component is considered part of the page rather than the main collection.

The names of the data nodes match the dialog fields used to enter their values. This is clear if you look at the stkNewsHeader dialog definition. Note how abstract, author, date and 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 workspace as content nodes and properties. To demonstrate this we added two components to the main area of the news03 page: stkFlash and stkQuotedText. Previously the main area contained only the stkTextImage component.

After adding the components, the content and configuration nodes of the components can be seen in the JCR browser.

Editing website content

Besides being a handy tool for viewing the content of a workspace, 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 workspaces).

The JCR browser can speed up repetitive tasks. For example, you can duplicate a component, 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 (01 and 02) of an existing stkTextImage component (0) on the demo-project/about/history page. Then we edited the HTML code in the text data node.

The new components are rendered on the page like this.

Data JCR browser

The data JCR browser, accessed in Data > JCR Browser, displays the data workspace. This browser works the same way as the website browser. It displays data types, their associated dialogs and data items stored in the data workspace.

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 /modules/data/dialogs.) The Contact dialog has three tabs, each containing several fields.

When a contact is stored in the workspace, 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: city, email, familyName and so on.

The Data module allows you to create hierarchical data types. The hierarchical structure is stored in the workspace and can be seen in the JCR browser.

For example, company is a hierarchical data type. Companies are top level items whereas departments and 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 workspace.

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 workspace for use on web pages.

The JCR Browser allows you to view the RSS configuration and the fetched content entries on a single screen.

Numbered items:

  1. The name of the aggregator, in this case news, is defined by the user in the Name field in the RssAggregator dialog (/modules/data/dialogs/RssAggregator/mainTab/name). It is stored in the name property and also used to name the aggregator folder.
  2. The retrieved news items (feed content entries) are stored under the data folder. These are dynamic nodes that change with each import run.
  3. feeds and filters are 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.
  4. The importState data node identifies the imported content as "new", as opposed to "old" which, depending on the configuration, may be required to be deleted.
  5. The usedImporterTarget data node identifies the target to which the imported data should be stored (configured at /modules/data/config/importers/rssaggregator/targets).

Config JCR browser

The third readily configured JCR browser displays the config workspace. 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 modules folder.

Configuring a custom JCR browser

You can configure a browser to display any Magnolia workspace.

  1. Go to /modules/adminInterface/trees.
  2. Copy the website-jcr content node and name the new content node according to the workspace you want to view, for example imaging-jcr.
  3. Set the repository data node to the name of the workspace you want to display.
  4. Go to /modules/adminInterface/config/menu/tools.
  5. Copy the websiteJCR content node and rename the new content node according to the workspace it displays, for example imagingJCR. Place the copy under the tools content 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).
  6. Edit the label child data node. Replace menu.tools.websiteJCR with a label you want to display on the menu such as JCR Browser (imaging). Note that menu.tools.websiteJCR is a key that refers to a message bundle where the actual menu name string is stored. To learn more see Language.
  7. Edit the onclick child data node. Set it to show the tree you configured above, MgnlAdminCentral.showTree('imaging-jcr');.

Now refresh AdminCentral (click Refresh on your Web browser) and go to the Tools menu. You should see the new JCR Browser (imaging) command which lets you browse the imaging workspace.

  • No labels