Simple Groupware Content Management

Simple Groupware is the first groupware to include the PmWiki engine. PmWiki is a very successful wiki-based system for collaborative creation and maintenance of websites. Combined with Simple Groupware, PmWiki becomes a full multi-user enterprise content management system (CMS), featuring notifications, user/group permissions on pages and media files, WebDAV, and many more.

Using an easy Wiki markup, content editors do not need to know HTML or CSS. Pages can be viewed completely in the backend (Simple Groupware) and the frontend (built with Smarty Templates). Administrators can quickly change the appearance of a site by using a stylesheet and a simple HTML template. Access control is offered on a user/group basis for each page or folders containing pages.

Simple Groupware PmWiki - CMS backend
CMS backend
Simple Groupware PmWiki - CMS frontend
CMS frontend

PmWiki has a great plugin architecture: One principle of the PmWiki philosophy is to only include essential features in the core engine, but make it easy for administrators to customize and add new markup. Hundreds of features are already available by using extensions (called "recipes") that are available from the PmWiki Cookbook. PmWiki is a registered trademark of Patrick R. Michaud.


Differences between PmWiki and Simple Groupware


 PmWikiSimple Groupware + PmWiki
Storagefile systemdatabase (MySQL / PostgreSQL)
Themescustom template engineSmarty Template Engine
Permissionspage, page groupsfolder + page permissions
 (users, passwords)(users + groups)
Authenticationfile based, database, LDAPdatabase, LDAP / AD, IMAP, SMTP, NTLM
File uploadsfile systemCMS or files module (+ WebDAV)
CachingWiki content cachingstatic HTML page caching
PreviewNew pageAjax (Shortcut: Alt+(Shift)+p)


Import PmWiki pages into Simple Groupware


Existing PmWiki pages and uploaded files can be imported into Simple Groupware by using the PmWiki data handler.

Steps in the file system:

  • Copy "<pmwiki>/wiki.d/" to "<sgs-dir>/import/pmwiki/"
  • Copy "<pmwiki>/uploads/" to "<sgs-dir>/ext/cms/files/"

Steps in Simple Groupware:

  • Create a new folder with the module CMS
  • Create a new PmWiki mountpoint and choose "../import/pmwiki/" as path
  • Copy all pages from the mountpoint folder to the CMS folder
  • Then you can start editing pages (default page is "Homepage")

Note: When using an older version before (0.412 or upgrade to 0.412), you'll need to copy all pages from "/Workspace/Demo/CMS/Import/pmwiki/" to "/Workspace/Demo/CMS/".


CMS frontend / getting started


The frontend of the CMS module is located at "<sgs-dir>/bin/cms.php". If the URL to Simple Groupware is "http://<your_server>/sgs/bin/index.php", the CMS frontend is available at "http://<your_server>/sgs/bin/cms.php".

In case you've upgraded from an older version of Simple Groupware (before 0.412), you'll need to create the CMS folder and the PmWiki mountpoint to "../import/pmwiki_cms" manually. Then copy all pages from the mountpoint to the CMS folder.

The default page is identified with the page name "Homepage". When requesting cms.php with no parameters, "Homepage" gets displayed. If a page does not exist, the page "Site.PageNotFound" will be displayed. Authentication is done with "Site.AuthForm". So these pages should be readable by "anonymous" and should not be deleted. By default, all "Site.*" pages are placed under "/Workspace/Demo/CMS/".

Note: The frontend displays or includes only pages that have the "Activated" flag checked. The backend shows all pages (no matter if activated is checked).

Links are automatically built like this:

  • Link to a page: cms.php?page=<Page name>
  • Edit a page: cms.php?page=<Page name>&edit
  • View the source of a page: cms.php?page=<Page name>&source
  • View the RSS sheet with the latest changes: cms.php?rss
  • Get a XML sitemap: cms.php?sitemap
  • Search function: cms.php?page=Site.Search&q=<search text>

Note: The default page "Homepage" can be changed in setup settings.


Attachments


In every page in the CMS module, one or more attachments can be added. To reference a file named image1.jpg, just use Attach:image1.jpg in the wiki markup. If the page is named MyPage and included inside another page, just use Attach:MyPage/image1.jpg. Same if the image should be included on another page. For more information about images in PmWiki, please click here. Examples:

# Attach a file from the Attachments field
Attach:image1.jpg

# Attach from another page or include the page
Attach:MyPage/image1.jpg


Real URLs


Normal URLs have the schema "http://<server>/<sgs-dir>/bin/cms.php?page=<pagename>", real URLs are using a shorter format like "http://<server>/cms/<pagename>".

Real URLs can be activated in setup settings by setting the value "Real URL format in the CMS" to "/cms/". In order to redirect the URLs properly, an ".htaccess" file needs to be placed in the document root of your web server:

RewriteEngine On

# css / images
RewriteRule ^cms/ext/(.+)$ /sgs/bin/ext/cms/$1 [L]

# attachments
RewriteRule ^cms/(.*?)/file/(.*) /sgs/bin/cms.php?page=$1&file=$2 [L]

# Thumbnails
RewriteRule ^cms/thumbs/(.*) /sgs/bin/preview.php?filename=$1 [L]

# pages
RewriteRule ^cms/(.*) /sgs/bin/cms.php?page=$1&%{QUERY_STRING} [L]

Note: This examples implies that Simple Groupware is installed under "http://<your_server>/sgs/". It may be necessary to change the paths to match your configuration.

Note: After (de)acticating real URLs, "schema cache" and "CMS cache" need to be cleared. In order to get the .htaccess working, your Apache web server needs to have the mod_rewrite module loaded.


Custom markup: Graphviz diagrams (added with release 0.503)


The following markup can be used to embed Graphviz diagrams into a normal CMS page:

Syntax:

(:graphviz [=
<graphviz content>
=]:)

Example:

(:graphviz [=
digraph G {
  {node[shape=box] process1 process2 process3}
  {node[shape=diamond] decision1 decision2}
  {node[shape=ellipse] startflow endflow}
  startflow -> process1 -> decision1
  decision1:w -> process1:w [label=n]
  decision1 -> process2 [label=y]
  process2:s -> process3:n
  process3 -> decision2
  decision2 -> endflow [label=y]
  decision2 -> process1 [label=n]
}
=]:)

Output:

Simple Groupware & CMS - Graphviz diagrams


Customizing the CMS frontend


The frontend of the CMS module is located at "<sgs-dir>/bin/cms.php". If the URL to Simple Groupware is "http://<your_server>/sgs/bin/index.php", the CMS frontend is available at "http://<your_server>/sgs/bin/cms.php".

The frontend is controlled by a Smarty template and a stylesheet. Every page is assigned to a template. The documentation for Smarty templates is here.

Default template<sgs-dir>/bin/templates/cms/pmwiki.tpl
Default stylesheet<sgs-dir>/bin/ext/cms/styles.css

Additional media files can be placed in "<sgs-dir>/bin/ext/cms/". References in the templates can be something like "ext/cms/xy.jpg".

There are two important variables assigned to the template: page and cms
To view them, you can add "{debug}" to the template and make sure that your browser allows popups for the page.

The "page" variable is an array which contains these properties (found in the database in table simple_cms):

idnumeric identifier (primary key)
foldernumeric identifier for the folder in the backend
pagenameName of the page (also used in the URL)
nameWhen using pagenames like Main.MyPage, MyPage will be the name
groupWhen using pagenames like Main.MyPage, Main will be the group
titlePage title
dataWiki content
templateSmarty template assigned to the page
descriptionPage description (meta data)
keywordsPage keywords (meta data)
authorPage author (meta data)
createdUnix timestamp of creation time
lastmodifiedUnix timestamp of last modification
createdbyPerson (username) that has created the page
lastmodifiedbyPerson (username) has done the last modification of the page
historyHistory of modifications of the page

The "cms" variable represents the cms class, defined in "cms.php".
Important methods are:

$cms->exists ( $pagename )Checks if a given page name exists
$cms->render ( $pagename )Renders a given page to HTML
$cms->get_content_from_url ( $url, $regexp, $xpath, $time=1800 )Loads content from a special URL, extracts a part of it with a regular expression or xpath, and caches the result for some seconds (0=no cache)

Examples:

Display headlines from Spiegel.de and cache them for half an hour (RSS + XPath):

{* load the data *}
{assign var="data" value=$cms->get_content_from_url("http://www.spiegel.de/schlagzeilen/rss/index.xml","","//item")}

{* display the data *}
{foreach item=item from=$data}
<a href="{$item->link}"> {$item->title} </a><br/>
{/foreach}


Get the latest version of Simple Groupware without caching the data (RSS + RegExp):

{$cms->get_content_from_url("http://sourceforge.net/export/rss2_projnews.php?group_id=96330","!simple groupware ([^ ]+?) rel!","",0)}

or directly in the PmWiki markup (Parameters are url, regexp and time):

(:get_content url=http://sourceforge.net/export/rss2_projnews.php?group_id=96330 regexp="!simple groupware ([^ ]+?) rel!i":)


Note: When using Javascript code inside a Smarty template, "{" and "}" need to be escaped with "{ldelim}" and "{rdelim}". {literal}...{/literal} can be also used to protect the code from being interpreted by Smarty.