Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/storage/PhabricatorProject.php
| Show All 39 Lines | final class PhabricatorProject extends PhabricatorProjectDAO | ||||
| private $watcherPHIDs = self::ATTACHABLE; | private $watcherPHIDs = self::ATTACHABLE; | ||||
| private $sparseWatchers = self::ATTACHABLE; | private $sparseWatchers = self::ATTACHABLE; | ||||
| private $sparseMembers = self::ATTACHABLE; | private $sparseMembers = self::ATTACHABLE; | ||||
| private $customFields = self::ATTACHABLE; | private $customFields = self::ATTACHABLE; | ||||
| private $profileImageFile = self::ATTACHABLE; | private $profileImageFile = self::ATTACHABLE; | ||||
| private $slugs = self::ATTACHABLE; | private $slugs = self::ATTACHABLE; | ||||
| private $parentProject = self::ATTACHABLE; | private $parentProject = self::ATTACHABLE; | ||||
| const DEFAULT_ICON = 'fa-briefcase'; | |||||
| const DEFAULT_COLOR = 'blue'; | const DEFAULT_COLOR = 'blue'; | ||||
| const TABLE_DATASOURCE_TOKEN = 'project_datasourcetoken'; | const TABLE_DATASOURCE_TOKEN = 'project_datasourcetoken'; | ||||
| public static function initializeNewProject(PhabricatorUser $actor) { | public static function initializeNewProject(PhabricatorUser $actor) { | ||||
| $app = id(new PhabricatorApplicationQuery()) | $app = id(new PhabricatorApplicationQuery()) | ||||
| ->setViewer(PhabricatorUser::getOmnipotentUser()) | ->setViewer(PhabricatorUser::getOmnipotentUser()) | ||||
| ->withClasses(array('PhabricatorProjectApplication')) | ->withClasses(array('PhabricatorProjectApplication')) | ||||
| ->executeOne(); | ->executeOne(); | ||||
| $view_policy = $app->getPolicy( | $view_policy = $app->getPolicy( | ||||
| ProjectDefaultViewCapability::CAPABILITY); | ProjectDefaultViewCapability::CAPABILITY); | ||||
| $edit_policy = $app->getPolicy( | $edit_policy = $app->getPolicy( | ||||
| ProjectDefaultEditCapability::CAPABILITY); | ProjectDefaultEditCapability::CAPABILITY); | ||||
| $join_policy = $app->getPolicy( | $join_policy = $app->getPolicy( | ||||
| ProjectDefaultJoinCapability::CAPABILITY); | ProjectDefaultJoinCapability::CAPABILITY); | ||||
| $default_icon = PhabricatorProjectIconSet::getDefaultIconKey(); | |||||
| return id(new PhabricatorProject()) | return id(new PhabricatorProject()) | ||||
| ->setAuthorPHID($actor->getPHID()) | ->setAuthorPHID($actor->getPHID()) | ||||
| ->setIcon(self::DEFAULT_ICON) | ->setIcon($default_icon) | ||||
| ->setColor(self::DEFAULT_COLOR) | ->setColor(self::DEFAULT_COLOR) | ||||
| ->setViewPolicy($view_policy) | ->setViewPolicy($view_policy) | ||||
| ->setEditPolicy($edit_policy) | ->setEditPolicy($edit_policy) | ||||
| ->setJoinPolicy($join_policy) | ->setJoinPolicy($join_policy) | ||||
| ->setIsMembershipLocked(0) | ->setIsMembershipLocked(0) | ||||
| ->attachMemberPHIDs(array()) | ->attachMemberPHIDs(array()) | ||||
| ->attachSlugs(array()) | ->attachSlugs(array()) | ||||
| ->setHasWorkboard(0) | ->setHasWorkboard(0) | ||||
| ▲ Show 20 Lines • Show All 402 Lines • ▼ Show 20 Lines | if (!$current) { | ||||
| $number = 1; | $number = 1; | ||||
| } else { | } else { | ||||
| $number = (int)$current['n'] + 1; | $number = (int)$current['n'] + 1; | ||||
| } | } | ||||
| return $number; | return $number; | ||||
| } | } | ||||
| public function getDisplayIcon() { | public function getDisplayIconKey() { | ||||
| if ($this->isMilestone()) { | if ($this->isMilestone()) { | ||||
| return 'fa-map-marker'; | $key = PhabricatorProjectIconSet::getMilestoneIconKey(); | ||||
| } else { | |||||
| $key = $this->getIcon(); | |||||
| } | |||||
| return $key; | |||||
| } | } | ||||
| return $this->getIcon(); | public function getDisplayIconIcon() { | ||||
| $key = $this->getDisplayIconKey(); | |||||
| return PhabricatorProjectIconSet::getIconIcon($key); | |||||
| } | |||||
| public function getDisplayIconName() { | |||||
| $key = $this->getDisplayIconKey(); | |||||
| return PhabricatorProjectIconSet::getIconName($key); | |||||
| } | } | ||||
| public function getDisplayColor() { | public function getDisplayColor() { | ||||
| if ($this->isMilestone()) { | if ($this->isMilestone()) { | ||||
| return self::DEFAULT_COLOR; | return self::DEFAULT_COLOR; | ||||
| } | } | ||||
| return $this->getColor(); | return $this->getColor(); | ||||
| ▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | return array( | ||||
| id(new PhabricatorConduitSearchFieldSpecification()) | id(new PhabricatorConduitSearchFieldSpecification()) | ||||
| ->setKey('name') | ->setKey('name') | ||||
| ->setType('string') | ->setType('string') | ||||
| ->setDescription(pht('The name of the project.')), | ->setDescription(pht('The name of the project.')), | ||||
| id(new PhabricatorConduitSearchFieldSpecification()) | id(new PhabricatorConduitSearchFieldSpecification()) | ||||
| ->setKey('slug') | ->setKey('slug') | ||||
| ->setType('string') | ->setType('string') | ||||
| ->setDescription(pht('Primary slug/hashtag.')), | ->setDescription(pht('Primary slug/hashtag.')), | ||||
| id(new PhabricatorConduitSearchFieldSpecification()) | |||||
| ->setKey('icon') | |||||
| ->setType('map<string, wild>') | |||||
| ->setDescription(pht('Information about the project icon.')), | |||||
| ); | ); | ||||
| } | } | ||||
| public function getFieldValuesForConduit() { | public function getFieldValuesForConduit() { | ||||
| return array( | return array( | ||||
| 'name' => $this->getName(), | 'name' => $this->getName(), | ||||
| 'slug' => $this->getPrimarySlug(), | 'slug' => $this->getPrimarySlug(), | ||||
| 'icon' => array( | |||||
| 'key' => $this->getDisplayIconKey(), | |||||
| 'name' => $this->getDisplayIconName(), | |||||
| 'icon' => $this->getDisplayIconIcon(), | |||||
| ), | |||||
| ); | ); | ||||
| } | } | ||||
| public function getConduitSearchAttachments() { | public function getConduitSearchAttachments() { | ||||
| return array(); | return array(); | ||||
| } | } | ||||
| } | } | ||||