function html_tree($proj, $tree) { global $extEnscript; $t = git_ls_tree(get_repo_path($proj), $tree); echo "<div class=\"gitbrowse\">\n"; echo "<table>\n"; foreach ($t as $obj) { $plain = ""; $dlfile = ""; $icon = ""; $perm = perm_string($obj['perm']); if ($obj['type'] == 'tree') { $objlink = html_ahref(array('p' => $proj, 'a' => "jump_to_tag", 't' => $obj['hash'])) . $obj['file'] . "</a>\n"; $icon = "<img src=\"" . sanitized_url() . "dl=icon_folder\" style=\"border-width: 0px;\"/>"; } elseif ($obj['type'] == 'blob') { $plain = html_ahref(array('p' => $proj, 'dl' => "plain", 'h' => $obj['hash'], 'n' => $obj['file'])) . "plain</a>"; $dlfile = " | " . html_ahref(array('p' => $proj, 'dl' => "dlfile", 'h' => $obj['hash'], 'n' => $obj['file'])) . "file</a>"; $objlink = html_ahref(array('p' => $proj, 'a' => "jump_to_tag", 'b' => $obj['hash'], 'n' => $obj['file']), "blob") . $obj['file'] . "</a>\n"; $ext = @$extEnscript[strrchr($obj['file'], ".")]; if ($ext == "") { $icon = "<img src=\"" . sanitized_url() . "dl=icon_plain\" style=\"border-width: 0px;\"/>"; } else { $icon = "<img src=\"" . sanitized_url() . "dl=icon_color\" style=\"border-width: 0px;\"/>"; } } echo "<tr><td>{$perm}</td><td>{$icon}</td></td><td>{$objlink}</td><td>{$plain}{$dlfile}</td></tr>\n"; } echo "</table>\n"; echo "</div>\n"; }
function html_tree($proj, $cid, $filepath) { $str = ''; $t = git_ls_tree(get_repo_path($proj), $cid, $filepath); $str .= "<div class=\"gittree\">\n"; $str .= "<table>\n"; foreach ($t as $obj) { $plain = ""; $perm = perm_string($obj['perm']); $f = isset($filepath) ? "{$filepath}/{$obj['file']}" : $obj['file']; if ($obj['type'] == 'tree') { $objlink = html_ahref(array('p' => $proj, 'c' => $cid, 'f' => $f), $obj['file']); } else { if ($obj['type'] == 'blob') { $plain = html_ahref(array('p' => $proj, 'dl' => 'plain', 'c' => $cid, 'b' => $obj['hash']), 'plain'); $objlink = html_ahref(array('p' => $proj, 'c' => $cid, 'b' => $obj['hash'], 'f' => $f), $obj['file'], 'blob'); } } $str .= "<tr><td>{$perm}</td><td>{$objlink}</td><td>{$plain}</td></tr>\n"; } $str .= "</table>\n"; $str .= "</div>\n"; return $str; }