Skip to content
Snippets Groups Projects
Commit d1c7face authored by srosse's avatar srosse
Browse files

Merge remote-tracking branch 'origin/OpenOLAT_15.1'

parents ca0b684e f7f49c1e
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,7 @@ import org.olat.core.gui.control.generic.tabbable.TabbableController; ...@@ -32,6 +32,7 @@ import org.olat.core.gui.control.generic.tabbable.TabbableController;
import org.olat.core.id.Identity; import org.olat.core.id.Identity;
import org.olat.core.id.Organisation; import org.olat.core.id.Organisation;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.core.util.ValidationStatus;
import org.olat.core.util.nodes.INode; import org.olat.core.util.nodes.INode;
import org.olat.course.ICourse; import org.olat.course.ICourse;
import org.olat.course.condition.ConditionEditController; import org.olat.course.condition.ConditionEditController;
...@@ -46,6 +47,8 @@ import org.olat.course.run.navigation.NodeRunConstructionResult; ...@@ -46,6 +47,8 @@ import org.olat.course.run.navigation.NodeRunConstructionResult;
import org.olat.course.run.userview.CourseNodeSecurityCallback; import org.olat.course.run.userview.CourseNodeSecurityCallback;
import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.course.run.userview.UserCourseEnvironment;
import org.olat.fileresource.types.VideoFileResource; import org.olat.fileresource.types.VideoFileResource;
import org.olat.modules.ModuleConfiguration;
import org.olat.modules.video.ui.VideoDisplayOptions;
import org.olat.repository.RepositoryEntry; import org.olat.repository.RepositoryEntry;
import org.olat.repository.RepositoryEntryImportExport; import org.olat.repository.RepositoryEntryImportExport;
import org.olat.repository.handlers.RepositoryHandler; import org.olat.repository.handlers.RepositoryHandler;
...@@ -72,7 +75,7 @@ public class VideoCourseNode extends AbstractAccessableCourseNode { ...@@ -72,7 +75,7 @@ public class VideoCourseNode extends AbstractAccessableCourseNode {
@Override @Override
public TabbableController createEditController(UserRequest ureq, WindowControl wControl, BreadcrumbPanel stackPanel, ICourse course, UserCourseEnvironment euce) { public TabbableController createEditController(UserRequest ureq, WindowControl wControl, BreadcrumbPanel stackPanel, ICourse course, UserCourseEnvironment euce) {
VideoEditController childTabCntrllr = new VideoEditController(this, ureq, wControl, course, euce); VideoEditController childTabCntrllr = new VideoEditController(this, ureq, wControl);
CourseNode chosenNode = course.getEditorTreeModel().getCourseNode(euce.getCourseEditorEnv().getCurrentCourseNodeId()); CourseNode chosenNode = course.getEditorTreeModel().getCourseNode(euce.getCourseEditorEnv().getCurrentCourseNodeId());
return new NodeEditController(ureq, wControl, course, chosenNode, euce, childTabCntrllr); return new NodeEditController(ureq, wControl, course, chosenNode, euce, childTabCntrllr);
} }
...@@ -93,13 +96,36 @@ public class VideoCourseNode extends AbstractAccessableCourseNode { ...@@ -93,13 +96,36 @@ public class VideoCourseNode extends AbstractAccessableCourseNode {
} }
@Override @Override
public NodeRunConstructionResult createNodeRunConstructionResult( public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl,
UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, CourseNodeSecurityCallback nodeSecCallback, String nodecmd) {
UserCourseEnvironment userCourseEnv, CourseNodeSecurityCallback nodeSecCallback,
String nodecmd) {
VideoRunController cprunC = new VideoRunController(getModuleConfiguration(), wControl, ureq, userCourseEnv, this); VideoRunController cprunC = new VideoRunController(getModuleConfiguration(), wControl, ureq, userCourseEnv, this);
return cprunC.createNodeRunConstructionResult(ureq); return cprunC.createNodeRunConstructionResult(ureq);
} }
public VideoDisplayOptions getVideoDisplay(RepositoryEntry videoEntry, boolean readOnly) {
// configure the display controller according to config
ModuleConfiguration config = getModuleConfiguration();
boolean autoplay = config.getBooleanSafe(VideoEditController.CONFIG_KEY_AUTOPLAY);
boolean comments = config.getBooleanSafe(VideoEditController.CONFIG_KEY_COMMENTS);
boolean ratings = config.getBooleanSafe(VideoEditController.CONFIG_KEY_RATING);
String customtext = config.getStringValue(VideoEditController.CONFIG_KEY_DESCRIPTION_CUSTOMTEXT);
VideoDisplayOptions displayOptions = VideoDisplayOptions.valueOf(autoplay, comments, ratings, true, false, false, null, false, readOnly);
switch(config.getStringValue(VideoEditController.CONFIG_KEY_DESCRIPTION_SELECT, "none")) {
case "customDescription":
displayOptions.setShowDescription(true);
displayOptions.setDescriptionText(customtext);
break;
case "resourceDescription":
displayOptions.setShowDescription(true);
displayOptions.setDescriptionText(videoEntry.getDescription());
break;
default:
displayOptions.setShowDescription(false);
break;
}
return displayOptions;
}
@Override @Override
public StatusDescription isConfigValid(){ public StatusDescription isConfigValid(){
...@@ -108,12 +134,11 @@ public class VideoCourseNode extends AbstractAccessableCourseNode { ...@@ -108,12 +134,11 @@ public class VideoCourseNode extends AbstractAccessableCourseNode {
StatusDescription sd = StatusDescription.NOERROR; StatusDescription sd = StatusDescription.NOERROR;
boolean isValid = VideoEditController.isModuleConfigValid(getModuleConfiguration()); boolean isValid = VideoEditController.isModuleConfigValid(getModuleConfiguration());
if (!isValid) { if (!isValid) {
// FIXME: refine statusdescriptions
String shortKey = "no.video.chosen"; String shortKey = "no.video.chosen";
String longKey = "error.noreference.long"; String longKey = "error.noreference.long";
String[] params = new String[] { this.getShortTitle() }; String[] params = new String[] { this.getShortTitle() };
String translPackage = Util.getPackageName(VideoEditController.class); String translPackage = Util.getPackageName(VideoEditController.class);
sd = new StatusDescription(StatusDescription.ERROR, shortKey, longKey, params, translPackage); sd = new StatusDescription(ValidationStatus.ERROR, shortKey, longKey, params, translPackage);
sd.setDescriptionForUnit(getIdent()); sd.setDescriptionForUnit(getIdent());
// set which pane is affected by error // set which pane is affected by error
sd.setActivateableViewIdentifier(VideoEditController.PANE_TAB_VIDEOCONFIG); sd.setActivateableViewIdentifier(VideoEditController.PANE_TAB_VIDEOCONFIG);
......
...@@ -46,10 +46,8 @@ import org.olat.core.util.StringHelper; ...@@ -46,10 +46,8 @@ import org.olat.core.util.StringHelper;
import org.olat.core.util.filter.FilterFactory; import org.olat.core.util.filter.FilterFactory;
import org.olat.core.util.vfs.VFSContainer; import org.olat.core.util.vfs.VFSContainer;
import org.olat.core.util.vfs.VFSContainerMapper; import org.olat.core.util.vfs.VFSContainerMapper;
import org.olat.course.ICourse;
import org.olat.course.editor.NodeEditController; import org.olat.course.editor.NodeEditController;
import org.olat.course.nodes.VideoCourseNode; import org.olat.course.nodes.VideoCourseNode;
import org.olat.course.run.userview.UserCourseEnvironment;
import org.olat.fileresource.types.VideoFileResource; import org.olat.fileresource.types.VideoFileResource;
import org.olat.modules.ModuleConfiguration; import org.olat.modules.ModuleConfiguration;
import org.olat.modules.video.VideoManager; import org.olat.modules.video.VideoManager;
...@@ -71,11 +69,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -71,11 +69,9 @@ import org.springframework.beans.factory.annotation.Autowired;
public class VideoEditController extends ActivateableTabbableDefaultController implements ControllerEventListener { public class VideoEditController extends ActivateableTabbableDefaultController implements ControllerEventListener {
public static final String PANE_TAB_VIDEOCONFIG = "pane.tab.videoconfig"; public static final String PANE_TAB_VIDEOCONFIG = "pane.tab.videoconfig";
private static final String PANE_TAB_ACCESSIBILITY = "pane.tab.accessibility"; private static final String[] paneKeys = { PANE_TAB_VIDEOCONFIG};
private final static String[] paneKeys = { PANE_TAB_VIDEOCONFIG};
public static final String NLS_ERROR_VIDEOREPOENTRYMISSING = "error.videorepoentrymissing"; public static final String NLS_ERROR_VIDEOREPOENTRYMISSING = "error.videorepoentrymissing";
private static final String NLS_CONDITION_ACCESSIBILITY_TITLE = "condition.accessibility.title";
private static final String NLS_COMMAND_CHOOSEVIDEO = "command.choosevideo"; private static final String NLS_COMMAND_CHOOSEVIDEO = "command.choosevideo";
private static final String NLS_COMMAND_CREATEVID = "command.createvideo"; private static final String NLS_COMMAND_CREATEVID = "command.createvideo";
private static final String NLS_COMMAND_CHANGEVID = "command.changevideo"; private static final String NLS_COMMAND_CHANGEVID = "command.changevideo";
...@@ -98,8 +94,8 @@ public class VideoEditController extends ActivateableTabbableDefaultController i ...@@ -98,8 +94,8 @@ public class VideoEditController extends ActivateableTabbableDefaultController i
private TabbedPane myTabbedPane; private TabbedPane myTabbedPane;
private VelocityContainer videoConfigurationVc; private VelocityContainer videoConfigurationVc;
private ModuleConfiguration config;
private final VideoCourseNode videoNode; private final VideoCourseNode videoNode;
private final ModuleConfiguration config;
private RepositoryEntry repositoryEntry; private RepositoryEntry repositoryEntry;
private CloseableModalController cmc; private CloseableModalController cmc;
...@@ -107,10 +103,10 @@ public class VideoEditController extends ActivateableTabbableDefaultController i ...@@ -107,10 +103,10 @@ public class VideoEditController extends ActivateableTabbableDefaultController i
private VideoOptionsForm videoOptionsCtrl; private VideoOptionsForm videoOptionsCtrl;
private ReferencableEntriesSearchController searchController; private ReferencableEntriesSearchController searchController;
public VideoEditController(VideoCourseNode videoNode, UserRequest ureq, WindowControl wControl, ICourse course, UserCourseEnvironment euce) { public VideoEditController(VideoCourseNode videoNode, UserRequest ureq, WindowControl wControl) {
super(ureq, wControl); super(ureq, wControl);
this.config = videoNode.getModuleConfiguration();
this.videoNode = videoNode; this.videoNode = videoNode;
this.config = videoNode.getModuleConfiguration();
main = new Panel("videomain"); main = new Panel("videomain");
...@@ -249,23 +245,7 @@ public class VideoEditController extends ActivateableTabbableDefaultController i ...@@ -249,23 +245,7 @@ public class VideoEditController extends ActivateableTabbableDefaultController i
removeAsListenerAndDispose(cmc); removeAsListenerAndDispose(cmc);
removeAsListenerAndDispose(previewCtrl); removeAsListenerAndDispose(previewCtrl);
boolean autoplay = config.getBooleanSafe(VideoEditController.CONFIG_KEY_AUTOPLAY); VideoDisplayOptions options = videoNode.getVideoDisplay(repositoryEntry, true);
boolean showRating = config.getBooleanSafe(VideoEditController.CONFIG_KEY_RATING);
boolean showComments = config.getBooleanSafe(VideoEditController.CONFIG_KEY_COMMENTS);
VideoDisplayOptions options = VideoDisplayOptions.valueOf(autoplay, showComments, showRating, true, true, false, false, "", true, true);
switch(config.getStringValue(VideoEditController.CONFIG_KEY_DESCRIPTION_SELECT, "none")) {
case "customDescription":
options.setCustomDescription(true);
options.setDescriptionText(config.getStringValue(VideoEditController.CONFIG_KEY_DESCRIPTION_CUSTOMTEXT));
break;
case "none":
options.setShowDescription(false);
break;
default:
break;
}
previewCtrl = new VideoDisplayController(ureq, getWindowControl(), repositoryEntry, null, null, options); previewCtrl = new VideoDisplayController(ureq, getWindowControl(), repositoryEntry, null, null, options);
listenTo(previewCtrl); listenTo(previewCtrl);
cmc = new CloseableModalController(getWindowControl(), translate("close"), previewCtrl.getInitialComponent(), true, translate(NLS_COMMAND_CHOOSEVIDEO)); cmc = new CloseableModalController(getWindowControl(), translate("close"), previewCtrl.getInitialComponent(), true, translate(NLS_COMMAND_CHOOSEVIDEO));
......
...@@ -107,27 +107,9 @@ public class VideoRunController extends BasicController { ...@@ -107,27 +107,9 @@ public class VideoRunController extends BasicController {
showError(VideoEditController.NLS_ERROR_VIDEOREPOENTRYMISSING); showError(VideoEditController.NLS_ERROR_VIDEOREPOENTRYMISSING);
return; return;
} }
// configure the display controller according to config
boolean autoplay = config.getBooleanSafe(VideoEditController.CONFIG_KEY_AUTOPLAY);
boolean comments = config.getBooleanSafe(VideoEditController.CONFIG_KEY_COMMENTS);
boolean ratings = config.getBooleanSafe(VideoEditController.CONFIG_KEY_RATING);
String customtext = config.getStringValue(VideoEditController.CONFIG_KEY_DESCRIPTION_CUSTOMTEXT);
VideoDisplayOptions displayOptions = VideoDisplayOptions.valueOf(autoplay, comments, ratings, true, true, false, false, null, false, userCourseEnv.isCourseReadOnly());
switch(config.getStringValue(VideoEditController.CONFIG_KEY_DESCRIPTION_SELECT,"none")) {
case "customDescription":
displayOptions.setCustomDescription(true);
displayOptions.setDescriptionText(customtext);
break;
case "none":
displayOptions.setShowDescription(false);
break;
default:
break;
}
RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry(); RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
VideoDisplayOptions displayOptions = videoNode.getVideoDisplay(videoEntry, userCourseEnv.isCourseReadOnly());
videoDispCtr = new VideoDisplayController(ureq, getWindowControl(), videoEntry, courseEntry, videoNode, displayOptions); videoDispCtr = new VideoDisplayController(ureq, getWindowControl(), videoEntry, courseEntry, videoNode, displayOptions);
listenTo(videoDispCtr); listenTo(videoDispCtr);
......
...@@ -103,7 +103,6 @@ public class VideoDisplayController extends BasicController { ...@@ -103,7 +103,6 @@ public class VideoDisplayController extends BasicController {
private Integer userPreferredResolution; private Integer userPreferredResolution;
private RepositoryEntry videoEntry; private RepositoryEntry videoEntry;
private String descriptionText;
private String mediaRepoBaseUrl; private String mediaRepoBaseUrl;
private VideoMeta videoMetadata; private VideoMeta videoMetadata;
private VideoMarkers videoMarkers; private VideoMarkers videoMarkers;
...@@ -118,13 +117,9 @@ public class VideoDisplayController extends BasicController { ...@@ -118,13 +117,9 @@ public class VideoDisplayController extends BasicController {
private VideoModule videoModule; private VideoModule videoModule;
@Autowired @Autowired
private VideoManager videoManager; private VideoManager videoManager;
public VideoDisplayController(UserRequest ureq, WindowControl wControl, RepositoryEntry videoEntry, boolean autoWidth) {
this(ureq, wControl, videoEntry, null, null, VideoDisplayOptions.valueOf(false, false, false, true, true, false, autoWidth, null, false, false));
}
public VideoDisplayController(UserRequest ureq, WindowControl wControl, RepositoryEntry videoEntry) { public VideoDisplayController(UserRequest ureq, WindowControl wControl, RepositoryEntry videoEntry) {
this(ureq, wControl, videoEntry, null, null, VideoDisplayOptions.valueOf(false, false, false, true, true, false, false, null, false, false)); this(ureq, wControl, videoEntry, null, null, VideoDisplayOptions.valueOf(false, false, false, true, true, true, videoEntry.getDescription(), false, false));
} }
/** /**
...@@ -141,7 +136,6 @@ public class VideoDisplayController extends BasicController { ...@@ -141,7 +136,6 @@ public class VideoDisplayController extends BasicController {
super(ureq, wControl); super(ureq, wControl);
this.videoEntry = videoEntry; this.videoEntry = videoEntry;
this.displayOptions = displayOptions; this.displayOptions = displayOptions;
this.descriptionText = getDescription(courseNode, displayOptions);
mainVC = createVelocityContainer("video_run"); mainVC = createVelocityContainer("video_run");
putInitialPanel(mainVC); putInitialPanel(mainVC);
...@@ -224,12 +218,6 @@ public class VideoDisplayController extends BasicController { ...@@ -224,12 +218,6 @@ public class VideoDisplayController extends BasicController {
PublisherData data = new PublisherData(VideoFileResource.TYPE_NAME, ores.getResourceableId() + "-" + subIdent, businessPath); PublisherData data = new PublisherData(VideoFileResource.TYPE_NAME, ores.getResourceableId() + "-" + subIdent, businessPath);
return new PublishingInformations(data, ctx); return new PublishingInformations(data, ctx);
} }
private String getDescription(VideoCourseNode courseNode, VideoDisplayOptions options) {
if (options.isCustomDescription()) return options.getDescriptionText();
if (courseNode != null) return courseNode.getLearningObjectives();
return null;
}
public VideoMeta getVideoMetadata() { public VideoMeta getVideoMetadata() {
return videoMetadata; return videoMetadata;
...@@ -425,9 +413,8 @@ public class VideoDisplayController extends BasicController { ...@@ -425,9 +413,8 @@ public class VideoDisplayController extends BasicController {
mainVC.contextPut("masterUrl", masterUrl); mainVC.contextPut("masterUrl", masterUrl);
mainVC.contextPut("title", videoEntry.getDisplayname()); mainVC.contextPut("title", videoEntry.getDisplayname());
if(displayOptions == null || displayOptions.isShowDescription()) { if(displayOptions.isShowDescription()) {
String desc = (StringHelper.containsNonWhitespace(descriptionText) ? descriptionText : videoEntry.getDescription()); setText(displayOptions.getDescriptionText(), "description");
setText(desc, "description");
} }
String authors = videoEntry.getAuthors(); String authors = videoEntry.getAuthors();
......
...@@ -33,7 +33,6 @@ public class VideoDisplayOptions { ...@@ -33,7 +33,6 @@ public class VideoDisplayOptions {
private boolean showRating; private boolean showRating;
private boolean showTitle; private boolean showTitle;
private boolean showDescription; private boolean showDescription;
private boolean customDescription;
private boolean autoWidth; private boolean autoWidth;
private boolean readOnly; private boolean readOnly;
private String descriptionText; private String descriptionText;
...@@ -46,11 +45,10 @@ public class VideoDisplayOptions { ...@@ -46,11 +45,10 @@ public class VideoDisplayOptions {
private boolean authorMode; private boolean authorMode;
public static VideoDisplayOptions valueOf(boolean autoplay, boolean showComments, boolean showRating, boolean showTitle, boolean showDescription, public static VideoDisplayOptions valueOf(boolean autoplay, boolean showComments, boolean showRating, boolean showTitle, boolean showDescription,
boolean customDescription, boolean autoWidth, String descriptionText, boolean authorMode, boolean readOnly) { boolean autoWidth, String descriptionText, boolean authorMode, boolean readOnly) {
VideoDisplayOptions options = new VideoDisplayOptions(); VideoDisplayOptions options = new VideoDisplayOptions();
options.setAutoplay(autoplay); options.setAutoplay(autoplay);
options.setAutoWidth(autoWidth); options.setAutoWidth(autoWidth);
options.setCustomDescription(customDescription);
options.setDescriptionText(descriptionText); options.setDescriptionText(descriptionText);
options.setReadOnly(readOnly); options.setReadOnly(readOnly);
options.setShowComments(showComments); options.setShowComments(showComments);
...@@ -71,7 +69,6 @@ public class VideoDisplayOptions { ...@@ -71,7 +69,6 @@ public class VideoDisplayOptions {
VideoDisplayOptions options = new VideoDisplayOptions(); VideoDisplayOptions options = new VideoDisplayOptions();
options.setAutoplay(false); options.setAutoplay(false);
options.setAutoWidth(false); options.setAutoWidth(false);
options.setCustomDescription(false);
options.setDescriptionText(null); options.setDescriptionText(null);
options.setReadOnly(false); options.setReadOnly(false);
options.setShowComments(false); options.setShowComments(false);
...@@ -167,14 +164,6 @@ public class VideoDisplayOptions { ...@@ -167,14 +164,6 @@ public class VideoDisplayOptions {
public void setShowDescription(boolean showDescription) { public void setShowDescription(boolean showDescription) {
this.showDescription = showDescription; this.showDescription = showDescription;
} }
public boolean isCustomDescription() {
return customDescription;
}
public void setCustomDescription(boolean customDescription) {
this.customDescription = customDescription;
}
public boolean isAutoWidth() { public boolean isAutoWidth() {
return autoWidth; return autoWidth;
......
...@@ -167,7 +167,7 @@ public class VideoListingController extends FormBasicController implements Activ ...@@ -167,7 +167,7 @@ public class VideoListingController extends FormBasicController implements Activ
RepositoryEntrySecurity reSecurity = repositoryManager.isAllowed(ureq, videoEntry); RepositoryEntrySecurity reSecurity = repositoryManager.isAllowed(ureq, videoEntry);
if (reSecurity.canLaunch()) {// no booking implemented for video if (reSecurity.canLaunch()) {// no booking implemented for video
boolean readOnly = videoEntry.getEntryStatus().decommissioned(); boolean readOnly = videoEntry.getEntryStatus().decommissioned();
VideoDisplayOptions options = VideoDisplayOptions.valueOf(true, true, true, true, true, false, true, null, false, readOnly); VideoDisplayOptions options = VideoDisplayOptions.valueOf(true, true, true, true, true, false, videoEntry.getDescription(), false, readOnly);
VideoDisplayController videoDisplayCtr = new VideoDisplayController(ureq, getWindowControl(), videoEntry, null, null, options); VideoDisplayController videoDisplayCtr = new VideoDisplayController(ureq, getWindowControl(), videoEntry, null, null, options);
listenTo(videoDisplayCtr); listenTo(videoDisplayCtr);
toolbarPanel.pushController(videoEntry.getDisplayname(), videoDisplayCtr); toolbarPanel.pushController(videoEntry.getDisplayname(), videoDisplayCtr);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment