use of org.olat.course.nodes.dialog.DialogElement in project openolat by klemens.
the class DialogElementListController method loadModel.
protected void loadModel() {
RepositoryEntry entry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
List<DialogElement> elements = dialogElementsManager.getDialogElements(entry, courseNode.getIdent());
List<DialogElementRow> rows = new ArrayList<>(elements.size());
for (DialogElement element : elements) {
DialogElementRow row = new DialogElementRow(element, userPropertyHandlers, getLocale());
int msgCount = forumManager.countMessagesByForumID(element.getForum().getKey());
int newMsg = msgCount - forumManager.countReadMessagesByUserAndForum(getIdentity(), element.getForum().getKey());
row.setNumOfMessages(msgCount);
row.setNumOfUnreadMessages(newMsg);
VFSLeaf item = dialogElementsManager.getDialogLeaf(element);
if (item != null) {
DownloadLink downloadLink = uifactory.addDownloadLink("file_" + (++counter), row.getFilename(), null, item, flc);
row.setDownloadLink(downloadLink);
}
rows.add(row);
}
tableModel.setObjects(rows);
tableEl.reset(true, true, true);
}
use of org.olat.course.nodes.dialog.DialogElement in project openolat by klemens.
the class DialogElementListEditController method loadModel.
protected void loadModel() {
List<DialogElement> elements = dialogElementsManager.getDialogElements(entry, courseNode.getIdent());
List<DialogElementRow> rows = new ArrayList<>(elements.size());
for (DialogElement element : elements) {
DialogElementRow row = new DialogElementRow(element, userPropertyHandlers, getLocale());
VFSLeaf item = dialogElementsManager.getDialogLeaf(element);
if (item != null) {
DownloadLink downloadLink = uifactory.addDownloadLink("file_" + (++counter), row.getFilename(), null, item, flc);
row.setDownloadLink(downloadLink);
}
rows.add(row);
}
tableModel.setObjects(rows);
tableEl.reset(true, true, true);
}
use of org.olat.course.nodes.dialog.DialogElement in project openolat by klemens.
the class DialogCourseNode method archiveNodeData.
@Override
public boolean archiveNodeData(Locale locale, ICourse course, ArchiveOptions options, ZipOutputStream exportStream, String charset) {
boolean dataFound = false;
RepositoryEntry entry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
List<DialogElement> list = CoreSpringFactory.getImpl(DialogElementsManager.class).getDialogElements(entry, getIdent());
if (list.size() > 0) {
for (DialogElement element : list) {
doArchiveElement(element, exportStream, locale);
dataFound = true;
}
}
return dataFound;
}
use of org.olat.course.nodes.dialog.DialogElement in project OpenOLAT by OpenOLAT.
the class DialogCourseNodeIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext repositoryResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
SearchResourceContext courseNodeResourceContext = createSearchResourceContext(repositoryResourceContext, courseNode, null);
Document document = CourseNodeDocument.createDocument(courseNodeResourceContext, courseNode);
indexWriter.addDocument(document);
RepositoryEntry entry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
DialogElementsManager dialogElmsMgr = CoreSpringFactory.getImpl(DialogElementsManager.class);
List<DialogElement> elements = dialogElmsMgr.getDialogElements(entry, courseNode.getIdent());
for (DialogElement element : elements) {
Forum forum = element.getForum();
doIndexAllMessages(courseNodeResourceContext, forum, indexWriter);
doIndexFile(element, courseNodeResourceContext, indexWriter);
}
}
use of org.olat.course.nodes.dialog.DialogElement in project OpenOLAT by OpenOLAT.
the class DialogElementsManagerTest method getDialogElementByForumKey.
@Test
public void getDialogElementByForumKey() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
Identity author = JunitTestHelper.createAndPersistIdentityAsRndUser("session-1");
String subIdent = UUID.randomUUID().toString();
DialogElement element = dialogElementsManager.createDialogElement(entry, author, "task_e.txt", 235l, subIdent);
dbInstance.commitAndCloseSession();
Forum forum = element.getForum();
DialogElement loadedElement = dialogElementsManager.getDialogElementByForum(forum.getKey());
Assert.assertNotNull(loadedElement.getKey());
Assert.assertEquals(forum, loadedElement.getForum());
Assert.assertEquals(author, loadedElement.getAuthor());
Assert.assertEquals("task_e.txt", loadedElement.getFilename());
Assert.assertEquals(Long.valueOf(235l), loadedElement.getSize());
Assert.assertEquals(subIdent, loadedElement.getSubIdent());
Assert.assertEquals(entry, loadedElement.getEntry());
}
Aggregations