Define the APIs to access remote trac project.
The APIs to manipulate Trac project from the WordPress plugin
Main Data Structures
Here are the main data structures we are using to present a Trac project on WordPress.
- Ticket Summary
Ticket summary is the brief information about a trac ticket. It has the following fields. The ticket reference the return value from XML-RPC call.
[Ticket Summary] id - ticket[0][0] created - ticket[0][1] modified - ticket[0][2] status - ticket[0][3]['status'] summary - ticket[0][3]['summary'] owner - ticket[0][3]['owner'] priority - ticket[0][3]['priority'] version - ticket[0][3]['version'] milestone - ticket[0][3]['milestone']
- Ticket Changelog and Comment
Any change for a ticket will be recorded in the change log. One change log is actually one field change log. One comment might have a set of fields change: comment, status, version, etc. All fields change will have one array with the following format. The value of time is the timestamp of a change, which will be used to find all changes in one comment. Event there is no content for a comment, the comment field change log will be created with a sequence id in oldvalue. A changelog has the following attributes:
[Ticket Changelog] time - changelog[0] author - changelog[1] field - changelog[2], the filed name: comment, status, milestone etc. oldvalue - changelog[3], it will be the comment id for comment field. newvalue - changelog[4], it will be the exact content for comment field. permanent - changelog[5]
Comments for a ticket will be organized by comment id. One comment will include all field changes and the exact comment content, if the content is exist.
- Ticket Attachments
- Attachment is actually stored as a comment.
- Ticket Details
The details information for a ticket. It will be the Ticket Summary plus the full list of Ticket Changelog:
[Ticket Details] id created modified summary owner priority milestone version description status comments commentId commentContent fields fieldName oldValue newValue
Query Interfaces
Query interfaces will offer easy way to get a signle ticket, a set of tickets, available ticket status, available ticket priorities, available sprints/versions, available milestones, etc.
- wptc_get_tickets($milestone, $version, $max=25, $page=1)
- return all tickets for the milestone and version.
- wptc_get_tickets_m($milestone, $version, $max=25, $page=1)
- The multicall implementation.
- wptc_get_tickets_amount($milestone, $version)
- return the totale number of tickets for the given milestone and version
- wptc_get_ticket($id)
- return all details of the ticket.
Some Samples
a attachment is saved as following:
[0]=> array(6) { [0]=> string(17) "20120309T14:27:15" [1]=> string(14) "seanchen" [2]=> string(10) "attachment" [3]=> string(0) "" [4]=> string(22) "iebug.png" [5]=> int(0) } [1]=> array(6) { [0]=> string(17) "20120309T14:27:15" [1]=> string(14) "seanchen" [2]=> string(7) "comment" [3]=> string(0) "desriptiong for the attachment." [4]=> string(0) "" [5]=> int(0) }