|
From: <tre...@us...> - 2007-08-30 20:40:13
|
Revision: 297
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=297&view=rev
Author: trevorolio
Date: 2007-08-30 13:40:07 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
Updated the info panel code and TestCube.js to reflect the change.
Modified Paths:
--------------
maven/trunk/ogoglio-server/pom.xml
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java
maven/trunk/ogoglio-server/src/main/webapp/spaceui.js
maven/trunk/ogoglio-server/src/main/webapp/thingPopup.html
maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.js
Modified: maven/trunk/ogoglio-server/pom.xml
===================================================================
--- maven/trunk/ogoglio-server/pom.xml 2007-08-30 19:00:17 UTC (rev 296)
+++ maven/trunk/ogoglio-server/pom.xml 2007-08-30 20:40:07 UTC (rev 297)
@@ -46,14 +46,21 @@
<include>migration-*.xml</include>
</includes>
</resource>
-
<resource>
<directory>src/main/resources/log4j</directory>
<includes>
<include>log4j.properties</include>
</includes>
</resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>mail/*</include>
+ </includes>
+ </resource>
+
</resources>
<!-- -->
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-30 19:00:17 UTC (rev 296)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java 2007-08-30 20:40:07 UTC (rev 297)
@@ -35,6 +35,7 @@
import com.ogoglio.client.model.Page;
import com.ogoglio.client.model.Shape;
import com.ogoglio.client.model.Thing;
+import com.ogoglio.client.model.User;
import com.ogoglio.sim.SpaceSimulator;
import com.ogoglio.util.ArgumentUtils;
import com.ogoglio.viewer.j3d.J3DSplineKeyFrame;
@@ -86,6 +87,15 @@
return System.currentTimeMillis();
}
+ public String[] jsFunction_getUsernames(){
+ User[] users = spaceSimulator.getSpace().getUsers();
+ String[] result = new String[users.length];
+ for (int i = 0; i < result.length; i++) {
+ result[i] = users[i].getUsername();
+ }
+ return result;
+ }
+
public String jsFunction_getSetting(String key) {
return spaceSimulator.getSetting(key);
}
@@ -151,6 +161,15 @@
spaceSimulator.setPageContent((long) thingID, (long) pageID, Page.TEXT_PLAIN, content);
}
+ public double[] jsFunction_getThingIDs(){
+ Thing[] things = spaceSimulator.getSpace().getThings();
+ double[] result = new double[things.length];
+ for (int i = 0; i < result.length; i++) {
+ result[i] = things[i].getThingID();
+ }
+ return result;
+ }
+
public ScriptPoint jsFunction_getThingPosition(double thingID) {
Thing thing = spaceSimulator.getSpace().getThing((long) thingID);
if (thing == null) {
Modified: maven/trunk/ogoglio-server/src/main/webapp/spaceui.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/spaceui.js 2007-08-30 19:00:17 UTC (rev 296)
+++ maven/trunk/ogoglio-server/src/main/webapp/spaceui.js 2007-08-30 20:40:07 UTC (rev 297)
@@ -205,25 +205,47 @@
if(infoDiv == null){
return;
}
+
var panelID = "infoPanel-" + id;
var infoPanelElement = document.createElement("div");
infoPanelElement.setAttribute("id", panelID);
infoPanelElement.setAttribute("class", "infoPanel");
- infoPanelElement.innerHTML = panelHTML;
+ infoPanelElement.style["background-color"] = "#EEE";
+
+ var infoActionDiv = document.createElement("div");
+ infoActionDiv.style.width = "100%";
+ infoActionDiv.style.textAlign = "right";
+ infoActionDiv.style.backgroundColor = "#F00";
+ var closeActionAnchor = document.createElement("a");
+ closeActionAnchor.setAttribute("href", "hmmm.html");
+ closeActionAnchor.setAttribute("onclick", "removeInfoPanel(" + id + "); return false;");
+ closeActionAnchor.appendChild(document.createTextNode("close"));
+ infoActionDiv.appendChild(closeActionAnchor);
+ infoPanelElement.appendChild(infoActionDiv);
+ var panelHTMLWrapperDiv = document.createElement("div");
+ panelHTMLWrapperDiv.innerHTML = panelHTML;
+ infoPanelElement.appendChild(panelHTMLWrapperDiv);
+
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();
+ infoPanelElement.focus();
}
}
+Array.prototype.remove=function(s){
+ for(i=0;i<this .length;i++){
+ if(s==this[i]) {
+ this.splice(i, 1);
+ break;
+ }
+ }
+}
+
function removeInfoPanel(id){
var infoDiv = document.getElementById("infoDiv");
if(infoDiv == null){
@@ -233,7 +255,7 @@
return;
}
infoDiv.removeChild(infoPanels[id]);
- infoPanels[id] = null;
+ infoPanels.remove(infoPanels[id]);
}
// 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.
Modified: maven/trunk/ogoglio-server/src/main/webapp/thingPopup.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/thingPopup.html 2007-08-30 19:00:17 UTC (rev 296)
+++ maven/trunk/ogoglio-server/src/main/webapp/thingPopup.html 2007-08-30 20:40:07 UTC (rev 297)
@@ -57,7 +57,7 @@
}
thingXML = xml;
- title.innerHTML = "Thing: " + xml.getAttribute('displayname');
+ title.innerHTML = escapeHTML(xml.getAttribute('displayname'));
xPosInput.value = parseFloat(thingXML.getAttribute('x')).toFixed(2);
yPosInput.value = parseFloat(thingXML.getAttribute('y')).toFixed(2);
zPosInput.value = parseFloat(thingXML.getAttribute('z')).toFixed(2);
@@ -193,7 +193,7 @@
<style type="text/css">
.section input[type=submit] {
- width: 100px;
+ width: 60px;
}
.section input[type=text] {
width: 70px;
Modified: maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.js
===================================================================
--- maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.js 2007-08-30 19:00:17 UTC (rev 296)
+++ maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.js 2007-08-30 20:40:07 UTC (rev 297)
@@ -18,25 +18,23 @@
}
function onContextClick(person, shapeName){
- space.log(person + " context clicked " + thingID + " on its " + shapeName);
-
- i1 = new ContextMenuInfo("Google",true,"google");
- i2 = new ContextMenuInfo("Yahoo",true,"yahoo");
- i3 = new ContextMenuInfo("Altavista",false,"NOTUSED");
- i4 = new ContextMenuInfo("Transmutable",true,"transmutable");
-
- return new Array(i1,i2,i3,i4);
+ var moveItem = new ContextMenuInfo("Move",true,"move");
+ var monkeyItem = new ContextMenuInfo("Monkey", true, "monkey");
+ var deadItem = new ContextMenuInfo("Groove",false,"groove");
+ return new Array(moveItem, monkeyItem, deadItem);
}
-function onContextMenuItemChosen(username,id)
-{
- var key = "favoriteSite";
- var preferred = space.getSetting(key);
-
- space.putSetting(key,id);
-
- //causes browser to jump to that page!
- return "http://www."+id+".com/";
+function onContextMenuItemChosen(username,id){
+ if(id == "move"){
+ var iFrameURL = "/og/thingPopup.html?thingID=" + thingID + "&spaceID=" + space.id;
+ var style = "width: 270px; height: 420px;";
+ space.showInfoPanel(thingID, username, "<iframe src='" + iFrameURL + "' style='" + style + "' />");
+ return "Showed move info panel";
+ } else if (id == "monkey") {
+ space.showInfoPanel(thingID, username, "<div><img src='/og/icons/32x32/face-monkey.png'/></div> ");
+ return "Showed Monkey";
+ } else {
+ return "Unknown item";
+ }
}
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|