当前位置: 首页>>代码示例>>PHP>>正文


PHP AphrontRequest::getUser方法代码示例

本文整理汇总了PHP中AphrontRequest::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontRequest::getUser方法的具体用法?PHP AphrontRequest::getUser怎么用?PHP AphrontRequest::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AphrontRequest的用法示例。


在下文中一共展示了AphrontRequest::getUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('branchID');
     $branch = id(new ReleephBranchQuery())->setViewer($viewer)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->withIDs(array($id))->executeOne();
     if (!$branch) {
         return new Aphront404Response();
     }
     $this->setBranch($branch);
     $symbolic_name = $request->getStr('symbolicName', $branch->getSymbolicName());
     if ($request->isFormPost()) {
         $existing_with_same_symbolic_name = id(new ReleephBranch())->loadOneWhere('id != %d AND releephProjectID = %d AND symbolicName = %s', $branch->getID(), $branch->getReleephProjectID(), $symbolic_name);
         $branch->openTransaction();
         $branch->setSymbolicName($symbolic_name);
         if ($existing_with_same_symbolic_name) {
             $existing_with_same_symbolic_name->setSymbolicName(null)->save();
         }
         $branch->save();
         $branch->saveTransaction();
         return id(new AphrontRedirectResponse())->setURI($this->getBranchViewURI($branch));
     }
     $phids = array();
     $phids[] = $creator_phid = $branch->getCreatedByUserPHID();
     $phids[] = $cut_commit_phid = $branch->getCutPointCommitPHID();
     $handles = id(new PhabricatorHandleQuery())->setViewer($request->getUser())->withPHIDs($phids)->execute();
     $form = id(new AphrontFormView())->setUser($request->getUser())->appendChild(id(new AphrontFormStaticControl())->setLabel(pht('Branch Name'))->setValue($branch->getName()))->appendChild(id(new AphrontFormMarkupControl())->setLabel(pht('Cut Point'))->setValue($handles[$cut_commit_phid]->renderLink()))->appendChild(id(new AphrontFormMarkupControl())->setLabel(pht('Created By'))->setValue($handles[$creator_phid]->renderLink()))->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Symbolic Name'))->setName('symbolicName')->setValue($symbolic_name)->setCaption(pht('Mutable alternate name, for easy reference, (e.g. "LATEST")')))->appendChild(id(new AphrontFormSubmitControl())->addCancelButton($this->getBranchViewURI($branch))->setValue(pht('Save Branch')));
     $title = pht('Edit Branch %s', $branch->getDisplayNameWithDetail());
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Edit'));
     $box = id(new PHUIObjectBoxView())->setHeaderText($title)->appendChild($form);
     return $this->buildApplicationPage(array($crumbs, $box), array('title' => $title));
 }
开发者ID:pugong,项目名称:phabricator,代码行数:32,代码来源:ReleephBranchEditController.php

示例2: processDiffusionRequest

 protected function processDiffusionRequest(AphrontRequest $request)
 {
     $repository_phid = $request->getStr('repositoryPHID');
     $repository = id(new PhabricatorRepositoryQuery())->setViewer($request->getUser())->withPHIDs(array($repository_phid))->executeOne();
     if (!$repository) {
         return new Aphront400Response();
     }
     $query_path = $request->getStr('q');
     if (preg_match('@/$@', $query_path)) {
         $query_dir = $query_path;
     } else {
         $query_dir = dirname($query_path) . '/';
     }
     $query_dir = ltrim($query_dir, '/');
     $drequest = DiffusionRequest::newFromDictionary(array('user' => $request->getUser(), 'repository' => $repository, 'path' => $query_dir));
     $this->setDiffusionRequest($drequest);
     $browse_results = DiffusionBrowseResultSet::newFromConduit($this->callConduitWithDiffusionRequest('diffusion.browsequery', array('path' => $drequest->getPath(), 'commit' => $drequest->getCommit())));
     $paths = $browse_results->getPaths();
     $output = array();
     foreach ($paths as $path) {
         $full_path = $query_dir . $path->getPath();
         if ($path->getFileType() == DifferentialChangeType::FILE_DIRECTORY) {
             $full_path .= '/';
         }
         $output[] = array('/' . $full_path, null, substr(md5($full_path), 0, 7));
     }
     return id(new AphrontAjaxResponse())->setContent($output);
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:28,代码来源:DiffusionPathCompleteController.php

示例3: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $user = $request->getUser();
     $query = id(new PhabricatorProjectQuery())->setViewer($user)->needMembers(true)->needWatchers(true)->needImages(true)->needSlugs(true);
     $id = $request->getURIData('id');
     $slug = $request->getURIData('slug');
     if ($slug) {
         $query->withSlugs(array($slug));
     } else {
         $query->withIDs(array($id));
     }
     $project = $query->executeOne();
     if (!$project) {
         return new Aphront404Response();
     }
     if ($slug && $slug != $project->getPrimarySlug()) {
         return id(new AphrontRedirectResponse())->setURI('/tag/' . $project->getPrimarySlug() . '/');
     }
     require_celerity_resource('phabricator-profile-css');
     $query = new PhabricatorFeedQuery();
     $query->setFilterPHIDs(array($project->getPHID()));
     $query->setLimit(50);
     $query->setViewer($request->getUser());
     $stories = $query->execute();
     $feed = $this->renderStories($stories);
     $content = phutil_tag_div('phabricator-project-feed', $feed);
     $nav = $this->buildIconNavView($project);
     $nav->selectFilter("feed/{$id}/");
     $nav->appendChild($content);
     return $this->buildApplicationPage($nav, array('title' => $project->getName()));
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:31,代码来源:PhabricatorProjectFeedController.php

示例4: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $user = $request->getUser();
     $query = id(new PhabricatorProjectQuery())->setViewer($user)->needMembers(true)->needWatchers(true)->needImages(true)->needSlugs(true);
     $id = $request->getURIData('id');
     $slug = $request->getURIData('slug');
     if ($slug) {
         $query->withSlugs(array($slug));
     } else {
         $query->withIDs(array($id));
     }
     $project = $query->executeOne();
     if (!$project) {
         return new Aphront404Response();
     }
     if ($slug && $slug != $project->getPrimarySlug()) {
         return id(new AphrontRedirectResponse())->setURI('/tag/' . $project->getPrimarySlug() . '/');
     }
     $query = new PhabricatorFeedQuery();
     $query->setFilterPHIDs(array($project->getPHID()));
     $query->setLimit(50);
     $query->setViewer($request->getUser());
     $stories = $query->execute();
     $feed = $this->renderStories($stories);
     $box = id(new PHUIObjectBoxView())->setHeaderText(pht('Project Activity'))->appendChild($feed);
     $nav = $this->buildIconNavView($project);
     $nav->selectFilter("feed/{$id}/");
     $nav->appendChild($box);
     return $this->buildApplicationPage($nav, array('title' => $project->getName()));
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:30,代码来源:PhabricatorProjectFeedController.php

示例5: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     $package = id(new PhabricatorOwnersPackageQuery())->setViewer($viewer)->withIDs(array($request->getURIData('id')))->needPaths(true)->executeOne();
     if (!$package) {
         return new Aphront404Response();
     }
     $paths = $package->getPaths();
     $repository_phids = array();
     foreach ($paths as $path) {
         $repository_phids[$path->getRepositoryPHID()] = true;
     }
     if ($repository_phids) {
         $repositories = id(new PhabricatorRepositoryQuery())->setViewer($viewer)->withPHIDs(array_keys($repository_phids))->execute();
         $repositories = mpull($repositories, null, 'getPHID');
     } else {
         $repositories = array();
     }
     $actions = $this->buildPackageActionView($package);
     $properties = $this->buildPackagePropertyView($package);
     $properties->setActionList($actions);
     $header = id(new PHUIHeaderView())->setUser($viewer)->setHeader($package->getName())->setPolicyObject($package);
     $panel = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
     $commit_views = array();
     $commit_uri = id(new PhutilURI('/audit/'))->setQueryParams(array('auditorPHIDs' => $package->getPHID()));
     $attention_commits = id(new DiffusionCommitQuery())->setViewer($request->getUser())->withAuditorPHIDs(array($package->getPHID()))->withAuditStatus(DiffusionCommitQuery::AUDIT_STATUS_CONCERN)->needCommitData(true)->setLimit(10)->execute();
     if ($attention_commits) {
         $view = id(new PhabricatorAuditListView())->setUser($viewer)->setCommits($attention_commits);
         $commit_views[] = array('view' => $view, 'header' => pht('Commits in this Package that Need Attention'), 'button' => id(new PHUIButtonView())->setTag('a')->setHref($commit_uri->alter('status', 'open'))->setText(pht('View All Problem Commits')));
     }
     $all_commits = id(new DiffusionCommitQuery())->setViewer($request->getUser())->withAuditorPHIDs(array($package->getPHID()))->needCommitData(true)->setLimit(100)->execute();
     $view = id(new PhabricatorAuditListView())->setUser($viewer)->setCommits($all_commits)->setNoDataString(pht('No commits in this package.'));
     $commit_views[] = array('view' => $view, 'header' => pht('Recent Commits in Package'), 'button' => id(new PHUIButtonView())->setTag('a')->setHref($commit_uri)->setText(pht('View All Package Commits')));
     $phids = array();
     foreach ($commit_views as $commit_view) {
         $phids[] = $commit_view['view']->getRequiredHandlePHIDs();
     }
     $phids = array_mergev($phids);
     $handles = $this->loadViewerHandles($phids);
     $commit_panels = array();
     foreach ($commit_views as $commit_view) {
         $commit_panel = new PHUIObjectBoxView();
         $header = new PHUIHeaderView();
         $header->setHeader($commit_view['header']);
         if (isset($commit_view['button'])) {
             $header->addActionLink($commit_view['button']);
         }
         $commit_view['view']->setHandles($handles);
         $commit_panel->setHeader($header);
         $commit_panel->appendChild($commit_view['view']);
         $commit_panels[] = $commit_panel;
     }
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($package->getName());
     $timeline = $this->buildTransactionTimeline($package, new PhabricatorOwnersPackageTransactionQuery());
     $timeline->setShouldTerminate(true);
     return $this->buildApplicationPage(array($crumbs, $panel, $this->renderPathsTable($paths, $repositories), $commit_panels, $timeline), array('title' => $package->getName()));
 }
开发者ID:bohanlin,项目名称:phabricator,代码行数:58,代码来源:PhabricatorOwnersDetailController.php

示例6: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     $id = $request->getURIData('id');
     $diff = id(new DifferentialDiffQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
     if (!$diff) {
         return new Aphront404Response();
     }
     if ($diff->getRevisionID()) {
         return id(new AphrontRedirectResponse())->setURI('/D' . $diff->getRevisionID() . '?id=' . $diff->getID());
     }
     $diff_phid = $diff->getPHID();
     $buildables = id(new HarbormasterBuildableQuery())->setViewer($viewer)->withBuildablePHIDs(array($diff_phid))->withManualBuildables(false)->needBuilds(true)->needTargets(true)->execute();
     $buildables = mpull($buildables, null, 'getBuildablePHID');
     $diff->attachBuildable(idx($buildables, $diff_phid));
     // TODO: implement optgroup support in AphrontFormSelectControl?
     $select = array();
     $select[] = hsprintf('<optgroup label="%s">', pht('Create New Revision'));
     $select[] = phutil_tag('option', array('value' => ''), pht('Create a new Revision...'));
     $select[] = hsprintf('</optgroup>');
     $selected_id = $request->getInt('revisionID');
     $revisions = $this->loadSelectableRevisions($viewer, $selected_id);
     if ($revisions) {
         $select[] = hsprintf('<optgroup label="%s">', pht('Update Existing Revision'));
         foreach ($revisions as $revision) {
             if ($selected_id == $revision->getID()) {
                 $selected = 'selected';
             } else {
                 $selected = null;
             }
             $select[] = phutil_tag('option', array('value' => $revision->getID(), 'selected' => $selected), id(new PhutilUTF8StringTruncator())->setMaximumGlyphs(128)->truncateString('D' . $revision->getID() . ' ' . $revision->getTitle()));
         }
         $select[] = hsprintf('</optgroup>');
     }
     $select = phutil_tag('select', array('name' => 'revisionID'), $select);
     $form = id(new AphrontFormView())->setUser($request->getUser())->setAction('/differential/revision/edit/')->addHiddenInput('diffID', $diff->getID())->addHiddenInput('viaDiffView', 1)->addHiddenInput(id(new DifferentialRepositoryField())->getFieldKey(), $diff->getRepositoryPHID())->appendRemarkupInstructions(pht('Review the diff for correctness. When you are satisfied, either ' . '**create a new revision** or **update an existing revision**.'))->appendChild(id(new AphrontFormMarkupControl())->setLabel(pht('Attach To'))->setValue($select))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Continue')));
     $props = id(new DifferentialDiffProperty())->loadAllWhere('diffID = %d', $diff->getID());
     $props = mpull($props, 'getData', 'getName');
     $property_head = id(new PHUIHeaderView())->setHeader(pht('Properties'));
     $property_view = new PHUIPropertyListView();
     $changesets = $diff->loadChangesets();
     $changesets = msort($changesets, 'getSortKey');
     $table_of_contents = $this->buildTableOfContents($changesets, $changesets, $diff->loadCoverageMap($viewer));
     $refs = array();
     foreach ($changesets as $changeset) {
         $refs[$changeset->getID()] = $changeset->getID();
     }
     $details = id(new DifferentialChangesetListView())->setChangesets($changesets)->setVisibleChangesets($changesets)->setRenderingReferences($refs)->setStandaloneURI('/differential/changeset/')->setDiff($diff)->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->setTitle(pht('Diff %d', $diff->getID()))->setUser($request->getUser());
     $title = pht('Diff %d', $diff->getID());
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($title);
     $crumbs->setBorder(true);
     $header = id(new PHUIHeaderView())->setHeader($title);
     $prop_box = id(new PHUIObjectBoxView())->setHeader($property_head)->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->addPropertyList($property_view)->setForm($form);
     $view = id(new PHUITwoColumnView())->setHeader($header)->setMainColumn(array())->setFooter(array($prop_box, $table_of_contents, $details));
     $page = $this->newPage()->setTitle(pht('Diff View'))->setCrumbs($crumbs)->appendChild($view);
     return $page;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:58,代码来源:DifferentialDiffViewController.php

示例7: 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);
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:27,代码来源:PhabricatorSettingsPanelLDAP.php

示例8: processRequest

 public function processRequest(AphrontRequest $request)
 {
     $user = $this->getUser();
     $viewer = $request->getUser();
     $keys = id(new PhabricatorAuthSSHKeyQuery())->setViewer($viewer)->withObjectPHIDs(array($user->getPHID()))->execute();
     $table = id(new PhabricatorAuthSSHKeyTableView())->setUser($viewer)->setKeys($keys)->setCanEdit(true)->setNoDataString(pht("You haven't added any SSH Public Keys."));
     $panel = new PHUIObjectBoxView();
     $header = new PHUIHeaderView();
     $upload_icon = id(new PHUIIconView())->setIconFont('fa-upload');
     $upload_button = id(new PHUIButtonView())->setText(pht('Upload Public Key'))->setHref('/auth/sshkey/upload/?objectPHID=' . $user->getPHID())->setWorkflow(true)->setTag('a')->setIcon($upload_icon);
     try {
         PhabricatorSSHKeyGenerator::assertCanGenerateKeypair();
         $can_generate = true;
     } catch (Exception $ex) {
         $can_generate = false;
     }
     $generate_icon = id(new PHUIIconView())->setIconFont('fa-lock');
     $generate_button = id(new PHUIButtonView())->setText(pht('Generate Keypair'))->setHref('/auth/sshkey/generate/?objectPHID=' . $user->getPHID())->setTag('a')->setWorkflow(true)->setDisabled(!$can_generate)->setIcon($generate_icon);
     $header->setHeader(pht('SSH Public Keys'));
     $header->addActionLink($generate_button);
     $header->addActionLink($upload_button);
     $panel->setHeader($header);
     $panel->setTable($table);
     return $panel;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:25,代码来源:PhabricatorSSHKeysSettingsPanel.php

示例9: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $user = $request->getUser();
     $id = $request->getURIData('id');
     $blog = id(new PhameBlogQuery())->setViewer($user)->withIDs(array($id))->executeOne();
     if (!$blog) {
         return new Aphront404Response();
     }
     if ($blog->getDomain() && $request->getHost() != $blog->getDomain()) {
         $base_uri = $blog->getLiveURI();
         // Don't redirect directly, since the domain is user-controlled and there
         // are a bevy of security issues associated with automatic redirects to
         // external domains.
         // Previously we CSRF'd this and someone found a way to pass OAuth
         // information through it using anchors. Just make users click a normal
         // link so that this is no more dangerous than any other external link
         // on the site.
         $dialog = id(new AphrontDialogView())->setTitle(pht('Blog Moved'))->setUser($user)->appendParagraph(pht('This blog is now hosted here:'))->appendParagraph(phutil_tag('a', array('href' => $base_uri), $base_uri))->addCancelButton('/');
         return id(new AphrontDialogResponse())->setDialog($dialog);
     }
     $phame_request = clone $request;
     $more = $phame_request->getURIData('more', '');
     $phame_request->setPath('/' . ltrim($more, '/'));
     $uri = $blog->getLiveURI();
     $skin = $blog->getSkinRenderer($phame_request);
     $skin->setBlog($blog)->setBaseURI($uri);
     $skin->willProcessRequest(array());
     return $skin->processRequest();
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:29,代码来源:PhameBlogLiveController.php

示例10: 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

示例11: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $phid = $request->getURIData('phid');
     $file = id(new PhabricatorFileQuery())->setViewer($request->getUser())->withPHIDs(array($phid))->executeOne();
     if (!$file) {
         return new Aphront404Response();
     }
     $data = $file->loadFileData();
     try {
         $data = phutil_json_decode($data);
     } catch (PhutilJSONParserException $ex) {
         throw new PhutilProxyException(pht('Failed to unserialize XHProf profile!'), $ex);
     }
     $symbol = $request->getStr('symbol');
     $is_framed = $request->getBool('frame');
     if ($symbol) {
         $view = new PhabricatorXHProfProfileSymbolView();
         $view->setSymbol($symbol);
     } else {
         $view = new PhabricatorXHProfProfileTopLevelView();
         $view->setFile($file);
         $view->setLimit(100);
     }
     $view->setBaseURI($request->getRequestURI()->getPath());
     $view->setIsFramed($is_framed);
     $view->setProfileData($data);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('%s Profile', $symbol));
     return $this->buildStandardPageResponse(array($crumbs, $view), array('title' => pht('Profile'), 'frame' => $is_framed));
 }
开发者ID:pugong,项目名称:phabricator,代码行数:30,代码来源:PhabricatorXHProfProfileController.php

示例12: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $user = $request->getUser();
     $nav = $this->renderSideNavFilterView(null);
     $filter = $request->getURIData('filter');
     $filter = $nav->selectFilter('blog/' . $filter, 'blog/user');
     $query = id(new PhameBlogQuery())->setViewer($user);
     switch ($filter) {
         case 'blog/all':
             $title = pht('All Blogs');
             $nodata = pht('No blogs have been created.');
             break;
         case 'blog/user':
             $title = pht('Joinable Blogs');
             $nodata = pht('There are no blogs you can contribute to.');
             $query->requireCapabilities(array(PhabricatorPolicyCapability::CAN_JOIN));
             break;
         default:
             throw new Exception(pht("Unknown filter '%s'!", $filter));
     }
     $pager = id(new AphrontPagerView())->setURI($request->getRequestURI(), 'offset')->setOffset($request->getInt('offset'));
     $blogs = $query->executeWithOffsetPager($pager);
     $blog_list = $this->renderBlogList($blogs, $user, $nodata);
     $blog_list->setPager($pager);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($title, $this->getApplicationURI());
     $nav->appendChild(array($crumbs, $blog_list));
     return $this->buildApplicationPage($nav, array('title' => $title));
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:29,代码来源:PhameBlogListController.php

示例13: processDiffusionRequest

 protected function processDiffusionRequest(AphrontRequest $request)
 {
     $user = $request->getUser();
     $drequest = $this->diffusionRequest;
     $repository = $drequest->getRepository();
     $repository = id(new PhabricatorRepositoryQuery())->setViewer($user)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->withIDs(array($repository->getID()))->executeOne();
     if (!$repository) {
         return new Aphront404Response();
     }
     if (!$repository->supportsStaging()) {
         return new Aphront404Response();
     }
     $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
     $v_area = $repository->getHumanReadableDetail('staging-uri');
     if ($request->isFormPost()) {
         $v_area = $request->getStr('area');
         $xactions = array();
         $template = id(new PhabricatorRepositoryTransaction());
         $type_encoding = PhabricatorRepositoryTransaction::TYPE_STAGING_URI;
         $xactions[] = id(clone $template)->setTransactionType($type_encoding)->setNewValue($v_area);
         id(new PhabricatorRepositoryEditor())->setContinueOnNoEffect(true)->setContentSourceFromRequest($request)->setActor($user)->applyTransactions($repository, $xactions);
         return id(new AphrontRedirectResponse())->setURI($edit_uri);
     }
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Edit Staging'));
     $title = pht('Edit %s', $repository->getName());
     $form = id(new AphrontFormView())->setUser($user)->appendRemarkupInstructions(pht("To make it easier to run integration tests and builds on code " . "under review, you can configure a **Staging Area**. When `arc` " . "creates a diff, it will push a copy of the changes to the " . "configured staging area with a corresponding tag." . "\n\n" . "IMPORTANT: This feature is new, experimental, and not supported. " . "Use it at your own risk."))->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Staging Area URI'))->setName('area')->setValue($v_area))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Save'))->addCancelButton($edit_uri));
     $object_box = id(new PHUIObjectBoxView())->setHeaderText($title)->setForm($form);
     return $this->buildApplicationPage(array($crumbs, $object_box), array('title' => $title));
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:30,代码来源:DiffusionRepositoryEditStagingController.php

示例14: processDiffusionRequest

 protected function processDiffusionRequest(AphrontRequest $request)
 {
     $user = $request->getUser();
     $drequest = $this->getDiffusionRequest();
     $callsign = $drequest->getRepository()->getCallsign();
     $repository = $drequest->getRepository();
     $commit = $drequest->loadCommit();
     $data = $commit->loadCommitData();
     $page_title = pht('Edit Diffusion Commit');
     if (!$commit) {
         return new Aphront404Response();
     }
     $commit_phid = $commit->getPHID();
     $edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
     $current_proj_phids = PhabricatorEdgeQuery::loadDestinationPHIDs($commit_phid, $edge_type);
     if ($request->isFormPost()) {
         $xactions = array();
         $proj_phids = $request->getArr('projects');
         $xactions[] = id(new PhabricatorAuditTransaction())->setTransactionType(PhabricatorTransactions::TYPE_EDGE)->setMetadataValue('edge:type', $edge_type)->setNewValue(array('=' => array_fuse($proj_phids)));
         $editor = id(new PhabricatorAuditEditor())->setActor($user)->setContinueOnNoEffect(true)->setContentSourceFromRequest($request);
         $xactions = $editor->applyTransactions($commit, $xactions);
         return id(new AphrontRedirectResponse())->setURI('/r' . $callsign . $commit->getCommitIdentifier());
     }
     $tokenizer_id = celerity_generate_unique_node_id();
     $form = id(new AphrontFormView())->setUser($user)->setAction($request->getRequestURI()->getPath())->appendControl(id(new AphrontFormTokenizerControl())->setLabel(pht('Projects'))->setName('projects')->setValue($current_proj_phids)->setID($tokenizer_id)->setCaption(javelin_tag('a', array('href' => '/project/create/', 'mustcapture' => true, 'sigil' => 'project-create'), pht('Create New Project')))->setDatasource(new PhabricatorProjectDatasource()));
     $reason = $data->getCommitDetail('autocloseReason', false);
     $reason = PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED;
     if ($reason !== false) {
         switch ($reason) {
             case PhabricatorRepository::BECAUSE_REPOSITORY_IMPORTING:
                 $desc = pht('No, Repository Importing');
                 break;
             case PhabricatorRepository::BECAUSE_AUTOCLOSE_DISABLED:
                 $desc = pht('No, Autoclose Disabled');
                 break;
             case PhabricatorRepository::BECAUSE_NOT_ON_AUTOCLOSE_BRANCH:
                 $desc = pht('No, Not On Autoclose Branch');
                 break;
             case PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED:
                 $desc = pht('Yes, Forced Via bin/repository CLI Tool.');
                 break;
             case null:
                 $desc = pht('Yes');
                 break;
             default:
                 $desc = pht('Unknown');
                 break;
         }
         $doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: Autoclose');
         $doc_link = phutil_tag('a', array('href' => $doc_href, 'target' => '_blank'), pht('Learn More'));
         $form->appendChild(id(new AphrontFormMarkupControl())->setLabel(pht('Autoclose?'))->setValue(array($desc, " · ", $doc_link)));
     }
     Javelin::initBehavior('project-create', array('tokenizerID' => $tokenizer_id));
     $submit = id(new AphrontFormSubmitControl())->setValue(pht('Save'))->addCancelButton('/r' . $callsign . $commit->getCommitIdentifier());
     $form->appendChild($submit);
     $crumbs = $this->buildCrumbs(array('commit' => true));
     $crumbs->addTextCrumb(pht('Edit'));
     $form_box = id(new PHUIObjectBoxView())->setHeaderText($page_title)->setForm($form);
     return $this->buildApplicationPage(array($crumbs, $form_box), array('title' => $page_title));
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:60,代码来源:DiffusionCommitEditController.php

示例15: readValueFromRequest

 public function readValueFromRequest(AphrontRequest $request)
 {
     $control = $this->newDateControl();
     $control->setUser($request->getUser());
     $value = $control->readValueFromRequest($request);
     $this->setFieldValue($value);
 }
开发者ID:AceMood,项目名称:phabricator,代码行数:7,代码来源:PhabricatorStandardCustomFieldDate.php


注:本文中的AphrontRequest::getUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。