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

Switch Calendar to EditEngine

Summary:
Ref T9275. This throws away the old EditController and switches fully to EditEngine.

There's still some sketchy behavior (particularly, no JS stuff yet) but I think all the basics work properly.

Test Plan: Created and edited events via EditEngine, everything seemed to work alright.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9275

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

+18 -632
-2
src/__phutil_library_map__.php
··· 2024 2024 'PhabricatorCalendarEventCancelController' => 'applications/calendar/controller/PhabricatorCalendarEventCancelController.php', 2025 2025 'PhabricatorCalendarEventDragController' => 'applications/calendar/controller/PhabricatorCalendarEventDragController.php', 2026 2026 'PhabricatorCalendarEventEditController' => 'applications/calendar/controller/PhabricatorCalendarEventEditController.php', 2027 - 'PhabricatorCalendarEventEditProController' => 'applications/calendar/controller/PhabricatorCalendarEventEditProController.php', 2028 2027 'PhabricatorCalendarEventEditor' => 'applications/calendar/editor/PhabricatorCalendarEventEditor.php', 2029 2028 'PhabricatorCalendarEventEmailCommand' => 'applications/calendar/command/PhabricatorCalendarEventEmailCommand.php', 2030 2029 'PhabricatorCalendarEventFulltextEngine' => 'applications/calendar/search/PhabricatorCalendarEventFulltextEngine.php', ··· 6633 6632 'PhabricatorCalendarEventCancelController' => 'PhabricatorCalendarController', 6634 6633 'PhabricatorCalendarEventDragController' => 'PhabricatorCalendarController', 6635 6634 'PhabricatorCalendarEventEditController' => 'PhabricatorCalendarController', 6636 - 'PhabricatorCalendarEventEditProController' => 'PhabricatorCalendarController', 6637 6635 'PhabricatorCalendarEventEditor' => 'PhabricatorApplicationTransactionEditor', 6638 6636 'PhabricatorCalendarEventEmailCommand' => 'MetaMTAEmailTransactionCommand', 6639 6637 'PhabricatorCalendarEventFulltextEngine' => 'PhabricatorFulltextEngine',
+1 -7
src/applications/calendar/application/PhabricatorCalendarApplication.php
··· 47 47 '(?P<month>\d+)/)?(?:(?P<day>\d+)/)?)?' 48 48 => 'PhabricatorCalendarEventListController', 49 49 'event/' => array( 50 - $this->getEditRoutePattern('editpro/') 51 - => 'PhabricatorCalendarEventEditProController', 52 - 'create/' 53 - => 'PhabricatorCalendarEventEditController', 54 - 'edit/(?P<id>[1-9]\d*)/' 50 + $this->getEditRoutePattern('edit/') 55 51 => 'PhabricatorCalendarEventEditController', 56 52 'drag/(?P<id>[1-9]\d*)/' 57 53 => 'PhabricatorCalendarEventDragController', ··· 59 55 => 'PhabricatorCalendarEventCancelController', 60 56 '(?P<action>join|decline|accept)/(?P<id>[1-9]\d*)/' 61 57 => 'PhabricatorCalendarEventJoinController', 62 - 'comment/(?P<id>[1-9]\d*)/' 63 - => 'PhabricatorCalendarEventCommentController', 64 58 ), 65 59 ), 66 60 );
-28
src/applications/calendar/controller/PhabricatorCalendarController.php
··· 2 2 3 3 abstract class PhabricatorCalendarController extends PhabricatorController { 4 4 5 - protected function buildApplicationCrumbs() { 6 - $crumbs = parent::buildApplicationCrumbs(); 7 - 8 - $actions = id(new PhabricatorActionListView()) 9 - ->setUser($this->getViewer()) 10 - ->addAction( 11 - id(new PhabricatorActionView()) 12 - ->setName(pht('Create Event')) 13 - ->setHref('/calendar/event/create/')) 14 - ->addAction( 15 - id(new PhabricatorActionView()) 16 - ->setName(pht('Create Public Event')) 17 - ->setHref('/calendar/event/create/?mode=public')) 18 - ->addAction( 19 - id(new PhabricatorActionView()) 20 - ->setName(pht('Create Recurring Event')) 21 - ->setHref('/calendar/event/create/?mode=recurring')); 22 - 23 - $crumbs->addAction( 24 - id(new PHUIListItemView()) 25 - ->setName(pht('Create Event')) 26 - ->setHref($this->getApplicationURI().'event/create/') 27 - ->setIcon('fa-plus-square') 28 - ->setDropdownMenu($actions)); 29 - 30 - return $crumbs; 31 - } 32 - 33 5 }
+3 -569
src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
··· 3 3 final class PhabricatorCalendarEventEditController 4 4 extends PhabricatorCalendarController { 5 5 6 - private $id; 7 - 8 - public function isCreate() { 9 - return !$this->id; 10 - } 11 - 12 6 public function handleRequest(AphrontRequest $request) { 13 - $viewer = $request->getViewer(); 14 - $user_phid = $viewer->getPHID(); 15 - $this->id = $request->getURIData('id'); 16 - 17 - $error_name = true; 18 - $error_recurrence_end_date = null; 19 - $error_start_date = true; 20 - $error_end_date = true; 21 - $validation_exception = null; 22 - 23 - $is_recurring_id = celerity_generate_unique_node_id(); 24 - $recurrence_end_date_id = celerity_generate_unique_node_id(); 25 - $frequency_id = celerity_generate_unique_node_id(); 26 - $all_day_id = celerity_generate_unique_node_id(); 27 - $start_date_id = celerity_generate_unique_node_id(); 28 - $end_date_id = celerity_generate_unique_node_id(); 29 - 30 - $next_workflow = $request->getStr('next'); 31 - $uri_query = $request->getStr('query'); 32 - 33 - if ($this->isCreate()) { 34 - $mode = $request->getStr('mode'); 35 - $event = PhabricatorCalendarEvent::initializeNewCalendarEvent( 36 - $viewer, 37 - $mode); 38 - 39 - $create_start_year = $request->getInt('year'); 40 - $create_start_month = $request->getInt('month'); 41 - $create_start_day = $request->getInt('day'); 42 - $create_start_time = $request->getStr('time'); 43 - 44 - if ($create_start_year) { 45 - $start = AphrontFormDateControlValue::newFromParts( 46 - $viewer, 47 - $create_start_year, 48 - $create_start_month, 49 - $create_start_day, 50 - $create_start_time); 51 - if (!$start->isValid()) { 52 - return new Aphront400Response(); 53 - } 54 - $start_value = AphrontFormDateControlValue::newFromEpoch( 55 - $viewer, 56 - $start->getEpoch()); 57 - 58 - $end = clone $start_value->getDateTime(); 59 - $end->modify('+1 hour'); 60 - $end_value = AphrontFormDateControlValue::newFromEpoch( 61 - $viewer, 62 - $end->format('U')); 63 - 64 - } else { 65 - list($start_value, $end_value) = $this->getDefaultTimeValues($viewer); 66 - } 67 - 68 - $recurrence_end_date_value = clone $end_value; 69 - $recurrence_end_date_value->setOptional(true); 70 - 71 - $submit_label = pht('Create'); 72 - $title = pht('Create Event'); 73 - $header_icon = 'fa-plus-square'; 74 - $redirect = 'created'; 75 - $subscribers = array(); 76 - $invitees = array($user_phid); 77 - $cancel_uri = $this->getApplicationURI(); 78 - } else { 79 - $event = id(new PhabricatorCalendarEventQuery()) 80 - ->setViewer($viewer) 81 - ->withIDs(array($this->id)) 82 - ->requireCapabilities( 83 - array( 84 - PhabricatorPolicyCapability::CAN_VIEW, 85 - PhabricatorPolicyCapability::CAN_EDIT, 86 - )) 87 - ->executeOne(); 88 - if (!$event) { 89 - return new Aphront404Response(); 90 - } 91 - 92 - $end_value = AphrontFormDateControlValue::newFromEpoch( 93 - $viewer, 94 - $event->getViewerDateTo()); 95 - $start_value = AphrontFormDateControlValue::newFromEpoch( 96 - $viewer, 97 - $event->getViewerDateFrom()); 98 - $recurrence_end_date_value = id(clone $end_value) 99 - ->setOptional(true); 100 - 101 - $submit_label = pht('Update'); 102 - $title = pht('Edit Event: %s', $event->getName()); 103 - $header_icon = 'fa-pencil'; 104 - 105 - $subscribers = PhabricatorSubscribersQuery::loadSubscribersForPHID( 106 - $event->getPHID()); 107 - 108 - $invitees = $event->getInviteePHIDsForEdit(); 109 - $cancel_uri = $event->getURI(); 110 - } 111 - 112 - if ($this->isCreate()) { 113 - $projects = array(); 114 - } else { 115 - $projects = PhabricatorEdgeQuery::loadDestinationPHIDs( 116 - $event->getPHID(), 117 - PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); 118 - $projects = array_reverse($projects); 119 - } 120 - 121 - $name = $event->getName(); 122 - $description = $event->getDescription(); 123 - $is_all_day = $event->getIsAllDay(); 124 - $is_recurring = $event->getIsRecurring(); 125 - $is_parent = $event->isParentEvent(); 126 - $frequency = idx($event->getRecurrenceFrequency(), 'rule'); 127 - $icon = $event->getIcon(); 128 - $edit_policy = $event->getEditPolicy(); 129 - $view_policy = $event->getViewPolicy(); 130 - $space = $event->getSpacePHID(); 131 - 132 - 133 - if ($request->isFormPost()) { 134 - $is_all_day = $request->getStr('isAllDay'); 135 - 136 - if ($is_all_day) { 137 - // TODO: This is a very gross temporary hack to get this working 138 - // reasonably: if this is an all day event, force the viewer's 139 - // timezone to UTC so the date controls get interpreted as UTC. 140 - $viewer->overrideTimezoneIdentifier('UTC'); 141 - } 142 - 143 - $xactions = array(); 144 - $name = $request->getStr('name'); 145 - 146 - $start_value = AphrontFormDateControlValue::newFromRequest( 147 - $request, 148 - 'start'); 149 - $end_value = AphrontFormDateControlValue::newFromRequest( 150 - $request, 151 - 'end'); 152 - $recurrence_end_date_value = AphrontFormDateControlValue::newFromRequest( 153 - $request, 154 - 'recurrenceEndDate'); 155 - $recurrence_end_date_value->setOptional(true); 156 - $projects = $request->getArr('projects'); 157 - $description = $request->getStr('description'); 158 - $subscribers = $request->getArr('subscribers'); 159 - $edit_policy = $request->getStr('editPolicy'); 160 - $view_policy = $request->getStr('viewPolicy'); 161 - $space = $request->getStr('spacePHID'); 162 - $is_recurring = $request->getStr('isRecurring') ? 1 : 0; 163 - $frequency = $request->getStr('frequency'); 164 - $icon = $request->getStr('icon'); 165 - 166 - $invitees = $request->getArr('invitees'); 167 - 168 - $xactions[] = id(new PhabricatorCalendarEventTransaction()) 169 - ->setTransactionType( 170 - PhabricatorCalendarEventTransaction::TYPE_NAME) 171 - ->setNewValue($name); 172 - 173 - if ($is_recurring && $this->isCreate()) { 174 - $xactions[] = id(new PhabricatorCalendarEventTransaction()) 175 - ->setTransactionType( 176 - PhabricatorCalendarEventTransaction::TYPE_RECURRING) 177 - ->setNewValue($is_recurring); 178 - 179 - $xactions[] = id(new PhabricatorCalendarEventTransaction()) 180 - ->setTransactionType( 181 - PhabricatorCalendarEventTransaction::TYPE_FREQUENCY) 182 - ->setNewValue(array('rule' => $frequency)); 183 - 184 - if (!$recurrence_end_date_value->isDisabled()) { 185 - $xactions[] = id(new PhabricatorCalendarEventTransaction()) 186 - ->setTransactionType( 187 - PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE) 188 - ->setNewValue($recurrence_end_date_value); 189 - } 190 - } 191 - 192 - if (($is_recurring && $this->isCreate()) || !$is_parent) { 193 - $xactions[] = id(new PhabricatorCalendarEventTransaction()) 194 - ->setTransactionType( 195 - PhabricatorCalendarEventTransaction::TYPE_ALL_DAY) 196 - ->setNewValue($is_all_day); 197 - 198 - $xactions[] = id(new PhabricatorCalendarEventTransaction()) 199 - ->setTransactionType( 200 - PhabricatorCalendarEventTransaction::TYPE_ICON) 201 - ->setNewValue($icon); 202 - 203 - $xactions[] = id(new PhabricatorCalendarEventTransaction()) 204 - ->setTransactionType( 205 - PhabricatorCalendarEventTransaction::TYPE_START_DATE) 206 - ->setNewValue($start_value); 207 - 208 - $xactions[] = id(new PhabricatorCalendarEventTransaction()) 209 - ->setTransactionType( 210 - PhabricatorCalendarEventTransaction::TYPE_END_DATE) 211 - ->setNewValue($end_value); 212 - } 213 - 214 - 215 - $xactions[] = id(new PhabricatorCalendarEventTransaction()) 216 - ->setTransactionType( 217 - PhabricatorTransactions::TYPE_SUBSCRIBERS) 218 - ->setNewValue(array('=' => array_fuse($subscribers))); 219 - 220 - $xactions[] = id(new PhabricatorCalendarEventTransaction()) 221 - ->setTransactionType( 222 - PhabricatorCalendarEventTransaction::TYPE_INVITE) 223 - ->setNewValue($invitees); 224 - 225 - $xactions[] = id(new PhabricatorCalendarEventTransaction()) 226 - ->setTransactionType( 227 - PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION) 228 - ->setNewValue($description); 229 - 230 - $xactions[] = id(new PhabricatorCalendarEventTransaction()) 231 - ->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY) 232 - ->setNewValue($request->getStr('viewPolicy')); 233 - 234 - $xactions[] = id(new PhabricatorCalendarEventTransaction()) 235 - ->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY) 236 - ->setNewValue($request->getStr('editPolicy')); 237 - 238 - $xactions[] = id(new PhabricatorCalendarEventTransaction()) 239 - ->setTransactionType(PhabricatorTransactions::TYPE_SPACE) 240 - ->setNewValue($space); 241 - 242 - $editor = id(new PhabricatorCalendarEventEditor()) 243 - ->setActor($viewer) 244 - ->setContentSourceFromRequest($request) 245 - ->setContinueOnNoEffect(true); 246 - 247 - try { 248 - $proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; 249 - $xactions[] = id(new PhabricatorCalendarEventTransaction()) 250 - ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 251 - ->setMetadataValue('edge:type', $proj_edge_type) 252 - ->setNewValue(array('=' => array_fuse($projects))); 253 - 254 - $xactions = $editor->applyTransactions($event, $xactions); 255 - $response = id(new AphrontRedirectResponse()); 256 - switch ($next_workflow) { 257 - case 'day': 258 - if (!$uri_query) { 259 - $uri_query = 'month'; 260 - } 261 - $year = $start_value->getDateTime()->format('Y'); 262 - $month = $start_value->getDateTime()->format('m'); 263 - $day = $start_value->getDateTime()->format('d'); 264 - $response->setURI( 265 - '/calendar/query/'.$uri_query.'/'.$year.'/'.$month.'/'.$day.'/'); 266 - break; 267 - default: 268 - $response->setURI('/E'.$event->getID()); 269 - break; 270 - } 271 - return $response; 272 - } catch (PhabricatorApplicationTransactionValidationException $ex) { 273 - $validation_exception = $ex; 274 - $error_name = $ex->getShortMessage( 275 - PhabricatorCalendarEventTransaction::TYPE_NAME); 276 - $error_start_date = $ex->getShortMessage( 277 - PhabricatorCalendarEventTransaction::TYPE_START_DATE); 278 - $error_end_date = $ex->getShortMessage( 279 - PhabricatorCalendarEventTransaction::TYPE_END_DATE); 280 - $error_recurrence_end_date = $ex->getShortMessage( 281 - PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE); 282 - } 283 - } 284 - 285 - $is_recurring_checkbox = null; 286 - $recurrence_end_date_control = null; 287 - $recurrence_frequency_select = null; 288 - 289 - $all_day_checkbox = null; 290 - $start_control = null; 291 - $end_control = null; 292 - 293 - $recurring_date_edit_label = null; 294 - 295 - $current_policies = id(new PhabricatorPolicyQuery()) 296 - ->setViewer($viewer) 297 - ->setObject($event) 298 - ->execute(); 299 - 300 - $name = id(new AphrontFormTextControl()) 301 - ->setLabel(pht('Name')) 302 - ->setName('name') 303 - ->setValue($name) 304 - ->setError($error_name); 305 - 306 - if ($this->isCreate()) { 307 - Javelin::initBehavior('recurring-edit', array( 308 - 'isRecurring' => $is_recurring_id, 309 - 'frequency' => $frequency_id, 310 - 'recurrenceEndDate' => $recurrence_end_date_id, 311 - )); 312 - 313 - $is_recurring_checkbox = id(new AphrontFormCheckboxControl()) 314 - ->addCheckbox( 315 - 'isRecurring', 316 - 1, 317 - pht('Recurring Event'), 318 - $is_recurring, 319 - $is_recurring_id); 320 - 321 - $recurrence_end_date_control = id(new AphrontFormDateControl()) 322 - ->setUser($viewer) 323 - ->setName('recurrenceEndDate') 324 - ->setLabel(pht('Recurrence End Date')) 325 - ->setError($error_recurrence_end_date) 326 - ->setValue($recurrence_end_date_value) 327 - ->setID($recurrence_end_date_id) 328 - ->setIsTimeDisabled(true) 329 - ->setIsDisabled($recurrence_end_date_value->isDisabled()) 330 - ->setAllowNull(true); 331 - 332 - $recurrence_frequency_select = id(new AphrontFormSelectControl()) 333 - ->setName('frequency') 334 - ->setOptions(array( 335 - PhabricatorCalendarEvent::FREQUENCY_DAILY => pht('Daily'), 336 - PhabricatorCalendarEvent::FREQUENCY_WEEKLY => pht('Weekly'), 337 - PhabricatorCalendarEvent::FREQUENCY_MONTHLY => pht('Monthly'), 338 - PhabricatorCalendarEvent::FREQUENCY_YEARLY => pht('Yearly'), 339 - )) 340 - ->setValue($frequency) 341 - ->setLabel(pht('Recurring Event Frequency')) 342 - ->setID($frequency_id) 343 - ->setDisabled(!$is_recurring); 344 - } 345 - 346 - if ($this->isCreate() || (!$is_parent && !$this->isCreate())) { 347 - Javelin::initBehavior('event-all-day', array( 348 - 'allDayID' => $all_day_id, 349 - 'startDateID' => $start_date_id, 350 - 'endDateID' => $end_date_id, 351 - )); 352 - 353 - $all_day_checkbox = id(new AphrontFormCheckboxControl()) 354 - ->addCheckbox( 355 - 'isAllDay', 356 - 1, 357 - pht('All Day Event'), 358 - $is_all_day, 359 - $all_day_id); 360 - 361 - $start_control = id(new AphrontFormDateControl()) 362 - ->setUser($viewer) 363 - ->setName('start') 364 - ->setLabel(pht('Start')) 365 - ->setError($error_start_date) 366 - ->setValue($start_value) 367 - ->setID($start_date_id) 368 - ->setIsTimeDisabled($is_all_day) 369 - ->setEndDateID($end_date_id); 370 - 371 - $end_control = id(new AphrontFormDateControl()) 372 - ->setUser($viewer) 373 - ->setName('end') 374 - ->setLabel(pht('End')) 375 - ->setError($error_end_date) 376 - ->setValue($end_value) 377 - ->setID($end_date_id) 378 - ->setIsTimeDisabled($is_all_day); 379 - } else if ($is_parent) { 380 - $recurring_date_edit_label = id(new AphrontFormStaticControl()) 381 - ->setUser($viewer) 382 - ->setValue(pht('Date and time of recurring event cannot be edited.')); 383 - 384 - if (!$recurrence_end_date_value->isDisabled()) { 385 - $disabled_recurrence_end_date_value = 386 - $recurrence_end_date_value->getValueAsFormat('M d, Y'); 387 - $recurrence_end_date_control = id(new AphrontFormStaticControl()) 388 - ->setUser($viewer) 389 - ->setLabel(pht('Recurrence End Date')) 390 - ->setValue($disabled_recurrence_end_date_value) 391 - ->setDisabled(true); 392 - } 393 - 394 - $recurrence_frequency_select = id(new AphrontFormSelectControl()) 395 - ->setName('frequency') 396 - ->setOptions(array( 397 - 'daily' => pht('Daily'), 398 - 'weekly' => pht('Weekly'), 399 - 'monthly' => pht('Monthly'), 400 - 'yearly' => pht('Yearly'), 401 - )) 402 - ->setValue($frequency) 403 - ->setLabel(pht('Recurring Event Frequency')) 404 - ->setID($frequency_id) 405 - ->setDisabled(true); 406 - 407 - $all_day_checkbox = id(new AphrontFormCheckboxControl()) 408 - ->addCheckbox( 409 - 'isAllDay', 410 - 1, 411 - pht('All Day Event'), 412 - $is_all_day, 413 - $all_day_id) 414 - ->setDisabled(true); 415 - 416 - $start_disabled = $start_value->getValueAsFormat('M d, Y, g:i A'); 417 - $end_disabled = $end_value->getValueAsFormat('M d, Y, g:i A'); 418 - 419 - $start_control = id(new AphrontFormStaticControl()) 420 - ->setUser($viewer) 421 - ->setLabel(pht('Start')) 422 - ->setValue($start_disabled) 423 - ->setDisabled(true); 424 - 425 - $end_control = id(new AphrontFormStaticControl()) 426 - ->setUser($viewer) 427 - ->setLabel(pht('End')) 428 - ->setValue($end_disabled); 429 - } 430 - 431 - $projects = id(new AphrontFormTokenizerControl()) 432 - ->setLabel(pht('Tags')) 433 - ->setName('projects') 434 - ->setValue($projects) 435 - ->setUser($viewer) 436 - ->setDatasource(new PhabricatorProjectDatasource()); 437 - 438 - $description = id(new PhabricatorRemarkupControl()) 439 - ->setLabel(pht('Description')) 440 - ->setName('description') 441 - ->setValue($description) 442 - ->setUser($viewer); 443 - 444 - $view_policies = id(new AphrontFormPolicyControl()) 445 - ->setUser($viewer) 446 - ->setValue($view_policy) 447 - ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) 448 - ->setPolicyObject($event) 449 - ->setPolicies($current_policies) 450 - ->setSpacePHID($space) 451 - ->setName('viewPolicy'); 452 - $edit_policies = id(new AphrontFormPolicyControl()) 453 - ->setUser($viewer) 454 - ->setValue($edit_policy) 455 - ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) 456 - ->setPolicyObject($event) 457 - ->setPolicies($current_policies) 458 - ->setName('editPolicy'); 459 - 460 - $subscribers = id(new AphrontFormTokenizerControl()) 461 - ->setLabel(pht('Subscribers')) 462 - ->setName('subscribers') 463 - ->setValue($subscribers) 464 - ->setUser($viewer) 465 - ->setDatasource(new PhabricatorMetaMTAMailableDatasource()); 466 - 467 - $invitees = id(new AphrontFormTokenizerControl()) 468 - ->setLabel(pht('Invitees')) 469 - ->setName('invitees') 470 - ->setValue($invitees) 471 - ->setUser($viewer) 472 - ->setDatasource(new PhabricatorMetaMTAMailableDatasource()); 473 - 474 - $icon = id(new PHUIFormIconSetControl()) 475 - ->setLabel(pht('Icon')) 476 - ->setName('icon') 477 - ->setIconSet(new PhabricatorCalendarIconSet()) 478 - ->setValue($icon); 479 - 480 - $form = id(new AphrontFormView()) 481 - ->addHiddenInput('next', $next_workflow) 482 - ->addHiddenInput('query', $uri_query) 483 - ->setUser($viewer) 484 - ->appendChild($name); 485 - 486 - if ($recurring_date_edit_label) { 487 - $form->appendControl($recurring_date_edit_label); 488 - } 489 - if ($is_recurring_checkbox) { 490 - $form->appendChild($is_recurring_checkbox); 491 - } 492 - if ($recurrence_end_date_control) { 493 - $form->appendChild($recurrence_end_date_control); 494 - } 495 - if ($recurrence_frequency_select) { 496 - $form->appendControl($recurrence_frequency_select); 497 - } 498 - 499 - $form 500 - ->appendChild($all_day_checkbox) 501 - ->appendChild($start_control) 502 - ->appendChild($end_control) 503 - ->appendControl($view_policies) 504 - ->appendControl($edit_policies) 505 - ->appendControl($subscribers) 506 - ->appendControl($invitees) 507 - ->appendChild($projects) 508 - ->appendChild($description) 509 - ->appendChild($icon); 510 - 511 - 512 - if ($request->isAjax()) { 513 - return $this->newDialog() 514 - ->setTitle($title) 515 - ->setWidth(AphrontDialogView::WIDTH_FULL) 516 - ->appendForm($form) 517 - ->addCancelButton($cancel_uri) 518 - ->addSubmitButton($submit_label); 519 - } 520 - 521 - $submit = id(new AphrontFormSubmitControl()) 522 - ->addCancelButton($cancel_uri) 523 - ->setValue($submit_label); 524 - 525 - $form->appendChild($submit); 526 - 527 - $form_box = id(new PHUIObjectBoxView()) 528 - ->setHeaderText(pht('Event')) 529 - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 530 - ->setValidationException($validation_exception) 531 - ->setForm($form); 532 - 533 - $crumbs = $this->buildApplicationCrumbs(); 534 - 535 - if (!$this->isCreate()) { 536 - $crumbs->addTextCrumb('E'.$event->getId(), '/E'.$event->getId()); 537 - $crumb_title = pht('Edit Event'); 538 - } else { 539 - $crumb_title = pht('Create Event'); 540 - } 541 - 542 - $crumbs->addTextCrumb($crumb_title); 543 - $crumbs->setBorder(true); 544 - 545 - $header = id(new PHUIHeaderView()) 546 - ->setHeader($title) 547 - ->setHeaderIcon($header_icon); 548 - 549 - $view = id(new PHUITwoColumnView()) 550 - ->setHeader($header) 551 - ->setFooter($form_box); 552 - 553 - return $this->newPage() 554 - ->setTitle($title) 555 - ->setCrumbs($crumbs) 556 - ->appendChild($view); 557 - } 558 - 559 - 560 - private function getDefaultTimeValues($viewer) { 561 - $start = new DateTime('@'.time()); 562 - $start->setTimeZone($viewer->getTimeZone()); 563 - 564 - $start->setTime($start->format('H'), 0, 0); 565 - $start->modify('+1 hour'); 566 - $end = id(clone $start)->modify('+1 hour'); 567 - 568 - $start_value = AphrontFormDateControlValue::newFromEpoch( 569 - $viewer, 570 - $start->format('U')); 571 - $end_value = AphrontFormDateControlValue::newFromEpoch( 572 - $viewer, 573 - $end->format('U')); 574 - 575 - return array($start_value, $end_value); 7 + return id(new PhabricatorCalendarEditEngine()) 8 + ->setController($this) 9 + ->buildResponse(); 576 10 } 577 11 578 12 }
-12
src/applications/calendar/controller/PhabricatorCalendarEventEditProController.php
··· 1 - <?php 2 - 3 - final class PhabricatorCalendarEventEditProController 4 - extends PhabricatorCalendarController { 5 - 6 - public function handleRequest(AphrontRequest $request) { 7 - return id(new PhabricatorCalendarEditEngine()) 8 - ->setController($this) 9 - ->buildResponse(); 10 - } 11 - 12 - }
+8 -13
src/applications/calendar/controller/PhabricatorCalendarEventListController.php
··· 19 19 20 20 $controller = id(new PhabricatorApplicationSearchController()) 21 21 ->setQueryKey($request->getURIData('queryKey')) 22 - ->setSearchEngine($engine) 23 - ->setNavigation($this->buildSideNav()); 22 + ->setSearchEngine($engine); 23 + 24 24 return $this->delegateToController($controller); 25 25 } 26 26 27 - public function buildSideNav() { 28 - $user = $this->getRequest()->getUser(); 27 + protected function buildApplicationCrumbs() { 28 + $crumbs = parent::buildApplicationCrumbs(); 29 29 30 - $nav = new AphrontSideNavFilterView(); 31 - $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); 30 + id(new PhabricatorCalendarEditEngine()) 31 + ->setViewer($this->getViewer()) 32 + ->addActionToCrumbs($crumbs); 32 33 33 - id(new PhabricatorCalendarEventSearchEngine()) 34 - ->setViewer($user) 35 - ->addNavigationItems($nav->getMenu()); 36 - 37 - $nav->selectFilter(null); 38 - 39 - return $nav; 34 + return $crumbs; 40 35 } 41 36 42 37 }
+1 -1
src/applications/calendar/editor/PhabricatorCalendarEditEngine.php
··· 56 56 } 57 57 58 58 protected function getEditorURI() { 59 - return $this->getApplication()->getApplicationURI('event/editpro/'); 59 + return $this->getApplication()->getApplicationURI('event/edit/'); 60 60 } 61 61 62 62 protected function buildCustomEditFields($object) {
+5
src/applications/people/query/PhabricatorPeopleQuery.php
··· 410 410 } 411 411 } 412 412 413 + // We need to load these users' timezone settings to figure out their 414 + // availability if they're attending all-day events. 415 + $this->needUserSettings(true); 416 + $this->fillUserCaches($rebuild); 417 + 413 418 foreach ($rebuild as $phid => $user) { 414 419 $events = idx($map, $phid, array()); 415 420