Page MenuHomePhorge

No OneTemporary

diff --git a/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php b/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php
index 26632dff24..84a4cbc519 100644
--- a/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php
+++ b/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php
@@ -1,109 +1,109 @@
<?php
final class PhabricatorDifferentialRevisionTestDataGenerator
extends PhabricatorTestDataGenerator {
const GENERATORKEY = 'revisions';
public function getGeneratorName() {
return pht('Differential Revisions');
}
public function generateObject() {
$author = $this->loadPhabricatorUser();
$revision = DifferentialRevision::initializeNewRevision($author);
$revision->attachReviewers(array());
$revision->attachActiveDiff(null);
// This could be a bit richer and more formal than it is.
$revision->setTitle($this->generateTitle());
$revision->setSummary($this->generateDescription());
$revision->setTestPlan($this->generateDescription());
$diff = $this->generateDiff($author);
$type_update = DifferentialRevisionUpdateTransaction::TRANSACTIONTYPE;
$xactions = array();
$xactions[] = id(new DifferentialTransaction())
->setTransactionType($type_update)
->setNewValue($diff->getPHID());
id(new DifferentialTransactionEditor())
->setActor($author)
->setContentSource($this->getLipsumContentSource())
->applyTransactions($revision, $xactions);
return $revision;
}
public function getCCPHIDs() {
$ccs = array();
for ($i = 0; $i < rand(1, 4);$i++) {
$ccs[] = $this->loadPhabricatorUserPHID();
}
return $ccs;
}
public function generateDiff($author) {
$paste_generator = new PhabricatorPasteTestDataGenerator();
$languages = $paste_generator->getSupportedLanguages();
$language = array_rand($languages);
$spec = $languages[$language];
$code = $paste_generator->generateContent($spec);
$altcode = $paste_generator->generateContent($spec);
$newcode = $this->randomlyModify($code, $altcode);
$diff = id(new PhabricatorDifferenceEngine())
->generateRawDiffFromFileContent($code, $newcode);
$call = new ConduitCall(
'differential.createrawdiff',
array(
'diff' => $diff,
));
$call->setUser($author);
$result = $call->execute();
$thediff = id(new DifferentialDiff())->load(
$result['id']);
$thediff->setDescription($this->generateTitle())->save();
return $thediff;
}
public function generateDescription() {
return id(new PhutilLipsumContextFreeGrammar())
->generate(10, 20);
}
public function generateTitle() {
return id(new PhutilLipsumContextFreeGrammar())
->generate();
}
public function randomlyModify($code, $altcode) {
$codearr = explode("\n", $code);
$altcodearr = explode("\n", $altcode);
$no_lines_to_delete = rand(1,
min(count($codearr) - 2, 5));
$randomlines = array_rand($codearr,
count($codearr) - $no_lines_to_delete);
$newcode = array();
foreach ($randomlines as $lineno) {
$newcode[] = $codearr[$lineno];
}
$newlines_count = rand(2,
min(count($codearr) - 2, count($altcodearr) - 2, 5));
$randomlines_orig = array_rand($codearr, $newlines_count);
$randomlines_new = array_rand($altcodearr, $newlines_count);
$newcode2 = array();
$c = 0;
for ($i = 0; $i < count($newcode);$i++) {
$newcode2[] = $newcode[$i];
if (in_array($i, $randomlines_orig)) {
$newcode2[] = $altcodearr[$randomlines_new[$c++]];
}
}
- return implode($newcode2, "\n");
+ return implode("\n", $newcode2);
}
}
diff --git a/src/applications/people/view/PhabricatorUserCardView.php b/src/applications/people/view/PhabricatorUserCardView.php
index 21cb468ba8..54d0a41204 100644
--- a/src/applications/people/view/PhabricatorUserCardView.php
+++ b/src/applications/people/view/PhabricatorUserCardView.php
@@ -1,176 +1,176 @@
<?php
final class PhabricatorUserCardView extends AphrontTagView {
private $profile;
private $viewer;
private $tag;
public function setProfile(PhabricatorUser $profile) {
$this->profile = $profile;
return $this;
}
public function setViewer(PhabricatorUser $viewer) {
$this->viewer = $viewer;
return $this;
}
public function setTag($tag) {
$this->tag = $tag;
return $this;
}
protected function getTagName() {
if ($this->tag) {
return $this->tag;
}
return 'div';
}
protected function getTagAttributes() {
$classes = array();
$classes[] = 'project-card-view';
$classes[] = 'people-card-view';
if ($this->profile->getIsDisabled()) {
$classes[] = 'project-card-disabled';
}
return array(
- 'class' => implode($classes, ' '),
+ 'class' => implode(' ', $classes),
);
}
protected function getTagContent() {
$user = $this->profile;
$profile = $user->loadUserProfile();
$picture = $user->getProfileImageURI();
$viewer = $this->viewer;
require_celerity_resource('project-card-view-css');
// We don't have a ton of room on the hovercard, so we're trying to show
// the most important tag. Users can click through to the profile to get
// more details.
$classes = array();
if ($user->getIsDisabled()) {
$tag_icon = 'fa-ban';
$tag_title = pht('Disabled');
$tag_shade = PHUITagView::COLOR_RED;
$classes[] = 'phui-image-disabled';
} else if (!$user->getIsApproved()) {
$tag_icon = 'fa-ban';
$tag_title = pht('Unapproved Account');
$tag_shade = PHUITagView::COLOR_RED;
} else if (!$user->getIsEmailVerified()) {
$tag_icon = 'fa-envelope';
$tag_title = pht('Email Not Verified');
$tag_shade = PHUITagView::COLOR_VIOLET;
} else if ($user->getIsAdmin()) {
$tag_icon = 'fa-star';
$tag_title = pht('Administrator');
$tag_shade = PHUITagView::COLOR_INDIGO;
} else {
$tag_icon = PhabricatorPeopleIconSet::getIconIcon($profile->getIcon());
$tag_title = $profile->getDisplayTitle();
$tag_shade = null;
}
$tag = id(new PHUITagView())
->setIcon($tag_icon)
->setName($tag_title)
->setType(PHUITagView::TYPE_SHADE);
if ($tag_shade !== null) {
$tag->setColor($tag_shade);
}
$body = array();
/* TODO: Replace with Conpherence Availability if we ship it */
$body[] = $this->addItem(
'fa-user-plus',
phabricator_date($user->getDateCreated(), $viewer));
$has_calendar = PhabricatorApplication::isClassInstalledForViewer(
'PhabricatorCalendarApplication',
$viewer);
if ($has_calendar) {
if (!$user->getIsDisabled()) {
$body[] = $this->addItem(
'fa-calendar-o',
id(new PHUIUserAvailabilityView())
->setViewer($viewer)
->setAvailableUser($user));
}
}
$classes[] = 'project-card-image';
$image = phutil_tag(
'img',
array(
'src' => $picture,
'class' => implode(' ', $classes),
));
$href = urisprintf(
'/p/%s/',
$user->getUsername());
$image = phutil_tag(
'a',
array(
'href' => $href,
'class' => 'project-card-image-href',
),
$image);
$name = phutil_tag_div('project-card-name',
$user->getRealname());
$username = phutil_tag_div('project-card-username',
'@'.$user->getUsername());
$tag = phutil_tag_div('phui-header-subheader',
$tag);
$header = phutil_tag(
'div',
array(
'class' => 'project-card-header',
),
array(
$name,
$username,
$tag,
$body,
));
$card = phutil_tag(
'div',
array(
'class' => 'project-card-inner',
),
array(
$header,
$image,
));
return $card;
}
private function addItem($icon, $value) {
$icon = id(new PHUIIconView())
->addClass('project-card-item-icon')
->setIcon($icon);
$text = phutil_tag(
'span',
array(
'class' => 'project-card-item-text',
),
$value);
return phutil_tag_div('project-card-item', array($icon, $text));
}
}
diff --git a/src/applications/project/view/PhabricatorProjectCardView.php b/src/applications/project/view/PhabricatorProjectCardView.php
index f82ee8c99e..a56697ba7e 100644
--- a/src/applications/project/view/PhabricatorProjectCardView.php
+++ b/src/applications/project/view/PhabricatorProjectCardView.php
@@ -1,84 +1,84 @@
<?php
final class PhabricatorProjectCardView extends AphrontTagView {
private $project;
private $viewer;
private $tag;
public function setProject(PhabricatorProject $project) {
$this->project = $project;
return $this;
}
public function setViewer(PhabricatorUser $viewer) {
$this->viewer = $viewer;
return $this;
}
public function setTag($tag) {
$this->tag = $tag;
return $this;
}
protected function getTagName() {
if ($this->tag) {
return $this->tag;
}
return 'div';
}
protected function getTagAttributes() {
$classes = array();
$classes[] = 'project-card-view';
$color = $this->project->getColor();
$classes[] = 'project-card-'.$color;
return array(
- 'class' => implode($classes, ' '),
+ 'class' => implode(' ', $classes),
);
}
protected function getTagContent() {
$project = $this->project;
$viewer = $this->viewer;
require_celerity_resource('project-card-view-css');
$icon = $project->getDisplayIconIcon();
$icon_name = $project->getDisplayIconName();
$tag = id(new PHUITagView())
->setIcon($icon)
->setName($icon_name)
->addClass('project-view-header-tag')
->setType(PHUITagView::TYPE_SHADE);
$header = id(new PHUIHeaderView())
->setHeader(array($project->getDisplayName(), $tag))
->setUser($viewer)
->setPolicyObject($project)
->setImage($project->getProfileImageURI());
if ($project->getStatus() == PhabricatorProjectStatus::STATUS_ACTIVE) {
$header->setStatus('fa-check', 'bluegrey', pht('Active'));
} else {
$header->setStatus('fa-ban', 'red', pht('Archived'));
}
$description = null;
$card = phutil_tag(
'div',
array(
'class' => 'project-card-inner',
),
array(
$header,
$description,
));
return $card;
}
}
diff --git a/src/view/phui/PHUIPropertyListView.php b/src/view/phui/PHUIPropertyListView.php
index 336c494a3c..62fa30bba8 100644
--- a/src/view/phui/PHUIPropertyListView.php
+++ b/src/view/phui/PHUIPropertyListView.php
@@ -1,303 +1,303 @@
<?php
final class PHUIPropertyListView extends AphrontView {
private $parts = array();
private $hasKeyboardShortcuts;
private $object;
private $invokedWillRenderEvent;
private $actionList = null;
private $classes = array();
private $stacked;
const ICON_SUMMARY = 'fa-align-left';
const ICON_TESTPLAN = 'fa-file-text-o';
protected function canAppendChild() {
return false;
}
public function setObject($object) {
$this->object = $object;
return $this;
}
public function setActionList(PhabricatorActionListView $list) {
$this->actionList = $list;
return $this;
}
public function getActionList() {
return $this->actionList;
}
public function setStacked($stacked) {
$this->stacked = $stacked;
return $this;
}
public function addClass($class) {
$this->classes[] = $class;
return $this;
}
public function setHasKeyboardShortcuts($has_keyboard_shortcuts) {
$this->hasKeyboardShortcuts = $has_keyboard_shortcuts;
return $this;
}
public function addProperty($key, $value) {
$current = array_pop($this->parts);
if (!$current || $current['type'] != 'property') {
if ($current) {
$this->parts[] = $current;
}
$current = array(
'type' => 'property',
'list' => array(),
);
}
$current['list'][] = array(
'key' => $key,
'value' => $value,
);
$this->parts[] = $current;
return $this;
}
public function addSectionHeader($name, $icon = null) {
$this->parts[] = array(
'type' => 'section',
'name' => $name,
'icon' => $icon,
);
return $this;
}
public function addTextContent($content) {
$this->parts[] = array(
'type' => 'text',
'content' => $content,
);
return $this;
}
public function addRawContent($content) {
$this->parts[] = array(
'type' => 'raw',
'content' => $content,
);
return $this;
}
public function addImageContent($content) {
$this->parts[] = array(
'type' => 'image',
'content' => $content,
);
return $this;
}
public function invokeWillRenderEvent() {
if ($this->object && $this->getUser() && !$this->invokedWillRenderEvent) {
$event = new PhabricatorEvent(
PhabricatorEventType::TYPE_UI_WILLRENDERPROPERTIES,
array(
'object' => $this->object,
'view' => $this,
));
$event->setUser($this->getUser());
PhutilEventEngine::dispatchEvent($event);
}
$this->invokedWillRenderEvent = true;
}
public function hasAnyProperties() {
$this->invokeWillRenderEvent();
if ($this->parts) {
return true;
}
return false;
}
public function render() {
$this->invokeWillRenderEvent();
require_celerity_resource('phui-property-list-view-css');
$items = array();
$parts = $this->parts;
// If we have an action list, make sure we render a property part, even
// if there are no properties. Otherwise, the action list won't render.
if ($this->actionList) {
$this->classes[] = 'phui-property-list-has-actions';
$have_property_part = false;
foreach ($this->parts as $part) {
if ($part['type'] == 'property') {
$have_property_part = true;
break;
}
}
if (!$have_property_part) {
$parts[] = array(
'type' => 'property',
'list' => array(),
);
}
}
foreach ($parts as $part) {
$type = $part['type'];
switch ($type) {
case 'property':
$items[] = $this->renderPropertyPart($part);
break;
case 'section':
$items[] = $this->renderSectionPart($part);
break;
case 'text':
case 'image':
$items[] = $this->renderTextPart($part);
break;
case 'raw':
$items[] = $this->renderRawPart($part);
break;
default:
throw new Exception(pht("Unknown part type '%s'!", $type));
}
}
$this->classes[] = 'phui-property-list-section';
$classes = implode(' ', $this->classes);
return phutil_tag(
'div',
array(
'class' => $classes,
),
array(
$items,
));
}
private function renderPropertyPart(array $part) {
$items = array();
foreach ($part['list'] as $spec) {
$key = $spec['key'];
$value = $spec['value'];
// NOTE: We append a space to each value to improve the behavior when the
// user double-clicks a property value (like a URI) to select it. Without
// the space, the label is also selected.
$items[] = phutil_tag(
'dt',
array(
'class' => 'phui-property-list-key',
),
array($key, ' '));
$items[] = phutil_tag(
'dd',
array(
'class' => 'phui-property-list-value',
),
array($value, ' '));
}
$stacked = '';
if ($this->stacked) {
$stacked = 'phui-property-list-stacked';
}
$list = phutil_tag(
'dl',
array(
'class' => 'phui-property-list-properties',
),
$items);
$shortcuts = null;
if ($this->hasKeyboardShortcuts) {
$shortcuts = new AphrontKeyboardShortcutsAvailableView();
}
$list = phutil_tag(
'div',
array(
'class' => 'phui-property-list-properties-wrap '.$stacked,
),
array($shortcuts, $list));
$action_list = null;
if ($this->actionList) {
$action_list = phutil_tag(
'div',
array(
'class' => 'phui-property-list-actions',
),
$this->actionList);
$this->actionList = null;
}
return phutil_tag(
'div',
array(
'class' => 'phui-property-list-container grouped',
),
array($action_list, $list));
}
private function renderSectionPart(array $part) {
$name = $part['name'];
if ($part['icon']) {
$icon = id(new PHUIIconView())
->setIcon($part['icon'].' bluegrey');
$name = phutil_tag(
'span',
array(
'class' => 'phui-property-list-section-header-icon',
),
array($icon, $name));
}
return phutil_tag(
'div',
array(
'class' => 'phui-property-list-section-header',
),
$name);
}
private function renderTextPart(array $part) {
$classes = array();
$classes[] = 'phui-property-list-text-content';
if ($part['type'] == 'image') {
$classes[] = 'phui-property-list-image-content';
}
return phutil_tag(
'div',
array(
- 'class' => implode($classes, ' '),
+ 'class' => implode(' ', $classes),
),
$part['content']);
}
private function renderRawPart(array $part) {
$classes = array();
$classes[] = 'phui-property-list-raw-content';
return phutil_tag(
'div',
array(
- 'class' => implode($classes, ' '),
+ 'class' => implode(' ', $classes),
),
$part['content']);
}
}
diff --git a/src/view/phui/PHUITwoColumnView.php b/src/view/phui/PHUITwoColumnView.php
index 9240887f4b..cf4abe3a40 100644
--- a/src/view/phui/PHUITwoColumnView.php
+++ b/src/view/phui/PHUITwoColumnView.php
@@ -1,246 +1,246 @@
<?php
final class PHUITwoColumnView extends AphrontTagView {
private $mainColumn;
private $sideColumn = null;
private $navigation;
private $display;
private $fixed;
private $header;
private $subheader;
private $footer;
private $tabs;
private $propertySection = array();
private $curtain;
const DISPLAY_LEFT = 'phui-side-column-left';
const DISPLAY_RIGHT = 'phui-side-column-right';
public function setMainColumn($main) {
$this->mainColumn = $main;
return $this;
}
public function setSideColumn($side) {
$this->sideColumn = $side;
return $this;
}
public function setNavigation($nav) {
$this->navigation = $nav;
$this->display = self::DISPLAY_LEFT;
return $this;
}
public function setHeader(PHUIHeaderView $header) {
$this->header = $header;
return $this;
}
public function setSubheader($subheader) {
$this->subheader = $subheader;
return $this;
}
public function setTabs(PHUIListView $tabs) {
$tabs->setType(PHUIListView::TABBAR_LIST);
$this->tabs = $tabs;
return $this;
}
public function setFooter($footer) {
$this->footer = $footer;
return $this;
}
public function addPropertySection($title, $section) {
$this->propertySection[] = array(
'header' => $title,
'content' => $section,
);
return $this;
}
public function setCurtain(PHUICurtainView $curtain) {
$this->curtain = $curtain;
return $this;
}
public function getCurtain() {
return $this->curtain;
}
public function setFixed($fixed) {
$this->fixed = $fixed;
return $this;
}
public function setDisplay($display) {
$this->display = $display;
return $this;
}
private function getDisplay() {
if ($this->display) {
return $this->display;
} else {
return self::DISPLAY_RIGHT;
}
}
protected function getTagAttributes() {
$classes = array();
$classes[] = 'phui-two-column-view';
$classes[] = $this->getDisplay();
if ($this->fixed) {
$classes[] = 'phui-two-column-fixed';
}
if ($this->tabs) {
$classes[] = 'with-tabs';
}
if ($this->subheader) {
$classes[] = 'with-subheader';
}
if (!$this->header) {
$classes[] = 'without-header';
}
return array(
'class' => implode(' ', $classes),
);
}
protected function getTagContent() {
require_celerity_resource('phui-two-column-view-css');
$main = $this->buildMainColumn();
$side = $this->buildSideColumn();
$footer = $this->buildFooter();
$order = array($side, $main);
$inner = phutil_tag_div('phui-two-column-row grouped', $order);
$table = phutil_tag_div('phui-two-column-content', $inner);
$header = null;
if ($this->header) {
$curtain = $this->getCurtain();
if ($curtain) {
$action_list = $curtain->getActionList();
$this->header->setActionListID($action_list->getID());
}
$header = phutil_tag_div(
'phui-two-column-header', $this->header);
}
$tabs = null;
if ($this->tabs) {
$tabs = phutil_tag_div(
'phui-two-column-tabs', $this->tabs);
}
$subheader = null;
if ($this->subheader) {
$subheader = phutil_tag_div(
'phui-two-column-subheader', $this->subheader);
}
return phutil_tag(
'div',
array(
'class' => 'phui-two-column-container',
),
array(
$header,
$tabs,
$subheader,
$table,
$footer,
));
}
private function buildMainColumn() {
$view = array();
$sections = $this->propertySection;
if ($sections) {
foreach ($sections as $section) {
$section_header = $section['header'];
$section_content = $section['content'];
if ($section_content === null) {
continue;
}
if ($section_header instanceof PHUIHeaderView) {
$header = $section_header;
} else {
$header = id(new PHUIHeaderView())
->setHeader($section_header);
}
$view[] = id(new PHUIObjectBoxView())
->setHeader($header)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->appendChild($section_content);
}
}
return phutil_tag(
'div',
array(
'class' => 'phui-main-column',
),
array(
$view,
$this->mainColumn,
));
}
private function buildSideColumn() {
$classes = array();
$classes[] = 'phui-side-column';
$navigation = null;
if ($this->navigation) {
$classes[] = 'side-has-nav';
$navigation = id(new PHUIObjectBoxView())
->appendChild($this->navigation);
}
$curtain = $this->getCurtain();
return phutil_tag(
'div',
array(
- 'class' => implode($classes, ' '),
+ 'class' => implode(' ', $classes),
),
array(
$navigation,
$curtain,
$this->sideColumn,
));
}
private function buildFooter() {
$footer = $this->footer;
return phutil_tag(
'div',
array(
'class' => 'phui-two-column-content phui-two-column-footer',
),
array(
$footer,
));
}
}

File Metadata

Mime Type
text/x-diff
Expires
Jan 19 2025, 21:06 (6 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128750
Default Alt Text
(23 KB)

Event Timeline