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


PHP AphrontFormView::setAction方法代码示例

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


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

示例1: processRequest

 public function processRequest()
 {
     if ($this->id) {
         $item = id(new PhabricatorDirectoryItem())->load($this->id);
         if (!$item) {
             return new Aphront404Response();
         }
     } else {
         $item = new PhabricatorDirectoryItem();
     }
     $e_name = true;
     $e_href = true;
     $errors = array();
     $request = $this->getRequest();
     if ($request->isFormPost()) {
         $item->setName($request->getStr('name'));
         $item->setHref($request->getStr('href'));
         $item->setDescription($request->getStr('description'));
         $item->setCategoryID($request->getStr('categoryID'));
         $item->setSequence($request->getStr('sequence'));
         if (!strlen($item->getName())) {
             $errors[] = 'Item name is required.';
             $e_name = 'Required';
         }
         if (!strlen($item->getHref())) {
             $errors[] = 'Item link is required.';
             $e_href = 'Required';
         }
         if (!$errors) {
             $item->save();
             return id(new AphrontRedirectResponse())->setURI('/directory/item/');
         }
     }
     $error_view = null;
     if ($errors) {
         $error_view = id(new AphrontErrorView())->setTitle('Form Errors')->setErrors($errors);
     }
     $form = new AphrontFormView();
     $form->setUser($request->getUser());
     if ($item->getID()) {
         $form->setAction('/directory/item/edit/' . $item->getID() . '/');
     } else {
         $form->setAction('/directory/item/edit/');
     }
     $categories = id(new PhabricatorDirectoryCategory())->loadAll();
     $category_map = mpull($categories, 'getName', 'getID');
     $form->appendChild(id(new AphrontFormTextControl())->setLabel('Name')->setName('name')->setValue($item->getName())->setError($e_name))->appendChild(id(new AphrontFormSelectControl())->setLabel('Category')->setName('categoryID')->setOptions($category_map)->setValue($item->getCategoryID()))->appendChild(id(new AphrontFormTextControl())->setLabel('Link')->setName('href')->setValue($item->getHref())->setError($e_href))->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Description')->setName('description')->setValue($item->getDescription()))->appendChild(id(new AphrontFormTextControl())->setLabel('Order')->setName('sequence')->setCaption('Items in a category are sorted by "order", then by name.')->setValue((int) $item->getSequence()))->appendChild(id(new AphrontFormSubmitControl())->setValue('Save')->addCancelButton('/directory/item/'));
     $panel = new AphrontPanelView();
     if ($item->getID()) {
         $panel->setHeader('Edit Directory Item');
     } else {
         $panel->setHeader('Create New Directory Item');
     }
     $panel->appendChild($form);
     $panel->setWidth(AphrontPanelView::WIDTH_FORM);
     return $this->buildStandardPageResponse(array($error_view, $panel), array('title' => 'Edit Directory Item'));
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:57,代码来源:PhabricatorDirectoryItemEditController.php

示例2: processRequest

 public function processRequest()
 {
     if ($this->id) {
         $category = id(new PhabricatorDirectoryCategory())->load($this->id);
         if (!$category) {
             return new Aphront404Response();
         }
     } else {
         $category = new PhabricatorDirectoryCategory();
     }
     $e_name = true;
     $errors = array();
     $request = $this->getRequest();
     if ($request->isFormPost()) {
         $category->setName($request->getStr('name'));
         $category->setSequence($request->getStr('sequence'));
         if (!strlen($category->getName())) {
             $errors[] = 'Category name is required.';
             $e_name = 'Required';
         }
         if (!$errors) {
             $category->save();
             return id(new AphrontRedirectResponse())->setURI('/directory/category/');
         }
     }
     $error_view = null;
     if ($errors) {
         $error_view = id(new AphrontErrorView())->setTitle('Form Errors')->setErrors($errors);
     }
     $form = new AphrontFormView();
     $form->setUser($request->getUser());
     if ($category->getID()) {
         $form->setAction('/directory/category/edit/' . $category->getID() . '/');
     } else {
         $form->setAction('/directory/category/edit/');
     }
     $categories = id(new PhabricatorDirectoryCategory())->loadAll();
     $category_map = mpull($categories, 'getName', 'getID');
     $form->appendChild(id(new AphrontFormTextControl())->setLabel('Name')->setName('name')->setValue($category->getName())->setError($e_name))->appendChild(id(new AphrontFormTextControl())->setLabel('Order')->setName('sequence')->setValue((int) $category->getSequence()))->appendChild(id(new AphrontFormSubmitControl())->setValue('Save')->addCancelButton('/directory/category/'));
     $panel = new AphrontPanelView();
     if ($category->getID()) {
         $panel->setHeader('Edit Directory Category');
     } else {
         $panel->setHeader('Create New Directory Category');
     }
     $panel->appendChild($form);
     $panel->setWidth(AphrontPanelView::WIDTH_FORM);
     return $this->buildStandardPageResponse(array($error_view, $panel), array('title' => 'Edit Directory Category'));
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:49,代码来源:PhabricatorDirectoryCategoryEditController.php

示例3: processRequest

 public function processRequest()
 {
     if ($this->id) {
         $list = id(new PhabricatorMetaMTAMailingList())->load($this->id);
         if (!$list) {
             return new Aphront404Response();
         }
     } else {
         $list = new PhabricatorMetaMTAMailingList();
     }
     $e_email = true;
     $errors = array();
     $request = $this->getRequest();
     if ($request->isFormPost()) {
         $list->setName($request->getStr('name'));
         $list->setEmail($request->getStr('email'));
         $list->setURI($request->getStr('uri'));
         if (!strlen($list->getEmail())) {
             $e_email = 'Required';
             $errors[] = 'Email is required.';
         }
         if (!$errors) {
             $list->save();
             return id(new AphrontRedirectResponse())->setURI('/mail/lists/');
         }
     }
     $error_view = null;
     if ($errors) {
         $error_view = id(new AphrontErrorView())->setTitle('Form Errors')->setErrors($errors);
     }
     $form = new AphrontFormView();
     $form->setUser($request->getUser());
     if ($list->getID()) {
         $form->setAction('/mail/lists/edit/' . $list->getID() . '/');
     } else {
         $form->setAction('/mail/lists/edit/');
     }
     $form->appendChild(id(new AphrontFormTextControl())->setLabel('Email')->setName('email')->setValue($list->getEmail())->setError($e_email))->appendChild(id(new AphrontFormTextControl())->setLabel('Name')->setName('name')->setValue($list->getName()))->appendChild(id(new AphrontFormTextControl())->setLabel('URI')->setName('uri')->setValue($list->getURI()))->appendChild(id(new AphrontFormStaticControl())->setLabel('ID')->setValue(nonempty($list->getID(), '-')))->appendChild(id(new AphrontFormStaticControl())->setLabel('PHID')->setValue(nonempty($list->getPHID(), '-')))->appendChild(id(new AphrontFormSubmitControl())->setValue('Save')->addCancelButton('/mail/lists/'));
     $panel = new AphrontPanelView();
     if ($list->getID()) {
         $panel->setHeader('Edit Mailing List');
     } else {
         $panel->setHeader('Create New Mailing List');
     }
     $panel->appendChild($form);
     $panel->setWidth(AphrontPanelView::WIDTH_FORM);
     return $this->buildStandardPageResponse(array($error_view, $panel), array('title' => 'Edit Mailing List'));
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:48,代码来源:PhabricatorMetaMTAMailingListEditController.php

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

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

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

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

示例8: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $file = id(new PhabricatorFile())->loadOneWhere('phid = %s', $this->phid);
     if (!$file) {
         return new Aphront404Response();
     }
     $author_child = null;
     if ($file->getAuthorPHID()) {
         $author = id(new PhabricatorUser())->loadOneWhere('phid = %s', $file->getAuthorPHID());
         if ($author) {
             $author_child = id(new AphrontFormStaticControl())->setLabel('Author')->setName('author')->setValue($author->getUserName());
         }
     }
     $form = new AphrontFormView();
     $submit = new AphrontFormSubmitControl();
     $form->setAction($file->getViewURI());
     if ($file->isViewableInBrowser()) {
         $submit->setValue('View File');
     } else {
         $submit->setValue('Download File');
     }
     if ($user->getPHID() == $file->getAuthorPHID() || $user->getIsAdmin()) {
         $submit->addCancelButton('/file/delete/' . $file->getID() . '/', 'Delete File');
     }
     $file_id = 'F' . $file->getID();
     $form->setUser($user);
     $form->appendChild(id(new AphrontFormStaticControl())->setLabel('Name')->setName('name')->setValue($file->getName()))->appendChild(id(new AphrontFormStaticControl())->setLabel('ID')->setName('id')->setValue($file_id)->setCaption('Download this file with: <tt>arc download ' . phutil_escape_html($file_id) . '</tt>'))->appendChild(id(new AphrontFormStaticControl())->setLabel('PHID')->setName('phid')->setValue($file->getPHID()))->appendChild($author_child)->appendChild(id(new AphrontFormStaticControl())->setLabel('Created')->setName('created')->setValue(phabricator_datetime($file->getDateCreated(), $user)))->appendChild(id(new AphrontFormStaticControl())->setLabel('Mime Type')->setName('mime')->setValue($file->getMimeType()))->appendChild(id(new AphrontFormStaticControl())->setLabel('Size')->setName('size')->setValue($file->getByteSize() . ' bytes'))->appendChild(id(new AphrontFormStaticControl())->setLabel('Engine')->setName('storageEngine')->setValue($file->getStorageEngine()))->appendChild(id(new AphrontFormStaticControl())->setLabel('Format')->setName('storageFormat')->setValue($file->getStorageFormat()))->appendChild(id(new AphrontFormStaticControl())->setLabel('Handle')->setName('storageHandle')->setValue($file->getStorageHandle()))->appendChild(id($submit));
     $panel = new AphrontPanelView();
     $panel->setHeader('File Info - ' . $file->getName());
     $panel->appendChild($form);
     $panel->setWidth(AphrontPanelView::WIDTH_FORM);
     $xform_panel = null;
     $transformations = id(new PhabricatorTransformedFile())->loadAllWhere('originalPHID = %s', $file->getPHID());
     if ($transformations) {
         $transformed_phids = mpull($transformations, 'getTransformedPHID');
         $transformed_files = id(new PhabricatorFile())->loadAllWhere('phid in (%Ls)', $transformed_phids);
         $transformed_map = mpull($transformed_files, null, 'getPHID');
         $rows = array();
         foreach ($transformations as $transformed) {
             $phid = $transformed->getTransformedPHID();
             $rows[] = array(phutil_escape_html($transformed->getTransform()), phutil_render_tag('a', array('href' => $transformed_map[$phid]->getBestURI()), $phid));
         }
         $table = new AphrontTableView($rows);
         $table->setHeaders(array('Transform', 'File'));
         $xform_panel = new AphrontPanelView();
         $xform_panel->appendChild($table);
         $xform_panel->setWidth(AphrontPanelView::WIDTH_FORM);
         $xform_panel->setHeader('Transformations');
     }
     return $this->buildStandardPageResponse(array($panel, $xform_panel), array('title' => 'File Info - ' . $file->getName()));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:53,代码来源:PhabricatorFileInfoController.php

示例9: prepareAuthForm

 private function prepareAuthForm(AphrontFormView $form)
 {
     $provider = $this->provider;
     $auth_uri = $provider->getAuthURI();
     $client_id = $provider->getClientID();
     $redirect_uri = $provider->getRedirectURI();
     $minimum_scope = $provider->getMinimumScope();
     $form->setAction($auth_uri)->setMethod('GET')->addHiddenInput('redirect_uri', $redirect_uri)->addHiddenInput('client_id', $client_id)->addHiddenInput('scope', $minimum_scope);
     foreach ($provider->getExtraAuthParameters() as $key => $value) {
         $form->addHiddenInput($key, $value);
     }
     return $form;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:13,代码来源:PhabricatorUserOAuthSettingsPanelController.php

示例10: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     if ($request->isFormPost()) {
         $mail = new PhabricatorMetaMTAMail();
         $mail->addTos($request->getArr('to'));
         $mail->addCCs($request->getArr('cc'));
         $mail->setSubject($request->getStr('subject'));
         $mail->setBody($request->getStr('body'));
         $files = $request->getArr('files');
         if ($files) {
             foreach ($files as $phid) {
                 $file = id(new PhabricatorFile())->loadOneWhere('phid = %s', $phid);
                 $mail->addAttachment(new PhabricatorMetaMTAAttachment($file->loadFileData(), $file->getName(), $file->getMimeType()));
             }
         }
         $mail->setFrom($request->getUser()->getPHID());
         $mail->setSimulatedFailureCount($request->getInt('failures'));
         $mail->setIsHTML($request->getInt('html'));
         $mail->setIsBulk($request->getInt('bulk'));
         $mail->setMailTags($request->getStrList('mailtags'));
         $mail->save();
         if ($request->getInt('immediately')) {
             $mail->sendNow();
         }
         return id(new AphrontRedirectResponse())->setURI('/mail/view/' . $mail->getID() . '/');
     }
     $failure_caption = "Enter a number to simulate that many consecutive send failures before " . "really attempting to deliver via the underlying MTA.";
     $doclink_href = PhabricatorEnv::getDoclink('article/Configuring_Outbound_Email.html');
     $doclink = phutil_render_tag('a', array('href' => $doclink_href, 'target' => '_blank'), 'Configuring Outbound Email');
     $instructions = '<p class="aphront-form-instructions">This form will send a normal ' . 'email using the settings you have configured for Phabricator. For more ' . 'information, see ' . $doclink . '.</p>';
     $adapter = PhabricatorEnv::getEnvConfig('metamta.mail-adapter');
     $warning = null;
     if ($adapter == 'PhabricatorMailImplementationTestAdapter') {
         $warning = new AphrontErrorView();
         $warning->setTitle('Email is Disabled');
         $warning->setSeverity(AphrontErrorView::SEVERITY_WARNING);
         $warning->appendChild('<p>This installation of Phabricator is currently set to use ' . '<tt>PhabricatorMailImplementationTestAdapter</tt> to deliver ' . 'outbound email. This completely disables outbound email! All ' . 'outbound email will be thrown in a deep, dark hole until you ' . 'configure a real adapter.</p>');
     }
     $panel_id = celerity_generate_unique_node_id();
     $form = new AphrontFormView();
     $form->setUser($request->getUser());
     $form->setAction('/mail/send/');
     $form->appendChild($instructions)->appendChild(id(new AphrontFormStaticControl())->setLabel('Configured Adapter')->setValue($adapter))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('To')->setName('to')->setDatasource('/typeahead/common/mailable/'))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('CC')->setName('cc')->setDatasource('/typeahead/common/mailable/'))->appendChild(id(new AphrontFormTextControl())->setLabel('Subject')->setName('subject'))->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Body')->setName('body'))->appendChild(id(new AphrontFormTextControl())->setLabel('Mail Tags')->setName('mailtags')->setCaption('Example: <tt>differential-cc, differential-comment</tt>'))->appendChild(id(new AphrontFormDragAndDropUploadControl())->setLabel('Attach Files')->setName('files')->setDragAndDropTarget($panel_id)->setActivatedClass('aphront-panel-view-drag-and-drop'))->appendChild(id(new AphrontFormTextControl())->setLabel('Simulate Failures')->setName('failures')->setCaption($failure_caption))->appendChild(id(new AphrontFormCheckboxControl())->setLabel('HTML')->addCheckbox('html', '1', 'Send as HTML email.'))->appendChild(id(new AphrontFormCheckboxControl())->setLabel('Bulk')->addCheckbox('bulk', '1', 'Send with bulk email headers.'))->appendChild(id(new AphrontFormCheckboxControl())->setLabel('Send Now')->addCheckbox('immediately', '1', 'Send immediately, not via MetaMTA background script.'))->appendChild(id(new AphrontFormSubmitControl())->setValue('Send Mail'));
     $panel = new AphrontPanelView();
     $panel->setHeader('Send Email');
     $panel->appendChild($form);
     $panel->setID($panel_id);
     $panel->setWidth(AphrontPanelView::WIDTH_WIDE);
     return $this->buildStandardPageResponse(array($warning, $panel), array('title' => 'Send Mail'));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:51,代码来源:PhabricatorMetaMTASendController.php

示例11: render

 public function render()
 {
     $user = $this->getUser();
     if (!$user) {
         throw new Exception("Call setUser() before render()!");
     }
     $form = new AphrontFormView();
     $form->setAction('/file/upload/');
     $form->setUser($user);
     $form->setEncType('multipart/form-data')->appendChild(id(new AphrontFormFileControl())->setLabel('File')->setName('file')->setError(true))->appendChild(id(new AphrontFormTextControl())->setLabel('Name')->setName('name')->setCaption('Optional file display name.'))->appendChild(id(new AphrontFormSubmitControl())->setValue('Upload')->addCancelButton('/file/'));
     $panel = new AphrontPanelView();
     $panel->setHeader('Upload File');
     $panel->appendChild($form);
     $panel->setWidth(AphrontPanelView::WIDTH_FULL);
     return $panel->render();
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:16,代码来源:PhabricatorFileUploadView.php

示例12: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     if ($request->isFormPost()) {
         $file = PhabricatorFile::newFromPHPUpload(idx($_FILES, 'file'), array('name' => $request->getStr('name'), 'authorPHID' => $user->getPHID()));
         return id(new AphrontRedirectResponse())->setURI($file->getBestURI());
     }
     $form = new AphrontFormView();
     $form->setAction('/file/upload/');
     $form->setUser($request->getUser());
     $form->setEncType('multipart/form-data')->appendChild(id(new AphrontFormFileControl())->setLabel('File')->setName('file')->setError(true))->appendChild(id(new AphrontFormTextControl())->setLabel('Name')->setName('name')->setCaption('Optional file display name.'))->appendChild(id(new AphrontFormSubmitControl())->setValue('Upload')->addCancelButton('/file/'));
     $panel = new AphrontPanelView();
     $panel->setHeader('Upload File');
     $panel->appendChild($form);
     $panel->setWidth(AphrontPanelView::WIDTH_FORM);
     return $this->buildStandardPageResponse(array($panel), array('title' => 'Upload File'));
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:18,代码来源:PhabricatorFileUploadController.php

示例13: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $mail = id(new PhabricatorMetaMTAMail())->load($this->id);
     if (!$mail) {
         return new Aphront404Response();
     }
     $status = PhabricatorMetaMTAMail::getReadableStatus($mail->getStatus());
     $form = new AphrontFormView();
     $form->setUser($request->getUser());
     $form->setAction('/mail/send/');
     $form->appendChild(id(new AphrontFormStaticControl())->setLabel('Subject')->setValue($mail->getSubject()))->appendChild(id(new AphrontFormStaticControl())->setLabel('Created')->setValue(phabricator_datetime($mail->getDateCreated(), $user)))->appendChild(id(new AphrontFormStaticControl())->setLabel('Status')->setValue($status))->appendChild(id(new AphrontFormStaticControl())->setLabel('Message')->setValue($mail->getMessage()))->appendChild(id(new AphrontFormStaticControl())->setLabel('Related PHID')->setValue($mail->getRelatedPHID()))->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Parameters')->setValue(json_encode($mail->getParameters())))->appendChild(id(new AphrontFormSubmitControl())->addCancelButton('/mail/', 'Done'));
     $panel = new AphrontPanelView();
     $panel->setHeader('View Email');
     $panel->appendChild($form);
     $panel->setWidth(AphrontPanelView::WIDTH_WIDE);
     return $this->buildStandardPageResponse($panel, array('title' => 'View Mail'));
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:19,代码来源:PhabricatorMetaMTAViewController.php

示例14: showForm

 private function showForm($errors = null, $title = "", $content = "", $id = null)
 {
     require_celerity_resource('ponder-core-view-css');
     require_celerity_resource('phabricator-remarkup-css');
     require_celerity_resource('ponder-post-css');
     $request = $this->getRequest();
     $user = $request->getUser();
     $error_view = null;
     if ($errors) {
         $error_view = id(new AphrontErrorView())->setTitle('Form Errors')->setErrors($errors);
     }
     $form = new AphrontFormView();
     $form->setUser($user);
     $form->setAction('/ponder/question/ask/');
     $form->appendChild(id(new AphrontFormTextControl())->setLabel('Title')->setName('title')->setValue($title))->appendChild(id(new AphrontFormTextAreaControl())->setName('content')->setID('content')->setValue($content)->setLabel("Question")->setCaption(phutil_render_tag('a', array('href' => PhabricatorEnv::getDoclink('article/Remarkup_Reference.html'), 'tabindex' => '-1', 'target' => '_blank'), "Formatting Reference")))->appendChild(id(new AphrontFormSubmitControl())->setValue('Ask Away!'));
     $panel = id(new AphrontPanelView())->addClass("ponder-panel")->setHeader("Your Question:")->appendChild($error_view)->appendChild($form);
     $panel->appendChild('<div class="aphront-panel-flush">' . '<div id="question-preview">' . '<span class="aphront-panel-preview-loading-text">' . 'Loading question preview...' . '</span>' . '</div>' . '</div>');
     Javelin::initBehavior('ponder-feedback-preview', array('uri' => '/ponder/question/preview/', 'content' => 'content', 'preview' => 'question-preview', 'question_id' => null));
     return $this->buildStandardPageResponse(array($panel), array('title' => 'Ask a Question'));
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:20,代码来源:PonderQuestionAskController.php

示例15: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     if ($request->isFormPost()) {
         $parser = new ArcanistDiffParser();
         $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();
     $form->setAction('/differential/diff/create/')->setUser($request->getUser())->appendChild('<p class="aphront-form-instructions">The best way to create a ' . 'Differential diff is by using <strong>Arcanist</strong>, but you ' . 'can also just paste a diff (e.g., from <tt>svn diff</tt> or ' . '<tt>git diff</tt>) into this box if you really want.</p>')->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Raw Diff')->setName('diff')->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL))->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:nguyennamtien,项目名称:phabricator,代码行数:23,代码来源:DifferentialDiffCreateController.php


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