Hi ,
In fact, I have long been eager to create a Responsive web app with Unigui. Of course, it's enough to create an app that handles administrative or massive data with Unigui. However, sometimes there are a lot of demands for design from clients and for responsive web. With UniGui's UniGUIServerModuleHTTPCommand, you can create a responsive and responsive app that meets your needs. However, this approach is often annoying when dealing with Unigui's greatest strength, Dataset. So, to make the best use of Unigui's advantages and to avoid the inconvenience of forming datasets, I wrote a very small module and named it dbfoxScript. As the name implies, it not only imports Datasets from the server, but also makes them faithful to the CRUD role. Therefore, if you need to add or modify datasets, you can speed up your development by minimizing the compile behavior after opening and modifying the Server Module like the previous development.
Of course, developing a Web app in HTML can be a tiring thing. We are already familiar with Unigui through intuitive and easy development.
<About dbfoxScript>
It is a simple script made only for CRUD. select, insert, update, delete, upload (File).
It can be used when using Ajax with Unigui Server instead of PHP, JSP, ASP.
Currently, it is under testing, and will make minimal functionality. It was easy to create using Unigui's modules and components.
nice connections with jQuery mobile, ReAct native, Ionic, and so on.
Supported RDBs are SQL server, Firebird, MySQL and so on ( with UniDac )
<Configuration>
1. Webserver: Unigui
2. dbfoxScript: Unigui
3. Designed Templete: Luna (Comercial) * Design choice is up to you.
4. Sample Database: Firebird 5. Unidac
Lets start !!
1. prepare to connect Database
-- open settinginfo.ini and Edit yours !!
[UNIDAC]
ProviderName=Interbase
Server=127.0.0.1
Username=SYSDBA
Password=masterkey
Database=<youPath>\uni_dbfox_ajax_unidac_luna_master\IBDATA\uni_demo.fdb
Provider=prAuto
//Provider=prDirect
//Provider=prAuto ( Firebird )
2. how to call foxscript in javascript
- remember ( CRUD means that those are 'select, update,delete,insert , upload )
- refer ServerModule.pas
- this is for only 'select' query
// sample 1 . dbfox/Datatables_member.html
function get_member(){
var search_key = $("#search_member_name").val() ;
if (search_key=='')
{
search_key = '' ;
} else {
search_key = search_key ;
}
var params = {
foxFileName : 'member.fox', //[restrict] - only write fox file name ( should not use with folder )
foxTagName : 'fox@select_member',
search_name : '%'+search_key+'%'
};
//********************************************************
//connect Database and Return Selected Dataset as Json - That's it
//********************************************************
var data = dbfox_ajaxRequest( 'select' , params ) ;
console.log( data[0]);
That'all . BTW , what params mean ?
- first , open fox file dbfox/scriptures/member.fox
- second look for Tag of fox@select_member
- Automatically , it makes SQL statement and return jsonDataset to Client.
/*********************
* member.fox
*
*/
<fox@select_member>
SELECT
member_id , member_name , member_image_filename , userid , password , indate , zaddr1
FROM MEMBER
WHERE member_name LIKE :search_name
</fox@select_member>
* foxScript will return jsonDataset .
3. ServerModule.pas
procedure TUniServerModule.UniGUIServerModuleHTTPCommand(
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo;
var Handled: Boolean);
var
r : string ;
params : TStrings ;
begin
//1.select
if UpperCase(ARequestInfo.URI) = UpperCase( '/SELECT' ) then begin
Handled := true;
r := remote_Select( params ) ;
AResponseInfo.ContentText := r ;
end;
//----- refer source about Insert , delete , upload(File/Image)
end;
uni_dbfox_ajax_unidac_luna_master.zip