Index: lams_tool_laqa/db/sql/drop_lams_tool_qa.sql =================================================================== diff -u -r16e844de3f7c34b44baee1b28e67e708f42d00bf -ra4b9dfe6935887930d266eedb191089ea52914cc --- lams_tool_laqa/db/sql/drop_lams_tool_qa.sql (.../drop_lams_tool_qa.sql) (revision 16e844de3f7c34b44baee1b28e67e708f42d00bf) +++ lams_tool_laqa/db/sql/drop_lams_tool_qa.sql (.../drop_lams_tool_qa.sql) (revision a4b9dfe6935887930d266eedb191089ea52914cc) @@ -4,4 +4,4 @@ DROP TABLE IF EXISTS lams.tl_laqa11_que_content; DROP TABLE IF EXISTS lams.tl_laqa11_session; DROP TABLE IF EXISTS lams.tl_laqa11_content; - +DROP TABLE IF EXISTS lams.tl_laqa11_uploadedFile; Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java =================================================================== diff -u -r11b1827ff684ae7472bb77194d2c35a9dafc0bc1 -ra4b9dfe6935887930d266eedb191089ea52914cc --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 11b1827ff684ae7472bb77194d2c35a9dafc0bc1) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision a4b9dfe6935887930d266eedb191089ea52914cc) @@ -354,14 +354,14 @@ logger.debug("createContent richTextInstructions from session: " + richTextInstructions); if (richTextInstructions == null) richTextInstructions=""; - /** read uploaded file informtion */ - - logger.debug("retrieve theOfflineFileName."); + /** read uploaded file informtion - offline file*/ + logger.debug("retrieve theOfflineFile."); FormFile theOfflineFile = qaAuthoringForm.getTheOfflineFile(); logger.debug("retrieved theOfflineFile: " + theOfflineFile); String offlineFileName=""; NodeKey nodeKey=null; + String offlineFileUuid=""; try { InputStream offlineFileInputStream = theOfflineFile.getInputStream(); @@ -370,7 +370,8 @@ logger.debug("retrieved offlineFileName: " + offlineFileName); nodeKey=qaService.uploadFileToRepository(offlineFileInputStream, offlineFileName); logger.debug("repository returned nodeKey: " + nodeKey); - logger.debug("repository returned nodeKey uuid: " + nodeKey.getUuid()); + logger.debug("repository returned offlineFileUuid nodeKey uuid: " + nodeKey.getUuid()); + offlineFileUuid=nodeKey.getUuid().toString(); } catch(FileNotFoundException e) { @@ -387,6 +388,42 @@ logger.debug("exception occured in accessing the repository server: " + e.getMessage()); //possibly give warning to user in request scope } + + /** read uploaded file informtion - online file*/ + logger.debug("retrieve theOnlineFile"); + FormFile theOnlineFile = qaAuthoringForm.getTheOnlineFile(); + logger.debug("retrieved theOnlineFile: " + theOnlineFile); + + String onlineFileName=""; + nodeKey=null; + String onlineFileUuid=""; + try + { + InputStream onlineFileInputStream = theOnlineFile.getInputStream(); + logger.debug("retrieved onlineFileInputStream: " + onlineFileInputStream); + onlineFileName=theOnlineFile.getFileName(); + logger.debug("retrieved onlineFileName: " + onlineFileName); + nodeKey=qaService.uploadFileToRepository(onlineFileInputStream, onlineFileName); + logger.debug("repository returned nodeKey: " + nodeKey); + logger.debug("repository returned onlineFileUuid nodeKey uuid: " + nodeKey.getUuid()); + onlineFileUuid=nodeKey.getUuid().toString(); + } + catch(FileNotFoundException e) + { + logger.debug("exception occured, online file not found : " + e.getMessage()); + //possibly give warning to user in request scope + } + catch(IOException e) + { + logger.debug("exception occured in online 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); @@ -422,9 +459,13 @@ logger.debug("qa created with content id: " + toolContentId); logger.debug("start persisting offline file information to db..."); - qaService.persistFile(nodeKey.getUuid().toString(),false, offlineFileName,qa); - logger.debug("successfully persisted file info"); - + qaService.persistFile(offlineFileUuid,false, offlineFileName,qa); + logger.debug("successfully persisted offline file info"); + + logger.debug("start persisting online file information to db..."); + qaService.persistFile(onlineFileUuid,true, onlineFileName,qa); + logger.debug("successfully persisted online file info"); + return qa; } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java =================================================================== diff -u -rcf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c -ra4b9dfe6935887930d266eedb191089ea52914cc --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java (.../QaAuthoringForm.java) (revision cf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java (.../QaAuthoringForm.java) (revision a4b9dfe6935887930d266eedb191089ea52914cc) @@ -28,6 +28,7 @@ protected String submitAllContent; protected String submitTabDone; protected String submitOfflineFile; + protected String submitOnlineFile; /** tab controller, these may go away once the Flash wraps the jsp */ protected String choice; @@ -71,6 +72,7 @@ this.submitAllContent=null; this.submitTabDone=null; this.submitOfflineFile=null; + this.submitOnlineFile=null; this.summaryMonitoring=null; this.instructionsMonitoring=null; @@ -87,6 +89,7 @@ this.submitAllContent=null; this.submitTabDone=null; this.submitOfflineFile=null; + this.submitOnlineFile=null; this.choice=null; this.choiceBasic=null; @@ -488,4 +491,16 @@ public FormFile getTheOnlineFile() { return theOnlineFile; } + /** + * @return Returns the submitOnlineFile. + */ + public String getSubmitOnlineFile() { + return submitOnlineFile; + } + /** + * @param submitOnlineFile The submitOnlineFile to set. + */ + public void setSubmitOnlineFile(String submitOnlineFile) { + this.submitOnlineFile = submitOnlineFile; + } } Index: lams_tool_laqa/web/BasicContent.jsp =================================================================== diff -u -rcf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c -ra4b9dfe6935887930d266eedb191089ea52914cc --- lams_tool_laqa/web/BasicContent.jsp (.../BasicContent.jsp) (revision cf64c7ef2a5b0d6dd1edc1b20f742e1b4523559c) +++ lams_tool_laqa/web/BasicContent.jsp (.../BasicContent.jsp) (revision a4b9dfe6935887930d266eedb191089ea52914cc) @@ -6,7 +6,6 @@ <%@ taglib uri="fck-editor" prefix="FCK" %>
- online upload
+ |
+