Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phame/editor/PhameBlogEditor.php
Show All 15 Lines | public function getTransactionTypes() { | ||||
$types[] = PhameBlogTransaction::TYPE_NAME; | $types[] = PhameBlogTransaction::TYPE_NAME; | ||||
$types[] = PhameBlogTransaction::TYPE_SUBTITLE; | $types[] = PhameBlogTransaction::TYPE_SUBTITLE; | ||||
$types[] = PhameBlogTransaction::TYPE_DESCRIPTION; | $types[] = PhameBlogTransaction::TYPE_DESCRIPTION; | ||||
$types[] = PhameBlogTransaction::TYPE_FULLDOMAIN; | $types[] = PhameBlogTransaction::TYPE_FULLDOMAIN; | ||||
$types[] = PhameBlogTransaction::TYPE_PARENTSITE; | $types[] = PhameBlogTransaction::TYPE_PARENTSITE; | ||||
$types[] = PhameBlogTransaction::TYPE_PARENTDOMAIN; | $types[] = PhameBlogTransaction::TYPE_PARENTDOMAIN; | ||||
$types[] = PhameBlogTransaction::TYPE_STATUS; | $types[] = PhameBlogTransaction::TYPE_STATUS; | ||||
$types[] = PhameBlogTransaction::TYPE_HEADERIMAGE; | |||||
$types[] = PhameBlogTransaction::TYPE_PROFILEIMAGE; | |||||
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY; | $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY; | ||||
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY; | $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY; | ||||
return $types; | return $types; | ||||
} | } | ||||
protected function getCustomTransactionOldValue( | protected function getCustomTransactionOldValue( | ||||
PhabricatorLiskDAO $object, | PhabricatorLiskDAO $object, | ||||
PhabricatorApplicationTransaction $xaction) { | PhabricatorApplicationTransaction $xaction) { | ||||
switch ($xaction->getTransactionType()) { | switch ($xaction->getTransactionType()) { | ||||
case PhameBlogTransaction::TYPE_NAME: | case PhameBlogTransaction::TYPE_NAME: | ||||
return $object->getName(); | return $object->getName(); | ||||
case PhameBlogTransaction::TYPE_SUBTITLE: | case PhameBlogTransaction::TYPE_SUBTITLE: | ||||
return $object->getSubtitle(); | return $object->getSubtitle(); | ||||
case PhameBlogTransaction::TYPE_DESCRIPTION: | case PhameBlogTransaction::TYPE_DESCRIPTION: | ||||
return $object->getDescription(); | return $object->getDescription(); | ||||
case PhameBlogTransaction::TYPE_FULLDOMAIN: | case PhameBlogTransaction::TYPE_FULLDOMAIN: | ||||
return $object->getDomainFullURI(); | return $object->getDomainFullURI(); | ||||
case PhameBlogTransaction::TYPE_PARENTSITE: | case PhameBlogTransaction::TYPE_PARENTSITE: | ||||
return $object->getParentSite(); | return $object->getParentSite(); | ||||
case PhameBlogTransaction::TYPE_PARENTDOMAIN: | case PhameBlogTransaction::TYPE_PARENTDOMAIN: | ||||
return $object->getParentDomain(); | return $object->getParentDomain(); | ||||
case PhameBlogTransaction::TYPE_PROFILEIMAGE: | |||||
return $object->getProfileImagePHID(); | |||||
case PhameBlogTransaction::TYPE_HEADERIMAGE: | |||||
return $object->getHeaderImagePHID(); | |||||
case PhameBlogTransaction::TYPE_STATUS: | case PhameBlogTransaction::TYPE_STATUS: | ||||
return $object->getStatus(); | return $object->getStatus(); | ||||
} | } | ||||
} | } | ||||
protected function getCustomTransactionNewValue( | protected function getCustomTransactionNewValue( | ||||
PhabricatorLiskDAO $object, | PhabricatorLiskDAO $object, | ||||
PhabricatorApplicationTransaction $xaction) { | PhabricatorApplicationTransaction $xaction) { | ||||
switch ($xaction->getTransactionType()) { | switch ($xaction->getTransactionType()) { | ||||
case PhameBlogTransaction::TYPE_NAME: | case PhameBlogTransaction::TYPE_NAME: | ||||
case PhameBlogTransaction::TYPE_SUBTITLE: | case PhameBlogTransaction::TYPE_SUBTITLE: | ||||
case PhameBlogTransaction::TYPE_DESCRIPTION: | case PhameBlogTransaction::TYPE_DESCRIPTION: | ||||
case PhameBlogTransaction::TYPE_STATUS: | case PhameBlogTransaction::TYPE_STATUS: | ||||
case PhameBlogTransaction::TYPE_PARENTSITE: | case PhameBlogTransaction::TYPE_PARENTSITE: | ||||
case PhameBlogTransaction::TYPE_PARENTDOMAIN: | case PhameBlogTransaction::TYPE_PROFILEIMAGE: | ||||
case PhameBlogTransaction::TYPE_HEADERIMAGE: | |||||
return $xaction->getNewValue(); | return $xaction->getNewValue(); | ||||
case PhameBlogTransaction::TYPE_FULLDOMAIN: | case PhameBlogTransaction::TYPE_FULLDOMAIN: | ||||
$domain = $xaction->getNewValue(); | $domain = $xaction->getNewValue(); | ||||
if (!strlen($xaction->getNewValue())) { | if (!strlen($xaction->getNewValue())) { | ||||
return null; | return null; | ||||
} | } | ||||
return $domain; | return $domain; | ||||
} | } | ||||
Show All 16 Lines | switch ($xaction->getTransactionType()) { | ||||
$uri = new PhutilURI($new_value); | $uri = new PhutilURI($new_value); | ||||
$domain = $uri->getDomain(); | $domain = $uri->getDomain(); | ||||
$object->setDomain($domain); | $object->setDomain($domain); | ||||
} else { | } else { | ||||
$object->setDomain(null); | $object->setDomain(null); | ||||
} | } | ||||
$object->setDomainFullURI($new_value); | $object->setDomainFullURI($new_value); | ||||
return; | return; | ||||
case PhameBlogTransaction::TYPE_PROFILEIMAGE: | |||||
return $object->setProfileImagePHID($xaction->getNewValue()); | |||||
case PhameBlogTransaction::TYPE_HEADERIMAGE: | |||||
return $object->setHeaderImagePHID($xaction->getNewValue()); | |||||
case PhameBlogTransaction::TYPE_STATUS: | case PhameBlogTransaction::TYPE_STATUS: | ||||
return $object->setStatus($xaction->getNewValue()); | return $object->setStatus($xaction->getNewValue()); | ||||
case PhameBlogTransaction::TYPE_PARENTSITE: | case PhameBlogTransaction::TYPE_PARENTSITE: | ||||
return $object->setParentSite($xaction->getNewValue()); | return $object->setParentSite($xaction->getNewValue()); | ||||
case PhameBlogTransaction::TYPE_PARENTDOMAIN: | case PhameBlogTransaction::TYPE_PARENTDOMAIN: | ||||
return $object->setParentDomain($xaction->getNewValue()); | return $object->setParentDomain($xaction->getNewValue()); | ||||
} | } | ||||
return parent::applyCustomInternalTransaction($object, $xaction); | return parent::applyCustomInternalTransaction($object, $xaction); | ||||
} | } | ||||
protected function applyCustomExternalTransaction( | protected function applyCustomExternalTransaction( | ||||
PhabricatorLiskDAO $object, | PhabricatorLiskDAO $object, | ||||
PhabricatorApplicationTransaction $xaction) { | PhabricatorApplicationTransaction $xaction) { | ||||
switch ($xaction->getTransactionType()) { | switch ($xaction->getTransactionType()) { | ||||
case PhameBlogTransaction::TYPE_NAME: | case PhameBlogTransaction::TYPE_NAME: | ||||
case PhameBlogTransaction::TYPE_SUBTITLE: | case PhameBlogTransaction::TYPE_SUBTITLE: | ||||
case PhameBlogTransaction::TYPE_DESCRIPTION: | case PhameBlogTransaction::TYPE_DESCRIPTION: | ||||
case PhameBlogTransaction::TYPE_FULLDOMAIN: | case PhameBlogTransaction::TYPE_FULLDOMAIN: | ||||
case PhameBlogTransaction::TYPE_PARENTSITE: | case PhameBlogTransaction::TYPE_PARENTSITE: | ||||
case PhameBlogTransaction::TYPE_PARENTDOMAIN: | case PhameBlogTransaction::TYPE_PARENTDOMAIN: | ||||
case PhameBlogTransaction::TYPE_HEADERIMAGE: | |||||
case PhameBlogTransaction::TYPE_PROFILEIMAGE: | |||||
case PhameBlogTransaction::TYPE_STATUS: | case PhameBlogTransaction::TYPE_STATUS: | ||||
return; | return; | ||||
} | } | ||||
return parent::applyCustomExternalTransaction($object, $xaction); | return parent::applyCustomExternalTransaction($object, $xaction); | ||||
} | } | ||||
protected function validateTransaction( | protected function validateTransaction( | ||||
▲ Show 20 Lines • Show All 174 Lines • Show Last 20 Lines |