PHP Classes
elePHPant
Icontem

DABAJAX Toolkit: Auto-complete fields with Oracle database data

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (11)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2009-10-13 (5 years ago) RSS 2.0 feedNot yet rated by the usersTotal: 827 This week: 1All time: 3,912 This week: 1,049Up
Version License PHP version Categories  
dab_ajax_toolkit 1.0Freeware5.0PHP 5, Databases, AJAX
Description Author  

This package can be used to auto-complete form fields with data retrieved from an Oracle database.

It can execute SQL queries to an Oracle database to complete text typed in form fields using parameters passed by Javascript code to PHP scripts using AJAX requests.

The queries may take parameters from different form fields that define filters for the data to be queried.

Picture of adscript
Name: adscript <contact>
Classes: 2 packages by
Country: Brazil Brazil
Age: 44
All time rank: 2068141 in Brazil Brazil
Week rank: 828 Up65 in Brazil Brazil Up

Details provided by the author  
AJAX toolkit was created to auto complete other elements into a html document.
It was firstly designed for situations when you have some fields that must be filled when
the user types something in some field ( like a primary key field ) and
this field lost the focus ( onblur event ).

in your View.html the sql is a md5 key. why? it's used to not allow client to see
your sql code and do modifications to obtain some privilleges.
To get your MD5 key, you must get your SQL defined at AjaxQueries.class.php and 
apply php md5( "select f1, f2, ..., fn from table" ).
Each SQL defined at AjaxQueries.class.php must have an index like follows:

$v[ 1 ] = "select nm_contato, telefone from contato";

For javascript you must use:
sql = "1:afe8133bd534f4a04e1222c913b735f7"; 

This AJAX toolkit is defined to be used with Oracle Databases. 
But to change it, is easy. The steps to change it follows below:

  1 - create a valid connection with your database in your Controller script ( Controller
      does not need to be named like this. It's only used for examples )
  2 - modify your SQL statement at AjaxQueries.class.php to match to your DB
  3 - change lines greater than 82 and stop using oci functions. 

This Ajax toolkit was implemented with Oracle and oci php functions. This is the first
version and other releases must use some more generic such as PDO or ADODB or something like that.
If someone wants to contribute, there is no problem.

Fixed Classes that does not need modifications
---------------------------------------------------
AjaxControlFiltler.class.php
AjaxFilter.class.php
AjaxFormat.class.php
AjaxOptionsValidator.interface.php


AjaxQueries.class.php must be modified to acomodate your queries

Examples:
-----------------------
View.html - document with html fields and needed javascript to send requests and manage response from server
Controller.php - server side script to deal with View requests/responses
BusValidator.example.php - example of customized validator 

Dependencies
----------------------
JSON - JavaScript Object Notation extension

Javascript scritps
------------------------
tkajax.js defines 3 global variables that must be used by your customized javascripts
like used in View.html

 - these variables must be references to some JS "objects"
 - you will create instances for it
 
 _ajaxobject          => TKAjax 
 _ajaxresultjsontext  => the result from server - JSON encoded
 _ajaxcallbackresult  => your function to treat responses from server

website: aeloy.blogspot.com
  Files folder image Files  
File Role Description
Files folder imagejs (2 files)
Plain text file AjaxControlFiller.class.php Class The main class
Accessible without login Plain text file README Doc. readme
Accessible without login Plain text file View.html Data view mode
Accessible without login Plain text file Controller.php Example example of a controller
Plain text file BusValidator.example.php Class customized option validator
Plain text file AjaxQueries.class.php Class Class with your SQL statements
Plain text file AjaxOptionsValidator.interface.php Class Interface for customized options validators
Plain text file AjaxFormat.class.php Class Class to format data for SQL statements
Plain text file AjaxFilter.class.php Class class that define filters, results and SQL to be executed

  Files folder image Files  /  js  
File Role Description
  Accessible without login Plain text file tkajax.js Data the core for ajax toolkit
  Accessible without login Plain text file JSON.js Data JSON script ( this is an extension )

 Version Control Unique User Downloads Download Rankings  
 0%Total:827All time:3,912
 This week:1This week:1,049Up