本文整理汇总了PHP中AphrontPanelView::addClass方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontPanelView::addClass方法的具体用法?PHP AphrontPanelView::addClass怎么用?PHP AphrontPanelView::addClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AphrontPanelView
的用法示例。
在下文中一共展示了AphrontPanelView::addClass方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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>';
}
示例2: buildJumpPanel
private function buildJumpPanel($query = null)
{
$request = $this->getRequest();
$user = $request->getUser();
$uniq_id = celerity_generate_unique_node_id();
Javelin::initBehavior('phabricator-autofocus', array('id' => $uniq_id));
require_celerity_resource('phabricator-jump-nav');
$doc_href = PhabricatorEnv::getDocLink('article/Jump_Nav_User_Guide.html');
$doc_link = phutil_render_tag('a', array('href' => $doc_href), 'Jump Nav User Guide');
$jump_input = phutil_render_tag('input', array('type' => 'text', 'class' => 'phabricator-jump-nav', 'name' => 'jump', 'id' => $uniq_id, 'value' => $query));
$jump_caption = phutil_render_tag('p', array('class' => 'phabricator-jump-nav-caption'), 'Enter the name of an object like <tt>D123</tt> to quickly jump to ' . 'it. See ' . $doc_link . ' or type <tt>help</tt>.');
$panel = new AphrontPanelView();
$panel->addClass('aphront-unpadded-panel-view');
$panel->appendChild(phabricator_render_form($user, array('action' => '/jump/', 'method' => 'POST', 'class' => 'phabricator-jump-nav-form'), $jump_input . $jump_caption));
return $panel;
}
示例3: 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>';
}
示例4: 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);
}
示例5: 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>';
}
示例6: processRequest
//.........这里部分代码省略.........
$actions[] = $action;
} else {
$action = new AphrontHeadsupActionView();
$action->setClass('phabricator-flag-ghost');
$action->setURI('/flag/edit/' . $task->getPHID() . '/');
$action->setName('Flag Task');
$action->setWorkflow(true);
$actions[] = $action;
}
require_celerity_resource('phabricator-object-selector-css');
require_celerity_resource('javelin-behavior-phabricator-object-selector');
$action = new AphrontHeadsupActionView();
$action->setName('Merge Duplicates');
$action->setURI('/search/attach/' . $task->getPHID() . '/TASK/merge/');
$action->setWorkflow(true);
$action->setClass('action-merge');
$actions[] = $action;
$action = new AphrontHeadsupActionView();
$action->setName('Create Subtask');
$action->setURI('/maniphest/task/create/?parent=' . $task->getID());
$action->setClass('action-branch');
$actions[] = $action;
$action = new AphrontHeadsupActionView();
$action->setName('Edit Dependencies');
$action->setURI('/search/attach/' . $task->getPHID() . '/TASK/dependencies/');
$action->setWorkflow(true);
$action->setClass('action-dependencies');
$actions[] = $action;
$action = new AphrontHeadsupActionView();
$action->setName('Edit Differential Revisions');
$action->setURI('/search/attach/' . $task->getPHID() . '/DREV/');
$action->setWorkflow(true);
$action->setClass('action-attach');
$actions[] = $action;
$action_list = new AphrontHeadsupActionListView();
$action_list->setActions($actions);
$headsup_panel = new AphrontHeadsupView();
$headsup_panel->setObjectName('T' . $task->getID());
$headsup_panel->setHeader($task->getTitle());
$headsup_panel->setActionList($action_list);
$headsup_panel->setProperties($dict);
$engine = new PhabricatorMarkupEngine();
$engine->setViewer($user);
$engine->addObject($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION);
foreach ($transactions as $xaction) {
if ($xaction->hasComments()) {
$engine->addObject($xaction, ManiphestTransaction::MARKUP_FIELD_BODY);
}
}
$engine->process();
$headsup_panel->appendChild('<div class="phabricator-remarkup">' . $engine->getOutput($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION) . '</div>');
$transaction_types = ManiphestTransactionType::getTransactionTypeMap();
$resolution_types = ManiphestTaskStatus::getTaskStatusMap();
if ($task->getStatus() == ManiphestTaskStatus::STATUS_OPEN) {
$resolution_types = array_select_keys($resolution_types, array(ManiphestTaskStatus::STATUS_CLOSED_RESOLVED, ManiphestTaskStatus::STATUS_CLOSED_WONTFIX, ManiphestTaskStatus::STATUS_CLOSED_INVALID, ManiphestTaskStatus::STATUS_CLOSED_SPITE));
} else {
$resolution_types = array(ManiphestTaskStatus::STATUS_OPEN => 'Reopened');
$transaction_types[ManiphestTransactionType::TYPE_STATUS] = 'Reopen Task';
unset($transaction_types[ManiphestTransactionType::TYPE_PRIORITY]);
unset($transaction_types[ManiphestTransactionType::TYPE_OWNER]);
}
$default_claim = array($user->getPHID() => $user->getUsername() . ' (' . $user->getRealName() . ')');
$draft = id(new PhabricatorDraft())->loadOneWhere('authorPHID = %s AND draftKey = %s', $user->getPHID(), $task->getPHID());
if ($draft) {
$draft_text = $draft->getDraft();
} else {
$draft_text = null;
}
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
if ($is_serious) {
// Prevent tasks from being closed "out of spite" in serious business
// installs.
unset($resolution_types[ManiphestTaskStatus::STATUS_CLOSED_SPITE]);
}
$comment_form = new AphrontFormView();
$comment_form->setUser($user)->setAction('/maniphest/transaction/save/')->setEncType('multipart/form-data')->addHiddenInput('taskID', $task->getID())->appendChild(id(new AphrontFormSelectControl())->setLabel('Action')->setName('action')->setOptions($transaction_types)->setID('transaction-action'))->appendChild(id(new AphrontFormSelectControl())->setLabel('Resolution')->setName('resolution')->setControlID('resolution')->setControlStyle('display: none')->setOptions($resolution_types))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('Assign To')->setName('assign_to')->setControlID('assign_to')->setControlStyle('display: none')->setID('assign-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('CCs')->setName('ccs')->setControlID('ccs')->setControlStyle('display: none')->setID('cc-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormSelectControl())->setLabel('Priority')->setName('priority')->setOptions($priority_map)->setControlID('priority')->setControlStyle('display: none')->setValue($task->getPriority()))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('Projects')->setName('projects')->setControlID('projects')->setControlStyle('display: none')->setID('projects-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormFileControl())->setLabel('File')->setName('file')->setControlID('file')->setControlStyle('display: none'))->appendChild(id(new PhabricatorRemarkupControl())->setLabel('Comments')->setName('comments')->setValue($draft_text)->setID('transaction-comments'))->appendChild(id(new AphrontFormDragAndDropUploadControl())->setLabel('Attached Files')->setName('files')->setActivatedClass('aphront-panel-view-drag-and-drop'))->appendChild(id(new AphrontFormSubmitControl())->setValue($is_serious ? 'Submit' : 'Avast!'));
$control_map = array(ManiphestTransactionType::TYPE_STATUS => 'resolution', ManiphestTransactionType::TYPE_OWNER => 'assign_to', ManiphestTransactionType::TYPE_CCS => 'ccs', ManiphestTransactionType::TYPE_PRIORITY => 'priority', ManiphestTransactionType::TYPE_PROJECTS => 'projects', ManiphestTransactionType::TYPE_ATTACH => 'file');
$tokenizer_map = array(ManiphestTransactionType::TYPE_PROJECTS => array('id' => 'projects-tokenizer', 'src' => '/typeahead/common/projects/', 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), 'placeholder' => 'Type a project name...'), ManiphestTransactionType::TYPE_OWNER => array('id' => 'assign-tokenizer', 'src' => '/typeahead/common/users/', 'value' => $default_claim, 'limit' => 1, 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), 'placeholder' => 'Type a user name...'), ManiphestTransactionType::TYPE_CCS => array('id' => 'cc-tokenizer', 'src' => '/typeahead/common/mailable/', 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), 'placeholder' => 'Type a user or mailing list...'));
Javelin::initBehavior('maniphest-transaction-controls', array('select' => 'transaction-action', 'controlMap' => $control_map, 'tokenizers' => $tokenizer_map));
Javelin::initBehavior('maniphest-transaction-preview', array('uri' => '/maniphest/transaction/preview/' . $task->getID() . '/', 'preview' => 'transaction-preview', 'comments' => 'transaction-comments', 'action' => 'transaction-action', 'map' => $control_map, 'tokenizers' => $tokenizer_map));
$comment_panel = new AphrontPanelView();
$comment_panel->appendChild($comment_form);
$comment_panel->addClass('aphront-panel-accent');
$comment_panel->setHeader($is_serious ? 'Add Comment' : 'Weigh In');
$preview_panel = '<div class="aphront-panel-preview">
<div id="transaction-preview">
<div class="aphront-panel-preview-loading-text">
Loading preview...
</div>
</div>
</div>';
$transaction_view = new ManiphestTransactionListView();
$transaction_view->setTransactions($transactions);
$transaction_view->setHandles($handles);
$transaction_view->setUser($user);
$transaction_view->setAuxiliaryFields($aux_fields);
$transaction_view->setMarkupEngine($engine);
PhabricatorFeedStoryNotification::updateObjectNotificationViews($user, $task->getPHID());
return $this->buildStandardPageResponse(array($context_bar, $headsup_panel, $transaction_view, $comment_panel, $preview_panel), array('title' => 'T' . $task->getID() . ' ' . $task->getTitle(), 'pageObjects' => array($task->getPHID())));
}
示例7: processRequest
//.........这里部分代码省略.........
}
$dict['Projects'] = implode(', ', $project_links);
} else {
$dict['Projects'] = '<em>None</em>';
}
if (idx($attached, PhabricatorPHIDConstants::PHID_TYPE_DREV)) {
$revs = idx($attached, PhabricatorPHIDConstants::PHID_TYPE_DREV);
$rev_links = array();
foreach ($revs as $rev => $info) {
$rev_links[] = $handles[$rev]->renderLink();
}
$rev_links = implode('<br />', $rev_links);
$dict['Revisions'] = $rev_links;
}
if (idx($attached, PhabricatorPHIDConstants::PHID_TYPE_FILE)) {
$file_infos = idx($attached, PhabricatorPHIDConstants::PHID_TYPE_FILE);
$file_phids = array_keys($file_infos);
if ($file_phids) {
$files = id(new PhabricatorFile())->loadAllWhere('phid IN (%Ls)', $file_phids);
$views = array();
foreach ($files as $file) {
$view = new AphrontFilePreviewView();
$view->setFile($file);
$views[] = $view->render();
}
$dict['Files'] = implode('', $views);
}
}
$dict['Description'] = '<div class="maniphest-task-description">' . '<div class="phabricator-remarkup">' . $engine->markupText($task->getDescription()) . '</div>' . '</div>';
require_celerity_resource('mainphest-task-detail-css');
$table = array();
foreach ($dict as $key => $value) {
$table[] = '<tr>' . '<th>' . phutil_escape_html($key) . ':</th>' . '<td>' . $value . '</td>' . '</tr>';
}
$table = '<table class="maniphest-task-properties">' . implode("\n", $table) . '</table>';
$actions = array();
$action = new AphrontHeadsupActionView();
$action->setName('Edit Task');
$action->setURI('/maniphest/task/edit/' . $task->getID() . '/');
$action->setClass('action-edit');
$actions[] = $action;
require_celerity_resource('phabricator-object-selector-css');
require_celerity_resource('javelin-behavior-phabricator-object-selector');
$action = new AphrontHeadsupActionView();
$action->setName('Merge Duplicates');
$action->setURI('/search/attach/' . $task->getPHID() . '/TASK/merge/');
$action->setWorkflow(true);
$action->setClass('action-merge');
$actions[] = $action;
$action = new AphrontHeadsupActionView();
$action->setName('Edit Differential Revisions');
$action->setURI('/search/attach/' . $task->getPHID() . '/DREV/');
$action->setWorkflow(true);
$action->setClass('action-attach');
$actions[] = $action;
$action_list = new AphrontHeadsupActionListView();
$action_list->setActions($actions);
$panel = '<div class="maniphest-panel">' . $action_list->render() . '<div class="maniphest-task-detail-core">' . '<h1>' . '<span class="aphront-headsup-object-name">' . phutil_escape_html('T' . $task->getID()) . '</span>' . ' ' . phutil_escape_html($task->getTitle()) . '</h1>' . $table . '</div>' . '</div>';
$transaction_types = ManiphestTransactionType::getTransactionTypeMap();
$resolution_types = ManiphestTaskStatus::getTaskStatusMap();
if ($task->getStatus() == ManiphestTaskStatus::STATUS_OPEN) {
$resolution_types = array_select_keys($resolution_types, array(ManiphestTaskStatus::STATUS_CLOSED_RESOLVED, ManiphestTaskStatus::STATUS_CLOSED_WONTFIX, ManiphestTaskStatus::STATUS_CLOSED_INVALID, ManiphestTaskStatus::STATUS_CLOSED_SPITE));
} else {
$resolution_types = array(ManiphestTaskStatus::STATUS_OPEN => 'Reopened');
$transaction_types[ManiphestTransactionType::TYPE_STATUS] = 'Reopen Task';
unset($transaction_types[ManiphestTransactionType::TYPE_PRIORITY]);
unset($transaction_types[ManiphestTransactionType::TYPE_OWNER]);
}
$default_claim = array($user->getPHID() => $user->getUsername() . ' (' . $user->getRealName() . ')');
$draft = id(new PhabricatorDraft())->loadOneWhere('authorPHID = %s AND draftKey = %s', $user->getPHID(), $task->getPHID());
if ($draft) {
$draft_text = $draft->getDraft();
} else {
$draft_text = null;
}
$panel_id = celerity_generate_unique_node_id();
$comment_form = new AphrontFormView();
$comment_form->setUser($user)->setAction('/maniphest/transaction/save/')->setEncType('multipart/form-data')->addHiddenInput('taskID', $task->getID())->appendChild(id(new AphrontFormSelectControl())->setLabel('Action')->setName('action')->setOptions($transaction_types)->setID('transaction-action'))->appendChild(id(new AphrontFormSelectControl())->setLabel('Resolution')->setName('resolution')->setControlID('resolution')->setControlStyle('display: none')->setOptions($resolution_types))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('Assign To')->setName('assign_to')->setControlID('assign_to')->setControlStyle('display: none')->setID('assign-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('CCs')->setName('ccs')->setControlID('ccs')->setControlStyle('display: none')->setID('cc-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormSelectControl())->setLabel('Priority')->setName('priority')->setOptions($priority_map)->setControlID('priority')->setControlStyle('display: none')->setValue($task->getPriority()))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('Projects')->setName('projects')->setControlID('projects')->setControlStyle('display: none')->setID('projects-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormFileControl())->setLabel('File')->setName('file')->setControlID('file')->setControlStyle('display: none'))->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Comments')->setName('comments')->setValue($draft_text)->setID('transaction-comments'))->appendChild(id(new AphrontFormDragAndDropUploadControl())->setLabel('Attached Files')->setName('files')->setDragAndDropTarget($panel_id)->setActivatedClass('aphront-panel-view-drag-and-drop'))->appendChild(id(new AphrontFormSubmitControl())->setValue('Avast!'));
$control_map = array(ManiphestTransactionType::TYPE_STATUS => 'resolution', ManiphestTransactionType::TYPE_OWNER => 'assign_to', ManiphestTransactionType::TYPE_CCS => 'ccs', ManiphestTransactionType::TYPE_PRIORITY => 'priority', ManiphestTransactionType::TYPE_PROJECTS => 'projects', ManiphestTransactionType::TYPE_ATTACH => 'file');
Javelin::initBehavior('maniphest-transaction-controls', array('select' => 'transaction-action', 'controlMap' => $control_map, 'tokenizers' => array(ManiphestTransactionType::TYPE_PROJECTS => array('id' => 'projects-tokenizer', 'src' => '/typeahead/common/projects/'), ManiphestTransactionType::TYPE_OWNER => array('id' => 'assign-tokenizer', 'src' => '/typeahead/common/users/', 'value' => $default_claim, 'limit' => 1), ManiphestTransactionType::TYPE_CCS => array('id' => 'cc-tokenizer', 'src' => '/typeahead/common/mailable/'))));
Javelin::initBehavior('maniphest-transaction-preview', array('uri' => '/maniphest/transaction/preview/' . $task->getID() . '/', 'preview' => 'transaction-preview', 'comments' => 'transaction-comments', 'action' => 'transaction-action', 'map' => $control_map));
$comment_panel = new AphrontPanelView();
$comment_panel->appendChild($comment_form);
$comment_panel->setID($panel_id);
$comment_panel->addClass('aphront-panel-accent');
$comment_panel->setHeader('Weigh In');
$preview_panel = '<div class="aphront-panel-preview">
<div id="transaction-preview">
<div class="aphront-panel-preview-loading-text">
Loading preview...
</div>
</div>
</div>';
$transaction_view = new ManiphestTransactionListView();
$transaction_view->setTransactions($transactions);
$transaction_view->setHandles($handles);
$transaction_view->setUser($user);
$transaction_view->setMarkupEngine($engine);
return $this->buildStandardPageResponse(array($panel, $transaction_view, $comment_panel, $preview_panel), array('title' => 'T' . $task->getID() . ' ' . $task->getTitle()));
}
示例8: processRequest
//.........这里部分代码省略.........
$table = array();
foreach ($dict as $key => $value) {
$table[] = '<tr>' . '<th>' . phutil_escape_html($key) . ':</th>' . '<td>' . $value . '</td>' . '</tr>';
}
$table = '<table class="maniphest-task-properties">' . implode("\n", $table) . '</table>';
$context_bar = null;
if ($parent_task) {
$context_bar = new AphrontContextBarView();
$context_bar->addButton(phutil_render_tag('a', array('href' => '/maniphest/task/create/?parent=' . $parent_task->getID(), 'class' => 'green button'), 'Create Another Subtask'));
$context_bar->appendChild('Created a subtask of <strong>' . $handles[$parent_task->getPHID()]->renderLink() . '</strong>');
} else {
if ($workflow == 'create') {
$context_bar = new AphrontContextBarView();
$context_bar->addButton(phutil_render_tag('a', array('href' => '/maniphest/task/create/?template=' . $task->getID(), 'class' => 'green button'), 'Create Another Task'));
$context_bar->appendChild('New task created.');
}
}
$actions = array();
$action = new AphrontHeadsupActionView();
$action->setName('Edit Task');
$action->setURI('/maniphest/task/edit/' . $task->getID() . '/');
$action->setClass('action-edit');
$actions[] = $action;
require_celerity_resource('phabricator-object-selector-css');
require_celerity_resource('javelin-behavior-phabricator-object-selector');
$action = new AphrontHeadsupActionView();
$action->setName('Merge Duplicates');
$action->setURI('/search/attach/' . $task->getPHID() . '/TASK/merge/');
$action->setWorkflow(true);
$action->setClass('action-merge');
$actions[] = $action;
$action = new AphrontHeadsupActionView();
$action->setName('Create Subtask');
$action->setURI('/maniphest/task/create/?parent=' . $task->getID());
$action->setClass('action-branch');
$actions[] = $action;
$action = new AphrontHeadsupActionView();
$action->setName('Edit Dependencies');
$action->setURI('/search/attach/' . $task->getPHID() . '/TASK/dependencies/');
$action->setWorkflow(true);
$action->setClass('action-dependencies');
$actions[] = $action;
$action = new AphrontHeadsupActionView();
$action->setName('Edit Differential Revisions');
$action->setURI('/search/attach/' . $task->getPHID() . '/DREV/');
$action->setWorkflow(true);
$action->setClass('action-attach');
$actions[] = $action;
$action_list = new AphrontHeadsupActionListView();
$action_list->setActions($actions);
$panel = '<div class="maniphest-panel">' . $action_list->render() . '<div class="maniphest-task-detail-core">' . '<h1>' . '<span class="aphront-headsup-object-name">' . phutil_escape_html('T' . $task->getID()) . '</span>' . ' ' . phutil_escape_html($task->getTitle()) . '</h1>' . $table . '</div>' . '</div>';
$transaction_types = ManiphestTransactionType::getTransactionTypeMap();
$resolution_types = ManiphestTaskStatus::getTaskStatusMap();
if ($task->getStatus() == ManiphestTaskStatus::STATUS_OPEN) {
$resolution_types = array_select_keys($resolution_types, array(ManiphestTaskStatus::STATUS_CLOSED_RESOLVED, ManiphestTaskStatus::STATUS_CLOSED_WONTFIX, ManiphestTaskStatus::STATUS_CLOSED_INVALID, ManiphestTaskStatus::STATUS_CLOSED_SPITE));
} else {
$resolution_types = array(ManiphestTaskStatus::STATUS_OPEN => 'Reopened');
$transaction_types[ManiphestTransactionType::TYPE_STATUS] = 'Reopen Task';
unset($transaction_types[ManiphestTransactionType::TYPE_PRIORITY]);
unset($transaction_types[ManiphestTransactionType::TYPE_OWNER]);
}
$default_claim = array($user->getPHID() => $user->getUsername() . ' (' . $user->getRealName() . ')');
$draft = id(new PhabricatorDraft())->loadOneWhere('authorPHID = %s AND draftKey = %s', $user->getPHID(), $task->getPHID());
if ($draft) {
$draft_text = $draft->getDraft();
} else {
$draft_text = null;
}
$panel_id = celerity_generate_unique_node_id();
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
if ($is_serious) {
// Prevent tasks from being closed "out of spite" in serious business
// installs.
unset($resolution_types[ManiphestTaskStatus::STATUS_CLOSED_SPITE]);
}
$remarkup_href = PhabricatorEnv::getDoclink('article/Remarkup_Reference.html');
$comment_form = new AphrontFormView();
$comment_form->setUser($user)->setAction('/maniphest/transaction/save/')->setEncType('multipart/form-data')->addHiddenInput('taskID', $task->getID())->appendChild(id(new AphrontFormSelectControl())->setLabel('Action')->setName('action')->setOptions($transaction_types)->setID('transaction-action'))->appendChild(id(new AphrontFormSelectControl())->setLabel('Resolution')->setName('resolution')->setControlID('resolution')->setControlStyle('display: none')->setOptions($resolution_types))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('Assign To')->setName('assign_to')->setControlID('assign_to')->setControlStyle('display: none')->setID('assign-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('CCs')->setName('ccs')->setControlID('ccs')->setControlStyle('display: none')->setID('cc-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormSelectControl())->setLabel('Priority')->setName('priority')->setOptions($priority_map)->setControlID('priority')->setControlStyle('display: none')->setValue($task->getPriority()))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('Projects')->setName('projects')->setControlID('projects')->setControlStyle('display: none')->setID('projects-tokenizer')->setDisableBehavior(true))->appendChild(id(new AphrontFormFileControl())->setLabel('File')->setName('file')->setControlID('file')->setControlStyle('display: none'))->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Comments')->setName('comments')->setValue($draft_text)->setCaption(phutil_render_tag('a', array('href' => $remarkup_href, 'tabindex' => '-1', 'target' => '_blank'), 'Formatting Reference'))->setID('transaction-comments'))->appendChild(id(new AphrontFormDragAndDropUploadControl())->setLabel('Attached Files')->setName('files')->setDragAndDropTarget($panel_id)->setActivatedClass('aphront-panel-view-drag-and-drop'))->appendChild(id(new AphrontFormSubmitControl())->setValue($is_serious ? 'Submit' : 'Avast!'));
$control_map = array(ManiphestTransactionType::TYPE_STATUS => 'resolution', ManiphestTransactionType::TYPE_OWNER => 'assign_to', ManiphestTransactionType::TYPE_CCS => 'ccs', ManiphestTransactionType::TYPE_PRIORITY => 'priority', ManiphestTransactionType::TYPE_PROJECTS => 'projects', ManiphestTransactionType::TYPE_ATTACH => 'file');
Javelin::initBehavior('maniphest-transaction-controls', array('select' => 'transaction-action', 'controlMap' => $control_map, 'tokenizers' => array(ManiphestTransactionType::TYPE_PROJECTS => array('id' => 'projects-tokenizer', 'src' => '/typeahead/common/projects/', 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand')), ManiphestTransactionType::TYPE_OWNER => array('id' => 'assign-tokenizer', 'src' => '/typeahead/common/users/', 'value' => $default_claim, 'limit' => 1, 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand')), ManiphestTransactionType::TYPE_CCS => array('id' => 'cc-tokenizer', 'src' => '/typeahead/common/mailable/', 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand')))));
Javelin::initBehavior('maniphest-transaction-preview', array('uri' => '/maniphest/transaction/preview/' . $task->getID() . '/', 'preview' => 'transaction-preview', 'comments' => 'transaction-comments', 'action' => 'transaction-action', 'map' => $control_map));
$comment_panel = new AphrontPanelView();
$comment_panel->appendChild($comment_form);
$comment_panel->setID($panel_id);
$comment_panel->addClass('aphront-panel-accent');
$comment_panel->setHeader($is_serious ? 'Add Comment' : 'Weigh In');
$preview_panel = '<div class="aphront-panel-preview">
<div id="transaction-preview">
<div class="aphront-panel-preview-loading-text">
Loading preview...
</div>
</div>
</div>';
$transaction_view = new ManiphestTransactionListView();
$transaction_view->setTransactions($transactions);
$transaction_view->setHandles($handles);
$transaction_view->setUser($user);
$transaction_view->setMarkupEngine($engine);
return $this->buildStandardPageResponse(array($context_bar, $panel, $transaction_view, $comment_panel, $preview_panel), array('title' => 'T' . $task->getID() . ' ' . $task->getTitle()));
}
示例9: 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>';
}