mobile channels in ez publish

57
Mobile Channels in eZ Publish eZ Conference 2011

Upload: lserwatka

Post on 22-Jan-2015

1.730 views

Category:

Technology


8 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Mobile Channels in eZ Publish

Mobile Channels in eZ PublisheZ Conference 2011

Page 2: Mobile Channels in eZ Publish

Łukasz SerwatkaMobile Lead Engineer at eZ Systems

eZ Systems employee since March 2005Member of the Engineering Division

8 years experience with eZ Publish2 years experience with native mobile applications development (iOS,

Android)Author of many print and online publications about eZ PublishCreator of many eZ Publish extensions

Web: www.serwatka.netTwitter: @lserwatka

10.04.2023PRESENTER: ŁUKASZ SERWATKA 2

Mobile Channels in eZ PublisheZ Conference 2011

Page 3: Mobile Channels in eZ Publish

Mobile channels available in eZ Publish

mobile web channelweb technologies

HTML5CSS3 & SASSJavaScript

REST interfaceweb service oriented

lightweight client-server communicationJSON as output format

10.04.2023PRESENTER: ŁUKASZ SERWATKA 3

Mobile Channels in eZ PublisheZ Conference 2011

Page 4: Mobile Channels in eZ Publish

Content channels in eZ Publish

10.04.2023PRESENTER: ŁUKASZ SERWATKA 4

Mobile Channels in eZ PublisheZ Conference 2011

Page 5: Mobile Channels in eZ Publish

Mobile channels in eZ Publish

10.04.2023PRESENTER: ŁUKASZ SERWATKA 5

Mobile Channels in eZ PublisheZ Conference 2011

Page 6: Mobile Channels in eZ Publish

Environments: fragmentation

Symbian (Nokia)Andorid (Google)Bada (Samsung)Windows Phone (Microsoft/Nokia)iOS (Apple)BlackBerry (RIM)webOS (Palm/HP)MeeGo (Intel/Nokia/Maemo)

10.04.2023PRESENTER: ŁUKASZ SERWATKA 6

Mobile Channels in eZ PublisheZ Conference 2011

Page 7: Mobile Channels in eZ Publish

The Web

Cross-platformFamiliar skills & toolsEasily updatedDecentralizedIndexedWell-understood

… but

10.04.2023PRESENTER: ŁUKASZ SERWATKA 7

Mobile Channels in eZ PublisheZ Conference 2011

Page 8: Mobile Channels in eZ Publish

Caveats

Performance: slower to execute, limited on CPU/GPU resourceBrowser support: some needs to be ignoredDevice access: limited access to hardware, not fully there yetDebug: more difficult on the client sideDiscoverability: no official app store, yetMonetization: more difficultApp ‘experience’

10.04.2023PRESENTER: ŁUKASZ SERWATKA 8

Mobile Channels in eZ PublisheZ Conference 2011

Page 9: Mobile Channels in eZ Publish

Mobile web: engines

WebKit: ~57% market shareiOSBadaBlackBerry 6.0+SymbianAndoridwebOSMeeGo

Presto: ~21% market shareOpera MiniOpera Mobile

Others: ~22% market shareGecko, Trident, Mango, UC, Obigo …

10.04.2023PRESENTER: ŁUKASZ SERWATKA 9

Mobile Channels in eZ PublisheZ Conference 2011

Page 10: Mobile Channels in eZ Publish

Mobile HTML5

10.04.2023PRESENTER: ŁUKASZ SERWATKA 10

Mobile Channels in eZ PublisheZ Conference 2011

semantics

offline & storage

device access

connectivity

multimedia

3D, graphics & effects

performance & integration

CSS3

Page 11: Mobile Channels in eZ Publish

Technologies

accelerometer -webkit @page CSS Text localStorage @mediamanifest transform <video> WebSQLGeoLocationtype=camera canvas keyframe gradienttouch events<audio> Web Workers CSS3 SASS

… and more

10.04.2023PRESENTER: ŁUKASZ SERWATKA 11

Mobile Channels in eZ PublisheZ Conference 2011

Page 12: Mobile Channels in eZ Publish

Cross-browser

mobile web frameworks

JavaScript-based (programmatic approach)Sencha TouchSproutCore

Markup-based (progressive enhancement approach)jQTouchjQuery Mobile

10.04.2023PRESENTER: ŁUKASZ SERWATKA 12

Mobile Channels in eZ PublisheZ Conference 2011

Page 13: Mobile Channels in eZ Publish

Mobile web frameworks: why?

Provide user interface componentstoolbars, buttons, navigation bars, etc.

Smooth browser inconsistenciesnormalization is done under the hood, abstractions

Mimic native or server paradigmsUI elements, drop shadows, insets,

Create consistent application architectureMVC framework

10.04.2023PRESENTER: ŁUKASZ SERWATKA 13

Mobile Channels in eZ PublisheZ Conference 2011

Page 14: Mobile Channels in eZ Publish

jQTouch

sponsored by Sencha Labsmarkup-basedUI layer on top of jQuerylibrary progressively enhancesMIT licensewide browser support

http://jqtouch.com

10.04.2023PRESENTER: ŁUKASZ SERWATKA 14

Mobile Channels in eZ PublisheZ Conference 2011

Page 15: Mobile Channels in eZ Publish

jQuery Mobile

still in alpha versionmarkup-basedUI layer on top of jQuerylibrary progressively enhancesMIT or GPL2 licensewide browser support

http://jquerymobile.com

10.04.2023PRESENTER: ŁUKASZ SERWATKA 15

Mobile Channels in eZ PublisheZ Conference 2011

Page 16: Mobile Channels in eZ Publish

Sencha Touch

self-contained librarybuilt on ExtJSJavaScript-based approachstandalone MVC applicationscommercial and open source licenseswide browser support

http://www.sencha.com/products/touch/

10.04.2023PRESENTER: ŁUKASZ SERWATKA 16

Mobile Channels in eZ PublisheZ Conference 2011

Page 17: Mobile Channels in eZ Publish

Back to eZ Publish …

10.04.2023PRESENTER: ŁUKASZ SERWATKA 17

Mobile Channels in eZ PublisheZ Conference 2011

Page 18: Mobile Channels in eZ Publish

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;

10.04.2023PRESENTER: ŁUKASZ SERWATKA 18

Mobile Channels in eZ PublisheZ Conference 2011

Page 19: Mobile Channels in eZ Publish

Mobile web channel in eZ Publish: configuration

Web server configurationVirtual-Host setup

eZ Publish configurationSiteaccess settingsPermissions setupDesign extension

10.04.2023PRESENTER: ŁUKASZ SERWATKA 19

Mobile Channels in eZ PublisheZ Conference 2011

Page 20: Mobile Channels in eZ Publish

Mobile web channel in eZ Publish: mobile detection

Apache Mobile Filterhttp://www.apachemobilefilter.org/

No built-in solution

10.04.2023PRESENTER: ŁUKASZ SERWATKA 20

Mobile Channels in eZ PublisheZ Conference 2011

Page 21: Mobile Channels in eZ Publish

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.

10.04.2023PRESENTER: ŁUKASZ SERWATKA 21

Mobile Channels in eZ PublisheZ Conference 2011

Page 22: Mobile Channels in eZ Publish

Mobile web channel in eZ Publish: VH setup

Possible scenariosUse a separate domain altogether (e.g www.mobile-example.com)

Use a subdomain (e.g m.example.com)Probably the most popular optionURI approach as alternative (e.g example.com/mobile)

Use a .mobi top level domain

Combine with smart detection

10.04.2023PRESENTER: ŁUKASZ SERWATKA 22

Mobile Channels in eZ PublisheZ Conference 2011

Page 23: Mobile Channels in eZ Publish

Mobile web channel in eZ Publish: siteaccess

/settings/override/site.ini.append.php...[SiteAccessSettings]AvailableSiteAccessList[]AvailableSiteAccessList[]=exampleAvailableSiteAccessList[]=mobileMatchOrder=host

HostMatchMapItems[]=www.example.com;exampleHostMatchMapItems[]=m.example.com;mobile...

10.04.2023PRESENTER: ŁUKASZ SERWATKA 23

Mobile Channels in eZ PublisheZ Conference 2011

Page 24: Mobile Channels in eZ Publish

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" />

10.04.2023PRESENTER: ŁUKASZ SERWATKA 24

Mobile Channels in eZ PublisheZ Conference 2011

Page 25: Mobile Channels in eZ Publish

DEMO

10.04.2023PRESENTER: ŁUKASZ SERWATKA SLIDE 25

Page 26: Mobile Channels in eZ Publish

Mobile web channel in eZ Publish: hybrid apps

Native shell for a mobile webEmbedded WebView

PhoneGapaccess to device APIsonline build toolwide range of supported platforms

Distributed via AppStore, Android Market, etc.Access to download statisticsAccess to the application via native shell (Icon on device screen)

10.04.2023PRESENTER: ŁUKASZ SERWATKA 26

Mobile Channels in eZ PublisheZ Conference 2011

Page 27: Mobile Channels in eZ Publish

DEMO

10.04.2023PRESENTER: ŁUKASZ SERWATKA SLIDE 27

Page 28: Mobile Channels in eZ Publish

REST

Page 29: Mobile Channels in eZ Publish

REST

REpresentationalStateTransfer

10.04.2023PRESENTER: ŁUKASZ SERWATKA 29

Mobile Channels in eZ PublisheZ Conference 2011

Page 30: Mobile Channels in eZ Publish

REST

REpresentationalStateTransfer

REST is a set of principles that how Web standards, such as HTTP and URIs, are supposed to be used.

Give every “thing” an IDLink things togetherUse standard methodsResource with multiple representationsCommunicate statelessly

10.04.2023PRESENTER: ŁUKASZ SERWATKA 30

Mobile Channels in eZ PublisheZ Conference 2011

Page 31: Mobile Channels in eZ Publish

REST

REpresentationalStateTransfer

Key goals of REST include:

Scalability of component interactionsGenerality of interfacesIndependent deployment of componentsIntermediary components to reduce latency, enforce security and

encapsulate legacy systems

10.04.2023PRESENTER: ŁUKASZ SERWATKA 31

Mobile Channels in eZ PublisheZ Conference 2011

Page 32: Mobile Channels in eZ Publish

Life before eZ Publish REST interface

custom siteaccess s and template based XML outputcustom web service implementations involving eZ Publish modules/viewezjscore based web service implementations

10.04.2023PRESENTER: ŁUKASZ SERWATKA 32

Mobile Channels in eZ PublisheZ Conference 2011

Page 33: Mobile Channels in eZ Publish

eZ Publish REST interface

available as a core feature since version 4.5

10.04.2023PRESENTER: ŁUKASZ SERWATKA 33

Mobile Channels in eZ PublisheZ Conference 2011

Page 34: Mobile Channels in eZ Publish

eZ Publish REST interface

available as a core feature since version 4.5

dedicated front-end controller (index_rest.php as REST endpoint)

10.04.2023PRESENTER: ŁUKASZ SERWATKA 34

Mobile Channels in eZ PublisheZ Conference 2011

Page 35: Mobile Channels in eZ Publish

eZ Publish REST interface

available as a core feature since version 4.5

dedicated front-end controller (index_rest.php as REST endpoint)

10.04.2023PRESENTER: ŁUKASZ SERWATKA 35

Mobile Channels in eZ PublisheZ Conference 2011

Page 36: Mobile Channels in eZ Publish

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

10.04.2023PRESENTER: ŁUKASZ SERWATKA 36

Mobile Channels in eZ PublisheZ Conference 2011

Page 37: Mobile Channels in eZ Publish

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

10.04.2023PRESENTER: ŁUKASZ SERWATKA 37

Mobile Channels in eZ PublisheZ Conference 2011

Page 38: Mobile Channels in eZ Publish

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

10.04.2023PRESENTER: ŁUKASZ SERWATKA 38

Mobile Channels in eZ PublisheZ Conference 2011

Page 39: Mobile Channels in eZ Publish

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

10.04.2023PRESENTER: ŁUKASZ SERWATKA 39

Mobile Channels in eZ PublisheZ Conference 2011

Page 40: Mobile Channels in eZ Publish

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

10.04.2023PRESENTER: ŁUKASZ SERWATKA 40

Mobile Channels in eZ PublisheZ Conference 2011

Page 41: Mobile Channels in eZ Publish

eZ Publish REST interface: other features

built-in caching

template based output for various resources

returned fields configured per request: responseGroups

10.04.2023PRESENTER: ŁUKASZ SERWATKA 41

Mobile Channels in eZ PublisheZ Conference 2011

Page 42: Mobile Channels in eZ Publish

eZ Publish REST interface: front-controller

10.04.2023PRESENTER: ŁUKASZ SERWATKA 42

Mobile Channels in eZ PublisheZ Conference 2011

Page 43: Mobile Channels in eZ Publish

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

10.04.2023PRESENTER: ŁUKASZ SERWATKA 43

Mobile Channels in eZ PublisheZ Conference 2011

Page 44: Mobile Channels in eZ Publish

eZ Publish REST interface

content is mapped into the resourcenodeobjectlistsfields

resources provided by the ezprestapiprovider extensionfor better upgradability and easier maintenance

new resources can be provided without eZ Publish upgrade

10.04.2023PRESENTER: ŁUKASZ SERWATKA 44

Mobile Channels in eZ PublisheZ Conference 2011

Page 45: Mobile Channels in eZ Publish

eZ Publish REST interface

content is mapped into the resourcenodeobjectlistsfields

resources provided by the ezprestapiprovider extensionfor better upgradability and easier maintenance

new resources can be provided without eZ Publish upgrade

10.04.2023PRESENTER: ŁUKASZ SERWATKA 45

Mobile Channels in eZ PublisheZ Conference 2011

Page 46: Mobile Channels in eZ Publish

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();}

10.04.2023PRESENTER: ŁUKASZ SERWATKA 46

Mobile Channels in eZ PublisheZ Conference 2011

Page 47: Mobile Channels in eZ Publish

REST URI pattern explained

10.04.2023PRESENTER: ŁUKASZ SERWATKA 47

Mobile Channels in eZ PublisheZ Conference 2011

Page 48: Mobile Channels in eZ Publish

REST URI pattern explained

10.04.2023PRESENTER: ŁUKASZ SERWATKA 48

Mobile Channels in eZ PublisheZ Conference 2011

global prefix which can be configured in the rest.iniworks as a token to trigger your re-write rule;/api/ as default prefix;

Page 49: Mobile Channels in eZ Publish

REST URI pattern explained

ezpRestPrefixFilterInterfaceresponsible for handling providers informationresponsible for handling version tokenezpRestDefaultRegexpPrefixFilter

/ezp/ as default provider tokenv + integer (e.g v1) as a version token

10.04.2023PRESENTER: ŁUKASZ SERWATKA 49

Mobile Channels in eZ PublisheZ Conference 2011

Page 50: Mobile Channels in eZ Publish

Versioning

versioning is supportedversion token is part of the URI resource e.g. /api/ezp/v1/…

use ezpRestVersionedRoute class to register your versioned resources

10.04.2023PRESENTER: ŁUKASZ SERWATKA 50

Mobile Channels in eZ PublisheZ Conference 2011

Page 51: Mobile Channels in eZ Publish

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 )

10.04.2023PRESENTER: ŁUKASZ SERWATKA 51

Mobile Channels in eZ PublisheZ Conference 2011

Page 52: Mobile Channels in eZ Publish

Extensibility

done via eZ Publish extension systemcreate new provider by implementing ezpRestProviderInterface

register your new versioned resources

see ezprestapiprovider extension as a source of your inspiration

10.04.2023PRESENTER: ŁUKASZ SERWATKA 52

Mobile Channels in eZ PublisheZ Conference 2011

Page 53: Mobile Channels in eZ Publish

Resources

content consumption only

full CRUD in the next versionsneeds to be inline with eZ Publish PHP API

10.04.2023PRESENTER: ŁUKASZ SERWATKA 53

Mobile Channels in eZ PublisheZ Conference 2011

Page 54: Mobile Channels in eZ Publish

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

10.04.2023PRESENTER: ŁUKASZ SERWATKA 54

Mobile Channels in eZ PublisheZ Conference 2011

Page 55: Mobile Channels in eZ Publish

Resources: example

10.04.2023PRESENTER: ŁUKASZ SERWATKA 55

Mobile Channels in eZ PublisheZ Conference 2011

Page 56: Mobile Channels in eZ Publish

DEMO

10.04.2023PRESENTER: ŁUKASZ SERWATKA SLIDE 56

Page 57: Mobile Channels in eZ Publish

Knowledge sharing

guidelines for the developersmobile webhybrid applicationsnative applications

source code for sample apps available on GitHub

10.04.2023PRESENTER: ŁUKASZ SERWATKA 57

Mobile Channels in eZ PublisheZ Conference 2011