Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java,v diff -u -r1.16 -r1.17 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java 14 Jul 2005 05:45:41 -0000 1.16 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java 20 Jul 2005 07:21:46 -0000 1.17 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/QaResources.properties,v diff -u -r1.9 -r1.10 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaResources.properties 14 Jul 2005 05:45:41 -0000 1.9 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaResources.properties 20 Jul 2005 07:21:46 -0000 1.10 @@ -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
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java,v
diff -u -r1.7 -r1.8
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java 11 Jul 2005 02:08:04 -0000 1.7
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java 20 Jul 2005 07:21:46 -0000 1.8
@@ -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
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/Attic/QAction.java,v
diff -u -r1.8 -r1.9
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QAction.java 11 Jul 2005 04:24:29 -0000 1.8
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QAction.java 20 Jul 2005 07:21:46 -0000 1.9
@@ -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
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/Attic/QaAuthoringForm.java,v
diff -u -r1.2 -r1.3
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java 4 Jul 2005 06:11:24 -0000 1.2
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java 20 Jul 2005 07:21:46 -0000 1.3
@@ -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 1.9 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
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java,v
diff -u -r1.15 -r1.16
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java 20 Jul 2005 01:16:02 -0000 1.15
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java 20 Jul 2005 07:21:46 -0000 1.16
@@ -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
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/web/Attic/BasicContent.jsp,v
diff -u -r1.6 -r1.7
--- lams_tool_laqa/web/BasicContent.jsp 14 Jul 2005 05:45:42 -0000 1.6
+++ lams_tool_laqa/web/BasicContent.jsp 20 Jul 2005 07:21:46 -0000 1.7
@@ -6,7 +6,7 @@
<%@ taglib uri="fck-editor" prefix="FCK" %>
+ |
+
+ |
+
|
|
+ |
+ + online upload + | +
@@ -54,7 +54,7 @@
- |