');
+
+ return completeElem = $('').append(fromElem).append(msgElem);
+}
+
+function resizeChat() {
+ // refresh the window height
+ windowHeight = $(window).height() - 30;
+
+ // if presence is shown
+ if (presenceShown) {
+ // set presence chat to maximized height
+ presenceChat.css({
+ 'top' : windowHeight - 270 + "px"
+ });
+ }
+ // otherwise
+ else {
+ // set presence chat to minimized height
+ presenceChat.css({
+ 'top' : windowHeight + "px"
+ });
+ }
+
+ $("#presenceChatWarning").css({
+ 'top' : windowHeight - 10 + "px"
+ });
+}
+
+function getUserFromTabIndex(tabIndex) {
+ var tabLabelsLocal = $(".ui-tabs-label");
+ var label = tabLabelsLocal[tabIndex].innerHTML;
+
+ if (label == groupChatInfo.nick) {
+ return groupChatInfo.nick;
+ } else {
+ for ( var i = 0; i < roster.users.length; i++) {
+ if (roster.users[i] == label) {
+ return roster.users[i];
+ }
+ }
+ }
+
+ return null;
+}
+
+function addTab(nick, tag) {
+ // add a tab with the the nick specified
+ presenceChatTabs.tabs('add', '#' + tag,
+ createPrivateTabLabel(nick, tag));
+ // add the content
+ $("#" + tag).html(createPrivateTabContent(nick, tag));
+}
+
+function nickToTag(nick) {
+ return nick == groupChatInfo.nick ? groupChatInfo.tag : nick.replace(/ /g, "_");
+}
+
+function nickToMessageArea(nick) {
+ return nickToTag(nick) + '_messageArea';
+}
+
+function tagToListing(tag) {
+ return tag + '_listing';
+}
+
+function tagToTabLabel(tag) {
+ return tag + '_tabLabel';
+}
+
+function getTime() {
+ var currentTime = new Date();
+ var hours = currentTime.getHours();
+ var minutes = currentTime.getMinutes();
+ var seconds = currentTime.getSeconds();
+
+ if (hours < 10) {
+ hours = "0" + hours;
+ }
+
+ if (minutes < 10) {
+ minutes = "0" + minutes;
+ }
+
+ if (seconds < 10) {
+ seconds = "0" + seconds;
+ }
+
+ return "(" + hours + ":" + minutes + ":" + seconds + ")";
+}
+
+/* ******* Main chat functions ******* */
+
+function sendMessage(receiver) {
+ var tag = nickToTag(receiver);
+ var messageInput = $('#' + tag + '_messageInput');
+ var message = messageInput.val();
+ if (!message || message == '') {
+ return false; // do not send empty messages.
+ }
+
+ messageInput.val('');
+ messageInput.focus();
+
+ $.ajax({
+ url : actionUrl,
+ data : {'method' : 'sendMessage',
+ 'lessonID' : lessonId,
+ 'from' : nickname,
+ 'to' : tag == groupChatInfo.tag ? null : receiver,
+ 'message' : message
+ },
+ cache : false,
+ complete : updateChat
+ });
+}
+
+function updateChat(){
+ // skip another attempt if previous did not return yet (slow server?)
+ if (!pollInProgress) {
+ pollInProgress = true;
+ var selected = presenceChatTabs.tabs('option','selected');
+ var from = getUserFromTabIndex(selected);
+ if (groupChatInfo.nick == from) {
+ from = null;
+ }
+
+ $.ajax({
+ url : actionUrl,
+ data : {'method' : 'getChatContent',
+ 'lessonID' : lessonId,
+ 'presenceShown' : presenceShown,
+ 'lastMessageUid' : roster.lastMessageUids[from ? from : 'group'],
+ 'to' : nickname,
+ 'from' : from
+ },
+ cache : false,
+ dataType : 'json',
+ complete : function(){
+ pollInProgress = false;
+ },
+ success : function (result) {
+ roster.updateDisplay(result.roster);
+
+ // real new messages for the opentab
+ if (result.messages) {
+ var messageArea = $("#" + (nickToMessageArea(from ? from : groupChatInfo.tag)));
+ var lastMessageUid = null;
+ jQuery.each(result.messages, function(){
+ messageArea.append(generateMessageHTML(this.from, this.message, this.dateSent));
+ lastMessageUid = this.uid;
+ });
+ // store last message uid and get new messages starting from this one
+ roster.lastMessageUids[from ? from : 'group'] = lastMessageUid;
+ messageArea.scrollTop(messageArea.prop('scrollHeight'));
+ }
+
+ // check if other users wrote something new
+ if (result.newConversations) {
+ var selectedTabTag = nickToTag(getUserFromTabIndex(selected));
+ jQuery.each(result.newConversations, function(index, nick){
+ var tag = nick == 'group' ? groupChatInfo.tag : nickToTag(nick);
+ if (tag != selectedTabTag) {
+ var tab = $("#" + tagToTabLabel(tag));
+ if (tab.length == 0) {
+ addTab(this, tag);
+ tab = $("#" + tagToTabLabel(tag));
+ }
+
+ // notify of new message
+ tab.addClass('presenceTabNewMessage');
+ if (tag != groupChatInfo.tag) {
+ $("#" + tagToListing(tag)).addClass('presenceListingNewMessage');
+ }
+ }
+ });
+ }
+ }
+ });
+ }
+}
+
+
+/* ******* Click handlers ******* */
+
+
+function handleCloseTab(label){
+ var tabLabelsLocal = $(".ui-tabs-label");
+ for (var i = 0; i < tabLabelsLocal.length; i++){
+ if(tabLabelsLocal[i].innerHTML == label){
+ presenceChatTabs.tabs('remove' , i);
+ roster.lastMessageUids[label] = null;
+ }
+ }
+}
+
+function handleLeftScrollClick(){
+ presenceChatTabs.tabs('scrollLeft');
+}
+
+function handleRightScrollClick(){
+ presenceChatTabs.tabs('scrollRight');
+}
+
+function handlePresenceClick() {
+ if (presenceShown) {
+ presenceChat.animate({
+ top : windowHeight + "px"
+ }, 1000);
+ minMaxIcon.attr("src", lamsUrl + "images/icons/bullet_arrow_top.png")
+ presenceShown = false;
+ } else {
+ presenceChat.animate({
+ top : windowHeight - 270 + "px"
+ }, 1000);
+ minMaxIcon.attr("src", lamsUrl + "images/icons/bullet_arrow_bottom.png");
+ presenceShown = true;
+ }
+}
+
+function handleMessageInput(e, nick) {
+ if (e.which == 13) {
+ e.preventDefault();
+ sendMessage(nick);
+ }
+}
\ No newline at end of file
Index: lams_learning/web/includes/jquery-contextmenu/images/cut.png
===================================================================
diff -u -r35a0e719d061c08b52e705135bb2f2126079ed21 -re64a90c0cc74118c5b88f5cbae323065abd59cac
Binary files differ
Index: lams_learning/web/includes/jquery-contextmenu/images/door.png
===================================================================
diff -u -r35a0e719d061c08b52e705135bb2f2126079ed21 -re64a90c0cc74118c5b88f5cbae323065abd59cac
Binary files differ
Index: lams_learning/web/includes/jquery-contextmenu/images/page_white_copy.png
===================================================================
diff -u -r35a0e719d061c08b52e705135bb2f2126079ed21 -re64a90c0cc74118c5b88f5cbae323065abd59cac
Binary files differ
Index: lams_learning/web/includes/jquery-contextmenu/images/page_white_delete.png
===================================================================
diff -u -r35a0e719d061c08b52e705135bb2f2126079ed21 -re64a90c0cc74118c5b88f5cbae323065abd59cac
Binary files differ
Index: lams_learning/web/includes/jquery-contextmenu/images/page_white_edit.png
===================================================================
diff -u -r35a0e719d061c08b52e705135bb2f2126079ed21 -re64a90c0cc74118c5b88f5cbae323065abd59cac
Binary files differ
Index: lams_learning/web/includes/jquery-contextmenu/images/page_white_paste.png
===================================================================
diff -u -r35a0e719d061c08b52e705135bb2f2126079ed21 -re64a90c0cc74118c5b88f5cbae323065abd59cac
Binary files differ
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jquery-contextmenu/jquery.contextMenu.css'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jquery-contextmenu/jquery.contextMenu.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jquery-contextmenu/jqueryContextMenu.html'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/AUTHORS'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/COPYING'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/ChangeLog'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/MPL-1.1.txt'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/Makefile'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/README'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/examples/simpleclient.html'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/gpl-2.0.txt'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/jsjac.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/jsjac.packed.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/lgpl-2.1.txt'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/JSJaC.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/JSJaCBuilder.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/JSJaCConfig.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/JSJaCConnection.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/JSJaCConsoleLogger.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/JSJaCConstants.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/JSJaCCookie.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/JSJaCError.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/JSJaCHttpBindingConnection.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/JSJaCHttpPollingConnection.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/JSJaCJID.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/JSJaCJSON.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/JSJaCKeys.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/JSJaCPacket.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/Makefile'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/crypt.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/header.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/jsextras.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/jsjac-1.3.1/src/xmlextras.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/presence.css'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/presence.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag e64a90c0cc74118c5b88f5cbae323065abd59cac refers to a dead (removed) revision in file `lams_learning/web/includes/presenceChat.jsp'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_learning/web/lessonChat.jsp
===================================================================
diff -u -r35a0e719d061c08b52e705135bb2f2126079ed21 -re64a90c0cc74118c5b88f5cbae323065abd59cac
--- lams_learning/web/lessonChat.jsp (.../lessonChat.jsp) (revision 35a0e719d061c08b52e705135bb2f2126079ed21)
+++ lams_learning/web/lessonChat.jsp (.../lessonChat.jsp) (revision e64a90c0cc74118c5b88f5cbae323065abd59cac)
@@ -52,12 +52,8 @@
- <%
- String jabberServer = Configuration.get(ConfigurationKeys.XMPP_DOMAIN);
- %>
- <%=jabberServer%>
- <%@ include file="/includes/presenceChat.jsp" %>
+ <%@ include file="presenceChat.jsp" %>
Index: lams_learning/web/mainflash.jsp
===================================================================
diff -u -r35a0e719d061c08b52e705135bb2f2126079ed21 -re64a90c0cc74118c5b88f5cbae323065abd59cac
--- lams_learning/web/mainflash.jsp (.../mainflash.jsp) (revision 35a0e719d061c08b52e705135bb2f2126079ed21)
+++ lams_learning/web/mainflash.jsp (.../mainflash.jsp) (revision e64a90c0cc74118c5b88f5cbae323065abd59cac)
@@ -166,11 +166,10 @@
String clientVersion = Configuration.get(ConfigurationKeys.LEARNER_CLIENT_VERSION);
String serverLanguage = Configuration.get(ConfigurationKeys.SERVER_LANGUAGE);
String languageDate = Configuration.get(ConfigurationKeys.DICTIONARY_DATE_CREATED);
- String jabberServer = Configuration.get(ConfigurationKeys.XMPP_DOMAIN);
%>
- ?userID=&firstName=&lastName=&serverURL=&presenceServerUrl=<%=jabberServer%>&build=<%=clientVersion%>&lang=&country=&langDate=<%=languageDate%>&theme=&lessonID=&uniqueID=&mode=
+ ?userID=&firstName=&lastName=&serverURL=&build=<%=clientVersion%>&lang=&country=&langDate=<%=languageDate%>&theme=&lessonID=&uniqueID=&mode=lams_learnerlams_learner.swf
@@ -209,9 +208,8 @@
-
- <%@ include file="/includes/presenceChat.jsp" %>
+ <%@ include file="presenceChat.jsp" %>
" scrolling="auto">
Index: lams_learning/web/mainnoflash.jsp
===================================================================
diff -u -r35a0e719d061c08b52e705135bb2f2126079ed21 -re64a90c0cc74118c5b88f5cbae323065abd59cac
--- lams_learning/web/mainnoflash.jsp (.../mainnoflash.jsp) (revision 35a0e719d061c08b52e705135bb2f2126079ed21)
+++ lams_learning/web/mainnoflash.jsp (.../mainnoflash.jsp) (revision e64a90c0cc74118c5b88f5cbae323065abd59cac)
@@ -68,10 +68,9 @@
')">
-
-
+
- <%@ include file="/includes/presenceChat.jsp" %>
+ <%@ include file="presenceChat.jsp" %>
" width="100%" >
Index: lams_learning/web/presenceChat.jsp
===================================================================
diff -u
--- lams_learning/web/presenceChat.jsp (revision 0)
+++ lams_learning/web/presenceChat.jsp (revision e64a90c0cc74118c5b88f5cbae323065abd59cac)
@@ -0,0 +1,143 @@
+<%-- css --%>
+
+
+
+<%-- javascript --%>
+
+
+
+
+
+<%-- initial html / presence.js adds on html into here --%>
+
+ <%-- only pop the message box if im is enabled --%>
+
+