I’ve been playing around with this more. If you want to switch the image browser when using image template variables here are the changes needed:
File: /manager/includes/tmplvars.inc.php
Around line 117, find:
<script type=\"text/javascript\">
var lastImageCtrl;
var lastFileCtrl;
function OpenServerBrowser(url, width, height ) {
var iLeft = (screen.width - width) / 2 ;
var iTop = (screen.height - height) / 2 ;
var sOptions = 'toolbar=no,status=no,resizable=yes,dependent=yes' ;
sOptions += ',width=' + width ;
sOptions += ',height=' + height ;
sOptions += ',left=' + iLeft ;
sOptions += ',top=' + iTop ;
var oWindow = window.open( url, 'FCKBrowseWindow', sOptions ) ;
}
function BrowseServer(ctrl) {
lastImageCtrl = ctrl;
var w = screen.width * 0.7;
var h = screen.height * 0.7;
OpenServerBrowser('".$base_url."manager/media/browser/mcpuk/browser.html?Type=images&Connector=".$base_url."manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=".$base_url."', w, h);
}
function BrowseFileServer(ctrl) {
lastFileCtrl = ctrl;
var w = screen.width * 0.7;
var h = screen.height * 0.7;
OpenServerBrowser('".$base_url."manager/media/browser/mcpuk/browser.html?Type=files&Connector=".$base_url."manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=".$base_url."', w, h);
}
function SetUrl(url, width, height, alt){
if(lastFileCtrl) {
var c = document.mutate[lastFileCtrl];
if(c) c.value = url;
lastFileCtrl = '';
} else if(lastImageCtrl) {
var c = document.mutate[lastImageCtrl];
if(c) c.value = url;
lastImageCtrl = '';
} else {
return;
}
}
</script>
I’m sure the above script can be modified or removed but I left it intact for the time being. Just next to it, or bellow add this script call:
<script language=\"javascript\" type=\"text/javascript\" src=\"/assets/plugins/tinymce/jscripts/tiny_mce/plugins/tinybrowser/tb_standalone.js.php\"></script>
Just bellow this line, find:
$field_html .='<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$field_value .'" '.$field_style.' onchange="documentDirty=true;" /> <input type="button" value="'.$_lang['insert'].'" onclick="BrowseServer(\'tv'.$field_id.'\')" />';
Comment or delete this line and instead use:
$field_html .='<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$field_value .'" '.$field_style.' onchange="documentDirty=true;" /> <input type="button" value="'.$_lang['insert'].'" onclick="tinyBrowserPopUp(\'image\',\'tv'.$field_id.'\');" />';
Note: only the onclick portion of the form changes.
I’ve only gone as far as the image template variable which is what I needed at this time, the same concept can be applied if you use files or any other type of template variable that calls up a file browser.
If I come around to modify the script above or remove it in anyway, I’ll update this post, but I am leaving it as it is for the time being.
Jose R. Lopez