Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/ponder/view/PonderPostBodyView.php b/src/applications/ponder/view/PonderPostBodyView.php
index 77e72ee33b..4bfb4362ea 100644
--- a/src/applications/ponder/view/PonderPostBodyView.php
+++ b/src/applications/ponder/view/PonderPostBodyView.php
@@ -1,126 +1,120 @@
<?php
final class PonderPostBodyView extends AphrontView {
private $target;
private $question;
private $handles;
private $preview;
private $anchorName;
private $action;
public function setQuestion($question) {
$this->question = $question;
return $this;
}
public function setTarget($target) {
$this->target = $target;
return $this;
}
public function setAction($action) {
$this->action = $action;
return $this;
}
public function setHandles(array $handles) {
assert_instances_of($handles, 'PhabricatorObjectHandle');
$this->handles = $handles;
return $this;
}
public function setPreview($preview) {
$this->preview = $preview;
return $this;
}
public function render() {
if (!$this->user) {
throw new Exception("Call setUser() before rendering!");
}
require_celerity_resource('phabricator-remarkup-css');
require_celerity_resource('ponder-post-css');
$user = $this->user;
$question = $this->question;
$target = $this->target;
$content = $target->getContent();
$info = array();
$content = PhabricatorMarkupEngine::renderOneObject(
$target,
$target->getMarkupField(),
$this->user);
- $content =
- '<div class="phabricator-remarkup">'.
- $content.
- '</div>';
+ $content = phutil_tag(
+ 'div',
+ array(
+ 'class' => 'phabricator-remarkup',
+ ),
+ $content);
$author = $this->handles[$target->getAuthorPHID()];
$actions = array($author->renderLink().' '.$this->action);
$author_link = $author->renderLink();
$xaction_view = id(new PhabricatorTransactionView())
->setUser($user)
->setImageURI($author->getImageURI())
->setContentSource($target->getContentSource())
->setActions($actions);
if ($this->target instanceof PonderAnswer) {
$xaction_view->addClass("ponder-answer");
} else {
$xaction_view->addClass("ponder-question");
}
if ($this->preview) {
$xaction_view->setIsPreview($this->preview);
} else {
$xaction_view->setEpoch($target->getDateCreated());
if ($this->target instanceof PonderAnswer) {
$anchor_text = 'Q' . $question->getID(). '#A' . $target->getID();
$xaction_view->setAnchor('A'.$target->getID(), $anchor_text);
$xaction_view->addClass("ponder-answer");
}
}
$xaction_view->appendChild(
- '<div class="ponder-post-core">'.
- $content.
- '</div>'
- );
+ phutil_tag(
+ 'div',
+ array(
+ 'class' => 'ponder-post-core',
+ ),
+ $content));
$outerview = $xaction_view;
if (!$this->preview) {
$outerview =
id(new PonderVotableView())
->setPHID($target->getPHID())
->setCount($target->getVoteCount())
->setVote($target->getUserVote());
if ($this->target instanceof PonderAnswer) {
$outerview->setURI('/ponder/answer/vote/');
} else {
$outerview->setURI('/ponder/question/vote/');
}
$outerview->appendChild($xaction_view);
}
return $outerview->render();
}
- private function renderHandleList(array $phids) {
- $result = array();
- foreach ($phids as $phid) {
- $result[] = $this->handles[$phid]->renderLink();
- }
- return implode(', ', $result);
- }
-
-
-
}
diff --git a/src/applications/repository/controller/PhabricatorRepositoryListController.php b/src/applications/repository/controller/PhabricatorRepositoryListController.php
index 8c4baea1d0..3b32685467 100644
--- a/src/applications/repository/controller/PhabricatorRepositoryListController.php
+++ b/src/applications/repository/controller/PhabricatorRepositoryListController.php
@@ -1,168 +1,168 @@
<?php
final class PhabricatorRepositoryListController
extends PhabricatorRepositoryController {
public function shouldRequireAdmin() {
return false;
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$is_admin = $user->getIsAdmin();
$repos = id(new PhabricatorRepository())->loadAll();
$repos = msort($repos, 'getName');
$rows = array();
foreach ($repos as $repo) {
if ($repo->isTracked()) {
$diffusion_link = phutil_tag(
'a',
array(
'href' => '/diffusion/'.$repo->getCallsign().'/',
),
'View in Diffusion');
} else {
$diffusion_link = '<em>Not Tracked</em>';
}
$rows[] = array(
phutil_escape_html($repo->getCallsign()),
phutil_escape_html($repo->getName()),
PhabricatorRepositoryType::getNameForRepositoryType(
$repo->getVersionControlSystem()),
$diffusion_link,
phutil_tag(
'a',
array(
'class' => 'button small grey',
'href' => '/repository/edit/'.$repo->getID().'/',
),
'Edit'),
javelin_tag(
'a',
array(
'class' => 'button small grey',
'href' => '/repository/delete/'.$repo->getID().'/',
'sigil' => 'workflow',
),
'Delete'),
);
}
$table = new AphrontTableView($rows);
$table->setHeaders(
array(
'Callsign',
'Repository',
'Type',
'Diffusion',
'',
''
));
$table->setColumnClasses(
array(
null,
'wide',
null,
null,
'action',
'action',
));
$table->setColumnVisibility(
array(
true,
true,
true,
true,
$is_admin,
$is_admin,
));
$panel = new AphrontPanelView();
$panel->setHeader('Repositories');
if ($is_admin) {
$panel->setCreateButton('Create New Repository', '/repository/create/');
}
$panel->appendChild($table);
$panel->setNoBackground();
$projects = id(new PhabricatorRepositoryArcanistProject())->loadAll();
$rows = array();
foreach ($projects as $project) {
$repo = idx($repos, $project->getRepositoryID());
if ($repo) {
$repo_name = phutil_escape_html($repo->getName());
} else {
$repo_name = '-';
}
$rows[] = array(
phutil_escape_html($project->getName()),
$repo_name,
phutil_tag(
'a',
array(
'href' => '/repository/project/edit/'.$project->getID().'/',
'class' => 'button grey small',
),
'Edit'),
- javelin_render_tag(
+ javelin_tag(
'a',
array(
'href' => '/repository/project/delete/'.$project->getID().'/',
'class' => 'button grey small',
'sigil' => 'workflow',
),
'Delete'),
);
}
$project_table = new AphrontTableView($rows);
$project_table->setHeaders(
array(
'Project ID',
'Repository',
'',
'',
));
$project_table->setColumnClasses(
array(
'',
'wide',
'action',
'action',
));
$project_table->setColumnVisibility(
array(
true,
true,
$is_admin,
$is_admin,
));
$project_panel = new AphrontPanelView();
$project_panel->setHeader('Arcanist Projects');
$project_panel->appendChild($project_table);
$project_panel->setNoBackground();
return $this->buildStandardPageResponse(
array(
$this->renderDaemonNotice(),
$panel,
$project_panel,
),
array(
'title' => 'Repository List',
));
}
}
diff --git a/src/view/layout/AphrontPanelView.php b/src/view/layout/AphrontPanelView.php
index 2c186d6e24..2d2e313977 100644
--- a/src/view/layout/AphrontPanelView.php
+++ b/src/view/layout/AphrontPanelView.php
@@ -1,110 +1,110 @@
<?php
final class AphrontPanelView extends AphrontView {
const WIDTH_FULL = 'full';
const WIDTH_FORM = 'form';
const WIDTH_WIDE = 'wide';
private $buttons = array();
private $header;
private $caption;
private $width;
private $classes = array();
private $id;
public function setCreateButton($create_button, $href) {
$this->addButton(
- phutil_render_tag(
+ phutil_tag(
'a',
array(
'href' => $href,
'class' => 'button green',
),
$create_button));
return $this;
}
public function addClass($class) {
$this->classes[] = $class;
return $this;
}
public function addButton($button) {
$this->buttons[] = $button;
return $this;
}
public function setHeader($header) {
$this->header = $header;
return $this;
}
public function setWidth($width) {
$this->width = $width;
return $this;
}
public function setID($id) {
$this->id = $id;
return $this;
}
public function setCaption($caption) {
$this->caption = $caption;
return $this;
}
public function setNoBackground() {
$this->classes[] = 'aphront-panel-plain';
return $this;
}
public function render() {
if ($this->header !== null) {
$header = '<h1>'.$this->header.'</h1>';
} else {
$header = null;
}
if ($this->caption !== null) {
$caption =
'<div class="aphront-panel-view-caption">'.
$this->caption.
'</div>';
} else {
$caption = null;
}
$buttons = null;
if ($this->buttons) {
$buttons =
'<div class="aphront-panel-view-buttons">'.
implode(" ", $this->buttons).
'</div>';
}
$header_elements =
'<div class="aphront-panel-header">'.
$buttons.$header.$caption.
'</div>';
$table = $this->renderChildren();
require_celerity_resource('aphront-panel-view-css');
$classes = $this->classes;
$classes[] = 'aphront-panel-view';
if ($this->width) {
$classes[] = 'aphront-panel-width-'.$this->width;
}
return phutil_render_tag(
'div',
array(
'class' => implode(' ', $classes),
'id' => $this->id,
),
$header_elements.$table);
}
}
diff --git a/src/view/layout/PhabricatorMenuView.php b/src/view/layout/PhabricatorMenuView.php
index bf1d601eb2..c863f9dfa1 100644
--- a/src/view/layout/PhabricatorMenuView.php
+++ b/src/view/layout/PhabricatorMenuView.php
@@ -1,164 +1,164 @@
<?php
final class PhabricatorMenuView extends AphrontTagView {
private $items = array();
protected function canAppendChild() {
return false;
}
public function newLabel($name) {
$item = id(new PhabricatorMenuItemView())
->setType(PhabricatorMenuItemView::TYPE_LABEL)
->setName($name);
$this->addMenuItem($item);
return $item;
}
public function newLink($name, $href) {
$item = id(new PhabricatorMenuItemView())
->setType(PhabricatorMenuItemView::TYPE_LINK)
->setName($name)
->setHref($href);
$this->addMenuItem($item);
return $item;
}
public function newButton($name, $href) {
$item = id(new PhabricatorMenuItemView())
->setType(PhabricatorMenuItemView::TYPE_BUTTON)
->setName($name)
->setHref($href);
$this->addMenuItem($item);
return $item;
}
public function addMenuItem(PhabricatorMenuItemView $item) {
return $this->addMenuItemAfter(null, $item);
}
public function addMenuItemAfter($key, PhabricatorMenuItemView $item) {
if ($key === null) {
$this->items[] = $item;
return $this;
}
if (!$this->getItem($key)) {
throw new Exception("No such key '{$key}' to add menu item after!");
}
$result = array();
foreach ($this->items as $other) {
$result[] = $other;
if ($other->getKey() == $key) {
$result[] = $item;
}
}
$this->items = $result;
return $this;
}
public function addMenuItemBefore($key, PhabricatorMenuItemView $item) {
if ($key === null) {
array_unshift($this->items, $item);
return $this;
}
$this->requireKey($key);
$result = array();
foreach ($this->items as $other) {
if ($other->getKey() == $key) {
$result[] = $item;
}
$result[] = $other;
}
$this->items = $result;
return $this;
}
public function addMenuItemToLabel($key, PhabricatorMenuItemView $item) {
$this->requireKey($key);
$other = $this->getItem($key);
if ($other->getType() != PhabricatorMenuItemView::TYPE_LABEL) {
throw new Exception("Menu item '{$key}' is not a label!");
}
$seen = false;
$after = null;
foreach ($this->items as $other) {
if (!$seen) {
if ($other->getKey() == $key) {
$seen = true;
}
} else {
if ($other->getType() == PhabricatorMenuItemView::TYPE_LABEL) {
break;
}
}
$after = $other->getKey();
}
return $this->addMenuItemAfter($after, $item);
}
private function requireKey($key) {
if (!$this->getItem($key)) {
throw new Exception("No menu item with key '{$key}' exists!");
}
}
public function getItem($key) {
$key = (string)$key;
// NOTE: We could optimize this, but need to update any map when items have
// their keys change. Since that's moderately complex, wait for a profile
// or use case.
foreach ($this->items as $item) {
if ($item->getKey() == $key) {
return $item;
}
}
return null;
}
public function getItems() {
return $this->items;
}
protected function willRender() {
$key_map = array();
foreach ($this->items as $item) {
$key = $item->getKey();
if ($key !== null) {
if (isset($key_map[$key])) {
throw new Exception(
"Menu contains duplicate items with key '{$key}'!");
}
$key_map[$key] = $item;
}
}
}
protected function getTagAttributes() {
return array(
'class' => 'phabricator-menu-view',
);
}
protected function getTagContent() {
- return $this->renderSingleView($this->items);
+ return $this->renderHTMLView($this->items);
}
}
diff --git a/src/view/layout/PhabricatorTimelineView.php b/src/view/layout/PhabricatorTimelineView.php
index e5d7dae568..3977a320b2 100644
--- a/src/view/layout/PhabricatorTimelineView.php
+++ b/src/view/layout/PhabricatorTimelineView.php
@@ -1,48 +1,48 @@
<?php
final class PhabricatorTimelineView extends AphrontView {
private $events = array();
private $id;
public function setID($id) {
$this->id = $id;
return $this;
}
public function addEvent(PhabricatorTimelineEventView $event) {
$this->events[] = $event;
return $this;
}
public function render() {
require_celerity_resource('phabricator-timeline-view-css');
$spacer = self::renderSpacer();
$events = array();
foreach ($this->events as $event) {
$events[] = $spacer;
$events[] = $this->renderSingleView($event);
}
$events[] = $spacer;
- return phutil_render_tag(
+ return phutil_tag(
'div',
array(
'class' => 'phabricator-timeline-view',
'id' => $this->id,
),
- implode('', $events));
+ $events);
}
public static function renderSpacer() {
return phutil_tag(
'div',
array(
'class' => 'phabricator-timeline-event-view '.
'phabricator-timeline-spacer',
),
'');
}
}

File Metadata

Mime Type
text/x-diff
Expires
Thu, Oct 16, 8:07 AM (23 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
272556
Default Alt Text
(15 KB)

Event Timeline