qsos-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qsos-commits] qsos/apps/xuleditor/chrome/content editor.js


From: Raphaël Semeteys
Subject: [Qsos-commits] qsos/apps/xuleditor/chrome/content editor.js
Date: Thu, 15 Feb 2007 07:11:41 +0000

CVSROOT:        /sources/qsos
Module name:    qsos
Changes by:     Raphaël Semeteys <rsemeteys>   07/02/15 07:11:41

Modified files:
        apps/xuleditor/chrome/content: editor.js 

Log message:
        XMPP features: not finished
        Sync between critria and graphs

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qsos/apps/xuleditor/chrome/content/editor.js?cvsroot=qsos&r1=1.17&r2=1.18

Patches:
Index: editor.js
===================================================================
RCS file: /sources/qsos/qsos/apps/xuleditor/chrome/content/editor.js,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- editor.js   9 Feb 2007 10:53:02 -0000       1.17
+++ editor.js   15 Feb 2007 07:11:41 -0000      1.18
@@ -32,6 +32,10 @@
 //Localized strings bundle
 var strbundle;
 
+//XMPP account init
+var account = { jid: undefined };
+var chatroom;
+
 //Window initialization after loading
 function init() {
     strbundle = document.getElementById("properties");
@@ -49,6 +53,46 @@
     if (url) {
        openRemoteFile(url)
     }
+
+    //Chat stuff
+
+    channel = XMPP.createChannel(
+        <query xmlns="http://jabber.org/protocol/disco#info";>
+        <feature var="http://jabber.org/protocol/muc"/>
+        <feature var="http://jabber.org/protocol/muc#user"/>
+        <feature var='http://jabber.org/protocol/xhtml-im'/>
+        </query>);
+
+    channel.on(
+        {event: 'message'},
+        function(message) {
+            var conversation = document.getElementById('conversation');
+            conversation.value +=
+                (message.direction == 'out' ? 'Me' : address@hidden) + ' : ' +
+                message.stanza.body + '\n';
+            conversation.scrollTop += conversation.scrollHeight - 
conversation.clientHeight;
+            //document.getElementById('conversation').scrollIntoView(false);
+        });
+
+    XMPP.cache.presenceIn.forEach(receivedPresence);
+
+    var prefManager = Components.classes["@mozilla.org/preferences-service;1"]
+            .getService(Components.interfaces.nsIPrefBranch);
+    chatroom = prefManager.getCharPref("extensions.qsos-xuled.chatroom");
+
+    XMPP.send(account,
+      <presence to={chatroom + '/address@hidden'}>
+        <x xmlns='http://jabber.org/protocol/muc'/>
+      </presence>);
+}
+
+function receivedPresence(presence) {
+  document.getElementById("roster").value += address@hidden + '\n';
+}
+
+function send() {
+    var input = document.getElementById('input').value;
+    XMPP.send(account, <message to={chatroom} 
type='groupchat'><body>{input}</body></message>);
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -497,9 +541,32 @@
        
                document.getElementById("f-c-comments").value = 
myDoc.getkeycomment(id);
                freezeComments("");
+
+                if (myDoc.hassubelements(id)) {
+                        drawChart(id);
+                } else {
+                        if (document.getElementById("t-s").selectedIndex == 1) 
{
+                                var parentId = myDoc.getparent(id);
+                                if (parentId) drawChart(parentId);
+                        }
+                }
        }
 }
 
+function selectItem(id) {
+        expandTree(true);
+        tree = document.getElementById("mytree");
+        for(i=0; i < tree.view.rowCount; i++) {
+                currentId = 
tree.view.getItemAtIndex(i).firstChild.firstChild.getAttribute("id");
+                if (currentId == id) {
+                          tree.view.selection.select(i);
+                          if (document.getElementById("t-s").selectedIndex != 
1) tree.treeBoxObject.scrollToRow(i);
+                          break;
+                }
+        }
+}
+
+
 //Triggered when software name is modified
 function changeAppName(xulelement) {
        docChanged = "true";
@@ -684,7 +751,7 @@
        var label = document.getElementById("chart-label");
        var newLabel = document.createElement("label");
        newLabel.setAttribute("value", ">  " + myDoc.getkeytitle(name));
-       newLabel.setAttribute("onclick", "drawChart(\"" + name + "\")");
+       newLabel.setAttribute("onclick", "selectItem(\"" + name + "\"); 
drawChart(\"" + name + "\")");
        newLabel.style.cursor = "pointer";
 
        if (marker) {
@@ -774,9 +841,12 @@
        }
        
        if (myScore.children) {
-               myText.setAttribute("onclick", "drawChart(\"" + myScore.name + 
"\")");
-               myText.style.cursor = "pointer";
+               myText.setAttribute("onclick", "selectItem(\"" + myScore.name + 
"\"); drawChart(\"" + myScore.name + "\")");    
+       } else {
+               myText.setAttribute("onclick", "selectItem(\"" + myScore.name + 
"\"); document.getElementById('t-s').selectedIndex = 1");
        }       
+       myText.style.cursor = "pointer";
+
 
        myText.appendChild(document.createTextNode(myScore.title));
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]