Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phame/controller/blog/PhameBlogEditController.php
| Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | if ($id) { | ||||
| $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(); | $skin = $blog->getSkin(); | ||||
| $can_view = $blog->getViewPolicy(); | $can_view = $blog->getViewPolicy(); | ||||
| $can_edit = $blog->getEditPolicy(); | $can_edit = $blog->getEditPolicy(); | ||||
| $can_join = $blog->getJoinPolicy(); | |||||
| $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'); | $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'); | ||||
| $can_join = $request->getStr('can_join'); | |||||
| $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) | ->setTransactionType(PhameBlogTransaction::TYPE_SKIN) | ||||
| ->setNewValue($skin), | ->setNewValue($skin), | ||||
| id(new PhameBlogTransaction()) | 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_JOIN_POLICY) | |||||
| ->setNewValue($can_join), | |||||
| id(new PhameBlogTransaction()) | |||||
| ->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS) | ->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS) | ||||
| ->setNewValue(array('=' => $v_cc)), | ->setNewValue(array('=' => $v_cc)), | ||||
| ); | ); | ||||
| $proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; | $proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; | ||||
| $xactions[] = id(new PhameBlogTransaction()) | $xactions[] = id(new PhameBlogTransaction()) | ||||
| ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) | ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) | ||||
| ->setMetadataValue('edge:type', $proj_edge_type) | ->setMetadataValue('edge:type', $proj_edge_type) | ||||
| ▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | $form = id(new AphrontFormView()) | ||||
| ->appendChild( | ->appendChild( | ||||
| id(new AphrontFormPolicyControl()) | id(new AphrontFormPolicyControl()) | ||||
| ->setUser($viewer) | ->setUser($viewer) | ||||
| ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) | ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) | ||||
| ->setPolicyObject($blog) | ->setPolicyObject($blog) | ||||
| ->setPolicies($policies) | ->setPolicies($policies) | ||||
| ->setValue($can_edit) | ->setValue($can_edit) | ||||
| ->setName('can_edit')) | ->setName('can_edit')) | ||||
| ->appendChild( | |||||
| id(new AphrontFormPolicyControl()) | |||||
| ->setUser($viewer) | |||||
| ->setCapability(PhabricatorPolicyCapability::CAN_JOIN) | |||||
| ->setPolicyObject($blog) | |||||
| ->setPolicies($policies) | |||||
| ->setValue($can_join) | |||||
| ->setName('can_join')) | |||||
| ->appendControl( | ->appendControl( | ||||
| id(new AphrontFormTokenizerControl()) | id(new AphrontFormTokenizerControl()) | ||||
| ->setLabel(pht('Projects')) | ->setLabel(pht('Projects')) | ||||
| ->setName('projects') | ->setName('projects') | ||||
| ->setValue($v_projects) | ->setValue($v_projects) | ||||
| ->setDatasource(new PhabricatorProjectDatasource())) | ->setDatasource(new PhabricatorProjectDatasource())) | ||||
| ->appendChild( | ->appendChild( | ||||
| id(new AphrontFormTextControl()) | id(new AphrontFormTextControl()) | ||||
| Show All 35 Lines | |||||