private void doStart(UserRequest ureq) {
   if (registrant == null) {
     GoToError error = new GoToError();
     registrant = meetingMgr.registerTraining(meeting, getIdentity(), error);
   }
   GoToError error = new GoToError();
   String startUrl = meetingMgr.startTraining(meeting, error);
   if (startUrl != null) {
     RedirectMediaResource redirect = new RedirectMediaResource(startUrl);
     ureq.getDispatchResult().setResultingMediaResource(redirect);
   } else if (error.getError() == GoToErrors.TrainingInSession) {
     String joinUrl = registrant.getJoinUrl();
     RedirectMediaResource redirect = new RedirectMediaResource(joinUrl);
     ureq.getDispatchResult().setResultingMediaResource(redirect);
   }
 }
  public GoToMeetingController(
      UserRequest ureq,
      WindowControl wControl,
      GoToMeeting meeting,
      boolean administrator,
      boolean moderator,
      boolean readOnly) {
    super(ureq, wControl);
    this.readOnly = readOnly;
    this.moderator = moderator;
    this.administrator = administrator;

    mainVC = createVelocityContainer("meeting");
    mainVC.contextPut("title", meeting.getName());
    mainVC.contextPut("description", meeting.getDescription());

    if (administrator || moderator) {
      startLink = LinkFactory.createButtonLarge("training.start", mainVC, this);
      startLink.setTarget("_blank");
    }
    registerLink = LinkFactory.createButtonLarge("training.register", mainVC, this);
    confirmLink = LinkFactory.createButtonLarge("training.confirm", mainVC, this);
    confirmLink.setTarget("_blank");
    joinLink = LinkFactory.createButtonLarge("training.join", mainVC, this);
    joinLink.setTarget("_blank");

    openRecordingsLink = LinkFactory.createButton("recordings", mainVC, this);

    GoToError error = new GoToError();
    this.meeting = meetingMgr.getMeeting(meeting, error);
    this.registrant = meetingMgr.getRegistrant(meeting, getIdentity());
    if (error.hasError() && error.getError() != null) {
      mainVC.contextPut("errorMessage", translate(error.getError().i18nKey()));
    }

    List<GoToRecordingsG2T> recordings = meetingMgr.getRecordings(meeting, error);
    openRecordingsLink.setVisible(recordings != null && recordings.size() > 0);

    Date start = meeting.getStartDate();
    Date end = meeting.getEndDate();
    Formatter formatter = Formatter.getInstance(getLocale());
    mainVC.contextPut("start", formatter.formatDateAndTime(start));
    mainVC.contextPut("end", formatter.formatDateAndTime(end));

    putInitialPanel(mainVC);
    updateButtons();
  }
 private void doRegister() {
   if (registrant == null) {
     GoToError error = new GoToError();
     registrant = meetingMgr.registerTraining(meeting, getIdentity(), error);
     if (registrant != null) {
       showInfo("training.register.success");
     } else {
       showWarning("training.register.failed");
     }
   }
   updateButtons();
 }
  private void doJoin(UserRequest ureq) {
    boolean join = false;
    GoToError error = new GoToError();
    if (registrant == null) {
      registrant = meetingMgr.registerTraining(meeting, getIdentity(), error);
    }
    if (registrant != null) {
      String joinUrl = registrant.getJoinUrl();
      if (joinUrl != null) {
        RedirectMediaResource redirect = new RedirectMediaResource(joinUrl);
        ureq.getDispatchResult().setResultingMediaResource(redirect);
        join = true;
      }
    }
    if (!join) {
      final String errorMessage;
      if (error.hasError()) {
        if (error.getError() != null) {
          errorMessage = translate(error.getError().i18nKey());
        } else {
          errorMessage = translate("error.code.unkown");
        }
      } else {
        errorMessage = translate("error.code.unkown");
      }

      ControllerCreator creator =
          BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(
              ureq,
              new ControllerCreator() {
                @Override
                public Controller createController(UserRequest lureq, WindowControl lwControl) {
                  // Wrap in column layout, popup window needs a layout controller
                  String title = "";
                  String text = errorMessage;
                  Controller ctr =
                      MessageUIFactory.createErrorMessage(lureq, lwControl, title, text);
                  LayoutMain3ColsController layoutCtr =
                      new LayoutMain3ColsController(lureq, lwControl, ctr);
                  layoutCtr.addDisposableChildController(ctr);
                  return layoutCtr;
                }
              });

      openInNewBrowserWindow(ureq, creator);
    }
    updateButtons();
  }