Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13983532
D16150.id38860.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
11 KB
Referenced Files
None
Subscribers
None
D16150.id38860.diff
View Options
diff --git a/resources/sql/autopatches/20160620.phame.blog.parentdomain.2.sql b/resources/sql/autopatches/20160620.phame.blog.parentdomain.2.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20160620.phame.blog.parentdomain.2.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_phame.phame_blog
+ ADD parentDomain VARCHAR(128) NOT NULL COLLATE {$COLLATE_TEXT};
diff --git a/resources/sql/autopatches/20160620.phame.blog.parentsite.1.sql b/resources/sql/autopatches/20160620.phame.blog.parentsite.1.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20160620.phame.blog.parentsite.1.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_phame.phame_blog
+ ADD parentSite VARCHAR(128) NOT NULL COLLATE {$COLLATE_TEXT};
diff --git a/src/applications/phame/controller/PhameLiveController.php b/src/applications/phame/controller/PhameLiveController.php
--- a/src/applications/phame/controller/PhameLiveController.php
+++ b/src/applications/phame/controller/PhameLiveController.php
@@ -159,6 +159,12 @@
// "Blogs" crumb into the crumbs list.
if ($is_external) {
$crumbs = new PHUICrumbsView();
+ // Link back to parent site
+ if ($blog->getParentSite() && $blog->getParentDomain()) {
+ $crumbs->addTextCrumb(
+ $blog->getParentSite(),
+ $blog->getExternalParentURI());
+ }
} else {
$crumbs = parent::buildApplicationCrumbs();
$crumbs->addTextCrumb(
diff --git a/src/applications/phame/controller/blog/PhameBlogManageController.php b/src/applications/phame/controller/blog/PhameBlogManageController.php
--- a/src/applications/phame/controller/blog/PhameBlogManageController.php
+++ b/src/applications/phame/controller/blog/PhameBlogManageController.php
@@ -95,8 +95,7 @@
Javelin::initBehavior('phabricator-tooltips');
$properties = id(new PHUIPropertyListView())
- ->setUser($viewer)
- ->setObject($blog);
+ ->setUser($viewer);
$domain = $blog->getDomain();
if (!$domain) {
@@ -105,6 +104,20 @@
$properties->addProperty(pht('Domain'), $domain);
+ $parent_site = $blog->getParentSite();
+ if (!$parent_site) {
+ $parent_site = phutil_tag('em', array(), pht('No parent site'));
+ }
+
+ $properties->addProperty(pht('Parent Site'), $parent_site);
+
+ $parent_domain = $blog->getParentDomain();
+ if (!$parent_domain) {
+ $parent_domain = phutil_tag('em', array(), pht('No parent domain'));
+ }
+
+ $properties->addProperty(pht('Parent Domain'), $parent_domain);
+
$feed_uri = PhabricatorEnv::getProductionURI(
$this->getApplicationURI('blog/feed/'.$blog->getID().'/'));
$properties->addProperty(
@@ -133,8 +146,6 @@
->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION)
->process();
- $properties->invokeWillRenderEvent();
-
$description = $blog->getDescription();
if (strlen($description)) {
$description = new PHUIRemarkupView($viewer, $description);
@@ -150,7 +161,7 @@
private function buildCurtain(PhameBlog $blog) {
$viewer = $this->getViewer();
- $curtain = $this->newCurtainView($viewer);
+ $curtain = $this->newCurtainView($blog);
$actions = id(new PhabricatorActionListView())
->setObject($blog)
diff --git a/src/applications/phame/editor/PhameBlogEditEngine.php b/src/applications/phame/editor/PhameBlogEditEngine.php
--- a/src/applications/phame/editor/PhameBlogEditEngine.php
+++ b/src/applications/phame/editor/PhameBlogEditEngine.php
@@ -101,6 +101,22 @@
->setConduitTypeDescription(pht('New blog domain.'))
->setValue($object->getDomain())
->setTransactionType(PhameBlogTransaction::TYPE_DOMAIN),
+ id(new PhabricatorTextEditField())
+ ->setKey('parentSite')
+ ->setLabel(pht('Parent Site'))
+ ->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(PhameBlogTransaction::TYPE_PARENTSITE),
+ id(new PhabricatorTextEditField())
+ ->setKey('parentDomain')
+ ->setLabel(pht('Parent Domain'))
+ ->setDescription(pht('Blog parent domain name.'))
+ ->setConduitDescription(pht('Change the blog parent domain.'))
+ ->setConduitTypeDescription(pht('New blog parent domain.'))
+ ->setValue($object->getParentDomain())
+ ->setTransactionType(PhameBlogTransaction::TYPE_PARENTDOMAIN),
id(new PhabricatorSelectEditField())
->setKey('status')
->setLabel(pht('Status'))
diff --git a/src/applications/phame/editor/PhameBlogEditor.php b/src/applications/phame/editor/PhameBlogEditor.php
--- a/src/applications/phame/editor/PhameBlogEditor.php
+++ b/src/applications/phame/editor/PhameBlogEditor.php
@@ -18,6 +18,8 @@
$types[] = PhameBlogTransaction::TYPE_SUBTITLE;
$types[] = PhameBlogTransaction::TYPE_DESCRIPTION;
$types[] = PhameBlogTransaction::TYPE_DOMAIN;
+ $types[] = PhameBlogTransaction::TYPE_PARENTSITE;
+ $types[] = PhameBlogTransaction::TYPE_PARENTDOMAIN;
$types[] = PhameBlogTransaction::TYPE_STATUS;
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
@@ -38,6 +40,10 @@
return $object->getDescription();
case PhameBlogTransaction::TYPE_DOMAIN:
return $object->getDomain();
+ case PhameBlogTransaction::TYPE_PARENTSITE:
+ return $object->getParentSite();
+ case PhameBlogTransaction::TYPE_PARENTDOMAIN:
+ return $object->getParentDomain();
case PhameBlogTransaction::TYPE_STATUS:
return $object->getStatus();
}
@@ -52,6 +58,8 @@
case PhameBlogTransaction::TYPE_SUBTITLE:
case PhameBlogTransaction::TYPE_DESCRIPTION:
case PhameBlogTransaction::TYPE_STATUS:
+ case PhameBlogTransaction::TYPE_PARENTSITE:
+ case PhameBlogTransaction::TYPE_PARENTDOMAIN:
return $xaction->getNewValue();
case PhameBlogTransaction::TYPE_DOMAIN:
$domain = $xaction->getNewValue();
@@ -77,6 +85,10 @@
return $object->setDomain($xaction->getNewValue());
case PhameBlogTransaction::TYPE_STATUS:
return $object->setStatus($xaction->getNewValue());
+ case PhameBlogTransaction::TYPE_PARENTSITE:
+ return $object->setParentSite($xaction->getNewValue());
+ case PhameBlogTransaction::TYPE_PARENTDOMAIN:
+ return $object->setParentDomain($xaction->getNewValue());
}
return parent::applyCustomInternalTransaction($object, $xaction);
@@ -91,6 +103,8 @@
case PhameBlogTransaction::TYPE_SUBTITLE:
case PhameBlogTransaction::TYPE_DESCRIPTION:
case PhameBlogTransaction::TYPE_DOMAIN:
+ case PhameBlogTransaction::TYPE_PARENTSITE:
+ case PhameBlogTransaction::TYPE_PARENTDOMAIN:
case PhameBlogTransaction::TYPE_STATUS:
return;
}
@@ -123,6 +137,25 @@
$errors[] = $error;
}
break;
+ case PhameBlogTransaction::TYPE_PARENTDOMAIN:
+ if (!$xactions) {
+ continue;
+ }
+ $parent_domain = last($xactions)->getNewValue();
+ if (empty($parent_domain)) {
+ continue;
+ }
+ try {
+ PhabricatorEnv::requireValidRemoteURIForLink($parent_domain);
+ } catch (Exception $ex) {
+ $error = new PhabricatorApplicationTransactionValidationError(
+ $type,
+ pht('Invalid URI'),
+ pht('Parent Domain must be set to a valid Remote URI.'),
+ nonempty(last($xactions), null));
+ $errors[] = $error;
+ }
+ break;
case PhameBlogTransaction::TYPE_DOMAIN:
if (!$xactions) {
continue;
diff --git a/src/applications/phame/storage/PhameBlog.php b/src/applications/phame/storage/PhameBlog.php
--- a/src/applications/phame/storage/PhameBlog.php
+++ b/src/applications/phame/storage/PhameBlog.php
@@ -18,6 +18,8 @@
protected $subtitle;
protected $description;
protected $domain;
+ protected $parentSite;
+ protected $parentDomain;
protected $configData;
protected $creatorPHID;
protected $viewPolicy;
@@ -44,6 +46,8 @@
'subtitle' => 'text64',
'description' => 'text',
'domain' => 'text128?',
+ 'parentSite' => 'text128',
+ 'parentDomain' => 'text128',
'status' => 'text32',
'mailKey' => 'bytes20',
'profileImagePHID' => 'phid?',
@@ -187,11 +191,16 @@
}
public function getExternalLiveURI() {
- $domain = $this->getDomain();
$uri = new PhutilURI('http://'.$this->getDomain().'/');
return (string)$uri;
}
+ public function getExternalParentURI() {
+ $uri = $this->getParentDomain();
+ PhabricatorEnv::requireValidRemoteURIForLink($uri);
+ return (string)$uri;
+ }
+
public function getInternalLiveURI() {
return '/phame/live/'.$this->getID().'/';
}
diff --git a/src/applications/phame/storage/PhameBlogTransaction.php b/src/applications/phame/storage/PhameBlogTransaction.php
--- a/src/applications/phame/storage/PhameBlogTransaction.php
+++ b/src/applications/phame/storage/PhameBlogTransaction.php
@@ -8,6 +8,8 @@
const TYPE_DESCRIPTION = 'phame.blog.description';
const TYPE_DOMAIN = 'phame.blog.domain';
const TYPE_STATUS = 'phame.blog.status';
+ const TYPE_PARENTSITE = 'phame.blog.parent.site';
+ const TYPE_PARENTDOMAIN = 'phame.blog.parent.domain';
const MAILTAG_DETAILS = 'phame-blog-details';
const MAILTAG_SUBSCRIBERS = 'phame-blog-subscribers';
@@ -65,7 +67,7 @@
switch ($this->getTransactionType()) {
case self::TYPE_STATUS:
if ($new == PhameBlog::STATUS_ARCHIVED) {
- return 'red';
+ return 'violet';
} else {
return 'green';
}
@@ -84,6 +86,8 @@
case self::TYPE_SUBTITLE:
case self::TYPE_DESCRIPTION:
case self::TYPE_DOMAIN:
+ case self::TYPE_PARENTSITE:
+ case self::TYPE_PARENTDOMAIN:
$tags[] = self::MAILTAG_DETAILS;
break;
default:
@@ -142,6 +146,32 @@
$this->renderHandleLink($author_phid),
$new);
break;
+ case self::TYPE_PARENTSITE:
+ if ($old === null) {
+ return pht(
+ '%s set this blog\'s parent site to "%s".',
+ $this->renderHandleLink($author_phid),
+ $new);
+ } else {
+ return pht(
+ '%s updated the blog\'s parent site to "%s".',
+ $this->renderHandleLink($author_phid),
+ $new);
+ }
+ break;
+ case self::TYPE_PARENTDOMAIN:
+ if ($old === null) {
+ return pht(
+ '%s set this blog\'s parent domain to "%s".',
+ $this->renderHandleLink($author_phid),
+ $new);
+ } else {
+ return pht(
+ '%s updated the blog\'s parent domain to "%s".',
+ $this->renderHandleLink($author_phid),
+ $new);
+ }
+ break;
case self::TYPE_STATUS:
switch ($new) {
case PhameBlog::STATUS_ACTIVE:
@@ -206,6 +236,18 @@
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
break;
+ case self::TYPE_PARENTSITE:
+ return pht(
+ '%s updated the parent site for %s.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid));
+ break;
+ case self::TYPE_PARENTDOMAIN:
+ return pht(
+ '%s updated the parent domain for %s.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid));
+ break;
case self::TYPE_STATUS:
switch ($new) {
case PhameBlog::STATUS_ACTIVE:
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Oct 21, 7:06 AM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6727214
Default Alt Text
D16150.id38860.diff (11 KB)
Attached To
Mode
D16150: Add ability to link back to parent site in external phame blogs
Attached
Detach File
Event Timeline
Log In to Comment