Page 7 of 10

Re: FiveWeb Questions

PostPosted: Tue Mar 01, 2016 3:54 pm
by Jeff Barnes
Thank you. Exactly what I was looking for :)

Re: FiveWeb Questions

PostPosted: Sat Mar 05, 2016 11:49 pm
by Jeff Barnes
Is there any way to hide the information passed via fiveweb in the address bar?

Re: FiveWeb Questions

PostPosted: Sun Mar 06, 2016 12:18 am
by Jeff Barnes
Another question..
For .js and .css files, I notice (for example in FiveWeb.prg) they are loaded from the internet (see sample below).
Is there anyway to have all these .js and .css files loaded from my server instead of the internet?

I realize I can just change the URL to my server but I would need to know where (what files) I need to look at so I can have all pointed to my server.
Reason: If anything changes on google or bitbucket (files get removed for example), I don't want my webapp to crash.


Code: Select all  Expand view

function IncludeScripts()

   ? '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>'
   ? '<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/jquery-ui.min.js"></script>'
   ? '<script src="https://fiveweb.googlecode.com/svn/trunk/source/js/fiveweb.js"></script>'
   ? '<script src="https://bitbucket.org/fivetech/fiveweb/downloads/jquery.maskedinput.js"></script>'   
   
return nil  
 

Re: FiveWeb Questions

PostPosted: Sun Mar 06, 2016 7:57 am
by Antonio Linares
Jeff,

> Is there any way to hide the information passed via fiveweb in the address bar?

You could encode it and then decode it from the FiveWeb app, so the info seen by the user is meaningless

Re: FiveWeb Questions

PostPosted: Sun Mar 06, 2016 7:58 am
by Antonio Linares
Jeff,

Jeff Barnes wrote:Another question..
For .js and .css files, I notice (for example in FiveWeb.prg) they are loaded from the internet (see sample below).
Is there anyway to have all these .js and .css files loaded from my server instead of the internet?

I realize I can just change the URL to my server but I would need to know where (what files) I need to look at so I can have all pointed to my server.
Reason: If anything changes on google or bitbucket (files get removed for example), I don't want my webapp to crash.


Code: Select all  Expand view

function IncludeScripts()

   ? '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>'
   ? '<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/jquery-ui.min.js"></script>'
   ? '<script src="https://fiveweb.googlecode.com/svn/trunk/source/js/fiveweb.js"></script>'
   ? '<script src="https://bitbucket.org/fivetech/fiveweb/downloads/jquery.maskedinput.js"></script>'   
   
return nil  
 


Simply download those files, keep them in your server and change the files path in function IncludeScripts()

Re: FiveWeb Questions

PostPosted: Fri Mar 18, 2016 12:04 pm
by Jeff Barnes
I ran into a little problem....

When saving the info in the gets if there is a bracket "(" in the text it gets changed.

Original Text:
This is a test (small test)

After saving:
This is a test \(small test\)

If I click save again with the modified text it keeps adding slashes.
This is a test \\\(small test\\\) --- second save
This is a test \\\\\\\(small test\\\\\\\) --- third save etc....

I've tried this with different brackets and the result is the same () {} []

Any ideas?

Re: FiveWeb Questions

PostPosted: Fri Mar 18, 2016 12:31 pm
by Jeff Barnes
Here is a self contained example of the problem. Try entering something like Test (test) and see the result.

Code: Select all  Expand view

#include "fiveweb.ch"

function Main( cParams )
   if pcount() > 0
      Process( cParams )
      return nil
   endif
   SetTheme( "redmond" )
   GetText()
return nil

//----------------------------------------------------------------------------//

function Process( cParams )
   local aParams := hb_aTokens( cParams, ":" )
   do case
      case aParams[ 1 ] == "showtext"
          ShowText(aParams)
   end case
return nil          

Function GetText()
   local oDlg, oGet, cText := Space( 30 )

   DEFINE DIALOG oDlg TITLE "Test" SIZE 650, 400
    @  69, 190 SAY "Text:" SIZE 110, 40 OF oDlg
    @  66, 315 GET oGet VAR cText SIZE 300, 40 OF oDlg
    @ 265, 189 BUTTON "Ok" SIZE 110, 40 OF oDlg ;
            ACTION ( "document.location = '" + AppName() + "?showtext:' + " ) + 'oGet.value'
   ACTIVATE DIALOG oDlg NOWAIT
return nil

Function ShowText( aParams )
    LOCAL cText := ALLTRIM(aParams[2])
    MsgInfo(cText)
Return Nil

 

Re: FiveWeb Questions

PostPosted: Fri Mar 18, 2016 5:53 pm
by Antonio Linares
Jeff,

When the browser sends the parameters to the FiveWeb CGI app, those text are automatically encoded so we need to unescape() them
from the app.

Here you have your example modified to unescape the text using javascript unescape()

Code: Select all  Expand view
#include "fiveweb.ch"

function Main( cParams )
   if pcount() > 0
      Process( cParams )
      return nil
   endif
   SetTheme( "redmond" )
   GetText()
return nil

//----------------------------------------------------------------------------//

function Process( cParams )
   local aParams := hb_aTokens( cParams, ":" )
   do case
      case aParams[ 1 ] == "showtext"
          ShowText(aParams)
   end case
return nil          

Function GetText()
   local oDlg, oGet, cText := Space( 30 )

   DEFINE DIALOG oDlg TITLE "Test" SIZE 650, 400
    @  69, 190 SAY "Text:" SIZE 110, 40 OF oDlg
    @  66, 315 GET oGet VAR cText SIZE 300, 40 OF oDlg
    @ 265, 189 BUTTON "Ok" SIZE 110, 40 OF oDlg ;
            ACTION ( "document.location = '" + AppName() + "?showtext:' + " ) + 'oGet.value'
   ACTIVATE DIALOG oDlg NOWAIT
return nil

Function ShowText( aParams )
   local oDlg
   LOCAL cText := ALLTRIM(aParams[2])
   
   DEFINE DIALOG oDlg TITLE "Test" SIZE 650, 400
    @ 265, 189 BUTTON "Ok" SIZE 110, 40 OF oDlg
   ATail( oDlg:aControls ):cAction = 'MsgInfo( unescape( "' + cText + '" ) )'

   ACTIVATE DIALOG oDlg NOWAIT

Return Nil

Re: FiveWeb Questions

PostPosted: Fri Mar 18, 2016 6:17 pm
by Jeff Barnes
Is there a way to "unescape" the info when trying to save it to the dbf?

What I am doing is passing the data with aParams then doing a
MyDBF->Text := aParams[2]

Re: FiveWeb Questions

PostPosted: Fri Mar 18, 2016 6:21 pm
by Antonio Linares
Jeff,

You may do:

cText = StrTran( cText, "\", "" )

unless you need to save "\" too

Re: FiveWeb Questions

PostPosted: Fri Mar 18, 2016 7:16 pm
by Jeff Barnes
Hmmm, this creates a problem.
I am extracting data from a text file and it could contain slashes that the user would like to keep.

This is an example of one line of text that I grab from the text file:

POSSIBLE RIGHT VENTRICULAR CONDUCTION DELAY [RSR (QR) IN V1/V2]

As you can see it contains both brackets and a slash.

Re: FiveWeb Questions

PostPosted: Fri Mar 18, 2016 8:33 pm
by Antonio Linares
Jeff,

Try this and keep completing it upon your needs:

Code: Select all  Expand view
function Decode( cText )

   cText = StrTran( cText, "\[", "[" )
   cText = StrTran( cText, "\(", "(" )
   cText = StrTran( cText, "\)", ")" )
   cText = StrTran( cText, "\]", "]" )
   cText = StrTran( cText, "\/", "/" )
   cText = StrTran( cText, "\\", "\" )

return cText

Re: FiveWeb Questions

PostPosted: Fri Mar 18, 2016 10:32 pm
by Jeff Barnes
Thanks Antonio ... The same idea hit me on my drive home :)

Re: FiveWeb Questions

PostPosted: Sun Mar 27, 2016 12:11 am
by Jeff Barnes
Two more questions:

1. Is there a way to set a button as the default button so if the user hits the enter key it activates the button?

2. I'm trying to allow the user to select some "canned" text from a list and have it placed into the text field.
I need it to allow the user to keep adding if they want to select other items.
Is there any type of "refresh" for fields?

Re: FiveWeb Questions

PostPosted: Sun Mar 27, 2016 7:19 am
by Antonio Linares
Jeff,

> 1. Is there a way to set a button as the default button so if the user hits the enter key it activates the button?

Here there are several proposals. We should test them:

http://stackoverflow.com/questions/2522125/jquery-ui-dialog-make-a-button-in-the-dialog-the-default-action-enter-key

> Is there any type of "refresh" for fields?

I guess that you have the set its value again:

document.getElementById( "oGet1" ).value = cNewText;