Changeset View
Changeset View
Standalone View
Standalone View
src/applications/legalpad/storage/LegalpadDocument.php
<?php | <?php | ||||
final class LegalpadDocument extends LegalpadDAO | final class LegalpadDocument extends LegalpadDAO | ||||
implements | implements | ||||
PhabricatorPolicyInterface, | PhabricatorPolicyInterface, | ||||
PhabricatorSubscribableInterface, | PhabricatorSubscribableInterface, | ||||
PhabricatorApplicationTransactionInterface, | PhabricatorApplicationTransactionInterface, | ||||
PhabricatorDestructibleInterface { | PhabricatorDestructibleInterface, | ||||
PhabricatorConduitResultInterface { | |||||
protected $title; | protected $title; | ||||
protected $contributorCount; | protected $contributorCount; | ||||
protected $recentContributorPHIDs = array(); | protected $recentContributorPHIDs = array(); | ||||
protected $creatorPHID; | protected $creatorPHID; | ||||
protected $versions; | protected $versions; | ||||
protected $documentBodyPHID; | protected $documentBodyPHID; | ||||
protected $viewPolicy; | protected $viewPolicy; | ||||
▲ Show 20 Lines • Show All 137 Lines • ▼ Show 20 Lines | $map = array( | ||||
self::SIGNATURE_TYPE_NONE => '', | self::SIGNATURE_TYPE_NONE => '', | ||||
self::SIGNATURE_TYPE_INDIVIDUAL => 'fa-user grey', | self::SIGNATURE_TYPE_INDIVIDUAL => 'fa-user grey', | ||||
self::SIGNATURE_TYPE_CORPORATION => 'fa-building-o grey', | self::SIGNATURE_TYPE_CORPORATION => 'fa-building-o grey', | ||||
); | ); | ||||
return idx($map, $type, 'fa-user grey'); | return idx($map, $type, 'fa-user grey'); | ||||
} | } | ||||
public function getPreamble() { | |||||
return $this->preamble; | |||||
} | |||||
/* -( PhabricatorSubscribableInterface )----------------------------------- */ | /* -( PhabricatorSubscribableInterface )----------------------------------- */ | ||||
public function isAutomaticallySubscribed($phid) { | public function isAutomaticallySubscribed($phid) { | ||||
return ($this->creatorPHID == $phid); | return ($this->creatorPHID == $phid); | ||||
} | } | ||||
/* -( PhabricatorConduitResultInterface )---------------------------------- */ | |||||
public function getFieldSpecificationsForConduit() { | |||||
return array( | |||||
id(new PhabricatorConduitSearchFieldSpecification()) | |||||
->setKey('title') | |||||
->setType('string') | |||||
->setDescription(pht('The title of this document')), | |||||
id(new PhabricatorConduitSearchFieldSpecification()) | |||||
->setKey('creatorPHID') | |||||
->setType('phid') | |||||
->setDescription(pht('This user who created this document')), | |||||
id(new PhabricatorConduitSearchFieldSpecification()) | |||||
->setKey('versions') | |||||
->setType('int') | |||||
->setDescription(pht('The number of versions of this document')), | |||||
id(new PhabricatorConduitSearchFieldSpecification()) | |||||
->setKey('requireSignature') | |||||
->setType('bool') | |||||
->setDescription(pht( | |||||
'Whether signatures on this doc are required to use this install')), | |||||
); | |||||
} | |||||
public function getFieldValuesForConduit() { | |||||
return array( | |||||
'title' => $this->title, | |||||
'creatorPHID' => $this->creatorPHID, | |||||
'versions' => $this->versions, | |||||
'requireSignature' => (bool)$this->requireSignature, | |||||
); | |||||
} | |||||
public function getConduitSearchAttachments() { | |||||
return array( | |||||
id(new PhabricatorLegalpadBodySearchEngineAttachment()) | |||||
->setAttachmentKey('body'), | |||||
id(new PhabricatorLegalpadSignaturesSearchEngineAttachment()) | |||||
->setAttachmentKey('signatures'), | |||||
); | |||||
} | |||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */ | /* -( PhabricatorPolicyInterface )----------------------------------------- */ | ||||
public function getCapabilities() { | public function getCapabilities() { | ||||
return array( | return array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0