FiveWeb Questions

User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: FiveWeb Questions

Post by Jeff Barnes »

Thank you. Exactly what I was looking for :)
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: FiveWeb Questions

Post by Jeff Barnes »

Is there any way to hide the information passed via fiveweb in the address bar?
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: FiveWeb Questions

Post 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

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   
 
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: FiveWeb Questions

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: FiveWeb Questions

Post 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

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()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: FiveWeb Questions

Post 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?
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: FiveWeb Questions

Post 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

#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

 
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: FiveWeb Questions

Post 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

#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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: FiveWeb Questions

Post 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]
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: FiveWeb Questions

Post by Antonio Linares »

Jeff,

You may do:

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

unless you need to save "\" too
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: FiveWeb Questions

Post 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.
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: FiveWeb Questions

Post by Antonio Linares »

Jeff,

Try this and keep completing it upon your needs:

Code: Select all

function Decode( cText )

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

return cText
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: FiveWeb Questions

Post by Jeff Barnes »

Thanks Antonio ... The same idea hit me on my drive home :)
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: FiveWeb Questions

Post 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?
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: FiveWeb Questions

Post 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/2522 ... -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;
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply