Walrus CMS User Guide

Albertas Mickėnas

Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.


I. Installation guide
1. System requirements
Environment
Resources
2. Quick and dirty install
3. Basic installation
Configuring files upload directory
4. Advanced installation
Database options
PostgreSQL
Other databases
Configuring SMTP mail server
II. Understanding walrus
5. Walrus concepts
Site
Rubric
Rubric display modes
Box
6. Technology stack
III. Creating a site
7. Structure guide
Site
Rubric hierarchy
Boxes
8. Theming guide
IV. Administration guide
9. Logging in
10. Editing content
11. User administration
V. Extending walrus
12. Building walrus
13. APIs and extension points

Part I. Installation guide

Chapter 1. System requirements

Environment

Walrus is tested to run on both Windows and Linux (Unix in general) operating systems.

You will need a functioning Java installation. Download and install Java if you don't have it yet.

For basic and advanced setup options you will need a Servlet 2.4 Specification compatible container. Walrus was tested to run in Apache Tomcat and Jetty containers.

Resources

Walrus installation takes up to 23Mb disk space when installed to the servlet container. Standalone installation bundled with Jetty container takes 32Mb.

Memory and CPU power consumption varies greatly depending on amount of content and visits to your site.

Chapter 2. Quick and dirty install

If you want to try Walrus right away, the best option for you is to download an installation bundled with Jetty servlet container.

  1. Download Walrus installation from this location:

  2. Unzip it to directory of your choice

  3. Open command prompt, change to the unzipped directory and run this command: if your OS is Linux:

    ./bin/jetty.sh run

    if your OS is Windows:

    ./bin/jetty.bat run

After this, point your browser to http://localhost:8180 and you will see a fresh Walrus CMS installation.

Note

If you already have a service running on port 8180, you will need to change Jetty configuration. Please refer to Jetty documentation about how to do it.

Chapter 3. Basic installation

Configuring files upload directory

Chapter 4. Advanced installation

Database options

By default Walrus comes bundled with 100% Java HyperSQL database. Depending on your needs you might want to configure Walrus to work with other database management systems, supported by Hibernate.

You just need to create a database and specify it in Walrus configuration files, there is no need to run any SQL commands - Walrus will create all necessary tables by itself.

PostgreSQL

Walrus comes with JDBC driver for PostgreSQL database.

To configure Walrus to work with PostgreSQL DB:

  1. Open file WEB-INF/classes/conf/daoConfiguration.xml

  2. Delete in the definition of walrusDataSource bean change database URL:

    <bean id="walrusDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    	<property name="driverClassName" value="net.sf.log4jdbc.DriverSpy" />
    	<property name="url" value="jdbc:log4jdbc:postgresql://${walrus.db.host}/${walrus.db.database}" />
    	<property name="username" value="${walrus.db.username}" />
    	<property name="password" value="${walrus.db.password}" />
    </bean>
    					

    Note

    In this particular case Walrus is configured to work with specific JDBC driver wrapper DriverSpy, designed to log SQL queries that are sent to database. If you don't need this functionality, change property driverClassName to org.postgresql.Driver and property url to jdbc:postgresql://${walrus.db.host}/${walrus.db.database}

  3. In the same file change the property hibernate.dialect to org.hibernate.dialect.PostgreSQLDialect:

    <bean id="hibernateSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    	<property name="dataSource" ref="walrusDataSource" />
    	<property name="mappingResources">
    		<list>
    			<value>WalrusCMS.hbm.xml</value>
    		</list>
    	</property>
    	<property name="hibernateProperties">
    		<value>
    			hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
    			hibernate.format_sql=false
    			hibernate.query.substitutions=true 1, false 0
    			hibernate.hbm2ddl.auto=update
    		</value>
    	</property>
    </bean>					
    					

  4. Open file WEB-INF/classes/walrus.properties and change these setting according to your system configuration:

    walrus.db.host=your.database.hostname
    walrus.db.database=databaseName
    walrus.db.username=databaseUsername
    walrus.db.password=databasePassword
    					

Other databases

To use Walrus with other databases, you must download a JDBC driver for particular database and put it's jar to WEB-INF/lib directory. Then you have to configure the walrusDataSource bean, specify the correct hibernate.dialect and configure any other Hibernate options for specific database management system.

Configuring SMTP mail server

Walrus can send email to administrators. Email is being sent on new user creation and on password change. To configure your email settings:

  1. Open file WEB-INF/classes/walrus.properties and change these setting according to your system configuration:

    walrus.mail.smtpHost=your.smtp.host
    walrus.mail.smtpUsername=
    walrus.mail.smtpPassword=
    					

  2. If your SMTP server does not use authentication, you can switch ir off by editing file WEB-INF/classes/conf/mail.xml and changing the property mail.smtp.auth to false:

    <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
    	<property name="host" value="${walrus.mail.smtpHost}"/>
    	<property name="javaMailProperties">
    		<props>
    			<prop key="mail.smtp.auth">true</prop>
    		</props>
    	</property>
    	<property name="username" value="${walrus.mail.smtpUsername}"/>
    	<property name="password" value="${walrus.mail.smtpPassword}"/>
    </bean>				
    					

Part II. Understanding walrus

Chapter 5. Walrus concepts

Site

A site is the main abstraction. A site holds rubric tree and boxes. One Walrus installation supports many sites - this means you can host several different sites with different hostnames and different languages in one Walrus installation.

A site is characterized by hostname and language. I.e. for every combination of hostname and language a site is created.

Rubric

A rubric is the main content holder. Rubrics have title, abstract and main body, they can have unique urls, you can specify rules when content in rubric becomes visible and invisible, and, most important - rubrics have references to other rubrics, forming a tree - like structure. This structure is represented in site menus and sitemap.

Rubric display modes

NONE

Children of rubric are not displayed

SIMPLE

Children of rubric are displayed in simple list

EXPANDED

Children of rubric are displayed in a list where child abstracts are visible

BLOG

Children are displayed in blog mode - full child body is visible

Box

A box is means to include arbitrary information to the site - things, that don't go into rubric hierachy, like footer, banner, featured links, etc.

Boxes are tied to the visual representation of the site - the templates specify where and which box appears.

For the time being it's impossible to create or delete boxes during site operation time. Boxes are defined during site creation phase and cannot be added or deleted later. Of course, you can always do this in SQL directly in database.

Walrus supports a variety of boxes:

TextBox

A text box containing a title and a body. If needed, the box can be configured to be displayed without a title (for a footer for example).

BannerBox

A box that can contain one or more banners. Random banner is rendered every time a page loads.

ImageBox

A box that contains one image. You can use ImageBox for site header, logo, etc.

RubricBox

A box, that has a connection to some specific Rubric. This can be used in many different ways - you can extract some specific content to the first page, or show a list of rubrics child subrics (think news box).

Chapter 6. Technology stack

Walrus is written in Java programming language. It's built by adhering to Model-View-Controller architectural pattern implemented using Spring framework. It uses now abandoned but generally awesome Springmodules XT ajax framework, Hybernate persistence layer and a combination of Apache Tiles and Freemarker for view layer templates.

Part III. Creating a site

Understanding the process

Every site is defined by content put to some structure and a view - representation of said content and said structure. Every time you create a site it's an iterative process - you work on content, then you work on the looks, then you put your content to your design and then design has to be improved somehow, which possibly leads to revising content and structure, etc. Walrus let's you to build your site in this iterative process.

When you try to open a Walrus managed site, Walrus looks into database for a site with hostname and language you are using. If site defined by hostname and language is not found, Walrus suggests to create such site by providing you with a specific link. After you click a link, Walrus creates a new site, using a site defined in file WEB-INF/classes/conf/site.xml as a template. This file is where you define your site's structure. You can just go with a Site object and just one Rubric defined and fill all the rest by the means of Walruses WYSIWYG tools, but it's more handy to have Walrus to boostrap your basic site structure every time you need to refine something and start clean.

Chapter 7. Structure guide

Sites structure template is loceted in file WEB-INF/classes/conf/site.xml. It's an XML file, describing Rubric structure of your site and available Boxes. The XML itself is Spring framework bean definition language.

Site

Consider this example:

<bean id="sitePrototype" class="lt.walrus.model.Site" autowire="no">
	<constructor-arg>
		<ref bean="r0" />
	</constructor-arg>
	<property name="boxes">
		<list>
			<ref bean="bannerBox"/>
			<ref bean="textBoxFooter"/>
			<ref bean="textBoxHello"/>
			<ref bean="imageBoxNiceness"/>
			<ref bean="rubricBoxNews"/>
		</list>
	</property>
</bean>
					

Here we have a Site defined. It has a reference to root rubric of rubric hierarchy provided in a constructor and a list of box references. Note that every bean has an id - it's important for this id to be unique as it is used to reference bean in another beans.

Rubric hierarchy

Now let's define a ROOT rubric. Rubric takes who arguments to it's constructor - a reference to parent Rubric and a title:

<bean id="r0" class="lt.walrus.model.Rubric">
	<constructor-arg><null /></constructor-arg>
	<constructor-arg><value>ROOT</value></constructor-arg>
	<property name="online"><value>true</value></property>
</bean>
					

A root rubric is a special kind of rubric - it is not displayed in view, content is not saved to it, it's used as placeholder for all other rubrics. A reference to root rubric is specified in definition of Site (see above). We make a root rubric by specifying <null /> as a parent reference. This means that Rubric has no parent. There will be just one Rubric with no parent.

Now let's add some children to our root Rubric:

<bean id="r1" class="lt.walrus.model.Rubric">
	<constructor-arg><ref bean="r0"/></constructor-arg>
	<constructor-arg><value>Kompanija</value></constructor-arg>
	<property name="online"><value>true</value></property>
</bean>
					

Note that we specify root Rubric as a parent for this rubric.

You can specify various other Rubric properties too, as you can see - we are marking rubrics online in these examples. Other properties you can specify include:

abstr

Abstract of rubric

body

Text body of rubric

date

The date string

visibleForever

When false, time restrictions visibleFrom visibleTo apply

visibleFrom

Date rubric is visible to visitors from (when visibleForever == false)

visibleTo

Date rubric is visible to visitors to (when visibleForever == false)

leaf

Is rubric a leaf - ie true when rubric can not have children

mode

Rubric display mode

url

Special url string for rubric

comments

Comments to the rubric

commentsAllowed

Is commenting turned on for rubric

Boxes

<bean id="textBoxFooter" class="lt.walrus.model.TextBox">
	<property name="boxId" value="boxFooter"/>
	<property name="title" value="Klientų atsiliepimai"/>
	<property name="body" value="Lorem ipsum dolor sit amet"/>
</bean>
<bean id="textBoxHello" class="lt.walrus.model.TextBox">
	<property name="boxId" value="boxHello"/>
	<property name="title" value="Klientų atsiliepimai"/>
	<property name="body" value="Lorem ipsum dolor sit amet"/>
</bean>
					

<bean id="rubricBoxNews" class="lt.walrus.model.RubricBox">
	<property name="boxId" value="newsBox"/>
	<property name="rubric" ref="r5" />
</bean>													
					

<bean id="bannerBox" class="lt.walrus.model.BannerBox">
	<property name="boxId" value="mainAd" />
	<property name="banners">
		<list>
			<bean class="lt.walrus.model.Banner">
				<property name="banner" value="/img/walrus_ad.jpg" />
				<property name="url" value="http://www.walrus.lt" />
			</bean>
		</list>
	</property>
</bean>
					

<bean id="imageBoxNiceness" class="lt.walrus.model.ImageBox">
	<property name="boxId" value="newsBox"/>
	<property name="image" ref="/img/image.jpg" />
</bean>													
					

Chapter 8. Theming guide

Part IV. Administration guide

Chapter 9. Logging in

Chapter 10. Editing content

Chapter 11. User administration

Part V. Extending walrus

Chapter 12. Building walrus

Chapter 13. APIs and extension points