Changes between Version 1 and Version 2 of TracReports
- Timestamp:
- Jun 21, 2005, 1:13:35 AM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracReports
v1 v2 1 = Trac Reports=1 = レポート = 2 2 [[TracGuideToc]] 3 3 4 The Trac reports module provides a simple, yet powerful reporting facility 5 to present information about tickets in the Trac database. 4 レポートモジュールは、簡単かつ強力なレポーティング機能を提供します。 5 この機能によって、 Trac データベースのチケット情報を取得することができます。 6 6 7 Rather than have its own report definition format, TracReports relies on standard SQL 8 S ELECT statements for custom report definition.7 TracReports ではレポートの形式を定義するための方法として、独自フォーマットではなく、 8 SQL の SELECT 文を使用することにしました。 9 9 10 A report consists of these basic parts:11 * ID -- Unique (sequential) identifier12 * Title -- Descriptive title13 * Description -- A brief description of the report, in WikiFormatting text.14 * Report Body -- List of results from report query, formatted according to the methods described below.15 * Footer -- Links to alternative download formats for this report.10 レポートは以下の基本的なパーツから構成されます: 11 * ID -- ユニークな (連番の) 識別子 12 * レポート名 (Title) -- レポートのタイトル 13 * 説明 (Description) -- WikiFormatting で記述された、レポートの説明。 14 * レポート本体 (Report Body) -- 後に述べるフォーマットで規定された、レポートクエリの結果。 15 * フッタ(Footer) -- レポート本体を異なる形式でダウンロードするためのリンク。 16 16 17 17 18 == Changing Sort Order==19 Simple reports - ungrouped reports to be specific - can be changed to be sorted by any column simply by clicking the column header. 18 == ソートの並び順変更 == 19 単純なレポート (特にグループ化されていないもの) では、カラムのヘッダをクリックすれば、そのカラムでソートすることが出来ます。 20 20 21 If a column header is a hyperlink (red), click the column you would like to sort by. Clicking the same header again reverses the order. 21 カラムのヘッダがハイパーリンク (赤) になっていれば、クリックすることでそのカラムでのソートができます。並び順を逆にするには、もう一度クリックします。 22 22 23 23 24 == Alternate Download Formats==25 Aside from the default HTML view, reports can also be exported in a number of alternate formats. 26 At the bottom of the report page, you will find a list of available data formats. Click the desired link to 27 download the alternate report format. 24 == ダウンロードできるフォーマット == 25 通常表示される HTML でのビューの加え、レポートはいろいろな形式で使用することができます。 26 レポートページの一番下に、利用可能なデータ形式の一覧があります。望む形式のリンクをクリックすれば、 27 その形式でのレポートをダウンロードすることができます。 28 28 29 === Comma-delimited- CSV (Comma Separated Values) ===30 Export the report as plain text, each row on its own line, columns separated by a single comma (','). 31 '''Note:''' C olumn data is stripped from carriage returns, line feeds and commas to preserve structure.29 === カンマ区切りテキスト - CSV (Comma Separated Values) === 30 1レコードを1行として、各カラムをカンマ (',') で区切ったプレーンテキストとしてダウンロードできます。 31 '''Note:''' CSV形式を保つため、各カラムのデータに改行文字やカンマがある場合、その位置で切り取られます。 32 32 33 === Tab-delimited===34 Like above, but uses tabs (\t) instead of comma. 33 === タブ区切り === 34 CSV と似ていますが、水平タブ文字 (\t) で区切られる点が違います。 35 35 36 36 === RSS - XML Content Syndication === 37 All reports support syndication using XML/RSS 2.0. To subscribe to a , click the the orange 'XML' icon at the bottom of the page. See TracRss for general information on RSS support in Trac. 37 全てのレポートは、 XML/RSS 2.0 での配信をサポートしています。購読するにはページ下部にある、オレンジ色の 'XML' アイコンをクリックしてください。 Trac での RSS サポートについての一般的な情報は、 TracRss に記述しています。 38 38 39 39 ---- 40 == Creating Custom Reports==40 == カスタムレポートを作成する == 41 41 42 '' Creating a custom report requires a comfortable knowledge of SQL.''42 ''カスタムレポートを作成するためには、 SQL を楽に書ける程度の知識が必要です。'' 43 43 44 A report is basically a single named SQL query, executed and presented by 45 Trac. Reports can be viewed and created from a custom SQL expression directly 46 in from the web interface. 44 レポートは基本的に、 Trac が実行できる形式の、名前がついた特定 SQL です。 45 レポートに指定された SQL は、直接 Web インタフェースから閲覧したり、 46 作成したりできます。 47 47 48 Typically, a report consists of a SELECT-expression from the 'ticket' table, 49 using the available columns and sorting the way you want it. 48 通常のレポートは、 'ticket' 表に対する、カラムの選択や、ソート指定を伴った 49 SELECT 文となります。 50 50 51 == Ticket columns==52 The ''ticket'' table has the following columns:53 * id 54 * time 55 * changetime 56 * component 57 * severity 58 * priority 59 * owner 60 * reporter 61 * cc 62 * url 63 * version 64 * milestone 65 * status 66 * resolution 67 * summary 68 * description 51 == Ticket 表のカラム == 52 ''ticket'' 表は、以下のカラムを持ちます: 53 * id -- チケットID 54 * time -- 登録日時 55 * changetime -- 最終更新日時 56 * component -- コンポーネント 57 * severity -- 重要度 58 * priority -- 優先度 59 * owner -- 担当者 60 * reporter -- 報告者 61 * cc -- 関係者 62 * url -- URL 63 * version -- バージョン 64 * milestone -- マイルストーン 65 * status -- ステータス 66 * resolution -- 解決方法 67 * summary -- チケットの概要 68 * description -- チケットについての完全な説明 69 69 70 See TracTickets for a detailed description of the column fields. 70 各カラムに対応する属性の詳細な説明は、 TracTickets に記述しています。 71 71 72 ''' all active tickets, sorted by priority and time'''72 '''優先度順、登録日時順の全未解決チケット''' 73 73 74 ''' Example:''' ''All active tickets, sorted by priority and time''74 '''例:''' ''優先度順、登録日時順の全未解決チケット'' 75 75 {{{ 76 76 SELECT id AS ticket, status, severity, priority, owner, … … 84 84 85 85 86 == Advanced Reports: Dynamic Variables==87 For more flexible reports, Trac supports the use of ''dynamic variables'' in report SQL statements. 88 In short, dynamic variables are ''special'' strings that are replaced by custom data before query execution. 86 == 上級トピック: 動的変数の使用 == 87 レポートに汎用性を持たせる手段として、 ''動的変数'' をレポート SQL で使用する方法があります。 88 簡単に言うと、動的変数とは、クエリを実行する前に置き換えられる ''特別な'' 文字列のことです。 89 89 90 === Using Variables in a Query===91 The syntax for dynamic variables is simple, any upper case word beginning with '$' is considered a variable. 90 === クエリで動的変数を使う方法 === 91 動的変数を使うためのシンタックスは単純です。 '$' に続いて、大文字で変数名となる語を挿入してください。 92 92 93 Example:93 例: 94 94 {{{ 95 95 SELECT id AS ticket,summary FROM ticket WHERE priority='$PRIORITY' 96 96 }}} 97 97 98 To assign a value to $PRIORITY when viewing the report, you must define it as an argument in the report URL, leaving out the the leading '$'. 98 レポート閲覧時、 $PRIORITY に値を当てはめるためには、レポートの URL に引数として変数を与えてください。この変数名に '$' を入れてはいけません。 99 99 100 Example:100 例: 101 101 {{{ 102 102 http://projects.edgewall.com/trac/reports/14?PRIORITY=high … … 104 104 105 105 106 === Special/Constant Variables===107 There is one ''magic'' dynamic variable to allow practical reports, its value automatically set without having to change the URL. 106 === 特殊な定数 === 107 実用的なレポートのために、定義済みの動的変数が用意されています。これらは URL に値を設定しなくても、自動的に値が割り当てられます。 108 108 109 * $USER -- Username of logged in user.109 * $USER -- ログインに使用したユーザ名。 110 110 111 Example (''List all tickets assigned to me''):111 例 (''私が担当になっているチケット一覧''): 112 112 {{{ 113 113 SELECT id AS ticket,summary FROM ticket WHERE owner='$USER' … … 118 118 119 119 120 == Advanced Reports: Custom Formatting==121 Trac is also capable of more advanced reports, including custom layouts,122 result grouping and user-defined CSS styles. To create such reports, we'll use 123 specialized SQL statements to control the output of the Trac report engine. 120 == 上級トピック: 表示形式のカスタマイズ == 121 Trac には、レイアウトのカスタマイズや、グルーピング、ユーザ定義の CSS 利用などによる 122 もっと複雑なレポートの作成も可能です。このようなレポートを作成するには、 123 Trac のレポートエンジンが出力を制御するためのステートメントを含む、特別な SQL を使用します。 124 124 125 == Special Columns==126 To format reports, TracReports looks for 'magic' column names in the query 127 result. These 'magic' names are processed and affect the layout and style of the 128 final report. 125 == 特別なカラム == 126 レポートを整形するため、 TracReports はクエリの結果から '特定の' カラム名を 127 探します。このような '特定の' 名前で、最終的なレポートのレイアウトやスタイルが 128 処理され、変更されます。 129 129 130 === Automatically formatted columns===131 * '''ticket''' -- Ticket ID number. Becomes a hyperlink to that ticket.132 * '''created, modified, date, time''' -- Format cell as a date and/or time.130 === 自動的に整形されるカラム名 === 131 * '''ticket''' -- チケットの ID が入っているカラムで使用します。該当する ID のカラムにハイパーリンクされます。 132 * '''created, modified, date, time''' -- 日付や時刻に整形されます。 133 133 134 * '''description''' -- Ticket description field, parsed through the wiki engine.134 * '''description''' -- チケットの説明が入っているカラムで使用します。 Wiki エンジンで処理されます。 135 135 136 ''' Example:'''136 '''例:''' 137 137 {{{ 138 138 SELECT id as ticket, created, status, summary FROM ticket 139 139 }}} 140 140 141 === Custom formatting columns===142 Columns whose names begin and end with 2 underscores (Example: '''_''''''_color_''''''_''') are 143 assumed to be ''formatting hints'', affecting the appearance of the row. 141 === 整形されるカラムのカスタマイズ === 142 カラム名の前後に 2 つのアンダースコアがついている場合 (例: '''_''''''_color_''''''_''') は、 143 ''整形用のヒント'' として扱われ、レコードの整形が行われます。 144 144 145 * '''_''''''_group_''''''_''' -- Group results based on values in this column. Each group will have its own header and table.146 * '''_''''''_color_''''''_''' -- Should be a numeric value ranging from 1 to 5 to select a pre-defined row color. Typically used to color rows by issue priority.147 * '''_''''''_style_''''''_''' -- A custom CSS style expression to use for the current row.145 * '''_''''''_group_''''''_''' -- 指定されたカラムで、表示がグループ化されます。各グループは、それぞれセクションヘッダとクエリ結果の表を持ちます。 146 * '''_''''''_color_''''''_''' -- 1 から 5 の数値である必要があります。値によって、あらかじめ定義された色付けが行われます。一般的な使用法は、優先度別の色付けです。 147 * '''_''''''_style_''''''_''' -- CSS 形式でレコードを整形できます。 148 148 149 ''' Example:''' ''List active tickets, grouped by milestone, colored by priority''149 '''例:''' ''マイルストーン別未解決チケット (優先度別色付け)'' 150 150 {{{ 151 151 SELECT p.value AS __color__, … … 159 159 }}} 160 160 161 '''Note:''' A table join is used to match ''ticket'' priorities with their162 numeric representation from the ''enum'' table. 161 '''Note:''' ''ticket'' 表の優先度に対応する数値は、 ''enum'' 表を結合することで 162 取り出しています。 163 163 164 === Changing layout of report rows===165 By default, all columns on each row are display on a single row in the HTML 166 report, possibly formatted according to the descriptions above. However, it's 167 also possible to create multi-line report entries. 164 === 行単位のレイアウト変更 === 165 デフォルトでは、全てのカラムで1行を使い、上記の指定がされていれば、 166 フォーマットされた形式で HTML に表示されます。それだけでなく、 167 これから挙げる指定によって、複数行にわたってのレイアウトを行うことができます。 168 168 169 * '''column_''' -- '' Break row after this''. By appending an underscore ('_') to the column name, the remaining columns will be be continued on a second line.169 * '''column_''' -- ''改行''。 カラム名の語尾にアンダースコア ('_') を付与した場合、以降のカラムは次の行で表示されます。 170 170 171 * '''_column_''' -- '' Full row''. By adding an underscore ('_') both at the beginning and the end of a column name, the data will be shown on a separate row.171 * '''_column_''' -- ''全行表示''。 カラム名の前後にアンダースコア ('_') を付与した場合、そのカラムは続く行で全てのカラム幅を使って表示されます。 172 172 173 * '''_column''' -- '' Hide data''. Prepending an underscore ('_') to a column name instructs Trac to hide the contents from the HTML output. This is useful for information to be visible only if downloaded in other formats (like CSV or RSS/XML).173 * '''_column''' -- ''データを非表示にする''。 カラム名の語頭にアンダースコア ('_') を付与した場合、 HTML 出力では非表示になります。これは (CSV や RSS のような) 別フォーマットでのダウンロード時にだけ見たい情報であるときに使います。 174 174 175 ''' Example:''' ''List active tickets, grouped by milestone, colored by priority, with description and multi-line layout''175 '''例:''' ''アクティブなチケットを、マイルストーンでグループ化し、優先度で色付け、チケットの説明を multi-line レイアウトでリスト表示する'' 176 176 177 177 {{{ … … 181 181 WHEN 'daniel' THEN 'font-weight: bold; background: red;' 182 182 ELSE '' END) AS __style__, 183 t.id AS ticket, summary AS summary_, -- ## Break line here183 t.id AS ticket, summary AS summary_, -- ## ここで改行する 184 184 component,version, severity, milestone, status, owner, 185 time AS created, changetime AS modified, -- ## Dates are formatted186 description AS _description_, -- ## Uses a full row187 changetime AS _changetime, reporter AS _reporter -- ## H idden from HTML output185 time AS created, changetime AS modified, -- ## 日付形式で整形 186 description AS _description_, -- ## 全行を使用して表示 187 changetime AS _changetime, reporter AS _reporter -- ## HTML 出力では表示しない 188 188 FROM ticket t,enum p 189 189 WHERE t.status IN ('new', 'assigned', 'reopened') … … 194 194 195 195 ---- 196 See also: TracTickets, TracQuery, TracGuide196 参考: TracTickets, TracQuery, TracGuide