Index: lams_tool_larsrc/conf/language/ApplicationResources.properties =================================================================== diff -u -r2699ca5080d7ebf1fbcd84c3f5060428b6fbb192 -r754e5e666cf510aff7f8f25527987cee00319ee2 --- lams_tool_larsrc/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 2699ca5080d7ebf1fbcd84c3f5060428b6fbb192) +++ lams_tool_larsrc/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 754e5e666cf510aff7f8f25527987cee00319ee2) @@ -1,5 +1,5 @@ # CVS ID: $Id$ # -# Language strings for the Forum tool. +# Language strings for the Shared resources tool. # ========== Values for tool and library activity. Sent to Flash as part of the learning design toolkit. ====== activity.title=Shared Resources activity.description=Sharing resource with others. @@ -90,21 +90,16 @@ #---------------------------------Monitoring ----------------------------------# page.title.monitoring.content.userlist=Summary -page.title.monitoring.view.user.mark=View user mark -page.title.monitoring.edit.user.mark=Edit user mark page.title.monitoring.view.activity=View Activity page.title.monitoring.edit.activity=Edit Activity page.title.monitoring.view.instructions=View Instructions page.title.monitoring.view.topic=View topic page.title.monitoring.statistic=Statistic -page.title.monitoring.definelater=Forum Tool Define label.monitoring.edit.activity.cancel=Cancel label.monitoring.edit.activity.update=Update label.monitoring.edit.activity.edit=Edit -label.monitoring.statistic.average.mark= Average message mark -lable.monitoring.statistic.total.message=# of total message message.monitoring.edit.activity.not.editable=This Activity is no longer editable #------------------------------End Monitoring ----------------------------------# @@ -119,29 +114,10 @@ error.uploading = error uploading error.mark.needNumber= Mark must be int value error.mark.invalid.number= Mark is invalid number format -error.fail.get.forum=No Forum available error.title.empty=Title can not be blank #General Messages message.msg.maxFileSize = Max 250K -##Message -title.messageTopic.open = Topic Details - -title.message.add = Add Message -title.message.open = View Message -title.message.reply = Reply Message -title.message.edit = Edit Message -title.message.view=Message Board -title.message.view.topic=View Message -title.message.delete=Delete Message - -message.label.subject = Subject -message.label.body = Body -message.label.attachment = Attachment -message.label.postedOn = Posted On: -message.label.threadReplies = Thread Replies -message.link.reply = Reply - ##Labels label.open = Open label.delete = Delete @@ -151,9 +127,7 @@ label.reply = Reply label.done = Done label.finish= Finish -label.newtopic= New Topic label.refresh= Refresh -lable.char.left=Characters left label.basic=Basic label.advanced=Advanced label.instructions=Instructions @@ -176,27 +150,20 @@ monitoring.tab.edit.activity=Edit Activity monitoring.user.post.topic=provides following posts: -lable.topic.title.comment=Comment message.not.avaliable=Not Available -lable.update.mark=Update mark message.assign.mark= Please assign a mark and a comment for the report by message.session.name=Session Name message.monitoring.summary.no.users=No users available message.view.all.marks=View all marks message.download.marks=Download marks -label.monitoring.summary.view.forum= View forum #new messages 6/3/06 message.monitoring.summary.no.session=No Session Available -#new messages 7/3/06 -topic.message.subject.hidden=Message subject hidden -topic.message.body.hidden=Message body hidden label.show=Show label.hide=Hide #new messages 10/3/06 -page.title.monitoring.init=Forum Monitoring monitoring.tab.statistics=Statistics # NB monitoring.tab.edit.statistics was removed label.save=Save Index: lams_tool_larsrc/conf/xdoclet/struts-actions.xml =================================================================== diff -u -r0c4f17efc49e7012360fb98ac98b7e4a005fea9f -r754e5e666cf510aff7f8f25527987cee00319ee2 --- lams_tool_larsrc/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 0c4f17efc49e7012360fb98ac98b7e4a005fea9f) +++ lams_tool_larsrc/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 754e5e666cf510aff7f8f25527987cee00319ee2) @@ -1,5 +1,13 @@ + + + + + + + resourceList = getResourceList(request); + List resourceList = getResourceItemList(request); ResourceItem item = resourceList.get(itemIdx); request.getSession().setAttribute(ResourceConstants.ATT_LEARNING_OBJECT,item); } @@ -154,9 +167,9 @@ private ActionForward removeItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { int itemIdx = NumberUtils.stringToInt(request.getParameter(ResourceConstants.PARAM_ITEM_INDEX),-1); if(itemIdx != -1){ - List resourceList = getResourceList(request); + List resourceList = getResourceItemList(request); ResourceItem item = resourceList.remove(itemIdx); - List delList = getDeletedResourceList(request); + List delList = getDeletedResourceItemList(request); delList.add(item); } return mapping.findForward(ResourceConstants.SUCCESS); @@ -166,10 +179,10 @@ int itemIdx = NumberUtils.stringToInt(request.getParameter(ResourceConstants.PARAM_ITEM_INDEX),-1); ResourceItem item = null; if(itemIdx != -1){ - List resourceList = getResourceList(request); + List resourceList = getResourceItemList(request); item = resourceList.get(itemIdx); if(item != null){ - popuplateItemToForm(itemIdx, item,(ResourceItemForm) form,request); + populateItemToForm(itemIdx, item,(ResourceItemForm) form,request); } } return findForward(item==null?-1:item.getType(),mapping); @@ -254,44 +267,66 @@ //****************************************************************************************************************** // Resource Author functions //****************************************************************************************************************** - - private ActionForward initPage(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { - + /** + * Read resource data from database and put them into HttpSession. It will redirect to init.do directly after this + * method run successfully. + * + * This method will avoid read database again and lost un-saved resouce item lost when user "refresh page", + * + */ + private ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { + //save toolContentID into HTTPSession Long contentId = new Long(WebUtil.readLongParam(request,ResourceConstants.PARAM_TOOL_CONTENT_ID)); - ResourceForm resourceForm = (ResourceForm)form; - //get back the topic list and display them on page + request.getSession().setAttribute(ResourceConstants.ATTR_TOOL_CONTENT_ID,contentId); + +// get back the resource and item list and display them on page IResourceService service = getResourceService(); - Set item = null; + List items = null; Resource resource = null; + ResourceForm resourceForm = (ResourceForm)form; try { resource = service.getResourceByContentId(contentId); //if resource does not exist, try to use default content instead. if(resource == null){ resource = service.getDefaultContent(contentId); if(resource.getResourceItems() != null){ - item = resource.getResourceItems(); + items = new ArrayList(resource.getResourceItems()); }else - item = null; + items = null; }else - item = service.getAuthoredItems(resource.getUid()); + items = service.getAuthoredItems(resource.getUid()); + + resourceForm.setResource(resource); + //initialize instruction attachment list List attachmentList = getAttachmentList(request); + attachmentList.clear(); attachmentList.addAll(resource.getAttachments()); - - resourceForm.setResource(resource); } catch (Exception e) { log.error(e); return mapping.findForward("error"); } - //set back STRUTS component value //init it to avoid null exception in following handling - if(item == null) - item = new HashSet(); - request.getSession().setAttribute(ResourceConstants.ATTR_RESOURCE_LIST, new ArrayList(item)); + if(items == null) + items = new ArrayList(); + + //init resource item list + List resourceItemList = getResourceItemList(request); + resourceItemList.clear(); + resourceItemList.addAll(items); + return mapping.findForward(ResourceConstants.SUCCESS); } + + + + private ActionForward initPage(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + + return mapping.findForward(ResourceConstants.SUCCESS); + } /** * This method will persist all inforamtion in this authoring page, include all resource item, information etc. * @@ -337,7 +372,7 @@ } resourcePO.setCreatedBy(resourceUser); - //**********************************Handle Attachement********************* + //**********************************Handle Authoring Instruction Attachement ********************* //merge attachment info Set attPOSet = resourcePO.getAttachments(); if(attPOSet == null) @@ -381,7 +416,7 @@ //************************* Handle resource items ******************* //Handle resource items Set itemList = new LinkedHashSet(); - List topics = getResourceList(request); + List topics = getResourceItemList(request); iter = topics.iterator(); while(iter.hasNext()){ ResourceItem item = (ResourceItem) iter.next(); @@ -394,7 +429,7 @@ } resourcePO.setResourceItems(itemList); //delete them from database. - List delResourceItemList = getDeletedResourceList(request); + List delResourceItemList = getDeletedResourceItemList(request); iter = delResourceItemList.iterator(); while(iter.hasNext()){ ResourceItem item = (ResourceItem) iter.next(); @@ -404,6 +439,16 @@ if(item.getFileUuid() != null && item.getFileVersionId() != null) service.deleteFromRepository(item.getFileUuid(),item.getFileVersionId()); } + //handle resource item attachment file: + List delItemAttList = getDeletedItemAttachmentList(request); + iter = delItemAttList.iterator(); + while(iter.hasNext()){ + ResourceItem delAtt = (ResourceItem) iter.next(); + iter.remove(); + //delete from repository + service.deleteFromRepository(delAtt.getFileUuid(),delAtt.getFileVersionId()); + } + //********************************************** //finally persist resourcePO again service.saveOrUpdateResource(resourcePO); @@ -648,17 +693,27 @@ * @param request * @return */ - private List getResourceList(HttpServletRequest request) { - return getListFromSession(request,ResourceConstants.ATTR_RESOURCE_LIST); + private List getResourceItemList(HttpServletRequest request) { + return getListFromSession(request,ResourceConstants.ATTR_RESOURCE_ITEM_LIST); } /** * List save deleted resource items, which could be persisted or non-persisted items. * @param request * @return */ - private List getDeletedResourceList(HttpServletRequest request) { - return getListFromSession(request,ResourceConstants.ATTR_DELETED_RESOURCE_LIST); + private List getDeletedResourceItemList(HttpServletRequest request) { + return getListFromSession(request,ResourceConstants.ATTR_DELETED_RESOURCE_ITEM_LIST); } + /** + * If a resource item has attahment file, and the user edit this item and change the attachment + * to new file, then the old file need be deleted when submitting the whole authoring page. + * Save the file uuid and version id into ResourceItem object for temporarily use. + * @param request + * @return + */ + private List getDeletedItemAttachmentList(HttpServletRequest request) { + return getListFromSession(request,ResourceConstants.ATTR_DELETED_RESOURCE_ITEM_ATTACHMENT_LIST); + } /** @@ -728,7 +783,15 @@ } return forward; } - private void popuplateItemToForm(int itemIdx, ResourceItem item, ResourceItemForm form, HttpServletRequest request) { + + /** + * This method will populate resource item information to its form for edit use. + * @param itemIdx + * @param item + * @param form + * @param request + */ + private void populateItemToForm(int itemIdx, ResourceItem item, ResourceItemForm form, HttpServletRequest request) { form.setDescription(item.getDescription()); form.setTitle(item.getTitle()); form.setUrl(item.getUrl()); @@ -744,6 +807,14 @@ for(int idx=0;idx var removeInstructionUrl = ""; var addInstructionUrl = ""; + var removeItemAttachmentUrl = ""; @@ -36,7 +37,12 @@ - + + +
+ <%@ include file="/pages/authoring/parts/itemattachment.jsp"%> +
+ @@ -54,7 +60,10 @@ <%@ include file="instructions.jsp" %> - + + " class="buttonStyle"> + + " class="buttonStyle"> Index: lams_tool_larsrc/web/pages/authoring/parts/addlearningobject.jsp =================================================================== diff -u -rca5f4ba9be98d3653d3820b885376003c6bf2b55 -r754e5e666cf510aff7f8f25527987cee00319ee2 --- lams_tool_larsrc/web/pages/authoring/parts/addlearningobject.jsp (.../addlearningobject.jsp) (revision ca5f4ba9be98d3653d3820b885376003c6bf2b55) +++ lams_tool_larsrc/web/pages/authoring/parts/addlearningobject.jsp (.../addlearningobject.jsp) (revision 754e5e666cf510aff7f8f25527987cee00319ee2) @@ -14,6 +14,8 @@ <%-- user for rsrcresourceitem.js --%> var removeInstructionUrl = ""; var addInstructionUrl = ""; + var removeItemAttachmentUrl = ""; + @@ -42,7 +44,12 @@ - + + +
+ <%@ include file="/pages/authoring/parts/itemattachment.jsp"%> +
+ @@ -60,7 +67,10 @@ <%@ include file="instructions.jsp" %> - + + " class="buttonStyle"> + + " class="buttonStyle"> Index: lams_tool_larsrc/web/pages/authoring/parts/addwebsite.jsp =================================================================== diff -u -rca5f4ba9be98d3653d3820b885376003c6bf2b55 -r754e5e666cf510aff7f8f25527987cee00319ee2 --- lams_tool_larsrc/web/pages/authoring/parts/addwebsite.jsp (.../addwebsite.jsp) (revision ca5f4ba9be98d3653d3820b885376003c6bf2b55) +++ lams_tool_larsrc/web/pages/authoring/parts/addwebsite.jsp (.../addwebsite.jsp) (revision 754e5e666cf510aff7f8f25527987cee00319ee2) @@ -14,6 +14,8 @@ <%-- user for rsrcresourceitem.js --%> var removeInstructionUrl = ""; var addInstructionUrl = ""; + var removeItemAttachmentUrl = ""; + @@ -42,7 +44,12 @@ - + + +
+ <%@ include file="/pages/authoring/parts/itemattachment.jsp"%> +
+ @@ -60,7 +67,10 @@ <%@ include file="instructions.jsp" %> - + + " class="buttonStyle"> + + " class="buttonStyle"> Index: lams_tool_larsrc/web/pages/authoring/parts/instructions.jsp =================================================================== diff -u -ra0999444e5cac377c2e02a67a3583c84e8e82ca2 -r754e5e666cf510aff7f8f25527987cee00319ee2 --- lams_tool_larsrc/web/pages/authoring/parts/instructions.jsp (.../instructions.jsp) (revision a0999444e5cac377c2e02a67a3583c84e8e82ca2) +++ lams_tool_larsrc/web/pages/authoring/parts/instructions.jsp (.../instructions.jsp) (revision 754e5e666cf510aff7f8f25527987cee00319ee2) @@ -4,7 +4,7 @@
- +
- - -
@@ -16,17 +16,24 @@
${status.index+1} - - - + + + <%-- Don't display down icon if last line --%> + + + + + - - - + + <%-- Don't display down icon if last line --%> + + + + + + Index: lams_tool_larsrc/web/pages/authoring/parts/itemattachment.jsp =================================================================== diff -u --- lams_tool_larsrc/web/pages/authoring/parts/itemattachment.jsp (revision 0) +++ lams_tool_larsrc/web/pages/authoring/parts/itemattachment.jsp (revision 754e5e666cf510aff7f8f25527987cee00319ee2) @@ -0,0 +1,23 @@ +<%@ include file="/common/taglibs.jsp" %> + + + + + + + + +
+ + + + + + + +
+
+ + + +
Index: lams_tool_larsrc/web/pages/authoring/start.jsp =================================================================== diff -u --- lams_tool_larsrc/web/pages/authoring/start.jsp (revision 0) +++ lams_tool_larsrc/web/pages/authoring/start.jsp (revision 754e5e666cf510aff7f8f25527987cee00319ee2) @@ -0,0 +1,12 @@ +<%@ include file="/common/taglibs.jsp" %> + + + + + + + + + \ No newline at end of file