@@ -144,6 +144,7 @@ public function handleRequest(AphrontRequest $request) {
144
144
$ description = $ event ->getDescription ();
145
145
$ is_all_day = $ event ->getIsAllDay ();
146
146
$ is_recurring = $ event ->getIsRecurring ();
147
+ $ is_parent = $ event ->getIsRecurrenceParent ();
147
148
$ frequency = idx ($ event ->getRecurrenceFrequency (), 'rule ' );
148
149
$ icon = $ event ->getIcon ();
149
150
@@ -190,7 +191,7 @@ public function handleRequest(AphrontRequest $request) {
190
191
PhabricatorCalendarEventTransaction::TYPE_NAME )
191
192
->setNewValue ($ name );
192
193
193
- if ($ this ->isCreate ()) {
194
+ if ($ is_parent && $ this ->isCreate ()) {
194
195
$ xactions [] = id (new PhabricatorCalendarEventTransaction ())
195
196
->setTransactionType (
196
197
PhabricatorCalendarEventTransaction::TYPE_RECURRING )
@@ -209,25 +210,28 @@ public function handleRequest(AphrontRequest $request) {
209
210
}
210
211
}
211
212
212
- $ xactions [] = id (new PhabricatorCalendarEventTransaction ())
213
- ->setTransactionType (
214
- PhabricatorCalendarEventTransaction::TYPE_ALL_DAY )
215
- ->setNewValue ($ is_all_day );
213
+ if (($ is_parent && $ this ->isCreate ()) || !$ is_parent ) {
214
+ $ xactions [] = id (new PhabricatorCalendarEventTransaction ())
215
+ ->setTransactionType (
216
+ PhabricatorCalendarEventTransaction::TYPE_ALL_DAY )
217
+ ->setNewValue ($ is_all_day );
216
218
217
- $ xactions [] = id (new PhabricatorCalendarEventTransaction ())
218
- ->setTransactionType (
219
- PhabricatorCalendarEventTransaction::TYPE_ICON )
220
- ->setNewValue ($ icon );
219
+ $ xactions [] = id (new PhabricatorCalendarEventTransaction ())
220
+ ->setTransactionType (
221
+ PhabricatorCalendarEventTransaction::TYPE_ICON )
222
+ ->setNewValue ($ icon );
221
223
222
- $ xactions [] = id (new PhabricatorCalendarEventTransaction ())
223
- ->setTransactionType (
224
- PhabricatorCalendarEventTransaction::TYPE_START_DATE )
225
- ->setNewValue ($ start_value );
224
+ $ xactions [] = id (new PhabricatorCalendarEventTransaction ())
225
+ ->setTransactionType (
226
+ PhabricatorCalendarEventTransaction::TYPE_START_DATE )
227
+ ->setNewValue ($ start_value );
228
+
229
+ $ xactions [] = id (new PhabricatorCalendarEventTransaction ())
230
+ ->setTransactionType (
231
+ PhabricatorCalendarEventTransaction::TYPE_END_DATE )
232
+ ->setNewValue ($ end_value );
233
+ }
226
234
227
- $ xactions [] = id (new PhabricatorCalendarEventTransaction ())
228
- ->setTransactionType (
229
- PhabricatorCalendarEventTransaction::TYPE_END_DATE )
230
- ->setNewValue ($ end_value );
231
235
232
236
$ xactions [] = id (new PhabricatorCalendarEventTransaction ())
233
237
->setTransactionType (
@@ -296,6 +300,12 @@ public function handleRequest(AphrontRequest $request) {
296
300
$ recurrence_end_date_control = null ;
297
301
$ recurrence_frequency_select = null ;
298
302
303
+ $ all_day_checkbox = null ;
304
+ $ start_control = null ;
305
+ $ end_control = null ;
306
+
307
+ $ recurring_date_edit_label = null ;
308
+
299
309
$ name = id (new AphrontFormTextControl ())
300
310
->setLabel (pht ('Name ' ))
301
311
->setName ('name ' )
@@ -325,8 +335,9 @@ public function handleRequest(AphrontRequest $request) {
325
335
->setValue ($ recurrence_end_date_value )
326
336
->setID ($ recurrence_end_date_id )
327
337
->setIsTimeDisabled (true )
338
+ ->setIsDisabled ($ recurrence_end_date_value ->isDisabled ())
328
339
->setAllowNull (true )
329
- ->setIsDisabled ( $ recurrence_end_date_value -> isDisabled () );
340
+ ->isRequired ( false );
330
341
331
342
$ recurrence_frequency_select = id (new AphrontFormSelectControl ())
332
343
->setName ('frequency ' )
@@ -342,38 +353,90 @@ public function handleRequest(AphrontRequest $request) {
342
353
->setDisabled (!$ is_recurring );
343
354
}
344
355
345
- Javelin::initBehavior ('event-all-day ' , array (
346
- 'allDayID ' => $ all_day_id ,
347
- 'startDateID ' => $ start_date_id ,
348
- 'endDateID ' => $ end_date_id ,
349
- ));
350
-
351
- $ all_day_checkbox = id (new AphrontFormCheckboxControl ())
352
- ->addCheckbox (
353
- 'isAllDay ' ,
354
- 1 ,
355
- pht ('All Day Event ' ),
356
- $ is_all_day ,
357
- $ all_day_id );
358
-
359
- $ start_control = id (new AphrontFormDateControl ())
360
- ->setUser ($ viewer )
361
- ->setName ('start ' )
362
- ->setLabel (pht ('Start ' ))
363
- ->setError ($ error_start_date )
364
- ->setValue ($ start_value )
365
- ->setID ($ start_date_id )
366
- ->setIsTimeDisabled ($ is_all_day )
367
- ->setEndDateID ($ end_date_id );
368
-
369
- $ end_control = id (new AphrontFormDateControl ())
370
- ->setUser ($ viewer )
371
- ->setName ('end ' )
372
- ->setLabel (pht ('End ' ))
373
- ->setError ($ error_end_date )
374
- ->setValue ($ end_value )
375
- ->setID ($ end_date_id )
376
- ->setIsTimeDisabled ($ is_all_day );
356
+ if ($ this ->isCreate () || (!$ is_parent && !$ this ->isCreate ())) {
357
+ Javelin::initBehavior ('event-all-day ' , array (
358
+ 'allDayID ' => $ all_day_id ,
359
+ 'startDateID ' => $ start_date_id ,
360
+ 'endDateID ' => $ end_date_id ,
361
+ ));
362
+
363
+ $ all_day_checkbox = id (new AphrontFormCheckboxControl ())
364
+ ->addCheckbox (
365
+ 'isAllDay ' ,
366
+ 1 ,
367
+ pht ('All Day Event ' ),
368
+ $ is_all_day ,
369
+ $ all_day_id );
370
+
371
+ $ start_control = id (new AphrontFormDateControl ())
372
+ ->setUser ($ viewer )
373
+ ->setName ('start ' )
374
+ ->setLabel (pht ('Start ' ))
375
+ ->setError ($ error_start_date )
376
+ ->setValue ($ start_value )
377
+ ->setID ($ start_date_id )
378
+ ->setIsTimeDisabled ($ is_all_day )
379
+ ->setEndDateID ($ end_date_id );
380
+
381
+ $ end_control = id (new AphrontFormDateControl ())
382
+ ->setUser ($ viewer )
383
+ ->setName ('end ' )
384
+ ->setLabel (pht ('End ' ))
385
+ ->setError ($ error_end_date )
386
+ ->setValue ($ end_value )
387
+ ->setID ($ end_date_id )
388
+ ->setIsTimeDisabled ($ is_all_day );
389
+ } else if ($ is_parent ) {
390
+ $ recurring_date_edit_label = id (new AphrontFormStaticControl ())
391
+ ->setUser ($ viewer )
392
+ ->setValue (pht ('Date and time of recurring event cannot be edited. ' ));
393
+
394
+ if (!$ recurrence_end_date_value ->isDisabled ()) {
395
+ $ disabled_recurrence_end_date_value =
396
+ $ recurrence_end_date_value ->getValueAsFormat ('M d, Y ' );
397
+ $ recurrence_end_date_control = id (new AphrontFormStaticControl ())
398
+ ->setUser ($ viewer )
399
+ ->setLabel (pht ('Recurrence End Date ' ))
400
+ ->setValue ($ disabled_recurrence_end_date_value )
401
+ ->setDisabled (true );
402
+ }
403
+
404
+ $ recurrence_frequency_select = id (new AphrontFormSelectControl ())
405
+ ->setName ('frequency ' )
406
+ ->setOptions (array (
407
+ 'daily ' => pht ('Daily ' ),
408
+ 'weekly ' => pht ('Weekly ' ),
409
+ 'monthly ' => pht ('Monthly ' ),
410
+ 'yearly ' => pht ('Yearly ' ),
411
+ ))
412
+ ->setValue ($ frequency )
413
+ ->setLabel (pht ('Recurring Event Frequency ' ))
414
+ ->setID ($ frequency_id )
415
+ ->setDisabled (true );
416
+
417
+ $ all_day_checkbox = id (new AphrontFormCheckboxControl ())
418
+ ->addCheckbox (
419
+ 'isAllDay ' ,
420
+ 1 ,
421
+ pht ('All Day Event ' ),
422
+ $ is_all_day ,
423
+ $ all_day_id )
424
+ ->setDisabled (true );
425
+
426
+ $ start_disabled = $ start_value ->getValueAsFormat ('M d, Y, g:i A ' );
427
+ $ end_disabled = $ end_value ->getValueAsFormat ('M d, Y, g:i A ' );
428
+
429
+ $ start_control = id (new AphrontFormStaticControl ())
430
+ ->setUser ($ viewer )
431
+ ->setLabel (pht ('Start ' ))
432
+ ->setValue ($ start_disabled )
433
+ ->setDisabled (true );
434
+
435
+ $ end_control = id (new AphrontFormStaticControl ())
436
+ ->setUser ($ viewer )
437
+ ->setLabel (pht ('End ' ))
438
+ ->setValue ($ end_disabled );
439
+ }
377
440
378
441
$ description = id (new AphrontFormTextAreaControl ())
379
442
->setLabel (pht ('Description ' ))
@@ -427,6 +490,9 @@ public function handleRequest(AphrontRequest $request) {
427
490
->setUser ($ viewer )
428
491
->appendChild ($ name );
429
492
493
+ if ($ recurring_date_edit_label ) {
494
+ $ form ->appendControl ($ recurring_date_edit_label );
495
+ }
430
496
if ($ is_recurring_checkbox ) {
431
497
$ form ->appendChild ($ is_recurring_checkbox );
432
498
}
0 commit comments