use of org.olat.modules.wiki.WikiPage in project OpenOLAT by OpenOLAT.
the class WikiArtefactHandler method prefillArtefactAccordingToSource.
/**
* @see org.olat.portfolio.EPAbstractHandler#prefillArtefactAccordingToSource(org.olat.portfolio.model.artefacts.AbstractArtefact, java.lang.Object)
*/
@Override
public void prefillArtefactAccordingToSource(AbstractArtefact artefact, Object source) {
super.prefillArtefactAccordingToSource(artefact, source);
WikiPage page = null;
OLATResourceable ores = null;
if (source instanceof OLATResourceable) {
ores = (OLATResourceable) source;
// fxdiff: FXOLAT-148 a wiki from a businessgroup needs to be wrapped accordingly!
if (artefact.getBusinessPath().contains(BusinessGroup.class.getSimpleName())) {
ores = OresHelper.createOLATResourceableInstance(BusinessGroup.class, ores.getResourceableId());
}
Wiki wiki = WikiManager.getInstance().getOrLoadWiki(ores);
String pageName = getPageName(artefact.getBusinessPath());
page = wiki.getPage(pageName, true);
} else if (source instanceof WikiPage) {
page = (WikiPage) source;
}
if (page != null) {
artefact.setSource(getSourceInfo(artefact.getBusinessPath(), ores));
artefact.setTitle(page.getPageName());
artefact.setFulltextContent(page.getContent());
artefact.setSignature(70);
}
}
use of org.olat.modules.wiki.WikiPage in project OpenOLAT by OpenOLAT.
the class WikiMediaHandler method getInformations.
@Override
public MediaInformations getInformations(Object mediaObject) {
String title = null;
if (mediaObject instanceof WikiPage) {
WikiPage page = (WikiPage) mediaObject;
title = page.getPageName();
}
return new Informations(title, null);
}
use of org.olat.modules.wiki.WikiPage in project OpenOLAT by OpenOLAT.
the class WikiMediaHandler method createMedia.
@Override
public Media createMedia(String title, String description, Object mediaObject, String businessPath, Identity author) {
String content = null;
if (mediaObject instanceof WikiPage) {
WikiPage page = (WikiPage) mediaObject;
content = page.getContent();
}
Media media = mediaDao.createMedia(title, description, content, WIKI_HANDLER, businessPath, null, 70, author);
ThreadLocalUserActivityLogger.log(PortfolioLoggingAction.PORTFOLIO_MEDIA_ADDED, getClass(), LoggingResourceable.wrap(media));
return media;
}
use of org.olat.modules.wiki.WikiPage in project OpenOLAT by OpenOLAT.
the class WikiCourseNodeIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext repositoryResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) {
String repoEntryName = "*name not available*";
try {
SearchResourceContext courseNodeResourceContext = createSearchResourceContext(repositoryResourceContext, courseNode, TYPE);
Document nodeDocument = CourseNodeDocument.createDocument(courseNodeResourceContext, courseNode);
indexWriter.addDocument(nodeDocument);
RepositoryEntry repositoryEntry = courseNode.getReferencedRepositoryEntry();
if (repositoryEntry == null)
return;
repoEntryName = repositoryEntry.getDisplayname();
Wiki wiki = WikiManager.getInstance().getOrLoadWiki(repositoryEntry.getOlatResource());
// loop over all wiki pages
List<WikiPage> wikiPageList = wiki.getAllPagesWithContent();
for (WikiPage wikiPage : wikiPageList) {
try {
courseNodeResourceContext.setFilePath(wikiPage.getPageName());
Document document = WikiPageDocument.createDocument(courseNodeResourceContext, wikiPage);
indexWriter.addDocument(document);
} catch (Exception e) {
log.error("Error indexing wiki page:" + (wikiPage == null ? "null" : wikiPage.getPageName()), e);
}
}
} catch (Exception e) {
log.error("Error indexing wiki:" + repoEntryName, e);
}
}
use of org.olat.modules.wiki.WikiPage in project openolat by klemens.
the class WikiMediaHandler method getInformations.
@Override
public MediaInformations getInformations(Object mediaObject) {
String title = null;
if (mediaObject instanceof WikiPage) {
WikiPage page = (WikiPage) mediaObject;
title = page.getPageName();
}
return new Informations(title, null);
}
Aggregations