Package org.olat.core.util.notifications

Examples of org.olat.core.util.notifications.NotificationsManager


        translate("form.fontsize.presentation") };
    fontsize = uifactory.addDropdownSingleselect("form.fontsize", formLayout, cssFontsizeKeys, cssFontsizeValues, null);
    fontsize.select(prefs.getFontsize(), true);

    // Email notification interval
    NotificationsManager nMgr = NotificationsManager.getInstance();
    List<String> intervals = nMgr.getNotificationIntervals();
    if (intervals.size() > 0) {
      String[] intervalKeys = new String[intervals.size()];
      intervals.toArray(intervalKeys);
      String[] intervalValues = new String[intervalKeys.length];
      String i18nPrefix = "interval.";
View Full Code Here


   */
  void updateSubscriptionsDataModel() {
    // Load subscriptions from DB. Don't use the ureq.getIdentity() but the
    // subscriberIdentity instead to make this controller also be usable in the
    // admin environment (admins might change notifications for a user)
    NotificationsManager man = NotificationsManager.getInstance();
    List<Subscriber> subs = man.getSubscribers(subscriberIdentity);
    for(Iterator<Subscriber> subIt=subs.iterator(); subIt.hasNext(); ) {
      Subscriber sub = subIt.next();
      if(!man.isPublisherValid(sub.getPublisher())) {
        subIt.remove();
      }
    }
   
    subscriptionsTableModel.setObjects(subs);
View Full Code Here

    // 3) delete the group
    currBusinessGroup = bgm.loadBusinessGroup(currBusinessGroup);
   
    //change state of publisher so that notifications of deleted group calendars make no problems
    CalendarManager calMan = CalendarManagerFactory.getInstance().getCalendarManager();
    NotificationsManager nfm = NotificationsManager.getInstance();
    KalendarRenderWrapper calRenderWrapper = calMan.getGroupCalendar(currBusinessGroup);
    SubscriptionProvider subProvider = new SubscriptionProviderImpl(calRenderWrapper);
    SubscriptionContext subsContext = subProvider.getSubscriptionContext();
    Publisher pub = nfm.getPublisher(subsContext);
    if (pub != null) {
      pub.setState(1); //int 0 is OK -> all other is not OK
    }
   
    bgm.deleteBusinessGroupWithMail(currBusinessGroup, getWindowControl(), ureq, getTranslator(), everybody);
View Full Code Here

  public void archiveGroups(BGContext context, File exportFile) {
    BusinessGroupArchiver.getInstance().archiveBGContext(context, exportFile);   
  }
 
  private void removeSubscriptions(Identity identity, BusinessGroup group) {
    NotificationsManager notiMgr = NotificationsManager.getInstance();
    List<Subscriber> l = notiMgr.getSubscribers(identity);
    for (Iterator iterator = l.iterator(); iterator.hasNext();) {
      Subscriber subscriber = (Subscriber) iterator.next();
      Long resId = subscriber.getPublisher().getResId();
      Long groupKey = group.getKey();
      if (resId != null && groupKey != null && resId.equals(groupKey)) {
        notiMgr.unsubscribe(subscriber);
      }
    }
  }
View Full Code Here

  /**
   * @return Returns the notificationInterval.
   */
  public String getNotificationInterval() {
    // Always return a valid notification interval
    NotificationsManager notiMgr = NotificationsManager.getInstance();
    if (notificationInterval == null || notificationInterval.isEmpty()
        || !notiMgr.getNotificationIntervals().contains(notificationInterval)) {
      notificationInterval = notiMgr.getDefaultNotificationInterval();
    }
    return notificationInterval;
  }
View Full Code Here

   */
  NotificationNewsController(Identity subscriberIdentity, UserRequest ureq, WindowControl wControl, Date newsSinceDate) {
    super(ureq, wControl);
    this.subscriberIdentity = subscriberIdentity;
    if (newsSinceDate == null) {
      NotificationsManager man = NotificationsManager.getInstance();
      compareDate = man.getCompareDateFromInterval(man.getUserIntervalOrDefault(ureq.getIdentity()));
    } else {
      compareDate = newsSinceDate;
    }
    // Main view is a velocity container
    newsVC = createVelocityContainer("notificationsNews");
View Full Code Here

  /**
   * Update the new data model and refresh the GUI
   */
  void updateNewsDataModel() {
    NotificationsManager man = NotificationsManager.getInstance();
    List<Subscriber> subs = man.getSubscribers(subscriberIdentity);
    newsVC.contextPut("subs", subs);
    subsInfoMap = NotificationHelper.getSubscriptionMap(getIdentity(), getLocale(), true, compareDate);
    NotificationSubscriptionAndNewsFormatter subsFormatter = new NotificationSubscriptionAndNewsFormatter(getTranslator(), subsInfoMap);
    newsVC.contextPut("subsFormatter", subsFormatter);
  }
View Full Code Here

   */
  @Override
  protected void event(UserRequest ureq, Component source, Event event) {
    if (source == emailLink) {
      // send email to user with the currently visible date
      NotificationsManager man = NotificationsManager.getInstance();
      List<SubscriptionItem> infoList = new ArrayList<SubscriptionItem>();
      List<Subscriber> subsList = new ArrayList<Subscriber>();
      for (Subscriber subscriber : subsInfoMap.keySet()) {
        subsList.add(subscriber);
        SubscriptionItem item = man.createSubscriptionItem(subscriber, getLocale(), SubscriptionInfo.MIME_PLAIN, SubscriptionInfo.MIME_PLAIN, compareDate);
        if(item != null) {
          infoList.add(item);
        }
      }
      if (man.sendMailToUserAndUpdateSubscriber(subscriberIdentity, infoList, getTranslator(), subsList)) {
        showInfo("email.ok");
      } else {
        showError("email.nok");       
      }
    }
View Full Code Here

    SubscriptionInfo subsInfo = subsInfoMap.get(sub);
    return subsInfo.getCustomUrl();
  }

  public SubscriptionItem getSubscriptionItem(Subscriber sub) {
    NotificationsManager notiMgr = NotificationsManager.getInstance();
    SubscriptionItem subscrItem = notiMgr.createSubscriptionItem(sub, translator.getLocale(), SubscriptionInfo.MIME_HTML, SubscriptionInfo.MIME_HTML);
    return subscrItem;   
  }
View Full Code Here

   * @param windowControl
   * @return
   */
  public static NotificationSubscriptionAndNewsController createCombinedSubscriptionsAndNewsController(Identity subscriberIdentity,
      UserRequest ureq, WindowControl windowControl) {
    NotificationsManager notiMgr = NotificationsManager.getInstance();
    // default use the interval
    Date compareDate = notiMgr.getCompareDateFromInterval(notiMgr.getUserIntervalOrDefault(ureq.getIdentity()));
    return new NotificationSubscriptionAndNewsController(subscriberIdentity, ureq, windowControl, compareDate);
  }
View Full Code Here

TOP

Related Classes of org.olat.core.util.notifications.NotificationsManager

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.