diff --git a/src/main/java/de/bps/course/nodes/ll/LLEditForm.java b/src/main/java/de/bps/course/nodes/ll/LLEditForm.java index d8fc91193610bf41e6fecee9ea7babdf7f6f3215..23a6bfbc3831a114dc9b28dc9fc21a726cca5600 100644 --- a/src/main/java/de/bps/course/nodes/ll/LLEditForm.java +++ b/src/main/java/de/bps/course/nodes/ll/LLEditForm.java @@ -195,7 +195,7 @@ public class LLEditForm extends FormBasicController { removeAsListenerAndDispose(mediaChooserController); VFSContainer courseContainer = courseEnv.getCourseFolderContainer(); - mediaChooserController = new MediaChooserController(ureq, getWindowControl(), courseContainer, null, null, "", null); + mediaChooserController = new MediaChooserController(ureq, getWindowControl(), courseContainer, null, null, "", null, true); listenTo(mediaChooserController); mediaDialogBox = new CloseableModalController(getWindowControl(), translate("choose"), mediaChooserController.getInitialComponent()); diff --git a/src/main/java/org/olat/core/commons/controllers/linkchooser/LinkChooserController.java b/src/main/java/org/olat/core/commons/controllers/linkchooser/LinkChooserController.java index 163555ff388581504810c164e9a5c4760f80e806..fc074917857bbd56a99a0c14d1f98215787abf0f 100644 --- a/src/main/java/org/olat/core/commons/controllers/linkchooser/LinkChooserController.java +++ b/src/main/java/org/olat/core/commons/controllers/linkchooser/LinkChooserController.java @@ -71,7 +71,7 @@ public class LinkChooserController extends BasicController { */ public LinkChooserController(UserRequest ureq, WindowControl wControl, VFSContainer rootDir, String uploadRelPath, String absolutPath, String[] suffixes, String fileName, - CustomLinkTreeModel customLinkTreeModel) { + CustomLinkTreeModel customLinkTreeModel, boolean allowCustomMediaChooserFactory) { super(ureq, wControl); tabbedPaneViewVC = createVelocityContainer("linkchooser"); @@ -91,7 +91,7 @@ public class LinkChooserController extends BasicController { // try to add custom media chooser from spring configuration. // This one will be added as additional tab. - if (CoreSpringFactory.containsBean(CustomMediaChooserFactory.class.getName())) { + if (allowCustomMediaChooserFactory && CoreSpringFactory.containsBean(CustomMediaChooserFactory.class.getName())) { CustomMediaChooserFactory customMediaChooserFactory = (CustomMediaChooserFactory) CoreSpringFactory.getBean(CustomMediaChooserFactory.class.getName()); customMediaChooserCtr = customMediaChooserFactory.getInstance(ureq, wControl); if (customMediaChooserCtr != null) { diff --git a/src/main/java/org/olat/core/commons/controllers/linkchooser/MediaChooserController.java b/src/main/java/org/olat/core/commons/controllers/linkchooser/MediaChooserController.java index 9953249ffb57966c843f401257d3d2d9d3ce7687..3a75162fc81ca036a9f17592512a6a788a4fb7e9 100644 --- a/src/main/java/org/olat/core/commons/controllers/linkchooser/MediaChooserController.java +++ b/src/main/java/org/olat/core/commons/controllers/linkchooser/MediaChooserController.java @@ -63,8 +63,8 @@ public class MediaChooserController extends LinkChooserController { * internalLinkTreeModel is null. */ public MediaChooserController(UserRequest ureq, WindowControl wControl, VFSContainer rootDir, String uploadRelPath, String[] suffixes, String fileName, - CustomLinkTreeModel customLinkTreeModel) { - super(ureq, wControl, rootDir, uploadRelPath, null, suffixes, fileName, customLinkTreeModel); + CustomLinkTreeModel customLinkTreeModel, boolean allowCustomMediaFactory) { + super(ureq, wControl, rootDir, uploadRelPath, null, suffixes, fileName, customLinkTreeModel, allowCustomMediaFactory); } /** diff --git a/src/main/java/org/olat/core/commons/modules/bc/FileCopyController.java b/src/main/java/org/olat/core/commons/modules/bc/FileCopyController.java index 325776f5866f8f81dfb7c5b787fadfd5fe9967fb..8cc58b77b91c756cae58f2baecf8d338d2e2e69d 100644 --- a/src/main/java/org/olat/core/commons/modules/bc/FileCopyController.java +++ b/src/main/java/org/olat/core/commons/modules/bc/FileCopyController.java @@ -87,7 +87,7 @@ public class FileCopyController extends LinkChooserController { public FileCopyController(UserRequest ureq, WindowControl wControl, VFSContainer rootDir, FolderComponent folderComponent) { - super(ureq, wControl, rootDir, null, null, null, "", null); + super(ureq, wControl, rootDir, null, null, null, "", null, true); this.folderComponent = folderComponent; vfsLockManager = CoreSpringFactory.getImpl(VFSLockManager.class); } diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/richText/RichTextConfiguration.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/richText/RichTextConfiguration.java index 54793c50255bfdd1240b6aefbdcbe584c05f7b80..58590a328d780cf9354ee87bffa913295a4d1c2f 100644 --- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/richText/RichTextConfiguration.java +++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/richText/RichTextConfiguration.java @@ -141,6 +141,7 @@ public class RichTextConfiguration implements Disposable { private String linkBrowserUploadRelPath; private String linkBrowserRelativeFilePath; private String linkBrowserAbsolutFilePath; + private boolean allowCustomMediaFactory = true; private CustomLinkTreeModel linkBrowserCustomTreeModel; // DOM ID of the flexi form element private String domID; @@ -296,6 +297,14 @@ public class RichTextConfiguration implements Disposable { setTabFocusEnabled(true); } + public boolean isAllowCustomMediaFactory() { + return allowCustomMediaFactory; + } + + public void setAllowCustomMediaFactory(boolean allowCustomMediaFactory) { + this.allowCustomMediaFactory = allowCustomMediaFactory; + } + /** * Add a function name that has to be executed after initialization. <br> * E.g: myFunctionName, (alert('loading successfull')) <br> diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/richText/RichTextElementComponent.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/richText/RichTextElementComponent.java index e119913df7b2d60e041660b12f311822ad018de9..4ec3e72aacf3e8e43c8a781bedae70eb829f427f 100644 --- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/richText/RichTextElementComponent.java +++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/richText/RichTextElementComponent.java @@ -127,6 +127,7 @@ class RichTextElementComponent extends FormBaseComponentImpl { private void createFileSelectorPopupWindow(final UserRequest ureq, final String type, final String fileName) { // Get allowed suffixes from configuration and requested media browser type from event final RichTextConfiguration config = element.getEditorConfiguration(); + final boolean allowCustomMediaFactory = config.isAllowCustomMediaFactory(); final String[] suffixes; if(type.equals(CMD_FILEBROWSER)) { suffixes = null; @@ -144,6 +145,7 @@ class RichTextElementComponent extends FormBaseComponentImpl { //helper code which is used to create link chooser controller ControllerCreator linkChooserControllerCreator = new ControllerCreator() { + @Override public Controller createController(UserRequest lureq,WindowControl lwControl) { LinkChooserController myLinkChooserController; VFSContainer baseContainer = config.getLinkBrowserBaseContainer(); @@ -152,11 +154,10 @@ class RichTextElementComponent extends FormBaseComponentImpl { CustomLinkTreeModel linkBrowserCustomTreeModel = config.getLinkBrowserCustomLinkTreeModel(); if (type.equals(CMD_FILEBROWSER)) { // when in file mode we include the internal links to the selection - //FIXME: user activity logger - myLinkChooserController = new LinkChooserController(lureq, lwControl, baseContainer, uploadRelPath, absolutePath, suffixes, fileName, linkBrowserCustomTreeModel); + myLinkChooserController = new LinkChooserController(lureq, lwControl, baseContainer, uploadRelPath, absolutePath, suffixes, fileName, linkBrowserCustomTreeModel, allowCustomMediaFactory); } else { // in media or image mode, internal links make no sense here - myLinkChooserController = new LinkChooserController(lureq, lwControl, baseContainer, uploadRelPath, absolutePath, suffixes, fileName, null); + myLinkChooserController = new LinkChooserController(lureq, lwControl, baseContainer, uploadRelPath, absolutePath, suffixes, fileName, null, allowCustomMediaFactory); } return new LayoutMain3ColsController(lureq, lwControl, myLinkChooserController); } diff --git a/src/main/java/org/olat/course/nodes/gta/ui/EditHTMLTaskController.java b/src/main/java/org/olat/course/nodes/gta/ui/EditHTMLTaskController.java index 398ff6f327397531069baae5ef7ed3817edbc866..0d9aa5b6921eedeceeedd7f4bb68c8c177a312f9 100644 --- a/src/main/java/org/olat/course/nodes/gta/ui/EditHTMLTaskController.java +++ b/src/main/java/org/olat/course/nodes/gta/ui/EditHTMLTaskController.java @@ -80,6 +80,7 @@ public class EditHTMLTaskController extends FormBasicController { contentEditor = new HTMLEditorController(ureq, getWindowControl(), taskContainer, task.getFilename(), null, "media", true, false, false, mainForm); contentEditor.getRichTextConfiguration().disableMedia(); + contentEditor.getRichTextConfiguration().setAllowCustomMediaFactory(false); listenTo(contentEditor); FormItem editorItem = contentEditor.getInitialFormItem(); editorItem.setLabel("task.file", null); diff --git a/src/main/java/org/olat/course/nodes/gta/ui/GTAAssignmentEditController.java b/src/main/java/org/olat/course/nodes/gta/ui/GTAAssignmentEditController.java index 28c0cfc4b05afd84fd54ccbe21fba1e65e2b3add..e20fcdc1f6b4352ab6fce0700395612954917808 100644 --- a/src/main/java/org/olat/course/nodes/gta/ui/GTAAssignmentEditController.java +++ b/src/main/java/org/olat/course/nodes/gta/ui/GTAAssignmentEditController.java @@ -420,6 +420,7 @@ public class GTAAssignmentEditController extends FormBasicController { newTaskEditorCtrl = WysiwygFactory.createWysiwygController(ureq, getWindowControl(), tasksContainer, documentName, "media", true, true); newTaskEditorCtrl.getRichTextConfiguration().disableMedia(); + newTaskEditorCtrl.getRichTextConfiguration().setAllowCustomMediaFactory(false); newTaskEditorCtrl.setNewFile(true); newTaskEditorCtrl.setUserObject(taskDef); listenTo(newTaskEditorCtrl); diff --git a/src/main/java/org/olat/course/nodes/gta/ui/GTASampleSolutionsEditController.java b/src/main/java/org/olat/course/nodes/gta/ui/GTASampleSolutionsEditController.java index c55b0cf13871334aabbdc1adcc2c40af7db29ed7..d704bde626f890e125055ada19b95a9d742eaa73 100644 --- a/src/main/java/org/olat/course/nodes/gta/ui/GTASampleSolutionsEditController.java +++ b/src/main/java/org/olat/course/nodes/gta/ui/GTASampleSolutionsEditController.java @@ -278,6 +278,7 @@ public class GTASampleSolutionsEditController extends FormBasicController { newSolutionEditorCtrl = WysiwygFactory.createWysiwygController(ureq, getWindowControl(), solutionContainer, documentName, "media", true, true); newSolutionEditorCtrl.getRichTextConfiguration().disableMedia(); + newSolutionEditorCtrl.getRichTextConfiguration().setAllowCustomMediaFactory(false); newSolutionEditorCtrl.setNewFile(true); newSolutionEditorCtrl.setUserObject(solution); listenTo(newSolutionEditorCtrl); @@ -293,6 +294,7 @@ public class GTASampleSolutionsEditController extends FormBasicController { editSolutionEditorCtrl = WysiwygFactory.createWysiwygController(ureq, getWindowControl(), solutionContainer, documentName, "media", true, true); editSolutionEditorCtrl.getRichTextConfiguration().disableMedia(); + editSolutionEditorCtrl.getRichTextConfiguration().setAllowCustomMediaFactory(false); listenTo(editSolutionEditorCtrl); cmc = new CloseableModalController(getWindowControl(), "close", editSolutionEditorCtrl.getInitialComponent()); diff --git a/src/main/java/org/olat/course/nodes/gta/ui/SubmitDocumentsController.java b/src/main/java/org/olat/course/nodes/gta/ui/SubmitDocumentsController.java index a8c9d30e677a711b23686975f01c7ed03fb0c775..897752f94e5c7e145200b88fde1aa5cd22a3bb69 100644 --- a/src/main/java/org/olat/course/nodes/gta/ui/SubmitDocumentsController.java +++ b/src/main/java/org/olat/course/nodes/gta/ui/SubmitDocumentsController.java @@ -426,6 +426,7 @@ class SubmitDocumentsController extends FormBasicController { newDocumentEditorCtrl = WysiwygFactory.createWysiwygController(ureq, getWindowControl(), documentsContainer, documentName, "media", true, true); newDocumentEditorCtrl.getRichTextConfiguration().disableMedia(); + newDocumentEditorCtrl.getRichTextConfiguration().setAllowCustomMediaFactory(false); newDocumentEditorCtrl.setNewFile(true); listenTo(newDocumentEditorCtrl); @@ -441,6 +442,7 @@ class SubmitDocumentsController extends FormBasicController { editDocumentEditorCtrl = WysiwygFactory.createWysiwygController(ureq, getWindowControl(), documentsContainer, documentName, "media", true, true); editDocumentEditorCtrl.getRichTextConfiguration().disableMedia(); + editDocumentEditorCtrl.getRichTextConfiguration().setAllowCustomMediaFactory(false); listenTo(editDocumentEditorCtrl); cmc = new CloseableModalController(getWindowControl(), "close", editDocumentEditorCtrl.getInitialComponent()); diff --git a/src/main/java/org/olat/modules/dialog/DialogElementsController.java b/src/main/java/org/olat/modules/dialog/DialogElementsController.java index 370fc8eb01327cd2787a8f76f0fd0887ca43a7d1..98e9d039fd32448ccf50e30de739aa0a163cd27d 100644 --- a/src/main/java/org/olat/modules/dialog/DialogElementsController.java +++ b/src/main/java/org/olat/modules/dialog/DialogElementsController.java @@ -466,7 +466,7 @@ public class DialogElementsController extends BasicController { private class MyLinkChooserController extends LinkChooserController { public MyLinkChooserController(UserRequest ureq, WindowControl wControl, VFSContainer rootDir, String uploadRelPath) { - super(ureq, wControl, rootDir, uploadRelPath, null, null, "", null); + super(ureq, wControl, rootDir, uploadRelPath, null, null, "", null, true); } @Override