Workspace templates with XML files
XML workspace templates always save a complete workspace. Using the export function you can create and modify an XML template from a workspace based on the standard workspace structure.
Introduction
For a workspace template with XML, censhare does not take into consideration the standard workspace structure and resource replace variants when creating the workspace. An XML workspace template saves the configuration in an XML file. Unlike workspace templates with resource events, this contains a complete workspace structure.
Just like workspace templates with resource events, censhare assigns XML templates using roles. If a user with a suitable role logs in, censhare assigns it the workspace saved in the XML file and then applies the resource events saved in the user workspace.
censhare does not automatically update the XML file. If an update is carried out on the censhare system, the changes in the standard workspace structure are not part of it. Manual editing of the XML workspace templates is required. Manual editing after an update is also required for resource replace variants. Only when using workspace templates with resource events can users see the changes after a system update.
The XML template export function uses the current workspace to create a file with the XML structure. This is then assigned to a workspace template. To modify the workspace to meet your requirements, you have to edit the XML workspace template file. For example, you can add your own workspace containers with widgets to a workspace page.
The export function creates an XML file from the internal XML structure. This allows the standard workspace structure, resource replace variants and a workspace template to be integrated for the current user. Any changes made by that user are also included. You can't recognize in the XML file which of the XML structures originates from which of the configuration options.
It is possible to simultaneously run templates with XML and resource events, but there are certain effects that you need to be aware of. The same applies to simultaneously running XML templates and resource replace variants.
Assigning XML templates
Assigning a template with XML is just like assigning templates with resource events.
Creating XML templates
Using the XML export function, you can create an XML workspace template (red). If censhare applies the template, then it reads the XML file of the template and uses that to create the internal workspace structure (final workspace).censhare uses this to display the user interface in the web browser.
Preparations
Use a proprietary user in order to create the respective XML template.No XML workspace template can be used for its main role. Otherwise, you only use the configuration stored there and the XML template won't be based on the current standard workspace structure.
Log in with this user and configure the workspace accordingly. If you simultaneously use XML workspace templates and resource replace variants, this will make the modifications to the XML templates more complicated.
XML exports
Go to the user workspace of the user that is logged in. Open the function "Create workspace XML template" in the page menu censhare creates the XML file and assigns it to the workspace template.
To do that, censhare goes step-by-step through the XML workspace structure and creates the XML definitions. If a container appears on five different workspace pages, the XML file contains it five times as XML. The same goes for widgets. The XML structure has no widget configurations, but rather just widgets that already contain their configuration.
censhare writes the XML definitions of the workspace pages alphabetically sorted in the file. It uses the ID attribute of the workspace pages to do the sorting. This ensures that the workspace pages are always displayed in the same order. This is a major requirement for being able to compare two XML files with one another.
The export also includes the localization information in the assets. This allows the user to change the language in an XML template.
Once censhare has created the template it offers you a link to open it. Here you need to still assign a resource key and the user roles.
Searching for XML templates
See the article "Workspaces with resource events".
Editing XML templates
To edit the master file of an XML template, go to the XML template asset on the file widget. If this is not available, add it in developer mode. In the page menu, select the function "Add widget type" and then the "Files" widget option.
Download the master file and open it in the XML editor. There is an XML Schema associated with the XML structure of the workspace. This must contain the XML file. Otherwise, you will get a validation error when the user logs in. The XML Schema has a name:
workspace.xsd
You can find it in the directory:
~/censhare/censhare-Server/web-commands/com/censhare/api/workspace/resources/
Assign this XML diagram to the XML file if you edit it in the XML editor. This allows you to see in the XML editor whether the XML file is valid, i.e. that it contains the specified structure. In addition, depending on the situation, an XML editor can also deliver a list of the allowed XML tags or attributes for an XML tag.
When editing the XML file you also need to be sure that the definitions are unique. For example, the feature "Workspace page URL pattern" for workspace pages needs to be unique. References to these types of errors are found in the server log.
After editing, upload the XML file using the file widget in order to update the XML template asset.
Modifications after a system update
Creating a comparison XML file after an update
Use a special update user to create a comparison XML file after an update. This user needs to fulfill a few conditions:
she can't have any of her own changes in her workspace
there can't be a workspace template for her main user role
there can't be a resource replace variant for her main user role
In terms of simplifying the update process for XML workspace templates, it makes sense to avoid using resource replace variants in the system at the same time. For every resource replace variant, censhare exports its XML structure and not that of the associated asset of the standard workspace structure. The comparison will be missing in those locations.
Updating XML workspaces
After a system update, log in with the update user and create an XML template from that workspace. Use that to then compare the XML files of the existing XML templates in the system.
Proceed as follows for each XML template in the system:
download the XML file
compare the XML file with the update XML file in the XML editor
edit the XML file accordingly in the XML editor
update the XML template
XML templates before the standard workspace structure
censhare has been using XML templates since version 5.0. In versions 5.0 to 5.5, censhare made a standard XML workspace available to users. Based on that, XML templates can be created and assigned to users via roles.
Since the introduction of the standard workspace structure, the previous standard XML workspace is no longer updated. The existing XML templates can still be used, however.
Since version 2017.2, it is possible to create an XML workspace based on the standard workspace structure. This allows XML templates to be made available based on this structure.
Configuring search settings
censhare provides you with a variety of filter options to further limit search results. For each of these, there is a configuration stored in censhare. These filters can be changed in the user workspace and in a workspace template. You can use the latter to specify further filter options for the configured user roles.