I am trying to create a new tab for the RTE browse links window with the aim of allowing links to files on network shares. Using the external link for this won't work, as TYPO3 automatically prepends http://<domain>/typo3
to the link.
I am having the same problem in my custom tab. When e.g. entering \\<share>\<file>
, the link ends up being http://<domain>/typo3/\\<share>\<file>
.
The hook class:
class Tx_Test_Hooks_NetworkFolderTree implements t3lib_browseLinksHook
{
public function init($browseLinks, $additionalParameters)
{
$this->browseLinks = &$browseLinks;
}
public function getTab($linkSelectorAction)
{
global $BE_USER, $LANG;
$content = '
<form action="" name="lurlform" id="lurlform">
<table border="0" cellpadding="2" cellspacing="1" id="typo3-linkURL">
<tr>
<td>URL:</td>
<td><input type="text" name="lurl"'.$this->browseLinks->doc->formWidth(20).' value="" /> '.
'<input type="submit" value="set" onclick="browse_links_setHref(document.lurlform.lurl.value); browse_links_setAdditionalValue(\'data-htmlarea-external\', \'1\'); return link_current();" /></td>
</tr>
</table>
</form>';
$content .= $this->browseLinks->addAttributesForm();
return $content;
}
public function parseCurrentUrl($href, $siteUrl, $info)
{
if( preg_match('/^([a-z]\:[\/\\\]|\\\{2})/', $href, $matchData) ) $info['act'] = 'unc';
return $info;
}
public function modifyMenuDefinition($menuDefinition)
{
global $LANG;
return array_merge($menuDefinition, array(
'unc' => array(
'isActive' => ($this->browseLinks->act == 'unc'),
'label' => 'Network file',
'url' => '#',
'addParams' => 'onclick="jumpToUrl(\''.htmlspecialchars('?act=unc&mode='.$this->browseLinks->mode.'&bparams='.$this->browseLinks->bparams).'\');return false;"'
)
)
);
}
public function addAllowedItems($currentlyAllowedItems)
{
return array_merge($currentlyAllowedItems, array('unc'));
}
}