Resource Library


In the process of developing web applications an important step is to handle the way the pages look. This is handled by different type of web resources: css, js, images, swf. The management of those web resources is done by using a web application called Resource Library. 

Starting Resource Library

Starting the Resource Library is simply a matter of accessing the Workflow Builder URL and providing the workflow hookpoint as a parameter to that page, more specifically the URL is:

http://<HOSTNAME>:<PORT>/<WEBAPP>/state.zul?TARGET=WEB.RL

where <WEBAPP> is the context where the workflow builder is deployed.

The Resource Library requires authentication so the first page is the Login (figure 1):


Figure 1: The Workflow Builders requires the operator to authenticate.

Once the operator has been authenticated, the first screen shown is the content of Resource Library (Figure 2).

Figure 2: The Resource Library allows operators to browse through resources.

All the resources have their own properties, like Name, Type, References and Version. They are explained in the table below.

Property

Description

Name

Name of the resource.

Type

The type of the resource. It can be Article, Template or other resource (Image, Item, Properties, CSS).

References

The name of other resources that hold a reference to this resource.

Version

The current version of this resource.

Resource Categories

1. Templates

The layout of the web pages follows the Template pattern. This way the layout and the design of the web page can be changed very easy. A template is a zk page that defines placeholders for different regions of the web page, regions that are defined in the framework as zones. In the figure below you can see a 4-region page: the header, the upper-left menu, the lower left menu and the center.

Figure 3. Template with 4-zone layout.

Template Actions

To add a template the user has to:

  • in the left menu of the Resource Library select Template(see figure 2)
  • click on Add button (see figure 2)

To edit a template the user has to:

  • either double-click on the template name or
  • select a template, open the contextual menu by right-clicking on the template name and then select Edit

To delete a template the user has to:

  • select a template, open the contextual menu by right-clicking on the template name and then select Delete

Other actions like Preview, Copy/Cut/Paste and Show revisions are available for templates as convenient actions.

Notes: Template names have to be unique. A Template can contain any zkoss markup plus CDRator templates special tags (labels, conditions, blocks)

2. Articles

These are static ZKoss scripts that are used to fill the zones in a template. They fit as tiles in the layout and can easily be changed, thus changing the page looks and functions. Below there is an article example.

Figure 4. Article example - can be used for the header zone.

Article actions

To add an article the user has to:

  • in the left menu of the Resource Library select Article(see figure 2)
  • click on Add button (see figure 2)

To edit a article the user has to:

  • either double-click on the article name or
  • select an article, open the contextual menu by right-clicking on the article name and then select Edit

To delete an article the user has to:

  • select an article, open the contextual menu by right-clicking on the article name and then select Delete

Other actions like Preview, Copy/Cut/Paste and Show revisions are available for articles as convenient actions.

Notes: Article names have to be unique. An Article can contain any zkoss markup plus CDRator templates special tags (labels, conditions, blocks)

3. Other Resources

A web page can contain some other resources as css, images, swf, property files and so on. The framework handles those resources by uploading them into the database and represents them in Resource Library using a folder-like structure (figure 5). The first level under Resources folder must be the context of the web application that is using those resources.


Figure 5. Example of resources folder structure

Figure 5 depicts a setup for 2 web applications: workflow-builder (that is running under http://<HOSTNAME>:<PORT>/workflow-builder/) and selfcare-web (that is running under http://<HOSTNAME>:<PORT>/selfcare-web/). If the context of these applications changes, then corresponding resource folder has to be renamed accordingly.

Other Resources Actions

To add an folder to the resource hierarchy the user has to:

  • in the left menu of the Resource Library select a folder under Resources(see figure 2)
  • open the contextual menu by right-clicking on the folder name and then select Add

To upload an resource the user has to:

  • have a folder under Resources\<WEBAPP> selected from the left menu of the Resource Library (see figure 2)
  • click on Add button (see figure 2). In the upload dialog that opens (figure 6), the user has to choose a file to upload and click OK. The type of the resource is automatically detected but it also can be changed by the user at upload time.

Figure 6. Upload resource item window

To edit a resource the user has to:

  • either double-click on the resource name or
  • select an resource, open the contextual menu by right-clicking on the resource name and then select Edit

The Edit operation is dependent of the resource type. For example, for resources of type IMAGE/ITEM/JAR the edit allows only the change of the name. For the other types Edit action opens a simple text editor that allows the changing of content.

To delete a resource the user has to:

  • select a resource, open the contextual menu by right-clicking on the article name and then select Delete
    The Delete action is also available for deleting entire folders from the Resource Library.

To import resources the user has to:

  • in the left menu of the Resource Library select a folder under Resources(see figure 2)
  • open the contextual menu by right-clicking on the folder name and then select Upload ZIP.

This action will load the content of the zip archive under the selected folder, maintaining the folder structure of the zip archive. At import time the user has the choice of selecting the whole content of the zip archive or only desired items from the archive. Figure 7 shows the upload zip file wizard steps.

Note: Uploading the same zip archive multiple times will overwrite the previous uploaded files/folders

To export resources the user has to:

  • in the left menu of the Resource Library select a folder under Resources(see figure 2)
  • open the contextual menu by right-clicking on the folder name and then select Export ZIP.

This action will pack the content of the selected folder (with all sub-folders) into a zip archive and offer it for download, maintaining the folder structure from the Resource Library.
Uploading and exporting resources are two very useful operations for migrating the entire Resource Library or making backups of it.
Articles and Templates do not make the object of uploading/exporting as zip files as they are managed by the workflow-builder import/export operations.

Other actions like Preview, Copy/Cut/Paste and Show revisions are available for resources as convenient actions.

Prerequisites

To use the Resource Library, authentication is performed so valid operators are required.
The resource library runs in a browser so check the supported browser list at http://confluence.cdrator.com/display/cdrwf/Supported+Platforms.