Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phriction/controller/PhrictionDiffController.php
Show First 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | $output = hsprintf( | ||||
$comparison_table->render(), | $comparison_table->render(), | ||||
$navigation_table, | $navigation_table, | ||||
$revert_l, | $revert_l, | ||||
$revert_r); | $revert_r); | ||||
$object_box = id(new PHUIObjectBoxView()) | $object_box = id(new PHUIObjectBoxView()) | ||||
->setHeader($header) | ->setHeader($header) | ||||
->setCollapsed(true) | |||||
->appendChild($output); | ->appendChild($output); | ||||
return $this->buildApplicationPage( | return $this->buildApplicationPage( | ||||
array( | array( | ||||
$crumbs, | $crumbs, | ||||
$object_box, | $object_box, | ||||
$changes, | $changes, | ||||
), | ), | ||||
Show All 21 Lines | if (isset($hidden_statuses[$content->getChangeType()])) { | ||||
return null; | return null; | ||||
} | } | ||||
if ($content->getID() == $current->getID()) { | if ($content->getID() == $current->getID()) { | ||||
return phutil_tag( | return phutil_tag( | ||||
'a', | 'a', | ||||
array( | array( | ||||
'href' => '/phriction/edit/'.$document_id.'/', | 'href' => '/phriction/edit/'.$document_id.'/', | ||||
'class' => 'button grey', | 'class' => 'button simple', | ||||
), | ), | ||||
pht('Edit Current Version')); | pht('Edit Current Version')); | ||||
} | } | ||||
return phutil_tag( | return phutil_tag( | ||||
'a', | 'a', | ||||
array( | array( | ||||
'href' => '/phriction/edit/'.$document_id.'/?revert='.$version, | 'href' => '/phriction/edit/'.$document_id.'/?revert='.$version, | ||||
'class' => 'button grey', | 'class' => 'button simple', | ||||
), | ), | ||||
pht('Revert to Version %s...', $version)); | pht('Revert to Version %s...', $version)); | ||||
} | } | ||||
private function renderComparisonTable(array $content) { | private function renderComparisonTable(array $content) { | ||||
assert_instances_of($content, 'PhrictionContent'); | assert_instances_of($content, 'PhrictionContent'); | ||||
$user = $this->getRequest()->getUser(); | $user = $this->getRequest()->getUser(); | ||||
$phids = mpull($content, 'getAuthorPHID'); | $phids = mpull($content, 'getAuthorPHID'); | ||||
$handles = $this->loadViewerHandles($phids); | $handles = $this->loadViewerHandles($phids); | ||||
$list = new PHUIObjectItemListView(); | $list = new PHUIObjectItemListView(); | ||||
$list->setFlush(true); | |||||
$first = true; | $first = true; | ||||
foreach ($content as $c) { | foreach ($content as $c) { | ||||
$author = $handles[$c->getAuthorPHID()]->renderLink(); | $author = $handles[$c->getAuthorPHID()]->renderLink(); | ||||
$item = id(new PHUIObjectItemView()) | $item = id(new PHUIObjectItemView()) | ||||
->setHeader(pht('%s by %s, %s', | ->setHeader(pht('%s by %s, %s', | ||||
PhrictionChangeType::getChangeTypeLabel($c->getChangeType()), | PhrictionChangeType::getChangeTypeLabel($c->getChangeType()), | ||||
$author, | $author, | ||||
pht('Version %s', $c->getVersion()))) | pht('Version %s', $c->getVersion()))) | ||||
->addAttribute(pht('%s %s', | ->addAttribute(pht('%s %s', | ||||
phabricator_date($c->getDateCreated(), $user), | phabricator_date($c->getDateCreated(), $user), | ||||
phabricator_time($c->getDateCreated(), $user))); | phabricator_time($c->getDateCreated(), $user))); | ||||
if ($c->getDescription()) { | if ($c->getDescription()) { | ||||
$item->addAttribute($c->getDescription()); | $item->addAttribute($c->getDescription()); | ||||
} | } | ||||
if ($first == true) { | if ($first == true) { | ||||
$item->setBarColor('green'); | $item->setStatusIcon('fa-file green'); | ||||
$first = false; | $first = false; | ||||
} else { | } else { | ||||
$item->setBarColor('red'); | $item->setStatusIcon('fa-file red'); | ||||
} | } | ||||
$list->addItem($item); | $list->addItem($item); | ||||
} | } | ||||
return $list; | return $list; | ||||
} | } | ||||
} | } |