/**
   * Constructor for the email
   *
   * @param wControl
   * @param ureq
   * @param mailTemplate
   * @param useCancel
   */
  public BGMailNotificationEditController(
      WindowControl wControl,
      UserRequest ureq,
      MailTemplate mailTemplate,
      boolean ccSenderAllowed,
      boolean customizingAvailable,
      boolean useCancel,
      boolean mandatory) {
    super(ureq, wControl);
    this.mailTemplate = mailTemplate;
    orgMailSubject = mailTemplate.getSubjectTemplate();
    orgMailBody = mailTemplate.getBodyTemplate();
    cpFrom = mailTemplate.getCpfrom();

    mainVC = createVelocityContainer("mailnotification");
    mailForm =
        new BGMailTemplateController(
            ureq,
            wControl,
            mailTemplate,
            ccSenderAllowed,
            customizingAvailable,
            useCancel,
            mandatory);
    listenTo(mailForm);

    mainVC.put("mailForm", mailForm.getInitialComponent());

    putInitialPanel(mainVC);
  }
 /**
  * @return The mail template containing the configured mail or null if user decided to not send a
  *     mail
  */
 public MailTemplate getMailTemplate() {
   if (mailForm.sendMailSwitchEnabled()) {
     return mailTemplate;
   } else {
     return null;
   }
 }
 @Override
 public void event(UserRequest ureq, Controller source, Event event) {
   if (source == mailForm) {
     if (event == Event.DONE_EVENT) {
       mailForm.updateTemplateFromForm(mailTemplate);
       fireEvent(ureq, event);
     } else if (event == Event.CANCELLED_EVENT) {
       mailTemplate = null;
       fireEvent(ureq, event);
     }
   }
 }
 public boolean isSendMail() {
   return mailForm.sendMailSwitchEnabled();
 }