Package org.olat.core.util.mail

Examples of org.olat.core.util.mail.MailTemplate


          Translator userTrsl = new PackageTranslator(PACKAGE, locale);
         
          String nodeUrl = new URLEncoder().encode("[" + OresHelper.calculateTypeName(CourseNode.class) + ":" + node.getIdent() + "]");
          String link = JumpInManager.getJumpInUri(this.getWindowControl().getBusinessControl()) + nodeUrl;
          log.debug("DEBUG : Returnbox notification email with link=" + link);
          MailTemplate mailTempl = new MailTemplate(userTrsl.translate("returnbox.email.subject"), userTrsl.translate(
              "returnbox.email.body", new String[] { userCourseEnv.getCourseEnvironment().getCourseTitle(), node.getShortTitle(),
                  folderEvent.getFilename(), link }), null) {

            @Override
            public void putVariablesInMailContext(VelocityContext context, Identity recipient) {
View Full Code Here


      usc.dispose();
      usc = null;

    } else if (sourceController == addUserMailCtr) {
      if (event == Event.DONE_EVENT) {
        MailTemplate customTemplate = addUserMailCtr.getMailTemplate();
        doAddIdentitiesToGroup(ureq, toAdd, customTemplate);
        cmc.deactivate();
      } else if (event == Event.CANCELLED_EVENT) {
        cmc.deactivate();
      } else {
        throw new RuntimeException("unknown event ::" + event.getCommand());
      }

    } else if (sourceController == confirmDelete) {
      if (DialogBoxUIFactory.isYesEvent(event)) {
        // before deleting, assure it is allowed
        if (!mayModifyMembers) throw new AssertException("not allowed to remove member!");
        // list is never null, but can be empty
        // TODO: Theoretically it can happen that the table model here is not accurate!
        // the 'keep at least one' should be handled by the security manager that should
        // synchronizes the method on the group
        int size = identitiesTableModel.getObjects().size();
        if (keepAtLeastOne && (size - toRemove.size() == 0)) {
          showError("msg.atleastone");
        } else {
          doRemoveIdentitiesFromGroup(ureq, toRemove, removeUserMailCustomTempl);
        }
      }

    } else if (sourceController == userToGroupWizardCtr) {
      if (event instanceof MultiIdentityChosenEvent) {
        MultiIdentityChosenEvent multiEvent = (MultiIdentityChosenEvent) event;
        List<Identity> choosenIdentities = multiEvent.getChosenIdentities();
        MailTemplate customTemplate = multiEvent.getMailTemplate();
        if (choosenIdentities.size() == 0) {
          showError("msg.selectionempty");
          return;
        }
        doAddIdentitiesToGroup(ureq, choosenIdentities, customTemplate);
View Full Code Here

        };
   
    String subject = translator.translate("mail.participants.add.subject", bodyArgs);
    String body = translator.translate("mail.participants.add.body", bodyArgs);
   
    MailTemplate mailTempl = new MailTemplate(subject, body, null) {
      @Override
      public void putVariablesInMailContext(VelocityContext context, Identity identity) {
//        User user = identity.getUser();
//        context.put("firstname", user.getProperty(UserConstants.FIRSTNAME, ureq.getLocale()));
//        context.put("lastname", user.getProperty(UserConstants.LASTNAME, ureq.getLocale()));
View Full Code Here

        };
   
    String subject = trans.translate("mail.participants.remove.subject", bodyArgs);
    String body = trans.translate("mail.participants.remove.body", bodyArgs);
   
    MailTemplate mailTempl = new MailTemplate(subject, body, null) {
      @Override
      public void putVariablesInMailContext(VelocityContext context, Identity identity) {
//        User user = identity.getUser();
//        context.put("firstname", user.getFirstName());
//        context.put("lastname", user.getLastName());
View Full Code Here

      Step startStep = new ZsuzStepUserData(ureq);
     
      StepRunnerCallback finishCallback = new StepRunnerCallback() {
        @SuppressWarnings({"synthetic-access","unused"})
        public Step execute(UserRequest ureq2, WindowControl control, StepsRunContext runContext) {
          MailTemplate mailtemplate = (MailTemplate)runContext.get("mailtemplate");
          //fetch data from runContext and send eMail with it
          MailerWithTemplate mailer = MailerWithTemplate.getInstance();
          Identity replyto = (Identity)runContext.get("replyto");
          MailerResult mr = mailer.sendMail(ureq2.getIdentity(), null, null, mailtemplate, replyto);
          logAudit("DRUCKEREI-TEMPLATE-ERSTELLT", null);
View Full Code Here

        }
      }
    } else if (sourceController == transferMailCtr) {
      if (event == Event.DONE_EVENT) {
        // fetch configured mail template and finish this controller workflow
        MailTemplate customTransferTemplate = transferMailCtr.getMailTemplate();
        cmc.deactivate();
        IdentitiesMoveEvent identitiesMoveEvent = new IdentitiesMoveEvent(toTransfer);
        identitiesMoveEvent.setMailTemplate(customTransferTemplate);
        fireEvent(ureq, identitiesMoveEvent);
        StringBuilder infoMessage = new StringBuilder();
View Full Code Here

   * @see org.olat.core.gui.control.generic.wizard.StepFormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer, org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
   */
  @Override
  @SuppressWarnings("unused")
  protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    MailTemplate template = (MailTemplate)getFromRunContext("mailtemplate");
    Identity replyto = (Identity)getFromRunContext("replyto");
    String[] subjectAndBody = MailerWithTemplate.getInstance().previewSubjectAndBody(ureq.getIdentity(), null, null, template, replyto);
    //add disabled textelements.
    String email = getIdentity().getUser().getProperty(UserConstants.EMAIL, getLocale());
    uifactory.addStaticTextElement("form.howtoproceed", null, translate("form.howtoproceed", email), formLayout);
View Full Code Here

    }
    // now delete the group first
    deleteBusinessGroup(businessGroupTodelete);
    // finally send email
    MailerWithTemplate mailer = MailerWithTemplate.getInstance();
    MailTemplate mailTemplate = BGMailHelper.createDeleteGroupMailTemplate(businessGroupTodelete, ureq.getIdentity());
    if (mailTemplate != null) {
      MailerResult mailerResult = mailer.sendMailAsSeparateMails(users, null, null, mailTemplate, null);
      MailHelper.printErrorsAndWarnings(mailerResult, wControl, ureq.getLocale());
    }
   
View Full Code Here

              this.removeFromWaitingListAndFireEvent(ureqIdentity, firstWaitingListIdentity, group, false);
            } finally {
              ThreadLocalUserActivityLogger.setStickyActionType(formerStickyActionType);
            }
            // send a notification mail if available
            MailTemplate mailTemplate = BGMailHelper.createWaitinglistTransferMailTemplate(group, ureqIdentity);
            if (mailTemplate != null) {
              MailerWithTemplate mailer = MailerWithTemplate.getInstance();
              MailerResult mailerResult = mailer.sendMail(firstWaitingListIdentity, null, null, mailTemplate, null);
              // Does not report errors to current screen because this is the identity who triggered the transfer
              Tracing.logWarn("Could not send WaitinglistTransferMail for identity=" + firstWaitingListIdentity.getName() , BusinessGroupManagerImpl.class);
View Full Code Here

    // Project Member Management
    projectMemberController = new GroupController(ureq, getWindowControl(), true, false, true, project.getProjectParticipantGroup());
    listenTo(projectMemberController);
    myContent.put("projectMemberController", projectMemberController.getInitialComponent());
    // add mail templates used when adding and removing users
    MailTemplate partAddUserMailTempl = ProjectBrokerManagerFactory.getProjectBrokerEmailer().createAddParticipantMailTemplate(project, ureq.getIdentity(), this.getTranslator());
    projectMemberController.setAddUserMailTempl(partAddUserMailTempl);
    MailTemplate partRemoveUserMailTempl = ProjectBrokerManagerFactory.getProjectBrokerEmailer().createRemoveParticipantMailTemplate(project, ureq.getIdentity(), this.getTranslator());
    projectMemberController.setRemoveUserMailTempl(partRemoveUserMailTempl);

    // Project Candidates Management
    if (projectBrokerModuleConfiguration.isAcceptSelectionManually()) {
      projectCandidatesController = new WaitingGroupController(ureq, getWindowControl(), true, false, true, project.getCandidateGroup());
      listenTo(projectCandidatesController);
      myContent.put("projectCandidatesController", projectCandidatesController.getInitialComponent());
      // add mail templates used when adding and removing users
      MailTemplate waitAddUserMailTempl = ProjectBrokerManagerFactory.getProjectBrokerEmailer().createAddCandidateMailTemplate(project, ureq.getIdentity(), this.getTranslator());
      projectCandidatesController.setAddUserMailTempl(waitAddUserMailTempl);
      MailTemplate waitRemoveUserMailTempl = ProjectBrokerManagerFactory.getProjectBrokerEmailer().createRemoveAsCandiadateMailTemplate(project, ureq.getIdentity(), this.getTranslator());
      projectCandidatesController.setRemoveUserMailTempl(waitRemoveUserMailTempl);
      MailTemplate waitTransferUserMailTempl = ProjectBrokerManagerFactory.getProjectBrokerEmailer().createAcceptCandiadateMailTemplate(project, ureq.getIdentity(), this.getTranslator());
      projectCandidatesController.setTransferUserMailTempl(waitTransferUserMailTempl);
    }
   
    putInitialPanel(myContent);
  }
View Full Code Here

TOP

Related Classes of org.olat.core.util.mail.MailTemplate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.