@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.

Make Dashboard tab panels editable by humans

Summary: Fixes T5335. This is not pretty, but should reasonably let normal humans create tab panels.

Test Plan: See screenshot.

Reviewers: chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T5335

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

+82 -5
+2
src/__phutil_library_map__.php
··· 1498 1498 'PhabricatorDashboardPanelSearchApplicationCustomField' => 'applications/dashboard/customfield/PhabricatorDashboardPanelSearchApplicationCustomField.php', 1499 1499 'PhabricatorDashboardPanelSearchEngine' => 'applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php', 1500 1500 'PhabricatorDashboardPanelSearchQueryCustomField' => 'applications/dashboard/customfield/PhabricatorDashboardPanelSearchQueryCustomField.php', 1501 + 'PhabricatorDashboardPanelTabsCustomField' => 'applications/dashboard/customfield/PhabricatorDashboardPanelTabsCustomField.php', 1501 1502 'PhabricatorDashboardPanelTransaction' => 'applications/dashboard/storage/PhabricatorDashboardPanelTransaction.php', 1502 1503 'PhabricatorDashboardPanelTransactionEditor' => 'applications/dashboard/editor/PhabricatorDashboardPanelTransactionEditor.php', 1503 1504 'PhabricatorDashboardPanelTransactionQuery' => 'applications/dashboard/query/PhabricatorDashboardPanelTransactionQuery.php', ··· 4319 4320 'PhabricatorDashboardPanelSearchApplicationCustomField' => 'PhabricatorStandardCustomField', 4320 4321 'PhabricatorDashboardPanelSearchEngine' => 'PhabricatorApplicationSearchEngine', 4321 4322 'PhabricatorDashboardPanelSearchQueryCustomField' => 'PhabricatorStandardCustomField', 4323 + 'PhabricatorDashboardPanelTabsCustomField' => 'PhabricatorStandardCustomField', 4322 4324 'PhabricatorDashboardPanelTransaction' => 'PhabricatorApplicationTransaction', 4323 4325 'PhabricatorDashboardPanelTransactionEditor' => 'PhabricatorApplicationTransactionEditor', 4324 4326 'PhabricatorDashboardPanelTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
+71
src/applications/dashboard/customfield/PhabricatorDashboardPanelTabsCustomField.php
··· 1 + <?php 2 + 3 + final class PhabricatorDashboardPanelTabsCustomField 4 + extends PhabricatorStandardCustomField { 5 + 6 + public function getFieldType() { 7 + return 'dashboard.tabs'; 8 + } 9 + 10 + public function shouldAppearInApplicationSearch() { 11 + return false; 12 + } 13 + 14 + public function readValueFromRequest(AphrontRequest $request) { 15 + $value = array(); 16 + 17 + $names = $request->getArr($this->getFieldKey().'_name'); 18 + $panels = $request->getArr($this->getFieldKey().'_panelID'); 19 + foreach ($names as $idx => $name) { 20 + $panel_id = idx($panels, $idx); 21 + if (strlen($name) && $panel_id) { 22 + $value[] = array( 23 + 'name' => $name, 24 + 'panelID' => $panel_id, 25 + ); 26 + } 27 + } 28 + 29 + $this->setFieldValue($value); 30 + } 31 + 32 + public function renderEditControl(array $handles) { 33 + $panels = id(new PhabricatorDashboardPanelQuery()) 34 + ->setViewer($this->getViewer()) 35 + ->execute(); 36 + 37 + $panel_map = array(); 38 + foreach ($panels as $panel) { 39 + $panel_map[$panel->getID()] = pht( 40 + '%s %s', 41 + $panel->getMonogram(), 42 + $panel->getName()); 43 + } 44 + $panel_map = array( 45 + '' => pht('(None)'), 46 + ) + $panel_map; 47 + 48 + $value = $this->getFieldValue(); 49 + if (!is_array($value)) { 50 + $value = array(); 51 + } 52 + 53 + $out = array(); 54 + for ($ii = 1; $ii <= 6; $ii++) { 55 + $tab = idx($value, ($ii - 1), array()); 56 + $out[] = id(new AphrontFormTextControl()) 57 + ->setName($this->getFieldKey().'_name[]') 58 + ->setValue(idx($tab, 'name')) 59 + ->setLabel(pht('Tab %d Name', $ii)); 60 + 61 + $out[] = id(new AphrontFormSelectControl()) 62 + ->setName($this->getFieldKey().'_panelID[]') 63 + ->setValue(idx($tab, 'panelID')) 64 + ->setOptions($panel_map) 65 + ->setLabel(pht('Tab %d Panel', $ii)); 66 + } 67 + 68 + return $out; 69 + } 70 + 71 + }
+9 -5
src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeTabs.php
··· 19 19 public function getFieldSpecifications() { 20 20 return array( 21 21 'config' => array( 22 - 'name' => pht('JSON Config'), 23 - 'type' => 'remarkup', 22 + 'name' => pht('Tabs'), 23 + 'type' => 'dashboard.tabs', 24 24 ), 25 25 ); 26 26 } ··· 35 35 PhabricatorDashboardPanel $panel, 36 36 PhabricatorDashboardPanelRenderingEngine $engine) { 37 37 38 - $config = phutil_json_decode($panel->getProperty('config'), null); 39 - if ($config === null) { 40 - throw new Exception(pht('The configuration is not valid JSON.')); 38 + $config = $panel->getProperty('config'); 39 + if (!is_array($config)) { 40 + // NOTE: The older version of this panel stored raw JSON. 41 + $config = phutil_json_decode($config, null); 42 + if ($config === null) { 43 + throw new Exception(pht('The configuration is not valid JSON.')); 44 + } 41 45 } 42 46 43 47 $list = id(new PHUIListView())