@@ -504,6 +504,7 @@ function AddTrainingCourseForm()
504504 $ Paid = new CheckboxField ('Paid ' , "Is Paid? " );
505505 $ Level = new DropdownField ('LevelID ' , 'Level ' , TrainingCourseLevel::get ()->map ('ID ' , 'Level ' ));
506506 $ Projects = new CheckboxSetField ('Projects ' , '' , Project::get ()->map ('ID ' , 'Name ' ));
507+ $ Projects ->setTemplate ('BootstrapAwesomeCheckboxsetField ' );
507508
508509 $ Program = new HiddenField ('TrainingServiceID ' , "TrainingServiceID " , $ this ->training_id );
509510 $ Course = new HiddenField ('ID ' , "course " , 0 );
@@ -521,7 +522,7 @@ function AddTrainingCourseForm()
521522 $ State [$ i ] = new TextField ('State[ ' . $ i . '] ' , "State " , $ dto ->getState ());
522523 $ State [$ i ]->addExtraClass ('state ' );
523524
524- $ Country [$ i ] = new DropdownField ('Country[ ' . $ i . '] ' , $ dto -> getCountry () , CountryCodes::$ iso_3166_countryCodes , $ dto ->getCountry ());
525+ $ Country [$ i ] = new DropdownField ('Country[ ' . $ i . '] ' , " Country " , CountryCodes::$ iso_3166_countryCodes , $ dto ->getCountry ());
525526 $ Country [$ i ]->setEmptyString ('-- Select One -- ' );
526527 $ Country [$ i ]->addExtraClass ('country ' );
527528
@@ -536,30 +537,29 @@ function AddTrainingCourseForm()
536537 }
537538 }
538539
539- if ( $ show_blank_schedule ) {
540- $ City = new TextField ('City[] ' , "City " );
541- $ City ->addExtraClass ('city_name ' );
540+ // fields for template
541+ $ TemplateCity = new TextField ('City[] ' , "City " );
542+ $ TemplateCity ->addExtraClass ('city_name ' );
542543
543- $ State = new TextField ('State[] ' , "State " );
544- $ State ->addExtraClass ('state ' );
544+ $ TemplateState = new TextField ('State[] ' , "State " );
545+ $ TemplateState ->addExtraClass ('state ' );
545546
546- $ Country = new DropdownField ('Country[] ' , 'Country ' , CountryCodes::$ iso_3166_countryCodes );
547- $ Country ->setEmptyString ('-- Select One -- ' );
548- $ Country ->addExtraClass ('country ' );
547+ $ TemplateCountry = new DropdownField ('Country[] ' , 'Country ' , CountryCodes::$ iso_3166_countryCodes );
548+ $ TemplateCountry ->setEmptyString ('-- Select One -- ' );
549+ $ TemplateCountry ->addExtraClass ('country ' );
549550
550- $ StartDate = new TextField ('StartDate[] ' , "Start Date " );
551- $ StartDate ->addExtraClass ('dateSelector start ' );
552- $ EndDate = new TextField ('EndDate[] ' , "End Date " );
553- $ EndDate ->addExtraClass ('dateSelector end ' );
554- $ LinkS = new TextField ('LinkS[] ' , "Link " );
555- $ LinkS ->addExtraClass ('url ' );
556- }
551+ $ TemplateStartDate = new TextField ('StartDate[] ' , "Start Date " );
552+ $ TemplateStartDate ->addExtraClass ('dateSelector start ' );
553+ $ TemplateEndDate = new TextField ('EndDate[] ' , "End Date " );
554+ $ TemplateEndDate ->addExtraClass ('dateSelector end ' );
555+ $ TemplateLinkS = new TextField ('LinkS[] ' , "Link " );
556+ $ TemplateLinkS ->addExtraClass ('url ' );
557557
558558 $ fields = new FieldList (
559559 $ Name ,
560560 $ Description ,
561561 $ Link ,
562- new LiteralField ('break ' , '<hr/><div class="horizontal-fields"> ' ),
562+ new LiteralField ('break ' , '<br>< hr/><div class="horizontal-fields"> ' ),
563563 $ Online ,
564564 $ Paid ,
565565 $ Level ,
@@ -570,6 +570,7 @@ function AddTrainingCourseForm()
570570 $ Projects ,
571571 new LiteralField ('schedule ' , '<h4>Schedule</h4> ' ),
572572 new LiteralField ('instruction ' , '<p class="note_online">City, State and Country can \'t be edited when a course is marked <em>Online</em>.</p> ' ),
573+ new LiteralField ('noSchedule ' , '<div id="no_schedules">No schedules set.</div> ' ),
573574 new LiteralField ('scheduleDiv ' , '<div id="schedules"> ' )
574575 );
575576
@@ -589,23 +590,25 @@ function AddTrainingCourseForm()
589590
590591 }
591592
592- } else {
593- $ fields ->push (new LiteralField ('scheduleDiv ' , '<div class="scheduleRow"> ' ));
594- $ fields ->push ($ City );
595- $ fields ->push ($ State );
596- $ fields ->push ($ Country );
597- $ fields ->push ($ StartDate );
598- $ fields ->push ($ EndDate );
599- $ fields ->push ($ LinkS );
600- $ fields ->push (new LiteralField ('scheduleDiv ' , '</div> ' ));
601593 }
602594
603595 $ fields ->push (new LiteralField ('scheduleDivC ' , '</div> ' ));
604- $ fields ->push (new LiteralField ('addSchedule ' , '<button id="addSchedule" class="action">Add Another</button> ' ));
596+ $ fields ->push (new LiteralField ('addSchedule ' , '<button id="addSchedule" class="btn btn-default action">Add Another</button> ' ));
597+
598+ // schedule template
599+ $ fields ->push (new LiteralField ('scheduleTemplate ' , '<div class="schedule_template"> ' ));
600+ $ fields ->push ($ TemplateCity );
601+ $ fields ->push ($ TemplateState );
602+ $ fields ->push ($ TemplateCountry );
603+ $ fields ->push ($ TemplateStartDate );
604+ $ fields ->push ($ TemplateEndDate );
605+ $ fields ->push ($ TemplateLinkS );
606+ $ fields ->push (new LiteralField ('scheduleTemplate ' , '</div> ' ));
605607
606608 $ actions = new FieldList (
607- new FormAction ('AddCourse ' , 'Submit ' )
609+ $ submit = new FormAction ('AddCourse ' , 'Submit ' )
608610 );
611+ $ submit ->addExtraClass ('btn btn-primary ' );
609612 $ validators = new ConditionalAndValidationRule (array (new RequiredFields ('Name ' , 'Level ' ), new HtmlPurifierRequiredValidator ('Description ' )));
610613 $ form = new Form ($ this , 'AddTrainingCourseForm ' , $ fields , $ actions , $ validators );
611614 if (isset ($ this ->EditCourseID )) {
@@ -635,6 +638,8 @@ function AddCourse($data, $form)
635638
636639 function trainingEdit ()
637640 {
641+ Requirements::css ('themes/openstack/bower_assets/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css ' );
642+
638643 $ this ->EditCourseID = intval ($ _GET ['course_id ' ]);
639644 return $ this ->renderWith (array ('EditProfilePage_TrainingAddCourse ' , 'Page ' ));
640645 }
0 commit comments