Search in sources :

Example 1 with FolderEvent

use of org.olat.core.commons.modules.bc.FolderEvent in project OpenOLAT by OpenOLAT.

the class TaskFolderCallback method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
@Override
public void event(UserRequest urequest, Controller source, Event event) {
    if (source == modulesForm) {
        boolean onoff = event.getCommand().endsWith("true");
        if (event.getCommand().startsWith("task")) {
            config.set(TACourseNode.CONF_TASK_ENABLED, new Boolean(onoff));
            myTabbedPane.setEnabled(taskTabPosition, onoff);
            if (onoff) {
                accessabilityVC.put("taskCondition", taskConditionC.getInitialComponent());
            } else {
                accessabilityVC.remove(taskConditionC.getInitialComponent());
            }
        } else if (event.getCommand().startsWith("dropbox")) {
            config.set(TACourseNode.CONF_DROPBOX_ENABLED, new Boolean(onoff));
            myTabbedPane.setEnabled(dropboxTabPosition, onoff);
            if (onoff) {
                accessabilityVC.put("dropCondition", dropConditionC.getInitialComponent());
            } else {
                accessabilityVC.remove(dropConditionC.getInitialComponent());
            }
        } else if (event.getCommand().startsWith("returnbox")) {
            config.set(TACourseNode.CONF_RETURNBOX_ENABLED, new Boolean(onoff));
            if (onoff) {
                accessabilityVC.put("returnboxCondition", returnboxConditionC.getInitialComponent());
            } else {
                accessabilityVC.remove(returnboxConditionC.getInitialComponent());
            }
        } else if (event.getCommand().startsWith("scoring")) {
            config.set(TACourseNode.CONF_SCORING_ENABLED, new Boolean(onoff));
            myTabbedPane.setEnabled(scoringTabPosition, onoff);
            if (onoff) {
                accessabilityVC.put("scoringCondition", scoringConditionC.getInitialComponent());
            } else {
                accessabilityVC.remove(scoringConditionC.getInitialComponent());
            }
        } else if (event.getCommand().startsWith("solution")) {
            config.set(TACourseNode.CONF_SOLUTION_ENABLED, new Boolean(onoff));
            myTabbedPane.setEnabled(solutionTabPosition, onoff);
            if (onoff) {
                accessabilityVC.put("solutionCondition", solutionConditionC.getInitialComponent());
            } else {
                accessabilityVC.remove(solutionConditionC.getInitialComponent());
            }
        }
        fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        return;
    } else if (source == taskConditionC) {
        if (event == Event.CHANGED_EVENT) {
            node.setConditionTask(taskConditionC.getCondition());
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == dropConditionC) {
        if (event == Event.CHANGED_EVENT) {
            node.setConditionDrop(dropConditionC.getCondition());
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == returnboxConditionC) {
        if (event == Event.CHANGED_EVENT) {
            node.setConditionReturnbox(returnboxConditionC.getCondition());
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == scoringConditionC) {
        if (event == Event.CHANGED_EVENT) {
            node.setConditionScoring(scoringConditionC.getCondition());
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == solutionConditionC) {
        if (event == Event.CHANGED_EVENT) {
            node.setConditionSolution(solutionConditionC.getCondition());
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == dialogBoxController) {
        if (DialogBoxUIFactory.isOkEvent(event)) {
            // ok: open task folder
            String relPath = TACourseNode.getTaskFolderPathRelToFolderRoot(course, node);
            OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(relPath, null);
            OlatNamedContainerImpl namedFolder = new OlatNamedContainerImpl(translate("taskfolder"), rootFolder);
            namedFolder.setLocalSecurityCallback(getTaskFolderSecCallback(relPath));
            frc = new FolderRunController(namedFolder, false, urequest, getWindowControl());
            listenTo(frc);
            CloseableModalController cmc = new CloseableModalController(getWindowControl(), translate("folder.close"), frc.getInitialComponent());
            cmc.activate();
            fireEvent(urequest, Event.CHANGED_EVENT);
        }
    } else if (source == taskController) {
        if (event == Event.CANCELLED_EVENT) {
            return;
        } else if (event == Event.DONE_EVENT) {
            config.set(TACourseNode.CONF_TASK_TYPE, taskController.getTaskType());
            config.set(TACourseNode.CONF_TASK_TEXT, taskController.getOptionalText());
            config.set(TACourseNode.CONF_TASK_SAMPLING_WITH_REPLACEMENT, new Boolean(taskController.getIsSamplingWithReplacement()));
            config.setBooleanEntry(TACourseNode.CONF_TASK_PREVIEW, taskController.isTaskPreviewMode());
            config.setBooleanEntry(TACourseNode.CONF_TASK_DESELECT, taskController.isTaskDeselectMode());
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
            return;
        }
    } else if (source == scoringController) {
        if (event == Event.CANCELLED_EVENT) {
            if (hasLogEntries) {
                scoringController.setDisplayOnly(true);
            }
            editScoring.contextPut("isOverwriting", new Boolean(false));
            return;
        } else if (event == Event.DONE_EVENT) {
            scoringController.updateModuleConfiguration(config);
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == dropboxForm) {
        if (event == Event.CANCELLED_EVENT) {
            return;
        } else if (event == Event.DONE_EVENT) {
            config.set(TACourseNode.CONF_DROPBOX_ENABLEMAIL, new Boolean(dropboxForm.mailEnabled()));
            config.set(TACourseNode.CONF_DROPBOX_CONFIRMATION, dropboxForm.getConfirmation());
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
            return;
        }
    } else if (source == frc && (event instanceof FolderEvent) && event.getCommand().equals(FolderEvent.DELETE_EVENT)) {
        String deletedTaskFile = getFileListAsComaSeparated(((FolderEvent) event).getFilename());
        // cancel task assignment
        identitiesToBeNotified = removeAssignedTask(course, deletedTaskFile);
        if (identitiesToBeNotified.size() > 0) {
            // prepare mailTemplate if they are any identities to be notified
            removeAsListenerAndDispose(mailCtr);
            RepositoryEntry repositoryEntry = RepositoryManager.getInstance().lookupRepositoryEntry(course, true);
            String courseURL = Settings.getServerContextPathURI() + "/url/RepositoryEntry/" + repositoryEntry.getKey();
            MailTemplate mailTemplate = this.createTaskDeletedMailTemplate(urequest, course.getCourseTitle(), courseURL, deletedTaskFile);
            mailCtr = new MailNotificationEditController(getWindowControl(), urequest, mailTemplate, true, false, true);
            listenTo(mailCtr);
            cmc = new CloseableModalController(getWindowControl(), translate("close"), mailCtr.getInitialComponent());
            listenTo(cmc);
            cmc.activate();
        }
    } else if (source == mailCtr) {
        if (event == Event.DONE_EVENT) {
            cmc.deactivate();
            if (identitiesToBeNotified != null && identitiesToBeNotified.size() > 0) {
                // sent email to all identities that used to have the deleted task assigned
                sendNotificationEmail(urequest, mailCtr.getMailTemplate(), identitiesToBeNotified);
            }
        } else if (event == Event.CANCELLED_EVENT) {
            cmc.deactivate();
        }
    } else {
        log.warn("Can not handle event in TACourseNodeEditController source=" + source + " " + event.toString());
    }
}
Also used : OlatNamedContainerImpl(org.olat.core.commons.modules.bc.vfs.OlatNamedContainerImpl) OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) FolderRunController(org.olat.core.commons.modules.bc.FolderRunController) MailTemplate(org.olat.core.util.mail.MailTemplate) FolderEvent(org.olat.core.commons.modules.bc.FolderEvent) RepositoryEntry(org.olat.repository.RepositoryEntry) MailNotificationEditController(org.olat.core.util.mail.MailNotificationEditController)

Example 2 with FolderEvent

use of org.olat.core.commons.modules.bc.FolderEvent in project OpenOLAT by OpenOLAT.

the class ReturnboxFullAccessCallback method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == dropboxFolderRunController) {
        if (event instanceof FolderEvent) {
            FolderEvent folderEvent = (FolderEvent) event;
            if (folderEvent.getCommand().equals(FolderEvent.DELETE_EVENT)) {
                UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
                // log entry for this file
                Identity coach = ureq.getIdentity();
                Identity student = userCourseEnv.getIdentityEnvironment().getIdentity();
                am.appendToUserNodeLog(node, coach, student, "FILE DELETED: " + folderEvent.getFilename());
            }
        }
    } else if (source == returnboxFolderRunController) {
        if (event instanceof FolderEvent) {
            FolderEvent folderEvent = (FolderEvent) event;
            if (folderEvent.getCommand().equals(FolderEvent.UPLOAD_EVENT) || folderEvent.getCommand().equals(FolderEvent.NEW_FILE_EVENT)) {
                UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
                // log entry for this file
                Identity coach = ureq.getIdentity();
                Identity student = userCourseEnv.getIdentityEnvironment().getIdentity();
                if (node instanceof AssessableCourseNode) {
                    AssessableCourseNode acn = (AssessableCourseNode) node;
                    AssessmentEvaluation eval = acn.getUserScoreEvaluation(userCourseEnv);
                    if (eval.getAssessmentStatus() == null || eval.getAssessmentStatus() == AssessmentEntryStatus.notStarted) {
                        eval = new AssessmentEvaluation(eval, AssessmentEntryStatus.inProgress);
                        acn.updateUserScoreEvaluation(eval, userCourseEnv, coach, false, Role.coach);
                    }
                }
                am.appendToUserNodeLog(node, coach, student, "FILE UPLOADED: " + folderEvent.getFilename());
                String toMail = UserManager.getInstance().getUserDisplayEmail(student, ureq.getLocale());
                OLATResourceable ores = OresHelper.createOLATResourceableInstance(CourseNode.class, Long.valueOf(node.getIdent()));
                ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ores);
                BusinessControl bc = BusinessControlFactory.getInstance().createBusinessControl(ce, getWindowControl().getBusinessControl());
                String link = BusinessControlFactory.getInstance().getAsURIString(bc, true);
                log.debug("DEBUG : Returnbox notification email with link=" + link);
                String subject = translate("returnbox.email.subject");
                String body = translate("returnbox.email.body", new String[] { userCourseEnv.getCourseEnvironment().getCourseTitle(), node.getShortTitle(), folderEvent.getFilename(), link });
                MailContext context = new MailContextImpl(getWindowControl().getBusinessControl().getAsString());
                MailBundle bundle = new MailBundle();
                bundle.setContext(context);
                bundle.setToId(student);
                bundle.setContent(subject, body);
                MailerResult result = CoreSpringFactory.getImpl(MailManager.class).sendMessage(bundle);
                if (result.getReturnCode() > 0) {
                    am.appendToUserNodeLog(node, coach, student, "MAIL SEND FAILED TO:" + toMail + "; MailReturnCode: " + result.getReturnCode());
                    log.warn("Could not send email 'returnbox notification' to " + student + "with email=" + toMail);
                } else {
                    log.info("Send email 'returnbox notification' to " + student + "with email=" + toMail);
                }
            }
        } else if (FolderCommand.FOLDERCOMMAND_FINISHED == event) {
            if (node instanceof AssessableCourseNode) {
                AssessableCourseNode acn = (AssessableCourseNode) node;
                AssessmentEvaluation eval = acn.getUserScoreEvaluation(userCourseEnv);
                if (eval == null) {
                    eval = AssessmentEvaluation.EMPTY_EVAL;
                }
                if (eval.getAssessmentStatus() == null || eval.getAssessmentStatus() == AssessmentEntryStatus.notStarted) {
                    eval = new AssessmentEvaluation(eval, AssessmentEntryStatus.inProgress);
                    acn.updateUserScoreEvaluation(eval, userCourseEnv, getIdentity(), false, Role.coach);
                    fireEvent(ureq, Event.CHANGED_EVENT);
                }
            }
        }
    } else if (source == statusForm) {
        if (event == Event.DONE_EVENT) {
            // get identity not from request (this would be an author)
            StatusManager.getInstance().saveStatusFormData(statusForm, node, userCourseEnv);
        }
    } else if (source == dialogBoxController) {
        if (DialogBoxUIFactory.isYesEvent(event) && assignedTask != null) {
            // cancel task assignment, and show "no task assigned to user"
            removeAssignedTask(userCourseEnv, userCourseEnv.getIdentityEnvironment().getIdentity());
            // update UI
            myContent.contextPut("assignedtask", null);
        }
    }
}
Also used : MailContextImpl(org.olat.core.util.mail.MailContextImpl) AssessmentEvaluation(org.olat.course.run.scoring.AssessmentEvaluation) OLATResourceable(org.olat.core.id.OLATResourceable) MailContext(org.olat.core.util.mail.MailContext) MailerResult(org.olat.core.util.mail.MailerResult) BusinessControl(org.olat.core.id.context.BusinessControl) ContextEntry(org.olat.core.id.context.ContextEntry) UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) FolderEvent(org.olat.core.commons.modules.bc.FolderEvent) CourseNode(org.olat.course.nodes.CourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) Identity(org.olat.core.id.Identity) MailBundle(org.olat.core.util.mail.MailBundle)

Example 3 with FolderEvent

use of org.olat.core.commons.modules.bc.FolderEvent in project OpenOLAT by OpenOLAT.

the class WikiMainController method event.

@Override
public void event(UserRequest ureq, Controller source, Event event) {
    Wiki wiki = getWiki();
    if (wiki == null) {
        mainPanel.setContent(createVelocityContainer("deleted"));
        return;
    }
    // reload page from cache
    WikiPage page = wiki.getPage(pageId, true);
    // set recent page id to the page currently used
    this.pageId = page.getPageId();
    if (event instanceof TreeEvent) {
        TreeEvent te = (TreeEvent) event;
        String nodeId = te.getNodeId();
        if (navAZNode.getIdent().equals(nodeId)) {
            openAtoZPage(ureq, wiki);
        } else if (navChangesNode.getIdent().equals(nodeId)) {
            openLastChangesPage(ureq, wiki);
        } else if (navMainPageNode.getIdent().equals(nodeId)) {
            page = openIndexPage(ureq, wiki);
        } else if (wikiMenuNode.getIdent().equals(nodeId)) {
            page = openPage(ureq, WikiPage.WIKI_MENU_PAGE, wiki);
        } else {
            TreeNode node = wikiMenuModel.getNodeById(nodeId);
            if (node != null && node.getUserObject() instanceof String) {
                String link = (String) node.getUserObject();
                page = openPage(ureq, link, wiki);
            }
        }
        if (page != null) {
            this.pageId = page.getPageId();
        }
    } else if (source == versioningTableCtr) {
        /**
         ***********************************************************************
         * history table events
         ***********************************************************************
         */
        if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
            TableEvent te = (TableEvent) event;
            if (te.getActionId().equals(ACTION_COMPARE)) {
                selectedPage = versioningTableModel.getObject(te.getRowId());
                diffs = wiki.getDiff(page, selectedPage.getVersion() - 1, selectedPage.getVersion());
                versioningContent.contextPut("diffs", diffs);
                versioningContent.remove(wikiVersionDisplayComp);
                versioningContent.contextPut("page", selectedPage);
            } else if (te.getActionId().equals(ACTION_SHOW)) {
                versioningContent.contextRemove("diffs");
                selectedPage = versioningTableModel.getObject(te.getRowId());
                selectedPage = wiki.loadVersion(selectedPage, selectedPage.getVersion());
                wikiVersionDisplayComp.setWikiContent(selectedPage.getContent());
                wikiVersionDisplayComp.setImageMapperUri(ureq, wikiContainer);
                versioningContent.put("versionDisplay", wikiVersionDisplayComp);
                versioningContent.contextPut("page", selectedPage);
            }
        }
    } else if (source == wikiUploadFileCtr) {
        if (event.getCommand().equals(FolderEvent.UPLOAD_EVENT)) {
            FolderEvent fEvent = (FolderEvent) event;
            createMediaMetadataFile(fEvent.getFilename(), ureq.getIdentity().getKey());
            updateFileAndLinkList(wiki);
        }
        cmc.deactivate();
        cleanUp();
    } else if (source == removePageDialogCtr) {
        if (DialogBoxUIFactory.isOkEvent(event)) {
            wiki.removePage(page);
            breadcrumpDropdown.removeComponent(page.getPageName());
            WikiManager.getInstance().deleteWikiPage(ores, page);
            page = wiki.getPage(WikiPage.WIKI_INDEX_PAGE);
            updatePageContext(ureq, page);
            tabs.setSelectedPane(ureq, 0);
        }
    } else if (source == mediaTableCtr) {
        if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
            TableEvent te = (TableEvent) event;
            if (te.getActionId().equals(ACTION_DELETE_MEDIA)) {
                List<MediaFileElement> list = new ArrayList<MediaFileElement>(1);
                list.add(mediaFilesTableModel.getObject(te.getRowId()));
                deleteMediaFile(list, ureq);
            } else if (te.getActionId().equals(ACTION_SHOW_MEDIA)) {
                // show a selected file from the media folder
                MediaFileElement element = mediaFilesTableModel.getObject(te.getRowId());
                if (isImage(element.getFilename())) {
                    // show images inline
                    // as modal overlay
                    imageDisplay.contextPut("mediaElement", element);
                    imageDisplay.contextPut("imageUri", wikiArticleComp.getImageBaseUri());
                    removeAsListenerAndDispose(cmc);
                    cmc = new CloseableModalController(getWindowControl(), translate("close"), imageDisplay);
                    listenTo(cmc);
                    cmc.activate();
                } else {
                    deliverMediaFile(ureq, element.getFilename());
                }
            }
        } else if (event.getCommand().equals(Table.COMMAND_MULTISELECT)) {
            TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
            if (tmse.getAction().equals(ACTION_DELETE_MEDIAS)) {
                deleteMediaFile(mediaFilesTableModel.getObjects(tmse.getSelection()), ureq);
                updateFileAndLinkList(wiki);
            }
        }
    } else if (source == archiveWikiDialogCtr) {
        if (DialogBoxUIFactory.isOkEvent(event)) {
            WikiToCPResource rsrc = new WikiToCPResource(ores, getIdentity(), getTranslator());
            ureq.getDispatchResult().setResultingMediaResource(rsrc);
        }
    } else if (source == createArticleForm) {
        calloutCtrl.deactivate();
        String query = createArticleForm.getQuery();
        if (!StringHelper.containsNonWhitespace(query)) {
            query = WikiPage.WIKI_INDEX_PAGE;
        }
        page = wiki.findPage(query);
        pageId = page.getPageId();
        if (page.getPageName().equals(Wiki.NEW_PAGE)) {
            setTabsEnabled(false);
        }
        page.incrementViewCount();
        updatePageContext(ureq, page);
        if (!page.getPageName().startsWith("O_")) {
            Link pageLink = LinkFactory.createToolLink(page.getPageName(), "select-page", page.getPageName(), this);
            breadcrumpDropdown.addComponent(pageLink);
        }
        tabs.setSelectedPane(ureq, 0);
    } else if (source == wikiEditForm) {
        // set recent page id to the page currently used
        this.pageId = page.getPageId();
        boolean wantPreview = false;
        boolean wantSave = false;
        boolean wantClose = false;
        if (event == Event.CANCELLED_EVENT) {
            wantClose = true;
        } else if (event == Event.DONE_EVENT) {
            wantSave = true;
        } else if (event.getCommand().equals("save.and.close")) {
            wantClose = true;
            wantSave = true;
            event = Event.DONE_EVENT;
        } else if (event.getCommand().equals("preview")) {
            wantPreview = true;
            event = Event.DONE_EVENT;
        } else if (event.getCommand().equals("delete.page")) {
            String msg = translate("question", page.getPageName());
            removePageDialogCtr = activateOkCancelDialog(ureq, null, msg, removePageDialogCtr);
            return;
        } else if (event.getCommand().equals("media.upload")) {
            doUploadFiles(ureq);
            return;
        } else if (event.getCommand().equals("manage.media")) {
            doManageMedias(ureq, wiki);
            return;
        }
        boolean dirty = !wikiEditForm.getWikiContent().equals(page.getContent());
        if (wantPreview) {
            WikiPage preview = new WikiPage("temp");
            preview.setContent(wikiEditForm.getWikiContent());
            wikiVersionDisplayComp.setWikiContent(preview.getContent());
            editContent.put("versionDisplay", wikiVersionDisplayComp);
        }
        if (wantSave && dirty) {
            editContent.contextPut("isDirty", Boolean.valueOf(false));
            page.setContent(wikiEditForm.getWikiContent());
            page.setModifyAuthor(getIdentity().getKey().longValue());
            page.setUpdateComment(wikiEditForm.getUpdateComment());
            if (page.getInitalAuthor() == 0)
                page.setInitalAuthor(getIdentity().getKey().longValue());
            // changed
            if (page.getPageName().equals(WikiPage.WIKI_MENU_PAGE)) {
                updateWikiMenu(wiki);
            }
            WikiManager.getInstance().saveWikiPage(ores, page, true, wiki);
            // inform subscription context about changes
            NotificationsManager.getInstance().markPublisherNews(subsContext, ureq.getIdentity(), true);
            updatePageContext(ureq, page);
        }
        if (dirty && wantPreview && !wantSave) {
            // wikiEditForm.setDirty(true);
            editContent.contextPut("isDirty", Boolean.valueOf(dirty));
        }
        if (wantClose) {
            tabs.setSelectedPane(ureq, 0);
            doReleaseEditLock();
            return;
        }
    }
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) TableMultiSelectEvent(org.olat.core.gui.components.table.TableMultiSelectEvent) ArrayList(java.util.ArrayList) TreeEvent(org.olat.core.gui.components.tree.TreeEvent) TableEvent(org.olat.core.gui.components.table.TableEvent) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) FolderEvent(org.olat.core.commons.modules.bc.FolderEvent) Link(org.olat.core.gui.components.link.Link)

Example 4 with FolderEvent

use of org.olat.core.commons.modules.bc.FolderEvent in project OpenOLAT by OpenOLAT.

the class VideoPosterEditController method event.

@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == posterUploadForm || source == posterSelectionForm) {
        if (event instanceof FolderEvent) {
            VFSLeaf posterFile = (VFSLeaf) ((FolderEvent) event).getItem();
            if (source == posterUploadForm) {
                videoManager.setPosterframeResizeUploadfile(videoResource, posterFile);
                posterFile.delete();
            } else {
                videoManager.setPosterframe(videoResource, posterFile);
            }
            updatePosterImage(ureq, videoResource);
        }
        cmc.deactivate();
        cleanUp();
    } else if (cmc == source) {
        cleanUp();
    }
}
Also used : VFSLeaf(org.olat.core.util.vfs.VFSLeaf) FolderEvent(org.olat.core.commons.modules.bc.FolderEvent)

Example 5 with FolderEvent

use of org.olat.core.commons.modules.bc.FolderEvent in project OpenOLAT by OpenOLAT.

the class VideoPosterUploadForm method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (posterField.isUploadSuccess()) {
        if (remainingSpace != -1) {
            if (posterField.getUploadFile().length() / 1024 > remainingSpace) {
                posterField.setErrorKey("QuotaExceeded", null);
                posterField.getUploadFile().delete();
                return;
            }
        } else {
            fireEvent(ureq, new FolderEvent(FolderEvent.UPLOAD_EVENT, posterField.moveUploadFileTo(metaDataFolder)));
        }
    }
}
Also used : FolderEvent(org.olat.core.commons.modules.bc.FolderEvent)

Aggregations

FolderEvent (org.olat.core.commons.modules.bc.FolderEvent)28 VFSItem (org.olat.core.util.vfs.VFSItem)14 MetaInfo (org.olat.core.commons.modules.bc.meta.MetaInfo)10 VFSContainer (org.olat.core.util.vfs.VFSContainer)8 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)8 MetaTagged (org.olat.core.commons.modules.bc.meta.tagged.MetaTagged)6 ArrayList (java.util.ArrayList)4 Link (org.olat.core.gui.components.link.Link)4 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)4 OlatRelPathImpl (org.olat.core.util.vfs.OlatRelPathImpl)4 FileChoosenEvent (org.olat.core.commons.controllers.filechooser.FileChoosenEvent)2 FolderRunController (org.olat.core.commons.modules.bc.FolderRunController)2 OlatNamedContainerImpl (org.olat.core.commons.modules.bc.vfs.OlatNamedContainerImpl)2 OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)2 Size (org.olat.core.commons.services.image.Size)2 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)2 TableEvent (org.olat.core.gui.components.table.TableEvent)2 TableMultiSelectEvent (org.olat.core.gui.components.table.TableMultiSelectEvent)2 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)2 TreeEvent (org.olat.core.gui.components.tree.TreeEvent)2