0
Zend Framework und Dojo Martin Ruprecht, Mayflower GmbH Tobias von Klipstein, Uxebu
Übersicht <ul><li>Einleitung </li></ul><ul><li>Was umfasst die Integration von Dojo in das ZF? </li></ul><ul><li>Wie ist d...
Einleitung <ul><li>Zend Framework 1.7.6 </li></ul><ul><li>Dojo 1.2.3 </li></ul>
Integration <ul><li>Dojo ist Teil des Zend Frameworks </li></ul><ul><ul><li>CDN (AOL, Google) </li></ul></ul><ul><ul><li>e...
Projektaufbau <ul><li>MVC- Architektur  </li></ul><ul><li>Zend_Layout- Komponente </li></ul>
View- Helper dojo() <ul><li>Platziert im Head- Bereich des Templates </li></ul><ul><li>Setzt das Dojo- Environment </li></...
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;>...
Zend_Dojo_Form <ul><li>Zuweisung im Controller: </li></ul><ul><ul><li>Zend_Form vs. Zend_Dojo_Form </li></ul></ul>
Dijit View Helpers <ul><li>Dijits im Template </li></ul><button name=&quot;btn&quot; id=&quot;btn&quot; type=&quot;button&...
Zend_Dojo_Data <ul><li>dojo.data: Zugriff auf Datastores </li></ul><ul><ul><li>JSON </li></ul></ul><ul><ul><li>XML </li></...
JSON- RPC <ul><li>„ JSON- RPC is a lightweight remote procedure call protocoll. It´s designed to be simple“ </li></ul><ul>...
Service Mapping Description (SMD) <ul><li>Beschreibt den Service im JSON- Format </li></ul><ul><li>Dojo: Simple Method Des...
JSON- RPC Request {&quot;method&quot;: &quot;add&quot;, &quot;params&quot;: [{1, 1}], &quot;id&quot;: 1} <ul><li>Aufruf ei...
JSON- RPC Response {&quot;result&quot;: 2, &quot;error&quot;: null, &quot;id&quot;: 1} <ul><li>Antwort nach kompletter Anf...
Zend_Json_Server <ul><li>JSON- RPC Server- Implementierung </li></ul><ul><li>PHP- Implementierung der SMD </li></ul><ul><l...
Zend_Json_Server <ul><li>public function smdAction() </li></ul><ul><li>{ </li></ul><ul><li>$class  = $this->_getParam('cla...
dojo.rpc.JsonService <ul><li>Instanziierung: </li></ul><ul><li>devdusk.rpc.beer =  new  dojo.rpc.JsonService('/rpc/smd/cla...
Vielen Dank für die Aufmerksamkeit
Upcoming SlideShare
Loading in...5
×

Zend Framework und das Dojo Toolkit

693

Published on

Vortrag beim Devdusk München am 19.03.2009.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
693
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Transcript of "Zend Framework und das Dojo Toolkit"

    1. 1. Zend Framework und Dojo Martin Ruprecht, Mayflower GmbH Tobias von Klipstein, Uxebu
    2. 2. Übersicht <ul><li>Einleitung </li></ul><ul><li>Was umfasst die Integration von Dojo in das ZF? </li></ul><ul><li>Wie ist der Aufbau eines Projektes mit den ZF- Komponenten und Dojo </li></ul><ul><li>Beispiel </li></ul><ul><li>Diskussion </li></ul>
    3. 3. Einleitung <ul><li>Zend Framework 1.7.6 </li></ul><ul><li>Dojo 1.2.3 </li></ul>
    4. 4. Integration <ul><li>Dojo ist Teil des Zend Frameworks </li></ul><ul><ul><li>CDN (AOL, Google) </li></ul></ul><ul><ul><li>externals/dojo </li></ul></ul><ul><ul><li>eigene Builds </li></ul></ul><ul><li>View- Helper dojo() </li></ul><ul><li>Dijits </li></ul><ul><li>Zend_Dojo_Data & dojo.data </li></ul><ul><li>JSON RPC mit Zend_Json_Server </li></ul>
    5. 5. Projektaufbau <ul><li>MVC- Architektur </li></ul><ul><li>Zend_Layout- Komponente </li></ul>
    6. 6. View- Helper dojo() <ul><li>Platziert im Head- Bereich des Templates </li></ul><ul><li>Setzt das Dojo- Environment </li></ul><ul><ul><ul><li>$this->dojo->enable(); </li></ul></ul></ul><ul><li>CDN oder lokales Dojo? </li></ul><ul><li>Stylesheet- Infos </li></ul><ul><li>parseOnLoad- Verhalten </li></ul>
    7. 7. <!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;><html> <head> <title>ZF und Dojo</title><style type=&quot;text/css&quot;> <!-- @import &quot;http://o.aolcdn.com/dojo/1.2.0/dijit/themes/tundra/tundra.css&quot;; --> </style> <script type=&quot;text/javascript&quot;> //<!-- var djConfig = {&quot;parseOnLoad&quot;:true}; //--> </script> <script type=&quot;text/javascript&quot; src=&quot;http://o.aolcdn.com/dojo/1.2.0/dojo/dojo.xd.js&quot;></script> <script type=&quot;text/javascript&quot;> //<!-- dojo.require(&quot;dijit.form.ValidationTextBox&quot;); dojo.require(&quot;dijit.form.Form&quot;); //--> </script> </head> <body class=&quot;tundra&quot;> <h2>Devdusk</h2> <form dojoType=&quot;dijit.form.Form&quot;><dl class=&quot;zend_form_dojo&quot;> <dt><label for=&quot;name&quot; class=&quot;required&quot;>Name:</label></dt> <dd> <input id=&quot;name&quot; name=&quot;name&quot; value=&quot;&quot; type=&quot;text&quot; invalidMessage=&quot;Dies ist ein Pflichtfeld!&quot; required=&quot;1&quot; dojoType=&quot;dijit.form.ValidationTextBox&quot;></dd></dl></form> </body> </html>
    8. 8. Zend_Dojo_Form <ul><li>Zuweisung im Controller: </li></ul><ul><ul><li>Zend_Form vs. Zend_Dojo_Form </li></ul></ul>
    9. 9. Dijit View Helpers <ul><li>Dijits im Template </li></ul><button name=&quot;btn&quot; id=&quot;btn&quot; type=&quot;button&quot; value=&quot;speichern&quot; iconClass=&quot;myButtons&quot; onClick=&quot;submitForm()&quot; dojoType=&quot;dijit.form.Button&quot;>speichern</button> <button id=&quot;btn&quot; dojoType=&quot;dijit.form.Button&quot; onclick=&quot;submitForm()&quot;>speichern</button >
    10. 10. Zend_Dojo_Data <ul><li>dojo.data: Zugriff auf Datastores </li></ul><ul><ul><li>JSON </li></ul></ul><ul><ul><li>XML </li></ul></ul><ul><ul><li>CSV </li></ul></ul><ul><li>http://docs.dojocampus.org/dojox/data/ </li></ul>
    11. 11. JSON- RPC <ul><li>„ JSON- RPC is a lightweight remote procedure call protocoll. It´s designed to be simple“ </li></ul><ul><li>Zend_Json_Server </li></ul>
    12. 12. Service Mapping Description (SMD) <ul><li>Beschreibt den Service im JSON- Format </li></ul><ul><li>Dojo: Simple Method Description </li></ul><ul><li>{&quot;SMDVersion&quot;:&quot;.1&quot;, </li></ul><ul><li>&quot;serviceType&quot;:&quot;JSON-RPC&quot;, </li></ul><ul><li>&quot;methods&quot;:[{&quot;name&quot;:&quot;listBreweries&quot;, </li></ul><ul><li>&quot;serviceURL&quot;:&quot;/rpc/service/class/Devdusk_Beer&quot;, </li></ul><ul><li>&quot;parameters&quot;:[{&quot;name&quot;:&quot;args&quot;,&quot;type&quot;:&quot;object&quot;}] </li></ul><ul><li> }] </li></ul><ul><li>} </li></ul>
    13. 13. JSON- RPC Request {&quot;method&quot;: &quot;add&quot;, &quot;params&quot;: [{1, 1}], &quot;id&quot;: 1} <ul><li>Aufruf eines Remote- Services (Request) </li></ul><ul><li>Request: Ein einfaches (JSON) serialisiertes Objekt. </li></ul><ul><li>Eigenschaften: </li></ul><ul><ul><li>method: Name der Methode die aufgerufen werden soll </li></ul></ul><ul><ul><li>params: Übergabeparameter in einem Array </li></ul></ul><ul><ul><li>id: Request id </li></ul></ul><ul><li>Zend_Json_Server </li></ul>
    14. 14. JSON- RPC Response {&quot;result&quot;: 2, &quot;error&quot;: null, &quot;id&quot;: 1} <ul><li>Antwort nach kompletter Anfrage </li></ul><ul><li>Response: Ein einfaches (JSON) serialisiertess Objekt. </li></ul><ul><li>Eigenschaften: </li></ul><ul><ul><li>result: NULL im Fehlerfall </li></ul></ul><ul><ul><li>error: NULL im Erfolgsfall </li></ul></ul><ul><ul><li>id: muss gleich der Request id sein </li></ul></ul>
    15. 15. Zend_Json_Server <ul><li>JSON- RPC Server- Implementierung </li></ul><ul><li>PHP- Implementierung der SMD </li></ul><ul><li>Beispiel </li></ul>
    16. 16. Zend_Json_Server <ul><li>public function smdAction() </li></ul><ul><li>{ </li></ul><ul><li>$class = $this->_getParam('class'); </li></ul><ul><li>$server = new Zend_Json_Server(); </li></ul><ul><li>$server->setClass($class); </li></ul><ul><li> // receive SMD </li></ul><ul><li>$smd = $server->getServiceMap(); </li></ul><ul><li>// force the server to deliver a dojo compatible format </li></ul><ul><li>$smd->setDojoCompatible(true); </li></ul><ul><li>$smd->setTransport('POST'); </li></ul><ul><li>// this is for the client calls </li></ul><ul><li>$smd->setTarget($this->getHelper('url')->url(array('controller'=>'rpc', 'action'=>'service'))) </li></ul><ul><li>->setId($this->getHelper('url')->url(array('controller'=>'rpc', 'action'=>'service'))); </li></ul><ul><li>// assigning the smd to the view </li></ul><ul><li>$this->view->data = $smd; </li></ul><ul><li>// set the right return format </li></ul><ul><li>$this->getResponse()->setHeader('Content-Type', 'application/json'); </li></ul><ul><li>// render the template service.phtml </li></ul><ul><li>$this->render('service'); </li></ul><ul><li>} </li></ul>
    17. 17. dojo.rpc.JsonService <ul><li>Instanziierung: </li></ul><ul><li>devdusk.rpc.beer = new dojo.rpc.JsonService('/rpc/smd/class/Devdusk_Beer'); </li></ul><ul><li>Aufruf der Remote- Methode: </li></ul><ul><li>devdusk.rpc.beer.listBreweries(1).addCallback(function(res){}); </li></ul>
    18. 18. Vielen Dank für die Aufmerksamkeit
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×