2011-03-08 02:25:47 +01:00
|
|
|
<?php
|
|
|
|
|
2012-03-10 00:46:25 +01:00
|
|
|
final class DiffusionBrowseController extends DiffusionController {
|
2011-03-08 02:25:47 +01:00
|
|
|
|
|
|
|
public function processRequest() {
|
2011-03-08 23:29:02 +01:00
|
|
|
$drequest = $this->diffusionRequest;
|
2013-04-23 20:12:02 +02:00
|
|
|
$is_file = false;
|
2011-03-08 02:25:47 +01:00
|
|
|
|
2012-12-14 23:07:39 +01:00
|
|
|
if ($this->getRequest()->getStr('before')) {
|
|
|
|
$is_file = true;
|
2013-04-23 20:12:02 +02:00
|
|
|
} else if ($this->getRequest()->getStr('grep') == '') {
|
Diffusion - move DiffusionBrowseQuery => Conduit
Summary: see title. Ref T2784.
Test Plan:
In diffusion, for each of SVN, Mercurial, and Git, I loaded up /diffusion/CALLSIGN/. I verified the README was displayed and things looked good. Next I clicked on "browse" on the top-most commit and verified things looked correct. Also clicked through to a file for a good measure and things looked good.
In owners, for each of SVN, Mercurial, and Git, I played around with the path typeahead / validator. It worked correctly!
Reviewers: epriestley
Reviewed By: epriestley
CC: chad, aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5883
2013-05-10 20:02:58 +02:00
|
|
|
$results = DiffusionBrowseResultSet::newFromConduit(
|
|
|
|
$this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.browsequery',
|
|
|
|
array(
|
|
|
|
'path' => $drequest->getPath(),
|
|
|
|
'commit' => $drequest->getCommit(),
|
|
|
|
)));
|
|
|
|
$reason = $results->getReasonForEmptyResultSet();
|
|
|
|
$is_file = ($reason == DiffusionBrowseResultSet::REASON_IS_FILE);
|
2012-12-14 23:07:39 +01:00
|
|
|
}
|
2011-03-08 02:25:47 +01:00
|
|
|
|
2013-04-23 20:12:02 +02:00
|
|
|
if ($is_file) {
|
|
|
|
$controller = new DiffusionBrowseFileController($this->getRequest());
|
|
|
|
$controller->setDiffusionRequest($drequest);
|
|
|
|
$controller->setCurrentApplication($this->getCurrentApplication());
|
|
|
|
return $this->delegateToController($controller);
|
|
|
|
}
|
|
|
|
|
2011-03-08 03:21:43 +01:00
|
|
|
$content = array();
|
|
|
|
|
2013-09-19 20:57:33 +02:00
|
|
|
$content[] = $this->buildHeaderView($drequest);
|
|
|
|
$content[] = $this->buildActionView($drequest);
|
|
|
|
$content[] = $this->buildPropertyView($drequest);
|
2012-04-24 03:36:25 +02:00
|
|
|
|
2013-04-23 20:12:02 +02:00
|
|
|
$content[] = $this->renderSearchForm();
|
2011-03-08 03:21:43 +01:00
|
|
|
|
2013-04-23 20:12:02 +02:00
|
|
|
if ($this->getRequest()->getStr('grep') != '') {
|
|
|
|
$content[] = $this->renderSearchResults();
|
2011-03-08 02:25:47 +01:00
|
|
|
} else {
|
Diffusion - move DiffusionBrowseQuery => Conduit
Summary: see title. Ref T2784.
Test Plan:
In diffusion, for each of SVN, Mercurial, and Git, I loaded up /diffusion/CALLSIGN/. I verified the README was displayed and things looked good. Next I clicked on "browse" on the top-most commit and verified things looked correct. Also clicked through to a file for a good measure and things looked good.
In owners, for each of SVN, Mercurial, and Git, I played around with the path typeahead / validator. It worked correctly!
Reviewers: epriestley
Reviewed By: epriestley
CC: chad, aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5883
2013-05-10 20:02:58 +02:00
|
|
|
if (!$results->isValidResults()) {
|
2013-04-23 20:12:02 +02:00
|
|
|
$empty_result = new DiffusionEmptyResultView();
|
|
|
|
$empty_result->setDiffusionRequest($drequest);
|
Diffusion - move DiffusionBrowseQuery => Conduit
Summary: see title. Ref T2784.
Test Plan:
In diffusion, for each of SVN, Mercurial, and Git, I loaded up /diffusion/CALLSIGN/. I verified the README was displayed and things looked good. Next I clicked on "browse" on the top-most commit and verified things looked correct. Also clicked through to a file for a good measure and things looked good.
In owners, for each of SVN, Mercurial, and Git, I played around with the path typeahead / validator. It worked correctly!
Reviewers: epriestley
Reviewed By: epriestley
CC: chad, aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5883
2013-05-10 20:02:58 +02:00
|
|
|
$empty_result->setDiffusionBrowseResultSet($results);
|
2013-04-23 20:12:02 +02:00
|
|
|
$empty_result->setView($this->getRequest()->getStr('view'));
|
|
|
|
$content[] = $empty_result;
|
|
|
|
} else {
|
|
|
|
$phids = array();
|
Diffusion - move DiffusionBrowseQuery => Conduit
Summary: see title. Ref T2784.
Test Plan:
In diffusion, for each of SVN, Mercurial, and Git, I loaded up /diffusion/CALLSIGN/. I verified the README was displayed and things looked good. Next I clicked on "browse" on the top-most commit and verified things looked correct. Also clicked through to a file for a good measure and things looked good.
In owners, for each of SVN, Mercurial, and Git, I played around with the path typeahead / validator. It worked correctly!
Reviewers: epriestley
Reviewed By: epriestley
CC: chad, aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5883
2013-05-10 20:02:58 +02:00
|
|
|
foreach ($results->getPaths() as $result) {
|
2013-04-23 20:12:02 +02:00
|
|
|
$data = $result->getLastCommitData();
|
|
|
|
if ($data) {
|
|
|
|
if ($data->getCommitDetail('authorPHID')) {
|
|
|
|
$phids[$data->getCommitDetail('authorPHID')] = true;
|
|
|
|
}
|
2011-04-03 01:44:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-23 20:12:02 +02:00
|
|
|
$phids = array_keys($phids);
|
|
|
|
$handles = $this->loadViewerHandles($phids);
|
2011-04-03 01:44:19 +02:00
|
|
|
|
2013-04-23 20:12:02 +02:00
|
|
|
$browse_table = new DiffusionBrowseTableView();
|
|
|
|
$browse_table->setDiffusionRequest($drequest);
|
|
|
|
$browse_table->setHandles($handles);
|
Diffusion - move DiffusionBrowseQuery => Conduit
Summary: see title. Ref T2784.
Test Plan:
In diffusion, for each of SVN, Mercurial, and Git, I loaded up /diffusion/CALLSIGN/. I verified the README was displayed and things looked good. Next I clicked on "browse" on the top-most commit and verified things looked correct. Also clicked through to a file for a good measure and things looked good.
In owners, for each of SVN, Mercurial, and Git, I played around with the path typeahead / validator. It worked correctly!
Reviewers: epriestley
Reviewed By: epriestley
CC: chad, aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5883
2013-05-10 20:02:58 +02:00
|
|
|
$browse_table->setPaths($results->getPaths());
|
2013-04-23 20:12:02 +02:00
|
|
|
$browse_table->setUser($this->getRequest()->getUser());
|
2011-03-08 02:25:47 +01:00
|
|
|
|
2013-04-23 20:12:02 +02:00
|
|
|
$browse_panel = new AphrontPanelView();
|
|
|
|
$browse_panel->appendChild($browse_table);
|
|
|
|
$browse_panel->setNoBackground();
|
2011-03-08 02:25:47 +01:00
|
|
|
|
2013-04-23 20:12:02 +02:00
|
|
|
$content[] = $browse_panel;
|
|
|
|
}
|
2011-03-08 02:25:47 +01:00
|
|
|
|
2013-04-23 20:12:02 +02:00
|
|
|
$content[] = $this->buildOpenRevisions();
|
2011-10-02 21:52:54 +02:00
|
|
|
|
2013-05-21 22:47:06 +02:00
|
|
|
$readme = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.readmequery',
|
|
|
|
array(
|
2013-08-13 19:11:15 +02:00
|
|
|
'paths' => $results->getPathDicts(),
|
2013-05-21 22:47:06 +02:00
|
|
|
));
|
2013-05-11 17:23:19 +02:00
|
|
|
if ($readme) {
|
|
|
|
$box = new PHUIBoxView();
|
|
|
|
$box->setShadow(true);
|
|
|
|
$box->appendChild($readme);
|
|
|
|
$box->addPadding(PHUI::PADDING_LARGE);
|
2013-07-03 19:10:07 +02:00
|
|
|
$box->addMargin(PHUI::MARGIN_LARGE);
|
2012-04-30 16:47:41 +02:00
|
|
|
|
2013-09-17 18:12:37 +02:00
|
|
|
$header = id(new PHUIHeaderView())
|
2013-07-03 19:10:07 +02:00
|
|
|
->setHeader(pht('README'));
|
2013-05-11 17:23:19 +02:00
|
|
|
|
2013-07-03 19:10:07 +02:00
|
|
|
$content[] = array(
|
|
|
|
$header,
|
|
|
|
$box,
|
|
|
|
);
|
2013-04-23 20:12:02 +02:00
|
|
|
}
|
2012-04-30 16:47:41 +02:00
|
|
|
}
|
|
|
|
|
upgrade diffusion to use modern header UI and fix a few quirks
Summary:
upgrades are CrumbsView, HeaderView, PropertyListView, and ActionListView. I had to modify CrumbsView stuff a bit to handle the "advanced" diffusion crumbs.
Quirks fixed include making file tree view show up in diffusion, the page not have extra space when the file tree is hidden, links no longer breaking once you visit files (since without the change the files always got "/" appended and thus 404'd), and a differential quirk where it read "next step:" and that colon is a no no,
Test Plan: played around in diffusion and differential
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin, chad
Maniphest Tasks: T2048, T2178
Differential Revision: https://secure.phabricator.com/D4169
2012-12-13 02:50:42 +01:00
|
|
|
$crumbs = $this->buildCrumbs(
|
|
|
|
array(
|
|
|
|
'branch' => true,
|
|
|
|
'path' => true,
|
|
|
|
'view' => 'browse',
|
|
|
|
));
|
2013-09-19 20:57:33 +02:00
|
|
|
|
upgrade diffusion to use modern header UI and fix a few quirks
Summary:
upgrades are CrumbsView, HeaderView, PropertyListView, and ActionListView. I had to modify CrumbsView stuff a bit to handle the "advanced" diffusion crumbs.
Quirks fixed include making file tree view show up in diffusion, the page not have extra space when the file tree is hidden, links no longer breaking once you visit files (since without the change the files always got "/" appended and thus 404'd), and a differential quirk where it read "next step:" and that colon is a no no,
Test Plan: played around in diffusion and differential
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin, chad
Maniphest Tasks: T2048, T2178
Differential Revision: https://secure.phabricator.com/D4169
2012-12-13 02:50:42 +01:00
|
|
|
return $this->buildApplicationPage(
|
2013-09-19 20:57:33 +02:00
|
|
|
array(
|
|
|
|
$crumbs,
|
|
|
|
$content,
|
|
|
|
),
|
2011-03-08 02:25:47 +01:00
|
|
|
array(
|
2013-05-11 17:23:19 +02:00
|
|
|
'device' => true,
|
2012-04-24 03:36:25 +02:00
|
|
|
'title' => array(
|
|
|
|
nonempty(basename($drequest->getPath()), '/'),
|
|
|
|
$drequest->getRepository()->getCallsign().' Repository',
|
|
|
|
),
|
2011-03-08 02:25:47 +01:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2013-04-23 20:12:02 +02:00
|
|
|
|
|
|
|
private function renderSearchForm() {
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$form = id(new AphrontFormView())
|
|
|
|
->setUser($this->getRequest()->getUser())
|
2013-08-26 20:53:11 +02:00
|
|
|
->setMethod('GET');
|
2013-04-23 20:12:02 +02:00
|
|
|
|
|
|
|
switch ($drequest->getRepository()->getVersionControlSystem()) {
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
|
|
|
$form->appendChild(pht('Search is not available in Subversion.'));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
$form
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTextControl())
|
|
|
|
->setLabel(pht('Search Here'))
|
|
|
|
->setName('grep')
|
|
|
|
->setValue($this->getRequest()->getStr('grep'))
|
2013-09-19 20:57:33 +02:00
|
|
|
->setCaption(pht('Enter a regular expression.')))
|
2013-04-23 20:12:02 +02:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormSubmitControl())
|
2013-09-19 20:57:33 +02:00
|
|
|
->setValue(pht('Search File Content')));
|
2013-04-23 20:12:02 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-05-11 17:23:19 +02:00
|
|
|
$filter = new AphrontListFilterView();
|
|
|
|
$filter->appendChild($form);
|
|
|
|
|
2013-09-19 20:57:33 +02:00
|
|
|
if (!strlen($this->getRequest()->getStr('grep'))) {
|
|
|
|
$filter->setCollapsed(
|
|
|
|
pht('Show Search'),
|
|
|
|
pht('Hide Search'),
|
|
|
|
pht('Search for file content in this directory.'),
|
|
|
|
'#');
|
|
|
|
}
|
|
|
|
|
2013-05-11 17:23:19 +02:00
|
|
|
return $filter;
|
2013-04-23 20:12:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private function renderSearchResults() {
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
$results = array();
|
|
|
|
$no_data = pht('No results found.');
|
|
|
|
|
|
|
|
$limit = 100;
|
|
|
|
$page = $this->getRequest()->getInt('page', 0);
|
|
|
|
$pager = new AphrontPagerView();
|
|
|
|
$pager->setPageSize($limit);
|
|
|
|
$pager->setOffset($page);
|
|
|
|
$pager->setURI($this->getRequest()->getRequestURI(), 'page');
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
2013-05-17 23:11:20 +02:00
|
|
|
$results = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.searchquery',
|
|
|
|
array(
|
|
|
|
'grep' => $this->getRequest()->getStr('grep'),
|
|
|
|
'stableCommitName' => $drequest->getStableCommitName(),
|
|
|
|
'path' => $drequest->getPath(),
|
|
|
|
'limit' => $limit + 1,
|
|
|
|
'offset' => $page));
|
|
|
|
|
|
|
|
} catch (ConduitException $ex) {
|
|
|
|
$err = $ex->getErrorDescription();
|
|
|
|
if ($err != '') {
|
2013-04-25 02:10:39 +02:00
|
|
|
return id(new AphrontErrorView())
|
|
|
|
->setTitle(pht('Search Error'))
|
2013-05-17 23:11:20 +02:00
|
|
|
->appendChild($err);
|
2013-04-25 02:10:39 +02:00
|
|
|
}
|
2013-04-23 20:12:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$results = $pager->sliceResults($results);
|
|
|
|
|
|
|
|
require_celerity_resource('syntax-highlighting-css');
|
|
|
|
|
|
|
|
// NOTE: This can be wrong because we may find the string inside the
|
|
|
|
// comment. But it's correct in most cases and highlighting the whole file
|
|
|
|
// would be too expensive.
|
|
|
|
$futures = array();
|
|
|
|
$engine = PhabricatorSyntaxHighlighter::newEngine();
|
|
|
|
foreach ($results as $result) {
|
|
|
|
list($path, $line, $string) = $result;
|
|
|
|
$futures["{$path}:{$line}"] = $engine->getHighlightFuture(
|
|
|
|
$engine->getLanguageFromFilename($path),
|
|
|
|
ltrim($string));
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
Futures($futures)->limit(8)->resolveAll();
|
|
|
|
} catch (PhutilSyntaxHighlighterException $ex) {
|
|
|
|
}
|
|
|
|
|
|
|
|
$rows = array();
|
|
|
|
foreach ($results as $result) {
|
|
|
|
list($path, $line, $string) = $result;
|
|
|
|
|
|
|
|
$href = $drequest->generateURI(array(
|
|
|
|
'action' => 'browse',
|
|
|
|
'path' => $path,
|
|
|
|
'line' => $line,
|
|
|
|
));
|
|
|
|
|
|
|
|
try {
|
|
|
|
$string = $futures["{$path}:{$line}"]->resolve();
|
|
|
|
} catch (PhutilSyntaxHighlighterException $ex) {
|
|
|
|
}
|
|
|
|
|
|
|
|
$string = phutil_tag(
|
|
|
|
'pre',
|
|
|
|
array('class' => 'PhabricatorMonospaced'),
|
|
|
|
$string);
|
|
|
|
|
|
|
|
$path = Filesystem::readablePath($path, $drequest->getPath());
|
|
|
|
|
|
|
|
$rows[] = array(
|
|
|
|
phutil_tag('a', array('href' => $href), $path),
|
|
|
|
$line,
|
|
|
|
$string,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$table = id(new AphrontTableView($rows))
|
|
|
|
->setClassName('remarkup-code')
|
|
|
|
->setHeaders(array(pht('Path'), pht('Line'), pht('String')))
|
|
|
|
->setColumnClasses(array('', 'n', 'wide'))
|
|
|
|
->setNoDataString($no_data);
|
|
|
|
|
|
|
|
return id(new AphrontPanelView())
|
2013-09-19 20:57:33 +02:00
|
|
|
->setNoBackground(true)
|
2013-04-23 20:12:02 +02:00
|
|
|
->appendChild($table)
|
|
|
|
->appendChild($pager);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-04-24 03:36:25 +02:00
|
|
|
private function markupText($text) {
|
|
|
|
$engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine();
|
2013-03-04 21:33:05 +01:00
|
|
|
$engine->setConfig('viewer', $this->getRequest()->getUser());
|
2013-02-13 23:50:15 +01:00
|
|
|
$text = $engine->markupText($text);
|
2012-04-24 03:36:25 +02:00
|
|
|
|
2013-01-18 09:32:58 +01:00
|
|
|
$text = phutil_tag(
|
2012-04-24 03:36:25 +02:00
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'phabricator-remarkup',
|
|
|
|
),
|
|
|
|
$text);
|
|
|
|
|
|
|
|
return $text;
|
|
|
|
}
|
|
|
|
|
2013-09-19 20:57:33 +02:00
|
|
|
private function buildHeaderView(DiffusionRequest $drequest) {
|
|
|
|
$viewer = $this->getRequest()->getUser();
|
|
|
|
|
|
|
|
$header = id(new PHUIHeaderView())
|
|
|
|
->setUser($viewer)
|
|
|
|
->setHeader($this->renderPathLinks($drequest))
|
|
|
|
->setPolicyObject($drequest->getRepository());
|
|
|
|
|
|
|
|
return $header;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function buildActionView(DiffusionRequest $drequest) {
|
|
|
|
$viewer = $this->getRequest()->getUser();
|
|
|
|
|
|
|
|
$view = id(new PhabricatorActionListView())
|
|
|
|
->setUser($viewer);
|
|
|
|
|
|
|
|
$history_uri = $drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'action' => 'history',
|
|
|
|
));
|
|
|
|
|
|
|
|
$view->addAction(
|
|
|
|
id(new PhabricatorActionView())
|
|
|
|
->setName(pht('View History'))
|
|
|
|
->setHref($history_uri)
|
|
|
|
->setIcon('perflab'));
|
|
|
|
|
|
|
|
$behind_head = $drequest->getRawCommit();
|
|
|
|
$head_uri = $drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'commit' => '',
|
|
|
|
'action' => 'browse',
|
|
|
|
));
|
|
|
|
$view->addAction(
|
|
|
|
id(new PhabricatorActionView())
|
|
|
|
->setName(pht('Jump to HEAD'))
|
|
|
|
->setHref($head_uri)
|
|
|
|
->setIcon('home')
|
|
|
|
->setDisabled(!$behind_head));
|
|
|
|
|
|
|
|
// TODO: Ideally, this should live in Owners and be event-triggered, but
|
|
|
|
// there's no reasonable object for it to react to right now.
|
|
|
|
|
|
|
|
$owners_uri = id(new PhutilURI('/owners/view/search/'))
|
|
|
|
->setQueryParams(
|
|
|
|
array(
|
|
|
|
'repository' => $drequest->getCallsign(),
|
|
|
|
'path' => '/'.$drequest->getPath(),
|
|
|
|
));
|
|
|
|
|
|
|
|
$view->addAction(
|
|
|
|
id(new PhabricatorActionView())
|
|
|
|
->setName(pht('Find Owners'))
|
|
|
|
->setHref((string)$owners_uri)
|
|
|
|
->setIcon('preview'));
|
|
|
|
|
|
|
|
return $view;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function buildPropertyView(DiffusionRequest $drequest) {
|
|
|
|
$viewer = $this->getRequest()->getUser();
|
|
|
|
|
|
|
|
$view = id(new PhabricatorPropertyListView())
|
|
|
|
->setUser($viewer);
|
|
|
|
|
|
|
|
$stable_commit = $drequest->getStableCommitName();
|
|
|
|
$callsign = $drequest->getRepository()->getCallsign();
|
|
|
|
|
|
|
|
$view->addProperty(
|
|
|
|
pht('Commit'),
|
|
|
|
phutil_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => $drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'action' => 'commit',
|
|
|
|
'commit' => $stable_commit,
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
$drequest->getRepository()->formatCommitName($stable_commit)));
|
|
|
|
|
|
|
|
if ($drequest->getTagContent()) {
|
|
|
|
$view->addProperty(
|
|
|
|
pht('Tag'),
|
|
|
|
$drequest->getSymbolicCommit());
|
|
|
|
|
|
|
|
$view->addSectionHeader(pht('Tag Content'));
|
|
|
|
$view->addTextContent($this->markupText($drequest->getTagContent()));
|
|
|
|
}
|
|
|
|
|
|
|
|
return $view;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function renderPathLinks(DiffusionRequest $drequest) {
|
|
|
|
$path = $drequest->getPath();
|
|
|
|
$path_parts = array_filter(explode('/', trim($path, '/')));
|
|
|
|
|
|
|
|
$links = array();
|
|
|
|
if ($path_parts) {
|
|
|
|
$links[] = phutil_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => $drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'action' => 'browse',
|
|
|
|
'path' => '',
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
'r'.$drequest->getRepository()->getCallsign().'/');
|
|
|
|
$accum = '';
|
|
|
|
$last_key = last_key($path_parts);
|
|
|
|
foreach ($path_parts as $key => $part) {
|
|
|
|
$links[] = ' ';
|
|
|
|
$accum .= '/'.$part;
|
|
|
|
if ($key === $last_key) {
|
|
|
|
$links[] = $part;
|
|
|
|
} else {
|
|
|
|
$links[] = phutil_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => $drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'action' => 'browse',
|
|
|
|
'path' => $accum,
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
$part.'/');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$links[] = 'r'.$drequest->getRepository()->getCallsign().'/';
|
|
|
|
}
|
|
|
|
|
|
|
|
return $links;
|
|
|
|
}
|
|
|
|
|
2011-03-08 02:25:47 +01:00
|
|
|
}
|