private function buildProperties(PhabricatorProject $project)
 {
     $viewer = $this->getViewer();
     $view = id(new PHUIPropertyListView())->setUser($viewer)->setObject($project);
     if ($project->isMilestone()) {
         $icon_key = PhabricatorProjectIconSet::getMilestoneIconKey();
         $icon = PhabricatorProjectIconSet::getIconIcon($icon_key);
         $target = PhabricatorProjectIconSet::getIconName($icon_key);
         $note = pht('Members of the parent project are members of this project.');
         $show_join = false;
     } else {
         if ($project->getHasSubprojects()) {
             $icon = 'fa-sitemap';
             $target = pht('Parent Project');
             $note = pht('Members of all subprojects are members of this project.');
             $show_join = false;
         } else {
             if ($project->getIsMembershipLocked()) {
                 $icon = 'fa-lock';
                 $target = pht('Locked Project');
                 $note = pht('Users with access may join this project, but may not leave.');
                 $show_join = true;
             } else {
                 $icon = 'fa-briefcase';
                 $target = pht('Normal Project');
                 $note = pht('Users with access may join and leave this project.');
                 $show_join = true;
             }
         }
     }
     $item = id(new PHUIStatusItemView())->setIcon($icon)->setTarget(phutil_tag('strong', array(), $target))->setNote($note);
     $status = id(new PHUIStatusListView())->addItem($item);
     $view->addProperty(pht('Membership'), $status);
     if ($show_join) {
         $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $project);
         $view->addProperty(pht('Joinable By'), $descriptions[PhabricatorPolicyCapability::CAN_JOIN]);
     }
     $viewer_phid = $viewer->getPHID();
     if ($project->isUserWatcher($viewer_phid)) {
         $watch_item = id(new PHUIStatusItemView())->setIcon('fa-eye green')->setTarget(phutil_tag('strong', array(), pht('Watching')))->setNote(pht('You will receive mail about changes made to any related ' . 'object.'));
         $watch_status = id(new PHUIStatusListView())->addItem($watch_item);
         $view->addProperty(pht('Watching'), $watch_status);
     }
     if ($project->isUserMember($viewer_phid)) {
         $is_silenced = $this->isProjectSilenced($project);
         if ($is_silenced) {
             $mail_icon = 'fa-envelope-o grey';
             $mail_target = pht('Disabled');
             $mail_note = pht('When mail is sent to project members, you will not receive ' . 'a copy.');
         } else {
             $mail_icon = 'fa-envelope-o green';
             $mail_target = pht('Enabled');
             $mail_note = pht('You will receive mail that is sent to project members.');
         }
         $mail_item = id(new PHUIStatusItemView())->setIcon($mail_icon)->setTarget(phutil_tag('strong', array(), $mail_target))->setNote($mail_note);
         $mail_status = id(new PHUIStatusListView())->addItem($mail_item);
         $view->addProperty(pht('Mail to Members'), $mail_status);
     }
     return $view;
 }
Exemplo n.º 2
0
 public function getDisplayIconKey()
 {
     if ($this->isMilestone()) {
         $key = PhabricatorProjectIconSet::getMilestoneIconKey();
     } else {
         $key = $this->getIcon();
     }
     return $key;
 }
 public function buildIconNavView(PhabricatorProject $project)
 {
     $this->setProject($project);
     $viewer = $this->getViewer();
     $id = $project->getID();
     $picture = $project->getProfileImageURI();
     $name = $project->getName();
     $columns = id(new PhabricatorProjectColumnQuery())->setViewer($viewer)->withProjectPHIDs(array($project->getPHID()))->execute();
     if ($columns) {
         $board_icon = 'fa-columns';
     } else {
         $board_icon = 'fa-columns grey';
     }
     $nav = new AphrontSideNavFilterView();
     $nav->setIconNav(true);
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
     $nav->addIcon("profile/{$id}/", $name, null, $picture);
     $class = 'PhabricatorManiphestApplication';
     if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
         $phid = $project->getPHID();
         $nav->addIcon("board/{$id}/", pht('Workboard'), $board_icon);
         $query_uri = urisprintf('/maniphest/?statuses=open()&projects=%s#R', $phid);
         $nav->addIcon(null, pht('Open Tasks'), 'fa-anchor', null, $query_uri);
     }
     $nav->addIcon("feed/{$id}/", pht('Feed'), 'fa-newspaper-o');
     $nav->addIcon("members/{$id}/", pht('Members'), 'fa-group');
     if (false && PhabricatorEnv::getEnvConfig('phabricator.show-prototypes')) {
         if ($project->supportsSubprojects()) {
             $subprojects_icon = 'fa-sitemap';
         } else {
             $subprojects_icon = 'fa-sitemap grey';
         }
         $key = PhabricatorProjectIconSet::getMilestoneIconKey();
         $milestones_icon = PhabricatorProjectIconSet::getIconIcon($key);
         if (!$project->supportsMilestones()) {
             $milestones_icon = "{$milestones_icon} grey";
         }
         $nav->addIcon("subprojects/{$id}/", pht('Subprojects'), $subprojects_icon);
         $nav->addIcon("milestones/{$id}/", pht('Milestones'), $milestones_icon);
     }
     return $nav;
 }