RSP

Q:
I would like to add a conditional statement in a .rsp page that would only print a memory variable if it was not equal to 0. This needs to be done in a text raw portion of the .rsp page
Screenshot - 23.1.2017. , 20_11_47.png
A:

You can close and then reopen the text raw…endtext

Screenshot - 23.1.2017. , 20_14_01.png

Q:
I’ve developed an RSP page based on “desktopwebservices”.
On App builder, if I enable the embedded HTTP Server, work fine.
On App center.. not work.
A:
the ‘Enable services‘ is not being saved to the App, then they will not be enabled when you deploy the App.

Q:
web reports. I am using FoxPro as my language and am trying to launch a .rsp file I created. The do function gives me an error when activated by an object button.
Is there a different command to launch a.rsp file? The error I receive is actually related to an .rso file, but I am unsure what this is.

A:
To execute an rsp file specify it in a Webview section.
The
HTML you generate will be loaded into that Webview.
In LianjaDemo, go to Report for customer over their credit limit.
The page has a webview section on it. Click the Attributes cog:
The, in the attributes, go to the Data section:pasted-image-0

Q:
I’ve a RSP page with Hyperlink column.
If I show the RSP page with “Lianja.ShowDialog”, how can I specify the “Delegate Hyperlink“?
A:
Screenshot - 23.1.2017. , 20_14_54.png

Q:
I’ve a table,, witha a memo field.
In the grid section, I write:
Bianco,Rosso,Rosè,Nero
2016-02-15-08_30_15-lianja-app-builder-post-new-thread
If I test the field (? myField), I get:

Screenshot - 23.1.2017. , 20_17_50.png

Is possible to use standard memo field without all the HTML?
Or..
Is possible to remove all the HTML?
A:
Memo fields are rich text formatted. If an attribute was provided for this you would need to make sure you always stored plain text in the memo everywhere. That’s messy with web and mobile.


Q:
Screenshot - 23.1.2017. , 20_23_52.pngScreenshot - 23.1.2017. , 20_24_41.png

Then I’ve a Javascript Commandbutton.
Is possible to refresh the page from Javascript? As a recall the drawTable() function..
A:
Reference the section and change the URL adding arguments.
You should read the arguments using getParameter() and use these to determine what data is displayed. Seeing that this is a desktop Webview with no cloud server you can’t use Ajax, just change the URL
and issue a refresh. You can have a procedure that you call that does all this.
I notice your HTML is wrong.

border=”0px”
(needs to be in quotation marks)

Q:
How I can enable cache browser using .rsp.
Today the generated page have the modified date is 07/27/1997 02:00.
I need set to datetime()
I already try use meta tags and dont work.
I change the http settings to enable cache and dont work, too!
A:
.rsp pages are compiled dynamically if the source file is newer than the .rso object file. That’s how all dynamically generated pages work.
These pages are not cached in the browser, they are cached on the server.
Caching only affects static content such as images, JavaScript files and CSS files.

Q:

fabtest.rsp:

Screenshot - 23.1.2017. , 20_30_09.png

tabella.html:

Screenshot - 23.1.2017. , 20_31_15.png

Console command:
Code:
Lianja.ShowDialog("Search & Find", "http://localhost:8002/desktopwebservice/fabtest.rsp?firstname=Yvonne&lastname=Milne")
Name:  showdialog.png Views: 24 Size:  6.5 KB
Name:  iframe.png Views: 29 Size:  17.8 KB
in my inframe I’ve this line of HTML:
Screenshot - 23.1.2017. , 20_32_50.png
this is my RSP code:
Screenshot - 23.1.2017. , 20_35_01.png
A:
You are calling the function instead of passing it’s address. Remove the ()

Q:
I call a RSP page with this function:
Lianja.ShowDialog(“Search & Find”, “lib:/sup_quickselect.rsp?fields=valore,valore&target=va lore&caption=Valore,Valore2”)
and work fine.. it open a Dialog, whit a row of the source table.Now I’ve added a first Row, witha a text box and a button “cerca” (= find).

My target is:
the user type something in the textbox, then press “Cerca”…

I would like to launch a function that reads the values of the first line “Valore” and “Valore2”, refresh the query and make a refrsh ..
2016-02-18-11_29_32-search-find
you can make that all be in VFP.
Instead of document.write you would simple print it.

Screenshot - 23.1.2017. , 21_09_30.png

etc.

Anything in the RSP gets evaluated on the server, not on the client.

If you have a JavaScript page/section, then JavaScript you put in there runs on the client. The exception of course being a Lianja.evaluate() call, which would run on the server and then send the result back to the client.
Anything you want to have happen on the page that has already been sent has to be in JavaScript, so it will run on the page in the client. When sending the page, you can use VFP to get your work done.

The question I have is: why are you using an .rsp page for this? It seems that a Canvas section would better suit your needs (I’m assuming this is a desktop app).
On a Canvas, you can put whatever you want wherever you want it, including a grid in the canvas.
For that matter, you could use two form sections, with the textboxes in the section above, no footer on the top section, no header on the bottom, so they look like one.


Q:
I recently had a request to serve up results of a powershell command from an rsp page.
I wasn’t sure it its possible, so I thought I would ask if anyone had tried.First request is just a simple list of all services on a given server.

Code:
PowerShell.exe  Get-Service -ComputerName myserver
A:

on way is to instantiate the PowerShell object as a .Net object — check out Doug Hennigs article on using PowerShell in VFP, p.33:http://doughennig.com/papers/Pub/PowerShell.pdf.I don’t know if wwDotNetBridge, which it uses, will work in Lianja, but there’s a good chance it will. If it does, this would give you the opportunity to make a dynamic application with a list of the scripts or cmdlets or whatever.

The alternative is to run with the run command in Lianja (in a VFP code section of the .rsp) and generate a log file output and use that to display or parse/display.
I recall Barry telling us to create tempfile for rsp pages.

Like in the image example:

// Look up an employee
seek “Smith”// Create a unique temporary name (guaranteed uniqueness across concurrent users in a network)
m_tmpnam = tmpnam()// Extract the photo from the database and write it to the temporary file
objectWrite(m_tmpnam,photo)// Generate the base64 encoded contents as an IMG tag and output into the HTML5
base64_encode_file(m_tmpnam, objectType(photo), “100px”, “100px”)

// Don’t forget to remove the temporary file

erase &m_tmpnam
I probably need to output the file to m_tmpnam.
because multiple requests can be running concurrently.

That’s a great example of how to get an rsp page working with standard section. It really highlights the power of the showDocument()

Screenshot - 23.1.2017. , 20_36_52.png

There are two parts of this example (I will resort it):

Code:
    save datasession
    open database southwind
    use customers
    list html off ;
        fields customerid,companyname,city,country onclick "customerid","editCustomerID('{}')"
    restore datasession

Result is the LIST of table records in HTML format “sent somewhere into the section”. “onclick” is important here to relate clicked record shown in another section.

Second part is ShowDocument with search action (inside of click-function):Screenshot - 23.1.2017. , 14_36_48.png

Screenshot - 23.1.2017. , 20_40_14.png

 

This is how this section (vebview standard section) is populated on the fly. The webview section is not build by drag&drop the table, but like a custom section.

Imagine it has no Data Source specified in section. This is Standard section which is not data bounded. You can dynamically USE…any table in any database and specify fields in LIST HTML OFF… and maybe “onclick”.
This is impressive.

It is incredibly easy to serve up a json result set in Lianja. I was overcomplicating it, so thought some others might be doing the same (again – I turned to Yvonne and Barry for assistance).
Here is the entire RSP page. It takes a parameter, gets the data, cleans it up, and delivers.

<%@ language=VFP %>
<%
private m_term = lower( getParameter(“term”, “”) )
private aresult
set strcompare off
select contactname from southwind!customers where lower(contactname) = m_term into array aresult

m= json_encode(aresult)
m=strtran(m,”[[“,”[“)
m=strtran(m,”]]”,”]”)
m=strtran(m,”],[“,”,”)
echo m

%>

Pinegrow is a really handy tool
I am starting to play around with it and thought I would work through several examples to show it usefulness.
I am clearly not an expert on it, so anyone that wants to extend the demo’s, feel free.
Here is the first one. It just puts a nav bar in a webview.

Lianja and Pinegrow part 1 – https://youtu.be/DlEHGGe00VA

Here is my default LianjaBootstrap file.

 Screenshot - 23.1.2017. , 20_41_49.png

So – I thought it would be fun to create a fake bank called – you guessed it – the Bank of Lianja.
This would have to incorporate some site building with application building.
Lianja is perfectly suited for the job.Image.png

Pinegrow for a bootstrap page?
I did use Pinegrow to kick start it.
One thing I noticed was that pinegrow was missing the nav-pills under the nav class, so I just used nav-tabs, and manually changed it toso I could stack them in my fourth column set.

Screenshot - 23.1.2017. , 20_44_05.png

Also – as you can see, I have the columns in medium and large screens with an offset of 1 column to give more distance to the right side menu.

Next – I’ll fix the columns heights to be equal.
I also added a well around my paragraph to give it a nicer look.

Screenshot - 23.1.2017. , 20_44_58.png

Slowly but surely, it will get there.

ps – I think the course from codeschool on getting started with bootstrap is very good.
What I am finding though, is that using the standard built in sections is a lot quicker than building full apps in RSP pages.
But I think there is definitely a place for both.
Dashboards, in particular, are a good place for .rsp pages.

Many of us old VFP developers used quite a few activeX tools to extend our user interfaces.
To me, the most powerful part of the Lianja is the RSP page. It’s fast and flexible and I think is the core of Lianja.

Add to that the built in support for bootstrap and the assorted javascript libraries, the sky is the limit.

I just downloaded KendoUI from telerik tonight and love the widgets. They are used the exact same way as the other Jquery UI components.

http://www.telerik.com/kendo-ui#more-widgets

In about 15 minutes, I got this little sample up and running. You can have a look at it here.
Just like Jquery, Lianja can seamlessly use the Power of Teleriks Kendoui widgets to extend your user interface. Here’s a quick demo.
LIanja with Kendouihttps://youtu.be/ScNexbKrARA


Q:
is Response.contenttype case sensitive?
A:

<% response.contenttype = “…” %>

it is Lianja/VFP. case insensitive.


Q:
Looking in fiddler, the content-type is still text/html.
Its a very straightforward rsp page.
it grabs some parameters,updates the SQL Server and returns the row that was just updated, and outputs the json result set. All is working except the response content type.

 

Screenshot - 23.1.2017. , 20_47_14.png
Looking at the response type, it is still text/html?????
Image.png
A:
Here’s the line that works for me when sending JSON to an .rsp web service:
lcRet = posturl(lcUrl,0,array(“Content-Type: application/json”,”charset: UTF-8″),lcJson,”c:\temp\mysite.txt”)

This video illustrates how by using Lianja.execute() , you can pass values between your javascript functions and your desktop canvas section.
web controls and Lianja Desktop – https://youtu.be/heu-3M28v-s


A quick example on how to incorporate leaflet/Mapbox map in your Lianja RSP page
LianjaAndLeafletjs – https://youtu.be/gqvJ-sIFzvY


I just wanted to showcase the speed and flexibility of the RSP pages.
I am using a free theme called devoops, and have also added Kendo UI controls. The RSP pages pull everything together and make the data retrievals and data updates very fast.
https://youtu.be/z0kuRx9iqWg


Here is quick example to hook your code into Lianja from the template you built in Pinegrow.
Lianja and Pinegrow Bootstrap Part 2 – https://youtu.be/PGmVEP_YwrI


This is just a quick tutorial on getting Pinegrow to work inside a Lianja RSP page.
Lianja and Pinegrow part 1 – https://youtu.be/DlEHGGe00VA


Using the AutoComplete function I Jquery with Lianja.
Both hardcoded values and remote data from an RSP page
Lianja JQuery Autocomplete – https://youtu.be/R4USkXxARWE


Just a quick example of interaction between Jquery and the Lianja framework.
Lianja and Jquery – https://youtu.be/FXUtccC4Xcw


Advertisements
Categories RSP

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s