[MediaWiki-commits] [Gerrit] adds enable Phragile configuration option enables 'View in P... - change (phabricator...Sprint)

2015-07-15 Thread Christopher Johnson (WMDE) (Code Review)
Christopher Johnson (WMDE) has submitted this change and it was merged.

Change subject: adds enable Phragile configuration option enables 'View in 
Phragile' option in Project Profile Action menu enables icon in Project 
Navigation menu
..


adds enable Phragile configuration option
enables 'View in Phragile' option in Project Profile Action menu
enables icon in Project Navigation menu

Bug: T104454
Change-Id: I9eae7306b3288b2a92a6a2164b7eda806d91f4bf
---
M src/config/SprintConfigOptions.php
M src/controller/SprintController.php
M src/events/BurndownActionMenuEventListener.php
3 files changed, 35 insertions(+), 10 deletions(-)

Approvals:
  Christopher Johnson (WMDE): Verified; Looks good to me, approved



diff --git a/src/config/SprintConfigOptions.php 
b/src/config/SprintConfigOptions.php
index f7ae983..5835e6e 100644
--- a/src/config/SprintConfigOptions.php
+++ b/src/config/SprintConfigOptions.php
@@ -88,6 +88,17 @@
 pht(
 "The Sprint Board is optional".
 "\n\n.")),
+$this->newOption('sprint.enable-phragile', 'bool', false)
+->setBoolOptions(
+array(
+pht('Enable Phragile'),
+pht('Disble Phragile'),
+))
+->setSummary(pht('Enable or Disable Phragile Extension.'))
+->setDescription(
+pht(
+"Phragile charts are provided by an external application 
at https://phragile.wmflabs.org";.
+"\n\n.")),
 );
   }
 
diff --git a/src/controller/SprintController.php 
b/src/controller/SprintController.php
index 401f9fb..bb7667d 100644
--- a/src/controller/SprintController.php
+++ b/src/controller/SprintController.php
@@ -129,7 +129,8 @@
 $id = $project->getID();
 $picture = $project->getProfileImageURI();
 $name = $project->getName();
-
+$enable_phragile = PhabricatorEnv::getEnvConfig('sprint.enable-phragile');
+$phragile_uri = new PhutilURI('https://phragile.wmflabs.org/sprints/'.$id);
 $columns = id(new PhabricatorProjectColumnQuery())
 ->setViewer($viewer)
 ->withProjectPHIDs(array($project->getPHID()))
@@ -144,10 +145,13 @@
 $nav->setIconNav(true);
 if ($this->isSprint($project) !== false) {
   $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
-  $nav->addIcon("profile/{$id}/", $name, null, $picture);
-  $nav->addIcon("burn/{$id}/", pht('Burndown'), 'fa-fire');
-  $nav->addIcon("board/{$id}/", pht('Sprint Board'), $board_icon);
-  $nav->addIcon('.', pht('Sprint List'), 'fa-bar-chart');
+  $nav->addIcon("profile/{$id}/", $name, null, $picture, null);
+  $nav->addIcon("burn/{$id}/", pht('Burndown'), 'fa-fire', null, null);
+  if ($enable_phragile) {
+$nav->addIcon("sprints/{$id}/", pht('Phragile'), 'fa-pie-chart', null, 
$phragile_uri);
+  }
+  $nav->addIcon("board/{$id}/", pht('Sprint Board'), $board_icon, null, 
null);
+  $nav->addIcon('.', pht('Sprint List'), 'fa-bar-chart', null, null);
 } else {
   $nav->setBaseURI(new PhutilURI($this->getProjectsURI()));
   $nav->addIcon("profile/{$id}/", $name, null, $picture);
@@ -162,9 +166,9 @@
   $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');
-$nav->addIcon("details/{$id}/", pht('Edit Details'), 'fa-pencil');
+$nav->addIcon("feed/{$id}/", pht('Feed'), 'fa-newspaper-o', null, null);
+$nav->addIcon("members/{$id}/", pht('Members'), 'fa-group', null, null);
+$nav->addIcon("details/{$id}/", pht('Edit Details'), 'fa-pencil', null, 
null);
 
 return $nav;
   }
diff --git a/src/events/BurndownActionMenuEventListener.php 
b/src/events/BurndownActionMenuEventListener.php
index e0b44ec..962c553 100644
--- a/src/events/BurndownActionMenuEventListener.php
+++ b/src/events/BurndownActionMenuEventListener.php
@@ -42,12 +42,13 @@
 if (!$this->canUseApplication($event->getUser())) {
   return null;
 }
-
+$enable_phragile = PhabricatorEnv::getEnvConfig('sprint.enable-phragile');
 $project = $event->getValue('object');
 $projectid = $project->getId();
 
 $view_uri = '/project/sprint/view/'.$projectid;
 $board_uri = '/project/sprint/board/'.$projectid;
+$phragile_uri = 'https://phragile.wmflabs.org/sprints/'.$projectid;
 
 $burndown = id(new PhabricatorActionView())
 ->setIcon('fa-bar-chart-o')
@@ -59,7 +60,16 @@
 ->setName(pht('View Sprint Board'))
 ->setHref($board_uri);
 
-return array ($burndown, $board);
+$phragile = null;
+if ($enable_phragile) {
+  $phragile = id(new PhabricatorActionView())
+  ->setIcon('fa-pie-chart')
+  ->setName(pht('View in Phragile'))
+  ->setHref($phragile_ur

[MediaWiki-commits] [Gerrit] adds enable Phragile configuration option enables 'View in P... - change (phabricator...Sprint)

2015-07-15 Thread Christopher Johnson (WMDE) (Code Review)
Christopher Johnson (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/224765

Change subject: adds enable Phragile configuration option enables 'View in 
Phragile' option in Project Profile Action menu enables icon in Project 
Navigation menu
..

adds enable Phragile configuration option
enables 'View in Phragile' option in Project Profile Action menu
enables icon in Project Navigation menu

Bug: T104454
Change-Id: I9eae7306b3288b2a92a6a2164b7eda806d91f4bf
---
M src/config/SprintConfigOptions.php
M src/controller/SprintController.php
M src/events/BurndownActionMenuEventListener.php
3 files changed, 35 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/phabricator/extensions/Sprint 
refs/changes/65/224765/1

diff --git a/src/config/SprintConfigOptions.php 
b/src/config/SprintConfigOptions.php
index f7ae983..5835e6e 100644
--- a/src/config/SprintConfigOptions.php
+++ b/src/config/SprintConfigOptions.php
@@ -88,6 +88,17 @@
 pht(
 "The Sprint Board is optional".
 "\n\n.")),
+$this->newOption('sprint.enable-phragile', 'bool', false)
+->setBoolOptions(
+array(
+pht('Enable Phragile'),
+pht('Disble Phragile'),
+))
+->setSummary(pht('Enable or Disable Phragile Extension.'))
+->setDescription(
+pht(
+"Phragile charts are provided by an external application 
at https://phragile.wmflabs.org";.
+"\n\n.")),
 );
   }
 
diff --git a/src/controller/SprintController.php 
b/src/controller/SprintController.php
index 401f9fb..bb7667d 100644
--- a/src/controller/SprintController.php
+++ b/src/controller/SprintController.php
@@ -129,7 +129,8 @@
 $id = $project->getID();
 $picture = $project->getProfileImageURI();
 $name = $project->getName();
-
+$enable_phragile = PhabricatorEnv::getEnvConfig('sprint.enable-phragile');
+$phragile_uri = new PhutilURI('https://phragile.wmflabs.org/sprints/'.$id);
 $columns = id(new PhabricatorProjectColumnQuery())
 ->setViewer($viewer)
 ->withProjectPHIDs(array($project->getPHID()))
@@ -144,10 +145,13 @@
 $nav->setIconNav(true);
 if ($this->isSprint($project) !== false) {
   $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
-  $nav->addIcon("profile/{$id}/", $name, null, $picture);
-  $nav->addIcon("burn/{$id}/", pht('Burndown'), 'fa-fire');
-  $nav->addIcon("board/{$id}/", pht('Sprint Board'), $board_icon);
-  $nav->addIcon('.', pht('Sprint List'), 'fa-bar-chart');
+  $nav->addIcon("profile/{$id}/", $name, null, $picture, null);
+  $nav->addIcon("burn/{$id}/", pht('Burndown'), 'fa-fire', null, null);
+  if ($enable_phragile) {
+$nav->addIcon("sprints/{$id}/", pht('Phragile'), 'fa-pie-chart', null, 
$phragile_uri);
+  }
+  $nav->addIcon("board/{$id}/", pht('Sprint Board'), $board_icon, null, 
null);
+  $nav->addIcon('.', pht('Sprint List'), 'fa-bar-chart', null, null);
 } else {
   $nav->setBaseURI(new PhutilURI($this->getProjectsURI()));
   $nav->addIcon("profile/{$id}/", $name, null, $picture);
@@ -162,9 +166,9 @@
   $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');
-$nav->addIcon("details/{$id}/", pht('Edit Details'), 'fa-pencil');
+$nav->addIcon("feed/{$id}/", pht('Feed'), 'fa-newspaper-o', null, null);
+$nav->addIcon("members/{$id}/", pht('Members'), 'fa-group', null, null);
+$nav->addIcon("details/{$id}/", pht('Edit Details'), 'fa-pencil', null, 
null);
 
 return $nav;
   }
diff --git a/src/events/BurndownActionMenuEventListener.php 
b/src/events/BurndownActionMenuEventListener.php
index e0b44ec..962c553 100644
--- a/src/events/BurndownActionMenuEventListener.php
+++ b/src/events/BurndownActionMenuEventListener.php
@@ -42,12 +42,13 @@
 if (!$this->canUseApplication($event->getUser())) {
   return null;
 }
-
+$enable_phragile = PhabricatorEnv::getEnvConfig('sprint.enable-phragile');
 $project = $event->getValue('object');
 $projectid = $project->getId();
 
 $view_uri = '/project/sprint/view/'.$projectid;
 $board_uri = '/project/sprint/board/'.$projectid;
+$phragile_uri = 'https://phragile.wmflabs.org/sprints/'.$projectid;
 
 $burndown = id(new PhabricatorActionView())
 ->setIcon('fa-bar-chart-o')
@@ -59,7 +60,16 @@
 ->setName(pht('View Sprint Board'))
 ->setHref($board_uri);
 
-return array ($burndown, $board);
+$phragile = null;
+if ($enable_phragile) {
+  $phragile = id(new PhabricatorActionView())
+  ->setIcon('fa-pie-chart')
+  ->setName(pht(