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 ($versionRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->P['table'], $this->P['uid'], 'uid')) {
00128 $this->P['uid'] = $versionRec['uid'];
00129 }
00130
00131
00132 if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'],$this->P['uid'])) {
00133
00134
00135 $rawRec = t3lib_BEfunc::getRecord($this->P['table'],$this->P['uid']);
00136 t3lib_BEfunc::fixVersioningPid($this->P['table'], $rawRec);
00137
00138
00139 $this->doc->JScode = $this->doc->wrapScriptTags('
00140 function jumpToUrl(URL,formEl) {
00141 if (document.editform) {
00142 if (!TBE_EDITOR.isFormChanged()) {
00143 window.location.href = URL;
00144 } else if (formEl) {
00145 if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
00146 }
00147 } else window.location.href = URL;
00148 }
00149 '.($this->popView ? t3lib_BEfunc::viewOnClick($rawRec['pid'],'',t3lib_BEfunc::BEgetRootLine($rawRec['pid'])) : '').'
00150 ');
00151
00152
00153 $this->content.=$this->doc->startPage('');
00154
00155
00156
00157 $tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
00158 $tceforms->initDefaultBEMode();
00159 $tceforms->disableWizards = 1;
00160 $tceforms->colorScheme[0]=$this->doc->bgColor;
00161
00162
00163 $RTEobj = &t3lib_BEfunc::RTEgetObj();
00164 if ($RTEobj->ID == 'rte') {
00165 $RTEobj->RTEdivStyle = 'position:relative; left:0px; top:0px; height:100%; width:100%; border:solid 0px;';
00166 # $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
00167 }
00168
00169
00170 $trData = t3lib_div::makeInstance('t3lib_transferData');
00171 $trData->lockRecords=1;
00172 $trData->fetchRecord($this->P['table'],$this->P['uid'],'');
00173
00174
00175 reset($trData->regTableItems_data);
00176 $rec = current($trData->regTableItems_data);
00177 $rec['uid'] = $this->P['uid'];
00178 $rec['pid'] = $rawRec['pid'];
00179
00180
00181 $closeUrl = $this->P['returnUrl'];
00182 $R_URI=t3lib_div::linkThisScript(array('popView'=>''));
00183
00184
00185 $undoButton = 0;
00186 $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');
00187 if ($undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) {
00188 $undoButton = 1;
00189 }
00190
00191
00192 if ($BE_USER->mayMakeShortcut()) {
00193 $sCut = $this->doc->makeShortcutIcon('P','',$this->MCONF['name'],1);
00194 } else {
00195 $sCut ='';
00196 }
00197
00198
00199
00200 $toolBarButtons=array();
00201
00202
00203 $toolBarButtons[]=
00204 '<a href="#" onclick="TBE_EDITOR.checkAndDoSubmit(1); return false;">'.
00205 '<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="" />'.
00206 '</a>';
00207
00208
00209 if (t3lib_extMgm::isLoaded('cms')) {
00210 $toolBarButtons[]=
00211 '<a href="#" onclick="'.htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR.checkAndDoSubmit(1); return false;').'">'.
00212 '<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="" />'.
00213 '</a>';
00214 }
00215
00216 $toolBarButtons[] = '<input type="image" class="c-inputButton" onclick="'.htmlspecialchars('document.editform.redirect.value=\''.$closeUrl.'\'; TBE_EDITOR.checkAndDoSubmit(1); return false;').'" name="_saveandclosedok"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/saveandclosedok.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc',1).'" />';
00217
00218 $toolBarButtons[]=
00219 '<a href="#" onclick="'.htmlspecialchars('jumpToUrl(unescape(\''.rawurlencode($closeUrl).'\')); return false;').'">'.
00220 '<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="" />'.
00221 '</a>';
00222
00223
00224 if ($undoButton) {
00225 $toolBarButtons[]=
00226 '<a href="#" onclick="'.htmlspecialchars('window.location.href=\'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;').'">'.
00227 '<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="" />'.
00228 '</a>';
00229 }
00230
00231 $panel = '<span class="c-saveButtons">'.implode('',$toolBarButtons).'</span>';
00232
00233
00234
00235 $fieldTSConfig = $tceforms->setTSconfig($this->P['table'],$rec,$this->P['field']);
00236 if (strcmp($fieldTSConfig['RTEfullScreenWidth'],'')) {
00237 $width=$fieldTSConfig['RTEfullScreenWidth'];
00238 } else {
00239 $width='500';
00240 }
00241
00242
00243 $formContent = $tceforms->getSoloField($this->P['table'],$rec,$this->P['field']);
00244 $formContent = '
00245
00246
00247 <!--
00248 RTE wizard:
00249 -->
00250 <table border="0" cellpadding="0" cellspacing="0" width="'.$width.'" id="typo3-rtewizard">
00251 <tr>
00252 <td>'.$panel.'</td>
00253 <td align="right">'.$sCut.'</td>
00254 <td></td>
00255 </tr>
00256 <tr>
00257 <td width="'.$width.'" colspan="2" id="c-formContent">'.$formContent.'</td>
00258 <td></td>
00259 </tr>
00260 </table>';
00261
00262
00263 $formContent.= '<input type="hidden" name="redirect" value="'.htmlspecialchars($R_URI).'" />
00264 <input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" />';
00265
00266
00267
00268 $this->content.=
00269 $tceforms->printNeededJSFunctions_top().
00270 $formContent.
00271 $tceforms->printNeededJSFunctions();
00272 } else {
00273
00274 $this->content.=$this->doc->startPage('');
00275 $this->content.=$this->doc->section($LANG->getLL('forms_title'),'<span class="typo3-red">'.$LANG->getLL('table_noData',1).'</span>',0,1);
00276 }
00277
00278 }
00279
00285 function printContent() {
00286 $this->content.= $this->doc->endPage();
00287 $this->content = $this->doc->insertStylesAndJS($this->content);
00288 echo $this->content;
00289 }
00290
00298 function checkEditAccess($table,$uid) {
00299 global $BE_USER;
00300
00301 $calcPRec = t3lib_BEfunc::getRecord($table,$uid);
00302 t3lib_BEfunc::fixVersioningPid($table,$calcPRec);
00303 if (is_array($calcPRec)) {
00304 if ($table=='pages') {
00305 $CALC_PERMS = $BE_USER->calcPerms($calcPRec);
00306 $hasAccess = $CALC_PERMS&2 ? TRUE : FALSE;
00307 } else {
00308 $CALC_PERMS = $BE_USER->calcPerms(t3lib_BEfunc::getRecord('pages',$calcPRec['pid']));
00309 $hasAccess = $CALC_PERMS&16 ? TRUE : FALSE;
00310 }
00311
00312
00313 if ($hasAccess) {
00314 $hasAccess = $BE_USER->recordEditAccessInternals($table, $calcPRec);
00315 }
00316 } else $hasAccess = FALSE;
00317
00318 return $hasAccess;
00319 }
00320 }
00321
00322
00323 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_rte.php']) {
00324 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_rte.php']);
00325 }
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339 $SOBE = t3lib_div::makeInstance('SC_wizard_rte');
00340 $SOBE->init();
00341 $SOBE->main();
00342 $SOBE->printContent();
00343 ?>