diff --git a/api/src/java/org/sakaiproject/bbb/api/BBBMeetingManager.java b/api/src/java/org/sakaiproject/bbb/api/BBBMeetingManager.java index a85a21c8..97281cf9 100644 --- a/api/src/java/org/sakaiproject/bbb/api/BBBMeetingManager.java +++ b/api/src/java/org/sakaiproject/bbb/api/BBBMeetingManager.java @@ -218,6 +218,12 @@ public boolean deleteRecordings(String meetingID, String recordID) public boolean publishRecordings(String meetingID, String recordID, String publish) throws SecurityException, BBBException; + /** + * Protect and unprotect recordings using the *_______________* api command + */ + public boolean protectRecordings(String meetingID, String recordID, + String protect) throws SecurityException, BBBException; + /** * Check if meeting is ready to be joined. */ diff --git a/bundle/src/resources/ToolMessages.properties b/bundle/src/resources/ToolMessages.properties index 75f9fcdb..b6ae7b2c 100644 --- a/bundle/src/resources/ToolMessages.properties +++ b/bundle/src/resources/ToolMessages.properties @@ -53,6 +53,10 @@ bbb_action_show_tooltip = Click to make this recording visible for Students bbb_action_delete_recording = Delete bbb_action_delete_recording_tooltip = Click to delete this recordings from the server bbb_action_delete_recording_question = Are you sure you want to delete permanently this recording {0}?\n\nClick OK to continue. +bbb_action_protect = Protect +bbb_action_unprotect = Unprotect +bbb_action_protect_tooltip = Click to make this recording protected +bbb_action_unprotect_tooltip = Click to unprotect this recording bbb_recording_status_hidden = Unpublished bbb_recording_status_shown = Published bbb_recording_thumbnails_hidden = Only for published recordings @@ -216,6 +220,8 @@ bbb_err_get_recording = Failed to get recordings from server bbb_err_delete_recording = Failed to delete recording {0} bbb_err_publish_recording = Failed to publish recording {0} bbb_err_unpublish_recording = Failed to unpublish recording {0} +bbb_err_protect_recording = Failed to protect recording {0} +bbb_err_unprotect_recording = Failed to unprotect recording {0} bbb_err_unreachable_server = Unreachable server bbb_err_meeting_description_too_long = The meeting description must be {0} characters or shorter, this one has {1} diff --git a/bundle/src/resources/ToolMessages_en.properties b/bundle/src/resources/ToolMessages_en.properties index d47dd161..511846c5 100644 --- a/bundle/src/resources/ToolMessages_en.properties +++ b/bundle/src/resources/ToolMessages_en.properties @@ -53,6 +53,10 @@ bbb_action_show_tooltip = Click to make this recording visible for Students bbb_action_delete_recording = Delete bbb_action_delete_recording_tooltip = Click to delete this recordings from the server bbb_action_delete_recording_question = Are you sure you want to delete permanently this recording {0}?\n\nClick OK to continue. +bbb_action_protect = Protect +bbb_action_unprotect = Unprotect +bbb_action_protect_tooltip = Click to make this recording protected +bbb_action_unprotect_tooltip = Click to unprotect this recording bbb_recording_status_hidden = Unpublished bbb_recording_status_shown = Published bbb_recording_thumbnails_hidden = Only for published recordings @@ -214,6 +218,8 @@ bbb_err_get_recording = Failed to get recordings from server bbb_err_delete_recording = Failed to delete recording {0} bbb_err_publish_recording = Failed to publish recording {0} bbb_err_unpublish_recording = Failed to unpublish recording {0} +bbb_err_protect_recording = Failed to protect recording {0} +bbb_err_unprotect_recording = Failed to unprotect recording {0} bbb_err_unreachable_server = Unreachable server bbb_err_meeting_description_too_long = The meeting description must be {0} characters or shorter, this one has {1} diff --git a/bundle/src/resources/ToolMessages_en_US.properties b/bundle/src/resources/ToolMessages_en_US.properties index cd4a052a..2eaa90a2 100644 --- a/bundle/src/resources/ToolMessages_en_US.properties +++ b/bundle/src/resources/ToolMessages_en_US.properties @@ -53,6 +53,10 @@ bbb_action_show_tooltip = Click to make this recording visible for Students bbb_action_delete_recording = Delete bbb_action_delete_recording_tooltip = Click to delete this recordings from the server bbb_action_delete_recording_question = Are you sure you want to delete permanently this recording {0}?\n\nClick OK to continue. +bbb_action_protect = Protect +bbb_action_unprotect = Unprotect +bbb_action_protect_tooltip = Click to make this recording protected +bbb_action_unprotect_tooltip = Click to unprotect this recording bbb_recording_status_hidden = Unpublished bbb_recording_status_shown = Published bbb_recording_thumbnails_hidden = Only for published recordings @@ -214,6 +218,8 @@ bbb_err_get_recording = Failed to get recordings from server bbb_err_delete_recording = Failed to delete recording {0} bbb_err_publish_recording = Failed to publish recording {0} bbb_err_unpublish_recording = Failed to unpublish recording {0} +bbb_err_protect_recording = Failed to protect recording {0} +bbb_err_unprotect_recording = Failed to unprotect recording {0} bbb_err_unreachable_server = Unreachable server bbb_err_meeting_description_too_long = The meeting description must be {0} characters or shorter, this one has {1} diff --git a/impl/src/java/org/sakaiproject/bbb/impl/BBBAPIWrapper.java b/impl/src/java/org/sakaiproject/bbb/impl/BBBAPIWrapper.java index 2f916b8b..b1c87d91 100644 --- a/impl/src/java/org/sakaiproject/bbb/impl/BBBAPIWrapper.java +++ b/impl/src/java/org/sakaiproject/bbb/impl/BBBAPIWrapper.java @@ -324,6 +324,21 @@ public boolean publishRecordings(String meetingID, String recordingID, String pu return publishRecordingsResponse; } + public boolean protectRecordings(String meetingID, String recordingID, String protect) + throws BBBException { + if (logger.isDebugEnabled()) logger.debug("protectRecordings()"); + + boolean protectRecordingsResponse = false; + + if ( api != null ) { + protectRecordingsResponse = api.protectRecordings(meetingID, recordingID, protect); + } else { + throw new BBBException(BBBException.MESSAGEKEY_INTERNALERROR, "Internal tool configuration error"); + } + + return protectRecordingsResponse; + } + public boolean deleteRecordings(String meetingID, String recordingID) throws BBBException { if (logger.isDebugEnabled()) logger.debug("publishRecordings()"); diff --git a/impl/src/java/org/sakaiproject/bbb/impl/BBBMeetingManagerImpl.java b/impl/src/java/org/sakaiproject/bbb/impl/BBBMeetingManagerImpl.java index ad378dce..c1b8324b 100644 --- a/impl/src/java/org/sakaiproject/bbb/impl/BBBMeetingManagerImpl.java +++ b/impl/src/java/org/sakaiproject/bbb/impl/BBBMeetingManagerImpl.java @@ -491,6 +491,12 @@ public boolean publishRecordings(String meetingID, String recordID, String publi return bbbAPI.publishRecordings(meetingID, recordID, publish); } + public boolean protectRecordings(String meetingID, String recordID, String protect) + throws SecurityException, BBBException { + // protect or unprotect the recording + return bbbAPI.protectRecordings(meetingID, recordID, protect); + } + public void checkJoinMeetingPreConditions(BBBMeeting meeting) throws BBBException { // check if meeting is within dates diff --git a/impl/src/java/org/sakaiproject/bbb/impl/bbbapi/BBBAPI.java b/impl/src/java/org/sakaiproject/bbb/impl/bbbapi/BBBAPI.java index 65ff68cd..73a58c8f 100644 --- a/impl/src/java/org/sakaiproject/bbb/impl/bbbapi/BBBAPI.java +++ b/impl/src/java/org/sakaiproject/bbb/impl/bbbapi/BBBAPI.java @@ -27,6 +27,8 @@ public interface BBBAPI { public boolean publishRecordings(String meetingID, String recordID, String publish) throws BBBException; + public boolean protectRecordings(String meetingID, String recordID, String protect) throws BBBException; + public String getJoinMeetingURL(String meetingID, User user, String password); public void makeSureMeetingExists(BBBMeeting meeting) throws BBBException; diff --git a/impl/src/java/org/sakaiproject/bbb/impl/bbbapi/BaseBBBAPI.java b/impl/src/java/org/sakaiproject/bbb/impl/bbbapi/BaseBBBAPI.java index 5cf1482e..5449f503 100644 --- a/impl/src/java/org/sakaiproject/bbb/impl/bbbapi/BaseBBBAPI.java +++ b/impl/src/java/org/sakaiproject/bbb/impl/bbbapi/BaseBBBAPI.java @@ -96,6 +96,7 @@ public class BaseBBBAPI implements BBBAPI { protected final static String APICALL_VERSION = ""; protected final static String APICALL_GETRECORDINGS = "getRecordings"; protected final static String APICALL_PUBLISHRECORDINGS = "publishRecordings"; + protected final static String APICALL_PROTECTRECORDINGS = "updateRecordings"; protected final static String APICALL_DELETERECORDINGS = "deleteRecordings"; // API Response Codes @@ -236,7 +237,6 @@ public BBBMeeting createMeeting(final BBBMeeting meeting) StringBuilder presentationUrl = new StringBuilder(config.getServerUrl()); presentationUrl.append(meeting.getPresentation()); xml_presentation = " "; - logger.debug(xml_presentation); } } @@ -415,6 +415,26 @@ public boolean publishRecordings(String meetingID, String recordID, String publi return true; } + /** Protect/Unprotect a recording on BBB server */ + public boolean protectRecordings(String meetingID, String recordID, String protect) + throws BBBException { + StringBuilder query = new StringBuilder(); + query.append("recordID="); + query.append(recordID); + query.append("&protect="); + query.append(protect); + query.append(getCheckSumParameterForQuery(APICALL_PROTECTRECORDINGS, query.toString())); + + try { + doAPICall(APICALL_PROTECTRECORDINGS, query.toString()); + + } catch (BBBException e) { + throw e; + } + + return true; + } + /** Build the join meeting url based on user role */ public String getJoinMeetingURL(String meetingID, User user, String password) { String userDisplayName, userId; @@ -687,7 +707,7 @@ protected Map processNode(Node _node) { } if (nodeName == "preview"){ Node n = node.getChildNodes().item(0); - map.put(nodeName, processNode(n)); + map.put(nodeName, new ArrayList(processNode(n).values())); }else{ map.put(nodeName, list); } diff --git a/tool/src/java/org/sakaiproject/bbb/tool/entity/BBBMeetingEntityProvider.java b/tool/src/java/org/sakaiproject/bbb/tool/entity/BBBMeetingEntityProvider.java index 5d04a46f..cfed4ef8 100644 --- a/tool/src/java/org/sakaiproject/bbb/tool/entity/BBBMeetingEntityProvider.java +++ b/tool/src/java/org/sakaiproject/bbb/tool/entity/BBBMeetingEntityProvider.java @@ -803,6 +803,34 @@ public String publishRecordings(Map params) { } + @EntityCustomAction(viewKey = EntityView.VIEW_LIST) + public String protectRecordings(Map params) { + if (logger.isDebugEnabled()) + logger.debug("protectRecordings"); + String meetingID = (String) params.get("meetingID"); + String recordID = (String) params.get("recordID"); + String protect = (String) params.get("protect"); + if (meetingID == null) { + throw new IllegalArgumentException("Missing required parameter [meetingID]"); + } + if (recordID == null) { + throw new IllegalArgumentException("Missing required parameter [recordID]"); + } + if (protect == null) { + throw new IllegalArgumentException("Missing required parameter [protect]"); + } + + try { + return Boolean.toString(meetingManager.protectRecordings(meetingID, + recordID, protect)); + } catch (BBBException e) { + String ref = Entity.SEPARATOR + BBBMeetingManager.ENTITY_PREFIX + + Entity.SEPARATOR + meetingID; + throw new EntityException(e.getPrettyMessage(), ref, 400); + } + + } + @EntityCustomAction(viewKey = EntityView.VIEW_LIST) public String deleteRecordings(Map params) { if (logger.isDebugEnabled()) @@ -1038,7 +1066,7 @@ private String getHtmlForJoining(String joinUrl, String meetingId, boolean waitf @EntityCustomAction(viewKey = EntityView.VIEW_LIST) public ActionReturn getGroups(Map params) { if(logger.isDebugEnabled()) - logger.debug("Getting Groups"); + logger.debug("getGroups"); String meetingID = (String) params.get("meetingID"); if (meetingID == null) { diff --git a/tool/src/webapp/WEB-INF/bootstrap.vm b/tool/src/webapp/WEB-INF/bootstrap.vm index d7190bdb..dcd352c3 100644 --- a/tool/src/webapp/WEB-INF/bootstrap.vm +++ b/tool/src/webapp/WEB-INF/bootstrap.vm @@ -188,32 +188,30 @@  |  ${D}{bbb_action_delete_recording} {/if} + {if r.canDelete} + {if r.protected} +  |  + {if r.protected == 'true'} + ${D}{bbb_action_unprotect} + {else} + ${D}{bbb_action_protect} + {/if} + {/if} + {/if}
- {for p in r.playback} - {if p.preview && r.published == 'true'} - {if p.preview.image1} - - ${D}{p.preview.image1.title} - - {/if} - {if p.preview.image2} - - ${D}{p.preview.image2.title} - - {/if} - {if p.preview.image3} - - ${D}{p.preview.image3.title} - - {/if} - {else if p.preview} - ${D}{bbb_recording_thumbnails_hidden} - {/if} - {/for} + {if r.images && r.published == 'true'} + {for image in r.images} + + ${D}{image.title} + + {/for} + {elseif r.images} + ${D}{bbb_recording_thumbnails_hidden} + {/if}
diff --git a/tool/src/webapp/js/bbb.js b/tool/src/webapp/js/bbb.js index 84a6b3ca..a1fbfa26 100644 --- a/tool/src/webapp/js/bbb.js +++ b/tool/src/webapp/js/bbb.js @@ -492,10 +492,19 @@ meetings.switchState = function (state, arg) { meetings.refreshRecordingList(); // watch for permissions changes, check meeting dates - for(var i=0,j=meetings.currentRecordings.length;i images.length){ + images = meetings.currentRecordings[i].playback[j].preview; + } + } + if(images.length){ + meetings.currentRecordings[i].images = images; + } + } meetings.utils.render('bbb_recordings_template',{'recordings':meetings.currentRecordings,'stateFunction':'recordings'},'bbb_content'); var $rows = $('#bbb_recording_table tbody tr'); diff --git a/tool/src/webapp/js/bbb_utils.js b/tool/src/webapp/js/bbb_utils.js index f4a5d548..711191bd 100644 --- a/tool/src/webapp/js/bbb_utils.js +++ b/tool/src/webapp/js/bbb_utils.js @@ -601,7 +601,7 @@ meetings.switchState('recordings_meeting',{'meetingId':meetingID}); }, error : function (xmlHttpRequest,status,error) { - if( action == 'PUBLISH' ) + if( action == 'true' ) var msg = bbb_err_publish_recording(recordID); else var msg = bbb_err_unpublish_recording(recordID); @@ -610,6 +610,37 @@ }); }; + meetings.utils.protectRecordings = function (meetingID, recordID, stateFunction) { + meetings.utils.updateRecordings(meetingID, recordID, "true", stateFunction); + }; + + meetings.utils.unprotectRecordings = function (meetingID, recordID, stateFunction) { + meetings.utils.updateRecordings(meetingID, recordID, "false", stateFunction); + } + + // Protect the specified recording from the BigBlueButton server. + meetings.utils.updateRecordings = function (meetingID, recordID, action, stateFunction) { + + jQuery.ajax({ + url : "/direct/bbb-tool/protectRecordings?meetingID=" + meetingID + "&recordID=" + recordID + "&protect=" + action, + dataType:'text', + type: "GET", + success : function (result) { + if(stateFunction == 'recordings') + meetings.switchState('recordings'); + else + meetings.switchState('recordings_meeting',{'meetingID':meetingID}); + }, + error : function (xmlHttpRequest,status,error) { + if( action == 'true' ) + var msg = bbb_err_protect_recording(recordID); + else + var msg = bbb_err_unprotect_recording(recordID); + meetings.utils.handleError(msg, xmlHttpRequest.status, xmlHttpRequest.statusText); + } + }); + }; + //Get meetings from BBB server meetings.utils.getMeetings = function () { var meetingsInfo;