Package org.olat.core.util.mail

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


            showWarning("msg.selectionempty");
            return;
          }
          removeAsListenerAndDispose(contactCtr);
          // create e-mail message
          ContactMessage cmsg = new ContactMessage(ureq.getIdentity());

          selectedIdentities = tdm.getIdentities(tmse.getSelection());
          ContactList contacts = new ContactList(translate("mailto.userlist"));
          contacts.addAllIdentites(selectedIdentities);
          cmsg.addEmailTo(contacts);

          // create contact form controller with ContactMessage
          contactCtr = new ContactFormController(ureq, getWindowControl(), false, true, false, false, cmsg);
          listenTo(contactCtr);
View Full Code Here


   * @return a contact form controller for this group
   */
  private ContactFormController createContactFormController(UserRequest ureq) {
    Manager scrtMngr = ManagerFactory.getManager();

    ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
    // two named ContactLists, the new way using the contact form
    // the same name as in the checkboxes are taken as contactlist names
    ContactList ownerCntctLst;// = new ContactList(translate("sendtochooser.form.chckbx.owners"));
    ContactList partipCntctLst;// = new ContactList(translate("sendtochooser.form.chckbx.partip"));
    ContactList waitingListContactList;// = new ContactList(translate("sendtochooser.form.chckbx.waitingList"));
    if (flags.isEnabled(BGConfigFlags.GROUP_OWNERS)) {
      if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) {
        ownerCntctLst = new ContactList(translate("sendtochooser.form.radio.owners.all"));
        SecurityGroup owners = businessGroup.getOwnerGroup();
        List<Identity> ownerList = scrtMngr.getIdentitiesOfSecurityGroup(owners);
        ownerCntctLst.addAllIdentites(ownerList);
        cmsg.addEmailTo(ownerCntctLst);
      } else {
        if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) {
          ownerCntctLst = new ContactList(translate("sendtochooser.form.radio.owners.choose"));
          SecurityGroup owners = businessGroup.getOwnerGroup();
          List<Identity> ownerList = scrtMngr.getIdentitiesOfSecurityGroup(owners);
          List<Identity> changeableOwnerList = scrtMngr.getIdentitiesOfSecurityGroup(owners);
          for (Identity identity : ownerList) {
            boolean keyIsSelected = false;
            for (Long key : sendToChooserForm.getSelectedOwnerKeys()) {
              if (key.equals(identity.getKey())) {
                keyIsSelected = true;
                break;
              }
            }
            if (!keyIsSelected) {
              changeableOwnerList.remove(changeableOwnerList.indexOf(identity));
            }
          }
          ownerCntctLst.addAllIdentites(changeableOwnerList);
          cmsg.addEmailTo(ownerCntctLst);
        }
      }
    }
    if (sendToChooserForm != null) {
      if  (sendToChooserForm.participantChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) {
        partipCntctLst  = new ContactList(translate("sendtochooser.form.radio.partip.all"));
        SecurityGroup participants = businessGroup.getPartipiciantGroup();
        List<Identity> participantsList = scrtMngr.getIdentitiesOfSecurityGroup(participants);
        partipCntctLst.addAllIdentites(participantsList);
        cmsg.addEmailTo(partipCntctLst);
      } else {
        if (sendToChooserForm.participantChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) {
          partipCntctLst  = new ContactList(translate("sendtochooser.form.radio.partip.choose"));
          SecurityGroup participants = businessGroup.getPartipiciantGroup();
          List<Identity> participantsList = scrtMngr.getIdentitiesOfSecurityGroup(participants);
          List<Identity> changeableParticipantsList = scrtMngr.getIdentitiesOfSecurityGroup(participants);
          for (Identity identity : participantsList) {
            boolean keyIsSelected = false;
            for (Long key : sendToChooserForm.getSelectedPartipKeys()) {
              if (key.equals(identity.getKey())) {
                keyIsSelected = true;
                break;
              }
            }
            if (!keyIsSelected) {
              changeableParticipantsList.remove(changeableParticipantsList.indexOf(identity));
            }
          }
          partipCntctLst.addAllIdentites(changeableParticipantsList);
          cmsg.addEmailTo(partipCntctLst);
        }
      }
     
    }
    if (sendToChooserForm != null && isAdmin && businessGroup.getWaitingListEnabled().booleanValue()) {
      if (sendToChooserForm.waitingListChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) {
        waitingListContactList = new ContactList(translate("sendtochooser.form.radio.waitings.all"));
        SecurityGroup waitingList = businessGroup.getWaitingGroup();
        List<Identity> waitingListIdentities = scrtMngr.getIdentitiesOfSecurityGroup(waitingList);
        waitingListContactList.addAllIdentites(waitingListIdentities);
        cmsg.addEmailTo(waitingListContactList);
      } else {
        if (sendToChooserForm.waitingListChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) {
          waitingListContactList = new ContactList(translate("sendtochooser.form.radio.waitings.choose"));
          SecurityGroup waitingList = businessGroup.getWaitingGroup();
          List<Identity> waitingListIdentities = scrtMngr.getIdentitiesOfSecurityGroup(waitingList);
          List<Identity> changeableWaitingListIdentities = scrtMngr.getIdentitiesOfSecurityGroup(waitingList);
          for (Identity indentity : waitingListIdentities) {
            boolean keyIsSelected = false;
            for (Long key : sendToChooserForm.getSelectedWaitingKeys()) {
              if (key.equals(indentity.getKey())) {
                keyIsSelected = true;
                break;
              }
            }
            if (!keyIsSelected) {
              changeableWaitingListIdentities.remove(changeableWaitingListIdentities.indexOf(indentity));
            }
          }
          waitingListContactList.addAllIdentites(changeableWaitingListIdentities);
          cmsg.addEmailTo(waitingListContactList);
        }
      }
    }
   
    cmsg.setSubject( translate("businessgroup.contact.subject", businessGroup.getName() ) );
    String resourceUrl = JumpInManager.getJumpInUri(this.getWindowControl().getBusinessControl());
    cmsg.setBodyText( getTranslator().translate("businessgroup.contact.bodytext", new String[]{ businessGroup.getName(), resourceUrl} ) );
   
    CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup);
    ContactFormController cofocntrllr = collabTools.createContactFormController(ureq, getWindowControl(), cmsg);
    return cofocntrllr;
  }
View Full Code Here

      contactLists.push(emailList);
      valid = true;
    }

    if (valid){ // at least one email adress
      ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
     
      while (!contactLists.empty()) {
        ContactList cl = contactLists.pop();
        cmsg.addEmailTo(cl);
      }
      cmsg.setBodyText(mBody);
      cmsg.setSubject(mSubject);
      coFoCtr = new ContactFormController(ureq, getWindowControl(), true,false,false,false, cmsg);
      listenTo(coFoCtr);//dispose as this controller is disposed
      myContent.put("myCoForm", coFoCtr.getInitialComponent());
      putInitialPanel(myContent);
    } else { // no email adresses at all
View Full Code Here

    sendMessageVC.contextPut("title", getTranslator().translate("user.message", new String[] { this.currentIdentity.getUser().getProperty(UserConstants.FIRSTNAME, getLocale()),
        this.currentIdentity.getUser().getProperty(UserConstants.FIRSTNAME, getLocale()) }));
  }

  private void doSendMessage(List identities, String mailToName, UserRequest ureq) {
    ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
    ContactList contactList = new ContactList(mailToName);
    contactList.addAllIdentites(identities);
    cmsg.addEmailTo(contactList);
    if (contactCtr != null) contactCtr.dispose();
    contactCtr = new ContactFormController(ureq, getWindowControl(), false, true, false, false, cmsg);
    contactCtr.addControllerListener(this);
    sendMessageVC.put("contactForm", contactCtr.getInitialComponent());
    setMainContent(sendMessageVC);
View Full Code Here

   * @return a contact form controller for this group
   */
  private ContactFormController createContactFormController(UserRequest ureq) {
    Manager scrtMngr = ManagerFactory.getManager();

    ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
    // two named ContactLists, the new way using the contact form
    // the same name as in the checkboxes are taken as contactlist names
    ContactList ownerCntctLst = new ContactList(businessGroupTranslator.translate("sendtochooser.form.chckbx.owners"));
    ContactList partipCntctLst = new ContactList(businessGroupTranslator.translate("sendtochooser.form.chckbx.partip"));
    ContactList waitingListContactList = new ContactList(businessGroupTranslator.translate("sendtochooser.form.chckbx.waitingList"));
    if (flags.isEnabled(BGConfigFlags.GROUP_OWNERS)) {
      if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) {
        SecurityGroup owners = this.currentGroup.getOwnerGroup();
        List<Identity> ownerList = scrtMngr.getIdentitiesOfSecurityGroup(owners);
        ownerCntctLst.addAllIdentites(ownerList);
        cmsg.addEmailTo(ownerCntctLst);
      } else {
        if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) {
          SecurityGroup owners = this.currentGroup.getOwnerGroup();
          List<Identity> ownerList = scrtMngr.getIdentitiesOfSecurityGroup(owners);
          for (Identity identity : new ArrayList<Identity>(ownerList)) {
            boolean keyIsSelected = false;
            for (Long key : sendToChooserForm.getSelectedOwnerKeys()) {
              if (key.equals(identity.getKey())) {
                keyIsSelected = true;
                break;
              }
            }
            if (!keyIsSelected) {
              ownerList.remove(identity);
            }
          }
          ownerCntctLst.addAllIdentites(ownerList);
          cmsg.addEmailTo(ownerCntctLst);
        }
      }
    }
    if (sendToChooserForm != null) {
      if  (sendToChooserForm.participantChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) {
        SecurityGroup participants = this.currentGroup.getPartipiciantGroup();
        List<Identity> participantsList = scrtMngr.getIdentitiesOfSecurityGroup(participants);
        partipCntctLst.addAllIdentites(participantsList);
        cmsg.addEmailTo(partipCntctLst);
      } else {
        if (sendToChooserForm.participantChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) {
          SecurityGroup participants = this.currentGroup.getPartipiciantGroup();
          List<Identity> participantsList = scrtMngr.getIdentitiesOfSecurityGroup(participants);
          for (Identity identity : new ArrayList<Identity>(participantsList)) {
            boolean keyIsSelected = false;
            for (Long key : sendToChooserForm.getSelectedPartipKeys()) {
              if (key.equals(identity.getKey())) {
                keyIsSelected = true;
                break;
              }
            }
            if (!keyIsSelected) {
              participantsList.remove(identity);
            }
          }
          partipCntctLst.addAllIdentites(participantsList);
          cmsg.addEmailTo(partipCntctLst);
        }
      }
     
    }
    if (sendToChooserForm != null && getIsGMAdminOwner(ureq) && this.currentGroup.getWaitingListEnabled().booleanValue()) {
      if (sendToChooserForm.waitingListChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) {
        SecurityGroup waitingList = this.currentGroup.getWaitingGroup();
        List<Identity> waitingListIdentities = scrtMngr.getIdentitiesOfSecurityGroup(waitingList);
        waitingListContactList.addAllIdentites(waitingListIdentities);
        cmsg.addEmailTo(waitingListContactList);
      } else {
        if (sendToChooserForm.waitingListChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) {
          SecurityGroup waitingList = this.currentGroup.getWaitingGroup();
          List<Identity> waitingListIdentities = scrtMngr.getIdentitiesOfSecurityGroup(waitingList);
          for (Identity identity : new ArrayList<Identity>(waitingListIdentities)) {
            boolean keyIsSelected = false;
            for (Long key : sendToChooserForm.getSelectedWaitingKeys()) {
              if (key.equals(identity.getKey())) {
                keyIsSelected = true;
                break;
              }
            }
            if (!keyIsSelected) {
              waitingListIdentities.remove(identity);
            }
          }
          waitingListContactList.addAllIdentites(waitingListIdentities);
          cmsg.addEmailTo(waitingListContactList);
        }
      }
    }
    String resourceUrl = JumpInManager.getJumpInUri(this.getWindowControl().getBusinessControl());
    cmsg.setSubject( businessGroupTranslator.translate("businessgroup.contact.subject", new String[]{ this.currentGroup.getName()} ) );
    cmsg.setBodyText( businessGroupTranslator.translate("businessgroup.contact.bodytext", new String[]{ this.currentGroup.getName(), resourceUrl} ) );
    CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(this.currentGroup);
    ContactFormController cofocntrllr = collabTools.createContactFormController(ureq, getWindowControl(), cmsg);
    return cofocntrllr;
  }
View Full Code Here

   * @param participants
   * @return VelocityContainer
   */
  protected VelocityContainer sendParticipantsMessage(UserRequest ureq, WindowControl wControl, DefaultController listener, String velocity_root, Translator trans, List<Identity> participants) {
    VelocityContainer sendMessageVC = new VelocityContainer("sendmessage", velocity_root + "/sendmessage.html", trans, listener);
    ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
    ContactList contactList = null;
    if(participants.size() == 1) {
      contactList = new ContactList(participants.get(0).getUser().getProperty(UserConstants.EMAIL, ureq.getLocale()));
    } else {
      contactList = new ContactList(trans.translate("participants.message.to"));
    }
    contactList.addAllIdentites(participants);
    cmsg.addEmailTo(contactList);
    ContactFormController contactCtr = new ContactFormController(ureq, wControl, false, false, false, false, cmsg);
    contactCtr.addControllerListener(listener);
    sendMessageVC.contextPut("title", trans.translate("participants.message"));
    sendMessageVC.put("contactForm", contactCtr.getInitialComponent());
   
View Full Code Here

      folderRunController = new FolderRunController(namedFolder, false, true, ureq, getWindowControl());
      listenTo(folderRunController);
      myContent.put("userinfo", folderRunController.getInitialComponent());

    } else if (menuCommand.equals(CMD_CONTACT)) {
      ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
      ContactList emailList = new ContactList(firstLastName);
      emailList.add(identity);
      cmsg.addEmailTo(emailList);
      removeAsListenerAndDispose(contactFormController);
      contactFormController = new ContactFormController(ureq, getWindowControl(), true,true,false,false,cmsg);
      listenTo(contactFormController);
      myContent.put("userinfo", contactFormController.getInitialComponent());
    } else if (menuCommand.equals(CMD_WEBLOG)) {
View Full Code Here

    notificationCmc.activate();
  }

  private void createParticipantsMail(UserRequest ureq, List<Identity> participants) {
    VelocityContainer sendMessageVC = new VelocityContainer("sendmessage", VELOCITY_ROOT + "/sendmessage.html", getTranslator(), this);
    ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
    ContactList contactList = null;
    if(participants.size() == 1) {
      contactList = new ContactList(participants.get(0).getName());
    } else {
      contactList = new ContactList(translate("participants.message.to"));
    }
    contactList.addAllIdentites(participants);
    cmsg.addEmailTo(contactList);
    contactCtr = new ContactFormController(ureq, getWindowControl(), false, false, false, false, cmsg);
    contactCtr.addControllerListener(this);
    sendMessageVC.contextPut("title", translate("participants.message"));
    sendMessageVC.put("contactForm", contactCtr.getInitialComponent());
    notificationCmc = new CloseableModalController(getWindowControl(), "close", sendMessageVC);
View Full Code Here

        for (int i = tmpIdent.size() - 1; i >= 0; i--) {
          caretaker.add((Identity) tmpIdent.get(i));
        }
       
        //create e-mail Message
        ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
        cmsg.addEmailTo(caretaker);
        removeAsListenerAndDispose(cfc);
        cfc = new ContactFormController(ureq, getWindowControl(), false, true, false, false, cmsg);
        listenTo(cfc);
        // open form in dialog
        removeAsListenerAndDispose(cmc);
View Full Code Here

  private String createReferenceesMsg(UserRequest ureq) {
    /*
     * problems: A tries to reference this test, after test editor has been
     * started
     */
    changeEmail = new ContactMessage(ureq.getIdentity());

    RepositoryManager rm = RepositoryManager.getInstance();
    // the owners of this qtiPkg
    RepositoryEntry myEntry = rm.lookupRepositoryEntry(qtiPackage.getRepresentingResourceable(), false);
    SecurityGroup qtiPkgOwners = myEntry.getOwnerGroup();
View Full Code Here

TOP

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

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.