本文整理汇总了PHP中AphrontRequest类的典型用法代码示例。如果您正苦于以下问题:PHP AphrontRequest类的具体用法?PHP AphrontRequest怎么用?PHP AphrontRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AphrontRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$name = $request->getURIData('name');
$service = id(new AlmanacServiceQuery())->setViewer($viewer)->withNames(array($name))->executeOne();
if (!$service) {
return new Aphront404Response();
}
$title = pht('Service %s', $service->getName());
$property_list = $this->buildPropertyList($service);
$action_list = $this->buildActionList($service);
$property_list->setActionList($action_list);
$header = id(new PHUIHeaderView())->setUser($viewer)->setHeader($service->getName())->setPolicyObject($service);
$box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($property_list);
$messages = $service->getServiceType()->getStatusMessages($service);
if ($messages) {
$box->setFormErrors($messages);
}
if ($service->getIsLocked()) {
$this->addLockMessage($box, pht('This service is locked, and can not be edited.'));
}
$bindings = $this->buildBindingList($service);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($service->getName());
$timeline = $this->buildTransactionTimeline($service, new AlmanacServiceTransactionQuery());
$timeline->setShouldTerminate(true);
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild(array($box, $bindings, $this->buildAlmanacPropertiesTable($service), $timeline));
}
开发者ID:truSense,项目名称:phabricator,代码行数:28,代码来源:AlmanacServiceViewController.php
示例2: buildRequest
public function buildRequest()
{
$request = new AphrontRequest($this->getHost(), $this->getPath());
$request->setRequestData($_GET + $_POST);
$request->setApplicationConfiguration($this);
return $request;
}
开发者ID:hunterbridges,项目名称:phabricator,代码行数:7,代码来源:AphrontDefaultApplicationConfiguration.php
示例3: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$books = id(new DivinerBookQuery())->setViewer($viewer)->execute();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->setBorder(true);
$crumbs->addTextCrumb(pht('Books'));
$query_button = id(new PHUIButtonView())->setTag('a')->setHref($this->getApplicationURI('query/'))->setText(pht('Advanced Search'))->setIcon('fa-search');
$header = id(new PHUIHeaderView())->setHeader(pht('Documentation Books'))->addActionLink($query_button);
$document = new PHUIDocumentViewPro();
$document->setHeader($header);
$document->addClass('diviner-view');
if ($books) {
$books = msort($books, 'getTitle');
$list = array();
foreach ($books as $book) {
$item = id(new DivinerBookItemView())->setTitle($book->getTitle())->setHref('/book/' . $book->getName() . '/')->setSubtitle($book->getPreface());
$list[] = $item;
}
$list = id(new PHUIBoxView())->addPadding(PHUI::PADDING_MEDIUM_TOP)->appendChild($list);
$document->appendChild($list);
} else {
$text = pht("(NOTE) **Looking for Phabricator documentation?** " . "If you're looking for help and information about Phabricator, " . "you can [[https://secure.phabricator.com/diviner/ | " . "browse the public Phabricator documentation]] on the live site.\n\n" . "Diviner is the documentation generator used to build the " . "Phabricator documentation.\n\n" . "You haven't generated any Diviner documentation books yet, so " . "there's nothing to show here. If you'd like to generate your own " . "local copy of the Phabricator documentation and have it appear " . "here, run this command:\n\n" . " %s\n\n", 'phabricator/ $ ./bin/diviner generate');
$text = new PHUIRemarkupView($viewer, $text);
$document->appendChild($text);
}
return $this->newPage()->setTitle(pht('Documentation Books'))->setCrumbs($crumbs)->appendChild(array($document));
}
开发者ID:rchicoli,项目名称:phabricator,代码行数:28,代码来源:DivinerMainController.php
示例4: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$dashboard = id(new PhabricatorDashboardQuery())->setViewer($viewer)->withIDs(array($id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$dashboard) {
return new Aphront404Response();
}
$view_uri = $this->getApplicationURI('manage/' . $dashboard->getID() . '/');
if ($request->isFormPost()) {
if ($dashboard->isArchived()) {
$new_status = PhabricatorDashboard::STATUS_ACTIVE;
} else {
$new_status = PhabricatorDashboard::STATUS_ARCHIVED;
}
$xactions = array();
$xactions[] = id(new PhabricatorDashboardTransaction())->setTransactionType(PhabricatorDashboardTransaction::TYPE_STATUS)->setNewValue($new_status);
id(new PhabricatorDashboardTransactionEditor())->setActor($viewer)->setContentSourceFromRequest($request)->setContinueOnNoEffect(true)->setContinueOnMissingFields(true)->applyTransactions($dashboard, $xactions);
return id(new AphrontRedirectResponse())->setURI($view_uri);
}
if ($dashboard->isArchived()) {
$title = pht('Activate Dashboard');
$body = pht('This dashboard will become active again.');
$button = pht('Activate Dashboard');
} else {
$title = pht('Archive Dashboard');
$body = pht('This dashboard will be marked as archived.');
$button = pht('Archive Dashboard');
}
return $this->newDialog()->setTitle($title)->appendChild($body)->addCancelButton($view_uri)->addSubmitButton($button);
}
开发者ID:pugong,项目名称:phabricator,代码行数:31,代码来源:PhabricatorDashboardArchiveController.php
示例5: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$initiative = id(new FundInitiativeQuery())->setViewer($viewer)->withIDs(array($id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$initiative) {
return new Aphront404Response();
}
$initiative_uri = '/' . $initiative->getMonogram();
$is_close = !$initiative->isClosed();
if ($request->isFormPost()) {
$type_status = FundInitiativeTransaction::TYPE_STATUS;
if ($is_close) {
$new_status = FundInitiative::STATUS_CLOSED;
} else {
$new_status = FundInitiative::STATUS_OPEN;
}
$xaction = id(new FundInitiativeTransaction())->setTransactionType($type_status)->setNewValue($new_status);
$editor = id(new FundInitiativeEditor())->setActor($viewer)->setContentSourceFromRequest($request)->setContinueOnMissingFields(true);
$editor->applyTransactions($initiative, array($xaction));
return id(new AphrontRedirectResponse())->setURI($initiative_uri);
}
if ($is_close) {
$title = pht('Close Initiative?');
$body = pht('Really close this initiative? Users will no longer be able to ' . 'back it.');
$button_text = pht('Close Initiative');
} else {
$title = pht('Reopen Initiative?');
$body = pht('Really reopen this initiative?');
$button_text = pht('Reopen Initiative');
}
return $this->newDialog()->setTitle($title)->appendParagraph($body)->addCancelButton($initiative_uri)->addSubmitButton($button_text);
}
开发者ID:pugong,项目名称:phabricator,代码行数:33,代码来源:FundInitiativeCloseController.php
示例6: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$timeline = null;
$url = id(new PhabricatorPhurlURLQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
if (!$url) {
return new Aphront404Response();
}
$title = $url->getMonogram();
$page_title = $title . ' ' . $url->getName();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($title, $url->getURI());
$timeline = $this->buildTransactionTimeline($url, new PhabricatorPhurlURLTransactionQuery());
$header = $this->buildHeaderView($url);
$actions = $this->buildActionView($url);
$properties = $this->buildPropertyView($url);
$properties->setActionList($actions);
$url_error = id(new PHUIInfoView())->setErrors(array(pht('This URL is invalid due to a bad protocol.')))->setIsHidden($url->isValid());
$box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties)->setInfoView($url_error);
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
$add_comment_header = $is_serious ? pht('Add Comment') : pht('More Cowbell');
$draft = PhabricatorDraft::newFromUserAndKey($viewer, $url->getPHID());
$comment_uri = $this->getApplicationURI('/phurl/comment/' . $url->getID() . '/');
$add_comment_form = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($url->getPHID())->setDraft($draft)->setHeaderText($add_comment_header)->setAction($comment_uri)->setSubmitButtonName(pht('Add Comment'));
return $this->buildApplicationPage(array($crumbs, $box, $timeline, $add_comment_form), array('title' => $page_title, 'pageObjects' => array($url->getPHID())));
}
开发者ID:hamilyjing,项目名称:phabricator,代码行数:27,代码来源:PhabricatorPhurlURLViewController.php
示例7: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$blog = id(new PhameBlogQuery())->setViewer($viewer)->withIDs(array($id))->needProfileImage(true)->executeOne();
if (!$blog) {
return new Aphront404Response();
}
if ($blog->isArchived()) {
$header_icon = 'fa-ban';
$header_name = pht('Archived');
$header_color = 'dark';
} else {
$header_icon = 'fa-check';
$header_name = pht('Active');
$header_color = 'bluegrey';
}
$picture = $blog->getProfileImageURI();
$header = id(new PHUIHeaderView())->setHeader($blog->getName())->setUser($viewer)->setPolicyObject($blog)->setImage($picture)->setStatus($header_icon, $header_color, $header_name);
$actions = $this->renderActions($blog, $viewer);
$properties = $this->renderProperties($blog, $viewer, $actions);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Blogs'), $this->getApplicationURI('blog/'));
$crumbs->addTextCrumb($blog->getName());
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
$timeline = $this->buildTransactionTimeline($blog, new PhameBlogTransactionQuery());
$timeline->setShouldTerminate(true);
return $this->newPage()->setTitle($blog->getName())->setCrumbs($crumbs)->appendChild(array($object_box, $timeline));
}
开发者ID:MenZil-Team,项目名称:phabricator,代码行数:29,代码来源:PhameBlogManageController.php
示例8: processRequest
public function processRequest(AphrontRequest $request)
{
$viewer = $request->getUser();
$tokens = id(new PhabricatorAuthTemporaryTokenQuery())->setViewer($viewer)->withObjectPHIDs(array($viewer->getPHID()))->execute();
$rows = array();
foreach ($tokens as $token) {
if ($token->isRevocable()) {
$button = javelin_tag('a', array('href' => '/auth/token/revoke/' . $token->getID() . '/', 'class' => 'small grey button', 'sigil' => 'workflow'), pht('Revoke'));
} else {
$button = javelin_tag('a', array('class' => 'small grey button disabled'), pht('Revoke'));
}
if ($token->getTokenExpires() >= time()) {
$expiry = phabricator_datetime($token->getTokenExpires(), $viewer);
} else {
$expiry = pht('Expired');
}
$rows[] = array($token->getTokenReadableTypeName(), $expiry, $button);
}
$table = new AphrontTableView($rows);
$table->setNoDataString(pht("You don't have any active tokens."));
$table->setHeaders(array(pht('Type'), pht('Expires'), pht('')));
$table->setColumnClasses(array('wide', 'right', 'action'));
$terminate_button = id(new PHUIButtonView())->setText(pht('Revoke All'))->setHref('/auth/token/revoke/all/')->setTag('a')->setWorkflow(true)->setIcon('fa-exclamation-triangle');
$header = id(new PHUIHeaderView())->setHeader(pht('Temporary Tokens'))->addActionLink($terminate_button);
$panel = id(new PHUIObjectBoxView())->setHeader($header)->setTable($table);
return $panel;
}
开发者ID:truSense,项目名称:phabricator,代码行数:27,代码来源:PhabricatorTokensSettingsPanel.php
示例9: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$board_id = $request->getURIData('projectID');
$board = id(new PhabricatorProjectQuery())->setViewer($viewer)->withIDs(array($board_id))->needImages(true)->executeOne();
if (!$board) {
return new Aphront404Response();
}
$this->setProject($board);
// Perform layout of no tasks to load and populate the columns in the
// correct order.
$layout_engine = id(new PhabricatorBoardLayoutEngine())->setViewer($viewer)->setBoardPHIDs(array($board->getPHID()))->setObjectPHIDs(array())->setFetchAllBoards(true)->executeLayout();
$columns = $layout_engine->getColumns($board->getPHID());
$board_id = $board->getID();
$header = $this->buildHeaderView($board);
$actions = $this->buildActionView($board);
$properties = $this->buildPropertyView($board);
$properties->setActionList($actions);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Workboard'), "/project/board/{$board_id}/");
$crumbs->addTextCrumb(pht('Manage'));
$box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
$nav = $this->getProfileMenu();
$title = array(pht('Manage Workboard'), $board->getDisplayName());
$columns_list = $this->buildColumnsList($board, $columns);
return $this->newPage()->setTitle($title)->setNavigation($nav)->setCrumbs($crumbs)->appendChild(array($box, $columns_list));
}
开发者ID:psyclone241,项目名称:phabricator,代码行数:27,代码来源:PhabricatorProjectBoardManageController.php
示例10: processDiffusionRequest
protected function processDiffusionRequest(AphrontRequest $request)
{
$limit = 500;
$offset = $request->getInt('offset', 0);
$drequest = $this->getDiffusionRequest();
$branch = $drequest->loadBranch();
$messages = $this->loadLintMessages($branch, $limit, $offset);
$is_dir = substr('/' . $drequest->getPath(), -1) == '/';
$authors = $this->loadViewerHandles(ipull($messages, 'authorPHID'));
$rows = array();
foreach ($messages as $message) {
$path = phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'lint', 'path' => $message['path']))), substr($message['path'], strlen($drequest->getPath()) + 1));
$line = phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'browse', 'path' => $message['path'], 'line' => $message['line'], 'commit' => $branch->getLintCommit()))), $message['line']);
$author = $message['authorPHID'];
if ($author && $authors[$author]) {
$author = $authors[$author]->renderLink();
}
$rows[] = array($path, $line, $author, ArcanistLintSeverity::getStringForSeverity($message['severity']), $message['name'], $message['description']);
}
$table = id(new AphrontTableView($rows))->setHeaders(array(pht('Path'), pht('Line'), pht('Author'), pht('Severity'), pht('Name'), pht('Description')))->setColumnClasses(array('', 'n'))->setColumnVisibility(array($is_dir));
$content = array();
$pager = id(new AphrontPagerView())->setPageSize($limit)->setOffset($offset)->setHasMorePages(count($messages) >= $limit)->setURI($request->getRequestURI(), 'offset');
$content[] = id(new PHUIObjectBoxView())->setHeaderText(pht('Lint Details'))->appendChild($table);
$crumbs = $this->buildCrumbs(array('branch' => true, 'path' => true, 'view' => 'lint'));
return $this->buildApplicationPage(array($crumbs, $content, $pager), array('title' => array(pht('Lint'), $drequest->getRepository()->getCallsign())));
}
开发者ID:hrb518,项目名称:phabricator,代码行数:26,代码来源:DiffusionLintDetailsController.php
示例11: handleRequest
public function handleRequest(AphrontRequest $request)
{
$id = $request->getURIData('class');
$classes = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorUIExample')->loadObjects();
$classes = msort($classes, 'getName');
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/')));
foreach ($classes as $class => $obj) {
$name = $obj->getName();
$nav->addFilter($class, $name);
}
$selected = $nav->selectFilter($id, head_key($classes));
$example = $classes[$selected];
$example->setRequest($this->getRequest());
$result = $example->renderExample();
if ($result instanceof AphrontResponse) {
// This allows examples to generate dialogs, etc., for demonstration.
return $result;
}
require_celerity_resource('phabricator-ui-example-css');
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($example->getName());
$note = id(new PHUIInfoView())->setTitle(pht('%s (%s)', $example->getName(), get_class($example)))->appendChild($example->getDescription())->setSeverity(PHUIInfoView::SEVERITY_NODATA);
$nav->appendChild(array($crumbs, $note, $result));
return $this->buildApplicationPage($nav, array('title' => $example->getName()));
}
开发者ID:JohnnyEstilles,项目名称:phabricator,代码行数:26,代码来源:PhabricatorUIExampleRenderController.php
示例12: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$stories = id(new PhabricatorNotificationQuery())->setViewer($viewer)->withUserPHIDs(array($viewer->getPHID()))->withKeys(array($request->getStr('key')))->execute();
if (!$stories) {
return $this->buildEmptyResponse();
}
$story = head($stories);
if ($story->getAuthorPHID() === $viewer->getPHID()) {
// Don't show the user individual notifications about their own
// actions. Primarily, this stops pages from showing notifications
// immediately after you click "Submit" on a comment form if the
// notification server returns faster than the web server.
// TODO: It would be nice to retain the "page updated" bubble on copies
// of the page that are open in other tabs, but there isn't an obvious
// way to do this easily.
return $this->buildEmptyResponse();
}
$builder = id(new PhabricatorNotificationBuilder(array($story)))->setUser($viewer)->setShowTimestamps(false);
$content = $builder->buildView()->render();
$dict = $builder->buildDict();
$data = $dict[0];
$response = array('pertinent' => true, 'primaryObjectPHID' => $story->getPrimaryObjectPHID(), 'desktopReady' => $data['desktopReady'], 'href' => $data['href'], 'icon' => $data['icon'], 'title' => $data['title'], 'body' => $data['body'], 'content' => hsprintf('%s', $content));
return id(new AphrontAjaxResponse())->setContent($response);
}
开发者ID:endlessm,项目名称:phabricator,代码行数:25,代码来源:PhabricatorNotificationIndividualController.php
示例13: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$dashboard_uri = $this->getApplicationURI('view/' . $id . '/');
// TODO: This UI should drop a lot of capabilities if the user can't
// edit the dashboard, but we should still let them in for "Install" and
// "View History".
$dashboard = id(new PhabricatorDashboardQuery())->setViewer($viewer)->withIDs(array($id))->needPanels(true)->executeOne();
if (!$dashboard) {
return new Aphront404Response();
}
$can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $dashboard, PhabricatorPolicyCapability::CAN_EDIT);
$title = $dashboard->getName();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Dashboard %d', $dashboard->getID()), $dashboard_uri);
$crumbs->addTextCrumb(pht('Manage'));
$crumbs->setBorder(true);
$header = $this->buildHeaderView($dashboard);
$curtain = $this->buildCurtainview($dashboard);
$properties = $this->buildPropertyView($dashboard);
$timeline = $this->buildTransactionTimeline($dashboard, new PhabricatorDashboardTransactionQuery());
$info_view = null;
if (!$can_edit) {
$no_edit = pht('You do not have permission to edit this dashboard. If you want to ' . 'make changes, make a copy first.');
$info_view = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NOTICE)->setErrors(array($no_edit));
}
$rendered_dashboard = id(new PhabricatorDashboardRenderingEngine())->setViewer($viewer)->setDashboard($dashboard)->setArrangeMode($can_edit)->renderDashboard();
$dashboard_box = id(new PHUIBoxView())->addClass('dashboard-preview-box')->appendChild($rendered_dashboard);
$view = id(new PHUITwoColumnView())->setHeader($header)->setCurtain($curtain)->setMainColumn(array($info_view, $properties, $timeline))->setFooter($dashboard_box);
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($view);
}
开发者ID:rchicoli,项目名称:phabricator,代码行数:32,代码来源:PhabricatorDashboardManageController.php
示例14: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $this->getViewer();
$config = $this->loadConfigForEdit();
if (!$config) {
return id(new Aphront404Response());
}
$engine_key = $config->getEngineKey();
$key = $config->getIdentifier();
$cancel_uri = "/transactions/editengine/{$engine_key}/view/{$key}/";
$type = PhabricatorEditEngineConfigurationTransaction::TYPE_DISABLE;
if ($request->isFormPost()) {
$xactions = array();
$xactions[] = id(new PhabricatorEditEngineConfigurationTransaction())->setTransactionType($type)->setNewValue(!$config->getIsDisabled());
$editor = id(new PhabricatorEditEngineConfigurationEditor())->setActor($viewer)->setContentSourceFromRequest($request)->setContinueOnMissingFields(true)->setContinueOnNoEffect(true);
$editor->applyTransactions($config, $xactions);
return id(new AphrontRedirectResponse())->setURI($cancel_uri);
}
if ($config->getIsDisabled()) {
$title = pht('Enable Form');
$body = pht('Enable this form? Users who can see it will be able to use it to ' . 'create objects.');
$button = pht('Enable Form');
} else {
$title = pht('Disable Form');
$body = pht('Disable this form? Users will no longer be able to use it.');
$button = pht('Disable Form');
}
return $this->newDialog()->setTitle($title)->appendParagraph($body)->addSubmitButton($button)->addCancelbutton($cancel_uri);
}
开发者ID:pugong,项目名称:phabricator,代码行数:29,代码来源:PhabricatorEditEngineConfigurationDisableController.php
示例15: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $this->getViewer();
// If the user already has a full session, just kick them out of here.
$has_partial_session = $viewer->hasSession() && $viewer->getSession()->getIsPartial();
if (!$has_partial_session) {
return id(new AphrontRedirectResponse())->setURI('/');
}
$engine = new PhabricatorAuthSessionEngine();
// If this cookie is set, the user is headed into a high security area
// after login (normally because of a password reset) so if they are
// able to pass the checkpoint we just want to put their account directly
// into high security mode, rather than prompt them again for the same
// set of credentials.
$jump_into_hisec = $request->getCookie(PhabricatorCookies::COOKIE_HISEC);
try {
$token = $engine->requireHighSecuritySession($viewer, $request, '/logout/', $jump_into_hisec);
} catch (PhabricatorAuthHighSecurityRequiredException $ex) {
$form = id(new PhabricatorAuthSessionEngine())->renderHighSecurityForm($ex->getFactors(), $ex->getFactorValidationResults(), $viewer, $request);
return $this->newDialog()->setTitle(pht('Provide Multi-Factor Credentials'))->setShortTitle(pht('Multi-Factor Login'))->setWidth(AphrontDialogView::WIDTH_FORM)->addHiddenInput(AphrontRequest::TYPE_HISEC, true)->appendParagraph(pht('Welcome, %s. To complete the login process, provide your ' . 'multi-factor credentials.', phutil_tag('strong', array(), $viewer->getUsername())))->appendChild($form->buildLayoutView())->setSubmitURI($request->getPath())->addCancelButton($ex->getCancelURI())->addSubmitButton(pht('Continue'));
}
// Upgrade the partial session to a full session.
$engine->upgradePartialSession($viewer);
// TODO: It might be nice to add options like "bind this session to my IP"
// here, even for accounts without multi-factor auth attached to them.
$next = PhabricatorCookies::getNextURICookie($request);
$request->clearCookie(PhabricatorCookies::COOKIE_NEXTURI);
$request->clearCookie(PhabricatorCookies::COOKIE_HISEC);
if (!PhabricatorEnv::isValidLocalURIForLink($next)) {
$next = '/';
}
return id(new AphrontRedirectResponse())->setURI($next);
}
开发者ID:pugong,项目名称:phabricator,代码行数:33,代码来源:PhabricatorAuthFinishController.php
示例16: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$blueprint = id(new DrydockBlueprintQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
if (!$blueprint) {
return new Aphront404Response();
}
$title = $blueprint->getBlueprintName();
$header = id(new PHUIHeaderView())->setHeader($title)->setUser($viewer)->setPolicyObject($blueprint);
if ($blueprint->getIsDisabled()) {
$header->setStatus('fa-ban', 'red', pht('Disabled'));
} else {
$header->setStatus('fa-check', 'bluegrey', pht('Active'));
}
$actions = $this->buildActionListView($blueprint);
$properties = $this->buildPropertyListView($blueprint, $actions);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Blueprint %d', $blueprint->getID()));
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
$field_list = PhabricatorCustomField::getObjectFields($blueprint, PhabricatorCustomField::ROLE_VIEW);
$field_list->setViewer($viewer)->readFieldsFromStorage($blueprint);
$field_list->appendFieldsToPropertyList($blueprint, $viewer, $properties);
$resource_box = $this->buildResourceBox($blueprint);
$authorizations_box = $this->buildAuthorizationsBox($blueprint);
$timeline = $this->buildTransactionTimeline($blueprint, new DrydockBlueprintTransactionQuery());
$timeline->setShouldTerminate(true);
$log_query = id(new DrydockLogQuery())->withBlueprintPHIDs(array($blueprint->getPHID()));
$log_box = $this->buildLogBox($log_query, $this->getApplicationURI("blueprint/{$id}/logs/query/all/"));
return $this->buildApplicationPage(array($crumbs, $object_box, $resource_box, $authorizations_box, $log_box, $timeline), array('title' => $title));
}
开发者ID:patelhardik,项目名称:phabricator,代码行数:31,代码来源:DrydockBlueprintViewController.php
示例17: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
if ($request->isFormPost()) {
$uri = new PhutilURI('/fact/chart/');
$uri->setQueryParam('y1', $request->getStr('y1'));
return id(new AphrontRedirectResponse())->setURI($uri);
}
$types = array('+N:*', '+N:DREV', 'updated');
$engines = PhabricatorFactEngine::loadAllEngines();
$specs = PhabricatorFactSpec::newSpecsForFactTypes($engines, $types);
$facts = id(new PhabricatorFactAggregate())->loadAllWhere('factType IN (%Ls)', $types);
$rows = array();
foreach ($facts as $fact) {
$spec = $specs[$fact->getFactType()];
$name = $spec->getName();
$value = $spec->formatValueForDisplay($viewer, $fact->getValueX());
$rows[] = array($name, $value);
}
$table = new AphrontTableView($rows);
$table->setHeaders(array(pht('Fact'), pht('Value')));
$table->setColumnClasses(array('wide', 'n'));
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('Facts'));
$panel->setTable($table);
$chart_form = $this->buildChartForm();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Home'));
$title = pht('Facts');
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild(array($chart_form, $panel));
}
开发者ID:rchicoli,项目名称:phabricator,代码行数:31,代码来源:PhabricatorFactHomeController.php
示例18: processDiffusionRequest
protected function processDiffusionRequest(AphrontRequest $request)
{
$viewer = $request->getUser();
$this->requireApplicationCapability(DiffusionCreateRepositoriesCapability::CAPABILITY);
if ($request->isFormPost()) {
if ($request->getStr('type')) {
switch ($request->getStr('type')) {
case 'create':
$uri = $this->getApplicationURI('create/');
break;
case 'import':
default:
$uri = $this->getApplicationURI('import/');
break;
}
return id(new AphrontRedirectResponse())->setURI($uri);
}
}
$doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: Repository Hosting');
$doc_link = phutil_tag('a', array('href' => $doc_href, 'target' => '_blank'), pht('Diffusion User Guide: Repository Hosting'));
$form = id(new AphrontFormView())->setUser($viewer)->appendChild(id(new AphrontFormRadioButtonControl())->setName('type')->addButton('create', pht('Create a New Hosted Repository'), array(pht('Create a new, empty repository which Phabricator will host. ' . 'For instructions on configuring repository hosting, see %s.', $doc_link)))->addButton('import', pht('Import an Existing External Repository'), pht("Import a repository hosted somewhere else, like GitHub, " . "Bitbucket, or your organization's existing servers. " . "Phabricator will read changes from the repository but will " . "not host or manage it. The authoritative master version of " . "the repository will stay where it is now.")))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Continue'))->addCancelButton($this->getApplicationURI()));
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('New Repository'));
$form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Create or Import Repository'))->setForm($form);
return $this->buildApplicationPage(array($crumbs, $form_box), array('title' => pht('New Repository')));
}
开发者ID:patelhardik,项目名称:phabricator,代码行数:26,代码来源:DiffusionRepositoryNewController.php
示例19: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $this->getViewer();
$id = $request->getURIData('id');
$user = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withIDs(array($id))->needProfile(true)->needProfileImage(true)->executeOne();
if (!$user) {
return new Aphront404Response();
}
$this->setUser($user);
$profile = $user->loadUserProfile();
$picture = $user->getProfileImageURI();
$profile_icon = PhabricatorPeopleIconSet::getIconIcon($profile->getIcon());
$profile_icon = id(new PHUIIconView())->setIcon($profile_icon);
$profile_title = $profile->getDisplayTitle();
$header = id(new PHUIHeaderView())->setHeader($user->getFullName())->setSubheader(array($profile_icon, $profile_title))->setImage($picture);
$actions = $this->buildActionList($user);
$properties = $this->buildPropertyView($user);
$properties->setActionList($actions);
$name = $user->getUsername();
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
$nav = $this->getProfileMenu();
$nav->selectFilter(PhabricatorPeopleProfilePanelEngine::PANEL_MANAGE);
$timeline = $this->buildTransactionTimeline($user, new PhabricatorPeopleTransactionQuery());
$timeline->setShouldTerminate(true);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Manage'));
return $this->newPage()->setTitle(array(pht('Manage User'), $user->getUsername()))->setNavigation($nav)->setCrumbs($crumbs)->appendChild(array($object_box, $timeline));
}
开发者ID:billtt,项目名称:phabricator,代码行数:28,代码来源:PhabricatorPeopleProfileManageController.php
示例20: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$question = id(new PonderQuestionQuery())->setViewer($viewer)->withIDs(array($id))->needAnswers(true)->needViewerVotes(true)->executeOne();
if (!$question) {
return new Aphront404Response();
}
$question->attachVotes($viewer->getPHID());
$question_xactions = $this->buildQuestionTransactions($question);
$answers = $this->buildAnswers($question->getAnswers());
$authors = mpull($question->getAnswers(), null, 'getAuthorPHID');
if (isset($authors[$viewer->getPHID()])) {
$answer_add_panel = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NOTICE)->appendChild(pht('You have already answered this question. You can not answer ' . 'twice, but you can edit your existing answer.'));
} else {
$answer_add_panel = new PonderAddAnswerView();
$answer_add_panel->setQuestion($question)->setUser($viewer)->setActionURI('/ponder/answer/add/');
}
$header = new PHUIHeaderView();
$header->setHeader($question->getTitle());
$header->setUser($viewer);
$header->setPolicyObject($question);
if ($question->getStatus() == PonderQuestionStatus::STATUS_OPEN) {
$header->setStatus('fa-square-o', 'bluegrey', pht('Open'));
} else {
$header->setStatus('fa-check-square-o', 'dark', pht('Closed'));
}
$actions = $this->buildActionListView($question);
$properties = $this->buildPropertyListView($question, $actions);
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
$crumbs = $this->buildApplicationCrumbs($this->buildSideNavView());
$crumbs->addTextCrumb('Q' . $id, '/Q' . $id);
$ponder_view = phutil_tag('div', array('class' => 'ponder-question-view'), array($crumbs, $object_box, $question_xactions, $answers, $answer_add_panel));
return $this->buildApplicationPage(array($ponder_view), array('title' => 'Q' . $question->getID() . ' ' . $question->getTitle(), 'pageObjects' => array_merge(array($question->getPHID()), mpull($question->getAnswers(), 'getPHID'))));
}
开发者ID:shrimpma,项目名称:phabricator,代码行数:35,代码来源:PonderQuestionViewController.php
注:本文中的AphrontRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论