diff --git a/resources/sql/autopatches/20161211.menu.01.itemkey.sql b/resources/sql/autopatches/20161211.menu.01.itemkey.sql new file mode 100644 --- /dev/null +++ b/resources/sql/autopatches/20161211.menu.01.itemkey.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_search.search_profilepanelconfiguration + CHANGE panelKey menuItemKey VARCHAR(64) NOT NULL COLLATE {$COLLATE_TEXT}; diff --git a/resources/sql/autopatches/20161211.menu.02.itemprops.sql b/resources/sql/autopatches/20161211.menu.02.itemprops.sql new file mode 100644 --- /dev/null +++ b/resources/sql/autopatches/20161211.menu.02.itemprops.sql @@ -0,0 +1,3 @@ +ALTER TABLE {$NAMESPACE}_search.search_profilepanelconfiguration + CHANGE panelProperties menuItemProperties + LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT}; diff --git a/resources/sql/autopatches/20161211.menu.03.order.sql b/resources/sql/autopatches/20161211.menu.03.order.sql new file mode 100644 --- /dev/null +++ b/resources/sql/autopatches/20161211.menu.03.order.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_search.search_profilepanelconfiguration + CHANGE panelOrder menuItemOrder INT UNSIGNED; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -3365,15 +3365,15 @@ '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 @@ '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', diff --git a/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php b/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php --- a/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php +++ b/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php @@ -24,7 +24,7 @@ $panels[] = $this->newPanel() ->setBuiltinKey(self::PANEL_PROFILE) - ->setPanelKey(PhabricatorPeopleDetailsProfilePanel::PANELKEY); + ->setMenuItemKey(PhabricatorPeopleDetailsProfilePanel::PANELKEY); $have_maniphest = PhabricatorApplication::isClassInstalledForViewer( 'PhabricatorManiphestApplication', @@ -36,10 +36,10 @@ $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 @@ $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 @@ $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; } diff --git a/src/applications/people/profilepanel/PhabricatorPeopleDetailsProfilePanel.php b/src/applications/people/profilepanel/PhabricatorPeopleDetailsProfilePanel.php --- a/src/applications/people/profilepanel/PhabricatorPeopleDetailsProfilePanel.php +++ b/src/applications/people/profilepanel/PhabricatorPeopleDetailsProfilePanel.php @@ -14,8 +14,8 @@ } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { - $name = $config->getPanelProperty('name'); + PhabricatorProfileMenuItemConfiguration $config) { + $name = $config->getMenuItemProperty('name'); if (strlen($name)) { return $name; @@ -25,18 +25,18 @@ } 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(); diff --git a/src/applications/people/profilepanel/PhabricatorPeopleManageProfilePanel.php b/src/applications/people/profilepanel/PhabricatorPeopleManageProfilePanel.php --- a/src/applications/people/profilepanel/PhabricatorPeopleManageProfilePanel.php +++ b/src/applications/people/profilepanel/PhabricatorPeopleManageProfilePanel.php @@ -14,13 +14,13 @@ } 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 @@ } 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(); diff --git a/src/applications/project/engine/PhabricatorProjectProfileMenuEngine.php b/src/applications/project/engine/PhabricatorProjectProfileMenuEngine.php --- a/src/applications/project/engine/PhabricatorProjectProfileMenuEngine.php +++ b/src/applications/project/engine/PhabricatorProjectProfileMenuEngine.php @@ -18,27 +18,27 @@ $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; } diff --git a/src/applications/project/profilepanel/PhabricatorProjectDetailsProfilePanel.php b/src/applications/project/profilepanel/PhabricatorProjectDetailsProfilePanel.php --- a/src/applications/project/profilepanel/PhabricatorProjectDetailsProfilePanel.php +++ b/src/applications/project/profilepanel/PhabricatorProjectDetailsProfilePanel.php @@ -14,13 +14,13 @@ } 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 @@ } 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(); diff --git a/src/applications/project/profilepanel/PhabricatorProjectManageProfilePanel.php b/src/applications/project/profilepanel/PhabricatorProjectManageProfilePanel.php --- a/src/applications/project/profilepanel/PhabricatorProjectManageProfilePanel.php +++ b/src/applications/project/profilepanel/PhabricatorProjectManageProfilePanel.php @@ -14,18 +14,18 @@ } 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 @@ } 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(); diff --git a/src/applications/project/profilepanel/PhabricatorProjectMembersProfilePanel.php b/src/applications/project/profilepanel/PhabricatorProjectMembersProfilePanel.php --- a/src/applications/project/profilepanel/PhabricatorProjectMembersProfilePanel.php +++ b/src/applications/project/profilepanel/PhabricatorProjectMembersProfilePanel.php @@ -14,8 +14,8 @@ } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { - $name = $config->getPanelProperty('name'); + PhabricatorProfileMenuItemConfiguration $config) { + $name = $config->getMenuItemProperty('name'); if (strlen($name)) { return $name; @@ -25,18 +25,18 @@ } 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(); diff --git a/src/applications/project/profilepanel/PhabricatorProjectPointsProfilePanel.php b/src/applications/project/profilepanel/PhabricatorProjectPointsProfilePanel.php --- a/src/applications/project/profilepanel/PhabricatorProjectPointsProfilePanel.php +++ b/src/applications/project/profilepanel/PhabricatorProjectPointsProfilePanel.php @@ -36,12 +36,12 @@ } 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 @@ } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $viewer = $this->getViewer(); $project = $config->getProfileObject(); diff --git a/src/applications/project/profilepanel/PhabricatorProjectSubprojectsProfilePanel.php b/src/applications/project/profilepanel/PhabricatorProjectSubprojectsProfilePanel.php --- a/src/applications/project/profilepanel/PhabricatorProjectSubprojectsProfilePanel.php +++ b/src/applications/project/profilepanel/PhabricatorProjectSubprojectsProfilePanel.php @@ -22,8 +22,8 @@ } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { - $name = $config->getPanelProperty('name'); + PhabricatorProfileMenuItemConfiguration $config) { + $name = $config->getMenuItemProperty('name'); if (strlen($name)) { return $name; @@ -33,18 +33,18 @@ } 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(); diff --git a/src/applications/project/profilepanel/PhabricatorProjectWorkboardProfilePanel.php b/src/applications/project/profilepanel/PhabricatorProjectWorkboardProfilePanel.php --- a/src/applications/project/profilepanel/PhabricatorProjectWorkboardProfilePanel.php +++ b/src/applications/project/profilepanel/PhabricatorProjectWorkboardProfilePanel.php @@ -14,7 +14,7 @@ } public function canMakeDefault( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return true; } @@ -31,8 +31,8 @@ } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { - $name = $config->getPanelProperty('name'); + PhabricatorProfileMenuItemConfiguration $config) { + $name = $config->getMenuItemProperty('name'); if (strlen($name)) { return $name; @@ -42,18 +42,18 @@ } 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(); diff --git a/src/applications/search/editor/PhabricatorProfileMenuEditEngine.php b/src/applications/search/editor/PhabricatorProfileMenuEditEngine.php --- a/src/applications/search/editor/PhabricatorProfileMenuEditEngine.php +++ b/src/applications/search/editor/PhabricatorProfileMenuEditEngine.php @@ -33,7 +33,7 @@ } public function setNewPanelConfiguration( - PhabricatorProfilePanelConfiguration $configuration) { + PhabricatorProfileMenuItemConfiguration $configuration) { $this->newPanelConfiguration = $configuration; return $this; } @@ -77,7 +77,7 @@ } protected function newObjectQuery() { - return id(new PhabricatorProfilePanelConfigurationQuery()); + return id(new PhabricatorProfileMenuItemConfigurationQuery()); } protected function getObjectCreateTitleText($object) { @@ -125,7 +125,7 @@ $fields = $panel->buildEditEngineFields($object); $type_property = - PhabricatorProfilePanelConfigurationTransaction::TYPE_PROPERTY; + PhabricatorProfileMenuItemConfigurationTransaction::TYPE_PROPERTY; foreach ($fields as $field) { $field diff --git a/src/applications/search/editor/PhabricatorProfilePanelEditor.php b/src/applications/search/editor/PhabricatorProfileMenuEditor.php rename from src/applications/search/editor/PhabricatorProfilePanelEditor.php rename to src/applications/search/editor/PhabricatorProfileMenuEditor.php --- a/src/applications/search/editor/PhabricatorProfilePanelEditor.php +++ b/src/applications/search/editor/PhabricatorProfileMenuEditor.php @@ -1,6 +1,6 @@ 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 @@ 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 @@ 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 @@ 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; } diff --git a/src/applications/search/engine/PhabricatorProfileMenuEngine.php b/src/applications/search/engine/PhabricatorProfileMenuEngine.php --- a/src/applications/search/engine/PhabricatorProfileMenuEngine.php +++ b/src/applications/search/engine/PhabricatorProfileMenuEngine.php @@ -37,7 +37,7 @@ } private function setDefaultPanel( - PhabricatorProfilePanelConfiguration $default_panel) { + PhabricatorProfileMenuItemConfiguration $default_panel) { $this->defaultPanel = $default_panel; return $this; } @@ -231,7 +231,7 @@ $panels = $this->loadBuiltinProfilePanels(); - $stored_panels = id(new PhabricatorProfilePanelConfigurationQuery()) + $stored_panels = id(new PhabricatorProfileMenuItemConfigurationQuery()) ->setViewer($viewer) ->withProfilePHIDs(array($object->getPHID())) ->execute(); @@ -327,7 +327,7 @@ $builtin_key)); } - $panel_key = $builtin->getPanelKey(); + $panel_key = $builtin->getMenuItemKey(); $panel = idx($panels, $panel_key); if (!$panel) { @@ -346,7 +346,7 @@ ->setProfilePHID($object->getPHID()) ->attachPanel($panel) ->attachProfileObject($object) - ->setPanelOrder($order); + ->setMenuItemOrder($order); if (!$builtin->shouldEnableForObject($object)) { continue; @@ -488,17 +488,17 @@ $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 @@ $hide_text = pht('Delete'); } - $can_disable = $panel->canHidePanel(); + $can_disable = $panel->canHideMenuItem(); $item->addAction( id(new PHUIListItemView()) @@ -695,7 +695,7 @@ } $configuration = - PhabricatorProfilePanelConfiguration::initializeNewPanelConfiguration( + PhabricatorProfileMenuItemConfiguration::initializeNewPanelConfiguration( $object, $panel_type); @@ -729,7 +729,7 @@ } private function buildPanelBuiltinContent( - PhabricatorProfilePanelConfiguration $configuration) { + PhabricatorProfileMenuItemConfiguration $configuration) { // If this builtin panel has already been persisted, redirect to the // edit page. @@ -761,7 +761,7 @@ } private function buildPanelHideContent( - PhabricatorProfilePanelConfiguration $configuration) { + PhabricatorProfileMenuItemConfiguration $configuration) { $controller = $this->getController(); $request = $controller->getRequest(); @@ -772,7 +772,7 @@ $configuration, PhabricatorPolicyCapability::CAN_EDIT); - if (!$configuration->canHidePanel()) { + if (!$configuration->canHideMenuItem()) { return $controller->newDialog() ->setTitle(pht('Mandatory Panel')) ->appendParagraph( @@ -787,14 +787,14 @@ $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 @@ $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 @@ } private function buildPanelDefaultContent( - PhabricatorProfilePanelConfiguration $configuration, + PhabricatorProfileMenuItemConfiguration $configuration, array $panels) { $controller = $this->getController(); @@ -894,7 +895,7 @@ } protected function newPanel() { - return PhabricatorProfilePanelConfiguration::initializeNewBuiltin(); + return PhabricatorProfileMenuItemConfiguration::initializeNewBuiltin(); } public function adjustDefault($key) { @@ -931,10 +932,10 @@ } $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 @@ 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) diff --git a/src/applications/search/phidtype/PhabricatorProfilePanelPHIDType.php b/src/applications/search/phidtype/PhabricatorProfileMenuItemPHIDType.php rename from src/applications/search/phidtype/PhabricatorProfilePanelPHIDType.php rename to src/applications/search/phidtype/PhabricatorProfileMenuItemPHIDType.php --- a/src/applications/search/phidtype/PhabricatorProfilePanelPHIDType.php +++ b/src/applications/search/phidtype/PhabricatorProfileMenuItemPHIDType.php @@ -1,16 +1,16 @@ withPHIDs($phids); } @@ -32,7 +32,7 @@ foreach ($handles as $phid => $handle) { $config = $objects[$phid]; - $handle->setName(pht('Profile Panel')); + $handle->setName(pht('Profile Menu Item')); } } diff --git a/src/applications/search/profilepanel/PhabricatorApplicationProfilePanel.php b/src/applications/search/profilepanel/PhabricatorApplicationProfilePanel.php --- a/src/applications/search/profilepanel/PhabricatorApplicationProfilePanel.php +++ b/src/applications/search/profilepanel/PhabricatorApplicationProfilePanel.php @@ -18,7 +18,7 @@ } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $app = $this->getApplication($config); if ($app) { return $app->getName(); @@ -29,20 +29,20 @@ } 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 @@ } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $viewer = $this->getViewer(); $app = $this->getApplication($config); if (!$app) { diff --git a/src/applications/search/profilepanel/PhabricatorDividerProfilePanel.php b/src/applications/search/profilepanel/PhabricatorDividerProfilePanel.php --- a/src/applications/search/profilepanel/PhabricatorDividerProfilePanel.php +++ b/src/applications/search/profilepanel/PhabricatorDividerProfilePanel.php @@ -18,12 +18,12 @@ } 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 @@ } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $item = $this->newItem() ->addClass('phui-divider'); diff --git a/src/applications/search/profilepanel/PhabricatorLinkProfilePanel.php b/src/applications/search/profilepanel/PhabricatorLinkProfilePanel.php --- a/src/applications/search/profilepanel/PhabricatorLinkProfilePanel.php +++ b/src/applications/search/profilepanel/PhabricatorLinkProfilePanel.php @@ -18,12 +18,12 @@ } 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 @@ } 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 @@ } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $icon = $this->getLinkIcon($config); $name = $this->getLinkName($config); diff --git a/src/applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php b/src/applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php --- a/src/applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php +++ b/src/applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php @@ -18,10 +18,10 @@ } 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 @@ } public function buildEditEngineFields( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return array( id(new PhabricatorInstructionsEditField()) ->setValue( @@ -51,9 +51,9 @@ } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { - $source = $config->getPanelProperty('source'); + $source = $config->getMenuItemProperty('source'); switch ($source) { case 'catfacts': diff --git a/src/applications/search/profilepanel/PhabricatorProfilePanel.php b/src/applications/search/profilepanel/PhabricatorProfilePanel.php --- a/src/applications/search/profilepanel/PhabricatorProfilePanel.php +++ b/src/applications/search/profilepanel/PhabricatorProfilePanel.php @@ -5,12 +5,12 @@ 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 public function getPanelTypeName(); abstract public function getDisplayName( - PhabricatorProfilePanelConfiguration $config); + PhabricatorProfileMenuItemConfiguration $config); public function buildEditEngineFields( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return array(); } @@ -35,12 +35,12 @@ } public function canHidePanel( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return true; } public function canMakeDefault( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return false; } diff --git a/src/applications/search/query/PhabricatorProfilePanelConfigurationQuery.php b/src/applications/search/query/PhabricatorProfileMenuItemConfigurationQuery.php rename from src/applications/search/query/PhabricatorProfilePanelConfigurationQuery.php rename to src/applications/search/query/PhabricatorProfileMenuItemConfigurationQuery.php --- a/src/applications/search/query/PhabricatorProfilePanelConfigurationQuery.php +++ b/src/applications/search/query/PhabricatorProfileMenuItemConfigurationQuery.php @@ -1,6 +1,6 @@ $panel) { - $panel_type = idx($panels, $panel->getPanelKey()); + $panel_type = idx($panels, $panel->getMenuItemKey()); if (!$panel_type) { $this->didRejectResult($panel); unset($page[$key]); diff --git a/src/applications/search/query/PhabricatorProfileMenuItemConfigurationTransactionQuery.php b/src/applications/search/query/PhabricatorProfileMenuItemConfigurationTransactionQuery.php new file mode 100644 --- /dev/null +++ b/src/applications/search/query/PhabricatorProfileMenuItemConfigurationTransactionQuery.php @@ -0,0 +1,10 @@ +setVisibility(self::VISIBILITY_VISIBLE); @@ -32,7 +37,7 @@ return self::initializeNewBuiltin() ->setProfilePHID($profile_object->getPHID()) - ->setPanelKey($panel->getPanelKey()) + ->setMenuItemKey($panel->getPanelKey()) ->attachPanel($panel) ->attachProfileObject($profile_object); } @@ -41,17 +46,17 @@ 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 @@ public function generatePHID() { return PhabricatorPHID::generateNewPHID( - PhabricatorProfilePanelPHIDType::TYPECONST); + PhabricatorProfileMenuItemPHIDType::TYPECONST); } public function attachPanel(PhabricatorProfilePanel $panel) { @@ -80,13 +85,13 @@ 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 @@ return $this->getPanel()->canMakeDefault($this); } - public function canHidePanel() { + public function canHideMenuItem() { return $this->getPanel()->canHidePanel($this); } @@ -114,7 +119,7 @@ } public function getSortKey() { - $order = $this->getPanelOrder(); + $order = $this->getMenuItemOrder(); if ($order === null) { $order = 'Z'; } else { @@ -128,7 +133,7 @@ } public function isDisabled() { - if (!$this->canHidePanel()) { + if (!$this->canHideMenuItem()) { return false; } return ($this->getVisibility() === self::VISIBILITY_DISABLED); @@ -179,7 +184,7 @@ public function getApplicationTransactionEditor() { - return new PhabricatorProfilePanelEditor(); + return new PhabricatorProfileMenuEditor(); } public function getApplicationTransactionObject() { @@ -187,7 +192,7 @@ } public function getApplicationTransactionTemplate() { - return new PhabricatorProfilePanelConfigurationTransaction(); + return new PhabricatorProfileMenuItemConfigurationTransaction(); } public function willRenderTimeline( diff --git a/src/applications/search/storage/PhabricatorProfilePanelConfigurationTransaction.php b/src/applications/search/storage/PhabricatorProfileMenuItemConfigurationTransaction.php rename from src/applications/search/storage/PhabricatorProfilePanelConfigurationTransaction.php rename to src/applications/search/storage/PhabricatorProfileMenuItemConfigurationTransaction.php --- a/src/applications/search/storage/PhabricatorProfilePanelConfigurationTransaction.php +++ b/src/applications/search/storage/PhabricatorProfileMenuItemConfigurationTransaction.php @@ -1,6 +1,6 @@ buildEdgeSchemata(new PhabricatorProfilePanelConfiguration()); + $this->buildEdgeSchemata(new PhabricatorProfileMenuItemConfiguration()); $this->buildRawSchema( 'search', diff --git a/src/applications/settings/controller/PhabricatorSettingsMainController.php b/src/applications/settings/controller/PhabricatorSettingsMainController.php --- a/src/applications/settings/controller/PhabricatorSettingsMainController.php +++ b/src/applications/settings/controller/PhabricatorSettingsMainController.php @@ -98,7 +98,7 @@ $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 @@ $nav->addLabel($group->getPanelGroupName()); } - $nav->addFilter($panel->getPanelKey(), $panel->getPanelName()); + $nav->addFilter($panel->getMenuItemKey(), $panel->getPanelName()); } return $nav;