Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java =================================================================== diff -u -r5583b96031dbb65e91d200b7121cc5cd49e26003 -rcf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision 5583b96031dbb65e91d200b7121cc5cd49e26003) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision cf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c) @@ -105,6 +105,10 @@ public static final String RICHTEXT_TITLE ="richTextTitle"; public static final String RICHTEXT_INSTRUCTIONS ="richTextInstructions"; public static final String RICHTEXT_BLANK ="
"; + public static final String THE_OFFLINE_FILE ="theOfflineFile"; + public static final String THE_ONLINE_FILE ="theOnlineFile"; + public static final String THE_OFFLINE_FILENAME ="theOfflineFileName"; + public static final String THE_ONLINE_FILENAME ="theOnlineFileName"; /** Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaResources.properties =================================================================== diff -u -r5583b96031dbb65e91d200b7121cc5cd49e26003 -rcf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaResources.properties (.../QaResources.properties) (revision 5583b96031dbb65e91d200b7121cc5cd49e26003) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaResources.properties (.../QaResources.properties) (revision cf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c) @@ -30,6 +30,9 @@ radiobox.questionsSequenced =Questions Sequenced label.offlineInstructions =Offline Instructions label.onlineInstructions =Online Instructions +label.offlineFiles =Offline Files +label.onlineFiles =Online Files +label.upload =Upload option.on =ON option.off =OFF feedback =Please address the following issues before submit.
NodeKey
object which is a unique indentifier of the file
- * in the repsoitorytl_lasbmt11_submission_details
tl_lasbmt11_report
InputStream
representing the data to be
- * uploaded
- * @param contentID
- * The contentID
of the file being uploaded
- * @param filePath
- * The physical path of the file
- * @param fileDescription
- * The description of the file
- * @param fileName
- * The name of the file being added
- * @param mimeType
- * The MIME type of the file (eg. TXT, DOC, GIF etc)
- * @param dateOfSubmission
- * The date this file was uploaded by the user
- * @param userID
- * The User
who has uploaded the file.
- * @throws SubmitFilesException
- */
- public void uploadFile(InputStream stream, Long toolContentId, String filePath, String fileDescription, String fileName, String mimeType,Date dateOfSubmission, Long userID) throws QaApplicationException {
- QaContent qaContent = qaDAO.loadQaById(toolContentId.longValue());
- logger.debug("retrieving qaContent: " + qaContent);
-
- if (qaContent == null)
- {
- logger.debug("no content with toolContentId: " + toolContentId);
- throw new QaApplicationException(
- "No such content with a toolContentId of: " + toolContentId
- + " found.");
- }
- else
- {
- NodeKey nodeKey = uploadFileToRepository(stream, fileName, mimeType);
- SubmissionDetails details = new SubmissionDetails(filePath,fileDescription,dateOfSubmission,
- nodeKey.getUuid(),nodeKey.getVersion(),
- userID);
- logger.debug("details: " + details);
- //submissionDetailsDAO.insert(details);
- }
- }
-
-
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java
===================================================================
diff -u -rab01f4417489f903865c8629d5256d7eed0736e5 -rcf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision ab01f4417489f903865c8629d5256d7eed0736e5)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision cf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c)
@@ -6,6 +6,9 @@
*/
package org.lamsfoundation.lams.tool.qa.web;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
@@ -18,8 +21,11 @@
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.NodeKey;
import org.lamsfoundation.lams.tool.exception.ToolException;
import org.lamsfoundation.lams.tool.qa.QaAppConstants;
+import org.lamsfoundation.lams.tool.qa.QaApplicationException;
import org.lamsfoundation.lams.tool.qa.QaComparator;
import org.lamsfoundation.lams.tool.qa.QaContent;
import org.lamsfoundation.lams.tool.qa.QaQueContent;
@@ -320,20 +326,14 @@
monitoringReportTitle=qaAuthoringForm.getMonitoringReportTitle();
offlineInstructions=qaAuthoringForm.getOnlineInstructions();
onlineInstructions=qaAuthoringForm.getOfflineInstructions();
-
- /**
- * read and persist rich text parameters
- */
- //QaUtils.persistRichText(request);
-
endLearningMessage=qaAuthoringForm.getEndLearningMessage();
}
creationDate=(String)request.getSession().getAttribute(CREATION_DATE);
if (creationDate == null)
creationDate=new Date(System.currentTimeMillis()).toString();
- /** read rich text vallues */
+ /** read rich text values */
String richTextOfflineInstructions="";
richTextOfflineInstructions = (String)request.getSession().getAttribute(RICHTEXT_OFFLINEINSTRUCTIONS);
logger.debug("createContent: richTextOfflineInstructions from session: " + richTextOfflineInstructions);
@@ -354,6 +354,40 @@
logger.debug("createContent richTextInstructions from session: " + richTextInstructions);
if (richTextInstructions == null) richTextInstructions="";
+ /** read uploaded file informtion */
+
+ logger.debug("retrieve theOfflineFileName.");
+ FormFile theOfflineFile = qaAuthoringForm.getTheOfflineFile();
+ logger.debug("retrieved theOfflineFile: " + theOfflineFile);
+
+ try
+ {
+ InputStream offlineFileInputStream = theOfflineFile.getInputStream();
+ logger.debug("retrieved offlineFileInputStream: " + offlineFileInputStream);
+ String offlineFileName=theOfflineFile.getFileName();
+ logger.debug("retrieved offlineFileName: " + offlineFileName);
+ NodeKey nodeKey=qaService.uploadFileToRepository(offlineFileInputStream, offlineFileName);
+ logger.debug("repository returned nodeKey: " + nodeKey);
+ logger.debug("repository returned nodeKey uuid: " + nodeKey.getUuid());
+ }
+ catch(FileNotFoundException e)
+ {
+ logger.debug("exception occured, offline file not found : " + e.getMessage());
+ //possibly give warning to user in request scope
+ }
+ catch(IOException e)
+ {
+ logger.debug("exception occured in offline file transfer: " + e.getMessage());
+ //possibly give warning to user in request scope
+ }
+ catch(QaApplicationException e)
+ {
+ logger.debug("exception occured in accessing the repository server: " + e.getMessage());
+ //possibly give warning to user in request scope
+ }
+
+
+
/**obtain user object from the session*/
User toolUser=(User)request.getSession().getAttribute(TOOL_USER);
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QAction.java
===================================================================
diff -u -r13e8a854b878342109ba1b3f778e508934917115 -rcf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QAction.java (.../QAction.java) (revision 13e8a854b878342109ba1b3f778e508934917115)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QAction.java (.../QAction.java) (revision cf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c)
@@ -21,6 +21,7 @@
package org.lamsfoundation.lams.tool.qa.web;
import java.io.IOException;
+import java.io.InputStream;
import java.util.Date;
import java.util.Map;
@@ -36,6 +37,7 @@
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.actions.DispatchAction;
+import org.apache.struts.upload.FormFile;
import org.lamsfoundation.lams.tool.qa.QaAppConstants;
import org.lamsfoundation.lams.tool.qa.QaContent;
import org.lamsfoundation.lams.tool.qa.QaSession;
@@ -277,6 +279,9 @@
logger.debug("user action is: " + userAction);
QaUtils.persistRichText(request);
+ //logger.debug("before calling persistUploadFileInformation");
+ //QaUtils.persistUploadFileInformation(request);
+
/** add a new question to Map */
if (userAction.equalsIgnoreCase(ADD_NEW_QUESTION))
{
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java
===================================================================
diff -u -r5ba75a338c76b23778bf80ab835209d38e2316cb -rcf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java (.../QaAuthoringForm.java) (revision 5ba75a338c76b23778bf80ab835209d38e2316cb)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java (.../QaAuthoringForm.java) (revision cf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c)
@@ -12,6 +12,7 @@
*/
import org.apache.struts.action.ActionForm;
import org.lamsfoundation.lams.tool.qa.QaAppConstants;
+import org.apache.struts.upload.FormFile;
/**
* @author Ozgur Demirtas
@@ -26,6 +27,7 @@
protected String removeAllContent;
protected String submitAllContent;
protected String submitTabDone;
+ protected String submitOfflineFile;
/** tab controller, these may go away once the Flash wraps the jsp */
protected String choice;
@@ -42,14 +44,17 @@
/** instructions content */
protected String onlineInstructions;
protected String offlineInstructions;
+ protected FormFile theOfflineFile;
+ protected FormFile theOnlineFile;
+
/** advanced content */
protected String synchInMonitor;
protected String reportTitle;
protected String monitoringReportTitle;
protected String endLearningMessage;
protected String usernameVisible;
protected String questionsSequenced;
-
+
/** proxy controllers for Monitoring tabs */
protected String summaryMonitoring;
protected String instructionsMonitoring;
@@ -65,6 +70,7 @@
this.removeAllContent=null;
this.submitAllContent=null;
this.submitTabDone=null;
+ this.submitOfflineFile=null;
this.summaryMonitoring=null;
this.instructionsMonitoring=null;
@@ -80,6 +86,7 @@
this.removeAllContent=null;
this.submitAllContent=null;
this.submitTabDone=null;
+ this.submitOfflineFile=null;
this.choice=null;
this.choiceBasic=null;
@@ -444,4 +451,41 @@
public void setEdit(String edit) {
this.edit = edit;
}
+
+ /**
+ * @return Returns the submitOfflineFile.
+ */
+ public String getSubmitOfflineFile() {
+ return submitOfflineFile;
+ }
+ /**
+ * @param submitOfflineFile The submitOfflineFile to set.
+ */
+ public void setSubmitOfflineFile(String submitOfflineFile) {
+ this.submitOfflineFile = submitOfflineFile;
+ }
+ /**
+ * @param theOfflineFile The theOfflineFile to set.
+ */
+ public void setTheOfflineFile(FormFile theOfflineFile) {
+ this.theOfflineFile = theOfflineFile;
+ }
+ /**
+ * @param theOnlineFile The theOnlineFile to set.
+ */
+ public void setTheOnlineFile(FormFile theOnlineFile) {
+ this.theOnlineFile = theOnlineFile;
+ }
+ /**
+ * @return Returns the theOfflineFile.
+ */
+ public FormFile getTheOfflineFile() {
+ return theOfflineFile;
+ }
+ /**
+ * @return Returns the theOnlineFile.
+ */
+ public FormFile getTheOnlineFile() {
+ return theOnlineFile;
+ }
}
Fisheye: Tag cf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioStarterAction.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java
===================================================================
diff -u -r3a1559dcb04b690e5daf72efd8df858b42db1317 -rcf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision 3a1559dcb04b690e5daf72efd8df858b42db1317)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision cf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c)
@@ -123,9 +123,9 @@
logger.debug("retrieving qaService from proxy: " + qaService);
request.getSession().setAttribute(TOOL_SERVICE, qaService);
}
+ /** souble check if this is a good place to call */
+ QaUtils.configureContentRepository(request);
- //QaUtils.configureContentRepository(request);
-
/**
* obtain and setup the current user's data
*/
@@ -225,7 +225,8 @@
request.getSession().setAttribute(CHOICE_TYPE_INSTRUCTIONS,CHOICE_TYPE_INSTRUCTIONS);
request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(false));
- request.setAttribute(FORM_INDEX, "0");
+ request.getSession().setAttribute(FORM_INDEX, "0");
+ logger.debug("FORM_INDEX set to: " + request.getSession().getAttribute(FORM_INDEX));
/**
Index: lams_tool_laqa/web/BasicContent.jsp
===================================================================
diff -u -r1213de28fa1704749c2b8cc7029667a5e944cef8 -rcf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c
--- lams_tool_laqa/web/BasicContent.jsp (.../BasicContent.jsp) (revision 1213de28fa1704749c2b8cc7029667a5e944cef8)
+++ lams_tool_laqa/web/BasicContent.jsp (.../BasicContent.jsp) (revision cf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c)
@@ -6,7 +6,7 @@
<%@ taglib uri="fck-editor" prefix="FCK" %>
+ |
+
+ |
+
|
|
+ |
+ + online upload + | +
@@ -54,7 +54,7 @@
- |