mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 05:52:06 +01:00
Initial checkin
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1871 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
bd4d3114d4
commit
7857d170be
16 changed files with 504 additions and 0 deletions
1
apps/webchat/build/ant
Normal file
1
apps/webchat/build/ant
Normal file
|
@ -0,0 +1 @@
|
|||
# blank for now
|
1
apps/webchat/build/ant.bat
Normal file
1
apps/webchat/build/ant.bat
Normal file
|
@ -0,0 +1 @@
|
|||
REM blank for now
|
1
apps/webchat/build/build.xml
Normal file
1
apps/webchat/build/build.xml
Normal file
|
@ -0,0 +1 @@
|
|||
<!-- blank for now -->
|
96
apps/webchat/source/web/chat-form.html
Normal file
96
apps/webchat/source/web/chat-form.html
Normal file
|
@ -0,0 +1,96 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Chat Session</title>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
// update the send button to be disabled/enabled
|
||||
function updateButton(el) {
|
||||
if (el.value != '') {
|
||||
el.form.send.disabled = false;
|
||||
}
|
||||
else {
|
||||
el.form.send.disabled = true;
|
||||
}
|
||||
}
|
||||
function handleSubmit(el) {
|
||||
// el is the form
|
||||
submitForm(el);
|
||||
|
||||
// return false so this form does not sumbmit:
|
||||
return false;
|
||||
}
|
||||
function handleKeyEvent(evt, el) {
|
||||
// el is the textarea, so get the form:
|
||||
var form = el.form;
|
||||
var keyCode = document.layers ? evt.which : evt.keyCode;
|
||||
if (keyCode == 13) {
|
||||
// submit form here
|
||||
submitForm(form);
|
||||
// clear the TA
|
||||
form.message.value = '';
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function submitForm(el) {
|
||||
// el is the form
|
||||
var chatform = window.parent.frames['hiddenform'].document.chatform;
|
||||
chatform.message.value = el.message.value;
|
||||
chatform.submit();
|
||||
el.message.focus();
|
||||
el.message.value = '';
|
||||
updateButton(el.message);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||
|
||||
<form name="chatform" onsubmit="return handleSubmit(this);">
|
||||
|
||||
<!--
|
||||
<tr valign="top">
|
||||
<td colspan="2" style="padding:8px;">
|
||||
<iframe src="chat-conv.html" frameborder="1"
|
||||
id="chatconv"
|
||||
style="border:1px #ccc solid;width:100%;height:250px;" scrolling="yes"
|
||||
height="100%" width="100%"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
-->
|
||||
|
||||
<tr>
|
||||
<td width="99%">
|
||||
<table cellpadding="7" cellspacing="0" border="0" width="100%">
|
||||
<tr><td>
|
||||
<textarea name="message" cols="58" rows="4" style="width:100%" wrap="virtual"
|
||||
onkeyup="handleKeyEvent(event,this);updateButton(this);"
|
||||
onchange="updateButton(this);"></textarea>
|
||||
</td>
|
||||
</tr></table>
|
||||
</td>
|
||||
<td width="1%" nowrap align="center">
|
||||
|
||||
|
||||
|
||||
<input type="submit" name="send" value=" Send " disabled>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</form>
|
||||
|
||||
</table>
|
||||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.chatform.message.focus();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
18
apps/webchat/source/web/chat-hiddenform.jsp
Normal file
18
apps/webchat/source/web/chat-hiddenform.jsp
Normal file
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Chat Form</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<form action="<%= request.getContextPath() %>/servlet/ChatServlet" name="chatform" method="post">
|
||||
<input type="hidden" name="command" value="write">
|
||||
<input type="hidden" name="message" value="">
|
||||
</form>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
35
apps/webchat/source/web/chat-launcher.jsp
Normal file
35
apps/webchat/source/web/chat-launcher.jsp
Normal file
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Chat Session</title>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
function launchWin() {
|
||||
var newWin = window.open("chat.jsp","chatWin",
|
||||
"location=no,status=no,toolbar=no,personalbar=no,menubar=no,width=600,height=400");
|
||||
}
|
||||
</script>
|
||||
<link rel="stylesheet" href="<%= request.getContextPath() %>/style.css" type="text/css">
|
||||
</head>
|
||||
|
||||
<body onload="launchWin();">
|
||||
|
||||
<h3>Chat Session Options</h3>
|
||||
|
||||
You chat session should have already started. If for some reason it did
|
||||
not, click <a href="#" onclick="launchWin();return false;">this link</a>
|
||||
to start your chat session.
|
||||
|
||||
<br><br>
|
||||
|
||||
Other options:
|
||||
|
||||
<ul>
|
||||
<li><a href="email">Email Transcript</a>
|
||||
<li><a href="something">Something Else</a>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
66
apps/webchat/source/web/chat-main.html
Normal file
66
apps/webchat/source/web/chat-main.html
Normal file
|
@ -0,0 +1,66 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Chat Session</title>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
// update the send button to be disabled/enabled
|
||||
function updateButton(el) {
|
||||
if (el.value != '') {
|
||||
el.form.send.disabled = false;
|
||||
}
|
||||
else {
|
||||
el.form.send.disabled = true;
|
||||
}
|
||||
}
|
||||
function handleSubmit(el) {
|
||||
// el is the form
|
||||
var chatform = window.parent.frames['form'].document.chatform;
|
||||
chatform.message.value = el.message.value;
|
||||
chatform.submit();
|
||||
el.message.value = '';
|
||||
el.message.focus();
|
||||
updateButton(el.message);
|
||||
|
||||
// return false so this form does not sumbmit:
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||
|
||||
<form name="chatform" onsubmit="return handleSubmit(this);">
|
||||
|
||||
<tr valign="top">
|
||||
<td colspan="2" style="padding:8px;">
|
||||
<iframe src="chat-conv.html" frameborder="0"
|
||||
id="chatconv"
|
||||
style="border:1px #ccc solid;width:100%;height:250px;" scrolling="yes"
|
||||
height="100%" width="100%"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="99%" style="padding:0px 2px 0px 8px;">
|
||||
<textarea name="message" cols="50" rows="4" style="width:100%" wrap="virtual"
|
||||
onkeyup="updateButton(this);"
|
||||
onchange="updateButton(this);"></textarea>
|
||||
</td>
|
||||
<td width="1%" nowrap style="padding:0px 8px 0px 2px;">
|
||||
<input type="submit" name="send" value="Send" style="padding-left:5px;padding-right:5px;" disabled>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</form>
|
||||
|
||||
</table>
|
||||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.chatform.message.focus();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
26
apps/webchat/source/web/chat.jsp
Normal file
26
apps/webchat/source/web/chat.jsp
Normal file
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Chat Session</title>
|
||||
</head>
|
||||
|
||||
<frameset rows="25,30,*,95,0,0,0" border="0" frameborder="0" framespacing="0">
|
||||
<frame name="main" src="menu.html"
|
||||
marginwidth="0" marginheight="0" scrolling="no" frameborder="0">
|
||||
<frame name="main" src="logo.html"
|
||||
marginwidth="0" marginheight="0" scrolling="no" frameborder="0">
|
||||
<frame name="main" src="iframe.html"
|
||||
marginwidth="0" marginheight="0" scrolling="yes" frameborder="0">
|
||||
<frame name="form" src="chat-form.html"
|
||||
marginwidth="0" marginheight="0" scrolling="no" frameborder="0">
|
||||
<frame name="hiddenform" src="chat-hiddenform.jsp"
|
||||
marginwidth="0" marginheight="0" scrolling="no" frameborder="0">
|
||||
<frame name="data" src="data.jsp"
|
||||
marginwidth="0" marginheight="0" scrolling="no" frameborder="0">
|
||||
<frame name="server" src="<%= request.getContextPath() %>/servlet/ChatServlet?command=read"
|
||||
marginwidth="0" marginheight="0" scrolling="no" frameborder="0">
|
||||
</frameset>
|
||||
|
||||
</html>
|
26
apps/webchat/source/web/data.jsp
Normal file
26
apps/webchat/source/web/data.jsp
Normal file
|
@ -0,0 +1,26 @@
|
|||
<%--
|
||||
-
|
||||
-
|
||||
--%>
|
||||
|
||||
<% // get the username of the current user
|
||||
String nickname = (String)session.getAttribute("messenger.servlet.nickname");
|
||||
if (nickname == null) {
|
||||
nickname = "";
|
||||
}
|
||||
%>
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Chat Data</title>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
var currUsername = "<%= nickname %>";
|
||||
var data = new Array();
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body></body>
|
||||
|
||||
</html>
|
18
apps/webchat/source/web/form.html
Normal file
18
apps/webchat/source/web/form.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Chat Form</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<form action="http://zeus/chat/servlet/ChatServlet" name="chatform" method="post">
|
||||
<input type="hidden" name="command" value="write">
|
||||
<input type="hidden" name="message" value="">
|
||||
</form>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
55
apps/webchat/source/web/iframe.html
Normal file
55
apps/webchat/source/web/iframe.html
Normal file
|
@ -0,0 +1,55 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="cache-control" content="no-cache">
|
||||
<title>Chat Session</title>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
var currUsername = window.parent.frames['data'].currUsername;
|
||||
var data = window.parent.frames['data'].data;
|
||||
function printChat() {
|
||||
for (var i in data) {
|
||||
if (data[i][0] == '') {
|
||||
// server message
|
||||
document.write("<div class='chat-statement'><span class='server-message'>"
|
||||
+ data[i][1] + "</span></div>");
|
||||
}
|
||||
else {
|
||||
// conversation part
|
||||
var partialClassName = (data[i][0] == currUsername) ? "-user" : "";
|
||||
document.write("<div class='chat-statement'><span class='chat-username"
|
||||
+ partialClassName + "'>" + data[i][0]
|
||||
+ ":</span> <span class='chat-text"+ partialClassName
|
||||
+ "'>" + data[i][1] + "</span></div>");
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.chat-username { font-weight : bold; color : blue; }
|
||||
.chat-username-user { font-weight : bold; color : red; }
|
||||
.chat-statement { padding-bottom : 3px; }
|
||||
.server-message { font-color : #999; font-style : italic; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#ffffff" leftmargin="5">
|
||||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
printChat();
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
var data = window.parent.frames['data'].data;
|
||||
if (data != null) {
|
||||
self.scrollTo(0,(30*data.length));
|
||||
// Do not delete second line! IE needs it for some reason...
|
||||
self.scrollTo(0,(30*data.length));
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
BIN
apps/webchat/source/web/images/logo.gif
Normal file
BIN
apps/webchat/source/web/images/logo.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
107
apps/webchat/source/web/index.jsp
Normal file
107
apps/webchat/source/web/index.jsp
Normal file
|
@ -0,0 +1,107 @@
|
|||
<%--
|
||||
-
|
||||
-
|
||||
--%>
|
||||
|
||||
<%@ page import="java.util.*" %>
|
||||
|
||||
<% // Get error map as a request attribute:
|
||||
Map errors = (Map)request.getAttribute("messenger.servlet.errors");
|
||||
if (errors == null) { errors = new HashMap(); }
|
||||
%>
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Chat</title>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
function submitForm(el) {
|
||||
el.form.submit();
|
||||
}
|
||||
</script>
|
||||
<link rel="stylesheet" href="<%= request.getContextPath() %>/style.css" type="text/css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>Jive Chat Login</h3>
|
||||
|
||||
<% if (errors.get("general") != null) { %>
|
||||
|
||||
<p class="error-text">
|
||||
Error logging in. Make sure your username and password is correct.
|
||||
</p>
|
||||
|
||||
<% } %>
|
||||
|
||||
<form action="<%= request.getContextPath() %>/servlet/ChatServlet" method="post" name="loginform">
|
||||
<input type="hidden" name="command" value="login">
|
||||
<input type="hidden" name="garbage" value="<%= Math.random() %>">
|
||||
|
||||
<table cellpadding="2" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td>Username:</td>
|
||||
<td>
|
||||
<input type="text" size="40" name="username">
|
||||
<% if (errors.get("username") != null) { %>
|
||||
|
||||
<span class="error-text"><br>
|
||||
Please enter a valid username.
|
||||
</span>
|
||||
|
||||
<% } %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Password:</td>
|
||||
<td>
|
||||
<input type="password" size="40" name="password">
|
||||
<% if (errors.get("password") != null) { %>
|
||||
|
||||
<span class="error-text"><br>
|
||||
Please enter a valid password.
|
||||
</span>
|
||||
|
||||
<% } %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Nickname:</td>
|
||||
<td>
|
||||
<input type="text" size="40" name="nickname">
|
||||
<% if (errors.get("nickname") != null) { %>
|
||||
|
||||
<span class="error-text"><br>
|
||||
Please enter a valid nickname.
|
||||
</span>
|
||||
|
||||
<% } %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Room:</td>
|
||||
<td>
|
||||
<input type="text" size="40" name="room" value="test@chat.jivesoftware.com">
|
||||
<% if (errors.get("room") != null) { %>
|
||||
|
||||
<span class="error-text"><br>
|
||||
Please enter a valid room.
|
||||
</span>
|
||||
|
||||
<% } %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<input type="submit" name="" value="Start Chat">
|
||||
</form>
|
||||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.loginform.username.focus();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
13
apps/webchat/source/web/logo.html
Normal file
13
apps/webchat/source/web/logo.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Chat Logo</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<img src="images/logo.gif" width="175" height="28" alt="" border="0">
|
||||
|
||||
</body>
|
||||
</html>
|
32
apps/webchat/source/web/menu.html
Normal file
32
apps/webchat/source/web/menu.html
Normal file
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Chat Menu</title>
|
||||
<style type="text/css">
|
||||
TD {
|
||||
font-family : verdana, arial, helvetica, sans-serif;
|
||||
}
|
||||
A, A:visited {
|
||||
color : #000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#f7f0fb" topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0">
|
||||
|
||||
<table cellpadding="2" cellspacing="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td width="99%">
|
||||
|
||||
</td>
|
||||
<td width="1%" nowrap>
|
||||
<font size="-2">
|
||||
<a href="#" onclick="alert('Not implemented right now');return false;">End Chat (Log Off)</a>
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
9
apps/webchat/source/web/style.css
Normal file
9
apps/webchat/source/web/style.css
Normal file
|
@ -0,0 +1,9 @@
|
|||
BODY, TD, TH {
|
||||
font-family : tahoma; font-size : 0.8em;
|
||||
}
|
||||
H3 {
|
||||
font-size : 1.2em;
|
||||
}
|
||||
.error-text {
|
||||
color : red;
|
||||
}
|
Loading…
Reference in a new issue