diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1300,6 +1300,7 @@ 'ManiphestHovercardEngineExtension' => 'applications/maniphest/engineextension/ManiphestHovercardEngineExtension.php', 'ManiphestInfoConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestInfoConduitAPIMethod.php', 'ManiphestNameIndex' => 'applications/maniphest/storage/ManiphestNameIndex.php', + 'ManiphestPointsConfigOptionType' => 'applications/maniphest/config/ManiphestPointsConfigOptionType.php', 'ManiphestPriorityConfigOptionType' => 'applications/maniphest/config/ManiphestPriorityConfigOptionType.php', 'ManiphestPriorityEmailCommand' => 'applications/maniphest/command/ManiphestPriorityEmailCommand.php', 'ManiphestProjectNameFulltextEngineExtension' => 'applications/maniphest/engineextension/ManiphestProjectNameFulltextEngineExtension.php', @@ -5460,6 +5461,7 @@ 'ManiphestHovercardEngineExtension' => 'PhabricatorHovercardEngineExtension', 'ManiphestInfoConduitAPIMethod' => 'ManiphestConduitAPIMethod', 'ManiphestNameIndex' => 'ManiphestDAO', + 'ManiphestPointsConfigOptionType' => 'PhabricatorConfigJSONOptionType', 'ManiphestPriorityConfigOptionType' => 'PhabricatorConfigJSONOptionType', 'ManiphestPriorityEmailCommand' => 'ManiphestEmailCommand', 'ManiphestProjectNameFulltextEngineExtension' => 'PhabricatorFulltextEngineExtension', diff --git a/src/applications/maniphest/config/ManiphestPointsConfigOptionType.php b/src/applications/maniphest/config/ManiphestPointsConfigOptionType.php new file mode 100644 --- /dev/null +++ b/src/applications/maniphest/config/ManiphestPointsConfigOptionType.php @@ -0,0 +1,10 @@ +encodeFormatted($fields_example); + $points_type = 'custom:ManiphestPointsConfigOptionType'; + + $points_example_1 = array( + 'enabled' => true, + 'label' => pht('Story Points'), + 'action' => pht('Change Story Points'), + ); + $points_json_1 = id(new PhutilJSON())->encodeFormatted($points_example_1); + + $points_example_2 = array( + 'enabled' => true, + 'label' => pht('Estimated Hours'), + 'action' => pht('Change Estimate'), + ); + $points_json_2 = id(new PhutilJSON())->encodeFormatted($points_example_2); + + $points_description = $this->deformat(pht(<<newOption('maniphest.custom-field-definitions', 'wild', array()) ->setSummary(pht('Custom Maniphest fields.')) @@ -336,9 +372,11 @@ '"Needs Triage" panel on the home page. You should adjust this if '. 'you adjust priorities using `%s`.', 'maniphest.priorities')), - $this->newOption('maniphest.points', 'map', array()) - ->setDescription( - pht('PROTOTYPE! Very hot. Burns user. Do not touch!')), + $this->newOption('maniphest.points', $points_type, array()) + ->setSummary(pht('Configure point values for tasks.')) + ->setDescription($points_description) + ->addExample($points_json_1, pht('Points Config')) + ->addExample($points_json_2, pht('Hours Config')), ); } diff --git a/src/applications/maniphest/constants/ManiphestTaskPoints.php b/src/applications/maniphest/constants/ManiphestTaskPoints.php --- a/src/applications/maniphest/constants/ManiphestTaskPoints.php +++ b/src/applications/maniphest/constants/ManiphestTaskPoints.php @@ -21,4 +21,21 @@ return PhabricatorEnv::getEnvConfig('maniphest.points'); } + public static function validateConfiguration($config) { + if (!is_array($config)) { + throw new Exception( + pht( + 'Configuration is not valid. Maniphest points configuration must '. + 'be a dictionary.')); + } + + PhutilTypeSpec::checkMap( + $config, + array( + 'enabled' => 'optional bool', + 'label' => 'optional string', + 'action' => 'optional string', + )); + } + }