new smack web client browser side

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1964 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
loki 2003-06-17 19:01:09 +00:00
parent a7a2b90b1b
commit 34acbe9cee
19 changed files with 777 additions and 466 deletions

View File

@ -0,0 +1,116 @@
<%--
-
-
--%>
<%@ 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>Create an account</title>
<link rel="stylesheet" href="<%= request.getContextPath() %>/style_sheet.jsp"
type="text/css">
</head>
<body class="deffr">
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="center" valign="middle">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<h3>Jive Account Creation</h3>
<% if (errors.get("general") != null) { %>
<p>
<span class="error-text">
Error creating account. <%= errors.get("general") %>
</span>
</p>
<br>
<% } %>
</td>
</tr>
<tr>
<td align="center">
<form action="<%= request.getContextPath() %>/ChatServlet"
method="post" name="createform">
<input type="hidden" name="command" value="create_account">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td>Desired username:</td>
<td>
<input type="text" size="40" name="username"
class="text">
<% if (errors.get("empty_username") != null) { %>
<span class="error-text"><br>
Please enter a username.
</span>
<% } %>
</td>
</tr>
<tr>
<td>Desired password:</td>
<td>
<input type="password" size="40" name="password"
class="text">
<% if (errors.get("empty_password") != null) { %>
<span class="error-text"><br>
Please enter a password.
</span>
<% } %>
<% if (errors.get("mismatch_password") != null) { %>
<span class="error-text"><br>
Your passwords did not match.
</span>
<% } %>
</td>
</tr>
<tr>
<td>Retype your password:</td>
<td>
<input type="password" size="40" name="password_zwei"
class="text">
<% if (errors.get("empty_password_two") != null) { %>
<span class="error-text"><br>
You must retype your password.
</span>
<% } %>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<br>
<input type="submit" name="" value="Create account"
class="submit">
</form>
</td>
</tr>
<tr>
<td align="center">
<br><a href="index.jsp">Click here to return to the login page.</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script language="JavaScript" type="text/javascript">
document.createform.username.focus();
</script>
</body>
</html>

View File

@ -1,96 +0,0 @@
<!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">
&nbsp;
&nbsp;
&nbsp;
<input type="submit" name="send" value=" Send " disabled>
&nbsp;
&nbsp;
&nbsp;
</td>
</tr>
</form>
</table>
<script language="JavaScript" type="text/javascript">
document.chatform.message.focus();
</script>
</body>
</html>

View File

@ -1,18 +1,19 @@
<!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>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chat Form</title>
<body>
<link rel="stylesheet" href="<%= request.getContextPath() %>/style_sheet.jsp"
type="text/css">
</head>
<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>
<form name="chatform" action="<%= request.getContextPath() %>/ChatServlet" method="post">
<input type="hidden" name="command" value="write">
<input type="hidden" name="message" value="">
</form>
</body>
</body>
</html>
</html>

View File

@ -1,34 +1,39 @@
<!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>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<body onload="launchWin();">
<title>Web Chat Session</title>
<script language="JavaScript" type="text/javascript">
<h3>Chat Session Options</h3>
function launchWin() {
var newWin = window.open("frame_master.jsp", "chatWin",
"location=no,status=no,toolbar=no,personalbar=no,menubar=no,width=650,height=430");
}
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.
</script>
<br><br>
<link rel="stylesheet" href="<%= request.getContextPath() %>/style_sheet.jsp"
type="text/css">
</head>
Other options:
<body class="deffr" onload="launchWin();">
<ul>
<li><a href="email" onclick="alert('Coming soon');return false;">Email Transcript</a>
</ul>
<h3>Chat Session Options</h3>
</body>
Your 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" onclick="alert('Coming soon'); return false;">Email Transcript</a>
<li><a href="index.jsp">Return to the login page.</a>
</ul>
</body>
</html>

View File

@ -1,66 +0,0 @@
<!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>

View File

@ -1,34 +0,0 @@
<!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 handleLogoff() {
if (confirm('Are you sure you want to end this chat session and close this window?')) {
window.close();
}
return false;
}
</script>
</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>

View File

@ -0,0 +1,182 @@
function addChatText (someText, isAnnouncement) {
var yakDiv = window.parent.frames['yak'].document.getElementById('ytext');
var children = yakDiv.childNodes.length;
var appendFailed = false;
var spanElement = document.createElement("span");
if (! isAnnouncement) {
spanElement.setAttribute("class", "chat_text");
} else {
spanElement.setAttribute("class", "chat_announcement");
}
// it's easier to dump the possibily html-containing text into the innerHTML
// of the span element than deciphering and building sub-elements.
spanElement.innerHTML = someText;
try {
// various versions of IE crash out on this, and safari
yakDiv.appendChild(spanElement);
} catch (exception) {
appendFailed = true;
}
if (! appendFailed) {
// really make sure the browser appended
appendFailed = (children == yakDiv.childNodes.length);
}
if (appendFailed) {
// try this, the only way left
var inn = yakDiv.innerHTML;
inn += "<span class=\"";
inn += (isAnnouncement ? "chat_announcement\">" : "chat_text\">");
inn += someText + "</span><br>";
yakDiv.innerHTML = inn;
} else {
yakDiv.appendChild(document.createElement("br"));
}
scrollYakToEnd();
}
function addUserName (userName) {
var yakDiv = window.parent.frames['yak'].document.getElementById('ytext');
var children = yakDiv.childNodes.length;
var appendFailed = false;
var spanElement = document.createElement("span");
var userIsClientOwner = false;
var announcement = false;
if (userName == "") {
announcement = true;
spanElement.setAttribute("class", "chat_announcement");
userName = "room announcement";
} else if (userName == nickname) {
userIsClientOwner = true;
spanElement.setAttribute("class", "chat_owner");
} else {
spanElement.setAttribute("class", "chat_participant");
}
try {
spanElement.appendChild(document.createTextNode(userName + ": "));
// various versions of IE crash out on this, and safari
yakDiv.appendChild(spanElement);
} catch (exception) {
appendFailed = true;
}
if (! appendFailed) {
// really make sure the browser appended
appendFailed = (children == yakDiv.childNodes.length);
}
if (appendFailed) {
// try this, the only way left
var inn = yakDiv.innerHTML
inn += "<span class=\"";
if (announcement) {
inn += "chat_announcement"
} else if (userIsClientOwner) {
inn += "chat_owner";
} else {
inn += "chat_participant";
}
inn += "\">" + userName + ": </span>";
yakDiv.innerHTML = inn;
}
}
function scrollYakToEnd () {
var endDiv = window.parent.frames['yak'].document.getElementById('enddiv');
window.parent.frames['yak'].window.scrollTo(0, endDiv.offsetTop);
}
function userJoined (username) {
var parentDIV = window.parent.frames['participants'].document.getElementById('par__list');
var children = parentDIV.childNodes.length;
var appendFailed = false;
var divElement = document.createElement("div");
divElement.setAttribute("id", username);
try {
divElement.appendChild(document.createTextNode(username));
divElement.appendChild(document.createElement("br"));
parentDIV.appendChild(divElement);
} catch (exception) {
appendFailed = true;
}
if (! appendFailed) {
// really make sure the browser appended
appendFailed = (children == parentDIV.childNodes.length);
}
if (appendFailed) {
// try this, the only way left
var inn = parentDIV.innerHTML;
inn += "<div id=\"" + username + "\"> &middot; " + username + "<br></div>";
parentDIV.innerHTML = inn;
}
}
function userDeparted (username) {
var partDoc = window.parent.frames['participants'].document;
var parentDIV = partDoc.getElementById('par__list');
var userDIV = partDoc.getElementById(username);
var children = parentDIV.childNodes.length;
var removeFailed = false;
// MAY RETURN THIS BLOCK
if (userDIV == null) {
return;
}
try {
parentDIV.removeChild(userDIV);
} catch (exception) {
removeFailed = true;
}
if (! removeFailed) {
// really make sure the browser appended
removeFailed = (children == parentDIV.childNodes.length);
}
if (removeFailed) {
// try this, the only way left
var inn = parentDIV.innerHTML;
var openingTag = "<div id=\"" + username + "\">";
var index = inn.toLowerCase().indexOf(openingTag);
var patchedHTML = inn.substring(0, index);
var secondIndex = openingTag.length + username.length + 13;
patchedHTML += inn.substring(secondIndex, (inn.length));
parentDIV.innerHTML = inn;
}
}
function writeDate () {
var msg = "This frame loaded at: ";
var now = new Date();
msg += now + "<br><hr>";
document.write(msg);
}

View File

@ -1,26 +0,0 @@
<%--
-
-
--%>
<% // 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>

View File

@ -1,18 +0,0 @@
<!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>

View File

@ -0,0 +1,33 @@
<html>
<head>
<title><%= request.getSession().getAttribute("messenger.servlet.room") %>
- Jive Web Chat Client</title>
<script>
function frameSetLoaded () {
window.frames['poller'].location.href
= "<%= request.getContextPath() %>/ChatServlet?command=read";
}
function attemptLogout () {
window.frames['participants'].document.logout.submit();
}
</script>
<link rel="stylesheet" href="<%= request.getContextPath() %>/style_sheet.jsp"
type="text/css">
</head>
<frameset cols="*, 125" border="0" frameborder="0" framespacing="0"
onLoad="frameSetLoaded();" onUnload="attemptLogout();">
<frameset rows="0, 200, *, 0" border="0" frameborder="0" framespacing="0">
<frame name="submitter" src="chat-hiddenform.jsp" frameborder="0">
<frame name="yak" src="transcript_frame.html" frameborder="0">
<frame name="input" src="input_frame.jsp" frameborder="0">
<frame name="poller" src="" frameborder="0">
</frameset>
<frame name="participants" src="participants_frame.jsp" class="bordered_left">
</frameset>
</html>

View File

@ -1,56 +0,0 @@
<!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>");
}
}
window.focus();
}
</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>
&nbsp;
<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>

View File

@ -7,100 +7,158 @@
<% // Get error map as a request attribute:
Map errors = (Map)request.getAttribute("messenger.servlet.errors");
boolean allowAnonymous = true;
boolean allowAccountCreate = true;
boolean allowLogin = true;
String param = null;
if (errors == null) { errors = new HashMap(); }
param = application.getInitParameter("allowAnonymous");
if ((param != null) && (param.equalsIgnoreCase("false"))) {
allowAnonymous = false;
}
param = application.getInitParameter("allowAccountCreation");
if ((param != null) && (param.equalsIgnoreCase("false"))) {
allowAccountCreate = false;
}
param = application.getInitParameter("allowLogin");
if ((param != null) && (param.equalsIgnoreCase("false"))) {
allowLogin = false;
}
%>
<!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>
<head>
<title>Jive Web Chat Client Login</title>
<script language="JavaScript" type="text/javascript">
function submitForm (el) {
el.form.submit();
}
<body>
function anonClick () {
document.loginform.command.value = "anon_login";
<h3>Jive Chat Login</h3>
return true;
}
</script>
<% if (errors.get("general") != null) { %>
<link rel="stylesheet" href="<%= request.getContextPath() %>/style_sheet.jsp"
type="text/css">
</head>
<p class="error-text">
Error logging in. Make sure your username and password is correct.
</p>
<body class="deffr">
<% } %>
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="center" valign="middle">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<h3>Welcome to the Jive Web Chat Client - Please Login</h3>
<% if (errors.get("general") != null) { %>
<p class="error-text">
Error logging in. Make sure your username and
password are correct. <%= errors.get("general") %>
</p>
<% } %>
</td>
</tr>
<tr>
<td align="center">
<form action="<%= request.getContextPath() %>/ChatServlet"
method="post" name="loginform">
<input type="hidden" name="command" value="login">
<form action="<%= request.getContextPath() %>/servlet/ChatServlet" method="post" name="loginform">
<input type="hidden" name="command" value="login">
<table cellpadding="2" cellspacing="0" border="0">
<% if (allowLogin) { %>
<tr>
<td>Username:</td>
<td>
<input type="text" size="40" name="username"
class="text">
<% 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"
class="text">
<% 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"
class="text">
<% if (errors.get("nickname") != null) { %>
<span class="error-text"><br>
Please enter a nickname.
</span>
<% } %>
</td>
</tr>
<tr>
<td>Room:</td>
<td>
<input type="text" size="40" name="room"
value="test@chat.jivesoftware.com" class="text">
<% if (errors.get("room") != null) { %>
<span class="error-text"><br>
Please enter a valid room.
</span>
<% } %>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<br>
<% if (allowLogin) { %>
<input type="submit" name="" value="Login and Chat"
class="submit">
<% } %>
<% if (allowAnonymous) { %>
<input type="submit" name="" value="Anonymously Chat"
onClick="return anonClick();" class="submit">
<% } %>
</form>
</td>
</tr>
<% if (allowAccountCreate) { %>
<tr>
<td align="center">
<br>Don't have an account and would like to create one?
<a href="account_creation.jsp">Click here.</a>
</td>
</tr>
<% } %>
</table>
</td>
</tr>
</table>
<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>
<script language="JavaScript" type="text/javascript">
<% if (allowLogin) { %>
document.loginform.username.focus();
<% } else { %>
document.loginform.nickname.focus();
<% } %>
</script>
<br>
<input type="submit" name="" value="Start Chat">
</form>
<script language="JavaScript" type="text/javascript">
document.loginform.username.focus();
</script>
</body>
</body>
</html>

View File

@ -0,0 +1,75 @@
<%@ page import="javax.servlet.*" %>
<% // Get error map as a request attribute:
String logoFilename = application.getInitParameter("logoFilename");
if (logoFilename == null) {
logoFilename = "images/logo.gif";
}
%>
<html>
<head>
<meta http-equiv="expires" content="0">
<script>
function updateButtonState (textAreaElement) {
if (textAreaElement.value != '') {
textAreaElement.form.send.disabled = false;
} else {
textAreaElement.form.send.disabled = true;
}
}
function handleKeyEvent (event, textAreaElement) {
var form = textAreaElement.form;
var keyCode = event.keyCode;
if (keyCode == null) {
keyCode = event.which;
}
if (keyCode == 13) {
submitForm(form);
form.message.value = '';
}
updateButtonState(textAreaElement);
}
function submitForm (formElement) {
var textAreaElement = formElement.message;
var text = textAreaElement.value;
var sForm = window.parent.frames['submitter'].document.chatform;
sForm.message.value = text;
sForm.submit();
textAreaElement.value = '';
updateButtonState(textAreaElement);
return false;
}
</script>
<link rel="stylesheet" href="<%= request.getContextPath() %>/style_sheet.jsp"
type="text/css">
</head>
<body class="deffr">
<center>
<form name="chat" onsubmit="return submitForm(this);">
<textarea name="message"
onkeyup="handleKeyEvent(event, this);"
onchange="updateButtonState(this);"></textarea>
<br>
<input type="submit" name="send" value="Send" class="submit_right" disabled>
</form>
</center>
<img src="<%= logoFilename %>" class="logo">
</body>
</html>

View File

@ -1,13 +0,0 @@
<!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>

View File

@ -1,32 +0,0 @@
<!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%">
&nbsp;
</td>
<td width="1%" nowrap>
<font size="-2">
<a href="#" onclick="parent.handleLogoff();return false;">End Chat (Log Off)</a>
</font>
</td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,46 @@
<html>
<head>
<meta http-equiv="expires" content="0">
<script>
function verifyLogout () {
if (confirm("Are you sure you'd like to logout")) {
// hacky solution to avoid logging out twice due to parent frame's onUnload
try {
document.logout.command.value = "silence";
} catch (e) { }
window.parent.close();
return true;
}
return false;
}
</script>
<link rel="stylesheet" href="<%= request.getContextPath() %>/style_sheet.jsp"
type="text/css">
</head>
<body class="deffr">
<center>In the room:</center>
<br>
<hr width=67%>
<div id="par__list"> </div>
<form name="logout" action="<%= request.getContextPath() %>/ChatServlet" method="post">
<input type="hidden" name="command" value="logout">
</form>
<span class="logout">
<a href="<%= request.getContextPath() %>/ChatServlet?command=logout"
onclick="return verifyLogout();" >
<img src="images/logout-16x16.gif" border="0" class="logout"> Logout</a></span>
</body>
</html>

View File

@ -1,9 +0,0 @@
BODY, TD, TH {
font-family : tahoma; font-size : 0.8em;
}
H3 {
font-size : 1.2em;
}
.error-text {
color : red;
}

View File

@ -0,0 +1,132 @@
<% // Set the content type of the this page to be CSS
String contentType = "text/css";
String chatAnnouncementColor = application.getInitParameter("chat.announcement-color");
String chatOwnerLabelColor = application.getInitParameter("chat.owner-label-color");
String chatParticipantLabelColor = application.getInitParameter("chat.participant-label-color");
String chatTextColor = application.getInitParameter("chat.text-color");
String errorTextColor = application.getInitParameter("error.text-color");
String linkColor = application.getInitParameter("link.color");
String linkHoverColor = application.getInitParameter("link.hover-color");
String linkVisitedColor = application.getInitParameter("link.visited-color");
String bodyBGColor = application.getInitParameter("body.background-color");
String bodyTextColor = application.getInitParameter("body.text-color");
String frameDividerColor = application.getInitParameter("frame.divider-color");
String buttonColor = application.getInitParameter("button.color");
String buttonTextColor = application.getInitParameter("button.text-color");
String textFieldColor = application.getInitParameter("textfield.color");
String textFieldTextColor = application.getInitParameter("textfield.text-color");
response.setContentType(contentType);
if (chatAnnouncementColor == null) {
chatAnnouncementColor = "#009d00";
}
if (chatOwnerLabelColor == null) {
chatOwnerLabelColor = "#aa0000";
}
if (chatParticipantLabelColor == null) {
chatParticipantLabelColor = "#0000aa";
}
if (chatTextColor == null) {
chatTextColor = "#434343";
}
if (errorTextColor == null) {
errorTextColor = "#ff0000";
}
if (linkColor == null) {
linkColor = "#045d30";
}
if (linkHoverColor == null) {
linkHoverColor = "#350000";
}
if (linkVisitedColor == null) {
linkVisitedColor = "#3b3757";
}
if (bodyBGColor == null) {
bodyBGColor = "#ffffff";
}
if (bodyTextColor == null) {
bodyTextColor = "#362f2d";
}
if (frameDividerColor == null) {
frameDividerColor = "#83272b";
}
if (buttonColor == null) {
buttonColor = "#d6dfdf";
}
if (buttonTextColor == null) {
buttonTextColor = "#333333";
}
if (textFieldColor == null) {
textFieldColor = "#f7f7fb";
}
if (textFieldTextColor == null) {
textFieldTextColor = "#333333";
}
%>
BODY, TD, TH { font-family : Tahoma, Arial, Verdana, sans serif; font-size: 13px; }
H3 { font-size : 1.2em; }
.error-text { color : <%= errorTextColor %>; }
/* default unvisited, visited and hover link presentation */
A:link { background: transparent; color: <%= linkColor %>;
text-decoration: none; }
A:visited { background: transparent; color: <%= linkVisitedColor %>;
text-decoration: none; }
A:hover { background: transparent; color: <%= linkHoverColor %>;
text-decoration: underline; }
/**
* site wide BODY style rule; the scrollbar stuff only works in IE for windows,
* but doesn't seem to hurt on other browsers..
*/
BODY.deffr { background-color: <%= bodyBGColor %>; color: <%= bodyTextColor %>;
scrollbar-face-color: <%= bodyBGColor %>;
scrollbar-shadow-color: <%= bodyTextColor %>;
scrollbar-highlight-color: <%= bodyBGColor %>;
scrollbar-darkshadow-color: <%= bodyBGColor %>;
scrollbar-track-color: <%= bodyBGColor %>;
scrollbar-arrow-color: <%= bodyTextColor %>; }
FRAME.bordered_left { border-left: 3px solid <%= frameDividerColor %>; }
IMG.logo { position: absolute; bottom: 12px; left: 10px; }
IMG.logout { vertical-align: middle; }
INPUT.submit { background-color: <%= buttonColor %>; color: <%= buttonTextColor %>;
font-size: 12px; font-family: Arial, Verdana, sans serif;
border-style: ridge; margin: 1px 5px 1px 5px; }
INPUT.submit_right { background-color: <%= buttonColor %>; color: <%= buttonTextColor %>;
font-size: 12px; font-family: Arial, Verdana, sans serif;
border-style: ridge; margin: 1px 5px 1px 5px;
position: absolute; right: 10px; }
INPUT.text { background-color: <%= textFieldColor %>; color: <%= textFieldTextColor %>;
font: normal 12px Arial, Verdana, sans serif; height: 20px; width: 271px;
border-style: groove; margin-left: 10px; }
SPAN.chat_text { font: normal 11px Arial, Verdana, sans serif;
color: <%= chatTextColor %>; }
SPAN.chat_announcement { font: italic 11px Arial, Verdana, sans serif;
color: <%= chatAnnouncementColor %>; }
SPAN.chat_owner { font: bold 11px Arial, Verdana, sans serif;
color: <%= chatOwnerLabelColor %>; }
SPAN.chat_participant { font: bold 11px Arial, Verdana, sans serif;
color: <%= chatParticipantLabelColor %>; }
SPAN.logout { position: absolute; bottom: 12px; right: 15px; }
TEXTAREA { color: <%= textFieldTextColor %>; font: normal 12px Arial, Verdana, sans serif;
width: 500px; height: 130px; }

View File

@ -0,0 +1,13 @@
<html>
<head>
<meta http-equiv="expires" content="0">
<link rel="stylesheet" href="style_sheet.jsp" type="text/css" media="screen">
</head>
<body class="deffr">
<div id="ytext"> <br></div><div id="enddiv"></div>
</body>
</html>