-
+
+
+
+
+
+
+
Index: lams_tool_chat/conf/language/ApplicationResources.properties
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -12,7 +12,7 @@
# ========== Authoring Page ===========
-pageTitle.authoring="Authoring"
+pageTitle.authoring=Authoring
button.basic=Basic
button.advanced=Advanced
@@ -39,19 +39,20 @@
link.delete=Delete
# ========== Learner Page ==========
-pageTitle.Learning="Learning"
+pageTitle.Learning=Learning
message.defineLaterSet=Please wait for the teacher to complete the contents of this activity
message.runOfflineSet=This activity is not being done on the computer. Please see your instructor for details
# ========== Monitoring Page ==========
-pageTitle.monitoring="Monitoring"
+pageTitle.monitoring=Monitoring
button.summary=Summary
+button.instructions=Instructions
button.editActivity=Edit Activity
button.statistics=Statistics
-button.edit=Edit
+
titleHeading.summary=Summary
titleHeading.instructions=Instructions
titleHeading.statistics=Statistics
Index: lams_tool_chat/conf/xdoclet/web-settings.xml
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/conf/xdoclet/web-settings.xml (.../web-settings.xml) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/conf/xdoclet/web-settings.xml (.../web-settings.xml) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -13,6 +13,6 @@
classpath:/org/lamsfoundation/lams/tool/toolApplicationContext.xml
classpath:/org/lamsfoundation/lams/learning/learningApplicationContext.xml
classpath:/org/lamsfoundation/lams/contentrepository/applicationContext.xml
- classpath:/org/lamsfoundation/lams/tool/chat/applicationContext.xml
+ classpath:/org/lamsfoundation/lams/tool/chat/chatApplicationContext.xml
Index: lams_tool_chat/db/sql/create_lams_tool_chat.sql
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/db/sql/create_lams_tool_chat.sql (.../create_lams_tool_chat.sql) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/db/sql/create_lams_tool_chat.sql (.../create_lams_tool_chat.sql) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -65,7 +65,7 @@
REFERENCES tl_lachat11_session (uid) ON DELETE NO ACTION ON UPDATE NO ACTION
)TYPE=InnoDB;
---INSERT INTO tl_lachat11_chat (title,instructions,online_instructions,offline_instructions,tool_content_id,run_offline,lock_on_finished,content_in_use,define_later)
---VALUES("Chat Title","Chat Instruction","Online instructions","Offline instructions",${default_content_id},0,0,0,0);
+INSERT INTO tl_lachat11_chat (title,instructions,online_instructions,offline_instructions,tool_content_id,run_offline,lock_on_finished,content_in_use,define_later)
+VALUES("LAMS Chat","Chat Instruction","Online instructions","Offline instructions",${default_content_id},0,0,0,0);
SET FOREIGN_KEY_CHECKS=1;
\ No newline at end of file
Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/Chat.java
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/Chat.java (.../Chat.java) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/Chat.java (.../Chat.java) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -19,330 +19,372 @@
*http://www.gnu.org/licenses/gpl.txt
*/
-/* $Id$ */
+/* $Id$ */
package org.lamsfoundation.lams.tool.chat;
import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.Set;
-import org.hibernate.criterion.Example;
+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"
+/**
+ * @hibernate.class table="tl_lachat11_chat"
*/
-public class Chat implements java.io.Serializable {
+public class Chat implements java.io.Serializable, Cloneable {
+ static Logger log = Logger.getLogger(ChatService.class.getName());
+
+ // Fields
- // Fields
+ /**
+ * TODO generate proper serialVersionUID
+ */
+ private static final long serialVersionUID = 1L;
- /**
+ /**
*
*/
- private static final long serialVersionUID = 1L;
+ 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"
*
*/
- 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;
+ public Long getUid() {
+ return this.uid;
+ }
- // Constructors
+ public void setUid(Long uid) {
+ this.uid = uid;
+ }
- /** default constructor */
- public Chat() {
- }
+ /**
+ * @hibernate.property column="create_date"
+ *
+ */
-
- /** 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;
- }
+ public Date getCreateDate() {
+ return this.createDate;
+ }
-
- // Property accessors
- /**
- * @hibernate.id
- * generator-class="native"
- * type="java.lang.Long"
- * column="uid"
- *
- */
+ public void setCreateDate(Date createDate) {
+ this.createDate = createDate;
+ }
- public Long getUid() {
- return this.uid;
- }
-
- public void setUid(Long uid) {
- this.uid = uid;
- }
- /**
- * @hibernate.property
- * column="create_date"
- *
- */
+ /**
+ * @hibernate.property column="update_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 Date getUpdateDate() {
- return this.updateDate;
- }
-
- public void setUpdateDate(Date updateDate) {
- this.updateDate = updateDate;
- }
- /**
- * @hibernate.property
- * column="create_by"
- * length="20"
- *
- */
+ public void setUpdateDate(Date updateDate) {
+ this.updateDate = updateDate;
+ }
- public Long getCreateBy() {
- return this.createBy;
- }
-
- public void setCreateBy(Long createBy) {
- this.createBy = createBy;
- }
- /**
- * @hibernate.property
- * column="title"
- * length="255"
- *
- */
+ /**
+ * @hibernate.property column="create_by" length="20"
+ *
+ */
- public String getTitle() {
- return this.title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
- /**
- * @hibernate.property
- * column="instructions"
- * length="65535"
- *
- */
+ public Long getCreateBy() {
+ return this.createBy;
+ }
- public String getInstructions() {
- return this.instructions;
- }
-
- public void setInstructions(String instructions) {
- this.instructions = instructions;
- }
- /**
- * @hibernate.property
- * column="run_offline"
- * length="1"
- *
- */
+ public void setCreateBy(Long createBy) {
+ this.createBy = createBy;
+ }
- public Boolean getRunOffline() {
- return this.runOffline;
- }
-
- public void setRunOffline(Boolean runOffline) {
- this.runOffline = runOffline;
- }
- /**
- * @hibernate.property
- * column="lock_on_finished"
- * length="1"
- *
- */
+ /**
+ * @hibernate.property column="title" length="255"
+ *
+ */
- public Boolean getLockOnFinished() {
- return this.lockOnFinished;
- }
-
- public void setLockOnFinished(Boolean lockOnFinished) {
- this.lockOnFinished = lockOnFinished;
- }
- /**
- * @hibernate.property
- * column="online_instructions"
- * length="65535"
- *
- */
+ public String getTitle() {
+ return this.title;
+ }
- public String getOnlineInstructions() {
- return this.onlineInstructions;
- }
-
- public void setOnlineInstructions(String onlineInstructions) {
- this.onlineInstructions = onlineInstructions;
- }
- /**
- * @hibernate.property
- * column="offline_instructions"
- * length="65535"
- *
- */
+ public void setTitle(String title) {
+ this.title = title;
+ }
- public String getOfflineInstructions() {
- return this.offlineInstructions;
- }
-
- public void setOfflineInstructions(String offlineInstructions) {
- this.offlineInstructions = offlineInstructions;
- }
- /**
- * @hibernate.property
- * column="content_in_use"
- * length="1"
- *
- */
+ /**
+ * @hibernate.property column="instructions" length="65535"
+ *
+ */
- public Boolean getContentInUse() {
- return this.contentInUse;
- }
-
- public void setContentInUse(Boolean contentInUse) {
- this.contentInUse = contentInUse;
- }
- /**
- * @hibernate.property
- * column="define_later"
- * length="1"
- *
- */
+ public String getInstructions() {
+ return this.instructions;
+ }
- public Boolean getDefineLater() {
- return this.defineLater;
- }
-
- public void setDefineLater(Boolean defineLater) {
- this.defineLater = defineLater;
- }
- /**
- * @hibernate.property
- * column="tool_content_id"
- * length="20"
- *
- */
+ public void setInstructions(String instructions) {
+ this.instructions = instructions;
+ }
- public Long getToolContentId() {
- return this.toolContentId;
- }
-
- public void setToolContentId(Long toolContentId) {
- this.toolContentId = toolContentId;
- }
- /**
- * @hibernate.set
- * lazy="false"
- * inverse="true"
- * cascade="none"
- * @hibernate.collection-key
- * column="chat_uid"
- * @hibernate.collection-one-to-many
- * class="org.lamsfoundation.lams.tool.chat.ChatAttachment"
- *
- */
+ /**
+ * @hibernate.property column="run_offline" length="1"
+ *
+ */
- 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.ChatSession"
- *
- */
+ public Boolean getRunOffline() {
+ return this.runOffline;
+ }
- public Set getChatSessions() {
- return this.chatSessions;
- }
-
- public void setChatSessions(Set chatSessions) {
- this.chatSessions = chatSessions;
- }
-
+ public void setRunOffline(Boolean runOffline) {
+ this.runOffline = runOffline;
+ }
- /**
- * toString
- * @return String
- */
- public String toString() {
- StringBuffer buffer = new StringBuffer();
+ /**
+ * @hibernate.property column="lock_on_finished" length="1"
+ *
+ */
- 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 getLockOnFinished() {
+ return this.lockOnFinished;
+ }
+ public void setLockOnFinished(Boolean lockOnFinished) {
+ this.lockOnFinished = lockOnFinished;
+ }
- 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;
- }
+ /**
+ * @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;
+ }
-}
\ No newline at end of file
+ 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="true" cascade="none"
+ * @hibernate.collection-key column="chat_uid"
+ * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.chat.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.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);
+
+ // copy the attachments,
+ if(chatAttachments != null){
+ Iterator iter = chatAttachments.iterator();
+ Set set = new HashSet();
+ while(iter.hasNext()){
+ ChatAttachment file = (ChatAttachment)iter.next();
+ ChatAttachment newFile = (ChatAttachment)file.clone();
+ set.add(newFile);
+ }
+
+ }
+ // TODO check what we need to do with chatSessions clone.
+ chat.chatSessions = new HashSet();
+
+ } catch (CloneNotSupportedException e) {
+ log.error("Error cloning " + Chat.class);
+ //TODO is this the right thing to do ??
+ // maybe we should let the exception propagate.
+ }
+ return chat;
+ }
+}
Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/ChatAttachment.java
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/ChatAttachment.java (.../ChatAttachment.java) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/ChatAttachment.java (.../ChatAttachment.java) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -19,190 +19,213 @@
*http://www.gnu.org/licenses/gpl.txt
*/
-/* $Id$ */
+/* $Id$ */
package org.lamsfoundation.lams.tool.chat;
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.
+ * 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"
- *
+ * @hibernate.class table="tl_lachat11_attachment"
+ *
*/
-public class ChatAttachment implements java.io.Serializable {
+public class ChatAttachment implements java.io.Serializable, Cloneable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
- /**
+ /**
*
*/
+
+ 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;
+ private Long fileVersionId;
- // Constructors
+ private String fileType;
- /** default constructor */
- public ChatAttachment() {
- }
+ private String fileName;
-
- /** 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;
- }
+ private Long fileUuid;
-
- // Property accessors
- /**
- * @hibernate.id
- * generator-class="native"
- * type="java.lang.Long"
- * column="uid"
- *
- */
+ private Date createDate;
- public Long getUid() {
- return this.uid;
- }
-
- public void setUid(Long uid) {
- this.uid = uid;
- }
- /**
- * @hibernate.property
- * column="file_version_id"
- * length="20"
- *
- */
+ private Chat chat;
- public Long getFileVersionId() {
- return this.fileVersionId;
- }
-
- public void setFileVersionId(Long fileVersionId) {
- this.fileVersionId = fileVersionId;
- }
- /**
- * @hibernate.property
- * column="file_type"
- * length="255"
- *
- */
+ // Constructors
- public String getFileType() {
- return this.fileType;
- }
-
- public void setFileType(String fileType) {
- this.fileType = fileType;
- }
- /**
- * @hibernate.property
- * column="file_name"
- * length="255"
- *
- */
+ /** default constructor */
+ public ChatAttachment() {
+ }
- public String getFileName() {
- return this.fileName;
- }
-
- public void setFileName(String fileName) {
- this.fileName = fileName;
- }
- /**
- * @hibernate.property
- * column="file_uuid"
- * length="20"
- *
- */
+ /** 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;
+ }
- public Long getFileUuid() {
- return this.fileUuid;
- }
-
- public void setFileUuid(Long fileUuid) {
- this.fileUuid = fileUuid;
- }
- /**
- * @hibernate.property
- * column="create_date"
- *
- */
+ // Property accessors
+ /**
+ * @hibernate.id generator-class="native" type="java.lang.Long" column="uid"
+ *
+ */
- 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 Long getUid() {
+ return this.uid;
+ }
- public Chat getChat() {
- return this.chat;
- }
-
- public void setChat(Chat chat) {
- this.chat = chat;
- }
-
+ public void setUid(Long uid) {
+ this.uid = uid;
+ }
- /**
- * toString
- * @return String
- */
- public String toString() {
- StringBuffer buffer = new StringBuffer();
+ /**
+ * @hibernate.property column="file_version_id" length="20"
+ *
+ */
- 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 Long getFileVersionId() {
+ return this.fileVersionId;
+ }
+ public void setFileVersionId(Long fileVersionId) {
+ this.fileVersionId = fileVersionId;
+ }
- 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;
- }
+ /**
+ * @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;
+ }
-}
\ No newline at end of file
+ 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/dao/IChatDAO.java
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatDAO.java (.../IChatDAO.java) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatDAO.java (.../IChatDAO.java) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -23,11 +23,16 @@
package org.lamsfoundation.lams.tool.chat.dao;
import org.lamsfoundation.lams.dao.IBaseDAO;
+import org.lamsfoundation.lams.tool.chat.Chat;
/**
* DAO for accessing the Chat objects - interface defining
* methods to be implemented by the Hibernate or other implementation.
*/
public interface IChatDAO extends IBaseDAO{
+ Chat getByContentId(Long toolContentId);
+
+ void saveOrUpdate(Chat toContent);
+
}
\ No newline at end of file
Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatSessionDAO.java
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatSessionDAO.java (.../IChatSessionDAO.java) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatSessionDAO.java (.../IChatSessionDAO.java) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -23,11 +23,15 @@
package org.lamsfoundation.lams.tool.chat.dao;
import org.lamsfoundation.lams.dao.IBaseDAO;
+import org.lamsfoundation.lams.tool.chat.ChatSession;
/**
* DAO for accessing the ChatSession objects - interface defining
* methods to be implemented by the Hibernate or other implementation.
*/
public interface IChatSessionDAO extends IBaseDAO{
-}
\ No newline at end of file
+ void saveOrUpdate(ChatSession session);
+
+ ChatSession getBySessionId(Long toolSessionId);
+}
Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatDAO.java
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatDAO.java (.../ChatDAO.java) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatDAO.java (.../ChatDAO.java) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -19,15 +19,32 @@
*http://www.gnu.org/licenses/gpl.txt
*/
-/* $Id$ */
+/* $Id$ */
package org.lamsfoundation.lams.tool.chat.dao.hibernate;
+import java.util.List;
+
import org.lamsfoundation.lams.dao.hibernate.BaseDAO;
+import org.lamsfoundation.lams.tool.chat.Chat;
import org.lamsfoundation.lams.tool.chat.dao.IChatDAO;
/**
* 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=?";
+
+ public Chat getByContentId(Long toolContentId) {
+ List list = getHibernateTemplate().find(FIND_FORUM_BY_CONTENTID,toolContentId);
+ if(list != null && list.size() > 0)
+ return (Chat) list.get(0);
+ else
+ return null;
+ }
+
+ public void saveOrUpdate(Chat chat) {
+ this.getHibernateTemplate().saveOrUpdate(chat);
+ this.getHibernateTemplate().flush();
+ }
}
Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatSessionDAO.java
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatSessionDAO.java (.../ChatSessionDAO.java) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatSessionDAO.java (.../ChatSessionDAO.java) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -19,15 +19,33 @@
*http://www.gnu.org/licenses/gpl.txt
*/
-/* $Id$ */
+/* $Id$ */
package org.lamsfoundation.lams.tool.chat.dao.hibernate;
+import java.util.List;
+
import org.lamsfoundation.lams.dao.hibernate.BaseDAO;
+import org.lamsfoundation.lams.tool.chat.ChatSession;
import org.lamsfoundation.lams.tool.chat.dao.IChatSessionDAO;
/**
* DAO for accessing the ChatSession objects - Hibernate specific code.
*/
public class ChatSessionDAO extends BaseDAO implements IChatSessionDAO {
+ public static final String SQL_QUERY_FIND_BY_SESSION_ID = "from "
+ + ChatSession.class.getName() + " where session_id=?";
+
+ public void saveOrUpdate(ChatSession session) {
+ this.getHibernateTemplate().saveOrUpdate(session);
+ this.getHibernateTemplate().flush();
+ }
+
+ public ChatSession getBySessionId(Long toolSessionId) {
+ List list = this.getHibernateTemplate().find(
+ SQL_QUERY_FIND_BY_SESSION_ID, toolSessionId);
+ if (list == null || list.isEmpty())
+ return null;
+ return (ChatSession) list.get(0);
+ }
}
Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatService.java
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatService.java (.../ChatService.java) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatService.java (.../ChatService.java) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -19,58 +19,99 @@
*http://www.gnu.org/licenses/gpl.txt
*/
-/* $Id$ */
+/* $Id$ */
package org.lamsfoundation.lams.tool.chat.service;
import java.util.List;
+import org.apache.log4j.Logger;
import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler;
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.util.ChatConstants;
+import org.lamsfoundation.lams.tool.chat.util.ChatException;
import org.lamsfoundation.lams.tool.exception.DataMissingException;
import org.lamsfoundation.lams.tool.exception.SessionDataExistsException;
import org.lamsfoundation.lams.tool.exception.ToolException;
import org.lamsfoundation.lams.tool.service.ILamsToolService;
/**
-* An implementation of the NoticeboardService interface.
-*
-* As a requirement, all LAMS tool's service bean must implement ToolContentManager and ToolSessionManager.
-*/
+ * An implementation of the NoticeboardService interface.
+ *
+ * As a requirement, all LAMS tool's service bean must implement
+ * ToolContentManager and ToolSessionManager.
+ */
public class ChatService implements ToolSessionManager, ToolContentManager,
IChatService {
- private IChatDAO chatDAO=null;
+ private IChatDAO chatDAO = null;
+
private IChatSessionDAO chatSessionDAO = null;
- private IChatUserDAO chatUserDAO=null;
+
+ private IChatUserDAO chatUserDAO = null;
+
private IChatAttachmentDAO chatAttachmentDAO = null;
-
+
private ILearnerService learnerService;
+
private ILamsToolService toolService;
+
private IToolContentHandler chatToolContentHandler = null;
public ChatService() {
super();
// TODO Auto-generated constructor stub
}
- /* ************ Methods from ToolSessionManager, ToolContentManager ***********************/
+ static Logger log = Logger.getLogger(ChatService.class.getName());
+
+ /* ************ Methods from ToolSessionManager, ToolContentManager ***** */
public void createToolSession(Long toolSessionId, String toolSessionName,
Long toolContentId) throws ToolException {
-
+ ChatSession session = new ChatSession();
+ session.setSessionId(toolSessionId);
+ session.setSessionName(toolSessionName);
+ Chat chat = chatDAO.getByContentId(toolContentId);
+ session.setChat(chat);
+ chatSessionDAO.saveOrUpdate(session);
}
public String leaveToolSession(Long toolSessionId, Long learnerId)
throws DataMissingException, ToolException {
- // TODO Auto-generated method stub
- // Do tool status stuff first e.g. set learner to complete within the tool
+
+ if (toolSessionId == null) {
+ log
+ .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.");
+ throw new ToolException(
+ "Fail to remove tool Session based on null learner.");
+ }
+
+ ChatSession session = chatSessionDAO.getBySessionId(toolSessionId);
+ if (session != null) {
+ session.setStatus(ChatConstants.COMPLETED);
+ chatSessionDAO.saveOrUpdate(session);
+ } else {
+ log.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."
+ + "Could not find submit file session by given session id: "
+ + toolSessionId);
+ }
return learnerService.completeToolSession(toolSessionId, learnerId);
}
@@ -94,8 +135,17 @@
public void copyToolContent(Long fromContentId, Long toContentId)
throws ToolException {
- // TODO Auto-generated method stub
+ if (fromContentId == null || toContentId == null)
+ throw new ToolException(
+ "Failed to create the SubmitFiles tool seession");
+ Chat fromContent = chatDAO.getByContentId(fromContentId);
+ if (fromContent == null) {
+ fromContent = getDefaultContent(fromContentId);
+ }
+ Chat toContent = Chat.newInstance(fromContent, toContentId,
+ chatToolContentHandler);
+ chatDAO.saveOrUpdate(toContent);
}
public void setAsDefineLater(Long toolContentId)
@@ -116,7 +166,32 @@
}
- /* ******************* Used by Spring to "inject" the linked objects **************************/
+ /* ********** My Methods ************************************************ */
+
+ 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);
+ throw new ChatException(error);
+ }
+
+ Chat defaultContent = getDefaultForum();
+ // save default content by given ID.
+ Chat content = new Chat();
+ content = Chat.newInstance(defaultContent, contentId,
+ chatToolContentHandler);
+ return null;
+ }
+
+ private Chat getDefaultForum() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* ********** Used by Spring to "inject" the linked objects ************* */
+
public IChatAttachmentDAO getChatAttachmentDAO() {
return chatAttachmentDAO;
}
@@ -137,7 +212,8 @@
return chatToolContentHandler;
}
- public void setChatToolContentHandler(IToolContentHandler chatToolContentHandler) {
+ public void setChatToolContentHandler(
+ IToolContentHandler chatToolContentHandler) {
this.chatToolContentHandler = chatToolContentHandler;
}
Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatConstants.java
===================================================================
diff -u
--- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatConstants.java (revision 0)
+++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatConstants.java (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -0,0 +1,6 @@
+package org.lamsfoundation.lams.tool.chat.util;
+
+public interface ChatConstants {
+ public static final String TOOL_SIGNATURE = "lachat11";
+ public static final Integer COMPLETED = new Integer(1);
+}
Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatException.java
===================================================================
diff -u
--- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatException.java (revision 0)
+++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/util/ChatException.java (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -0,0 +1,28 @@
+package org.lamsfoundation.lams.tool.chat.util;
+
+/**
+ *
+ * @author Anthony Sukkar
+ *
+ */
+public class ChatException extends RuntimeException {
+
+ public ChatException(String message) {
+ super(message);
+ }
+
+ public ChatException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ChatException() {
+ super();
+
+ }
+
+ public ChatException(Throwable cause) {
+ super(cause);
+
+ }
+
+}
Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/MonitoringAction.java
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/MonitoringAction.java (.../MonitoringAction.java) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/MonitoringAction.java (.../MonitoringAction.java) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -46,5 +46,4 @@
// TODO Auto-generated method stub
return mapping.findForward("success");
}
-
}
Index: lams_tool_chat/web/WEB-INF/struts/tiles-defs.xml
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/web/WEB-INF/struts/tiles-defs.xml (.../tiles-defs.xml) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/web/WEB-INF/struts/tiles-defs.xml (.../tiles-defs.xml) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -1,72 +1,100 @@
-
-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; either version 2 of the License, or
-(at your option) any later version.
-
-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
+
-
-
-
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
- -->
-
-
-
-
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
+
-
-
\ No newline at end of file
+
+
+
+
+
+
Index: lams_tool_chat/web/WEB-INF/web.xml
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/web/WEB-INF/web.xml (.../web.xml) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/web/WEB-INF/web.xml (.../web.xml) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -16,7 +16,7 @@
classpath:/org/lamsfoundation/lams/tool/toolApplicationContext.xml
classpath:/org/lamsfoundation/lams/learning/learningApplicationContext.xml
classpath:/org/lamsfoundation/lams/contentrepository/applicationContext.xml
- classpath:/org/lamsfoundation/lams/tool/chat/applicationContext.xml
+ classpath:/org/lamsfoundation/lams/tool/chat/chatApplicationContext.xml
Index: lams_tool_chat/web/common/footer.jsp
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/web/common/footer.jsp (.../footer.jsp) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/web/common/footer.jsp (.../footer.jsp) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -1 +1 @@
-Copyright (C) 2006 LAMS Foundation (http://lamsfoundation.org
\ No newline at end of file
+Copyright (C) 2006 LAMS Foundation (http://lamsfoundation.org
Index: lams_tool_chat/web/common/header.jsp
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/web/common/header.jsp (.../header.jsp) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/web/common/header.jsp (.../header.jsp) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -8,14 +8,14 @@
-
- Chat Title, TODO please to use application resources
+
-
+
-
-
+
+
-
\ No newline at end of file
+
+
Index: lams_tool_chat/web/common/taglibs.jsp
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/web/common/taglibs.jsp (.../taglibs.jsp) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/web/common/taglibs.jsp (.../taglibs.jsp) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -8,4 +8,3 @@
<%@ taglib uri="tags-fmt" prefix="fmt"%>
<%@ taglib uri="tags-lams" prefix="lams"%>
<%@ taglib uri="fck-editor" prefix="fck"%>
-
Index: lams_tool_chat/web/includes/javascript/fckcontroller.js
===================================================================
diff -u
--- lams_tool_chat/web/includes/javascript/fckcontroller.js (revision 0)
+++ lams_tool_chat/web/includes/javascript/fckcontroller.js (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -0,0 +1,212 @@
+var activeEditorIndex = 0;
+var oFCKeditor;
+
+//whether to initialise the editor in textarea mode or preview mode
+function initEditor(index){
+ var textareaElement = document.getElementById("tx" + index + ".textarea")
+ if(textareaElement == null)
+ return;
+ var text = textareaElement.value;
+
+ if(containsHTML(text)){
+ var previewTextElement = document.getElementById("preview" + index + ".text");
+ var previewText = document.getElementById("tx" + index + ".textarea").value;
+ previewTextElement.innerHTML = previewText;
+
+ hideElementById("tx"+index);
+ showElementById("preview"+index);
+ }
+ else{
+ hideElementById("preview"+index);
+ showElementById("tx"+index);
+ }
+}
+
+// FCKeditor_OnComplete is a special function that is called when an editor
+// instance is loaded ad available to the API. It must be named exactly in
+// this way.
+function FCKeditor_OnComplete( editorInstance )
+{
+ //hideElementById("wyswygEditorScreen");
+}
+
+
+function SetContents(content)
+{
+ // Get the editor instance that we want to interact with.
+ var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
+
+ // Set the editor contents (replace the actual one).
+ oEditor.SetHTML(content) ;
+}
+
+
+function doWYSWYGEdit(index, size){
+
+ var oEditor;
+ try {
+ oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
+ }
+ catch(error) {
+ //browsers like opera can't resolve the FCKeditorAPI classes
+ alert("The browser you are using doesn't support Rich Text Editor, Please use a supported browser instead.");
+ return;
+ }
+
+ if(activeEditorIndex != index && activeEditorIndex != 0){
+ saveWYSWYGEdittedText(activeEditorIndex); //save the existing content
+ doPreview(activeEditorIndex); //update preview panel
+ }
+
+ activeEditorIndex = index;
+
+ //hide html editor
+ doPreview(index);
+
+ var previewElement = document.getElementById("preview" + index + ".text");
+ var posX = findPosX(previewElement);
+ var posY = findPosY(previewElement);
+
+ var text = document.getElementById("tx" + index + ".textarea").value;
+
+ oEditor.SetHTML(text) ;
+
+ wyswygEditorScreenElement = document.getElementById("wyswygEditorScreen");
+ wyswygEditorScreenElement.style.top = posY + "px";
+ wyswygEditorScreenElement.style.left = posX + "px";
+
+ //resize the fck editor
+ fckFrameElement = document.getElementById("FCKeditor1___Frame");
+ if (size == "small") {
+ fckFrameElement.style.height = "100px";
+ wyswygEditorScreenElement.style.height = "120px";
+ } else {
+ fckFrameElement.style.height = "200px";
+ wyswygEditorScreenElement.style.height = "220px";
+ }
+
+ showElementById("wyswygEditorScreen");
+
+
+ showElementById("wyswygEditorScreen");
+}
+
+//convert the text to HTML first,
+function doTextToHTML(index){
+ var textareaElement = document.getElementById("tx" + index + ".textarea");
+ var text = covertTextToHTML(textareaElement.value);
+ textareaElement.value = text;
+}
+
+function saveWYSWYGEdittedText(index){
+ var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
+ var text = oEditor.GetXHTML( true )
+
+
+ var htmlEditorElement = document.getElementById("tx" + index + ".textarea");
+ htmlEditorElement.value = text;
+
+}
+
+function doEdit(index){
+ hideElementById("wyswygEditorScreen");
+ hideElementById("preview"+index);
+ showElementById("tx"+index);
+}
+
+function doPreview(index){
+ var previewTextElement = document.getElementById("preview" + index + ".text");
+ var previewText = document.getElementById("tx" + index + ".textarea").value;
+ previewTextElement.innerHTML = previewText;
+
+ hideElementById("wyswygEditorScreen");
+ hideElementById("tx"+index);
+ showElementById("preview"+index);
+}
+
+
+/*** show/hide Elements ***/
+function showElement(element) {
+ element.style.visibility = 'visible';
+ element.style.display = "block";
+}
+function hideElement(element) {
+ element.style.visibility = 'hidden';
+ element.style.display = "none";
+}
+
+function showElementById(id) {
+ var element = document.getElementById(id);
+ showElement(element);
+}
+
+function hideElementById(id) {
+ var element = document.getElementById(id);
+ hideElement(element);
+}
+
+
+/*** findPosX and findPoxY functions are use to locate the x,y location of an element ***/
+function findPosX(obj) {
+ var curleft = 0;
+ if(obj.offsetParent)
+ while(1)
+ {
+ curleft += obj.offsetLeft;
+ if(!obj.offsetParent)
+ break;
+ obj = obj.offsetParent;
+ }
+ else if(obj.x)
+ curleft += obj.x;
+ return curleft;
+}
+
+function findPosY(obj) {
+ var curtop = 0;
+ if(obj.offsetParent)
+ while(1)
+ {
+ curtop += obj.offsetTop;
+ if(!obj.offsetParent)
+ break;
+ obj = obj.offsetParent;
+ }
+ else if(obj.y)
+ curtop += obj.y;
+ return curtop;
+}
+
+/**** Using the regular expressions defined below to convert Text to HTML ****/
+var NEWLINE = "
";
+var GREATER = ">";
+var LESSER = "<";
+//var SPACE = " ";
+
+var RE_ESCAPE_NEWLINE = new RegExp("\n", "g");
+var RE_ESCAPE_GREATER = new RegExp(">", "g");
+var RE_ESCAPE_LESSER = new RegExp("<", "g");
+//var RE_ESCAPE_SPACE = new RegExp(" ", "g");
+
+var RE_HTML_TAG = new RegExp("<.*>|" + LESSER + "|" + GREATER);
+
+function covertTextToHTML(str){
+ return str.replace(RE_ESCAPE_GREATER, GREATER)
+ .replace(RE_ESCAPE_LESSER, LESSER)
+ .replace(RE_ESCAPE_NEWLINE, NEWLINE);
+
+ //.replace(RE_ESCAPE_SPACE, SPACE)
+}
+
+/**** Detect whether HTML was used */
+function containsHTML(str){
+ return (str.match(RE_HTML_TAG) != null)? true:false;
+}
+
+
+
+/*** implement the event onSelectTab() which gets trigger when tabs is changed ***/
+function onSelectTab(tabID){
+ //hide all active editors
+ doPreview(activeEditorIndex);
+}
\ No newline at end of file
Index: lams_tool_chat/web/includes/javascript/tabcontroller.js
===================================================================
diff -u
--- lams_tool_chat/web/includes/javascript/tabcontroller.js (revision 0)
+++ lams_tool_chat/web/includes/javascript/tabcontroller.js (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -0,0 +1,52 @@
+var tabSize = 0;
+var selectedTabID = 0;
+
+/* Initialise the number of tabs in the page */
+function initTabSize(size){
+ tabSize = size;
+}
+
+function selectTab(tabID) {
+
+ if(selectedTabID == tabID)
+ return;
+
+ if(selectedTabID == 0)
+ selectedTabID = tabID;
+
+ //change the old tab's class
+ document.getElementById("tab" + selectedTabID).className = "tab tabcentre";
+ //swap images of side parts
+ var tl = document.getElementById("tableft_"+selectedTabID);
+ tl.src= imgRoot + themeName + "_tab_left.gif";
+ tl.height = 22;
+ var tr = document.getElementById("tabright_"+selectedTabID);
+ tr.src= imgRoot + themeName + "_tab_right.gif";
+ tr.height = 22;
+
+ //change the new tab's class
+ document.getElementById("tab" + tabID).className = "tab tabcentre_selected";
+ var tl = document.getElementById("tableft_"+tabID);
+ tl.src= imgRoot + themeName + "_tab_s_left.gif";
+ tl.height = 25;
+ var tr = document.getElementById("tabright_"+tabID);
+ tr.src= imgRoot + themeName + "_tab_s_right.gif";
+ tr.height = 25;
+
+ //save tabID as selectedTabID
+ selectedTabID = tabID;
+
+ //switch the the selected tab on
+ for(i = 1; i <= tabSize; i++) {
+ document.getElementById("tabbody" + i).style.display = (i == tabID) ? 'block':'none';
+ }
+
+
+ try{
+ //trigger the custom event listener onSelectTab()
+ onSelectTab(tabID);
+ }
+ catch (error){
+ //catch reference error when onSelectTab() is not defined
+ }
+}
\ No newline at end of file
Index: lams_tool_chat/web/layouts/defaultLayout.jsp
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/web/layouts/defaultLayout.jsp (.../defaultLayout.jsp) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/web/layouts/defaultLayout.jsp (.../defaultLayout.jsp) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -1,6 +1,6 @@
<%@ include file="/common/taglibs.jsp"%>
-
Index: lams_tool_chat/web/layouts/tabLayout.jsp
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/web/layouts/tabLayout.jsp (.../tabLayout.jsp) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/web/layouts/tabLayout.jsp (.../tabLayout.jsp) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -1 +1,16 @@
+<%@ include file="/common/taglibs.jsp"%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_chat/web/pages/authoring/advanced.jsp
===================================================================
diff -u
--- lams_tool_chat/web/pages/authoring/advanced.jsp (revision 0)
+++ lams_tool_chat/web/pages/authoring/advanced.jsp (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -0,0 +1 @@
+this is advanced
\ No newline at end of file
Index: lams_tool_chat/web/pages/authoring/authoring.jsp
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -1 +1,13 @@
- This is a dummy authoring page.
+<%@ include file="/common/taglibs.jsp"%>
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_chat/web/pages/authoring/basic.jsp
===================================================================
diff -u
--- lams_tool_chat/web/pages/authoring/basic.jsp (revision 0)
+++ lams_tool_chat/web/pages/authoring/basic.jsp (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -0,0 +1 @@
+this is basic
\ No newline at end of file
Index: lams_tool_chat/web/pages/authoring/instructions.jsp
===================================================================
diff -u
--- lams_tool_chat/web/pages/authoring/instructions.jsp (revision 0)
+++ lams_tool_chat/web/pages/authoring/instructions.jsp (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -0,0 +1 @@
+this is instructions
\ No newline at end of file
Index: lams_tool_chat/web/pages/authoring/script.jsp
===================================================================
diff -u
--- lams_tool_chat/web/pages/authoring/script.jsp (revision 0)
+++ lams_tool_chat/web/pages/authoring/script.jsp (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -0,0 +1,36 @@
+<%@ include file="/common/taglibs.jsp"%>
+
+
+
+
+
+<%-- Authoring Script --%>
+
+
+
Index: lams_tool_chat/web/pages/monitoring/editActivity.jsp
===================================================================
diff -u
--- lams_tool_chat/web/pages/monitoring/editActivity.jsp (revision 0)
+++ lams_tool_chat/web/pages/monitoring/editActivity.jsp (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -0,0 +1 @@
+ this is edit acitivity
\ No newline at end of file
Index: lams_tool_chat/web/pages/monitoring/instructions.jsp
===================================================================
diff -u
--- lams_tool_chat/web/pages/monitoring/instructions.jsp (revision 0)
+++ lams_tool_chat/web/pages/monitoring/instructions.jsp (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -0,0 +1 @@
+ this is instructions
\ No newline at end of file
Index: lams_tool_chat/web/pages/monitoring/monitoring.jsp
===================================================================
diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r8d5c540b1da67b18a80b3145c81c1ce04c2c17b2
--- lams_tool_chat/web/pages/monitoring/monitoring.jsp (.../monitoring.jsp) (revision ed16d5f8991580c9160628f30a49e947a0b154bb)
+++ lams_tool_chat/web/pages/monitoring/monitoring.jsp (.../monitoring.jsp) (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -1 +1,15 @@
- This is a dummy monitoring page.
\ No newline at end of file
+<%@ include file="/common/taglibs.jsp"%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: lams_tool_chat/web/pages/monitoring/script.jsp
===================================================================
diff -u
--- lams_tool_chat/web/pages/monitoring/script.jsp (revision 0)
+++ lams_tool_chat/web/pages/monitoring/script.jsp (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -0,0 +1,35 @@
+<%@ include file="/common/taglibs.jsp"%>
+
+
+
+
+
+<%-- Monitoring Script --%>
+
+
\ No newline at end of file
Index: lams_tool_chat/web/pages/monitoring/statistics.jsp
===================================================================
diff -u
--- lams_tool_chat/web/pages/monitoring/statistics.jsp (revision 0)
+++ lams_tool_chat/web/pages/monitoring/statistics.jsp (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -0,0 +1 @@
+ this is statistics
\ No newline at end of file
Index: lams_tool_chat/web/pages/monitoring/summary.jsp
===================================================================
diff -u
--- lams_tool_chat/web/pages/monitoring/summary.jsp (revision 0)
+++ lams_tool_chat/web/pages/monitoring/summary.jsp (revision 8d5c540b1da67b18a80b3145c81c1ce04c2c17b2)
@@ -0,0 +1 @@
+ this is summary
\ No newline at end of file