Index: lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java =================================================================== diff -u -rb883de594943eb26d71846e2259212980b524a32 -rd98b61a50b1a6f7cbaf419e9904fc4eebe91ac5d --- lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java (.../AuthoringService.java) (revision b883de594943eb26d71846e2259212980b524a32) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java (.../AuthoringService.java) (revision d98b61a50b1a6f7cbaf419e9904fc4eebe91ac5d) @@ -610,6 +610,14 @@ return flashMessage.serializeMessage(); } + /** @see org.lamsfoundation.lams.authoring.service.IAuthoringService#copyToolContent(java.lang.Long) */ + public String copyToolContent(Long toolContentID) throws IOException + { + Long newContentID = lamsCoreToolService.notifyToolToCopyContent(toolContentID); + FlashMessage flashMessage = new FlashMessage("copyToolContent", newContentID); + return flashMessage.serializeMessage(); + } + /** @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getAvailableLicenses() */ public Vector getAvailableLicenses() { List licenses = licenseDAO.findAll(License.class); Index: lams_central/src/java/org/lamsfoundation/lams/authoring/service/IAuthoringService.java =================================================================== diff -u -rb883de594943eb26d71846e2259212980b524a32 -rd98b61a50b1a6f7cbaf419e9904fc4eebe91ac5d --- lams_central/src/java/org/lamsfoundation/lams/authoring/service/IAuthoringService.java (.../IAuthoringService.java) (revision b883de594943eb26d71846e2259212980b524a32) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/service/IAuthoringService.java (.../IAuthoringService.java) (revision d98b61a50b1a6f7cbaf419e9904fc4eebe91ac5d) @@ -170,6 +170,19 @@ */ public String getToolContentID(Long toolID) throws IOException; + /** + * Calls an appropriate tool to copy the content indicated by toolContentId. + * Returns a string representing the new tool content id in WDDX format. + * + * The is called when the user copies and pastes a tool activity icon in authoring. + * It should only be called on a ToolActivity - never a Gate or Grouping or + * Complex activity. + * + * @param toolContentID The toolContentID indicating the content to copy + * @return String The new tool content id in WDDX Format + */ + public String copyToolContent(Long toolContentID) throws IOException; + /** Get the available licenses. This will include our supported Creative Common * licenses and an "OTHER" license which may be used for user entered license details. * The picture url supplied should be a full URL i.e. if it was a relative URL in the Index: lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java =================================================================== diff -u -rb883de594943eb26d71846e2259212980b524a32 -rd98b61a50b1a6f7cbaf419e9904fc4eebe91ac5d --- lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java (.../AuthoringAction.java) (revision b883de594943eb26d71846e2259212980b524a32) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java (.../AuthoringAction.java) (revision d98b61a50b1a6f7cbaf419e9904fc4eebe91ac5d) @@ -40,6 +40,7 @@ import org.lamsfoundation.lams.util.audit.IAuditService; import org.lamsfoundation.lams.util.wddx.FlashMessage; import org.lamsfoundation.lams.web.action.LamsDispatchAction; +import org.lamsfoundation.lams.web.util.AttributeNames; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; @@ -171,6 +172,24 @@ } + /** Copy some existing content. Used when the user copies an activity in authoring. + * Expects one parameters - toolContentId (the content to be copied) */ + public ActionForward copyToolContent(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException { + + String wddxPacket; + IAuthoringService authoringService = getAuthoringService(); + try { + long toolContentID = WebUtil.readLongParam(request,AttributeNames.PARAM_TOOL_CONTENT_ID); + wddxPacket = authoringService.copyToolContent(toolContentID); + } catch (Exception e) { + wddxPacket = handleException(e, "copyToolContent", authoringService).serializeMessage(); + } + return outputPacket(mapping, request, response, wddxPacket, "details"); + + } /** * This method returns a list of all available license in * WDDX format. Index: lams_documents/lams_common/AuthoringDesign.doc =================================================================== diff -u -r0c62152cd2a1687e5f3ed94e191cc4b32198fb79 -rd98b61a50b1a6f7cbaf419e9904fc4eebe91ac5d Binary files differ