1 <?php # vim:ts=2:sw=2:et:
2 /* For licensing and copyright terms, see the file named LICENSE */
4 include '../inc/common.php';
5 MTrackACL::requireAllRights('Browser', 'read');
7 $pi = mtrack_get_pathinfo(true);
8 $crumbs = MTrackSCM::makeBreadcrumbs($pi);
9 if (!strlen($pi) || $pi == '/') {
13 $repo = MTrackSCM::factory($pi);
17 throw new Exception("Cannot determine what to log from $pi");
20 MTrackACL::requireAllRights("repo:$repo->repoid", 'read');
21 mtrack_head("Log $pi");
23 /* Render a bread-crumb enabled location indicator */
24 echo "<div class='browselocation'>Location: ";
26 if (isset($_GET['jump'])) {
27 $jump = '?jump=' . urlencode($_GET['jump']);
28 list($object, $ident) = explode(':', $_GET['jump'], 2);
35 $last = array_pop($crumbs);
36 foreach ($crumbs as $path) {
39 echo "<a href='{$ABSWEB}browse.php$jump'>$path</a> / ";
41 $location .= '/' . htmlentities(urlencode($path), ENT_QUOTES, 'utf-8');
42 echo "<a href='{$ABSWEB}log.php$location$jump'>$path</a> / ";
47 $branches = $repo->getBranches();
48 $tags = $repo->getTags();
49 if (count($branches) + count($tags)) {
50 $jumps = array("" => "- Select Branch / Tag - ");
51 if (is_array($branches)) {
52 foreach ($branches as $name => $notcare) {
53 $jumps["branch:$name"] = "Branch: $name";
56 if (is_array($tags)) {
57 foreach ($tags as $name => $notcare) {
58 $jumps["tag:$name"] = "Tag: $name";
62 echo mtrack_select_box("jump", $jumps, $_GET['jump']);
63 echo "<button type='submit'>Choose</button></form>\n";
69 $hist = $repo->history($pi, null, $object, $ident);
71 echo "<em>No history for the requested path</em>";
73 echo "<div class='changesets'>\n";
74 foreach ($hist as $ent) {
75 $class = ($even++ % 2) ? '' : 'odd';
77 $ts = strtotime($ent->ctime);
78 $day = date('D, M d Y', $ts);
79 $time = date('H:m', $ts);
81 if ($day !== $last_day) {
82 echo "<div class='changesetday'>$day</div>\n";
85 echo "<div class='changeset$class'>\n<div class='changelog'>";
86 echo MTrackWiki::format_to_html($ent->changelog);
89 echo "<div class='changeinfo'>\n";
90 echo mtrack_username($ent->changeby, array(
95 echo mtrack_changeset($ent->rev, $repo);
96 foreach ($ent->branches as $b) {
97 echo " " . mtrack_branch($b);
99 foreach ($ent->tags as $t) {
100 echo " " . mtrack_tag($t);
103 echo mtrack_username($ent->changeby, array('no_image' => true)) . "<br>\n";
104 echo "$time <span class='time'>" . mtrack_date($ent->ctime) . "</span>\n";
105 echo "</div></div>\n";