Zend Framework und das Dojo Toolkit

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Zend Framework und das Dojo Toolkit - Presentation Transcript

    1. Zend Framework und Dojo Martin Ruprecht, Mayflower GmbH Tobias von Klipstein, Uxebu
    2. Übersicht
      • Einleitung
      • Was umfasst die Integration von Dojo in das ZF?
      • Wie ist der Aufbau eines Projektes mit den ZF- Komponenten und Dojo
      • Beispiel
      • Diskussion
    3. Einleitung
      • Zend Framework 1.7.6
      • Dojo 1.2.3
    4. Integration
      • Dojo ist Teil des Zend Frameworks
        • CDN (AOL, Google)
        • externals/dojo
        • eigene Builds
      • View- Helper dojo()
      • Dijits
      • Zend_Dojo_Data & dojo.data
      • JSON RPC mit Zend_Json_Server
    5. Projektaufbau
      • MVC- Architektur
      • Zend_Layout- Komponente
    6. View- Helper dojo()
      • Platziert im Head- Bereich des Templates
      • Setzt das Dojo- Environment
          • $this->dojo->enable();
      • CDN oder lokales Dojo?
      • Stylesheet- Infos
      • parseOnLoad- Verhalten
    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. Zend_Dojo_Form
      • Zuweisung im Controller:
        • Zend_Form vs. Zend_Dojo_Form
    9. Dijit View Helpers
      • Dijits im Template
      <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. Zend_Dojo_Data
      • dojo.data: Zugriff auf Datastores
        • JSON
        • XML
        • CSV
      • http://docs.dojocampus.org/dojox/data/
    11. JSON- RPC
      • „ JSON- RPC is a lightweight remote procedure call protocoll. It´s designed to be simple“
      • Zend_Json_Server
    12. Service Mapping Description (SMD)
      • Beschreibt den Service im JSON- Format
      • Dojo: Simple Method Description
      • {&quot;SMDVersion&quot;:&quot;.1&quot;,
      • &quot;serviceType&quot;:&quot;JSON-RPC&quot;,
      • &quot;methods&quot;:[{&quot;name&quot;:&quot;listBreweries&quot;,
      • &quot;serviceURL&quot;:&quot;/rpc/service/class/Devdusk_Beer&quot;,
      • &quot;parameters&quot;:[{&quot;name&quot;:&quot;args&quot;,&quot;type&quot;:&quot;object&quot;}]
      • }]
      • }
    13. JSON- RPC Request {&quot;method&quot;: &quot;add&quot;, &quot;params&quot;: [{1, 1}], &quot;id&quot;: 1}
      • Aufruf eines Remote- Services (Request)
      • Request: Ein einfaches (JSON) serialisiertes Objekt.
      • Eigenschaften:
        • method: Name der Methode die aufgerufen werden soll
        • params: Übergabeparameter in einem Array
        • id: Request id
      • Zend_Json_Server
    14. JSON- RPC Response {&quot;result&quot;: 2, &quot;error&quot;: null, &quot;id&quot;: 1}
      • Antwort nach kompletter Anfrage
      • Response: Ein einfaches (JSON) serialisiertess Objekt.
      • Eigenschaften:
        • result: NULL im Fehlerfall
        • error: NULL im Erfolgsfall
        • id: muss gleich der Request id sein
    15. Zend_Json_Server
      • JSON- RPC Server- Implementierung
      • PHP- Implementierung der SMD
      • Beispiel
    16. Zend_Json_Server
      • public function smdAction()
      • {
      • $class = $this->_getParam('class');
      • $server = new Zend_Json_Server();
      • $server->setClass($class);
      • // receive SMD
      • $smd = $server->getServiceMap();
      • // force the server to deliver a dojo compatible format
      • $smd->setDojoCompatible(true);
      • $smd->setTransport('POST');
      • // this is for the client calls
      • $smd->setTarget($this->getHelper('url')->url(array('controller'=>'rpc', 'action'=>'service')))
      • ->setId($this->getHelper('url')->url(array('controller'=>'rpc', 'action'=>'service')));
      • // assigning the smd to the view
      • $this->view->data = $smd;
      • // set the right return format
      • $this->getResponse()->setHeader('Content-Type', 'application/json');
      • // render the template service.phtml
      • $this->render('service');
      • }
    17. dojo.rpc.JsonService
      • Instanziierung:
      • devdusk.rpc.beer = new dojo.rpc.JsonService('/rpc/smd/class/Devdusk_Beer');
      • Aufruf der Remote- Methode:
      • devdusk.rpc.beer.listBreweries(1).addCallback(function(res){});
    18. Vielen Dank für die Aufmerksamkeit
    SlideShare Zeitgeist 2009

    + klipsteinklipstein Nominate

    custom

    516 views, 0 favs, 0 embeds more stats

    Vortrag beim Devdusk München am 19.03.2009.

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 516
      • 516 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 3
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories