1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<title>JWChat - Storico</title>
5
<meta http-equiv="content-type" content="text/html; charset=utf-8">
6
<script src="shared.js"></script>
7
<script src="emoticons.js"></script>
8
<script src="switchStyle.js"></script>
9
<script src="jsjac.js"></script>
12
function reloadHistory(iq) {
14
if (iq && iq.getType != 'result')
15
srcW.Debug.log(iq.xml(),1);
18
selected_collection.document.body.innerHTML = '';
19
collections.document.body.innerHTML = '';
22
var aIQ = new JSJaCIQ();
24
aIQ.setTo(srcW.loghost);
25
var aNode = aIQ.appendNode(
27
{'xmlns': 'http://jabber.org/protocol/archive',
29
srcW.con.send(aIQ,me.handleCollsGet);
34
function handleCollGet(iq) {
35
if (!iq || iq.getType() != 'result')
38
srcW.Debug.log(iq.xml(),2);
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
46
histHTML += "<font color=\"blue\"><" + srcW.nick + "></font> ";
48
histHTML += "<font color=\"red\"><" + user.name + "></font> ";
50
if (aChild.firstChild.firstChild)
51
histHTML += htmlEnc(aChild.firstChild.firstChild.nodeValue);
55
selected_collection.document.body.innerHTML = histHTML;
58
function handleCollsGet(iq) {
59
if (!iq || iq.getType() != 'result')
62
srcW.Debug.log(iq.getDoc().xml,2);
64
var items = iq.getNode().firstChild.getElementsByTagName('store');
66
var myTable = collections.document.createElement("TABLE");
67
var myTableBody = collections.document.createElement("TBODY");
69
myTable.appendChild(myTableBody);
72
for (var i=0; i<items.length; i++) {
74
var item = items.item(i);
76
row = collections.document.createElement("TR");
77
row.setAttribute("start",item.getAttribute('start'));
78
myTableBody.appendChild(row);
80
cell = collections.document.createElement("TD");
81
row.appendChild(cell);
83
textN = collections.document.createTextNode(hrTime(item.getAttribute('start')));
84
cell.appendChild(textN);
88
myTable.setAttribute("id","myTable");
89
myTable.setAttribute("WIDTH","100%");
90
myTable.setAttribute("BORDER","0");
91
myTable.setAttribute("CELLSPACING","0");
92
myTable.setAttribute("CELLPADDING","0");
93
myTable.setAttribute("RULES","rows");
96
collections.document.body.appendChild(myTable);
98
// tell frame about it
102
function deleteHistory() {
103
if (!confirm("Are you sure you want to delete this chat history completely?"))
106
var aIQ = new JSJaCIQ();
108
aIQ.setTo(srcW.loghost);
110
aIQ.appendNode('remove',
111
{'xmlns': 'http://jabber.org/protocol/archive',
114
srcW.Debug.log(aIQ.xml(),2);
117
srcW.con.send(aIQ,me.reloadHistory);
122
// determine source window
123
if (opener.top.roster)
125
if (typeof(srcW) == 'undefined' || !srcW)
129
jid = passedArgs['jid'];
131
if (typeof(jid) == 'undefined' || jid == '') {
132
alert("JID mancante.\nAnnullamento...");
136
user = srcW.roster.getUserByJID(jid);
138
var dtitle = "Storico chat per "+user.name;
139
document.getElementById('title').innerHTML = dtitle;
140
document.title = dtitle;
143
var aIQ = new JSJaCIQ();
145
aIQ.setTo(srcW.loghost);
147
aIQ.appendNode('list',
148
{'xmlns': 'http://jabber.org/protocol/archive',
151
srcW.con.send(aIQ,me.handleCollsGet);
154
function keyPressed(e) {
160
onkeydown = keyPressed;
164
<script for="document" event="onkeydown()" language="JScript">
166
return keyPressed(window.event);
170
<body style="margin:8px;">
171
<table width="100%" height="100%" border=0>
173
<td><h2 id="title"></h2></td><td align="right"><button onClick="deleteHistory();">Rimuovi</button> <button onClick="reloadHistory();">Aggiorna</td>
177
<iframe id="collections" name="collections" src="userhist_collections_iframe.html" style="width:240px;height:100%;" scrolling="auto"></iframe>
180
<iframe id="selected_collection" name="selected_collection" src="chat_iframe.html" style="width:100%;height:100%;"></iframe>