@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Organize bulk edit actions into nice groups

Summary: Ref T13025. We're getting kind of a lot of actions, so put them in nice groups so they're easier to work with.

Test Plan: {F5386038}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13025

Differential Revision: https://secure.phabricator.com/D18880

+194 -18
+10 -11
resources/celerity/map.php
··· 476 476 'rsrc/js/core/behavior-audio-source.js' => '59b251eb', 477 477 'rsrc/js/core/behavior-autofocus.js' => '7319e029', 478 478 'rsrc/js/core/behavior-badge-view.js' => '8ff5e24c', 479 - 'rsrc/js/core/behavior-bulk-editor.js' => '5e178556', 479 + 'rsrc/js/core/behavior-bulk-editor.js' => '66a6def1', 480 480 'rsrc/js/core/behavior-choose-control.js' => '327a00d1', 481 481 'rsrc/js/core/behavior-copy.js' => 'b0b8f86d', 482 482 'rsrc/js/core/behavior-detect-timezone.js' => '4c193c96', ··· 595 595 'javelin-behavior-audio-source' => '59b251eb', 596 596 'javelin-behavior-audit-preview' => 'd835b03a', 597 597 'javelin-behavior-badge-view' => '8ff5e24c', 598 - 'javelin-behavior-bulk-editor' => '5e178556', 598 + 'javelin-behavior-bulk-editor' => '66a6def1', 599 599 'javelin-behavior-bulk-job-reload' => 'edf8a145', 600 600 'javelin-behavior-calendar-month-view' => 'fe33e256', 601 601 'javelin-behavior-choose-control' => '327a00d1', ··· 1391 1391 'javelin-stratcom', 1392 1392 'javelin-dom', 1393 1393 ), 1394 - '5e178556' => array( 1395 - 'javelin-behavior', 1396 - 'javelin-dom', 1397 - 'javelin-util', 1398 - 'phabricator-prefab', 1399 - 'multirow-row-manager', 1400 - 'javelin-json', 1401 - 'phuix-form-control-view', 1402 - ), 1403 1394 '5e2634b9' => array( 1404 1395 'javelin-behavior', 1405 1396 'javelin-aphlict', ··· 1435 1426 'javelin-stratcom', 1436 1427 'javelin-workflow', 1437 1428 'javelin-dom', 1429 + ), 1430 + '66a6def1' => array( 1431 + 'javelin-behavior', 1432 + 'javelin-dom', 1433 + 'javelin-util', 1434 + 'multirow-row-manager', 1435 + 'javelin-json', 1436 + 'phuix-form-control-view', 1438 1437 ), 1439 1438 '680ea2c8' => array( 1440 1439 'javelin-install',
+2
src/__phutil_library_map__.php
··· 2203 2203 'PhabricatorBuiltinFileCachePurger' => 'applications/cache/purger/PhabricatorBuiltinFileCachePurger.php', 2204 2204 'PhabricatorBuiltinPatchList' => 'infrastructure/storage/patch/PhabricatorBuiltinPatchList.php', 2205 2205 'PhabricatorBulkContentSource' => 'infrastructure/daemon/contentsource/PhabricatorBulkContentSource.php', 2206 + 'PhabricatorBulkEditGroup' => 'applications/transactions/bulk/PhabricatorBulkEditGroup.php', 2206 2207 'PhabricatorBulkEngine' => 'applications/transactions/bulk/PhabricatorBulkEngine.php', 2207 2208 'PhabricatorCacheDAO' => 'applications/cache/storage/PhabricatorCacheDAO.php', 2208 2209 'PhabricatorCacheEngine' => 'applications/system/engine/PhabricatorCacheEngine.php', ··· 7499 7500 'PhabricatorBuiltinFileCachePurger' => 'PhabricatorCachePurger', 7500 7501 'PhabricatorBuiltinPatchList' => 'PhabricatorSQLPatchList', 7501 7502 'PhabricatorBulkContentSource' => 'PhabricatorContentSource', 7503 + 'PhabricatorBulkEditGroup' => 'Phobject', 7502 7504 'PhabricatorBulkEngine' => 'Phobject', 7503 7505 'PhabricatorCacheDAO' => 'PhabricatorLiskDAO', 7504 7506 'PhabricatorCacheEngine' => 'Phobject',
+1 -1
src/applications/maniphest/view/ManiphestTaskResultListView.php
··· 218 218 'disabled' => 'disabled', 219 219 'class' => 'disabled', 220 220 ), 221 - pht("Batch Edit Selected \xC2\xBB")); 221 + pht("Bulk Edit Selected \xC2\xBB")); 222 222 223 223 $export = javelin_tag( 224 224 'a',
+27
src/applications/transactions/bulk/PhabricatorBulkEditGroup.php
··· 1 + <?php 2 + 3 + final class PhabricatorBulkEditGroup 4 + extends Phobject { 5 + 6 + private $key; 7 + private $label; 8 + 9 + public function setKey($key) { 10 + $this->key = $key; 11 + return $this; 12 + } 13 + 14 + public function getKey() { 15 + return $this->key; 16 + } 17 + 18 + public function setLabel($label) { 19 + $this->label = $label; 20 + return $this; 21 + } 22 + 23 + public function getLabel() { 24 + return $this->label; 25 + } 26 + 27 + }
+26
src/applications/transactions/bulk/PhabricatorBulkEngine.php
··· 299 299 ->setViewer($viewer); 300 300 301 301 $edit_map = $edit_engine->newBulkEditMap(); 302 + $groups = $edit_engine->newBulkEditGroupMap(); 303 + 304 + $spec = array(); 305 + $option_groups = igroup($edit_map, 'group'); 306 + foreach ($groups as $group_key => $group) { 307 + $options = idx($option_groups, $group_key, array()); 308 + if (!$options) { 309 + continue; 310 + } 311 + 312 + $option_map = array(); 313 + foreach ($options as $option) { 314 + $option_map[] = array( 315 + 'key' => $option['xaction'], 316 + 'label' => $option['label'], 317 + ); 318 + } 319 + 320 + $spec[] = array( 321 + 'label' => $group->getLabel(), 322 + 'options' => $option_map, 323 + ); 324 + } 302 325 303 326 require_celerity_resource('phui-bulk-editor-css'); 304 327 ··· 308 331 'rootNodeID' => $this->getRootFormID(), 309 332 'inputNodeID' => $input_id, 310 333 'edits' => $edit_map, 334 + 'optgroups' => array( 335 + 'groups' => $spec, 336 + ), 311 337 )); 312 338 313 339 $cancel_uri = $this->getCancelURI();
+75
src/applications/transactions/editengine/PhabricatorEditEngine.php
··· 181 181 $field 182 182 ->setViewer($viewer) 183 183 ->setObject($object); 184 + 185 + $group_key = $field->getBulkEditGroupKey(); 186 + if ($group_key === null) { 187 + $field->setBulkEditGroupKey('extension'); 188 + } 184 189 } 185 190 186 191 $extension_fields = mpull($extension_fields, null, 'getKey'); ··· 2424 2429 2425 2430 /* -( Bulk Edits )--------------------------------------------------------- */ 2426 2431 2432 + final public function newBulkEditGroupMap() { 2433 + $groups = $this->newBulkEditGroups(); 2434 + 2435 + $map = array(); 2436 + foreach ($groups as $group) { 2437 + $key = $group->getKey(); 2438 + 2439 + if (isset($map[$key])) { 2440 + throw new Exception( 2441 + pht( 2442 + 'Two bulk edit groups have the same key ("%s"). Each bulk edit '. 2443 + 'group must have a unique key.', 2444 + $key)); 2445 + } 2446 + 2447 + $map[$key] = $group; 2448 + } 2449 + 2450 + if ($this->isEngineExtensible()) { 2451 + $extensions = PhabricatorEditEngineExtension::getAllEnabledExtensions(); 2452 + } else { 2453 + $extensions = array(); 2454 + } 2455 + 2456 + foreach ($extensions as $extension) { 2457 + $extension_groups = $extension->newBulkEditGroups($this); 2458 + foreach ($extension_groups as $group) { 2459 + $key = $group->getKey(); 2460 + 2461 + if (isset($map[$key])) { 2462 + throw new Exception( 2463 + pht( 2464 + 'Extension "%s" defines a bulk edit group with the same key '. 2465 + '("%s") as the main editor or another extension. Each bulk '. 2466 + 'edit group must have a unique key.')); 2467 + } 2468 + 2469 + $map[$key] = $group; 2470 + } 2471 + } 2472 + 2473 + return $map; 2474 + } 2475 + 2476 + protected function newBulkEditGroups() { 2477 + return array( 2478 + id(new PhabricatorBulkEditGroup()) 2479 + ->setKey('default') 2480 + ->setLabel(pht('Primary Fields')), 2481 + id(new PhabricatorBulkEditGroup()) 2482 + ->setKey('extension') 2483 + ->setLabel(pht('Support Applications')), 2484 + ); 2485 + } 2427 2486 2428 2487 final public function newBulkEditMap() { 2429 2488 $config = $this->loadDefaultConfiguration(); ··· 2434 2493 2435 2494 $object = $this->newEditableObject(); 2436 2495 $fields = $this->buildEditFields($object); 2496 + $groups = $this->newBulkEditGroupMap(); 2437 2497 2438 2498 $edit_types = $this->getBulkEditTypesFromFields($fields); 2439 2499 ··· 2449 2509 continue; 2450 2510 } 2451 2511 2512 + $group_key = $type->getBulkEditGroupKey(); 2513 + if (!$group_key) { 2514 + $group_key = 'default'; 2515 + } 2516 + 2517 + if (!isset($groups[$group_key])) { 2518 + throw new Exception( 2519 + pht( 2520 + 'Field "%s" has a bulk edit group key ("%s") with no '. 2521 + 'corresponding bulk edit group.', 2522 + $key, 2523 + $group_key)); 2524 + } 2525 + 2452 2526 $map[] = array( 2453 2527 'label' => $bulk_label, 2454 2528 'xaction' => $key, 2529 + 'group' => $group_key, 2455 2530 'control' => array( 2456 2531 'type' => $bulk_type->getPHUIXControlType(), 2457 2532 'spec' => (object)$bulk_type->getPHUIXControlSpecification(),
+10
src/applications/transactions/editfield/PhabricatorEditField.php
··· 18 18 private $controlID; 19 19 private $controlInstructions; 20 20 private $bulkEditLabel; 21 + private $bulkEditGroupKey; 21 22 22 23 private $description; 23 24 private $conduitDescription; ··· 73 74 74 75 public function getBulkEditLabel() { 75 76 return $this->bulkEditLabel; 77 + } 78 + 79 + public function setBulkEditGroupKey($key) { 80 + $this->bulkEditGroupKey = $key; 81 + return $this; 82 + } 83 + 84 + public function getBulkEditGroupKey() { 85 + return $this->bulkEditGroupKey; 76 86 } 77 87 78 88 public function setViewer(PhabricatorUser $viewer) {
+14
src/applications/transactions/edittype/PhabricatorEditType.php
··· 15 15 16 16 private $bulkParameterType; 17 17 private $bulkEditLabel; 18 + private $bulkEditGroupKey; 18 19 19 20 public function setLabel($label) { 20 21 $this->label = $label; ··· 36 37 } 37 38 38 39 return $this->getEditField()->getBulkEditLabel(); 40 + } 41 + 42 + public function setBulkEditGroupKey($key) { 43 + $this->bulkEditGroupKey = $key; 44 + return $this; 45 + } 46 + 47 + public function getBulkEditGroupKey() { 48 + if ($this->bulkEditGroupKey !== null) { 49 + return $this->bulkEditGroupKey; 50 + } 51 + 52 + return $this->getEditField()->getBulkEditGroupKey(); 39 53 } 40 54 41 55 public function setEditType($edit_type) {
+9
src/applications/transactions/engineextension/PhabricatorCommentEditEngineExtension.php
··· 33 33 return (bool)$comment; 34 34 } 35 35 36 + public function newBulkEditGroups(PhabricatorEditEngine $engine) { 37 + return array( 38 + id(new PhabricatorBulkEditGroup()) 39 + ->setKey('comments') 40 + ->setLabel(pht('Comments')), 41 + ); 42 + } 43 + 36 44 public function buildCustomEditFields( 37 45 PhabricatorEditEngine $engine, 38 46 PhabricatorApplicationTransactionInterface $object) { ··· 47 55 ->setKey(self::EDITKEY) 48 56 ->setLabel(pht('Comments')) 49 57 ->setBulkEditLabel(pht('Add comment')) 58 + ->setBulkEditGroupKey('comments') 50 59 ->setAliases(array('comments')) 51 60 ->setIsHidden(true) 52 61 ->setIsReorderable(false)
+4
src/applications/transactions/engineextension/PhabricatorEditEngineExtension.php
··· 32 32 PhabricatorEditEngine $engine, 33 33 PhabricatorApplicationTransactionInterface $object); 34 34 35 + public function newBulkEditGroups(PhabricatorEditEngine $engine) { 36 + return array(); 37 + } 38 + 35 39 final public static function getAllExtensions() { 36 40 return id(new PhutilClassMapQuery()) 37 41 ->setAncestorClass(__CLASS__)
+13
src/infrastructure/customfield/engineextension/PhabricatorCustomFieldEditEngineExtension.php
··· 23 23 return ($object instanceof PhabricatorCustomFieldInterface); 24 24 } 25 25 26 + public function newBulkEditGroups(PhabricatorEditEngine $engine) { 27 + return array( 28 + id(new PhabricatorBulkEditGroup()) 29 + ->setKey('custom') 30 + ->setLabel(pht('Custom Fields')), 31 + ); 32 + } 33 + 26 34 public function buildCustomEditFields( 27 35 PhabricatorEditEngine $engine, 28 36 PhabricatorApplicationTransactionInterface $object) { ··· 43 51 foreach ($field_list->getFields() as $field) { 44 52 $edit_fields = $field->getEditEngineFields($engine); 45 53 foreach ($edit_fields as $edit_field) { 54 + $group_key = $edit_field->getBulkEditGroupKey(); 55 + if ($group_key === null) { 56 + $edit_field->setBulkEditGroupKey('custom'); 57 + } 58 + 46 59 $results[] = $edit_field; 47 60 } 48 61 }
+3 -6
webroot/rsrc/js/core/behavior-bulk-editor.js
··· 3 3 * @requires javelin-behavior 4 4 * javelin-dom 5 5 * javelin-util 6 - * phabricator-prefab 7 6 * multirow-row-manager 8 7 * javelin-json 9 8 * phuix-form-control-view ··· 31 30 } 32 31 33 32 function renderRow() { 34 - var action_select = JX.Prefab.renderSelect( 35 - option_map, 36 - null, 37 - null, 38 - option_order); 33 + var action_select = new JX.PHUIXFormControl() 34 + .setControl('optgroups', config.optgroups) 35 + .getRawInputNode(); 39 36 40 37 var cell = JX.$N('td', {className: 'bulk-edit-input'}); 41 38 var vfunc = null;