~ubuntu-branches/ubuntu/trusty/jwchat/trusty

« back to all changes in this revision

Viewing changes to userhist.html.en

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2008-08-24 15:02:53 UTC
  • mfrom: (3.1.4 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080824150253-h0z39rzjmo4lc1k5
Tags: 1.0beta3-3
* Clean up README.Debian. (Closes: #481320)
* Add brazilian debconf messages translation. (Closes: #481522)
* Add swedish debconf messages translation. (Closes: #494887)
* Add italian debconf messages translation. (Closes: #495780)
* Add russian debconf messages translation. (Closes: #495573)
* Add finnish debconf messages translation. (Closes: #496227)

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
    <script src="emoticons.js"></script>
8
8
    <script src="switchStyle.js"></script>
9
9
    <script src="xmlextras.js"></script>
10
 
    <script src="JSJaCPacket.js"></script>
 
10
    <script src="jsjac.js"></script>
11
11
    <script>
12
12
      <!--
13
 
function reloadHistory() {
 
13
function reloadHistory(iq) {
 
14
 
 
15
        if (iq && iq.getType != 'result')
 
16
                srcW.Debug.log(iq.xml(),1);
 
17
 
14
18
        // clear iframes
15
19
        selected_collection.document.body.innerHTML = '';
16
20
        collections.document.body.innerHTML = '';
19
23
        var aIQ = new JSJaCIQ();
20
24
        aIQ.setType('get');
21
25
        aIQ.setTo(srcW.loghost);
22
 
        var aNode = aIQ.getNode().appendChild(aIQ.getDoc().createElement('archive'));
23
 
        aNode.setAttribute('jid',jid);
 
26
        var aNode = aIQ.getNode().appendChild(aIQ.getDoc().createElement('list'));
 
27
        aNode.setAttribute('xmlns','http://jabber.org/protocol/archive');
 
28
        aNode.setAttribute('with',jid);
24
29
        srcW.con.send(aIQ,me.handleCollsGet);
25
30
 
26
31
        return false;
30
35
        if (!iq || iq.getType() != 'result')
31
36
                return;
32
37
 
33
 
        srcW.Debug.log(iq.getDoc().xml,2);
 
38
        srcW.Debug.log(iq.xml(),2);
34
39
 
35
 
        //selected_collection.document.body.innerHTML = '';
36
40
        var histHTML = '';
37
41
 
38
 
        for (var i=0; i<iq.getNode().firstChild.getElementsByTagName('message').length; i++) {
39
 
 
40
 
                var msg = JSJaCPWrapNode(iq.getNode().firstChild.getElementsByTagName('message').item(i));
41
 
                if (msg.getTo() != null) // message from me
 
42
        var aStore = iq.getNode().firstChild;
 
43
        for (var i=0; i<aStore.childNodes.length; i++) {
 
44
                var aChild = aStore.childNodes.item(i);
 
45
                if (aChild.nodeName == 'to') // message from me
42
46
                        histHTML += "<font color=\"blue\">&lt;" + srcW.nick + "&gt;</font> ";
43
47
                else
44
48
                        histHTML += "<font color=\"red\">&lt;" + user.name + "&gt;</font> ";
45
49
 
46
 
                histHTML += msg.getBody() + '<br>';
 
50
                if (aChild.firstChild.firstChild)
 
51
                        histHTML += htmlEnc(aChild.firstChild.firstChild.nodeValue);
 
52
                histHTML += '<br>';
47
53
                continue;
48
54
        }
49
 
        selected_collection.document.body.innerHTML = histHTML;
 
55
        selected_collection.document.body.innerHTML = histHTML;
50
56
}
51
57
 
52
58
function handleCollsGet(iq) {
55
61
 
56
62
        srcW.Debug.log(iq.getDoc().xml,2);
57
63
 
58
 
        var items = iq.getNode().firstChild.getElementsByTagName('item');
 
64
        var items = iq.getNode().firstChild.getElementsByTagName('store');
59
65
 
60
66
        var myTable = collections.document.createElement("TABLE");
61
67
        var myTableBody = collections.document.createElement("TBODY");
67
73
 
68
74
                var item = items.item(i);
69
75
 
70
 
                if (cutResource(item.getAttribute('jid')) != cutResource(jid)) // skip
71
 
                        continue;
72
 
                
73
76
                row = collections.document.createElement("TR");
74
 
                row.setAttribute("cid",item.getAttribute('cid'));
 
77
                row.setAttribute("start",item.getAttribute('start'));
75
78
                myTableBody.appendChild(row);
76
79
 
77
80
                cell = collections.document.createElement("TD");
96
99
        collections.init();
97
100
}
98
101
 
 
102
function deleteHistory() {
 
103
        if (!confirm("Are you sure you want to delete this chat history completely?"))
 
104
                return;
 
105
 
 
106
        var aIQ = new JSJaCIQ();
 
107
        aIQ.setType('set');
 
108
        aIQ.setTo(srcW.loghost);
 
109
        var aNode = aIQ.getNode().appendChild(aIQ.getDoc().createElement('remove'));
 
110
        aNode.setAttribute('xmlns','http://jabber.org/protocol/archive');
 
111
        aNode.setAttribute('with',jid);
 
112
        
 
113
        srcW.Debug.log(aIQ.xml(),2);
 
114
 
 
115
        me = this;
 
116
        srcW.con.send(aIQ,me.reloadHistory);
 
117
}
 
118
 
99
119
var srcW;
100
120
function init() {
101
121
        // determine source window
122
142
        var aIQ = new JSJaCIQ();
123
143
        aIQ.setType('get');
124
144
        aIQ.setTo(srcW.loghost);
125
 
        var aNode = aIQ.getNode().appendChild(aIQ.getDoc().createElement('archive'));
 
145
        var aNode = aIQ.getNode().appendChild(aIQ.getDoc().createElement('list'));
126
146
        aNode.setAttribute('xmlns','http://jabber.org/protocol/archive');
127
 
        aNode.setAttribute('jid',jid);
 
147
        aNode.setAttribute('with',jid);
128
148
        me = this;
129
149
        srcW.con.send(aIQ,me.handleCollsGet);
130
150
}
148
168
  <body style="margin:8px;">
149
169
                <table width="100%" height="100%" border=0>
150
170
                                <tr>
151
 
                                        <td><h2 id="title"></h2></td><td align="right"><button onClick="return reloadHistory();">Refresh</td>
 
171
                                        <td><h2 id="title"></h2></td><td align="right"><button onClick="deleteHistory();">Delete</button> <button onClick="reloadHistory();">Refresh</td>
152
172
                                </tr>
153
173
                                <tr height="100%">
154
174
                                        <td>