I would like to configure webfm to link to my files directly instead of feeding them through webfm. The reason is that I use tons of PDFs and browsers will display the first pages of large PDFs immediately rather than the user having to wait for the entire PDF to load before anything is displayed at all. Now I would also like the files to open in a new browser window, but I have discovered that webfm flag.

Comments

webservant316’s picture

hello, anyone there?

cgmonroe’s picture

This isn't built into WebFM... Since it conflicts with a bunch of WebaFM underlying design principals (Secure file access with .htaccess in plac; /single file for multiple attachments; and some others), it would be hard to implement.

Probably easier to write your own module that displayed webfm files with the direct URL than try to mod the JavaScript / PhP in WebFM.

webservant316’s picture

Thanks for getting back. sorry to hear that it would be difficult to implement. If you were able to add it to your que of additions to the software it would be greatly appreciated. I may not be the only user interested in this feature because there is a significant difference when loading PDF files. As for the security issue, as long as it was the website admins had the choice, then they could determine if this is really a security issue to have the true path exposed.

Thanks again,

Jeff

webservant316’s picture

direct links to webfm files would be a great asset to our use of your module.
could you take a few moments to expand on your suggestions of different ways to do that?
does webfm expose a direct link to the file in views?
or which module in webfm would need to be revised? in our case we would be just as happy to expose all direct file links.

then main reason I like webfm is that I do not want to upload files in Drupal's native upload utility via the browser.
instead I like webfm's ability to allow me to attach files that are already on the server.
hmmm, maybe there is another module that would enable me to do that, that does have direct links. know of one?

Jeff

cgmonroe’s picture

I haven't really messed about with views so I can't say... but I do remember that you probably need the -dev version for it to work correctly.

One place to look at this (and maybe fix your problem), is the theme_webfm_attahments($files) function. This is called to create the display of webfm files attached to a node. Since this is a theme function, you could override this in your theme to get the URL you want.

This might also be used in code generated pages to list WebFM uploaded files not attached. You'd have to figure out what information needs to be in the $files array and fill it with the files you want.

webservant316’s picture

thanks, I will try that.

is theme_webform_results_table() in webform_report.inc the theme function to override?
what is the variable with the direct link? $node->webform['components']['???directlink???']

thanks for any help.

nhck’s picture

Status: Active » Closed (duplicate)

You should really help and adopt this into a full module.

#941662: New input filter to dramatically improve performance.

webservant316’s picture

Tried to get the new input filter proposed above at #7 to work but couldn't figure it out.
So I just did this for now...

>>added to line 2814 of webfm.module

   //WEBSERVANT316 - Direct access hack
   if ( stripos($f->fpath,'authenticated') == FALSE ) {
        // direct access to all my webfm files, unless in the 'authenticated' folder
 	global $base_url;
 	header('Location: ' . $base_url . '/' . $f->fpath);
}
webservant316’s picture

Whoa! Needed to and an exit() after the call to header().
Again at line 2814 of webfm.module

//WEBSERVANT316 - Direct access hack
if ( stripos($f->fpath,'authenticated') == FALSE ) {
    // direct access to all my webfm files, unless in the 'authenticated' folder,  just my particular use case
    global $base_url;
    header('Location: ' . $base_url . '/' . $f->fpath);
    exit(0);
}