use of org.olat.course.nodes.WikiCourseNode in project OpenOLAT by OpenOLAT.
the class ArchiverMainController method launchArchiveControllers.
private void launchArchiveControllers(UserRequest ureq, String menuCommand) {
if (menuCommand.equals(CMD_INDEX)) {
main.setContent(intro);
} else {
removeAsListenerAndDispose(contentCtr);
if (menuCommand.equals(CMD_QTISURVRESULTS)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new IQSURVCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_QTITESTRESULTS)) {
contentCtr = new TestArchiveController(ureq, getWindowControl(), ores, new IQTESTCourseNode(), new IQSELFCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_SCOREACCOUNTING)) {
contentCtr = new ScoreAccountingArchiveController(ureq, getWindowControl(), ores);
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_ARCHIVELOGFILES)) {
contentCtr = new CourseLogsArchiveController(ureq, getWindowControl(), ores);
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_HANDEDINTASKS)) {
// TACourseNode
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new TACourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_GROUPTASKS)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new GTACourseNode(), new GTACourseNode(GTACourseNode.TYPE_INDIVIDUAL));
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_PROJECTBROKER)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new ProjectBrokerCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_FORUMS)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new FOCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_DIALOGS)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new DialogCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_WIKIS)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new WikiCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_SCORM)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new ScormCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_CHECKLIST)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new CheckListCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_PARTICIPANTFOLDER)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new PFCourseNode());
main.setContent(contentCtr.getInitialComponent());
}
listenTo(contentCtr);
}
}
use of org.olat.course.nodes.WikiCourseNode in project openolat by klemens.
the class ArchiverMainController method launchArchiveControllers.
private void launchArchiveControllers(UserRequest ureq, String menuCommand) {
if (menuCommand.equals(CMD_INDEX)) {
main.setContent(intro);
} else {
removeAsListenerAndDispose(contentCtr);
if (menuCommand.equals(CMD_QTISURVRESULTS)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new IQSURVCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_QTITESTRESULTS)) {
contentCtr = new TestArchiveController(ureq, getWindowControl(), ores, new IQTESTCourseNode(), new IQSELFCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_SCOREACCOUNTING)) {
contentCtr = new ScoreAccountingArchiveController(ureq, getWindowControl(), ores);
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_ARCHIVELOGFILES)) {
contentCtr = new CourseLogsArchiveController(ureq, getWindowControl(), ores);
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_HANDEDINTASKS)) {
// TACourseNode
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new TACourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_GROUPTASKS)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new GTACourseNode(), new GTACourseNode(GTACourseNode.TYPE_INDIVIDUAL));
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_PROJECTBROKER)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new ProjectBrokerCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_FORUMS)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new FOCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_DIALOGS)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new DialogCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_WIKIS)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new WikiCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_SCORM)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new ScormCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_CHECKLIST)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new CheckListCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_PARTICIPANTFOLDER)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new PFCourseNode());
main.setContent(contentCtr.getInitialComponent());
}
listenTo(contentCtr);
}
}
use of org.olat.course.nodes.WikiCourseNode in project OpenOLAT by OpenOLAT.
the class WikiPageChangeOrCreateNotificationHandler method createSubscriptionInfo.
/**
* @see org.olat.core.commons.services.notifications.NotificationsHandler#createSubscriptionInfo(org.olat.core.commons.services.notifications.Subscriber,
* java.util.Locale, java.util.Date)
*/
@Override
public SubscriptionInfo createSubscriptionInfo(Subscriber subscriber, final Locale locale, Date compareDate) {
Publisher p = subscriber.getPublisher();
final Date latestNews = p.getLatestNewsDate();
Long resId = p.getResId();
SubscriptionInfo si;
final boolean debug = log.isDebug();
// there could be news for me, investigate deeper
if (debug)
log.debug("compareDate=" + compareDate + " ; latestNews=" + latestNews, null);
try {
if (NotificationsManager.getInstance().isPublisherValid(p) && compareDate.before(latestNews)) {
OLATResourceable ores = null;
if (p.getResName().equals(CourseModule.getCourseTypeName())) {
// resId = CourseResourceableId p.getSubidentifier() = wikiCourseNode.getIdent()
ICourse course = CourseFactory.loadCourse(resId);
if (!courseStatus(course)) {
return NotificationsManager.getInstance().getNoSubscriptionInfo();
}
CourseEnvironment cenv = course.getCourseEnvironment();
CourseNode courseNode = cenv.getRunStructure().getNode(p.getSubidentifier());
if (courseNode == null) {
// OLAT-3356 because removing wikicoursenodes was not propagated to
// disable subcriptions, we may end up here with a NULL wikicoursenode
// Best we can do here -> return noSubsInfo and clean up
NotificationsManager.getInstance().deactivate(p);
// return nothing available
return NotificationsManager.getInstance().getNoSubscriptionInfo();
}
ModuleConfiguration config = ((WikiCourseNode) courseNode).getModuleConfiguration();
RepositoryEntry re = WikiEditController.getWikiRepoReference(config, true);
resId = re.getOlatResource().getResourceableId();
if (debug)
log.debug("resId=" + resId, null);
ores = OresHelper.createOLATResourceableInstance(WikiResource.TYPE_NAME, resId);
businessControlString = p.getBusinessPath() + "[path=";
} else {
// resName = 'BusinessGroup' or 'FileResource.WIKI'
if (debug)
log.debug("p.getResName()=" + p.getResName(), null);
ores = OresHelper.createOLATResourceableInstance(p.getResName(), resId);
businessControlString = p.getBusinessPath() + "[path=";
}
Wiki wiki = WikiManager.getInstance().getOrLoadWiki(ores);
final List<WikiPage> pages = wiki.getPagesByDate();
Translator translator = Util.createPackageTranslator(WikiPageChangeOrCreateNotificationHandler.class, locale);
Translator forumTranslator = Util.createPackageTranslator(ForumNotificationsHandler.class, locale);
TitleItem title = getTitleItem(p, translator);
si = new SubscriptionInfo(subscriber.getKey(), p.getType(), title, null);
for (Iterator<WikiPage> it = pages.listIterator(); it.hasNext(); ) {
WikiPage element = it.next();
// do only show entries newer then the ones already seen
Date modDate = new Date(element.getModificationTime());
if (debug)
log.debug("modDate=" + modDate + " ; compareDate=" + compareDate, null);
if (modDate.after(compareDate)) {
if ((element.getPageName().startsWith("O_") || element.getPageName().startsWith(WikiPage.WIKI_MENU_PAGE)) && (element.getModifyAuthor() <= 0)) {
// theses pages are created sometimes automatically. Check if this is the case
continue;
}
// build Businesscontrol-Path
String businessPath = null;
String urlToSend = null;
if (p.getBusinessPath() != null) {
businessPath = businessControlString + element.getPageName() + "]";
urlToSend = BusinessControlFactory.getInstance().getURLFromBusinessPathString(businessPath);
}
// string[] gets filled into translation key by adding {0...n} to
// the string
Identity ident = BaseSecurityManager.getInstance().loadIdentityByKey(Long.valueOf(element.getModifyAuthor()));
String desc = translator.translate("notifications.entry", new String[] { element.getPageName(), NotificationHelper.getFormatedName(ident) });
SubscriptionListItem subListItem = new SubscriptionListItem(desc, urlToSend, businessPath, modDate, CSS_CLASS_WIKI_PAGE_CHANGED_ICON);
si.addSubscriptionListItem(subListItem);
}
long forumKey = element.getForumKey();
List<Message> mInfos = ForumManager.getInstance().getNewMessageInfo(forumKey, compareDate);
for (Message mInfo : mInfos) {
String messageTitle = mInfo.getTitle();
Identity creator = mInfo.getCreator();
Identity modifier = mInfo.getModifier();
Date messageModDate = mInfo.getLastModified();
String name;
if (modifier != null) {
name = NotificationHelper.getFormatedName(modifier);
} else {
name = NotificationHelper.getFormatedName(creator);
}
final String descKey = "notifications.entry" + (mInfo.getCreationDate().equals(messageModDate) ? "" : ".modified");
final String desc = forumTranslator.translate(descKey, new String[] { messageTitle, name });
String urlToSend = null;
String businessPath = null;
if (p.getBusinessPath() != null) {
businessPath = businessControlString + element.getPageName() + "][message:" + mInfo.getKey().toString() + "]";
urlToSend = BusinessControlFactory.getInstance().getURLFromBusinessPathString(businessPath);
}
SubscriptionListItem subListItem = new SubscriptionListItem(desc, urlToSend, businessPath, messageModDate, CSS_CLASS_WIKI_PAGE_CHANGED_ICON);
si.addSubscriptionListItem(subListItem);
}
}
} else {
// no news
si = NotificationsManager.getInstance().getNoSubscriptionInfo();
}
} catch (Exception e) {
log.error("Error creating wiki's notifications for subscriber: " + subscriber.getKey(), e);
checkPublisher(p);
si = NotificationsManager.getInstance().getNoSubscriptionInfo();
}
return si;
}
use of org.olat.course.nodes.WikiCourseNode in project openolat by klemens.
the class WikiPageChangeOrCreateNotificationHandler method createSubscriptionInfo.
/**
* @see org.olat.core.commons.services.notifications.NotificationsHandler#createSubscriptionInfo(org.olat.core.commons.services.notifications.Subscriber,
* java.util.Locale, java.util.Date)
*/
@Override
public SubscriptionInfo createSubscriptionInfo(Subscriber subscriber, final Locale locale, Date compareDate) {
Publisher p = subscriber.getPublisher();
final Date latestNews = p.getLatestNewsDate();
Long resId = p.getResId();
SubscriptionInfo si;
final boolean debug = log.isDebug();
// there could be news for me, investigate deeper
if (debug)
log.debug("compareDate=" + compareDate + " ; latestNews=" + latestNews, null);
try {
if (NotificationsManager.getInstance().isPublisherValid(p) && compareDate.before(latestNews)) {
OLATResourceable ores = null;
if (p.getResName().equals(CourseModule.getCourseTypeName())) {
// resId = CourseResourceableId p.getSubidentifier() = wikiCourseNode.getIdent()
ICourse course = CourseFactory.loadCourse(resId);
if (!courseStatus(course)) {
return NotificationsManager.getInstance().getNoSubscriptionInfo();
}
CourseEnvironment cenv = course.getCourseEnvironment();
CourseNode courseNode = cenv.getRunStructure().getNode(p.getSubidentifier());
if (courseNode == null) {
// OLAT-3356 because removing wikicoursenodes was not propagated to
// disable subcriptions, we may end up here with a NULL wikicoursenode
// Best we can do here -> return noSubsInfo and clean up
NotificationsManager.getInstance().deactivate(p);
// return nothing available
return NotificationsManager.getInstance().getNoSubscriptionInfo();
}
ModuleConfiguration config = ((WikiCourseNode) courseNode).getModuleConfiguration();
RepositoryEntry re = WikiEditController.getWikiRepoReference(config, true);
resId = re.getOlatResource().getResourceableId();
if (debug)
log.debug("resId=" + resId, null);
ores = OresHelper.createOLATResourceableInstance(WikiResource.TYPE_NAME, resId);
businessControlString = p.getBusinessPath() + "[path=";
} else {
// resName = 'BusinessGroup' or 'FileResource.WIKI'
if (debug)
log.debug("p.getResName()=" + p.getResName(), null);
ores = OresHelper.createOLATResourceableInstance(p.getResName(), resId);
businessControlString = p.getBusinessPath() + "[path=";
}
Wiki wiki = WikiManager.getInstance().getOrLoadWiki(ores);
final List<WikiPage> pages = wiki.getPagesByDate();
Translator translator = Util.createPackageTranslator(WikiPageChangeOrCreateNotificationHandler.class, locale);
Translator forumTranslator = Util.createPackageTranslator(ForumNotificationsHandler.class, locale);
TitleItem title = getTitleItem(p, translator);
si = new SubscriptionInfo(subscriber.getKey(), p.getType(), title, null);
for (Iterator<WikiPage> it = pages.listIterator(); it.hasNext(); ) {
WikiPage element = it.next();
// do only show entries newer then the ones already seen
Date modDate = new Date(element.getModificationTime());
if (debug)
log.debug("modDate=" + modDate + " ; compareDate=" + compareDate, null);
if (modDate.after(compareDate)) {
if ((element.getPageName().startsWith("O_") || element.getPageName().startsWith(WikiPage.WIKI_MENU_PAGE)) && (element.getModifyAuthor() <= 0)) {
// theses pages are created sometimes automatically. Check if this is the case
continue;
}
// build Businesscontrol-Path
String businessPath = null;
String urlToSend = null;
if (p.getBusinessPath() != null) {
businessPath = businessControlString + element.getPageName() + "]";
urlToSend = BusinessControlFactory.getInstance().getURLFromBusinessPathString(businessPath);
}
// string[] gets filled into translation key by adding {0...n} to
// the string
Identity ident = BaseSecurityManager.getInstance().loadIdentityByKey(Long.valueOf(element.getModifyAuthor()));
String desc = translator.translate("notifications.entry", new String[] { element.getPageName(), NotificationHelper.getFormatedName(ident) });
SubscriptionListItem subListItem = new SubscriptionListItem(desc, urlToSend, businessPath, modDate, CSS_CLASS_WIKI_PAGE_CHANGED_ICON);
si.addSubscriptionListItem(subListItem);
}
long forumKey = element.getForumKey();
List<Message> mInfos = ForumManager.getInstance().getNewMessageInfo(forumKey, compareDate);
for (Message mInfo : mInfos) {
String messageTitle = mInfo.getTitle();
Identity creator = mInfo.getCreator();
Identity modifier = mInfo.getModifier();
Date messageModDate = mInfo.getLastModified();
String name;
if (modifier != null) {
name = NotificationHelper.getFormatedName(modifier);
} else {
name = NotificationHelper.getFormatedName(creator);
}
final String descKey = "notifications.entry" + (mInfo.getCreationDate().equals(messageModDate) ? "" : ".modified");
final String desc = forumTranslator.translate(descKey, new String[] { messageTitle, name });
String urlToSend = null;
String businessPath = null;
if (p.getBusinessPath() != null) {
businessPath = businessControlString + element.getPageName() + "][message:" + mInfo.getKey().toString() + "]";
urlToSend = BusinessControlFactory.getInstance().getURLFromBusinessPathString(businessPath);
}
SubscriptionListItem subListItem = new SubscriptionListItem(desc, urlToSend, businessPath, messageModDate, CSS_CLASS_WIKI_PAGE_CHANGED_ICON);
si.addSubscriptionListItem(subListItem);
}
}
} else {
// no news
si = NotificationsManager.getInstance().getNoSubscriptionInfo();
}
} catch (Exception e) {
log.error("Error creating wiki's notifications for subscriber: " + subscriber.getKey(), e);
checkPublisher(p);
si = NotificationsManager.getInstance().getNoSubscriptionInfo();
}
return si;
}
Aggregations