Search in sources :

Example 11 with DialogElement

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);
}
Also used : DownloadLink(org.olat.core.gui.components.form.flexible.elements.DownloadLink) VFSLeaf(org.olat.core.util.vfs.VFSLeaf) ArrayList(java.util.ArrayList) DialogElement(org.olat.course.nodes.dialog.DialogElement) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 12 with DialogElement

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);
}
Also used : DownloadLink(org.olat.core.gui.components.form.flexible.elements.DownloadLink) VFSLeaf(org.olat.core.util.vfs.VFSLeaf) ArrayList(java.util.ArrayList) DialogElement(org.olat.course.nodes.dialog.DialogElement)

Example 13 with DialogElement

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;
}
Also used : DialogElement(org.olat.course.nodes.dialog.DialogElement) RepositoryEntry(org.olat.repository.RepositoryEntry) DialogElementsManager(org.olat.course.nodes.dialog.DialogElementsManager)

Example 14 with DialogElement

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);
    }
}
Also used : SearchResourceContext(org.olat.search.service.SearchResourceContext) DialogElement(org.olat.course.nodes.dialog.DialogElement) RepositoryEntry(org.olat.repository.RepositoryEntry) Document(org.apache.lucene.document.Document) ForumMessageDocument(org.olat.search.service.document.ForumMessageDocument) CourseNodeDocument(org.olat.search.service.document.CourseNodeDocument) DialogElementsManager(org.olat.course.nodes.dialog.DialogElementsManager) Forum(org.olat.modules.fo.Forum)

Example 15 with DialogElement

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());
}
Also used : DialogElement(org.olat.course.nodes.dialog.DialogElement) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) Forum(org.olat.modules.fo.Forum) Test(org.junit.Test)

Aggregations

DialogElement (org.olat.course.nodes.dialog.DialogElement)36 RepositoryEntry (org.olat.repository.RepositoryEntry)14 Identity (org.olat.core.id.Identity)6 VFSContainer (org.olat.core.util.vfs.VFSContainer)6 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)6 DialogElementsManager (org.olat.course.nodes.dialog.DialogElementsManager)6 Forum (org.olat.modules.fo.Forum)6 File (java.io.File)4 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)4 DownloadLink (org.olat.core.gui.components.form.flexible.elements.DownloadLink)4 Date (java.util.Date)2 Document (org.apache.lucene.document.Document)2 Publisher (org.olat.core.commons.services.notifications.Publisher)2 SubscriptionInfo (org.olat.core.commons.services.notifications.SubscriptionInfo)2 SubscriptionListItem (org.olat.core.commons.services.notifications.model.SubscriptionListItem)2 TitleItem (org.olat.core.commons.services.notifications.model.TitleItem)2 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)2 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)2