Search in sources :

Example 1 with DialogElement

use of org.olat.course.nodes.dialog.DialogElement in project OpenOLAT by OpenOLAT.

the class DialogElementListEditController method doDelete.

private void doDelete(DialogElementRow rowToDelete) {
    DialogElement elementToDelete = dialogElementsManager.getDialogElementByKey(rowToDelete.getDialogElementKey());
    // archive data to personal folder
    File exportDir = CourseFactory.getOrCreateDataExportDirectory(getIdentity(), courseNode.getShortTitle());
    courseNode.doArchiveElement(elementToDelete, exportDir, getLocale());
    dialogElementsManager.deleteDialogElement(elementToDelete);
    // do logging
    ThreadLocalUserActivityLogger.log(CourseLoggingAction.DIALOG_ELEMENT_FILE_DELETED, getClass(), LoggingResourceable.wrapUploadFile(elementToDelete.getFilename()));
}
Also used : DialogElement(org.olat.course.nodes.dialog.DialogElement) File(java.io.File)

Example 2 with DialogElement

use of org.olat.course.nodes.dialog.DialogElement in project OpenOLAT by OpenOLAT.

the class DialogElementsManagerImpl method deleteDialogElement.

@Override
public void deleteDialogElement(DialogElement element) {
    Forum forum = element.getForum();
    DialogElement reloadedElement = dbInstance.getCurrentEntityManager().getReference(DialogElementImpl.class, element.getKey());
    dbInstance.getCurrentEntityManager().remove(reloadedElement);
    forumManager.deleteForum(forum.getKey());
}
Also used : DialogElement(org.olat.course.nodes.dialog.DialogElement) Forum(org.olat.modules.fo.Forum)

Example 3 with DialogElement

use of org.olat.course.nodes.dialog.DialogElement in project OpenOLAT by OpenOLAT.

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 4 with DialogElement

use of org.olat.course.nodes.dialog.DialogElement in project OpenOLAT by OpenOLAT.

the class DialogCourseNode method cleanupOnDelete.

/**
 * life cycle of node data e.g properties stuff should be deleted if node gets
 * deleted life cycle: create - delete - migrate
 */
@Override
public void cleanupOnDelete(ICourse course) {
    super.cleanupOnDelete(course);
    DialogElementsManager depm = CoreSpringFactory.getImpl(DialogElementsManager.class);
    RepositoryEntry entry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
    List<DialogElement> dialogElements = depm.getDialogElements(entry, getIdent());
    for (DialogElement dialogElement : dialogElements) {
        Long forumKey = dialogElement.getForum().getKey();
        SubscriptionContext subsContext = CourseModule.createSubscriptionContext(course.getCourseEnvironment(), this, forumKey.toString());
        NotificationsManager.getInstance().delete(subsContext);
        depm.deleteDialogElement(dialogElement);
    }
}
Also used : DialogElement(org.olat.course.nodes.dialog.DialogElement) RepositoryEntry(org.olat.repository.RepositoryEntry) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) DialogElementsManager(org.olat.course.nodes.dialog.DialogElementsManager)

Example 5 with DialogElement

use of org.olat.course.nodes.dialog.DialogElement in project OpenOLAT by OpenOLAT.

the class DialogElementListController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == tableEl) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            DialogElementRow row = tableModel.getObject(se.getIndex());
            if ("forum".equals(se.getCommand())) {
                fireEvent(ureq, new SelectRowEvent(row));
            } else if ("delete".equals(se.getCommand())) {
                doConfirmDelete(ureq, row);
            }
        }
    } else if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        String cmd = link.getCmd();
        if ("download".equals(cmd)) {
            doFileDelivery(ureq, (DialogElement) link.getUserObject());
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) DialogElement(org.olat.course.nodes.dialog.DialogElement) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

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