Index: lams_tool_sbmt/conf/xdoclet/struts-forms.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/conf/xdoclet/struts-forms.xml,v diff -u -r1.7 -r1.8 --- lams_tool_sbmt/conf/xdoclet/struts-forms.xml 29 Jul 2005 05:25:19 -0000 1.7 +++ lams_tool_sbmt/conf/xdoclet/struts-forms.xml 12 Aug 2005 04:26:51 -0000 1.8 @@ -22,6 +22,9 @@ + + Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/Learner.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/Attic/Learner.java,v diff -u -r1.1 -r1.2 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/Learner.java 3 Aug 2005 06:19:03 -0000 1.1 +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/Learner.java 12 Aug 2005 04:26:51 -0000 1.2 @@ -100,7 +100,7 @@ try { obj = super.clone(); } catch (CloneNotSupportedException e) { - log.error("When clone " + SubmitFilesReport.class + " failed"); + log.error("When clone " + Learner.class + " failed"); } return obj; } Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/ISubmitFilesService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/ISubmitFilesService.java,v diff -u -r1.16 -r1.17 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/ISubmitFilesService.java 10 Aug 2005 01:39:37 -0000 1.16 +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/ISubmitFilesService.java 12 Aug 2005 04:26:51 -0000 1.17 @@ -56,7 +56,9 @@ /** * Returns the SubmitFilesContent object corresponding to the - * given contentID + * given contentID. If could not find out corresponding + * SubmitFilesContent by given contentID, return a not-null + * but emtpy SubmitFilesContent instance. * * @param contentID * The content_id of the object to be looked up Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java,v diff -u -r1.22 -r1.23 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java 10 Aug 2005 02:21:22 -0000 1.22 +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java 12 Aug 2005 04:26:51 -0000 1.23 @@ -233,8 +233,8 @@ + " based on null toolContentId"); try { - SubmitFilesContent content = submitFilesContentDAO.getContentByID(toolContentId); - if ( content == null ) { + SubmitFilesContent content = getSubmitFilesContent(toolContentId); + if ( content == null || !toolContentId.equals(content.getContentID())) { content = duplicateDefaultToolContent(toolContentId); } content.setRunOffline(true); @@ -248,6 +248,9 @@ } /** + * If the toolContentID does not exist, then get default tool content id from tool core and + * initialize a emtpy SubmitFilesContent return. + * * @param toolContentId * @return */ @@ -269,8 +272,8 @@ + " based on null toolContentId"); try { - SubmitFilesContent content = submitFilesContentDAO.getContentByID(toolContentId); - if ( content == null ) { + SubmitFilesContent content = getSubmitFilesContent(toolContentId); + if ( content == null || !toolContentId.equals(content.getContentID())) { content = duplicateDefaultToolContent(toolContentId); } content.setDefineLater(true); @@ -427,8 +430,11 @@ + toolContentId.longValue() + "]"); try { - SubmitFilesContent submitContent = submitFilesContentDAO.getContentByID(toolContentId); - + SubmitFilesContent submitContent = getSubmitFilesContent(toolContentId); + if ( submitContent == null || !toolContentId.equals(submitContent.getContentID())) { + submitContent = new SubmitFilesContent(); + submitContent.setContentID(toolContentId); + } SubmitFilesSession submitSession = new SubmitFilesSession (); submitSession.setSessionID(toolSessionId); @@ -527,17 +533,21 @@ if(uploadFile == null || StringUtils.isEmpty(uploadFile.getFileName())) throw new SubmitFilesException("Could not find upload file: " + uploadFile); - SubmitFilesContent content = submitFilesContentDAO.getContentByID(contentID); - if (content == null) - throw new SubmitFilesException( - "No such content with a contentID of: " + contentID - + " found."); - + SubmitFilesContent content = getSubmitFilesContent(contentID); + if ( content == null || !contentID.equals(content.getContentID())) { + content = new SubmitFilesContent(); + content.setContentID(contentID); + //user firstly upload file without any other input, even the not-null + //field "title". Set title as default title. + content.setTitle(SbmtConstants.DEFAULT_TITLE); + } NodeKey nodeKey = processFile(uploadFile,fileType); Set fileSet = content.getInstructionFiles(); - if(fileSet == null) + if(fileSet == null){ fileSet = new HashSet(); + content.setInstructionFiles(fileSet); + } InstructionFiles file = new InstructionFiles(); file.setType(fileType); file.setUuID(nodeKey.getUuid()); Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesServiceProxy.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesServiceProxy.java,v diff -u -r1.2 -r1.3 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesServiceProxy.java 10 Aug 2005 01:39:37 -0000 1.2 +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesServiceProxy.java 12 Aug 2005 04:26:51 -0000 1.3 @@ -1,9 +1,26 @@ -/* - * Created on May 24, 2005 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** */ + package org.lamsfoundation.lams.tool.sbmt.service; import javax.servlet.ServletContext; Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/util/SbmtConstants.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/util/SbmtConstants.java,v diff -u -r1.2 -r1.3 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/util/SbmtConstants.java 10 Aug 2005 02:21:22 -0000 1.2 +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/util/SbmtConstants.java 12 Aug 2005 04:26:51 -0000 1.3 @@ -24,5 +24,6 @@ public static final String AUTHORING_DTO = "authoring"; public static final String TOOLSIGNNATURE = "lasbmt11"; + public static final String DEFAULT_TITLE = "Submit Files Title"; } Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/AuthoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/AuthoringAction.java,v diff -u -r1.9 -r1.10 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/AuthoringAction.java 11 Aug 2005 04:48:38 -0000 1.9 +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/AuthoringAction.java 12 Aug 2005 04:26:51 -0000 1.10 @@ -1,6 +1,24 @@ -/* - * Created on May 19, 2005 - * +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** */ package org.lamsfoundation.lams.tool.sbmt.web; @@ -50,7 +68,7 @@ public ISubmitFilesService submitFilesService; /** - * Update content + * Update all content for submit tool except online/offline instruction files list. * * @param mapping * @param form @@ -83,7 +101,9 @@ return mapping.findForward("success"); } /** - * Handle upload online instruction files request. + * Handle upload online instruction files request. Once the file uploaded successfully, database + * will update accordingly. + * * @param mapping * @param form * @param request @@ -95,7 +115,8 @@ return uploadFile(mapping, form, IToolContentHandler.TYPE_ONLINE,request); } /** - * Handle upload offline instruction files request. + * Handle upload offline instruction files request. Once the file uploaded successfully, database + * will update accordingly. * @param mapping * @param form * @param request @@ -144,18 +165,11 @@ return mapping.getInputForward(); } - protected Map getKeyMethodMap() { - Map map = new HashMap(); - map.put("label.authoring.upload.online.button", "uploadOnline"); - map.put("label.authoring.upload.offline.button", "uploadOffline"); - map.put("label.authoring.save.button", "updateContent"); - - return map; - } - /* - * (non-Javadoc) - * + /** + * This page will display initial submit tool content. Or just a blank page if the toolContentID does not + * exist before. + * * @see org.apache.struts.actions.DispatchAction#unspecified(org.apache.struts.action.ActionMapping, * org.apache.struts.action.ActionForm, * javax.servlet.http.HttpServletRequest, @@ -171,10 +185,12 @@ .getServlet().getServletContext()); SubmitFilesContent persistContent = submitFilesService.getSubmitFilesContent(contentID); - //if this content does not exist, then reset the contentID to current value to keep it on HTML page. - if(persistContent == null) + //if this content does not exist(empty without id), or find out wrong content(id not match), + //then reset the contentID to current value in order to keep it on HTML page. + if(!contentID.equals(persistContent.getContentID())){ persistContent = new SubmitFilesContent(); - persistContent.setContentID(contentID); + persistContent.setContentID(contentID); + } setUp(request,persistContent); //set back STRUTS component value @@ -184,9 +200,20 @@ authForm.set("lockOnFinished",persistContent.isLockOnFinished()?"1":null); return mapping.getInputForward(); } + /** + * Just for STRUTS LookupDispatchAction mapping function. + */ + protected Map getKeyMethodMap() { + Map map = new HashMap(); + map.put("label.authoring.upload.online.button", "uploadOnline"); + map.put("label.authoring.upload.offline.button", "uploadOffline"); + map.put("label.authoring.save.button", "updateContent"); + + return map; + } /** - * Get content from ActionForm parameters. + * The private method to get content from ActionForm parameters (web page). * * @param form * @return @@ -222,6 +249,8 @@ * @param content */ private void setUp(HttpServletRequest request, SubmitFilesContent content) { + String currTab = request.getParameter("currentTab"); + request.setAttribute("currentTab",currTab); AuthoringDTO authorDto = new AuthoringDTO(content); request.setAttribute(SbmtConstants.AUTHORING_DTO,authorDto); } Index: lams_tool_sbmt/web/WEB-INF/struts/struts-config.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/web/WEB-INF/struts/Attic/struts-config.xml,v diff -u -r1.18 -r1.19 --- lams_tool_sbmt/web/WEB-INF/struts/struts-config.xml 10 Aug 2005 01:39:37 -0000 1.18 +++ lams_tool_sbmt/web/WEB-INF/struts/struts-config.xml 12 Aug 2005 04:26:51 -0000 1.19 @@ -30,6 +30,9 @@ type="org.apache.struts.upload.FormFile"/> + + Index: lams_tool_sbmt/web/authoring/authoring.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/web/authoring/authoring.jsp,v diff -u -r1.11 -r1.12 --- lams_tool_sbmt/web/authoring/authoring.jsp 11 Aug 2005 04:48:38 -0000 1.11 +++ lams_tool_sbmt/web/authoring/authoring.jsp 12 Aug 2005 04:26:51 -0000 1.12 @@ -10,20 +10,23 @@ + - - + + - - + - @@ -32,9 +35,9 @@
- - - + + +
BasicBasic
@@ -43,9 +46,9 @@ - - - + + +
AdvancedAdvanced
@@ -54,9 +57,9 @@ - - - + + +
InstructionsInstructions
@@ -203,10 +206,8 @@ - - - +
@@ -226,16 +227,14 @@ - -
+
- - +
@@ -247,6 +246,7 @@
+