本文整理汇总了PHP中AphrontPanelView::setHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontPanelView::setHeader方法的具体用法?PHP AphrontPanelView::setHeader怎么用?PHP AphrontPanelView::setHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AphrontPanelView
的用法示例。
在下文中一共展示了AphrontPanelView::setHeader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processRequest
public function processRequest()
{
if ($this->id) {
$macro = id(new PhabricatorFileImageMacro())->load($this->id);
if (!$macro) {
return new Aphront404Response();
}
} else {
$macro = new PhabricatorFileImageMacro();
}
$errors = array();
$e_name = true;
$request = $this->getRequest();
$user = $request->getUser();
if ($request->isFormPost()) {
$macro->setName($request->getStr('name'));
if (!strlen($macro->getName())) {
$errors[] = 'Macro name is required.';
$e_name = 'Required';
} else {
if (!preg_match('/^[a-z0-9_-]{3,}$/', $macro->getName())) {
$errors[] = 'Macro must be at least three characters long and contain ' . 'only lowercase letters, digits, hyphen and underscore.';
$e_name = 'Invalid';
} else {
$e_name = null;
}
}
if (!$errors) {
$file = PhabricatorFile::newFromPHPUpload(idx($_FILES, 'file'), array('name' => $request->getStr('name'), 'authorPHID' => $user->getPHID()));
$macro->setFilePHID($file->getPHID());
try {
$macro->save();
return id(new AphrontRedirectResponse())->setURI('/file/macro/');
} catch (AphrontQueryDuplicateKeyException $ex) {
$errors[] = 'Macro name is not unique!';
$e_name = 'Duplicate';
}
}
}
if ($errors) {
$error_view = new AphrontErrorView();
$error_view->setTitle('Form Errors');
$error_view->setErrors($errors);
} else {
$error_view = null;
}
$form = new AphrontFormView();
$form->setAction('/file/macro/edit/');
$form->setUser($request->getUser());
$form->setEncType('multipart/form-data')->appendChild(id(new AphrontFormTextControl())->setLabel('Name')->setName('name')->setValue($macro->getName())->setCaption('This word or phrase will be replaced with the image.')->setError($e_name))->appendChild(id(new AphrontFormFileControl())->setLabel('File')->setName('file')->setError(true))->appendChild(id(new AphrontFormSubmitControl())->setValue('Save Image Macro')->addCancelButton('/file/macro/'));
$panel = new AphrontPanelView();
if ($macro->getID()) {
$panel->setHeader('Edit Image Macro');
} else {
$panel->setHeader('Create Image Macro');
}
$panel->appendChild($form);
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
return $this->buildStandardPageResponse(array($error_view, $panel), array('title' => 'Edit Image Macro'));
}
示例2: processRequest
public function processRequest()
{
if ($this->id) {
$item = id(new PhabricatorDirectoryItem())->load($this->id);
if (!$item) {
return new Aphront404Response();
}
} else {
$item = new PhabricatorDirectoryItem();
}
$e_name = true;
$e_href = true;
$errors = array();
$request = $this->getRequest();
if ($request->isFormPost()) {
$item->setName($request->getStr('name'));
$item->setHref($request->getStr('href'));
$item->setDescription($request->getStr('description'));
$item->setCategoryID($request->getStr('categoryID'));
$item->setSequence($request->getStr('sequence'));
if (!strlen($item->getName())) {
$errors[] = 'Item name is required.';
$e_name = 'Required';
}
if (!strlen($item->getHref())) {
$errors[] = 'Item link is required.';
$e_href = 'Required';
}
if (!$errors) {
$item->save();
return id(new AphrontRedirectResponse())->setURI('/directory/item/');
}
}
$error_view = null;
if ($errors) {
$error_view = id(new AphrontErrorView())->setTitle('Form Errors')->setErrors($errors);
}
$form = new AphrontFormView();
$form->setUser($request->getUser());
if ($item->getID()) {
$form->setAction('/directory/item/edit/' . $item->getID() . '/');
} else {
$form->setAction('/directory/item/edit/');
}
$categories = id(new PhabricatorDirectoryCategory())->loadAll();
$category_map = mpull($categories, 'getName', 'getID');
$form->appendChild(id(new AphrontFormTextControl())->setLabel('Name')->setName('name')->setValue($item->getName())->setError($e_name))->appendChild(id(new AphrontFormSelectControl())->setLabel('Category')->setName('categoryID')->setOptions($category_map)->setValue($item->getCategoryID()))->appendChild(id(new AphrontFormTextControl())->setLabel('Link')->setName('href')->setValue($item->getHref())->setError($e_href))->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Description')->setName('description')->setValue($item->getDescription()))->appendChild(id(new AphrontFormTextControl())->setLabel('Order')->setName('sequence')->setCaption('Items in a category are sorted by "order", then by name.')->setValue((int) $item->getSequence()))->appendChild(id(new AphrontFormSubmitControl())->setValue('Save')->addCancelButton('/directory/item/'));
$panel = new AphrontPanelView();
if ($item->getID()) {
$panel->setHeader('Edit Directory Item');
} else {
$panel->setHeader('Create New Directory Item');
}
$panel->appendChild($form);
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
return $this->buildStandardPageResponse(array($error_view, $panel), array('title' => 'Edit Directory Item'));
}
示例3: processRequest
public function processRequest()
{
if ($this->id) {
$category = id(new PhabricatorDirectoryCategory())->load($this->id);
if (!$category) {
return new Aphront404Response();
}
} else {
$category = new PhabricatorDirectoryCategory();
}
$e_name = true;
$errors = array();
$request = $this->getRequest();
if ($request->isFormPost()) {
$category->setName($request->getStr('name'));
$category->setSequence($request->getStr('sequence'));
if (!strlen($category->getName())) {
$errors[] = 'Category name is required.';
$e_name = 'Required';
}
if (!$errors) {
$category->save();
return id(new AphrontRedirectResponse())->setURI('/directory/category/');
}
}
$error_view = null;
if ($errors) {
$error_view = id(new AphrontErrorView())->setTitle('Form Errors')->setErrors($errors);
}
$form = new AphrontFormView();
$form->setUser($request->getUser());
if ($category->getID()) {
$form->setAction('/directory/category/edit/' . $category->getID() . '/');
} else {
$form->setAction('/directory/category/edit/');
}
$categories = id(new PhabricatorDirectoryCategory())->loadAll();
$category_map = mpull($categories, 'getName', 'getID');
$form->appendChild(id(new AphrontFormTextControl())->setLabel('Name')->setName('name')->setValue($category->getName())->setError($e_name))->appendChild(id(new AphrontFormTextControl())->setLabel('Order')->setName('sequence')->setValue((int) $category->getSequence()))->appendChild(id(new AphrontFormSubmitControl())->setValue('Save')->addCancelButton('/directory/category/'));
$panel = new AphrontPanelView();
if ($category->getID()) {
$panel->setHeader('Edit Directory Category');
} else {
$panel->setHeader('Create New Directory Category');
}
$panel->appendChild($form);
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
return $this->buildStandardPageResponse(array($error_view, $panel), array('title' => 'Edit Directory Category'));
}
示例4: processRequest
public function processRequest()
{
if ($this->id) {
$list = id(new PhabricatorMetaMTAMailingList())->load($this->id);
if (!$list) {
return new Aphront404Response();
}
} else {
$list = new PhabricatorMetaMTAMailingList();
}
$e_email = true;
$errors = array();
$request = $this->getRequest();
if ($request->isFormPost()) {
$list->setName($request->getStr('name'));
$list->setEmail($request->getStr('email'));
$list->setURI($request->getStr('uri'));
if (!strlen($list->getEmail())) {
$e_email = 'Required';
$errors[] = 'Email is required.';
}
if (!$errors) {
$list->save();
return id(new AphrontRedirectResponse())->setURI('/mail/lists/');
}
}
$error_view = null;
if ($errors) {
$error_view = id(new AphrontErrorView())->setTitle('Form Errors')->setErrors($errors);
}
$form = new AphrontFormView();
$form->setUser($request->getUser());
if ($list->getID()) {
$form->setAction('/mail/lists/edit/' . $list->getID() . '/');
} else {
$form->setAction('/mail/lists/edit/');
}
$form->appendChild(id(new AphrontFormTextControl())->setLabel('Email')->setName('email')->setValue($list->getEmail())->setError($e_email))->appendChild(id(new AphrontFormTextControl())->setLabel('Name')->setName('name')->setValue($list->getName()))->appendChild(id(new AphrontFormTextControl())->setLabel('URI')->setName('uri')->setValue($list->getURI()))->appendChild(id(new AphrontFormStaticControl())->setLabel('ID')->setValue(nonempty($list->getID(), '-')))->appendChild(id(new AphrontFormStaticControl())->setLabel('PHID')->setValue(nonempty($list->getPHID(), '-')))->appendChild(id(new AphrontFormSubmitControl())->setValue('Save')->addCancelButton('/mail/lists/'));
$panel = new AphrontPanelView();
if ($list->getID()) {
$panel->setHeader('Edit Mailing List');
} else {
$panel->setHeader('Create New Mailing List');
}
$panel->appendChild($form);
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
return $this->buildStandardPageResponse(array($error_view, $panel), array('title' => 'Edit Mailing List'));
}
示例5: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$editable = $this->getAccountEditable();
// There's no sense in showing a change password panel if the user
// can't change their password
if (!$editable || !PhabricatorEnv::getEnvConfig('auth.password-auth-enabled')) {
return new Aphront400Response();
}
$errors = array();
if ($request->isFormPost()) {
if ($user->comparePassword($request->getStr('old_pw'))) {
$pass = $request->getStr('new_pw');
$conf = $request->getStr('conf_pw');
if ($pass === $conf) {
if (strlen($pass)) {
$user->setPassword($pass);
// This write is unguarded because the CSRF token has already
// been checked in the call to $request->isFormPost() and
// the CSRF token depends on the password hash, so when it
// is changed here the CSRF token check will fail.
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
$user->save();
unset($unguarded);
return id(new AphrontRedirectResponse())->setURI('/settings/page/password/?saved=true');
} else {
$errors[] = 'Your new password is too short.';
}
} else {
$errors[] = 'New password and confirmation do not match.';
}
} else {
$errors[] = 'The old password you entered is incorrect.';
}
}
$notice = null;
if (!$errors) {
if ($request->getStr('saved')) {
$notice = new AphrontErrorView();
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$notice->setTitle('Changes Saved');
$notice->appendChild('<p>Your password has been updated.</p>');
}
} else {
$notice = new AphrontErrorView();
$notice->setTitle('Error Changing Password');
$notice->setErrors($errors);
}
$form = new AphrontFormView();
$form->setUser($user)->appendChild(id(new AphrontFormPasswordControl())->setLabel('Old Password')->setName('old_pw'));
$form->appendChild(id(new AphrontFormPasswordControl())->setLabel('New Password')->setName('new_pw'));
$form->appendChild(id(new AphrontFormPasswordControl())->setLabel('Confirm Password')->setName('conf_pw'));
$form->appendChild(id(new AphrontFormSubmitControl())->setValue('Save'));
$panel = new AphrontPanelView();
$panel->setHeader('Change Password');
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
$panel->appendChild($form);
return id(new AphrontNullView())->appendChild(array($notice, $panel));
}
示例6: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$offset = $request->getInt('offset', 0);
$pager = new AphrontPagerView();
$pager->setPageSize(250);
$pager->setOffset($offset);
$pager->setURI($request->getRequestURI(), 'offset');
$list = new PhabricatorMetaMTAMailingList();
$conn_r = $list->establishConnection('r');
$data = queryfx_all($conn_r, 'SELECT * FROM %T
ORDER BY name ASC
LIMIT %d, %d', $list->getTableName(), $pager->getOffset(), $pager->getPageSize() + 1);
$data = $pager->sliceResults($data);
$lists = $list->loadAllFromArray($data);
$rows = array();
foreach ($lists as $list) {
$rows[] = array(phutil_escape_html($list->getName()), phutil_escape_html($list->getEmail()), phutil_render_tag('a', array('class' => 'button grey small', 'href' => $this->getApplicationURI('/edit/' . $list->getID() . '/')), 'Edit'));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('Name', 'Email', ''));
$table->setColumnClasses(array(null, 'wide', 'action'));
$panel = new AphrontPanelView();
$panel->appendChild($table);
$panel->setHeader('Mailing Lists');
$panel->setCreateButton('Add New List', $this->getApplicationURI('/edit/'));
$panel->appendChild($pager);
return $this->buildApplicationPage($panel, array('title' => 'Mailing Lists'));
}
示例7: processRequest
public function processRequest()
{
$request = $this->getRequest();
$phids = $request->getStrList('phids');
if ($phids) {
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$rows = array();
foreach ($handles as $handle) {
if ($handle->getURI()) {
$link = phutil_render_tag('a', array('href' => $handle->getURI()), phutil_escape_html($handle->getURI()));
} else {
$link = null;
}
$rows[] = array(phutil_escape_html($handle->getPHID()), phutil_escape_html($handle->getType()), phutil_escape_html($handle->getName()), $link);
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('PHID', 'Type', 'Name', 'URI'));
$table->setColumnClasses(array(null, null, null, 'wide'));
$panel = new AphrontPanelView();
$panel->setHeader('PHID Handles');
$panel->appendChild($table);
return $this->buildStandardPageResponse($panel, array('title' => 'PHID Lookup Results'));
}
$lookup_form = new AphrontFormView();
$lookup_form->setUser($request->getUser());
$lookup_form->setAction('/phid/')->appendChild(id(new AphrontFormTextAreaControl())->setName('phids')->setCaption('Enter PHIDs separated by spaces or commas.'))->appendChild(id(new AphrontFormSubmitControl())->setValue('Lookup PHIDs'));
$lookup_panel = new AphrontPanelView();
$lookup_panel->setHeader('Lookup PHIDs');
$lookup_panel->appendChild($lookup_form);
$lookup_panel->setWidth(AphrontPanelView::WIDTH_WIDE);
return $this->buildStandardPageResponse(array($lookup_panel), array('title' => 'PHID Lookup'));
}
示例8: processRequest
public function processRequest(AphrontRequest $request)
{
$user = $request->getUser();
$ldap_info = id(new PhabricatorUserLDAPInfo())->loadOneWhere('userID = %d', $user->getID());
$forms = array();
if (!$ldap_info) {
$unlink = 'Link LDAP Account';
$unlink_form = new AphrontFormView();
$unlink_form->setUser($user)->setAction('/ldap/login/')->appendChild('<p class="aphront-form-instructions">There is currently no ' . 'LDAP account linked to your Phabricator account. You can link an ' . 'account, which will allow you to use it to log into Phabricator</p>')->appendChild(id(new AphrontFormTextControl())->setLabel('LDAP username')->setName('username'))->appendChild(id(new AphrontFormPasswordControl())->setLabel('Password')->setName('password'))->appendChild(id(new AphrontFormSubmitControl())->setValue("Link LDAP Account »"));
$forms['Link Account'] = $unlink_form;
} else {
$unlink = 'Unlink LDAP Account';
$unlink_form = new AphrontFormView();
$unlink_form->setUser($user)->appendChild('<p class="aphront-form-instructions">You may unlink this account ' . 'from your LDAP account. This will prevent you from logging in with ' . 'your LDAP credentials.</p>')->appendChild(id(new AphrontFormSubmitControl())->addCancelButton('/ldap/unlink/', $unlink));
$forms['Unlink Account'] = $unlink_form;
}
$panel = new AphrontPanelView();
$panel->setHeader('LDAP Account Settings');
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
foreach ($forms as $name => $form) {
if ($name) {
$panel->appendChild('<br /><h1>' . $name . '</h1><br />');
}
$panel->appendChild($form);
}
return array($panel);
}
示例9: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$views = array(self::VIEW_ALL => 'All Slowvotes', self::VIEW_CREATED => 'Created', self::VIEW_VOTED => 'Voted In');
$view = isset($views[$this->view]) ? $this->view : self::VIEW_ALL;
$side_nav = $this->renderSideNav($views, $view);
$pager = new AphrontPagerView();
$pager->setOffset($request->getInt('page'));
$pager->setURI($request->getRequestURI(), 'page');
$polls = $this->loadPolls($pager, $view);
$phids = mpull($polls, 'getAuthorPHID');
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$rows = array();
foreach ($polls as $poll) {
$rows[] = array('V' . $poll->getID(), phutil_render_tag('a', array('href' => '/V' . $poll->getID()), phutil_escape_html($poll->getQuestion())), $handles[$poll->getAuthorPHID()]->renderLink(), phabricator_date($poll->getDateCreated(), $user), phabricator_time($poll->getDateCreated(), $user));
}
$table = new AphrontTableView($rows);
$table->setColumnClasses(array('', 'pri wide', '', '', 'right'));
$table->setHeaders(array('ID', 'Poll', 'Author', 'Date', 'Time'));
$panel = new AphrontPanelView();
$panel->setHeader($this->getTableHeader($view));
$panel->setCreateButton('Create Slowvote', '/vote/create/');
$panel->appendChild($table);
$panel->appendChild($pager);
$side_nav->appendChild($panel);
return $this->buildStandardPageResponse($side_nav, array('title' => 'Slowvotes'));
}
示例10: processRequest
public function processRequest()
{
$request = $this->getRequest();
if ($request->isFormPost()) {
$parser = new ArcanistDiffParser();
$diff = null;
try {
$diff = PhabricatorFile::readUploadedFileData($_FILES['diff-file']);
} catch (Exception $ex) {
$diff = $request->getStr('diff');
}
$changes = $parser->parseDiff($diff);
$diff = DifferentialDiff::newFromRawChanges($changes);
$diff->setLintStatus(DifferentialLintStatus::LINT_SKIP);
$diff->setUnitStatus(DifferentialLintStatus::LINT_SKIP);
$diff->setAuthorPHID($request->getUser()->getPHID());
$diff->setCreationMethod('web');
$diff->save();
return id(new AphrontRedirectResponse())->setURI('/differential/diff/' . $diff->getID() . '/');
}
$form = new AphrontFormView();
$arcanist_href = PhabricatorEnv::getDoclink('article/Arcanist_User_Guide.html');
$arcanist_link = phutil_render_tag('a', array('href' => $arcanist_href, 'target' => '_blank'), 'Arcanist');
$form->setAction('/differential/diff/create/')->setEncType('multipart/form-data')->setUser($request->getUser())->appendChild('<p class="aphront-form-instructions">The best way to create a ' . "Differential diff is by using {$arcanist_link}, but you " . 'can also just paste a diff (e.g., from <tt>svn diff</tt> or ' . '<tt>git diff</tt>) into this box or upload it as a file if you ' . 'really want.</p>')->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Raw Diff')->setName('diff')->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL))->appendChild(id(new AphrontFormFileControl())->setLabel('Raw Diff from file')->setName('diff-file'))->appendChild(id(new AphrontFormSubmitControl())->setValue("Create Diff »"));
$panel = new AphrontPanelView();
$panel->setHeader('Create New Diff');
$panel->appendChild($form);
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
return $this->buildStandardPageResponse($panel, array('title' => 'Create Diff', 'tab' => 'create'));
}
示例11: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$nav = $this->buildSideNav('lease');
$pager = new AphrontPagerView();
$pager->setURI(new PhutilURI('/drydock/lease/'), 'page');
$data = id(new DrydockLease())->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
$data = $pager->sliceResults($data);
$phids = mpull($data, 'getOwnerPHID');
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$resource_ids = mpull($data, 'getResourceID');
$resources = array();
if ($resource_ids) {
$resources = id(new DrydockResource())->loadAllWhere('id IN (%Ld)', $resource_ids);
}
$rows = array();
foreach ($data as $lease) {
$resource = idx($resources, $lease->getResourceID());
$rows[] = array($lease->getID(), DrydockLeaseStatus::getNameForStatus($lease->getStatus()), $lease->getOwnerPHID() ? $handles[$lease->getOwnerPHID()]->renderLink() : null, $lease->getResourceID(), $resource ? phutil_escape_html($resource->getName()) : null, phabricator_datetime($lease->getDateCreated(), $user));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('ID', 'Status', 'Owner', 'Resource ID', 'Resource', 'Created'));
$table->setColumnClasses(array('', '', '', '', 'wide pri', 'right'));
$panel = new AphrontPanelView();
$panel->setHeader('Drydock Leases');
$panel->appendChild($table);
$panel->appendChild($pager);
$nav->appendChild($panel);
return $this->buildStandardPageResponse($nav, array('title' => 'Leases'));
}
示例12: processRequest
public function processRequest()
{
$event = id(new PhabricatorTimelineEvent('NULL'))->load($this->id);
if (!$event) {
return new Aphront404Response();
}
$request = $this->getRequest();
$user = $request->getUser();
if ($event->getDataID()) {
$data = id(new PhabricatorTimelineEventData())->load($event->getDataID());
}
if ($data) {
$data = json_encode($data->getEventData());
} else {
$data = 'null';
}
$form = new AphrontFormView();
$form->setUser($user)->appendChild(id(new AphrontFormStaticControl())->setLabel('ID')->setValue($event->getID()))->appendChild(id(new AphrontFormStaticControl())->setLabel('Type')->setValue($event->getType()))->appendChild(id(new AphrontFormTextAreaControl())->setDisabled(true)->setLabel('Data')->setValue($data))->appendChild(id(new AphrontFormSubmitControl())->addCancelButton('/daemon/timeline/'));
$panel = new AphrontPanelView();
$panel->setHeader('Event');
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
$panel->appendChild($form);
$nav = $this->buildSideNavView();
$nav->selectFilter('timeline');
$nav->appendChild($panel);
return $this->buildApplicationPage($nav, array('title' => 'Timeline Event'));
}
示例13: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$content_type_map = HeraldContentTypeConfig::getContentTypeMap();
if (empty($content_type_map[$this->contentType])) {
$this->contentType = head_key($content_type_map);
}
$rule_type_map = HeraldRuleTypeConfig::getRuleTypeMap();
if (empty($rule_type_map[$this->ruleType])) {
$this->ruleType = HeraldRuleTypeConfig::RULE_TYPE_PERSONAL;
}
// Reorder array to put "personal" first.
$rule_type_map = array_select_keys($rule_type_map, array(HeraldRuleTypeConfig::RULE_TYPE_PERSONAL)) + $rule_type_map;
$captions = array(HeraldRuleTypeConfig::RULE_TYPE_PERSONAL => 'Personal rules notify you about events. You own them, but they can ' . 'only affect you.', HeraldRuleTypeConfig::RULE_TYPE_GLOBAL => 'Global rules notify anyone about events. No one owns them, and ' . 'anyone can edit them. Usually, Global rules are used to notify ' . 'mailing lists.');
$radio = id(new AphrontFormRadioButtonControl())->setLabel('Type')->setName('rule_type')->setValue($this->ruleType);
foreach ($rule_type_map as $value => $name) {
$radio->addButton($value, $name, idx($captions, $value));
}
$form = id(new AphrontFormView())->setUser($user)->setAction('/herald/rule/')->appendChild(id(new AphrontFormSelectControl())->setLabel('New rule for')->setName('content_type')->setValue($this->contentType)->setOptions($content_type_map))->appendChild($radio)->appendChild(id(new AphrontFormSubmitControl())->setValue('Create Rule')->addCancelButton('/herald/view/' . $this->contentType . '/'));
$panel = new AphrontPanelView();
$panel->setHeader('Create New Herald Rule');
$panel->setWidth(AphrontPanelView::WIDTH_FULL);
$panel->appendChild($form);
$nav = $this->renderNav();
$nav->selectFilter('new');
$nav->appendChild($panel);
return $this->buildStandardPageResponse($nav, array('title' => 'Create Herald Rule'));
}
示例14: processRequest
public function processRequest()
{
$request = $this->getRequest();
$pager = new AphrontPagerView();
$pager->setOffset($request->getInt('page'));
$pastes = id(new PhabricatorPaste())->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
$pastes = $pager->sliceResults($pastes);
$pager->setURI($request->getRequestURI(), 'page');
$phids = mpull($pastes, 'getAuthorPHID');
$handles = array();
if ($phids) {
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
}
$rows = array();
foreach ($pastes as $paste) {
$handle = $handles[$paste->getAuthorPHID()];
$rows[] = array(phutil_escape_html('P' . $paste->getID()), phutil_render_tag('a', array('href' => '/p/' . $handle->getName() . '/'), phutil_escape_html($handle->getName())), phutil_escape_html($paste->getLanguage()), phutil_render_tag('a', array('href' => '/P' . $paste->getID()), phutil_escape_html(nonempty($paste->getTitle(), 'Untitled Masterwork P' . $paste->getID()))), phutil_render_tag('a', array('href' => PhabricatorFileURI::getViewURIForPHID($paste->getFilePHID())), phutil_escape_html($paste->getFilePHID())));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('Paste ID', 'Author', 'Language', 'Title', 'File'));
$table->setColumnClasses(array(null, null, null, 'wide pri', null));
$panel = new AphrontPanelView();
$panel->setWidth(AphrontPanelView::WIDTH_FULL);
$panel->setHeader("Paste");
$panel->setCreateButton('Paste Something', '/paste/');
$panel->appendChild($table);
$panel->appendChild($pager);
return $this->buildStandardPageResponse($panel, array('title' => 'Paste List', 'tab' => 'list'));
}
示例15: processRequest
public function processRequest()
{
$request = $this->getRequest();
$nav = new AphrontSideNavView();
$links = array('calls' => 'All Calls');
if (empty($links[$this->view])) {
$this->view = key($links);
}
foreach ($links as $slug => $name) {
$nav->addNavItem(phutil_render_tag('a', array('href' => '/conduit/log/view/' . $slug . '/', 'class' => $slug == $this->view ? 'aphront-side-nav-selected' : null), phutil_escape_html($name)));
}
$conn_table = new PhabricatorConduitConnectionLog();
$call_table = new PhabricatorConduitMethodCallLog();
$conn_r = $call_table->establishConnection('r');
$pager = new AphrontPagerView();
$pager->setOffset($request->getInt('page'));
$calls = $call_table->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
$calls = $pager->sliceResults($calls);
$pager->setURI(new PhutilURI('/conduit/log/view/' . $this->view . '/'), 'page');
$pager->setEnableKeyboardShortcuts(true);
$min = $pager->getOffset() + 1;
$max = $min + count($calls) - 1;
$conn_ids = array_filter(mpull($calls, 'getConnectionID'));
$conns = array();
if ($conn_ids) {
$conns = $conn_table->loadAllWhere('id IN (%Ld)', $conn_ids);
}
$table = $this->renderCallTable($calls, $conns);
$panel = new AphrontPanelView();
$panel->setHeader('Conduit Method Calls (' . $min . '-' . $max . ')');
$panel->appendChild($table);
$panel->appendChild($pager);
$nav->appendChild($panel);
return $this->buildStandardPageResponse($nav, array('title' => 'Conduit Logs', 'tab' => 'logs'));
}