SlideShare una empresa de Scribd logo
1 de 87
Sahana Eden: Emergency Development Environment 2 July 2010, Sahana Camp Fran Boon [email_address]
Stack Overview ,[object Object],Client Browser Eclipse Firebug Sahana Eden (S3) Web2Py Python HTML JavaScript CSS
Set yourself up ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Windows: Layout ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Configure Eclipse ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Tea
Morning Session ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Model-View-Controller ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Model-View-Controller ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Model-View-Controller ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
JavaScript
Models ,[object Object],[object Object],[object Object]
Models ,[object Object],[object Object],[object Object]
Core Models ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Core Models (continued) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Core Models (continued) ,[object Object],[object Object],[object Object],[object Object]
Modules ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Sahana Modules ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Resources ,[object Object],[object Object],[object Object],[object Object],[object Object]
S3 REST Controller ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
eden module resource
Emergency ,[object Object]
Adding a new module ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Model: Define Table ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Controllers ,[object Object],[object Object],[object Object],[object Object]
Controller: S3 REST ,[object Object],[object Object],[object Object]
View ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Morning Session ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Lunch
Afternoon Session ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Exploring: Web2Py shell ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Views: Web2Py ,[object Object],[object Object],[object Object],[object Object],[object Object]
Views: S3 REST ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Views: Custom ,[object Object],[object Object],[object Object],[object Object],[object Object]
Internationalisation ,[object Object],[object Object],[object Object]
Internationalisation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Views ,[object Object],[object Object],[object Object],[object Object],[object Object]
Model: SQL constraints ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Model: Validators ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Model: Field Types ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Model: Default Values ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Controller: Labels ,[object Object],[object Object],[object Object],[object Object]
Controller: Labels ,[object Object],[object Object],[object Object],[object Object]
Controller: Comment ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Controller: CRUD Strings ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Controller: Action buttons ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How do we Navigate? ,[object Object],[object Object],[object Object]
URL(r=request, a= application , c= controller , f= function , args=[], vars={})
Enable Module ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Index page ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
View ,[object Object],[object Object],[object Object],[object Object],[object Object]
Controller: Menu ,[object Object],[object Object],[object Object]
Tea
Joined Resources ,[object Object],[object Object],[object Object],[object Object]
Joined Resources: Model ,[object Object],[object Object]
Joined Resources: Model ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Joined Resources: Model ,[object Object],[object Object],[object Object],[object Object],[object Object]
Joined Resources: Model ,[object Object],[object Object],[object Object],[object Object],[object Object]
Joined Resources: Controller ,[object Object],[object Object],[object Object],[object Object],[object Object]
Joined Resources: Model  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Joined Resources: Model ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
DAL: Database Abstraction Layer ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
DAL ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
DAL ,[object Object],[object Object],[object Object]
JR: Represent ,[object Object],[object Object],[object Object],[object Object]
JR: Components ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Components: RHeader ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Components: Rheader Tabs ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Show me the Map!
Map ,[object Object],[object Object],[object Object],[object Object],[object Object]
Display on Map ,[object Object],[object Object],[object Object],[object Object]
Simplify data entry: GIS Controller ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Simplify data entry: GIS View ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
HTML5 Geolocation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Documentation ,[object Object],[object Object],[object Object],[object Object]
Use the Source, Luke! ,[object Object]
S3 is built on Web2Py REST CRUD SQLFORM FORM
Form submission ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Web2Py CRUD ,[object Object],[object Object],[object Object],[object Object]
S3XRC ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Afternoon Session ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
End
Controller: String Substitution  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Web2Py CRUD ,[object Object],[object Object],[object Object]
Controller: prep ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
S3 REST ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
BluePrint: Messaging Open Data Kit JavaRosa

Más contenido relacionado

Destacado

Destacado (9)

Contabilidade dicas concursos
Contabilidade dicas concursosContabilidade dicas concursos
Contabilidade dicas concursos
 
Becky peterson slideshow 2010
Becky peterson slideshow 2010Becky peterson slideshow 2010
Becky peterson slideshow 2010
 
Sistema nervioso
Sistema nerviosoSistema nervioso
Sistema nervioso
 
Tema 8 marta garcía jara
Tema 8 marta garcía jaraTema 8 marta garcía jara
Tema 8 marta garcía jara
 
Ppt tema6
Ppt tema6Ppt tema6
Ppt tema6
 
Dibujoshiro
DibujoshiroDibujoshiro
Dibujoshiro
 
Dubai and petroleum
Dubai and petroleumDubai and petroleum
Dubai and petroleum
 
Blok
BlokBlok
Blok
 
Germany
GermanyGermany
Germany
 

Similar a Sahana introduction to the code v2

GHC Participant Training
GHC Participant TrainingGHC Participant Training
GHC Participant TrainingAidIQ
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplicationolegmmiller
 
The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...
The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...
The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...marcocasario
 
Software Project Management
Software Project ManagementSoftware Project Management
Software Project ManagementWidoyo PH
 
Mini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico CesMini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico CesLeonardo Fernandes
 
PHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & PinbaPHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & PinbaPatrick Allaert
 
Easy Web Project Development & Management with Django & Mercurial
Easy Web Project Development & Management with Django & MercurialEasy Web Project Development & Management with Django & Mercurial
Easy Web Project Development & Management with Django & MercurialWidoyo PH
 
Birt Integration
Birt IntegrationBirt Integration
Birt Integrationmicajblock
 
Benefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBenefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBo-Yi Wu
 
Cloud api之應用與實例
Cloud api之應用與實例Cloud api之應用與實例
Cloud api之應用與實例Simon Su
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Phpfunkatron
 
Best Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesBest Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesOdoo
 
Progressive web apps
Progressive web appsProgressive web apps
Progressive web appsFastly
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introductionTomi Juhola
 
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...Andrey Karpov
 

Similar a Sahana introduction to the code v2 (20)

GHC Participant Training
GHC Participant TrainingGHC Participant Training
GHC Participant Training
 
Nodejs.meetup
Nodejs.meetupNodejs.meetup
Nodejs.meetup
 
CGI Presentation
CGI PresentationCGI Presentation
CGI Presentation
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplication
 
The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...
The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...
The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...
 
Software Project Management
Software Project ManagementSoftware Project Management
Software Project Management
 
Mini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico CesMini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico Ces
 
PHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & PinbaPHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & Pinba
 
IIS 7: The Administrator’s Guide
IIS 7: The Administrator’s GuideIIS 7: The Administrator’s Guide
IIS 7: The Administrator’s Guide
 
Easy Web Project Development & Management with Django & Mercurial
Easy Web Project Development & Management with Django & MercurialEasy Web Project Development & Management with Django & Mercurial
Easy Web Project Development & Management with Django & Mercurial
 
Birt Integration
Birt IntegrationBirt Integration
Birt Integration
 
Benefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBenefit of CodeIgniter php framework
Benefit of CodeIgniter php framework
 
Cloud api之應用與實例
Cloud api之應用與實例Cloud api之應用與實例
Cloud api之應用與實例
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Php
 
Best Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesBest Practices in Handling Performance Issues
Best Practices in Handling Performance Issues
 
Progressive web apps
Progressive web appsProgressive web apps
Progressive web apps
 
Php
PhpPhp
Php
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introduction
 
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
 
TO Hack an ASP .NET website?
TO Hack an ASP .NET website?  TO Hack an ASP .NET website?
TO Hack an ASP .NET website?
 

Más de AidIQ

Tech 2 - Introduction to the Code
Tech 2 - Introduction to the CodeTech 2 - Introduction to the Code
Tech 2 - Introduction to the CodeAidIQ
 
Tech 1 - Deploying Sahana Eden
Tech 1  - Deploying Sahana EdenTech 1  - Deploying Sahana Eden
Tech 1 - Deploying Sahana EdenAidIQ
 
Introduction to Sahana Eden
Introduction to Sahana EdenIntroduction to Sahana Eden
Introduction to Sahana EdenAidIQ
 
Bombeiros Workshop - Introduction to Sahana Eden
Bombeiros Workshop - Introduction to Sahana EdenBombeiros Workshop - Introduction to Sahana Eden
Bombeiros Workshop - Introduction to Sahana EdenAidIQ
 
Sahana Open Source Humanitarian Software Project - Pandemic Preparedness Forum
Sahana Open Source Humanitarian Software Project - Pandemic Preparedness ForumSahana Open Source Humanitarian Software Project - Pandemic Preparedness Forum
Sahana Open Source Humanitarian Software Project - Pandemic Preparedness ForumAidIQ
 
Humanitarian Mapping - Sahana and OpenStreetMap
Humanitarian Mapping - Sahana and OpenStreetMapHumanitarian Mapping - Sahana and OpenStreetMap
Humanitarian Mapping - Sahana and OpenStreetMapAidIQ
 
Sahana Eden : Introduction and Simulation A (SahanaCamp 1.2)
Sahana Eden : Introduction and Simulation A (SahanaCamp 1.2)Sahana Eden : Introduction and Simulation A (SahanaCamp 1.2)
Sahana Eden : Introduction and Simulation A (SahanaCamp 1.2)AidIQ
 
Sahana Eden : Developer Environment (VM) (SahanaCamp 1.2)
Sahana Eden : Developer Environment (VM) (SahanaCamp 1.2)Sahana Eden : Developer Environment (VM) (SahanaCamp 1.2)
Sahana Eden : Developer Environment (VM) (SahanaCamp 1.2)AidIQ
 
Sahana Eden : Deployment (SahanaCamp 1.2)
Sahana Eden : Deployment (SahanaCamp 1.2)Sahana Eden : Deployment (SahanaCamp 1.2)
Sahana Eden : Deployment (SahanaCamp 1.2)AidIQ
 
Sahana Eden : Bug Reporting (SahanaCamp 1.2)
Sahana Eden : Bug Reporting (SahanaCamp 1.2)Sahana Eden : Bug Reporting (SahanaCamp 1.2)
Sahana Eden : Bug Reporting (SahanaCamp 1.2)AidIQ
 
Sahana : Case Studies (SahanaCamp 1.2)
Sahana : Case Studies (SahanaCamp 1.2)Sahana : Case Studies (SahanaCamp 1.2)
Sahana : Case Studies (SahanaCamp 1.2)AidIQ
 
Participatory programming
Participatory programmingParticipatory programming
Participatory programmingAidIQ
 
OpenStreetMap : Technical (SahanaCamp 1.2)
OpenStreetMap : Technical (SahanaCamp 1.2)OpenStreetMap : Technical (SahanaCamp 1.2)
OpenStreetMap : Technical (SahanaCamp 1.2)AidIQ
 
OpenStreetMap : Sahana Mapping Client (SahanaCamp 1.2)
OpenStreetMap : Sahana Mapping Client (SahanaCamp 1.2)OpenStreetMap : Sahana Mapping Client (SahanaCamp 1.2)
OpenStreetMap : Sahana Mapping Client (SahanaCamp 1.2)AidIQ
 
Simulation: Instructions ((SahanaCamp 1.2)
Simulation: Instructions ((SahanaCamp 1.2)Simulation: Instructions ((SahanaCamp 1.2)
Simulation: Instructions ((SahanaCamp 1.2)AidIQ
 
Simulation: Incidents (SahanaCamp 1.2)
Simulation: Incidents (SahanaCamp 1.2)Simulation: Incidents (SahanaCamp 1.2)
Simulation: Incidents (SahanaCamp 1.2)AidIQ
 
Implementing IT Solutions for Disaster Management (SahanaCamp 1.2)
Implementing IT Solutions for Disaster Management (SahanaCamp 1.2)Implementing IT Solutions for Disaster Management (SahanaCamp 1.2)
Implementing IT Solutions for Disaster Management (SahanaCamp 1.2)AidIQ
 
General Sessions Hand Outs (SahanaCamp 1.2)
General Sessions Hand Outs (SahanaCamp 1.2)General Sessions Hand Outs (SahanaCamp 1.2)
General Sessions Hand Outs (SahanaCamp 1.2)AidIQ
 
BZR & LaunchPad : Sharing Your Work With Others (SahanaCamp 1.2)
BZR & LaunchPad : Sharing Your Work With Others (SahanaCamp 1.2)BZR & LaunchPad : Sharing Your Work With Others (SahanaCamp 1.2)
BZR & LaunchPad : Sharing Your Work With Others (SahanaCamp 1.2)AidIQ
 
Sahana Eden : Introduction to the Code (SahanaCamp 1.2)
Sahana Eden : Introduction to the Code (SahanaCamp 1.2)Sahana Eden : Introduction to the Code (SahanaCamp 1.2)
Sahana Eden : Introduction to the Code (SahanaCamp 1.2)AidIQ
 

Más de AidIQ (20)

Tech 2 - Introduction to the Code
Tech 2 - Introduction to the CodeTech 2 - Introduction to the Code
Tech 2 - Introduction to the Code
 
Tech 1 - Deploying Sahana Eden
Tech 1  - Deploying Sahana EdenTech 1  - Deploying Sahana Eden
Tech 1 - Deploying Sahana Eden
 
Introduction to Sahana Eden
Introduction to Sahana EdenIntroduction to Sahana Eden
Introduction to Sahana Eden
 
Bombeiros Workshop - Introduction to Sahana Eden
Bombeiros Workshop - Introduction to Sahana EdenBombeiros Workshop - Introduction to Sahana Eden
Bombeiros Workshop - Introduction to Sahana Eden
 
Sahana Open Source Humanitarian Software Project - Pandemic Preparedness Forum
Sahana Open Source Humanitarian Software Project - Pandemic Preparedness ForumSahana Open Source Humanitarian Software Project - Pandemic Preparedness Forum
Sahana Open Source Humanitarian Software Project - Pandemic Preparedness Forum
 
Humanitarian Mapping - Sahana and OpenStreetMap
Humanitarian Mapping - Sahana and OpenStreetMapHumanitarian Mapping - Sahana and OpenStreetMap
Humanitarian Mapping - Sahana and OpenStreetMap
 
Sahana Eden : Introduction and Simulation A (SahanaCamp 1.2)
Sahana Eden : Introduction and Simulation A (SahanaCamp 1.2)Sahana Eden : Introduction and Simulation A (SahanaCamp 1.2)
Sahana Eden : Introduction and Simulation A (SahanaCamp 1.2)
 
Sahana Eden : Developer Environment (VM) (SahanaCamp 1.2)
Sahana Eden : Developer Environment (VM) (SahanaCamp 1.2)Sahana Eden : Developer Environment (VM) (SahanaCamp 1.2)
Sahana Eden : Developer Environment (VM) (SahanaCamp 1.2)
 
Sahana Eden : Deployment (SahanaCamp 1.2)
Sahana Eden : Deployment (SahanaCamp 1.2)Sahana Eden : Deployment (SahanaCamp 1.2)
Sahana Eden : Deployment (SahanaCamp 1.2)
 
Sahana Eden : Bug Reporting (SahanaCamp 1.2)
Sahana Eden : Bug Reporting (SahanaCamp 1.2)Sahana Eden : Bug Reporting (SahanaCamp 1.2)
Sahana Eden : Bug Reporting (SahanaCamp 1.2)
 
Sahana : Case Studies (SahanaCamp 1.2)
Sahana : Case Studies (SahanaCamp 1.2)Sahana : Case Studies (SahanaCamp 1.2)
Sahana : Case Studies (SahanaCamp 1.2)
 
Participatory programming
Participatory programmingParticipatory programming
Participatory programming
 
OpenStreetMap : Technical (SahanaCamp 1.2)
OpenStreetMap : Technical (SahanaCamp 1.2)OpenStreetMap : Technical (SahanaCamp 1.2)
OpenStreetMap : Technical (SahanaCamp 1.2)
 
OpenStreetMap : Sahana Mapping Client (SahanaCamp 1.2)
OpenStreetMap : Sahana Mapping Client (SahanaCamp 1.2)OpenStreetMap : Sahana Mapping Client (SahanaCamp 1.2)
OpenStreetMap : Sahana Mapping Client (SahanaCamp 1.2)
 
Simulation: Instructions ((SahanaCamp 1.2)
Simulation: Instructions ((SahanaCamp 1.2)Simulation: Instructions ((SahanaCamp 1.2)
Simulation: Instructions ((SahanaCamp 1.2)
 
Simulation: Incidents (SahanaCamp 1.2)
Simulation: Incidents (SahanaCamp 1.2)Simulation: Incidents (SahanaCamp 1.2)
Simulation: Incidents (SahanaCamp 1.2)
 
Implementing IT Solutions for Disaster Management (SahanaCamp 1.2)
Implementing IT Solutions for Disaster Management (SahanaCamp 1.2)Implementing IT Solutions for Disaster Management (SahanaCamp 1.2)
Implementing IT Solutions for Disaster Management (SahanaCamp 1.2)
 
General Sessions Hand Outs (SahanaCamp 1.2)
General Sessions Hand Outs (SahanaCamp 1.2)General Sessions Hand Outs (SahanaCamp 1.2)
General Sessions Hand Outs (SahanaCamp 1.2)
 
BZR & LaunchPad : Sharing Your Work With Others (SahanaCamp 1.2)
BZR & LaunchPad : Sharing Your Work With Others (SahanaCamp 1.2)BZR & LaunchPad : Sharing Your Work With Others (SahanaCamp 1.2)
BZR & LaunchPad : Sharing Your Work With Others (SahanaCamp 1.2)
 
Sahana Eden : Introduction to the Code (SahanaCamp 1.2)
Sahana Eden : Introduction to the Code (SahanaCamp 1.2)Sahana Eden : Introduction to the Code (SahanaCamp 1.2)
Sahana Eden : Introduction to the Code (SahanaCamp 1.2)
 

Sahana introduction to the code v2

Notas del editor

  1. S3 is a codename for Sahana Eden Server & Client can be on the same machine Each part needs to be debugged separately: Eclipse works well for the Server-side Python, whilst Firebug is excellent for the generated HTML/CSS/JavaScript JavaScript libraries we use include jQuery & ExtJS
  2. You can install the software from the server or from provided packs on USB flash drives Users of other Linux distributions are without step-by-step help currently – contributions welcomed 
  3. http://eden.sahanafoundation.org/wiki/DeveloperGuidelinesEclipse Launch Eclipse tick Use this as the default & do not ask again, Next Right-click on ‘Resource’ in top-right & close Window menu | Open Perspective | Other | Debug Window menu | Open Perspective | Other | PyDev Open the ‘Debug’ perspective. Window menu | Show View | Expressions Set up the Python Interpreter: Window > Preferences > PyDev > Interpreter - Python New, Browse to python26/python.exe, OK, OK Add a new PyDev Project: File > New > Project > PyDev Project > Next untick Use Default Browse to the web2py directory Give the project a name: eden, Next untick "Create default 'src' folder and add it to the pythonpath" Debug Configuration: Run > Debug Configurations > Python Run Name: Sahana Eden Project: Browse to eden Main Module: Browse to web2py.py Arguments tab: Program Arguments: -a password Apply, Debug unblock in Windows Firewall
  4. Look around the filesystem in web2py/applications/eden folder Similar layout structure to other MVC frameworks, such as Ruby-on-Rails
  5. JavaScript which doesn’t require server-side parsing put into static Python Libraries available: System Python, Web2Py, Eden (S3*)
  6. Remember that after server-side Python finishes, we still have a lot of possibilities client-side with JavaScript.
  7. Minimise the time taken to process Manage dependencies No need to import most of the libraries in ‘gluon/’
  8. Deleted Columns / Tables simply Ignored
  9. Take a look at them now Remember that execution order is defined by alphabetical order
  10. Take a look at them now
  11. Take a look at them now
  12. For each of these, you should find at least 1 Model, a single Controller & a folder containing 1 or more Views
  13. Sahana Eden is Resource-centric
  14. Web Services, Mash-ups
  15. Create a new file in the Models folder called ‘vts.py’ & type in the text above. # Text after this symbol is a comment & is ignored If you make a mistake, then the Ticketing system should catch the error & let you know what you did wrong.
  16. No need to create a manual routes entry, unlike other frameworks, like Django
  17. Create a new file in the Controllers folder called ‘vts.py’ & type in the text above.
  18. Note that you’ll need to Register yourself as a user on the system before you’re allowed to create a resource. The 1 st user to register gets the Administrator role by default.
  19. This should be available as a script or an alias ‘w2p’
  20. No need to learn another macro language Can Extend just a single other file Can Include many others
  21. These defaults are why we didn’t need any views for our application.
  22. Create a new folder in the views folder called ‘vts’ & inside that put a new file ‘vehicle_list_create.html’. Type in the text above. Refresh the vehicle page to see the new text: http://127.0.0.1:8000/eden/vts/vehicle
  23. All user-visible text should be localised by calling through T() Amend your view & then update the languages files - the string should now be visible in the list of strings to translate
  24. HTML tags shouldn’t be in the translatable strings If concatenating with strings, need to str() the LazyT 1 st . Tstr() is a convenience function defined within Eden
  25. Open the About page & browse the variables We store our S3 variables in response.s3.*, session.s3.* so as not to pollute the Web2Py namespace
  26. Unique=True is a SQL-level constraint. Open your vts.py from the models directory & add the extra code above. Try to enter bad data: tickets
  27. Validators are DAL-level constraints which produce nice error messages instead of tickets! Validators provide server-side validation & some also provide client-side rendering & validation Add the extra code above to your file & now add bad data to see the difference.
  28. Fields default to type ‘string’. ‘ date’ is the SQL-level field type & also provides the class in the HTML which means we get a date widget Add the extra code above to your file & refresh the page, now enter a date.
  29. Add the extra code above to your file & refresh the page to see the default value
  30. Add this to your controller & try it out
  31. You can check out the languages file again, if you wish: http://127.0.0.1:8000/admin/default/design/eden#languages Update all languages
  32. Add this to your controller & try it out Comment is rendered as ‘column3’ (although can be moved using ‘formstyle’)
  33. Try them out…copy/paste from another controller & then edit…see what effect this has on your module.
  34. Can provide your own custom buttons here – shn_action_buttons are just the common ones. See definition in models/00_utils.py Copy this into your controller file & see what effect this has on your module. This REST ‘post-processor’ has a companion ‘pre-processor’ available too (you can see org.py organsiation() for an example)
  35. URL() is an example of an HTML ‘Helper’ object
  36. Add this text to the file 000_config.py in the models folder. Navigate to the home page to see the module appear both there & on the menu. Try navigating to the module. Module Type 10 means appears in the ‘more’ section of the default modules menu. (Most deployments will create a fully-customised menu anyway)
  37. Add this text to your controller file & now open the module. “ Custom View” is a Doc String One should be added to all functions for automatic documentation generators & interactive browsing of docs You can try this out in the Interactive Shell: w2p execfile("applications/eden/controllers/vts.py", globals()) help(index)
  38. Create a file called ‘index.html’ inside the views/vts folder See plain HTML being interspersed with the server-side parsed Python Look at another module’s index.html What’s bad about this index?
  39. Add this text to your controller (outside the functions – e.g. at the top) & see what effect this has on your module.
  40. Copt this text into your model. Note the use of string substitution to define the tablename
  41. Tells SQL that these fields are ‘reference’ fields (i.e. Foreign Keys) - They store integers which are a pointer to the ID field in the other tables.
  42. Copy this text into your Model & refresh the presence page Reusable field defined in models/03_gis.py Includes additional useful configuration such as .requires & .represent
  43. Copt this text into your controller. Try it out. Note the automation of the resource name to minimise the editing after copy/paste of new functions
  44. Copy this text into your model & see what it does for the page IS_ONE_OF() will provide us a dropdown showing license plates, even though we actually store the ID. This is an S3 validator which extends Web2Py’s IS_IN_DB() to support the ‘deleted’ status & also allow the use of lambdas as formatting options.
  45. We can add additional fields into the link table.
  46. Google: web2py dal Try these out in the Web2Py shell  Don’t take effect until you db.commit() Beware locking with Sqlite! (e.g. cron tasks) Wipe DB if developing a lot For Production, split Dev/UAT/Prod instances so that you can plan Data Migrations (Live migrations works in most cases, but some do need manual scripts still – not a complete ‘Get out of jail free’).
  47. Don’t take effect until you db.commit()
  48. IS_ONE_OF provides the representation in the dropdown table.field.represent provides the representation in Display/List views Optimise the query – we know we only want a single record & a single field from that record
  49. Add this to your model underneath the definition of the Presence table & try out the URL. No need for dedicated presence() controller
  50. Add this Resource Header to your Controller.
  51. Then plug it into the Controller Take another look
  52. Add a Vehicle Presence & view it on the Map
  53. Can automate the collection of the location information if it makes sense
  54. Whilst we spend a lot of time updating developer documentation, the actual codebase always moves faster, so the source is always the most authoritative source of information.
  55. Web2Py source code very accessible – small enough to be able to grasp the whole thing after not too long FORM defined in gluon/html.py: Dumb HTML elements SQLFORM defined in gluon/sqlhtml.py: Self-processing forms which update the database CRUD defined in gluon/tools.py: Wrappers around SQLFORM REST defined in modules/s3xrc.py: RESTful interface & XML representations If you drop down a level, then need to do things more manually & need to take care of framework issues yourself.
  56. NB Don’t redirect in an onaccept or you’ll break bulk XML imports!
  57. XSLT stored in static
  58. More effort at 1 st but makes subsequent resources much faster to copy/paste
  59. S3’s REST Controller is built on top of Web2Py’s ‘Crud’ controller, so we can also use it’s controls NB Be careful using next or you’ll break bulk XML imports!
  60. Only want this in interactive views, not JSON/XML & not in Popups either
  61. We wrap the underlying CRUD functions within REST