2011-03-08 17:31:44 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Copyright 2011 Facebook, Inc.
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
2011-03-12 16:17:34 -08:00
|
|
|
final class DiffusionHistoryTableView extends DiffusionView {
|
2011-03-08 17:31:44 -08:00
|
|
|
|
|
|
|
|
private $history;
|
|
|
|
|
|
|
|
|
|
public function setHistory(array $history) {
|
|
|
|
|
$this->history = $history;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function render() {
|
2011-03-12 16:17:34 -08:00
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
|
|
2011-03-08 17:31:44 -08:00
|
|
|
$rows = array();
|
|
|
|
|
foreach ($this->history as $history) {
|
2011-03-12 22:51:40 -08:00
|
|
|
$epoch = $history->getEpoch();
|
|
|
|
|
|
|
|
|
|
if ($epoch) {
|
|
|
|
|
$date = date('M j, Y', $epoch);
|
|
|
|
|
$time = date('g:i A', $epoch);
|
|
|
|
|
} else {
|
|
|
|
|
$date = null;
|
|
|
|
|
$time = null;
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-08 17:31:44 -08:00
|
|
|
$rows[] = array(
|
2011-03-12 16:17:34 -08:00
|
|
|
$this->linkBrowse(
|
|
|
|
|
$drequest->getPath(),
|
|
|
|
|
array(
|
|
|
|
|
'commit' => $history->getCommitIdentifier(),
|
|
|
|
|
)),
|
|
|
|
|
self::linkCommit(
|
|
|
|
|
$drequest->getRepository(),
|
|
|
|
|
$history->getCommitIdentifier()),
|
2011-03-12 22:51:40 -08:00
|
|
|
'-',
|
|
|
|
|
$date,
|
|
|
|
|
$time,
|
|
|
|
|
phutil_escape_html($history->getAuthorName()),
|
|
|
|
|
phutil_escape_html($history->getSummary()),
|
2011-03-08 17:31:44 -08:00
|
|
|
// TODO: etc etc
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$view = new AphrontTableView($rows);
|
|
|
|
|
$view->setHeaders(
|
|
|
|
|
array(
|
2011-03-12 16:17:34 -08:00
|
|
|
'Browse',
|
2011-03-08 17:31:44 -08:00
|
|
|
'Commit',
|
2011-03-12 16:17:34 -08:00
|
|
|
'Change',
|
|
|
|
|
'Date',
|
2011-03-12 22:51:40 -08:00
|
|
|
'Time',
|
2011-03-12 16:17:34 -08:00
|
|
|
'Author',
|
|
|
|
|
'Details',
|
|
|
|
|
));
|
|
|
|
|
$view->setColumnClasses(
|
|
|
|
|
array(
|
|
|
|
|
'',
|
|
|
|
|
'n',
|
|
|
|
|
'',
|
|
|
|
|
'',
|
2011-03-12 22:51:40 -08:00
|
|
|
'right',
|
2011-03-12 16:17:34 -08:00
|
|
|
'',
|
|
|
|
|
'wide wrap',
|
2011-03-08 17:31:44 -08:00
|
|
|
));
|
|
|
|
|
return $view->render();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|