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


PHP AphrontFormView::appendChild方法代码示例

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


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

示例1: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $editable = $this->getAccountEditable();
     // There's no sense in showing a change password panel if the user
     // can't change their password
     if (!$editable || !PhabricatorEnv::getEnvConfig('auth.password-auth-enabled')) {
         return new Aphront400Response();
     }
     $errors = array();
     if ($request->isFormPost()) {
         if ($user->comparePassword($request->getStr('old_pw'))) {
             $pass = $request->getStr('new_pw');
             $conf = $request->getStr('conf_pw');
             if ($pass === $conf) {
                 if (strlen($pass)) {
                     $user->setPassword($pass);
                     // This write is unguarded because the CSRF token has already
                     // been checked in the call to $request->isFormPost() and
                     // the CSRF token depends on the password hash, so when it
                     // is changed here the CSRF token check will fail.
                     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
                     $user->save();
                     unset($unguarded);
                     return id(new AphrontRedirectResponse())->setURI('/settings/page/password/?saved=true');
                 } else {
                     $errors[] = 'Your new password is too short.';
                 }
             } else {
                 $errors[] = 'New password and confirmation do not match.';
             }
         } else {
             $errors[] = 'The old password you entered is incorrect.';
         }
     }
     $notice = null;
     if (!$errors) {
         if ($request->getStr('saved')) {
             $notice = new AphrontErrorView();
             $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
             $notice->setTitle('Changes Saved');
             $notice->appendChild('<p>Your password has been updated.</p>');
         }
     } else {
         $notice = new AphrontErrorView();
         $notice->setTitle('Error Changing Password');
         $notice->setErrors($errors);
     }
     $form = new AphrontFormView();
     $form->setUser($user)->appendChild(id(new AphrontFormPasswordControl())->setLabel('Old Password')->setName('old_pw'));
     $form->appendChild(id(new AphrontFormPasswordControl())->setLabel('New Password')->setName('new_pw'));
     $form->appendChild(id(new AphrontFormPasswordControl())->setLabel('Confirm Password')->setName('conf_pw'));
     $form->appendChild(id(new AphrontFormSubmitControl())->setValue('Save'));
     $panel = new AphrontPanelView();
     $panel->setHeader('Change Password');
     $panel->setWidth(AphrontPanelView::WIDTH_FORM);
     $panel->appendChild($form);
     return id(new AphrontNullView())->appendChild(array($notice, $panel));
 }
开发者ID:hwang36,项目名称:phabricator,代码行数:60,代码来源:PhabricatorUserPasswordSettingsPanelController.php

示例2: buildSearchForm

 public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved)
 {
     $form->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Name Contains'))->setName('nameContains')->setValue($saved->getParameter('nameContains')));
     $is_stable = $saved->getParameter('isStable');
     $is_unstable = $saved->getParameter('isUnstable');
     $is_deprecated = $saved->getParameter('isDeprecated');
     $form->appendChild(id(new AphrontFormCheckboxControl())->setLabel('Stability')->addCheckbox('isStable', 1, hsprintf('<strong>%s</strong>: %s', pht('Stable Methods'), pht('Show established API methods with stable interfaces.')), $is_stable)->addCheckbox('isUnstable', 1, hsprintf('<strong>%s</strong>: %s', pht('Unstable Methods'), pht('Show new methods which are subject to change.')), $is_unstable)->addCheckbox('isDeprecated', 1, hsprintf('<strong>%s</strong>: %s', pht('Deprecated Methods'), pht('Show old methods which will be deleted in a future ' . 'version of Phabricator.')), $is_deprecated));
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:8,代码来源:PhabricatorConduitSearchEngine.php

示例3: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $methods = $this->getAllMethods();
     if (empty($methods[$this->method])) {
         return new Aphront404Response();
     }
     $this->setFilter('method/' . $this->method);
     $method_class = $methods[$this->method];
     $method_object = newv($method_class, array());
     $status = $method_object->getMethodStatus();
     $reason = $method_object->getMethodStatusDescription();
     $status_view = null;
     if ($status != ConduitAPIMethod::METHOD_STATUS_STABLE) {
         $status_view = new AphrontErrorView();
         switch ($status) {
             case ConduitAPIMethod::METHOD_STATUS_DEPRECATED:
                 $status_view->setTitle('Deprecated Method');
                 $status_view->appendChild(phutil_escape_html(nonempty($reason, "This method is deprecated.")));
                 break;
             case ConduitAPIMethod::METHOD_STATUS_UNSTABLE:
                 $status_view->setSeverity(AphrontErrorView::SEVERITY_WARNING);
                 $status_view->setTitle('Unstable Method');
                 $status_view->appendChild(phutil_escape_html(nonempty($reason, "This method is new and unstable. Its interface is subject " . "to change.")));
                 break;
         }
     }
     $error_description = array();
     $error_types = $method_object->defineErrorTypes();
     if ($error_types) {
         $error_description[] = '<ul>';
         foreach ($error_types as $error => $meaning) {
             $error_description[] = '<li>' . '<strong>' . phutil_escape_html($error) . ':</strong> ' . phutil_escape_html($meaning) . '</li>';
         }
         $error_description[] = '</ul>';
         $error_description = implode("\n", $error_description);
     } else {
         $error_description = "This method does not raise any specific errors.";
     }
     $form = new AphrontFormView();
     $form->setUser($request->getUser())->setAction('/api/' . $this->method)->appendChild(id(new AphrontFormStaticControl())->setLabel('Description')->setValue($method_object->getMethodDescription()))->appendChild(id(new AphrontFormStaticControl())->setLabel('Returns')->setValue($method_object->defineReturnType()))->appendChild(id(new AphrontFormMarkupControl())->setLabel('Errors')->setValue($error_description))->appendChild('<p class="aphront-form-instructions">Enter parameters using ' . '<strong>JSON</strong>. For instance, to enter a list, type: ' . '<tt>["apple", "banana", "cherry"]</tt>');
     $params = $method_object->defineParamTypes();
     foreach ($params as $param => $desc) {
         $form->appendChild(id(new AphrontFormTextControl())->setLabel($param)->setName("params[{$param}]")->setCaption(phutil_escape_html($desc)));
     }
     $form->appendChild(id(new AphrontFormSelectControl())->setLabel('Output Format')->setName('output')->setOptions(array('human' => 'Human Readable', 'json' => 'JSON')))->appendChild(id(new AphrontFormSubmitControl())->setValue('Call Method'));
     $panel = new AphrontPanelView();
     $panel->setHeader('Conduit API: ' . phutil_escape_html($this->method));
     $panel->appendChild($form);
     $panel->setWidth(AphrontPanelView::WIDTH_FULL);
     return $this->buildStandardPageResponse(array($status_view, $panel), array('title' => 'Conduit Console - ' . $this->method));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:52,代码来源:PhabricatorConduitConsoleController.php

示例4: processRequest

 public function processRequest()
 {
     $this->requireApplicationCapability(ManiphestBulkEditCapability::CAPABILITY);
     $request = $this->getRequest();
     $user = $request->getUser();
     $task_ids = $request->getArr('batch');
     $tasks = id(new ManiphestTaskQuery())->setViewer($user)->withIDs($task_ids)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->execute();
     $actions = $request->getStr('actions');
     if ($actions) {
         $actions = json_decode($actions, true);
     }
     if ($request->isFormPost() && is_array($actions)) {
         foreach ($tasks as $task) {
             $field_list = PhabricatorCustomField::getObjectFields($task, PhabricatorCustomField::ROLE_EDIT);
             $field_list->readFieldsFromStorage($task);
             $xactions = $this->buildTransactions($actions, $task);
             if ($xactions) {
                 // TODO: Set content source to "batch edit".
                 $editor = id(new ManiphestTransactionEditor())->setActor($user)->setContentSourceFromRequest($request)->setContinueOnNoEffect(true)->setContinueOnMissingFields(true)->applyTransactions($task, $xactions);
             }
         }
         $task_ids = implode(',', mpull($tasks, 'getID'));
         return id(new AphrontRedirectResponse())->setURI('/maniphest/?ids=' . $task_ids);
     }
     $handles = ManiphestTaskListView::loadTaskHandles($user, $tasks);
     $list = new ManiphestTaskListView();
     $list->setTasks($tasks);
     $list->setUser($user);
     $list->setHandles($handles);
     $template = new AphrontTokenizerTemplateView();
     $template = $template->render();
     $projects_source = new PhabricatorProjectDatasource();
     $mailable_source = new PhabricatorMetaMTAMailableDatasource();
     $owner_source = new PhabricatorTypeaheadOwnerDatasource();
     require_celerity_resource('maniphest-batch-editor');
     Javelin::initBehavior('maniphest-batch-editor', array('root' => 'maniphest-batch-edit-form', 'tokenizerTemplate' => $template, 'sources' => array('project' => array('src' => $projects_source->getDatasourceURI(), 'placeholder' => $projects_source->getPlaceholderText()), 'owner' => array('src' => $owner_source->getDatasourceURI(), 'placeholder' => $owner_source->getPlaceholderText(), 'limit' => 1), 'cc' => array('src' => $mailable_source->getDatasourceURI(), 'placeholder' => $mailable_source->getPlaceholderText())), 'input' => 'batch-form-actions', 'priorityMap' => ManiphestTaskPriority::getTaskPriorityMap(), 'statusMap' => ManiphestTaskStatus::getTaskStatusMap()));
     $form = new AphrontFormView();
     $form->setUser($user);
     $form->setID('maniphest-batch-edit-form');
     foreach ($tasks as $task) {
         $form->appendChild(phutil_tag('input', array('type' => 'hidden', 'name' => 'batch[]', 'value' => $task->getID())));
     }
     $form->appendChild(phutil_tag('input', array('type' => 'hidden', 'name' => 'actions', 'id' => 'batch-form-actions')));
     $form->appendChild(phutil_tag('p', array(), pht('These tasks will be edited:')));
     $form->appendChild($list);
     $form->appendChild(id(new AphrontFormInsetView())->setTitle('Actions')->setRightButton(javelin_tag('a', array('href' => '#', 'class' => 'button green', 'sigil' => 'add-action', 'mustcapture' => true), pht('Add Another Action')))->setContent(javelin_tag('table', array('sigil' => 'maniphest-batch-actions', 'class' => 'maniphest-batch-actions-table'), '')))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Update Tasks'))->addCancelButton('/maniphest/'));
     $title = pht('Batch Editor');
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($title);
     $form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Batch Edit Tasks'))->setForm($form);
     return $this->buildApplicationPage(array($crumbs, $form_box), array('title' => $title, 'device' => false));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:52,代码来源:ManiphestBatchEditController.php

示例5: buildSearchForm

 public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved_query)
 {
     $document_phids = $saved_query->getParameter('documentPHIDs', array());
     $signer_phids = $saved_query->getParameter('signerPHIDs', array());
     $phids = array_merge($document_phids, $signer_phids);
     $handles = id(new PhabricatorHandleQuery())->setViewer($this->requireViewer())->withPHIDs($phids)->execute();
     if (!$this->document) {
         $form->appendChild(id(new AphrontFormTokenizerControl())->setDatasource(new LegalpadDocumentDatasource())->setName('documents')->setLabel(pht('Documents'))->setValue(array_select_keys($handles, $document_phids)));
     }
     $name_contains = $saved_query->getParameter('nameContains', '');
     $email_contains = $saved_query->getParameter('emailContains', '');
     $form->appendChild(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('signers')->setLabel(pht('Signers'))->setValue(array_select_keys($handles, $signer_phids)))->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Name Contains'))->setName('nameContains')->setValue($name_contains))->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Email Contains'))->setName('emailContains')->setValue($email_contains));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:13,代码来源:LegalpadDocumentSignatureSearchEngine.php

示例6: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $method = id(new PhabricatorConduitMethodQuery())->setViewer($viewer)->withMethods(array($this->method))->executeOne();
     if (!$method) {
         return new Aphront404Response();
     }
     $can_call_method = false;
     $status = $method->getMethodStatus();
     $reason = $method->getMethodStatusDescription();
     $errors = array();
     switch ($status) {
         case ConduitAPIMethod::METHOD_STATUS_DEPRECATED:
             $reason = nonempty($reason, pht('This method is deprecated.'));
             $errors[] = pht('Deprecated Method: %s', $reason);
             break;
         case ConduitAPIMethod::METHOD_STATUS_UNSTABLE:
             $reason = nonempty($reason, pht('This method is new and unstable. Its interface is subject ' . 'to change.'));
             $errors[] = pht('Unstable Method: %s', $reason);
             break;
     }
     $error_types = $method->defineErrorTypes();
     if ($error_types) {
         $error_description = array();
         foreach ($error_types as $error => $meaning) {
             $error_description[] = hsprintf('<li><strong>%s:</strong> %s</li>', $error, $meaning);
         }
         $error_description = phutil_tag('ul', array(), $error_description);
     } else {
         $error_description = pht('This method does not raise any specific errors.');
     }
     $form = new AphrontFormView();
     $form->setUser($request->getUser())->setAction('/api/' . $this->method)->addHiddenInput('allowEmptyParams', 1)->appendChild(id(new AphrontFormStaticControl())->setLabel('Description')->setValue($method->getMethodDescription()))->appendChild(id(new AphrontFormStaticControl())->setLabel('Returns')->setValue($method->defineReturnType()))->appendChild(id(new AphrontFormMarkupControl())->setLabel('Errors')->setValue($error_description))->appendChild(hsprintf('<p class="aphront-form-instructions">Enter parameters using ' . '<strong>JSON</strong>. For instance, to enter a list, type: ' . '<tt>["apple", "banana", "cherry"]</tt>'));
     $params = $method->defineParamTypes();
     foreach ($params as $param => $desc) {
         $form->appendChild(id(new AphrontFormTextControl())->setLabel($param)->setName("params[{$param}]")->setCaption($desc));
     }
     $must_login = !$viewer->isLoggedIn() && $method->shouldRequireAuthentication();
     if ($must_login) {
         $errors[] = pht('Login Required: This method requires authentication. You must ' . 'log in before you can make calls to it.');
     } else {
         $form->appendChild(id(new AphrontFormSelectControl())->setLabel('Output Format')->setName('output')->setOptions(array('human' => 'Human Readable', 'json' => 'JSON')))->appendChild(id(new AphrontFormSubmitControl())->addCancelButton($this->getApplicationURI())->setValue(pht('Call Method')));
     }
     $header = id(new PHUIHeaderView())->setUser($viewer)->setHeader($method->getAPIMethodName());
     $form_box = id(new PHUIObjectBoxView())->setHeader($header)->setFormErrors($errors)->setForm($form);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($method->getAPIMethodName());
     return $this->buildApplicationPage(array($crumbs, $form_box), array('title' => $method->getAPIMethodName()));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:50,代码来源:PhabricatorConduitConsoleController.php

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

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

示例9: buildSearchForm

 public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved)
 {
     $responsible_phids = $saved->getParameter('responsiblePHIDs', array());
     $author_phids = $saved->getParameter('authorPHIDs', array());
     $reviewer_phids = $saved->getParameter('reviewerPHIDs', array());
     $subscriber_phids = $saved->getParameter('subscriberPHIDs', array());
     $repository_phids = $saved->getParameter('repositoryPHIDs', array());
     $only_draft = $saved->getParameter('draft', false);
     $all_phids = array_mergev(array($responsible_phids, $author_phids, $reviewer_phids, $subscriber_phids, $repository_phids));
     $handles = id(new PhabricatorHandleQuery())->setViewer($this->requireViewer())->withPHIDs($all_phids)->execute();
     $form->appendChild(id(new AphrontFormTokenizerControl())->setLabel(pht('Responsible Users'))->setName('responsibles')->setDatasource(new PhabricatorPeopleDatasource())->setValue(array_select_keys($handles, $responsible_phids)))->appendChild(id(new AphrontFormTokenizerControl())->setLabel(pht('Authors'))->setName('authors')->setDatasource(new PhabricatorPeopleDatasource())->setValue(array_select_keys($handles, $author_phids)))->appendChild(id(new AphrontFormTokenizerControl())->setLabel(pht('Reviewers'))->setName('reviewers')->setDatasource(new PhabricatorProjectOrUserDatasource())->setValue(array_select_keys($handles, $reviewer_phids)))->appendChild(id(new AphrontFormTokenizerControl())->setLabel(pht('Subscribers'))->setName('subscribers')->setDatasource(new PhabricatorMetaMTAMailableDatasource())->setValue(array_select_keys($handles, $subscriber_phids)))->appendChild(id(new AphrontFormTokenizerControl())->setLabel(pht('Repositories'))->setName('repositories')->setDatasource(new DiffusionRepositoryDatasource())->setValue(array_select_keys($handles, $repository_phids)))->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Status'))->setName('status')->setOptions($this->getStatusOptions())->setValue($saved->getParameter('status')));
     if ($this->requireViewer()->isLoggedIn()) {
         $form->appendChild(id(new AphrontFormCheckboxControl())->addCheckbox('draft', 1, pht('Show only revisions with a draft comment.'), $only_draft));
     }
     $form->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Order'))->setName('order')->setOptions($this->getOrderOptions())->setValue($saved->getParameter('order')));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:16,代码来源:DifferentialRevisionSearchEngine.php

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

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

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

示例14: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $project = new PhabricatorProject();
     $project->setAuthorPHID($user->getPHID());
     $profile = new PhabricatorProjectProfile();
     $e_name = true;
     $errors = array();
     if ($request->isFormPost()) {
         try {
             $editor = new PhabricatorProjectEditor($project);
             $editor->setUser($user);
             $editor->setName($request->getStr('name'));
             $editor->save();
         } catch (PhabricatorProjectNameCollisionException $ex) {
             $e_name = 'Not Unique';
             $errors[] = $ex->getMessage();
         }
         $project->setStatus(PhabricatorProjectStatus::ONGOING);
         $profile->setBlurb($request->getStr('blurb'));
         if (!$errors) {
             $project->save();
             $profile->setProjectPHID($project->getPHID());
             $profile->save();
             id(new PhabricatorProjectAffiliation())->setUserPHID($user->getPHID())->setProjectPHID($project->getPHID())->setRole('Owner')->setIsOwner(true)->save();
             if ($request->isAjax()) {
                 return id(new AphrontAjaxResponse())->setContent(array('phid' => $project->getPHID(), 'name' => $project->getName()));
             } else {
                 return id(new AphrontRedirectResponse())->setURI('/project/view/' . $project->getID() . '/');
             }
         }
     }
     $error_view = null;
     if ($errors) {
         $error_view = new AphrontErrorView();
         $error_view->setTitle('Form Errors');
         $error_view->setErrors($errors);
     }
     if ($request->isAjax()) {
         $form = new AphrontFormLayoutView();
     } else {
         $form = new AphrontFormView();
         $form->setUser($user);
     }
     $form->appendChild(id(new AphrontFormTextControl())->setLabel('Name')->setName('name')->setValue($project->getName())->setError($e_name))->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Blurb')->setName('blurb')->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_SHORT)->setValue($profile->getBlurb()));
     if ($request->isAjax()) {
         if ($error_view) {
             $error_view->setWidth(AphrontErrorView::WIDTH_DIALOG);
         }
         $dialog = id(new AphrontDialogView())->setUser($user)->setWidth(AphrontDialogView::WIDTH_FORM)->setTitle('Create a New Project')->appendChild($error_view)->appendChild($form)->addSubmitButton('Create Project')->addCancelButton('/project/');
         return id(new AphrontDialogResponse())->setDialog($dialog);
     } else {
         $form->appendChild(id(new AphrontFormSubmitControl())->setValue('Create')->addCancelButton('/project/'));
         $panel = new AphrontPanelView();
         $panel->setWidth(AphrontPanelView::WIDTH_FORM)->setHeader('Create a New Project')->appendChild($form);
         return $this->buildStandardPageResponse(array($error_view, $panel), array('title' => 'Create new Project'));
     }
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:59,代码来源:PhabricatorProjectCreateController.php

示例15: 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();
     $voted = $saved_query->getParameter('voted', false);
     $statuses = $saved_query->getParameter('statuses', array());
     $form->appendChild(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('authors')->setLabel(pht('Authors'))->setValue($author_handles))->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:denghp,项目名称:phabricator,代码行数:8,代码来源:PhabricatorSlowvoteSearchEngine.php


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