本文整理汇总了PHP中AphrontPanelView::render方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontPanelView::render方法的具体用法?PHP AphrontPanelView::render怎么用?PHP AphrontPanelView::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AphrontPanelView
的用法示例。
在下文中一共展示了AphrontPanelView::render方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render()
{
DarkConsoleXHProfPluginAPI::includeXHProfLib();
$data = $this->profileData;
$GLOBALS['display_calls'] = true;
$totals = array();
$flat = xhprof_compute_flat_info($data, $totals);
unset($GLOBALS['display_calls']);
$symbol = $this->symbol;
$children = array();
$parents = array();
foreach ($this->profileData as $key => $counters) {
if (strpos($key, '==>') !== false) {
list($parent, $child) = explode('==>', $key, 2);
} else {
continue;
}
if ($parent == $symbol) {
$children[$key] = $child;
} else {
if ($child == $symbol) {
$parents[$key] = $parent;
}
}
}
$base_uri = $this->baseURI;
$rows = array();
$rows[] = array('Metrics for this Call', '', '', '');
$rows[] = array(phutil_render_tag('a', array('href' => $base_uri . '?symbol=' . $symbol), phutil_escape_html($symbol)), $flat[$symbol]['ct'], $flat[$symbol]['wt'], '100%');
$rows[] = array('Parent Calls', '', '', '');
foreach ($parents as $key => $name) {
$rows[] = array(phutil_render_tag('a', array('href' => $base_uri . '?symbol=' . $name), phutil_escape_html($name)), $data[$key]['ct'], $data[$key]['wt'], '');
}
$rows[] = array('Child Calls', '', '', '');
$child_rows = array();
foreach ($children as $key => $name) {
$child_rows[] = array($name, $data[$key]['ct'], $data[$key]['wt'], $data[$key]['wt'] / $flat[$symbol]['wt']);
}
$child_rows = isort($child_rows, 2);
$child_rows = array_reverse($child_rows);
$rows = array_merge($rows, $this->formatRows($child_rows));
$table = new AphrontTableView($rows);
$table->setHeaders(array('Symbol', 'Count', 'Wall Time', '%'));
$table->setColumnClasses(array('wide pri', 'n', 'n', 'n'));
$panel = new AphrontPanelView();
$panel->setHeader('XHProf Profile');
$panel->appendChild($table);
return $panel->render();
}
示例2: render
public function render()
{
$user = $this->getUser();
if (!$user) {
throw new Exception("Call setUser() before render()!");
}
$form = new AphrontFormView();
$form->setAction('/file/upload/');
$form->setUser($user);
$form->setEncType('multipart/form-data')->appendChild(id(new AphrontFormFileControl())->setLabel('File')->setName('file')->setError(true))->appendChild(id(new AphrontFormTextControl())->setLabel('Name')->setName('name')->setCaption('Optional file display name.'))->appendChild(id(new AphrontFormSubmitControl())->setValue('Upload')->addCancelButton('/file/'));
$panel = new AphrontPanelView();
$panel->setHeader('Upload File');
$panel->appendChild($form);
$panel->setWidth(AphrontPanelView::WIDTH_FULL);
return $panel->render();
}
示例3: render
public function render()
{
DarkConsoleXHProfPluginAPI::includeXHProfLib();
$GLOBALS['display_calls'] = true;
$totals = array();
$flat = xhprof_compute_flat_info($this->profileData, $totals);
unset($GLOBALS['display_calls']);
$aggregated = array();
foreach ($flat as $call => $counters) {
$parts = explode('@', $call, 2);
$agg_call = reset($parts);
if (empty($aggregated[$agg_call])) {
$aggregated[$agg_call] = $counters;
} else {
foreach ($aggregated[$agg_call] as $key => $val) {
if ($key != 'wt') {
$aggregated[$agg_call][$key] += $counters[$key];
}
}
}
}
$flat = $aggregated;
$flat = isort($flat, 'wt');
$flat = array_reverse($flat);
$rows = array();
$rows[] = array('Total', number_format($totals['ct']), number_format($totals['wt']) . ' us', '100.0%', number_format($totals['wt']) . ' us', '100.0%');
if ($this->limit) {
$flat = array_slice($flat, 0, $this->limit);
}
foreach ($flat as $call => $counters) {
$rows[] = array($this->renderSymbolLink($call), number_format($counters['ct']), number_format($counters['wt']) . ' us', sprintf('%.1f%%', 100 * $counters['wt'] / $totals['wt']), number_format($counters['excl_wt']) . ' us', sprintf('%.1f%%', 100 * $counters['excl_wt'] / $totals['wt']));
}
Javelin::initBehavior('phabricator-tooltips');
$table = new AphrontTableView($rows);
$table->setHeaders(array('Symbol', 'Count', javelin_render_tag('span', array('sigil' => 'has-tooltip', 'meta' => array('tip' => 'Total wall time spent in this function and all of ' . 'its children (chilren are other functions it called ' . 'while executing).', 'size' => 200)), 'Wall Time (Inclusive)'), '%', javelin_render_tag('span', array('sigil' => 'has-tooltip', 'meta' => array('tip' => 'Wall time spent in this function, excluding time ' . 'spent in children (children are other functions it ' . 'called while executing).', 'size' => 200)), 'Wall Time (Exclusive)'), '%'));
$table->setColumnClasses(array('wide pri', 'n', 'n', 'n', 'n', 'n'));
$panel = new AphrontPanelView();
$panel->setHeader('XHProf Profile');
if ($this->file) {
$panel->addButton(phutil_render_tag('a', array('href' => $this->file->getBestURI(), 'class' => 'green button'), 'Download .xhprof Profile'));
}
$panel->appendChild($table);
return $panel->render();
}
示例4: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$nav = $this->buildBaseSideNav();
$queries = id(new ManiphestSavedQuery())->loadAllWhere('userPHID = %s ORDER BY name ASC', $user->getPHID());
$default = null;
if ($request->isFormPost()) {
$new_default = null;
foreach ($queries as $query) {
if ($query->getID() == $request->getInt('default')) {
$new_default = $query;
}
}
if ($this->getDefaultQuery()) {
$this->getDefaultQuery()->setIsDefault(0)->save();
}
if ($new_default) {
$new_default->setIsDefault(1)->save();
}
return id(new AphrontRedirectResponse())->setURI('/maniphest/custom/');
}
$rows = array();
foreach ($queries as $query) {
if ($query->getIsDefault()) {
$default = $query;
}
$rows[] = array(phutil_render_tag('input', array('type' => 'radio', 'name' => 'default', 'value' => $query->getID(), 'checked' => $query->getIsDefault() ? 'checked' : null)), phutil_render_tag('a', array('href' => '/maniphest/view/custom/?key=' . $query->getQueryKey()), phutil_escape_html($query->getName())), phutil_render_tag('a', array('href' => '/maniphest/custom/edit/' . $query->getID() . '/', 'class' => 'grey small button'), 'Edit'), javelin_render_tag('a', array('href' => '/maniphest/custom/delete/' . $query->getID() . '/', 'class' => 'grey small button', 'sigil' => 'workflow'), 'Delete'));
}
$rows[] = array(phutil_render_tag('input', array('type' => 'radio', 'name' => 'default', 'value' => 0, 'checked' => $default === null ? 'checked' : null)), '<em>No Default</em>', '', '');
$table = new AphrontTableView($rows);
$table->setHeaders(array('Default', 'Name', 'Edit', 'Delete'));
$table->setColumnClasses(array('radio', 'wide pri', 'action', 'action'));
$panel = new AphrontPanelView();
$panel->setHeader('Saved Custom Queries');
$panel->addButton(phutil_render_tag('button', array(), 'Save Default Query'));
$panel->appendChild($table);
$form = phabricator_render_form($user, array('method' => 'POST', 'action' => $request->getRequestURI()), $panel->render());
$nav->selectFilter('saved', 'saved');
$nav->appendChild($form);
return $this->buildStandardPageResponse($nav, array('title' => 'Saved Queries'));
}
示例5: render
public function render()
{
DarkConsoleXHProfPluginAPI::includeXHProfLib();
$GLOBALS['display_calls'] = true;
$totals = array();
$flat = xhprof_compute_flat_info($this->profileData, $totals);
unset($GLOBALS['display_calls']);
$aggregated = array();
foreach ($flat as $call => $counters) {
$parts = explode('@', $call, 2);
$agg_call = reset($parts);
if (empty($aggregated[$agg_call])) {
$aggregated[$agg_call] = $counters;
} else {
foreach ($aggregated[$agg_call] as $key => $val) {
if ($key != 'wt') {
$aggregated[$agg_call][$key] += $counters[$key];
}
}
}
}
$flat = $aggregated;
$flat = isort($flat, 'wt');
$flat = array_reverse($flat);
$rows = array();
$rows[] = array('Total', number_format($totals['ct']), number_format($totals['wt']) . ' us', '100.0%', number_format($totals['wt']) . ' us', '100.0%');
if ($this->limit) {
$flat = array_slice($flat, 0, $this->limit);
}
$base_uri = $this->baseURI;
foreach ($flat as $call => $counters) {
$rows[] = array(phutil_render_tag('a', array('href' => $base_uri . '?symbol=' . $call), phutil_escape_html($call)), number_format($counters['ct']), number_format($counters['wt']) . ' us', sprintf('%.1f%%', 100 * $counters['wt'] / $totals['wt']), number_format($counters['excl_wt']) . ' us', sprintf('%.1f%%', 100 * $counters['excl_wt'] / $totals['wt']));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('Symbol', 'Count', 'Incl Wall Time', '%', 'Excl Wall Time', '%'));
$table->setColumnClasses(array('wide pri', 'n', 'n', 'n', 'n', 'n'));
$panel = new AphrontPanelView();
$panel->setHeader('XHProf Profile');
$panel->appendChild($table);
return $panel->render();
}
示例6: render
public function render()
{
require_celerity_resource('differential-revision-add-comment-css');
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
$revision = $this->revision;
$form = new AphrontFormView();
$form->setWorkflow(true)->setUser($this->user)->setAction($this->actionURI)->addHiddenInput('revision_id', $revision->getID())->appendChild(id(new AphrontFormSelectControl())->setLabel('Action')->setName('action')->setID('comment-action')->setOptions($this->actions))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('Add Reviewers')->setName('reviewers')->setControlID('add-reviewers')->setControlStyle('display: none')->setID('add-reviewers-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('Add CCs')->setName('ccs')->setControlID('add-ccs')->setControlStyle('display: none')->setID('add-ccs-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormTextAreaControl())->setName('comment')->setID('comment-content')->setLabel('Comment')->setEnableDragAndDropFileUploads(true)->setValue($this->draft)->setCaption(phutil_render_tag('a', array('href' => PhabricatorEnv::getDoclink('article/Remarkup_Reference.html'), 'tabindex' => '-1', 'target' => '_blank'), 'Formatting Reference')))->appendChild(id(new AphrontFormSubmitControl())->setValue($is_serious ? 'Submit' : 'Clowncopterize'));
Javelin::initBehavior('differential-add-reviewers-and-ccs', array('dynamic' => array('add-reviewers-tokenizer' => array('actions' => array('request_review' => 1, 'add_reviewers' => 1), 'src' => '/typeahead/common/users/', 'row' => 'add-reviewers', 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), 'placeholder' => 'Type a user name...'), 'add-ccs-tokenizer' => array('actions' => array('add_ccs' => 1), 'src' => '/typeahead/common/mailable/', 'row' => 'add-ccs', 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), 'placeholder' => 'Type a user or mailing list...')), 'select' => 'comment-action'));
$diff = $revision->loadActiveDiff();
$warnings = mpull($this->auxFields, 'renderWarningBoxForRevisionAccept');
$lint_warning = null;
$unit_warning = null;
Javelin::initBehavior('differential-accept-with-errors', array('select' => 'comment-action', 'warnings' => 'warnings'));
$rev_id = $revision->getID();
Javelin::initBehavior('differential-feedback-preview', array('uri' => '/differential/comment/preview/' . $rev_id . '/', 'preview' => 'comment-preview', 'action' => 'comment-action', 'content' => 'comment-content', 'previewTokenizers' => array('reviewers' => 'add-reviewers-tokenizer', 'ccs' => 'add-ccs-tokenizer'), 'inlineuri' => '/differential/comment/inline/preview/' . $rev_id . '/', 'inline' => 'inline-comment-preview'));
$panel_view = new AphrontPanelView();
$panel_view->appendChild($form);
$warning_container = '<div id="warnings">';
foreach ($warnings as $warning) {
if ($warning) {
$warning_container .= $warning->render();
}
}
$warning_container .= '</div>';
$panel_view->appendChild($warning_container);
if ($lint_warning) {
$panel_view->appendChild($lint_warning);
}
if ($unit_warning) {
$panel_view->appendChild($unit_warning);
}
$panel_view->setHeader($is_serious ? 'Add Comment' : 'Leap Into Action');
$panel_view->addClass('aphront-panel-accent');
$panel_view->addClass('aphront-panel-flush');
return '<div class="differential-add-comment-panel">' . $panel_view->render() . '<div class="aphront-panel-preview aphront-panel-flush">' . '<div id="comment-preview">' . '<span class="aphront-panel-preview-loading-text">' . 'Loading comment preview...' . '</span>' . '</div>' . '<div id="inline-comment-preview">' . '</div>' . '</div>' . '</div>';
}
示例7: renderAddCommentPanel
private function renderAddCommentPanel(PhabricatorRepositoryCommit $commit, array $audit_requests, $pane_id = null)
{
assert_instances_of($audit_requests, 'PhabricatorRepositoryAuditRequest');
$user = $this->getRequest()->getUser();
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
Javelin::initBehavior('differential-keyboard-navigation', array('haunt' => $pane_id));
$draft = id(new PhabricatorDraft())->loadOneWhere('authorPHID = %s AND draftKey = %s', $user->getPHID(), 'diffusion-audit-' . $commit->getID());
if ($draft) {
$draft = $draft->getDraft();
} else {
$draft = null;
}
$actions = $this->getAuditActions($commit, $audit_requests);
$form = id(new AphrontFormView())->setUser($user)->setAction('/audit/addcomment/')->addHiddenInput('commit', $commit->getPHID())->appendChild(id(new AphrontFormSelectControl())->setLabel('Action')->setName('action')->setID('audit-action')->setOptions($actions))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('Add Auditors')->setName('auditors')->setControlID('add-auditors')->setControlStyle('display: none')->setID('add-auditors-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('Add CCs')->setName('ccs')->setControlID('add-ccs')->setControlStyle('display: none')->setID('add-ccs-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Comments')->setName('content')->setValue($draft)->setID('audit-content')->setCaption(phutil_render_tag('a', array('href' => PhabricatorEnv::getDoclink('article/Remarkup_Reference.html'), 'tabindex' => '-1', 'target' => '_blank'), 'Formatting Reference')))->appendChild(id(new AphrontFormSubmitControl())->setValue($is_serious ? 'Submit' : 'Cook the Books'));
$panel = new AphrontPanelView();
$panel->setHeader($is_serious ? 'Audit Commit' : 'Creative Accounting');
$panel->appendChild($form);
$panel->addClass('aphront-panel-accent');
$panel->addClass('aphront-panel-flush');
require_celerity_resource('phabricator-transaction-view-css');
Javelin::initBehavior('differential-add-reviewers-and-ccs', array('dynamic' => array('add-auditors-tokenizer' => array('actions' => array('add_auditors' => 1), 'src' => '/typeahead/common/users/', 'row' => 'add-auditors', 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), 'placeholder' => 'Type a user name...'), 'add-ccs-tokenizer' => array('actions' => array('add_ccs' => 1), 'src' => '/typeahead/common/mailable/', 'row' => 'add-ccs', 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), 'placeholder' => 'Type a user or mailing list...')), 'select' => 'audit-action'));
Javelin::initBehavior('differential-feedback-preview', array('uri' => '/audit/preview/' . $commit->getID() . '/', 'preview' => 'audit-preview', 'content' => 'audit-content', 'action' => 'audit-action', 'previewTokenizers' => array('auditors' => 'add-auditors-tokenizer', 'ccs' => 'add-ccs-tokenizer'), 'inline' => 'inline-comment-preview', 'inlineuri' => '/diffusion/inline/preview/' . $commit->getPHID() . '/'));
$preview_panel = '<div class="aphront-panel-preview aphront-panel-flush">
<div id="audit-preview">
<div class="aphront-panel-preview-loading-text">
Loading preview...
</div>
</div>
<div id="inline-comment-preview">
</div>
</div>';
return phutil_render_tag('div', array('class' => 'differential-add-comment-panel'), $panel->render() . $preview_panel);
}
示例8: render
public function render()
{
require_celerity_resource('differential-revision-add-comment-css');
$revision = $this->revision;
$actions = array();
foreach ($this->actions as $action) {
$actions[$action] = DifferentialAction::getActionVerb($action);
}
$form = new AphrontFormView();
$form->setUser($this->user)->setAction($this->actionURI)->addHiddenInput('revision_id', $revision->getID())->appendChild(id(new AphrontFormSelectControl())->setLabel('Action')->setName('action')->setID('comment-action')->setOptions($actions))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('Add Reviewers')->setName('reviewers')->setControlID('add-reviewers')->setControlStyle('display: none')->setID('add-reviewers-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('Add CCs')->setName('ccs')->setControlID('add-ccs')->setControlStyle('display: none')->setID('add-ccs-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormTextAreaControl())->setName('comment')->setID('comment-content')->setLabel('Comment')->setEnableDragAndDropFileUploads(true)->setValue($this->draft))->appendChild(id(new AphrontFormSubmitControl())->setValue('Clowncopterize'));
Javelin::initBehavior('differential-add-reviewers-and-ccs', array('dynamic' => array('add_reviewers' => array('tokenizer' => 'add-reviewers-tokenizer', 'src' => '/typeahead/common/users/', 'row' => 'add-reviewers'), 'add_ccs' => array('tokenizer' => 'add-ccs-tokenizer', 'src' => '/typeahead/common/mailable/', 'row' => 'add-ccs')), 'select' => 'comment-action'));
$diff = $revision->loadActiveDiff();
$lint_warning = null;
$unit_warning = null;
if ($diff->getLintStatus() >= DifferentialLintStatus::LINT_WARN) {
$titles = array(DifferentialLintStatus::LINT_WARN => 'Lint Warning', DifferentialLintStatus::LINT_FAIL => 'Lint Failure', DifferentialLintStatus::LINT_SKIP => 'Lint Skipped');
$content = "<p>This diff has Lint Problems. Make sure you are OK with them " . "before you accept this diff.</p>";
$lint_warning = $this->generateWarningView($diff->getLintStatus(), $titles, 'lint-warning', $content);
}
if ($diff->getUnitStatus() >= DifferentialUnitStatus::UNIT_WARN) {
$titles = array(DifferentialUnitStatus::UNIT_WARN => 'Unit Tests Warning', DifferentialUnitStatus::UNIT_FAIL => 'Unit Tests Failure', DifferentialUnitStatus::UNIT_SKIP => 'Unit Tests Skipped', DifferentialUnitStatus::UNIT_POSTPONED => 'Unit Tests Postponed');
$content = "<p>This diff has Unit Test Problems. Make sure you are OK with them " . "before you accept this diff.</p>";
$unit_warning = $this->generateWarningView($diff->getUnitStatus(), $titles, 'unit-warning', $content);
}
Javelin::initBehavior('differential-accept-with-errors', array('select' => 'comment-action', 'lint_warning' => $lint_warning ? 'lint-warning' : null, 'unit_warning' => $unit_warning ? 'unit-warning' : null));
$rev_id = $revision->getID();
Javelin::initBehavior('differential-feedback-preview', array('uri' => '/differential/comment/preview/' . $rev_id . '/', 'preview' => 'comment-preview', 'action' => 'comment-action', 'content' => 'comment-content', 'inlineuri' => '/differential/comment/inline/preview/' . $rev_id . '/', 'inline' => 'inline-comment-preview'));
$panel_view = new AphrontPanelView();
$panel_view->appendChild($form);
if ($lint_warning) {
$panel_view->appendChild($lint_warning);
}
if ($unit_warning) {
$panel_view->appendChild($unit_warning);
}
$panel_view->setHeader('Leap Into Action');
$panel_view->addClass('aphront-panel-accent');
$panel_view->addClass('aphront-panel-flush');
return '<div class="differential-add-comment-panel">' . $panel_view->render() . '<div class="aphront-panel-preview aphront-panel-flush">' . '<div id="comment-preview">' . '<span class="aphront-panel-preview-loading-text">' . 'Loading comment preview...' . '</span>' . '</div>' . '<div id="inline-comment-preview">' . '</div>' . '</div>' . '</div>';
}
示例9: render
public function render()
{
require_celerity_resource('differential-revision-add-comment-css');
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
$revision = $this->revision;
$form = new AphrontFormView();
$form->setUser($this->user)->setAction($this->actionURI)->addHiddenInput('revision_id', $revision->getID())->appendChild(id(new AphrontFormSelectControl())->setLabel('Action')->setName('action')->setID('comment-action')->setOptions($this->actions))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('Add Reviewers')->setName('reviewers')->setControlID('add-reviewers')->setControlStyle('display: none')->setID('add-reviewers-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('Add CCs')->setName('ccs')->setControlID('add-ccs')->setControlStyle('display: none')->setID('add-ccs-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormTextAreaControl())->setName('comment')->setID('comment-content')->setLabel('Comment')->setEnableDragAndDropFileUploads(true)->setValue($this->draft)->setCaption(phutil_render_tag('a', array('href' => PhabricatorEnv::getDoclink('article/Remarkup_Reference.html'), 'tabindex' => '-1', 'target' => '_blank'), 'Formatting Reference')))->appendChild(id(new AphrontFormSubmitControl())->setValue($is_serious ? 'Submit' : 'Clowncopterize'));
Javelin::initBehavior('differential-add-reviewers-and-ccs', array('dynamic' => array('add_reviewers' => array('tokenizer' => 'add-reviewers-tokenizer', 'src' => '/typeahead/common/users/', 'row' => 'add-reviewers', 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand')), 'add_ccs' => array('tokenizer' => 'add-ccs-tokenizer', 'src' => '/typeahead/common/mailable/', 'row' => 'add-ccs', 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'))), 'select' => 'comment-action'));
$diff = $revision->loadActiveDiff();
$lint_warning = null;
$unit_warning = null;
if ($diff->getLintStatus() >= DifferentialLintStatus::LINT_WARN) {
$titles = array(DifferentialLintStatus::LINT_WARN => 'Lint Warning', DifferentialLintStatus::LINT_FAIL => 'Lint Failure', DifferentialLintStatus::LINT_SKIP => 'Lint Skipped');
$content = "<p>This diff has Lint Problems. Make sure you are OK with them " . "before you accept this diff.</p>";
$lint_warning = $this->generateWarningView($diff->getLintStatus(), $titles, 'lint-warning', $content);
}
if ($diff->getUnitStatus() >= DifferentialUnitStatus::UNIT_WARN) {
$titles = array(DifferentialUnitStatus::UNIT_WARN => 'Unit Tests Warning', DifferentialUnitStatus::UNIT_FAIL => 'Unit Tests Failure', DifferentialUnitStatus::UNIT_SKIP => 'Unit Tests Skipped', DifferentialUnitStatus::UNIT_POSTPONED => 'Unit Tests Postponed');
if ($diff->getUnitStatus() == DifferentialUnitStatus::UNIT_POSTPONED) {
$content = "<p>This diff has postponed unit tests. The results should be " . "coming in soon. You should probably wait for them before accepting " . "this diff.</p>";
} else {
$content = "<p>This diff has Unit Test Problems. Make sure you are OK with " . "them before you accept this diff.</p>";
}
$unit_warning = $this->generateWarningView($diff->getUnitStatus(), $titles, 'unit-warning', $content);
}
Javelin::initBehavior('differential-accept-with-errors', array('select' => 'comment-action', 'lint_warning' => $lint_warning ? 'lint-warning' : null, 'unit_warning' => $unit_warning ? 'unit-warning' : null));
$rev_id = $revision->getID();
Javelin::initBehavior('differential-feedback-preview', array('uri' => '/differential/comment/preview/' . $rev_id . '/', 'preview' => 'comment-preview', 'action' => 'comment-action', 'content' => 'comment-content', 'previewTokenizers' => array('reviewers' => 'add-reviewers-tokenizer', 'ccs' => 'add-ccs-tokenizer'), 'inlineuri' => '/differential/comment/inline/preview/' . $rev_id . '/', 'inline' => 'inline-comment-preview'));
$panel_view = new AphrontPanelView();
$panel_view->appendChild($form);
if ($lint_warning) {
$panel_view->appendChild($lint_warning);
}
if ($unit_warning) {
$panel_view->appendChild($unit_warning);
}
$panel_view->setHeader($is_serious ? 'Add Comment' : 'Leap Into Action');
$panel_view->addClass('aphront-panel-accent');
$panel_view->addClass('aphront-panel-flush');
return '<div class="differential-add-comment-panel">' . $panel_view->render() . '<div class="aphront-panel-preview aphront-panel-flush">' . '<div id="comment-preview">' . '<span class="aphront-panel-preview-loading-text">' . 'Loading comment preview...' . '</span>' . '</div>' . '<div id="inline-comment-preview">' . '</div>' . '</div>' . '</div>';
}
示例10: render
public function render()
{
require_celerity_resource('differential-revision-add-comment-css');
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
$revision = $this->revision;
$action = null;
if ($this->draft) {
$action = idx($this->draft->getMetadata(), 'action');
}
$enable_reviewers = DifferentialAction::allowReviewers($action);
$enable_ccs = $action == DifferentialAction::ACTION_ADDCCS;
$form = new AphrontFormView();
$form->setWorkflow(true)->setUser($this->user)->setAction($this->actionURI)->addHiddenInput('revision_id', $revision->getID())->appendChild(id(new AphrontFormSelectControl())->setLabel('Action')->setName('action')->setValue($action)->setID('comment-action')->setOptions($this->actions))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('Add Reviewers')->setName('reviewers')->setControlID('add-reviewers')->setControlStyle($enable_reviewers ? null : 'display: none')->setID('add-reviewers-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('Add CCs')->setName('ccs')->setControlID('add-ccs')->setControlStyle($enable_ccs ? null : 'display: none')->setID('add-ccs-tokenizer')->setDisableBehavior(true))->appendChild(id(new PhabricatorRemarkupControl())->setName('comment')->setID('comment-content')->setLabel('Comment')->setValue($this->draft ? $this->draft->getDraft() : null))->appendChild(id(new AphrontFormSubmitControl())->setValue($is_serious ? 'Submit' : 'Clowncopterize'));
Javelin::initBehavior('differential-add-reviewers-and-ccs', array('dynamic' => array('add-reviewers-tokenizer' => array('actions' => array('request_review' => 1, 'add_reviewers' => 1), 'src' => '/typeahead/common/users/', 'value' => $this->reviewers, 'row' => 'add-reviewers', 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), 'placeholder' => 'Type a user name...'), 'add-ccs-tokenizer' => array('actions' => array('add_ccs' => 1), 'src' => '/typeahead/common/mailable/', 'value' => $this->ccs, 'row' => 'add-ccs', 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), 'placeholder' => 'Type a user or mailing list...')), 'select' => 'comment-action'));
$diff = $revision->loadActiveDiff();
$warnings = mpull($this->auxFields, 'renderWarningBoxForRevisionAccept');
$lint_warning = null;
$unit_warning = null;
Javelin::initBehavior('differential-accept-with-errors', array('select' => 'comment-action', 'warnings' => 'warnings'));
$rev_id = $revision->getID();
Javelin::initBehavior('differential-feedback-preview', array('uri' => '/differential/comment/preview/' . $rev_id . '/', 'preview' => 'comment-preview', 'action' => 'comment-action', 'content' => 'comment-content', 'previewTokenizers' => array('reviewers' => 'add-reviewers-tokenizer', 'ccs' => 'add-ccs-tokenizer'), 'inlineuri' => '/differential/comment/inline/preview/' . $rev_id . '/', 'inline' => 'inline-comment-preview'));
$panel_view = new AphrontPanelView();
$panel_view->appendChild($form);
$warning_container = '<div id="warnings">';
foreach ($warnings as $warning) {
if ($warning) {
$warning_container .= $warning->render();
}
}
$warning_container .= '</div>';
$panel_view->appendChild($warning_container);
if ($lint_warning) {
$panel_view->appendChild($lint_warning);
}
if ($unit_warning) {
$panel_view->appendChild($unit_warning);
}
$panel_view->setHeader($is_serious ? 'Add Comment' : 'Leap Into Action');
$panel_view->addClass('aphront-panel-accent');
$panel_view->addClass('aphront-panel-flush');
return id(new PhabricatorAnchorView())->setAnchorName('comment')->setNavigationMarker(true)->render() . '<div class="differential-add-comment-panel">' . $panel_view->render() . '<div class="aphront-panel-preview aphront-panel-flush">' . '<div id="comment-preview">' . '<span class="aphront-panel-preview-loading-text">' . 'Loading comment preview...' . '</span>' . '</div>' . '<div id="inline-comment-preview">' . '</div>' . '</div>' . '</div>';
}