@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.

Calendar events should actually have an icon now.

Summary: Ref T7936, Calendar events should actually have an icon now.

Test Plan: Edit event, edit icon, save, observe transaction feed.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7936

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

+85 -20
+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',
+5
resources/sql/autopatches/20150519.calendar.calendaricon.sql
··· 1 + ALTER TABLE {$NAMESPACE}_calendar.calendar_event 2 + ADD COLUMN icon VARCHAR(32) COLLATE {$COLLATE_TEXT} NOT NULL; 3 + 4 + UPDATE {$NAMESPACE}_calendar.calendar_event 5 + SET icon = "fa-calendar" WHERE icon = "";
+24 -3
src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
··· 13 13 return !$this->id; 14 14 } 15 15 16 - public function processRequest() { 17 - $request = $this->getRequest(); 16 + public function handleRequest(AphrontRequest $request) { 18 17 $user = $request->getUser(); 19 18 $user_phid = $user->getPHID(); 20 19 $error_name = true; ··· 74 73 $name = $event->getName(); 75 74 $description = $event->getDescription(); 76 75 $is_all_day = $event->getIsAllDay(); 76 + $icon = $event->getIcon(); 77 77 78 78 $current_policies = id(new PhabricatorPolicyQuery()) 79 79 ->setViewer($user) ··· 95 95 $edit_policy = $request->getStr('editPolicy'); 96 96 $view_policy = $request->getStr('viewPolicy'); 97 97 $is_all_day = $request->getStr('isAllDay'); 98 + $icon = $request->getStr('icon'); 98 99 99 100 $invitees = $request->getArr('invitees'); 100 101 $new_invitees = $this->getNewInviteeList($invitees, $event); ··· 115 116 ->setTransactionType( 116 117 PhabricatorCalendarEventTransaction::TYPE_ALL_DAY) 117 118 ->setNewValue($is_all_day); 119 + 120 + $xactions[] = id(new PhabricatorCalendarEventTransaction()) 121 + ->setTransactionType( 122 + PhabricatorCalendarEventTransaction::TYPE_ICON) 123 + ->setNewValue($icon); 118 124 119 125 $xactions[] = id(new PhabricatorCalendarEventTransaction()) 120 126 ->setTransactionType( ··· 246 252 ->setUser($user) 247 253 ->setDatasource(new PhabricatorMetaMTAMailableDatasource()); 248 254 255 + if ($this->isCreate()) { 256 + $icon_uri = $this->getApplicationURI('icon/'); 257 + } else { 258 + $icon_uri = $this->getApplicationURI('icon/'.$event->getID().'/'); 259 + } 260 + $icon_display = PhabricatorCalendarIcon::renderIconForChooser($icon); 261 + $icon = id(new AphrontFormChooseButtonControl()) 262 + ->setLabel(pht('Icon')) 263 + ->setName('icon') 264 + ->setDisplayValue($icon_display) 265 + ->setButtonText(pht('Choose Icon...')) 266 + ->setChooseURI($icon_uri) 267 + ->setValue($icon); 268 + 249 269 $form = id(new AphrontFormView()) 250 270 ->setUser($user) 251 271 ->appendChild($name) ··· 256 276 ->appendControl($edit_policies) 257 277 ->appendControl($subscribers) 258 278 ->appendControl($invitees) 259 - ->appendChild($description); 279 + ->appendChild($description) 280 + ->appendChild($icon); 260 281 261 282 262 283 if ($request->isAjax()) {
+6
src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
··· 264 264 265 265 $properties->invokeWillRenderEvent(); 266 266 267 + $icon_display = PhabricatorCalendarIcon::renderIconForChooser( 268 + $event->getIcon()); 269 + $properties->addProperty( 270 + pht('Icon'), 271 + $icon_display); 272 + 267 273 $properties->addSectionHeader( 268 274 pht('Description'), 269 275 PHUIPropertyListView::ICON_SUMMARY);
+11 -1
src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
··· 21 21 $types[] = PhabricatorCalendarEventTransaction::TYPE_CANCEL; 22 22 $types[] = PhabricatorCalendarEventTransaction::TYPE_INVITE; 23 23 $types[] = PhabricatorCalendarEventTransaction::TYPE_ALL_DAY; 24 + $types[] = PhabricatorCalendarEventTransaction::TYPE_ICON; 24 25 25 26 $types[] = PhabricatorTransactions::TYPE_COMMENT; 26 27 $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY; ··· 45 46 return $object->getIsCancelled(); 46 47 case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY: 47 48 return (int)$object->getIsAllDay(); 49 + case PhabricatorCalendarEventTransaction::TYPE_ICON: 50 + return $object->getIcon(); 48 51 case PhabricatorCalendarEventTransaction::TYPE_INVITE: 49 52 $map = $xaction->getNewValue(); 50 53 $phids = array_keys($map); ··· 73 76 case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION: 74 77 case PhabricatorCalendarEventTransaction::TYPE_CANCEL: 75 78 case PhabricatorCalendarEventTransaction::TYPE_INVITE: 79 + case PhabricatorCalendarEventTransaction::TYPE_ICON: 76 80 return $xaction->getNewValue(); 77 81 case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY: 78 82 return (int)$xaction->getNewValue(); ··· 107 111 case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY: 108 112 $object->setIsAllDay((int)$xaction->getNewValue()); 109 113 return; 114 + case PhabricatorCalendarEventTransaction::TYPE_ICON: 115 + $object->setIcon($xaction->getNewValue()); 116 + return; 110 117 case PhabricatorCalendarEventTransaction::TYPE_INVITE: 111 118 return; 112 119 } ··· 125 132 case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION: 126 133 case PhabricatorCalendarEventTransaction::TYPE_CANCEL: 127 134 case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY: 135 + case PhabricatorCalendarEventTransaction::TYPE_ICON: 128 136 return; 129 137 case PhabricatorCalendarEventTransaction::TYPE_INVITE: 130 138 $map = $xaction->getNewValue(); ··· 171 179 $invalidate_phids = array(); 172 180 foreach ($xactions as $xaction) { 173 181 switch ($xaction->getTransactionType()) { 182 + case PhabricatorCalendarEventTransaction::TYPE_ICON: 183 + break; 174 184 case PhabricatorCalendarEventTransaction::TYPE_START_DATE: 175 185 case PhabricatorCalendarEventTransaction::TYPE_END_DATE: 176 186 case PhabricatorCalendarEventTransaction::TYPE_CANCEL: ··· 329 339 PhabricatorCalendarEventTransaction::MAILTAG_CONTENT => 330 340 pht( 331 341 "An event's name, status, invite list, ". 332 - "and description changes."), 342 + "icon, and description changes."), 333 343 PhabricatorCalendarEventTransaction::MAILTAG_RESCHEDULE => 334 344 pht( 335 345 "An event's start and end date ".
+16 -16
src/applications/calendar/icon/PhabricatorCalendarIcon.php
··· 5 5 public static function getIconMap() { 6 6 return 7 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'), 8 + 'fa-calendar' => pht('Default'), 9 + 'fa-glass' => pht('Party'), 10 + 'fa-plane' => pht('Travel'), 11 + 'fa-plus-square' => pht('Health / Appointment'), 12 + 'fa-rocket' => pht('Sabatical / Leave'), 13 + 'fa-home' => pht('Working From Home'), 14 + 'fa-tree' => pht('Holiday'), 15 + 'fa-gamepad' => pht('Staycation'), 16 + 'fa-coffee' => pht('Coffee Meeting'), 17 + 'fa-film' => pht('Movie'), 18 + 'fa-users' => pht('Meeting'), 19 + 'fa-cutlery' => pht('Meal'), 20 + 'fa-paw' => pht('Pet Activity'), 21 + 'fa-institution' => pht('Official Business'), 22 + 'fa-bus' => pht('Field Trip'), 23 + 'fa-microphone' => pht('Conference'), 24 24 ); 25 25 } 26 26
+5
src/applications/calendar/storage/PhabricatorCalendarEvent.php
··· 17 17 protected $description; 18 18 protected $isCancelled; 19 19 protected $isAllDay; 20 + protected $icon; 20 21 protected $mailKey; 21 22 22 23 protected $viewPolicy; 23 24 protected $editPolicy; 25 + 26 + const DEFAULT_ICON = 'fa-calendar'; 24 27 25 28 private $invitees = self::ATTACHABLE; 26 29 private $appliedViewer; ··· 35 38 ->setUserPHID($actor->getPHID()) 36 39 ->setIsCancelled(0) 37 40 ->setIsAllDay(0) 41 + ->setIcon(self::DEFAULT_ICON) 38 42 ->setViewPolicy($actor->getPHID()) 39 43 ->setEditPolicy($actor->getPHID()) 40 44 ->attachInvitees(array()) ··· 166 170 'description' => 'text', 167 171 'isCancelled' => 'bool', 168 172 'isAllDay' => 'bool', 173 + 'icon' => 'text32', 169 174 'mailKey' => 'bytes20', 170 175 ), 171 176 self::CONFIG_KEY_SCHEMA => array(
+16
src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
··· 9 9 const TYPE_DESCRIPTION = 'calendar.description'; 10 10 const TYPE_CANCEL = 'calendar.cancel'; 11 11 const TYPE_ALL_DAY = 'calendar.allday'; 12 + const TYPE_ICON = 'calendar.icon'; 12 13 const TYPE_INVITE = 'calendar.invite'; 13 14 14 15 const MAILTAG_RESCHEDULE = 'calendar-reschedule'; ··· 66 67 67 68 public function getIcon() { 68 69 switch ($this->getTransactionType()) { 70 + case self::TYPE_ICON: 71 + return $this->getNewValue(); 69 72 case self::TYPE_NAME: 70 73 case self::TYPE_START_DATE: 71 74 case self::TYPE_END_DATE: ··· 130 133 '%s converted this from an all day event.', 131 134 $this->renderHandleLink($author_phid)); 132 135 } 136 + case self::TYPE_ICON: 137 + return pht( 138 + '%s set this event\'s icon to %s.', 139 + $this->renderHandleLink($author_phid), 140 + PhabricatorCalendarIcon::getLabel($new)); 141 + break; 133 142 case self::TYPE_CANCEL: 134 143 if ($new) { 135 144 return pht( ··· 292 301 $this->renderHandleLink($author_phid), 293 302 $this->renderHandleLink($object_phid)); 294 303 } 304 + case self::TYPE_ICON: 305 + return pht( 306 + '%s set the icon for %s to %s.', 307 + $this->renderHandleLink($author_phid), 308 + $this->renderHandleLink($object_phid), 309 + PhabricatorCalendarIcon::getLabel($new)); 295 310 case self::TYPE_CANCEL: 296 311 if ($new) { 297 312 return pht( ··· 449 464 case self::TYPE_NAME: 450 465 case self::TYPE_DESCRIPTION: 451 466 case self::TYPE_INVITE: 467 + case self::TYPE_ICON: 452 468 $tags[] = self::MAILTAG_CONTENT; 453 469 break; 454 470 case self::TYPE_START_DATE: