1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 11:30:55 +01:00

Rename "ProfilePanelConfiguration" to "ProfileMenuItemConfiguration"

Summary:
Ref T11957. This renames the Configuration storage, transaction, query, and PHID type.

No rename on the actual menu item types yet, that's next (and should be the end of this, I think).

Test Plan:
  - Viewed projects.
  - Viewed profiles.
  - Edited a project menu.
  - Grepped for all renamed symbols, I think?

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11957

Differential Revision: https://secure.phabricator.com/D17027
This commit is contained in:
epriestley 2016-12-11 09:38:06 -08:00
parent d6704705a7
commit 8480776ccd
30 changed files with 221 additions and 199 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_search.search_profilepanelconfiguration
CHANGE panelKey menuItemKey VARCHAR(64) NOT NULL COLLATE {$COLLATE_TEXT};

View file

@ -0,0 +1,3 @@
ALTER TABLE {$NAMESPACE}_search.search_profilepanelconfiguration
CHANGE panelProperties menuItemProperties
LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT};

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_search.search_profilepanelconfiguration
CHANGE panelOrder menuItemOrder INT UNSIGNED;

View file

@ -3365,15 +3365,15 @@ phutil_register_library_map(array(
'PhabricatorPonderApplication' => 'applications/ponder/application/PhabricatorPonderApplication.php', 'PhabricatorPonderApplication' => 'applications/ponder/application/PhabricatorPonderApplication.php',
'PhabricatorProfileMenuCollapsedSetting' => 'applications/settings/setting/PhabricatorProfileMenuCollapsedSetting.php', 'PhabricatorProfileMenuCollapsedSetting' => 'applications/settings/setting/PhabricatorProfileMenuCollapsedSetting.php',
'PhabricatorProfileMenuEditEngine' => 'applications/search/editor/PhabricatorProfileMenuEditEngine.php', 'PhabricatorProfileMenuEditEngine' => 'applications/search/editor/PhabricatorProfileMenuEditEngine.php',
'PhabricatorProfileMenuEditor' => 'applications/search/editor/PhabricatorProfileMenuEditor.php',
'PhabricatorProfileMenuEngine' => 'applications/search/engine/PhabricatorProfileMenuEngine.php', 'PhabricatorProfileMenuEngine' => 'applications/search/engine/PhabricatorProfileMenuEngine.php',
'PhabricatorProfileMenuItemConfiguration' => 'applications/search/storage/PhabricatorProfileMenuItemConfiguration.php',
'PhabricatorProfileMenuItemConfigurationQuery' => 'applications/search/query/PhabricatorProfileMenuItemConfigurationQuery.php',
'PhabricatorProfileMenuItemConfigurationTransaction' => 'applications/search/storage/PhabricatorProfileMenuItemConfigurationTransaction.php',
'PhabricatorProfileMenuItemConfigurationTransactionQuery' => 'applications/search/query/PhabricatorProfileMenuItemConfigurationTransactionQuery.php',
'PhabricatorProfileMenuItemPHIDType' => 'applications/search/phidtype/PhabricatorProfileMenuItemPHIDType.php',
'PhabricatorProfilePanel' => 'applications/search/profilepanel/PhabricatorProfilePanel.php', 'PhabricatorProfilePanel' => 'applications/search/profilepanel/PhabricatorProfilePanel.php',
'PhabricatorProfilePanelConfiguration' => 'applications/search/storage/PhabricatorProfilePanelConfiguration.php',
'PhabricatorProfilePanelConfigurationQuery' => 'applications/search/query/PhabricatorProfilePanelConfigurationQuery.php',
'PhabricatorProfilePanelConfigurationTransaction' => 'applications/search/storage/PhabricatorProfilePanelConfigurationTransaction.php',
'PhabricatorProfilePanelConfigurationTransactionQuery' => 'applications/search/query/PhabricatorProfilePanelConfigurationTransactionQuery.php',
'PhabricatorProfilePanelEditor' => 'applications/search/editor/PhabricatorProfilePanelEditor.php',
'PhabricatorProfilePanelIconSet' => 'applications/search/profilepanel/PhabricatorProfilePanelIconSet.php', 'PhabricatorProfilePanelIconSet' => 'applications/search/profilepanel/PhabricatorProfilePanelIconSet.php',
'PhabricatorProfilePanelPHIDType' => 'applications/search/phidtype/PhabricatorProfilePanelPHIDType.php',
'PhabricatorProject' => 'applications/project/storage/PhabricatorProject.php', 'PhabricatorProject' => 'applications/project/storage/PhabricatorProject.php',
'PhabricatorProjectAddHeraldAction' => 'applications/project/herald/PhabricatorProjectAddHeraldAction.php', 'PhabricatorProjectAddHeraldAction' => 'applications/project/herald/PhabricatorProjectAddHeraldAction.php',
'PhabricatorProjectApplication' => 'applications/project/application/PhabricatorProjectApplication.php', 'PhabricatorProjectApplication' => 'applications/project/application/PhabricatorProjectApplication.php',
@ -8451,20 +8451,20 @@ phutil_register_library_map(array(
'PhabricatorPonderApplication' => 'PhabricatorApplication', 'PhabricatorPonderApplication' => 'PhabricatorApplication',
'PhabricatorProfileMenuCollapsedSetting' => 'PhabricatorInternalSetting', 'PhabricatorProfileMenuCollapsedSetting' => 'PhabricatorInternalSetting',
'PhabricatorProfileMenuEditEngine' => 'PhabricatorEditEngine', 'PhabricatorProfileMenuEditEngine' => 'PhabricatorEditEngine',
'PhabricatorProfileMenuEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorProfileMenuEngine' => 'Phobject', 'PhabricatorProfileMenuEngine' => 'Phobject',
'PhabricatorProfilePanel' => 'Phobject', 'PhabricatorProfileMenuItemConfiguration' => array(
'PhabricatorProfilePanelConfiguration' => array(
'PhabricatorSearchDAO', 'PhabricatorSearchDAO',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
'PhabricatorExtendedPolicyInterface', 'PhabricatorExtendedPolicyInterface',
'PhabricatorApplicationTransactionInterface', 'PhabricatorApplicationTransactionInterface',
), ),
'PhabricatorProfilePanelConfigurationQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorProfileMenuItemConfigurationQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorProfilePanelConfigurationTransaction' => 'PhabricatorApplicationTransaction', 'PhabricatorProfileMenuItemConfigurationTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorProfilePanelConfigurationTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'PhabricatorProfileMenuItemConfigurationTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorProfilePanelEditor' => 'PhabricatorApplicationTransactionEditor', 'PhabricatorProfileMenuItemPHIDType' => 'PhabricatorPHIDType',
'PhabricatorProfilePanel' => 'Phobject',
'PhabricatorProfilePanelIconSet' => 'PhabricatorIconSet', 'PhabricatorProfilePanelIconSet' => 'PhabricatorIconSet',
'PhabricatorProfilePanelPHIDType' => 'PhabricatorPHIDType',
'PhabricatorProject' => array( 'PhabricatorProject' => array(
'PhabricatorProjectDAO', 'PhabricatorProjectDAO',
'PhabricatorApplicationTransactionInterface', 'PhabricatorApplicationTransactionInterface',

View file

@ -24,7 +24,7 @@ final class PhabricatorPeopleProfileMenuEngine
$panels[] = $this->newPanel() $panels[] = $this->newPanel()
->setBuiltinKey(self::PANEL_PROFILE) ->setBuiltinKey(self::PANEL_PROFILE)
->setPanelKey(PhabricatorPeopleDetailsProfilePanel::PANELKEY); ->setMenuItemKey(PhabricatorPeopleDetailsProfilePanel::PANELKEY);
$have_maniphest = PhabricatorApplication::isClassInstalledForViewer( $have_maniphest = PhabricatorApplication::isClassInstalledForViewer(
'PhabricatorManiphestApplication', 'PhabricatorManiphestApplication',
@ -36,10 +36,10 @@ final class PhabricatorPeopleProfileMenuEngine
$panels[] = $this->newPanel() $panels[] = $this->newPanel()
->setBuiltinKey('tasks') ->setBuiltinKey('tasks')
->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY) ->setMenuItemKey(PhabricatorLinkProfilePanel::PANELKEY)
->setPanelProperty('icon', 'maniphest') ->setMenuItemProperty('icon', 'maniphest')
->setPanelProperty('name', pht('Open Tasks')) ->setMenuItemProperty('name', pht('Open Tasks'))
->setPanelProperty('uri', $uri); ->setMenuItemProperty('uri', $uri);
} }
$have_differential = PhabricatorApplication::isClassInstalledForViewer( $have_differential = PhabricatorApplication::isClassInstalledForViewer(
@ -52,10 +52,10 @@ final class PhabricatorPeopleProfileMenuEngine
$panels[] = $this->newPanel() $panels[] = $this->newPanel()
->setBuiltinKey('revisions') ->setBuiltinKey('revisions')
->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY) ->setMenuItemKey(PhabricatorLinkProfilePanel::PANELKEY)
->setPanelProperty('icon', 'differential') ->setMenuItemProperty('icon', 'differential')
->setPanelProperty('name', pht('Revisions')) ->setMenuItemProperty('name', pht('Revisions'))
->setPanelProperty('uri', $uri); ->setMenuItemProperty('uri', $uri);
} }
$have_diffusion = PhabricatorApplication::isClassInstalledForViewer( $have_diffusion = PhabricatorApplication::isClassInstalledForViewer(
@ -68,15 +68,15 @@ final class PhabricatorPeopleProfileMenuEngine
$panels[] = $this->newPanel() $panels[] = $this->newPanel()
->setBuiltinKey('commits') ->setBuiltinKey('commits')
->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY) ->setMenuItemKey(PhabricatorLinkProfilePanel::PANELKEY)
->setPanelProperty('icon', 'diffusion') ->setMenuItemProperty('icon', 'diffusion')
->setPanelProperty('name', pht('Commits')) ->setMenuItemProperty('name', pht('Commits'))
->setPanelProperty('uri', $uri); ->setMenuItemProperty('uri', $uri);
} }
$panels[] = $this->newPanel() $panels[] = $this->newPanel()
->setBuiltinKey(self::PANEL_MANAGE) ->setBuiltinKey(self::PANEL_MANAGE)
->setPanelKey(PhabricatorPeopleManageProfilePanel::PANELKEY); ->setMenuItemKey(PhabricatorPeopleManageProfilePanel::PANELKEY);
return $panels; return $panels;
} }

View file

@ -14,8 +14,8 @@ final class PhabricatorPeopleDetailsProfilePanel
} }
public function getDisplayName( public function getDisplayName(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$name = $config->getPanelProperty('name'); $name = $config->getMenuItemProperty('name');
if (strlen($name)) { if (strlen($name)) {
return $name; return $name;
@ -25,18 +25,18 @@ final class PhabricatorPeopleDetailsProfilePanel
} }
public function buildEditEngineFields( public function buildEditEngineFields(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return array( return array(
id(new PhabricatorTextEditField()) id(new PhabricatorTextEditField())
->setKey('name') ->setKey('name')
->setLabel(pht('Name')) ->setLabel(pht('Name'))
->setPlaceholder($this->getDefaultName()) ->setPlaceholder($this->getDefaultName())
->setValue($config->getPanelProperty('name')), ->setValue($config->getMenuProperty('name')),
); );
} }
protected function newNavigationMenuItems( protected function newNavigationMenuItems(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$user = $config->getProfileObject(); $user = $config->getProfileObject();

View file

@ -14,13 +14,13 @@ final class PhabricatorPeopleManageProfilePanel
} }
public function canHidePanel( public function canHidePanel(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return false; return false;
} }
public function getDisplayName( public function getDisplayName(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$name = $config->getPanelProperty('name'); $name = $config->getMenuItemProperty('name');
if (strlen($name)) { if (strlen($name)) {
return $name; return $name;
@ -30,18 +30,18 @@ final class PhabricatorPeopleManageProfilePanel
} }
public function buildEditEngineFields( public function buildEditEngineFields(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return array( return array(
id(new PhabricatorTextEditField()) id(new PhabricatorTextEditField())
->setKey('name') ->setKey('name')
->setLabel(pht('Name')) ->setLabel(pht('Name'))
->setPlaceholder($this->getDefaultName()) ->setPlaceholder($this->getDefaultName())
->setValue($config->getPanelProperty('name')), ->setValue($config->getMenuItemProperty('name')),
); );
} }
protected function newNavigationMenuItems( protected function newNavigationMenuItems(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$user = $config->getProfileObject(); $user = $config->getProfileObject();
$id = $user->getID(); $id = $user->getID();

View file

@ -18,27 +18,27 @@ final class PhabricatorProjectProfileMenuEngine
$panels[] = $this->newPanel() $panels[] = $this->newPanel()
->setBuiltinKey(PhabricatorProject::PANEL_PROFILE) ->setBuiltinKey(PhabricatorProject::PANEL_PROFILE)
->setPanelKey(PhabricatorProjectDetailsProfilePanel::PANELKEY); ->setMenuItemKey(PhabricatorProjectDetailsProfilePanel::PANELKEY);
$panels[] = $this->newPanel() $panels[] = $this->newPanel()
->setBuiltinKey(PhabricatorProject::PANEL_POINTS) ->setBuiltinKey(PhabricatorProject::PANEL_POINTS)
->setPanelKey(PhabricatorProjectPointsProfilePanel::PANELKEY); ->setMenuItemKey(PhabricatorProjectPointsProfilePanel::PANELKEY);
$panels[] = $this->newPanel() $panels[] = $this->newPanel()
->setBuiltinKey(PhabricatorProject::PANEL_WORKBOARD) ->setBuiltinKey(PhabricatorProject::PANEL_WORKBOARD)
->setPanelKey(PhabricatorProjectWorkboardProfilePanel::PANELKEY); ->setMenuItemKey(PhabricatorProjectWorkboardProfilePanel::PANELKEY);
$panels[] = $this->newPanel() $panels[] = $this->newPanel()
->setBuiltinKey(PhabricatorProject::PANEL_MEMBERS) ->setBuiltinKey(PhabricatorProject::PANEL_MEMBERS)
->setPanelKey(PhabricatorProjectMembersProfilePanel::PANELKEY); ->setMenuItemKey(PhabricatorProjectMembersProfilePanel::PANELKEY);
$panels[] = $this->newPanel() $panels[] = $this->newPanel()
->setBuiltinKey(PhabricatorProject::PANEL_SUBPROJECTS) ->setBuiltinKey(PhabricatorProject::PANEL_SUBPROJECTS)
->setPanelKey(PhabricatorProjectSubprojectsProfilePanel::PANELKEY); ->setMenuItemKey(PhabricatorProjectSubprojectsProfilePanel::PANELKEY);
$panels[] = $this->newPanel() $panels[] = $this->newPanel()
->setBuiltinKey(PhabricatorProject::PANEL_MANAGE) ->setBuiltinKey(PhabricatorProject::PANEL_MANAGE)
->setPanelKey(PhabricatorProjectManageProfilePanel::PANELKEY); ->setMenuItemKey(PhabricatorProjectManageProfilePanel::PANELKEY);
return $panels; return $panels;
} }

View file

@ -14,13 +14,13 @@ final class PhabricatorProjectDetailsProfilePanel
} }
public function canMakeDefault( public function canMakeDefault(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return true; return true;
} }
public function getDisplayName( public function getDisplayName(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$name = $config->getPanelProperty('name'); $name = $config->getMenuItemProperty('name');
if (strlen($name)) { if (strlen($name)) {
return $name; return $name;
@ -30,18 +30,18 @@ final class PhabricatorProjectDetailsProfilePanel
} }
public function buildEditEngineFields( public function buildEditEngineFields(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return array( return array(
id(new PhabricatorTextEditField()) id(new PhabricatorTextEditField())
->setKey('name') ->setKey('name')
->setLabel(pht('Name')) ->setLabel(pht('Name'))
->setPlaceholder($this->getDefaultName()) ->setPlaceholder($this->getDefaultName())
->setValue($config->getPanelProperty('name')), ->setValue($config->getMenuItemProperty('name')),
); );
} }
protected function newNavigationMenuItems( protected function newNavigationMenuItems(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$project = $config->getProfileObject(); $project = $config->getProfileObject();

View file

@ -14,18 +14,18 @@ final class PhabricatorProjectManageProfilePanel
} }
public function canHidePanel( public function canHidePanel(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return false; return false;
} }
public function canMakeDefault( public function canMakeDefault(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return true; return true;
} }
public function getDisplayName( public function getDisplayName(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$name = $config->getPanelProperty('name'); $name = $config->getMenuItemProperty('name');
if (strlen($name)) { if (strlen($name)) {
return $name; return $name;
@ -35,18 +35,18 @@ final class PhabricatorProjectManageProfilePanel
} }
public function buildEditEngineFields( public function buildEditEngineFields(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return array( return array(
id(new PhabricatorTextEditField()) id(new PhabricatorTextEditField())
->setKey('name') ->setKey('name')
->setLabel(pht('Name')) ->setLabel(pht('Name'))
->setPlaceholder($this->getDefaultName()) ->setPlaceholder($this->getDefaultName())
->setValue($config->getPanelProperty('name')), ->setValue($config->getMenuItemProperty('name')),
); );
} }
protected function newNavigationMenuItems( protected function newNavigationMenuItems(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$project = $config->getProfileObject(); $project = $config->getProfileObject();

View file

@ -14,8 +14,8 @@ final class PhabricatorProjectMembersProfilePanel
} }
public function getDisplayName( public function getDisplayName(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$name = $config->getPanelProperty('name'); $name = $config->getMenuItemProperty('name');
if (strlen($name)) { if (strlen($name)) {
return $name; return $name;
@ -25,18 +25,18 @@ final class PhabricatorProjectMembersProfilePanel
} }
public function buildEditEngineFields( public function buildEditEngineFields(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return array( return array(
id(new PhabricatorTextEditField()) id(new PhabricatorTextEditField())
->setKey('name') ->setKey('name')
->setLabel(pht('Name')) ->setLabel(pht('Name'))
->setPlaceholder($this->getDefaultName()) ->setPlaceholder($this->getDefaultName())
->setValue($config->getPanelProperty('name')), ->setValue($config->getMenuItemProperty('name')),
); );
} }
protected function newNavigationMenuItems( protected function newNavigationMenuItems(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$project = $config->getProfileObject(); $project = $config->getProfileObject();

View file

@ -36,12 +36,12 @@ final class PhabricatorProjectPointsProfilePanel
} }
public function getDisplayName( public function getDisplayName(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return $this->getDefaultName(); return $this->getDefaultName();
} }
public function buildEditEngineFields( public function buildEditEngineFields(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return array( return array(
id(new PhabricatorInstructionsEditField()) id(new PhabricatorInstructionsEditField())
->setValue( ->setValue(
@ -53,7 +53,7 @@ final class PhabricatorProjectPointsProfilePanel
} }
protected function newNavigationMenuItems( protected function newNavigationMenuItems(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$project = $config->getProfileObject(); $project = $config->getProfileObject();

View file

@ -22,8 +22,8 @@ final class PhabricatorProjectSubprojectsProfilePanel
} }
public function getDisplayName( public function getDisplayName(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$name = $config->getPanelProperty('name'); $name = $config->getMenuItemProperty('name');
if (strlen($name)) { if (strlen($name)) {
return $name; return $name;
@ -33,18 +33,18 @@ final class PhabricatorProjectSubprojectsProfilePanel
} }
public function buildEditEngineFields( public function buildEditEngineFields(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return array( return array(
id(new PhabricatorTextEditField()) id(new PhabricatorTextEditField())
->setKey('name') ->setKey('name')
->setLabel(pht('Name')) ->setLabel(pht('Name'))
->setPlaceholder($this->getDefaultName()) ->setPlaceholder($this->getDefaultName())
->setValue($config->getPanelProperty('name')), ->setValue($config->getMenuItemProperty('name')),
); );
} }
protected function newNavigationMenuItems( protected function newNavigationMenuItems(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$project = $config->getProfileObject(); $project = $config->getProfileObject();

View file

@ -14,7 +14,7 @@ final class PhabricatorProjectWorkboardProfilePanel
} }
public function canMakeDefault( public function canMakeDefault(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return true; return true;
} }
@ -31,8 +31,8 @@ final class PhabricatorProjectWorkboardProfilePanel
} }
public function getDisplayName( public function getDisplayName(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$name = $config->getPanelProperty('name'); $name = $config->getMenuItemProperty('name');
if (strlen($name)) { if (strlen($name)) {
return $name; return $name;
@ -42,18 +42,18 @@ final class PhabricatorProjectWorkboardProfilePanel
} }
public function buildEditEngineFields( public function buildEditEngineFields(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return array( return array(
id(new PhabricatorTextEditField()) id(new PhabricatorTextEditField())
->setKey('name') ->setKey('name')
->setLabel(pht('Name')) ->setLabel(pht('Name'))
->setPlaceholder($this->getDefaultName()) ->setPlaceholder($this->getDefaultName())
->setValue($config->getPanelProperty('name')), ->setValue($config->getMenuItemProperty('name')),
); );
} }
protected function newNavigationMenuItems( protected function newNavigationMenuItems(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$project = $config->getProfileObject(); $project = $config->getProfileObject();
$has_workboard = $project->getHasWorkboard(); $has_workboard = $project->getHasWorkboard();

View file

@ -33,7 +33,7 @@ final class PhabricatorProfileMenuEditEngine
} }
public function setNewPanelConfiguration( public function setNewPanelConfiguration(
PhabricatorProfilePanelConfiguration $configuration) { PhabricatorProfileMenuItemConfiguration $configuration) {
$this->newPanelConfiguration = $configuration; $this->newPanelConfiguration = $configuration;
return $this; return $this;
} }
@ -77,7 +77,7 @@ final class PhabricatorProfileMenuEditEngine
} }
protected function newObjectQuery() { protected function newObjectQuery() {
return id(new PhabricatorProfilePanelConfigurationQuery()); return id(new PhabricatorProfileMenuItemConfigurationQuery());
} }
protected function getObjectCreateTitleText($object) { protected function getObjectCreateTitleText($object) {
@ -125,7 +125,7 @@ final class PhabricatorProfileMenuEditEngine
$fields = $panel->buildEditEngineFields($object); $fields = $panel->buildEditEngineFields($object);
$type_property = $type_property =
PhabricatorProfilePanelConfigurationTransaction::TYPE_PROPERTY; PhabricatorProfileMenuItemConfigurationTransaction::TYPE_PROPERTY;
foreach ($fields as $field) { foreach ($fields as $field) {
$field $field

View file

@ -1,6 +1,6 @@
<?php <?php
final class PhabricatorProfilePanelEditor final class PhabricatorProfileMenuEditor
extends PhabricatorApplicationTransactionEditor { extends PhabricatorApplicationTransactionEditor {
public function getEditorApplicationClass() { public function getEditorApplicationClass() {
@ -8,15 +8,18 @@ final class PhabricatorProfilePanelEditor
} }
public function getEditorObjectsDescription() { public function getEditorObjectsDescription() {
return pht('Profile Panels'); return pht('Profile Menu Items');
} }
public function getTransactionTypes() { public function getTransactionTypes() {
$types = parent::getTransactionTypes(); $types = parent::getTransactionTypes();
$types[] = PhabricatorProfilePanelConfigurationTransaction::TYPE_PROPERTY; $types[] =
$types[] = PhabricatorProfilePanelConfigurationTransaction::TYPE_ORDER; PhabricatorProfileMenuItemConfigurationTransaction::TYPE_PROPERTY;
$types[] = PhabricatorProfilePanelConfigurationTransaction::TYPE_VISIBILITY; $types[] =
PhabricatorProfileMenuItemConfigurationTransaction::TYPE_ORDER;
$types[] =
PhabricatorProfileMenuItemConfigurationTransaction::TYPE_VISIBILITY;
return $types; return $types;
} }
@ -26,12 +29,12 @@ final class PhabricatorProfilePanelEditor
PhabricatorApplicationTransaction $xaction) { PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) { switch ($xaction->getTransactionType()) {
case PhabricatorProfilePanelConfigurationTransaction::TYPE_PROPERTY: case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_PROPERTY:
$key = $xaction->getMetadataValue('property.key'); $key = $xaction->getMetadataValue('property.key');
return $object->getPanelProperty($key, null); return $object->getMenuItemProperty($key, null);
case PhabricatorProfilePanelConfigurationTransaction::TYPE_ORDER: case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_ORDER:
return $object->getPanelOrder(); return $object->getMenuItemOrder();
case PhabricatorProfilePanelConfigurationTransaction::TYPE_VISIBILITY: case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_VISIBILITY:
return $object->getVisibility(); return $object->getVisibility();
} }
} }
@ -41,10 +44,10 @@ final class PhabricatorProfilePanelEditor
PhabricatorApplicationTransaction $xaction) { PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) { switch ($xaction->getTransactionType()) {
case PhabricatorProfilePanelConfigurationTransaction::TYPE_PROPERTY: case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_PROPERTY:
case PhabricatorProfilePanelConfigurationTransaction::TYPE_VISIBILITY: case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_VISIBILITY:
return $xaction->getNewValue(); return $xaction->getNewValue();
case PhabricatorProfilePanelConfigurationTransaction::TYPE_ORDER: case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_ORDER:
return (int)$xaction->getNewValue(); return (int)$xaction->getNewValue();
} }
} }
@ -54,15 +57,15 @@ final class PhabricatorProfilePanelEditor
PhabricatorApplicationTransaction $xaction) { PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) { switch ($xaction->getTransactionType()) {
case PhabricatorProfilePanelConfigurationTransaction::TYPE_PROPERTY: case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_PROPERTY:
$key = $xaction->getMetadataValue('property.key'); $key = $xaction->getMetadataValue('property.key');
$value = $xaction->getNewValue(); $value = $xaction->getNewValue();
$object->setPanelProperty($key, $value); $object->getMenuItemProperty($key, $value);
return; return;
case PhabricatorProfilePanelConfigurationTransaction::TYPE_ORDER: case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_ORDER:
$object->setPanelOrder($xaction->getNewValue()); $object->setMenuItemOrder($xaction->getNewValue());
return; return;
case PhabricatorProfilePanelConfigurationTransaction::TYPE_VISIBILITY: case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_VISIBILITY:
$object->setVisibility($xaction->getNewValue()); $object->setVisibility($xaction->getNewValue());
return; return;
} }
@ -75,9 +78,9 @@ final class PhabricatorProfilePanelEditor
PhabricatorApplicationTransaction $xaction) { PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) { switch ($xaction->getTransactionType()) {
case PhabricatorProfilePanelConfigurationTransaction::TYPE_PROPERTY: case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_PROPERTY:
case PhabricatorProfilePanelConfigurationTransaction::TYPE_ORDER: case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_ORDER:
case PhabricatorProfilePanelConfigurationTransaction::TYPE_VISIBILITY: case PhabricatorProfileMenuItemConfigurationTransaction::TYPE_VISIBILITY:
return; return;
} }

View file

@ -37,7 +37,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
} }
private function setDefaultPanel( private function setDefaultPanel(
PhabricatorProfilePanelConfiguration $default_panel) { PhabricatorProfileMenuItemConfiguration $default_panel) {
$this->defaultPanel = $default_panel; $this->defaultPanel = $default_panel;
return $this; return $this;
} }
@ -231,7 +231,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
$panels = $this->loadBuiltinProfilePanels(); $panels = $this->loadBuiltinProfilePanels();
$stored_panels = id(new PhabricatorProfilePanelConfigurationQuery()) $stored_panels = id(new PhabricatorProfileMenuItemConfigurationQuery())
->setViewer($viewer) ->setViewer($viewer)
->withProfilePHIDs(array($object->getPHID())) ->withProfilePHIDs(array($object->getPHID()))
->execute(); ->execute();
@ -327,7 +327,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
$builtin_key)); $builtin_key));
} }
$panel_key = $builtin->getPanelKey(); $panel_key = $builtin->getMenuItemKey();
$panel = idx($panels, $panel_key); $panel = idx($panels, $panel_key);
if (!$panel) { if (!$panel) {
@ -346,7 +346,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
->setProfilePHID($object->getPHID()) ->setProfilePHID($object->getPHID())
->attachPanel($panel) ->attachPanel($panel)
->attachProfileObject($object) ->attachProfileObject($object)
->setPanelOrder($order); ->setMenuItemOrder($order);
if (!$builtin->shouldEnableForObject($object)) { if (!$builtin->shouldEnableForObject($object)) {
continue; continue;
@ -488,17 +488,17 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
$panels = array_select_keys($panels, $key_order) + $panels; $panels = array_select_keys($panels, $key_order) + $panels;
$type_order = $type_order =
PhabricatorProfilePanelConfigurationTransaction::TYPE_ORDER; PhabricatorProfileMenuItemConfigurationTransaction::TYPE_ORDER;
$order = 1; $order = 1;
foreach ($panels as $panel) { foreach ($panels as $panel) {
$xactions = array(); $xactions = array();
$xactions[] = id(new PhabricatorProfilePanelConfigurationTransaction()) $xactions[] = id(new PhabricatorProfileMenuItemConfigurationTransaction())
->setTransactionType($type_order) ->setTransactionType($type_order)
->setNewValue($order); ->setNewValue($order);
$editor = id(new PhabricatorProfilePanelEditor()) $editor = id(new PhabricatorProfileMenuEditor())
->setContentSourceFromRequest($request) ->setContentSourceFromRequest($request)
->setActor($viewer) ->setActor($viewer)
->setContinueOnMissingFields(true) ->setContinueOnMissingFields(true)
@ -607,7 +607,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
$hide_text = pht('Delete'); $hide_text = pht('Delete');
} }
$can_disable = $panel->canHidePanel(); $can_disable = $panel->canHideMenuItem();
$item->addAction( $item->addAction(
id(new PHUIListItemView()) id(new PHUIListItemView())
@ -695,7 +695,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
} }
$configuration = $configuration =
PhabricatorProfilePanelConfiguration::initializeNewPanelConfiguration( PhabricatorProfileMenuItemConfiguration::initializeNewPanelConfiguration(
$object, $object,
$panel_type); $panel_type);
@ -729,7 +729,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
} }
private function buildPanelBuiltinContent( private function buildPanelBuiltinContent(
PhabricatorProfilePanelConfiguration $configuration) { PhabricatorProfileMenuItemConfiguration $configuration) {
// If this builtin panel has already been persisted, redirect to the // If this builtin panel has already been persisted, redirect to the
// edit page. // edit page.
@ -761,7 +761,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
} }
private function buildPanelHideContent( private function buildPanelHideContent(
PhabricatorProfilePanelConfiguration $configuration) { PhabricatorProfileMenuItemConfiguration $configuration) {
$controller = $this->getController(); $controller = $this->getController();
$request = $controller->getRequest(); $request = $controller->getRequest();
@ -772,7 +772,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
$configuration, $configuration,
PhabricatorPolicyCapability::CAN_EDIT); PhabricatorPolicyCapability::CAN_EDIT);
if (!$configuration->canHidePanel()) { if (!$configuration->canHideMenuItem()) {
return $controller->newDialog() return $controller->newDialog()
->setTitle(pht('Mandatory Panel')) ->setTitle(pht('Mandatory Panel'))
->appendParagraph( ->appendParagraph(
@ -787,14 +787,14 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
$body = pht('Delete this menu item?'); $body = pht('Delete this menu item?');
$button = pht('Delete Menu Item'); $button = pht('Delete Menu Item');
} else if ($configuration->isDisabled()) { } else if ($configuration->isDisabled()) {
$new_value = PhabricatorProfilePanelConfiguration::VISIBILITY_VISIBLE; $new_value = PhabricatorProfileMenuItemConfiguration::VISIBILITY_VISIBLE;
$title = pht('Enable Menu Item'); $title = pht('Enable Menu Item');
$body = pht( $body = pht(
'Enable this menu item? It will appear in the menu again.'); 'Enable this menu item? It will appear in the menu again.');
$button = pht('Enable Menu Item'); $button = pht('Enable Menu Item');
} else { } else {
$new_value = PhabricatorProfilePanelConfiguration::VISIBILITY_DISABLED; $new_value = PhabricatorProfileMenuItemConfiguration::VISIBILITY_DISABLED;
$title = pht('Disable Menu Item'); $title = pht('Disable Menu Item');
$body = pht( $body = pht(
@ -809,15 +809,16 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
$configuration->delete(); $configuration->delete();
} else { } else {
$type_visibility = $type_visibility =
PhabricatorProfilePanelConfigurationTransaction::TYPE_VISIBILITY; PhabricatorProfileMenuItemConfigurationTransaction::TYPE_VISIBILITY;
$xactions = array(); $xactions = array();
$xactions[] = id(new PhabricatorProfilePanelConfigurationTransaction()) $xactions[] =
id(new PhabricatorProfileMenuItemConfigurationTransaction())
->setTransactionType($type_visibility) ->setTransactionType($type_visibility)
->setNewValue($new_value); ->setNewValue($new_value);
$editor = id(new PhabricatorProfilePanelEditor()) $editor = id(new PhabricatorProfileMenuEditor())
->setContentSourceFromRequest($request) ->setContentSourceFromRequest($request)
->setActor($viewer) ->setActor($viewer)
->setContinueOnMissingFields(true) ->setContinueOnMissingFields(true)
@ -837,7 +838,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
} }
private function buildPanelDefaultContent( private function buildPanelDefaultContent(
PhabricatorProfilePanelConfiguration $configuration, PhabricatorProfileMenuItemConfiguration $configuration,
array $panels) { array $panels) {
$controller = $this->getController(); $controller = $this->getController();
@ -894,7 +895,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
} }
protected function newPanel() { protected function newPanel() {
return PhabricatorProfilePanelConfiguration::initializeNewBuiltin(); return PhabricatorProfileMenuItemConfiguration::initializeNewBuiltin();
} }
public function adjustDefault($key) { public function adjustDefault($key) {
@ -931,10 +932,10 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
} }
$type_visibility = $type_visibility =
PhabricatorProfilePanelConfigurationTransaction::TYPE_VISIBILITY; PhabricatorProfileMenuItemConfigurationTransaction::TYPE_VISIBILITY;
$v_visible = PhabricatorProfilePanelConfiguration::VISIBILITY_VISIBLE; $v_visible = PhabricatorProfileMenuItemConfiguration::VISIBILITY_VISIBLE;
$v_default = PhabricatorProfilePanelConfiguration::VISIBILITY_DEFAULT; $v_default = PhabricatorProfileMenuItemConfiguration::VISIBILITY_DEFAULT;
$apply = array( $apply = array(
array($v_visible, $visible), array($v_visible, $visible),
@ -946,11 +947,12 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
foreach ($panels as $panel) { foreach ($panels as $panel) {
$xactions = array(); $xactions = array();
$xactions[] = id(new PhabricatorProfilePanelConfigurationTransaction()) $xactions[] =
id(new PhabricatorProfileMenuItemConfigurationTransaction())
->setTransactionType($type_visibility) ->setTransactionType($type_visibility)
->setNewValue($value); ->setNewValue($value);
$editor = id(new PhabricatorProfilePanelEditor()) $editor = id(new PhabricatorProfileMenuEditor())
->setContentSourceFromRequest($request) ->setContentSourceFromRequest($request)
->setActor($viewer) ->setActor($viewer)
->setContinueOnMissingFields(true) ->setContinueOnMissingFields(true)

View file

@ -1,16 +1,16 @@
<?php <?php
final class PhabricatorProfilePanelPHIDType final class PhabricatorProfileMenuItemPHIDType
extends PhabricatorPHIDType { extends PhabricatorPHIDType {
const TYPECONST = 'PANL'; const TYPECONST = 'PANL';
public function getTypeName() { public function getTypeName() {
return pht('Profile Panel'); return pht('Profile Menu Item');
} }
public function newObject() { public function newObject() {
return new PhabricatorProfilePanelConfiguration(); return new PhabricatorProfileMenuItemConfiguration();
} }
public function getPHIDTypeApplicationClass() { public function getPHIDTypeApplicationClass() {
@ -20,7 +20,7 @@ final class PhabricatorProfilePanelPHIDType
protected function buildQueryForObjects( protected function buildQueryForObjects(
PhabricatorObjectQuery $object_query, PhabricatorObjectQuery $object_query,
array $phids) { array $phids) {
return id(new PhabricatorProfilePanelConfigurationQuery()) return id(new PhabricatorProfileMenuItemConfigurationQuery())
->withPHIDs($phids); ->withPHIDs($phids);
} }
@ -32,7 +32,7 @@ final class PhabricatorProfilePanelPHIDType
foreach ($handles as $phid => $handle) { foreach ($handles as $phid => $handle) {
$config = $objects[$phid]; $config = $objects[$phid];
$handle->setName(pht('Profile Panel')); $handle->setName(pht('Profile Menu Item'));
} }
} }

View file

@ -18,7 +18,7 @@ final class PhabricatorApplicationProfilePanel
} }
public function getDisplayName( public function getDisplayName(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$app = $this->getApplication($config); $app = $this->getApplication($config);
if ($app) { if ($app) {
return $app->getName(); return $app->getName();
@ -29,20 +29,20 @@ final class PhabricatorApplicationProfilePanel
} }
public function buildEditEngineFields( public function buildEditEngineFields(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return array( return array(
id(new PhabricatorDatasourceEditField()) id(new PhabricatorDatasourceEditField())
->setKey('application') ->setKey('application')
->setLabel(pht('Application')) ->setLabel(pht('Application'))
->setDatasource(new PhabricatorApplicationDatasource()) ->setDatasource(new PhabricatorApplicationDatasource())
->setSingleValue($config->getPanelProperty('application')), ->setSingleValue($config->getMenuItemProperty('application')),
); );
} }
private function getApplication( private function getApplication(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$phid = $config->getPanelProperty('application'); $phid = $config->getMenuItemProperty('application');
$app = id(new PhabricatorApplicationQuery()) $app = id(new PhabricatorApplicationQuery())
->setViewer($viewer) ->setViewer($viewer)
->withPHIDs(array($phid)) ->withPHIDs(array($phid))
@ -52,7 +52,7 @@ final class PhabricatorApplicationProfilePanel
} }
protected function newNavigationMenuItems( protected function newNavigationMenuItems(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$app = $this->getApplication($config); $app = $this->getApplication($config);
if (!$app) { if (!$app) {

View file

@ -18,12 +18,12 @@ final class PhabricatorDividerProfilePanel
} }
public function getDisplayName( public function getDisplayName(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return pht("\xE2\x80\x94"); return pht("\xE2\x80\x94");
} }
public function buildEditEngineFields( public function buildEditEngineFields(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return array( return array(
id(new PhabricatorInstructionsEditField()) id(new PhabricatorInstructionsEditField())
->setValue( ->setValue(
@ -35,7 +35,7 @@ final class PhabricatorDividerProfilePanel
} }
protected function newNavigationMenuItems( protected function newNavigationMenuItems(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$item = $this->newItem() $item = $this->newItem()
->addClass('phui-divider'); ->addClass('phui-divider');

View file

@ -18,12 +18,12 @@ final class PhabricatorLinkProfilePanel
} }
public function getDisplayName( public function getDisplayName(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return $this->getLinkName($config); return $this->getLinkName($config);
} }
public function buildEditEngineFields( public function buildEditEngineFields(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return array( return array(
id(new PhabricatorTextEditField()) id(new PhabricatorTextEditField())
->setKey('name') ->setKey('name')
@ -44,18 +44,18 @@ final class PhabricatorLinkProfilePanel
} }
private function getLinkName( private function getLinkName(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return $config->getPanelProperty('name'); return $config->getMenuItemProperty('name');
} }
private function getLinkIcon( private function getLinkIcon(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return $config->getPanelProperty('icon', 'link'); return $config->getMenuItemProperty('icon', 'link');
} }
private function getLinkURI( private function getLinkURI(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return $config->getPanelProperty('uri'); return $config->getMenuItemProperty('uri');
} }
private function isValidLinkURI($uri) { private function isValidLinkURI($uri) {
@ -63,7 +63,7 @@ final class PhabricatorLinkProfilePanel
} }
protected function newNavigationMenuItems( protected function newNavigationMenuItems(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$icon = $this->getLinkIcon($config); $icon = $this->getLinkIcon($config);
$name = $this->getLinkName($config); $name = $this->getLinkName($config);

View file

@ -18,10 +18,10 @@ final class PhabricatorMotivatorProfilePanel
} }
public function getDisplayName( public function getDisplayName(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$options = $this->getOptions(); $options = $this->getOptions();
$name = idx($options, $config->getPanelProperty('source')); $name = idx($options, $config->getMenuItemProperty('source'));
if ($name !== null) { if ($name !== null) {
return pht('Motivator: %s', $name); return pht('Motivator: %s', $name);
} else { } else {
@ -30,7 +30,7 @@ final class PhabricatorMotivatorProfilePanel
} }
public function buildEditEngineFields( public function buildEditEngineFields(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return array( return array(
id(new PhabricatorInstructionsEditField()) id(new PhabricatorInstructionsEditField())
->setValue( ->setValue(
@ -51,9 +51,9 @@ final class PhabricatorMotivatorProfilePanel
} }
protected function newNavigationMenuItems( protected function newNavigationMenuItems(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
$source = $config->getPanelProperty('source'); $source = $config->getMenuItemProperty('source');
switch ($source) { switch ($source) {
case 'catfacts': case 'catfacts':

View file

@ -5,12 +5,12 @@ abstract class PhabricatorProfilePanel extends Phobject {
private $viewer; private $viewer;
final public function buildNavigationMenuItems( final public function buildNavigationMenuItems(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return $this->newNavigationMenuItems($config); return $this->newNavigationMenuItems($config);
} }
abstract protected function newNavigationMenuItems( abstract protected function newNavigationMenuItems(
PhabricatorProfilePanelConfiguration $config); PhabricatorProfileMenuItemConfiguration $config);
public function getPanelTypeIcon() { public function getPanelTypeIcon() {
return null; return null;
@ -19,10 +19,10 @@ abstract class PhabricatorProfilePanel extends Phobject {
abstract public function getPanelTypeName(); abstract public function getPanelTypeName();
abstract public function getDisplayName( abstract public function getDisplayName(
PhabricatorProfilePanelConfiguration $config); PhabricatorProfileMenuItemConfiguration $config);
public function buildEditEngineFields( public function buildEditEngineFields(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return array(); return array();
} }
@ -35,12 +35,12 @@ abstract class PhabricatorProfilePanel extends Phobject {
} }
public function canHidePanel( public function canHidePanel(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return true; return true;
} }
public function canMakeDefault( public function canMakeDefault(
PhabricatorProfilePanelConfiguration $config) { PhabricatorProfileMenuItemConfiguration $config) {
return false; return false;
} }

View file

@ -1,6 +1,6 @@
<?php <?php
final class PhabricatorProfilePanelConfigurationQuery final class PhabricatorProfileMenuItemConfigurationQuery
extends PhabricatorCursorPagedPolicyAwareQuery { extends PhabricatorCursorPagedPolicyAwareQuery {
private $ids; private $ids;
@ -23,7 +23,7 @@ final class PhabricatorProfilePanelConfigurationQuery
} }
public function newResultObject() { public function newResultObject() {
return new PhabricatorProfilePanelConfiguration(); return new PhabricatorProfileMenuItemConfiguration();
} }
protected function loadPage() { protected function loadPage() {
@ -60,7 +60,7 @@ final class PhabricatorProfilePanelConfigurationQuery
protected function willFilterPage(array $page) { protected function willFilterPage(array $page) {
$panels = PhabricatorProfilePanel::getAllPanels(); $panels = PhabricatorProfilePanel::getAllPanels();
foreach ($page as $key => $panel) { foreach ($page as $key => $panel) {
$panel_type = idx($panels, $panel->getPanelKey()); $panel_type = idx($panels, $panel->getMenuItemKey());
if (!$panel_type) { if (!$panel_type) {
$this->didRejectResult($panel); $this->didRejectResult($panel);
unset($page[$key]); unset($page[$key]);

View file

@ -0,0 +1,10 @@
<?php
final class PhabricatorProfileMenuItemConfigurationTransactionQuery
extends PhabricatorApplicationTransactionQuery {
public function getTemplateApplicationTransaction() {
return new PhabricatorProfileMenuItemConfigurationTransaction();
}
}

View file

@ -1,10 +0,0 @@
<?php
final class PhabricatorProfilePanelConfigurationTransactionQuery
extends PhabricatorApplicationTransactionQuery {
public function getTemplateApplicationTransaction() {
return new PhabricatorProfilePanelConfigurationTransaction();
}
}

View file

@ -1,6 +1,6 @@
<?php <?php
final class PhabricatorProfilePanelConfiguration final class PhabricatorProfileMenuItemConfiguration
extends PhabricatorSearchDAO extends PhabricatorSearchDAO
implements implements
PhabricatorPolicyInterface, PhabricatorPolicyInterface,
@ -8,11 +8,11 @@ final class PhabricatorProfilePanelConfiguration
PhabricatorApplicationTransactionInterface { PhabricatorApplicationTransactionInterface {
protected $profilePHID; protected $profilePHID;
protected $panelKey; protected $menuItemKey;
protected $builtinKey; protected $builtinKey;
protected $panelOrder; protected $menuItemOrder;
protected $visibility; protected $visibility;
protected $panelProperties = array(); protected $menuItemProperties = array();
private $profileObject = self::ATTACHABLE; private $profileObject = self::ATTACHABLE;
private $panel = self::ATTACHABLE; private $panel = self::ATTACHABLE;
@ -21,6 +21,11 @@ final class PhabricatorProfilePanelConfiguration
const VISIBILITY_VISIBLE = 'visible'; const VISIBILITY_VISIBLE = 'visible';
const VISIBILITY_DISABLED = 'disabled'; const VISIBILITY_DISABLED = 'disabled';
public function getTableName() {
// For now, this class uses an older table name.
return 'search_profilepanelconfiguration';
}
public static function initializeNewBuiltin() { public static function initializeNewBuiltin() {
return id(new self()) return id(new self())
->setVisibility(self::VISIBILITY_VISIBLE); ->setVisibility(self::VISIBILITY_VISIBLE);
@ -32,7 +37,7 @@ final class PhabricatorProfilePanelConfiguration
return self::initializeNewBuiltin() return self::initializeNewBuiltin()
->setProfilePHID($profile_object->getPHID()) ->setProfilePHID($profile_object->getPHID())
->setPanelKey($panel->getPanelKey()) ->setMenuItemKey($panel->getPanelKey())
->attachPanel($panel) ->attachPanel($panel)
->attachProfileObject($profile_object); ->attachProfileObject($profile_object);
} }
@ -41,17 +46,17 @@ final class PhabricatorProfilePanelConfiguration
return array( return array(
self::CONFIG_AUX_PHID => true, self::CONFIG_AUX_PHID => true,
self::CONFIG_SERIALIZATION => array( self::CONFIG_SERIALIZATION => array(
'panelProperties' => self::SERIALIZATION_JSON, 'menuItemProperties' => self::SERIALIZATION_JSON,
), ),
self::CONFIG_COLUMN_SCHEMA => array( self::CONFIG_COLUMN_SCHEMA => array(
'panelKey' => 'text64', 'menuItemKey' => 'text64',
'builtinKey' => 'text64?', 'builtinKey' => 'text64?',
'panelOrder' => 'uint32?', 'menuItemOrder' => 'uint32?',
'visibility' => 'text32', 'visibility' => 'text32',
), ),
self::CONFIG_KEY_SCHEMA => array( self::CONFIG_KEY_SCHEMA => array(
'key_profile' => array( 'key_profile' => array(
'columns' => array('profilePHID', 'panelOrder'), 'columns' => array('profilePHID', 'menuItemOrder'),
), ),
), ),
) + parent::getConfiguration(); ) + parent::getConfiguration();
@ -59,7 +64,7 @@ final class PhabricatorProfilePanelConfiguration
public function generatePHID() { public function generatePHID() {
return PhabricatorPHID::generateNewPHID( return PhabricatorPHID::generateNewPHID(
PhabricatorProfilePanelPHIDType::TYPECONST); PhabricatorProfileMenuItemPHIDType::TYPECONST);
} }
public function attachPanel(PhabricatorProfilePanel $panel) { public function attachPanel(PhabricatorProfilePanel $panel) {
@ -80,13 +85,13 @@ final class PhabricatorProfilePanelConfiguration
return $this->assertAttached($this->profileObject); return $this->assertAttached($this->profileObject);
} }
public function setPanelProperty($key, $value) { public function setMenuItemProperty($key, $value) {
$this->panelProperties[$key] = $value; $this->menuItemProperties[$key] = $value;
return $this; return $this;
} }
public function getPanelProperty($key, $default = null) { public function getMenuItemProperty($key, $default = null) {
return idx($this->panelProperties, $key, $default); return idx($this->menuItemProperties, $key, $default);
} }
public function buildNavigationMenuItems() { public function buildNavigationMenuItems() {
@ -105,7 +110,7 @@ final class PhabricatorProfilePanelConfiguration
return $this->getPanel()->canMakeDefault($this); return $this->getPanel()->canMakeDefault($this);
} }
public function canHidePanel() { public function canHideMenuItem() {
return $this->getPanel()->canHidePanel($this); return $this->getPanel()->canHidePanel($this);
} }
@ -114,7 +119,7 @@ final class PhabricatorProfilePanelConfiguration
} }
public function getSortKey() { public function getSortKey() {
$order = $this->getPanelOrder(); $order = $this->getMenuItemOrder();
if ($order === null) { if ($order === null) {
$order = 'Z'; $order = 'Z';
} else { } else {
@ -128,7 +133,7 @@ final class PhabricatorProfilePanelConfiguration
} }
public function isDisabled() { public function isDisabled() {
if (!$this->canHidePanel()) { if (!$this->canHideMenuItem()) {
return false; return false;
} }
return ($this->getVisibility() === self::VISIBILITY_DISABLED); return ($this->getVisibility() === self::VISIBILITY_DISABLED);
@ -179,7 +184,7 @@ final class PhabricatorProfilePanelConfiguration
public function getApplicationTransactionEditor() { public function getApplicationTransactionEditor() {
return new PhabricatorProfilePanelEditor(); return new PhabricatorProfileMenuEditor();
} }
public function getApplicationTransactionObject() { public function getApplicationTransactionObject() {
@ -187,7 +192,7 @@ final class PhabricatorProfilePanelConfiguration
} }
public function getApplicationTransactionTemplate() { public function getApplicationTransactionTemplate() {
return new PhabricatorProfilePanelConfigurationTransaction(); return new PhabricatorProfileMenuItemConfigurationTransaction();
} }
public function willRenderTimeline( public function willRenderTimeline(

View file

@ -1,6 +1,6 @@
<?php <?php
final class PhabricatorProfilePanelConfigurationTransaction final class PhabricatorProfileMenuItemConfigurationTransaction
extends PhabricatorApplicationTransaction { extends PhabricatorApplicationTransaction {
const TYPE_PROPERTY = 'profilepanel.property'; const TYPE_PROPERTY = 'profilepanel.property';
@ -11,8 +11,13 @@ final class PhabricatorProfilePanelConfigurationTransaction
return 'search'; return 'search';
} }
public function getTableName() {
// At least for now, this object uses an older table name.
return 'search_profilepanelconfigurationtransaction';
}
public function getApplicationTransactionType() { public function getApplicationTransactionType() {
return PhabricatorProfilePanelPHIDType::TYPECONST; return PhabricatorProfileMenuItemPHIDType::TYPECONST;
} }
public function getApplicationTransactionCommentObject() { public function getApplicationTransactionCommentObject() {

View file

@ -4,7 +4,7 @@ final class PhabricatorSearchSchemaSpec
extends PhabricatorConfigSchemaSpec { extends PhabricatorConfigSchemaSpec {
public function buildSchemata() { public function buildSchemata() {
$this->buildEdgeSchemata(new PhabricatorProfilePanelConfiguration()); $this->buildEdgeSchemata(new PhabricatorProfileMenuItemConfiguration());
$this->buildRawSchema( $this->buildRawSchema(
'search', 'search',

View file

@ -98,7 +98,7 @@ final class PhabricatorSettingsMainController
$panels = $this->buildPanels($preferences); $panels = $this->buildPanels($preferences);
$nav = $this->renderSideNav($panels); $nav = $this->renderSideNav($panels);
$key = $nav->selectFilter($key, head($panels)->getPanelKey()); $key = $nav->selectFilter($key, head($panels)->getMenuItemKey());
$panel = $panels[$key] $panel = $panels[$key]
->setController($this) ->setController($this)
@ -196,7 +196,7 @@ final class PhabricatorSettingsMainController
$nav->addLabel($group->getPanelGroupName()); $nav->addLabel($group->getPanelGroupName());
} }
$nav->addFilter($panel->getPanelKey(), $panel->getPanelName()); $nav->addFilter($panel->getMenuItemKey(), $panel->getPanelName());
} }
return $nav; return $nav;