⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class.tx_rtehtmlarea_browse_links.php

📁 Typo3, 开源里边最强大的
💻 PHP
📖 第 1 页 / 共 3 页
字号:
			if (window.opener) {				var editor = window.opener.RTEarea[' . $this->editorNo . ']["editor"];				var HTMLArea = window.opener.HTMLArea;			}				// This JavaScript is primarily for RTE/Link. jumpToUrl is used in the other cases as well...			var add_href="'.($this->curUrlArray['href']?'&curUrl[href]='.rawurlencode($this->curUrlArray['href']):'').'";			var add_target="'.($this->setTarget?'&curUrl[target]='.rawurlencode($this->setTarget):'').'";			var add_class="'.($this->setClass?'&curUrl[class]='.rawurlencode($this->setClass):'').'";			var add_title="'.($this->setTitle?'&curUrl[title]='.rawurlencode($this->setTitle):'').'";			var add_params="'.($this->bparams?'&bparams='.rawurlencode($this->bparams):'').'";			var cur_href="'.($this->curUrlArray['href']?$this->curUrlArray['href']:'').'";			var cur_target="'.($this->setTarget?$this->setTarget:'').'";			var cur_class="'.($this->setClass?$this->setClass:'').'";			var cur_title="'.($this->setTitle?$this->setTitle:'').'";			function setTarget(value)	{				cur_target=value;				add_target="&curUrl[target]="+encodeURIComponent(value);			}			function setClass(value)	{				cur_class=value;				add_class="&curUrl[class]="+encodeURIComponent(value);			}			function setTitle(value)	{				cur_title=value;				add_title="&curUrl[title]="+encodeURIComponent(value);			}			function setValue(value)	{				cur_href=value;				add_href="&curUrl[href]="+value;			}';		if ($this->mode=='wizard')	{	// Functions used, if the link selector is in wizard mode (= TCEforms fields)			unset($this->P['fieldChangeFunc']['alert']);			reset($this->P['fieldChangeFunc']);			$update='';			while(list($k,$v)=each($this->P['fieldChangeFunc']))	{				$update.= '				window.opener.'.$v;			}			$P2=array();			$P2['itemName']=$this->P['itemName'];			$P2['formName']=$this->P['formName'];			$P2['fieldChangeFunc']=$this->P['fieldChangeFunc'];			$addPassOnParams.=t3lib_div::implodeArrayForUrl('P',$P2);			$JScode.='				function link_typo3Page(id,anchor)	{	//					updateValueInMainForm(id+(anchor?anchor:"")+" "+cur_target);					close();					return false;				}				function link_folder(folder)	{	//					updateValueInMainForm(folder+" "+cur_target);					close();					return false;				}				function link_current()	{	//					if (cur_href!="http://" && cur_href!="mailto:")	{						var setValue = cur_href+" "+cur_target+" "+cur_class+" "+cur_title;						if (setValue.substr(0,7)=="http://")	setValue = setValue.substr(7);						if (setValue.substr(0,7)=="mailto:")	setValue = setValue.substr(7);						updateValueInMainForm(setValue);						close();					}					return false;				}				function checkReference()	{	//					if (window.opener && window.opener.document && window.opener.document.'.$this->P['formName'].' && window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"] )	{						return window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"];					} else {						close();					}				}				function updateValueInMainForm(input)	{	//					var field = checkReference();					if (field)	{						field.value = input;						'.$update.'					}				}			';		} else {	// Functions used, if the link selector is in RTE mode:			$JScode.='				function link_typo3Page(id,anchor)	{					var theLink = \''.$this->siteURL.'?id=\'+id+(anchor?anchor:"");					if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);					if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);					editor.renderPopup_addLink(theLink,cur_target,cur_class,cur_title);					return false;				}				function link_folder(folder)	{	//					var theLink = \''.$this->siteURL.'\'+folder;					if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);					if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);					editor.renderPopup_addLink(theLink,cur_target,cur_class,cur_title);					return false;				}				function link_spec(theLink)	{	//					if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);					if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);					editor.renderPopup_addLink(theLink,cur_target,cur_class,cur_title);					return false;				}				function link_current()	{	//					if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);					if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);					if (cur_href!="http://" && cur_href!="mailto:")	{						editor.renderPopup_addLink(cur_href,cur_target,cur_class,cur_title);					}					return false;				}			';		}			// General "jumpToUrl" function:		$JScode.='			function jumpToUrl(URL,anchor)	{	//				var add_editorNo = URL.indexOf("editorNo=")==-1 ? "&editorNo='.$this->editorNo.'" : "";				var add_contentTypo3Language = URL.indexOf("contentTypo3Language=")==-1 ? "&contentTypo3Language='.$this->contentTypo3Language.'" : "";				var add_contentTypo3Charset = URL.indexOf("contentTypo3Charset=")==-1 ? "&contentTypo3Charset='.$this->contentTypo3Charset.'" : "";				var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act.'" : "";				var add_mode = URL.indexOf("mode=")==-1 ? "&mode='.$this->mode.'" : "";				var theLocation = URL+add_act+add_editorNo+add_contentTypo3Language+add_contentTypo3Charset+add_mode+add_href+add_target+add_class+add_title+add_params'.($addPassOnParams?'+"'.$addPassOnParams.'"':'').'+(anchor?anchor:"");				window.location.href = theLocation;				return false;			}		';			// This is JavaScript especially for the TBE Element Browser!		$pArr = explode('|',$this->bparams);		$formFieldName = 'data['.$pArr[0].']['.$pArr[1].']['.$pArr[2].']';		$JScode.='			var elRef="";			var targetDoc="";			function launchView(url)	{	//				var thePreviewWindow="";				thePreviewWindow = window.open("' . $BACK_PATH . 'show_item.php?table="+url,"ShowItem","height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");				if (thePreviewWindow && thePreviewWindow.focus)	{					thePreviewWindow.focus();				}			}			function setReferences()	{	//				if (parent.window.opener				&& parent.window.opener.content				&& parent.window.opener.content.document.editform				&& parent.window.opener.content.document.editform["'.$formFieldName.'"]						) {					targetDoc = parent.window.opener.content.document;					elRef = targetDoc.editform["'.$formFieldName.'"];					return true;				} else {					return false;				}			}			function insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close)	{	//				if (1=='.($pArr[0]&&!$pArr[1]&&!$pArr[2] ? 1 : 0).')	{					addElement(filename,table+"_"+uid,fp,close);				} else {					if (setReferences())	{						parent.window.opener.group_change("add","'.$pArr[0].'","'.$pArr[1].'","'.$pArr[2].'",elRef,targetDoc);					} else {						alert("Error - reference to main window is not set properly!");					}					if (close)	{						parent.window.opener.focus();						parent.close();					}				}				return false;			}			function addElement(elName,elValue,altElValue,close)	{	//				if (parent.window.opener && parent.window.opener.setFormValueFromBrowseWin)	{					parent.window.opener.setFormValueFromBrowseWin("'.$pArr[0].'",altElValue?altElValue:elValue,elName);					if (close)	{						parent.window.opener.focus();						parent.close();					}				} else {					alert("Error - reference to main window is not set properly!");					parent.close();				}			}		';			// Finally, add the accumulated JavaScript to the template object:		$this->doc->JScode = $this->doc->wrapScriptTags($JScode);			// Debugging:		if (FALSE) debug(array(			'pointer' => $this->pointer,			'act' => $this->act,			'mode' => $this->mode,			'curUrlInfo' => $this->curUrlInfo,			'curUrlArray' => $this->curUrlArray,			'P' => $this->P,			'bparams' => $this->bparams,			'RTEtsConfigParams' => $this->RTEtsConfigParams,			'expandPage' => $this->expandPage,			'expandFolder' => $this->expandFolder,			'PM' => $this->PM,		),'Internal variables of Script Class:');	}	/******************************************************************	 *	 * Main functions	 *	 ******************************************************************/	/**	 * Rich Text Editor (RTE) link selector (MAIN function)	 * Generates the link selector for the Rich Text Editor.	 * Can also be used to select links for the TCEforms (see $wiz)	 *	 * @param	boolean		If set, the "remove link" is not shown in the menu: Used for the "Select link" wizard which is used by the TCEforms	 * @return	string		Modified content variable.	 */	function main_rte($wiz=0)	{		global $LANG, $BE_USER, $BACK_PATH;			// Starting content:		$content=$this->doc->startPage($LANG->getLL('Insert/Modify Link',1));			// Initializing the action value, possibly removing blinded values etc:		$allowedItems = explode(',','page,file,url,mail,spec');		if (is_array($this->buttonConfig['options.']) && $this->buttonConfig['options.']['removeItems']) {			$allowedItems = array_diff($allowedItems,t3lib_div::trimExplode(',',$this->buttonConfig['options.']['removeItems'],1));		} else {			$allowedItems = array_diff($allowedItems,t3lib_div::trimExplode(',',$this->thisConfig['blindLinkOptions'],1));		}		reset($allowedItems);		if (!in_array($this->act,$allowedItems)) {			$this->act = current($allowedItems);		}					// Making menu in top:		$menuDef = array();		if (!$wiz)	{			$menuDef['removeLink']['isActive'] = $this->act=='removeLink';			$menuDef['removeLink']['label'] = $LANG->getLL('removeLink',1);			$menuDef['removeLink']['url'] = '#';			$menuDef['removeLink']['addParams'] = 'onclick="editor.renderPopup_unLink();return false;"';		}		if (in_array('page',$allowedItems)) {			$menuDef['page']['isActive'] = $this->act=='page';			$menuDef['page']['label'] = $LANG->getLL('page',1);			$menuDef['page']['url'] = '#';			$menuDef['page']['addParams'] = 'onclick="jumpToUrl(\'?act=page&editorNo='.$this->editorNo.'&contentTypo3Language='.$this->contentTypo3Language.'&contentTypo3Charset='.$this->contentTypo3Charset.'\');return false;"';		}		if (in_array('file',$allowedItems)){			$menuDef['file']['isActive'] = $this->act=='file';			$menuDef['file']['label'] = $LANG->getLL('file',1);			$menuDef['file']['url'] = '#';			$menuDef['file']['addParams'] = 'onclick="jumpToUrl(\'?act=file&editorNo='.$this->editorNo.'&contentTypo3Language='.$this->contentTypo3Language.'&contentTypo3Charset='.$this->contentTypo3Charset.'\');return false;"';		}		if (in_array('url',$allowedItems)) {			$menuDef['url']['isActive'] = $this->act=='url';			$menuDef['url']['label'] = $LANG->getLL('extUrl',1);			$menuDef['url']['url'] = '#';			$menuDef['url']['addParams'] = 'onclick="jumpToUrl(\'?act=url&editorNo='.$this->editorNo.'&contentTypo3Language='.$this->contentTypo3Language.'&contentTypo3Charset='.$this->contentTypo3Charset.'\');return false;"';		}		if (in_array('mail',$allowedItems)) {			$menuDef['mail']['isActive'] = $this->act=='mail';			$menuDef['mail']['label'] = $LANG->getLL('email',1);			$menuDef['mail']['url'] = '#';			$menuDef['mail']['addParams'] = 'onclick="jumpToUrl(\'?act=mail&editorNo='.$this->editorNo.'&contentTypo3Language='.$this->contentTypo3Language.'&contentTypo3Charset='.$this->contentTypo3Charset.'\');return false;"';		}		if (is_array($this->thisConfig['userLinks.']) && in_array('spec',$allowedItems)) {			$menuDef['spec']['isActive'] = $this->act=='spec';			$menuDef['spec']['label'] = $LANG->getLL('special',1);			$menuDef['spec']['url'] = '#';			$menuDef['spec']['addParams'] = 'onclick="jumpToUrl(\'?act=spec&editorNo='.$this->editorNo.'&contentTypo3Language='.$this->contentTypo3Language.'&contentTypo3Charset='.$this->contentTypo3Charset.'\');return false;"';		}		$content .= $this->doc->getTabMenuRaw($menuDef);			// Adding the menu and header to the top of page:		$content.=$this->printCurrentUrl($this->curUrlInfo['info']).'<br />';					// Depending on the current action we will create the actual module content for selecting a link:		switch($this->act)	{			case 'mail':				$extUrl='			<!--				Enter mail address:			-->					<form action="" name="lurlform" id="lurlform">						<table border="0" cellpadding="2" cellspacing="1" id="typo3-linkMail">							<tr>								<td>'.$LANG->getLL('emailAddress',1).':</td>								<td><input type="text" name="lemail"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='mail'?$this->curUrlInfo['info']:'').'" /> '.									'<input type="submit" value="'.$LANG->getLL('setLink',1).'" onclick="setTarget(\'\');setValue(\'mailto:\'+document.lurlform.lemail.value); return link_current();" /></td>							</tr>						</table>					</form>';				$content.=$extUrl;				$content.=$this->addAttributesForm();			break;			case 'url':				$extUrl='			<!--				Enter External URL:			-->					<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->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='url'?$this->curUrlInfo['info']:'http://').'" /> '.									'<input type="submit" value="'.$LANG->getLL('setLink',1).'" onclick="setValue(document.lurlform.lurl.value); return link_current();" /></td>							</tr>						</table>					</form>';				$content.=$extUrl;				$content.=$this->addAttributesForm();			break;			case 'file':				$content.=$this->addAttributesForm();								$foldertree = t3lib_div::makeInstance('tx_rtehtmlarea_folderTree');				$tree=$foldertree->getBrowsableTree();				if (!$this->curUrlInfo['value'] || $this->curUrlInfo['act']!='file')	{					$cmpPath='';				} elseif (substr(trim($this->curUrlInfo['info']),-1)!='/')	{					$cmpPath=PATH_site.dirname($this->curUrlInfo['info']).'/';					if (!isset($this->expandFolder)) $this->expandFolder = $cmpPath;				} else {					$cmpPath=PATH_site.$this->curUrlInfo['info'];				}				list(,,$specUid) = explode('_',$this->PM);				$files = $this->expandFolder($foldertree->specUIDmap[$specUid]);					// Create upload/create folder forms, if a path is given:				if ($BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) {					$fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');					$fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);					$path=$this->expandFolder;					if (!$path || !@is_dir($path))	{						$path = $fileProcessor->findTempFolder().'/';	// The closest TEMP-path is found					}					if ($path!='/' && @is_dir($path))	{						$uploadForm=$this->uploadForm($path);						$createFolder=$this->createFolder($path);					} else {						$createFolder='';						$uploadForm='';					}					$content.=$uploadForm;					if ($BE_USER->isAdmin() || $BE_USER->getTSConfigVal('options.createFoldersInEB')) {						$content.=$createFolder;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -