Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / examples / image-organizer / php / api.php
diff --git a/examples/image-organizer/php/api.php b/examples/image-organizer/php/api.php
new file mode 100644 (file)
index 0000000..3b1aba6
--- /dev/null
@@ -0,0 +1,32 @@
+<?php\r
+require('config.php');\r
+header('Content-Type: text/javascript');\r
+\r
+// convert API config to Ext.Direct spec\r
+$actions = array();\r
+foreach($API as $aname=>&$a){\r
+       $methods = array();\r
+       foreach($a['methods'] as $mname=>&$m){\r
+               $md = array(\r
+                       'name'=>$mname,\r
+                       'len'=>$m['len']\r
+               );\r
+               if(isset($m['formHandler'])){\r
+                       $md['formHandler'] = true;\r
+               }\r
+               $methods[] = $md;\r
+       }\r
+       $actions[$aname] = $methods;\r
+}\r
+\r
+$cfg = array(\r
+    'url'=>'php/router.php',\r
+    'type'=>'remoting',\r
+       'actions'=>$actions,\r
+    'namespace'=>'Imgorg.ss'\r
+);\r
+\r
+echo 'Imgorg.REMOTING_API = ';\r
+\r
+echo json_encode($cfg);\r
+echo ';';\r