我正在尝试为 RTE 浏览链接窗口创建一个新选项卡,目的是允许链接到网络共享上的文件。使用外部链接是行不通的,因为 TYPO3 会自动http://<domain>/typo3
添加到链接前面。
我在自定义选项卡中遇到了同样的问题。例如,当进入\\<share>\<file>
时,链接最终成为http://<domain>/typo3/\\<share>\<file>
.
钩子类:
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'));
}
}