Search results The results is only based on Apollo89.com
3 posts are related to 'mantis'
  1. 2009/04/07 멘티스(mantis) 커스텀 필드(CUSTOM FIELD) date 포맷 기본값 설정.
  2. 2007/06/26 Mantis 파일 업로드 설정.
  3. 2007/06/23 Mantis 설치.
멘티스(mantis) 커스텀 필드(CUSTOM FIELD) date 포맷 기본값 설정.

맨티스에서 커스텀 필드를 사용하다 보니 date 포맷을 자주 사용한다.
(시작일, 종료일, 적용일 등..)

그런데 일반 텍스트 박스는 기본값 설정이 가능하나, date 형식은 select 박스 형태아 기본값을 설정하는 것이 난감했다..

입력은 모두 공백으로 되어있어서 셀렉트 박스를 하나하나 선택해줘야 하는 번거로움이 있다..

년/월/일 따로되어있고, 또 날짜 커스텀 항목이 3~4개면 여간 번거로운일이 아닐수 없다..ㅋ

그래서..

소스를 뜯어 고쳤다..ㅡㅡ;;

이슈보고하기 페이지는 bug_report_page.php 이다.

여기서 커스텀 필드를 가져오는 부분은 아래와 같다.

<!-- Custom Fields -->
<?php
    $t_custom_fields_found = false;
    $t_related_custom_field_ids = custom_field_get_linked_ids( $t_project_id );
    foreach( $t_related_custom_field_ids as $t_id ) {
        $t_def = custom_field_get_definition( $t_id );
        $t_def[default_value] = time();
        if( ( ( $t_def['display_report'] && !$t_def['advanced'] ) || $t_def['require_report']) && custom_field_has_write_access_to_project( $t_id, $t_project_id ) ) {
            $t_custom_fields_found = true;
?>
<tr <?php echo helper_alternate_class() ?>>
    <td class="category">
        <?php if( $t_def['require_report'] ) { ?>
            <span class="required">*</span>
        <?php } ?>
        <?php echo string_display( lang_get_defaulted( $t_def['name'] ) ) ?>
    </td>
    <td>
        <?php print_custom_field_input( $t_def, ( $f_master_bug_id === 0 ) ? null : $f_master_bug_id ) ?>
    </td>
</tr>
<?php
        } # if (!$t_def['advanced']) && has write access
    } # foreach( $t_related_custom_field_ids as $t_id )
?>

custom_field_get_linked_ids 메소드가 현재 프로젝트에 할당된 커스텀 필드 배열을 가지고 온다.

그리고 loop을 돌면서 custom_field_get_definition 메소드 에서 각 커스텀 필드의 값을 가져온다(기본값 포함)

이렇게 커스텀 필드를 가져오고 여러가지 권한을 체크한 후에  커스텀 필드 입력을 위한 인풋 박스 를 생성하는 메소드는 print_custom_field_input 이다.

거기서 특별히 내가 기본값을 주고자 하는 날짜 커스텀 필드의 항목은

case CUSTOM_FIELD_TYPE_DATE:

부분이다.
 
이부분에 보면 아래와 같은 select set 을 호출하는 부분이 있다.

print_date_selection_set("custom_field_" . $t_id, config_get('short_date_format'), $t_custom_field_value, false, true) ;

여기서 $t_custom_field_value 변수가 기본 선택되는 값이다.

$t_custom_field_value값의 포맷을 알기 위해 다시 위의 메소드가 있는 부분을 확인해보니,  core/date_api.php 으로 날짜 관련 API 이다.

print_date_selection_set를 뒤져보니

$t_date = preg_split('/-/', date( 'Y-m-d', $p_date), -1, PREG_SPLIT_NO_EMPTY) ;

넘기는 $t_custom_field_value은  $p_date으로 date( 'Y-m-d', $p_date) 부분에서 값을 가져와 정규식으로 파싱해서 표현한다.

즉,  $p_date(=$t_custom_field_value)는 timestamp 값이다..

그러면 다시 bug_report_page.php 으로 가서, custom_field_get_definition 메소드 에서 각 커스텀 필드의 값을 가져오는 부분에서

       $t_def = custom_field_get_definition( $t_id );
       if( $t_def[type] == 8) {
           $t_def[default_value] = time();
       }
부분을 추가한다.

즉, $t_def[type]이 8인것은 날짜 커스텀 필드일 경우에는

기본값을 현재 timestamp으로 하는 것이다.

이제 앞으로는 날짜 커스텀 필드에서 일일이 날짜를 선택하는 번거로움이여 안뇽~ㅋ

크리에이티브 커먼즈 라이센스
Creative Commons License
2009/04/07 15:21 2009/04/07 15:21


Mantis 파일 업로드 설정. posted on 2007/06/26 16:17, filed under Develop
맨티스를 설치하고 한글섲어을 해서 편하게 쓰고 있었다.ㅋㅋㅋ

그런데 참고 자료가 생겨서 맨티스에 파일을 업로드를 하려는 순간!!

에러가 파파밧!! ㅡㅡ;;

또 한글 문제인 것 같았다..

그리고 데이터 베이스 오류란다..

먼뜻인지..ㅋ

여기저기 검색해 본 결과..

파일 업로드 방식 설정의 문제었던것이다..

config_defaults_inc.php를 까서 찿아보니,

$g_file_upload_method   = DATABASE; 으로 설정되어있었다.

그래서

$g_file_upload_method   = DISK;

으로 설정하고 파일 경로도

$g_absolute_path_default_upload_folder = '/디렉토리/맨티스';

으로 설정해서 완료!!



크리에이티브 커먼즈 라이센스
Creative Commons License
2007/06/26 16:17 2007/06/26 16:17


Mantis 설치. posted on 2007/06/23 01:53, filed under Develop
앞으로의 개발 생산성을 위해서 이슈 트레킹 시스템인 맨티스를 설치 했다..ㅋ

정말 오랜만에 보는 맨티스의 즐거움이란^^

버그를 하나하나 잡아가는 재미가 쏠쏠하다~ㅋ

오랜만에 보니까 새로운 버전에 나와서 새버전으로 설치했다.

맨티스 홈페이지 : http://mantisbt.org

최신 안정 버전이 1.0.7이란다..

주저없이 최신버전으로 다운 후 설치!!

영어다ㅋ

주저없이 한글화를 마음먹고 수정을 감행!!

config_defaults_inc.php 파일을 열어 수정했다.

329번 라인  $g_default_language = 'korean';
421번 라인  $g_fallback_language = 'korean';
으로 한글 설정

그러고 다시 refresh를 하게 되면

무수한 에러를 만나게 됨ㅋㅋㅋ

다시 config_defaults_inc.php 파일을 열어 에러 옵션을 수정했다.
1400번 라인  E_WARNING => 'none',

이로써 한글 문제으로 해결



크리에이티브 커먼즈 라이센스
Creative Commons License
2007/06/23 01:53 2007/06/23 01:53


Total: 213296 (Today: 87, Yesterday: 81)

RSS
읽고 있는 책