0
我正在嘗試爲RTE瀏覽鏈接窗口創建一個新選項卡,目的是允許鏈接到網絡共享上的文件。使用外部鏈接將不起作用,因爲TYPO3自動將http://<domain>/typo3
預加載到鏈接。t3lib_browseLinksHook和自定義鏈接格式
我在自定義選項卡中遇到同樣的問題。當例如輸入\\<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'));
}
}