Most Powerful Open Source ERP

How To Use ERP5 Mobile Skin

How To showing how to use ERP5 mobile skin to display erp5 on a mobile phone.
  • Last Update:2016-02-11
  • Version:001
  • Language:en

A business template "erp5_mobile" provides a skin layer so that you can use ERP5 from a mobile phone (depending on the model, it is not compatible with every phone, so you have to try yours).

Table of Contents

  • Steps
  • Set access rule for automatic skin selection
  • Related Articles

    Steps

    To install and configure it, do the following:

    • install business template "erp5_mobile"
    • check and fix skin layers

    The installation process adds a "Mobile" layer, but sometimes it messes up order - the safest course then is to copy the "View" layer, paste it into the "Mobile" and add "erp5_mobile_ui" on the very top of it.

    • devise a url for mobile access and configure your server

    You need a different url for mobile access so that ERP5 can chose the right skin. So, you need to be able to access the same site under different urls, like:

    http://yourhost.yourdomain/erp5
    http://mobile.yourhost.yourdomain/erp5
    

    To do this, refer to DNS and Apache VirtualHost configuration docs. It is easy when you've done it once. Sample pair of vhost definitions can look like this:

     
    <VirtualHost *:80>
    #  setup for normal access
    DocumentRoot /var/www/html/test
    ServerName yoursite.yourdomain
    RewriteEngine On
    RewriteRule ^(.*) http://localhost:8080/VirtualHostBase/http/yoursite.yourdomain:80/VirtualHostRoot$1 [L,P]
    ProxyPassReverse ^/(.*) http://yoursite.yourdomain/$1
    </VirtualHost>
    
    <VirtualHost *:80>
    #  setup for mobile phone access
    DocumentRoot /var/www/html/test
    ServerName mobile.yoursite.yourdomain
    RewriteEngine On
    RewriteRule ^(.*) http://localhost:8080/VirtualHostBase/http/mobile.yoursite.yourdomain:80/VirtualHostRoot$1 [L,P]
    ProxyPassReverse ^/(.*) http://mobile.yoursite.yourdomain/$1
    </VirtualHost>
    

    Set access rule for automatic skin selection

    First write a script which will analyze the requested url and set skin layer accordingly - something along these lines:

    request = context.REQUEST
    
    if request.get('portal_skin', None) is not None:
      return context.getPortalObject().changeSkin(request.get('portal_skin'))
    
    url = request.get('URL')
    if url.startswith('http://mobile'):
      context.getPortalObject().changeSkin('Mobile')
    

    Then at the site level in ZMI choose "Set Access Rule" option, and give it the name of the script. That's all.

    Related Articles