|
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.
|