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:テキストエリア';

0 件のコメント:

コメントを投稿