[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/maniphest/config/ -> PhabricatorManiphestConfigOptions.php (source)

   1  <?php
   2  
   3  final class PhabricatorManiphestConfigOptions
   4    extends PhabricatorApplicationConfigOptions {
   5  
   6    public function getName() {
   7      return pht('Maniphest');
   8    }
   9  
  10    public function getDescription() {
  11      return pht('Configure Maniphest.');
  12    }
  13  
  14    public function getOptions() {
  15  
  16      $priority_defaults = array(
  17        100 => array(
  18          'name'  => pht('Unbreak Now!'),
  19          'short' => pht('Unbreak!'),
  20          'color' => 'indigo',
  21        ),
  22        90 => array(
  23          'name' => pht('Needs Triage'),
  24          'short' => pht('Triage'),
  25          'color' => 'violet',
  26        ),
  27        80 => array(
  28          'name' => pht('High'),
  29          'short' => pht('High'),
  30          'color' => 'red',
  31        ),
  32        50 => array(
  33          'name' => pht('Normal'),
  34          'short' => pht('Normal'),
  35          'color' => 'orange',
  36        ),
  37        25 => array(
  38          'name' => pht('Low'),
  39          'short' => pht('Low'),
  40          'color' => 'yellow',
  41        ),
  42        0 => array(
  43          'name' => pht('Wishlist'),
  44          'short' => pht('Wish'),
  45          'color' => 'sky',
  46        ),
  47      );
  48  
  49      $status_type = 'custom:ManiphestStatusConfigOptionType';
  50      $status_defaults = array(
  51        'open' => array(
  52          'name' => pht('Open'),
  53          'special' => ManiphestTaskStatus::SPECIAL_DEFAULT,
  54        ),
  55        'resolved' => array(
  56          'name' => pht('Resolved'),
  57          'name.full' => pht('Closed, Resolved'),
  58          'closed' => true,
  59          'special' => ManiphestTaskStatus::SPECIAL_CLOSED,
  60          'prefixes' => array(
  61            'closed',
  62            'closes',
  63            'close',
  64            'fix',
  65            'fixes',
  66            'fixed',
  67            'resolve',
  68            'resolves',
  69            'resolved',
  70          ),
  71          'suffixes' => array(
  72            'as resolved',
  73            'as fixed',
  74          ),
  75        ),
  76        'wontfix' => array(
  77          'name' => pht('Wontfix'),
  78          'name.full' => pht('Closed, Wontfix'),
  79          'closed' => true,
  80          'prefixes' => array(
  81            'wontfix',
  82            'wontfixes',
  83            'wontfixed',
  84          ),
  85          'suffixes' => array(
  86            'as wontfix',
  87          ),
  88        ),
  89        'invalid' => array(
  90          'name' => pht('Invalid'),
  91          'name.full' => pht('Closed, Invalid'),
  92          'closed' => true,
  93          'prefixes' => array(
  94            'invalidate',
  95            'invalidates',
  96            'invalidated',
  97          ),
  98          'suffixes' => array(
  99            'as invalid',
 100          ),
 101        ),
 102        'duplicate' => array(
 103          'name' => pht('Duplicate'),
 104          'name.full' => pht('Closed, Duplicate'),
 105          'transaction.icon' => 'fa-times',
 106          'special' => ManiphestTaskStatus::SPECIAL_DUPLICATE,
 107          'closed' => true,
 108        ),
 109        'spite' => array(
 110          'name' => pht('Spite'),
 111          'name.full' => pht('Closed, Spite'),
 112          'name.action' => pht('Spited'),
 113          'transaction.icon' => 'fa-thumbs-o-down',
 114          'silly' => true,
 115          'closed' => true,
 116          'prefixes' => array(
 117            'spite',
 118            'spites',
 119            'spited',
 120          ),
 121          'suffixes' => array(
 122            'out of spite',
 123            'as spite',
 124          ),
 125        ),
 126      );
 127  
 128      $status_description = $this->deformat(pht(<<<EOTEXT
 129  Allows you to edit, add, or remove the task statuses available in Maniphest,
 130  like "Open", "Resolved" and "Invalid". The configuration should contain a map
 131  of status constants to status specifications (see defaults below for examples).
 132  
 133  The constant for each status should be 1-12 characters long and  contain only
 134  lowercase letters and digits. Valid examples are "open", "closed", and
 135  "invalid". Users will not normally see these values.
 136  
 137  The keys you can provide in a specification are:
 138  
 139    - `name` //Required string.// Name of the status, like "Invalid".
 140    - `name.full` //Optional string.// Longer name, like "Closed, Invalid". This
 141      appears on the task detail view in the header.
 142    - `name.action` //Optional string.// Action name for email subjects, like
 143      "Marked Invalid".
 144    - `closed` //Optional bool.// Statuses are either "open" or "closed".
 145      Specifying `true` here will mark the status as closed (like "Resolved" or
 146      "Invalid"). By default, statuses are open.
 147    - `special` //Optional string.// Mark this status as special. The special
 148      statuses are:
 149      - `default` This is the default status for newly created tasks. You must
 150        designate one status as default, and it must be an open status.
 151      - `closed` This is the default status for closed tasks (for example, tasks
 152        closed via the "!close" action in email or via the quick close button in
 153        Maniphest). You must designate one status as the default closed status,
 154        and it must be a closed status.
 155      - `duplicate` This is the status used when tasks are merged into one
 156        another as duplicates. You must designate one status for duplicates,
 157        and it must be a closed status.
 158    - `transaction.icon` //Optional string.// Allows you to choose a different
 159      icon to use for this status when showing status changes in the transaction
 160      log. Please see UIExamples, Icons and Images for a list.
 161    - `transaction.color` //Optional string.// Allows you to choose a different
 162      color to use for this status when showing status changes in the transaction
 163      log.
 164    - `silly` //Optional bool.// Marks this status as silly, and thus wholly
 165      inappropriate for use by serious businesses.
 166    - `prefixes` //Optional list<string>.// Allows you to specify a list of
 167      text prefixes which will trigger a task transition into this status
 168      when mentioned in a commit message. For example, providing "closes" here
 169      will allow users to move tasks to this status by writing `Closes T123` in
 170      commit messages.
 171    - `suffixes` //Optional list<string>.// Allows you to specify a list of
 172      text suffixes which will trigger a task transition into this status
 173      when mentioned in a commit message, after a valid prefix. For example,
 174      providing "as invalid" here will allow users to move tasks
 175      to this status by writing `Closes T123 as invalid`, even if another status
 176      is selected by the "Closes" prefix.
 177  
 178  Examining the default configuration and examples below will probably be helpful
 179  in understanding these options.
 180  
 181  EOTEXT
 182  ));
 183  
 184      $status_example = array(
 185        'open' => array(
 186          'name' => 'Open',
 187          'special' => 'default',
 188        ),
 189        'closed' => array(
 190          'name' => 'Closed',
 191          'special' => 'closed',
 192          'closed' => true,
 193        ),
 194        'duplicate' => array(
 195          'name' => 'Duplicate',
 196          'special' => 'duplicate',
 197          'closed' => true,
 198        ),
 199      );
 200  
 201      $json = new PhutilJSON();
 202      $status_example = $json->encodeFormatted($status_example);
 203  
 204      // This is intentionally blank for now, until we can move more Maniphest
 205      // logic to custom fields.
 206      $default_fields = array();
 207  
 208      foreach ($default_fields as $key => $enabled) {
 209        $default_fields[$key] = array(
 210          'disabled' => !$enabled,
 211        );
 212      }
 213  
 214      $custom_field_type = 'custom:PhabricatorCustomFieldConfigOptionType';
 215  
 216      return array(
 217        $this->newOption('maniphest.custom-field-definitions', 'wild', array())
 218          ->setSummary(pht('Custom Maniphest fields.'))
 219          ->setDescription(
 220            pht(
 221              'Array of custom fields for Maniphest tasks. For details on '.
 222              'adding custom fields to Maniphest, see "Configuring Custom '.
 223              'Fields" in the documentation.'))
 224          ->addExample(
 225            '{"mycompany:estimated-hours": {"name": "Estimated Hours", '.
 226            '"type": "int", "caption": "Estimated number of hours this will '.
 227            'take."}}',
 228            pht('Valid Setting')),
 229        $this->newOption('maniphest.fields', $custom_field_type, $default_fields)
 230          ->setCustomData(id(new ManiphestTask())->getCustomFieldBaseClass())
 231          ->setDescription(pht('Select and reorder task fields.')),
 232        $this->newOption('maniphest.priorities', 'wild', $priority_defaults)
 233          ->setSummary(pht('Configure Maniphest priority names.'))
 234          ->setDescription(
 235            pht(
 236              'Allows you to edit or override the default priorities available '.
 237              'in Maniphest, like "High", "Normal" and "Low". The configuration '.
 238              'should contain a map of priority constants to priority '.
 239              'specifications (see defaults below for examples).'.
 240              "\n\n".
 241              'The keys you can define for a priority are:'.
 242              "\n\n".
 243              '  - `name` Name of the priority.'."\n".
 244              '  - `short` Alternate shorter name, used in UIs where there is '.
 245              '    not much space available.'."\n".
 246              '  - `color` A color for this priority, like "red" or "blue".'.
 247              "\n\n".
 248              'You can choose which priority is the default for newly created '.
 249              'tasks with `maniphest.default-priority`.')),
 250        $this->newOption('maniphest.statuses', $status_type, $status_defaults)
 251          ->setSummary(pht('Configure Maniphest task statuses.'))
 252          ->setDescription($status_description)
 253          ->addExample($status_example, pht('Minimal Valid Config')),
 254        $this->newOption('maniphest.default-priority', 'int', 90)
 255          ->setSummary(pht('Default task priority for create flows.'))
 256          ->setDescription(
 257            pht(
 258              'Choose a default priority for newly created tasks. You can '.
 259              'review and adjust available priorities by using the '.
 260              '{{maniphest.priorities}} configuration option. The default value '.
 261              '(`90`) corresponds to the default "Needs Triage" priority.')),
 262        $this->newOption(
 263          'metamta.maniphest.reply-handler-domain',
 264          'string',
 265          null)
 266          ->setSummary(pht('Enable replying to tasks via email.'))
 267          ->setDescription(
 268            pht(
 269              'You can configure a reply handler domain so that email sent from '.
 270              'Maniphest will have a special "Reply To" address like '.
 271              '"[email protected]" that allows recipients to reply by '.
 272              'email and interact with tasks. For instructions on configurating '.
 273              'reply handlers, see the article "Configuring Inbound Email" in '.
 274              'the Phabricator documentation. By default, this is set to `null` '.
 275              'and Phabricator will use a generic `noreply@` address or the '.
 276              'address of the acting user instead of a special reply handler '.
 277              'address (see `metamta.default-address`). If you set a domain '.
 278              'here, Phabricator will begin generating private reply handler '.
 279              'addresses. See also `metamta.maniphest.reply-handler` to further '.
 280              'configure behavior. This key should be set to the domain part '.
 281              'after the @, like "example.com".')),
 282        $this->newOption(
 283          'metamta.maniphest.reply-handler',
 284          'class',
 285          'ManiphestReplyHandler')
 286          ->setBaseClass('PhabricatorMailReplyHandler')
 287          ->setDescription(pht('Override reply handler class.')),
 288        $this->newOption(
 289          'metamta.maniphest.subject-prefix',
 290          'string',
 291          '[Maniphest]')
 292          ->setDescription(pht('Subject prefix for Maniphest mail.')),
 293        $this->newOption(
 294          'metamta.maniphest.public-create-email',
 295          'string',
 296          null)
 297          ->setSummary(pht('Allow filing bugs via email.'))
 298          ->setDescription(
 299            pht(
 300              'You can configure an email address like '.
 301              '"[email protected]" which will automatically create '.
 302              'Maniphest tasks when users send email to it. This relies on the '.
 303              '"From" address to authenticate users, so it is is not completely '.
 304              'secure. To set this up, enter a complete email address like '.
 305              '"[email protected]" and then configure mail to that '.
 306              'address so it routed to Phabricator (if you\'ve already '.
 307              'configured reply handlers, you\'re probably already done). See '.
 308              '"Configuring Inbound Email" in the documentation for more '.
 309              'information.')),
 310        $this->newOption(
 311          'metamta.maniphest.default-public-author',
 312          'string',
 313          null)
 314          ->setSummary(pht('Username anonymous bugs are filed under.'))
 315          ->setDescription(
 316            pht(
 317              'If you enable `metamta.maniphest.public-create-email` and create '.
 318              'an email address like "[email protected]", it will '.
 319              'default to rejecting mail which doesn\'t come from a known user. '.
 320              'However, you might want to let anyone send email to this '.
 321              'address; to do so, set a default author here (a Phabricator '.
 322              'username). A typical use of this might be to create a "System '.
 323              'Agent" user called "bugs" and use that name here. If you specify '.
 324              'a valid username, mail will always be accepted and used to '.
 325              'create a task, even if the sender is not a system user. The '.
 326              'original email address will be stored in an `From Email` field '.
 327              'on the task.')),
 328        $this->newOption(
 329          'maniphest.priorities.unbreak-now',
 330          'int',
 331          100)
 332          ->setSummary(pht('Priority used to populate "Unbreak Now" on home.'))
 333          ->setDescription(
 334            pht(
 335              'Temporary setting. If set, this priority is used to populate the '.
 336              '"Unbreak Now" panel on the home page. You should adjust this if '.
 337              'you adjust priorities using `maniphest.priorities`.')),
 338        $this->newOption(
 339          'maniphest.priorities.needs-triage',
 340          'int',
 341          90)
 342          ->setSummary(pht('Priority used to populate "Needs Triage" on home.'))
 343          ->setDescription(
 344            pht(
 345              'Temporary setting. If set, this priority is used to populate the '.
 346              '"Needs Triage" panel on the home page. You should adjust this if '.
 347              'you adjust priorities using `maniphest.priorities`.')),
 348  
 349      );
 350    }
 351  
 352  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1