1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

Provide a "PHUIFormIconSetControl"

Summary:
Ref T9992. This is a step on the path to getting EditEngine working in Badges, Projects and Calendar.

This doesn't add a new `EditField` for icons yet, just standardizes the old stuff. New stuff is more general and I saved 150 lines of code.

I put the endpoint in Files because the similar "choose a profile picture" endpoint will definitely go there, and this endpoint might eventually feature, like, "draw your own icon~~" or something.

Test Plan:
  - Created events, projects and badges with custom icons.
  - Edited events, projects and badges, changing their icons.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9992

Differential Revision: https://secure.phabricator.com/D14799
This commit is contained in:
epriestley 2015-12-16 07:53:13 -08:00
parent 57cc30d0c4
commit 5e182180a9
32 changed files with 437 additions and 582 deletions

View file

@ -7,7 +7,7 @@
*/ */
return array( return array(
'names' => array( 'names' => array(
'core.pkg.css' => '6d8c526d', 'core.pkg.css' => '8378907a',
'core.pkg.js' => 'c60f35d8', 'core.pkg.js' => 'c60f35d8',
'darkconsole.pkg.js' => 'e7393ebb', 'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '2de124c9', 'differential.pkg.css' => '2de124c9',
@ -131,7 +131,7 @@ return array(
'rsrc/css/phui/phui-document.css' => 'a4a1c3b9', 'rsrc/css/phui/phui-document.css' => 'a4a1c3b9',
'rsrc/css/phui/phui-feed-story.css' => 'b7b26d23', 'rsrc/css/phui/phui-feed-story.css' => 'b7b26d23',
'rsrc/css/phui/phui-fontkit.css' => '9cda225e', 'rsrc/css/phui/phui-fontkit.css' => '9cda225e',
'rsrc/css/phui/phui-form-view.css' => 'c1d2ef29', 'rsrc/css/phui/phui-form-view.css' => 'cf7da606',
'rsrc/css/phui/phui-form.css' => 'afdb2c6e', 'rsrc/css/phui/phui-form.css' => 'afdb2c6e',
'rsrc/css/phui/phui-header-view.css' => '55bb32dd', 'rsrc/css/phui/phui-header-view.css' => '55bb32dd',
'rsrc/css/phui/phui-icon.css' => 'b0a6b1b6', 'rsrc/css/phui/phui-icon.css' => 'b0a6b1b6',
@ -464,7 +464,7 @@ return array(
'rsrc/js/core/behavior-active-nav.js' => 'e379b58e', 'rsrc/js/core/behavior-active-nav.js' => 'e379b58e',
'rsrc/js/core/behavior-audio-source.js' => '59b251eb', 'rsrc/js/core/behavior-audio-source.js' => '59b251eb',
'rsrc/js/core/behavior-autofocus.js' => '7319e029', 'rsrc/js/core/behavior-autofocus.js' => '7319e029',
'rsrc/js/core/behavior-choose-control.js' => '6153c708', 'rsrc/js/core/behavior-choose-control.js' => 'dfaafb14',
'rsrc/js/core/behavior-crop.js' => 'fa0f4fc2', 'rsrc/js/core/behavior-crop.js' => 'fa0f4fc2',
'rsrc/js/core/behavior-dark-console.js' => 'f411b6ae', 'rsrc/js/core/behavior-dark-console.js' => 'f411b6ae',
'rsrc/js/core/behavior-device.js' => 'a205cf28', 'rsrc/js/core/behavior-device.js' => 'a205cf28',
@ -570,7 +570,7 @@ return array(
'javelin-behavior-audio-source' => '59b251eb', 'javelin-behavior-audio-source' => '59b251eb',
'javelin-behavior-audit-preview' => 'd835b03a', 'javelin-behavior-audit-preview' => 'd835b03a',
'javelin-behavior-bulk-job-reload' => 'edf8a145', 'javelin-behavior-bulk-job-reload' => 'edf8a145',
'javelin-behavior-choose-control' => '6153c708', 'javelin-behavior-choose-control' => 'dfaafb14',
'javelin-behavior-comment-actions' => 'bb0d2d0c', 'javelin-behavior-comment-actions' => 'bb0d2d0c',
'javelin-behavior-config-reorder-fields' => 'b6993408', 'javelin-behavior-config-reorder-fields' => 'b6993408',
'javelin-behavior-conpherence-drag-and-drop-photo' => 'cf86d16a', 'javelin-behavior-conpherence-drag-and-drop-photo' => 'cf86d16a',
@ -805,7 +805,7 @@ return array(
'phui-font-icon-base-css' => 'ecbbb4c2', 'phui-font-icon-base-css' => 'ecbbb4c2',
'phui-fontkit-css' => '9cda225e', 'phui-fontkit-css' => '9cda225e',
'phui-form-css' => 'afdb2c6e', 'phui-form-css' => 'afdb2c6e',
'phui-form-view-css' => 'c1d2ef29', 'phui-form-view-css' => 'cf7da606',
'phui-header-view-css' => '55bb32dd', 'phui-header-view-css' => '55bb32dd',
'phui-icon-view-css' => 'b0a6b1b6', 'phui-icon-view-css' => 'b0a6b1b6',
'phui-image-mask-css' => '5a8b09c8', 'phui-image-mask-css' => '5a8b09c8',
@ -1266,12 +1266,6 @@ return array(
'javelin-stratcom', 'javelin-stratcom',
'javelin-dom', 'javelin-dom',
), ),
'6153c708' => array(
'javelin-behavior',
'javelin-stratcom',
'javelin-dom',
'javelin-workflow',
),
'61cbc29a' => array( '61cbc29a' => array(
'javelin-magical-init', 'javelin-magical-init',
'javelin-util', 'javelin-util',
@ -1890,6 +1884,12 @@ return array(
'df5e11d2' => array( 'df5e11d2' => array(
'javelin-install', 'javelin-install',
), ),
'dfaafb14' => array(
'javelin-behavior',
'javelin-stratcom',
'javelin-dom',
'javelin-workflow',
),
'e10f8e18' => array( 'e10f8e18' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-dom', 'javelin-dom',

View file

@ -114,7 +114,6 @@ phutil_register_library_map(array(
'AphrontException' => 'aphront/exception/AphrontException.php', 'AphrontException' => 'aphront/exception/AphrontException.php',
'AphrontFileResponse' => 'aphront/response/AphrontFileResponse.php', 'AphrontFileResponse' => 'aphront/response/AphrontFileResponse.php',
'AphrontFormCheckboxControl' => 'view/form/control/AphrontFormCheckboxControl.php', 'AphrontFormCheckboxControl' => 'view/form/control/AphrontFormCheckboxControl.php',
'AphrontFormChooseButtonControl' => 'view/form/control/AphrontFormChooseButtonControl.php',
'AphrontFormControl' => 'view/form/control/AphrontFormControl.php', 'AphrontFormControl' => 'view/form/control/AphrontFormControl.php',
'AphrontFormDateControl' => 'view/form/control/AphrontFormDateControl.php', 'AphrontFormDateControl' => 'view/form/control/AphrontFormDateControl.php',
'AphrontFormDateControlValue' => 'view/form/control/AphrontFormDateControlValue.php', 'AphrontFormDateControlValue' => 'view/form/control/AphrontFormDateControlValue.php',
@ -1474,6 +1473,7 @@ phutil_register_library_map(array(
'PHUIFeedStoryView' => 'view/phui/PHUIFeedStoryView.php', 'PHUIFeedStoryView' => 'view/phui/PHUIFeedStoryView.php',
'PHUIFormDividerControl' => 'view/form/control/PHUIFormDividerControl.php', 'PHUIFormDividerControl' => 'view/form/control/PHUIFormDividerControl.php',
'PHUIFormFreeformDateControl' => 'view/form/control/PHUIFormFreeformDateControl.php', 'PHUIFormFreeformDateControl' => 'view/form/control/PHUIFormFreeformDateControl.php',
'PHUIFormIconSetControl' => 'view/form/control/PHUIFormIconSetControl.php',
'PHUIFormInsetView' => 'view/form/PHUIFormInsetView.php', 'PHUIFormInsetView' => 'view/form/PHUIFormInsetView.php',
'PHUIFormLayoutView' => 'view/form/PHUIFormLayoutView.php', 'PHUIFormLayoutView' => 'view/form/PHUIFormLayoutView.php',
'PHUIFormMultiSubmitControl' => 'view/form/control/PHUIFormMultiSubmitControl.php', 'PHUIFormMultiSubmitControl' => 'view/form/control/PHUIFormMultiSubmitControl.php',
@ -1774,10 +1774,9 @@ phutil_register_library_map(array(
'PhabricatorBadgesDAO' => 'applications/badges/storage/PhabricatorBadgesDAO.php', 'PhabricatorBadgesDAO' => 'applications/badges/storage/PhabricatorBadgesDAO.php',
'PhabricatorBadgesDefaultEditCapability' => 'applications/badges/capability/PhabricatorBadgesDefaultEditCapability.php', 'PhabricatorBadgesDefaultEditCapability' => 'applications/badges/capability/PhabricatorBadgesDefaultEditCapability.php',
'PhabricatorBadgesEditController' => 'applications/badges/controller/PhabricatorBadgesEditController.php', 'PhabricatorBadgesEditController' => 'applications/badges/controller/PhabricatorBadgesEditController.php',
'PhabricatorBadgesEditIconController' => 'applications/badges/controller/PhabricatorBadgesEditIconController.php',
'PhabricatorBadgesEditRecipientsController' => 'applications/badges/controller/PhabricatorBadgesEditRecipientsController.php', 'PhabricatorBadgesEditRecipientsController' => 'applications/badges/controller/PhabricatorBadgesEditRecipientsController.php',
'PhabricatorBadgesEditor' => 'applications/badges/editor/PhabricatorBadgesEditor.php', 'PhabricatorBadgesEditor' => 'applications/badges/editor/PhabricatorBadgesEditor.php',
'PhabricatorBadgesIcon' => 'applications/badges/icon/PhabricatorBadgesIcon.php', 'PhabricatorBadgesIconSet' => 'applications/badges/icon/PhabricatorBadgesIconSet.php',
'PhabricatorBadgesListController' => 'applications/badges/controller/PhabricatorBadgesListController.php', 'PhabricatorBadgesListController' => 'applications/badges/controller/PhabricatorBadgesListController.php',
'PhabricatorBadgesMailReceiver' => 'applications/badges/mail/PhabricatorBadgesMailReceiver.php', 'PhabricatorBadgesMailReceiver' => 'applications/badges/mail/PhabricatorBadgesMailReceiver.php',
'PhabricatorBadgesPHIDType' => 'applications/badges/phid/PhabricatorBadgesPHIDType.php', 'PhabricatorBadgesPHIDType' => 'applications/badges/phid/PhabricatorBadgesPHIDType.php',
@ -1833,7 +1832,6 @@ phutil_register_library_map(array(
'PhabricatorCalendarEventCommentController' => 'applications/calendar/controller/PhabricatorCalendarEventCommentController.php', 'PhabricatorCalendarEventCommentController' => 'applications/calendar/controller/PhabricatorCalendarEventCommentController.php',
'PhabricatorCalendarEventDragController' => 'applications/calendar/controller/PhabricatorCalendarEventDragController.php', 'PhabricatorCalendarEventDragController' => 'applications/calendar/controller/PhabricatorCalendarEventDragController.php',
'PhabricatorCalendarEventEditController' => 'applications/calendar/controller/PhabricatorCalendarEventEditController.php', 'PhabricatorCalendarEventEditController' => 'applications/calendar/controller/PhabricatorCalendarEventEditController.php',
'PhabricatorCalendarEventEditIconController' => 'applications/calendar/controller/PhabricatorCalendarEventEditIconController.php',
'PhabricatorCalendarEventEditor' => 'applications/calendar/editor/PhabricatorCalendarEventEditor.php', 'PhabricatorCalendarEventEditor' => 'applications/calendar/editor/PhabricatorCalendarEventEditor.php',
'PhabricatorCalendarEventEmailCommand' => 'applications/calendar/command/PhabricatorCalendarEventEmailCommand.php', 'PhabricatorCalendarEventEmailCommand' => 'applications/calendar/command/PhabricatorCalendarEventEmailCommand.php',
'PhabricatorCalendarEventInvitee' => 'applications/calendar/storage/PhabricatorCalendarEventInvitee.php', 'PhabricatorCalendarEventInvitee' => 'applications/calendar/storage/PhabricatorCalendarEventInvitee.php',
@ -1852,7 +1850,7 @@ phutil_register_library_map(array(
'PhabricatorCalendarEventViewController' => 'applications/calendar/controller/PhabricatorCalendarEventViewController.php', 'PhabricatorCalendarEventViewController' => 'applications/calendar/controller/PhabricatorCalendarEventViewController.php',
'PhabricatorCalendarHoliday' => 'applications/calendar/storage/PhabricatorCalendarHoliday.php', 'PhabricatorCalendarHoliday' => 'applications/calendar/storage/PhabricatorCalendarHoliday.php',
'PhabricatorCalendarHolidayTestCase' => 'applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php', 'PhabricatorCalendarHolidayTestCase' => 'applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php',
'PhabricatorCalendarIcon' => 'applications/calendar/icon/PhabricatorCalendarIcon.php', 'PhabricatorCalendarIconSet' => 'applications/calendar/icon/PhabricatorCalendarIconSet.php',
'PhabricatorCalendarRemarkupRule' => 'applications/calendar/remarkup/PhabricatorCalendarRemarkupRule.php', 'PhabricatorCalendarRemarkupRule' => 'applications/calendar/remarkup/PhabricatorCalendarRemarkupRule.php',
'PhabricatorCalendarReplyHandler' => 'applications/calendar/mail/PhabricatorCalendarReplyHandler.php', 'PhabricatorCalendarReplyHandler' => 'applications/calendar/mail/PhabricatorCalendarReplyHandler.php',
'PhabricatorCalendarSchemaSpec' => 'applications/calendar/storage/PhabricatorCalendarSchemaSpec.php', 'PhabricatorCalendarSchemaSpec' => 'applications/calendar/storage/PhabricatorCalendarSchemaSpec.php',
@ -2263,6 +2261,7 @@ phutil_register_library_map(array(
'PhabricatorFileEditor' => 'applications/files/editor/PhabricatorFileEditor.php', 'PhabricatorFileEditor' => 'applications/files/editor/PhabricatorFileEditor.php',
'PhabricatorFileFilePHIDType' => 'applications/files/phid/PhabricatorFileFilePHIDType.php', 'PhabricatorFileFilePHIDType' => 'applications/files/phid/PhabricatorFileFilePHIDType.php',
'PhabricatorFileHasObjectEdgeType' => 'applications/files/edge/PhabricatorFileHasObjectEdgeType.php', 'PhabricatorFileHasObjectEdgeType' => 'applications/files/edge/PhabricatorFileHasObjectEdgeType.php',
'PhabricatorFileIconSetSelectController' => 'applications/files/controller/PhabricatorFileIconSetSelectController.php',
'PhabricatorFileImageMacro' => 'applications/macro/storage/PhabricatorFileImageMacro.php', 'PhabricatorFileImageMacro' => 'applications/macro/storage/PhabricatorFileImageMacro.php',
'PhabricatorFileImageTransform' => 'applications/files/transform/PhabricatorFileImageTransform.php', 'PhabricatorFileImageTransform' => 'applications/files/transform/PhabricatorFileImageTransform.php',
'PhabricatorFileInfoController' => 'applications/files/controller/PhabricatorFileInfoController.php', 'PhabricatorFileInfoController' => 'applications/files/controller/PhabricatorFileInfoController.php',
@ -2359,6 +2358,8 @@ phutil_register_library_map(array(
'PhabricatorIDsSearchField' => 'applications/search/field/PhabricatorIDsSearchField.php', 'PhabricatorIDsSearchField' => 'applications/search/field/PhabricatorIDsSearchField.php',
'PhabricatorIRCProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorIRCProtocolAdapter.php', 'PhabricatorIRCProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorIRCProtocolAdapter.php',
'PhabricatorIconRemarkupRule' => 'applications/macro/markup/PhabricatorIconRemarkupRule.php', 'PhabricatorIconRemarkupRule' => 'applications/macro/markup/PhabricatorIconRemarkupRule.php',
'PhabricatorIconSet' => 'applications/files/iconset/PhabricatorIconSet.php',
'PhabricatorIconSetIcon' => 'applications/files/iconset/PhabricatorIconSetIcon.php',
'PhabricatorImageMacroRemarkupRule' => 'applications/macro/markup/PhabricatorImageMacroRemarkupRule.php', 'PhabricatorImageMacroRemarkupRule' => 'applications/macro/markup/PhabricatorImageMacroRemarkupRule.php',
'PhabricatorImageTransformer' => 'applications/files/PhabricatorImageTransformer.php', 'PhabricatorImageTransformer' => 'applications/files/PhabricatorImageTransformer.php',
'PhabricatorImagemagickSetupCheck' => 'applications/config/check/PhabricatorImagemagickSetupCheck.php', 'PhabricatorImagemagickSetupCheck' => 'applications/config/check/PhabricatorImagemagickSetupCheck.php',
@ -2809,12 +2810,11 @@ phutil_register_library_map(array(
'PhabricatorProjectDatasource' => 'applications/project/typeahead/PhabricatorProjectDatasource.php', 'PhabricatorProjectDatasource' => 'applications/project/typeahead/PhabricatorProjectDatasource.php',
'PhabricatorProjectDescriptionField' => 'applications/project/customfield/PhabricatorProjectDescriptionField.php', 'PhabricatorProjectDescriptionField' => 'applications/project/customfield/PhabricatorProjectDescriptionField.php',
'PhabricatorProjectEditDetailsController' => 'applications/project/controller/PhabricatorProjectEditDetailsController.php', 'PhabricatorProjectEditDetailsController' => 'applications/project/controller/PhabricatorProjectEditDetailsController.php',
'PhabricatorProjectEditIconController' => 'applications/project/controller/PhabricatorProjectEditIconController.php',
'PhabricatorProjectEditPictureController' => 'applications/project/controller/PhabricatorProjectEditPictureController.php', 'PhabricatorProjectEditPictureController' => 'applications/project/controller/PhabricatorProjectEditPictureController.php',
'PhabricatorProjectEditorTestCase' => 'applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php', 'PhabricatorProjectEditorTestCase' => 'applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php',
'PhabricatorProjectFeedController' => 'applications/project/controller/PhabricatorProjectFeedController.php', 'PhabricatorProjectFeedController' => 'applications/project/controller/PhabricatorProjectFeedController.php',
'PhabricatorProjectHeraldAction' => 'applications/project/herald/PhabricatorProjectHeraldAction.php', 'PhabricatorProjectHeraldAction' => 'applications/project/herald/PhabricatorProjectHeraldAction.php',
'PhabricatorProjectIcon' => 'applications/project/icon/PhabricatorProjectIcon.php', 'PhabricatorProjectIconSet' => 'applications/project/icon/PhabricatorProjectIconSet.php',
'PhabricatorProjectInterface' => 'applications/project/interface/PhabricatorProjectInterface.php', 'PhabricatorProjectInterface' => 'applications/project/interface/PhabricatorProjectInterface.php',
'PhabricatorProjectListController' => 'applications/project/controller/PhabricatorProjectListController.php', 'PhabricatorProjectListController' => 'applications/project/controller/PhabricatorProjectListController.php',
'PhabricatorProjectLogicalAndDatasource' => 'applications/project/typeahead/PhabricatorProjectLogicalAndDatasource.php', 'PhabricatorProjectLogicalAndDatasource' => 'applications/project/typeahead/PhabricatorProjectLogicalAndDatasource.php',
@ -3973,7 +3973,6 @@ phutil_register_library_map(array(
'AphrontException' => 'Exception', 'AphrontException' => 'Exception',
'AphrontFileResponse' => 'AphrontResponse', 'AphrontFileResponse' => 'AphrontResponse',
'AphrontFormCheckboxControl' => 'AphrontFormControl', 'AphrontFormCheckboxControl' => 'AphrontFormControl',
'AphrontFormChooseButtonControl' => 'AphrontFormControl',
'AphrontFormControl' => 'AphrontView', 'AphrontFormControl' => 'AphrontView',
'AphrontFormDateControl' => 'AphrontFormControl', 'AphrontFormDateControl' => 'AphrontFormControl',
'AphrontFormDateControlValue' => 'Phobject', 'AphrontFormDateControlValue' => 'Phobject',
@ -5527,6 +5526,7 @@ phutil_register_library_map(array(
'PHUIFeedStoryView' => 'AphrontView', 'PHUIFeedStoryView' => 'AphrontView',
'PHUIFormDividerControl' => 'AphrontFormControl', 'PHUIFormDividerControl' => 'AphrontFormControl',
'PHUIFormFreeformDateControl' => 'AphrontFormControl', 'PHUIFormFreeformDateControl' => 'AphrontFormControl',
'PHUIFormIconSetControl' => 'AphrontFormControl',
'PHUIFormInsetView' => 'AphrontView', 'PHUIFormInsetView' => 'AphrontView',
'PHUIFormLayoutView' => 'AphrontView', 'PHUIFormLayoutView' => 'AphrontView',
'PHUIFormMultiSubmitControl' => 'AphrontFormControl', 'PHUIFormMultiSubmitControl' => 'AphrontFormControl',
@ -5873,10 +5873,9 @@ phutil_register_library_map(array(
'PhabricatorBadgesDAO' => 'PhabricatorLiskDAO', 'PhabricatorBadgesDAO' => 'PhabricatorLiskDAO',
'PhabricatorBadgesDefaultEditCapability' => 'PhabricatorPolicyCapability', 'PhabricatorBadgesDefaultEditCapability' => 'PhabricatorPolicyCapability',
'PhabricatorBadgesEditController' => 'PhabricatorBadgesController', 'PhabricatorBadgesEditController' => 'PhabricatorBadgesController',
'PhabricatorBadgesEditIconController' => 'PhabricatorBadgesController',
'PhabricatorBadgesEditRecipientsController' => 'PhabricatorBadgesController', 'PhabricatorBadgesEditRecipientsController' => 'PhabricatorBadgesController',
'PhabricatorBadgesEditor' => 'PhabricatorApplicationTransactionEditor', 'PhabricatorBadgesEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorBadgesIcon' => 'Phobject', 'PhabricatorBadgesIconSet' => 'PhabricatorIconSet',
'PhabricatorBadgesListController' => 'PhabricatorBadgesController', 'PhabricatorBadgesListController' => 'PhabricatorBadgesController',
'PhabricatorBadgesMailReceiver' => 'PhabricatorObjectMailReceiver', 'PhabricatorBadgesMailReceiver' => 'PhabricatorObjectMailReceiver',
'PhabricatorBadgesPHIDType' => 'PhabricatorPHIDType', 'PhabricatorBadgesPHIDType' => 'PhabricatorPHIDType',
@ -5944,7 +5943,6 @@ phutil_register_library_map(array(
'PhabricatorCalendarEventCommentController' => 'PhabricatorCalendarController', 'PhabricatorCalendarEventCommentController' => 'PhabricatorCalendarController',
'PhabricatorCalendarEventDragController' => 'PhabricatorCalendarController', 'PhabricatorCalendarEventDragController' => 'PhabricatorCalendarController',
'PhabricatorCalendarEventEditController' => 'PhabricatorCalendarController', 'PhabricatorCalendarEventEditController' => 'PhabricatorCalendarController',
'PhabricatorCalendarEventEditIconController' => 'PhabricatorCalendarController',
'PhabricatorCalendarEventEditor' => 'PhabricatorApplicationTransactionEditor', 'PhabricatorCalendarEventEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorCalendarEventEmailCommand' => 'MetaMTAEmailTransactionCommand', 'PhabricatorCalendarEventEmailCommand' => 'MetaMTAEmailTransactionCommand',
'PhabricatorCalendarEventInvitee' => array( 'PhabricatorCalendarEventInvitee' => array(
@ -5966,7 +5964,7 @@ phutil_register_library_map(array(
'PhabricatorCalendarEventViewController' => 'PhabricatorCalendarController', 'PhabricatorCalendarEventViewController' => 'PhabricatorCalendarController',
'PhabricatorCalendarHoliday' => 'PhabricatorCalendarDAO', 'PhabricatorCalendarHoliday' => 'PhabricatorCalendarDAO',
'PhabricatorCalendarHolidayTestCase' => 'PhabricatorTestCase', 'PhabricatorCalendarHolidayTestCase' => 'PhabricatorTestCase',
'PhabricatorCalendarIcon' => 'Phobject', 'PhabricatorCalendarIconSet' => 'PhabricatorIconSet',
'PhabricatorCalendarRemarkupRule' => 'PhabricatorObjectRemarkupRule', 'PhabricatorCalendarRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'PhabricatorCalendarReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler', 'PhabricatorCalendarReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
'PhabricatorCalendarSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'PhabricatorCalendarSchemaSpec' => 'PhabricatorConfigSchemaSpec',
@ -6452,6 +6450,7 @@ phutil_register_library_map(array(
'PhabricatorFileEditor' => 'PhabricatorApplicationTransactionEditor', 'PhabricatorFileEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorFileFilePHIDType' => 'PhabricatorPHIDType', 'PhabricatorFileFilePHIDType' => 'PhabricatorPHIDType',
'PhabricatorFileHasObjectEdgeType' => 'PhabricatorEdgeType', 'PhabricatorFileHasObjectEdgeType' => 'PhabricatorEdgeType',
'PhabricatorFileIconSetSelectController' => 'PhabricatorFileController',
'PhabricatorFileImageMacro' => array( 'PhabricatorFileImageMacro' => array(
'PhabricatorFileDAO', 'PhabricatorFileDAO',
'PhabricatorSubscribableInterface', 'PhabricatorSubscribableInterface',
@ -6563,6 +6562,8 @@ phutil_register_library_map(array(
'PhabricatorIDsSearchField' => 'PhabricatorSearchField', 'PhabricatorIDsSearchField' => 'PhabricatorSearchField',
'PhabricatorIRCProtocolAdapter' => 'PhabricatorProtocolAdapter', 'PhabricatorIRCProtocolAdapter' => 'PhabricatorProtocolAdapter',
'PhabricatorIconRemarkupRule' => 'PhutilRemarkupRule', 'PhabricatorIconRemarkupRule' => 'PhutilRemarkupRule',
'PhabricatorIconSet' => 'Phobject',
'PhabricatorIconSetIcon' => 'Phobject',
'PhabricatorImageMacroRemarkupRule' => 'PhutilRemarkupRule', 'PhabricatorImageMacroRemarkupRule' => 'PhutilRemarkupRule',
'PhabricatorImageTransformer' => 'Phobject', 'PhabricatorImageTransformer' => 'Phobject',
'PhabricatorImagemagickSetupCheck' => 'PhabricatorSetupCheck', 'PhabricatorImagemagickSetupCheck' => 'PhabricatorSetupCheck',
@ -7095,12 +7096,11 @@ phutil_register_library_map(array(
'PhabricatorProjectDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorProjectDatasource' => 'PhabricatorTypeaheadDatasource',
'PhabricatorProjectDescriptionField' => 'PhabricatorProjectStandardCustomField', 'PhabricatorProjectDescriptionField' => 'PhabricatorProjectStandardCustomField',
'PhabricatorProjectEditDetailsController' => 'PhabricatorProjectController', 'PhabricatorProjectEditDetailsController' => 'PhabricatorProjectController',
'PhabricatorProjectEditIconController' => 'PhabricatorProjectController',
'PhabricatorProjectEditPictureController' => 'PhabricatorProjectController', 'PhabricatorProjectEditPictureController' => 'PhabricatorProjectController',
'PhabricatorProjectEditorTestCase' => 'PhabricatorTestCase', 'PhabricatorProjectEditorTestCase' => 'PhabricatorTestCase',
'PhabricatorProjectFeedController' => 'PhabricatorProjectController', 'PhabricatorProjectFeedController' => 'PhabricatorProjectController',
'PhabricatorProjectHeraldAction' => 'HeraldAction', 'PhabricatorProjectHeraldAction' => 'HeraldAction',
'PhabricatorProjectIcon' => 'Phobject', 'PhabricatorProjectIconSet' => 'PhabricatorIconSet',
'PhabricatorProjectListController' => 'PhabricatorProjectController', 'PhabricatorProjectListController' => 'PhabricatorProjectController',
'PhabricatorProjectLogicalAndDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'PhabricatorProjectLogicalAndDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
'PhabricatorProjectLogicalDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'PhabricatorProjectLogicalDatasource' => 'PhabricatorTypeaheadCompositeDatasource',

View file

@ -49,10 +49,6 @@ final class PhabricatorBadgesApplication extends PhabricatorApplication {
=> 'PhabricatorBadgesArchiveController', => 'PhabricatorBadgesArchiveController',
'view/(?:(?P<id>\d+)/)?' 'view/(?:(?P<id>\d+)/)?'
=> 'PhabricatorBadgesViewController', => 'PhabricatorBadgesViewController',
'icon/(?P<id>[1-9]\d*)/'
=> 'PhabricatorBadgesEditIconController',
'icon/'
=> 'PhabricatorBadgesEditIconController',
'recipients/(?P<id>[1-9]\d*)/' 'recipients/(?P<id>[1-9]\d*)/'
=> 'PhabricatorBadgesEditRecipientsController', => 'PhabricatorBadgesEditRecipientsController',
'recipients/(?P<id>[1-9]\d*)/remove/' 'recipients/(?P<id>[1-9]\d*)/remove/'

View file

@ -111,13 +111,6 @@ final class PhabricatorBadgesEditController
} }
} }
if ($is_new) {
$icon_uri = $this->getApplicationURI('icon/');
} else {
$icon_uri = $this->getApplicationURI('icon/'.$badge->getID().'/');
}
$icon_display = PhabricatorBadgesIcon::renderIconForChooser($v_icon);
$policies = id(new PhabricatorPolicyQuery()) $policies = id(new PhabricatorPolicyQuery())
->setViewer($viewer) ->setViewer($viewer)
->setObject($badge) ->setObject($badge)
@ -137,12 +130,10 @@ final class PhabricatorBadgesEditController
->setLabel(pht('Flavor Text')) ->setLabel(pht('Flavor Text'))
->setValue($v_flav)) ->setValue($v_flav))
->appendChild( ->appendChild(
id(new AphrontFormChooseButtonControl()) id(new PHUIFormIconSetControl())
->setLabel(pht('Icon')) ->setLabel(pht('Icon'))
->setName('icon') ->setName('icon')
->setDisplayValue($icon_display) ->setIconSet(new PhabricatorBadgesIconSet())
->setButtonText(pht('Choose Icon...'))
->setChooseURI($icon_uri)
->setValue($v_icon)) ->setValue($v_icon))
->appendChild( ->appendChild(
id(new AphrontFormSelectControl()) id(new AphrontFormSelectControl())

View file

@ -1,101 +0,0 @@
<?php
final class PhabricatorBadgesEditIconController
extends PhabricatorBadgesController {
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
if ($id) {
$badge = id(new PhabricatorBadgesQuery())
->setViewer($viewer)
->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->executeOne();
if (!$badge) {
return new Aphront404Response();
}
$cancel_uri =
$this->getApplicationURI('view/'.$badge->getID().'/');
$badge_icon = $badge->getIcon();
} else {
$this->requireApplicationCapability(
PhabricatorBadgesCreateCapability::CAPABILITY);
$cancel_uri = '/badges/';
$badge_icon = $request->getStr('value');
}
require_celerity_resource('project-icon-css');
Javelin::initBehavior('phabricator-tooltips');
$badge_icons = PhabricatorBadgesIcon::getIconMap();
if ($request->isFormPost()) {
$v_icon = $request->getStr('icon');
return id(new AphrontAjaxResponse())->setContent(
array(
'value' => $v_icon,
'display' => PhabricatorBadgesIcon::renderIconForChooser($v_icon),
));
}
$ii = 0;
$buttons = array();
foreach ($badge_icons as $icon => $label) {
$view = id(new PHUIIconView())
->setIconFont($icon);
$aural = javelin_tag(
'span',
array(
'aural' => true,
),
pht('Choose "%s" Icon', $label));
if ($icon == $badge_icon) {
$class_extra = ' selected';
} else {
$class_extra = null;
}
$buttons[] = javelin_tag(
'button',
array(
'class' => 'icon-button'.$class_extra,
'name' => 'icon',
'value' => $icon,
'type' => 'submit',
'sigil' => 'has-tooltip',
'meta' => array(
'tip' => $label,
),
),
array(
$aural,
$view,
));
if ((++$ii % 4) == 0) {
$buttons[] = phutil_tag('br');
}
}
$buttons = phutil_tag(
'div',
array(
'class' => 'icon-grid',
),
$buttons);
return $this->newDialog()
->setTitle(pht('Choose Badge Icon'))
->appendChild($buttons)
->addCancelButton($cancel_uri);
}
}

View file

@ -85,7 +85,6 @@ final class PhabricatorBadgesViewController
->setObject($badge); ->setObject($badge);
$quality = idx($badge->getQualityNameMap(), $badge->getQuality()); $quality = idx($badge->getQualityNameMap(), $badge->getQuality());
$icon = idx($badge->getIconNameMap(), $badge->getIcon());
$view->addProperty( $view->addProperty(
pht('Quality'), pht('Quality'),
@ -93,7 +92,8 @@ final class PhabricatorBadgesViewController
$view->addProperty( $view->addProperty(
pht('Icon'), pht('Icon'),
$icon); id(new PhabricatorBadgesIconSet())
->getIconLabel($badge->getIcon()));
$view->addProperty( $view->addProperty(
pht('Flavor'), pht('Flavor'),

View file

@ -1,53 +0,0 @@
<?php
final class PhabricatorBadgesIcon extends Phobject {
public static function getIconMap() {
return
array(
'fa-star' => pht('Superstar'),
'fa-user' => pht('Average Person'),
'fa-bug' => pht('Ladybug'),
'fa-users' => pht('Triplets'),
'fa-book' => pht('Nominomicon'),
'fa-rocket' => pht('Escape Route'),
'fa-life-ring' => pht('Foam Circle'),
'fa-birthday-cake' => pht('Cake Day'),
'fa-camera-retro' => pht('Leica Enthusiast'),
'fa-beer' => pht('Liquid Lunch'),
'fa-gift' => pht('Free Stuff'),
'fa-eye' => pht('Eye See You'),
'fa-heart' => pht('Love is Love'),
'fa-trophy' => pht('Winner at Things'),
'fa-umbrella' => pht('Rain Defender'),
'fa-graduation-cap' => pht('In Debt'),
);
}
public static function getLabel($key) {
$map = self::getIconMap();
return $map[$key];
}
public static function getAPIName($key) {
return substr($key, 3);
}
public static function renderIconForChooser($icon) {
$badge_icons = self::getIconMap();
return phutil_tag(
'span',
array(),
array(
id(new PHUIIconView())->setIconFont($icon),
' ',
idx($badge_icons, $icon, pht('Unknown Icon')),
));
}
}

View file

@ -0,0 +1,45 @@
<?php
final class PhabricatorBadgesIconSet
extends PhabricatorIconSet {
const ICONSETKEY = 'badges';
public function getSelectIconTitleText() {
return pht('Choose Badge Icon');
}
protected function newIcons() {
$map = array(
'fa-star' => pht('Superstar'),
'fa-user' => pht('Average Person'),
'fa-bug' => pht('Ladybug'),
'fa-users' => pht('Triplets'),
'fa-book' => pht('Nominomicon'),
'fa-rocket' => pht('Escape Route'),
'fa-life-ring' => pht('Foam Circle'),
'fa-birthday-cake' => pht('Cake Day'),
'fa-camera-retro' => pht('Leica Enthusiast'),
'fa-beer' => pht('Liquid Lunch'),
'fa-gift' => pht('Free Stuff'),
'fa-eye' => pht('Eye See You'),
'fa-heart' => pht('Love is Love'),
'fa-trophy' => pht('Winner at Things'),
'fa-umbrella' => pht('Rain Defender'),
'fa-graduation-cap' => pht('In Debt'),
);
$icons = array();
foreach ($map as $key => $label) {
$icons[] = id(new PhabricatorIconSetIcon())
->setKey($key)
->setLabel($label);
}
return $icons;
}
}

View file

@ -54,10 +54,6 @@ final class PhabricatorBadgesBadge extends PhabricatorBadgesDAO
); );
} }
public static function getIconNameMap() {
return PhabricatorBadgesIcon::getIconMap();
}
public static function initializeNewBadge(PhabricatorUser $actor) { public static function initializeNewBadge(PhabricatorUser $actor) {
$app = id(new PhabricatorApplicationQuery()) $app = id(new PhabricatorApplicationQuery())
->setViewer($actor) ->setViewer($actor)

View file

@ -78,9 +78,11 @@ final class PhabricatorBadgesTransaction
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$new); $new);
} else { } else {
$icon_map = PhabricatorBadgesBadge::getIconNameMap(); $set = new PhabricatorBadgesIconSet();
$icon_new = idx($icon_map, $new, $new);
$icon_old = idx($icon_map, $old, $old); $icon_old = $set->getIconLabel($old);
$icon_new = $set->getIconLabel($new);
return pht( return pht(
'%s updated the icon for this badge from "%s" to "%s".', '%s updated the icon for this badge from "%s" to "%s".',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),

View file

@ -46,10 +46,6 @@ final class PhabricatorCalendarApplication extends PhabricatorApplication {
'(?:query/(?P<queryKey>[^/]+)/(?:(?P<year>\d+)/'. '(?:query/(?P<queryKey>[^/]+)/(?:(?P<year>\d+)/'.
'(?P<month>\d+)/)?(?:(?P<day>\d+)/)?)?' '(?P<month>\d+)/)?(?:(?P<day>\d+)/)?)?'
=> 'PhabricatorCalendarEventListController', => 'PhabricatorCalendarEventListController',
'icon/(?P<id>[1-9]\d*)/'
=> 'PhabricatorCalendarEventEditIconController',
'icon/'
=> 'PhabricatorCalendarEventEditIconController',
'event/' => array( 'event/' => array(
'create/' 'create/'
=> 'PhabricatorCalendarEventEditController', => 'PhabricatorCalendarEventEditController',

View file

@ -499,18 +499,11 @@ final class PhabricatorCalendarEventEditController
->setUser($viewer) ->setUser($viewer)
->setDatasource(new PhabricatorMetaMTAMailableDatasource()); ->setDatasource(new PhabricatorMetaMTAMailableDatasource());
if ($this->isCreate()) {
$icon_uri = $this->getApplicationURI('icon/'); $icon = id(new PHUIFormIconSetControl())
} else {
$icon_uri = $this->getApplicationURI('icon/'.$event->getID().'/');
}
$icon_display = PhabricatorCalendarIcon::renderIconForChooser($icon);
$icon = id(new AphrontFormChooseButtonControl())
->setLabel(pht('Icon')) ->setLabel(pht('Icon'))
->setName('icon') ->setName('icon')
->setDisplayValue($icon_display) ->setIconSet(new PhabricatorCalendarIconSet())
->setButtonText(pht('Choose Icon...'))
->setChooseURI($icon_uri)
->setValue($icon); ->setValue($icon);
$form = id(new AphrontFormView()) $form = id(new AphrontFormView())

View file

@ -1,97 +0,0 @@
<?php
final class PhabricatorCalendarEventEditIconController
extends PhabricatorCalendarController {
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getUser();
$id = $request->getURIData('id');
if ($id) {
$event = id(new PhabricatorCalendarEventQuery())
->setViewer($viewer)
->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->executeOne();
if (!$event) {
return new Aphront404Response();
}
$cancel_uri = $this->getApplicationURI('/E'.$event->getID());
$event_icon = $event->getIcon();
} else {
$cancel_uri = '/calendar/';
$event_icon = $request->getStr('value');
}
require_celerity_resource('calendar-icon-css');
Javelin::initBehavior('phabricator-tooltips');
$calendar_icons = PhabricatorCalendarIcon::getIconMap();
if ($request->isFormPost()) {
$v_icon = $request->getStr('icon');
return id(new AphrontAjaxResponse())->setContent(
array(
'value' => $v_icon,
'display' => PhabricatorCalendarIcon::renderIconForChooser($v_icon),
));
}
$ii = 0;
$buttons = array();
foreach ($calendar_icons as $icon => $label) {
$view = id(new PHUIIconView())
->setIconFont($icon);
$aural = javelin_tag(
'span',
array(
'aural' => true,
),
pht('Choose "%s" Icon', $label));
if ($icon == $event_icon) {
$class_extra = ' selected';
} else {
$class_extra = null;
}
$buttons[] = javelin_tag(
'button',
array(
'class' => 'icon-button'.$class_extra,
'name' => 'icon',
'value' => $icon,
'type' => 'submit',
'sigil' => 'has-tooltip',
'meta' => array(
'tip' => $label,
),
),
array(
$aural,
$view,
));
if ((++$ii % 4) == 0) {
$buttons[] = phutil_tag('br');
}
}
$buttons = phutil_tag(
'div',
array(
'class' => 'icon-grid',
),
$buttons);
return $this->newDialog()
->setTitle(pht('Choose Calendar Event Icon'))
->appendChild($buttons)
->addCancelButton($cancel_uri);
}
}

View file

@ -360,11 +360,10 @@ final class PhabricatorCalendarEventViewController
$properties->invokeWillRenderEvent(); $properties->invokeWillRenderEvent();
$icon_display = PhabricatorCalendarIcon::renderIconForChooser(
$event->getIcon());
$properties->addProperty( $properties->addProperty(
pht('Icon'), pht('Icon'),
$icon_display); id(new PhabricatorCalendarIconSet())
->getIconLabel($event->getIcon()));
if (strlen($event->getDescription())) { if (strlen($event->getDescription())) {
$description = PhabricatorMarkupEngine::renderOneObject( $description = PhabricatorMarkupEngine::renderOneObject(

View file

@ -1,49 +0,0 @@
<?php
final class PhabricatorCalendarIcon extends Phobject {
public static function getIconMap() {
return
array(
'fa-calendar' => pht('Default'),
'fa-glass' => pht('Party'),
'fa-plane' => pht('Travel'),
'fa-plus-square' => pht('Health / Appointment'),
'fa-rocket' => pht('Sabatical / Leave'),
'fa-home' => pht('Working From Home'),
'fa-tree' => pht('Holiday'),
'fa-gamepad' => pht('Staycation'),
'fa-coffee' => pht('Coffee Meeting'),
'fa-film' => pht('Movie'),
'fa-users' => pht('Meeting'),
'fa-cutlery' => pht('Meal'),
'fa-paw' => pht('Pet Activity'),
'fa-institution' => pht('Official Business'),
'fa-bus' => pht('Field Trip'),
'fa-microphone' => pht('Conference'),
);
}
public static function getLabel($key) {
$map = self::getIconMap();
return $map[$key];
}
public static function getAPIName($key) {
return substr($key, 3);
}
public static function renderIconForChooser($icon) {
$calendar_icons = self::getIconMap();
return phutil_tag(
'span',
array(),
array(
id(new PHUIIconView())->setIconFont($icon),
' ',
idx($calendar_icons, $icon, pht('Unknown Icon')),
));
}
}

View file

@ -0,0 +1,45 @@
<?php
final class PhabricatorCalendarIconSet
extends PhabricatorIconSet {
const ICONSETKEY = 'calendar.event';
public function getSelectIconTitleText() {
return pht('Choose Event Icon');
}
protected function newIcons() {
$map = array(
'fa-calendar' => pht('Default'),
'fa-glass' => pht('Party'),
'fa-plane' => pht('Travel'),
'fa-plus-square' => pht('Health / Appointment'),
'fa-rocket' => pht('Sabatical / Leave'),
'fa-home' => pht('Working From Home'),
'fa-tree' => pht('Holiday'),
'fa-gamepad' => pht('Staycation'),
'fa-coffee' => pht('Coffee Meeting'),
'fa-film' => pht('Movie'),
'fa-users' => pht('Meeting'),
'fa-cutlery' => pht('Meal'),
'fa-paw' => pht('Pet Activity'),
'fa-institution' => pht('Official Business'),
'fa-bus' => pht('Field Trip'),
'fa-microphone' => pht('Conference'),
);
$icons = array();
foreach ($map as $key => $label) {
$icons[] = id(new PhabricatorIconSetIcon())
->setKey($key)
->setLabel($label);
}
return $icons;
}
}

View file

@ -156,10 +156,11 @@ final class PhabricatorCalendarEventTransaction
$this->renderHandleLink($author_phid)); $this->renderHandleLink($author_phid));
} }
case self::TYPE_ICON: case self::TYPE_ICON:
$set = new PhabricatorCalendarIconSet();
return pht( return pht(
'%s set this event\'s icon to %s.', '%s set this event\'s icon to %s.',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
PhabricatorCalendarIcon::getLabel($new)); $set->getIconLabel($new));
break; break;
case self::TYPE_CANCEL: case self::TYPE_CANCEL:
if ($new) { if ($new) {
@ -356,11 +357,12 @@ final class PhabricatorCalendarEventTransaction
$this->renderHandleLink($object_phid)); $this->renderHandleLink($object_phid));
} }
case self::TYPE_ICON: case self::TYPE_ICON:
$set = new PhabricatorCalendarIconSet();
return pht( return pht(
'%s set the icon for %s to %s.', '%s set the icon for %s to %s.',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid), $this->renderHandleLink($object_phid),
PhabricatorCalendarIcon::getLabel($new)); $set->getIconLabel($new));
case self::TYPE_CANCEL: case self::TYPE_CANCEL:
if ($new) { if ($new) {
return pht( return pht(

View file

@ -83,6 +83,9 @@ final class PhabricatorFilesApplication extends PhabricatorApplication {
'PhabricatorFileTransformListController', 'PhabricatorFileTransformListController',
'uploaddialog/' => 'PhabricatorFileUploadDialogController', 'uploaddialog/' => 'PhabricatorFileUploadDialogController',
'download/(?P<phid>[^/]+)/' => 'PhabricatorFileDialogController', 'download/(?P<phid>[^/]+)/' => 'PhabricatorFileDialogController',
'iconset/(?P<key>[^/]+)/' => array(
'select/' => 'PhabricatorFileIconSetSelectController',
),
) + $this->getResourceSubroutes(), ) + $this->getResourceSubroutes(),
); );
} }

View file

@ -0,0 +1,91 @@
<?php
final class PhabricatorFileIconSetSelectController
extends PhabricatorFileController {
public function handleRequest(AphrontRequest $request) {
$key = $request->getURIData('key');
$set = PhabricatorIconSet::getIconSetByKey($key);
if (!$set) {
return new Aphront404Response();
}
$v_icon = $request->getStr('icon');
if ($request->isFormPost()) {
$icon = $set->getIcon($v_icon);
if ($icon) {
$payload = array(
'value' => $icon->getKey(),
'display' => $set->renderIconForControl($icon),
);
return id(new AphrontAjaxResponse())
->setContent($payload);
}
}
require_celerity_resource('project-icon-css');
Javelin::initBehavior('phabricator-tooltips');
$ii = 0;
$buttons = array();
foreach ($set->getIcons() as $icon) {
$label = $icon->getLabel();
$view = id(new PHUIIconView())
->setIconFont($icon->getIcon());
$aural = javelin_tag(
'span',
array(
'aural' => true,
),
pht('Choose "%s" Icon', $label));
$classes = array();
$classes[] = 'icon-button';
if ($icon->getKey() == $v_icon) {
$classes[] = 'selected';
}
$buttons[] = javelin_tag(
'button',
array(
'class' => implode(' ', $classes),
'name' => 'icon',
'value' => $icon->getKey(),
'type' => 'submit',
'sigil' => 'has-tooltip',
'meta' => array(
'tip' => $label,
),
),
array(
$aural,
$view,
));
if ((++$ii % 4) == 0) {
$buttons[] = phutil_tag('br');
}
}
$buttons = phutil_tag(
'div',
array(
'class' => 'icon-grid',
),
$buttons);
$dialog_title = $set->getSelectIconTitleText();
return $this->newDialog()
->setTitle($dialog_title)
->appendChild($buttons)
->addCancelButton('/');
}
}

View file

@ -0,0 +1,70 @@
<?php
abstract class PhabricatorIconSet
extends Phobject {
final public function getIconSetKey() {
return $this->getPhobjectClassConstant('ICONSETKEY');
}
public function getChooseButtonText() {
return pht('Choose Icon...');
}
public function getSelectIconTitleText() {
return pht('Choose Icon');
}
public function getSelectURI() {
$key = $this->getIconSetKey();
return "/file/iconset/{$key}/select/";
}
final public function getIcons() {
$icons = $this->newIcons();
// TODO: Validate icons.
$icons = mpull($icons, null, 'getKey');
return $icons;
}
final public function getIcon($key) {
$icons = $this->getIcons();
return idx($icons, $key);
}
final public function getIconLabel($key) {
$icon = $this->getIcon($key);
if ($icon) {
return $icon->getLabel();
}
return $key;
}
final public function renderIconForControl(PhabricatorIconSetIcon $icon) {
return phutil_tag(
'span',
array(),
array(
id(new PHUIIconView())->setIconFont($icon->getIcon()),
' ',
$icon->getLabel(),
));
}
final public static function getIconSetByKey($key) {
$sets = self::getAllIconSets();
return idx($sets, $key);
}
final public static function getAllIconSets() {
return id(new PhutilClassMapQuery())
->setAncestorClass(__CLASS__)
->setUniqueMethod('getIconSetKey')
->execute();
}
}

View file

@ -0,0 +1,40 @@
<?php
final class PhabricatorIconSetIcon
extends Phobject {
private $key;
private $icon;
private $label;
public function setKey($key) {
$this->key = $key;
return $this;
}
public function getKey() {
return $this->key;
}
public function setIcon($icon) {
$this->icon = $icon;
return $this;
}
public function getIcon() {
if ($this->icon === null) {
return $this->getKey();
}
return $this->icon;
}
public function setLabel($label) {
$this->label = $label;
return $this;
}
public function getLabel() {
return $this->label;
}
}

View file

@ -59,10 +59,6 @@ final class PhabricatorProjectApplication extends PhabricatorApplication {
=> 'PhabricatorProjectViewController', => 'PhabricatorProjectViewController',
'picture/(?P<id>[1-9]\d*)/' 'picture/(?P<id>[1-9]\d*)/'
=> 'PhabricatorProjectEditPictureController', => 'PhabricatorProjectEditPictureController',
'icon/(?P<id>[1-9]\d*)/'
=> 'PhabricatorProjectEditIconController',
'icon/'
=> 'PhabricatorProjectEditIconController',
'create/' => 'PhabricatorProjectEditDetailsController', 'create/' => 'PhabricatorProjectEditDetailsController',
'board/(?P<id>[1-9]\d*)/'. 'board/(?P<id>[1-9]\d*)/'.
'(?P<filter>filter/)?'. '(?P<filter>filter/)?'.

View file

@ -26,7 +26,7 @@ abstract class ProjectConduitAPIMethod extends ConduitAPIMethod {
$project_slugs = $project->getSlugs(); $project_slugs = $project->getSlugs();
$project_slugs = array_values(mpull($project_slugs, 'getSlug')); $project_slugs = array_values(mpull($project_slugs, 'getSlug'));
$project_icon = PhabricatorProjectIcon::getAPIName($project->getIcon()); $project_icon = substr($project->getIcon(), 3);
$result[$project->getPHID()] = array( $result[$project->getPHID()] = array(
'id' => $project->getID(), 'id' => $project->getID(),

View file

@ -188,14 +188,8 @@ final class PhabricatorProjectEditDetailsController
->setError($e_name)); ->setError($e_name));
$field_list->appendFieldsToForm($form); $field_list->appendFieldsToForm($form);
$shades = PhabricatorProjectIcon::getColorMap(); $shades = PhabricatorProjectIconSet::getColorMap();
if ($is_new) {
$icon_uri = $this->getApplicationURI('icon/');
} else {
$icon_uri = $this->getApplicationURI('icon/'.$project->getID().'/');
}
$icon_display = PhabricatorProjectIcon::renderIconForChooser($v_icon);
list($can_lock, $lock_message) = $this->explainApplicationCapability( list($can_lock, $lock_message) = $this->explainApplicationCapability(
ProjectCanLockProjectsCapability::CAPABILITY, ProjectCanLockProjectsCapability::CAPABILITY,
pht('You can update the Lock Project setting.'), pht('You can update the Lock Project setting.'),
@ -203,12 +197,10 @@ final class PhabricatorProjectEditDetailsController
$form $form
->appendChild( ->appendChild(
id(new AphrontFormChooseButtonControl()) id(new PHUIFormIconSetControl())
->setLabel(pht('Icon')) ->setLabel(pht('Icon'))
->setName('icon') ->setName('icon')
->setDisplayValue($icon_display) ->setIconSet(new PhabricatorProjectIconSet())
->setButtonText(pht('Choose Icon...'))
->setChooseURI($icon_uri)
->setValue($v_icon)) ->setValue($v_icon))
->appendChild( ->appendChild(
id(new AphrontFormSelectControl()) id(new AphrontFormSelectControl())

View file

@ -1,100 +0,0 @@
<?php
final class PhabricatorProjectEditIconController
extends PhabricatorProjectController {
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
if ($id) {
$project = id(new PhabricatorProjectQuery())
->setViewer($viewer)
->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->executeOne();
if (!$project) {
return new Aphront404Response();
}
$cancel_uri = $this->getApplicationURI('profile/'.$project->getID().'/');
$project_icon = $project->getIcon();
} else {
$this->requireApplicationCapability(
ProjectCreateProjectsCapability::CAPABILITY);
$cancel_uri = '/project/';
$project_icon = $request->getStr('value');
}
require_celerity_resource('project-icon-css');
Javelin::initBehavior('phabricator-tooltips');
$project_icons = PhabricatorProjectIcon::getIconMap();
if ($request->isFormPost()) {
$v_icon = $request->getStr('icon');
return id(new AphrontAjaxResponse())->setContent(
array(
'value' => $v_icon,
'display' => PhabricatorProjectIcon::renderIconForChooser($v_icon),
));
}
$ii = 0;
$buttons = array();
foreach ($project_icons as $icon => $label) {
$view = id(new PHUIIconView())
->setIconFont($icon);
$aural = javelin_tag(
'span',
array(
'aural' => true,
),
pht('Choose "%s" Icon', $label));
if ($icon == $project_icon) {
$class_extra = ' selected';
} else {
$class_extra = null;
}
$buttons[] = javelin_tag(
'button',
array(
'class' => 'icon-button'.$class_extra,
'name' => 'icon',
'value' => $icon,
'type' => 'submit',
'sigil' => 'has-tooltip',
'meta' => array(
'tip' => $label,
),
),
array(
$aural,
$view,
));
if ((++$ii % 4) == 0) {
$buttons[] = phutil_tag('br');
}
}
$buttons = phutil_tag(
'div',
array(
'class' => 'icon-grid',
),
$buttons);
return $this->newDialog()
->setTitle(pht('Choose Project Icon'))
->appendChild($buttons)
->addCancelButton($cancel_uri);
}
}

View file

@ -1,59 +0,0 @@
<?php
final class PhabricatorProjectIcon extends Phobject {
public static function getIconMap() {
return
array(
'fa-briefcase' => pht('Briefcase'),
'fa-tags' => pht('Tag'),
'fa-folder' => pht('Folder'),
'fa-users' => pht('Team'),
'fa-bug' => pht('Bug'),
'fa-trash-o' => pht('Garbage'),
'fa-calendar' => pht('Deadline'),
'fa-flag-checkered' => pht('Goal'),
'fa-envelope' => pht('Communication'),
'fa-truck' => pht('Release'),
'fa-lock' => pht('Policy'),
'fa-umbrella' => pht('An Umbrella'),
'fa-cloud' => pht('The Cloud'),
'fa-building' => pht('Company'),
'fa-credit-card' => pht('Accounting'),
'fa-flask' => pht('Experimental'),
);
}
public static function getColorMap() {
$shades = PHUITagView::getShadeMap();
$shades = array_select_keys(
$shades,
array(PhabricatorProject::DEFAULT_COLOR)) + $shades;
unset($shades[PHUITagView::COLOR_DISABLED]);
return $shades;
}
public static function getLabel($key) {
$map = self::getIconMap();
return $map[$key];
}
public static function getAPIName($key) {
return substr($key, 3);
}
public static function renderIconForChooser($icon) {
$project_icons = self::getIconMap();
return phutil_tag(
'span',
array(),
array(
id(new PHUIIconView())->setIconFont($icon),
' ',
idx($project_icons, $icon, pht('Unknown Icon')),
));
}
}

View file

@ -0,0 +1,55 @@
<?php
final class PhabricatorProjectIconSet
extends PhabricatorIconSet {
const ICONSETKEY = 'projects';
public function getSelectIconTitleText() {
return pht('Choose Project Icon');
}
protected function newIcons() {
$map = array(
'fa-briefcase' => pht('Briefcase'),
'fa-tags' => pht('Tag'),
'fa-folder' => pht('Folder'),
'fa-users' => pht('Team'),
'fa-bug' => pht('Bug'),
'fa-trash-o' => pht('Garbage'),
'fa-calendar' => pht('Deadline'),
'fa-flag-checkered' => pht('Goal'),
'fa-envelope' => pht('Communication'),
'fa-truck' => pht('Release'),
'fa-lock' => pht('Policy'),
'fa-umbrella' => pht('An Umbrella'),
'fa-cloud' => pht('The Cloud'),
'fa-building' => pht('Company'),
'fa-credit-card' => pht('Accounting'),
'fa-flask' => pht('Experimental'),
);
$icons = array();
foreach ($map as $key => $label) {
$icons[] = id(new PhabricatorIconSetIcon())
->setKey($key)
->setLabel($label);
}
return $icons;
}
public static function getColorMap() {
$shades = PHUITagView::getShadeMap();
$shades = array_select_keys(
$shades,
array(PhabricatorProject::DEFAULT_COLOR)) + $shades;
unset($shades[PHUITagView::COLOR_DISABLED]);
return $shades;
}
}

View file

@ -128,12 +128,13 @@ protected function buildQueryFromParameters(array $map) {
private function getIconOptions() { private function getIconOptions() {
$options = array(); $options = array();
foreach (PhabricatorProjectIcon::getIconMap() as $icon => $name) { $set = new PhabricatorProjectIconSet();
$options[$icon] = array( foreach ($set->getIcons() as $icon) {
$options[$icon->getKey()] = array(
id(new PHUIIconView()) id(new PHUIIconView())
->setIconFont($icon), ->setIconFont($icon->getIcon()),
' ', ' ',
$name, $icon->getLabel(),
); );
} }
@ -143,7 +144,7 @@ protected function buildQueryFromParameters(array $map) {
private function getColorOptions() { private function getColorOptions() {
$options = array(); $options = array();
foreach (PhabricatorProjectIcon::getColorMap() as $color => $name) { foreach (PhabricatorProjectIconSet::getColorMap() as $color => $name) {
$options[$color] = array( $options[$color] = array(
id(new PHUITagView()) id(new PHUITagView())
->setType(PHUITagView::TYPE_SHADE) ->setType(PHUITagView::TYPE_SHADE)

View file

@ -147,10 +147,12 @@ final class PhabricatorProjectTransaction
break; break;
case self::TYPE_ICON: case self::TYPE_ICON:
$set = new PhabricatorProjectIconSet();
return pht( return pht(
"%s set this project's icon to %s.", "%s set this project's icon to %s.",
$author_handle, $author_handle,
PhabricatorProjectIcon::getLabel($new)); $set->getIconLabel($new));
break; break;
case self::TYPE_COLOR: case self::TYPE_COLOR:
@ -301,11 +303,13 @@ final class PhabricatorProjectTransaction
} }
case self::TYPE_ICON: case self::TYPE_ICON:
$set = new PhabricatorProjectIconSet();
return pht( return pht(
'%s set the icon for %s to %s.', '%s set the icon for %s to %s.',
$author_handle, $author_handle,
$object_handle, $object_handle,
PhabricatorProjectIcon::getLabel($new)); $set->getIconLabel($new));
case self::TYPE_COLOR: case self::TYPE_COLOR:
return pht( return pht(

View file

@ -1,62 +1,59 @@
<?php <?php
final class AphrontFormChooseButtonControl extends AphrontFormControl { final class PHUIFormIconSetControl
extends AphrontFormControl {
private $displayValue; private $iconSet;
private $buttonText;
private $chooseURI;
public function setDisplayValue($display_value) { public function setIconSet(PhabricatorIconSet $icon_set) {
$this->displayValue = $display_value; $this->iconSet = $icon_set;
return $this; return $this;
} }
public function getDisplayValue() { public function getIconSet() {
return $this->displayValue; return $this->iconSet;
}
public function setButtonText($text) {
$this->buttonText = $text;
return $this;
}
public function setChooseURI($choose_uri) {
$this->chooseURI = $choose_uri;
return $this;
} }
protected function getCustomControlClass() { protected function getCustomControlClass() {
return 'aphront-form-control-choose-button'; return 'phui-form-iconset-control';
} }
protected function renderInput() { protected function renderInput() {
Javelin::initBehavior('choose-control'); Javelin::initBehavior('choose-control');
$set = $this->getIconSet();
$input_id = celerity_generate_unique_node_id(); $input_id = celerity_generate_unique_node_id();
$display_id = celerity_generate_unique_node_id(); $display_id = celerity_generate_unique_node_id();
$display_value = $this->displayValue;
$button = javelin_tag( $button = javelin_tag(
'a', 'a',
array( array(
'href' => '#', 'href' => '#',
'class' => 'button grey', 'class' => 'button grey',
'sigil' => 'aphront-form-choose-button', 'sigil' => 'phui-form-iconset-button',
), ),
nonempty($this->buttonText, pht('Choose...'))); $set->getChooseButtonText());
$icon = $set->getIcon($this->getValue());
if ($icon) {
$display = $set->renderIconForControl($icon);
} else {
$display = null;
}
$display_cell = phutil_tag( $display_cell = phutil_tag(
'td', 'td',
array( array(
'class' => 'aphront-form-choose-display-cell', 'class' => 'phui-form-iconset-display-cell',
'id' => $display_id, 'id' => $display_id,
), ),
$display_value); $display);
$button_cell = phutil_tag( $button_cell = phutil_tag(
'td', 'td',
array( array(
'class' => 'aphront-form-choose-button-cell', 'class' => 'phui-form-iconset-button-cell',
), ),
$button); $button);
@ -68,10 +65,10 @@ final class AphrontFormChooseButtonControl extends AphrontFormControl {
$layout = javelin_tag( $layout = javelin_tag(
'table', 'table',
array( array(
'class' => 'aphront-form-choose-table', 'class' => 'phui-form-iconset-table',
'sigil' => 'aphront-form-choose', 'sigil' => 'phui-form-iconset',
'meta' => array( 'meta' => array(
'uri' => $this->chooseURI, 'uri' => $set->getSelectURI(),
'inputID' => $input_id, 'inputID' => $input_id,
'displayID' => $display_id, 'displayID' => $display_id,
), ),

View file

@ -519,12 +519,12 @@ properly, and submit values. */
width: 180px; width: 180px;
} }
.aphront-form-choose-table td { .phui-form-iconset-table td {
vertical-align: middle; vertical-align: middle;
padding: 4px 0; padding: 4px 0;
} }
.aphront-form-choose-table .aphront-form-choose-button-cell { .phui-form-iconset-table .phui-form-iconset-button-cell {
padding: 4px 8px; padding: 4px 8px;
} }

View file

@ -10,11 +10,11 @@ JX.behavior('choose-control', function() {
JX.Stratcom.listen( JX.Stratcom.listen(
'click', 'click',
'aphront-form-choose-button', 'phui-form-iconset-button',
function(e) { function(e) {
e.kill(); e.kill();
var data = e.getNodeData('aphront-form-choose'); var data = e.getNodeData('phui-form-iconset');
var params = { var params = {
value: JX.$(data.inputID).value value: JX.$(data.inputID).value