FiveWeb Questions

Re: FiveWeb Questions

Postby Jeff Barnes » Tue Mar 01, 2016 3:54 pm

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

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: FiveWeb Questions

Postby Jeff Barnes » Sat Mar 05, 2016 11:49 pm

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

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: FiveWeb Questions

Postby Jeff Barnes » Sun Mar 06, 2016 12:18 am

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  RUN

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 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: FiveWeb Questions

Postby Antonio Linares » Sun Mar 06, 2016 7:57 am

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: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FiveWeb Questions

Postby Antonio Linares » Sun Mar 06, 2016 7:58 am

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  RUN

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
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FiveWeb Questions

Postby Jeff Barnes » Fri Mar 18, 2016 12:04 pm

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 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: FiveWeb Questions

Postby Jeff Barnes » Fri Mar 18, 2016 12:31 pm

Here is a self contained example of the problem. Try entering something like Test (test) and see the result.

Code: Select all  Expand view  RUN

#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 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: FiveWeb Questions

Postby Antonio Linares » Fri Mar 18, 2016 5:53 pm

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  RUN
#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
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FiveWeb Questions

Postby Jeff Barnes » Fri Mar 18, 2016 6:17 pm

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 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: FiveWeb Questions

Postby Antonio Linares » Fri Mar 18, 2016 6:21 pm

Jeff,

You may do:

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

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

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

Re: FiveWeb Questions

Postby Jeff Barnes » Fri Mar 18, 2016 7:16 pm

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 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: FiveWeb Questions

Postby Antonio Linares » Fri Mar 18, 2016 8:33 pm

Jeff,

Try this and keep completing it upon your needs:

Code: Select all  Expand view  RUN
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
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FiveWeb Questions

Postby Jeff Barnes » Fri Mar 18, 2016 10:32 pm

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

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: FiveWeb Questions

Postby Jeff Barnes » Sun Mar 27, 2016 12:11 am

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 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: FiveWeb Questions

Postby Antonio Linares » Sun Mar 27, 2016 7:19 am

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

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

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 45 guests