Friday, June 28, 2013

tuning Fossil SCM Ticketing system to show only own tickets



This work is placed in the Public Domain by the original author, Alexandru Toth

Reasons to choose Fossil

Surprisingly, CGI programs written in C such as Fossil are CPU are memory conscious.
Contrary to popular belief, doing FastCGI in a scripting language results in a process that stays alive for a long time, consuming memory. This is a problem in shared servers. (Translation = tried to run a certain ticketing system written in Ruby On Rails with FastCGI, which used all my memory quota)

Hiding navigation except Tickets, Admin, Login

Others had requested similar topics.
From Admin > Header keep only the Home, Tickets, Administration and Login < li > items

Initializing the ticket creator with the user

From Admin > Tickets > New Ticket Page insert the bold line near the top . For example the existing subsystem field is used, but you can roll your own.
set status Open
set subsystem $login 
if {$mutype eq "HTML"} { 

Showing only own tickets

This works by returning an error message instead of rendering the Admin > Tickets > View Ticket and Edit Ticket pages. Bellow the subsystem field was populated with the ticket creator. You can use another field.
Place at the top this code snippet: 
if { ($login ne "revj") && ($login ne "$subsystem" ) } {
error "unauthorised"

Protecting hidden navigation with mod_rewrite

Even if the navigation to Timeline was hidden, typing the URL would still work. With the help of Apache's mod_rewrite it is possible to allow only access to Tickets and Administration. There must be a file called denied.html. RewriteEngine on

RewriteBase /
RewriteRule ^(.*)/timeline /fossil/denied.html [NC,L]
RewriteRule ^(.*)/files /fossil/denied.html [NC,L]
RewriteRule ^(.*)/dir /fossil/denied.html [NC,L]
RewriteRule ^(.*)/fileage /fossil/denied.html [NC,L]
RewriteRule ^(.*)/brlist /fossil/denied.html [NC,L]
RewriteRule ^(.*)/taglist /fossil/denied.html [NC,L]
RewriteRule ^(.*)/tagtimeline /fossil/denied.html [NC,L]
RewriteRule ^(.*)/wiki /fossil/denied.html [NC,L]
RewriteRule ^(.*)/eventedit /fossil/denied.html [NC,L]
...
look at http://www.fossil-scm.org/xfer/help for full list of URL, you may want to block some more
...

RewriteRule ^(.*)rss /fossil/denied.html [NC,L] 

Alternatively, one can block the URL with 403 error (forbidden):
RewriteRule ^(.*)/timeline - [F,L] 

Adding Search

Look at here about searching.

Styling CSS

From Admin > CSS insert the code bellow at the end. This was largely copied from the ISC licensed codebase behind http://chiselapp.com
#navigation { float: right; } ul#main-navigation { margin: 10px 20px 0px 20px; text-align: right; color: #34495E; font-size: 14px; } ul#main-navigation li { display: inline; vertical-align: center; padding: 5px 10px 5px 0; } ul#main-navigation li a { color: #34495E; text-decoration: none; } ul#main-navigation li.color1 { color: #fff; padding: 5px 10px 5px 10px; background-color:#6880CA; /*767396 ; 6880CA; 6880CA; 4684AB , B07645;*/ -webkit-border-radius:4px; -moz-border-radius:4px; -ms-border-radius:4px; -o-border-radius:4px; border-radius:4px; -webkit-font-smoothing:antialiased; } ul#main-navigation li.color2 { color: #fff; padding: 5px 10px 5px 10px; background-color:#E74C3C; /*#A7BABE;*/ -webkit-border-radius:4px; -moz-border-radius:4px; -ms-border-radius:4px; -o-border-radius:4px; border-radius:4px; -webkit-font-smoothing:antialiased; } ul#main-navigation li.color1 a { color: #fff; } ul#main-navigation li.color2 a { color: #fff; } h1 { padding: 0px 10px 0px 10px; margin: 0 0 0 0; }