|
From: <tre...@us...> - 2007-11-21 17:17:00
|
Revision: 596
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=596&view=rev
Author: trevorolio
Date: 2007-11-21 09:16:57 -0800 (Wed, 21 Nov 2007)
Log Message:
-----------
Sadly, this breaks with idea of using the applet only for 3D view because browsers can't reliably pass focus between DOM text field and java panel, which we tried to make work for the movement/chat cycle but it failed and made it unacceptably slow to switch between the two actions. So, I added the chat history and command line to the applet and rewhacked all of the relevant HTML pages.
While moving in the 3D view press enter or / to move to the command line. Enter or escape will switch focus back to 3D view.
Also, fixed the bug in which losing focus while moving would make you lose control, endlessly walking or turning. Now the 3D view catched the focus change and stops any active movement.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/space.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceEmbed.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-11-21 17:16:47 UTC (rev 595)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-11-21 17:16:57 UTC (rev 596)
@@ -1089,7 +1089,7 @@
public void viewpointMotionStopped(Transform3D position) {
}
- public void focusCommandField() {
+ public void focusCommandField(String preloadedText) {
}
public void mouseContextClickedThing(Thing thing, String name, int x, int y) {
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/space.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/space.html 2007-11-21 17:16:47 UTC (rev 595)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/space.html 2007-11-21 17:16:57 UTC (rev 596)
@@ -17,35 +17,11 @@
#spaceDiv {
width: 758px;
- height: 500px;
+ height: 600px;
border: solid 1px #CCD;
color: #AAA;
}
-#chatHistory {
- width: 752px;
- height: 100px;
- border: solid 1px #CCD;
- border-top: 0px;
- overflow: auto;
- padding: 0px 3px 0px 3px;
-}
-
-#chatForm {
- margin: 0px 0px 0px 0px;
- padding: 0px;
-}
-
-#commandInput {
- padding: 3px;
- width: 650px;
- border: solid 1px #CCD;
-}
-
-#sendCommandButton {
- width: 90px;
-}
-
#infoDiv {
float:right;
padding: 10px 0px 10px 0px;
@@ -68,7 +44,7 @@
function init(){
populateMemberMenuItem();
viewerWidth = 758;
- viewerHeight = 500;
+ viewerHeight = 700;
initSpaceUI();
}
</script>
@@ -97,12 +73,6 @@
<div id="spaceDiv">
<noscript><div style="width: 100%; text-align: center; color: #911;">You must enable javascript to view this page.</div></noscript>
</div>
-
- <div id="chatHistory"></div>
- <form id="chatForm" onsubmit="goChatForm(); return false;">
- <input id="commandInput" type="text" />
- <input id="sendCommandButton" type="submit" value="send" />
- </form>
<div id="messages">
</div>
</div><!-- end main -->
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceEmbed.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceEmbed.html 2007-11-21 17:16:47 UTC (rev 595)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceEmbed.html 2007-11-21 17:16:57 UTC (rev 596)
@@ -9,42 +9,17 @@
}
#spaceDiv {
width: 758px;
- height: 500px;
+ height: 600px;
color: #AAA;
}
-
-#chatHistory {
- width: 752px;
- height: 100px;
- border: solid 1px #CCD;
- border-top: 0px;
- overflow: auto;
- padding: 0px 3px 0px 3px;
-}
-
-#chatForm {
- margin: 0px 0px 0px 0px;
- padding: 0px;
-}
-
-#commandInput {
- padding: 3px;
- width: 650px;
- border: solid 1px #CCD;
-}
-
-#sendCommandButton {
- width: 90px;
-}
</style>
<script type="text/javascript" src="/og/ogoglio.js"></script>
<script type="text/javascript" src="/og/browserTests.js"></script>
<script type="text/javascript" src="/og/spaceui.js"></script>
<script type="text/javascript">
-var chatHistoryHeight = 50;
var viewerWidth = getIntParameter('width', 758);
-var viewerHeight = getIntParameter('height', 500);
+var viewerHeight = getIntParameter('height', 600);
var showChat = locationParameters['showChat'] != 'false';
var autoGuest = locationParameters['autoGuest'] == 'true';
var movable = locationParameters['movable'] != 'false';
@@ -64,17 +39,6 @@
spaceDiv.style.width = viewerWidth + "px";
spaceDiv.style.height = viewerHeight + "px";
- var chatForm = document.getElementById('chatForm');
- var chatHistory = document.getElementById('chatHistory');
- var commandInput = document.getElementById('commandInput');
- if(showChat){
- chatHistory.style.width = (viewerWidth - 6) + "px";
- chatHistory.style.height = chatHistoryHeight + "px";
- commandInput.style.width = (viewerWidth - 110) + "px";
- } else {
- chatForm.style.visibility = "hidden";
- chatForm.innerHTML = "";
- }
initSpaceUI();
}
@@ -92,12 +56,6 @@
<noscript><div style="width: 100%; text-align: center; color: #911;">You must enable javascript to view this page.</div></noscript>
</div>
- <div id="chatHistory"></div>
- <form id="chatForm" onsubmit="goChatForm(); return false;">
- <input id="commandInput" type="text" />
- <input id="sendCommandButton" type="submit" value="send" />
- </form>
-
<!-- Copyright 2007 Transmutable (http://transmutable.com/) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.-->
</body>
</html>
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2007-11-21 17:16:47 UTC (rev 595)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2007-11-21 17:16:57 UTC (rev 596)
@@ -8,8 +8,8 @@
var startRY = 0;
var startRZ = 0;
var movable = true;
+var showChat = true;
var spaceDiv = null;
-var chatHistory = null;
var signinURL = "signin.html";
function handleSpaceDoc(xml){
@@ -90,6 +90,7 @@
html += "<param name='serviceURI' value='" + serviceURI + "' />";
html += "<param name='spaceID' value='" + locationParameters['spaceID'] + "' />";
html += "<param name='image' value='" + appletLoadingImagePath + "' />";
+ html += "<param name='showChat' value='" + showChat + "' />";
if(startX != 0){
html += "<param name='x' value='" + startX + "' />";
}
@@ -116,75 +117,6 @@
spaceDiv.innerHTML = html;
}
-function displayLink(displayName, link){
- displayName = displayName + "";
- link = link + "";
-
- displayChatMessage("Link: <a onclick='popUp(\"" + link + "\", true); return false;' href='javascript:void(0);'>" + escapeHTML(displayName) + "</a>");
-}
-
-//called by the viewer applet
-function focusCommandField(){
- var commandInput = document.getElementById("commandInput");
- if(typeof commandInput != 'undefined'){
- commandInput.focus();
- }
-}
-
-function displayChatMessage(message){
- message = message + ""; //makes message into a js string instead of a (buggy on safari) string
- var username = null;
- var text = null;
- if(message.indexOf(":") != -1){
- username = message.substring(0, message.indexOf(":"));
- if(username.indexOf(guestCookiePrefix) == 0){
- username = convertGuestCookieToDisplayName(username);
- }
-
- text = message.substring(message.indexOf(":") + 1);
- } else {
- username = "system";
- text = message;
- }
-
- chatHistory.innerHTML += "<span class='chatUsername'>" + username + "</span>: " + markupChatMessage(text) + "<br />";
- chatHistory.scrollTop = chatHistory.scrollHeight;
- focusCommandField();
-}
-
-var emoteIconBase = appPath + "/icons/16x16/";
-
-var emotePatterns = new Array();
-var emoteImageNames = new Array();
-
-emotePatterns[emotePatterns.length] = "0:-)"; emoteImageNames[emoteImageNames.length] = "face-angel.png";
-emotePatterns[emotePatterns.length] = ":'("; emoteImageNames[emoteImageNames.length] = "face-crying.png";
-emotePatterns[emotePatterns.length] = ">:-)"; emoteImageNames[emoteImageNames.length] = "face-devil-grin.png";
-emotePatterns[emotePatterns.length] = "B-)"; emoteImageNames[emoteImageNames.length] = "face-glasses.png";
-emotePatterns[emotePatterns.length] = ":-*"; emoteImageNames[emoteImageNames.length] = "face-kiss.png";
-emotePatterns[emotePatterns.length] = ":-(|)"; emoteImageNames[emoteImageNames.length] = "face-monkey.png";
-emotePatterns[emotePatterns.length] = ":-|"; emoteImageNames[emoteImageNames.length] = "face-plain.png";
-emotePatterns[emotePatterns.length] = ":-("; emoteImageNames[emoteImageNames.length] = "face-sad.png";
-emotePatterns[emotePatterns.length] = ":-)"; emoteImageNames[emoteImageNames.length] = "face-smile.png";
-emotePatterns[emotePatterns.length] = ":-D"; emoteImageNames[emoteImageNames.length] = "face-smile-big.png";
-emotePatterns[emotePatterns.length] = ":-0"; emoteImageNames[emoteImageNames.length] = "face-surprise.png";
-emotePatterns[emotePatterns.length] = ";-)"; emoteImageNames[emoteImageNames.length] = "face-wink.png";
-
-function markupChatMessage(messageText){
- for(var i = 0; i < emotePatterns.length; i++){
- messageText = emotify(messageText, emotePatterns[i], emoteIconBase + emoteImageNames[i]);
- }
- return messageText;
-}
-
-function emotify(messageText, emotePattern, imageURL){
- var workingText = messageText;
- while(workingText.indexOf(emotePattern) != -1){
- workingText = workingText.substring(0, workingText.indexOf(emotePattern)) + "<img src='" + imageURL +"' width='16' height='16' />" + workingText.substring(workingText.indexOf(emotePattern) + emotePattern.length);
- }
- return workingText;
-}
-
function handleTestResults(success){
if(!success){
//we leave the error message there
@@ -194,31 +126,8 @@
writeApplet();
}
-function goChatForm(){
- var form = document.getElementById("chatForm");
- var commandValue = form.commandInput.value;
- if(commandValue == null || trim(commandValue).length == 0){
- return;
- }
- form.commandInput.value = "";
- if(commandValue == "/help"){
- displayChatMessage(getHelpMessage());
- return;
- }
- document.viewer.sendChatMessage(commandValue);
-}
-
-function getHelpMessage(){
- var helpMessage = "Help: Click the 3D scene and use your arrow keys to explore.<br/>"
- helpMessage += "Drag the mouse up/down and left/right to move your camera.<br/>";
- helpMessage += "Press the escape key to reset your camera.<br/>"
- helpMessage += "PageUp/PageDown tilts your camera.";
- return helpMessage;
-}
-
function initSpaceUI(){
spaceDiv = document.getElementById('spaceDiv');
- chatHistory = document.getElementById('chatHistory');
addAuthListeners(spaceHandleAuth, spaceHandleAuth);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|