@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Skeleton of calendar icon infrastructure

Summary: Ref T7936, Skeleton of calendar icon infrastructure

Test Plan: Navigate to install/calendar/icon/, observe temporary calendar icons

Reviewers: epriestley, #blessed_reviewers, chad

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7936

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

+189
+2
resources/celerity/map.php
··· 38 38 'rsrc/css/application/base/notification-menu.css' => '3c9d8aa1', 39 39 'rsrc/css/application/base/phabricator-application-launch-view.css' => '16ca323f', 40 40 'rsrc/css/application/base/standard-page-view.css' => '61e68a55', 41 + 'rsrc/css/application/calendar/calendar-icon.css' => '98ce946d', 41 42 'rsrc/css/application/chatlog/chatlog.css' => '852140ff', 42 43 'rsrc/css/application/conduit/conduit-api.css' => '7bc725c4', 43 44 'rsrc/css/application/config/config-options.css' => '7fedf08b', ··· 492 493 'aphront-two-column-view-css' => '16ab3ad2', 493 494 'aphront-typeahead-control-css' => '0e403212', 494 495 'auth-css' => '44975d4b', 496 + 'calendar-icon-css' => '98ce946d', 495 497 'changeset-view-manager' => '58562350', 496 498 'conduit-api-css' => '7bc725c4', 497 499 'config-options-css' => '7fedf08b',
+4
src/__phutil_library_map__.php
··· 1499 1499 'PhabricatorCalendarEventCancelController' => 'applications/calendar/controller/PhabricatorCalendarEventCancelController.php', 1500 1500 'PhabricatorCalendarEventCommentController' => 'applications/calendar/controller/PhabricatorCalendarEventCommentController.php', 1501 1501 'PhabricatorCalendarEventEditController' => 'applications/calendar/controller/PhabricatorCalendarEventEditController.php', 1502 + 'PhabricatorCalendarEventEditIconController' => 'applications/calendar/controller/PhabricatorCalendarEventEditIconController.php', 1502 1503 'PhabricatorCalendarEventEditor' => 'applications/calendar/editor/PhabricatorCalendarEventEditor.php', 1503 1504 'PhabricatorCalendarEventEmailCommand' => 'applications/calendar/command/PhabricatorCalendarEventEmailCommand.php', 1504 1505 'PhabricatorCalendarEventInvitee' => 'applications/calendar/storage/PhabricatorCalendarEventInvitee.php', ··· 1517 1518 'PhabricatorCalendarEventViewController' => 'applications/calendar/controller/PhabricatorCalendarEventViewController.php', 1518 1519 'PhabricatorCalendarHoliday' => 'applications/calendar/storage/PhabricatorCalendarHoliday.php', 1519 1520 'PhabricatorCalendarHolidayTestCase' => 'applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php', 1521 + 'PhabricatorCalendarIcon' => 'applications/calendar/icon/PhabricatorCalendarIcon.php', 1520 1522 'PhabricatorCalendarRemarkupRule' => 'applications/calendar/remarkup/PhabricatorCalendarRemarkupRule.php', 1521 1523 'PhabricatorCalendarReplyHandler' => 'applications/calendar/mail/PhabricatorCalendarReplyHandler.php', 1522 1524 'PhabricatorCalendarSchemaSpec' => 'applications/calendar/storage/PhabricatorCalendarSchemaSpec.php', ··· 4860 4862 'PhabricatorCalendarEventCancelController' => 'PhabricatorCalendarController', 4861 4863 'PhabricatorCalendarEventCommentController' => 'PhabricatorCalendarController', 4862 4864 'PhabricatorCalendarEventEditController' => 'PhabricatorCalendarController', 4865 + 'PhabricatorCalendarEventEditIconController' => 'PhabricatorCalendarController', 4863 4866 'PhabricatorCalendarEventEditor' => 'PhabricatorApplicationTransactionEditor', 4864 4867 'PhabricatorCalendarEventEmailCommand' => 'MetaMTAEmailTransactionCommand', 4865 4868 'PhabricatorCalendarEventInvitee' => array( ··· 4881 4884 'PhabricatorCalendarEventViewController' => 'PhabricatorCalendarController', 4882 4885 'PhabricatorCalendarHoliday' => 'PhabricatorCalendarDAO', 4883 4886 'PhabricatorCalendarHolidayTestCase' => 'PhabricatorTestCase', 4887 + 'PhabricatorCalendarIcon' => 'Phobject', 4884 4888 'PhabricatorCalendarRemarkupRule' => 'PhabricatorObjectRemarkupRule', 4885 4889 'PhabricatorCalendarReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler', 4886 4890 'PhabricatorCalendarSchemaSpec' => 'PhabricatorConfigSchemaSpec',
+4
src/applications/calendar/application/PhabricatorCalendarApplication.php
··· 45 45 '(?:query/(?P<queryKey>[^/]+)/(?:(?P<year>\d+)/'. 46 46 '(?P<month>\d+)/)?(?:(?P<day>\d+)/)?)?' 47 47 => 'PhabricatorCalendarEventListController', 48 + 'icon/(?P<id>[1-9]\d*)/' 49 + => 'PhabricatorCalendarEventEditIconController', 50 + 'icon/' 51 + => 'PhabricatorCalendarEventEditIconController', 48 52 'event/' => array( 49 53 'create/' 50 54 => 'PhabricatorCalendarEventEditController',
+102
src/applications/calendar/controller/PhabricatorCalendarEventEditIconController.php
··· 1 + <?php 2 + 3 + final class PhabricatorCalendarEventEditIconController 4 + extends PhabricatorCalendarController { 5 + 6 + private $id; 7 + 8 + public function willProcessRequest(array $data) { 9 + $this->id = idx($data, 'id'); 10 + } 11 + 12 + public function handleRequest(AphrontRequest $request) { 13 + $viewer = $request->getUser(); 14 + 15 + if ($this->id) { 16 + $event = id(new PhabricatorCalendarEventQuery()) 17 + ->setViewer($viewer) 18 + ->withIDs(array($this->id)) 19 + ->requireCapabilities( 20 + array( 21 + PhabricatorPolicyCapability::CAN_VIEW, 22 + PhabricatorPolicyCapability::CAN_EDIT, 23 + )) 24 + ->executeOne(); 25 + if (!$event) { 26 + return new Aphront404Response(); 27 + } 28 + $cancel_uri = $this->getApplicationURI('/E'.$event->getID()); 29 + $event_icon = $event->getIcon(); 30 + } else { 31 + $cancel_uri = '/calendar/'; 32 + $event_icon = $request->getStr('value'); 33 + } 34 + 35 + require_celerity_resource('calendar-icon-css'); 36 + Javelin::initBehavior('phabricator-tooltips'); 37 + 38 + $calendar_icons = PhabricatorCalendarIcon::getIconMap(); 39 + 40 + if ($request->isFormPost()) { 41 + $v_icon = $request->getStr('icon'); 42 + 43 + return id(new AphrontAjaxResponse())->setContent( 44 + array( 45 + 'value' => $v_icon, 46 + 'display' => PhabricatorCalendarIcon::renderIconForChooser($v_icon), 47 + )); 48 + } 49 + 50 + $ii = 0; 51 + $buttons = array(); 52 + foreach ($calendar_icons as $icon => $label) { 53 + $view = id(new PHUIIconView()) 54 + ->setIconFont($icon); 55 + 56 + $aural = javelin_tag( 57 + 'span', 58 + array( 59 + 'aural' => true, 60 + ), 61 + pht('Choose "%s" Icon', $label)); 62 + 63 + if ($icon == $event_icon) { 64 + $class_extra = ' selected'; 65 + } else { 66 + $class_extra = null; 67 + } 68 + 69 + $buttons[] = javelin_tag( 70 + 'button', 71 + array( 72 + 'class' => 'icon-button'.$class_extra, 73 + 'name' => 'icon', 74 + 'value' => $icon, 75 + 'type' => 'submit', 76 + 'sigil' => 'has-tooltip', 77 + 'meta' => array( 78 + 'tip' => $label, 79 + ), 80 + ), 81 + array( 82 + $aural, 83 + $view, 84 + )); 85 + if ((++$ii % 4) == 0) { 86 + $buttons[] = phutil_tag('br'); 87 + } 88 + } 89 + 90 + $buttons = phutil_tag( 91 + 'div', 92 + array( 93 + 'class' => 'icon-grid', 94 + ), 95 + $buttons); 96 + 97 + return $this->newDialog() 98 + ->setTitle(pht('Choose Calendar Event Icon')) 99 + ->appendChild($buttons) 100 + ->addCancelButton($cancel_uri); 101 + } 102 + }
+49
src/applications/calendar/icon/PhabricatorCalendarIcon.php
··· 1 + <?php 2 + 3 + final class PhabricatorCalendarIcon extends Phobject { 4 + 5 + public static function getIconMap() { 6 + return 7 + array( 8 + 'fa-briefcase' => pht('Briefcase'), 9 + 'fa-tags' => pht('Tag'), 10 + 'fa-folder' => pht('Folder'), 11 + 'fa-users' => pht('Team'), 12 + 'fa-bug' => pht('Bug'), 13 + 'fa-trash-o' => pht('Garbage'), 14 + 'fa-calendar' => pht('Deadline'), 15 + 'fa-flag-checkered' => pht('Goal'), 16 + 'fa-envelope' => pht('Communication'), 17 + 'fa-truck' => pht('Release'), 18 + 'fa-lock' => pht('Policy'), 19 + 'fa-umbrella' => pht('An Umbrella'), 20 + 'fa-cloud' => pht('The Cloud'), 21 + 'fa-building' => pht('Company'), 22 + 'fa-credit-card' => pht('Accounting'), 23 + 'fa-flask' => pht('Experimental'), 24 + ); 25 + } 26 + 27 + public static function getLabel($key) { 28 + $map = self::getIconMap(); 29 + return $map[$key]; 30 + } 31 + 32 + public static function getAPIName($key) { 33 + return substr($key, 3); 34 + } 35 + 36 + public static function renderIconForChooser($icon) { 37 + $calendar_icons = self::getIconMap(); 38 + 39 + return phutil_tag( 40 + 'span', 41 + array(), 42 + array( 43 + id(new PHUIIconView())->setIconFont($icon), 44 + ' ', 45 + idx($calendar_icons, $icon, pht('Unknown Icon')), 46 + )); 47 + } 48 + 49 + }
+28
webroot/rsrc/css/application/calendar/calendar-icon.css
··· 1 + /** 2 + * @provides calendar-icon-css 3 + */ 4 + 5 + button.icon-button { 6 + background: #f7f7f7; 7 + border: 1px solid {$lightblueborder}; 8 + position: relative; 9 + width: 16px; 10 + height: 16px; 11 + padding: 12px; 12 + margin: 4px; 13 + text-shadow: none; 14 + box-shadow: none; 15 + box-sizing: content-box; 16 + } 17 + 18 + .icon-grid { 19 + text-align: center; 20 + } 21 + 22 + .icon-icon + .icon-icon { 23 + margin-left: 4px; 24 + } 25 + 26 + button.icon-button.selected { 27 + background: {$bluebackground}; 28 + }