Jump to content


Photo

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

responsive app dbfox foxscript unigui

  • Please log in to reply
10 replies to this topic

#1 David Lee

David Lee

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 53 posts

Posted 11 June 2018 - 08:42 AM

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;

Attached Files


  • 3

#2 mohammad

mohammad

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 823 posts
  • LocationKufur Kassem, Palestine

Posted 13 June 2018 - 09:35 AM

Great, Thank you and it looks good  ;)


  • 0

#3 Mohammed Nasman

Mohammed Nasman

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 174 posts
  • LocationGaza - Palestine

Posted 13 June 2018 - 11:09 AM

very nice, but it missing "dbfox_utils" unit


  • 0

#4 Mohammed Nasman

Mohammed Nasman

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 174 posts
  • LocationGaza - Palestine

Posted 13 June 2018 - 12:55 PM

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?


  • 0

#5 David Lee

David Lee

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 53 posts

Posted 13 June 2018 - 12:59 PM

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.

Attached Files


  • 0

#6 David Lee

David Lee

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 53 posts

Posted 14 June 2018 - 02:43 AM

 

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,

  • 0

#7 Abaksoft

Abaksoft

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 617 posts
  • LocationAlgeria

Posted 14 June 2018 - 10:41 AM

Great David Lee !

+1

in dianostic...


  • 0

#8 Mohammed Nasman

Mohammed Nasman

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 174 posts
  • LocationGaza - Palestine

Posted 18 June 2018 - 08:57 AM

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,

 


  • 0

#9 delphidude

delphidude

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 193 posts
  • LocationNorway

Posted 18 June 2018 - 09:26 AM

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.


  • 0

#10 David Lee

David Lee

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 53 posts

Posted 18 June 2018 - 11:01 AM

@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,


  • 0

#11 David Lee

David Lee

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 53 posts

Posted 18 June 2018 - 11:12 AM

@delphidude 

 

Hi , I remember  and  appreciate  you  gave me lots of helps to understand  kind of this part . 

 

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

realistic for production anyway.

 

I will look again at your advice.

 

Many thanks !!


  • 0





Also tagged with one or more of these keywords: responsive app, dbfox, foxscript, unigui

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users