Index: lams_tool_chat/.classpath =================================================================== diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/.classpath (.../.classpath) (revision ed16d5f8991580c9160628f30a49e947a0b154bb) +++ lams_tool_chat/.classpath (.../.classpath) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -3,12 +3,9 @@ - - - - + Index: lams_tool_chat/.mymetadata =================================================================== diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/.mymetadata (.../.mymetadata) (revision ed16d5f8991580c9160628f30a49e947a0b154bb) +++ lams_tool_chat/.mymetadata (.../.mymetadata) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -6,7 +6,7 @@ j2ee-spec="1.4" archive="lams_tool_chat.war"> - + Index: lams_tool_chat/.settings/org.eclipse.jdt.core.prefs =================================================================== diff -u --- lams_tool_chat/.settings/org.eclipse.jdt.core.prefs (revision 0) +++ lams_tool_chat/.settings/org.eclipse.jdt.core.prefs (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -0,0 +1,12 @@ +#Tue Apr 04 10:46:08 EST 2006 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 Index: lams_tool_chat/build.xml =================================================================== diff -u -rad683fcaeabe83c702b599c5c866bb7d30cd7191 -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/build.xml (.../build.xml) (revision ad683fcaeabe83c702b599c5c866bb7d30cd7191) +++ lams_tool_chat/build.xml (.../build.xml) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -85,6 +85,7 @@ + @@ -201,7 +202,7 @@ - + Fisheye: Tag b32ded72d955763a9b49e33e2dc2ab195d83564b refers to a dead (removed) revision in file `lams_tool_chat/conf/hibernate/mappings/org/lamsfoundation/lams/tool/chat/Chat.hbm.xml'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b32ded72d955763a9b49e33e2dc2ab195d83564b refers to a dead (removed) revision in file `lams_tool_chat/conf/hibernate/mappings/org/lamsfoundation/lams/tool/chat/ChatAttachment.hbm.xml'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b32ded72d955763a9b49e33e2dc2ab195d83564b refers to a dead (removed) revision in file `lams_tool_chat/conf/hibernate/mappings/org/lamsfoundation/lams/tool/chat/ChatSession.hbm.xml'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b32ded72d955763a9b49e33e2dc2ab195d83564b refers to a dead (removed) revision in file `lams_tool_chat/conf/hibernate/mappings/org/lamsfoundation/lams/tool/chat/ChatUser.hbm.xml'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_chat/conf/hibernate/mappings/org/lamsfoundation/lams/tool/chat/model/Chat.hbm.xml =================================================================== diff -u --- lams_tool_chat/conf/hibernate/mappings/org/lamsfoundation/lams/tool/chat/model/Chat.hbm.xml (revision 0) +++ lams_tool_chat/conf/hibernate/mappings/org/lamsfoundation/lams/tool/chat/model/Chat.hbm.xml (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_chat/conf/hibernate/mappings/org/lamsfoundation/lams/tool/chat/model/ChatAttachment.hbm.xml =================================================================== diff -u --- lams_tool_chat/conf/hibernate/mappings/org/lamsfoundation/lams/tool/chat/model/ChatAttachment.hbm.xml (revision 0) +++ lams_tool_chat/conf/hibernate/mappings/org/lamsfoundation/lams/tool/chat/model/ChatAttachment.hbm.xml (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_chat/conf/hibernate/mappings/org/lamsfoundation/lams/tool/chat/model/ChatSession.hbm.xml =================================================================== diff -u --- lams_tool_chat/conf/hibernate/mappings/org/lamsfoundation/lams/tool/chat/model/ChatSession.hbm.xml (revision 0) +++ lams_tool_chat/conf/hibernate/mappings/org/lamsfoundation/lams/tool/chat/model/ChatSession.hbm.xml (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_chat/conf/hibernate/mappings/org/lamsfoundation/lams/tool/chat/model/ChatUser.hbm.xml =================================================================== diff -u --- lams_tool_chat/conf/hibernate/mappings/org/lamsfoundation/lams/tool/chat/model/ChatUser.hbm.xml (revision 0) +++ lams_tool_chat/conf/hibernate/mappings/org/lamsfoundation/lams/tool/chat/model/ChatUser.hbm.xml (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_chat/conf/language/ApplicationResources.properties =================================================================== diff -u -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2 -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2) +++ lams_tool_chat/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -20,9 +20,13 @@ button.upload=Upload # Basic Page -basic.title=Title: -basic.content=Content: +label.authoring.basic.title=Title: +label.authoring.basic.content=Content: +label.authoring.basic.instructions=Intructions: +#Advanced Page +advanced.lockOnFinished= Lock on Finish + #Instructions Page instructions.onlineInstructions=Online Instructions: instructions.offlineInstructions=Offline Instructions: @@ -38,6 +42,9 @@ link.download=Download link.delete=Delete +message.updateSuccess=Changes saved +message.unsavedChanges=Page contains unsaved changes + # ========== Learner Page ========== pageTitle.Learning=Learning @@ -52,7 +59,6 @@ button.editActivity=Edit Activity button.statistics=Statistics - titleHeading.summary=Summary titleHeading.instructions=Instructions titleHeading.statistics=Statistics @@ -74,10 +80,22 @@ button.finish=Finish button.next=Next +# ========= FCKEditor Labels ============ +label.save=Save +label.cancel=Cancel + # ========== Error/Exception Messages ========== -error.mandatoryField={0} field is mandatory. error.missingParam=Unable to continue. {0} is missing. error.exceedMaxFileSize=File size exceeded error.exception.NbApplication=An internal error has occured with the Chat Tool. If reporting this error, please report:
{0} error.contentrepository=An error has occurred when saving/deleting instruction file {0}. The files may not be saved correctly. + +# ========= Standard Error Messages ========= + +error.content.locked=The content has been locked since it is being used by one or more learners. The modification of the content is not allowed. +error.defineLater=Sorry, the activity is not ready yet. Please wait for the teacher to finishing defining the activity. +errors.maxfilesize=The uploaded file has exceeded the maximum file size limit of {0} bytes +error.mandatoryField={0} field is mandatory. +error.mark.invalid.number={0} field must be a valid number. Decimal points are not allowed. +error.mark.invalid.decimal.number={0} field must be a valid decimal number. \ No newline at end of file Index: lams_tool_chat/conf/xdoclet/servlet-mappings.xml =================================================================== diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/conf/xdoclet/servlet-mappings.xml (.../servlet-mappings.xml) (revision ed16d5f8991580c9160628f30a49e947a0b154bb) +++ lams_tool_chat/conf/xdoclet/servlet-mappings.xml (.../servlet-mappings.xml) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -9,3 +9,8 @@ /fckeditor/editor/filemanager/browser/default/connectors/jsp/connector + + download + /download/* + + Index: lams_tool_chat/conf/xdoclet/servlets.xml =================================================================== diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/conf/xdoclet/servlets.xml (.../servlets.xml) (revision ed16d5f8991580c9160628f30a49e947a0b154bb) +++ lams_tool_chat/conf/xdoclet/servlets.xml (.../servlets.xml) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -5,41 +5,54 @@ - action - org.apache.struts.action.ActionServlet - - config - /WEB-INF/struts/struts-config.xml - - - debug - 999 - - - detail - 2 - - - validate - true - - 1 + action + org.apache.struts.action.ActionServlet + + config + /WEB-INF/struts/struts-config.xml + + + debug + 999 + + + detail + 2 + + + validate + true + + 1 - Connector - com.fredck.FCKeditor.connector.ConnectorServlet - - baseDir - /UserFiles/ - - - debug - false - - 1 + Connector + com.fredck.FCKeditor.connector.ConnectorServlet + + baseDir + /UserFiles/ + + + debug + false + + 1 + + + Attachment Download + Attachment Download + download + org.lamsfoundation.lams.contentrepository.client.ToolDownload + + toolContentHandlerBeanName + chatToolContentHandler + + 3 + + Index: lams_tool_chat/conf/xdoclet/struts-forms.xml =================================================================== diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/conf/xdoclet/struts-forms.xml (.../struts-forms.xml) (revision ed16d5f8991580c9160628f30a49e947a0b154bb) +++ lams_tool_chat/conf/xdoclet/struts-forms.xml (.../struts-forms.xml) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -1 +1 @@ + Index: lams_tool_chat/conf/xdoclet/struts-message-resources.xml =================================================================== diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/conf/xdoclet/struts-message-resources.xml (.../struts-message-resources.xml) (revision ed16d5f8991580c9160628f30a49e947a0b154bb) +++ lams_tool_chat/conf/xdoclet/struts-message-resources.xml (.../struts-message-resources.xml) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file Index: lams_tool_chat/conf/xdoclet/web-settings.xml =================================================================== diff -u -rad683fcaeabe83c702b599c5c866bb7d30cd7191 -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/conf/xdoclet/web-settings.xml (.../web-settings.xml) (revision ad683fcaeabe83c702b599c5c866bb7d30cd7191) +++ lams_tool_chat/conf/xdoclet/web-settings.xml (.../web-settings.xml) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -2,7 +2,7 @@ javax.servlet.jsp.jstl.fmt.localizationContext - org.lamsfoundation.lams.applicationResources + org.lamsfoundation.lams.tool.chat.ApplicationResources Index: lams_tool_chat/db/sql/activity_insert.sql =================================================================== diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/db/sql/activity_insert.sql (.../activity_insert.sql) (revision ed16d5f8991580c9160628f30a49e947a0b154bb) +++ lams_tool_chat/db/sql/activity_insert.sql (.../activity_insert.sql) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -76,5 +76,5 @@ , NULL , NULL , NULL -, 'org.lamsfoundation.lams.tool.chat.web.ApplicationResources' +, 'org.lamsfoundation.lams.tool.chat.ApplicationResources' ) Index: lams_tool_chat/db/sql/tool_insert.sql =================================================================== diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/db/sql/tool_insert.sql (.../tool_insert.sql) (revision ed16d5f8991580c9160628f30a49e947a0b154bb) +++ lams_tool_chat/db/sql/tool_insert.sql (.../tool_insert.sql) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -49,6 +49,6 @@ 'tool/lachat11/exportPortfolio?mode=teacher', 'tool/lachat11/contribute.do', 'tool/lachat11/moderate.do', -'org.lamsfoundation.lams.tool.chat.web.ApplicationResources', +'org.lamsfoundation.lams.tool.chat.ApplicationResources', NOW() ) Fisheye: Tag b32ded72d955763a9b49e33e2dc2ab195d83564b refers to a dead (removed) revision in file `lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/Chat.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b32ded72d955763a9b49e33e2dc2ab195d83564b refers to a dead (removed) revision in file `lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/ChatAttachment.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b32ded72d955763a9b49e33e2dc2ab195d83564b refers to a dead (removed) revision in file `lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/ChatSession.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b32ded72d955763a9b49e33e2dc2ab195d83564b refers to a dead (removed) revision in file `lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/ChatUser.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/beans/AuthoringSessionBean.java =================================================================== diff -u --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/beans/AuthoringSessionBean.java (revision 0) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/beans/AuthoringSessionBean.java (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -0,0 +1,198 @@ +/**************************************************************** + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ + +package org.lamsfoundation.lams.tool.chat.beans; + +import java.util.LinkedList; +import java.util.List; + +import org.apache.struts.upload.FormFile; +import org.lamsfoundation.lams.tool.chat.model.ChatAttachment; + +public class AuthoringSessionBean { + String authSessionId; + + Long toolContentID; + + // properties updated every request/response + String title; + + String instructions; + + String offlineInstruction; + + String onlineInstruction; + + String lockOnFinished; + + FormFile onlineFile; + + FormFile offlineFile; + + String currentTab; + + String dispatch; + + // properties maintained over multiple requests. + + List onlineFilesList = new LinkedList(); + + List offlineFilesList = new LinkedList(); + + List unsavedOnlineFilesList = new LinkedList(); + + List unsavedOfflineFilesList = new LinkedList(); + + List deletedFilesList = new LinkedList(); + + // getters / setters + public String getAuthSessionId() { + return authSessionId; + } + + public void setAuthSessionId(String authSessionId) { + this.authSessionId = authSessionId; + } + + public String getCurrentTab() { + return currentTab; + } + + public void setCurrentTab(String currentTab) { + this.currentTab = currentTab; + } + + public List getDeletedFilesList() { + return deletedFilesList; + } + + public void setDeletedFilesList(List deletedFilesList) { + this.deletedFilesList = deletedFilesList; + } + + public String getDispatch() { + return dispatch; + } + + public void setDispatch(String dispatch) { + this.dispatch = dispatch; + } + + public String getInstructions() { + return instructions; + } + + public void setInstructions(String instructions) { + this.instructions = instructions; + } + + public String getLockOnFinished() { + return lockOnFinished; + } + + public void setLockOnFinished(String lockOnFinished) { + this.lockOnFinished = lockOnFinished; + } + + public FormFile getOfflineFile() { + return offlineFile; + } + + public void setOfflineFile(FormFile offlineFile) { + this.offlineFile = offlineFile; + } + + public List getOfflineFilesList() { + return offlineFilesList; + } + + public void setOfflineFilesList(List offlineFilesList) { + this.offlineFilesList = offlineFilesList; + } + + public String getOfflineInstruction() { + return offlineInstruction; + } + + public void setOfflineInstruction(String offlineInstruction) { + this.offlineInstruction = offlineInstruction; + } + + public FormFile getOnlineFile() { + return onlineFile; + } + + public void setOnlineFile(FormFile onlineFile) { + this.onlineFile = onlineFile; + } + + public List getOnlineFilesList() { + return onlineFilesList; + } + + public void setOnlineFilesList(List onlineFilesList) { + this.onlineFilesList = onlineFilesList; + } + + public String getOnlineInstruction() { + return onlineInstruction; + } + + public void setOnlineInstruction(String onlineInstruction) { + this.onlineInstruction = onlineInstruction; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Long getToolContentID() { + return toolContentID; + } + + public void setToolContentID(Long toolContentID) { + this.toolContentID = toolContentID; + } + + public List getUnsavedOfflineFilesList() { + return unsavedOfflineFilesList; + } + + public void setUnsavedOfflineFilesList(List unsavedOfflineFilesList) { + this.unsavedOfflineFilesList = unsavedOfflineFilesList; + } + + public List getUnsavedOnlineFilesList() { + return unsavedOnlineFilesList; + } + + public void setUnsavedOnlineFilesList(List unsavedOnlineFilesList) { + this.unsavedOnlineFilesList = unsavedOnlineFilesList; + } +} Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/chatApplicationContext.xml =================================================================== diff -u -ra439ae1667c31323c5c4176727616cc8191ec367 -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/chatApplicationContext.xml (.../chatApplicationContext.xml) (revision a439ae1667c31323c5c4176727616cc8191ec367) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/chatApplicationContext.xml (.../chatApplicationContext.xml) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -15,10 +15,10 @@ - org/lamsfoundation/lams/tool/chat/Chat.hbm.xml - org/lamsfoundation/lams/tool/chat/ChatSession.hbm.xml - org/lamsfoundation/lams/tool/chat/ChatUser.hbm.xml - org/lamsfoundation/lams/tool/chat/ChatAttachment.hbm.xml + org/lamsfoundation/lams/tool/chat/model/Chat.hbm.xml + org/lamsfoundation/lams/tool/chat/model/ChatSession.hbm.xml + org/lamsfoundation/lams/tool/chat/model/ChatUser.hbm.xml + org/lamsfoundation/lams/tool/chat/model/ChatAttachment.hbm.xml Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatDAO.java =================================================================== diff -u -r57a8fd80863308a6aae133850dbe2de4acd15abf -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatDAO.java (.../IChatDAO.java) (revision 57a8fd80863308a6aae133850dbe2de4acd15abf) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatDAO.java (.../IChatDAO.java) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -24,7 +24,7 @@ package org.lamsfoundation.lams.tool.chat.dao; import org.lamsfoundation.lams.dao.IBaseDAO; -import org.lamsfoundation.lams.tool.chat.Chat; +import org.lamsfoundation.lams.tool.chat.model.Chat; /** * DAO for accessing the Chat objects - interface defining @@ -36,4 +36,6 @@ void saveOrUpdate(Chat toContent); + void deleteInstructionFile(Long toolContentId, Long uuid, Long versionId, String type); + } \ No newline at end of file Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatSessionDAO.java =================================================================== diff -u -r57a8fd80863308a6aae133850dbe2de4acd15abf -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatSessionDAO.java (.../IChatSessionDAO.java) (revision 57a8fd80863308a6aae133850dbe2de4acd15abf) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatSessionDAO.java (.../IChatSessionDAO.java) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -24,7 +24,7 @@ package org.lamsfoundation.lams.tool.chat.dao; import org.lamsfoundation.lams.dao.IBaseDAO; -import org.lamsfoundation.lams.tool.chat.ChatSession; +import org.lamsfoundation.lams.tool.chat.model.ChatSession; /** * DAO for accessing the ChatSession objects - interface defining Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatDAO.java =================================================================== diff -u -r57a8fd80863308a6aae133850dbe2de4acd15abf -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatDAO.java (.../ChatDAO.java) (revision 57a8fd80863308a6aae133850dbe2de4acd15abf) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatDAO.java (.../ChatDAO.java) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -25,20 +25,28 @@ import java.util.List; +import org.hibernate.FlushMode; import org.lamsfoundation.lams.dao.hibernate.BaseDAO; -import org.lamsfoundation.lams.tool.chat.Chat; import org.lamsfoundation.lams.tool.chat.dao.IChatDAO; +import org.lamsfoundation.lams.tool.chat.model.Chat; +import org.lamsfoundation.lams.tool.chat.model.ChatAttachment; +import org.springframework.orm.hibernate3.HibernateTemplate; /** * DAO for accessing the Chat objects - Hibernate specific code. */ public class ChatDAO extends BaseDAO implements IChatDAO { private static final String FIND_FORUM_BY_CONTENTID = "from Chat chat where chat.toolContentId=?"; - + + private static final String FIND_INSTRUCTION_FILE = "from " + + ChatAttachment.class.getName() + + " as i where tool_content_id=? and i.file_uuid=? and i.file_version_id=? and i.file_type=?"; + public Chat getByContentId(Long toolContentId) { - List list = getHibernateTemplate().find(FIND_FORUM_BY_CONTENTID,toolContentId); - if(list != null && list.size() > 0) + List list = getHibernateTemplate().find(FIND_FORUM_BY_CONTENTID, + toolContentId); + if (list != null && list.size() > 0) return (Chat) list.get(0); else return null; @@ -48,4 +56,22 @@ this.getHibernateTemplate().saveOrUpdate(chat); this.getHibernateTemplate().flush(); } + + public void deleteInstructionFile(Long toolContentId, Long uuid, + Long versionId, String type) { + HibernateTemplate templ = this.getHibernateTemplate(); + if (toolContentId != null && uuid != null && versionId != null) { + List list = getSession().createQuery(FIND_INSTRUCTION_FILE) + .setLong(0, toolContentId.longValue()).setLong(1, + uuid.longValue()).setLong(2, versionId.longValue()) + .setString(3, type).list(); + if (list != null && list.size() > 0) { + ChatAttachment file = (ChatAttachment) list.get(0); + this.getSession().setFlushMode(FlushMode.AUTO); + templ.delete(file); + templ.flush(); + } + } + + } } Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatSessionDAO.java =================================================================== diff -u -r57a8fd80863308a6aae133850dbe2de4acd15abf -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatSessionDAO.java (.../ChatSessionDAO.java) (revision 57a8fd80863308a6aae133850dbe2de4acd15abf) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatSessionDAO.java (.../ChatSessionDAO.java) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -26,7 +26,7 @@ import java.util.List; import org.lamsfoundation.lams.dao.hibernate.BaseDAO; -import org.lamsfoundation.lams.tool.chat.ChatSession; +import org.lamsfoundation.lams.tool.chat.model.ChatSession; import org.lamsfoundation.lams.tool.chat.dao.IChatSessionDAO; /** Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/Chat.java =================================================================== diff -u --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/Chat.java (revision 0) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/Chat.java (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -0,0 +1,388 @@ +/**************************************************************** + * 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ +/* $$Id$$ */ +package org.lamsfoundation.lams.tool.chat.model; + +import java.util.Date; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; +import org.lamsfoundation.lams.tool.chat.service.ChatService; + +/** + * @hibernate.class table="tl_lachat11_chat" + */ + +public class Chat implements java.io.Serializable, Cloneable { + + /** + * + */ + private static final long serialVersionUID = 579733009969321015L; + + static Logger log = Logger.getLogger(ChatService.class.getName()); + + // Fields + /** + * + */ + private Long uid; + + private Date createDate; + + private Date updateDate; + + private Long createBy; + + private String title; + + private String instructions; + + private Boolean runOffline; + + private Boolean lockOnFinished; + + private String onlineInstructions; + + private String offlineInstructions; + + private Boolean contentInUse; + + private Boolean defineLater; + + private Long toolContentId; + + private Set chatAttachments; + + private Set chatSessions; + + private IToolContentHandler toolContentHandler; + + // Constructors + + /** default constructor */ + public Chat() { + } + + /** full constructor */ + public Chat(Date createDate, Date updateDate, Long createBy, String title, + String instructions, Boolean runOffline, Boolean lockOnFinished, + String onlineInstructions, String offlineInstructions, + Boolean contentInUse, Boolean defineLater, Long toolContentId, + Set chatAttachments, Set chatSessions) { + this.createDate = createDate; + this.updateDate = updateDate; + this.createBy = createBy; + this.title = title; + this.instructions = instructions; + this.runOffline = runOffline; + this.lockOnFinished = lockOnFinished; + this.onlineInstructions = onlineInstructions; + this.offlineInstructions = offlineInstructions; + this.contentInUse = contentInUse; + this.defineLater = defineLater; + this.toolContentId = toolContentId; + this.chatAttachments = chatAttachments; + this.chatSessions = chatSessions; + } + + // Property accessors + /** + * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" + * + */ + + public Long getUid() { + return this.uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + /** + * @hibernate.property column="create_date" + * + */ + + public Date getCreateDate() { + return this.createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + /** + * @hibernate.property column="update_date" + * + */ + + public Date getUpdateDate() { + return this.updateDate; + } + + public void setUpdateDate(Date updateDate) { + this.updateDate = updateDate; + } + + /** + * @hibernate.property column="create_by" length="20" + * + */ + + public Long getCreateBy() { + return this.createBy; + } + + public void setCreateBy(Long createBy) { + this.createBy = createBy; + } + + /** + * @hibernate.property column="title" length="255" + * + */ + + public String getTitle() { + return this.title; + } + + public void setTitle(String title) { + this.title = title; + } + + /** + * @hibernate.property column="instructions" length="65535" + * + */ + + public String getInstructions() { + return this.instructions; + } + + public void setInstructions(String instructions) { + this.instructions = instructions; + } + + /** + * @hibernate.property column="run_offline" length="1" + * + */ + + public Boolean getRunOffline() { + return this.runOffline; + } + + public void setRunOffline(Boolean runOffline) { + this.runOffline = runOffline; + } + + /** + * @hibernate.property column="lock_on_finished" length="1" + * + */ + + public Boolean getLockOnFinished() { + return this.lockOnFinished; + } + + public void setLockOnFinished(Boolean lockOnFinished) { + this.lockOnFinished = lockOnFinished; + } + + /** + * @hibernate.property column="online_instructions" length="65535" + * + */ + + public String getOnlineInstructions() { + return this.onlineInstructions; + } + + public void setOnlineInstructions(String onlineInstructions) { + this.onlineInstructions = onlineInstructions; + } + + /** + * @hibernate.property column="offline_instructions" length="65535" + * + */ + + public String getOfflineInstructions() { + return this.offlineInstructions; + } + + public void setOfflineInstructions(String offlineInstructions) { + this.offlineInstructions = offlineInstructions; + } + + /** + * @hibernate.property column="content_in_use" length="1" + * + */ + + public Boolean getContentInUse() { + return this.contentInUse; + } + + public void setContentInUse(Boolean contentInUse) { + this.contentInUse = contentInUse; + } + + /** + * @hibernate.property column="define_later" length="1" + * + */ + + public Boolean getDefineLater() { + return this.defineLater; + } + + public void setDefineLater(Boolean defineLater) { + this.defineLater = defineLater; + } + + /** + * @hibernate.property column="tool_content_id" length="20" + * + */ + + public Long getToolContentId() { + return this.toolContentId; + } + + public void setToolContentId(Long toolContentId) { + this.toolContentId = toolContentId; + } + + /** + * @hibernate.set lazy="false" inverse="false" cascade="all-delete-orphan" + * @hibernate.collection-key column="chat_uid" + * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.chat.model.ChatAttachment" + * + */ + + public Set getChatAttachments() { + return this.chatAttachments; + } + + public void setChatAttachments(Set chatAttachments) { + this.chatAttachments = chatAttachments; + } + + /** + * @hibernate.set lazy="true" inverse="true" cascade="none" + * @hibernate.collection-key column="chat_uid" + * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.chat.model.ChatSession" + * + */ + + public Set getChatSessions() { + return this.chatSessions; + } + + public void setChatSessions(Set chatSessions) { + this.chatSessions = chatSessions; + } + + /** + * toString + * + * @return String + */ + public String toString() { + StringBuffer buffer = new StringBuffer(); + + buffer.append(getClass().getName()).append("@").append( + Integer.toHexString(hashCode())).append(" ["); + buffer.append("title").append("='").append(getTitle()).append("' "); + buffer.append("instructions").append("='").append(getInstructions()) + .append("' "); + buffer.append("toolContentId").append("='").append(getToolContentId()) + .append("' "); + buffer.append("]"); + + return buffer.toString(); + } + + public boolean equals(Object other) { + if ((this == other)) + return true; + if ((other == null)) + return false; + if (!(other instanceof Chat)) + return false; + Chat castOther = (Chat) other; + + return ((this.getUid() == castOther.getUid()) || (this.getUid() != null + && castOther.getUid() != null && this.getUid().equals( + castOther.getUid()))); + } + + public int hashCode() { + int result = 17; + result = 37 * result + + (getUid() == null ? 0 : this.getUid().hashCode()); + return result; + } + + public static Chat newInstance(Chat fromContent, Long contentId, + IToolContentHandler chatToolContentHandler) { + Chat toContent = new Chat(); + fromContent.toolContentHandler = chatToolContentHandler; + toContent = (Chat) fromContent.clone(); + toContent.setToolContentId(contentId); + return toContent; + } + + protected Object clone() { + + Chat chat = null; + try { + chat = (Chat) super.clone(); + chat.setUid(null); + + if (chatAttachments != null) { + // create a copy of the attachments + Iterator iter = chatAttachments.iterator(); + Set set = new HashSet(); + while (iter.hasNext()) { + ChatAttachment originalFile = (ChatAttachment) iter.next(); + ChatAttachment newFile = (ChatAttachment) originalFile.clone(); + set.add(newFile); + } + chat.chatAttachments = set; + } + // create an empty set for the chatSession + chat.chatSessions = new HashSet(); + + } catch (CloneNotSupportedException e) { + log.error("Error cloning " + Chat.class); + } + return chat; + } +} Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/ChatAttachment.java =================================================================== diff -u --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/ChatAttachment.java (revision 0) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/ChatAttachment.java (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -0,0 +1,230 @@ +/**************************************************************** + * 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ +/* $$Id$$ */ +package org.lamsfoundation.lams.tool.chat.model; + +import java.util.Date; + +import org.apache.log4j.Logger; + +/** + * + * The details of files attached to the tool. In most cases this will be the + * online/offline instruction files. + * + * @hibernate.class table="tl_lachat11_attachment" + * + */ + +public class ChatAttachment implements java.io.Serializable, Cloneable { + + + + /** + * + */ + private static final long serialVersionUID = 47452859888067500L; + + private static final Logger log = Logger.getLogger(ChatAttachment.class); + + /** + * + */ + private Long uid; + + private Long fileVersionId; + + private String fileType; + + private String fileName; + + private Long fileUuid; + + private Date createDate; + + private Chat chat; + + // Constructors + + /** default constructor */ + public ChatAttachment() { + } + + /** full constructor */ + public ChatAttachment(Long fileVersionId, String fileType, String fileName, + Long fileUuid, Date createDate, Chat chat) { + this.fileVersionId = fileVersionId; + this.fileType = fileType; + this.fileName = fileName; + this.fileUuid = fileUuid; + this.createDate = createDate; + this.chat = chat; + } + + // Property accessors + /** + * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" + * + */ + + public Long getUid() { + return this.uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + /** + * @hibernate.property column="file_version_id" length="20" + * + */ + + public Long getFileVersionId() { + return this.fileVersionId; + } + + public void setFileVersionId(Long fileVersionId) { + this.fileVersionId = fileVersionId; + } + + /** + * @hibernate.property column="file_type" length="255" + * + */ + + public String getFileType() { + return this.fileType; + } + + public void setFileType(String fileType) { + this.fileType = fileType; + } + + /** + * @hibernate.property column="file_name" length="255" + * + */ + + public String getFileName() { + return this.fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + /** + * @hibernate.property column="file_uuid" length="20" + * + */ + + public Long getFileUuid() { + return this.fileUuid; + } + + public void setFileUuid(Long fileUuid) { + this.fileUuid = fileUuid; + } + + /** + * @hibernate.property column="create_date" + * + */ + + public Date getCreateDate() { + return this.createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + /** + * @hibernate.many-to-one not-null="true" + * @hibernate.column name="chat_uid" + * + */ + + public Chat getChat() { + return this.chat; + } + + public void setChat(Chat chat) { + this.chat = chat; + } + + /** + * toString + * + * @return String + */ + public String toString() { + StringBuffer buffer = new StringBuffer(); + + buffer.append(getClass().getName()).append("@").append( + Integer.toHexString(hashCode())).append(" ["); + buffer.append("fileVersionId").append("='").append(getFileVersionId()) + .append("' "); + buffer.append("fileName").append("='").append(getFileName()).append( + "' "); + buffer.append("fileUuid").append("='").append(getFileUuid()).append( + "' "); + buffer.append("]"); + + return buffer.toString(); + } + + public boolean equals(Object other) { + if ((this == other)) + return true; + if ((other == null)) + return false; + if (!(other instanceof ChatAttachment)) + return false; + ChatAttachment castOther = (ChatAttachment) other; + + return ((this.getUid() == castOther.getUid()) || (this.getUid() != null + && castOther.getUid() != null && this.getUid().equals( + castOther.getUid()))); + } + + public int hashCode() { + int result = 17; + result = 37 * result + + (getUid() == null ? 0 : this.getUid().hashCode()); + return result; + } + + public Object clone() { + Object obj = null; + try { + obj = super.clone(); + ((ChatAttachment) obj).setUid(null); + } catch (CloneNotSupportedException e) { + log.error("Failed to clone " + ChatAttachment.class); + } + + return obj; + } +} Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/ChatSession.java =================================================================== diff -u --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/ChatSession.java (revision 0) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/ChatSession.java (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -0,0 +1,248 @@ +/**************************************************************** + * 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ +/* $$Id$$ */ +package org.lamsfoundation.lams.tool.chat.model; + +import java.util.Date; +import java.util.HashSet; +import java.util.Set; + +import org.apache.log4j.Logger; + +/** + * + * Represents the tool session. + * + * @hibernate.class table="tl_lachat11_session" + */ + +public class ChatSession implements java.io.Serializable { + + private static Logger log = Logger.getLogger(ChatSession.class); + /** + * + */ + private static final long serialVersionUID = 4407078136514639026L; + + // Fields + private Long uid; + + private Date sessionEndDate; + + private Date sessionStartDate; + + private Integer status; + + private Long sessionId; + + private String sessionName; + + private Chat chat; + + private Set chatUsers = new HashSet(0); + + // Constructors + + /** default constructor */ + public ChatSession() { + } + + /** full constructor */ + public ChatSession(Date sessionEndDate, Date sessionStartDate, + Integer status, Long sessionId, String sessionName, Chat chat, + Set chatUsers) { + this.sessionEndDate = sessionEndDate; + this.sessionStartDate = sessionStartDate; + this.status = status; + this.sessionId = sessionId; + this.sessionName = sessionName; + this.chat = chat; + this.chatUsers = chatUsers; + } + + // Property accessors + /** + * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" + * + */ + + public Long getUid() { + return this.uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + /** + * @hibernate.property column="session_end_date" + * + */ + + public Date getSessionEndDate() { + return this.sessionEndDate; + } + + public void setSessionEndDate(Date sessionEndDate) { + this.sessionEndDate = sessionEndDate; + } + + /** + * @hibernate.property column="session_start_date" + * + */ + + public Date getSessionStartDate() { + return this.sessionStartDate; + } + + public void setSessionStartDate(Date sessionStartDate) { + this.sessionStartDate = sessionStartDate; + } + + /** + * @hibernate.property column="status" length="11" + * + */ + + public Integer getStatus() { + return this.status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + /** + * @hibernate.property column="session_id" length="20" + * + */ + + public Long getSessionId() { + return this.sessionId; + } + + public void setSessionId(Long sessionId) { + this.sessionId = sessionId; + } + + /** + * @hibernate.property column="session_name" length="250" + * + */ + + public String getSessionName() { + return this.sessionName; + } + + public void setSessionName(String sessionName) { + this.sessionName = sessionName; + } + + /** + * @hibernate.many-to-one not-null="true" + * @hibernate.column name="chat_uid" + * + */ + + public Chat getChat() { + return this.chat; + } + + public void setChat(Chat chat) { + this.chat = chat; + } + + /** + * @hibernate.set lazy="true" inverse="true" cascade="none" + * @hibernate.collection-key column="session_id" + * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.chat.model.ChatUser" + * + */ + + public Set getChatUsers() { + return this.chatUsers; + } + + public void setChatUsers(Set chatUsers) { + this.chatUsers = chatUsers; + } + + /** + * toString + * + * @return String + */ + public String toString() { + StringBuffer buffer = new StringBuffer(); + + buffer.append(getClass().getName()).append("@").append( + Integer.toHexString(hashCode())).append(" ["); + buffer.append("sessionEndDate").append("='") + .append(getSessionEndDate()).append("' "); + buffer.append("sessionStartDate").append("='").append( + getSessionStartDate()).append("' "); + buffer.append("status").append("='").append(getStatus()).append("' "); + buffer.append("sessionId").append("='").append(getSessionId()).append( + "' "); + buffer.append("sessionName").append("='").append(getSessionName()) + .append("' "); + buffer.append("]"); + + return buffer.toString(); + } + + public boolean equals(Object other) { + if ((this == other)) + return true; + if ((other == null)) + return false; + if (!(other instanceof ChatSession)) + return false; + ChatSession castOther = (ChatSession) other; + + return ((this.getUid() == castOther.getUid()) || (this.getUid() != null + && castOther.getUid() != null && this.getUid().equals( + castOther.getUid()))); + } + + public int hashCode() { + int result = 17; + result = 37 * result + + (getUid() == null ? 0 : this.getUid().hashCode()); + return result; + } + + public Object clone(){ + + ChatSession session = null; + try{ + session = (ChatSession) super.clone(); + session.chatUsers = new HashSet(); + } catch (CloneNotSupportedException e) { + log.error("When clone " + ChatSession.class + " failed"); + } + return session; + } + +} \ No newline at end of file Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/ChatUser.java =================================================================== diff -u --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/ChatUser.java (revision 0) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/ChatUser.java (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -0,0 +1,174 @@ +/**************************************************************** + * 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ +/* $$Id$$ */ +package org.lamsfoundation.lams.tool.chat.model; + +/** + * + * Caches the user details. This allows the tool to be more efficient at + * displaying user names but means that when people's names change, they + * won't change in the "old" tool data. + * + * @hibernate.class + * table="tl_lachat11_user" + */ + +public class ChatUser implements java.io.Serializable { + + + /** + * + */ + private static final long serialVersionUID = -3701664859818409197L; + // Fields + private Long uid; + private Long userId; + private String lastName; + private String firstName; + private ChatSession chatSession; + + + // Constructors + + /** default constructor */ + public ChatUser() { + } + + + /** full constructor */ + public ChatUser(Long userId, String lastName, String firstName, ChatSession chatSession) { + this.userId = userId; + this.lastName = lastName; + this.firstName = firstName; + this.chatSession = chatSession; + } + + + // Property accessors + /** + * @hibernate.id + * generator-class="native" + * type="java.lang.Long" + * column="uid" + */ + + public Long getUid() { + return this.uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + /** + * @hibernate.property + * column="user_id" + * length="20" + * + */ + + public Long getUserId() { + return this.userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + /** + * @hibernate.property + * column="last_name" + * length="255" + * + */ + + public String getLastName() { + return this.lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + /** + * @hibernate.property + * column="first_name" + * length="255" + * + */ + + public String getFirstName() { + return this.firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + /** + * @hibernate.many-to-one + * not-null="true" + * @hibernate.column name="session_id" + * + */ + + public ChatSession getChatSession() { + return this.chatSession; + } + + public void setChatSession(ChatSession chatSession) { + this.chatSession = chatSession; + } + + + /** + * toString + * @return String + */ + public String toString() { + StringBuffer buffer = new StringBuffer(); + + buffer.append(getClass().getName()).append("@").append(Integer.toHexString(hashCode())).append(" ["); + buffer.append("userId").append("='").append(getUserId()).append("' "); + buffer.append("]"); + + return buffer.toString(); + } + + + public boolean equals(Object other) { + if ( (this == other ) ) return true; + if ( (other == null ) ) return false; + if ( !(other instanceof ChatUser) ) return false; + ChatUser castOther = ( ChatUser ) other; + + return ( (this.getUid()==castOther.getUid()) || ( this.getUid()!=null && castOther.getUid()!=null && this.getUid().equals(castOther.getUid()) ) ); + } + + public int hashCode() { + int result = 17; + result = 37 * result + ( getUid() == null ? 0 : this.getUid().hashCode() ); + return result; + } + + + + + +} \ No newline at end of file Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatService.java =================================================================== diff -u -r57a8fd80863308a6aae133850dbe2de4acd15abf -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatService.java (.../ChatService.java) (revision 57a8fd80863308a6aae133850dbe2de4acd15abf) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatService.java (.../ChatService.java) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -23,22 +23,39 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.chat.service; +import java.io.FileNotFoundException; +import java.io.IOException; import java.util.List; +import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; +import org.apache.struts.upload.FormFile; +import org.lamsfoundation.lams.contentrepository.AccessDeniedException; +import org.lamsfoundation.lams.contentrepository.ICredentials; +import org.lamsfoundation.lams.contentrepository.ITicket; +import org.lamsfoundation.lams.contentrepository.InvalidParameterException; +import org.lamsfoundation.lams.contentrepository.LoginException; +import org.lamsfoundation.lams.contentrepository.NodeKey; +import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException; +import org.lamsfoundation.lams.contentrepository.WorkspaceNotFoundException; import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; +import org.lamsfoundation.lams.contentrepository.service.IRepositoryService; +import org.lamsfoundation.lams.contentrepository.service.RepositoryProxy; +import org.lamsfoundation.lams.contentrepository.service.SimpleCredentials; import org.lamsfoundation.lams.learning.service.ILearnerService; import org.lamsfoundation.lams.tool.ToolContentManager; import org.lamsfoundation.lams.tool.ToolSessionExportOutputData; import org.lamsfoundation.lams.tool.ToolSessionManager; -import org.lamsfoundation.lams.tool.chat.Chat; -import org.lamsfoundation.lams.tool.chat.ChatSession; import org.lamsfoundation.lams.tool.chat.dao.IChatAttachmentDAO; import org.lamsfoundation.lams.tool.chat.dao.IChatDAO; import org.lamsfoundation.lams.tool.chat.dao.IChatSessionDAO; import org.lamsfoundation.lams.tool.chat.dao.IChatUserDAO; +import org.lamsfoundation.lams.tool.chat.model.Chat; +import org.lamsfoundation.lams.tool.chat.model.ChatAttachment; +import org.lamsfoundation.lams.tool.chat.model.ChatSession; import org.lamsfoundation.lams.tool.chat.util.ChatConstants; import org.lamsfoundation.lams.tool.chat.util.ChatException; +import org.lamsfoundation.lams.tool.chat.util.ChatToolContentHandler; import org.lamsfoundation.lams.tool.exception.DataMissingException; import org.lamsfoundation.lams.tool.exception.SessionDataExistsException; import org.lamsfoundation.lams.tool.exception.ToolException; @@ -54,6 +71,8 @@ public class ChatService implements ToolSessionManager, ToolContentManager, IChatService { + static Logger logger = Logger.getLogger(ChatService.class.getName()); + private IChatDAO chatDAO = null; private IChatSessionDAO chatSessionDAO = null; @@ -67,17 +86,24 @@ private ILamsToolService toolService; private IToolContentHandler chatToolContentHandler = null; + + private IRepositoryService repositoryService = null; public ChatService() { super(); // TODO Auto-generated constructor stub } - static Logger log = Logger.getLogger(ChatService.class.getName()); - /* ************ Methods from ToolSessionManager, ToolContentManager ***** */ public void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentId) throws ToolException { + if (logger.isDebugEnabled()) { + logger.debug("entering method createToolSession:" + + " toolSessionId = " + toolSessionId + + " toolSessionName = " + toolSessionName + + " toolContentId = " + toolContentId); + } + ChatSession session = new ChatSession(); session.setSessionId(toolSessionId); session.setSessionName(toolSessionName); @@ -88,15 +114,21 @@ public String leaveToolSession(Long toolSessionId, Long learnerId) throws DataMissingException, ToolException { - + + if(logger.isDebugEnabled()) { + logger.debug("entering method leaveToolSession:" + + " toolSessionId=" + toolSessionId + + " learnerId=" + learnerId); + } + if (toolSessionId == null) { - log + logger .error("Fail to leave tool Session based on null tool session id."); throw new ToolException( "Fail to remove tool Session based on null tool session id."); } if (learnerId == null) { - log.error("Fail to leave tool Session based on null learner."); + logger.error("Fail to leave tool Session based on null learner."); throw new ToolException( "Fail to remove tool Session based on null learner."); } @@ -106,7 +138,7 @@ session.setStatus(ChatConstants.COMPLETED); chatSessionDAO.saveOrUpdate(session); } else { - log.error("Fail to leave tool Session.Could not find submit file " + logger.error("Fail to leave tool Session.Could not find submit file " + "session by given session id: " + toolSessionId); throw new DataMissingException( "Fail to leave tool Session." @@ -136,13 +168,23 @@ public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException { - if (fromContentId == null || toContentId == null) - throw new ToolException( - "Failed to create the SubmitFiles tool seession"); + if (logger.isDebugEnabled()) { + logger.debug("entering method copyToolContent:" + + " fromContentId=" + fromContentId + + " toContentId=" + toContentId); + } + + if (fromContentId == null || toContentId == null) { + String error = "Failed to copy tool content: " + + " fromContentID or toContentID is null"; + throw new ToolException(error); + } + Chat fromContent = chatDAO.getByContentId(fromContentId); if (fromContent == null) { - fromContent = getDefaultContent(fromContentId); + // create the fromContent using the default tool content + fromContent = copyDefaultContent(fromContentId); } Chat toContent = Chat.newInstance(fromContent, toContentId, chatToolContentHandler); @@ -167,30 +209,146 @@ } - /* ********** My Methods ************************************************ */ + /* ********** IChatService Methods ************************************** */ + public Chat copyDefaultContent(Long newContentID) { - private Chat getDefaultContent(Long contentId) { - // TODO This method signature should be added to IChatService - - if (contentId == null) { - String error = "Could not retrieve default content id for Forum tool"; - log.error(error); + if (newContentID == null) { + String error = "Cannot copy the Chat tools default content: + " + + "newContentID is null"; + logger.error(error); throw new ChatException(error); } - Chat defaultContent = getDefaultForum(); - // save default content by given ID. - Chat content = new Chat(); - content = Chat.newInstance(defaultContent, contentId, + Chat defaultContent = getDefaultContent(); + // create new chat using the newContentID + Chat newContent = new Chat(); + newContent = Chat.newInstance(defaultContent, newContentID, chatToolContentHandler); - return null; + chatDAO.saveOrUpdate(newContent); + return newContent; } - private Chat getDefaultForum() { - // TODO Auto-generated method stub - return null; + public Chat getDefaultContent() { + Long defaultContentID = getToolDefaultContentIdBySignature(ChatConstants.TOOL_SIGNATURE); + Chat defaultContent = getChatByContentId(defaultContentID); + if (defaultContent == null) { + String error = "Could not retrieve default content record for this tool"; + logger.error(error); + throw new ChatException(error); + } + return defaultContent; } + public Long getToolDefaultContentIdBySignature(String toolSignature) { + Long toolContentId = null; + toolContentId = new Long(toolService + .getToolDefaultContentIdBySignature(toolSignature)); + if (toolContentId == null) { + String error = "Could not retrieve default content id for this tool"; + logger.error(error); + throw new ChatException(error); + } + return toolContentId; + } + + public Chat getChatByContentId(Long toolContentID) { + Chat chat = (Chat) chatDAO.getByContentId(toolContentID); + if (chat == null) { + logger.info("Could not find the content with toolContentID:" + + toolContentID); + } + return chat; + } + + public ChatAttachment uploadFileToContent(Long toolContentId, FormFile file, String type) { + if(file == null || StringUtils.isEmpty(file.getFileName())) + throw new ChatException("Could not find upload file: " + file); + + NodeKey nodeKey = processFile(file, type); + + ChatAttachment attachment = new ChatAttachment(); + attachment.setFileType(type); + attachment.setFileUuid(nodeKey.getUuid()); + attachment.setFileVersionId(nodeKey.getVersion()); + attachment.setFileName(file.getFileName()); + + return attachment; + } + + public void deleteFromRepository(Long uuid, Long versionID) throws ChatException { + ITicket ticket = getRepositoryLoginTicket(); + try { + repositoryService.deleteVersion(ticket, uuid,versionID); + } catch (Exception e) { + throw new ChatException( + "Exception occured while deleting files from" + + " the repository " + e.getMessage()); + } + } + + public void deleteInstructionFile(Long contentID, Long uuid, Long versionID, String type) { + chatDAO.deleteInstructionFile(contentID, uuid, versionID, type); + + } + + public void saveOrUpdateContent(Chat persistContent) { + chatDAO.saveOrUpdate(persistContent); + + } + + /* ********** Private methods ********** */ + + private NodeKey processFile(FormFile file, String type) { + NodeKey node = null; + if (file!= null && !StringUtils.isEmpty(file.getFileName())) { + String fileName = file.getFileName(); + try { + node = getChatToolContentHandler().uploadFile(file.getInputStream(), fileName, + file.getContentType(), type); + } catch (InvalidParameterException e) { + throw new ChatException("FileNotFoundException occured while trying to upload File" + e.getMessage()); + } catch (FileNotFoundException e) { + throw new ChatException("FileNotFoundException occured while trying to upload File" + e.getMessage()); + } catch (RepositoryCheckedException e) { + throw new ChatException("FileNotFoundException occured while trying to upload File" + e.getMessage()); + } catch (IOException e) { + throw new ChatException("FileNotFoundException occured while trying to upload File" + e.getMessage()); + } + } + return node; + } + + /** + * This method verifies the credentials of the SubmitFiles Tool and gives it + * the Ticket to login and access the Content Repository. + * + * A valid ticket is needed in order to access the content from the + * repository. This method would be called evertime the tool needs to + * upload/download files from the content repository. + * + * @return ITicket The ticket for repostory access + * @throws SubmitFilesException + */ + private ITicket getRepositoryLoginTicket() throws ChatException { + repositoryService = RepositoryProxy.getRepositoryService(); + ICredentials credentials = new SimpleCredentials( + ChatToolContentHandler.repositoryUser, + ChatToolContentHandler.repositoryId); + try { + ITicket ticket = repositoryService.login(credentials, + ChatToolContentHandler.repositoryWorkspaceName); + return ticket; + } catch (AccessDeniedException ae) { + throw new ChatException("Access Denied to repository." + + ae.getMessage()); + } catch (WorkspaceNotFoundException we) { + throw new ChatException("Workspace not found." + + we.getMessage()); + } catch (LoginException e) { + throw new ChatException("Login failed." + e.getMessage()); + } + } + /* ********** Used by Spring to "inject" the linked objects ************* */ public IChatAttachmentDAO getChatAttachmentDAO() { @@ -249,5 +407,4 @@ public void setLearnerService(ILearnerService learnerService) { this.learnerService = learnerService; } - } Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/IChatService.java =================================================================== diff -u -r57a8fd80863308a6aae133850dbe2de4acd15abf -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/IChatService.java (.../IChatService.java) (revision 57a8fd80863308a6aae133850dbe2de4acd15abf) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/IChatService.java (.../IChatService.java) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -23,12 +23,74 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.chat.service; +import org.apache.struts.upload.FormFile; +import org.lamsfoundation.lams.tool.chat.model.Chat; +import org.lamsfoundation.lams.tool.chat.model.ChatAttachment; - /** * Defines the services available to the web layer from the Chat Service */ public interface IChatService { + /** + * Makes a copy of the default content and assigns it a newContentID + * + * @params newContentID + * @return + */ + public Chat copyDefaultContent(Long newContentID); - -} + /** + * Returns an instance of the Chat tools default content. + * + * @return + */ + public Chat getDefaultContent(); + + /** + * + * @param toolSignature + * @return + */ + public Long getToolDefaultContentIdBySignature(String toolSignature); + + /** + * + * @param toolContentID + * @return + */ + public Chat getChatByContentId(Long toolContentID); + + /** + * + * + * @param toolContentId + * @param file + * @param type + * @return + */ + public ChatAttachment uploadFileToContent(Long toolContentId, FormFile file, String type); + + /** + * + * @param uuid + * @param versionID + */ + public void deleteFromRepository(Long uuid, Long versionID); + + /** + * + * @param contentID + * @param uuid + * @param versionID + * @param type + */ + public void deleteInstructionFile(Long contentID, Long uuid, Long versionID, String type); + + /* + * + */ + public void saveOrUpdateContent(Chat persistContent); + + + +} \ No newline at end of file Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatConstants.java =================================================================== diff -u -r57a8fd80863308a6aae133850dbe2de4acd15abf -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatConstants.java (.../ChatConstants.java) (revision 57a8fd80863308a6aae133850dbe2de4acd15abf) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatConstants.java (.../ChatConstants.java) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -26,4 +26,9 @@ public interface ChatConstants { public static final String TOOL_SIGNATURE = "lachat11"; public static final Integer COMPLETED = new Integer(1); + public static final String AUTHORING_DEFAULT_TAB = "1"; + public static final String ATTACHMENT_LIST = "attachmentList"; + public static final String DELETED_ATTACHMENT_LIST = "deletedAttachmentList"; + public static final String AUTH_SESSION_ID_COUNTER = "authoringSessionIdCounter"; + public static final String AUTH_SESSION_ID = "authoringSessionId"; } Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatException.java =================================================================== diff -u -r57a8fd80863308a6aae133850dbe2de4acd15abf -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatException.java (.../ChatException.java) (revision 57a8fd80863308a6aae133850dbe2de4acd15abf) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatException.java (.../ChatException.java) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -30,6 +30,11 @@ */ public class ChatException extends RuntimeException { + /** + * + */ + private static final long serialVersionUID = -5518806968051758859L; + public ChatException(String message) { super(message); } Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatToolContentHandler.java =================================================================== diff -u -r57a8fd80863308a6aae133850dbe2de4acd15abf -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatToolContentHandler.java (.../ChatToolContentHandler.java) (revision 57a8fd80863308a6aae133850dbe2de4acd15abf) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatToolContentHandler.java (.../ChatToolContentHandler.java) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -30,36 +30,46 @@ */ public class ChatToolContentHandler extends ToolContentHandler { - private static String repositoryWorkspaceName = "chatworkspace"; - private static String repositoryUser = "chat"; - private static char[] repositoryId = {'l','a','m','s','-','e','x'}; + // TODO these three fields were changed to public, since accessor methods + // cannot be made static. Check if we can do this a better way. + public static String repositoryWorkspaceName = "chatworkspace"; - /** - * - */ - public ChatToolContentHandler() { - super(); - } + public static String repositoryUser = "chat"; - /* (non-Javadoc) - * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryWorkspaceName() - */ - public String getRepositoryWorkspaceName() { - return repositoryWorkspaceName; - } + public static char[] repositoryId = { 'l', 'a', 'm', 's', '-', 'e', 'x' }; - /* (non-Javadoc) - * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryUser() - */ - public String getRepositoryUser() { - return repositoryUser; - } + /** + * + */ + public ChatToolContentHandler() { + super(); + } - /* (non-Javadoc) - * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryId() - */ - public char[] getRepositoryId() { - return repositoryId; - } + /* + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryWorkspaceName() + */ + public String getRepositoryWorkspaceName() { + return repositoryWorkspaceName; + } + /* + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryUser() + */ + public String getRepositoryUser() { + return repositoryUser; + } + + /* + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryId() + */ + public char[] getRepositoryId() { + return repositoryId; + } + } Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/AuthoringAction.java =================================================================== diff -u -r57a8fd80863308a6aae133850dbe2de4acd15abf -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/AuthoringAction.java (.../AuthoringAction.java) (revision 57a8fd80863308a6aae133850dbe2de4acd15abf) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/AuthoringAction.java (.../AuthoringAction.java) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -23,31 +23,393 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.chat.web.actions; +import java.util.Date; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; -import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; +import org.apache.struts.upload.FormFile; +import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; +import org.lamsfoundation.lams.tool.chat.beans.AuthoringSessionBean; +import org.lamsfoundation.lams.tool.chat.model.Chat; +import org.lamsfoundation.lams.tool.chat.model.ChatAttachment; +import org.lamsfoundation.lams.tool.chat.service.ChatServiceProxy; +import org.lamsfoundation.lams.tool.chat.service.IChatService; +import org.lamsfoundation.lams.tool.chat.util.ChatConstants; +import org.lamsfoundation.lams.tool.chat.web.forms.AuthoringForm; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.action.LamsDispatchAction; +import org.lamsfoundation.lams.web.util.AttributeNames; /** * @author * @version * - * @struts.action path="/authoring" - * - * @struts.action-forward name="success" path="tiles:/authoring/main" - * @struts.action-forward name="test" path="/pages/test.html" + * @struts.action path="/authoring" name="authoringForm" parameter="dispatch" + * scope="request" validate="false" + * + * @struts.action-forward name="success" path="tiles:/authoring/main" */ -public class AuthoringAction extends Action { +public class AuthoringAction extends LamsDispatchAction { - private static Logger log = Logger.getLogger(AuthoringAction.class); + private static Logger logger = Logger.getLogger(AuthoringAction.class); - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - // TODO Auto-generated method stub - return mapping.findForward("success"); } -} + public IChatService chatService; + + /** + * Default method when no dispatch parameter is specified. It is expected + * that the parameter toolContentID will be passed in. This + * will be used to retrieve content for this tool. + * + */ + protected ActionForward unspecified(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) { + + // set up the form. + AuthoringForm authForm = (AuthoringForm) form; + + // Extract toolContentID from parameters. + Long toolContentID = new Long(WebUtil.readLongParam(request, + AttributeNames.PARAM_TOOL_CONTENT_ID)); + if (logger.isDebugEnabled()) { + logger.debug("entering method unspecified: toolContentID = " + + toolContentID); + } + + // create a new authoringSessionBean and add to session + AuthoringSessionBean authSession = new AuthoringSessionBean(); + String id = ChatConstants.AUTH_SESSION_ID + + createAuthSessionId(request.getSession()); + authSession.setAuthSessionId(id); + request.getSession().setAttribute(id, authSession); + + // set up chatService + if (chatService == null) { + chatService = ChatServiceProxy.getChatService(this.getServlet() + .getServletContext()); + } + + // retrieving Chat with given toolContentID + Chat chat = chatService.getChatByContentId(toolContentID); + if (chat == null) { + chat = chatService.copyDefaultContent(toolContentID); + chat.setCreateDate(new Date()); + chatService.saveOrUpdateContent(chat); + // TODO NOTE: this causes DB orphans when LD not saved. + } + + // populating the AuthoringForm using Chat content + populateAuthForm((AuthoringForm) form, chat); + resetAuthSession(authSession, chat); + authForm.setAuthSession(authSession); + authForm.setAuthSessionId(authSession.getAuthSessionId()); + return mapping.findForward("success"); + } + + private synchronized Long createAuthSessionId(HttpSession httpSession) { + Long authSessionId = (Long) httpSession + .getAttribute(ChatConstants.AUTH_SESSION_ID_COUNTER); + if (authSessionId == null) { + authSessionId = 1L; + httpSession.setAttribute(ChatConstants.AUTH_SESSION_ID_COUNTER, + authSessionId); + } else { + authSessionId++; + } + return authSessionId; + } + + public ActionForward updateContent(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) { + // Local History 10:29, started change. + // TODO need error checking. + AuthoringForm authForm = (AuthoringForm) form; + + // retrieving authoring session bean + AuthoringSessionBean authSession = (AuthoringSessionBean) request + .getSession().getAttribute(authForm.getAuthSessionId()); + + // retrieve the content. + if (chatService == null) { + chatService = ChatServiceProxy.getChatService(this.getServlet() + .getServletContext()); + } + Chat content = chatService.getChatByContentId(authForm + .getToolContentID()); + + // copy form inputs to content + populateChat(content, authForm); + + // adding unsaved uploaded files. + Set attachments = content.getChatAttachments(); + if (attachments == null) { + attachments = new HashSet(); + } + attachments.addAll(authSession.getUnsavedOnlineFilesList()); + attachments.addAll(authSession.getUnsavedOfflineFilesList()); + + // Removing attachments marked for deletion. + List deletedAttachments = authSession.getDeletedFilesList(); + for(ChatAttachment delAtt:deletedAttachments) { + // remove from repository + chatService.deleteFromRepository(delAtt.getFileUuid(), delAtt + .getFileVersionId()); + + // remove from ChatAttachments + Iterator attIter = attachments.iterator(); + while (attIter.hasNext()) { + ChatAttachment att = (ChatAttachment) attIter.next(); + if (delAtt.getUid().equals(att.getUid())) { + attIter.remove(); + break; + } + } + } + + // set attachments in case it didnt exist + content.setChatAttachments(attachments); + + // saving changes. + content.setUpdateDate(new Date()); + chatService.saveOrUpdateContent(content); + + request.setAttribute("updateContentSuccess", new Boolean(true)); + + // update form and return to page. + resetAuthSession(authSession, content); + authForm.setAuthSession(authSession); + return mapping.findForward("success"); + } + + public ActionForward uploadOnline(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) { + return uploadFile(mapping, form, IToolContentHandler.TYPE_ONLINE, + request); + } + + public ActionForward uploadOffline(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) { + return uploadFile(mapping, form, IToolContentHandler.TYPE_OFFLINE, + request); + } + + public ActionForward deleteOnline(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) { + + AuthoringForm au = (AuthoringForm)form; + + Long myLong = au.getDeleteFileUuid(); + + return deleteFile(mapping, form, IToolContentHandler.TYPE_ONLINE, request); + } + + public ActionForward deleteOffline(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) { + + return deleteFile(mapping, form, IToolContentHandler.TYPE_OFFLINE, request); + } + + public ActionForward removeUnsavedOnline(ActionMapping mapping, + ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + + return removeUnsaved(mapping, form, IToolContentHandler.TYPE_ONLINE, request); + } + + + + public ActionForward removeUnsavedOffline(ActionMapping mapping, + ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + + return removeUnsaved(mapping, form, IToolContentHandler.TYPE_OFFLINE, request); + } + + /* ========== Private Methods ********** */ + + private ActionForward uploadFile(ActionMapping mapping, ActionForm form, + String type, HttpServletRequest request) { + + AuthoringForm authForm = (AuthoringForm) form; + + // retrieving authoring session bean + AuthoringSessionBean authSession = (AuthoringSessionBean) request + .getSession().getAttribute(authForm.getAuthSessionId()); + + // setting up variable to be used. + FormFile file; + List unsavedFilesList; + List savedFilesList; + if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { + file = (FormFile) authForm.getOfflineFile(); + unsavedFilesList = authSession.getUnsavedOfflineFilesList(); + savedFilesList = authSession.getOfflineFilesList(); + } else { + file = (FormFile) authForm.getOnlineFile(); + unsavedFilesList = authSession.getUnsavedOnlineFilesList(); + savedFilesList = authSession.getOnlineFilesList(); + } + + // upload file to repository + ChatAttachment newAttachment = chatService.uploadFileToContent(authForm + .getToolContentID(), file, type); + + // Add attachment to unsavedFileList + // checking to see if file with same name exists + ChatAttachment currentAttachment; + Iterator iter = savedFilesList.iterator(); + while (iter.hasNext()) { + currentAttachment = (ChatAttachment) iter.next(); + if (StringUtils.equals(currentAttachment.getFileName(), + newAttachment.getFileName())) { + // move from this this list to deleted list. + authSession.getDeletedFilesList().add(currentAttachment); + iter.remove(); + break; + } + } + unsavedFilesList.add(newAttachment); + + authForm.setAuthSession(authSession); + request.setAttribute("unsavedChanges", new Boolean(true)); + return mapping.findForward("success"); + } + + private ActionForward deleteFile(ActionMapping mapping, ActionForm form, String type, HttpServletRequest request) { + AuthoringForm authForm = (AuthoringForm) form; + + // retrieving authoring session bean + AuthoringSessionBean authSession = (AuthoringSessionBean) request + .getSession().getAttribute(authForm.getAuthSessionId()); + + List fileList; + if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { + fileList = authSession.getOfflineFilesList(); + } else { + fileList = authSession.getOnlineFilesList(); + } + + Iterator iter = fileList.iterator(); + + while(iter.hasNext()) { + ChatAttachment att = (ChatAttachment) iter.next(); + + if (att.getFileUuid().equals(authForm.getDeleteFileUuid())) { + // move to delete file list, at next updateContent it will be deleted + authSession.getDeletedFilesList().add(att); + + // remove from this list + iter.remove(); + break; + } + } + + authForm.setAuthSession(authSession); + request.setAttribute("unsavedChanges", new Boolean(true)); + return mapping.findForward("success"); + } + private ActionForward removeUnsaved(ActionMapping mapping, ActionForm form, String type, HttpServletRequest request) { + AuthoringForm authForm = (AuthoringForm) form; + + // retrieving authoring session bean + AuthoringSessionBean authSession = (AuthoringSessionBean) request + .getSession().getAttribute(authForm.getAuthSessionId()); + + List unsavedAttachments; + + if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { + unsavedAttachments = authSession.getUnsavedOfflineFilesList(); + } else { + unsavedAttachments = authSession.getUnsavedOnlineFilesList(); + } + + Iterator iter = unsavedAttachments.iterator(); + while(iter.hasNext()) { + ChatAttachment remAtt = (ChatAttachment) iter.next(); + + if (remAtt.getFileUuid().equals(authForm.getDeleteFileUuid())) { + // delete from repository + chatService.deleteFromRepository(remAtt.getFileUuid(), remAtt + .getFileVersionId()); + + // remove from session list + iter.remove(); + break; + } + } + + authForm.setAuthSession(authSession); + request.setAttribute("unsavedChanges", new Boolean(true)); + return mapping.findForward("success"); + } + + /** + * Populates a Chat using inputs in AuthoringForm. + * + * @param authForm + * @return + */ + private void populateChat(Chat chat, AuthoringForm authForm) { + // Extract data from AuthoringForm + String title = (String) authForm.getTitle(); + String instructions = (String) authForm.getInstructions(); + String online_instruction = (String) authForm.getOnlineInstruction(); + String offline_instruction = (String) authForm.getOfflineInstruction(); + String value = (String) authForm.getLockOnFinished(); + boolean lock_on_finished = StringUtils.isEmpty(value) ? false : true; + + // update chat object. + chat.setTitle(title); + chat.setInstructions(instructions); + chat.setOfflineInstructions(offline_instruction); + chat.setOnlineInstructions(online_instruction); + chat.setLockOnFinished(lock_on_finished); + } + + /** + * Populates the AuthoringForm with content from Chat + * + * @param chat + * @param authForm + * @return + */ + private void populateAuthForm(AuthoringForm authForm, Chat chat) { + authForm.setToolContentID(chat.getToolContentId()); + authForm.setTitle(chat.getTitle()); + authForm.setInstructions(chat.getInstructions()); + authForm.setOnlineInstruction(chat.getOnlineInstructions()); + authForm.setOfflineInstruction(chat.getOfflineInstructions()); + // TODO add the rest. + } + + private void resetAuthSession(AuthoringSessionBean authSession, Chat chat) { + // clear the lists in session. + authSession.getUnsavedOfflineFilesList().clear(); + authSession.getUnsavedOnlineFilesList().clear(); + authSession.getDeletedFilesList().clear(); + authSession.getOnlineFilesList().clear(); + authSession.getOfflineFilesList().clear(); + + Iterator iter = chat.getChatAttachments().iterator(); + while (iter.hasNext()) { + ChatAttachment attachment = (ChatAttachment) iter.next(); + String type = attachment.getFileType(); + if (type.equals(IToolContentHandler.TYPE_OFFLINE)) { + authSession.getOfflineFilesList().add(attachment); + } + if (type.equals(IToolContentHandler.TYPE_ONLINE)) { + authSession.getOnlineFilesList().add(attachment); + } + } + } +} \ No newline at end of file Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/LearningAction.java =================================================================== diff -u -r57a8fd80863308a6aae133850dbe2de4acd15abf -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/LearningAction.java (.../LearningAction.java) (revision 57a8fd80863308a6aae133850dbe2de4acd15abf) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/LearningAction.java (.../LearningAction.java) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -47,6 +47,7 @@ HttpServletRequest request, HttpServletResponse response) throws Exception { // TODO Auto-generated method stub + log.info("excuting learning action"); return mapping.findForward("success"); } Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/MonitoringAction.java =================================================================== diff -u -r57a8fd80863308a6aae133850dbe2de4acd15abf -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/MonitoringAction.java (.../MonitoringAction.java) (revision 57a8fd80863308a6aae133850dbe2de4acd15abf) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/MonitoringAction.java (.../MonitoringAction.java) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -47,6 +47,7 @@ HttpServletRequest request, HttpServletResponse response) throws Exception { // TODO Auto-generated method stub + log.info("excuting monitoring action"); return mapping.findForward("success"); } } Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/forms/AuthoringForm.java =================================================================== diff -u --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/forms/AuthoringForm.java (revision 0) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/forms/AuthoringForm.java (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -0,0 +1,171 @@ +/**************************************************************** + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ + +package org.lamsfoundation.lams.tool.chat.web.forms; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.upload.FormFile; +import org.lamsfoundation.lams.tool.chat.beans.AuthoringSessionBean; + +public class AuthoringForm extends ActionForm { + + /** + * + */ + private static final long serialVersionUID = 3950453134542135495L; + + // Properties + + String title; + + String instructions; + + String offlineInstruction; + + String onlineInstruction; + + Long toolContentID; + + String lockOnFinished; + + FormFile onlineFile; + + FormFile offlineFile; + + String currentTab; + + String dispatch; + + String authSessionId; + + Long deleteFileUuid; + + AuthoringSessionBean authSession; + + public String getAuthSessionId() { + return authSessionId; + } + + public void setAuthSessionId(String authSessionId) { + this.authSessionId = authSessionId; + } + + public String getCurrentTab() { + return currentTab; + } + + public void setCurrentTab(String currentTab) { + this.currentTab = currentTab; + } + + public String getDispatch() { + return dispatch; + } + + public void setDispatch(String dispatch) { + this.dispatch = dispatch; + } + + public String getInstructions() { + return instructions; + } + + public void setInstructions(String instructions) { + this.instructions = instructions; + } + + public String getLockOnFinished() { + return lockOnFinished; + } + + public void setLockOnFinished(String lockOnFinished) { + this.lockOnFinished = lockOnFinished; + } + + public FormFile getOfflineFile() { + return offlineFile; + } + + public void setOfflineFile(FormFile offlineFile) { + this.offlineFile = offlineFile; + } + + public String getOfflineInstruction() { + return offlineInstruction; + } + + public void setOfflineInstruction(String offlineInstruction) { + this.offlineInstruction = offlineInstruction; + } + + public FormFile getOnlineFile() { + return onlineFile; + } + + public void setOnlineFile(FormFile onlineFile) { + this.onlineFile = onlineFile; + } + + public String getOnlineInstruction() { + return onlineInstruction; + } + + public void setOnlineInstruction(String onlineInstruction) { + this.onlineInstruction = onlineInstruction; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Long getToolContentID() { + return toolContentID; + } + + public void setToolContentID(Long toolContentID) { + this.toolContentID = toolContentID; + } + + public void setAuthSession(AuthoringSessionBean authSession) { + this.authSession = authSession; + + } + + public AuthoringSessionBean getAuthSession() { + return authSession; + } + + public Long getDeleteFileUuid() { + return deleteFileUuid; + } + + public void setDeleteFileUuid(Long deleteFile) { + this.deleteFileUuid = deleteFile; + } +} Index: lams_tool_chat/web/WEB-INF/lams.tld =================================================================== diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/web/WEB-INF/lams.tld (.../lams.tld) (revision ed16d5f8991580c9160628f30a49e947a0b154bb) +++ lams_tool_chat/web/WEB-INF/lams.tld (.../lams.tld) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -2,7 +2,7 @@ 1.0 @@ -33,6 +33,7 @@ empty + Output details from the shared session UserDTO object property true @@ -63,6 +64,7 @@ empty + Output stylesheet based on the user preferences. localLink false Index: lams_tool_chat/web/WEB-INF/struts/struts-config.xml =================================================================== diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/web/WEB-INF/struts/struts-config.xml (.../struts-config.xml) (revision ed16d5f8991580c9160628f30a49e947a0b154bb) +++ lams_tool_chat/web/WEB-INF/struts/struts-config.xml (.../struts-config.xml) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -13,6 +13,8 @@ + + @@ -55,27 +57,25 @@ - - + Index: lams_tool_chat/web/WEB-INF/web.xml =================================================================== diff -u -rad683fcaeabe83c702b599c5c866bb7d30cd7191 -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/web/WEB-INF/web.xml (.../web.xml) (revision ad683fcaeabe83c702b599c5c866bb7d30cd7191) +++ lams_tool_chat/web/WEB-INF/web.xml (.../web.xml) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -5,7 +5,7 @@ javax.servlet.jsp.jstl.fmt.localizationContext - org.lamsfoundation.lams.applicationResources + org.lamsfoundation.lams.tool.chat.ApplicationResources @@ -74,43 +74,56 @@ - action - org.apache.struts.action.ActionServlet - - config - /WEB-INF/struts/struts-config.xml - - - debug - 999 - - - detail - 2 - - - validate - true - - 1 + action + org.apache.struts.action.ActionServlet + + config + /WEB-INF/struts/struts-config.xml + + + debug + 999 + + + detail + 2 + + + validate + true + + 1 - Connector - com.fredck.FCKeditor.connector.ConnectorServlet - - baseDir - /UserFiles/ - - - debug - false - - 1 + Connector + com.fredck.FCKeditor.connector.ConnectorServlet + + baseDir + /UserFiles/ + + + debug + false + + 1 + + + Attachment Download + Attachment Download + download + org.lamsfoundation.lams.contentrepository.client.ToolDownload + + toolContentHandlerBeanName + chatToolContentHandler + + 3 + + action *.do @@ -122,6 +135,11 @@ /fckeditor/editor/filemanager/browser/default/connectors/jsp/connector + + download + /download/* + + 120 Index: lams_tool_chat/web/common/header.jsp =================================================================== diff -u -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2 -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/web/common/header.jsp (.../header.jsp) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2) +++ lams_tool_chat/web/common/header.jsp (.../header.jsp) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -11,11 +11,15 @@ <bean:message key="activity.display.name" /> + + + + Index: lams_tool_chat/web/common/taglibs.jsp =================================================================== diff -u -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2 -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/web/common/taglibs.jsp (.../taglibs.jsp) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2) +++ lams_tool_chat/web/common/taglibs.jsp (.../taglibs.jsp) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -8,3 +8,4 @@ <%@ taglib uri="tags-fmt" prefix="fmt"%> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="fck-editor" prefix="fck"%> + \ No newline at end of file Index: lams_tool_chat/web/images/error.png =================================================================== diff -u Binary files differ Index: lams_tool_chat/web/images/error_big.png =================================================================== diff -u Binary files differ Index: lams_tool_chat/web/images/good.png =================================================================== diff -u Binary files differ Index: lams_tool_chat/web/images/good_big.png =================================================================== diff -u Binary files differ Index: lams_tool_chat/web/images/hidden.png =================================================================== diff -u Binary files differ Index: lams_tool_chat/web/images/hidden_big.png =================================================================== diff -u Binary files differ Index: lams_tool_chat/web/images/success.gif =================================================================== diff -u Binary files differ Index: lams_tool_chat/web/images/warning.png =================================================================== diff -u Binary files differ Index: lams_tool_chat/web/images/warning_big.png =================================================================== diff -u Binary files differ Index: lams_tool_chat/web/includes/css/fckeditor_style.css =================================================================== diff -u --- lams_tool_chat/web/includes/css/fckeditor_style.css (revision 0) +++ lams_tool_chat/web/includes/css/fckeditor_style.css (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -0,0 +1,55 @@ +.previewPanel{ + width: 700px; + height: 220px; + border-style: none; + border-width: 1px; + padding: 5px; + + overflow: auto; +} + +.textareaPanel{ + width: 700px; + height: 220px; +} + + +.smallPreviewPanel{ + width: 700px; + height: 120px; + border-style: none; + border-width: 1px; + padding: 5px; +} + +.smallTextareaPanel{ + width: 700px; + height: 120px; +} + +#wyswygEditor{ + /*position the wyswygEditor in the centre*/ + position: absolute; + /*top: 15%; + left: 50%; + margin-left: -400px; + margin-top: -260px;*/ + + width: 100%; + height: 100%; + + + /*border-style: solid; + border-width: 3px;*/ +} + +#wyswygEditorScreen{ + position: absolute; + + width: 700px; + height: 220px; + + padding: 0px; + margin: 0px; +} + Index: lams_tool_chat/web/pages/authoring/advanced.jsp =================================================================== diff -u -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2 -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/web/pages/authoring/advanced.jsp (.../advanced.jsp) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2) +++ lams_tool_chat/web/pages/authoring/advanced.jsp (.../advanced.jsp) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -1 +1,16 @@ -this is advanced \ No newline at end of file +<%@ include file="/common/taglibs.jsp"%> + + + + +
+ + + + +
+ + + +
+
Index: lams_tool_chat/web/pages/authoring/authoring.jsp =================================================================== diff -u -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2 -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2) +++ lams_tool_chat/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -1,13 +1,52 @@ <%@ include file="/common/taglibs.jsp"%> - +
- - - + + + + + + +
+ + + + + + + + + + +
+ + <%-- Page tabs --%> + + + + +
+ + <%-- Form Controls --%> +
+ + + + + + +
+
+ + + + + + Index: lams_tool_chat/web/pages/authoring/basic.jsp =================================================================== diff -u -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2 -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/web/pages/authoring/basic.jsp (.../basic.jsp) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2) +++ lams_tool_chat/web/pages/authoring/basic.jsp (.../basic.jsp) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -1 +1,29 @@ -this is basic \ No newline at end of file +<%@ include file="/common/taglibs.jsp"%> + + + + +
+ + + <%-- ========== TITLE FIELD ========== --%> + + + + + + <%-- ========== INSTRUCTIONS FIELD ========== --%> + + + + +
+ + + +
+ + + +
+
Index: lams_tool_chat/web/pages/authoring/instructions.jsp =================================================================== diff -u -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2 -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/web/pages/authoring/instructions.jsp (.../instructions.jsp) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2) +++ lams_tool_chat/web/pages/authoring/instructions.jsp (.../instructions.jsp) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -1 +1,207 @@ -this is instructions \ No newline at end of file +<%@ include file="/common/taglibs.jsp"%> + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+   + +
+
+ +
  • + + + + + + + +   + + + + + + + +   + + + + + + +
  • +
    + + <%-- Displaying unsaved Files --%> + +
  • + + * + + + + + + +   + + + + + + + +   + + + + +
  • +
    +
    +
    + + + + + choose + + + + +
    +   + +   +
    + + + <%-- TODO get rid of the nowrap --%> + +
    +   + +
    +
    + + +
  • + + + + + + + +   + + + + + + + +   + + + + +
  • +
    + + + +
  • + + * + + + + + + +   + + + + + + + +   + + + + +
  • +
    + +
    +
    + + + + + choose + + + + +
    +
    Index: lams_tool_chat/web/pages/authoring/script.jsp =================================================================== diff -u -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2 -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/web/pages/authoring/script.jsp (.../script.jsp) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2) +++ lams_tool_chat/web/pages/authoring/script.jsp (.../script.jsp) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -11,13 +11,22 @@ var themeName="aqua"; function init(){ + + // initialising tabs initTabSize(3); - -// var tag = document.getElementById("currentTab"); -// if(tag.value != "") -// selectTab(tag.value); -// else + + // open the current tab + var tag = document.getElementById("currentTab"); + if(tag.value != "") + selectTab(tag.value); + else selectTab(1); + + // initialising fckeditor + initEditor("Title"); + initEditor("Instructions"); + initEditor("OnlineInstruction"); + initEditor("OfflineInstruction"); } function doSelectTab(tabId) { @@ -26,11 +35,15 @@ selectTab(tabId); } - function doSubmit(method, tabId) { -// if(tabId != null) -// document.forumMonitoringForm.currentTab.value=tabId; -// document.forumMonitoringForm.method.value=method; - document.forumMonitoringForm.submit(); + function doSubmit(method) { + document.authoringForm.dispatch.value=method; + document.authoringForm.submit(); } - - + + function deleteAttachment(dispatch, uuid) { + document.authoringForm.dispatch.value=dispatch; + document.authoringForm.deleteFileUuid.value=uuid; + document.authoringForm.submit(); + } + + \ No newline at end of file Index: lams_tool_chat/web/pages/monitoring/script.jsp =================================================================== diff -u -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2 -rb32ded72d955763a9b49e33e2dc2ab195d83564b --- lams_tool_chat/web/pages/monitoring/script.jsp (.../script.jsp) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2) +++ lams_tool_chat/web/pages/monitoring/script.jsp (.../script.jsp) (revision b32ded72d955763a9b49e33e2dc2ab195d83564b) @@ -27,9 +27,7 @@ } function doSubmit(method, tabId) { -// if(tabId != null) -// document.forumMonitoringForm.currentTab.value=tabId; -// document.forumMonitoringForm.method.value=method; - document.forumMonitoringForm.submit(); + document.monitoringForm.method.value=method; + document.monitoringForm.submit(); } \ No newline at end of file