1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<title>JWChat - História rozhovoru</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="xmlextras.js"></script>
10
<script src="jsjac.js"></script>
13
function reloadHistory(iq) {
15
if (iq && iq.getType != 'result')
16
srcW.Debug.log(iq.xml(),1);
19
selected_collection.document.body.innerHTML = '';
20
collections.document.body.innerHTML = '';
23
var aIQ = new JSJaCIQ();
25
aIQ.setTo(srcW.loghost);
26
var aNode = aIQ.getNode().appendChild(aIQ.getDoc().createElement('list'));
27
aNode.setAttribute('xmlns','http://jabber.org/protocol/archive');
28
aNode.setAttribute('with',jid);
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("Ste si skutočne istý(á), že chcete zmazať kompletnú históriu rozhovoru?"))
106
var aIQ = new JSJaCIQ();
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);
113
srcW.Debug.log(aIQ.xml(),2);
116
srcW.con.send(aIQ,me.reloadHistory);
121
// determine source window
122
if (opener.top.roster)
124
if (typeof(srcW) == 'undefined' || !srcW)
128
jid = passedArgs['jid'];
130
if (typeof(jid) == 'undefined' || jid == '') {
131
alert("JID chýba.\nUkončovanie...");
135
user = srcW.roster.getUserByJID(jid);
137
var dtitle = "História rozhovoru pre "+user.name;
138
document.getElementById('title').innerHTML = dtitle;
139
document.title = dtitle;
142
var aIQ = new JSJaCIQ();
144
aIQ.setTo(srcW.loghost);
145
var aNode = aIQ.getNode().appendChild(aIQ.getDoc().createElement('list'));
146
aNode.setAttribute('xmlns','http://jabber.org/protocol/archive');
147
aNode.setAttribute('with',jid);
149
srcW.con.send(aIQ,me.handleCollsGet);
152
function keyPressed(e) {
158
onkeydown = keyPressed;
162
<script for="document" event="onkeydown()" language="JScript">
164
return keyPressed(window.event);
168
<body style="margin:8px;">
169
<table width="100%" height="100%" border=0>
171
<td><h2 id="title"></h2></td><td align="right"><button onClick="deleteHistory();">Zmazať</button> <button onClick="reloadHistory();">Obnoviť</td>
175
<iframe id="collections" name="collections" src="userhist_collections_iframe.html" style="width:240px;height:100%;" scrolling="auto"></iframe>
178
<iframe id="selected_collection" name="selected_collection" src="chat_iframe.html" style="width:100%;height:100%;"></iframe>