diff --git a/src/applications/phame/editor/PhameBlogEditEngine.php b/src/applications/phame/editor/PhameBlogEditEngine.php index 6d6c0a9f77..9b6be308c4 100644 --- a/src/applications/phame/editor/PhameBlogEditEngine.php +++ b/src/applications/phame/editor/PhameBlogEditEngine.php @@ -1,137 +1,138 @@ getViewer()); } protected function newObjectQuery() { return id(new PhameBlogQuery()) ->needProfileImage(true); } protected function getObjectCreateTitleText($object) { return pht('Create New Blog'); } protected function getObjectEditTitleText($object) { return pht('Edit %s', $object->getName()); } protected function getObjectEditShortText($object) { return $object->getName(); } protected function getObjectCreateShortText() { return pht('Create Blog'); } protected function getObjectName() { return pht('Blog'); } protected function getObjectCreateCancelURI($object) { return $this->getApplication()->getApplicationURI('blog/'); } protected function getEditorURI() { return $this->getApplication()->getApplicationURI('blog/edit/'); } protected function getObjectViewURI($object) { return $object->getManageURI(); } protected function getCreateNewObjectPolicy() { return $this->getApplication()->getPolicy( PhameBlogCreateCapability::CAPABILITY); } protected function buildCustomEditFields($object) { return array( id(new PhabricatorTextEditField()) ->setKey('name') ->setLabel(pht('Name')) ->setDescription(pht('Blog name.')) ->setConduitDescription(pht('Retitle the blog.')) ->setConduitTypeDescription(pht('New blog title.')) ->setTransactionType(PhameBlogNameTransaction::TRANSACTIONTYPE) + ->setIsRequired(true) ->setValue($object->getName()), id(new PhabricatorTextEditField()) ->setKey('subtitle') ->setLabel(pht('Subtitle')) ->setDescription(pht('Blog subtitle.')) ->setConduitDescription(pht('Change the blog subtitle.')) ->setConduitTypeDescription(pht('New blog subtitle.')) ->setTransactionType(PhameBlogSubtitleTransaction::TRANSACTIONTYPE) ->setValue($object->getSubtitle()), id(new PhabricatorRemarkupEditField()) ->setKey('description') ->setLabel(pht('Description')) ->setDescription(pht('Blog description.')) ->setConduitDescription(pht('Change the blog description.')) ->setConduitTypeDescription(pht('New blog description.')) ->setTransactionType(PhameBlogDescriptionTransaction::TRANSACTIONTYPE) ->setValue($object->getDescription()), id(new PhabricatorTextEditField()) ->setKey('domainFullURI') ->setLabel(pht('Full Domain URI')) ->setControlInstructions(pht('Set Full Domain URI if you plan to '. 'serve this blog on another hosted domain. Parent Site Name and '. 'Parent Site URI are optional but helpful since they provide '. 'a link from the blog back to your parent site.')) ->setDescription(pht('Blog full domain URI.')) ->setConduitDescription(pht('Change the blog full domain URI.')) ->setConduitTypeDescription(pht('New blog full domain URI.')) ->setValue($object->getDomainFullURI()) ->setTransactionType(PhameBlogFullDomainTransaction::TRANSACTIONTYPE), id(new PhabricatorTextEditField()) ->setKey('parentSite') ->setLabel(pht('Parent Site Name')) ->setDescription(pht('Blog parent site name.')) ->setConduitDescription(pht('Change the blog parent site name.')) ->setConduitTypeDescription(pht('New blog parent site name.')) ->setValue($object->getParentSite()) ->setTransactionType(PhameBlogParentSiteTransaction::TRANSACTIONTYPE), id(new PhabricatorTextEditField()) ->setKey('parentDomain') ->setLabel(pht('Parent Site URI')) ->setDescription(pht('Blog parent domain name.')) ->setConduitDescription(pht('Change the blog parent domain.')) ->setConduitTypeDescription(pht('New blog parent domain.')) ->setValue($object->getParentDomain()) ->setTransactionType(PhameBlogParentDomainTransaction::TRANSACTIONTYPE), id(new PhabricatorSelectEditField()) ->setKey('status') ->setLabel(pht('Status')) ->setTransactionType(PhameBlogStatusTransaction::TRANSACTIONTYPE) ->setIsConduitOnly(true) ->setOptions(PhameBlog::getStatusNameMap()) ->setDescription(pht('Active or archived status.')) ->setConduitDescription(pht('Active or archive the blog.')) ->setConduitTypeDescription(pht('New blog status constant.')) ->setValue($object->getStatus()), ); } } diff --git a/src/applications/phame/editor/PhamePostEditEngine.php b/src/applications/phame/editor/PhamePostEditEngine.php index af1b1091d1..04738beb80 100644 --- a/src/applications/phame/editor/PhamePostEditEngine.php +++ b/src/applications/phame/editor/PhamePostEditEngine.php @@ -1,134 +1,135 @@ blog = $blog; return $this; } public function getEngineApplicationClass() { return 'PhabricatorPhameApplication'; } protected function newEditableObject() { $viewer = $this->getViewer(); if ($this->blog) { $blog = $this->blog; } else { $blog = PhameBlog::initializeNewBlog($viewer); } return PhamePost::initializePost($viewer, $blog); } protected function newObjectQuery() { return new PhamePostQuery(); } protected function getObjectCreateTitleText($object) { return pht('Create New Post'); } protected function getObjectEditTitleText($object) { return pht('Edit %s', $object->getTitle()); } protected function getObjectEditShortText($object) { return $object->getTitle(); } protected function getObjectCreateShortText() { return pht('Create Post'); } protected function getObjectName() { return pht('Post'); } protected function getObjectViewURI($object) { return $object->getViewURI(); } protected function getEditorURI() { return $this->getApplication()->getApplicationURI('post/edit/'); } protected function buildCustomEditFields($object) { $blog_phid = $object->getBlog()->getPHID(); return array( id(new PhabricatorHandlesEditField()) ->setKey('blog') ->setLabel(pht('Blog')) ->setDescription(pht('Blog to publish this post to.')) ->setConduitDescription( pht('Choose a blog to create a post on (or move a post to).')) ->setConduitTypeDescription(pht('PHID of the blog.')) ->setAliases(array('blogPHID')) ->setTransactionType(PhamePostBlogTransaction::TRANSACTIONTYPE) ->setHandleParameterType(new AphrontPHIDListHTTPParameterType()) ->setSingleValue($blog_phid) ->setIsReorderable(false) ->setIsDefaultable(false) ->setIsLockable(false) ->setIsLocked(true), id(new PhabricatorTextEditField()) ->setKey('title') ->setLabel(pht('Title')) ->setDescription(pht('Post title.')) ->setConduitDescription(pht('Retitle the post.')) ->setConduitTypeDescription(pht('New post title.')) ->setTransactionType(PhamePostTitleTransaction::TRANSACTIONTYPE) + ->setIsRequired(true) ->setValue($object->getTitle()), id(new PhabricatorTextEditField()) ->setKey('subtitle') ->setLabel(pht('Subtitle')) ->setDescription(pht('Post subtitle.')) ->setConduitDescription(pht('Change the post subtitle.')) ->setConduitTypeDescription(pht('New post subtitle.')) ->setTransactionType(PhamePostSubtitleTransaction::TRANSACTIONTYPE) ->setValue($object->getSubtitle()), id(new PhabricatorSelectEditField()) ->setKey('visibility') ->setLabel(pht('Visibility')) ->setDescription(pht('Post visibility.')) ->setConduitDescription(pht('Change post visibility.')) ->setConduitTypeDescription(pht('New post visibility constant.')) ->setTransactionType(PhamePostVisibilityTransaction::TRANSACTIONTYPE) ->setValue($object->getVisibility()) ->setOptions(PhameConstants::getPhamePostStatusMap()), id(new PhabricatorRemarkupEditField()) ->setKey('body') ->setLabel(pht('Body')) ->setDescription(pht('Post body.')) ->setConduitDescription(pht('Change post body.')) ->setConduitTypeDescription(pht('New post body.')) ->setTransactionType(PhamePostBodyTransaction::TRANSACTIONTYPE) ->setValue($object->getBody()) ->setPreviewPanel( id(new PHUIRemarkupPreviewPanel()) ->setHeader(pht('Blog Post')) ->setPreviewType(PHUIRemarkupPreviewPanel::DOCUMENT)), ); } } diff --git a/src/applications/phame/storage/PhamePostTransaction.php b/src/applications/phame/storage/PhamePostTransaction.php index 1c259911f3..6adc640b67 100644 --- a/src/applications/phame/storage/PhamePostTransaction.php +++ b/src/applications/phame/storage/PhamePostTransaction.php @@ -1,49 +1,49 @@ getTransactionType()) { case PhabricatorTransactions::TYPE_COMMENT: $tags[] = self::MAILTAG_COMMENT; break; case PhabricatorTransactions::TYPE_SUBSCRIBERS: $tags[] = self::MAILTAG_SUBSCRIBERS; break; - case self::TYPE_TITLE: - case self::TYPE_SUBTITLE: - case self::TYPE_BODY: + case PhamePostTitleTransaction::TRANSACTIONTYPE: + case PhamePostSubtitleTransaction::TRANSACTIONTYPE: + case PhamePostBodyTransaction::TRANSACTIONTYPE: $tags[] = self::MAILTAG_CONTENT; break; default: $tags[] = self::MAILTAG_OTHER; break; } return $tags; } }