Hello,
I noticed that the bundled file plugin doesn’t have a function to mount a server. I’m accustomed to using a FileMaker plugin called Troi File, which has a MountDisk function. Is there another plugin that has similar functionality?
As a possible alternative, I know that you can use AppleScript, or even the command line, to mount a server from a Mac. I don’t know how to mount a server from Windows from the command line.
Regards,
Sean
The datastream server component allows you to specify a ‘mount-point’ at your Servoy Server end. This is done within the /servoy-admin/ plugin configuration web pages.
When you upload, all files are placed into a location relative to that mount point. The local client-side source (file or URL) is specified by you.
When you request to download from the server mount point, you specify the client destination.
In each scenario, you get to (optionally) browse a Server File System Tree View to select the source or destination.
Hope that helps.
Hello,
I’m still a little confused.
I’m migrating a FileMaker solution that deals with a large number of PDFs, and all of the PDFs are stored on a network share, so to view them, you first have to make sure the network share is mounted, hence the need for this Troi File plugin.
I certainly would like to remove the need to mount a server, especially if you’re accessing the solution from outside the local network. I’m still debating whether to store PDFs in BLOBs or on disk. If I choose to keep the PDFs on disk, I’m still confused on how the clients can view them. After reading a few threads, it sounds like:
a) Copy the PDF into a temp BLOB
b) Write a temp file on the client’s computer, and then open that with the appropriate program (or in my case, maybe just have the PDF rendering bean do the work).
Am I on the right track here? Is it possible to bypass the copying and ‘stream’ the file directly to the client?
you first have to make sure the network share is mounted
Firstly, if the share is your Servoy server, you simplify many things.
That’s true whether you decide to use my plugins or roll your own.
If I choose to keep the PDFs on disk, I’m still confused on how the clients can view them
If you use my DataStream plugin you can have a media record point to a disk location in the Servoy Server share, or you can place the media directly into the database. The way you would discriminate between the 2 techniques would be to make alternate ‘upload’ calls when your users save.
Now…
Assuming your share is your Servoy Server:
Then the DataStream plugin will give you what you want out of the box.
Assuming your share is not your Servoy Server:
Then you need to consider a caching strategy which will complement whatever stream implementation you adopt.
This should be done at the Solution level, not at the Plugin level, simply because you may decide to change your caching strategy so you therefore need full control over this part of the process.
Lastly, how remotely distributed are your users ?
cybersack,
In my case the Servoy server and the network share are on the same computer.
My solution is for a doctor’s office, and it’s designed to help get rid of all the paper charts that a typical office accumulates, so the PDFs are just the scanned versions of the paper documents. These PDFs are read-only, FWIW.
Some practices have multiple offices, so ideally I would centralize all the documents on the Servoy server, and then serve them as needed.
So, in my case, would loading the PDFs into a temp BLOB still be a viable thing to do? If so, then I’m still a little confused. How can I load a BLOB from a client if all the PDFs are on the server?
Thanks for your help,
Sean
chartpacs:
I’m migrating a FileMaker solution that deals with a large number of PDFs, and all of the PDFs are stored on a network share, so to view them, you first have to make sure the network share is mounted, hence the need for this Troi File plugin.
I certainly would like to remove the need to mount a server, especially if you’re accessing the solution from outside the local network. I’m still debating whether to store PDFs in BLOBs or on disk. If I choose to keep the PDFs on disk, I’m still confused on how the clients can view them. After reading a few threads, it sounds like:
a) Copy the PDF into a temp BLOB
b) Write a temp file on the client’s computer, and then open that with the appropriate program (or in my case, maybe just have the PDF rendering bean do the work).
Am I on the right track here?
You are nearly on the right track…
Add a table for documents in your project with a media field to store files. Bob Cusic (thanks Bob!) has written a sample module with all the logic to deal with this available from his web site.
We created our own simplified interface based on Bob’s code to get rid of share with 5,000 documents. We save the docs into tmp directory on local disk for viewing and open them in whatever app is relevant.
Also on Mac and Unix systems you can install pdftotext (free)
www.bluem.net/downloads/pdftotext_en/
and you can grab the text from the pdf as you read it into your database so you can make the PDFs ‘searchable’ within Servoy. BIG 
To extract the text
var txt = application.executeProgram('/usr/local/bin/pdftotext', apath, '-');
where apath is the path to your PDF.
Hope this helps.
So, in my case, would loading the PDFs into a temp BLOB still be a viable thing to do? If so, then I’m still a little confused. How can I load a BLOB from a client if all the PDFs are on the server?
Why temp ?
What you would do is for a given “patient-scan” record, import your data so that it resides either in the “patient-scan-media” table or have the “patient-scan-media” table contain a reference to a file location on the Server File System.
Upon import (say a DnD gesture or Import Dialog) you choose a destination to place the file bytes on the server - either the “patient-scan-media” record media column itself, or a ref to a location on the server-file-system. If you choose a ref, then the blob field remains empty. In either case, the bytes are streamed up to the server.
The next time a client visits your record, you make a datastream-plugin call to load the data.
The plugin knows how to tell where the data are and creates a stream for the client from bytes either out of the media cell or the file on the server.
hi cybersack,
I initially said ‘temp’ because I didn’t realize you could store references to binary data.
It generally seems easier to store the documents directly in Servoy, as swingman has done (each document isn’t that big, but there literally will be tens or hundreds of thousands of documents, depending on the size of the practice). If I choose to do that, do you have some example code to handle the viewing?
If it helps, here’s how the PDFs would get into Servoy:
a) the originals are scanned into a designated “input” directory on a client’s desktop.
b) The client clicks on an “Import” button, and a method loops thru each file in the directory, creating a new record and adding the document to a BLOB field (I’m guessing using the readFile function?).
c) The client would then go thru each newly imported document and tag it with info like: document date, document category (lab report, MRI report, etc.), and patient name.
d) After each document is processed, anyone can look at them by clicking a ‘View’ button in various parts of the solution.
So I guess I’m asking for help with the method attached to the View button.
Regards,
Sean
Bobs code:
tmpfile = plugins.file.convertStringToJSFile(pathtoyourfilegoeshere);
tmpfile = utils.stringReplace(tmpfile,"\\", "/") //replace backslashes with forward slashes to avoid escaping problems
application.writeFile(tmpfile,the_file)
if(utils.stringMiddle(application.getOSName(),1,7) == "Windows")
{
application.executeProgram('rundll32', 'url.dll,FileProtocolHandler',tmpfile)
}
else if(utils.stringMiddle(application.getOSName(),1,7) == "FreeBSD"||utils.stringMiddle(application.getOSName(),1,5) == "Linux")
{
application.executeProgram('mozilla', tmpfile)
}
else if(utils.stringMiddle(application.getOSName(),1,6) == "Mac OS")
{
application.executeProgram('open', tmpfile)
}
}
hi christian,
Thanks for the code, and thanks for the tip regarding the pdftotext software. In my case the PDFs will usually be faxed, and the fax software converts the fax into a PDF image, so I wonder if the pdftotext software will work. I guess I’ll experiment.
Regards,
sean