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