Plone and Mysql Searching - mysql

I have Mysql and Zope talking to each other nicely.
I can insert values in, and even view one record from the databse and have it show up in the form fields(not that cool really).
I have just been following tutorials, but now I need to search the Database and display the results.
I have been fiddling with this for a while but I haven't gotten far.
I know that using a Zope Page template we can call the Zsql method and show the results with TAL, but I need to some how using a script and a redirect form the search form pass the search data.
Can anyone help we get started?
Can anyone show me a way to do it with formgen and a custom script adapter?

Go into your ZMI, and add a "Z Search Interface" object in the same folder as your ZSQL method. Your ZSQL methods should show as "searchable objects". Select the ZSQL method you want, fill in the rest of the fields, and it will generate form and display page templates. Then modify the templates to taste.

Related

Is that possible to create a custom input widget in Foundry Slate?

I know how to use input widget in Slate but I have a use case where I need to create several inputs from an array. Maybe one, maybe more, let's say around 10 or 15. Is that possible to create a input and to catch the user entry just by using an HTML widget.
One other way to say shoud be: I would like to have a table of 1 to 15 rows with one column dedicated to an input area. Number of row depend of the source data, so I want that the input is created dynamically. Is it possible in foundry-slate ?
Best regards
You can't do this in a plain HTML widget - the dependency graph can't read state from arbitrary HTML input elements.
There are a couple other options here; the one that most directly works they way you would like it to in your question, would be to use the Code Sandbox widget, which effectively let's you build your own widget and wire it up to the Slate dependency graph for interaction with the rest of the app. You can use a 3rd-party library, assuming you have the license, to do something more advanced (you can search your Foundry instance for some examples in the Slate Reference Examples) or simply use HTML and Javascript to build the widget as you would in normal web development as you have access to the DOM and JQuery when working in the Sandbox.
Slightly more in-line with how Slate might expect you to build this functionality, you can use a single input widget, but toggle what you do with the associated input based on other state, for example what row the user has selected. This, in combination with a button that stores the input into a Variable with a click event, can be used to let users build up a "bag" of edits, that you can then apply with Actions (or you can apply them immediately - all depends on the workflow). You'll find some examples of that pattern in the "Events" folder in the Slate Reference Examples.
Thinking a bit more expansively, if you model your data in the ontology, you can set up an editable table pattern in Workshop and have a quite straightforward experience once you have the right Action and Object Type configuration. You'll find the documentation on this on your Foundry instance at https://www.palantir.com/docs/foundry/workshop/widgets-object-table/#inline-edits-or-cell-level-writeback and an example in the Flight Alert Inbox example application.

App Maker Multi Select?

So I'm quite new to Google App Maker and what the situation is is that I have one datasource which has a section that I would like to use a multiselect for. I've followed the Partner Management template to try and understand how relations work a bit better and I've read all of the documentation on them but despite what I do the multi select either always unticks everything by default when I come out of the edit dialog or it changes the values for all of the multiselects within each request. I'm struggling to bind the data. I know it's hard to describe without showing you but basically I just wondered if anyone would be able to explain to me a bit better how exactly I would get a multiselect to work and keep it's value for each individual request.
Unfortunately in datasource only one item can be selected, you can add checkbox column, so you will be able to get list of checked items.

Scan an area of a web page's source code for changes while reporting it?

this is one heck of a confusing question to ask so here it goes. Firstly, I'm not asking you to write me any code I just need help going in the right direction for what I'm trying to achieve here. Basically the task is this, I want to scan a select area of a web page's source code for changes and if something does change, I want to report it somewhere (like a console or something). However, I do not want just a notification of change, I also want what the change is/was. I've been looking into things like jsoup but I am still struggling to even find out what this is called.
Any pointers would be insanely appreciated. Thanks, Optimistic.
Here are some steps assuming this is from a node.js project:
Get the URL for the specific script file you're looking for a change in.
Using the request() module, fetch that URL.
Break the data up into lines (probably using .split()).
Find the specific line you are looking for either by counting line numbers of by searching for some representative text in that line.
Using some sort of search in that line (perhaps a regex), find the current value of the exact item in that line you are looking for.
Save the current value.
Then, at some future time, repeat this whole process and compare what you find to the previous value.
If this is being done from a browser instead of node.js, then use an Ajax call to retrieve the file. If the file is on another domain from your web page and that domain does not permit cross-origin requests, then you cannot solve this problem in an automated fashion from a browser in your own web page.
Here is how I would do it with Jsoup:
Document doc = Jsoup.connect(url).get();
String scriptCssQuery = "script"; // Tune this CSS query to find THE script you need.
Element script = doc.select(scriptCssQuery).first();
if (script != null) {
String scriptLines = script.html();
// Store the changing line somewhere and compare it to its previous value...
}

Multiple Shiny apps using the ui to populate the second app

I currently have a app that manages projects. The user sees a list of projects and can select one. They can should (it would be nice) be able to click a run button and have another app open. The parameters stored in the project they selected are populated into the second application. The issue I am having is firing the second application. runApp generates the following.
ui code line:
actionButton("RunProj", "Run"),
Warning in run(timeoutMs) :
Unhandled error in observer: Key / already in use
observeEvent(input$RunProj)
I would like to trigger the second app and pass in the location of the project directory I have looked at parseQueryString and still trying to figure out a way to include that. Maybe via a redirect?
Any suggests would be much appreciated.
Regards,
Rich
I'm not 100% sure if I understand your intention correctly but here is a few things I think you may want to think about.
In one project, if you want to run a few kinds of analyses, you may want to try navbarPage
If there are many different types of analyses, you may want to try shinydashboard
If you know the link to each app and you really want to add those "run" buttons, you can add a button manually in ui.R. I think you can write some codes in server.r to generate the link based on your database.
tags$a(href="the link to your apps", class= "btn btn-default", "Run App")

how to remove result set from html page

I have a MySQL database, and few perl scripts using which i am generating the webpages.
On Html page links are available,
For example-
Customer_link => (calls customers.pl) query executed - select * from customers.
Now there is one more link say Customer_in_mumbai => it should remove all the customers whose city is not mumbai.
How to achieve that?
do i need to execute the query once again with where clause or any other way is also possible so that i can simply remove the customers whose city is not mumbai?
Also if i need to execute the query again, do i need to write one more perl file, if not how can i use the same file?
You can use Javascript to manipulate on the client side of things after it's been loaded/displayed. There's nothing you can do on the server side to change a page once it's been downloaded without Javascript.
The rest of your questions indicate a lack of familiary with how dynamic web pages are generated. You can have a single page that does all that, using standard HTTP query variables to modify how the script operates. e.g.
http://example.com/yourscript.pl?remove=mumbai
then have Perl retrieve that remove value and use it to modify how the database query runs. But showing you that is beyond the scope of this site - we're not here to teach you, just help fix problems.
From your question, it seems you only want to remove it from the page temporarily for the user. You can achieve that simply by remove rows with mumbai as a value with Javascript. That should save you server side processing. Use a Library like JQuery to achieve it easily.