MRBS 資源、會議室預約系統

  • Category: 電腦相關
  • Last Updated: Friday, 29 May 2015 09:51
  • Published: Thursday, 04 December 2014 10:41
  • Written by sam

剛好公司有這個需求

就來介紹一下

MRBS 這個系統是免費的,主要是使用PHP,資料庫的部份使用MySQL or Pgsql

我的環境剛好都有,但opennms的資源較多

所以建立在和nms同一臺主機,也就是使用pgsql資料庫

 photo 2014-12-04_100411_zps4789bdda.png

首先至http://mrbs.sourceforge.net/

下載

再來使用

tar -xvzf XXXXXXXX
mv ./web XXXXXX (移到你的web目錄下)

我的是PostgreSQL是8版的

使用命令

createdb -E UTF8 -T template0 mrbs
psql -a -f tables.pg.pre73.sql mrbs (MRBS 是資料庫名,可自行改變)
psql -a -f sample-data.sql mrbs

安裝大致至此

再來是幾個設定檔的修改位址

vi config.inc.php
$timezone = "Asia/Taipei";
$db_database = "mrbs";
$db_login = "postgres";
// Database login password:
這行我是使用本機的postgres故無密碼
記得註解掉

再來是主要的設定檔

vi systemdefaults.inc.php
$mrbs_admin = "admin";
$mrbs_admin_email = "sam at myla.gotdns.com";
$mrbs_company = "XXX";
$mrbs_company_logo = "./images/XXX.png"; 自行修改logo位址
$auth["admin"][] = "127.0.0.1";     
$auth["admin"][] = "administrator"; 
$auth["user"]["administrator"] = "xxx";
$auth["user"]["abc"] = "xx"; 以上是使用本機驗證才會用

再來是設定採用的驗證方式

LDAP, POP3, IMAP...

我採用gmail來驗證

$auth["type"] = "imap_php"
// 'auth_imap_php' configuration settings
$auth["imap_php"]["hostname"] = "imap.gmail.com";
// You can also specify any of the following options:
// Specifies the port number to connect to
$auth["imap_php"]["port"] = 993;
// Use SSL
$auth["imap_php"]["ssl"] = TRUE;
// Use TLS
//$auth["imap_php"]["tls"] = TRUE;
// Turn off SSL/TLS certificate validation
//$auth["imap_php"]["novalidate-cert"] = TRUE;

這個記修改…

$mail_settings['booker']                 = TRUE;  // the person making the booking
$mail_settings['on_new']    = TRUE;   // when an entry is created
$mail_settings['on_change'] = TRUE;  // when an entry is changed
$mail_settings['on_delete'] = TRUE;  // when an entry is deleted

發信的機制

// These settings are only used with the "smtp" backend
$smtp_settings['host'] = '192.168.1.13';  // SMTP server
$smtp_settings['port'] = 25;           // SMTP port number
$smtp_settings['auth'] = TRUE;        // Whether to use SMTP authentication
$smtp_settings['username'] = 'xxxxxx';       // Username (if using authentication)
$smtp_settings['password'] = 'xxxxxxxx';       // Password (if using authentic
$mail_settings['recipients'] = 'xxxxx';
$mail_settings['cc'] = 'sam at myla.gotdns.com';

因為使用外部驗證

再來要修改,告知系統哪個帳號登入是ADMIN

vi ./auth/auth_imap_php.inc
$auth["admin"][] = "sam at myla.gotdns.com";

幾個常用指令

postgres=# \l

 名稱    |  擁有者  | 字元編碼 |    定序     |  轉換型別   |       存取權限
-----------+----------+----------+-------------+-------------+-----------------------
 mrbs      | postgres | UTF8     | zh_TW.UTF-8 | zh_TW.UTF-8 | =Tc/postgres
                                                             : postgres=CTc/postgres
                                                             : sam=CTc/postgres
 opennms   | postgres | UTF8     | zh_TW.UTF-8 | zh_TW.UTF-8 | =Tc/postgres
                                                             : postgres=CTc/postgres
                                                             : opennms=CTc/postgres
 postgres  | postgres | UTF8     | zh_TW.UTF-8 | zh_TW.UTF-8 |
 template0 | postgres | UTF8     | zh_TW.UTF-8 | zh_TW.UTF-8 | =c/postgres
                                                             : postgres=CTc/postgres
 template1 | postgres | UTF8     | zh_TW.UTF-8 | zh_TW.UTF-8 | =c/postgres
                                                             : postgres=CTc/postgres
(5 筆資料列)
postgres=# \c mrbs;
psql (8.4.20)
您現在已經連線到資料庫 "mrbs"。.
mrbs=# \dt;
                   關聯列表
 架構模式 |      名稱      |  型別  |  擁有者
----------+----------------+--------+----------
 public   | mrbs_area      | 資料表 | postgres
 public   | mrbs_entry     | 資料表 | postgres
 public   | mrbs_repeat    | 資料表 | postgres
 public   | mrbs_room      | 資料表 | postgres
 public   | mrbs_users     | 資料表 | postgres
 public   | mrbs_variables | 資料表 | postgres
 public   | mrbs_zoneinfo  | 資料表 | postgres
(7 筆資料列)
mrbs=# select * from mrbs_room;
 id | disabled | area_id | room_name | sort_key | description | capacity |  room_admin_email   | custom_html
----+----------+---------+-----------+----------+-------------+----------+---------------------+-------------
 12 |        0 |       1 | 802       | 802      |             |        8 | sam at myla.gotdns.com |
 13 |        0 |       1 | 803       | 803      |             |        5 | sam at myla.gotdns.com |
 14 |        0 |       1 | 804       | 804      |             |        6 | sam at myla.gotdns.com |
 15 |        0 |       1 | 806       | 806      |             |        6 | sam at myla.gotdns.com |
 16 |        0 |       1 | 807       | 807      |             |        6 | sam at myla.gotdns.com |
 11 |        0 |       1 | 801       | 801      | 1           |       15 | sam at myla.gotdns.com | 2
(6 筆資料列)

以上幾個常用指令,可以拿來檢查一下開頭的匯入是否成功

在web介面新加的資源是否成功

再修改幾行

 

[root@opennms web]# vi systemdefaults.inc.php

 

$url_base = "http://mrbs.fuhu.tw/web";

 

$mail_settings['details']   = TRUE;

 

$mail_settings['html']      = TRUE;

修改前,純文字

不帶連結,需要將連結手動貼入自己的domain name

 photo 2014-12-08_105202_zps82e23a2e.png

修改後,html

這樣可以直接看到內容

也能直接點選連結url,不需手動

 photo 2014-12-08_105153_zps270da5b3.png