Index: lams_tool_larsrc/conf/language/ApplicationResources.properties =================================================================== diff -u -r962368626dedf96b0d7c3bf5028905a97988356b -rfc7f983fbdc263b826831b5b6f4839290f7ef964 --- lams_tool_larsrc/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 962368626dedf96b0d7c3bf5028905a97988356b) +++ lams_tool_larsrc/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision fc7f983fbdc263b826831b5b6f4839290f7ef964) @@ -1,21 +1,21 @@ # CVS ID: $Id$ # -# Language strings for the Shared resources tool. +# Language strings for the Share resources tool. # ========== Values for tool and library activity. Sent to Flash as part of the learning design toolkit. ====== -activity.title=Shared Resources +activity.title=Share Resources activity.description=Sharing resource with others. activity.helptext=Uploading your resources to share with others. -tool.display.name=Shared Resources Tool +tool.display.name=Share Resources Tool tool.description=Tool for sharing resources. #=========================labels===========================# -appName = Shared Resources +appName = Share Resources errorPage.title=Error page errorPage.heading=Some error occurs when handling your request #=========================labels===========================# #-------------------------Authoring Labels-----------------# -label.authoring.heading = Shared Resources -label.author.title=Shared Resources Authoring +label.authoring.heading = Share Resources +label.author.title=Share Resources Authoring label.authoring.heading.basic=Basic label.authoring.heading.advance=Advance @@ -91,6 +91,7 @@ error.msg.file.not.found=File not found exception occurs when uploading file. error.msg.ims.package=Invalid IMS package format. error.msg.ims.application=ImscpApplicationException occurs when uploading resource item file. +error.msg.website.no.initial.file=Website zip can not find out initial file (index.htm/html or default.htm/html). error.msg.io.exception=IOException occurs when uploading file. error.msg.invaid.param.upload=InvalidParameterException occured while trying to upload File. error.msg.repository=Repository occurs exception while trying to upload file. @@ -100,11 +101,11 @@ msg.no.instruction=No instruction available. #-------------------------END Authoring Labels END-----------------# #------------------------------Learner ----------------------------------# -label.learning.title=Shared Resource Learning -label.learning.heading=Shared Resources +label.learning.title=Share Resource Learning +label.learning.heading=Share Resources label.resoruce.to.review=Resources to view label.learning.minimum.review=You must view at least {0} of the resources. -lable.learning.minimum.view.number.less=You at least view other {0} of the resources. +lable.learning.minimum.view.number.less=You at least view another {0} of the resources. label.check.for.new=Check for new label.suggest.new=Suggest a new label.learning.new.file=New file details: @@ -138,7 +139,7 @@ #------------------------------End Monitoring ----------------------------------# export.label.resource=Resource export.label.no.learning.object=No offline package available -export.title=Export portfolio of Shared Resource +export.title=Export portfolio of Share Resource export.init.resource=Initial Resources ## errors Index: lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/service/ResourceServiceImpl.java =================================================================== diff -u -r00546fef27c802810d1b2ac3d621f9c3e2d64cb0 -rfc7f983fbdc263b826831b5b6f4839290f7ef964 --- lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/service/ResourceServiceImpl.java (.../ResourceServiceImpl.java) (revision 00546fef27c802810d1b2ac3d621f9c3e2d64cb0) +++ lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/service/ResourceServiceImpl.java (.../ResourceServiceImpl.java) (revision fc7f983fbdc263b826831b5b6f4839290f7ef964) @@ -596,6 +596,9 @@ if(item.getType() == ResourceConstants.RESOURCE_TYPE_WEBSITE){ String packageDirectory = ZipFileUtil.expandZip(is, fileName); String initFile = findWebsiteInitialItem(packageDirectory); + if(initFile == null){ + throw new UploadResourceFileException(messageService.getMessage("error.msg.website.no.initial.file")); + } item.setInitialItem(initFile); //upload package NodeKey nodeKey = processPackage(packageDirectory,initFile); @@ -645,7 +648,7 @@ private String findWebsiteInitialItem(String packageDirectory) { File file = new File(packageDirectory); if(!file.isDirectory()) - return ""; + return null; File[] initFiles = file.listFiles(new FileFilter(){ public boolean accept(File pathname) { @@ -663,7 +666,7 @@ if(initFiles != null && initFiles.length > 0) return initFiles[0].getName(); else - return ""; + return null; } Index: lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/web/action/ViewItemAction.java =================================================================== diff -u -rf44c4b85fd2563394f045ad28218d3c0b5cbb9da -rfc7f983fbdc263b826831b5b6f4839290f7ef964 --- lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/web/action/ViewItemAction.java (.../ViewItemAction.java) (revision f44c4b85fd2563394f045ad28218d3c0b5cbb9da) +++ lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/web/action/ViewItemAction.java (.../ViewItemAction.java) (revision fc7f983fbdc263b826831b5b6f4839290f7ef964) @@ -35,6 +35,7 @@ import javax.servlet.http.HttpSession; import org.apache.commons.lang.math.NumberUtils; +import org.apache.log4j.Logger; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; @@ -52,7 +53,11 @@ import org.springframework.web.context.support.WebApplicationContextUtils; public class ViewItemAction extends Action { - + + private static final Logger log = Logger.getLogger(ViewItemAction.class); + private static final String DEFUALT_PROTOCOL_REFIX = "http://"; + private static final String ALLOW_PROTOCOL_REFIX = new String("[http://|https://|ftp://|nntp://]"); + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { @@ -151,7 +156,7 @@ String url = null; switch (type) { case ResourceConstants.RESOURCE_TYPE_URL: - url = item.getUrl(); + url = protocol(item.getUrl()); break; case ResourceConstants.RESOURCE_TYPE_FILE: url = "/download/?uuid="+item.getFileUuid()+"&preferDownload=false"; @@ -166,6 +171,23 @@ return url; } /** + * If there is not url prefix, such as http://, https:// or ftp:// etc, this + * method will add default url protocol. + * + * @param url + * @return + */ + private String protocol(String url) { + if(url == null) + return ""; + + if(!url.matches("^" + ALLOW_PROTOCOL_REFIX + ".*")) + url = DEFUALT_PROTOCOL_REFIX + url; + + return url; + } + + /** * List save current resource items. * @param request * @return Index: lams_tool_larsrc/web/pages/itemreview/mainframe.jsp =================================================================== diff -u -r318b6abe8422efe8b6bac112c6dc0fd15ba13873 -rfc7f983fbdc263b826831b5b6f4839290f7ef964 --- lams_tool_larsrc/web/pages/itemreview/mainframe.jsp (.../mainframe.jsp) (revision 318b6abe8422efe8b6bac112c6dc0fd15ba13873) +++ lams_tool_larsrc/web/pages/itemreview/mainframe.jsp (.../mainframe.jsp) (revision fc7f983fbdc263b826831b5b6f4839290f7ef964) @@ -19,7 +19,7 @@ http://www.gnu.org/licenses/gpl.txt --%> <%@ include file="/common/taglibs.jsp" %> - + " name=headerFrame" marginheight="0" scrolling="NO"> Index: lams_tool_larsrc/web/pages/learning/learning.jsp =================================================================== diff -u -r00546fef27c802810d1b2ac3d621f9c3e2d64cb0 -rfc7f983fbdc263b826831b5b6f4839290f7ef964 --- lams_tool_larsrc/web/pages/learning/learning.jsp (.../learning.jsp) (revision 00546fef27c802810d1b2ac3d621f9c3e2d64cb0) +++ lams_tool_larsrc/web/pages/learning/learning.jsp (.../learning.jsp) (revision fc7f983fbdc263b826831b5b6f4839290f7ef964) @@ -20,7 +20,7 @@ } function checkNew(){ var reqIDVar = new Date(); - document.location.href = "?reqID="+reqIDVar.getTime(); + document.location.href = "?toolSessionID=${toolSessionID}&reqID="+reqIDVar.getTime(); return false; } function viewItem(itemUid){