|
From: <ian...@us...> - 2007-08-31 16:30:10
|
Revision: 304
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=304&view=rev
Author: iansmith
Date: 2007-08-31 08:15:02 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
Massive upgrade in pom logic.
Tomcat now behaves properly.
Converted server to use null velocity templates.
Modified Paths:
--------------
maven/trunk/ogoglio/pom.xml
maven/trunk/ogoglio-appdev/pom.xml
maven/trunk/ogoglio-body-editor-applet/pom.xml
maven/trunk/ogoglio-common/pom.xml
maven/trunk/ogoglio-integration-test/pom.xml
maven/trunk/ogoglio-server/pom.xml
maven/trunk/ogoglio-test-applet/pom.xml
maven/trunk/ogoglio-viewer-applet/pom.xml
Added Paths:
-----------
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/GrayCheckmark.gif
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/GreenCheckmark.gif
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/account.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/admin.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/browserTests.js
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/createAccount.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/doorPopup.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/icons/
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/index.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/inventory.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/licenses.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/reset.css
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/signin.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/site.js
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/space.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceEditor.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceEmbed.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spacePopulation.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceSettings.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/style.css
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/templateEditor.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/thingPopup.html
Removed Paths:
-------------
maven/trunk/ogoglio-server/src/main/webapp/GrayCheckmark.gif
maven/trunk/ogoglio-server/src/main/webapp/GreenCheckmark.gif
maven/trunk/ogoglio-server/src/main/webapp/account.html
maven/trunk/ogoglio-server/src/main/webapp/admin.html
maven/trunk/ogoglio-server/src/main/webapp/body.html
maven/trunk/ogoglio-server/src/main/webapp/browserTests.js
maven/trunk/ogoglio-server/src/main/webapp/createAccount.html
maven/trunk/ogoglio-server/src/main/webapp/doorPopup.html
maven/trunk/ogoglio-server/src/main/webapp/icons/
maven/trunk/ogoglio-server/src/main/webapp/index.html
maven/trunk/ogoglio-server/src/main/webapp/inventory.html
maven/trunk/ogoglio-server/src/main/webapp/licenses.html
maven/trunk/ogoglio-server/src/main/webapp/ogoglio.js
maven/trunk/ogoglio-server/src/main/webapp/reset.css
maven/trunk/ogoglio-server/src/main/webapp/signin.html
maven/trunk/ogoglio-server/src/main/webapp/site.js
maven/trunk/ogoglio-server/src/main/webapp/space.html
maven/trunk/ogoglio-server/src/main/webapp/spaceEditor.html
maven/trunk/ogoglio-server/src/main/webapp/spaceEmbed.html
maven/trunk/ogoglio-server/src/main/webapp/spacePopulation.html
maven/trunk/ogoglio-server/src/main/webapp/spaceSettings.html
maven/trunk/ogoglio-server/src/main/webapp/spaceui.js
maven/trunk/ogoglio-server/src/main/webapp/style.css
maven/trunk/ogoglio-server/src/main/webapp/templateEditor.html
maven/trunk/ogoglio-server/src/main/webapp/thingPopup.html
Modified: maven/trunk/ogoglio/pom.xml
===================================================================
--- maven/trunk/ogoglio/pom.xml 2007-08-31 14:21:53 UTC (rev 303)
+++ maven/trunk/ogoglio/pom.xml 2007-08-31 15:15:02 UTC (rev 304)
@@ -26,7 +26,7 @@
<!-- tomcat configuration -->
<configuration>
- <home>/tmp/tomcat5x</home>
+ <home>${ogoglio.tmp.tomcat5x}</home>
<properties>
<cargo.servlet.port>
8080
Modified: maven/trunk/ogoglio-appdev/pom.xml
===================================================================
--- maven/trunk/ogoglio-appdev/pom.xml 2007-08-31 14:21:53 UTC (rev 303)
+++ maven/trunk/ogoglio-appdev/pom.xml 2007-08-31 15:15:02 UTC (rev 304)
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-appdev</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
@@ -37,7 +37,7 @@
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-common</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Modified: maven/trunk/ogoglio-body-editor-applet/pom.xml
===================================================================
--- maven/trunk/ogoglio-body-editor-applet/pom.xml 2007-08-31 14:21:53 UTC (rev 303)
+++ maven/trunk/ogoglio-body-editor-applet/pom.xml 2007-08-31 15:15:02 UTC (rev 304)
@@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-body-editor-applet</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
@@ -39,7 +39,7 @@
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-common</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Modified: maven/trunk/ogoglio-common/pom.xml
===================================================================
--- maven/trunk/ogoglio-common/pom.xml 2007-08-31 14:21:53 UTC (rev 303)
+++ maven/trunk/ogoglio-common/pom.xml 2007-08-31 15:15:02 UTC (rev 304)
@@ -7,7 +7,7 @@
<!-- About this project -->
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-common</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
<build>
Modified: maven/trunk/ogoglio-integration-test/pom.xml
===================================================================
--- maven/trunk/ogoglio-integration-test/pom.xml 2007-08-31 14:21:53 UTC (rev 303)
+++ maven/trunk/ogoglio-integration-test/pom.xml 2007-08-31 15:15:02 UTC (rev 304)
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-integration-test</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
@@ -86,109 +86,8 @@
</execution>
</executions>
</plugin>
- <!-- CARGO FOR STOP/START THE SERVER -->
- <plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <version>0.3-SNAPSHOT</version>
- <executions>
- <execution>
- <id>get-up</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- <configuration>
- <wait>false</wait>
- </configuration>
- </execution>
-
- <execution>
- <id>get-down</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
-
- <configuration>
- <wait>true</wait>
- <type>runtime</type>
- </configuration>
- </execution>
- <execution>
- <!-- get rid of leftover tomcat's if they exist -->
- <id>kill if exists</id>
- <phase>test</phase> <!-- just needs to be before integration test -->
- <goals>
- <goal>stop</goal>
- </goals>
- <configuration>
- <type>runtime</type>
- <wait>false</wait>
- </configuration>
- </execution>
- </executions>
-
- <!-- CARGO CONFIG -->
- <configuration>
- <!-- tomcat 5.5 running on the same machine...-->
- <container>
- <containerId>tomcat5x</containerId>
- <home>${cargo.tomcat5x.home}</home>
- <type>installed</type>
- <log>
- ${project.build.directory}/tomcat5x.log
- </log>
- <output>
- ${project.build.directory}/tomcat5x.out
- </output>
- <logLevel>debug</logLevel>
- </container>
-
- <!-- tomcat configuration -->
- <configuration>
- <home>${project.build.directory}/tomcat5x</home>
- <properties>
- <cargo.servlet.port>
- 8080
- </cargo.servlet.port>
- <cargo.logging>high</cargo.logging>
- </properties>
- <!-- our app to deploy -->
- <deployables>
- <deployable>
-
- <groupId>com.ogoglio</groupId>
- <artifactId>ogoglio-server</artifactId>
- <type>war</type>
-
- <properties>
- <context>ogoglio-server</context>
- </properties>
-
- </deployable>
- </deployables>
-
- </configuration>
- </configuration>
-
- </plugin>
-
</plugins>
</build>
- <!-- -->
- <!-- PLUGIN REPOS -->
- <!-- -->
- <pluginRepositories>
- <!-- CARGO -->
- <pluginRepository>
- <id>codehaus snapshot repository</id>
- <url>http://snapshots.repository.codehaus.org/</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- </pluginRepository>
- </pluginRepositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -201,18 +100,18 @@
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-server</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-common</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-viewer-applet</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
Modified: maven/trunk/ogoglio-server/pom.xml
===================================================================
--- maven/trunk/ogoglio-server/pom.xml 2007-08-31 14:21:53 UTC (rev 303)
+++ maven/trunk/ogoglio-server/pom.xml 2007-08-31 15:15:02 UTC (rev 304)
@@ -7,7 +7,16 @@
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-server</artifactId>
<packaging>war</packaging>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <distributionManagement>
+ <snapshotRepository>
+ <id>local-disk</id>
+ <uniqueVersion>false</uniqueVersion>
+ <name>local disk</name>
+ <url>${my.local.repo}</url>
+ </snapshotRepository>
+ </distributionManagement>
<!-- -->
<!-- profiles -->
@@ -59,8 +68,12 @@
<include>mail/*</include>
</includes>
</resource>
-
-
+ <resource>
+ <directory>src/main/resources</directory>
+ <excludes>
+ <exclude>siteTemplates</exclude>
+ </excludes>
+ </resource>
</resources>
<!-- -->
@@ -85,11 +98,29 @@
<!-- PLUGINS -->
<!-- -->
<plugins>
- <!-- CARGO -->
-
-
+ <!-- our own plugin for building the static code -->
+ <plugin>
+ <groupId>com.ogoglio</groupId>
+ <artifactId>dev-plugins</artifactId>
+ <executions>
+ <execution>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>buildHtml</goal>
+ </goals>
+ <configuration>
+ <templateDirectory>
+ src/main/resources/siteTemplates
+ </templateDirectory>
+ <targetDirectory>
+ target/${artifactId}-${version}
+ </targetDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
<!-- DEPENDENCY PLUGIN: We need to pull in applets -->
-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
@@ -101,25 +132,35 @@
<goal>copy</goal>
</goals>
<configuration>
- <outputDirectory>${project.build.directory}/ogoglio-server-0.0.1</outputDirectory>
+ <outputDirectory>
+ ${project.build.directory}/ogoglio-server-0.0.1
+ </outputDirectory>
<overwriteIfNewer>true</overwriteIfNewer>
<stripVersion>true</stripVersion>
<artifactItems>
<artifactItem>
<groupId>com.ogoglio</groupId>
- <artifactId>ogoglio-viewer-applet</artifactId>
+ <artifactId>
+ ogoglio-viewer-applet
+ </artifactId>
</artifactItem>
<artifactItem>
<groupId>com.ogoglio</groupId>
- <artifactId>ogoglio-body-editor-applet</artifactId>
+ <artifactId>
+ ogoglio-body-editor-applet
+ </artifactId>
</artifactItem>
<artifactItem>
<groupId>com.ogoglio</groupId>
- <artifactId>ogoglio-test-applet</artifactId>
+ <artifactId>
+ ogoglio-test-applet
+ </artifactId>
</artifactItem>
<artifactItem>
<groupId>com.ogoglio</groupId>
- <artifactId>ogoglio-common</artifactId>
+ <artifactId>
+ ogoglio-common
+ </artifactId>
</artifactItem>
</artifactItems>
</configuration>
@@ -140,7 +181,38 @@
</webResources>
</configuration>
</plugin>
-
+ <!-- CARGO FOR DEPLOY SERVER -->
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>0.3-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>install</id>
+ <phase>integration-test</phase> <!-- just must be after packaging -->
+ <goals><goal>deploy</goal></goals>
+ <!-- CARGO CONFIG -->
+ <configuration>
+ <container>
+ <containerId>tomcat5x</containerId>
+ </container>
+ <!-- Configuration to use with the container -->
+ <configuration>
+ <type>existing</type>
+ <home>${ogoglio.tmp.tomcat5x}</home>
+ <!-- Deployer configuration -->
+ <deployables>
+ <deployable>
+ <properties>
+ <context>${pom.artifactId}</context>
+ </properties>
+ </deployable>
+ </deployables>
+ </configuration>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
@@ -195,33 +267,32 @@
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-common</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-appdev</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
</dependency>
-
<!-- -->
<!-- BOGUS DEPENDENCIES-->
<!-- -->
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-viewer-applet</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-body-editor-applet</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-test-applet</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
Added: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/GrayCheckmark.gif
===================================================================
(Binary files differ)
Property changes on: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/GrayCheckmark.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/GreenCheckmark.gif
===================================================================
(Binary files differ)
Property changes on: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/GreenCheckmark.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/account.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/account.html (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/account.html 2007-08-31 15:15:02 UTC (rev 304)
@@ -0,0 +1,269 @@
+<!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="ogoglio.js"></script>
+<script type="text/javascript" src="site.js"></script>
+
+<title>Ogoglio Example: account</title>
+<style type="text/css">
+#main {
+ overflow: hidden;
+ width: 750px;
+}
+
+#content {
+ width: 500px;
+ border-right: 250px solid #FFF;
+ margin-right: -250px;
+ float: left;
+}
+
+#rail {
+ background-color: #FFF;
+ width: 250px;
+ float: left;
+}
+
+.section {
+ border: solid 1px #CCD;
+ border-top: solid 5px #CCD;
+ margin: 0px 25px 10px 0px;
+ padding: 0px 5px 5px 5px;
+}
+
+#profileTable th {
+ text-align: right;
+}
+
+.includedFeedItem {
+ margin-top: 10px;
+}
+</style>
+<script type="text/javascript">
+var requestedUsername = locationParameters['username'];
+var spaceListXML = null;
+
+var mainElement = null;
+var titleUserElement = null;
+//var titleAccountElement = null;
+var inventoryLink = null;
+var spaceListTable = null;
+var spaceMembershipTable = null;
+var profileTable = null;
+var profileGoButton = null;
+var bodyLink = null;
+
+function handleAuth(){
+ if(requestedUsername == null){
+ mainElement.innerHTML = "<h2>No Account Requested</h2>";
+ return;
+ }
+
+ if(authedUsername == null || (authedUsername != requestedUsername)){
+ mainElement.innerHTML = "<h2>You're not logged in to this account.</h2>";
+ return;
+ }
+
+ inventoryLink.innerHTML = "<a href='inventory.html?username=" + requestedUsername + "'>Check your inventory »</a>"
+
+ requestAccountDocument(requestedUsername, handleAccount);
+ requestSpaceList(requestedUsername, handleSpaceList);
+ requestAccountMembership(requestedUsername, handleMembership);
+}
+
+function handleMembership(membershipXML){
+ if(membershipXML == null) return;
+
+ var tableHTML = "";
+ for(var i=0; i < membershipXML.childNodes.length; i++){
+ var spaceID = membershipXML.childNodes[i].getAttribute("spaceid");
+ var banned = membershipXML.childNodes[i].getAttribute("banned");
+ var role = membershipXML.childNodes[i].getAttribute("role");
+ if(i == 0){
+ tableHTML += "<tr><th>role</th><th>space</th></tr>"
+ }
+ tableHTML += "<tr>";
+ if("true" == banned){
+ tableHTML += "<td>banned</td>";
+ } else {
+ tableHTML += "<td>" + escapeHTML(role) + "</td>";
+ }
+ tableHTML += "<td><a href='space.html?spaceID=" + spaceID + "'>Space " + escapeHTML(spaceID) + "</a></td>";
+ tableHTML += "</tr>";
+ }
+ spaceMembershipTable.innerHTML = "<table>" + tableHTML + "</table>";
+}
+
+function createNewSpace(spaceName){
+ createSpace(requestedUsername, spaceName, handleNewSpace);
+}
+
+function handleNewSpace(xml){
+ requestSpaceList(requestedUsername, handleSpaceList);
+}
+
+function handleSpaceList(xml){
+ if(xml == null) return;
+
+ spaceListXML = xml;
+ setSpaceListFromSpaceListXML();
+}
+
+function setSpaceListFromSpaceListXML() {
+ if(spaceListXML == null){
+ return;
+ }
+ var tableHTML = "";
+ for(var i=0; i < spaceListXML.childNodes.length; i++){
+ var spaceID = spaceListXML.childNodes[i].getAttribute("spaceid");
+ var displayName = spaceListXML.childNodes[i].getAttribute("displayname");
+ tableHTML += "<tr>";
+ tableHTML += "<td>" + escapeHTML(displayName) + "</td>";
+ tableHTML += "<td><form onsubmit='document.location.href=\"space.html?spaceID=" + spaceID + "\"; return false;'><input type='submit' value='view'/></form></td>";
+ tableHTML += "<td><form onsubmit='document.location.href=\"spaceEditor.html?spaceID=" + spaceID + "\"; return false;'><input type='submit' value='edit'/></form></td>";
+ tableHTML += "</tr>";
+ }
+ spaceListTable.innerHTML = "<table>" + tableHTML + "</table>";
+}
+
+function handleAccount(xml){
+ if(xml == null){
+ return;
+ }
+ accountXML = xml;
+
+ titleUserElement.innerHTML = "User: " + accountXML.getAttribute("username");
+ //titleAccountElement.innerHTML = "Account Type: " + accountXML.getAttribute("accountlevel");
+ bodyLink.innerHTML = "<a href='body.html?bodyID=" + accountXML.getAttribute('defaultbodyid') + "'>Edit your body »</a>"
+ setProfileFromAccountXML();
+}
+
+function setProfileFromAccountXML(){
+ var tableHTML = generateProfileRow("email", "email", accountXML.getAttribute("email"), false);
+ tableHTML += generateProfileRow("first name", "firstname", accountXML.getAttribute("firstname"), false);
+ tableHTML += generateProfileRow("last name", "lastname", accountXML.getAttribute("lastname"), false);
+ tableHTML += generateProfileRow("homepage", "homepage", accountXML.getAttribute("homepage"), true);
+ profileTable.innerHTML = "<table>" + tableHTML + "</table>";
+}
+
+function profileGo(){
+ if(profileGoButton.value == "edit"){
+ var tableHTML = "<tr><th>email:</th><td>" + accountXML.getAttribute("email") + "</td><td></td></tr>";
+ tableHTML += generateProfileInput("first name", "firstname", accountXML.getAttribute("firstname"));
+ tableHTML += generateProfileInput("last name", "lastname", accountXML.getAttribute("lastname"));
+ tableHTML += generateProfileInput("homepage", "homepage", accountXML.getAttribute("homepage"));
+ tableHTML += generateProfileInput("password", "password", null, "blank leaves as-is");
+ tableHTML += generateProfileInput("again", "password2", null);
+ profileTable.innerHTML = "<table>" + tableHTML + "</table>";
+ profileGoButton.value = "save";
+ } else if(profileGoButton.value == "save"){
+ if(document.getElementById('password').value != document.getElementById('password2').value){
+ alert("Passwords 1 and 2 don't match.");
+ return;
+ }
+
+ profileGoButton.value = "edit";
+
+ accountXML.setAttribute("firstname", escapeHTML(document.getElementById("firstname").value));
+ accountXML.setAttribute("lastname", escapeHTML(document.getElementById("lastname").value));
+ accountXML.setAttribute("homepage", escapeHTML(document.getElementById("homepage").value));
+ accountXML.setAttribute("password", escapeHTML(document.getElementById("password").value));
+ updateAccountDocument(accountXML, handleAccount);
+ profileTable.innerHTML = "saving...";
+ }
+}
+
+function generateProfileRow(heading, field, value, link){
+ if(value == null || value.length === 0){
+ return "";
+ }
+ if(link){
+ return "<tr><th>" + heading + ":</th><td><a rel='nofollow' href='" + escapeHTML(value) +"'>" + escapeHTML(value) + "</a></td></tr>\n";
+ } else {
+ return "<tr><th>" + heading + ":</th><td>" + escapeHTML(value) + "</td></tr>\n";
+ }
+}
+
+function generateProfileInput(heading, field, value, comment) {
+ var nonNullValue = value == null ? "" : value;
+ var nonNullComment = comment == null ? "" : comment;
+ var result = "<tr><th>" + heading + ":</th><td><input id='" + field + "' name='" + field + "' type='text' value='" + escapeHTML(nonNullValue) + "' /></td><td>" + escapeHTML(nonNullComment) + "</td></tr>\n";
+ return result;
+}
+
+function init(){
+ populateMemberMenuItem();
+
+ titleUserElement = document.getElementById("titleUser");
+ //titleAccountElement = document.getElementById("titleAccount");
+ mainElement = document.getElementById("main");
+ inventoryLink = document.getElementById("inventoryLink");
+ spaceListTable = document.getElementById("spaceListTable");
+ spaceMembershipTable = document.getElementById("spaceMembershipTable");
+ profileGoButton = document.getElementById("profileGoButton");
+ profileTable = document.getElementById("profileTable");
+ bodyLink = document.getElementById("bodyLink");
+
+ addAuthListeners(handleAuth, handleAuth);
+}
+</script>
+</head>
+<body onload="init();">
+<div id="header">
+ <strong><a href="index.html">Ogoglio Example</a></strong>
+ <span id="search">
+ <!-- <form style="margin: 0px;" method="get" action="http://www.google.com/search">
+ <input type="text" size="20" name="q"/>
+ <input type="hidden" name="q" value="site:example.com"/>
+ <input type="submit" value="find"/>
+ </form> -->
+ </span>
+</div> <!-- end header -->
+
+<div id="headerMenu">
+ <a href="index.html">Home</a>
+ <span id="memberMenuItem"> </span>
+</div> <!-- end header menu -->
+
+<div id="main">
+ <h2 id="titleUser">User: loading...</h2>
+ <!-- <h3 id="titleAccount">Account Type: loading...</h3> -->
+
+ <div id="content">
+ <div class="section">
+ <h3>Profile: <input id="profileGoButton" onclick="profileGo(); return false;" type="submit" value="edit"/></h3>
+ <form id='profileForm'>
+ <div id="profileTable">
+ loading...
+ </div>
+ </form>
+ </div>
+
+ <div class="section">
+ <h3>Your spaces:</h3>
+ <div id="spaceListTable">
+ loading...
+ </div>
+ <form onsubmit="createNewSpace('New Space'); return false;"><input type="submit" value="create a new space"/></form>
+ </div>
+
+ <p class="navLink" id="bodyLink"></p>
+ <p class="navLink" id="inventoryLink"></p>
+ </div><!-- end content -->
+
+ <div id="rail">
+ <div class="section">
+ <h3>Space membership:</h3>
+ <div id="spaceMembershipTable">
+ loading...
+ </div>
+ </div>
+ </div><!-- end rail -->
+</div> <!-- end main -->
+<div id="footer">
+
+</div>
+<!-- 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>
\ No newline at end of file
Added: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/admin.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/admin.html (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/admin.html 2007-08-31 15:15:02 UTC (rev 304)
@@ -0,0 +1,264 @@
+<!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>
+
+<title>Ogoglio Example: admin</title>
+
+<style type="text/css">
+#main {
+ overflow: hidden;
+ width: 7680px;
+}
+
+#content {
+ width: 768px;
+ float: left;
+}
+
+#rail {
+ background-color: #FFF;
+ width: 250px;
+ float: left;
+}
+
+.section {
+ border: solid 1px #CCD;
+ border-top: solid 5px #CCD;
+ margin: 0px 25px 10px 0px;
+ padding: 0px 5px 5px 5px;
+}
+
+#profileTable th {
+ text-align: right;
+}
+
+.includedFeedItem {
+ margin-top: 10px;
+}
+</style>
+<script type="text/javascript">
+var requestedUsername = locationParameters['username'];
+
+var mainElement = null;
+var titleUserElement = null;
+var profileTable = null;
+var profileGoButton = null;
+var freezeDiv = null;
+var levelDiv = null;
+
+function handleAuth(){
+ if(requestedUsername == null){
+ mainElement.innerHTML = "<h2>No Account Requested</h2>";
+ return;
+ }
+
+ if(authedUsername == null){
+ mainElement.innerHTML = "<h2>You must log in as an admin.</h2>";
+ return;
+ }
+ requestAccountDocument(authedUsername, handleAdminTest);
+}
+
+function handleAdminTest(xml){
+ if(xml == null){
+ mainElement.innerHTML = "<h2>There was an error checking your account for admin access.</h2>";
+ return;
+ }
+ if("admin" != xml.getAttribute("accountlevel")){
+ mainElement.innerHTML = "<h2>You must be an admin to use this page.</h2>";
+ return;
+ }
+ requestAccountDocument(requestedUsername, handleAccount);
+}
+
+function handleAccount(xml){
+ if(xml == null){
+ mainElement.innerHTML = "<h2>Could not find that user: " + requestedUsername + "</h2>";
+ return;
+ }
+ accountXML = xml;
+
+ titleUserElement.innerHTML = "Administer User: " + accountXML.getAttribute("username");
+ setProfileFromAccountXML();
+}
+
+function setProfileFromAccountXML(){
+ var tableHTML = generateProfileRow("email", "email", accountXML.getAttribute("email"), false);
+ tableHTML += generateProfileRow("first name", "firstname", accountXML.getAttribute("firstname"), false);
+ tableHTML += generateProfileRow("last name", "lastname", accountXML.getAttribute("lastname"), false);
+ tableHTML += generateProfileRow("homepage", "homepage", accountXML.getAttribute("homepage"), true);
+ profileTable.innerHTML = "<table>" + tableHTML + "</table>";
+
+ var freezeHTML = "";
+ if(accountXML.getAttribute("frozenuntil")){
+ var date = new Date();
+ date.setTime(accountXML.getAttribute("frozenuntil"));
+ freezeHTML += "frozen until:<div style='color: #F00; margin: 10px;'>" + date + "</div>";
+ freezeHTML += "<form onsubmit='freezeGo(); return false;'><input type='submit' value='thaw' /></form>";
+ } else {
+ freezeHTML += "not frozen:<br/><br/>";
+ freezeHTML += "<form onsubmit='freezeGo(); return false;'><input type='submit' value='freeze' /></form>";
+ }
+ freezeDiv.innerHTML = freezeHTML;
+
+ //basic, advanced, pro, or admin
+ var levelHTML = "";
+ levelHTML += '<form id="levelForm">';
+ levelHTML += '<select onchange="levelFormGo(); return false;" id="levelSelect" name="level">';
+ levelHTML += '<option value="basic">basic</option>';
+ levelHTML += '<option value="advanced">advanced</option>';
+ levelHTML += '<option value="pro">pro</option>';
+ levelHTML += '<option value="admin">admin</option>';
+ levelHTML += '</select>';
+ levelHTML += '</form>';
+ levelDiv.innerHTML = levelHTML;
+
+ var currentLevel = accountXML.getAttribute("accountlevel");
+ var levelForm = document.getElementById("levelForm");
+ if(currentLevel == 'basic'){
+ levelForm.levelSelect.selectedIndex = 0;
+ } else if (currentLevel == 'advanced'){
+ levelForm.levelSelect.selectedIndex = 1;
+ } else if (currentLevel == 'pro'){
+ levelForm.levelSelect.selectedIndex = 2;
+ } else if (currentLevel == 'admin'){
+ levelForm.levelSelect.selectedIndex = 3;
+ }
+}
+
+function levelFormGo(){
+ var currentLevel = accountXML.getAttribute("accountlevel");
+ var levelForm = document.getElementById("levelForm");
+ var newLevel = levelForm.levelSelect.options[levelForm.levelSelect.selectedIndex].value;
+ if(newLevel == currentLevel){
+ return;
+ }
+ accountXML.setAttribute("accountlevel", newLevel);
+ updateAccountDocument(accountXML, handleAccount);
+}
+
+function freezeGo(){
+ if(accountXML.getAttribute("frozenuntil")){
+ accountXML.setAttribute("frozenuntil", 1000);
+ updateAccountDocument(accountXML, handleAccount);
+ profileTable.innerHTML = "thawing...";
+ } else {
+ accountXML.setAttribute("frozenuntil", new Date().getTime() + 1135296000000);
+ updateAccountDocument(accountXML, handleAccount);
+ profileTable.innerHTML = "freezing...";
+ }
+}
+
+function profileGo(){
+ if(profileGoButton.value == "edit"){
+ var tableHTML = "<tr><th>email:</th><td>" + accountXML.getAttribute("email") + "</td><td></td></tr>";
+ tableHTML += generateProfileInput("first name", "firstname", accountXML.getAttribute("firstname"));
+ tableHTML += generateProfileInput("last name", "lastname", accountXML.getAttribute("lastname"));
+ tableHTML += generateProfileInput("homepage", "homepage", accountXML.getAttribute("homepage"));
+ tableHTML += generateProfileInput("password", "password", null, "blank leaves as-is");
+ tableHTML += generateProfileInput("again", "password2", null);
+
+ profileTable.innerHTML = "<table>" + tableHTML + "</table>";
+ profileGoButton.value = "save";
+ } else if(profileGoButton.value == "save"){
+ if(document.getElementById('password').value != document.getElementById('password2').value){
+ alert("Passwords 1 and 2 don't match.");
+ return;
+ }
+
+ profileGoButton.value = "edit";
+
+ accountXML.setAttribute("firstname", escapeHTML(document.getElementById("firstname").value));
+ accountXML.setAttribute("lastname", escapeHTML(document.getElementById("lastname").value));
+ accountXML.setAttribute("homepage", escapeHTML(document.getElementById("homepage").value));
+ accountXML.setAttribute("password", escapeHTML(document.getElementById("password").value));
+ updateAccountDocument(accountXML, handleAccount);
+ profileTable.innerHTML = "saving...";
+ }
+}
+
+function generateProfileRow(heading, field, value, link){
+ if(value == null || value.length === 0){
+ return "";
+ }
+ if(link){
+ return "<tr><th>" + heading + ":</th><td><a rel='nofollow' href='" + escapeHTML(value) +"'>" + escapeHTML(value) + "</a></td></tr>\n";
+ } else {
+ return "<tr><th>" + heading + ":</th><td>" + escapeHTML(value) + "</td></tr>\n";
+ }
+}
+
+function generateProfileInput(heading, field, value, comment) {
+ var nonNullValue = value == null ? "" : value;
+ var nonNullComment = comment == null ? "" : comment;
+ var result = "<tr><th>" + heading + ":</th><td><input id='" + field + "' name='" + field + "' type='text' value='" + escapeHTML(nonNullValue) + "' /></td><td>" + escapeHTML(nonNullComment) + "</td></tr>\n";
+ return result;
+}
+
+function init(){
+ populateMemberMenuItem();
+
+ titleUserElement = document.getElementById("titleUser");
+ mainElement = document.getElementById("main");
+ profileGoButton = document.getElementById("profileGoButton");
+ profileTable = document.getElementById("profileTable");
+ freezeDiv = document.getElementById("freezeDiv");
+ levelDiv = document.getElementById("levelDiv");
+
+ addAuthListeners(handleAuth, handleAuth);
+}
+</script>
+</head>
+<body onload="init();">
+<div id="header">
+ <strong><a href="index.html">Ogoglio Example</a></strong>
+ <span id="search">
+ <!-- <form style="margin: 0px;" method="get" action="http://www.google.com/search">
+ <input type="text" size="20" name="q"/>
+ <input type="hidden" name="q" value="site:example.com"/>
+ <input type="submit" value="find"/>
+ </form> -->
+ </span>
+</div> <!-- end header -->
+
+<div id="headerMenu">
+ <a href="index.html">Home</a>
+ <span id="memberMenuItem"> </span>
+</div> <!-- end header menu -->
+
+<div id="main">
+ <h2 style="color: #4F4;" id="titleUser">Administer User: loading...</h2>
+
+ <div id="content">
+ <div class="section">
+ <h3>Profile: <input id="profileGoButton" onclick="profileGo(); return false;" type="submit" value="edit"/></h3>
+ <form id='profileForm'>
+ <div id="profileTable">
+ loading...
+ </div>
+ </form>
+ </div>
+ <div class="section">
+ <h3>Account level:</h3>
+ <div id="levelDiv">
+ loading...
+ </div>
+ </div>
+
+ <div class="section">
+ <h3>Account status:</h3>
+ <div id="freezeDiv">
+ loading...
+ </div>
+ </div>
+ </div><!-- end content -->
+</div> <!-- end main -->
+<div id="footer">
+
+</div>
+<!-- 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>
\ No newline at end of file
Added: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html 2007-08-31 15:15:02 UTC (rev 304)
@@ -0,0 +1,127 @@
+<!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>
+
+<title>Ogoglio Example: body</title>
+<style type="text/css">
+#main {
+ overflow: hidden;
+ width: 750px;
+}
+
+.section {
+ border: solid 1px #CCD;
+ border-top: solid 5px #CCD;
+ margin: 0px 25px 10px 0px;
+ padding: 0px 5px 5px 5px;
+}
+
+p {
+ margin: 10px 0px 10px 0px;
+}
+
+#appletDiv {
+ width: 500px;
+ height: 500px;
+}
+</style>
+
+<script type="text/javascript">
+var bodyID = locationParameters['bodyID'];
+var loginCookie = getCookie('loginCookie');
+
+var titleElement = null;
+var mainElement = null;
+var titleElement = null;
+var appletDiv = null;
+
+var bodyXML = null;
+
+function handleAuth(){
+ if(loginCookie == null){
+ mainElement.innerHTML = "<h2>Please sign in to use this page.</h2>";
+ return;
+ }
+
+ if(bodyID == null){
+ mainElement.innerHTML = "<h2>Error: somehow you arrived here without the parameters.</h2> (dang)";
+ return;
+ }
+
+ if(authedUsername == null){
+ mainElement.innerHTML = "<h2>Please log in.</h2>";
+ return;
+ }
+
+ requestBodyDocument(authedUsername, bodyID, handleBody);
+}
+
+function handleBody(xml){
+ if(xml == null) {
+ mainElement.innerHTML = "Couldn't read body information.";
+ return;
+ }
+ bodyXML = xml;
+ titleElement.innerHTML = escapeHTML(bodyXML.getAttribute("displayname"));
+ writeApplet();
+}
+
+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='500' height='500' 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 init(){
+ populateMemberMenuItem();
+
+ titleElement = document.getElementById("title");
+ mainElement = document.getElementById("main");
+ appletDiv = document.getElementById("appletDiv");
+
+ addAuthListeners(handleAuth, handleAuth);
+}
+</script>
+</head>
+<body onload="init();">
+
+<div id="header">
+ <strong><a href="index.html">Ogoglio Example</a></strong>
+ <span id="search">
+ <!-- <form style="margin: 0px;" method="get" action="http://www.google.com/search">
+ <input type="text" size="20" name="q"/>
+ <input type="hidden" name="q" value="site:example.com"/>
+ <input type="submit" value="find"/>
+ </form> -->
+ </span>
+</div> <!-- end header -->
+
+<div id="headerMenu">
+ <a href="index.html">Home</a>
+ <span id="memberMenuItem"> </span>
+</div> <!-- end header menu -->
+
+<div id="main">
+ <h2 id="title">Loading...</h2>
+ <div id="appletDiv"> </div>
+
+</div> <!-- end main -->
+
+<div id="footer">
+
+</div>
+<!-- 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>
Added: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/browserTests.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/browserTests.js (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/browserTests.js 2007-08-31 15:15:02 UTC (rev 304)
@@ -0,0 +1,160 @@
+var testedCookieName = 'ogoglioBrowserTested';
+
+var requirementTests = new Array();
+var hasTestedCookie = getCookie(testedCookieName) == "true";
+
+function PlatformTest(theTitle, theDescription, theFailureMessage, theTestFunction){
+ var that = this;
+ this.title = theTitle;
+ this.description = theDescription;
+ this.failureMessage = theFailureMessage;
+ this.testFunction = theTestFunction;
+}
+
+PlatformTest.prototype.runTest = function (testSpan) {
+ return this.testFunction(testSpan);
+}
+
+function testJavascript(){
+ return true;
+}
+requirementTests[requirementTests.length] = new PlatformTest("Checking that Javascript is enabled", "", "You must enable Javascript.", testJavascript);
+
+
+function testJava(testSpan){
+ try {
+ var jarURI = getServiceURI() + "/ogoglio-test-applet.jar";
+ var appletHTML = "<applet id='testApplet' name='testApplet' code='com.ogoglio.testapplet.TestApplet' archive='" + jarURI + "' width='1' height='1'></applet>";
+ testSpan.innerHTML = appletHTML;
+ while(typeof document.testApplet == "undefined"){
+ for(i=0; i < 100; i++) setTimeout('this = "something";', 5000);
+ }
+ if((typeof document.testApplet == "undefined")) {
+ requirementTests[1].failureMessage = "Unfortunately, Java support was not found in this browser.<br/>" + javaErrorMessage;
+ return false;
+ }
+ if(!document.testApplet.doesExist()){
+ requirementTests[1].failureMessage = "Unfortunately, we could not communicate with the applet.<br/>" + javaErrorMessage;
+ return false;
+ }
+ if(!document.testApplet.hasAcceptableJava()){
+ requirementTests[1].failureMessage = "Unfortunately, this version of java is not supported: " + document.testApplet.getJavaVersion() + "<br/>" + javaErrorMessage;
+ return false;
+ }
+ if(!document.testApplet.hasJava3D()){
+ var j3dVersion = document.testApplet.getJava3DVersion();
+ if(j3dVersion == null){
+ requirementTests[1].failureMessage = "Unfortunately, you do not have Java3D installed.<br/>" + javaErrorMessage;
+ } else {
+ requirementTests[1].failureMessage = "Unfortunately, this version of Java3D is not supported: " + j3dVersion + javaErrorMessage + "<br/>";
+ }
+ return false;
+ }
+ if(!document.testApplet.canStartJava3D()){
+ requirementTests[1].failureMessage = "Unfortunately, you have Java3D but it can not initialize." + javaErrorMessage + "<br/>";
+ }
+ return true;
+ } catch (error){
+ requirementTests[1].failureMessage = "Unfortunately, Java support was not found in this browser." + javaErrorMessage + "<br/>";
+ return false;
+ }
+ return false;
+}
+var javaErrorMessage = "<br/><br/>Please check that Java support is enabled in your browser preferences.";
+javaErrorMessage += "<br/>If your computer needs Java, use the online installer from <a href='http://java.com/en/download/manual.jsp'>Java.com</a>.<br/>";
+javaErrorMessage += "<br/>If your computer needs Java3D, a quick installer is available <a href='http://java.sun.com/products/java-media/3D/download.html'>here</a>.";
+requirementTests[requirementTests.length] = new PlatformTest("Checking for Java support", "Java displays the 3D views.", javaErrorMessage, testJava);
+
+var currentTestIndex = -1;
+var running = false;
+
+function BrowserTester(){
+ this.listener = null;
+}
+
+BrowserTester.prototype.runTests = function(aCallback){
+ this.callback = aCallback;
+ currentTestIndex = 0;
+ running = true;
+ setTimeout("browserTester.test();", 100);
+}
+
+BrowserTester.prototype.test = function(){
+ var watchdog = setTimeout("browserTester.timedOut();", 10000);
+
+ var title = document.getElementById("requirementTitle" + currentTestIndex);
+ var description = document.getElementById("requirementDescription" + currentTestIndex);
+ var testSpan = document.getElementById("requirementTest" + currentTestIndex);
+
+ title.style.color = "#000";
+ description.style.color = "#000";
+
+ if(requirementTests[currentTestIndex].runTest(testSpan) == true){
+ clearTimeout(watchdog);
+ this.succeed();
+ } else {
+ clearTimeout(watchdog);
+ this.fail();
+ }
+}
+
+BrowserTester.prototype.succeed = function(){
+ if(running == false) return;
+
+ var title = document.getElementById("requirementTitle" + currentTestIndex);
+ var description = document.getElementById("requirementDescription" + currentTestIndex);
+ var testSpan = document.getElementById("requirementTest" + currentTestIndex);
+
+ title.style.color = "#0F0";
+ title.innerHTML = title.innerHTML + "<img id='requirementCheck" + currentTestIndex + "' align='center' src='" + getServiceURI() + "/GreenCheckmark.gif'/>";
+ description.style.color = "#0F0";
+
+ currentTestIndex++;
+ if(currentTestIndex >= requirementTests.length){
+ running = false;
+ this.callback(true);
+ } else {
+ setTimeout("browserTester.test(" + currentTestIndex + ");", 100);
+ }
+}
+
+BrowserTester.prototype.fail = function(){
+ if(running == false) return;
+ running = false;
+
+ var title = document.getElementById("requirementTitle" + currentTestIndex);
+ var description = document.getElementById("requirementDescription" + currentTestIndex);
+ var testSpan = document.getElementById("requirementTest" + currentTestIndex);
+
+ title.style.color = "#FF0000";
+ description.style.color = "#000";
+ var message = requirementTests[currentTestIndex].failureMessage;
+ description.innerHTML = message;
+ this.callback(false);
+}
+
+BrowserTester.prototype.timedOut = function(){
+ if(running == false) return;
+ running = false;
+ this.fail();
+}
+
+var browserTester = new BrowserTester();
+
+
+function writeRequirementTestUI(targetElement){
+ var html = "<ol style='margin: 10px;'>";
+ for(var i=0; i < requirementTests.length; i++){
+ html += "<li id='requirementLI" + i + "'>";
+ html += "<h2 id='requirementTitle" + i + "'>";
+ html += requirementTests[i].title + ": ";
+ html += "</h2>";
+ html += "<p id='requirementDescription" + i + "' >" + requirementTests[i].description + "</p>";
+ html += "<span id='requirementTest" + i + "'> </span>";
+ html += "</li>";
+ }
+ html += "</ol>";
+ targetElement.innerHTML = html;
+}
+
+// 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.
Added: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/createAccount.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/createAccount.html (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/createAccount.html 2007-08-31 15:15:02 UTC (rev 304)
@@ -0,0 +1,775 @@
+var appPath = "/og"; //do not put a slash on the end
+
+function getServiceURI(){
+ var locLink = document.location;
+ return locLink.protocol + "//" + locLink.host + appPath;
+}
+
+
+//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;
+}
+
+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;
+ }
+}
+
+function getIntParameter(paramName, defaultValue){
+ var value = locationParameters[paramName];
+ if(typeof value == 'undefined' || value == null){
+ return defaultValue;
+ }
+ try {
+ return parseInt(value);
+ } catch (error){
+ return defaultValue;
+ }
+}
+
+var isIE = false;
+if (window.ActiveXObject) {
+ isIE = true;
+}
+
+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;
+}
+
+XMLRequestManager.prototype.setMethod = function (newMethod) {
+ this.method = newMethod;
+}
+
+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);
+ }
+}
+
+
+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"){
+ return;
+ }
+ debugDiv.innerHTML += message + "<br/>";
+}
+//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){
+ 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 XMLRequ...
[truncated message content] |