本文整理匯總了PHP中PHUIPropertyListView::addTextContent方法的典型用法代碼示例。如果您正苦於以下問題:PHP PHUIPropertyListView::addTextContent方法的具體用法?PHP PHUIPropertyListView::addTextContent怎麽用?PHP PHUIPropertyListView::addTextContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PHUIPropertyListView
的用法示例。
在下文中一共展示了PHUIPropertyListView::addTextContent方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: renderItemCommonProperties
private function renderItemCommonProperties(PhabricatorUser $viewer, NuanceItem $item, PHUIPropertyListView $view)
{
$complaint = $item->getNuanceProperty('complaint');
$complaint = PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($complaint), 'default', $viewer);
$view->addSectionHeader(pht('Complaint'), 'fa-exclamation-circle');
$view->addTextContent($complaint);
}
示例2: renderItemCommonProperties
private function renderItemCommonProperties(PhabricatorUser $viewer, NuanceItem $item, PHUIPropertyListView $view)
{
$complaint = $item->getNuanceProperty('complaint');
$complaint = new PHUIRemarkupView($viewer, $complaint);
$view->addSectionHeader(pht('Complaint'), 'fa-exclamation-circle');
$view->addTextContent($complaint);
}
示例3: buildDocument
private function buildDocument(PhabricatorMarkupEngine $engine, LegalpadDocumentBody $body)
{
$view = new PHUIPropertyListView();
$view->addClass('legalpad');
$view->addSectionHeader(pht('Document'));
$view->addTextContent($engine->getOutput($body, LegalpadDocumentBody::MARKUP_FIELD_TEXT));
return $view;
}
示例4: renderProperties
private function renderProperties(PhameBlog $blog, PhabricatorUser $user, PhabricatorActionListView $actions)
{
require_celerity_resource('aphront-tooltip-css');
Javelin::initBehavior('phabricator-tooltips');
$properties = new PHUIPropertyListView();
$properties->setActionList($actions);
$properties->addProperty(pht('Skin'), $blog->getSkin());
$properties->addProperty(pht('Domain'), $blog->getDomain());
$feed_uri = PhabricatorEnv::getProductionURI($this->getApplicationURI('blog/feed/' . $blog->getID() . '/'));
$properties->addProperty(pht('Atom URI'), javelin_tag('a', array('href' => $feed_uri, 'sigil' => 'has-tooltip', 'meta' => array('tip' => pht('Atom URI does not support custom domains.'), 'size' => 320)), $feed_uri));
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($user, $blog);
$properties->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
$properties->addProperty(pht('Joinable By'), $descriptions[PhabricatorPolicyCapability::CAN_JOIN]);
$engine = id(new PhabricatorMarkupEngine())->setViewer($user)->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION)->process();
$properties->addTextContent(phutil_tag('div', array('class' => 'phabricator-remarkup'), $engine->getOutput($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION)));
return $properties;
}
示例5: renderExample
public function renderExample()
{
$request = $this->getRequest();
$user = $request->getUser();
$details1 = id(new PHUIListItemView())->setName('Details')->setSelected(true);
$details2 = id(new PHUIListItemView())->setName('Rainbow Info')->setStatusColor(PHUIListItemView::STATUS_WARN);
$details3 = id(new PHUIListItemView())->setName('Pasta Haiku')->setStatusColor(PHUIListItemView::STATUS_FAIL);
$statustabs = id(new PHUIListView())->setType(PHUIListView::NAVBAR_LIST)->addMenuItem($details1)->addMenuItem($details2)->addMenuItem($details3);
$view = new PHUIPropertyListView();
$view->addProperty(pht('Color'), pht('Yellow'));
$view->addProperty(pht('Size'), pht('Mouse'));
$view->addProperty(pht('Element'), pht('Electric'));
$view->addTextContent('Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' . 'Quisque rhoncus tempus massa, sit amet faucibus lectus bibendum ' . 'viverra. Nunc tempus tempor quam id iaculis. Maecenas lectus ' . 'velit, aliquam et consequat quis, tincidunt id dolor.');
$view2 = new PHUIPropertyListView();
$view2->addSectionHeader('Colors of the Rainbow');
$view2->addProperty('R', 'Red');
$view2->addProperty('O', 'Orange');
$view2->addProperty('Y', 'Yellow');
$view2->addProperty('G', 'Green');
$view2->addProperty('B', 'Blue');
$view2->addProperty('I', 'Indigo');
$view2->addProperty('V', 'Violet');
$view3 = new PHUIPropertyListView();
$view3->addSectionHeader('Haiku About Pasta');
$view3->addTextContent(hsprintf('this is a pasta<br />' . 'haiku. it is very bad.<br />' . 'what did you expect?'));
$object_box1 = id(new PHUIObjectBoxView())->setHeaderText('PHUIPropertyListView Stackered')->addPropertyList($view, $details1)->addPropertyList($view2, $details2)->addPropertyList($view3, $details3);
$edge_cases_view = new PHUIPropertyListView();
$edge_cases_view->addProperty(pht('Description'), pht('These layouts test UI edge cases in the element. This block ' . 'tests wrapping and overflow behavior.'));
$edge_cases_view->addProperty(pht('A Very Very Very Very Very Very Very Very Very Long Property Label'), pht('This property label and property value are quite long. They ' . 'demonstrate the wrapping behavior of the element, or lack thereof ' . 'if something terrible has happened.'));
$edge_cases_view->addProperty(pht('AVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongUnbrokenPropertyLabel'), pht('Thispropertylabelandpropertyvaluearequitelongandhave' . 'nospacestheydemonstratetheoverflowbehavioroftheelement' . 'orlackthereof.'));
$edge_cases_view->addProperty(pht('Description'), pht('The next section is an empty text block.'));
$edge_cases_view->addTextContent('');
$edge_cases_view->addProperty(pht('Description'), pht('This section should have multiple properties with the same name.'));
$edge_cases_view->addProperty(pht('Joe'), pht('Smith'));
$edge_cases_view->addProperty(pht('Joe'), pht('Smith'));
$edge_cases_view->addProperty(pht('Joe'), pht('Smith'));
$object_box2 = id(new PHUIObjectBoxView())->setHeaderText('Some Bad Examples')->addPropertyList($edge_cases_view);
return array($object_box1, $object_box2);
}
示例6: processDiffusionRequest
protected function processDiffusionRequest(AphrontRequest $request)
{
$user = $request->getUser();
// This controller doesn't use blob/path stuff, just pass the dictionary
// in directly instead of using the AphrontRequest parsing mechanism.
$data = $request->getURIMap();
$data['user'] = $user;
$drequest = DiffusionRequest::newFromDictionary($data);
$this->diffusionRequest = $drequest;
if ($request->getStr('diff')) {
return $this->buildRawDiffResponse($drequest);
}
$repository = $drequest->getRepository();
$callsign = $repository->getCallsign();
$content = array();
$commit = id(new DiffusionCommitQuery())->setViewer($request->getUser())->withRepository($repository)->withIdentifiers(array($drequest->getCommit()))->needCommitData(true)->needAuditRequests(true)->executeOne();
$crumbs = $this->buildCrumbs(array('commit' => true));
if (!$commit) {
$exists = $this->callConduitWithDiffusionRequest('diffusion.existsquery', array('commit' => $drequest->getCommit()));
if (!$exists) {
return new Aphront404Response();
}
$error = id(new PHUIInfoView())->setTitle(pht('Commit Still Parsing'))->appendChild(pht('Failed to load the commit because the commit has not been ' . 'parsed yet.'));
return $this->buildApplicationPage(array($crumbs, $error), array('title' => pht('Commit Still Parsing')));
}
$audit_requests = $commit->getAudits();
$this->auditAuthorityPHIDs = PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($user);
$commit_data = $commit->getCommitData();
$is_foreign = $commit_data->getCommitDetail('foreign-svn-stub');
if ($is_foreign) {
$subpath = $commit_data->getCommitDetail('svn-subpath');
$error_panel = new PHUIInfoView();
$error_panel->setTitle(pht('Commit Not Tracked'));
$error_panel->setSeverity(PHUIInfoView::SEVERITY_WARNING);
$error_panel->appendChild(pht("This Diffusion repository is configured to track only one " . "subdirectory of the entire Subversion repository, and this commit " . "didn't affect the tracked subdirectory ('%s'), so no " . "information is available.", $subpath));
$content[] = $error_panel;
} else {
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
$engine->setConfig('viewer', $user);
require_celerity_resource('phabricator-remarkup-css');
$parents = $this->callConduitWithDiffusionRequest('diffusion.commitparentsquery', array('commit' => $drequest->getCommit()));
if ($parents) {
$parents = id(new DiffusionCommitQuery())->setViewer($user)->withRepository($repository)->withIdentifiers($parents)->execute();
}
$headsup_view = id(new PHUIHeaderView())->setHeader(nonempty($commit->getSummary(), pht('Commit Detail')));
$headsup_actions = $this->renderHeadsupActionList($commit, $repository);
$commit_properties = $this->loadCommitProperties($commit, $commit_data, $parents, $audit_requests);
$property_list = id(new PHUIPropertyListView())->setHasKeyboardShortcuts(true)->setUser($user)->setObject($commit);
foreach ($commit_properties as $key => $value) {
$property_list->addProperty($key, $value);
}
$message = $commit_data->getCommitMessage();
$revision = $commit->getCommitIdentifier();
$message = $this->linkBugtraq($message);
$message = $engine->markupText($message);
$property_list->invokeWillRenderEvent();
$property_list->setActionList($headsup_actions);
$detail_list = new PHUIPropertyListView();
$detail_list->addSectionHeader(pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
$detail_list->addTextContent(phutil_tag('div', array('class' => 'diffusion-commit-message phabricator-remarkup'), $message));
$headsup_view->setTall(true);
$object_box = id(new PHUIObjectBoxView())->setHeader($headsup_view)->addPropertyList($property_list)->addPropertyList($detail_list);
$content[] = $object_box;
}
$content[] = $this->buildComments($commit);
$hard_limit = 1000;
if ($commit->isImported()) {
$change_query = DiffusionPathChangeQuery::newFromDiffusionRequest($drequest);
$change_query->setLimit($hard_limit + 1);
$changes = $change_query->loadChanges();
} else {
$changes = array();
}
$was_limited = count($changes) > $hard_limit;
if ($was_limited) {
$changes = array_slice($changes, 0, $hard_limit);
}
$content[] = $this->buildMergesTable($commit);
$highlighted_audits = $commit->getAuthorityAudits($user, $this->auditAuthorityPHIDs);
$count = count($changes);
$bad_commit = null;
if ($count == 0) {
$bad_commit = queryfx_one(id(new PhabricatorRepository())->establishConnection('r'), 'SELECT * FROM %T WHERE fullCommitName = %s', PhabricatorRepository::TABLE_BADCOMMIT, 'r' . $callsign . $commit->getCommitIdentifier());
}
$show_changesets = false;
if ($bad_commit) {
$content[] = $this->renderStatusMessage(pht('Bad Commit'), $bad_commit['description']);
} else {
if ($is_foreign) {
// Don't render anything else.
} else {
if (!$commit->isImported()) {
$content[] = $this->renderStatusMessage(pht('Still Importing...'), pht('This commit is still importing. Changes will be visible once ' . 'the import finishes.'));
} else {
if (!count($changes)) {
$content[] = $this->renderStatusMessage(pht('Empty Commit'), pht('This commit is empty and does not affect any paths.'));
} else {
if ($was_limited) {
$content[] = $this->renderStatusMessage(pht('Enormous Commit'), pht('This commit is enormous, and affects more than %d files. ' . 'Changes are not shown.', $hard_limit));
} else {
//.........這裏部分代碼省略.........
示例7: appendFieldsToPropertyList
public function appendFieldsToPropertyList(PhabricatorCustomFieldInterface $object, PhabricatorUser $viewer, PHUIPropertyListView $view)
{
$this->readFieldsFromStorage($object);
$fields = $this->fields;
foreach ($fields as $field) {
$field->setViewer($viewer);
}
// Move all the blocks to the end, regardless of their configuration order,
// because it always looks silly to render a block in the middle of a list
// of properties.
$head = array();
$tail = array();
foreach ($fields as $key => $field) {
$style = $field->getStyleForPropertyView();
switch ($style) {
case 'property':
case 'header':
$head[$key] = $field;
break;
case 'block':
$tail[$key] = $field;
break;
default:
throw new Exception(pht("Unknown field property view style '%s'; valid styles are " . "'%s' and '%s'.", $style, 'block', 'property'));
}
}
$fields = $head + $tail;
$add_header = null;
$phids = array();
foreach ($fields as $key => $field) {
$phids[$key] = $field->getRequiredHandlePHIDsForPropertyView();
}
$all_phids = array_mergev($phids);
if ($all_phids) {
$handles = id(new PhabricatorHandleQuery())->setViewer($viewer)->withPHIDs($all_phids)->execute();
} else {
$handles = array();
}
foreach ($fields as $key => $field) {
$field_handles = array_select_keys($handles, $phids[$key]);
$label = $field->renderPropertyViewLabel();
$value = $field->renderPropertyViewValue($field_handles);
if ($value !== null) {
switch ($field->getStyleForPropertyView()) {
case 'header':
// We want to hide headers if the fields the're assciated with
// don't actually produce any visible properties. For example, in a
// list like this:
//
// Header A
// Prop A: Value A
// Header B
// Prop B: Value B
//
// ...if the "Prop A" field returns `null` when rendering its
// property value and we rendered naively, we'd get this:
//
// Header A
// Header B
// Prop B: Value B
//
// This is silly. Instead, we hide "Header A".
$add_header = $value;
break;
case 'property':
if ($add_header !== null) {
// Add the most recently seen header.
$view->addSectionHeader($add_header);
$add_header = null;
}
$view->addProperty($label, $value);
break;
case 'block':
$icon = $field->getIconForPropertyView();
$view->invokeWillRenderEvent();
if ($label !== null) {
$view->addSectionHeader($label, $icon);
}
$view->addTextContent($value);
break;
}
}
}
}
示例8: buildDescriptionView
private function buildDescriptionView(ManiphestTask $task)
{
$viewer = $this->getViewer();
$section = null;
$description = $task->getDescription();
if (strlen($description)) {
$section = new PHUIPropertyListView();
$section->addTextContent(phutil_tag('div', array('class' => 'phabricator-remarkup'), id(new PHUIRemarkupView($viewer, $description))->setContextObject($task)));
}
return $section;
}
示例9: buildDescriptionView
private function buildDescriptionView(ManiphestTask $task, PhabricatorMarkupEngine $engine)
{
$section = null;
if (strlen($task->getDescription())) {
$section = new PHUIPropertyListView();
$section->addSectionHeader(pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
$section->addTextContent(phutil_tag('div', array('class' => 'phabricator-remarkup'), $engine->getOutput($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION)));
}
return $section;
}
示例10: handleRequest
public function handleRequest(AphrontRequest $request)
{
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$drequest = $this->getDiffusionRequest();
$viewer = $request->getUser();
if ($request->getStr('diff')) {
return $this->buildRawDiffResponse($drequest);
}
$repository = $drequest->getRepository();
$commit = id(new DiffusionCommitQuery())->setViewer($viewer)->withRepository($repository)->withIdentifiers(array($drequest->getCommit()))->needCommitData(true)->needAuditRequests(true)->executeOne();
$crumbs = $this->buildCrumbs(array('commit' => true));
$crumbs->setBorder(true);
if (!$commit) {
if (!$this->getCommitExists()) {
return new Aphront404Response();
}
$error = id(new PHUIInfoView())->setTitle(pht('Commit Still Parsing'))->appendChild(pht('Failed to load the commit because the commit has not been ' . 'parsed yet.'));
$title = pht('Commit Still Parsing');
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($error);
}
$audit_requests = $commit->getAudits();
$this->auditAuthorityPHIDs = PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($viewer);
$commit_data = $commit->getCommitData();
$is_foreign = $commit_data->getCommitDetail('foreign-svn-stub');
$error_panel = null;
if ($is_foreign) {
$subpath = $commit_data->getCommitDetail('svn-subpath');
$error_panel = new PHUIInfoView();
$error_panel->setTitle(pht('Commit Not Tracked'));
$error_panel->setSeverity(PHUIInfoView::SEVERITY_WARNING);
$error_panel->appendChild(pht("This Diffusion repository is configured to track only one " . "subdirectory of the entire Subversion repository, and this commit " . "didn't affect the tracked subdirectory ('%s'), so no " . "information is available.", $subpath));
} else {
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
$engine->setConfig('viewer', $viewer);
$commit_tag = $this->renderCommitHashTag($drequest);
$header = id(new PHUIHeaderView())->setHeader(nonempty($commit->getSummary(), pht('Commit Detail')))->setHeaderIcon('fa-code-fork')->addTag($commit_tag);
if ($commit->getAuditStatus()) {
$icon = PhabricatorAuditCommitStatusConstants::getStatusIcon($commit->getAuditStatus());
$color = PhabricatorAuditCommitStatusConstants::getStatusColor($commit->getAuditStatus());
$status = PhabricatorAuditCommitStatusConstants::getStatusName($commit->getAuditStatus());
$header->setStatus($icon, $color, $status);
}
$curtain = $this->buildCurtain($commit, $repository);
$subheader = $this->buildSubheaderView($commit, $commit_data);
$details = $this->buildPropertyListView($commit, $commit_data, $audit_requests);
$message = $commit_data->getCommitMessage();
$revision = $commit->getCommitIdentifier();
$message = $this->linkBugtraq($message);
$message = $engine->markupText($message);
$detail_list = new PHUIPropertyListView();
$detail_list->addTextContent(phutil_tag('div', array('class' => 'diffusion-commit-message phabricator-remarkup'), $message));
if ($this->getCommitErrors()) {
$error_panel = id(new PHUIInfoView())->appendChild($this->getCommitErrors())->setSeverity(PHUIInfoView::SEVERITY_WARNING);
}
}
$timeline = $this->buildComments($commit);
$hard_limit = 1000;
if ($commit->isImported()) {
$change_query = DiffusionPathChangeQuery::newFromDiffusionRequest($drequest);
$change_query->setLimit($hard_limit + 1);
$changes = $change_query->loadChanges();
} else {
$changes = array();
}
$was_limited = count($changes) > $hard_limit;
if ($was_limited) {
$changes = array_slice($changes, 0, $hard_limit);
}
$merge_table = $this->buildMergesTable($commit);
$highlighted_audits = $commit->getAuthorityAudits($viewer, $this->auditAuthorityPHIDs);
$count = count($changes);
$bad_commit = null;
if ($count == 0) {
$bad_commit = queryfx_one(id(new PhabricatorRepository())->establishConnection('r'), 'SELECT * FROM %T WHERE fullCommitName = %s', PhabricatorRepository::TABLE_BADCOMMIT, $commit->getMonogram());
}
$show_changesets = false;
$info_panel = null;
$change_list = null;
$change_table = null;
if ($bad_commit) {
$info_panel = $this->renderStatusMessage(pht('Bad Commit'), $bad_commit['description']);
} else {
if ($is_foreign) {
// Don't render anything else.
} else {
if (!$commit->isImported()) {
$info_panel = $this->renderStatusMessage(pht('Still Importing...'), pht('This commit is still importing. Changes will be visible once ' . 'the import finishes.'));
} else {
if (!count($changes)) {
$info_panel = $this->renderStatusMessage(pht('Empty Commit'), pht('This commit is empty and does not affect any paths.'));
} else {
if ($was_limited) {
$info_panel = $this->renderStatusMessage(pht('Enormous Commit'), pht('This commit is enormous, and affects more than %d files. ' . 'Changes are not shown.', $hard_limit));
} else {
if (!$this->getCommitExists()) {
$info_panel = $this->renderStatusMessage(pht('Commit No Longer Exists'), pht('This commit no longer exists in the repository.'));
} else {
//.........這裏部分代碼省略.........