Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phame/controller/blog/PhameBlogEditController.php
| Show All 40 Lines | if ($id) { | ||||
| $page_title = pht('Create Blog'); | $page_title = pht('Create Blog'); | ||||
| $cancel_uri = $this->getApplicationURI(); | $cancel_uri = $this->getApplicationURI(); | ||||
| $v_projects = array(); | $v_projects = array(); | ||||
| $v_cc = array(); | $v_cc = array(); | ||||
| } | } | ||||
| $name = $blog->getName(); | $name = $blog->getName(); | ||||
| $description = $blog->getDescription(); | $description = $blog->getDescription(); | ||||
| $custom_domain = $blog->getDomain(); | $custom_domain = $blog->getDomain(); | ||||
| $skin = $blog->getSkin(); | |||||
| $can_view = $blog->getViewPolicy(); | $can_view = $blog->getViewPolicy(); | ||||
| $can_edit = $blog->getEditPolicy(); | $can_edit = $blog->getEditPolicy(); | ||||
| $e_name = true; | $e_name = true; | ||||
| $e_custom_domain = null; | $e_custom_domain = null; | ||||
| $e_view_policy = null; | $e_view_policy = null; | ||||
| $validation_exception = null; | $validation_exception = null; | ||||
| if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
| $name = $request->getStr('name'); | $name = $request->getStr('name'); | ||||
| $description = $request->getStr('description'); | $description = $request->getStr('description'); | ||||
| $custom_domain = nonempty($request->getStr('custom_domain'), null); | $custom_domain = nonempty($request->getStr('custom_domain'), null); | ||||
| $skin = $request->getStr('skin'); | |||||
| $can_view = $request->getStr('can_view'); | $can_view = $request->getStr('can_view'); | ||||
| $can_edit = $request->getStr('can_edit'); | $can_edit = $request->getStr('can_edit'); | ||||
| $v_projects = $request->getArr('projects'); | $v_projects = $request->getArr('projects'); | ||||
| $v_cc = $request->getArr('cc'); | $v_cc = $request->getArr('cc'); | ||||
| $xactions = array( | $xactions = array( | ||||
| id(new PhameBlogTransaction()) | id(new PhameBlogTransaction()) | ||||
| ->setTransactionType(PhameBlogTransaction::TYPE_NAME) | ->setTransactionType(PhameBlogTransaction::TYPE_NAME) | ||||
| ->setNewValue($name), | ->setNewValue($name), | ||||
| id(new PhameBlogTransaction()) | id(new PhameBlogTransaction()) | ||||
| ->setTransactionType(PhameBlogTransaction::TYPE_DESCRIPTION) | ->setTransactionType(PhameBlogTransaction::TYPE_DESCRIPTION) | ||||
| ->setNewValue($description), | ->setNewValue($description), | ||||
| id(new PhameBlogTransaction()) | id(new PhameBlogTransaction()) | ||||
| ->setTransactionType(PhameBlogTransaction::TYPE_DOMAIN) | ->setTransactionType(PhameBlogTransaction::TYPE_DOMAIN) | ||||
| ->setNewValue($custom_domain), | ->setNewValue($custom_domain), | ||||
| id(new PhameBlogTransaction()) | id(new PhameBlogTransaction()) | ||||
| ->setTransactionType(PhameBlogTransaction::TYPE_SKIN) | |||||
| ->setNewValue($skin), | |||||
| id(new PhameBlogTransaction()) | |||||
| ->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY) | ->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY) | ||||
| ->setNewValue($can_view), | ->setNewValue($can_view), | ||||
| id(new PhameBlogTransaction()) | id(new PhameBlogTransaction()) | ||||
| ->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY) | ->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY) | ||||
| ->setNewValue($can_edit), | ->setNewValue($can_edit), | ||||
| id(new PhameBlogTransaction()) | id(new PhameBlogTransaction()) | ||||
| ->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS) | ->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS) | ||||
| ->setNewValue(array('=' => $v_cc)), | ->setNewValue(array('=' => $v_cc)), | ||||
| Show All 26 Lines | if ($request->isFormPost()) { | ||||
| } | } | ||||
| } | } | ||||
| $policies = id(new PhabricatorPolicyQuery()) | $policies = id(new PhabricatorPolicyQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->setObject($blog) | ->setObject($blog) | ||||
| ->execute(); | ->execute(); | ||||
| $skins = PhameSkinSpecification::loadAllSkinSpecifications(); | |||||
| $skins = mpull($skins, 'getName'); | |||||
| $form = id(new AphrontFormView()) | $form = id(new AphrontFormView()) | ||||
| ->setUser($viewer) | ->setUser($viewer) | ||||
| ->appendChild( | ->appendChild( | ||||
| id(new AphrontFormTextControl()) | id(new AphrontFormTextControl()) | ||||
| ->setLabel(pht('Name')) | ->setLabel(pht('Name')) | ||||
| ->setName('name') | ->setName('name') | ||||
| ->setValue($name) | ->setValue($name) | ||||
| ->setID('blog-name') | ->setID('blog-name') | ||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | $form = id(new AphrontFormView()) | ||||
| id(new AphrontFormTextControl()) | id(new AphrontFormTextControl()) | ||||
| ->setLabel(pht('Custom Domain')) | ->setLabel(pht('Custom Domain')) | ||||
| ->setName('custom_domain') | ->setName('custom_domain') | ||||
| ->setValue($custom_domain) | ->setValue($custom_domain) | ||||
| ->setCaption( | ->setCaption( | ||||
| pht('Must include at least one dot (.), e.g. %s', 'blog.example.com')) | pht('Must include at least one dot (.), e.g. %s', 'blog.example.com')) | ||||
| ->setError($e_custom_domain)) | ->setError($e_custom_domain)) | ||||
| ->appendChild( | ->appendChild( | ||||
| id(new AphrontFormSelectControl()) | |||||
| ->setLabel(pht('Skin')) | |||||
| ->setName('skin') | |||||
| ->setValue($skin) | |||||
| ->setOptions($skins)) | |||||
| ->appendChild( | |||||
| id(new AphrontFormSubmitControl()) | id(new AphrontFormSubmitControl()) | ||||
| ->addCancelButton($cancel_uri) | ->addCancelButton($cancel_uri) | ||||
| ->setValue($submit_button)); | ->setValue($submit_button)); | ||||
| $form_box = id(new PHUIObjectBoxView()) | $form_box = id(new PHUIObjectBoxView()) | ||||
| ->setHeaderText($page_title) | ->setHeaderText($page_title) | ||||
| ->setValidationException($validation_exception) | ->setValidationException($validation_exception) | ||||
| ->setForm($form); | ->setForm($form); | ||||
| Show All 14 Lines | |||||