build joomla! 3.0 business apps with chronoforms

34
Build Joomla! business apps with ChronoForms Russell Searle 19 Jan 2013

Upload: russell-searle

Post on 13-May-2015

690 views

Category:

Technology


1 download

DESCRIPTION

This presentation is an expansion and elaboration of my talk on ChronoForms web application development from Jan 2011. Presented at Melbourne Joomla!Day on 19 Jan 2013.

TRANSCRIPT

Page 1: Build Joomla! 3.0 business apps with ChronoForms

Build Joomla! business apps with ChronoForms

Russell Searle

19 Jan 2013

Page 2: Build Joomla! 3.0 business apps with ChronoForms

Introduction

• Introduction• Requirements• Analysis and modelling• Design• Development• Testing• Deployment

Page 3: Build Joomla! 3.0 business apps with ChronoForms

Why build business apps?• Businesses automate and connect business processes ->

significant cost reductions = improve profitability• Use Joomla! as a framework, it has all the services and

elements• Attract bigger clients for longer term engagements and more

repeat business• Work on more interesting projects• More demanding custom development work attracts higher

rates• Produce higher value applications and sites• Possibly reduce need to interface / integrate separate

customer apps

Page 4: Build Joomla! 3.0 business apps with ChronoForms

Elements of business apps

Feature ChronoForms product

Forms ChronoForms

Views ChronoConnectivity

Workflow: mail ChronoForms

Workflow: state

ChronoForms, ChronoConnectivity

Page 5: Build Joomla! 3.0 business apps with ChronoForms

ChronoForms product range• ChronoForms

• Builds chainable CRUD forms for any data• Simple form controls, rich set of actions, fully programmable

• ChronoConnectivity• Builds views of any data• Front-end and back-end views in one view object

• ChronoForums• A beta-version forum built on CF, similar to phpBB V3• For sites that need a modified or customised forum• Reference installation for CF features and techniques

• ChronoContact• A simplified contact form builder

Page 6: Build Joomla! 3.0 business apps with ChronoForms

ChronoForms features• Drag and drop form builder• Wizards for basic and complex forms• Basic set of configurable input elements, plus custom element• Extensive set of configurable form actions

• A CF form does not have to have a UI!

• Custom callable events• Pluggable architecture• Extremely customisable and programmable• Suits web developers: HTML, PHP, JavaScript, CSS, AJAX• Developed by Max (ChronoMan), supported by Max and

Bob Janes (author of Packt book, custom actions and tutorials)

Page 7: Build Joomla! 3.0 business apps with ChronoForms

Two types of forms CCK• “Vertical” data organisation

• Multiple physical records per logical record• Fixed table and column names, fixed key and indexes• RS Form! Pro organises main tables “vertically”

Form builder RSForm! ProTable #__reform_submission_values

SubmissionValueId FormId SubmissionId FieldName FieldValue

1 1 1 name Joe Blow2 1 1 email joe@[email protected] 1 1 address1 1 Fred Street4 1 1 address2 5 1 1 suburb Carlton6 1 1 state Vic7 1 1 postcode 30848 1 1 country AU9 1 1 phone 03 5555 1234

Page 8: Build Joomla! 3.0 business apps with ChronoForms

Two types of forms CCK• “Horizontal” data organisation

• One physical record per logical record• Custom table and column names, custom key and indexes• ChronoForms organises data “horizontally”

Form builder ChronoForms

Table #__chronoforms_data_mailusers

name email address1 address2 suburb state postcode country phone

Joe Blow joe@[email protected] 1 Fred Street Carlton Vic 3084 AU 03 5555 1234

Page 9: Build Joomla! 3.0 business apps with ChronoForms

Comparison of forms CCKs

Feature “Vertical” storage “Horizontal” storage

Flexibility Very flexible Rigid structure

Adaptability Highly adaptable Slow to adapt

Extensibility Easy, fast extension Painstaking extension

Efficiency, performance ? OK for small-medium DBs High performance

Scalability Limited, constrained Practically unlimited

Joins and views Hopeless Practically unlimited

Report production Poor reporting support Strong reporting features

Processing complexity Limited to simple apps Highly complex DBs/apps

Data typing Weak typing Strong typing

Page 10: Build Joomla! 3.0 business apps with ChronoForms

Requirements

• Introduction• Requirements• Analysis and modelling• Design• Development• Testing• Deployment

Page 11: Build Joomla! 3.0 business apps with ChronoForms

CFDemo organisation chart

CEO

Finance

Fred

Sales

Sarah

Sam

HR

Helen

Payroll

CFDemo

Page 12: Build Joomla! 3.0 business apps with ChronoForms

Business processThe new online leave application process works as follows:• To gain access to online Leave Application facilities, you must log in to the CFDemo application as one of the CFDemo employees.• Begin the leave application process by clicking the Apply for Leave link in one of these places:

• The Apply for Leave option in the HR drop-down menu from the top menu bar• The Apply for Leave option in the HR section menu in the left sidebar

• You will be asked which type of leave you are applying for: Annual, Sick, Long Service or Bereavement leave.• If you are a manager who has the authority to submit leave applications on behalf of your staff, you will also be asked whether you are

submitting the leave application for yourself, or on behalf of one of your staff members.• Fill out and submit the Leave Application form. Required values have labels marked with *. There are pop-up calendars for the starting

and ending leave dates. Please be sure to enter the correct number of working days off. You must apply for a minimum of one day's leave.

• For sick leave applications, please upload a scanned copy of your doctor’s certificate. For bereavement applications, please identify your relationship to your deceased relative.

• When you submit the form, three e-mails are sent:• You receive an acknowledgement e-mail at your registered e-mail address.• The Payroll Administrator will receive a request to check and confirm your available balance of the type of leave you have requested.• The manager who approves your leave applications will receive a copy of your application, for planning purposes.

• When the Payroll Administrator checks your leave balance, another e-mail is sent to the manager who approves your leave applications:

• Your manager will be asked to review and approve your leave application. The manager may refuse your application, but if so, he or she must record a reason.

• If your manager is unable to review your leave application for some reason, the Payroll Administrator can review and update your application on behalf of your manager.

• When your manager reviews and updates your leave application, two more e-mails are sent:• You receive an e-mail advising the manager's decision. If your leave application is refused, please discuss the matter with your manager.• If your application is for Long Service leave, the Managing Director will also receive a copy of your manager's decision on your leave

application.• The e-mail to you is also copied to the Payroll Administrator, for management purposes.

Page 13: Build Joomla! 3.0 business apps with ChronoForms

More business rules• CFDemo managers may have staff who are not employees, e.g. casuals, contractors. In general these staff do not

have trusted CFDemo e-mail addresses. Managers are expected to apply for leave on behalf of these staff members, and to communicate directly with them about their leave applications. For this reason, the LeaveApplicationProxy form requires entry of the applicant’s name but it does not allow entry of an e-mail address, and proxy leave applications do not attempt to notify the leave applicant at any stage of the work flow.

• There are four types of leave but in each case, there are several options for the way that wages may be paid during the employee’s absence. This attribute is referred to as the “Leave Option”. It is selected during the initial leave application but can be changed later by the Payroll Administrator.

• Each type of leave also has different attributes, as follows:• Annual Leave. This is the basic form of leave, there are no additional fields on the Leave Application form.• Sick Leave. Applicants are expected to provide a doctor’s certificate for all sick leave. This can be uploaded on the initial

leave application, or the leave applicant can provide it later and the Payroll Administrator or the Approving Manager can upload it to the application at a later stage, even after leave has been approved.

• Long Service Leave. There are no additional fields on the Leave Application form, but the CEO is copied in on the leave approval email notification.

• Bereavement Leave: The leave applicant must specify his or her relationship to the deceased person, and only a specified set of relationships are accepted for the granting of Bereavement Leave. In addition, the leave days credit must be paid for from one pf the normal leave balances that are due to the applicant.

• If the Approver Manager refuses a Leave Application, he or she must provide a reason for doing so, but that reason is not communicated in email notifications.

• The system does not attempt to maintain the leave days’ balances for employees, the Payroll Administrator handles that separately with other systems.

• Managers need a Leave Schedule report so they can review planned or past absences from their departments.• The Payroll Administrator needs the ability to review, update and delete all Leave Applications at any time. No mail

notifications are sent when the Payroll Administrator updates Leave Applications outside the normal work flow.

Page 14: Build Joomla! 3.0 business apps with ChronoForms

Analysis and modelling

• Introduction• Requirements• Analysis and modelling• Design• Development• Testing• Deployment

Page 15: Build Joomla! 3.0 business apps with ChronoForms

Analysis process• Business analysis is skilled, demanding, high-value work• Analysts think in terms of processes, structures, models• Good modelling tools can generate schemas and code• Products of analysis

• Business process narrative• Process and partial data models• Requirements• Functional spec• Test cases• Partial database schema• Basic classes in various target languages

Page 16: Build Joomla! 3.0 business apps with ChronoForms

Simplified JSD analysis

A simplified method, based on Jackson System Development1. Obtain a written narrative description of the business

process, including objects, inputs, outputs and actors

2. Get four highlighters

3. Highlight all nouns in colour #1:these are candidate entities, or candidate master tables

4. Highlight all verbs in colour #2:these are candidate actions, transactions or relationships

5. Highlight all adjectives in colour #3:these may be candidate attributes for related entities

6. Highlight all adverbs in colour #4:these may be candidate conditions or modifiers

Page 17: Build Joomla! 3.0 business apps with ChronoForms

Analysis methods• UML: Unified Modelling Language• Key product of OMG: Object Management Group• UML provides standards and specs for modelling business

and application processes, structure, behaviour and architecture

• UML tools produce various diagrams• Users can understand and react to UML diagrams• Most useful behavioural diagrams for analysis:

• Use cases• Activity• Sequence• Interaction• Communication

Page 19: Build Joomla! 3.0 business apps with ChronoForms

CFDemo use case

uc Actors

CFDemo Leave Application

Applicant

Payroll

Approv er

Applies for leav e

Check Leav e Balance

Approv e / Refuse Application

«Notfiy»

«Notify»

«Notify»

«Notify»

«Notify»

Page 20: Build Joomla! 3.0 business apps with ChronoForms

Design

• Introduction• Requirements• Analysis and modelling• Design• Development• Testing• Deployment

Page 21: Build Joomla! 3.0 business apps with ChronoForms

Design methods and tools• Use some more UML, continue from analysis work• Most useful structural diagrams for design:

• Class• Object• Package

• For web sites, page layout and form styling may also be required, but this is usually a separate stream of work

Page 22: Build Joomla! 3.0 business apps with ChronoForms

Data model• The data model is the single most important product

• If the data model is sound, there will always be a reasonable solution for functional requirements, and support cost and effort will be predictable

• If the data design is incomplete, wrong or weak, the application will have a high life-cycle cost, it will cause trouble and pain, and it will eventually break

• Make every effort to align the data model with the real world• Entities• Relationships• Indexes• Foreign keys• Attributes• Constraints• Stored procedures• Triggers

Page 23: Build Joomla! 3.0 business apps with ChronoForms

Data modelling• Make the effort to build a data model for any non-trivial

application• Build a fully normalised model (3NF)

• You can always de-normalise it later if necessary for performance, reporting or data warehousing

• But not vice versa: difficult and expensive to normalise a non-normal database

• Elaborate BA’s partial data models and schema• Or start with entities and attributes from

simplified JSD analysis method

• Refine until you can prove that use cases are satisfied

Page 24: Build Joomla! 3.0 business apps with ChronoForms

Data modelling tools• Microsoft Visio

• Very commonly used, but doesn’t do code generation

• MySQL Workbench 5.x• phpMyAdmin also includes a basic data modeller

• You have to set up phpMyAdmin configuration storage.This is a bit tricky, but it’s worth doing.

• IBM Data Studio• Many other database clients have data modelling features• Many UML analysis tools also have data modelling

features

Page 25: Build Joomla! 3.0 business apps with ChronoForms

class Schema1

#__chronoforms_data_leav eapplication

«column»*PK cf_id :INTEGER cf_uid :VARCHAR(255) cf_created :DATETIME cf_modified :DATETIME cf_ipaddress :VARCHAR(255) cf_user_id :VARCHAR(255) stage :VARCHAR(255) applicant :VARCHAR(255) leavetype :VARCHAR(255) name :VARCHAR(255) email :VARCHAR(255) leaveoption :VARCHAR(255) leavecomments :VARCHAR(255) leavestart :DATETIME leaveend :DATETIME daysoff :INTEGER certificate :VARCHAR(255) relationship :VARCHAR(255) checkbalance :VARCHAR(255) approved :VARCHAR(255) refusalreason :VARCHAR(255) approver :VARCHAR(255) approveremail :VARCHAR(255)

«PK»+ PK_cf4_chronoforms_data_leaveapplication(INTEGER)

#__chronoforms_data_leav edefinition

«column»*PK cf_id :INTEGER cf_uid :VARCHAR(255) cf_created :DATETIME cf_modified :DATETIME cf_ipaddress :VARCHAR(255) cf_user_id :VARCHAR(255) parameter :VARCHAR(255) parameterValue :VARCHAR(255) parameterDescription :VARCHAR(255)

«FK»+ FK_parameter(VARCHAR)

«PK»+ PK_cf4_chronoforms_data_leavedefinition(INTEGER)

#__chronoforms_data_leav erule

«column»*PK cf_id :INTEGER cf_uid :VARCHAR(255) cf_created :DATETIME cf_modified :DATETIME cf_ipaddress :VARCHAR(255) cf_user_id :VARCHAR(255) rule :VARCHAR(255) factor01 :VARCHAR(255) factor02 :VARCHAR(255) factor03 :VARCHAR(255) factor04 :VARCHAR(255) result01 :VARCHAR(255) result02 :VARCHAR(255)

«PK»+ PK_cf4_chronoforms_data_leaverule(INTEGER)

#__users

«column»*PK id :INTEGER* name :VARCHAR(255)* username :VARCHAR(150)* email :VARCHAR(100)* password :VARCHAR(100)* usertype :VARCHAR(25)* block :TINYINT = 0 sendEmail :TINYINT = 0* registerDate :DATETIME = '0000-00-00 00:...* lastvisitDate :DATETIME = '0000-00-00 00:...* activation :VARCHAR(100)* params :TEXT* lastResetTime :DATETIME = '0000-00-00 00:...* resetCount :INTEGER = 0

«PK»+ PK_cf4_users(INTEGER)

«index»+ usertype(VARCHAR)+ idx_name(VARCHAR)+ idx_block(TINYINT)+ username(VARCHAR)+ email(VARCHAR)

+FK_parameter

Parameterreferences

+FK_rule,FK_factor01,FK_factor02

+name

Userreference

+FK_factor04,FK_result02

+composite key

Rulereferences

+various

+name

Userreferences

+FK_applicant,FK_approver

+composite key

Definitionreferences

+various

CFDemo data model

Page 26: Build Joomla! 3.0 business apps with ChronoForms

Data design

• Actors• Applicant• Approver• Delegate (dropped)• PayrollAdmin• ManagingDirector

• Entities = Tables• LeaveDefinition• LeaveRule• LeaveApplication

• Relations• LeaveApplication -> LeaveDefinition• LeaveApplication -> LeaveRule

• Major Attributes• LeaveDefinition

• name, value, description

• LeaveRule• rule, factors x 4, results x 2

• LeaveApplication• applicantType• leaveType

• leaveOption

• stage• checkBalance• approved• All actors• etc …

Page 27: Build Joomla! 3.0 business apps with ChronoForms

Forms designLeave Application Forms List

Stage Process Seq Name Type Use Case Next Seq

Control 1 LeaveDefinition Form Defines entity-level parameters for Leave Application forms 2, 3

2 LeaveDefinitionList View List Leave Definitions for add or update 3

Control 3 LeaveRule Form Defines combination rules to populate LeaveApplication forms 4, 5

4 LeaveRuleList View List Leave Rules for add or update 5

Apply 5 LeaveApplicationMaster Switch Present Approver options or Applicant Leave Type option 6 or 7

6 LeaveApproverOptions Form Approver chooses Leave Type and either LeaveApplicationSelf or LeaveApplicationProxy 8 or 9

7 LeaveApplicantOptions Form Applicant chooses Leave Type 9

9 LeaveApplicationSelf Form Leave Application for Self 10

8 LeaveApplicationProxy Form Leave Application for Employee 10

CheckBalance 10 LeaveCheckBalance Form Payroll Administrator approves available Leave Balance 11, 12

11 LeaveCheckBalanceList View Payroll Administrator reviews and updates all Leave Applications awaiting Leave Balance approval 12

ApproveLeave 12 LeaveApproval Form Approver approves Leave Application 13, 14

13 LeaveApprovalList View Approver reviews and updates all Applications awaiting his/her Leave approval 14

Control 14 LeaveApplicationAll Form Payroll Administrator updates any Leave Application 15

15 LeaveList View Payroll Administrator reviews and updates all Leave Applications end

Page 28: Build Joomla! 3.0 business apps with ChronoForms

Development

• Introduction• Requirements• Analysis and modelling• Design• Development• Testing• Deployment

Page 29: Build Joomla! 3.0 business apps with ChronoForms

Final HR Leave Application product

Demonstration

Page 30: Build Joomla! 3.0 business apps with ChronoForms

Testing

• Introduction• Requirements• Analysis and modelling• Design• Development• Testing• Deployment

Page 31: Build Joomla! 3.0 business apps with ChronoForms

Testing ChronoForms• Use a good IDE and copy/paste code to/from CF

elements and actions; helps to get syntax right• Have a test plan and a suite of unit tests• Test in pieces; test incrementally; test as you go• Test boundary conditions• Use the Debugger action freely• Use Firebug to debug HTML, CSS, JavaScript• PHP debuggers like Xdebug, Zend Debugger are useful

but it’s not easy to drill down to deep code in Joomla!• Use Selenium to automate unit test suite

Page 32: Build Joomla! 3.0 business apps with ChronoForms

Deployment

• Introduction• Requirements• Analysis and modelling• Design• Development• Testing• Deployment

Page 33: Build Joomla! 3.0 business apps with ChronoForms

Deploying ChronoFormsExporting an application:• Survey your forms and list any custom actions used• Identify any related groups and access levels• Backup CF and CC forms from CF / CC managers• Export database tables with phpMyAdmin or other MySQL client

Deploying an application:• Install custom actions required for your app• Create required groups and access levels• Import database tables with phpMyAdmin / MySQL client• Change table prefixes of imported tables• Restore CF and CC forms in CF / CC Managers• Work through all forms and connections and update database table names• Check any static email addresses and embedded URLs• Recreate menus and menu items

Page 34: Build Joomla! 3.0 business apps with ChronoForms

References• ChronoForms product site:

• http://www.chronoengine.com/• Bob Janes’ support site:

• http://greyhead.net/• My CFDemo case study site:

• http://cfdemo.psicom.com.au/• Bob Janes’ ChronoForms 3.1 Cookbook:

• http://www.packtpub.com/chronoforms-31-joomla-site-cookbook/book

• MooTools:• http://mootools.net/

• FormCheck class:• http://mootools.floor.ch/docs/formcheck/files/formcheck-js.html