• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP AphrontFormView类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: buildSearchForm

 public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved)
 {
     $options = array();
     $author_value = null;
     $owner_value = null;
     $subscribers_value = null;
     $project_value = null;
     $author_phids = $saved->getParameter('authorPHIDs', array());
     $owner_phids = $saved->getParameter('ownerPHIDs', array());
     $subscriber_phids = $saved->getParameter('subscriberPHIDs', array());
     $project_phids = $saved->getParameter('projectPHIDs', array());
     $all_phids = array_merge($author_phids, $owner_phids, $subscriber_phids, $project_phids);
     $all_handles = id(new PhabricatorHandleQuery())->setViewer($this->requireViewer())->withPHIDs($all_phids)->execute();
     $author_handles = array_select_keys($all_handles, $author_phids);
     $owner_handles = array_select_keys($all_handles, $owner_phids);
     $subscriber_handles = array_select_keys($all_handles, $subscriber_phids);
     $project_handles = array_select_keys($all_handles, $project_phids);
     $with_unowned = $saved->getParameter('withUnowned', array());
     $status_values = $saved->getParameter('statuses', array());
     $status_values = array_fuse($status_values);
     $statuses = array(PhabricatorSearchRelationship::RELATIONSHIP_OPEN => pht('Open'), PhabricatorSearchRelationship::RELATIONSHIP_CLOSED => pht('Closed'));
     $status_control = id(new AphrontFormCheckboxControl())->setLabel(pht('Document Status'));
     foreach ($statuses as $status => $name) {
         $status_control->addCheckbox('statuses[]', $status, $name, isset($status_values[$status]));
     }
     $type_values = $saved->getParameter('types', array());
     $type_values = array_fuse($type_values);
     $types = self::getIndexableDocumentTypes($this->requireViewer());
     $types_control = id(new AphrontFormCheckboxControl())->setLabel(pht('Document Types'));
     foreach ($types as $type => $name) {
         $types_control->addCheckbox('types[]', $type, $name, isset($type_values[$type]));
     }
     $form->appendChild(phutil_tag('input', array('type' => 'hidden', 'name' => 'jump', 'value' => 'no')))->appendChild(id(new AphrontFormTextControl())->setLabel('Query')->setName('query')->setValue($saved->getParameter('query')))->appendChild($status_control)->appendChild($types_control)->appendChild(id(new AphrontFormTokenizerControl())->setName('authorPHIDs')->setLabel('Authors')->setDatasource(new PhabricatorPeopleDatasource())->setValue($author_handles))->appendChild(id(new AphrontFormTokenizerControl())->setName('ownerPHIDs')->setLabel('Owners')->setDatasource(new PhabricatorTypeaheadOwnerDatasource())->setValue($owner_handles))->appendChild(id(new AphrontFormCheckboxControl())->addCheckbox('withUnowned', 1, pht('Show only unowned documents.'), $with_unowned))->appendChild(id(new AphrontFormTokenizerControl())->setName('subscriberPHIDs')->setLabel('Subscribers')->setDatasource(new PhabricatorPeopleDatasource())->setValue($subscriber_handles))->appendChild(id(new AphrontFormTokenizerControl())->setName('projectPHIDs')->setLabel('In Any Project')->setDatasource(new PhabricatorProjectDatasource())->setValue($project_handles));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:34,代码来源:PhabricatorSearchApplicationSearchEngine.php


示例2: buildSearchForm

 public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved_query)
 {
     $phids = $saved_query->getParameter('authorPHIDs', array());
     $author_handles = id(new PhabricatorHandleQuery())->setViewer($this->requireViewer())->withPHIDs($phids)->execute();
     $upcoming = $saved_query->getParameter('upcoming');
     $form->appendChild(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('authors')->setLabel(pht('Authors'))->setValue($author_handles))->appendChild(id(new AphrontFormCheckboxControl())->addCheckbox('upcoming', 1, pht('Show only countdowns that are still counting down.'), $upcoming));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:7,代码来源:PhabricatorCountdownSearchEngine.php


示例3: render

 public function render()
 {
     $question = $this->question;
     $viewer = $this->user;
     $authors = mpull($question->getAnswers(), null, 'getAuthorPHID');
     if (isset($authors[$viewer->getPHID()])) {
         return id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NOTICE)->setTitle(pht('Already Answered'))->appendChild(pht('You have already answered this question. You can not answer ' . 'twice, but you can edit your existing answer.'));
     }
     $info_panel = null;
     if ($question->getStatus() != PonderQuestionStatus::STATUS_OPEN) {
         $info_panel = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NOTICE)->appendChild(pht('This question has been marked as closed,
          but you can still leave a new answer.'));
     }
     $box_style = null;
     $own_question = null;
     $hide_action_id = celerity_generate_unique_node_id();
     $show_action_id = celerity_generate_unique_node_id();
     if ($question->getAuthorPHID() == $viewer->getPHID()) {
         $box_style = 'display: none;';
         $open_link = javelin_tag('a', array('sigil' => 'reveal-content', 'class' => 'mml', 'id' => $hide_action_id, 'href' => '#', 'meta' => array('showIDs' => array($show_action_id), 'hideIDs' => array($hide_action_id))), pht('Add an answer.'));
         $own_question = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_WARNING)->setID($hide_action_id)->appendChild(pht('This is your own question. You are welcome to provide
         an answer if you have found a resolution.'))->appendChild($open_link);
     }
     $header = id(new PHUIHeaderView())->setHeader(pht('Add Answer'));
     $form = new AphrontFormView();
     $form->setUser($this->user)->setAction($this->actionURI)->setWorkflow(true)->addHiddenInput('question_id', $question->getID())->appendChild(id(new PhabricatorRemarkupControl())->setName('answer')->setLabel(pht('Answer'))->setError(true)->setID('answer-content')->setUser($this->user))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Add Answer')));
     $box = id(new PHUIObjectBoxView())->setHeader($header)->appendChild($form);
     if ($info_panel) {
         $box->setInfoView($info_panel);
     }
     $box = phutil_tag('div', array('style' => $box_style, 'class' => 'mlt', 'id' => $show_action_id), $box);
     return array($own_question, $box);
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:33,代码来源:PonderAddAnswerView.php


示例4: buildSearchForm

 public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved_query)
 {
     $user_phids = $saved_query->getParameter('userPHIDs', array());
     $ended = $saved_query->getParameter('ended', PhrequentUserTimeQuery::ENDED_ALL);
     $order = $saved_query->getParameter('order', PhrequentUserTimeQuery::ORDER_ENDED_DESC);
     $form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('users')->setLabel(pht('Users'))->setValue($user_phids))->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Ended'))->setName('ended')->setValue($ended)->setOptions(PhrequentUserTimeQuery::getEndedSearchOptions()))->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Order'))->setName('order')->setValue($order)->setOptions(PhrequentUserTimeQuery::getOrderSearchOptions()));
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:7,代码来源:PhrequentSearchEngine.php


示例5: buildSearchForm

 public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved_query)
 {
     $author_phids = $saved_query->getParameter('authorPHIDs', array());
     $content_type = $saved_query->getParameter('contentType');
     $rule_type = $saved_query->getParameter('ruleType');
     $form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('authors')->setLabel(pht('Authors'))->setValue($author_phids))->appendChild(id(new AphrontFormSelectControl())->setName('contentType')->setLabel(pht('Content Type'))->setValue($content_type)->setOptions($this->getContentTypeOptions()))->appendChild(id(new AphrontFormSelectControl())->setName('ruleType')->setLabel(pht('Rule Type'))->setValue($rule_type)->setOptions($this->getRuleTypeOptions()))->appendChild(id(new AphrontFormSelectControl())->setName('disabled')->setLabel(pht('Rule Status'))->setValue($this->getBoolFromQuery($saved_query, 'disabled'))->setOptions(array('' => pht('Show Enabled and Disabled Rules'), 'false' => pht('Show Only Enabled Rules'), 'true' => pht('Show Only Disabled Rules'))));
 }
开发者ID:kristain,项目名称:phabricator,代码行数:7,代码来源:HeraldRuleSearchEngine.php


示例6: processRequest

 public function processRequest()
 {
     $event = id(new PhabricatorTimelineEvent('NULL'))->load($this->id);
     if (!$event) {
         return new Aphront404Response();
     }
     $request = $this->getRequest();
     $user = $request->getUser();
     if ($event->getDataID()) {
         $data = id(new PhabricatorTimelineEventData())->load($event->getDataID());
     }
     if ($data) {
         $data = json_encode($data->getEventData());
     } else {
         $data = 'null';
     }
     $form = new AphrontFormView();
     $form->setUser($user)->appendChild(id(new AphrontFormStaticControl())->setLabel('ID')->setValue($event->getID()))->appendChild(id(new AphrontFormStaticControl())->setLabel('Type')->setValue($event->getType()))->appendChild(id(new AphrontFormTextAreaControl())->setDisabled(true)->setLabel('Data')->setValue($data))->appendChild(id(new AphrontFormSubmitControl())->addCancelButton('/daemon/timeline/'));
     $panel = new AphrontPanelView();
     $panel->setHeader('Event');
     $panel->setWidth(AphrontPanelView::WIDTH_FORM);
     $panel->appendChild($form);
     $nav = $this->buildSideNavView();
     $nav->selectFilter('timeline');
     $nav->appendChild($panel);
     return $this->buildApplicationPage($nav, array('title' => 'Timeline Event'));
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:27,代码来源:PhabricatorDaemonTimelineEventController.php


示例7: processRequest

 public function processRequest(AphrontRequest $request)
 {
     $user = $request->getUser();
     $username = $user->getUsername();
     $pref_time = PhabricatorUserPreferences::PREFERENCE_TIME_FORMAT;
     $pref_date = PhabricatorUserPreferences::PREFERENCE_DATE_FORMAT;
     $pref_week_start = PhabricatorUserPreferences::PREFERENCE_WEEK_START_DAY;
     $preferences = $user->loadPreferences();
     $errors = array();
     if ($request->isFormPost()) {
         $new_timezone = $request->getStr('timezone');
         if (in_array($new_timezone, DateTimeZone::listIdentifiers(), true)) {
             $user->setTimezoneIdentifier($new_timezone);
         } else {
             $errors[] = pht('The selected timezone is not a valid timezone.');
         }
         $preferences->setPreference($pref_time, $request->getStr($pref_time))->setPreference($pref_date, $request->getStr($pref_date))->setPreference($pref_week_start, $request->getStr($pref_week_start));
         if (!$errors) {
             $preferences->save();
             $user->save();
             return id(new AphrontRedirectResponse())->setURI($this->getPanelURI('?saved=true'));
         }
     }
     $timezone_ids = DateTimeZone::listIdentifiers();
     $timezone_id_map = array_fuse($timezone_ids);
     $form = new AphrontFormView();
     $form->setUser($user)->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Timezone'))->setName('timezone')->setOptions($timezone_id_map)->setValue($user->getTimezoneIdentifier()))->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Time-of-Day Format'))->setName($pref_time)->setOptions(array('g:i A' => pht('12-hour (2:34 PM)'), 'H:i' => pht('24-hour (14:34)')))->setCaption(pht('Format used when rendering a time of day.'))->setValue($preferences->getPreference($pref_time)))->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Date Format'))->setName($pref_date)->setOptions(array('Y-m-d' => pht('ISO 8601 (2000-02-28)'), 'n/j/Y' => pht('US (2/28/2000)'), 'd-m-Y' => pht('European (28-02-2000)')))->setCaption(pht('Format used when rendering a date.'))->setValue($preferences->getPreference($pref_date)))->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Week Starts On'))->setOptions($this->getWeekDays())->setName($pref_week_start)->setCaption(pht('Calendar weeks will start with this day.'))->setValue($preferences->getPreference($pref_week_start, 0)))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Save Account Settings')));
     $form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Date and Time Settings'))->setFormSaved($request->getStr('saved'))->setFormErrors($errors)->setForm($form);
     return array($form_box);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:30,代码来源:PhabricatorDateTimeSettingsPanel.php


示例8: processRequest

 public function processRequest()
 {
     if ($this->id) {
         $macro = id(new PhabricatorFileImageMacro())->load($this->id);
         if (!$macro) {
             return new Aphront404Response();
         }
     } else {
         $macro = new PhabricatorFileImageMacro();
     }
     $errors = array();
     $e_name = true;
     $request = $this->getRequest();
     $user = $request->getUser();
     if ($request->isFormPost()) {
         $macro->setName($request->getStr('name'));
         if (!strlen($macro->getName())) {
             $errors[] = 'Macro name is required.';
             $e_name = 'Required';
         } else {
             if (!preg_match('/^[a-z0-9_-]{3,}$/', $macro->getName())) {
                 $errors[] = 'Macro must be at least three characters long and contain ' . 'only lowercase letters, digits, hyphen and underscore.';
                 $e_name = 'Invalid';
             } else {
                 $e_name = null;
             }
         }
         if (!$errors) {
             $file = PhabricatorFile::newFromPHPUpload(idx($_FILES, 'file'), array('name' => $request->getStr('name'), 'authorPHID' => $user->getPHID()));
             $macro->setFilePHID($file->getPHID());
             try {
                 $macro->save();
                 return id(new AphrontRedirectResponse())->setURI('/file/macro/');
             } catch (AphrontQueryDuplicateKeyException $ex) {
                 $errors[] = 'Macro name is not unique!';
                 $e_name = 'Duplicate';
             }
         }
     }
     if ($errors) {
         $error_view = new AphrontErrorView();
         $error_view->setTitle('Form Errors');
         $error_view->setErrors($errors);
     } else {
         $error_view = null;
     }
     $form = new AphrontFormView();
     $form->setAction('/file/macro/edit/');
     $form->setUser($request->getUser());
     $form->setEncType('multipart/form-data')->appendChild(id(new AphrontFormTextControl())->setLabel('Name')->setName('name')->setValue($macro->getName())->setCaption('This word or phrase will be replaced with the image.')->setError($e_name))->appendChild(id(new AphrontFormFileControl())->setLabel('File')->setName('file')->setError(true))->appendChild(id(new AphrontFormSubmitControl())->setValue('Save Image Macro')->addCancelButton('/file/macro/'));
     $panel = new AphrontPanelView();
     if ($macro->getID()) {
         $panel->setHeader('Edit Image Macro');
     } else {
         $panel->setHeader('Create Image Macro');
     }
     $panel->appendChild($form);
     $panel->setWidth(AphrontPanelView::WIDTH_FORM);
     return $this->buildStandardPageResponse(array($error_view, $panel), array('title' => 'Edit Image Macro'));
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:60,代码来源:PhabricatorFileMacroEditController.php


示例9: renderValidateFactorForm

 public function renderValidateFactorForm(PhabricatorAuthFactorConfig $config, AphrontFormView $form, PhabricatorUser $viewer, $validation_result)
 {
     if (!$validation_result) {
         $validation_result = array();
     }
     $form->appendChild(id(new AphrontFormTextControl())->setName($this->getParameterName($config, 'totpcode'))->setLabel(pht('App Code'))->setCaption(pht('Factor Name: %s', $config->getFactorName()))->setValue(idx($validation_result, 'value'))->setError(idx($validation_result, 'error', true)));
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:7,代码来源:PhabricatorTOTPAuthFactor.php


示例10: buildSearchForm

 public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved)
 {
     $backer_phids = $saved->getParameter('backerPHIDs', array());
     $all_phids = array_mergev(array($backer_phids));
     $handles = id(new PhabricatorHandleQuery())->setViewer($this->requireViewer())->withPHIDs($all_phids)->execute();
     $form->appendChild(id(new AphrontFormTokenizerControl())->setLabel(pht('Backers'))->setName('backers')->setDatasource(new PhabricatorPeopleDatasource())->setValue(array_select_keys($handles, $backer_phids)));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:7,代码来源:FundBackerSearchEngine.php


示例11: buildSearchForm

 public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved_query)
 {
     $user_phids = $saved_query->getParameter('userPHIDs', array());
     $proj_phids = $saved_query->getParameter('projectPHIDs', array());
     $viewer_projects = $saved_query->getParameter('viewerProjects');
     $form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('users')->setLabel(pht('Include Users'))->setValue($user_phids))->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorProjectDatasource())->setName('projectPHIDs')->setLabel(pht('Include Projects'))->setValue($proj_phids))->appendChild(id(new AphrontFormCheckboxControl())->addCheckbox('viewerProjects', 1, pht('Include stories about projects I am a member of.'), $viewer_projects));
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:7,代码来源:PhabricatorFeedSearchEngine.php


示例12: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     if ($request->isFormPost()) {
         $receiver = PhabricatorMetaMTAReceivedMail::loadReceiverObject($request->getStr('obj'));
         if (!$receiver) {
             throw new Exception("No such task or revision!");
         }
         $hash = PhabricatorMetaMTAReceivedMail::computeMailHash($receiver->getMailKey(), $user->getPHID());
         $received = new PhabricatorMetaMTAReceivedMail();
         $received->setHeaders(array('to' => $request->getStr('obj') . '+' . $user->getID() . '+' . $hash . '@'));
         $received->setBodies(array('text' => $request->getStr('body')));
         $received->save();
         $received->processReceivedMail();
         $phid = $receiver->getPHID();
         $handles = $this->loadViewerHandles(array($phid));
         $uri = $handles[$phid]->getURI();
         return id(new AphrontRedirectResponse())->setURI($uri);
     }
     $form = new AphrontFormView();
     $form->setUser($request->getUser());
     $form->setAction($this->getApplicationURI('/receive/'));
     $form->appendChild('<p class="aphront-form-instructions">This form will simulate ' . 'sending mail to an object.</p>')->appendChild(id(new AphrontFormTextControl())->setLabel('To')->setName('obj')->setCaption('e.g. <tt>D1234</tt> or <tt>T1234</tt>'))->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Body')->setName('body'))->appendChild(id(new AphrontFormSubmitControl())->setValue('Receive Mail'));
     $panel = new AphrontPanelView();
     $panel->setHeader('Receive Email');
     $panel->appendChild($form);
     $panel->setWidth(AphrontPanelView::WIDTH_FORM);
     $nav = $this->buildSideNavView();
     $nav->selectFilter('receive');
     $nav->appendChild($panel);
     return $this->buildApplicationPage($nav, array('title' => 'Receive Test'));
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:33,代码来源:PhabricatorMetaMTAReceiveController.php


示例13: buildSearchForm

 public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved_query)
 {
     $author_phids = $saved_query->getParameter('authorPHIDs', array());
     $voted = $saved_query->getParameter('voted', false);
     $statuses = $saved_query->getParameter('statuses', array());
     $form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('authors')->setLabel(pht('Authors'))->setValue($author_phids))->appendChild(id(new AphrontFormCheckboxControl())->addCheckbox('voted', 1, pht("Show only polls I've voted in."), $voted))->appendChild(id(new AphrontFormCheckboxControl())->setLabel(pht('Status'))->addCheckbox('statuses[]', 'open', pht('Open'), in_array('open', $statuses))->addCheckbox('statuses[]', 'closed', pht('Closed'), in_array('closed', $statuses)));
 }
开发者ID:kristain,项目名称:phabricator,代码行数:7,代码来源:PhabricatorSlowvoteSearchEngine.php


示例14: buildSearchForm

 public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved_query)
 {
     $author_phids = $saved_query->getParameter('authorPHIDs', array());
     $answerer_phids = $saved_query->getParameter('answererPHIDs', array());
     $status = $saved_query->getParameter('status', PonderQuestionStatus::STATUS_OPEN);
     $form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('authors')->setLabel(pht('Authors'))->setValue($author_phids))->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('answerers')->setLabel(pht('Answered By'))->setValue($answerer_phids))->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Status'))->setName('status')->setValue($status)->setOptions(PonderQuestionStatus::getQuestionStatusMap()));
 }
开发者ID:kristain,项目名称:phabricator,代码行数:7,代码来源:PonderQuestionSearchEngine.php


示例15: render

 public function render()
 {
     $question = $this->question;
     $viewer = $this->getViewer();
     $authors = mpull($question->getAnswers(), null, 'getAuthorPHID');
     if (isset($authors[$viewer->getPHID()])) {
         $view = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NOTICE)->setTitle(pht('Already Answered'))->appendChild(pht('You have already answered this question. You can not answer ' . 'twice, but you can edit your existing answer.'));
         return phutil_tag_div('ponder-add-answer-view', $view);
     }
     $info_panel = null;
     if ($question->getStatus() != PonderQuestionStatus::STATUS_OPEN) {
         $info_panel = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NOTICE)->appendChild(pht('This question has been marked as closed,
          but you can still leave a new answer.'));
     }
     $box_style = null;
     $header = id(new PHUIHeaderView())->setHeader(pht('New Answer'))->addClass('ponder-add-answer-header');
     $form = new AphrontFormView();
     $form->setViewer($viewer)->setAction($this->actionURI)->setWorkflow(true)->addHiddenInput('question_id', $question->getID())->appendChild(id(new PhabricatorRemarkupControl())->setName('answer')->setLabel(pht('Answer'))->setError(true)->setID('answer-content')->setViewer($viewer))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Add Answer')));
     if (!$viewer->isLoggedIn()) {
         $login_href = id(new PhutilURI('/auth/start/'))->setQueryParam('next', '/Q' . $question->getID());
         $form = id(new PHUIFormLayoutView())->addClass('login-to-participate')->appendChild(id(new PHUIButtonView())->setTag('a')->setText(pht('Login to Answer'))->setHref((string) $login_href));
     }
     $box = id(new PHUIObjectBoxView())->appendChild($form)->setHeaderText('Answer')->addClass('ponder-add-answer-view');
     if ($info_panel) {
         $box->setInfoView($info_panel);
     }
     return array($header, $box);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:28,代码来源:PonderAddAnswerView.php


示例16: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     if ($request->isFormPost()) {
         $parser = new ArcanistDiffParser();
         $diff = null;
         try {
             $diff = PhabricatorFile::readUploadedFileData($_FILES['diff-file']);
         } catch (Exception $ex) {
             $diff = $request->getStr('diff');
         }
         $changes = $parser->parseDiff($diff);
         $diff = DifferentialDiff::newFromRawChanges($changes);
         $diff->setLintStatus(DifferentialLintStatus::LINT_SKIP);
         $diff->setUnitStatus(DifferentialLintStatus::LINT_SKIP);
         $diff->setAuthorPHID($request->getUser()->getPHID());
         $diff->setCreationMethod('web');
         $diff->save();
         return id(new AphrontRedirectResponse())->setURI('/differential/diff/' . $diff->getID() . '/');
     }
     $form = new AphrontFormView();
     $arcanist_href = PhabricatorEnv::getDoclink('article/Arcanist_User_Guide.html');
     $arcanist_link = phutil_render_tag('a', array('href' => $arcanist_href, 'target' => '_blank'), 'Arcanist');
     $form->setAction('/differential/diff/create/')->setEncType('multipart/form-data')->setUser($request->getUser())->appendChild('<p class="aphront-form-instructions">The best way to create a ' . "Differential diff is by using {$arcanist_link}, but you " . 'can also just paste a diff (e.g., from <tt>svn diff</tt> or ' . '<tt>git diff</tt>) into this box or upload it as a file if you ' . 'really want.</p>')->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Raw Diff')->setName('diff')->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL))->appendChild(id(new AphrontFormFileControl())->setLabel('Raw Diff from file')->setName('diff-file'))->appendChild(id(new AphrontFormSubmitControl())->setValue("Create Diff »"));
     $panel = new AphrontPanelView();
     $panel->setHeader('Create New Diff');
     $panel->appendChild($form);
     $panel->setWidth(AphrontPanelView::WIDTH_FORM);
     return $this->buildStandardPageResponse($panel, array('title' => 'Create Diff', 'tab' => 'create'));
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:30,代码来源:DifferentialDiffCreateController.php


示例17: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $phids = $request->getStrList('phids');
     if ($phids) {
         $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
         $rows = array();
         foreach ($handles as $handle) {
             if ($handle->getURI()) {
                 $link = phutil_render_tag('a', array('href' => $handle->getURI()), phutil_escape_html($handle->getURI()));
             } else {
                 $link = null;
             }
             $rows[] = array(phutil_escape_html($handle->getPHID()), phutil_escape_html($handle->getType()), phutil_escape_html($handle->getName()), $link);
         }
         $table = new AphrontTableView($rows);
         $table->setHeaders(array('PHID', 'Type', 'Name', 'URI'));
         $table->setColumnClasses(array(null, null, null, 'wide'));
         $panel = new AphrontPanelView();
         $panel->setHeader('PHID Handles');
         $panel->appendChild($table);
         return $this->buildStandardPageResponse($panel, array('title' => 'PHID Lookup Results'));
     }
     $lookup_form = new AphrontFormView();
     $lookup_form->setUser($request->getUser());
     $lookup_form->setAction('/phid/')->appendChild(id(new AphrontFormTextAreaControl())->setName('phids')->setCaption('Enter PHIDs separated by spaces or commas.'))->appendChild(id(new AphrontFormSubmitControl())->setValue('Lookup PHIDs'));
     $lookup_panel = new AphrontPanelView();
     $lookup_panel->setHeader('Lookup PHIDs');
     $lookup_panel->appendChild($lookup_form);
     $lookup_panel->setWidth(AphrontPanelView::WIDTH_WIDE);
     return $this->buildStandardPageResponse(array($lookup_panel), array('title' => 'PHID Lookup'));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:32,代码来源:PhabricatorPHIDLookupController.php


示例18: appendFieldsToForm

 public function appendFieldsToForm(AphrontFormView $form)
 {
     $enabled = array();
     foreach ($this->fields as $field) {
         if ($field->shouldEnableForRole(PhabricatorCustomField::ROLE_EDIT)) {
             $enabled[] = $field;
         }
     }
     $phids = array();
     foreach ($enabled as $field_key => $field) {
         $phids[$field_key] = $field->getRequiredHandlePHIDsForEdit();
     }
     $all_phids = array_mergev($phids);
     if ($all_phids) {
         $handles = id(new PhabricatorHandleQuery())->setViewer($this->viewer)->withPHIDs($all_phids)->execute();
     } else {
         $handles = array();
     }
     foreach ($enabled as $field_key => $field) {
         $field_handles = array_select_keys($handles, $phids[$field_key]);
         $instructions = $field->getInstructionsForEdit();
         if (strlen($instructions)) {
             $form->appendRemarkupInstructions($instructions);
         }
         $form->appendChild($field->renderEditControl($field_handles));
     }
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:27,代码来源:PhabricatorCustomFieldList.php


示例19: render

 public function render()
 {
     $viewer = $this->getViewer();
     $this->requireResource('differential-revision-add-comment-css');
     $revision = $this->revision;
     $action = null;
     if ($this->draft) {
         $action = idx($this->draft->getMetadata(), 'action');
     }
     $enable_reviewers = DifferentialAction::allowReviewers($action);
     $enable_ccs = $action == DifferentialAction::ACTION_ADDCCS;
     $add_reviewers_labels = array('add_reviewers' => pht('Add Reviewers'), 'request_review' => pht('Add Reviewers'), 'resign' => pht('Suggest Reviewers'));
     $mailable_source = new PhabricatorMetaMTAMailableDatasource();
     // TODO: This should be a reviewers datasource, but it's a mess.
     $reviewer_source = new PhabricatorMetaMTAMailableDatasource();
     $form = new AphrontFormView();
     $form->setWorkflow(true)->setViewer($viewer)->setAction($this->actionURI)->addHiddenInput('revision_id', $revision->getID())->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Action'))->setName('action')->setValue($action)->setID('comment-action')->setOptions($this->actions))->appendControl(id(new AphrontFormTokenizerControl())->setLabel($enable_reviewers ? $add_reviewers_labels[$action] : $add_reviewers_labels['add_reviewers'])->setName('reviewers')->setControlID('add-reviewers')->setControlStyle($enable_reviewers ? null : 'display: none')->setID('add-reviewers-tokenizer')->setDisableBehavior(true)->setDatasource($reviewer_source))->appendControl(id(new AphrontFormTokenizerControl())->setLabel(pht('Add Subscribers'))->setName('ccs')->setControlID('add-ccs')->setControlStyle($enable_ccs ? null : 'display: none')->setID('add-ccs-tokenizer')->setDisableBehavior(true)->setDatasource($mailable_source))->appendChild(id(new PhabricatorRemarkupControl())->setName('comment')->setID('comment-content')->setLabel(pht('Comment'))->setValue($this->draft ? $this->draft->getDraft() : null)->setViewer($viewer))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Submit')));
     Javelin::initBehavior('differential-add-reviewers-and-ccs', array('dynamic' => array('add-reviewers-tokenizer' => array('actions' => array('request_review' => 1, 'add_reviewers' => 1, 'resign' => 1), 'src' => $reviewer_source->getDatasourceURI(), 'value' => $this->reviewers, 'row' => 'add-reviewers', 'labels' => $add_reviewers_labels, 'placeholder' => $reviewer_source->getPlaceholderText()), 'add-ccs-tokenizer' => array('actions' => array('add_ccs' => 1), 'src' => $mailable_source->getDatasourceURI(), 'value' => $this->ccs, 'row' => 'add-ccs', 'placeholder' => $mailable_source->getPlaceholderText())), 'select' => 'comment-action'));
     $diff = $revision->loadActiveDiff();
     $rev_id = $revision->getID();
     Javelin::initBehavior('differential-feedback-preview', array('uri' => '/differential/comment/preview/' . $rev_id . '/', 'preview' => 'comment-preview', 'action' => 'comment-action', 'content' => 'comment-content', 'previewTokenizers' => array('reviewers' => 'add-reviewers-tokenizer', 'ccs' => 'add-ccs-tokenizer'), 'inlineuri' => '/differential/comment/inline/preview/' . $rev_id . '/', 'inline' => 'inline-comment-preview'));
     $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
     $header_text = $is_serious ? pht('Add Comment') : pht('Leap Into Action!');
     $header = id(new PHUIHeaderView())->setHeader($header_text);
     $anchor = id(new PhabricatorAnchorView())->setAnchorName('comment')->setNavigationMarker(true);
     $loading = phutil_tag('span', array('class' => 'aphront-panel-preview-loading-text'), pht('Loading comment preview...'));
     $preview = phutil_tag_div('aphront-panel-preview aphront-panel-flush', array(phutil_tag('div', array('id' => 'comment-preview'), $loading), phutil_tag('div', array('id' => 'inline-comment-preview'))));
     $comment_box = id(new PHUIObjectBoxView())->setHeader($header)->appendChild($anchor)->appendChild($form);
     if ($this->errorView) {
         $comment_box->setInfoView($this->errorView);
     }
     return array($comment_box, $preview);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:33,代码来源:DifferentialAddCommentView.php


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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP AphrontPagerView类代码示例发布时间:2022-05-23
下一篇:
PHP AphrontErrorView类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap