public Object getValueAt(int row, int col) {
   PortletEntry<Subscriber> entry = getObject(row);
   Subscriber subscriber = entry.getValue();
   Publisher pub = subscriber.getPublisher();
   switch (col) {
     case 0:
       Object subsInfoObj = subToSubInfo.get(subscriber);
       if (subsInfoObj instanceof SubscriptionInfo) {
         SubscriptionInfo subsInfo = (SubscriptionInfo) subsInfoObj;
         int newsCount = subsInfo.countSubscriptionListItems();
         if (newsCount == 1) {
           return translate(
               "notificationsPortlet.single.news.in",
               subsInfo.getTitle(SubscriptionInfo.MIME_PLAIN));
         } else {
           return translate(
               "notificationsPortlet.multiple.news.in",
               new String[] {newsCount + "", subsInfo.getTitle(SubscriptionInfo.MIME_PLAIN)});
         }
       }
       return "";
     case 1:
       String innerType = pub.getType();
       return NewControllerFactory.translateResourceableTypeName(innerType, locale);
     default:
       return "ERROR";
   }
 }
Ejemplo n.º 2
0
 private void launch(UserRequest ureq, String businessPath) {
   if (StringHelper.containsNonWhitespace(businessPath)) {
     try {
       // make the resume secure. If something fail, don't generate a red screen
       NewControllerFactory.getInstance().launch(businessPath, ureq, getWindowControl());
     } catch (Exception e) {
       logError("Error while resuming", e);
     }
   }
 }
Ejemplo n.º 3
0
 private void launch(UserRequest ureq, BusinessControl bc) {
   if (bc == null) return;
   WindowControl bwControl =
       BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
   try {
     // make the resume secure. If something fail, don't generate a red screen
     NewControllerFactory.getInstance().launch(ureq, bwControl);
   } catch (Exception e) {
     logError("Error while resuming", e);
   }
 }
 /**
  * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
  *     org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
  */
 public void event(UserRequest ureq, Component source, Event event) {
   if (source == showAllLink) {
     // activate homes tab in top navigation and active bookmarks menu item
     String resourceUrl = "[HomeSite:" + ureq.getIdentity().getKey() + "][notifications:0]";
     BusinessControl bc = BusinessControlFactory.getInstance().createFromString(resourceUrl);
     WindowControl bwControl =
         BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
     NewControllerFactory.getInstance().launch(ureq, bwControl);
   } else if (event == ComponentUtil.VALIDATE_EVENT && needsModelReload) {
     // updateTableModel(ureq.getLocale(), ureq.getIdentity());
     reloadModel(sortingCriteria);
     needsModelReload = false;
   }
 }
Ejemplo n.º 5
0
  @Override
  protected void formOK(UserRequest ureq) {
    savePreferences(ureq, "auto");
    fireEvent(ureq, Event.DONE_EVENT);

    HistoryPoint historyEntry = historyManager.readHistoryPoint(ureq.getIdentity());
    if (historyEntry != null
        && StringHelper.containsNonWhitespace(historyEntry.getBusinessPath())) {
      List<ContextEntry> cloneCes =
          BusinessControlFactory.getInstance().cloneContextEntries(historyEntry.getEntries());
      BusinessControl bc = BusinessControlFactory.getInstance().createFromContextEntries(cloneCes);
      WindowControl bwControl =
          BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
      try {
        // make the resume secure. If something fail, don't generate a red screen
        NewControllerFactory.getInstance().launch(ureq, bwControl);
      } catch (Exception e) {
        logError("Error while resumging", e);
      }
    }
  }
 /** @see org.olat.core.gui.components.table.TableDataModel#getValueAt(int, int) */
 public final Object getValueAt(int row, int col) {
   PortletEntry<Subscriber> entry = getObject(row);
   Subscriber subscriber = entry.getValue();
   Publisher pub = subscriber.getPublisher();
   switch (col) {
     case 0:
       {
         SubscriptionInfo subsInfo = subToSubInfo.get(subscriber);
         return subsInfo.getTitle(SubscriptionInfo.MIME_PLAIN);
       }
     case 1:
       {
         SubscriptionInfo subsInfo = subToSubInfo.get(subscriber);
         if (!subsInfo.hasNews()) return "-";
         return subsInfo.getSpecificInfo(SubscriptionInfo.MIME_HTML, locale);
       }
     case 2:
       String innerType = pub.getType();
       return NewControllerFactory.translateResourceableTypeName(innerType, locale);
     default:
       return "error";
   }
 }
 public String getContainerType(Subscriber sub) {
   Publisher pub = sub.getPublisher();
   String containerType = pub.getResName();
   return NewControllerFactory.translateResourceableTypeName(
       containerType, translator.getLocale());
 }