Skip to content

Commit

Permalink
Tagged 0.6 release
Browse files Browse the repository at this point in the history
git-svn-id: https://qooxdoo.svn.sourceforge.net/svnroot/qooxdoo/tags/release_0_6@4178 61aaf1ca-a10e-0410-b9fb-ac63ec25887f
  • Loading branch information
wpbasti committed Sep 7, 2006
1 parent c16a7cc commit 87dfc95
Show file tree
Hide file tree
Showing 56 changed files with 806 additions and 1,061 deletions.
142 changes: 95 additions & 47 deletions qooxdoo/backend/php/services/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,28 @@
define("JsonRpcError_PermissionDenied", 6);


define("ScriptTransport_NotInUse", -1);

function SendReply($reply, $scriptTransportId)
{
/* If not using ScriptTransport... */
if ($scriptTransportId == ScriptTransport_NotInUse)
{
/* ... then just output the reply. */
print $reply;
}
else
{
/* Otherwise, we need to add a call to a qooxdoo-specific function */
$reply =
"qx.io.remote.ScriptTransport._requestFinished(" .
$scriptTransportId . ", " . $reply .
");";
print $reply;
}
}


/*
* class JsonRpcError
*
Expand All @@ -118,6 +140,7 @@ class JsonRpcError
var $json;
var $data;
var $id;
var $scriptTransportId;

function JsonRpcError($json,
$origin = JsonRpcError_Origin_Server,
Expand All @@ -128,6 +151,9 @@ function JsonRpcError($json,
$this->data = array("origin" => $origin,
"code" => $code,
"message" => $message);

/* Assume we're not using ScriptTransporrt */
$this->scriptTransportId = ScriptTransport_NotInUse;
}

function SetOrigin($origin)
Expand All @@ -146,13 +172,18 @@ function SetId($id)
$this->id = $id;
}

function SetScriptTransportId($id)
{
$this->scriptTransportId = $id;
}

function SendAndExit()
{
$error = $this;
$id = $this->id;
$ret = array("error" => $this->data,
"id" => $id);
print $this->json->encode($ret);
SendReply($this->json->encode($ret), $this->scriptTransportId);
exit;
}
}
Expand All @@ -168,63 +199,80 @@ function debug($str)
fflush($fw);
}



/* Ensure we received POST data */
if ($_SERVER["REQUEST_METHOD"] != "POST")
{
/*
* This request was not issued with JSON-RPC so echo the error rather than
* issuing a JsonRpcError response.
*/
echo "Services require POST using JSON-RPC<br>";
exit;
}

/*
* Create a new instance of JSON and get the JSON-RPC request from
* the POST data.
*/
$json = new JSON();
$input = file_get_contents('php://input', 1000000);
$error = new JsonRpcError($json);

/*
* If this was form data (as would be received via an IframeTransport
* request), we expect "_data_=<url-encoded-json-rpc>"; otherwise
* (XmlHttpTransport) we'll have simply <json-rpc>, not url-encoded and with
* no "_data_=". The "Content-Type" field should be one of our two supported
* variants: text/json or application/x-json-form-urlencoded. If neither, or
* if there is more than one form field provided or if the first form field
* name is not '_data_', it's an error.
*/
switch($_SERVER["CONTENT_TYPE"])
/* Assume (default) we're not using ScriptTransport */
$scriptTransportId = ScriptTransport_NotInUse;

if ($_SERVER["REQUEST_METHOD"] == "POST")
{
case "text/json":
/* We found literal POSTed json-rpc data (we hope) */
$jsonInput = $json->decode($input);
break;

case "application/x-www-form-urlencoded":
/* Form. See what fields were provided. There must be only "_data_" */
if (count($_POST) == 1 && isset($_POST["_data_"]))
/*
* We might have received either of two submission methods here. If this
* was form data (as would be received via an IframeTransport request), we
* expect "_data_=<url-encoded-json-rpc>"; otherwise (XmlHttpTransport)
* we'll have simply <json-rpc>, not url-encoded and with no "_data_=".
* The "Content-Type" field should be one of our two supported variants:
* text/json or application/x-json-form-urlencoded. If neither, or if
* there is more than one form field provided or if the first form field
* name is not '_data_', it's an error.
*/
switch($_SERVER["CONTENT_TYPE"])
{
/* $_POST["_data_"] has quotes escaped. php://input doesn't. */
case "text/json":
/* We found literal POSTed json-rpc data (we hope) */
$input = file_get_contents('php://input', 1000000);
$inputFields = explode("=", $input);
$jsonInput = $json->decode(urldecode($inputFields[1]));
$jsonInput = $json->decode($input);
break;
}

/* fall through to default */
case "application/x-www-form-urlencoded":
/*
* We received a form submission. See what fields were provided.
* There must be only "_data_"
*/
if (count($_POST) == 1 && isset($_POST["_data_"]))
{
/* $_POST["_data_"] has quotes escaped. php://input doesn't. */
$input = file_get_contents('php://input', 1000000);
$inputFields = explode("=", $input);
$jsonInput = $json->decode(urldecode($inputFields[1]));
break;
}

default:
/* fall through to default */

default:
/*
* This request was not issued with JSON-RPC so echo the error rather
* than issuing a JsonRpcError response.
*/
echo
"JSON-RPC request expected; " .
"unexpected data received";
exit;
}
}
else if ($_SERVER["REQUEST_METHOD"] == "GET" &&
isset($_GET["_ScriptTransport_id"]) &&
isset($_GET["_ScriptTransport_data"]))
{
/* We have what looks like a valid ScriptTransport request */
$scriptTransportId = $_GET["_ScriptTransport_id"];
$error->SetScriptTransportId($scriptTransportId);
$input = $_GET["_ScriptTransport_data"];
$jsonInput = $json->decode(stripslashes($input));
}
else
{
/*
* This request was not issued with JSON-RPC so echo the error rather than
* issuing a JsonRpcError response.
*/
echo
"JSON-RPC request expected; " .
"unexpected data received";
echo "Services require JSON-RPC<br>";
exit;
}

Expand All @@ -248,7 +296,6 @@ function debug($str)
* Ok, it looks like JSON-RPC, so we'll return an Error object if we encounter
* errors from here on out.
*/
$error = new JsonRpcError($json);
$error->SetId($jsonInput->id);

/*
Expand Down Expand Up @@ -304,7 +351,7 @@ function debug($str)
{
/* Couldn't find the requested service */
$error->SetError(JsonRpcError_ServiceNotFound,
"Service not found.");
"Service `$servicePath` not found.");
$error->SendAndExit();
/* never gets here */
}
Expand All @@ -316,7 +363,7 @@ function debug($str)
if (! class_exists($className))
{
$error->SetError(JsonRpcError_ClassNotFound,
"Class not found.");
"Service class `$className` not found.");
$error->SendAndExit();
/* never gets here */
}
Expand All @@ -329,7 +376,8 @@ function debug($str)
if (! method_exists($service, $method))
{
$error->SetError(JsonRpcError_MethodNotFound,
"Method not found.");
"Method `$method` not found " .
"in service class `$className`.");
$error->SendAndExit();
/* never gets here */
}
Expand All @@ -351,6 +399,6 @@ function debug($str)
/* Give 'em what they came for! */
$ret = array("result" => $output,
"id" => $jsonInput->id);
print $json->encode($ret);
SendReply($json->encode($ret), $scriptTransportId);

?>
2 changes: 1 addition & 1 deletion qooxdoo/frontend/demo/source/html/example/Atom_2.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<a href="javascript://" onclick="void(at1.setIcon(null))">null</a> |
<a href="javascript://" onclick="void(at1.setIcon('icon/16/date.png'))">16px</a> |
<a href="javascript://" onclick="void(at1.setIcon('icon/32/colors.png'))">32px</a> |
<a href="javascript://" onclick="void(at1.setIcon('icon/48/agent.png'))">48px</a>
<a href="javascript://" onclick="void(at1.setIcon('icon/48/memory.png'))">48px</a>
</p>
<p>
Icon Position:
Expand Down
2 changes: 1 addition & 1 deletion qooxdoo/frontend/demo/source/html/example/Atom_3.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<script type="text/javascript" src="../../script/layout.js"></script>

<div id="demoDescription">
<p>Testing the new flash support for QxAtoms.</p>
<p>Testing the new flash support for qx.ui.basic.Atom</p>
</div>

<script type="text/javascript">
Expand Down
2 changes: 1 addition & 1 deletion qooxdoo/frontend/demo/source/html/example/Inline_1.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<script type="text/javascript" src="../../script/layout.js"></script>

<div id="demoDescription">
<p>Inline widget.</p><p>Application layout is disabled by using qx.core.Settings. Scrollbars appear, if content is bigger than window.</p>
<p>Inline widget.</p><p>Application layout is disabled by using qx.core.Settings. Scrollbars appear, if the content is bigger than the window.</p>
</div>

<div id="iframe1" class="manualFrame" style="overflow:hidden;position:static;margin-top:38px;margin-left:10px">
Expand Down
14 changes: 10 additions & 4 deletions qooxdoo/frontend/demo/source/html/example/SplitPane_1.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@

qx.core.Init.getInstance().defineMain(function()
{
var frame = new qx.ui.layout.CanvasLayout;
frame.setLocation(20, 48);
frame.setBottom(48);
frame.setRight(300);
frame.setBackgroundColor("#134275");
frame.setPadding(20);
frame.addToDocument();

// the splitpane itself
var splitpane = new qx.ui.splitpane.HorizontalSplitPane("1*", "2*");
splitpane.setLocation(20, 48);
splitpane.setBottom(48);
splitpane.setRight(310);
splitpane.addToDocument();
splitpane.setEdge(0);
frame.add(splitpane);

// left Widget
var leftWidget = new qx.ui.form.TextArea("LeftWidget");
Expand Down
14 changes: 10 additions & 4 deletions qooxdoo/frontend/demo/source/html/example/SplitPane_2.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@

qx.core.Init.getInstance().defineMain(function()
{
var frame = new qx.ui.layout.CanvasLayout;
frame.setLocation(20, 48);
frame.setBottom(48);
frame.setRight(300);
frame.setBackgroundColor("#134275");
frame.setPadding(20);
frame.addToDocument();

// the splitpane itself
var splitpane = new qx.ui.splitpane.HorizontalSplitPane("1*", "2*");
splitpane.setLocation(20, 48);
splitpane.setBottom(48);
splitpane.setRight(310);
splitpane.setEdge(0);
splitpane.setLiveResize(true);
splitpane.addToDocument();
frame.add(splitpane);

// left Widget
var leftWidget = new qx.ui.form.TextArea("LeftWidget");
Expand Down
2 changes: 1 addition & 1 deletion qooxdoo/frontend/demo/source/html/test/Atom_1.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<p>Some speed tests for qx.ui.basic.Atom. Please regard, that many of things in the finished
page are modified on the already created and visible qx.ui.basic.Atom instances. This is not
a good example in scripting qooxdoo. It's always faster to configure a instance of qx.ui.core.Widget
completly, before add it to the qx.ui.core.ClientDocument or any other visible parent qx.ui.core.Widget.</p>
completely, before add it to the qx.ui.core.ClientDocument or any other visible parent qx.ui.core.Widget.</p>
</div>

<script type="text/javascript">
Expand Down
2 changes: 1 addition & 1 deletion qooxdoo/frontend/demo/source/html/test/Atom_5.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<script type="text/javascript" src="../../script/layout.js"></script>

<div id="demoDescription">

<p>Adding many qx.ui.basic.Atom widgets without setting the icon-width and -height.</p>
</div>

<script type="text/javascript">
Expand Down
2 changes: 1 addition & 1 deletion qooxdoo/frontend/demo/source/html/test/Atom_6.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<script type="text/javascript" src="../../script/layout.js"></script>

<div id="demoDescription">

<p>Adding many qx.ui.basic.Atom widgets setting the icon-width and -height.</p>
</div>

<script type="text/javascript">
Expand Down
2 changes: 1 addition & 1 deletion qooxdoo/frontend/demo/source/html/test/CanvasLayout_3.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<script type="text/javascript" src="../../script/layout.js"></script>

<div id="demoDescription">

<p>This test is using multiple qx.ui.basic.Terminator</p>
</div>

<script type="text/javascript">
Expand Down
6 changes: 4 additions & 2 deletions qooxdoo/frontend/demo/source/html/test/CanvasLayout_4.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<script type="text/javascript" src="../../script/layout.js"></script>

<div id="demoDescription">

<p>This test is using multiple div-Elements</p>
<p>Created with "createElement" and added via "appendChild" to the document.</p>
</div>

<script type="text/javascript">
Expand All @@ -28,11 +29,12 @@
{
var w = document.createElement("div");

w.className = "qx.ui.core.Widget QxWidgetCore";
w.className = "qx_ui_core_Widget_QxWidgetCore";
w.id = "Auto" + i + "|" + j;

w.style.width = "12px";
w.style.height = "12px";
w.style.position = "absolute";
w.style.left = (20+(12*i)) + "px";
w.style.top = (48+(12*j)) + "px";

Expand Down
7 changes: 4 additions & 3 deletions qooxdoo/frontend/demo/source/html/test/CanvasLayout_5.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<script type="text/javascript" src="../../script/layout.js"></script>

<div id="demoDescription">

<p>This test is using multiple div-Elements</p>
<p>Added to the document using the "innerHTML" property.</p>
</div>

<script type="text/javascript">
Expand All @@ -27,13 +28,13 @@
{
for (var j=1; j<=20; j++)
{
h.push("<div style='width:12px;height:12px;");
h.push("<div style='width:12px;height:12px;position:absolute;");
h.push("left:" + (20+(12*i)) + "px;");
h.push("top:" + (48+(12*j)) + "px;");

v = Math.round(20+(i*j)/2);
h.push("background-color:" + "rgb(" + v + "," + v + "," + v + ")");
h.push("' class='qx.ui.core.Widget QxWidgetCore' id='Auto" + i + "|" + j + "'></div>");
h.push("' class='qx_ui_core_Widget_QxWidgetCore' id='Auto" + i + "|" + j + "'></div>");
};
};

Expand Down
Loading

0 comments on commit 87dfc95

Please sign in to comment.