ラベル mantis の投稿を表示しています。 すべての投稿を表示
ラベル mantis の投稿を表示しています。 すべての投稿を表示

2012年6月17日日曜日

mantis(mantisbt-1.2.11)のカスタムフィールドにTEXTAREAを選択可能なように変更。
mantisではカスタムフィールドで255までの文字列はサポートされていますが フリーのtextareaを使うことができません。そこでソースを修正してカスタムフィールドとして 選択できるようにする。ただし、255文字以上を扱えるようにするためにはDBの型も修正する必要あり。
mantis custom_field string only supports up to 255 characters string and 1line. mantis custom_field can't select by textarea. So,Source code is modify. Custom_Field can select the textarea.DataBase kind of format is C(255) to XL. Although, If TextArea is 255 character, don't have to change.
admin/schema.php
DataBaseの構造が定義されているが、ここを修正してinstall.phpを起動させても Versionが同じもののため変更されない。これの修正方法がわからず。 下記の型修正はmysqlのツールを使って変更。ただし255文字以内であれば修正不要。
154c154
<   value   C(255) NOTNULL DEFAULT \" '' \"
---
>   value   XL NOTNULL DEFAULT \" '' \"
mantisbt-1.2.11/config_defaults_inc.php
custom_fieldとしてtextarea型が認識できるように追加。
3031c3031
<  $g_custom_field_type_enum_string    = '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:radio';
---
>  $g_custom_field_type_enum_string    = '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:radio,10:textarea';
mantisbt-1.2.11/core/cfdefs/cfdef_standard.php
選択されたtextareaの実体の定義
33a34,47
> $g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_TEXTAREA ] = array (
>  '#display_possible_values' => TRUE,
>  '#display_valid_regexp' => TRUE,
>  '#display_length_min' => TRUE,
>  '#display_length_max' => TRUE,
>  '#display_default_value' => TRUE,
>  '#function_return_distinct_values' => null,
>  '#function_value_to_database' => null,
>  '#function_database_to_value' => null,
>  '#function_print_input' => 'cfdef_input_textarea',
>  '#function_string_value' => null,
>  '#function_string_value_for_email' => null,
> );
> 
300a315,324
> }
> 
> function cfdef_input_textarea($p_field_def, $t_custom_field_value) {
>   echo '<textarea    if( 0 < $p_field_def['length_max'] ) {
>     echo ' maxlength="' . $p_field_def['length_max'] . '"';
>   } else {
>     echo ' maxlength="65535">';
>   }
>   echo string_attribute( $t_custom_field_value ) .'</textarea>';
mantisbt-1.2.11/core/constant_inc.php
Custom_Fieldの型を10として登録
417a418 > define( 'CUSTOM_FIELD_TYPE_TEXTAREA', 10 );
mantisbt-1.2.11/lang/strings_english.txt
画面上に表示するためのTextArea文字列の定義
1311c1311
< $s_custom_field_type_enum_string = '0:String,1:Numeric,2:Float,3:Enumeration,4:E-mail,5:Checkbox,6:List,7:Multiselection list,8:Date,9:Radio';
---
> $s_custom_field_type_enum_string = '0:String,1:Numeric,2:Float,3:Enumeration,4:E-mail,5:Checkbox,6:List,7:Multiselection list,8:Date,9:Radio,10:TextArea';
mantisbt-1.2.11/lang/strings_japanese.txt
日本語のテキストエリアの定義
1019c1019
< $s_custom_field_type_enum_string = '0:文字列,1:整数,2:浮動小数点,3:列挙,4:メール,5:チェックボックス,6:リスト,7:複数選択リスト,8:日付,9:ラジオボタン';
---
> $s_custom_field_type_enum_string = '0:文字列,1:整数,2:浮動小数点,3:列挙,4:メール,5:チェックボックス,6:リスト,7:複数選択リスト,8:日付,9:ラジオボタン,10:テキストエリア';

2011年11月30日水曜日

MantisGraphの文字フォント

mantisでのグラフ表示
mantisのグラフ系の処理がjpgraphを別途インストールしないとグラフが表示できなかったが、mantisbt-1.2.8ではMantisGraphとしてPlugin化されているようだ。
このMantisGraphを使ったグラフではそのままでは日本語フォントが設定されていないために日本語が化けてしまう。

Ubuntu12.04でデフォルトで使えるTakaoフォントを使用
日本語のフォントを設定してグラフに日本語を表示できるようにする。

ubuntu12.04ではTakaoフォントの位置が
/usr/share/fonts/truetype/ttf-japanaese-gothic.ttf
→/etc/alternatives/ttf-japanese-gothic.ttf
これらはシンボリックリンクとなっていて
実体は
/usr/share/fonts/truetype/takeo-gothic/TakaoPGothic.ttf
を参照しているがそこにはフォントファイルが存在せず。
/usr/share/fonts/truetype/takeo/TakaoPGothic.ttf
にあるのでシンボリックリンクを修正。
/etc/alternatives$ sudo ln -s /usr/share/fonts/truetype/takao-gothic/TakaoPGothic.ttf ttf-japanese-gothic.ttf

mantisbt-1.2.11/plugins/MantisGraph/MantisGraph.php
config()の'font'識別子に"JAPAN"を追加 識別子なので何でも良い。
      function config() {
                return array(
                        'eczlibrary' => ON,

                        'window_width' => 800,
                        'bar_aspect' => 0.9,
                        'summary_graphs_per_row' => 2,
                        'font' => 'JAPAN',

                        'jpgraph_path' => '',
                        'jpgraph_antialias' => ON,
                );
        }

graph_api.php フォント設定に日本語の設定を追加

上記のフォント識別子('JAPAN')に対するフォント名を指定する。
$f_font_map = array( に'JAPAN' => 'ttf-japanaese-gothic.ttf' を追加