MTrack/SCMEvent.php
[web.mtrack] / MTrack / SCMEvent.php
1 <?php
2
3 require_once 'MTrack/Wiki.php';
4
5 class MTrackSCMEvent 
6 {
7     
8     public $repo;
9     /** Revision or changeset identifier for this particular file */
10     public $rev;
11
12     /** commit message associated with this revision */
13     public $changelog;
14
15     /** who committed this revision */
16     public $changeby;
17
18     /** when this revision was committed */
19     public $ctime;
20
21     /** files affected in this event; may be null, but otherwise
22     * will be an array of MTrackSCMFileEvent */
23     public $files;
24
25     
26     function changelogOneToHtml()
27     {
28         list($one) = explode("\n", $this->changelog);
29         return MTrack_Wiki::format_to_oneliner(rtrim($one, " \r\n"));
30     }
31     function changelogToHtml()
32     {
33        return MTrack_Wiki::format_to_html($this->changelog);
34     }
35     // get rid of this..
36     function changeByToHtml($linkHandler)
37     {
38         return $linkHandler->username($this->changeby, array('no_image' => true));
39         //mtrack_username($d->changeby, array('size' => 16)) <<< might add size here as an arg..   
40     }
41     function ctimeToHtml($linkHandler) 
42     {
43         return  $linkHandler->date($this->ctime);
44     }
45     function changeset($linkHandler)
46     {
47         return  $linkHandler->changeset($this->rev, $this->repo);
48     }
49     /**
50      * return the changeby as a RFC address..
51      */
52     function changebyToEmail()
53     {
54         require_once 'Mail/RFC822.php';
55         $m = new Mail_RFC822;
56         $addr = $m->parseAddressList($this->changeby);
57         return $addr['mailbox'].'@'.$add['host'];
58     }
59      
60 }