wiki:EpochFieldPlugin

Epoch (unix time) field, timezone sensitive

Notice: This plugin is deprecated in Trac milestone:1.1.1 and later. Equivalent functionality has been added to Trac in #1942.
see also ​trac:wiki:/TracDev/Proposals/TracTicketsCustomTimeFields

Description

Note: on this page descriptions in japanese-Kanji are added after slashes (/).

This plugin adds the following features: / 以下の二機能があります:

  1. Timezone sensitive date&time field. / 時差を考慮した時刻フィールド
  2. Date & time presentation in report. / 時差を考慮したレポート表示

Bugs/Feature Requests

Existing bugs and feature requests for EpochFieldPlugin are here.

If you have any issues, create a new ticket. / 不具合報告はこちらへ。

Download

Download the zipped source from here.

Source

You can check out EpochFieldPlugin from here using Subversion, or browse the source with Trac.

入手はzip, Subversion, Tracでどうぞ。

Installation

General instructions on installing Trac plugins can be found on the TracPlugins page.

Example / 例

Epoch field

Specify format=epoch for the custom-field in trac.ini as follows or use CustomFieldAdminPlugin: / trac.ini または CustomFieldAdminPlugin で、カスタムフィールドの format を epoch と指定します:

[ticket-custom]
due = text
due.format = epoch

This plugin uses jquery.datetimeentry.js. Ctrl-Home to current datetime. / Ctrl-Home で現在日時を入力できます。

Epoch report

In the trac.ini file specify the field-names you want to translate from epoch to datetime-string in regular-expressions as follows: / trac.ini で 日時表記したいカラム名を正規表現で指定して:

[epochfield]
date_columns = .*_date, .*日付?
datetime_columns = .*_datetime, .*日時
time_columns = .*_time, .*時刻

And, for example, create a report query as follows: / たとえば以下のようにSQLを書くと、

SELECT id, summary, ticket.time,
    a.time AS accepted_datetime,
    c.time AS closed_datetime,
    c.author AS Closer
FROM ticket
LEFT JOIN (
    SELECT ticket, author, newvalue AS status, MAX(time) AS time
        FROM ticket_change 
        WHERE field = 'status' AND newvalue = 'accepted'
        GROUP BY ticket, newvalue, author
) AS a ON (a.ticket = ticket.id AND a.status = 'accepted')
LEFT JOIN (
    SELECT ticket, author, newvalue AS status, MAX(time) AS time
        FROM ticket_change 
        WHERE field = 'status' AND newvalue = 'closed'
        GROUP BY ticket, newvalue, author
) AS c ON (c.ticket = ticket.id AND c.status = 'closed')

Then the epoch columns, such as the status change time in the example above, shows as datetime string. / 更新日時といった列を unixtime ではなく日付文字列で表示します。

Recent Changes

15659 by matobaa on 2016-07-11 14:21:25
EpochFieldPlugin: follows changeset:15474
15101 by matobaa on 2015-12-07 03:04:46
epochfieldPlugin: add "Epoch" Macro;
15088 by matobaa on 2015-12-01 15:00:54
EpochFieldPlugin: fix a bug that epoch format is not hold in custom field admin panel by CustomFieldAdminPlugin
(more)

Author/Contributors

Author: matobaa
Maintainer: matobaa
Contributors:

Last modified 5 years ago Last modified on Oct 23, 2019, 8:55:14 AM

Attachments (2)

Download all attachments as: .zip