From 79398334c47bcc901d7aa8ec0ea845f0df27b2ba Mon Sep 17 00:00:00 2001 From: srosse <none@none> Date: Mon, 12 Nov 2012 11:48:32 +0100 Subject: [PATCH] OO-408: implement the real thing for groups, view the recording in our player... --- .../collaboration/CollaborationTools.java | 50 ++++++- .../course/nodes/OpenMeetingsCourseNode.java | 10 +- .../OpenMeetingsEditFormController.java | 19 +++ .../run/BusinessGroupMainRunController.java | 2 +- .../manager/OpenMeetingsManager.java | 6 +- .../manager/OpenMeetingsManagerImpl.java | 56 ++++---- .../model/OpenMeetingsRecording.java | 19 +++ .../openmeetings/model/OpenMeetingsRoom.java | 12 +- .../ui/OpenMeetingsRecordingController.java | 67 +++++++++ .../ui/OpenMeetingsRecordingsController.java | 133 ++++++++++++++++++ .../ui/OpenMeetingsRecordingsDataModel.java | 93 ++++++++++++ .../ui/OpenMeetingsRoomEditController.java | 29 ++-- .../ui/OpenMeetingsRunController.java | 100 ++++++++++--- .../openmeetings/ui/_content/recording.html | 8 ++ .../openmeetings/ui/_content/room.html | 11 ++ .../ui/_i18n/LocalStrings_de.properties | 6 + .../document/file/OfficeDocumentTest.java | 19 +++ 17 files changed, 572 insertions(+), 68 deletions(-) create mode 100644 src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRecordingController.java create mode 100644 src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRecordingsController.java create mode 100644 src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRecordingsDataModel.java create mode 100644 src/main/java/org/olat/modules/openmeetings/ui/_content/recording.html diff --git a/src/main/java/org/olat/collaboration/CollaborationTools.java b/src/main/java/org/olat/collaboration/CollaborationTools.java index c48e39be98d..28fca5cfadd 100644 --- a/src/main/java/org/olat/collaboration/CollaborationTools.java +++ b/src/main/java/org/olat/collaboration/CollaborationTools.java @@ -90,6 +90,10 @@ import org.olat.modules.fo.archiver.ForumArchiveManager; import org.olat.modules.fo.archiver.formatters.ForumFormatter; import org.olat.modules.fo.archiver.formatters.ForumRTFFormatter; import org.olat.modules.openmeetings.OpenMeetingsModule; +import org.olat.modules.openmeetings.manager.OpenMeetingsException; +import org.olat.modules.openmeetings.manager.OpenMeetingsManager; +import org.olat.modules.openmeetings.model.OpenMeetingsRoom; +import org.olat.modules.openmeetings.model.RoomType; import org.olat.modules.openmeetings.ui.OpenMeetingsRunController; import org.olat.modules.wiki.WikiManager; import org.olat.modules.wiki.WikiSecurityCallback; @@ -566,8 +570,8 @@ public class CollaborationTools implements Serializable { return EPUIFactory.createMapViewController(ureq, wControl, map, secCallback); } - public Controller createOpenMeetingsController(final UserRequest ureq, WindowControl wControl, final BusinessGroup group) { - OpenMeetingsRunController runController = new OpenMeetingsRunController(ureq, wControl, group, null, null, null, true); + public Controller createOpenMeetingsController(final UserRequest ureq, WindowControl wControl, final BusinessGroup group, boolean admin) { + OpenMeetingsRunController runController = new OpenMeetingsRunController(ureq, wControl, group, null, null, null, admin); return runController; } @@ -646,6 +650,19 @@ public class CollaborationTools implements Serializable { * news content */ npm.deleteProperties(null, null, PROP_CAT_BG_COLLABTOOLS, null); + + /* + * Delete OpenMeetings room + */ + OpenMeetingsModule omModule = CoreSpringFactory.getImpl(OpenMeetingsModule.class); + if(omModule.isEnabled()) { + OpenMeetingsManager omManager = CoreSpringFactory.getImpl(OpenMeetingsManager.class); + try { + omManager.deleteAll(ores, null, null); + } catch (OpenMeetingsException e) { + log.error("A room could not be deleted for group: " + ores, e); + } + } /* * and last but not least the cache is reseted @@ -653,6 +670,27 @@ public class CollaborationTools implements Serializable { cacheToolStates.clear(); this.dirty = true; } + + + private void openOpenMeetingsRoom() { + OpenMeetingsModule omModule = CoreSpringFactory.getImpl(OpenMeetingsModule.class); + if(!omModule.isEnabled()) return; + + OpenMeetingsManager omm = CoreSpringFactory.getImpl(OpenMeetingsManager.class); + Long roomId = omm.getRoomId(ores, null, null); + if(roomId == null) { + //create the room + OpenMeetingsRoom room = new OpenMeetingsRoom(); + room.setComment(ores.getDescription()); + room.setModerated(true); + room.setName(ores.getName()); + room.setRecordingAllowed(true); + room.setResourceName(ores.getName()); + room.setSize(25); + room.setType(RoomType.conference.type()); + omm.addRoom(ores, null, null, room); + } + } /** * creates the property if non-existing, or updates the existing property to @@ -667,7 +705,7 @@ public class CollaborationTools implements Serializable { if (cv != null && cv.booleanValue() == toolValue) { return; // nice, cache saved a needless update } - + // handle Boolean Values via String Field in Property DB Table final String toolValueStr = toolValue ? TRUE : FALSE; final PropertyManager pm = PropertyManager.getInstance(); @@ -683,6 +721,12 @@ public class CollaborationTools implements Serializable { // if existing -> update to desired value property.setStringValue(toolValueStr); } + + //create a room if needed + if(toolValue && TOOL_OPENMEETINGS.equals(selectedTool)) { + openOpenMeetingsRoom(); + } + // property becomes persistent pm.saveProperty(property); }}); diff --git a/src/main/java/org/olat/course/nodes/OpenMeetingsCourseNode.java b/src/main/java/org/olat/course/nodes/OpenMeetingsCourseNode.java index ea5dd461ed0..cf9c213df14 100644 --- a/src/main/java/org/olat/course/nodes/OpenMeetingsCourseNode.java +++ b/src/main/java/org/olat/course/nodes/OpenMeetingsCourseNode.java @@ -29,6 +29,8 @@ import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.generic.tabbable.TabbableController; import org.olat.core.id.OLATResourceable; import org.olat.core.id.Roles; +import org.olat.core.logging.OLog; +import org.olat.core.logging.Tracing; import org.olat.core.util.Util; import org.olat.core.util.resource.OresHelper; import org.olat.course.CourseFactory; @@ -45,6 +47,7 @@ import org.olat.course.nodes.openmeetings.OpenMeetingsPeekViewController; import org.olat.course.run.navigation.NodeRunConstructionResult; import org.olat.course.run.userview.NodeEvaluation; import org.olat.course.run.userview.UserCourseEnvironment; +import org.olat.modules.openmeetings.manager.OpenMeetingsException; import org.olat.modules.openmeetings.manager.OpenMeetingsManager; import org.olat.modules.openmeetings.ui.OpenMeetingsRoomEditController; import org.olat.modules.openmeetings.ui.OpenMeetingsRunController; @@ -59,6 +62,7 @@ import org.olat.repository.RepositoryManager; public class OpenMeetingsCourseNode extends AbstractAccessableCourseNode { private static final long serialVersionUID = 8680935159748506305L; + private static final OLog log = Tracing.createLoggerFor(OpenMeetingsCourseNode.class); private static final String TYPE = "openmeetings"; @@ -172,6 +176,10 @@ public class OpenMeetingsCourseNode extends AbstractAccessableCourseNode { OpenMeetingsManager provider = CoreSpringFactory.getImpl(OpenMeetingsManager.class); // remove meeting OLATResourceable ores = OresHelper.createOLATResourceableInstance(course.getResourceableTypeName(), course.getResourceableId()); - provider.deleteAll(null, ores, getIdent()); + try { + provider.deleteAll(null, ores, getIdent()); + } catch (OpenMeetingsException e) { + log.error("A room could not be deleted for course node: " + getIdent() + " of course:" + course, e); + } } } \ No newline at end of file diff --git a/src/main/java/org/olat/course/nodes/openmeetings/OpenMeetingsEditFormController.java b/src/main/java/org/olat/course/nodes/openmeetings/OpenMeetingsEditFormController.java index 9e8303b7cdc..abe52ccd1b1 100644 --- a/src/main/java/org/olat/course/nodes/openmeetings/OpenMeetingsEditFormController.java +++ b/src/main/java/org/olat/course/nodes/openmeetings/OpenMeetingsEditFormController.java @@ -1,3 +1,22 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * 12.10.2011 by frentix GmbH, http://www.frentix.com + * <p> + */ package org.olat.course.nodes.openmeetings; import org.olat.core.CoreSpringFactory; diff --git a/src/main/java/org/olat/group/ui/run/BusinessGroupMainRunController.java b/src/main/java/org/olat/group/ui/run/BusinessGroupMainRunController.java index 7abf57ca7d4..fb1b6160523 100644 --- a/src/main/java/org/olat/group/ui/run/BusinessGroupMainRunController.java +++ b/src/main/java/org/olat/group/ui/run/BusinessGroupMainRunController.java @@ -692,7 +692,7 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, bwControl); ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapPortfolioOres(ce.getOLATResourceable())); - collabToolCtr = collabTools.createOpenMeetingsController(ureq, bwControl, businessGroup); + collabToolCtr = collabTools.createOpenMeetingsController(ureq, bwControl, businessGroup, isAdmin); listenTo(collabToolCtr); mainPanel.setContent(collabToolCtr.getInitialComponent()); //fxdiff VCRP-1,2: access control of resources diff --git a/src/main/java/org/olat/modules/openmeetings/manager/OpenMeetingsManager.java b/src/main/java/org/olat/modules/openmeetings/manager/OpenMeetingsManager.java index 42f426dfe8a..83ab43568bf 100644 --- a/src/main/java/org/olat/modules/openmeetings/manager/OpenMeetingsManager.java +++ b/src/main/java/org/olat/modules/openmeetings/manager/OpenMeetingsManager.java @@ -105,8 +105,10 @@ public interface OpenMeetingsManager { public boolean removeUser(String publicSID); - public boolean checkConnection(String url, String login, String password) throws OpenMeetingsException; + public boolean checkConnection(String url, String login, String password) + throws OpenMeetingsException; - public void deleteAll(BusinessGroup group, OLATResourceable ores, String subIdentifier); + public void deleteAll(BusinessGroup group, OLATResourceable ores, String subIdentifier) + throws OpenMeetingsException; } diff --git a/src/main/java/org/olat/modules/openmeetings/manager/OpenMeetingsManagerImpl.java b/src/main/java/org/olat/modules/openmeetings/manager/OpenMeetingsManagerImpl.java index 48a4b0ca2b7..a8e0fd951a3 100644 --- a/src/main/java/org/olat/modules/openmeetings/manager/OpenMeetingsManagerImpl.java +++ b/src/main/java/org/olat/modules/openmeetings/manager/OpenMeetingsManagerImpl.java @@ -56,8 +56,8 @@ import org.olat.user.UserDataDeletable; import org.openmeetings.app.conference.session.xsd.RoomClient; import org.openmeetings.app.persistence.beans.flvrecord.xsd.FlvRecording; import org.openmeetings.app.persistence.beans.rooms.xsd.Rooms; -import org.openmeetings.axis.services.AddRoomWithModerationAndExternalType; -import org.openmeetings.axis.services.AddRoomWithModerationAndExternalTypeResponse; +import org.openmeetings.axis.services.AddRoomWithModerationAndRecordingFlags; +import org.openmeetings.axis.services.AddRoomWithModerationAndRecordingFlagsResponse; import org.openmeetings.axis.services.CloseRoom; import org.openmeetings.axis.services.CloseRoomResponse; import org.openmeetings.axis.services.DeleteRoom; @@ -68,8 +68,6 @@ import org.openmeetings.axis.services.GetRoomById; import org.openmeetings.axis.services.GetRoomByIdResponse; import org.openmeetings.axis.services.GetRoomWithClientObjectsById; import org.openmeetings.axis.services.GetRoomWithClientObjectsByIdResponse; -import org.openmeetings.axis.services.GetRoomsPublic; -import org.openmeetings.axis.services.GetRoomsPublicResponse; import org.openmeetings.axis.services.GetRoomsWithCurrentUsersByListAndType; import org.openmeetings.axis.services.GetRoomsWithCurrentUsersByListAndTypeResponse; import org.openmeetings.axis.services.GetSession; @@ -107,6 +105,7 @@ public class OpenMeetingsManagerImpl implements OpenMeetingsManager, UserDataDel private final static OLog log = Tracing.createLoggerFor(OpenMeetingsManagerImpl.class); private final static String OM_CATEGORY = "openmeetings_room"; + private final static String GROUP_NAME_PLACEHOLDER = "omgrouptool"; @Autowired private OpenMeetingsModule openMeetingsModule; @@ -365,6 +364,7 @@ public class OpenMeetingsManagerImpl implements OpenMeetingsManager, UserDataDel room.setRoomId(omRoom.getRooms_id()); room.setSize(omRoom.getNumberOfPartizipants()); room.setType(omRoom.getRoomtype().getRoomtypes_id()); + room.setClosed(omRoom.getIsClosed()); return room; } else { return null; @@ -445,6 +445,8 @@ public class OpenMeetingsManagerImpl implements OpenMeetingsManager, UserDataDel rec.setDownloadName(recording.getFileHash()); rec.setDownloadNameAlt(recording.getAlternateDownload()); rec.setPreviewImage(recording.getPreviewImage()); + rec.setWidth(recording.getFlvWidth()); + rec.setHeight(recording.getFlvHeight()); recList.add(rec); } } @@ -481,8 +483,10 @@ public class OpenMeetingsManagerImpl implements OpenMeetingsManager, UserDataDel String sessionId = adminLogin(); RoomServiceStub roomWs = getRoomWebService(); - AddRoomWithModerationAndExternalType omRoom = new AddRoomWithModerationAndExternalType(); + AddRoomWithModerationAndRecordingFlags omRoom = new AddRoomWithModerationAndRecordingFlags(); omRoom.setAppointment(false); + omRoom.setAllowRecording(room.isRecordingAllowed()); + omRoom.setAllowUserQuestions(true); omRoom.setComment(room.getComment()); omRoom.setDemoTime(0); omRoom.setExternalRoomType(getOpenOLATExternalType()); @@ -493,8 +497,9 @@ public class OpenMeetingsManagerImpl implements OpenMeetingsManager, UserDataDel omRoom.setNumberOfPartizipants(room.getSize()); omRoom.setRoomtypes_id(room.getType()); omRoom.setSID(sessionId); + omRoom.setWaitForRecording(true); - AddRoomWithModerationAndExternalTypeResponse addRoomResponse = roomWs.addRoomWithModerationAndExternalType(omRoom); + AddRoomWithModerationAndRecordingFlagsResponse addRoomResponse = roomWs.addRoomWithModerationAndRecordingFlags(omRoom); long returned = addRoomResponse.get_return(); if(returned >= 0) { room.setRoomId(returned); @@ -708,34 +713,21 @@ public class OpenMeetingsManagerImpl implements OpenMeetingsManager, UserDataDel } } - public void getRooms(String sessionId) { + @Override + public void deleteAll(BusinessGroup group, OLATResourceable ores, String subIdentifier) + throws OpenMeetingsException { try { - RoomServiceStub roomsWs = getRoomWebService(); - - GetRoomsPublic getRooms = new GetRoomsPublic(); - getRooms.setSID(sessionId); - - GetRoomsPublicResponse getRoomsResponse = roomsWs.getRoomsPublic(getRooms); - Rooms[] rooms = getRoomsResponse.get_return(); - if(rooms != null) { - System.out.println(rooms.length); - for(Rooms room : rooms) { - if(room == null) { - System.out.println("Room is null"); - } else { - System.out.println(room.getName()); - } + Long roomId = getRoomId(group, ores, subIdentifier); + if(roomId != null) { + OpenMeetingsRoom room = getRoom(group, ores, subIdentifier); + if(room != null) { + deleteRoom(room); } } - } catch (Exception e) { - e.printStackTrace(); + } catch (OpenMeetingsException e) { + } } - - @Override - public void deleteAll(BusinessGroup group, OLATResourceable ores, String subIdentifier) { - // - } @Override public boolean checkConnection(String url, String login, String password) @@ -764,6 +756,9 @@ public class OpenMeetingsManagerImpl implements OpenMeetingsManager, UserDataDel } private final Property getProperty(BusinessGroup group, OLATResourceable courseResource, String subIdentifier) { + if(group != null && subIdentifier == null) { + subIdentifier = GROUP_NAME_PLACEHOLDER;//name is mandatory + } return propertyManager.findProperty(null, group, courseResource, OM_CATEGORY, subIdentifier); } @@ -783,6 +778,9 @@ public class OpenMeetingsManagerImpl implements OpenMeetingsManager, UserDataDel private final Property createProperty(final BusinessGroup group, final OLATResourceable courseResource, String subIdentifier, OpenMeetingsRoom room) { String serialized = serializeRoom(room); long roomId = room.getRoomId(); + if(group != null && subIdentifier == null) { + subIdentifier = GROUP_NAME_PLACEHOLDER;//name is mandatory + } return propertyManager.createPropertyInstance(null, group, courseResource, OM_CATEGORY, subIdentifier, null, roomId, null, serialized); } diff --git a/src/main/java/org/olat/modules/openmeetings/model/OpenMeetingsRecording.java b/src/main/java/org/olat/modules/openmeetings/model/OpenMeetingsRecording.java index 7f7f8e0b82e..0697590a43c 100644 --- a/src/main/java/org/olat/modules/openmeetings/model/OpenMeetingsRecording.java +++ b/src/main/java/org/olat/modules/openmeetings/model/OpenMeetingsRecording.java @@ -35,6 +35,9 @@ public class OpenMeetingsRecording { private String downloadNameAlt; private String previewImage; + private long width; + private long height; + public long getRoomId() { return roomId; @@ -83,6 +86,22 @@ public class OpenMeetingsRecording { public void setPreviewImage(String previewImage) { this.previewImage = previewImage; } + + public long getWidth() { + return width; + } + + public void setWidth(long width) { + this.width = width; + } + + public long getHeight() { + return height; + } + + public void setHeight(long height) { + this.height = height; + } diff --git a/src/main/java/org/olat/modules/openmeetings/model/OpenMeetingsRoom.java b/src/main/java/org/olat/modules/openmeetings/model/OpenMeetingsRoom.java index f336fb12247..df3a73e7ec7 100644 --- a/src/main/java/org/olat/modules/openmeetings/model/OpenMeetingsRoom.java +++ b/src/main/java/org/olat/modules/openmeetings/model/OpenMeetingsRoom.java @@ -36,6 +36,7 @@ public class OpenMeetingsRoom { private long size; private boolean moderated; private boolean recordingAllowed; + private boolean closed; private transient Property property; private transient int numOfUsers; @@ -128,7 +129,12 @@ public class OpenMeetingsRoom { public void setResourceName(String resourceName) { this.resourceName = resourceName; } - - - + + public boolean isClosed() { + return closed; + } + + public void setClosed(boolean closed) { + this.closed = closed; + } } diff --git a/src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRecordingController.java b/src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRecordingController.java new file mode 100644 index 00000000000..e1587a01d39 --- /dev/null +++ b/src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRecordingController.java @@ -0,0 +1,67 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * 12.10.2011 by frentix GmbH, http://www.frentix.com + * <p> + */ +package org.olat.modules.openmeetings.ui; + +import org.olat.core.CoreSpringFactory; +import org.olat.core.gui.UserRequest; +import org.olat.core.gui.components.Component; +import org.olat.core.gui.components.velocity.VelocityContainer; +import org.olat.core.gui.control.Event; +import org.olat.core.gui.control.WindowControl; +import org.olat.core.gui.control.controller.BasicController; +import org.olat.modules.openmeetings.manager.OpenMeetingsManager; +import org.olat.modules.openmeetings.model.OpenMeetingsRecording; + +/** + * + * Initial date: 12.11.2012<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class OpenMeetingsRecordingController extends BasicController { + + private final VelocityContainer mainVC; + + + public OpenMeetingsRecordingController(UserRequest ureq, WindowControl wControl, OpenMeetingsRecording recording) { + super(ureq, wControl); + + mainVC = createVelocityContainer("recording"); + + OpenMeetingsManager openMeetingsManager = CoreSpringFactory.getImpl(OpenMeetingsManager.class); + String url = openMeetingsManager.getRecordingURL(recording, null); + mainVC.contextPut("recordingUrl", url); + mainVC.contextPut("width", new Long(recording.getWidth())); + mainVC.contextPut("height", new Long(recording.getHeight())); + + + putInitialPanel(mainVC); + } + + @Override + protected void doDispose() { + // + } + + @Override + protected void event(UserRequest ureq, Component source, Event event) { + // + } +} diff --git a/src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRecordingsController.java b/src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRecordingsController.java new file mode 100644 index 00000000000..761514a03ac --- /dev/null +++ b/src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRecordingsController.java @@ -0,0 +1,133 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * 12.10.2011 by frentix GmbH, http://www.frentix.com + * <p> + */ +package org.olat.modules.openmeetings.ui; + +import java.util.List; + +import org.olat.core.CoreSpringFactory; +import org.olat.core.gui.UserRequest; +import org.olat.core.gui.components.Component; +import org.olat.core.gui.components.table.DefaultColumnDescriptor; +import org.olat.core.gui.components.table.StaticColumnDescriptor; +import org.olat.core.gui.components.table.TableController; +import org.olat.core.gui.components.table.TableEvent; +import org.olat.core.gui.components.table.TableGuiConfiguration; +import org.olat.core.gui.control.Controller; +import org.olat.core.gui.control.Event; +import org.olat.core.gui.control.WindowControl; +import org.olat.core.gui.control.controller.BasicController; +import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController; +import org.olat.core.gui.translator.Translator; +import org.olat.modules.openmeetings.manager.OpenMeetingsException; +import org.olat.modules.openmeetings.manager.OpenMeetingsManager; +import org.olat.modules.openmeetings.model.OpenMeetingsRecording; +import org.olat.user.UserManager; + +/** + * + * Initial date: 12.11.2012<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class OpenMeetingsRecordingsController extends BasicController { + + private TableController tableCtr; + private CloseableModalController cmc; + private OpenMeetingsRecordingController recordingController; + + private final long roomId; + private final OpenMeetingsManager openMeetingsManager; + + public OpenMeetingsRecordingsController(UserRequest ureq, WindowControl wControl, long roomId) { + super(ureq, wControl); + + this.roomId = roomId; + openMeetingsManager = CoreSpringFactory.getImpl(OpenMeetingsManager.class); + + TableGuiConfiguration tableConfig = new TableGuiConfiguration(); + tableConfig.setTableEmptyMessage(translate("users.empty")); + + Translator trans = UserManager.getInstance().getPropertyHandlerTranslator(getTranslator()); + tableCtr = new TableController(tableConfig, ureq, getWindowControl(), trans); + listenTo(tableCtr); + + tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("room.name", OpenMeetingsRecordingsDataModel.Col.name.ordinal(), null, getLocale())); + tableCtr.addColumnDescriptor(new StaticColumnDescriptor("download", "download", translate("download"))); + tableCtr.addColumnDescriptor(new StaticColumnDescriptor("view", "view", translate("view"))); + tableCtr.setTableDataModel(new OpenMeetingsRecordingsDataModel()); + loadModel(); + + putInitialPanel(tableCtr.getInitialComponent()); + } + + private void loadModel() { + try { + List<OpenMeetingsRecording> recordings = openMeetingsManager.getRecordings(roomId); + ((OpenMeetingsRecordingsDataModel)tableCtr.getTableDataModel()).setObjects(recordings); + tableCtr.modelChanged(); + } catch (OpenMeetingsException e) { + showError(e.getType().i18nKey()); + } + } + + @Override + protected void doDispose() { + // + } + + @Override + protected void event(UserRequest ureq, Component source, Event event) { + // + } + + @Override + protected void event(UserRequest ureq, Controller source, Event event) { + if(source == tableCtr) { + if(event instanceof TableEvent) { + TableEvent e = (TableEvent)event; + int row = e.getRowId(); + OpenMeetingsRecording recording = (OpenMeetingsRecording)tableCtr.getTableDataModel().getObject(row); + if("download".equals(e.getActionId())) { + doDownload(ureq, recording); + }else if("view".equals(e.getActionId())) { + doView(ureq, recording); + } + } + } + } + + private void doView(UserRequest ureq, OpenMeetingsRecording recording) { + removeAsListenerAndDispose(recordingController); + removeAsListenerAndDispose(cmc); + + recordingController = new OpenMeetingsRecordingController(ureq, getWindowControl(), recording); + listenTo(recordingController); + + String name = recording.getFilename(); + cmc = new CloseableModalController(getWindowControl(), translate("close"), recordingController.getInitialComponent(), true, name); + listenTo(cmc); + cmc.activate(); + } + + private void doDownload(UserRequest ureq, OpenMeetingsRecording recording) { + String url = openMeetingsManager.getRecordingURL(recording, null); + System.out.println(url); + } +} diff --git a/src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRecordingsDataModel.java b/src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRecordingsDataModel.java new file mode 100644 index 00000000000..aec959e4f1c --- /dev/null +++ b/src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRecordingsDataModel.java @@ -0,0 +1,93 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * 12.10.2011 by frentix GmbH, http://www.frentix.com + * <p> + */ +package org.olat.modules.openmeetings.ui; + +import java.util.ArrayList; +import java.util.List; + +import org.olat.core.gui.components.table.TableDataModel; +import org.olat.modules.openmeetings.model.OpenMeetingsRecording; + +/** + * + * Initial date: 12.11.2012<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class OpenMeetingsRecordingsDataModel implements TableDataModel<OpenMeetingsRecording> { + + private List<OpenMeetingsRecording> recordings; + + public OpenMeetingsRecordingsDataModel() { + // + } + + public OpenMeetingsRecordingsDataModel(List<OpenMeetingsRecording> recordings) { + this.recordings = recordings; + } + + @Override + public int getColumnCount() { + return 0; + } + + @Override + public int getRowCount() { + return recordings == null ? 0 : recordings.size(); + } + + @Override + public Object getValueAt(int row, int col) { + OpenMeetingsRecording recording = getObject(row); + switch(Col.values()[col]) { + case name: return recording.getFilename(); + default: return "ERROR"; + } + } + + @Override + public OpenMeetingsRecording getObject(int row) { + return recordings.get(row); + } + + @Override + public void setObjects(List<OpenMeetingsRecording> objects) { + recordings = new ArrayList<OpenMeetingsRecording>(objects); + } + + @Override + public OpenMeetingsRecordingsDataModel createCopyWithEmptyList() { + return new OpenMeetingsRecordingsDataModel(); + } + + public enum Col { + name("recording.name"); + + private final String i18nKey; + + private Col(String i18nKey) { + this.i18nKey = i18nKey; + } + + public String getI18nKey() { + return i18nKey; + } + } +} diff --git a/src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRoomEditController.java b/src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRoomEditController.java index 74d923494dc..06400ae49be 100644 --- a/src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRoomEditController.java +++ b/src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRoomEditController.java @@ -22,6 +22,7 @@ package org.olat.modules.openmeetings.ui; import org.olat.core.CoreSpringFactory; import org.olat.core.gui.UserRequest; import org.olat.core.gui.components.form.flexible.FormItemContainer; +import org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement; import org.olat.core.gui.components.form.flexible.elements.SingleSelection; import org.olat.core.gui.components.form.flexible.elements.TextElement; import org.olat.core.gui.components.form.flexible.impl.FormBasicController; @@ -49,16 +50,14 @@ public class OpenMeetingsRoomEditController extends FormBasicController { private SingleSelection roomTypeEl; private SingleSelection roomSizeEl; private SingleSelection moderationModeEl; - private SingleSelection recordingEl; + private MultipleSelectionElement recordingEl; private TextElement commentEl; private final String[] roomTypeKeys; - private final String[] roomTypeValues; private final String[] roomSizes; private final String[] moderationModeKeys; - private final String[] moderationModeValues; private final String[] recordingKeys = {"xx"}; - private final String[] recordingValues = {"???"}; + private final BusinessGroup group; private final OLATResourceable ores; @@ -78,14 +77,7 @@ public class OpenMeetingsRoomEditController extends FormBasicController { roomTypeKeys = new String[]{ RoomType.conference.typeStr(), RoomType.audience.typeStr(), RoomType.restricted.typeStr(), RoomType.interview.typeStr() }; - roomTypeValues = new String[]{ - translate(RoomType.conference.i18nKey()), translate(RoomType.audience.i18nKey()), translate(RoomType.restricted.i18nKey()), translate(RoomType.interview.i18nKey()) - }; - - roomSizes = new String[]{"16", "100"}; - moderationModeKeys = new String[]{"yes", "no"}; - moderationModeValues = new String[]{ translate("room.moderation.yes"), translate("room.moderation.no") }; openMeetingsManager = CoreSpringFactory.getImpl(OpenMeetingsManager.class); try { @@ -93,6 +85,12 @@ public class OpenMeetingsRoomEditController extends FormBasicController { } catch (OpenMeetingsException e) { showError(e.getType().i18nKey()); } + + if(room != null && room.getSize() != 16 && room.getSize() != 100) { + roomSizes = new String[]{"16", Long.toString(room.getSize()), "100"}; + } else { + roomSizes = new String[]{"16", "100"}; + } initForm(ureq); } @@ -106,6 +104,9 @@ public class OpenMeetingsRoomEditController extends FormBasicController { String name = room == null ? "" : room.getName(); roomNameEl = uifactory.addTextElement("roomname", "room.name", 255, name, formLayout); + String[] roomTypeValues = new String[]{ + translate(RoomType.conference.i18nKey()), translate(RoomType.audience.i18nKey()), translate(RoomType.restricted.i18nKey()), translate(RoomType.interview.i18nKey()) + }; roomTypeEl = uifactory.addDropdownSingleselect("roomtype", "room.type", formLayout, roomTypeKeys, roomTypeValues, null); if(room != null) { String type = Long.toString(room.getType()); @@ -118,13 +119,15 @@ public class OpenMeetingsRoomEditController extends FormBasicController { roomSizeEl.select(size, true); } + String[] moderationModeValues = new String[]{ translate("room.moderation.yes"), translate("room.moderation.no") }; moderationModeEl = uifactory.addDropdownSingleselect("moderationmode", "room.moderation.mode", formLayout, moderationModeKeys, moderationModeValues, null); if(room != null) { String key = room.isModerated() ? moderationModeKeys[0] : moderationModeKeys[1]; moderationModeEl.select(key, true); }; - recordingEl = uifactory.addDropdownSingleselect("recording", "room.recording", formLayout, recordingKeys, recordingValues, null); + String[] recordingValues = new String[]{ translate("room.recording") }; + recordingEl = uifactory.addCheckboxesHorizontal("recording", "room.recording", formLayout, recordingKeys, recordingValues, null); if(room != null) { String key = room.isRecordingAllowed() ? recordingKeys[0] : recordingKeys[1]; recordingEl.select(key, true); @@ -153,7 +156,7 @@ public class OpenMeetingsRoomEditController extends FormBasicController { room.setComment(commentEl.getValue()); room.setModerated(moderationModeEl.isOneSelected() && moderationModeEl.isSelected(0)); room.setName(roomNameEl.getValue()); - room.setRecordingAllowed(recordingEl.isOneSelected() && recordingEl.isSelected(0)); + room.setRecordingAllowed(recordingEl.isAtLeastSelected(1)); if(roomSizeEl.isOneSelected()) { String key = roomSizeEl.getSelectedKey(); if(StringHelper.isLong(key)) { diff --git a/src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRunController.java b/src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRunController.java index 64e3b4df418..5430c739b5f 100644 --- a/src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRunController.java +++ b/src/main/java/org/olat/modules/openmeetings/ui/OpenMeetingsRunController.java @@ -19,8 +19,6 @@ */ package org.olat.modules.openmeetings.ui; -import java.util.List; - import org.olat.core.CoreSpringFactory; import org.olat.core.gui.UserRequest; import org.olat.core.gui.components.Component; @@ -39,7 +37,7 @@ import org.olat.group.BusinessGroup; import org.olat.modules.openmeetings.OpenMeetingsModule; import org.olat.modules.openmeetings.manager.OpenMeetingsException; import org.olat.modules.openmeetings.manager.OpenMeetingsManager; -import org.olat.modules.openmeetings.model.OpenMeetingsRecording; +import org.olat.modules.openmeetings.model.OpenMeetingsRoom; /** * @@ -49,36 +47,36 @@ import org.olat.modules.openmeetings.model.OpenMeetingsRecording; */ public class OpenMeetingsRunController extends BasicController { - private Link openLink, closeLink, startLink, startGuestLink; + private Link openLink, closeLink, startLink, startGuestLink, recordingLink, membersLink, editLink; private VelocityContainer mainVC; private CloseableModalController cmc; private OpenMeetingsGuestController guestController; + private OpenMeetingsRecordingsController recordingsController; + private OpenMeetingsAdminRoomMembersController membersController; + private OpenMeetingsRoomEditController editController; private final boolean admin; private final Long roomId; private final OpenMeetingsModule openMeetingsModule; private final OpenMeetingsManager openMeetingsManager; + + private final BusinessGroup group; + private final OLATResourceable ores; + private final String subIdentifier; public OpenMeetingsRunController(UserRequest ureq, WindowControl wControl, BusinessGroup group, OLATResourceable ores, String subIdentifier, String resourceName, boolean admin) { super(ureq, wControl); this.admin = admin; + this.group = group; + this.ores = ores; + this.subIdentifier = subIdentifier; + openMeetingsModule = CoreSpringFactory.getImpl(OpenMeetingsModule.class); openMeetingsManager = CoreSpringFactory.getImpl(OpenMeetingsManager.class); roomId = openMeetingsManager.getRoomId(group, ores, subIdentifier); - - try { - List<OpenMeetingsRecording> recList = openMeetingsManager.getRecordings(roomId); - for(OpenMeetingsRecording rec:recList) { - System.out.println(openMeetingsManager.getRecordingURL(rec, null)); - } - System.out.println(recList); - } catch (OpenMeetingsException e) { - e.printStackTrace(); - } - mainVC = createVelocityContainer("room"); init(ureq); @@ -89,7 +87,7 @@ public class OpenMeetingsRunController extends BasicController { if(!openMeetingsModule.isEnabled()) { mainVC.contextPut("disabled", Boolean.TRUE); } else if(roomId == null) { - mainVC.contextPut("norroom", Boolean.TRUE); + mainVC.contextPut("noroom", Boolean.TRUE); } else if (ureq.getUserSession().getRoles().isGuestOnly() || ureq.getUserSession().getRoles().isInvitee()){ startGuestLink = LinkFactory.createButton("start.room.guest", mainVC, this); mainVC.put("start.room.guest", startGuestLink); @@ -100,7 +98,17 @@ public class OpenMeetingsRunController extends BasicController { closeLink = LinkFactory.createButton("close.room", mainVC, this); mainVC.put("close.room", closeLink); + + membersLink = LinkFactory.createButton("room.members", mainVC, this); + mainVC.put("room.members", membersLink); + + editLink = LinkFactory.createButton("edit", mainVC, this); + mainVC.put("edit", editLink); } + + recordingLink = LinkFactory.createButton("recordings", mainVC, this); + mainVC.put("open.recordings", recordingLink); + startLink = LinkFactory.createButton("start.room", mainVC, this); startLink.setTarget("openmeetings"); mainVC.put("start.room", startLink); @@ -123,6 +131,12 @@ public class OpenMeetingsRunController extends BasicController { doOpen(ureq); } else if(source == closeLink) { doClose(ureq); + } else if(source == recordingLink) { + doOpenRecordings(ureq); + } else if(source == membersLink) { + doOpenMembers(ureq); + } else if(source == editLink) { + doEdit(ureq); } } @@ -136,6 +150,19 @@ public class OpenMeetingsRunController extends BasicController { } cmc.deactivate(); cleanupPopups(); + } else if (source == recordingsController) { + cmc.deactivate(); + cleanupPopups(); + } else if(source == membersController) { + cmc.deactivate(); + cleanupPopups(); + } else if(source == editController) { + if(event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) { + //do something + System.out.println("Room edited"); + } + cmc.deactivate(); + cleanupPopups(); } else if(source == cmc) { cleanupPopups(); } @@ -144,8 +171,14 @@ public class OpenMeetingsRunController extends BasicController { private void cleanupPopups() { removeAsListenerAndDispose(guestController); + removeAsListenerAndDispose(recordingsController); + removeAsListenerAndDispose(membersController); + removeAsListenerAndDispose(editController); removeAsListenerAndDispose(cmc); guestController = null; + editController = null; + recordingsController = null; + membersController = null; cmc = null; } @@ -165,6 +198,41 @@ public class OpenMeetingsRunController extends BasicController { } } + private void doOpenRecordings(UserRequest ureq) { + cleanupPopups(); + recordingsController = new OpenMeetingsRecordingsController(ureq, getWindowControl(), roomId); + listenTo(recordingsController); + + cmc = new CloseableModalController(getWindowControl(), translate("close"), recordingsController.getInitialComponent(), true, translate("recordings")); + listenTo(cmc); + cmc.activate(); + } + + private void doOpenMembers(UserRequest ureq) { + cleanupPopups(); + try { + OpenMeetingsRoom room = openMeetingsManager.getRoom(group, ores, subIdentifier); + membersController = new OpenMeetingsAdminRoomMembersController(ureq, getWindowControl(), room); + listenTo(membersController); + + cmc = new CloseableModalController(getWindowControl(), translate("close"), membersController.getInitialComponent(), true, translate("room.members")); + listenTo(cmc); + cmc.activate(); + } catch (OpenMeetingsException e) { + showError(e.getType().i18nKey()); + } + } + + private void doEdit(UserRequest ureq) { + cleanupPopups(); + editController = new OpenMeetingsRoomEditController(ureq, getWindowControl(), group, ores, subIdentifier, "", true); + listenTo(editController); + + cmc = new CloseableModalController(getWindowControl(), translate("close"), editController.getInitialComponent(), true, translate("edit")); + listenTo(cmc); + cmc.activate(); + } + private void doStartAsGuest(UserRequest ureq) { cleanupPopups(); guestController = new OpenMeetingsGuestController(ureq, getWindowControl()); diff --git a/src/main/java/org/olat/modules/openmeetings/ui/_content/recording.html b/src/main/java/org/olat/modules/openmeetings/ui/_content/recording.html new file mode 100644 index 00000000000..518ac222726 --- /dev/null +++ b/src/main/java/org/olat/modules/openmeetings/ui/_content/recording.html @@ -0,0 +1,8 @@ +<p> + <span id="olatFlashMovieViewer0" class="olatFlashMovieViewer" style="display: block; border: solid 1px #000; width:${width}px; height:${height}px;"> + <script src='$r.staticLink("movie/player.js")'></script> + <script>// <![CDATA[ + BPlayer.insertPlayer("$recordingUrl","olatFlashMovieViewer0",$width,$height,"00:00:00.000",0,"video",undefined,false,false,true);// + // ]]></script> + </span> +</p> \ No newline at end of file diff --git a/src/main/java/org/olat/modules/openmeetings/ui/_content/room.html b/src/main/java/org/olat/modules/openmeetings/ui/_content/room.html index 4a7350da417..fafbc9cc3ec 100644 --- a/src/main/java/org/olat/modules/openmeetings/ui/_content/room.html +++ b/src/main/java/org/olat/modules/openmeetings/ui/_content/room.html @@ -8,6 +8,17 @@ $r.render("close.room") #end + #if($r.available("open.recordings")) + $r.render("open.recordings") + #end + + #if($r.available("room.members")) + $r.render("room.members") + #end + + #if($r.available("edit")) + $r.render("edit") + #end #if($r.available("start.room.guest")) $r.render("start.room.guest") diff --git a/src/main/java/org/olat/modules/openmeetings/ui/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/modules/openmeetings/ui/_i18n/LocalStrings_de.properties index 16bdd6e6ddc..e36833fc3d2 100644 --- a/src/main/java/org/olat/modules/openmeetings/ui/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/modules/openmeetings/ui/_i18n/LocalStrings_de.properties @@ -19,9 +19,14 @@ openmeetings.account=Konfiguration openmeetings.title=OpenMeetings openmeetings.intro=Apache OpenMeetings v2.0 Konfiguration openmeetings.module.enabled=Modul "OpenMeetings" +download=Herunterladen +view=Ansehen table.empty=Kein Raum wurde gefunden. +recording.name=Name +recordings=Aufzeichnungen rooms.title=Raum room.comment=Kommentar +room.members=Mitglieder room.name=Name des Raums room.type=Typ von Raum room.type.conference=Conference @@ -36,6 +41,7 @@ room.recording=Recording room.resource=Ressourcen room.numOfUsers=#Benutzer room.infos=Detailinformationen +room.recording=Recording allowed start.room=Zum Raum gehen start.room.guest=Zum Raum gehen open.room=Offnen diff --git a/src/test/java/org/olat/search/service/document/file/OfficeDocumentTest.java b/src/test/java/org/olat/search/service/document/file/OfficeDocumentTest.java index 4a92bd3e9e9..7d57b409e51 100644 --- a/src/test/java/org/olat/search/service/document/file/OfficeDocumentTest.java +++ b/src/test/java/org/olat/search/service/document/file/OfficeDocumentTest.java @@ -1,3 +1,22 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * 12.10.2011 by frentix GmbH, http://www.frentix.com + * <p> + */ package org.olat.search.service.document.file; import java.io.File; -- GitLab