1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-19 16:58:48 +02: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',
'PhabricatorProfileMenuCollapsedSetting' => 'applications/settings/setting/PhabricatorProfileMenuCollapsedSetting.php',
'PhabricatorProfileMenuEditEngine' => 'applications/search/editor/PhabricatorProfileMenuEditEngine.php',
'PhabricatorProfileMenuEditor' => 'applications/search/editor/PhabricatorProfileMenuEditor.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',
'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',
'PhabricatorProfilePanelPHIDType' => 'applications/search/phidtype/PhabricatorProfilePanelPHIDType.php',
'PhabricatorProject' => 'applications/project/storage/PhabricatorProject.php',
'PhabricatorProjectAddHeraldAction' => 'applications/project/herald/PhabricatorProjectAddHeraldAction.php',
'PhabricatorProjectApplication' => 'applications/project/application/PhabricatorProjectApplication.php',
@ -8451,20 +8451,20 @@ phutil_register_library_map(array(
'PhabricatorPonderApplication' => 'PhabricatorApplication',
'PhabricatorProfileMenuCollapsedSetting' => 'PhabricatorInternalSetting',
'PhabricatorProfileMenuEditEngine' => 'PhabricatorEditEngine',
'PhabricatorProfileMenuEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorProfileMenuEngine' => 'Phobject',
'PhabricatorProfilePanel' => 'Phobject',
'PhabricatorProfilePanelConfiguration' => array(
'PhabricatorProfileMenuItemConfiguration' => array(
'PhabricatorSearchDAO',
'PhabricatorPolicyInterface',
'PhabricatorExtendedPolicyInterface',
'PhabricatorApplicationTransactionInterface',
),
'PhabricatorProfilePanelConfigurationQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorProfilePanelConfigurationTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorProfilePanelConfigurationTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorProfilePanelEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorProfileMenuItemConfigurationQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorProfileMenuItemConfigurationTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorProfileMenuItemConfigurationTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorProfileMenuItemPHIDType' => 'PhabricatorPHIDType',
'PhabricatorProfilePanel' => 'Phobject',
'PhabricatorProfilePanelIconSet' => 'PhabricatorIconSet',
'PhabricatorProfilePanelPHIDType' => 'PhabricatorPHIDType',
'PhabricatorProject' => array(
'PhabricatorProjectDAO',
'PhabricatorApplicationTransactionInterface',

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,16 +1,16 @@
<?php
final class PhabricatorProfilePanelPHIDType
final class PhabricatorProfileMenuItemPHIDType
extends PhabricatorPHIDType {
const TYPECONST = 'PANL';
public function getTypeName() {
return pht('Profile Panel');
return pht('Profile Menu Item');
}
public function newObject() {
return new PhabricatorProfilePanelConfiguration();
return new PhabricatorProfileMenuItemConfiguration();
}
public function getPHIDTypeApplicationClass() {
@ -20,7 +20,7 @@ final class PhabricatorProfilePanelPHIDType
protected function buildQueryForObjects(
PhabricatorObjectQuery $object_query,
array $phids) {
return id(new PhabricatorProfilePanelConfigurationQuery())
return id(new PhabricatorProfileMenuItemConfigurationQuery())
->withPHIDs($phids);
}
@ -32,7 +32,7 @@ final class PhabricatorProfilePanelPHIDType
foreach ($handles as $phid => $handle) {
$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(
PhabricatorProfilePanelConfiguration $config) {
PhabricatorProfileMenuItemConfiguration $config) {
$app = $this->getApplication($config);
if ($app) {
return $app->getName();
@ -29,20 +29,20 @@ final class PhabricatorApplicationProfilePanel
}
public function buildEditEngineFields(
PhabricatorProfilePanelConfiguration $config) {
PhabricatorProfileMenuItemConfiguration $config) {
return array(
id(new PhabricatorDatasourceEditField())
->setKey('application')
->setLabel(pht('Application'))
->setDatasource(new PhabricatorApplicationDatasource())
->setSingleValue($config->getPanelProperty('application')),
->setSingleValue($config->getMenuItemProperty('application')),
);
}
private function getApplication(
PhabricatorProfilePanelConfiguration $config) {
PhabricatorProfileMenuItemConfiguration $config) {
$viewer = $this->getViewer();
$phid = $config->getPanelProperty('application');
$phid = $config->getMenuItemProperty('application');
$app = id(new PhabricatorApplicationQuery())
->setViewer($viewer)
->withPHIDs(array($phid))
@ -52,7 +52,7 @@ final class PhabricatorApplicationProfilePanel
}
protected function newNavigationMenuItems(
PhabricatorProfilePanelConfiguration $config) {
PhabricatorProfileMenuItemConfiguration $config) {
$viewer = $this->getViewer();
$app = $this->getApplication($config);
if (!$app) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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