madal


MySQL Ajax Database Access Layer

MADAL - MySQL Ajax Database Access Layer

MADAL allows one to quickly generate ajax enabled web-pages. MADAL is an open source database access layer for MySQL written in PHP and Javascript. MADAL generates documented PHP and Javascript source code from a MySQL relational database. The generated codebase enables object oriented access to the database hierarchy and auto-completion against database tables. MADAL also facilitates trivial implementation of Ajax enabled html inputs for insert/update/delete on database entries.

Inspiration: As I was developing a web application for for a graduate research project, I started to get sick of the required 3 pages every time I wanted an input to do an insert, update, or delete from the database in an Ajaxian way. Further, I didn't like writing the simple SQL statements when I only wanted to access one field of one row. So, I developed MADAL.

MADAL generates PHP and Javascript/jQuery source code that is well documented, so you can use your IDE's auto-completion against database tables and fields. The documentation was designed with PHP Eclipse in mind, but should work for any IDE that recognizes PHP doc.

Here's how simple using MADAL is: $table_name->print_FieldName_input_setter();

This will give you an input field (text, checkbox, textarea, or datepicker) that updates the database FieldName of the row represented by $table_name onblur. Pretty simple, right?

MADAL also generates Javascript objects that allow you to update the database based on your own custom fields.

For example: Classroom2.set_capacity(33);

This will make an ajax call to the MADAL web service. Much simpler than writing a custom update page for every field of the database, and custom classes for every table.

Core components: 1. PHP 1. MySQL 1. Javascript - jQuery

Features: * PHP Model - generates a set of PHP classes that mirror your database schema * Javascript Model - generates a set of javascript/jQuery classes that mirror your database schema and allows for easy client side display and modification * MADAL Web Service - generates an easy to use web-service for accessing your database (includes instructions for implementing security) * Easy ajax - simply print the input field setter and you've got an ajax enabled input field * Field validation - input fields are validated for their type * jQuery ui themes - MADAL includes the whole set of default jQuery ui themes for easy styling of your pages. You can also add more using the jQuery ui theme roller. * Optimistic concurrency - if more than one user is accessing a piece of data, and one of the users updates a field, then the other user updates the same field (but has out of date information), the second user will receive a notification that the field is in use, and the page will auto-refresh thus retrieving the most up-to-date data. * Built in Rich Text wysiwyg editor ( Thanks to jHtmlArea: http://jhtmlarea.codeplex.com/ )

Getting Started

Get started by checking out the wiki pages and follow the installation and hello world instructions. If you have any questions, suggestions or any other feedback, please visit the discussion group and post there.

Example Screenshots

Screenshots from the madal-example-project

Simple Row Adding Example //See Wiki and MADAL Example Project for code http://dl.dropbox.com/u/151973/madal/simple_row_add_example.png

Date Example //Date code $profile->print_date_of_birth_input_setter (); http://dl.dropbox.com/u/151973/madal/date_example.png

WYSIWYG Example ( uses jHtmlArea: http://jhtmlarea.codeplex.com/ ) //WYSIWYG Code $course->print_course_description_wysiwyg_setter(); http://dl.dropbox.com/u/151973/madal/wysiwyg_example.png

Dropdown Example

http://dl.dropbox.com/u/151973/madal/courses_example.png

Autocomplete Example New //Autocomplete code Department::print_Department_autocomplete(Department::getDepartments(), "department_name", "", "setDepartmentId"); http://dl.dropbox.com/u/151973/madal/autocomplete_example.png

Project Information

Labels:
MySQL ajax PHP database-access-layer model-view-controller web-service jQuery