use of org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController in project OpenOLAT by OpenOLAT.
the class EPChangelogController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
/* the subscription context + component */
if (logger.isDebug())
logger.debug("creating subscriptionContext for Map: " + map.getTitle() + ", getResourceableId: ->" + map.getResourceableId() + ", key: " + map.getKey());
subsContext = new SubscriptionContext(EPNotificationsHandler.TYPENNAME, map.getResourceableId(), EPNotificationsHandler.TYPENNAME);
if (subsContext != null) {
String businessPath = "[EPDefaultMap:" + map.getKey() + "]";
PublisherData data = new PublisherData(EPNotificationsHandler.TYPENNAME, null, businessPath);
cSubscriptionCtrl = new ContextualSubscriptionController(ureq, getWindowControl(), subsContext, data);
listenTo(cSubscriptionCtrl);
flc.put("subscription", cSubscriptionCtrl.getInitialComponent());
}
/* the datechooser */
dateChooser = uifactory.addDateChooser("dateChooser", "news.since", null, formLayout);
dateChooser.setDate(new Date());
dateChooser.addActionListener(FormEvent.ONCHANGE);
/* display the changelog */
updateChangelogDisplay();
}
use of org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController in project openolat by klemens.
the class PFCoachController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
OLATResource course = courseEnv.getCourseGroupManager().getCourseResource();
String businessPath = getWindowControl().getBusinessControl().getAsString();
SubscriptionContext subsContext = new SubscriptionContext(course, pfNode.getIdent());
PublisherData publisherData = new PublisherData(OresHelper.calculateTypeName(PFCourseNode.class), String.valueOf(course.getResourceableId()), businessPath);
contextualSubscriptionCtr = new ContextualSubscriptionController(ureq, getWindowControl(), subsContext, publisherData);
listenTo(contextualSubscriptionCtr);
layoutCont.put("contextualSubscription", contextualSubscriptionCtr.getInitialComponent());
backLink = LinkFactory.createLinkBack(layoutCont.getFormItemComponent(), this);
}
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
int i = 0;
FlexiTableSortOptions options = new FlexiTableSortOptions();
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
int colIndex = USER_PROPS_OFFSET + i++;
if (userPropertyHandler == null)
continue;
String propName = userPropertyHandler.getName();
boolean visible = userManager.isMandatoryUserProperty(USER_PROPS_ID, userPropertyHandler);
FlexiColumnModel col;
if (UserConstants.FIRSTNAME.equals(propName) || UserConstants.LASTNAME.equals(propName)) {
col = new DefaultFlexiColumnModel(userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, userPropertyHandler.getName(), true, propName, new StaticFlexiCellRenderer(userPropertyHandler.getName(), new TextFlexiCellRenderer()));
} else {
col = new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, true, propName);
}
columnsModel.addFlexiColumnModel(col);
if (!options.hasDefaultOrderBy()) {
options.setDefaultOrderBy(new SortKey(propName, true));
} else if (UserConstants.LASTNAME.equals(propName)) {
options.setDefaultOrderBy(new SortKey(propName, true));
}
}
if (pfNode.hasParticipantBoxConfigured()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.numberFiles, "drop.box"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.lastUpdate));
}
if (pfNode.hasCoachBoxConfigured()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.numberFilesReturn, "return.box"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.lastUpdateReturn));
}
StaticFlexiCellRenderer openCellRenderer = new StaticFlexiCellRenderer(translate("open.box"), "open.box");
openCellRenderer.setIconRightCSS("o_icon_start o_icon-fw");
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.openbox, "open.box", openCellRenderer));
tableModel = new DropBoxTableModel(columnsModel, getTranslator());
dropboxTable = uifactory.addTableElement(getWindowControl(), "table", tableModel, getTranslator(), formLayout);
dropboxTable.setMultiSelect(true);
dropboxTable.setSelectAllEnable(true);
dropboxTable.setExportEnabled(true);
dropboxTable.setSortSettings(options);
dropboxTable.setAndLoadPersistedPreferences(ureq, "participant-folder_coach_" + pfView.name());
dropboxTable.setEmtpyTableMessageKey("table.empty");
FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
buttonGroupLayout.setElementCssClass("o_button_group");
formLayout.add(buttonGroupLayout);
downloadLink = uifactory.addFormLink("download.link", buttonGroupLayout, Link.BUTTON);
uploadAllLink = uifactory.addFormLink("upload.link", buttonGroupLayout, Link.BUTTON);
}
use of org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController in project openolat by klemens.
the class FeedMainController method display.
/**
* Sets up the velocity container for displaying the view
*
* @param ores
* @param ureq
* @param wControl
* @param previewMode
* @param isCourseNode
*/
private void display(UserRequest ureq, WindowControl wControl, FeedItemDisplayConfig displayConfig) {
vcMain = createVelocityContainer("feed_main");
vcInfo = uiFactory.createInfoVelocityContainer(this);
vcInfo.contextPut("feed", feed);
vcInfo.contextPut("helper", helper);
if (subsContext != null) {
String businessPath = wControl.getBusinessControl().getAsString();
PublisherData data = new PublisherData(ores.getResourceableTypeName(), ores.getResourceableId().toString(), businessPath);
cSubscriptionCtrl = new ContextualSubscriptionController(ureq, getWindowControl(), subsContext, data);
listenTo(cSubscriptionCtrl);
vcInfo.put("subscription", cSubscriptionCtrl.getInitialComponent());
}
vcRightCol = uiFactory.createRightColumnVelocityContainer(this);
vcMain.put("rightColumn", vcRightCol);
RepositoryEntry repositoryEntry = repositoryManager.lookupRepositoryEntry(feed, false);
if (repositoryEntry == null && callback.mayEditMetadata()) {
editFeedButton = LinkFactory.createButtonSmall("feed.edit", vcInfo, this);
editFeedButton.setElementCssClass("o_sel_feed_edit");
}
vcInfo.contextPut("callback", callback);
displayUrlCtr = new DisplayFeedUrlController(ureq, wControl, feed, helper, uiFactory.getTranslator());
listenTo(displayUrlCtr);
vcInfo.put("feedUrlComponent", displayUrlCtr.getInitialComponent());
vcMain.put("info", vcInfo);
itemsCtr = new ItemsController(ureq, wControl, feed, helper, uiFactory, callback, vcRightCol, displayConfig);
listenTo(itemsCtr);
vcMain.put("items", itemsCtr.getInitialComponent());
putInitialPanel(vcMain);
}
use of org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController in project openolat by klemens.
the class WeeklyCalendarController method getContextualSubscriptionController.
private ContextualSubscriptionController getContextualSubscriptionController(UserRequest ureq, KalendarRenderWrapper kalendarRenderWrapper, SubscriptionContext context) {
String businessPath = getWindowControl().getBusinessControl().getAsString();
if ((caller.equals(CalendarController.CALLER_COURSE) || caller.equals(CalendarManager.TYPE_COURSE))) {
Long courseId = kalendarRenderWrapper.getLinkProvider().getControler().getCourseId();
PublisherData pdata = new PublisherData(OresHelper.calculateTypeName(CalendarManager.class), String.valueOf(courseId), businessPath);
return new ContextualSubscriptionController(ureq, getWindowControl(), context, pdata);
}
if ((caller.equals(CalendarController.CALLER_COLLAB) || caller.equals(CalendarManager.TYPE_GROUP))) {
BusinessGroup businessGroup = calendarNotificationsManager.getBusinessGroup(kalendarRenderWrapper);
if (businessGroup != null) {
PublisherData pdata = new PublisherData(OresHelper.calculateTypeName(CalendarManager.class), String.valueOf(businessGroup.getResourceableId()), businessPath);
return new ContextualSubscriptionController(ureq, getWindowControl(), context, pdata);
}
}
return null;
}
use of org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController in project OpenOLAT by OpenOLAT.
the class WeeklyCalendarController method getContextualSubscriptionController.
private ContextualSubscriptionController getContextualSubscriptionController(UserRequest ureq, KalendarRenderWrapper kalendarRenderWrapper, SubscriptionContext context) {
String businessPath = getWindowControl().getBusinessControl().getAsString();
if ((caller.equals(CalendarController.CALLER_COURSE) || caller.equals(CalendarManager.TYPE_COURSE))) {
Long courseId = kalendarRenderWrapper.getLinkProvider().getControler().getCourseId();
PublisherData pdata = new PublisherData(OresHelper.calculateTypeName(CalendarManager.class), String.valueOf(courseId), businessPath);
return new ContextualSubscriptionController(ureq, getWindowControl(), context, pdata);
}
if ((caller.equals(CalendarController.CALLER_COLLAB) || caller.equals(CalendarManager.TYPE_GROUP))) {
BusinessGroup businessGroup = calendarNotificationsManager.getBusinessGroup(kalendarRenderWrapper);
if (businessGroup != null) {
PublisherData pdata = new PublisherData(OresHelper.calculateTypeName(CalendarManager.class), String.valueOf(businessGroup.getResourceableId()), businessPath);
return new ContextualSubscriptionController(ureq, getWindowControl(), context, pdata);
}
}
return null;
}
Aggregations