*/ /** * [CLASS/FUNCTION INDEX of SCRIPT] * * * * 81: class SC_wizard_rte * 99: function init() * 123: function main() * 285: function printContent() * 298: function checkEditAccess($table,$uid) * * TOTAL FUNCTIONS: 4 * (This index is automatically created/updated by the extension "extdeveval") * */ $BACK_PATH=''; require ('init.php'); require ('template.php'); $LANG->includeLLFile('EXT:lang/locallang_wizards.xml'); require_once (PATH_t3lib.'class.t3lib_tceforms.php'); require_once (PATH_t3lib.'class.t3lib_loaddbgroup.php'); require_once (PATH_t3lib.'class.t3lib_transferdata.php'); t3lib_BEfunc::lockRecords(); /** * Script Class for rendering the full screen RTE display * * @author Kasper Skaarhoj * @package TYPO3 * @subpackage core */ class SC_wizard_rte { // Internal, dynamic: var $doc; // Document template object var $content; // Content accumulation for the module. // Internal, static: GPvars var $P; // Wizard parameters, coming from TCEforms linking to the wizard. var $popView; // If set, launch a new window with the current records pid. /** * Initialization of the class * * @return void */ function init() { global $BACK_PATH; // Setting GPvars: $this->P = t3lib_div::_GP('P'); $this->popView = t3lib_div::_GP('popView'); // "Module name": $this->MCONF['name']='xMOD_wizard_rte.php'; // Starting the document template object: $this->doc = t3lib_div::makeInstance('mediumDoc'); $this->doc->docType = 'xhtml_trans'; $this->doc->divClass = ''; // Need to NOT have the page wrapped in DIV since if we do that we destroy the feature that the RTE spans the whole height of the page!!! $this->doc->form='
'; $this->doc->backPath = $BACK_PATH; } /** * Main function, rendering the document with the iframe with the RTE in. * * @return void */ function main() { global $BE_USER,$LANG; // translate id to the workspace version: if ($versionRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->P['table'], $this->P['uid'], 'uid')) { $this->P['uid'] = $versionRec['uid']; } // If all parameters are available: if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'],$this->P['uid'])) { // Getting the raw record (we need only the pid-value from here...) $rawRec = t3lib_BEfunc::getRecord($this->P['table'],$this->P['uid']); t3lib_BEfunc::fixVersioningPid($this->P['table'], $rawRec); // Setting JavaScript, including the pid value for viewing: $this->doc->JScode = $this->doc->wrapScriptTags(' function jumpToUrl(URL,formEl) { // if (document.editform) { if (!TBE_EDITOR_isFormChanged()) { window.location.href = URL; } else if (formEl) { if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1; } } else window.location.href = URL; } '.($this->popView ? t3lib_BEfunc::viewOnClick($rawRec['pid'],'',t3lib_BEfunc::BEgetRootLine($rawRec['pid'])) : '').' '); // Create page HTML header: $this->content.=$this->doc->startPage(''); // Initialize TCeforms - for rendering the field: $tceforms = t3lib_div::makeInstance('t3lib_TCEforms'); $tceforms->initDefaultBEMode(); // Init... $tceforms->disableWizards = 1; // SPECIAL: Disables all wizards - we are NOT going to need them. $tceforms->colorScheme[0]=$this->doc->bgColor; // SPECIAL: Setting background color of the RTE to ordinary background // Initialize style for RTE object: $RTEobj = &t3lib_BEfunc::RTEgetObj(); // Getting reference to the RTE object used to render the field! if ($RTEobj->ID == 'rte') { $RTEobj->RTEdivStyle = 'position:relative; left:0px; top:0px; height:100%; width:100%; border:solid 0px;'; // SPECIAL: Setting style for the RTE
layer containing the IFRAME # $RTEobj->RTEdivStyle = 'position:relative; left:0px; top:0px; height:600px; width:100%; border:solid 0px;'; // SPECIAL: Setting style for the RTE
layer containing the IFRAME } // Fetching content of record: $trData = t3lib_div::makeInstance('t3lib_transferData'); $trData->lockRecords=1; $trData->fetchRecord($this->P['table'],$this->P['uid'],''); // Getting the processed record content out: reset($trData->regTableItems_data); $rec = current($trData->regTableItems_data); $rec['uid'] = $this->P['uid']; $rec['pid'] = $rawRec['pid']; // Making the toolbar: $closeUrl = $this->P['returnUrl']; $R_URI=t3lib_div::linkThisScript(array('popView'=>'')); // Getting settings for the undo button: $undoButton = 0; $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->P['table'], 'sys_history').' AND recuid='.intval($this->P['uid']), '', 'tstamp DESC', '1'); if ($undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) { $undoButton = 1; } // ShortCut if ($BE_USER->mayMakeShortcut()) { $sCut = $this->doc->makeShortcutIcon('P','',$this->MCONF['name'],1); } else { $sCut =''; } // Make Toolbar of buttons: $toolBarButtons=array(); // Save: $toolBarButtons[]= ''. 'doc->backPath,'gfx/savedok.gif','width="21" height="16"').' class="c-inputButton" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc',1).'" alt="" />'. ''; // Save/View: if (t3lib_extMgm::isLoaded('cms')) { $toolBarButtons[]= ''. 'doc->backPath,'gfx/savedokshow.gif','width="21" height="16"').' class="c-inputButton" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDocShow',1).'" alt="" />'. ''; } // Save/Close: $toolBarButtons[] = 'doc->backPath,'gfx/saveandclosedok.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc',1).'" />'; // Close: $toolBarButtons[]= ''. 'doc->backPath,'gfx/closedok.gif','width="21" height="16"').' class="c-inputButton" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc',1).'" alt="" />'. ''; // Undo/Revert: if ($undoButton) { $toolBarButtons[]= ''. 'doc->backPath,'gfx/undo.gif','width="21" height="16"').' class="c-inputButton" title="'.htmlspecialchars(sprintf($LANG->getLL('rte_undoLastChange'),t3lib_BEfunc::calcAge(time()-$undoButtonR['tstamp'],$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')))).'" alt="" />'. ''; } $panel = ''.implode('',$toolBarButtons).''; // TSconfig, setting width: $fieldTSConfig = $tceforms->setTSconfig($this->P['table'],$rec,$this->P['field']); if (strcmp($fieldTSConfig['RTEfullScreenWidth'],'')) { $width=$fieldTSConfig['RTEfullScreenWidth']; } else { $width='500'; } // Get the form field and wrap it in the table with the buttons: $formContent = $tceforms->getSoloField($this->P['table'],$rec,$this->P['field']); $formContent = '
'.$panel.' '.$sCut.'
'.$formContent.'
'; // Adding hidden fields: $formContent.= ' '; // Finally, add the whole setup: $this->content.= $tceforms->printNeededJSFunctions_top(). $formContent. $tceforms->printNeededJSFunctions(); } else { // ERROR: $this->content.=$this->doc->startPage(''); $this->content.=$this->doc->section($LANG->getLL('forms_title'),''.$LANG->getLL('table_noData',1).'',0,1); } } /** * Outputting the accumulated content to screen * * @return void */ function printContent() { $this->content.= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); echo $this->content; } /** * Checks access for element * * @param string Table name * @param integer Record uid * @return void */ function checkEditAccess($table,$uid) { global $BE_USER; $calcPRec = t3lib_BEfunc::getRecord($table,$uid); t3lib_BEfunc::fixVersioningPid($table,$calcPRec); if (is_array($calcPRec)) { if ($table=='pages') { // If pages: $CALC_PERMS = $BE_USER->calcPerms($calcPRec); $hasAccess = $CALC_PERMS&2 ? TRUE : FALSE; } else { $CALC_PERMS = $BE_USER->calcPerms(t3lib_BEfunc::getRecord('pages',$calcPRec['pid'])); // Fetching pid-record first. $hasAccess = $CALC_PERMS&16 ? TRUE : FALSE; } // Check internals regarding access: if ($hasAccess) { $hasAccess = $BE_USER->recordEditAccessInternals($table, $calcPRec); } } else $hasAccess = FALSE; return $hasAccess; } } // Include extension? if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_rte.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_rte.php']); } // Make instance: $SOBE = t3lib_div::makeInstance('SC_wizard_rte'); $SOBE->init(); $SOBE->main(); $SOBE->printContent(); ?>