Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15467757
D12934.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
12 KB
Referenced Files
None
Subscribers
None
D12934.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -38,6 +38,7 @@
'rsrc/css/application/base/notification-menu.css' => '3c9d8aa1',
'rsrc/css/application/base/phabricator-application-launch-view.css' => '16ca323f',
'rsrc/css/application/base/standard-page-view.css' => '61e68a55',
+ 'rsrc/css/application/calendar/calendar-icon.css' => '98ce946d',
'rsrc/css/application/chatlog/chatlog.css' => '852140ff',
'rsrc/css/application/conduit/conduit-api.css' => '7bc725c4',
'rsrc/css/application/config/config-options.css' => '7fedf08b',
@@ -492,6 +493,7 @@
'aphront-two-column-view-css' => '16ab3ad2',
'aphront-typeahead-control-css' => '0e403212',
'auth-css' => '44975d4b',
+ 'calendar-icon-css' => '98ce946d',
'changeset-view-manager' => '58562350',
'conduit-api-css' => '7bc725c4',
'config-options-css' => '7fedf08b',
diff --git a/resources/sql/autopatches/20150519.calendar.calendaricon.sql b/resources/sql/autopatches/20150519.calendar.calendaricon.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150519.calendar.calendaricon.sql
@@ -0,0 +1,5 @@
+ALTER TABLE {$NAMESPACE}_calendar.calendar_event
+ ADD COLUMN icon VARCHAR(32) COLLATE {$COLLATE_TEXT} NOT NULL;
+
+UPDATE {$NAMESPACE}_calendar.calendar_event
+ SET icon = "fa-calendar" WHERE icon = "";
diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
--- a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
@@ -13,8 +13,7 @@
return !$this->id;
}
- public function processRequest() {
- $request = $this->getRequest();
+ public function handleRequest(AphrontRequest $request) {
$user = $request->getUser();
$user_phid = $user->getPHID();
$error_name = true;
@@ -74,6 +73,7 @@
$name = $event->getName();
$description = $event->getDescription();
$is_all_day = $event->getIsAllDay();
+ $icon = $event->getIcon();
$current_policies = id(new PhabricatorPolicyQuery())
->setViewer($user)
@@ -95,6 +95,7 @@
$edit_policy = $request->getStr('editPolicy');
$view_policy = $request->getStr('viewPolicy');
$is_all_day = $request->getStr('isAllDay');
+ $icon = $request->getStr('icon');
$invitees = $request->getArr('invitees');
$new_invitees = $this->getNewInviteeList($invitees, $event);
@@ -118,6 +119,11 @@
$xactions[] = id(new PhabricatorCalendarEventTransaction())
->setTransactionType(
+ PhabricatorCalendarEventTransaction::TYPE_ICON)
+ ->setNewValue($icon);
+
+ $xactions[] = id(new PhabricatorCalendarEventTransaction())
+ ->setTransactionType(
PhabricatorCalendarEventTransaction::TYPE_START_DATE)
->setNewValue($start_value);
@@ -246,6 +252,20 @@
->setUser($user)
->setDatasource(new PhabricatorMetaMTAMailableDatasource());
+ if ($this->isCreate()) {
+ $icon_uri = $this->getApplicationURI('icon/');
+ } else {
+ $icon_uri = $this->getApplicationURI('icon/'.$event->getID().'/');
+ }
+ $icon_display = PhabricatorCalendarIcon::renderIconForChooser($icon);
+ $icon = id(new AphrontFormChooseButtonControl())
+ ->setLabel(pht('Icon'))
+ ->setName('icon')
+ ->setDisplayValue($icon_display)
+ ->setButtonText(pht('Choose Icon...'))
+ ->setChooseURI($icon_uri)
+ ->setValue($icon);
+
$form = id(new AphrontFormView())
->setUser($user)
->appendChild($name)
@@ -256,7 +276,8 @@
->appendControl($edit_policies)
->appendControl($subscribers)
->appendControl($invitees)
- ->appendChild($description);
+ ->appendChild($description)
+ ->appendChild($icon);
if ($request->isAjax()) {
diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
--- a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
@@ -264,6 +264,12 @@
$properties->invokeWillRenderEvent();
+ $icon_display = PhabricatorCalendarIcon::renderIconForChooser(
+ $event->getIcon());
+ $properties->addProperty(
+ pht('Icon'),
+ $icon_display);
+
$properties->addSectionHeader(
pht('Description'),
PHUIPropertyListView::ICON_SUMMARY);
diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
--- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
+++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
@@ -21,6 +21,7 @@
$types[] = PhabricatorCalendarEventTransaction::TYPE_CANCEL;
$types[] = PhabricatorCalendarEventTransaction::TYPE_INVITE;
$types[] = PhabricatorCalendarEventTransaction::TYPE_ALL_DAY;
+ $types[] = PhabricatorCalendarEventTransaction::TYPE_ICON;
$types[] = PhabricatorTransactions::TYPE_COMMENT;
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
@@ -45,6 +46,8 @@
return $object->getIsCancelled();
case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY:
return (int)$object->getIsAllDay();
+ case PhabricatorCalendarEventTransaction::TYPE_ICON:
+ return $object->getIcon();
case PhabricatorCalendarEventTransaction::TYPE_INVITE:
$map = $xaction->getNewValue();
$phids = array_keys($map);
@@ -73,6 +76,7 @@
case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION:
case PhabricatorCalendarEventTransaction::TYPE_CANCEL:
case PhabricatorCalendarEventTransaction::TYPE_INVITE:
+ case PhabricatorCalendarEventTransaction::TYPE_ICON:
return $xaction->getNewValue();
case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY:
return (int)$xaction->getNewValue();
@@ -107,6 +111,9 @@
case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY:
$object->setIsAllDay((int)$xaction->getNewValue());
return;
+ case PhabricatorCalendarEventTransaction::TYPE_ICON:
+ $object->setIcon($xaction->getNewValue());
+ return;
case PhabricatorCalendarEventTransaction::TYPE_INVITE:
return;
}
@@ -125,6 +132,7 @@
case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION:
case PhabricatorCalendarEventTransaction::TYPE_CANCEL:
case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY:
+ case PhabricatorCalendarEventTransaction::TYPE_ICON:
return;
case PhabricatorCalendarEventTransaction::TYPE_INVITE:
$map = $xaction->getNewValue();
@@ -171,6 +179,8 @@
$invalidate_phids = array();
foreach ($xactions as $xaction) {
switch ($xaction->getTransactionType()) {
+ case PhabricatorCalendarEventTransaction::TYPE_ICON:
+ break;
case PhabricatorCalendarEventTransaction::TYPE_START_DATE:
case PhabricatorCalendarEventTransaction::TYPE_END_DATE:
case PhabricatorCalendarEventTransaction::TYPE_CANCEL:
@@ -329,7 +339,7 @@
PhabricatorCalendarEventTransaction::MAILTAG_CONTENT =>
pht(
"An event's name, status, invite list, ".
- "and description changes."),
+ "icon, and description changes."),
PhabricatorCalendarEventTransaction::MAILTAG_RESCHEDULE =>
pht(
"An event's start and end date ".
diff --git a/src/applications/calendar/icon/PhabricatorCalendarIcon.php b/src/applications/calendar/icon/PhabricatorCalendarIcon.php
--- a/src/applications/calendar/icon/PhabricatorCalendarIcon.php
+++ b/src/applications/calendar/icon/PhabricatorCalendarIcon.php
@@ -5,22 +5,22 @@
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'),
+ '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'),
);
}
diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
--- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php
+++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
@@ -17,11 +17,14 @@
protected $description;
protected $isCancelled;
protected $isAllDay;
+ protected $icon;
protected $mailKey;
protected $viewPolicy;
protected $editPolicy;
+ const DEFAULT_ICON = 'fa-calendar';
+
private $invitees = self::ATTACHABLE;
private $appliedViewer;
@@ -35,6 +38,7 @@
->setUserPHID($actor->getPHID())
->setIsCancelled(0)
->setIsAllDay(0)
+ ->setIcon(self::DEFAULT_ICON)
->setViewPolicy($actor->getPHID())
->setEditPolicy($actor->getPHID())
->attachInvitees(array())
@@ -166,6 +170,7 @@
'description' => 'text',
'isCancelled' => 'bool',
'isAllDay' => 'bool',
+ 'icon' => 'text32',
'mailKey' => 'bytes20',
),
self::CONFIG_KEY_SCHEMA => array(
diff --git a/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php b/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
--- a/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
+++ b/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
@@ -9,6 +9,7 @@
const TYPE_DESCRIPTION = 'calendar.description';
const TYPE_CANCEL = 'calendar.cancel';
const TYPE_ALL_DAY = 'calendar.allday';
+ const TYPE_ICON = 'calendar.icon';
const TYPE_INVITE = 'calendar.invite';
const MAILTAG_RESCHEDULE = 'calendar-reschedule';
@@ -66,6 +67,8 @@
public function getIcon() {
switch ($this->getTransactionType()) {
+ case self::TYPE_ICON:
+ return $this->getNewValue();
case self::TYPE_NAME:
case self::TYPE_START_DATE:
case self::TYPE_END_DATE:
@@ -130,6 +133,12 @@
'%s converted this from an all day event.',
$this->renderHandleLink($author_phid));
}
+ case self::TYPE_ICON:
+ return pht(
+ '%s set this event\'s icon to %s.',
+ $this->renderHandleLink($author_phid),
+ PhabricatorCalendarIcon::getLabel($new));
+ break;
case self::TYPE_CANCEL:
if ($new) {
return pht(
@@ -292,6 +301,12 @@
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
}
+ case self::TYPE_ICON:
+ return pht(
+ '%s set the icon for %s to %s.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid),
+ PhabricatorCalendarIcon::getLabel($new));
case self::TYPE_CANCEL:
if ($new) {
return pht(
@@ -449,6 +464,7 @@
case self::TYPE_NAME:
case self::TYPE_DESCRIPTION:
case self::TYPE_INVITE:
+ case self::TYPE_ICON:
$tags[] = self::MAILTAG_CONTENT;
break;
case self::TYPE_START_DATE:
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 4, 5:46 PM (4 d, 17 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7336679
Default Alt Text
D12934.diff (12 KB)
Attached To
Mode
D12934: Calendar events should actually have an icon now.
Attached
Detach File
Event Timeline
Log In to Comment