2. Łukasz Serwatka Mobile Lead Engineer at eZ Systems eZ Systems employee since March 2005 Member of the Engineering Division 8 years experience with eZ Publish 2 years experience with native mobile applications development (iOS, Android) Author of many print and online publications about eZ Publish Creator of many eZ Publish extensions Web: www.serwatka.net Twitter: @lserwatka 11-06-20 Presenter: Łukasz Serwatka 2 Mobile Channels in eZ Publish eZ Conference 2011
3. Mobile channels available in eZ Publish mobile web channel web technologies HTML5 CSS3 & SASS JavaScript REST interface web service oriented lightweight client-server communication JSON as output format 11-06-20 Presenter: Łukasz Serwatka 3 Mobile Channels in eZ Publish eZ Conference 2011
4. Content channels in eZ Publish 11-06-20 Presenter: Łukasz Serwatka 4 Mobile Channels in eZ Publish eZ Conference 2011
5. Mobile channels in eZ Publish 11-06-20 Presenter: Łukasz Serwatka 5 Mobile Channels in eZ Publish eZ Conference 2011
6. Environments: fragmentation Symbian (Nokia) Andorid (Google) Bada (Samsung) Windows Phone (Microsoft/Nokia) iOS (Apple) BlackBerry (RIM) webOS (Palm/HP) MeeGo (Intel/Nokia/Maemo) 11-06-20 Presenter: Łukasz Serwatka 6 Mobile Channels in eZ Publish eZ Conference 2011
7. The Web Cross-platform Familiar skills & tools Easily updated Decentralized Indexed Well-understood … but 11-06-20 Presenter: Łukasz Serwatka 7 Mobile Channels in eZ Publish eZ Conference 2011
8. Caveats Performance: slower to execute, limited on CPU/GPU resource Browser support: some needs to be ignored Device access: limited access to hardware, not fully there yet Debug: more difficult on the client side Discoverability: no official app store, yet Monetization: more difficult App ‘experience’ 11-06-20 Presenter: Łukasz Serwatka 8 Mobile Channels in eZ Publish eZ Conference 2011
9. Mobile web: engines WebKit: ~57% market share iOS Bada BlackBerry 6.0+ Symbian Andorid webOS MeeGo Presto: ~21% market share Opera Mini Opera Mobile Others: ~22% market share Gecko, Trident, Mango, UC, Obigo … 11-06-20 Presenter: Łukasz Serwatka 9 Mobile Channels in eZ Publish eZ Conference 2011
10. Mobile HTML5 Presenter: Łukasz Serwatka 10 Mobile Channels in eZ Publish eZ Conference 2011 semantics multimedia offline & storage 3D, graphics & effects device access performance & integration connectivity CSS3 11-06-20
11. Technologies accelerometer -webkit @page CSS Text localStorage @media manifest transform <video> WebSQL GeoLocation type=camera canvas keyframe gradient touch events <audio> Web Workers CSS3 SASS … and more 11-06-20 Presenter: Łukasz Serwatka 11 Mobile Channels in eZ Publish eZ Conference 2011
12. Cross-browser mobile web frameworks JavaScript-based (programmatic approach) Sencha Touch SproutCore Markup-based (progressive enhancement approach) jQTouch jQuery Mobile 11-06-20 Presenter: Łukasz Serwatka 12 Mobile Channels in eZ Publish eZ Conference 2011
13. Mobile web frameworks: why? Provide user interface components toolbars, buttons, navigation bars, etc. Smooth browser inconsistencies normalization is done under the hood, abstractions Mimic native or server paradigms UI elements, drop shadows, insets, Create consistent application architecture MVC framework 11-06-20 Presenter: Łukasz Serwatka 13 Mobile Channels in eZ Publish eZ Conference 2011
14. jQTouch sponsored by Sencha Labs markup-based UI layer on top of jQuery library progressively enhances MIT license wide browser support http://jqtouch.com 11-06-20 Presenter: Łukasz Serwatka 14 Mobile Channels in eZ Publish eZ Conference 2011
15. jQuery Mobile still in alpha version markup-based UI layer on top of jQuery library progressively enhances MIT or GPL2 license wide browser support http://jquerymobile.com 11-06-20 Presenter: Łukasz Serwatka 15 Mobile Channels in eZ Publish eZ Conference 2011
16. Sencha Touch self-contained library built on ExtJS JavaScript-based approach standalone MVC applications commercial and open source licenses wide browser support http://www.sencha.com/products/touch/ 11-06-20 Presenter: Łukasz Serwatka 16 Mobile Channels in eZ Publish eZ Conference 2011
17. Back to eZ Publish … 11-06-20 Presenter: Łukasz Serwatka 17 Mobile Channels in eZ Publish eZ Conference 2011
18. Mobile web channel in eZ Publish accessible via eZ Publish “siteaccess” system; supports URI, HOST and PORT based access; permissions handling; can provide mobile optimized content and layout; template engine; content engine; 11-06-20 Presenter: Łukasz Serwatka 18 Mobile Channels in eZ Publish eZ Conference 2011
19. Mobile web channel in eZ Publish: configuration Web server configuration Virtual-Host setup eZ Publish configuration Siteaccess settings Permissions setup Design extension 11-06-20 Presenter: Łukasz Serwatka 19 Mobile Channels in eZ Publish eZ Conference 2011
20. Mobile web channel in eZ Publish: mobile detection Apache Mobile Filter http://www.apachemobilefilter.org/ No built-in solution 11-06-20 Presenter: Łukasz Serwatka 20 Mobile Channels in eZ Publish eZ Conference 2011
21. Mobile web channel in eZ Publish: mobile detection Smart detection but let user choice. Place link to the desktop version of your site as well. 11-06-20 Presenter: Łukasz Serwatka 21 Mobile Channels in eZ Publish eZ Conference 2011
22. Mobile web channel in eZ Publish: VH setup Possible scenarios Use a separate domain altogether (e.g www.mobile-example.com) Use a subdomain (e.g m.example.com) Probably the most popular option URI approach as alternative (e.g example.com/mobile) Use a .mobi top level domain Combine with smart detection 11-06-20 Presenter: Łukasz Serwatka 22 Mobile Channels in eZ Publish eZ Conference 2011
23. Mobile web channel in eZ Publish: siteaccess /settings/override/site.ini.append.php ... [SiteAccessSettings] AvailableSiteAccessList[] AvailableSiteAccessList[]=example AvailableSiteAccessList[]=mobile MatchOrder=host HostMatchMapItems[]=www.example.com;example HostMatchMapItems[]=m.example.com;mobile ... 11-06-20 Presenter: Łukasz Serwatka 23 Mobile Channels in eZ Publish eZ Conference 2011
24. Mobile web channel in eZ Publish: viewport Use the viewport meta tag to improve the presentation of your web content <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=yes" /> 11-06-20 Presenter: Łukasz Serwatka 24 Mobile Channels in eZ Publish eZ Conference 2011
26. Mobile web channel in eZ Publish: hybrid apps Native shell for a mobile web Embedded WebView PhoneGap access to device APIs online build tool wide range of supported platforms Distributed via AppStore, Android Market, etc. Access to download statistics Access to the application via native shell (Icon on device screen) 11-06-20 Presenter: Łukasz Serwatka 26 Mobile Channels in eZ Publish eZ Conference 2011
29. REST REpresentational State Transfer 11-06-20 Presenter: Łukasz Serwatka 29 Mobile Channels in eZ Publish eZ Conference 2011
30. REST REpresentational State Transfer REST is a set of principles that how Web standards, such as HTTP and URIs, are supposed to be used. Give every “thing” an ID Link things together Use standard methods Resource with multiple representations Communicate statelessly 11-06-20 Presenter: Łukasz Serwatka 30 Mobile Channels in eZ Publish eZ Conference 2011
31. REST REpresentational State Transfer Key goals of REST include: Scalability of component interactions Generality of interfaces Independent deployment of components Intermediary components to reduce latency, enforce security and encapsulate legacy systems 11-06-20 Presenter: Łukasz Serwatka 31 Mobile Channels in eZ Publish eZ Conference 2011
32. Life before eZ Publish REST interface custom siteaccess s and template based XML output custom web service implementations involving eZ Publish modules/view ezjscore based web service implementations 11-06-20 Presenter: Łukasz Serwatka 32 Mobile Channels in eZ Publish eZ Conference 2011
33. eZ Publish REST interface available as a core feature since version 4.5 11-06-20 Presenter: Łukasz Serwatka 33 Mobile Channels in eZ Publish eZ Conference 2011
34. eZ Publish REST interface available as a core feature since version 4.5 dedicated front-end controller (index_rest.php as REST endpoint) 11-06-20 Presenter: Łukasz Serwatka 34 Mobile Channels in eZ Publish eZ Conference 2011
35. eZ Publish REST interface available as a core feature since version 4.5 dedicated front-end controller (index_rest.php as REST endpoint) 11-06-20 Presenter: Łukasz Serwatka 35 Mobile Channels in eZ Publish eZ Conference 2011
36. eZ Publish REST interface available as a core feature since version 4.5 dedicated front-end controller (index_rest.php as REST endpoint) based on the Zeta Components: MVCTools component 11-06-20 Presenter: Łukasz Serwatka 36 Mobile Channels in eZ Publish eZ Conference 2011
37. eZ Publish REST interface available as a core feature since version 4.5 dedicated front-end controller (index_rest.php as REST endpoint) based on the Zeta Components: MVCTools component content retrieval only, with possibility to extend 11-06-20 Presenter: Łukasz Serwatka 37 Mobile Channels in eZ Publish eZ Conference 2011
38. eZ Publish REST interface available as a core feature since version 4.5 dedicated front-end controller (index_rest.php as REST endpoint) based on the Zeta Components: MVCTools component content retrieval only, with possibility to extend extensions mechanism 11-06-20 Presenter: Łukasz Serwatka 38 Mobile Channels in eZ Publish eZ Conference 2011
39. eZ Publish REST interface available as a core feature since version 4.5 dedicated front-end controller (index_rest.php as REST endpoint) based on the Zeta Components: MVCTools component content retrieval only, with possibility to extend extensions mechanism versioning 11-06-20 Presenter: Łukasz Serwatka 39 Mobile Channels in eZ Publish eZ Conference 2011
40. eZ Publish REST interface available as a core feature since version 4.5 dedicated front-controller (index_rest.php as REST endpoint) based on the Zeta Components: MVCTools component content retrieval only, with possibility to extend extensions mechanism versioning OAuth 2.0 authentication 11-06-20 Presenter: Łukasz Serwatka 40 Mobile Channels in eZ Publish eZ Conference 2011
41. eZ Publish REST interface: other features built-in caching template based output for various resources returned fields configured per request: responseGroups 11-06-20 Presenter: Łukasz Serwatka 41 Mobile Channels in eZ Publish eZ Conference 2011
42. eZ Publish REST interface: front-controller 11-06-20 Presenter: Łukasz Serwatka 42 Mobile Channels in eZ Publish eZ Conference 2011
43. eZ Publish REST interface: OAuth 2.0 web interface for applications management support for custom OAuth login pages: override oauthloginpagelayout.tpl configurable token expiry time in the rest.ini 11-06-20 Presenter: Łukasz Serwatka 43 Mobile Channels in eZ Publish eZ Conference 2011
44. eZ Publish REST interface content is mapped into the resource node object lists fields resources provided by the ezprestapiprovider extension for better upgradability and easier maintenance new resources can be provided without eZ Publish upgrade 11-06-20 Presenter: Łukasz Serwatka 44 Mobile Channels in eZ Publish eZ Conference 2011
45. eZ Publish REST interface content is mapped into the resource node object lists fields resources provided by the ezprestapiprovider extension for better upgradability and easier maintenance new resources can be provided without eZ Publish upgrade 11-06-20 Presenter: Łukasz Serwatka 45 Mobile Channels in eZ Publish eZ Conference 2011
46. ezpRestProviderInterface every REST resource provider needs to implement ezpRestProviderInterface interface ezpRestProviderInterface { /** * Returns registered versioned routes for provider * * @abstract * @return array */ public function getRoutes(); /** * Returns associated with provider view controller * * @abstract * @return ezpRestViewController */ public function getViewController(); } 11-06-20 Presenter: Łukasz Serwatka 46 Mobile Channels in eZ Publish eZ Conference 2011
47. REST URI pattern explained 11-06-20 Presenter: Łukasz Serwatka 47 Mobile Channels in eZ Publish eZ Conference 2011
48. REST URI pattern explained 11-06-20 Presenter: Łukasz Serwatka 48 Mobile Channels in eZ Publish eZ Conference 2011 globalprefixwhichcan be configured in the rest.ini works as a token to triggeryour re-writerule; /api/ as defaultprefix;
49. REST URI pattern explained ezpRestPrefixFilterInterface responsible for handlingprovidersinformation responsible for handling version token ezpRestDefaultRegexpPrefixFilter /ezp/ as defaultprovidertoken v + integer (e.g v1) as a version token 11-06-20 Presenter: Łukasz Serwatka 49 Mobile Channels in eZ Publish eZ Conference 2011
50. Versioning versioning is supported version token is part of the URI resource e.g. /api/ezp/v1/… use ezpRestVersionedRoute class to register your versioned resources 11-06-20 Presenter: Łukasz Serwatka 50 Mobile Channels in eZ Publish eZ Conference 2011
51. Versioning: examples new ezpRestVersionedRoute( new ezpMvcRailsRoute( '/content/node/:nodeId/fields', 'ezpRestContentController', 'viewFields' ), 1 ) new ezpRestVersionedRoute( new ezpMvcRailsRoute( '/content/node/:nodeId/field/:fieldIdentifier', 'ezpRestContentController', 'viewField' ), 1 ) new ezpRestVersionedRoute( new ezpMvcRailsRoute( '/content/node/:nodeId/childrenCount', 'ezpRestContentController', 'countChildren' ), 1 ) new ezpRestVersionedRoute( new ezpMvcRailsRoute( '/content/object/:objectId', 'ezpRestContentController', 'viewContent' ), 1 ) 11-06-20 Presenter: Łukasz Serwatka 51 Mobile Channels in eZ Publish eZ Conference 2011
52. Extensibility done via eZ Publish extension system create new provider by implementing ezpRestProviderInterface register your new versioned resources see ezprestapiprovider extension as a source of your inspiration 11-06-20 Presenter: Łukasz Serwatka 52 Mobile Channels in eZ Publish eZ Conference 2011
53. Resources content consumption only full CRUD in the next versions needs to be inline with eZ Publish PHP API 11-06-20 Presenter: Łukasz Serwatka 53 Mobile Channels in eZ Publish eZ Conference 2011
54. Resources: example GET /[api]/v1/content/object/<objectId>/fields HTTP/1.1 /content/node/:nodeId /content/node/:nodeId/fields /content/node/:nodeId/field/:fieldIdentifier /content/node/:nodeId/childrenCount /content/object/:objectId /content/object/:objectId/fields 11-06-20 Presenter: Łukasz Serwatka 54 Mobile Channels in eZ Publish eZ Conference 2011
57. Knowledge sharing guidelines for the developers mobile web hybrid applications native applications source code for sample apps available on GitHub 11-06-20 Presenter: Łukasz Serwatka 57 Mobile Channels in eZ Publish eZ Conference 2011
58. Presenter: Łukasz Serwatka 58 Guidelines for the usage Color scheme Orange eZ color (for Headlines, graphical elements) RGB (243/108/44) HEX (#f36f21) Blue eZ color (for highlighting, graphical elements) RGB (42/132/183) HEX (#2a84b7) Light gray eZ color (for graphical elements) RGB (147/149/152) HEX (#939598) Dark gray eZ color (for text and sublines) RGB (64/64/64) 11-06-20