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


PHP AphrontRequest::getBool方法代码示例

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


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

示例1: processRequest

 public function processRequest(AphrontRequest $request)
 {
     $user = $request->getUser();
     $preferences = $user->loadPreferences();
     $pref_dark_console = PhabricatorUserPreferences::PREFERENCE_DARK_CONSOLE;
     $dark_console_value = $preferences->getPreference($pref_dark_console);
     if ($request->isFormPost()) {
         $new_dark_console = $request->getBool($pref_dark_console);
         $preferences->setPreference($pref_dark_console, $new_dark_console);
         // If the user turned Dark Console on, enable it (as though they had hit
         // "`").
         if ($new_dark_console && !$dark_console_value) {
             $user->setConsoleVisible(true);
             $user->save();
         }
         $preferences->save();
         return id(new AphrontRedirectResponse())->setURI($this->getPanelURI('?saved=true'));
     }
     $is_console_enabled = PhabricatorEnv::getEnvConfig('darkconsole.enabled');
     $preamble = pht("**DarkConsole** is a developer console which can help build and " . "debug Phabricator applications. It includes tools for understanding " . "errors, performance, service calls, and other low-level aspects of " . "Phabricator's inner workings.");
     if ($is_console_enabled) {
         $instructions = pht("%s\n\n" . 'You can enable it for your account below. Enabling DarkConsole will ' . 'slightly decrease performance, but give you access to debugging ' . 'tools. You may want to disable it again later if you only need it ' . 'temporarily.' . "\n\n" . 'NOTE: After enabling DarkConsole, **press the ##%s## key on your ' . 'keyboard** to show or hide it.', $preamble, '`');
     } else {
         $instructions = pht("%s\n\n" . 'Before you can turn on DarkConsole, it needs to be enabled in ' . 'the configuration for this install (`%s`).', $preamble, 'darkconsole.enabled');
     }
     $form = id(new AphrontFormView())->setUser($user)->appendRemarkupInstructions($instructions)->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Dark Console'))->setName($pref_dark_console)->setValue($dark_console_value)->setOptions(array(0 => pht('Disable DarkConsole'), 1 => pht('Enable DarkConsole')))->setDisabled(!$is_console_enabled))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Save Preferences')));
     $form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Developer Settings'))->setFormSaved($request->getBool('saved'))->setForm($form);
     return array($form_box);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:29,代码来源:PhabricatorDeveloperPreferencesSettingsPanel.php

示例2: processDiffusionRequest

 protected function processDiffusionRequest(AphrontRequest $request)
 {
     $viewer = $request->getUser();
     $drequest = $this->diffusionRequest;
     $repository = $drequest->getRepository();
     $repository = id(new PhabricatorRepositoryQuery())->setViewer($viewer)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->withIDs(array($repository->getID()))->executeOne();
     if (!$repository) {
         return new Aphront404Response();
     }
     $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
     // NOTE: We're inverting these here, because the storage is silly.
     $v_notify = !$repository->getHumanReadableDetail('herald-disabled');
     $v_autoclose = !$repository->getHumanReadableDetail('disable-autoclose');
     if ($request->isFormPost()) {
         $v_notify = $request->getBool('notify');
         $v_autoclose = $request->getBool('autoclose');
         $xactions = array();
         $template = id(new PhabricatorRepositoryTransaction());
         $type_notify = PhabricatorRepositoryTransaction::TYPE_NOTIFY;
         $type_autoclose = PhabricatorRepositoryTransaction::TYPE_AUTOCLOSE;
         $xactions[] = id(clone $template)->setTransactionType($type_notify)->setNewValue($v_notify);
         $xactions[] = id(clone $template)->setTransactionType($type_autoclose)->setNewValue($v_autoclose);
         id(new PhabricatorRepositoryEditor())->setContinueOnNoEffect(true)->setContentSourceFromRequest($request)->setActor($viewer)->applyTransactions($repository, $xactions);
         return id(new AphrontRedirectResponse())->setURI($edit_uri);
     }
     $content = array();
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Edit Actions'));
     $title = pht('Edit Actions (%s)', $repository->getName());
     $policies = id(new PhabricatorPolicyQuery())->setViewer($viewer)->setObject($repository)->execute();
     $form = id(new AphrontFormView())->setUser($viewer)->appendRemarkupInstructions(pht("Normally, Phabricator publishes notifications when it discovers " . "new commits. You can disable publishing for this repository by " . "turning off **Notify/Publish**. This will disable notifications, " . "feed, and Herald (including audits and build plans) for this " . "repository.\n\n" . "When Phabricator discovers a new commit, it can automatically " . "close associated revisions and tasks. If you don't want " . "Phabricator to close objects when it discovers new commits in " . "this repository, you can disable **Autoclose**."))->appendChild(id(new AphrontFormSelectControl())->setName('notify')->setLabel(pht('Notify/Publish'))->setValue((int) $v_notify)->setOptions(array(1 => pht('Enable Notifications, Feed and Herald'), 0 => pht('Disable Notifications, Feed and Herald'))))->appendChild(id(new AphrontFormSelectControl())->setName('autoclose')->setLabel(pht('Autoclose'))->setValue((int) $v_autoclose)->setOptions(array(1 => pht('Enable Autoclose'), 0 => pht('Disable Autoclose'))))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Save Actions'))->addCancelButton($edit_uri));
     $form_box = id(new PHUIObjectBoxView())->setHeaderText($title)->setForm($form);
     return $this->buildApplicationPage(array($crumbs, $form_box), array('title' => $title));
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:34,代码来源:DiffusionRepositoryEditActionsController.php

示例3: handleRequest

 /**
  * @phutil-external-symbol class PhabricatorStartup
  */
 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     // NOTE: Throws if valid CSRF token is not present in the request.
     $request->validateCSRF();
     $name = $request->getStr('name');
     $file_phid = $request->getStr('phid');
     // If there's no explicit view policy, make it very restrictive by default.
     // This is the correct policy for files dropped onto objects during
     // creation, comment and edit flows.
     $view_policy = $request->getStr('viewPolicy');
     if (!$view_policy) {
         $view_policy = $viewer->getPHID();
     }
     $is_chunks = $request->getBool('querychunks');
     if ($is_chunks) {
         $params = array('filePHID' => $file_phid);
         $result = id(new ConduitCall('file.querychunks', $params))->setUser($viewer)->execute();
         return id(new AphrontAjaxResponse())->setContent($result);
     }
     $is_allocate = $request->getBool('allocate');
     if ($is_allocate) {
         $params = array('name' => $name, 'contentLength' => $request->getInt('length'), 'viewPolicy' => $view_policy);
         $result = id(new ConduitCall('file.allocate', $params))->setUser($viewer)->execute();
         $file_phid = $result['filePHID'];
         if ($file_phid) {
             $file = $this->loadFile($file_phid);
             $result += $file->getDragAndDropDictionary();
         }
         return id(new AphrontAjaxResponse())->setContent($result);
     }
     // Read the raw request data. We're either doing a chunk upload or a
     // vanilla upload, so we need it.
     $data = PhabricatorStartup::getRawInput();
     $is_chunk_upload = $request->getBool('uploadchunk');
     if ($is_chunk_upload) {
         $params = array('filePHID' => $file_phid, 'byteStart' => $request->getInt('byteStart'), 'data' => $data);
         $result = id(new ConduitCall('file.uploadchunk', $params))->setUser($viewer)->execute();
         $file = $this->loadFile($file_phid);
         if ($file->getIsPartial()) {
             $result = array();
         } else {
             $result = array('complete' => true) + $file->getDragAndDropDictionary();
         }
         return id(new AphrontAjaxResponse())->setContent($result);
     }
     $file = PhabricatorFile::newFromXHRUpload($data, array('name' => $request->getStr('name'), 'authorPHID' => $viewer->getPHID(), 'viewPolicy' => $view_policy, 'isExplicitUpload' => true));
     $result = $file->getDragAndDropDictionary();
     return id(new AphrontAjaxResponse())->setContent($result);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:53,代码来源:PhabricatorFileDropUploadController.php

示例4: processRequest

 public function processRequest(AphrontRequest $request)
 {
     $user = $request->getUser();
     $preferences = $user->loadPreferences();
     $pref_jump = PhabricatorUserPreferences::PREFERENCE_SEARCHBAR_JUMP;
     $pref_shortcut = PhabricatorUserPreferences::PREFERENCE_SEARCH_SHORTCUT;
     if ($request->isFormPost()) {
         $preferences->setPreference($pref_jump, $request->getBool($pref_jump));
         $preferences->setPreference($pref_shortcut, $request->getBool($pref_shortcut));
         $preferences->save();
         return id(new AphrontRedirectResponse())->setURI($this->getPanelURI('?saved=true'));
     }
     $form = id(new AphrontFormView())->setUser($user)->appendChild(id(new AphrontFormCheckboxControl())->addCheckbox($pref_jump, 1, pht('Enable jump nav functionality in all search boxes.'), $preferences->getPreference($pref_jump, 1))->addCheckbox($pref_shortcut, 1, pht("Press '/' to focus the search input."), $preferences->getPreference($pref_shortcut, 1)))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Save')));
     $form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Search Preferences'))->setFormSaved($request->getStr('saved') === 'true')->setForm($form);
     return array($form_box);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:16,代码来源:PhabricatorSettingsPanelSearchPreferences.php

示例5: getValueFromRequest

 protected function getValueFromRequest(AphrontRequest $request, $key)
 {
     if (!strlen($request->getStr($key))) {
         return null;
     }
     return $request->getBool($key);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:7,代码来源:PhabricatorSearchThreeStateField.php

示例6: processRequest

 public function processRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     $preferences = $this->getPreferences();
     $notifications_key = PhabricatorDesktopNotificationsSetting::SETTINGKEY;
     $notifications_value = $preferences->getSettingValue($notifications_key);
     if ($request->isFormPost()) {
         $this->writeSetting($preferences, $notifications_key, $request->getInt($notifications_key));
         return id(new AphrontRedirectResponse())->setURI($this->getPanelURI('?saved=true'));
     }
     $title = pht('Desktop Notifications');
     $control_id = celerity_generate_unique_node_id();
     $status_id = celerity_generate_unique_node_id();
     $browser_status_id = celerity_generate_unique_node_id();
     $cancel_ask = pht('The dialog asking for permission to send desktop notifications was ' . 'closed without granting permission. Only application notifications ' . 'will be sent.');
     $accept_ask = pht('Click "Save Preference" to persist these changes.');
     $reject_ask = pht('Permission for desktop notifications was denied. Only application ' . 'notifications will be sent.');
     $no_support = pht('This web browser does not support desktop notifications. Only ' . 'application notifications will be sent for this browser regardless of ' . 'this preference.');
     $default_status = phutil_tag('span', array(), array(pht('This browser has not yet granted permission to send desktop ' . 'notifications for this Phabricator instance.'), phutil_tag('br'), phutil_tag('br'), javelin_tag('button', array('sigil' => 'desktop-notifications-permission-button', 'class' => 'green'), pht('Grant Permission'))));
     $granted_status = phutil_tag('span', array(), pht('This browser has been granted permission to send desktop ' . 'notifications for this Phabricator instance.'));
     $denied_status = phutil_tag('span', array(), pht('This browser has denied permission to send desktop notifications ' . 'for this Phabricator instance. Consult your browser settings / ' . 'documentation to figure out how to clear this setting, do so, ' . 'and then re-visit this page to grant permission.'));
     $status_box = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NOTICE)->setID($status_id)->setIsHidden(true)->appendChild($accept_ask);
     $control_config = array('controlID' => $control_id, 'statusID' => $status_id, 'browserStatusID' => $browser_status_id, 'defaultMode' => 0, 'desktopMode' => 1, 'cancelAsk' => $cancel_ask, 'grantedAsk' => $accept_ask, 'deniedAsk' => $reject_ask, 'defaultStatus' => $default_status, 'deniedStatus' => $denied_status, 'grantedStatus' => $granted_status, 'noSupport' => $no_support);
     $form = id(new AphrontFormView())->setUser($viewer)->appendChild(id(new AphrontFormSelectControl())->setLabel($title)->setControlID($control_id)->setName($notifications_key)->setValue($notifications_value)->setOptions(array(1 => pht('Send Desktop Notifications Too'), 0 => pht('Send Application Notifications Only')))->setCaption(pht('Should Phabricator send desktop notifications? These are sent ' . 'in addition to the notifications within the Phabricator ' . 'application.'))->initBehavior('desktop-notifications-control', $control_config))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Save Preference')));
     $test_button = id(new PHUIButtonView())->setTag('a')->setWorkflow(true)->setText(pht('Send Test Notification'))->setHref('/notification/test/')->setIcon('fa-exclamation-triangle');
     $form_box = id(new PHUIObjectBoxView())->setHeader(id(new PHUIHeaderView())->setHeader(pht('Desktop Notifications'))->addActionLink($test_button))->setForm($form)->setInfoView($status_box)->setFormSaved($request->getBool('saved'));
     $browser_status_box = id(new PHUIInfoView())->setID($browser_status_id)->setSeverity(PHUIInfoView::SEVERITY_NOTICE)->setIsHidden(true)->appendChild($default_status);
     return array($form_box, $browser_status_box);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:29,代码来源:PhabricatorDesktopNotificationsSettingsPanel.php

示例7: readRequest

 public function readRequest(PhabricatorConfigOption $option, AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $view_policy = PhabricatorPolicies::POLICY_PUBLIC;
     if ($request->getBool('removeLogo')) {
         $logo_image_phid = null;
     } else {
         if ($request->getFileExists('logoImage')) {
             $logo_image = PhabricatorFile::newFromPHPUpload(idx($_FILES, 'logoImage'), array('name' => 'logo', 'authorPHID' => $viewer->getPHID(), 'viewPolicy' => $view_policy, 'canCDN' => true, 'isExplicitUpload' => true));
             $logo_image_phid = $logo_image->getPHID();
         } else {
             $logo_image_phid = self::getLogoImagePHID();
         }
     }
     $wordmark_text = $request->getStr('wordmarkText');
     $value = array('logoImagePHID' => $logo_image_phid, 'wordmarkText' => $wordmark_text);
     $errors = array();
     $e_value = null;
     try {
         $this->validateOption($option, $value);
     } catch (Exception $ex) {
         $e_value = pht('Invalid');
         $errors[] = $ex->getMessage();
         $value = array();
     }
     return array($e_value, $errors, $value, phutil_json_encode($value));
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:27,代码来源:PhabricatorCustomLogoConfigType.php

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

示例9: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     $this->requireApplicationCapability(PhabricatorMacroManageCapability::CAPABILITY);
     $macro = id(new PhabricatorMacroQuery())->setViewer($viewer)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW))->withIDs(array($id))->executeOne();
     if (!$macro) {
         return new Aphront404Response();
     }
     $errors = array();
     $view_uri = $this->getApplicationURI('/view/' . $macro->getID() . '/');
     $e_file = null;
     $file = null;
     if ($request->isFormPost()) {
         $xactions = array();
         if ($request->getBool('behaviorForm')) {
             $xactions[] = id(new PhabricatorMacroTransaction())->setTransactionType(PhabricatorMacroTransaction::TYPE_AUDIO_BEHAVIOR)->setNewValue($request->getStr('audioBehavior'));
         } else {
             $file = null;
             if ($request->getFileExists('file')) {
                 $file = PhabricatorFile::newFromPHPUpload($_FILES['file'], array('name' => $request->getStr('name'), 'authorPHID' => $viewer->getPHID(), 'isExplicitUpload' => true));
             }
             if ($file) {
                 if (!$file->isAudio()) {
                     $errors[] = pht('You must upload audio.');
                     $e_file = pht('Invalid');
                 } else {
                     $xactions[] = id(new PhabricatorMacroTransaction())->setTransactionType(PhabricatorMacroTransaction::TYPE_AUDIO)->setNewValue($file->getPHID());
                 }
             } else {
                 $errors[] = pht('You must upload an audio file.');
                 $e_file = pht('Required');
             }
         }
         if (!$errors) {
             id(new PhabricatorMacroEditor())->setActor($viewer)->setContinueOnNoEffect(true)->setContentSourceFromRequest($request)->applyTransactions($macro, $xactions);
             return id(new AphrontRedirectResponse())->setURI($view_uri);
         }
     }
     $form = id(new AphrontFormView())->addHiddenInput('behaviorForm', 1)->setUser($viewer);
     $options = id(new AphrontFormRadioButtonControl())->setLabel(pht('Audio Behavior'))->setName('audioBehavior')->setValue(nonempty($macro->getAudioBehavior(), PhabricatorFileImageMacro::AUDIO_BEHAVIOR_NONE));
     $options->addButton(PhabricatorFileImageMacro::AUDIO_BEHAVIOR_NONE, pht('Do Not Play'), pht('Do not play audio.'));
     $options->addButton(PhabricatorFileImageMacro::AUDIO_BEHAVIOR_ONCE, pht('Play Once'), pht('Play audio once, when the viewer looks at the macro.'));
     $options->addButton(PhabricatorFileImageMacro::AUDIO_BEHAVIOR_LOOP, pht('Play Continuously'), pht('Play audio continuously, treating the macro as an audio source. ' . 'Best for ambient sounds.'));
     $form->appendChild($options);
     $form->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Save Audio Behavior'))->addCancelButton($view_uri));
     $crumbs = $this->buildApplicationCrumbs();
     $title = pht('Edit Audio: %s', $macro->getName());
     $crumb = pht('Edit Audio');
     $crumbs->addTextCrumb(pht('Macro "%s"', $macro->getName()), $view_uri);
     $crumbs->addTextCrumb($crumb, $request->getRequestURI());
     $crumbs->setBorder(true);
     $upload_form = id(new AphrontFormView())->setEncType('multipart/form-data')->setUser($viewer)->appendChild(id(new AphrontFormFileControl())->setLabel(pht('Audio File'))->setName('file'))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Upload File')));
     $upload = id(new PHUIObjectBoxView())->setHeaderText(pht('Upload New Audio'))->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->setForm($upload_form);
     $form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Behavior'))->setFormErrors($errors)->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->setForm($form);
     $header = id(new PHUIHeaderView())->setHeader($title)->setHeaderIcon('fa-pencil');
     $view = id(new PHUITwoColumnView())->setHeader($header)->setFooter(array($form_box, $upload));
     return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($view);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:59,代码来源:PhabricatorMacroAudioController.php

示例10: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     if ($request->getStr('jump') != 'no') {
         $response = PhabricatorJumpNavHandler::getJumpResponse($viewer, $request->getStr('query'));
         if ($response) {
             return $response;
         }
     }
     $engine = new PhabricatorSearchApplicationSearchEngine();
     $engine->setViewer($viewer);
     // If we're coming from primary search, do some special handling to
     // interpret the scope selector and query.
     if ($request->getBool('search:primary')) {
         // If there's no query, just take the user to advanced search.
         if (!strlen($request->getStr('query'))) {
             $advanced_uri = '/search/query/advanced/';
             return id(new AphrontRedirectResponse())->setURI($advanced_uri);
         }
         // First, load or construct a template for the search by examining
         // the current search scope.
         $scope = $request->getStr('search:scope');
         $saved = null;
         if ($scope == self::SCOPE_CURRENT_APPLICATION) {
             $application = id(new PhabricatorApplicationQuery())->setViewer($viewer)->withClasses(array($request->getStr('search:application')))->executeOne();
             if ($application) {
                 $types = $application->getApplicationSearchDocumentTypes();
                 if ($types) {
                     $saved = id(new PhabricatorSavedQuery())->setEngineClassName(get_class($engine))->setParameter('types', $types)->setParameter('statuses', array('open'));
                 }
             }
         }
         if (!$saved && !$engine->isBuiltinQuery($scope)) {
             $saved = id(new PhabricatorSavedQueryQuery())->setViewer($viewer)->withQueryKeys(array($scope))->executeOne();
         }
         if (!$saved) {
             if (!$engine->isBuiltinQuery($scope)) {
                 $scope = 'all';
             }
             $saved = $engine->buildSavedQueryFromBuiltin($scope);
         }
         // Add the user's query, then save this as a new saved query and send
         // the user to the results page.
         $saved->setParameter('query', $request->getStr('query'));
         $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
         try {
             $saved->setID(null)->save();
         } catch (AphrontDuplicateKeyQueryException $ex) {
             // Ignore, this is just a repeated search.
         }
         unset($unguarded);
         $query_key = $saved->getQueryKey();
         $results_uri = $engine->getQueryResultsPageURI($query_key) . '#R';
         return id(new AphrontRedirectResponse())->setURI($results_uri);
     }
     $controller = id(new PhabricatorApplicationSearchController())->setQueryKey($request->getURIData('queryKey'))->setSearchEngine($engine)->setNavigation($this->buildSideNavView());
     return $this->delegateToController($controller);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:58,代码来源:PhabricatorSearchController.php

示例11: testRequestDataAccess

 public function testRequestDataAccess()
 {
     $r = new AphrontRequest('http://example.com/', '/');
     $r->setRequestData(array('str_empty' => '', 'str' => 'derp', 'str_true' => 'true', 'str_false' => 'false', 'zero' => '0', 'one' => '1', 'arr_empty' => array(), 'arr_num' => array(1, 2, 3), 'comma' => ',', 'comma_1' => 'a, b', 'comma_2' => ' ,a ,, b ,,,, ,, ', 'comma_3' => '0', 'comma_4' => 'a, a, b, a', 'comma_5' => "a\nb, c\n\nd\n\n\n,\n"));
     $this->assertEqual(1, $r->getInt('one'));
     $this->assertEqual(0, $r->getInt('zero'));
     $this->assertEqual(null, $r->getInt('does-not-exist'));
     $this->assertEqual(0, $r->getInt('str_empty'));
     $this->assertEqual(true, $r->getBool('one'));
     $this->assertEqual(false, $r->getBool('zero'));
     $this->assertEqual(true, $r->getBool('str_true'));
     $this->assertEqual(false, $r->getBool('str_false'));
     $this->assertEqual(true, $r->getBool('str'));
     $this->assertEqual(null, $r->getBool('does-not-exist'));
     $this->assertEqual(false, $r->getBool('str_empty'));
     $this->assertEqual('derp', $r->getStr('str'));
     $this->assertEqual('', $r->getStr('str_empty'));
     $this->assertEqual(null, $r->getStr('does-not-exist'));
     $this->assertEqual(array(), $r->getArr('arr_empty'));
     $this->assertEqual(array(1, 2, 3), $r->getArr('arr_num'));
     $this->assertEqual(null, $r->getArr('str_empty', null));
     $this->assertEqual(null, $r->getArr('str_true', null));
     $this->assertEqual(null, $r->getArr('does-not-exist', null));
     $this->assertEqual(array(), $r->getArr('does-not-exist'));
     $this->assertEqual(array(), $r->getStrList('comma'));
     $this->assertEqual(array('a', 'b'), $r->getStrList('comma_1'));
     $this->assertEqual(array('a', 'b'), $r->getStrList('comma_2'));
     $this->assertEqual(array('0'), $r->getStrList('comma_3'));
     $this->assertEqual(array('a', 'a', 'b', 'a'), $r->getStrList('comma_4'));
     $this->assertEqual(array('a', 'b', 'c', 'd'), $r->getStrList('comma_5'));
     $this->assertEqual(array(), $r->getStrList('does-not-exist'));
     $this->assertEqual(null, $r->getStrList('does-not-exist', null));
     $this->assertEqual(true, $r->getExists('str'));
     $this->assertEqual(false, $r->getExists('does-not-exist'));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:35,代码来源:AphrontRequestTestCase.php

示例12: getScopesFromRequest

 public static function getScopesFromRequest(AphrontRequest $request)
 {
     $scopes = self::getScopesDict();
     $requested_scopes = array();
     foreach ($scopes as $scope => $bit) {
         if ($request->getBool($scope)) {
             $requested_scopes[$scope] = 1;
         }
     }
     return $requested_scopes;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:11,代码来源:PhabricatorOAuthServerScope.php

示例13: processRequest

 public function processRequest(AphrontRequest $request)
 {
     $user = $request->getUser();
     $preferences = $user->loadPreferences();
     $pref_jump = PhabricatorUserPreferences::PREFERENCE_SEARCHBAR_JUMP;
     $pref_shortcut = PhabricatorUserPreferences::PREFERENCE_SEARCH_SHORTCUT;
     if ($request->isFormPost()) {
         $preferences->setPreference($pref_jump, $request->getBool($pref_jump));
         $preferences->setPreference($pref_shortcut, $request->getBool($pref_shortcut));
         $preferences->save();
         return id(new AphrontRedirectResponse())->setURI($this->getPanelURI('?saved=true'));
     }
     $form = id(new AphrontFormView())->setUser($user)->appendChild(id(new AphrontFormCheckboxControl())->addCheckbox($pref_jump, 1, 'Enable jump nav functionality in all search boxes.', $preferences->getPreference($pref_jump, 1))->addCheckbox($pref_shortcut, 1, "Press '/' to focus the search input.", $preferences->getPreference($pref_shortcut, 1)))->appendChild(id(new AphrontFormSubmitControl())->setValue('Save'));
     $panel = new AphrontPanelView();
     $panel->setWidth(AphrontPanelView::WIDTH_FORM);
     $panel->setHeader('Search Preferences');
     $panel->appendChild($form);
     $error_view = null;
     if ($request->getStr('saved') === 'true') {
         $error_view = id(new AphrontErrorView())->setTitle('Preferences Saved')->setSeverity(AphrontErrorView::SEVERITY_NOTICE)->setErrors(array('Your preferences have been saved.'));
     }
     return array($error_view, $panel);
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:23,代码来源:PhabricatorSettingsPanelSearchPreferences.php

示例14: processRequest

 public function processRequest(AphrontRequest $request)
 {
     $user = $request->getUser();
     $preferences = $user->loadPreferences();
     $pref = PhabricatorUserPreferences::PREFERENCE_CONPH_NOTIFICATIONS;
     if ($request->isFormPost()) {
         $notifications = $request->getInt($pref);
         $preferences->setPreference($pref, $notifications);
         $preferences->save();
         return id(new AphrontRedirectResponse())->setURI($this->getPanelURI('?saved=true'));
     }
     $form = id(new AphrontFormView())->setUser($user)->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Conpherence Notifications'))->setName($pref)->setValue($preferences->getPreference($pref))->setOptions(array(ConpherenceSettings::EMAIL_ALWAYS => pht('Email Always'), ConpherenceSettings::NOTIFICATIONS_ONLY => pht('Notifications Only')))->setCaption(pht('Should Conpherence send emails for updates or ' . 'notifications only? This global setting can be overridden ' . 'on a per-thread basis within Conpherence.')))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Save Preferences')));
     $form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Conpherence Preferences'))->setForm($form)->setFormSaved($request->getBool('saved'));
     return array($form_box);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:15,代码来源:PhabricatorConpherencePreferencesSettingsPanel.php

示例15: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $book_name = $request->getStr('book');
     $query_text = $request->getStr('name');
     $book = null;
     if ($book_name) {
         $book = id(new DivinerBookQuery())->setViewer($viewer)->withNames(array($book_name))->executeOne();
         if (!$book) {
             return new Aphront404Response();
         }
     }
     $query = id(new DivinerAtomQuery())->setViewer($viewer);
     if ($book) {
         $query->withBookPHIDs(array($book->getPHID()));
     }
     $context = $request->getStr('context');
     if (strlen($context)) {
         $query->withContexts(array($context));
     }
     $type = $request->getStr('type');
     if (strlen($type)) {
         $query->withTypes(array($type));
     }
     $query->withGhosts(false);
     $query->withIsDocumentable(true);
     $name_query = clone $query;
     $name_query->withNames(array($query_text, phutil_utf8_strtolower($query_text)));
     $atoms = $name_query->execute();
     if (!$atoms) {
         $title_query = clone $query;
         $title_query->withTitles(array($query_text));
         $atoms = $title_query->execute();
     }
     $not_found_uri = $this->getApplicationURI();
     if (!$atoms) {
         $dialog = id(new AphrontDialogView())->setUser($viewer)->setTitle(pht('Documentation Not Found'))->appendChild(pht('Unable to find the specified documentation. ' . 'You may have followed a bad or outdated link.'))->addCancelButton($not_found_uri, pht('Read More Documentation'));
         return id(new AphrontDialogResponse())->setDialog($dialog);
     }
     if (count($atoms) == 1 && $request->getBool('jump')) {
         $atom_uri = head($atoms)->getURI();
         return id(new AphrontRedirectResponse())->setURI($atom_uri);
     }
     $list = $this->renderAtomList($atoms);
     return $this->newPage()->setTitle(array(pht('Find'), pht('"%s"', $query_text)))->appendChild(array($list));
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:46,代码来源:DivinerFindController.php


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