1 <?php # vim:ts=2:sw=2:et:
2 /* For licensing and copyright terms, see the file named LICENSE */
4 require_once 'MTrackWeb.php';
6 class MTrackWeb_Log extends MTrackWeb
8 var $template = 'log.html';
13 MTrackACL::requireAllRights('Browser', 'read');
20 if (!empty($_REQUEST['embed'])) {
21 $this->masterTemplate=$this->template;
24 $this->pi = empty($pi) ? '' : ($pi . $this->bootLoader->ext);
26 $this->repo = DB_DataObject::factory('repos');
27 $this->filename = $this->repo->loadFromPath($this->pi);
31 return HTML_FlexyFramework::run('Browse');
36 $this->branches = $this->repo->getBranches();
38 MTrackACL::requireAllRights("repo:{$this->repo->repoid}", 'read');
41 $this->title = "Log $file";
43 $this->branches = $this->repo->getBranches();
46 $this->crumbs = array();
48 foreach($crumbs as $path)
50 //if (count($this->crumbs) && !strlen($path)) {
54 $c->name = strlen($path) ? $path : '[root]';
55 $c->root = strlen($path) ? 0 : 1;
56 $location .= strlen($location) ? '/' : '';
57 $location .= strlen($path) ? urlencode($path) : '';
58 $c->location = $location;
62 $branches = $this->repo->getBranches();
63 $tags = $this->repo->getTags();
64 if (count($branches) + count($tags)) {
66 $jumps = array("" => "- Select Branch / Tag - ");
67 if (is_array($branches)) {
68 foreach ($branches as $name => $notcare) {
69 $jumps["branch:$name"] = "Branch: $name";
72 if (is_array($tags)) {
73 foreach ($tags as $name => $notcare) {
74 $jumps["tag:$name"] = "Tag: $name";
78 $this->elements['jump'] = new HTML_Template_Flexy_Element('select');
79 $this->elements['jump']->setOptions($jumps);
80 $this->elements['jump']->setValue(empty($_GET['jump']) ? '' : $_GET['jump']);
84 if (!empty($_GET['jump'])) {
85 list($object, $ident) = explode(':', $_GET['jump'], 2);
91 $hist = $this->repo->history($pi, 100, $object, $ident);
98 // repo has a 'release' branch, this should be used to track what needs
99 // merging from 'HEAD' to update it
100 // (basically how far behind is the release from head..)
102 // $need_review = ' style="background-color:#fdd;"';
103 // $good_to_go = ' style="background-color:#585;"';
104 // $live = ' style="background-color:#336;"';
107 $this->hist= array();
108 foreach($hist as $i=>$h) {
109 $h->cls = $i % 2 ? 'odd' : '';
111 $ts = strtotime($h->ctime);
112 $day = date('D, M d Y', $ts);
113 $time = date('g:ia', $ts);
115 if ($day !== $last_day) {
116 $this->hist[] = (object) array(
125 if (preg_match('/#([0-9]+)\s+/', $h->changelog, $M)) {
127 $h->ticket = MTrackIssue::loadByNSIdent($M[1]) ;
128 // ticket->status == closed == ok to commit to another branch...
129 // echo '<PRE>'; print_r($h->ticket);