php7
[web.mtrack] / MTrackWeb / Browse.php
index c350149..2521821 100644 (file)
@@ -49,7 +49,7 @@ class MTrackWeb_Browse extends MTrackWeb
   
     }
  
-    function get($pi)
+    function get($pi='', $args = array())
     {
         $this->pi =  $pi . (strlen($pi) ? $this->bootLoader->ext : '');
        
@@ -68,6 +68,11 @@ class MTrackWeb_Browse extends MTrackWeb
         if (!$this->repo->id) {
             $this->repo = false;
         }
+        // if we have an active project.. enforce it..
+        if ($this->currentProject() && $this->repo &&  $this->repo->project_id != $this->currentProject()) {
+            $this->repo =  false; // no repo..
+        }
+        
         
         $this->object = null;
         $this->ident = null;
@@ -253,6 +258,10 @@ class MTrackWeb_Browse extends MTrackWeb
         } else {
             $do->orderBy("shortname ASC");
         }
+        
+        if ($this->currentProject()) {
+            $do->project_id = $this->currentProject();
+        }
 // FIXME -> permissions on repositories goes here.. 
         //$do->ensurePerm($this->authUser); 
         //$do->fetchAll();
@@ -358,7 +367,7 @@ class MTrackWeb_Browse extends MTrackWeb
         foreach($ar as $e) {
             $e->basename = basename($e->name);
             // remove e->rev as it's not valid..
-            $e->rev = '....';
+            $e->rev = false;
             $map[$e->hash] = $e;
             
         }
@@ -371,10 +380,14 @@ class MTrackWeb_Browse extends MTrackWeb
         
         foreach($revs as $hash => $sobject) {
             $event = $impl->commitLogToEvent($sobject);
-            // add something???
+            // add something??? 
+            if (!$event) {
+                continue;
+            }
             $event->is_dir = $map[$hash]->is_dir;
             $event->name = $map[$hash]->name;
             $event->basename = $map[$hash]->basename;
+        
             $map[$hash] =  $event; // this was previous only done for directories??? why???
         }
         return array_values($map);
@@ -420,7 +433,15 @@ class MTrackWeb_Browse extends MTrackWeb
             $add->age = $event->ctimeToHtml($this->link);
             $add->basename = basename($e->name);
             $add->changeby = htmlspecialchars($event->changeby); 
-            $add->rev = $event->rev; 
+            $add->rev = '<a class="changesetlink browse-link"  href="'. 
+                        htmlspecialchars($this->baseURL) .
+                        '/Changeset/' .
+                        htmlspecialchars($this->repo->displayName()). 
+                        '/'.
+                        htmlspecialchars($event->rev) .
+                        '">'.
+                        htmlspecialchars($event->rev) .
+                        '</a>';
             
             $map[$e->hash] = $add;