masterTemplate = 'log.html'; $this->pi = empty($pi) ? '' : ($pi . $this->bootLoader->ext); $this->repo = DB_DataObject::factory('mtrack_repos'); $this->filename = $this->repo->loadFromPath($this->pi); if (!$this->repo->id) { return HTML_FlexyFramework::run('Browse'); }; if (!$this->projectPerm($this->repo->project_id, 'MTrack.Repos', 'S')) { return HTML_FlexyFramework::run('Noperm'); // noperm = loggedin -> need more perms / not.. try loggin in.. } $this->branches = $this->repo->getBranches(); $this->title = "Log $this->filename"; $this->branches = $this->repo->getBranches(); $this->crumbs = array(); $location = ''; $this->basename = basename($this->filename); $crumbs = dirname($this->filename) == '.' || !strlen(dirname($this->filename)) ? array() : explode('/', dirname($this->filename)); foreach($crumbs as $path) { $c = new StdClass; $c->name = strlen($path) ? $path : '[root]'; $c->root = strlen($path) ? 0 : 1; $location .= strlen($location) ? '/' : ''; $location .= strlen($path) ? urlencode($path) : ''; $c->location = $location; $this->crumbs[] = $c; } $branches = $this->repo->getBranches(); $tags = $this->repo->getTags(); if (count($branches) + count($tags)) { $this->showJump = 1; $jumps = array("" => "- Select Branch / Tag - "); if (is_array($branches)) { foreach ($branches as $name => $notcare) { $jumps["branch:$name"] = "Branch: $name"; } } if (is_array($tags)) { foreach ($tags as $name => $notcare) { $jumps["tag:$name"] = "Tag: $name"; } } $this->elements['jump'] = new HTML_Template_Flexy_Element('select'); $this->elements['jump']->setOptions($jumps); $this->elements['jump']->setValue(empty($_GET['jump']) ? '' : $_GET['jump']); } $object = null; $ident = null; if (!empty($_GET['jump'])) { list($object, $ident) = explode(':', $_GET['jump'], 2); } $last_day = null; $even = 1; $offset= empty($_GET['offset']) ? 0 : (int) $_GET['offset']; $this->offset = $offset+100; $hist = $this->repo->history($this->filename, array($offset,100), $object, $ident); if (empty($hist)) { return; // an error conditon!?! } $this->rev = $hist[0]->rev; if (count($hist) < 100) { $this->offset = 0; } // code here... // repo has a 'release' branch, this should be used to track what needs // merging from 'HEAD' to update it // (basically how far behind is the release from head..) // $need_review = ' style="background-color:#fdd;"'; // $good_to_go = ' style="background-color:#585;"'; // $live = ' style="background-color:#336;"'; //$is_live = false; $this->hist= array(); foreach($hist as $i=>$h) { $h->cls = $i % 2 ? 'odd' : ''; $ts = strtotime($h->ctime); $day = date('D, M d Y', $ts); $time = date('g:ia', $ts); //print_r($ent); if ($day !== $last_day) { $this->hist[] = (object) array( 'isday' => 1, 'day' => $day ); } $h->time = $time; $last_day = $day; $M = array(); // if (preg_match('/#([0-9]+)\s+/', $h->changelog, $M)) { // $h->ticket = MTrackIssue::loadByNSIdent($M[1]) ; // ticket->status == closed == ok to commit to another branch... // echo '
'; print_r($h->ticket);
           // }
            
             
       
    
            $this->hist[] = $h;
        }
    }
        
}