00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00054 $BACK_PATH='';
00055 require ('init.php');
00056 require ('template.php');
00057 $LANG->includeLLFile('EXT:lang/locallang_wizards.xml');
00058 require_once (PATH_t3lib.'class.t3lib_tceforms.php');
00059 require_once (PATH_t3lib.'class.t3lib_loaddbgroup.php');
00060 require_once (PATH_t3lib.'class.t3lib_transferdata.php');
00061
00062 t3lib_BEfunc::lockRecords();
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00081 class SC_wizard_rte {
00082
00083
00084 var $doc;
00085 var $content;
00086
00087
00088 var $P;
00089 var $popView;
00090
00091
00092
00093
00099 function init() {
00100 global $BACK_PATH;
00101
00102
00103 $this->P = t3lib_div::_GP('P');
00104 $this->popView = t3lib_div::_GP('popView');
00105
00106
00107 $this->MCONF['name']='xMOD_wizard_rte.php';
00108
00109
00110 $this->doc = t3lib_div::makeInstance('mediumDoc');
00111 $this->doc->docType = 'xhtml_trans';
00112 $this->doc->divClass = '';
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 }
00117
00123 function main() {
00124 global $BE_USER,$LANG;
00125
00126
00127 if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'],$this->P['uid'])) {
00128
00129
00130 $rawRec = t3lib_BEfunc::getRecord($this->P['table'],$this->P['uid']);
00131
00132
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
00147 $this->content.=$this->doc->startPage('');
00148
00149
00150
00151 $tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
00152 $tceforms->initDefaultBEMode();
00153 $tceforms->disableWizards = 1;
00154 $tceforms->colorScheme[0]=$this->doc->bgColor;
00155
00156
00157 $RTEobj = &t3lib_BEfunc::RTEgetObj();
00158 if ($RTEobj->ID == 'rte') {
00159 $RTEobj->RTEdivStyle = 'position:relative; left:0px; top:0px; height:100%; width:100%; border:solid 0px;';
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
00164 $trData = t3lib_div::makeInstance('t3lib_transferData');
00165 $trData->lockRecords=1;
00166 $trData->fetchRecord($this->P['table'],$this->P['uid'],'');
00167
00168
00169 reset($trData->regTableItems_data);
00170 $rec = current($trData->regTableItems_data);
00171 $rec['uid'] = $this->P['uid'];
00172 $rec['pid'] = $rawRec['pid'];
00173
00174
00175 $closeUrl = $this->P['returnUrl'];
00176 $R_URI=t3lib_div::linkThisScript(array('popView'=>''));
00177
00178
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
00186 if ($BE_USER->mayMakeShortcut()) {
00187 $sCut = $this->doc->makeShortcutIcon('P','',$this->MCONF['name'],1);
00188 } else {
00189 $sCut ='';
00190 }
00191
00192
00193
00194 $toolBarButtons=array();
00195
00196
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
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
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
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
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
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
00255 $formContent.= '<input type="hidden" name="redirect" value="'.htmlspecialchars($R_URI).'" />
00256 <input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" />';
00257
00258
00259
00260 $this->content.=
00261 $tceforms->printNeededJSFunctions_top().
00262 $formContent.
00263 $tceforms->printNeededJSFunctions();
00264 } else {
00265
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
00271 $this->content.=$this->doc->endPage();
00272 }
00273
00279 function printContent() {
00280 echo $this->content;
00281 }
00282
00290 function checkEditAccess($table,$uid) {
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') {
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']));
00301 $hasAccess = $CALC_PERMS&16 ? TRUE : FALSE;
00302 }
00303
00304
00305 if ($hasAccess) {
00306 $hasAccess = $BE_USER->recordEditAccessInternals($table, $calcPRec);
00307 }
00308 } else $hasAccess = FALSE;
00309
00310 return $hasAccess;
00311 }
00312 }
00313
00314
00315 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_rte.php']) {
00316 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_rte.php']);
00317 }
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331 $SOBE = t3lib_div::makeInstance('SC_wizard_rte');
00332 $SOBE->init();
00333 $SOBE->main();
00334 $SOBE->printContent();
00335 ?>