|
From: <tre...@us...> - 2007-08-30 00:59:00
|
Revision: 292
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=292&view=rev
Author: trevorolio
Date: 2007-08-29 17:58:59 -0700 (Wed, 29 Aug 2007)
Log Message:
-----------
Added the path from a template script to the info panel.
Cannot send information in the other direction, yet.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java
maven/trunk/ogoglio-server/src/main/webapp/space.html
maven/trunk/ogoglio-server/src/main/webapp/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-08-29 21:43:58 UTC (rev 291)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-08-30 00:58:59 UTC (rev 292)
@@ -454,6 +454,14 @@
listener.generatedSpaceEventForUser(username, spaceEvent, this);
}
+ public void showInfoPanelToUser(long sourceThingID, String username, String infoPanelHTML) {
+ SpaceEvent spaceEvent = new SpaceEvent(SpaceEvent.SHOW_INFO_PANEL_EVENT);
+ spaceEvent.setProperty(SpaceEvent.USERNAME, username);
+ spaceEvent.setProperty(SpaceEvent.THING_ID, new Long(sourceThingID));
+ spaceEvent.setProperty(SpaceEvent.INFO_PANEL_HTML, infoPanelHTML);
+ listener.generatedSpaceEventForUser(username, spaceEvent, this);
+ }
+
public DoorDocument addDoor(String displayName, long templateID, String templateOwner, URI link, Transform3D transform) {
Template template = getTemplate(templateID);
Door door = new Door(space, template, -1, displayName, link, transform);
@@ -1048,5 +1056,4 @@
public void mouseContextClickedThing(Thing thing, String name, int x, int y) {
}
}
-
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java 2007-08-29 21:43:58 UTC (rev 291)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java 2007-08-30 00:58:59 UTC (rev 292)
@@ -98,6 +98,10 @@
return spaceSimulator.removeSetting(key);
}
+ public void jsFunction_showInfoPanel(double sourceThingID, String username, String infoPanelHTML){
+ spaceSimulator.showInfoPanelToUser((long)sourceThingID, username, infoPanelHTML);
+ }
+
public void jsFunction_log(String message) {
spaceSimulator.log(message);
}
Modified: maven/trunk/ogoglio-server/src/main/webapp/space.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/space.html 2007-08-29 21:43:58 UTC (rev 291)
+++ maven/trunk/ogoglio-server/src/main/webapp/space.html 2007-08-30 00:58:59 UTC (rev 292)
@@ -11,6 +11,10 @@
<script type="text/javascript" src="/og/spaceui.js"></script>
<style type="text/css">
+body {
+ width: 1050px;
+}
+
#spaceDiv {
width: 758px;
height: 500px;
@@ -41,6 +45,23 @@
#sendCommandButton {
width: 90px;
}
+
+#infoDiv {
+ float:right;
+ padding: 10px 0px 10px 0px;
+ width: 270px;
+ height: 580px;
+ background-color: #FFF;
+}
+
+.infoPanel {
+ width: 100%;
+ padding: 2px;
+ margin: 0px 0px 10px 0px;
+ border-style: solid;
+ border-width: 10px 1px 1px 1px;
+ border-color: #CCD;
+}
</style>
<script type="text/javascript">
@@ -70,6 +91,9 @@
</div> <!-- end header menu -->
<div style="margin: 0px;">
+ <div id="infoDiv"> </div>
+
+ </div>
<div id="spaceDiv">
<noscript><div style="width: 100%; text-align: center; color: #911;">You must enable javascript to view this page.</div></noscript>
</div>
Modified: maven/trunk/ogoglio-server/src/main/webapp/spaceui.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/spaceui.js 2007-08-29 21:43:58 UTC (rev 291)
+++ maven/trunk/ogoglio-server/src/main/webapp/spaceui.js 2007-08-30 00:58:59 UTC (rev 292)
@@ -136,6 +136,7 @@
chatHistory.innerHTML += "<strong>" + username + "</strong>: " + markupChatMessage(text) + "<br />";
chatHistory.scrollTop = chatHistory.scrollHeight;
+ focusCommandField();
}
var emoteIconBase = appPath + "/icons/16x16/";
@@ -196,4 +197,43 @@
addAuthListeners(spaceHandleAuth, spaceHandleAuth);
}
+//############## Start Info Panel Functions ##################
+var infoPanels = new Array();
+
+function addInfoPanel(id, panelHTML){
+ var infoDiv = document.getElementById("infoDiv");
+ if(infoDiv == null){
+ return;
+ }
+ var panelID = "infoPanel-" + id;
+ var infoPanelElement = document.createElement("div");
+ infoPanelElement.setAttribute("id", panelID);
+ infoPanelElement.setAttribute("class", "infoPanel");
+ infoPanelElement.innerHTML = panelHTML;
+
+ if(infoPanels[id] != null){
+ infoDiv.replaceChild(infoPanelElement, infoPanels[id]);
+ infoPanels[id] = infoPanelElement;
+ } else {
+ var tempElement = document.createElement("div");
+ infoDiv.appendChild(tempElement);
+ infoDiv.appendChild(infoPanelElement);
+ infoDiv.removeChild(tempElement);
+ infoPanels[id] = infoPanelElement;
+ infoPanels[id].focus();
+ }
+}
+
+function removeInfoPanel(id){
+ var infoDiv = document.getElementById("infoDiv");
+ if(infoDiv == null){
+ return;
+ }
+ if(infoPanels[id] == null){
+ return;
+ }
+ infoDiv.removeChild(infoPanels[id]);
+ infoPanels[id] = null;
+}
+
// 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.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-09-01 19:20:34
|
Revision: 324
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=324&view=rev
Author: trevorolio
Date: 2007-09-01 12:20:33 -0700 (Sat, 01 Sep 2007)
Log Message:
-----------
Fixed a bug in the thing service code which didn't pass parameter values correctly.
Added a TV template which provides a context menu list of blip.tv videos which it will play in its info panel. So, we're starting to get some leverage from letting the browser handle webish media instead of trying to shoehorn it into 3D.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java
Added Paths:
-----------
maven/trunk/ogoglio-server/src/main/resources/populate/template-42/
maven/trunk/ogoglio-server/src/main/resources/populate/template-42/TV.blend
maven/trunk/ogoglio-server/src/main/resources/populate/template-42/TV.js
maven/trunk/ogoglio-server/src/main/resources/populate/template-42/TV.mtl
maven/trunk/ogoglio-server/src/main/resources/populate/template-42/TV.obj
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java 2007-09-01 17:12:25 UTC (rev 323)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java 2007-09-01 19:20:33 UTC (rev 324)
@@ -307,7 +307,6 @@
return response;
}
- //TODO actually pass the parameter map
String[] parameterNames = (String[]) parameterMap.keySet().toArray(new String[0]);
String[] parameterValues = new String[parameterNames.length];
for (int i = 0; i < parameterValues.length; i++) {
@@ -316,8 +315,8 @@
parameterValues[i] = (String) parameterMap.get(parameterNames[i]);
} else if(value instanceof String[]){
String[] array = (String[])value;
- for (int j = 0; j < array.length; j++) {
- System.out.println(parameterNames[i] + ": " + array[j]);
+ if(array.length > 0){
+ parameterValues[i] = array[0];
}
} else {
System.err.println("Got an unhandled parameter type: " + parameterMap.get(parameterNames[i]).getClass());
Added: maven/trunk/ogoglio-server/src/main/resources/populate/template-42/TV.blend
===================================================================
(Binary files differ)
Property changes on: maven/trunk/ogoglio-server/src/main/resources/populate/template-42/TV.blend
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: maven/trunk/ogoglio-server/src/main/resources/populate/template-42/TV.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/populate/template-42/TV.js (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/populate/template-42/TV.js 2007-09-01 19:20:33 UTC (rev 324)
@@ -0,0 +1,49 @@
+var thingID = -1;
+
+function construct(id){
+ thingID = id;
+}
+
+function Channel(theDisplayName, theHTML, theNonce) {
+ this.displayName = theDisplayName;
+ this.html = theHTML;
+ this.nonce = theNonce;
+}
+
+var omnHTML = '<html><body><object type="application/x-shockwave-flash" data="http://blip.tv/scripts/flash/showplayer.swf?autostart=true&brandname=One%20Minute%20News&brandlink=http%3A//dina.blip.tv/&showplayerpath=http%3A//blip.tv/scripts/flash/showplayer.swf&file=http%3A//dina.blip.tv/%3Fskin%3Drss%26sort%3Ddate&user=TrevorFSmith&showguidebutton=true&showfsbutton=true&useCode=1188671857921&fullscreenpage=http%3A//blip.tv/fullscreen.html&fsreturnpage=http%3A//blip.tv/exitfullscreen.html" width="250" height="250" allowfullscreen="true" id="showplayer"><param name="movie" value="http://blip.tv/scripts/flash/showplayer.swf?autostart=true&brandname=One%20Minute%20News&brandlink=http%3A//dina.blip.tv/&showplayerpath=http%3A//blip.tv/scripts/flash/showplayer.swf&file=http%3A//dina.blip.tv/%3Fskin%3Drss%26sort%3Ddate&user=TrevorFSmith&showguidebutton=true&showfsbutton=true&useCode=1188671857921&fullscreenpage=http%3A//blip.tv/fullscreen.html&fsreturnpage=http%3A//blip.tv/exitfullscreen.html" /><param name="quality" value="best" /><param name="allowScriptAccess" value="always" /></object></html></body></html>';
+var oneMinuteNewsChannel = new Channel("One Minute News", omnHTML, "omn");
+
+var transmutableHTML = '<html><body><object type="application/x-shockwave-flash" data="http://blip.tv/scripts/flash/showplayer.swf?autostart=true&brandname=transmutable&brandlink=http%3A//transmutable.blip.tv/&showplayerpath=http%3A//blip.tv/scripts/flash/showplayer.swf&file=http%3A//transmutable.blip.tv/%3Fskin%3Drss%26sort%3Ddate&user=TrevorFSmith&showguidebutton=true&showfsbutton=true&useCode=1188673893371&fullscreenpage=http%3A//blip.tv/fullscreen.html&fsreturnpage=http%3A//blip.tv/exitfullscreen.html" width="250" height="250" allowfullscreen="true" id="showplayer"><param name="movie" value="http://blip.tv/scripts/flash/showplayer.swf?autostart=true&brandname=transmutable&brandlink=http%3A//transmutable.blip.tv/&showplayerpath=http%3A//blip.tv/scripts/flash/showplayer.swf&file=http%3A//transmutable.blip.tv/%3Fskin%3Drss%26sort%3Ddate&user=TrevorFSmith&showguidebutton=true&showfsbutton=true&useCode=1188673893371&fullscreenpage=http%3A//blip.tv/fullscreen.html&fsreturnpage=http%3A//blip.tv/exitfullscreen.html" /><param name="quality" value="best" /><param name="allowScriptAccess" value="always" /></object></body></html>';
+var transmutableChannel = new Channel("Transmutable", transmutableHTML, "transmutable");
+
+var channels = new Array(oneMinuteNewsChannel, transmutableChannel);
+
+function onContextClick(person, shapeName){
+ var items = new Array();
+ for(var i=0; i < channels.length; i++){
+ items[items.length] = new ContextMenuInfo(channels[i].displayName, true, channels[i].nonce);
+ }
+ return items;
+}
+
+function onContextMenuItemChosen(username, id){
+ for(var i=0; i < channels.length; i++){
+ if(id == channels[i].nonce){
+ space.showInfoPanel(thingID, username, channels[i].nonce);
+ return username + " chose to watch " + channels[i].displayName;
+ }
+ }
+ return "Context chose an uknown item";
+}
+
+function onService(method, parameterNames, parameterValues){
+ if(parameterNames.length == 0){
+ return new HTTPResponse(200, "No Video Selected.", "text/plain");
+ }
+ for(var i=0; i < channels.length; i++){
+ if(parameterValues[0] == channels[i].nonce){
+ return new HTTPResponse(200, channels[i].html, "text/html");
+ }
+ }
+ return new HTTPResponse(200, "Unknown video id: " + parameterValues[0], "text/plain");
+}
Added: maven/trunk/ogoglio-server/src/main/resources/populate/template-42/TV.mtl
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/populate/template-42/TV.mtl (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/populate/template-42/TV.mtl 2007-09-01 19:20:33 UTC (rev 324)
@@ -0,0 +1,52 @@
+# Blender3D MTL File: TV.blend
+# Material Count: 5
+newmtl Red
+Ns 96.078431
+Ka 0.000000 0.000000 0.000000
+Kd 0.800000 0.431043 0.460894
+Ks 0.500000 0.500000 0.500000
+Ni 1.000000
+d 1.000000
+illum 2
+
+
+newmtl Body
+Ns 96.078431
+Ka 0.000000 0.000000 0.000000
+Kd 0.271838 0.411143 0.640000
+Ks 0.500000 0.500000 0.500000
+Ni 1.000000
+d 1.000000
+illum 2
+
+
+newmtl Blue
+Ns 96.078431
+Ka 0.000000 0.000000 0.000000
+Kd 0.351441 0.431043 0.640000
+Ks 0.500000 0.500000 0.500000
+Ni 1.000000
+d 1.000000
+illum 2
+
+
+newmtl Silver
+Ns 96.078431
+Ka 0.000000 0.000000 0.000000
+Kd 0.670646 0.640000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ni 1.000000
+d 1.000000
+illum 2
+
+
+newmtl Black
+Ns 96.078431
+Ka 0.000000 0.000000 0.000000
+Kd 0.160000 0.160000 0.160000
+Ks 0.500000 0.500000 0.500000
+Ni 1.000000
+d 1.000000
+illum 2
+
+
Added: maven/trunk/ogoglio-server/src/main/resources/populate/template-42/TV.obj
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/populate/template-42/TV.obj (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/populate/template-42/TV.obj 2007-09-01 19:20:33 UTC (rev 324)
@@ -0,0 +1,3775 @@
+# Blender3D v243 OBJ File: TV.blend
+# www.blender3d.org
+mtllib TV.mtl
+o Cylinder.005
+v -0.248128 0.000052 -0.250309
+v -0.240604 0.000052 -0.237276
+v -0.240604 0.000052 -0.222227
+v -0.248128 0.000052 -0.209194
+v -0.261161 0.000052 -0.201670
+v -0.276210 0.000052 -0.201670
+v -0.289243 0.000052 -0.209194
+v -0.296767 0.000052 -0.222227
+v -0.296767 0.000052 -0.237276
+v -0.289243 0.000052 -0.250309
+v -0.276210 0.000052 -0.257833
+v -0.261161 0.000052 -0.257833
+v -0.235520 0.055667 -0.262917
+v -0.223381 0.055667 -0.241891
+v -0.223380 0.055667 -0.217612
+v -0.235520 0.055667 -0.196586
+v -0.256546 0.055667 -0.184447
+v -0.280825 0.055667 -0.184447
+v -0.301851 0.055667 -0.196586
+v -0.313990 0.055667 -0.217612
+v -0.313990 0.055667 -0.241891
+v -0.301851 0.055667 -0.262917
+v -0.280825 0.055667 -0.275056
+v -0.256546 0.055667 -0.275056
+v -0.268685 0.000052 -0.229752
+v -0.268685 0.055667 -0.229752
+usemtl Black
+s 1
+f 25 1 2
+f 26 14 13
+f 25 2 3
+f 26 15 14
+f 25 3 4
+f 26 16 15
+f 25 4 5
+f 26 17 16
+f 25 5 6
+f 26 18 17
+f 25 6 7
+f 26 19 18
+f 25 7 8
+f 26 20 19
+f 25 8 9
+f 26 21 20
+f 25 9 10
+f 26 22 21
+f 25 10 11
+f 26 23 22
+f 25 11 12
+f 26 24 23
+f 12 1 25
+f 26 13 24
+f 1 13 14 2
+f 2 14 15 3
+f 3 15 16 4
+f 4 16 17 5
+f 5 17 18 6
+f 6 18 19 7
+f 7 19 20 8
+f 8 20 21 9
+f 9 21 22 10
+f 10 22 23 11
+f 11 23 24 12
+f 13 1 12 24
+o Cylinder.004
+v 0.352979 0.000052 -0.250309
+v 0.360504 0.000052 -0.237276
+v 0.360504 0.000052 -0.222227
+v 0.352979 0.000052 -0.209194
+v 0.339947 0.000052 -0.201670
+v 0.324898 0.000052 -0.201670
+v 0.311865 0.000052 -0.209194
+v 0.304341 0.000052 -0.222227
+v 0.304341 0.000052 -0.237276
+v 0.311865 0.000052 -0.250309
+v 0.324898 0.000052 -0.257833
+v 0.339947 0.000052 -0.257833
+v 0.365588 0.055667 -0.262917
+v 0.377727 0.055667 -0.241891
+v 0.377727 0.055667 -0.217612
+v 0.365588 0.055667 -0.196586
+v 0.344562 0.055667 -0.184447
+v 0.320283 0.055667 -0.184447
+v 0.299257 0.055667 -0.196586
+v 0.287117 0.055667 -0.217612
+v 0.287117 0.055667 -0.241891
+v 0.299257 0.055667 -0.262917
+v 0.320283 0.055667 -0.275056
+v 0.344562 0.055667 -0.275056
+v 0.332422 0.000052 -0.229752
+v 0.332422 0.055667 -0.229752
+usemtl Black
+s 1
+f 51 27 28
+f 52 40 39
+f 51 28 29
+f 52 41 40
+f 51 29 30
+f 52 42 41
+f 51 30 31
+f 52 43 42
+f 51 31 32
+f 52 44 43
+f 51 32 33
+f 52 45 44
+f 51 33 34
+f 52 46 45
+f 51 34 35
+f 52 47 46
+f 51 35 36
+f 52 48 47
+f 51 36 37
+f 52 49 48
+f 51 37 38
+f 52 50 49
+f 38 27 51
+f 52 39 50
+f 27 39 40 28
+f 28 40 41 29
+f 29 41 42 30
+f 30 42 43 31
+f 31 43 44 32
+f 32 44 45 33
+f 33 45 46 34
+f 34 46 47 35
+f 35 47 48 36
+f 36 48 49 37
+f 37 49 50 38
+f 39 27 38 50
+o Cylinder.003
+v 0.352979 0.000052 0.216294
+v 0.360504 0.000052 0.229327
+v 0.360504 0.000052 0.244376
+v 0.352979 0.000052 0.257409
+v 0.339947 0.000052 0.264933
+v 0.324898 0.000052 0.264933
+v 0.311865 0.000052 0.257409
+v 0.304341 0.000052 0.244376
+v 0.304341 0.000052 0.229327
+v 0.311865 0.000052 0.216295
+v 0.324898 0.000052 0.208770
+v 0.339947 0.000052 0.208770
+v 0.365588 0.055667 0.203686
+v 0.377727 0.055667 0.224712
+v 0.377727 0.055667 0.248991
+v 0.365588 0.055667 0.270017
+v 0.344562 0.055667 0.282156
+v 0.320283 0.055667 0.282157
+v 0.299257 0.055667 0.270017
+v 0.287117 0.055667 0.248991
+v 0.287117 0.055667 0.224712
+v 0.299257 0.055667 0.203686
+v 0.320283 0.055667 0.191547
+v 0.344562 0.055667 0.191547
+v 0.332422 0.000052 0.236852
+v 0.332422 0.055667 0.236852
+usemtl Black
+s 1
+f 77 53 54
+f 78 66 65
+f 77 54 55
+f 78 67 66
+f 77 55 56
+f 78 68 67
+f 77 56 57
+f 78 69 68
+f 77 57 58
+f 78 70 69
+f 77 58 59
+f 78 71 70
+f 77 59 60
+f 78 72 71
+f 77 60 61
+f 78 73 72
+f 77 61 62
+f 78 74 73
+f 77 62 63
+f 78 75 74
+f 77 63 64
+f 78 76 75
+f 64 53 77
+f 78 65 76
+f 53 65 66 54
+f 54 66 67 55
+f 55 67 68 56
+f 56 68 69 57
+f 57 69 70 58
+f 58 70 71 59
+f 59 71 72 60
+f 60 72 73 61
+f 61 73 74 62
+f 62 74 75 63
+f 63 75 76 64
+f 65 53 64 76
+o Cylinder.002
+v -0.248128 0.000052 0.216294
+v -0.240604 0.000052 0.229327
+v -0.240604 0.000052 0.244376
+v -0.248128 0.000052 0.257409
+v -0.261161 0.000052 0.264933
+v -0.276210 0.000052 0.264933
+v -0.289243 0.000052 0.257409
+v -0.296767 0.000052 0.244376
+v -0.296767 0.000052 0.229327
+v -0.289243 0.000052 0.216295
+v -0.276210 0.000052 0.208770
+v -0.261161 0.000052 0.208770
+v -0.235520 0.055667 0.203686
+v -0.223381 0.055667 0.224712
+v -0.223381 0.055667 0.248991
+v -0.235520 0.055667 0.270017
+v -0.256546 0.055667 0.282156
+v -0.280825 0.055667 0.282157
+v -0.301851 0.055667 0.270017
+v -0.313990 0.055667 0.248991
+v -0.313990 0.055667 0.224712
+v -0.301851 0.055667 0.203686
+v -0.280825 0.055667 0.191547
+v -0.256546 0.055667 0.191547
+v -0.268685 0.000052 0.236852
+v -0.268685 0.055667 0.236852
+usemtl Black
+s 1
+f 103 79 80
+f 104 92 91
+f 103 80 81
+f 104 93 92
+f 103 81 82
+f 104 94 93
+f 103 82 83
+f 104 95 94
+f 103 83 84
+f 104 96 95
+f 103 84 85
+f 104 97 96
+f 103 85 86
+f 104 98 97
+f 103 86 87
+f 104 99 98
+f 103 87 88
+f 104 100 99
+f 103 88 89
+f 104 101 100
+f 103 89 90
+f 104 102 101
+f 90 79 103
+f 104 91 102
+f 79 91 92 80
+f 80 92 93 81
+f 81 93 94 82
+f 82 94 95 83
+f 83 95 96 84
+f 84 96 97 85
+f 85 97 98 86
+f 86 98 99 87
+f 87 99 100 88
+f 88 100 101 89
+f 89 101 102 90
+f 91 79 90 102
+o Tube.001_Tube.002
+v 0.175528 1.073621 0.240888
+v 0.176808 1.072882 0.235374
+v 0.173312 1.074901 0.231338
+v 0.168537 1.077657 0.232815
+v 0.167258 1.078396 0.238329
+v 0.170753 1.076378 0.242365
+v 0.048589 0.853756 0.240888
+v 0.049869 0.853018 0.235374
+v 0.046373 0.855036 0.231338
+v 0.041598 0.857793 0.232815
+v 0.040319 0.858531 0.238329
+v 0.043814 0.856513 0.242365
+v 0.179189 1.071507 0.245115
+v 0.181809 1.069995 0.233827
+v 0.174652 1.074127 0.225563
+v 0.164876 1.079771 0.228588
+v 0.162257 1.081283 0.239876
+v 0.169413 1.077151 0.248140
+v 0.180625 1.079492 0.242366
+v 0.182373 1.078483 0.234833
+v 0.177597 1.081240 0.229319
+v 0.171073 1.085007 0.231337
+v 0.169325 1.086016 0.238870
+v 0.174101 1.083259 0.244385
+v 0.175849 1.082250 0.236852
+usemtl Silver
+s 1
+f 105 111 112 106
+f 106 112 113 107
+f 107 113 114 108
+f 108 114 115 109
+f 109 115 116 110
+f 111 105 110 116
+f 105 106 118 117
+f 106 107 119 118
+f 107 108 120 119
+f 108 109 121 120
+f 109 110 122 121
+f 110 105 117 122
+f 117 118 124 123
+f 118 119 125 124
+f 119 120 126 125
+f 120 121 127 126
+f 121 122 128 127
+f 122 117 123 128
+f 123 124 129
+f 124 125 129
+f 125 126 129
+f 126 127 129
+f 127 128 129
+f 128 123 129
+o Tube_Tube.001
+v -0.090397 1.077657 0.240888
+v -0.089118 1.078396 0.235374
+v -0.092613 1.076378 0.231338
+v -0.097388 1.073621 0.232815
+v -0.098668 1.072882 0.238329
+v -0.095172 1.074901 0.242365
+v 0.036542 0.857792 0.240888
+v 0.037821 0.858531 0.235374
+v 0.034326 0.856513 0.231338
+v 0.029551 0.853756 0.232815
+v 0.028271 0.853018 0.238329
+v 0.031767 0.855036 0.242365
+v -0.086736 1.079771 0.245115
+v -0.084117 1.081283 0.233827
+v -0.091273 1.077152 0.225563
+v -0.101049 1.071507 0.228588
+v -0.103669 1.069995 0.239876
+v -0.096512 1.074127 0.248140
+v -0.092933 1.085007 0.242366
+v -0.091185 1.086016 0.234833
+v -0.095961 1.083259 0.229319
+v -0.102485 1.079492 0.231337
+v -0.104233 1.078483 0.238870
+v -0.099457 1.081240 0.244385
+v -0.097709 1.082250 0.236852
+usemtl Silver
+s 1
+f 130 136 137 131
+f 131 137 138 132
+f 132 138 139 133
+f 133 139 140 134
+f 134 140 141 135
+f 136 130 135 141
+f 130 131 143 142
+f 131 132 144 143
+f 132 133 145 144
+f 133 134 146 145
+f 134 135 147 146
+f 135 130 142 147
+f 142 143 149 148
+f 143 144 150 149
+f 144 145 151 150
+f 145 146 152 151
+f 146 147 153 152
+f 147 142 148 153
+f 148 149 154
+f 149 150 154
+f 150 151 154
+f 151 152 154
+f 152 153 154
+f 153 148 154
+o Sphere_Sphere.001
+v 0.034982 0.818867 0.296138
+v 0.075193 0.818867 0.274644
+v 0.034869 0.820006 0.177565
+v 0.040541 0.821134 0.178423
+v 0.046103 0.822241 0.179844
+v 0.051502 0.823314 0.181813
+v 0.056685 0.824345 0.184313
+v 0.061603 0.825324 0.187319
+v 0.066209 0.826240 0.190801
+v 0.070458 0.827085 0.194727
+v 0.074308 0.827851 0.199059
+v 0.077724 0.828530 0.203755
+v 0.080672 0.829117 0.208769
+v 0.083123 0.829604 0.214054
+v 0.085055 0.829989 0.219558
+v 0.086448 0.830266 0.225230
+v 0.087289 0.830433 0.231012
+v 0.087571 0.830489 0.236852
+v 0.087289 0.830433 0.242691
+v 0.086448 0.830266 0.248474
+v 0.085055 0.829989 0.254145
+v 0.083123 0.829604 0.259649
+v 0.080672 0.829117 0.264934
+v 0.077724 0.828530 0.269949
+v 0.074308 0.827851 0.274644
+v 0.070458 0.827085 0.278976
+v 0.066209 0.826240 0.282902
+v 0.061603 0.825324 0.286385
+v 0.056685 0.824345 0.289390
+v 0.051502 0.823314 0.291890
+v 0.046103 0.822241 0.293860
+v 0.040541 0.821134 0.295280
+v 0.034869 0.820006 0.296138
+v 0.034537 0.821101 0.296138
+v 0.039880 0.823314 0.295280
+v 0.045119 0.825485 0.293860
+v 0.050205 0.827591 0.291890
+v 0.055087 0.829614 0.289390
+v 0.059720 0.831533 0.286385
+v 0.064058 0.833329 0.282902
+v 0.068060 0.834987 0.278976
+v 0.071688 0.836490 0.274644
+v 0.074905 0.837822 0.269949
+v 0.077682 0.838973 0.264934
+v 0.079991 0.839929 0.259649
+v 0.081811 0.840683 0.254145
+v 0.083123 0.841226 0.248474
+v 0.083916 0.841555 0.242691
+v 0.084181 0.841664 0.236852
+v 0.083916 0.841555 0.231012
+v 0.083123 0.841226 0.225230
+v 0.081811 0.840683 0.219558
+v 0.079991 0.839929 0.214054
+v 0.077682 0.838973 0.208769
+v 0.074905 0.837822 0.203755
+v 0.071688 0.836490 0.199059
+v 0.068060 0.834987 0.194727
+v 0.064058 0.833329 0.190801
+v 0.059720 0.831532 0.187319
+v 0.055087 0.829614 0.184313
+v 0.050205 0.827591 0.181813
+v 0.045119 0.825485 0.179844
+v 0.039880 0.823314 0.178423
+v 0.034537 0.821101 0.177565
+v 0.033998 0.822111 0.177565
+v 0.038806 0.825324 0.178423
+v 0.043521 0.828474 0.179844
+v 0.048098 0.831532 0.181813
+v 0.052492 0.834469 0.184313
+v 0.056662 0.837255 0.187319
+v 0.060566 0.839863 0.190801
+v 0.064168 0.842270 0.194727
+v 0.067432 0.844451 0.199059
+v 0.070328 0.846386 0.203755
+v 0.072827 0.848056 0.208769
+v 0.074905 0.849444 0.214054
+v 0.076543 0.850539 0.219558
+v 0.077724 0.851328 0.225230
+v 0.078437 0.851804 0.231012
+v 0.078676 0.851964 0.236852
+v 0.078437 0.851804 0.242691
+v 0.077724 0.851328 0.248474
+v 0.076543 0.850539 0.254145
+v 0.074905 0.849444 0.259649
+v 0.072827 0.848056 0.264934
+v 0.070328 0.846386 0.269949
+v 0.067432 0.844451 0.274644
+v 0.064168 0.842270 0.278976
+v 0.060566 0.839863 0.282902
+v 0.056662 0.837255 0.286385
+v 0.052492 0.834469 0.289390
+v 0.048098 0.831533 0.291890
+v 0.043521 0.828474 0.293860
+v 0.038806 0.825324 0.295280
+v 0.033998 0.822111 0.296138
+v 0.033271 0.822996 0.296138
+v 0.037361 0.827085 0.295280
+v 0.041371 0.831095 0.293860
+v 0.045263 0.834987 0.291890
+v 0.049000 0.838724 0.289390
+v 0.052546 0.842270 0.286385
+v 0.055866 0.845590 0.282902
+v 0.058929 0.848653 0.278976
+v 0.061705 0.851430 0.274644
+v 0.064168 0.853892 0.269949
+v 0.066293 0.856017 0.264934
+v 0.068060 0.857785 0.259649
+v 0.069453 0.859177 0.254145
+v 0.070458 0.860182 0.248474
+v 0.071064 0.860788 0.242691
+v 0.071267 0.860991 0.236852
+v 0.071064 0.860788 0.231012
+v 0.070458 0.860182 0.225230
+v 0.069453 0.859177 0.219558
+v 0.068060 0.857785 0.214054
+v 0.066293 0.856017 0.208769
+v 0.064168 0.853892 0.203755
+v 0.061705 0.851430 0.199059
+v 0.058929 0.848653 0.194727
+v 0.055866 0.845590 0.190801
+v 0.052546 0.842270 0.187319
+v 0.049000 0.838724 0.184313
+v 0.045263 0.834987 0.181813
+v 0.041371 0.831095 0.179844
+v 0.037360 0.827085 0.178423
+v 0.033271 0.822996 0.177565
+v 0.029142 0.818867 0.177279
+v 0.032386 0.823722 0.177565
+v 0.035599 0.828530 0.178423
+v 0.038750 0.833246 0.179844
+v 0.041808 0.837822 0.181813
+v 0.044744 0.842217 0.184313
+v 0.047530 0.846386 0.187319
+v 0.050139 0.850290 0.190801
+v 0.052546 0.853892 0.194727
+v 0.054727 0.857157 0.199059
+v 0.056662 0.860052 0.203755
+v 0.058331 0.862551 0.208769
+v 0.059720 0.864630 0.214054
+v 0.060814 0.866267 0.219558
+v 0.061603 0.867448 0.225230
+v 0.062080 0.868161 0.231012
+v 0.062239 0.868400 0.236852
+v 0.062080 0.868161 0.242691
+v 0.061603 0.867448 0.248474
+v 0.060814 0.866267 0.254145
+v 0.059720 0.864630 0.259649
+v 0.058331 0.862551 0.264934
+v 0.056662 0.860052 0.269949
+v 0.054727 0.857157 0.274644
+v 0.052546 0.853892 0.278976
+v 0.050139 0.850290 0.282902
+v 0.047530 0.846386 0.286385
+v 0.044744 0.842217 0.289390
+v 0.041808 0.837822 0.291890
+v 0.038750 0.833246 0.293860
+v 0.035599 0.828530 0.295280
+v 0.032387 0.823722 0.296138
+v 0.031377 0.824262 0.296138
+v 0.033590 0.829604 0.295280
+v 0.035760 0.834844 0.293860
+v 0.037867 0.839929 0.291890
+v 0.039889 0.844812 0.289390
+v 0.041808 0.849444 0.286385
+v 0.043605 0.853783 0.282902
+v 0.045263 0.857785 0.278976
+v 0.046765 0.861412 0.274644
+v 0.048098 0.864630 0.269949
+v 0.049248 0.867406 0.264934
+v 0.050205 0.869716 0.259649
+v 0.050958 0.871535 0.254145
+v 0.051502 0.872848 0.248474
+v 0.051830 0.873640 0.242691
+v 0.051940 0.873905 0.236852
+v 0.051830 0.873640 0.231012
+v 0.051502 0.872848 0.225230
+v 0.050958 0.871535 0.219558
+v 0.050205 0.869716 0.214054
+v 0.049248 0.867406 0.208769
+v 0.048098 0.864630 0.203755
+v 0.046765 0.861412 0.199059
+v 0.045263 0.857785 0.194727
+v 0.043605 0.853783 0.190801
+v 0.041808 0.849444 0.187319
+v 0.039889 0.844812 0.184313
+v 0.037867 0.839929 0.181813
+v 0.035760 0.834844 0.179844
+v 0.033590 0.829604 0.178423
+v 0.031377 0.824262 0.177565
+v 0.030282 0.824594 0.177565
+v 0.031410 0.830266 0.178423
+v 0.032516 0.835828 0.179844
+v 0.033590 0.841226 0.181813
+v 0.034621 0.846410 0.184313
+v 0.035599 0.851328 0.187319
+v 0.036515 0.855933 0.190801
+v 0.037361 0.860182 0.194727
+v 0.038126 0.864033 0.199059
+v 0.038806 0.867448 0.203755
+v 0.039392 0.870396 0.208769
+v 0.039880 0.872848 0.214054
+v 0.040264 0.874779 0.219558
+v 0.040541 0.876172 0.225230
+v 0.040709 0.877014 0.231012
+v 0.040765 0.877295 0.236852
+v 0.040709 0.877014 0.242691
+v 0.040541 0.876172 0.248474
+v 0.040264 0.874779 0.254145
+v 0.039880 0.872848 0.259649
+v 0.039392 0.870396 0.264934
+v 0.038806 0.867448 0.269949
+v 0.038126 0.864033 0.274644
+v 0.037361 0.860182 0.278976
+v 0.036515 0.855933 0.282902
+v 0.035599 0.851328 0.286385
+v 0.034621 0.846410 0.289390
+v 0.033590 0.841226 0.291890
+v 0.032516 0.835828 0.293860
+v 0.031410 0.830266 0.295280
+v 0.030282 0.824594 0.296138
+v 0.029142 0.824706 0.296138
+v 0.029142 0.830489 0.295280
+v 0.029142 0.836160 0.293860
+v 0.029142 0.841664 0.291890
+v 0.029142 0.846949 0.289390
+v 0.029142 0.851964 0.286385
+v 0.029142 0.856660 0.282902
+v 0.029142 0.860991 0.278976
+v 0.029142 0.864917 0.274644
+v 0.029142 0.868400 0.269949
+v 0.029142 0.871406 0.264934
+v 0.029142 0.873905 0.259649
+v 0.029142 0.875875 0.254145
+v 0.029142 0.877295 0.248474
+v 0.029142 0.878153 0.242691
+v 0.029142 0.878440 0.236852
+v 0.029142 0.878153 0.231012
+v 0.029142 0.877295 0.225230
+v 0.029142 0.875875 0.219558
+v 0.029142 0.873905 0.214054
+v 0.029142 0.871406 0.208769
+v 0.029142 0.868400 0.203755
+v 0.029142 0.864917 0.199059
+v 0.029142 0.860991 0.194727
+v 0.029142 0.856660 0.190801
+v 0.029142 0.851964 0.187319
+v 0.029142 0.846949 0.184313
+v 0.029142 0.841664 0.181813
+v 0.029142 0.836160 0.179844
+v 0.029142 0.830489 0.178423
+v 0.029142 0.824706 0.177565
+v 0.028003 0.824594 0.177565
+v 0.026875 0.830266 0.178423
+v 0.025769 0.835828 0.179844
+v 0.024695 0.841226 0.181813
+v 0.023664 0.846410 0.184313
+v 0.022686 0.851328 0.187319
+v 0.021769 0.855933 0.190801
+v 0.020924 0.860182 0.194727
+v 0.020158 0.864033 0.199059
+v 0.019479 0.867448 0.203755
+v 0.018893 0.870396 0.208769
+v 0.018405 0.872848 0.214054
+v 0.018021 0.874779 0.219558
+v 0.017744 0.876172 0.225230
+v 0.017576 0.877014 0.231012
+v 0.017520 0.877295 0.236852
+v 0.017576 0.877014 0.242691
+v 0.017744 0.876172 0.248474
+v 0.018021 0.874779 0.254145
+v 0.018405 0.872848 0.259649
+v 0.018893 0.870396 0.264934
+v 0.019479 0.867448 0.269949
+v 0.020158 0.864033 0.274644
+v 0.020924 0.860182 0.278976
+v 0.021769 0.855933 0.282902
+v 0.022686 0.851328 0.286385
+v 0.023664 0.846410 0.289390
+v 0.024695 0.841226 0.291890
+v 0.025769 0.835828 0.293860
+v 0.026875 0.830266 0.295280
+v 0.028003 0.824594 0.296138
+v 0.026908 0.824262 0.296138
+v 0.024695 0.829604 0.295280
+v 0.022525 0.834844 0.293860
+v 0.020418 0.839929 0.291890
+v 0.018396 0.844812 0.289390
+v 0.016477 0.849444 0.286385
+v 0.014680 0.853783 0.282902
+v 0.013022 0.857785 0.278976
+v 0.011520 0.861412 0.274644
+v 0.010187 0.864630 0.269949
+v 0.009037 0.867406 0.264934
+v 0.008080 0.869716 0.259649
+v 0.007326 0.871535 0.254145
+v 0.006783 0.872848 0.248474
+v 0.006455 0.873640 0.242691
+v 0.006345 0.873905 0.236852
+v 0.006455 0.873640 0.231012
+v 0.006783 0.872848 0.225230
+v 0.007326 0.871535 0.219558
+v 0.008080 0.869716 0.214054
+v 0.009037 0.867406 0.208769
+v 0.010187 0.864630 0.203755
+v 0.011520 0.861412 0.199059
+v 0.013022 0.857785 0.194727
+v 0.014680 0.853783 0.190801
+v 0.016477 0.849444 0.187319
+v 0.018396 0.844812 0.184313
+v 0.020418 0.839929 0.181813
+v 0.022525 0.834844 0.179844
+v 0.024695 0.829604 0.178423
+v 0.026908 0.824262 0.177565
+v 0.025898 0.823722 0.177565
+v 0.022686 0.828530 0.178423
+v 0.019535 0.833246 0.179844
+v 0.016477 0.837822 0.181813
+v 0.013541 0.842217 0.184313
+v 0.010755 0.846386 0.187319
+v 0.008146 0.850290 0.190801
+v 0.005739 0.853892 0.194727
+v 0.003558 0.857157 0.199059
+v 0.001623 0.860052 0.203755
+v -0.000047 0.862551 0.208769
+v -0.001435 0.864630 0.214054
+v -0.002529 0.866267 0.219558
+v -0.003319 0.867448 0.225230
+v -0.003795 0.868161 0.231012
+v -0.003955 0.868400 0.236852
+v -0.003795 0.868161 0.242691
+v -0.003319 0.867448 0.248474
+v -0.002529 0.866267 0.254145
+v -0.001435 0.864630 0.259649
+v -0.000047 0.862551 0.264934
+v 0.001623 0.860052 0.269949
+v 0.003558 0.857157 0.274644
+v 0.005739 0.853892 0.278976
+v 0.008146 0.850290 0.282902
+v 0.010755 0.846386 0.286385
+v 0.013541 0.842217 0.289390
+v 0.016477 0.837822 0.291890
+v 0.019535 0.833246 0.293860
+v 0.022686 0.828530 0.295280
+v 0.025898 0.823722 0.296138
+v 0.025014 0.822996 0.296138
+v 0.020924 0.827085 0.295280
+v 0.016914 0.831095 0.293860
+v 0.013022 0.834987 0.291890
+v 0.009285 0.838724 0.289390
+v 0.005739 0.842270 0.286385
+v 0.002419 0.845590 0.282902
+v -0.000644 0.848653 0.278976
+v -0.003420 0.851430 0.274644
+v -0.005883 0.853892 0.269949
+v -0.008008 0.856017 0.264934
+v -0.009776 0.857785 0.259649
+v -0.011168 0.859177 0.254145
+v -0.012173 0.860182 0.248474
+v -0.012779 0.860788 0.242691
+v -0.012982 0.860991 0.236852
+v -0.012779 0.860788 0.231012
+v -0.012173 0.860182 0.225230
+v -0.011168 0.859177 0.219558
+v -0.009776 0.857785 0.214054
+v -0.008008 0.856017 0.208769
+v -0.005883 0.853892 0.203755
+v -0.003420 0.851430 0.199059
+v -0.000644 0.848653 0.194727
+v 0.002419 0.845590 0.190801
+v 0.005739 0.842270 0.187319
+v 0.009285 0.838724 0.184313
+v 0.013022 0.834987 0.181813
+v 0.016914 0.831095 0.179844
+v 0.020924 0.827085 0.178423
+v 0.025014 0.822996 0.177565
+v 0.024287 0.822111 0.177565
+v 0.019479 0.825324 0.178423
+v 0.014764 0.828474 0.179844
+v 0.010187 0.831532 0.181813
+v 0.005793 0.834469 0.184313
+v 0.001623 0.837255 0.187319
+v -0.002281 0.839863 0.190801
+v -0.005883 0.842270 0.194727
+v -0.009147 0.844451 0.199059
+v -0.012043 0.846386 0.203755
+v -0.014542 0.848056 0.208769
+v -0.016620 0.849444 0.214054
+v -0.018258 0.850539 0.219558
+v -0.019439 0.851328 0.225230
+v -0.020152 0.851804 0.231012
+v -0.020391 0.851964 0.236852
+v -0.020152 0.851804 0.242691
+v -0.019439 0.851328 0.248474
+v -0.018258 0.850539 0.254145
+v -0.016620 0.849444 0.259649
+v -0.014542 0.848056 0.264934
+v -0.012043 0.846386 0.269949
+v -0.009147 0.844451 0.274644
+v -0.005883 0.842270 0.278976
+v -0.002281 0.839863 0.282902
+v 0.001623 0.837255 0.286385
+v 0.005793 0.834469 0.289390
+v 0.010187 0.831533 0.291890
+v 0.014764 0.828474 0.293860
+v 0.019479 0.825324 0.295280
+v 0.024287 0.822111 0.296138
+v 0.023748 0.821101 0.296138
+v 0.018405 0.823314 0.295280
+v 0.013166 0.825485 0.293860
+v 0.008080 0.827591 0.291890
+v 0.003198 0.829614 0.289390
+v -0.001435 0.831532 0.286385
+v -0.005773 0.833329 0.282902
+v -0.009776 0.834987 0.278976
+v -0.013403 0.836490 0.274644
+v -0.016620 0.837822 0.269949
+v -0.019397 0.838973 0.264934
+v -0.021706 0.839929 0.259649
+v -0.023526 0.840683 0.254145
+v -0.024838 0.841226 0.248474
+v -0.025631 0.841555 0.242691
+v -0.025896 0.841664 0.236852
+v -0.025631 0.841555 0.231012
+v -0.024838 0.841226 0.225230
+v -0.023526 0.840683 0.219558
+v -0.021706 0.839929 0.214054
+v -0.019397 0.838973 0.208769
+v -0.016620 0.837822 0.203755
+v -0.013403 0.836490 0.199059
+v -0.009775 0.834987 0.194727
+v -0.005773 0.833329 0.190801
+v -0.001435 0.831532 0.187319
+v 0.003198 0.829614 0.184313
+v 0.008080 0.827591 0.181813
+v 0.013166 0.825485 0.179844
+v 0.018405 0.823314 0.178423
+v 0.023748 0.821101 0.177565
+v 0.023416 0.820006 0.177565
+v 0.017744 0.821134 0.178423
+v 0.012182 0.822241 0.179844
+v 0.006783 0.823314 0.181813
+v 0.001600 0.824345 0.184313
+v -0.003319 0.825324 0.187319
+v -0.007924 0.826240 0.190801
+v -0.012173 0.827085 0.194727
+v -0.016023 0.827851 0.199059
+v -0.019439 0.828530 0.203755
+v -0.022387 0.829117 0.208769
+v -0.024838 0.829604 0.214054
+v -0.026770 0.829989 0.219558
+v -0.028163 0.830266 0.225230
+v -0.029005 0.830433 0.231012
+v -0.029286 0.830489 0.236852
+v -0.029005 0.830433 0.242691
+v -0.028163 0.830266 0.248474
+v -0.026770 0.829989 0.254145
+v -0.024838 0.829604 0.259649
+v -0.022387 0.829117 0.264934
+v -0.019439 0.828530 0.269949
+v -0.016023 0.827851 0.274644
+v -0.012173 0.827085 0.278976
+v -0.007924 0.826240 0.282902
+v -0.003319 0.825324 0.286385
+v 0.001600 0.824345 0.289390
+v 0.006783 0.823314 0.291890
+v 0.012182 0.822241 0.293860
+v 0.017744 0.8...
[truncated message content] |
|
From: <tre...@us...> - 2007-09-02 18:12:42
|
Revision: 335
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=335&view=rev
Author: trevorolio
Date: 2007-09-02 11:12:42 -0700 (Sun, 02 Sep 2007)
Log Message:
-----------
Made the whiteboard info panel provide image upload capabilities.
Fixed a bug in which browser form uploads of images resulted in displaying the image file as text (aka horrid text junk).
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java
maven/trunk/ogoglio-server/src/main/resources/populate/template-28/WhiteBoard.js
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java 2007-09-02 18:12:39 UTC (rev 334)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java 2007-09-02 18:12:42 UTC (rev 335)
@@ -31,6 +31,7 @@
import com.ogoglio.appdev.persist.PersistException;
import com.ogoglio.appdev.servlet.SiteResource;
+import com.ogoglio.client.DecoratedInputStream;
import com.ogoglio.media.MediaService;
import com.ogoglio.persist.AccountRecord;
import com.ogoglio.persist.SimPersistTasks;
@@ -502,8 +503,10 @@
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
return;
}
+ String pageContentType = null;
if (request.getContentType() != null && request.getContentType().startsWith("multipart/form-data")) {
- InputStream fileInput = getFirstFile(request, Sim.MAX_PAGE_SIZE);
+ DecoratedInputStream fileInput = getFirstFile(request, Sim.MAX_PAGE_SIZE);
+ pageContentType = fileInput.getMimeType();
if (fileInput == null) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
return;
@@ -518,6 +521,7 @@
if (newValue == null) {
getMediaService().delete(MediaService.getPageContentName(spaceID, thingID, pageID));
} else {
+ pageContentType = "text/plain";
getMediaService().write(MediaService.getPageContentName(spaceID, thingID, pageID), newValue);
}
break;
@@ -526,7 +530,7 @@
} else {
getMediaService().write(MediaService.getPageContentName(spaceID, thingID, pageID), request.getInputStream(), Sim.MAX_PAGE_SIZE);
}
- simulator.pageContentsChanged(thingID, pageID, request.getContentType());
+ simulator.pageContentsChanged(thingID, pageID, pageContentType);
response.setStatus(HttpServletResponse.SC_OK);
return;
} catch (PersistException e) {
Modified: maven/trunk/ogoglio-server/src/main/resources/populate/template-28/WhiteBoard.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/populate/template-28/WhiteBoard.js 2007-09-02 18:12:39 UTC (rev 334)
+++ maven/trunk/ogoglio-server/src/main/resources/populate/template-28/WhiteBoard.js 2007-09-02 18:12:42 UTC (rev 335)
@@ -15,8 +15,8 @@
function formatBoardText(text){
var result = '';
- for(var i=0; i < text.length - 2; i++){
- if((text[i] == '\n' || text[i] == '\r') && (text[i + 1] == '\n' || text[i + 1] == '\r')){
+ for(var i=0; i < text.length; i++){
+ if(i != text.length - 1 && (text[i] == '\n' || text[i] == '\r') && (text[i + 1] == '\n' || text[i + 1] == '\r')){
result += '<br>';
} else {
result += text[i];
@@ -88,8 +88,9 @@
html += '<input type="submit" value="update whiteboard" />';
html += '</form>';
html += '<hr>';
- html += '<form action="service?nonce=clear" method="post">';
- html += '<input type="submit" value="clear whiteboard" />';
+ html += '<form action="/og/space/' + space.id + '/thing/' + thingID + '/page/' + pageID + '/content" enctype="multipart/form-data" method="post">';
+ html += '<input type="file" name="pageFile" />';
+ html += '<input type="submit" value="update page directly" />';
html += '</form>';
html += htmlSuffix;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-09-07 00:27:20
|
Revision: 379
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=379&view=rev
Author: trevorolio
Date: 2007-09-06 17:27:17 -0700 (Thu, 06 Sep 2007)
Log Message:
-----------
Fixed a bug in SpaceScriptEngine which caused a silent ECMA script failue.
Consolidated some of the login cookie script functionality.
Changed the REST api permissions on a thing's service resource.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java 2007-09-07 00:27:11 UTC (rev 378)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java 2007-09-07 00:27:17 UTC (rev 379)
@@ -112,7 +112,7 @@
public void cleanup() { //this happens when a space is stopped, not necessarily when it's deleted
Object[] scopes = thingScopes.getValues();
for (int i = 0; i < scopes.length; i++) {
- callAndIgnoreFunction(DESTRUCT_FUNCTION_NAME, (ScriptableObject) scopes[i]); //yes, we call destruct in cleanup()... it's weird but right
+ callAndIgnoreFunction(DESTRUCT_FUNCTION_NAME, (ScriptableObject) scopes[i]); //yes, we call destruct in cleanup()... it's weird but right
}
scriptSpace.cleanup();
}
@@ -277,7 +277,12 @@
return null;
} else {
Function function = (Function) functionObject;
- return function.call(context, thingScope, thingScope, functionArgs);
+ try {
+ return function.call(context, thingScope, thingScope, functionArgs);
+ } catch (EcmaError e) {
+ spaceSimulator.log("Error calling " + functionName + ": " + e);
+ return null;
+ }
}
}
@@ -373,7 +378,7 @@
public void thingAdded(Thing thing) {
}
- private void callAndIgnoreFunction(String functionName, ScriptableObject thingScope){
+ private void callAndIgnoreFunction(String functionName, ScriptableObject thingScope) {
Context context = Context.enter();
try {
callJavascriptFunction(context, thingScope, functionName, new Object[0]);
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java 2007-09-07 00:27:11 UTC (rev 378)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java 2007-09-07 00:27:17 UTC (rev 379)
@@ -61,6 +61,8 @@
public class SimServlet extends OgoglioServletBase {
private static final String RELOAD_PARAMETER = "reload";
+ public static final String THING_SERVICE_PATH_ELEMENT = "service";
+
private Sim sim = null;
private URI simURI = null;
@@ -755,7 +757,7 @@
private class ThingServiceResource extends SiteResource {
public ThingServiceResource() {
- super("service");
+ super(THING_SERVICE_PATH_ELEMENT);
}
public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java 2007-09-07 00:27:11 UTC (rev 378)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java 2007-09-07 00:27:17 UTC (rev 379)
@@ -181,7 +181,7 @@
}
int userCount = element.getChildren(UserDocument.NAME).length;
if(userCount >= spaceRecord.getMaxGuests()) {
- Log.error("Refused guest to space " + spaceRecord.getSpaceID() + " for reasons of max guest limit: " + payload.getSpaceID());
+ Log.error("Refused guest to space " + spaceRecord.getSpaceID() + " for reasons of max guest limit: " + spaceRecord.getMaxGuests());
Message failureMessage = new Message(channelServer.getLocator(), request.getOrigin(), payload.getSpaceID(), new PayloadFactory.AuthenticationFailurePayload("This space has reached its guest limit."));
sourceChannel.sendMessage(failureMessage);
return;
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java 2007-09-07 00:27:11 UTC (rev 378)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java 2007-09-07 00:27:17 UTC (rev 379)
@@ -16,7 +16,6 @@
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.Date;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
@@ -41,6 +40,7 @@
import com.ogoglio.persist.SpaceMemberRecord;
import com.ogoglio.persist.SpacePersistTasks;
import com.ogoglio.persist.SpaceRecord;
+import com.ogoglio.sim.site.SimServlet;
import com.ogoglio.util.Log;
import com.ogoglio.xml.AccountDocument;
import com.ogoglio.xml.ServiceDocument;
@@ -362,7 +362,7 @@
}
AccountRecord authedAccount = AuthServlet.getAuthedAccountRecord(request, getSessionFactory());
- if(!canUseMethodOnSpace(method, authedAccount, spaceRecord)){
+ if(!canUseMethodOnSpace(method, authedAccount, spaceRecord) && !SimServlet.THING_SERVICE_PATH_ELEMENT.equals(pathElements[pathElements.length - 1])){
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
return;
}
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html 2007-09-07 00:27:11 UTC (rev 378)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html 2007-09-07 00:27:17 UTC (rev 379)
@@ -31,7 +31,7 @@
<script type="text/javascript">
var bodyID = locationParameters['bodyID'];
-var loginCookie = getCookie('loginCookie');
+var loginCookie = getLoginCookie();
var titleElement = null;
var mainElement = null;
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2007-09-07 00:27:11 UTC (rev 378)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2007-09-07 00:27:17 UTC (rev 379)
@@ -1,4 +1,5 @@
var appPath = "/og"; //do not put a slash on the end
+var loginCookieName = "loginCookie";
function getServiceURI(){
var locLink = document.location;
@@ -176,6 +177,16 @@
return window.open(URL, id, params);
}
+function getLoginCookie(){
+ return getCookie(loginCookieName);
+}
+
+function setLoginCookie(cookie){
+ var expire = new Date();
+ expire.setTime(expire.getTime() + 3600000*24*3);
+ document.cookie = loginCookieName + "=" + escape(cookie) + ";expires=" + expire.toGMTString() + ";path=/";
+}
+
function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2007-09-07 00:27:11 UTC (rev 378)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2007-09-07 00:27:17 UTC (rev 379)
@@ -20,6 +20,10 @@
var allowsGuests = parseInt(xml.getAttribute("maxguests")) > 0;
if(authedUsername == null){
if(allowsGuests && typeof autoGuest != "undefined" && autoGuest){
+ if(getLoginCookie() != null && getLoginCookie().indexOf("guest_") == 0){
+ enterTheSpace();
+ return;
+ }
enterAsGuest();
} else if(allowsGuests){
spaceDiv.innerHTML = "<div style='width: 100%; text-align: center; margin-top: 20px; font-weight: bold; color: #000;'>Would you like to <a href='signin.html'>sign in</a> or <a href='space.html' onclick='enterAsGuest(); return false;'>enter as a guest</a>?";
@@ -62,7 +66,7 @@
}
function writeApplet(){
- var loginCookie = getCookie("loginCookie");
+ var loginCookie = getLoginCookie();
if(loginCookie == null){
spaceDiv.innerHTML = "No cookie. Please sign in or register as a guest.";
return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ian...@us...> - 2007-09-07 21:08:32
|
Revision: 383
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=383&view=rev
Author: iansmith
Date: 2007-09-07 14:08:36 -0700 (Fri, 07 Sep 2007)
Log Message:
-----------
More futzing with security stuff. This passes "clean install" so should have no effect on
non-demo users.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/site/MediaServlet.java
maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml
maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/site/MediaServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/site/MediaServlet.java 2007-09-07 20:37:27 UTC (rev 382)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/site/MediaServlet.java 2007-09-07 21:08:36 UTC (rev 383)
@@ -118,8 +118,8 @@
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
return;
}
-
String name = pathElements[pathElements.length - 1];
+ Log.debug("in doPut of media servlet:"+name);
fileStore.write(name, request.getInputStream(), -1);
response.setStatus(HttpServletResponse.SC_OK);
response.setContentLength(0);
Modified: maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml 2007-09-07 20:37:27 UTC (rev 382)
+++ maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml 2007-09-07 21:08:36 UTC (rev 383)
@@ -2,7 +2,9 @@
<Context reloadable="true" path="/og" >
<Realm className="org.apache.catalina.realm.MemoryRealm" />
-
+ <tomcat-users>
+
+ </tomcat-users>
<Resource name="jdbc/space" scope="Shareable"
type="javax.sql.DataSource" auth='Container'
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
@@ -14,6 +16,10 @@
show_sql="false"
maxIdle="5"
maxActive="50" />
+
+ <tomcat-users>
+ <user name="seattle" password="demolove" roles="demo"/>
+ </tomcat-users>
<Environment name="ogoglio/oktoZapDB" value="false" type="java.lang.String"/> <!-- not running tests! -->
<Environment name="ogoglio/okToMigrateDB" value="${ogoglio.okToMigrateDB}" type="java.lang.String"/>
Modified: maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml 2007-09-07 20:37:27 UTC (rev 382)
+++ maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml 2007-09-07 21:08:36 UTC (rev 383)
@@ -41,7 +41,7 @@
</servlet-mapping>
<servlet-mapping>
- <servlet-name>SpaceServlet</servlet-name>
+ <servlet-name>SpaceServlet</servlet-name>test
<url-pattern>/space/*</url-pattern>
</servlet-mapping>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-09-07 21:40:38
|
Revision: 386
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=386&view=rev
Author: trevorolio
Date: 2007-09-07 14:40:40 -0700 (Fri, 07 Sep 2007)
Log Message:
-----------
Tweaked db log.
Added javascript login functionality such that the usual authListeners can be bypassed.
Fixed createAccount.html, which was weirdly replaced with an old ogoglio.js contents (bad cut and paste)?
Made SpaceMemberRecord creation honor the role indicated by the incoming SpaceMemberDocument.
Fixed the hanging "Receiving items..." context menu for scriptless objects.
Changed page permissions so that editors can now post contents to them.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/SpaceMemberPersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/SpaceMemberRecord.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/createAccount.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/SpaceMemberPersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/SpaceMemberPersistTasks.java 2007-09-07 21:40:36 UTC (rev 385)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/SpaceMemberPersistTasks.java 2007-09-07 21:40:40 UTC (rev 386)
@@ -61,7 +61,7 @@
return (SpaceMemberRecord[]) task.execute();
}
- public static SpaceMemberRecord createSpaceMember(final long spaceID, final String memberUsername, final boolean banned, SessionFactory sessionFactory) throws PersistException {
+ public static SpaceMemberRecord createSpaceMember(final long spaceID, final String memberUsername, final boolean banned, final int role, SessionFactory sessionFactory) throws PersistException {
HibernateTask task = new HibernateTask() {
public Object run(Session hibernateSession) {
Query accountQuery = hibernateSession.getNamedQuery(AccountPersistTasks.ACCOUNT_BY_USERNAME);
@@ -79,7 +79,7 @@
return null;
}
- record = new SpaceMemberRecord(spaceID, memberUsername, banned);
+ record = new SpaceMemberRecord(spaceID, memberUsername, banned, role);
hibernateSession.save(record);
return record;
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/SpaceMemberRecord.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/SpaceMemberRecord.java 2007-09-07 21:40:36 UTC (rev 385)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/SpaceMemberRecord.java 2007-09-07 21:40:40 UTC (rev 386)
@@ -32,12 +32,13 @@
public SpaceMemberRecord() {
}
- public SpaceMemberRecord(long spaceID, String memberUsername, boolean banned) {
+ public SpaceMemberRecord(long spaceID, String memberUsername, boolean banned, int role) {
ArgumentUtils.assertNotNegative(spaceID);
this.spaceID = spaceID;
ArgumentUtils.assertNotNull(memberUsername);
this.memberUsername = memberUsername;
this.banned = banned;
+ setRole(role);
}
public boolean isBanned() {
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java 2007-09-07 21:40:36 UTC (rev 385)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java 2007-09-07 21:40:40 UTC (rev 386)
@@ -173,17 +173,24 @@
}
} else if (SpaceEvent.THING_CONTEXT_CLICKED_EVENT.equals(event.getName())) {
Long thingID = event.getLongProperty(SpaceEvent.THING_ID);
+ String shapeName = event.getStringProperty(SpaceEvent.SHAPE_NAME);
+ String username = event.getStringProperty(SpaceEvent.USERNAME);
+ long nonce = event.getLongProperty(SpaceEvent.NONCE).longValue();
+
+ SpaceEvent resultEvent = new SpaceEvent(SpaceEvent.CONTEXT_MENU_DATA_EVENT);
+ resultEvent.setProperty(SpaceEvent.NONCE, new Long(nonce));
+
if (thingID == null) {
+ spaceSimulator.getListener().generatedSpaceEventForUser(username, resultEvent, spaceSimulator);
return;
}
+
ScriptableObject thingScope = getThingScope(thingID.longValue());
if (thingScope == null) {
+ spaceSimulator.getListener().generatedSpaceEventForUser(username, resultEvent, spaceSimulator);
return;
}
- String shapeName = event.getStringProperty(SpaceEvent.SHAPE_NAME);
- String username = event.getStringProperty(SpaceEvent.USERNAME);
- long nonce = event.getLongProperty(SpaceEvent.NONCE).longValue();
String functionName = ONCONTEXTCLICK_FUNCTION_NAME;
@@ -191,9 +198,6 @@
functionArgs[0] = username;
functionArgs[1] = shapeName;
- SpaceEvent resultEvent = new SpaceEvent(SpaceEvent.CONTEXT_MENU_DATA_EVENT);
- resultEvent.setProperty(SpaceEvent.NONCE, new Long(nonce));
-
Context context = Context.enter();
try {
Object callResult = callJavascriptFunction(context, thingScope, functionName, functionArgs);
@@ -235,10 +239,12 @@
} else if (SpaceEvent.THING_CONTEXT_SELECTION_MADE_EVENT.equals(event.getName())) {
Long thingID = event.getLongProperty(SpaceEvent.THING_ID);
if (thingID == null) {
+ spaceSimulator.log("Context selection with no thing ID!");
return;
}
ScriptableObject thingScope = getThingScope(thingID.longValue());
if (thingScope == null) {
+ spaceSimulator.log("Context selection on a thing with no script!: " + thingID);
return;
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java 2007-09-07 21:40:36 UTC (rev 385)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java 2007-09-07 21:40:40 UTC (rev 386)
@@ -32,6 +32,7 @@
import com.ogoglio.appdev.servlet.SiteResource;
import com.ogoglio.client.DecoratedInputStream;
import com.ogoglio.media.MediaService;
+import com.ogoglio.persist.AccountPersistTasks;
import com.ogoglio.persist.AccountRecord;
import com.ogoglio.persist.SimPersistTasks;
import com.ogoglio.persist.SimRecord;
@@ -43,7 +44,6 @@
import com.ogoglio.sim.script.ScriptHTTPRequest;
import com.ogoglio.sim.script.ScriptHTTPResponse;
import com.ogoglio.site.AuthServlet;
-import com.ogoglio.site.AuthenticatedSiteResource;
import com.ogoglio.site.OgoglioServletBase;
import com.ogoglio.site.SpaceServlet;
import com.ogoglio.util.Log;
@@ -456,6 +456,13 @@
return;
}
+
+ AccountRecord authedAccount = AuthServlet.getAuthedAccountRecord(request, getSessionFactory());
+ if (!SpacePersistTasks.canReadSpace(authedAccount, spaceID, getSessionFactory())) {
+ response.setStatus(HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
+
SpaceSimulator simulator = sim.getOrCreateSpaceSimulator(spaceRecord);
long thingID = Long.parseLong(pathElements[4]);
@@ -492,7 +499,7 @@
}
AccountRecord authedAccount = AuthServlet.getAuthedAccountRecord(request, getSessionFactory());
- if (authedAccount != null && !authedAccount.getUsername().equals(spaceRecord.getOwnerUsername())) {
+ if (!SpacePersistTasks.canWriteSpace(authedAccount, spaceID, getSessionFactory())) {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
return;
}
@@ -765,17 +772,7 @@
}
public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
- try {
- AccountRecord authedAccount = AuthServlet.getAuthedAccountRecord(request, getSessionFactory());
- if (authedAccount == null) {
- response.setStatus(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
- doScriptService(request, response, pathElements);
- } catch (PersistException e) {
- e.printStackTrace();
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
+ doScriptService(request, response, pathElements);
}
public void doScriptService(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
@@ -890,7 +887,7 @@
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
return;
}
-
+
AccountRecord authedAccount = AuthServlet.getAuthedAccountRecord(request, getSessionFactory());
if (authedAccount != null && !SpacePersistTasks.canWriteSpace(authedAccount, requestedSpaceID, getSessionFactory())) {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
@@ -1048,7 +1045,7 @@
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
return;
}
-
+
AccountRecord authedAccount = AuthServlet.getAuthedAccountRecord(request, getSessionFactory());
if (authedAccount != null && !SpacePersistTasks.canWriteSpace(authedAccount, requestedSpaceID, getSessionFactory())) {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java 2007-09-07 21:40:36 UTC (rev 385)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java 2007-09-07 21:40:40 UTC (rev 386)
@@ -683,7 +683,7 @@
}
SpaceMemberDocument newMemberDoc = new SpaceMemberDocument(parseXML(request.getInputStream()));
- SpaceMemberRecord rec = SpaceMemberPersistTasks.createSpaceMember(spaceID, newMemberDoc.getMemberUsername(), newMemberDoc.isBanned(), getSessionFactory());
+ SpaceMemberRecord rec = SpaceMemberPersistTasks.createSpaceMember(spaceID, newMemberDoc.getMemberUsername(), newMemberDoc.isBanned(), newMemberDoc.getRoleAsInt(), getSessionFactory());
if (rec == null) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/createAccount.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/createAccount.html 2007-09-07 21:40:36 UTC (rev 385)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/createAccount.html 2007-09-07 21:40:40 UTC (rev 386)
@@ -1,775 +1,140 @@
-var appPath = "/og"; //do not put a slash on the end
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<link rel="stylesheet" href="style.css" type="text/css" />
+<script type="text/javascript" src="/og/ogoglio.js"></script>
+<script type="text/javascript" src="site.js"></script>
-function getServiceURI(){
- var locLink = document.location;
- return locLink.protocol + "//" + locLink.host + appPath;
-}
+<title>Ogoglio Example: create account</title>
-
-//BEGIN GENERAL UTILS
-function parseLocationParameters(){
- var paramPhrases = location.search.substring(1, location.search.length).split("&");
- var paramDict = new Object();
- for(var i=0; i < paramPhrases.length; i++){
- paramDict[paramPhrases[i].split("=")[0]] = paramPhrases[i].split("=")[1];
- }
- return paramDict;
+<style type="text/css">
+#main {
+ overflow: hidden;
+ width: 750px;
}
-var locationParameters = parseLocationParameters();
-
-function getFloatParameter(paramName, defaultValue){
- var value = locationParameters[paramName];
- if(typeof value == 'undefined' || value == null){
- return defaultValue;
- }
- try {
- return parseFloat(value);
- } catch (error){
- return defaultValue;
- }
+#content {
+ width: 750px;
+ border-right: 1px solid #FFF;
+ margin-right: 1px;
+ float: left;
}
-function getIntParameter(paramName, defaultValue){
- var value = locationParameters[paramName];
- if(typeof value == 'undefined' || value == null){
- return defaultValue;
- }
- try {
- return parseInt(value);
- } catch (error){
- return defaultValue;
- }
+.section form {
+ margin-top: 10px;
}
-var isIE = false;
-if (window.ActiveXObject) {
- isIE = true;
+.section {
+ border: solid 1px #CCD;
+ border-top: solid 5px #CCD;
+ margin: 0px 25px 10px 0px;
+ padding: 0px 5px 5px 5px;
}
-function XMLRequestManager(theURL, theListener){
- var that = this;
- this.url = theURL;
- this.listener = theListener;
- this.request = getXMLHttpRequest();
- this.method = "GET";
-
- function processRequestChange() {
- if(that.request.readyState == 4){
- if(that.request.status == 200){
- if(that.request.responseXML && that.request.responseXML.documentElement && that.listener.handleResponseXML ){
- that.listener.handleResponseXML(that.request.responseXML);
- } else if(that.request.responseText != "undefined" && that.listener.handleResponseText){
- that.listener.handleResponseText(that.request.responseText);
- } else {
- that.listener.handleFailure("Found the file, but it is not a handled type (text or xml)");
- }
- } else {
- that.listener.handleFailure(that.request.statusText);
- }
- }
- }
- this.request.onreadystatechange = processRequestChange;
+#profileTable th {
+ text-align: right;
}
-XMLRequestManager.prototype.setMethod = function (newMethod) {
- this.method = newMethod;
+.includedFeedItem {
+ margin-top: 10px;
}
+</style>
+<script type="text/javascript">
-XMLRequestManager.prototype.send = function (data, contentType) {
- if(this.method == "DELETE"){ //a workaround for WebKit's tendency to do only GET and POST
- if(this.url.indexOf("?") == -1){
- this.url += "?method=DELETE";
- } else {
- this.url += "&method=DELETE";
- }
- }
-
- this.request.open(this.method, this.url, true);
- if(data){
- if(contentType != null){
- this.request.setRequestHeader('Content-Type', contentType);
- } else {
- this.request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- }
- this.request.send(data);
- } else if(isIE){
- this.request.send();
- } else {
- this.request.send(null);
- }
-}
+var mainElement = null;
+var newUserDiv = null;
-
-function BasicHTTPListener(callbackFunction) {
- this.callback = callbackFunction;
-}
-
-BasicHTTPListener.prototype.handleResponseXML = function (responseXML) {
- this.callback(responseXML.documentElement);
-}
-
-BasicHTTPListener.prototype.handleResponseText = function (responseText) {
- this.callback(responseText);
-}
-
-BasicHTTPListener.prototype.handleFailure = function (statusText) {
- this.callback(null);
-}
-
-function getXMLHttpRequest(){
- if (window.XMLHttpRequest) {
- return new XMLHttpRequest();
- } else if (window.ActiveXObject) {
- return new ActiveXObject("Microsoft.XMLHTTP");
- }
- return null;
-}
-
-function getFirstChildByTagName(localName, parentNode){
- var children = parentNode.childNodes;
- for(var i=0; children[i]; i++){
- if(children[i].name == localName || children[i].nodeName == localName || children[i].localName == localName){
- return children[i];
- }
- }
-}
-
-function trim(str) {
- return str.replace(/^\s*|\s*$/g,"");
-}
-
-function shorten(str, len){
- if(typeof str == "undefined" || str == null || str.length <= len){
- return str;
- }
- return str.substring(0, len);
-}
-
-function trimPX(value){
- if(value.indexOf("px") != -1){
- value = value.substring(0, value.indexOf("px"));
- }
- return value;
-}
-
-function clip(text, maxLength, elipseText){
- var eLength = elipseText == null ? 0 : elipseText.length;
- if(text == null || text.length <= maxLength){
- return text;
- }
- return text.substring(0, maxLength - eLength) + (elipseText == null ? "" : elipseText);
-}
-
-function popUp(URL, decorated, width, height) {
- var id = "page-" + new Date().getTime();
- var params = "";
- if(typeof width != "undefined"){
- params += ",width=" + width;
- }
- if(typeof height != undefined){
- params += ",height=" + height;
- }
- if(decorated == null || decorated == true){
- params += ',toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1';
- }
- return window.open(URL, id, params);
-}
-
-function getCookie(name) {
- var dc = document.cookie;
- var prefix = name + "=";
- var begin = dc.indexOf("; " + prefix);
- if (begin == -1) {
- begin = dc.indexOf(prefix);
- if (begin != 0) return null;
- } else {
- begin += 2;
- }
- var end = document.cookie.indexOf(";", begin);
- if (end == -1) {
- end = dc.length;
- }
- return unescapeHTML(dc.substring(begin + prefix.length, end));
-}
-
-function debug(message){
- var debugDiv = document.getElementById('debugMessages');
- if(debugDiv == null || typeof debugDiv == "undefined"){
+function handleAuth(){
+ if(authedUsername == null){
+ mainElement.innerHTML = "<h2>You must log in as an admin.</h2>";
return;
}
- debugDiv.innerHTML += message + "<br/>";
+ requestAccountDocument(authedUsername, handleAdminTest);
}
-//this only serializes simple XML and it casts all tag and attribute names to lower case
-//TODO handle all the various warts of XML
-function serializeXML(xml){
- var result = "<" + xml.tagName.toLowerCase();
- var attributes = xml.attributes;
- for (var i = 0; i < attributes.length; i++){
- result += " " + attributes.item(i).name.toLowerCase() + "='" + escapeHTML(attributes.item(i).value) + "'";
- }
- var hasText = (typeof xml.text != "undefined") && xml.text.length != 0;
-
- if(!hasText && xml.childNodes.length == 0){
- result += " />";
-
- return result;
- } else {
- result += ">";
- }
-
- if(hasText){
- result += xml.text;
- }
-
- for(var i = 0; i < xml.childNodes.length; i++){
- result += serializeXML(xml.childNodes[i]);
- }
- result += "</" + xml.tagName.toLowerCase() + ">";
- return result;
-}
-
-function escapeHTML(xml){
- if(xml == null || xml.length == 0){
- return xml;
- }
- return xml.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
-};
-
-function unescapeHTML(xml){
- return xml.replace(/'/g,"'").replace(/"/g,"\"").replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&");
-};
-
-// BEGIN QUATERION CLASS
-
-function Quaternion(wValue, xValue, yValue, zValue){
- this.w = wValue;
- this.x = xValue;
- this.y = yValue;
- this.z = zValue;
- this.normalize();
-}
-
-Quaternion.prototype.set = function(wValue, xValue, yValue, zValue){
- this.w = wValue;
- this.x = xValue;
- this.y = yValue;
- this.z = zValue;
- this.normalize();
-}
-
-Quaternion.prototype.normalize = function(){
- var norm = (this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
-
- if (norm > 0.0) {
- norm = 1.0 / Math.sqrt(norm);
- this.x *= norm;
- this.y *= norm;
- this.z *= norm;
- this.w *= norm;
- } else {
- this.x = 0.0;
- this.y = 0.0;
- this.z = 0.0;
- this.w = 0.0;
- }
-}
-
-Quaternion.prototype.mul = function(q1){
- var nw = this.w * q1.w - this.x * q1.x - this.y * q1.y - this.z * q1.z;
- var nx = this.w * q1.x + q1.w * this.x + this.y * q1.z - this.z * q1.y;
- var ny = this.w * q1.y + q1.w * this.y - this.x * q1.z + this.z * q1.x;
- this.z = this.w * q1.z + q1.w * this.z + this.x * q1.y - this.y * q1.x;
- this.w = nw;
- this.x = nx;
- this.y = ny;
- this.normalize();
-}
-
-Quaternion.prototype.rotateEuler = function(rotX, rotY, rotZ){
- var quat = new Quaternion(1, 0, 0, 0);
- quat.setEuler(rotX, rotY, rotZ);
- this.mul(quat);
-}
-
-Quaternion.prototype.toString = function(){
- return "<" + this.w + ", " + this.x + ", " + this.y + ", " + this.z + ">";
-}
-
-Quaternion.prototype.setEuler = function(rotX, rotY, rotZ){
- var c1 = Math.cos(rotY / 2);
- var c2 = Math.cos(rotX / 2);
- var c3 = Math.cos(rotZ / 2);
- var s1 = Math.sin(rotY / 2);
- var s2 = Math.sin(rotX / 2);
- var s3 = Math.sin(rotZ / 2);
-
- this.w = (c1 * c2 * c3) - (s1 * s2 * s3);
- this.x = (s1 * s2 * c3) + (c1 * c2 * s3);
- this.y = (s1 * c2 * c3) + (c1 * s2 * s3);
- this.z = (c1 * s2 * c3) - (s1 * c2 * s3);
- this.normalize();
-}
-
-Quaternion.prototype.getEuler = function(){
- var heading = 0;
- var attitude = 0;
- var bank = 0;
- if(this.x * this.y + this.z * this.w == 0.5){ //North Pole
- attitude = Math.PI / 2;
- bank = 0;
- heading = 2 * Math.atan2(this.x, this.w);
- } else if (this.x * this.y + this.z * this.w == -0.5) { // South Pole
- attitude = -Math.PI / 2;
- heading = -2 * Math.atan2(this.x, this.w)
- bank = 0;
- } else {
- heading = Math.atan2(2 * this.y * this.w - 2 * this.x * this.z, 1 - 2 * (this.y * this.y) - 2 * (this.z * this.z)) % (2 * Math.PI);
- attitude = Math.asin(2 * this.x * this.y + 2 * this.z * this.w) % (2 * Math.PI);
- bank = Math.atan2(2 * this.x * this.w - 2 * this.y * this.z , 1 - 2 * (this.x * this.x) - 2 * (this.z * this.z)) % (2 * Math.PI);
- }
- return new Array(cleanRotation(attitude), cleanRotation(heading), cleanRotation(bank));
-}
-
-function cleanRotation(rotation){ //in radians
- while(rotation < 0){
- rotation += 2 * Math.PI;
- }
- while(rotation >= 2 * Math.PI){
- rotation -= 2 * Math.PI;
- }
- if(rotation < 0.0001){
- return 0;
- }
- return rotation.toFixed(4);
-}
-
-//BEGIN AUTH UTILS
-
-var completedAuthRequest = false;
-var authedUsername = null;
-var authedUserLevel = null;
-var errorText = null;
-
-
-function logout(){
- var logoutRequestManager = new XMLRequestManager(appPath + "/auth?logout=true", new AuthListener());
- logoutRequestManager.send();
-}
-
-function addAuthListeners(authFunction, failedFunction){
- authedListeners[authedListeners.length] = authFunction;
- failedListeners[failedListeners.length] = failedFunction;
- if(completedAuthRequest){
- if(authedUsername == null){
- failedFunction();
- } else {
- authFunction();
- }
- }
-}
-
-var authedListeners = new Array();
-var failedListeners = new Array();
-
-function AuthListener() {
-}
-
-AuthListener.prototype.handleResponseXML = function (responseXML) {
- var xmlDoc = responseXML.documentElement;
- var successAttribute = xmlDoc.getAttribute('authenticated');
- var idAttribute = xmlDoc.getAttribute('username');
- var levelAttribute = xmlDoc.getAttribute('accountlevel');
-
- if(successAttribute == "true" && typeof idAttribute != "undefined" && typeof levelAttribute != "undefined") {
- authedUsername = idAttribute;
- authedUserLevel = levelAttribute;
-
- for(var i=0; i < authedListeners.length; i++){
- authedListeners[i]();
- }
- completedAuthRequest = true;
- } else {
- authedUsername = null;
- for(var i=0; i < authedListeners.length; i++){
- authedListeners[i]();
- }
- completedAuthRequest = true;
- }
-}
-
-AuthListener.prototype.handleFailure = function (statusText) {
- for(var i=0;i < failedListeners.length; i++){
- failedListeners[i]();
- }
- errorText = statusText;
- completedAuthRequest = true;
- authedUsername = null;
-}
-
-var authRequestManager = new XMLRequestManager(appPath + "/auth", new AuthListener());
-authRequestManager.send();
-
-function login(username, password){
- if(!username || trim(username).length == 0 || !password || trim(password).length == 0){
+function handleAdminTest(xml){
+ if(xml == null){
+ mainElement.innerHTML = "<h2>There was an error checking your account for admin access.</h2>";
return;
}
-
- var manager = new XMLRequestManager(appPath + "/auth", new AuthListener());
-
- manager.setMethod("POST");
- manager.send("username=" + trim(username) + "&password=" + trim(password));
-}
-
-function requestMyAuthDocument(listener){
- new XMLRequestManager(appPath + "/auth/me", new BasicHTTPListener(listener)).send();
-}
-
-function requestGuestCookie(listener){
- var manager = new XMLRequestManager(appPath + "/auth/guest", new BasicHTTPListener(listener));
- manager.setMethod("POST");
- manager.send();
-}
-
-// BEGIN ACCOUNT UTILS
-
-function createAccount(username, email, listener){
- var xml = document.createElement("account");
- xml.setAttribute("username", username);
- xml.setAttribute("email", email);
- xml.setAttribute("accountlevel", "basic");
- var manager = new XMLRequestManager(appPath + "/account/", new BasicHTTPListener(listener));
- manager.setMethod("POST");
- manager.send(serializeXML(xml));
-}
-
-function requestAccountDocument(username, listener){
- var accountListener = new BasicHTTPListener(listener);
- new XMLRequestManager(appPath + "/account/" + username, accountListener).send();
-}
-
-function updateAccountDocument(accountXML, listener){
- if(accountXML == null){
+ if("admin" != xml.getAttribute("accountlevel")){
+ mainElement.innerHTML = "<h2>You must be an admin to use this page.</h2>";
return;
}
- var username = accountXML.getAttribute("username");
- var accountListener = new BasicHTTPListener(listener);
- var manager = new XMLRequestManager(appPath + "/account/" + username, accountListener);
- manager.setMethod("POST");
- var xmlString = serializeXML(accountXML);
- manager.send(xmlString);
-}
-
-function requestAccountMembership(username, listener){
- new XMLRequestManager(appPath + "/account/" + username + "/membership", new BasicHTTPListener(listener)).send();
-}
-
-function validate(secret, listener){
- new XMLRequestManager(appPath + "/account/validate?secret=" + secret, new BasicHTTPListener(listener)).send();
-}
-
-// BEGIN SPACE UTILS
-
-function requestSpaceList(username, listener){
- new XMLRequestManager(appPath + "/account/" + username + "/space/", new BasicHTTPListener(listener)).send();
-}
-
-function requestSpaceDocument(spaceID, listener){
- new XMLRequestManager(appPath + "/space/" + spaceID, new BasicHTTPListener(listener)).send();
-}
-
-function requestSpaceMembers(spaceID, listener){
- new XMLRequestManager(appPath + "/space/" + spaceID + "/member", new BasicHTTPListener(listener)).send();
-}
-
-function addSpaceMember(spaceID, memberUsername, role, listener){
- var memberXML = document.createElement("spacemember");
- memberXML.setAttribute("spaceid", spaceID);
- memberXML.setAttribute("memberusername", memberUsername);
- memberXML.setAttribute("role", role);
- memberXML.setAttribute("banned", false);
- var manager = new XMLRequestManager(appPath + "/space/" + spaceID + "/member/", new BasicHTTPListener(listener));
- manager.setMethod("POST");
- manager.send(serializeXML(memberXML));
-}
-
-function removeSpaceMember(spaceID, memberUsername, listener){
- var manager = new XMLRequestManager(appPath + "/space/" + spaceID + "/member/" + memberUsername, new BasicHTTPListener(listener));
- manager.setMethod("DELETE");
- manager.send();
-}
-
-function updateMemberRole(spaceID, memberUsername, newRole, listener){
- var memberXML = document.createElement("spacemember");
- memberXML.setAttribute("spaceid", spaceID);
- memberXML.setAttribute("memberusername", memberUsername);
- memberXML.setAttribute("role", newRole);
- memberXML.setAttribute("banned", false);
- var manager = new XMLRequestManager(appPath + "/space/" + spaceID + "/member/" + memberUsername, new BasicHTTPListener(listener));
- manager.setMethod("POST");
- manager.send(serializeXML(memberXML));
-}
-
-function createSpace(username, spaceName, listener){
- var bodyXML = document.createElement("space");
- bodyXML.setAttribute("ownerusername", username);
- bodyXML.setAttribute("displayname", escapeHTML(spaceName));
- var manager = new XMLRequestManager(appPath + "/space/", new BasicHTTPListener(listener));
- manager.setMethod("POST");
- manager.send(serializeXML(bodyXML));
-}
-
-function deleteSpace(spaceID, listener){
- var req = new XMLRequestManager(appPath + "/space/" + spaceID, new BasicHTTPListener(listener));
- req.setMethod("DELETE");
- req.send();
-}
-
-function updateSpaceDocument(xml, listener){
- if(xml == null){
- return;
- }
- var spaceID = xml.getAttribute("spaceid");
-
- var spaceListener = new BasicHTTPListener(listener);
- var manager = new XMLRequestManager(appPath + "/space/" + spaceID, spaceListener);
- manager.setMethod("POST");
- manager.send(serializeXML(xml));
-}
-
-function requestUserList(spaceID, listener){
- new XMLRequestManager(appPath + "/space/" + spaceID + "/user", new BasicHTTPListener(listener)).send();
-}
-
-function bootUser(spaceID, username, listener){
- var req = new XMLRequestManager(appPath + "/space/" + spaceID + "/user/" + username, new BasicHTTPListener(listener));
- req.setMethod("DELETE");
- req.send();
-}
-
-function requestSettingList(spaceID, listener){
- new XMLRequestManager(appPath + "/space/" + spaceID + "/setting", new BasicHTTPListener(listener)).send();
-}
-
-function requestSetting(spaceID, key, listener){
- new XMLRequestManager(appPath + "/space/" + spaceID + "/setting/" + key, new BasicHTTPListener(listener)).send();
-}
-
-function updateSetting(spaceID, key, value, listener){
- var manager = new XMLRequestManager(appPath + "/space/" + spaceID + "/setting/" + key, new BasicHTTPListener(listener));
- ...
[truncated message content] |
|
From: <tre...@us...> - 2007-09-08 00:30:33
|
Revision: 387
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=387&view=rev
Author: trevorolio
Date: 2007-09-07 17:30:36 -0700 (Fri, 07 Sep 2007)
Log Message:
-----------
Tweak applet loading process.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/site/MediaServlet.java
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/site/MediaServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/site/MediaServlet.java 2007-09-07 21:40:40 UTC (rev 386)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/site/MediaServlet.java 2007-09-08 00:30:36 UTC (rev 387)
@@ -119,7 +119,6 @@
return;
}
String name = pathElements[pathElements.length - 1];
- Log.debug("in doPut of media servlet:"+name);
fileStore.write(name, request.getInputStream(), -1);
response.setStatus(HttpServletResponse.SC_OK);
response.setContentLength(0);
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2007-09-07 21:40:40 UTC (rev 386)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2007-09-08 00:30:36 UTC (rev 387)
@@ -1,5 +1,6 @@
var viewerWidth = 700;
var viewerHeight = 500;
+var appletLoadingImagePath = appPath + "/icons/32x32/face-monkey.png";
var startX = 0;
var startY = 0;
var startZ = 0;
@@ -78,7 +79,7 @@
html += "<param name='loginCookie' value='" + loginCookie + "' />";
html += "<param name='serviceURI' value='" + serviceURI + "' />";
html += "<param name='spaceID' value='" + locationParameters['spaceID'] + "' />";
- html += "<param name='image' value='" + appPath + "/icons/32x32/face-monkey.png' />";
+ html += "<param name='image' value='" + appletLoadingImagePath + "' />";
if(startX != 0){
html += "<param name='x' value='" + startX + "' />";
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-08 12:51:26
|
Revision: 489
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=489&view=rev
Author: trevorolio
Date: 2007-10-08 05:51:24 -0700 (Mon, 08 Oct 2007)
Log Message:
-----------
Fixed the sim side Page so that it retains new content types upon update.
Added a new web api call to update a page from an input stream.
(all of this is handy for my hawt new iSight -> page demo hack)
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java
maven/trunk/ogoglio-server/src/main/resources/populate/space-2
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/thingPopup.html
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-10-08 12:51:18 UTC (rev 488)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-10-08 12:51:24 UTC (rev 489)
@@ -322,9 +322,31 @@
log("removed page " + event.getLongProperty(SpaceEvent.PAGE_ID));
} else if (SpaceEvent.UPDATE_PAGE_EVENT.equals(event.getName())) {
+ long thingID = event.getLongProperty(SpaceEvent.THING_ID).longValue();
+ long pageID = event.getLongProperty(SpaceEvent.PAGE_ID).longValue();
+ Thing thing = space.getThing(thingID);
+ if(thing == null){
+ return;
+ }
+ Page page = thing.getPage(pageID);
+ if(page == null){
+ return;
+ }
+ page.setContentType(event.getStringProperty(SpaceEvent.CONTENT_TYPE));
listener.generatedSpaceEvent(event, SpaceSimulator.this);
} else if (SpaceEvent.UPDATE_PAGE_CONTENT_EVENT.equals(event.getName())) {
+ long thingID = event.getLongProperty(SpaceEvent.THING_ID).longValue();
+ long pageID = event.getLongProperty(SpaceEvent.PAGE_ID).longValue();
+ Thing thing = space.getThing(thingID);
+ if(thing == null){
+ return;
+ }
+ Page page = thing.getPage(pageID);
+ if(page == null){
+ return;
+ }
+ page.setContentType(event.getStringProperty(SpaceEvent.CONTENT_TYPE));
listener.generatedSpaceEvent(event, SpaceSimulator.this);
} else if (SpaceEvent.TEXT_SAY_EVENT.equals(event.getName())) {
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java 2007-10-08 12:51:18 UTC (rev 488)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java 2007-10-08 12:51:24 UTC (rev 489)
@@ -553,11 +553,11 @@
String pageContentType = null;
if (request.getContentType() != null && request.getContentType().startsWith("multipart/form-data")) {
DecoratedInputStream fileInput = getFirstFile(request, Sim.MAX_PAGE_SIZE);
- pageContentType = fileInput.getMimeType();
if (fileInput == null) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
return;
}
+ pageContentType = fileInput.getMimeType();
getMediaService().write(MediaService.getPageContentName(spaceID, thingID, pageID), fileInput, Sim.MAX_PAGE_SIZE);
} else if (request.getContentType() != null && request.getContentType().startsWith("application/x-www-form-urlencoded")) {
Enumeration enumeration = request.getParameterNames();
@@ -575,6 +575,7 @@
}
}
} else {
+ pageContentType = request.getContentType();
getMediaService().write(MediaService.getPageContentName(spaceID, thingID, pageID), request.getInputStream(), Sim.MAX_PAGE_SIZE);
}
simulator.pageContentsChanged(thingID, pageID, pageContentType);
Modified: maven/trunk/ogoglio-server/src/main/resources/populate/space-2
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/populate/space-2 2007-10-08 12:51:18 UTC (rev 488)
+++ maven/trunk/ogoglio-server/src/main/resources/populate/space-2 2007-10-08 12:51:24 UTC (rev 489)
@@ -1 +1 @@
-<space ownerusername="library" sealevel="0.0" simid="1" displayname="Testville" maxguests="0" displaysea="false" spaceid="1" published="true"><thing templateid="57" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Light Pole" scaley="1.0" templateowner="library" scalex="1.0" possessionid="1" thingid="1" z="6.0" y="1.0" x="0.0" ownerusername="library"/><thing templateid="70" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Sign25 Miles Per Hour" scaley="1.0" templateowner="library" scalex="1.0" possessionid="2" thingid="2" z="-19.0" y="0.0" x="2.0" ownerusername="library"/><thing templateid="50" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Pipe Fence" scaley="1.0" templateowner="library" scalex="1.0" possessionid="3" thingid="3" z="0.0" y="0.0" x="2.0" ownerusername="library"/><thing templateid="64" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Pipe Cage" scaley="1.0" templateowner="library" scalex="1.0" possessionid="4" thingid="4" z="-13.0" y="0.0" x="-3.0" ownerusername="library"/><thing templateid="82" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Switchbox" scaley="1.0" templateowner="library" scalex="1.0" possessionid="5" thingid="5" z="-25.0" y="0.0" x="4.0" ownerusername="library"/><thing templateid="58" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Mailbox" scaley="1.0" templateowner="library" scalex="1.0" possessionid="6" thingid="6" z="-12.0" y="0.0" x="8.0" ownerusername="library"/><thing templateid="71" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Sign Bump" scaley="1.0" templateowner="library" scalex="1.0" possessionid="7" thingid="7" z="-17.0" y="0.0" x="0.0" ownerusername="library"/><thing templateid="75" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Sprinkler" scaley="1.0" templateowner="library" scalex="1.0" possessionid="8" thingid="8" z="-5.0" y="0.0" x="5.0" ownerusername="library"/><thing templateid="49" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Fence" scaley="1.0" templateowner="library" scalex="1.0" possessionid="9" thingid="9" z="-6.0" y="0.0" x="-5.0" ownerusername="library"/><thing templateid="63" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Parking Barrier" scaley="1.0" templateowner="library" scalex="1.0" possessionid="10" thingid="10" z="-17.0" y="0.0" x="3.0" ownerusername="library"/><thing templateid="72" rz="0.0" ry="-0.1081951345301089" rx="0.0" rw="0.9941296760805463" scalez="1.0000000000000016" displayname="Sign Bus Stop" scaley="1.0000000000000016" templateowner="library" scalex="1.0000000000000016" possessionid="11" thingid="11" z="-35.0" y="0.0" x="12.0" ownerusername="library"/><thing templateid="74" rz="0.0" ry="-0.6816387600233345" rx="0.0" rw="0.7316888688738207" scalez="1.0" displayname="Spigot" scaley="1.0" templateowner="library" scalex="1.0" possessionid="12" thingid="12" z="-5.0" y="1.0" x="-3.0" ownerusername="library"/><thing templateid="80" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Double Streetlight" scaley="1.0" templateowner="library" scalex="1.0" possessionid="13" thingid="13" z="0.0" y="0.0" x="-9.0" ownerusername="library"/><thing templateid="51" rz="0.0" ry="0.6816387600233345" rx="0.0" rw="0.7316888688738207" scalez="1.0" displayname="Floodlight" scaley="1.0" templateowner="library" scalex="1.0" possessionid="14" thingid="14" z="-8.0" y="3.0" x="-4.0" ownerusername="library"/><thing templateid="73" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Sign Crossing" scaley="1.0" templateowner="library" scalex="1.0" possessionid="15" thingid="15" z="-20.0" y="0.0" x="-2.0" ownerusername="library"/><thing templateid="62" rz="-0.2422096054295765" ry="-0.4519453132273099" rx="0.6039063177273147" rw="0.6102270891221998" scalez="0.9999999999999997" displayname="Palette" scaley="0.9999999999999997" templateowner="library" scalex="0.9999999999999997" possessionid="16" thingid="16" z="-40.0" y="1.0" x="3.0" ownerusername="library"/><thing templateid="48" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Crosswalk Button" scaley="1.0" templateowner="library" scalex="1.0" possessionid="17" thingid="17" z="2.0" y="2.0" x="2.0" ownerusername="library"/><thing templateid="43" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Bike Rack" scaley="1.0" templateowner="library" scalex="1.0" possessionid="18" thingid="18" z="-37.0" y="0.0" x="11.0" ownerusername="library"/><thing templateid="56" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Lawn Light" scaley="1.0" templateowner="library" scalex="1.0" possessionid="19" thingid="19" z="0.0" y="0.0" x="-2.0" ownerusername="library"/><thing templateid="81" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Old Fashioned Streetlight" scaley="1.0" templateowner="library" scalex="1.0" possessionid="20" thingid="20" z="-11.0" y="0.0" x="11.0" ownerusername="library"/><thing templateid="65" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Flower Pot" scaley="1.0" templateowner="library" scalex="1.0" possessionid="21" thingid="21" z="-16.0" y="1.0" x="-3.0" ownerusername="library"/><thing templateid="86" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Wire Conduit" scaley="1.0" templateowner="library" scalex="1.0" possessionid="22" thingid="22" z="0.0" y="0.0" x="-17.0" ownerusername="library"/><thing templateid="46" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Cafe Table" scaley="1.0" templateowner="library" scalex="1.0" possessionid="23" thingid="23" z="0.0" y="0.0" x="6.0" ownerusername="library"/><thing templateid="60" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Short Mailbox" scaley="1.0" templateowner="library" scalex="1.0" possessionid="24" thingid="24" z="-6.0" y="3.0" x="-2.0" ownerusername="library"/><thing templateid="76" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Stop Sign" scaley="1.0" templateowner="library" scalex="1.0" possessionid="25" thingid="25" z="-35.0" y="0.0" x="0.0" ownerusername="library"/><thing templateid="67" rz="0.0" ry="-0.9974949866040559" rx="0.0" rw="0.07073720166769953" scalez="1.0" displayname="Rail Endcap" scaley="1.0" templateowner="library" scalex="1.0" possessionid="26" thingid="26" z="-5.0" y="0.0" x="0.0" ownerusername="library"/><thing templateid="53" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Hydrant" scaley="1.0" templateowner="library" scalex="1.0" possessionid="27" thingid="27" z="-11.0" y="0.0" x="3.0" ownerusername="library"/><thing templateid="45" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Broom" scaley="1.0" templateowner="library" scalex="1.0" possessionid="28" thingid="28" z="-13.0" y="1.0" x="-1.0" ownerusername="library"/><thing templateid="79" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Streetlight" scaley="1.0" templateowner="library" scalex="1.0" possessionid="29" thingid="29" z="0.0" y="0.0" x="-4.0" ownerusername="library"/><thing templateid="54" rz="0.0" ry="-0.4794255386042033" rx="0.0" rw="0.8775825618903726" scalez="1.0" displayname="Lamp" scaley="1.0" templateowner="library" scalex="1.0" possessionid="30" thingid="30" z="-5.0" y="4.0" x="2.0" ownerusername="library"/><thing templateid="68" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Sandwich Board" scaley="1.0" templateowner="library" scalex="1.0" possessionid="31" thingid="31" z="-20.0" y="0.0" x="1.0" ownerusername="library"/><thing templateid="83" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Pylon" scaley="1.0" templateowner="library" scalex="1.0" possessionid="32" thingid="32" z="-6.0" y="0.0" x="4.0" ownerusername="library"/><thing templateid="59" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Private Mailbox" scaley="1.0" templateowner="library" scalex="1.0" possessionid="33" thingid="33" z="-12.0" y="0.0" x="9.0" ownerusername="library"/><thing templateid="84" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Trash Can1" scaley="1.0" templateowner="library" scalex="1.0" possessionid="34" thingid="34" z="0.0" y="0.0" x="-3.0" ownerusername="library"/><thing templateid="44" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Balloons" scaley="1.0" templateowner="library" scalex="1.0" possessionid="35" thingid="35" z="-9.0" y="3.0" x="7.0" ownerusername="library"/><thing templateid="55" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Gas Lamp" scaley="1.0" templateowner="library" scalex="1.0" possessionid="36" thingid="36" z="0.0" y="3.0" x="3.0" ownerusername="library"/><thing templateid="69" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Sidewalk Barrier" scaley="1.0" templateowner="library" scalex="1.0" possessionid="37" thingid="37" z="-2.0" y="0.0" x="1.0" ownerusername="library"/><thing templateid="78" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Street Sign" scaley="1.0" templateowner="library" scalex="1.0" possessionid="38" thingid="38" z="-22.0" y="0.0" x="-3.0" ownerusername="library"/><thing templateid="61" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Gas Meter" scaley="1.0" templateowner="library" scalex="1.0" possessionid="39" thingid="39" z="-5.0" y="0.0" x="-4.0" ownerusername="library"/><thing templateid="85" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Trash Can2" scaley="1.0" templateowner="library" scalex="1.0" possessionid="40" thingid="40" z="-12.0" y="0.0" x="4.0" ownerusername="library"/><thing templateid="66" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Rail" scaley="1.0" templateowner="library" scalex="1.0" possessionid="41" thingid="41" z="-5.0" y="0.0" x="-1.0" ownerusername="library"/><thing templateid="77" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Street Bench" scaley="1.0" templateowner="library" scalex="1.0" possessionid="42" thingid="42" z="-15.0" y="0.0" x="7.0" ownerusername="library"/><thing templateid="52" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Garden Border" scaley="1.0" templateowner="library" scalex="1.0" possessionid="43" thingid="43" z="-1.0" y="0.0" x="4.0" ownerusername="library"/><thing templateid="47" rz="-5.378544397142389E-17" ry="-1.373367859738978E-17" rx="0.24740395925452296" rw="0.9689124217106448" scalez="1.0" displayname="Cinder Block" scaley="1.0" templateowner="library" scalex="1.0" possessionid="44" thingid="44" z="-5.0" y="0.0" x="-2.0" ownerusername="library"/></space>
\ No newline at end of file
+<space ownerusername="admin" sealevel="0.0" simid="1" displayname="Whitespace" maxguests="0" displaysea="false" spaceid="2" published="true"><thing templateid="28" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="White Board" scaley="1.0" templateowner="admin" scalex="1.0" possessionid="1" thingid="1" z="-10.0" y="1.0" x="0.0" ownerusername="admin"/></space>
\ No newline at end of file
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/thingPopup.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/thingPopup.html 2007-10-08 12:51:18 UTC (rev 488)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/thingPopup.html 2007-10-08 12:51:24 UTC (rev 489)
@@ -230,8 +230,8 @@
<input type='submit' onclick='move(0, 0, 1); return false;' value='South'/>
<form onsubmit='moveToZ(this.zPosInput.value); return false;'><input type='text' size='3' id='zPosInput' /></form>
<br/>
+ <input type='submit' onclick='move(-1, 0, 0); return false;' value='West'/>
<input type='submit' onclick='move(1, 0, 0); return false;' value='East'/>
- <input type='submit' onclick='move(-1, 0, 0); return false;' value='West'/>
<form onsubmit='moveToX(this.xPosInput.value); return false;'><input type='text' size='3' id='xPosInput' /></form>
<br/>
<input type='submit' onclick='resetPosition(); return false;' value='Reset'/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-15 13:04:38
|
Revision: 491
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=491&view=rev
Author: trevorolio
Date: 2007-10-15 06:04:39 -0700 (Mon, 15 Oct 2007)
Log Message:
-----------
Added a body texture web resource, backed by the media service. This is used in conjunction with body configurations to provide users with skin customization.
Still to come in texture land:
the body editor UI needs some design love to incorporate the texture upload form
body loading takes too long and shows no progress information
a base skin texture with decal textures baked on top
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/MediaService.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/TemplateResource.java
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
Added Paths:
-----------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyTextureRecord.java
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/MediaService.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/MediaService.java 2007-10-10 23:31:38 UTC (rev 490)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/MediaService.java 2007-10-15 13:04:39 UTC (rev 491)
@@ -36,6 +36,8 @@
public static final String PAGE_CONTENT_PREFIX = "pageContent-";
+ private static final String BODY_TEXTURE_PREFIX = "bodyTexture-";
+
private MediaStore store = null;
public MediaService(URI mediaURI) throws IOException {
@@ -78,6 +80,11 @@
return PAGE_CONTENT_PREFIX + spaceID + "-" + thingID + "-" + pageID;
}
+ public static String getBodyTextureName(long bodyConfigurationID) {
+ return BODY_TEXTURE_PREFIX + bodyConfigurationID;
+ }
+
+
public boolean write(String name, String value) throws IOException {
return store.write(name, value);
}
Added: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyTextureRecord.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyTextureRecord.java (rev 0)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyTextureRecord.java 2007-10-15 13:04:39 UTC (rev 491)
@@ -0,0 +1,48 @@
+package com.ogoglio.persist;
+
+import com.ogoglio.util.ArgumentUtils;
+
+public class BodyTextureRecord {
+
+ private long bodyTextureID = -1;
+
+ private long bodyConfigurationID = -1;
+
+ private String displayName = null;
+
+ public BodyTextureRecord() {
+ }
+
+ public BodyTextureRecord(long bodyConfigurationID, String displayName) {
+ ArgumentUtils.assertNotNegative(bodyConfigurationID);
+ this.bodyConfigurationID = bodyConfigurationID;
+ ArgumentUtils.assertNotNull(displayName);
+ this.displayName = displayName;
+ }
+
+ public long getBodyTextureID() {
+ return bodyTextureID;
+ }
+
+ public void setBodyTextureID(long bodyTextureID) {
+ this.bodyTextureID = bodyTextureID;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ ArgumentUtils.assertNotNull(displayName);
+ this.displayName = displayName;
+ }
+
+ public long getBodyConfigurationID() {
+ return bodyConfigurationID;
+ }
+
+ public void setBodyConfigurationID(long bodyConfigurationID) {
+ this.bodyConfigurationID = bodyConfigurationID;
+ }
+
+}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java 2007-10-10 23:31:38 UTC (rev 490)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java 2007-10-15 13:04:39 UTC (rev 491)
@@ -57,6 +57,8 @@
public static final long VACANCY_TIME_TILL_SHUTDOWN = 1 * 60 * 1000;
+ public static final long MAX_BODY_TEXTURE_SIZE = MAX_GEOMETRY_RESOURCE_SIZE;
+
private SimMessageHandler messageHandler = null;
private TwoWayMap spaceSimulators = new TwoWayMap(); //Maps Long spaceIDs to SpaceSimulators
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-10-10 23:31:38 UTC (rev 490)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-10-15 13:04:39 UTC (rev 491)
@@ -1012,6 +1012,10 @@
public ZipInputStream getBodyData(long bodyDataID) {
return new ZipInputStream(getClass().getClassLoader().getResourceAsStream("ogoglio-body-sim.jar"));
}
+
+ public InputStream getBodyTexture(String username, long bodyConfigurationID) {
+ return null;
+ }
}
private class InSimTemplateDataProvider implements TemplateDataProvider {
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2007-10-10 23:31:38 UTC (rev 490)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2007-10-15 13:04:39 UTC (rev 491)
@@ -14,6 +14,7 @@
package com.ogoglio.site;
import java.io.IOException;
+import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Map;
@@ -29,17 +30,20 @@
import com.ogoglio.appdev.persist.PersistException;
import com.ogoglio.appdev.servlet.Four04SiteResource;
import com.ogoglio.appdev.servlet.SiteResource;
+import com.ogoglio.client.DecoratedInputStream;
import com.ogoglio.client.WebAPIClientWire;
import com.ogoglio.client.WebAPIUtil;
import com.ogoglio.mail.MailClient;
import com.ogoglio.mail.MailFormatter;
import com.ogoglio.mail.MailSendException;
import com.ogoglio.mail.MailTemplateFactory;
+import com.ogoglio.media.MediaService;
import com.ogoglio.persist.AccountPersistTasks;
import com.ogoglio.persist.AccountRecord;
import com.ogoglio.persist.BodyConfigurationRecord;
import com.ogoglio.persist.BodyPersistTasks;
import com.ogoglio.persist.BodySettingRecord;
+import com.ogoglio.persist.BodyTextureRecord;
import com.ogoglio.persist.PendingEmailValidationRecord;
import com.ogoglio.persist.PendingEmailValidationTasks;
import com.ogoglio.persist.PossessionPersistTasks;
@@ -53,7 +57,9 @@
import com.ogoglio.persist.SpaceRecord;
import com.ogoglio.persist.TemplatePersistTasks;
import com.ogoglio.persist.TemplateRecord;
+import com.ogoglio.sim.Sim;
import com.ogoglio.util.Log;
+import com.ogoglio.util.StreamUtils;
import com.ogoglio.xml.AccountDocument;
import com.ogoglio.xml.BodyConfigurationDocument;
import com.ogoglio.xml.PossessionDocument;
@@ -178,9 +184,114 @@
return false;
}
+ private class BodyTextureResource extends AuthenticatedSiteResource {
+ public BodyTextureResource() {
+ super("texture", false, getSessionFactory());
+ }
+
+ public void doDelete(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws ServletException, IOException, PersistException {
+ BodyConfigurationRecord configRecord = getBodyConfigurationRecord(request, authedAccount, pathElements);
+ if (configRecord == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+
+ getMediaService().delete(MediaService.getBodyTextureName(configRecord.getBodyConfigurationID()));
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
+
+
+ public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws ServletException, IOException, PersistException {
+ BodyConfigurationRecord configRecord = getBodyConfigurationRecord(request, authedAccount, pathElements);
+ if (configRecord == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+
+ InputStream fileInput = null;
+ if (request.getContentType() != null && request.getContentType().startsWith("multipart/form-data")) {
+ fileInput = getFirstFile(request, Sim.MAX_GEOMETRY_SIZE);
+ System.out.println("File input: " + fileInput);
+ if (fileInput == null) {
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ return;
+ }
+ } else {
+ fileInput = request.getInputStream();
+ System.out.println("inputolio: " + fileInput);
+ }
+
+ if (!getMediaService().write(MediaService.getBodyTextureName(configRecord.getBodyConfigurationID()), fileInput, Sim.MAX_BODY_TEXTURE_SIZE)) {
+ Log.error("Could not write body texture");
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ return;
+ }
+
+ response.setStatus(HttpServletResponse.SC_OK);
+ return;
+ }
+
+ public void doHead(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws ServletException, IOException, PersistException {
+ BodyConfigurationRecord configRecord = getBodyConfigurationRecord(request, authedAccount, pathElements);
+ if (configRecord == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+
+ String mediaName = MediaService.getBodyTextureName(configRecord.getBodyConfigurationID());
+ long length = getMediaService().getSize(mediaName);
+ if (length == -1) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+
+ long lastModified = getMediaService().getLastModified(mediaName);
+ setCachable(response);
+ response.setStatus(HttpServletResponse.SC_OK);
+ response.setContentLength((int) length);
+ response.setDateHeader("Last-Modified", lastModified);
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, IOException {
+ BodyConfigurationRecord configRecord = getBodyConfigurationRecord(request, authedAccount, pathElements);
+ if (configRecord == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+ DecoratedInputStream data = getMediaService().getData(MediaService.getBodyTextureName(configRecord.getBodyConfigurationID()));
+ if (data == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+ response.setStatus(HttpServletResponse.SC_OK);
+ setCachable(response);
+ if (data.getMimeType() != null) {
+ response.setContentType(data.getMimeType());
+ }
+ if (data.getLength() > -1) {
+ response.setContentLength((int) data.getLength());
+ }
+ StreamUtils.write(data, response.getOutputStream());
+ }
+
+ private BodyConfigurationRecord getBodyConfigurationRecord(HttpServletRequest request, AccountRecord authedAccount, String[] pathElements) throws PersistException {
+ String username = pathElements[pathElements.length - 4];
+ if (!requestOkForBody(request, username, authedAccount)) {
+ return null;
+ }
+ long bodyConfigID = Long.parseLong(pathElements[pathElements.length - 2]);
+ BodyConfigurationRecord record = BodyPersistTasks.findBodyConfigurationByID(bodyConfigID, getSessionFactory());
+ if (record == null || !username.equals(record.getOwnerUsername())) {
+ return null;
+ }
+ return record;
+ }
+ }
+
private class BodyResource extends AuthenticatedSiteResource {
public BodyResource() {
super(SiteResource.LONG_ELEMENT, false, getSessionFactory());
+ addSubResource(new BodyTextureResource());
}
public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, IOException {
@@ -197,7 +308,6 @@
return;
}
BodySettingRecord[] settingRecords = BodyPersistTasks.findBodySettingsByConfigurationID(bodyConfigID, getSessionFactory());
-
sendStringResponse(DocumentFactory.documentFromRecord(record, settingRecords).toString(), "text/xml", response);
}
@@ -237,12 +347,11 @@
return;
}
BodyConfigurationRecord record = BodyPersistTasks.findBodyConfigurationByID(authedAccount.getDefaultBodyConfigurationID(), getSessionFactory());
- if(record == null){
+ if (record == null) {
throw new IllegalStateException("Account has a bogus body configuration record.. " + authedAccount.getDefaultBodyConfigurationID());
}
-
- BodySettingRecord[] settingRecords = BodyPersistTasks.findBodySettingsByConfigurationID(record.getBodyConfigurationID(), getSessionFactory());
- sendStringResponse(DocumentFactory.documentFromRecord(record, settingRecords).toString(), "text/xml", response);
+
+ sendStringResponse(createBodyConfigurationDocument(record).toString(), "text/xml", response);
}
}
@@ -262,7 +371,7 @@
BodyConfigurationRecord[] configRecs = BodyPersistTasks.findBodyConfigurationsByUsername(username, getSessionFactory());
XMLElement list = new XMLElement("list");
for (int i = 0; i < configRecs.length; i++) {
- list.addChild(DocumentFactory.documentFromRecord(configRecs[i], BodyPersistTasks.findBodySettingsByConfigurationID(configRecs[i].getBodyConfigurationID(), getSessionFactory())).toElement());
+ list.addChild(createBodyConfigurationDocument(configRecs[i]).toElement());
}
sendStringResponse(list.toString(), "text/xml", response);
}
@@ -283,10 +392,15 @@
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
return;
}
- sendStringResponse(DocumentFactory.documentFromRecord(record, BodyPersistTasks.findBodySettingsByConfigurationID(record.getBodyConfigurationID(), getSessionFactory())).toString(), "text/xml", response);
+ sendStringResponse(createBodyConfigurationDocument(record).toString(), "text/xml", response);
}
}
+ private BodyConfigurationDocument createBodyConfigurationDocument(BodyConfigurationRecord record) throws PersistException {
+ BodySettingRecord[] settingRecords = BodyPersistTasks.findBodySettingsByConfigurationID(record.getBodyConfigurationID(), getSessionFactory());
+ return DocumentFactory.documentFromRecord(record, settingRecords);
+ }
+
private void sendValidationMail(PendingEmailValidationRecord validationRecord) throws MailSendException {
String from = "robot@" + getSiteInfo().getHost();
String validationURL = getSiteInfo().getBaseUrl() + "account/validate?" + SECRET_PARAMETER + "=" + validationRecord.getSecret();
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/TemplateResource.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/TemplateResource.java 2007-10-10 23:31:38 UTC (rev 490)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/TemplateResource.java 2007-10-15 13:04:39 UTC (rev 491)
@@ -29,567 +29,569 @@
import com.ogoglio.xml.server.DocumentFactory;
public class TemplateResource extends AuthenticatedSiteResource {
- private SessionFactory sessionFactory;
- private MediaService mediaService;
+ private SessionFactory sessionFactory;
- public TemplateResource(SessionFactory factory, MediaService service) {
- super(SiteResource.LONG_ELEMENT, false, factory);
- addSubResource(new TemplateGeometryResource());
- addSubResource(new TemplateScriptResource(factory));
- sessionFactory=factory;
- mediaService=service;
- }
- public SessionFactory getSessionFactory() {
- return sessionFactory;
- }
- public InputStream getFirstFile(HttpServletRequest request,long maxSize) throws IOException {
- return AbstractResourceServlet.getFirstFile(request, maxSize);
- }
- public MediaService getMediaService() {
- return mediaService;
- }
- public void setCachable(HttpServletResponse response) {
- AbstractResourceServlet.setCachable(response);
- }
- public String getFirstStringValue(HttpServletRequest request) throws IOException {
- return AbstractResourceServlet.getFirstStringValue(request);
- }
+ private MediaService mediaService;
+ public TemplateResource(SessionFactory factory, MediaService service) {
+ super(SiteResource.LONG_ELEMENT, false, factory);
+ addSubResource(new TemplateGeometryResource());
+ addSubResource(new TemplateScriptResource(factory));
+ sessionFactory = factory;
+ mediaService = service;
+ }
- public void doDelete(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
- AccountRecord requestedAccount = verifyAccountFromPathElements(response, pathElements);
- if (requestedAccount==null) {
- return;
- }
+ public SessionFactory getSessionFactory() {
+ return sessionFactory;
+ }
- TemplateRecord record = verifyTemplateIDFromPathElements(response, pathElements);
- if (record==null) {
- return;
- }
- if (!TemplatePersistTasks.deleteTemplate(record, getSessionFactory())) {
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- return;
- }
- response.setStatus(HttpServletResponse.SC_OK);
- }
+ public InputStream getFirstFile(HttpServletRequest request, long maxSize) throws IOException {
+ return AbstractResourceServlet.getFirstFile(request, maxSize);
+ }
- public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
- AccountRecord requestedAccount = verifyAccountFromPathElements(response, pathElements);
- if (requestedAccount==null) {
- return;
- }
+ public MediaService getMediaService() {
+ return mediaService;
+ }
- TemplateRecord record = verifyTemplateIDFromPathElements(response, pathElements);
- if (record==null) {
- return;
- }
+ public void setCachable(HttpServletResponse response) {
+ AbstractResourceServlet.setCachable(response);
+ }
- if (authedAccount == null || !requestedAccount.getUsername().equals(authedAccount.getUsername())) {
- response.setStatus(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
+ public String getFirstStringValue(HttpServletRequest request) throws IOException {
+ return AbstractResourceServlet.getFirstStringValue(request);
+ }
- TemplateDocument newDoc = new TemplateDocument(parseXML(request.getInputStream()));
- TemplateRecord updatedRec = TemplatePersistTasks.update(newDoc, record, getSessionFactory());
- if (updatedRec == null) {
- response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
- return;
- }
+ public void doDelete(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
+ AccountRecord requestedAccount = verifyAccountFromPathElements(response, pathElements);
+ if (requestedAccount == null) {
+ return;
+ }
- newDoc = DocumentFactory.documentFromRecord(updatedRec);
+ TemplateRecord record = verifyTemplateIDFromPathElements(response, pathElements);
+ if (record == null) {
+ return;
+ }
+ if (!TemplatePersistTasks.deleteTemplate(record, getSessionFactory())) {
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ return;
+ }
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
- sendStringResponse(newDoc.toString(), "text/xml", response);
- }
+ public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
+ AccountRecord requestedAccount = verifyAccountFromPathElements(response, pathElements);
+ if (requestedAccount == null) {
+ return;
+ }
- private TemplateRecord verifyTemplateIDFromPathElements(HttpServletResponse response, String[] pathElements) throws PersistException {
- long templateID = Long.parseLong(pathElements[pathElements.length - 1]);
- TemplateRecord record = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
- if (record == null) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return null;
- }
- return record;
- }
+ TemplateRecord record = verifyTemplateIDFromPathElements(response, pathElements);
+ if (record == null) {
+ return;
+ }
- private AccountRecord verifyAccountFromPathElements(HttpServletResponse response, String[] pathElements) throws PersistException {
- String usernameParam = pathElements[pathElements.length - 3];
- AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
- if (requestedAccount == null) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return null;
- }
- return requestedAccount;
- }
+ if (authedAccount == null || !requestedAccount.getUsername().equals(authedAccount.getUsername())) {
+ response.setStatus(HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
- public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
- AccountRecord requestedAccount = verifyAccountFromPathElements(response, pathElements);
- if (requestedAccount==null) {
- return;
- }
+ TemplateDocument newDoc = new TemplateDocument(parseXML(request.getInputStream()));
+ TemplateRecord updatedRec = TemplatePersistTasks.update(newDoc, record, getSessionFactory());
+ if (updatedRec == null) {
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ return;
+ }
- TemplateRecord record = verifyTemplateIDFromPathElements(response, pathElements);
- if (record==null) {
- return;
- }
- TemplateDocument result = DocumentFactory.documentFromRecord(record);
- sendStringResponse(result.toString(), "text/xml", response);
+ newDoc = DocumentFactory.documentFromRecord(updatedRec);
- }
+ sendStringResponse(newDoc.toString(), "text/xml", response);
+ }
+ private TemplateRecord verifyTemplateIDFromPathElements(HttpServletResponse response, String[] pathElements) throws PersistException {
+ long templateID = Long.parseLong(pathElements[pathElements.length - 1]);
+ TemplateRecord record = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
+ if (record == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return null;
+ }
+ return record;
+ }
-// to prevent repetition between post and delete
- private abstract class TemplateSupportFileAction {
- public abstract void doGeometryAction(HttpServletRequest request, HttpServletResponse response,
- String[] pathElements, long templateID) throws PersistException, IOException;
- public abstract void doMaterialFileAction(HttpServletRequest request, HttpServletResponse response,
- String[] pathElements, long templateID) throws IOException, PersistException;
+ private AccountRecord verifyAccountFromPathElements(HttpServletResponse response, String[] pathElements) throws PersistException {
+ String usernameParam = pathElements[pathElements.length - 3];
+ AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
+ if (requestedAccount == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return null;
+ }
+ return requestedAccount;
+ }
- void destroyARecordInATemplateSetOfSupportFiles(HttpServletResponse response, TemplateRecord template, TemplateSupportFileRecord rec) throws PersistException {
- if (rec==null) {
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- return;
- }
- template.getSupportFiles().remove(rec); //destroy pointer
- TemplatePersistTasks.update(template, getSessionFactory());
- response.setStatus(HttpServletResponse.SC_OK);
- }
- public String templateGeometryNameFromPathElements(long templateID, String[] pathElements, int[] hackReturn) {
- int LOD=-2995;
- try {
- LOD=Integer.parseInt(pathElements[pathElements.length -1]);
- hackReturn[0]=LOD;
- } catch (NumberFormatException e) {
- return null;
- }
- return MediaService.getTemplateGeometryName(templateID, LOD);
- }
- }
+ public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
+ AccountRecord requestedAccount = verifyAccountFromPathElements(response, pathElements);
+ if (requestedAccount == null) {
+ return;
+ }
- class TemplateSupportFilePost extends TemplateSupportFileAction{
- public void doGeometryAction(HttpServletRequest request, HttpServletResponse response,
- String[] pathElements, long templateID) throws PersistException, IOException{
- InputStream fileInput;
- //is this coming from a browser?
- if (request.getContentType() != null && request.getContentType().startsWith("multipart/form-data")) {
- fileInput = getFirstFile(request, Sim.MAX_GEOMETRY_SIZE);
- if (fileInput == null) {
- response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
- return;
- }
- } else {
- //coming from a sensible browser, just get the file input
- fileInput=request.getInputStream();
- }
- int[] lodHack=new int[1];
- String templateGeometryName = templateGeometryNameFromPathElements(templateID, pathElements,lodHack);
+ TemplateRecord record = verifyTemplateIDFromPathElements(response, pathElements);
+ if (record == null) {
+ return;
+ }
+ TemplateDocument result = DocumentFactory.documentFromRecord(record);
+ sendStringResponse(result.toString(), "text/xml", response);
+
+ }
+
+ // to prevent repetition between post and delete
+ private abstract class TemplateSupportFileAction {
+ public abstract void doGeometryAction(HttpServletRequest request, HttpServletResponse response, String[] pathElements, long templateID) throws PersistException, IOException;
+
+ public abstract void doMaterialFileAction(HttpServletRequest request, HttpServletResponse response, String[] pathElements, long templateID) throws IOException, PersistException;
+
+ void destroyARecordInATemplateSetOfSupportFiles(HttpServletResponse response, TemplateRecord template, TemplateSupportFileRecord rec) throws PersistException {
+ if (rec == null) {
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ return;
+ }
+ template.getSupportFiles().remove(rec); //destroy pointer
+ TemplatePersistTasks.update(template, getSessionFactory());
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
+
+ public String templateGeometryNameFromPathElements(long templateID, String[] pathElements, int[] hackReturn) {
+ int LOD = -2995;
+ try {
+ LOD = Integer.parseInt(pathElements[pathElements.length - 1]);
+ hackReturn[0] = LOD;
+ } catch (NumberFormatException e) {
+ return null;
+ }
+ return MediaService.getTemplateGeometryName(templateID, LOD);
+ }
+ }
+
+ class TemplateSupportFilePost extends TemplateSupportFileAction {
+ public void doGeometryAction(HttpServletRequest request, HttpServletResponse response, String[] pathElements, long templateID) throws PersistException, IOException {
+ InputStream fileInput;
+ //is this coming from a browser?
+ if (request.getContentType() != null && request.getContentType().startsWith("multipart/form-data")) {
+ fileInput = getFirstFile(request, Sim.MAX_GEOMETRY_SIZE);
+ if (fileInput == null) {
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ return;
+ }
+ } else {
+ //coming from a sensible browser, just get the file input
+ fileInput = request.getInputStream();
+ }
+ int[] lodHack = new int[1];
+ String templateGeometryName = templateGeometryNameFromPathElements(templateID, pathElements, l...
[truncated message content] |
|
From: <tre...@us...> - 2007-10-19 22:09:16
|
Revision: 519
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=519&view=rev
Author: trevorolio
Date: 2007-10-19 15:09:21 -0700 (Fri, 19 Oct 2007)
Log Message:
-----------
Fixed up the chairs so that they are populated as seats with reasonable seat positioning.
This required an addition of a template.properties file to template population dirs.
Tweaked template editor html to handle seat position editing keystrokes a little better.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/PossessionPersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/TemplatePersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-1.xml
maven/trunk/ogoglio-server/src/main/resources/populate/space-1
maven/trunk/ogoglio-server/src/main/resources/populate/template-15/HillHouseChair.blend
maven/trunk/ogoglio-server/src/main/resources/populate/template-15/HillHouseChair.obj
maven/trunk/ogoglio-server/src/main/resources/populate/template-16/JacobsenChair3107.blend
maven/trunk/ogoglio-server/src/main/resources/populate/template-16/JacobsenChair3107.mtl
maven/trunk/ogoglio-server/src/main/resources/populate/template-16/JacobsenChair3107.obj
maven/trunk/ogoglio-server/src/main/resources/populate/template-17/LeCorbusierArmChair.blend
maven/trunk/ogoglio-server/src/main/resources/populate/template-17/LeCorbusierArmChair.obj
maven/trunk/ogoglio-server/src/main/resources/populate/template-18/LeCorbusierRecliner.blend
maven/trunk/ogoglio-server/src/main/resources/populate/template-18/LeCorbusierRecliner.mtl
maven/trunk/ogoglio-server/src/main/resources/populate/template-18/LeCorbusierRecliner.obj
maven/trunk/ogoglio-server/src/main/resources/populate/template-19/LeCorbusierSofa.blend
maven/trunk/ogoglio-server/src/main/resources/populate/template-19/LeCorbusierSofa.obj
maven/trunk/ogoglio-server/src/main/resources/populate/template-20/MarshmallowSofa.blend
maven/trunk/ogoglio-server/src/main/resources/populate/template-20/MarshmallowSofa.mtl
maven/trunk/ogoglio-server/src/main/resources/populate/template-20/MarshmallowSofa.obj
maven/trunk/ogoglio-server/src/main/resources/populate/template-24/OfficeChair.blend
maven/trunk/ogoglio-server/src/main/resources/populate/template-24/OfficeChair.obj
maven/trunk/ogoglio-server/src/main/resources/populate/template-3/BarcelonaChair.blend
maven/trunk/ogoglio-server/src/main/resources/populate/template-3/BarcelonaChair.obj
maven/trunk/ogoglio-server/src/main/resources/populate/template-31/OfficeChairNoArms.blend
maven/trunk/ogoglio-server/src/main/resources/populate/template-31/OfficeChairNoArms.obj
maven/trunk/ogoglio-server/src/main/resources/populate/template-5/CescaArmChair.blend
maven/trunk/ogoglio-server/src/main/resources/populate/template-5/CescaArmChair.obj
maven/trunk/ogoglio-server/src/main/resources/populate/template-6/CornerSofa.blend
maven/trunk/ogoglio-server/src/main/resources/populate/template-6/CornerSofa.mtl
maven/trunk/ogoglio-server/src/main/resources/populate/template-6/CornerSofa.obj
maven/trunk/ogoglio-server/src/main/resources/populate/template-8/AluminumChair.blend
maven/trunk/ogoglio-server/src/main/resources/populate/template-8/AluminumChair.obj
maven/trunk/ogoglio-server/src/main/resources/populate/template-9/EamesLoungeChair.blend
maven/trunk/ogoglio-server/src/main/resources/populate/template-9/EamesLoungeChair.mtl
maven/trunk/ogoglio-server/src/main/resources/populate/template-9/EamesLoungeChair.obj
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/templateEditor.html
Added Paths:
-----------
maven/trunk/ogoglio-server/src/main/resources/populate/template-15/template.properties
maven/trunk/ogoglio-server/src/main/resources/populate/template-16/template.properties
maven/trunk/ogoglio-server/src/main/resources/populate/template-17/template.properties
maven/trunk/ogoglio-server/src/main/resources/populate/template-18/template.properties
maven/trunk/ogoglio-server/src/main/resources/populate/template-19/template.properties
maven/trunk/ogoglio-server/src/main/resources/populate/template-20/template.properties
maven/trunk/ogoglio-server/src/main/resources/populate/template-24/template.properties
maven/trunk/ogoglio-server/src/main/resources/populate/template-3/template.properties
maven/trunk/ogoglio-server/src/main/resources/populate/template-31/template.properties
maven/trunk/ogoglio-server/src/main/resources/populate/template-5/template.properties
maven/trunk/ogoglio-server/src/main/resources/populate/template-6/template.properties
maven/trunk/ogoglio-server/src/main/resources/populate/template-77/template.properties
maven/trunk/ogoglio-server/src/main/resources/populate/template-8/template.properties
maven/trunk/ogoglio-server/src/main/resources/populate/template-9/template.properties
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/PossessionPersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/PossessionPersistTasks.java 2007-10-19 17:15:31 UTC (rev 518)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/PossessionPersistTasks.java 2007-10-19 22:09:21 UTC (rev 519)
@@ -29,6 +29,8 @@
public static final String POSSESSIONS_BY_SPACE_ID = "com.ogoglio.persist.possessionsBySpaceID";
+ protected static final String POSSESSIONS_BY_TEMPLATE_ID = "com.ogoglio.persist.possessionsByTemplateID";
+
public static PossessionRecord[] findPossessionsByOwnerUsername(final String username, SessionFactory sessionFactory) throws PersistException {
HibernateTask task = new HibernateTask() {
public Object run(Session session) throws PersistException {
@@ -41,6 +43,18 @@
return (PossessionRecord[]) task.execute();
}
+ public static PossessionRecord[] findPossessionsByTemplateID(final long templateID, SessionFactory sessionFactory) throws PersistException {
+ HibernateTask task = new HibernateTask() {
+ public Object run(Session session) throws PersistException {
+ Query query = session.getNamedQuery(POSSESSIONS_BY_TEMPLATE_ID);
+ query.setLong("templateID", templateID);
+ return query.list().toArray(new PossessionRecord[0]);
+ }
+ };
+ task.setSessionFactory(sessionFactory);
+ return (PossessionRecord[]) task.execute();
+ }
+
public static PossessionRecord[] findPossessionsBySpaceID(final long spaceID, SessionFactory sessionFactory) throws PersistException {
HibernateTask task = new HibernateTask() {
public Object run(Session session) throws PersistException {
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/TemplatePersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/TemplatePersistTasks.java 2007-10-19 17:15:31 UTC (rev 518)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/TemplatePersistTasks.java 2007-10-19 22:09:21 UTC (rev 519)
@@ -162,6 +162,14 @@
if (accountRecord == null) {
return null;
}
+
+ Query possQuery = session.getNamedQuery(PossessionPersistTasks.POSSESSIONS_BY_TEMPLATE_ID);
+ possQuery.setLong("templateID", record.getTemplateID());
+ PossessionRecord[] currentPossessions = (PossessionRecord[])possQuery.list().toArray(new PossessionRecord[0]);
+ if(currentPossessions.length > 0){
+ return Boolean.FALSE;
+ }
+
session.delete(record);
return Boolean.TRUE;
}
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-10-19 17:15:31 UTC (rev 518)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-10-19 22:09:21 UTC (rev 519)
@@ -100,7 +100,13 @@
ThingDocument[] thingDocs = spaceDocument.getThingDocuments();
for (int i = 0; i < thingDocs.length; i++) {
- Template template = new Template(listener.getTemplateDocument(thingDocs[i].getTemplateID()));
+ TemplateDocument templateDoc = listener.getTemplateDocument(thingDocs[i].getTemplateID());
+ if (templateDoc == null) {
+ log("Could not add a thing (" + thingDocs[i].getDisplayName() + ") for unknown template " + thingDocs[i].getTemplateID());
+ Log.error("In space " + space.getSpaceID() + ", could not add a thing (" + thingDocs[i].getDisplayName() + ") for unknown template " + thingDocs[i].getTemplateID());
+ return;
+ }
+ Template template = new Template(templateDoc);
space.addTemplate(template);
space.addThing(new Thing(space, template, thingDocs[i]));
}
@@ -131,7 +137,7 @@
public void generatedSpaceEventForUser(String username, SpaceEvent event, SpaceSimulator spaceSimulator);
public TemplateDocument getTemplateDocument(long templateID);
-
+
public BodyConfigurationDocument getDefaultBodyConfigurationDocument(String username);
public String getTemplateScript(long templateID);
@@ -200,7 +206,7 @@
while (!cleaned) {
try {
SpaceEvent event = (SpaceEvent) queue.dequeue();
- if(cleaned){
+ if (cleaned) {
return;
}
if (SpaceEvent.ADD_USER_EVENT.equals(event.getName())) {
@@ -231,7 +237,7 @@
}
user.stopMotion(event.getTransform());
listener.generatedSpaceEvent(event, SpaceSimulator.this);
- } else if(SpaceEvent.USER_SAT_EVENT.equals(event.getName())){
+ } else if (SpaceEvent.USER_SAT_EVENT.equals(event.getName())) {
String username = event.getStringProperty(SpaceEvent.USERNAME);
User user = space.getUser(username);
if (user == null) {
@@ -240,12 +246,12 @@
}
long thingID = event.getLongProperty(SpaceEvent.THING_ID).longValue();
Thing seatThing = space.getThing(thingID);
- if(seatThing == null){
+ if (seatThing == null) {
log("Received sit event for unknown thing: " + username + ", " + thingID);
}
user.setSeat(seatThing);
listener.generatedSpaceEvent(event, SpaceSimulator.this);
-
+
} else if (SpaceEvent.THING_START_MOTION_EVENT.equals(event.getName())) {
long thingID = event.getLongProperty(SpaceEvent.THING_ID).longValue();
Thing thing = space.getThing(thingID);
@@ -339,11 +345,11 @@
long thingID = event.getLongProperty(SpaceEvent.THING_ID).longValue();
long pageID = event.getLongProperty(SpaceEvent.PAGE_ID).longValue();
Thing thing = space.getThing(thingID);
- if(thing == null){
+ if (thing == null) {
return;
}
Page page = thing.getPage(pageID);
- if(page == null){
+ if (page == null) {
return;
}
page.setContentType(event.getStringProperty(SpaceEvent.CONTENT_TYPE));
@@ -353,11 +359,11 @@
long thingID = event.getLongProperty(SpaceEvent.THING_ID).longValue();
long pageID = event.getLongProperty(SpaceEvent.PAGE_ID).longValue();
Thing thing = space.getThing(thingID);
- if(thing == null){
+ if (thing == null) {
return;
}
Page page = thing.getPage(pageID);
- if(page == null){
+ if (page == null) {
return;
}
page.setContentType(event.getStringProperty(SpaceEvent.CONTENT_TYPE));
@@ -1019,9 +1025,9 @@
public SimBodyConfiguration() {
super(1, "Sim Body", 1);
}
-
+
}
-
+
private class InSimBodyDataProvider implements BodyDataProvider {
public ZipInputStream getBodyData(long bodyDataID) {
return new ZipInputStream(getClass().getClassLoader().getResourceAsStream("ogoglio-body-sim.jar"));
@@ -1050,7 +1056,7 @@
return listener.getTemplateResourceStream(templateID, resourceName);
}
- public String getTemplateScript(String username, long templateID){
+ public String getTemplateScript(String username, long templateID) {
Template template = space.getTemplate(templateID);
if (template == null) {
return null;
Modified: maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-1.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-1.xml 2007-10-19 17:15:31 UTC (rev 518)
+++ maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-1.xml 2007-10-19 22:09:21 UTC (rev 519)
@@ -222,6 +222,10 @@
<![CDATA[ from com.ogoglio.persist.PossessionRecord as possession where possession.spaceID = :spaceID ]]>
</query>
+ <query name="com.ogoglio.persist.possessionsByTemplateID">
+ <![CDATA[ from com.ogoglio.persist.PossessionRecord as possession where possession.templateID = :templateID ]]>
+ </query>
+
<query name="com.ogoglio.persist.templateByID">
<![CDATA[ from com.ogoglio.persist.TemplateRecord as template where template.templateID = :templateID ]]>
</query>
Modified: maven/trunk/ogoglio-server/src/main/resources/populate/space-1
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/populate/space-1 2007-10-19 17:15:31 UTC (rev 518)
+++ maven/trunk/ogoglio-server/src/main/resources/populate/space-1 2007-10-19 22:09:21 UTC (rev 519)
@@ -1,52 +1 @@
-<space ownerusername="library" sealevel="0.0" simid="1"
- displayname="Sitting" maxguests="0" displaysea="false" spaceid="1"
- published="true">
- <thing templateid="9" rz="0.0" ry="0.0" rx="0.0" rw="1.0"
- scalez="1.0" displayname="EamesLoungeChair" scaley="1.0"
- templateowner="library" scalex="1.0" possessionid="1" thingid="1"
- z="-5.0" y="0.0" x="-18.0" ownerusername="library" />
- <thing templateid="24" rz="0.0" ry="0.0" rx="0.0" rw="1.0"
- scalez="1.0" displayname="OfficeChair" scaley="1.0"
- templateowner="library" scalex="1.0" possessionid="2" thingid="2"
- z="-5.0" y="0.0" x="-16.0" ownerusername="library" />
- <thing templateid="18" rz="0.0" ry="0.0" rx="0.0" rw="1.0"
- scalez="1.0" displayname="LeCorbusierRecliner" scaley="1.0"
- templateowner="library" scalex="1.0" possessionid="3" thingid="3"
- z="-5.0" y="0.0" x="-8.2" ownerusername="library" />
- <thing templateid="19" rz="0.0" ry="0.0" rx="0.0" rw="1.0"
- scalez="1.0" displayname="LeCorbusierSofa" scaley="1.0"
- templateowner="library" scalex="1.0" possessionid="4" thingid="4"
- z="-5.0" y="0.0" x="-12.0" ownerusername="library" />
- <thing templateid="16" rz="0.0" ry="0.0" rx="0.0" rw="1.0"
- scalez="1.0" displayname="JacobsenChair3107" scaley="1.0"
- templateowner="library" scalex="1.0" possessionid="5" thingid="5"
- z="-5.0" y="0.0" x="-3.0" ownerusername="library" />
- <thing templateid="5" rz="0.0" ry="0.0" rx="0.0" rw="1.0"
- scalez="1.0" displayname="CescaArmChair" scaley="1.0"
- templateowner="library" scalex="1.0" possessionid="6" thingid="6"
- z="-5.0" y="0.0" x="-6.0" ownerusername="library" />
- <thing templateid="8" rz="0.0" ry="0.0" rx="0.0" rw="1.0"
- scalez="1.0" displayname="AluminumChair" scaley="1.0"
- templateowner="library" scalex="1.0" possessionid="7" thingid="7"
- z="-5.0" y="0.0" x="0.0" ownerusername="library" />
- <thing templateid="20" rz="0.0" ry="0.0" rx="0.0" rw="1.0"
- scalez="1.0" displayname="MarshmallowSofa" scaley="1.0"
- templateowner="library" scalex="1.0" possessionid="8" thingid="8"
- z="-5.0" y="0.0" x="3.0" ownerusername="library" />
- <thing templateid="17" rz="0.0" ry="0.0" rx="0.0" rw="1.0"
- scalez="1.0" displayname="LeCorbusierArmChair" scaley="1.0"
- templateowner="library" scalex="1.0" possessionid="9" thingid="9"
- z="-5.0" y="0.0" x="9.0" ownerusername="library" />
- <thing templateid="3" rz="0.0" ry="0.0" rx="0.0" rw="1.0"
- scalez="1.0" displayname="BarcelonaChair" scaley="1.0"
- templateowner="library" scalex="1.0" possessionid="10" thingid="10"
- z="-5.0" y="0.0" x="6.0" ownerusername="library" />
- <thing templateid="31" rz="0.0" ry="0.0" rx="0.0" rw="1.0"
- scalez="1.0" displayname="OfficeChairNoArms" scaley="1.0"
- templateowner="library" scalex="1.0" possessionid="11" thingid="11"
- z="-5.0" y="0.0" x="12.0" ownerusername="library" />
- <thing templateid="6" rz="0.0" ry="0.0" rx="0.0" rw="1.0"
- scalez="1.0" displayname="CornerSofa" scaley="1.0"
- templateowner="library" scalex="1.0" possessionid="12" thingid="12"
- z="-5.0" y="0.0" x="18.0" ownerusername="library" />
-</space>
+<space ownerusername="admin" sealevel="0.000000" simid="1" displayname="Sitting" maxguests="5" displaysea="false" spaceid="2" published="true"><thing templateid="24" rz="0.000000" ry="0.841471" rx="0.000000" rw="0.540302" scalez="1.000000" displayname="Office Chair" scaley="1.000000" templateowner="admin" scalex="1.000000" possessionid="1" thingid="1" z="-9.000000" y="0.000000" x="-5.000000" ownerusername="admin"/><thing templateid="19" rz="0.000000" ry="-0.711473" rx="0.000000" rw="0.702713" scalez="1.000000" displayname="Le Corbusier Sofa" scaley="1.000000" templateowner="admin" scalex="1.000000" possessionid="2" thingid="2" z="-12.000000" y="0.000000" x="2.000000" ownerusername="admin"/><thing templateid="17" rz="0.000000" ry="0.681639" rx="0.000000" rw="0.731688" scalez="1.000000" displayname="Le Corbusier Arm Chair" scaley="1.000000" templateowner="admin" scalex="1.000000" possessionid="3" thingid="3" z="-12.000000" y="0.000000" x="-5.000000" ownerusername="admin"/><thing templateid="20" rz="0.000000" ry="-0.479426" rx="0.000000" rw="0.877582" scalez="1.000000" displayname="Marshmallow Sofa" scaley="1.000000" templateowner="admin" scalex="1.000000" possessionid="4" thingid="4" z="-16.000000" y="0.000000" x="1.500000" ownerusername="admin"/><thing templateid="31" rz="0.000000" ry="0.841471" rx="0.000000" rw="0.540302" scalez="1.000000" displayname="Office Chair No Arms" scaley="1.000000" templateowner="admin" scalex="1.000000" possessionid="5" thingid="5" z="-10.000000" y="0.000000" x="-5.000000" ownerusername="admin"/><thing templateid="5" rz="0.000000" ry="0.997495" rx="0.000000" rw="0.070737" scalez="1.000000" displayname="Cesca Arm Chair" scaley="1.000000" templateowner="admin" scalex="1.000000" possessionid="6" thingid="6" z="-8.000000" y="0.000000" x="-4.000000" ownerusername="admin"/><thing templateid="9" rz="0.000000" ry="-0.999574" rx="0.000000" rw="0.029200" scalez="1.000000" displayname="Eames Lounge Chair" scaley="1.000000" templateowner="admin" scalex="1.000000" possessionid="7" thingid="7" z="-8.000000" y="0.000000" x="-2.000000" ownerusername="admin"/><thing templateid="18" rz="0.000000" ry="0.681639" rx="0.000000" rw="0.731688" scalez="1.000000" displayname="Le Corbusier Recliner" scaley="1.000000" templateowner="admin" scalex="1.000000" possessionid="8" thingid="8" z="-18.000000" y="0.000000" x="-1.200000" ownerusername="admin"/><thing templateid="3" rz="0.000000" ry="-0.983986" rx="0.000000" rw="0.178246" scalez="1.000000" displayname="Barcelona Chair" scaley="1.000000" templateowner="admin" scalex="1.000000" possessionid="9" thingid="9" z="-9.000000" y="0.000000" x="0.000000" ownerusername="admin"/><thing templateid="8" rz="0.000000" ry="0.000000" rx="0.000000" rw="1.000000" scalez="1.000000" displayname="Aluminum Chair" scaley="1.000000" templateowner="admin" scalex="1.000000" possessionid="10" thingid="10" z="-17.000000" y="0.000000" x="0.000000" ownerusername="admin"/><thing templateid="6" rz="0.000000" ry="0.479426" rx="0.000000" rw="0.877582" scalez="1.000000" displayname="Corner Sofa" scaley="1.000000" templateowner="admin" scalex="1.000000" possessionid="11" thingid="11" z="-17.000000" y="0.000000" x="-4.000000" ownerusername="admin"/><thing templateid="16" rz="0.000000" ry="0.681639" rx="0.000000" rw="0.731689" scalez="1.000000" displayname="Jacobsen Chair3107" scaley="1.000000" templateowner="admin" scalex="1.000000" possessionid="12" thingid="12" z="-14.000000" y="0.000000" x="-5.000000" ownerusername="admin"/></space>
\ No newline at end of file
Modified: maven/trunk/ogoglio-server/src/main/resources/populate/template-15/HillHouseChair.blend
===================================================================
(Binary files differ)
Modified: maven/trunk/ogoglio-server/src/main/resources/populate/template-15/HillHouseChair.obj
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/populate/template-15/HillHouseChair.obj 2007-10-19 17:15:31 UTC (rev 518)
+++ maven/trunk/ogoglio-server/src/main/resources/populate/template-15/HillHouseChair.obj 2007-10-19 22:09:21 UTC (rev 519)
@@ -2,1435 +2,1435 @@
# www.blender3d.org
mtllib HillHouseChair.mtl
o frame_Material_#39
-v -8.820000 2.800000 -0.700000
-v -0.316349 2.799963 -0.363283
-v -0.316349 2.865866 -0.363283
-v -0.316349 2.799963 -0.378398
-v -0.316349 2.865866 -0.378398
-v -0.316349 0.004264 -0.363283
-v -0.316349 0.070167 -0.363283
-v -0.316349 0.004264 -0.378399
-v -0.316349 0.070167 -0.378399
-v -0.316349 0.137393 -0.363283
-v -0.316349 0.203296 -0.363283
-v -0.316349 0.137393 -0.378399
-v -0.316349 0.203296 -0.378399
-v -0.316349 0.270522 -0.363283
-v -0.316349 0.336424 -0.363283
-v -0.316349 0.270522 -0.378399
-v -0.316349 0.336424 -0.378399
-v -0.316349 0.403650 -0.363283
-v -0.316349 0.469553 -0.363283
-v -0.316349 0.403650 -0.378399
-v -0.316349 0.469553 -0.378399
-v -0.316349 0.536779 -0.363283
-v -0.316349 0.602682 -0.363283
-v -0.316349 0.536779 -0.378399
-v -0.316349 0.602682 -0.378399
-v -0.316349 0.669907 -0.363283
-v -0.316349 0.735810 -0.363283
-v -0.316349 0.669907 -0.378399
-v -0.316349 0.735810 -0.378399
-v -0.316349 0.803036 -0.363283
-v -0.316349 0.868939 -0.363283
-v -0.316349 0.803036 -0.378399
-v -0.316349 0.868939 -0.378399
-v -0.316349 0.936164 -0.363283
-v -0.316349 1.002067 -0.363283
-v -0.316349 0.936164 -0.378399
-v -0.316349 1.002067 -0.378399
-v -0.316349 1.069293 -0.363283
-v -0.316349 1.135196 -0.363283
-v -0.316349 1.069293 -0.378399
-v -0.316349 1.135196 -0.378399
-v -0.316349 1.202421 -0.363283
-v -0.316349 1.268324 -0.363283
-v -0.316349 1.202421 -0.378399
-v -0.316349 1.268324 -0.378399
-v -0.316349 1.335550 -0.363283
-v -0.316349 1.401453 -0.363283
-v -0.316349 1.335550 -0.378399
-v -0.316349 1.401453 -0.378398
-v -0.316349 1.468678 -0.363283
-v -0.316349 1.534581 -0.363283
-v -0.316349 1.468678 -0.378398
-v -0.316349 1.534581 -0.378398
-v -0.316349 1.601807 -0.363283
-v -0.316349 1.667710 -0.363283
-v -0.316349 1.601807 -0.378398
-v -0.316349 1.667710 -0.378398
-v -0.316349 1.734935 -0.363283
-v -0.316349 1.800838 -0.363283
-v -0.316349 1.734935 -0.378398
-v -0.316349 1.800838 -0.378398
-v -0.316349 1.868064 -0.363283
-v -0.316349 1.933967 -0.363283
-v -0.316349 1.868064 -0.378398
-v -0.316349 1.933967 -0.378398
-v -0.316349 2.001192 -0.363283
-v -0.316349 2.067095 -0.363283
-v -0.316349 2.001192 -0.378398
-v -0.316349 2.067095 -0.378398
-v -0.316349 2.134321 -0.363283
-v -0.316349 2.200224 -0.363283
-v -0.316349 2.134321 -0.378398
-v -0.316349 2.200224 -0.378398
-v -0.316349 2.267449 -0.363283
-v -0.316349 2.333352 -0.363283
-v -0.316349 2.267449 -0.378398
-v -0.316349 2.333352 -0.378398
-v -0.316349 2.400578 -0.363283
-v -0.316349 2.466481 -0.363283
-v -0.316349 2.400578 -0.378398
-v -0.316349 2.466481 -0.378398
-v -0.316349 2.533706 -0.363283
-v -0.316349 2.599609 -0.363283
-v -0.316349 2.533706 -0.378398
-v -0.316349 2.599609 -0.378398
-v -0.316349 2.666835 -0.363283
-v -0.316349 2.732738 -0.363283
-v -0.316349 2.666835 -0.378398
-v -0.316349 2.732738 -0.378398
-v -0.316349 2.933092 -0.363283
-v -0.316349 2.998995 -0.363283
-v -0.316349 2.933092 -0.378398
-v -0.316349 2.998995 -0.378398
-v -0.316349 3.066221 -0.363283
-v -0.316349 3.132123 -0.363283
-v -0.316349 3.066221 -0.378398
-v -0.316349 3.132123 -0.378398
-v -0.424112 -0.030615 0.349412
-v -0.426888 -0.030615 0.339054
-v -0.434470 -0.030615 0.331471
-v -0.444829 -0.030615 0.328695
-v -0.455187 -0.030615 0.331471
-v -0.462770 -0.030615 0.339054
-v -0.465546 -0.030615 0.349412
-v -0.462770 -0.030615 0.359771
-v -0.455187 -0.030615 0.367354
-v -0.444829 -0.030615 0.370129
-v -0.434470 -0.030615 0.367354
-v -0.426888 -0.030615 0.359771
-v -0.424112 0.861191 0.349412
-v -0.426888 0.861191 0.339054
-v -0.434470 0.861191 0.331471
-v -0.444829 0.861191 0.328696
-v -0.455187 0.861191 0.331471
-v -0.462770 0.861191 0.339054
-v -0.465546 0.861191 0.349412
-v -0.462770 0.861191 0.359771
-v -0.455187 0.861191 0.367354
-v -0.444829 0.861191 0.370129
-v -0.434470 0.861191 0.367354
-v -0.426888 0.861191 0.352050
-v -0.424112 0.961367 0.349412
-v -0.426888 0.961367 0.339054
-v -0.434470 0.961367 0.331471
-v -0.444829 0.961367 0.328696
-v -0.455187 0.961367 0.331471
-v -0.462770 0.961367 0.339054
-v -0.465546 0.961367 0.349412
-v -0.462770 0.961367 0.359771
-v -0.455187 0.961367 0.367354
-v -0.444829 0.961367 0.370129
-v -0.434470 0.961367 0.367354
-v -0.426888 0.961367 0.352050
-v -0.323274 0.861191 -0.359568
-v -0.333633 0.861191 -0.359564
-v -0.343992 0.861191 -0.359568
-v -0.348737 0.961367 -0.359058
-v -0.338378 0.961367 -0.359055
-v -0.328020 0.961367 -0.359058
-v -0.435890 0.264134 0.368684
-v -0.435890 0.249399 0.357979
-v -0.435890 0.255028 0.340657
-v -0.435890 0.273241 0.340657
-v -0.435890 0.278869 0.357979
-v -0.439432 0.218242 0.354200
-v -0.443589 0.212439 0.353503
-v -0.450318 0.214656 0.352375
-v -0.450318 0.221829 0.352375
-v -0.443589 0.224045 0.353503
-v -0.320608 0.218242 -0.354492
-v -0.324766 0.212439 -0.355189
-v -0.331494 0.214656 -0.356317
-v -0.331494 0.221829 -0.356317
-v -0.324766 0.224046 -0.355189
-v -0.439432 0.316060 0.354200
-v -0.443589 0.310257 0.353503
-v -0.450318 0.312474 0.352375
-v -0.450318 0.319647 0.352375
-v -0.443589 0.321864 0.353503
-v -0.320608 0.316060 -0.354492
-v -0.324766 0.310257 -0.355189
-v -0.331494 0.312474 -0.356317
-v -0.331494 0.319647 -0.356317
-v -0.324766 0.321864 -0.355189
-v -0.302178 -0.030615 -0.371799
-v -0.323431 -0.030615 -0.401051
-v -0.357819 -0.030615 -0.389878
-v -0.357819 -0.030615 -0.353720
-v -0.323431 -0.030615 -0.342547
-v -0.302178 3.553614 -0.371799
-v -0.323431 3.553614 -0.401051
-v -0.357819 3.553614 -0.389877
-v -0.357819 3.553614 -0.353720
-v -0.323431 3.553614 -0.342546
-v 0.333612 2.799963 -0.363283
-v 0.333612 2.865866 -0.363283
-v 0.333612 2.799963 -0.378398
-v 0.333612 2.865866 -0.378398
-v 0.333612 0.004264 -0.363283
-v 0.333612 0.070167 -0.363283
-v 0.333612 0.004264 -0.378399
-v 0.333612 0.070167 -0.378399
-v 0.333612 0.137393 -0.363283
-v 0.333612 0.203296 -0.363283
-v 0.333612 0.137393 -0.378399
-v 0.333612 0.203296 -0.378399
-v 0.333612 0.270522 -0.363283
-v 0.333612 0.336424 -0.363283
-v 0.333612 0.270522 -0.378399
-v 0.333612 0.336424 -0.378399
-v 0.333612 0.403650 -0.363283
-v 0.333612 0.469553 -0.363283
-v 0.333612 0.403650 -0.378399
-v 0.333612 0.469553 -0.378399
-v 0.333612 0.536779 -0.363283
-v 0.333612 0.602682 -0.363283
-v 0.333612 0.536779 -0.378399
-v 0.333612 0.602682 -0.378399
-v 0.333612 0.669907 -0.363283
-v 0.333612 0.735810 -0.363283
-v 0.333612 0.669907 -0.378399
-v 0.333612 0.735810 -0.378399
-v 0.333612 0.803036 -0.363283
-v 0.333612 0.868939 -0.363283
-v 0.333612 0.803036 -0.378399
-v 0.333612 0.868939 -0.378399
-v 0.333612 0.936164 -0.363283
-v 0.333612 1.002067 -0.363283
-v 0.333612 0.936164 -0.378399
-v 0.333612 1.002067 -0.378399
-v 0.333612 1.069293 -0.363283
-v 0.333612 1.135196 -0.363283
-v 0.333612 1.069293 -0.378399
-v 0.333612 1.135196 -0.378399
-v 0.333612 1.202421 -0.363283
-v 0.333612 1.268324 -0.363283
-v 0.333612 1.202421 -0.378399
-v 0.333612 1.268324 -0.378399
-v 0.333612 1.335550 -0.363283
-v 0.333612 1.401453 -0.363283
-v 0.333612 1.335550 -0.378399
-v 0.333612 1.401453 -0.378398
-v 0.333612 1.468678 -0.363283
-v 0.333612 1.534581 -0.363283
-v 0.333612 1.468678 -0.378398
-v 0.333612 1.534581 -0.378398
-v 0.333612 1.601807 -0.363283
-v 0.333612 1.667710 -0.363283
-v 0.333612 1.601807 -0.378398
-v 0.333612 1.667710 -0.378398
-v 0.333612 1.734935 -0.363283
-v 0.333612 1.800838 -0.363283
-v 0.333612 1.734935 -0.378398
-v 0.333612 1.800838 -0.378398
-v 0.333612 1.868064 -0.363283
-v 0.333612 1.933967 -0.363283
-v 0.333612 1.868064 -0.378398
-v 0.333612 1.933967 -0.378398
-v 0.333612 2.001192 -0.363283
-v 0.333612 2.067095 -0.363283
-v 0.333612 2.001192 -0.378398
-v 0.333612 2.067095 -0.378398
-v 0.333612 2.134321 -0.363283
-v 0.333612 2.200224 -0.363283
-v 0.333612 2.134321 -0.378398
-v 0.333612 2.200224 -0.378398
-v 0.333612 2.267449 -0.363283
-v 0.333612 2.333352 -0.363283
-v 0.333612 2.267449 -0.378398
-v 0.333612 2.333352 -0.378398
-v 0.333612 2.400578 -0.363283
-v 0.333612 2.466481 -0.363283
-v 0.333612 2.400578 -0.378398
-v 0.333612 2.466481 -0.378398
-v 0....
[truncated message content] |
|
From: <tre...@us...> - 2007-10-22 20:34:39
|
Revision: 538
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=538&view=rev
Author: trevorolio
Date: 2007-10-22 13:34:44 -0700 (Mon, 22 Oct 2007)
Log Message:
-----------
Now guests can enter a display name, so we can finally get "Guest Gandalfs" at every event.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AuthServlet.java
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AuthServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AuthServlet.java 2007-10-22 20:34:39 UTC (rev 537)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AuthServlet.java 2007-10-22 20:34:44 UTC (rev 538)
@@ -227,7 +227,8 @@
}
public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
- String cookie = generateGuestCookie();
+ String requestedGuestNameParameter = request.getParameter(WebConstants.REQUESTED_GUEST_NAME_PARAMETER);
+ String cookie = generateGuestCookie(requestedGuestNameParameter);
Cookie newCookie = new Cookie(WebConstants.AUTH_COOKIE, cookie);
newCookie.setPath("/");
newCookie.setMaxAge(-1);
@@ -243,17 +244,46 @@
public static final String COOKIE_CHARS = "abcdefghijklmnopqrstuvwxyz1234567890";
- public static final String[] GUEST_NAMES = { "Moon", "Spoon", "Plume", "Bloom", "Thyme", "Rhyme", "Steel", "Boat", "Vase", "Book", "Screen", "Fenestra", "Farmer", "Door", "Squid", "Rocket", "Picker", "Page", "Lawn", "Food", "Plate", "Bean", "Horse", "Cat", "Fireplace", "Frame", "Chair", "Table", "Sofa", "Stair", "Counter", "Shelf", "Phone", "Robot", "Tree", "Key" };
+ public static final String[] GUEST_NAMES = { "Moon", "Spoon", "Plume", "Bloom", "Thyme", "Rhyme", "Steel", "Boat", "Vase", "Book", "Screen", "Fenestra", "Farmer", "Door", "Squid", "Rocket", "Picker", "Page", "Lawn", "Food", "Plate", "Bean", "Horse", "Cat", "Fireplace", "Frame", "Chair", "Table", "Sofa", "Stair", "Counter", "Shelf", "Phone", "Robot", "Tree", "Key", "Pony"};
- private String generateGuestCookie() {
+ private String generateGuestCookie(String requestedGuestName) {
StringBuffer result = new StringBuffer();
result.append(WebConstants.GUEST_COOKIE_PREFIX);
for (int i = 0; i < 3; i++) {
result.append("_" + GUEST_NAMES[Math.abs(random.nextInt()) % GUEST_NAMES.length]);
}
+ String cleanedGuestName = cleanGuestName(requestedGuestName);
+ if(cleanedGuestName != null){
+ result.append("_" + cleanedGuestName);
+ }
return result.toString();
}
+ private String cleanGuestName(String requestedGuestName) {
+ if(requestedGuestName == null){
+ return null;
+ }
+ requestedGuestName = requestedGuestName.trim();
+ StringBuffer result = new StringBuffer();
+
+ int numNonWhitespace = 0;
+ for (int i = 0; i < requestedGuestName.length(); i++) {
+ if(Character.isDigit(requestedGuestName.charAt(i))){
+ numNonWhitespace++;
+ result.append(requestedGuestName.charAt(i));
+ } else if(Character.isLetter(requestedGuestName.charAt(i))){
+ result.append(requestedGuestName.charAt(i));
+ numNonWhitespace++;
+ } else if(Character.isWhitespace(requestedGuestName.charAt(i))){
+ result.append("_");
+ }
+ }
+ if(numNonWhitespace == 0){
+ return null;
+ }
+ return result.toString();
+ }
+
private String generateAuthCookie(boolean guest) {
StringBuffer result = new StringBuffer(14);
if (guest) {
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2007-10-22 20:34:39 UTC (rev 537)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2007-10-22 20:34:44 UTC (rev 538)
@@ -1,5 +1,7 @@
var appPath = "/og"; //do not put a slash on the end
var loginCookieName = "loginCookie";
+var guestCookiePrefix = "guest_";
+var guestDisplayNamePrefix = "Guest ";
function getServiceURI(){
var locLink = document.location;
@@ -454,12 +456,33 @@
new XMLRequestManager(appPath + "/auth/me", new BasicHTTPListener(listener)).send();
}
-function requestGuestCookie(listener){
- var manager = new XMLRequestManager(appPath + "/auth/guest", new BasicHTTPListener(listener));
+function requestGuestCookie(suggestedGuestName, listener){
+ var guestNameParameter = ""
+ if(suggestedGuestName != null && suggestedGuestName.length > 0){
+ guestNameParameter = "?requestedGuestName=" + escape(suggestedGuestName);
+ }
+ var manager = new XMLRequestManager(appPath + "/auth/guest" + guestNameParameter, new BasicHTTPListener(listener));
manager.setMethod("POST");
manager.send();
}
+// there are always at least three random tokens separated by _ after "guest_"
+// a guest cookie which looks like guest_Moon_Unit_Zappa will return like so "Guest Moon Unit Zappa"
+// if there are more than three (as when a user suggests a guest name) the tokens > 3 will be used
+// a guest cookie which looks like guest_Moon_Unit_Zappa_Kurt_Vonnegut will return like so "Guest Kurt Vonnegut"
+function convertGuestCookieToDisplayName(guestCookie){
+ if(guestCookie == null || guestCookie.indexOf(guestCookiePrefix) != 0){
+ return null;
+ }
+ var username = guestDisplayNamePrefix;
+ var tokens = guestCookie.substring(6).split("_");
+ var startIndex = tokens.length > 3 ? 3 : 0;
+ for(var i=startIndex; i < tokens.length; i++){
+ username += " " + tokens[i];
+ }
+ return username;
+}
+
// BEGIN ACCOUNT UTILS
function createAccount(username, email, password, listener){
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2007-10-22 20:34:39 UTC (rev 537)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2007-10-22 20:34:44 UTC (rev 538)
@@ -21,13 +21,22 @@
var allowsGuests = parseInt(xml.getAttribute("maxguests")) > 0;
if(authedUsername == null){
if(allowsGuests && typeof autoGuest != "undefined" && autoGuest){
- if(getLoginCookie() != null && getLoginCookie().indexOf("guest_") == 0){
+ if(getLoginCookie() != null && getLoginCookie().indexOf(guestCookiePrefix) == 0){
enterTheSpace();
return;
}
- enterAsGuest();
+ enterAsGuest(null);
} else if(allowsGuests){
- spaceDiv.innerHTML = "<div style='width: 100%; text-align: center; margin-top: 20px; font-weight: bold; color: #000;'>Would you like to <a href='signin.html'>sign in</a> or <a href='space.html' onclick='enterAsGuest(); return false;'>enter as a guest</a>?";
+ var guestMessage = "<div style='width: 100%; text-align: center; margin-top: 20px; font-weight: bold; color: #000;'>";
+ guestMessage += "<a href='signin.html'>Click here to login</a>";
+ guestMessage += "<h1>or</h1>";
+ guestMessage += "Enter a name: ";
+ guestMessage += "<form action='index.html' onsubmit='enterAsGuest(this.guestNameInput.value); return false;'>";
+ guestMessage += "<input type='text' name='guestNameInput' id='guestNameInput' size='12' />";
+ guestMessage += "<input type='submit' value='enter as a guest' />";
+ guestMessage += "</form>";
+ guestMessage += "</div>";
+ spaceDiv.innerHTML = guestMessage;
} else {
spaceDiv.innerHTML = "You must <a href='signin.html'>sign in</a> to enter this space." ;
}
@@ -36,8 +45,8 @@
}
}
-function enterAsGuest(){
- requestGuestCookie(guestCookieHandler);
+function enterAsGuest(guestNameInput){
+ requestGuestCookie(guestNameInput, guestCookieHandler);
}
function guestCookieHandler(guestCookie){
@@ -127,12 +136,10 @@
var text = null;
if(message.indexOf(":") != -1){
username = message.substring(0, message.indexOf(":"));
- if(username.indexOf("guest_") == 0){
- username = "Guest " + username.substring(6);
- while(username.indexOf('_') != -1){
- username = username.substring(0, username.indexOf('_')) + " " + username.substring(username.indexOf('_') + 1);
- }
+ if(username.indexOf(guestCookiePrefix) == 0){
+ username = convertGuestCookieToDisplayName(username);
}
+
text = message.substring(message.indexOf(":") + 1);
} else {
username = "system";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-30 00:18:26
|
Revision: 546
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=546&view=rev
Author: trevorolio
Date: 2007-10-29 17:18:29 -0700 (Mon, 29 Oct 2007)
Log Message:
-----------
Updated the body editor so that you can choose a new body configuration and choose which body data to use as the base.
Still need to add the ability to add a body configuration.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
Added Paths:
-----------
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.css
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.js
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java 2007-10-30 00:18:24 UTC (rev 545)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java 2007-10-30 00:18:29 UTC (rev 546)
@@ -71,6 +71,21 @@
}
}
}
+
+ if(document.getBodyConfigurationID() != -1 && document.getBodyConfigurationID() != record.getDefaultBodyConfigurationID()){
+ Query bodyConfigQuery = hibernateSession.getNamedQuery(BodyPersistTasks.BODY_CONFIGURATION_BY_ID);
+ bodyConfigQuery.setLong("bodyConfigurationID", document.getBodyConfigurationID());
+ BodyConfigurationRecord bodyConfigRecord = (BodyConfigurationRecord)bodyConfigQuery.uniqueResult();
+ if(bodyConfigRecord == null){
+ return Boolean.FALSE;
+ }
+ if(!record.getUsername().equals(bodyConfigRecord.getOwnerUsername())){
+ return Boolean.FALSE;
+ }
+ dirty = true;
+ record.setDefaultBodyConfigurationID(document.getBodyConfigurationID());
+ }
+
if (dirty) {
hibernateSession.update(record);
return Boolean.TRUE;
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2007-10-30 00:18:24 UTC (rev 545)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2007-10-30 00:18:29 UTC (rev 546)
@@ -84,9 +84,9 @@
AccountDocument result = null;
if (authed) {
- result = new AccountDocument(account.getUsername(), account.getAccountlevel(), account.getFirstName(), account.getLastName(), account.getHomepage(), null, account.getEmail(), account.getCreationDate(), null, account.getFrozenUntil());
+ result = new AccountDocument(account.getUsername(), account.getAccountlevel(), account.getFirstName(), account.getLastName(), account.getHomepage(), null, account.getEmail(), account.getCreationDate(), null, account.getFrozenUntil(), account.getDefaultBodyConfigurationID());
} else {
- result = new AccountDocument(account.getUsername(), null, null, null, null, null, null, account.getCreationDate(), null, account.getFrozenUntil());
+ result = new AccountDocument(account.getUsername(), null, null, null, null, null, null, account.getCreationDate(), null, account.getFrozenUntil(), -1);
}
return result;
}
Added: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.css
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.css (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.css 2007-10-30 00:18:29 UTC (rev 546)
@@ -0,0 +1,62 @@
+#appletDiv {
+ width: 300px;
+ height: 400px;
+ position: absolute;
+ top: 20px;
+ left: 205px;
+}
+
+#leftControlDiv {
+ position: absolute;
+ top: 25px;
+ left: 0px;
+ width: 200px;
+ height: 400px;
+ overflow: auto;
+ visibility: hidden;
+}
+
+#rightControlDiv {
+ position: absolute;
+ top: 25px;
+ left: 510px;
+ width: 200px;
+ height: 400px;
+ visibility: hidden;
+}
+
+#topControlDiv {
+ position: absolute;
+ top: 0px;
+ left: 25px;
+ height: 20px;
+ width: 100%;
+ text-align: center;
+ visibility: hidden;
+}
+
+#topControlDiv form {
+ display: inline;
+}
+
+#bottomControlDiv {
+ position: absolute;
+ top: 435px;
+ left: 0px;
+ height: 30px;
+ width: 100%;
+ visibility: hidden;
+}
+
+#morphControls form {
+ display: inline;
+}
+
+#animationControls form input {
+ margin-bottom: 5px;
+ width: 75px;
+}
+
+#textureForm {
+ margin-top: 25px;
+}
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html 2007-10-30 00:18:24 UTC (rev 545)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html 2007-10-30 00:18:29 UTC (rev 546)
@@ -4,8 +4,11 @@
<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript" src="/og/ogoglio.js"></script>
<script type="text/javascript" src="site.js"></script>
-<script type="text/javascript" src="webtoolkit.aim.js"></script>
+<script type="text/javascript" src="/og/webtoolkit.aim.js"></script>
+<script type="text/javascript" src="/og/body.js"></script>
+<link rel="stylesheet" href="/og/body.css" type="text/css" />
+
<title>Ogoglio Example: body</title>
<style type="text/css">
#main {
@@ -13,7 +16,7 @@
position: relative;
top: 0px;
left: 0px;
- height: 430px;
+ height: 465px;
overflow: hidden;
width: 730px;
}
@@ -29,244 +32,19 @@
margin: 10px 0px 10px 0px;
}
-#appletDiv {
- width: 300px;
- height: 400px;
- position: absolute;
- top: 0px;
- left: 205px;
-}
-#leftControlDiv {
- position: absolute;
- top: 0px;
- left: 0px;
- width: 200px;
- height: 400px;
- overflow: auto;
-}
-
-#rightControlDiv {
- position: absolute;
- top: 0px;
- left: 510px;
- width: 200px;
- height: 400px;
-}
-
-#morphControls form {
- display: inline;
-}
-
-#animationControls form input {
- margin-bottom: 5px;
- width: 75px;
-}
-
-#textureForm {
- margin-top: 25px;
-}
-
</style>
<script type="text/javascript">
-var loginCookie = getLoginCookie();
-
var titleElement = null;
var mainElement = null;
-var titleElement = null;
-var appletDiv = null;
-var leftControlDiv = null;
-var rightControlDiv = null;
-var bottomControlDiv = null;
-var textureSelectionDiv = null;
-var textureForm = null;
-var morphControls = null;
-var animationControls = null;
-var bodyXML = null;
-
-function handleAuth(){
- if(loginCookie == null){
- mainElement.innerHTML = "<h2>Please sign in to use this page.</h2>";
- return;
- }
-
- if(authedUsername == null){
- mainElement.innerHTML = "<h2>Please log in.</h2>";
- return;
- }
- writeApplet();
- requestDefaultBodyDocument(authedUsername, handleBodyConfiguration);
-}
-
-function handleBodyConfiguration(xml){
- if(xml == null){
- bottomControlDiv.innerHTML = "";
- return;
- }
- bodyXML = xml;
- var bodyConfigurationID = +bodyXML.getAttribute("bodyconfigurationid");
- var ownerUsername = bodyXML.getAttribute("ownerusername");
-
- textureForm.action = appPath + "/account/" + ownerUsername + "/body/" + bodyConfigurationID + "/texture";
-
- setTimeout("awaitInitialLoad();", 1000);
-}
-
-function awaitInitialLoad(){
- var editor = document.getElementById("viewer");
- if(editor != null && editor.completedInitialLoad()){
- initControls();
- return;
- }
- setTimeout("awaitInitialLoad();", 500);
-}
-
-function initControls(){
- var editor = document.getElementById("viewer");
- var morphNames = editor.getMorphNames();
- var morphHTML = "";
- for(var i = morphNames.length - 1; i >= 0; i--){
- var settingValue = editor.getMorphSetting(morphNames[i]);
- morphHTML += "<h4>" + morphNames[i] + ":</h4>";
- morphHTML += "<form onsubmit='changeMorph(\"" + morphNames[i] + "\", 0.1);return false;'><input type='submit' value='+' name='" + morphNames[i] + "'></form>";
- morphHTML += " <span id='" + morphNames[i] + " setting'>" + formatSettingValue(settingValue) + "</span> ";
- morphHTML += "<form onsubmit='changeMorph(\"" + morphNames[i] + "\", -0.1);return false;'><input type='submit' value='-' name='" + morphNames[i] + "'></form>";
- }
- morphControls.innerHTML = morphHTML;
-
- var animationNames = editor.getAnimationNames();
- var animationHTML = "";
- for(var i = 0; i < animationNames.length; i++){
- if(animationNames[i] == "default"){
- continue;
- }
- animationHTML += "<form onsubmit='playAnimation(\"" + animationNames[i] + "\"); return false;'><input type='submit' value='" + animationNames[i] + "'/></form>";
- }
- animationControls.innerHTML = animationHTML;
-
- var textureNames = editor.getBaseTextureNames();
- var baseTextureName = bodyXML.getAttribute("basetexturename");
-
- var textureHTML = "<form id='textureSelectForm' action='body.html' method='get' onsubmit='return false;'>";
- textureHTML += "<select id='textureSelect' onchange='textureSelectGo();' name='textureSelect'>";
- if(baseTextureName == null){
- textureHTML += "<option selected='selected' value='Default'>Default</option>";
- } else {
- textureHTML += "<option value='Default'>Default</option>";
- }
- for(var i=0; i < textureNames.length; i++){
- var selectedText = textureNames[i] == baseTextureName ? "selected='selected'" : "";
- textureHTML += "<option " + selectedText + " value='" + textureNames[i] + "'>" + textureNames[i] + "</option>";
- }
- textureHTML += "</select></form>";
- textureSelectionDiv.innerHTML = textureHTML;
-}
-
-function textureSelectGo(){
- var textureSelectForm = document.getElementById("textureSelectForm");
- var selectedTextureName = textureSelectForm.textureSelect.options[textureSelectForm.textureSelect.selectedIndex].value;
- var currentTextureName = bodyXML.getAttribute("basetexturename");
- if(currentTextureName == selectedTextureName || (currentTextureName == null && selectedTextureName == "Default")){
- return;
- }
- var editor = document.getElementById("viewer");
- if(selectedTextureName == "Default"){
- editor.setBaseTexture(null);
- } else {
- editor.setBaseTexture(selectedTextureName);
- }
- requestDefaultBodyDocument(authedUsername, handleBodyConfiguration);
- return true;
-}
-
-function startedTextureForm() {
- return true;
-}
-
-function completedTextureForm(response) {
- repaintTexture();
-}
-
-function handleTextureForm(){
- AIM.submit(textureForm, {'onStart' : startedTextureForm, 'onComplete' : completedTextureForm})
- return true;
-}
-
-function textureDeleteGo(){
- if(bodyXML == null){
- return;
- }
- deleteBodyTexture(authedUsername, bodyXML.getAttribute("bodyconfigurationid"), handleTextureDelete);
-}
-
-function handleTextureDelete(){
- repaintTexture();
-}
-
-function repaintTexture(){
- var ogViewer = document.getElementById("viewer");
- ogViewer.updateTextures();
-}
-
-function playAnimation(animationName){
- var editor = document.getElementById("viewer");
- editor.playAnimation(animationName);
-}
-
-function changeMorph(morphName, delta){
- var editor = document.getElementById("viewer");
- var settingValue = editor.getMorphSetting(morphName) + delta;
- if(settingValue < 0) settingValue = 0;
- if(settingValue > 1) settingValue = 1;
- editor.setMorphSetting(morphName, settingValue);
- var settingSpan = document.getElementById(morphName + " setting");
- settingSpan.innerHTML = formatSettingValue(settingValue);
-}
-
-function formatSettingValue(settingValue){
- return settingValue.toPrecision(2);
-}
-
-function writeApplet(){
- if(loginCookie == null){
- appletDiv.innerHTML = "No cookie. Please sign in or register as a guest.";
- return;
- }
- var serviceURI = getServiceURI();
- var html = "<applet id='viewer' codebase='" + serviceURI + "' code='com.ogoglio.bodyeditor.BodyEditorApplet' archive='ogoglio-common.jar,ogoglio-body-editor-applet.jar' width='300' height='400' mayscript='true'>";
- html += "<param name='loginCookie' value='" + loginCookie + "' />";
- html += "<param name='serviceURI' value='" + getServiceURI() + "' />";
- html += "<param name='image' value='" + appPath + "/icons/32x32/face-monkey.png' />";
- html += "</applet>";
-
- appletDiv.innerHTML = html;
-}
-
-function doSave(){
- var editor = document.getElementById("viewer");
- if(editor == null){
- return;
- }
- editor.saveBodyConfiguration();
-}
-
function init(){
- populateMemberMenuItem();
-
titleElement = document.getElementById("title");
mainElement = document.getElementById("main");
- appletDiv = document.getElementById("appletDiv");
- leftControlDiv = document.getElementById("leftControlDiv");
- rightControlDiv = document.getElementById("rightControlDiv");
- bottomControlDiv = document.getElementById("bottomControlDiv");
- textureSelectionDiv = document.getElementById("textureSelectionDiv");
- textureForm = document.getElementById("textureForm");
- morphControls = document.getElementById("morphControls");
- animationControls = document.getElementById("animationControls");
- addAuthListeners(handleAuth, handleAuth);
+ populateMemberMenuItem();
+ initBodyEditor();
}
</script>
</head>
@@ -283,6 +61,10 @@
<h2 id="title">Body Editor:</h2>
<div id="main">
+ <div id="topControlDiv">
+ <span id="bodyListControl"> </span>
+ <span id="bodyDataControl"> </span>
+ </div>
<div id="leftControlDiv">
<div id="morphControls"> </div>
</div>
@@ -296,16 +78,17 @@
<input type="submit" value="upload custom skin" />
</form>
<form id="textureDeleteForm" onsubmit="textureDeleteGo(); return false;"><input type="submit" value="delete custom skin"/></form>
- <iframe id="textureTargetFrame" name="textureTargetFrame" style="width: 1px; height: 1px;"></iframe>
-
+ <iframe id="textureTargetFrame" name="textureTargetFrame" style="width: 1px; height: 1px;"></iframe>
</div>
+
<div id="appletDiv"> </div>
+
+ <div id="bottomControlDiv" style="text-align: center;">
+ <form onsubmit="doSave(); return false"><input type="submit" value="save" /></form>
+ </div>
</div> <!-- end main -->
-<div id="bottomControlDiv" style="text-align: center;">
- <form onsubmit="doSave(); return false"><input type="submit" value="save" /></form>
-</div>
<div id="footer">
Added: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.js (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.js 2007-10-30 00:18:29 UTC (rev 546)
@@ -0,0 +1,310 @@
+var loginCookie = getLoginCookie();
+
+var appletDiv = null;
+var leftControlDiv = null;
+var rightControlDiv = null;
+var bottomControlDiv = null;
+var topControlDiv = null;
+var textureSelectionDiv = null;
+var textureForm = null;
+var morphControls = null;
+var animationControls = null;
+var bodyListControl = null;
+var bodyDataControl = null;
+
+var bodyXML = null;
+var bodyListXML = null;
+var bodyDataListXML = null
+
+function handleBodyAuth(){
+ if(loginCookie == null){
+ appletDiv.innerHTML = "<h2>Please log in to use this page.</h2>";
+ return;
+ }
+
+ if(authedUsername == null){
+ appletDiv.innerHTML = "<h2>Please log in.</h2>";
+ return;
+ }
+ writeApplet();
+ requestDefaultBodyDocument(authedUsername, handleBody);
+}
+
+function stopAndDisplayError(errorMessage){
+ topControlDiv.innerHTML = "";
+ leftControlDiv.innerHTML = "";
+ rightControlDiv.innerHTML = "";
+ bottomControlDiv.innerHTML = "";
+ centerControlDiv.innerHTML = errorMessage;
+}
+
+function handleBody(xml){
+ if(xml == null){
+ stopAndDisplayError("<h1>Could not load the body editor.</h1>");
+ return;
+ }
+ bodyXML = xml;
+ requestBodyList(authedUsername, handleBodyList);
+}
+
+function handleBodyList(xml){
+ if(xml == null){
+ stopAndDisplayError("Could not load body list");
+ return;
+ }
+ bodyListXML = xml;
+
+ requestBodyDataList(handleBodyDataList);
+}
+
+function handleBodyDataList(xml){
+ if(xml == null){
+ stopAndDisplayError("Could not load body data list");
+ return;
+ }
+ bodyDataListXML = xml;
+
+ setTimeout("awaitInitialLoad();", 1000);
+}
+
+function awaitInitialLoad(){
+ var editor = document.getElementById("viewer");
+ if(editor != null && editor.completedInitialLoad()){
+ initControls();
+ return;
+ }
+ setTimeout("awaitInitialLoad();", 500);
+}
+
+function initControls(){
+ var editor = document.getElementById("viewer");
+ var morphNames = editor.getMorphNames();
+ var textureNames = editor.getBaseTextureNames();
+ var baseTextureName = bodyXML.getAttribute("basetexturename");
+ var defaultBodyID = +bodyXML.getAttribute("bodyconfigurationid");
+ var ownerUsername = bodyXML.getAttribute("ownerusername");
+
+ var morphHTML = "";
+ for(var i = morphNames.length - 1; i >= 0; i--){
+ var settingValue = editor.getMorphSetting(morphNames[i]);
+ morphHTML += "<h4>" + morphNames[i] + ":</h4>";
+ morphHTML += "<form onsubmit='changeMorph(\"" + morphNames[i] + "\", 0.1);return false;'><input type='submit' value='+' name='" + morphNames[i] + "'></form>";
+ morphHTML += " <span id='" + morphNames[i] + " setting'>" + formatSettingValue(settingValue) + "</span> ";
+ morphHTML += "<form onsubmit='changeMorph(\"" + morphNames[i] + "\", -0.1);return false;'><input type='submit' value='-' name='" + morphNames[i] + "'></form>";
+ }
+ morphControls.innerHTML = morphHTML;
+
+ var animationNames = editor.getAnimationNames();
+ var animationHTML = "";
+ for(var i = 0; i < animationNames.length; i++){
+ if(animationNames[i] == "default"){
+ continue;
+ }
+ animationHTML += "<form onsubmit='playAnimation(\"" + animationNames[i] + "\"); return false;'><input type='submit' value='" + animationNames[i] + "'/></form>";
+ }
+ animationControls.innerHTML = animationHTML;
+
+ var textureHTML = "<form id='textureSelectForm' action='body.html' method='get' onsubmit='return false;'>";
+ textureHTML += "<select id='textureSelect' onchange='textureSelectGo();' name='textureSelect'>";
+ if(baseTextureName == null){
+ textureHTML += "<option selected='selected' value='Default'>Default</option>";
+ } else {
+ textureHTML += "<option value='Default'>Default</option>";
+ }
+ for(var i=0; i < textureNames.length; i++){
+ var selectedText = textureNames[i] == baseTextureName ? "selected='selected'" : "";
+ textureHTML += "<option " + selectedText + " value='" + textureNames[i] + "'>" + textureNames[i] + "</option>";
+ }
+ textureHTML += "</select></form>";
+ textureSelectionDiv.innerHTML = textureHTML;
+
+ textureForm.action = appPath + "/account/" + ownerUsername + "/body/" + defaultBodyID + "/texture";
+
+ var bodySwitcherHTML = "<form id='bodySwitcherForm' action='body.html' method='get' onsubmit='return false;'>";
+ bodySwitcherHTML += "<select id='bodySwitcher' onchange='bodySwitcherGo();' name='bodySwitcher'>";
+ for(var i=0; i < bodyListXML.childNodes.length; i++){
+ var displayName = bodyListXML.childNodes[i].getAttribute("displayname");
+ var bodyConfigurationID = bodyListXML.childNodes[i].getAttribute("bodyconfigurationid");
+ var selected = bodyListXML.childNodes[i].getAttribute("bodyconfigurationid") == bodyXML.getAttribute("bodyconfigurationid");
+ var selectedText = selected ? " selected='selected'" : "";
+ bodySwitcherHTML += "<option " + selectedText + " value='" + bodyConfigurationID + "'>" + escapeHTML(displayName) + "</option>";
+ }
+ bodySwitcherHTML += "<option value='newBody'>New Body...</option>";
+ if(bodyListXML.childNodes.length > 1){
+ bodySwitcherHTML += "<option value='deleteBody'>Delete This Body...</option>";
+ }
+ bodySwitcherHTML += "</select></form>";
+ bodyListControl.innerHTML = bodySwitcherHTML;
+
+ var bodyDataHTML = "<form id='bodyDataForm' action='body.html' method='get' onsubmit='return false;'>";
+ bodyDataHTML += "<select id='bodyDataSelect' name='bodyDataSelect' onchange='bodyDataSelectGo();'>";
+ for(var i=0; i < bodyDataListXML.childNodes.length; i++){
+ var displayName = bodyDataListXML.childNodes[i].getAttribute("displayname");
+ var bodyDataID = bodyDataListXML.childNodes[i].getAttribute("bodydataid");
+ var selected = bodyXML.getAttribute("bodydataid") == bodyDataID;
+ var selectedText = selected ? " selected='selected'" : "";
+ bodyDataHTML += "<option " + selectedText + " value='" + bodyDataID + "'>" + escapeHTML(displayName) + "</option>";
+ }
+ bodyDataHTML += "</select>";
+ bodyDataHTML += "</form>";
+ bodyDataControl.innerHTML = bodyDataHTML;
+
+ topControlDiv.style.visibility = "visible";
+ bottomControlDiv.style.visibility = "visible";
+ leftControlDiv.style.visibility = "visible";
+ rightControlDiv.style.visibility = "visible";
+}
+
+function bodyDataSelectGo(){
+ var editor = document.getElementById("viewer");
+ var form = document.getElementById("bodyDataForm");
+ var selectedValue = +(form.bodyDataSelect.options[form.bodyDataSelect.selectedIndex].value);
+ var currentBodyDataID = +bodyXML.getAttribute("bodydataid");
+ if(selectedValue == currentBodyDataID){
+ alert("no change");
+ return;
+ }
+ editor.setBodyData(selectedValue);
+ requestBodyDocument(authedUsername, bodyXML.getAttribute("bodyconfigurationid"), handleBody);
+ return true;
+}
+
+function bodySwitcherGo(){
+ var editor = document.getElementById("viewer");
+ var form = document.getElementById("bodySwitcherForm");
+ var selectedValue = form.bodySwitcher.options[form.bodySwitcher.selectedIndex].value;
+ if(selectedValue == "newBody"){
+ alert("Show new body dialog");
+ return false;
+ } else if(selectedValue == "deleteBody"){
+ var answer = confirm("Really Delete This Body?");
+ if(!answer){
+ return false;
+ }
+ var currentDefaultBodyID = bodyXML.getAttribute("bodyconfigurationid");
+ var newDefaultBodyID = bodyListXML.childNodes[0].getAttribute("bodyconfigurationid");
+ if(newDefaultBodyID == currentDefaultBodyID){
+ newDefaultBodyID = bodyListXML.childNodes[1].getAttribute("bodyconfigurationid");
+ }
+ editor.setDefaultBodyConfiguration(+(newDefaultBodyID));
+ deleteBody(authedUsername, currentDefaultBodyID, handleBodyDeletion);
+ requestDefaultBodyDocument(authedUsername, handleBody);
+ return true;
+ }
+ var currentBodyConfigID = bodyXML.getAttribute("bodyconfigurationid");
+ if(selectedValue == currentBodyConfigID){
+ return true;
+ }
+ editor.setDefaultBodyConfiguration(+(selectedValue));
+ requestBodyDocument(authedUsername, selectedValue, handleBody);
+
+ return true;
+}
+
+function handleBodyDeletion(text){
+ requestDefaultBodyDocument(authedUsername, handleBody);
+}
+
+function textureSelectGo(){
+ var textureSelectForm = document.getElementById("textureSelectForm");
+ var selectedTextureName = textureSelectForm.textureSelect.options[textureSelectForm.textureSelect.selectedIndex].value;
+ var currentTextureName = bodyXML.getAttribute("basetexturename");
+ if(currentTextureName == selectedTextureName || (currentTextureName == null && selectedTextureName == "Default")){
+ return;
+ }
+ var editor = document.getElementById("viewer");
+ if(selectedTextureName == "Default"){
+ editor.setBaseTexture(null);
+ } else {
+ editor.setBaseTexture(selectedTextureName);
+ }
+ requestDefaultBodyDocument(authedUsername, handleBody);
+ return true;
+}
+
+function startedTextureForm() {
+ return true;
+}
+
+function completedTextureForm(response) {
+ repaintTexture();
+}
+
+function handleTextureForm(){
+ AIM.submit(textureForm, {'onStart' : startedTextureForm, 'onComplete' : completedTextureForm})
+ return true;
+}
+
+function textureDeleteGo(){
+ if(bodyXML == null){
+ return;
+ }
+ deleteBodyTexture(authedUsername, bodyXML.getAttribute("bodyconfigurationid"), handleTextureDelete);
+}
+
+function handleTextureDelete(){
+ repaintTexture();
+}
+
+function repaintTexture(){
+ var ogViewer = document.getElementById("viewer");
+ ogViewer.updateTextures();
+}
+
+function playAnimation(animationName){
+ var editor = document.getElementById("viewer");
+ editor.playAnimation(animationName);
+}
+
+function changeMorph(morphName, delta){
+ var editor = document.getElementById("viewer");
+ var settingValue = editor.getMorphSetting(morphName) + delta;
+ if(settingValue < 0) settingValue = 0;
+ if(settingValue > 1) settingValue = 1;
+ editor.setMorphSetting(morphName, settingValue);
+ var settingSpan = document.getElementById(morphName + " setting");
+ settingSpan.innerHTML = formatSettingValue(settingValue);
+}
+
+function formatSettingValue(settingValue){
+ return settingValue.toPrecision(2);
+}
+
+function writeApplet(){
+ if(loginCookie == null){
+ appletDiv.innerHTML = "No cookie. Please sign in or register as a guest.";
+ return;
+ }
+ var serviceURI = getServiceURI();
+ var html = "<applet id='viewer' codebase='" + serviceURI + "' code='com.ogoglio.bodyeditor.BodyEditorApplet' archive='ogoglio-common.jar,ogoglio-body-editor-applet.jar' width='300' height='400' mayscript='true'>";
+ html += "<param name='loginCookie' value='" + loginCookie + "' />";
+ html += "<param name='serviceURI' value='" + getServiceURI() + "' />";
+ html += "<param name='image' value='" + appPath + "/icons/32x32/face-monkey.png' />";
+ html += "</applet>";
+
+ appletDiv.innerHTML = html;
+}
+
+function doSave(){
+ var editor = document.getElementById("viewer");
+ if(editor == null){
+ return;
+ }
+ editor.saveBodyConfiguration();
+}
+
+function initBodyEditor(){
+ appletDiv = document.getElementById("appletDiv");
+ leftControlDiv = document.getElementById("leftControlDiv");
+ rightControlDiv = document.getElementById("rightControlDiv");
+ bottomControlDiv = document.getElementById("bottomControlDiv");
+ topControlDiv = document.getElementById("topControlDiv");
+ bodyListControl = document.getElementById("bodyListControl");
+ bodyDataControl = document.getElementById("bodyDataControl");
+ textureSelectionDiv = document.getElementById("textureSelectionDiv");
+ textureForm = document.getElementById("textureForm");
+ morphControls = document.getElementById("morphControls");
+ animationControls = document.getElementById("animationControls");
+
+ addAuthListeners(handleBodyAuth, handleBodyAuth);
+}
\ No newline at end of file
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2007-10-30 00:18:24 UTC (rev 545)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2007-10-30 00:18:29 UTC (rev 546)
@@ -791,6 +791,12 @@
manager.send(serializeXML(bodyXML));
}
+function deleteBody(username, bodyID, listener){
+ var manager = new XMLRequestManager(appPath + "/account/" + username + "/body/" + bodyID, new BasicHTTPListener(listener));
+ manager.setMethod("DELETE");
+ manager.send();
+}
+
function updateBodyDocument(xml, listener){
if(xml == null){
return;
@@ -810,6 +816,10 @@
manager.send();
}
+function requestBodyDataList(listener){
+ new XMLRequestManager(appPath + "/space/body", new BasicHTTPListener(listener)).send();
+}
+
// BEGIN POSSESSION UTILS
function requestPossession(username, possessionID, listener){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-30 03:00:07
|
Revision: 548
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=548&view=rev
Author: trevorolio
Date: 2007-10-29 20:00:11 -0700 (Mon, 29 Oct 2007)
Log Message:
-----------
Using the body editor you can now create, modify, and delete body configurations.
Still needs much UI style love, but that can wait.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.js
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java 2007-10-30 00:18:31 UTC (rev 547)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java 2007-10-30 03:00:11 UTC (rev 548)
@@ -81,6 +81,30 @@
return (BodyConfigurationRecord) task.execute();
}
+ public static boolean deleteBodyConfiguration(final BodyConfigurationRecord record, SessionFactory sessionFactory) throws PersistException {
+ HibernateTask task = new HibernateTask() {
+ public Object run(Session session) throws PersistException {
+ Query accountQuery = session.getNamedQuery(AccountPersistTasks.ACCOUNT_BY_USERNAME);
+ accountQuery.setString("username", record.getOwnerUsername());
+ AccountRecord accountRec = (AccountRecord)accountQuery.uniqueResult();
+ if(accountRec == null || accountRec.getDefaultBodyConfigurationID() == record.getBodyConfigurationID()){
+ return Boolean.FALSE;
+ }
+
+ Query settingsQuery = session.getNamedQuery(BODY_SETTINGS_BY_CONFIGURATION_ID);
+ settingsQuery.setLong("bodyConfigurationID", record.getBodyConfigurationID());
+ BodySettingRecord[] settings = (BodySettingRecord[])settingsQuery.list().toArray(new BodySettingRecord[0]);
+ for (int i = 0; i < settings.length; i++) {
+ session.delete(settings[i]);
+ }
+ session.delete(record);
+ return Boolean.TRUE;
+ }
+ };
+ task.setSessionFactory(sessionFactory);
+ return Boolean.TRUE.equals(task.execute());
+ }
+
public static BodyConfigurationRecord[] findBodyConfigurationsByUsername(final String username, SessionFactory sessionFactory) throws PersistException {
HibernateTask task = new HibernateTask() {
public Object run(Session session) throws PersistException {
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2007-10-30 00:18:31 UTC (rev 547)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2007-10-30 03:00:11 UTC (rev 548)
@@ -309,6 +309,27 @@
}
sendStringResponse(bodyConfigDoc.toString(), "text/xml", response);
}
+
+ public void doDelete(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws ServletException, IOException, PersistException {
+ String username = pathElements[pathElements.length - 3];
+ if (!requestOkForBody(request, username, authedAccount)) {
+ response.setStatus(HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
+ long bodyConfigID = Long.parseLong(pathElements[pathElements.length - 1]);
+
+ BodyConfigurationRecord record = BodyPersistTasks.findBodyConfigurationByID(bodyConfigID, getSessionFactory());
+ if (record == null || !username.equals(record.getOwnerUsername())) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+
+ getMediaService().delete(MediaService.getBodyTextureName(record.getBodyConfigurationID()));
+ BodyPersistTasks.deleteBodyConfiguration(record, getSessionFactory());
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
+
+
}
private class DefaultBodyResource extends AuthenticatedSiteResource {
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.js 2007-10-30 00:18:31 UTC (rev 547)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.js 2007-10-30 03:00:11 UTC (rev 548)
@@ -161,7 +161,6 @@
var selectedValue = +(form.bodyDataSelect.options[form.bodyDataSelect.selectedIndex].value);
var currentBodyDataID = +bodyXML.getAttribute("bodydataid");
if(selectedValue == currentBodyDataID){
- alert("no change");
return;
}
editor.setBodyData(selectedValue);
@@ -169,13 +168,34 @@
return true;
}
+function pickNewBodyName(){
+ for(var i=1; i < 100; i++){
+ var foundIt = false;
+ var potentialName = "Body " + i;
+ for(var j=0; j < bodyListXML.childNodes.length; j++){
+ if(potentialName == bodyListXML.childNodes[j].getAttribute("displayname")){
+ foundIt = true;
+ break;
+ }
+ }
+ if(!foundIt){
+ return potentialName;
+ }
+ }
+ return null;
+}
+
function bodySwitcherGo(){
var editor = document.getElementById("viewer");
var form = document.getElementById("bodySwitcherForm");
var selectedValue = form.bodySwitcher.options[form.bodySwitcher.selectedIndex].value;
if(selectedValue == "newBody"){
- alert("Show new body dialog");
- return false;
+ var newBodyName = pickNewBodyName();
+ if(newBodyName == null){
+ return false;
+ }
+ createBody(authedUsername, newBodyName, bodyXML.getAttribute("bodydataid"), handleNewBody);
+ return true;
} else if(selectedValue == "deleteBody"){
var answer = confirm("Really Delete This Body?");
if(!answer){
@@ -201,6 +221,17 @@
return true;
}
+function handleNewBody(xml){
+ if(xml == null){
+ alert("Error creating body.");
+ return;
+ }
+ var editor = document.getElementById("viewer");
+ var newBodyConfigurationID = +(xml.getAttribute("bodyconfigurationid"));
+ editor.setDefaultBodyConfiguration(newBodyConfigurationID);
+ requestBodyDocument(authedUsername, newBodyConfigurationID, handleBody);
+}
+
function handleBodyDeletion(text){
requestDefaultBodyDocument(authedUsername, handleBody);
}
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2007-10-30 00:18:31 UTC (rev 547)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2007-10-30 03:00:11 UTC (rev 548)
@@ -782,10 +782,11 @@
new XMLRequestManager(appPath + "/account/" + username + "/body/" + bodyID, httpListener).send();
}
-function createBody(username, bodyName, listener){
- var bodyXML = document.createElement("body");
+function createBody(username, bodyName, bodyDataID, listener){
+ var bodyXML = document.createElement("bodyconfiguration");
bodyXML.setAttribute("ownerusername", username);
bodyXML.setAttribute("displayname", bodyName);
+ bodyXML.setAttribute("bodydataid", bodyDataID);
var manager = new XMLRequestManager(appPath + "/account/" + username + "/body/", new BasicHTTPListener(listener));
manager.setMethod("POST");
manager.send(serializeXML(bodyXML));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-01 13:16:36
|
Revision: 550
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=550&view=rev
Author: trevorolio
Date: 2007-11-01 06:16:40 -0700 (Thu, 01 Nov 2007)
Log Message:
-----------
Updated the template editor UI to provide for script FILE upload in addition to inline editing.
This is handy for those of us who edit scripts in populate template directories using reasonable IDEs.
Added space.getOwnerUsername() to the script api so scripts can give owners more actions.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptQuaternion.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/templateEditor.html
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptQuaternion.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptQuaternion.java 2007-10-31 13:50:49 UTC (rev 549)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptQuaternion.java 2007-11-01 13:16:40 UTC (rev 550)
@@ -15,6 +15,7 @@
package com.ogoglio.sim.script;
import javax.media.j3d.Transform3D;
+import javax.vecmath.Point3d;
import javax.vecmath.Quat4d;
import javax.vecmath.Vector3d;
@@ -97,6 +98,9 @@
}
public void jsFunction_rotate(double x, double y, double z) {
+ if(Double.isNaN(x) || Double.isNaN(y) || Double.isNaN(z)){
+ throw new IllegalArgumentException("Can't rotate with NaN: " + x + ", " + y + ", " + z);
+ }
Transform3D rotTransform = new Transform3D();
rotTransform.setEuler(new Vector3d(x, y, z));
@@ -110,6 +114,16 @@
setQuat(quat);
}
+ public void jsFunction_rotatePoint(ScriptPoint pointOfRotation, ScriptPoint pointToRotate){
+ Vector3d vectorOfRot = new Vector3d(); //new Vector3d(pointOfRotation.jsGet_x(), pointOfRotation.jsGet_y(), pointOfRotation.jsGet_z());
+ Transform3D rotTransform = new Transform3D(new Quat4d(x, y, z, w), vectorOfRot, 1);
+ Point3d workingPoint = new Point3d(pointToRotate.jsGet_x(), pointToRotate.jsGet_y(), pointToRotate.jsGet_z());
+ rotTransform.transform(workingPoint);
+ pointToRotate.jsSet_x(workingPoint.x);
+ pointToRotate.jsSet_y(workingPoint.y);
+ pointToRotate.jsSet_z(workingPoint.z);
+ }
+
public void jsFunction_set(double w, double x, double y, double z) {
this.w = w;
this.x = w;
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java 2007-10-31 13:50:49 UTC (rev 549)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java 2007-11-01 13:16:40 UTC (rev 550)
@@ -84,6 +84,10 @@
return spaceSimulator.getSpaceID();
}
+ public String jsGet_ownerUsername(){
+ return spaceSimulator.getSpace().getOwnerUsername();
+ }
+
public long jsGet_time() {
return System.currentTimeMillis();
}
@@ -171,6 +175,14 @@
return result;
}
+ public double jsFunction_getThingTemplateID(double thingID){
+ Thing thing = spaceSimulator.getSpace().getThing((long) thingID);
+ if (thing == null) {
+ return -1;
+ }
+ return thing.getTemplate().getTemplateID();
+ }
+
public ScriptPoint jsFunction_getThingPosition(double thingID) {
Thing thing = spaceSimulator.getSpace().getThing((long) thingID);
if (thing == null) {
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/templateEditor.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/templateEditor.html 2007-10-31 13:50:49 UTC (rev 549)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/templateEditor.html 2007-11-01 13:16:40 UTC (rev 550)
@@ -61,7 +61,7 @@
var objMessage = null;
var seatCheckbox = null;
var seatPositionForm = null;
-
+var scriptFileForm = null;
var scriptEditor = null;
var templateDoc = null;
@@ -89,10 +89,12 @@
titleElement.innerHTML = "Template: " + escapeHTML(templateDoc.getAttribute('displayname')) + " <input id='titleFormGoButton' type='submit' value='rename' onclick='titleFormGo(); return false;' />";
+
var templatePath = appPath + "/account/" + authedUsername + "/template/" + templateID;
obj0Form.action = templatePath + "/geometry/data/0";
obj0Form.onsubmit = submitObj0;
-
+ scriptFileForm.action = templatePath + "/script/";
+
var geometryMessage = "does not exist";
var resourceHTML = "";
@@ -157,6 +159,10 @@
return AIM.submit(resourceForm, {'onStart' : startedTemplateForm, 'onComplete' : completedTemplateForm});
}
+function scriptFileFormGo(){
+ return AIM.submit(scriptFileForm, {'onStart' : startedScriptFileForm, 'onComplete' : completedScriptFileForm});
+}
+
function titleFormGo(){
var goButton = document.getElementById("titleFormGoButton");
if(goButton.value == "rename"){
@@ -174,6 +180,17 @@
}
}
+function scriptFileFormGo(){
+ return AIM.submit(scriptFileForm, {'onStart' : startedScriptFileForm, 'onComplete' : completedScriptFileForm});
+}
+
+function startedScriptFileForm(){
+}
+
+function completedScriptFileForm(response){
+ requestTemplateScript(authedUsername, templateID, handleScript);
+}
+
function scriptFormGo(scriptForm){
var newScript = trim(scriptForm.scriptTextArea.value);
updateTemplateScript(authedUsername, templateID, newScript, handleScriptUpdate);
@@ -248,7 +265,8 @@
objMessage = document.getElementById("objMessage");
seatCheckbox = document.getElementById("seatCheckbox");
seatPositionForm = document.getElementById("seatPositionForm");
-
+ scriptFileForm = document.getElementById("scriptFileForm");
+
scriptEditor = document.getElementById('scriptEditor');
if(templateID == null){
@@ -324,8 +342,18 @@
<br clear="all"/>
<div class="section">
+ <h3>Upload script:</h3>
+ <form id="scriptFileForm" onsubmit="scriptFileFormGo();" target="scriptFileTarget" action="" enctype="multipart/form-data" method="post">
+ <input type="file" name="scriptFile" />
+ <input type="submit" value="upload script" />
+ </form>
+ <iframe id="scriptFileTarget" name="scriptFileTarget" style="width: 1px; height: 1px;"></iframe>
+ </div>
+ <br clear="all"/>
+
+ <div class="section">
<div style="float: right;" class="navLink"><a href="http://ogoglio.wiki.sourceforge.net/ServerManualJavascriptAPI">Script API »</a></div>
- <h3>Script:</h3>
+ <h3>Edit script:</h3>
<div id="scriptEditor">
</div>
</div>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-08 00:25:38
|
Revision: 564
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=564&view=rev
Author: trevorolio
Date: 2007-11-07 16:25:42 -0800 (Wed, 07 Nov 2007)
Log Message:
-----------
Added account level field to auth docs.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AuthServlet.java
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AuthServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AuthServlet.java 2007-11-08 00:25:38 UTC (rev 563)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AuthServlet.java 2007-11-08 00:25:42 UTC (rev 564)
@@ -135,7 +135,7 @@
} else {
AuthDocument authDoc = null;
if (cookieAccountRecord != null) {
- authDoc = new AuthDocument(cookieAccountRecord.getUsername(), true);
+ authDoc = new AuthDocument(cookieAccountRecord.getUsername(), true, cookieAccountRecord.getAccountlevel());
} else {
authDoc = new AuthDocument();
}
@@ -161,7 +161,7 @@
newCookie.setPath("/");
newCookie.setMaxAge(Integer.MAX_VALUE - 1);
response.addCookie(newCookie);
- AuthDocument authDoc = new AuthDocument(authedAccountRecord.getUsername(), true);
+ AuthDocument authDoc = new AuthDocument(authedAccountRecord.getUsername(), true, authedAccountRecord.getAccountlevel());
response.setStatus(HttpServletResponse.SC_OK);
response.setContentType("text/xml");
response.getOutputStream().write(authDoc.toString().getBytes());
@@ -178,7 +178,7 @@
AccountRecord cookieAccountRecord = getAuthedAccountRecord(request, getSessionFactory());
AuthDocument authDoc = null;
if (cookieAccountRecord != null) {
- authDoc = new AuthDocument(cookieAccountRecord.getUsername(), true);
+ authDoc = new AuthDocument(cookieAccountRecord.getUsername(), true, cookieAccountRecord.getAccountlevel());
} else {
authDoc = new AuthDocument();
}
@@ -205,7 +205,7 @@
AccountRecord cookieAccountRecord = getAuthedAccountRecord(request, getSessionFactory());
AuthDocument authDoc = null;
if (cookieAccountRecord != null) {
- authDoc = new AuthDocument(cookieAccountRecord.getUsername(), true);
+ authDoc = new AuthDocument(cookieAccountRecord.getUsername(), true, cookieAccountRecord.getAccountlevel());
} else {
authDoc = new AuthDocument();
}
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2007-11-08 00:25:38 UTC (rev 563)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2007-11-08 00:25:42 UTC (rev 564)
@@ -262,6 +262,10 @@
return xml.replace(/'/g,"'").replace(/"/g,"\"").replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&");
};
+function newlinesToBrs(text){
+ return text.replace(/\n/g,"<br/>");
+}
+
// BEGIN QUATERION CLASS
function Quaternion(wValue, xValue, yValue, zValue){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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.
|
|
From: <ian...@us...> - 2007-12-13 01:58:02
|
Revision: 632
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=632&view=rev
Author: iansmith
Date: 2007-12-12 17:58:05 -0800 (Wed, 12 Dec 2007)
Log Message:
-----------
First stage of allowing folks that want to protect their sims with a servlet filter.
Developers need to add this to their servlet.xml
<Environment name="simFilter" value="false" type="java.lang.String"/>
<!-- simFilterPortDoesn't matter unless simFilter is true and developers don't want that-->
<!-- but you want to keep in here so that tools that examine this file can find it -->
<Environment name="simFilterPort" value="0" type="java.lang.String"/>
With this, filtering is turned off for the development machine.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml
maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml
Added Paths:
-----------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimFilter.java
Removed Paths:
-------------
maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web-all.xml
maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web-app.xml
maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web-media.xml
maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web-sim.xml
Added: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimFilter.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimFilter.java (rev 0)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimFilter.java 2007-12-13 01:58:05 UTC (rev 632)
@@ -0,0 +1,67 @@
+package com.ogoglio.sim.site;
+
+import java.io.IOException;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletResponse;
+
+import com.ogoglio.util.Log;
+
+public class SimFilter implements Filter {
+
+ private boolean filterNeeded=false;
+ private int okPort=8888;
+
+ public void destroy() {
+ }
+
+ public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
+ //do we even need to bother?
+ if (!filterNeeded) {
+ chain.doFilter(req, resp);
+ return;
+ }
+
+ //ok, now do the checking
+ if (req.getLocalPort()!=okPort) {
+ if (resp instanceof HttpServletResponse) {
+ Log.info("Refusing to allow connection to sim on port "+req.getLocalPort());
+ HttpServletResponse httpResp=(HttpServletResponse)resp;
+ httpResp.setStatus(HttpServletResponse.SC_FORBIDDEN);
+ } else {
+ Log.warn("Configuration is almost certainly messed up, got a non HTTP servlet response:"+
+ resp.getClass().getName());
+ }
+ } else {
+ chain.doFilter(req,resp);
+ }
+ }
+
+ public void init(FilterConfig config) throws ServletException {
+ try {
+ Context initCtx = new InitialContext();
+ Context envCtx = (Context) initCtx.lookup("java:comp/env");
+ String useMe = (String) envCtx.lookup("ogoglio/simFilter");
+ if ("true".equals(useMe.toLowerCase())) {
+ filterNeeded=true;
+ String port=(String)envCtx.lookup("ogoglio/simFilterPort");
+ try {
+ okPort=Integer.parseInt(port);
+ } catch (NumberFormatException ex) {
+ Log.error("Whoa! Couldn't understand ogoglio/simFilterPort: "+port+" using "+okPort+" instead!");
+ }
+ }
+ } catch (NamingException e) {
+ throw new ServletException("Initialization time exception from Naming (JNDI):"+e.getMessage());
+ }
+ }
+}
+
Modified: maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml 2007-12-13 01:46:16 UTC (rev 631)
+++ maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml 2007-12-13 01:58:05 UTC (rev 632)
@@ -19,4 +19,7 @@
<ResourceLink name="ogoglio/isMediaServer" global="isMediaServer" type="java.lang.String"/>
<ResourceLink name="ogoglio/isWebappServer" global="isWebappServer" type="java.lang.String"/>
+ <ResourceLink name="ogoglio/simFilter" global="simFilterPort" type="java.lang.String"/>
+ <ResourceLink name="ogoglio/simFilterPort" global="simFilterPort" type="java.lang.String"/>
+
</Context>
Deleted: maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web-all.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web-all.xml 2007-12-13 01:46:16 UTC (rev 631)
+++ maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web-all.xml 2007-12-13 01:58:05 UTC (rev 632)
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
- <servlet>
- <servlet-name>AccountServlet</servlet-name>
- <servlet-class>com.ogoglio.site.AccountServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet>
- <servlet-name>AuthServlet</servlet-name>
- <servlet-class>com.ogoglio.site.AuthServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet>
- <servlet-name>SpaceServlet</servlet-name>
- <servlet-class>com.ogoglio.site.SpaceServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet>
- <servlet-name>MediaServlet</servlet-name>
- <servlet-class>com.ogoglio.media.site.MediaServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet>
- <servlet-name>SimServlet</servlet-name>
- <servlet-class>com.ogoglio.sim.site.SimServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>AccountServlet</servlet-name>
- <url-pattern>/account/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>AuthServlet</servlet-name>
- <url-pattern>/auth/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>SpaceServlet</servlet-name>
- <url-pattern>/space/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>SimServlet</servlet-name>
- <url-pattern>/sim/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>MediaServlet</servlet-name>
- <url-pattern>/media/*</url-pattern>
- </servlet-mapping>
-
- <error-page>
- <error-code>404</error-code>
- <location>/notFound.html</location>
- </error-page>
-</web-app>
Deleted: maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web-app.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web-app.xml 2007-12-13 01:46:16 UTC (rev 631)
+++ maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web-app.xml 2007-12-13 01:58:05 UTC (rev 632)
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
- <servlet>
- <servlet-name>AccountServlet</servlet-name>
- <servlet-class>com.ogoglio.site.AccountServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet>
- <servlet-name>AuthServlet</servlet-name>
- <servlet-class>com.ogoglio.site.AuthServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet>
- <servlet-name>SpaceServlet</servlet-name>
- <servlet-class>com.ogoglio.site.SpaceServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>AccountServlet</servlet-name>
- <url-pattern>/account/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>AuthServlet</servlet-name>
- <url-pattern>/auth/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>SpaceServlet</servlet-name>
- <url-pattern>/space/*</url-pattern>
- </servlet-mapping>
-
- <error-page>
- <error-code>404</error-code>
- <location>/notFound.html</location>
- </error-page>
-</web-app>
Deleted: maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web-media.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web-media.xml 2007-12-13 01:46:16 UTC (rev 631)
+++ maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web-media.xml 2007-12-13 01:58:05 UTC (rev 632)
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
- <servlet>
- <servlet-name>MediaServlet</servlet-name>
- <servlet-class>com.ogoglio.media.site.MediaServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>MediaServlet</servlet-name>
- <url-pattern>/media/*</url-pattern>
- </servlet-mapping>
-
- <error-page>
- <error-code>404</error-code>
- <location>/notFound.html</location>
- </error-page>
-</web-app>
Deleted: maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web-sim.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web-sim.xml 2007-12-13 01:46:16 UTC (rev 631)
+++ maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web-sim.xml 2007-12-13 01:58:05 UTC (rev 632)
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
- <servlet>
- <servlet-name>SimServlet</servlet-name>
- <servlet-class>com.ogoglio.sim.site.SimServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>SimServlet</servlet-name>
- <url-pattern>/sim/*</url-pattern>
- </servlet-mapping>
-
- <error-page>
- <error-code>404</error-code>
- <location>/notFound.html</location>
- </error-page>
-</web-app>
Modified: maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml 2007-12-13 01:46:16 UTC (rev 631)
+++ maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml 2007-12-13 01:58:05 UTC (rev 632)
@@ -42,6 +42,12 @@
<load-on-startup>1</load-on-startup>
</servlet>
+ <filter>
+ <filter-name>SimFilter</filter-name>
+ <filter-class>com.ogoglio.sim.site.SimFilter</filter-class>
+ </filter>
+
+
<servlet-mapping>
<servlet-name>AccountServlet</servlet-name>
<url-pattern>/account/*</url-pattern>
@@ -62,6 +68,11 @@
<url-pattern>/sim/*</url-pattern>
</servlet-mapping>
+ <filter-mapping>
+ <filter-name>SimFilter</filter-name>
+ <url-pattern>/sim/*</url-pattern>
+ </filter-mapping>
+
<servlet-mapping>
<servlet-name>MediaServlet</servlet-name>
<url-pattern>/media/*</url-pattern>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-12-14 17:28:51
|
Revision: 633
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=633&view=rev
Author: trevorolio
Date: 2007-12-14 09:28:46 -0800 (Fri, 14 Dec 2007)
Log Message:
-----------
Tweaked a servlet filter config typo
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java
maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java 2007-12-13 01:58:05 UTC (rev 632)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java 2007-12-14 17:28:46 UTC (rev 633)
@@ -344,7 +344,6 @@
}
try {
URI result=new URI(representativeURI.getScheme(),null,representativeURI.getHost(),representativeURI.getPort(),cometPath,null,null);
- Log.warn("Somewhat dodgy: Converting the URI "+representativeURI+" to "+result+" for comet!");
return result;
} catch (URISyntaxException e) {
throw new IOException("Our converted URI was not well formed! Started with:"+representativeURI);
Modified: maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml 2007-12-13 01:58:05 UTC (rev 632)
+++ maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml 2007-12-14 17:28:46 UTC (rev 633)
@@ -19,7 +19,7 @@
<ResourceLink name="ogoglio/isMediaServer" global="isMediaServer" type="java.lang.String"/>
<ResourceLink name="ogoglio/isWebappServer" global="isWebappServer" type="java.lang.String"/>
- <ResourceLink name="ogoglio/simFilter" global="simFilterPort" type="java.lang.String"/>
+ <ResourceLink name="ogoglio/simFilter" global="simFilter" type="java.lang.String"/>
<ResourceLink name="ogoglio/simFilterPort" global="simFilterPort" type="java.lang.String"/>
</Context>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ian...@us...> - 2007-12-14 18:17:24
|
Revision: 634
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=634&view=rev
Author: iansmith
Date: 2007-12-14 10:17:28 -0800 (Fri, 14 Dec 2007)
Log Message:
-----------
Renamed the filter to be more sensible. It is also now available (via web.xml) to the status
servlet as well, if you want to protect that servlet. For developers, this is all turned
OFF by default.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml
Added Paths:
-----------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/FilterByPort.java
Removed Paths:
-------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimFilter.java
Copied: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/FilterByPort.java (from rev 632, maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimFilter.java)
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/FilterByPort.java (rev 0)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/FilterByPort.java 2007-12-14 18:17:28 UTC (rev 634)
@@ -0,0 +1,68 @@
+package com.ogoglio.sim.site;
+
+import java.io.IOException;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletResponse;
+
+import com.ogoglio.util.Log;
+
+public class FilterByPort implements Filter {
+
+ private boolean filterNeeded=false;
+ private int okPort=8888;
+
+ public void destroy() {
+ }
+
+ public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
+ //do we even need to bother?
+ if (!filterNeeded) {
+ chain.doFilter(req, resp);
+ return;
+ }
+
+ //ok, now do the checking
+ if (req.getLocalPort()!=okPort) {
+ if (resp instanceof HttpServletResponse) {
+ Log.info("Refusing to allow connection to sim on port "+req.getLocalPort());
+ HttpServletResponse httpResp=(HttpServletResponse)resp;
+ httpResp.setStatus(HttpServletResponse.SC_FORBIDDEN);
+ } else {
+ Log.warn("Configuration is almost certainly messed up, got a non HTTP servlet response:"+
+ resp.getClass().getName());
+ }
+ } else {
+ chain.doFilter(req,resp);
+ }
+ }
+
+ public void init(FilterConfig config) throws ServletException {
+ try {
+ Context initCtx = new InitialContext();
+ Context envCtx = (Context) initCtx.lookup("java:comp/env");
+ String useMe = (String) envCtx.lookup("ogoglio/simFilter");
+ if ("true".equals(useMe.toLowerCase())) {
+ filterNeeded=true;
+ String port=(String)envCtx.lookup("ogoglio/simFilterPort");
+ try {
+ okPort=Integer.parseInt(port);
+ } catch (NumberFormatException ex) {
+ Log.error("Whoa! Couldn't understand ogoglio/simFilterPort: "+port+" using "+okPort+" instead!");
+ }
+ }
+ Log.info("Filtering by port? "+useMe+" [port = "+okPort+"] and needed?"+filterNeeded);
+ } catch (NamingException e) {
+ throw new ServletException("Initialization time exception from Naming (JNDI):"+e.getMessage());
+ }
+ }
+}
+
Deleted: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimFilter.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimFilter.java 2007-12-14 17:28:46 UTC (rev 633)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimFilter.java 2007-12-14 18:17:28 UTC (rev 634)
@@ -1,67 +0,0 @@
-package com.ogoglio.sim.site;
-
-import java.io.IOException;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletResponse;
-
-import com.ogoglio.util.Log;
-
-public class SimFilter implements Filter {
-
- private boolean filterNeeded=false;
- private int okPort=8888;
-
- public void destroy() {
- }
-
- public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
- //do we even need to bother?
- if (!filterNeeded) {
- chain.doFilter(req, resp);
- return;
- }
-
- //ok, now do the checking
- if (req.getLocalPort()!=okPort) {
- if (resp instanceof HttpServletResponse) {
- Log.info("Refusing to allow connection to sim on port "+req.getLocalPort());
- HttpServletResponse httpResp=(HttpServletResponse)resp;
- httpResp.setStatus(HttpServletResponse.SC_FORBIDDEN);
- } else {
- Log.warn("Configuration is almost certainly messed up, got a non HTTP servlet response:"+
- resp.getClass().getName());
- }
- } else {
- chain.doFilter(req,resp);
- }
- }
-
- public void init(FilterConfig config) throws ServletException {
- try {
- Context initCtx = new InitialContext();
- Context envCtx = (Context) initCtx.lookup("java:comp/env");
- String useMe = (String) envCtx.lookup("ogoglio/simFilter");
- if ("true".equals(useMe.toLowerCase())) {
- filterNeeded=true;
- String port=(String)envCtx.lookup("ogoglio/simFilterPort");
- try {
- okPort=Integer.parseInt(port);
- } catch (NumberFormatException ex) {
- Log.error("Whoa! Couldn't understand ogoglio/simFilterPort: "+port+" using "+okPort+" instead!");
- }
- }
- } catch (NamingException e) {
- throw new ServletException("Initialization time exception from Naming (JNDI):"+e.getMessage());
- }
- }
-}
-
Modified: maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml 2007-12-14 17:28:46 UTC (rev 633)
+++ maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml 2007-12-14 18:17:28 UTC (rev 634)
@@ -43,8 +43,8 @@
</servlet>
<filter>
- <filter-name>SimFilter</filter-name>
- <filter-class>com.ogoglio.sim.site.SimFilter</filter-class>
+ <filter-name>PortFilter</filter-name>
+ <filter-class>com.ogoglio.sim.site.FilterByPort</filter-class>
</filter>
@@ -69,7 +69,7 @@
</servlet-mapping>
<filter-mapping>
- <filter-name>SimFilter</filter-name>
+ <filter-name>PortFilter</filter-name>
<url-pattern>/sim/*</url-pattern>
</filter-mapping>
@@ -88,6 +88,11 @@
<url-pattern>/status/*</url-pattern>
</servlet-mapping>
+ <filter-mapping>
+ <filter-name>PortFilter</filter-name>
+ <url-pattern>/status/*</url-pattern>
+ </filter-mapping>
+
<error-page>
<error-code>404</error-code>
<location>/notFound.html</location>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2008-01-01 21:34:57
|
Revision: 660
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=660&view=rev
Author: trevorolio
Date: 2008-01-01 13:35:01 -0800 (Tue, 01 Jan 2008)
Log Message:
-----------
WARNING: DB SCHEMA CHANGE
Added an emailValid field to account records, their XML docs, and the Java APIs.
Fixed up the existing email validation framework to update this value.
Added an email validation test to the integration test suite.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountRecord.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/PendingEmailValidationTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-1.xml
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/defaultAccountPhoto.gif
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java 2008-01-01 21:34:54 UTC (rev 659)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java 2008-01-01 21:35:01 UTC (rev 660)
@@ -171,7 +171,7 @@
BodyConfigurationRecord bodyConfRecord = new BodyConfigurationRecord(username, "Body", bodyDataRecords[0].getBodyDataID(), null);
hibernateSession.save(bodyConfRecord);
- record = new AccountRecord(username, accountlevel, email, bodyConfRecord.getBodyConfigurationID(), null, null);
+ record = new AccountRecord(username, accountlevel, email, false, bodyConfRecord.getBodyConfigurationID(), null, null);
hibernateSession.save(record);
PendingEmailValidationRecord validationRec = new PendingEmailValidationRecord(username, email);
@@ -199,16 +199,4 @@
task.setSessionFactory(sessionFactory);
return (AccountRecord) task.execute();
}
-
- public static void delete(final AccountRecord accRec, SessionFactory sessionFactory) throws PersistException {
- HibernateTask task = new HibernateTask() {
- public Object run(Session hibernateSession) {
- hibernateSession.delete(accRec);
- return null;
- }
- };
- task.setSessionFactory(sessionFactory);
- task.execute();
-
- }
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountRecord.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountRecord.java 2008-01-01 21:34:54 UTC (rev 659)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountRecord.java 2008-01-01 21:35:01 UTC (rev 660)
@@ -36,6 +36,8 @@
private String passwordHash = null;
private String email = null;
+
+ private boolean emailValid = false;
private long creationDate = AccountDocument.NO_TIME_VALUE;
@@ -52,7 +54,7 @@
public AccountRecord() {
}
- public AccountRecord(String username, String accountlevel, String email, long defaultBodyConfigurationID, String voiceURI, String textURI) {
+ public AccountRecord(String username, String accountlevel, String email, boolean emailValid, long defaultBodyConfigurationID, String voiceURI, String textURI) {
this.username = cleanUsername(username);
if (this.username == null) {
throw new IllegalArgumentException("Bad username (only letters and numbers): " + username);
@@ -66,7 +68,8 @@
if (this.email == null) {
throw new IllegalArgumentException("Bad email: " + email);
}
-
+ this.emailValid = emailValid;
+
this.defaultBodyConfigurationID = defaultBodyConfigurationID;
this.voiceURI = voiceURI;
@@ -311,4 +314,12 @@
public void setTextURI(String textURI) {
this.textURI = textURI;
}
+
+ public boolean isEmailValid() {
+ return emailValid;
+ }
+
+ public void setEmailValid(boolean emailValid) {
+ this.emailValid = emailValid;
+ }
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/PendingEmailValidationTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/PendingEmailValidationTasks.java 2008-01-01 21:34:54 UTC (rev 659)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/PendingEmailValidationTasks.java 2008-01-01 21:35:01 UTC (rev 660)
@@ -50,10 +50,20 @@
return (PendingEmailValidationRecord) task.execute();
}
- public static boolean delete(final PendingEmailValidationRecord validationRecord, SessionFactory sessionFactory) throws PersistException {
+ public static boolean setValidAndDelete(final PendingEmailValidationRecord validationRecord, SessionFactory sessionFactory) throws PersistException {
HibernateTask task = new HibernateTask() {
- public Object run(Session hibernateSession) {
- hibernateSession.delete(validationRecord);
+ public Object run(Session session) {
+ Query accountQuery = session.getNamedQuery(AccountPersistTasks.ACCOUNT_BY_USERNAME);
+ accountQuery.setString("username", validationRecord.getUsername());
+ AccountRecord accountRec = (AccountRecord)accountQuery.uniqueResult();
+ if(accountRec == null){
+ return Boolean.FALSE;
+ }
+ accountRec.setEmail(validationRecord.getEmail());
+ accountRec.setEmailValid(true);
+ session.update(accountRec);
+
+ session.delete(validationRecord);
return Boolean.TRUE;
}
};
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2008-01-01 21:34:54 UTC (rev 659)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2008-01-01 21:35:01 UTC (rev 660)
@@ -86,9 +86,9 @@
AccountDocument result = null;
if (authed) {
- result = new AccountDocument(account.getUsername(), account.getAccountlevel(), account.getFirstName(), account.getLastName(), account.getHomepage(), null, account.getEmail(), account.getCreationDate(), null, account.getFrozenUntil(), account.getDefaultBodyConfigurationID(), account.getVoiceURI(), account.getTextURI());
+ result = new AccountDocument(account.getUsername(), account.getAccountlevel(), account.getFirstName(), account.getLastName(), account.getHomepage(), null, account.getEmail(), account.isEmailValid(), account.getCreationDate(), null, account.getFrozenUntil(), account.getDefaultBodyConfigurationID(), account.getVoiceURI(), account.getTextURI());
} else {
- result = new AccountDocument(account.getUsername(), account.getAccountlevel(), account.getFirstName(), account.getLastName(), account.getHomepage(), null, null, account.getCreationDate(), null, account.getFrozenUntil(), account.getDefaultBodyConfigurationID(), null, null);
+ result = new AccountDocument(account.getUsername(), account.getAccountlevel(), account.getFirstName(), account.getLastName(), account.getHomepage(), null, null, account.isEmailValid(), account.getCreationDate(), null, account.getFrozenUntil(), account.getDefaultBodyConfigurationID(), null, null);
}
return result;
}
@@ -436,8 +436,8 @@
return;
}
- if (!PendingEmailValidationTasks.delete(validationRecord, getSessionFactory())) {
- Log.error("Could not delete validation record for email: " + validationRecord.getEmail());
+ if (!PendingEmailValidationTasks.setValidAndDelete(validationRecord, getSessionFactory())) {
+ Log.error("Could not update database with email validation: " + validationRecord.getEmail());
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
}
Modified: maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-1.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-1.xml 2008-01-01 21:34:54 UTC (rev 659)
+++ maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-1.xml 2008-01-01 21:35:01 UTC (rev 660)
@@ -85,6 +85,7 @@
table="AccountRecords">
<id name="username"></id>
<property name="email" not-null="true" unique="true" />
+ <property name="emailValid" />
<property name="accountlevel" not-null="true" />
<property name="passwordHash" />
<property name="firstName" />
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/defaultAccountPhoto.gif
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2008-01-02 10:15:52
|
Revision: 663
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=663&view=rev
Author: trevorolio
Date: 2008-01-02 02:15:57 -0800 (Wed, 02 Jan 2008)
Log Message:
-----------
Use a proxy instead of a redirect on the account photo resource to make WinIE happy. *sigh*
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
Added Paths:
-----------
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/defaultAccountPhoto.jpg
Removed Paths:
-------------
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/defaultAccountPhoto.gif
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2008-01-02 06:00:45 UTC (rev 662)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2008-01-02 10:15:57 UTC (rev 663)
@@ -95,7 +95,7 @@
public SiteResource createBaseResource(ServletConfig servletConfig) {
if (servletNeeded) {
- defaultAccountPhotoPath = getBaseUrl() + "defaultAccountPhoto.gif";
+ defaultAccountPhotoPath = getBaseUrl() + "defaultAccountPhoto.jpg";
return new AccountsResource();
} else {
Log.info("Turning off account servlet, this host doesn't want it.");
@@ -460,7 +460,7 @@
DecoratedInputStream data = getMediaService().getData(MediaService.getAccountPhotoName(accountRec.getUsername()));
if (data == null) {
- response.sendRedirect(defaultAccountPhotoPath);
+ proxy(URI.create(defaultAccountPhotoPath), "GET", request, response);
return;
}
response.setStatus(HttpServletResponse.SC_OK);
Deleted: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/defaultAccountPhoto.gif
===================================================================
(Binary files differ)
Added: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/defaultAccountPhoto.jpg
===================================================================
(Binary files differ)
Property changes on: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/defaultAccountPhoto.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2008-01-11 21:21:05
|
Revision: 678
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=678&view=rev
Author: trevorolio
Date: 2008-01-11 13:21:10 -0800 (Fri, 11 Jan 2008)
Log Message:
-----------
Added private tells among space cohabitants.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
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 2008-01-11 21:20:46 UTC (rev 677)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2008-01-11 21:21:10 UTC (rev 678)
@@ -417,6 +417,28 @@
listener.generatedSpaceEvent(markedUpEvent, SpaceSimulator.this);
+ } else if (SpaceEvent.TEXT_TELL_EVENT.equals(event.getName())) {
+ String username = event.getStringProperty(SpaceEvent.USERNAME);
+ User user = space.getUser(username);
+ if (user == null) {
+ log("Got tell message from non-existent person: " + username);
+ continue;
+ }
+ String recipientName = event.getStringProperty(SpaceEvent.TTE_RECIPIENT);
+ User recipient = space.getUser(recipientName);
+ if(recipient == null){
+ log("Got tell message for non-existent person: " + recipientName);
+ continue;
+ }
+ String chatMessage = markdownChatMessage(event.getStringProperty(SpaceEvent.TTE_MESSAGE));
+
+ SpaceEvent markedUpEvent = new SpaceEvent(SpaceEvent.TEXT_TELL_EVENT);
+ markedUpEvent.setProperty(SpaceEvent.USERNAME, username);
+ markedUpEvent.setProperty(SpaceEvent.TTE_RECIPIENT, recipientName);
+ markedUpEvent.setProperty(SpaceEvent.TTE_MESSAGE, chatMessage);
+
+ listener.generatedSpaceEventForUser(recipientName, event, SpaceSimulator.this);
+
} else if (((SpaceEvent.THING_CLICKED_EVENT.equals(event.getName()))) || ((SpaceEvent.THING_CONTEXT_CLICKED_EVENT.equals(event.getName()))) || ((SpaceEvent.THING_CONTEXT_SELECTION_MADE_EVENT.equals(event.getName())))) {
String username = event.getStringProperty(SpaceEvent.USERNAME);
User user = space.getUser(username);
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2008-01-11 21:20:46 UTC (rev 677)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2008-01-11 21:21:10 UTC (rev 678)
@@ -16,6 +16,7 @@
viewerHelpMessage += "Chat: Click in the text field below, type a chat message, then press \"return\".<br/>";
viewerHelpMessage += "Camera: Drag your mouse to pan the camera left, right, up and down. ESC to reset.<br/>"
viewerHelpMessage += "Zoom: Use your scroll wheel to zoom the camera in and out.<br/>";
+viewerHelpMessage += "Private Message: /t username message<br/>";
viewerHelpMessage += "<br/>Type \"/help\" to see this message again.";
function handleSpaceDoc(xml){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2008-01-30 22:43:42
|
Revision: 698
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=698&view=rev
Author: trevorolio
Date: 2008-01-30 14:43:45 -0800 (Wed, 30 Jan 2008)
Log Message:
-----------
Added the requested IP number to the service doc so the applet can work against round robin dns clusters, on Windows, in Firefox. Also tweaked the renderer graphics config to indicate a lowest level of texture bit depth, which also has the nice side effect of making the card use higher bit depth if possible.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java 2008-01-30 22:43:10 UTC (rev 697)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java 2008-01-30 22:43:45 UTC (rev 698)
@@ -109,7 +109,7 @@
}
public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
- ServiceDocument serviceDocument = new ServiceDocument(messageProxy.getUserCount(), messageProxy.getSimCount());
+ ServiceDocument serviceDocument = new ServiceDocument(messageProxy.getUserCount(), messageProxy.getSimCount(), request.getLocalAddr());
sendStringResponse(serviceDocument.toString(), "text/xml", response);
}
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2008-01-30 22:43:10 UTC (rev 697)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2008-01-30 22:43:45 UTC (rev 698)
@@ -631,6 +631,9 @@
}
// BEGIN SERVICE UTILS
+function requestService(listener){
+ new XMLRequestManager(appPath + "/space/", new BasicHTTPListener(listener)).send();
+}
function requestServiceState(listener){
new XMLRequestManager(appPath + "/space/state/", new BasicHTTPListener(listener)).send();
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2008-01-30 22:43:10 UTC (rev 697)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2008-01-30 22:43:45 UTC (rev 698)
@@ -89,12 +89,22 @@
spaceDiv.innerHTML = "No cookie. Please sign in or register as a guest.";
return;
}
+ requestService(handleService);
+}
+function handleService(serviceXML){
+ if(serviceXML == null){
+ spaceDiv.innerHTML = "There was an error and I could not talk to the server. Sorry.";
+ return;
+ }
+ var loginCookie = getLoginCookie();
+ var serverIP = serviceXML.getAttribute("serverip"); //we pass this in because Firefox and Applets on XP can resolve different IPs using load balanced DNS
var serviceURI = getServiceURI();
var html = "<applet id='viewer' archive='ogoglio-common.jar,ogoglio-viewer-applet.jar' codebase='" + serviceURI + "' code='com.ogoglio.viewer.applet.ViewerApplet' width='" + viewerWidth + "' height='" + viewerHeight + "' mayscript='true'>";
html += "<param name='loginCookie' value='" + loginCookie + "' />";
html += "<param name='serviceURI' value='" + serviceURI + "' />";
+ html += "<param name='serverIP' value='" + serverIP + "' />";
html += "<param name='spaceID' value='" + locationParameters['spaceID'] + "' />";
html += "<param name='image' value='" + appletLoadingImagePath + "' />";
if(viewerHelpMessage != null){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2008-02-07 12:20:52
|
Revision: 726
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=726&view=rev
Author: trevorolio
Date: 2008-02-07 04:20:53 -0800 (Thu, 07 Feb 2008)
Log Message:
-----------
More attachment work:
a first pass at a body editor UI
a template for Joe with just a texture containing shirts and pants
fixed up the populate mojo to read an attachment property out of template.properties
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/TemplatePersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-2.xml
maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-3.xml
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.css
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.js
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
Added Paths:
-----------
maven/trunk/ogoglio-server/src/main/resources/populate/template-90/
maven/trunk/ogoglio-server/src/main/resources/populate/template-90/JoeShirtAndPants.obj
maven/trunk/ogoglio-server/src/main/resources/populate/template-90/body.gif
maven/trunk/ogoglio-server/src/main/resources/populate/template-90/template.properties
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/TemplatePersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/TemplatePersistTasks.java 2008-02-07 12:20:35 UTC (rev 725)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/TemplatePersistTasks.java 2008-02-07 12:20:53 UTC (rev 726)
@@ -36,6 +36,8 @@
protected static final String TEMPLATE_BY_OWNER = "com.ogoglio.persist.templateByOwner";
+ public static final String TEMPLATES_BY_ATTACHMENT = "com.ogoglio.persist.templatesByAttachment";
+
public static TemplateRecord createTemplate(final String displayName, final String ownerUsername, SessionFactory sessionFactory) throws PersistException {
final TemplateRecord record = new TemplateRecord(displayName, ownerUsername);
HibernateTask task = new HibernateTask() {
@@ -91,6 +93,19 @@
return (TemplateRecord[]) task.execute();
}
+ public static TemplateRecord[] findAttachmentTemplates(SessionFactory sessionFactory) throws PersistException {
+ HibernateTask task = new HibernateTask() {
+ public Object run(Session session) throws PersistException {
+ Query query = session.getNamedQuery(TEMPLATES_BY_ATTACHMENT);
+ query.setBoolean("attachment", true);
+ return prepareTemplatesCollections(query);
+ }
+
+ };
+ task.setSessionFactory(sessionFactory);
+ return (TemplateRecord[]) task.execute();
+ }
+
private static TemplateRecord[] prepareTemplatesCollections(Query query) {
TemplateRecord[] allRecs = (TemplateRecord[]) query.list().toArray(new TemplateRecord[0]);
for (int i = 0; i < allRecs.length; ++i) {
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2008-02-07 12:20:35 UTC (rev 725)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2008-02-07 12:20:53 UTC (rev 726)
@@ -663,6 +663,7 @@
public class TemplateQueryResource extends AuthenticatedSiteResource {
public TemplateQueryResource() {
super("template", false, getSessionFactory());
+ addSubResource(new TemplateQueryAttachmentResource());
addSubResource(new TemplateQueryIDsResource());
}
@@ -671,6 +672,23 @@
}
}
+ public class TemplateQueryAttachmentResource extends AuthenticatedSiteResource {
+ public TemplateQueryAttachmentResource() {
+ super("attachment", false, getSessionFactory());
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
+ XMLElement result = new XMLElement("list");
+
+ TemplateRecord[] records = TemplatePersistTasks.findAttachmentTemplates(getSessionFactory());
+ for (int i = 0; i < records.length; i++) {
+ result.addChild(DocumentFactory.documentFromRecord(records[i]).toElement());
+ }
+
+ sendStringResponse(result.toString(), "text/xml", response);
+ }
+ }
+
public class TemplateQueryIDsResource extends AuthenticatedSiteResource {
public TemplateQueryIDsResource() {
super(SiteResource.WILDCARD_ELEMENT, true, getSessionFactory());
Modified: maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-2.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-2.xml 2008-02-07 12:20:35 UTC (rev 725)
+++ maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-2.xml 2008-02-07 12:20:53 UTC (rev 726)
@@ -259,6 +259,10 @@
<![CDATA[ from com.ogoglio.persist.TemplateRecord as template where template.templateID = :templateID ]]>
</query>
+ <query name="com.ogoglio.persist.templatesByAttachment">
+ <![CDATA[ from com.ogoglio.persist.TemplateRecord as template where template.attachment = :attachment ]]>
+ </query>
+
<query name="com.ogoglio.persist.templateByIDs">
<![CDATA[ from com.ogoglio.persist.TemplateRecord as template where template.templateID in ( :templateIDs ) ]]>
</query>
Modified: maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-3.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-3.xml 2008-02-07 12:20:35 UTC (rev 725)
+++ maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-3.xml 2008-02-07 12:20:53 UTC (rev 726)
@@ -257,6 +257,10 @@
<![CDATA[ from com.ogoglio.persist.TemplateRecord as template where template.templateID = :templateID ]]>
</query>
+ <query name="com.ogoglio.persist.templatesByAttachment">
+ <![CDATA[ from com.ogoglio.persist.TemplateRecord as template where template.attachment = :attachment ]]>
+ </query>
+
<query name="com.ogoglio.persist.templateByIDs">
<![CDATA[ from com.ogoglio.persist.TemplateRecord as template where template.templateID in ( :templateIDs ) ]]>
</query>
Added: maven/trunk/ogoglio-server/src/main/resources/populate/template-90/JoeShirtAndPants.obj
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/populate/template-90/JoeShirtAndPants.obj (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/populate/template-90/JoeShirtAndPants.obj 2008-02-07 12:20:53 UTC (rev 726)
@@ -0,0 +1 @@
+# This is intentionally empty
Added: maven/trunk/ogoglio-server/src/main/resources/populate/template-90/body.gif
===================================================================
(Binary files differ)
Property changes on: maven/trunk/ogoglio-server/src/main/resources/populate/template-90/body.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: maven/trunk/ogoglio-server/src/main/resources/populate/template-90/template.properties
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/populate/template-90/template.properties (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/populate/template-90/template.properties 2008-02-07 12:20:53 UTC (rev 726)
@@ -0,0 +1,2 @@
+
+attachment: true
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.css
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.css 2008-02-07 12:20:35 UTC (rev 725)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.css 2008-02-07 12:20:53 UTC (rev 726)
@@ -2,55 +2,56 @@
width: 300px;
height: 400px;
position: absolute;
- top: 20px;
- left: 205px;
+ top: 0px;
+ left: 0px;
}
-#leftControlDiv {
+#tabDiv {
+ margin: 0px;
+ padding: 0px;
+ width: 400px;
+ height: 400px;
position: absolute;
- top: 25px;
- left: 0px;
- width: 200px;
- height: 400px;
- overflow: auto;
- visibility: hidden;
+ top: 0px;
+ left: 310px;
}
-#rightControlDiv {
- position: absolute;
- top: 25px;
- left: 510px;
- width: 200px;
- height: 400px;
- visibility: hidden;
+#morphTable {
+ margin: 0px;
+ padding: 0px;
+ border: none;
}
-#topControlDiv {
- position: absolute;
- top: 0px;
- left: 25px;
- height: 20px;
- width: 100%;
- text-align: center;
- visibility: hidden;
+#morphTable td {
+ padding: 5px;
+ border: none;
}
-#topControlDiv form {
+.tab {
+ margin: 0px 0px 10px 0px;
+ padding: 0px;
+ width: 75px;
+ height: 100px;
display: inline;
}
-#bottomControlDiv {
+.tabbedControlDiv {
position: absolute;
- top: 435px;
+ top: 30px;
left: 0px;
- height: 30px;
- width: 100%;
+ width: 400px;
+ height: 370px;
+ overflow: auto;
visibility: hidden;
}
-#bottomControlDiv form {
+
+#bodyControlDiv {
display: inline;
}
+#bodyControlDiv form {
+ display: inline;
+}
#morphControls form {
display: inline;
@@ -61,6 +62,10 @@
width: 75px;
}
+#attachmentControlDiv form {
+ display: inline;
+}
+
#textureForm {
margin-top: 25px;
}
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html 2008-02-07 12:20:35 UTC (rev 725)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html 2008-02-07 12:20:53 UTC (rev 726)
@@ -60,32 +60,48 @@
<h2 id="title">Body Editor:</h2>
<div id="main">
- <div id="topControlDiv">
- <span id="bodyListControl"> </span>
- <span id="bodyDataControl"> </span>
+ <div id="tabDiv">
+ <div id="tabsDiv">
+ <div id="bodyTab" class="tab"><a onclick="showTab('bodyTab', 'bodyControlDiv'); return false;" href="body.html">Bodies</a></div>
+ <div id="morphTab" class="tab"><a onclick="showTab('morphTab', 'morphControlDiv'); return false;" href="body.html">Morphs</a></div>
+ <div id="animationTab" class="tab"><a onclick="showTab('animationTab', 'animationControlDiv'); return false;" href="body.html">Animations</a></div>
+ <div id="attachmentTab" class="tab"><a onclick="showTab('attachmentTab', 'attachmentControlDiv'); return false;" href="body.html">Attachments</a></div>
+ </div>
+ <div id="bodyControlDiv" class="tabbedControlDiv">
+ <h3>Body name: <span id="bodyListControl"> </span></h3>
+
+ <h3>Base body: <span id="bodyDataControl"> </span></h3>
+
+
+ <h3>Texture Selection: <span id="textureSelectionDiv"> </span></h3>
+
+
+ <h3>Custom Texture Upload:</h3>
+ <form id="textureForm" onsubmit="handleTextureForm();" target="textureTargetFrame" action="" enctype="multipart/form-data" method="post">
+ <input type="file" size="7" name="textureData" />
+ <input type="submit" value="upload custom skin" />
+ </form>
+ <form id="textureDeleteForm" onsubmit="textureDeleteGo(); return false;"><input style="text-align: right; margin-top: 20px;" type="submit" value="delete custom skin"/></form>
+ <iframe id="textureTargetFrame" name="textureTargetFrame" style="width: 1px; height: 1px;"></iframe>
+
+ <h3>Profile photo:</h3>
+ <form onsubmit="doSaveAccountPhoto(); return false"><input type="submit" value="save profile photo" /></form>
+ </div>
+ <div id="morphControlDiv" class="tabbedControlDiv">
+ <div id="morphControls"> </div>
+ <div id="saveControlDiv" style="text-align: center;">
+ <form onsubmit="doSave(); return false"><input type="submit" value="save" /></form>
+ </div>
+ </div>
+ <div id="animationControlDiv" class="tabbedControlDiv">
+ <div id="animationControls"> </div>
+ </div>
+ <div id="attachmentControlDiv" class="tabbedControlDiv">
+ <div id="attachmentControls"> </div>
+ </div>
</div>
- <div id="leftControlDiv">
- <div id="morphControls"> </div>
- </div>
- <div id="rightControlDiv">
- <div id="animationControls"> </div>
-
- <div id="textureSelectionDiv"> </div>
-
- <form id="textureForm" onsubmit="handleTextureForm();" target="textureTargetFrame" action="" enctype="multipart/form-data" method="post">
- <input type="file" size="7" name="textureData" />
- <input type="submit" value="upload custom skin" />
- </form>
- <form id="textureDeleteForm" onsubmit="textureDeleteGo(); return false;"><input type="submit" value="delete custom skin"/></form>
- <iframe id="textureTargetFrame" name="textureTargetFrame" style="width: 1px; height: 1px;"></iframe>
- </div>
-
+
<div id="appletDiv"> </div>
-
- <div id="bottomControlDiv" style="text-align: center;">
- <form onsubmit="doSave(); return false"><input type="submit" value="save" /></form>
- <form onsubmit="doSaveAccountPhoto(); return false"><input type="submit" value="save profile photo" /></form>
- </div>
</div> <!-- end main -->
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.js 2008-02-07 12:20:35 UTC (rev 725)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.js 2008-02-07 12:20:53 UTC (rev 726)
@@ -1,21 +1,44 @@
var loginCookie = getLoginCookie();
var appletDiv = null;
-var leftControlDiv = null;
-var rightControlDiv = null;
-var bottomControlDiv = null;
-var topControlDiv = null;
var textureSelectionDiv = null;
var textureForm = null;
var morphControls = null;
var animationControls = null;
var bodyListControl = null;
var bodyDataControl = null;
+var attachmentControls = null;
+var tabbedControlDivs = new Array();
+var bodyControlDiv = null;
+var morphControlDiv = null;
+var animationControlDiv = null;
+var attachmentDiv = null;
+
var bodyXML = null;
var bodyListXML = null;
-var bodyDataListXML = null
+var bodyDataListXML = null;
+var attachmentTemplateListXML = null;
+var oldTab = null;
+function showTab(tabID, controlDivID){
+ var tab = document.getElementById(tabID);
+ var controlDiv = document.getElementById(controlDivID);
+ for(var i=0; i < tabbedControlDivs.length; i++){
+ if(tabbedControlDivs[i] == controlDiv){
+ tabbedControlDivs[i].style.visibility = "visible";
+ } else {
+ tabbedControlDivs[i].style.visibility = "hidden";
+ }
+ }
+
+ if(oldTab != null){
+ oldTab.style.borderBottom = "none";
+ }
+ oldTab = tab;
+ tab.style.borderBottom = "solid 3px #666";
+}
+
function handleBodyAuth(){
if(loginCookie == null){
appletDiv.innerHTML = "<h2>Please log in to use this page.</h2>";
@@ -31,11 +54,8 @@
}
function stopAndDisplayError(errorMessage){
- topControlDiv.innerHTML = "";
- leftControlDiv.innerHTML = "";
- rightControlDiv.innerHTML = "";
- bottomControlDiv.innerHTML = "";
- centerControlDiv.innerHTML = errorMessage;
+ tabDiv.innerHTML = "";
+ appletDiv.innerHTML = errorMessage;
}
function handleBody(xml){
@@ -64,6 +84,16 @@
}
bodyDataListXML = xml;
+ requestAttachmentTemplateList(handleAttachmentTemplateList);
+}
+
+function handleAttachmentTemplateList(xml){
+ if(xml == null){
+ stopAndDisplayError("Could not load attachment template list");
+ return;
+ }
+ attachmentTemplateListXML = xml;
+
awaitInitialLoad();
}
@@ -82,15 +112,27 @@
var defaultBodyID = +bodyXML.getAttribute("bodyconfigurationid");
var ownerUsername = bodyXML.getAttribute("ownerusername");
- var morphHTML = "";
- for(var i = editor.getMorphCount() - 1; i >= 0; i--){
+ var numColumns = 3;
+ var morphHTML = "<table id='morphTable'>";
+ for(var i = 0; i < editor.getMorphCount(); i++){
+ if(i % numColumns == 0){
+ morphHTML += "<tr>";
+ }
+
var morphName = editor.getMorphName(i);
var settingValue = editor.getMorphSetting(morphName);
+ morphHTML += "<td>";
morphHTML += "<h4>" + morphName + ":</h4>";
morphHTML += "<form onsubmit='changeMorph(\"" + morphName + "\", 0.1);return false;'><input type='submit' value='+' name='" + morphName + "'></form>";
morphHTML += " <span id='" + morphName + " setting'>" + formatSettingValue(settingValue) + "</span> ";
morphHTML += "<form onsubmit='changeMorph(\"" + morphName + "\", -0.1);return false;'><input type='submit' value='-' name='" + morphName + "'></form>";
+ morphHTML += "</td>";
+
+ if(i % numColumns == numColumns - 1 || i == editor.getMorphCount() - 1){
+ morphHTML += "</tr>";
+ }
}
+ morphHTML += "</table>";
morphControls.innerHTML = morphHTML;
var animationHTML = "";
@@ -120,12 +162,17 @@
textureForm.action = appPath + "/account/" + ownerUsername + "/body/" + defaultBodyID + "/texture";
+ var bodyConfigurationXML = null;
+
var bodySwitcherHTML = "<form id='bodySwitcherForm' action='body.html' method='get' onsubmit='return false;'>";
bodySwitcherHTML += "<select id='bodySwitcher' onchange='bodySwitcherGo();' name='bodySwitcher'>";
for(var i=0; i < bodyListXML.childNodes.length; i++){
var displayName = bodyListXML.childNodes[i].getAttribute("displayname");
var bodyConfigurationID = bodyListXML.childNodes[i].getAttribute("bodyconfigurationid");
var selected = bodyListXML.childNodes[i].getAttribute("bodyconfigurationid") == bodyXML.getAttribute("bodyconfigurationid");
+ if(selected){
+ bodyConfigurationXML = bodyListXML.childNodes[i];
+ }
var selectedText = selected ? " selected='selected'" : "";
bodySwitcherHTML += "<option " + selectedText + " value='" + bodyConfigurationID + "'>" + escapeHTML(displayName) + "</option>";
}
@@ -148,13 +195,65 @@
bodyDataHTML += "</select>";
bodyDataHTML += "</form>";
bodyDataControl.innerHTML = bodyDataHTML;
+
+ writeAttachmentControls();
+
+ showTab("bodyTab", "bodyControlDiv");
+}
- topControlDiv.style.visibility = "visible";
- bottomControlDiv.style.visibility = "visible";
- leftControlDiv.style.visibility = "visible";
- rightControlDiv.style.visibility = "visible";
+function writeAttachmentControls(){
+ var attachmentHTML = "<ul>";
+ for(var i=0; i < attachmentTemplateListXML.childNodes.length; i++){
+ var node = attachmentTemplateListXML.childNodes[i];
+ var displayName = node.getAttribute("displayname");
+ var templateID = +node.getAttribute("templateid");
+ var ownerUsername = node.getAttribute("ownerusername");
+
+ attachmentHTML += "<br/>" + escapeHTML(displayName);
+
+ var attachmentID = getAttachmentID(templateID);
+ var selected = attachmentID == -1 ? "" : " checked='checked'";
+ attachmentHTML += " <form onsubmit='return false;'><input onchange='goAttachmentChange(\"" + ownerUsername + "\", " + templateID + ");' name='" + templateID + "' type='checkbox' " + selected + " /></form>";
+ }
+ attachmentHTML += "</ul>";
+ if(attachmentTemplateListXML.childNodes.length == 0){
+ attachmentHTML += "There are no available attachments. Dang.";
+ }
+ attachmentControls.innerHTML = attachmentHTML;
}
+function goAttachmentChange(ownerUsername, templateID){
+ var editor = document.getElementById("viewer");
+ var attachmentID = getAttachmentID(templateID);
+ if(attachmentID == -1){
+ editor.addAttachment(ownerUsername, templateID);
+ } else {
+ editor.removeAttachment(attachmentID + "");
+ }
+ requestDefaultBodyDocument(authedUsername, handleBodyPostAttachmentChange);
+ return true;
+}
+
+
+function handleBodyPostAttachmentChange(xml){
+ if(xml == null){
+ return;
+ }
+ bodyXML = xml;
+}
+
+function getAttachmentID(templateID){
+ for(var i=0; i < bodyXML.childNodes.length; i++){
+ if(bodyXML.childNodes[i].tagName != "attachment"){
+ continue;
+ }
+ if(+bodyXML.childNodes[i].getAttribute("templateid") == templateID){
+ return +bodyXML.childNodes[i].getAttribute("attachmentid");
+ }
+ }
+ return -1;
+}
+
function bodyDataSelectGo(){
var editor = document.getElementById("viewer");
var form = document.getElementById("bodyDataForm");
@@ -334,16 +433,27 @@
function initBodyEditor(){
appletDiv = document.getElementById("appletDiv");
- leftControlDiv = document.getElementById("leftControlDiv");
- rightControlDiv = document.getElementById("rightControlDiv");
- bottomControlDiv = document.getElementById("bottomControlDiv");
- topControlDiv = document.getElementById("topControlDiv");
+
+ bodyControlDiv = document.getElementById("bodyControlDiv");
+ if(bodyControlDiv == null){
+ alert("no control div");
+ return;
+ }
+ tabbedControlDivs[tabbedControlDivs.length] = bodyControlDiv;
+ morphControlDiv = document.getElementById("morphControlDiv");
+ tabbedControlDivs[tabbedControlDivs.length] = morphControlDiv;
+ animationControlDiv = document.getElementById("animationControlDiv");
+ tabbedControlDivs[tabbedControlDivs.length] = animationControlDiv;
+ attachmentControlDiv = document.getElementById("attachmentControlDiv");
+ tabbedControlDivs[tabbedControlDivs.length] = attachmentControlDiv;
+
bodyListControl = document.getElementById("bodyListControl");
bodyDataControl = document.getElementById("bodyDataControl");
textureSelectionDiv = document.getElementById("textureSelectionDiv");
textureForm = document.getElementById("textureForm");
morphControls = document.getElementById("morphControls");
animationControls = document.getElementById("animationControls");
+ attachmentControls = document.getElementById("attachmentControls");
addAuthListeners(handleBodyAuth, handleBodyAuth);
}
\ No newline at end of file
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2008-02-07 12:20:35 UTC (rev 725)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2008-02-07 12:20:53 UTC (rev 726)
@@ -644,6 +644,10 @@
new XMLRequestManager(appPath + "/account/" + username + "/template/", new BasicHTTPListener(listener)).send();
}
+function requestAttachmentTemplateList(listener){
+ new XMLRequestManager(appPath + "/account/template/attachment/", new BasicHTTPListener(listener)).send();
+}
+
function requestTemplate(username, templateID, listener){
new XMLRequestManager(appPath + "/account/" + username + "/template/" + templateID, new BasicHTTPListener(listener)).send();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2008-02-18 14:33:30
|
Revision: 755
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=755&view=rev
Author: trevorolio
Date: 2008-02-18 06:33:36 -0800 (Mon, 18 Feb 2008)
Log Message:
-----------
Cleanup tweakes and a log function in ogoglio.js which makes the firebug console much more useful.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/SpacePersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/SpacePersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/SpacePersistTasks.java 2008-02-18 14:31:48 UTC (rev 754)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/SpacePersistTasks.java 2008-02-18 14:33:36 UTC (rev 755)
@@ -258,9 +258,8 @@
}
private static SimRecord pickSimRandomly(final SpaceRecord spaceRecord, SessionFactory sessionFactory, SimRecord[] active) throws PersistException {
- SimRecord rec;
//pick randomly among actives
- rec = (SimRecord) active[Math.abs(RANDOM.nextInt() % active.length)];
+ SimRecord rec = (SimRecord) active[Math.abs(RANDOM.nextInt() % active.length)];
spaceRecord.setSimID(rec.getSimID());
updateRecordAndUpdateModifiedTime(spaceRecord, sessionFactory, true);
return rec;
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java 2008-02-18 14:31:48 UTC (rev 754)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java 2008-02-18 14:33:36 UTC (rev 755)
@@ -277,7 +277,6 @@
}
}
- // TODO is there a better way to shutdown this sim ?
public boolean shutdownSpaceSim(long spaceID) {
try {
SpaceRecord record = SpacePersistTasks.findSpaceBySpaceID(spaceID, sessionFactory);
@@ -286,7 +285,7 @@
return false;
}
if (simRecord.getSimID() != record.getSimID()) {
- Log.error("Tried to shut down space not on this sim: " + spaceID);
+ Log.error("Tried to shut down space "+ spaceID + " which is not on this sim (" + simRecord.getSimID() + ") but is on sim " + record.getSimID());
synchronized (spaceSimulators) {
spaceSimulators.removeForward(new Long(record.getSpaceID()));
}
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2008-02-18 14:31:48 UTC (rev 754)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2008-02-18 14:33:36 UTC (rev 755)
@@ -23,6 +23,14 @@
}
//BEGIN GENERAL UTILS
+function logXML(xml){
+ if(xml == null){
+ console.log("Null xml");
+ } else {
+ console.log(serializeXML(xml));
+ }
+}
+
function parseLocationParameters(){
var paramPhrases = location.search.substring(1, location.search.length).split("&");
var paramDict = new Object();
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2008-02-18 14:31:48 UTC (rev 754)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2008-02-18 14:33:36 UTC (rev 755)
@@ -102,7 +102,10 @@
var codeBase = getCodeBase(serverIP);
var html = "<applet id='viewer' archive='ogoglio-common.jar,ogoglio-viewer-applet.jar' codebase='" + codeBase + "' code='com.ogoglio.viewer.applet.ViewerApplet' width='" + viewerWidth + "' height='" + viewerHeight + "' mayscript='true'>";
- html += "<param name='loginCookie' value='" + loginCookie + "' />";
+ //html += "<param name='codebase_lookup' value='false'/>"; //speed up because we only use jars
+ //html += "<param name='noddraw.check' value='true'>"; //turn off DirectDraw on windows
+ //html += "<param name='noddraw.check.silent' value='true'>"; //but don't bother the user about turning off DirectDraw
+ html += "<param name='loginCookie' value='" + loginCookie + "' />";
html += "<param name='serviceURI' value='" + codeBase + "' />";
html += "<param name='serverIP' value='" + serverIP + "' />";
html += "<param name='spaceID' value='" + locationParameters['spaceID'] + "' />";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|