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