Custom Views


Introduction

Custom Views are template based sub-sites packaged in a ZIP archive that can be moved between different installations of rap-X. More background infomation is available here.

To add or remove a Custom View, go to Manage->Settings->List Custom Views. To edit the custom view templates look in the rapx/web/WEB-INF/customviews/ directory.

A View is a mini-website that shows a particular slice of Request data. It can be customised by editing simple templates to reflect any page or site design.

A View can be accessed by non logged-in users, but only after the supplier has defined an "Anonymous User".

Custom Views are usually accessible from the path /public/$viewName ,where $viewName is the name of the specific view. For example: http://support.rap-x.com/public/faq/ is the URL for the rap-X FAQ Custom View.

There are 5 steps involved in creating a new custom view

  1. Get hold of an existing view. If you have a download copy of rap-X, look in the WEB-INF/customviews/ directory. Alternatively, visit http://library.rap-x.com
  2. Edit the configuration files if you need to change the logic of the view (e.g. only showing "public" Requests)
  3. Edit the template files to change the page layout and formatting
  4. Create a new ZIP archive containing the templates and configuration files.
  5. Upload the new Custom View (in Zip format) to your rap-X server

Custom Views Library

A library of pre-packaged custom views is available at http://library.rap-x.com. Views can be browsed and downloaded for immediate use in your own rap-X installation, or for further customisation. You are welcome to upload new views to this location for use by other users.

Defining the Anonymous User

When non-authenticated users visit a rap-X View (e.g. FAQ or Forum), the system uses a default user account to determine their permissions, thus controlling what data is made available to them. This user account must be defined before hand.

  1. Decide what permissions (i.e. which categories) you wish to grant to the anonymous user.
  2. If a client organisation already exists with the appropriate permissions, proceed to step 3. Otherwise, create a new organisation, and set the appropriate permissions for that Organisation (see ControllingCategoryAccess
  3. Create a new user within the organisation. Note that it will not be possible to login as this user, it can only be used for anonymous access.
  4. Go to "Manage" -> "Settings" -> "Anonymous User" and pick the user defined above.

Changing the Look and Feel of CustomView pages

rap-X Views have been designed to make it as easy as possible to customise the pages that end users will see.

The view pages can be edited by going to the rap-X/WEB-INF/forum/templates directory within the location where rap-X was installed on your file system.

These templates can be edited by anyone familiar with HTML. The templates use a technology called "Velocity". More details about using Velocity can be found here: http://jakarta.apache.org/velocity/user-guide.html

Velocity templates in rap-X are HTML pages which include elements of dynamic, database derived data. rap-X provides each template with access to data variables, which are referenced by words beginning with a $ symbol. Examples of data variables are:

  • $request (a request variable can be an FAQ, Discussion Item or a support request.
  • $category

Within each data variable are data fields, which can accessed by the notation $variable.field, e.g.

  • $request.name
  • $category.description

Browse a full listing of data references available to custom views.

Anatomy of a CustomView

A CustomView consists of simply a set of view templates and an XML configuration file. The structure is as follows:

Directory Contents
/ System Administrators configuration file
/settings User Administrator configuration files
/templates Template files

/ - System Administrator's configuration files

These files use Spring Framework's xml format for Java Bean (object) configuration. This format is described in detail on the Spring Framework website, but you should not need to get too involved with this backgound information - the files are easy to edit and quite self-explanatory.

In the root, / , directory, there are two files:

  • config.xml
  • views.xml

config.xml

The following tags can be edited in this file:

Example config.xml file


<beans>
  
 <bean id="config" class="com.rap_x.customviews.Configuration" singleton="true">
  <property name="showCategoriesTree"><value>true</value></property>
  	 	
  <property name="categoryType">
   <description> category types: 0-filter, 1-container </description>

   <value>0</value>
  </property>
  	 	
  <property name="showOrgRequestsOnly">
   <value>false</value>
  </property>

  <property name="newReqDiscussion">
   <value>true</value>
  </property>
  <property name="newReqFAQ">
   <value>false</value>
  </property>
  <property name="newReqPrivate">
   <value>false</value>
  </property>
  	 	
 </bean>

 <bean id="velocityConfig" 
    class="org.springframework.web.servlet.view.velocity.VelocityConfigurer"
				singleton="true">
				
  <property name="resourceLoaderPath">
   <value>/WEB-INF/customviews/forum/templates/</value></property>
 </bean>

 <bean id="viewResolver" 
        class="org.springframework.web.servlet.view.XmlViewResolver">
  <property name="cache"><value>false</value></property>
  <property name=
  "location"><value>/WEB-INF/customviews/forum/views.xml</value></property>
 </bean>
</beans>

views.xml

This is another Spring Framework bean configuration file:

<bean id="requestList" class="com.rap_x.web.EscapingVelocityView">
  <property name="url"><value>requestList.vm</value></property>       
</bean>

Its purpose is to define which physical template files to use for each view. If you edit anything other than the filename (in italics), something will probably go horribly wrong.

/settings - User Administrator configuration files

This directory contains the view-specific files which can be edited by Administrator users (Supplier users) through the web interface (using the "Configure" link). These settings define default values for new requests added through a CustomView web interface. The settings are stored in an xml file, an example of which is provided with each custom view (sample-settings.xml). The following options can be configured:

  • Category - the category to which new requests will belong
  • Request Type - Bug/Enhancement/Ticket etc
  • Priority
  • Private - whether new Requests are public of private.

/templates

This is the directory in which template files are stored.

Editing Custom View Templates

rap-X Views have been designed to make it as easy as possible to customise the pages that end users will see.

The view pages can be edited by going to the rap-X/WEB-INF/forum/templates directory within the location where rap-X was installed on your file system.

These templates can be edited by anyone familiar with HTML. The templates use a technology called "Velocity". More details about using Velocity can be found here: http://jakarta.apache.org/velocity/user-guide.html

Velocity templates in rap-X are HTML pages which include elements of dynamic, database derived data. rap-X provides each template with access to data variables, which are referenced by words beginning with a $ symbol. Examples of data variables are:

  • $request (a request variable can be an FAQ, Discussion Item or a support request.
  • $category

Within each data variable are data fields, which can accessed by the notation $variable.field, e.g.

  • $request.name
  • $category.description

The data fields available within requests are detailed here