Index: lams_tool_daco/conf/xdoclet/struts-actions.xml =================================================================== diff -u -r20c4b3aa2dff4d1057cddddcca4abb2bd67818a0 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_daco/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 20c4b3aa2dff4d1057cddddcca4abb2bd67818a0) +++ lams_tool_daco/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -20,23 +20,6 @@ - - - - - - - - - - - - - @@ -100,7 +83,6 @@ name="recordForm" scope="request" validate="false"> - Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/DacoConstants.java =================================================================== diff -u -r5a5f3640c4d5fdf0c302347e7d6b502a972fd9cc -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/DacoConstants.java (.../DacoConstants.java) (revision 5a5f3640c4d5fdf0c302347e7d6b502a972fd9cc) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/DacoConstants.java (.../DacoConstants.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -85,8 +85,6 @@ public static final String DEFINE_LATER = "definelater"; - public static final String RUN_OFFLINE = "runOffline"; - // record operations public static final String RECORD_OPERATION_ADD = "add"; @@ -135,8 +133,6 @@ public static final String PARAM_QUESTION_UID = "questionUid"; - public static final String PARAM_RUN_OFFLINE = "runOffline"; - public static final String PARAM_LONGLAT_MAPS_SELECTED = "longlatMapsSelected"; public static final String PARAM_ANSWER_OPTION_INDEX = "removeIndex"; @@ -154,14 +150,8 @@ public static final String ATTR_RECORD_LIST = "recordList"; - public static final String ATTR_ATTACHMENT_LIST = "instructionAttachmentList"; - public static final String ATTR_DELETED_QUESTION_LIST = "deleteDacoList"; - public static final String ATTR_DELETED_ATTACHMENT_LIST = "deletedAttachmmentList"; - - public static final String ATTR_DELETED_QUESTION_ATTACHMENT_LIST = "deletedQuestionAttachmmentList"; - public static final String ATTR_QUESTION_REVIEW_URL = "dacoQuestionReviewUrl"; public static final String ATTR_DACO = "daco"; @@ -176,8 +166,6 @@ public static final String ATTR_DACO_FORM = "dacoForm"; - public static final String ATTR_FILE_TYPE_FLAG = "fileTypeFlag"; - public static final String ATTR_USER_FINISHED = "userFinished"; public static final String ATTR_ANSWER_OPTION_LIST = "answerOptionList"; Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dacoApplicationContext.xml =================================================================== diff -u -r126d84999e520648cb187e465cb4aaa3baad222e -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dacoApplicationContext.xml (.../dacoApplicationContext.xml) (revision 126d84999e520648cb187e465cb4aaa3baad222e) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dacoApplicationContext.xml (.../dacoApplicationContext.xml) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -78,9 +78,6 @@ - - - @@ -114,8 +111,6 @@ PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception - PROPAGATION_REQUIRED,-java.lang.Exception - PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dbupdates/patch20140102.sql =================================================================== diff -u --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dbupdates/patch20140102.sql (revision 0) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dbupdates/patch20140102.sql (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -0,0 +1,19 @@ +-- Turn off autocommit, so nothing is committed if there is an error +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; +----------------------Put all sql statements below here------------------------- + +-- LDEV-3147 Simplify tools: get rid of instructions tab, define in monitor and offline activity options +ALTER TABLE tl_ladaco10_contents DROP COLUMN online_instructions; +ALTER TABLE tl_ladaco10_contents DROP COLUMN offline_instructions; +ALTER TABLE tl_ladaco10_contents DROP COLUMN run_offline; +DROP TABLE IF EXISTS tl_ladaco10_attachments; + +UPDATE lams_tool SET tool_version='20140102' WHERE tool_signature='ladaco10'; + +----------------------Put all sql statements above here------------------------- + +-- If there were no errors, commit and restore autocommit to on +COMMIT; +SET AUTOCOMMIT = 1; +SET FOREIGN_KEY_CHECKS=1; \ No newline at end of file Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/model/Daco.java =================================================================== diff -u -ra8e7e92f2121c4b307fb49d28008a5828ad58c58 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/model/Daco.java (.../Daco.java) (revision a8e7e92f2121c4b307fb49d28008a5828ad58c58) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/model/Daco.java (.../Daco.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -59,7 +59,6 @@ private String instructions; // advance - private boolean runOffline; private boolean lockOnFinished; @@ -71,13 +70,6 @@ private Short maxRecords; - // instructions - private String onlineInstructions; - - private String offlineInstructions; - - private Set attachments = new LinkedHashSet(); - // general infomation private Date created; @@ -96,19 +88,11 @@ private boolean notifyTeachersOnRecordSumbit; - // *************** NON Persist Fields ******************** - private IToolContentHandler toolContentHandler; - - private List onlineFileList; - - private List offlineFileList; - // ********************************************************** // Function method for Daco // ********************************************************** - public static Daco newInstance(Daco defaultContent, Long contentId, DacoToolContentHandler dacoToolContentHandler) { + public static Daco newInstance(Daco defaultContent, Long contentId) { Daco toContent = new Daco(); - defaultContent.toolContentHandler = dacoToolContentHandler; toContent = (Daco) defaultContent.clone(); toContent.setContentId(contentId); @@ -137,11 +121,6 @@ daco.getDacoQuestions().add(clonedQuestion); } - daco.setAttachments(new LinkedHashSet(attachments.size())); - for (DacoAttachment attachment : attachments) { - daco.getAttachments().add((DacoAttachment) attachment.clone()); - } - if (createdBy != null) { daco.setCreatedBy((DacoUser) createdBy.clone()); } @@ -165,15 +144,13 @@ final Daco genericEntity = (Daco) o; return new EqualsBuilder().append(uid, genericEntity.uid).append(title, genericEntity.title).append(instructions, - genericEntity.instructions).append(onlineInstructions, genericEntity.onlineInstructions).append( - offlineInstructions, genericEntity.offlineInstructions).append(created, genericEntity.created).append(updated, + genericEntity.instructions).append(created, genericEntity.created).append(updated, genericEntity.updated).append(createdBy, genericEntity.createdBy).isEquals(); } @Override public int hashCode() { - return new HashCodeBuilder().append(uid).append(title).append(instructions).append(onlineInstructions).append( - offlineInstructions).append(created).append(updated).append(createdBy).toHashCode(); + return new HashCodeBuilder().append(uid).append(title).append(instructions).append(created).append(updated).append(createdBy).toHashCode(); } /** @@ -188,22 +165,6 @@ this.setUpdated(new Date(now)); } - public void toDTO() { - onlineFileList = new ArrayList(); - offlineFileList = new ArrayList(); - Set fileSet = this.getAttachments(); - if (fileSet != null) { - for (DacoAttachment file : fileSet) { - if (StringUtils.equalsIgnoreCase(file.getFileType(), IToolContentHandler.TYPE_OFFLINE)) { - offlineFileList.add(file); - } - else { - onlineFileList.add(file); - } - } - } - } - // ********************************************************** // get/set methods // ********************************************************** @@ -292,26 +253,6 @@ } /** - * @return Returns the runOffline. - * - * @hibernate.property column="run_offline" - * - */ - public boolean getRunOffline() { - return runOffline; - } - - /** - * @param runOffline - * The forceOffLine to set. - * - * - */ - public void setRunOffline(boolean forceOffline) { - runOffline = forceOffline; - } - - /** * @return Returns the lockOnFinish. * * @hibernate.property column="lock_on_finished" @@ -343,53 +284,8 @@ } /** - * @return Returns the onlineInstructions set by the teacher. * - * @hibernate.property column="online_instructions" type="text" - */ - public String getOnlineInstructions() { - return onlineInstructions; - } - - public void setOnlineInstructions(String onlineInstructions) { - this.onlineInstructions = onlineInstructions; - } - - /** - * @return Returns the onlineInstructions set by the teacher. * - * @hibernate.property column="offline_instructions" type="text" - */ - public String getOfflineInstructions() { - return offlineInstructions; - } - - public void setOfflineInstructions(String offlineInstructions) { - this.offlineInstructions = offlineInstructions; - } - - /** - * - * @hibernate.set lazy="true" cascade="all" order-by="create_date desc" - * @hibernate.collection-key column="content_uid" - * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.daco.model.DacoAttachment" - * - * @return a set of Attachments to this Message. - */ - public Set getAttachments() { - return attachments; - } - - /** - * @param attachments The attachments to set. - */ - public void setAttachments(Set attachments) { - this.attachments = attachments; - } - - /** - * - * * @hibernate.set cascade="all" order-by="uid asc" outer-join="true" * @hibernate.collection-key column="content_uid" * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.daco.model.DacoQuestion" @@ -440,26 +336,6 @@ this.contentId = contentId; } - public List getOfflineFileList() { - return offlineFileList; - } - - public void setOfflineFileList(List offlineFileList) { - this.offlineFileList = offlineFileList; - } - - public List getOnlineFileList() { - return onlineFileList; - } - - public void setOnlineFileList(List onlineFileList) { - this.onlineFileList = onlineFileList; - } - - public void setToolContentHandler(IToolContentHandler toolContentHandler) { - this.toolContentHandler = toolContentHandler; - } - /** * @hibernate.property column="reflect_instructions" * @return Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/model/DacoAttachment.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/model/DacoQuestion.java =================================================================== diff -u -r843648563725cffa91af1dfd96dce9682d39b410 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/model/DacoQuestion.java (.../DacoQuestion.java) (revision 843648563725cffa91af1dfd96dce9682d39b410) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/model/DacoQuestion.java (.../DacoQuestion.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -70,7 +70,7 @@ DacoQuestion obj = null; try { obj = (DacoQuestion) super.clone(); - // clone attachment + // clone answer options obj.setAnswerOptions(new LinkedHashSet(answerOptions.size())); for (DacoAnswerOption answerOption : answerOptions) { obj.getAnswerOptions().add((DacoAnswerOption) answerOption.clone()); Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/DacoImportContentVersionFilter.java =================================================================== diff -u --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/DacoImportContentVersionFilter.java (revision 0) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/DacoImportContentVersionFilter.java (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -0,0 +1,43 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ +package org.lamsfoundation.lams.tool.daco.service; + +import org.lamsfoundation.lams.learningdesign.service.ToolContentVersionFilter; +import org.lamsfoundation.lams.tool.daco.model.Daco; + +/** + * Import filter class for different version of Chat content. + */ +public class DacoImportContentVersionFilter extends ToolContentVersionFilter { + + /** + * Import 20090326 version content to 20140102 version tool server. + */ + public void up20090326To20140102() { + this.removeField(Daco.class, "runOffline"); + this.removeField(Daco.class, "onlineInstructions"); + this.removeField(Daco.class, "offlineInstructions"); + this.removeField(Daco.class, "attachments"); + } +} Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/DacoServiceImpl.java =================================================================== diff -u -r33da76d05725a84e191a5f6dca50b394cca3c1ee -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/DacoServiceImpl.java (.../DacoServiceImpl.java) (revision 33da76d05725a84e191a5f6dca50b394cca3c1ee) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/DacoServiceImpl.java (.../DacoServiceImpl.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -28,7 +28,6 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.Collection; -import java.util.Date; import java.util.LinkedList; import java.util.List; import java.util.Set; @@ -75,7 +74,6 @@ import org.lamsfoundation.lams.tool.daco.dto.QuestionSummarySingleAnswerDTO; import org.lamsfoundation.lams.tool.daco.model.Daco; import org.lamsfoundation.lams.tool.daco.model.DacoAnswer; -import org.lamsfoundation.lams.tool.daco.model.DacoAttachment; import org.lamsfoundation.lams.tool.daco.model.DacoQuestion; import org.lamsfoundation.lams.tool.daco.model.DacoSession; import org.lamsfoundation.lams.tool.daco.model.DacoUser; @@ -122,8 +120,6 @@ private ILearnerService learnerService; - private IAuditService auditService; - private IUserManagementService userManagementService; private IExportToolContentService exportContentService; @@ -153,7 +149,7 @@ } } - Daco toContent = Daco.newInstance(daco, toContentId, dacoToolContentHandler); + Daco toContent = Daco.newInstance(daco, toContentId); dacoDao.saveObject(toContent); } @@ -180,11 +176,6 @@ dacoAnswerDao.removeObject(DacoAnswer.class, uid); } - public void deleteDacoAttachment(Long attachmentUid) { - dacoDao.removeObject(DacoAttachment.class, attachmentUid); - - } - public void deleteDacoQuestion(Long uid) { dacoQuestionDao.removeObject(DacoQuestion.class, uid); } @@ -220,13 +211,8 @@ // set DacoToolContentHandler as null to avoid copy file node in // repository again. - toolContentObj = Daco.newInstance(toolContentObj, toolContentId, null); - toolContentObj.setToolContentHandler(null); - toolContentObj.setOfflineFileList(null); - toolContentObj.setOnlineFileList(null); + toolContentObj = Daco.newInstance(toolContentObj, toolContentId); try { - exportContentService - .registerFileClassForExport(DacoAttachment.class.getName(), "fileUuid", "fileVersionId"); exportContentService.exportToolContent(toolContentId, toolContentObj, dacoToolContentHandler, rootPath); } catch (ExportToolContentException e) { throw new ToolException(e); @@ -311,7 +297,7 @@ Daco defaultContent = getDefaultDaco(); // save default content by given ID. Daco content = new Daco(); - content = Daco.newInstance(defaultContent, contentId, dacoToolContentHandler); + content = Daco.newInstance(defaultContent, contentId); return content; } @@ -606,9 +592,9 @@ String toVersion) throws ToolException { try { - exportContentService.registerFileClassForImport(DacoAttachment.class.getName(), "fileUuid", - "fileVersionId", "fileName", "fileType", null, null); - + // register version filter class + exportContentService.registerImportVersionFilterClass(DacoImportContentVersionFilter.class); + Object toolPOJO = exportContentService.importToolContent(toolContentPath, dacoToolContentHandler, fromVersion, toVersion); if (!(toolPOJO instanceof Daco)) { @@ -682,13 +668,12 @@ * @throws RepositoryCheckedException * @throws InvalidParameterException */ - private NodeKey processFile(FormFile file, String fileType) throws UploadDacoFileException { + private NodeKey processFile(FormFile file) throws UploadDacoFileException { NodeKey node = null; if (file != null && !StringUtils.isEmpty(file.getFileName())) { String fileName = file.getFileName(); try { - node = dacoToolContentHandler.uploadFile(file.getInputStream(), fileName, file.getContentType(), - fileType); + node = dacoToolContentHandler.uploadFile(file.getInputStream(), fileName, file.getContentType()); } catch (InvalidParameterException e) { throw new UploadDacoFileException(messageService.getMessage("error.msg.invaid.param.upload")); } catch (FileNotFoundException e) { @@ -759,28 +744,9 @@ dacoSessionDao.saveObject(resSession); } - public void setAsDefineLater(Long toolContentId, boolean value) throws DataMissingException, ToolException { - Daco daco = dacoDao.getByContentId(toolContentId); - if (daco == null) { - throw new ToolException("No found tool content by given content ID:" + toolContentId); - } - daco.setDefineLater(value); - } - - public void setAsRunOffline(Long toolContentId, boolean value) throws DataMissingException, ToolException { - Daco daco = dacoDao.getByContentId(toolContentId); - if (daco == null) { - throw new ToolException("No found tool content by given content ID:" + toolContentId); - } - daco.setRunOffline(value); - } - // ***************************************************************************** // set methods for Spring Bean // ***************************************************************************** - public void setAuditService(IAuditService auditService) { - this.auditService = auditService; - } public void setCoreNotebookService(ICoreNotebookService coreNotebookService) { this.coreNotebookService = coreNotebookService; @@ -851,7 +817,7 @@ // For file only upload one sigle file if (answer.getQuestion().getType() == DacoConstants.QUESTION_TYPE_FILE || answer.getQuestion().getType() == DacoConstants.QUESTION_TYPE_IMAGE) { - NodeKey nodeKey = processFile(file, IToolContentHandler.TYPE_ONLINE); + NodeKey nodeKey = processFile(file); answer.setFileUuid(nodeKey.getUuid()); answer.setFileVersionId(nodeKey.getVersion()); } @@ -868,26 +834,6 @@ } } - public DacoAttachment uploadInstructionFile(FormFile uploadFile, String fileType) throws UploadDacoFileException { - if (uploadFile == null || StringUtils.isEmpty(uploadFile.getFileName())) { - throw new UploadDacoFileException(messageService.getMessage("error.msg.upload.file.not.found", - new Object[] { uploadFile })); - } - - // upload file to repository - NodeKey nodeKey = processFile(uploadFile, fileType); - - // create new attachement - DacoAttachment file = new DacoAttachment(); - file.setFileType(fileType); - file.setFileUuid(nodeKey.getUuid()); - file.setFileVersionId(nodeKey.getVersion()); - file.setFileName(uploadFile.getFileName()); - file.setCreated(new Date()); - - return file; - } - public DacoAnswerDAO getDacoAnswerDao() { return dacoAnswerDao; } Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/IDacoService.java =================================================================== diff -u -r096eb3709ec455d412a9ea1d6c503899b5dece17 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/IDacoService.java (.../IDacoService.java) (revision 096eb3709ec455d412a9ea1d6c503899b5dece17) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/IDacoService.java (.../IDacoService.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -35,7 +35,6 @@ import org.lamsfoundation.lams.tool.daco.dto.QuestionSummaryDTO; import org.lamsfoundation.lams.tool.daco.model.Daco; import org.lamsfoundation.lams.tool.daco.model.DacoAnswer; -import org.lamsfoundation.lams.tool.daco.model.DacoAttachment; import org.lamsfoundation.lams.tool.daco.model.DacoQuestion; import org.lamsfoundation.lams.tool.daco.model.DacoSession; import org.lamsfoundation.lams.tool.daco.model.DacoUser; @@ -77,16 +76,6 @@ Daco getDefaultContent(Long contentId) throws DacoApplicationException; /** - * Upload instruciton file into repository. - * - * @param file - * @param type - * @return - * @throws UploadDacoFileException - */ - DacoAttachment uploadInstructionFile(FormFile file, String type) throws UploadDacoFileException; - - /** * Upload daco answer file to repository * * @param answer @@ -134,14 +123,6 @@ void saveOrUpdateAnswer(DacoAnswer answer); /** - * Delete reource attachment(i.e., offline/online instruction file) from database. This method does not delete the - * file from repository. - * - * @param attachmentUid - */ - void deleteDacoAttachment(Long attachmentUid); - - /** * Delete question from database. * * @param uid Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/AuthoringAction.java =================================================================== diff -u -r430f979ac0574e45242bd6e3df353d8592276121 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision 430f979ac0574e45242bd6e3df353d8592276121) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -54,24 +54,20 @@ import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; -import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.authoring.web.AuthoringConstants; import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; import org.lamsfoundation.lams.tool.ToolAccessMode; import org.lamsfoundation.lams.tool.daco.DacoConstants; import org.lamsfoundation.lams.tool.daco.model.Daco; import org.lamsfoundation.lams.tool.daco.model.DacoAnswerOption; -import org.lamsfoundation.lams.tool.daco.model.DacoAttachment; import org.lamsfoundation.lams.tool.daco.model.DacoQuestion; import org.lamsfoundation.lams.tool.daco.model.DacoUser; import org.lamsfoundation.lams.tool.daco.service.DacoApplicationException; import org.lamsfoundation.lams.tool.daco.service.IDacoService; -import org.lamsfoundation.lams.tool.daco.service.UploadDacoFileException; import org.lamsfoundation.lams.tool.daco.util.DacoQuestionComparator; import org.lamsfoundation.lams.tool.daco.web.form.DacoForm; import org.lamsfoundation.lams.tool.daco.web.form.DacoQuestionForm; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; -import org.lamsfoundation.lams.util.FileValidatorUtil; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; @@ -87,34 +83,6 @@ private static Logger log = Logger.getLogger(AuthoringAction.class); - /** - * Delete offline instruction file from current Daco authoring page. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - protected ActionForward deleteOfflineFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - return deleteFile(mapping, request, response, form, IToolContentHandler.TYPE_OFFLINE); - } - - /** - * Delete online instruction file from current Daco authoring page. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - protected ActionForward deleteOnlineFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - return deleteFile(mapping, request, response, form, IToolContentHandler.TYPE_ONLINE); - } - @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { @@ -151,18 +119,6 @@ if (param.equals("updateContent")) { return updateContent(mapping, form, request, response); } - if (param.equals("uploadOnlineFile")) { - return uploadOnline(mapping, form, request, response); - } - if (param.equals("uploadOfflineFile")) { - return uploadOffline(mapping, form, request, response); - } - if (param.equals("deleteOnlineFile")) { - return deleteOnlineFile(mapping, form, request, response); - } - if (param.equals("deleteOfflineFile")) { - return deleteOfflineFile(mapping, form, request, response); - } // ----------------------- Add daco question function // --------------------------- if (param.equals("newQuestion")) { @@ -188,77 +144,6 @@ } /** - * Handle upload offline instruction files request. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws UploadDacoFileException - */ - public ActionForward uploadOffline(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws UploadDacoFileException { - return uploadFile(mapping, form, IToolContentHandler.TYPE_OFFLINE, request); - } - - /** - * Handle upload online instruction files request. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws UploadDacoFileException - */ - public ActionForward uploadOnline(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws UploadDacoFileException { - return uploadFile(mapping, form, IToolContentHandler.TYPE_ONLINE, request); - } - - /** - * General method to delete file (online or offline) - * - * @param mapping - * @param request - * @param response - * @param form - * @param type - * @return - */ - protected ActionForward deleteFile(ActionMapping mapping, HttpServletRequest request, HttpServletResponse response, - ActionForm form, String type) { - Long versionID = new Long(WebUtil.readLongParam(request, DacoConstants.PARAM_FILE_VERSION_ID)); - Long uuID = new Long(WebUtil.readLongParam(request, DacoConstants.PARAM_FILE_UUID)); - - // get back sessionMAP - String sessionMapID = WebUtil.readStrParam(request, DacoConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); - - // handle session value - List attachmentList = getAttachmentList(sessionMap); - List deleteAttachmentList = getDeletedAttachmentList(sessionMap); - // first check exist attachment and delete old one (if exist) to - // deletedAttachmentList - Iterator iter = attachmentList.iterator(); - DacoAttachment existAtt; - while (iter.hasNext()) { - existAtt = (DacoAttachment) iter.next(); - if (existAtt.getFileUuid().equals(uuID) && existAtt.getFileVersionId().equals(versionID)) { - // if there is same name attachment, delete old one - deleteAttachmentList.add(existAtt); - iter.remove(); - } - } - - request.setAttribute(DacoConstants.ATTR_FILE_TYPE_FLAG, type); - request.setAttribute(DacoConstants.ATTR_SESSION_MAP_ID, sessionMapID); - return mapping.findForward(DacoConstants.SUCCESS); - - } - - /** * Display edit page for existed daco question. * * @param mapping @@ -465,14 +350,6 @@ return answerOptionList; } - /** - * @param request - * @return - */ - protected List getAttachmentList(SessionMap sessionMap) { - return getListFromSession(sessionMap, DacoConstants.ATTR_ATTACHMENT_LIST); - } - // ************************************************************************************* // Private method // ************************************************************************************* @@ -485,14 +362,6 @@ } /** - * @param request - * @return - */ - protected List getDeletedAttachmentList(SessionMap sessionMap) { - return getListFromSession(sessionMap, DacoConstants.ATTR_DELETED_ATTACHMENT_LIST); - } - - /** * List save deleted daco questions, which could be persisted or non-persisted questions. * * @param request @@ -851,11 +720,6 @@ } dacoForm.setDaco(daco); - - // initialize instruction attachment list - List attachmentList = getAttachmentList(sessionMap); - attachmentList.clear(); - attachmentList.addAll(daco.getAttachments()); } catch (Exception e) { AuthoringAction.log.error(e); @@ -967,48 +831,7 @@ } dacoPO.setCreatedBy(dacoUser); - // **********************************Handle Authoring Instruction - // Attachement ********************* - // merge attachment info - // so far, attPOSet will be empty if content is existed. because - // PropertyUtils.copyProperties() is executed - Set attPOSet = dacoPO.getAttachments(); - if (attPOSet == null) { - attPOSet = new HashSet(); - } - List attachmentList = getAttachmentList(sessionMap); - List deleteAttachmentList = getDeletedAttachmentList(sessionMap); - // current attachemnt in authoring instruction tab. - Iterator iter = attachmentList.iterator(); - while (iter.hasNext()) { - DacoAttachment newAtt = (DacoAttachment) iter.next(); - attPOSet.add(newAtt); - } - attachmentList.clear(); - - // deleted attachment. 2 possible types: one is persist another is - // non-persist before. - iter = deleteAttachmentList.iterator(); - while (iter.hasNext()) { - DacoAttachment delAtt = (DacoAttachment) iter.next(); - iter.remove(); - // it is an existed att, then delete it from current attachmentPO - if (delAtt.getUid() != null) { - Iterator attIter = attPOSet.iterator(); - while (attIter.hasNext()) { - DacoAttachment att = (DacoAttachment) attIter.next(); - if (delAtt.getUid().equals(att.getUid())) { - attIter.remove(); - break; - } - } - service.deleteDacoAttachment(delAtt.getUid()); - }// end remove from persist value - } - - // copy back - dacoPO.setAttachments(attPOSet); // ************************* Handle daco questions ******************* // Handle daco questions SortedSet formQuestionSet = getQuestionList(sessionMap); @@ -1027,17 +850,14 @@ // delete questions from database List deletedQuestionList = getDeletedDacoQuestionList(sessionMap); - iter = deletedQuestionList.iterator(); + Iterator iter = deletedQuestionList.iterator(); while (iter.hasNext()) { DacoQuestion question = (DacoQuestion) iter.next(); iter.remove(); if (question.getUid() != null) { service.deleteDacoQuestion(question.getUid()); } } - // initialize attachmentList again - attachmentList = getAttachmentList(sessionMap); - attachmentList.addAll(daco.getAttachments()); dacoForm.setDaco(dacoPO); request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE); @@ -1051,70 +871,6 @@ } - /** - * Common method to upload online or offline instruction files request. - * - * @param mapping - * @param form - * @param type - * @param request - * @return - * @throws UploadDacoFileException - */ - protected ActionForward uploadFile(ActionMapping mapping, ActionForm form, String type, HttpServletRequest request) - throws UploadDacoFileException { - - DacoForm dacoForm = (DacoForm) form; - // get back sessionMAP - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(dacoForm.getSessionMapID()); - - FormFile file; - if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { - file = dacoForm.getOfflineFile(); - } - else { - file = dacoForm.getOnlineFile(); - } - - if (file == null || StringUtils.isBlank(file.getFileName())) { - return mapping.findForward(DacoConstants.SUCCESS); - } - - // validate file size - ActionMessages errors = new ActionMessages(); - FileValidatorUtil.validateFileSize(file, true, errors); - if (!errors.isEmpty()) { - this.saveErrors(request, errors); - return mapping.findForward(DacoConstants.SUCCESS); - } - - IDacoService service = getDacoService(); - // upload to repository - DacoAttachment att = service.uploadInstructionFile(file, type); - // handle session value - List attachmentList = getAttachmentList(sessionMap); - List deleteAttachmentList = getDeletedAttachmentList(sessionMap); - // first check exist attachment and delete old one (if exist) to - // deletedAttachmentList - Iterator iter = attachmentList.iterator(); - DacoAttachment existAtt; - while (iter.hasNext()) { - existAtt = (DacoAttachment) iter.next(); - if (StringUtils.equals(existAtt.getFileName(), att.getFileName()) - && StringUtils.equals(existAtt.getFileType(), att.getFileType())) { - // if there is same name attachment, delete old one - deleteAttachmentList.add(existAtt); - iter.remove(); - break; - } - } - // add to attachmentList - attachmentList.add(att); - - return mapping.findForward(DacoConstants.SUCCESS); - - } - protected ActionMessages validateDacoForm(DacoForm dacoForm, ActionMapping mapping, HttpServletRequest request) { ActionMessages errors = new ActionMessages(); Short min = dacoForm.getDaco().getMinRecords(); Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/LearningAction.java =================================================================== diff -u -r1edbb81f16cedfcc1326e4eca6e520b5b48cbddc -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/LearningAction.java (.../LearningAction.java) (revision 1edbb81f16cedfcc1326e4eca6e520b5b48cbddc) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/LearningAction.java (.../LearningAction.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -234,14 +234,6 @@ daco.setDefineLater(false); service.saveOrUpdateDaco(daco); - // add run offline support - if (daco.getRunOffline()) { - sessionMap.put(DacoConstants.PARAM_RUN_OFFLINE, true); - return mapping.findForward(DacoConstants.RUN_OFFLINE); - } else { - sessionMap.put(DacoConstants.PARAM_RUN_OFFLINE, false); - } - sessionMap.put(DacoConstants.ATTR_DACO, daco); if (daco.isNotifyTeachersOnLearnerEntry()) { Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/MonitoringAction.java =================================================================== diff -u -r5a5f3640c4d5fdf0c302347e7d6b502a972fd9cc -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/MonitoringAction.java (.../MonitoringAction.java) (revision 5a5f3640c4d5fdf0c302347e7d6b502a972fd9cc) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/MonitoringAction.java (.../MonitoringAction.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -130,7 +130,6 @@ Long contentId = sessionMap.get(AttributeNames.PARAM_TOOL_CONTENT_ID) == null ? WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID) : (Long) sessionMap.get(AttributeNames.PARAM_TOOL_CONTENT_ID); Daco daco = service.getDacoByContentId(contentId); - daco.toDTO(); List monitoringSummaryList = service.getMonitoringSummary(contentId, DacoConstants.MONITORING_SUMMARY_MATCH_NONE); Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/form/DacoForm.java =================================================================== diff -u -r843648563725cffa91af1dfd96dce9682d39b410 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/form/DacoForm.java (.../DacoForm.java) (revision 843648563725cffa91af1dfd96dce9682d39b410) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/form/DacoForm.java (.../DacoForm.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -79,7 +79,6 @@ daco.setLockOnFinished(false); daco.setDefineLater(false); - daco.setRunOffline(false); daco.setReflectOnActivity(false); } } Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/servlet/ExportServlet.java =================================================================== diff -u -rb33e717f9a734d318eefab07a17234f07c770c92 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/servlet/ExportServlet.java (.../ExportServlet.java) (revision b33e717f9a734d318eefab07a17234f07c770c92) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/servlet/ExportServlet.java (.../ExportServlet.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -101,31 +101,6 @@ return FILENAME; } - @Override - protected String doOfflineExport(HttpServletRequest request, HttpServletResponse response, String directoryName, - Cookie[] cookies) { - if (toolContentID == null && toolSessionID == null) { - ExportServlet.logger.error("Tool content Id or and session Id are null. Unable to activity title"); - } - else { - IDacoService service = DacoServiceProxy.getDacoService(getServletContext()); - Daco daco = null; - if (toolContentID != null) { - daco = service.getDacoByContentId(toolContentID); - } - else { - DacoSession session = service.getSessionBySessionId(toolSessionID); - if (session != null) { - daco = session.getDaco(); - } - } - if (daco != null) { - activityTitle = daco.getTitle(); - } - } - return super.doOfflineExport(request, response, directoryName, cookies); - } - private void teacherExport(SessionMap sessionMap, String basePath, String learnerDirectory, Cookie[] cookies) throws DacoApplicationException { if (toolContentID == null) { Index: lams_tool_daco/web/pages/authoring/authoring.jsp =================================================================== diff -u -r430f979ac0574e45242bd6e3df353d8592276121 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_daco/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision 430f979ac0574e45242bd6e3df353d8592276121) +++ lams_tool_daco/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -28,18 +28,7 @@ // end optional tab controller stuff selectTab(tabId); - } - - function doUploadOnline() { - var myForm = $("authoringForm"); - myForm.action = ""; - myForm.submit(); } - function doUploadOffline() { - var myForm = $("authoringForm"); - myForm.action = ""; - myForm.submit(); - } @@ -55,7 +44,6 @@ -
@@ -80,11 +68,6 @@ - - - - - <%-- Default value cancelButtonLabelKey="label.common.cancel" Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_daco/web/pages/authoring/instructions.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_daco/web/pages/authoring/parts/instructionfilelist.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_daco/web/pages/learning/runoffline.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_daco/web/pages/monitoring/instructions.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_daco/web/pages/monitoring/monitoring.jsp =================================================================== diff -u -r843648563725cffa91af1dfd96dce9682d39b410 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_daco/web/pages/monitoring/monitoring.jsp (.../monitoring.jsp) (revision 843648563725cffa91af1dfd96dce9682d39b410) +++ lams_tool_daco/web/pages/monitoring/monitoring.jsp (.../monitoring.jsp) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -24,18 +24,16 @@
- - - + +
Index: lams_tool_eadventure/conf/xdoclet/struts-actions.xml =================================================================== diff -u -r7322054ababd8f5387c3424cdd38d99c3ab49e02 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_eadventure/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 7322054ababd8f5387c3424cdd38d99c3ab49e02) +++ lams_tool_eadventure/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -157,39 +157,6 @@ parameter="downExpression"> - - - - - - - - - - - - - @@ -223,8 +190,7 @@ type="org.eucm.lams.tool.eadventure.web.action.LearningAction" parameter="start" > - - + - - - - - - @@ -80,9 +74,6 @@ - - - @@ -153,8 +144,6 @@ PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception - PROPAGATION_REQUIRED,-java.lang.Exception - PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Eadventure.java =================================================================== diff -u -r79a74d271adae90228cf1247a89a8dd4cf9d82b9 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Eadventure.java (.../Eadventure.java) (revision 79a74d271adae90228cf1247a89a8dd4cf9d82b9) +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Eadventure.java (.../Eadventure.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -60,21 +60,13 @@ private String instructions; //advance - private boolean runOffline; private boolean lockWhenFinished; private boolean defineLater; private boolean contentInUse; - //instructions - private String onlineInstructions; - - private String offlineInstructions; - - private Set attachments; - //general infomation private Date created; @@ -115,21 +107,12 @@ // DTO fields: private boolean complete; - //*************** NON Persist Fields ******************** - // manages the content in the repository - private IToolContentHandler toolContentHandler; - - private List onlineFileList; - - private List offlineFileList; - /** * Default contruction method. * */ public Eadventure() { - attachments = new HashSet(); params = new HashSet(); conditions = new HashSet(); @@ -138,10 +121,8 @@ // ********************************************************** // Function method for Eadventure // ********************************************************** - public static Eadventure newInstance(Eadventure defaultContent, Long contentId, - EadventureToolContentHandler eadventureToolContentHandler) { + public static Eadventure newInstance(Eadventure defaultContent, Long contentId) { Eadventure toContent = new Eadventure(); - defaultContent.toolContentHandler = eadventureToolContentHandler; toContent = (Eadventure) defaultContent.clone(); toContent.setContentId(contentId); @@ -160,19 +141,6 @@ try { eadventure = (Eadventure) super.clone(); eadventure.setUid(null); - //clone attachment - if (attachments != null) { - Iterator iter = attachments.iterator(); - Set set = new HashSet(); - while (iter.hasNext()) { - EadventureAttachment file = (EadventureAttachment) iter.next(); - EadventureAttachment newFile = (EadventureAttachment) file.clone(); - // just clone old file without duplicate it in repository - - set.add(newFile); - } - eadventure.attachments = set; - } //clone ReourceUser as well if (createdBy != null) { eadventure.setCreatedBy((EadventureUser) createdBy.clone()); @@ -234,17 +202,16 @@ final Eadventure genericEntity = (Eadventure) o; - return new EqualsBuilder().append(uid, genericEntity.uid).append(title, genericEntity.title).append(instructions, - genericEntity.instructions).append(onlineInstructions, genericEntity.onlineInstructions).append( - offlineInstructions, genericEntity.offlineInstructions).append(created, genericEntity.created).append(updated, - genericEntity.updated).append(createdBy, genericEntity.createdBy).isEquals(); + return new EqualsBuilder().append(uid, genericEntity.uid).append(title, genericEntity.title) + .append(instructions, genericEntity.instructions).append(created, genericEntity.created) + .append(updated, genericEntity.updated).append(createdBy, genericEntity.createdBy).isEquals(); } @Override - public int hashCode() { - return new HashCodeBuilder().append(uid).append(title).append(instructions).append(onlineInstructions).append( - offlineInstructions).append(created).append(updated).append(createdBy).toHashCode(); - } + public int hashCode() { + return new HashCodeBuilder().append(uid).append(title).append(instructions).append(created).append(updated) + .append(createdBy).toHashCode(); + } /** * Updates the modification data for this entity. @@ -258,22 +225,6 @@ this.setUpdated(new Date(now)); } - public void toDTO() { - onlineFileList = new ArrayList(); - offlineFileList = new ArrayList(); - Set fileSet = this.getAttachments(); - if (fileSet != null) { - for (EadventureAttachment file : fileSet) { - if (StringUtils.equalsIgnoreCase(file.getFileType(), IToolContentHandler.TYPE_OFFLINE)) { - offlineFileList.add(file); - } - else { - onlineFileList.add(file); - } - } - } - } - //********************************************************** // get/set methods //********************************************************** @@ -364,26 +315,6 @@ } /** - * @return Returns the runOffline. - * - * @hibernate.property - * column="run_offline" - * - */ - public boolean getRunOffline() { - return runOffline; - } - - /** - * @param runOffline The forceOffLine to set. - * - * - */ - public void setRunOffline(boolean forceOffline) { - runOffline = forceOffline; - } - - /** * @return Returns the lockWhenFinish. * * @hibernate.property @@ -417,59 +348,6 @@ } /** - * @return Returns the onlineInstructions set by the teacher. - * - * @hibernate.property - * column="online_instructions" - * type="text" - */ - public String getOnlineInstructions() { - return onlineInstructions; - } - - public void setOnlineInstructions(String onlineInstructions) { - this.onlineInstructions = onlineInstructions; - } - - /** - * @return Returns the onlineInstructions set by the teacher. - * - * @hibernate.property - * column="offline_instructions" - * type="text" - */ - public String getOfflineInstructions() { - return offlineInstructions; - } - - public void setOfflineInstructions(String offlineInstructions) { - this.offlineInstructions = offlineInstructions; - } - - /** - * - * @hibernate.set lazy="true" - * cascade="all" - * inverse="false" - * order-by="create_date desc" - * @hibernate.collection-key column="eadventure_uid" - * @hibernate.collection-one-to-many - * class="org.eucm.lams.tool.eadventure.model.EadventureAttachment" - * - * @return a set of Attachments to this Message. - */ - public Set getAttachments() { - return attachments; - } - - /* - * @param attachments The attachments to set. - */ - public void setAttachments(Set attachments) { - this.attachments = attachments; - } - - /** * @hibernate.property column="content_in_use" * @return */ @@ -505,26 +383,6 @@ this.contentId = contentId; } - public List getOfflineFileList() { - return offlineFileList; - } - - public void setOfflineFileList(List offlineFileList) { - this.offlineFileList = offlineFileList; - } - - public List getOnlineFileList() { - return onlineFileList; - } - - public void setOnlineFileList(List onlineFileList) { - this.onlineFileList = onlineFileList; - } - - public void setToolContentHandler(IToolContentHandler toolContentHandler) { - this.toolContentHandler = toolContentHandler; - } - /** * @hibernate.property column="reflect_instructions" * @return Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureAttachment.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureImportContentVersionFilter.java =================================================================== diff -u --- lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureImportContentVersionFilter.java (revision 0) +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureImportContentVersionFilter.java (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -0,0 +1,43 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ +package org.eucm.lams.tool.eadventure.service; + +import org.eucm.lams.tool.eadventure.model.Eadventure; +import org.lamsfoundation.lams.learningdesign.service.ToolContentVersionFilter; + +/** + * Import filter class for different version of Eadventure content. + */ +public class EadventureImportContentVersionFilter extends ToolContentVersionFilter { + + /** + * Import 20071100 version content to 20140102 version tool server. + */ + public void up20071100To20140102() { + this.removeField(Eadventure.class, "runOffline"); + this.removeField(Eadventure.class, "onlineInstructions"); + this.removeField(Eadventure.class, "offlineInstructions"); + this.removeField(Eadventure.class, "attachments"); + } +} Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureServiceImpl.java =================================================================== diff -u -r33da76d05725a84e191a5f6dca50b394cca3c1ee -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureServiceImpl.java (.../EadventureServiceImpl.java) (revision 33da76d05725a84e191a5f6dca50b394cca3c1ee) +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureServiceImpl.java (.../EadventureServiceImpl.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -39,14 +39,37 @@ import java.util.Map; import java.util.Set; import java.util.SortedMap; -import java.util.SortedSet; -import java.util.TreeMap; import java.util.TreeSet; -import java.util.Vector; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.apache.struts.upload.FormFile; +import org.eucm.lams.tool.eadventure.EadventureConstants; +import org.eucm.lams.tool.eadventure.dao.EadventureConditionDAO; +import org.eucm.lams.tool.eadventure.dao.EadventureDAO; +import org.eucm.lams.tool.eadventure.dao.EadventureExpressionDAO; +import org.eucm.lams.tool.eadventure.dao.EadventureItemVisitDAO; +import org.eucm.lams.tool.eadventure.dao.EadventureParamDAO; +import org.eucm.lams.tool.eadventure.dao.EadventureSessionDAO; +import org.eucm.lams.tool.eadventure.dao.EadventureUserDAO; +import org.eucm.lams.tool.eadventure.dao.EadventureVarsDAO; +import org.eucm.lams.tool.eadventure.dto.ReflectDTO; +import org.eucm.lams.tool.eadventure.dto.Summary; +import org.eucm.lams.tool.eadventure.ims.IContentPackageConverter; +import org.eucm.lams.tool.eadventure.ims.IMSManifestException; +import org.eucm.lams.tool.eadventure.ims.ImscpApplicationException; +import org.eucm.lams.tool.eadventure.ims.SimpleContentPackageConverter; +import org.eucm.lams.tool.eadventure.model.Eadventure; +import org.eucm.lams.tool.eadventure.model.EadventureCondition; +import org.eucm.lams.tool.eadventure.model.EadventureExpression; +import org.eucm.lams.tool.eadventure.model.EadventureItemVisitLog; +import org.eucm.lams.tool.eadventure.model.EadventureParam; +import org.eucm.lams.tool.eadventure.model.EadventureSession; +import org.eucm.lams.tool.eadventure.model.EadventureUser; +import org.eucm.lams.tool.eadventure.model.EadventureVars; +import org.eucm.lams.tool.eadventure.util.EadventureToolContentHandler; +import org.eucm.lams.tool.eadventure.util.InputOutputReader; +import org.eucm.lams.tool.eadventure.util.ReflectDTOComparator; import org.lamsfoundation.lams.contentrepository.AccessDeniedException; import org.lamsfoundation.lams.contentrepository.ICredentials; import org.lamsfoundation.lams.contentrepository.ITicket; @@ -56,7 +79,6 @@ import org.lamsfoundation.lams.contentrepository.NodeKey; import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException; import org.lamsfoundation.lams.contentrepository.WorkspaceNotFoundException; -import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; import org.lamsfoundation.lams.contentrepository.service.IRepositoryService; import org.lamsfoundation.lams.contentrepository.service.SimpleCredentials; import org.lamsfoundation.lams.events.IEventNotificationService; @@ -78,34 +100,6 @@ import org.lamsfoundation.lams.tool.exception.DataMissingException; import org.lamsfoundation.lams.tool.exception.SessionDataExistsException; import org.lamsfoundation.lams.tool.exception.ToolException; -import org.eucm.lams.tool.eadventure.EadventureConstants; -import org.eucm.lams.tool.eadventure.dao.EadventureAttachmentDAO; -import org.eucm.lams.tool.eadventure.dao.EadventureConditionDAO; -import org.eucm.lams.tool.eadventure.dao.EadventureDAO; -import org.eucm.lams.tool.eadventure.dao.EadventureExpressionDAO; -import org.eucm.lams.tool.eadventure.dao.EadventureItemVisitDAO; -import org.eucm.lams.tool.eadventure.dao.EadventureParamDAO; -import org.eucm.lams.tool.eadventure.dao.EadventureSessionDAO; -import org.eucm.lams.tool.eadventure.dao.EadventureUserDAO; -import org.eucm.lams.tool.eadventure.dao.EadventureVarsDAO; -import org.eucm.lams.tool.eadventure.dto.ReflectDTO; -import org.eucm.lams.tool.eadventure.dto.Summary; -import org.eucm.lams.tool.eadventure.ims.IContentPackageConverter; -import org.eucm.lams.tool.eadventure.ims.IMSManifestException; -import org.eucm.lams.tool.eadventure.ims.ImscpApplicationException; -import org.eucm.lams.tool.eadventure.ims.SimpleContentPackageConverter; -import org.eucm.lams.tool.eadventure.model.Eadventure; -import org.eucm.lams.tool.eadventure.model.EadventureAttachment; -import org.eucm.lams.tool.eadventure.model.EadventureCondition; -import org.eucm.lams.tool.eadventure.model.EadventureExpression; -import org.eucm.lams.tool.eadventure.model.EadventureItemVisitLog; -import org.eucm.lams.tool.eadventure.model.EadventureParam; -import org.eucm.lams.tool.eadventure.model.EadventureSession; -import org.eucm.lams.tool.eadventure.model.EadventureUser; -import org.eucm.lams.tool.eadventure.model.EadventureVars; -import org.eucm.lams.tool.eadventure.util.ReflectDTOComparator; -import org.eucm.lams.tool.eadventure.util.EadventureToolContentHandler; -import org.eucm.lams.tool.eadventure.util.InputOutputReader; import org.lamsfoundation.lams.tool.service.ILamsToolService; import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; @@ -131,8 +125,6 @@ private EadventureDAO eadventureDao; - private EadventureAttachmentDAO eadventureAttachmentDao; - private EadventureUserDAO eadventureUserDao; private EadventureSessionDAO eadventureSessionDao; @@ -272,7 +264,7 @@ Eadventure defaultContent = getDefaultEadventure(); // save default content by given ID. Eadventure content = new Eadventure(); - content = Eadventure.newInstance(defaultContent, contentId, eadventureToolContentHandler); + content = Eadventure.newInstance(defaultContent, contentId); return content; } @@ -281,27 +273,6 @@ return eadventureItemDao.getAuthoringItems(eadventureUid); }*/ - public EadventureAttachment uploadInstructionFile(FormFile uploadFile, String fileType) - throws UploadEadventureFileException { - if (uploadFile == null || StringUtils.isEmpty(uploadFile.getFileName())) { - throw new UploadEadventureFileException(messageService.getMessage("error.msg.upload.file.not.found", - new Object[] { uploadFile })); - } - - // upload file to repository - NodeKey nodeKey = processFile(uploadFile, fileType); - - // create new attachement - EadventureAttachment file = new EadventureAttachment(); - file.setFileType(fileType); - file.setFileUuid(nodeKey.getUuid()); - file.setFileVersionId(nodeKey.getVersion()); - file.setFileName(uploadFile.getFileName()); - file.setCreated(new Date()); - - return file; - } - public void createUser(EadventureUser eadventureUser) { eadventureUserDao.saveObject(eadventureUser); } @@ -361,11 +332,6 @@ // cond.setEadListExpression(expList); } } - - public void deleteEadventureAttachment(Long attachmentUid) { - eadventureAttachmentDao.removeObject(EadventureAttachment.class, attachmentUid); - - } public void deleteEadventureCondition(Long conditionUid) { eadventureConditionDao.removeObject(EadventureCondition.class, conditionUid); @@ -722,35 +688,6 @@ return contentId; } - /** - * Process an uploaded file. - * - * @throws EadventureApplicationException - * @throws FileNotFoundException - * @throws IOException - * @throws RepositoryCheckedException - * @throws InvalidParameterException - */ - private NodeKey processFile(FormFile file, String fileType) throws UploadEadventureFileException { - NodeKey node = null; - if (file != null && !StringUtils.isEmpty(file.getFileName())) { - String fileName = file.getFileName(); - try { - node = eadventureToolContentHandler.uploadFile(file.getInputStream(), fileName, file.getContentType(), - fileType); - } catch (InvalidParameterException e) { - throw new UploadEadventureFileException(messageService.getMessage("error.msg.invaid.param.upload")); - } catch (FileNotFoundException e) { - throw new UploadEadventureFileException(messageService.getMessage("error.msg.file.not.found")); - } catch (RepositoryCheckedException e) { - throw new UploadEadventureFileException(messageService.getMessage("error.msg.repository")); - } catch (IOException e) { - throw new UploadEadventureFileException(messageService.getMessage("error.msg.io.exception")); - } - } - return node; - } - private NodeKey processPackage(String packageDirectory, String initFile) throws UploadEadventureFileException { NodeKey node = null; try { @@ -907,10 +844,6 @@ this.repositoryService = repositoryService; } - public void setEadventureAttachmentDao(EadventureAttachmentDAO eadventureAttachmentDao) { - this.eadventureAttachmentDao = eadventureAttachmentDao; - } - public void setEadventureDao(EadventureDAO eadventureDao) { this.eadventureDao = eadventureDao; } @@ -966,13 +899,8 @@ } // set EadventureToolContentHandler as null to avoid copy file node in repository again. - toolContentObj = Eadventure.newInstance(toolContentObj, toolContentId, null); - toolContentObj.setToolContentHandler(null); - toolContentObj.setOfflineFileList(null); - toolContentObj.setOnlineFileList(null); + toolContentObj = Eadventure.newInstance(toolContentObj, toolContentId); try { - exportContentService.registerFileClassForExport(EadventureAttachment.class.getName(), "fileUuid", - "fileVersionId"); //TODO revisar!! exportContentService.registerFileClassForExport(Eadventure.class.getName(), "fileUuid", "fileVersionId"); exportContentService.exportToolContent(toolContentId, toolContentObj, eadventureToolContentHandler, rootPath); @@ -985,8 +913,9 @@ String toVersion) throws ToolException { try { - exportContentService.registerFileClassForImport(EadventureAttachment.class.getName(), "fileUuid", - "fileVersionId", "fileName", "fileType", null, null); + // register version filter class + exportContentService.registerImportVersionFilterClass(EadventureImportContentVersionFilter.class); + //TODO revisar exportContentService.registerFileClassForImport(Eadventure.class.getName(), "fileUuid", "fileVersionId", "fileName", "fileType", null, "initialItem"); @@ -1089,7 +1018,7 @@ } } - Eadventure toContent = Eadventure.newInstance(eadventure, toContentId, eadventureToolContentHandler); + Eadventure toContent = Eadventure.newInstance(eadventure, toContentId); eadventureDao.saveObject(toContent); //TODO no hace nada... pero comprobar que no de problema @@ -1107,23 +1036,7 @@ public String getToolContentTitle(Long toolContentId) { return getEadventureByContentId(toolContentId).getTitle(); } - - public void setAsDefineLater(Long toolContentId, boolean value) throws DataMissingException, ToolException { - Eadventure eadventure = eadventureDao.getByContentId(toolContentId); - if (eadventure == null) { - throw new ToolException("No found tool content by given content ID:" + toolContentId); - } - eadventure.setDefineLater(value); - } - public void setAsRunOffline(Long toolContentId, boolean value) throws DataMissingException, ToolException { - Eadventure eadventure = eadventureDao.getByContentId(toolContentId); - if (eadventure == null) { - throw new ToolException("No found tool content by given content ID:" + toolContentId); - } - eadventure.setRunOffline(value); - } - public void removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException, ToolException { Eadventure eadventure = eadventureDao.getByContentId(toolContentId); @@ -1229,9 +1142,6 @@ toolContentObj.setDefineLater(Boolean.FALSE); toolContentObj.setInstructions(WebUtil.convertNewlines((String) importValues .get(ToolContentImport102Manager.CONTENT_BODY))); - toolContentObj.setOfflineInstructions(null); - toolContentObj.setOnlineInstructions(null); - toolContentObj.setRunOffline(Boolean.FALSE); toolContentObj.setUpdated(now); toolContentObj.setReflectOnActivity(Boolean.FALSE); toolContentObj.setReflectInstructions(null); @@ -1244,9 +1154,6 @@ ToolContentImport102Manager.CONTENT_URL_RUNTIME_LEARNER_SUBMIT_URL); toolContentObj.setLockWhenFinished(Boolean.FALSE); - // leave as empty, no need to set them to anything. - // toolContentObj.setAttachments(attachments); - /* * unused entries from 1.0.2 [directoryName=] no equivalent in 2.0 [runtimeSubmissionStaffFile=true] no * equivalent in 2.0 [contentShowUser=false] no equivalent in 2.0 [isHTML=false] no equivalent in 2.0 Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/IEadventureService.java =================================================================== diff -u -r7322054ababd8f5387c3424cdd38d99c3ab49e02 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/IEadventureService.java (.../IEadventureService.java) (revision 7322054ababd8f5387c3424cdd38d99c3ab49e02) +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/IEadventureService.java (.../IEadventureService.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -26,23 +26,21 @@ import java.util.List; import java.util.Map; import java.util.Set; -import java.util.SortedSet; import org.apache.struts.upload.FormFile; -import org.lamsfoundation.lams.contentrepository.IVersionedNode; -import org.lamsfoundation.lams.events.IEventNotificationService; -import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.eucm.lams.tool.eadventure.dto.ReflectDTO; import org.eucm.lams.tool.eadventure.dto.Summary; import org.eucm.lams.tool.eadventure.model.Eadventure; -import org.eucm.lams.tool.eadventure.model.EadventureAttachment; import org.eucm.lams.tool.eadventure.model.EadventureCondition; import org.eucm.lams.tool.eadventure.model.EadventureExpression; import org.eucm.lams.tool.eadventure.model.EadventureItemVisitLog; import org.eucm.lams.tool.eadventure.model.EadventureParam; import org.eucm.lams.tool.eadventure.model.EadventureSession; import org.eucm.lams.tool.eadventure.model.EadventureUser; import org.eucm.lams.tool.eadventure.model.EadventureVars; +import org.lamsfoundation.lams.contentrepository.IVersionedNode; +import org.lamsfoundation.lams.events.IEventNotificationService; +import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.usermanagement.User; /** @@ -111,16 +109,6 @@ // List getAuthoredItems(Long eadventureUid); /** - * Upload instruciton file into repository. - * - * @param file - * @param type - * @return - * @throws UploadEadventureFileException - */ - EadventureAttachment uploadInstructionFile(FormFile file, String type) throws UploadEadventureFileException; - - /** * Upload eadventure file to repository. * * @param eAdventure @@ -165,15 +153,7 @@ */ void saveOrUpdateEadventure(Eadventure Eadventure); - /** - * Delete reource attachment(i.e., offline/online instruction file) from database. This method does not delete the - * file from repository. - * - * @param attachmentUid - */ - void deleteEadventureAttachment(Long attachmentUid); - public void saveOrUpdateEadventureConditions(Set eadConditions); public void saveOrUpdateEadventureExpressions(Set eadExpressions, Long condUID); Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/AuthoringAction.java =================================================================== diff -u -r79a74d271adae90228cf1247a89a8dd4cf9d82b9 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision 79a74d271adae90228cf1247a89a8dd4cf9d82b9) +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -23,9 +23,7 @@ /* $$Id$$ */ package org.eucm.lams.tool.eadventure.web.action; -import java.io.FileNotFoundException; import java.io.IOException; -import java.io.InputStream; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; @@ -36,8 +34,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -61,35 +57,24 @@ import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; import org.apache.struts.upload.FormFile; -import org.lamsfoundation.lams.authoring.web.AuthoringConstants; -import org.lamsfoundation.lams.contentrepository.NodeKey; -import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; -import org.lamsfoundation.lams.tool.ToolAccessMode; import org.eucm.lams.tool.eadventure.EadventureConstants; -import org.eucm.lams.tool.eadventure.ims.IContentPackageConverter; -import org.eucm.lams.tool.eadventure.ims.IMSManifestException; -import org.eucm.lams.tool.eadventure.ims.ImscpApplicationException; -import org.eucm.lams.tool.eadventure.ims.SimpleContentPackageConverter; import org.eucm.lams.tool.eadventure.model.Eadventure; -import org.eucm.lams.tool.eadventure.model.EadventureAttachment; import org.eucm.lams.tool.eadventure.model.EadventureCondition; import org.eucm.lams.tool.eadventure.model.EadventureExpression; import org.eucm.lams.tool.eadventure.model.EadventureParam; import org.eucm.lams.tool.eadventure.model.EadventureUser; -import org.eucm.lams.tool.eadventure.service.EadventureServiceImpl; import org.eucm.lams.tool.eadventure.service.IEadventureService; -import org.eucm.lams.tool.eadventure.service.EadventureApplicationException; import org.eucm.lams.tool.eadventure.service.UploadEadventureFileException; import org.eucm.lams.tool.eadventure.util.EadventureConditionComparator; -import org.eucm.lams.tool.eadventure.util.InputOutputReader; import org.eucm.lams.tool.eadventure.web.form.EadventureForm; import org.eucm.lams.tool.eadventure.web.form.EadventureGameForm; import org.eucm.lams.tool.eadventure.web.form.EadventurePedagogicalPlannerForm; +import org.lamsfoundation.lams.authoring.web.AuthoringConstants; +import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; +import org.lamsfoundation.lams.tool.ToolAccessMode; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.FileValidatorUtil; import org.lamsfoundation.lams.util.WebUtil; -import org.lamsfoundation.lams.util.zipfile.ZipFileUtil; -import org.lamsfoundation.lams.util.zipfile.ZipFileUtilException; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; import org.lamsfoundation.lams.web.util.SessionMap; @@ -101,10 +86,7 @@ * @version $Revision$ */ public class AuthoringAction extends Action { - private static final int INIT_INSTRUCTION_COUNT = 2; private static final String INSTRUCTION_ITEM_DESC_PREFIX = "instructionItemDesc"; - private static final String INSTRUCTION_ITEM_COUNT = "instructionCount"; - private static final String ITEM_TYPE = "itemType"; private static Logger log = Logger.getLogger(AuthoringAction.class); @@ -143,18 +125,6 @@ if (param.equals("updateContent")) { return updateContent(mapping, form, request, response); } - if (param.equals("uploadOnlineFile")) { - return uploadOnline(mapping, form, request, response); - } - if (param.equals("uploadOfflineFile")) { - return uploadOffline(mapping, form, request, response); - } - if (param.equals("deleteOnlineFile")) { - return deleteOnlineFile(mapping, form, request, response); - } - if (param.equals("deleteOfflineFile")) { - return deleteOfflineFile(mapping, form, request, response); - } // ----------------------- Add eadventure item function // --------------------------- /* if (param.equals("newItemInit")) { @@ -236,9 +206,6 @@ eadventureForm.setEadventure(eadventure); eadventureForm.setHasFile(eadventure.getFileName()!=null); - List attachmentList = getAttachmentList(sessionMap); - attachmentList.clear(); - attachmentList.addAll(eadventure.getAttachments()); } catch (Exception e) { AuthoringAction.log.error(e); throw new ServletException(e); @@ -659,44 +626,6 @@ // merge attachment info // so far, attPOSet will be empty if content is existed. because // PropertyUtils.copyProperties() is executed - // For eAdventure tool only store as attachements the online-offline instructions files - Set attPOSet = eadventurePO.getAttachments(); - if (attPOSet == null) { - attPOSet = new HashSet(); - } - List attachmentList = getAttachmentList(sessionMap); - List deleteAttachmentList = getDeletedAttachmentList(sessionMap); - - // current attachemnt in authoring instruction tab. - Iterator iter = attachmentList.iterator(); - while (iter.hasNext()) { - EadventureAttachment newAtt = (EadventureAttachment) iter.next(); - attPOSet.add(newAtt); - } - attachmentList.clear(); - - // deleted attachment. 2 possible types: one is persist another is - // non-persist before. - iter = deleteAttachmentList.iterator(); - while (iter.hasNext()) { - EadventureAttachment delAtt = (EadventureAttachment) iter.next(); - iter.remove(); - // it is an existed att, then delete it from current attachmentPO - if (delAtt.getUid() != null) { - Iterator attIter = attPOSet.iterator(); - while (attIter.hasNext()) { - EadventureAttachment att = (EadventureAttachment) attIter.next(); - if (delAtt.getUid().equals(att.getUid())) { - attIter.remove(); - break; - } - } - service.deleteEadventureAttachment(delAtt.getUid()); - }// end remove from persist value - } - - // copy back - eadventurePO.setAttachments(attPOSet); service.saveOrUpdateEadventureParams(eadventurePO.getParams()); @@ -737,7 +666,7 @@ // delete TaEadventureConditionfrom database. - iter = delEadventureConditionList.iterator(); + Iterator iter = delEadventureConditionList.iterator(); while (iter.hasNext()) { EadventureCondition condition = (EadventureCondition) iter.next(); iter.remove(); @@ -791,10 +720,6 @@ service.saveOrUpdateEadventure(eadventurePO); - //TODO por que??? - // initialize attachmentList again - attachmentList = getAttachmentList(sessionMap); - attachmentList.addAll(eadventure.getAttachments()); eadventureForm.setEadventure(eadventurePO); request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE); @@ -805,163 +730,6 @@ } } - /** - * Handle upload online instruction files request. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws UploadEadventureFileException - */ - public ActionForward uploadOnline(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) - throws UploadEadventureFileException { - return uploadFile(mapping, form, IToolContentHandler.TYPE_ONLINE, request); - } - - /** - * Handle upload offline instruction files request. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws UploadEadventureFileException - */ - public ActionForward uploadOffline(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) - throws UploadEadventureFileException { - return uploadFile(mapping, form, IToolContentHandler.TYPE_OFFLINE, request); - } - - /** - * Common method to upload online or offline instruction files request. - * - * @param mapping - * @param form - * @param type - * @param request - * @return - * @throws UploadEadventureFileException - */ - private ActionForward uploadFile(ActionMapping mapping, ActionForm form, String type, HttpServletRequest request) throws UploadEadventureFileException { - - EadventureForm eadventureForm = (EadventureForm) form; - // get back sessionMAP - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(eadventureForm.getSessionMapID()); - - FormFile file; - if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { - file = eadventureForm.getOfflineFile(); - } else { - file = eadventureForm.getOnlineFile(); - } - - if (file == null || StringUtils.isBlank(file.getFileName())) { - return mapping.findForward(EadventureConstants.SUCCESS); - } - - // validate file size - ActionMessages errors = new ActionMessages(); - FileValidatorUtil.validateFileSize(file, true, errors); - if (!errors.isEmpty()) { - this.saveErrors(request, errors); - return mapping.findForward(EadventureConstants.SUCCESS); - } - - IEadventureService service = getEadventureService(); - // upload to repository - EadventureAttachment att = service.uploadInstructionFile(file, type); - // handle session value - List attachmentList = getAttachmentList(sessionMap); - List deleteAttachmentList = getDeletedAttachmentList(sessionMap); - // first check exist attachment and delete old one (if exist) to - // deletedAttachmentList - Iterator iter = attachmentList.iterator(); - EadventureAttachment existAtt; - while (iter.hasNext()) { - existAtt = (EadventureAttachment) iter.next(); - if (StringUtils.equals(existAtt.getFileName(), att.getFileName()) && StringUtils.equals(existAtt.getFileType(), att.getFileType())) { - // if there is same name attachment, delete old one - deleteAttachmentList.add(existAtt); - iter.remove(); - break; - } - } - // add to attachmentList - attachmentList.add(att); - - return mapping.findForward(EadventureConstants.SUCCESS); - - } - - /** - * Delete offline instruction file from current Eadventure authoring page. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - public ActionForward deleteOfflineFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { - return deleteFile(mapping, request, response, form, IToolContentHandler.TYPE_OFFLINE); - } - - /** - * Delete online instruction file from current Eadventure authoring page. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - public ActionForward deleteOnlineFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { - return deleteFile(mapping, request, response, form, IToolContentHandler.TYPE_ONLINE); - } - - /** - * General method to delete file (online or offline) - * - * @param mapping - * @param request - * @param response - * @param form - * @param type - * @return - */ - private ActionForward deleteFile(ActionMapping mapping, HttpServletRequest request, HttpServletResponse response, ActionForm form, String type) { - Long versionID = new Long(WebUtil.readLongParam(request, EadventureConstants.PARAM_FILE_VERSION_ID)); - Long uuID = new Long(WebUtil.readLongParam(request, EadventureConstants.PARAM_FILE_UUID)); - - // get back sessionMAP - String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); - - // handle session value - List attachmentList = getAttachmentList(sessionMap); - List deleteAttachmentList = getDeletedAttachmentList(sessionMap); - // first check exist attachment and delete old one (if exist) to - // deletedAttachmentList - Iterator iter = attachmentList.iterator(); - EadventureAttachment existAtt; - while (iter.hasNext()) { - existAtt = (EadventureAttachment) iter.next(); - if (existAtt.getFileUuid().equals(uuID) && existAtt.getFileVersionId().equals(versionID)) { - // if there is same name attachment, delete old one - deleteAttachmentList.add(existAtt); - iter.remove(); - } - } - - request.setAttribute(EadventureConstants.ATTR_FILE_TYPE_FLAG, type); - request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, sessionMapID); - return mapping.findForward(EadventureConstants.SUCCESS); - - } - // ************************************************************************************* // Private method // ************************************************************************************* @@ -973,52 +741,8 @@ return (IEadventureService) wac.getBean(EadventureConstants.RESOURCE_SERVICE); } - /** - * @param request - * @return - */ - private List getAttachmentList(SessionMap sessionMap) { - return getListFromSession(sessionMap, EadventureConstants.ATT_ATTACHMENT_LIST); - } - - /** - * @param request - * @return - */ - private List getDeletedAttachmentList(SessionMap sessionMap) { - return getListFromSession(sessionMap, EadventureConstants.ATTR_DELETED_ATTACHMENT_LIST); - } - - - - /** - * List save deleted eadventure items, which could be persisted or - * non-persisted items. - * - * @param request - * @return - */ - private List getDeletedEadventureItemList(SessionMap sessionMap) { - return getListFromSession(sessionMap, EadventureConstants.ATTR_DELETED_RESOURCE_ITEM_LIST); - } - - /** - * If a eadventure 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 EadventureItem object for temporarily use. - * - * @param request - * @return - */ - private List getDeletedItemAttachmentList(SessionMap sessionMap) { - return getListFromSession(sessionMap, EadventureConstants.ATTR_DELETED_RESOURCE_ITEM_ATTACHMENT_LIST); - } - - - /** * List save deleted eadventure conditions, which could be persisted or non-persisted conditions. * * @param request @@ -1239,17 +963,16 @@ return mapping.findForward(EadventureConstants.SUCCESS); } else { try { - String onlineInstructions = taskList.getOnlineInstructions(); response.setContentType("text/html;charset=utf-8"); PrintWriter writer = response.getWriter(); if (AttributeNames.COMMAND_CHECK_EDITING_ADVICE.equals(command)) { Integer activityIndex = WebUtil.readIntParam(request, AttributeNames.PARAM_ACTIVITY_INDEX); - String responseText = (StringUtils.isEmpty(taskList.getOnlineInstructions()) ? "NO" : "OK") + '&' + activityIndex; + String responseText = (StringUtils.isEmpty("") ? "NO" : "OK") + '&' + activityIndex; writer.print(responseText); } else if (AttributeNames.COMMAND_GET_EDITING_ADVICE.equals(command)) { - writer.print(onlineInstructions); + writer.print("onlineInstructions"); } } catch (IOException e) { AuthoringAction.log.error(e); Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/LearningAction.java =================================================================== diff -u -r8aded0b18a5a7712622ae56f38923fa297449977 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/LearningAction.java (.../LearningAction.java) (revision 8aded0b18a5a7712622ae56f38923fa297449977) +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/LearningAction.java (.../LearningAction.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -251,16 +251,6 @@ eadventure.setDefineLater(false); service.saveOrUpdateEadventure(eadventure); - // add run offline support - if (eadventure.getRunOffline()) { - sessionMap.put(EadventureConstants.PARAM_RUN_OFFLINE, true); - return mapping.findForward("runOffline"); - } else { - sessionMap.put(EadventureConstants.PARAM_RUN_OFFLINE, false); - } - - - // set complete flag for display purpose //TODO getionar el complete //if (eadventureUser != null) { @@ -527,23 +517,6 @@ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); - HttpSession ss = SessionManager.getSession(); - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); - Long userID = new Long(user.getUserID().longValue()); - - IEadventureService service = getEadventureService(); - /*int miniViewFlag = service.checkMiniView(sessionId, userID); - // if current user view less than reqired view count number, then just return error message. - // if it is runOffline content, then need not check minimum view count - Boolean runOffline = (Boolean) sessionMap.get(EadventureConstants.PARAM_RUN_OFFLINE); - if (miniViewFlag > 0 && !runOffline) { - ActionErrors errors = new ActionErrors(); - errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("lable.learning.minimum.view.number.less", - miniViewFlag)); - this.addErrors(request, errors); - return false; - }*/ - return true; } Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/MonitoringAction.java =================================================================== diff -u -r7322054ababd8f5387c3424cdd38d99c3ab49e02 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/MonitoringAction.java (.../MonitoringAction.java) (revision 7322054ababd8f5387c3424cdd38d99c3ab49e02) +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/MonitoringAction.java (.../MonitoringAction.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -189,7 +189,6 @@ List groupList = service.getSummary(contentId); Eadventure eadventure = service.getEadventureByContentId(contentId); - eadventure.toDTO(); Map> relectList = service.getReflectList(contentId, false); Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureForm.java =================================================================== diff -u -r7322054ababd8f5387c3424cdd38d99c3ab49e02 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureForm.java (.../EadventureForm.java) (revision 7322054ababd8f5387c3424cdd38d99c3ab49e02) +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureForm.java (.../EadventureForm.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -23,21 +23,14 @@ /* $$Id$$ */ package org.eucm.lams.tool.eadventure.web.form; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.upload.FormFile; -import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; import org.eucm.lams.tool.eadventure.model.Eadventure; -import org.eucm.lams.tool.eadventure.model.EadventureAttachment; /** * @@ -55,8 +48,6 @@ private String sessionMapID; private String contentFolderID; private int currentTab; - private FormFile offlineFile; - private FormFile onlineFile; //flag of this item has attachment or not private boolean hasFile; @@ -87,7 +78,6 @@ eadventure.setDefineComplete(false); eadventure.setLockWhenFinished(false); eadventure.setDefineLater(false); - eadventure.setRunOffline(false); eadventure.setReflectOnActivity(false); } } @@ -102,26 +92,6 @@ } - public FormFile getOfflineFile() { - return offlineFile; - } - - - public void setOfflineFile(FormFile offlineFile) { - this.offlineFile = offlineFile; - } - - - public FormFile getOnlineFile() { - return onlineFile; - } - - - public void setOnlineFile(FormFile onlineFile) { - this.onlineFile = onlineFile; - } - - public Eadventure getEadventure() { return eadventure; } Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/servlet/ExportServlet.java =================================================================== diff -u -rb33e717f9a734d318eefab07a17234f07c770c92 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/servlet/ExportServlet.java (.../ExportServlet.java) (revision b33e717f9a734d318eefab07a17234f07c770c92) +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/servlet/ExportServlet.java (.../ExportServlet.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -113,28 +113,6 @@ return FILENAME; } - protected String doOfflineExport(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) { - if (toolContentID == null && toolSessionID == null) { - logger.error("Tool content Id or and session Id are null. Unable to activity title"); - } else { - - Eadventure content = null; - if ( toolContentID != null ) { - content = service.getEadventureByContentId(toolContentID); - } else { - EadventureSession session=service.getEadventureSessionBySessionId(toolSessionID); - if ( session != null ) - content = session.getEadventure(); - } - if ( content != null ) { - activityTitle = content.getTitle(); - } - } - return super.doOfflineExport(request, response, directoryName, cookies); - } - - - public void learner(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies, HashMap sessionMap) throws EadventureApplicationException { Index: lams_tool_eadventure/web/pages/authoring/authoring.jsp =================================================================== diff -u -r2b350be06485bbfe1da8c66def9fc2cd81e883a8 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_eadventure/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision 2b350be06485bbfe1da8c66def9fc2cd81e883a8) +++ lams_tool_eadventure/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -57,17 +57,6 @@ } } - function doUploadOnline() { - var myForm = $("authoringForm"); - myForm.action = ""; - myForm.submit(); - } - function doUploadOffline() { - var myForm = $("authoringForm"); - myForm.action = ""; - myForm.submit(); - } - function changeViewNum(initVal){ var tb = document.getElementById("itemTable"); var num = tb.getElementsByTagName("tr"); Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_eadventure/web/pages/authoring/instructions.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_eadventure/web/pages/authoring/parts/instructionfilelist.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_eadventure/web/pages/authoring/parts/instructions.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_eadventure/web/pages/learning/runoffline.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_eadventure/web/pages/monitoring/instructions.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_eadventure/web/pages/monitoring/monitoring.jsp =================================================================== diff -u -r7322054ababd8f5387c3424cdd38d99c3ab49e02 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_eadventure/web/pages/monitoring/monitoring.jsp (.../monitoring.jsp) (revision 7322054ababd8f5387c3424cdd38d99c3ab49e02) +++ lams_tool_eadventure/web/pages/monitoring/monitoring.jsp (.../monitoring.jsp) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -37,18 +37,16 @@
- - - + +
Index: lams_tool_forum/conf/xdoclet/struts-actions.xml =================================================================== diff -u -raafe5d45599dbc368a2b719ac0160fb95f932fe2 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_forum/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision aafe5d45599dbc368a2b719ac0160fb95f932fe2) +++ lams_tool_forum/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -28,42 +28,7 @@ - - - - - - - - - - - - - - - - + PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception - PROPAGATION_REQUIRED,-java.lang.Exception - PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/Forum.java =================================================================== diff -u -r4fb3d978934e94b0008c9ff0bcdd53258298b1cf -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/Forum.java (.../Forum.java) (revision 4fb3d978934e94b0008c9ff0bcdd53258298b1cf) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/Forum.java (.../Forum.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -34,7 +34,6 @@ import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.log4j.Logger; import org.lamsfoundation.lams.learningdesign.TextSearchConditionComparator; -import org.lamsfoundation.lams.tool.forum.util.ForumToolContentHandler; /** * Forum @@ -58,8 +57,6 @@ private boolean lockWhenFinished; - private boolean runOffline; - private boolean allowAnonym; private boolean allowEdit; @@ -82,10 +79,6 @@ private String instructions; - private String onlineInstructions; - - private String offlineInstructions; - private boolean defineLater; private boolean contentInUse; @@ -98,8 +91,6 @@ private Set messages; - private Set attachments; - private int limitedChar; private boolean limitedInput; @@ -119,15 +110,11 @@ // conditions private Set conditions = new TreeSet(new TextSearchConditionComparator()); - // ********* Non Persist fields - private ForumToolContentHandler toolContentHandler; - /** * Default contruction method. * */ public Forum() { - attachments = new HashSet(); messages = new HashSet(); } @@ -146,7 +133,7 @@ Iterator iter = messages.iterator(); Set set = new HashSet(); while (iter.hasNext()) { - set.add(Message.newInstance((Message) iter.next(), toolContentHandler)); + set.add(Message.newInstance((Message) iter.next())); } forum.messages = set; } @@ -157,20 +144,7 @@ } forum.setConditions(conditionsCopy); } - // clone attachment - if (attachments != null) { - Iterator iter = attachments.iterator(); - Set set = new HashSet(); - while (iter.hasNext()) { - Attachment file = (Attachment) iter.next(); - Attachment newFile = (Attachment) file.clone(); - // clone old file without duplicate it in repository - set.add(newFile); - } - forum.attachments = set; - } - } catch (CloneNotSupportedException e) { Forum.log.error("When clone " + Forum.class + " failed"); } @@ -190,15 +164,13 @@ final Forum genericEntity = (Forum) o; return new EqualsBuilder().append(uid, genericEntity.uid).append(title, genericEntity.title).append( - instructions, genericEntity.instructions).append(onlineInstructions, genericEntity.onlineInstructions) - .append(offlineInstructions, genericEntity.offlineInstructions).append(created, genericEntity.created) + instructions, genericEntity.instructions).append(created, genericEntity.created) .append(updated, genericEntity.updated).append(createdBy, genericEntity.createdBy).isEquals(); } @Override public int hashCode() { - return new HashCodeBuilder().append(uid).append(title).append(instructions).append(onlineInstructions).append( - offlineInstructions).append(created).append(updated).append(createdBy).toHashCode(); + return new HashCodeBuilder().append(uid).append(title).append(instructions).append(created).append(updated).append(createdBy).toHashCode(); } // ********************************************************** @@ -309,26 +281,6 @@ } /** - * @return Returns the runOffline. - * - * @hibernate.property column="run_offline" - * - */ - public boolean getRunOffline() { - return runOffline; - } - - /** - * @param runOffline - * The forceOffLine to set. - * - * - */ - public void setRunOffline(boolean forceOffline) { - runOffline = forceOffline; - } - - /** * @return Returns the lockWhenFinish. * * @hibernate.property column="lock_on_finished" @@ -360,51 +312,6 @@ } /** - * @return Returns the onlineInstructions set by the teacher. - * - * @hibernate.property column="online_instructions" type="text" - */ - public String getOnlineInstructions() { - return onlineInstructions; - } - - public void setOnlineInstructions(String onlineInstructions) { - this.onlineInstructions = onlineInstructions; - } - - /** - * @return Returns the onlineInstructions set by the teacher. - * - * @hibernate.property column="offline_instructions" type="text" - */ - public String getOfflineInstructions() { - return offlineInstructions; - } - - public void setOfflineInstructions(String offlineInstructions) { - this.offlineInstructions = offlineInstructions; - } - - /** - * - * @hibernate.set lazy="true" cascade="all" inverse="false" order-by="create_date desc" - * @hibernate.collection-key column="forum_uid" - * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.forum.persistence.Attachment" - * - * @return a set of Attachments to this Message. - */ - public Set getAttachments() { - return attachments; - } - - /* - * @param attachments The attachments to set. - */ - public void setAttachments(Set attachments) { - this.attachments = attachments; - } - - /** * NOTE: The reason that relation don't use save-update to persist message is MessageSeq table need save a record as * well. * @@ -494,9 +401,8 @@ this.allowRichEditor = allowRichEditor; } - public static Forum newInstance(Forum fromContent, Long contentId, ForumToolContentHandler forumToolContentHandler) { + public static Forum newInstance(Forum fromContent, Long contentId) { Forum toContent = new Forum(); - fromContent.toolContentHandler = forumToolContentHandler; toContent = (Forum) fromContent.clone(); toContent.setContentId(contentId); @@ -537,14 +443,6 @@ this.limitedInput = limitedInput; } - public ForumToolContentHandler getToolContentHandler() { - return toolContentHandler; - } - - public void setToolContentHandler(ForumToolContentHandler toolContentHandler) { - this.toolContentHandler = toolContentHandler; - } - /** * @hibernate.property column="allow_new_topic" * @return Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/Message.java =================================================================== diff -u -r4fb3d978934e94b0008c9ff0bcdd53258298b1cf -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/Message.java (.../Message.java) (revision 4fb3d978934e94b0008c9ff0bcdd53258298b1cf) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/Message.java (.../Message.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -68,8 +68,6 @@ private ForumReport report; private Set sessionClones; - private ForumToolContentHandler toolContentHandler; - public Message() { attachments = new TreeSet(); sessionClones = new HashSet(); @@ -78,9 +76,8 @@ // ********************************************************** // Function method for Message // ********************************************************** - public static Message newInstance(Message fromMsg, ForumToolContentHandler toolContentHandler) { + public static Message newInstance(Message fromMsg) { Message toMsg = new Message(); - fromMsg.toolContentHandler = toolContentHandler; toMsg = (Message) fromMsg.clone(); return toMsg; } @@ -143,7 +140,6 @@ clone.setReplyNumber(this.getReplyNumber()); clone.setReport(this.getReport()); clone.setSubject(this.getSubject()); - clone.setToolContentHandler(this.getToolContentHandler()); clone.setUpdated(clone.getUpdated()); // Update the attachments. Easiest way is to recopy them - which does NOT copy them in the content repository. @@ -517,12 +513,4 @@ return new ToStringBuilder(this).append("uid", uid).append("subject", subject).append("body", body).toString(); } - public ForumToolContentHandler getToolContentHandler() { - return toolContentHandler; - } - - public void setToolContentHandler(ForumToolContentHandler toolContentHandler) { - this.toolContentHandler = toolContentHandler; - } - } Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumImportContentVersionFilter.java =================================================================== diff -u --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumImportContentVersionFilter.java (revision 0) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumImportContentVersionFilter.java (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -0,0 +1,43 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ +package org.lamsfoundation.lams.tool.forum.service; + +import org.lamsfoundation.lams.learningdesign.service.ToolContentVersionFilter; +import org.lamsfoundation.lams.tool.forum.persistence.Forum; + +/** + * Import filter class for different version of Forum content. + */ +public class ForumImportContentVersionFilter extends ToolContentVersionFilter { + + /** + * Import 20121109 version content to 20140102 version tool server. + */ + public void up20121109To20140102() { + this.removeField(Forum.class, "runOffline"); + this.removeField(Forum.class, "onlineInstructions"); + this.removeField(Forum.class, "offlineInstructions"); + this.removeField(Forum.class, "attachments"); + } +} Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java =================================================================== diff -u -r5c1b68500cee552c70a5f1c5fe510687eac07b8d -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java (.../ForumService.java) (revision 5c1b68500cee552c70a5f1c5fe510687eac07b8d) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java (.../ForumService.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -34,13 +34,13 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Random; import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; import java.util.TreeSet; import java.util.Vector; -import java.util.Map.Entry; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; @@ -53,10 +53,8 @@ import org.lamsfoundation.lams.contentrepository.NodeKey; import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException; import org.lamsfoundation.lams.contentrepository.WorkspaceNotFoundException; -import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; import org.lamsfoundation.lams.contentrepository.service.IRepositoryService; import org.lamsfoundation.lams.contentrepository.service.SimpleCredentials; -import org.lamsfoundation.lams.events.DeliveryMethodMail; import org.lamsfoundation.lams.events.IEventNotificationService; import org.lamsfoundation.lams.gradebook.service.IGradebookService; import org.lamsfoundation.lams.learning.service.ILearnerService; @@ -363,54 +361,13 @@ return replyMessage; } - public Attachment uploadInstructionFile(FormFile uploadFile, String fileType) throws PersistenceException { - if (uploadFile == null || StringUtils.isEmpty(uploadFile.getFileName())) { - throw new ForumException("Could not find upload file: " + uploadFile); - } - - // upload file to repository - NodeKey nodeKey = processFile(uploadFile, fileType); - - // create new attachement - Attachment file = new Attachment(); - file.setFileType(fileType); - file.setFileUuid(nodeKey.getUuid()); - file.setFileVersionId(nodeKey.getVersion()); - file.setFileName(uploadFile.getFileName()); - file.setCreated(new Date()); - - return file; - - } - - /** - * This method deletes the content with the given uuid and versionID from the content - * repository - * - * @param uuid - * The uuid of the node to be deleted - * @param versionID - * The version_id of the node to be deleted. - * @throws SubmitFilesException - */ - public void deleteFromRepository(Long uuid, Long versionID) throws ForumException { - ITicket ticket = getRepositoryLoginTicket(); - try { - repositoryService.deleteVersion(ticket, uuid, versionID); - } catch (Exception e) { - throw new ForumException("Exception occured while deleting files from" + " the repository " - + e.getMessage()); - } - } - public Attachment uploadAttachment(FormFile uploadFile) throws PersistenceException { if (uploadFile == null || StringUtils.isEmpty(uploadFile.getFileName())) { throw new ForumException("Could not find upload file: " + uploadFile); } - NodeKey nodeKey = processFile(uploadFile, IToolContentHandler.TYPE_ONLINE); + NodeKey nodeKey = processFile(uploadFile); Attachment file = new Attachment(); - file.setFileType(IToolContentHandler.TYPE_ONLINE); file.setFileUuid(nodeKey.getUuid()); file.setFileVersionId(nodeKey.getVersion()); file.setFileName(uploadFile.getFileName()); @@ -656,13 +613,12 @@ * @throws RepositoryCheckedException * @throws InvalidParameterException */ - private NodeKey processFile(FormFile file, String fileType) { + private NodeKey processFile(FormFile file) { NodeKey node = null; if (file != null && !StringUtils.isEmpty(file.getFileName())) { String fileName = file.getFileName(); try { - node = getForumToolContentHandler().uploadFile(file.getInputStream(), fileName, file.getContentType(), - fileType); + node = getForumToolContentHandler().uploadFile(file.getInputStream(), fileName, file.getContentType()); } catch (InvalidParameterException e) { throw new ForumException("FileNotFoundException occured while trying to upload File" + e.getMessage()); } catch (FileNotFoundException e) { @@ -762,7 +718,7 @@ fromContent = getDefaultForum(); } - Forum toContent = Forum.newInstance(fromContent, toContentId, forumToolContentHandler); + Forum toContent = Forum.newInstance(fromContent, toContentId); // save topics in this forum, only save the author created topic!!! and reset its reply number to zero. Set topics = toContent.getMessages(); @@ -788,24 +744,6 @@ } - public void setAsDefineLater(Long toolContentId, boolean value) throws DataMissingException, ToolException { - Forum forum = forumDao.getByContentId(toolContentId); - if (forum == null) { - throw new ToolException("No found tool content by given content ID:" + toolContentId); - } - forum.setDefineLater(value); - forum.setContentInUse(false); - } - - public void setAsRunOffline(Long toolContentId, boolean value) throws DataMissingException, ToolException { - Forum forum = forumDao.getByContentId(toolContentId); - if (forum == null) { - throw new ToolException("No found tool content by given content ID:" + toolContentId); - } - forum.setRunOffline(value); - - } - public void removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException, ToolException { Forum forum = forumDao.getByContentId(toolContentId); @@ -839,8 +777,7 @@ } // set ResourceToolContentHandler as null to avoid copy file node in repository again. - toolContentObj = Forum.newInstance(toolContentObj, toolContentId, null); - toolContentObj.setToolContentHandler(null); + toolContentObj = Forum.newInstance(toolContentObj, toolContentId); toolContentObj.setCreatedBy(null); Set items = toolContentObj.getMessages(); Set authorItems = new HashSet(); @@ -851,7 +788,6 @@ item.setModifiedBy(null); item.setToolSession(null); item.setForum(null); - item.setToolContentHandler(null); item.setReport(null); item.setReplyNumber(0); item.setParent(null); @@ -877,6 +813,9 @@ String toVersion) throws ToolException { try { + // register version filter class + exportContentService.registerImportVersionFilterClass(ForumImportContentVersionFilter.class); + exportContentService.registerFileClassForImport(Attachment.class.getName(), "fileUuid", "fileVersionId", "fileName", "fileType", null, null); @@ -960,7 +899,7 @@ if (contentTopics != null && contentTopics.size() > 0) { for (Message msg : contentTopics) { if (msg.getIsAuthored() && msg.getToolSession() == null) { - Message newMsg = Message.newInstance(msg, forumToolContentHandler); + Message newMsg = Message.newInstance(msg); msg.getSessionClones().add(newMsg); createRootTopic(forum.getContentId(), session, newMsg); } @@ -1049,7 +988,7 @@ } } // get default content by given ID. - Forum content = Forum.newInstance(defaultContent, contentID, forumToolContentHandler); + Forum content = Forum.newInstance(defaultContent, contentID); return content; } @@ -1092,9 +1031,6 @@ toolContentObj.setLockWhenFinished(bool != null ? !bool.booleanValue() : false); toolContentObj.setMaximumReply(0); toolContentObj.setMinimumReply(0); - toolContentObj.setOfflineInstructions(null); - toolContentObj.setOnlineInstructions(null); - toolContentObj.setRunOffline(Boolean.FALSE); toolContentObj.setUpdated(now); // unused entries from 1.0.2 Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/IForumService.java =================================================================== diff -u -r7817bc4fce30416c9737875ae2d137be0c6aa8ba -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/IForumService.java (.../IForumService.java) (revision 7817bc4fce30416c9737875ae2d137be0c6aa8ba) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/IForumService.java (.../IForumService.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -70,16 +70,6 @@ Forum updateForum(Forum forum) throws PersistenceException; /** - * Upload instruction file - * - * @param file - * @param type - * @return - * @throws PersistenceException - */ - Attachment uploadInstructionFile(FormFile file, String type) throws PersistenceException; - - /** * Get forum by forum UID * * @param forumUid @@ -97,14 +87,6 @@ */ Forum getForumByContentId(Long contentID) throws PersistenceException; - /** - * Delete authoring page instruction files. - * - * @param attachmentId - * @throws PersistenceException - */ - void deleteForumAttachment(Long attachmentId) throws PersistenceException; - // ************************************************************************************ // Topic Method // ************************************************************************************ @@ -185,15 +167,6 @@ */ Attachment uploadAttachment(FormFile file) throws PersistenceException; - /** - * Delete file from repository. - * - * @param uuID - * @param versionID - * @throws PersistenceException - */ - void deleteFromRepository(Long uuID, Long versionID) throws PersistenceException; - // ************************************************************************************ // *********************Get topic methods ********************** // ************************************************************************************ Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/ForumConstants.java =================================================================== diff -u -rf1e0b7ce7d91dd9bb8c03647456beec2be16b612 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/ForumConstants.java (.../ForumConstants.java) (revision f1e0b7ce7d91dd9bb8c03647456beec2be16b612) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/ForumConstants.java (.../ForumConstants.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -85,14 +85,6 @@ public static final String ATTR_LOCK_WHEN_FINISHED = "lockedWhenFinished"; - public static final String ONLINE_ATTACHMENT = "online_att"; - - public static final String OFFLINE_ATTACHMENT = "offline_att"; - - public static final String ATTACHMENT_LIST = "attachmentList"; - - public static final String DELETED_ATTACHMENT_LIST = "deletedAttachmentList"; - public static final String TOPIC_DELETED_ATTACHMENT_LIST = "topicDeletedAttachmentList"; public static final String DELETED_AUTHORING_TOPICS_LIST = "deletedAuthoringTopicList"; @@ -105,11 +97,11 @@ public static final String ATTR_UPLOAD_MAX_FILE_SIZE = "uploadMaxFileSize"; - // for submission deadline LDEV-2657 + // for submission deadline public static final String ATTR_SUBMISSION_DEADLINE = "submissionDeadline"; - public static final String ATTR_IS_SUBMISSION_DEADLINE_PASSED = "isSubmissionDeadlinePassed"; + public static final String ATTR_IS_SUBMISSION_DEADLINE_PASSED = "isSubmissionDeadlinePassed"; // used in monitoring public static final String TITLE = "title"; @@ -134,8 +126,6 @@ public static final String ATTR_REPORT = "report"; - public static final String ATTR_FILE_TYPE_FLAG = "fileTypeFlag"; - public static final String PARAM_UPDATE_MODE = "updateMode"; public static final String ATTR_NO_MORE_POSTS = "noMorePosts"; @@ -154,6 +144,8 @@ public static final String ATTR_REFLECTION_ON = "reflectOn"; public static final String ATTR_REFLECTION_INSTRUCTION = "reflectInstructions"; + + public static final String DELETED_ATTACHMENT_LIST = "deletedAttachmentList"; public static final String ATTR_REFLECTION_ENTRY = "reflectEntry"; Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/AuthoringAction.java =================================================================== diff -u -rfd8292deb95c595b3d948e003dd9ff1807f7b569 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/AuthoringAction.java (.../AuthoringAction.java) (revision fd8292deb95c595b3d948e003dd9ff1807f7b569) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/AuthoringAction.java (.../AuthoringAction.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -128,18 +128,6 @@ if (param.equals("updateContent")) { return updateContent(mapping, form, request, response); } - if (param.equals("uploadOnlineFile")) { - return uploadOnline(mapping, form, request, response); - } - if (param.equals("uploadOfflineFile")) { - return uploadOffline(mapping, form, request, response); - } - if (param.equals("deleteOnlineFile")) { - return deleteOnlineFile(mapping, form, request, response); - } - if (param.equals("deleteOfflineFile")) { - return deleteOfflineFile(mapping, form, request, response); - } // -----------------------Topic function --------------------------- if (param.equals("newTopic")) { return newTopic(mapping, form, request, response); @@ -251,9 +239,6 @@ } } } - // initialize attachmentList - List attachmentList = getAttachmentList(sessionMap); - attachmentList.addAll(forum.getAttachments()); // tear down PO to normal object using clone() method forumForm.setForum((Forum) forum.clone()); @@ -361,46 +346,12 @@ } forumPO.setCreatedBy(forumUser); - // **********************************Handle Attachement********************* - // merge attachment info - Set attPOSet = forumPO.getAttachments(); - if (attPOSet == null) { - attPOSet = new HashSet(); - } - List attachmentList = getAttachmentList(sessionMap); - List deleteAttachmentList = getDeletedAttachmentList(sessionMap); - Iterator iter = attachmentList.iterator(); - while (iter.hasNext()) { - Attachment newAtt = (Attachment) iter.next(); - attPOSet.add(newAtt); - } - attachmentList.clear(); - - iter = deleteAttachmentList.iterator(); - while (iter.hasNext()) { - Attachment delAtt = (Attachment) iter.next(); - iter.remove(); - // it is an existed att, then delete it from current attachmentPO - if (delAtt.getUid() != null) { - Iterator attIter = attPOSet.iterator(); - while (attIter.hasNext()) { - Attachment att = (Attachment) attIter.next(); - if (delAtt.getUid().equals(att.getUid())) { - attIter.remove(); - break; - } - } - forumService.deleteForumAttachment(delAtt.getUid()); - }// end remove from persist value - } - // copy back - forumPO.setAttachments(attPOSet); forum = forumService.updateForum(forumPO); // delete message attachment List topicDeleteAttachmentList = getTopicDeletedAttachmentList(sessionMap); - iter = topicDeleteAttachmentList.iterator(); + Iterator iter = topicDeleteAttachmentList.iterator(); while (iter.hasNext()) { Attachment delAtt = (Attachment) iter.next(); iter.remove(); @@ -460,10 +411,6 @@ forum = forumService.updateForum(forum); - // initialize attachmentList again - attachmentList = getAttachmentList(sessionMap); - attachmentList.addAll(forum.getAttachments()); - request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE); if (mode.isAuthor()) { return mapping.findForward("author"); @@ -472,157 +419,6 @@ } } - /** - * Handle upload online instruction files request. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - public ActionForward uploadOnline(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - return uploadFile(mapping, form, IToolContentHandler.TYPE_ONLINE, request); - } - - /** - * Handle upload offline instruction files request. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - public ActionForward uploadOffline(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - return uploadFile(mapping, form, IToolContentHandler.TYPE_OFFLINE, request); - } - - /** - * Common method to upload online or offline instruction files request. - * - * @param mapping - * @param form - * @param type - * @param request - * @return - */ - private ActionForward uploadFile(ActionMapping mapping, ActionForm form, String type, HttpServletRequest request) { - - ForumForm forumForm = (ForumForm) form; - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(forumForm.getSessionMapID()); - - FormFile file; - if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { - file = forumForm.getOfflineFile(); - } else { - file = forumForm.getOnlineFile(); - } - - if (file == null || StringUtils.isBlank(file.getFileName())) { - return mapping.findForward("success"); - } - - ActionMessages errors = new ActionMessages(); - FileValidatorUtil.validateFileSize(file, true, errors); - if (!errors.isEmpty()) { - this.saveErrors(request, errors); - return mapping.findForward("success"); - } - - forumService = getForumManager(); - // upload to repository - Attachment att = forumService.uploadInstructionFile(file, type); - - // handle session value - List attachmentList = getAttachmentList(sessionMap); - List deleteAttachmentList = getDeletedAttachmentList(sessionMap); - // first check exist attachment and delete old one (if exist) to deletedAttachmentList - Iterator iter = attachmentList.iterator(); - Attachment existAtt; - while (iter.hasNext()) { - existAtt = (Attachment) iter.next(); - if (StringUtils.equals(existAtt.getFileName(), att.getFileName()) - && StringUtils.equals(existAtt.getFileType(), att.getFileType())) { - // if there is same name attachment, delete old one - deleteAttachmentList.add(existAtt); - iter.remove(); - break; - } - } - // add to attachmentList - attachmentList.add(att); - - return mapping.findForward("success"); - - } - - /** - * Delete offline instruction file from current Forum authoring page. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - public ActionForward deleteOfflineFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - return deleteFile(mapping, form, request, response, IToolContentHandler.TYPE_OFFLINE); - } - - /** - * Delete online instruction file from current Forum authoring page. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - public ActionForward deleteOnlineFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - return deleteFile(mapping, form, request, response, IToolContentHandler.TYPE_ONLINE); - } - - /** - * @param request - * @param response - * @param form - * @param type - * @return - */ - private ActionForward deleteFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response, String type) { - Long versionID = new Long(WebUtil.readLongParam(request, "versionID")); - Long uuID = new Long(WebUtil.readLongParam(request, "uuID")); - // get sessionMAP - String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); - - // handle session value - List attachmentList = getAttachmentList(sessionMap); - List deleteAttachmentList = getDeletedAttachmentList(sessionMap); - // first check exist attachment and delete old one (if exist) to deletedAttachmentList - Iterator iter = attachmentList.iterator(); - Attachment existAtt; - while (iter.hasNext()) { - existAtt = (Attachment) iter.next(); - if (existAtt.getFileUuid().equals(uuID) && existAtt.getFileVersionId().equals(versionID)) { - // if there is same name attachment, delete old one - deleteAttachmentList.add(existAtt); - iter.remove(); - } - - } - - request.setAttribute(ForumConstants.ATTR_FILE_TYPE_FLAG, type); - request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMapID); - return mapping.findForward("success"); - } - // ****************************************************************************************************************** // Topic functions // ****************************************************************************************************************** @@ -712,7 +508,7 @@ if (forum != null) { List toolSessions = forumService.getSessionsByContentId(forum.getContentId()); for (ForumToolSession toolSession : toolSessions) { - Message newMsg = Message.newInstance(message, forum.getToolContentHandler()); + Message newMsg = Message.newInstance(message); newMsg.setToolSession(toolSession); newMsg.setAttachments(new TreeSet()); newMsg.setModifiedBy(null); @@ -971,22 +767,6 @@ * @param request * @return */ - private List getAttachmentList(SessionMap sessionMap) { - return getListFromSession(sessionMap, ForumConstants.ATTACHMENT_LIST); - } - - /** - * @param request - * @return - */ - private List getDeletedAttachmentList(SessionMap sessionMap) { - return getListFromSession(sessionMap, ForumConstants.DELETED_ATTACHMENT_LIST); - } - - /** - * @param request - * @return - */ private SortedSet getTopics(SessionMap sessionMap) { SortedSet topics = (SortedSet) sessionMap.get(ForumConstants.AUTHORING_TOPICS_LIST); if (topics == null) { @@ -995,7 +775,7 @@ } return topics; } - + /** * @param request * @return Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/ExportServlet.java =================================================================== diff -u -rb33e717f9a734d318eefab07a17234f07c770c92 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/ExportServlet.java (.../ExportServlet.java) (revision b33e717f9a734d318eefab07a17234f07c770c92) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/ExportServlet.java (.../ExportServlet.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -93,25 +93,6 @@ forumService = ForumServiceProxy.getForumService(getServletContext()); super.init(); } - - protected String doOfflineExport(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) { - if (toolContentID == null && toolSessionID == null) { - logger.error("Tool content Id or and session Id are null. Unable to activity title"); - } else { - Forum forum = null; - if ( toolContentID != null ) { - forum = forumService.getForumByContentId(toolContentID); - } else { - ForumToolSession session = forumService.getSessionBySessionId(toolSessionID); - if ( session != null ) - forum = session.getForum(); - } - if ( forum != null ) { - activityTitle = forum.getTitle(); - } - } - return super.doOfflineExport(request, response, directoryName, cookies); - } public String doExport(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) { Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java =================================================================== diff -u -r7817bc4fce30416c9737875ae2d137be0c6aa8ba -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java (.../LearningAction.java) (revision 7817bc4fce30416c9737875ae2d137be0c6aa8ba) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java (.../LearningAction.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -270,11 +270,6 @@ forum.setDefineLater(false); forumService.updateForum(forum); - // add run offline support - if (forum.getRunOffline()) { - return mapping.findForward("runOffline"); - } - // get all root topic to display on init page List rootTopics = forumService.getRootTopics(sessionId); if (!forum.isAllowNewTopic()) { @@ -316,9 +311,9 @@ Date tzSubmissionDeadline = DateUtil.convertToTimeZoneFromDefault(learnerTimeZone, submissionDeadline); Date currentLearnerDate = DateUtil.convertToTimeZoneFromDefault(learnerTimeZone, new Date()); - // calculate whether submission deadline has passed, and if so forward to "runOffline" + // calculate whether submission deadline has passed, and if so forward to "submissionDeadline" if (currentLearnerDate.after(tzSubmissionDeadline)) { - return mapping.findForward("runOffline"); + return mapping.findForward("submissionDeadline"); } } @@ -937,7 +932,7 @@ HttpSession ss = SessionManager.getSession(); UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); Long userID = new Long(user.getUserID().longValue()); - if (!forum.getRunOffline() && !forum.isAllowNewTopic()) { + if (!forum.isAllowNewTopic()) { List list = forumService.getRootTopics(sessionId); for (MessageDTO msgDto : list) { Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/ForumForm.java =================================================================== diff -u -r8a8c14627918cc58fa845c2369937bc482d2f6b9 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/ForumForm.java (.../ForumForm.java) (revision 8a8c14627918cc58fa845c2369937bc482d2f6b9) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/ForumForm.java (.../ForumForm.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -64,11 +64,6 @@ private String currentTab; private String sessionMapID; private String contentFolderID; - - private FormFile offlineFile; - private FormFile onlineFile; - private List onlineFileList; - private List offlineFileList; private Forum forum; @@ -91,19 +86,6 @@ //set Form special varaible from given forum if(forum != null){ this.toolContentID = forum.getContentId(); - onlineFileList = new ArrayList(); - offlineFileList = new ArrayList(); - Set fileSet = forum.getAttachments(); - if(fileSet != null){ - Iterator iter = fileSet.iterator(); - while(iter.hasNext()){ - Attachment file = (Attachment) iter.next(); - if(StringUtils.equalsIgnoreCase(file.getFileType(),IToolContentHandler.TYPE_OFFLINE)) - offlineFileList.add(file); - else - onlineFileList.add(file); - } - } }else{ logger.error("Initial ForumForm failed by null value of Forum."); } @@ -126,22 +108,6 @@ return forum; } - public void setOnlineFile(FormFile onlineFile) { - this.onlineFile = onlineFile; - } - - public FormFile getOnlineFile() { - return onlineFile; - } - - public void setOfflineFile(FormFile offlineFile) { - this.offlineFile = offlineFile; - } - - public FormFile getOfflineFile() { - return offlineFile; - } - public String getCurrentTab() { return currentTab; } @@ -157,22 +123,7 @@ public void setToolContentID(Long toolContentID) { this.toolContentID = toolContentID; } - - public List getOfflineFileList() { - return offlineFileList; - } - - public void setOfflineFileList(List offlineFileList) { - this.offlineFileList = offlineFileList; - } - - public List getOnlineFileList() { - return onlineFileList; - } - - public void setOnlineFileList(List onlineFileList) { - this.onlineFileList = onlineFileList; - } + public String getSessionMapID() { return sessionMapID; } Index: lams_tool_forum/web/WEB-INF/tiles-defs.xml =================================================================== diff -u -rd56929f06ad90a63082d514e6521adc175f3de27 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_forum/web/WEB-INF/tiles-defs.xml (.../tiles-defs.xml) (revision d56929f06ad90a63082d514e6521adc175f3de27) +++ lams_tool_forum/web/WEB-INF/tiles-defs.xml (.../tiles-defs.xml) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -65,9 +65,9 @@ - - - + + + Index: lams_tool_forum/web/jsps/authoring/authoring.jsp =================================================================== diff -u -rdb44c0602e8fa1b68b2ebce18a58a3d8215cc61b -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_forum/web/jsps/authoring/authoring.jsp (.../authoring.jsp) (revision db44c0602e8fa1b68b2ebce18a58a3d8215cc61b) +++ lams_tool_forum/web/jsps/authoring/authoring.jsp (.../authoring.jsp) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -9,16 +9,12 @@ - +
@@ -28,12 +24,9 @@ - - - + + + + + +
+

+ +

+
+ +
+ +
+ + + +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_forum/web/jsps/learning/runoffline.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_forum/web/jsps/learning/submissionDeadline.jsp =================================================================== diff -u --- lams_tool_forum/web/jsps/learning/submissionDeadline.jsp (revision 0) +++ lams_tool_forum/web/jsps/learning/submissionDeadline.jsp (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -0,0 +1,61 @@ +<%@ include file="/common/taglibs.jsp"%> + + +
+ +

+ +

+ +
+ + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + Index: lams_tool_forum/web/jsps/monitoring/header.jsp =================================================================== diff -u -rad2ec9d32d0f051e3334c443c5c5d558c111bdb4 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_forum/web/jsps/monitoring/header.jsp (.../header.jsp) (revision ad2ec9d32d0f051e3334c443c5c5d558c111bdb4) +++ lams_tool_forum/web/jsps/monitoring/header.jsp (.../header.jsp) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -23,7 +23,7 @@ selectTab(tabId); //for statistic page change: - if(tabId == 4) + if(tabId == 3) doStatistic(); } Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_forum/web/jsps/monitoring/instructions.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_forum/web/jsps/monitoring/monitoring.jsp =================================================================== diff -u -r77eb2c44ff2c1c9b5956d01bb7f931f27ca71a24 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_forum/web/jsps/monitoring/monitoring.jsp (.../monitoring.jsp) (revision 77eb2c44ff2c1c9b5956d01bb7f931f27ca71a24) +++ lams_tool_forum/web/jsps/monitoring/monitoring.jsp (.../monitoring.jsp) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -5,17 +5,15 @@ - - - + +
- - - + +
Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dao/IGmapAttachmentDAO.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dao/IGmapDAO.java =================================================================== diff -u -r9ed689d51b8f41ba820bd7e6be8e3253703096a8 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dao/IGmapDAO.java (.../IGmapDAO.java) (revision 9ed689d51b8f41ba820bd7e6be8e3253703096a8) +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dao/IGmapDAO.java (.../IGmapDAO.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -37,7 +37,5 @@ Gmap getByContentId(Long toolContentId); void saveOrUpdate(Gmap toContent); - - void deleteInstructionFile(Long toolContentId, Long uuid, Long versionId, String type); } Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dao/hibernate/GmapAttachmentDAO.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dao/hibernate/GmapDAO.java =================================================================== diff -u -r9ed689d51b8f41ba820bd7e6be8e3253703096a8 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dao/hibernate/GmapDAO.java (.../GmapDAO.java) (revision 9ed689d51b8f41ba820bd7e6be8e3253703096a8) +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dao/hibernate/GmapDAO.java (.../GmapDAO.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -30,7 +30,6 @@ import org.lamsfoundation.lams.dao.hibernate.BaseDAO; import org.lamsfoundation.lams.tool.gmap.dao.IGmapDAO; import org.lamsfoundation.lams.tool.gmap.model.Gmap; -import org.lamsfoundation.lams.tool.gmap.model.GmapAttachment; import org.springframework.orm.hibernate3.HibernateTemplate; /** @@ -40,10 +39,6 @@ private static final String FIND_FORUM_BY_CONTENTID = "from Gmap gmap where gmap.toolContentId=?"; - private static final String FIND_INSTRUCTION_FILE = "from " - + GmapAttachment.class.getName() - + " as i where tool_content_id=? and i.file_uuid=? and i.file_version_id=? and i.file_type=?"; - public Gmap getByContentId(Long toolContentId) { List list = getHibernateTemplate().find(FIND_FORUM_BY_CONTENTID, toolContentId); @@ -57,22 +52,4 @@ this.getHibernateTemplate().saveOrUpdate(gmap); this.getHibernateTemplate().flush(); } - - public void deleteInstructionFile(Long toolContentId, Long uuid, - Long versionId, String type) { - HibernateTemplate templ = this.getHibernateTemplate(); - if (toolContentId != null && uuid != null && versionId != null) { - List list = getSession().createQuery(FIND_INSTRUCTION_FILE) - .setLong(0, toolContentId.longValue()).setLong(1, - uuid.longValue()).setLong(2, versionId.longValue()) - .setString(3, type).list(); - if (list != null && list.size() > 0) { - GmapAttachment file = (GmapAttachment) list.get(0); - this.getSession().setFlushMode(FlushMode.AUTO); - templ.delete(file); - templ.flush(); - } - } - - } } Index: lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dbupdates/patch20140102.sql =================================================================== diff -u --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dbupdates/patch20140102.sql (revision 0) +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dbupdates/patch20140102.sql (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -0,0 +1,19 @@ +-- Turn off autocommit, so nothing is committed if there is an error +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; +----------------------Put all sql statements below here------------------------- + +-- LDEV-3147 Simplify tools: get rid of instructions tab, define in monitor and offline activity options +ALTER TABLE tl_lagmap10_gmap DROP COLUMN online_instructions; +ALTER TABLE tl_lagmap10_gmap DROP COLUMN offline_instructions; +ALTER TABLE tl_lagmap10_gmap DROP COLUMN run_offline; +DROP TABLE IF EXISTS tl_lagmap10_attachment; + +UPDATE lams_tool SET tool_version='20140102' WHERE tool_signature='lagmap10'; + +----------------------Put all sql statements above here------------------------- + +-- If there were no errors, commit and restore autocommit to on +COMMIT; +SET AUTOCOMMIT = 1; +SET FOREIGN_KEY_CHECKS=1; \ No newline at end of file Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dto/GmapAttachmentDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dto/GmapDTO.java =================================================================== diff -u -r910b2ac5592ed40624543c6e5d22f5a80547d588 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dto/GmapDTO.java (.../GmapDTO.java) (revision 910b2ac5592ed40624543c6e5d22f5a80547d588) +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dto/GmapDTO.java (.../GmapDTO.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -25,17 +25,16 @@ package org.lamsfoundation.lams.tool.gmap.dto; +import java.util.HashSet; import java.util.Iterator; -import java.util.Set; import java.util.List; +import java.util.Set; import java.util.TreeSet; -import java.util.HashSet; import org.apache.log4j.Logger; import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; import org.lamsfoundation.lams.tool.gmap.model.Gmap; import org.lamsfoundation.lams.tool.gmap.model.GmapMarker; -import org.lamsfoundation.lams.tool.gmap.model.GmapAttachment; import org.lamsfoundation.lams.tool.gmap.model.GmapSession; /** @@ -52,10 +51,6 @@ public String title; public String instructions; - - public String onlineInstructions; - - public String offlineInstructions; public boolean defineLater; @@ -96,11 +91,7 @@ String defaultGeocoderAddress; public Set gmapMarkers = new HashSet(); - - public Set onlineInstructionsFiles; - public Set offlineInstructionsFiles; - public Set sessionDTOs = new TreeSet(); /* Constructors */ @@ -110,8 +101,6 @@ toolContentId = gmap.getToolContentId(); title = gmap.getTitle(); instructions = gmap.getInstructions(); - onlineInstructions = gmap.getOnlineInstructions(); - offlineInstructions = gmap.getOfflineInstructions(); contentInUse = gmap.isContentInUse(); //allowRichEditor = gmap.isAllowRichEditor(); lockOnFinish = gmap.isLockOnFinished(); @@ -131,25 +120,6 @@ reflectInstructions = gmap.getReflectInstructions(); defaultGeocoderAddress = gmap.getDefaultGeocoderAddress(); - onlineInstructionsFiles = new TreeSet(); - offlineInstructionsFiles = new TreeSet(); - - for (Iterator i = gmap.getGmapAttachments().iterator(); i.hasNext();) { - GmapAttachment att = (GmapAttachment) i.next(); - if (att.getFileType().equals(IToolContentHandler.TYPE_OFFLINE)) { - GmapAttachmentDTO attDTO = new GmapAttachmentDTO(att); - offlineInstructionsFiles.add(attDTO); - } else if (att.getFileType() - .equals(IToolContentHandler.TYPE_ONLINE)) { - GmapAttachmentDTO attDTO = new GmapAttachmentDTO(att); - onlineInstructionsFiles.add(attDTO); - } else { - // something is wrong. Ignore file, log error - logger.error("File with uid " + att.getFileUuid() - + " contains invalid fileType: " + att.getFileType()); - } - } - for (Iterator iter = gmap.getGmapSessions().iterator(); iter.hasNext();) { GmapSession session = (GmapSession) iter.next(); GmapSessionDTO sessionDTO = new GmapSessionDTO(session); @@ -174,40 +144,6 @@ this.instructions = instructions; } - public String getOfflineInstructions() { - return offlineInstructions; - } - - public void setOfflineInstructions(String offlineInstructions) { - this.offlineInstructions = offlineInstructions; - } - - public Set getOfflineInstructionsFiles() { - return offlineInstructionsFiles; - } - - public void setOfflineInstructionsFiles( - Set offlineInstructionsFiles) { - this.offlineInstructionsFiles = offlineInstructionsFiles; - } - - public String getOnlineInstructions() { - return onlineInstructions; - } - - public void setOnlineInstructions(String onlineInstructions) { - this.onlineInstructions = onlineInstructions; - } - - public Set getOnlineInstructionsFiles() { - return onlineInstructionsFiles; - } - - public void setOnlineInstructionsFiles( - Set onlineInstructionsFiles) { - this.onlineInstructionsFiles = onlineInstructionsFiles; - } - public String getTitle() { return title; } Index: lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/gmapApplicationContext.xml =================================================================== diff -u -r126d84999e520648cb187e465cb4aaa3baad222e -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/gmapApplicationContext.xml (.../gmapApplicationContext.xml) (revision 126d84999e520648cb187e465cb4aaa3baad222e) +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/gmapApplicationContext.xml (.../gmapApplicationContext.xml) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -17,19 +17,16 @@ - - - + - @@ -43,8 +40,6 @@ PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED - PROPAGATION_REQUIRED - PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED @@ -76,10 +71,6 @@ - - - - Index: lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/model/Gmap.java =================================================================== diff -u -r3813117828096a5d4063e220506bbc6357be2683 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/model/Gmap.java (.../Gmap.java) (revision 3813117828096a5d4063e220506bbc6357be2683) +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/model/Gmap.java (.../Gmap.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -36,7 +36,6 @@ /** * @hibernate.class table="tl_lagmap10_gmap" */ - public class Gmap implements java.io.Serializable, Cloneable { private static final long serialVersionUID = 938457189932877382L; @@ -61,9 +60,6 @@ // activity instructions private String instructions; - // run offline flag - private boolean runOffline; - // lock when user finishes activity private boolean lockOnFinished; @@ -103,12 +99,6 @@ // map type private String mapType; - // online instructions - private String onlineInstructions; - - // offline instructions - private String offlineInstructions; - // flag for content in use private boolean contentInUse; @@ -127,52 +117,12 @@ // default Geocoder Address (Set to "Macquarie University, Sydney NSW" by default) String defaultGeocoderAddress; - // list of attached files for the gmap - private Set gmapAttachments; - // list of sessions for this gmap private Set gmapSessions; // list of markers for this gmap private Set gmapMarkers; - //*********** NON Persist fields - private IToolContentHandler toolContentHandler; - - // Constructors - - /** default constructor */ - public Gmap() { - } - - /** full constructor */ - public Gmap(Date createDate, Date updateDate, Long createBy, String title, - String instructions, boolean runOffline, boolean lockOnFinished, - boolean filteringEnabled, String filterKeywords, - String onlineInstructions, String offlineInstructions, - boolean contentInUse, boolean defineLater, Long toolContentId, - boolean reflectOnActivity, String reflectInstructions, String defaultGeocoderAddress, - Set gmapAttachments, Set gmapSessions, Set markers) { - this.createDate = createDate; - this.updateDate = updateDate; - this.createBy = createBy; - this.title = title; - this.instructions = instructions; - this.runOffline = runOffline; - this.lockOnFinished = lockOnFinished; - this.onlineInstructions = onlineInstructions; - this.offlineInstructions = offlineInstructions; - this.contentInUse = contentInUse; - this.defineLater = defineLater; - this.toolContentId = toolContentId; - this.gmapAttachments = gmapAttachments; - this.gmapSessions = gmapSessions; - this.gmapMarkers = markers; - this.reflectOnActivity = reflectOnActivity; - this.reflectInstructions = reflectInstructions; - this.defaultGeocoderAddress = defaultGeocoderAddress; - } - // Property accessors /** * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" @@ -260,19 +210,6 @@ } /** - * @hibernate.property column="run_offline" length="1" - * - */ - - public boolean isRunOffline() { - return this.runOffline; - } - - public void setRunOffline(boolean runOffline) { - this.runOffline = runOffline; - } - - /** * @hibernate.property column="lock_on_finished" length="1" * */ @@ -286,32 +223,6 @@ } /** - * @hibernate.property column="online_instructions" length="65535" - * - */ - - public String getOnlineInstructions() { - return this.onlineInstructions; - } - - public void setOnlineInstructions(String onlineInstructions) { - this.onlineInstructions = onlineInstructions; - } - - /** - * @hibernate.property column="offline_instructions" length="65535" - * - */ - - public String getOfflineInstructions() { - return this.offlineInstructions; - } - - public void setOfflineInstructions(String offlineInstructions) { - this.offlineInstructions = offlineInstructions; - } - - /** * @hibernate.property column="content_in_use" length="1" * */ @@ -351,21 +262,6 @@ } /** - * @hibernate.set lazy="false" inverse="false" cascade="all-delete-orphan" - * @hibernate.collection-key column="gmap_uid" - * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.gmap.model.GmapAttachment" - * - */ - - public Set getGmapAttachments() { - return this.gmapAttachments; - } - - public void setGmapAttachments(Set gmapAttachments) { - this.gmapAttachments = gmapAttachments; - } - - /** * @hibernate.set lazy="true" inverse="true" cascade="none" * @hibernate.collection-key column="gmap_uid" * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.gmap.model.GmapSession" @@ -421,10 +317,8 @@ return result; } - public static Gmap newInstance(Gmap fromContent, Long toContentId, - IToolContentHandler gmapToolContentHandler) { + public static Gmap newInstance(Gmap fromContent, Long toContentId) { Gmap toContent = new Gmap(); - fromContent.toolContentHandler = gmapToolContentHandler; toContent = (Gmap) fromContent.clone(); toContent.setToolContentId(toContentId); toContent.setCreateDate(new Date()); @@ -438,23 +332,10 @@ gmap = (Gmap) super.clone(); gmap.setUid(null); - Set attachmentSet = new HashSet(); Set markerSet = new HashSet(); - - if (gmapAttachments != null) { - // create a copy of the attachments - Iterator iter = gmapAttachments.iterator(); - while (iter.hasNext()) { - GmapAttachment originalFile = (GmapAttachment) iter.next(); - GmapAttachment newFile = (GmapAttachment) originalFile.clone(); - attachmentSet.add(newFile); - } - } - gmap.gmapAttachments = attachmentSet; - if (gmapMarkers != null) { - // create a copy of the attachments + // create a copy of the markers Iterator iter = gmapMarkers.iterator(); while (iter.hasNext()) { GmapMarker originalMarker = (GmapMarker) iter.next(); @@ -474,14 +355,6 @@ return gmap; } - public IToolContentHandler getToolContentHandler() { - return toolContentHandler; - } - - public void setToolContentHandler(IToolContentHandler toolContentHandler) { - this.toolContentHandler = toolContentHandler; - } - /** * @hibernate.set lazy="false" * cascade="all-delete-orphan" Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/model/GmapAttachment.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/service/GmapImportContentVersionFilter.java =================================================================== diff -u --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/service/GmapImportContentVersionFilter.java (revision 0) +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/service/GmapImportContentVersionFilter.java (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -0,0 +1,43 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ +package org.lamsfoundation.lams.tool.gmap.service; + +import org.lamsfoundation.lams.learningdesign.service.ToolContentVersionFilter; +import org.lamsfoundation.lams.tool.gmap.model.Gmap; + +/** + * Import filter class for different version of Gmap content. + */ +public class GmapImportContentVersionFilter extends ToolContentVersionFilter { + + /** + * Import 20080521 version content to 20140102 version tool server. + */ + public void up20080521To20140102() { + this.removeField(Gmap.class, "runOffline"); + this.removeField(Gmap.class, "onlineInstructions"); + this.removeField(Gmap.class, "offlineInstructions"); + this.removeField(Gmap.class, "gmapAttachments"); + } +} Index: lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/service/GmapService.java =================================================================== diff -u -r33da76d05725a84e191a5f6dca50b394cca3c1ee -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/service/GmapService.java (.../GmapService.java) (revision 33da76d05725a84e191a5f6dca50b394cca3c1ee) +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/service/GmapService.java (.../GmapService.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -68,14 +68,12 @@ import org.lamsfoundation.lams.tool.exception.DataMissingException; import org.lamsfoundation.lams.tool.exception.SessionDataExistsException; import org.lamsfoundation.lams.tool.exception.ToolException; -import org.lamsfoundation.lams.tool.gmap.dao.IGmapAttachmentDAO; import org.lamsfoundation.lams.tool.gmap.dao.IGmapConfigItemDAO; import org.lamsfoundation.lams.tool.gmap.dao.IGmapDAO; import org.lamsfoundation.lams.tool.gmap.dao.IGmapMarkerDAO; import org.lamsfoundation.lams.tool.gmap.dao.IGmapSessionDAO; import org.lamsfoundation.lams.tool.gmap.dao.IGmapUserDAO; import org.lamsfoundation.lams.tool.gmap.model.Gmap; -import org.lamsfoundation.lams.tool.gmap.model.GmapAttachment; import org.lamsfoundation.lams.tool.gmap.model.GmapConfigItem; import org.lamsfoundation.lams.tool.gmap.model.GmapMarker; import org.lamsfoundation.lams.tool.gmap.model.GmapSession; @@ -112,18 +110,12 @@ private IGmapUserDAO gmapUserDAO = null; - private IGmapAttachmentDAO gmapAttachmentDAO = null; - private ILearnerService learnerService; private ILamsToolService toolService; private IToolContentHandler gmapToolContentHandler = null; - private IRepositoryService repositoryService = null; - - private IAuditService auditService = null; - private IExportToolContentService exportContentService; private ICoreNotebookService coreNotebookService; @@ -225,28 +217,10 @@ // create the fromContent using the default tool content fromContent = getDefaultContent(); } - Gmap toContent = Gmap.newInstance(fromContent, toContentId, gmapToolContentHandler); + Gmap toContent = Gmap.newInstance(fromContent, toContentId); gmapDAO.saveOrUpdate(toContent); } - public void setAsDefineLater(Long toolContentId, boolean value) throws DataMissingException, ToolException { - Gmap gmap = gmapDAO.getByContentId(toolContentId); - if (gmap == null) { - throw new ToolException("Could not find tool with toolContentID: " + toolContentId); - } - gmap.setDefineLater(value); - gmapDAO.saveOrUpdate(gmap); - } - - public void setAsRunOffline(Long toolContentId, boolean value) throws DataMissingException, ToolException { - Gmap gmap = gmapDAO.getByContentId(toolContentId); - if (gmap == null) { - throw new ToolException("Could not find tool with toolContentID: " + toolContentId); - } - gmap.setRunOffline(value); - gmapDAO.saveOrUpdate(gmap); - } - public void removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException, ToolException { // TODO Auto-generated method stub @@ -272,17 +246,10 @@ // set ResourceToolContentHandler as null to avoid copy file node in // repository again. - gmap = Gmap.newInstance(gmap, toolContentId, null); - gmap.setToolContentHandler(null); + gmap = Gmap.newInstance(gmap, toolContentId); gmap.setGmapSessions(null); gmap.setCreateBy(null); - gmap.setToolContentHandler(null); - Set atts = gmap.getGmapAttachments(); - for (GmapAttachment att : atts) { - att.setGmap(null); - } - Set markers = gmap.getGmapMarkers(); Set authorItems = new HashSet(); @@ -298,8 +265,6 @@ gmap.setGmapMarkers(authorItems); try { - exportContentService - .registerFileClassForExport(GmapAttachment.class.getName(), "fileUuid", "fileVersionId"); exportContentService.exportToolContent(toolContentId, gmap, gmapToolContentHandler, rootPath); } catch (ExportToolContentException e) { throw new ToolException(e); @@ -315,9 +280,9 @@ public void importToolContent(Long toolContentId, Integer newUserUid, String toolContentPath, String fromVersion, String toVersion) throws ToolException { try { - exportContentService.registerFileClassForImport(GmapAttachment.class.getName(), "fileUuid", - "fileVersionId", "fileName", "fileType", null, null); - + // register version filter class + exportContentService.registerImportVersionFilterClass(GmapImportContentVersionFilter.class); + Object toolPOJO = exportContentService.importToolContent(toolContentPath, gmapToolContentHandler, fromVersion, toVersion); if (!(toolPOJO instanceof Gmap)) { @@ -405,7 +370,7 @@ Gmap defaultContent = getDefaultContent(); // create new gmap using the newContentID Gmap newContent = new Gmap(); - newContent = Gmap.newInstance(defaultContent, newContentID, gmapToolContentHandler); + newContent = Gmap.newInstance(defaultContent, newContentID); gmapDAO.saveOrUpdate(newContent); return newContent; } @@ -438,36 +403,6 @@ return gmapUserDAO.getByUID(uid); } - public GmapAttachment uploadFileToContent(Long toolContentId, FormFile file, String type) { - if (file == null || StringUtils.isEmpty(file.getFileName())) { - throw new GmapException("Could not find upload file: " + file); - } - - NodeKey nodeKey = processFile(file, type); - - GmapAttachment attachment = new GmapAttachment(); - attachment.setFileType(type); - attachment.setFileUuid(nodeKey.getUuid()); - attachment.setFileVersionId(nodeKey.getVersion()); - attachment.setFileName(file.getFileName()); - - return attachment; - } - - public void deleteFromRepository(Long uuid, Long versionID) throws GmapException { - ITicket ticket = getRepositoryLoginTicket(); - try { - repositoryService.deleteVersion(ticket, uuid, versionID); - } catch (Exception e) { - throw new GmapException("Exception occured while deleting files from" + " the repository " + e.getMessage()); - } - } - - public void deleteInstructionFile(Long contentID, Long uuid, Long versionID, String type) { - gmapDAO.deleteInstructionFile(contentID, uuid, versionID, type); - - } - public void saveOrUpdateGmap(Gmap gmap) { gmapDAO.saveOrUpdate(gmap); } @@ -502,36 +437,6 @@ gmapConfigItemDAO.saveOrUpdate(item); } - public IAuditService getAuditService() { - return auditService; - } - - public void setAuditService(IAuditService auditService) { - this.auditService = auditService; - } - - private NodeKey processFile(FormFile file, String type) { - NodeKey node = null; - if (file != null && !StringUtils.isEmpty(file.getFileName())) { - String fileName = file.getFileName(); - try { - node = getGmapToolContentHandler().uploadFile(file.getInputStream(), fileName, file.getContentType(), - type); - } catch (InvalidParameterException e) { - throw new GmapException("InvalidParameterException occured while trying to upload File" - + e.getMessage()); - } catch (FileNotFoundException e) { - throw new GmapException("FileNotFoundException occured while trying to upload File" + e.getMessage()); - } catch (RepositoryCheckedException e) { - throw new GmapException("RepositoryCheckedException occured while trying to upload File" - + e.getMessage()); - } catch (IOException e) { - throw new GmapException("IOException occured while trying to upload File" + e.getMessage()); - } - } - return node; - } - /* * (non-Javadoc) * @@ -599,31 +504,6 @@ return toolService.isGroupedActivity(toolContentID); } - /** - * This method verifies the credentials of the SubmitFiles Tool and gives it the Ticket to login and - * access the Content Repository. - * - * A valid ticket is needed in order to access the content from the repository. This method would be called evertime - * the tool needs to upload/download files from the content repository. - * - * @return ITicket The ticket for repostory access - * @throws SubmitFilesException - */ - private ITicket getRepositoryLoginTicket() throws GmapException { - ICredentials credentials = new SimpleCredentials(GmapToolContentHandler.repositoryUser, - GmapToolContentHandler.repositoryId); - try { - ITicket ticket = repositoryService.login(credentials, GmapToolContentHandler.repositoryWorkspaceName); - return ticket; - } catch (AccessDeniedException ae) { - throw new GmapException("Access Denied to repository." + ae.getMessage()); - } catch (WorkspaceNotFoundException we) { - throw new GmapException("Workspace not found." + we.getMessage()); - } catch (LoginException e) { - throw new GmapException("Login failed." + e.getMessage()); - } - } - /* ===============Methods implemented from ToolContentImport102Manager =============== */ /** @@ -636,12 +516,7 @@ gmap.setCreateBy(new Long(user.getUserID().longValue())); gmap.setCreateDate(now); gmap.setDefineLater(Boolean.FALSE); - gmap.setInstructions(WebUtil.convertNewlines((String) importValues - .get(ToolContentImport102Manager.CONTENT_BODY))); gmap.setLockOnFinished(Boolean.TRUE); - gmap.setOfflineInstructions(null); - gmap.setOnlineInstructions(null); - gmap.setRunOffline(Boolean.FALSE); gmap.setTitle((String) importValues.get(ToolContentImport102Manager.CONTENT_TITLE)); gmap.setToolContentId(toolContentId); gmap.setUpdateDate(now); @@ -666,14 +541,6 @@ // ========================================================================================= /* ********** Used by Spring to "inject" the linked objects ************* */ - public IGmapAttachmentDAO getGmapAttachmentDAO() { - return gmapAttachmentDAO; - } - - public void setGmapAttachmentDAO(IGmapAttachmentDAO attachmentDAO) { - gmapAttachmentDAO = attachmentDAO; - } - public IGmapDAO getGmapDAO() { return gmapDAO; } @@ -738,14 +605,6 @@ this.coreNotebookService = coreNotebookService; } - public IRepositoryService getRepositoryService() { - return repositoryService; - } - - public void setRepositoryService(IRepositoryService repositoryService) { - this.repositoryService = repositoryService; - } - public IGmapMarkerDAO getGmapMarkerDAO() { return gmapMarkerDAO; } Index: lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/service/IGmapService.java =================================================================== diff -u -r714b9e7b785b4cc6b7a37e56938c0858f74138a5 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/service/IGmapService.java (.../IGmapService.java) (revision 714b9e7b785b4cc6b7a37e56938c0858f74138a5) +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/service/IGmapService.java (.../IGmapService.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -29,7 +29,6 @@ import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.tool.gmap.model.Gmap; -import org.lamsfoundation.lams.tool.gmap.model.GmapAttachment; import org.lamsfoundation.lams.tool.gmap.model.GmapConfigItem; import org.lamsfoundation.lams.tool.gmap.model.GmapMarker; import org.lamsfoundation.lams.tool.gmap.model.GmapSession; @@ -69,31 +68,6 @@ public Gmap getGmapByContentId(Long toolContentID); /** - * @param toolContentId - * @param file - * @param type - * @return - */ - public GmapAttachment uploadFileToContent(Long toolContentId, - FormFile file, String type); - - /** - * @param uuid - * @param versionID - */ - public void deleteFromRepository(Long uuid, Long versionID) - throws GmapException; - - /** - * @param contentID - * @param uuid - * @param versionID - * @param type - */ - public void deleteInstructionFile(Long contentID, Long uuid, - Long versionID, String type); - - /** * @param gmap */ public void saveOrUpdateGmap(Gmap gmap); Index: lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/util/GmapConstants.java =================================================================== diff -u -ra8324ce68a8de301097e84ef4919751ecd0b8fe8 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/util/GmapConstants.java (.../GmapConstants.java) (revision a8324ce68a8de301097e84ef4919751ecd0b8fe8) +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/util/GmapConstants.java (.../GmapConstants.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -33,8 +33,6 @@ public static final Integer SESSION_COMPLETED = new Integer(2); public static final String AUTHORING_DEFAULT_TAB = "1"; - public static final String ATTACHMENT_LIST = "attachmentList"; - public static final String DELETED_ATTACHMENT_LIST = "deletedAttachmentList"; public static final String AUTH_SESSION_ID_COUNTER = "authoringSessionIdCounter"; public static final String AUTH_SESSION_ID = "authoringSessionId"; Index: lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/web/actions/AuthoringAction.java =================================================================== diff -u -ra8324ce68a8de301097e84ef4919751ecd0b8fe8 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/web/actions/AuthoringAction.java (.../AuthoringAction.java) (revision a8324ce68a8de301097e84ef4919751ecd0b8fe8) +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/web/actions/AuthoringAction.java (.../AuthoringAction.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -26,9 +26,6 @@ import java.util.Date; import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; import java.util.Set; import javax.servlet.http.HttpServletRequest; @@ -40,13 +37,9 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessages; -import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.authoring.web.AuthoringConstants; -import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; import org.lamsfoundation.lams.tool.ToolAccessMode; import org.lamsfoundation.lams.tool.gmap.model.Gmap; -import org.lamsfoundation.lams.tool.gmap.model.GmapAttachment; import org.lamsfoundation.lams.tool.gmap.model.GmapConfigItem; import org.lamsfoundation.lams.tool.gmap.model.GmapMarker; import org.lamsfoundation.lams.tool.gmap.model.GmapUser; @@ -55,7 +48,6 @@ import org.lamsfoundation.lams.tool.gmap.util.GmapConstants; import org.lamsfoundation.lams.tool.gmap.web.forms.AuthoringForm; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; -import org.lamsfoundation.lams.util.FileValidatorUtil; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.action.LamsDispatchAction; import org.lamsfoundation.lams.web.session.SessionManager; @@ -85,16 +77,6 @@ private static final String KEY_MODE = "mode"; - private static final String KEY_ONLINE_FILES = "onlineFiles"; - - private static final String KEY_OFFLINE_FILES = "offlineFiles"; - - private static final String KEY_UNSAVED_ONLINE_FILES = "unsavedOnlineFiles"; - - private static final String KEY_UNSAVED_OFFLINE_FILES = "unsavedOfflineFiles"; - - private static final String KEY_DELETED_FILES = "deletedFiles"; - /** * Default method when no dispatch parameter is specified. It is expected * that the parameter toolContentID will be passed in. This @@ -196,31 +178,13 @@ updateGmap(gmap, authForm, mode, gmapUser); - - // remove attachments marked for deletion. - Set attachments = gmap.getGmapAttachments(); - if (attachments == null) { - attachments = new HashSet(); - } // do the same for the gmap markers Set markers = gmap.getGmapMarkers(); if (markers == null) { markers = new HashSet(); } - for (GmapAttachment att : getAttList(KEY_DELETED_FILES, map)) { - // remove from db, leave in repository - attachments.remove(att); - } - - // add unsaved attachments - attachments.addAll(getAttList(KEY_UNSAVED_ONLINE_FILES, map)); - attachments.addAll(getAttList(KEY_UNSAVED_OFFLINE_FILES, map)); - - // set attachments in case it didn't exist - gmap.setGmapAttachments(attachments); - // set the update date gmap.setUpdateDate(new Date()); @@ -247,166 +211,9 @@ return mapping.findForward("success"); } - public ActionForward uploadOnline(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) { - return uploadFile(mapping, (AuthoringForm) form, - IToolContentHandler.TYPE_ONLINE, request); - } - - public ActionForward uploadOffline(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) { - return uploadFile(mapping, (AuthoringForm) form, - IToolContentHandler.TYPE_OFFLINE, request); - } - - public ActionForward deleteOnline(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) { - return deleteFile(mapping, (AuthoringForm) form, - IToolContentHandler.TYPE_ONLINE, request); - } - - public ActionForward deleteOffline(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) { - return deleteFile(mapping, (AuthoringForm) form, - IToolContentHandler.TYPE_OFFLINE, request); - } - - public ActionForward removeUnsavedOnline(ActionMapping mapping, - ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - return removeUnsaved(mapping, (AuthoringForm) form, - IToolContentHandler.TYPE_ONLINE, request); - } - - public ActionForward removeUnsavedOffline(ActionMapping mapping, - ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - return removeUnsaved(mapping, (AuthoringForm) form, - IToolContentHandler.TYPE_OFFLINE, request); - } - /* ========== Private Methods ********** */ - private ActionForward uploadFile(ActionMapping mapping, - AuthoringForm authForm, String type, HttpServletRequest request) { - SessionMap map = getSessionMap(request, authForm); - FormFile file; - List unsavedFiles; - List savedFiles; - if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { - file = (FormFile) authForm.getOfflineFile(); - unsavedFiles = getAttList(KEY_UNSAVED_OFFLINE_FILES, map); - - savedFiles = getAttList(KEY_OFFLINE_FILES, map); - } else { - file = (FormFile) authForm.getOnlineFile(); - unsavedFiles = getAttList(KEY_UNSAVED_ONLINE_FILES, map); - - savedFiles = getAttList(KEY_ONLINE_FILES, map); - } - - // validate file max size - ActionMessages errors = new ActionMessages(); - FileValidatorUtil.validateFileSize(file, true, errors); - if (!errors.isEmpty()) { - request.setAttribute(GmapConstants.ATTR_SESSION_MAP, map); - this.saveErrors(request, errors); - return mapping.findForward("success"); - } - - if (file.getFileName().length() != 0) { - - // upload file to repository - GmapAttachment newAtt = gmapService.uploadFileToContent( - (Long) map.get(KEY_TOOL_CONTENT_ID), file, type); - - // Add attachment to unsavedFiles - // check to see if file with same name exists - GmapAttachment currAtt; - Iterator iter = savedFiles.iterator(); - while (iter.hasNext()) { - currAtt = (GmapAttachment) iter.next(); - if (StringUtils.equals(currAtt.getFileName(), newAtt - .getFileName())) { - // move from this this list to deleted list. - getAttList(KEY_DELETED_FILES, map).add(currAtt); - iter.remove(); - break; - } - } - unsavedFiles.add(newAtt); - - request.setAttribute(GmapConstants.ATTR_SESSION_MAP, map); - request.setAttribute("unsavedChanges", new Boolean(true)); - } - return mapping.findForward("success"); - } - - private ActionForward deleteFile(ActionMapping mapping, - AuthoringForm authForm, String type, HttpServletRequest request) { - SessionMap map = getSessionMap(request, authForm); - - List fileList; - if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { - fileList = getAttList(KEY_OFFLINE_FILES, map); - } else { - fileList = getAttList(KEY_ONLINE_FILES, map); - } - - Iterator iter = fileList.iterator(); - - while (iter.hasNext()) { - GmapAttachment att = (GmapAttachment) iter.next(); - - if (att.getFileUuid().equals(authForm.getDeleteFileUuid())) { - // move to delete file list, deleted at next updateContent - getAttList(KEY_DELETED_FILES, map).add(att); - - // remove from this list - iter.remove(); - break; - } - } - - request.setAttribute(GmapConstants.ATTR_SESSION_MAP, map); - request.setAttribute("unsavedChanges", new Boolean(true)); - - return mapping.findForward("success"); - } - - private ActionForward removeUnsaved(ActionMapping mapping, - AuthoringForm authForm, String type, HttpServletRequest request) { - SessionMap map = getSessionMap(request, authForm); - - List unsavedFiles; - - if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { - unsavedFiles = getAttList(KEY_UNSAVED_OFFLINE_FILES, map); - } else { - unsavedFiles = getAttList(KEY_UNSAVED_ONLINE_FILES, map); - } - - Iterator iter = unsavedFiles.iterator(); - while (iter.hasNext()) { - GmapAttachment att = (GmapAttachment) iter.next(); - - if (att.getFileUuid().equals(authForm.getDeleteFileUuid())) { - // delete from repository and list - gmapService.deleteFromRepository(att.getFileUuid(), att - .getFileVersionId()); - iter.remove(); - break; - } - } - - request.setAttribute(GmapConstants.ATTR_SESSION_MAP, map); - request.setAttribute("unsavedChanges", new Boolean(true)); - - return mapping.findForward("success"); - } - - /** * Updates Gmap content using AuthoringForm inputs. * @@ -424,8 +231,6 @@ if (mode.isAuthor()) { // Teacher cannot modify following gmap.setCreateBy(guser.getUid()); - gmap.setOfflineInstructions(authForm.getOnlineInstruction()); - gmap.setOnlineInstructions(authForm.getOfflineInstruction()); gmap.setLockOnFinished(authForm.isLockOnFinished()); gmap.setAllowEditMarkers(authForm.isAllowEditMarkers()); gmap.setAllowShowAllMarkers(authForm.isAllowShowAllMarkers()); @@ -456,8 +261,6 @@ { authForm.setTitle(gmap.getTitle()); authForm.setInstructions(gmap.getInstructions()); - authForm.setOnlineInstruction(gmap.getOnlineInstructions()); - authForm.setOfflineInstruction(gmap.getOfflineInstructions()); authForm.setLockOnFinished(gmap.isLockOnFinished()); authForm.setAllowEditMarkers(gmap.isAllowEditMarkers()); authForm.setAllowShowAllMarkers(gmap.isAllowShowAllMarkers()); @@ -490,24 +293,7 @@ map.put(KEY_MODE, mode); map.put(KEY_CONTENT_FOLDER_ID, contentFolderID); map.put(KEY_TOOL_CONTENT_ID, toolContentID); - map.put(KEY_ONLINE_FILES, new LinkedList()); - map.put(KEY_OFFLINE_FILES, new LinkedList()); - map.put(KEY_UNSAVED_ONLINE_FILES, new LinkedList()); - map.put(KEY_UNSAVED_OFFLINE_FILES,new LinkedList()); - map.put(KEY_DELETED_FILES, new LinkedList()); - Iterator iter = gmap.getGmapAttachments().iterator(); - while (iter.hasNext()) { - GmapAttachment attachment = (GmapAttachment) iter.next(); - String type = attachment.getFileType(); - if (type.equals(IToolContentHandler.TYPE_OFFLINE)) { - getAttList(KEY_OFFLINE_FILES, map).add(attachment); - } - if (type.equals(IToolContentHandler.TYPE_ONLINE)) { - getAttList(KEY_ONLINE_FILES, map).add(attachment); - } - } - return map; } @@ -530,19 +316,6 @@ } /** - * Retrieves a List of attachments from the map using the key. - * - * @param key - * @param map - * @return - */ - private List getAttList(String key, - SessionMap map) { - List list = (List) map.get(key); - return list; - } - - /** * Retrieve the SessionMap from the HttpSession using the author form. * * @param request Index: lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/web/actions/LearningAction.java =================================================================== diff -u -r8aded0b18a5a7712622ae56f38923fa297449977 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/web/actions/LearningAction.java (.../LearningAction.java) (revision 8aded0b18a5a7712622ae56f38923fa297449977) +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/web/actions/LearningAction.java (.../LearningAction.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -65,7 +65,6 @@ * @struts.action path="/learning" parameter="dispatch" scope="request" * name="learningForm" * @struts.action-forward name="gmap" path="tiles:/learning/main" - * @struts.action-forward name="runOffline" path="tiles:/learning/runOffline" * @struts.action-forward name="defineLater" path="tiles:/learning/defineLater" * @struts.action-forward name="notebook" path="/pages/learning/notebook.jsp" */ @@ -128,11 +127,6 @@ LearningWebUtil.putActivityPositionInRequestByToolSessionId(toolSessionID, request, getServlet() .getServletContext()); - // check runOffline - if (gmap.isRunOffline()) { - return mapping.findForward("runOffline"); - } - GmapUser gmapUser; if (mode.equals(ToolAccessMode.TEACHER)) { Long userID = WebUtil.readLongParam(request, AttributeNames.PARAM_USER_ID, false); Index: lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/web/servlets/ExportServlet.java =================================================================== diff -u -rb33e717f9a734d318eefab07a17234f07c770c92 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/web/servlets/ExportServlet.java (.../ExportServlet.java) (revision b33e717f9a734d318eefab07a17234f07c770c92) +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/web/servlets/ExportServlet.java (.../ExportServlet.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -109,30 +109,6 @@ return FILENAME; } - protected String doOfflineExport(HttpServletRequest request, HttpServletResponse response, String directoryName, - Cookie[] cookies) { - if (toolContentID == null && toolSessionID == null) { - logger.error("Tool content Id or and session Id are null. Unable to activity title"); - } else { - if (gmapService == null) { - gmapService = GmapServiceProxy.getGmapService(getServletContext()); - } - - Gmap content = null; - if (toolContentID != null) { - content = gmapService.getGmapByContentId(toolContentID); - } else { - GmapSession session = gmapService.getSessionBySessionId(toolSessionID); - if (session != null) - content = session.getGmap(); - } - if (content != null) { - activityTitle = content.getTitle(); - } - } - return super.doOfflineExport(request, response, directoryName, cookies); - } - private void doLearnerExport(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) throws GmapException { Index: lams_tool_gmap/web/WEB-INF/tiles-defs.xml =================================================================== diff -u -rd56929f06ad90a63082d514e6521adc175f3de27 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_gmap/web/WEB-INF/tiles-defs.xml (.../tiles-defs.xml) (revision d56929f06ad90a63082d514e6521adc175f3de27) +++ lams_tool_gmap/web/WEB-INF/tiles-defs.xml (.../tiles-defs.xml) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -86,10 +86,6 @@ - - - - Index: lams_tool_gmap/web/includes/javascript/authoring.js =================================================================== diff -u -r9ed689d51b8f41ba820bd7e6be8e3253703096a8 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_gmap/web/includes/javascript/authoring.js (.../authoring.js) (revision 9ed689d51b8f41ba820bd7e6be8e3253703096a8) +++ lams_tool_gmap/web/includes/javascript/authoring.js (.../authoring.js) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -26,10 +26,5 @@ document.authoringForm.dispatch.value = method; document.authoringForm.submit(); } -function deleteAttachment(dispatch, uuid) { - document.authoringForm.dispatch.value = dispatch; - document.authoringForm.deleteFileUuid.value = uuid; - document.authoringForm.submit(); -} Index: lams_tool_gmap/web/pages/authoring/authoring.jsp =================================================================== diff -u -r07816ee123b4d33a4ecfcbc266e6791417e699ae -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_gmap/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision 07816ee123b4d33a4ecfcbc266e6791417e699ae) +++ lams_tool_gmap/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -11,7 +11,6 @@ saveMapState(); } return save; - } @@ -24,20 +23,13 @@ - - @@ -54,11 +46,7 @@ -
- - -

@@ -68,15 +56,12 @@

- + <%-- Page tabs --%> - - - - + +
- - - + +
Index: lams_tool_images/conf/xdoclet/struts-actions.xml =================================================================== diff -u -re9a15f092fec282a10620269d12e833465367444 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_images/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision e9a15f092fec282a10620269d12e833465367444) +++ lams_tool_images/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -38,41 +38,6 @@
- - - - - - - - - - - - - - - - - + - - - - - - @@ -97,9 +91,6 @@ - - - @@ -112,9 +103,6 @@ - - - @@ -154,9 +142,7 @@ PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception - PROPAGATION_REQUIRED, -java.lang.Exception - PROPAGATION_REQUIRED,-java.lang.Exception - PROPAGATION_REQUIRED,-java.lang.Exception + PROPAGATION_REQUIRED, -java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/ImageGallery.java =================================================================== diff -u -rdb681dba0a5e44ae9f4e4cf6b9bc575d6175212f -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/ImageGallery.java (.../ImageGallery.java) (revision db681dba0a5e44ae9f4e4cf6b9bc575d6175212f) +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/ImageGallery.java (.../ImageGallery.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -40,8 +40,6 @@ /** * ImageGallery * - * @author Dapeng Ni - * * @hibernate.class table="tl_laimag10_imageGallery" * */ @@ -62,7 +60,6 @@ private Long nextImageTitle; // advance - private boolean runOffline; private boolean allowVote; @@ -78,13 +75,6 @@ private boolean allowRank; - // instructions - private String onlineInstructions; - - private String offlineInstructions; - - private Set attachments; - // general infomation private Date created; @@ -101,30 +91,20 @@ private boolean notifyTeachersOnImageSumbit; - // *************** NON Persist Fields ******************** - private IToolContentHandler toolContentHandler; - - private List onlineFileList; - - private List offlineFileList; - /** * Default contruction method. * */ public ImageGallery() { nextImageTitle = new Long(1); - attachments = new HashSet(); imageGalleryItems = new HashSet(); } // ********************************************************** // Function method for ImageGallery // ********************************************************** - public static ImageGallery newInstance(ImageGallery defaultContent, Long contentId, - ImageGalleryToolContentHandler imageGalleryToolContentHandler) { + public static ImageGallery newInstance(ImageGallery defaultContent, Long contentId) { ImageGallery toContent = new ImageGallery(); - defaultContent.toolContentHandler = imageGalleryToolContentHandler; toContent = (ImageGallery) defaultContent.clone(); toContent.setContentId(contentId); @@ -157,19 +137,6 @@ } imageGallery.imageGalleryItems = set; } - // clone attachment - if (attachments != null) { - Iterator iter = attachments.iterator(); - Set set = new HashSet(); - while (iter.hasNext()) { - ImageGalleryAttachment file = (ImageGalleryAttachment) iter.next(); - ImageGalleryAttachment newFile = (ImageGalleryAttachment) file.clone(); - // just clone old file without duplicate it in repository - - set.add(newFile); - } - imageGallery.attachments = set; - } // clone ReourceUser as well if (createdBy != null) { imageGallery.setCreatedBy((ImageGalleryUser) createdBy.clone()); @@ -193,15 +160,13 @@ final ImageGallery genericEntity = (ImageGallery) o; return new EqualsBuilder().append(uid, genericEntity.uid).append(title, genericEntity.title).append( - instructions, genericEntity.instructions).append(onlineInstructions, genericEntity.onlineInstructions) - .append(offlineInstructions, genericEntity.offlineInstructions).append(created, genericEntity.created) + instructions, genericEntity.instructions).append(created, genericEntity.created) .append(updated, genericEntity.updated).append(createdBy, genericEntity.createdBy).isEquals(); } @Override public int hashCode() { - return new HashCodeBuilder().append(uid).append(title).append(instructions).append(onlineInstructions).append( - offlineInstructions).append(created).append(updated).append(createdBy).toHashCode(); + return new HashCodeBuilder().append(uid).append(title).append(instructions).append(created).append(updated).append(createdBy).toHashCode(); } /** @@ -216,21 +181,6 @@ this.setUpdated(new Date(now)); } - public void toDTO() { - onlineFileList = new ArrayList(); - offlineFileList = new ArrayList(); - Set fileSet = this.getAttachments(); - if (fileSet != null) { - for (ImageGalleryAttachment file : fileSet) { - if (StringUtils.equalsIgnoreCase(file.getFileType(), IToolContentHandler.TYPE_OFFLINE)) { - offlineFileList.add(file); - } else { - onlineFileList.add(file); - } - } - } - } - // ********************************************************** // get/set methods // ********************************************************** @@ -320,26 +270,6 @@ } /** - * @return Returns the runOffline. - * - * @hibernate.property column="run_offline" - * - */ - public boolean getRunOffline() { - return runOffline; - } - - /** - * @param runOffline - * The forceOffLine to set. - * - * - */ - public void setRunOffline(boolean forceOffline) { - runOffline = forceOffline; - } - - /** * @return Returns the lockWhenFinish. * * @hibernate.property column="lock_on_finished" @@ -382,55 +312,10 @@ public void setNextImageTitle(Long nextImageTitle) { this.nextImageTitle = nextImageTitle; } - - /** - * @return Returns the onlineInstructions set by the teacher. - * - * @hibernate.property column="online_instructions" type="text" - */ - public String getOnlineInstructions() { - return onlineInstructions; - } - public void setOnlineInstructions(String onlineInstructions) { - this.onlineInstructions = onlineInstructions; - } - /** - * @return Returns the onlineInstructions set by the teacher. * - * @hibernate.property column="offline_instructions" type="text" - */ - public String getOfflineInstructions() { - return offlineInstructions; - } - - public void setOfflineInstructions(String offlineInstructions) { - this.offlineInstructions = offlineInstructions; - } - - /** * - * @hibernate.set lazy="true" cascade="all" inverse="false" order-by="create_date desc" - * @hibernate.collection-key column="imageGallery_uid" - * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.imageGallery.model.ImageGalleryAttachment" - * - * @return a set of Attachments to this Message. - */ - public Set getAttachments() { - return attachments; - } - - /* - * @param attachments The attachments to set. - */ - public void setAttachments(Set attachments) { - this.attachments = attachments; - } - - /** - * - * * @hibernate.set lazy="true" inverse="false" cascade="all" order-by="create_date desc" * @hibernate.collection-key column="imageGallery_uid" * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.imageGallery.model.ImageGalleryItem" @@ -516,27 +401,7 @@ public void setAllowVote(boolean allowVote) { this.allowVote = allowVote; } - - public List getOfflineFileList() { - return offlineFileList; - } - public void setOfflineFileList(List offlineFileList) { - this.offlineFileList = offlineFileList; - } - - public List getOnlineFileList() { - return onlineFileList; - } - - public void setOnlineFileList(List onlineFileList) { - this.onlineFileList = onlineFileList; - } - - public void setToolContentHandler(IToolContentHandler toolContentHandler) { - this.toolContentHandler = toolContentHandler; - } - /** * @hibernate.property column="reflect_instructions" * @return Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/IImageGalleryService.java =================================================================== diff -u -re9a15f092fec282a10620269d12e833465367444 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/IImageGalleryService.java (.../IImageGalleryService.java) (revision e9a15f092fec282a10620269d12e833465367444) +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/IImageGalleryService.java (.../IImageGalleryService.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -70,16 +70,6 @@ List getAuthoredItems(Long imageGalleryUid); /** - * Upload instruciton file into repository. - * - * @param file - * @param type - * @return - * @throws UploadImageGalleryFileException - */ - ImageGalleryAttachment uploadInstructionFile(FormFile file, String type) throws UploadImageGalleryFileException; - - /** * Upload imageGallery item file to repository. i.e., single file, websize zip file, or learning object zip file. * * @param item @@ -111,28 +101,14 @@ */ ImageGalleryUser getUserByIDAndSession(Long userId, Long sessionId); - // ********** Repository methods *********************** /** - * Delete file from repository. - */ - void deleteFromRepository(Long fileUuid, Long fileVersionId) throws ImageGalleryException; - - /** * Save or update imageGallery into database. * * @param ImageGallery */ void saveOrUpdateImageGallery(ImageGallery ImageGallery); /** - * Delete reource attachment(i.e., offline/online instruction file) from database. This method does not delete the - * file from repository. - * - * @param attachmentUid - */ - void deleteImageGalleryAttachment(Long attachmentUid); - - /** * Delete resoruce item from database. * * @param uid Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryImportContentVersionFilter.java =================================================================== diff -u --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryImportContentVersionFilter.java (revision 0) +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryImportContentVersionFilter.java (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -0,0 +1,43 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ +package org.lamsfoundation.lams.tool.imageGallery.service; + +import org.lamsfoundation.lams.learningdesign.service.ToolContentVersionFilter; +import org.lamsfoundation.lams.tool.imageGallery.model.ImageGallery; + +/** + * Import filter class for different version of ImageGallery content. + */ +public class ImageGalleryImportContentVersionFilter extends ToolContentVersionFilter { + + /** + * Import 20090819 version content to 20140102 version tool server. + */ + public void up20090819To20140102() { + this.removeField(ImageGallery.class, "runOffline"); + this.removeField(ImageGallery.class, "onlineInstructions"); + this.removeField(ImageGallery.class, "offlineInstructions"); + this.removeField(ImageGallery.class, "attachments"); + } +} Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryServiceImpl.java =================================================================== diff -u -r33da76d05725a84e191a5f6dca50b394cca3c1ee -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryServiceImpl.java (.../ImageGalleryServiceImpl.java) (revision 33da76d05725a84e191a5f6dca50b394cca3c1ee) +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryServiceImpl.java (.../ImageGalleryServiceImpl.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -76,7 +76,6 @@ import org.lamsfoundation.lams.tool.exception.ToolException; import org.lamsfoundation.lams.tool.imageGallery.ImageGalleryConstants; import org.lamsfoundation.lams.tool.imageGallery.dao.ImageCommentDAO; -import org.lamsfoundation.lams.tool.imageGallery.dao.ImageGalleryAttachmentDAO; import org.lamsfoundation.lams.tool.imageGallery.dao.ImageGalleryConfigItemDAO; import org.lamsfoundation.lams.tool.imageGallery.dao.ImageGalleryDAO; import org.lamsfoundation.lams.tool.imageGallery.dao.ImageGalleryItemDAO; @@ -134,8 +133,6 @@ private ImageVoteDAO imageVoteDao; - private ImageGalleryAttachmentDAO imageGalleryAttachmentDao; - private ImageGalleryUserDAO imageGalleryUserDao; private ImageGallerySessionDAO imageGallerySessionDao; @@ -152,7 +149,6 @@ private ImageGalleryOutputFactory imageGalleryOutputFactory; // system services - private IRepositoryService repositoryService; private ILamsToolService toolService; @@ -173,70 +169,7 @@ // ******************************************************************************* // Service method // ******************************************************************************* - /** - * Try to get the file. If forceLogin = false and an access denied exception occurs, call this method again to get a - * new ticket and retry file lookup. If forceLogin = true and it then fails then throw exception. - * - * @param uuid - * @param versionId - * @param relativePath - * @param attemptCount - * @return file node - * @throws ImscpApplicationException - */ - private IVersionedNode getFile(Long uuid, Long versionId, String relativePath) throws ImageGalleryException { - ITicket tic = getRepositoryLoginTicket(); - - try { - - return repositoryService.getFileItem(tic, uuid, versionId, relativePath); - - } catch (AccessDeniedException e) { - - String error = "Unable to access repository to get file uuid " + uuid + " version id " + versionId - + " path " + relativePath + "."; - - error = error + "AccessDeniedException: " + e.getMessage() + " Unable to retry further."; - ImageGalleryServiceImpl.log.error(error); - throw new ImageGalleryException(error, e); - - } catch (Exception e) { - - String error = "Unable to access repository to get file uuid " + uuid + " version id " + versionId - + " path " + relativePath + "." + " Exception: " + e.getMessage(); - ImageGalleryServiceImpl.log.error(error); - throw new ImageGalleryException(error, e); - - } - } - - /** - * This method verifies the credentials of the ImageGallery Tool and gives it the Ticket to login and - * access the Content Repository. - * - * A valid ticket is needed in order to access the content from the repository. This method would be called evertime - * the tool needs to upload/download files from the content repository. - * - * @return ITicket The ticket for repostory access - * @throws ImageGalleryException - */ - private ITicket getRepositoryLoginTicket() throws ImageGalleryException { - ICredentials credentials = new SimpleCredentials(imageGalleryToolContentHandler.getRepositoryUser(), - imageGalleryToolContentHandler.getRepositoryId()); - try { - ITicket ticket = repositoryService.login(credentials, imageGalleryToolContentHandler - .getRepositoryWorkspaceName()); - return ticket; - } catch (AccessDeniedException ae) { - throw new ImageGalleryException("Access Denied to repository." + ae.getMessage()); - } catch (WorkspaceNotFoundException we) { - throw new ImageGalleryException("Workspace not found." + we.getMessage()); - } catch (LoginException e) { - throw new ImageGalleryException("Login failed." + e.getMessage()); - } - } - public ImageGallery getImageGalleryByContentId(Long contentId) { ImageGallery rs = imageGalleryDao.getByContentId(contentId); if (rs == null) { @@ -255,7 +188,7 @@ ImageGallery defaultContent = getDefaultImageGallery(); // save default content by given ID. ImageGallery content = new ImageGallery(); - content = ImageGallery.newInstance(defaultContent, contentId, imageGalleryToolContentHandler); + content = ImageGallery.newInstance(defaultContent, contentId); // content.setNextImageTitle(new Long(1)); return content; } @@ -264,23 +197,6 @@ return imageGalleryItemDao.getAuthoringItems(imageGalleryUid); } - public ImageGalleryAttachment uploadInstructionFile(FormFile uploadFile, String fileType) - throws UploadImageGalleryFileException { - - // upload file to repository - NodeKey nodeKey = uploadFormFile(uploadFile, fileType); - - // create new attachement - ImageGalleryAttachment file = new ImageGalleryAttachment(); - file.setFileType(fileType); - file.setFileUuid(nodeKey.getUuid()); - file.setFileVersionId(nodeKey.getVersion()); - file.setFileName(uploadFile.getFileName()); - file.setCreated(new Date()); - - return file; - } - public void saveUser(ImageGalleryUser imageGalleryUser) { imageGalleryUserDao.saveObject(imageGalleryUser); } @@ -293,25 +209,10 @@ return imageGalleryUserDao.getUserByUserIDAndSessionID(userId, sessionId); } - public void deleteFromRepository(Long fileUuid, Long fileVersionId) throws ImageGalleryException { - ITicket ticket = getRepositoryLoginTicket(); - try { - repositoryService.deleteVersion(ticket, fileUuid, fileVersionId); - } catch (Exception e) { - throw new ImageGalleryException("Exception occured while deleting files from" + " the repository " - + e.getMessage()); - } - } - public void saveOrUpdateImageGallery(ImageGallery imageGallery) { imageGalleryDao.saveObject(imageGallery); } - public void deleteImageGalleryAttachment(Long attachmentUid) { - imageGalleryAttachmentDao.removeObject(ImageGalleryAttachment.class, attachmentUid); - - } - public ImageGalleryItem getImageGalleryItemByUid(Long itemUid) { return imageGalleryItemDao.getByUid(itemUid); } @@ -631,7 +532,7 @@ throws UploadImageGalleryFileException { try { // upload file - NodeKey nodeKey = uploadFormFile(file, IToolContentHandler.TYPE_ONLINE); + NodeKey nodeKey = uploadFormFile(file); image.setFileName(file.getFileName()); image.setFileType(file.getContentType()); image.setFileVersionId(nodeKey.getVersion()); @@ -650,8 +551,8 @@ InputStream mediumIS = ResizePictureUtil.resizePicture(originalImage, mediumImageDimensions); String mediumFileName = ImageGalleryServiceImpl.MEDIUM_FILENAME_PREFIX + fileName.substring(0, fileName.indexOf('.')) + ".jpg"; - NodeKey mediumNodeKey = imageGalleryToolContentHandler.uploadFile(mediumIS, mediumFileName, file - .getContentType(), IToolContentHandler.TYPE_ONLINE); + NodeKey mediumNodeKey = imageGalleryToolContentHandler.uploadFile(mediumIS, mediumFileName, + file.getContentType()); image.setMediumFileUuid(mediumNodeKey.getUuid()); ImageGalleryConfigItem thumbnailImageDimensionsKey = getConfigItem(ImageGalleryConfigItem.KEY_THUMBNAIL_IMAGE_DIMENSIONS); @@ -665,8 +566,8 @@ InputStream thumbnailIS = ResizePictureUtil.resizePicture(mediumImage, thumbnailImageDimensions); String thumbnailFileName = ImageGalleryServiceImpl.THUMBNAIL_FILENAME_PREFIX + fileName.substring(0, fileName.indexOf('.')) + ".jpg"; - NodeKey thumbnailNodeKey = imageGalleryToolContentHandler.uploadFile(thumbnailIS, thumbnailFileName, file - .getContentType(), IToolContentHandler.TYPE_ONLINE); + NodeKey thumbnailNodeKey = imageGalleryToolContentHandler.uploadFile(thumbnailIS, thumbnailFileName, + file.getContentType()); image.setThumbnailFileUuid(thumbnailNodeKey.getUuid()); } catch (RepositoryCheckedException e) { @@ -694,16 +595,16 @@ * @throws RepositoryCheckedException * @throws InvalidParameterException */ - private NodeKey uploadFormFile(FormFile file, String fileType) throws UploadImageGalleryFileException { + private NodeKey uploadFormFile(FormFile file) throws UploadImageGalleryFileException { if (file == null || StringUtils.isEmpty(file.getFileName())) { throw new UploadImageGalleryFileException(messageService.getMessage("error.msg.upload.file.not.found", new Object[] { file })); } NodeKey node = null; try { - node = imageGalleryToolContentHandler.uploadFile(file.getInputStream(), file.getFileName(), file - .getContentType(), fileType); + node = imageGalleryToolContentHandler.uploadFile(file.getInputStream(), file.getFileName(), + file.getContentType()); } catch (InvalidParameterException e) { throw new UploadImageGalleryFileException(messageService.getMessage("error.msg.invaid.param.upload")); } catch (FileNotFoundException e) { @@ -734,15 +635,7 @@ public void setMessageService(MessageService messageService) { this.messageService = messageService; } - - public void setRepositoryService(IRepositoryService repositoryService) { - this.repositoryService = repositoryService; - } - - public void setImageGalleryAttachmentDao(ImageGalleryAttachmentDAO imageGalleryAttachmentDao) { - this.imageGalleryAttachmentDao = imageGalleryAttachmentDao; - } - + public void setImageGalleryDao(ImageGalleryDAO imageGalleryDao) { this.imageGalleryDao = imageGalleryDao; } @@ -813,10 +706,7 @@ } // set ImageGalleryToolContentHandler as null to avoid copy file node in repository again. - toolContentObj = ImageGallery.newInstance(toolContentObj, toolContentId, null); - toolContentObj.setToolContentHandler(null); - toolContentObj.setOfflineFileList(null); - toolContentObj.setOnlineFileList(null); + toolContentObj = ImageGallery.newInstance(toolContentObj, toolContentId); Set images = toolContentObj.getImageGalleryItems(); for (ImageGalleryItem image : images) { image.setComments(null); @@ -832,21 +722,18 @@ originalFile.setFileUuid(image.getOriginalFileUuid()); originalFile.setFileVersionId(image.getFileVersionId()); originalFile.setFileName(fileName); - originalFile.setFileType(IToolContentHandler.TYPE_ONLINE); image.setOriginalFile(originalFile); ImageGalleryAttachment mediumFile = new ImageGalleryAttachment(); mediumFile.setFileUuid(image.getMediumFileUuid()); mediumFile.setFileVersionId(image.getFileVersionId()); mediumFile.setFileName(ImageGalleryServiceImpl.MEDIUM_FILENAME_PREFIX + fileName); - mediumFile.setFileType(IToolContentHandler.TYPE_ONLINE); image.setMediumFile(mediumFile); ImageGalleryAttachment thumbnailFile = new ImageGalleryAttachment(); thumbnailFile.setFileUuid(image.getThumbnailFileUuid()); thumbnailFile.setFileVersionId(image.getFileVersionId()); thumbnailFile.setFileName(ImageGalleryServiceImpl.THUMBNAIL_FILENAME_PREFIX + fileName); - thumbnailFile.setFileType(IToolContentHandler.TYPE_ONLINE); image.setThumbnailFile(thumbnailFile); } @@ -864,6 +751,9 @@ String toVersion) throws ToolException { try { + // register version filter class + exportContentService.registerImportVersionFilterClass(ImageGalleryImportContentVersionFilter.class); + exportContentService.registerFileClassForImport(ImageGalleryAttachment.class.getName(), "fileUuid", "fileVersionId", "fileName", "fileType", null, null); @@ -943,7 +833,7 @@ } } - ImageGallery toContent = ImageGallery.newInstance(imageGallery, toContentId, imageGalleryToolContentHandler); + ImageGallery toContent = ImageGallery.newInstance(imageGallery, toContentId); imageGalleryDao.saveObject(toContent); // save imageGallery items as well @@ -960,23 +850,7 @@ public String getToolContentTitle(Long toolContentId) { return getImageGalleryByContentId(toolContentId).getTitle(); } - - public void setAsDefineLater(Long toolContentId, boolean value) throws DataMissingException, ToolException { - ImageGallery imageGallery = imageGalleryDao.getByContentId(toolContentId); - if (imageGallery == null) { - throw new ToolException("No found tool content by given content ID:" + toolContentId); - } - imageGallery.setDefineLater(value); - } - public void setAsRunOffline(Long toolContentId, boolean value) throws DataMissingException, ToolException { - ImageGallery imageGallery = imageGalleryDao.getByContentId(toolContentId); - if (imageGallery == null) { - throw new ToolException("No found tool content by given content ID:" + toolContentId); - } - imageGallery.setRunOffline(value); - } - public void removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException, ToolException { ImageGallery imageGallery = imageGalleryDao.getByContentId(toolContentId); Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/AuthoringAction.java =================================================================== diff -u -rdfe9ef3dde4b722b5d87c4964a66f19fd48ea2b0 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision dfe9ef3dde4b722b5d87c4964a66f19fd48ea2b0) +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -117,18 +117,6 @@ if (param.equals("updateContent")) { return updateContent(mapping, form, request, response); } - if (param.equals("uploadOnlineFile")) { - return uploadOnline(mapping, form, request, response); - } - if (param.equals("uploadOfflineFile")) { - return uploadOffline(mapping, form, request, response); - } - if (param.equals("deleteOnlineFile")) { - return deleteOnlineFile(mapping, form, request, response); - } - if (param.equals("deleteOfflineFile")) { - return deleteOfflineFile(mapping, form, request, response); - } // ----------------------- Add imageGallery item function --------------------------- if (param.equals("newImageInit")) { return newImageInit(mapping, form, request, response); @@ -208,11 +196,6 @@ imageGalleryForm.setImageGallery(imageGallery); imageGalleryForm.setAllowRatingsOrVote(imageGallery.isAllowVote() || imageGallery.isAllowRank()); - - // initialize instruction attachment list - List attachmentList = getAttachmentList(sessionMap); - attachmentList.clear(); - attachmentList.addAll(imageGallery.getAttachments()); } catch (Exception e) { AuthoringAction.log.error(e); throw new ServletException(e); @@ -351,53 +334,14 @@ imageGalleryPO.setCreatedBy(imageGalleryUser); - // **********************************Handle Authoring Instruction Attachement ********************* - // merge attachment info - // so far, attPOSet will be empty if content is existed. because PropertyUtils.copyProperties() is executed - Set attPOSet = imageGalleryPO.getAttachments(); - if (attPOSet == null) { - attPOSet = new HashSet(); - } - List attachmentList = getAttachmentList(sessionMap); - List deleteAttachmentList = getDeletedAttachmentList(sessionMap); - - // current attachemnt in authoring instruction tab. - Iterator iter = attachmentList.iterator(); - while (iter.hasNext()) { - ImageGalleryAttachment newAtt = (ImageGalleryAttachment) iter.next(); - attPOSet.add(newAtt); - } - attachmentList.clear(); - - // deleted attachment. 2 possible types: one is persist another is non-persist before. - iter = deleteAttachmentList.iterator(); - while (iter.hasNext()) { - ImageGalleryAttachment delAtt = (ImageGalleryAttachment) iter.next(); - iter.remove(); - // it is an existed att, then delete it from current attachmentPO - if (delAtt.getUid() != null) { - Iterator attIter = attPOSet.iterator(); - while (attIter.hasNext()) { - ImageGalleryAttachment att = (ImageGalleryAttachment) attIter.next(); - if (delAtt.getUid().equals(att.getUid())) { - attIter.remove(); - break; - } - } - service.deleteImageGalleryAttachment(delAtt.getUid()); - }// end remove from persist value - } - // copy back - imageGalleryPO.setAttachments(attPOSet); - // ************************* Handle imageGallery allowRank item ******************* imageGalleryPO.setAllowRank(imageGalleryForm.isAllowRatingsOrVote() && !imageGalleryPO.isAllowVote()); // ************************* Handle imageGallery items ******************* // Handle imageGallery items Set itemList = new LinkedHashSet(); SortedSet imageList = getImageList(sessionMap); - iter = imageList.iterator(); + Iterator iter = imageList.iterator(); while (iter.hasNext()) { ImageGalleryItem item = (ImageGalleryItem) iter.next(); if (item != null) { @@ -429,9 +373,6 @@ // finally persist imageGalleryPO again service.saveOrUpdateImageGallery(imageGalleryPO); - // initialize attachmentList again - attachmentList = getAttachmentList(sessionMap); - attachmentList.addAll(imageGallery.getAttachments()); imageGalleryForm.setImageGallery(imageGalleryPO); request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE); @@ -442,166 +383,6 @@ } } - /** - * Handle upload online instruction files request. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws UploadImageGalleryFileException - */ - public ActionForward uploadOnline(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws UploadImageGalleryFileException { - return uploadFile(mapping, form, IToolContentHandler.TYPE_ONLINE, request); - } - - /** - * Handle upload offline instruction files request. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws UploadImageGalleryFileException - */ - public ActionForward uploadOffline(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws UploadImageGalleryFileException { - return uploadFile(mapping, form, IToolContentHandler.TYPE_OFFLINE, request); - } - - /** - * Common method to upload online or offline instruction files request. - * - * @param mapping - * @param form - * @param type - * @param request - * @return - * @throws UploadImageGalleryFileException - */ - private ActionForward uploadFile(ActionMapping mapping, ActionForm form, String type, HttpServletRequest request) - throws UploadImageGalleryFileException { - - ImageGalleryForm imageGalleryForm = (ImageGalleryForm) form; - // get back sessionMAP - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(imageGalleryForm.getSessionMapID()); - - FormFile file; - if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { - file = imageGalleryForm.getOfflineFile(); - } else { - file = imageGalleryForm.getOnlineFile(); - } - - if ((file == null) || StringUtils.isBlank(file.getFileName())) { - return mapping.findForward(ImageGalleryConstants.SUCCESS); - } - - // validate file size - ActionMessages errors = new ActionMessages(); - FileValidatorUtil.validateFileSize(file, true, errors); - if (!errors.isEmpty()) { - this.saveErrors(request, errors); - return mapping.findForward(ImageGalleryConstants.SUCCESS); - } - - IImageGalleryService service = getImageGalleryService(); - // upload to repository - ImageGalleryAttachment att = service.uploadInstructionFile(file, type); - // handle session value - List attachmentList = getAttachmentList(sessionMap); - List deleteAttachmentList = getDeletedAttachmentList(sessionMap); - // first check exist attachment and delete old one (if exist) to deletedAttachmentList - Iterator iter = attachmentList.iterator(); - ImageGalleryAttachment existAtt; - while (iter.hasNext()) { - existAtt = (ImageGalleryAttachment) iter.next(); - if (StringUtils.equals(existAtt.getFileName(), att.getFileName()) - && StringUtils.equals(existAtt.getFileType(), att.getFileType())) { - // if there is same name attachment, delete old one - deleteAttachmentList.add(existAtt); - iter.remove(); - break; - } - } - // add to attachmentList - attachmentList.add(att); - - return mapping.findForward(ImageGalleryConstants.SUCCESS); - - } - - /** - * Delete offline instruction file from current ImageGallery authoring page. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - public ActionForward deleteOfflineFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - return deleteFile(mapping, request, response, form, IToolContentHandler.TYPE_OFFLINE); - } - - /** - * Delete online instruction file from current ImageGallery authoring page. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - public ActionForward deleteOnlineFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - return deleteFile(mapping, request, response, form, IToolContentHandler.TYPE_ONLINE); - } - - /** - * General method to delete file (online or offline) - * - * @param mapping - * @param request - * @param response - * @param form - * @param type - * @return - */ - private ActionForward deleteFile(ActionMapping mapping, HttpServletRequest request, HttpServletResponse response, - ActionForm form, String type) { - Long versionID = new Long(WebUtil.readLongParam(request, ImageGalleryConstants.PARAM_FILE_VERSION_ID)); - Long uuID = new Long(WebUtil.readLongParam(request, ImageGalleryConstants.PARAM_FILE_UUID)); - - // get back sessionMAP - String sessionMapID = WebUtil.readStrParam(request, ImageGalleryConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); - - // handle session value - List attachmentList = getAttachmentList(sessionMap); - List deleteAttachmentList = getDeletedAttachmentList(sessionMap); - // first check exist attachment and delete old one (if exist) to deletedAttachmentList - Iterator iter = attachmentList.iterator(); - ImageGalleryAttachment existAtt; - while (iter.hasNext()) { - existAtt = (ImageGalleryAttachment) iter.next(); - if (existAtt.getFileUuid().equals(uuID) && existAtt.getFileVersionId().equals(versionID)) { - // if there is same name attachment, delete old one - deleteAttachmentList.add(existAtt); - iter.remove(); - } - } - - request.setAttribute(ImageGalleryConstants.ATTR_FILE_TYPE_FLAG, type); - request.setAttribute(ImageGalleryConstants.ATTR_SESSION_MAP_ID, sessionMapID); - return mapping.findForward(ImageGalleryConstants.SUCCESS); - - } - // ********************************************************** // Add Image methods // ********************************************************** @@ -871,22 +652,6 @@ } /** - * @param request - * @return - */ - private List getAttachmentList(SessionMap sessionMap) { - return getListFromSession(sessionMap, ImageGalleryConstants.ATT_ATTACHMENT_LIST); - } - - /** - * @param request - * @return - */ - private List getDeletedAttachmentList(SessionMap sessionMap) { - return getListFromSession(sessionMap, ImageGalleryConstants.ATTR_DELETED_ATTACHMENT_LIST); - } - - /** * List save current imageGallery items. * * @param request Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java =================================================================== diff -u -r1edbb81f16cedfcc1326e4eca6e520b5b48cbddc -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java (.../LearningAction.java) (revision 1edbb81f16cedfcc1326e4eca6e520b5b48cbddc) +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java (.../LearningAction.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -233,14 +233,6 @@ request, getServlet().getServletContext()); sessionMap.put(AttributeNames.ATTR_ACTIVITY_POSITION, activityPosition); - // add run offline support - if (imageGallery.getRunOffline()) { - sessionMap.put(ImageGalleryConstants.PARAM_RUN_OFFLINE, true); - return mapping.findForward("runOffline"); - } else { - sessionMap.put(ImageGalleryConstants.PARAM_RUN_OFFLINE, false); - } - // Create set of images, along with this filtering out items added by users from other groups TreeSet images = new TreeSet(new ImageGalleryItemComparator()); if (mode.isLearner()) { Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/MonitoringAction.java =================================================================== diff -u -r99e285ee1203e9036b58bf84cfce0a37a0386406 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/MonitoringAction.java (.../MonitoringAction.java) (revision 99e285ee1203e9036b58bf84cfce0a37a0386406) +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/MonitoringAction.java (.../MonitoringAction.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -142,7 +142,6 @@ List> groupList = service.getSummary(contentId); ImageGallery imageGallery = service.getImageGalleryByContentId(contentId); - imageGallery.toDTO(); Map> reflectList = service.getReflectList(contentId, false); boolean isGroupedActivity = service.isGroupedActivity(contentId); Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/form/ImageGalleryForm.java =================================================================== diff -u -rfd6a44adca1e0d4ee031b0b8b442de4ee8974d74 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/form/ImageGalleryForm.java (.../ImageGalleryForm.java) (revision fd6a44adca1e0d4ee031b0b8b442de4ee8974d74) +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/form/ImageGalleryForm.java (.../ImageGalleryForm.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -79,7 +79,6 @@ imageGallery.setLockWhenFinished(false); imageGallery.setDefineLater(false); imageGallery.setAllowVote(false); - imageGallery.setRunOffline(false); imageGallery.setReflectOnActivity(false); } } Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/servlet/ExportServlet.java =================================================================== diff -u -rb33e717f9a734d318eefab07a17234f07c770c92 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/servlet/ExportServlet.java (.../ExportServlet.java) (revision b33e717f9a734d318eefab07a17234f07c770c92) +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/servlet/ExportServlet.java (.../ExportServlet.java) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -125,27 +125,6 @@ return FILENAME; } - protected String doOfflineExport(HttpServletRequest request, HttpServletResponse response, String directoryName, - Cookie[] cookies) { - if (toolContentID == null && toolSessionID == null) { - logger.error("Tool content Id or and session Id are null. Unable to activity title"); - } else { - - ImageGallery content = null; - if (toolContentID != null) { - content = service.getImageGalleryByContentId(toolContentID); - } else { - ImageGallerySession session = service.getImageGallerySessionBySessionId(toolSessionID); - if (session != null) - content = session.getImageGallery(); - } - if (content != null) { - activityTitle = content.getTitle(); - } - } - return super.doOfflineExport(request, response, directoryName, cookies); - } - public void learner(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies, HashMap sessionMap) throws ImageGalleryException { Index: lams_tool_images/web/pages/authoring/authoring.jsp =================================================================== diff -u -r00ae80d4791f903bcb3661537fc7e129c72ad195 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_images/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision 00ae80d4791f903bcb3661537fc7e129c72ad195) +++ lams_tool_images/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -27,19 +27,7 @@ tag.value = tabId; // end optional tab controller stuff selectTab(tabId); - } - - function doUploadOnline() { - var myForm = $("authoringForm"); - myForm.action = ""; - myForm.submit(); } - - function doUploadOffline() { - var myForm = $("authoringForm"); - myForm.action = ""; - myForm.submit(); - } @@ -54,7 +42,6 @@ - @@ -81,11 +68,6 @@ - - - - - <%-- Default value cancelButtonLabelKey="label.authoring.cancel.button" Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_images/web/pages/authoring/instructions.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_images/web/pages/authoring/parts/instructionfilelist.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_images/web/pages/learning/runoffline.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_images/web/pages/monitoring/instructions.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_images/web/pages/monitoring/monitoring.jsp =================================================================== diff -u -rc0ae190cb1f4081bcf86fa46b07d1cbbd43ce250 -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_images/web/pages/monitoring/monitoring.jsp (.../monitoring.jsp) (revision c0ae190cb1f4081bcf86fa46b07d1cbbd43ce250) +++ lams_tool_images/web/pages/monitoring/monitoring.jsp (.../monitoring.jsp) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -46,18 +46,16 @@
- - - + +
Index: lams_tool_imscc/conf/xdoclet/struts-actions.xml =================================================================== diff -u -rf2b535f5f5e5134c69b47e2f813e05009afdbe4d -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_imscc/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision f2b535f5f5e5134c69b47e2f813e05009afdbe4d) +++ lams_tool_imscc/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -36,39 +36,6 @@
- - - - - - - - - - - - - - - +
@@ -121,11 +109,6 @@ - - - - - <%-- Default value cancelButtonLabelKey="label.authoring.cancel.button" Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_imscc/web/pages/authoring/instructions.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_imscc/web/pages/authoring/parts/instructionfilelist.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_imscc/web/pages/learning/runoffline.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6d674e346dea6ce7a824366c8a7c315660677744 refers to a dead (removed) revision in file `lams_tool_imscc/web/pages/monitoring/instructions.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_imscc/web/pages/monitoring/monitoring.jsp =================================================================== diff -u -rf2b535f5f5e5134c69b47e2f813e05009afdbe4d -r6d674e346dea6ce7a824366c8a7c315660677744 --- lams_tool_imscc/web/pages/monitoring/monitoring.jsp (.../monitoring.jsp) (revision f2b535f5f5e5134c69b47e2f813e05009afdbe4d) +++ lams_tool_imscc/web/pages/monitoring/monitoring.jsp (.../monitoring.jsp) (revision 6d674e346dea6ce7a824366c8a7c315660677744) @@ -39,18 +39,16 @@
- - - + +