Jump to content

Responsive Web App with Unigui webServer + dbfoxScript !! (Testing)


Recommended Posts

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

post-1434-0-75783000-1528707152_thumb.png

post-1434-0-88446100-1528707204_thumb.png

post-1434-0-64214600-1528707217_thumb.png

post-1434-0-47265200-1528707244_thumb.png

post-1434-0-56625400-1528707258_thumb.png

post-1434-0-34581800-1528707941_thumb.png

post-1434-0-01792800-1528709424_thumb.png

  • Like 3
  • Upvote 5
Link to comment
Share on other sites

I digged more into your sample, but I found you use Unigui app as webserver, you all your work is done on client side, so I'm not sure how do you benefit from Unigui with your work?

 

I feel the Delphi MVC framework, Rad Server or Xdata is more suitable to do the backend work, and you use whatever html templates on frontend with jquery or angular or whatever.

 

or am I missing something?

Link to comment
Share on other sites

Hi,

 

@mohammed - Thank you mohammad for your cheers !! 

 

      ( I know how much you love and contribute to Developers of Unigui . )

 

 

 

 

 

 

 

 

very nice, but it missing "dbfox_utils" unit

 

@Mohammed Nasman -  Thanks for interesting and correcting what i missed in this project  .
 
1.  units/dbfox_utils.pas , 
 
    1) it will need foxScript.dcu 
    2) add  foxScript.dcu  in the project folder . 
 
   
2.  foxScript.dcu
 
     1) The core of foxscript. It parses the params to create an SQL statement.
     2) Under construction to make it as a component .
         Unfortunately, the original source codes of foxscript can not be released at this time.

update_20180613.zip

Link to comment
Share on other sites

 

I digged more into your sample, but I found you use Unigui app as webserver, you all your work is done on client side, so I'm not sure how do you benefit from Unigui with your work?

 

I feel the Delphi MVC framework, Rad Server or Xdata is more suitable to do the backend work, and you use whatever html templates on frontend with jquery or angular or whatever.

 

or am I missing something?

@Mohammad Namsan

 

  <Key point>
   - If possible , not add , modify your codes in server module for CRUD  ( Select , Insert , Update , delete , upload file . They are already made in server module )  !! 
   - just add or modify your html or javascript codes  and  foxscripts  outside of server module like php . ( you don't need re-compiling and re-deployment your server ) 
 
1. Why do i use Unigui for this sample project ?
 
    1)  web server + application server( Database ) possible   .
    2)  Benefit with Unigui  all in one  as portable -  easy development  ( Both  : RAD web application + Using javascript framework for Datatables , charts , management of images ,movies , files ) 
    3)  No needs other server script like php -  And  No installing other server , server scripts .
     
2. why did I make foxscript ?
    1) for lazy like me -  I do not like re-compiling and re-deploying again and again  after installing web server once.
    2) for students  -  they can learn how to make responsive web app using database  without any server and server script installing and setting 
    3) I want to handle codes  outsides of server module  in the case using HTML5  for getting json dataset from database server like php .
    4) just make foxscript file and call it  through ajax requesting . 
 
3. why don't you  use foxscript  ?
    1)  Though  you do not know server script like php , jsp , asp ... 
          you should learn of SQL statement ( Select , insert , update , delete )  , 
         if you know SQL-Statements , you can write foxscript  easily
        (   foxscript  =>  <fox@tagname> SQL-statement </fox@tagname>  )
 
    2)  Just call (request) it  in javascript .  it will return in json object  data .
 
          var data = dbfox_ajaxRequest( 'select' , params ) ;        // see about params how to use in sample about update , delete ..
 
          you can use it returned data , for   Datatables , charts ,etc . using every  javascript framework  . 
 
    3)  It dose not matter using with today's famous web frameworks  even native development , if you can use it in them as calling ajax . 
 
 
@Mohammad Namsan - if i dont understand you correctly , let me know again .
 
 
Best Regards,
Link to comment
Share on other sites

Thank you for the detailed answer, but my question was different :)

 

what I mean is: UniGui is great as backend & frontend framework for developing web application

 

but you didn't use the feature of Frontend, and used external html pages with it, you use it as web server only, but this could be done with other backend frameworks such as : Delphi MVC or Rad studio or whatever you like.

 

so my question was, is there any feature you feel it better with unigui for backend programming, without using the powerful extjs library with it.

 

 

@Mohammad Namsan

 

  <Key point>
   - If possible , not add , modify your codes in server module for CRUD  ( Select , Insert , Update , delete , upload file . They are already made in server module )  !! 
   - just add or modify your html or javascript codes  and  foxscripts  outside of server module like php . ( you don't need re-compiling and re-deployment your server ) 
 
1. Why do i use Unigui for this sample project ?
 
    1)  web server + application server( Database ) possible   .
    2)  Benefit with Unigui  all in one  as portable -  easy development  ( Both  : RAD web application + Using javascript framework for Datatables , charts , management of images ,movies , files ) 
    3)  No needs other server script like php -  And  No installing other server , server scripts .
     
2. why did I make foxscript ?
    1) for lazy like me -  I do not like re-compiling and re-deploying again and again  after installing web server once.
    2) for students  -  they can learn how to make responsive web app using database  without any server and server script installing and setting 
    3) I want to handle codes  outsides of server module  in the case using HTML5  for getting json dataset from database server like php .
    4) just make foxscript file and call it  through ajax requesting . 
 
3. why don't you  use foxscript  ?
    1)  Though  you do not know server script like php , jsp , asp ... 
          you should learn of SQL statement ( Select , insert , update , delete )  , 
         if you know SQL-Statements , you can write foxscript  easily
        (   foxscript  =>  <fox@tagname> SQL-statement </fox@tagname>  )
 
    2)  Just call (request) it  in javascript .  it will return in json object  data .
 
          var data = dbfox_ajaxRequest( 'select' , params ) ;        // see about params how to use in sample about update , delete ..
 
          you can use it returned data , for   Datatables , charts ,etc . using every  javascript framework  . 
 
    3)  It dose not matter using with today's famous web frameworks  even native development , if you can use it in them as calling ajax . 
 
 
@Mohammad Namsan - if i dont understand you correctly , let me know again .
 
 
Best Regards,

 

Link to comment
Share on other sites

I have realized this possibility too, but also concluded I could then use any

webserver, and since HTTPCommand apparently does not work in DLL-mode it is not

realistic for production anyway.

Link to comment
Share on other sites

@Mohammed Nasman 

 

 

 

UniGui is great as backend & frontend framework for developing web application

 

 I totally agree. I  fall in love with Unigui !!

 

I also use unigui for development of most of my web applications.  web applications. Sometimes it is inevitable for customers to use the parts described above.

I would like to take a look at this sample project as an attempt to reduce the inconvenience when using HTML5 out of Unigui.

 

Best regards,

Link to comment
Share on other sites

  • 2 months later...
  • 2 years later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...