I thought some people might want to know about a tiny hack I came up with today.
In a recent project I had to put links around images targeting even larger images.
<a href="assets/images/id/galerie/01_large.jpg">
<img src="assets/images/id/76/01_medium.jpg" />
</a>
the problem with MCPuck is that if I add a "link" to tinyMCE, and then use the browser to specify a target, I can only choose files included in /assets/files and below.
As I didn’t wanted to upload those images to the files folder, I had to modify how MCpuck handles such operations.
First, I modified manager/media/browser/mcpuk/frmresourcetype.html to display the relevant modx ressource folders (files, images, flash, media) all the time.
Line 41
window.onload = function()
{
var bHasType = ( oConnector.ResourceType.length > 0 ) ;
cmbTypeObj=document.getElementById("cmbType");
for ( var i = 0 ; i < aTypes.length ; i++ )
{
if ( bHasType || aTypes[i][0] == oConnector.ResourceType ) {
// pepebe: check whether the current folder is the default folder
var optionSelected = false;
if (oConnector.ResourceType == aTypes[i][0]){
var optionSelected = true;
}
AddSelectOption( cmbTypeObj, aTypes[i][1], aTypes[i][0], optionSelected ) ;
}
}
}
Second, I applied some changes to manager/media/browser/mcpuk/js/common.js, so the "default" folder is initially preselected:
//Line 19
function AddSelectOption( selectElement, optionText, optionValue, optionSelected )
{
// added selected option
var oOption = document.createElement("OPTION") ;
oOption.text = optionText ;
oOption.value = optionValue ;
oOption.selected = optionSelected ; // preselection added by pepebe
selectElement.options.add(oOption) ;
return oOption ;
}
Sofar, I have tested this for TinyMCE only and it works like expected. Don’t know if it will also work for other RTEs like FCKEditor.
Regards,
pepebe
P.S. As usual, backup the original files BEFORE you apply changes...