Generate the link used for various history views.
public static getHistoryViews ( string $where ) : array | ||
$where | string | The current file path. |
Résultat | array | An array of file view links. |
for ($row = sizeof($trunk) - 1; $row >= 0; $row--) { $grid[$row][0] = $trunk[$row]; _populateGrid($row, 0); } /* Sort the grid array into row order, and determine the maximum * column size that we need to render out in HTML. */ ksort($grid); $maxCol = 0; foreach ($grid as $cols) { krsort($cols); list($val) = each($cols); $maxCol = max($val, $maxCol); } $title = _("Source Branching View for:"); Chora::header($title); echo Chora::getHistoryViews($where)->render('history'); require CHORA_TEMPLATES . '/history/header.inc'; foreach ($grid as $row) { echo '<tr>'; /* Start traversing the grid of rows and columns. */ for ($i = 0; $i <= $maxCol; ++$i) { /* If this column has nothing in it, require a blank cell. */ if (!isset($row[$i])) { $bg = ''; require CHORA_TEMPLATES . '/history/blank.inc'; continue; } /* Otherwise, this cell has content; determine what it is. */ $rev = $row[$i]; // if ($VC->isValidRevision($rev) && ($VC->sizeof($rev) % 2)) { if ($VC->isValidRevision($rev)) {
if (!isset($title)) { $title = _("Commits to:"); } } try { $ps = $VC->getPatchset($ps_opts); $patchsets = $ps->getPatchsets(); } catch (Horde_Vcs_Exception $e) { Chora::fatal($e); } if (empty($patchsets)) { Chora::fatal(_("Commit Not Found"), '404 Not Found'); } $page_output->addScriptFile('tables.js', 'horde'); $page_output->addScriptFile('quickfinder.js', 'horde'); Chora::header($title); echo Chora::getHistoryViews($where)->render('patchsets'); require CHORA_TEMPLATES . '/patchsets/header_table.inc'; $diff_img = Horde::img('diff.png', _("Diff")); reset($patchsets); while (list($id, $patchset) = each($patchsets)) { $patchset_link = Chora::url('commit', $where, array('commit' => $id))->link(array('title' => $id)) . htmlspecialchars($VC->abbrev($id)) . '</a>'; $commitDate = Chora::formatDate($patchset['date']); $readableDate = Chora::readableTime($patchset['date'], true); $author = Chora::showAuthorName($patchset['author'], true); $logMessage = Chora::formatLogMessage($patchset['log']); $tags = array_merge($patchset['branch'], $patchset['tags']); require CHORA_TEMPLATES . '/patchsets/ps.inc'; } require CHORA_TEMPLATES . '/patchsets/footer.inc'; $page_output->footer();
/** * Stats script. * * Copyright 2000-2015 Horde LLC (http://www.horde.org/) * * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.horde.org/licenses/gpl. * * @author Anil Madhavapeddy <*****@*****.**> * @package Chora */ require_once __DIR__ . '/lib/Application.php'; Horde_Registry::appInit('chora'); /* Spawn the file object. */ try { $fl = $VC->getFile($where); } catch (Horde_Vcs_Exception $e) { Chora::fatal($e); } $stats = array(); foreach ($fl->getLog() as $lg) { $qa = $lg->getAuthor(); $stats[$qa] = isset($stats[$qa]) ? $stats[$qa] + 1 : 1; } arsort($stats); $title = _("Statistics for:"); $page_output->addScriptFile('tables.js', 'horde'); Chora::header($title); echo Chora::getHistoryViews($where)->render('stats'); require CHORA_TEMPLATES . '/stats/stats.inc'; $page_output->footer();
$title = _("Logs for:"); $logs = $fl->getLog(); $first = end($logs); $diffValueLeft = $first->getRevision(); $diffValueRight = $fl->getRevision(); $sel = ''; foreach ($fl->getTags() as $sm => $rv) { $sel .= '<option value="' . $rv . '">' . $sm . '</option>'; } $branches = array(); if ($VC->hasFeature('branches')) { $branches = $fl->getBranches(); } $page_output->addScriptFile('revlog.js'); Chora::header($title); echo Chora::getHistoryViews($where)->render('browsefile'); require CHORA_TEMPLATES . '/log/header.inc'; $view = $injector->createInstance('Horde_View'); $currentDay = null; echo '<div class="commit-list">'; reset($logs); foreach ($logs as $log) { $day = date('Y-m-d', $log->getDate()); if ($day != $currentDay) { echo '<h3>' . $day . '</h3>'; $currentDay = $day; } echo $view->renderPartial('app/views/logMessage', array('object' => $log->toHash())); } echo '</div>'; $page_output->footer();
foreach ($args as $key => $val) { $argstr .= "-{$key} \"{$val}\" "; } } else { foreach ($args as $key => $val) { $argstr .= "-{$key} '{$val}' "; } } header('Content-Type: image/png'); passthru($conf['paths']['cvsgraph'] . ' ' . $argstr . ' ' . $file); exit; } // Display the wrapper page for the image. $title = _("Graph for:"); Chora::header($title); echo Chora::getHistoryViews($where)->render('cvsgraph'); $imgUrl = Chora::url('cvsgraph', $where, array('show_image' => 1)); $args = array('c' => $conf['paths']['cvsgraph_conf'], 'M' => 'graphMap', 'r' => $root, '0' => '&', '1' => Chora::url('browsefile', $where, array('dummy' => 'true')), '2' => Chora::url('diff', $where, array('dummy' => 'true')), '3' => Chora::url('co', $where, array('dummy' => 'true'))); // Build up the argument string. $argstr = ''; if (!strncasecmp(PHP_OS, 'WIN', 3)) { foreach ($args as $key => $val) { $argstr .= "-{$key} \"{$val}\" "; } } else { foreach ($args as $key => $val) { $argstr .= "-{$key} '{$val}' "; } } // Generate the imagemap. $map = shell_exec($conf['paths']['cvsgraph'] . ' ' . $argstr . ' -i ' . $file);