Changes between Initial Version and Version 1 of TracTicketsCustomFields


Ignore:
Timestamp:
2007/12/16 04:44:37 (16 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracTicketsCustomFields

    v1 v1  
     1= カスタムチケット属性 = 
     2Trac ではチケットにユーザ定義の属性を追加できます。カスタムチケット属性を使用すると、定型で、プロジェクト特有のプロパティをチケットに持たせることができます。 
     3 
     4== 設定方法 == 
     5カスタムチケット属性を設定するためには、 [wiki:TracIni trac.ini] ファイルを変更します。カスタムフィールドは、 trac.ini ファイルの `[ticket-custom]` セクションに書く必要があります。 
     6 
     7各属性の定義は以下のように記述します: 
     8{{{ 
     9 属性名 = タイプ 
     10 (属性名.オプション = 値) 
     11 ... 
     12}}} 
     13構文の詳細は以下の例を見てください。 
     14 
     15=== 属性のタイプとオプション === 
     16 * '''text''': シンプルな(1行の)テキスト。 
     17   * label: 説明となるラベル 
     18   * value: デフォルト値 
     19   * order: ソート時の並び順 (フォーム内での相対的位置を決定します。) 
     20 * '''checkbox''': ブーリアン値をもつチェックボックス。 
     21   * label: 説明となるラベル。 
     22   * value: デフォルト値 (0 または 1). 
     23   * order: ソート時の並び順 
     24 * '''select''': ドロップダウンするリストボックス。 
     25   * label: 説明となるラベル。 
     26   * options: リストに表示する値を '''|''' (vertical pipe) 区切りで記述。 
     27   * value: デフォルト値 (0から始まるリスト内での番号) 。 
     28   * order: ソート時の並び順 
     29 * '''radio''': ラジオボタン。 HTML の '''select''' 要素と同じ。 
     30   * label: 説明となるラベル。 
     31   * options: リストに表示する値を '''|''' (vertical pipe) 区切りで記述。 
     32   * value: デフォルト値 (0から始まるリスト内での番号) 。 
     33   * order: ソート時の並び順 
     34 * '''textarea''': 複数行のテキストエリア。 
     35   * label: 説明となるラベル。 
     36   * value: デフォルトで設定されるテキスト。 
     37   * cols: 入力領域のカラム幅。 
     38   * rows: 入力領域の行数。 
     39   * order: ソート時の並び順 
     40 
     41=== サンプル === 
     42{{{ 
     43[ticket-custom] 
     44 
     45test_one = text 
     46test_one.label = Just a text box 
     47 
     48test_two = text 
     49test_two.label = Another text-box 
     50test_two.value = Just a default value 
     51 
     52test_three = checkbox 
     53test_three.label = Some checkbox 
     54test_three.value = 1 
     55 
     56test_four = select 
     57test_four.label = My selectbox 
     58test_four.options = one|two|third option|four 
     59test_four.value = 2 
     60 
     61test_five = radio 
     62test_five.label = Radio buttons are fun 
     63test_five.options = uno|dos|tres|cuatro|cinco 
     64test_five.value = 1 
     65 
     66test_six = textarea 
     67test_six.label = This is a large textarea 
     68test_six.value = Default text 
     69test_six.cols = 60 
     70test_six.rows = 30 
     71}}} 
     72 
     73''Note: `select` タイプのフィールドを非必須 (optional) にしたい場合、 `フィールド名.options` オプションの先頭に `バーティカルパイプ (|)` を設定してください。'' 
     74 
     75=== カスタム属性を含むレポート === 
     76 
     77カスタム属性を含む TracReports では比較的 SQL を間違えやすいです。 `ticket_custom` 表の `JOIN` はカスタム属性ごとにそれぞれ必要です。 
     78 
     79以下の例は `progress` という名前のカスタム属性を含むレポートです: 
     80{{{ 
     81#!sql 
     82SELECT p.value AS __color__, 
     83   id AS ticket, summary, component, version, milestone, severity, 
     84   (CASE status WHEN 'assigned' THEN owner||' *' ELSE owner END) AS owner, 
     85   time AS created, 
     86   changetime AS _changetime, description AS _description, 
     87   reporter AS _reporter, 
     88  (CASE WHEN c.value = '0' THEN 'None' ELSE c.value END) AS progress 
     89  FROM ticket t 
     90     LEFT OUTER JOIN ticket_custom c ON (t.id = c.ticket AND c.name = 'progress') 
     91     JOIN enum p ON p.name = t.priority AND p.type='priority' 
     92  WHERE status IN ('new', 'assigned', 'reopened') 
     93  ORDER BY p.value, milestone, severity, time 
     94}}} 
     95 
     96この `LEFT OUTER JOIN` ステートメントに特に注意してください。 
     97 
     98---- 
     99See also: TracTickets, TracIni