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

Make EditEngine form for Calendar Events almost fully-functional

Summary:
Ref T9275. This still has a number of rough edges and other minor problems (no JS on the controls, some date handling control bugs) but I'll smooth those over in future changes.

It does make all the editable transaction types available from EditEngine, technically speaking.

Test Plan: Created and edited events with the "pro" controller, which mostly worked.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9275

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

+102 -3
+78 -3
src/applications/calendar/editor/PhabricatorCalendarEditEngine.php
··· 68 68 $invitee_phids = $object->getInviteePHIDsForEdit(); 69 69 } 70 70 71 + $frequency_options = array( 72 + PhabricatorCalendarEvent::FREQUENCY_DAILY => pht('Daily'), 73 + PhabricatorCalendarEvent::FREQUENCY_WEEKLY => pht('Weekly'), 74 + PhabricatorCalendarEvent::FREQUENCY_MONTHLY => pht('Monthly'), 75 + PhabricatorCalendarEvent::FREQUENCY_YEARLY => pht('Yearly'), 76 + ); 77 + 71 78 $fields = array( 72 79 id(new PhabricatorTextEditField()) 73 80 ->setKey('name') ··· 109 116 ->setConduitTypeDescription(pht('New event invitees.')) 110 117 ->setValue($invitee_phids) 111 118 ->setCommentActionLabel(pht('Change Invitees')), 112 - id(new PhabricatorIconSetEditField()) 119 + ); 120 + 121 + if ($this->getIsCreate()) { 122 + $fields[] = id(new PhabricatorBoolEditField()) 123 + ->setKey('isRecurring') 124 + ->setLabel(pht('Recurring')) 125 + ->setOptions(pht('One-Time Event'), pht('Recurring Event')) 126 + ->setTransactionType( 127 + PhabricatorCalendarEventTransaction::TYPE_RECURRING) 128 + ->setDescription(pht('One time or recurring event.')) 129 + ->setConduitDescription(pht('Make the event recurring.')) 130 + ->setConduitTypeDescription(pht('Mark the event as a recurring event.')) 131 + ->setValue($object->getIsRecurring()); 132 + 133 + $fields[] = id(new PhabricatorSelectEditField()) 134 + ->setKey('frequency') 135 + ->setLabel(pht('Frequency')) 136 + ->setOptions($frequency_options) 137 + ->setTransactionType( 138 + PhabricatorCalendarEventTransaction::TYPE_FREQUENCY) 139 + ->setDescription(pht('Recurring event frequency.')) 140 + ->setConduitDescription(pht('Change the event frequency.')) 141 + ->setConduitTypeDescription(pht('New event frequency.')) 142 + ->setValue($object->getFrequencyUnit()); 143 + } 144 + 145 + if ($this->getIsCreate() || $object->getIsRecurring()) { 146 + $fields[] = id(new PhabricatorEpochEditField()) 147 + ->setAllowNull(true) 148 + ->setKey('until') 149 + ->setLabel(pht('Repeat Until')) 150 + ->setTransactionType( 151 + PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE) 152 + ->setDescription(pht('Last instance of the event.')) 153 + ->setConduitDescription(pht('Change when the event repeats until.')) 154 + ->setConduitTypeDescription(pht('New final event time.')) 155 + ->setValue($object->getRecurrenceEndDate()); 156 + } 157 + 158 + $fields[] = id(new PhabricatorBoolEditField()) 159 + ->setKey('isAllDay') 160 + ->setLabel(pht('All Day')) 161 + ->setOptions(pht('Normal Event'), pht('All Day Event')) 162 + ->setTransactionType(PhabricatorCalendarEventTransaction::TYPE_ALL_DAY) 163 + ->setDescription(pht('Marks this as an all day event.')) 164 + ->setConduitDescription(pht('Make the event an all day event.')) 165 + ->setConduitTypeDescription(pht('Mark the event as an all day event.')) 166 + ->setValue($object->getIsAllDay()); 167 + 168 + $fields[] = id(new PhabricatorEpochEditField()) 169 + ->setKey('start') 170 + ->setLabel(pht('Start')) 171 + ->setTransactionType( 172 + PhabricatorCalendarEventTransaction::TYPE_START_DATE) 173 + ->setDescription(pht('Start time of the event.')) 174 + ->setConduitDescription(pht('Change the start time of the event.')) 175 + ->setConduitTypeDescription(pht('New event start time.')) 176 + ->setValue($object->getViewerDateFrom()); 177 + 178 + $fields[] = id(new PhabricatorEpochEditField()) 179 + ->setKey('end') 180 + ->setLabel(pht('End')) 181 + ->setTransactionType( 182 + PhabricatorCalendarEventTransaction::TYPE_END_DATE) 183 + ->setDescription(pht('End time of the event.')) 184 + ->setConduitDescription(pht('Change the end time of the event.')) 185 + ->setConduitTypeDescription(pht('New event end time.')) 186 + ->setValue($object->getViewerDateTo()); 187 + 188 + $fields[] = id(new PhabricatorIconSetEditField()) 113 189 ->setKey('icon') 114 190 ->setLabel(pht('Icon')) 115 191 ->setIconSet(new PhabricatorCalendarIconSet()) ··· 117 193 ->setDescription(pht('Event icon.')) 118 194 ->setConduitDescription(pht('Change the event icon.')) 119 195 ->setConduitTypeDescription(pht('New event icon.')) 120 - ->setValue($object->getIcon()), 121 - ); 196 + ->setValue($object->getIcon()); 122 197 123 198 return $fields; 124 199 }
+12
src/applications/calendar/storage/PhabricatorCalendarEvent.php
··· 70 70 $is_recurring = true; 71 71 } 72 72 73 + $start = new DateTime('@'.PhabricatorTime::getNow()); 74 + $start->setTimeZone($actor->getTimeZone()); 75 + 76 + $start->setTime($start->format('H'), 0, 0); 77 + $start->modify('+1 hour'); 78 + $end = id(clone $start)->modify('+1 hour'); 79 + 80 + $epoch_min = $start->format('U'); 81 + $epoch_max = $end->format('U'); 82 + 73 83 return id(new PhabricatorCalendarEvent()) 74 84 ->setUserPHID($actor->getPHID()) 75 85 ->setIsCancelled(0) ··· 81 91 ->setEditPolicy($actor->getPHID()) 82 92 ->setSpacePHID($actor->getDefaultSpacePHID()) 83 93 ->attachInvitees(array()) 94 + ->setDateFrom($epoch_min) 95 + ->setDateTo($epoch_max) 84 96 ->applyViewerTimezone($actor); 85 97 } 86 98
+12
src/applications/transactions/editfield/PhabricatorEpochEditField.php
··· 3 3 final class PhabricatorEpochEditField 4 4 extends PhabricatorEditField { 5 5 6 + private $allowNull; 7 + 8 + public function setAllowNull($allow_null) { 9 + $this->allowNull = $allow_null; 10 + return $this; 11 + } 12 + 13 + public function getAllowNull() { 14 + return $this->allowNull; 15 + } 16 + 6 17 protected function newControl() { 7 18 return id(new AphrontFormDateControl()) 19 + ->setAllowNull($this->getAllowNull()) 8 20 ->setViewer($this->getViewer()); 9 21 } 10 22