SFU Crest Simon Fraser university SFU
MySFU
Webmail
 
Home People Events Research Graduate Undergraduate
PHP icalendar Google Calendar and PHP icalendar MRBS Room booking Calendar  Feed2JS (RSS Feed to JavaScript)

Setting up MRBS on fraser.sfu.ca

Make sure you are using the latest MRBS. Just started updating this for 1.4.7 (October 2011). The old version is here.

MRBS is an online calendar for scheduling/ reserving/ booking rooms, equipment, facilities, people and other resources. It prevents scheduling conflicts and 'double booking' but does not directly support iCal, vCal or Google Calendar. More about MRBS is available at the SourceForge website.

Our setup allows anyone to view the calendar, but using SFU's maillists and CAS for authentication only people in our department can make reservations (this differs from the default distribution by putting the add/edit and admin files in an .htaccess restricted subfolder). Selected staff manage the calendar (edit/delete other peoples bookings). Because our setup uses existing SFU mail lists, the calendar requires no extra maintenance such as adding users. Many other authentication possibilities exist.

You may setup a script to send notification reminders (using cron). MRBS has a setting for confirmation emails.

I also modified MRBS to allow confidential booking of our undergraduate student advisors . This required using the latest SVN version with optional private booking, and adding a couple of fields (Student number or student id, and phone number), plus other minor modifications. If you are interested in specifics contact me, as well as look at mrbs_mysql_quick.txt and mrbs-advising.html.
Derek Warren has written MRBS_Customization_Notes.txt that looks very nice. mrbs-derek warren-nicer.gif

MRBS is also used by the SFU Library, Faculty of Applied Sciences, SFU Co-op, SFU Surrey, and the Nano Imaging Facility.

Additional help is available from http://mrbs.sourceforge.net/INSTALL.html. My directions are for Macintosh OS X, using terminal and TextWrangler, but you can use Windows, Putty and Crimson Editor or Notepad2 (any editor that will save with UNIX line endings). These instructions worked for me but I do not guarantee that they will work for you, or that they will meet your security needs (please share any suggestions you have with me!). Another good php based scheduling calendar is ORS.


1) Request a mysql database be created by ACS- follow these instructions.  If you already have a mysql database on fraser you may be able to use it (do not use one being used by smart templates).  mySQL databases on fraser are independent of the SFU computing ID, thus you may use one database in more than one account.

2) Open a Terminal window and SSH to your SFU UNIX account (fraser). Follow ACS instructions for creating a secure server at http://www.sfu.ca/acs/sfuwebhelp/cgi.htm, basically:

ssh YOURACCOUNT@fraser.sfu.ca
mkdir sec_html
chmod 711 sec_html
cd sec_html
mkdir calendar
(or whatever you want your directory to be called)

3) Mount the folder afp://YOURACCOUNT@home.sfu.ca/ (with OS X) or ftp://YOURACCOUNT@ftp.sfu.ca/.  Download MRBS from http://mrbs.sourceforge.net/ on your computer or directly into your fraser account, putting mrbs-#.#.#.tar.gz into the new folder.  

4) In your terminal window extract the files:

cd calendar/
ls mr*   [will reply with mrbs-1.#.#.tar.gz or whatever version it is]
tar -xvzf mrbs-1.2.4.tar.gz

5)  The files in the web folder are the only ones you need for the web- I transferred them so I have a better web address. 

6)  Connect to your mySQL database with information you received in (A) from ACS.  Run the tables.my.sql script.  
9: youraccount_fraser% mysql -u sfuMySQLname -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 437638 to server version: 4.0.20-standard-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use database sfuDatabase_name;

mysql> source /home/youraccount/sec_html/calendar/tables.my.sql
Query OK, 0 rows affected (0.08 sec)

Query OK, 0 rows affected (0.02 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

7)  See http://www.sfu.ca/acs/sfuwebhelp/php.htm  Use TextWrangler to open and modify files.  Add this first line to most *.php files:
#!/usr/local/bin/php
        
    but don't add it to:
        config.inc.php
        grab_globals.inc.php
        standard_vars.inc..php
        internalconfig.inc.php
        areadefaults.inc.php
        PEAR.php
        Mail.php (nor the files in the 'Mail' folder)
        
[probably other php files that I do not use should not have the line added- if you see "#!/usr/local/bin/php" at the top of a web page, it should be removed from the file calling it]        
        

8) Modify config.inc.php by copying portions from systemdefaults.inc.php - look at the two sample files- one without email notification, the other with (search for 'SFU' to see changes made.). To use CAS authentication, use at least MRBS version 1.4.1 and .htaccess files, 'remote_user', and 'none' in the authentication settings, e.g.:

$auth["session"] = "remote_user"; // How to get and keep the user ID. One of
           // "http" "php" "cookie" "ip" "host" "nt" "omni"
           // "remote_user"

$auth["type"] = "none";
 Note the change from $unicode_encoding = 1;  to $unicode_encoding = 0;


In admin.php (for aesthetics) change
# add space  before parenthesis approx. line 94
echo "<li>" . htmlspecialchars($row[1]) . " (" . htmlspecialchars($row[2])

9) In Terminal, change permissions for directories and files- 

chmod 711 /home/YOURACCOUNT/sec_html/calendar/
chmod 700 /home/YOURACCOUNT/sec_html/calendar/*.php

If you have problems, you may have to make some files visible to the world...

chmod 644 /home/YOURACCOUNT/sec_html/calendar/*.gif
chmod 644 /home/YOURACCOUNT/sec_html/calendar/*.css
chmod 644 /home/YOURACCOUNT/sec_html/calendar/*.html

10) Now you should be able to go to a web browser and view the calendar-

https://cgi.sfu.ca/~YOURACCOUNT/whatever

https://cgi.sfu.ca/~science/calendar/biology/booking/web/


It should work- if not, search on the error message or email me. Once you get it to work you can modify things to restrict access or create additional folders (websites) with different administrators.

I created a .htaccess restricted subdirectory named restricted. Then I copied all the files to the subdirectory (chmod as required), and changed the files in the unrestricted directory to point to the restricted directory [e.g. in day.php etc, href=\"restricted/edit_entry.php] and removed the links to admin.php. I deleted the edit_entry.php and admin.php in the unrestricted directory.

If you only use english you may modify wording by changing the lang.en file and change config.inc.php to disable_automatic_language_changing = 1; (0 is the default and sets the language based on the user's preference).


We get the error message [Warning: Server failed to set locale to "_" (Unix)] so we used the command 'locale -a' on fraser, e.g.,

science_fraser% locale -a
POSIX
C
iso_8859_1
Then set the locale in config.inc.php as shown here:
// Set this to a valid locale (for the OS you run the MRBS server on)
// if you want to override the automatic locale determination MRBS
// performs
$override_locale = "C";  //SFU changed to iso_8859_1 but did not work / POSIX /  from blank
and the error message was gone. (This is despite using version MRBS 1.4.1 which I was not supposed to have that problem.)


In order to show that a booking is part of a series in day.php I added an asterisk to the booking:

Line 182: changed sql $tbl_entry.description AS entry_description to

$tbl_entry.description AS entry_description, entry_type

Line 233: Added line after $today[$row['room_id']][date($format,$t)]["long_descr"] = "";

$today[$row['room_id']][date($format,$t)]["repeatdc"]  = ($row['entry_type'] ? '*' : '');	//Added SFU to show repeating

Line 423: Added line after $long_descr = htmlspecialchars($today[$room_id][$time_t]["long_descr"]);

$repeatdc = $today[$room_id][$time_t]["repeatdc"];   //Added by Dave Carmean SFU to show repeating

Line 500: Added $repeatdc to show asterisk in

echo "<a href=\"view_entry.php?id=$id&area=$area&day=$day&month=$month&year=$year\" title=\"$long_descr\">$descr$repeatdc</a>\n";


I commented out the "lastmonth" table cell at the bottom of mincals.inc to remove the small calendar for the previous month (people generally don't want to know what rooms were available in the past, and it made extra space for comments).

See my comments about creating additional tables in tables.my.sql. so you can have different administrators and different websites.


In day.php I changed it so depending on the area it would display capacity as "(seats ##)"  or not display capacity (e.g, most people do not want their capacity shown).
        echo "<th width=\"$room_column_width%\">"
            . htmlspecialchars($row[0]) . ($row[1] > 0 ? "<small> (seats $row[1])</small>" : " ") . "</th>";

The original (which has links) was:
        echo "<th width=\"$room_column_width%\">
            <a href=\"week.php?year=$year&month=$month&day=$day&area=$area&room=$row[2]\"
            title=\"" . get_vocab("viewweek") . " &#10;&#10;$row[3]\">"
            . htmlspecialchars($row[0]) . ($row[1] > 0 ? "($row[1])" : "") . "</a></th>";


Last login: Mon Oct 17 20:14:27 on console
David-Carmeans-MacBook:~ carmean$ ssh sfu_user@fraser.sfu.ca
Password: 
Last login: Mon Sep 26 16:18:53 2011 from c-98-232-202-11
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005

*************************************************************************
Welcome to Simon Fraser University's information technology environment. Use
of these facilities is governed by SFU Policy GP-24 "Fair Use of Information
Resources". GP-24 is printed in the SFU Computing Guide and may be
found at http://www.sfu.ca/policies/general/gp24.htm on the World Wide Web.
****************************************************************************

1: science_fraser% cd sec_html/

2: science_fraser% mkdir mrbs_directory

4: science_fraser% chmod 711 mrbs_directory

6: science_fraser% cd mrbs_directory


10: science_fraser% mysql -u databaseuser -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2263501
Server version: 5.0.87-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use biology_databases;
Database changed
mysql> source /home/username/sec_html/mrbs_directory/tables.my.e2o.sql
Query OK, 0 rows affected (0.12 sec)

Query OK, 0 rows affected (0.03 sec)

Query OK, 0 rows affected (0.07 sec)

Query OK, 0 rows affected (0.02 sec)

Query OK, 0 rows affected (0.02 sec)

Query OK, 0 rows affected (0.03 sec)

Query OK, 1 row affected (0.01 sec)

Query OK, 1 row affected (0.00 sec)

mysql> exit
Bye

 
5: science_fraser% cd mrbs_directory
/mrbs_directory

6: science_fraser% chmod 700 *.php

7: science_fraser% pico .htaccess

10: science_fraser% chmod 644 *.html

11: science_fraser% chmod 644 *.css

12: science_fraser% chmod 711 images

13: science_fraser% chmod 700 Net/*.php

14: science_fraser% chmod 700 Mail/*.php

15: science_fraser% chmod 644 images/*.*

16: science_fraser% chmod 700 File/*.php

17: science_fraser% chmod 700 File/Passwd/*.php

18: science_fraser% chmod 700 Blowfish/*.php


26: science_fraser% locale -a
C
POSIX
en_CA
en_CA.ISO8859-1
en_CA.UTF-8
en_US
en_US.ISO8859-1
en_US.ISO8859-15
en_US.ISO8859-15@euro
es
es_MX
es_MX.ISO8859-1
es_MX.UTF-8
fr
fr_CA
fr_CA.ISO8859-1
fr_CA.UTF-8
iso_8859_1


33: science_fraser% chmod 700 *.php