Index: lams_tool_assessment/conf/xdoclet/struts-actions.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/conf/xdoclet/struts-actions.xml,v diff -u -r1.19 -r1.20 --- lams_tool_assessment/conf/xdoclet/struts-actions.xml 8 Jan 2014 17:47:02 -0000 1.19 +++ lams_tool_assessment/conf/xdoclet/struts-actions.xml 17 Jan 2014 21:35:01 -0000 1.20 @@ -38,41 +38,6 @@ - - - - - - - - - - - - - - - - - + - - - - - - @@ -76,9 +70,6 @@ - - - @@ -88,9 +79,6 @@ - - - @@ -152,8 +140,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 Fisheye: Tag 1.2 refers to a dead (removed) revision in file `lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/dao/AssessmentAttachmentDAO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/dao/hibernate/AssessmentAttachmentDAOHibernate.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/dbupdates/patch20140102.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/dbupdates/patch20140102.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/dbupdates/patch20140102.sql 17 Jan 2014 21:35:01 -0000 1.1 @@ -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_laasse10_assessment DROP COLUMN online_instructions; +ALTER TABLE tl_laasse10_assessment DROP COLUMN offline_instructions; +ALTER TABLE tl_laasse10_assessment DROP COLUMN run_offline; +DROP TABLE IF EXISTS tl_laasse10_attachment; + +UPDATE lams_tool SET tool_version='20140102' WHERE tool_signature='laasse10'; + +----------------------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_assessment/src/java/org/lamsfoundation/lams/tool/assessment/model/Assessment.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/model/Assessment.java,v diff -u -r1.14 -r1.15 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/model/Assessment.java 8 Jan 2014 17:47:01 -0000 1.14 +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/model/Assessment.java 17 Jan 2014 21:35:00 -0000 1.15 @@ -23,19 +23,14 @@ /* $Id$ */ package org.lamsfoundation.lams.tool.assessment.model; -import java.util.ArrayList; import java.util.Date; import java.util.Iterator; -import java.util.List; import java.util.Set; import java.util.TreeSet; -import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.log4j.Logger; -import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; -import org.lamsfoundation.lams.tool.assessment.util.AssessmentToolContentHandler; import org.lamsfoundation.lams.tool.assessment.util.SequencableComparator; /** @@ -70,8 +65,6 @@ private int attemptsAllowed; private int passingMark; - - private boolean runOffline; private boolean shuffled; @@ -101,13 +94,6 @@ private String reflectInstructions; - // instructions - private String onlineInstructions; - - private String offlineInstructions; - - private Set attachments; - // general infomation private Date created; @@ -125,19 +111,11 @@ private Set overallFeedbacks; - // *************** NON Persist Fields ******************** - private IToolContentHandler toolContentHandler; - - private List onlineFileList; - - private List offlineFileList; - /** * Default contruction method. * */ public Assessment() { - attachments = new TreeSet(); questions = new TreeSet(new SequencableComparator()); questionReferences = new TreeSet(new SequencableComparator()); overallFeedbacks = new TreeSet(new SequencableComparator()); @@ -146,10 +124,8 @@ // ********************************************************** // Function method for Assessment // ********************************************************** - public static Assessment newInstance(Assessment defaultContent, Long contentId, - AssessmentToolContentHandler assessmentToolContentHandler) { + public static Assessment newInstance(Assessment defaultContent, Long contentId) { Assessment toContent = new Assessment(); - defaultContent.toolContentHandler = assessmentToolContentHandler; toContent = (Assessment) defaultContent.clone(); toContent.setContentId(contentId); @@ -225,19 +201,6 @@ set.add(newOverallFeedback); } assessment.overallFeedbacks = set; - } - // clone attachment - if (attachments != null) { - Iterator iter = attachments.iterator(); - Set set = new TreeSet(); - while (iter.hasNext()) { - AssessmentAttachment file = (AssessmentAttachment) iter.next(); - AssessmentAttachment newFile = (AssessmentAttachment) file.clone(); - // just clone old file without duplicate it in repository - - set.add(newFile); - } - assessment.attachments = set; } // clone ReourceUser as well if (createdBy != null) { @@ -262,15 +225,13 @@ final Assessment genericEntity = (Assessment) 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(updated).append(createdBy).toHashCode(); } /** @@ -285,21 +246,6 @@ this.setUpdated(new Date(now)); } - public void toDTO() { - onlineFileList = new ArrayList(); - offlineFileList = new ArrayList(); - Set fileSet = this.getAttachments(); - if (fileSet != null) { - for (AssessmentAttachment file : fileSet) { - if (StringUtils.equalsIgnoreCase(file.getFileType(), IToolContentHandler.TYPE_OFFLINE)) { - offlineFileList.add(file); - } else { - onlineFileList.add(file); - } - } - } - } - // ********************************************************** // get/set methods // ********************************************************** @@ -406,26 +352,6 @@ public void setTitle(String title) { this.title = title; } - - /** - * @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; - } /** * If the tool utilizes leaders from Select Leader tool. @@ -473,52 +399,7 @@ } /** - * @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="assessment_uid" - * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.assessment.model.AssessmentAttachment" - * - * @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="sequence_id asc" * @hibernate.collection-key column="assessment_uid" * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.assessment.model.AssessmentQuestion" @@ -755,26 +636,6 @@ this.numbered = numbered; } - 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="attempt_completion_notify" * @return Fisheye: Tag 1.5 refers to a dead (removed) revision in file `lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/model/AssessmentAttachment.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentImportContentVersionFilter.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentImportContentVersionFilter.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentImportContentVersionFilter.java 17 Jan 2014 21:35:00 -0000 1.1 @@ -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: AssessmentImportContentVersionFilter.java,v 1.1 2014/01/17 21:35:00 andreyb Exp $ */ +package org.lamsfoundation.lams.tool.assessment.service; + +import org.lamsfoundation.lams.learningdesign.service.ToolContentVersionFilter; +import org.lamsfoundation.lams.tool.assessment.model.Assessment; + +/** + * Import filter class for different version of Assessment content. + */ +public class AssessmentImportContentVersionFilter extends ToolContentVersionFilter { + + /** + * Import 20140101 version content to 20140102 version tool server. + */ + public void up20140101To20140102() { + this.removeField(Assessment.class, "runOffline"); + this.removeField(Assessment.class, "onlineInstructions"); + this.removeField(Assessment.class, "offlineInstructions"); + this.removeField(Assessment.class, "attachments"); + } +} Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java,v diff -u -r1.35 -r1.36 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java 8 Jan 2014 17:47:02 -0000 1.35 +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java 17 Jan 2014 21:35:00 -0000 1.36 @@ -23,8 +23,6 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.assessment.service; -import java.io.FileNotFoundException; -import java.io.IOException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Date; @@ -42,19 +40,7 @@ import java.util.regex.Pattern; import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; -import org.apache.struts.upload.FormFile; -import org.lamsfoundation.lams.contentrepository.AccessDeniedException; -import org.lamsfoundation.lams.contentrepository.ICredentials; -import org.lamsfoundation.lams.contentrepository.ITicket; -import org.lamsfoundation.lams.contentrepository.InvalidParameterException; -import org.lamsfoundation.lams.contentrepository.LoginException; -import org.lamsfoundation.lams.contentrepository.NodeKey; -import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException; -import org.lamsfoundation.lams.contentrepository.WorkspaceNotFoundException; -import org.lamsfoundation.lams.contentrepository.service.IRepositoryService; -import org.lamsfoundation.lams.contentrepository.service.SimpleCredentials; import org.lamsfoundation.lams.events.IEventNotificationService; import org.lamsfoundation.lams.gradebook.service.IGradebookService; import org.lamsfoundation.lams.learning.service.ILearnerService; @@ -77,7 +63,6 @@ import org.lamsfoundation.lams.tool.ToolSessionExportOutputData; import org.lamsfoundation.lams.tool.ToolSessionManager; import org.lamsfoundation.lams.tool.assessment.AssessmentConstants; -import org.lamsfoundation.lams.tool.assessment.dao.AssessmentAttachmentDAO; import org.lamsfoundation.lams.tool.assessment.dao.AssessmentDAO; import org.lamsfoundation.lams.tool.assessment.dao.AssessmentQuestionDAO; import org.lamsfoundation.lams.tool.assessment.dao.AssessmentQuestionResultDAO; @@ -90,7 +75,6 @@ import org.lamsfoundation.lams.tool.assessment.dto.UserSummary; import org.lamsfoundation.lams.tool.assessment.dto.UserSummaryItem; import org.lamsfoundation.lams.tool.assessment.model.Assessment; -import org.lamsfoundation.lams.tool.assessment.model.AssessmentAttachment; import org.lamsfoundation.lams.tool.assessment.model.AssessmentOptionAnswer; import org.lamsfoundation.lams.tool.assessment.model.AssessmentQuestion; import org.lamsfoundation.lams.tool.assessment.model.AssessmentQuestionOption; @@ -129,8 +113,6 @@ private AssessmentQuestionDAO assessmentQuestionDao; - private AssessmentAttachmentDAO assessmentAttachmentDao; - private AssessmentUserDAO assessmentUserDao; private AssessmentSessionDAO assessmentSessionDao; @@ -147,7 +129,6 @@ private AssessmentOutputFactory assessmentOutputFactory; // system services - private IRepositoryService repositoryService; private ILamsToolService toolService; @@ -300,32 +281,6 @@ return assessmentUserDao.getBySessionID(toolSessionID); } - /** - * This method verifies the credentials of the Assessment 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 AssessmentApplicationException - */ - private ITicket getRepositoryLoginTicket() throws AssessmentApplicationException { - ICredentials credentials = new SimpleCredentials(assessmentToolContentHandler.getRepositoryUser(), - assessmentToolContentHandler.getRepositoryId()); - try { - ITicket ticket = repositoryService.login(credentials, assessmentToolContentHandler - .getRepositoryWorkspaceName()); - return ticket; - } catch (AccessDeniedException ae) { - throw new AssessmentApplicationException("Access Denied to repository." + ae.getMessage()); - } catch (WorkspaceNotFoundException we) { - throw new AssessmentApplicationException("Workspace not found." + we.getMessage()); - } catch (LoginException e) { - throw new AssessmentApplicationException("Login failed." + e.getMessage()); - } - } - @Override public Assessment getAssessmentByContentId(Long contentId) { Assessment rs = assessmentDao.getByContentId(contentId); @@ -346,7 +301,7 @@ Assessment defaultContent = getDefaultAssessment(); // save default content by given ID. Assessment content = new Assessment(); - content = Assessment.newInstance(defaultContent, contentId, assessmentToolContentHandler); + content = Assessment.newInstance(defaultContent, contentId); return content; } @@ -356,27 +311,6 @@ } @Override - public AssessmentAttachment uploadInstructionFile(FormFile uploadFile, String fileType) - throws UploadAssessmentFileException { - if (uploadFile == null || StringUtils.isEmpty(uploadFile.getFileName())) { - throw new UploadAssessmentFileException(messageService.getMessage("error.msg.upload.file.not.found", - new Object[] { uploadFile })); - } - // upload file to repository - NodeKey nodeKey = processFile(uploadFile, fileType); - - // create new attachement - AssessmentAttachment file = new AssessmentAttachment(); - file.setFileType(fileType); - file.setFileUuid(nodeKey.getUuid()); - file.setFileVersionId(nodeKey.getVersion()); - file.setFileName(uploadFile.getFileName()); - file.setCreated(new Date()); - - return file; - } - - @Override public void createUser(AssessmentUser assessmentUser) { assessmentUserDao.saveObject(assessmentUser); } @@ -392,27 +326,11 @@ } @Override - public void deleteFromRepository(Long fileUuid, Long fileVersionId) throws AssessmentApplicationException { - ITicket ticket = getRepositoryLoginTicket(); - try { - repositoryService.deleteVersion(ticket, fileUuid, fileVersionId); - } catch (Exception e) { - throw new AssessmentApplicationException("Exception occured while deleting files from" + " the repository " - + e.getMessage()); - } - } - - @Override public void saveOrUpdateAssessment(Assessment assessment) { assessmentDao.saveObject(assessment); } @Override - public void deleteAssessmentAttachment(Long attachmentUid) { - assessmentAttachmentDao.removeObject(AssessmentAttachment.class, attachmentUid); - } - - @Override public void deleteAssessmentQuestion(Long uid) { assessmentQuestionDao.removeObject(AssessmentQuestion.class, uid); } @@ -1176,35 +1094,6 @@ return contentId; } - /** - * Process an uploaded file. - * - * @throws AssessmentApplicationException - * @throws FileNotFoundException - * @throws IOException - * @throws RepositoryCheckedException - * @throws InvalidParameterException - */ - private NodeKey processFile(FormFile file, String fileType) throws UploadAssessmentFileException { - NodeKey node = null; - if (file != null && !StringUtils.isEmpty(file.getFileName())) { - String fileName = file.getFileName(); - try { - node = assessmentToolContentHandler.uploadFile(file.getInputStream(), fileName, file.getContentType(), - fileType); - } catch (InvalidParameterException e) { - throw new UploadAssessmentFileException(messageService.getMessage("error.msg.invaid.param.upload")); - } catch (FileNotFoundException e) { - throw new UploadAssessmentFileException(messageService.getMessage("error.msg.file.not.found")); - } catch (RepositoryCheckedException e) { - throw new UploadAssessmentFileException(messageService.getMessage("error.msg.repository")); - } catch (IOException e) { - throw new UploadAssessmentFileException(messageService.getMessage("error.msg.io.exception")); - } - } - return node; - } - // ***************************************************************************** // set methods for Spring Bean // ***************************************************************************** @@ -1221,14 +1110,6 @@ this.messageService = messageService; } - public void setRepositoryService(IRepositoryService repositoryService) { - this.repositoryService = repositoryService; - } - - public void setAssessmentAttachmentDao(AssessmentAttachmentDAO assessmentAttachmentDao) { - this.assessmentAttachmentDao = assessmentAttachmentDao; - } - public void setAssessmentDao(AssessmentDAO assessmentDao) { this.assessmentDao = assessmentDao; } @@ -1278,14 +1159,8 @@ throw new DataMissingException("Unable to find default content for the assessment tool"); } - // set AssessmentToolContentHandler as null to avoid copy file node in repository again. - toolContentObj = Assessment.newInstance(toolContentObj, toolContentId, null); - toolContentObj.setToolContentHandler(null); - toolContentObj.setOfflineFileList(null); - toolContentObj.setOnlineFileList(null); + toolContentObj = Assessment.newInstance(toolContentObj, toolContentId); try { - exportContentService.registerFileClassForExport(AssessmentAttachment.class.getName(), "fileUuid", - "fileVersionId"); exportContentService.exportToolContent(toolContentId, toolContentObj, assessmentToolContentHandler, rootPath); } catch (ExportToolContentException e) { @@ -1297,9 +1172,9 @@ String toVersion) throws ToolException { try { - exportContentService.registerFileClassForImport(AssessmentAttachment.class.getName(), "fileUuid", - "fileVersionId", "fileName", "fileType", null, null); - + // register version filter class + exportContentService.registerImportVersionFilterClass(AssessmentImportContentVersionFilter.class); + Object toolPOJO = exportContentService.importToolContent(toolContentPath, assessmentToolContentHandler, fromVersion, toVersion); if (!(toolPOJO instanceof Assessment)) { @@ -1368,26 +1243,10 @@ } } - Assessment toContent = Assessment.newInstance(assessment, toContentId, assessmentToolContentHandler); + Assessment toContent = Assessment.newInstance(assessment, toContentId); assessmentDao.saveObject(toContent); } - public void setAsDefineLater(Long toolContentId, boolean value) throws DataMissingException, ToolException { - Assessment assessment = assessmentDao.getByContentId(toolContentId); - if (assessment == null) { - throw new ToolException("No found tool content by given content ID:" + toolContentId); - } - assessment.setDefineLater(value); - } - - public void setAsRunOffline(Long toolContentId, boolean value) throws DataMissingException, ToolException { - Assessment assessment = assessmentDao.getByContentId(toolContentId); - if (assessment == null) { - throw new ToolException("No found tool content by given content ID:" + toolContentId); - } - assessment.setRunOffline(value); - } - public void removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException, ToolException { Assessment assessment = assessmentDao.getByContentId(toolContentId); Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/IAssessmentService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/IAssessmentService.java,v diff -u -r1.20 -r1.21 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/IAssessmentService.java 8 Jan 2014 17:47:02 -0000 1.20 +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/IAssessmentService.java 17 Jan 2014 21:35:00 -0000 1.21 @@ -30,17 +30,14 @@ import java.util.Map; import java.util.Set; -import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.events.IEventNotificationService; import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.tool.assessment.dto.QuestionSummary; import org.lamsfoundation.lams.tool.assessment.dto.ReflectDTO; import org.lamsfoundation.lams.tool.assessment.dto.Summary; import org.lamsfoundation.lams.tool.assessment.dto.UserSummary; import org.lamsfoundation.lams.tool.assessment.model.Assessment; -import org.lamsfoundation.lams.tool.assessment.model.AssessmentAttachment; import org.lamsfoundation.lams.tool.assessment.model.AssessmentQuestion; -import org.lamsfoundation.lams.tool.assessment.model.AssessmentQuestionResult; import org.lamsfoundation.lams.tool.assessment.model.AssessmentResult; import org.lamsfoundation.lams.tool.assessment.model.AssessmentSession; import org.lamsfoundation.lams.tool.assessment.model.AssessmentUser; @@ -115,16 +112,6 @@ */ List getAuthoredQuestions(Long assessmentUid); - /** - * Upload instruciton file into repository. - * - * @param file - * @param type - * @return - * @throws UploadAssessmentFileException - */ - AssessmentAttachment uploadInstructionFile(FormFile file, String type) throws UploadAssessmentFileException; - // ********** for user methods ************* /** * Create a new user in database. @@ -148,28 +135,14 @@ */ AssessmentUser getUserByIDAndSession(Long long1, Long sessionId); - // ********** Repository methods *********************** /** - * Delete file from repository. - */ - void deleteFromRepository(Long fileUuid, Long fileVersionId) throws AssessmentApplicationException; - - /** * Save or update assessment into database. * * @param Assessment */ void saveOrUpdateAssessment(Assessment Assessment); /** - * Delete reource attachment(i.e., offline/online instruction file) from database. This method does not delete the - * file from repository. - * - * @param attachmentUid - */ - void deleteAssessmentAttachment(Long attachmentUid); - - /** * Delete resoruce question from database. * * @param uid Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/util/AssessmentBundler.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/util/AssessmentBundler.java,v diff -u -r1.6 -r1.7 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/util/AssessmentBundler.java 29 Sep 2012 13:54:28 -0000 1.6 +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/util/AssessmentBundler.java 17 Jan 2014 21:35:01 -0000 1.7 @@ -34,7 +34,6 @@ import javax.servlet.http.HttpServletRequest; import org.lamsfoundation.lams.learning.export.web.action.Bundler; -import org.lamsfoundation.lams.tool.assessment.AssessmentConstants; import org.lamsfoundation.lams.util.Configuration; import org.lamsfoundation.lams.util.ConfigurationKeys; import org.lamsfoundation.lams.util.HttpUrlConnectionUtil; Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/AuthoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/AuthoringAction.java,v diff -u -r1.26 -r1.27 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/AuthoringAction.java 4 Jun 2013 13:49:18 -0000 1.26 +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/AuthoringAction.java 17 Jan 2014 21:35:00 -0000 1.27 @@ -33,7 +33,6 @@ import java.util.ArrayList; import java.util.Date; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; @@ -58,18 +57,14 @@ 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.learningdesign.service.ExportToolContentException; import org.lamsfoundation.lams.questions.Answer; import org.lamsfoundation.lams.questions.Question; import org.lamsfoundation.lams.questions.QuestionParser; import org.lamsfoundation.lams.tool.ToolAccessMode; import org.lamsfoundation.lams.tool.assessment.AssessmentConstants; import org.lamsfoundation.lams.tool.assessment.model.Assessment; -import org.lamsfoundation.lams.tool.assessment.model.AssessmentAttachment; import org.lamsfoundation.lams.tool.assessment.model.AssessmentOverallFeedback; import org.lamsfoundation.lams.tool.assessment.model.AssessmentQuestion; import org.lamsfoundation.lams.tool.assessment.model.AssessmentQuestionOption; @@ -78,13 +73,11 @@ import org.lamsfoundation.lams.tool.assessment.model.QuestionReference; import org.lamsfoundation.lams.tool.assessment.service.AssessmentApplicationException; import org.lamsfoundation.lams.tool.assessment.service.IAssessmentService; -import org.lamsfoundation.lams.tool.assessment.service.UploadAssessmentFileException; import org.lamsfoundation.lams.tool.assessment.util.SequencableComparator; import org.lamsfoundation.lams.tool.assessment.web.form.AssessmentForm; import org.lamsfoundation.lams.tool.assessment.web.form.AssessmentQuestionForm; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.FileUtil; -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; @@ -135,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); - } // ----------------------- Add assessment question functions --------------------------- if (param.equals("newQuestionInit")) { return newQuestionInit(mapping, form, request, response); @@ -261,11 +242,6 @@ } assessmentForm.setAssessment(assessment); - - // initialize instruction attachment list - List attachmentList = getAttachmentList(sessionMap); - attachmentList.clear(); - attachmentList.addAll(assessment.getAttachments()); } catch (Exception e) { AuthoringAction.log.error(e); throw new ServletException(e); @@ -396,47 +372,12 @@ } assessmentPO.setCreatedBy(assessmentUser); - - // **********************************Handle Authoring Instruction Attachement ********************* - // merge attachment info - // so far, attPOSet will be empty if content is existed. because PropertyUtils.copyProperties() is executed - Set attPOSet = assessmentPO.getAttachments(); - if (attPOSet == null) { - attPOSet = new HashSet(); - } - List attachmentList = getAttachmentList(sessionMap); - List deleteAttachmentList = getDeletedAttachmentList(sessionMap); - - // current attachemnt in authoring instruction tab. - attPOSet.addAll(attachmentList); - attachmentList.clear(); - - // deleted attachment. 2 possible types: one is persist another is non-persist before. - Iterator iter = deleteAttachmentList.iterator(); - while (iter.hasNext()) { - AssessmentAttachment delAtt = (AssessmentAttachment) 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()) { - AssessmentAttachment att = (AssessmentAttachment) attIter.next(); - if (delAtt.getUid().equals(att.getUid())) { - attIter.remove(); - break; - } - } - service.deleteAssessmentAttachment(delAtt.getUid()); - }// end remove from persist value - } - - // copy back - assessmentPO.setAttachments(attPOSet); + // ************************* Handle assessment questions ******************* // Handle assessment questions Set questions = new LinkedHashSet(); SortedSet topics = getQuestionList(sessionMap); - iter = topics.iterator(); + Iterator iter = topics.iterator(); while (iter.hasNext()) { AssessmentQuestion question = (AssessmentQuestion) iter.next(); if (question != null) { @@ -474,14 +415,6 @@ Set questionReferences = updateQuestionReferencesGrades(request, sessionMap, true); assessmentPO.setQuestionReferences(questionReferences); - // handle assessment question attachment file: - List delQuestionAttList = getDeletedQuestionAttachmentList(sessionMap); - iter = delQuestionAttList.iterator(); - while (iter.hasNext()) { - AssessmentQuestion delAtt = (AssessmentQuestion) iter.next(); - iter.remove(); - } - // ************************* Handle assessment overall feedbacks ******************* if (mode.isAuthor()) { TreeSet overallFeedbackList = getOverallFeedbacksFromForm(request, true); @@ -492,9 +425,6 @@ // finally persist assessmentPO again service.saveOrUpdateAssessment(assessmentPO); - // initialize attachmentList again - attachmentList = getAttachmentList(sessionMap); - attachmentList.addAll(assessment.getAttachments()); assessmentForm.setAssessment(assessmentPO); request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE); @@ -506,166 +436,6 @@ } /** - * Handle upload online instruction files request. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws UploadAssessmentFileException - */ - public ActionForward uploadOnline(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws UploadAssessmentFileException { - return uploadFile(mapping, form, IToolContentHandler.TYPE_ONLINE, request); - } - - /** - * Handle upload offline instruction files request. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws UploadAssessmentFileException - */ - public ActionForward uploadOffline(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws UploadAssessmentFileException { - 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 UploadAssessmentFileException - */ - private ActionForward uploadFile(ActionMapping mapping, ActionForm form, String type, HttpServletRequest request) - throws UploadAssessmentFileException { - - AssessmentForm assessmentForm = (AssessmentForm) form; - // get back sessionMAP - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(assessmentForm.getSessionMapID()); - updateQuestionReferencesGrades(request, sessionMap, true); - - FormFile file; - if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { - file = assessmentForm.getOfflineFile(); - } else { - file = assessmentForm.getOnlineFile(); - } - - if ((file == null) || StringUtils.isBlank(file.getFileName())) { - return mapping.findForward(AssessmentConstants.SUCCESS); - } - - // validate file size - ActionMessages errors = new ActionMessages(); - FileValidatorUtil.validateFileSize(file, true, errors); - if (!errors.isEmpty()) { - this.saveErrors(request, errors); - return mapping.findForward(AssessmentConstants.SUCCESS); - } - - IAssessmentService service = getAssessmentService(); - // upload to repository - AssessmentAttachment 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(); - AssessmentAttachment existAtt; - while (iter.hasNext()) { - existAtt = (AssessmentAttachment) 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(AssessmentConstants.SUCCESS); - - } - - /** - * Delete offline instruction file from current Assessment 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 Assessment 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, AssessmentConstants.PARAM_FILE_VERSION_ID)); - Long uuID = new Long(WebUtil.readLongParam(request, AssessmentConstants.PARAM_FILE_UUID)); - - // get back sessionMAP - String sessionMapID = WebUtil.readStrParam(request, AssessmentConstants.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(); - AssessmentAttachment existAtt; - while (iter.hasNext()) { - existAtt = (AssessmentAttachment) 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(AssessmentConstants.ATTR_FILE_TYPE_FLAG, type); - request.setAttribute(AssessmentConstants.ATTR_SESSION_MAP_ID, sessionMapID); - return mapping.findForward(AssessmentConstants.SUCCESS); - } - - /** * Display empty page for new assessment question. * * @param mapping @@ -1601,22 +1371,6 @@ } /** - * @param request - * @return - */ - private List getAttachmentList(SessionMap sessionMap) { - return getListFromSession(sessionMap, AssessmentConstants.ATT_ATTACHMENT_LIST); - } - - /** - * @param request - * @return - */ - private List getDeletedAttachmentList(SessionMap sessionMap) { - return getListFromSession(sessionMap, AssessmentConstants.ATTR_DELETED_ATTACHMENT_LIST); - } - - /** * List save current assessment questions. * * @param request @@ -1669,18 +1423,6 @@ } /** - * If a assessment question has attahment file, and the user edit this question 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 Assessmentquestion object for temporarily use. - * - * @param request - * @return - */ - private List getDeletedQuestionAttachmentList(SessionMap sessionMap) { - return getListFromSession(sessionMap, AssessmentConstants.ATTR_DELETED_QUESTION_ATTACHMENT_LIST); - } - - /** * Get java.util.List from HttpSession by given name. * * @param request Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/LearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/LearningAction.java,v diff -u -r1.33 -r1.34 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/LearningAction.java 8 Jan 2014 17:47:02 -0000 1.33 +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/LearningAction.java 17 Jan 2014 21:35:00 -0000 1.34 @@ -265,7 +265,6 @@ sessionMap.put(AssessmentConstants.ATTR_IS_RESUBMIT_ALLOWED, isResubmitAllowed); sessionMap.put(AssessmentConstants.ATTR_FINISHED_LOCK, finishedLock); sessionMap.put(AssessmentConstants.ATTR_USER_FINISHED, assessmentUser.isSessionFinished()); - sessionMap.put(AssessmentConstants.PARAM_RUN_OFFLINE, assessment.getRunOffline()); sessionMap.put(AttributeNames.ATTR_LEARNER_CONTENT_FOLDER, service.getLearnerContentFolder(toolSessionId, assessmentUser.getUserId())); sessionMap.put(AttributeNames.PARAM_TOOL_SESSION_ID, toolSessionId); @@ -290,11 +289,6 @@ assessment.setDefineLater(false); service.saveOrUpdateAssessment(assessment); - // run offline support - if (assessment.getRunOffline()) { - return mapping.findForward("runOffline"); - } - //check if there is submission deadline Date submissionDeadline = assessment.getSubmissionDeadline(); if (submissionDeadline != null) { @@ -307,9 +301,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"); } } Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/MonitoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/MonitoringAction.java,v diff -u -r1.20 -r1.21 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/MonitoringAction.java 21 Nov 2013 16:12:40 -0000 1.20 +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/MonitoringAction.java 17 Jan 2014 21:35:00 -0000 1.21 @@ -123,7 +123,6 @@ List summaryList = service.getSummaryList(contentId); Assessment assessment = service.getAssessmentByContentId(contentId); - assessment.toDTO(); //set SubmissionDeadline, if any if (assessment.getSubmissionDeadline() != null) { Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/form/AssessmentForm.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/form/AssessmentForm.java,v diff -u -r1.6 -r1.7 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/form/AssessmentForm.java 11 Jun 2013 10:30:18 -0000 1.6 +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/form/AssessmentForm.java 17 Jan 2014 21:35:00 -0000 1.7 @@ -81,7 +81,6 @@ assessment.setDefineLater(false); assessment.setShuffled(false); assessment.setNumbered(false); - assessment.setRunOffline(false); assessment.setDisplaySummary(false); assessment.setReflectOnActivity(false); } Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/servlet/ExportServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/servlet/ExportServlet.java,v diff -u -r1.8 -r1.9 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/servlet/ExportServlet.java 6 Jan 2014 08:42:26 -0000 1.8 +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/servlet/ExportServlet.java 17 Jan 2014 21:35:01 -0000 1.9 @@ -30,7 +30,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import java.util.TreeSet; import javax.servlet.ServletException; import javax.servlet.http.Cookie; @@ -40,7 +39,6 @@ import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.lamsfoundation.lams.notebook.model.NotebookEntry; -import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.ToolAccessMode; import org.lamsfoundation.lams.tool.assessment.AssessmentConstants; import org.lamsfoundation.lams.tool.assessment.dto.QuestionSummary; @@ -56,13 +54,10 @@ import org.lamsfoundation.lams.tool.assessment.service.IAssessmentService; import org.lamsfoundation.lams.tool.assessment.util.AssessmentBundler; import org.lamsfoundation.lams.tool.assessment.util.AssessmentToolContentHandler; -import org.lamsfoundation.lams.tool.assessment.util.ReflectDTOComparator; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.servlet.AbstractExportPortfolioServlet; import org.lamsfoundation.lams.web.util.AttributeNames; import org.lamsfoundation.lams.web.util.SessionMap; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; /** * Export portfolio servlet to export all assessment questions into offline HTML package. @@ -122,27 +117,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 { - - Assessment content = null; - if (toolContentID != null) { - content = service.getAssessmentByContentId(toolContentID); - } else { - AssessmentSession session = service.getAssessmentSessionBySessionId(toolSessionID); - if (session != null) - content = session.getAssessment(); - } - 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 AssessmentApplicationException { Index: lams_tool_assessment/web/pages/authoring/authoring.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/web/pages/authoring/authoring.jsp,v diff -u -r1.10 -r1.11 --- lams_tool_assessment/web/pages/authoring/authoring.jsp 8 Jan 2014 17:47:02 -0000 1.10 +++ lams_tool_assessment/web/pages/authoring/authoring.jsp 17 Jan 2014 21:35:01 -0000 1.11 @@ -1,10 +1,8 @@ - + <%@ include file="/common/taglibs.jsp"%> <%@ page import="org.lamsfoundation.lams.tool.assessment.AssessmentConstants"%> - <fmt:message key="label.author.title" /> @@ -29,20 +27,8 @@ tag.value = tabId; // end optional tab controller stuff selectTab(tabId); - } - - function doUploadOnline() { - var myForm = $("#authoringForm"); - myForm.attr("action", ""); - myForm.submit(); } - function doUploadOffline() { - var myForm = $("#authoringForm"); - myForm.attr("action", ""); - myForm.submit(); - } - function serializeOverallFeedbackForm() { $("#overallFeedbackList").val($('#advancedInputArea').contents().find('#overallFeedbackForm').serialize(true)); @@ -61,7 +47,6 @@ - @@ -87,11 +72,6 @@ - - - - - <%-- Default value cancelButtonLabelKey="label.authoring.cancel.button" Fisheye: Tag 1.3 refers to a dead (removed) revision in file `lams_tool_assessment/web/pages/authoring/instructions.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `lams_tool_assessment/web/pages/authoring/parts/instructionfilelist.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_assessment/web/pages/learning/learning.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/web/pages/learning/learning.jsp,v diff -u -r1.27 -r1.28 --- lams_tool_assessment/web/pages/learning/learning.jsp 8 Jan 2014 17:47:02 -0000 1.27 +++ lams_tool_assessment/web/pages/learning/learning.jsp 17 Jan 2014 21:35:01 -0000 1.28 @@ -344,6 +344,69 @@ + + + <%@ page import="org.lamsfoundation.lams.util.HashUtil" %> + <%@ page import="org.lamsfoundation.lams.web.util.AttributeNames" %> + <%@ page import="org.lamsfoundation.lams.web.session.SessionManager" %> + <%@ page import="org.lamsfoundation.lams.usermanagement.dto.UserDTO" %> + <%@ page import="java.text.SimpleDateFormat" %> + <%@ page import="java.util.Date" %> + <%@ page import="org.springframework.web.context.WebApplicationContext" %> + <%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %> + <%@ page import="org.lamsfoundation.lams.tool.assessment.service.IAssessmentService" %> + <%@ page import="org.lamsfoundation.lams.util.WebUtil" %> + <%@ page import="org.lamsfoundation.lams.tool.assessment.AssessmentConstants" %> + <%@ page import="org.lamsfoundation.lams.web.util.SessionMap" %> + <%@ page import="org.lamsfoundation.lams.lesson.dto.LessonDetailsDTO" %> + <%@ page import="org.lamsfoundation.lams.lesson.service.ILessonService" %> + <%@ page import="java.net.URLEncoder" %> + <% + //specify serverId + String serverId = "aupwvi"; + //specify serverKey + String serverKey = "255PF776rned"; + + HttpSession ss = SessionManager.getSession(); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + String userLogin = user.getLogin(); + SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHH:mm:ss"); + String trxdate = format.format(new Date()); + + String hashValue = HashUtil.sha1(userLogin.toLowerCase() + serverId.toLowerCase() + serverKey.toLowerCase() + trxdate.toLowerCase()); + + //get lessonId and lessonName + String sessionMapID = request.getParameter(AssessmentConstants.ATTR_SESSION_MAP_ID); + String lessonId = "n/a"; + String lessonName = "n/a"; + if (sessionMapID != null) { + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + Long toolSessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); + WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext()); + ILessonService lessonService = (ILessonService) wac.getBean("lessonService"); + + LessonDetailsDTO lessonDetailsDTO = lessonService.getLessonDetailsFromSessionID(toolSessionId); + lessonId = lessonDetailsDTO.getLessonID().toString(); + lessonName = URLEncoder.encode(lessonDetailsDTO.getLessonName(), "UTF-8"); + } + %> + + + + + F + + + P + + + + https://up.wvstepwise.org/swaupws/swaupservices.asmx/ReceiveExamResult?ServerID=<%=serverId%>&HashValue=<%=hashValue%>&UserID=<%=userLogin%>&Result=${result}&activityName=${assessment.title}[${assessment.uid}]&TrxDateTime=<%=trxdate%>&LessonId=<%=lessonId%>&LessonName=<%=lessonName%> + + + + + Fisheye: Tag 1.8 refers to a dead (removed) revision in file `lams_tool_assessment/web/pages/learning/runoffline.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_assessment/web/pages/learning/submissionDeadline.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/web/pages/learning/submissionDeadline.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_assessment/web/pages/learning/submissionDeadline.jsp 17 Jan 2014 21:35:01 -0000 1.1 @@ -0,0 +1,54 @@ + + +<%@include file="/common/taglibs.jsp"%> + + + + <%@ include file="/common/header.jsp"%> + + + + + +
+

+ ${sessionMap.title} +

+ +
+ + + +
+ +
+ + + + + + + + + + + + +
+
+ + + + +
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `lams_tool_assessment/web/pages/monitoring/instructions.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_assessment/web/pages/monitoring/monitoring.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/web/pages/monitoring/monitoring.jsp,v diff -u -r1.9 -r1.10 --- lams_tool_assessment/web/pages/monitoring/monitoring.jsp 17 Jun 2013 07:15:15 -0000 1.9 +++ lams_tool_assessment/web/pages/monitoring/monitoring.jsp 17 Jan 2014 21:35:00 -0000 1.10 @@ -56,18 +56,16 @@
- - - + +
Index: lams_tool_bbb/conf/middlegen/lams_tool_labbb11-prefs.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_bbb/conf/middlegen/lams_tool_labbb11-prefs.properties,v diff -u -r1.1 -r1.2 --- lams_tool_bbb/conf/middlegen/lams_tool_labbb11-prefs.properties 4 May 2011 02:23:38 -0000 1.1 +++ lams_tool_bbb/conf/middlegen/lams_tool_labbb11-prefs.properties 17 Jan 2014 21:35:50 -0000 1.2 @@ -1,31 +1,4 @@ # Middlegen Preferences -hibernate.tables.tl_labbb10_attachment.base-class-name=BbbAttachment -hibernate.tables.tl_labbb10_attachment.columns.create_date.columnspecialty=property -hibernate.tables.tl_labbb10_attachment.columns.create_date.java-name=createDate -hibernate.tables.tl_labbb10_attachment.columns.create_date.java-type=java.sql.Timestamp -hibernate.tables.tl_labbb10_attachment.columns.bbb_uid.columnspecialty=foreign key -hibernate.tables.tl_labbb10_attachment.columns.bbb_uid.java-name=bbbUid -hibernate.tables.tl_labbb10_attachment.columns.bbb_uid.java-type=java.lang.Long -hibernate.tables.tl_labbb10_attachment.columns.file_name.inctostring=true -hibernate.tables.tl_labbb10_attachment.columns.file_name.java-name=fileName -hibernate.tables.tl_labbb10_attachment.columns.file_name.java-type=java.lang.String -hibernate.tables.tl_labbb10_attachment.columns.file_type.java-name=fileType -hibernate.tables.tl_labbb10_attachment.columns.file_type.java-type=java.lang.String -hibernate.tables.tl_labbb10_attachment.columns.file_uuid.columnspecialty=property -hibernate.tables.tl_labbb10_attachment.columns.file_uuid.incequals=false -hibernate.tables.tl_labbb10_attachment.columns.file_uuid.inctostring=true -hibernate.tables.tl_labbb10_attachment.columns.file_uuid.java-name=fileUuid -hibernate.tables.tl_labbb10_attachment.columns.file_uuid.java-type=java.lang.Long -hibernate.tables.tl_labbb10_attachment.columns.file_version_id.inctostring=true -hibernate.tables.tl_labbb10_attachment.columns.file_version_id.java-name=fileVersionId -hibernate.tables.tl_labbb10_attachment.columns.file_version_id.java-type=java.lang.Long -hibernate.tables.tl_labbb10_attachment.columns.uid.columnspecialty=key -hibernate.tables.tl_labbb10_attachment.columns.uid.incequals=true -hibernate.tables.tl_labbb10_attachment.columns.uid.inctostring=true -hibernate.tables.tl_labbb10_attachment.columns.uid.java-name=uid -hibernate.tables.tl_labbb10_attachment.columns.uid.java-type=java.lang.Long -hibernate.tables.tl_labbb10_attachment.equalshashcode=true -hibernate.tables.tl_labbb10_attachment.keygenerator=native hibernate.tables.tl_labbb10_bbb.base-class-name=Bbb hibernate.tables.tl_labbb10_bbb.columns.content_in_use.java-name=contentInUse hibernate.tables.tl_labbb10_bbb.columns.content_in_use.java-type=java.lang.Boolean @@ -40,12 +13,6 @@ hibernate.tables.tl_labbb10_bbb.columns.instructions.java-type=java.lang.String hibernate.tables.tl_labbb10_bbb.columns.lock_on_finished.java-name=lockOnFinished hibernate.tables.tl_labbb10_bbb.columns.lock_on_finished.java-type=java.lang.Boolean -hibernate.tables.tl_labbb10_bbb.columns.offline_instructions.java-name=offlineInstructions -hibernate.tables.tl_labbb10_bbb.columns.offline_instructions.java-type=java.lang.String -hibernate.tables.tl_labbb10_bbb.columns.online_instructions.java-name=onlineInstructions -hibernate.tables.tl_labbb10_bbb.columns.online_instructions.java-type=java.lang.String -hibernate.tables.tl_labbb10_bbb.columns.run_offline.java-name=runOffline -hibernate.tables.tl_labbb10_bbb.columns.run_offline.java-type=java.lang.Boolean hibernate.tables.tl_labbb10_bbb.columns.title.inctostring=true hibernate.tables.tl_labbb10_bbb.columns.title.java-name=title hibernate.tables.tl_labbb10_bbb.columns.title.java-type=java.lang.String @@ -106,10 +73,6 @@ hibernate.tables.tl_labbb10_user.columns.user_id.java-type=java.lang.Long hibernate.tables.tl_labbb10_user.equalshashcode=true hibernate.tables.tl_labbb10_user.keygenerator=sequence -relations.tl_labbb10_bbb-tl_labbb10_attachment.tl_labbb10_attachment-has-tl_labbb10_bbb.enabled=true -relations.tl_labbb10_bbb-tl_labbb10_attachment.tl_labbb10_attachment-has-tl_labbb10_bbb.target-many=false -relations.tl_labbb10_bbb-tl_labbb10_attachment.tl_labbb10_bbb-has-tl_labbb10_attachment.enabled=true -relations.tl_labbb10_bbb-tl_labbb10_attachment.tl_labbb10_bbb-has-tl_labbb10_attachment.target-many=true relations.tl_labbb10_bbb-tl_labbb10_session.tl_labbb10_bbb-has-tl_labbb10_session.enabled=true relations.tl_labbb10_bbb-tl_labbb10_session.tl_labbb10_bbb-has-tl_labbb10_session.target-many=true relations.tl_labbb10_bbb-tl_labbb10_session.tl_labbb10_session-has-tl_labbb10_bbb.enabled=true Index: lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/bbbApplicationContext.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/bbbApplicationContext.xml,v diff -u -r1.1 -r1.2 --- lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/bbbApplicationContext.xml 4 May 2011 02:23:40 -0000 1.1 +++ lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/bbbApplicationContext.xml 17 Jan 2014 21:35:50 -0000 1.2 @@ -16,18 +16,15 @@ - - - @@ -41,8 +38,6 @@ PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED - PROPAGATION_REQUIRED - PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED @@ -66,10 +61,6 @@ - - - - Fisheye: Tag 1.2 refers to a dead (removed) revision in file `lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/dao/IBbbAttachmentDAO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/dao/hibernate/BbbAttachmentDAO.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/dbupdates/patch20140102.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/dbupdates/patch20140102.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/dbupdates/patch20140102.sql 17 Jan 2014 21:35:50 -0000 1.1 @@ -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_labbb10_bbb DROP COLUMN online_instructions; +ALTER TABLE tl_labbb10_bbb DROP COLUMN offline_instructions; +ALTER TABLE tl_labbb10_bbb DROP COLUMN run_offline; +DROP TABLE IF EXISTS tl_labbb10_attachment; + +UPDATE lams_tool SET tool_version='20140102' WHERE tool_signature='labbb10'; + +----------------------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 1.2 refers to a dead (removed) revision in file `lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/dto/AttachmentDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/dto/ContentDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/dto/ContentDTO.java,v diff -u -r1.1 -r1.2 --- lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/dto/ContentDTO.java 4 May 2011 02:23:40 -0000 1.1 +++ lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/dto/ContentDTO.java 17 Jan 2014 21:35:49 -0000 1.2 @@ -30,7 +30,6 @@ import org.apache.log4j.Logger; import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; import org.lamsfoundation.lams.tool.bbb.model.Bbb; -import org.lamsfoundation.lams.tool.bbb.model.BbbAttachment; import org.lamsfoundation.lams.tool.bbb.model.BbbSession; public class ContentDTO { @@ -43,10 +42,6 @@ String instructions; - String onlineInstructions; - - String offlineInstructions; - boolean reflectOnActivity; String reflectInstructions; @@ -57,10 +52,6 @@ boolean lockOnFinish; - Set onlineInstructionsFiles; - - Set offlineInstructionsFiles; - Set sessionDTOs = new TreeSet(); Long currentTab; @@ -73,31 +64,11 @@ this.toolContentId = bbb.getToolContentId(); this.title = bbb.getTitle(); this.instructions = bbb.getInstructions(); - this.onlineInstructions = bbb.getOnlineInstructions(); - this.offlineInstructions = bbb.getOfflineInstructions(); this.contentInUse = bbb.isContentInUse(); this.reflectInstructions = bbb.getReflectInstructions(); this.reflectOnActivity = bbb.isReflectOnActivity(); this.lockOnFinish = bbb.isLockOnFinished(); - this.onlineInstructionsFiles = new TreeSet(); - this.offlineInstructionsFiles = new TreeSet(); - - for (BbbAttachment att : bbb.getBbbAttachments()) { - Set attSet = null; - if (att.getFileType().equals(IToolContentHandler.TYPE_OFFLINE)) { - attSet = offlineInstructionsFiles; - } else if (att.getFileType().equals(IToolContentHandler.TYPE_ONLINE)) { - attSet = onlineInstructionsFiles; - } else { - // something is wrong. Ignore file, log error - logger.error("File with uid " + att.getFileUuid() + " contains invalid fileType: " + att.getFileType()); - } - - if (attSet != null) - attSet.add(new AttachmentDTO(att)); - } - for (BbbSession bbbSession : bbb.getBbbSessions()) { sessionDTOs.add(new SessionDTO(bbbSession)); } @@ -120,38 +91,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 boolean isReflectOnActivity() { return reflectOnActivity; } Index: lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/model/Bbb.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/model/Bbb.java,v diff -u -r1.1 -r1.2 --- lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/model/Bbb.java 4 May 2011 02:23:40 -0000 1.1 +++ lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/model/Bbb.java 17 Jan 2014 21:35:50 -0000 1.2 @@ -59,26 +59,18 @@ private String instructions; - private boolean runOffline; - private boolean lockOnFinished; private boolean reflectOnActivity; private String reflectInstructions; - private String onlineInstructions; - - private String offlineInstructions; - private boolean contentInUse; private boolean defineLater; private Long toolContentId; - private Set bbbAttachments; - private Set bbbSessions; // Property accessors @@ -161,19 +153,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" * */ @@ -209,32 +188,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" * */ @@ -274,21 +227,6 @@ } /** - * @hibernate.set lazy="true" inverse="false" cascade="all-delete-orphan" - * @hibernate.collection-key column="bbb_uid" - * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.bbb.model.BbbAttachment" - * - */ - - public Set getBbbAttachments() { - return this.bbbAttachments; - } - - public void setBbbAttachments(Set bbbAttachments) { - this.bbbAttachments = bbbAttachments; - } - - /** * @hibernate.set lazy="true" inverse="true" cascade="none" * @hibernate.collection-key column="bbb_uid" * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.bbb.model.BbbSession" @@ -355,14 +293,6 @@ bbb = (Bbb) super.clone(); bbb.setUid(null); - if (bbbAttachments != null) { - // create a copy of the attachments - Set set = new HashSet(); - for (BbbAttachment att : bbbAttachments) { - set.add((BbbAttachment) att.clone()); - } - bbb.bbbAttachments = set; - } // create an empty set for the bbbSession bbb.bbbSessions = new HashSet(); Fisheye: Tag 1.2 refers to a dead (removed) revision in file `lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/model/BbbAttachment.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/service/BbbImportContentVersionFilter.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/service/BbbImportContentVersionFilter.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/service/BbbImportContentVersionFilter.java 17 Jan 2014 21:35:50 -0000 1.1 @@ -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: BbbImportContentVersionFilter.java,v 1.1 2014/01/17 21:35:50 andreyb Exp $ */ +package org.lamsfoundation.lams.tool.bbb.service; + +import org.lamsfoundation.lams.learningdesign.service.ToolContentVersionFilter; +import org.lamsfoundation.lams.tool.bbb.model.Bbb; + +/** + * Import filter class for different version of Bbb content. + */ +public class BbbImportContentVersionFilter extends ToolContentVersionFilter { + + /** + * Import 20110511 version content to 20140102 version tool server. + */ + public void up20110511To20140102() { + this.removeField(Bbb.class, "runOffline"); + this.removeField(Bbb.class, "onlineInstructions"); + this.removeField(Bbb.class, "offlineInstructions"); + this.removeField(Bbb.class, "bbbAttachments"); + } +} Index: lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/service/BbbService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/service/BbbService.java,v diff -u -r1.3 -r1.4 --- lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/service/BbbService.java 29 Jul 2013 23:12:04 -0000 1.3 +++ lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/service/BbbService.java 17 Jan 2014 21:35:50 -0000 1.4 @@ -65,13 +65,11 @@ import org.lamsfoundation.lams.tool.ToolOutputDefinition; import org.lamsfoundation.lams.tool.ToolSessionExportOutputData; import org.lamsfoundation.lams.tool.ToolSessionManager; -import org.lamsfoundation.lams.tool.bbb.dao.IBbbAttachmentDAO; import org.lamsfoundation.lams.tool.bbb.dao.IBbbConfigDAO; import org.lamsfoundation.lams.tool.bbb.dao.IBbbDAO; import org.lamsfoundation.lams.tool.bbb.dao.IBbbSessionDAO; import org.lamsfoundation.lams.tool.bbb.dao.IBbbUserDAO; import org.lamsfoundation.lams.tool.bbb.model.Bbb; -import org.lamsfoundation.lams.tool.bbb.model.BbbAttachment; import org.lamsfoundation.lams.tool.bbb.model.BbbConfig; import org.lamsfoundation.lams.tool.bbb.model.BbbSession; import org.lamsfoundation.lams.tool.bbb.model.BbbUser; @@ -102,8 +100,6 @@ private IBbbUserDAO bbbUserDAO = null; - private IBbbAttachmentDAO bbbAttachmentDAO = null; - private IBbbConfigDAO bbbConfigDAO = null; private ILearnerService learnerService; @@ -112,10 +108,6 @@ private IToolContentHandler bbbToolContentHandler = null; - private IRepositoryService repositoryService = null; - - private IAuditService auditService = null; - private IExportToolContentService exportContentService; private ICoreNotebookService coreNotebookService; @@ -208,24 +200,6 @@ saveOrUpdateBbb(toContent); } - public void setAsDefineLater(Long toolContentId, boolean value) throws DataMissingException, ToolException { - Bbb bbb = getBbbByContentId(toolContentId); - if (bbb == null) { - throw new ToolException("Could not find tool with toolContentID: " + toolContentId); - } - bbb.setDefineLater(value); - saveOrUpdateBbb(bbb); - } - - public void setAsRunOffline(Long toolContentId, boolean value) throws DataMissingException, ToolException { - Bbb bbb = getBbbByContentId(toolContentId); - if (bbb == null) { - throw new ToolException("Could not find tool with toolContentID: " + toolContentId); - } - bbb.setRunOffline(value); - saveOrUpdateBbb(bbb); - } - public void removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException, ToolException { // TODO Auto-generated method stub @@ -253,13 +227,7 @@ bbb = Bbb.newInstance(bbb, toolContentId, null); bbb.setToolContentHandler(null); bbb.setBbbSessions(null); - Set atts = bbb.getBbbAttachments(); - for (BbbAttachment att : atts) { - att.setBbb(null); - } try { - exportContentService.registerFileClassForExport(BbbAttachment.class.getName(), "fileUuid", - "fileVersionId"); exportContentService.exportToolContent(toolContentId, bbb, bbbToolContentHandler, rootPath); } catch (ExportToolContentException e) { throw new ToolException(e); @@ -275,9 +243,9 @@ public void importToolContent(Long toolContentId, Integer newUserUid, String toolContentPath, String fromVersion, String toVersion) throws ToolException { try { - exportContentService.registerFileClassForImport(BbbAttachment.class.getName(), "fileUuid", - "fileVersionId", "fileName", "fileType", null, null); - + // register version filter class + exportContentService.registerImportVersionFilterClass(BbbImportContentVersionFilter.class); + Object toolPOJO = exportContentService.importToolContent(toolContentPath, bbbToolContentHandler, fromVersion, toVersion); if (!(toolPOJO instanceof Bbb)) @@ -425,27 +393,6 @@ } } - public BbbAttachment uploadFileToContent(Long toolContentId, FormFile file, String type) { - if (file == null || StringUtils.isEmpty(file.getFileName())) - throw new BbbException("Could not find upload file: " + file); - - NodeKey nodeKey = processFile(file, type); - - BbbAttachment attachment = new BbbAttachment(nodeKey.getVersion(), type, file.getFileName(), nodeKey - .getUuid(), new Date()); - return attachment; - } - - public void deleteFromRepository(Long uuid, Long versionID) throws BbbException { - ITicket ticket = getRepositoryLoginTicket(); - try { - repositoryService.deleteVersion(ticket, uuid, versionID); - } catch (Exception e) { - throw new BbbException("Exception occured while deleting files from" + " the repository " - + e.getMessage()); - } - } - public String getJoinMeetingURL(UserDTO userDTO, String meetingKey, String password) throws Exception { // Get Bbb details @@ -595,14 +542,6 @@ bbbConfigDAO.insertOrUpdate(bbbConfig); } - public IAuditService getAuditService() { - return auditService; - } - - public void setAuditService(IAuditService auditService) { - this.auditService = auditService; - } - private String sendRequest(URL url) throws IOException { if (logger.isDebugEnabled()) { @@ -626,54 +565,7 @@ return response; } - private NodeKey processFile(FormFile file, String type) { - NodeKey node = null; - if (file != null && !StringUtils.isEmpty(file.getFileName())) { - String fileName = file.getFileName(); - try { - node = getBbbToolContentHandler().uploadFile(file.getInputStream(), fileName, file.getContentType(), - type); - } catch (InvalidParameterException e) { - throw new BbbException("InvalidParameterException occured while trying to upload File" - + e.getMessage()); - } catch (FileNotFoundException e) { - throw new BbbException("FileNotFoundException occured while trying to upload File" + e.getMessage()); - } catch (RepositoryCheckedException e) { - throw new BbbException("RepositoryCheckedException occured while trying to upload File" - + e.getMessage()); - } catch (IOException e) { - throw new BbbException("IOException occured while trying to upload File" + e.getMessage()); - } - } - return node; - } - /** - * This method verifies the credentials of the 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 every time - * the tool needs to upload/download files from the content repository. - * - * @return ITicket The ticket for repository access - * @throws SubmitFilesException - */ - private ITicket getRepositoryLoginTicket() throws BbbException { - ICredentials credentials = new SimpleCredentials(BbbToolContentHandler.repositoryUser, - BbbToolContentHandler.repositoryId); - try { - ITicket ticket = repositoryService.login(credentials, BbbToolContentHandler.repositoryWorkspaceName); - return ticket; - } catch (AccessDeniedException ae) { - throw new BbbException("Access Denied to repository." + ae.getMessage()); - } catch (WorkspaceNotFoundException we) { - throw new BbbException("Workspace not found." + we.getMessage()); - } catch (LoginException e) { - throw new BbbException("Login failed." + e.getMessage()); - } - } - - /** * Set the description, throws away the title value as this is not supported in 2.0 */ public void setReflectiveData(Long toolContentId, String title, String description) throws ToolException, @@ -694,14 +586,6 @@ // ========================================================================================= /* Used by Spring to "inject" the linked objects */ - public IBbbAttachmentDAO getBbbAttachmentDAO() { - return bbbAttachmentDAO; - } - - public void setBbbAttachmentDAO(IBbbAttachmentDAO attachmentDAO) { - this.bbbAttachmentDAO = attachmentDAO; - } - public IBbbDAO getBbbDAO() { return bbbDAO; } @@ -773,14 +657,5 @@ public void setCoreNotebookService(ICoreNotebookService coreNotebookService) { this.coreNotebookService = coreNotebookService; } - - public IRepositoryService getRepositoryService() { - return repositoryService; - } - public void setRepositoryService(IRepositoryService repositoryService) { - this.repositoryService = repositoryService; - } - - } Index: lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/service/IBbbService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/service/IBbbService.java,v diff -u -r1.1 -r1.2 --- lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/service/IBbbService.java 4 May 2011 02:23:41 -0000 1.1 +++ lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/service/IBbbService.java 17 Jan 2014 21:35:50 -0000 1.2 @@ -27,7 +27,6 @@ import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.tool.bbb.model.Bbb; -import org.lamsfoundation.lams.tool.bbb.model.BbbAttachment; import org.lamsfoundation.lams.tool.bbb.model.BbbConfig; import org.lamsfoundation.lams.tool.bbb.model.BbbSession; import org.lamsfoundation.lams.tool.bbb.model.BbbUser; @@ -66,20 +65,6 @@ public Bbb getBbbByContentId(Long toolContentID); /** - * @param toolContentId - * @param file - * @param type - * @return - */ - public BbbAttachment uploadFileToContent(Long toolContentId, FormFile file, String type); - - /** - * @param uuid - * @param versionID - */ - public void deleteFromRepository(Long uuid, Long versionID) throws BbbException; - - /** * @param bbb */ public void saveOrUpdateBbb(Bbb bbb); Index: lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/util/Constants.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/util/Constants.java,v diff -u -r1.1 -r1.2 --- lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/util/Constants.java 4 May 2011 02:23:41 -0000 1.1 +++ lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/util/Constants.java 17 Jan 2014 21:35:49 -0000 1.2 @@ -45,13 +45,8 @@ // Authoring SessionMap key names public static final String KEY_CONTENT_FOLDER_ID = "contentFolderID"; - public static final String KEY_DELETED_FILES = "deletedFiles"; public static final String KEY_MODE = "mode"; - public static final String KEY_OFFLINE_FILES = "offlineFiles"; - public static final String KEY_ONLINE_FILES = "onlineFiles"; public static final String KEY_TOOL_CONTENT_ID = "toolContentID"; - public static final String KEY_UNSAVED_OFFLINE_FILES = "unsavedOfflineFiles"; - public static final String KEY_UNSAVED_ONLINE_FILES = "unsavedOnlineFiles"; // Big Blue Button parameters public static final String BBB_CREATE_PARAM = "bigbluebutton/api/create?"; Index: lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/web/actions/AuthoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/web/actions/AuthoringAction.java,v diff -u -r1.1 -r1.2 --- lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/web/actions/AuthoringAction.java 4 May 2011 02:23:41 -0000 1.1 +++ lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/web/actions/AuthoringAction.java 17 Jan 2014 21:35:50 -0000 1.2 @@ -48,7 +48,6 @@ import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; import org.lamsfoundation.lams.tool.ToolAccessMode; import org.lamsfoundation.lams.tool.bbb.model.Bbb; -import org.lamsfoundation.lams.tool.bbb.model.BbbAttachment; import org.lamsfoundation.lams.tool.bbb.service.BbbServiceProxy; import org.lamsfoundation.lams.tool.bbb.service.IBbbService; import org.lamsfoundation.lams.tool.bbb.util.Constants; @@ -68,8 +67,7 @@ */ public class AuthoringAction extends DispatchAction { - // private static final Logger logger = - // Logger.getLogger(AuthoringAction.class); + // private static final Logger logger = Logger.getLogger(AuthoringAction.class); private IBbbService bbbService; @@ -147,24 +145,6 @@ ToolAccessMode mode = (ToolAccessMode) map.get(Constants.KEY_MODE); copyProperties(bbb, authForm, mode); - // remove attachments marked for deletion. - Set attachments = bbb.getBbbAttachments(); - if (attachments == null) { - attachments = new HashSet(); - } - - for (BbbAttachment att : getAttList(Constants.KEY_DELETED_FILES, map)) { - // remove from db, leave in repository - attachments.remove(att); - } - - // add unsaved attachments - attachments.addAll(getAttList(Constants.KEY_UNSAVED_ONLINE_FILES, map)); - attachments.addAll(getAttList(Constants.KEY_UNSAVED_OFFLINE_FILES, map)); - - // set attachments in case it didn't exist - bbb.setBbbAttachments(attachments); - // set the update date bbb.setUpdateDate(new Date()); @@ -183,153 +163,8 @@ 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(Constants.KEY_UNSAVED_OFFLINE_FILES, map); - - savedFiles = getAttList(Constants.KEY_OFFLINE_FILES, map); - } else { - file = (FormFile) authForm.getOnlineFile(); - unsavedFiles = getAttList(Constants.KEY_UNSAVED_ONLINE_FILES, map); - - savedFiles = getAttList(Constants.KEY_ONLINE_FILES, map); - } - - // validate file max size - ActionMessages errors = new ActionMessages(); - FileValidatorUtil.validateFileSize(file, true, errors); - if (!errors.isEmpty()) { - request.setAttribute(Constants.ATTR_SESSION_MAP, map); - this.saveErrors(request, errors); - return mapping.findForward("success"); - } - - if (file.getFileName().length() != 0) { - - // upload file to repository - BbbAttachment newAtt = bbbService.uploadFileToContent((Long) map.get(Constants.KEY_TOOL_CONTENT_ID), - file, type); - - // Add attachment to unsavedFiles - // check to see if file with same name exists - BbbAttachment currAtt; - Iterator iter = savedFiles.iterator(); - while (iter.hasNext()) { - currAtt = (BbbAttachment) iter.next(); - if (StringUtils.equals(currAtt.getFileName(), newAtt.getFileName()) - && StringUtils.equals(currAtt.getFileType(), newAtt.getFileType())) { - // move from this this list to deleted list. - getAttList(Constants.KEY_DELETED_FILES, map).add(currAtt); - iter.remove(); - break; - } - } - unsavedFiles.add(newAtt); - - request.setAttribute(Constants.ATTR_SESSION_MAP, map); - } - 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(Constants.KEY_OFFLINE_FILES, map); - } else { - fileList = getAttList(Constants.KEY_ONLINE_FILES, map); - } - - Iterator iter = fileList.iterator(); - - while (iter.hasNext()) { - BbbAttachment att = (BbbAttachment) iter.next(); - - if (att.getFileUuid().equals(authForm.getDeleteFileUuid())) { - // move to delete file list, deleted at next updateContent - getAttList(Constants.KEY_DELETED_FILES, map).add(att); - - // remove from this list - iter.remove(); - break; - } - } - - request.setAttribute(Constants.ATTR_SESSION_MAP, map); - - 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(Constants.KEY_UNSAVED_OFFLINE_FILES, map); - } else { - unsavedFiles = getAttList(Constants.KEY_UNSAVED_ONLINE_FILES, map); - } - - Iterator iter = unsavedFiles.iterator(); - while (iter.hasNext()) { - BbbAttachment att = (BbbAttachment) iter.next(); - - if (att.getFileUuid().equals(authForm.getDeleteFileUuid())) { - // delete from repository and list - bbbService.deleteFromRepository(att.getFileUuid(), att.getFileVersionId()); - iter.remove(); - break; - } - } - - request.setAttribute(Constants.ATTR_SESSION_MAP, map); - - return mapping.findForward("success"); - } - /** * Updates Bbb content using AuthoringForm inputs. * @@ -341,8 +176,6 @@ bbb.setTitle(authForm.getTitle()); bbb.setInstructions(authForm.getInstructions()); if (mode.isAuthor()) { // Teacher cannot modify following - bbb.setOfflineInstructions(authForm.getOfflineInstructions()); - bbb.setOnlineInstructions(authForm.getOnlineInstructions()); bbb.setReflectOnActivity(authForm.isReflectOnActivity()); bbb.setReflectInstructions(authForm.getReflectInstructions()); bbb.setLockOnFinished(authForm.isLockOnFinished()); @@ -382,22 +215,7 @@ map.put(Constants.KEY_MODE, mode); map.put(Constants.KEY_CONTENT_FOLDER_ID, contentFolderID); map.put(Constants.KEY_TOOL_CONTENT_ID, toolContentID); - map.put(Constants.KEY_ONLINE_FILES, new LinkedList()); - map.put(Constants.KEY_OFFLINE_FILES, new LinkedList()); - map.put(Constants.KEY_UNSAVED_ONLINE_FILES, new LinkedList()); - map.put(Constants.KEY_UNSAVED_OFFLINE_FILES, new LinkedList()); - map.put(Constants.KEY_DELETED_FILES, new LinkedList()); - for (BbbAttachment attachment : bbb.getBbbAttachments()) { - String type = attachment.getFileType(); - if (type.equals(IToolContentHandler.TYPE_OFFLINE)) { - getAttList(Constants.KEY_OFFLINE_FILES, map).add(attachment); - } - if (type.equals(IToolContentHandler.TYPE_ONLINE)) { - getAttList(Constants.KEY_ONLINE_FILES, map).add(attachment); - } - } - return map; } @@ -419,19 +237,6 @@ } /** - * Retrieves a List of attachments from the map using the key. - * - * @param key - * @param map - * @return - */ - @SuppressWarnings("unchecked") - private List getAttList(String key, SessionMap map) { - List list = (List) map.get(key); - return list; - } - - /** * Retrieve the SessionMap from the HttpSession. * * @param request Index: lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/web/actions/LearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/web/actions/LearningAction.java,v diff -u -r1.2 -r1.3 --- lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/web/actions/LearningAction.java 9 Apr 2013 12:45:31 -0000 1.2 +++ lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/web/actions/LearningAction.java 17 Jan 2014 21:35:50 -0000 1.3 @@ -68,7 +68,6 @@ * @struts.action path="/learning" parameter="dispatch" scope="request" name="learningForm" * @struts.action-forward name="bbb" path="tiles:/learning/main" * @struts.action-forward name="notebook" path="tiles:/learning/notebook" - * @struts.action-forward name="runOffline" path="tiles:/learning/runOffline" * @struts.action-forward name="defineLater" path="tiles:/learning/defineLater" * @struts.action-forward name="generalMessage" path="tiles:/general/message" */ @@ -310,11 +309,6 @@ LearningWebUtil.putActivityPositionInRequestByToolSessionId(toolSessionID, request, getServlet() .getServletContext()); - - // check runOffline - if (bbb.isRunOffline()) { - return mapping.findForward("runOffline"); - } BbbUser user; if (mode.equals(ToolAccessMode.TEACHER)) { Index: lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/web/servlets/ExportServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/web/servlets/ExportServlet.java,v diff -u -r1.2 -r1.3 --- lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/web/servlets/ExportServlet.java 6 Jan 2014 08:42:22 -0000 1.2 +++ lams_tool_bbb/src/java/org/lamsfoundation/lams/tool/bbb/web/servlets/ExportServlet.java 17 Jan 2014 21:35:50 -0000 1.3 @@ -74,28 +74,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 { - setupService(); - - Bbb content = null; - if (toolContentID != null) { - content = bbbService.getBbbByContentId(toolContentID); - } else { - BbbSession session = bbbService.getSessionBySessionId(toolSessionID); - if (session != null) - content = session.getBbb(); - } - 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 BbbException { Index: lams_tool_bbb/web/WEB-INF/tiles-defs.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_bbb/web/WEB-INF/tiles-defs.xml,v diff -u -r1.1 -r1.2 --- lams_tool_bbb/web/WEB-INF/tiles-defs.xml 30 Jul 2012 18:49:51 -0000 1.1 +++ lams_tool_bbb/web/WEB-INF/tiles-defs.xml 17 Jan 2014 21:35:50 -0000 1.2 @@ -58,9 +58,6 @@ - - - Index: lams_tool_bbb/web/includes/javascript/authoring.js =================================================================== RCS file: /usr/local/cvsroot/lams_tool_bbb/web/includes/javascript/authoring.js,v diff -u -r1.1 -r1.2 --- lams_tool_bbb/web/includes/javascript/authoring.js 4 May 2011 02:23:44 -0000 1.1 +++ lams_tool_bbb/web/includes/javascript/authoring.js 17 Jan 2014 21:35:50 -0000 1.2 @@ -17,8 +17,3 @@ 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_bbb/web/pages/authoring/authoring.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_bbb/web/pages/authoring/authoring.jsp,v diff -u -r1.1 -r1.2 --- lams_tool_bbb/web/pages/authoring/authoring.jsp 4 May 2011 02:23:44 -0000 1.1 +++ lams_tool_bbb/web/pages/authoring/authoring.jsp 17 Jan 2014 21:35:49 -0000 1.2 @@ -2,12 +2,9 @@ <%@ page import="org.lamsfoundation.lams.tool.bbb.util.Constants"%> - + - + @@ -22,7 +19,6 @@ - @@ -35,9 +31,6 @@
- - -

@@ -55,8 +48,6 @@ - - - - + +

- + - - - + +
Index: lams_tool_chat/conf/middlegen/lams_tool_lachat11-prefs.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/conf/middlegen/lams_tool_lachat11-prefs.properties,v diff -u -r1.1 -r1.2 --- lams_tool_chat/conf/middlegen/lams_tool_lachat11-prefs.properties 28 Mar 2006 02:15:07 -0000 1.1 +++ lams_tool_chat/conf/middlegen/lams_tool_lachat11-prefs.properties 17 Jan 2014 21:36:38 -0000 1.2 @@ -44,8 +44,6 @@ hibernate.tables.tl_lachat11_chat.columns.offline_instructions.java-type=java.lang.String hibernate.tables.tl_lachat11_chat.columns.online_instructions.java-name=onlineInstructions hibernate.tables.tl_lachat11_chat.columns.online_instructions.java-type=java.lang.String -hibernate.tables.tl_lachat11_chat.columns.run_offline.java-name=runOffline -hibernate.tables.tl_lachat11_chat.columns.run_offline.java-type=java.lang.Boolean hibernate.tables.tl_lachat11_chat.columns.title.inctostring=true hibernate.tables.tl_lachat11_chat.columns.title.java-name=title hibernate.tables.tl_lachat11_chat.columns.title.java-type=java.lang.String Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/chatApplicationContext.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/chatApplicationContext.xml,v diff -u -r1.11 -r1.12 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/chatApplicationContext.xml 26 Mar 2009 10:00:37 -0000 1.11 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/chatApplicationContext.xml 17 Jan 2014 21:36:39 -0000 1.12 @@ -17,7 +17,6 @@
- @@ -27,7 +26,6 @@ - @@ -39,7 +37,6 @@ - @@ -53,8 +50,6 @@ PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED - PROPAGATION_REQUIRED - PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED @@ -81,10 +76,6 @@ - - - - Fisheye: Tag 1.5 refers to a dead (removed) revision in file `lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatAttachmentDAO.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatDAO.java,v diff -u -r1.7 -r1.8 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatDAO.java 27 Oct 2008 03:31:23 -0000 1.7 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatDAO.java 17 Jan 2014 21:36:40 -0000 1.8 @@ -37,7 +37,5 @@ void saveOrUpdate(Chat toContent); - void deleteInstructionFile(Long toolContentId, Long uuid, Long versionId, String type); - void releaseFromCache(Object o); } \ No newline at end of file Fisheye: Tag 1.5 refers to a dead (removed) revision in file `lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatAttachmentDAO.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatDAO.java,v diff -u -r1.7 -r1.8 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatDAO.java 27 Oct 2008 03:31:23 -0000 1.7 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatDAO.java 17 Jan 2014 21:36:39 -0000 1.8 @@ -26,12 +26,9 @@ import java.util.List; -import org.hibernate.FlushMode; import org.lamsfoundation.lams.dao.hibernate.BaseDAO; import org.lamsfoundation.lams.tool.chat.dao.IChatDAO; import org.lamsfoundation.lams.tool.chat.model.Chat; -import org.lamsfoundation.lams.tool.chat.model.ChatAttachment; -import org.springframework.orm.hibernate3.HibernateTemplate; /** * DAO for accessing the Chat objects - Hibernate specific code. @@ -40,9 +37,6 @@ private static final String FIND_FORUM_BY_CONTENTID = "from Chat chat where chat.toolContentId=?"; - private static final String FIND_INSTRUCTION_FILE = "from " + ChatAttachment.class.getName() - + " as i where tool_content_id=? and i.file_uuid=? and i.file_version_id=? and i.file_type=?"; - public Chat getByContentId(Long toolContentId) { List list = getHibernateTemplate().find(ChatDAO.FIND_FORUM_BY_CONTENTID, toolContentId); if (list != null && list.size() > 0) { @@ -57,21 +51,6 @@ 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(ChatDAO.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) { - ChatAttachment file = (ChatAttachment) list.get(0); - this.getSession().setFlushMode(FlushMode.AUTO); - templ.delete(file); - templ.flush(); - } - } - - } - public void releaseFromCache(Object o) { getSession().evict(o); Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dbupdates/patch20140102.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dbupdates/patch20140102.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dbupdates/patch20140102.sql 17 Jan 2014 21:36:39 -0000 1.1 @@ -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_lachat11_chat DROP COLUMN online_instructions; +ALTER TABLE tl_lachat11_chat DROP COLUMN offline_instructions; +ALTER TABLE tl_lachat11_chat DROP COLUMN run_offline; +DROP TABLE IF EXISTS tl_lachat11_attachment; + +UPDATE lams_tool SET tool_version='20140102' WHERE tool_signature='lachat11'; + +----------------------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 1.4 refers to a dead (removed) revision in file `lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dto/ChatAttachmentDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dto/ChatDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dto/ChatDTO.java,v diff -u -r1.9 -r1.10 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dto/ChatDTO.java 17 May 2011 02:21:54 -0000 1.9 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dto/ChatDTO.java 17 Jan 2014 21:36:40 -0000 1.10 @@ -25,15 +25,12 @@ package org.lamsfoundation.lams.tool.chat.dto; -import java.util.Iterator; +import java.util.Date; import java.util.Set; import java.util.TreeSet; -import java.util.Date; import org.apache.log4j.Logger; -import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; import org.lamsfoundation.lams.tool.chat.model.Chat; -import org.lamsfoundation.lams.tool.chat.model.ChatAttachment; public class ChatDTO { @@ -44,10 +41,6 @@ public String title; public String instructions; - - public String onlineInstructions; - - public String offlineInstructions; public boolean defineLater; @@ -64,11 +57,7 @@ public String reflectInstructions; public Date submissionDeadline; - - public Set onlineInstructionsFiles = new TreeSet(); - public Set offlineInstructionsFiles = new TreeSet(); - public Set sessionDTOs = new TreeSet();; public Long currentTab; @@ -77,31 +66,13 @@ toolContentId = chat.getToolContentId(); title = chat.getTitle(); instructions = chat.getInstructions(); - onlineInstructions = chat.getOnlineInstructions(); - offlineInstructions = chat.getOfflineInstructions(); contentInUse = chat.isContentInUse(); reflectInstructions = chat.getReflectInstructions(); reflectOnActivity = chat.isReflectOnActivity(); lockOnFinish = chat.isLockOnFinished(); filteringEnabled = chat.isFilteringEnabled(); filteredKeyWords = chat.getFilterKeywords(); submissionDeadline = chat.getSubmissionDeadline(); - - for (Iterator i = chat.getChatAttachments().iterator(); i.hasNext();) { - ChatAttachment att = (ChatAttachment) i.next(); - if (att.getFileType().equals(IToolContentHandler.TYPE_OFFLINE)) { - ChatAttachmentDTO attDTO = new ChatAttachmentDTO(att); - offlineInstructionsFiles.add(attDTO); - } else if (att.getFileType() - .equals(IToolContentHandler.TYPE_ONLINE)) { - ChatAttachmentDTO attDTO = new ChatAttachmentDTO(att); - onlineInstructionsFiles.add(attDTO); - } else { - // something is wrong. Ignore file, log error - logger.error("File with uid " + att.getFileUuid() - + " contains invalid fileType: " + att.getFileType()); - } - } } public Set getSessionDTOs() { @@ -120,40 +91,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_chat/src/java/org/lamsfoundation/lams/tool/chat/model/Chat.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/Chat.java,v diff -u -r1.13 -r1.14 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/Chat.java 17 May 2011 02:21:54 -0000 1.13 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/Chat.java 17 Jan 2014 21:36:39 -0000 1.14 @@ -64,8 +64,6 @@ private String instructions; - private boolean runOffline; - private boolean lockOnFinished; private boolean reflectOnActivity; @@ -76,10 +74,6 @@ private String filterKeywords; - private String onlineInstructions; - - private String offlineInstructions; - private boolean contentInUse; private boolean defineLater; @@ -88,40 +82,30 @@ private Date submissionDeadline; - private Set chatAttachments; - private Set chatSessions; private Set conditions = new TreeSet(new TextSearchConditionComparator()); - // *********** NON Persisit fields - private IToolContentHandler toolContentHandler; - // Constructors /** default constructor */ public Chat() { } /** full constructor */ - public Chat(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, - Set chatAttachments, Set chatSessions) { + public Chat(Date createDate, Date updateDate, Long createBy, String title, String instructions, + boolean lockOnFinished, boolean filteringEnabled, String filterKeywords, boolean contentInUse, boolean defineLater, Long toolContentId, + Set chatSessions) { this.createDate = createDate; this.updateDate = updateDate; this.createBy = createBy; this.title = title; this.instructions = instructions; - this.runOffline = runOffline; this.lockOnFinished = lockOnFinished; this.filteringEnabled = filteringEnabled; this.filterKeywords = filterKeywords; - this.onlineInstructions = onlineInstructions; - this.offlineInstructions = offlineInstructions; this.contentInUse = contentInUse; this.defineLater = defineLater; this.toolContentId = toolContentId; - this.chatAttachments = chatAttachments; this.chatSessions = chatSessions; } @@ -205,19 +189,6 @@ } /** - * @hibernate.property column="run_offline" length="1" - * - */ - - public boolean isRunOffline() { - return runOffline; - } - - public void setRunOffline(boolean runOffline) { - this.runOffline = runOffline; - } - - /** * @hibernate.property column="lock_on_finished" length="1" * */ @@ -253,32 +224,6 @@ } /** - * @hibernate.property column="online_instructions" length="65535" - * - */ - - public String getOnlineInstructions() { - return onlineInstructions; - } - - public void setOnlineInstructions(String onlineInstructions) { - this.onlineInstructions = onlineInstructions; - } - - /** - * @hibernate.property column="offline_instructions" length="65535" - * - */ - - public String getOfflineInstructions() { - return offlineInstructions; - } - - public void setOfflineInstructions(String offlineInstructions) { - this.offlineInstructions = offlineInstructions; - } - - /** * @hibernate.property column="content_in_use" length="1" * */ @@ -318,21 +263,6 @@ } /** - * @hibernate.set lazy="false" inverse="false" cascade="all-delete-orphan" - * @hibernate.collection-key column="chat_uid" - * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.chat.model.ChatAttachment" - * - */ - - public Set getChatAttachments() { - return chatAttachments; - } - - public void setChatAttachments(Set chatAttachments) { - this.chatAttachments = chatAttachments; - } - - /** * @hibernate.set lazy="true" inverse="true" cascade="none" * @hibernate.collection-key column="chat_uid" * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.chat.model.ChatSession" @@ -424,9 +354,8 @@ return result; } - public static Chat newInstance(Chat fromContent, Long toContentId, IToolContentHandler chatToolContentHandler) { + public static Chat newInstance(Chat fromContent, Long toContentId) { Chat toContent = new Chat(); - fromContent.toolContentHandler = chatToolContentHandler; toContent = (Chat) fromContent.clone(); toContent.setToolContentId(toContentId); toContent.setCreateDate(new Date()); @@ -441,18 +370,6 @@ chat = (Chat) super.clone(); chat.setUid(null); - if (chatAttachments != null) { - // create a copy of the attachments but do not duplicate node in repository - Iterator iter = chatAttachments.iterator(); - Set set = new HashSet(); - while (iter.hasNext()) { - ChatAttachment originalFile = (ChatAttachment) iter.next(); - ChatAttachment newFile = (ChatAttachment) originalFile.clone(); - - set.add(newFile); - } - chat.chatAttachments = set; - } // create an empty set for the chatSession chat.chatSessions = new HashSet(); @@ -470,14 +387,6 @@ return chat; } - public IToolContentHandler getToolContentHandler() { - return toolContentHandler; - } - - public void setToolContentHandler(IToolContentHandler toolContentHandler) { - this.toolContentHandler = toolContentHandler; - } - /** * @hibernate.set lazy="true" cascade="all" * sort="org.lamsfoundation.lams.learningdesign.TextSearchConditionComparator" Fisheye: Tag 1.5 refers to a dead (removed) revision in file `lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/ChatAttachment.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatImportContentVersionFilter.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatImportContentVersionFilter.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatImportContentVersionFilter.java 17 Jan 2014 21:36:39 -0000 1.1 @@ -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: ChatImportContentVersionFilter.java,v 1.1 2014/01/17 21:36:39 andreyb Exp $ */ +package org.lamsfoundation.lams.tool.chat.service; + +import org.lamsfoundation.lams.learningdesign.service.ToolContentVersionFilter; +import org.lamsfoundation.lams.tool.chat.model.Chat; + +/** + * Import filter class for different version of Chat content. + */ +public class ChatImportContentVersionFilter extends ToolContentVersionFilter { + + /** + * Import 20121024 version content to 20140102 version tool server. + */ + public void up20121024To20140102() { + this.removeField(Chat.class, "runOffline"); + this.removeField(Chat.class, "onlineInstructions"); + this.removeField(Chat.class, "offlineInstructions"); + this.removeField(Chat.class, "chatAttachments"); + } +} Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatService.java,v diff -u -r1.58 -r1.59 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatService.java 29 Jul 2013 23:11:21 -0000 1.58 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatService.java 17 Jan 2014 21:36:39 -0000 1.59 @@ -24,34 +24,19 @@ package org.lamsfoundation.lams.tool.chat.service; -import java.io.FileNotFoundException; -import java.io.IOException; import java.util.Collection; import java.util.Date; import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.Random; -import java.util.Set; import java.util.SortedMap; import java.util.concurrent.ConcurrentHashMap; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; -import org.apache.struts.upload.FormFile; -import org.lamsfoundation.lams.contentrepository.AccessDeniedException; -import org.lamsfoundation.lams.contentrepository.ICredentials; -import org.lamsfoundation.lams.contentrepository.ITicket; -import org.lamsfoundation.lams.contentrepository.InvalidParameterException; -import org.lamsfoundation.lams.contentrepository.LoginException; -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.learning.service.ILearnerService; import org.lamsfoundation.lams.learningdesign.service.ExportToolContentException; import org.lamsfoundation.lams.learningdesign.service.IExportToolContentService; @@ -64,21 +49,18 @@ import org.lamsfoundation.lams.tool.ToolOutputDefinition; import org.lamsfoundation.lams.tool.ToolSessionExportOutputData; import org.lamsfoundation.lams.tool.ToolSessionManager; -import org.lamsfoundation.lams.tool.chat.dao.IChatAttachmentDAO; import org.lamsfoundation.lams.tool.chat.dao.IChatDAO; import org.lamsfoundation.lams.tool.chat.dao.IChatMessageDAO; import org.lamsfoundation.lams.tool.chat.dao.IChatSessionDAO; import org.lamsfoundation.lams.tool.chat.dao.IChatUserDAO; import org.lamsfoundation.lams.tool.chat.model.Chat; -import org.lamsfoundation.lams.tool.chat.model.ChatAttachment; import org.lamsfoundation.lams.tool.chat.model.ChatCondition; import org.lamsfoundation.lams.tool.chat.model.ChatMessage; import org.lamsfoundation.lams.tool.chat.model.ChatSession; import org.lamsfoundation.lams.tool.chat.model.ChatUser; import org.lamsfoundation.lams.tool.chat.util.ChatConstants; import org.lamsfoundation.lams.tool.chat.util.ChatException; import org.lamsfoundation.lams.tool.chat.util.ChatMessageFilter; -import org.lamsfoundation.lams.tool.chat.util.ChatToolContentHandler; import org.lamsfoundation.lams.tool.exception.DataMissingException; import org.lamsfoundation.lams.tool.exception.SessionDataExistsException; import org.lamsfoundation.lams.tool.exception.ToolException; @@ -107,16 +89,12 @@ private IChatMessageDAO chatMessageDAO = null; - private IChatAttachmentDAO chatAttachmentDAO = null; - private ILearnerService learnerService; private ILamsToolService toolService; private IToolContentHandler chatToolContentHandler = null; - private IRepositoryService repositoryService = null; - private IAuditService auditService = null; private IExportToolContentService exportContentService; @@ -240,28 +218,10 @@ // create the fromContent using the default tool content fromContent = getDefaultContent(); } - Chat toContent = Chat.newInstance(fromContent, toContentId, chatToolContentHandler); + Chat toContent = Chat.newInstance(fromContent, toContentId); chatDAO.saveOrUpdate(toContent); } - public void setAsDefineLater(Long toolContentId, boolean value) throws DataMissingException, ToolException { - Chat chat = chatDAO.getByContentId(toolContentId); - if (chat == null) { - throw new ToolException("Could not find tool with toolContentID: " + toolContentId); - } - chat.setDefineLater(value); - chatDAO.saveOrUpdate(chat); - } - - public void setAsRunOffline(Long toolContentId, boolean value) throws DataMissingException, ToolException { - Chat chat = chatDAO.getByContentId(toolContentId); - if (chat == null) { - throw new ToolException("Could not find tool with toolContentID: " + toolContentId); - } - chat.setRunOffline(value); - chatDAO.saveOrUpdate(chat); - } - public void removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException, ToolException { // TODO Auto-generated method stub @@ -287,16 +247,9 @@ // set ResourceToolContentHandler as null to avoid copy file node in // repository again. - chat = Chat.newInstance(chat, toolContentId, null); - chat.setToolContentHandler(null); + chat = Chat.newInstance(chat, toolContentId); chat.setChatSessions(null); - Set atts = chat.getChatAttachments(); - for (ChatAttachment att : atts) { - att.setChat(null); - } try { - exportContentService - .registerFileClassForExport(ChatAttachment.class.getName(), "fileUuid", "fileVersionId"); exportContentService.exportToolContent(toolContentId, chat, chatToolContentHandler, rootPath); } catch (ExportToolContentException e) { throw new ToolException(e); @@ -312,9 +265,9 @@ public void importToolContent(Long toolContentId, Integer newUserUid, String toolContentPath, String fromVersion, String toVersion) throws ToolException { try { - exportContentService.registerFileClassForImport(ChatAttachment.class.getName(), "fileUuid", - "fileVersionId", "fileName", "fileType", null, null); - + // register version filter class + exportContentService.registerImportVersionFilterClass(ChatImportContentVersionFilter.class); + Object toolPOJO = exportContentService.importToolContent(toolContentPath, chatToolContentHandler, fromVersion, toVersion); if (!(toolPOJO instanceof Chat)) { @@ -394,7 +347,7 @@ Chat defaultContent = getDefaultContent(); // create new chat using the newContentID Chat newContent = new Chat(); - newContent = Chat.newInstance(defaultContent, newContentID, chatToolContentHandler); + newContent = Chat.newInstance(defaultContent, newContentID); chatDAO.saveOrUpdate(newContent); return newContent; } @@ -458,37 +411,6 @@ return chatMessageDAO.getSentByUser(userUid); } - public ChatAttachment uploadFileToContent(Long toolContentId, FormFile file, String type) { - if ((file == null) || StringUtils.isEmpty(file.getFileName())) { - throw new ChatException("Could not find upload file: " + file); - } - - NodeKey nodeKey = processFile(file, type); - - ChatAttachment attachment = new ChatAttachment(); - attachment.setFileType(type); - attachment.setFileUuid(nodeKey.getUuid()); - attachment.setFileVersionId(nodeKey.getVersion()); - attachment.setFileName(file.getFileName()); - attachment.setCreateDate(new Date()); - - return attachment; - } - - public void deleteFromRepository(Long uuid, Long versionID) throws ChatException { - ITicket ticket = getRepositoryLoginTicket(); - try { - repositoryService.deleteVersion(ticket, uuid, versionID); - } catch (Exception e) { - throw new ChatException("Exception occured while deleting files from" + " the repository " + e.getMessage()); - } - } - - public void deleteInstructionFile(Long contentID, Long uuid, Long versionID, String type) { - chatDAO.deleteInstructionFile(contentID, uuid, versionID, type); - - } - public void saveOrUpdateChat(Chat chat) { updateMessageFilters(chat); chatDAO.saveOrUpdate(chat); @@ -583,14 +505,6 @@ return chatMessageDAO.getLatest(chatSession, max); } - public IRepositoryService getRepositoryService() { - return repositoryService; - } - - public void setRepositoryService(IRepositoryService repositoryService) { - this.repositoryService = repositoryService; - } - public IAuditService getAuditService() { return auditService; } @@ -621,63 +535,6 @@ /* Private methods */ private Map messageFilters = new ConcurrentHashMap(); - private NodeKey processFile(FormFile file, String type) { - NodeKey node = null; - if ((file != null) && !StringUtils.isEmpty(file.getFileName())) { - String fileName = file.getFileName(); - try { - node = getChatToolContentHandler().uploadFile(file.getInputStream(), fileName, file.getContentType(), - type); - } catch (InvalidParameterException e) { - throw new ChatException("InvalidParameterException occured while trying to upload File" - + e.getMessage()); - } catch (FileNotFoundException e) { - throw new ChatException("FileNotFoundException occured while trying to upload File" + e.getMessage()); - } catch (RepositoryCheckedException e) { - throw new ChatException("RepositoryCheckedException occured while trying to upload File" - + e.getMessage()); - } catch (IOException e) { - throw new ChatException("IOException occured while trying to upload File" + e.getMessage()); - } - } - return node; - } - - /** - * 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 ChatException { - ICredentials credentials = new SimpleCredentials(ChatToolContentHandler.repositoryUser, - ChatToolContentHandler.repositoryId); - try { - ITicket ticket = repositoryService.login(credentials, ChatToolContentHandler.repositoryWorkspaceName); - return ticket; - } catch (AccessDeniedException ae) { - throw new ChatException("Access Denied to repository." + ae.getMessage()); - } catch (WorkspaceNotFoundException we) { - throw new ChatException("Workspace not found." + we.getMessage()); - } catch (LoginException e) { - throw new ChatException("Login failed." + e.getMessage()); - } - } - - /* Used by Spring to "inject" the linked objects */ - - public IChatAttachmentDAO getChatAttachmentDAO() { - return chatAttachmentDAO; - } - - public void setChatAttachmentDAO(IChatAttachmentDAO attachmentDAO) { - chatAttachmentDAO = attachmentDAO; - } - public IChatDAO getChatDAO() { return chatDAO; } @@ -798,11 +655,8 @@ chat.setInstructions(WebUtil.convertNewlines((String) importValues .get(ToolContentImport102Manager.CONTENT_BODY))); chat.setLockOnFinished(Boolean.FALSE); - chat.setOfflineInstructions(null); - chat.setOnlineInstructions(null); chat.setReflectInstructions(null); chat.setReflectOnActivity(Boolean.FALSE); - chat.setRunOffline(Boolean.FALSE); chat.setTitle((String) importValues.get(ToolContentImport102Manager.CONTENT_TITLE)); chat.setToolContentId(toolContentId); chat.setUpdateDate(now); @@ -820,9 +674,6 @@ + "- WDDX caused an exception. Some data from the design will have been lost. See log for more details."); } - // leave as empty, no need to set them to anything. - // setChatAttachments(Set chatAttachments); - // setChatSessions(Set chatSessions); chatDAO.saveOrUpdate(chat); } Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/IChatService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/IChatService.java,v diff -u -r1.20 -r1.21 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/IChatService.java 25 Oct 2012 10:21:03 -0000 1.20 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/IChatService.java 17 Jan 2014 21:36:39 -0000 1.21 @@ -32,7 +32,6 @@ import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.tool.chat.model.Chat; -import org.lamsfoundation.lams.tool.chat.model.ChatAttachment; import org.lamsfoundation.lams.tool.chat.model.ChatCondition; import org.lamsfoundation.lams.tool.chat.model.ChatMessage; import org.lamsfoundation.lams.tool.chat.model.ChatSession; @@ -73,28 +72,6 @@ public Chat getChatByContentId(Long toolContentID); /** - * @param toolContentId - * @param file - * @param type - * @return - */ - public ChatAttachment uploadFileToContent(Long toolContentId, FormFile file, String type); - - /** - * @param uuid - * @param versionID - */ - public void deleteFromRepository(Long uuid, Long versionID) throws ChatException; - - /** - * @param contentID - * @param uuid - * @param versionID - * @param type - */ - public void deleteInstructionFile(Long contentID, Long uuid, Long versionID, String type); - - /** * @param chat */ public void saveOrUpdateChat(Chat chat); Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatConstants.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatConstants.java,v diff -u -r1.17 -r1.18 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatConstants.java 25 Oct 2012 10:21:03 -0000 1.17 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatConstants.java 17 Jan 2014 21:36:40 -0000 1.18 @@ -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"; @@ -68,7 +66,7 @@ public static final String ERROR_MSG_NAME_DUPLICATED = "error.condition.duplicated.name"; public static final String MESSAGE_SEPARATOR = " "; - /* Date time restriction LDEV-2657 */ + /* Date time restriction */ public static final String ATTR_SUBMISSION_DEADLINE = "submissionDeadline"; public static final String ATTR_IS_SUBMISSION_DEADLINE_PASSED = "isSubmissionDeadlinePassed"; Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/AuthoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/AuthoringAction.java,v diff -u -r1.29 -r1.30 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/AuthoringAction.java 6 Sep 2011 01:14:53 -0000 1.29 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/AuthoringAction.java 17 Jan 2014 21:36:39 -0000 1.30 @@ -33,7 +33,6 @@ import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; -import java.util.Map.Entry; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -50,7 +49,6 @@ import org.lamsfoundation.lams.learningdesign.TextSearchConditionComparator; import org.lamsfoundation.lams.tool.ToolAccessMode; import org.lamsfoundation.lams.tool.chat.model.Chat; -import org.lamsfoundation.lams.tool.chat.model.ChatAttachment; import org.lamsfoundation.lams.tool.chat.model.ChatCondition; import org.lamsfoundation.lams.tool.chat.service.ChatServiceProxy; import org.lamsfoundation.lams.tool.chat.service.IChatService; @@ -84,16 +82,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 will be used to retrieve content for this tool. @@ -161,23 +149,6 @@ ToolAccessMode mode = (ToolAccessMode) map.get(AuthoringAction.KEY_MODE); updateChat(chat, authForm, mode); - // remove attachments marked for deletion. - Set attachments = chat.getChatAttachments(); - if (attachments == null) { - attachments = new HashSet(); - } - - for (ChatAttachment att : getAttList(AuthoringAction.KEY_DELETED_FILES, map)) { - // leave in repository but remove from db - attachments.remove(att); - } - - // add unsaved attachments - attachments.addAll(getAttList(AuthoringAction.KEY_UNSAVED_ONLINE_FILES, map)); - attachments.addAll(getAttList(AuthoringAction.KEY_UNSAVED_OFFLINE_FILES, map)); - - // set attachments in case it didn't exist - chat.setChatAttachments(attachments); chatService.releaseConditionsFromCache(chat); Set conditions = chat.getConditions(); @@ -197,7 +168,7 @@ } } - // set attachments in case it didn't exist + // set conditions in case it didn't exist chat.setConditions(conditionSet); // set the update date chat.setUpdateDate(new Date()); @@ -217,154 +188,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 = authForm.getOfflineFile(); - unsavedFiles = getAttList(AuthoringAction.KEY_UNSAVED_OFFLINE_FILES, map); - - savedFiles = getAttList(AuthoringAction.KEY_OFFLINE_FILES, map); - } else { - file = authForm.getOnlineFile(); - unsavedFiles = getAttList(AuthoringAction.KEY_UNSAVED_ONLINE_FILES, map); - - savedFiles = getAttList(AuthoringAction.KEY_ONLINE_FILES, map); - } - - ActionMessages errors = new ActionMessages(); - FileValidatorUtil.validateFileSize(file, true, errors); - if (!errors.isEmpty()) { - request.setAttribute(ChatConstants.ATTR_SESSION_MAP, map); - this.saveErrors(request, errors); - return mapping.findForward("success"); - } - - if (file.getFileName().length() != 0) { - // upload file to repository - ChatAttachment newAtt = chatService.uploadFileToContent( - (Long) map.get(AuthoringAction.KEY_TOOL_CONTENT_ID), file, type); - - // Add attachment to unsavedFiles - // check to see if file with same name exists - ChatAttachment currAtt; - Iterator iter = savedFiles.iterator(); - while (iter.hasNext()) { - currAtt = (ChatAttachment) iter.next(); - if (StringUtils.equals(currAtt.getFileName(), newAtt.getFileName()) - && StringUtils.equals(currAtt.getFileType(), newAtt.getFileType())) { - // move from this this list to deleted list. - getAttList(AuthoringAction.KEY_DELETED_FILES, map).add(currAtt); - iter.remove(); - break; - } - } - unsavedFiles.add(newAtt); - - request.setAttribute(ChatConstants.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(AuthoringAction.KEY_OFFLINE_FILES, map); - } else { - fileList = getAttList(AuthoringAction.KEY_ONLINE_FILES, map); - } - - Iterator iter = fileList.iterator(); - - while (iter.hasNext()) { - ChatAttachment att = (ChatAttachment) iter.next(); - - if (att.getFileUuid().equals(authForm.getDeleteFileUuid())) { - // move to delete file list, deleted at next updateContent - getAttList(AuthoringAction.KEY_DELETED_FILES, map).add(att); - - // remove from this list - iter.remove(); - break; - } - } - - request.setAttribute(ChatConstants.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(AuthoringAction.KEY_UNSAVED_OFFLINE_FILES, map); - } else { - unsavedFiles = getAttList(AuthoringAction.KEY_UNSAVED_ONLINE_FILES, map); - } - - Iterator iter = unsavedFiles.iterator(); - while (iter.hasNext()) { - ChatAttachment att = (ChatAttachment) iter.next(); - - if (att.getFileUuid().equals(authForm.getDeleteFileUuid())) { - // delete from repository and list - chatService.deleteFromRepository(att.getFileUuid(), att.getFileVersionId()); - iter.remove(); - break; - } - } - - request.setAttribute(ChatConstants.ATTR_SESSION_MAP, map); - request.setAttribute("unsavedChanges", new Boolean(true)); - - return mapping.findForward("success"); - } - /** * Updates Chat content using AuthoringForm inputs. * @@ -376,8 +202,6 @@ chat.setTitle(authForm.getTitle()); chat.setInstructions(authForm.getInstructions()); if (mode.isAuthor()) { // Teacher cannot modify following - chat.setOfflineInstructions(authForm.getOfflineInstruction()); - chat.setOnlineInstructions(authForm.getOnlineInstruction()); chat.setLockOnFinished(authForm.isLockOnFinished()); chat.setReflectOnActivity(authForm.isReflectOnActivity()); chat.setReflectInstructions(authForm.getReflectInstructions()); @@ -396,8 +220,6 @@ private void updateAuthForm(AuthoringForm authForm, Chat chat) { authForm.setTitle(chat.getTitle()); authForm.setInstructions(chat.getInstructions()); - authForm.setOnlineInstruction(chat.getOnlineInstructions()); - authForm.setOfflineInstruction(chat.getOfflineInstructions()); authForm.setLockOnFinished(chat.isLockOnFinished()); authForm.setReflectOnActivity(chat.isReflectOnActivity()); authForm.setReflectInstructions(chat.getReflectInstructions()); @@ -419,23 +241,6 @@ map.put(AuthoringAction.KEY_MODE, mode); map.put(AuthoringAction.KEY_CONTENT_FOLDER_ID, contentFolderID); map.put(AuthoringAction.KEY_TOOL_CONTENT_ID, toolContentID); - map.put(AuthoringAction.KEY_ONLINE_FILES, new LinkedList()); - map.put(AuthoringAction.KEY_OFFLINE_FILES, new LinkedList()); - map.put(AuthoringAction.KEY_UNSAVED_ONLINE_FILES, new LinkedList()); - map.put(AuthoringAction.KEY_UNSAVED_OFFLINE_FILES, new LinkedList()); - map.put(AuthoringAction.KEY_DELETED_FILES, new LinkedList()); - - Iterator iter = chat.getChatAttachments().iterator(); - while (iter.hasNext()) { - ChatAttachment attachment = (ChatAttachment) iter.next(); - String type = attachment.getFileType(); - if (type.equals(IToolContentHandler.TYPE_OFFLINE)) { - getAttList(AuthoringAction.KEY_OFFLINE_FILES, map).add(attachment); - } - if (type.equals(IToolContentHandler.TYPE_ONLINE)) { - getAttList(AuthoringAction.KEY_ONLINE_FILES, map).add(attachment); - } - } SortedSet set = new TreeSet(new TextSearchConditionComparator()); if (chat.getConditions() != null) { @@ -463,18 +268,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. * * @param request @@ -484,20 +277,4 @@ private SessionMap getSessionMap(HttpServletRequest request, AuthoringForm authForm) { return (SessionMap) request.getSession().getAttribute(authForm.getSessionMapID()); } - - /** - * List save deleted taskList items, which could be persisted or non-persisted items. - * - * @param request - * @return - */ - private List getDeletedChatConditionList(SessionMap sessionMap) { - List list = (List) sessionMap.get(ChatConstants.ATTR_DELETED_CONDITION_LIST); - if (list == null) { - list = new ArrayList(); - sessionMap.put(ChatConstants.ATTR_DELETED_CONDITION_LIST, list); - } - return list; - - } } \ No newline at end of file Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/LearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/LearningAction.java,v diff -u -r1.33 -r1.34 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/LearningAction.java 9 Apr 2013 12:47:18 -0000 1.33 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/LearningAction.java 17 Jan 2014 21:36:39 -0000 1.34 @@ -77,7 +77,7 @@ * * @struts.action path="/learning" parameter="dispatch" scope="request" name="learningForm" * @struts.action-forward name="learning" path="tiles:/learning/main" - * @struts.action-forward name="runOffline" path="tiles:/learning/runOffline" + * @struts.action-forward name="submissionDeadline" path="tiles:/learning/submissionDeadline" * @struts.action-forward name="defineLater" path="tiles:/learning/defineLater" * @struts.action-forward name="notebook" path="tiles:/learning/notebook" */ @@ -178,11 +178,6 @@ LearningWebUtil.putActivityPositionInRequestByToolSessionId(toolSessionID, request, getServlet() .getServletContext()); - - // check runOffline - if (chat.isRunOffline()) { - return mapping.findForward("runOffline"); - } /* Check if submission deadline is null */ @@ -198,10 +193,9 @@ Date currentLearnerDate = DateUtil.convertToTimeZoneFromDefault(learnerTimeZone, new Date()); request.setAttribute("submissionDeadline", submissionDeadline); - // 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"); } } Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/forms/AuthoringForm.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/forms/AuthoringForm.java,v diff -u -r1.11 -r1.12 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/forms/AuthoringForm.java 1 Nov 2006 23:10:49 -0000 1.11 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/forms/AuthoringForm.java 17 Jan 2014 21:36:40 -0000 1.12 @@ -48,10 +48,6 @@ String instructions; - String offlineInstruction; - - String onlineInstruction; - boolean lockOnFinished; boolean reflectOnActivity; @@ -62,10 +58,6 @@ String filterKeywords; - FormFile onlineFile; - - FormFile offlineFile; - String currentTab; String dispatch; @@ -123,39 +115,7 @@ public void setLockOnFinished(boolean lockOnFinished) { this.lockOnFinished = lockOnFinished; } - - public FormFile getOfflineFile() { - return offlineFile; - } - - public void setOfflineFile(FormFile offlineFile) { - this.offlineFile = offlineFile; - } - - public String getOfflineInstruction() { - return offlineInstruction; - } - - public void setOfflineInstruction(String offlineInstruction) { - this.offlineInstruction = offlineInstruction; - } - - public FormFile getOnlineFile() { - return onlineFile; - } - - public void setOnlineFile(FormFile onlineFile) { - this.onlineFile = onlineFile; - } - public String getOnlineInstruction() { - return onlineInstruction; - } - - public void setOnlineInstruction(String onlineInstruction) { - this.onlineInstruction = onlineInstruction; - } - public String getTitle() { return title; } Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/servlets/ExportServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/servlets/ExportServlet.java,v diff -u -r1.10 -r1.11 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/servlets/ExportServlet.java 6 Jan 2014 08:42:35 -0000 1.10 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/servlets/ExportServlet.java 17 Jan 2014 21:36:40 -0000 1.11 @@ -93,26 +93,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 { - IChatService service = ChatServiceProxy.getChatService(getServletContext()); - Chat chat = null; - if ( toolContentID != null ) { - chat = service.getChatByContentId(toolContentID); - } else { - ChatSession session = chatService.getSessionBySessionId(toolSessionID); - if ( session != null ) - chat = session.getChat(); - } - if ( chat != null ) { - activityTitle = chat.getTitle(); - } - } - return super.doOfflineExport(request, response, directoryName, cookies); - } - private void doLearnerExport(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) throws ChatException { Index: lams_tool_chat/web/WEB-INF/tiles-defs.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/web/WEB-INF/tiles-defs.xml,v diff -u -r1.1 -r1.2 --- lams_tool_chat/web/WEB-INF/tiles-defs.xml 30 Jul 2012 18:50:55 -0000 1.1 +++ lams_tool_chat/web/WEB-INF/tiles-defs.xml 17 Jan 2014 21:36:40 -0000 1.2 @@ -88,8 +88,8 @@ - - + + Index: lams_tool_chat/web/includes/javascript/authoring.js =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/web/includes/javascript/authoring.js,v diff -u -r1.2 -r1.3 --- lams_tool_chat/web/includes/javascript/authoring.js 26 Oct 2006 02:30:53 -0000 1.2 +++ lams_tool_chat/web/includes/javascript/authoring.js 17 Jan 2014 21:36:40 -0000 1.3 @@ -17,9 +17,4 @@ 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_chat/web/includes/javascript/learning.js =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/web/includes/javascript/learning.js,v diff -u -r1.14 -r1.15 --- lams_tool_chat/web/includes/javascript/learning.js 31 Oct 2012 09:31:42 -0000 1.14 +++ lams_tool_chat/web/includes/javascript/learning.js 17 Jan 2014 21:36:40 -0000 1.15 @@ -1,5 +1,5 @@ // for chat users to be indetified by different colours -var PALETTE = ["#0000FF", "#006699", "#0066FF", "#6633FF", "#00CCFF", "#009900", "#00CC33", "#339900", "#008080", "#66FF66", "#CC6600", "#FF6600", "#FF9900", "#CC6633", "#FF9933", "#990000", "#A50021", "#990033", "#CC3300", "#FF6666", "#330033", "#663399", "#6633CC", "#660099", "#FF00FF", "#999900", "#808000", "#FF9FF2", "#666633", "#292929", "#666666"]; +var PALETTE = ["#008CD2", "#DF7C08", "#83B532", "#E0BE40", "#AE8124", "#5F0704", "#004272", "#CD322B", "#254806"]; // only Monitor can send a personal message var selectedUser = null; // last message in chat window @@ -35,11 +35,11 @@ jQuery.each(result.messages, function(){ var container = $('
',{ 'class' : 'message ' + (this.type == 'chat' ? 'private_message' : '') - }).css('color' , getColour(this.from)); + }); $('
',{ 'class' : 'messageFrom', 'text' : this.from - }).appendTo(container); + }).css('color' , getColour(this.from)).appendTo(container); $('',{ 'text' : this.body }).appendTo(container); Index: lams_tool_chat/web/pages/authoring/authoring.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/web/pages/authoring/authoring.jsp,v diff -u -r1.15 -r1.16 --- lams_tool_chat/web/pages/authoring/authoring.jsp 27 Oct 2008 03:31:23 -0000 1.15 +++ lams_tool_chat/web/pages/authoring/authoring.jsp 17 Jan 2014 21:36:39 -0000 1.16 @@ -1,12 +1,9 @@ <%@ include file="/common/taglibs.jsp"%> <%@ page import="org.lamsfoundation.lams.tool.chat.util.ChatConstants"%> - + - + @@ -19,8 +16,7 @@ - - +
@@ -35,9 +31,6 @@
- - -

@@ -54,10 +47,7 @@ - - + + +

+

+ +

+ +
+ + + +
+ + + <%@ include file="parts/finishButton.jsp"%> + +
+ Fisheye: Tag 1.9 refers to a dead (removed) revision in file `lams_tool_chat/web/pages/monitoring/instructions.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_daco/conf/xdoclet/struts-actions.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/conf/xdoclet/struts-actions.xml,v diff -u -r1.7 -r1.8 --- lams_tool_daco/conf/xdoclet/struts-actions.xml 18 Mar 2010 13:59:26 -0000 1.7 +++ lams_tool_daco/conf/xdoclet/struts-actions.xml 17 Jan 2014 21:42:48 -0000 1.8 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/DacoConstants.java,v diff -u -r1.16 -r1.17 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/DacoConstants.java 20 Dec 2012 15:07:36 -0000 1.16 +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/DacoConstants.java 17 Jan 2014 21:42:48 -0000 1.17 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dacoApplicationContext.xml,v diff -u -r1.6 -r1.7 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dacoApplicationContext.xml 26 Mar 2009 10:00:37 -0000 1.6 +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dacoApplicationContext.xml 17 Jan 2014 21:42:48 -0000 1.7 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dbupdates/patch20140102.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dbupdates/patch20140102.sql 17 Jan 2014 21:42:49 -0000 1.1 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/model/Daco.java,v diff -u -r1.6 -r1.7 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/model/Daco.java 26 Aug 2008 03:28:09 -0000 1.6 +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/model/Daco.java 17 Jan 2014 21:42:48 -0000 1.7 @@ -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 1.3 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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/model/DacoQuestion.java,v diff -u -r1.4 -r1.5 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/model/DacoQuestion.java 8 Aug 2008 08:10:22 -0000 1.4 +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/model/DacoQuestion.java 17 Jan 2014 21:42:49 -0000 1.5 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/DacoImportContentVersionFilter.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/DacoImportContentVersionFilter.java 17 Jan 2014 21:42:48 -0000 1.1 @@ -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: DacoImportContentVersionFilter.java,v 1.1 2014/01/17 21:42:48 andreyb Exp $ */ +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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/DacoServiceImpl.java,v diff -u -r1.15 -r1.16 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/DacoServiceImpl.java 29 Jul 2013 23:11:58 -0000 1.15 +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/DacoServiceImpl.java 17 Jan 2014 21:42:48 -0000 1.16 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/IDacoService.java,v diff -u -r1.10 -r1.11 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/IDacoService.java 10 Feb 2011 22:29:41 -0000 1.10 +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/IDacoService.java 17 Jan 2014 21:42:48 -0000 1.11 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/AuthoringAction.java,v diff -u -r1.8 -r1.9 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/AuthoringAction.java 29 Jul 2013 12:15:44 -0000 1.8 +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/AuthoringAction.java 17 Jan 2014 21:42:48 -0000 1.9 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/LearningAction.java,v diff -u -r1.18 -r1.19 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/LearningAction.java 4 Jul 2013 11:35:14 -0000 1.18 +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/LearningAction.java 17 Jan 2014 21:42:48 -0000 1.19 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/MonitoringAction.java,v diff -u -r1.12 -r1.13 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/MonitoringAction.java 20 Dec 2012 15:07:36 -0000 1.12 +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/MonitoringAction.java 17 Jan 2014 21:42:48 -0000 1.13 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/form/DacoForm.java,v diff -u -r1.3 -r1.4 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/form/DacoForm.java 8 Aug 2008 08:10:21 -0000 1.3 +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/form/DacoForm.java 17 Jan 2014 21:42:48 -0000 1.4 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/servlet/ExportServlet.java,v diff -u -r1.4 -r1.5 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/servlet/ExportServlet.java 6 Jan 2014 08:42:50 -0000 1.4 +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/servlet/ExportServlet.java 17 Jan 2014 21:42:48 -0000 1.5 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/web/pages/authoring/authoring.jsp,v diff -u -r1.6 -r1.7 --- lams_tool_daco/web/pages/authoring/authoring.jsp 29 Jul 2013 12:15:44 -0000 1.6 +++ lams_tool_daco/web/pages/authoring/authoring.jsp 17 Jan 2014 21:42:48 -0000 1.7 @@ -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 1.4 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 1.4 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 1.8 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 1.4 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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/web/pages/monitoring/monitoring.jsp,v diff -u -r1.3 -r1.4 --- lams_tool_daco/web/pages/monitoring/monitoring.jsp 8 Aug 2008 08:10:22 -0000 1.3 +++ lams_tool_daco/web/pages/monitoring/monitoring.jsp 17 Jan 2014 21:42:48 -0000 1.4 @@ -24,18 +24,16 @@
- - - + +
Index: lams_tool_eadventure/conf/xdoclet/struts-actions.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_eadventure/conf/xdoclet/struts-actions.xml,v diff -u -r1.3 -r1.4 --- lams_tool_eadventure/conf/xdoclet/struts-actions.xml 11 Dec 2011 21:30:26 -0000 1.3 +++ lams_tool_eadventure/conf/xdoclet/struts-actions.xml 17 Jan 2014 21:42:40 -0000 1.4 @@ -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 Fisheye: Tag 1.4 refers to a dead (removed) revision in file `lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureAttachmentDAO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureAttachmentDAOHibernate.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dbupdates/patch20140102.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dbupdates/patch20140102.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dbupdates/patch20140102.sql 17 Jan 2014 21:42:40 -0000 1.1 @@ -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_eueadv10_eadventure DROP COLUMN online_instructions; +ALTER TABLE tl_eueadv10_eadventure DROP COLUMN offline_instructions; +ALTER TABLE tl_eueadv10_eadventure DROP COLUMN run_offline; +DROP TABLE IF EXISTS tl_eueadv10_attachment; + +UPDATE lams_tool SET tool_version='20140102' WHERE tool_signature='eueadv10'; + +----------------------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_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Eadventure.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Eadventure.java,v diff -u -r1.4 -r1.5 --- lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Eadventure.java 14 Dec 2013 15:20:30 -0000 1.4 +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Eadventure.java 17 Jan 2014 21:42:39 -0000 1.5 @@ -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 1.4 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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureImportContentVersionFilter.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureImportContentVersionFilter.java 17 Jan 2014 21:42:40 -0000 1.1 @@ -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: EadventureImportContentVersionFilter.java,v 1.1 2014/01/17 21:42:40 andreyb Exp $ */ +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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureServiceImpl.java,v diff -u -r1.8 -r1.9 --- lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureServiceImpl.java 29 Jul 2013 23:12:13 -0000 1.8 +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureServiceImpl.java 17 Jan 2014 21:42:40 -0000 1.9 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/IEadventureService.java,v diff -u -r1.3 -r1.4 --- lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/IEadventureService.java 11 Dec 2011 21:30:31 -0000 1.3 +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/IEadventureService.java 17 Jan 2014 21:42:40 -0000 1.4 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/AuthoringAction.java,v diff -u -r1.6 -r1.7 --- lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/AuthoringAction.java 14 Dec 2013 15:20:30 -0000 1.6 +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/AuthoringAction.java 17 Jan 2014 21:42:40 -0000 1.7 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/LearningAction.java,v diff -u -r1.5 -r1.6 --- lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/LearningAction.java 9 Apr 2013 12:46:18 -0000 1.5 +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/LearningAction.java 17 Jan 2014 21:42:40 -0000 1.6 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/MonitoringAction.java,v diff -u -r1.3 -r1.4 --- lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/MonitoringAction.java 11 Dec 2011 21:30:31 -0000 1.3 +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/MonitoringAction.java 17 Jan 2014 21:42:40 -0000 1.4 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureForm.java,v diff -u -r1.3 -r1.4 --- lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureForm.java 11 Dec 2011 21:30:32 -0000 1.3 +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureForm.java 17 Jan 2014 21:42:41 -0000 1.4 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/servlet/ExportServlet.java,v diff -u -r1.5 -r1.6 --- lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/servlet/ExportServlet.java 6 Jan 2014 08:42:11 -0000 1.5 +++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/servlet/ExportServlet.java 17 Jan 2014 21:42:41 -0000 1.6 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_eadventure/web/pages/authoring/authoring.jsp,v diff -u -r1.6 -r1.7 --- lams_tool_eadventure/web/pages/authoring/authoring.jsp 26 Jul 2013 13:16:51 -0000 1.6 +++ lams_tool_eadventure/web/pages/authoring/authoring.jsp 17 Jan 2014 21:42:41 -0000 1.7 @@ -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 1.4 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 1.4 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 1.6 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 1.6 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 1.4 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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_eadventure/web/pages/monitoring/monitoring.jsp,v diff -u -r1.3 -r1.4 --- lams_tool_eadventure/web/pages/monitoring/monitoring.jsp 11 Dec 2011 21:30:43 -0000 1.3 +++ lams_tool_eadventure/web/pages/monitoring/monitoring.jsp 17 Jan 2014 21:42:40 -0000 1.4 @@ -37,18 +37,16 @@
- - - + +
Index: lams_tool_forum/conf/xdoclet/struts-actions.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/conf/xdoclet/struts-actions.xml,v diff -u -r1.51 -r1.52 --- lams_tool_forum/conf/xdoclet/struts-actions.xml 6 Jan 2012 16:35:08 -0000 1.51 +++ lams_tool_forum/conf/xdoclet/struts-actions.xml 17 Jan 2014 21:42:45 -0000 1.52 @@ -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/dbupdates/patch20140102.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/dbupdates/patch20140102.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/dbupdates/patch20140102.sql 17 Jan 2014 21:42:45 -0000 1.1 @@ -0,0 +1,18 @@ +-- 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_lafrum11_forum DROP COLUMN online_instructions; +ALTER TABLE tl_lafrum11_forum DROP COLUMN offline_instructions; +ALTER TABLE tl_lafrum11_forum DROP COLUMN run_offline; + +UPDATE lams_tool SET tool_version='20140102' WHERE tool_signature='lafrum11'; + +----------------------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_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/Forum.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/Forum.java,v diff -u -r1.36 -r1.37 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/Forum.java 27 Jun 2013 12:06:16 -0000 1.36 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/Forum.java 17 Jan 2014 21:42:44 -0000 1.37 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/Message.java,v diff -u -r1.39 -r1.40 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/Message.java 27 Jun 2013 12:06:16 -0000 1.39 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/Message.java 17 Jan 2014 21:42:44 -0000 1.40 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumImportContentVersionFilter.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumImportContentVersionFilter.java 17 Jan 2014 21:42:45 -0000 1.1 @@ -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: ForumImportContentVersionFilter.java,v 1.1 2014/01/17 21:42:45 andreyb Exp $ */ +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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java,v diff -u -r1.116 -r1.117 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java 13 Aug 2013 12:14:24 -0000 1.116 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java 17 Jan 2014 21:42:44 -0000 1.117 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/IForumService.java,v diff -u -r1.51 -r1.52 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/IForumService.java 12 Jul 2013 14:17:07 -0000 1.51 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/IForumService.java 17 Jan 2014 21:42:44 -0000 1.52 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/ForumConstants.java,v diff -u -r1.59 -r1.60 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/ForumConstants.java 8 Nov 2012 15:05:38 -0000 1.59 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/ForumConstants.java 17 Jan 2014 21:42:45 -0000 1.60 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/AuthoringAction.java,v diff -u -r1.79 -r1.80 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/AuthoringAction.java 12 Feb 2011 18:54:32 -0000 1.79 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/AuthoringAction.java 17 Jan 2014 21:42:44 -0000 1.80 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/ExportServlet.java,v diff -u -r1.18 -r1.19 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/ExportServlet.java 6 Jan 2014 08:42:14 -0000 1.18 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/ExportServlet.java 17 Jan 2014 21:42:44 -0000 1.19 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java,v diff -u -r1.82 -r1.83 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java 12 Jul 2013 14:17:07 -0000 1.82 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java 17 Jan 2014 21:42:44 -0000 1.83 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/ForumForm.java,v diff -u -r1.18 -r1.19 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/ForumForm.java 4 Mar 2011 13:50:04 -0000 1.18 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/ForumForm.java 17 Jan 2014 21:42:45 -0000 1.19 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/WEB-INF/tiles-defs.xml,v diff -u -r1.3 -r1.4 --- lams_tool_forum/web/WEB-INF/tiles-defs.xml 30 Jul 2012 18:51:56 -0000 1.3 +++ lams_tool_forum/web/WEB-INF/tiles-defs.xml 17 Jan 2014 21:42:45 -0000 1.4 @@ -65,9 +65,9 @@ - - - + + + Index: lams_tool_forum/web/jsps/authoring/authoring.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/authoring/authoring.jsp,v diff -u -r1.29 -r1.30 --- lams_tool_forum/web/jsps/authoring/authoring.jsp 21 Mar 2012 17:57:21 -0000 1.29 +++ lams_tool_forum/web/jsps/authoring/authoring.jsp 17 Jan 2014 21:42:45 -0000 1.30 @@ -9,16 +9,12 @@ - +
@@ -28,12 +24,9 @@ - - - + + + + + +
+ +

+ +

+ +
+ + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + Fisheye: Tag 1.7 refers to a dead (removed) revision in file `lams_tool_forum/web/jsps/learning/mobile/runoffline.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_forum/web/jsps/learning/mobile/submissionDeadline.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/learning/mobile/submissionDeadline.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_forum/web/jsps/learning/mobile/submissionDeadline.jsp 17 Jan 2014 21:42:45 -0000 1.1 @@ -0,0 +1,65 @@ +<%@ include file="/common/taglibs.jsp"%> + + +
+

+ +

+
+ +
+ +
+ + + +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Index: lams_tool_forum/web/jsps/monitoring/header.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/monitoring/header.jsp,v diff -u -r1.7 -r1.8 --- lams_tool_forum/web/jsps/monitoring/header.jsp 10 Jul 2013 10:13:33 -0000 1.7 +++ lams_tool_forum/web/jsps/monitoring/header.jsp 17 Jan 2014 21:42:44 -0000 1.8 @@ -23,7 +23,7 @@ selectTab(tabId); //for statistic page change: - if(tabId == 4) + if(tabId == 3) doStatistic(); } Fisheye: Tag 1.11 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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/monitoring/monitoring.jsp,v diff -u -r1.5 -r1.6 --- lams_tool_forum/web/jsps/monitoring/monitoring.jsp 21 Sep 2006 08:27:57 -0000 1.5 +++ lams_tool_forum/web/jsps/monitoring/monitoring.jsp 17 Jan 2014 21:42:44 -0000 1.6 @@ -5,17 +5,15 @@ - - - + +
- - - + +
Index: lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/gmapApplicationContext.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/gmapApplicationContext.xml,v diff -u -r1.5 -r1.6 --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/gmapApplicationContext.xml 26 Mar 2009 10:00:38 -0000 1.5 +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/gmapApplicationContext.xml 17 Jan 2014 21:45:00 -0000 1.6 @@ -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 @@ - - - - Fisheye: Tag 1.3 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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dao/IGmapDAO.java,v diff -u -r1.2 -r1.3 --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dao/IGmapDAO.java 6 Jun 2008 00:24:19 -0000 1.2 +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dao/IGmapDAO.java 17 Jan 2014 21:45:00 -0000 1.3 @@ -37,7 +37,5 @@ Gmap getByContentId(Long toolContentId); void saveOrUpdate(Gmap toContent); - - void deleteInstructionFile(Long toolContentId, Long uuid, Long versionId, String type); } Fisheye: Tag 1.3 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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dao/hibernate/GmapDAO.java,v diff -u -r1.2 -r1.3 --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dao/hibernate/GmapDAO.java 6 Jun 2008 00:24:19 -0000 1.2 +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/dao/hibernate/GmapDAO.java 17 Jan 2014 21:45:00 -0000 1.3 @@ -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/model/Gmap.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/model/Gmap.java,v diff -u -r1.6 -r1.7 --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/model/Gmap.java 23 Jul 2008 04:15:10 -0000 1.6 +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/model/Gmap.java 17 Jan 2014 21:45:00 -0000 1.7 @@ -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 1.4 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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/service/GmapImportContentVersionFilter.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/service/GmapImportContentVersionFilter.java 17 Jan 2014 21:45:00 -0000 1.1 @@ -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: GmapImportContentVersionFilter.java,v 1.1 2014/01/17 21:45:00 andreyb Exp $ */ +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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/service/GmapService.java,v diff -u -r1.20 -r1.21 --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/service/GmapService.java 29 Jul 2013 23:11:16 -0000 1.20 +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/service/GmapService.java 17 Jan 2014 21:45:00 -0000 1.21 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/service/IGmapService.java,v diff -u -r1.9 -r1.10 --- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/service/IGmapService.java 10 Feb 2011 22:47:56 -0000 1.9 +++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/service/IGmapService.java 17 Jan 2014 21:45:00 -0000 1.10 @@ -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); Fisheye: Tag 1.5 refers to a dead (removed) revision in file `lams_tool_gmap/web/pages/learning/runOffline.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `lams_tool_gmap/web/pages/monitoring/instructions.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_gmap/web/pages/monitoring/monitoring.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_gmap/web/pages/monitoring/monitoring.jsp,v diff -u -r1.1 -r1.2 --- lams_tool_gmap/web/pages/monitoring/monitoring.jsp 23 May 2008 06:29:10 -0000 1.1 +++ lams_tool_gmap/web/pages/monitoring/monitoring.jsp 17 Jan 2014 21:45:00 -0000 1.2 @@ -4,19 +4,17 @@
- - - + +
Index: lams_tool_images/conf/xdoclet/struts-actions.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/conf/xdoclet/struts-actions.xml,v diff -u -r1.11 -r1.12 --- lams_tool_images/conf/xdoclet/struts-actions.xml 11 Jun 2011 20:21:25 -0000 1.11 +++ lams_tool_images/conf/xdoclet/struts-actions.xml 17 Jan 2014 21:44:57 -0000 1.12 @@ -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 Fisheye: Tag 1.2 refers to a dead (removed) revision in file `lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dao/ImageGalleryAttachmentDAO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dao/hibernate/ImageGalleryAttachmentDAOHibernate.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dbupdates/patch20140102.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dbupdates/patch20140102.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dbupdates/patch20140102.sql 17 Jan 2014 21:44:57 -0000 1.1 @@ -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_laimag10_imageGallery DROP COLUMN online_instructions; +ALTER TABLE tl_laimag10_imageGallery DROP COLUMN offline_instructions; +ALTER TABLE tl_laimag10_imageGallery DROP COLUMN run_offline; +DROP TABLE IF EXISTS tl_laimag10_attachment; + +UPDATE lams_tool SET tool_version='20140102' WHERE tool_signature='laimag10'; + +----------------------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_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/ImageGallery.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/ImageGallery.java,v diff -u -r1.7 -r1.8 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/ImageGallery.java 16 Dec 2008 18:16:12 -0000 1.7 +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/ImageGallery.java 17 Jan 2014 21:44:58 -0000 1.8 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/IImageGalleryService.java,v diff -u -r1.18 -r1.19 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/IImageGalleryService.java 11 Jun 2011 20:21:25 -0000 1.18 +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/IImageGalleryService.java 17 Jan 2014 21:44:57 -0000 1.19 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryImportContentVersionFilter.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryImportContentVersionFilter.java 17 Jan 2014 21:44:57 -0000 1.1 @@ -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: ImageGalleryImportContentVersionFilter.java,v 1.1 2014/01/17 21:44:57 andreyb Exp $ */ +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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryServiceImpl.java,v diff -u -r1.25 -r1.26 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryServiceImpl.java 29 Jul 2013 23:11:33 -0000 1.25 +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryServiceImpl.java 17 Jan 2014 21:44:57 -0000 1.26 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/AuthoringAction.java,v diff -u -r1.8 -r1.9 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/AuthoringAction.java 25 Jul 2013 05:55:17 -0000 1.8 +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/AuthoringAction.java 17 Jan 2014 21:44:57 -0000 1.9 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java,v diff -u -r1.25 -r1.26 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java 4 Jul 2013 11:35:03 -0000 1.25 +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java 17 Jan 2014 21:44:57 -0000 1.26 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/MonitoringAction.java,v diff -u -r1.8 -r1.9 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/MonitoringAction.java 10 Feb 2011 22:52:58 -0000 1.8 +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/MonitoringAction.java 17 Jan 2014 21:44:57 -0000 1.9 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/form/ImageGalleryForm.java,v diff -u -r1.3 -r1.4 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/form/ImageGalleryForm.java 2 Nov 2008 01:15:12 -0000 1.3 +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/form/ImageGalleryForm.java 17 Jan 2014 21:44:58 -0000 1.4 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/servlet/ExportServlet.java,v diff -u -r1.7 -r1.8 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/servlet/ExportServlet.java 6 Jan 2014 08:42:21 -0000 1.7 +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/servlet/ExportServlet.java 17 Jan 2014 21:44:57 -0000 1.8 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/web/pages/authoring/authoring.jsp,v diff -u -r1.4 -r1.5 --- lams_tool_images/web/pages/authoring/authoring.jsp 28 Jul 2009 14:20:01 -0000 1.4 +++ lams_tool_images/web/pages/authoring/authoring.jsp 17 Jan 2014 21:44:57 -0000 1.5 @@ -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 1.2 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 1.2 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 1.7 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 1.2 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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/web/pages/monitoring/monitoring.jsp,v diff -u -r1.7 -r1.8 --- lams_tool_images/web/pages/monitoring/monitoring.jsp 11 Dec 2012 11:29:45 -0000 1.7 +++ lams_tool_images/web/pages/monitoring/monitoring.jsp 17 Jan 2014 21:44:57 -0000 1.8 @@ -46,18 +46,16 @@
- - - + +