天高任鸟飞,海阔凭鱼跃。 -------我思故我在

发布新日志

  • Mantis相关配置

    2007-03-20 00:03:51

    以下的配置基于mantis1.1


    1.中文编码集

    TO:解决浏览器访问Mantis时中文字体乱码问题

    修改Mantis中的默认配置文件config_defaults_inc.php,找到如下内容,对照修改.

    如果把以下内容拷到config_inc.php中也可以.

    配置文件加载顺序:先加载config_defaults_inc.php,后加载config_inc.php。

    config_inc.php中的值会覆盖config_defaults_inc.php.

      ################################
     # Mantis Language Settings
     ################################

     # --- language settings -----------
     # If the language is set to 'auto', the actual
     # language is determined by the user agent (web browser)
     # language preference.
     $g_default_language  = 'chinese_simplified_gb2312';

     # list the choices that the users are allowed to choose
     $g_language_choices_arr = array(
      'auto',
      'bulgarian',
      'catalan',
      'chinese_simplified_gb2312',
      'chinese_traditional',
      'croatian',
      'czech',
      'danish',
      'dutch',
      'english',
      'estonian',
      'finnish',
      'french',
      'german',
      'hebrew',
      'hungarian',
      'icelandic',
      'italian',
      'japanese',
      'korean',
      'latvian',
      'lithuanian',
      'norwegian',
      'polish',
      'portuguese_brazil',
      'portuguese_standard',
      'romanian',
      'russian',
      'serbian',
      'slovak',
      'slovene',
      'spanish',
      'swedish',
      'turkish',
      'ukrainian'
     );

     # Browser language mapping for 'auto' language selection
     $g_language_auto_map = array(
      'bg' => 'bulgarian',
      'ca' => 'catalan',
      'zh-cn, zh-sg, zh' => 'chinese_simplified_gb2312',
      'zh-hk, zh-tw' => 'chinese_traditional',
      'cs' => 'czech',
      'da' => 'danish',
      'nl-be, nl' => 'dutch',
      'en-us, en-gb, en-au, en' => 'english',
      'et' => 'estonian',
      'fi' => 'finnish',
      'fr-ca, fr-be, fr-ch, fr' => 'french',
      'de-de, de-at, de-ch, de' => 'german',
      'he' => 'hebrew',
      'hu' => 'hungarian',
      'hr' => 'croatian',
      'is' => 'icelandic',
      'it-ch, it' => 'italian',
      'ja' => 'japanese',
      'ko' => 'korean',
      'lt' => 'lithuanian',
      'lv' => 'latvian',
      'no' => 'norwegian',
      'pl' => 'polish',
      'pt-br' => 'portugese_brazil',
      'pt' => 'portugese_standard',
      'ro-mo, ro' => 'romanian',
      'ru-mo, ru-ru, ru-ua, ru' => 'russian',
      'sr' => 'serbian',
      'sk' => 'slovak',
      'sl' => 'slovene',
      'es-mx, es-co, es-ar, es-cl, es-pr, es' => 'spanish',
      'sv-fi, sv' => 'swedish',
      'tr' => 'turkish',
      'uk' => 'ukrainian'
     );

     # Fallback for automatic language selection
     $g_fallback_language = 'english';


    2.邮件配置

    TO:解决邮件发送问题

    以下内容可以在config_defaults_inc.php中找到。

    建议把该内容拷到config_inc.php中.

     #############################
     # Mantis Email Settings
     #############################

     # --- email variables -------------
     $g_administrator_email =
    'testsrv@xxx.com';
     $g_webmaster_email  =
    'testsrv@xxx.com';

     # the 'From: ' field in emails
     $g_from_email   =
    'testsrv@xxx.com';

     # the return address for bounced mail
     $g_return_path_email =
    'testsrv@xxx.com';

     # allow email notification
     #  note that if this is disabled, sign-up and password reset messages will
     #  not be sent.
     $g_enable_email_notification = ON;
     # select the method to mail by:
     # 0 - mail()
     # 1 - sendmail
     # 2 - SMTP
     $g_phpMailer_method  = 2;

     # This option allows you to use a remote SMTP host.  Must use the phpMailer scrīpt
     # Name of smtp host, needed for phpMailer, taken from php.ini
     $g_smtp_host   = 'mail.xxx.com';

     # These options allow you to use SMTP Authentication when you use a remote
     # SMTP host with phpMailer.  If smtp_username is not '' then the username
     # and password will be used when logging in to the SMTP server.
     $g_smtp_username = 'testsrv';
     $g_smtp_password = 'testsrv';

    邮件系统的配置建议用smtp方式。一般公司都有自己的邮件服务器,让管理员给你开一个mantis的专用信箱。

    另:本人配置mantis邮件服务时,也出现过邮件发送成功但收不到的情况,后来让公司管理员协助,从邮件服务器的后台日志查到。原来是把testsrv@xxx.com写成testesrv@xxx.com

     呵呵,要细心一点哦!

    经验之谈。


    3.图形报表

    TO:解决图形报表中文字体输出问题.

    在mantis1.1中,现在稍微简单一些,只要改个字体就可以。

    打开core\graph_api.php文件,找到如下内容,并添加一行:

     function graph_get_font() {
      $t_font_map = array(
       'simsun' => FF_SIMSUN,
       'arial' => FF_ARIAL,
       'verdana' => FF_VERDANA,
       'courier' => FF_COURIER,
       'comic' => FF_COMIC,
       'times' => FF_TIMES,
       'georgia' => FF_GEORGIA,
       'trebuche' => FF_TREBUCHE,
       'vera' => FF_VERA,
       'veramono' => FF_VERAMONO,
       'veraserif' => FF_VERASERIF );

      $t_font = config_get( 'graph_font', '');
      if ( isset( $t_font_map[$t_font] ) ) {
       return $t_font_map[$t_font];
      } else {
       return FF_FONT1;
      }

    另外注意config_inc.php或config_defaults_inc.php中应该有以下配置内容:

    ############################
     # Mantis JPGRAPH Addon
     ############################

     # --- jpgraph settings --- #
     # Initial Version from Duncan Lisset
     #
     # To use the Jpgraph addon you need the JPGRAPH package from
     #
    http://www.aditus.nu/jpgraph/index.php
     # You can place the package whereever you want, but you have
     # to set the var in jpgraph.php eg.
     # (DEFINE('DIR_BASE','/www/mantisbt/jpgraph/');)

     $g_use_jpgraph   = ON;
     $g_jpgraph_path   = 'D:/mantis-1.1.0a2/core/jpgraph/src' . DIRECTORY_SEPARATOR . '' . DIRECTORY_SEPARATOR;   # dont forget the ending slash!

    #注意:这里需要指定src\jpgraph.php的路径.页面出错时会有提示的.

     # what truetype font will the graphs use. Allowed values are 'arial', 'verdana', 'courier', 'book', 'comic', 'times',
     #  'georgia', 'trebuche', 'vera', 'veramono', or 'veraserif'. Refer to the jpgraph manual for details.
     # NOTE: these fonts need to be installed in the TTF_DIR as specified to jpgraph
     $g_graph_font = 'simsun';

     # what width is used to scale the graphs.
     $g_graph_window_width = 800;
     # bar graph aspect ration (height / width)
     $g_graph_bar_aspect = 0.9;

     # how many graphs to put in each row in the advanced summary page
     $g_graph_summary_graphs_per_row = 2;

     $g_system_font_folder = 'c:/winnt/fonts/';

     $g_font_per_captcha = 'simsun.ttf';

    4.时区设置

    TO:解决mantis页面时间显示问题,默认用的是GMT格林威治时间.与中国时间相差8小时.

    在config_inc.php或config_defaults_inc.php中添加以下内容:

     #时区设置

    putenv("TZ=Asia/Shanghai");

    另外网上也有人提到在php.ini中进行如下设置。(如果putenv函数不起作用的话,可以试下

    [Date]
    ; Defines the default timezone used by the date functions
    date.timezone = Asia/shanghai


    5.数据库(Mysql)

    版本:MySQL 5.0系列

    很多人用phpMyAdmin对mysql进行数据管理。

    建议大家用MySQL-Front,我用的是3.2版。

    图形化界面操作挺方便。

    mantis中的数据源连接配置还是比较简单的,在config_inc.php中设置:

     ################################
     # Mantis Database Settings
     ################################

     # --- database variables ---------

     # set these values to match your setup

     # hostname should be either a hostname or connection string to supply to adodb.
     # For example, if you would like to connect to a mysql server on the local machine,
     # set hostname to 'localhost', and db_type to 'mysql'.
     # If you need to supply a port to connect to, set hostname as 'localhost:3306'.
     $g_hostname    = 'localhost';
     $g_db_username   = 'mantis';
     $g_db_password   = 'mantis';
     $g_database_name  = 'mantis';

    #这里数据库用户名,密码,和数据库名称,全都是用mantis.

    #要在myssql中新建一个数据库用户mantis,注意给它足够的权限。

     # Supported types: mysql for MySQL, mysqli for MySQL, pgsql for PostgreSQL, mssql for MS SQL Server, oci8 for Oracle.这里支持的数据库类型还真不少。
     $g_db_type    = 'mysql';


    6.web服务器(Apache Or IIS)

    mantis目前常用的服务就是这两种,这里推荐用Apache.

    Apache现在版本是2.2系列。配置主要是一个应用服务目录的配置,

    打开apache\conf\httpd.conf,在文件的最后添加以下内容:

    Alias /mantis "D:/mantis-1.1.0a2/"
    #这是服务访问的虚拟路径设置

    <Directory "D:/mantis-1.1.0a2/">
        Options Indexes
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    Apache端口修改:

    #Listen 12.34.56.78:80
    Listen 80

    默认应用目录修改:

    DocumentRoot "D:/mantis-1.1.0a2"


Open Toolbar