[TotW] Lasso Wiki Source Code

The tip of the week for April 4, 2008 includes the source for the Lasso Wiki, the basis for the LassoTech Web site, so you can use it in your own sites. The code can be used to deploy a stand-alone Wiki site or to add a Wiki sub-folder to an existing site.

Introduction

The Lasso Wiki source code is being distributed open source to the Lasso community. It is our hope that this code will form the basis of a full featured Lasso-based Wiki engine.

The complete source code for the LassoTech Web site is included. However, there are a number of features planned for the LassoTech Web site which have not yet been implemented. Future updates of this source code will include these new features.

The code of the Lasso Wiki is provided as-is and without warranty. It is free to use and modify for commercial or non-commercial purposes.

Download

The source code can be downloaded from the following URL. Please read the instructions below for installation and configuration instructions. These instructions are also available in the __instructions.lasso file within the download.

http://downloads.lassosoft.com/pub/TotW/lassowiki.zip

Installation

Place the entire "lassowiki" folder within your Web serving folder. By default the site assumes that it is going to be in a subfolder of an existing site. The Lasso Wiki can also be configured on its own domain.

The _includes/lassowiki_data.lasso file must be customized in order for the wiki to work properly. You will need to set the domain name, database name (see MySQL Database section below), Lasso Security username and password, and other values.

If the site is going to be run as a sub-folder of an existing domain then it will be necessary to customize the omnisite_root to specify the name of the sub-folder of the site. By default this is set to /lassowiki/. It should begin and end with a /.

If the site is going to be run as its own domain then it will be necessary to set the omnisite_root to simply /.

It will probably be necessary to customize the template and some of the individual pages in order to make the Wiki blend in with an existing site. At minimum the logo should be modified.

Apache Configuration

The wiki uses a single file to dispatch incoming requests to the appropriate pages. It assumes that you have Apache configured to route all incoming requests to Lasso and that you have a Lasso URL Redirect which routes all incoming request to index.lasso (See Lasso Configuration below).

If you are configuring the Lasso wiki to be a sub-folder of an existing site you can add a location directive to an existing host definition. For example, the following directive assumes that the lassowiki folder is placed within an existing site folder. Any URLs which do not contain a period, within that folder, are routed to Lasso.

<Location ~ "^/lassowiki/[^.]*$">
	SetHandler lasso8-handler
</Location>

The following virtual host configuration routes all URLs which do not contain a period to Lasso in the sub-domain wiki.example.com. This directive would be added to your /etc/httpd/httpd.conf file (for Apache 1.3 or on Mac OS X 10.4 Tiger or earlier) or /etc/apache2/httpd.conf file (for Apache 2 or on Mac OS X 10.5 Leopard), or wherever your virtual hosts are defined.

<VirtualHost *>
	ServerName wiki.example.com
	DocumentRoot /Library/WebServer/Documents/lassowiki
	<Location ~ "^[^.]*$">
		SetHandler lasso8-handler
	</Location>
</VirtualHost>

You will need to use "sudo apachectl graceful" to restart Apache after adding the rules.

MySQL Database

The Lasso Wiki draws all of its data out of a single MySQL database. The following SQL statements will generate the tables for the database.

Using MySQL Client

in Lasso Site Administration for the data source. You may need to Refresh within Lasso Site Administration in order to see the new tables.

Using Database Browser

you just created. Statement.

CREATE TABLE `pages` (
	`id` int(11) NOT NULL auto_increment,
	`omnisite_created` datetime default NULL,
	`omnisite_modified` timestamp NOT NULL default CURRENT_TIMESTAMP,
	`omnisite_format` varchar(255) default NULL,
	`omnisite_headline` varchar(255) default NULL,
	`omnisite_body` longtext,
	`omnisite_status` varchar(255) default NULL,
	`omnisite_priority` smallint(10) default '0',
	`omnisite_summary` text,
	`omnisite_order` int(11) default '0',
	`omnisite_code` varchar(255) default NULL,
	`omnisite_tags` text,
	`omnisite_display` longtext,
	`omnisite_floater` text,
	PRIMARY KEY (`id`),
	KEY `format` (`omnisite_format`),
	FULLTEXT KEY `searchable` (`omnisite_headline`,`omnisite_body`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE `tags` (
	`tag_id` bigint(20) NOT NULL auto_increment,
	`tag_name` varchar(255) default NULL,
	`tag_pageid` varchar(255) default NULL,
	PRIMARY KEY (`tag_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE `users` (
	`id` int(11) NOT NULL auto_increment,
	`omnisite_handle` varchar(255) default NULL,
	`omnisite_password` varchar(255) default NULL,
	`omnisite_firstname` varchar(255) default NULL,
	`omnisite_lastname` varchar(255) default NULL,
	`omnisite_company` varchar(255) default NULL,
	`omnisite_email` varchar(255) default NULL,
	`omnisite_phone` varchar(255) default NULL,
	`omnisite_created` datetime default NULL,
	`omnisite_modified` timestamp NOT NULL default CURRENT_TIMESTAMP,
	`omnisite_website` varchar(255) default NULL,
	`omnisite_status` varchar(255) NOT NULL default '',
	`omnisite_body` text,
	`omnisite_verify` varchar(255) default NULL,
	PRIMARY KEY (`id`),
	KEY `handle` (`omnisite_handle`),
	KEY `password` (`omnisite_password`),
	KEY `email` (`omnisite_email`),
	KEY `status` (`omnisite_status`),
	KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE `history` (
	`id` int(11) NOT NULL auto_increment,
	`omnisite_created` datetime default NULL,
	`omnisite_modified` timestamp NOT NULL default CURRENT_TIMESTAMP,
	`omnisite_format` varchar(255) default NULL,
	`omnisite_headline` varchar(255) default NULL,
	`omnisite_body` longtext,
	`omnisite_status` varchar(255) default NULL,
	`omnisite_priority` smallint(10) default '0',
	`omnisite_summary` text,
	`omnisite_order` int(11) default '0',
	`omnisite_code` varchar(255) default NULL,
	`omnisite_userid` int(11) default NULL,
	`omnisite_pageid` int(11) default NULL,
	`omnisite_comment` text,
	`omnisite_tags` text,
	`omnisite_display` longtext,
	`omnisite_floater` text,
	PRIMARY KEY (`id`),
	KEY `format` (`omnisite_format`),
	FULLTEXT KEY `searchable` (`omnisite_headline`,`omnisite_body`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 

Lasso Configuration

Lasso Security

Create a group "lassowiki" which has full access to the database that you set up in the MySQL Database section above. A user should be configured within that group and then the username and password specified in the lassowiki_data.lasso file.

The group must have Execute SQL permission for the MySQL host on which your lassowiki database resides as well as All permissions for the lassowiki database and the included tables (or All Tables).

URL Rewrite

The Lasso Wiki uses a URL Redirect rule to route all incoming requests which do not contain a period to the "index.lasso" file.

If the wiki is in a sub-folder of an existing domain then add the following rule adjusted for the name of the sub-folder. First create the rule with the [Response_FilePath] rule and [Include] action, then add the second [Response_FilePath] rule and [Abort] action.

Name: LassoWiki
Status: Enabled
Perform Action If: All Triggers Match
Triggers: 
	[Response_FilePath] Does Not Contain "."
	[Repsonse_FilePath] Begins With "/lassowiki"
Actions: 
	[Include: "/lassowiki/index.lasso"]
	[Abort]

If the wiki is hosted in its own domain name then add the following rule in the Setup > URL Rewrite > Rewrite Rules section of Lasso Site Administration. First create the rule with the [Response_FilePath] rule and [Include] action, then add the [Abort] action.

Name: LassoWiki
Status: Enabled
Perform Action If: All Triggers Match
Triggers: 
	[Response_FilePath] Does Not Contain "."
Actions:
	[Include: "/index.lasso"]
	[Abort]

Getting Started

Once the Lasso Wiki is configured you can access it through the appropriate URL.

http://locahost/lassowiki/index.lasso

Click through the interface and make sure that none of the page show a red error.

If you get Apache errors make sure that you have configured the Location directive properly and the URL Rewrite rule within Lasso properly.

If you see a "No Permission" error then make sure you have configured the "lassowiki" group and user and entered the username and password in the lassowiki_data.lasso file in _includes.

Create a new user and verify your email address. Hint, if you are testing offline you can fetch the verification rule from the email queue.

Create a new page using the Create link or by visiting a testing URL directly. After creating the page you can test category listings, searching, editing the page, viewing the RSS feeds, and viewing the page history.

http://locahost/lassowiki/test

Feedback

Feedback about the Wiki is appreciated. Changes and corrections are also appreciated and will be incorporated into future versions of the Wiki. The Lasso Wiki can be discussed on the Lasso Talk mailing list or messages can be sent to documentation@lassosoft.com.

More Information

More information about all of the tags used in this tip of the week can be found in the Lasso 8.5 Language Guide or in the online Lasso Reference <http://reference.lassosoft.com/>.