SlideShare a Scribd company logo
Cross-Platform Mobile Apps
& Drupal Web Services
TiConf Mobile Developers Conference 2013

Presented by LTC Bob Sims
CIS Branch Head, Training Support Division

www.jftc.nato.int                   NATO UNCLASSIFIED
About Me

Bob Sims
US Army
Information Systems Manager

•   Lots of living and working abroad, currently
    Bydgoszcz, Poland
•   Connecting people through systems
•   Not terribly bright, just likes problem solving

bob.sims@gmail.com
@2wheelsburning
bobsims.tumblr.com
github.com/bob-sims

Disclaimer:
Mentions in this brief != Endorsements

                                           NATO UNCLASSIFIED
About the JFTC Facility




       www.jftc.nato.int


        NATO UNCLASSIFIED
About Our Mission




     NATO UNCLASSIFIED
Why Mobile Matters




U.S. Army photo by Capt. Thomas Cieslak/Task Force 1-82 PAO   NATO UNCLASSIFIED
Which Problem Space?




     http://events.jftc.nato.int
          NATO UNCLASSIFIED
Why Drupal?

• Manage data + content
• Users, registration,
  permissions, roles
• Flexible themes, content
  types, views, search, more
• Readily publish data
• Vast module repository and
  open-source community
• Enterprise-ready



                                            Source: Josh Schroeder
                        NATO UNCLASSIFIED    http://jdschroeder.ca
Use Case: Collect Dynamic Data

                  How to change data structure (content
                  type) on Drupal web app without
                  breaking native mobile app?
                        –   New allowed field values (pickers)?
                        –   Add/remove new fields?
                        –   X-platform + native app
                  Ingredients:
                  • Drupal 6 backend
                        –   Services + REST server module
                        –   Views + CCK modules
                  •    Custom node form Drupal module
                        https://gist.github.com/bob-sims/4094461
                  •    Code from “Forging Titanium Episode
                       10: Forms” http://is.gd/dPGqBG
                  •    Custom Drupal Services CommonJS
                       library https://gist.github.com/bob-sims/1966524
                  •    Titanium 3.x + Alloy (w/some cheating!)
            NATO UNCLASSIFIED
Secret Sauce
Hard Part: building node object in Drupal node-friendly format

        {"title": "Attend TiConf",
                 "type":"todo",
                 "body": "Prepare presentation",
                 "field_status":[{"value":2}], //cck text field
                 "field_category":[{"value":"Travel"}, //cck text field
                           {"value":"Work"}] }         // multiple selects


Easy Part: posting node object with Titanium API to Drupal Services endpoint

       exports.createNode = function(node, url) {
                  var xhr = Titanium.Network.createHTTPClient();
                  xhr.open('POST', url);
                  xhr.onload = function(e) { /* passback awesome here */ }
                  xhr.setRequestHeader('Content-Type','application/json; charset=utf-
            8');
                  var obj = (node);
                  xhr.send(JSON.stringify(obj));
            };
                                   NATO UNCLASSIFIED
User Authentication
Tip: wait for login success response before creating content, don't send CRUD
action before xhr.onload() fires.

        exports.userLogin = function(url, opts) {
                 var xhr = Titanium.Network.createHTTPClient();
                 url = url + 'user/login.json'; // Services endpoint
                 xhr.open('POST', url);
                 xhr.setRequestHeader('Content-Type','application/json; charset=utf-
            8');

                 xhr.send({"username":opts.username,"password":opts.password});
                 xhr.onload = function() {
                                    var jsonObject = JSON.parse(this.responseText);
                                    opts.success && opts.success(jsonObject);
                          };
                 xhr.onerror = function(e) {
                          opts.error && opts.error({
                                    "status":xhr.status,
                                    "statusText":xhr.statusText
                          });
                 };
                                   NATO UNCLASSIFIED
Use Case: Event Statistics

            How to provide executive leadership
            real-time “business intelligence”?
                  – Limited authenticated roles?
                  – Dynamic graphing of collated data?
                  – X-platform + native app


            Ingredients:
            • Drupal 6 backend
                  – Services + REST Server module
                  – Custom statistics Drupal module
            • RGraph.js charting library
                  – Sample code: http://is.gd/qtVOTS
                  – HTML5 Canvas element
            • Titanium 3.x + Alloy (no cheating!)
                  Custom backbone.js sync adapter

         NATO UNCLASSIFIED
Secret Sauce
Passing dynamic data from Alloy controller to webview

   detail.xml:

         <WebView id="webcharts" url="/html/charts.htm" onLoad="drawCharts"/>


   detail.js:

         // build JSON data object to populate your webview chart
         var chartData = {"canvas":"signupPie",
                                     "title":"Signups",
                                     "data":dataArray,
                                     "labels":labelArray,
                                     "colors":colorArray
                            };

         function drawCharts(e) {
                  $.webcharts.evalJS('drawChart(' + JSON.stringify(chartData) + ')');
                  }

                                    NATO UNCLASSIFIED
Prior Art

Titanium + Drupal Integration
• Drupanium: integrated Drupal distro + sample TiMobile app
• Tyler Frankenstein blog post + examples
    –   Drupal 7 Services + Phonegap + JQuery Mobile
•   Josh Schroeder "App-ify Drupal Titanium Project"
    –   Drupal Camp Alberta 2010 presentation
•   Sumit Kataria civicactions.com

Drupal Services
• post.node create using custom fields (drupal.org)
• IBM Developer Works: Create custom web services project in Drupal 7

Dynamic Graphing with WebViews
• Tim Poulsen – jqPlot x-platform WebView graphing demo
• Aaron Saunders – Titanium Appcelerator Quickie: Google Charts and Appcelerator

                                           NATO UNCLASSIFIED
Pirate Hunter
  Title
  • Dynamic real-world piracy data
          –   Sharepoint-hosted XML to JSON via YQL
          –   Updated daily
  •     NATO Shipping Centre (NSC)
          –   Northwood, UK
          –   www.shipping.nato.int
  •     Case study of "decoupled", informal
        collaboration




      NATO UNCLASSIFIED
Lessons Learned

• Alloy (+ backbone.js) is a "must-learn" for rapid, x-
  platform, data-driven Titanium apps
• underscore.js eases burden of parsing complex JSON
  data returns
• Rendering complex forms or workflows: integrated
  WebViews vs. native UI objects?
• Drupal + Titanium platforms = compelling web/mobile
  solution for organizations




                        NATO UNCLASSIFIED
Credits/Resources

• Aaron Saunders – if he hasn't
  already posted a solution to your
  problem, one doesn't exist
• Raul Riera – Super awesome
  HTTP client for Appcelerator
  Titanium (includes taffydb.js
  caching)
• Grzegorz Bartman – Drupal +
  mobile app ninja in Wroclaw,
  Poland.




                                                   Photo by Justin Pepus
                               NATO UNCLASSIFIED
Conclusion




Photo by Staff Sgt. James Selesnick     NATO UNCLASSIFIED

More Related Content

PDF
Scala in hulu's data platform
PDF
OrientDB introduction - NoSQL
PDF
dataviz on d3.js + elasticsearch
PDF
Streamlining JSON mapping
PDF
MongoDB ClickStream and Visualization
PDF
Importing Data into Neo4j quickly and easily - StackOverflow
PDF
Presto - Hadoop Conference Japan 2014
PDF
Extending spring
Scala in hulu's data platform
OrientDB introduction - NoSQL
dataviz on d3.js + elasticsearch
Streamlining JSON mapping
MongoDB ClickStream and Visualization
Importing Data into Neo4j quickly and easily - StackOverflow
Presto - Hadoop Conference Japan 2014
Extending spring

What's hot (20)

PPT
Java overview the piramide of success
PDF
A quick review of Python and Graph Databases
PDF
The power of datomic
PDF
Session 7 - Connecting to Legacy Systems, IoT and other Systems | Train the T...
PDF
Riak from Small to Large
PPTX
MongoDB and Hadoop: Driving Business Insights
PDF
Session 5 - NGSI-LD Advanced Operations | Train the Trainers Program
PDF
N hidden gems in hippo forge and experience plugins (dec17)
PDF
Appli légère avec d3.js, sinatra, elasticsearch et capucine
PDF
SWAT4LS Wikidata tutorial cambridge dec 2015
PDF
Neo4j + Tableau Visual Analytics - GraphConnect SF 2015
PPTX
Spring Data, Jongo & Co.
PDF
Objective-C Is Not Java
PDF
Introduction to Globus: Research Data Management Software at the ALCF
PDF
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
PPTX
High Performance Applications with MongoDB
PDF
Scalable XQuery Processing with Zorba on top of MongoDB
PDF
N hidden gems in forge (as of may '17)
PDF
Neo4j Fundamentals
ODP
Java overview the piramide of success
A quick review of Python and Graph Databases
The power of datomic
Session 7 - Connecting to Legacy Systems, IoT and other Systems | Train the T...
Riak from Small to Large
MongoDB and Hadoop: Driving Business Insights
Session 5 - NGSI-LD Advanced Operations | Train the Trainers Program
N hidden gems in hippo forge and experience plugins (dec17)
Appli légère avec d3.js, sinatra, elasticsearch et capucine
SWAT4LS Wikidata tutorial cambridge dec 2015
Neo4j + Tableau Visual Analytics - GraphConnect SF 2015
Spring Data, Jongo & Co.
Objective-C Is Not Java
Introduction to Globus: Research Data Management Software at the ALCF
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
High Performance Applications with MongoDB
Scalable XQuery Processing with Zorba on top of MongoDB
N hidden gems in forge (as of may '17)
Neo4j Fundamentals
Ad

Similar to Cross-Platform Mobile Apps & Drupal Web Services (20)

PPTX
Crafting Evolvable Api Responses
PPTX
Berlin Buzz Words - Apache Drill by Ted Dunning & Michael Hausenblas
PDF
Web_of_Things_2013
PPTX
Web Ninja
PPTX
Social Photos - My presentation at Microsoft Tech Day
KEY
Practical Use of MongoDB for Node.js
PPTX
Webdevcon Keynote hh-2012-09-18
PPTX
ETL with SPARK - First Spark London meetup
PDF
Building infrastructure with Terraform (Google)
PPTX
Jump Start with Apache Spark 2.0 on Databricks
PPTX
Open shift enterprise 3.1 paas on kubernetes
PPTX
Big data, just an introduction to Hadoop and Scripting Languages
PPTX
Intro to node and mongodb 1
PPTX
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
PPTX
Running High-Speed Serverless with nuclio
PPTX
Sf big analytics_2018_04_18: Evolution of the GoPro's data platform
PDF
Painless Persistence in a Disconnected World
PPT
Cloud State of the Union for Java Developers
PPTX
Introduction to Azure DocumentDB
PPT
Shindig in 2 hours
Crafting Evolvable Api Responses
Berlin Buzz Words - Apache Drill by Ted Dunning & Michael Hausenblas
Web_of_Things_2013
Web Ninja
Social Photos - My presentation at Microsoft Tech Day
Practical Use of MongoDB for Node.js
Webdevcon Keynote hh-2012-09-18
ETL with SPARK - First Spark London meetup
Building infrastructure with Terraform (Google)
Jump Start with Apache Spark 2.0 on Databricks
Open shift enterprise 3.1 paas on kubernetes
Big data, just an introduction to Hadoop and Scripting Languages
Intro to node and mongodb 1
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Running High-Speed Serverless with nuclio
Sf big analytics_2018_04_18: Evolution of the GoPro's data platform
Painless Persistence in a Disconnected World
Cloud State of the Union for Java Developers
Introduction to Azure DocumentDB
Shindig in 2 hours
Ad

Recently uploaded (20)

PDF
Machine learning based COVID-19 study performance prediction
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Approach and Philosophy of On baking technology
PPTX
Machine Learning_overview_presentation.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Programs and apps: productivity, graphics, security and other tools
DOCX
The AUB Centre for AI in Media Proposal.docx
Machine learning based COVID-19 study performance prediction
Mobile App Security Testing_ A Comprehensive Guide.pdf
cuic standard and advanced reporting.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Network Security Unit 5.pdf for BCA BBA.
sap open course for s4hana steps from ECC to s4
Spectral efficient network and resource selection model in 5G networks
Approach and Philosophy of On baking technology
Machine Learning_overview_presentation.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Agricultural_Statistics_at_a_Glance_2022_0.pdf
A Presentation on Artificial Intelligence
The Rise and Fall of 3GPP – Time for a Sabbatical?
Digital-Transformation-Roadmap-for-Companies.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Reach Out and Touch Someone: Haptics and Empathic Computing
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Programs and apps: productivity, graphics, security and other tools
The AUB Centre for AI in Media Proposal.docx

Cross-Platform Mobile Apps & Drupal Web Services

  • 1. Cross-Platform Mobile Apps & Drupal Web Services TiConf Mobile Developers Conference 2013 Presented by LTC Bob Sims CIS Branch Head, Training Support Division www.jftc.nato.int NATO UNCLASSIFIED
  • 2. About Me Bob Sims US Army Information Systems Manager • Lots of living and working abroad, currently Bydgoszcz, Poland • Connecting people through systems • Not terribly bright, just likes problem solving bob.sims@gmail.com @2wheelsburning bobsims.tumblr.com github.com/bob-sims Disclaimer: Mentions in this brief != Endorsements NATO UNCLASSIFIED
  • 3. About the JFTC Facility www.jftc.nato.int NATO UNCLASSIFIED
  • 4. About Our Mission NATO UNCLASSIFIED
  • 5. Why Mobile Matters U.S. Army photo by Capt. Thomas Cieslak/Task Force 1-82 PAO NATO UNCLASSIFIED
  • 6. Which Problem Space? http://events.jftc.nato.int NATO UNCLASSIFIED
  • 7. Why Drupal? • Manage data + content • Users, registration, permissions, roles • Flexible themes, content types, views, search, more • Readily publish data • Vast module repository and open-source community • Enterprise-ready Source: Josh Schroeder NATO UNCLASSIFIED http://jdschroeder.ca
  • 8. Use Case: Collect Dynamic Data How to change data structure (content type) on Drupal web app without breaking native mobile app? – New allowed field values (pickers)? – Add/remove new fields? – X-platform + native app Ingredients: • Drupal 6 backend – Services + REST server module – Views + CCK modules • Custom node form Drupal module https://gist.github.com/bob-sims/4094461 • Code from “Forging Titanium Episode 10: Forms” http://is.gd/dPGqBG • Custom Drupal Services CommonJS library https://gist.github.com/bob-sims/1966524 • Titanium 3.x + Alloy (w/some cheating!) NATO UNCLASSIFIED
  • 9. Secret Sauce Hard Part: building node object in Drupal node-friendly format {"title": "Attend TiConf", "type":"todo", "body": "Prepare presentation", "field_status":[{"value":2}], //cck text field "field_category":[{"value":"Travel"}, //cck text field {"value":"Work"}] } // multiple selects Easy Part: posting node object with Titanium API to Drupal Services endpoint exports.createNode = function(node, url) { var xhr = Titanium.Network.createHTTPClient(); xhr.open('POST', url); xhr.onload = function(e) { /* passback awesome here */ } xhr.setRequestHeader('Content-Type','application/json; charset=utf- 8'); var obj = (node); xhr.send(JSON.stringify(obj)); }; NATO UNCLASSIFIED
  • 10. User Authentication Tip: wait for login success response before creating content, don't send CRUD action before xhr.onload() fires. exports.userLogin = function(url, opts) { var xhr = Titanium.Network.createHTTPClient(); url = url + 'user/login.json'; // Services endpoint xhr.open('POST', url); xhr.setRequestHeader('Content-Type','application/json; charset=utf- 8'); xhr.send({"username":opts.username,"password":opts.password}); xhr.onload = function() { var jsonObject = JSON.parse(this.responseText); opts.success && opts.success(jsonObject); }; xhr.onerror = function(e) { opts.error && opts.error({ "status":xhr.status, "statusText":xhr.statusText }); }; NATO UNCLASSIFIED
  • 11. Use Case: Event Statistics How to provide executive leadership real-time “business intelligence”? – Limited authenticated roles? – Dynamic graphing of collated data? – X-platform + native app Ingredients: • Drupal 6 backend – Services + REST Server module – Custom statistics Drupal module • RGraph.js charting library – Sample code: http://is.gd/qtVOTS – HTML5 Canvas element • Titanium 3.x + Alloy (no cheating!) Custom backbone.js sync adapter NATO UNCLASSIFIED
  • 12. Secret Sauce Passing dynamic data from Alloy controller to webview detail.xml: <WebView id="webcharts" url="/html/charts.htm" onLoad="drawCharts"/> detail.js: // build JSON data object to populate your webview chart var chartData = {"canvas":"signupPie", "title":"Signups", "data":dataArray, "labels":labelArray, "colors":colorArray }; function drawCharts(e) { $.webcharts.evalJS('drawChart(' + JSON.stringify(chartData) + ')'); } NATO UNCLASSIFIED
  • 13. Prior Art Titanium + Drupal Integration • Drupanium: integrated Drupal distro + sample TiMobile app • Tyler Frankenstein blog post + examples – Drupal 7 Services + Phonegap + JQuery Mobile • Josh Schroeder "App-ify Drupal Titanium Project" – Drupal Camp Alberta 2010 presentation • Sumit Kataria civicactions.com Drupal Services • post.node create using custom fields (drupal.org) • IBM Developer Works: Create custom web services project in Drupal 7 Dynamic Graphing with WebViews • Tim Poulsen – jqPlot x-platform WebView graphing demo • Aaron Saunders – Titanium Appcelerator Quickie: Google Charts and Appcelerator NATO UNCLASSIFIED
  • 14. Pirate Hunter Title • Dynamic real-world piracy data – Sharepoint-hosted XML to JSON via YQL – Updated daily • NATO Shipping Centre (NSC) – Northwood, UK – www.shipping.nato.int • Case study of "decoupled", informal collaboration NATO UNCLASSIFIED
  • 15. Lessons Learned • Alloy (+ backbone.js) is a "must-learn" for rapid, x- platform, data-driven Titanium apps • underscore.js eases burden of parsing complex JSON data returns • Rendering complex forms or workflows: integrated WebViews vs. native UI objects? • Drupal + Titanium platforms = compelling web/mobile solution for organizations NATO UNCLASSIFIED
  • 16. Credits/Resources • Aaron Saunders – if he hasn't already posted a solution to your problem, one doesn't exist • Raul Riera – Super awesome HTTP client for Appcelerator Titanium (includes taffydb.js caching) • Grzegorz Bartman – Drupal + mobile app ninja in Wroclaw, Poland. Photo by Justin Pepus NATO UNCLASSIFIED
  • 17. Conclusion Photo by Staff Sgt. James Selesnick NATO UNCLASSIFIED