I'm using WebFM to manage a Filesystem within my company intranet website.
Accesses to files is done by roles from user: different user can access different roots.
To facilitate the organization of the files I'm also using Filebrowser module which provides an easy way to create "directory listing" within Drupal.
Whenever users use "Filebrowser upload API" the Webfm is not called to register the file within the underneath table and this is creating an issue for managing rights.
I figure out I need to call “function webfm_dbinsert_file” function within Webfm module to force inserting the file into database from Filebrowser module.
Since I'm not so expert in scripting, I would like to know at least the following two items:
- What is the procedure to call an API of WebFM module from another module in drupal?
- Which is the precise API (I mean the upper layer) to call to force webfm_dbinsert_file?
Comments
Comment #1
nhck commentedMario,
thank you for asking and helping to make webfm better. I'll give it a shot, but I think you might find some more answers by looking through the issue queue.
What is the procedure to call an API of WebFM module from another module in drupal?
There no actual API - there are no hook or something that is called. You might rather want to call webfm_insert_file - it gives you a TRUE/FALSE return value and thus might be nicer.
I could imagine a scenario like this: You write a custom module that uses a kind of hook that your filebrowser provides. This hook triggers webfm_insert_file and your done :-)
Which is the precise API (I mean the upper layer) to call to force webfm_dbinsert_file?
As I said for a single file I'd rather use webfm_insert_file(). You probably noticed the usage:
Well, I hope this helps a little bit,
Happy Holidays.
Comment #2
mariodm commentednhck,
I followed your suggestion and tried to include "webfm_file.inc" which is implementing webfm_insert_file() functionality but unfortunately the system wasn't working the site disappear and when I restored it there is no log!!
Following the php code used where I removed the complete path:
$rootDir="C:/...../all/Modules/webfm/";
include($rootDir."/webfm_file.inc'");
Please any suggestion?
Is there any procedure you would reccomend to include the wefm functions?
Regards,
Mario
Comment #3
nhck commentedComment #4
mariodm commentednhck,
done! It work.
To get it working I added this code in advance:
$relative_temp = _filebrowser_current_full_path($node). "/" . $file_name;
$relative_filepath = ".\\" . substr( $relative_temp , 1 );
This was necessary since fpath field within webfm database requires to have .\ characters before the path.
Should we put this item as closed?
Thanks&Regards,
Mario
Comment #5
nhck commented