1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>JWChat - Chat History</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script src="shared.js"></script>
<script src="emoticons.js"></script>
<script src="switchStyle.js"></script>
<script src="xmlextras.js"></script>
<script src="JSJaCPacket.js"></script>
<script>
<!--
function reloadHistory() {
// clear iframes
selected_collection.document.body.innerHTML = '';
collections.document.body.innerHTML = '';
// get collections
var aIQ = new JSJaCIQ();
aIQ.setType('get');
aIQ.setTo(srcW.loghost);
var aNode = aIQ.getNode().appendChild(aIQ.getDoc().createElement('archive'));
aNode.setAttribute('jid',jid);
srcW.con.send(aIQ,me.handleCollsGet);
return false;
}
function handleCollGet(iq) {
if (!iq || iq.getType() != 'result')
return;
srcW.Debug.log(iq.getDoc().xml,2);
//selected_collection.document.body.innerHTML = '';
var histHTML = '';
for (var i=0; i<iq.getNode().firstChild.getElementsByTagName('message').length; i++) {
var msg = JSJaCPWrapNode(iq.getNode().firstChild.getElementsByTagName('message').item(i));
if (msg.getTo() != null) // message from me
histHTML += "<font color=\"blue\"><" + srcW.nick + "></font> ";
else
histHTML += "<font color=\"red\"><" + user.name + "></font> ";
histHTML += msg.getBody() + '<br>';
continue;
}
selected_collection.document.body.innerHTML = histHTML;
}
function handleCollsGet(iq) {
if (!iq || iq.getType() != 'result')
return;
srcW.Debug.log(iq.getDoc().xml,2);
var items = iq.getNode().firstChild.getElementsByTagName('item');
var myTable = collections.document.createElement("TABLE");
var myTableBody = collections.document.createElement("TBODY");
myTable.appendChild(myTableBody);
var row, cell, textN;
for (var i=0; i<items.length; i++) {
var item = items.item(i);
if (cutResource(item.getAttribute('jid')) != cutResource(jid)) // skip
continue;
row = collections.document.createElement("TR");
row.setAttribute("cid",item.getAttribute('cid'));
myTableBody.appendChild(row);
cell = collections.document.createElement("TD");
row.appendChild(cell);
textN = collections.document.createTextNode(hrTime(item.getAttribute('start')));
cell.appendChild(textN);
}
myTable.setAttribute("id","myTable");
myTable.setAttribute("WIDTH","100%");
myTable.setAttribute("BORDER","0");
myTable.setAttribute("CELLSPACING","0");
myTable.setAttribute("CELLPADDING","0");
myTable.setAttribute("RULES","rows");
// add table
collections.document.body.appendChild(myTable);
// tell frame about it
collections.init();
}
var srcW;
function init() {
// determine source window
if (opener.top.roster)
srcW = opener.top;
if (typeof(srcW) == 'undefined' || !srcW)
return;
getArgs();
jid = passedArgs['jid'];
if (typeof(jid) == 'undefined' || jid == '') {
alert("JID is missing.\nAborting...");
window.close();
}
user = srcW.roster.getUserByJID(jid);
var dtitle = "Chat-Protokoll für "+user.name;
document.getElementById('title').innerHTML = dtitle;
document.title = dtitle;
// get collections
var aIQ = new JSJaCIQ();
aIQ.setType('get');
aIQ.setTo(srcW.loghost);
var aNode = aIQ.getNode().appendChild(aIQ.getDoc().createElement('archive'));
aNode.setAttribute('xmlns','http://jabber.org/protocol/archive');
aNode.setAttribute('jid',jid);
me = this;
srcW.con.send(aIQ,me.handleCollsGet);
}
function keyPressed(e) {
if (e.keyCode == 27)
window.close();
return true;
}
onkeydown = keyPressed;
onload = init;
//-->
</script>
<script for="document" event="onkeydown()" language="JScript">
<!--
return keyPressed(window.event);
//-->
</script>
</head>
<body style="margin:8px;">
<table width="100%" height="100%" border=0>
<tr>
<td><h2 id="title"></h2></td><td align="right"><button onClick="return reloadHistory();">Neuladen</td>
</tr>
<tr height="100%">
<td>
<iframe id="collections" name="collections" src="userhist_collections_iframe.html" style="width:240px;height:100%;" scrolling="auto"></iframe>
</td>
<td width="100%">
<iframe id="selected_collection" name="selected_collection" src="chat_iframe.html" style="width:100%;height:100%;"></iframe>
</td>
</tr>
</table>
</body>
</html>
|