Public Member Functions | |
| init () | |
| Initialization of the class. | |
| main () | |
| Main function, rendering the document with the iframe with the RTE in. | |
| printContent () | |
| Outputting the accumulated content to screen. | |
| checkEditAccess ($table, $uid) | |
| Checks access for element. | |
Public Attributes | |
| $doc | |
| $content | |
| $P | |
| $popView | |
|
||||||||||||
|
Checks access for element.
Definition at line 290 of file wizard_rte.php. References t3lib_BEfunc::fixVersioningPid(), t3lib_BEfunc::getRecord(), and table(). Referenced by main(). 00290 {
00291 global $BE_USER;
00292
00293 $calcPRec = t3lib_BEfunc::getRecord($table,$uid);
00294 t3lib_BEfunc::fixVersioningPid($table,$uid);
00295 if (is_array($calcPRec)) {
00296 if ($table=='pages') { // If pages:
00297 $CALC_PERMS = $BE_USER->calcPerms($calcPRec);
00298 $hasAccess = $CALC_PERMS&2 ? TRUE : FALSE;
00299 } else {
00300 $CALC_PERMS = $BE_USER->calcPerms(t3lib_BEfunc::getRecord('pages',$calcPRec['pid'])); // Fetching pid-record first.
00301 $hasAccess = $CALC_PERMS&16 ? TRUE : FALSE;
00302 }
00303
00304 // Check internals regarding access:
00305 if ($hasAccess) {
00306 $hasAccess = $BE_USER->recordEditAccessInternals($table, $calcPRec);
00307 }
00308 } else $hasAccess = FALSE;
00309
00310 return $hasAccess;
00311 }
|
|
|
Initialization of the class.
Definition at line 99 of file wizard_rte.php. 00099 {
00100 global $BACK_PATH;
00101
00102 // Setting GPvars:
00103 $this->P = t3lib_div::_GP('P');
00104 $this->popView = t3lib_div::_GP('popView');
00105
00106 // "Module name":
00107 $this->MCONF['name']='xMOD_wizard_rte.php';
00108
00109 // Starting the document template object:
00110 $this->doc = t3lib_div::makeInstance('mediumDoc');
00111 $this->doc->docType = 'xhtml_trans';
00112 $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!!!
00113 $this->doc->form='<form action="tce_db.php" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="return TBE_EDITOR_checkSubmit(1);">';
00114 $this->doc->backPath = $BACK_PATH;
00115
00116 }
|
|
|
Main function, rendering the document with the iframe with the RTE in.
Definition at line 123 of file wizard_rte.php. References checkEditAccess(), t3lib_BEfunc::getRecord(), and table(). 00123 {
00124 global $BE_USER,$LANG;
00125
00126 // If all parameters are available:
00127 if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'],$this->P['uid'])) {
00128
00129 // Getting the raw record (we need only the pid-value from here...)
00130 $rawRec = t3lib_BEfunc::getRecord($this->P['table'],$this->P['uid']);
00131
00132 // Setting JavaScript, including the pid value for viewing:
00133 $this->doc->JScode = $this->doc->wrapScriptTags('
00134 function jumpToUrl(URL,formEl) { //
00135 if (document.editform) {
00136 if (!TBE_EDITOR_isFormChanged()) {
00137 document.location = URL;
00138 } else if (formEl) {
00139 if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
00140 }
00141 } else document.location = URL;
00142 }
00143 '.($this->popView ? t3lib_BEfunc::viewOnClick($rawRec['pid'],'',t3lib_BEfunc::BEgetRootLine($rawRec['pid'])) : '').'
00144 ');
00145
00146 // Create page HTML header:
00147 $this->content.=$this->doc->startPage('');
00148
00149
00150 // Initialize TCeforms - for rendering the field:
00151 $tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
00152 $tceforms->initDefaultBEMode(); // Init...
00153 $tceforms->disableWizards = 1; // SPECIAL: Disables all wizards - we are NOT going to need them.
00154 $tceforms->colorScheme[0]=$this->doc->bgColor; // SPECIAL: Setting background color of the RTE to ordinary background
00155
00156 // Initialize style for RTE object:
00157 $RTEobj = &t3lib_BEfunc::RTEgetObj(); // Getting reference to the RTE object used to render the field!
00158 if ($RTEobj->ID == 'rte') {
00159 $RTEobj->RTEdivStyle = 'position:relative; left:0px; top:0px; height:100%; width:100%; border:solid 0px;'; // SPECIAL: Setting style for the RTE <DIV> layer containing the IFRAME
00160 # $RTEobj->RTEdivStyle = 'position:relative; left:0px; top:0px; height:600px; width:100%; border:solid 0px;'; // SPECIAL: Setting style for the RTE <DIV> layer containing the IFRAME
00161 }
00162
00163 // Fetching content of record:
00164 $trData = t3lib_div::makeInstance('t3lib_transferData');
00165 $trData->lockRecords=1;
00166 $trData->fetchRecord($this->P['table'],$this->P['uid'],'');
00167
00168 // Getting the processed record content out:
00169 reset($trData->regTableItems_data);
00170 $rec = current($trData->regTableItems_data);
00171 $rec['uid'] = $this->P['uid'];
00172 $rec['pid'] = $rawRec['pid'];
00173
00174 // Making the toolbar:
00175 $closeUrl = $this->P['returnUrl'];
00176 $R_URI=t3lib_div::linkThisScript(array('popView'=>''));
00177
00178 // Getting settings for the undo button:
00179 $undoButton = 0;
00180 $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename="'.$GLOBALS['TYPO3_DB']->quoteStr($this->P['table'], 'sys_history').'" AND recuid="'.$GLOBALS['TYPO3_DB']->quoteStr($this->P['uid'], 'sys_history').'"', '', 'tstamp DESC', '1');
00181 if ($undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) {
00182 $undoButton = 1;
00183 }
00184
00185 // ShortCut
00186 if ($BE_USER->mayMakeShortcut()) {
00187 $sCut = $this->doc->makeShortcutIcon('P','',$this->MCONF['name'],1);
00188 } else {
00189 $sCut ='';
00190 }
00191
00192
00193 // Make Toolbar of buttons:
00194 $toolBarButtons=array();
00195
00196 // Save:
00197 $toolBarButtons[]=
00198 '<a href="#" onclick="TBE_EDITOR_checkAndDoSubmit(1); return false;">'.
00199 '<img'.t3lib_iconWorks::skinImg($this->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="" />'.
00200 '</a>';
00201
00202 // Save/View:
00203 if (t3lib_extMgm::isLoaded('cms')) {
00204 $toolBarButtons[]=
00205 '<a href="#" onclick="'.htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR_checkAndDoSubmit(1); return false;').'">'.
00206 '<img'.t3lib_iconWorks::skinImg($this->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="" />'.
00207 '</a>';
00208 }
00209 // Close:
00210 $toolBarButtons[]=
00211 '<a href="#" onclick="'.htmlspecialchars('jumpToUrl(unescape(\''.rawurlencode($closeUrl).'\')); return false;').'">'.
00212 '<img'.t3lib_iconWorks::skinImg($this->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="" />'.
00213 '</a>';
00214
00215 // Undo/Revert:
00216 if ($undoButton) {
00217 $toolBarButtons[]=
00218 '<a href="#" onclick="'.htmlspecialchars('document.location=\'show_rechis.php?element='.rawurlencode($this->P['table'].':'.$this->P['uid']).'&revert='.rawurlencode('field:'.$this->P['field']).'&sumUp=-1&returnUrl='.rawurlencode($R_URI).'\'; return false;').'">'.
00219 '<img'.t3lib_iconWorks::skinImg($this->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="" />'.
00220 '</a>';
00221 }
00222
00223 $panel = '<span class="c-saveButtons">'.implode('',$toolBarButtons).'</span>';
00224
00225
00226 // TSconfig, setting width:
00227 $fieldTSConfig = $tceforms->setTSconfig($this->P['table'],$rec,$this->P['field']);
00228 if (strcmp($fieldTSConfig['RTEfullScreenWidth'],'')) {
00229 $width=$fieldTSConfig['RTEfullScreenWidth'];
00230 } else {
00231 $width='500';
00232 }
00233
00234 // Get the form field and wrap it in the table with the buttons:
00235 $formContent = $tceforms->getSoloField($this->P['table'],$rec,$this->P['field']);
00236 $formContent = '
00237
00238
00239 <!--
00240 RTE wizard:
00241 -->
00242 <table border="0" cellpadding="0" cellspacing="0" width="'.$width.'" id="typo3-rtewizard">
00243 <tr>
00244 <td>'.$panel.'</td>
00245 <td align="right">'.$sCut.'</td>
00246 <td></td>
00247 </tr>
00248 <tr>
00249 <td width="'.$width.'" colspan="2" id="c-formContent">'.$formContent.'</td>
00250 <td></td>
00251 </tr>
00252 </table>';
00253
00254 // Adding hidden fields:
00255 $formContent.= '<input type="hidden" name="redirect" value="'.htmlspecialchars($R_URI).'" />
00256 <input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" />';
00257
00258
00259 // Finally, add the whole setup:
00260 $this->content.=
00261 $tceforms->printNeededJSFunctions_top().
00262 $formContent.
00263 $tceforms->printNeededJSFunctions();
00264 } else {
00265 // ERROR:
00266 $this->content.=$this->doc->startPage('');
00267 $this->content.=$this->doc->section($LANG->getLL('forms_title'),'<span class="typo3-red">'.$LANG->getLL('table_noData',1).'</span>',0,1);
00268 }
00269
00270 // Ending page:
00271 $this->content.=$this->doc->endPage();
00272 }
|
|
|
Outputting the accumulated content to screen.
Definition at line 279 of file wizard_rte.php. 00279 {
00280 echo $this->content;
00281 }
|
|
|
Definition at line 85 of file wizard_rte.php. |
|
|
Definition at line 84 of file wizard_rte.php. |
|
|
Definition at line 88 of file wizard_rte.php. |
|
|
Definition at line 89 of file wizard_rte.php. |
1.3.8-20040913