Re: Navigate to appropriate folder in TFM when globeadmin clicks on 'Upload Files' button
Posted: Mon Oct 06, 2025 7:31 am
Not sure I understand the best way to properly do that.
https://forums.nubuilder.cloud/
Code: Select all
function nuVendorLogin(appId, table) {
const tableName = table || nuSERVERRESPONSE.table;
const params = new URLSearchParams({
sessid: window.nuSESSION,
appId: appId,
table: tableName,
timezone: nuSERVERRESPONSE.timezone
});
const url = `core/nuvendorlogin.php?${params.toString()}`;
return window.open(url, appId); // use appId as window name for reuse
}
// 1. Open TFM via nuVendorLogin()
var win = nuVendorLogin('TFM');
// 2. Build the Tiny File Manager URL
var tab_id = nuSelectedTabId();
var tablabel = '';
if (tab_id === '68ca2d0c176d4d4') {
tablabel = 'Audio';
} else if (tab_id === '68e16015b8742d6') {
tablabel = 'Video';
} else if (tab_id === '68e16037843edff') {
tablabel = 'Photo';
}
var recordNumber = nuRecordId();
// Construct the file path dynamically
var path = '/nubuilder2/third_party/tinyfilemanager/';
// Construct the full URL
var fileManagerUrl = `${path}tinyfilemanager.php?p=Case ${recordNumber}/Evidence/${tablabel}`;
// 3. Once the vendor login window is created, change its location
if (win) {
setTimeout(() => {
win.location.href = fileManagerUrl;
}, 1000); // wait 1 second before redirecting
}